@fox-js/fox 3.1.1-13 → 3.1.1-15

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 CHANGED
@@ -1,3 +1 @@
1
- "use strict";/*!
2
- * fox v3.1.0 Sun Aug 24 2025 00:23:21 GMT+0800 (中国标准时间)
3
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("vue"),ye=typeof window<"u",E=function(){return window},Be=function(){return window.document};function ir(r){let e=r,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 mt(){if(!ye)return"/";let r=E().location,e=`${r.protocol}//${r.host}`;return e+=ir(r.pathname),e}function it(r,e,t,s=!1){r.addEventListener?r.addEventListener(e,t,s):r.attachEvent?r.attachEvent(`on${e}`,t):r[`on${e}`]=t}function Vt(r,e,t){r.removeEventListener?r.removeEventListener(e,t):r.detachEvent?r.detachEvent(`on${e}`,t):r[`on${e}`]=null}const Ue=(r,e,t)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("Events");let n=!0,i=!0;for(let a in e)a==="bubbles"?n=!!e[a]:a==="cancelable"?i=!!e[a]:s[a]=e[a];s.initEvent(r,n,i),(t??document).dispatchEvent(s)},Ot=Array.isArray,or=r=>ut(r)==="[object Map]",lr=r=>ut(r)==="[object Set]",ar=r=>r instanceof Date,S=r=>typeof r=="function",ur=r=>typeof r=="string",fr=r=>typeof r=="symbol",As=r=>r!==null&&typeof r=="object",cr=r=>As(r)&&S(r.then)&&S(r.catch),De=r=>r==null,hr=Object.prototype.toString,ut=r=>hr.call(r),Es=r=>ut(r)==="[object Object]",yr=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function zt(r){return r.__esModule||yr&&r[Symbol.toStringTag]==="Module"}const dr=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function C(...r){let e=r[0]!==void 0&&r[0]!==null?r[0]:{},t=1,s=r.length,n=!1;for(typeof e=="boolean"&&(n=e,e=r[t]??{},t++),typeof e!="object"&&(e={});t<s;t++)if(r[t]!==null&&r[t]!==void 0){let i=r[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]=C(n,u,l)}else l!==void 0&&(e[o]=l)}}return e}function ft(r,e,t=!1){if(!t)C(!0,r,e);else{if(typeof e!="object")return{};typeof r!="object"&&(r={});for(let s of Reflect.ownKeys(e)){let n=r[s],i=e[s];if(n!==i)if(typeof i=="object"){if(!Array.isArray(i)&&!Es(i))continue;n=ft(n,i,t),r[s]=n}else{if(typeof i=="function")continue;r[s]=i}}}return r}class ie{static seed=new Date().getTime();static get(){let e=++ie.seed;return e>=Number.MAX_VALUE&&(ie.seed=0),e}}const pt=dr?Promise.resolve():null;function Me(r,...e){pt!==null?e&&e.length>0?pt.then(()=>{r(e)}):pt.then(r):e&&e.length>0?setTimeout(()=>{r(e)}):setTimeout(r)}function Wt(r){return r==null?!1:typeof r=="boolean"?r:typeof r=="string"?r.toLocaleLowerCase()==="true":!!r}function mr(r){return typeof r=="number"?r:Number(r)}const pr={"[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(r){let t=Object.prototype.toString.call(r);return r==null?String(r):pr[t]||"object"}function It(r,e){if(r==e)return!0;if(r===void 0||e===void 0)return!1;let t=Mt(r),s=Mt(e);if(t!==s)return!1;if(t==="object"){let n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++){let a=n[o],l=r[a],u=e[a];if(!It(l,u))return!1}return!0}else if(t==="array"){if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++){let i=r[n],o=e[n];if(!It(i,o))return!1}return!0}return!1}const $s=r=>{const e={};for(let t of Reflect.ownKeys(r)){let s=r[t];s&&!Array.isArray(s)&&typeof s=="object"&&(s=$s(s)),typeof t=="symbol"?e[String(t)]=s:e[t]=s}return e},gr=/^Symbol\((.*)\)$/,_s=r=>{const e={};for(let t of Reflect.ownKeys(r)){let s=r[t];s&&!Array.isArray(s)&&typeof s=="object"&&(s=_s(s));const n=gr.exec(t);if(n&&n[1]){const i=Symbol.for(n[1]);e[i]=s}else e[t]=s}return e};function Ks(r,e){let t=null;return function(...s){t&&clearTimeout(t),t=setTimeout(()=>{t=null,Reflect.apply(r,null,[...s])},e)}}const ns=Symbol("idKey"),de=Symbol("valueKey"),R=Symbol("childrenKey"),z=Symbol("growKey");class js{[z]=!0;[ns];[de]=g.ref();[R]=new Map;constructor(e){this[ns]=e}}class vr{get(e,t){if(t=="value")return e[de].value;if(t==="grow")return e[z];let s=e[R].get(t);if(s)return He(s);if(e[z])return s=Gt(t),s[z]=e[z],e[R].set(t,s),He(s)}set(e,t,s){return t=="value"?(e[de].value=s,!0):t==="grow"?(e[z]=Wt(s),!0):s==null?(e[R].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[R].delete(t),!0)}}const Jt="__proxy__";function Gt(r){const e=new js(r);return Reflect.set(e,Jt,new Proxy(e,new vr)),e}function He(r){return Reflect.get(r,Jt)}let wr=class{name="";persistPolicy="memory";storage;initFlag=!1;state={};constructor(e={},t){if(e.persistPolicy&&e.persistPolicy!=="memory"&&De(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(ye){const t=E();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}`,s=JSON.stringify(this.state??{});e.setItem(t,s)}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 s=`_bus_${this.name}`,n=t.getItem(s);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,s=e.slice(0,t-1).join("/"),n=e[t-1];this.state[s]=n,this.saveState()}catch(t){console.error(t)}}remove(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,s=e.slice(0,t-1).join("/"),n={};Reflect.ownKeys(this.state).forEach(o=>{typeof o=="string"&&(o===s||o.startsWith(s)||(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 qs extends js{_persistHandler;constructor(e={},t){super("__root__"),this._persistHandler=new wr(e,t),this._persistHandler.init(this)}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let s=this;for(let n=0;n<t-1;n++){let i=e[n],o;s[R].has(i)?o=s[R].get(i):(o=Gt(i),s[R].set(i,o)),s=o}return s[de].value=e[t-1],this._persistHandler.put(e),!0}get(...e){let t=e.length;if(t===0)return;let s=this;for(let n=0;n<t;n++){let i=e[n];if(s[R].has(i))s=s[R].get(i);else return}return s[de].value}remove(...e){let t=e.length;if(t==0)return!1;let s=this;for(let i=0;i<t-1;i++){const o=e[i];if(s[R].has(o))s=s[R].get(o);else return!1}const n=e[t-1];return s[R].has(n)?(s[R].delete(n),this._persistHandler.remove(e),!0):!1}contains(...e){const t=e.length;if(t==0)return!1;let s=this;for(let i=0;i<t-1;i++){let o=e[i];if(s[R].has(o))s=s[R].get(o);else return!1}const n=e[t-1];return s[R].has(n)}clear(){this[R].clear(),this._persistHandler.clear()}}const br=["put","get","contains","remove","clear","_persistHandler"];function is(r){return br.includes(r)}class Sr{get(e,t){if(t=="value")return e[de].value;if(t==="grow")return e[z];if(t===R)return e[R];if(typeof t=="string"&&is(t))return e[t];const s=String(t);let n=e[R].get(s);if(n)return He(n);if(e[z])return n=Gt(s),n[z]=e[z],e[R].set(s,n),He(n)}set(e,t,s){return t=="value"?(e[de].value=s,!0):t==="grow"?(e[z]=Wt(s),!0):is(t)?!1:s==null?(e[R].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[R].delete(t),!0)}}function Rr(r,e){const t=new qs(r,e),s=new Sr,n=new Proxy(t,s);return Reflect.set(t,Jt,n),t}const Ht=new Proxy(qs,{construct(r,e){const t=e[0]??{},s=e[1],n=Rr(t,s);return He(n)}}),Xt=r=>!r||typeof r!="object"?!0:Reflect.ownKeys(r).length===0;class Ts{name="";persistPolicy="memory";storage;constructor(e={}){if(e.persistPolicy&&e.persistPolicy!=="memory"&&De(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(ye){const t=E();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||Xt(e))return;const s=`_state_${this.name}`,n=JSON.stringify(e??{});t.setItem(s,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 s=`_state_${this.name}`,n=t.getItem(s);if(n){const i=JSON.parse(n);Object.assign(e,i)}}}function ks(r,e,t){const s=new Ts(t);s.restore(e);const n=l=>{const u=g.toRaw(l),f={};for(let c in u){const h=u[c];De(h)||(f[c]=h)}Xt(f)?s.removeState():s.saveState(f)};let i=null;if(t&&t.debounce===!1)i=n;else{const l=t&&t.debounceDelay?t.debounceDelay:250;i=Ks(n,l)}const o=r?g.shallowReactive(e):g.reactive(e);return g.effectScope(!0).run(()=>{g.watch(o,l=>{const u=g.toRaw(l);i(u)})}),o}function xr(r,e){return ks(!1,r,e)}function Pr(r,e){return ks(!0,r,e)}function Fr(r,e){const t=new Ts(e);t.restore(r);const s=a=>{const l=g.toRaw(a),u={};for(let f in l){const c=l[f];De(c)||(u[f]=c)}Xt(u)?t.removeState():t.saveState(u)};let n=null;if(e&&e.debounce===!1)n=s;else{const a=e&&e.debounceDelay?e.debounceDelay:250;n=Ks(s,a)}const i={get(a,l){return a[l]},set(a,l,u){return a[l]=u,n(a),!0}};return new Proxy(r,i)}function Cr(r,e){return Fr(r,e)}const Q="default",Ls=Symbol("sync"),O=Symbol("normalizeRoute");function os(r){let e=!1;return function(...t){if(!e)return e=!0,Reflect.apply(r,{},t)}}function Ar(r){let e=r.src;return new Promise((t,s)=>{const n=os(a=>{zt(a)&&(a=a.default),r.component=a,console.debug("success load async module"),t()}),i=os(a=>{console.debug("reject load async module"),s(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 Er{name;level;rootName;rootIndex=0;constructor(e,t,s,n){this.name=e,this.level=t,this.rootName=s,this.rootIndex=n}}class Re{to;routeModel;from;data={};constructor(e,t){this.to=e,this.from=t}static from(e){const t=new Re(e.to,e.from),s=e.data??{};return C(!0,t.data,s),t}static clear(e){for(let t in e)e[t]=void 0}}class x{path;get fullPath(){const e=this.path??`/${this.name}`;return`${this.root??Q}!${e}`}alias;name;root;params;query;traceless;template;matched;meta;success;error;destroy;opsType;updateType;historyUpdatePolicy;viewTagAttrs;index;active;slot;static clone(e,t){let s=new x;return ft(s,e,t),s}static isSame(e,t){return!e||!t?!1:e===t?!0:e.root!==t.root||e.index!==t.index?!1:e.path&&t.path&&e.path===t.path?!0:!!(e.name&&t.name&&e.name===t.name)}static isSamePathForRoute(e,t){return!e||!t?!1:e===t||e.path&&t.path&&e.path===t.path?!0:!!(e.name&&t.name&&e.name===t.name)}static from(e){let t=new x;if(e==null)return t;let s=t;for(let i in e){let o=e[i];s[i]=o}const n=Object.getOwnPropertySymbols(e);if(Array.isArray(n)&&n.length>0)for(let i of n)s[i]=e[i];return t}}class $r{id;name;props;meta;src;component;constructor(e,t,s,n){this.id=ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=s,this.meta=n}get isResolved(){return this.component!==void 0}resolve(){return Ar(this)}}class ls{models=[]}class gt{path;match;redirect;name;layers=[]}var F=(r=>(r[r.Push=0]="Push",r[r.Replace=1]="Replace",r[r.Put=2]="Put",r[r.Append=3]="Append",r[r.Open=4]="Open",r))(F||{});const Os="FoxBeforeEnter",Ms="FoxEnter",Is="FoxLeave",Hs="FoxLeave",ot="FoxLeaveEnd",I=Symbol("chainKey"),L=Symbol("cursorKey"),vt=Symbol("$persistentModeKey"),A=Symbol("statusKey"),G=Symbol("argsKey"),Ve=Symbol("exArgsKey"),ge=Symbol("successFnsKey"),Ae=Symbol("errorFnsKey"),ne=Symbol("sessionKey"),X=Symbol("_go");class Ne{[I]=[];[L]=0;[vt]=!1;[A]="Free";[G]=[];[Ve]=[];[ge]=[];[Ae]=[];[ne];get session(){return this[ne]}constructor(e,t=!1){this[ne]=e,this[vt]=t}[X](e,...t){let s=this[A];if(this[A]="Busy",this[L]+=e,this[L]<0&&(this[L]=0),this[G]=t,s==="Exception"||s==="Reject"){let a=[{session:this[ne]},...this[Ve]];for(;this[Ae].length>0;)try{let l=this[Ae].shift();typeof l=="function"&&Me(()=>{Reflect.apply(l,{},a)})}catch(l){console.error(l.message,l)}return this[A]=s,this[I]=[],this[L]=0,this}else if(s==="Finished"||this[L]>=this[I].length){let a=[{session:this[ne]},...this[G]];for(;this[ge].length>0;){let l=this[ge].shift();typeof l=="function"&&Me(()=>{Reflect.apply(l,{},a)})}return this[A]="Free",this}if(this[L]>=this[I].length)return this[A]="Free",this;let n=this[I][this[L]];this[vt]||(this[I].splice(0,this[L]+1),this[L]=-1);let i=this[L]+1;try{let o=!1,a={go:(l,...u)=>{o||(o=!0,Reflect.apply(this[X],this,[l,...u]))},resolve:(...l)=>{o||(o=!0,Reflect.apply(this[X],this,[1,...l]))},reject:(...l)=>{o||(o=!0,Reflect.apply(this.reject,this,[...l]))},insert:l=>{o||(this[I].splice(i,0,l),i++)},session:this[ne]};Me(()=>{Reflect.apply(n,{},[a,...this[G]])})}catch(o){this.throw(o)}return this}go(e,...t){return Reflect.apply(this[X],this,[e,...t])}finish(...e){return this[A]="Finished",this[G]=e,Reflect.apply(this[X],this,[0])}reject(...e){return this[A]="Reject",this[Ve]=e,Reflect.apply(this[X],this,[0])}throw(...e){return this[A]="Exception",this[Ve]=e,Reflect.apply(this[X],this,[0])}reset(...e){this[A]="Busy",this[G]=e,this[I]=[],this[L]=0;let s=[{session:this[ne]},...this[G]];for(;this[ge].length>0;){let n=this[ge].shift();Me(()=>{Reflect.apply(n,this,s)})}return this[A]="Free",this}post(e){return this[A]==="Reject"||this[A]==="Exception"?this:(Array.isArray(e)?this[I]=[...this[I],...e]:this[I].push(e),this[A]==="Busy"?this:(Reflect.apply(this[X],this,[0,...this[G]]),this))}wait(e,t){return e&&typeof e=="function"&&this[ge].push(e),t&&typeof t=="function"&&this[Ae].push(t),this[A]==="Busy"?this:(Reflect.apply(this[X],this,[0,...this[G]]),this)}exception(e){return e&&typeof e=="function"&&this[Ae].push(e),this[A]==="Busy"?this:Reflect.apply(this[X],this,[0,...this[G]])}isFinish(){return this[A]=="Reject"||this[A]=="Free"&&this[L]>=this[I].length}}const ve=Symbol("registerKey");class _r{policy;callback;constructor(e,t){this.callback=e,this.policy=t}}class Nt{[ve]=new Map;constructor(){}on(e,t,s=!1){let n=this[ve].get(e);n||(n=new Array,this[ve].set(e,n));let i=s===!0?1:0,o=new _r(t,i);return n.push(o),this}off(e,t){if(!t)return this[ve].delete(e),this;let s=this[ve].get(e);if(s){for(let n=0;n<s.length;n++)if(s[n].callback===t){s.splice(n,1);break}}return this}bind(e,t,s=!1){return this.on(e,t,s)}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 s=e[t-1];if(typeof s!="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(s,{},i)});return this}emit(e,...t){let s=this[ve].get(e);if(!s)return this;for(let n=0;n<s.length;){let i=s[n];if(i.policy==1?s.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 Ee=Symbol("registerKey");class Kr{[Ee]=new Map;constructor(){}set(e,t){this[Ee].set(e,t)}get(e){return this[Ee].get(e)}has(e){return this[Ee].has(e)}delete(e){return this[Ee].delete(e)}}const he=Symbol("lc");function lt(r,e=!1){let t=r;if(Reflect.has(t,he))return t[he];if(e){const s=new Kr;return t[he]=s,s}return null}function Ns(r,e=!1){let t=null,s=r;for(;s&&!(Reflect.has(s,he)&&(t=s[he],t));)s=s.$parent;if(!t&&e){const n=r;n&&n.$parent&&(t=lt(n.$parent,e))}return t}function Qt(r,e){let t=r;for(;t;){if(Reflect.has(t,he)){const s=t[he];if(s.has(e))return s.get(e)}t=t.$parent}return null}function jr(r,e,t){Ns(r,!0)?.set(e,t)}function qr(r,e){Ns(r,!0)?.delete(e)}function as(r){if(Array.isArray(r.children)&&r.children.length>0){let e=r.children[0];if(e!=null&&e.component!=null&&e.component.proxy!=null)return lt(e.component.proxy,!1)}return null}const at=Symbol("hooksKey");function Tr(r){let e=r.get(at);e||(e=[],r.set(at,e))}function us(r,e){let t=r.get(at);if(t!=null)for(let s=t.length-1;s>=0;s--){let n=t[s];if(n.type===e)try{Reflect.apply(n.hook,n.target,[])}catch(i){console.error(i.message,i)}}}var Dt=(r=>(r.DEACTIVATED="da",r.ACTIVATED="a",r))(Dt||{});class kr{type;hook;target;constructor(e,t,s){this.target=s,this.hook=t,this.type=e}}function Lr(r,e,t,s){let n=new kr(e,t,s);return r.push(n),!0}function Or(r,e,t,s){let n=-1;for(let i=0;i<r.length;i++){let o=r[i];if(o.type===e&&o.hook===t&&o.target===s){n=i;break}}return n!=-1?(r.splice(n,1),!0):!1}function Ds(r){return(e,t)=>{let s;if(t)s=t;else{const i=g.getCurrentInstance();if(i==null||i.proxy==null){console.error("can not get current instance or proxy");return}s=i.proxy}const n=Qt(s,at);if(n==null){console.warn("hooks context not found");return}g.onUnmounted(()=>{Or(n,r,e,s)}),Lr(n,r,e,s)}}const Mr=Ds("a"),Ir=Ds("da"),Bs=Symbol("routeKey");function fs(r,e){r.set(Bs,e)}function Yt(r){let e=Qt(r,Bs);return typeof e=="function"?e():e??null}const ct=Symbol("rk"),wt=Symbol("vd"),cs=Symbol("rv"),bt=Symbol("rvi"),hs=Symbol("pv"),St=Symbol("pvi");var Ie=(r=>(r[r.Static=0]="Static",r[r.Param=1]="Param",r[r.Group=2]="Group",r))(Ie||{});const Hr={type:0,value:""},Nr=/[a-zA-Z0-9_]/;function Dr(r){if(!r)return[[]];if(r==="/")return[[Hr]];if(!r.startsWith("/"))throw new Error(`Invalid path "${r}"`);function e(y){throw new Error(`ERR (${t})/"${u}": ${y}`)}let t=0,s=t;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,u="",f="";function c(){u&&(t===0?i.push({type:0,value:u}):t===1||t===2||t===3?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),i.push({type:1,value:u,regexp:f,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),u="")}function h(){u+=l}for(;a<r.length;){if(l=r[a++],l==="\\"&&t!==2){s=t,t=4;continue}switch(t){case 0:l==="/"?(u&&c(),o()):l===":"?(c(),t=1):h();break;case 4:h(),t=s;break;case 1:l==="("?t=2:Nr.test(l)?h():(c(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case 2:l===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+l:t=3:f+=l;break;case 3:c(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--,f="";break;default:e("Unknown state");break}}return t===2&&e(`Unfinished custom RegExp for param "${u}"`),c(),o(),n}const ys="[^/]+?",Br={sensitive:!1,strict:!1,start:!0,end:!0},Ur=/[.+*?^${}()[\]/\\]/g;function Vr(r,e){const t=C(!0,{},Br,e),s=[];let n=t.start?"^":"";const i=[];for(const u of r){const f=u.length?[]:[90];t.strict&&!u.length&&(n+="/");for(let c=0;c<u.length;c++){const h=u[c];let y=40+(t.sensitive?.25:0);if(h.type===Ie.Static)c||(n+="/"),n+=h.value.replace(Ur,"\\$&"),y+=40;else if(h.type===Ie.Param){const{value:d,repeatable:p,optional:v,regexp:w}=h;i.push({name:d,repeatable:p,optional:v});const m=w||ys;if(m!==ys){y+=10;try{new RegExp(`(${m})`)}catch(W){throw new Error(`Invalid custom RegExp for param "${d}" (${m}): `+W.message)}}let $=p?`((?:${m})(?:/(?:${m}))*)`:`(${m})`;c||($=v&&u.length<2?`(?:/${$})`:"/"+$),v&&($+="?"),n+=$,y+=20,v&&(y+=-8),p&&(y+=-20),m===".*"&&(y+=-50)}f.push(y)}s.push(f)}if(t.strict&&t.end){const u=s.length-1;s[u][s[u].length-1]+=.7000000000000001}t.strict||(n+="/?"),t.end?n+="$":t.strict&&!n.endsWith("/")&&(n+="(?:/|$)");const o=new RegExp(n,t.sensitive?"":"i");function a(u){const f=u.match(o),c={};if(!f)return null;for(let h=1;h<f.length;h++){const y=f[h]||"",d=i[h-1];c[d.name]=y&&d.repeatable?y.split("/"):y}return c}function l(u){let f="",c=!1;for(const h of r){(!c||!f.endsWith("/"))&&(f+="/"),c=!1;for(const y of h)if(y.type===Ie.Static)f+=y.value;else if(y.type===Ie.Param){const{value:d,repeatable:p,optional:v}=y,w=d in u?u[d]:"";if(Ot(w)&&!p)throw new Error(`Provided param "${d}" is an array but it is not repeatable (* or + modifiers)`);const m=Ot(w)?w.join("/"):w;if(!m)if(v)h.length<2&&(f.endsWith("/")?f=f.slice(0,-1):c=!0);else throw new Error(`Missing required param "${d}"`);f+=m}}return f||"/"}return{re:o,score:s,keys:i,parse:a,stringify:l}}function zr(r,e){const t=Vr(Dr(r),e);return function(s){const n=t.parse(s);return n?{path:s,params:n}:null}}var st=(r=>(r[r.Part=0]="Part",r[r.All=1]="All",r))(st||{});const V=Symbol("rootKey"),U=Symbol("rootNodeKey"),ce=Symbol("parentNodeKey"),rt=Symbol("nameKey");class te{instance=null;model;route;active=!0;index=0;constructor(e,t,s=0,n=!0){this.route=e,this.model=t,this.index=s,this.active=n}}class $e{_slots;get slots(){return this._slots==null&&(this._slots=g.shallowRef([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[rt];[V];[U]=null;[ce]=null;get name(){return this[rt]}constructor(e,t,s){this[rt]=e,this[V]=t,s&&(this[U]=s)}}class H{view;index;level;constructor(e,t,s){this.view=e,this.index=t,this.level=s}static include(e,t){for(let s=0;s<e.length;s++){let n=e[s];if(n.view===t.view&&(t.index==-1||n.index===t.index)&&n.level===t.level)return!0}return!1}}class Rt{views=[]}class Wr{layers=[]}class Jr{time;route}class Gr{forbidTime=300;submitRecorder=new Jr;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 xe=Symbol("_notifyChange");class ds{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}}const le=Symbol("historyChangeConsumerKey"),ms=Symbol("_navigateFirstRoute"),ze=Symbol("_getRouteMark"),xt=Symbol("_getUrlSearch"),Pt=Symbol("_generateLocation"),We=Symbol("_setRouteMarkRecorder"),_e=Symbol("beforeRestoreFiltersKey"),ps=Symbol("_beforeRestore"),gs="Symbol(_fox_restore_point)";function Ke(r,...e){return typeof r=="function"?Reflect.apply(r,null,[...e]):r}function vs(r){if(!Array.isArray(r))return!1;if(r.length===0)return!0;const e=r[0];return!!(Reflect.has(e,"path")&&Reflect.has(e,"root"))}class Us{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[le]=!1;[_e]=new Array;backTimeout=320;constructor(e="hash",t="",s="",n=!0,i=!0,o=!1,a,l){this.mode=e,this.base=t,this.query=s,this.firstNavigate=n,this.historyMonitor=i,this.traceless=o,this.storage=a??E().sessionStorage,this.backTimeout=l??320}init(e=!0){const t=E();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(typeof this[le]=="function"){const s=this[le]();if(this[le]=!1,s)return}else if(this[le]===!0){this[le]=!1;return}if(Ke(this.historyMonitor)){const s=t.history.state;this[xe](s);try{let n=[];if(typeof s=="string"?n=JSON.parse(s):n=s,Array.isArray(n)&&n.length>0){const i=this[ze]()??"/";this[We](i,n)}}catch{}}}),it(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[ms](),Promise.resolve()}destroy(){if(this.historyChange){const e=E();Vt(e,"popstate",this.historyChange)}}[ps](e,t,s,n){for(let i of this[_e])try{const o=Reflect.apply(i,{},[e,t,s,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}[ms](){const e=this[ze]()??"/",t=this.storage.getItem(gs);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?_s(l.params):{},this[ps](l,u,e,o.routes)));if(a.length>0){const l=this[xt](),u=a.length-1;a[u].query=l||a[u].query,this[xe](a);return}}}catch{}const s=e.indexOf("!");let n;s!=-1?n=e.substring(s+1):n=e;const i=new x;i.path=n,i.query=this[xt](),this[xe]([i])}[We](e,t){try{t.forEach(i=>{i.params=i.params?$s(i.params):{}});const n=JSON.stringify({mark:e,routes:t});this.storage.setItem(gs,n)}catch(s){console.error(s.message,s)}}setRestorePoint(e){const t=this[ze]()??"/";this[We](t,e)}[xe](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[ze](){const e=E();if(this.mode==="path"){let t=e.location.pathname;return this.base&&t.indexOf(this.base)===0&&(t=t.substring(this.base.length)),t}else{const t=e.location.hash,s=t.indexOf("#");if(s!=-1)return t.substring(s+1)}return null}[xt](){let t=E().location.search;return t.length>0&&t.indexOf("?")===0&&(t=t.substring(1)),t}listen(e){this.changeHandler=e}go(e,t=!1){const s=E();this[le]=t,s.history.go(e)}goBack(e,t){const s=E(),n=s.history.state;if(vs(n)&&n.length>0){let i=!1;for(let f=n.length-1;f>=0;f--){const c=x.from(n[f]);if(!(c.historyUpdatePolicy==="traceless"||Ke(this.traceless,c))&&x.isSame(c,e)){i=!0;break}}if(!i){t();return}const o=this.backTimeout;let a=null;const l=()=>{s.history.go(-1),a=setTimeout(l,o)},u=()=>{clearTimeout(a);const c=E().history.state;if(vs(c)&&c.length>0){let h=c.length;const y=c[h-1],d=x.from(y);if(x.isSame(d,e))return t(),!0;if(h>0){let p=!1;for(let v=h-1;v>=0;v--){const w=x.from(c[v]);if(!(w.traceless===!0||Ke(this.traceless,w))&&x.isSame(w,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[Pt](e.currentRoute);e.currentRoute.historyUpdatePolicy!=="traceless"&&!Ke(this.traceless,e.currentRoute)&&E().history.pushState(e.routes,"",t),this.setRouteMark(e)}replace(e){const t=this[Pt](e.currentRoute);(e.currentRoute.historyUpdatePolicy!=="traceless"||!Ke(this.traceless,e.currentRoute))&&E().history.replaceState(e.routes,"",t),this.setRouteMark(e)}[Pt](e){const t=E();let s="";if(e.query){let a="";if(typeof e.query=="object")for(let l of Reflect.ownKeys(e.query)){let u=encodeURIComponent(e.query[l]),f=`${encodeURIComponent(String(l))}=${u}`;a.length>0&&(a+="&"),a+=f}else a=e.query;this.query?(s=a.length>0?`${this.query}&${a}`:this.query,s.length>0&&s.charAt(0)!=="?"&&(s=`?${s}`)):a.length>0&&(s=`?${a}`)}const n=t.location;let i=e.alias??e.fullPath;i.startsWith(Q)&&(i=i.substring(Q.length+1));let o;return s?this.mode=="path"?i.indexOf("/")===0?o=`${this.base}${i}${s}`:o=`${this.base}/${i}${s}`:o=`${n.pathname}${s}#${i}`:this.mode=="path"?i.indexOf("/")===0?o=`${this.base}${i}`:o=`${this.base}/${i}`:o=`${n.pathname}#${i}`,`${n.origin}${o}`}}function Xr(r=!0,e=null,t="",s=!0,n=!1,i){return e!==null&&(e=E().location.pathname),e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),new Us("path",e??"",t,r,s,n,i)}function Vs(r=!0,e="",t=!0,s=!1,n){return new Us("hash","",e,r,t,s,n)}class Qr{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}[xe](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!1){if(this.queue.length==0||this.cursor<=0)return;let s=this.cursor+e;if(s<0?s=0:s>this.queue.length-1&&(s=this.queue.length-1),s!=this.cursor){this.cursor=s;let n=!1;if(typeof t=="function"?n=t():n=t,!n){const i=this.queue[s];this[xe](i.routes)}}}goBack(e,t){if(this.queue.length==0||this.cursor<=0)return;let s=0;if(e===null)s=this.cursor+1;else for(let n=this.cursor;n>=0;n--){const i=this.queue[n];if(x.isSame(i.currentRoute,e))break;s++}if(s===0){t();return}this.go(-s,()=>(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 zs(r="",e=50){return new Qr(r,e)}const Je=Symbol("_constructRouteModel"),Ge=Symbol("_findRouteModel"),Ft=Symbol("_findRootView"),ws=Symbol("_getFirstView"),ae=Symbol("_removeView"),bs=Symbol("_buildPage"),Ss=Symbol("_resolveComponent"),Rs=Symbol("_update"),se=Symbol("_merge"),Ct=Symbol("_handleHistoryChange"),ue=Symbol("_handleRouteUpdated"),Xe=Symbol("routeUpdatedCallback"),At=Symbol("currentRoute"),b=Symbol("currentRoutes"),Qe=Symbol("routeSessionCacheKey"),xs=Symbol("_addRouteRecorder"),je=Symbol("_removeRouteRecorder"),Ye=Symbol("_cloneRouteRecorder"),K=Symbol("_handleError"),Ze=Symbol("errorCallback"),N=Symbol("registerKey"),et=Symbol("notFoundKey"),Et=Symbol("notFoundPathKey"),D=Symbol("forestKey"),P=Symbol("historyKey"),qe=Symbol("beforeFiltersKey"),Te=Symbol("afterFiltersKey"),ke=Symbol("destroyFiltersKey"),$t=Symbol("propsFilterKey"),we=Symbol("mainDispatcherKey"),_t=Symbol("initKey"),fe=Symbol("readyKey"),Kt=Symbol("readyHandlersKey"),tt=Symbol("_markReady"),Ps=Symbol("_createNextFn"),jt=Symbol("_start"),qt=Symbol("_before"),Tt=Symbol("_after"),Fs=Symbol("_destroy"),kt=Symbol("_load"),Le=Symbol("_unload"),Oe=Symbol("routerGuardKey");function Yr(r){return r.layers.length==0||r.layers[0].views.length==0}function Zr(r){let e=[];return r.layers.forEach(t=>{t.models==null||t.models==null||t.models.forEach(s=>{if(!(s==null||s==null))if(typeof s.meta=="object"){let n=C(!0,{},s.meta);e.push(n)}else s.meta&&e.push(s.meta)})}),e}class en{[N]=new Array;[et];[Et]="*";[fe]=!1;[Kt]=[];[D]=new Wr;[P];[b]=new Array;[At]=g.shallowRef(null);[Qe]=new WeakMap;[Ze]=null;[Xe]=null;[qe]=new Array;[Te]=new Array;[ke]=new Array;[$t]=null;[we]=new Ne;[Oe]=new Gr;[_t]=!1;get currentRoute(){return g.readonly(this[At])}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[P]=e.history:this[P]=ye?Vs():zs(),this[P]?.listen(async s=>{let n=!0;try{if(typeof s=="string"){const i=this[O](s);i&&await this[Ct]([i])}else await this[Ct](s)}catch(i){console.error(i.message,i),n=!1}this[fe]===!1&&this[tt](n)})}[K](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[Ze]=="function")try{this[Ze](e,t)}catch{}console.error(e)}init(){this[_t]!==!0&&(this[P]?.init(!this[fe]),this[_t]=!0)}isReady(){return this[fe]?Promise.resolve():new Promise((e,t)=>{this[Kt].push([e,t])})}[tt](e){this[fe]=!0,this[Kt].forEach(([t,s])=>{try{e?t():s()}catch(n){console.error(n.message,n)}})}[Ct](e){try{if(!e){let o=[...this[b]].reverse();return this[Le](o),ye&&E().location.reload(),Promise.resolve()}let t=null,s=[],n=[],i=0;for(;i<e.length&&i<this[b].length&&x.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&&(s=e.slice(i)),i<this[b].length&&(n=this[b].slice(i).reverse()),n.length===0&&s.length===0){if(t!==null)return this.restore([t])}else if(n.length>0){if(this[Le](n)){if(s.length>0)return this.restore(s);if(t!==null)return this.restore([t])}}else return this.restore(s)}catch(t){this[K](t)}return Promise.resolve()}[ue](e=null){if(this[At].value=e,typeof this[Xe]=="function")try{this[Xe](e)}catch{}}[xs](e,t){if(e.opsType===F.Open){let s=!1;const n=this[b].length-1;for(let i=n;i>=0;i--){const o=this[b][i];if(e.root==o.root){if(e.path===o.path){this[b].splice(i,1,e),s=!0;continue}e.active&&(o.active=!1)}}s||this[b].push(e)}else this[b].push(e);this[Qe].set(e,t),this[ue](e)}[Ye](){let e=[];for(let t of this[b]){let s=x.clone(t,!0);e.push(s)}return e}[je](e){if(!this[b]){this[ue](null);return}let t=-1;for(let s=0;s<this[b].length;s++)if(x.isSame(this[b][s],e)){t=s;break}if(t!=-1){const s=this[b][t];this[b].splice(t,1);const n=this[Qe].get(s);if(this[Qe].delete(s),this[Fs](s,n),s.opsType===F.Append){const i=this[b].length-1;this[ue](this[b][i]??null)}else this[ue](null)}else this[ue](null)}set historyMonitor(e){this[P]&&(this[P].historyMonitor=e)}get historyMonitor(){return this[P]?this[P].historyMonitor:!1}set traceless(e){this[P]&&(this[P].traceless=e)}get traceless(){return this[P]?this[P].traceless:!1}set propsFilter(e){this[$t]=e}get propsFilter(){return this[$t]}setRestorePoint(){const e=this[Ye]();this[P]?.setRestorePoint(e)}onRouteUpdated(e){this[Xe]=e}onError(e){this[Ze]=e}beforeEach(e){this[qe].push(e)}removeBeforeEach(e){const t=this[qe].indexOf(e);return t!==-1?(this[qe].splice(t,1),!0):!1}afterEach(e){this[Te].push(e)}removeAfterEach(e){const t=this[Te].indexOf(e);return t!==-1?(this[Te].splice(t,1),!0):!1}destroyEach(e){this[ke].push(e)}removeDestroyEach(e){const t=this[ke].indexOf(e);return t!==-1?(this[ke].splice(t,1),!0):!1}beforeRestoreEach(e){this[P]?.beforeRestoreEach(e)}removeBeforeRestoreEach(e){return this[P]?.removeBeforeRestoreEach(e)??!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[Et]){this.setNotFoundRoute(e);return}const s=this[Je](e);if(t==-1)this[N]=[...this[N],...s];else for(let n=s.length-1;n>=0;n--)this[N].splice(t,0,s[n])}removeRoute(e){const t=this[O](e);if(t===null)return console.warn("route格式错误",e),!1;for(let s=0;s<this[N].length;s++){const n=this[N][s];if(t?.path&&n.path===t.path)return this[N].splice(s,1),!0;if(t?.name&&n.name===t.name)return this[N].splice(s,1),!0}return!1}hasRoute(e){const t=this[O](e);return t===null?(console.warn("route格式错误",e),!1):this[N].findIndex(n=>{if(t?.path&&n.path===t.path||t?.name&&n.name===t.name)return!0})!==-1}setNotFoundPath(e){this[Et]=e}setNotFoundRoute(e){const t=this[Je](e);this[et]=t[0]}getRoutes(){return[...this[N]]}[Je](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let s=e.components??(e.component&&{"":e.component});if(s==null){const a=new gt;return a.path=t,a.redirect=e.redirect,[a]}let n=[];for(let a in s){let l=s[a];a.length===0&&(a=Q);let u=new $r(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[Je](a);for(let u of l){let f=new gt;f.name=u.name,u.path&&u.path.length>0?t!=="/"?f.path=`${t}${u.path}`:f.path=u.path:(i=!0,f.path=t);let c=new ls;c.models=[...n],f.layers=[c,...u.layers],o.push(f)}}if(!i){const a=new ls;a.models=n;const l=new gt;l.name=e.name,l.path=t,l.layers=[a],o.splice(0,0,l)}return o}[Ge](e){const t=e.route;try{for(let s of this[N]){const n=t.template??t.path,i=t.template??t.name;if(n&&s.path){let o=s.match;o||(o=s.match=zr(s.path));const a=o(n);if(!a)continue;if(s.redirect){const l=new x;C(!0,l,t),l.path=s.redirect;const u={route:l,find:void 0};return this[Ge](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??{},C(!0,t.params,a.params),t.query){const l=t.query;if(typeof l=="string"){const u={},f=l.split("&");for(let c of f){const h=c.split("=");if(h.length!==2)continue;const y=decodeURIComponent(h[0].trim()),d=decodeURIComponent(h[1].trim());u[y]=d}C(!0,t.params,u)}else typeof l=="object"&&C(!0,t.params,l)}return e.find=s,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0}else if(i===s.name)return e.find=s,t.template&&e.find&&(e.find={...e.find},e.find.name=t.name),!0}}catch(s){console.error(s.message,s),typeof t.error=="function"&&t.error(s.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 s=0;s<e.length;s++)s===0?e[s].charAt(0)==="/"?t.path=e[s]:t.name=e[s]:s===1?t.params=e[s]:s===2?t.root=e[s]:s===3&&C(!1,t,e[s]);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 s=t.path.indexOf("?");s!==-1&&s<t.path.length-1&&(t.query=t.path.substring(s+1),t.path=t.path.substring(0,s))}t.root=t.root??Q,t.opsType=t.opsType??this.options.defaultOperationType??F.Push,t.traceless&&!t.historyUpdatePolicy&&(t.historyUpdatePolicy="traceless")}return t}push(...e){const t=this[O](e);return t?(t.opsType=F.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=F.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=F.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=F.Append,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}remove(e,t){return new Promise(s=>{this[we].post(n=>{try{if(this[b].length===0){n.resolve(),s(!1);return}let i=-1,o,a=[];if(e){if(e.root?o=e.root:o=this[b][0].root??Q,e.all)for(let u=this[b].length-1;u>0;u--){let f=this[b][u];f.opsType===F.Append&&f.root===o&&(a.splice(0,0,f),i=u-1)}else if(e.until)for(let u=this[b].length-1;u>0;u--){let f=this[b][u];if(f.opsType===F.Append&&f.root===o){if(e.until.charAt(0)==="/"&&e.until===f.path){i=u;break}else if(e.until===f.name){i=u;break}a.splice(0,0,f)}}else if(e.to)for(let u=this[b].length-1;u>0;u--){let f=this[b][u];if(f.opsType===F.Append&&f.root===o){if(a.splice(0,0,f),e.to.charAt(0)==="/"&&e.to===f.path){i=u-1;break}else if(e.to===f.name){i=u-1;break}}}}else{o=Q;let u=this[ws](this[D]);u&&(o=u.name);for(let f=this[b].length-1;f>0;f--){let c=this[b][f];if(c.opsType===F.Append&&c.root===o){a.push(c),i=f-1;break}}}if(i===-1||a.length===0){let u="can not find route";console.warn(u),n.resolve(u),s(!1);return}let l=null;if(i!==-1&&(l=this[b][i]),this[Le](a)){if(t===!1)return n.resolve(),s(!0),!0;const u=()=>(n.resolve(),s(!0),!0),f=this[b].length;if(l&&x.isSame(l,this[b][f-1])){this[P]?.goBack(l,u);return}u()}}catch(i){this[K](i),n.resolve(),s(!1)}})})}open(...e){let t=this[O](e);return t?(t.opsType=F.Open,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}close(e){return this[we].post(t=>{try{let s=this[O](e);if(!s){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===s.root){if(!s.path&&!s.name){n.push(o);continue}if(s.path&&s.path===o.path){n.push(o);break}else if(s.name&&s.name===o.name){n.push(o);break}}}if(n.length===0){t.resolve();return}this[Le](n),t.resolve()}catch(s){this[K](s),t.resolve()}}),this}to(...e){let t=this[O](e);if(!t)return this[K]("resolve route fail",t),this;let s=this[Oe].acquire(t);return s==null?(this[K]("route forbid",t),this):(this[we].post(n=>{try{let i=this[jt](t);this[qt](i),this[kt](i),this[Tt](i),i.wait((o,a)=>{const l=o.session.to;if(o.session.updateResult&&o.session.updateResult.status==="success")try{let u=x.clone(l,!0);const f=new ds(u,this[Ye]());l.historyUpdatePolicy==="replace"?this[P]?.replace(f):l.historyUpdatePolicy==="traceless"?this[P]?.setRouteMark(f):this[P]?.push(f)}catch(u){console.error(u.message,u)}if(Re.clear(o.session),this[Oe].release(s),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(u){console.error(u.message,u)}this[fe]===!1&&this[tt](!0),i=null,n.resolve()},(o,a)=>{this[Oe].release(s),a!==null&&this[K](a,t),this[fe]===!1&&this[tt](!1),Re.clear(o.session),i=null,n.resolve()})}catch(i){this[Oe].release(s),this[K](i,t),n.resolve()}}),this)}back(e=1){this[P]?.go(-e,!1)}[Ps](e){return(t,s)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(s??null);else if(t){const n=this[O](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()}}[jt](e){const t=this[b].length>0?this[b][this[b].length-1]:void 0,s=new Re(e,t),n={route:e,find:null};return this[Ge](n),n.find&&(s.routeModel=n.find,e.matched=Zr(n.find),Array.isArray(e.matched)&&e.matched.length>0&&(e.meta=n.find.layers[0].models[0].meta)),new Ne(s)}[qt](e){for(let t of this[qe])e.post(s=>{const n=this[Ps](s);Reflect.apply(t,{},[s.session.to,s.session.from,n,s.session])})}[Tt](e){e.post(t=>{for(let s of this[Te])try{Reflect.apply(s,{},[t.session.to,t.session.from,t.session])}catch(n){console.error(n.message,n)}t.resolve()})}[Fs](e,t){for(let s of this[ke])try{Reflect.apply(s,{},[e,t])}catch(n){console.error(n.message,n)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[kt](e){e.post(t=>{const s=t.session.to;let n=t.session.routeModel;if(n==null){let o={route:s,find:null};if(this[Ge](o))n=o.find,t.session.routeModel=n;else if(this[et])n=this[et];else{t.reject(`not find route model, path:${s.path??s.name}`);return}}const i=Re.from(t.session);this[bs](s,n,i).then(o=>{this[D],t.session.updateResult=o??{status:"success",message:""},t.resolve()},o=>{t.reject(o)})})}[Le](e){if(e.length==0)return!0;let t=this[D],s=[];for(let n of e){let i=this[Ft](t,n);i!=null&&s.push({...i,route:n})}if(s.length==0)return this[K]("can not find view index"),!1;for(let n of s.reverse())this[ae](t,{x:n.x,y:n.y},[n.route.index??0],!0);return!0}[Ft](e,t){const s=t.root??Q;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[V]&&l[rt]===s)return n={x:a,y:i},n}}return null}[ws](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[ae](e,t,s=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 c=u.length-1;c>=0;c--){let h=u[c];(!s||s.indexOf(h.index)!=-1)&&(h.route&&i[V]&&(this[je](h.route),h.active===!0&&h.route.opsType==F.Append&&(l=!0)),a.push(new H(i,h.index,t.y)),u.splice(c,1))}if(u.length==0)n?i.slots.value=u:e.layers[t.y].views.splice(t.x,1);else{if(l){let c=u.length-1,h=u[c];h.active=!0,h.route&&(h.route.active=h.active)}i.slots.value=u}e.layers[t.y].views.length==0&&(o=!0);let f=t.y+1;for(;f<e.layers.length;f++){let c=e.layers[f].views,h=[];for(let y=c.length-1;(o||a.length>0)&&y>=0;y--){let d=c[y];if(d[ce]&&(o||H.include(a,d[ce]))){let p=d.slots.value;for(let v=p.length-1;v>=0;v--){let w=p[v];w.route&&d[V]&&this[je](w.route),h.push(new H(d,w.index,f)),p.splice(v,1)}e.layers[f].views.splice(y,1)}}a=h,e.layers[f].views.length==0&&(o=!0)}}restore(e){if(!e||this[N].length==0){let t=this[D];if(t.layers.length>0){let s=t.layers[0].views;s.length>0&&(s[0].slots.value=[])}return this[b]=[],this[ue](null),Promise.resolve()}else return new Promise((s,n)=>{let i=null,o=!1;for(let a=0;a<e.length;a++){const l=e[a];this[we].post(u=>{const f=this[jt](l);this[qt](f),this[kt](f),this[Tt](f),f.wait((c,h)=>{i=c.session.to,o=c.session.redirect,u.resolve()},(c,h)=>{i=null,h!==null&&this[K](h),u.resolve()})})}this[we].post(a=>{if(i&&o===!0){const l=x.clone(i,!0),u=new ds(l,this[Ye]());this[P]?.replace(u)}a.resolve(),s()})})}[bs](e,t,s){const n=e.updateType??st.Part;return this[Ss](t).then(()=>{const o=this[Rs](t,e,s,n);if(o.status==="error")throw Error(o.message);return o})}[Ss](e){let t=[];for(let s=0;s<e.layers.length;s++){let n=e.layers[s];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()}[Rs](e,t,s,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[D],a=Yr(o),l=t.root??Q,u;!a&&n==st.Part&&(u=this[Ft](o,t));let f,c=0;if(u==null||u==null)if(a||n===st.All){if(o.layers.length==0&&(o.layers[0]=new Rt),o.layers[0].views.length==0){let h=t.root??Q;f=new $e(h,!0,null),o.layers[0].views=[f]}else f=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 v of p.views){if(v[V]&&v.name===h.rootName){d=new H(v,h.rootIndex??0,y-1);break}if(v[U]&&v[U].view.name===h.rootName&&v[U].index===h.rootIndex){d=v[U];break}}}if(!d)return{status:"error",message:"can not insert view(not find root node ref)"};f=new $e(l,!0,d),o.layers[y].views.push(f),u={x:o.layers[y].views.length-1,y}}else f=o.layers[u.y].views[u.x];if(c=u.y,f[V]=!0,t.opsType===F.Append){t.index=t.index??ie.get(),t.active=!0;let h=f.slots.value;if(h.length>0){let w=h[h.length-1];w.active=!1,w.route&&(w.route.active=w.active)}let y=new te(t,i,t.index,!0);f.slots.value=[...h,y];let d=c+1,p=1,v=new H(f,t.index,c);this[se](o,d,e,p,v)}else if(t.opsType===F.Open){let h=f.slots.value;const y=t.active??!0;let d=!1;for(let p of h){if(p.route!==null&&x.isSamePathForRoute(p.route,t)){if(p.active===y)return t.index=p.index,t.active=y,p.route=t,{status:"noChange",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??ie.get(),t.active=y;let p=new te(t,i,t.index,y);h.push(p);let v=c+1,w=1,m=new H(f,t.index,c);this[se](o,v,e,w,m)}f.slots.value=[...h]}else{let h=f.slots.value;if(h.length==0){t.index=t.index??ie.get(),t.active=!0,f.slots.value=[new te(t,i,t.index)];let y=c+1,d=1,p=new H(f,t.index,c);this[se](o,y,e,d,p)}else{let y=h[0];if(y.model!==i){this[ae](o,u,null,!0),t.index=t.index??ie.get(),t.active=!0,f.slots.value=[new te(t,i,t.index)];let d=c+1,p=1,v=new H(f,t.index,c);this[se](o,d,e,p,v)}else{y.route!==null&&this[je](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 v=[];for(let Y=1;Y<h.length;Y++)v.push(h[Y].index);v.length>0?this[ae](o,u,v,!0):d&&(f.slots.value=[...h]);let w=[new H(f,t.index,c)],m=c+1,$=1,W=new H(f,t.index,c);for(;w.length>0&&m<o.layers.length&&$<e.layers.length;m++,$++){let Y=[];for(let j=0;j<o.layers[m].views.length;j++){let q=o.layers[m].views[j];q[ce]&&H.include(w,q[ce])&&Y.unshift(j)}let me=[];for(let j of Y){let q=o.layers[m].views[j],oe=e.layers[$].models,Z;for(let k=0;k<oe.length;k++)if(q.name===oe[k].name){Z=oe[k];break}if(!Z)this[ae](o,{x:j,y:m},null,!1);else{let k=q.slots.value;if(k.length==0){let J=0;q.slots.value=[new te(null,Z,J)];let B=m+1,ee=$+1;this[se](o,B,e,ee,W)}else{let J=k[0];if(J.model!==Z){this[ae](o,{x:j,y:m},null,!0),q.slots.value=[new te(null,Z,0)];let B=m+1,ee=$+1;this[se](o,B,e,ee,W)}else{q[V]&&J.route!==null&&this[je](J.route);let B=[];for(let ee=1;ee<k.length;ee++)B.push(k[ee].index);B.length>0&&this[ae](o,{x:j,y:m},B,!0),me.push(new H(q,J.index,m))}}q[V]=!1}}w=me}this[se](o,m,e,$,W)}}}if(f&&f[U]){let h=f[U];h&&(t.slot=new Er(l,c,h?.view.name,h?.index??0))}return s.to=void 0,s.routeModel=void 0,this[xs](t,s),{status:"success",message:""}}[se](e,t,s,n,i){let o=n,a=t;for(;a<e.layers.length&&o<s.layers.length;a++,o++){let l=e.layers[a].views;for(let u of s.layers[o].models){let f=new $e(u.name,!1,i),c=new te(null,u);f.slots.value=[c],l.push(f)}}for(;o<s.layers.length;o++){let l=new Rt;l.views=[];for(let u of s.layers[o].models){let f=new $e(u.name,!1,i),c=new te(null,u);f.slots.value=[c],l.views.push(f)}e.layers.push(l)}}[Ls](e,t,s,n,i,o){if(t<0||t>this[D].layers.length)return null;if(t<this[D].layers.length){let f=this[D].layers[t],c=null;for(let h of f.views){let y=!1;if(s!==null?(y=h.name===e&&h[U]?.view===s,y&&n!==-1&&(y=h[U]?.index===n)):y=h.name===e,!!y){i!==null&&(h[ce]={view:i,index:o,level:t-1}),c=h;break}}if(c!==null)return c}let a=null,l=null;i!==null&&(i[V]?a={view:i,index:o,level:t-1}:a=i[U],l={view:i,index:o,level:t-1});let u=new $e(e,!0,a);if(u[ce]=l,t==this[D].layers.length){let f=new Rt;f.views=[u],this[D].layers.push(f)}else this[D].layers[t].views.push(u);return u}}const tn="fox-router-view",sn="fox-router-link";function Ws(r,e=!1){let t=null;return e?t=r.showFromClass??r.enterFromClass:t=r.enterFromClass,t||(t=r.transitionName,t?e?`${t}-show-from`:`${t}-enter-from`:null)}function Js(r,e=!1){let t=null;return e?t=r.showActiveClass??r.enterActiveClass:t=r.enterActiveClass,t||(t=r.transitionName,t?e?`${t}-show-active`:`${t}-enter-active`:null)}function rn(r,e=!1){let t=null;return e?t=r.showToClass??r.enterToClass:t=r.enterToClass,t||(t=r.transitionName,t?e?`${t}-show-to`:`${t}-enter-to`:null)}function Gs(r,e=!1){let t=null;return e?t=r.hideFromClass??r.leaveFromClass:t=r.leaveFromClass,t||(t=r.transitionName,t?e?`${t}-hide-from`:`${t}-leave-from`:null)}function Xs(r,e=!1){let t=null;return e?t=r.hideActiveClass??r.leaveActiveClass:t=r.leaveActiveClass,t||(t=r.transitionName,t?e?`${t}-hide-active`:`${t}-leave-active`:null)}function nn(r,e=!1){let t=null;return e?t=r.hideToClass??r.leaveToClass:t=r.leaveToClass,t||(t=r.transitionName,t?e?`${t}-hide-to`:`${t}-leave-to`:null)}function on(r,e=!1){let t=null;return e?t=r.beforeShow??r.beforeEnter:t=r.beforeEnter,t}function ln(r,e=!1){let t=null;return e?t=r.show??r.enter:t=r.enter,t}function an(r,e=!1){let t=null;return e?t=r.afterShow??r.afterEnter:t=r.afterEnter,t}function un(r,e=!1){let t=null;return e?t=r.showCancelled??r.enterCancelled:t=r.enterCancelled,t}function fn(r,e=!1){let t=null;return e?t=r.beforeHide??r.beforeLeave:t=r.beforeLeave,t}function cn(r,e=!1){let t=null;return e?t=r.hide??r.leave:t=r.leave,t}function hn(r,e=!1){let t=null;return e?t=r.afterHide??r.afterLeave:t=r.afterLeave,t}function yn(r,e=!1){let t=null;return e?t=r.hideCancelled??r.leaveCancelled:t=r.leaveCancelled,t}function Zt(r){let e,t=r.transitionDuration;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 Fe(r,e){r.classList.contains(e)||r.classList.add(e)}function Pe(r,e){r.classList.remove(e)}const dn=ye&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function ht(r){dn(r)}function _(r,e,t){S(e)&&(r==null&&(r={}),Reflect.apply(e,r,t))}function Qs(r,e,t,s=-1,n,i,o){let a=[];const l=()=>{for(let u of a)Vt(e,u.type,u.listener);a=[]};if(S(i)){if(n!==void 0&&n>=0){setTimeout(()=>{Reflect.apply(i,r,[e,t,s])},n);return}const u=["animationend","transitionend",ot],f=c=>{const h=c.target||c.srcElement,y=c.currentTarget;h===y&&(l(),Reflect.apply(i,r,[e,t,s]))};u.forEach(c=>{it(e,c,f),a.push({type:c,listener:f})})}if(S(o)){const u="animationcancel",f=c=>{const h=c.target||c.srcElement,y=c.currentTarget;h===y&&(l(),Reflect.apply(o,r,[e,t,s]))};it(e,u,f),a.push({type:u,listener:f})}}function yt(r){return!ye||r===null?!1:r.opsType===F.Append||r.opsType===F.Open}function Ys(r,e,t,s={},n,i=-1){if(e||yt(n)){const o=Ws(s,e);o&&Fe(t,o);const a=Js(s,e);a&&Fe(t,a);const l=on(s,e);_(r,l,[t,e,n,i])}}function Zs(r,e,t,s={},n,i,o,a){if(!yt(i)&&!e){S(a)&&a(r,a,[t]);return}const l=Ws(s,e),u=Js(s,e),f=rn(s,e),c=ln(s,e),h=an(s,e),y=un(s,e);if(!l&&!u&&!f&&!c){S(a)&&a(r,a,[t]);return}ht(()=>{Qs(r,t,i,o,n,()=>{u&&Pe(t,u),f&&Pe(t,f),S(h)&&_(r,h,[t,e,i,o]),S(a)&&a(r,a,[t])},()=>{S(y)&&_(r,y,[t,e,i,o])}),l&&Pe(t,l),f&&Fe(t,f),S(c)&&_(r,c,[t,e,i,o])})}function er(r,e,t,s={},n,i=-1){if(e||yt(n)){const o=Gs(s,e);o&&Fe(t,o);const a=Xs(s,e);a&&Fe(t,a);const l=fn(s,e);_(r,l,[t,e,n,i])}}function tr(r,e,t,s={},n,i,o,a,l){if(!yt(o)&&!e){S(l)&&_(r,l,[t]),!e&&S(i)&&i();return}const u=Gs(s,e),f=Xs(s,e),c=nn(s,e),h=cn(s,e),y=hn(s,e),d=yn(s,e);if(!u&&!f&&!c&&!h){S(l)&&_(r,l,[t]),!e&&S(i)&&i();return}ht(()=>{Qs(r,t,o,a,n,()=>{try{f&&Pe(t,f),c&&Pe(t,c),S(y)&&_(r,y,[t,e,o,a]),S(l)&&_(r,l,[t])}finally{!e&&S(i)&&i()}},()=>{try{S(d)&&_(r,d,[t,e,o,a]),S(l)&&_(r,l,[t])}finally{!e&&S(i)&&i()}}),u&&Pe(t,u),c&&Fe(t,c),S(h)&&_(r,h,[t,e,o,a])})}function Bt(r,e,t={},s,n=-1){const i=t.mode??"default",o=Zt(t);return{mode:i,persisted:!1,beforeEnter:l=>{Ys(r,!1,l,t,s,n)},enter:l=>{Zs(r,!1,l,t,o.enter,s,n)},leave:(l,u)=>{er(r,!1,l,t,s,n),tr(r,!1,l,t,o.leave,u,s,n,()=>{e.transition=null,e=null})},clone:l=>Bt(r,e,t,s,n)}}function sr(r){return r.el}function mn(r,e,t={},s,n,i,o){if(i===!0){const a=sr(e);if(a==null)return;const l=Zt(t);Ys(r,!0,a,t,s,n),Zs(r,!0,a,t,l.show,s,n,u=>{S(o)&&_(r,o,[u])})}else S(o)&&_(r,o,[])}function pn(r,e,t={},s,n,i,o){if(i===!0){const a=sr(e);if(a==null)return;const l=Zt(t);er(r,!0,a,t,s,n),tr(r,!0,a,t,l.hide,null,s,n,u=>{S(o)&&_(r,o,[u])})}else S(o)&&_(r,o,[])}function gn(r,e={}){ht(()=>{for(let t=0;t<r.length;t++)Reflect.apply(r[t],e,[])})}function rr(r,e,t={},s,n=-1){return{mode:t.mode??"default",persisted:!1,beforeEnter:a=>{Ue(Os,{},a)},enter:a=>{Ue(Ms,{},a)},leave:(a,l)=>{Ue(Is,{},a),ht(()=>{const u=f=>{const c=f.target||f.srcElement,h=f.currentTarget;c===h&&(Vt(a,ot,u),l&&Reflect.apply(l,r,[]),e.transition=null,e=null)};it(a,ot,u),Ue(Hs,{},a)})},clone:a=>rr(r,e,t,s,n)}}function re(r,e,t){return typeof r=="function"?Reflect.apply(r,{},[e,t]):r}function Lt(r,e){if(!r)return null;const t=r(e);return t.length===1?t[0]:t}function be(r,e){return typeof e=="function"?e(r):r}class vn{node;state;constructor(e,t){this.node=e,this.state=t}}const Ut=g.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(r,e){const t=g.getCurrentInstance();if(t===null||t.proxy===null){console.error("instance or instance.proxy not exist");return}const s=r.multi===!0,n=g.inject(ct,null),i=g.inject(wt,0),o=g.inject(cs,null),a=g.inject(bt,-1);let l=null,u=r.modelSlot;if(u){if(g.provide(wt,i+1),g.provide(bt,u.index),g.provide(St,u.index),!u.route){console.warn("child view render error, route not exist");return}const h=lt(t.proxy,!0);Tr(h),fs(h,()=>u?.route??null)}else{if(n==null){console.error("router is not been injected");return}const c=r.name,h=g.inject(hs,null),y=g.inject(St,0);if(l=n[Ls](c,i,o,a,h,y),l===null)return;g.provide(hs,l);const d=l[V]===!0;if(d&&g.provide(cs,l),!s&&(g.provide(bt,-1),g.provide(wt,i+1),g.provide(St,-1),d)){const p=lt(t.proxy,!0);fs(p,()=>{const v=l.slots.value;return v.length>0?v[0].route:null})}}const f={value:new Map};return g.onUnmounted(()=>{if(f.value&&f.value.clear(),u){const c=u;c.route=null,c.model=null,c.instance=null,u=void 0}}),()=>{if(s){const c=new Map,h=[],y=l?.slots.value,d=[];for(let w=0;w<y.length;w++){const m=y[w],$=`${r.name}_${m.index}`,W=re(r.transition,m.route,w)??!0,Y={modelSlot:m};let me;e.slots.default?me=g.h(Ut,Y,{default:e.slots.default}):me=g.h(Ut,Y);const j={},q=re(r.viewClass,m.route,w);typeof q=="string"&&q.length>0&&(j[q]=!0);const oe=re(r.viewActiveClass,m.route,w),Z=re(r.viewInactiveClass,m.route,w),k=f.value.get($);if(typeof oe=="string"&&oe.length>0&&(j[oe]=m.active),typeof Z=="string"&&Z.length>0&&(j[Z]=!m.active),k&&m.active!==k.state){const M=k.node;m.active?d.unshift(()=>{const dt=()=>{let Ce=as(M);Ce!=null&&us(Ce,Dt.ACTIVATED)};mn(t,M,r,m.route,w,W,dt)}):d.push(()=>{const dt=()=>{const Ce=as(M);Ce!=null&&us(Ce,Dt.DEACTIVATED)};pn(t,M,r,m.route,w,W,dt)})}const J={class:j,key:$},B=re(r.viewTagProps,m.route,w);if(B!==null&&typeof B=="object"){const M=be(B,n?.propsFilter);C(!0,J,M)}if(m.route?.viewTagAttrs&&typeof m.route?.viewTagAttrs=="object"){const M=be(m.route.viewTagAttrs,n?.propsFilter);C(!0,J,M)}const ee=re(r.viewTag,m.route,w),pe=g.h(ee,J,{default:()=>[me]});if(c.set($,new vn(pe,m.active)),f.value.delete($),W===!0){const M=Bt(t,pe,r,m.route,w);pe.transition=M}else if(W==="custom"){const M=rr(t,pe,r,m.route,w);pe.transition=M}h.push(pe)}f.value=c,gn(d,t);const p=re(r.tag,null,-1),v={};return Object.assign(v,e.attrs),g.h(p,v,{default:()=>h})}else if(u!=null){const c=u.model,h={};if(c.props){if(typeof c.props=="object"){const d=be(c.props,n?.propsFilter);C(!1,h,d)}else if(c.props===!0&&typeof u.route?.params=="object"){const d=be(u.route.params,n?.propsFilter);C(!1,h,d)}}const y=g.h(c.component,h);return Lt(e.slots.default,{Component:y,route:u.route})??y}else{const c=l.slots.value;if(c.length>0){const h=c[0],y=h.route??(t.proxy&&Yt(t.proxy))??null,d=h.model,p={};if(d.props){if(typeof d.props=="object"){const m=be(d.props,n?.propsFilter);C(!1,p,m)}else if(d.props===!0&&typeof y?.params=="object"){const m=be(y.params,n?.propsFilter);C(!1,p,m)}}const v=g.h(d.component,p);if(re(r.transition,y,-1)??!0){const m=Bt(t,v,r,y,-1);v.transition=m}return Lt(e.slots.default,{Component:v,route:y})??v}else return Lt(e.slots.fallback,{})}}}});function wn(r){if(!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)&&!r.defaultPrevented&&!(r.button!=null&&r.button!==0)){if(r.currentTarget&&r.currentTarget.getAttribute){const e=r.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return r.preventDefault&&r.preventDefault(),!0}}function bn(r,e){return r==null||e==null?!1:!!(r===e||r.path&&r.path===e.path||r.name&&r.name===e.name)}function Sn(r,e){return r==null||e==null?!1:!!(r.path&&e.path&&e.path.startsWith(r.path)||r.name&&r.name==e.name)}function Se(r,e){return typeof r=="function"?Reflect.apply(r,{},[e]):r}let Rn=g.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(r,e){const t=g.inject(ct,null);return()=>{let s=Se(r.to,null),n=Se(r.tag,s);if(n==null){console.warn("can not resolve link tag");return}let i=null,o=null;t!==null&&(i=t[O](s),r.root&&(i.root=r.root),o=t.currentRoute.value);let a={},l=Se(r.activeClass,i);if(typeof l=="string"&&l.length>0&&(a[l]=Sn(i,o)),Se(r.exact,i)===!0){let h=Se(r.exactActiveClass,i);typeof h=="string"&&h.length>0&&(a[h]=bn(i,o))}let f={class:a};(n==="a"||n==="A")&&(f.href=i?.path??i?.name??"#"),C(!0,f,e.attrs);let c=Se(r.event,i);if(typeof c=="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}wn(y)&&t.to(i)};f[c]=h}return g.h(n,f,e.slots)}}});var T=(r=>(r[r.Loading=0]="Loading",r[r.Loaded=1]="Loaded",r[r.Defining=2]="Defining",r[r.Defined=3]="Defined",r))(T||{}),nt=(r=>(r[r.normal=0]="normal",r[r.factory=1]="factory",r))(nt||{});class xn{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 Cs{moduleManager=new xn;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 Be().head}constructor(){}setModule(e,t){const s={id:e,src:"",status:T.Defined};typeof t=="function"?(s.exports=t,s.type=nt.factory):s.exports=t,this.moduleManager.set(e,s)}removeModule(e){this.moduleManager.remove(e)}ensure(...e){const t=[];let s=e.length-1;const n={};typeof e[s]=="object"&&(Object.assign(n,e[s]),s--);let i=null;typeof e[s]=="function"&&(i=e[s],s--);for(let l=0;l<=s;l++)if(Array.isArray(e[l])){let u=e[l];for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}else if(typeof e[l]=="string"){let u=e[l].split(",");for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}const o=new Pn(t.length,(l,u)=>{if(o.isOK())try{typeof i=="function"&&Reflect.apply(i,{},u)}catch(f){console.error(f.message,f)}else try{console.error(l),typeof i=="function"&&Reflect.apply(i,{},[])}catch(f){console.error(f.message,f)}}),a=new Ne;for(let l=0;l<t.length;l++){const u=new Fn(l,t[l],n,o);this.mount(a,u)}return this}remove(...e){let t=[],s=e.length-1,n={};typeof e[s]=="object"&&(Object.assign(n,e[s]),s--);let i=null;typeof e[s]=="function"&&(i=e[s],s--);for(let o=0;o<=s;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 s=this.getFileNamePostfix(t.src);if(s==="js"||s.length===0){let n=t.params.jsPoint;n||(n=this.head),this.mountJS(e,t,n);return}else if(s==="css"){let n=t.params.cssPoint;n||(n=this.head),this.mountCSS(e,t,n);return}}mountCSS(e,t,s){e.post(n=>{const i=t.src,o=this.moduleManager.get(i);if(o&&(o.status==T.Defined||o.status==T.Loaded)&&o.exports){o.type===nt.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=Be(),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{s.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),n.reject()};else{const c={timeout:this.options.timeout??3e3,time:0,success:()=>{t.progress.work(!0,t.index,t.src),n.resolve()},error:()=>{try{s.removeChild(l)}catch(h){console.error(h.message,h)}t.progress.work(!1,t.index,null),n.resolve()}};setTimeout(()=>{nr(l,c)},1)}let f=a.getElementById(i);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=i,l.href=i,s.appendChild(l)})}mountJS(e,t,s){e.post(n=>{const i=t.src;let o=this.moduleManager.get(i);if(o&&(o.status==T.Defined||o.status==T.Loaded)){if(o.exports){o.type===nt.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:T.Loading},this.moduleManager.set(i,o);const l=Be().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,o.status===T.Loading&&(o.status=T.Loaded,t.progress.work(!0,t.index,i)),n.resolve()},l.onerror=()=>{try{s.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,this.moduleManager.remove(i),t.progress.work(!1,t.index,null),n.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,o.status==T.Loading&&(o.status=T.Loaded,t.progress.work(!0,t.index,i)),n.resolve())}}l.defer=!0,l.src=i;const f=E();f.define=this.createDefine(o,t),s.appendChild(l)})}unmount(e,t={}){const s=Be(),n=this.getFileNamePostfix(e);if(n==="js"||n.length===0){const i=s.querySelector(`script[src="${e}"]`);i&&i.parentNode&&i.parentNode.removeChild(i),this.moduleManager.remove(e);return}else if(n==="css"){const i=s.querySelector(`style[href="${e}"]`);i&&i.parentNode&&i.parentNode.removeChild(i);return}}trimEmptyElement(e){let t=[];for(let s=0;s<e.length;s++){if(e[s]===void 0||e[s]===null)continue;const n=e[s].trim();n.length!==0&&t.push(n)}return t}createDefine(e,t){const s=this,n=function(...i){e.status=T.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=s.trimEmptyElement(i[0]),o=void 0):a=void 0):(o=i[0],a=s.trimEmptyElement(i[1]),l=i[2]),o&&(e.id=o,s.options.alias[o]=e.src),a&&a.length>0?s.ensure(a,(...f)=>{const c=f.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,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=l;e.status=T.Defined,t.progress.work(!0,t.index,e.exports)}):(typeof l=="function"?e.exports=Reflect.apply(l,e,[]):e.exports=l,e.status=T.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 s=this.createSearch(this.query);return e.indexOf("?")==-1?(t!=="js"&&t!=="css"&&(e+=".js"),s.length>0&&(e+=`?${s}`)):s.length>0&&(e+=`&${s}`),e}catch(t){throw console.error(`resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e){for(let s in e){let n=`${e[s]}`;t+=`${encodeURIComponent(s)}=${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 s=e.lastIndexOf(".",t);return s==-1?"":e.substring(s+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 s=0;s<t.length;s++){const n=t[s];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`${mt()}${e.slice(1)}`;if(e.indexOf("./")==0)return`${mt()}${e.slice(2)}`;if(e.indexOf("//")==0)return`${E().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`${mt()}${e}`}}function nr(r,e){let t=r.sheet,s=!1;if(e.isOldWebKit)t&&(s=!0);else if(t)try{t.cssRules&&(s=!0)}catch(n){n.name==="NS_ERROR_DOM_SECURITY_ERR"&&(s=!0)}setTimeout(()=>{e.time+=20,s?e.success():e.timeout>e.timeout?e.error():nr(r,e)},20)}class Pn{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,s){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values[t]=s),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 Fn{index;src;params;progress;constructor(e,t,s,n){this.index=e,this.src=t,this.params=s,this.progress=n}}const es=Symbol("fk"),ts=Symbol("fbk"),ss=Symbol("fepk");function Cn(r={}){const e=new en(r),t=new Ht,s=new Nt,n=new Cs,i={get router(){return e},get bus(){return t},get Bus(){return Ht},get EventProxy(){return Nt},get eventproxy(){return s},get EventChain(){return Ne},get Require(){return Cs},get require(){return n},get extend(){return C},get clone(){return ft},get isESModule(){return zt},install(o){o.provide(ct,e),o.provide(es,i),o.provide(ts,t),o.provide(ss,s),o.component(tn,Ut),o.component(sn,Rn),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 s}}),o.config.globalProperties.$fox_on=function(a,l,u=!1){s.on(a,l,u)},o.config.globalProperties.$fox_off=function(a,l){s.off(a,l)},o.config.globalProperties.$fox_once=function(a,l){s.once(a,l)},o.config.globalProperties.$fox_all=function(...a){let l=s;Reflect.apply(l.all,l,a)},o.config.globalProperties.$fox_trigger=function(a,...l){let u=s;Reflect.apply(u.trigger,u,[a,...l])},o.config.globalProperties.$fox_emit=function(a,...l){let u=s;Reflect.apply(u.trigger,u,[a,...l])},o.mixin({computed:{$route(){return Yt(this)}}}),e.init()}};return i}function rs(r){return r?r.$router:g.inject(ct)}function An(r){return r||(r=g.getCurrentInstance()?.proxy??void 0),r?Yt(r):null}function En(r){return r?r.$fox:g.inject(es)}function $n(r){return r?r.$bus:g.inject(ts)}function _n(r){return r?r.$eventProxy:g.inject(ss)}function Kn(r){const e=rs(),t=(s,n,i)=>{try{Reflect.apply(r,{},[s,n])}catch(o){console.error(o)}i()};e.beforeEach(t),g.onUnmounted(()=>{e.removeBeforeEach(t)})}function jn(r){const e=rs(),t=(s,n,i)=>{try{Reflect.apply(r,{},[s,n])}catch(o){console.error(o)}i()};e.afterEach(t),g.onUnmounted(()=>{e.removeAfterEach(t)})}exports.Bus=Ht;exports.EventChain=Ne;exports.EventProxy=Nt;exports.FoxBeforeEnter=Os;exports.FoxBeforeLeave=Is;exports.FoxEnter=Ms;exports.FoxLeave=Hs;exports.FoxLeaveEnd=ot;exports.OperationType=F;exports.Route=x;exports.clone=ft;exports.createFox=Cn;exports.createMemoryHistory=zs;exports.createWebHashHistory=Vs;exports.createWebHistory=Xr;exports.deleteContextValue=qr;exports.extend=C;exports.foxBusKey=ts;exports.foxEventProxyKey=ss;exports.foxKey=es;exports.injectContextValue=Qt;exports.isArray=Ot;exports.isDate=ar;exports.isESModule=zt;exports.isEqual=It;exports.isFunction=S;exports.isMap=or;exports.isNil=De;exports.isObject=As;exports.isPlainObject=Es;exports.isPromise=cr;exports.isSet=lr;exports.isString=ur;exports.isSymbol=fr;exports.onAfterRouteUpdate=jn;exports.onBeforeRouteUpdate=Kn;exports.onFoxActivated=Mr;exports.onFoxInactivated=Ir;exports.provideContextValue=jr;exports.rawState=Cr;exports.reactiveState=xr;exports.sessionKey=ne;exports.shallowReactiveState=Pr;exports.toBoolean=Wt;exports.toNumber=mr;exports.toTypeString=ut;exports.typeOf=Mt;exports.useBus=$n;exports.useEventProxy=_n;exports.useFox=En;exports.useRoute=An;exports.useRouter=rs;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("vue"),ye=typeof window<"u",E=function(){return window},Be=function(){return window.document};function ir(r){let e=r,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 mt(){if(!ye)return"/";let r=E().location,e=`${r.protocol}//${r.host}`;return e+=ir(r.pathname),e}function it(r,e,t,s=!1){r.addEventListener?r.addEventListener(e,t,s):r.attachEvent?r.attachEvent(`on${e}`,t):r[`on${e}`]=t}function Vt(r,e,t){r.removeEventListener?r.removeEventListener(e,t):r.detachEvent?r.detachEvent(`on${e}`,t):r[`on${e}`]=null}const Ue=(r,e,t)=>{e=e??{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("Events");let n=!0,i=!0;for(let a in e)a==="bubbles"?n=!!e[a]:a==="cancelable"?i=!!e[a]:s[a]=e[a];s.initEvent(r,n,i),(t??document).dispatchEvent(s)},Ot=Array.isArray,or=r=>ut(r)==="[object Map]",lr=r=>ut(r)==="[object Set]",ar=r=>r instanceof Date,R=r=>typeof r=="function",ur=r=>typeof r=="string",fr=r=>typeof r=="symbol",As=r=>r!==null&&typeof r=="object",cr=r=>As(r)&&R(r.then)&&R(r.catch),De=r=>r==null,hr=Object.prototype.toString,ut=r=>hr.call(r),Es=r=>ut(r)==="[object Object]",yr=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function zt(r){return r.__esModule||yr&&r[Symbol.toStringTag]==="Module"}const dr=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function C(...r){let e=r[0]!==void 0&&r[0]!==null?r[0]:{},t=1,s=r.length,n=!1;for(typeof e=="boolean"&&(n=e,e=r[t]??{},t++),typeof e!="object"&&(e={});t<s;t++)if(r[t]!==null&&r[t]!==void 0){let i=r[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]=C(n,u,l)}else l!==void 0&&(e[o]=l)}}return e}function ft(r,e,t=!1){if(!t)C(!0,r,e);else{if(typeof e!="object")return{};typeof r!="object"&&(r={});for(let s of Reflect.ownKeys(e)){let n=r[s],i=e[s];if(n!==i)if(typeof i=="object"){if(!Array.isArray(i)&&!Es(i))continue;n=ft(n,i,t),r[s]=n}else{if(typeof i=="function")continue;r[s]=i}}}return r}class ie{static seed=new Date().getTime();static get(){let e=++ie.seed;return e>=Number.MAX_VALUE&&(ie.seed=0),e}}const pt=dr?Promise.resolve():null;function Me(r,...e){pt!==null?e&&e.length>0?pt.then(()=>{r(e)}):pt.then(r):e&&e.length>0?setTimeout(()=>{r(e)}):setTimeout(r)}function Wt(r){return r==null?!1:typeof r=="boolean"?r:typeof r=="string"?r.toLocaleLowerCase()==="true":!!r}function mr(r){return typeof r=="number"?r:Number(r)}const pr={"[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(r){let t=Object.prototype.toString.call(r);return r==null?String(r):pr[t]||"object"}function It(r,e){if(r==e)return!0;if(r===void 0||e===void 0)return!1;let t=Mt(r),s=Mt(e);if(t!==s)return!1;if(t==="object"){let n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++){let a=n[o],l=r[a],u=e[a];if(!It(l,u))return!1}return!0}else if(t==="array"){if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++){let i=r[n],o=e[n];if(!It(i,o))return!1}return!0}return!1}const $s=r=>{const e={};for(let t of Reflect.ownKeys(r)){let s=r[t];s&&!Array.isArray(s)&&typeof s=="object"&&(s=$s(s)),typeof t=="symbol"?e[String(t)]=s:e[t]=s}return e},gr=/^Symbol\((.*)\)$/,_s=r=>{const e={};for(let t of Reflect.ownKeys(r)){let s=r[t];s&&!Array.isArray(s)&&typeof s=="object"&&(s=_s(s));const n=gr.exec(t);if(n&&n[1]){const i=Symbol.for(n[1]);e[i]=s}else e[t]=s}return e};function Ks(r,e){let t=null;return function(...s){t&&clearTimeout(t),t=setTimeout(()=>{t=null,Reflect.apply(r,null,[...s])},e)}}const ns=Symbol("idKey"),de=Symbol("valueKey"),x=Symbol("childrenKey"),z=Symbol("growKey");class js{[z]=!0;[ns];[de]=g.ref();[x]=new Map;constructor(e){this[ns]=e}}class vr{get(e,t){if(t=="value")return e[de].value;if(t==="grow")return e[z];let s=e[x].get(t);if(s)return He(s);if(e[z])return s=Gt(t),s[z]=e[z],e[x].set(t,s),He(s)}set(e,t,s){return t=="value"?(e[de].value=s,!0):t==="grow"?(e[z]=Wt(s),!0):s==null?(e[x].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}}const Jt="__proxy__";function Gt(r){const e=new js(r);return Reflect.set(e,Jt,new Proxy(e,new vr)),e}function He(r){return Reflect.get(r,Jt)}let wr=class{name="";persistPolicy="memory";storage;initFlag=!1;state={};constructor(e={},t){if(e.persistPolicy&&e.persistPolicy!=="memory"&&De(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(ye){const t=E();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}`,s=JSON.stringify(this.state??{});e.setItem(t,s)}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 s=`_bus_${this.name}`,n=t.getItem(s);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,s=e.slice(0,t-1).join("/"),n=e[t-1];this.state[s]=n,this.saveState()}catch(t){console.error(t)}}remove(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,s=e.slice(0,t-1).join("/"),n={};Reflect.ownKeys(this.state).forEach(o=>{typeof o=="string"&&(o===s||o.startsWith(s)||(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 qs extends js{_persistHandler;constructor(e={},t){super("__root__"),this._persistHandler=new wr(e,t),this._persistHandler.init(this)}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let s=this;for(let n=0;n<t-1;n++){let i=e[n],o;s[x].has(i)?o=s[x].get(i):(o=Gt(i),s[x].set(i,o)),s=o}return s[de].value=e[t-1],this._persistHandler.put(e),!0}get(...e){let t=e.length;if(t===0)return;let s=this;for(let n=0;n<t;n++){let i=e[n];if(s[x].has(i))s=s[x].get(i);else return}return s[de].value}remove(...e){let t=e.length;if(t==0)return!1;let s=this;for(let i=0;i<t-1;i++){const o=e[i];if(s[x].has(o))s=s[x].get(o);else return!1}const n=e[t-1];return s[x].has(n)?(s[x].delete(n),this._persistHandler.remove(e),!0):!1}contains(...e){const t=e.length;if(t==0)return!1;let s=this;for(let i=0;i<t-1;i++){let o=e[i];if(s[x].has(o))s=s[x].get(o);else return!1}const n=e[t-1];return s[x].has(n)}clear(){this[x].clear(),this._persistHandler.clear()}}const br=["put","get","contains","remove","clear","_persistHandler"];function is(r){return br.includes(r)}class Rr{get(e,t){if(t=="value")return e[de].value;if(t==="grow")return e[z];if(t===x)return e[x];if(typeof t=="string"&&is(t))return e[t];const s=String(t);let n=e[x].get(s);if(n)return He(n);if(e[z])return n=Gt(s),n[z]=e[z],e[x].set(s,n),He(n)}set(e,t,s){return t=="value"?(e[de].value=s,!0):t==="grow"?(e[z]=Wt(s),!0):is(t)?!1:s==null?(e[x].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}}function Sr(r,e){const t=new qs(r,e),s=new Rr,n=new Proxy(t,s);return Reflect.set(t,Jt,n),t}const Ht=new Proxy(qs,{construct(r,e){const t=e[0]??{},s=e[1],n=Sr(t,s);return He(n)}}),Xt=r=>!r||typeof r!="object"?!0:Reflect.ownKeys(r).length===0;class Ts{name="";persistPolicy="memory";storage;constructor(e={}){if(e.persistPolicy&&e.persistPolicy!=="memory"&&De(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(ye){const t=E();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||Xt(e))return;const s=`_state_${this.name}`,n=JSON.stringify(e??{});t.setItem(s,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 s=`_state_${this.name}`,n=t.getItem(s);if(n){const i=JSON.parse(n);Object.assign(e,i)}}}function ks(r,e,t){const s=new Ts(t);s.restore(e);const n=l=>{const u=g.toRaw(l),f={};for(let c in u){const h=u[c];De(h)||(f[c]=h)}Xt(f)?s.removeState():s.saveState(f)};let i=null;if(t&&t.debounce===!1)i=n;else{const l=t&&t.debounceDelay?t.debounceDelay:250;i=Ks(n,l)}const o=r?g.shallowReactive(e):g.reactive(e);return g.effectScope(!0).run(()=>{g.watch(o,l=>{const u=g.toRaw(l);i(u)})}),o}function xr(r,e){return ks(!1,r,e)}function Pr(r,e){return ks(!0,r,e)}function Fr(r,e){const t=new Ts(e);t.restore(r);const s=a=>{const l=g.toRaw(a),u={};for(let f in l){const c=l[f];De(c)||(u[f]=c)}Xt(u)?t.removeState():t.saveState(u)};let n=null;if(e&&e.debounce===!1)n=s;else{const a=e&&e.debounceDelay?e.debounceDelay:250;n=Ks(s,a)}const i={get(a,l){return a[l]},set(a,l,u){return a[l]=u,n(a),!0}};return new Proxy(r,i)}function Cr(r,e){return Fr(r,e)}const Q="default",Ls=Symbol("sync"),O=Symbol("normalizeRoute");function os(r){let e=!1;return function(...t){if(!e)return e=!0,Reflect.apply(r,{},t)}}function Ar(r){let e=r.src;return new Promise((t,s)=>{const n=os(a=>{zt(a)&&(a=a.default),r.component=a,console.debug("success load async module"),t()}),i=os(a=>{console.debug("reject load async module"),s(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 Er{name;level;rootName;rootIndex=0;constructor(e,t,s,n){this.name=e,this.level=t,this.rootName=s,this.rootIndex=n}}class Se{to;routeModel;from;data={};constructor(e,t){this.to=e,this.from=t}static from(e){const t=new Se(e.to,e.from),s=e.data??{};return C(!0,t.data,s),t}static clear(e){for(let t in e)e[t]=void 0}}class S{path;get fullPath(){const e=this.path??`/${this.name}`;return`${this.root??Q}!${e}`}alias;name;root;params;query;traceless;template;matched;meta;success;error;destroy;opsType;updateType;historyUpdatePolicy;viewTagAttrs;index;active;slot;static clone(e,t){let s=new S;return ft(s,e,t),s}static isSame(e,t){return!e||!t?!1:e===t?!0:e.root!==t.root||e.index!==t.index?!1:e.path&&t.path&&e.path===t.path?!0:!!(e.name&&t.name&&e.name===t.name)}static isSamePathForRoute(e,t){return!e||!t?!1:e===t||e.path&&t.path&&e.path===t.path?!0:!!(e.name&&t.name&&e.name===t.name)}static from(e){let t=new S;if(e==null)return t;let s=t;for(let i in e){let o=e[i];s[i]=o}const n=Object.getOwnPropertySymbols(e);if(Array.isArray(n)&&n.length>0)for(let i of n)s[i]=e[i];return t}}class $r{id;name;props;src;component;constructor(e,t,s){this.id=ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=s}get isResolved(){return this.component!==void 0}resolve(){return Ar(this)}}class ls{models=[]}class gt{path;match;redirect;name;meta;matchedRoutes;layers=[]}var F=(r=>(r[r.Push=0]="Push",r[r.Replace=1]="Replace",r[r.Put=2]="Put",r[r.Append=3]="Append",r[r.Open=4]="Open",r))(F||{});const Os="FoxBeforeEnter",Ms="FoxEnter",Is="FoxLeave",Hs="FoxLeave",ot="FoxLeaveEnd",I=Symbol("chainKey"),L=Symbol("cursorKey"),vt=Symbol("$persistentModeKey"),A=Symbol("statusKey"),G=Symbol("argsKey"),Ve=Symbol("exArgsKey"),ge=Symbol("successFnsKey"),Ae=Symbol("errorFnsKey"),ne=Symbol("sessionKey"),X=Symbol("_go");class Ne{[I]=[];[L]=0;[vt]=!1;[A]="Free";[G]=[];[Ve]=[];[ge]=[];[Ae]=[];[ne];get session(){return this[ne]}constructor(e,t=!1){this[ne]=e,this[vt]=t}[X](e,...t){let s=this[A];if(this[A]="Busy",this[L]+=e,this[L]<0&&(this[L]=0),this[G]=t,s==="Exception"||s==="Reject"){let a=[{session:this[ne]},...this[Ve]];for(;this[Ae].length>0;)try{let l=this[Ae].shift();typeof l=="function"&&Me(()=>{Reflect.apply(l,{},a)})}catch(l){console.error(l.message,l)}return this[A]=s,this[I]=[],this[L]=0,this}else if(s==="Finished"||this[L]>=this[I].length){let a=[{session:this[ne]},...this[G]];for(;this[ge].length>0;){let l=this[ge].shift();typeof l=="function"&&Me(()=>{Reflect.apply(l,{},a)})}return this[A]="Free",this}if(this[L]>=this[I].length)return this[A]="Free",this;let n=this[I][this[L]];this[vt]||(this[I].splice(0,this[L]+1),this[L]=-1);let i=this[L]+1;try{let o=!1,a={go:(l,...u)=>{o||(o=!0,Reflect.apply(this[X],this,[l,...u]))},resolve:(...l)=>{o||(o=!0,Reflect.apply(this[X],this,[1,...l]))},reject:(...l)=>{o||(o=!0,Reflect.apply(this.reject,this,[...l]))},insert:l=>{o||(this[I].splice(i,0,l),i++)},session:this[ne]};Me(()=>{Reflect.apply(n,{},[a,...this[G]])})}catch(o){this.throw(o)}return this}go(e,...t){return Reflect.apply(this[X],this,[e,...t])}finish(...e){return this[A]="Finished",this[G]=e,Reflect.apply(this[X],this,[0])}reject(...e){return this[A]="Reject",this[Ve]=e,Reflect.apply(this[X],this,[0])}throw(...e){return this[A]="Exception",this[Ve]=e,Reflect.apply(this[X],this,[0])}reset(...e){this[A]="Busy",this[G]=e,this[I]=[],this[L]=0;let s=[{session:this[ne]},...this[G]];for(;this[ge].length>0;){let n=this[ge].shift();Me(()=>{Reflect.apply(n,this,s)})}return this[A]="Free",this}post(e){return this[A]==="Reject"||this[A]==="Exception"?this:(Array.isArray(e)?this[I]=[...this[I],...e]:this[I].push(e),this[A]==="Busy"?this:(Reflect.apply(this[X],this,[0,...this[G]]),this))}wait(e,t){return e&&typeof e=="function"&&this[ge].push(e),t&&typeof t=="function"&&this[Ae].push(t),this[A]==="Busy"?this:(Reflect.apply(this[X],this,[0,...this[G]]),this)}exception(e){return e&&typeof e=="function"&&this[Ae].push(e),this[A]==="Busy"?this:Reflect.apply(this[X],this,[0,...this[G]])}isFinish(){return this[A]=="Reject"||this[A]=="Free"&&this[L]>=this[I].length}}const ve=Symbol("registerKey");class _r{policy;callback;constructor(e,t){this.callback=e,this.policy=t}}class Nt{[ve]=new Map;constructor(){}on(e,t,s=!1){let n=this[ve].get(e);n||(n=new Array,this[ve].set(e,n));let i=s===!0?1:0,o=new _r(t,i);return n.push(o),this}off(e,t){if(!t)return this[ve].delete(e),this;let s=this[ve].get(e);if(s){for(let n=0;n<s.length;n++)if(s[n].callback===t){s.splice(n,1);break}}return this}bind(e,t,s=!1){return this.on(e,t,s)}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 s=e[t-1];if(typeof s!="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(s,{},i)});return this}emit(e,...t){let s=this[ve].get(e);if(!s)return this;for(let n=0;n<s.length;){let i=s[n];if(i.policy==1?s.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 Ee=Symbol("registerKey");class Kr{[Ee]=new Map;constructor(){}set(e,t){this[Ee].set(e,t)}get(e){return this[Ee].get(e)}has(e){return this[Ee].has(e)}delete(e){return this[Ee].delete(e)}}const he=Symbol("lc");function lt(r,e=!1){let t=r;if(Reflect.has(t,he))return t[he];if(e){const s=new Kr;return t[he]=s,s}return null}function Ns(r,e=!1){let t=null,s=r;for(;s&&!(Reflect.has(s,he)&&(t=s[he],t));)s=s.$parent;if(!t&&e){const n=r;n&&n.$parent&&(t=lt(n.$parent,e))}return t}function Qt(r,e){let t=r;for(;t;){if(Reflect.has(t,he)){const s=t[he];if(s.has(e))return s.get(e)}t=t.$parent}return null}function jr(r,e,t){Ns(r,!0)?.set(e,t)}function qr(r,e){Ns(r,!0)?.delete(e)}function as(r){if(Array.isArray(r.children)&&r.children.length>0){let e=r.children[0];if(e!=null&&e.component!=null&&e.component.proxy!=null)return lt(e.component.proxy,!1)}return null}const at=Symbol("hooksKey");function Tr(r){let e=r.get(at);e||(e=[],r.set(at,e))}function us(r,e){let t=r.get(at);if(t!=null)for(let s=t.length-1;s>=0;s--){let n=t[s];if(n.type===e)try{Reflect.apply(n.hook,n.target,[])}catch(i){console.error(i.message,i)}}}var Dt=(r=>(r.DEACTIVATED="da",r.ACTIVATED="a",r))(Dt||{});class kr{type;hook;target;constructor(e,t,s){this.target=s,this.hook=t,this.type=e}}function Lr(r,e,t,s){let n=new kr(e,t,s);return r.push(n),!0}function Or(r,e,t,s){let n=-1;for(let i=0;i<r.length;i++){let o=r[i];if(o.type===e&&o.hook===t&&o.target===s){n=i;break}}return n!=-1?(r.splice(n,1),!0):!1}function Ds(r){return(e,t)=>{let s;if(t)s=t;else{const i=g.getCurrentInstance();if(i==null||i.proxy==null){console.error("can not get current instance or proxy");return}s=i.proxy}const n=Qt(s,at);if(n==null){console.warn("hooks context not found");return}g.onUnmounted(()=>{Or(n,r,e,s)}),Lr(n,r,e,s)}}const Mr=Ds("a"),Ir=Ds("da"),Bs=Symbol("routeKey");function fs(r,e){r.set(Bs,e)}function Yt(r){let e=Qt(r,Bs);return typeof e=="function"?e():e??null}const ct=Symbol("rk"),wt=Symbol("vd"),cs=Symbol("rv"),bt=Symbol("rvi"),hs=Symbol("pv"),Rt=Symbol("pvi");var Ie=(r=>(r[r.Static=0]="Static",r[r.Param=1]="Param",r[r.Group=2]="Group",r))(Ie||{});const Hr={type:0,value:""},Nr=/[a-zA-Z0-9_]/;function Dr(r){if(!r)return[[]];if(r==="/")return[[Hr]];if(!r.startsWith("/"))throw new Error(`Invalid path "${r}"`);function e(y){throw new Error(`ERR (${t})/"${u}": ${y}`)}let t=0,s=t;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,u="",f="";function c(){u&&(t===0?i.push({type:0,value:u}):t===1||t===2||t===3?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),i.push({type:1,value:u,regexp:f,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),u="")}function h(){u+=l}for(;a<r.length;){if(l=r[a++],l==="\\"&&t!==2){s=t,t=4;continue}switch(t){case 0:l==="/"?(u&&c(),o()):l===":"?(c(),t=1):h();break;case 4:h(),t=s;break;case 1:l==="("?t=2:Nr.test(l)?h():(c(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case 2:l===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+l:t=3:f+=l;break;case 3:c(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--,f="";break;default:e("Unknown state");break}}return t===2&&e(`Unfinished custom RegExp for param "${u}"`),c(),o(),n}const ys="[^/]+?",Br={sensitive:!1,strict:!1,start:!0,end:!0},Ur=/[.+*?^${}()[\]/\\]/g;function Vr(r,e){const t=C(!0,{},Br,e),s=[];let n=t.start?"^":"";const i=[];for(const u of r){const f=u.length?[]:[90];t.strict&&!u.length&&(n+="/");for(let c=0;c<u.length;c++){const h=u[c];let y=40+(t.sensitive?.25:0);if(h.type===Ie.Static)c||(n+="/"),n+=h.value.replace(Ur,"\\$&"),y+=40;else if(h.type===Ie.Param){const{value:d,repeatable:p,optional:v,regexp:w}=h;i.push({name:d,repeatable:p,optional:v});const m=w||ys;if(m!==ys){y+=10;try{new RegExp(`(${m})`)}catch(W){throw new Error(`Invalid custom RegExp for param "${d}" (${m}): `+W.message)}}let $=p?`((?:${m})(?:/(?:${m}))*)`:`(${m})`;c||($=v&&u.length<2?`(?:/${$})`:"/"+$),v&&($+="?"),n+=$,y+=20,v&&(y+=-8),p&&(y+=-20),m===".*"&&(y+=-50)}f.push(y)}s.push(f)}if(t.strict&&t.end){const u=s.length-1;s[u][s[u].length-1]+=.7000000000000001}t.strict||(n+="/?"),t.end?n+="$":t.strict&&!n.endsWith("/")&&(n+="(?:/|$)");const o=new RegExp(n,t.sensitive?"":"i");function a(u){const f=u.match(o),c={};if(!f)return null;for(let h=1;h<f.length;h++){const y=f[h]||"",d=i[h-1];c[d.name]=y&&d.repeatable?y.split("/"):y}return c}function l(u){let f="",c=!1;for(const h of r){(!c||!f.endsWith("/"))&&(f+="/"),c=!1;for(const y of h)if(y.type===Ie.Static)f+=y.value;else if(y.type===Ie.Param){const{value:d,repeatable:p,optional:v}=y,w=d in u?u[d]:"";if(Ot(w)&&!p)throw new Error(`Provided param "${d}" is an array but it is not repeatable (* or + modifiers)`);const m=Ot(w)?w.join("/"):w;if(!m)if(v)h.length<2&&(f.endsWith("/")?f=f.slice(0,-1):c=!0);else throw new Error(`Missing required param "${d}"`);f+=m}}return f||"/"}return{re:o,score:s,keys:i,parse:a,stringify:l}}function zr(r,e){const t=Vr(Dr(r),e);return function(s){const n=t.parse(s);return n?{path:s,params:n}:null}}var st=(r=>(r[r.Part=0]="Part",r[r.All=1]="All",r))(st||{});const V=Symbol("rootKey"),U=Symbol("rootNodeKey"),ce=Symbol("parentNodeKey"),rt=Symbol("nameKey");class te{instance=null;model;route;active=!0;index=0;constructor(e,t,s=0,n=!0){this.route=e,this.model=t,this.index=s,this.active=n}}class $e{_slots;get slots(){return this._slots==null&&(this._slots=g.shallowRef([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[rt];[V];[U]=null;[ce]=null;get name(){return this[rt]}constructor(e,t,s){this[rt]=e,this[V]=t,s&&(this[U]=s)}}class H{view;index;level;constructor(e,t,s){this.view=e,this.index=t,this.level=s}static include(e,t){for(let s=0;s<e.length;s++){let n=e[s];if(n.view===t.view&&(t.index==-1||n.index===t.index)&&n.level===t.level)return!0}return!1}}class St{views=[]}class Wr{layers=[]}class Jr{time;route}class Gr{forbidTime=300;submitRecorder=new Jr;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 xe=Symbol("_notifyChange");class ds{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}}const le=Symbol("historyChangeConsumerKey"),ms=Symbol("_navigateFirstRoute"),ze=Symbol("_getRouteMark"),xt=Symbol("_getUrlSearch"),Pt=Symbol("_generateLocation"),We=Symbol("_setRouteMarkRecorder"),_e=Symbol("beforeRestoreFiltersKey"),ps=Symbol("_beforeRestore"),gs="Symbol(_fox_restore_point)";function Ke(r,...e){return typeof r=="function"?Reflect.apply(r,null,[...e]):r}function vs(r){if(!Array.isArray(r))return!1;if(r.length===0)return!0;const e=r[0];return!!(Reflect.has(e,"path")&&Reflect.has(e,"root"))}class Us{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[le]=!1;[_e]=new Array;backTimeout=320;constructor(e="hash",t="",s="",n=!0,i=!0,o=!1,a,l){this.mode=e,this.base=t,this.query=s,this.firstNavigate=n,this.historyMonitor=i,this.traceless=o,this.storage=a??E().sessionStorage,this.backTimeout=l??320}init(e=!0){const t=E();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(typeof this[le]=="function"){const s=this[le]();if(this[le]=!1,s)return}else if(this[le]===!0){this[le]=!1;return}if(Ke(this.historyMonitor)){const s=t.history.state;this[xe](s);try{let n=[];if(typeof s=="string"?n=JSON.parse(s):n=s,Array.isArray(n)&&n.length>0){const i=this[ze]()??"/";this[We](i,n)}}catch{}}}),it(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[ms](),Promise.resolve()}destroy(){if(this.historyChange){const e=E();Vt(e,"popstate",this.historyChange)}}[ps](e,t,s,n){for(let i of this[_e])try{const o=Reflect.apply(i,{},[e,t,s,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}[ms](){const e=this[ze]()??"/",t=this.storage.getItem(gs);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?_s(l.params):{},this[ps](l,u,e,o.routes)));if(a.length>0){const l=this[xt](),u=a.length-1;a[u].query=l||a[u].query,this[xe](a);return}}}catch{}const s=e.indexOf("!");let n;s!=-1?n=e.substring(s+1):n=e;const i=new S;i.path=n,i.query=this[xt](),this[xe]([i])}[We](e,t){try{t.forEach(i=>{i.params=i.params?$s(i.params):{}});const n=JSON.stringify({mark:e,routes:t});this.storage.setItem(gs,n)}catch(s){console.error(s.message,s)}}setRestorePoint(e){const t=this[ze]()??"/";this[We](t,e)}[xe](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[ze](){const e=E();if(this.mode==="path"){let t=e.location.pathname;return this.base&&t.indexOf(this.base)===0&&(t=t.substring(this.base.length)),t}else{const t=e.location.hash,s=t.indexOf("#");if(s!=-1)return t.substring(s+1)}return null}[xt](){let t=E().location.search;return t.length>0&&t.indexOf("?")===0&&(t=t.substring(1)),t}listen(e){this.changeHandler=e}go(e,t=!1){const s=E();this[le]=t,s.history.go(e)}goBack(e,t){const s=E(),n=s.history.state;if(vs(n)&&n.length>0){let i=!1;for(let f=n.length-1;f>=0;f--){const c=S.from(n[f]);if(!(c.historyUpdatePolicy==="traceless"||Ke(this.traceless,c))&&S.isSame(c,e)){i=!0;break}}if(!i){t();return}const o=this.backTimeout;let a=null;const l=()=>{s.history.go(-1),a=setTimeout(l,o)},u=()=>{clearTimeout(a);const c=E().history.state;if(vs(c)&&c.length>0){let h=c.length;const y=c[h-1],d=S.from(y);if(S.isSame(d,e))return t(),!0;if(h>0){let p=!1;for(let v=h-1;v>=0;v--){const w=S.from(c[v]);if(!(w.traceless===!0||Ke(this.traceless,w))&&S.isSame(w,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[Pt](e.currentRoute);e.currentRoute.historyUpdatePolicy!=="traceless"&&!Ke(this.traceless,e.currentRoute)&&E().history.pushState(e.routes,"",t),this.setRouteMark(e)}replace(e){const t=this[Pt](e.currentRoute);(e.currentRoute.historyUpdatePolicy!=="traceless"||!Ke(this.traceless,e.currentRoute))&&E().history.replaceState(e.routes,"",t),this.setRouteMark(e)}[Pt](e){const t=E();let s="";if(e.query){let a="";if(typeof e.query=="object")for(let l of Reflect.ownKeys(e.query)){let u=encodeURIComponent(e.query[l]),f=`${encodeURIComponent(String(l))}=${u}`;a.length>0&&(a+="&"),a+=f}else a=e.query;this.query?(s=a.length>0?`${this.query}&${a}`:this.query,s.length>0&&s.charAt(0)!=="?"&&(s=`?${s}`)):a.length>0&&(s=`?${a}`)}const n=t.location;let i=e.alias??e.fullPath;i.startsWith(Q)&&(i=i.substring(Q.length+1));let o;return s?this.mode=="path"?i.indexOf("/")===0?o=`${this.base}${i}${s}`:o=`${this.base}/${i}${s}`:o=`${n.pathname}${s}#${i}`:this.mode=="path"?i.indexOf("/")===0?o=`${this.base}${i}`:o=`${this.base}/${i}`:o=`${n.pathname}#${i}`,`${n.origin}${o}`}}function Xr(r=!0,e=null,t="",s=!0,n=!1,i){return e!==null&&(e=E().location.pathname),e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),new Us("path",e??"",t,r,s,n,i)}function Vs(r=!0,e="",t=!0,s=!1,n){return new Us("hash","",e,r,t,s,n)}class Qr{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}[xe](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!1){if(this.queue.length==0||this.cursor<=0)return;let s=this.cursor+e;if(s<0?s=0:s>this.queue.length-1&&(s=this.queue.length-1),s!=this.cursor){this.cursor=s;let n=!1;if(typeof t=="function"?n=t():n=t,!n){const i=this.queue[s];this[xe](i.routes)}}}goBack(e,t){if(this.queue.length==0||this.cursor<=0)return;let s=0;if(e===null)s=this.cursor+1;else for(let n=this.cursor;n>=0;n--){const i=this.queue[n];if(S.isSame(i.currentRoute,e))break;s++}if(s===0){t();return}this.go(-s,()=>(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 zs(r="",e=50){return new Qr(r,e)}const Je=Symbol("_constructRouteModel"),Ge=Symbol("_findRouteModel"),Ft=Symbol("_findRootView"),ws=Symbol("_getFirstView"),ae=Symbol("_removeView"),bs=Symbol("_buildPage"),Rs=Symbol("_resolveComponent"),Ss=Symbol("_update"),se=Symbol("_merge"),Ct=Symbol("_handleHistoryChange"),ue=Symbol("_handleRouteUpdated"),Xe=Symbol("routeUpdatedCallback"),At=Symbol("currentRoute"),b=Symbol("currentRoutes"),Qe=Symbol("routeSessionCacheKey"),xs=Symbol("_addRouteRecorder"),je=Symbol("_removeRouteRecorder"),Ye=Symbol("_cloneRouteRecorder"),K=Symbol("_handleError"),Ze=Symbol("errorCallback"),N=Symbol("registerKey"),et=Symbol("notFoundKey"),Et=Symbol("notFoundPathKey"),D=Symbol("forestKey"),P=Symbol("historyKey"),qe=Symbol("beforeFiltersKey"),Te=Symbol("afterFiltersKey"),ke=Symbol("destroyFiltersKey"),$t=Symbol("propsFilterKey"),we=Symbol("mainDispatcherKey"),_t=Symbol("initKey"),fe=Symbol("readyKey"),Kt=Symbol("readyHandlersKey"),tt=Symbol("_markReady"),Ps=Symbol("_createNextFn"),jt=Symbol("_start"),qt=Symbol("_before"),Tt=Symbol("_after"),Fs=Symbol("_destroy"),kt=Symbol("_load"),Le=Symbol("_unload"),Oe=Symbol("routerGuardKey");function Yr(r){return r.layers.length==0||r.layers[0].views.length==0}class Zr{[N]=new Array;[et];[Et]="*";[fe]=!1;[Kt]=[];[D]=new Wr;[P];[b]=new Array;[At]=g.shallowRef(null);[Qe]=new WeakMap;[Ze]=null;[Xe]=null;[qe]=new Array;[Te]=new Array;[ke]=new Array;[$t]=null;[we]=new Ne;[Oe]=new Gr;[_t]=!1;get currentRoute(){return g.readonly(this[At])}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[P]=e.history:this[P]=ye?Vs():zs(),this[P]?.listen(async s=>{let n=!0;try{if(typeof s=="string"){const i=this[O](s);i&&await this[Ct]([i])}else await this[Ct](s)}catch(i){console.error(i.message,i),n=!1}this[fe]===!1&&this[tt](n)})}[K](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[Ze]=="function")try{this[Ze](e,t)}catch{}console.error(e)}init(){this[_t]!==!0&&(this[P]?.init(!this[fe]),this[_t]=!0)}isReady(){return this[fe]?Promise.resolve():new Promise((e,t)=>{this[Kt].push([e,t])})}[tt](e){this[fe]=!0,this[Kt].forEach(([t,s])=>{try{e?t():s()}catch(n){console.error(n.message,n)}})}[Ct](e){try{if(!e){let o=[...this[b]].reverse();return this[Le](o),ye&&E().location.reload(),Promise.resolve()}let t=null,s=[],n=[],i=0;for(;i<e.length&&i<this[b].length&&S.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&&(s=e.slice(i)),i<this[b].length&&(n=this[b].slice(i).reverse()),n.length===0&&s.length===0){if(t!==null)return this.restore([t])}else if(n.length>0){if(this[Le](n)){if(s.length>0)return this.restore(s);if(t!==null)return this.restore([t])}}else return this.restore(s)}catch(t){this[K](t)}return Promise.resolve()}[ue](e=null){if(this[At].value=e,typeof this[Xe]=="function")try{this[Xe](e)}catch{}}[xs](e,t){if(e.opsType===F.Open){let s=!1;const n=this[b].length-1;for(let i=n;i>=0;i--){const o=this[b][i];if(e.root==o.root){if(e.path===o.path){this[b].splice(i,1,e),s=!0;continue}e.active&&(o.active=!1)}}s||this[b].push(e)}else this[b].push(e);this[Qe].set(e,t),this[ue](e)}[Ye](){let e=[];for(let t of this[b]){let s=S.clone(t,!0);e.push(s)}return e}[je](e){if(!this[b]){this[ue](null);return}let t=-1;for(let s=0;s<this[b].length;s++)if(S.isSame(this[b][s],e)){t=s;break}if(t!=-1){const s=this[b][t];this[b].splice(t,1);const n=this[Qe].get(s);if(this[Qe].delete(s),this[Fs](s,n),s.opsType===F.Append){const i=this[b].length-1;this[ue](this[b][i]??null)}else this[ue](null)}else this[ue](null)}set historyMonitor(e){this[P]&&(this[P].historyMonitor=e)}get historyMonitor(){return this[P]?this[P].historyMonitor:!1}set traceless(e){this[P]&&(this[P].traceless=e)}get traceless(){return this[P]?this[P].traceless:!1}set propsFilter(e){this[$t]=e}get propsFilter(){return this[$t]}setRestorePoint(){const e=this[Ye]();this[P]?.setRestorePoint(e)}onRouteUpdated(e){this[Xe]=e}onError(e){this[Ze]=e}beforeEach(e){this[qe].push(e)}removeBeforeEach(e){const t=this[qe].indexOf(e);return t!==-1?(this[qe].splice(t,1),!0):!1}afterEach(e){this[Te].push(e)}removeAfterEach(e){const t=this[Te].indexOf(e);return t!==-1?(this[Te].splice(t,1),!0):!1}destroyEach(e){this[ke].push(e)}removeDestroyEach(e){const t=this[ke].indexOf(e);return t!==-1?(this[ke].splice(t,1),!0):!1}beforeRestoreEach(e){this[P]?.beforeRestoreEach(e)}removeBeforeRestoreEach(e){return this[P]?.removeBeforeRestoreEach(e)??!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[Et]){this.setNotFoundRoute(e);return}const s=this[Je](e);if(t==-1)this[N]=[...this[N],...s];else for(let n=s.length-1;n>=0;n--)this[N].splice(t,0,s[n])}removeRoute(e){const t=this[O](e);if(t===null)return console.warn("route格式错误",e),!1;for(let s=0;s<this[N].length;s++){const n=this[N][s];if(t?.path&&n.path===t.path)return this[N].splice(s,1),!0;if(t?.name&&n.name===t.name)return this[N].splice(s,1),!0}return!1}hasRoute(e){const t=this[O](e);return t===null?(console.warn("route格式错误",e),!1):this[N].findIndex(n=>{if(t?.path&&n.path===t.path||t?.name&&n.name===t.name)return!0})!==-1}setNotFoundPath(e){this[Et]=e}setNotFoundRoute(e){const t=this[Je](e);this[et]=t[0]}getRoutes(){return[...this[N]]}[Je](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let s=e.components??(e.component&&{"":e.component});if(!s){const l=new gt;return l.path=t,l.redirect=e.redirect,[l]}const n=new S;n.path=t,n.name=e.name,n.meta=e.meta;let i=[];for(let l in s){const u=s[l];l.length===0&&(l=Q);const f=new $r(l,u,e.props);i.push(f)}let o=!1,a=[];if(e.children)for(let l of e.children){const u=this[Je](l);for(let f of u){let c=new gt;c.name=f.name,f.path&&f.path.length>0?t!=="/"?c.path=`${t}${f.path}`:c.path=f.path:(o=!0,c.path=t);let h=new ls;h.models=[...i],c.layers=[h,...f.layers];const y=f.matchedRoutes??[];c.matchedRoutes=[n,...y],a.push(c)}}if(!o){const l=new ls;l.models=i;const u=new gt;u.name=e.name,u.path=t,u.meta=e.meta,u.matchedRoutes=[n],u.layers=[l],a.splice(0,0,u)}return a}[Ge](e){const t=e.route;try{for(let s of this[N]){const n=t.path?t.template??t.path:null,i=t.name?t.template??t.name:null;if(n&&s.path){let o=s.match;o||(o=s.match=zr(s.path));const a=o(n);if(!a)continue;if(s.redirect){const l=new S;C(!0,l,t),l.path=s.redirect;const u={route:l,find:void 0};return this[Ge](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??{},C(!0,t.params,a.params),t.query){const l=t.query;if(typeof l=="string"){const u={},f=l.split("&");for(let c of f){const h=c.split("=");if(h.length!==2)continue;const y=decodeURIComponent(h[0].trim()),d=decodeURIComponent(h[1].trim());u[y]=d}C(!0,t.params,u)}else typeof l=="object"&&C(!0,t.params,l)}return e.find=s,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0}else if(i===s.name)return e.find=s,t.template&&e.find&&(e.find={...e.find},e.find.name=t.name),!0}}catch(s){console.error(s.message,s),typeof t.error=="function"&&t.error(s.message)}return!1}[O](e){let t=null;if(Array.isArray(e))if(t=new S,typeof e[0]=="object")t=S.from(e[0]);else for(let s=0;s<e.length;s++)s===0?e[s].charAt(0)==="/"?t.path=e[s]:t.name=e[s]:s===1?t.params=e[s]:s===2?t.root=e[s]:s===3&&C(!1,t,e[s]);else typeof e=="object"?t=S.from(e):typeof e=="string"&&(t=new S,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let s=t.path.indexOf("?");s!==-1&&s<t.path.length-1&&(t.query=t.path.substring(s+1),t.path=t.path.substring(0,s))}t.root=t.root??Q,t.opsType=t.opsType??this.options.defaultOperationType??F.Push,t.traceless&&!t.historyUpdatePolicy&&(t.historyUpdatePolicy="traceless")}return t}push(...e){const t=this[O](e);return t?(t.opsType=F.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=F.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=F.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=F.Append,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}remove(e,t){return new Promise(s=>{this[we].post(n=>{try{if(this[b].length===0){n.resolve(),s(!1);return}let i=-1,o,a=[];if(e){if(e.root?o=e.root:o=this[b][0].root??Q,e.all)for(let u=this[b].length-1;u>0;u--){let f=this[b][u];f.opsType===F.Append&&f.root===o&&(a.splice(0,0,f),i=u-1)}else if(e.until)for(let u=this[b].length-1;u>0;u--){let f=this[b][u];if(f.opsType===F.Append&&f.root===o){if(e.until.charAt(0)==="/"&&e.until===f.path){i=u;break}else if(e.until===f.name){i=u;break}a.splice(0,0,f)}}else if(e.to)for(let u=this[b].length-1;u>0;u--){let f=this[b][u];if(f.opsType===F.Append&&f.root===o){if(a.splice(0,0,f),e.to.charAt(0)==="/"&&e.to===f.path){i=u-1;break}else if(e.to===f.name){i=u-1;break}}}}else{o=Q;let u=this[ws](this[D]);u&&(o=u.name);for(let f=this[b].length-1;f>0;f--){let c=this[b][f];if(c.opsType===F.Append&&c.root===o){a.push(c),i=f-1;break}}}if(i===-1||a.length===0){let u="can not find route";console.warn(u),n.resolve(u),s(!1);return}let l=null;if(i!==-1&&(l=this[b][i]),this[Le](a)){if(t===!1)return n.resolve(),s(!0),!0;const u=()=>(n.resolve(),s(!0),!0),f=this[b].length;if(l&&S.isSame(l,this[b][f-1])){this[P]?.goBack(l,u);return}u()}}catch(i){this[K](i),n.resolve(),s(!1)}})})}open(...e){let t=this[O](e);return t?(t.opsType=F.Open,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}close(e){return this[we].post(t=>{try{let s=this[O](e);if(!s){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===s.root){if(!s.path&&!s.name){n.push(o);continue}if(s.path&&s.path===o.path){n.push(o);break}else if(s.name&&s.name===o.name){n.push(o);break}}}if(n.length===0){t.resolve();return}this[Le](n),t.resolve()}catch(s){this[K](s),t.resolve()}}),this}to(...e){let t=this[O](e);if(!t)return this[K]("resolve route fail",t),this;let s=this[Oe].acquire(t);return s==null?(this[K]("route forbid",t),this):(this[we].post(n=>{try{let i=this[jt](t);this[qt](i),this[kt](i),this[Tt](i),i.wait((o,a)=>{const l=o.session.to;if(o.session.updateResult&&o.session.updateResult.status==="success")try{let u=S.clone(l,!0);const f=new ds(u,this[Ye]());l.historyUpdatePolicy==="replace"?this[P]?.replace(f):l.historyUpdatePolicy==="traceless"?this[P]?.setRouteMark(f):this[P]?.push(f)}catch(u){console.error(u.message,u)}if(Se.clear(o.session),this[Oe].release(s),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(u){console.error(u.message,u)}this[fe]===!1&&this[tt](!0),i=null,n.resolve()},(o,a)=>{this[Oe].release(s),a!==null&&this[K](a,t),this[fe]===!1&&this[tt](!1),Se.clear(o.session),i=null,n.resolve()})}catch(i){this[Oe].release(s),this[K](i,t),n.resolve()}}),this)}back(e=1){this[P]?.go(-e,!1)}[Ps](e){return(t,s)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(s??null);else if(t){const n=this[O](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()}}[jt](e){const t=this[b].length>0?this[b][this[b].length-1]:void 0,s=new Se(e,t),n={route:e,find:null};return this[Ge](n),n.find&&(s.routeModel=n.find,e.matched=n.find.matchedRoutes??[],n.find.meta&&typeof n.find.meta=="object"&&(e.meta=C(!0,e.meta??{},n.find.meta))),new Ne(s)}[qt](e){for(let t of this[qe])e.post(s=>{const n=this[Ps](s);Reflect.apply(t,{},[s.session.to,s.session.from,n,s.session])})}[Tt](e){e.post(t=>{for(let s of this[Te])try{Reflect.apply(s,{},[t.session.to,t.session.from,t.session])}catch(n){console.error(n.message,n)}t.resolve()})}[Fs](e,t){for(let s of this[ke])try{Reflect.apply(s,{},[e,t])}catch(n){console.error(n.message,n)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[kt](e){e.post(t=>{const s=t.session.to;let n=t.session.routeModel;if(n==null){let o={route:s,find:null};if(this[Ge](o))n=o.find,t.session.routeModel=n;else if(this[et])n=this[et];else{t.reject(`not find route model, path:${s.path??s.name}`);return}}const i=Se.from(t.session);this[bs](s,n,i).then(o=>{this[D],t.session.updateResult=o??{status:"success",message:""},t.resolve()},o=>{t.reject(o)})})}[Le](e){if(e.length==0)return!0;let t=this[D],s=[];for(let n of e){let i=this[Ft](t,n);i!=null&&s.push({...i,route:n})}if(s.length==0)return this[K]("can not find view index"),!1;for(let n of s.reverse())this[ae](t,{x:n.x,y:n.y},[n.route.index??0],!0);return!0}[Ft](e,t){const s=t.root??Q;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[V]&&l[rt]===s)return n={x:a,y:i},n}}return null}[ws](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[ae](e,t,s=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 c=u.length-1;c>=0;c--){let h=u[c];(!s||s.indexOf(h.index)!=-1)&&(h.route&&i[V]&&(this[je](h.route),h.active===!0&&h.route.opsType==F.Append&&(l=!0)),a.push(new H(i,h.index,t.y)),u.splice(c,1))}if(u.length==0)n?i.slots.value=u:e.layers[t.y].views.splice(t.x,1);else{if(l){let c=u.length-1,h=u[c];h.active=!0,h.route&&(h.route.active=h.active)}i.slots.value=u}e.layers[t.y].views.length==0&&(o=!0);let f=t.y+1;for(;f<e.layers.length;f++){let c=e.layers[f].views,h=[];for(let y=c.length-1;(o||a.length>0)&&y>=0;y--){let d=c[y];if(d[ce]&&(o||H.include(a,d[ce]))){let p=d.slots.value;for(let v=p.length-1;v>=0;v--){let w=p[v];w.route&&d[V]&&this[je](w.route),h.push(new H(d,w.index,f)),p.splice(v,1)}e.layers[f].views.splice(y,1)}}a=h,e.layers[f].views.length==0&&(o=!0)}}restore(e){if(!e||this[N].length==0){let t=this[D];if(t.layers.length>0){let s=t.layers[0].views;s.length>0&&(s[0].slots.value=[])}return this[b]=[],this[ue](null),Promise.resolve()}else return new Promise((s,n)=>{let i=null,o=!1;for(let a=0;a<e.length;a++){const l=e[a];this[we].post(u=>{const f=this[jt](l);this[qt](f),this[kt](f),this[Tt](f),f.wait((c,h)=>{i=c.session.to,o=c.session.redirect,u.resolve()},(c,h)=>{i=null,h!==null&&this[K](h),u.resolve()})})}this[we].post(a=>{if(i&&o===!0){const l=S.clone(i,!0),u=new ds(l,this[Ye]());this[P]?.replace(u)}a.resolve(),s()})})}[bs](e,t,s){const n=e.updateType??st.Part;return this[Rs](t).then(()=>{const o=this[Ss](t,e,s,n);if(o.status==="error")throw Error(o.message);return o})}[Rs](e){let t=[];for(let s=0;s<e.layers.length;s++){let n=e.layers[s];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()}[Ss](e,t,s,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[D],a=Yr(o),l=t.root??Q,u;!a&&n==st.Part&&(u=this[Ft](o,t));let f,c=0;if(u==null||u==null)if(a||n===st.All){if(o.layers.length==0&&(o.layers[0]=new St),o.layers[0].views.length==0){let h=t.root??Q;f=new $e(h,!0,null),o.layers[0].views=[f]}else f=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 v of p.views){if(v[V]&&v.name===h.rootName){d=new H(v,h.rootIndex??0,y-1);break}if(v[U]&&v[U].view.name===h.rootName&&v[U].index===h.rootIndex){d=v[U];break}}}if(!d)return{status:"error",message:"can not insert view(not find root node ref)"};f=new $e(l,!0,d),o.layers[y].views.push(f),u={x:o.layers[y].views.length-1,y}}else f=o.layers[u.y].views[u.x];if(c=u.y,f[V]=!0,t.opsType===F.Append){t.index=t.index??ie.get(),t.active=!0;let h=f.slots.value;if(h.length>0){let w=h[h.length-1];w.active=!1,w.route&&(w.route.active=w.active)}let y=new te(t,i,t.index,!0);f.slots.value=[...h,y];let d=c+1,p=1,v=new H(f,t.index,c);this[se](o,d,e,p,v)}else if(t.opsType===F.Open){let h=f.slots.value;const y=t.active??!0;let d=!1;for(let p of h){if(p.route!==null&&S.isSamePathForRoute(p.route,t)){if(p.active===y)return t.index=p.index,t.active=y,p.route=t,{status:"noChange",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??ie.get(),t.active=y;let p=new te(t,i,t.index,y);h.push(p);let v=c+1,w=1,m=new H(f,t.index,c);this[se](o,v,e,w,m)}f.slots.value=[...h]}else{let h=f.slots.value;if(h.length==0){t.index=t.index??ie.get(),t.active=!0,f.slots.value=[new te(t,i,t.index)];let y=c+1,d=1,p=new H(f,t.index,c);this[se](o,y,e,d,p)}else{let y=h[0];if(y.model!==i){this[ae](o,u,null,!0),t.index=t.index??ie.get(),t.active=!0,f.slots.value=[new te(t,i,t.index)];let d=c+1,p=1,v=new H(f,t.index,c);this[se](o,d,e,p,v)}else{y.route!==null&&this[je](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 v=[];for(let Y=1;Y<h.length;Y++)v.push(h[Y].index);v.length>0?this[ae](o,u,v,!0):d&&(f.slots.value=[...h]);let w=[new H(f,t.index,c)],m=c+1,$=1,W=new H(f,t.index,c);for(;w.length>0&&m<o.layers.length&&$<e.layers.length;m++,$++){let Y=[];for(let j=0;j<o.layers[m].views.length;j++){let q=o.layers[m].views[j];q[ce]&&H.include(w,q[ce])&&Y.unshift(j)}let me=[];for(let j of Y){let q=o.layers[m].views[j],oe=e.layers[$].models,Z;for(let k=0;k<oe.length;k++)if(q.name===oe[k].name){Z=oe[k];break}if(!Z)this[ae](o,{x:j,y:m},null,!1);else{let k=q.slots.value;if(k.length==0){let J=0;q.slots.value=[new te(null,Z,J)];let B=m+1,ee=$+1;this[se](o,B,e,ee,W)}else{let J=k[0];if(J.model!==Z){this[ae](o,{x:j,y:m},null,!0),q.slots.value=[new te(null,Z,0)];let B=m+1,ee=$+1;this[se](o,B,e,ee,W)}else{q[V]&&J.route!==null&&this[je](J.route);let B=[];for(let ee=1;ee<k.length;ee++)B.push(k[ee].index);B.length>0&&this[ae](o,{x:j,y:m},B,!0),me.push(new H(q,J.index,m))}}q[V]=!1}}w=me}this[se](o,m,e,$,W)}}}if(f&&f[U]){let h=f[U];h&&(t.slot=new Er(l,c,h?.view.name,h?.index??0))}return s.to=void 0,s.routeModel=void 0,this[xs](t,s),{status:"success",message:""}}[se](e,t,s,n,i){let o=n,a=t;for(;a<e.layers.length&&o<s.layers.length;a++,o++){let l=e.layers[a].views;for(let u of s.layers[o].models){let f=new $e(u.name,!1,i),c=new te(null,u);f.slots.value=[c],l.push(f)}}for(;o<s.layers.length;o++){let l=new St;l.views=[];for(let u of s.layers[o].models){let f=new $e(u.name,!1,i),c=new te(null,u);f.slots.value=[c],l.views.push(f)}e.layers.push(l)}}[Ls](e,t,s,n,i,o){if(t<0||t>this[D].layers.length)return null;if(t<this[D].layers.length){let f=this[D].layers[t],c=null;for(let h of f.views){let y=!1;if(s!==null?(y=h.name===e&&h[U]?.view===s,y&&n!==-1&&(y=h[U]?.index===n)):y=h.name===e,!!y){i!==null&&(h[ce]={view:i,index:o,level:t-1}),c=h;break}}if(c!==null)return c}let a=null,l=null;i!==null&&(i[V]?a={view:i,index:o,level:t-1}:a=i[U],l={view:i,index:o,level:t-1});let u=new $e(e,!0,a);if(u[ce]=l,t==this[D].layers.length){let f=new St;f.views=[u],this[D].layers.push(f)}else this[D].layers[t].views.push(u);return u}}const en="fox-router-view",tn="fox-router-link";function Ws(r,e=!1){let t=null;return e?t=r.showFromClass??r.enterFromClass:t=r.enterFromClass,t||(t=r.transitionName,t?e?`${t}-show-from`:`${t}-enter-from`:null)}function Js(r,e=!1){let t=null;return e?t=r.showActiveClass??r.enterActiveClass:t=r.enterActiveClass,t||(t=r.transitionName,t?e?`${t}-show-active`:`${t}-enter-active`:null)}function sn(r,e=!1){let t=null;return e?t=r.showToClass??r.enterToClass:t=r.enterToClass,t||(t=r.transitionName,t?e?`${t}-show-to`:`${t}-enter-to`:null)}function Gs(r,e=!1){let t=null;return e?t=r.hideFromClass??r.leaveFromClass:t=r.leaveFromClass,t||(t=r.transitionName,t?e?`${t}-hide-from`:`${t}-leave-from`:null)}function Xs(r,e=!1){let t=null;return e?t=r.hideActiveClass??r.leaveActiveClass:t=r.leaveActiveClass,t||(t=r.transitionName,t?e?`${t}-hide-active`:`${t}-leave-active`:null)}function rn(r,e=!1){let t=null;return e?t=r.hideToClass??r.leaveToClass:t=r.leaveToClass,t||(t=r.transitionName,t?e?`${t}-hide-to`:`${t}-leave-to`:null)}function nn(r,e=!1){let t=null;return e?t=r.beforeShow??r.beforeEnter:t=r.beforeEnter,t}function on(r,e=!1){let t=null;return e?t=r.show??r.enter:t=r.enter,t}function ln(r,e=!1){let t=null;return e?t=r.afterShow??r.afterEnter:t=r.afterEnter,t}function an(r,e=!1){let t=null;return e?t=r.showCancelled??r.enterCancelled:t=r.enterCancelled,t}function un(r,e=!1){let t=null;return e?t=r.beforeHide??r.beforeLeave:t=r.beforeLeave,t}function fn(r,e=!1){let t=null;return e?t=r.hide??r.leave:t=r.leave,t}function cn(r,e=!1){let t=null;return e?t=r.afterHide??r.afterLeave:t=r.afterLeave,t}function hn(r,e=!1){let t=null;return e?t=r.hideCancelled??r.leaveCancelled:t=r.leaveCancelled,t}function Zt(r){let e,t=r.transitionDuration;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 Fe(r,e){r.classList.contains(e)||r.classList.add(e)}function Pe(r,e){r.classList.remove(e)}const yn=ye&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function ht(r){yn(r)}function _(r,e,t){R(e)&&(r==null&&(r={}),Reflect.apply(e,r,t))}function Qs(r,e,t,s=-1,n,i,o){let a=[];const l=()=>{for(let u of a)Vt(e,u.type,u.listener);a=[]};if(R(i)){if(n!==void 0&&n>=0){setTimeout(()=>{Reflect.apply(i,r,[e,t,s])},n);return}const u=["animationend","transitionend",ot],f=c=>{const h=c.target||c.srcElement,y=c.currentTarget;h===y&&(l(),Reflect.apply(i,r,[e,t,s]))};u.forEach(c=>{it(e,c,f),a.push({type:c,listener:f})})}if(R(o)){const u="animationcancel",f=c=>{const h=c.target||c.srcElement,y=c.currentTarget;h===y&&(l(),Reflect.apply(o,r,[e,t,s]))};it(e,u,f),a.push({type:u,listener:f})}}function yt(r){return!ye||r===null?!1:r.opsType===F.Append||r.opsType===F.Open}function Ys(r,e,t,s={},n,i=-1){if(e||yt(n)){const o=Ws(s,e);o&&Fe(t,o);const a=Js(s,e);a&&Fe(t,a);const l=nn(s,e);_(r,l,[t,e,n,i])}}function Zs(r,e,t,s={},n,i,o,a){if(!yt(i)&&!e){R(a)&&a(r,a,[t]);return}const l=Ws(s,e),u=Js(s,e),f=sn(s,e),c=on(s,e),h=ln(s,e),y=an(s,e);if(!l&&!u&&!f&&!c){R(a)&&a(r,a,[t]);return}ht(()=>{Qs(r,t,i,o,n,()=>{u&&Pe(t,u),f&&Pe(t,f),R(h)&&_(r,h,[t,e,i,o]),R(a)&&a(r,a,[t])},()=>{R(y)&&_(r,y,[t,e,i,o])}),l&&Pe(t,l),f&&Fe(t,f),R(c)&&_(r,c,[t,e,i,o])})}function er(r,e,t,s={},n,i=-1){if(e||yt(n)){const o=Gs(s,e);o&&Fe(t,o);const a=Xs(s,e);a&&Fe(t,a);const l=un(s,e);_(r,l,[t,e,n,i])}}function tr(r,e,t,s={},n,i,o,a,l){if(!yt(o)&&!e){R(l)&&_(r,l,[t]),!e&&R(i)&&i();return}const u=Gs(s,e),f=Xs(s,e),c=rn(s,e),h=fn(s,e),y=cn(s,e),d=hn(s,e);if(!u&&!f&&!c&&!h){R(l)&&_(r,l,[t]),!e&&R(i)&&i();return}ht(()=>{Qs(r,t,o,a,n,()=>{try{f&&Pe(t,f),c&&Pe(t,c),R(y)&&_(r,y,[t,e,o,a]),R(l)&&_(r,l,[t])}finally{!e&&R(i)&&i()}},()=>{try{R(d)&&_(r,d,[t,e,o,a]),R(l)&&_(r,l,[t])}finally{!e&&R(i)&&i()}}),u&&Pe(t,u),c&&Fe(t,c),R(h)&&_(r,h,[t,e,o,a])})}function Bt(r,e,t={},s,n=-1){const i=t.mode??"default",o=Zt(t);return{mode:i,persisted:!1,beforeEnter:l=>{Ys(r,!1,l,t,s,n)},enter:l=>{Zs(r,!1,l,t,o.enter,s,n)},leave:(l,u)=>{er(r,!1,l,t,s,n),tr(r,!1,l,t,o.leave,u,s,n,()=>{e.transition=null,e=null})},clone:l=>Bt(r,e,t,s,n)}}function sr(r){return r.el}function dn(r,e,t={},s,n,i,o){if(i===!0){const a=sr(e);if(a==null)return;const l=Zt(t);Ys(r,!0,a,t,s,n),Zs(r,!0,a,t,l.show,s,n,u=>{R(o)&&_(r,o,[u])})}else R(o)&&_(r,o,[])}function mn(r,e,t={},s,n,i,o){if(i===!0){const a=sr(e);if(a==null)return;const l=Zt(t);er(r,!0,a,t,s,n),tr(r,!0,a,t,l.hide,null,s,n,u=>{R(o)&&_(r,o,[u])})}else R(o)&&_(r,o,[])}function pn(r,e={}){ht(()=>{for(let t=0;t<r.length;t++)Reflect.apply(r[t],e,[])})}function rr(r,e,t={},s,n=-1){return{mode:t.mode??"default",persisted:!1,beforeEnter:a=>{Ue(Os,{},a)},enter:a=>{Ue(Ms,{},a)},leave:(a,l)=>{Ue(Is,{},a),ht(()=>{const u=f=>{const c=f.target||f.srcElement,h=f.currentTarget;c===h&&(Vt(a,ot,u),l&&Reflect.apply(l,r,[]),e.transition=null,e=null)};it(a,ot,u),Ue(Hs,{},a)})},clone:a=>rr(r,e,t,s,n)}}function re(r,e,t){return typeof r=="function"?Reflect.apply(r,{},[e,t]):r}function Lt(r,e){if(!r)return null;const t=r(e);return t.length===1?t[0]:t}function be(r,e){return typeof e=="function"?e(r):r}class gn{node;state;constructor(e,t){this.node=e,this.state=t}}const Ut=g.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(r,e){const t=g.getCurrentInstance();if(t===null||t.proxy===null){console.error("instance or instance.proxy not exist");return}const s=r.multi===!0,n=g.inject(ct,null),i=g.inject(wt,0),o=g.inject(cs,null),a=g.inject(bt,-1);let l=null,u=r.modelSlot;if(u){if(g.provide(wt,i+1),g.provide(bt,u.index),g.provide(Rt,u.index),!u.route){console.warn("child view render error, route not exist");return}const h=lt(t.proxy,!0);Tr(h),fs(h,()=>u?.route??null)}else{if(n==null){console.error("router is not been injected");return}const c=r.name,h=g.inject(hs,null),y=g.inject(Rt,0);if(l=n[Ls](c,i,o,a,h,y),l===null)return;g.provide(hs,l);const d=l[V]===!0;if(d&&g.provide(cs,l),!s&&(g.provide(bt,-1),g.provide(wt,i+1),g.provide(Rt,-1),d)){const p=lt(t.proxy,!0);fs(p,()=>{const v=l.slots.value;return v.length>0?v[0].route:null})}}const f={value:new Map};return g.onUnmounted(()=>{if(f.value&&f.value.clear(),u){const c=u;c.route=null,c.model=null,c.instance=null,u=void 0}}),()=>{if(s){const c=new Map,h=[],y=l?.slots.value,d=[];for(let w=0;w<y.length;w++){const m=y[w],$=`${r.name}_${m.index}`,W=re(r.transition,m.route,w)??!0,Y={modelSlot:m};let me;e.slots.default?me=g.h(Ut,Y,{default:e.slots.default}):me=g.h(Ut,Y);const j={},q=re(r.viewClass,m.route,w);typeof q=="string"&&q.length>0&&(j[q]=!0);const oe=re(r.viewActiveClass,m.route,w),Z=re(r.viewInactiveClass,m.route,w),k=f.value.get($);if(typeof oe=="string"&&oe.length>0&&(j[oe]=m.active),typeof Z=="string"&&Z.length>0&&(j[Z]=!m.active),k&&m.active!==k.state){const M=k.node;m.active?d.unshift(()=>{const dt=()=>{let Ce=as(M);Ce!=null&&us(Ce,Dt.ACTIVATED)};dn(t,M,r,m.route,w,W,dt)}):d.push(()=>{const dt=()=>{const Ce=as(M);Ce!=null&&us(Ce,Dt.DEACTIVATED)};mn(t,M,r,m.route,w,W,dt)})}const J={class:j,key:$},B=re(r.viewTagProps,m.route,w);if(B!==null&&typeof B=="object"){const M=be(B,n?.propsFilter);C(!0,J,M)}if(m.route?.viewTagAttrs&&typeof m.route?.viewTagAttrs=="object"){const M=be(m.route.viewTagAttrs,n?.propsFilter);C(!0,J,M)}const ee=re(r.viewTag,m.route,w),pe=g.h(ee,J,{default:()=>[me]});if(c.set($,new gn(pe,m.active)),f.value.delete($),W===!0){const M=Bt(t,pe,r,m.route,w);pe.transition=M}else if(W==="custom"){const M=rr(t,pe,r,m.route,w);pe.transition=M}h.push(pe)}f.value=c,pn(d,t);const p=re(r.tag,null,-1),v={};return Object.assign(v,e.attrs),g.h(p,v,{default:()=>h})}else if(u!=null){const c=u.model,h={};if(c.props){if(typeof c.props=="object"){const d=be(c.props,n?.propsFilter);C(!1,h,d)}else if(c.props===!0&&typeof u.route?.params=="object"){const d=be(u.route.params,n?.propsFilter);C(!1,h,d)}}const y=g.h(c.component,h);return Lt(e.slots.default,{Component:y,route:u.route})??y}else{const c=l.slots.value;if(c.length>0){const h=c[0],y=h.route??(t.proxy&&Yt(t.proxy))??null,d=h.model,p={};if(d.props){if(typeof d.props=="object"){const m=be(d.props,n?.propsFilter);C(!1,p,m)}else if(d.props===!0&&typeof y?.params=="object"){const m=be(y.params,n?.propsFilter);C(!1,p,m)}}const v=g.h(d.component,p);if(re(r.transition,y,-1)??!0){const m=Bt(t,v,r,y,-1);v.transition=m}return Lt(e.slots.default,{Component:v,route:y})??v}else return Lt(e.slots.fallback,{})}}}});function vn(r){if(!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)&&!r.defaultPrevented&&!(r.button!=null&&r.button!==0)){if(r.currentTarget&&r.currentTarget.getAttribute){const e=r.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return r.preventDefault&&r.preventDefault(),!0}}function wn(r,e){return r==null||e==null?!1:!!(r===e||r.path&&r.path===e.path||r.name&&r.name===e.name)}function bn(r,e){return r==null||e==null?!1:!!(r.path&&e.path&&e.path.startsWith(r.path)||r.name&&r.name==e.name)}function Re(r,e){return typeof r=="function"?Reflect.apply(r,{},[e]):r}let Rn=g.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(r,e){const t=g.inject(ct,null);return()=>{let s=Re(r.to,null),n=Re(r.tag,s);if(n==null){console.warn("can not resolve link tag");return}let i=null,o=null;t!==null&&(i=t[O](s),r.root&&(i.root=r.root),o=t.currentRoute.value);let a={},l=Re(r.activeClass,i);if(typeof l=="string"&&l.length>0&&(a[l]=bn(i,o)),Re(r.exact,i)===!0){let h=Re(r.exactActiveClass,i);typeof h=="string"&&h.length>0&&(a[h]=wn(i,o))}let f={class:a};(n==="a"||n==="A")&&(f.href=i?.path??i?.name??"#"),C(!0,f,e.attrs);let c=Re(r.event,i);if(typeof c=="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}vn(y)&&t.to(i)};f[c]=h}return g.h(n,f,e.slots)}}});var T=(r=>(r[r.Loading=0]="Loading",r[r.Loaded=1]="Loaded",r[r.Defining=2]="Defining",r[r.Defined=3]="Defined",r))(T||{}),nt=(r=>(r[r.normal=0]="normal",r[r.factory=1]="factory",r))(nt||{});class Sn{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 Cs{moduleManager=new Sn;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 Be().head}constructor(){}setModule(e,t){const s={id:e,src:"",status:T.Defined};typeof t=="function"?(s.exports=t,s.type=nt.factory):s.exports=t,this.moduleManager.set(e,s)}removeModule(e){this.moduleManager.remove(e)}ensure(...e){const t=[];let s=e.length-1;const n={};typeof e[s]=="object"&&(Object.assign(n,e[s]),s--);let i=null;typeof e[s]=="function"&&(i=e[s],s--);for(let l=0;l<=s;l++)if(Array.isArray(e[l])){let u=e[l];for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}else if(typeof e[l]=="string"){let u=e[l].split(",");for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}const o=new xn(t.length,(l,u)=>{if(o.isOK())try{typeof i=="function"&&Reflect.apply(i,{},u)}catch(f){console.error(f.message,f)}else try{console.error(l),typeof i=="function"&&Reflect.apply(i,{},[])}catch(f){console.error(f.message,f)}}),a=new Ne;for(let l=0;l<t.length;l++){const u=new Pn(l,t[l],n,o);this.mount(a,u)}return this}remove(...e){let t=[],s=e.length-1,n={};typeof e[s]=="object"&&(Object.assign(n,e[s]),s--);let i=null;typeof e[s]=="function"&&(i=e[s],s--);for(let o=0;o<=s;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 s=this.getFileNamePostfix(t.src);if(s==="js"||s.length===0){let n=t.params.jsPoint;n||(n=this.head),this.mountJS(e,t,n);return}else if(s==="css"){let n=t.params.cssPoint;n||(n=this.head),this.mountCSS(e,t,n);return}}mountCSS(e,t,s){e.post(n=>{const i=t.src,o=this.moduleManager.get(i);if(o&&(o.status==T.Defined||o.status==T.Loaded)&&o.exports){o.type===nt.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=Be(),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{s.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),n.reject()};else{const c={timeout:this.options.timeout??3e3,time:0,success:()=>{t.progress.work(!0,t.index,t.src),n.resolve()},error:()=>{try{s.removeChild(l)}catch(h){console.error(h.message,h)}t.progress.work(!1,t.index,null),n.resolve()}};setTimeout(()=>{nr(l,c)},1)}let f=a.getElementById(i);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=i,l.href=i,s.appendChild(l)})}mountJS(e,t,s){e.post(n=>{const i=t.src;let o=this.moduleManager.get(i);if(o&&(o.status==T.Defined||o.status==T.Loaded)){if(o.exports){o.type===nt.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:T.Loading},this.moduleManager.set(i,o);const l=Be().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,o.status===T.Loading&&(o.status=T.Loaded,t.progress.work(!0,t.index,i)),n.resolve()},l.onerror=()=>{try{s.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,this.moduleManager.remove(i),t.progress.work(!1,t.index,null),n.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,o.status==T.Loading&&(o.status=T.Loaded,t.progress.work(!0,t.index,i)),n.resolve())}}l.defer=!0,l.src=i;const f=E();f.define=this.createDefine(o,t),s.appendChild(l)})}unmount(e,t={}){const s=Be(),n=this.getFileNamePostfix(e);if(n==="js"||n.length===0){const i=s.querySelector(`script[src="${e}"]`);i&&i.parentNode&&i.parentNode.removeChild(i),this.moduleManager.remove(e);return}else if(n==="css"){const i=s.querySelector(`style[href="${e}"]`);i&&i.parentNode&&i.parentNode.removeChild(i);return}}trimEmptyElement(e){let t=[];for(let s=0;s<e.length;s++){if(e[s]===void 0||e[s]===null)continue;const n=e[s].trim();n.length!==0&&t.push(n)}return t}createDefine(e,t){const s=this,n=function(...i){e.status=T.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=s.trimEmptyElement(i[0]),o=void 0):a=void 0):(o=i[0],a=s.trimEmptyElement(i[1]),l=i[2]),o&&(e.id=o,s.options.alias[o]=e.src),a&&a.length>0?s.ensure(a,(...f)=>{const c=f.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,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=l;e.status=T.Defined,t.progress.work(!0,t.index,e.exports)}):(typeof l=="function"?e.exports=Reflect.apply(l,e,[]):e.exports=l,e.status=T.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 s=this.createSearch(this.query);return e.indexOf("?")==-1?(t!=="js"&&t!=="css"&&(e+=".js"),s.length>0&&(e+=`?${s}`)):s.length>0&&(e+=`&${s}`),e}catch(t){throw console.error(`resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e){for(let s in e){let n=`${e[s]}`;t+=`${encodeURIComponent(s)}=${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 s=e.lastIndexOf(".",t);return s==-1?"":e.substring(s+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 s=0;s<t.length;s++){const n=t[s];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`${mt()}${e.slice(1)}`;if(e.indexOf("./")==0)return`${mt()}${e.slice(2)}`;if(e.indexOf("//")==0)return`${E().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`${mt()}${e}`}}function nr(r,e){let t=r.sheet,s=!1;if(e.isOldWebKit)t&&(s=!0);else if(t)try{t.cssRules&&(s=!0)}catch(n){n.name==="NS_ERROR_DOM_SECURITY_ERR"&&(s=!0)}setTimeout(()=>{e.time+=20,s?e.success():e.timeout>e.timeout?e.error():nr(r,e)},20)}class xn{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,s){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values[t]=s),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 Pn{index;src;params;progress;constructor(e,t,s,n){this.index=e,this.src=t,this.params=s,this.progress=n}}const es=Symbol("fk"),ts=Symbol("fbk"),ss=Symbol("fepk");function Fn(r={}){const e=new Zr(r),t=new Ht,s=new Nt,n=new Cs,i={get router(){return e},get bus(){return t},get Bus(){return Ht},get EventProxy(){return Nt},get eventproxy(){return s},get EventChain(){return Ne},get Require(){return Cs},get require(){return n},get extend(){return C},get clone(){return ft},get isESModule(){return zt},install(o){o.provide(ct,e),o.provide(es,i),o.provide(ts,t),o.provide(ss,s),o.component(en,Ut),o.component(tn,Rn),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 s}}),o.config.globalProperties.$fox_on=function(a,l,u=!1){s.on(a,l,u)},o.config.globalProperties.$fox_off=function(a,l){s.off(a,l)},o.config.globalProperties.$fox_once=function(a,l){s.once(a,l)},o.config.globalProperties.$fox_all=function(...a){let l=s;Reflect.apply(l.all,l,a)},o.config.globalProperties.$fox_trigger=function(a,...l){let u=s;Reflect.apply(u.trigger,u,[a,...l])},o.config.globalProperties.$fox_emit=function(a,...l){let u=s;Reflect.apply(u.trigger,u,[a,...l])},o.mixin({computed:{$route(){return Yt(this)}}}),e.init()}};return i}function rs(r){return r?r.$router:g.inject(ct)}function Cn(r){return r||(r=g.getCurrentInstance()?.proxy??void 0),r?Yt(r):null}function An(r){return r?r.$fox:g.inject(es)}function En(r){return r?r.$bus:g.inject(ts)}function $n(r){return r?r.$eventProxy:g.inject(ss)}function _n(r){const e=rs(),t=(s,n,i)=>{try{Reflect.apply(r,{},[s,n])}catch(o){console.error(o)}i()};e.beforeEach(t),g.onUnmounted(()=>{e.removeBeforeEach(t)})}function Kn(r){const e=rs(),t=(s,n,i)=>{try{Reflect.apply(r,{},[s,n])}catch(o){console.error(o)}i()};e.afterEach(t),g.onUnmounted(()=>{e.removeAfterEach(t)})}exports.Bus=Ht;exports.EventChain=Ne;exports.EventProxy=Nt;exports.FoxBeforeEnter=Os;exports.FoxBeforeLeave=Is;exports.FoxEnter=Ms;exports.FoxLeave=Hs;exports.FoxLeaveEnd=ot;exports.OperationType=F;exports.Route=S;exports.clone=ft;exports.createFox=Fn;exports.createMemoryHistory=zs;exports.createWebHashHistory=Vs;exports.createWebHistory=Xr;exports.deleteContextValue=qr;exports.extend=C;exports.foxBusKey=ts;exports.foxEventProxyKey=ss;exports.foxKey=es;exports.injectContextValue=Qt;exports.isArray=Ot;exports.isDate=ar;exports.isESModule=zt;exports.isEqual=It;exports.isFunction=R;exports.isMap=or;exports.isNil=De;exports.isObject=As;exports.isPlainObject=Es;exports.isPromise=cr;exports.isSet=lr;exports.isString=ur;exports.isSymbol=fr;exports.onAfterRouteUpdate=Kn;exports.onBeforeRouteUpdate=_n;exports.onFoxActivated=Mr;exports.onFoxInactivated=Ir;exports.provideContextValue=jr;exports.rawState=Cr;exports.reactiveState=xr;exports.sessionKey=ne;exports.shallowReactiveState=Pr;exports.toBoolean=Wt;exports.toNumber=mr;exports.toTypeString=ut;exports.typeOf=Mt;exports.useBus=En;exports.useEventProxy=$n;exports.useFox=An;exports.useRoute=Cn;exports.useRouter=rs;
@@ -688,10 +688,6 @@ declare class Model {
688
688
  props: Record<string | number | symbol, any> | boolean | {
689
689
  (route: Route): any;
690
690
  } | undefined;
691
- /**
692
- * 元数据
693
- */
694
- meta?: Record<string | number | symbol, any>;
695
691
  /**
696
692
  * 原始组件数据
697
693
  */
