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