mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-11 23:45:11 +08:00
重构并精简了部分UI组件,移除冗余弹窗与详情组件,新增NPC相关逻辑(npcBehaviorLogic、npcGrowthLogic、npcStore等)及外交逻辑(diplomaticLogic、DiplomacyView)。完善分页、标签、复选框等通用UI组件。优化战报弹窗,调整README下载链接为相对路径,修复部分国际化内容。
1 line
8.3 KiB
JavaScript
1 line
8.3 KiB
JavaScript
import{An as e,Cn as t,Fn as n,Jt as r,Ln as i,Mn as a,Nn as o,Pn as s,Un as c,Vn as l,an as u,jn as d,kn as f,on as p,un as m}from"./game-logic-Bi1l7y4K.js";var h=typeof window<`u`,g,_=e=>g=e,v=Symbol();function y(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var b;(function(e){e.direct=`direct`,e.patchObject=`patch object`,e.patchFunction=`patch function`})(b||={});var x=(()=>typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null})();function S(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function C(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){O(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function w(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function T(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var E=typeof navigator==`object`?navigator:{userAgent:``},D=(()=>/Macintosh/.test(E.userAgent)&&/AppleWebKit/.test(E.userAgent)&&!/Safari/.test(E.userAgent))(),O=h?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!D?k:`msSaveOrOpenBlob`in E?A:j:()=>{};function k(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?T(r):w(r.href)?C(e,t,n):(r.target=`_blank`,T(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){T(r)},0))}function A(e,t=`download`,n){if(typeof e==`string`)if(w(e))C(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){T(t)})}else navigator.msSaveOrOpenBlob(S(e,n),t)}function j(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return C(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(x.HTMLElement))||`safari`in x,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||D)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:ee}=Object;function M(){let e=f(!0),t=e.run(()=>i({})),n=[],r=[],a=o({install(e){_(a),a._a=e,e.provide(v,a),e.config.globalProperties.$pinia=a,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return a}var N=()=>{};function P(t,n,r,i=N){t.add(n);let a=()=>{t.delete(n)&&i()};return!r&&e()&&s(a),a}function F(e,...t){e.forEach(e=>{e(...t)})}var I=e=>e(),L=Symbol(),R=Symbol();function z(e,t){for(let n in e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e),t){if(!t.hasOwnProperty(n))continue;let r=t[n],i=e[n];y(i)&&y(r)&&e.hasOwnProperty(n)&&!a(r)&&!d(r)?e[n]=z(i,r):e[n]=r}return e}var B=Symbol();function V(e){return!y(e)||!Object.prototype.hasOwnProperty.call(e,B)}var{assign:H}=Object;function U(e){return!!(a(e)&&e.effect)}function W(e,t,n,i){let{state:a,actions:s,getters:l}=t,u=n.state.value[e],d;function f(){return u||(n.state.value[e]=a?a():{}),H(c(n.state.value[e]),s,Object.keys(l||{}).reduce((t,i)=>(t[i]=o(r(()=>{_(n);let t=n._s.get(e);return l[i].call(t,t)})),t),{}))}return d=G(e,f,t,n,i,!0),d}function G(e,r,o={},s,c,u){let p,h=H({actions:{}},o),g={deep:!0},v,y,x=new Set,S=new Set,C=s.state.value[e];!u&&!C&&(s.state.value[e]={}),i({});let w;function T(t){let n;v=y=!1,typeof t==`function`?(t(s.state.value[e]),n={type:b.patchFunction,storeId:e,events:void 0}):(z(s.state.value[e],t),n={type:b.patchObject,payload:t,storeId:e,events:void 0});let r=w=Symbol();m().then(()=>{w===r&&(v=!0)}),y=!0,F(x,n,s.state.value[e])}let E=u?function(){let{state:e}=o,t=e?e():{};this.$patch(e=>{H(e,t)})}:N;function D(){p.stop(),x.clear(),S.clear(),s._s.delete(e)}let O=(t,n=``)=>{if(L in t)return t[R]=n,t;let r=function(){_(s);let n=Array.from(arguments),i=new Set,a=new Set;function o(e){i.add(e)}function c(e){a.add(e)}F(S,{args:n,name:r[R],store:k,after:o,onError:c});let l;try{l=t.apply(this&&this.$id===e?this:k,n)}catch(e){throw F(a,e),e}return l instanceof Promise?l.then(e=>(F(i,e),e)).catch(e=>(F(a,e),Promise.reject(e))):(F(i,l),l)};return r[L]=!0,r[R]=n,r},k=n({_p:s,$id:e,$onAction:P.bind(null,S),$patch:T,$reset:E,$subscribe(n,r={}){let i=P(x,n,r.detached,()=>a()),a=p.run(()=>t(()=>s.state.value[e],t=>{(r.flush===`sync`?y:v)&&n({storeId:e,type:b.direct,events:void 0},t)},H({},g,r)));return i},$dispose:D});s._s.set(e,k);let A=(s._a&&s._a.runWithContext||I)(()=>s._e.run(()=>(p=f()).run(()=>r({action:O}))));for(let t in A){let n=A[t];a(n)&&!U(n)||d(n)?u||(C&&V(n)&&(a(n)?n.value=C[t]:z(n,C[t])),s.state.value[e][t]=n):typeof n==`function`&&(A[t]=O(n,t),h.actions[t]=n)}return H(k,A),H(l(k),A),Object.defineProperty(k,`$state`,{get:()=>s.state.value[e],set:e=>{T(t=>{H(t,e)})}}),s._p.forEach(e=>{H(k,p.run(()=>e({store:k,app:s._a,pinia:s,options:h})))}),C&&u&&o.hydrate&&o.hydrate(k.$state,C),v=!0,y=!0,k}function K(e,t,n){let r,i=typeof t==`function`;r=i?n:t;function a(n,a){let o=u();return n||=o?p(v,null):null,n&&_(n),n=g,n._s.has(e)||(i?G(e,t,r,n):W(e,r,n)),n._s.get(e)}return a.$id=e,a}function q(e,t){if(e==null)return;let n=e;for(let e=0;e<t.length;e++){if(n===void 0||n[t[e]]===void 0)return;if(n===null||n[t[e]]===null)return null;n=n[t[e]]}return n}function J(e,t,n){if(n.length===0)return t;let r=n[0];return n.length>1&&(t=J(typeof e!=`object`||!e||!Object.prototype.hasOwnProperty.call(e,r)?Number.isInteger(Number(n[1]))?[]:{}:e[r],t,Array.prototype.slice.call(n,1))),Number.isInteger(Number(r))&&Array.isArray(e)?e.slice()[r]:Object.assign({},e,{[r]:t})}function Y(e,t){if(e==null||t.length===0)return e;if(t.length===1){if(e==null)return e;if(Number.isInteger(t[0])&&Array.isArray(e))return Array.prototype.slice.call(e,0).splice(t[0],1);let n={};for(let t in e)n[t]=e[t];return delete n[t[0]],n}if(e[t[0]]==null){if(Number.isInteger(t[0])&&Array.isArray(e))return Array.prototype.concat.call([],e);let n={};for(let t in e)n[t]=e[t];return n}return J(e,Y(e[t[0]],Array.prototype.slice.call(t,1)),[t[0]])}function X(e,t){return t.map(e=>e.split(`.`)).map(t=>[t,q(e,t)]).filter(e=>e[1]!==void 0).reduce((e,t)=>J(e,t[1],t[0]),{})}function Z(e,t){return t.map(e=>e.split(`.`)).reduce((e,t)=>Y(e,t),e)}function Q(e,{storage:t,serializer:n,key:r,debug:i,pick:a,omit:o,beforeHydrate:s,afterHydrate:c},l,u=!0){try{u&&s?.(l);let i=t.getItem(r);if(i){let t=n.deserialize(i),r=a?X(t,a):t,s=o?Z(r,o):r;e.$patch(s)}u&&c?.(l)}catch(e){i&&console.error(`[pinia-plugin-persistedstate]`,e)}}function $(e,{storage:t,serializer:n,key:r,debug:i,pick:a,omit:o}){try{let i=a?X(e,a):e,s=o?Z(i,o):i,c=n.serialize(s);t.setItem(r,c)}catch(e){i&&console.error(`[pinia-plugin-persistedstate]`,e)}}function te(e,t){return typeof e==`function`?e(t):typeof e==`string`?e:t}function ne(e,t,n){let{pinia:r,store:i,options:{persist:a=n}}=e;if(!a)return;if(!(i.$id in r.state.value)){let e=r._s.get(i.$id.replace(`__hot:`,``));e&&Promise.resolve().then(()=>e.$persist());return}let o=(Array.isArray(a)?a:a===!0?[{}]:[a]).map(t);i.$hydrate=({runHooks:t=!0}={})=>{o.forEach(n=>{Q(i,n,e,t)})},i.$persist=()=>{o.forEach(e=>{$(i.$state,e)})},o.forEach(t=>{Q(i,t,e),i.$subscribe((e,n)=>$(n,t),{detached:!0})})}function re(e={}){return function(t){ne(t,n=>{let r=te(n.key,t.store.$id);return{key:(e.key?e.key:e=>e)(r),debug:n.debug??e.debug??!1,serializer:n.serializer??e.serializer??{serialize:e=>JSON.stringify(e),deserialize:e=>JSON.parse(e)},storage:n.storage??e.storage??window.localStorage,beforeHydrate:n.beforeHydrate??e.beforeHydrate,afterHydrate:n.afterHydrate??e.afterHydrate,pick:n.pick,omit:n.omit}},e.auto??!1)}}var ie=re();export{M as n,K as r,ie as t}; |