@@ -706,11 +702,10 @@ declare class Model {
706
702
  * @param name
707
703
  * @param src
708
704
  * @param props
709
- * @param meta
710
705
  */
711
706
  constructor(name: string, src: any, props?: Record<string | number | symbol, any> | {
712
707
  (route: Route): any;
713
- } | boolean, meta?: Record<string | number | symbol, any>);
708
+ } | boolean);
714
709
  /**
715
710
  * 是否已经解析完成
716
711
  */
@@ -1099,9 +1094,7 @@ export declare class Route {
1099
1094
  /**
1100
1095
  * 获取匹配的元数组列表
1101
1096
  */
1102
- matched?: {
1103
- meta: Record<string | number | symbol, any>;
1104
- }[];
1097
+ matched?: Array<Route>;
1105
1098
  /**
1106
1099
  * route本身的元数据
1107
1100
  */
@@ -1243,6 +1236,11 @@ declare class RouteModel {
1243
1236
  * 名称
1244
1237
  */
1245
1238
  name?: string;
1239
+ /**
1240
+ * 元数据
1241
+ */
1242
+ meta?: Record<string | number | symbol, any>;
1243
+ matchedRoutes?: Array<Route>;
1246
1244
  /**
1247
1245
  * layer集合
1248
1246
  */
@@ -1331,7 +1329,7 @@ export declare class Router {
1331
1329
  */
1332
1330
  get currentRoute(): Readonly<Ref< {
1333
1331
  readonly path?: string | undefined;
1334
- readonly fullPath?: string;
1332
+ readonly fullPath?: string | undefined;
1335
1333
  readonly alias?: string | undefined;
1336
1334
  readonly name?: string | undefined;
1337
1335
  readonly root?: string | undefined;
@@ -1344,11 +1342,46 @@ export declare class Router {
1344
1342
  readonly traceless?: boolean | undefined;
1345
1343
  readonly template?: string | undefined;
1346
1344
  readonly matched?: readonly {
1347
- readonly meta: {
1345
+ readonly path?: string | undefined;
1346
+ readonly fullPath: string;
1347
+ readonly alias?: string | undefined;
1348
+ readonly name?: string | undefined;
1349
+ readonly root?: string | undefined;
1350
+ readonly params?: {
1348
1351
  readonly [x: string]: any;
1349
1352
  readonly [x: number]: any;
1350
1353
  readonly [x: symbol]: any;
1351
- };
1354
+ } | undefined;
1355
+ readonly query?: any;
1356
+ readonly traceless?: boolean | undefined;
1357
+ readonly template?: string | undefined;
1358
+ readonly matched?: readonly /*elided*/ any[] | undefined;
1359
+ readonly meta?: {
1360
+ readonly [x: string]: any;
1361
+ readonly [x: number]: any;
1362
+ readonly [x: symbol]: any;
1363
+ } | undefined;
1364
+ readonly success?: {
1365
+ (...arg: any[]): void;
1366
+ } | undefined;
1367
+ readonly error?: {
1368
+ (...arg: any[]): void;
1369
+ } | undefined;
1370
+ readonly destroy?: {
1371
+ (...arg: any[]): void;
1372
+ } | undefined;
1373
+ readonly opsType?: OperationType | undefined;
1374
+ readonly updateType?: UpdateType | undefined;
1375
+ readonly historyUpdatePolicy?: HistoryUpdatePolicy | undefined;
1376
+ readonly viewTagAttrs?: any;
1377
+ readonly index?: number | undefined;
1378
+ readonly active?: boolean | undefined;
1379
+ readonly slot?: {
1380
+ readonly name: string;
1381
+ readonly level: number;
1382
+ readonly rootName: string | undefined;
1383
+ readonly rootIndex: number;
1384
+ } | undefined;
1352
1385
  }[] | undefined;
1353
1386
  readonly meta?: {
1354
1387
  readonly [x: string]: any;
@@ -1378,7 +1411,7 @@ export declare class Router {
1378
1411
  } | undefined;
1379
1412
  } | null, {
1380
1413
  readonly path?: string | undefined;
1381
- readonly fullPath?: string;
1414
+ readonly fullPath?: string | undefined;
1382
1415
  readonly alias?: string | undefined;
1383
1416
  readonly name?: string | undefined;
1384
1417
  readonly root?: string | undefined;
@@ -1391,11 +1424,46 @@ export declare class Router {
1391
1424
  readonly traceless?: boolean | undefined;
1392
1425
  readonly template?: string | undefined;
1393
1426
  readonly matched?: readonly {
1394
- readonly meta: {
1427
+ readonly path?: string | undefined;
1428
+ readonly fullPath: string;
1429
+ readonly alias?: string | undefined;
1430
+ readonly name?: string | undefined;
1431
+ readonly root?: string | undefined;
1432
+ readonly params?: {
1395
1433
  readonly [x: string]: any;
1396
1434
  readonly [x: number]: any;
1397
1435
  readonly [x: symbol]: any;
1398
- };
1436
+ } | undefined;
1437
+ readonly query?: any;
1438
+ readonly traceless?: boolean | undefined;
1439
+ readonly template?: string | undefined;
1440
+ readonly matched?: readonly /*elided*/ any[] | undefined;
1441
+ readonly meta?: {
1442
+ readonly [x: string]: any;
1443
+ readonly [x: number]: any;
1444
+ readonly [x: symbol]: any;
1445
+ } | undefined;
1446
+ readonly success?: {
1447
+ (...arg: any[]): void;
1448
+ } | undefined;
1449
+ readonly error?: {
1450
+ (...arg: any[]): void;
1451
+ } | undefined;
1452
+ readonly destroy?: {
1453
+ (...arg: any[]): void;
1454
+ } | undefined;
1455
+ readonly opsType?: OperationType | undefined;
1456
+ readonly updateType?: UpdateType | undefined;
1457
+ readonly historyUpdatePolicy?: HistoryUpdatePolicy | undefined;
1458
+ readonly viewTagAttrs?: any;
1459
+ readonly index?: number | undefined;
1460
+ readonly active?: boolean | undefined;
1461
+ readonly slot?: {
1462
+ readonly name: string;
1463
+ readonly level: number;
1464
+ readonly rootName: string | undefined;
1465
+ readonly rootIndex: number;
1466
+ } | undefined;
1399
1467
  }[] | undefined;
1400
1468
  readonly meta?: {
1401
1469
  readonly [x: string]: any;