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