@fox-js/fox 3.0.1-2 → 3.0.1-21

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.
@@ -0,0 +1,3 @@
1
+ (function(g,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],w):(g=typeof globalThis<"u"?globalThis:g||self,w(g.Fox={},g.Vue))})(this,function(g,w){"use strict";/*!
2
+ * fox v3.0.0 Tue Mar 21 2023 19:14:24 GMT+0800 (China Standard Time)
3
+ */const Nr=Array.isArray,Hr=r=>He(r)==="[object Map]",Dr=r=>He(r)==="[object Set]",Br=r=>r instanceof Date,S=r=>typeof r=="function",Vr=r=>typeof r=="string",Ur=r=>typeof r=="symbol",Zt=r=>r!==null&&typeof r=="object",kr=r=>Zt(r)&&S(r.then)&&S(r.catch),Wr=Object.prototype.toString,He=r=>Wr.call(r),st=r=>He(r)==="[object Object]",zr=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function ot(r){return r.__esModule||zr&&r[Symbol.toStringTag]==="Module"}const Jr=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function j(...r){let e=r[0]!==void 0&&r[0]!==null?r[0]:{},t=1,n=r.length,i=!1;for(typeof e=="boolean"&&(i=e,e=r[t]??{},t++),typeof e!="object"&&(e={});t<n;t++)if(r[t]!==null&&r[t]!==void 0){let s=r[t];for(let o in s){let a=e[o],l=s[o];if(a!==l)if(i===!0&&l&&typeof l=="object"){let u;Array.isArray(l)?u=a&&Array.isArray(a)?a:[]:u=a&&typeof a=="object"?a:{},e[o]=j(i,u,l)}else l!==void 0&&(e[o]=l)}}return e}function xe(r,e,t=!1){if(!t)j(!0,r,e);else{if(typeof e!="object")return{};typeof r!="object"&&(r={});for(let i in e){let s=r[i],o=e[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!st(o))continue;s=xe(s,o,t),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}const n=Object.getOwnPropertySymbols(e);for(let i of n){let s=r[i],o=e[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!st(o))continue;s=xe(s,o,t),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}}return r}class ne{static seed=new Date().getTime();static get(){let e=++ne.seed;return e>=Number.MAX_VALUE&&(ne.seed=0),e}}const lt=Jr?Promise.resolve():null;function Se(r,...e){lt!==null?e&&e.length>0?lt.then(()=>{r(e)}):lt.then(r):e&&e.length>0?setTimeout(()=>{r(e)}):setTimeout(r)}function at(r){return r==null?!1:typeof r=="boolean"?r:typeof r=="string"?r.toLocaleLowerCase()==="true":Boolean(r)}function Gr(r){return typeof r=="number"?r:Number(r)}const Qr={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Object]":"object"};function ut(r){let t=Object.prototype.toString.call(r);return r==null?String(r):Qr[t]||"object"}function ft(r,e){if(r==e)return!0;if(r===void 0||e===void 0)return!1;let t=ut(r),n=ut(e);if(t!==n)return!1;if(t==="object"){let i=Object.keys(r),s=Object.keys(e);if(i.length!==s.length)return!1;for(let o=0;o<i.length;o++){let a=i[o],l=r[a],u=e[a];if(!ft(l,u))return!1}return!0}else if(t==="array"){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++){let s=r[i],o=e[i];if(!ft(s,o))return!1}return!0}return!1}const er=Symbol("idKey"),ae=Symbol("valueKey"),P=Symbol("childrenKey"),z=Symbol("growKey");class tr{[z]=!0;[er];[ae]=w.ref();[P]=new Map;constructor(e){this[er]=e}}class Xr{get(e,t){if(t=="value")return e[ae].value;if(t==="grow")return e[z];let n=e[P].get(t);if(n)return Pe(n);if(e[z])return n=ht(t),n[z]=e[z],e[P].set(t,n),Pe(n)}set(e,t,n){return t=="value"?(e[ae].value=n,!0):t==="grow"?(e[z]=at(n),!0):n==null?(e[P].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[P].delete(t),!0)}}const ct="__proxy__";function ht(r){let e=new tr(r);return Reflect.set(e,ct,new Proxy(e,new Xr)),e}function Pe(r){return Reflect.get(r,ct)}class rr extends tr{constructor(){super("__root__")}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let n=this;for(let i=0;i<t-1;i++){let s=e[i],o;n[P].has(s)?o=n[P].get(s):(o=ht(s),n[P].set(s,o)),n=o}return n[ae].value=e[t-1],!0}get(...e){let t=e.length;if(t===0)return;let n=this;for(let i=0;i<t;i++){let s=e[i];if(n[P].has(s))n=n[P].get(s);else return}return n[ae].value}remove(...e){let t=e.length;if(t==0)return!1;let n=this;for(let s=0;s<t-1;s++){let o=e[s];if(n[P].has(o))n=n[P].get(o);else return!1}let i=e[t-1];return n[P].has(i)?(n[P].delete(i),!0):!1}contains(...e){let t=e.length;if(t==0)return!1;let n=this;for(let s=0;s<t-1;s++){let o=e[s];if(n[P].has(o))n=n[P].get(o);else return!1}let i=e[t-1];return n[P].has(i)}clear(){this[P].clear()}}const Yr=["put","get","contains","remove","clear"];function nr(r){return Yr.includes(r)}class Zr{get(e,t){if(t=="value")return e[ae].value;if(t==="grow")return e[z];if(t===P)return e[P];if(typeof t=="string"&&nr(t))return e[t];let n=String(t),i=e[P].get(n);if(i)return Pe(i);if(e[z])return i=ht(n),i[z]=e[z],e[P].set(n,i),Pe(i)}set(e,t,n){return t=="value"?(e[ae].value=n,!0):t==="grow"?(e[z]=at(n),!0):nr(t)?!1:n==null?(e[P].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[P].delete(t),!0)}}function en(){let r=new rr,e=new Zr,t=new Proxy(r,e);return Object.assign({put(...i){return Reflect.apply(r.put,r,i)},get(...i){return Reflect.apply(r.get,r,i)},remove(...i){return Reflect.apply(r.remove,r,i)},contains(...i){return Reflect.apply(r.contains,r,i)},clear(){return Reflect.apply(r.clear,r,[])}},t),Reflect.set(r,ct,t),r}let dt=new Proxy(rr,{construct(r,...e){let t=en();return Pe(t)}});const Y="default",ir=Symbol("sync"),I=Symbol("resolveRoute");function sr(r){let e=!1;return function(...t){if(!e)return e=!0,Reflect.apply(r,{},t)}}function tn(r){let e=r.src;return new Promise((t,n)=>{const i=sr(a=>{ot(a)&&(a=a.default),r.component=a,console.debug("success load async module"),t()}),s=sr(a=>{console.debug("reject load async module"),n(a)});let o;try{o=e(i,s)}catch(a){s(a)}if(o)if(typeof o.then=="function")o.then(i,s);else{const a=o.component;a&&typeof a.then=="function"&&a.then(i,s)}})}class rn{name;level;rootName;rootIndex=0;constructor(e,t,n,i){this.name=e,this.level=t,this.rootName=n,this.rootIndex=i}}class De{to;routeModel;from;data={};constructor(e,t){this.to=e,this.from=t}static from(e){let t=new De(e.to,e.from),n=e.data??{};return j(!0,t.data,n),t}}class q{path;get fullPath(){const e=this.path??`/${this.name}`;return`${this.root??Y}!${e}`}alias;name;root;params;query;matched;meta;success;error;destroy;opsType;updateType;viewTagAttrs;index;active;slot;session;static clone(e,t){let n=new q;return xe(n,e,t),n}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 q;if(e==null)return t;let n=t;for(let s in e){let o=e[s];n[s]=o}const i=Object.getOwnPropertySymbols(e);if(Array.isArray(i)&&i.length>0)for(let s of i)n[s]=e[s];return t}}class nn{id;name;props;meta;src;component;constructor(e,t,n,i){this.id=ne.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=n,this.meta=i}get isResolved(){return this.component!==void 0}resolve(){return tn(this)}}class or{models=[]}class yt{path;match;redirect;name;layers=[]}const V=Symbol("chainKey"),N=Symbol("cursorKey"),mt=Symbol("$persistentModeKey"),_=Symbol("statusKey"),Z=Symbol("argsKey"),Be=Symbol("exArgsKey"),he=Symbol("successFnsKey"),Ce=Symbol("errorFnsKey"),ie=Symbol("sessionKey"),ee=Symbol("_go");class Ee{[V]=[];[N]=0;[mt]=!1;[_]="Free";[Z]=[];[Be]=[];[he]=[];[Ce]=[];[ie];get session(){return this[ie]}constructor(e,t=!1){this[ie]=e,this[mt]=t}[ee](e,...t){let n=this[_];if(this[_]="Busy",this[N]+=e,this[N]<0&&(this[N]=0),this[Z]=t,n==="Exception"||n==="Reject"){let a=[{session:this[ie]},...this[Be]];for(;this[Ce].length>0;)try{let l=this[Ce].shift();typeof l=="function"&&Se(()=>{Reflect.apply(l,{},a)})}catch(l){console.error(l.message,l)}return this[_]=n,this[V]=[],this[N]=0,this}else if(n==="Finished"||this[N]>=this[V].length){let a=[{session:this[ie]},...this[Z]];for(;this[he].length>0;){let l=this[he].shift();typeof l=="function"&&Se(()=>{Reflect.apply(l,{},a)})}return this[_]="Free",this}if(this[N]>=this[V].length)return this[_]="Free",this;let i=this[V][this[N]];this[mt]||(this[V].splice(0,this[N]+1),this[N]=-1);let s=this[N]+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[V].splice(s,0,l),s++)},session:this[ie]};Se(()=>{Reflect.apply(i,{},[a,...this[Z]])})}catch(o){this.throw(o)}return this}go(e,...t){return Reflect.apply(this[ee],this,[e,...t])}finish(...e){return this[_]="Finished",this[Z]=e,Reflect.apply(this[ee],this,[0])}reject(...e){return this[_]="Reject",this[Be]=e,Reflect.apply(this[ee],this,[0])}throw(...e){return this[_]="Exception",this[Be]=e,Reflect.apply(this[ee],this,[0])}reset(...e){this[_]="Busy",this[Z]=e,this[V]=[],this[N]=0;let n=[{session:this[ie]},...this[Z]];for(;this[he].length>0;){let i=this[he].shift();Se(()=>{Reflect.apply(i,this,n)})}return this[_]="Free",this}post(e){return this[_]==="Reject"||this[_]==="Exception"?this:(Array.isArray(e)?this[V]=[...this[V],...e]:this[V].push(e),this[_]==="Busy"?this:(Reflect.apply(this[ee],this,[0,...this[Z]]),this))}wait(e,t){return e&&typeof e=="function"&&this[he].push(e),t&&typeof t=="function"&&this[Ce].push(t),this[_]==="Busy"?this:(Reflect.apply(this[ee],this,[0,...this[Z]]),this)}exception(e){return e&&typeof e=="function"&&this[Ce].push(e),this[_]==="Busy"?this:Reflect.apply(this[ee],this,[0,...this[Z]])}isFinish(){return this[_]=="Reject"||this[_]=="Free"&&this[N]>=this[V].length}}const de=Symbol("registerKey");class sn{policy;callback;constructor(e,t){this.callback=e,this.policy=t}}class pt{[de]=new Map;constructor(){}on(e,t,n=!1){let i=this[de].get(e);i||(i=new Array,this[de].set(e,i));let s=n===!0?1:0,o=new sn(t,s);return i.push(o),this}off(e,t){if(!t)return this[de].delete(e),this;let n=this[de].get(e);if(n){for(let i=0;i<n.length;i++)if(n[i].callback===t){n.splice(i,1);break}}return this}bind(e,t,n=!1){return this.on(e,t,n)}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 n=e[t-1];if(typeof n!="function")return console.error("callback can not benn empty"),this;let i=t-1,s=new Array(i),o=[].splice.call(e,0,i);for(let a=0;a<o.length;a++)this.once(o[a],l=>{s[a]=l,i-=1,i==0&&Reflect.apply(n,{},s)});return this}emit(e,...t){let n=this[de].get(e);if(!n)return this;for(let i=0;i<n.length;){let s=n[i];if(s.policy==1?n.splice(i,1):i++,typeof s.callback=="function")try{Se(()=>{Reflect.apply(s.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 on{[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 Fe=Symbol("lc");function vt(r,e=!1){let t=r;if(Reflect.has(t,Fe))return t[Fe];if(e){const n=new on;return t[Fe]=n,n}return null}function lr(r,e){let t=r;for(;t;){if(Reflect.has(t,Fe)){const n=t[Fe];if(n.has(e))return n.get(e)}t=t.$parent}return null}function ar(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 vt(e.component.proxy,!1)}return null}const Ve=Symbol("hooksKey");function ln(r){let e=r.get(Ve);e||(e=[],r.set(Ve,e))}function ur(r,e){let t=r.get(Ve);if(t!=null)for(let n=t.length-1;n>=0;n--){let i=t[n];if(i.type===e)try{Reflect.apply(i.hook,i.target,[])}catch(s){console.error(s.message,s)}}}var gt=(r=>(r.DEACTIVATED="da",r.ACTIVATED="a",r))(gt||{});class an{type;hook;target;constructor(e,t,n){this.target=n,this.hook=t,this.type=e}}function un(r,e,t,n){let i=new an(e,t,n);return r.push(i),!0}function fn(r,e,t,n){let i=-1;for(let s=0;s<r.length;s++){let o=r[s];if(o.type===e&&o.hook===t&&o.target===n){i=s;break}}return i!=-1?(r.splice(i,1),!0):!1}function fr(r){return(e,t)=>{let n;if(t)n=t;else{let s=w.getCurrentInstance();if(s==null||s.proxy==null){console.error("can not get current instance or proxy");return}n=s.proxy}let i=lr(n,Ve);if(i==null){console.warn("can not get hooks context");return}w.onUnmounted(()=>{fn(i,r,e,n)}),un(i,r,e,n)}}let cn=fr("a"),hn=fr("da");const wt=Symbol("routeKey");function cr(r,e){r.set(wt,e)}function bt(r){let e=lr(r,wt);return typeof e=="function"?e():e??null}const Ue=Symbol("rk"),Rt=Symbol("vd"),hr=Symbol("rv"),xt=Symbol("rvi"),dr=Symbol("pv"),St=Symbol("pvi");function dn(r){for(var e=[],t=0;t<r.length;){var n=r[t];if(n==="*"||n==="+"||n==="?"){e.push({type:"MODIFIER",index:t,value:r[t++]});continue}if(n==="\\"){e.push({type:"ESCAPED_CHAR",index:t++,value:r[t++]});continue}if(n==="{"){e.push({type:"OPEN",index:t,value:r[t++]});continue}if(n==="}"){e.push({type:"CLOSE",index:t,value:r[t++]});continue}if(n===":"){for(var i="",s=t+1;s<r.length;){var o=r.charCodeAt(s);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=r[s++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(t));e.push({type:"NAME",index:t,value:i}),t=s;continue}if(n==="("){var a=1,l="",s=t+1;if(r[s]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<r.length;){if(r[s]==="\\"){l+=r[s++]+r[s++];continue}if(r[s]===")"){if(a--,a===0){s++;break}}else if(r[s]==="("&&(a++,r[s+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(s));l+=r[s++]}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=s;continue}e.push({type:"CHAR",index:t,value:r[t++]})}return e.push({type:"END",index:t,value:""}),e}function yr(r,e){e===void 0&&(e={});for(var t=dn(r),n=e.prefixes,i=n===void 0?"./":n,s="[^".concat(ye(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],Q=E.type,D=E.index;throw new TypeError("Unexpected ".concat(Q," at ").concat(D,", expected ").concat(F))},h=function(){for(var F="",C;C=f("CHAR")||f("ESCAPED_CHAR");)F+=C;return F};l<t.length;){var d=f("CHAR"),p=f("NAME"),m=f("PATTERN");if(p||m){var y=d||"";i.indexOf(y)===-1&&(u+=y,y=""),u&&(o.push(u),u=""),o.push({name:p||a++,prefix:y,suffix:"",pattern:m||s,modifier:f("MODIFIER")||""});continue}var v=d||f("ESCAPED_CHAR");if(v){u+=v;continue}u&&(o.push(u),u="");var b=f("OPEN");if(b){var y=h(),K=f("NAME")||"",x=f("PATTERN")||"",$=h();c("CLOSE"),o.push({name:K||(x?a++:""),pattern:K&&!x?s:x,prefix:y,suffix:$,modifier:f("MODIFIER")||""});continue}c("END")}return o}function yn(r,e){return mn(yr(r,e),e)}function mn(r,e){e===void 0&&(e={});var t=Pt(e),n=e.encode,i=n===void 0?function(l){return l}:n,s=e.validate,o=s===void 0?!0:s,a=r.map(function(l){if(typeof l=="object")return new RegExp("^(?:".concat(l.pattern,")$"),t)});return function(l){for(var u="",f=0;f<r.length;f++){var c=r[f];if(typeof c=="string"){u+=c;continue}var h=l?l[c.name]:void 0,d=c.modifier==="?"||c.modifier==="*",p=c.modifier==="*"||c.modifier==="+";if(Array.isArray(h)){if(!p)throw new TypeError('Expected "'.concat(c.name,'" to not repeat, but got an array'));if(h.length===0){if(d)continue;throw new TypeError('Expected "'.concat(c.name,'" to not be empty'))}for(var m=0;m<h.length;m++){var y=i(h[m],c);if(o&&!a[f].test(y))throw new TypeError('Expected all "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(y,'"'));u+=c.prefix+y+c.suffix}continue}if(typeof h=="string"||typeof h=="number"){var y=i(String(h),c);if(o&&!a[f].test(y))throw new TypeError('Expected "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(y,'"'));u+=c.prefix+y+c.suffix;continue}if(!d){var v=p?"an array":"a string";throw new TypeError('Expected "'.concat(c.name,'" to be ').concat(v))}}return u}}function pn(r,e){var t=[],n=mr(r,t,e);return vn(n,t,e)}function vn(r,e,t){t===void 0&&(t={});var n=t.decode,i=n===void 0?function(s){return s}:n;return function(s){var o=r.exec(s);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 d=e[h-1];d.modifier==="*"||d.modifier==="+"?u[d.name]=o[h].split(d.prefix+d.suffix).map(function(p){return i(p,d)}):u[d.name]=i(o[h],d)},c=1;c<o.length;c++)f(c);return{path:a,index:l,params:u}}}function ye(r){return r.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function Pt(r){return r&&r.sensitive?"":"i"}function gn(r,e){if(!e)return r;for(var t=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=t.exec(r.source);i;)e.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=t.exec(r.source);return r}function wn(r,e,t){var n=r.map(function(i){return mr(i,e,t).source});return new RegExp("(?:".concat(n.join("|"),")"),Pt(t))}function bn(r,e,t){return Rn(yr(r,t),e,t)}function Rn(r,e,t){t===void 0&&(t={});for(var n=t.strict,i=n===void 0?!1:n,s=t.start,o=s===void 0?!0:s,a=t.end,l=a===void 0?!0:a,u=t.encode,f=u===void 0?function(D){return D}:u,c=t.delimiter,h=c===void 0?"/#?":c,d=t.endsWith,p=d===void 0?"":d,m="[".concat(ye(p),"]|$"),y="[".concat(ye(h),"]"),v=o?"^":"",b=0,K=r;b<K.length;b++){var x=K[b];if(typeof x=="string")v+=ye(f(x));else{var $=ye(f(x.prefix)),F=ye(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)i||(v+="".concat(y,"?")),v+=t.endsWith?"(?=".concat(m,")"):"$";else{var E=r[r.length-1],Q=typeof E=="string"?y.indexOf(E[E.length-1])>-1:E===void 0;i||(v+="(?:".concat(y,"(?=").concat(m,"))?")),Q||(v+="(?=".concat(y,"|").concat(m,")"))}return new RegExp(v,Pt(t))}function mr(r,e,t){return r instanceof RegExp?gn(r,e):Array.isArray(r)?wn(r,e,t):bn(r,e,t)}var T=(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))(T||{}),ke=(r=>(r[r.Part=0]="Part",r[r.All=1]="All",r))(ke||{});const J=Symbol("rootKey"),G=Symbol("rootNodeKey"),ue=Symbol("parentNodeKey"),We=Symbol("nameKey");class se{instance=null;model;route;active=!0;index=0;constructor(e,t,n=0,i=!0){this.route=e,this.model=t,this.index=n,this.active=i}}class Te{_slots;get slots(){return this._slots==null&&(this._slots=w.shallowRef([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[We];[J];[G]=null;[ue]=null;get name(){return this[We]}constructor(e,t,n){this[We]=e,this[J]=t,n&&(this[G]=n)}}class U{view;index;level;constructor(e,t,n){this.view=e,this.index=t,this.level=n}static include(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(i.view===t.view&&(t.index==-1||i.index===t.index)&&i.level===t.level)return!0}return!1}}class Ct{views=[]}class xn{layers=[]}class Sn{time;route}class Pn{forbidTime=300;submitRecorder=new Sn;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 me=Symbol("_notifyChange");class pr{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}}const je=typeof window<"u",L=function(){return window},ze=function(){return window.document};function Cn(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 Et(){if(!je)return"/";let r=L().location,e=`${r.protocol}//${r.host}`;return e+=Cn(r.pathname),e}function At(r,e,t){r.addEventListener?r.addEventListener(e,t,!1):r.attachEvent?r.attachEvent(`on${e}`,t):r[`on${e}`]=t}function Ft(r,e,t){r.removeEventListener?r.removeEventListener(e,t):r.detachEvent?r.detachEvent(`on${e}`,t):r[`on${e}`]=null}const Je=Symbol("ignoreHistoryChangeOnceKey"),vr=Symbol("_navigateFirstRoute"),Ge=Symbol("_getRouteMark"),Tt=Symbol("_getUrlSearch"),jt=Symbol("_generateLocation"),_e=Symbol("_setRouteMarkRecorder"),Ke=Symbol("beforeRestoreFiltersKey"),gr=Symbol("_beforeRestore"),wr="Symbol(_fox_restore_point)";function _t(r,...e){return typeof r=="function"?Reflect.apply(r,null,[...e]):r}class br{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[Je]=!1;[Ke]=new Array;constructor(e="hash",t="",n="",i=!0,s=!0,o=!1,a){this.mode=e,this.base=t,this.query=n,this.firstNavigate=i,this.historyMonitor=s,this.traceless=o,this.storage=a??L().sessionStorage}init(e=!0){const t=L();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(this[Je]){this[Je]=!1;return}if(_t(this.historyMonitor)){const n=t.history.state;this[me](n);try{let i=[];if(typeof n=="string"?i=JSON.parse(n):i=n,Array.isArray(i)&&i.length>0){const s=this[Ge]()??"/";this[_e](s,i)}}catch{}}}),At(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[vr](),Promise.resolve()}destroy(){if(this.historyChange){const e=L();Ft(e,"popstate",this.historyChange)}}[gr](e,t,n,i){for(let s of this[Ke])try{const o=[],a=Reflect.apply(s,{},[e,t,n,i]);if(a===!1)return a}catch(o){console.error(o.message,o)}return!0}beforeRestoreEach(e){this[Ke].push(e)}removeBeforeRestoreEach(e){const t=this[Ke].indexOf(e);return t!==-1?(this[Ke].splice(t,1),!0):!1}[vr](){const e=this[Ge]()??"/",t=this.storage.getItem(wr);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)=>this[gr](l,u,e,o.routes));if(a.length>0){const l=this[Tt](),u=a.length-1;a[u].query=l||a[u].query,this[me](a);return}}}catch{}const n=e.indexOf("!");let i;n!=-1?i=e.substring(n+1):i=e;const s=new q;s.path=i,s.query=this[Tt](),this[me]([s])}[_e](e,t){try{const n={mark:e,routes:t},i=JSON.stringify(n);this.storage.setItem(wr,i)}catch(n){console.error(n.message,n)}}setRestorePoint(e){const t=this[Ge]()??"/";this[_e](t,e)}[me](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[Ge](){const e=L();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,n=t.indexOf("#");if(n!=-1)return t.substring(n+1)}return null}[Tt](){let t=L().location.search;return t.length>0&&t.indexOf("?")===0&&(t=t.substring(1)),t}listen(e){this.changeHandler=e}go(e,t=!0){const n=L();this[Je]=!t,n.history.go(e)}push(e){const t=this[jt](e.currentRoute);_t(this.traceless,e.currentRoute)||L().history.pushState(e.routes,"",t);const n=e.currentRoute.fullPath;this[_e](n,e.routes)}replace(e){const t=this[jt](e.currentRoute);_t(this.traceless,e.currentRoute)||L().history.replaceState(e.routes,"",t);const n=e.currentRoute.fullPath;this[_e](n,e.routes)}[jt](e){const t=L();let n="";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?(n=a.length>0?`${this.query}&${a}`:this.query,n.length>0&&n.charAt(0)!=="?"&&(n=`?${n}`)):a.length>0&&(n=`?${a}`)}const i=t.location;let s=e.alias??e.fullPath;s.startsWith(Y)&&(s=s.substring(Y.length+1));let o;return n?this.mode=="path"?s.indexOf("/")===0?o=`${this.base}${s}${n}`:o=`${this.base}/${s}${n}`:o=`${i.pathname}${n}#${s}`:this.mode=="path"?s.indexOf("/")===0?o=`${this.base}${s}`:o=`${this.base}/${s}`:o=`${i.pathname}#${s}`,`${i.origin}${o}`}}function En(r=!0,e=null,t="",n=!0,i=!1,s){return e!==null&&(e=L().location.pathname),e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),new br("path",e??"",t,r,n,i,s)}function Rr(r=!0,e="",t=!0,n=!1,i){return new br("hash","",e,r,t,n,i)}class An{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}[me](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!0){if(this.queue.length==0||this.cursor<=0||this.cursor>=this.queue.length-1)return;let n=this.cursor+e;if(n<0?n=0:n>this.queue.length-1&&(n=this.queue.length-1),n!=this.cursor&&(this.cursor=n,t)){const i=this.queue[n];this[me](i.routes)}}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 xr(r="",e=50){return new An(r,e)}function ui(r){}const Qe=Symbol("_constructRouteModel"),Xe=Symbol("_findRouteModel"),Kt=Symbol("_findRootView"),Sr=Symbol("_getFirstView"),fe=Symbol("_removeView"),Pr=Symbol("_buildPage"),Cr=Symbol("_resolveComponent"),Er=Symbol("_update"),oe=Symbol("_merge"),$t=Symbol("_handleHistoryChange"),Ye=Symbol("_handleRouteUpdated"),Ze=Symbol("routeUpdatedCallback"),R=Symbol("currentRoutes"),pe=Symbol("current"),Ar=Symbol("_addRouteRecorder"),$e=Symbol("_removeRouteRecorder"),et=Symbol("_cloneRouteRecorder"),O=Symbol("_handleError"),tt=Symbol("errorCallback"),k=Symbol("registerKey"),rt=Symbol("notFoundKey"),qt=Symbol("notFoundPathKey"),W=Symbol("forestKey"),A=Symbol("historyKey"),qe=Symbol("beforeFiltersKey"),Oe=Symbol("afterFiltersKey"),Le=Symbol("destroyFiltersKey"),ve=Symbol("mainDispatcherKey"),Ot=Symbol("initKey"),ce=Symbol("readyKey"),Lt=Symbol("readyHandlersKey"),nt=Symbol("_markReady"),Fr=Symbol("_createNextFn"),Mt=Symbol("_start"),It=Symbol("_before"),Nt=Symbol("_after"),Tr=Symbol("_destroy"),Ht=Symbol("_load"),Me=Symbol("_unload"),Ie=Symbol("routerGuardKey");function Fn(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(n=>{if(!(n==null||n==null))if(typeof n.meta=="object"){let i=j(!0,{},n.meta);e.push(i)}else n.meta&&e.push(n.meta)})}),e}class jn{[k]=new Array;[rt];[qt]="*";[ce]=!1;[Lt]=[];[W]=new xn;[A];[R]=new Array;[tt]=null;[Ze]=null;[qe]=new Array;[Oe]=new Array;[Le]=new Array;[ve]=new Ee;[Ie]=new Pn;[Ot]=!1;[pe]=w.ref(null);get current(){return this[pe].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]=je?Rr():xr(),this[A]?.listen(async n=>{let i=!0;try{if(typeof n=="string"){const s=this[I](n);s&&await this[$t]([s])}else await this[$t](n)}catch(s){console.error(s.message,s),i=!1}this[ce]===!1&&this[nt](i)})}[O](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[tt]=="function")try{this[tt](e,t)}catch{}console.error(e)}init(){this[Ot]!==!0&&(this[A]?.init(!this[ce]),this[Ot]=!0)}isReady(){return this[ce]?Promise.resolve():new Promise((e,t)=>{this[Lt].push([e,t])})}[nt](e){this[ce]=!0,this[Lt].forEach(([t,n])=>{try{e?t():n()}catch(i){console.error(i.message,i)}})}[$t](e){try{if(!e){let o=[...this[R]].reverse();return this[Me](o),je&&L().location.reload(),Promise.resolve()}let t=null,n=[],i=[],s=0;for(;s<e.length&&s<this[R].length&&q.isSame(e[s],this[R][s]);s++)e[s].active===!0&&e[s].active!==this[R][s].active&&(t=e[s]);if(s<e.length&&(n=e.slice(s)),s<this[R].length&&(i=this[R].slice(s).reverse()),i.length===0&&n.length===0){if(t!==null)return this.restore([t])}else if(i.length>0){if(this[Me](i)){if(n.length>0)return this.restore(n);if(t!==null)return this.restore([t])}}else return this.restore(n)}catch(t){this[O](t)}return Promise.resolve()}[Ye](e){if(e)this[pe].value=e;else{let t=this[R].length;t>0?this[pe].value=this[R][t-1]:this[pe].value=null}if(typeof this[Ze]=="function")try{this[Ze](this[pe].value)}catch{}}[Ar](e){if(e.opsType===T.Open){let t=!1;const n=this[R].length-1;for(let i=n;i>=0;i--){const s=this[R][i];if(e.root==s.root){if(e.path===s.path){this[R].splice(i,1,e),t=!0;continue}e.active&&(s.active=!1)}}t||this[R].push(e)}else this[R].push(e)}[et](){let e=[];for(let t of this[R]){let n=q.clone(t,!0);e.push(n)}return e}[$e](e){if(!this[R])return;let t=-1;for(let n=0;n<this[R].length;n++)if(q.isSame(this[R][n],e)){t=n;break}if(t!=-1){let n=this[R][t];this[R].splice(t,1),this[Tr](n,n.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}setRestorePoint(){const e=this[et]();this[A]?.setRestorePoint(e)}onRouteUpdated(e){this[Ze]=e}onError(e){this[tt]=e}beforeEach(e){this[qe].push(e)}removeBeforeEach(e){const t=this[qe].indexOf(e);return t!==-1?(this[qe].splice(t,1),!0):!1}afterEach(e){this[Oe].push(e)}removeAfterEach(e){const t=this[Oe].indexOf(e);return t!==-1?(this[Oe].splice(t,1),!0):!1}destroyEach(e){this[Le].push(e)}removeDestroyEach(e){const t=this[Le].indexOf(e);return t!==-1?(this[Le].splice(t,1),!0):!1}beforeRestoreEach(e){this[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[qt]){this.setNotFoundRoute(e);return}const n=this[Qe](e);if(t==-1)this[k]=[...this[k],...n];else for(let i=n.length-1;i>=0;i--)this[k].splice(t,0,n[i])}removeRoute(e){const t=this[I](e);if(t===null)return console.warn("route格式错误",e),!1;for(let n=0;n<this[k].length;n++){const i=this[k][n];if(t?.path&&i.path===t.path)return this[k].splice(n,1),!0;if(t?.name&&i.name===t.name)return this[k].splice(n,1),!0}return!1}hasRoute(e){const t=this[I](e);return t===null?(console.warn("route格式错误",e),!1):this[k].findIndex(i=>{if(t?.path&&i.path===t.path||t?.name&&i.name===t.name)return!0})!==-1}setNotFoundPath(e){this[qt]=e}setNotFoundRoute(e){const t=this[Qe](e);this[rt]=t[0]}getRoutes(){return[...this[k]]}[Qe](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let n=e.components??(e.component&&{"":e.component});if(n==null){const a=new yt;return a.path=t,a.redirect=e.redirect,[a]}let i=[];for(let a in n){let l=n[a];a.length===0&&(a=Y);let u=new nn(a,l,e.props,e.meta);i.push(u)}let s=!1,o=[];if(e.children)for(let a of e.children){let l=this[Qe](a);for(let u of l){let f=new yt;f.name=u.name,u.path&&u.path.length>0?t!=="/"?f.path=`${t}${u.path}`:f.path=u.path:(s=!0,f.path=t);let c=new or;c.models=[...i],f.layers=[c,...u.layers],o.push(f)}}if(!s){const a=new or;a.models=i;const l=new yt;l.name=e.name,l.path=t,l.layers=[a],o.splice(0,0,l)}return o}[Xe](e){const t=e.route;try{for(let n of this[k])if(t.path&&n.path){let i=n.match;i||(i=n.match=pn(n.path));let s=i(t.path);if(!s)continue;if(n.redirect){let o=new q;j(!0,o,t),o.path=n.redirect;let a={route:o,find:void 0};return this[Xe](a)?(e.route=a.route,e.find=a.find,!0):!1}if(t.params=t.params??{},j(!0,t.params,s.params),t.query){let o=t.query;if(typeof o=="string"){let a={},l=o.split("&");for(let u of l){let f=u.split("=");if(f.length!==2)continue;let c=decodeURIComponent(f[0].trim()),h=decodeURIComponent(f[1].trim());a[c]=h}j(!0,t.params,a)}else typeof o=="object"&&j(!0,t.params,o)}return e.find=n,!0}else if(t.name===n.name){t.params=t.params??{};let i=yn(n.path);return t.path=i(t.params),e.find=n,!0}}catch(n){console.error(n.message,n),typeof t.error=="function"&&t.error(n.message)}return!1}[I](e){let t=null;if(Array.isArray(e))if(t=new q,typeof e[0]=="object")t=q.from(e[0]);else for(let n=0;n<e.length;n++)n===0?e[n].charAt(0)==="/"?t.path=e[n]:t.name=e[n]:n===1?t.params=e[n]:n===2?t.root=e[n]:n===3&&j(!1,t,e[n]);else typeof e=="object"?t=q.from(e):typeof e=="string"&&(t=new q,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let n=t.path.indexOf("?");n!==-1&&n<t.path.length-1&&(t.query=t.path.substring(n+1),t.path=t.path.substring(0,n))}t.root=t.root??Y,t.opsType=t.opsType??this.options.defaultOperationType??T.Push}return t}push(...e){let t=this[I](e);return t?(t.opsType=t.opsType||T.Push,this.to(t)):(this[O]("resolve route fail",t),this)}put(...e){let t=this[I](e);return t?(t.opsType=T.Put,this.to(t)):(this[O]("resolve route fail",t),this)}replace(...e){let t=this[I](e);return t?(t.opsType=T.Replace,this.to(t)):(this[O]("resolve route fail",t),this)}append(...e){let t=this[I](e);return t?(t.opsType=T.Append,this.to(t)):(this[O]("resolve route fail",t),this)}remove(e){return new Promise(t=>{this[ve].post(n=>{try{if(this[R].length===0){n.resolve(),t(!1);return}let i=-1,s,o=[];if(e){if(e.root?s=e.root:s=this[R][0].root??Y,e.all)for(let l=this[R].length-1;l>0;l--){let u=this[R][l];u.opsType===T.Append&&u.root===s&&(o.splice(0,0,u),i=l-1)}else if(e.until)for(let l=this[R].length-1;l>0;l--){let u=this[R][l];if(u.opsType===T.Append&&u.root===s){if(e.until.charAt(0)==="/"&&e.until===u.path){i=l;break}else if(e.until===u.name){i=l;break}o.splice(0,0,u)}}}else{s=Y;let l=this[Sr](this[W]);l&&(s=l.name);for(let u=this[R].length-1;u>0;u--){let f=this[R][u];if(f.opsType===T.Append&&f.root===s){o.push(f),i=u-1;break}}}if(o.length===0){let l="can not find route";console.warn(l),n.resolve(l),t(!1);return}let a=0;if(this[R].forEach(l=>{l.opsType!==T.Put&&a++}),this[Me](o)){let l=0;this[R].forEach(f=>{f.opsType!==T.Put&&l++});const u=l-a;this[A]?.go(u,!1),n.resolve(),t(!0)}}catch(i){this[O](i),n.resolve(),t(!1)}})})}open(...e){let t=this[I](e);return t?(t.opsType=T.Open,this.to(t)):(this[O]("resolve route fail",t),this)}close(e){return this[ve].post(t=>{try{let n=this[I](e);if(!n){t.reject("resolve route fail");return}let i=[];for(let s=0;s<this[R].length;s++){let o=this[R][s];if(o.root===n.root){if(!n.path&&!n.name){i.push(o);continue}if(n.path&&n.path===o.path){i.push(o);break}else if(n.name&&n.name===o.name){i.push(o);break}}}if(i.length===0){t.resolve();return}this[Me](i)&&this[Ye](),t.resolve()}catch(n){this[O](n),t.resolve()}}),this}to(...e){let t=this[I](e);if(!t)return this[O]("resolve route fail",t),this;let n=this[Ie].acquire(t);return n==null?(this[O]("route forbid",t),this):(this[ve].post(i=>{try{let s=this[Mt](t);this[It](s),this[Ht](s),this[Nt](s),s.wait((o,a)=>{const l=o.session.to;try{let u=q.clone(l,!0);const f=new pr(u,this[et]());l.opsType===T.Replace?this[A]?.replace(f):this[A]?.push(f)}catch(u){console.error(u.message,u)}if(this[Ie].release(n),this[Ye](l),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(u){console.error(u.message,u)}this[ce]===!1&&this[nt](!0),i.resolve()},(o,a)=>{this[Ie].release(n),a!==null&&this[O](a,t),this[ce]===!1&&this[nt](!1),i.resolve()})}catch(s){this[Ie].release(n),this[O](s,t),i.resolve()}}),this)}back(e=1){this[A]?.go(-e)}[Fr](e){return(t,n)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(n??null);else if(t){const i=this[I](t);if(i){const s=e.session.to;i.success=s.success,i.error=s.error,e.session.to=i,e.session.redirect=!0,e.session.routeModel=null,e.resolve()}else e.session.redirect=!1,e.reject("route resolve fail")}else e.session.redirect=!1,e.resolve()}}[Mt](e){let t=this[R].length>0?this[R][0]:void 0,n=new De(e,t),i={route:e,find:null};return this[Xe](i),i.find&&(n.routeModel=i.find,e.matched=Tn(i.find),Array.isArray(e.matched)&&e.matched.length>0&&(e.meta=i.find.layers[0].models[0].meta)),new Ee(n)}[It](e){for(let t of this[qe])e.post(n=>{let i=this[Fr](n);Reflect.apply(t,{},[n.session.to,n.session.from,i,n.session])})}[Nt](e){e.post(t=>{for(let n of this[Oe])try{Reflect.apply(n,{},[t.session.to,t.session.from,t.session])}catch(i){console.error(i.message,i)}t.resolve()})}[Tr](e,t){for(let n of this[Le])try{Reflect.apply(n,{},[e,t])}catch(i){console.error(i.message,i)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[Ht](e){e.post(t=>{let n=t.session.to,i=t.session.routeModel;if(i==null){let o={route:n,find:null};if(this[Xe](o))i=o.find,t.session.routeModel=i;else if(this[rt])i=this[rt];else{t.reject(`not find route model, path:${n.path??n.name}`);return}}let s=De.from(t.session);this[Pr](n,i,s).then(o=>{this[W],t.resolve()},o=>{t.reject(o)})})}[Me](e){if(e.length==0)return!0;let t=this[W],n=[];for(let i of e){let s=this[Kt](t,i);s!=null&&n.push({...s,route:i})}if(n.length==0){let i="can not find view index";return this[O](i),!1}for(let i of n.reverse())this[fe](t,{x:i.x,y:i.y},[i.route.index??0],!0);return!0}[Kt](e,t){const n=t.root??Y;let i;for(let s=0;s<e.layers.length;s++){const o=e.layers[s];for(let a=o.views.length-1;a>=0;a--){const l=o.views[a];if(l[J]&&l[We]===n)return i={x:a,y:s},i}}return null}[Sr](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[fe](e,t,n=null,i=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let s=e.layers[t.y].views[t.x],o=!1,a=[],l=!1,u=[...s.slots.value];for(let c=u.length-1;c>=0;c--){let h=u[c];(!n||n.indexOf(h.index)!=-1)&&(h.route&&s[J]&&(this[$e](h.route),h.active===!0&&h.route.opsType==T.Append&&(l=!0)),a.push(new U(s,h.index,t.y)),u.splice(c,1))}if(u.length==0)i?s.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)}s.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 d=c.length-1;(o||a.length>0)&&d>=0;d--){let p=c[d];if(p[ue]&&(o||U.include(a,p[ue]))){let m=p.slots.value;for(let y=m.length-1;y>=0;y--){let v=m[y];v.route&&p[J]&&this[$e](v.route),h.push(new U(p,v.index,f)),m.splice(y,1)}e.layers[f].views.splice(d,1)}}a=h,e.layers[f].views.length==0&&(o=!0)}}restore(e){if(!e||this[k].length==0){let t=this[W];if(t.layers.length>0){let n=t.layers[0].views;n.length>0&&(n[0].slots.value=[])}return this[R]=[],this[Ye](),Promise.resolve()}else return new Promise((n,i)=>{let s=null,o=!1;for(let a=0;a<e.length;a++){const l=e[a];this[ve].post(u=>{const f=this[Mt](l);this[It](f),this[Ht](f),this[Nt](f),f.wait((c,h)=>{s=c.session.to,o=c.session.redirect,u.resolve()},(c,h)=>{s=null,h!==null&&this[O](h),u.resolve()})})}this[ve].post(a=>{if(s&&o===!0){const l=q.clone(s,!0),u=new pr(l,this[et]());this[A]?.replace(u)}a.resolve(),n()})})}[Pr](e,t,n){let i=e.updateType??ke.Part;return this[Cr](t).then(()=>{this[Er](t,e,n,i)})}[Cr](e){let t=[];for(let n=0;n<e.layers.length;n++){let i=e.layers[n];for(let s=0;s<i.models.length;s++){let o=i.models[s];o.isResolved||t.push(o.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[Er](e,t,n,i){if(e.layers[0].models.length!==1)return Promise.reject("illegal route structure(multi root node)");const s=e.layers[0].models[0];let o=this[W],a=Fn(o),l=t.root??Y,u;!a&&i==ke.Part&&(u=this[Kt](o,t));let f,c=0;if(u==null||u==null)if(a||i===ke.All){if(o.layers.length==0&&(o.layers[0]=new Ct),o.layers[0].views.length==0){let h=t.root??Y;f=new Te(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 Promise.reject("can not rebuild view(because not route slot)");let d=h.level;if(d>o.layers.length)return Promise.reject("can not insert view(override level)");let p;if(h.rootName){let m=o.layers[d-1];for(let y of m.views){if(y[J]&&y.name===h.rootName){p=new U(y,h.rootIndex??0,d-1);break}if(y[G]&&y[G].view.name===h.rootName&&y[G].index===h.rootIndex){p=y[G];break}}}if(!p)return Promise.reject("can not insert view(not find root node ref)");f=new Te(l,!0,p),o.layers[d].views.push(f),u={x:o.layers[d].views.length-1,y:d}}else f=o.layers[u.y].views[u.x];if(c=u.y,f[J]=!0,t.opsType===T.Append){t.index=ne.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 d=new se(t,s,t.index,!0);f.slots.value=[...h,d];let p=c+1,m=1,y=new U(f,t.index,c);this[oe](o,p,e,m,y)}else if(t.opsType===T.Open){let h=f.slots.value;const d=t.active??!0;let p=!1;for(let m of h){if(m.route!==null&&q.isSameForRouteModel(m.route,t)){if(m.active===d)return t.index=m.index,t.active=d,m.route=t,Promise.resolve();m.active=d,p=!0,t.index=m.index,t.active=d,m.route=t}else d&&(m.active=!1);m.route&&(m.route.active=m.active)}if(!p){t.index=ne.get(),t.active=d;let m=new se(t,s,t.index,d);h.push(m);let y=c+1,v=1,b=new U(f,t.index,c);this[oe](o,y,e,v,b)}f.slots.value=[...h]}else{let h=f.slots.value;if(h.length==0){t.index=ne.get(),t.active=!0,f.slots.value=[new se(t,s,t.index)];let d=c+1,p=1,m=new U(f,t.index,c);this[oe](o,d,e,p,m)}else{let d=h[0];if(d.model!==s){this[fe](o,u,null,!0),t.index=ne.get(),t.active=!0,f.slots.value=[new se(t,s,t.index)];let p=c+1,m=1,y=new U(f,t.index,c);this[oe](o,p,e,m,y)}else{d.route!==null&&this[$e](d.route);let p=!1;const m=t.active??!0;d.active!==m&&(d.active=m,p=!0),t.active=m,t.index=d.index,d.route=t;let y=[];for(let $=1;$<h.length;$++)y.push(h[$].index);y.length>0?this[fe](o,u,y,!0):p&&(f.slots.value=[...h]);let v=[new U(f,t.index,c)],b=c+1,K=1,x=new U(f,t.index,c);for(;v.length>0&&b<o.layers.length&&K<e.layers.length;b++,K++){let $=[];for(let C=0;C<o.layers[b].views.length;C++){let E=o.layers[b].views[C];E[ue]&&U.include(v,E[ue])&&$.unshift(C)}let F=[];for(let C of $){let E=o.layers[b].views[C],Q=e.layers[K].models,D;for(let B=0;B<Q.length;B++)if(E.name===Q[B].name){D=Q[B];break}if(!D)this[fe](o,{x:C,y:b},null,!1);else{let B=E.slots.value;if(B.length==0){let te=0;E.slots.value=[new se(null,D,te)];let X=b+1,re=K+1;this[oe](o,X,e,re,x)}else{let te=B[0];if(te.model!==D){this[fe](o,{x:C,y:b},null,!0),E.slots.value=[new se(null,D,0)];let X=b+1,re=K+1;this[oe](o,X,e,re,x)}else{E[J]&&te.route!==null&&this[$e](te.route);let X=[];for(let re=1;re<B.length;re++)X.push(B[re].index);X.length>0&&this[fe](o,{x:C,y:b},X,!0),F.push(new U(E,te.index,b))}}E[J]=!1}}v=F}this[oe](o,b,e,K,x)}}}if(f&&f[G]){let h=f[G];h&&(t.slot=new rn(l,c,h?.view.name,h?.index??0))}n.to=void 0,n.routeModel=void 0,t.session=n,this[Ar](t)}[oe](e,t,n,i,s){let o=i,a=t;for(;a<e.layers.length&&o<n.layers.length;a++,o++){let l=e.layers[a].views;for(let u of n.layers[o].models){let f=new Te(u.name,!1,s),c=new se(null,u);f.slots.value=[c],l.push(f)}}for(;o<n.layers.length;o++){let l=new Ct;l.views=[];for(let u of n.layers[o].models){let f=new Te(u.name,!1,s),c=new se(null,u);f.slots.value=[c],l.views.push(f)}e.layers.push(l)}}[ir](e,t,n,i,s,o){if(t<0||t>this[W].layers.length)return null;if(t<this[W].layers.length){let f=this[W].layers[t],c=null;for(let h of f.views){let d=!1;if(n!==null?(d=h.name===e&&h[G]?.view===n,d&&i!==-1&&(d=h[G]?.index===i)):d=h.name===e,!!d){s!==null&&(h[ue]={view:s,index:o,level:t-1}),c=h;break}}if(c!==null)return c}let a=null,l=null;s!==null&&(s[J]?a={view:s,index:o,level:t-1}:a=s[G],l={view:s,index:o,level:t-1});let u=new Te(e,!0,a);if(u[ue]=l,t==this[W].layers.length){let f=new Ct;f.views=[u],this[W].layers.push(f)}else this[W].layers[t].views.push(u);return u}}const _n="fox-router-view",Kn="fox-router-link";function jr(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 _r(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 $n(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 qn(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 On(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 Mn(r,e=!1){let t=null;return e?t=r.beforeShow??r.beforeEnter:t=r.beforeEnter,t}function In(r,e=!1){let t=null;return e?t=r.show??r.enter:t=r.enter,t}function Nn(r,e=!1){let t=null;return e?t=r.afterShow??r.afterEnter:t=r.afterEnter,t}function Hn(r,e=!1){let t=null;return e?t=r.showCancelled??r.enterCancelled:t=r.enterCancelled,t}function Dn(r,e=!1){let t=null;return e?t=r.hide??r.leave:t=r.leave,t}function Bn(r,e=!1){let t=null;return e?t=r.afterHide??r.afterLeave:t=r.afterLeave,t}function Vn(r,e=!1){let t=null;return e?t=r.hideCancelled??r.leaveCancelled:t=r.leaveCancelled,t}function Dt(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 ge(r,e){r.classList.contains(e)||r.classList.add(e)}function we(r,e){r.classList.remove(e)}const Un=je&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function Bt(r){Un(r)}function H(r,e,t){S(e)&&(r==null&&(r={}),Reflect.apply(e,r,t))}function Kr(r,e,t,n=-1,i,s,o,a){if(S(s)){if(i!==void 0&&i>=0){setTimeout(()=>{Reflect.apply(s,r,[e,t,n]),S(a)&&Reflect.apply(a,r,[])},i);return}const l=["animationend","transitionend"],u=f=>{l.forEach(c=>{Ft(e,c,u)}),Reflect.apply(s,r,[e,t,n]),a&&Reflect.apply(a,r,[])};l.forEach(f=>{At(e,f,u)})}if(S(o)){const l="animationcancel",u=f=>{Reflect.apply(o,r,[e,t,n]),Ft(e,l,u)};At(e,l,u)}}function Vt(r){return!je||r===null?!1:r.opsType===T.Append||r.opsType===T.Open}function $r(r,e,t,n={},i,s=-1){if(e||Vt(i)){const o=jr(n,e);o&&ge(t,o);const a=_r(n,e);a&&ge(t,a);const l=Mn(n,e);H(r,l,[t,e,i,s])}}function qr(r,e,t,n={},i,s,o,a){if(!Vt(s)&&!e){S(a)&&a(r,a,[t]);return}const l=jr(n,e),u=_r(n,e),f=$n(n,e),c=In(n,e),h=Nn(n,e),d=Hn(n,e);Bt(()=>{Kr(r,t,s,o,i,()=>{u&&we(t,u),f&&we(t,f),S(h)&&H(r,h,[t,e,s,o]),S(a)&&a(r,a,[t])},()=>{S(d)&&H(r,d,[t,e,s,o])}),l&&we(t,l),f&&ge(t,f),S(c)&&H(r,c,[t,e,s,o])})}function Or(r,e,t,n={},i,s,o,a,l){if(!Vt(o)&&!e){!e&&S(s)&&s();return}const u=qn(n,e),f=On(n,e),c=Ln(n,e),h=Dn(n,e),d=Bn(n,e),p=Vn(n,e);u&&ge(t,u),f&&ge(t,f),S(h)&&H(r,h,[t,e,o,a]),Bt(()=>{Kr(r,t,o,a,i,()=>{f&&we(t,f),c&&we(t,c),S(d)&&H(r,d,[t,e,o,a]),S(l)&&H(r,l,[t]),!e&&S(s)&&s()},()=>{S(p)&&H(r,p,[t,e,o,a]),S(l)&&H(r,l,[t]),!e&&S(s)&&s()}),u&&we(t,u),c&&ge(t,c)})}function Ut(r,e={},t,n=-1){const i=e.mode??"default",s=Dt(e);return{mode:i,persisted:!1,beforeEnter:a=>{$r(r,!1,a,e,t,n)},enter:a=>{qr(r,!1,a,e,s.enter,t,n)},leave:(a,l)=>{Or(r,!1,a,e,s.leave,l,t,n)},clone:a=>Ut(r,e,t,n)}}function Lr(r){return r.el}function kn(r,e,t={},n,i,s,o){if(s){const a=Lr(e);if(a==null)return;const l=Dt(t);$r(r,!0,a,t,n,i),qr(r,!0,a,t,l.show,n,i,u=>{S(o)&&H(r,o,[u])})}else S(o)&&H(r,o,[])}function Wn(r,e,t={},n,i,s,o){if(s){const a=Lr(e);if(a==null)return;const l=Dt(t);Or(r,!0,a,t,l.hide,null,n,i,u=>{S(o)&&H(r,o,[u])})}else S(o)&&H(r,o,[])}function zn(r,e={}){Bt(()=>{for(let t=0;t<r.length;t++)Reflect.apply(r[t],e,[])})}function le(r,e,t){return typeof r=="function"?Reflect.apply(r,{},[e,t]):r}function kt(r,e){if(!r)return null;const t=r(e);return t.length===1?t[0]:t}class Jn{node;state;constructor(e,t){this.node=e,this.state=t}}const Wt=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(r,e){const t=w.getCurrentInstance();if(t===null||t.proxy===null){console.error("instance or instance.proxy not exist");return}const n=r.multi===!0,i=w.inject(Ue,null),s=w.inject(Rt,0),o=w.inject(hr,null),a=w.inject(xt,-1);let l=null;const u=r.modelSlot;if(u){if(w.provide(Rt,s+1),w.provide(xt,u.index),w.provide(St,u.index),!u.route){console.warn("child view render error, route not exist");return}const h=vt(t.proxy,!0);ln(h),cr(h,()=>u.route??null)}else{if(i==null){console.error("router is not been injected");return}const c=r.name,h=w.inject(dr,null),d=w.inject(St,0);if(l=i[ir](c,s,o,a,h,d),l===null)return;w.provide(dr,l);const p=l[J]===!0;if(p&&w.provide(hr,l),!n&&(w.provide(xt,-1),w.provide(Rt,s+1),w.provide(St,-1),p)){const m=vt(t.proxy,!0);cr(m,()=>{const y=l.slots.value;return y.length>0?y[0].route:null})}}const f={value:new Map};return w.onUnmounted(()=>{f.value&&f.value.clear()}),()=>{if(n){const c=new Map,h=[],d=l?.slots.value,p=[];for(let v=0;v<d.length;v++){const b=d[v],K=`${r.name}_${b.index}`,x=le(r.transition,b.route,v)??!0,$={modelSlot:b};let F;e.slots.default?F=w.h(Wt,$,{default:e.slots.default}):F=w.h(Wt,$);const C={},E=le(r.viewClass,b.route,v);typeof E=="string"&&E.length>0&&(C[E]=!0);const Q=le(r.viewActiveClass,b.route,v),D=le(r.viewInactiveClass,b.route,v),B=f.value.get(K);if(typeof Q=="string"&&Q.length>0&&(C[Q]=b.active),typeof D=="string"&&D.length>0&&(C[D]=!b.active),B&&b.active!==B.state){const Re=B.node;b.active?p.unshift(()=>{const Yt=()=>{let Ne=ar(Re);Ne!=null&&ur(Ne,gt.ACTIVATED)};kn(t,Re,r,b.route,v,x,Yt)}):p.push(()=>{const Yt=()=>{const Ne=ar(Re);Ne!=null&&ur(Ne,gt.DEACTIVATED)};Wn(t,Re,r,b.route,v,x,Yt)})}const te={class:C,key:K},X=le(r.viewTagProps,b.route,v);X!==null&&typeof X=="object"&&j(!0,te,X),b.route?.viewTagAttrs&&typeof b.route?.viewTagAttrs=="object"&&j(!0,te,b.route.viewTagAttrs);const re=le(r.viewTag,b.route,v),Xt=w.h(re,te,{default:()=>[F]});if(c.set(K,new Jn(Xt,b.active)),f.value.delete(K),x){const Re=Ut(t,r,b.route,v);Xt.transition=Re}h.push(Xt)}f.value.forEach(v=>{v.node.transition=null}),f.value=c,zn(p,t);const m=le(r.tag,null,-1),y={};return Object.assign(y,e.attrs),w.h(m,y,{default:()=>h})}else if(u!=null){const c=u.model,h={};c.props&&(typeof c.props=="object"?j(!1,h,c.props):c.props===!0&&typeof u.route?.params=="object"&&j(!1,h,u.route?.params));const d=w.h(c.component,h);return kt(e.slots.default,{Component:d,route:u.route})??d}else{const c=l.slots.value;if(c.length>0){const h=c[0],d=h.route??(t.proxy&&bt(t.proxy))??null,p=h.model,m={};p.props&&(typeof p.props=="object"?j(!1,m,p.props):p.props===!0&&typeof d?.params=="object"&&j(!1,m,d?.params));const y=w.h(p.component,m);if(le(r.transition,d,-1)??!0){const b=Ut(t,r,d,-1);y.transition=b}return kt(e.slots.default,{Component:y,route:d})??y}else return kt(e.slots.fallback,{})}}}});function Gn(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 Qn(r,e){return r==null||e==null?!1:!!(r===e||r.path&&r.path===e.path||r.name&&r.name===e.name)}function Xn(r,e){return r==null||e==null?!1:!!(r.path&&e.path&&e.path.startsWith(r.path)||r.name&&r.name==e.name)}function be(r,e){return typeof r=="function"?Reflect.apply(r,{},[e]):r}let Yn=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(r,e){const t=w.inject(Ue,null);return()=>{let n=be(r.to,null),i=be(r.tag,n);if(i==null){console.warn("can not resolve link tag");return}let s=null,o=null;t!==null&&(s=t[I](n),r.root&&(s.root=r.root),o=t.current);let a={},l=be(r.activeClass,s);if(typeof l=="string"&&l.length>0&&(a[l]=Xn(s,o)),be(r.exact,s)===!0){let h=be(r.exactActiveClass,s);typeof h=="string"&&h.length>0&&(a[h]=Qn(s,o))}let f={class:a};(i==="a"||i==="A")&&(f.href=s?.path??s?.name??"#"),j(!0,f,e.attrs);let c=be(r.event,s);if(typeof c=="string"){const h=d=>{if(t==null){console.warn("router is not been injected");return}if(s==null){console.warn("route is not been resolved");return}Gn(d)&&t.to(s)};f[c]=h}return w.h(i,f,e.slots)}}});var M=(r=>(r[r.Loading=0]="Loading",r[r.Loaded=1]="Loaded",r[r.Defining=2]="Defining",r[r.Defined=3]="Defined",r))(M||{}),it=(r=>(r[r.normal=0]="normal",r[r.factory=1]="factory",r))(it||{});class Zn{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 Mr{moduleManager=new Zn;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 ze().head}constructor(){}setModule(e,t){const n={id:e,src:"",status:M.Defined};typeof t=="function"?(n.exports=t,n.type=it.factory):n.exports=t,this.moduleManager.set(e,n)}removeModule(e){this.moduleManager.remove(e)}ensure(...e){const t=[];let n=e.length-1;const i={};typeof e[n]=="object"&&(Object.assign(i,e[n]),n--);let s=null;typeof e[n]=="function"&&(s=e[n],n--);for(let l=0;l<=n;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 ei(t.length,(l,u)=>{if(o.isOK())try{typeof s=="function"&&Reflect.apply(s,{},u)}catch(f){console.error(f.message,f)}else try{console.error(l),typeof s=="function"&&Reflect.apply(s,{},[])}catch(f){console.error(f.message,f)}}),a=new Ee;for(let l=0;l<t.length;l++){const u=new ti(l,t[l],i,o);this.mount(a,u)}return this}remove(...e){let t=[],n=e.length-1,i={};typeof e[n]=="object"&&(Object.assign(i,e[n]),n--);let s=null;typeof e[n]=="function"&&(s=e[n],n--);for(let o=0;o<=n;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,i)}),typeof s=="function"&&Reflect.apply(s,{},[]),this}mount(e,t){if(t.src==="exports"){e.post(i=>{t.progress.work(!0,t.index,"exports"),i.resolve()});return}else if(t.src==="module"){e.post(i=>{t.progress.work(!0,t.index,"module"),i.resolve()});return}if(this.isNaturePath(t.src)){let i=t.params.jsPoint;i||(i=this.head),this.mountJS(e,t,i);return}else if(this.isNaturePath(t.src)){let i=t.params.cssPoint;i||(i=this.head),this.mountCSS(e,t,i);return}let n=this.getFileNamePostfix(t.src);if(n==="js"||n.length===0){let i=t.params.jsPoint;i||(i=this.head),this.mountJS(e,t,i);return}else if(n==="css"){let i=t.params.cssPoint;i||(i=this.head),this.mountCSS(e,t,i);return}}mountCSS(e,t,n){e.post(i=>{const s=t.src,o=this.moduleManager.get(s);if(o&&(o.status==M.Defined||o.status==M.Loaded)&&o.exports){o.type===it.factory&&typeof o.exports=="function"?t.progress.work(!0,t.index,o.exports()):t.progress.work(!0,t.index,o.exports),i.resolve();return}const a=ze(),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),i.resolve()},l.onerror=()=>{try{n.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),i.reject()};else{const c={timeout:this.options.timeout??3e3,time:0,success:()=>{t.progress.work(!0,t.index,t.src),i.resolve()},error:()=>{try{n.removeChild(l)}catch(h){console.error(h.message,h)}t.progress.work(!1,t.index,null),i.resolve()}};setTimeout(()=>{Ir(l,c)},1)}let f=a.getElementById(s);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=s,l.href=s,n.appendChild(l)})}mountJS(e,t,n){e.post(i=>{const s=t.src;let o=this.moduleManager.get(s);if(o&&(o.status==M.Defined||o.status==M.Loaded)){if(o.exports){o.type===it.factory&&typeof o.exports=="function"?t.progress.work(!0,t.index,o.exports()):t.progress.work(!0,t.index,o.exports),i.resolve();return}if(document.querySelector(`script[src='${s}`)){t.progress.work(!0,t.index,o.exports),i.resolve();return}}o={id:s,src:s,status:M.Loading},this.moduleManager.set(s,o);const l=ze().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,o.status==M.Loading&&(o.status=M.Loaded,t.progress.work(!0,t.index,s)),i.resolve()},l.onerror=()=>{try{n.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,this.moduleManager.remove(s),t.progress.work(!1,t.index,null),i.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,o.status==M.Loading&&(o.status=M.Loaded,t.progress.work(!0,t.index,s)),i.resolve())}}l.defer=!0,l.src=s;const f=L();f.define=this.createDefine(o,t),n.appendChild(l)})}unmount(e,t={}){const n=ze(),i=this.getFileNamePostfix(e);if(i==="js"||i.length===0){const s=n.querySelector(`script[src="${e}"]`);s&&s.parentNode&&s.parentNode.removeChild(s),this.moduleManager.remove(e);return}else if(i==="css"){const s=n.querySelector(`style[href="${e}"]`);s&&s.parentNode&&s.parentNode.removeChild(s);return}}trimEmptyElement(e){let t=[];for(let n=0;n<e.length;n++){if(e[n]===void 0||e[n]===null)continue;const i=e[n].trim();i.length!==0&&t.push(i)}return t}createDefine(e,t){const n=this,i=function(...s){e.status=M.Defining;let o,a,l,u=s.length;u===1?(l=s[0],o=void 0):u===2?(l=s[1],Array.isArray(s[0])?(a=n.trimEmptyElement(s[0]),o=void 0):a=void 0):(o=s[0],a=n.trimEmptyElement(s[1]),l=s[2]),o&&(e.id=o,n.options.alias[o]=e.src),a&&a.length>0?n.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=M.Defined,t.progress.work(!0,t.index,e.exports)}):(typeof l=="function"?e.exports=Reflect.apply(l,e,[]):e.exports=l,e.status=M.Defined,t.progress.work(!0,t.index,e.exports))};return i.amd=!0,i}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 n=this.createSearch(this.query);return e.indexOf("?")==-1?(t!=="js"&&t!=="css"&&(e+=".js"),n.length>0&&(e+=`?${n}`)):n.length>0&&(e+=`&${n}`),e}catch(t){throw console.error(`resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e){for(let n in e){let i=`${e[n]}`;t+=`${encodeURIComponent(n)}=${encodeURIComponent(i)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getFileNamePostfix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let n=e.lastIndexOf(".",t);return n==-1?"":e.substring(n+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 n=0;n<t.length;n++){const i=t[n];if(e.indexOf(i)===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`${Et()}${e.slice(1)}`;if(e.indexOf("./")==0)return`${Et()}${e.slice(2)}`;if(e.indexOf("//")==0)return`${L().location.protocol}${e}`;if(t){let i=this.options.alias[e];if(!i){let s=e.indexOf("/");if(s==-1)i=e;else{let o=e.slice(0,s),a=this.options.paths[o];a?i=a+e.slice(s):i=e}}return this.parserPath(i,!1)}return`${Et()}${e}`}}function Ir(r,e){let t=r.sheet,n=!1;if(e.isOldWebKit)t&&(n=!0);else if(t)try{t.cssRules&&(n=!0)}catch(i){i.name==="NS_ERROR_DOM_SECURITY_ERR"&&(n=!0)}setTimeout(()=>{e.time+=20,n?e.success():e.timeout>e.timeout?e.error():Ir(r,e)},20)}class ei{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,n){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values.push(n)),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(i){console.error(i.message,i)}}isOK(){return this.status}}class ti{index;src;params;progress;constructor(e,t,n,i){this.index=e,this.src=t,this.params=n,this.progress=i}}const zt=Symbol("fk"),Jt=Symbol("fbk"),Gt=Symbol("fepk");function ri(r={}){const e=new jn(r),t=new dt,n=new pt,i=new Mr,s={get router(){return e},get bus(){return t},get Bus(){return dt},get EventProxy(){return pt},get eventproxy(){return n},get EventChain(){return Ee},get Require(){return Mr},get require(){return i},get extend(){return j},get clone(){return xe},get isESModule(){return ot},install(o){o.provide(Ue,e),o.provide(zt,s),o.provide(Jt,t),o.provide(Gt,n),o.component(_n,Wt),o.component(Kn,Yn),Reflect.defineProperty(o.config.globalProperties,"$fox",{get(){return s}}),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 n}}),o.config.globalProperties.$fox_on=function(a,l,u=!1){n.on(a,l,u)},o.config.globalProperties.$fox_off=function(a,l){n.off(a,l)},o.config.globalProperties.$fox_once=function(a,l){n.once(a,l)},o.config.globalProperties.$fox_all=function(...a){let l=n;Reflect.apply(l.all,l,a)},o.config.globalProperties.$fox_trigger=function(a,...l){let u=n;Reflect.apply(u.trigger,u,[a,...l])},o.config.globalProperties.$fox_emit=function(a,...l){let u=n;Reflect.apply(u.trigger,u,[a,...l])},o.mixin({computed:{$route(){return bt(this)}}}),e.init()}};return s}function Qt(r){return r?r.$router:w.inject(Ue)}function ni(r){return r||(r=w.getCurrentInstance()?.proxy??void 0),r?bt(r):null}function ii(r){return r?r.$fox:w.inject(zt)}function si(r){return r?r.$bus:w.inject(Jt)}function oi(r){return r?r.$eventProxy:w.inject(Gt)}function li(r){const e=Qt(),t=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};e.beforeEach(t),w.onUnmounted(()=>{e.removeBeforeEach(t)})}function ai(r){const e=Qt(),t=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};e.afterEach(t),w.onUnmounted(()=>{e.removeAfterEach(t)})}const fi="";g.Bus=dt,g.EventChain=Ee,g.EventProxy=pt,g.Route=q,g.clone=xe,g.createFox=ri,g.createMemoryHistory=xr,g.createWebHashHistory=Rr,g.createWebHistory=En,g.extend=j,g.foxBusKey=Jt,g.foxEventProxyKey=Gt,g.foxKey=zt,g.isArray=Nr,g.isDate=Br,g.isESModule=ot,g.isEqual=ft,g.isFunction=S,g.isMap=Hr,g.isObject=Zt,g.isPlainObject=st,g.isPromise=kr,g.isSet=Dr,g.isString=Vr,g.isSymbol=Ur,g.onAfterRouteUpdate=ai,g.onBeforeRouteUpdate=li,g.onFoxActivated=cn,g.onFoxInactivated=hn,g.sessionKey=ie,g.toBoolean=at,g.toNumber=Gr,g.toTypeString=He,g.typeOf=ut,g.useBus=si,g.useEventProxy=oi,g.useFox=ii,g.useRoute=ni,g.useRouter=Qt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
package/libs/style.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.fox-views.fox-views-window{display:block}.fox-views.fox-views-window .fox-view{position:fixed;top:0;left:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:100}.fox-views.fox-card-views{position:relative;width:100%;height:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.fox-views.fox-card-views .fox-card-view{width:100%}.fox-views.fox-card-views .fox-card-view-active{z-index:1}.fox-views.fox-card-views .fox-card-view-inactive{display:none;z-index:0}.fox-views .fox-view-trans-enter-to{-webkit-animation:fox-view-in-slide-right .33s;animation:fox-view-in-slide-right .33s;z-index:120}.fox-views .fox-view-trans-leave-to{-webkit-animation:fox-view-out-slide-right .32s;animation:fox-view-out-slide-right .32s;z-index:120}.fox-views .fox-view-trans-show-to{-webkit-animation:fox-view-show-slide-right .3s;animation:fox-view-show-slide-right .3s;z-index:110}.fox-views .fox-view-trans-hide-to{-webkit-animation:fox-view-hide-slide-left .32s;animation:fox-view-hide-slide-left .32s;z-index:110}@-webkit-keyframes fox-view-in-slide-right{0%{-webkit-transform:translateX(103%);transform:translate(103%)}to{-webkit-transform:translateX(0%);transform:translate(0)}}@keyframes fox-view-in-slide-right{0%{-webkit-transform:translateX(103%);transform:translate(103%)}to{-webkit-transform:translateX(0%);transform:translate(0)}}@-webkit-keyframes fox-view-out-slide-right{0%{-webkit-transform:translateX(0%);transform:translate(0)}to{-webkit-transform:translateX(103%);transform:translate(103%)}}@keyframes fox-view-out-slide-right{0%{-webkit-transform:translateX(0%);transform:translate(0)}to{-webkit-transform:translateX(103%);transform:translate(103%)}}@-webkit-keyframes fox-view-hide-slide-left{0%{-webkit-transform:translateX(0%);transform:translate(0)}to{-webkit-transform:translateX(-30%);transform:translate(-30%)}}@keyframes fox-view-hide-slide-left{0%{-webkit-transform:translateX(0%);transform:translate(0)}to{-webkit-transform:translateX(-30%);transform:translate(-30%)}}@-webkit-keyframes fox-view-show-slide-right{0%{-webkit-transform:translateX(-30%);transform:translate(-30%)}to{-webkit-transform:translateX(0%);transform:translate(0)}}@keyframes fox-view-show-slide-right{0%{-webkit-transform:translateX(-30%);transform:translate(-30%)}to{-webkit-transform:translateX(0%);transform:translate(0)}}
package/package.json CHANGED
@@ -1,28 +1,39 @@
1
1
  {
2
2
  "name": "@fox-js/fox",
3
- "version": "3.0.1-2",
3
+ "version": "3.0.1-21",
4
4
  "description": "Fox Router and commons Utils",
5
5
  "author": "jiangcheng",
6
6
  "keywords": [
7
7
  "fox",
8
8
  "router",
9
9
  "vue3",
10
- "tyepscript"
10
+ "typescript"
11
11
  ],
12
- "main": "main.js",
13
- "module": "main.js",
12
+ "main": "libs/index.umd.js",
13
+ "module": "libs/index.esm.js",
14
14
  "exports": {
15
15
  ".": {
16
- "import": "./main.js"
17
- }
16
+ "import": {
17
+ "node": "./libs/index.esm.js",
18
+ "default": "./libs/index.esm.js"
19
+ },
20
+ "require": {
21
+ "node": "./libs/index.umd.js",
22
+ "default": "./libs/index.umd.js"
23
+ }
24
+ },
25
+ "./style.css": "./libs/style.css"
18
26
  },
19
- "style": "libs/index.css",
20
- "typings": "libs/index.d.ts",
27
+ "style": "libs/style.css",
28
+ "typings": "libs/index.esm.d.ts",
29
+ "files": [
30
+ "libs"
31
+ ],
21
32
  "publishConfig": {
22
33
  "access": "public"
23
34
  },
24
35
  "scripts": {
25
- "publish:next": "npm version prerelease & npm publish --tag next"
36
+ "publish:next": "npm version prerelease && npm publish --tag next"
26
37
  },
27
38
  "dependencies": {},
28
39
  "repository": ""
package/READEME.md DELETED
@@ -1,57 +0,0 @@
1
- <!--
2
- * @version: 1.0
3
- * @Author: 江成
4
- * @Date: 2021-12-19 22:08:30
5
- -->
6
-
7
- # Fox
8
-
9
- Fox Router and commons Utils
10
-
11
- ## 安装
12
-
13
- 正式版
14
-
15
- ```js
16
- npm install @fox-js/fox@next
17
- ```
18
-
19
- 测试版
20
-
21
- ```js
22
- npm install @fox-js/fox@beta
23
- ```
24
-
25
- ## 使用
26
-
27
- ```js
28
- import fox from '@fox-js/fox'
29
- ```
30
-
31
- ## 编译
32
-
33
- 开发版本
34
-
35
- ```js
36
- npm run dev
37
- ```
38
-
39
- 正式版本
40
-
41
- ```js
42
- npm run prod
43
- ```
44
-
45
- ## 发布
46
-
47
- 测试版本
48
-
49
- ```js
50
- npm run publish:beta
51
- ```
52
-
53
- 正式版本(慎重)
54
-
55
- ```js
56
- npm run publish:next
57
- ```
package/libs/index.css DELETED
@@ -1,144 +0,0 @@
1
- @charset "UTF-8";
2
- /* eslint-disable */
3
- /*views window*/
4
- .fox-views {
5
- /*卡片容器class*/
6
- }
7
- .fox-views.fox-views-window {
8
- display: block;
9
- /*view class*/
10
- }
11
- .fox-views.fox-views-window .fox-view {
12
- position: fixed;
13
- top: 0px;
14
- left: 0px;
15
- width: 100%;
16
- -webkit-box-sizing: border-box;
17
- box-sizing: border-box;
18
- z-index: 100;
19
- }
20
- .fox-views.fox-card-views {
21
- position: relative;
22
- width: 100%;
23
- height: 100%;
24
- box-sizing: border-box;
25
- /*卡片页class*/
26
- /*卡片页激活class*/
27
- /*卡片页失活class*/
28
- }
29
- .fox-views.fox-card-views .fox-card-view {
30
- width: 100%;
31
- height: 100%;
32
- }
33
- .fox-views.fox-card-views .fox-card-view-active {
34
- z-index: 1;
35
- }
36
- .fox-views.fox-card-views .fox-card-view-deactive {
37
- display: none;
38
- z-index: 0;
39
- }
40
- .fox-views .fox-view-trans-enter-to {
41
- animation: fox-view-in-slide-right 330ms;
42
- -webkit-animation: fox-view-in-slide-right 330ms;
43
- z-index: 120;
44
- }
45
- .fox-views .fox-view-trans-leave-to {
46
- animation: fox-view-out-slide-right 320ms;
47
- -webkit-animation: fox-view-out-slide-right 320ms;
48
- z-index: 120;
49
- }
50
- .fox-views .fox-view-trans-show-to {
51
- animation: fox-view-show-slide-right 300ms;
52
- -webkit-animation: fox-view-show-slide-right 300ms;
53
- z-index: 110;
54
- }
55
- .fox-views .fox-view-trans-hide-to {
56
- animation: fox-view-hide-slide-left 320ms;
57
- -webkit-animation: fox-view-hide-slide-left 320ms;
58
- z-index: 110;
59
- }
60
-
61
- /* 进场动画 */
62
- @-webkit-keyframes fox-view-in-slide-right {
63
- 0% {
64
- -webkit-transform: translateX(103%);
65
- transform: translateX(103%);
66
- }
67
- 100% {
68
- -webkit-transform: translateX(0%);
69
- transform: translateX(0%);
70
- }
71
- }
72
- @keyframes fox-view-in-slide-right {
73
- 0% {
74
- -webkit-transform: translateX(103%);
75
- transform: translateX(103%);
76
- }
77
- 100% {
78
- -webkit-transform: translateX(0%);
79
- transform: translateX(0%);
80
- }
81
- }
82
- /* 出场动画 */
83
- @-webkit-keyframes fox-view-out-slide-right {
84
- 0% {
85
- -webkit-transform: translateX(0%);
86
- transform: translateX(0%);
87
- }
88
- 100% {
89
- -webkit-transform: translateX(103%);
90
- transform: translateX(103%);
91
- }
92
- }
93
- @keyframes fox-view-out-slide-right {
94
- 0% {
95
- -webkit-transform: translateX(0%);
96
- transform: translateX(0%);
97
- }
98
- 100% {
99
- -webkit-transform: translateX(103%);
100
- transform: translateX(103%);
101
- }
102
- }
103
- /* 隐藏动画 */
104
- @-webkit-keyframes fox-view-hide-slide-left {
105
- 0% {
106
- -webkit-transform: translateX(0%);
107
- transform: translateX(0%);
108
- }
109
- 100% {
110
- -webkit-transform: translateX(-30%);
111
- transform: translateX(-30%);
112
- }
113
- }
114
- @keyframes fox-view-hide-slide-left {
115
- 0% {
116
- -webkit-transform: translateX(0%);
117
- transform: translateX(0%);
118
- }
119
- 100% {
120
- -webkit-transform: translateX(-30%);
121
- transform: translateX(-30%);
122
- }
123
- }
124
- /* 显示动画 */
125
- @-webkit-keyframes fox-view-show-slide-right {
126
- 0% {
127
- -webkit-transform: translateX(-30%);
128
- transform: translateX(-30%);
129
- }
130
- 100% {
131
- -webkit-transform: translateX(0%);
132
- transform: translateX(0%);
133
- }
134
- }
135
- @keyframes fox-view-show-slide-right {
136
- 0% {
137
- -webkit-transform: translateX(-30%);
138
- transform: translateX(-30%);
139
- }
140
- 100% {
141
- -webkit-transform: translateX(0%);
142
- transform: translateX(0%);
143
- }
144
- }
package/libs/index.js DELETED
@@ -1 +0,0 @@
1
- import{ref as e,effectScope as t,watch as r,shallowRef as n,getCurrentInstance as o,onUnmounted as s,shallowReactive as i,defineComponent as l,inject as a,provide as u,h as c}from"vue";const h=Array.isArray,f=e=>"[object Map]"===x(e),p=e=>"[object Set]"===x(e),d=e=>e instanceof Date,y=e=>"function"==typeof e,m=e=>"string"==typeof e,g=e=>"symbol"==typeof e,v=e=>null!==e&&"object"==typeof e,b=e=>v(e)&&y(e.then)&&y(e.catch),w=Object.prototype.toString,x=e=>w.call(e),S=e=>"[object Object]"===x(e),R="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function A(e){return e.__esModule||R&&"Module"===e[Symbol.toStringTag]}const C="undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]");function E(...e){let t=void 0!==e[0]&&null!==e[0]?e[0]:{},r=1,n=e.length,o=!1;for("boolean"==typeof t&&(o=t,t=e[r]??{},r++),"object"!=typeof t&&(t={});r<n;r++)if(null!==e[r]&&void 0!==e[r]){let n=e[r];for(let e in n){let r=t[e],s=n[e];if(r!==s)if(!0===o&&s&&"object"==typeof s){let n;n=Array.isArray(s)?r&&Array.isArray(r)?r:[]:r&&"object"==typeof r?r:{},t[e]=E(o,n,s)}else void 0!==s&&(t[e]=s)}}return t}function j(e,t,r=!1){if(r){if("object"!=typeof t)return{};"object"!=typeof e&&(e={});for(let n in t){let o=e[n],s=t[n];if(o!==s)if("object"==typeof s){if(!Array.isArray(s)&&!S(s))continue;o=j(o,s,r),e[n]=o}else{if("function"==typeof s)continue;e[n]=s}}const n=Object.getOwnPropertySymbols(t);for(let o of n){let n=e[o],s=t[o];if(n!==s)if("object"==typeof s){if(!Array.isArray(s)&&!S(s))continue;n=j(n,s,r),e[o]=n}else{if("function"==typeof s)continue;e[o]=s}}}else E(!0,e,t);return e}class P{static seed=(new Date).getTime();static get(){let e=++P.seed;return e>=Number.MAX_VALUE&&(P.seed=0),e}}const T=C?Promise.resolve():null;function O(e,...t){null!==T?t&&t.length>0?T.then((()=>{e(t)})):T.then(e):t&&t.length>0?setTimeout((()=>{e(t)})):setTimeout(e)}function $(e){return null!=e&&("boolean"==typeof e?e:"string"==typeof e?"true"===e.toLocaleLowerCase():Boolean(e))}function q(e){return"number"==typeof e?e:Number(e)}const F={"[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 k(e){let t=Object.prototype.toString.call(e);return null==e?String(e):F[t]||"object"}function _(e){return e&&"object"==typeof e&&"setInterval"in e}function M(e){let t=!!e&&"length"in e&&e.length,r=k(e);return"function"!==r&&!_(e)&&("array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e)}function N(e,t){let r=+t.length,n=0,o=e.length;for(;n<r;n++)e[o++]=t[n];return e.length=o,e}function K(e,t=[]){let r=t;return null!=e&&(M(Object(e))?N(r,"string"==typeof e?[e]:e):r.push(e)),r}function L(e,t,r){if(M(e))Reflect.apply([].forEach,e,[t]);else for(let n in e)if(r&&e.hasOwnProperty(n)){if(!1===Reflect.apply(t,e,[e[n]]))break}else if(!1===Reflect.apply(t,e,[e[n]]))break;return e}function I(e,t){if(e==t)return!0;if(void 0===e||void 0===t)return!1;let r=k(e);if(r!==k(t))return!1;if("object"===r){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n=0;n<r.length;n++){let o=r[n];if(!I(e[o],t[o]))return!1}return!0}if("array"===r){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){if(!I(e[r],t[r]))return!1}return!0}return!1}const D=Symbol("idKey"),H=Symbol("valueKey"),U=Symbol("childrenKey"),B=Symbol("growKey");class W{[B]=!0;[D];[H]=e();[U]=new Map;constructor(e){this[D]=e}}class V{get(e,t){if("value"==t)return e[H].value;if("grow"===t)return e[B];let r=e[U].get(t);return r?z(r):e[B]?(r=J(t),r[B]=e[B],e[U].set(t,r),z(r)):void 0}set(e,t,r){return"value"==t?(e[H].value=r,!0):"grow"===t?(e[B]=$(r),!0):null==r?(e[U].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return"value"===t||"grow"==t?(console.error(`can not delete property:${String(t)}`),!1):(e[U].delete(t),!0)}}function J(e){let t=new W(e);return Reflect.set(t,"__proxy__",new Proxy(t,new V)),t}function z(e){return Reflect.get(e,"__proxy__")}class G extends W{constructor(){super("__root__")}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 t,o=e[n];r[U].has(o)?t=r[U].get(o):(t=J(o),r[U].set(o,t)),r=t}return r[H].value=e[t-1],!0}get(...e){let t=e.length;if(0===t)return;let r=this;for(let n=0;n<t;n++){let t=e[n];if(!r[U].has(t))return;r=r[U].get(t)}return r[H].value}remove(...e){let t=e.length;if(0==t)return!1;let r=this;for(let n=0;n<t-1;n++){let t=e[n];if(!r[U].has(t))return!1;r=r[U].get(t)}let n=e[t-1];return!!r[U].has(n)&&(r[U].delete(n),!0)}contains(...e){let t=e.length;if(0==t)return!1;let r=this;for(let n=0;n<t-1;n++){let t=e[n];if(!r[U].has(t))return!1;r=r[U].get(t)}let n=e[t-1];return r[U].has(n)}clear(){this[U].clear()}}const X=["put","get","contains","remove","clear"];function Y(e){return X.includes(e)}class Q{get(e,t){if("value"==t)return e[H].value;if("grow"===t)return e[B];if(t===U)return e[U];if("string"==typeof t&&Y(t))return e[t];let r=String(t),n=e[U].get(r);return n?z(n):e[B]?(n=J(r),n[B]=e[B],e[U].set(r,n),z(n)):void 0}set(e,t,r){return"value"==t?(e[H].value=r,!0):"grow"===t?(e[B]=$(r),!0):!Y(t)&&(null==r?(e[U].delete(t),!0):(console.error(`illegal property:${t}`),!1))}deleteProperty(e,t){return"value"===t||"grow"==t?(console.error(`can not delete property:${String(t)}`),!1):(e[U].delete(t),!0)}}let Z=new Proxy(G,{construct:(e,...t)=>z(function(){let e=new G,t=new Q,r=new Proxy(e,t),n={put:(...t)=>Reflect.apply(e.put,e,t),get:(...t)=>Reflect.apply(e.get,e,t),remove:(...t)=>Reflect.apply(e.remove,e,t),contains:(...t)=>Reflect.apply(e.contains,e,t),clear:()=>Reflect.apply(e.clear,e,[])};return Object.assign(n,r),Reflect.set(e,"__proxy__",r),e}())});function ee(e,t){void 0===t&&(t={});for(var r=function(e){for(var t=[],r=0;r<e.length;){var n=e[r];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)t.push({type:"CHAR",index:r,value:e[r++]});else{var o=1,s="";if("?"===e[l=r+1])throw new TypeError('Pattern cannot start with "?" at '.concat(l));for(;l<e.length;)if("\\"!==e[l]){if(")"===e[l]){if(0==--o){l++;break}}else if("("===e[l]&&(o++,"?"!==e[l+1]))throw new TypeError("Capturing groups are not allowed at ".concat(l));s+=e[l++]}else s+=e[l++]+e[l++];if(o)throw new TypeError("Unbalanced pattern at ".concat(r));if(!s)throw new TypeError("Missing pattern at ".concat(r));t.push({type:"PATTERN",index:r,value:s}),r=l}else{for(var i="",l=r+1;l<e.length;){var a=e.charCodeAt(l);if(!(a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||95===a))break;i+=e[l++]}if(!i)throw new TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:i}),r=l}else t.push({type:"CLOSE",index:r,value:e[r++]});else t.push({type:"OPEN",index:r,value:e[r++]});else t.push({type:"ESCAPED_CHAR",index:r++,value:e[r++]});else t.push({type:"MODIFIER",index:r,value:e[r++]})}return t.push({type:"END",index:r,value:""}),t}(e),n=t.prefixes,o=void 0===n?"./":n,s="[^".concat(ne(t.delimiter||"/#?"),"]+?"),i=[],l=0,a=0,u="",c=function(e){if(a<r.length&&r[a].type===e)return r[a++].value},h=function(e){var t=c(e);if(void 0!==t)return t;var n=r[a],o=n.type,s=n.index;throw new TypeError("Unexpected ".concat(o," at ").concat(s,", expected ").concat(e))},f=function(){for(var e,t="";e=c("CHAR")||c("ESCAPED_CHAR");)t+=e;return t};a<r.length;){var p=c("CHAR"),d=c("NAME"),y=c("PATTERN");if(d||y){var m=p||"";-1===o.indexOf(m)&&(u+=m,m=""),u&&(i.push(u),u=""),i.push({name:d||l++,prefix:m,suffix:"",pattern:y||s,modifier:c("MODIFIER")||""})}else{var g=p||c("ESCAPED_CHAR");if(g)u+=g;else if(u&&(i.push(u),u=""),c("OPEN")){m=f();var v=c("NAME")||"",b=c("PATTERN")||"",w=f();h("CLOSE"),i.push({name:v||(b?l++:""),pattern:v&&!b?s:b,prefix:m,suffix:w,modifier:c("MODIFIER")||""})}else h("END")}}return i}function te(e,t){return function(e,t){void 0===t&&(t={});var r=oe(t),n=t.encode,o=void 0===n?function(e){return e}:n,s=t.validate,i=void 0===s||s,l=e.map((function(e){if("object"==typeof e)return new RegExp("^(?:".concat(e.pattern,")$"),r)}));return function(t){for(var r="",n=0;n<e.length;n++){var s=e[n];if("string"!=typeof s){var a=t?t[s.name]:void 0,u="?"===s.modifier||"*"===s.modifier,c="*"===s.modifier||"+"===s.modifier;if(Array.isArray(a)){if(!c)throw new TypeError('Expected "'.concat(s.name,'" to not repeat, but got an array'));if(0===a.length){if(u)continue;throw new TypeError('Expected "'.concat(s.name,'" to not be empty'))}for(var h=0;h<a.length;h++){var f=o(a[h],s);if(i&&!l[n].test(f))throw new TypeError('Expected all "'.concat(s.name,'" to match "').concat(s.pattern,'", but got "').concat(f,'"'));r+=s.prefix+f+s.suffix}}else if("string"!=typeof a&&"number"!=typeof a){if(!u){var p=c?"an array":"a string";throw new TypeError('Expected "'.concat(s.name,'" to be ').concat(p))}}else{f=o(String(a),s);if(i&&!l[n].test(f))throw new TypeError('Expected "'.concat(s.name,'" to match "').concat(s.pattern,'", but got "').concat(f,'"'));r+=s.prefix+f+s.suffix}}else r+=s}return r}}(ee(e,t),t)}function re(e,t){var r=[];return function(e,t,r){void 0===r&&(r={});var n=r.decode,o=void 0===n?function(e){return e}:n;return function(r){var n=e.exec(r);if(!n)return!1;for(var s=n[0],i=n.index,l=Object.create(null),a=function(e){if(void 0===n[e])return"continue";var r=t[e-1];"*"===r.modifier||"+"===r.modifier?l[r.name]=n[e].split(r.prefix+r.suffix).map((function(e){return o(e,r)})):l[r.name]=o(n[e],r)},u=1;u<n.length;u++)a(u);return{path:s,index:i,params:l}}}(ie(e,r,t),r,t)}function ne(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function oe(e){return e&&e.sensitive?"":"i"}function se(e,t,r){return function(e,t,r){void 0===r&&(r={});for(var n=r.strict,o=void 0!==n&&n,s=r.start,i=void 0===s||s,l=r.end,a=void 0===l||l,u=r.encode,c=void 0===u?function(e){return e}:u,h=r.delimiter,f=void 0===h?"/#?":h,p=r.endsWith,d="[".concat(ne(void 0===p?"":p),"]|$"),y="[".concat(ne(f),"]"),m=i?"^":"",g=0,v=e;g<v.length;g++){var b=v[g];if("string"==typeof b)m+=ne(c(b));else{var w=ne(c(b.prefix)),x=ne(c(b.suffix));if(b.pattern)if(t&&t.push(b),w||x)if("+"===b.modifier||"*"===b.modifier){var S="*"===b.modifier?"?":"";m+="(?:".concat(w,"((?:").concat(b.pattern,")(?:").concat(x).concat(w,"(?:").concat(b.pattern,"))*)").concat(x,")").concat(S)}else m+="(?:".concat(w,"(").concat(b.pattern,")").concat(x,")").concat(b.modifier);else"+"===b.modifier||"*"===b.modifier?m+="((?:".concat(b.pattern,")").concat(b.modifier,")"):m+="(".concat(b.pattern,")").concat(b.modifier);else m+="(?:".concat(w).concat(x,")").concat(b.modifier)}}if(a)o||(m+="".concat(y,"?")),m+=r.endsWith?"(?=".concat(d,")"):"$";else{var R=e[e.length-1],A="string"==typeof R?y.indexOf(R[R.length-1])>-1:void 0===R;o||(m+="(?:".concat(y,"(?=").concat(d,"))?")),A||(m+="(?=".concat(y,"|").concat(d,")"))}return new RegExp(m,oe(r))}(ee(e,r),t,r)}function ie(e,t,r){return e instanceof RegExp?function(e,t){if(!t)return e;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,o=r.exec(e.source);o;)t.push({name:o[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),o=r.exec(e.source);return e}(e,t):Array.isArray(e)?function(e,t,r){var n=e.map((function(e){return ie(e,t,r).source}));return new RegExp("(?:".concat(n.join("|"),")"),oe(r))}(e,t,r):se(e,t,r)}const le=Symbol("sync"),ae=Symbol("resolveRoute");function ue(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}class ce{name;level;rootName;rootIndex=0;constructor(e,t,r,n){this.name=e,this.level=t,this.rootName=r,this.rootIndex=n}}class he{to;routeModel;from;data={};constructor(e,t){this.to=e,this.from=t}static from(e){let t=new he(e.to,e.from),r=e.data??{};return E(!0,t.data,r),t}}class fe{path;get fullPath(){let e=this.path??`/${this.name}`;return`${this.root??"default"}!${e}`}name;root;params;query;matched;meta;success;error;destroy;opsType;updateType;viewTagAttrs;index;active;slot;session;static clone(e,t){let r=new fe;return j(r,e,t),r}static isSame(e,t){return e===t||null!=e&&null!=t&&((!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||null!=e&&null!=t&&((!e.path||e.path==t.path)&&(!e.name||e.name==t.name))}static from(e){let t=new fe;if(null==e)return t;let r=t;for(let t in e){let n=e[t];r[t]=n}const n=Object.getOwnPropertySymbols(e);if(Array.isArray(n)&&n.length>0)for(let t of n)r[t]=e[t];return t}}class pe{id;name;props;meta;src;component;constructor(e,t,r,n){this.id=P.get(),this.name=e,this.src=t,"function"!=typeof t&&(this.component=t),this.props=r,this.meta=n}get isResolved(){return void 0!==this.component}resolve(){return function(e){let t=e.src;return new Promise(((r,n)=>{const o=ue((t=>{A(t)&&(t=t.default),e.component=t,console.debug("success load async module"),r()})),s=ue((e=>{console.debug("reject load async module"),n(e)}));let i;try{i=t(o,s)}catch(e){s(e)}if(i)if("function"==typeof i.then)i.then(o,s);else{const e=i.component;e&&"function"==typeof e.then&&e.then(o,s)}}))}(this)}}class de{models=[]}class ye{path;match;redirect;name;layers=[]}var me=(e=>(e[e.Push=0]="Push",e[e.Replace=1]="Replace",e[e.Put=2]="Put",e[e.Append=3]="Append",e[e.Open=4]="Open",e))(me||{}),ge=(e=>(e[e.Part=0]="Part",e[e.All=1]="All",e))(ge||{});const ve=Symbol("rootKey"),be=Symbol("rootNodeKey"),we=Symbol("parentNodeKey"),xe=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 Re{scope=null;set compensation(e){null!==this.scope&&this.scope.stop(),this.scope=t(),this.scope.run((()=>{r(this.slots,(()=>{let t=!1;try{t=e()}catch(e){console.error(e)}t&&null!==this.scope&&(this.scope.stop(),this.scope=null)}))}))}_slots;get slots(){return null==this._slots&&(this._slots=n([])),this._slots}get empty(){return null==this._slots||0==this._slots.value.length}[xe];[ve];[be]=null;[we]=null;get name(){return this[xe]}constructor(e,t,r){this[xe]=e,this[ve]=t,r&&(this[be]=r)}}class Ae{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&&(-1==t.index||n.index===t.index)&&n.level===t.level)return!0}return!1}}class Ce{views=[]}class Ee{layers=[]}class je{time;route}class Pe{forbidTime=300;submitRecorder=new je;isSameRoute(e,t){return null!=e&&null!=t&&(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))return this.submitRecorder.route=e,this.submitRecorder.time=t,t;this.submitRecorder.time=t}release(e){this.submitRecorder.time===e&&(this.submitRecorder.route=void 0)}}const Te=void 0!==typeof window,Oe=window,$e=window.document;function qe(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function Fe(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}let ke=function(){let e=Oe.location,t=`${e.protocol}//${e.host}`;return t+=function(e){let t=e,r=t.lastIndexOf("/");return r>0&&r<t.length-1?t=t.substring(0,r+1):0===r&&-1!==t.indexOf(".")?t="/":-1===r&&(t=-1==t.indexOf(".")?`/${t}/`:"/"),0!==t.indexOf("/")&&(t=`/${t}`),t}(e.pathname),t}();const _e={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",keepalive:!0},Me=new Map;async function Ne(e){let{id:t,method:r="POST",url:n,headers:o={},data:s,processData:i=!0,timeout:l=-1}=e;if(t&&Me.has(t))throw new Error("resubmit");r=r.toUpperCase();let{contentType:a="application/json; charset=UTF-8"}=o,u=E(!0,{..._e},{method:r,headers:o});if("GET"===r?n=function(e,t,r="text"){if(null==t)return e;let n="";if(0===(r=r.trim().toLowerCase()).indexOf("application/x-www-form-urlencoded")||0===r.indexOf("application/json"))if("object"==typeof t)for(let e in t){let r=t[e];if(Array.isArray(r))for(let t=0;t<r.length;t++){let o=`${encodeURIComponent(e)}=${encodeURIComponent(r[t])}`;n.length>0&&(n+="&"),n+=o}else{let t=`${encodeURIComponent(e)}=${encodeURIComponent(r)}`;n.length>0&&(n+="&"),n+=t}}else n=t;else n=t;return n.length>0&&(e=-1===e.indexOf("?")?`${e}?${n}`:`${e}&${n}`),e}(n,s,a):(i&&(s=function(e,t="text"){let r="";if(0===(t=t.trim().toLowerCase()).indexOf("application/x-www-form-urlencoded"))if("object"==typeof e)for(let t in e){let n=e[t];if(Array.isArray(n))for(let e=0;e<n.length;e++){let o=`${encodeURIComponent(t)}=${encodeURIComponent(n[e])}`;r.length>0&&(r+="&"),r+=o}else{let e=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;r.length>0&&(r+="&"),r+=e}}else r=e;else r=0===t.indexOf("text")?"object"==typeof e?JSON.stringify(e):e:0===t.indexOf("application/json")&&"object"==typeof e?JSON.stringify(e):e;return r}(s,a)),u.body=s),t||l>0){t||(t=`fetch_${P.get()}`);const e=new AbortController;u.signal=e.signal;let r={timer:null,controller:e};if(l>0){const e=setTimeout((()=>{r.timer&&r.controller.abort()}),l);r.timer=e}Me.set(t,r)}try{let e,r=await fetch(n,u),o={};r.headers.forEach(((e,t)=>{o[e]=t}));let s=o["content-type"]??"";return e=-1!==s.indexOf("application/json")?await r.json():-1!=s.indexOf("text")?await r.text():await r.blob(),{ok:r.ok,status:r.status,statusText:r.statusText,headers:o,data:e,response:r}}catch(e){throw e}finally{if(t){let e=Me.get(t);e&&(e.timer&&(clearTimeout(e.timer),e.timer=null),Me.delete(t))}}}function Ke(e){let t=Me.get(e);return!!t&&(t.timer&&(clearTimeout(t.timer),t.timer=null),t.controller.abort(),Me.delete(e),!0)}class Le{cache=new Map;constructor(){}async get(e,t=-1){if(this.cache.has(e)){return this.cache.get(e)}let r=await Ne({url:e,method:"GET",timeout:t,heaaders:{"content-type":"text/plain"}});if(r.ok)return this.cache.set(e,r.data),r.data;throw Error(r.statusText)}remove(e){this.cache.delete(e)}}var Ie=(e=>(e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Defining=2]="Defining",e[e.Defined=3]="Defined",e))(Ie||{});class De{exports;status;id;src}class He{register=new Map;constructor(){}get(e){return this.register.get(e)}put(e,t){this.register.set(e,t)}remove(e){let t=this.register.get(e);return this.register.delete(e),t}contains(e){return this.register.has(e)}clear(){this.register.clear()}}const Ue=Symbol("chainKey"),Be=Symbol("cursorKey"),We=Symbol("$persistentModeKey"),Ve=Symbol("statusKey"),Je=Symbol("argsKey"),ze=Symbol("exArgsKey"),Ge=Symbol("successFnsKey"),Xe=Symbol("errorFnsKey"),Ye=Symbol("sessionKey"),Qe=Symbol("_go");class Ze{[Ue]=[];[Be]=0;[We]=!1;[Ve]="Free";[Je]=[];[ze]=[];[Ge]=[];[Xe]=[];[Ye];get session(){return this[Ye]}constructor(e,t=!1){this[Ye]=e,this[We]=t}[Qe](e,...t){let r=this[Ve];if(this[Ve]="Busy",this[Be]+=e,this[Be]<0&&(this[Be]=0),this[Je]=t,"Exception"===r||"Reject"===r){let e=[{session:this[Ye]},...this[ze]];for(;this[Xe].length>0;)try{let t=this[Xe].shift();"function"==typeof t&&O((()=>{Reflect.apply(t,{},e)}))}catch(e){console.error(e.message,e)}return this[Ve]=r,this[Ue]=[],this[Be]=0,this}if("Finished"===r||this[Be]>=this[Ue].length){let e=[{session:this[Ye]},...this[Je]];for(;this[Ge].length>0;){let t=this[Ge].shift();"function"==typeof t&&O((()=>{Reflect.apply(t,{},e)}))}return this[Ve]="Free",this}if(this[Be]>=this[Ue].length)return this[Ve]="Free",this;let n=this[Ue][this[Be]];this[We]||(this[Ue].splice(0,this[Be]+1),this[Be]=-1);let o=this[Be]+1;try{let e=!1,t={go:(t,...r)=>{e||(e=!0,Reflect.apply(this[Qe],this,[t,...r]))},resolve:(...t)=>{e||(e=!0,Reflect.apply(this[Qe],this,[1,...t]))},reject:(...t)=>{e||(e=!0,Reflect.apply(this.reject,this,[...t]))},insert:t=>{e||(this[Ue].splice(o,0,t),o++)},session:this[Ye]};O((()=>{Reflect.apply(n,{},[t,...this[Je]])}))}catch(e){this.throw(e)}return this}go(e,...t){return Reflect.apply(this[Qe],this,[e,...t])}finish(...e){return this[Ve]="Finished",this[Je]=e,Reflect.apply(this[Qe],this,[0])}reject(...e){return this[Ve]="Reject",this[ze]=e,Reflect.apply(this[Qe],this,[0])}throw(...e){return this[Ve]="Exception",this[ze]=e,Reflect.apply(this[Qe],this,[0])}reset(...e){this[Ve]="Busy",this[Je]=e,this[Ue]=[],this[Be]=0;let t=[{session:this[Ye]},...this[Je]];for(;this[Ge].length>0;){let e=this[Ge].shift();O((()=>{Reflect.apply(e,this,t)}))}return this[Ve]="Free",this}post(e){return"Reject"===this[Ve]||"Exception"===this[Ve]?this:(Array.isArray(e)?this[Ue]=[...this[Ue],...e]:this[Ue].push(e),"Busy"===this[Ve]||Reflect.apply(this[Qe],this,[0,...this[Je]]),this)}wait(e,t){return e&&"function"==typeof e&&this[Ge].push(e),t&&"function"==typeof t&&this[Xe].push(t),"Busy"===this[Ve]||Reflect.apply(this[Qe],this,[0,...this[Je]]),this}exception(e){return e&&"function"==typeof e&&this[Xe].push(e),"Busy"===this[Ve]?this:Reflect.apply(this[Qe],this,[0,...this[Je]])}isFinish(){return"Reject"==this[Ve]||"Free"==this[Ve]&&this[Be]>=this[Ue].length}}class et{head;isOldWebKit;moduleManager=new He;resource=new Le;options;_query;set query(e){this._query=e}get query(){return this._query}constructor(e={}){this.head=$e.head||$e.getElementsByTagName("head")[0]||$e.documentElement,this.isOldWebKit=+navigator.userAgent.replace(/.*(?:AppleWebKit|AndroidWebKit)\/(\d+).*/,"$1")<536,this.options=e,this.options.paths||(this.options.paths={}),this.options.alias||(this.options.alias={})}ensure(...e){let t=[],r=e.length-1,n={};"object"==typeof e[r]&&(Object.assign(n,e[r]),r--);let o=null;"function"==typeof e[r]&&(o=e[r],r--);for(let n=0;n<=r;n++)if(Array.isArray(e[n])){let r=e[n];for(let e=0;e<r.length;e++)void 0!==r[e]&&t.push(this.resolvePath(r[e]))}else{let r=e[n].split(",");for(let e=0;e<r.length;e++)void 0!==r[e]&&t.push(this.resolvePath(r[e]))}let s=new rt(t.length,((e,t)=>{if(s.isOK())try{"function"==typeof o&&Reflect.apply(o,{},t)}catch(e){console.error(e.message,e)}else try{console.error(e),"function"==typeof o&&Reflect.apply(o,{},[])}catch(e){console.error(e.message,e)}})),i=new Ze;for(let e=0;e<t.length;e++){let r=new nt(e,t[e],n,s);this.mount(i,r)}return this}remove(...e){let t=[],r=e.length-1,n={};"object"==typeof e[r]&&(Object.assign(n,e[r]),r--);let o=null;"function"==typeof e[r]&&(o=e[r],r--);for(let n=0;n<=r;n++)if(Array.isArray(e[n])){let r=e[n];for(let e=0;e<r.length;e++)void 0!==r[e]&&t.push(this.resolvePath(r[e]))}else{let r=e[n].split(",");for(let e=0;e<r.length;e++)void 0!==r[e]&&t.push(this.resolvePath(r[e]))}return t.forEach((e=>{this.unmount(e,n)})),"function"==typeof o&&Reflect.apply(o,{},[]),this}mount(e,t){if(this.isNaturePath(t.src,"js")){let r=t.params.jsPoint;return r||(r=this.head),void this.mountJS(e,t,r)}if(this.isNaturePath(t.src,"css")){let r=t.params.cssPoint;return r||(r=this.head),void this.mountCSS(e,t,r)}if(this.isNaturePath(t.src,"html")){let r=t.params.htmlPoint;return r||(r=$e.body),void this.mountHTML(e,t,r)}let r=this.getFileNamePostfix(t.src);if("js"===r||0===r.length){let r=t.params.jsPoint;return r||(r=this.head),void this.mountJS(e,t,r)}if("css"===r){let r=t.params.cssPoint;return r||(r=this.head),void this.mountCSS(e,t,r)}{let r=t.params.htmlPoint;return r||(r=$e.body),void this.mountHTML(e,t,r)}}mountHTML(e,t,r){e.post((e=>{let n=t.params.timeout??this.options.timeout??3e4,o=t.src;this.resource.get(o,n).then((n=>{r.innerHTML=n,t.progress.work(!0,t.index,n),e.resolve()}),(r=>{console.error(r),t.progress.work(!1,t.index,null),e.reject()}))}))}mountCSS(e,t,r){e.post((e=>{let n=t.src,o=$e.createElement("link"),s="onload"in o;if(this.isOldWebKit||!s){let n={timeout:this.options.time||3e3,time:0,isOldWebKit:this.isOldWebKit,success:()=>{t.progress.work(!0,t.index,t.src),e.resolve()},error:()=>{try{r.removeChild(o)}catch(e){console.error(e.message,e)}t.progress.work(!1,t.index,null),e.resolve()}};setTimeout((()=>{tt(o,n)}),1)}else o.onload=()=>{o.onload=o.onerror=null,t.progress.work(!0,t.index,t.src),e.resolve()},o.onerror=()=>{try{r.removeChild(o)}catch(e){console.error(e.message,e)}o.onload=o.onerror=null,t.progress.work(!1,t.index,null),e.reject()};let i=$e.getElementById(n);i&&i.parentNode&&i.parentNode.removeChild(i),o.rel="stylesheet",o.type="text/css",o.id=n,o.href=n,r.appendChild(o)}))}mountJS(e,t,r){e.post((e=>{let n=t.src,o=this.moduleManager.get(n);if(o&&(o.status==Ie.Defined||o.status==Ie.Loaded)){if(o.exports)return t.progress.work(!0,t.index,o.exports),void e.resolve();if(document.querySelector(`script[src='${n}`))return t.progress.work(!0,t.index,o.exports),void e.resolve()}o=new De,o.id=n,o.src=n,o.status=Ie.Loading,this.moduleManager.put(n,o);let s=$e.createElement("script");if("onload"in s)s.onload=()=>{s.onload=s.onerror=null,o.status==Ie.Loading&&(o.status=Ie.Loaded,t.progress.work(!0,t.index,n)),e.resolve()},s.onerror=()=>{try{r.removeChild(s)}catch(e){console.error(e.message,e)}s.onload=s.onerror=null,t.progress.work(!1,t.index,null),e.reject()};else{let r=s;r.onreadystatechange=()=>{/loaded|complete/.test(r.readyState)&&(r.onreadystatechange=null,o.status==Ie.Loading&&(o.status=Ie.Loaded,t.progress.work(!0,t.index,n)),e.resolve())}}s.defer=!0,s.src=n,Oe.define=this.createDefine(o,t),r.appendChild(s)}))}unmount(e,t={}){let r=this.getFileNamePostfix(e);if("js"===r||0===r.length){let t=$e.querySelector(`script[src="${e}"]`);return t&&t.parentNode&&t.parentNode.removeChild(t),void this.moduleManager.remove(e)}if("css"!==r){this.resource.remove(e);let r=t.htmlPoint;return r||(r=$e.body),void(r.innerHTML="")}{let t=$e.querySelector(`style[href="${e}"]`);t&&t.parentNode&&t.parentNode.removeChild(t)}}trimEmptyElement(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r].trim();0!==n.length&&t.push(n)}return t}createDefine(e,t){let r=this,n=function(...n){let o,s,i;e.status=Ie.Defining;let l=n.length;1===l?(i=n[0],o=void 0):2===l?(i=n[1],Array.isArray(n[0])?(s=r.trimEmptyElement(n[0]),o=void 0):s=void 0):(o=n[0],s=r.trimEmptyElement(n[1]),i=n[2]),o&&(e.id=o,r.options.alias[o]=e.src),s&&s.length>0?r.ensure(s,((...r)=>{e.exports="function"==typeof i?Reflect.apply(i,e,r):i,e.status=Ie.Defined,t.progress.work(!0,t.index,e.exports)})):(e.exports="function"==typeof i?Reflect.apply(i,e,[]):i,e.status=Ie.Defined,t.progress.work(!0,t.index,e.exports))};return n.amd=!0,n}resolvePath(e){try{if(this.isNaturePath(e,"all"))return e;e=this.parserPath(e,!0);let t=this.getFileNamePostfix(e);t=t.toLowerCase();let r=this.createSearch(this.query);return-1==e.indexOf("?")?("js"!==t&&"css"!==t&&"html"!==t&&(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("?");-1==t&&(t=e.length);let r=e.lastIndexOf(".",t);return-1==r?"":e.substring(r+1,t)}isNaturePath(e,t){if(null==this.options.nature)return!1;if("all"===t||"js"===t){let t=this.options.nature.js;if(void 0!==t)for(let r=0;r<t.length;r++){let n=t[r];if(0===e.indexOf(n))return!0}}if("all"===t||"css"===t){let t=this.options.nature.css;if(void 0!==t)for(let r=0;r<t.length;r++){let n=t[r];if(0===e.indexOf(n))return!0}}if("all"===t||"html"===t){let t=this.options.nature.html;if(void 0!==t)for(let r=0;r<t.length;r++){let n=t[r];if(0===e.indexOf(n))return!0}}return!1}parserPath(e,t){if(0==e.indexOf("http://"))return e;if(0==e.indexOf("https://"))return e;if(0==e.indexOf("file:///"))return e;if(0==e.indexOf("/")){return ke+e.slice(1)}if(0==e.indexOf("./")){return ke+e.slice(2)}if(t){let t=this.options.alias[e];if(!t){let r=e.indexOf("/");if(-1==r)t=e;else{let n=e.slice(0,r),o=this.options.paths[n];t=o?o+e.slice(r):e}}return this.parserPath(t,!1)}return ke+e}}function tt(e,t){let r=e.sheet,n=!1;if(t.isOldWebKit)r&&(n=!0);else if(r)try{r.cssRules&&(n=!0)}catch(e){"NS_ERROR_DOM_SECURITY_ERR"===e.name&&(n=!0)}setTimeout((()=>{t.time+=20,n?t.success():t.time>t.timeout?t.error():tt(e,t)}),20)}class rt{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,!0===this.status&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values.push(r)),0===this.size||!1===this.status)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(e){console.error(e.message,e)}}isOK(){return this.status}}class nt{index;src;params;progress;constructor(e,t,r,n){this.index=e,this.src=t,this.params=r,this.progress=n}}const ot=Symbol("_notifyChange"),st=Symbol("_generateLocation"),it=Symbol("_setHashRecorder");class lt{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}}class at{query;changeHandle;historyChange;hashMonitor;traceless=!1;defaultPath;lastHash;constructor(e="",t=!0,r=!1,n="/"){this.query=e,this.hashMonitor=t,this.traceless=r,this.defaultPath=n}init(){if(!this.hashMonitor)return;if(this.historyChange)return;this.historyChange=()=>{if(!this.hashMonitor)return;let e=Oe.history.state;this[ot](e)},qe(Oe,"popstate",this.historyChange);let e=this.getHash()||this.defaultPath,t=Oe.sessionStorage.getItem(e);if(t){let e=JSON.parse(t);this[ot](e)}else{let t,r=e.indexOf("!");t=-1!=r?e.substring(r+1):e;let n=new fe;n.path=t,n.query=this.getSearch(),this[ot]([n])}}destroy(){this.historyChange&&Fe(Oe,"popstate",this.historyChange)}[it](e,t){if(this.hashMonitor)try{this.lastHash&&Oe.sessionStorage.removeItem(this.lastHash);let r=JSON.stringify(t);Oe.sessionStorage.setItem(e,r),this.lastHash=e}catch(e){console.error(e.message)}}listen(e){this.changeHandle=e}[ot](e){"function"==typeof this.changeHandle&&this.changeHandle(e)}go(e){Oe.history.go(e)}push(e){let t=this[st](e.currentRoute);this.traceless||Oe.history.pushState(e.routes,"",t),this[it](e.currentRoute.fullPath,e.routes)}replace(e){let t=this[st](e.currentRoute);this.traceless||Oe.history.replaceState(e.routes,"",t),this[it](e.currentRoute.fullPath,e.routes)}[st](e){let t;if(e.query){let r="";if("object"==typeof e.query)for(let t in e.query){let n=encodeURIComponent(e.query[t]),o=`${encodeURIComponent(t)}=${n}`;r.length>0&&(r+="&"),r+=o}else r=e.query;this.query?(t=`${this.query}&${r}`,"?"!==t.charAt(0)&&(t=`?${t}`)):t=`?${r}`}const r=Oe.location;let n;return n=t?`${r.origin}${r.pathname}${t}#${e.fullPath}`:`${r.origin}${r.pathname}#${e.fullPath}`,n}getHash(){let e=Oe.location.hash,t=e.indexOf("#");if(-1!=t){return e.substring(t+1)}return null}getSearch(){return Oe.location.search}}const ut=Symbol("_constructRouteModel"),ct=Symbol("_findRouteModel"),ht=Symbol("_findRootView"),ft=Symbol("_getFirstView"),pt=Symbol("_removeView"),dt=Symbol("_buildPage"),yt=Symbol("_resolveComponent"),mt=Symbol("_update"),gt=Symbol("_merge"),vt=Symbol("ignoreHistoryChangeOnceKey"),bt=Symbol("_handleHistoryChange"),wt=Symbol("_handleRouteUpdated"),xt=Symbol("routeUpdatedCallback"),St=Symbol("currentRoutes"),Rt=Symbol("current"),At=Symbol("_addRouteRecorder"),Ct=Symbol("_removeRouteRecorder"),Et=Symbol("_cloneRouteRecorder"),jt=Symbol("_hanldeError"),Pt=Symbol("errorCallback"),Tt=Symbol("registerKey"),Ot=Symbol("notFoundKey"),$t=Symbol("forestKey"),qt=Symbol("historyKey"),Ft=Symbol("beforeFiltersKey"),kt=Symbol("afterFiltersKey"),_t=Symbol("destroyFiltersKey"),Mt=Symbol("mainDispatcherKey"),Nt=Symbol("initKey"),Kt=Symbol("requireKey"),Lt=Symbol("_createNextFn"),It=Symbol("_start"),Dt=Symbol("_before"),Ht=Symbol("_after"),Ut=Symbol("_destroy"),Bt=Symbol("_load"),Wt=Symbol("_unload"),Vt=Symbol("_loadDependency"),Jt=Symbol("resolvedModulesKey"),zt=Symbol("resolveDependencyKey"),Gt=Symbol("routerGuardKey");class Xt{[Tt]=new Array;[Ot];[$t]=new Ee;[qt];[St]=new Array;[Pt]=null;[xt]=null;[Ft]=new Array;[kt]=new Array;[_t]=new Array;[Mt]=new Ze;[Jt]=new Map;[zt]=null;[Gt]=new Pe;[Nt]=!1;[Rt]=e(null);[Kt]=new et;get require(){return this[Kt]}get current(){return this[Rt].value}options;constructor(e){this.options=e??{};let t=this.options.routes||[];this.addRoutes(t),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),this[qt]=new at(this.options.query,this.options.hashMonitor,this.options.traceless,this.options.defaultPath),this[qt]?.listen((e=>{if("string"==typeof e){let t=this[ae](e);t&&this[bt]([t])}else this[bt](e)}))}[jt](e="error",t){if(t&&"function"==typeof t.error)try{t.error(e)}catch(e){}if("function"==typeof this[Pt])try{this[Pt](e,t)}catch(e){}console.error(e)}init(){!0!==this[Nt]&&(this[qt]?.init(),this[Nt]=!0)}[vt]=!1;[bt](e){if(this[vt])this[vt]=!1;else try{if(!e){let e=[...this[St]].reverse();return this[Wt](e),void Oe.location.reload()}let t=null,r=[],n=[],o=0;for(;o<e.length&&o<this[St].length&&fe.isSame(e[o],this[St][o]);o++)e[o].opsType===me.Open&&!0===e[o].active&&e[o].active!==this[St][o].active&&(t=e[o]);if(o<e.length&&(r=e.slice(o)),o<this[St].length&&(n=this[St].slice(o).reverse()),0==n.length&&0==r.length)return void(null!==t&&this.restore([t]));if(n.length>0){if(this[Wt](n)){if(r.length>0)return void this.restore(r);null!==t&&this.restore([t])}}else this.restore(r)}catch(e){this[jt](e)}}[wt](e){if(e)this[Rt].value=e;else{let e=this[St].length;this[Rt].value=e>0?this[St][e-1]:null}if("function"==typeof this[xt])try{this[xt](this[Rt].value)}catch(e){}}[At](e,t=-1){t<0||t>=this[St].length?this[St].push(e):this[St].splice(t,0,e)}[Et](){let e=[];for(let t of this[St]){let r=fe.clone(t,!0);e.push(r)}return e}[Ct](e){if(null==this[St])return;let t=-1;for(let r=0;r<this[St].length;r++)if(fe.isSame(this[St][r],e)){t=r;break}if(-1!=t){let e=this[St][t];this[St].splice(t,1),this[Ut](e,e.session)}}set hashMonitor(e){this[qt]&&(this[qt].hashMonitor=e)}get hashMonitor(){return!!this[qt]&&this[qt].hashMonitor}set traceless(e){this[qt]&&(this[qt].traceless=e)}get traceless(){return!!this[qt]&&this[qt].traceless}onRouteUpdated(e){this[xt]=e}onError(e){this[Pt]=e}beforeEach(e){this[Ft].push(e)}removeBeforeEach(e){let t=this[Ft].indexOf(e);return-1!==t&&(this[Ft].splice(t,1),!0)}afterEach(e){this[kt].push(e)}removeAfterEach(e){let t=this[kt].indexOf(e);return-1!==t&&(this[kt].splice(t,1),!0)}destroyEach(e){this[_t].push(e)}removeDestroyEach(e){let t=this[_t].indexOf(e);return-1!==t&&(this[_t].splice(t,1),!0)}setResolveDependency(e){this[zt]=e}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){let r=this[ut](e);if(-1==t)this[Tt]=[...this[Tt],...r];else for(let e=r.length-1;e>=0;e--)this[Tt].splice(t,0,r[e])}removeRoute(e){let t=this[ae](e);if(null===t)return console.warn("route格式错误",e),!1;for(let e=0;e<this[Tt].length;e++){let r=this[Tt][e];if(t?.path&&r.path===t.path)return this[Tt].splice(e,1),!0;if(t?.name&&r.name===t.name)return this[Tt].splice(e,1),!0}return!1}hasRoute(e){let t=this[ae](e);return null===t?(console.warn("route格式错误",e),!1):-1!==this[Tt].findIndex((e=>!(!t?.path||e.path!==t.path)||(!(!t?.name||e.name!==t.name)||void 0)))}setNotFoundRoute(e){let t=this[ut](e);this[Ot]=t[0]}getRoutes(){return[...this[Tt]]}[ut](e){let t=e.path??"";t.length>0&&"/"!==t.charAt(0)&&(t=`/${t}`);let r=e.components??(e.component&&{"":e.component});if(null==r){let r=new ye;return r.path=t,r.redirect=e.redirect,[r]}let n=[];for(let t in r){let o=r[t];0===t.length&&(t="default");let s=new pe(t,o,e.props,e.meta);n.push(s)}let o=!1,s=[];if(e.children)for(let r of e.children){let e=this[ut](r);for(let r of e){let e=new ye;e.name=r.name,r.path&&r.path.length>0?e.path="/"!==t?`${t}${r.path}`:r.path:(o=!0,e.path=t);let i=new de;i.models=[...n],e.layers=[i,...r.layers],s.push(e)}}if(!o){let r=new de;r.models=n;let o=new ye;o.name=e.name,o.path=t,o.layers=[r],s.splice(0,0,o)}return s}[ct](e){let t=e.route;try{for(let r of this[Tt]){if(t.path&&r.path){let n=r.match;n||(n=r.match=re(r.path));let o=n(t.path);if(!o)continue;if(r.redirect){let n=new fe;E(!0,n,t),n.path=r.redirect;let o={route:n,find:void 0};return!!this[ct](o)&&(e.route=o.route,e.find=o.find,!0)}if(t.params=t.params??{},E(!0,t.params,o.params),t.query){let e=t.query;if("string"==typeof e){let r={},n=e.split("&");for(let e of n){let t=e.split("=");if(2!==t.length)continue;let n=decodeURIComponent(t[0].trim()),o=decodeURIComponent(t[1].trim());r[n]=o}E(!0,t.params,r)}else"object"==typeof e&&E(!0,t.params,e)}return e.find=r,!0}if(t.name===r.name){t.params=t.params??{};let n=te(r.path);return t.path=n(t.params),e.find=r,!0}}}catch(e){console.error(e.message,e),"function"==typeof t.error&&t.error(e.message)}return!1}[ae](e){let t=null;if(Array.isArray(e))if(t=new fe,"object"==typeof e[0])t=fe.from(e[0]);else for(let r=0;r<e.length;r++)0===r?"/"===e[r].charAt(0)?t.path=e[r]:t.name=e[r]:1===r?t.params=e[r]:2===r?t.root=e[r]:3===r&&E(!1,t,e[r]);else"object"==typeof e?t=fe.from(e):"string"==typeof e&&(t=new fe,"/"==e.charAt(0)?t.path=e:t.name=e);if(t){if(t.path){let e=t.path.indexOf("?");-1!==e&&e<t.path.length-1&&(t.query=t.path.substring(e+1),t.path=t.path.substring(0,e))}t.root=t.root??"default",t.opsType=t.opsType??this.options.defaultOperationType??me.Push}return t}push(...e){let t=this[ae](e);return t?(t.opsType=t.opsType||me.Push,this.to(t)):(this[jt]("resolve route fail",t),this)}put(...e){let t=this[ae](e);return t?(t.opsType=me.Put,this.to(t)):(this[jt]("resolve route fail",t),this)}replace(...e){let t=this[ae](e);return t?(t.opsType=me.Replace,this.to(t)):(this[jt]("resolve route fail",t),this)}append(...e){let t=this[ae](e);return t?(t.opsType=me.Append,this.to(t)):(this[jt]("resolve route fail",t),this)}remove(e){return new Promise((t=>{this[Mt].post((r=>{try{if(0===this[St].length)return r.resolve(),void t(!1);let n,o=-1,s=[];if(e){if(e.root)n=e.root;else{n=this[St][0].root??"default"}if(e.all)for(let e=this[St].length-1;e>0;e--){let t=this[St][e];t.opsType===me.Append&&t.root===n&&(s.splice(0,0,t),o=e-1)}else if(e.until)for(let t=this[St].length-1;t>0;t--){let r=this[St][t];if(r.opsType===me.Append&&r.root===n){if("/"===e.until.charAt(0)&&e.until===r.path){o=t;break}if(e.until===r.name){o=t;break}s.splice(0,0,r)}}}else{n="default";let e=this[ft](this[$t]);e&&(n=e.name);for(let e=this[St].length-1;e>0;e--){let t=this[St][e];if(t.opsType===me.Append&&t.root===n){s.push(t),o=e-1;break}}}if(0===s.length){let e="can not find route";return console.warn(e),r.resolve(e),void t(!1)}let i=0;if(this[St].forEach((e=>{e.opsType!==me.Put&&i++})),this[Wt](s)){let e=0;this[St].forEach((t=>{t.opsType!==me.Put&&e++}));let n=i-e;this[vt]=!0,this.back(n),r.resolve(),t(!0)}}catch(e){this[jt](e),r.resolve(),t(!1)}}))}))}open(...e){let t=this[ae](e);return t?(t.opsType=me.Open,this.to(t)):(this[jt]("resolve route fail",t),this)}close(e){return this[Mt].post((t=>{try{let r=this[ae](e);if(!r)return void t.reject("resolve route fail");let n=[];for(let e=0;e<this[St].length;e++){let t=this[St][e];if(t.root===r.root){if(r.path&&r.path===t.path){n.push(t);break}if(r.name&&r.name===t.name){n.push(t);break}}}if(0===n.length)return void t.resolve();if(this[Wt](n)){let e=fe.clone(r,!0);const t=new lt(e,this[Et]());this[qt]?.replace(t),this[wt]()}t.resolve()}catch(e){this[jt](e),t.resolve()}})),this}to(...e){let t=this[ae](e);if(!t)return this[jt]("resolve route fail",t),this;let r=this[Gt].acquire(t);return null==r?(this[jt]("route forbid",t),this):(this[Mt].post((e=>{try{let n=this[It](t);this[Dt](n),!n.session?.routeModel&&this[zt]&&this[Vt](n),this[Bt](n),this[Ht](n),n.wait(((n,o)=>{let s=n.session.to;try{let e=fe.clone(s,!0);const t=new lt(e,this[Et]());s.opsType===me.Replace?this[qt]?.replace(t):this[qt]?.push(t)}catch(e){console.error(e.message,e)}if(this[Gt].release(r),this[wt](s),"function"==typeof t.success)try{Reflect.apply(t.success,{},[])}catch(e){console.error(e.message,e)}e.resolve()}),((n,o)=>{this[Gt].release(r),this[jt](o,t),e.resolve()}))}catch(n){this[Gt].release(r),this[jt](n,t),e.resolve()}})),this)}back(e=1){this[qt]?.go(-e)}[Lt](e){return(t,r)=>{if("boolean"==typeof t)t?e.resolve():e.reject(r);else if(t){let r=this[ae](t);if(r){let t=e.session.to;r.success=t.success,r.error=t.error,e.session.to=r,e.session.routeModel=null,e.resolve()}else e.reject("route resolve fail")}else e.resolve()}}[It](e){let t=this[St].length>0?this[St][0]:void 0,r=new he(e,t),n={route:e,find:null};return this[ct](n),n.find&&(r.routeModel=n.find,e.matched=function(e){let t=[];return e.layers.forEach((e=>{null!=e.models&&null!=e.models&&e.models.forEach((e=>{if(null!=e&&null!=e)if("object"==typeof e.meta){let r=E(!0,{},e.meta);t.push(r)}else e.meta&&t.push(e.meta)}))})),t}(n.find),Array.isArray(e.matched)&&e.matched.length>0&&(e.meta=n.find.layers[0].models[0].meta)),new Ze(r)}[Dt](e){for(let t of this[Ft])e.post((e=>{let r=this[Lt](e);Reflect.apply(t,{},[e.session.to,e.session.from,r,e.session])}))}[Ht](e){e.post((e=>{for(let t of this[kt])try{Reflect.apply(t,{},[e.session.to,e.session.from,e.session])}catch(e){console.error(e.message,e)}e.resolve()}))}[Ut](e,t){for(let r of this[_t])try{Reflect.apply(r,{},[e,t])}catch(e){console.error(e.message,e)}"function"==typeof e.destroy&&Reflect.apply(e.destroy,e,[])}[Vt](e){let t=e.session,r=Reflect.apply(this[zt],this,[t?.to]);if(null==r)return;Array.isArray(r)||(r=[r]);let n=[];for(let e of r)this[Jt].has(e)||n.push(e);0!==n.length&&e.post((e=>{this[Kt].ensure(n,((...t)=>{if(t){for(let e of t){if(!e)continue;let t;t=A(e)?e.default:e,Array.isArray(t)&&this.addRoutes(t)}for(let e of n)this[Jt].set(e,!0);e.resolve()}else e.reject()}))}))}[Bt](e){e.post((e=>{let t=e.session.to,r=e.session.routeModel;if(null==r){let n={route:t,find:null};if(this[ct](n))r=n.find,e.session.routeModel=r;else{if(!this[Ot])return void e.reject(`not find route model, path:${t.path??t.name}`);r=this[Ot]}}let n=he.from(e.session);this[dt](t,r,n).then((t=>{this[$t],e.resolve()}),(t=>{e.reject(t)}))}))}[Wt](e){if(0==e.length)return!0;let t=this[$t],r=[];for(let n of e){let e=this[ht](t,n);null!=e&&r.push({...e,route:n})}if(0==r.length){let e="can not find view index";return this[jt](e),!1}for(let e of r.reverse())this[pt](t,{x:e.x,y:e.y},[e.route.index??0],!0);return!0}[ht](e,t){let r,n=t.root??"default";for(let t=0;t<e.layers.length;t++){let o=e.layers[t];for(let e=o.views.length-1;e>=0;e--){let s=o.views[e];if(s[ve]&&s[xe]===n)return r={x:e,y:t},r}}return null}[ft](e){if(e.layers.length>0&&e.layers[0].views.length>0){return e.layers[0].views[0]}return null}[pt](e,t,r=null,n=!0){if(t.y>=e.layers.length)return;if(t.x>=e.layers[t.y].views.length)return;let o=e.layers[t.y].views[t.x],s=!1,i=[],l=!1,a=o.slots.value;for(let e=a.length-1;e>=0;e--){let n=a[e];null!=r&&-1==r.indexOf(n.index)||(n.route&&o[ve]&&(this[Ct](n.route),!0===n.active&&n.route.opsType==me.Append&&(l=!0)),i.push(new Ae(o,n.index,t.y)),a.splice(e,1))}if(0==a.length)n?o.slots.value=[...a]:e.layers[t.y].views.splice(t.x,1);else{if(l){let e=a[a.length-1];e.active=!0,e.route&&(e.route.active=e.active)}o.slots.value=[...a]}0==e.layers[t.y].views.length&&(s=!0);let u=t.y+1;for(;u<e.layers.length;u++){let t=e.layers[u].views,r=[];for(let n=t.length-1;(s||i.length>0)&&n>=0;n--){let o=t[n];if(o[we]&&(s||Ae.include(i,o[we]))){let t=o.slots.value;for(let e=t.length-1;e>=0;e--){let n=t[e];n.route&&o[ve]&&this[Ct](n.route),r.push(new Ae(o,n.index,u)),t.splice(e,1)}e.layers[u].views.splice(n,1)}}i=r,0==e.layers[u].views.length&&(s=!0)}}restore(e){if(e&&0!=this[Tt].length){return new Promise(((t,r)=>{for(let t=0;t<e.length;t++){let r=e[t];this[Mt].post((e=>{let t=this[It](r);this[Dt](t),!t.session?.routeModel&&this[zt]&&this[Vt](t),this[Bt](t),this[Ht](t),t.wait(((t,r)=>{e.resolve()}),((t,r)=>{this[jt](r),e.resolve()}))}))}this[Mt].post((e=>{e.resolve(),t()}))}))}{let e=this[$t];if(e.layers.length>0){let t=e.layers[0].views;t.length>0&&(t[0].slots.value=[])}return this[St]=[],this[wt](),Promise.resolve()}}[dt](e,t,r){let n=e.updateType??ge.Part;return this[yt](t).then((()=>{this[mt](t,e,r,n)}))}[yt](e){let t=[];for(let r=0;r<e.layers.length;r++){let n=e.layers[r];for(let e=0;e<n.models.length;e++){let r=n.models[e];r.isResolved||t.push(r.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[mt](e,t,r,n){if(1!==e.layers[0].models.length)return Promise.reject("illegal route structure(multil root node)");const o=e.layers[0].models[0];let s,i,l=this[$t],a=function(e){return 0==e.layers.length||0==e.layers[0].views.length}(l),u=t.root??"default";a||n!=ge.Part||(s=this[ht](l,t));let c=0;if(null==s||null==s)if(a||n===ge.All){if(0==l.layers[0].views.length){let e=t.root??"default";i=new Re(e,!0,null),l.layers[0].views=[i]}else i=l.layers[0].views[0];s={x:0,y:0}}else{let e=t.slot;if(!e)return Promise.reject("can not rebuild view(because not route slot)");let r,n=e.level;if(n>l.layers.length)return Promise.reject("can not insert view(override level)");if(e.rootName){let t=l.layers[n-1];for(let o of t.views){if(o[ve]&&o.name===e.rootName){r=new Ae(o,e.rootIndex??0,n-1);break}if(o[be]&&o[be].view.name===e.rootName&&o[be].index===e.rootIndex){r=o[be];break}}}if(!r)return Promise.reject("can not insert view(not find root node ref)");i=new Re(u,!0,r),l.layers[n].views.push(i),s={x:l.layers[n].views.length-1,y:n}}else i=l.layers[s.y].views[s.x];if(c=s.y,i[ve]=!0,t.opsType===me.Append){t.index=P.get();let r=i.slots.value;if(r.length>0){let e=r[r.length-1];e.active=!1,e.route&&(e.route.active=e.active)}let n=new Se(t,o,t.index,!0);i.slots.value=[...r,n];let s=c+1,a=1,u=new Ae(i,t.index,c);this[gt](l,s,e,a,u)}else if(t.opsType===me.Open){let r=i.slots.value,n=!1;for(let e of r){if(null!==e.route&&fe.isSameForRouteModel(e.route,t)){if(1==e.active)return t.index=e.index,t.active=e.active,e.route=t,Promise.resolve();e.active=!0,n=!0,t.index=e.index,t.active=e.active,e.route=t,this[Ct](e.route)}else e.active=!1;e.route&&(e.route.active=e.active)}if(!n){t.index=P.get(),t.active=!0;let n=new Se(t,o,t.index,!0);r.push(n);let s=c+1,a=1,u=new Ae(i,t.index,c);this[gt](l,s,e,a,u)}i.slots.value=[...r]}else{let r=i.slots.value;if(0==r.length){t.index=P.get(),i.slots.value=[new Se(t,o,t.index)];let r=c+1,n=1,s=new Ae(i,t.index,c);this[gt](l,r,e,n,s)}else{let n=r[0];if(n.model!==o){this[pt](l,s,null,!0),t.index=P.get(),i.slots.value=[new Se(t,o,t.index)];let r=c+1,n=1,a=new Ae(i,t.index,c);this[gt](l,r,e,n,a)}else{null!==n.route&&this[Ct](n.route);let o=[];for(let e=1;e<r.length;e++)o.push(r[e].index);o.length>0&&this[pt](l,s,o,!0),t.index=n.index,n.route=t;let a=[new Ae(i,t.index,c)],u=c+1,h=1,f=new Ae(i,t.index,c);for(;a.length>0&&u<l.layers.length&&h<e.layers.length;u++,h++){let t=[];for(let e=0;e<l.layers[u].views.length;e++){let r=l.layers[u].views[e];r[we]&&Ae.include(a,r[we])&&t.unshift(e)}let r=[];for(let n of t){let t,o=l.layers[u].views[n],s=e.layers[h].models;for(let e=0;e<s.length;e++)if(o.name===s[e].name){t=s[e];break}if(t){let s=o.slots.value;if(0==s.length){let r=0;o.slots.value=[new Se(null,t,r)];let n=u+1,s=h+1;this[gt](l,n,e,s,f)}else{let i=s[0];if(i.model!==t){this[pt](l,{x:n,y:u},null,!0),o.slots.value=[new Se(null,t,0)];let r=u+1,s=h+1;this[gt](l,r,e,s,f)}else{o[ve]&&null!==i.route&&this[Ct](i.route);let e=[];for(let t=1;t<s.length;t++)e.push(s[t].index);e.length>0&&this[pt](l,{x:n,y:u},e,!0),r.push(new Ae(o,i.index,u))}}o[ve]=!1}else this[pt](l,{x:n,y:u},null,!1)}a=r}this[gt](l,u,e,h,f)}}}if(i&&i[be]){let e=i[be];e&&(t.slot=new ce(u,c,e?.view.name,e?.index??0))}r.to=void 0,r.routeModel=void 0,t.session=r,this[At](t)}[gt](e,t,r,n,o){let s=n,i=t;for(;i<e.layers.length&&s<r.layers.length;i++,s++){let t=e.layers[i].views;for(let e of r.layers[s].models){let r=new Re(e.name,!1,o),n=new Se(null,e);r.slots.value=[n],t.push(r)}}for(;s<r.layers.length;s++){let t=new Ce;t.views=[];for(let e of r.layers[s].models){let r=new Re(e.name,!1,o),n=new Se(null,e);r.slots.value=[n],t.views.push(r)}e.layers.push(t)}}[le](e,t,r,n,o,s){if(t<0||t>this[$t].layers.length)return null;if(t<this[$t].layers.length){let i=this[$t].layers[t],l=null;for(let a of i.views){let i=!1;if(null!==r?(i=a.name===e&&a[be]?.view===r,i&&-1!==n&&(i=a[be]?.index===n)):i=a.name===e,i){null!==o&&(a[we]={view:o,index:s,level:t-1}),l=a;break}}if(null!==l)return l}let i=null,l=null;null!==o&&(i=o[ve]?{view:o,index:s,level:t-1}:o[be],l={view:o,index:s,level:t-1});let a=new Re(e,!0,i);if(a[we]=l,t==this[$t].layers.length){let e=new Ce;e.views=[a],this[$t].layers.push(e)}else this[$t].layers[t].views.push(a);return a}}const Yt=Symbol("registerKey");class Qt{policy;callback;constructor(e,t){this.callback=e,this.policy=t}}class Zt{[Yt]=new Map;constructor(){}on(e,t,r=!1){let n=this[Yt].get(e);n||(n=new Array,this[Yt].set(e,n));let o=new Qt(t,!0===r?1:0);return n.push(o),this}off(e,t){if(!t)return this[Yt].delete(e),this;let r=this[Yt].get(e);if(r)for(let e=0;e<r.length;e++){if(r[e].callback===t){r.splice(e,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("function"!=typeof r)return console.error("callback can not benn empty"),this;let n=t-1,o=new Array(n),s=[].splice.call(e,0,n);for(let e=0;e<s.length;e++)this.once(s[e],(t=>{o[e]=t,n-=1,0==n&&Reflect.apply(r,{},o)}));return this}emit(e,...t){let r=this[Yt].get(e);if(!r)return this;for(let e=0;e<r.length;){let n=r[e];if(1==n.policy?r.splice(e,1):e++,"function"==typeof n.callback)try{O((()=>{Reflect.apply(n.callback,{},t)}))}catch(e){console.error(e.message,e)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}}const er=Symbol("registerKey");class tr{[er]=new Map;constructor(){}set(e,t){this[er].set(e,t)}get(e){return this[er].get(e)}has(e){return this[er].has(e)}delete(e){return this[er].delete(e)}}const rr=Symbol("lc");function nr(e,t=!1){let r=e,n=r[rr];if(!n){if(!t)return null;n=new tr,r[rr]=n}return n}function or(e,t){let r=e;for(;null!==r;){let e=r[rr];if(e&&e.has(t))return e.get(t);r=r.$parent}return null}function sr(e){if(Array.isArray(e.children)&&e.children.length>0){let t=e.children[0];if(null!=t&&null!=t.component&&null!=t.component.proxy)return nr(t.component.proxy,!1)}return null}const ir=Symbol("hooksKey");function lr(e,t){let r=e.get(ir);if(null!=r)for(let e=r.length-1;e>=0;e--){let n=r[e];if(n.type===t)try{Reflect.apply(n.hook,n.target,[])}catch(e){console.error(e.message,e)}}}var ar=(e=>(e.DEACTIVATED="da",e.ACTIVATED="a",e))(ar||{});class ur{type;hook;target;constructor(e,t,r){this.target=r,this.hook=t,this.type=e}}function cr(e){return(t,r)=>{let n;if(r)n=r;else{let e=o();if(null==e||null==e.proxy)return void console.error("can not get currrent instance or proxy");n=e.proxy}let i=or(n,ir);null!=i?(s((()=>{!function(e,t,r,n){let o=-1;for(let s=0;s<e.length;s++){let i=e[s];if(i.type===t&&i.hook===r&&i.target===n){o=s;break}}-1!=o&&e.splice(o,1)}(i,e,t,n)})),function(e,t,r,n){let o=new ur(t,r,n);e.push(o)}(i,e,t,n)):console.warn("can not get hooks context")}}let hr=cr("a"),fr=cr("da");const pr=Symbol("routeKey");function dr(e,t){let r=e.get(pr);if(r){let e={path:"",name:"",params:{},index:-1,session:{}};Object.assign(e,t),Object.assign(r,e)}else r=function(){let e=new fe;return e.path="",e.name="",e.params={},e.index=-1,i(e)}(),Object.assign(r,t),e.set(pr,r)}function yr(e){let t=or(e,pr);return null!=t?t:null}const mr=Symbol("rk"),gr=Symbol("vd"),vr=Symbol("rv"),br=Symbol("rvi"),wr=Symbol("pv"),xr=Symbol("pvi");function Sr(e,t=!1){let r=null;return r=t?e.showFromClass??e.enterFromClass:e.enterFromClass,r||(r=e.transitionName,r?t?`${r}-show-from`:`${r}-enter-from`:null)}function Rr(e,t=!1){let r=null;return r=t?e.showActiveClass??e.enterActiveClass:e.enterActiveClass,r||(r=e.transitionName,r?t?`${r}-show-active`:`${r}-enter-active`:null)}function Ar(e){let t,r=e.duration;return"object"==typeof r?t={enter:r.enter??-1,leave:r.leave??-1,show:r.show??-1,hide:r.hide??-1}:("string"==typeof r&&(r=0==r.length?-1:Number(r)),t={enter:r,leave:r,show:r,hide:r}),t}function Cr(e,t){e.classList.contains(t)||e.classList.add(t)}function Er(e,t){e.classList.remove(t)}const jr=Te&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function Pr(e){jr(e)}function Tr(e,t,...r){y(t)&&(null==e&&(e={}),Reflect.apply(t,e,r))}function Or(e,t,r,n=-1,o,s,i,l){if(y(s)){if(void 0!==o&&o>=0)return void setTimeout((()=>{Reflect.apply(s,e,[t,r,n]),y(l)&&Reflect.apply(l,e,[])}),o);let i=["animationend","transitionend"],a=o=>{i.forEach((e=>{Fe(t,e,a)})),Reflect.apply(s,e,[t,r,n]),l&&Reflect.apply(l,e,[])};i.forEach((e=>{qe(t,e,a)}))}if(y(i)){let o="animationcancel",s=l=>{Reflect.apply(i,e,[t,r,n]),Fe(t,o,s)};qe(t,o,s)}}function $r(e){return null!==e&&(e.opsType===me.Append||e.opsType===me.Open)}function qr(e,t,r,n,o={},s,i=-1){if(t&&(r||$r(s))){let e=Sr(o,r);e&&Cr(n,e);let t=Rr(o,r);t&&Cr(n,t)}else{Tr(e,function(e,t=!1){let r=null;return r=t?e.onBeforeShow??e.onBeforeEnter:e.onBeforeEnter,r}(o,r),[n,s,i])}}function Fr(e,t,r,n,o={},s,i,l,a){if($r(i)||r)if(t){let t=Sr(o,r),u=Rr(o,r),c=function(e,t=!1){let r=null;return r=t?e.showToClass??e.enterToClass:e.enterToClass,r||(r=e.transitionName,r?t?`${r}-show-to`:`${r}-enter-to`:null)}(o,r);Pr(c?()=>{Or(e,n,i,l,s,(()=>{u&&Er(n,u),c&&Er(n,c),y(a)&&a(e,a,[n])})),t&&Er(n,t),c&&Cr(n,c)}:()=>{t&&Er(n,t),u&&Er(n,u),y(a)&&a(e,a,[n])})}else{let t=function(e,t=!1){let r=null;return r=t?e.onShow??e.onEnter:e.onEnter,r}(o,r),s=function(e,t=!1){let r=null;return r=t?e.onAfterShow??e.onAfterEnter:e.onAfterEnter,r}(o,r),u=function(e,t=!1){let r=null;return r=t?e.onShowCancelled??e.onEnterCancelled:e.onEnterCancelled,r}(o,r),c=t=>{!t&&y(s)?Tr(e,s,[n,i,l]):y(u)&&Tr(e,u,[n,i,l]),y(a)&&a(e,a,[n])};y(t)?Tr(e,t,[n,c,i,l]):c()}else y(a)&&a(e,a,[n])}function kr(e,t,r,n,o={},s,i,l,a,u){if($r(l)||r)if(t){let t=function(e,t=!1){let r=null;return r=t?e.hideFromClass??e.leaveFromClass:e.leaveFromClass,r||(r=e.transitionName,r?t?`${r}-hide-from`:`${r}-leave-from`:null)}(o,r),c=function(e,t=!1){let r=null;return r=t?e.hideActiveClass??e.leaveActiveClass:e.leaveActiveClass,r||(r=e.transitionName,r?t?`${r}-hide-active`:`${r}-leave-active`:null)}(o,r),h=function(e,t=!1){let r=null;return r=t?e.hideToClass??e.leaveToClass:e.leaveToClass,r||(r=e.transitionName,r?t?`${r}-hide-to`:`${r}-leave-to`:null)}(o,r);t&&Cr(n,t),c&&Cr(n,c),Pr(h?()=>{Or(e,n,l,a,s,(()=>{c&&Er(n,c),h&&Er(n,h),y(u)&&Tr(e,u,[n]),!r&&y(i)&&i()})),t&&Er(n,t),h&&Cr(n,h)}:()=>{t&&Er(n,t),c&&Er(n,c),y(u)&&Tr(e,u,[n]),!r&&y(i)&&i()})}else{let t=function(e,t=!1){let r=null;return r=t?e.onHide??e.onLeave:e.onLeave,r}(o,r),s=function(e,t=!1){let r=null;return r=t?e.onAfterHide??e.onAfterLeave:e.onAfterLeave,r}(o,r),c=function(e,t=!1){let r=null;return r=t?e.onHideCancelled??e.onLeaveCancelled:e.onLeaveCancelled,r}(o,r),h=t=>{!t&&y(s)?(Tr(e,s,[n,l,a]),y(u)&&Tr(e,u,[n]),!r&&y(i)&&i()):y(c)&&(Tr(e,c,[n,l,a]),y(u)&&Tr(e,u,[n]))};y(t)?Tr(e,t,[n,h,l,a]):h()}else!r&&y(i)&&i()}function _r(e,t={},r,n=-1){let o=$(t.css),s=t.mode??"default",i=Ar(t);return{mode:s,persisted:!1,beforeEnter:s=>{qr(e,o,!1,s,t,r,n)},enter:s=>{Fr(e,o,!1,s,t,i.enter,r,n)},leave:(s,l)=>{kr(e,o,!1,s,t,i.leave,l,r,n)},clone:o=>_r(e,t,r,n)}}function Mr(e){return e.el}function Nr(e,t,r={},n,o,s,i){if(s){let s=Mr(t);if(null==s)return;let l=$(r.css),a=Ar(r);qr(e,l,!0,s,r,n,o),Fr(e,l,!0,s,r,a.show,n,o,(t=>{y(i)&&Tr(e,i,[t])}))}else y(i)&&Tr(e,i,[])}function Kr(e,t,r={},n,o,s,i){if(s){let s=Mr(t);if(null==s)return;let l=$(r.css),a=Ar(r);kr(e,l,!0,s,r,a.hide,null,n,o,(t=>{y(i)&&Tr(e,i,[t])}))}else y(i)&&Tr(e,i,[])}function Lr(e,t,r){return"function"==typeof e?Reflect.apply(e,{},[t,r]):e}function Ir(e,t){if(!e)return null;const r=e(t);return 1===r.length?r[0]:r}class Dr{node;state;constructor(e,t){this.node=e,this.state=t}}const Hr=l({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:()=>({})},viewClass:{type:[String,Function],required:!1},viewActiveClass:{type:[String,Function],required:!1},viewDeactiveClass:{type:[String,Function],required:!1},css:{type:[Boolean,String],required:!1,default:!0},transition:{type:[Boolean,String],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},onBeforeEnter:{type:Function,required:!1},onEnter:{type:Function,required:!1},onAfterEnter:{type:Function,required:!1},onEnterCancelled:{type:Function,required:!1},onBeforeLeave:{type:Function,required:!1},onLeave:{type:Function,required:!1},onAfterLeave:{type:Function,required:!1},onLeaveCancelled:{type:Function,required:!1},onBeforeShow:{type:Function,required:!1},onShow:{type:Function,required:!1},onAfterShow:{type:Function,required:!1},onShowCancelled:{type:Function,required:!1},onBeforeHide:{type:Function,required:!1},onHide:{type:Function,required:!1},onAfterHide:{type:Function,required:!1},onHideCancelled:{type:Function,required:!1}},setup(e,t){const r=o();if(null===r||null===r.proxy)return void console.error("instance or instance.proxy not exist");const n=!0===e.multi,i=a(mr,null),l=a(gr,0),h=a(vr,null),f=a(br,-1);let p=!1,d=null;const y=e.modelSlot;if(y){u(gr,l+1),u(br,y.index),u(xr,y.index);const e=y.route;if(!e)return void console.warn("child view render error, route not exist");const t=nr(r.proxy,!0);!function(e){let t=e.get(ir);t||(t=[],e.set(ir,t))}(t),dr(t,e)}else{if(null==i)return void console.error("router is not been injected");const t=e.name,o=a(wr,null),s=a(xr,0);if(d=i[le](t,l,h,f,o,s),null===d)return;u(wr,d);if(!0===d[ve]&&u(vr,d),n)p=$(e.transition??!0);else{p=$(e.transition??!1),u(br,-1),u(gr,l+1),u(xr,-1);const t=d.slots.value;if(t.length>0){const e=t[0].route;if(e){dr(nr(r.proxy,!0),e)}}else{const e=nr(r.proxy,!0);d.compensation=()=>{const t=d.slots.value;if(t.length>0){const r=t[0].route;return r&&dr(e,r),!0}return!1}}}}const m={value:new Map};return s((()=>{m.value&&m.value.clear()})),()=>{if(n){const n=new Map,o=[],s=d?.slots.value,i=[];for(let l=0;l<s.length;l++){const a=s[l],u=`${e.name}-${a.index}`,h={modelSlot:a};let f;f=t.slots.default?c(Hr,h,{default:t.slots.default}):c(Hr,h);const d={},y=Lr(e.viewClass,a.route,l);"string"==typeof y&&y.length>0&&(d[y]=!0);const g=Lr(e.viewActiveClass,a.route,l),v=Lr(e.viewDeactiveClass,a.route,l),b=m.value.get(u);if("string"==typeof g&&g.length>0&&(d[g]=a.active),"string"==typeof v&&v.length>0&&(d[v]=!a.active),b&&a.active!==b.state){const t=b.node;a.active?i.unshift((()=>{Nr(r,t,e,a.route,l,p,(()=>{let e=sr(t);null!=e&&lr(e,ar.ACTIVATED)}))})):i.push((()=>{Kr(r,t,e,a.route,l,p,(()=>{let e=sr(t);null!=e&&lr(e,ar.DEACTIVATED)}))}))}const w={class:d,key:u},x=Lr(e.viewTagProps,a.route,l);null!==x&&"object"==typeof x&&E(!0,w,x),a.route?.viewTagAttrs&&"object"==typeof a.route?.viewTagAttrs&&E(!0,w,a.route.viewTagAttrs);const S=Lr(e.viewTag,a.route,l),R=c(S,w,{default:()=>[f]});if(n.set(u,new Dr(R,a.active)),p){const t=_r(r,e,a.route,l);R.transition=t}o.push(R)}m.value=n,function(e,t={}){Pr((()=>{for(let r=0;r<e.length;r++)Reflect.apply(e[r],t,[])}))}(i,r);const l=Lr(e.tag,null,-1),a={};return Object.assign(a,t.attrs),c(l,a,{default:()=>o})}if(null!=y){const e=y.model,r={};e.props&&("object"==typeof e.props?E(!1,r,e.props):!0===e.props&&"object"==typeof y.route?.params&&E(!1,r,y.route?.params));const n=c(e.component,r);return Ir(t.slots.default,{Component:n,route:y.route})??n}{const n=d.slots.value;if(n.length>0){const o=n[0],s=o.model,i={};s.props&&("object"==typeof s.props?E(!1,i,s.props):!0===s.props&&"object"==typeof o.route?.params&&E(!1,i,o.route?.params));const l=c(s.component,i);if(p){const t=_r(r,e,o.route,-1);l.transition=t}return Ir(t.slots.default,{Component:l,route:o.route})??l}return Ir(t.slots.fallback,{})}}}});function Ur(e,t){return"function"==typeof e?Reflect.apply(e,{},[t]):e}let Br=l({name:"RouterLink",inheritAttrs:!1,props:{tag:{type:[String,Object,Function],required:!1,default:"a"},to:{type:[String,Object,Function],required:!0},activeClass:{type:[String,Function],required:!1,default:"fox-router-link-active"},exact:{type:[String,Boolean,Function],required:!1},exactActiveClass:{type:[String,Function],required:!1,default:"fox-router-link-exact-active"},event:{type:[String,Function],required:!1,default:"onClick"}},setup(e,t){const r=a(mr,null);return()=>{let n=Ur(e.to,null),o=Ur(e.tag,n);if(null==o)return void console.warn("can not resolve link tag");let s=null,i=null;null!==r&&(s=r[ae](n),i=r.current);let l={},a=Ur(e.activeClass,s);if("string"==typeof a&&a.length>0&&(l[a]=function(e,t){return!!(null!=e&&null!=t&&(e.path&&t.path&&t.path.startsWith(e.path)||e.name&&e.name==t.name))}(s,i)),!0===Ur(e.exact,s)){let t=Ur(e.exactActiveClass,s);"string"==typeof t&&t.length>0&&(l[t]=function(e,t){return!!(null!=e&&null!=t&&(e===t||e.path&&e.path===t.path||e.name&&e.name===t.name))}(s,i))}let u={class:l};E(!0,u,t.attrs);let h=Ur(e.event,s);if("string"==typeof h){const e=e=>{null!=r?null!=s?function(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||null!=e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}(e)&&r.to(s):console.warn("route is not been resolved"):console.warn("router is not been injectd")};u[h]=e}return c(o,u,t.slots)}}}),Wr={get each(){return L},get type(){return k},get isFunction(){return y},get isArray(){return h},get isArrayLike(){return M},get makeArray(){return K},get merge(){return N},get isWindow(){return _},get isPlainObject(){return S},get isEqual(){return I}};const Vr=Symbol("fk"),Jr=Symbol("fbk"),zr=Symbol("fepk");function Gr(e={}){const t=new Xt(e),r=new Z,n=new Zt,o={...Wr,get router(){return t},get bus(){return r},get Bus(){return Z},get eventproxy(){return n},get EventProxy(){return Zt},get EventChain(){return Ze},get require(){return t.require},get request(){return Ne},get extend(){return E},get clone(){return j},install(e){e.provide(mr,t),e.provide(Vr,o),e.provide(Jr,r),e.provide(zr,n),e.component("fox-router-view",Hr),e.component("fox-router-link",Br),Reflect.defineProperty(e.config.globalProperties,"$fox",{get:()=>o}),Reflect.defineProperty(e.config.globalProperties,"$router",{get:()=>t}),Reflect.defineProperty(e.config.globalProperties,"$bus",{get:()=>r}),Reflect.defineProperty(e.config.globalProperties,"$bus",{get:()=>r}),Reflect.defineProperty(e.config.globalProperties,"$eventProxy",{get:()=>n}),e.config.globalProperties.$fox_on=function(e,t,r=!1){n.on(e,t,r)},e.config.globalProperties.$fox_off=function(e,t){n.off(e,t)},e.config.globalProperties.$fox_once=function(e,t){n.once(e,t)},e.config.globalProperties.$fox_all=function(...e){let t=n;Reflect.apply(t.all,t,e)},e.config.globalProperties.$fox_trigger=function(e,...t){let r=n;Reflect.apply(r.trigger,r,[e,...t])},e.config.globalProperties.$fox_emit=function(e,...t){let r=n;Reflect.apply(r.trigger,r,[e,...t])},e.mixin({computed:{$route(){return yr(this)}},created(){t.init()}})}};return o}function Xr(e){if(e){return e.$router}return a(mr)}function Yr(e){if(!e){e=o()?.proxy??void 0}return e?yr(e):null}function Qr(e){if(e){return e.$fox}return a(Vr)}function Zr(e){if(e){return e.$bus}return a(Jr)}function en(e){if(e){return e.$eventProxy}return a(zr)}function tn(e){const t=Xr(),r=(t,r,n)=>{try{Reflect.apply(e,{},[t,r])}catch(e){console.error(e)}n()};t.beforeEach(r),s((()=>{t.removeBeforeEach(r)}))}function rn(e){const t=Xr(),r=(t,r,n)=>{try{Reflect.apply(e,{},[t,r])}catch(e){console.error(e)}n()};t.afterEach(r),s((()=>{t.removeAfterEach(r)}))}export{Z as Bus,Ze as EventChain,Zt as EventProxy,fe as Route,Xt as Router,Ke as cancel,j as clone,Gr as createFox,E as extend,Jr as foxBusKey,zr as foxEventProxyKey,Vr as foxKey,h as isArray,d as isDate,A as isESModule,I as isEqual,y as isFunction,f as isMap,v as isObject,S as isPlainObject,b as isPromise,p as isSet,m as isString,g as isSymbol,rn as onAfterRouteUpdate,tn as onBeforeRouteUpdate,hr as onFoxActivated,fr as onFoxDeactivated,Ne as request,$ as toBoolean,q as toNumber,x as toTypeString,Zr as useBus,en as useEventProxy,Qr as useFox,Yr as useRoute,Xr as useRouter};
package/main.js DELETED
@@ -1,8 +0,0 @@
1
- /*
2
- * @version: 1.0
3
- * @Author: 江成
4
- * @Date: 2021-09-18 09:36:45
5
- */
6
-
7
- import './libs/index.css'
8
- export * from './libs/index.js'