@fox-js/fox 3.0.1-0 → 3.0.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/READEME.md ADDED
@@ -0,0 +1,57 @@
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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ref, ComponentInternalInstance, App } from 'vue';
1
+ import { Ref, ComponentInternalInstance, InjectionKey, App, ComponentPublicInstance } from 'vue';
2
2
 
3
3
  declare const idKey: unique symbol;
4
4
  declare const valueKey: unique symbol;
@@ -223,7 +223,7 @@ declare class Route {
223
223
  /**
224
224
  * 查询
225
225
  */
226
- query: any;
226
+ query?: any;
227
227
  /**
228
228
  * 获取匹配的元数组列表
229
229
  */
@@ -1624,6 +1624,18 @@ interface Tools {
1624
1624
  get isEqual(): Function;
1625
1625
  }
1626
1626
 
1627
+ /**
1628
+ * 全局Fox
1629
+ */
1630
+ declare const foxKey: InjectionKey<Fox>;
1631
+ /**
1632
+ * 全局Bus
1633
+ */
1634
+ declare const foxBusKey: InjectionKey<Tree>;
1635
+ /**
1636
+ * 全局Event Proxy
1637
+ */
1638
+ declare const foxEventProxyKey: InjectionKey<EventProxy>;
1627
1639
  /**
1628
1640
  * 参数
1629
1641
  */
@@ -1687,26 +1699,33 @@ interface Fox extends Tools {
1687
1699
  declare function createFox(options?: FoxOptions): Fox;
1688
1700
  /**
1689
1701
  * Returns the current router
1702
+ * @returns
1690
1703
  */
1691
- declare function useRouter(): Router;
1704
+ declare function useRouter(proxy?: ComponentPublicInstance): Router;
1692
1705
  /**
1693
1706
  * Returns the current route
1707
+ * @param proxy
1708
+ * @returns
1694
1709
  */
1695
- declare function useRoute(): Route | null;
1710
+ declare function useRoute(proxy?: ComponentPublicInstance): Route | null;
1696
1711
  /**
1697
1712
  * Returns the current fox
1713
+ * @param proxy
1714
+ * @returns
1698
1715
  */
1699
- declare function useFox(): Fox | null;
1716
+ declare function useFox(proxy?: ComponentPublicInstance): Fox;
1700
1717
  /**
1701
- * Returns the global bus
1718
+ * Returns the global bus
1719
+ * @param proxy
1702
1720
  * @returns
1703
1721
  */
1704
- declare function useBus(): Tree | null;
1722
+ declare function useBus(proxy?: ComponentPublicInstance): Tree;
1705
1723
  /**
1706
- * Returns the global event proxy
1724
+ * Returns the global event proxy
1725
+ * @param proxy
1707
1726
  * @returns
1708
1727
  */
1709
- declare function useEventProxy(): EventProxy | null;
1728
+ declare function useEventProxy(proxy?: ComponentPublicInstance): EventProxy;
1710
1729
  /**
1711
1730
  * 路由更新前执行
1712
1731
  * @param callback
@@ -1722,4 +1741,4 @@ declare function onAfterRouteUpdate(callback: {
1722
1741
  (to: Route, from?: Route): void;
1723
1742
  }): void;
1724
1743
 
1725
- export { Bus, EventChain, EventProxy, Route, Router, cancel, clone, createFox, extend, isArray, isDate, isESModule, isEqual, isFunction, isMap, isObject, isPlainObject, isPromise, isSet, isString, isSymbol, onAfterRouteUpdate, onBeforeRouteUpdate, onFoxActivated, onFoxDeactivated, request, toBoolean, toNumber, toTypeString, useBus, useEventProxy, useFox, useRoute, useRouter };
1744
+ export { Bus, EventChain, EventProxy, Route, Router, cancel, clone, createFox, extend, foxBusKey, foxEventProxyKey, foxKey, isArray, isDate, isESModule, isEqual, isFunction, isMap, isObject, isPlainObject, isPromise, isSet, isString, isSymbol, onAfterRouteUpdate, onBeforeRouteUpdate, onFoxActivated, onFoxDeactivated, request, toBoolean, toNumber, toTypeString, useBus, useEventProxy, useFox, useRoute, useRouter };
package/libs/index.js CHANGED
@@ -1 +1 @@
1
- import{ref as e,effectScope as t,watch as r,shallowRef as n,getCurrentInstance as i,onUnmounted as l,shallowReactive as o,defineComponent as s,inject as a,provide as u,h}from"vue";const c=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 j="undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]");function E(...e){var t;let r=void 0!==e[0]&&null!==e[0]?e[0]:{},n=1,i=e.length,l=!1;for("boolean"==typeof r&&(l=r,r=null!=(t=e[n])?t:{},n++),"object"!=typeof r&&(r={});n<i;n++)if(null!==e[n]&&void 0!==e[n]){let t=e[n];for(let e in t){let n=r[e],i=t[e];if(n!==i)if(!0===l&&i&&"object"==typeof i){let t;t=Array.isArray(i)?n&&Array.isArray(n)?n:[]:n&&"object"==typeof n?n:{},r[e]=E(l,t,i)}else void 0!==i&&(r[e]=i)}}return r}function O(e,t,r=!1){if(r){if("object"!=typeof t)return{};"object"!=typeof e&&(e={});for(let n in t){let i=e[n],l=t[n];if(i!==l)if("object"==typeof l){if(!Array.isArray(l)&&!S(l))continue;i=O(i,l,r),e[n]=i}else{if("function"==typeof l)continue;e[n]=l}}const n=Object.getOwnPropertySymbols(t);for(let i of n){let n=e[i],l=t[i];if(n!==l)if("object"==typeof l){if(!Array.isArray(l)&&!S(l))continue;n=O(n,l,r),e[i]=n}else{if("function"==typeof l)continue;e[i]=l}}}else E(!0,e,t);return e}const P=class{static get(){let e=++P.seed;return e>=Number.MAX_VALUE&&(P.seed=0),e}};let C=P;C.seed=(new Date).getTime();const T=j?Promise.resolve():null;function $(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 q(e){return null!=e&&("boolean"==typeof e?e:"string"==typeof e?"true"===e.toLocaleLowerCase():Boolean(e))}function F(e){return"number"==typeof e?e:Number(e)}const k={"[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 _(e){let t=Object.prototype.toString.call(e);return null==e?String(e):k[t]||"object"}function M(e){return e&&"object"==typeof e&&"setInterval"in e}function N(e){let t=!!e&&"length"in e&&e.length,r=_(e);return"function"!==r&&!M(e)&&("array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e)}function K(e,t){let r=+t.length,n=0,i=e.length;for(;n<r;n++)e[i++]=t[n];return e.length=i,e}function I(e,t=[]){let r=t;return null!=e&&(N(Object(e))?K(r,"string"==typeof e?[e]:e):r.push(e)),r}function D(e,t,r){if(N(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 L(e,t){if(e==t)return!0;if(void 0===e||void 0===t)return!1;let r=_(e);if(r!==_(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 i=r[n];if(!L(e[i],t[i]))return!1}return!0}if("array"===r){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){if(!L(e[r],t[r]))return!1}return!0}return!1}var H,B,U;const V=Symbol("idKey"),W=Symbol("valueKey"),J=Symbol("childrenKey"),z=Symbol("growKey");class G{constructor(t){this[H]=!0,this[B]=e(),this[U]=new Map,this[V]=t}}H=z,B=W,U=J;class X{get(e,t){if("value"==t)return e[W].value;if("grow"===t)return e[z];let r=e[J].get(t);return r?Q(r):e[z]?(r=Y(t),r[z]=e[z],e[J].set(t,r),Q(r)):void 0}set(e,t,r){return"value"==t?(e[W].value=r,!0):"grow"===t?(e[z]=q(r),!0):null==r?(e[J].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[J].delete(t),!0)}}function Y(e){let t=new G(e);return Reflect.set(t,"__proxy__",new Proxy(t,new X)),t}function Q(e){return Reflect.get(e,"__proxy__")}class Z extends G{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,i=e[n];r[J].has(i)?t=r[J].get(i):(t=Y(i),r[J].set(i,t)),r=t}return r[W].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[J].has(t))return;r=r[J].get(t)}return r[W].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[J].has(t))return!1;r=r[J].get(t)}let n=e[t-1];return!!r[J].has(n)&&(r[J].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[J].has(t))return!1;r=r[J].get(t)}let n=e[t-1];return r[J].has(n)}clear(){this[J].clear()}}const ee=["put","get","contains","remove","clear"];function te(e){return ee.includes(e)}class re{get(e,t){if("value"==t)return e[W].value;if("grow"===t)return e[z];if(t===J)return e[J];if("string"==typeof t&&te(t))return e[t];let r=String(t),n=e[J].get(r);return n?Q(n):e[z]?(n=Y(r),n[z]=e[z],e[J].set(r,n),Q(n)):void 0}set(e,t,r){return"value"==t?(e[W].value=r,!0):"grow"===t?(e[z]=q(r),!0):!te(t)&&(null==r?(e[J].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[J].delete(t),!0)}}let ne=new Proxy(Z,{construct:(e,...t)=>Q(function(){let e=new Z,t=new re,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 ie(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 i=1,l="";if("?"===e[s=r+1])throw new TypeError('Pattern cannot start with "?" at '+s);for(;s<e.length;)if("\\"!==e[s]){if(")"===e[s]){if(0==--i){s++;break}}else if("("===e[s]&&(i++,"?"!==e[s+1]))throw new TypeError("Capturing groups are not allowed at "+s);l+=e[s++]}else l+=e[s++]+e[s++];if(i)throw new TypeError("Unbalanced pattern at "+r);if(!l)throw new TypeError("Missing pattern at "+r);t.push({type:"PATTERN",index:r,value:l}),r=s}else{for(var o="",s=r+1;s<e.length;){var a=e.charCodeAt(s);if(!(a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||95===a))break;o+=e[s++]}if(!o)throw new TypeError("Missing parameter name at "+r);t.push({type:"NAME",index:r,value:o}),r=s}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,i=void 0===n?"./":n,l="[^"+se(t.delimiter||"/#?")+"]+?",o=[],s=0,a=0,u="",h=function(e){if(a<r.length&&r[a].type===e)return r[a++].value},c=function(e){var t=h(e);if(void 0!==t)return t;var n=r[a],i=n.type,l=n.index;throw new TypeError("Unexpected "+i+" at "+l+", expected "+e)},f=function(){for(var e,t="";e=h("CHAR")||h("ESCAPED_CHAR");)t+=e;return t};a<r.length;){var p=h("CHAR"),d=h("NAME"),y=h("PATTERN");if(d||y){var m=p||"";-1===i.indexOf(m)&&(u+=m,m=""),u&&(o.push(u),u=""),o.push({name:d||s++,prefix:m,suffix:"",pattern:y||l,modifier:h("MODIFIER")||""})}else{var g=p||h("ESCAPED_CHAR");if(g)u+=g;else if(u&&(o.push(u),u=""),h("OPEN")){m=f();var v=h("NAME")||"",b=h("PATTERN")||"",w=f();c("CLOSE"),o.push({name:v||(b?s++:""),pattern:v&&!b?l:b,prefix:m,suffix:w,modifier:h("MODIFIER")||""})}else c("END")}}return o}function le(e,t){return function(e,t){void 0===t&&(t={});var r=ae(t),n=t.encode,i=void 0===n?function(e){return e}:n,l=t.validate,o=void 0===l||l,s=e.map((function(e){if("object"==typeof e)return new RegExp("^(?:"+e.pattern+")$",r)}));return function(t){for(var r="",n=0;n<e.length;n++){var l=e[n];if("string"!=typeof l){var a=t?t[l.name]:void 0,u="?"===l.modifier||"*"===l.modifier,h="*"===l.modifier||"+"===l.modifier;if(Array.isArray(a)){if(!h)throw new TypeError('Expected "'+l.name+'" to not repeat, but got an array');if(0===a.length){if(u)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var c=0;c<a.length;c++){var f=i(a[c],l);if(o&&!s[n].test(f))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'", but got "'+f+'"');r+=l.prefix+f+l.suffix}}else if("string"!=typeof a&&"number"!=typeof a){if(!u){var p=h?"an array":"a string";throw new TypeError('Expected "'+l.name+'" to be '+p)}}else{f=i(String(a),l);if(o&&!s[n].test(f))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but got "'+f+'"');r+=l.prefix+f+l.suffix}}else r+=l}return r}}(ie(e,t),t)}function oe(e,t){var r=[];return function(e,t,r){void 0===r&&(r={});var n=r.decode,i=void 0===n?function(e){return e}:n;return function(r){var n=e.exec(r);if(!n)return!1;for(var l=n[0],o=n.index,s=Object.create(null),a=function(e){if(void 0===n[e])return"continue";var r=t[e-1];"*"===r.modifier||"+"===r.modifier?s[r.name]=n[e].split(r.prefix+r.suffix).map((function(e){return i(e,r)})):s[r.name]=i(n[e],r)},u=1;u<n.length;u++)a(u);return{path:l,index:o,params:s}}}(he(e,r,t),r,t)}function se(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function ae(e){return e&&e.sensitive?"":"i"}function ue(e,t,r){return function(e,t,r){void 0===r&&(r={});for(var n=r.strict,i=void 0!==n&&n,l=r.start,o=void 0===l||l,s=r.end,a=void 0===s||s,u=r.encode,h=void 0===u?function(e){return e}:u,c="["+se(r.endsWith||"")+"]|$",f="["+se(r.delimiter||"/#?")+"]",p=o?"^":"",d=0,y=e;d<y.length;d++){var m=y[d];if("string"==typeof m)p+=se(h(m));else{var g=se(h(m.prefix)),v=se(h(m.suffix));if(m.pattern)if(t&&t.push(m),g||v)if("+"===m.modifier||"*"===m.modifier){var b="*"===m.modifier?"?":"";p+="(?:"+g+"((?:"+m.pattern+")(?:"+v+g+"(?:"+m.pattern+"))*)"+v+")"+b}else p+="(?:"+g+"("+m.pattern+")"+v+")"+m.modifier;else p+="("+m.pattern+")"+m.modifier;else p+="(?:"+g+v+")"+m.modifier}}if(a)i||(p+=f+"?"),p+=r.endsWith?"(?="+c+")":"$";else{var w=e[e.length-1],x="string"==typeof w?f.indexOf(w[w.length-1])>-1:void 0===w;i||(p+="(?:"+f+"(?="+c+"))?"),x||(p+="(?="+f+"|"+c+")")}return new RegExp(p,ae(r))}(ie(e,r),t,r)}function he(e,t,r){return e instanceof RegExp?function(e,t){if(!t)return e;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=r.exec(e.source);i;)t.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=r.exec(e.source);return e}(e,t):Array.isArray(e)?function(e,t,r){var n=e.map((function(e){return he(e,t,r).source}));return new RegExp("(?:"+n.join("|")+")",ae(r))}(e,t,r):ue(e,t,r)}const ce=Symbol("sync"),fe=Symbol("resolveRoute");function pe(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}class de{constructor(e,t,r,n){this.rootIndex=0,this.name=e,this.level=t,this.rootName=r,this.rootIndex=n}}class ye{constructor(e,t){this.data={},this.to=e,this.from=t}static from(e){var t;let r=new ye(e.to,e.from),n=null!=(t=e.data)?t:{};return E(!0,r.data,n),r}}class me{get fullPath(){var e,t;let r=null!=(e=this.path)?e:`/${this.name}`;return`${null!=(t=this.root)?t:"default"}!${r}`}static clone(e,t){let r=new me;return O(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 me;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 ge{constructor(e,t,r,n){this.id=C.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 i=pe((t=>{A(t)&&(t=t.default),e.component=t,console.debug("success load async module"),r()})),l=pe((e=>{console.debug("reject load async module"),n(e)}));let o;try{o=t(i,l)}catch(e){l(e)}if(o)if("function"==typeof o.then)o.then(i,l);else{const e=o.component;e&&"function"==typeof e.then&&e.then(i,l)}}))}(this)}}class ve{constructor(){this.models=[]}}class be{constructor(){this.layers=[]}}var we,xe,Se,Re,Ae,je;(xe=we||(we={}))[xe.Push=0]="Push",xe[xe.Replace=1]="Replace",xe[xe.Put=2]="Put",xe[xe.Append=3]="Append",xe[xe.Open=4]="Open",(Re=Se||(Se={}))[Re.Part=0]="Part",Re[Re.All=1]="All";const Ee=Symbol("rootKey"),Oe=Symbol("rootNodeKey"),Pe=Symbol("parentNodeKey"),Ce=Symbol("nameKey");class Te{constructor(e,t,r=0,n=!0){this.instance=null,this.active=!0,this.index=0,this.route=e,this.model=t,this.index=r,this.active=n}}class $e{constructor(e,t,r){this.scope=null,this[Ae]=null,this[je]=null,this[Ce]=e,this[Ee]=t,r&&(this[Oe]=r)}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)}))}))}get slots(){return null==this._slots&&(this._slots=n([])),this._slots}get empty(){return null==this._slots||0==this._slots.value.length}get name(){return this[Ce]}}Ae=Oe,je=Pe;class qe{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 Fe{constructor(){this.views=[]}}class ke{constructor(){this.layers=[]}}class _e{}class Me{constructor(){this.forbidTime=300,this.submitRecorder=new _e}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 Ne=void 0!==typeof window,Ke=window,Ie=window.document;function De(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function Le(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}let He=function(){let e=Ke.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}();var Be=Object.defineProperty,Ue=Object.getOwnPropertySymbols,Ve=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,Je=(e,t,r)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;const ze={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",keepalive:!0},Ge=new Map;async function Xe(e){var t;let{id:r,method:n="POST",url:i,headers:l={},data:o,processData:s=!0,timeout:a=-1}=e;if(r&&Ge.has(r))throw new Error("resubmit");n=n.toUpperCase();let{contentType:u="application/json; charset=UTF-8"}=l,h=E(!0,((e,t)=>{for(var r in t||(t={}))Ve.call(t,r)&&Je(e,r,t[r]);if(Ue)for(var r of Ue(t))We.call(t,r)&&Je(e,r,t[r]);return e})({},ze),{method:n,headers:l});if("GET"===n?i=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 i=`${encodeURIComponent(e)}=${encodeURIComponent(r[t])}`;n.length>0&&(n+="&"),n+=i}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}(i,o,u):(s&&(o=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 i=`${encodeURIComponent(t)}=${encodeURIComponent(n[e])}`;r.length>0&&(r+="&"),r+=i}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}(o,u)),h.body=o),r||a>0){r||(r=`fetch_${C.get()}`);const e=new AbortController;h.signal=e.signal;let t={timer:null,controller:e};if(a>0){const e=setTimeout((()=>{t.timer&&t.controller.abort()}),a);t.timer=e}Ge.set(r,t)}try{let e,n=await fetch(i,h),l={};n.headers.forEach(((e,t)=>{l[e]=t}));let o=null!=(t=l["content-type"])?t:"";return e=-1!==o.indexOf("application/json")?await n.json():-1!=o.indexOf("text")?await n.text():await n.blob(),{ok:n.ok,status:n.status,statusText:n.statusText,headers:l,data:e,response:n}}catch(e){throw e}finally{if(r){let e=Ge.get(r);e&&(e.timer&&(clearTimeout(e.timer),e.timer=null),Ge.delete(r))}}}function Ye(e){let t=Ge.get(e);return!!t&&(t.timer&&(clearTimeout(t.timer),t.timer=null),t.controller.abort(),Ge.delete(e),!0)}class Qe{constructor(){this.cache=new Map}async get(e,t=-1){if(this.cache.has(e)){return this.cache.get(e)}let r=await Xe({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 Ze,et,tt,rt,nt,it,lt,ot,st,at,ut,ht;(et=Ze||(Ze={}))[et.Loading=0]="Loading",et[et.Loaded=1]="Loaded",et[et.Defining=2]="Defining",et[et.Defined=3]="Defined";class ct{}class ft{constructor(){this.register=new Map}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()}}(ht=ut||(ut={})).Busy="Busy",ht.Free="Free",ht.Reject="Reject",ht.Exception="Exception",ht.Finished="Finished";const pt=Symbol("chainKey"),dt=Symbol("cursorKey"),yt=Symbol("$persistentModeKey"),mt=Symbol("statusKey"),gt=Symbol("argsKey"),vt=Symbol("exArgsKey"),bt=Symbol("successFnsKey"),wt=Symbol("errorFnsKey"),xt=Symbol("sessionKey"),St=Symbol("_go");class Rt{constructor(e,t=!1){this[tt]=[],this[rt]=0,this[nt]=!1,this[it]=ut.Free,this[lt]=[],this[ot]=[],this[st]=[],this[at]=[],this[xt]=e,this[yt]=t}get session(){return this[xt]}[(tt=pt,rt=dt,nt=yt,it=mt,lt=gt,ot=vt,st=bt,at=wt,St)](e,...t){let r=this[mt];if(this[mt]=ut.Busy,this[dt]+=e,this[dt]<0&&(this[dt]=0),this[gt]=t,r===ut.Exception||r===ut.Reject){let e=[{session:this[xt]},...this[vt]];for(;this[wt].length>0;)try{let t=this[wt].shift();"function"==typeof t&&$((()=>{Reflect.apply(t,{},e)}))}catch(e){console.error(e.message,e)}return this[mt]=r,this[pt]=[],this[dt]=0,this}if(r===ut.Finished||this[dt]>=this[pt].length){let e=[{session:this[xt]},...this[gt]];for(;this[bt].length>0;){let t=this[bt].shift();"function"==typeof t&&$((()=>{Reflect.apply(t,{},e)}))}return this[mt]=ut.Free,this}if(this[dt]>=this[pt].length)return this[mt]=ut.Free,this;let n=this[pt][this[dt]];this[yt]||(this[pt].splice(0,this[dt]+1),this[dt]=-1);let i=this[dt]+1;try{let e=!1,t={go:(t,...r)=>{e||(e=!0,Reflect.apply(this[St],this,[t,...r]))},resolve:(...t)=>{e||(e=!0,Reflect.apply(this[St],this,[1,...t]))},reject:(...t)=>{e||(e=!0,Reflect.apply(this.reject,this,[...t]))},insert:t=>{e||(this[pt].splice(i,0,t),i++)},session:this[xt]};$((()=>{Reflect.apply(n,{},[t,...this[gt]])}))}catch(e){this.throw(e)}return this}go(e,...t){return Reflect.apply(this[St],this,[e,...t])}finish(...e){return this[mt]=ut.Finished,this[gt]=e,Reflect.apply(this[St],this,[0])}reject(...e){return this[mt]=ut.Reject,this[vt]=e,Reflect.apply(this[St],this,[0])}throw(...e){return this[mt]=ut.Exception,this[vt]=e,Reflect.apply(this[St],this,[0])}reset(...e){this[mt]=ut.Busy,this[gt]=e,this[pt]=[],this[dt]=0;let t=[{session:this[xt]},...this[gt]];for(;this[bt].length>0;){let e=this[bt].shift();$((()=>{Reflect.apply(e,this,t)}))}return this[mt]=ut.Free,this}post(e){return this[mt]===ut.Reject||this[mt]===ut.Exception?this:(Array.isArray(e)?this[pt]=[...this[pt],...e]:this[pt].push(e),this[mt]===ut.Busy||Reflect.apply(this[St],this,[0,...this[gt]]),this)}wait(e,t){return e&&"function"==typeof e&&this[bt].push(e),t&&"function"==typeof t&&this[wt].push(t),this[mt]===ut.Busy||Reflect.apply(this[St],this,[0,...this[gt]]),this}exception(e){return e&&"function"==typeof e&&this[wt].push(e),this[mt]===ut.Busy?this:Reflect.apply(this[St],this,[0,...this[gt]])}isFinish(){return this[mt]==ut.Reject||this[mt]==ut.Free&&this[dt]>=this[pt].length}}class At{constructor(e={}){this.moduleManager=new ft,this.resource=new Qe,this.head=Ie.head||Ie.getElementsByTagName("head")[0]||Ie.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={})}set query(e){this._query=e}get query(){return this._query}ensure(...e){let t=[],r=e.length-1,n={};"object"==typeof e[r]&&(Object.assign(n,e[r]),r--);let i=null;"function"==typeof e[r]&&(i=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 l=new Et(t.length,((e,t)=>{if(l.isOK())try{"function"==typeof i&&Reflect.apply(i,{},t)}catch(e){console.error(e.message,e)}else try{console.error(e),"function"==typeof i&&Reflect.apply(i,{},[])}catch(e){console.error(e.message,e)}})),o=new Rt;for(let e=0;e<t.length;e++){let r=new Ot(e,t[e],n,l);this.mount(o,r)}return this}remove(...e){let t=[],r=e.length-1,n={};"object"==typeof e[r]&&(Object.assign(n,e[r]),r--);let i=null;"function"==typeof e[r]&&(i=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 i&&Reflect.apply(i,{},[]),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=Ie.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=Ie.body),void this.mountHTML(e,t,r)}}mountHTML(e,t,r){e.post((e=>{var n,i;let l=null!=(i=null!=(n=t.params.timeout)?n:this.options.timeout)?i:3e4,o=t.src;this.resource.get(o,l).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,i=Ie.createElement("link"),l="onload"in i;if(this.isOldWebKit||!l){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(i)}catch(e){console.error(e.message,e)}t.progress.work(!1,t.index,null),e.resolve()}};setTimeout((()=>{jt(i,n)}),1)}else i.onload=()=>{i.onload=i.onerror=null,t.progress.work(!0,t.index,t.src),e.resolve()},i.onerror=()=>{try{r.removeChild(i)}catch(e){console.error(e.message,e)}i.onload=i.onerror=null,t.progress.work(!1,t.index,null),e.reject()};let o=Ie.getElementById(n);o&&o.parentNode&&o.parentNode.removeChild(o),i.rel="stylesheet",i.type="text/css",i.id=n,i.href=n,r.appendChild(i)}))}mountJS(e,t,r){e.post((e=>{let n=t.src,i=this.moduleManager.get(n);if(i&&(i.status==Ze.Defined||i.status==Ze.Loaded)){if(i.exports)return t.progress.work(!0,t.index,i.exports),void e.resolve();if(document.querySelector(`script[src='${n}`))return t.progress.work(!0,t.index,i.exports),void e.resolve()}i=new ct,i.id=n,i.src=n,i.status=Ze.Loading,this.moduleManager.put(n,i);let l=Ie.createElement("script");if("onload"in l)l.onload=()=>{l.onload=l.onerror=null,i.status==Ze.Loading&&(i.status=Ze.Loaded,t.progress.work(!0,t.index,n)),e.resolve()},l.onerror=()=>{try{r.removeChild(l)}catch(e){console.error(e.message,e)}l.onload=l.onerror=null,t.progress.work(!1,t.index,null),e.reject()};else{let r=l;r.onreadystatechange=()=>{/loaded|complete/.test(r.readyState)&&(r.onreadystatechange=null,i.status==Ze.Loading&&(i.status=Ze.Loaded,t.progress.work(!0,t.index,n)),e.resolve())}}l.defer=!0,l.src=n,Ke.define=this.createDefine(i,t),r.appendChild(l)}))}unmount(e,t={}){let r=this.getFileNamePostfix(e);if("js"===r||0===r.length){let t=Ie.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=Ie.body),void(r.innerHTML="")}{let t=Ie.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 i,l,o;e.status=Ze.Defining;let s=n.length;1===s?(o=n[0],i=void 0):2===s?(o=n[1],Array.isArray(n[0])?(l=r.trimEmptyElement(n[0]),i=void 0):l=void 0):(i=n[0],l=r.trimEmptyElement(n[1]),o=n[2]),i&&(e.id=i,r.options.alias[i]=e.src),l&&l.length>0?r.ensure(l,((...r)=>{e.exports="function"==typeof o?Reflect.apply(o,e,r):o,e.status=Ze.Defined,t.progress.work(!0,t.index,e.exports)})):(e.exports="function"==typeof o?Reflect.apply(o,e,[]):o,e.status=Ze.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 He+e.slice(1)}if(0==e.indexOf("./")){return He+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),i=this.options.paths[n];t=i?i+e.slice(r):e}}return this.parserPath(t,!1)}return He+e}}function jt(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():jt(e,t)}),20)}class Et{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 Ot{constructor(e,t,r,n){this.index=e,this.src=t,this.params=r,this.progress=n}}const Pt=Symbol("_notifyChange"),Ct=Symbol("_generateLocation"),Tt=Symbol("_setHashRecorder");class $t{constructor(e,t){this.currentRoute=e,this.routes=t}}class qt{constructor(e="",t=!0,r=!1,n="/"){this.traceless=!1,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=Ke.history.state;this[Pt](e)},De(Ke,"popstate",this.historyChange);let e=this.getHash()||this.defaultPath,t=Ke.sessionStorage.getItem(e);if(t){let e=JSON.parse(t);this[Pt](e)}else{let t,r=e.indexOf("!");t=-1!=r?e.substring(r+1):e;let n=new me;n.path=t,n.query=this.getSearch(),this[Pt]([n])}}destroy(){this.historyChange&&Le(Ke,"popstate",this.historyChange)}[Tt](e,t){if(this.hashMonitor)try{this.lastHash&&Ke.sessionStorage.removeItem(this.lastHash);let r=JSON.stringify(t);Ke.sessionStorage.setItem(e,r),this.lastHash=e}catch(e){console.error(e.message)}}listen(e){this.changeHandle=e}[Pt](e){"function"==typeof this.changeHandle&&this.changeHandle(e)}go(e){Ke.history.go(e)}push(e){let t=this[Ct](e.currentRoute);this.traceless||Ke.history.pushState(e.routes,"",t),this[Tt](e.currentRoute.fullPath,e.routes)}replace(e){let t=this[Ct](e.currentRoute);this.traceless||Ke.history.replaceState(e.routes,"",t),this[Tt](e.currentRoute.fullPath,e.routes)}[Ct](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]),i=`${encodeURIComponent(t)}=${n}`;r.length>0&&(r+="&"),r+=i}else r=e.query;this.query?(t=`${this.query}&${r}`,"?"!==t.charAt(0)&&(t=`?${t}`)):t=`?${r}`}const r=Ke.location;let n;return n=t?`${r.origin}${r.pathname}${t}#${e.fullPath}`:`${r.origin}${r.pathname}#${e.fullPath}`,n}getHash(){let e=Ke.location.hash,t=e.indexOf("#");if(-1!=t){return e.substring(t+1)}return null}getSearch(){return Ke.location.search}}var Ft,kt,_t,Mt,Nt,Kt,It,Dt,Lt,Ht,Bt,Ut,Vt,Wt,Jt,zt=Object.defineProperty,Gt=Object.defineProperties,Xt=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,Zt=Object.prototype.propertyIsEnumerable,er=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tr=(e,t)=>{for(var r in t||(t={}))Qt.call(t,r)&&er(e,r,t[r]);if(Yt)for(var r of Yt(t))Zt.call(t,r)&&er(e,r,t[r]);return e};const rr=Symbol("_constructRouteModel"),nr=Symbol("_findRouteModel"),ir=Symbol("_findRootView"),lr=Symbol("_getFirstView"),or=Symbol("_removeView"),sr=Symbol("_buildPage"),ar=Symbol("_resolveComponent"),ur=Symbol("_update"),hr=Symbol("_merge"),cr=Symbol("ignoreHistoryChangeOnceKey"),fr=Symbol("_handleHistoryChange"),pr=Symbol("_handleRouteUpdated"),dr=Symbol("routeUpdatedCallback"),yr=Symbol("currentRoutes"),mr=Symbol("current"),gr=Symbol("_addRouteRecorder"),vr=Symbol("_removeRouteRecorder"),br=Symbol("_cloneRouteRecorder"),wr=Symbol("_hanldeError"),xr=Symbol("errorCallback"),Sr=Symbol("registerKey"),Rr=Symbol("notFoundKey"),Ar=Symbol("forestKey"),jr=Symbol("historyKey"),Er=Symbol("beforeFiltersKey"),Or=Symbol("afterFiltersKey"),Pr=Symbol("destroyFiltersKey"),Cr=Symbol("mainDispatcherKey"),Tr=Symbol("initKey"),$r=Symbol("requireKey"),qr=Symbol("_createNextFn"),Fr=Symbol("_start"),kr=Symbol("_before"),_r=Symbol("_after"),Mr=Symbol("_destroy"),Nr=Symbol("_load"),Kr=Symbol("_unload"),Ir=Symbol("_loadDependency"),Dr=Symbol("resolvedModulesKey"),Lr=Symbol("resolveDependencyKey"),Hr=Symbol("routerGuardKey");class Br{constructor(t){var r;this[Ft]=new Array,this[kt]=new ke,this[_t]=new Array,this[Mt]=null,this[Nt]=null,this[Kt]=new Array,this[It]=new Array,this[Dt]=new Array,this[Lt]=new Rt,this[Ht]=new Map,this[Bt]=new Me,this[Ut]=!1,this[Vt]=e(null),this[Wt]=new At,this[Jt]=!1,this.options=null!=t?t:{};let n=this.options.routes||[];this.addRoutes(n),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),this[jr]=new qt(this.options.query,this.options.hashMonitor,this.options.traceless,this.options.defaultPath),null==(r=this[jr])||r.listen((e=>{if("string"==typeof e){let t=this[fe](e);t&&this[fr]([t])}else this[fr](e)}))}get require(){return this[$r]}get current(){return this[mr].value}[(Ft=Sr,kt=Ar,_t=yr,Mt=xr,Nt=dr,Kt=Er,It=Or,Dt=Pr,Lt=Cr,Ht=Dr,Bt=Hr,Ut=Tr,Vt=mr,Wt=$r,wr)](e="error",t){if(t&&"function"==typeof t.error)try{t.error(e)}catch(e){}if("function"==typeof this[xr])try{this[xr](e,t)}catch(e){}console.error(e)}init(){var e;!0!==this[Tr]&&(null==(e=this[jr])||e.init(),this[Tr]=!0)}[(Jt=cr,fr)](e){if(this[cr])this[cr]=!1;else try{if(!e){let e=[...this[yr]].reverse();return this[Kr](e),void Ke.location.reload()}let t=null,r=[],n=[],i=0;for(;i<e.length&&i<this[yr].length&&me.isSame(e[i],this[yr][i]);i++)e[i].opsType===we.Open&&!0===e[i].active&&e[i].active!==this[yr][i].active&&(t=e[i]);if(i<e.length&&(r=e.slice(i)),i<this[yr].length&&(n=this[yr].slice(i).reverse()),0==n.length&&0==r.length)return void(null!==t&&this.restore([t]));if(n.length>0){if(this[Kr](n)){if(r.length>0)return void this.restore(r);null!==t&&this.restore([t])}}else this.restore(r)}catch(e){this[wr](e)}}[pr](e){if(e)this[mr].value=e;else{let e=this[yr].length;this[mr].value=e>0?this[yr][e-1]:null}if("function"==typeof this[dr])try{this[dr](this[mr].value)}catch(e){}}[gr](e,t=-1){t<0||t>=this[yr].length?this[yr].push(e):this[yr].splice(t,0,e)}[br](){let e=[];for(let t of this[yr]){let r=me.clone(t,!0);e.push(r)}return e}[vr](e){if(null==this[yr])return;let t=-1;for(let r=0;r<this[yr].length;r++)if(me.isSame(this[yr][r],e)){t=r;break}if(-1!=t){let e=this[yr][t];this[yr].splice(t,1),this[Mr](e,e.session)}}set hashMonitor(e){this[jr]&&(this[jr].hashMonitor=e)}get hashMonitor(){return!!this[jr]&&this[jr].hashMonitor}set traceless(e){this[jr]&&(this[jr].traceless=e)}get traceless(){return!!this[jr]&&this[jr].traceless}onRouteUpdated(e){this[dr]=e}onError(e){this[xr]=e}beforeEach(e){this[Er].push(e)}removeBeforeEach(e){let t=this[Er].indexOf(e);return-1!==t&&(this[Er].splice(t,1),!0)}afterEach(e){this[Or].push(e)}removeAfterEach(e){let t=this[Or].indexOf(e);return-1!==t&&(this[Or].splice(t,1),!0)}destroyEach(e){this[Pr].push(e)}removeDestroyEach(e){let t=this[Pr].indexOf(e);return-1!==t&&(this[Pr].splice(t,1),!0)}setResolveDependency(e){this[Lr]=e}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){let r=this[rr](e);if(-1==t)this[Sr]=[...this[Sr],...r];else for(let e=r.length-1;e>=0;e--)this[Sr].splice(t,0,r[e])}removeRoute(e){let t=this[fe](e);if(null===t)return console.warn("route格式错误",e),!1;for(let e=0;e<this[Sr].length;e++){let r=this[Sr][e];if((null==t?void 0:t.path)&&r.path===t.path)return this[Sr].splice(e,1),!0;if((null==t?void 0:t.name)&&r.name===t.name)return this[Sr].splice(e,1),!0}return!1}hasRoute(e){let t=this[fe](e);return null===t?(console.warn("route格式错误",e),!1):-1!==this[Sr].findIndex((e=>!(!(null==t?void 0:t.path)||e.path!==t.path)||(!(!(null==t?void 0:t.name)||e.name!==t.name)||void 0)))}setNotFoundRoute(e){let t=this[rr](e);this[Rr]=t[0]}getRoutes(){return[...this[Sr]]}[rr](e){var t,r;let n=null!=(t=e.path)?t:"";n.length>0&&"/"!==n.charAt(0)&&(n=`/${n}`);let i=null!=(r=e.components)?r:e.component&&{"":e.component};if(null==i){let t=new be;return t.path=n,t.redirect=e.redirect,[t]}let l=[];for(let t in i){let r=i[t];0===t.length&&(t="default");let n=new ge(t,r,e.props,e.meta);l.push(n)}let o=!1,s=[];if(e.children)for(let t of e.children){let e=this[rr](t);for(let t of e){let e=new be;e.name=t.name,t.path&&t.path.length>0?e.path="/"!==n?`${n}${t.path}`:t.path:(o=!0,e.path=n);let r=new ve;r.models=[...l],e.layers=[r,...t.layers],s.push(e)}}if(!o){let t=new ve;t.models=l;let r=new be;r.name=e.name,r.path=n,r.layers=[t],s.splice(0,0,r)}return s}[nr](e){var t,r;let n=e.route;try{for(let i of this[Sr]){if(n.path&&i.path){let r=i.match;r||(r=i.match=oe(i.path));let l=r(n.path);if(!l)continue;if(i.redirect){let t=new me;E(!0,t,n),t.path=i.redirect;let r={route:t,find:void 0};return!!this[nr](r)&&(e.route=r.route,e.find=r.find,!0)}if(n.params=null!=(t=n.params)?t:{},E(!0,n.params,l.params),n.query){let e=n.query;if("string"==typeof e){let t={},r=e.split("&");for(let e of r){let r=e.split("=");if(2!==r.length)continue;let n=decodeURIComponent(r[0].trim()),i=decodeURIComponent(r[1].trim());t[n]=i}E(!0,n.params,t)}else"object"==typeof e&&E(!0,n.params,e)}return e.find=i,!0}if(n.name===i.name){n.params=null!=(r=n.params)?r:{};let t=le(i.path);return n.path=t(n.params),e.find=i,!0}}}catch(e){console.error(e.message,e),"function"==typeof n.error&&n.error(e.message)}return!1}[fe](e){var t,r,n;let i=null;if(Array.isArray(e))if(i=new me,"object"==typeof e[0])i=me.from(e[0]);else for(let t=0;t<e.length;t++)0===t?"/"===e[t].charAt(0)?i.path=e[t]:i.name=e[t]:1===t?i.params=e[t]:2===t?i.root=e[t]:3===t&&E(!1,i,e[t]);else"object"==typeof e?i=me.from(e):"string"==typeof e&&(i=new me,"/"==e.charAt(0)?i.path=e:i.name=e);if(i){if(i.path){let e=i.path.indexOf("?");-1!==e&&e<i.path.length-1&&(i.query=i.path.substring(e+1),i.path=i.path.substring(0,e))}i.root=null!=(t=i.root)?t:"default",i.opsType=null!=(n=null!=(r=i.opsType)?r:this.options.defaultOperationType)?n:we.Push}return i}push(...e){let t=this[fe](e);return t?(t.opsType=t.opsType||we.Push,this.to(t)):(this[wr]("resolve route fail",t),this)}put(...e){let t=this[fe](e);return t?(t.opsType=we.Put,this.to(t)):(this[wr]("resolve route fail",t),this)}replace(...e){let t=this[fe](e);return t?(t.opsType=we.Replace,this.to(t)):(this[wr]("resolve route fail",t),this)}append(...e){let t=this[fe](e);return t?(t.opsType=we.Append,this.to(t)):(this[wr]("resolve route fail",t),this)}remove(e){return new Promise((t=>{this[Cr].post((r=>{var n;try{if(0===this[yr].length)return r.resolve(),void t(!1);let i,l=-1,o=[];if(e){if(e.root)i=e.root;else{i=null!=(n=this[yr][0].root)?n:"default"}if(e.all)for(let e=this[yr].length-1;e>0;e--){let t=this[yr][e];t.opsType===we.Append&&t.root===i&&(o.splice(0,0,t),l=e-1)}else if(e.until)for(let t=this[yr].length-1;t>0;t--){let r=this[yr][t];if(r.opsType===we.Append&&r.root===i){if("/"===e.until.charAt(0)&&e.until===r.path){l=t;break}if(e.until===r.name){l=t;break}o.splice(0,0,r)}}}else{i="default";let e=this[lr](this[Ar]);e&&(i=e.name);for(let e=this[yr].length-1;e>0;e--){let t=this[yr][e];if(t.opsType===we.Append&&t.root===i){o.push(t),l=e-1;break}}}if(0===o.length){let e="can not find route";return console.warn(e),r.resolve(e),void t(!1)}let s=0;if(this[yr].forEach((e=>{e.opsType!==we.Put&&s++})),this[Kr](o)){let e=0;this[yr].forEach((t=>{t.opsType!==we.Put&&e++}));let n=s-e;this[cr]=!0,this.back(n),r.resolve(),t(!0)}}catch(e){this[wr](e),r.resolve(),t(!1)}}))}))}open(...e){let t=this[fe](e);return t?(t.opsType=we.Open,this.to(t)):(this[wr]("resolve route fail",t),this)}close(e){return this[Cr].post((t=>{var r;try{let n=this[fe](e);if(!n)return void t.reject("resolve route fail");let i=[];for(let e=0;e<this[yr].length;e++){let t=this[yr][e];if(t.root===n.root){if(n.path&&n.path===t.path){i.push(t);break}if(n.name&&n.name===t.name){i.push(t);break}}}if(0===i.length)return void t.resolve();if(this[Kr](i)){let e=me.clone(n,!0);const t=new $t(e,this[br]());null==(r=this[jr])||r.replace(t),this[pr]()}t.resolve()}catch(e){this[wr](e),t.resolve()}})),this}to(...e){let t=this[fe](e);if(!t)return this[wr]("resolve route fail",t),this;let r=this[Hr].acquire(t);return null==r?(this[wr]("route forbid",t),this):(this[Cr].post((e=>{var n;try{let i=this[Fr](t);this[kr](i),!(null==(n=i.session)?void 0:n.routeModel)&&this[Lr]&&this[Ir](i),this[Nr](i),this[_r](i),i.wait(((n,i)=>{var l,o;let s=n.session.to;try{let e=me.clone(s,!0);const t=new $t(e,this[br]());s.opsType===we.Replace?null==(l=this[jr])||l.replace(t):null==(o=this[jr])||o.push(t)}catch(e){console.error(e.message,e)}if(this[Hr].release(r),this[pr](s),"function"==typeof t.success)try{Reflect.apply(t.success,{},[])}catch(e){console.error(e.message,e)}e.resolve()}),((n,i)=>{this[Hr].release(r),this[wr](i,t),e.resolve()}))}catch(n){this[Hr].release(r),this[wr](n,t),e.resolve()}})),this)}back(e=1){var t;null==(t=this[jr])||t.go(-e)}[qr](e){return(t,r)=>{if("boolean"==typeof t)t?e.resolve():e.reject(r);else if(t){let r=this[fe](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()}}[Fr](e){let t=this[yr].length>0?this[yr][0]:void 0,r=new ye(e,t),n={route:e,find:null};return this[nr](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 Rt(r)}[kr](e){for(let t of this[Er])e.post((e=>{let r=this[qr](e);Reflect.apply(t,{},[e.session.to,e.session.from,r,e.session])}))}[_r](e){e.post((e=>{for(let t of this[Or])try{Reflect.apply(t,{},[e.session.to,e.session.from,e.session])}catch(e){console.error(e.message,e)}e.resolve()}))}[Mr](e,t){for(let r of this[Pr])try{Reflect.apply(r,{},[e,t])}catch(e){console.error(e.message,e)}"function"==typeof e.destroy&&Reflect.apply(e.destroy,e,[])}[Ir](e){let t=e.session,r=Reflect.apply(this[Lr],this,[null==t?void 0:t.to]);if(null==r)return;Array.isArray(r)||(r=[r]);let n=[];for(let e of r)this[Dr].has(e)||n.push(e);0!==n.length&&e.post((e=>{this[$r].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[Dr].set(e,!0);e.resolve()}else e.reject()}))}))}[Nr](e){e.post((e=>{var t;let r=e.session.to,n=e.session.routeModel;if(null==n){let i={route:r,find:null};if(this[nr](i))n=i.find,e.session.routeModel=n;else{if(!this[Rr])return void e.reject(`not find route model, path:${null!=(t=r.path)?t:r.name}`);n=this[Rr]}}let i=ye.from(e.session);this[sr](r,n,i).then((t=>{this[Ar],e.resolve()}),(t=>{e.reject(t)}))}))}[Kr](e){var t;if(0==e.length)return!0;let r=this[Ar],n=[];for(let t of e){let e=this[ir](r,t);null!=e&&n.push((i=tr({},e),Gt(i,Xt({route:t}))))}var i;if(0==n.length){let e="can not find view index";return this[wr](e),!1}for(let e of n.reverse())this[or](r,{x:e.x,y:e.y},[null!=(t=e.route.index)?t:0],!0);return!0}[ir](e,t){var r;let n,i=null!=(r=t.root)?r:"default";for(let t=0;t<e.layers.length;t++){let r=e.layers[t];for(let e=r.views.length-1;e>=0;e--){let l=r.views[e];if(l[Ee]&&l[Ce]===i)return n={x:e,y:t},n}}return null}[lr](e){if(e.layers.length>0&&e.layers[0].views.length>0){return e.layers[0].views[0]}return null}[or](e,t,r=null,n=!0){if(t.y>=e.layers.length)return;if(t.x>=e.layers[t.y].views.length)return;let i=e.layers[t.y].views[t.x],l=!1,o=[],s=!1,a=i.slots.value;for(let e=a.length-1;e>=0;e--){let n=a[e];null!=r&&-1==r.indexOf(n.index)||(n.route&&i[Ee]&&(this[vr](n.route),!0===n.active&&n.route.opsType==we.Append&&(s=!0)),o.push(new qe(i,n.index,t.y)),a.splice(e,1))}if(0==a.length)n?i.slots.value=[...a]:e.layers[t.y].views.splice(t.x,1);else{if(s){let e=a[a.length-1];e.active=!0,e.route&&(e.route.active=e.active)}i.slots.value=[...a]}0==e.layers[t.y].views.length&&(l=!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;(l||o.length>0)&&n>=0;n--){let i=t[n];if(i[Pe]&&(l||qe.include(o,i[Pe]))){let t=i.slots.value;for(let e=t.length-1;e>=0;e--){let n=t[e];n.route&&i[Ee]&&this[vr](n.route),r.push(new qe(i,n.index,u)),t.splice(e,1)}e.layers[u].views.splice(n,1)}}o=r,0==e.layers[u].views.length&&(l=!0)}}restore(e){if(e&&0!=this[Sr].length){return new Promise(((t,r)=>{for(let t=0;t<e.length;t++){let r=e[t];this[Cr].post((e=>{var t;let n=this[Fr](r);this[kr](n),!(null==(t=n.session)?void 0:t.routeModel)&&this[Lr]&&this[Ir](n),this[Nr](n),this[_r](n),n.wait(((t,r)=>{e.resolve()}),((t,r)=>{this[wr](r),e.resolve()}))}))}this[Cr].post((e=>{e.resolve(),t()}))}))}{let e=this[Ar];if(e.layers.length>0){let t=e.layers[0].views;t.length>0&&(t[0].slots.value=[])}return this[yr]=[],this[pr](),Promise.resolve()}}[sr](e,t,r){var n;let i=null!=(n=e.updateType)?n:Se.Part;return this[ar](t).then((()=>{this[ur](t,e,r,i)}))}[ar](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()}[ur](e,t,r,n){var i,l,o,s;if(1!==e.layers[0].models.length)return Promise.reject("illegal route structure(multil root node)");const a=e.layers[0].models[0];let u,h,c=this[Ar],f=function(e){return 0==e.layers.length||0==e.layers[0].views.length}(c),p=null!=(i=t.root)?i:"default";f||n!=Se.Part||(u=this[ir](c,t));let d=0;if(null==u||null==u)if(f||n===Se.All){if(0==c.layers[0].views.length){let e=null!=(l=t.root)?l:"default";h=new $e(e,!0,null),c.layers[0].views=[h]}else h=c.layers[0].views[0];u={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>c.layers.length)return Promise.reject("can not insert view(override level)");if(e.rootName){let t=c.layers[n-1];for(let i of t.views){if(i[Ee]&&i.name===e.rootName){r=new qe(i,null!=(o=e.rootIndex)?o:0,n-1);break}if(i[Oe]&&i[Oe].view.name===e.rootName&&i[Oe].index===e.rootIndex){r=i[Oe];break}}}if(!r)return Promise.reject("can not insert view(not find root node ref)");h=new $e(p,!0,r),c.layers[n].views.push(h),u={x:c.layers[n].views.length-1,y:n}}else h=c.layers[u.y].views[u.x];if(d=u.y,h[Ee]=!0,t.opsType===we.Append){t.index=C.get();let r=h.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 Te(t,a,t.index,!0);h.slots.value=[...r,n];let i=d+1,l=1,o=new qe(h,t.index,d);this[hr](c,i,e,l,o)}else if(t.opsType===we.Open){let r=h.slots.value,n=!1;for(let e of r){if(null!==e.route&&me.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[vr](e.route)}else e.active=!1;e.route&&(e.route.active=e.active)}if(!n){t.index=C.get(),t.active=!0;let n=new Te(t,a,t.index,!0);r.push(n);let i=d+1,l=1,o=new qe(h,t.index,d);this[hr](c,i,e,l,o)}h.slots.value=[...r]}else{let r=h.slots.value;if(0==r.length){t.index=C.get(),h.slots.value=[new Te(t,a,t.index)];let r=d+1,n=1,i=new qe(h,t.index,d);this[hr](c,r,e,n,i)}else{let n=r[0];if(n.model!==a){this[or](c,u,null,!0),t.index=C.get(),h.slots.value=[new Te(t,a,t.index)];let r=d+1,n=1,i=new qe(h,t.index,d);this[hr](c,r,e,n,i)}else{null!==n.route&&this[vr](n.route);let i=[];for(let e=1;e<r.length;e++)i.push(r[e].index);i.length>0&&this[or](c,u,i,!0),t.index=n.index,n.route=t;let l=[new qe(h,t.index,d)],o=d+1,s=1,a=new qe(h,t.index,d);for(;l.length>0&&o<c.layers.length&&s<e.layers.length;o++,s++){let t=[];for(let e=0;e<c.layers[o].views.length;e++){let r=c.layers[o].views[e];r[Pe]&&qe.include(l,r[Pe])&&t.unshift(e)}let r=[];for(let n of t){let t,i=c.layers[o].views[n],l=e.layers[s].models;for(let e=0;e<l.length;e++)if(i.name===l[e].name){t=l[e];break}if(t){let l=i.slots.value;if(0==l.length){let r=0;i.slots.value=[new Te(null,t,r)];let n=o+1,l=s+1;this[hr](c,n,e,l,a)}else{let u=l[0];if(u.model!==t){this[or](c,{x:n,y:o},null,!0),i.slots.value=[new Te(null,t,0)];let r=o+1,l=s+1;this[hr](c,r,e,l,a)}else{i[Ee]&&null!==u.route&&this[vr](u.route);let e=[];for(let t=1;t<l.length;t++)e.push(l[t].index);e.length>0&&this[or](c,{x:n,y:o},e,!0),r.push(new qe(i,u.index,o))}}i[Ee]=!1}else this[or](c,{x:n,y:o},null,!1)}l=r}this[hr](c,o,e,s,a)}}}if(h&&h[Oe]){let e=h[Oe];e&&(t.slot=new de(p,d,null==e?void 0:e.view.name,null!=(s=null==e?void 0:e.index)?s:0))}r.to=void 0,r.routeModel=void 0,t.session=r,this[gr](t)}[hr](e,t,r,n,i){let l=n,o=t;for(;o<e.layers.length&&l<r.layers.length;o++,l++){let t=e.layers[o].views;for(let e of r.layers[l].models){let r=new $e(e.name,!1,i),n=new Te(null,e);r.slots.value=[n],t.push(r)}}for(;l<r.layers.length;l++){let t=new Fe;t.views=[];for(let e of r.layers[l].models){let r=new $e(e.name,!1,i),n=new Te(null,e);r.slots.value=[n],t.views.push(r)}e.layers.push(t)}}[ce](e,t,r,n,i,l){var o,s;if(t<0||t>this[Ar].layers.length)return null;if(t<this[Ar].layers.length){let a=this[Ar].layers[t],u=null;for(let h of a.views){let a=!1;if(null!==r?(a=h.name===e&&(null==(o=h[Oe])?void 0:o.view)===r,a&&-1!==n&&(a=(null==(s=h[Oe])?void 0:s.index)===n)):a=h.name===e,a){null!==i&&(h[Pe]={view:i,index:l,level:t-1}),u=h;break}}if(null!==u)return u}let a=null,u=null;null!==i&&(a=i[Ee]?{view:i,index:l,level:t-1}:i[Oe],u={view:i,index:l,level:t-1});let h=new $e(e,!0,a);if(h[Pe]=u,t==this[Ar].layers.length){let e=new Fe;e.views=[h],this[Ar].layers.push(e)}else this[Ar].layers[t].views.push(h);return h}}var Ur,Vr,Wr;(Wr=Vr||(Vr={}))[Wr.limitless=0]="limitless",Wr[Wr.once=1]="once";const Jr=Symbol("registerKey");class zr{constructor(e,t){this.callback=e,this.policy=t}}class Gr{constructor(){this[Ur]=new Map}on(e,t,r=!1){let n=this[Jr].get(e);n||(n=new Array,this[Jr].set(e,n));let i=new zr(t,!0===r?1:0);return n.push(i),this}off(e,t){if(!t)return this[Jr].delete(e),this;let r=this[Jr].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,i=new Array(n),l=[].splice.call(e,0,n);for(let e=0;e<l.length;e++)this.once(l[e],(t=>{i[e]=t,n-=1,0==n&&Reflect.apply(r,{},i)}));return this}emit(e,...t){let r=this[Jr].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{$((()=>{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])}}var Xr;Ur=Jr;const Yr=Symbol("registerKey");class Qr{constructor(){this[Xr]=new Map}set(e,t){this[Yr].set(e,t)}get(e){return this[Yr].get(e)}has(e){return this[Yr].has(e)}delete(e){return this[Yr].delete(e)}}Xr=Yr;const Zr=Symbol("lc");function en(e,t=!1){let r=e,n=r[Zr];if(!n){if(!t)return null;n=new Qr,r[Zr]=n}return n}function tn(e,t){let r=e;for(;null!==r;){let e=r[Zr];if(e&&e.has(t))return e.get(t);r=r.$parent}return null}function rn(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 en(t.component.proxy,!1)}return null}const nn=Symbol("hooksKey");function ln(e,t){let r=e.get(nn);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 on,sn;(sn=on||(on={})).DEACTIVATED="da",sn.ACTIVATED="a";class an{constructor(e,t,r){this.target=r,this.hook=t,this.type=e}}function un(e){return(t,r)=>{let n;if(r)n=r;else{let e=i();if(null==e||null==e.proxy)return void console.error("can not get currrent instance or proxy");n=e.proxy}let o=tn(n,nn);null!=o?(l((()=>{!function(e,t,r,n){let i=-1;for(let l=0;l<e.length;l++){let o=e[l];if(o.type===t&&o.hook===r&&o.target===n){i=l;break}}-1!=i&&e.splice(i,1)}(o,e,t,n)})),function(e,t,r,n){let i=new an(t,r,n);e.push(i)}(o,e,t,n)):console.warn("can not get hooks context")}}let hn=un(on.ACTIVATED),cn=un(on.DEACTIVATED);const fn=Symbol("routeKey");function pn(e,t){let r=e.get(fn);if(r){let e={path:"",name:"",params:{},index:-1,session:{}};Object.assign(e,t),Object.assign(r,e)}else r=function(){let e=new me;return e.path="",e.name="",e.params={},e.index=-1,o(e)}(),Object.assign(r,t),e.set(fn,r)}function dn(e){let t=tn(e,fn);return null!=t?t:null}const yn=Symbol("rk"),mn=Symbol("vd"),gn=Symbol("rv"),vn=Symbol("rvi"),bn=Symbol("pv"),wn=Symbol("pvi");function xn(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.showFromClass)?r:e.enterFromClass,n||(n=e.transitionName,n?t?`${n}-show-from`:`${n}-enter-from`:null)}function Sn(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.showActiveClass)?r:e.enterActiveClass,n||(n=e.transitionName,n?t?`${n}-show-active`:`${n}-enter-active`:null)}function Rn(e){var t,r,n,i;let l,o=e.duration;return"object"==typeof o?l={enter:null!=(t=o.enter)?t:-1,leave:null!=(r=o.leave)?r:-1,show:null!=(n=o.show)?n:-1,hide:null!=(i=o.hide)?i:-1}:("string"==typeof o&&(o=0==o.length?-1:Number(o)),l={enter:o,leave:o,show:o,hide:o}),l}function An(e,t){e.classList.contains(t)||e.classList.add(t)}function jn(e,t){e.classList.remove(t)}const En=Ne&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function On(e){En(e)}function Pn(e,t,...r){y(t)&&(null==e&&(e={}),Reflect.apply(t,e,r))}function Cn(e,t,r,n=-1,i,l,o,s){if(y(l)){if(void 0!==i&&i>=0)return void setTimeout((()=>{Reflect.apply(l,e,[t,r,n]),y(s)&&Reflect.apply(s,e,[])}),i);let o=["animationend","transitionend"],a=i=>{o.forEach((e=>{Le(t,e,a)})),Reflect.apply(l,e,[t,r,n]),s&&Reflect.apply(s,e,[])};o.forEach((e=>{De(t,e,a)}))}if(y(o)){let i="animationcancel",l=s=>{Reflect.apply(o,e,[t,r,n]),Le(t,i,l)};De(t,i,l)}}function Tn(e){return null!==e&&(e.opsType===we.Append||e.opsType===we.Open)}function $n(e,t,r,n,i={},l,o=-1){if(t&&(r||Tn(l))){let e=xn(i,r);e&&An(n,e);let t=Sn(i,r);t&&An(n,t)}else{Pn(e,function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onBeforeShow)?r:e.onBeforeEnter,n}(i,r),[n,l,o])}}function qn(e,t,r,n,i={},l,o,s,a){if(Tn(o)||r)if(t){let t=xn(i,r),u=Sn(i,r),h=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.showToClass)?r:e.enterToClass,n||(n=e.transitionName,n?t?`${n}-show-to`:`${n}-enter-to`:null)}(i,r);On(h?()=>{Cn(e,n,o,s,l,(()=>{u&&jn(n,u),h&&jn(n,h),y(a)&&a(e,a,[n])})),t&&jn(n,t),h&&An(n,h)}:()=>{t&&jn(n,t),u&&jn(n,u),y(a)&&a(e,a,[n])})}else{let t=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onShow)?r:e.onEnter,n}(i,r),l=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onAfterShow)?r:e.onAfterEnter,n}(i,r),u=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onShowCancelled)?r:e.onEnterCancelled,n}(i,r),h=t=>{!t&&y(l)?Pn(e,l,[n,o,s]):y(u)&&Pn(e,u,[n,o,s]),y(a)&&a(e,a,[n])};y(t)?Pn(e,t,[n,h,o,s]):h()}else y(a)&&a(e,a,[n])}function Fn(e,t,r,n,i={},l,o,s,a,u){if(Tn(s)||r)if(t){let t=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.hideFromClass)?r:e.leaveFromClass,n||(n=e.transitionName,n?t?`${n}-hide-from`:`${n}-leave-from`:null)}(i,r),h=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.hideActiveClass)?r:e.leaveActiveClass,n||(n=e.transitionName,n?t?`${n}-hide-active`:`${n}-leave-active`:null)}(i,r),c=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.hideToClass)?r:e.leaveToClass,n||(n=e.transitionName,n?t?`${n}-hide-to`:`${n}-leave-to`:null)}(i,r);t&&An(n,t),h&&An(n,h),On(c?()=>{Cn(e,n,s,a,l,(()=>{h&&jn(n,h),c&&jn(n,c),y(u)&&Pn(e,u,[n]),!r&&y(o)&&o()})),t&&jn(n,t),c&&An(n,c)}:()=>{t&&jn(n,t),h&&jn(n,h),y(u)&&Pn(e,u,[n]),!r&&y(o)&&o()})}else{let t=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onHide)?r:e.onLeave,n}(i,r),l=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onAfterHide)?r:e.onAfterLeave,n}(i,r),h=function(e,t=!1){var r;let n=null;return n=t&&null!=(r=e.onHideCancelled)?r:e.onLeaveCancelled,n}(i,r),c=t=>{!t&&y(l)?(Pn(e,l,[n,s,a]),y(u)&&Pn(e,u,[n]),!r&&y(o)&&o()):y(h)&&(Pn(e,h,[n,s,a]),y(u)&&Pn(e,u,[n]))};y(t)?Pn(e,t,[n,c,s,a]):c()}else!r&&y(o)&&o()}function kn(e,t={},r,n=-1){var i;let l=q(t.css),o=null!=(i=t.mode)?i:"default",s=Rn(t);return{mode:o,persisted:!1,beforeEnter:i=>{$n(e,l,!1,i,t,r,n)},enter:i=>{qn(e,l,!1,i,t,s.enter,r,n)},leave:(i,o)=>{Fn(e,l,!1,i,t,s.leave,o,r,n)},clone:i=>kn(e,t,r,n)}}function _n(e){return e.el}function Mn(e,t,r={},n,i,l,o){if(l){let l=_n(t);if(null==l)return;let s=q(r.css),a=Rn(r);$n(e,s,!0,l,r,n,i),qn(e,s,!0,l,r,a.show,n,i,(t=>{y(o)&&Pn(e,o,[t])}))}else y(o)&&Pn(e,o,[])}function Nn(e,t,r={},n,i,l,o){if(l){let l=_n(t);if(null==l)return;let s=q(r.css),a=Rn(r);Fn(e,s,!0,l,r,a.hide,null,n,i,(t=>{y(o)&&Pn(e,o,[t])}))}else y(o)&&Pn(e,o,[])}function Kn(e,t,r){return"function"==typeof e?Reflect.apply(e,{},[t,r]):e}class In{constructor(e,t){this.node=e,this.state=t}}let Dn=s({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){var r,n;let o=i();if(null===o||null===o.proxy)return void console.error("instance or instance.proxy not exist");const s=!0===e.multi,c=a(yn,null),f=a(mn,0),p=a(gn,null),d=a(vn,-1);let y=!1,m=null;const g=e.modelSlot;if(g){u(mn,f+1),u(vn,g.index),u(wn,g.index);let e=g.route;if(!e)return void console.warn("child view render error, route not exist");let t=en(o.proxy,!0);!function(e){let t=e.get(nn);t||(t=[],e.set(nn,t))}(t),pn(t,e)}else{if(null==c)return void console.error("router is not been injected");let t=e.name,i=a(bn,null),l=a(wn,0);if(m=c[ce](t,f,p,d,i,l),null===m)return;u(bn,m);if(!0===m[Ee]&&u(gn,m),s)y=q(null==(n=e.transition)||n);else{y=q(null!=(r=e.transition)&&r),u(vn,-1),u(mn,f+1),u(wn,-1);let t=m.slots.value;if(t.length>0){let e=t[0].route;if(e){pn(en(o.proxy,!0),e)}}else{let e=en(o.proxy,!0);m.compensation=()=>{let t=m.slots.value;if(t.length>0){let r=t[0].route;return r&&pn(e,r),!0}return!1}}}}let v=new Map;return l((()=>{v&&v.clear()})),()=>{var r,n,i,l,a,u;if(s){let i=new Map,l=[],s=null==m?void 0:m.slots.value,a=[];for(let t=0;t<s.length;t++){let u=s[t],c=`${e.name}-${u.index}`,f=h(Dn,{modelSlot:u}),p={},d=Kn(e.viewClass,u.route,t);"string"==typeof d&&d.length>0&&(p[d]=!0);let m=Kn(e.viewActiveClass,u.route,t),g=Kn(e.viewDeactiveClass,u.route,t),b=v.get(c);if("string"==typeof m&&m.length>0&&(p[m]=u.active),"string"==typeof g&&g.length>0&&(p[g]=!u.active),b&&u.active!==b.state){let r=b.node;u.active?a.unshift((()=>{Mn(o,r,e,u.route,t,y,(()=>{let e=rn(r);null!=e&&ln(e,on.ACTIVATED)}))})):a.push((()=>{Nn(o,r,e,u.route,t,y,(()=>{let e=rn(r);null!=e&&ln(e,on.DEACTIVATED)}))}))}let w={class:p,key:c},x=Kn(e.viewTagProps,u.route,t);null!==x&&"object"==typeof x&&E(!0,w,x),(null==(r=u.route)?void 0:r.viewTagAttrs)&&"object"==typeof(null==(n=u.route)?void 0:n.viewTagAttrs)&&E(!0,w,u.route.viewTagAttrs);let S=Kn(e.viewTag,u.route,t),R=h(S,w,{default:()=>[f]});if(i.set(c,new In(R,u.active)),y){let r=kn(o,e,u.route,t);R.transition=r}l.push(R)}v=i,function(e,t={}){On((()=>{for(let r=0;r<e.length;r++)Reflect.apply(e[r],t,[])}))}(a,o);let u=Kn(e.tag,null,-1),c={};return Object.assign(c,t.attrs),h(u,c,{default:()=>l})}if(null!=g){let e=g.model,t={};return e.props&&("object"==typeof e.props?E(!1,t,e.props):!0===e.props&&"object"==typeof(null==(i=g.route)?void 0:i.params)&&E(!1,t,null==(l=g.route)?void 0:l.params)),h(e.component,t)}{let t=m.slots.value;if(t.length>0){let r=t[0],n=r.model,i={};n.props&&("object"==typeof n.props?E(!1,i,n.props):!0===n.props&&"object"==typeof(null==(a=r.route)?void 0:a.params)&&E(!1,i,null==(u=r.route)?void 0:u.params));let l=h(n.component,i);if(y){let t=kn(o,e,r.route,-1);l.transition=t}return l}}}}});function Ln(e,t){return"function"==typeof e?Reflect.apply(e,{},[t]):e}let Hn=s({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(yn,null);return()=>{let n=Ln(e.to,null),i=Ln(e.tag,n);if(null==i)return void console.warn("can not resolve link tag");let l=null,o=null;null!==r&&(l=r[fe](n),o=r.current);let s={},a=Ln(e.activeClass,l);if("string"==typeof a&&a.length>0&&(s[a]=function(e,t){return!!(null!=e&&null!=t&&(e.path&&t.path&&t.path.startsWith(e.path)||e.name&&e.name==t.name))}(l,o)),!0===Ln(e.exact,l)){let t=Ln(e.exactActiveClass,l);"string"==typeof t&&t.length>0&&(s[t]=function(e,t){return!!(null!=e&&null!=t&&(e===t||e.path&&e.path===t.path||e.name&&e.name===t.name))}(l,o))}let u={class:s};E(!0,u,t.attrs);let c=Ln(e.event,l);if("string"==typeof c){const e=e=>{null!=r?null!=l?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(l):console.warn("route is not been resolved"):console.warn("router is not been injectd")};u[c]=e}return h(i,u,t.slots)}}}),Bn={get each(){return D},get type(){return _},get isFunction(){return y},get isArray(){return c},get isArrayLike(){return N},get makeArray(){return I},get merge(){return K},get isWindow(){return M},get isPlainObject(){return S},get isEqual(){return L}};var Un=Object.defineProperty,Vn=Object.defineProperties,Wn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertySymbols,zn=Object.prototype.hasOwnProperty,Gn=Object.prototype.propertyIsEnumerable,Xn=(e,t,r)=>t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;const Yn=Symbol("fk"),Qn=Symbol("fbk"),Zn=Symbol("fepk");function ei(e={}){const t=new Br(e),r=new ne,n=new Gr,i=(l=((e,t)=>{for(var r in t||(t={}))zn.call(t,r)&&Xn(e,r,t[r]);if(Jn)for(var r of Jn(t))Gn.call(t,r)&&Xn(e,r,t[r]);return e})({},Bn),Vn(l,Wn({get router(){return t},get bus(){return r},get Bus(){return ne},get eventproxy(){return n},get EventProxy(){return Gr},get EventChain(){return Rt},get require(){return t.require},get request(){return Xe},get extend(){return E},get clone(){return O},install(e){e.provide(yn,t),e.provide(Yn,i),e.provide(Qn,r),e.provide(Zn,n),e.component("fox-router-view",Dn),e.component("fox-router-link",Hn),Reflect.defineProperty(e.config.globalProperties,"$fox",{get:()=>i}),Reflect.defineProperty(e.config.globalProperties,"$router",{get:()=>t}),Reflect.defineProperty(e.config.globalProperties,"$bus",{get:()=>r}),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 dn(this)}},created(){t.init()}})}})));var l;return i}function ti(){return a(yn)}function ri(){let e=i();return null===e||null===e.proxy?null:dn(e.proxy)}function ni(){return a(Yn,null)}function ii(){return a(Qn,null)}function li(){return a(Zn,null)}function oi(e){const t=ti(),r=(t,r,n)=>{try{Reflect.apply(e,{},[t,r])}catch(e){console.error(e)}n()};t.beforeEach(r),l((()=>{t.removeBeforeEach(r)}))}function si(e){const t=ti(),r=(t,r,n)=>{try{Reflect.apply(e,{},[t,r])}catch(e){console.error(e)}n()};t.afterEach(r),l((()=>{t.removeAfterEach(r)}))}export{ne as Bus,Rt as EventChain,Gr as EventProxy,me as Route,Br as Router,Ye as cancel,O as clone,ei as createFox,E as extend,c as isArray,d as isDate,A as isESModule,L 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,si as onAfterRouteUpdate,oi as onBeforeRouteUpdate,hn as onFoxActivated,cn as onFoxDeactivated,Xe as request,q as toBoolean,F as toNumber,x as toTypeString,ii as useBus,li as useEventProxy,ni as useFox,ri as useRoute,ti as useRouter};
1
+ import{ref as e,effectScope as t,watch as r,shallowRef as n,getCurrentInstance as i,onUnmounted as s,shallowReactive as o,defineComponent as l,inject as a,provide as u,h}from"vue";const c=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,w=e=>v(e)&&y(e.then)&&y(e.catch),b=Object.prototype.toString,x=e=>b.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 E="undefined"!=typeof Promise&&-1!==Promise.toString().indexOf("[native code]");function C(...e){let t=void 0!==e[0]&&null!==e[0]?e[0]:{},r=1,n=e.length,i=!1;for("boolean"==typeof t&&(i=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===i&&s&&"object"==typeof s){let n;n=Array.isArray(s)?r&&Array.isArray(r)?r:[]:r&&"object"==typeof r?r:{},t[e]=C(i,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 i=e[n],s=t[n];if(i!==s)if("object"==typeof s){if(!Array.isArray(s)&&!S(s))continue;i=j(i,s,r),e[n]=i}else{if("function"==typeof s)continue;e[n]=s}}const n=Object.getOwnPropertySymbols(t);for(let i of n){let n=e[i],s=t[i];if(n!==s)if("object"==typeof s){if(!Array.isArray(s)&&!S(s))continue;n=j(n,s,r),e[i]=n}else{if("function"==typeof s)continue;e[i]=s}}}else C(!0,e,t);return e}const T=class{static get(){let e=++T.seed;return e>=Number.MAX_VALUE&&(T.seed=0),e}};let P=T;P.seed=(new Date).getTime();const $=E?Promise.resolve():null;function O(e,...t){null!==$?t&&t.length>0?$.then((()=>{e(t)})):$.then(e):t&&t.length>0?setTimeout((()=>{e(t)})):setTimeout(e)}function q(e){return null!=e&&("boolean"==typeof e?e:"string"==typeof e?"true"===e.toLocaleLowerCase():Boolean(e))}function F(e){return"number"==typeof e?e:Number(e)}const k={"[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 _(e){let t=Object.prototype.toString.call(e);return null==e?String(e):k[t]||"object"}function M(e){return e&&"object"==typeof e&&"setInterval"in e}function N(e){let t=!!e&&"length"in e&&e.length,r=_(e);return"function"!==r&&!M(e)&&("array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e)}function K(e,t){let r=+t.length,n=0,i=e.length;for(;n<r;n++)e[i++]=t[n];return e.length=i,e}function I(e,t=[]){let r=t;return null!=e&&(N(Object(e))?K(r,"string"==typeof e?[e]:e):r.push(e)),r}function L(e,t,r){if(N(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 D(e,t){if(e==t)return!0;if(void 0===e||void 0===t)return!1;let r=_(e);if(r!==_(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 i=r[n];if(!D(e[i],t[i]))return!1}return!0}if("array"===r){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){if(!D(e[r],t[r]))return!1}return!0}return!1}var H,B,U;const V=Symbol("idKey"),W=Symbol("valueKey"),J=Symbol("childrenKey"),z=Symbol("growKey");class G{constructor(t){this[H]=!0,this[B]=e(),this[U]=new Map,this[V]=t}}H=z,B=W,U=J;class X{get(e,t){if("value"==t)return e[W].value;if("grow"===t)return e[z];let r=e[J].get(t);return r?Q(r):e[z]?(r=Y(t),r[z]=e[z],e[J].set(t,r),Q(r)):void 0}set(e,t,r){return"value"==t?(e[W].value=r,!0):"grow"===t?(e[z]=q(r),!0):null==r?(e[J].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[J].delete(t),!0)}}function Y(e){let t=new G(e);return Reflect.set(t,"__proxy__",new Proxy(t,new X)),t}function Q(e){return Reflect.get(e,"__proxy__")}class Z extends G{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,i=e[n];r[J].has(i)?t=r[J].get(i):(t=Y(i),r[J].set(i,t)),r=t}return r[W].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[J].has(t))return;r=r[J].get(t)}return r[W].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[J].has(t))return!1;r=r[J].get(t)}let n=e[t-1];return!!r[J].has(n)&&(r[J].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[J].has(t))return!1;r=r[J].get(t)}let n=e[t-1];return r[J].has(n)}clear(){this[J].clear()}}const ee=["put","get","contains","remove","clear"];function te(e){return ee.includes(e)}class re{get(e,t){if("value"==t)return e[W].value;if("grow"===t)return e[z];if(t===J)return e[J];if("string"==typeof t&&te(t))return e[t];let r=String(t),n=e[J].get(r);return n?Q(n):e[z]?(n=Y(r),n[z]=e[z],e[J].set(r,n),Q(n)):void 0}set(e,t,r){return"value"==t?(e[W].value=r,!0):"grow"===t?(e[z]=q(r),!0):!te(t)&&(null==r?(e[J].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[J].delete(t),!0)}}let ne=new Proxy(Z,{construct:(e,...t)=>Q(function(){let e=new Z,t=new re,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 ie(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 i=1,s="";if("?"===e[l=r+1])throw new TypeError('Pattern cannot start with "?" at '+l);for(;l<e.length;)if("\\"!==e[l]){if(")"===e[l]){if(0==--i){l++;break}}else if("("===e[l]&&(i++,"?"!==e[l+1]))throw new TypeError("Capturing groups are not allowed at "+l);s+=e[l++]}else s+=e[l++]+e[l++];if(i)throw new TypeError("Unbalanced pattern at "+r);if(!s)throw new TypeError("Missing pattern at "+r);t.push({type:"PATTERN",index:r,value:s}),r=l}else{for(var o="",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;o+=e[l++]}if(!o)throw new TypeError("Missing parameter name at "+r);t.push({type:"NAME",index:r,value:o}),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,i=void 0===n?"./":n,s="[^"+le(t.delimiter||"/#?")+"]+?",o=[],l=0,a=0,u="",h=function(e){if(a<r.length&&r[a].type===e)return r[a++].value},c=function(e){var t=h(e);if(void 0!==t)return t;var n=r[a],i=n.type,s=n.index;throw new TypeError("Unexpected "+i+" at "+s+", expected "+e)},f=function(){for(var e,t="";e=h("CHAR")||h("ESCAPED_CHAR");)t+=e;return t};a<r.length;){var p=h("CHAR"),d=h("NAME"),y=h("PATTERN");if(d||y){var m=p||"";-1===i.indexOf(m)&&(u+=m,m=""),u&&(o.push(u),u=""),o.push({name:d||l++,prefix:m,suffix:"",pattern:y||s,modifier:h("MODIFIER")||""})}else{var g=p||h("ESCAPED_CHAR");if(g)u+=g;else if(u&&(o.push(u),u=""),h("OPEN")){m=f();var v=h("NAME")||"",w=h("PATTERN")||"",b=f();c("CLOSE"),o.push({name:v||(w?l++:""),pattern:v&&!w?s:w,prefix:m,suffix:b,modifier:h("MODIFIER")||""})}else c("END")}}return o}function se(e,t){return function(e,t){void 0===t&&(t={});var r=ae(t),n=t.encode,i=void 0===n?function(e){return e}:n,s=t.validate,o=void 0===s||s,l=e.map((function(e){if("object"==typeof e)return new RegExp("^(?:"+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,h="*"===s.modifier||"+"===s.modifier;if(Array.isArray(a)){if(!h)throw new TypeError('Expected "'+s.name+'" to not repeat, but got an array');if(0===a.length){if(u)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var c=0;c<a.length;c++){var f=i(a[c],s);if(o&&!l[n].test(f))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but got "'+f+'"');r+=s.prefix+f+s.suffix}}else if("string"!=typeof a&&"number"!=typeof a){if(!u){var p=h?"an array":"a string";throw new TypeError('Expected "'+s.name+'" to be '+p)}}else{f=i(String(a),s);if(o&&!l[n].test(f))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but got "'+f+'"');r+=s.prefix+f+s.suffix}}else r+=s}return r}}(ie(e,t),t)}function oe(e,t){var r=[];return function(e,t,r){void 0===r&&(r={});var n=r.decode,i=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],o=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 i(e,r)})):l[r.name]=i(n[e],r)},u=1;u<n.length;u++)a(u);return{path:s,index:o,params:l}}}(he(e,r,t),r,t)}function le(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function ae(e){return e&&e.sensitive?"":"i"}function ue(e,t,r){return function(e,t,r){void 0===r&&(r={});for(var n=r.strict,i=void 0!==n&&n,s=r.start,o=void 0===s||s,l=r.end,a=void 0===l||l,u=r.encode,h=void 0===u?function(e){return e}:u,c="["+le(r.endsWith||"")+"]|$",f="["+le(r.delimiter||"/#?")+"]",p=o?"^":"",d=0,y=e;d<y.length;d++){var m=y[d];if("string"==typeof m)p+=le(h(m));else{var g=le(h(m.prefix)),v=le(h(m.suffix));if(m.pattern)if(t&&t.push(m),g||v)if("+"===m.modifier||"*"===m.modifier){var w="*"===m.modifier?"?":"";p+="(?:"+g+"((?:"+m.pattern+")(?:"+v+g+"(?:"+m.pattern+"))*)"+v+")"+w}else p+="(?:"+g+"("+m.pattern+")"+v+")"+m.modifier;else p+="("+m.pattern+")"+m.modifier;else p+="(?:"+g+v+")"+m.modifier}}if(a)i||(p+=f+"?"),p+=r.endsWith?"(?="+c+")":"$";else{var b=e[e.length-1],x="string"==typeof b?f.indexOf(b[b.length-1])>-1:void 0===b;i||(p+="(?:"+f+"(?="+c+"))?"),x||(p+="(?="+f+"|"+c+")")}return new RegExp(p,ae(r))}(ie(e,r),t,r)}function he(e,t,r){return e instanceof RegExp?function(e,t){if(!t)return e;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=r.exec(e.source);i;)t.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=r.exec(e.source);return e}(e,t):Array.isArray(e)?function(e,t,r){var n=e.map((function(e){return he(e,t,r).source}));return new RegExp("(?:"+n.join("|")+")",ae(r))}(e,t,r):ue(e,t,r)}const ce=Symbol("sync"),fe=Symbol("resolveRoute");function pe(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}class de{constructor(e,t,r,n){this.rootIndex=0,this.name=e,this.level=t,this.rootName=r,this.rootIndex=n}}class ye{constructor(e,t){this.data={},this.to=e,this.from=t}static from(e){let t=new ye(e.to,e.from),r=e.data??{};return C(!0,t.data,r),t}}class me{get fullPath(){let e=this.path??`/${this.name}`;return`${this.root??"default"}!${e}`}static clone(e,t){let r=new me;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 me;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 ge{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 i=pe((t=>{A(t)&&(t=t.default),e.component=t,console.debug("success load async module"),r()})),s=pe((e=>{console.debug("reject load async module"),n(e)}));let o;try{o=t(i,s)}catch(e){s(e)}if(o)if("function"==typeof o.then)o.then(i,s);else{const e=o.component;e&&"function"==typeof e.then&&e.then(i,s)}}))}(this)}}class ve{constructor(){this.models=[]}}class we{constructor(){this.layers=[]}}var be,xe,Se,Re,Ae,Ee;(xe=be||(be={}))[xe.Push=0]="Push",xe[xe.Replace=1]="Replace",xe[xe.Put=2]="Put",xe[xe.Append=3]="Append",xe[xe.Open=4]="Open",(Re=Se||(Se={}))[Re.Part=0]="Part",Re[Re.All=1]="All";const Ce=Symbol("rootKey"),je=Symbol("rootNodeKey"),Te=Symbol("parentNodeKey"),Pe=Symbol("nameKey");class $e{constructor(e,t,r=0,n=!0){this.instance=null,this.active=!0,this.index=0,this.route=e,this.model=t,this.index=r,this.active=n}}class Oe{constructor(e,t,r){this.scope=null,this[Ae]=null,this[Ee]=null,this[Pe]=e,this[Ce]=t,r&&(this[je]=r)}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)}))}))}get slots(){return null==this._slots&&(this._slots=n([])),this._slots}get empty(){return null==this._slots||0==this._slots.value.length}get name(){return this[Pe]}}Ae=je,Ee=Te;class qe{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 Fe{constructor(){this.views=[]}}class ke{constructor(){this.layers=[]}}class _e{}class Me{constructor(){this.forbidTime=300,this.submitRecorder=new _e}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 Ne=void 0!==typeof window,Ke=window,Ie=window.document;function Le(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function De(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}let He=function(){let e=Ke.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 Be={method:"POST",headers:{"Content-Type":"application/json; charset=UTF-8"},mode:"cors",credentials:"same-origin",cache:"default",redirect:"follow",keepalive:!0},Ue=new Map;async function Ve(e){let{id:t,method:r="POST",url:n,headers:i={},data:s,processData:o=!0,timeout:l=-1}=e;if(t&&Ue.has(t))throw new Error("resubmit");r=r.toUpperCase();let{contentType:a="application/json; charset=UTF-8"}=i,u=C(!0,{...Be},{method:r,headers:i});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 i=`${encodeURIComponent(e)}=${encodeURIComponent(r[t])}`;n.length>0&&(n+="&"),n+=i}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):(o&&(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 i=`${encodeURIComponent(t)}=${encodeURIComponent(n[e])}`;r.length>0&&(r+="&"),r+=i}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}Ue.set(t,r)}try{let e,r=await fetch(n,u),i={};r.headers.forEach(((e,t)=>{i[e]=t}));let s=i["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:i,data:e,response:r}}catch(e){throw e}finally{if(t){let e=Ue.get(t);e&&(e.timer&&(clearTimeout(e.timer),e.timer=null),Ue.delete(t))}}}function We(e){let t=Ue.get(e);return!!t&&(t.timer&&(clearTimeout(t.timer),t.timer=null),t.controller.abort(),Ue.delete(e),!0)}class Je{constructor(){this.cache=new Map}async get(e,t=-1){if(this.cache.has(e)){return this.cache.get(e)}let r=await Ve({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 ze,Ge,Xe,Ye,Qe,Ze,et,tt,rt,nt,it,st;(Ge=ze||(ze={}))[Ge.Loading=0]="Loading",Ge[Ge.Loaded=1]="Loaded",Ge[Ge.Defining=2]="Defining",Ge[Ge.Defined=3]="Defined";class ot{}class lt{constructor(){this.register=new Map}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()}}(st=it||(it={})).Busy="Busy",st.Free="Free",st.Reject="Reject",st.Exception="Exception",st.Finished="Finished";const at=Symbol("chainKey"),ut=Symbol("cursorKey"),ht=Symbol("$persistentModeKey"),ct=Symbol("statusKey"),ft=Symbol("argsKey"),pt=Symbol("exArgsKey"),dt=Symbol("successFnsKey"),yt=Symbol("errorFnsKey"),mt=Symbol("sessionKey"),gt=Symbol("_go");class vt{constructor(e,t=!1){this[Xe]=[],this[Ye]=0,this[Qe]=!1,this[Ze]=it.Free,this[et]=[],this[tt]=[],this[rt]=[],this[nt]=[],this[mt]=e,this[ht]=t}get session(){return this[mt]}[(Xe=at,Ye=ut,Qe=ht,Ze=ct,et=ft,tt=pt,rt=dt,nt=yt,gt)](e,...t){let r=this[ct];if(this[ct]=it.Busy,this[ut]+=e,this[ut]<0&&(this[ut]=0),this[ft]=t,r===it.Exception||r===it.Reject){let e=[{session:this[mt]},...this[pt]];for(;this[yt].length>0;)try{let t=this[yt].shift();"function"==typeof t&&O((()=>{Reflect.apply(t,{},e)}))}catch(e){console.error(e.message,e)}return this[ct]=r,this[at]=[],this[ut]=0,this}if(r===it.Finished||this[ut]>=this[at].length){let e=[{session:this[mt]},...this[ft]];for(;this[dt].length>0;){let t=this[dt].shift();"function"==typeof t&&O((()=>{Reflect.apply(t,{},e)}))}return this[ct]=it.Free,this}if(this[ut]>=this[at].length)return this[ct]=it.Free,this;let n=this[at][this[ut]];this[ht]||(this[at].splice(0,this[ut]+1),this[ut]=-1);let i=this[ut]+1;try{let e=!1,t={go:(t,...r)=>{e||(e=!0,Reflect.apply(this[gt],this,[t,...r]))},resolve:(...t)=>{e||(e=!0,Reflect.apply(this[gt],this,[1,...t]))},reject:(...t)=>{e||(e=!0,Reflect.apply(this.reject,this,[...t]))},insert:t=>{e||(this[at].splice(i,0,t),i++)},session:this[mt]};O((()=>{Reflect.apply(n,{},[t,...this[ft]])}))}catch(e){this.throw(e)}return this}go(e,...t){return Reflect.apply(this[gt],this,[e,...t])}finish(...e){return this[ct]=it.Finished,this[ft]=e,Reflect.apply(this[gt],this,[0])}reject(...e){return this[ct]=it.Reject,this[pt]=e,Reflect.apply(this[gt],this,[0])}throw(...e){return this[ct]=it.Exception,this[pt]=e,Reflect.apply(this[gt],this,[0])}reset(...e){this[ct]=it.Busy,this[ft]=e,this[at]=[],this[ut]=0;let t=[{session:this[mt]},...this[ft]];for(;this[dt].length>0;){let e=this[dt].shift();O((()=>{Reflect.apply(e,this,t)}))}return this[ct]=it.Free,this}post(e){return this[ct]===it.Reject||this[ct]===it.Exception?this:(Array.isArray(e)?this[at]=[...this[at],...e]:this[at].push(e),this[ct]===it.Busy||Reflect.apply(this[gt],this,[0,...this[ft]]),this)}wait(e,t){return e&&"function"==typeof e&&this[dt].push(e),t&&"function"==typeof t&&this[yt].push(t),this[ct]===it.Busy||Reflect.apply(this[gt],this,[0,...this[ft]]),this}exception(e){return e&&"function"==typeof e&&this[yt].push(e),this[ct]===it.Busy?this:Reflect.apply(this[gt],this,[0,...this[ft]])}isFinish(){return this[ct]==it.Reject||this[ct]==it.Free&&this[ut]>=this[at].length}}class wt{constructor(e={}){this.moduleManager=new lt,this.resource=new Je,this.head=Ie.head||Ie.getElementsByTagName("head")[0]||Ie.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={})}set query(e){this._query=e}get query(){return this._query}ensure(...e){let t=[],r=e.length-1,n={};"object"==typeof e[r]&&(Object.assign(n,e[r]),r--);let i=null;"function"==typeof e[r]&&(i=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 xt(t.length,((e,t)=>{if(s.isOK())try{"function"==typeof i&&Reflect.apply(i,{},t)}catch(e){console.error(e.message,e)}else try{console.error(e),"function"==typeof i&&Reflect.apply(i,{},[])}catch(e){console.error(e.message,e)}})),o=new vt;for(let e=0;e<t.length;e++){let r=new St(e,t[e],n,s);this.mount(o,r)}return this}remove(...e){let t=[],r=e.length-1,n={};"object"==typeof e[r]&&(Object.assign(n,e[r]),r--);let i=null;"function"==typeof e[r]&&(i=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 i&&Reflect.apply(i,{},[]),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=Ie.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=Ie.body),void this.mountHTML(e,t,r)}}mountHTML(e,t,r){e.post((e=>{let n=t.params.timeout??this.options.timeout??3e4,i=t.src;this.resource.get(i,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,i=Ie.createElement("link"),s="onload"in i;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(i)}catch(e){console.error(e.message,e)}t.progress.work(!1,t.index,null),e.resolve()}};setTimeout((()=>{bt(i,n)}),1)}else i.onload=()=>{i.onload=i.onerror=null,t.progress.work(!0,t.index,t.src),e.resolve()},i.onerror=()=>{try{r.removeChild(i)}catch(e){console.error(e.message,e)}i.onload=i.onerror=null,t.progress.work(!1,t.index,null),e.reject()};let o=Ie.getElementById(n);o&&o.parentNode&&o.parentNode.removeChild(o),i.rel="stylesheet",i.type="text/css",i.id=n,i.href=n,r.appendChild(i)}))}mountJS(e,t,r){e.post((e=>{let n=t.src,i=this.moduleManager.get(n);if(i&&(i.status==ze.Defined||i.status==ze.Loaded)){if(i.exports)return t.progress.work(!0,t.index,i.exports),void e.resolve();if(document.querySelector(`script[src='${n}`))return t.progress.work(!0,t.index,i.exports),void e.resolve()}i=new ot,i.id=n,i.src=n,i.status=ze.Loading,this.moduleManager.put(n,i);let s=Ie.createElement("script");if("onload"in s)s.onload=()=>{s.onload=s.onerror=null,i.status==ze.Loading&&(i.status=ze.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,i.status==ze.Loading&&(i.status=ze.Loaded,t.progress.work(!0,t.index,n)),e.resolve())}}s.defer=!0,s.src=n,Ke.define=this.createDefine(i,t),r.appendChild(s)}))}unmount(e,t={}){let r=this.getFileNamePostfix(e);if("js"===r||0===r.length){let t=Ie.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=Ie.body),void(r.innerHTML="")}{let t=Ie.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 i,s,o;e.status=ze.Defining;let l=n.length;1===l?(o=n[0],i=void 0):2===l?(o=n[1],Array.isArray(n[0])?(s=r.trimEmptyElement(n[0]),i=void 0):s=void 0):(i=n[0],s=r.trimEmptyElement(n[1]),o=n[2]),i&&(e.id=i,r.options.alias[i]=e.src),s&&s.length>0?r.ensure(s,((...r)=>{e.exports="function"==typeof o?Reflect.apply(o,e,r):o,e.status=ze.Defined,t.progress.work(!0,t.index,e.exports)})):(e.exports="function"==typeof o?Reflect.apply(o,e,[]):o,e.status=ze.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 He+e.slice(1)}if(0==e.indexOf("./")){return He+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),i=this.options.paths[n];t=i?i+e.slice(r):e}}return this.parserPath(t,!1)}return He+e}}function bt(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():bt(e,t)}),20)}class xt{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 St{constructor(e,t,r,n){this.index=e,this.src=t,this.params=r,this.progress=n}}const Rt=Symbol("_notifyChange"),At=Symbol("_generateLocation"),Et=Symbol("_setHashRecorder");class Ct{constructor(e,t){this.currentRoute=e,this.routes=t}}class jt{constructor(e="",t=!0,r=!1,n="/"){this.traceless=!1,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=Ke.history.state;this[Rt](e)},Le(Ke,"popstate",this.historyChange);let e=this.getHash()||this.defaultPath,t=Ke.sessionStorage.getItem(e);if(t){let e=JSON.parse(t);this[Rt](e)}else{let t,r=e.indexOf("!");t=-1!=r?e.substring(r+1):e;let n=new me;n.path=t,n.query=this.getSearch(),this[Rt]([n])}}destroy(){this.historyChange&&De(Ke,"popstate",this.historyChange)}[Et](e,t){if(this.hashMonitor)try{this.lastHash&&Ke.sessionStorage.removeItem(this.lastHash);let r=JSON.stringify(t);Ke.sessionStorage.setItem(e,r),this.lastHash=e}catch(e){console.error(e.message)}}listen(e){this.changeHandle=e}[Rt](e){"function"==typeof this.changeHandle&&this.changeHandle(e)}go(e){Ke.history.go(e)}push(e){let t=this[At](e.currentRoute);this.traceless||Ke.history.pushState(e.routes,"",t),this[Et](e.currentRoute.fullPath,e.routes)}replace(e){let t=this[At](e.currentRoute);this.traceless||Ke.history.replaceState(e.routes,"",t),this[Et](e.currentRoute.fullPath,e.routes)}[At](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]),i=`${encodeURIComponent(t)}=${n}`;r.length>0&&(r+="&"),r+=i}else r=e.query;this.query?(t=`${this.query}&${r}`,"?"!==t.charAt(0)&&(t=`?${t}`)):t=`?${r}`}const r=Ke.location;let n;return n=t?`${r.origin}${r.pathname}${t}#${e.fullPath}`:`${r.origin}${r.pathname}#${e.fullPath}`,n}getHash(){let e=Ke.location.hash,t=e.indexOf("#");if(-1!=t){return e.substring(t+1)}return null}getSearch(){return Ke.location.search}}var Tt,Pt,$t,Ot,qt,Ft,kt,_t,Mt,Nt,Kt,It,Lt,Dt,Ht;const Bt=Symbol("_constructRouteModel"),Ut=Symbol("_findRouteModel"),Vt=Symbol("_findRootView"),Wt=Symbol("_getFirstView"),Jt=Symbol("_removeView"),zt=Symbol("_buildPage"),Gt=Symbol("_resolveComponent"),Xt=Symbol("_update"),Yt=Symbol("_merge"),Qt=Symbol("ignoreHistoryChangeOnceKey"),Zt=Symbol("_handleHistoryChange"),er=Symbol("_handleRouteUpdated"),tr=Symbol("routeUpdatedCallback"),rr=Symbol("currentRoutes"),nr=Symbol("current"),ir=Symbol("_addRouteRecorder"),sr=Symbol("_removeRouteRecorder"),or=Symbol("_cloneRouteRecorder"),lr=Symbol("_hanldeError"),ar=Symbol("errorCallback"),ur=Symbol("registerKey"),hr=Symbol("notFoundKey"),cr=Symbol("forestKey"),fr=Symbol("historyKey"),pr=Symbol("beforeFiltersKey"),dr=Symbol("afterFiltersKey"),yr=Symbol("destroyFiltersKey"),mr=Symbol("mainDispatcherKey"),gr=Symbol("initKey"),vr=Symbol("requireKey"),wr=Symbol("_createNextFn"),br=Symbol("_start"),xr=Symbol("_before"),Sr=Symbol("_after"),Rr=Symbol("_destroy"),Ar=Symbol("_load"),Er=Symbol("_unload"),Cr=Symbol("_loadDependency"),jr=Symbol("resolvedModulesKey"),Tr=Symbol("resolveDependencyKey"),Pr=Symbol("routerGuardKey");class $r{constructor(t){this[Tt]=new Array,this[Pt]=new ke,this[$t]=new Array,this[Ot]=null,this[qt]=null,this[Ft]=new Array,this[kt]=new Array,this[_t]=new Array,this[Mt]=new vt,this[Nt]=new Map,this[Kt]=new Me,this[It]=!1,this[Lt]=e(null),this[Dt]=new wt,this[Ht]=!1,this.options=t??{};let r=this.options.routes||[];this.addRoutes(r),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),this[fr]=new jt(this.options.query,this.options.hashMonitor,this.options.traceless,this.options.defaultPath),this[fr]?.listen((e=>{if("string"==typeof e){let t=this[fe](e);t&&this[Zt]([t])}else this[Zt](e)}))}get require(){return this[vr]}get current(){return this[nr].value}[(Tt=ur,Pt=cr,$t=rr,Ot=ar,qt=tr,Ft=pr,kt=dr,_t=yr,Mt=mr,Nt=jr,Kt=Pr,It=gr,Lt=nr,Dt=vr,lr)](e="error",t){if(t&&"function"==typeof t.error)try{t.error(e)}catch(e){}if("function"==typeof this[ar])try{this[ar](e,t)}catch(e){}console.error(e)}init(){!0!==this[gr]&&(this[fr]?.init(),this[gr]=!0)}[(Ht=Qt,Zt)](e){if(this[Qt])this[Qt]=!1;else try{if(!e){let e=[...this[rr]].reverse();return this[Er](e),void Ke.location.reload()}let t=null,r=[],n=[],i=0;for(;i<e.length&&i<this[rr].length&&me.isSame(e[i],this[rr][i]);i++)e[i].opsType===be.Open&&!0===e[i].active&&e[i].active!==this[rr][i].active&&(t=e[i]);if(i<e.length&&(r=e.slice(i)),i<this[rr].length&&(n=this[rr].slice(i).reverse()),0==n.length&&0==r.length)return void(null!==t&&this.restore([t]));if(n.length>0){if(this[Er](n)){if(r.length>0)return void this.restore(r);null!==t&&this.restore([t])}}else this.restore(r)}catch(e){this[lr](e)}}[er](e){if(e)this[nr].value=e;else{let e=this[rr].length;this[nr].value=e>0?this[rr][e-1]:null}if("function"==typeof this[tr])try{this[tr](this[nr].value)}catch(e){}}[ir](e,t=-1){t<0||t>=this[rr].length?this[rr].push(e):this[rr].splice(t,0,e)}[or](){let e=[];for(let t of this[rr]){let r=me.clone(t,!0);e.push(r)}return e}[sr](e){if(null==this[rr])return;let t=-1;for(let r=0;r<this[rr].length;r++)if(me.isSame(this[rr][r],e)){t=r;break}if(-1!=t){let e=this[rr][t];this[rr].splice(t,1),this[Rr](e,e.session)}}set hashMonitor(e){this[fr]&&(this[fr].hashMonitor=e)}get hashMonitor(){return!!this[fr]&&this[fr].hashMonitor}set traceless(e){this[fr]&&(this[fr].traceless=e)}get traceless(){return!!this[fr]&&this[fr].traceless}onRouteUpdated(e){this[tr]=e}onError(e){this[ar]=e}beforeEach(e){this[pr].push(e)}removeBeforeEach(e){let t=this[pr].indexOf(e);return-1!==t&&(this[pr].splice(t,1),!0)}afterEach(e){this[dr].push(e)}removeAfterEach(e){let t=this[dr].indexOf(e);return-1!==t&&(this[dr].splice(t,1),!0)}destroyEach(e){this[yr].push(e)}removeDestroyEach(e){let t=this[yr].indexOf(e);return-1!==t&&(this[yr].splice(t,1),!0)}setResolveDependency(e){this[Tr]=e}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){let r=this[Bt](e);if(-1==t)this[ur]=[...this[ur],...r];else for(let e=r.length-1;e>=0;e--)this[ur].splice(t,0,r[e])}removeRoute(e){let t=this[fe](e);if(null===t)return console.warn("route格式错误",e),!1;for(let e=0;e<this[ur].length;e++){let r=this[ur][e];if(t?.path&&r.path===t.path)return this[ur].splice(e,1),!0;if(t?.name&&r.name===t.name)return this[ur].splice(e,1),!0}return!1}hasRoute(e){let t=this[fe](e);return null===t?(console.warn("route格式错误",e),!1):-1!==this[ur].findIndex((e=>!(!t?.path||e.path!==t.path)||(!(!t?.name||e.name!==t.name)||void 0)))}setNotFoundRoute(e){let t=this[Bt](e);this[hr]=t[0]}getRoutes(){return[...this[ur]]}[Bt](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 we;return r.path=t,r.redirect=e.redirect,[r]}let n=[];for(let t in r){let i=r[t];0===t.length&&(t="default");let s=new ge(t,i,e.props,e.meta);n.push(s)}let i=!1,s=[];if(e.children)for(let r of e.children){let e=this[Bt](r);for(let r of e){let e=new we;e.name=r.name,r.path&&r.path.length>0?e.path="/"!==t?`${t}${r.path}`:r.path:(i=!0,e.path=t);let o=new ve;o.models=[...n],e.layers=[o,...r.layers],s.push(e)}}if(!i){let r=new ve;r.models=n;let i=new we;i.name=e.name,i.path=t,i.layers=[r],s.splice(0,0,i)}return s}[Ut](e){let t=e.route;try{for(let r of this[ur]){if(t.path&&r.path){let n=r.match;n||(n=r.match=oe(r.path));let i=n(t.path);if(!i)continue;if(r.redirect){let n=new me;C(!0,n,t),n.path=r.redirect;let i={route:n,find:void 0};return!!this[Ut](i)&&(e.route=i.route,e.find=i.find,!0)}if(t.params=t.params??{},C(!0,t.params,i.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()),i=decodeURIComponent(t[1].trim());r[n]=i}C(!0,t.params,r)}else"object"==typeof e&&C(!0,t.params,e)}return e.find=r,!0}if(t.name===r.name){t.params=t.params??{};let n=se(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}[fe](e){let t=null;if(Array.isArray(e))if(t=new me,"object"==typeof e[0])t=me.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&&C(!1,t,e[r]);else"object"==typeof e?t=me.from(e):"string"==typeof e&&(t=new me,"/"==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??be.Push}return t}push(...e){let t=this[fe](e);return t?(t.opsType=t.opsType||be.Push,this.to(t)):(this[lr]("resolve route fail",t),this)}put(...e){let t=this[fe](e);return t?(t.opsType=be.Put,this.to(t)):(this[lr]("resolve route fail",t),this)}replace(...e){let t=this[fe](e);return t?(t.opsType=be.Replace,this.to(t)):(this[lr]("resolve route fail",t),this)}append(...e){let t=this[fe](e);return t?(t.opsType=be.Append,this.to(t)):(this[lr]("resolve route fail",t),this)}remove(e){return new Promise((t=>{this[mr].post((r=>{try{if(0===this[rr].length)return r.resolve(),void t(!1);let n,i=-1,s=[];if(e){if(e.root)n=e.root;else{n=this[rr][0].root??"default"}if(e.all)for(let e=this[rr].length-1;e>0;e--){let t=this[rr][e];t.opsType===be.Append&&t.root===n&&(s.splice(0,0,t),i=e-1)}else if(e.until)for(let t=this[rr].length-1;t>0;t--){let r=this[rr][t];if(r.opsType===be.Append&&r.root===n){if("/"===e.until.charAt(0)&&e.until===r.path){i=t;break}if(e.until===r.name){i=t;break}s.splice(0,0,r)}}}else{n="default";let e=this[Wt](this[cr]);e&&(n=e.name);for(let e=this[rr].length-1;e>0;e--){let t=this[rr][e];if(t.opsType===be.Append&&t.root===n){s.push(t),i=e-1;break}}}if(0===s.length){let e="can not find route";return console.warn(e),r.resolve(e),void t(!1)}let o=0;if(this[rr].forEach((e=>{e.opsType!==be.Put&&o++})),this[Er](s)){let e=0;this[rr].forEach((t=>{t.opsType!==be.Put&&e++}));let n=o-e;this[Qt]=!0,this.back(n),r.resolve(),t(!0)}}catch(e){this[lr](e),r.resolve(),t(!1)}}))}))}open(...e){let t=this[fe](e);return t?(t.opsType=be.Open,this.to(t)):(this[lr]("resolve route fail",t),this)}close(e){return this[mr].post((t=>{try{let r=this[fe](e);if(!r)return void t.reject("resolve route fail");let n=[];for(let e=0;e<this[rr].length;e++){let t=this[rr][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[Er](n)){let e=me.clone(r,!0);const t=new Ct(e,this[or]());this[fr]?.replace(t),this[er]()}t.resolve()}catch(e){this[lr](e),t.resolve()}})),this}to(...e){let t=this[fe](e);if(!t)return this[lr]("resolve route fail",t),this;let r=this[Pr].acquire(t);return null==r?(this[lr]("route forbid",t),this):(this[mr].post((e=>{try{let n=this[br](t);this[xr](n),!n.session?.routeModel&&this[Tr]&&this[Cr](n),this[Ar](n),this[Sr](n),n.wait(((n,i)=>{let s=n.session.to;try{let e=me.clone(s,!0);const t=new Ct(e,this[or]());s.opsType===be.Replace?this[fr]?.replace(t):this[fr]?.push(t)}catch(e){console.error(e.message,e)}if(this[Pr].release(r),this[er](s),"function"==typeof t.success)try{Reflect.apply(t.success,{},[])}catch(e){console.error(e.message,e)}e.resolve()}),((n,i)=>{this[Pr].release(r),this[lr](i,t),e.resolve()}))}catch(n){this[Pr].release(r),this[lr](n,t),e.resolve()}})),this)}back(e=1){this[fr]?.go(-e)}[wr](e){return(t,r)=>{if("boolean"==typeof t)t?e.resolve():e.reject(r);else if(t){let r=this[fe](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()}}[br](e){let t=this[rr].length>0?this[rr][0]:void 0,r=new ye(e,t),n={route:e,find:null};return this[Ut](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=C(!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 vt(r)}[xr](e){for(let t of this[pr])e.post((e=>{let r=this[wr](e);Reflect.apply(t,{},[e.session.to,e.session.from,r,e.session])}))}[Sr](e){e.post((e=>{for(let t of this[dr])try{Reflect.apply(t,{},[e.session.to,e.session.from,e.session])}catch(e){console.error(e.message,e)}e.resolve()}))}[Rr](e,t){for(let r of this[yr])try{Reflect.apply(r,{},[e,t])}catch(e){console.error(e.message,e)}"function"==typeof e.destroy&&Reflect.apply(e.destroy,e,[])}[Cr](e){let t=e.session,r=Reflect.apply(this[Tr],this,[t?.to]);if(null==r)return;Array.isArray(r)||(r=[r]);let n=[];for(let e of r)this[jr].has(e)||n.push(e);0!==n.length&&e.post((e=>{this[vr].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[jr].set(e,!0);e.resolve()}else e.reject()}))}))}[Ar](e){e.post((e=>{let t=e.session.to,r=e.session.routeModel;if(null==r){let n={route:t,find:null};if(this[Ut](n))r=n.find,e.session.routeModel=r;else{if(!this[hr])return void e.reject(`not find route model, path:${t.path??t.name}`);r=this[hr]}}let n=ye.from(e.session);this[zt](t,r,n).then((t=>{this[cr],e.resolve()}),(t=>{e.reject(t)}))}))}[Er](e){if(0==e.length)return!0;let t=this[cr],r=[];for(let n of e){let e=this[Vt](t,n);null!=e&&r.push({...e,route:n})}if(0==r.length){let e="can not find view index";return this[lr](e),!1}for(let e of r.reverse())this[Jt](t,{x:e.x,y:e.y},[e.route.index??0],!0);return!0}[Vt](e,t){let r,n=t.root??"default";for(let t=0;t<e.layers.length;t++){let i=e.layers[t];for(let e=i.views.length-1;e>=0;e--){let s=i.views[e];if(s[Ce]&&s[Pe]===n)return r={x:e,y:t},r}}return null}[Wt](e){if(e.layers.length>0&&e.layers[0].views.length>0){return e.layers[0].views[0]}return null}[Jt](e,t,r=null,n=!0){if(t.y>=e.layers.length)return;if(t.x>=e.layers[t.y].views.length)return;let i=e.layers[t.y].views[t.x],s=!1,o=[],l=!1,a=i.slots.value;for(let e=a.length-1;e>=0;e--){let n=a[e];null!=r&&-1==r.indexOf(n.index)||(n.route&&i[Ce]&&(this[sr](n.route),!0===n.active&&n.route.opsType==be.Append&&(l=!0)),o.push(new qe(i,n.index,t.y)),a.splice(e,1))}if(0==a.length)n?i.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)}i.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||o.length>0)&&n>=0;n--){let i=t[n];if(i[Te]&&(s||qe.include(o,i[Te]))){let t=i.slots.value;for(let e=t.length-1;e>=0;e--){let n=t[e];n.route&&i[Ce]&&this[sr](n.route),r.push(new qe(i,n.index,u)),t.splice(e,1)}e.layers[u].views.splice(n,1)}}o=r,0==e.layers[u].views.length&&(s=!0)}}restore(e){if(e&&0!=this[ur].length){return new Promise(((t,r)=>{for(let t=0;t<e.length;t++){let r=e[t];this[mr].post((e=>{let t=this[br](r);this[xr](t),!t.session?.routeModel&&this[Tr]&&this[Cr](t),this[Ar](t),this[Sr](t),t.wait(((t,r)=>{e.resolve()}),((t,r)=>{this[lr](r),e.resolve()}))}))}this[mr].post((e=>{e.resolve(),t()}))}))}{let e=this[cr];if(e.layers.length>0){let t=e.layers[0].views;t.length>0&&(t[0].slots.value=[])}return this[rr]=[],this[er](),Promise.resolve()}}[zt](e,t,r){let n=e.updateType??Se.Part;return this[Gt](t).then((()=>{this[Xt](t,e,r,n)}))}[Gt](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()}[Xt](e,t,r,n){if(1!==e.layers[0].models.length)return Promise.reject("illegal route structure(multil root node)");const i=e.layers[0].models[0];let s,o,l=this[cr],a=function(e){return 0==e.layers.length||0==e.layers[0].views.length}(l),u=t.root??"default";a||n!=Se.Part||(s=this[Vt](l,t));let h=0;if(null==s||null==s)if(a||n===Se.All){if(0==l.layers[0].views.length){let e=t.root??"default";o=new Oe(e,!0,null),l.layers[0].views=[o]}else o=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 i of t.views){if(i[Ce]&&i.name===e.rootName){r=new qe(i,e.rootIndex??0,n-1);break}if(i[je]&&i[je].view.name===e.rootName&&i[je].index===e.rootIndex){r=i[je];break}}}if(!r)return Promise.reject("can not insert view(not find root node ref)");o=new Oe(u,!0,r),l.layers[n].views.push(o),s={x:l.layers[n].views.length-1,y:n}}else o=l.layers[s.y].views[s.x];if(h=s.y,o[Ce]=!0,t.opsType===be.Append){t.index=P.get();let r=o.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 $e(t,i,t.index,!0);o.slots.value=[...r,n];let s=h+1,a=1,u=new qe(o,t.index,h);this[Yt](l,s,e,a,u)}else if(t.opsType===be.Open){let r=o.slots.value,n=!1;for(let e of r){if(null!==e.route&&me.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[sr](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 $e(t,i,t.index,!0);r.push(n);let s=h+1,a=1,u=new qe(o,t.index,h);this[Yt](l,s,e,a,u)}o.slots.value=[...r]}else{let r=o.slots.value;if(0==r.length){t.index=P.get(),o.slots.value=[new $e(t,i,t.index)];let r=h+1,n=1,s=new qe(o,t.index,h);this[Yt](l,r,e,n,s)}else{let n=r[0];if(n.model!==i){this[Jt](l,s,null,!0),t.index=P.get(),o.slots.value=[new $e(t,i,t.index)];let r=h+1,n=1,a=new qe(o,t.index,h);this[Yt](l,r,e,n,a)}else{null!==n.route&&this[sr](n.route);let i=[];for(let e=1;e<r.length;e++)i.push(r[e].index);i.length>0&&this[Jt](l,s,i,!0),t.index=n.index,n.route=t;let a=[new qe(o,t.index,h)],u=h+1,c=1,f=new qe(o,t.index,h);for(;a.length>0&&u<l.layers.length&&c<e.layers.length;u++,c++){let t=[];for(let e=0;e<l.layers[u].views.length;e++){let r=l.layers[u].views[e];r[Te]&&qe.include(a,r[Te])&&t.unshift(e)}let r=[];for(let n of t){let t,i=l.layers[u].views[n],s=e.layers[c].models;for(let e=0;e<s.length;e++)if(i.name===s[e].name){t=s[e];break}if(t){let s=i.slots.value;if(0==s.length){let r=0;i.slots.value=[new $e(null,t,r)];let n=u+1,s=c+1;this[Yt](l,n,e,s,f)}else{let o=s[0];if(o.model!==t){this[Jt](l,{x:n,y:u},null,!0),i.slots.value=[new $e(null,t,0)];let r=u+1,s=c+1;this[Yt](l,r,e,s,f)}else{i[Ce]&&null!==o.route&&this[sr](o.route);let e=[];for(let t=1;t<s.length;t++)e.push(s[t].index);e.length>0&&this[Jt](l,{x:n,y:u},e,!0),r.push(new qe(i,o.index,u))}}i[Ce]=!1}else this[Jt](l,{x:n,y:u},null,!1)}a=r}this[Yt](l,u,e,c,f)}}}if(o&&o[je]){let e=o[je];e&&(t.slot=new de(u,h,e?.view.name,e?.index??0))}r.to=void 0,r.routeModel=void 0,t.session=r,this[ir](t)}[Yt](e,t,r,n,i){let s=n,o=t;for(;o<e.layers.length&&s<r.layers.length;o++,s++){let t=e.layers[o].views;for(let e of r.layers[s].models){let r=new Oe(e.name,!1,i),n=new $e(null,e);r.slots.value=[n],t.push(r)}}for(;s<r.layers.length;s++){let t=new Fe;t.views=[];for(let e of r.layers[s].models){let r=new Oe(e.name,!1,i),n=new $e(null,e);r.slots.value=[n],t.views.push(r)}e.layers.push(t)}}[ce](e,t,r,n,i,s){if(t<0||t>this[cr].layers.length)return null;if(t<this[cr].layers.length){let o=this[cr].layers[t],l=null;for(let a of o.views){let o=!1;if(null!==r?(o=a.name===e&&a[je]?.view===r,o&&-1!==n&&(o=a[je]?.index===n)):o=a.name===e,o){null!==i&&(a[Te]={view:i,index:s,level:t-1}),l=a;break}}if(null!==l)return l}let o=null,l=null;null!==i&&(o=i[Ce]?{view:i,index:s,level:t-1}:i[je],l={view:i,index:s,level:t-1});let a=new Oe(e,!0,o);if(a[Te]=l,t==this[cr].layers.length){let e=new Fe;e.views=[a],this[cr].layers.push(e)}else this[cr].layers[t].views.push(a);return a}}var Or,qr,Fr;(Fr=qr||(qr={}))[Fr.limitless=0]="limitless",Fr[Fr.once=1]="once";const kr=Symbol("registerKey");class _r{constructor(e,t){this.callback=e,this.policy=t}}class Mr{constructor(){this[Or]=new Map}on(e,t,r=!1){let n=this[kr].get(e);n||(n=new Array,this[kr].set(e,n));let i=new _r(t,!0===r?1:0);return n.push(i),this}off(e,t){if(!t)return this[kr].delete(e),this;let r=this[kr].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,i=new Array(n),s=[].splice.call(e,0,n);for(let e=0;e<s.length;e++)this.once(s[e],(t=>{i[e]=t,n-=1,0==n&&Reflect.apply(r,{},i)}));return this}emit(e,...t){let r=this[kr].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])}}var Nr;Or=kr;const Kr=Symbol("registerKey");class Ir{constructor(){this[Nr]=new Map}set(e,t){this[Kr].set(e,t)}get(e){return this[Kr].get(e)}has(e){return this[Kr].has(e)}delete(e){return this[Kr].delete(e)}}Nr=Kr;const Lr=Symbol("lc");function Dr(e,t=!1){let r=e,n=r[Lr];if(!n){if(!t)return null;n=new Ir,r[Lr]=n}return n}function Hr(e,t){let r=e;for(;null!==r;){let e=r[Lr];if(e&&e.has(t))return e.get(t);r=r.$parent}return null}function Br(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 Dr(t.component.proxy,!1)}return null}const Ur=Symbol("hooksKey");function Vr(e,t){let r=e.get(Ur);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 Wr,Jr;(Jr=Wr||(Wr={})).DEACTIVATED="da",Jr.ACTIVATED="a";class zr{constructor(e,t,r){this.target=r,this.hook=t,this.type=e}}function Gr(e){return(t,r)=>{let n;if(r)n=r;else{let e=i();if(null==e||null==e.proxy)return void console.error("can not get currrent instance or proxy");n=e.proxy}let o=Hr(n,Ur);null!=o?(s((()=>{!function(e,t,r,n){let i=-1;for(let s=0;s<e.length;s++){let o=e[s];if(o.type===t&&o.hook===r&&o.target===n){i=s;break}}-1!=i&&e.splice(i,1)}(o,e,t,n)})),function(e,t,r,n){let i=new zr(t,r,n);e.push(i)}(o,e,t,n)):console.warn("can not get hooks context")}}let Xr=Gr(Wr.ACTIVATED),Yr=Gr(Wr.DEACTIVATED);const Qr=Symbol("routeKey");function Zr(e,t){let r=e.get(Qr);if(r){let e={path:"",name:"",params:{},index:-1,session:{}};Object.assign(e,t),Object.assign(r,e)}else r=function(){let e=new me;return e.path="",e.name="",e.params={},e.index=-1,o(e)}(),Object.assign(r,t),e.set(Qr,r)}function en(e){let t=Hr(e,Qr);return null!=t?t:null}const tn=Symbol("rk"),rn=Symbol("vd"),nn=Symbol("rv"),sn=Symbol("rvi"),on=Symbol("pv"),ln=Symbol("pvi");function an(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 un(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 hn(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 cn(e,t){e.classList.contains(t)||e.classList.add(t)}function fn(e,t){e.classList.remove(t)}const pn=Ne&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function dn(e){pn(e)}function yn(e,t,...r){y(t)&&(null==e&&(e={}),Reflect.apply(t,e,r))}function mn(e,t,r,n=-1,i,s,o,l){if(y(s)){if(void 0!==i&&i>=0)return void setTimeout((()=>{Reflect.apply(s,e,[t,r,n]),y(l)&&Reflect.apply(l,e,[])}),i);let o=["animationend","transitionend"],a=i=>{o.forEach((e=>{De(t,e,a)})),Reflect.apply(s,e,[t,r,n]),l&&Reflect.apply(l,e,[])};o.forEach((e=>{Le(t,e,a)}))}if(y(o)){let i="animationcancel",s=l=>{Reflect.apply(o,e,[t,r,n]),De(t,i,s)};Le(t,i,s)}}function gn(e){return null!==e&&(e.opsType===be.Append||e.opsType===be.Open)}function vn(e,t,r,n,i={},s,o=-1){if(t&&(r||gn(s))){let e=an(i,r);e&&cn(n,e);let t=un(i,r);t&&cn(n,t)}else{yn(e,function(e,t=!1){let r=null;return r=t?e.onBeforeShow??e.onBeforeEnter:e.onBeforeEnter,r}(i,r),[n,s,o])}}function wn(e,t,r,n,i={},s,o,l,a){if(gn(o)||r)if(t){let t=an(i,r),u=un(i,r),h=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)}(i,r);dn(h?()=>{mn(e,n,o,l,s,(()=>{u&&fn(n,u),h&&fn(n,h),y(a)&&a(e,a,[n])})),t&&fn(n,t),h&&cn(n,h)}:()=>{t&&fn(n,t),u&&fn(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}(i,r),s=function(e,t=!1){let r=null;return r=t?e.onAfterShow??e.onAfterEnter:e.onAfterEnter,r}(i,r),u=function(e,t=!1){let r=null;return r=t?e.onShowCancelled??e.onEnterCancelled:e.onEnterCancelled,r}(i,r),h=t=>{!t&&y(s)?yn(e,s,[n,o,l]):y(u)&&yn(e,u,[n,o,l]),y(a)&&a(e,a,[n])};y(t)?yn(e,t,[n,h,o,l]):h()}else y(a)&&a(e,a,[n])}function bn(e,t,r,n,i={},s,o,l,a,u){if(gn(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)}(i,r),h=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)}(i,r),c=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)}(i,r);t&&cn(n,t),h&&cn(n,h),dn(c?()=>{mn(e,n,l,a,s,(()=>{h&&fn(n,h),c&&fn(n,c),y(u)&&yn(e,u,[n]),!r&&y(o)&&o()})),t&&fn(n,t),c&&cn(n,c)}:()=>{t&&fn(n,t),h&&fn(n,h),y(u)&&yn(e,u,[n]),!r&&y(o)&&o()})}else{let t=function(e,t=!1){let r=null;return r=t?e.onHide??e.onLeave:e.onLeave,r}(i,r),s=function(e,t=!1){let r=null;return r=t?e.onAfterHide??e.onAfterLeave:e.onAfterLeave,r}(i,r),h=function(e,t=!1){let r=null;return r=t?e.onHideCancelled??e.onLeaveCancelled:e.onLeaveCancelled,r}(i,r),c=t=>{!t&&y(s)?(yn(e,s,[n,l,a]),y(u)&&yn(e,u,[n]),!r&&y(o)&&o()):y(h)&&(yn(e,h,[n,l,a]),y(u)&&yn(e,u,[n]))};y(t)?yn(e,t,[n,c,l,a]):c()}else!r&&y(o)&&o()}function xn(e,t={},r,n=-1){let i=q(t.css),s=t.mode??"default",o=hn(t);return{mode:s,persisted:!1,beforeEnter:s=>{vn(e,i,!1,s,t,r,n)},enter:s=>{wn(e,i,!1,s,t,o.enter,r,n)},leave:(s,l)=>{bn(e,i,!1,s,t,o.leave,l,r,n)},clone:i=>xn(e,t,r,n)}}function Sn(e){return e.el}function Rn(e,t,r={},n,i,s,o){if(s){let s=Sn(t);if(null==s)return;let l=q(r.css),a=hn(r);vn(e,l,!0,s,r,n,i),wn(e,l,!0,s,r,a.show,n,i,(t=>{y(o)&&yn(e,o,[t])}))}else y(o)&&yn(e,o,[])}function An(e,t,r={},n,i,s,o){if(s){let s=Sn(t);if(null==s)return;let l=q(r.css),a=hn(r);bn(e,l,!0,s,r,a.hide,null,n,i,(t=>{y(o)&&yn(e,o,[t])}))}else y(o)&&yn(e,o,[])}function En(e,t,r){return"function"==typeof e?Reflect.apply(e,{},[t,r]):e}class Cn{constructor(e,t){this.node=e,this.state=t}}let jn=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){let r=i();if(null===r||null===r.proxy)return void console.error("instance or instance.proxy not exist");const n=!0===e.multi,o=a(tn,null),l=a(rn,0),c=a(nn,null),f=a(sn,-1);let p=!1,d=null;const y=e.modelSlot;if(y){u(rn,l+1),u(sn,y.index),u(ln,y.index);let e=y.route;if(!e)return void console.warn("child view render error, route not exist");let t=Dr(r.proxy,!0);!function(e){let t=e.get(Ur);t||(t=[],e.set(Ur,t))}(t),Zr(t,e)}else{if(null==o)return void console.error("router is not been injected");let t=e.name,i=a(on,null),s=a(ln,0);if(d=o[ce](t,l,c,f,i,s),null===d)return;u(on,d);if(!0===d[Ce]&&u(nn,d),n)p=q(e.transition??!0);else{p=q(e.transition??!1),u(sn,-1),u(rn,l+1),u(ln,-1);let t=d.slots.value;if(t.length>0){let e=t[0].route;if(e){Zr(Dr(r.proxy,!0),e)}}else{let e=Dr(r.proxy,!0);d.compensation=()=>{let t=d.slots.value;if(t.length>0){let r=t[0].route;return r&&Zr(e,r),!0}return!1}}}}let m=new Map;return s((()=>{m&&m.clear()})),()=>{if(n){let n=new Map,i=[],s=d?.slots.value,o=[];for(let t=0;t<s.length;t++){let l=s[t],a=`${e.name}-${l.index}`,u=h(jn,{modelSlot:l}),c={},f=En(e.viewClass,l.route,t);"string"==typeof f&&f.length>0&&(c[f]=!0);let d=En(e.viewActiveClass,l.route,t),y=En(e.viewDeactiveClass,l.route,t),g=m.get(a);if("string"==typeof d&&d.length>0&&(c[d]=l.active),"string"==typeof y&&y.length>0&&(c[y]=!l.active),g&&l.active!==g.state){let n=g.node;l.active?o.unshift((()=>{Rn(r,n,e,l.route,t,p,(()=>{let e=Br(n);null!=e&&Vr(e,Wr.ACTIVATED)}))})):o.push((()=>{An(r,n,e,l.route,t,p,(()=>{let e=Br(n);null!=e&&Vr(e,Wr.DEACTIVATED)}))}))}let v={class:c,key:a},w=En(e.viewTagProps,l.route,t);null!==w&&"object"==typeof w&&C(!0,v,w),l.route?.viewTagAttrs&&"object"==typeof l.route?.viewTagAttrs&&C(!0,v,l.route.viewTagAttrs);let b=En(e.viewTag,l.route,t),x=h(b,v,{default:()=>[u]});if(n.set(a,new Cn(x,l.active)),p){let n=xn(r,e,l.route,t);x.transition=n}i.push(x)}m=n,function(e,t={}){dn((()=>{for(let r=0;r<e.length;r++)Reflect.apply(e[r],t,[])}))}(o,r);let l=En(e.tag,null,-1),a={};return Object.assign(a,t.attrs),h(l,a,{default:()=>i})}if(null!=y){let e=y.model,t={};return e.props&&("object"==typeof e.props?C(!1,t,e.props):!0===e.props&&"object"==typeof y.route?.params&&C(!1,t,y.route?.params)),h(e.component,t)}{let t=d.slots.value;if(t.length>0){let n=t[0],i=n.model,s={};i.props&&("object"==typeof i.props?C(!1,s,i.props):!0===i.props&&"object"==typeof n.route?.params&&C(!1,s,n.route?.params));let o=h(i.component,s);if(p){let t=xn(r,e,n.route,-1);o.transition=t}return o}}}}});function Tn(e,t){return"function"==typeof e?Reflect.apply(e,{},[t]):e}let Pn=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(tn,null);return()=>{let n=Tn(e.to,null),i=Tn(e.tag,n);if(null==i)return void console.warn("can not resolve link tag");let s=null,o=null;null!==r&&(s=r[fe](n),o=r.current);let l={},a=Tn(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,o)),!0===Tn(e.exact,s)){let t=Tn(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,o))}let u={class:l};C(!0,u,t.attrs);let c=Tn(e.event,s);if("string"==typeof c){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[c]=e}return h(i,u,t.slots)}}}),$n={get each(){return L},get type(){return _},get isFunction(){return y},get isArray(){return c},get isArrayLike(){return N},get makeArray(){return I},get merge(){return K},get isWindow(){return M},get isPlainObject(){return S},get isEqual(){return D}};const On=Symbol("fk"),qn=Symbol("fbk"),Fn=Symbol("fepk");function kn(e={}){const t=new $r(e),r=new ne,n=new Mr,i={...$n,get router(){return t},get bus(){return r},get Bus(){return ne},get eventproxy(){return n},get EventProxy(){return Mr},get EventChain(){return vt},get require(){return t.require},get request(){return Ve},get extend(){return C},get clone(){return j},install(e){e.provide(tn,t),e.provide(On,i),e.provide(qn,r),e.provide(Fn,n),e.component("fox-router-view",jn),e.component("fox-router-link",Pn),Reflect.defineProperty(e.config.globalProperties,"$fox",{get:()=>i}),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 en(this)}},created(){t.init()}})}};return i}function _n(e){if(e){return e.$router}return a(tn)}function Mn(e){if(!e){e=i()?.proxy??void 0}return e?en(e):null}function Nn(e){if(e){return e.$fox}return a(On)}function Kn(e){if(e){return e.$bus}return a(qn)}function In(e){if(e){return e.$eventProxy}return a(Fn)}function Ln(e){const t=_n(),r=(t,r,n)=>{try{Reflect.apply(e,{},[t,r])}catch(e){console.error(e)}n()};t.beforeEach(r),s((()=>{t.removeBeforeEach(r)}))}function Dn(e){const t=_n(),r=(t,r,n)=>{try{Reflect.apply(e,{},[t,r])}catch(e){console.error(e)}n()};t.afterEach(r),s((()=>{t.removeAfterEach(r)}))}export{ne as Bus,vt as EventChain,Mr as EventProxy,me as Route,$r as Router,We as cancel,j as clone,kn as createFox,C as extend,qn as foxBusKey,Fn as foxEventProxyKey,On as foxKey,c as isArray,d as isDate,A as isESModule,D as isEqual,y as isFunction,f as isMap,v as isObject,S as isPlainObject,w as isPromise,p as isSet,m as isString,g as isSymbol,Dn as onAfterRouteUpdate,Ln as onBeforeRouteUpdate,Xr as onFoxActivated,Yr as onFoxDeactivated,Ve as request,q as toBoolean,F as toNumber,x as toTypeString,Kn as useBus,In as useEventProxy,Nn as useFox,Mn as useRoute,_n as useRouter};
package/package.json CHANGED
@@ -1,17 +1,28 @@
1
1
  {
2
2
  "name": "@fox-js/fox",
3
- "version": "3.0.1-0",
3
+ "version": "3.0.1-1",
4
4
  "description": "Fox Router and commons Utils",
5
+ "author": "jiangcheng",
6
+ "keywords": [
7
+ "fox",
8
+ "router",
9
+ "vue3",
10
+ "tyepscript"
11
+ ],
5
12
  "main": "main.js",
13
+ "module": "main.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./main.js"
17
+ }
18
+ },
6
19
  "style": "libs/index.css",
7
- "typings": "",
20
+ "typings": "libs/index.d.ts",
8
21
  "publishConfig": {
9
22
  "access": "public"
10
23
  },
11
24
  "scripts": {
12
- "publish:beta": "npm version prerelease & npm publish --tag beta",
13
- "publish:next": "npm version prerelease & npm publish --tag next",
14
- "publish:latest": "npm version patch & npm publish"
25
+ "publish:next": "npm version prerelease & npm publish --tag next"
15
26
  },
16
27
  "dependencies": {},
17
28
  "repository": ""