@fox-js/fox 3.1.1-22 → 3.1.1-23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libs/index.cjs.js +1 -1
- package/libs/index.esm.d.ts +2 -3
- package/libs/index.esm.js +189 -189
- package/libs/index.umd.js +1 -1
- package/package.json +1 -1
package/libs/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let m=require("vue");var xe=typeof window<"u",_=function(){return window},Ne=function(){return window.document};function nt(e,t,r,s=!1){e.addEventListener?e.addEventListener(t,r,s):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function zt(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}var Ue=(e,t,r)=>{t=t??{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("Events");let i=!0,n=!0;for(let a in t)a==="bubbles"?i=!!t[a]:a==="cancelable"?n=!!t[a]:s[a]=t[a];s.initEvent(e,i,n),(r??document).dispatchEvent(s)},Ot=Array.isArray,fs=e=>ct(e)==="[object Map]",cs=e=>ct(e)==="[object Set]",hs=e=>e instanceof Date,R=e=>typeof e=="function",ys=e=>typeof e=="string",ds=e=>typeof e=="symbol",_r=e=>e!==null&&typeof e=="object",ms=e=>_r(e)&&R(e.then)&&R(e.catch),Pe=e=>e==null,vs=Object.prototype.toString,ct=e=>vs.call(e),Kr=e=>ct(e)==="[object Object]",ps=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function ht(e){return e.__esModule||ps&&e[Symbol.toStringTag]==="Module"}var gs=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function j(...e){let t=e[0]!==void 0&&e[0]!==null?e[0]:{},r=1,s=e.length,i=!1;for(typeof t=="boolean"&&(i=t,t=e[r]??{},r++),typeof t!="object"&&(t={});r<s;r++)if(e[r]!==null&&e[r]!==void 0){let n=e[r];for(let a in n){let l=t[a],o=n[a];if(l!==o)if(i===!0&&o&&typeof o=="object"){let u;Array.isArray(o)?u=l&&Array.isArray(l)?l:[]:u=l&&typeof l=="object"?l:{},t[a]=j(i,u,o)}else o!==void 0&&(t[a]=o)}}return t}function jr(e,t,r=!1){if(typeof t!="object")return{};typeof e!="object"&&(e={});for(let s of Reflect.ownKeys(t)){let i=e[s],n=t[s];if(i!==n)if(typeof n=="object"){if(!Array.isArray(n)&&!Kr(n))continue;i=jr(i,n,r),e[s]=i}else{if(typeof n=="function")continue;e[s]=n}}return e}var Ie=class Dt{static seed=new Date().getTime();static get(){let t=++Dt.seed;return t>=Number.MAX_VALUE&&(Dt.seed=0),t}},pt=gs?Promise.resolve():null;function Be(e,...t){pt!==null?t&&t.length>0?pt.then(()=>{e(t)}):pt.then(e):t&&t.length>0?setTimeout(()=>{e(t)}):setTimeout(e)}function Gt(e){return e==null?!1:typeof e=="boolean"?e:typeof e=="string"?e.toLocaleLowerCase()==="true":!!e}function ws(e){return typeof e=="number"?e:Number(e)}var bs={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Object]":"object"};function Ht(e){let t=Object.prototype.toString.call(e);return e==null?String(e):bs[t]||"object"}function Nt(e,t){if(e==t)return!0;if(e===void 0||t===void 0)return!1;let r=Ht(e);if(r!==Ht(t))return!1;if(r==="object"){let s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(let n=0;n<s.length;n++){let a=s[n],l=e[a],o=t[a];if(!Nt(l,o))return!1}return!0}else if(r==="array"){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++){let i=e[s],n=t[s];if(!Nt(i,n))return!1}return!0}return!1}var $r=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=$r(s)),typeof r=="symbol"?t[String(r)]=s:t[r]=s}return t},Rs=/^Symbol\((.*)\)$/,qr=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=qr(s));const i=Rs.exec(r);if(i&&i[1]){const n=Symbol.for(i[1]);t[n]=s}else t[r]=s}return t};function Mr(e,t){let r=null;return function(...s){r&&clearTimeout(r),r=setTimeout(()=>{r=null,Reflect.apply(e,null,[...s])},t)}}var or=Symbol("idKey"),ye=Symbol("valueKey"),x=Symbol("childrenKey"),X=Symbol("growKey"),Lr=class{[X]=!0;[or];[ye]=(0,m.ref)();[x]=new Map;constructor(e){this[or]=e}},xs=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];let r=e[x].get(t);if(r)return Oe(r);if(e[X])return r=Qt(t),r[X]=e[X],e[x].set(t,r),Oe(r)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=Gt(r),!0):r==null?(e[x].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}},Xt="__proxy__";function Qt(e){const t=new Lr(e);return Reflect.set(t,Xt,new Proxy(t,new xs)),t}function Oe(e){return Reflect.get(e,Xt)}var Ss=class{name="";persistPolicy="memory";storage;initFlag=!1;state={};constructor(e={},t){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Pe(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage,t&&typeof t=="object"&&Object.assign(this.state,t)}init(e){this.restore(e),this.initFlag=!0}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=_();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`,r=JSON.stringify(this.state??{});e.setItem(t,r)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_bus_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(this.state,i),Reflect.ownKeys(this.state).forEach(n=>{if(typeof n!="string")return;const a=this.state[n],l=n.split(/\//g);l.push(a),Reflect.apply(e.put,e,l)})}}put(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s=e[t-1];this.state[r]=s,this.saveState()}catch(t){console.error(t)}}remove(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s={};Reflect.ownKeys(this.state).forEach(i=>{typeof i=="string"&&(i===r||i.startsWith(r)||(s[i]=this.state[i]))}),this.state=s,this.saveState()}catch(t){console.error(t)}}clear(){if(this.initFlag)try{this.state={},this.removeState()}catch(e){console.error(e)}}},Tr=class extends Lr{_persistHandler;constructor(e={},t){super("__root__"),this._persistHandler=new Ss(e,t),this._persistHandler.init(this)}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let r=this;for(let s=0;s<t-1;s++){let i=e[s],n;r[x].has(i)?n=r[x].get(i):(n=Qt(i),r[x].set(i,n)),r=n}return r[ye].value=e[t-1],this._persistHandler.put(e),!0}get(...e){let t=e.length;if(t===0)return;let r=this;for(let s=0;s<t;s++){let i=e[s];if(r[x].has(i))r=r[x].get(i);else return}return r[ye].value}remove(...e){let t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){const n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)?(r[x].delete(s),this._persistHandler.remove(e),!0):!1}contains(...e){const t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){let n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)}clear(){this[x].clear(),this._persistHandler.clear()}},Ps=["put","get","contains","remove","clear","_persistHandler"];function lr(e){return Ps.includes(e)}var Es=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];if(t===x)return e[x];if(typeof t=="string"&&lr(t))return e[t];const r=String(t);let s=e[x].get(r);if(s)return Oe(s);if(e[X])return s=Qt(r),s[X]=e[X],e[x].set(r,s),Oe(s)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=Gt(r),!0):lr(t)?!1:r==null?(e[x].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}};function Fs(e,t){const r=new Tr(e,t),s=new Es,i=new Proxy(r,s);return Reflect.set(r,Xt,i),r}var Ut=new Proxy(Tr,{construct(e,t){const r=t[0]??{},s=t[1];return Oe(Fs(r,s))}}),Zt=e=>!e||typeof e!="object"?!0:Reflect.ownKeys(e).length===0,kr=class{name="";persistPolicy="memory";storage;constructor(e={}){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Pe(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=_();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null||Zt(e))return;const r=`_state_${this.name}`,s=JSON.stringify(e??{});t.setItem(r,s)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null)return;const t=`_state_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_state_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(e,i)}}};function Ir(e,t,r){const s=new kr(r);s.restore(t);const i=l=>{const o=(0,m.toRaw)(l),u={};for(let f in o){const c=o[f];Pe(c)||(u[f]=c)}Zt(u)?s.removeState():s.saveState(u)};let n=null;r&&r.debounce===!1?n=i:n=Mr(i,r&&r.debounceDelay?r.debounceDelay:250);const a=e?(0,m.shallowReactive)(t):(0,m.reactive)(t);return(0,m.effectScope)(!0).run(()=>{(0,m.watch)(a,l=>{const o=(0,m.toRaw)(l);n(o)})}),a}function Cs(e,t){return Ir(!1,e,t)}function As(e,t){return Ir(!0,e,t)}function _s(e,t){const r=new kr(t);r.restore(e);const s=n=>{const a=(0,m.toRaw)(n),l={};for(let o in a){const u=a[o];Pe(u)||(l[o]=u)}Zt(l)?r.removeState():r.saveState(l)};let i=null;return t&&t.debounce===!1?i=s:i=Mr(s,t&&t.debounceDelay?t.debounceDelay:250),new Proxy(e,{get(n,a){return n[a]},set(n,a,l){return n[a]=l,i(n),!0}})}function Ks(e,t){return _s(e,t)}var Br="default",Or=Symbol("sync"),B=Symbol("normalizeRoute");function ar(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}function js(e){let t=e.src;return new Promise((r,s)=>{const i=ar(l=>{ht(l)&&(l=l.default),e.component=l,console.debug("success load async module"),r()}),n=ar(l=>{`${l}`,console.debug("reject load async module"),s(l)});let a;try{a=t(i,n)}catch(l){n(l)}if(a)if(typeof a.then=="function")a.then(i,n);else{const l=a.component;l&&typeof l.then=="function"&&l.then(i,n)}})}var $s=class{name;level;rootName;rootIndex=0;constructor(e,t,r,s){this.name=e,this.level=t,this.rootName=r,this.rootIndex=s}},Ve=class Dr{to;routeModel;from;data={};constructor(t,r){this.to=t,this.from=r}static from(t){const r=new Dr(t.to,t.from),s=t.data??{};return j(!0,r.data,s),r}static clear(t){for(let r in t)t[r]=void 0}},P=class Vt{path;get fullPath(){const t=this.path??`/${this.name}`;return`${this.root??"default"}!${t}`}alias;name;root;params;query;traceless;template;matched;meta;success;error;destroy;opsType;updateType;historyUpdatePolicy;viewTagAttrs;index;active;slot;static clone(t,r){let s=new Vt;return jr(s,t,r),s}static isSame(t,r){return!t||!r?!1:t===r?!0:t.root!==r.root||t.index!==r.index?!1:t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static isSamePathForRoute(t,r){return!t||!r?!1:t===r||t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static from(t){let r=new Vt;if(t==null)return r;let s=r;for(let n in t)s[n]=t[n];const i=Object.getOwnPropertySymbols(t);if(Array.isArray(i)&&i.length>0)for(let n of i)s[n]=t[n];return r}},qs=class{id;name;props;src;component;constructor(e,t,r){this.id=Ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=r}get isResolved(){return this.component!==void 0}resolve(){return js(this)}},ur=class{models=[]},gt=class{path;match;redirect;name;meta;matchedRoutes;layers=[]},A=(function(e){return e[e.Push=0]="Push",e[e.Replace=1]="Replace",e[e.Put=2]="Put",e[e.Append=3]="Append",e[e.Open=4]="Open",e})({}),Hr="FoxBeforeEnter",Nr="FoxEnter",Ur="FoxLeave",Vr="FoxLeave",ot="FoxLeaveEnd",yt=Symbol("rk"),wt=Symbol("vd"),fr=Symbol("rv"),bt=Symbol("rvi"),cr=Symbol("pv"),Rt=Symbol("pvi"),Ce=Symbol("registerKey"),Ms=class{[Ce]=new Map;constructor(){}set(e,t){this[Ce].set(e,t)}get(e){return this[Ce].get(e)}has(e){return this[Ce].has(e)}delete(e){return this[Ce].delete(e)}},he=Symbol("lc");function lt(e,t=!1){let r=e;if(Reflect.has(r,he))return r[he];if(t){const s=new Ms;return r[he]=s,s}return null}function Wr(e,t=!1){let r=null,s=e;for(;s&&!(Reflect.has(s,he)&&(r=s[he],r));)s=s.$parent;if(!r&&t){const i=e;i&&i.$parent&&(r=lt(i.$parent,t))}return r}function Yt(e,t){let r=e;for(;r;){if(Reflect.has(r,he)){const s=r[he];if(s.has(t))return s.get(t)}r=r.$parent}return null}function Ls(e,t,r){Wr(e,!0)?.set(t,r)}function Ts(e,t){Wr(e,!0)?.delete(t)}function hr(e){if(Array.isArray(e.children)&&e.children.length>0){let t=e.children[0];if(t!=null&&t.component!=null&&t.component.proxy!=null)return lt(t.component.proxy,!1)}return null}var at=Symbol("hooksKey");function ks(e){let t=e.get(at);t||(t=[],e.set(at,t))}function yr(e,t){let r=e.get(at);if(r!=null)for(let s=r.length-1;s>=0;s--){let i=r[s];if(i.type===t)try{Reflect.apply(i.hook,i.target,[])}catch(n){console.error(n.message,n)}}}var ut=(function(e){return e.DEACTIVATED="da",e.ACTIVATED="a",e})({}),Is=class{type;hook;target;constructor(e,t,r){this.target=r,this.hook=t,this.type=e}};function Bs(e,t,r,s){let i=new Is(t,r,s);return e.push(i),!0}function Os(e,t,r,s){let i=-1;for(let n=0;n<e.length;n++){let a=e[n];if(a.type===t&&a.hook===r&&a.target===s){i=n;break}}return i!=-1?(e.splice(i,1),!0):!1}function Jr(e){return(t,r)=>{let s;if(r)s=r;else{const n=(0,m.getCurrentInstance)();if(n==null||n.proxy==null){console.error("can not get current instance or proxy");return}s=n.proxy}const i=Yt(s,at);if(i==null){console.warn("hooks context not found");return}(0,m.onUnmounted)(()=>{Os(i,e,t,s)}),Bs(i,e,t,s)}}var Ds=Jr(ut.ACTIVATED),Hs=Jr(ut.DEACTIVATED),zr=Symbol("routeKey");function dr(e,t){e.set(zr,t)}function er(e){let t=Yt(e,zr);return typeof t=="function"?t():t??null}function Gr(e,t=!1){let r=null;return t?r=e.showFromClass??e.enterFromClass:r=e.enterFromClass,r||(r=e.transitionName,r?t?`${r}-show-from`:`${r}-enter-from`:null)}function Xr(e,t=!1){let r=null;return t?r=e.showActiveClass??e.enterActiveClass:r=e.enterActiveClass,r||(r=e.transitionName,r?t?`${r}-show-active`:`${r}-enter-active`:null)}function Ns(e,t=!1){let r=null;return t?r=e.showToClass??e.enterToClass:r=e.enterToClass,r||(r=e.transitionName,r?t?`${r}-show-to`:`${r}-enter-to`:null)}function Qr(e,t=!1){let r=null;return t?r=e.hideFromClass??e.leaveFromClass:r=e.leaveFromClass,r||(r=e.transitionName,r?t?`${r}-hide-from`:`${r}-leave-from`:null)}function Zr(e,t=!1){let r=null;return t?r=e.hideActiveClass??e.leaveActiveClass:r=e.leaveActiveClass,r||(r=e.transitionName,r?t?`${r}-hide-active`:`${r}-leave-active`:null)}function Us(e,t=!1){let r=null;return t?r=e.hideToClass??e.leaveToClass:r=e.leaveToClass,r||(r=e.transitionName,r?t?`${r}-hide-to`:`${r}-leave-to`:null)}function Vs(e,t=!1){let r=null;return t?r=e.beforeShow??e.beforeEnter:r=e.beforeEnter,r}function Ws(e,t=!1){let r=null;return t?r=e.show??e.enter:r=e.enter,r}function Js(e,t=!1){let r=null;return t?r=e.afterShow??e.afterEnter:r=e.afterEnter,r}function zs(e,t=!1){let r=null;return t?r=e.showCancelled??e.enterCancelled:r=e.enterCancelled,r}function Gs(e,t=!1){let r=null;return t?r=e.beforeHide??e.beforeLeave:r=e.beforeLeave,r}function Xs(e,t=!1){let r=null;return t?r=e.hide??e.leave:r=e.leave,r}function Qs(e,t=!1){let r=null;return t?r=e.afterHide??e.afterLeave:r=e.afterLeave,r}function Zs(e,t=!1){let r=null;return t?r=e.hideCancelled??e.leaveCancelled:r=e.leaveCancelled,r}function tr(e){let t,r=e.transitionDuration;return typeof r=="object"?t={enter:r.enter??-1,leave:r.leave??-1,show:r.show??-1,hide:r.hide??-1}:(typeof r=="string"&&(r=r.length==0?-1:Number(r)),t={enter:r,leave:r,show:r,hide:r}),t}function Se(e,t){e.classList.contains(t)||e.classList.add(t)}function Re(e,t){e.classList.remove(t)}var Ys=xe&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function dt(e){Ys(e)}function K(e,t,r){R(t)&&(e==null&&(e={}),Reflect.apply(t,e,r))}function Yr(e,t,r,s=-1,i,n,a){let l=[];const o=()=>{for(let u of l)zt(t,u.type,u.listener);l=[]};if(R(n)){if(i!==void 0&&i>=0){setTimeout(()=>{Reflect.apply(n,e,[t,r,s])},i);return}const u=["animationend","transitionend",ot],f=c=>{(c.target||c.srcElement)===c.currentTarget&&(o(),Reflect.apply(n,e,[t,r,s]))};u.forEach(c=>{nt(t,c,f),l.push({type:c,listener:f})})}if(R(a)){const u="animationcancel",f=c=>{(c.target||c.srcElement)===c.currentTarget&&(o(),Reflect.apply(a,e,[t,r,s]))};nt(t,u,f),l.push({type:u,listener:f})}}function mt(e){return!xe||e===null?!1:e.opsType===A.Append||e.opsType===A.Open}function es(e,t,r,s={},i,n=-1){if(t||mt(i)){const a=Gr(s,t);a&&Se(r,a);const l=Xr(s,t);l&&Se(r,l),K(e,Vs(s,t),[r,t,i,n])}}function ts(e,t,r,s={},i,n,a,l){if(!mt(n)&&!t){R(l)&&l(e,l,[r]);return}const o=Gr(s,t),u=Xr(s,t),f=Ns(s,t),c=Ws(s,t),h=Js(s,t),y=zs(s,t);if(!o&&!u&&!f&&!c){R(l)&&l(e,l,[r]);return}dt(()=>{Yr(e,r,n,a,i,()=>{u&&Re(r,u),f&&Re(r,f),R(h)&&K(e,h,[r,t,n,a]),R(l)&&l(e,l,[r])},()=>{R(y)&&K(e,y,[r,t,n,a])}),o&&Re(r,o),f&&Se(r,f),R(c)&&K(e,c,[r,t,n,a])})}function rs(e,t,r,s={},i,n=-1){if(t||mt(i)){const a=Qr(s,t);a&&Se(r,a);const l=Zr(s,t);l&&Se(r,l),K(e,Gs(s,t),[r,t,i,n])}}function ss(e,t,r,s={},i,n,a,l,o){if(!mt(a)&&!t){R(o)&&K(e,o,[r]),!t&&R(n)&&n();return}const u=Qr(s,t),f=Zr(s,t),c=Us(s,t),h=Xs(s,t),y=Qs(s,t),d=Zs(s,t);if(!u&&!f&&!c&&!h){R(o)&&K(e,o,[r]),!t&&R(n)&&n();return}dt(()=>{Yr(e,r,a,l,i,()=>{try{f&&Re(r,f),c&&Re(r,c),R(y)&&K(e,y,[r,t,a,l]),R(o)&&K(e,o,[r])}finally{!t&&R(n)&&n()}},()=>{try{R(d)&&K(e,d,[r,t,a,l]),R(o)&&K(e,o,[r])}finally{!t&&R(n)&&n()}}),u&&Re(r,u),c&&Se(r,c),R(h)&&K(e,h,[r,t,a,l])})}function Wt(e,t,r={},s,i=-1){const n=r.mode??"default",a=tr(r);return{mode:n,persisted:!1,beforeEnter:l=>{es(e,!1,l,r,s,i)},enter:l=>{ts(e,!1,l,r,a.enter,s,i)},leave:(l,o)=>{rs(e,!1,l,r,s,i),ss(e,!1,l,r,a.leave,o,s,i,()=>{t.transition=null,t=null})},clone:l=>Wt(e,t,r,s,i)}}function is(e){return e.el}function ei(e,t,r={},s,i,n,a){if(n===!0){const l=is(t);if(l==null)return;const o=tr(r);es(e,!0,l,r,s,i),ts(e,!0,l,r,o.show,s,i,u=>{R(a)&&K(e,a,[u])})}else R(a)&&K(e,a,[])}function ti(e,t,r={},s,i,n,a){if(n===!0){const l=is(t);if(l==null)return;const o=tr(r);rs(e,!0,l,r,s,i),ss(e,!0,l,r,o.hide,null,s,i,u=>{R(a)&&K(e,a,[u])})}else R(a)&&K(e,a,[])}function ri(e,t={}){dt(()=>{for(let r=0;r<e.length;r++)Reflect.apply(e[r],t,[])})}function ns(e,t,r={},s,i=-1){return{mode:r.mode??"default",persisted:!1,beforeEnter:n=>{Ue(Hr,{},n)},enter:n=>{Ue(Nr,{},n)},leave:(n,a)=>{Ue(Ur,{},n),dt(()=>{const l=o=>{(o.target||o.srcElement)===o.currentTarget&&(zt(n,ot,l),a&&Reflect.apply(a,e,[]),t.transition=null,t=null)};nt(n,ot,l),Ue(Vr,{},n)})},clone:n=>ns(e,t,r,s,i)}}var G=Symbol("rootKey"),z=Symbol("rootNodeKey"),fe=Symbol("parentNodeKey"),st=Symbol("nameKey"),te=class{instance=null;model;route;active=!0;index=0;constructor(e,t,r=0,s=!0){this.route=e,this.model=t,this.index=r,this.active=s}},Ae=class{_slots;get slots(){return this._slots==null&&(this._slots=(0,m.shallowRef)([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[st];[G];[z]=null;[fe]=null;get name(){return this[st]}constructor(e,t,r){this[st]=e,this[G]=t,r&&(this[z]=r)}},O=class{view;index;level;constructor(e,t,r){this.view=e,this.index=t,this.level=r}static include(e,t){for(let r=0;r<e.length;r++){let s=e[r];if(s.view===t.view&&(t.index==-1||s.index===t.index)&&s.level===t.level)return!0}return!1}},xt=class{views=[]},si=class{layers=[]};function re(e,t,r){return typeof e=="function"?Reflect.apply(e,{},[t,r]):e}function St(e,t){if(!e)return null;const r=e(t);return r.length===1?r[0]:r}function me(e,t){return typeof t=="function"?t(e):e}var ii=class{node;state;constructor(e,t){this.node=e,this.state=t}},ft=(0,m.defineComponent)({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,required:!1,default:"default"},modelSlot:{type:[Object],required:!1},multi:{type:Boolean,required:!1,default:!1},tag:{type:[String,Object,Function],required:!1,default:"div"},viewTag:{type:[String,Object,Function],required:!1,default:"div"},viewTagProps:{type:[Object,Function],required:!1,default(){return{}}},viewClass:{type:[String,Function],required:!1},viewActiveClass:{type:[String,Function],required:!1},viewInactiveClass:{type:[String,Function],required:!1},transition:{type:[Boolean,String,Function],required:!1,default:!1},transitionName:{type:String,required:!1},transitionDuration:{type:[String,Number,Object],required:!1},enterFromClass:{type:String,required:!1},enterActiveClass:{type:String,required:!1},enterToClass:{type:String,required:!1},leaveFromClass:{type:String,required:!1},leaveActiveClass:{type:String,required:!1},leaveToClass:{type:String,required:!1},showFromClass:{type:String,required:!1},showActiveClass:{type:String,required:!1},showToClass:{type:String,required:!1},hideFromClass:{type:String,required:!1},hideActiveClass:{type:String,required:!1},hideToClass:{type:String,required:!1},beforeEnter:{type:Function,required:!1},enter:{type:Function,required:!1},afterEnter:{type:Function,required:!1},enterCancelled:{type:Function,required:!1},beforeLeave:{type:Function,required:!1},leave:{type:Function,required:!1},afterLeave:{type:Function,required:!1},leaveCancelled:{type:Function,required:!1},beforeShow:{type:Function,required:!1},show:{type:Function,required:!1},afterShow:{type:Function,required:!1},showCancelled:{type:Function,required:!1},beforeHide:{type:Function,required:!1},hide:{type:Function,required:!1},afterHide:{type:Function,required:!1},hideCancelled:{type:Function,required:!1}},setup(e,t){const r=(0,m.getCurrentInstance)();if(r===null||r.proxy===null){console.error("instance or instance.proxy not exist");return}const s=e.multi===!0,i=(0,m.inject)(yt,null),n=(0,m.inject)(wt,0),a=(0,m.inject)(fr,null),l=(0,m.inject)(bt,-1);let o=null,u=e.modelSlot;if(u){if((0,m.provide)(wt,n+1),(0,m.provide)(bt,u.index),(0,m.provide)(Rt,u.index),!u.route){console.warn("child view render error, route not exist");return}const c=lt(r.proxy,!0);ks(c),dr(c,()=>u?.route??null)}else{if(i==null){console.error("router is not been injected");return}const c=e.name,h=(0,m.inject)(cr,null),y=(0,m.inject)(Rt,0);if(o=i[Or](c,n,a,l,h,y),o===null)return;(0,m.provide)(cr,o);const d=o[G]===!0;d&&(0,m.provide)(fr,o),s||((0,m.provide)(bt,-1),(0,m.provide)(wt,n+1),(0,m.provide)(Rt,-1),d&&dr(lt(r.proxy,!0),()=>{const v=o.slots.value;return v.length>0?v[0].route:null}))}const f={value:new Map};return(0,m.onUnmounted)(()=>{if(f.value&&f.value.clear(),u){const c=u;c.route=null,c.model=null,c.instance=null,u=void 0}}),()=>{if(s){const c=new Map,h=[],y=o?.slots.value,d=[];for(let w=0;w<y.length;w++){const p=y[w],M=`${e.name}_${p.index}`,L=re(e.transition,p.route,w)??!0,Ee={modelSlot:p};let T;t.slots.default?T=(0,m.h)(ft,Ee,{default:t.slots.default}):T=(0,m.h)(ft,Ee);const $={},ne=re(e.viewClass,p.route,w);typeof ne=="string"&&ne.length>0&&($[ne]=!0);const ee=re(e.viewActiveClass,p.route,w),k=re(e.viewInactiveClass,p.route,w),Q=f.value.get(M);if(typeof ee=="string"&&ee.length>0&&($[ee]=p.active),typeof k=="string"&&k.length>0&&($[k]=!p.active),Q&&p.active!==Q.state){const He=Q.node;p.active?d.unshift(()=>{const vt=()=>{let Fe=hr(He);Fe!=null&&yr(Fe,ut.ACTIVATED)};ei(r,He,e,p.route,w,L,vt)}):d.push(()=>{const vt=()=>{const Fe=hr(He);Fe!=null&&yr(Fe,ut.DEACTIVATED)};ti(r,He,e,p.route,w,L,vt)})}const U={class:$,key:M},V=re(e.viewTagProps,p.route,w);V!==null&&typeof V=="object"&&j(!0,U,me(V,i?.propsFilter)),p.route?.viewTagAttrs&&typeof p.route?.viewTagAttrs=="object"&&j(!0,U,me(p.route.viewTagAttrs,i?.propsFilter));const de=(0,m.h)(re(e.viewTag,p.route,w),U,{default:()=>[T]});c.set(M,new ii(de,p.active)),f.value.delete(M),L===!0?de.transition=Wt(r,de,e,p.route,w):L==="custom"&&(de.transition=ns(r,de,e,p.route,w)),h.push(de)}f.value=c,ri(d,r);const v=re(e.tag,null,-1),b={};return Object.assign(b,t.attrs),(0,m.h)(v,b,{default:()=>h})}else if(u!=null){const c=u.model,h={};c.props&&(typeof c.props=="object"?j(!1,h,me(c.props,i?.propsFilter)):c.props===!0&&typeof u.route?.params=="object"&&j(!1,h,me(u.route.params,i?.propsFilter)));const y=(0,m.h)(c.component,h);return St(t.slots.default,{Component:y,route:u.route})??y}else{const c=o.slots.value;if(c.length>0){const h=c[0],y=h.route??(r.proxy&&er(r.proxy))??null,d=h.model,v={};d.props&&(typeof d.props=="object"?j(!1,v,me(d.props,i?.propsFilter)):d.props===!0&&typeof y?.params=="object"&&j(!1,v,me(y.params,i?.propsFilter)));const b=(0,m.h)(d.component,v);return(re(e.transition,y,-1)??!0)&&(b.transition=Wt(r,b,e,y,-1)),St(t.slots.default,{Component:b,route:y})??b}else return St(t.slots.fallback,{})}}}});function ni(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!=null&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function oi(e,t){return e==null||t==null?!1:!!(e===t||e.path&&e.path===t.path||e.name&&e.name===t.name)}function li(e,t){return e==null||t==null?!1:!!(e.path&&t.path&&t.path.startsWith(e.path)||e.name&&e.name==t.name)}function ve(e,t){return typeof e=="function"?Reflect.apply(e,{},[t]):e}var os=(0,m.defineComponent)({name:"RouterLink",inheritAttrs:!1,props:{tag:{type:[String,Object,Function],required:!1,default:"a"},to:{type:[String,Object,Function],required:!0},root:{type:String},activeClass:{type:[String,Function],required:!1,default:"fox-router-link-active"},exact:{type:[String,Boolean,Function],required:!1},exactActiveClass:{type:[String,Function],required:!1,default:"fox-router-link-exact-active"},event:{type:[String,Function],required:!1,default:"onClick"}},setup(e,t){const r=(0,m.inject)(yt,null);return()=>{let s=ve(e.to,null),i=ve(e.tag,s);if(i==null){console.warn("can not resolve link tag");return}let n=null,a=null;r!==null&&(n=r[B](s),e.root&&(n.root=e.root),a=r.currentRoute.value);let l={},o=ve(e.activeClass,n);if(typeof o=="string"&&o.length>0&&(l[o]=li(n,a)),ve(e.exact,n)===!0){let c=ve(e.exactActiveClass,n);typeof c=="string"&&c.length>0&&(l[c]=oi(n,a))}let u={class:l};(i==="a"||i==="A")&&(u.href=n?.path??n?.name??"#"),j(!0,u,t.attrs);let f=ve(e.event,n);if(typeof f=="string"){const c=h=>{if(r==null){console.warn("router is not been injected");return}if(n==null){console.warn("route is not been resolved");return}ni(h)&&r.to(n)};u[f]=c}return(0,m.h)(i,u,t.slots)}}}),E=(function(e){return e.Busy="Busy",e.Free="Free",e.Reject="Reject",e.Exception="Exception",e.Finished="Finished",e})(E||{}),D=Symbol("chainKey"),I=Symbol("cursorKey"),Pt=Symbol("$persistentModeKey"),C=Symbol("statusKey"),Z=Symbol("argsKey"),We=Symbol("exArgsKey"),pe=Symbol("successFnsKey"),_e=Symbol("errorFnsKey"),ie=Symbol("sessionKey"),Y=Symbol("_go"),De=class{[D]=[];[I]=0;[Pt]=!1;[C]=E.Free;[Z]=[];[We]=[];[pe]=[];[_e]=[];[ie];get session(){return this[ie]}constructor(e,t=!1){this[ie]=e,this[Pt]=t}[Y](e,...t){let r=this[C];if(this[C]=E.Busy,this[I]+=e,this[I]<0&&(this[I]=0),this[Z]=t,r===E.Exception||r===E.Reject){let n=[{session:this[ie]},...this[We]];for(;this[_e].length>0;)try{let a=this[_e].shift();typeof a=="function"&&Be(()=>{Reflect.apply(a,{},n)})}catch(a){console.error(a.message,a)}return this[C]=r,this[D]=[],this[I]=0,this}else if(r===E.Finished||this[I]>=this[D].length){let n=[{session:this[ie]},...this[Z]];for(;this[pe].length>0;){let a=this[pe].shift();typeof a=="function"&&Be(()=>{Reflect.apply(a,{},n)})}return this[C]=E.Free,this}if(this[I]>=this[D].length)return this[C]=E.Free,this;let s=this[D][this[I]];this[Pt]||(this[D].splice(0,this[I]+1),this[I]=-1);let i=this[I]+1;try{let n=!1,a={go:(l,...o)=>{n||(n=!0,Reflect.apply(this[Y],this,[l,...o]))},resolve:(...l)=>{n||(n=!0,Reflect.apply(this[Y],this,[1,...l]))},reject:(...l)=>{n||(n=!0,Reflect.apply(this.reject,this,[...l]))},insert:l=>{n||(this[D].splice(i,0,l),i++)},session:this[ie]};Be(()=>{Reflect.apply(s,{},[a,...this[Z]])})}catch(n){this.throw(n)}return this}go(e,...t){return Reflect.apply(this[Y],this,[e,...t])}finish(...e){return this[C]=E.Finished,this[Z]=e,Reflect.apply(this[Y],this,[0])}reject(...e){return this[C]=E.Reject,this[We]=e,Reflect.apply(this[Y],this,[0])}throw(...e){return this[C]=E.Exception,this[We]=e,Reflect.apply(this[Y],this,[0])}reset(...e){this[C]=E.Busy,this[Z]=e,this[D]=[],this[I]=0;let t=[{session:this[ie]},...this[Z]];for(;this[pe].length>0;){let r=this[pe].shift();Be(()=>{Reflect.apply(r,this,t)})}return this[C]=E.Free,this}post(e){return this[C]===E.Reject||this[C]===E.Exception?this:(Array.isArray(e)?this[D]=[...this[D],...e]:this[D].push(e),this[C]===E.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this))}wait(e,t){return e&&typeof e=="function"&&this[pe].push(e),t&&typeof t=="function"&&this[_e].push(t),this[C]===E.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this)}exception(e){return e&&typeof e=="function"&&this[_e].push(e),this[C]===E.Busy?this:Reflect.apply(this[Y],this,[0,...this[Z]])}isFinish(){return this[C]==E.Reject||this[C]==E.Free&&this[I]>=this[D].length}},it=(function(e){return e[e.limitless=0]="limitless",e[e.once=1]="once",e})(it||{}),ge=Symbol("registerKey"),ai=class{policy;callback;constructor(e,t){this.callback=e,this.policy=t}},Jt=class{[ge]=new Map;constructor(){}on(e,t,r=!1){let s=this[ge].get(e);s||(s=new Array,this[ge].set(e,s));let i=new ai(t,r===!0?it.once:it.limitless);return s.push(i),this}off(e,t){if(!t)return this[ge].delete(e),this;let r=this[ge].get(e);if(r){for(let s=0;s<r.length;s++)if(r[s].callback===t){r.splice(s,1);break}}return this}bind(e,t,r=!1){return this.on(e,t,r)}unbind(e,t){return this.off(e,t)}once(e,t){return this.on(e,t,!0)}all(...e){let t=e.length;if(t<1)return this;let r=e[t-1];if(typeof r!="function")return console.error("callback can not benn empty"),this;let s=t-1,i=new Array(s),n=[].splice.call(e,0,s);for(let a=0;a<n.length;a++)this.once(n[a],l=>{i[a]=l,s-=1,s==0&&Reflect.apply(r,{},i)});return this}emit(e,...t){let r=this[ge].get(e);if(!r)return this;for(let s=0;s<r.length;){let i=r[s];if(i.policy==it.once?r.splice(s,1):s++,typeof i.callback=="function")try{Be(()=>{Reflect.apply(i.callback,{},t)})}catch(n){console.error(n.message,n)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}},ce=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({}),F=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(F||{}),ui={type:ce.Static,value:""},fi=/[a-zA-Z0-9_]/;function ci(e){if(!e)return[[]];if(e==="/")return[[ui]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${r})/"${u}": ${y}`)}let r=F.Static,s=r;const i=[];let n;function a(){n&&i.push(n),n=[]}let l=0,o,u="",f="";function c(){u&&(r===F.Static?n.push({type:ce.Static,value:u}):r===F.Param||r===F.ParamRegExp||r===F.ParamRegExpEnd?(n.length>1&&(o==="*"||o==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),n.push({type:ce.Param,value:u,regexp:f,repeatable:o==="*"||o==="+",optional:o==="*"||o==="?"})):t("Invalid state to consume buffer"),u="")}function h(){u+=o}for(;l<e.length;){if(o=e[l++],o==="\\"&&r!==F.ParamRegExp){s=r,r=F.EscapeNext;continue}switch(r){case F.Static:o==="/"?(u&&c(),a()):o===":"?(c(),r=F.Param):h();break;case F.EscapeNext:h(),r=s;break;case F.Param:o==="("?r=F.ParamRegExp:fi.test(o)?h():(c(),r=F.Static,o!=="*"&&o!=="?"&&o!=="+"&&l--);break;case F.ParamRegExp:o===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+o:r=F.ParamRegExpEnd:f+=o;break;case F.ParamRegExpEnd:c(),r=F.Static,o!=="*"&&o!=="?"&&o!=="+"&&l--,f="";break;default:t("Unknown state");break}}return r===F.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),c(),a(),i}var mr="[^/]+?",hi={sensitive:!1,strict:!1,start:!0,end:!0},J=(function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e})(J||{}),yi=/[.+*?^${}()[\]/\\]/g;function di(e,t){const r=j(!0,{},hi,t),s=[];let i=r.start?"^":"";const n=[];for(const u of e){const f=u.length?[]:[J.Root];r.strict&&!u.length&&(i+="/");for(let c=0;c<u.length;c++){const h=u[c];let y=J.Segment+(r.sensitive?J.BonusCaseSensitive:0);if(h.type===ce.Static)c||(i+="/"),i+=h.value.replace(yi,"\\$&"),y+=J.Static;else if(h.type===ce.Param){const{value:d,repeatable:v,optional:b,regexp:w}=h;n.push({name:d,repeatable:v,optional:b});const p=w||mr;if(p!==mr){y+=J.BonusCustomRegExp;try{new RegExp(`(${p})`)}catch(L){throw new Error(`Invalid custom RegExp for param "${d}" (${p}): `+L.message)}}let M=v?`((?:${p})(?:/(?:${p}))*)`:`(${p})`;c||(M=b&&u.length<2?`(?:/${M})`:"/"+M),b&&(M+="?"),i+=M,y+=J.Dynamic,b&&(y+=J.BonusOptional),v&&(y+=J.BonusRepeatable),p===".*"&&(y+=J.BonusWildcard)}f.push(y)}s.push(f)}if(r.strict&&r.end){const u=s.length-1;s[u][s[u].length-1]+=J.BonusStrict}r.strict||(i+="/?"),r.end?i+="$":r.strict&&!i.endsWith("/")&&(i+="(?:/|$)");const a=new RegExp(i,r.sensitive?"":"i");function l(u){const f=u.match(a),c={};if(!f)return null;for(let h=1;h<f.length;h++){const y=f[h]||"",d=n[h-1];c[d.name]=y&&d.repeatable?y.split("/"):y}return c}function o(u){let f="",c=!1;for(const h of e){(!c||!f.endsWith("/"))&&(f+="/"),c=!1;for(const y of h)if(y.type===ce.Static)f+=y.value;else if(y.type===ce.Param){const{value:d,repeatable:v,optional:b}=y,w=d in u?u[d]:"";if(Ot(w)&&!v)throw new Error(`Provided param "${d}" is an array but it is not repeatable (* or + modifiers)`);const p=Ot(w)?w.join("/"):w;if(!p)if(b)h.length<2&&(f.endsWith("/")?f=f.slice(0,-1):c=!0);else throw new Error(`Missing required param "${d}"`);f+=p}}return f||"/"}return{re:a,score:s,keys:n,parse:l,stringify:o}}function mi(e,t){const r=di(ci(e),t);return function(s){const i=r.parse(s);return i?{path:s,params:i}:null}}var Et=(function(e){return e[e.Part=0]="Part",e[e.All=1]="All",e})({}),vi=class{time;route},pi=class{forbidTime=300;submitRecorder=new vi;isSameRoute(e,t){return e==null||t==null?!1:e.name===t.name&&e.path===t.path&&e.root===t.root}acquire(e){let t=new Date().getTime();if(this.isSameRoute(e,this.submitRecorder.route)&&this.submitRecorder.time&&t-this.submitRecorder.time<=this.forbidTime){this.submitRecorder.time=t;return}return this.submitRecorder.route=e,this.submitRecorder.time=t,t}release(e){this.submitRecorder.time===e&&(this.submitRecorder.route=void 0)}},be=Symbol("_notifyChange"),vr=class{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}},oe=Symbol("historyChangeConsumerKey"),pr=Symbol("_navigateFirstRoute"),Je=Symbol("_getRouteMark"),Ft=Symbol("_getUrlSearch"),Ct=Symbol("_generateLocation"),ze=Symbol("_setRouteMarkRecorder"),Ke=Symbol("beforeRestoreFiltersKey"),gr=Symbol("_beforeRestore"),wr="Symbol(_fox_restore_point)";function je(e,...t){return typeof e=="function"?Reflect.apply(e,null,[...t]):e}function br(e){if(!Array.isArray(e))return!1;if(e.length===0)return!0;const t=e[0];return!!(Reflect.has(t,"path")&&Reflect.has(t,"root"))}var ls=class{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[oe]=!1;[Ke]=new Array;backTimeout=320;constructor(e="hash",t="",r="",s=!0,i=!0,n=!1,a,l){this.mode=e,this.base=t,this.query=r,this.firstNavigate=s,this.historyMonitor=i,this.traceless=n,this.storage=a??_().sessionStorage,this.backTimeout=l??320}init(e=!0){const t=_();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(typeof this[oe]=="function"){const r=this[oe]();if(this[oe]=!1,r)return}else if(this[oe]===!0){this[oe]=!1;return}if(je(this.historyMonitor)){const r=t.history.state;this[be](r);try{let s=[];if(typeof r=="string"?s=JSON.parse(r):s=r,Array.isArray(s)&&s.length>0){const i=this[Je]()??"/";this[ze](i,s)}}catch{}}}),nt(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[pr](),Promise.resolve()}destroy(){this.historyChange&&zt(_(),"popstate",this.historyChange)}[gr](e,t,r,s){for(let i of this[Ke])try{const n=Reflect.apply(i,{},[e,t,r,s]);if(n===!1)return n}catch(n){console.error(n.message,n)}return!0}beforeRestoreEach(e){this[Ke].push(e)}removeBeforeRestoreEach(e){const t=this[Ke].indexOf(e);return t!==-1?(this[Ke].splice(t,1),!0):!1}[pr](){const e=this[Je]()??"/",t=this.storage.getItem(wr);if(t)try{const n=JSON.parse(t);if(n.mark===e&&Array.isArray(n.routes)&&n.routes.length>0){const a=n.routes.filter((l,o)=>(l.params=l.params?qr(l.params):{},this[gr](l,o,e,n.routes)));if(a.length>0){const l=this[Ft](),o=a.length-1;a[o].query=l||a[o].query,this[be](a);return}}}catch{}const r=e.indexOf("!");let s;r!=-1?s=e.substring(r+1):s=e;const i=new P;i.path=s,i.query=this[Ft](),this[be]([i])}[ze](e,t){try{t.forEach(i=>{i.params=i.params?$r(i.params):{}});const s=JSON.stringify({mark:e,routes:t});this.storage.setItem(wr,s)}catch(r){console.error(r.message,r)}}setRestorePoint(e){const t=this[Je]()??"/";this[ze](t,e)}[be](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[Je](){const e=_();if(this.mode==="path"){let t=e.location.pathname;return this.base&&t.indexOf(this.base)===0&&(t=t.substring(this.base.length)),t}else{const t=e.location.hash,r=t.indexOf("#");if(r!=-1)return t.substring(r+1)}return null}[Ft](){let e=_().location.search;return e.length>0&&e.indexOf("?")===0&&(e=e.substring(1)),e}listen(e){this.changeHandler=e}go(e,t=!1){const r=_();this[oe]=t,r.history.go(e)}goBack(e,t){const r=_(),s=r.history.state;if(br(s)&&s.length>0){let i=!1;for(let u=s.length-1;u>=0;u--){const f=P.from(s[u]);if(!(f.historyUpdatePolicy==="traceless"||je(this.traceless,f))&&P.isSame(f,e)){i=!0;break}}if(!i){t();return}const n=this.backTimeout;let a=null;const l=()=>{r.history.go(-1),a=setTimeout(l,n)},o=()=>{clearTimeout(a);const u=_().history.state;if(br(u)&&u.length>0){let f=u.length;const c=u[f-1],h=P.from(c);if(P.isSame(h,e))return t(),!0;if(f>0){let y=!1;for(let d=f-1;d>=0;d--){const v=P.from(u[d]);if(!(v.traceless===!0||je(this.traceless,v))&&P.isSame(v,e)){y=!0;break}}return y?(setTimeout(()=>{a=setTimeout(l,n),this.go(-1,o)},0),!0):(t(),!0)}}return t(),!0};a=setTimeout(l,n),this.go(-1,o)}else t()}setRouteMark(e){const t=e.currentRoute.fullPath;this[ze](t,e.routes)}push(e){const t=this[Ct](e.currentRoute);e.currentRoute.historyUpdatePolicy!=="traceless"&&!je(this.traceless,e.currentRoute)&&_().history.pushState(e.routes,"",t),this.setRouteMark(e)}replace(e){const t=this[Ct](e.currentRoute);(e.currentRoute.historyUpdatePolicy!=="traceless"||!je(this.traceless,e.currentRoute))&&_().history.replaceState(e.routes,"",t),this.setRouteMark(e)}[Ct](e){const t=_();let r="";if(e.query){let a="";if(typeof e.query=="object")for(let l of Reflect.ownKeys(e.query)){let o=encodeURIComponent(e.query[l]),u=`${encodeURIComponent(String(l))}=${o}`;a.length>0&&(a+="&"),a+=u}else a=e.query;this.query?(r=a.length>0?`${this.query}&${a}`:this.query,r.length>0&&r.charAt(0)!=="?"&&(r=`?${r}`)):a.length>0&&(r=`?${a}`)}const s=t.location;let i=e.alias??e.fullPath;i.startsWith("default")&&(i=i.substring(Br.length+1));let n;return r?this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}${r}`:n=`${this.base}/${i}${r}`:n=`${s.pathname}${r}#${i}`:this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}`:n=`${this.base}/${i}`:n=`${s.pathname}#${i}`,`${s.origin}${n}`}};function gi(e=!0,t=null,r="",s=!0,i=!1,n){return t!==null&&(t=_().location.pathname),t&&t.endsWith("/")&&(t=t.substring(0,t.length-1)),new ls("path",t??"",r,e,s,i,n)}function as(e=!0,t="",r=!0,s=!1,i){return new ls("hash","",t,e,r,s,i)}var wi=class{maxSize=50;cursor=-1;queue=[];changeHandler;base;historyMonitor=!1;traceless=!1;constructor(e,t=50){this.base=e,this.maxSize=t}init(e=!0){return Promise.resolve()}destroy(){this.queue=[]}beforeRestoreEach(e){}removeBeforeRestoreEach(e){return!1}listen(e){this.changeHandler=e}[be](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!1){if(this.queue.length==0||this.cursor<=0)return;let r=this.cursor+e;if(r<0?r=0:r>this.queue.length-1&&(r=this.queue.length-1),r!=this.cursor){this.cursor=r;let s=!1;if(typeof t=="function"?s=t():s=t,!s){const i=this.queue[r];this[be](i.routes)}}}goBack(e,t){if(this.queue.length==0||this.cursor<=0)return;let r=0;if(e===null)r=this.cursor+1;else for(let s=this.cursor;s>=0;s--){const i=this.queue[s];if(P.isSame(i.currentRoute,e))break;r++}if(r===0){t();return}this.go(-r,()=>(t(),!0))}setRouteMark(e){}push(e){this.queue.length>=this.maxSize&&this.queue.splice(0,1),this.queue.push(e),this.cursor=this.queue.length-1}replace(e){let t=this.queue.length-this.cursor;this.queue.splice(this.cursor,t),this.queue[this.cursor]=e}setRestorePoint(e){}};function us(e="",t=50){return new wi(e,t)}var Ge=Symbol("_constructRouteModel"),Xe=Symbol("_findRouteModel"),At=Symbol("_findRootView"),bi=Symbol("_getFirstView"),le=Symbol("_removeView"),Rr=Symbol("_buildPage"),xr=Symbol("_resolveComponent"),Sr=Symbol("_update"),se=Symbol("_merge"),_t=Symbol("_handleHistoryChange"),ae=Symbol("_handleRouteUpdated"),Qe=Symbol("routeUpdatedCallback"),Kt=Symbol("currentRoute"),g=Symbol("currentRoutes"),Ze=Symbol("routeSessionCacheKey"),Pr=Symbol("_addRouteRecorder"),$e=Symbol("_removeRouteRecorder"),Ye=Symbol("_cloneRouteRecorder"),q=Symbol("_handleError"),et=Symbol("errorCallback"),H=Symbol("registerKey"),tt=Symbol("notFoundKey"),jt=Symbol("notFoundPathKey"),W=Symbol("forestKey"),S=Symbol("historyKey"),qe=Symbol("beforeFiltersKey"),Me=Symbol("afterFiltersKey"),Le=Symbol("destroyFiltersKey"),$t=Symbol("propsFilterKey"),we=Symbol("mainDispatcherKey"),qt=Symbol("initKey"),ue=Symbol("readyKey"),Mt=Symbol("readyHandlersKey"),rt=Symbol("_markReady"),Er=Symbol("_createNextFn"),Lt=Symbol("_start"),Tt=Symbol("_before"),kt=Symbol("_after"),Fr=Symbol("_destroy"),It=Symbol("_load"),Te=Symbol("_unload"),ke=Symbol("routerGuardKey"),ki=Symbol.for("loadViewModel");function Ri(e){return e.layers.length==0||e.layers[0].views.length==0}var xi=class{[H]=new Array;[tt];[jt]="*";[ue]=!1;[Mt]=[];[W]=new si;[S];[g]=new Array;[Kt]=(0,m.shallowRef)(null);[Ze]=new WeakMap;[et]=null;[Qe]=null;[qe]=new Array;[Me]=new Array;[Le]=new Array;[$t]=null;[we]=new De;[ke]=new pi;[qt]=!1;get currentRoute(){return(0,m.readonly)(this[Kt])}options;constructor(e){this.options=e??{},this.options.notFoundPath&&this.setNotFoundPath(this.options.notFoundPath);let t=this.options.routes||[];this.addRoutes(t),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),e.history?this[S]=e.history:this[S]=xe?as():us(),this[S]?.listen(async r=>{let s=!0;try{if(typeof r=="string"){const i=this[B](r);i&&await this[_t]([i])}else await this[_t](r)}catch(i){console.error(i.message,i),s=!1}this[ue]===!1&&this[rt](s)})}[q](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[et]=="function")try{this[et](e,t)}catch{}console.error(e)}init(){this[qt]!==!0&&(this[S]?.init(!this[ue]),this[qt]=!0)}isReady(){return this[ue]?Promise.resolve():new Promise((e,t)=>{this[Mt].push([e,t])})}[rt](e){this[ue]=!0,this[Mt].forEach(([t,r])=>{try{e?t():r()}catch(s){console.error(s.message,s)}})}[_t](e){try{if(!e){let n=[...this[g]].reverse();return this[Te](n),xe&&_().location.reload(),Promise.resolve()}let t=null,r=[],s=[],i=0;for(;i<e.length&&i<this[g].length&&P.isSame(e[i],this[g][i]);i++)e[i].active===!0&&e[i].active!==this[g][i].active&&(t=e[i]);if(i<e.length&&(r=e.slice(i)),i<this[g].length&&(s=this[g].slice(i).reverse()),s.length===0&&r.length===0){if(t!==null)return this.restore([t])}else if(s.length>0){if(this[Te](s)){if(r.length>0)return this.restore(r);if(t!==null)return this.restore([t])}}else return this.restore(r)}catch(t){this[q](t)}return Promise.resolve()}[ae](e=null){if(this[Kt].value=e,typeof this[Qe]=="function")try{this[Qe](e)}catch{}}[Pr](e,t){if(e.opsType===A.Open){let r=!1;const s=this[g].length-1;for(let i=s;i>=0;i--){const n=this[g][i];if(e.root==n.root){if(e.path===n.path){this[g].splice(i,1,e),r=!0;continue}e.active&&(n.active=!1)}}r||this[g].push(e)}else this[g].push(e);this[Ze].set(e,t),this[ae](e)}[Ye](){let e=[];for(let t of this[g]){let r=P.clone(t,!0);e.push(r)}return e}[$e](e){if(!this[g]){this[ae](null);return}let t=-1;for(let r=0;r<this[g].length;r++)if(P.isSame(this[g][r],e)){t=r;break}if(t!=-1){const r=this[g][t];this[g].splice(t,1);const s=this[Ze].get(r);if(this[Ze].delete(r),this[Fr](r,s),r.opsType===A.Append){const i=this[g].length-1;this[ae](this[g][i]??null)}else this[ae](null)}else this[ae](null)}set historyMonitor(e){this[S]&&(this[S].historyMonitor=e)}get historyMonitor(){return this[S]?this[S].historyMonitor:!1}set traceless(e){this[S]&&(this[S].traceless=e)}get traceless(){return this[S]?this[S].traceless:!1}set propsFilter(e){this[$t]=e}get propsFilter(){return this[$t]}setRestorePoint(){const e=this[Ye]();this[S]?.setRestorePoint(e)}onRouteUpdated(e){this[Qe]=e}onError(e){this[et]=e}beforeEach(e){this[qe].push(e)}removeBeforeEach(e){const t=this[qe].indexOf(e);return t!==-1?(this[qe].splice(t,1),!0):!1}afterEach(e){this[Me].push(e)}removeAfterEach(e){const t=this[Me].indexOf(e);return t!==-1?(this[Me].splice(t,1),!0):!1}destroyEach(e){this[Le].push(e)}removeDestroyEach(e){const t=this[Le].indexOf(e);return t!==-1?(this[Le].splice(t,1),!0):!1}beforeRestoreEach(e){this[S]?.beforeRestoreEach(e)}removeBeforeRestoreEach(e){return this[S]?.removeBeforeRestoreEach(e)??!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[jt]){this.setNotFoundRoute(e);return}const r=this[Ge](e);if(t==-1)this[H]=[...this[H],...r];else for(let s=r.length-1;s>=0;s--)this[H].splice(t,0,r[s])}removeRoute(e){const t=this[B](e);if(t===null)return console.warn("route格式错误",e),!1;for(let r=0;r<this[H].length;r++){const s=this[H][r];if(t?.path&&s.path===t.path)return this[H].splice(r,1),!0;if(t?.name&&s.name===t.name)return this[H].splice(r,1),!0}return!1}hasRoute(e){const t=this[B](e);return t===null?(console.warn("route格式错误",e),!1):this[H].findIndex(r=>{if(t?.path&&r.path===t.path||t?.name&&r.name===t.name)return!0})!==-1}setNotFoundPath(e){this[jt]=e}setNotFoundRoute(e){this[tt]=this[Ge](e)[0]}getRoutes(){return[...this[H]]}[Ge](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let r=e.components??(e.component&&{"":e.component});if(!r){const l=new gt;return l.path=t,l.redirect=e.redirect,[l]}const s=new P;s.path=t,s.name=e.name,s.meta=e.meta;let i=[];for(let l in r){const o=r[l];l.length===0&&(l=Br);const u=new qs(l,o,e.props);i.push(u)}let n=!1,a=[];if(e.children)for(let l of e.children){const o=this[Ge](l);for(let u of o){let f=new gt;f.name=u.name,u.path&&u.path.length>0?t!=="/"?f.path=`${t}${u.path}`:f.path=u.path:(n=!0,f.path=t);let c=new ur;c.models=[...i],f.layers=[c,...u.layers],f.matchedRoutes=[s,...u.matchedRoutes??[]],a.push(f)}}if(!n){const l=new ur;l.models=i;const o=new gt;o.name=e.name,o.path=t,o.matchedRoutes=[s],o.layers=[l],a.splice(0,0,o)}return a}[Xe](e){const t=e.route;try{for(let r of this[H]){const s=t.path?t.template??t.path:null,i=t.name?t.template??t.name:null;if(s&&r.path){let n=r.match;n||(n=r.match=mi(r.path));const a=n(s);if(!a)continue;if(r.redirect){const l=new P;j(!0,l,t),l.path=r.redirect;const o={route:l,find:void 0};return this[Xe](o)?(e.route=o.route,e.find=o.find,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0):!1}if(t.params=t.params??{},j(!0,t.params,a.params),t.query){const l=t.query;if(typeof l=="string"){const o={},u=l.split("&");for(let f of u){const c=f.split("=");if(c.length!==2)continue;const h=decodeURIComponent(c[0].trim());o[h]=decodeURIComponent(c[1].trim())}j(!0,t.params,o)}else typeof l=="object"&&j(!0,t.params,l)}return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0}else if(i===r.name)return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.name=t.name),!0}}catch(r){console.error(r.message,r),typeof t.error=="function"&&t.error(r.message)}return!1}[B](e){let t=null;if(Array.isArray(e))if(t=new P,typeof e[0]=="object")t=P.from(e[0]);else for(let r=0;r<e.length;r++)r===0?e[r].charAt(0)==="/"?t.path=e[r]:t.name=e[r]:r===1?t.params=e[r]:r===2?t.root=e[r]:r===3&&j(!1,t,e[r]);else typeof e=="object"?t=P.from(e):typeof e=="string"&&(t=new P,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let r=t.path.indexOf("?");r!==-1&&r<t.path.length-1&&(t.query=t.path.substring(r+1),t.path=t.path.substring(0,r))}t.root=t.root??"default",t.opsType=t.opsType??this.options.defaultOperationType??A.Push,t.traceless&&!t.historyUpdatePolicy&&(t.historyUpdatePolicy="traceless")}return t}push(...e){const t=this[B](e);return t?(t.opsType=A.Push,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[q]("resolve route fail",t),this)}put(...e){const t=this[B](e);return t?(t.opsType=A.Put,t.historyUpdatePolicy=t.historyUpdatePolicy??"traceless",this.to(t)):(this[q]("resolve route fail",t),this)}replace(...e){const t=this[B](e);return t?(t.opsType=A.Replace,t.historyUpdatePolicy=t.historyUpdatePolicy??"replace",this.to(t)):(this[q]("resolve route fail",t),this)}append(...e){const t=this[B](e);return t?(t.opsType=A.Append,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[q]("resolve route fail",t),this)}remove(e,t){return new Promise(r=>{this[we].post(s=>{try{if(this[g].length===0){s.resolve(),r(!1);return}let i=-1,n=null,a=[];if(e){if(n=e.root??null,e.all)for(let o=this[g].length-1;o>0;o--){const u=this[g][o];if(u.opsType===A.Append){const f=u.root??"default";if(n&&n!==f)continue;a.splice(0,0,u),i=o-1}}else if(e.until)for(let o=this[g].length-1;o>0;o--){let u=this[g][o];if(u.opsType===A.Append&&u.root===n){if(e.until.charAt(0)==="/"&&e.until===u.path){i=o;break}else if(e.until===u.name){i=o;break}a.splice(0,0,u)}}else if(e.to)for(let o=this[g].length-1;o>0;o--){const u=this[g][o];if(u.opsType===A.Append){const f=u.root??"default";if(n&&n!==f)continue;if(a.splice(0,0,u),e.to.charAt(0)==="/"&&e.to===u.path){i=o-1;break}else if(e.to===u.name){i=o-1;break}}}}else for(let o=this[g].length-1;o>0;o--){let u=this[g][o];if(u.opsType===A.Append){a.push(u),i=o-1;break}}if(i===-1||a.length===0){let o="can not find route";console.warn(o),s.resolve(o),r(!1);return}let l=null;if(i!==-1&&(l=this[g][i]),this[Te](a)){if(t===!1)return s.resolve(),r(!0),!0;const o=()=>(s.resolve(),r(!0),!0),u=this[g].length;if(l&&P.isSame(l,this[g][u-1])){this[S]?.goBack(l,o);return}o()}}catch(i){this[q](i),s.resolve(),r(!1)}})})}open(...e){let t=this[B](e);return t?(t.opsType=A.Open,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[q]("resolve route fail",t),this)}close(e){return this[we].post(t=>{try{let r=this[B](e);if(!r){t.reject("resolve route fail");return}let s=[];for(let i=0;i<this[g].length;i++){let n=this[g][i];if(n.root===r.root){if(!r.path&&!r.name){s.push(n);continue}if(r.path&&r.path===n.path){s.push(n);break}else if(r.name&&r.name===n.name){s.push(n);break}}}if(s.length===0){t.resolve();return}this[Te](s),t.resolve()}catch(r){this[q](r),t.resolve()}}),this}to(...e){let t=this[B](e);if(!t)return this[q]("resolve route fail",t),this;let r=this[ke].acquire(t);return r==null?(this[q]("route forbid",t),this):(this[we].post(s=>{try{let i=this[Lt](t);this[Tt](i),this[It](i),this[kt](i),i.wait((n,a)=>{const l=n.session.to;if(n.session.updateResult&&n.session.updateResult.status==="success")try{const o=new vr(P.clone(l,!0),this[Ye]());l.historyUpdatePolicy==="replace"?this[S]?.replace(o):l.historyUpdatePolicy==="traceless"?this[S]?.setRouteMark(o):this[S]?.push(o)}catch(o){console.error(o.message,o)}if(Ve.clear(n.session),this[ke].release(r),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(o){console.error(o.message,o)}this[ue]===!1&&this[rt](!0),i=null,s.resolve()},(n,a)=>{this[ke].release(r),a!==null&&this[q](a,t),this[ue]===!1&&this[rt](!1),Ve.clear(n.session),i=null,s.resolve()})}catch(i){this[ke].release(r),this[q](i,t),s.resolve()}}),this)}back(e=1){this[S]?.go(-e,!1)}[Er](e){return(t,r)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(r??null);else if(t){const s=this[B](t);if(s){const i=e.session.to;s.success=i.success,s.error=i.error,e.session.to=s,e.session.redirect=!0,e.session.routeModel=null,e.resolve()}else e.session.redirect=!1,e.reject("route resolve fail")}else e.session.redirect=!1,e.resolve()}}[Lt](e){const t=new Ve(e,this[g].length>0?this[g][this[g].length-1]:void 0),r={route:e,find:null};if(this[Xe](r),r.find){t.routeModel=r.find,e.matched=r.find.matchedRoutes??[];const s={};if(Array.isArray(r.find?.matchedRoutes))for(let i=0;i<r.find.matchedRoutes.length;i++){const n=r.find.matchedRoutes[i];n.meta&&typeof n.meta=="object"&&Object.assign(s,n.meta)}e.meta&&typeof e.meta=="object"&&Object.assign(s,e.meta),e.meta=s}return new De(t)}[Tt](e){for(let t of this[qe])e.post(r=>{const s=this[Er](r);Reflect.apply(t,{},[r.session.to,r.session.from,s,r.session])})}[kt](e){e.post(t=>{for(let r of this[Me])try{Reflect.apply(r,{},[t.session.to,t.session.from,t.session])}catch(s){console.error(s.message,s)}t.resolve()})}[Fr](e,t){for(let r of this[Le])try{Reflect.apply(r,{},[e,t])}catch(s){console.error(s.message,s)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[It](e){e.post(t=>{const r=t.session.to;let s=t.session.routeModel;if(s==null){let n={route:r,find:null};if(this[Xe](n))s=n.find,t.session.routeModel=s;else if(this[tt])s=this[tt];else{t.reject(`not find route model, path:${r.path??r.name}`);return}}const i=Ve.from(t.session);this[Rr](r,s,i).then(n=>{this[W],t.session.updateResult=n??{status:"success",message:""},t.resolve()},n=>{t.reject(n)})})}[Te](e){if(e.length==0)return!0;let t=this[W],r=[];for(let s of e){let i=this[At](t,s);i!=null&&r.push({...i,route:s})}if(r.length==0)return this[q]("can not find view index"),!1;for(let s of r.reverse())this[le](t,{x:s.x,y:s.y},[s.route.index??0],!0);return!0}[At](e,t){const r=t.root??"default";let s;for(let i=0;i<e.layers.length;i++){const n=e.layers[i];for(let a=n.views.length-1;a>=0;a--){const l=n.views[a];if(l[G]&&l[st]===r)return s={x:a,y:i},s}}return null}[bi](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[le](e,t,r=null,s=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let i=e.layers[t.y].views[t.x],n=!1,a=[],l=!1,o=[...i.slots.value];for(let f=o.length-1;f>=0;f--){let c=o[f];(!r||r.indexOf(c.index)!=-1)&&(c.route&&i[G]&&(this[$e](c.route),c.active===!0&&c.route.opsType==A.Append&&(l=!0)),a.push(new O(i,c.index,t.y)),o.splice(f,1))}if(o.length==0)s?i.slots.value=o:e.layers[t.y].views.splice(t.x,1);else{if(l){let f=o[o.length-1];f.active=!0,f.route&&(f.route.active=f.active)}i.slots.value=o}e.layers[t.y].views.length==0&&(n=!0);let u=t.y+1;for(;u<e.layers.length;u++){let f=e.layers[u].views,c=[];for(let h=f.length-1;(n||a.length>0)&&h>=0;h--){let y=f[h];if(y[fe]&&(n||O.include(a,y[fe]))){let d=y.slots.value;for(let v=d.length-1;v>=0;v--){let b=d[v];b.route&&y[G]&&this[$e](b.route),c.push(new O(y,b.index,u)),d.splice(v,1)}e.layers[u].views.splice(h,1)}}a=c,e.layers[u].views.length==0&&(n=!0)}}restore(e){if(!e||this[H].length==0){let t=this[W];if(t.layers.length>0){let r=t.layers[0].views;r.length>0&&(r[0].slots.value=[])}return this[g]=[],this[ae](null),Promise.resolve()}else return new Promise((t,r)=>{let s=null,i=!1;for(let n=0;n<e.length;n++){const a=e[n];this[we].post(l=>{const o=this[Lt](a);this[Tt](o),this[It](o),this[kt](o),o.wait((u,f)=>{s=u.session.to,i=u.session.redirect,l.resolve()},(u,f)=>{s=null,f!==null&&this[q](f),l.resolve()})})}this[we].post(n=>{if(s&&i===!0){const a=new vr(P.clone(s,!0),this[Ye]());this[S]?.replace(a)}n.resolve(),t()})})}[Rr](e,t,r){const s=e.updateType??Et.Part;return this[xr](t).then(()=>{const i=this[Sr](t,e,r,s);if(i.status==="error")throw Error(i.message);return i})}[xr](e){let t=[];for(let r=0;r<e.layers.length;r++){let s=e.layers[r];for(let i=0;i<s.models.length;i++){let n=s.models[i];n.isResolved||t.push(n.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[Sr](e,t,r,s){if(e.layers[0].models.length!==1)return{status:"error",message:"illegal route structure(multi root node)"};const i=e.layers[0].models[0];let n=this[W],a=Ri(n),l=t.root??"default",o;!a&&s==Et.Part&&(o=this[At](n,t));let u,f=0;if(o==null||o==null)if(a||s===Et.All)n.layers.length==0&&(n.layers[0]=new xt),n.layers[0].views.length==0?(u=new Ae(t.root??"default",!0,null),n.layers[0].views=[u]):u=n.layers[0].views[0],o={x:0,y:0};else{let c=t.slot;if(!c)return{status:"error",message:"can not rebuild view(because not route slot)"};let h=c.level;if(h>n.layers.length)return{status:"error",message:"can not insert view(override level)"};let y;if(c.rootName){let d=n.layers[h-1];for(let v of d.views){if(v[G]&&v.name===c.rootName){y=new O(v,c.rootIndex??0,h-1);break}if(v[z]&&v[z].view.name===c.rootName&&v[z].index===c.rootIndex){y=v[z];break}}}if(!y)return{status:"error",message:"can not insert view(not find root node ref)"};u=new Ae(l,!0,y),n.layers[h].views.push(u),o={x:n.layers[h].views.length-1,y:h}}else u=n.layers[o.y].views[o.x];if(f=o.y,u[G]=!0,t.opsType===A.Append){t.index=t.index??Ie.get(),t.active=!0;let c=u.slots.value;if(c.length>0){let b=c[c.length-1];b.active=!1,b.route&&(b.route.active=b.active)}let h=new te(t,i,t.index,!0);u.slots.value=[...c,h];let y=f+1,d=1,v=new O(u,t.index,f);this[se](n,y,e,d,v)}else if(t.opsType===A.Open){let c=u.slots.value;const h=t.active??!0;let y=!1;for(let d of c){if(d.route!==null&&P.isSamePathForRoute(d.route,t)){if(d.active===h)return t.index=d.index,t.active=h,d.route=t,{status:"noChange",message:""};d.active=h,y=!0,t.index=d.index,t.active=h,d.route=t}else h&&(d.active=!1);d.route&&(d.route.active=d.active)}if(!y){t.index=t.index??Ie.get(),t.active=h;let d=new te(t,i,t.index,h);c.push(d);let v=f+1,b=1,w=new O(u,t.index,f);this[se](n,v,e,b,w)}u.slots.value=[...c]}else{let c=u.slots.value;if(c.length==0){t.index=t.index??Ie.get(),t.active=!0,u.slots.value=[new te(t,i,t.index)];let h=f+1,y=1,d=new O(u,t.index,f);this[se](n,h,e,y,d)}else{let h=c[0];if(h.model!==i){this[le](n,o,null,!0),t.index=t.index??Ie.get(),t.active=!0,u.slots.value=[new te(t,i,t.index)];let y=f+1,d=1,v=new O(u,t.index,f);this[se](n,y,e,d,v)}else{h.route!==null&&this[$e](h.route);let y=!1;const d=t.active??!0;h.active!==d&&(h.active=d,y=!0),t.active=d,t.index=h.index,h.route=t;let v=[];for(let L=1;L<c.length;L++)v.push(c[L].index);v.length>0?this[le](n,o,v,!0):y&&(u.slots.value=[...c]);let b=[new O(u,t.index,f)],w=f+1,p=1,M=new O(u,t.index,f);for(;b.length>0&&w<n.layers.length&&p<e.layers.length;w++,p++){let L=[];for(let T=0;T<n.layers[w].views.length;T++){let $=n.layers[w].views[T];$[fe]&&O.include(b,$[fe])&&L.unshift(T)}let Ee=[];for(let T of L){let $=n.layers[w].views[T],ne=e.layers[p].models,ee;for(let k=0;k<ne.length;k++)if($.name===ne[k].name){ee=ne[k];break}if(!ee)this[le](n,{x:T,y:w},null,!1);else{let k=$.slots.value;if(k.length==0){let Q=0;$.slots.value=[new te(null,ee,Q)];let U=w+1,V=p+1;this[se](n,U,e,V,M)}else{let Q=k[0];if(Q.model!==ee){this[le](n,{x:T,y:w},null,!0),$.slots.value=[new te(null,ee,0)];let U=w+1,V=p+1;this[se](n,U,e,V,M)}else{$[G]&&Q.route!==null&&this[$e](Q.route);let U=[];for(let V=1;V<k.length;V++)U.push(k[V].index);U.length>0&&this[le](n,{x:T,y:w},U,!0),Ee.push(new O($,Q.index,w))}}$[G]=!1}}b=Ee}this[se](n,w,e,p,M)}}}if(u&&u[z]){let c=u[z];c&&(t.slot=new $s(l,f,c?.view.name,c?.index??0))}return r.to=void 0,r.routeModel=void 0,this[Pr](t,r),{status:"success",message:""}}[se](e,t,r,s,i){let n=s,a=t;for(;a<e.layers.length&&n<r.layers.length;a++,n++){let l=e.layers[a].views;for(let o of r.layers[n].models){let u=new Ae(o.name,!1,i),f=new te(null,o);u.slots.value=[f],l.push(u)}}for(;n<r.layers.length;n++){let l=new xt;l.views=[];for(let o of r.layers[n].models){let u=new Ae(o.name,!1,i),f=new te(null,o);u.slots.value=[f],l.views.push(u)}e.layers.push(l)}}[Or](e,t,r,s,i,n){if(t<0||t>this[W].layers.length)return null;if(t<this[W].layers.length){let u=this[W].layers[t],f=null;for(let c of u.views){let h=!1;if(r!==null?(h=c.name===e&&c[z]?.view===r,h&&s!==-1&&(h=c[z]?.index===s)):h=c.name===e,!!h){i!==null&&(c[fe]={view:i,index:n,level:t-1}),f=c;break}}if(f!==null)return f}let a=null,l=null;i!==null&&(i[G]?a={view:i,index:n,level:t-1}:a=i[z],l={view:i,index:n,level:t-1});let o=new Ae(e,!0,a);if(o[fe]=l,t==this[W].layers.length){let u=new xt;u.views=[o],this[W].layers.push(u)}else this[W].layers[t].views.push(o);return o}},Si="fox-router-view",Pi="fox-router-link",N=(function(e){return e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Defining=2]="Defining",e[e.Defined=3]="Defined",e})({});function Ei(e){return e==N.Loaded||e===N.Defined}var Cr=(function(e){return e[e.normal=0]="normal",e[e.factory=1]="factory",e})({}),Fi=class{register=new Map;regExpRegisters=[];constructor(){}get(e){let t=this.register.get(e)??null;return t||(t=this.regExpRegisters.find(r=>r.pattern?.test(e))?.module??null),t}has(e){return!!this.get(e)}set(e,t){if(typeof e=="string")this.register.set(e,t);else if(e instanceof RegExp){const r=this.regExpRegisters.find(s=>(s.pattern?.source??"")===(e?.source??""));r?r.module=t:this.regExpRegisters.push({pattern:e,module:t})}}remove(e){if(typeof e=="string"){const t=this.register.get(e);return this.register.delete(e),t??null}else if(e instanceof RegExp){const t=this.regExpRegisters.findIndex(r=>(r.pattern?.source??"")===(e?.source??""));if(t!==-1){const r=this.regExpRegisters[t].module??null;return this.regExpRegisters.splice(t,1),r}}return null}clear(){this.register.clear(),this.regExpRegisters=[]}},Bt=["require","exports","module"];async function Ci(e){return await new Function("url","return import(url)")(e)}var Ar=class{moduleManager=new Fi;_alias={};set alias(e){this._alias=e}get alias(){return this._alias}_resourceParser;set resourceParser(e){this._resourceParser=e}get resourceParser(){return this._resourceParser}_timeout;set timeout(e){this._timeout=e}get timeout(){return this._timeout}_query;set query(e){this._query=e}get query(){return this._query}get head(){return Ne().head}_cssMountPoint=null;set cssMountPoint(e){this._cssMountPoint=e}get cssMountPoint(){return this._cssMountPoint}_jsMountPoint=null;set jsMountPoint(e){this._jsMountPoint=e}get jsMountPoint(){return this._jsMountPoint}setModule(e,t){const r={id:typeof e=="string"?e:e?.source,src:"",status:N.Loaded};typeof t=="function"?(r.exports=t,r.type=Cr.factory):r.exports=t,this.moduleManager.set(e,r)}removeModule(e){this.moduleManager.remove(e)}getModuleExports(e){const t=this.moduleManager.get(e);return t&&Ei(t.status)?t.type===Cr.factory&&typeof t.exports=="function"?t.exports():t.exports:null}exposeRequire(e="__foxRequire",t,r){const s=t??_();return s&&typeof s=="object"?(s[e]=i=>{const n=this.getModuleExports(i);return r&&!n&&console.error(`[Fox] module:${i}, not found!`),n},!0):!1}resloveResource(e){if(typeof e=="string"){if(Bt.includes(e))return e;if(e=this.alias?.[e]??e,typeof this.resourceParser=="function"){const r=this.resloveResource(e);if(!r)return r}const t=this.getResourcePathSuffix(e);if(t==="mjs")return{path:e,type:"js",format:"es"};if(t==="js")return{path:e,type:"js",format:"umd"};if(t==="css")return{path:e,type:"css"}}return e}ensure(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let o=0;o<=i;o++)if(Array.isArray(e[o])){const u=e[o];for(let f=0;f<u.length;f++){const c=this.resloveResource(u[f]);s.push(c)}}else if(typeof e[o]=="string"){const u=this.resloveResource(e[o]);s.push(u)}const a=new Ai(s.length,(o,u)=>{if(a.isOK())try{typeof n=="function"&&Reflect.apply(n,{},u),t(u)}catch(f){console.error(f),r(f)}else try{console.error(o),typeof n=="function"&&Reflect.apply(n,{},[]),r(o)}catch(f){console.error(f),r(f)}}),l=new De;for(let o=0;o<s.length;o++){const u=new _i(o,s[o],a);this.mount(l,u)}return this})}remove(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let a=0;a<=i;a++)if(Array.isArray(e[a])){const l=e[a];for(let o=0;o<l.length;o++){const u=this.resloveResource(l[o]);s.push(u)}}else if(typeof e[a]=="string"){const l=this.resloveResource(e[a]);s.push(l)}for(let a=0;a<s.length;a++)try{this.unmount(s[a])}catch(l){console.error(l)}typeof n=="function"&&Reflect.apply(n,{},[!0]),t(!0)})}mount(e,t){if(!t.resource){e.post(s=>{t.progress.work(!1,t.index,null),s.resolve()});return}if(typeof t.resource=="string"){if(Bt.includes(t.resource)){e.post(i=>{t.progress.work(!0,t.index,t.resource),i.resolve()});return}const s=this.getModuleExports(t.resource);if(s){e.post(i=>{t.progress.work(!0,t.index,s),i.resolve()});return}}const r=t.resource;if(r.type==="js")if(r.format==="es")this.mountCJS(e,t);else{const s=this.jsMountPoint??this.head;this.mountJS(e,t,s)}else{const s=this.cssMountPoint??this.head;this.mountCSS(e,t,s)}}mountCSS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const a=Ne(),l=a.createElement("link"),o="onload"in l;o&&(l.onload=()=>{l.onload=null,l.onerror=null,t.progress.work(!0,t.index,i.path),s.resolve()},l.onerror=()=>{try{r.removeChild(l)}catch(c){console.error(c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),s.reject()});const u=this.constructResourceUri(i.path),f=a.getElementById(i.path);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=i.path,l.href=u,r.appendChild(l),o||(t.progress.work(!0,t.index,i.path),s.resolve())})}mountJS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const a={id:i.path,src:i.path,status:N.Loading};this.moduleManager.set(i.path,a);const l=Ne().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,a.status===N.Loading&&(a.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve()},l.onerror=()=>{try{r.removeChild(l)}catch(c){console.error(c)}l.onload=null,l.onerror=null,this.moduleManager.remove(i.path),t.progress.work(!1,t.index,null),s.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,a.status==N.Loading&&(a.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve())}}const o=this.constructResourceUri(i.path);l.defer=!0,l.src=o;const u=_(),f=this.createRequireLoad();u.require=f,u.define=this.createDefine(a,f,t),r.appendChild(l)})}mountCJS(e,t){e.post(async r=>{const s=t.resource,i=this.getModuleExports(s.path);if(i){t.progress.work(!0,t.index,i),r.resolve();return}try{let n=await Ci(s.path);if(ht(n)&&(n=n.default??n),Pe(n)){t.progress.work(!1,t.index,n),r.resolve();return}const a={id:s.path,src:s.path,status:N.Loaded,exports:n};this.moduleManager.set(s.path,a),t.progress.work(!0,t.index,n),r.resolve()}catch(n){console.error(n),t.progress.work(!1,t.index,null),r.resolve()}})}unmount(e){let t="",r="";typeof e=="string"?(this.moduleManager.remove(e),r=this.getResourcePathSuffix(e),t=e):(this.moduleManager.remove(e.path),r=e.type==="css"?"css":e.format??"",t=e.path);const s=Ne();if(r==="umd"){let i=s.getElementById(t);i||(i=s.querySelector(`script[src="${t}"]`)),i&&i.remove()}else if(r==="css"){let i=s.getElementById(t);if(!i){const n=this.constructResourceUri(t);i=s.querySelector(`link[href="${n}"]`)}i&&i.remove()}}trimEmptyElement(e){const t=[];for(let r=0;r<e.length;r++){let s=e[r];s!=null&&(s=s.trim(),s.length!==0&&t.push(s))}return t}createDefine(e,t,r){const s=this,i=function(...n){e.status=N.Defining;let a,l,o,u=n.length;if(u===1?(o=n[0],a=void 0):u===2?(o=n[1],Array.isArray(n[0])?(l=s.trimEmptyElement(n[0]),a=void 0):l=void 0):(a=n[0],l=s.trimEmptyElement(n[1]),o=n[2]),a&&(e.id=a,typeof s._alias=="object"&&(s._alias[a]=e.src)),l&&l.length>0)s.ensure(l,(...f)=>{try{const c=f.map(h=>h==="exports"?((!e.exports||typeof e.exports!="object")&&(e.exports={}),e.exports):h==="module"?e:h==="require"?t:h);if(typeof o=="function"){const h=Reflect.apply(o,e,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=o;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}catch(c){console.error(c),r.progress.work(!1,r.index,[])}});else{if(typeof o=="function"){const f=Reflect.apply(o,e,[]);f&&typeof f=="object"&&(e.exports=e.exports??{},Object.assign(e.exports,f))}else e.exports=o;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}};return i.amd=!0,i}createRequireLoad(){return e=>(e=this._alias?.[e]??e,this.getModuleExports(e))}constructResourceUri(e){try{if(Bt.includes(e)||!this.query)return e;const t=this.createSearch(this.query);return e.indexOf("?")==-1?e+=`?${t}`:t.length>0&&(e+=`&${t}`),e}catch(t){throw console.error(`[Fox]resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e&&typeof e=="object"){for(let r in e){let s=`${e[r]}`;t+=`${encodeURIComponent(r)}=${encodeURIComponent(s)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getResourcePathSuffix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let r=e.lastIndexOf(".",t);return r==-1?"":e.substring(r+1,t)}},Ai=class{callback;values;status;size;lastIndex;constructor(e,t){this.size=e,this.callback=t,this.status=!0,this.values=[],this.lastIndex=-1}work(e,t,r){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values[t]=r),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(s){console.error(s.message,s)}}isOK(){return this.status}},_i=class{index;resource;progress;constructor(e,t,r){this.index=e,this.resource=t,this.progress=r}},rr=Symbol("fk"),sr=Symbol("fbk"),ir=Symbol("fepk");function Ki(e={}){const t=new xi(e),r=new Ut,s=new Jt,i=new Ar,n={get router(){return t},get bus(){return r},get Bus(){return Ut},get EventProxy(){return Jt},get eventproxy(){return s},get EventChain(){return De},get Require(){return Ar},get require(){return i},get isESModule(){return ht},install(a){a.provide(yt,t),a.provide(rr,n),a.provide(sr,r),a.provide(ir,s),a.component(Si,ft),a.component(Pi,os),Reflect.defineProperty(a.config.globalProperties,"$fox",{get(){return n}}),Reflect.defineProperty(a.config.globalProperties,"$router",{get(){return t}}),Reflect.defineProperty(a.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(a.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(a.config.globalProperties,"$eventProxy",{get(){return s}}),a.config.globalProperties.$fox_on=function(l,o,u=!1){s.on(l,o,u)},a.config.globalProperties.$fox_off=function(l,o){s.off(l,o)},a.config.globalProperties.$fox_once=function(l,o){s.once(l,o)},a.config.globalProperties.$fox_all=function(...l){let o=s;Reflect.apply(o.all,o,l)},a.config.globalProperties.$fox_trigger=function(l,...o){let u=s;Reflect.apply(u.trigger,u,[l,...o])},a.config.globalProperties.$fox_emit=function(l,...o){let u=s;Reflect.apply(u.trigger,u,[l,...o])},a.mixin({computed:{$route(){return er(this)}}}),t.init()}};return n}function nr(e){return e?e.$router:(0,m.inject)(yt)}function ji(e){return e||(e=(0,m.getCurrentInstance)()?.proxy??void 0),e?er(e):null}function $i(e){return e?e.$fox:(0,m.inject)(rr)}function qi(e){return e?e.$bus:(0,m.inject)(sr)}function Mi(e){return e?e.$eventProxy:(0,m.inject)(ir)}function Li(e){const t=nr(),r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(a){console.error(a)}n()};t.beforeEach(r),(0,m.onUnmounted)(()=>{t.removeBeforeEach(r)})}function Ti(e){const t=nr(),r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(a){console.error(a)}n()};t.afterEach(r),(0,m.onUnmounted)(()=>{t.removeAfterEach(r)})}exports.Bus=Ut;exports.EventChain=De;exports.EventProxy=Jt;exports.FoxBeforeEnter=Hr;exports.FoxBeforeLeave=Ur;exports.FoxEnter=Nr;exports.FoxLeave=Vr;exports.FoxLeaveEnd=ot;exports.OperationType=A;exports.Route=P;exports.RouterLink=os;exports.RouterView=ft;exports.createFox=Ki;exports.createMemoryHistory=us;exports.createWebHashHistory=as;exports.createWebHistory=gi;exports.deleteContextValue=Ts;exports.extend=j;exports.foxBusKey=sr;exports.foxEventProxyKey=ir;exports.foxKey=rr;exports.injectContextValue=Yt;exports.isArray=Ot;exports.isDate=hs;exports.isESModule=ht;exports.isEqual=Nt;exports.isFunction=R;exports.isMap=fs;exports.isNil=Pe;exports.isObject=_r;exports.isPlainObject=Kr;exports.isPromise=ms;exports.isSet=cs;exports.isString=ys;exports.isSymbol=ds;exports.onAfterRouteUpdate=Ti;exports.onBeforeRouteUpdate=Li;exports.onFoxActivated=Ds;exports.onFoxInactivated=Hs;exports.provideContextValue=Ls;exports.rawState=Ks;exports.reactiveState=Cs;exports.sessionKey=ie;exports.shallowReactiveState=As;exports.toBoolean=Gt;exports.toNumber=ws;exports.toTypeString=ct;exports.typeOf=Ht;exports.useBus=qi;exports.useEventProxy=Mi;exports.useFox=$i;exports.useRoute=ji;exports.useRouter=nr;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let m=require("vue");var xe=typeof window<"u",_=function(){return window},Ne=function(){return window.document};function nt(e,t,r,s=!1){e.addEventListener?e.addEventListener(t,r,s):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function zt(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}var Ue=(e,t,r)=>{t=t??{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("Events");let i=!0,n=!0;for(let a in t)a==="bubbles"?i=!!t[a]:a==="cancelable"?n=!!t[a]:s[a]=t[a];s.initEvent(e,i,n),(r??document).dispatchEvent(s)},Ot=Array.isArray,fs=e=>ct(e)==="[object Map]",cs=e=>ct(e)==="[object Set]",hs=e=>e instanceof Date,R=e=>typeof e=="function",ys=e=>typeof e=="string",ds=e=>typeof e=="symbol",_r=e=>e!==null&&typeof e=="object",ms=e=>_r(e)&&R(e.then)&&R(e.catch),Pe=e=>e==null,vs=Object.prototype.toString,ct=e=>vs.call(e),Kr=e=>ct(e)==="[object Object]",ps=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function ht(e){return e.__esModule||ps&&e[Symbol.toStringTag]==="Module"}var gs=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function j(...e){let t=e[0]!==void 0&&e[0]!==null?e[0]:{},r=1,s=e.length,i=!1;for(typeof t=="boolean"&&(i=t,t=e[r]??{},r++),typeof t!="object"&&(t={});r<s;r++)if(e[r]!==null&&e[r]!==void 0){let n=e[r];for(let a in n){let l=t[a],o=n[a];if(l!==o)if(i===!0&&o&&typeof o=="object"){let u;Array.isArray(o)?u=l&&Array.isArray(l)?l:[]:u=l&&typeof l=="object"?l:{},t[a]=j(i,u,o)}else o!==void 0&&(t[a]=o)}}return t}function jr(e,t,r=!1){if(typeof t!="object")return{};typeof e!="object"&&(e={});for(let s of Reflect.ownKeys(t)){let i=e[s],n=t[s];if(i!==n)if(typeof n=="object"){if(!Array.isArray(n)&&!Kr(n))continue;i=jr(i,n,r),e[s]=i}else{if(typeof n=="function")continue;e[s]=n}}return e}var Ie=class Dt{static seed=new Date().getTime();static get(){let t=++Dt.seed;return t>=Number.MAX_VALUE&&(Dt.seed=0),t}},pt=gs?Promise.resolve():null;function Be(e,...t){pt!==null?t&&t.length>0?pt.then(()=>{e(t)}):pt.then(e):t&&t.length>0?setTimeout(()=>{e(t)}):setTimeout(e)}function Gt(e){return e==null?!1:typeof e=="boolean"?e:typeof e=="string"?e.toLocaleLowerCase()==="true":!!e}function bs(e){return typeof e=="number"?e:Number(e)}var ws={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Object]":"object"};function Ht(e){let t=Object.prototype.toString.call(e);return e==null?String(e):ws[t]||"object"}function Nt(e,t){if(e==t)return!0;if(e===void 0||t===void 0)return!1;let r=Ht(e);if(r!==Ht(t))return!1;if(r==="object"){let s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(let n=0;n<s.length;n++){let a=s[n],l=e[a],o=t[a];if(!Nt(l,o))return!1}return!0}else if(r==="array"){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++){let i=e[s],n=t[s];if(!Nt(i,n))return!1}return!0}return!1}var $r=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=$r(s)),typeof r=="symbol"?t[String(r)]=s:t[r]=s}return t},Rs=/^Symbol\((.*)\)$/,qr=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=qr(s));const i=Rs.exec(r);if(i&&i[1]){const n=Symbol.for(i[1]);t[n]=s}else t[r]=s}return t};function Lr(e,t){let r=null;return function(...s){r&&clearTimeout(r),r=setTimeout(()=>{r=null,Reflect.apply(e,null,[...s])},t)}}var or=Symbol("idKey"),ye=Symbol("valueKey"),x=Symbol("childrenKey"),X=Symbol("growKey"),Mr=class{[X]=!0;[or];[ye]=(0,m.ref)();[x]=new Map;constructor(e){this[or]=e}},xs=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];let r=e[x].get(t);if(r)return Oe(r);if(e[X])return r=Qt(t),r[X]=e[X],e[x].set(t,r),Oe(r)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=Gt(r),!0):r==null?(e[x].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}},Xt="__proxy__";function Qt(e){const t=new Mr(e);return Reflect.set(t,Xt,new Proxy(t,new xs)),t}function Oe(e){return Reflect.get(e,Xt)}var Ss=class{name="";persistPolicy="memory";storage;initFlag=!1;state={};constructor(e={},t){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Pe(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage,t&&typeof t=="object"&&Object.assign(this.state,t)}init(e){this.restore(e),this.initFlag=!0}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=_();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`,r=JSON.stringify(this.state??{});e.setItem(t,r)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_bus_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(this.state,i),Reflect.ownKeys(this.state).forEach(n=>{if(typeof n!="string")return;const a=this.state[n],l=n.split(/\//g);l.push(a),Reflect.apply(e.put,e,l)})}}put(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s=e[t-1];this.state[r]=s,this.saveState()}catch(t){console.error(t)}}remove(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s={};Reflect.ownKeys(this.state).forEach(i=>{typeof i=="string"&&(i===r||i.startsWith(r)||(s[i]=this.state[i]))}),this.state=s,this.saveState()}catch(t){console.error(t)}}clear(){if(this.initFlag)try{this.state={},this.removeState()}catch(e){console.error(e)}}},Tr=class extends Mr{_persistHandler;constructor(e={},t){super("__root__"),this._persistHandler=new Ss(e,t),this._persistHandler.init(this)}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let r=this;for(let s=0;s<t-1;s++){let i=e[s],n;r[x].has(i)?n=r[x].get(i):(n=Qt(i),r[x].set(i,n)),r=n}return r[ye].value=e[t-1],this._persistHandler.put(e),!0}get(...e){let t=e.length;if(t===0)return;let r=this;for(let s=0;s<t;s++){let i=e[s];if(r[x].has(i))r=r[x].get(i);else return}return r[ye].value}remove(...e){let t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){const n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)?(r[x].delete(s),this._persistHandler.remove(e),!0):!1}contains(...e){const t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){let n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)}clear(){this[x].clear(),this._persistHandler.clear()}},Ps=["put","get","contains","remove","clear","_persistHandler"];function lr(e){return Ps.includes(e)}var Es=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];if(t===x)return e[x];if(typeof t=="string"&&lr(t))return e[t];const r=String(t);let s=e[x].get(r);if(s)return Oe(s);if(e[X])return s=Qt(r),s[X]=e[X],e[x].set(r,s),Oe(s)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=Gt(r),!0):lr(t)?!1:r==null?(e[x].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}};function Fs(e,t){const r=new Tr(e,t),s=new Es,i=new Proxy(r,s);return Reflect.set(r,Xt,i),r}var Ut=new Proxy(Tr,{construct(e,t){const r=t[0]??{},s=t[1];return Oe(Fs(r,s))}}),Zt=e=>!e||typeof e!="object"?!0:Reflect.ownKeys(e).length===0,kr=class{name="";persistPolicy="memory";storage;constructor(e={}){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Pe(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=_();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null||Zt(e))return;const r=`_state_${this.name}`,s=JSON.stringify(e??{});t.setItem(r,s)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null)return;const t=`_state_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_state_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(e,i)}}};function Ir(e,t,r){const s=new kr(r);s.restore(t);const i=l=>{const o=(0,m.toRaw)(l),u={};for(let f in o){const c=o[f];Pe(c)||(u[f]=c)}Zt(u)?s.removeState():s.saveState(u)};let n=null;r&&r.debounce===!1?n=i:n=Lr(i,r&&r.debounceDelay?r.debounceDelay:250);const a=e?(0,m.shallowReactive)(t):(0,m.reactive)(t);return(0,m.effectScope)(!0).run(()=>{(0,m.watch)(a,l=>{const o=(0,m.toRaw)(l);n(o)})}),a}function Cs(e,t){return Ir(!1,e,t)}function As(e,t){return Ir(!0,e,t)}function _s(e,t){const r=new kr(t);r.restore(e);const s=n=>{const a=(0,m.toRaw)(n),l={};for(let o in a){const u=a[o];Pe(u)||(l[o]=u)}Zt(l)?r.removeState():r.saveState(l)};let i=null;return t&&t.debounce===!1?i=s:i=Lr(s,t&&t.debounceDelay?t.debounceDelay:250),new Proxy(e,{get(n,a){return n[a]},set(n,a,l){return n[a]=l,i(n),!0}})}function Ks(e,t){return _s(e,t)}var Br="default",Or=Symbol("sync"),B=Symbol("normalizeRoute");function ar(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}function js(e){let t=e.src;return new Promise((r,s)=>{const i=ar(l=>{ht(l)&&(l=l.default),e.component=l,console.debug("success load async module"),r()}),n=ar(l=>{`${l}`,console.debug("reject load async module"),s(l)});let a;try{a=t(i,n)}catch(l){n(l)}if(a)if(typeof a.then=="function")a.then(i,n);else{const l=a.component;l&&typeof l.then=="function"&&l.then(i,n)}})}var $s=class{name;level;rootName;rootIndex=0;constructor(e,t,r,s){this.name=e,this.level=t,this.rootName=r,this.rootIndex=s}},Ve=class Dr{to;routeModel;from;data={};constructor(t,r){this.to=t,this.from=r}static from(t){const r=new Dr(t.to,t.from),s=t.data??{};return j(!0,r.data,s),r}static clear(t){for(let r in t)t[r]=void 0}},P=class Vt{path;get fullPath(){const t=this.path??`${this.name}`;return`${this.root??"default"}!${t}`}alias;name;root;params;query;traceless;template;matched;meta;success;error;destroy;opsType;updateType;historyUpdatePolicy;viewTagAttrs;index;active;slot;static clone(t,r){let s=new Vt;return jr(s,t,r),s}static isSame(t,r){return!t||!r?!1:t===r?!0:t.root!==r.root||t.index!==r.index?!1:t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static isSamePathForRoute(t,r){return!t||!r?!1:t===r||t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static from(t){let r=new Vt;if(t==null)return r;let s=r;for(let n in t)s[n]=t[n];const i=Object.getOwnPropertySymbols(t);if(Array.isArray(i)&&i.length>0)for(let n of i)s[n]=t[n];return r}},qs=class{id;name;props;src;component;constructor(e,t,r){this.id=Ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=r}get isResolved(){return this.component!==void 0}resolve(){return js(this)}},ur=class{models=[]},gt=class{path;match;redirect;name;meta;matchedRoutes;layers=[]},A=(function(e){return e[e.Push=0]="Push",e[e.Replace=1]="Replace",e[e.Put=2]="Put",e[e.Append=3]="Append",e[e.Open=4]="Open",e})({}),Hr="FoxBeforeEnter",Nr="FoxEnter",Ur="FoxLeave",Vr="FoxLeave",ot="FoxLeaveEnd",yt=Symbol("rk"),bt=Symbol("vd"),fr=Symbol("rv"),wt=Symbol("rvi"),cr=Symbol("pv"),Rt=Symbol("pvi"),Ce=Symbol("registerKey"),Ls=class{[Ce]=new Map;constructor(){}set(e,t){this[Ce].set(e,t)}get(e){return this[Ce].get(e)}has(e){return this[Ce].has(e)}delete(e){return this[Ce].delete(e)}},he=Symbol("lc");function lt(e,t=!1){let r=e;if(Reflect.has(r,he))return r[he];if(t){const s=new Ls;return r[he]=s,s}return null}function Wr(e,t=!1){let r=null,s=e;for(;s&&!(Reflect.has(s,he)&&(r=s[he],r));)s=s.$parent;if(!r&&t){const i=e;i&&i.$parent&&(r=lt(i.$parent,t))}return r}function Yt(e,t){let r=e;for(;r;){if(Reflect.has(r,he)){const s=r[he];if(s.has(t))return s.get(t)}r=r.$parent}return null}function Ms(e,t,r){Wr(e,!0)?.set(t,r)}function Ts(e,t){Wr(e,!0)?.delete(t)}function hr(e){if(Array.isArray(e.children)&&e.children.length>0){let t=e.children[0];if(t!=null&&t.component!=null&&t.component.proxy!=null)return lt(t.component.proxy,!1)}return null}var at=Symbol("hooksKey");function ks(e){let t=e.get(at);t||(t=[],e.set(at,t))}function yr(e,t){let r=e.get(at);if(r!=null)for(let s=r.length-1;s>=0;s--){let i=r[s];if(i.type===t)try{Reflect.apply(i.hook,i.target,[])}catch(n){console.error(n.message,n)}}}var ut=(function(e){return e.DEACTIVATED="da",e.ACTIVATED="a",e})({}),Is=class{type;hook;target;constructor(e,t,r){this.target=r,this.hook=t,this.type=e}};function Bs(e,t,r,s){let i=new Is(t,r,s);return e.push(i),!0}function Os(e,t,r,s){let i=-1;for(let n=0;n<e.length;n++){let a=e[n];if(a.type===t&&a.hook===r&&a.target===s){i=n;break}}return i!=-1?(e.splice(i,1),!0):!1}function Jr(e){return(t,r)=>{let s;if(r)s=r;else{const n=(0,m.getCurrentInstance)();if(n==null||n.proxy==null){console.error("can not get current instance or proxy");return}s=n.proxy}const i=Yt(s,at);if(i==null){console.warn("hooks context not found");return}(0,m.onUnmounted)(()=>{Os(i,e,t,s)}),Bs(i,e,t,s)}}var Ds=Jr(ut.ACTIVATED),Hs=Jr(ut.DEACTIVATED),zr=Symbol("routeKey");function dr(e,t){e.set(zr,t)}function er(e){let t=Yt(e,zr);return typeof t=="function"?t():t??null}function Gr(e,t=!1){let r=null;return t?r=e.showFromClass??e.enterFromClass:r=e.enterFromClass,r||(r=e.transitionName,r?t?`${r}-show-from`:`${r}-enter-from`:null)}function Xr(e,t=!1){let r=null;return t?r=e.showActiveClass??e.enterActiveClass:r=e.enterActiveClass,r||(r=e.transitionName,r?t?`${r}-show-active`:`${r}-enter-active`:null)}function Ns(e,t=!1){let r=null;return t?r=e.showToClass??e.enterToClass:r=e.enterToClass,r||(r=e.transitionName,r?t?`${r}-show-to`:`${r}-enter-to`:null)}function Qr(e,t=!1){let r=null;return t?r=e.hideFromClass??e.leaveFromClass:r=e.leaveFromClass,r||(r=e.transitionName,r?t?`${r}-hide-from`:`${r}-leave-from`:null)}function Zr(e,t=!1){let r=null;return t?r=e.hideActiveClass??e.leaveActiveClass:r=e.leaveActiveClass,r||(r=e.transitionName,r?t?`${r}-hide-active`:`${r}-leave-active`:null)}function Us(e,t=!1){let r=null;return t?r=e.hideToClass??e.leaveToClass:r=e.leaveToClass,r||(r=e.transitionName,r?t?`${r}-hide-to`:`${r}-leave-to`:null)}function Vs(e,t=!1){let r=null;return t?r=e.beforeShow??e.beforeEnter:r=e.beforeEnter,r}function Ws(e,t=!1){let r=null;return t?r=e.show??e.enter:r=e.enter,r}function Js(e,t=!1){let r=null;return t?r=e.afterShow??e.afterEnter:r=e.afterEnter,r}function zs(e,t=!1){let r=null;return t?r=e.showCancelled??e.enterCancelled:r=e.enterCancelled,r}function Gs(e,t=!1){let r=null;return t?r=e.beforeHide??e.beforeLeave:r=e.beforeLeave,r}function Xs(e,t=!1){let r=null;return t?r=e.hide??e.leave:r=e.leave,r}function Qs(e,t=!1){let r=null;return t?r=e.afterHide??e.afterLeave:r=e.afterLeave,r}function Zs(e,t=!1){let r=null;return t?r=e.hideCancelled??e.leaveCancelled:r=e.leaveCancelled,r}function tr(e){let t,r=e.transitionDuration;return typeof r=="object"?t={enter:r.enter??-1,leave:r.leave??-1,show:r.show??-1,hide:r.hide??-1}:(typeof r=="string"&&(r=r.length==0?-1:Number(r)),t={enter:r,leave:r,show:r,hide:r}),t}function Se(e,t){e.classList.contains(t)||e.classList.add(t)}function Re(e,t){e.classList.remove(t)}var Ys=xe&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function dt(e){Ys(e)}function K(e,t,r){R(t)&&(e==null&&(e={}),Reflect.apply(t,e,r))}function Yr(e,t,r,s=-1,i,n,a){let l=[];const o=()=>{for(let u of l)zt(t,u.type,u.listener);l=[]};if(R(n)){if(i!==void 0&&i>=0){setTimeout(()=>{Reflect.apply(n,e,[t,r,s])},i);return}const u=["animationend","transitionend",ot],f=c=>{(c.target||c.srcElement)===c.currentTarget&&(o(),Reflect.apply(n,e,[t,r,s]))};u.forEach(c=>{nt(t,c,f),l.push({type:c,listener:f})})}if(R(a)){const u="animationcancel",f=c=>{(c.target||c.srcElement)===c.currentTarget&&(o(),Reflect.apply(a,e,[t,r,s]))};nt(t,u,f),l.push({type:u,listener:f})}}function mt(e){return!xe||e===null?!1:e.opsType===A.Append||e.opsType===A.Open}function es(e,t,r,s={},i,n=-1){if(t||mt(i)){const a=Gr(s,t);a&&Se(r,a);const l=Xr(s,t);l&&Se(r,l),K(e,Vs(s,t),[r,t,i,n])}}function ts(e,t,r,s={},i,n,a,l){if(!mt(n)&&!t){R(l)&&l(e,l,[r]);return}const o=Gr(s,t),u=Xr(s,t),f=Ns(s,t),c=Ws(s,t),h=Js(s,t),y=zs(s,t);if(!o&&!u&&!f&&!c){R(l)&&l(e,l,[r]);return}dt(()=>{Yr(e,r,n,a,i,()=>{u&&Re(r,u),f&&Re(r,f),R(h)&&K(e,h,[r,t,n,a]),R(l)&&l(e,l,[r])},()=>{R(y)&&K(e,y,[r,t,n,a])}),o&&Re(r,o),f&&Se(r,f),R(c)&&K(e,c,[r,t,n,a])})}function rs(e,t,r,s={},i,n=-1){if(t||mt(i)){const a=Qr(s,t);a&&Se(r,a);const l=Zr(s,t);l&&Se(r,l),K(e,Gs(s,t),[r,t,i,n])}}function ss(e,t,r,s={},i,n,a,l,o){if(!mt(a)&&!t){R(o)&&K(e,o,[r]),!t&&R(n)&&n();return}const u=Qr(s,t),f=Zr(s,t),c=Us(s,t),h=Xs(s,t),y=Qs(s,t),d=Zs(s,t);if(!u&&!f&&!c&&!h){R(o)&&K(e,o,[r]),!t&&R(n)&&n();return}dt(()=>{Yr(e,r,a,l,i,()=>{try{f&&Re(r,f),c&&Re(r,c),R(y)&&K(e,y,[r,t,a,l]),R(o)&&K(e,o,[r])}finally{!t&&R(n)&&n()}},()=>{try{R(d)&&K(e,d,[r,t,a,l]),R(o)&&K(e,o,[r])}finally{!t&&R(n)&&n()}}),u&&Re(r,u),c&&Se(r,c),R(h)&&K(e,h,[r,t,a,l])})}function Wt(e,t,r={},s,i=-1){const n=r.mode??"default",a=tr(r);return{mode:n,persisted:!1,beforeEnter:l=>{es(e,!1,l,r,s,i)},enter:l=>{ts(e,!1,l,r,a.enter,s,i)},leave:(l,o)=>{rs(e,!1,l,r,s,i),ss(e,!1,l,r,a.leave,o,s,i,()=>{t.transition=null,t=null})},clone:l=>Wt(e,t,r,s,i)}}function is(e){return e.el}function ei(e,t,r={},s,i,n,a){if(n===!0){const l=is(t);if(l==null)return;const o=tr(r);es(e,!0,l,r,s,i),ts(e,!0,l,r,o.show,s,i,u=>{R(a)&&K(e,a,[u])})}else R(a)&&K(e,a,[])}function ti(e,t,r={},s,i,n,a){if(n===!0){const l=is(t);if(l==null)return;const o=tr(r);rs(e,!0,l,r,s,i),ss(e,!0,l,r,o.hide,null,s,i,u=>{R(a)&&K(e,a,[u])})}else R(a)&&K(e,a,[])}function ri(e,t={}){dt(()=>{for(let r=0;r<e.length;r++)Reflect.apply(e[r],t,[])})}function ns(e,t,r={},s,i=-1){return{mode:r.mode??"default",persisted:!1,beforeEnter:n=>{Ue(Hr,{},n)},enter:n=>{Ue(Nr,{},n)},leave:(n,a)=>{Ue(Ur,{},n),dt(()=>{const l=o=>{(o.target||o.srcElement)===o.currentTarget&&(zt(n,ot,l),a&&Reflect.apply(a,e,[]),t.transition=null,t=null)};nt(n,ot,l),Ue(Vr,{},n)})},clone:n=>ns(e,t,r,s,i)}}var G=Symbol("rootKey"),z=Symbol("rootNodeKey"),fe=Symbol("parentNodeKey"),st=Symbol("nameKey"),te=class{instance=null;model;route;active=!0;index=0;constructor(e,t,r=0,s=!0){this.route=e,this.model=t,this.index=r,this.active=s}},Ae=class{_slots;get slots(){return this._slots==null&&(this._slots=(0,m.shallowRef)([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[st];[G];[z]=null;[fe]=null;get name(){return this[st]}constructor(e,t,r){this[st]=e,this[G]=t,r&&(this[z]=r)}},O=class{view;index;level;constructor(e,t,r){this.view=e,this.index=t,this.level=r}static include(e,t){for(let r=0;r<e.length;r++){let s=e[r];if(s.view===t.view&&(t.index==-1||s.index===t.index)&&s.level===t.level)return!0}return!1}},xt=class{views=[]},si=class{layers=[]};function re(e,t,r){return typeof e=="function"?Reflect.apply(e,{},[t,r]):e}function St(e,t){if(!e)return null;const r=e(t);return r.length===1?r[0]:r}function me(e,t){return typeof t=="function"?t(e):e}var ii=class{node;state;constructor(e,t){this.node=e,this.state=t}},ft=(0,m.defineComponent)({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,required:!1,default:"default"},modelSlot:{type:[Object],required:!1},multi:{type:Boolean,required:!1,default:!1},tag:{type:[String,Object,Function],required:!1,default:"div"},viewTag:{type:[String,Object,Function],required:!1,default:"div"},viewTagProps:{type:[Object,Function],required:!1,default(){return{}}},viewClass:{type:[String,Function],required:!1},viewActiveClass:{type:[String,Function],required:!1},viewInactiveClass:{type:[String,Function],required:!1},transition:{type:[Boolean,String,Function],required:!1,default:!1},transitionName:{type:String,required:!1},transitionDuration:{type:[String,Number,Object],required:!1},enterFromClass:{type:String,required:!1},enterActiveClass:{type:String,required:!1},enterToClass:{type:String,required:!1},leaveFromClass:{type:String,required:!1},leaveActiveClass:{type:String,required:!1},leaveToClass:{type:String,required:!1},showFromClass:{type:String,required:!1},showActiveClass:{type:String,required:!1},showToClass:{type:String,required:!1},hideFromClass:{type:String,required:!1},hideActiveClass:{type:String,required:!1},hideToClass:{type:String,required:!1},beforeEnter:{type:Function,required:!1},enter:{type:Function,required:!1},afterEnter:{type:Function,required:!1},enterCancelled:{type:Function,required:!1},beforeLeave:{type:Function,required:!1},leave:{type:Function,required:!1},afterLeave:{type:Function,required:!1},leaveCancelled:{type:Function,required:!1},beforeShow:{type:Function,required:!1},show:{type:Function,required:!1},afterShow:{type:Function,required:!1},showCancelled:{type:Function,required:!1},beforeHide:{type:Function,required:!1},hide:{type:Function,required:!1},afterHide:{type:Function,required:!1},hideCancelled:{type:Function,required:!1}},setup(e,t){const r=(0,m.getCurrentInstance)();if(r===null||r.proxy===null){console.error("instance or instance.proxy not exist");return}const s=e.multi===!0,i=(0,m.inject)(yt,null),n=(0,m.inject)(bt,0),a=(0,m.inject)(fr,null),l=(0,m.inject)(wt,-1);let o=null,u=e.modelSlot;if(u){if((0,m.provide)(bt,n+1),(0,m.provide)(wt,u.index),(0,m.provide)(Rt,u.index),!u.route){console.warn("child view render error, route not exist");return}const c=lt(r.proxy,!0);ks(c),dr(c,()=>u?.route??null)}else{if(i==null){console.error("router is not been injected");return}const c=e.name,h=(0,m.inject)(cr,null),y=(0,m.inject)(Rt,0);if(o=i[Or](c,n,a,l,h,y),o===null)return;(0,m.provide)(cr,o);const d=o[G]===!0;d&&(0,m.provide)(fr,o),s||((0,m.provide)(wt,-1),(0,m.provide)(bt,n+1),(0,m.provide)(Rt,-1),d&&dr(lt(r.proxy,!0),()=>{const v=o.slots.value;return v.length>0?v[0].route:null}))}const f={value:new Map};return(0,m.onUnmounted)(()=>{if(f.value&&f.value.clear(),u){const c=u;c.route=null,c.model=null,c.instance=null,u=void 0}}),()=>{if(s){const c=new Map,h=[],y=o?.slots.value,d=[];for(let b=0;b<y.length;b++){const p=y[b],L=`${e.name}_${p.index}`,M=re(e.transition,p.route,b)??!0,Ee={modelSlot:p};let T;t.slots.default?T=(0,m.h)(ft,Ee,{default:t.slots.default}):T=(0,m.h)(ft,Ee);const $={},ne=re(e.viewClass,p.route,b);typeof ne=="string"&&ne.length>0&&($[ne]=!0);const ee=re(e.viewActiveClass,p.route,b),k=re(e.viewInactiveClass,p.route,b),Q=f.value.get(L);if(typeof ee=="string"&&ee.length>0&&($[ee]=p.active),typeof k=="string"&&k.length>0&&($[k]=!p.active),Q&&p.active!==Q.state){const He=Q.node;p.active?d.unshift(()=>{const vt=()=>{let Fe=hr(He);Fe!=null&&yr(Fe,ut.ACTIVATED)};ei(r,He,e,p.route,b,M,vt)}):d.push(()=>{const vt=()=>{const Fe=hr(He);Fe!=null&&yr(Fe,ut.DEACTIVATED)};ti(r,He,e,p.route,b,M,vt)})}const U={class:$,key:L},V=re(e.viewTagProps,p.route,b);V!==null&&typeof V=="object"&&j(!0,U,me(V,i?.propsFilter)),p.route?.viewTagAttrs&&typeof p.route?.viewTagAttrs=="object"&&j(!0,U,me(p.route.viewTagAttrs,i?.propsFilter));const de=(0,m.h)(re(e.viewTag,p.route,b),U,{default:()=>[T]});c.set(L,new ii(de,p.active)),f.value.delete(L),M===!0?de.transition=Wt(r,de,e,p.route,b):M==="custom"&&(de.transition=ns(r,de,e,p.route,b)),h.push(de)}f.value=c,ri(d,r);const v=re(e.tag,null,-1),w={};return Object.assign(w,t.attrs),(0,m.h)(v,w,{default:()=>h})}else if(u!=null){const c=u.model,h={};c.props&&(typeof c.props=="object"?j(!1,h,me(c.props,i?.propsFilter)):c.props===!0&&typeof u.route?.params=="object"&&j(!1,h,me(u.route.params,i?.propsFilter)));const y=(0,m.h)(c.component,h);return St(t.slots.default,{Component:y,route:u.route})??y}else{const c=o.slots.value;if(c.length>0){const h=c[0],y=h.route??(r.proxy&&er(r.proxy))??null,d=h.model,v={};d.props&&(typeof d.props=="object"?j(!1,v,me(d.props,i?.propsFilter)):d.props===!0&&typeof y?.params=="object"&&j(!1,v,me(y.params,i?.propsFilter)));const w=(0,m.h)(d.component,v);return(re(e.transition,y,-1)??!0)&&(w.transition=Wt(r,w,e,y,-1)),St(t.slots.default,{Component:w,route:y})??w}else return St(t.slots.fallback,{})}}}});function ni(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!=null&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function oi(e,t){return e==null||t==null?!1:!!(e===t||e.path&&e.path===t.path||e.name&&e.name===t.name)}function li(e,t){return e==null||t==null?!1:!!(e.path&&t.path&&t.path.startsWith(e.path)||e.name&&e.name==t.name)}function ve(e,t){return typeof e=="function"?Reflect.apply(e,{},[t]):e}var os=(0,m.defineComponent)({name:"RouterLink",inheritAttrs:!1,props:{tag:{type:[String,Object,Function],required:!1,default:"a"},to:{type:[String,Object,Function],required:!0},root:{type:String},activeClass:{type:[String,Function],required:!1,default:"fox-router-link-active"},exact:{type:[String,Boolean,Function],required:!1},exactActiveClass:{type:[String,Function],required:!1,default:"fox-router-link-exact-active"},event:{type:[String,Function],required:!1,default:"onClick"}},setup(e,t){const r=(0,m.inject)(yt,null);return()=>{let s=ve(e.to,null),i=ve(e.tag,s);if(i==null){console.warn("can not resolve link tag");return}let n=null,a=null;r!==null&&(n=r[B](s),e.root&&(n.root=e.root),a=r.currentRoute.value);let l={},o=ve(e.activeClass,n);if(typeof o=="string"&&o.length>0&&(l[o]=li(n,a)),ve(e.exact,n)===!0){let c=ve(e.exactActiveClass,n);typeof c=="string"&&c.length>0&&(l[c]=oi(n,a))}let u={class:l};(i==="a"||i==="A")&&(u.href=n?.path??n?.name??"#"),j(!0,u,t.attrs);let f=ve(e.event,n);if(typeof f=="string"){const c=h=>{if(r==null){console.warn("router is not been injected");return}if(n==null){console.warn("route is not been resolved");return}ni(h)&&r.to(n)};u[f]=c}return(0,m.h)(i,u,t.slots)}}}),E=(function(e){return e.Busy="Busy",e.Free="Free",e.Reject="Reject",e.Exception="Exception",e.Finished="Finished",e})(E||{}),D=Symbol("chainKey"),I=Symbol("cursorKey"),Pt=Symbol("$persistentModeKey"),C=Symbol("statusKey"),Z=Symbol("argsKey"),We=Symbol("exArgsKey"),pe=Symbol("successFnsKey"),_e=Symbol("errorFnsKey"),ie=Symbol("sessionKey"),Y=Symbol("_go"),De=class{[D]=[];[I]=0;[Pt]=!1;[C]=E.Free;[Z]=[];[We]=[];[pe]=[];[_e]=[];[ie];get session(){return this[ie]}constructor(e,t=!1){this[ie]=e,this[Pt]=t}[Y](e,...t){let r=this[C];if(this[C]=E.Busy,this[I]+=e,this[I]<0&&(this[I]=0),this[Z]=t,r===E.Exception||r===E.Reject){let n=[{session:this[ie]},...this[We]];for(;this[_e].length>0;)try{let a=this[_e].shift();typeof a=="function"&&Be(()=>{Reflect.apply(a,{},n)})}catch(a){console.error(a.message,a)}return this[C]=r,this[D]=[],this[I]=0,this}else if(r===E.Finished||this[I]>=this[D].length){let n=[{session:this[ie]},...this[Z]];for(;this[pe].length>0;){let a=this[pe].shift();typeof a=="function"&&Be(()=>{Reflect.apply(a,{},n)})}return this[C]=E.Free,this}if(this[I]>=this[D].length)return this[C]=E.Free,this;let s=this[D][this[I]];this[Pt]||(this[D].splice(0,this[I]+1),this[I]=-1);let i=this[I]+1;try{let n=!1,a={go:(l,...o)=>{n||(n=!0,Reflect.apply(this[Y],this,[l,...o]))},resolve:(...l)=>{n||(n=!0,Reflect.apply(this[Y],this,[1,...l]))},reject:(...l)=>{n||(n=!0,Reflect.apply(this.reject,this,[...l]))},insert:l=>{n||(this[D].splice(i,0,l),i++)},session:this[ie]};Be(()=>{Reflect.apply(s,{},[a,...this[Z]])})}catch(n){this.throw(n)}return this}go(e,...t){return Reflect.apply(this[Y],this,[e,...t])}finish(...e){return this[C]=E.Finished,this[Z]=e,Reflect.apply(this[Y],this,[0])}reject(...e){return this[C]=E.Reject,this[We]=e,Reflect.apply(this[Y],this,[0])}throw(...e){return this[C]=E.Exception,this[We]=e,Reflect.apply(this[Y],this,[0])}reset(...e){this[C]=E.Busy,this[Z]=e,this[D]=[],this[I]=0;let t=[{session:this[ie]},...this[Z]];for(;this[pe].length>0;){let r=this[pe].shift();Be(()=>{Reflect.apply(r,this,t)})}return this[C]=E.Free,this}post(e){return this[C]===E.Reject||this[C]===E.Exception?this:(Array.isArray(e)?this[D]=[...this[D],...e]:this[D].push(e),this[C]===E.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this))}wait(e,t){return e&&typeof e=="function"&&this[pe].push(e),t&&typeof t=="function"&&this[_e].push(t),this[C]===E.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this)}exception(e){return e&&typeof e=="function"&&this[_e].push(e),this[C]===E.Busy?this:Reflect.apply(this[Y],this,[0,...this[Z]])}isFinish(){return this[C]==E.Reject||this[C]==E.Free&&this[I]>=this[D].length}},it=(function(e){return e[e.limitless=0]="limitless",e[e.once=1]="once",e})(it||{}),ge=Symbol("registerKey"),ai=class{policy;callback;constructor(e,t){this.callback=e,this.policy=t}},Jt=class{[ge]=new Map;constructor(){}on(e,t,r=!1){let s=this[ge].get(e);s||(s=new Array,this[ge].set(e,s));let i=new ai(t,r===!0?it.once:it.limitless);return s.push(i),this}off(e,t){if(!t)return this[ge].delete(e),this;let r=this[ge].get(e);if(r){for(let s=0;s<r.length;s++)if(r[s].callback===t){r.splice(s,1);break}}return this}bind(e,t,r=!1){return this.on(e,t,r)}unbind(e,t){return this.off(e,t)}once(e,t){return this.on(e,t,!0)}all(...e){let t=e.length;if(t<1)return this;let r=e[t-1];if(typeof r!="function")return console.error("callback can not benn empty"),this;let s=t-1,i=new Array(s),n=[].splice.call(e,0,s);for(let a=0;a<n.length;a++)this.once(n[a],l=>{i[a]=l,s-=1,s==0&&Reflect.apply(r,{},i)});return this}emit(e,...t){let r=this[ge].get(e);if(!r)return this;for(let s=0;s<r.length;){let i=r[s];if(i.policy==it.once?r.splice(s,1):s++,typeof i.callback=="function")try{Be(()=>{Reflect.apply(i.callback,{},t)})}catch(n){console.error(n.message,n)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}},ce=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({}),F=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(F||{}),ui={type:ce.Static,value:""},fi=/[a-zA-Z0-9_]/;function ci(e){if(!e)return[[]];if(e==="/")return[[ui]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${r})/"${u}": ${y}`)}let r=F.Static,s=r;const i=[];let n;function a(){n&&i.push(n),n=[]}let l=0,o,u="",f="";function c(){u&&(r===F.Static?n.push({type:ce.Static,value:u}):r===F.Param||r===F.ParamRegExp||r===F.ParamRegExpEnd?(n.length>1&&(o==="*"||o==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),n.push({type:ce.Param,value:u,regexp:f,repeatable:o==="*"||o==="+",optional:o==="*"||o==="?"})):t("Invalid state to consume buffer"),u="")}function h(){u+=o}for(;l<e.length;){if(o=e[l++],o==="\\"&&r!==F.ParamRegExp){s=r,r=F.EscapeNext;continue}switch(r){case F.Static:o==="/"?(u&&c(),a()):o===":"?(c(),r=F.Param):h();break;case F.EscapeNext:h(),r=s;break;case F.Param:o==="("?r=F.ParamRegExp:fi.test(o)?h():(c(),r=F.Static,o!=="*"&&o!=="?"&&o!=="+"&&l--);break;case F.ParamRegExp:o===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+o:r=F.ParamRegExpEnd:f+=o;break;case F.ParamRegExpEnd:c(),r=F.Static,o!=="*"&&o!=="?"&&o!=="+"&&l--,f="";break;default:t("Unknown state");break}}return r===F.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),c(),a(),i}var mr="[^/]+?",hi={sensitive:!1,strict:!1,start:!0,end:!0},J=(function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e})(J||{}),yi=/[.+*?^${}()[\]/\\]/g;function di(e,t){const r=j(!0,{},hi,t),s=[];let i=r.start?"^":"";const n=[];for(const u of e){const f=u.length?[]:[J.Root];r.strict&&!u.length&&(i+="/");for(let c=0;c<u.length;c++){const h=u[c];let y=J.Segment+(r.sensitive?J.BonusCaseSensitive:0);if(h.type===ce.Static)c||(i+="/"),i+=h.value.replace(yi,"\\$&"),y+=J.Static;else if(h.type===ce.Param){const{value:d,repeatable:v,optional:w,regexp:b}=h;n.push({name:d,repeatable:v,optional:w});const p=b||mr;if(p!==mr){y+=J.BonusCustomRegExp;try{new RegExp(`(${p})`)}catch(M){throw new Error(`Invalid custom RegExp for param "${d}" (${p}): `+M.message)}}let L=v?`((?:${p})(?:/(?:${p}))*)`:`(${p})`;c||(L=w&&u.length<2?`(?:/${L})`:"/"+L),w&&(L+="?"),i+=L,y+=J.Dynamic,w&&(y+=J.BonusOptional),v&&(y+=J.BonusRepeatable),p===".*"&&(y+=J.BonusWildcard)}f.push(y)}s.push(f)}if(r.strict&&r.end){const u=s.length-1;s[u][s[u].length-1]+=J.BonusStrict}r.strict||(i+="/?"),r.end?i+="$":r.strict&&!i.endsWith("/")&&(i+="(?:/|$)");const a=new RegExp(i,r.sensitive?"":"i");function l(u){const f=u.match(a),c={};if(!f)return null;for(let h=1;h<f.length;h++){const y=f[h]||"",d=n[h-1];c[d.name]=y&&d.repeatable?y.split("/"):y}return c}function o(u){let f="",c=!1;for(const h of e){(!c||!f.endsWith("/"))&&(f+="/"),c=!1;for(const y of h)if(y.type===ce.Static)f+=y.value;else if(y.type===ce.Param){const{value:d,repeatable:v,optional:w}=y,b=d in u?u[d]:"";if(Ot(b)&&!v)throw new Error(`Provided param "${d}" is an array but it is not repeatable (* or + modifiers)`);const p=Ot(b)?b.join("/"):b;if(!p)if(w)h.length<2&&(f.endsWith("/")?f=f.slice(0,-1):c=!0);else throw new Error(`Missing required param "${d}"`);f+=p}}return f||"/"}return{re:a,score:s,keys:n,parse:l,stringify:o}}function mi(e,t){const r=di(ci(e),t);return function(s){const i=r.parse(s);return i?{path:s,params:i}:null}}var Et=(function(e){return e[e.Part=0]="Part",e[e.All=1]="All",e})({}),vi=class{time;route},pi=class{forbidTime=300;submitRecorder=new vi;isSameRoute(e,t){return e==null||t==null?!1:e.name===t.name&&e.path===t.path&&e.root===t.root}acquire(e){let t=new Date().getTime();if(this.isSameRoute(e,this.submitRecorder.route)&&this.submitRecorder.time&&t-this.submitRecorder.time<=this.forbidTime){this.submitRecorder.time=t;return}return this.submitRecorder.route=e,this.submitRecorder.time=t,t}release(e){this.submitRecorder.time===e&&(this.submitRecorder.route=void 0)}},we=Symbol("_notifyChange"),vr=class{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}},oe=Symbol("historyChangeConsumerKey"),pr=Symbol("_navigateFirstRoute"),Je=Symbol("_getRouteMark"),Ft=Symbol("_getUrlSearch"),Ct=Symbol("_generateLocation"),ze=Symbol("_setRouteMarkRecorder"),Ke=Symbol("beforeRestoreFiltersKey"),gr=Symbol("_beforeRestore"),br="Symbol(_fox_restore_point)";function je(e,...t){return typeof e=="function"?Reflect.apply(e,null,[...t]):e}function wr(e){if(!Array.isArray(e))return!1;if(e.length===0)return!0;const t=e[0];return!!(Reflect.has(t,"path")&&Reflect.has(t,"root"))}var ls=class{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[oe]=!1;[Ke]=new Array;backTimeout=320;constructor(e="hash",t="",r="",s=!0,i=!0,n=!1,a,l){this.mode=e,this.base=t,this.query=r,this.firstNavigate=s,this.historyMonitor=i,this.traceless=n,this.storage=a??_().sessionStorage,this.backTimeout=l??320}init(e=!0){const t=_();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(typeof this[oe]=="function"){const r=this[oe]();if(this[oe]=!1,r)return}else if(this[oe]===!0){this[oe]=!1;return}if(je(this.historyMonitor)){const r=t.history.state;this[we](r);try{let s=[];if(typeof r=="string"?s=JSON.parse(r):s=r,Array.isArray(s)&&s.length>0){const i=this[Je]()??"/";this[ze](i,s)}}catch{}}}),nt(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[pr](),Promise.resolve()}destroy(){this.historyChange&&zt(_(),"popstate",this.historyChange)}[gr](e,t,r,s){for(let i of this[Ke])try{const n=Reflect.apply(i,{},[e,t,r,s]);if(n===!1)return n}catch(n){console.error(n.message,n)}return!0}beforeRestoreEach(e){this[Ke].push(e)}removeBeforeRestoreEach(e){const t=this[Ke].indexOf(e);return t!==-1?(this[Ke].splice(t,1),!0):!1}[pr](){const e=this[Je]()??"/",t=this.storage.getItem(br);if(t)try{const n=JSON.parse(t);if(n.mark===e&&Array.isArray(n.routes)&&n.routes.length>0){const a=n.routes.filter((l,o)=>(l.params=l.params?qr(l.params):{},this[gr](l,o,e,n.routes)));if(a.length>0){const l=this[Ft](),o=a.length-1;a[o].query=l||a[o].query,this[we](a);return}}}catch{}const r=e.indexOf("!");let s;r!=-1?s=e.substring(r+1):s=e;const i=new P;i.path=s,i.query=this[Ft](),this[we]([i])}[ze](e,t){try{t.forEach(s=>{s.params=s.params?$r(s.params):{}});const r=JSON.stringify({mark:e,routes:t});this.storage.setItem(br,r)}catch(r){console.error(r.message,r)}}setRestorePoint(e){const t=this[Je]()??"/";this[ze](t,e)}[we](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[Je](){const e=_();if(this.mode==="path"){let t=e.location.pathname;return this.base&&t.indexOf(this.base)===0&&(t=t.substring(this.base.length)),t}else{const t=e.location.hash,r=t.indexOf("#");if(r!=-1)return t.substring(r+1)}return null}[Ft](){let e=_().location.search;return e.length>0&&e.indexOf("?")===0&&(e=e.substring(1)),e}listen(e){this.changeHandler=e}go(e,t=!1){const r=_();this[oe]=t,r.history.go(e)}goBack(e,t){const r=_(),s=r.history.state;if(wr(s)&&s.length>0){let i=!1;for(let u=s.length-1;u>=0;u--){const f=P.from(s[u]);if(!(f.historyUpdatePolicy==="traceless"||je(this.traceless,f))&&P.isSame(f,e)){i=!0;break}}if(!i){t();return}const n=this.backTimeout;let a=null;const l=()=>{r.history.go(-1),a=setTimeout(l,n)},o=()=>{clearTimeout(a);const u=_().history.state;if(wr(u)&&u.length>0){let f=u.length;const c=u[f-1],h=P.from(c);if(P.isSame(h,e))return t(),!0;if(f>0){let y=!1;for(let d=f-1;d>=0;d--){const v=P.from(u[d]);if(!(v.traceless===!0||je(this.traceless,v))&&P.isSame(v,e)){y=!0;break}}return y?(setTimeout(()=>{a=setTimeout(l,n),this.go(-1,o)},0),!0):(t(),!0)}}return t(),!0};a=setTimeout(l,n),this.go(-1,o)}else t()}setRouteMark(e){const t=e.currentRoute.fullPath;this[ze](t,e.routes)}push(e){const t=this[Ct](e.currentRoute);e.currentRoute.historyUpdatePolicy!=="traceless"&&!je(this.traceless,e.currentRoute)&&_().history.pushState(e.routes,"",t),this.setRouteMark(e)}replace(e){const t=this[Ct](e.currentRoute);(e.currentRoute.historyUpdatePolicy!=="traceless"||!je(this.traceless,e.currentRoute))&&_().history.replaceState(e.routes,"",t),this.setRouteMark(e)}[Ct](e){const t=_();let r="";if(e.query){let a="";if(typeof e.query=="object")for(let l of Reflect.ownKeys(e.query)){let o=encodeURIComponent(e.query[l]),u=`${encodeURIComponent(String(l))}=${o}`;a.length>0&&(a+="&"),a+=u}else a=e.query;this.query?(r=a.length>0?`${this.query}&${a}`:this.query,r.length>0&&r.charAt(0)!=="?"&&(r=`?${r}`)):a.length>0&&(r=`?${a}`)}const s=t.location;let i=e.alias??e.fullPath;i.startsWith("default")&&(i=i.substring(Br.length+1));let n;return r?this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}${r}`:n=`${this.base}/${i}${r}`:n=`${s.pathname}${r}#${i}`:this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}`:n=`${this.base}/${i}`:n=`${s.pathname}#${i}`,`${s.origin}${n}`}};function gi(e=!0,t=null,r="",s=!0,i=!1,n){return t!==null&&(t=_().location.pathname),t&&t.endsWith("/")&&(t=t.substring(0,t.length-1)),new ls("path",t??"",r,e,s,i,n)}function as(e=!0,t="",r=!0,s=!1,i){return new ls("hash","",t,e,r,s,i)}var bi=class{maxSize=50;cursor=-1;queue=[];changeHandler;base;historyMonitor=!1;traceless=!1;constructor(e,t=50){this.base=e,this.maxSize=t}init(e=!0){return Promise.resolve()}destroy(){this.queue=[]}beforeRestoreEach(e){}removeBeforeRestoreEach(e){return!1}listen(e){this.changeHandler=e}[we](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!1){if(this.queue.length==0||this.cursor<=0)return;let r=this.cursor+e;if(r<0?r=0:r>this.queue.length-1&&(r=this.queue.length-1),r!=this.cursor){this.cursor=r;let s=!1;if(typeof t=="function"?s=t():s=t,!s){const i=this.queue[r];this[we](i.routes)}}}goBack(e,t){if(this.queue.length==0||this.cursor<=0)return;let r=0;if(e===null)r=this.cursor+1;else for(let s=this.cursor;s>=0;s--){const i=this.queue[s];if(P.isSame(i.currentRoute,e))break;r++}if(r===0){t();return}this.go(-r,()=>(t(),!0))}setRouteMark(e){}push(e){this.queue.length>=this.maxSize&&this.queue.splice(0,1),this.queue.push(e),this.cursor=this.queue.length-1}replace(e){let t=this.queue.length-this.cursor;this.queue.splice(this.cursor,t),this.queue[this.cursor]=e}setRestorePoint(e){}};function us(e="",t=50){return new bi(e,t)}var Ge=Symbol("_constructRouteModel"),Xe=Symbol("_findRouteModel"),At=Symbol("_findRootView"),wi=Symbol("_getFirstView"),le=Symbol("_removeView"),Rr=Symbol("_buildPage"),xr=Symbol("_resolveComponent"),Sr=Symbol("_update"),se=Symbol("_merge"),_t=Symbol("_handleHistoryChange"),ae=Symbol("_handleRouteUpdated"),Qe=Symbol("routeUpdatedCallback"),Kt=Symbol("currentRoute"),g=Symbol("currentRoutes"),Ze=Symbol("routeSessionCacheKey"),Pr=Symbol("_addRouteRecorder"),$e=Symbol("_removeRouteRecorder"),Ye=Symbol("_cloneRouteRecorder"),q=Symbol("_handleError"),et=Symbol("errorCallback"),H=Symbol("registerKey"),tt=Symbol("notFoundKey"),jt=Symbol("notFoundPathKey"),W=Symbol("forestKey"),S=Symbol("historyKey"),qe=Symbol("beforeFiltersKey"),Le=Symbol("afterFiltersKey"),Me=Symbol("destroyFiltersKey"),$t=Symbol("propsFilterKey"),be=Symbol("mainDispatcherKey"),qt=Symbol("initKey"),ue=Symbol("readyKey"),Lt=Symbol("readyHandlersKey"),rt=Symbol("_markReady"),Er=Symbol("_createNextFn"),Mt=Symbol("_start"),Tt=Symbol("_before"),kt=Symbol("_after"),Fr=Symbol("_destroy"),It=Symbol("_load"),Te=Symbol("_unload"),ke=Symbol("routerGuardKey");function Ri(e){return e.layers.length==0||e.layers[0].views.length==0}var xi=class{[H]=new Array;[tt];[jt]="*";[ue]=!1;[Lt]=[];[W]=new si;[S];[g]=new Array;[Kt]=(0,m.shallowRef)(null);[Ze]=new WeakMap;[et]=null;[Qe]=null;[qe]=new Array;[Le]=new Array;[Me]=new Array;[$t]=null;[be]=new De;[ke]=new pi;[qt]=!1;get currentRoute(){return(0,m.readonly)(this[Kt])}options;constructor(e){this.options=e??{},this.options.notFoundPath&&this.setNotFoundPath(this.options.notFoundPath);let t=this.options.routes||[];this.addRoutes(t),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),e.history?this[S]=e.history:this[S]=xe?as():us(),this[S]?.listen(async r=>{let s=!0;try{if(typeof r=="string"){const i=this[B](r);i&&await this[_t]([i])}else await this[_t](r)}catch(i){console.error(i.message,i),s=!1}this[ue]===!1&&this[rt](s)})}[q](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[et]=="function")try{this[et](e,t)}catch{}console.error(e)}init(){this[qt]!==!0&&(this[S]?.init(!this[ue]),this[qt]=!0)}isReady(){return this[ue]?Promise.resolve():new Promise((e,t)=>{this[Lt].push([e,t])})}[rt](e){this[ue]=!0,this[Lt].forEach(([t,r])=>{try{e?t():r()}catch(s){console.error(s.message,s)}})}[_t](e){try{if(!e){let n=[...this[g]].reverse();return this[Te](n),xe&&_().location.reload(),Promise.resolve()}let t=null,r=[],s=[],i=0;for(;i<e.length&&i<this[g].length&&P.isSame(e[i],this[g][i]);i++)e[i].active===!0&&e[i].active!==this[g][i].active&&(t=e[i]);if(i<e.length&&(r=e.slice(i)),i<this[g].length&&(s=this[g].slice(i).reverse()),s.length===0&&r.length===0){if(t!==null)return this.restore([t])}else if(s.length>0){if(this[Te](s)){if(r.length>0)return this.restore(r);if(t!==null)return this.restore([t])}}else return this.restore(r)}catch(t){this[q](t)}return Promise.resolve()}[ae](e=null){if(this[Kt].value=e,typeof this[Qe]=="function")try{this[Qe](e)}catch{}}[Pr](e,t){if(e.opsType===A.Open){let r=!1;const s=this[g].length-1;for(let i=s;i>=0;i--){const n=this[g][i];if(e.root==n.root){if(e.path===n.path){this[g].splice(i,1,e),r=!0;continue}e.active&&(n.active=!1)}}r||this[g].push(e)}else this[g].push(e);this[Ze].set(e,t),this[ae](e)}[Ye](){let e=[];for(let t of this[g]){let r=P.clone(t,!0);e.push(r)}return e}[$e](e){if(!this[g]){this[ae](null);return}let t=-1;for(let r=0;r<this[g].length;r++)if(P.isSame(this[g][r],e)){t=r;break}if(t!=-1){const r=this[g][t];this[g].splice(t,1);const s=this[Ze].get(r);if(this[Ze].delete(r),this[Fr](r,s),r.opsType===A.Append){const i=this[g].length-1;this[ae](this[g][i]??null)}else this[ae](null)}else this[ae](null)}set historyMonitor(e){this[S]&&(this[S].historyMonitor=e)}get historyMonitor(){return this[S]?this[S].historyMonitor:!1}set traceless(e){this[S]&&(this[S].traceless=e)}get traceless(){return this[S]?this[S].traceless:!1}set propsFilter(e){this[$t]=e}get propsFilter(){return this[$t]}setRestorePoint(){const e=this[Ye]();this[S]?.setRestorePoint(e)}onRouteUpdated(e){this[Qe]=e}onError(e){this[et]=e}beforeEach(e){this[qe].push(e)}removeBeforeEach(e){const t=this[qe].indexOf(e);return t!==-1?(this[qe].splice(t,1),!0):!1}afterEach(e){this[Le].push(e)}removeAfterEach(e){const t=this[Le].indexOf(e);return t!==-1?(this[Le].splice(t,1),!0):!1}destroyEach(e){this[Me].push(e)}removeDestroyEach(e){const t=this[Me].indexOf(e);return t!==-1?(this[Me].splice(t,1),!0):!1}beforeRestoreEach(e){this[S]?.beforeRestoreEach(e)}removeBeforeRestoreEach(e){return this[S]?.removeBeforeRestoreEach(e)??!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[jt]){this.setNotFoundRoute(e);return}const r=this[Ge](e);if(t==-1)this[H]=[...this[H],...r];else for(let s=r.length-1;s>=0;s--)this[H].splice(t,0,r[s])}removeRoute(e){const t=this[B](e);if(t===null)return console.warn("route格式错误",e),!1;for(let r=0;r<this[H].length;r++){const s=this[H][r];if(t?.path&&s.path===t.path)return this[H].splice(r,1),!0;if(t?.name&&s.name===t.name)return this[H].splice(r,1),!0}return!1}hasRoute(e){const t=this[B](e);return t===null?(console.warn("route格式错误",e),!1):this[H].findIndex(r=>{if(t?.path&&r.path===t.path||t?.name&&r.name===t.name)return!0})!==-1}setNotFoundPath(e){this[jt]=e}setNotFoundRoute(e){this[tt]=this[Ge](e)[0]}getRoutes(){return[...this[H]]}[Ge](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let r=e.components??(e.component&&{"":e.component});if(!r){const l=new gt;return l.path=t,l.redirect=e.redirect,[l]}const s=new P;s.path=t,s.name=e.name,s.meta=e.meta;let i=[];for(let l in r){const o=r[l];l.length===0&&(l=Br);const u=new qs(l,o,e.props);i.push(u)}let n=!1,a=[];if(e.children)for(let l of e.children){const o=this[Ge](l);for(let u of o){let f=new gt;f.name=u.name,u.path&&u.path.length>0?t!=="/"?f.path=`${t}${u.path}`:f.path=u.path:(n=!0,f.path=t);let c=new ur;c.models=[...i],f.layers=[c,...u.layers],f.matchedRoutes=[s,...u.matchedRoutes??[]],a.push(f)}}if(!n){const l=new ur;l.models=i;const o=new gt;o.name=e.name,o.path=t,o.matchedRoutes=[s],o.layers=[l],a.splice(0,0,o)}return a}[Xe](e){const t=e.route;try{for(let r of this[H]){const s=t.path?t.template??t.path:null,i=t.name?t.template??t.name:null;if(s&&r.path){let n=r.match;n||(n=r.match=mi(r.path));const a=n(s);if(!a)continue;if(r.redirect){const l=new P;j(!0,l,t),l.path=r.redirect;const o={route:l,find:void 0};return this[Xe](o)?(e.route=o.route,e.find=o.find,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0):!1}if(t.params=t.params??{},j(!0,t.params,a.params),t.query){const l=t.query;if(typeof l=="string"){const o={},u=l.split("&");for(let f of u){const c=f.split("=");if(c.length!==2)continue;const h=decodeURIComponent(c[0].trim());o[h]=decodeURIComponent(c[1].trim())}j(!0,t.params,o)}else typeof l=="object"&&j(!0,t.params,l)}return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0}else if(i===r.name)return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.name=t.name),!0}}catch(r){console.error(r.message,r),typeof t.error=="function"&&t.error(r.message)}return!1}[B](e){let t=null;if(Array.isArray(e))if(t=new P,typeof e[0]=="object")t=P.from(e[0]);else for(let r=0;r<e.length;r++)r===0?e[r].charAt(0)==="/"?t.path=e[r]:t.name=e[r]:r===1?t.params=e[r]:r===2?t.root=e[r]:r===3&&j(!1,t,e[r]);else typeof e=="object"?t=P.from(e):typeof e=="string"&&(t=new P,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let r=t.path.indexOf("?");r!==-1&&r<t.path.length-1&&(t.query=t.path.substring(r+1),t.path=t.path.substring(0,r))}t.root=t.root??"default",t.opsType=t.opsType??this.options.defaultOperationType??A.Push,t.traceless&&!t.historyUpdatePolicy&&(t.historyUpdatePolicy="traceless")}return t}push(...e){const t=this[B](e);return t?(t.opsType=A.Push,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[q]("resolve route fail",t),this)}put(...e){const t=this[B](e);return t?(t.opsType=A.Put,t.historyUpdatePolicy=t.historyUpdatePolicy??"traceless",this.to(t)):(this[q]("resolve route fail",t),this)}replace(...e){const t=this[B](e);return t?(t.opsType=A.Replace,t.historyUpdatePolicy=t.historyUpdatePolicy??"replace",this.to(t)):(this[q]("resolve route fail",t),this)}append(...e){const t=this[B](e);return t?(t.opsType=A.Append,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[q]("resolve route fail",t),this)}remove(e,t){return new Promise(r=>{this[be].post(s=>{try{if(this[g].length===0){s.resolve(),r(!1);return}let i=-1,n=null,a=[];if(e){if(n=e.root??null,e.all)for(let o=this[g].length-1;o>0;o--){const u=this[g][o];if(u.opsType===A.Append){const f=u.root??"default";if(n&&n!==f)continue;a.splice(0,0,u),i=o-1}}else if(e.until)for(let o=this[g].length-1;o>0;o--){let u=this[g][o];if(u.opsType===A.Append&&u.root===n){if(e.until.charAt(0)==="/"&&e.until===u.path){i=o;break}else if(e.until===u.name){i=o;break}a.splice(0,0,u)}}else if(e.to)for(let o=this[g].length-1;o>0;o--){const u=this[g][o];if(u.opsType===A.Append){const f=u.root??"default";if(n&&n!==f)continue;if(a.splice(0,0,u),e.to.charAt(0)==="/"&&e.to===u.path){i=o-1;break}else if(e.to===u.name){i=o-1;break}}}}else for(let o=this[g].length-1;o>0;o--){let u=this[g][o];if(u.opsType===A.Append){a.push(u),i=o-1;break}}if(i===-1||a.length===0){let o="can not find route";console.warn(o),s.resolve(o),r(!1);return}let l=null;if(i!==-1&&(l=this[g][i]),this[Te](a)){if(t===!1)return s.resolve(),r(!0),!0;const o=()=>(s.resolve(),r(!0),!0),u=this[g].length;if(l&&P.isSame(l,this[g][u-1])){this[S]?.goBack(l,o);return}o()}}catch(i){this[q](i),s.resolve(),r(!1)}})})}open(...e){let t=this[B](e);return t?(t.opsType=A.Open,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[q]("resolve route fail",t),this)}close(e){return this[be].post(t=>{try{let r=this[B](e);if(!r){t.reject("resolve route fail");return}let s=[];for(let i=0;i<this[g].length;i++){let n=this[g][i];if(n.root===r.root){if(!r.path&&!r.name){s.push(n);continue}if(r.path&&r.path===n.path){s.push(n);break}else if(r.name&&r.name===n.name){s.push(n);break}}}if(s.length===0){t.resolve();return}this[Te](s),t.resolve()}catch(r){this[q](r),t.resolve()}}),this}to(...e){let t=this[B](e);if(!t)return this[q]("resolve route fail",t),this;let r=this[ke].acquire(t);return r==null?(this[q]("route forbid",t),this):(this[be].post(s=>{try{let i=this[Mt](t);this[Tt](i),this[It](i),this[kt](i),i.wait((n,a)=>{const l=n.session.to;if(n.session.updateResult&&n.session.updateResult.status==="success")try{const o=new vr(P.clone(l,!0),this[Ye]());l.historyUpdatePolicy==="replace"?this[S]?.replace(o):l.historyUpdatePolicy==="traceless"?this[S]?.setRouteMark(o):this[S]?.push(o)}catch(o){console.error(o.message,o)}if(Ve.clear(n.session),this[ke].release(r),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(o){console.error(o.message,o)}this[ue]===!1&&this[rt](!0),i=null,s.resolve()},(n,a)=>{this[ke].release(r),a!==null&&this[q](a,t),this[ue]===!1&&this[rt](!1),Ve.clear(n.session),i=null,s.resolve()})}catch(i){this[ke].release(r),this[q](i,t),s.resolve()}}),this)}back(e=1){this[S]?.go(-e,!1)}[Er](e){return(t,r)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(r??null);else if(t){const s=this[B](t);if(s){const i=e.session.to;s.success=i.success,s.error=i.error,e.session.to=s,e.session.redirect=!0,e.session.routeModel=null,e.resolve()}else e.session.redirect=!1,e.reject("route resolve fail")}else e.session.redirect=!1,e.resolve()}}[Mt](e){const t=new Ve(e,this[g].length>0?this[g][this[g].length-1]:void 0),r={route:e,find:null};if(this[Xe](r),r.find){t.routeModel=r.find,e.matched=r.find.matchedRoutes??[];const s={};if(Array.isArray(r.find?.matchedRoutes))for(let i=0;i<r.find.matchedRoutes.length;i++){const n=r.find.matchedRoutes[i];n.meta&&typeof n.meta=="object"&&Object.assign(s,n.meta)}e.meta&&typeof e.meta=="object"&&Object.assign(s,e.meta),e.meta=s}return new De(t)}[Tt](e){for(let t of this[qe])e.post(r=>{const s=this[Er](r);Reflect.apply(t,{},[r.session.to,r.session.from,s,r.session])})}[kt](e){e.post(t=>{for(let r of this[Le])try{Reflect.apply(r,{},[t.session.to,t.session.from,t.session])}catch(s){console.error(s.message,s)}t.resolve()})}[Fr](e,t){for(let r of this[Me])try{Reflect.apply(r,{},[e,t])}catch(s){console.error(s.message,s)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[It](e){e.post(t=>{const r=t.session.to;let s=t.session.routeModel;if(s==null){let n={route:r,find:null};if(this[Xe](n))s=n.find,t.session.routeModel=s;else if(this[tt])s=this[tt];else{t.reject(`not find route model, path:${r.path??r.name}`);return}}const i=Ve.from(t.session);this[Rr](r,s,i).then(n=>{this[W],t.session.updateResult=n??{status:"success",message:""},t.resolve()},n=>{t.reject(n)})})}[Te](e){if(e.length==0)return!0;let t=this[W],r=[];for(let s of e){let i=this[At](t,s);i!=null&&r.push({...i,route:s})}if(r.length==0)return this[q]("can not find view index"),!1;for(let s of r.reverse())this[le](t,{x:s.x,y:s.y},[s.route.index??0],!0);return!0}[At](e,t){const r=t.root??"default";let s;for(let i=0;i<e.layers.length;i++){const n=e.layers[i];for(let a=n.views.length-1;a>=0;a--){const l=n.views[a];if(l[G]&&l[st]===r)return s={x:a,y:i},s}}return null}[wi](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[le](e,t,r=null,s=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let i=e.layers[t.y].views[t.x],n=!1,a=[],l=!1,o=[...i.slots.value];for(let f=o.length-1;f>=0;f--){let c=o[f];(!r||r.indexOf(c.index)!=-1)&&(c.route&&i[G]&&(this[$e](c.route),c.active===!0&&c.route.opsType==A.Append&&(l=!0)),a.push(new O(i,c.index,t.y)),o.splice(f,1))}if(o.length==0)s?i.slots.value=o:e.layers[t.y].views.splice(t.x,1);else{if(l){let f=o[o.length-1];f.active=!0,f.route&&(f.route.active=f.active)}i.slots.value=o}e.layers[t.y].views.length==0&&(n=!0);let u=t.y+1;for(;u<e.layers.length;u++){let f=e.layers[u].views,c=[];for(let h=f.length-1;(n||a.length>0)&&h>=0;h--){let y=f[h];if(y[fe]&&(n||O.include(a,y[fe]))){let d=y.slots.value;for(let v=d.length-1;v>=0;v--){let w=d[v];w.route&&y[G]&&this[$e](w.route),c.push(new O(y,w.index,u)),d.splice(v,1)}e.layers[u].views.splice(h,1)}}a=c,e.layers[u].views.length==0&&(n=!0)}}restore(e){if(!e||this[H].length==0){let t=this[W];if(t.layers.length>0){let r=t.layers[0].views;r.length>0&&(r[0].slots.value=[])}return this[g]=[],this[ae](null),Promise.resolve()}else return new Promise((t,r)=>{let s=null,i=!1;for(let n=0;n<e.length;n++){const a=e[n];this[be].post(l=>{const o=this[Mt](a);this[Tt](o),this[It](o),this[kt](o),o.wait((u,f)=>{s=u.session.to,i=u.session.redirect,l.resolve()},(u,f)=>{s=null,f!==null&&this[q](f),l.resolve()})})}this[be].post(n=>{if(s&&i===!0){const a=new vr(P.clone(s,!0),this[Ye]());this[S]?.replace(a)}n.resolve(),t()})})}[Rr](e,t,r){const s=e.updateType??Et.Part;return this[xr](t).then(()=>{const i=this[Sr](t,e,r,s);if(i.status==="error")throw Error(i.message);return i})}[xr](e){let t=[];for(let r=0;r<e.layers.length;r++){let s=e.layers[r];for(let i=0;i<s.models.length;i++){let n=s.models[i];n.isResolved||t.push(n.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[Sr](e,t,r,s){if(e.layers[0].models.length!==1)return{status:"error",message:"illegal route structure(multi root node)"};const i=e.layers[0].models[0];let n=this[W],a=Ri(n),l=t.root??"default",o;!a&&s==Et.Part&&(o=this[At](n,t));let u,f=0;if(o==null||o==null)if(a||s===Et.All)n.layers.length==0&&(n.layers[0]=new xt),n.layers[0].views.length==0?(u=new Ae(t.root??"default",!0,null),n.layers[0].views=[u]):u=n.layers[0].views[0],o={x:0,y:0};else{let c=t.slot;if(!c)return{status:"error",message:"can not rebuild view(because not route slot)"};let h=c.level;if(h>n.layers.length)return{status:"error",message:"can not insert view(override level)"};let y;if(c.rootName){let d=n.layers[h-1];for(let v of d.views){if(v[G]&&v.name===c.rootName){y=new O(v,c.rootIndex??0,h-1);break}if(v[z]&&v[z].view.name===c.rootName&&v[z].index===c.rootIndex){y=v[z];break}}}if(!y)return{status:"error",message:"can not insert view(not find root node ref)"};u=new Ae(l,!0,y),n.layers[h].views.push(u),o={x:n.layers[h].views.length-1,y:h}}else u=n.layers[o.y].views[o.x];if(f=o.y,u[G]=!0,t.opsType===A.Append){t.index=t.index??Ie.get(),t.active=!0;let c=u.slots.value;if(c.length>0){let w=c[c.length-1];w.active=!1,w.route&&(w.route.active=w.active)}let h=new te(t,i,t.index,!0);u.slots.value=[...c,h];let y=f+1,d=1,v=new O(u,t.index,f);this[se](n,y,e,d,v)}else if(t.opsType===A.Open){let c=u.slots.value;const h=t.active??!0;let y=!1;for(let d of c){if(d.route!==null&&P.isSamePathForRoute(d.route,t)){if(d.active===h)return t.index=d.index,t.active=h,d.route=t,{status:"noChange",message:""};d.active=h,y=!0,t.index=d.index,t.active=h,d.route=t}else h&&(d.active=!1);d.route&&(d.route.active=d.active)}if(!y){t.index=t.index??Ie.get(),t.active=h;let d=new te(t,i,t.index,h);c.push(d);let v=f+1,w=1,b=new O(u,t.index,f);this[se](n,v,e,w,b)}u.slots.value=[...c]}else{let c=u.slots.value;if(c.length==0){t.index=t.index??Ie.get(),t.active=!0,u.slots.value=[new te(t,i,t.index)];let h=f+1,y=1,d=new O(u,t.index,f);this[se](n,h,e,y,d)}else{let h=c[0];if(h.model!==i){this[le](n,o,null,!0),t.index=t.index??Ie.get(),t.active=!0,u.slots.value=[new te(t,i,t.index)];let y=f+1,d=1,v=new O(u,t.index,f);this[se](n,y,e,d,v)}else{h.route!==null&&this[$e](h.route);let y=!1;const d=t.active??!0;h.active!==d&&(h.active=d,y=!0),t.active=d,t.index=h.index,h.route=t;let v=[];for(let M=1;M<c.length;M++)v.push(c[M].index);v.length>0?this[le](n,o,v,!0):y&&(u.slots.value=[...c]);let w=[new O(u,t.index,f)],b=f+1,p=1,L=new O(u,t.index,f);for(;w.length>0&&b<n.layers.length&&p<e.layers.length;b++,p++){let M=[];for(let T=0;T<n.layers[b].views.length;T++){let $=n.layers[b].views[T];$[fe]&&O.include(w,$[fe])&&M.unshift(T)}let Ee=[];for(let T of M){let $=n.layers[b].views[T],ne=e.layers[p].models,ee;for(let k=0;k<ne.length;k++)if($.name===ne[k].name){ee=ne[k];break}if(!ee)this[le](n,{x:T,y:b},null,!1);else{let k=$.slots.value;if(k.length==0){let Q=0;$.slots.value=[new te(null,ee,Q)];let U=b+1,V=p+1;this[se](n,U,e,V,L)}else{let Q=k[0];if(Q.model!==ee){this[le](n,{x:T,y:b},null,!0),$.slots.value=[new te(null,ee,0)];let U=b+1,V=p+1;this[se](n,U,e,V,L)}else{$[G]&&Q.route!==null&&this[$e](Q.route);let U=[];for(let V=1;V<k.length;V++)U.push(k[V].index);U.length>0&&this[le](n,{x:T,y:b},U,!0),Ee.push(new O($,Q.index,b))}}$[G]=!1}}w=Ee}this[se](n,b,e,p,L)}}}if(u&&u[z]){let c=u[z];c&&(t.slot=new $s(l,f,c?.view.name,c?.index??0))}return r.to=void 0,r.routeModel=void 0,this[Pr](t,r),{status:"success",message:""}}[se](e,t,r,s,i){let n=s,a=t;for(;a<e.layers.length&&n<r.layers.length;a++,n++){let l=e.layers[a].views;for(let o of r.layers[n].models){let u=new Ae(o.name,!1,i),f=new te(null,o);u.slots.value=[f],l.push(u)}}for(;n<r.layers.length;n++){let l=new xt;l.views=[];for(let o of r.layers[n].models){let u=new Ae(o.name,!1,i),f=new te(null,o);u.slots.value=[f],l.views.push(u)}e.layers.push(l)}}[Or](e,t,r,s,i,n){if(t<0||t>this[W].layers.length)return null;if(t<this[W].layers.length){let u=this[W].layers[t],f=null;for(let c of u.views){let h=!1;if(r!==null?(h=c.name===e&&c[z]?.view===r,h&&s!==-1&&(h=c[z]?.index===s)):h=c.name===e,!!h){i!==null&&(c[fe]={view:i,index:n,level:t-1}),f=c;break}}if(f!==null)return f}let a=null,l=null;i!==null&&(i[G]?a={view:i,index:n,level:t-1}:a=i[z],l={view:i,index:n,level:t-1});let o=new Ae(e,!0,a);if(o[fe]=l,t==this[W].layers.length){let u=new xt;u.views=[o],this[W].layers.push(u)}else this[W].layers[t].views.push(o);return o}},Si="FoxRouterView",Pi="FoxRouterLink",N=(function(e){return e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Defining=2]="Defining",e[e.Defined=3]="Defined",e})({});function Ei(e){return e==N.Loaded||e===N.Defined}var Cr=(function(e){return e[e.normal=0]="normal",e[e.factory=1]="factory",e})({}),Fi=class{register=new Map;regExpRegisters=[];constructor(){}get(e){let t=this.register.get(e)??null;return t||(t=this.regExpRegisters.find(r=>r.pattern?.test(e))?.module??null),t}has(e){return!!this.get(e)}set(e,t){if(typeof e=="string")this.register.set(e,t);else if(e instanceof RegExp){const r=this.regExpRegisters.find(s=>(s.pattern?.source??"")===(e?.source??""));r?r.module=t:this.regExpRegisters.push({pattern:e,module:t})}}remove(e){if(typeof e=="string"){const t=this.register.get(e);return this.register.delete(e),t??null}else if(e instanceof RegExp){const t=this.regExpRegisters.findIndex(r=>(r.pattern?.source??"")===(e?.source??""));if(t!==-1){const r=this.regExpRegisters[t].module??null;return this.regExpRegisters.splice(t,1),r}}return null}clear(){this.register.clear(),this.regExpRegisters=[]}},Bt=["require","exports","module"];async function Ci(e){return await new Function("url","return import(url)")(e)}var Ar=class{moduleManager=new Fi;_alias={};set alias(e){this._alias=e}get alias(){return this._alias}_resourceParser;set resourceParser(e){this._resourceParser=e}get resourceParser(){return this._resourceParser}_timeout;set timeout(e){this._timeout=e}get timeout(){return this._timeout}_query;set query(e){this._query=e}get query(){return this._query}get head(){return Ne().head}_cssMountPoint=null;set cssMountPoint(e){this._cssMountPoint=e}get cssMountPoint(){return this._cssMountPoint}_jsMountPoint=null;set jsMountPoint(e){this._jsMountPoint=e}get jsMountPoint(){return this._jsMountPoint}setModule(e,t){const r={id:typeof e=="string"?e:e?.source,src:"",status:N.Loaded};typeof t=="function"?(r.exports=t,r.type=Cr.factory):r.exports=t,this.moduleManager.set(e,r)}removeModule(e){this.moduleManager.remove(e)}getModuleExports(e){const t=this.moduleManager.get(e);return t&&Ei(t.status)?t.type===Cr.factory&&typeof t.exports=="function"?t.exports():t.exports:null}exposeRequire(e="__foxRequire",t,r){const s=t??_();return s&&typeof s=="object"?(s[e]=i=>{const n=this.getModuleExports(i);return r&&!n&&console.error(`[Fox] module:${i}, not found!`),n},!0):!1}resloveResource(e){if(typeof e=="string"){if(Bt.includes(e))return e;if(e=this.alias?.[e]??e,typeof this.resourceParser=="function"){const r=this.resloveResource(e);if(!r)return r}const t=this.getResourcePathSuffix(e);if(t==="mjs")return{path:e,type:"js",format:"es"};if(t==="js")return{path:e,type:"js",format:"umd"};if(t==="css")return{path:e,type:"css"}}return e}ensure(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let o=0;o<=i;o++)if(Array.isArray(e[o])){const u=e[o];for(let f=0;f<u.length;f++){const c=this.resloveResource(u[f]);s.push(c)}}else if(typeof e[o]=="string"){const u=this.resloveResource(e[o]);s.push(u)}const a=new Ai(s.length,(o,u)=>{if(a.isOK())try{typeof n=="function"&&Reflect.apply(n,{},u),t(u)}catch(f){console.error(f),r(f)}else try{console.error(o),typeof n=="function"&&Reflect.apply(n,{},[]),r(o)}catch(f){console.error(f),r(f)}}),l=new De;for(let o=0;o<s.length;o++){const u=new _i(o,s[o],a);this.mount(l,u)}return this})}remove(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let a=0;a<=i;a++)if(Array.isArray(e[a])){const l=e[a];for(let o=0;o<l.length;o++){const u=this.resloveResource(l[o]);s.push(u)}}else if(typeof e[a]=="string"){const l=this.resloveResource(e[a]);s.push(l)}for(let a=0;a<s.length;a++)try{this.unmount(s[a])}catch(l){console.error(l)}typeof n=="function"&&Reflect.apply(n,{},[!0]),t(!0)})}mount(e,t){if(!t.resource){e.post(s=>{t.progress.work(!1,t.index,null),s.resolve()});return}if(typeof t.resource=="string"){if(Bt.includes(t.resource)){e.post(i=>{t.progress.work(!0,t.index,t.resource),i.resolve()});return}const s=this.getModuleExports(t.resource);if(s){e.post(i=>{t.progress.work(!0,t.index,s),i.resolve()});return}}const r=t.resource;if(r.type==="js")if(r.format==="es")this.mountCJS(e,t);else{const s=this.jsMountPoint??this.head;this.mountJS(e,t,s)}else{const s=this.cssMountPoint??this.head;this.mountCSS(e,t,s)}}mountCSS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const a=Ne(),l=a.createElement("link"),o="onload"in l;o&&(l.onload=()=>{l.onload=null,l.onerror=null,t.progress.work(!0,t.index,i.path),s.resolve()},l.onerror=()=>{try{r.removeChild(l)}catch(c){console.error(c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),s.reject()});const u=this.constructResourceUri(i.path),f=a.getElementById(i.path);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=i.path,l.href=u,r.appendChild(l),o||(t.progress.work(!0,t.index,i.path),s.resolve())})}mountJS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const a={id:i.path,src:i.path,status:N.Loading};this.moduleManager.set(i.path,a);const l=Ne().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,a.status===N.Loading&&(a.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve()},l.onerror=()=>{try{r.removeChild(l)}catch(c){console.error(c)}l.onload=null,l.onerror=null,this.moduleManager.remove(i.path),t.progress.work(!1,t.index,null),s.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,a.status==N.Loading&&(a.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve())}}const o=this.constructResourceUri(i.path);l.defer=!0,l.src=o;const u=_(),f=this.createRequireLoad();u.require=f,u.define=this.createDefine(a,f,t),r.appendChild(l)})}mountCJS(e,t){e.post(async r=>{const s=t.resource,i=this.getModuleExports(s.path);if(i){t.progress.work(!0,t.index,i),r.resolve();return}try{let n=await Ci(s.path);if(ht(n)&&(n=n.default??n),Pe(n)){t.progress.work(!1,t.index,n),r.resolve();return}const a={id:s.path,src:s.path,status:N.Loaded,exports:n};this.moduleManager.set(s.path,a),t.progress.work(!0,t.index,n),r.resolve()}catch(n){console.error(n),t.progress.work(!1,t.index,null),r.resolve()}})}unmount(e){let t="",r="";typeof e=="string"?(this.moduleManager.remove(e),r=this.getResourcePathSuffix(e),t=e):(this.moduleManager.remove(e.path),r=e.type==="css"?"css":e.format??"",t=e.path);const s=Ne();if(r==="umd"){let i=s.getElementById(t);i||(i=s.querySelector(`script[src="${t}"]`)),i&&i.remove()}else if(r==="css"){let i=s.getElementById(t);if(!i){const n=this.constructResourceUri(t);i=s.querySelector(`link[href="${n}"]`)}i&&i.remove()}}trimEmptyElement(e){const t=[];for(let r=0;r<e.length;r++){let s=e[r];s!=null&&(s=s.trim(),s.length!==0&&t.push(s))}return t}createDefine(e,t,r){const s=this,i=function(...n){e.status=N.Defining;let a,l,o,u=n.length;if(u===1?(o=n[0],a=void 0):u===2?(o=n[1],Array.isArray(n[0])?(l=s.trimEmptyElement(n[0]),a=void 0):l=void 0):(a=n[0],l=s.trimEmptyElement(n[1]),o=n[2]),a&&(e.id=a,typeof s._alias=="object"&&(s._alias[a]=e.src)),l&&l.length>0)s.ensure(l,(...f)=>{try{const c=f.map(h=>h==="exports"?((!e.exports||typeof e.exports!="object")&&(e.exports={}),e.exports):h==="module"?e:h==="require"?t:h);if(typeof o=="function"){const h=Reflect.apply(o,e,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=o;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}catch(c){console.error(c),r.progress.work(!1,r.index,[])}});else{if(typeof o=="function"){const f=Reflect.apply(o,e,[]);f&&typeof f=="object"&&(e.exports=e.exports??{},Object.assign(e.exports,f))}else e.exports=o;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}};return i.amd=!0,i}createRequireLoad(){return e=>(e=this._alias?.[e]??e,this.getModuleExports(e))}constructResourceUri(e){try{if(Bt.includes(e)||!this.query)return e;const t=this.createSearch(this.query);return e.indexOf("?")==-1?e+=`?${t}`:t.length>0&&(e+=`&${t}`),e}catch(t){throw console.error(`[Fox]resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e&&typeof e=="object"){for(let r in e){let s=`${e[r]}`;t+=`${encodeURIComponent(r)}=${encodeURIComponent(s)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getResourcePathSuffix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let r=e.lastIndexOf(".",t);return r==-1?"":e.substring(r+1,t)}},Ai=class{callback;values;status;size;lastIndex;constructor(e,t){this.size=e,this.callback=t,this.status=!0,this.values=[],this.lastIndex=-1}work(e,t,r){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values[t]=r),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(s){console.error(s.message,s)}}isOK(){return this.status}},_i=class{index;resource;progress;constructor(e,t,r){this.index=e,this.resource=t,this.progress=r}},rr=Symbol("fk"),sr=Symbol("fbk"),ir=Symbol("fepk");function Ki(e={}){const t=new xi(e),r=new Ut,s=new Jt,i=new Ar,n={get router(){return t},get bus(){return r},get Bus(){return Ut},get EventProxy(){return Jt},get eventproxy(){return s},get EventChain(){return De},get Require(){return Ar},get require(){return i},get isESModule(){return ht},install(a){a.provide(yt,t),a.provide(rr,n),a.provide(sr,r),a.provide(ir,s),a.component(Si,ft),a.component(Pi,os),Reflect.defineProperty(a.config.globalProperties,"$fox",{get(){return n}}),Reflect.defineProperty(a.config.globalProperties,"$router",{get(){return t}}),Reflect.defineProperty(a.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(a.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(a.config.globalProperties,"$eventProxy",{get(){return s}}),a.config.globalProperties.$fox_on=function(l,o,u=!1){s.on(l,o,u)},a.config.globalProperties.$fox_off=function(l,o){s.off(l,o)},a.config.globalProperties.$fox_once=function(l,o){s.once(l,o)},a.config.globalProperties.$fox_all=function(...l){let o=s;Reflect.apply(o.all,o,l)},a.config.globalProperties.$fox_trigger=function(l,...o){let u=s;Reflect.apply(u.trigger,u,[l,...o])},a.config.globalProperties.$fox_emit=function(l,...o){let u=s;Reflect.apply(u.trigger,u,[l,...o])},a.mixin({computed:{$route(){return er(this)}}}),t.init()}};return n}function nr(e){return e?e.$router:(0,m.inject)(yt)}function ji(e){return e||(e=(0,m.getCurrentInstance)()?.proxy??void 0),e?er(e):null}function $i(e){return e?e.$fox:(0,m.inject)(rr)}function qi(e){return e?e.$bus:(0,m.inject)(sr)}function Li(e){return e?e.$eventProxy:(0,m.inject)(ir)}function Mi(e){const t=nr(),r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(a){console.error(a)}n()};t.beforeEach(r),(0,m.onUnmounted)(()=>{t.removeBeforeEach(r)})}function Ti(e){const t=nr(),r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(a){console.error(a)}n()};t.afterEach(r),(0,m.onUnmounted)(()=>{t.removeAfterEach(r)})}exports.Bus=Ut;exports.EventChain=De;exports.EventProxy=Jt;exports.FoxBeforeEnter=Hr;exports.FoxBeforeLeave=Ur;exports.FoxEnter=Nr;exports.FoxLeave=Vr;exports.FoxLeaveEnd=ot;exports.OperationType=A;exports.Route=P;exports.RouterLink=os;exports.RouterView=ft;exports.createFox=Ki;exports.createMemoryHistory=us;exports.createWebHashHistory=as;exports.createWebHistory=gi;exports.deleteContextValue=Ts;exports.extend=j;exports.foxBusKey=sr;exports.foxEventProxyKey=ir;exports.foxKey=rr;exports.injectContextValue=Yt;exports.isArray=Ot;exports.isDate=hs;exports.isESModule=ht;exports.isEqual=Nt;exports.isFunction=R;exports.isMap=fs;exports.isNil=Pe;exports.isObject=_r;exports.isPlainObject=Kr;exports.isPromise=ms;exports.isSet=cs;exports.isString=ys;exports.isSymbol=ds;exports.onAfterRouteUpdate=Ti;exports.onBeforeRouteUpdate=Mi;exports.onFoxActivated=Ds;exports.onFoxInactivated=Hs;exports.provideContextValue=Ms;exports.rawState=Ks;exports.reactiveState=Cs;exports.sessionKey=ie;exports.shallowReactiveState=As;exports.toBoolean=Gt;exports.toNumber=bs;exports.toTypeString=ct;exports.typeOf=Ht;exports.useBus=qi;exports.useEventProxy=Li;exports.useFox=$i;exports.useRoute=ji;exports.useRouter=nr;
|
package/libs/index.esm.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { ComponentProvideOptions } from 'vue';
|
|
|
5
5
|
import { ComponentPublicInstance } from 'vue';
|
|
6
6
|
import { DefineComponent } from 'vue';
|
|
7
7
|
import { ExtractPropTypes } from 'vue';
|
|
8
|
-
import { HistoryUpdatePolicy } from './operationType';
|
|
9
8
|
import { InjectionKey } from 'vue';
|
|
10
9
|
import { PropType } from 'vue';
|
|
11
10
|
import { PublicProps } from 'vue';
|
|
@@ -524,7 +523,7 @@ declare const historyKey: unique symbol;
|
|
|
524
523
|
/**
|
|
525
524
|
* 历史更新策略
|
|
526
525
|
*/
|
|
527
|
-
declare type
|
|
526
|
+
declare type HistoryUpdatePolicy = 'push' | 'replace' | 'traceless';
|
|
528
527
|
|
|
529
528
|
declare const idKey: unique symbol;
|
|
530
529
|
|
|
@@ -1179,7 +1178,7 @@ export declare class Route {
|
|
|
1179
1178
|
/**
|
|
1180
1179
|
* 历史更新策略
|
|
1181
1180
|
*/
|
|
1182
|
-
historyUpdatePolicy?:
|
|
1181
|
+
historyUpdatePolicy?: HistoryUpdatePolicy;
|
|
1183
1182
|
/**
|
|
1184
1183
|
* view属性集合(用于multi view的tab view属性)
|
|
1185
1184
|
*/
|