@vtj/renderer 0.17.6 → 0.17.7
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/dist/index.cjs +21 -13
- package/dist/index.mjs +4988 -1227
- package/package.json +6 -5
- package/types/version.d.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("@vtj/core"),f=require("@vtj/utils"),F=require("vue"),zt=require("vue-router");function cs(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const Be=cs(F);/**!
|
|
2
2
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
3
3
|
* @name @vtj/renderer
|
|
4
4
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
5
|
-
* @version 0.17.
|
|
5
|
+
* @version 0.17.7
|
|
6
6
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
7
|
-
*/const
|
|
8
|
-
`),
|
|
9
|
-
`}catch(r){console.error("Failed to read cssRules from adopted stylesheet:",r)}}),t){const s=n.createElement("style");s.textContent=t,n.head.appendChild(s)}}async function Oe(n,e){const t=await window.fetch(e).then(s=>s.text()).catch(()=>"");t&&Q(window,n,t)}function pe(n,e=window){const t=e.document,s=e.document.head;for(const r of n)if(!t.getElementById(r)){const o=t.createElement("link");o.rel="stylesheet",o.id=r,o.href=r,s.appendChild(o)}}async function fe(n,e,t=window){const s=t.document,r=t.document.head;let i=t[e];return i?i.default||i:new Promise((o,c)=>{for(const p of n){const a=s.createElement("script");a.src=p,a.onload=()=>{i=t[e],i?o(i.default||i):c(null)},a.onerror=l=>{c(l)},r.appendChild(a)}})}function xe(n){return f.isFunction(n)&&Object.getOwnPropertyNames(n.prototype||{}).length===0||f.isFunction(n?.install)}function De(n){return be.includes(n)}function ke(n){return le.includes(n)}function k(n=window){const e=window?.Mock;if(e)return e;const t=n?.Mock;if(t&&window)return window.Mock=t,t}function gt(n,e,t){Object.assign(e.meta,t.meta);const s=n?._container;t?.type==="page"&&s.classList.add("is-page"),t?.pure&&s.classList.add("is-pure")}function He(n){return/^\([\s\S]*\)/.test(n.trim())}function Ne(n){return/\w+\([\s\S]*\)$/.test(n.trim())}function Le(n){return n.includes("=")}function _t(n){if(typeof window>"u")return;const e=window[0]||window;if(e.__simulator__)try{const t=e.__simulator__.engine.provider.errorHandler;t&&t(n)}catch{}}function H(n,e,t=!1,s=!1,r=!1){try{const i=['"use strict";',"var __self = arguments[0];"];i.push("return ");let o=(n.value||"").trim();r||(o=o.replace(/this(\W|$)/g,(p,a)=>`__self${a}`)),o=i.join(`
|
|
10
|
-
`)+o;const c=r?`
|
|
11
|
-
${o}
|
|
12
|
-
`:`with(${t?"{}":"$scope || {}"}) { ${o} }`;return new Function("$scope",c)(e)}catch(i){if(f.logger.error("parseExpression.error",i,n,e?.__self??e),_t(i),s)throw i}}function R(n,e,t=!1,s=!1,r=!1){const i=H(n,e,t,s,r);if(typeof i!="function"&&(f.logger.error("parseFunction.error","not a function",n,e?.__self??e),s))throw new Error(`"${n.value}" not a function`);return i}function b(n){return n&&n.type==="JSExpression"}function C(n){return typeof n=="object"&&n&&n.type==="JSFunction"}function Ue(n){return b(n)||C(n)}function vt(n){return Ue(n)?n.value:JSON.stringify(n)}const yt={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},de=Symbol("access");class Y{options;data=null;mode=S.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},yt,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:t,router:s,request:r}=e;this.mode=t,s&&this.mode!==S.Design&&this.setGuard(s),r&&this.setRequest(r)}login(e){const{storageKey:t,storagePrefix:s,session:r,authKey:i}=this.options;this.setData(e),this.data&&(f.storage.save(t,e,{type:"local",prefix:s}),r&&f.cookie.set(i,this.data.token))}clear(){const{storageKey:e,storagePrefix:t,session:s,authKey:r}=this.options;this.data=null,f.storage.remove(e,{type:"local",prefix:t}),s&&f.cookie.remove(r)}logout(){this.clear(),this.toLogin()}getData(){return this.data?this.data:(this.loadData(),this.data)}getToken(){return this.data||this.loadData(),this.data?.token}can(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return typeof e=="function"?e(s):f.toArray(e).every(i=>s[i]||s[t+"."+i])}some(e){const{appName:t}=this.options,{permissions:s={}}=this.data||{};return f.toArray(e).some(i=>s[i]||s[t+"."+i])}install(e){e.config.globalProperties.$access=this,e.provide(de,this)}isAuthPath(e){const{auth:t,isAuth:s}=this.options;if(s)return s(e);if(e.path&&typeof t=="string"){const r=t.split("#")[1]||t;return e.path===r}return!1}toLogin(){const{auth:e,redirectParam:t}=this.options;if(!e)return;const s=t?`?${t}=${encodeURIComponent(location.href)}`:"";typeof e=="function"?e(s):location.href=t?`${e}${s}`:e}setData(e){const{privateKey:t}=this.options;if(Array.isArray(e)&&t){const s=e.map(r=>f.unRSA(r,t));try{this.data=JSON.parse(s.join(""))}catch(r){console.warn(r)}return}if(typeof e=="string")try{const s=t?f.unRSA(e,t):e;s?this.data=JSON.parse(s):console.warn("RSA解密失败或登录信息缺失")}catch(s){console.warn(s)}else this.data=e}loadData(){const{storageKey:e,storagePrefix:t}=this.options,s=f.storage.get(e,{type:"local",prefix:t});this.setData(s||null)}isLogined(){const{session:e,authKey:t}=this.options;return e&&t?!!f.cookie.get(t):!!this.getToken()}hasRoutePermission(e){if(e.name===D){const t=e.params.id;return t&&this.can(t)}return e.meta.__vtj__?this.can(e.meta.__vtj__):e.meta.permission?this.can(e.meta.permission):!0}setGuard(e){e.beforeEach((t,s,r)=>this.guard(t,r))}async guard(e,t){if(this.isWhiteList(e)||this.isAuthPath(e))return t();if(this.isLogined()){if(this.hasRoutePermission(e))return t();{const{noPermissionMessage:s="无权限访问",unauthorized:r=!1}=this.options;return await this.showTip(s),f.isFunction(r)?(r(),t(!1)):f.isString(r)?t(r):t(!1)}}t(!1),await f.delay(0),this.toLogin()}isWhiteList(e){const{whiteList:t}=this.options;return t?Array.isArray(t)?t.some(s=>e.fullPath.startsWith(s)):t(e):!1}isUnauthorized(e){const{unauthorizedCode:t=401,statusKey:s="code"}=this.options;return e.status===t||e.data?.[s]===t}async showUnauthorizedAlert(e){const{unauthorizedMessage:t="登录已失效"}=this.options;this.isUnauthorized(e)&&await this.showTip(t)&&this.toLogin()}async showTip(e){const{alert:t}=this.options;return this.isTipShowing?!1:t?(this.isTipShowing=!0,await f.delay(150),await t(e,{title:"提示",type:"warning"})?.catch(()=>!0)?.finally(()=>{this.isTipShowing=!1})):(window.alert(e),!0)}setRequest(e){e.useRequest(t=>(this.data?.token&&(t.headers[this.options.authKey]=this.data?.token),t)),e.useResponse(async t=>(this.interceptResponse&&await this.showUnauthorizedAlert(t),t),async t=>{if(!this.interceptResponse)return Promise.reject(t);const s=t.response||t||{};return await this.showUnauthorizedAlert(s),Promise.reject(t)})}}function qe(){return $.inject(de,null)}function St(n={}){const{notify:e,loading:t,settings:s={},Startup:r,access:i,useTitle:o,alert:c}=n;let p=null;return{request:f.createRequest({adapter:n.axiosAdapter,settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:l=>l.data?.code===0||!!l.data?.success,failMessage:!0,showError:l=>{e&&e(l||"未知错误")},showLoading:()=>{p&&p.close(),t&&(p=t())},hideLoading:()=>{p&&(p.close(),p=null)},...s}}),jsonp:f.jsonp,notify:e,loading:t,useTitle:o,alert:c,startupComponent:r,access:i?new Y({alert:c,...i}):void 0}}function wt(n={}){return new Y(n)}function Be(n,e){const{jsonp:t,request:s}=e;if(n.method==="jsonp")return(r={})=>t(n.url,{...n.jsonpOptions,query:r});{const r=n.headers?H(n.headers,{},!0):void 0,i={url:n.url,method:n.method,settings:{...n.settings,headers:r}};return(o,c)=>(delete i.data,s.send(f.merge(i,c||{},{data:o})))}}function Je(n,e){const{metaQuery:t}=e;if(!t)return;const{code:s,queryCode:r}=n;return(i,o)=>{if(!t){console.warn("adapter.metaQuery is not defined!");return}return t(s,r,i,o)}}function Ke(n=[],e=[],t){const s={};for(const r of n){const i=Be(r,t);s[r.id]=i,s[r.name]=i}for(const r of e)s[r.id]=Je(r,t);return s}async function Ge(n=[],e=window){const t=k(e);t&&(he(e),n.forEach(s=>Ve(t,s)))}function ze(n,e=window){const t=C(n.mockTemplate)&&n.mockTemplate.value?R(n.mockTemplate,{},!0):void 0,s=k(e);return async(...r)=>{let i={};if(t)try{i=await t.apply(t,r)}catch(o){f.logger.warn("模拟数据模版异常",o)}return s?.mock(i)}}function Ve(n,e){if(!e.mock)return;const{url:t,mockTemplate:s,method:r="get"}=e;if(t&&s)try{const i=f.isUrl(t)?new URL(t).pathname:t,o=f.pathToRegexp(`(.*)${i}(.*)`),c=f.pathToRegexpMatch(i,{decode:decodeURIComponent}),p=H(s,{},!0);n.mock(o,r.toLowerCase(),a=>{const l=f.url.parse(a.url)||{},u=a.body instanceof FormData?f.formDataToJson(a.body):a.body,d=f.isUrl(a.url)?new URL(a.url).pathname:a.url.split("?")[0],h=c(d)?.params;Object.assign(a,{data:u,params:h,query:l});try{return n.mock(p(a))}catch(m){return console.warn("[mockApi]",o,a,m),null}})}catch(i){console.warn("mockApi",i)}}function he(n=window){const e=k(n);e&&(e._mocked={})}class We{__id=null;__mode;__instance=null;__contextRefs={};__refs={};__refCaches={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};$provider=null;__transform={};constructor(e){const{mode:t,dsl:s,attrs:r}=e;this.__mode=t,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),r&&Object.assign(this,r)}setup(e,t=W){const s=t.getCurrentInstance();if(!s)return;this.__refs={},this.__refCaches={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=s.proxy;const r=s.appContext.config.globalProperties;Object.assign(this,r),Object.assign(this,e||{}),this.__proxy(),t.onMounted(()=>{this.__proxy()}),t.onUnmounted(()=>{this.__cleanup()}),t.onBeforeUpdate(()=>{this.__reset()})}__proxy(){if(!this.__instance)return;const e=this.__instance;oe.forEach(t=>{this[t]=e[t]||e._?.[t.replace("$","")]||null})}__cleanup(){oe.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.__refCaches={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:s}=e,r=t?this.__transform[t]??e.value:e.value;return R({type:s,value:r},this)}else return R(e,this)}__parseExpression(e){if(e)if(this.__mode===S.Runtime){const{id:t,type:s}=e,r=t?this.__transform[t]??e.value:e.value;return H({type:s,value:r},this)}else return H(e,this)}__ref(e=null,t){if(this.__mode===S.VNode)return;e&&e!==this.__id&&(this.__contextRefs[e]=this);let s=e?this.__refCaches[e]:null;return s||(s=async r=>{await f.delay(0);let i=r?.$vtjEl||r?.$el||r?._?.vnode?.el||r;if(!i){typeof t=="string"&&(delete this.$refs[t],e&&delete this.__refs[e]);return}return i.nodeType===3&&i.nextSibling&&(i=i.nextSibling),i.__vtj__=e,S.Design===this.__mode&&(i.__context__=this,i.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,r)),typeof t=="function"?t(r):t&&(this.$refs[t]=this.__getRefEl(this.$refs,t,r)),r},e&&(this.__refCaches[e]=s),s)}__getRefEl(e,t,s){const r=e[t];if(r&&s!==r){const i=new Set([].concat(r,s));return Array.from(i)}else return s}__clone(e={}){const t={...this.context,...e},s={...t,context:t};return s.context.__proto__=this.context,s.__proto__=this,s}}function z(n){const{Vue:e=W,mode:t=S.Runtime,components:s={},libs:r={},apis:i={},loader:o}=n,c=e.computed(()=>n.dsl),p={$components:s,$libs:r,$apis:i},a=new We({mode:t,dsl:c.value,attrs:p}),l=e.defineComponent({name:c.value.name,__scopeId:c.value.id?`data-v-${c.value.id}`:void 0,props:{...$t(c.value.props??[],a)},async setup(u={}){a.$props=u,a.props=u,c.value.id&&Q(n.window||window,c.value.id,c.value.css||"",!0),a.state=Ct(e,c.value.state??{},a);const d=bt(e,c.value.computed??{},a),h=jt(c.value.methods??{},a),m=Rt(e,c.value.inject,a);for(const[y,w]of Object.entries(m||{}))m[y]=e.inject(y,w);const g=Qe(c.value.dataSources||{},a),_={...m,...d,...h,...g};return a.setup(_,e),Pt(e,c.value.watch??[],a),{vtj:a,state:a.state,...u,...d,...h}},emits:Et(c.value.emits),expose:["vtj",...c.value.expose||[]],render(){if(!c.value.nodes)return null;const u=c.value.nodes||[];if(u.length===1)return M(u[0],a,e,o,u);{const d=u.map(h=>M(h,a,e,o,u));return e.createVNode("div",{},d)}},...At(c.value.lifeCycles??{},a)});return{renderer:e.markRaw(l),context:a}}function Et(n=[]){return n.map(e=>f.isString(e)?e:e.name)}function $t(n=[],e){const t=s=>s?(Array.isArray(s)?s:[s]).map(i=>Ce[i]):void 0;return n.map(s=>f.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:b(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,r)=>(s[r.name]={type:t(r.type),required:r.required,default:r.default},s),{})}function Ct(n,e,t){return n.reactive(Object.keys(e||{}).reduce((s,r)=>{let i=e[r];return b(i)?i=t.__parseExpression(i):C(i)&&(i=t.__parseFunction(i)),s[r]=i,s},{}))}function bt(n,e,t){return Object.entries(e??{}).reduce((s,[r,i])=>(s[r]=n.computed(t.__parseFunction(i)),s),{})}function jt(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>(t[s]=e.__parseFunction(r),t),{})}function Rt(n,e=[],t){return e.reduce((s,r)=>{const{name:i,from:o}=r||{};r.default;const c=b(o)?t.__parseExpression(o)||i:o??i,p=b(r.default)?t.__parseExpression(r.default):r.default??null;return s[i]=n.inject(c,p),s},{})}function Qe(n,e){return Object.keys(n).reduce((t,s)=>{const r=n[s];if(r.type==="mock")t[s]=ze(r);else if(r.ref){const i=e.$apis[r.ref],o=C(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;t[s]=async(...c)=>{const p=await i.apply(e,c);return o?o(p):p}}return t},{})}function Pt(n,e=[],t){e.forEach(s=>{n.watch(t.__parseExpression(s.source),t.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function At(n,e){return Object.entries(n??{}).reduce((t,[s,r])=>{const i=e.__parseFunction(r);return t[s]=async()=>{f.isFunction(i)&&(await f.delay(0),await i())},t},{})}class It{__props={};__events={};__nodes={};constructor(){}setProps(e,t){this.__props[e]=t}getProps(e){return this.__props[e]}loadProps(e,t){const s=e?this.getProps(e):null;return s||(e&&this.setProps(e,t),t)}setEvents(e,t){}getEvents(e){return this.__events[e]}loadEvents(e,t){const s=e?this.getEvents(e):null;return s||(e&&this.setEvents(e,t),t)}setNode(e,t){this.__nodes[e]=t}getNode(e){return this.__nodes[e]}loadNode(e,t){const s=e?this.getNode(e):null;return s||(e&&this.setNode(e,t),t)}isEqual(e,t){return f.isEqual(e,t)}clear(){this.__props={},this.__events={},this.__nodes={}}}const O=new It,Ye=new f.Queue;let ne=[],T={},L={};const Xe=(n,e)=>e;async function me(n,e=window){const{urls:t=[],library:s}=n,r=t.filter(c=>J(c));if(r.length===0||!s)return null;const i=t.filter(c=>B(c));return i.length&&pe(i,e),await fe(r,s,e).catch(c=>(console.warn("loadScriptUrl error",r,s,c),null))}function V(n){const{getDsl:e,getDslByUrl:t,options:s}=n;return s.window&&(ne.forEach(r=>{delete s.window[r]}),ne=[]),(r,i,o,c=W)=>{if(!o||typeof o=="string")return i;let p="";if(o.type==="Schema"&&o.id)return p=o.id+"_"+r,L[p]||(L[p]=c.defineAsyncComponent(async()=>{const a=T[o.id]||await Ye.add(o.id,()=>e(o.id));return a&&(a.name=i,T[o.id]=a),a?z({Vue:c,mode:S.Runtime,...s,dsl:f.cloneDeep(a),loader:V(n)}).renderer:null}));if(o.type==="UrlSchema"&&o.url)return p=o.url+"_"+r,L[p]||(L[p]=c.defineAsyncComponent(async()=>{const a=T[o.url]||await t(o.url);return a&&(a.name=i,T[o.url]=a),a?z({...s,Vue:c,dsl:f.cloneDeep(a),mode:S.Runtime,loader:V(n)}).renderer:null}));if(o.type==="Plugin"){let a=o.library?T[o.library]:null;return a||(o.library&&ne.push(o.library),a=T[o.library||Symbol()]=c.defineAsyncComponent(async()=>{const l=await me(o,s.window);return l||(console.warn("getPlugin result is null",o),null)}),a)}return i}}function Ft(){T={},L={},Ye.clearAllCache(),O.clear()}function M(n,e,t=W,s=Xe,r=[],i=!1,o=0){if(!n||!n.name||n.invisible)return null;const c=t.getCurrentInstance()?.appContext,{id:p=null,directives:a=[]}=n,{vIf:l,vElseIf:u,vElse:d,vFor:h,vShow:m,vModels:g,vBind:_,vHtml:y,others:w}=Ze(a);if(!i&&(u||d))return null;if(l&&!Mt(l,e))return Nt(n,e,t,s,r);const j=(v,A=0)=>{const Z=v.$components,ee=(()=>{if(n.name==="component")return Ot(v,n.props?.is);if(n.name==="slot")return n.name;const P=s(`${n.id}_${A}`,n.name,n.from,t);return f.isString(P)?De(P)||ke(P)?P:Z[P]??c?.app?.component(P)??P:P})(),I=xt(p,n.props??{},v),rt=Ht(t,n.id,n.events??{},v);if(n.name==="slot")return Lt(t,n,I,v,s);_&&Object.assign(I,v.__parseExpression(_.value)),m&&(I.style=Object.assign(I.style??{},qt(m,v))),y&&Object.assign(I,Bt(y,v)),g.forEach(P=>{le.includes(n.name)?Object.assign(I,Jt(P,v)):Object.assign(I,Kt(t,P,v))});const it=Gt(t,n.children??[],v,s,n),Se=v?.__id?`data-v-${v.__id}`:void 0,ot=Se?{[Se]:""}:{},at=v.__mode===S.Design?{"data-vtj":p}:{},K=`${p}_${A}`,te={key:K,...ot,...at,...I,...rt};O.isEqual(te,O.getNode(K))||O.setNode(K,te);let se=t.createVNode(ee,O.getNode(K)||te||{},it);const we=c?Tt(c,w,v):[];return we.length&&(se=t.withDirectives(se,we)),se};return h?Wt(h,j,e):j(e,o)}function Tt(n,e,t){const s=n.app;return e.map(r=>{const i=typeof r.name=="string"?s.directive(r.name):t.__parseExpression(r.name);if(!i)return null;const o=[i];return r.value&&o.push(t.__parseExpression(r.value)),r.arg&&o.push(r.arg),r.modifiers&&o.push(r.modifiers),o}).filter(r=>!!r)}function Ze(n=[]){const e=n.find(l=>f.camelCase(l.name)==="vIf"),t=n.find(l=>f.camelCase(l.name)==="vElseIf"),s=n.find(l=>f.camelCase(l.name)==="vElse"),r=n.find(l=>f.camelCase(l.name)==="vFor"),i=n.find(l=>f.camelCase(l.name)==="vShow"),o=n.find(l=>f.camelCase(l.name)==="vBind"),c=n.find(l=>f.camelCase(l.name)==="vHtml"),p=n.filter(l=>f.camelCase(l.name)==="vModel"),a=n.filter(l=>!$e.includes(f.camelCase(l.name)));return{vIf:e,vElseIf:t,vElse:s,vFor:r,vShow:i,vModels:p,vBind:o,others:a,vHtml:c}}function Mt(n,e){return!!e.__parseExpression(n.value)}function Ot(n,e){return e?b(e)?n.__parseExpression(e):e:"div"}function xt(n,e,t){const s=ae(e,t);return s.ref=t.__ref(n,s.ref),s}function ae(n,e){return b(n)?e.__parseExpression(n):C(n)?e.__parseFunction(n):Array.isArray(n)?n.map(t=>ae(t,e)):typeof n=="object"?Object.keys(n||{}).reduce((t,s)=>{let r=n[s];return t[s]=ae(r,e),t},{}):n}function Dt(n,e){return t=>{t?.key?.toLowerCase()===e.toLowerCase()&&n(t)}}function kt(n){return He(n.value)?n:Ne(n.value)?{type:"JSFunction",value:`(...args) => (() => {
|
|
7
|
+
*/const ge="0.17.7";var T=(t=>(t.Runtime="Runtime",t.Design="Design",t.Raw="Raw",t.VNode="VNode",t))(T||{});const at=["$el","$emit","$nextTick","$parent","$root","$attrs","$slots","$watch","$props","$options","$forceUpdate"],ls=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeUnmount","unmounted","errorCaptured","renderTracked","renderTriggered","activated","deactivated"],Kt=["vIf","vElseIf","vElse","vShow","vModel","vFor","vBind","vHtml"],Jt={String,Number,Boolean,Array,Object,Function,Date},xe="VtjPage",Ce="VtjHomepage",ft="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(","),Qt="component,slot".split(","),hs=["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o"].join(""),ps={auth:["h","t","t","p","s",":","/","/","a","p","p",".","v","t","j",".","p","r","o","/","a","u","t","h",".","h","t","m","l"].join(""),storageKey:["R","R","O","_","I","D","E","_","A","C","C","E","S","S","_","S","T","O","R","A","G","E","_","_"].join(""),privateKey:"MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"};function _e(t,e){return t.map(i=>f.isUrl(i)||i.startsWith("/")?i:`${e}${i}`)}function Pe(t){return/\.css$/.test(t)}function Te(t){return/\.js$/.test(t)}function Yt(t){return/\.json$/.test(t)}function fs(t){return t.map(e=>`<script src="${f.url.append(e,{v:ge})}"><\/script>`).join("")}function ds(t=[]){return t.map(e=>`<link rel="stylesheet" href="${f.url.append(e,{v:ge})}" />`).join("")}function Xt(t,e=!1){return e&&t.endsWith(".prod.js")?t.replace(".prod.js",".js"):t}function Zt(t,e,i=!1){const s=t.filter(m=>!!m.enabled),r=[],n=[],a=[],u=[],l={},c={},h=[],p={};return s.forEach(({urls:m,assetsUrl:d,library:g,assetsLibrary:v,localeLibrary:y})=>{m?.forEach(k=>{Te(k)&&r.push(Xt(k,i)),Pe(k)&&n.push(k)}),g&&(u.push(g),l[g]=_e(m||[],e),y&&(c[g]=y)),d&&a.push(d),v&&h.push(v),g&&v&&(p[v]=g)}),{scripts:_e(r,e),css:_e(n,e),materials:_e(a,e),libraryExports:u,materialExports:f.dedupArray(h),materialMapLibrary:p,libraryMap:l,libraryLocaleMap:c}}function ei(t,e){const{name:i,parent:s,alias:r}=t;return s?e[s]?.[r||i]:e[r||i]}function ti(t=[]){const e=t.filter(s=>Pe(s)),i=t.filter(s=>Te(s));return{css:e,js:i}}function ii(t,e){const i=c=>{const h=[];let p=0;for(;p<c.length;){if(/\s/.test(c[p])){p++;continue}if(c.substring(p,p+2)==="/*"){const k=c.indexOf("*/",p+2);if(k!==-1){p=k+2;continue}}if(c[p]==="@"){const k=p;for(;p<c.length&&c[p]!=="{"&&c[p]!==";";)p++;const P=c.substring(k,p).trim(),O=P.includes("@keyframes");if(c[p]===";")h.push({type:"simple-at-rule",content:c.substring(k,p+1)}),p++;else if(c[p]==="{"){const E=p+1;let Y=1;for(p++;p<c.length&&Y>0;)c[p]==="{"?Y++:c[p]==="}"&&Y--,p++;const Qe=c.substring(k,p),Ye=c.substring(E,p-1);h.push({type:O?"keyframes":"at-rule",rule:P,content:Qe,inner:Ye})}continue}const m=p;for(;p<c.length&&c[p]!=="{";)p++;if(p>=c.length)break;const d=c.substring(m,p).trim();if(!d){p++;continue}const g=p+1;let v=1;for(p++;p<c.length&&v>0;)c[p]==="{"?v++:c[p]==="}"&&v--,p++;const y=c.substring(g,p-1);h.push({type:"rule",selector:d,content:y.trim()})}return h},s=c=>{const h=c.trim();return/^(from|to|\d+(\.\d+)?%)$/.test(h)},r=c=>c.replace(/::v-deep\(/g,":deep(").replace(/::v-deep\s+/g,":deep(").replace(/\/deep\//g," ").replace(/>>>/g," ").replace(/(.*?):deep\(([^)]+)\)/g,(h,p,m)=>{const d=p.trim(),g=m.trim();return d?`${d}[${e}] ${g}`:g}),n=c=>{const h=c.trim();if(!h||h.includes(`[${e}]`)||/^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(h)||s(h))return h;const p=h.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);if(p){const[,m,d=""]=p,g=m.trim();return g?`${g}[${e}]${d}`:h}return`${h}[${e}]`},a=c=>r(c).split(",").map(p=>n(p)).filter(p=>p.trim()).join(", "),u=c=>c.map(h=>{switch(h.type){case"simple-at-rule":return h.content;case"keyframes":return h.content;case"at-rule":try{const m=i(h.inner),d=u(m);return`${h.rule} { ${d} }`}catch{return h.content}case"rule":if(!h.selector||!h.content)return"";const p=a(h.selector);return p.trim()?`${p} { ${h.content} }`:"";default:return""}}).filter(h=>h.trim()).join(" "),l=c=>c.replace(/\s*{\s*/g," { ").replace(/\s*}\s*/g," } ").replace(/\s*;\s*/g,"; ").replace(/\s*,\s*/g,", ").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"").replace(/\s*}\s*}/g," } }").trim();try{const c=t.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g,"").replace(/^\s+|\s+$/gm,"").replace(/\n\s*\n/g,`
|
|
8
|
+
`),h=i(c),p=u(h);return l(p)}catch(c){return console.error("CSS scoping failed:",c),console.error("Input CSS:",t),t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,h=>h).replace(/([^{}@]+)(?=\s*{)/g,h=>{const p=h.trim();return!p||p.startsWith("@")||p.includes(`[${e}]`)||s(p)?h:`${p}[${e}]`})}}const ms=750;function si(t,e,i){let s;typeof t<"u"?s=t.innerWidth||t.document.documentElement.clientWidth:(console.warn("无法获取屏幕宽度,使用默认值375"),s=375);const r=i||ms;return e*s/r}function ri(t,e){let i=!1,s=!1,r=!1,n="";for(let a=0;a<e.length;a++){const u=e[a];if(u==="'"&&!s&&!r?i=!i:u==='"'&&!i&&!r?s=!s:e.substr(a,4).toLowerCase()==="url("&&!i&&!s?r=!0:u===")"&&r&&(r=!1),!i&&!s&&!r){const l=e.substr(a).match(/^(-?\d+(?:\.\d+)?)\s*rpx/);if(l){const c=l[1],h=parseFloat(c),m=`${si(t,h).toFixed(6).replace(/\.?0+$/,"")}px`;n+=m,a+=l[0].length-1;continue}}n+=u}return n}function dt(t){return f.isString(t)?t:JSON.stringify(t)}function He(t,e,i,s=!1){const r=t.CSSStyleSheet,n=s?`data-v-${e}`:e,a=t.__uniConfig?ri(t,i):i,u=s?ii(a,n):a,l=!!t.__uniConfig;if(r.prototype.replaceSync&&!l){const c=new r;c.id=e,c.replaceSync(u);const h=t.document,p=h.adoptedStyleSheets,m=Array.from(p).filter(d=>d.id!==e);h.adoptedStyleSheets=[...m,c]}else{const c=t.document;let h=c.getElementById(e);h?h.innerHTML=u:(h=c.createElement("style"),h.id=e,h.innerHTML=u,c.head.appendChild(h))}}function gs(t){const e=t.adoptedStyleSheets||[];let i="";if(e.forEach(s=>{try{for(const r of s.cssRules)i+=r.cssText+`
|
|
9
|
+
`}catch(r){console.error("Failed to read cssRules from adopted stylesheet:",r)}}),i){const s=t.createElement("style");s.textContent=i,t.head.appendChild(s)}}async function ni(t,e){const i=await window.fetch(e).then(s=>s.text()).catch(()=>"");i&&He(window,t,i)}function mt(t,e=window){const i=e.document,s=e.document.head;for(const r of t)if(!i.getElementById(r)){const a=i.createElement("link");a.rel="stylesheet",a.id=r,a.href=r,s.appendChild(a)}}async function gt(t,e,i=window){const s=i.document,r=i.document.head;let n=i[e];return n?n.default||n:new Promise((a,u)=>{for(const l of t){const c=s.createElement("script");c.src=l,c.onload=()=>{n=i[e],n?a(n.default||n):u(null)},c.onerror=h=>{u(h)},r.appendChild(c)}})}function ai(t){return f.isFunction(t)&&Object.getOwnPropertyNames(t.prototype||{}).length===0||f.isFunction(t?.install)}function oi(t){return Qt.includes(t)}function ui(t){return ft.includes(t)}function ve(t=window){const e=window?.Mock;if(e)return e;const i=t?.Mock;if(i&&window)return window.Mock=i,i}function xs(t,e,i){Object.assign(e.meta,i.meta);const s=t?._container;i?.type==="page"&&s.classList.add("is-page"),i?.pure&&s.classList.add("is-pure")}function ci(t){return/^\([\s\S]*\)/.test(t.trim())}function li(t){return/\w+\([\s\S]*\)$/.test(t.trim())}function hi(t){return t.includes("=")}var et={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},tt="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",vs={5:tt,"5module":tt+" export import",6:tt+" const class extends export import super"},ys=/^in(stanceof)?$/,xt="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",pi="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",bs=new RegExp("["+xt+"]"),_s=new RegExp("["+xt+pi+"]");xt=pi=null;var fi=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],Ss=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function ot(t,e){for(var i=65536,s=0;s<e.length;s+=2){if(i+=e[s],i>t)return!1;if(i+=e[s+1],i>=t)return!0}}function ne(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&bs.test(String.fromCharCode(t)):e===!1?!1:ot(t,fi)}function ye(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&_s.test(String.fromCharCode(t)):e===!1?!1:ot(t,fi)||ot(t,Ss)}var w=function(e,i){i===void 0&&(i={}),this.label=e,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function H(t,e){return new w(t,{beforeExpr:!0,binop:e})}var U={beforeExpr:!0},B={startsExpr:!0},vt={};function C(t,e){return e===void 0&&(e={}),e.keyword=t,vt[t]=new w(t,e)}var o={num:new w("num",B),regexp:new w("regexp",B),string:new w("string",B),name:new w("name",B),eof:new w("eof"),bracketL:new w("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new w("]"),braceL:new w("{",{beforeExpr:!0,startsExpr:!0}),braceR:new w("}"),parenL:new w("(",{beforeExpr:!0,startsExpr:!0}),parenR:new w(")"),comma:new w(",",U),semi:new w(";",U),colon:new w(":",U),dot:new w("."),question:new w("?",U),questionDot:new w("?."),arrow:new w("=>",U),template:new w("template"),invalidTemplate:new w("invalidTemplate"),ellipsis:new w("...",U),backQuote:new w("`",B),dollarBraceL:new w("${",{beforeExpr:!0,startsExpr:!0}),eq:new w("=",{beforeExpr:!0,isAssign:!0}),assign:new w("_=",{beforeExpr:!0,isAssign:!0}),incDec:new w("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new w("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:H("||",1),logicalAND:H("&&",2),bitwiseOR:H("|",3),bitwiseXOR:H("^",4),bitwiseAND:H("&",5),equality:H("==/!=/===/!==",6),relational:H("</>/<=/>=",7),bitShift:H("<</>>/>>>",8),plusMin:new w("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:H("%",10),star:H("*",10),slash:H("/",10),starstar:new w("**",{beforeExpr:!0}),coalesce:H("??",1),_break:C("break"),_case:C("case",U),_catch:C("catch"),_continue:C("continue"),_debugger:C("debugger"),_default:C("default",U),_do:C("do",{isLoop:!0,beforeExpr:!0}),_else:C("else",U),_finally:C("finally"),_for:C("for",{isLoop:!0}),_function:C("function",B),_if:C("if"),_return:C("return",U),_switch:C("switch"),_throw:C("throw",U),_try:C("try"),_var:C("var"),_const:C("const"),_while:C("while",{isLoop:!0}),_with:C("with"),_new:C("new",{beforeExpr:!0,startsExpr:!0}),_this:C("this",B),_super:C("super",B),_class:C("class",B),_extends:C("extends",U),_export:C("export"),_import:C("import",B),_null:C("null",B),_true:C("true",B),_false:C("false",B),_in:C("in",{beforeExpr:!0,binop:7}),_instanceof:C("instanceof",{beforeExpr:!0,binop:7}),_typeof:C("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:C("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:C("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},q=/\r\n?|\n|\u2028|\u2029/,Ee=new RegExp(q.source,"g");function Ne(t,e){return t===10||t===13||!e&&(t===8232||t===8233)}var di=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,$=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,mi=Object.prototype,Cs=mi.hasOwnProperty,ws=mi.toString;function Ue(t,e){return Cs.call(t,e)}var Mt=Array.isArray||(function(t){return ws.call(t)==="[object Array]"});function ce(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}var ke=function(e,i){this.line=e,this.column=i};ke.prototype.offset=function(e){return new ke(this.line,this.column+e)};var $e=function(e,i,s){this.start=i,this.end=s,e.sourceFile!==null&&(this.source=e.sourceFile)};function gi(t,e){for(var i=1,s=0;;){Ee.lastIndex=s;var r=Ee.exec(t);if(r&&r.index<e)++i,s=r.index+r[0].length;else return new ke(i,e-s)}}var ut={ecmaVersion:10,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};function Es(t){var e={};for(var i in ut)e[i]=t&&Ue(t,i)?t[i]:ut[i];if(e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),Mt(e.onToken)){var s=e.onToken;e.onToken=function(r){return s.push(r)}}return Mt(e.onComment)&&(e.onComment=ks(e,e.onComment)),e}function ks(t,e){return function(i,s,r,n,a,u){var l={type:i?"Block":"Line",value:s,start:r,end:n};t.locations&&(l.loc=new $e(this,a,u)),t.ranges&&(l.range=[r,n]),e.push(l)}}var Ie=1,Re=2,yt=Ie|Re,xi=4,vi=8,yi=16,bi=32,_i=64,Si=128;function bt(t,e){return Re|(t?xi:0)|(e?vi:0)}var Dt=0,_t=1,X=2,Ci=3,wi=4,Ei=5,A=function(e,i,s){this.options=e=Es(e),this.sourceFile=e.sourceFile,this.keywords=ce(vs[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var r="";if(e.allowReserved!==!0){for(var n=e.ecmaVersion;!(r=et[n]);n--);e.sourceType==="module"&&(r+=" await")}this.reservedWords=ce(r);var a=(r?r+" ":"")+et.strict;this.reservedWordsStrict=ce(a),this.reservedWordsStrictBind=ce(a+" "+et.strictBind),this.input=String(i),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf(`
|
|
10
|
+
`,s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(q).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=o.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports={},this.pos===0&&e.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Ie),this.regexpState=null},he={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0}};A.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)};he.inFunction.get=function(){return(this.currentVarScope().flags&Re)>0};he.inGenerator.get=function(){return(this.currentVarScope().flags&vi)>0};he.inAsync.get=function(){return(this.currentVarScope().flags&xi)>0};he.allowSuper.get=function(){return(this.currentThisScope().flags&_i)>0};he.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Si)>0};he.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};A.prototype.inNonArrowFunction=function(){return(this.currentThisScope().flags&Re)>0};A.extend=function(){for(var e=[],i=arguments.length;i--;)e[i]=arguments[i];for(var s=this,r=0;r<e.length;r++)s=e[r](s);return s};A.parse=function(e,i){return new this(i,e).parse()};A.parseExpressionAt=function(e,i,s){var r=new this(s,e,i);return r.nextToken(),r.parseExpression()};A.tokenizer=function(e,i){return new this(i,e)};Object.defineProperties(A.prototype,he);var V=A.prototype,Is=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;V.strictDirective=function(t){for(;;){$.lastIndex=t,t+=$.exec(this.input)[0].length;var e=Is.exec(this.input.slice(t));if(!e)return!1;if((e[1]||e[2])==="use strict"){$.lastIndex=t+e[0].length;var i=$.exec(this.input),s=i.index+i[0].length,r=this.input.charAt(s);return r===";"||r==="}"||q.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||r==="!"&&this.input.charAt(s+1)==="=")}t+=e[0].length,$.lastIndex=t,t+=$.exec(this.input)[0].length,this.input[t]===";"&&t++}};V.eat=function(t){return this.type===t?(this.next(),!0):!1};V.isContextual=function(t){return this.type===o.name&&this.value===t&&!this.containsEsc};V.eatContextual=function(t){return this.isContextual(t)?(this.next(),!0):!1};V.expectContextual=function(t){this.eatContextual(t)||this.unexpected()};V.canInsertSemicolon=function(){return this.type===o.eof||this.type===o.braceR||q.test(this.input.slice(this.lastTokEnd,this.start))};V.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};V.semicolon=function(){!this.eat(o.semi)&&!this.insertSemicolon()&&this.unexpected()};V.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0};V.expect=function(t){this.eat(t)||this.unexpected()};V.unexpected=function(t){this.raise(t??this.start,"Unexpected token")};function Ge(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}V.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var i=e?t.parenthesizedAssign:t.parenthesizedBind;i>-1&&this.raiseRecoverable(i,"Parenthesized pattern")}};V.checkExpressionErrors=function(t,e){if(!t)return!1;var i=t.shorthandAssign,s=t.doubleProto;if(!e)return i>=0||s>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),s>=0&&this.raiseRecoverable(s,"Redefinition of __proto__ property")};V.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};V.isSimpleAssignTarget=function(t){return t.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(t.expression):t.type==="Identifier"||t.type==="MemberExpression"};var b=A.prototype;b.parseTopLevel=function(t){var e={};for(t.body||(t.body=[]);this.type!==o.eof;){var i=this.parseStatement(null,!0,e);t.body.push(i)}if(this.inModule)for(var s=0,r=Object.keys(this.undefinedExports);s<r.length;s+=1){var n=r[s];this.raiseRecoverable(this.undefinedExports[n].start,"Export '"+n+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var St={kind:"loop"},As={kind:"switch"};b.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;$.lastIndex=this.pos;var e=$.exec(this.input),i=this.pos+e[0].length,s=this.input.charCodeAt(i);if(s===91)return!0;if(t)return!1;if(s===123)return!0;if(ne(s,!0)){for(var r=i+1;ye(this.input.charCodeAt(r),!0);)++r;var n=this.input.slice(i,r);if(!ys.test(n))return!0}return!1};b.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;$.lastIndex=this.pos;var t=$.exec(this.input),e=this.pos+t[0].length;return!q.test(this.input.slice(this.pos,e))&&this.input.slice(e,e+8)==="function"&&(e+8===this.input.length||!ye(this.input.charAt(e+8)))};b.parseStatement=function(t,e,i){var s=this.type,r=this.startNode(),n;switch(this.isLet(t)&&(s=o._var,n="let"),s){case o._break:case o._continue:return this.parseBreakContinueStatement(r,s.keyword);case o._debugger:return this.parseDebuggerStatement(r);case o._do:return this.parseDoStatement(r);case o._for:return this.parseForStatement(r);case o._function:return t&&(this.strict||t!=="if"&&t!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case o._class:return t&&this.unexpected(),this.parseClass(r,!0);case o._if:return this.parseIfStatement(r);case o._return:return this.parseReturnStatement(r);case o._switch:return this.parseSwitchStatement(r);case o._throw:return this.parseThrowStatement(r);case o._try:return this.parseTryStatement(r);case o._const:case o._var:return n=n||this.value,t&&n!=="var"&&this.unexpected(),this.parseVarStatement(r,n);case o._while:return this.parseWhileStatement(r);case o._with:return this.parseWithStatement(r);case o.braceL:return this.parseBlock(!0,r);case o.semi:return this.parseEmptyStatement(r);case o._export:case o._import:if(this.options.ecmaVersion>10&&s===o._import){$.lastIndex=this.pos;var a=$.exec(this.input),u=this.pos+a[0].length,l=this.input.charCodeAt(u);if(l===40||l===46)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),s===o._import?this.parseImport(r):this.parseExport(r,i);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var c=this.value,h=this.parseExpression();return s===o.name&&h.type==="Identifier"&&this.eat(o.colon)?this.parseLabeledStatement(r,c,h,t):this.parseExpressionStatement(r,h)}};b.parseBreakContinueStatement=function(t,e){var i=e==="break";this.next(),this.eat(o.semi)||this.insertSemicolon()?t.label=null:this.type!==o.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var s=0;s<this.labels.length;++s){var r=this.labels[s];if((t.label==null||r.name===t.label.name)&&(r.kind!=null&&(i||r.kind==="loop")||t.label&&i))break}return s===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,i?"BreakStatement":"ContinueStatement")};b.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")};b.parseDoStatement=function(t){return this.next(),this.labels.push(St),t.body=this.parseStatement("do"),this.labels.pop(),this.expect(o._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(o.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")};b.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(St),this.enterScope(0),this.expect(o.parenL),this.type===o.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var i=this.isLet();if(this.type===o._var||this.type===o._const||i){var s=this.startNode(),r=i?"let":this.value;return this.next(),this.parseVar(s,!0,r),this.finishNode(s,"VariableDeclaration"),(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&s.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===o._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,s)):(e>-1&&this.unexpected(e),this.parseFor(t,s))}var n=new Ge,a=this.parseExpression(!0,n);return this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.options.ecmaVersion>=9&&(this.type===o._in?e>-1&&this.unexpected(e):t.await=e>-1),this.toAssignable(a,!1,n),this.checkLVal(a),this.parseForIn(t,a)):(this.checkExpressionErrors(n,!0),e>-1&&this.unexpected(e),this.parseFor(t,a))};b.parseFunctionStatement=function(t,e,i){return this.next(),this.parseFunction(t,we|(i?0:ct),!1,e)};b.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(o._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")};b.parseReturnStatement=function(t){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(o.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")};b.parseSwitchStatement=function(t){this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect(o.braceL),this.labels.push(As),this.enterScope(0);for(var e,i=!1;this.type!==o.braceR;)if(this.type===o._case||this.type===o._default){var s=this.type===o._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),s?e.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,e.test=null),this.expect(o.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")};b.parseThrowStatement=function(t){return this.next(),q.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var Ps=[];b.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===o._catch){var e=this.startNode();if(this.next(),this.eat(o.parenL)){e.param=this.parseBindingAtom();var i=e.param.type==="Identifier";this.enterScope(i?bi:0),this.checkLVal(e.param,i?wi:X),this.expect(o.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0);e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(o._finally)?this.parseBlock():null,!t.handler&&!t.finalizer&&this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")};b.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")};b.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(St),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")};b.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")};b.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")};b.parseLabeledStatement=function(t,e,i,s){for(var r=0,n=this.labels;r<n.length;r+=1){var a=n[r];a.name===e&&this.raise(i.start,"Label '"+e+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===o._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var c=this.labels[l];if(c.statementStart===t.start)c.statementStart=this.start,c.kind=u;else break}return this.labels.push({name:e,kind:u,statementStart:this.start}),t.body=this.parseStatement(s?s.indexOf("label")===-1?s+"label":s:"label"),this.labels.pop(),t.label=i,this.finishNode(t,"LabeledStatement")};b.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")};b.parseBlock=function(t,e,i){for(t===void 0&&(t=!0),e===void 0&&(e=this.startNode()),e.body=[],this.expect(o.braceL),t&&this.enterScope(0);this.type!==o.braceR;){var s=this.parseStatement(null);e.body.push(s)}return i&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")};b.parseFor=function(t,e){return t.init=e,this.expect(o.semi),t.test=this.type===o.semi?null:this.parseExpression(),this.expect(o.semi),t.update=this.type===o.parenR?null:this.parseExpression(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")};b.parseForIn=function(t,e){var i=this.type===o._in;return this.next(),e.type==="VariableDeclaration"&&e.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||e.kind!=="var"||e.declarations[0].id.type!=="Identifier")?this.raise(e.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"):e.type==="AssignmentPattern"&&this.raise(e.start,"Invalid left-hand side in for-loop"),t.left=e,t.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(o.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,i?"ForInStatement":"ForOfStatement")};b.parseVar=function(t,e,i){for(t.declarations=[],t.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(o.eq)?s.init=this.parseMaybeAssign(e):i==="const"&&!(this.type===o._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():s.id.type!=="Identifier"&&!(e&&(this.type===o._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,t.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(o.comma))break}return t};b.parseVarId=function(t,e){t.id=this.parseBindingAtom(),this.checkLVal(t.id,e==="var"?_t:X,!1)};var we=1,ct=2,ki=4;b.parseFunction=function(t,e,i,s){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!s)&&(this.type===o.star&&e&ct&&this.unexpected(),t.generator=this.eat(o.star)),this.options.ecmaVersion>=8&&(t.async=!!s),e&we&&(t.id=e&ki&&this.type!==o.name?null:this.parseIdent(),t.id&&!(e&ct)&&this.checkLVal(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?_t:X:Ci));var r=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(bt(t.async,t.generator)),e&we||(t.id=this.type===o.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,i,!1),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(t,e&we?"FunctionDeclaration":"FunctionExpression")};b.parseFunctionParams=function(t){this.expect(o.parenL),t.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};b.parseClass=function(t,e){this.next();var i=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var s=this.startNode(),r=!1;for(s.body=[],this.expect(o.braceL);this.type!==o.braceR;){var n=this.parseClassElement(t.superClass!==null);n&&(s.body.push(n),n.type==="MethodDefinition"&&n.kind==="constructor"&&(r&&this.raise(n.start,"Duplicate constructor in the same class"),r=!0))}return this.strict=i,this.next(),t.body=this.finishNode(s,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")};b.parseClassElement=function(t){var e=this;if(this.eat(o.semi))return null;var i=this.startNode(),s=function(l,c){c===void 0&&(c=!1);var h=e.start,p=e.startLoc;return e.eatContextual(l)?e.type!==o.parenL&&(!c||!e.canInsertSemicolon())?!0:(i.key&&e.unexpected(),i.computed=!1,i.key=e.startNodeAt(h,p),i.key.name=l,e.finishNode(i.key,"Identifier"),!1):!1};i.kind="method",i.static=s("static");var r=this.eat(o.star),n=!1;r||(this.options.ecmaVersion>=8&&s("async",!0)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(o.star)):s("get")?i.kind="get":s("set")&&(i.kind="set")),i.key||this.parsePropertyName(i);var a=i.key,u=!1;return!i.computed&&!i.static&&(a.type==="Identifier"&&a.name==="constructor"||a.type==="Literal"&&a.value==="constructor")?(i.kind!=="method"&&this.raise(a.start,"Constructor can't have get/set modifier"),r&&this.raise(a.start,"Constructor can't be a generator"),n&&this.raise(a.start,"Constructor can't be an async method"),i.kind="constructor",u=t):i.static&&a.type==="Identifier"&&a.name==="prototype"&&this.raise(a.start,"Classes may not have a static property named prototype"),this.parseClassMethod(i,r,n,u),i.kind==="get"&&i.value.params.length!==0&&this.raiseRecoverable(i.value.start,"getter should have no params"),i.kind==="set"&&i.value.params.length!==1&&this.raiseRecoverable(i.value.start,"setter should have exactly one param"),i.kind==="set"&&i.value.params[0].type==="RestElement"&&this.raiseRecoverable(i.value.params[0].start,"Setter cannot use rest params"),i};b.parseClassMethod=function(t,e,i,s){return t.value=this.parseMethod(e,i,s),this.finishNode(t,"MethodDefinition")};b.parseClassId=function(t,e){this.type===o.name?(t.id=this.parseIdent(),e&&this.checkLVal(t.id,X,!1)):(e===!0&&this.unexpected(),t.id=null)};b.parseClassSuper=function(t){t.superClass=this.eat(o._extends)?this.parseExprSubscripts():null};b.parseExport=function(t,e){if(this.next(),this.eat(o.star))return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseIdent(!0),this.checkExport(e,t.exported.name,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat(o._default)){this.checkExport(e,"default",this.lastTokStart);var i;if(this.type===o._function||(i=this.isAsyncFunction())){var s=this.startNode();this.next(),i&&this.next(),t.declaration=this.parseFunction(s,we|ki,!1,i)}else if(this.type===o._class){var r=this.startNode();t.declaration=this.parseClass(r,"nullableID")}else t.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(null),t.declaration.type==="VariableDeclaration"?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id.name,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==o.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var n=0,a=t.specifiers;n<a.length;n+=1){var u=a[n];this.checkUnreserved(u.local),this.checkLocalExport(u.local)}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")};b.checkExport=function(t,e,i){t&&(Ue(t,e)&&this.raiseRecoverable(i,"Duplicate export '"+e+"'"),t[e]=!0)};b.checkPatternExport=function(t,e){var i=e.type;if(i==="Identifier")this.checkExport(t,e.name,e.start);else if(i==="ObjectPattern")for(var s=0,r=e.properties;s<r.length;s+=1){var n=r[s];this.checkPatternExport(t,n)}else if(i==="ArrayPattern")for(var a=0,u=e.elements;a<u.length;a+=1){var l=u[a];l&&this.checkPatternExport(t,l)}else i==="Property"?this.checkPatternExport(t,e.value):i==="AssignmentPattern"?this.checkPatternExport(t,e.left):i==="RestElement"?this.checkPatternExport(t,e.argument):i==="ParenthesizedExpression"&&this.checkPatternExport(t,e.expression)};b.checkVariableExport=function(t,e){if(t)for(var i=0,s=e;i<s.length;i+=1){var r=s[i];this.checkPatternExport(t,r.id)}};b.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};b.parseExportSpecifiers=function(t){var e=[],i=!0;for(this.expect(o.braceL);!this.eat(o.braceR);){if(i)i=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var s=this.startNode();s.local=this.parseIdent(!0),s.exported=this.eatContextual("as")?this.parseIdent(!0):s.local,this.checkExport(t,s.exported.name,s.exported.start),e.push(this.finishNode(s,"ExportSpecifier"))}return e};b.parseImport=function(t){return this.next(),this.type===o.string?(t.specifiers=Ps,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===o.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")};b.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===o.name){var i=this.startNode();if(i.local=this.parseIdent(),this.checkLVal(i.local,X),t.push(this.finishNode(i,"ImportDefaultSpecifier")),!this.eat(o.comma))return t}if(this.type===o.star){var s=this.startNode();return this.next(),this.expectContextual("as"),s.local=this.parseIdent(),this.checkLVal(s.local,X),t.push(this.finishNode(s,"ImportNamespaceSpecifier")),t}for(this.expect(o.braceL);!this.eat(o.braceR);){if(e)e=!1;else if(this.expect(o.comma),this.afterTrailingComma(o.braceR))break;var r=this.startNode();r.imported=this.parseIdent(!0),this.eatContextual("as")?r.local=this.parseIdent():(this.checkUnreserved(r.imported),r.local=r.imported),this.checkLVal(r.local,X),t.push(this.finishNode(r,"ImportSpecifier"))}return t};b.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)};b.isDirectiveCandidate=function(t){return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&(this.input[t.start]==='"'||this.input[t.start]==="'")};var Z=A.prototype;Z.toAssignable=function(t,e,i){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&t.name==="await"&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var s=0,r=t.properties;s<r.length;s+=1){var n=r[s];this.toAssignable(n,e),n.type==="RestElement"&&(n.argument.type==="ArrayPattern"||n.argument.type==="ObjectPattern")&&this.raise(n.argument.start,"Unexpected token")}break;case"Property":t.kind!=="init"&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),t.argument.type==="AssignmentPattern"&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":t.operator!=="="&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,i);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return t};Z.toAssignableList=function(t,e){for(var i=t.length,s=0;s<i;s++){var r=t[s];r&&this.toAssignable(r,e)}if(i){var n=t[i-1];this.options.ecmaVersion===6&&e&&n&&n.type==="RestElement"&&n.argument.type!=="Identifier"&&this.unexpected(n.argument.start)}return t};Z.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")};Z.parseRestBinding=function(){var t=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==o.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")};Z.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case o.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList(o.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case o.braceL:return this.parseObj(!0)}return this.parseIdent()};Z.parseBindingList=function(t,e,i){for(var s=[],r=!0;!this.eat(t);)if(r?r=!1:this.expect(o.comma),e&&this.type===o.comma)s.push(null);else{if(i&&this.afterTrailingComma(t))break;if(this.type===o.ellipsis){var n=this.parseRestBinding();this.parseBindingListItem(n),s.push(n),this.type===o.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}else{var a=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(a),s.push(a)}}return s};Z.parseBindingListItem=function(t){return t};Z.parseMaybeDefault=function(t,e,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(o.eq))return i;var s=this.startNodeAt(t,e);return s.left=i,s.right=this.parseMaybeAssign(),this.finishNode(s,"AssignmentPattern")};Z.checkLVal=function(t,e,i){switch(e===void 0&&(e=Dt),t.type){case"Identifier":e===X&&t.name==="let"&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),i&&(Ue(i,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),i[t.name]=!0),e!==Dt&&e!==Ei&&this.declareName(t.name,e,t.start);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":e&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ObjectPattern":for(var s=0,r=t.properties;s<r.length;s+=1){var n=r[s];this.checkLVal(n,e,i)}break;case"Property":this.checkLVal(t.value,e,i);break;case"ArrayPattern":for(var a=0,u=t.elements;a<u.length;a+=1){var l=u[a];l&&this.checkLVal(l,e,i)}break;case"AssignmentPattern":this.checkLVal(t.left,e,i);break;case"RestElement":this.checkLVal(t.argument,e,i);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,i);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var _=A.prototype;_.checkPropClash=function(t,e,i){if(!(this.options.ecmaVersion>=9&&t.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var s=t.key,r;switch(s.type){case"Identifier":r=s.name;break;case"Literal":r=String(s.value);break;default:return}var n=t.kind;if(this.options.ecmaVersion>=6){r==="__proto__"&&n==="init"&&(e.proto&&(i?i.doubleProto<0&&(i.doubleProto=s.start):this.raiseRecoverable(s.start,"Redefinition of __proto__ property")),e.proto=!0);return}r="$"+r;var a=e[r];if(a){var u;n==="init"?u=this.strict&&a.init||a.get||a.set:u=a.init||a[n],u&&this.raiseRecoverable(s.start,"Redefinition of property")}else a=e[r]={init:!1,get:!1,set:!1};a[n]=!0}};_.parseExpression=function(t,e){var i=this.start,s=this.startLoc,r=this.parseMaybeAssign(t,e);if(this.type===o.comma){var n=this.startNodeAt(i,s);for(n.expressions=[r];this.eat(o.comma);)n.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(n,"SequenceExpression")}return r};_.parseMaybeAssign=function(t,e,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var s=!1,r=-1,n=-1;e?(r=e.parenthesizedAssign,n=e.trailingComma,e.parenthesizedAssign=e.trailingComma=-1):(e=new Ge,s=!0);var a=this.start,u=this.startLoc;(this.type===o.parenL||this.type===o.name)&&(this.potentialArrowAt=this.start);var l=this.parseMaybeConditional(t,e);if(i&&(l=i.call(this,l,a,u)),this.type.isAssign){var c=this.startNodeAt(a,u);return c.operator=this.value,c.left=this.type===o.eq?this.toAssignable(l,!1,e):l,s||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.left.start&&(e.shorthandAssign=-1),this.checkLVal(l),this.next(),c.right=this.parseMaybeAssign(t),this.finishNode(c,"AssignmentExpression")}else s&&this.checkExpressionErrors(e,!0);return r>-1&&(e.parenthesizedAssign=r),n>-1&&(e.trailingComma=n),l};_.parseMaybeConditional=function(t,e){var i=this.start,s=this.startLoc,r=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return r;if(this.eat(o.question)){var n=this.startNodeAt(i,s);return n.test=r,n.consequent=this.parseMaybeAssign(),this.expect(o.colon),n.alternate=this.parseMaybeAssign(t),this.finishNode(n,"ConditionalExpression")}return r};_.parseExprOps=function(t,e){var i=this.start,s=this.startLoc,r=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)||r.start===i&&r.type==="ArrowFunctionExpression"?r:this.parseExprOp(r,i,s,-1,t)};_.parseExprOp=function(t,e,i,s,r){var n=this.type.binop;if(n!=null&&(!r||this.type!==o._in)&&n>s){var a=this.type===o.logicalOR||this.type===o.logicalAND,u=this.type===o.coalesce;u&&(n=o.logicalAND.binop);var l=this.value;this.next();var c=this.start,h=this.startLoc,p=this.parseExprOp(this.parseMaybeUnary(null,!1),c,h,n,r),m=this.buildBinary(e,i,t,p,l,a||u);return(a&&this.type===o.coalesce||u&&(this.type===o.logicalOR||this.type===o.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(m,e,i,s,r)}return t};_.buildBinary=function(t,e,i,s,r,n){var a=this.startNodeAt(t,e);return a.left=i,a.operator=r,a.right=s,this.finishNode(a,n?"LogicalExpression":"BinaryExpression")};_.parseMaybeUnary=function(t,e){var i=this.start,s=this.startLoc,r;if(this.isContextual("await")&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction))r=this.parseAwait(),e=!0;else if(this.type.prefix){var n=this.startNode(),a=this.type===o.incDec;n.operator=this.value,n.prefix=!0,this.next(),n.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),a?this.checkLVal(n.argument):this.strict&&n.operator==="delete"&&n.argument.type==="Identifier"?this.raiseRecoverable(n.start,"Deleting local variable in strict mode"):e=!0,r=this.finishNode(n,a?"UpdateExpression":"UnaryExpression")}else{if(r=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return r;for(;this.type.postfix&&!this.canInsertSemicolon();){var u=this.startNodeAt(i,s);u.operator=this.value,u.prefix=!1,u.argument=r,this.checkLVal(r),this.next(),r=this.finishNode(u,"UpdateExpression")}}return!e&&this.eat(o.starstar)?this.buildBinary(i,s,r,this.parseMaybeUnary(null,!1),"**",!1):r};_.parseExprSubscripts=function(t){var e=this.start,i=this.startLoc,s=this.parseExprAtom(t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var r=this.parseSubscripts(s,e,i);return t&&r.type==="MemberExpression"&&(t.parenthesizedAssign>=r.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=r.start&&(t.parenthesizedBind=-1)),r};_.parseSubscripts=function(t,e,i,s){for(var r=this.options.ecmaVersion>=8&&t.type==="Identifier"&&t.name==="async"&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start===5&&this.potentialArrowAt===t.start,n=!1;;){var a=this.parseSubscript(t,e,i,s,r,n);if(a.optional&&(n=!0),a===t||a.type==="ArrowFunctionExpression"){if(n){var u=this.startNodeAt(e,i);u.expression=a,a=this.finishNode(u,"ChainExpression")}return a}t=a}};_.parseSubscript=function(t,e,i,s,r,n){var a=this.options.ecmaVersion>=11,u=a&&this.eat(o.questionDot);s&&u&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(o.bracketL);if(l||u&&this.type!==o.parenL&&this.type!==o.backQuote||this.eat(o.dot)){var c=this.startNodeAt(e,i);c.object=t,c.property=l?this.parseExpression():this.parseIdent(this.options.allowReserved!=="never"),c.computed=!!l,l&&this.expect(o.bracketR),a&&(c.optional=u),t=this.finishNode(c,"MemberExpression")}else if(!s&&this.eat(o.parenL)){var h=new Ge,p=this.yieldPos,m=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var g=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1,h);if(r&&!u&&!this.canInsertSemicolon()&&this.eat(o.arrow))return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=p,this.awaitPos=m,this.awaitIdentPos=d,this.parseArrowExpression(this.startNodeAt(e,i),g,!0);this.checkExpressionErrors(h,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var v=this.startNodeAt(e,i);v.callee=t,v.arguments=g,a&&(v.optional=u),t=this.finishNode(v,"CallExpression")}else if(this.type===o.backQuote){(u||n)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(e,i);y.tag=t,y.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(y,"TaggedTemplateExpression")}return t};_.parseExprAtom=function(t){this.type===o.slash&&this.readRegexp();var e,i=this.potentialArrowAt===this.start;switch(this.type){case o._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),e=this.startNode(),this.next(),this.type===o.parenL&&!this.allowDirectSuper&&this.raise(e.start,"super() call outside constructor of a subclass"),this.type!==o.dot&&this.type!==o.bracketL&&this.type!==o.parenL&&this.unexpected(),this.finishNode(e,"Super");case o._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case o.name:var s=this.start,r=this.startLoc,n=this.containsEsc,a=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!n&&a.name==="async"&&!this.canInsertSemicolon()&&this.eat(o._function))return this.parseFunction(this.startNodeAt(s,r),0,!1,!0);if(i&&!this.canInsertSemicolon()){if(this.eat(o.arrow))return this.parseArrowExpression(this.startNodeAt(s,r),[a],!1);if(this.options.ecmaVersion>=8&&a.name==="async"&&this.type===o.name&&!n)return a=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(o.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,r),[a],!0)}return a;case o.regexp:var u=this.value;return e=this.parseLiteral(u.value),e.regex={pattern:u.pattern,flags:u.flags},e;case o.num:case o.string:return this.parseLiteral(this.value);case o._null:case o._true:case o._false:return e=this.startNode(),e.value=this.type===o._null?null:this.type===o._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case o.parenL:var l=this.start,c=this.parseParenAndDistinguishExpression(i);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(t.parenthesizedAssign=l),t.parenthesizedBind<0&&(t.parenthesizedBind=l)),c;case o.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList(o.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case o.braceL:return this.parseObj(!1,t);case o._function:return e=this.startNode(),this.next(),this.parseFunction(e,0);case o._class:return this.parseClass(this.startNode(),!1);case o._new:return this.parseNew();case o.backQuote:return this.parseTemplate();case o._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}};_.parseExprImport=function(){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var e=this.parseIdent(!0);switch(this.type){case o.parenL:return this.parseDynamicImport(t);case o.dot:return t.meta=e,this.parseImportMeta(t);default:this.unexpected()}};_.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),!this.eat(o.parenR)){var e=this.start;this.eat(o.comma)&&this.eat(o.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")};_.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="meta"&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")};_.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),e.raw.charCodeAt(e.raw.length-1)===110&&(e.bigint=e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")};_.parseParenExpression=function(){this.expect(o.parenL);var t=this.parseExpression();return this.expect(o.parenR),t};_.parseParenAndDistinguishExpression=function(t){var e=this.start,i=this.startLoc,s,r=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var n=this.start,a=this.startLoc,u=[],l=!0,c=!1,h=new Ge,p=this.yieldPos,m=this.awaitPos,d;for(this.yieldPos=0,this.awaitPos=0;this.type!==o.parenR;)if(l?l=!1:this.expect(o.comma),r&&this.afterTrailingComma(o.parenR,!0)){c=!0;break}else if(this.type===o.ellipsis){d=this.start,u.push(this.parseParenItem(this.parseRestBinding())),this.type===o.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}else u.push(this.parseMaybeAssign(!1,h,this.parseParenItem));var g=this.start,v=this.startLoc;if(this.expect(o.parenR),t&&!this.canInsertSemicolon()&&this.eat(o.arrow))return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=m,this.parseParenArrowList(e,i,u);(!u.length||c)&&this.unexpected(this.lastTokStart),d&&this.unexpected(d),this.checkExpressionErrors(h,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,u.length>1?(s=this.startNodeAt(n,a),s.expressions=u,this.finishNodeAt(s,"SequenceExpression",g,v)):s=u[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(e,i);return y.expression=s,this.finishNode(y,"ParenthesizedExpression")}else return s};_.parseParenItem=function(t){return t};_.parseParenArrowList=function(t,e,i){return this.parseArrowExpression(this.startNodeAt(t,e),i)};var Ts=[];_.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(o.dot)){t.meta=e;var i=this.containsEsc;return t.property=this.parseIdent(!0),t.property.name!=="target"&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.inNonArrowFunction()||this.raiseRecoverable(t.start,"'new.target' can only be used in functions"),this.finishNode(t,"MetaProperty")}var s=this.start,r=this.startLoc,n=this.type===o._import;return t.callee=this.parseSubscripts(this.parseExprAtom(),s,r,!0),n&&t.callee.type==="ImportExpression"&&this.raise(s,"Cannot use new with import()"),this.eat(o.parenL)?t.arguments=this.parseExprList(o.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Ts,this.finishNode(t,"NewExpression")};_.parseTemplateElement=function(t){var e=t.isTagged,i=this.startNode();return this.type===o.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value,cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
11
|
+
`),cooked:this.value},this.next(),i.tail=this.type===o.backQuote,this.finishNode(i,"TemplateElement")};_.parseTemplate=function(t){t===void 0&&(t={});var e=t.isTagged;e===void 0&&(e=!1);var i=this.startNode();this.next(),i.expressions=[];var s=this.parseTemplateElement({isTagged:e});for(i.quasis=[s];!s.tail;)this.type===o.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(o.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(o.braceR),i.quasis.push(s=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(i,"TemplateLiteral")};_.isAsyncProp=function(t){return!t.computed&&t.key.type==="Identifier"&&t.key.name==="async"&&(this.type===o.name||this.type===o.num||this.type===o.string||this.type===o.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===o.star)&&!q.test(this.input.slice(this.lastTokEnd,this.start))};_.parseObj=function(t,e){var i=this.startNode(),s=!0,r={};for(i.properties=[],this.next();!this.eat(o.braceR);){if(s)s=!1;else if(this.expect(o.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(o.braceR))break;var n=this.parseProperty(t,e);t||this.checkPropClash(n,r,e),i.properties.push(n)}return this.finishNode(i,t?"ObjectPattern":"ObjectExpression")};_.parseProperty=function(t,e){var i=this.startNode(),s,r,n,a;if(this.options.ecmaVersion>=9&&this.eat(o.ellipsis))return t?(i.argument=this.parseIdent(!1),this.type===o.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(this.type===o.parenL&&e&&(e.parenthesizedAssign<0&&(e.parenthesizedAssign=this.start),e.parenthesizedBind<0&&(e.parenthesizedBind=this.start)),i.argument=this.parseMaybeAssign(!1,e),this.type===o.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(t||e)&&(n=this.start,a=this.startLoc),t||(s=this.eat(o.star)));var u=this.containsEsc;return this.parsePropertyName(i),!t&&!u&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(i)?(r=!0,s=this.options.ecmaVersion>=9&&this.eat(o.star),this.parsePropertyName(i,e)):r=!1,this.parsePropertyValue(i,t,s,r,n,a,e,u),this.finishNode(i,"Property")};_.parsePropertyValue=function(t,e,i,s,r,n,a,u){if((i||s)&&this.type===o.colon&&this.unexpected(),this.eat(o.colon))t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),t.kind="init";else if(this.options.ecmaVersion>=6&&this.type===o.parenL)e&&this.unexpected(),t.kind="init",t.method=!0,t.value=this.parseMethod(i,s);else if(!e&&!u&&this.options.ecmaVersion>=5&&!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.type!==o.comma&&this.type!==o.braceR&&this.type!==o.eq){(i||s)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),t.value=this.parseMethod(!1);var l=t.kind==="get"?0:1;if(t.value.params.length!==l){var c=t.value.start;t.kind==="get"?this.raiseRecoverable(c,"getter should have no params"):this.raiseRecoverable(c,"setter should have exactly one param")}else t.kind==="set"&&t.value.params[0].type==="RestElement"&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")}else this.options.ecmaVersion>=6&&!t.computed&&t.key.type==="Identifier"?((i||s)&&this.unexpected(),this.checkUnreserved(t.key),t.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=r),t.kind="init",e?t.value=this.parseMaybeDefault(r,n,t.key):this.type===o.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),t.value=this.parseMaybeDefault(r,n,t.key)):t.value=t.key,t.shorthand=!0):this.unexpected()};_.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat(o.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(o.bracketR),t.key;t.computed=!1}return t.key=this.type===o.num||this.type===o.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};_.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)};_.parseMethod=function(t,e,i){var s=this.startNode(),r=this.yieldPos,n=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(s),this.options.ecmaVersion>=6&&(s.generator=t),this.options.ecmaVersion>=8&&(s.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(bt(e,s.generator)|_i|(i?Si:0)),this.expect(o.parenL),s.params=this.parseBindingList(o.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(s,!1,!0),this.yieldPos=r,this.awaitPos=n,this.awaitIdentPos=a,this.finishNode(s,"FunctionExpression")};_.parseArrowExpression=function(t,e,i){var s=this.yieldPos,r=this.awaitPos,n=this.awaitIdentPos;return this.enterScope(bt(i,!1)|yi),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1),this.yieldPos=s,this.awaitPos=r,this.awaitIdentPos=n,this.finishNode(t,"ArrowFunctionExpression")};_.parseFunctionBody=function(t,e,i){var s=e&&this.type!==o.braceL,r=this.strict,n=!1;if(s)t.body=this.parseMaybeAssign(),t.expression=!0,this.checkParams(t,!1);else{var a=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);(!r||a)&&(n=this.strictDirective(this.end),n&&a&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var u=this.labels;this.labels=[],n&&(this.strict=!0),this.checkParams(t,!r&&!n&&!e&&!i&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLVal(t.id,Ei),t.body=this.parseBlock(!1,void 0,n&&!r),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=u}this.exitScope()};_.isSimpleParamList=function(t){for(var e=0,i=t;e<i.length;e+=1){var s=i[e];if(s.type!=="Identifier")return!1}return!0};_.checkParams=function(t,e){for(var i={},s=0,r=t.params;s<r.length;s+=1){var n=r[s];this.checkLVal(n,_t,e?null:i)}};_.parseExprList=function(t,e,i,s){for(var r=[],n=!0;!this.eat(t);){if(n)n=!1;else if(this.expect(o.comma),e&&this.afterTrailingComma(t))break;var a=void 0;i&&this.type===o.comma?a=null:this.type===o.ellipsis?(a=this.parseSpread(s),s&&this.type===o.comma&&s.trailingComma<0&&(s.trailingComma=this.start)):a=this.parseMaybeAssign(!1,s),r.push(a)}return r};_.checkUnreserved=function(t){var e=t.start,i=t.end,s=t.name;if(this.inGenerator&&s==="yield"&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&s==="await"&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),this.keywords.test(s)&&this.raise(e,"Unexpected keyword '"+s+"'"),!(this.options.ecmaVersion<6&&this.input.slice(e,i).indexOf("\\")!==-1)){var r=this.strict?this.reservedWordsStrict:this.reservedWords;r.test(s)&&(!this.inAsync&&s==="await"&&this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+s+"' is reserved"))}};_.parseIdent=function(t,e){var i=this.startNode();return this.type===o.name?i.name=this.value:this.type.keyword?(i.name=this.type.keyword,(i.name==="class"||i.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop()):this.unexpected(),this.next(!!t),this.finishNode(i,"Identifier"),t||(this.checkUnreserved(i),i.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=i.start)),i};_.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===o.semi||this.canInsertSemicolon()||this.type!==o.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(o.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")};_.parseAwait=function(){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!1),this.finishNode(t,"AwaitExpression")};var Fe=A.prototype;Fe.raise=function(t,e){var i=gi(this.input,t);e+=" ("+i.line+":"+i.column+")";var s=new SyntaxError(e);throw s.pos=t,s.loc=i,s.raisedAt=this.pos,s};Fe.raiseRecoverable=Fe.raise;Fe.curPosition=function(){if(this.options.locations)return new ke(this.curLine,this.pos-this.lineStart)};var ae=A.prototype,Ns=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};ae.enterScope=function(t){this.scopeStack.push(new Ns(t))};ae.exitScope=function(){this.scopeStack.pop()};ae.treatFunctionsAsVarInScope=function(t){return t.flags&Re||!this.inModule&&t.flags&Ie};ae.declareName=function(t,e,i){var s=!1;if(e===X){var r=this.currentScope();s=r.lexical.indexOf(t)>-1||r.functions.indexOf(t)>-1||r.var.indexOf(t)>-1,r.lexical.push(t),this.inModule&&r.flags&Ie&&delete this.undefinedExports[t]}else if(e===wi){var n=this.currentScope();n.lexical.push(t)}else if(e===Ci){var a=this.currentScope();this.treatFunctionsAsVar?s=a.lexical.indexOf(t)>-1:s=a.lexical.indexOf(t)>-1||a.var.indexOf(t)>-1,a.functions.push(t)}else for(var u=this.scopeStack.length-1;u>=0;--u){var l=this.scopeStack[u];if(l.lexical.indexOf(t)>-1&&!(l.flags&bi&&l.lexical[0]===t)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(t)>-1){s=!0;break}if(l.var.push(t),this.inModule&&l.flags&Ie&&delete this.undefinedExports[t],l.flags&yt)break}s&&this.raiseRecoverable(i,"Identifier '"+t+"' has already been declared")};ae.checkLocalExport=function(t){this.scopeStack[0].lexical.indexOf(t.name)===-1&&this.scopeStack[0].var.indexOf(t.name)===-1&&(this.undefinedExports[t.name]=t)};ae.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};ae.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&yt)return e}};ae.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(e.flags&yt&&!(e.flags&yi))return e}};var Ct=function(e,i,s){this.type="",this.start=i,this.end=0,e.options.locations&&(this.loc=new $e(e,s)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[i,0])},qe=A.prototype;qe.startNode=function(){return new Ct(this,this.start,this.startLoc)};qe.startNodeAt=function(t,e){return new Ct(this,t,e)};function Ii(t,e,i,s){return t.type=e,t.end=i,this.options.locations&&(t.loc.end=s),this.options.ranges&&(t.range[1]=i),t}qe.finishNode=function(t,e){return Ii.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)};qe.finishNodeAt=function(t,e,i,s){return Ii.call(this,t,e,i,s)};var z=function(e,i,s,r,n){this.token=e,this.isExpr=!!i,this.preserveSpace=!!s,this.override=r,this.generator=!!n},I={b_stat:new z("{",!1),b_expr:new z("{",!0),b_tmpl:new z("${",!1),p_stat:new z("(",!1),p_expr:new z("(",!0),q_tmpl:new z("`",!0,!0,function(t){return t.tryReadTemplateToken()}),f_stat:new z("function",!1),f_expr:new z("function",!0),f_expr_gen:new z("function",!0,!1,null,!0),f_gen:new z("function",!1,!1,null,!0)},We=A.prototype;We.initialContext=function(){return[I.b_stat]};We.braceIsBlock=function(t){var e=this.curContext();return e===I.f_expr||e===I.f_stat?!0:t===o.colon&&(e===I.b_stat||e===I.b_expr)?!e.isExpr:t===o._return||t===o.name&&this.exprAllowed?q.test(this.input.slice(this.lastTokEnd,this.start)):t===o._else||t===o.semi||t===o.eof||t===o.parenR||t===o.arrow?!0:t===o.braceL?e===I.b_stat:t===o._var||t===o._const||t===o.name?!1:!this.exprAllowed};We.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if(e.token==="function")return e.generator}return!1};We.updateContext=function(t){var e,i=this.type;i.keyword&&t===o.dot?this.exprAllowed=!1:(e=i.updateContext)?e.call(this,t):this.exprAllowed=i.beforeExpr};o.parenR.updateContext=o.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var t=this.context.pop();t===I.b_stat&&this.curContext().token==="function"&&(t=this.context.pop()),this.exprAllowed=!t.isExpr};o.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?I.b_stat:I.b_expr),this.exprAllowed=!0};o.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0};o.parenL.updateContext=function(t){var e=t===o._if||t===o._for||t===o._with||t===o._while;this.context.push(e?I.p_stat:I.p_expr),this.exprAllowed=!0};o.incDec.updateContext=function(){};o._function.updateContext=o._class.updateContext=function(t){t.beforeExpr&&t!==o.semi&&t!==o._else&&!(t===o._return&&q.test(this.input.slice(this.lastTokEnd,this.start)))&&!((t===o.colon||t===o.braceL)&&this.curContext()===I.b_stat)?this.context.push(I.f_expr):this.context.push(I.f_stat),this.exprAllowed=!1};o.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1};o.star.updateContext=function(t){if(t===o._function){var e=this.context.length-1;this.context[e]===I.f_expr?this.context[e]=I.f_expr_gen:this.context[e]=I.f_gen}this.exprAllowed=!0};o.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==o.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Ai="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Pi=Ai+" Extended_Pictographic",Rs=Pi,Vs={9:Ai,10:Pi,11:Rs},Bt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ti="Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Ni=Ti+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Os=Ni+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ls={9:Ti,10:Ni,11:Os},Ri={};function wt(t){var e=Ri[t]={binary:ce(Vs[t]+" "+Bt),nonBinary:{General_Category:ce(Bt),Script:ce(Ls[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}wt(9);wt(10);wt(11);var x=A.prototype,ee=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":""),this.unicodeProperties=Ri[e.options.ecmaVersion>=11?11:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};ee.prototype.reset=function(e,i,s){var r=s.indexOf("u")!==-1;this.start=e|0,this.source=i+"",this.flags=s,this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchN=r&&this.parser.options.ecmaVersion>=9};ee.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)};ee.prototype.at=function(e,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(e>=r)return-1;var n=s.charCodeAt(e);if(!(i||this.switchU)||n<=55295||n>=57344||e+1>=r)return n;var a=s.charCodeAt(e+1);return a>=56320&&a<=57343?(n<<10)+a-56613888:n};ee.prototype.nextIndex=function(e,i){i===void 0&&(i=!1);var s=this.source,r=s.length;if(e>=r)return r;var n=s.charCodeAt(e),a;return!(i||this.switchU)||n<=55295||n>=57344||e+1>=r||(a=s.charCodeAt(e+1))<56320||a>57343?e+1:e+2};ee.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)};ee.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)};ee.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)};ee.prototype.eat=function(e,i){return i===void 0&&(i=!1),this.current(i)===e?(this.advance(i),!0):!1};function je(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}x.validateRegExpFlags=function(t){for(var e=t.validFlags,i=t.flags,s=0;s<i.length;s++){var r=i.charAt(s);e.indexOf(r)===-1&&this.raise(t.start,"Invalid regular expression flag"),i.indexOf(r,s+1)>-1&&this.raise(t.start,"Duplicate regular expression flag")}};x.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&t.groupNames.length>0&&(t.switchN=!0,this.regexp_pattern(t))};x.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames.length=0,t.backReferenceNames.length=0,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,i=t.backReferenceNames;e<i.length;e+=1){var s=i[e];t.groupNames.indexOf(s)===-1&&t.raise("Invalid named capture referenced")}};x.regexp_disjunction=function(t){for(this.regexp_alternative(t);t.eat(124);)this.regexp_alternative(t);this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")};x.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););};x.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))?(this.regexp_eatQuantifier(t),!0):!1};x.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!i,!0}return t.pos=e,!1};x.regexp_eatQuantifier=function(t,e){return e===void 0&&(e=!1),this.regexp_eatQuantifierPrefix(t,e)?(t.eat(63),!0):!1};x.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)};x.regexp_eatBracedQuantifier=function(t,e){var i=t.pos;if(t.eat(123)){var s=0,r=-1;if(this.regexp_eatDecimalDigits(t)&&(s=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(r=t.lastIntValue),t.eat(125)))return r!==-1&&r<s&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=i}return!1};x.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)};x.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1};x.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)&&t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}t.pos=e}return!1};x.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):t.current()===63&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1};x.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)};x.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1};x.regexp_eatSyntaxCharacter=function(t){var e=t.current();return Vi(e)?(t.lastIntValue=e,t.advance(),!0):!1};function Vi(t){return t===36||t>=40&&t<=43||t===46||t===63||t>=91&&t<=94||t>=123&&t<=125}x.regexp_eatPatternCharacters=function(t){for(var e=t.pos,i=0;(i=t.current())!==-1&&!Vi(i);)t.advance();return t.pos!==e};x.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return e!==-1&&e!==36&&!(e>=40&&e<=43)&&e!==46&&e!==63&&e!==91&&e!==94&&e!==124?(t.advance(),!0):!1};x.regexp_groupSpecifier=function(t){if(t.eat(63)){if(this.regexp_eatGroupName(t)){t.groupNames.indexOf(t.lastStringValue)!==-1&&t.raise("Duplicate capture group name"),t.groupNames.push(t.lastStringValue);return}t.raise("Invalid group")}};x.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1};x.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=je(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=je(t.lastIntValue);return!0}return!1};x.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,s=t.current(i);return t.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(s=t.lastIntValue),Fs(s)?(t.lastIntValue=s,!0):(t.pos=e,!1)};function Fs(t){return ne(t,!0)||t===36||t===95}x.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,i=this.options.ecmaVersion>=11,s=t.current(i);return t.advance(i),s===92&&this.regexp_eatRegExpUnicodeEscapeSequence(t,i)&&(s=t.lastIntValue),js(s)?(t.lastIntValue=s,!0):(t.pos=e,!1)};function js(t){return ye(t,!0)||t===36||t===95||t===8204||t===8205}x.regexp_eatAtomEscape=function(t){return this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t)?!0:(t.switchU&&(t.current()===99&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)};x.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var i=t.lastIntValue;if(t.switchU)return i>t.maxBackReference&&(t.maxBackReference=i),!0;if(i<=t.numCapturingParens)return!0;t.pos=e}return!1};x.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1};x.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)};x.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1};x.regexp_eatZero=function(t){return t.current()===48&&!ze(t.lookahead())?(t.lastIntValue=0,t.advance(),!0):!1};x.regexp_eatControlEscape=function(t){var e=t.current();return e===116?(t.lastIntValue=9,t.advance(),!0):e===110?(t.lastIntValue=10,t.advance(),!0):e===118?(t.lastIntValue=11,t.advance(),!0):e===102?(t.lastIntValue=12,t.advance(),!0):e===114?(t.lastIntValue=13,t.advance(),!0):!1};x.regexp_eatControlLetter=function(t){var e=t.current();return Oi(e)?(t.lastIntValue=e%32,t.advance(),!0):!1};function Oi(t){return t>=65&&t<=90||t>=97&&t<=122}x.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){e===void 0&&(e=!1);var i=t.pos,s=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(s&&r>=55296&&r<=56319){var n=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var a=t.lastIntValue;if(a>=56320&&a<=57343)return t.lastIntValue=(r-55296)*1024+(a-56320)+65536,!0}t.pos=n,t.lastIntValue=r}return!0}if(s&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&Ms(t.lastIntValue))return!0;s&&t.raise("Invalid unicode escape"),t.pos=i}return!1};function Ms(t){return t>=0&&t<=1114111}x.regexp_eatIdentityEscape=function(t){if(t.switchU)return this.regexp_eatSyntaxCharacter(t)?!0:t.eat(47)?(t.lastIntValue=47,!0):!1;var e=t.current();return e!==99&&(!t.switchN||e!==107)?(t.lastIntValue=e,t.advance(),!0):!1};x.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do t.lastIntValue=10*t.lastIntValue+(e-48),t.advance();while((e=t.current())>=48&&e<=57);return!0}return!1};x.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(Ds(e))return t.lastIntValue=-1,t.advance(),!0;if(t.switchU&&this.options.ecmaVersion>=9&&(e===80||e===112)){if(t.lastIntValue=-1,t.advance(),t.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(t)&&t.eat(125))return!0;t.raise("Invalid property name")}return!1};function Ds(t){return t===100||t===68||t===115||t===83||t===119||t===87}x.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var i=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var s=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,i,s),!0}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var r=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,r),!0}return!1};x.regexp_validateUnicodePropertyNameAndValue=function(t,e,i){Ue(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(i)||t.raise("Invalid property value")};x.regexp_validateUnicodePropertyNameOrValue=function(t,e){t.unicodeProperties.binary.test(e)||t.raise("Invalid property name")};x.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Li(e=t.current());)t.lastStringValue+=je(e),t.advance();return t.lastStringValue!==""};function Li(t){return Oi(t)||t===95}x.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";Bs(e=t.current());)t.lastStringValue+=je(e),t.advance();return t.lastStringValue!==""};function Bs(t){return Li(t)||ze(t)}x.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)};x.regexp_eatCharacterClass=function(t){if(t.eat(91)){if(t.eat(94),this.regexp_classRanges(t),t.eat(93))return!0;t.raise("Unterminated character class")}return!1};x.regexp_classRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var i=t.lastIntValue;t.switchU&&(e===-1||i===-1)&&t.raise("Invalid character class"),e!==-1&&i!==-1&&e>i&&t.raise("Range out of order in character class")}}};x.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var i=t.current();(i===99||Mi(i))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var s=t.current();return s!==93?(t.lastIntValue=s,t.advance(),!0):!1};x.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)};x.regexp_eatClassControlLetter=function(t){var e=t.current();return ze(e)||e===95?(t.lastIntValue=e%32,t.advance(),!0):!1};x.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1};x.regexp_eatDecimalDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;ze(i=t.current());)t.lastIntValue=10*t.lastIntValue+(i-48),t.advance();return t.pos!==e};function ze(t){return t>=48&&t<=57}x.regexp_eatHexDigits=function(t){var e=t.pos,i=0;for(t.lastIntValue=0;Fi(i=t.current());)t.lastIntValue=16*t.lastIntValue+ji(i),t.advance();return t.pos!==e};function Fi(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function ji(t){return t>=65&&t<=70?10+(t-65):t>=97&&t<=102?10+(t-97):t-48}x.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var i=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=e*64+i*8+t.lastIntValue:t.lastIntValue=e*8+i}else t.lastIntValue=e;return!0}return!1};x.regexp_eatOctalDigit=function(t){var e=t.current();return Mi(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)};function Mi(t){return t>=48&&t<=55}x.regexp_eatFixedHexDigits=function(t,e){var i=t.pos;t.lastIntValue=0;for(var s=0;s<e;++s){var r=t.current();if(!Fi(r))return t.pos=i,!1;t.lastIntValue=16*t.lastIntValue+ji(r),t.advance()}return!0};var Et=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new $e(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},S=A.prototype;S.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Et(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};S.getToken=function(){return this.next(),new Et(this)};typeof Symbol<"u"&&(S[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===o.eof,value:e}}}});S.curContext=function(){return this.context[this.context.length-1]};S.nextToken=function(){var t=this.curContext();if((!t||!t.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(o.eof);if(t.override)return t.override(this);this.readToken(this.fullCharCodeAtPos())};S.readToken=function(t){return ne(t,this.options.ecmaVersion>=6)||t===92?this.readWord():this.getTokenFromCode(t)};S.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);if(t<=55295||t>=57344)return t;var e=this.input.charCodeAt(this.pos+1);return(t<<10)+e-56613888};S.skipBlockComment=function(){var t=this.options.onComment&&this.curPosition(),e=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations){Ee.lastIndex=e;for(var s;(s=Ee.exec(this.input))&&s.index<this.pos;)++this.curLine,this.lineStart=s.index+s[0].length}this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,i),e,this.pos,t,this.curPosition())};S.skipLineComment=function(t){for(var e=this.pos,i=this.options.onComment&&this.curPosition(),s=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!Ne(s);)s=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,i,this.curPosition())};S.skipSpace=function(){e:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(t>8&&t<14||t>=5760&&di.test(String.fromCharCode(t)))++this.pos;else break e}}};S.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=t,this.value=e,this.updateContext(i)};S.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&t===46&&e===46?(this.pos+=3,this.finishToken(o.ellipsis)):(++this.pos,this.finishToken(o.dot))};S.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):t===61?this.finishOp(o.assign,2):this.finishOp(o.slash,1)};S.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),i=1,s=t===42?o.star:o.modulo;return this.options.ecmaVersion>=7&&t===42&&e===42&&(++i,s=o.starstar,e=this.input.charCodeAt(this.pos+2)),e===61?this.finishOp(o.assign,i+1):this.finishOp(s,i)};S.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(o.assign,3)}return this.finishOp(t===124?o.logicalOR:o.logicalAND,2)}return e===61?this.finishOp(o.assign,2):this.finishOp(t===124?o.bitwiseOR:o.bitwiseAND,1)};S.readToken_caret=function(){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(o.assign,2):this.finishOp(o.bitwiseXOR,1)};S.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?e===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||q.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(o.incDec,2):e===61?this.finishOp(o.assign,2):this.finishOp(o.plusMin,1)};S.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),i=1;return e===t?(i=t===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(o.assign,i+1):this.finishOp(o.bitShift,i)):e===33&&t===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(e===61&&(i=2),this.finishOp(o.relational,i))};S.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(o.equality,this.input.charCodeAt(this.pos+2)===61?3:2):t===61&&e===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(o.arrow)):this.finishOp(t===61?o.eq:o.prefix,1)};S.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(e===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(o.questionDot,2)}if(e===63){if(t>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(o.assign,3)}return this.finishOp(o.coalesce,2)}}return this.finishOp(o.question,1)};S.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(o.parenL);case 41:return++this.pos,this.finishToken(o.parenR);case 59:return++this.pos,this.finishToken(o.semi);case 44:return++this.pos,this.finishToken(o.comma);case 91:return++this.pos,this.finishToken(o.bracketL);case 93:return++this.pos,this.finishToken(o.bracketR);case 123:return++this.pos,this.finishToken(o.braceL);case 125:return++this.pos,this.finishToken(o.braceR);case 58:return++this.pos,this.finishToken(o.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(o.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(e===120||e===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(e===111||e===79)return this.readRadixNumber(8);if(e===98||e===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp(o.prefix,1)}this.raise(this.pos,"Unexpected character '"+kt(t)+"'")};S.finishOp=function(t,e){var i=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,i)};S.readRegexp=function(){for(var t,e,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var s=this.input.charAt(this.pos);if(q.test(s)&&this.raise(i,"Unterminated regular expression"),t)t=!1;else{if(s==="[")e=!0;else if(s==="]"&&e)e=!1;else if(s==="/"&&!e)break;t=s==="\\"}++this.pos}var r=this.input.slice(i,this.pos);++this.pos;var n=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(n);var u=this.regexpState||(this.regexpState=new ee(this));u.reset(i,r,a),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var l=null;try{l=new RegExp(r,a)}catch{}return this.finishToken(o.regexp,{pattern:r,flags:a,value:l})};S.readInt=function(t,e,i){for(var s=this.options.ecmaVersion>=12&&e===void 0,r=i&&this.input.charCodeAt(this.pos)===48,n=this.pos,a=0,u=0,l=0,c=e??1/0;l<c;++l,++this.pos){var h=this.input.charCodeAt(this.pos),p=void 0;if(s&&h===95){r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),u===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),u=h;continue}if(h>=97?p=h-97+10:h>=65?p=h-65+10:h>=48&&h<=57?p=h-48:p=1/0,p>=t)break;u=h,a=a*t+p}return s&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===n||e!=null&&this.pos-n!==e?null:a};function Hs(t,e){return e?parseInt(t,8):parseFloat(t.replace(/_/g,""))}function Di(t){return typeof BigInt!="function"?null:BigInt(t.replace(/_/g,""))}S.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var i=this.readInt(t);return i==null&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Di(this.input.slice(e,this.pos)),++this.pos):ne(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,i)};S.readNumber=function(t){var e=this.pos;!t&&this.readInt(10,void 0,!0)===null&&this.raise(e,"Invalid number");var i=this.pos-e>=2&&this.input.charCodeAt(e)===48;i&&this.strict&&this.raise(e,"Invalid number");var s=this.input.charCodeAt(this.pos);if(!i&&!t&&this.options.ecmaVersion>=11&&s===110){var r=Di(this.input.slice(e,this.pos));return++this.pos,ne(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(o.num,r)}i&&/[89]/.test(this.input.slice(e,this.pos))&&(i=!1),s===46&&!i&&(++this.pos,this.readInt(10),s=this.input.charCodeAt(this.pos)),(s===69||s===101)&&!i&&(s=this.input.charCodeAt(++this.pos),(s===43||s===45)&&++this.pos,this.readInt(10)===null&&this.raise(e,"Invalid number")),ne(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var n=Hs(this.input.slice(e,this.pos),i);return this.finishToken(o.num,n)};S.readCodePoint=function(){var t=this.input.charCodeAt(this.pos),e;if(t===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else e=this.readHexChar(4);return e};function kt(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}S.readString=function(t){for(var e="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var s=this.input.charCodeAt(this.pos);if(s===t)break;s===92?(e+=this.input.slice(i,this.pos),e+=this.readEscapedChar(!1),i=this.pos):(Ne(s,this.options.ecmaVersion>=10)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(i,this.pos++),this.finishToken(o.string,e)};var Bi={};S.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t===Bi)this.readInvalidTemplateToken();else throw t}this.inTemplateElement=!1};S.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Bi;this.raise(t,e)};S.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===o.template||this.type===o.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(o.dollarBraceL)):(++this.pos,this.finishToken(o.backQuote)):(t+=this.input.slice(e,this.pos),this.finishToken(o.template,t));if(i===92)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(Ne(i)){switch(t+=this.input.slice(e,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:t+=`
|
|
12
|
+
`;break;default:t+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}};S.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(o.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,"Unterminated template")};S.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
|
|
13
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return kt(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(t){var i=this.pos-1;return this.invalidStringToken(i,"Invalid escape sequence in template string"),null}default:if(e>=48&&e<=55){var s=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(s,8);return r>255&&(s=s.slice(0,-1),r=parseInt(s,8)),this.pos+=s.length-1,e=this.input.charCodeAt(this.pos),(s!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-s.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return Ne(e)?"":String.fromCharCode(e)}};S.readHexChar=function(t){var e=this.pos,i=this.readInt(16,t);return i===null&&this.invalidStringToken(e,"Bad character escape sequence"),i};S.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,i=this.pos,s=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(ye(r,s))this.pos+=r<=65535?1:2;else if(r===92){this.containsEsc=!0,t+=this.input.slice(i,this.pos);var n=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(e?ne:ye)(a,s)||this.invalidStringToken(n,"Invalid Unicode escape"),t+=kt(a),i=this.pos}else break;e=!1}return t+this.input.slice(i,this.pos)};S.readWord=function(){var t=this.readWord1(),e=o.name;return this.keywords.test(t)&&(e=vt[t]),this.finishToken(e,t)};var Us="7.4.1";A.acorn={Parser:A,version:Us,defaultOptions:ut,Position:ke,SourceLocation:$e,getLineInfo:gi,Node:Ct,TokenType:w,tokTypes:o,keywordTypes:vt,TokContext:z,tokContexts:I,isIdentifierChar:ye,isIdentifierStart:ne,Token:Et,isNewLine:Ne,lineBreak:q,lineBreakG:Ee,nonASCIIwhitespace:di};function $s(t,e){return A.parse(t,e)}class Gs extends Error{}class qs extends SyntaxError{}class lt extends ReferenceError{}class Ws extends TypeError{}class Hi extends Gs{}class zs extends qs{}class K extends lt{}const R={ExecutionTimeOutError:[3002,"Script execution timed out after %0ms",Hi],NodeTypeSyntaxError:[1001,"Unknown node type: %0",K],BinaryOperatorSyntaxError:[1002,"Unknown binary operator: %0",K],LogicalOperatorSyntaxError:[1003,"Unknown logical operator: %0",K],UnaryOperatorSyntaxError:[1004,"Unknown unary operator: %0",K],UpdateOperatorSyntaxError:[1005,"Unknown update operator: %0",K],ObjectStructureSyntaxError:[1006,"Unknown object structure: %0",K],AssignmentExpressionSyntaxError:[1007,"Unknown assignment expression: %0",K],VariableTypeSyntaxError:[1008,"Unknown variable type: %0",K],ParamTypeSyntaxError:[1009,"Unknown param type: %0",K],AssignmentTypeSyntaxError:[1010,"Unknown assignment type: %0",K],FunctionUndefinedReferenceError:[2001,"%0 is not a function",lt],VariableUndefinedReferenceError:[2002,"%0 is not defined",lt],IsNotConstructor:[2003,"%0 is not a constructor",Ws]},Ks="1.4.8";function Ht(t,e){Object.defineProperty(t,"name",{value:e,writable:!1,enumerable:!1,configurable:!0})}const Js=Object.prototype.hasOwnProperty,pe=Symbol("Break"),fe=Symbol("Continue"),Ut=Symbol("DefaultCase"),N=Symbol("EmptyStatementReturn"),$t=Symbol("WithScopeName"),Gt=Symbol("SuperScopeName"),qt=Symbol("RootScopeName"),Wt=Symbol("GlobalScopeName");function it(t){return typeof t=="function"}class se{constructor(e){this.interpreter=e}generator(){const e=this.interpreter;function i(){return this.getCurrentScope()}function s(){return this.getGlobalScope()}function r(){return this.getCurrentContext()}return{getOptions:e.getOptions.bind(e),getCurrentScope:i.bind(e),getGlobalScope:s.bind(e),getCurrentContext:r.bind(e),getExecStartTime:e.getExecStartTime.bind(e)}}}function It(t,e,i=!0){if(!(t instanceof se))throw new Error("Illegal call");if(typeof e!="string")return e;if(!e)return;const s=t.generator(),n={timeout:s.getOptions().timeout,_initEnv:function(){i||this.setCurrentContext(s.getCurrentContext()),this.execStartTime=s.getExecStartTime(),this.execEndTime=this.execStartTime}},a=i?s.getGlobalScope():s.getCurrentScope();return new j(a,n).evaluate(e)}Object.defineProperty(It,"__IS_EVAL_FUNC",{value:!0,writable:!1,enumerable:!1,configurable:!1});function At(t,...e){if(!(t instanceof se))throw new Error("Illegal call");const i=t.generator(),s=e.pop(),r=new j(i.getGlobalScope(),i.getOptions()),n=`
|
|
14
|
+
(function anonymous(${e.join(",")}){
|
|
15
|
+
${s}
|
|
16
|
+
});
|
|
17
|
+
`;return r.evaluate(n)}Object.defineProperty(At,"__IS_FUNCTION_FUNC",{value:!0,writable:!1,enumerable:!1,configurable:!1});class J{constructor(e){this.value=e}}class oe{constructor(e){this.value=e}}class ie{constructor(e){this.value=e}}class de{constructor(e,i=null,s){this.name=s,this.parent=i,this.data=e,this.labelStack=[]}}function Oe(){}function Qs(t=null,e){return new de(Object.create(null),t,e)}function Ys(t){return Object.create(t)}const Q={NaN:NaN,Infinity:1/0,undefined:void 0,Object,Array,String,Boolean,Number,Date,RegExp,Error,URIError,TypeError,RangeError,SyntaxError,ReferenceError,Math,parseInt,parseFloat,isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,escape,unescape,eval:It,Function:At};typeof JSON<"u"&&(Q.JSON=JSON);typeof Promise<"u"&&(Q.Promise=Promise);typeof Set<"u"&&(Q.Set=Set);typeof Map<"u"&&(Q.Map=Map);typeof Symbol<"u"&&(Q.Symbol=Symbol);typeof Proxy<"u"&&(Q.Proxy=Proxy);typeof WeakMap<"u"&&(Q.WeakMap=WeakMap);typeof WeakSet<"u"&&(Q.WeakSet=WeakSet);typeof Reflect<"u"&&(Q.Reflect=Reflect);class j{constructor(e=j.global,i={}){this.sourceList=[],this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null),this.isVarDeclMode=!1,this.lastExecNode=null,this.isRunning=!1,this.options={ecmaVersion:i.ecmaVersion||j.ecmaVersion,timeout:i.timeout||0,rootContext:i.rootContext,globalContextInFunction:i.globalContextInFunction===void 0?j.globalContextInFunction:i.globalContextInFunction,_initEnv:i._initEnv},this.context=e||Object.create(null),this.callStack=[],this.initEnvironment(this.context)}initEnvironment(e){let i;if(e instanceof de)i=e;else{let r=null;const n=this.createSuperScope(e);this.options.rootContext&&(r=new de(Ys(this.options.rootContext),n,qt)),i=new de(e,r||n,Wt)}this.globalScope=i,this.currentScope=this.globalScope,this.globalContext=i.data,this.currentContext=i.data,this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null),this.execStartTime=Date.now(),this.execEndTime=this.execStartTime;const s=this.options._initEnv;s&&s.call(this)}getExecStartTime(){return this.execStartTime}getExecutionTime(){return this.execEndTime-this.execStartTime}setExecTimeout(e=0){this.options.timeout=e}getOptions(){return this.options}getGlobalScope(){return this.globalScope}getCurrentScope(){return this.currentScope}getCurrentContext(){return this.currentContext}isInterruptThrow(e){return e instanceof Hi||e instanceof K||e instanceof zs}createSuperScope(e){let i=Object.assign({},Q);return Object.keys(i).forEach(r=>{r in e&&delete i[r]}),new de(i,null,Gt)}setCurrentContext(e){this.currentContext=e}setCurrentScope(e){this.currentScope=e}evaluate(e=""){let i;if(e)return i=$s(e,{ranges:!0,locations:!0,ecmaVersion:this.options.ecmaVersion||j.ecmaVersion}),this.evaluateNode(i,e)}appendCode(e){return this.evaluate(e)}evaluateNode(e,i=""){this.value=void 0,this.source=i,this.sourceList.push(i),this.isRunning=!0,this.execStartTime=Date.now(),this.execEndTime=this.execStartTime,this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null);const s=this.getCurrentScope(),r=this.getCurrentContext(),n=s.labelStack.concat([]),a=this.callStack.concat([]),u=()=>{this.setCurrentScope(s),this.setCurrentContext(r),s.labelStack=n,this.callStack=a};try{const l=this.createClosure(e);this.addDeclarationsToScope(this.collectDeclVars,this.collectDeclFuncs,this.getCurrentScope()),l()}catch(l){throw l}finally{u(),this.execEndTime=Date.now()}return this.isRunning=!1,this.getValue()}createErrorMessage(e,i,s){let r=e[1].replace("%0",String(i));return s!==null&&(r+=this.getNodePosition(s||this.lastExecNode)),r}createError(e,i){return new i(e)}createThrowError(e,i){return this.createError(e,i)}createInternalThrowError(e,i,s){return this.createError(this.createErrorMessage(e,i,s),e[2])}checkTimeout(){if(!this.isRunning)return!1;const e=this.options.timeout||0;return Date.now()-this.execStartTime>e}getNodePosition(e){return e&&e.loc?` [${e.loc.start.line}:${e.loc.start.column}]`:""}createClosure(e){let i;switch(e.type){case"BinaryExpression":i=this.binaryExpressionHandler(e);break;case"LogicalExpression":i=this.logicalExpressionHandler(e);break;case"UnaryExpression":i=this.unaryExpressionHandler(e);break;case"UpdateExpression":i=this.updateExpressionHandler(e);break;case"ObjectExpression":i=this.objectExpressionHandler(e);break;case"ArrayExpression":i=this.arrayExpressionHandler(e);break;case"CallExpression":i=this.callExpressionHandler(e);break;case"NewExpression":i=this.newExpressionHandler(e);break;case"MemberExpression":i=this.memberExpressionHandler(e);break;case"ThisExpression":i=this.thisExpressionHandler(e);break;case"SequenceExpression":i=this.sequenceExpressionHandler(e);break;case"Literal":i=this.literalHandler(e);break;case"Identifier":i=this.identifierHandler(e);break;case"AssignmentExpression":i=this.assignmentExpressionHandler(e);break;case"FunctionDeclaration":i=this.functionDeclarationHandler(e);break;case"VariableDeclaration":i=this.variableDeclarationHandler(e);break;case"BlockStatement":case"Program":i=this.programHandler(e);break;case"ExpressionStatement":i=this.expressionStatementHandler(e);break;case"EmptyStatement":i=this.emptyStatementHandler(e);break;case"ReturnStatement":i=this.returnStatementHandler(e);break;case"FunctionExpression":i=this.functionExpressionHandler(e);break;case"IfStatement":i=this.ifStatementHandler(e);break;case"ConditionalExpression":i=this.conditionalExpressionHandler(e);break;case"ForStatement":i=this.forStatementHandler(e);break;case"WhileStatement":i=this.whileStatementHandler(e);break;case"DoWhileStatement":i=this.doWhileStatementHandler(e);break;case"ForInStatement":i=this.forInStatementHandler(e);break;case"WithStatement":i=this.withStatementHandler(e);break;case"ThrowStatement":i=this.throwStatementHandler(e);break;case"TryStatement":i=this.tryStatementHandler(e);break;case"ContinueStatement":i=this.continueStatementHandler(e);break;case"BreakStatement":i=this.breakStatementHandler(e);break;case"SwitchStatement":i=this.switchStatementHandler(e);break;case"LabeledStatement":i=this.labeledStatementHandler(e);break;case"DebuggerStatement":i=this.debuggerStatementHandler(e);break;default:throw this.createInternalThrowError(R.NodeTypeSyntaxError,e.type,e)}return(...s)=>{const r=this.options.timeout;if(r&&r>0&&this.checkTimeout())throw this.createInternalThrowError(R.ExecutionTimeOutError,r,null);return this.lastExecNode=e,i(...s)}}binaryExpressionHandler(e){const i=this.createClosure(e.left),s=this.createClosure(e.right);return()=>{const r=i(),n=s();switch(e.operator){case"==":return r==n;case"!=":return r!=n;case"===":return r===n;case"!==":return r!==n;case"<":return r<n;case"<=":return r<=n;case">":return r>n;case">=":return r>=n;case"<<":return r<<n;case">>":return r>>n;case">>>":return r>>>n;case"+":return r+n;case"-":return r-n;case"*":return r*n;case"**":return Math.pow(r,n);case"/":return r/n;case"%":return r%n;case"|":return r|n;case"^":return r^n;case"&":return r&n;case"in":return r in n;case"instanceof":return r instanceof n;default:throw this.createInternalThrowError(R.BinaryOperatorSyntaxError,e.operator,e)}}}logicalExpressionHandler(e){const i=this.createClosure(e.left),s=this.createClosure(e.right);return()=>{switch(e.operator){case"||":return i()||s();case"&&":return i()&&s();default:throw this.createInternalThrowError(R.LogicalOperatorSyntaxError,e.operator,e)}}}unaryExpressionHandler(e){switch(e.operator){case"delete":const i=this.createObjectGetter(e.argument),s=this.createNameGetter(e.argument);return()=>{let n=i();const a=s();return delete n[a]};default:let r;if(e.operator==="typeof"&&e.argument.type==="Identifier"){const n=this.createObjectGetter(e.argument),a=this.createNameGetter(e.argument);r=()=>n()[a()]}else r=this.createClosure(e.argument);return()=>{const n=r();switch(e.operator){case"-":return-n;case"+":return+n;case"!":return!n;case"~":return~n;case"void":return;case"typeof":return typeof n;default:throw this.createInternalThrowError(R.UnaryOperatorSyntaxError,e.operator,e)}}}}updateExpressionHandler(e){const i=this.createObjectGetter(e.argument),s=this.createNameGetter(e.argument);return()=>{const r=i(),n=s();switch(this.assertVariable(r,n,e),e.operator){case"++":return e.prefix?++r[n]:r[n]++;case"--":return e.prefix?--r[n]:r[n]--;default:throw this.createInternalThrowError(R.UpdateOperatorSyntaxError,e.operator,e)}}}objectExpressionHandler(e){const i=[];function s(n){return n.type==="Identifier"?n.name:n.type==="Literal"?n.value:this.throwError(R.ObjectStructureSyntaxError,n.type,n)}const r=Object.create(null);return e.properties.forEach(n=>{const a=n.kind,u=s(n.key);(!r[u]||a==="init")&&(r[u]={}),r[u][a]=this.createClosure(n.value),i.push({key:u,property:n})}),()=>{const n={},a=i.length;for(let u=0;u<a;u++){const l=i[u],c=l.key,h=r[c],p=h.init?h.init():void 0,m=h.get?h.get():function(){},d=h.set?h.set():function(g){};if("set"in h||"get"in h)Object.defineProperty(n,c,{configurable:!0,enumerable:!0,get:m,set:d});else{const g=l.property,v=g.kind;g.key.type==="Identifier"&&g.value.type==="FunctionExpression"&&v==="init"&&!g.value.id&&Ht(p,g.key.name),n[c]=p}}return n}}arrayExpressionHandler(e){const i=e.elements.map(s=>s&&this.createClosure(s));return()=>{const s=i.length,r=Array(s);for(let n=0;n<s;n++){const a=i[n];a&&(r[n]=a())}return r}}safeObjectGet(e,i,s){return e[i]}createCallFunctionGetter(e){switch(e.type){case"MemberExpression":const i=this.createClosure(e.object),s=this.createMemberKeyGetter(e),r=this.source;return()=>{const a=i(),u=s(),l=this.safeObjectGet(a,u,e);if(!l||!it(l)){const c=r.slice(e.start,e.end);throw this.createInternalThrowError(R.FunctionUndefinedReferenceError,c,e)}return l.__IS_EVAL_FUNC?c=>l(new se(this),c,!0):l.__IS_FUNCTION_FUNC?(...c)=>l(new se(this),...c):l.bind(a)};default:const n=this.createClosure(e);return()=>{let a="";e.type==="Identifier"&&(a=e.name);const u=n();if(!u||!it(u))throw this.createInternalThrowError(R.FunctionUndefinedReferenceError,a,e);if(e.type==="Identifier"&&u.__IS_EVAL_FUNC&&a==="eval")return c=>{const h=this.getScopeFromName(a,this.getCurrentScope()),p=h.name===Gt||h.name===Wt||h.name===qt;return u(new se(this),c,!p)};if(u.__IS_EVAL_FUNC)return c=>u(new se(this),c,!0);if(u.__IS_FUNCTION_FUNC)return(...c)=>u(new se(this),...c);let l=this.options.globalContextInFunction;if(e.type==="Identifier"){const c=this.getIdentifierScope(e);c.name===$t&&(l=c.data)}return u.bind(l)}}}callExpressionHandler(e){const i=this.createCallFunctionGetter(e.callee),s=e.arguments.map(r=>this.createClosure(r));return()=>i()(...s.map(r=>r()))}functionExpressionHandler(e){const i=this,s=this.source,r=this.collectDeclVars,n=this.collectDeclFuncs;this.collectDeclVars=Object.create(null),this.collectDeclFuncs=Object.create(null);const a=e.id?e.id.name:"",u=e.params.length,l=e.params.map(m=>this.createParamNameGetter(m)),c=this.createClosure(e.body),h=this.collectDeclVars,p=this.collectDeclFuncs;return this.collectDeclVars=r,this.collectDeclFuncs=n,()=>{const m=i.getCurrentScope(),d=function(...g){i.callStack.push(`${a}`);const v=i.getCurrentScope(),y=Qs(m,`FunctionScope(${a})`);i.setCurrentScope(y),i.addDeclarationsToScope(h,p,y),a&&(y.data[a]=d),y.data.arguments=arguments,l.forEach((O,E)=>{y.data[O()]=g[E]});const k=i.getCurrentContext();i.setCurrentContext(this);const P=c();if(i.setCurrentContext(k),i.setCurrentScope(v),i.callStack.pop(),P instanceof J)return P.value};return Ht(d,a),Object.defineProperty(d,"length",{value:u,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(d,"toString",{value:()=>s.slice(e.start,e.end),writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(d,"valueOf",{value:()=>s.slice(e.start,e.end),writable:!0,configurable:!0,enumerable:!1}),d}}newExpressionHandler(e){const i=this.source,s=this.createClosure(e.callee),r=e.arguments.map(n=>this.createClosure(n));return()=>{const n=s();if(!it(n)||n.__IS_EVAL_FUNC){const a=e.callee,u=i.slice(a.start,a.end);throw this.createInternalThrowError(R.IsNotConstructor,u,e)}return n.__IS_FUNCTION_FUNC?n(new se(this),...r.map(a=>a())):new n(...r.map(a=>a()))}}memberExpressionHandler(e){const i=this.createClosure(e.object),s=this.createMemberKeyGetter(e);return()=>{const r=i();let n=s();return r[n]}}thisExpressionHandler(e){return()=>this.getCurrentContext()}sequenceExpressionHandler(e){const i=e.expressions.map(s=>this.createClosure(s));return()=>{let s;const r=i.length;for(let n=0;n<r;n++){const a=i[n];s=a()}return s}}literalHandler(e){return()=>e.regex?new RegExp(e.regex.pattern,e.regex.flags):e.value}identifierHandler(e){return()=>{const i=this.getCurrentScope(),s=this.getScopeDataFromName(e.name,i);return this.assertVariable(s,e.name,e),s[e.name]}}getIdentifierScope(e){const i=this.getCurrentScope();return this.getScopeFromName(e.name,i)}assignmentExpressionHandler(e){e.left.type==="Identifier"&&e.right.type==="FunctionExpression"&&!e.right.id&&(e.right.id={type:"Identifier",name:e.left.name});const i=this.createObjectGetter(e.left),s=this.createNameGetter(e.left),r=this.createClosure(e.right);return()=>{const n=i(),a=s(),u=r();switch(e.operator!=="="&&this.assertVariable(n,a,e),e.operator){case"=":return n[a]=u;case"+=":return n[a]+=u;case"-=":return n[a]-=u;case"*=":return n[a]*=u;case"**=":return n[a]=Math.pow(n[a],u);case"/=":return n[a]/=u;case"%=":return n[a]%=u;case"<<=":return n[a]<<=u;case">>=":return n[a]>>=u;case">>>=":return n[a]>>>=u;case"&=":return n[a]&=u;case"^=":return n[a]^=u;case"|=":return n[a]|=u;default:throw this.createInternalThrowError(R.AssignmentExpressionSyntaxError,e.type,e)}}}functionDeclarationHandler(e){if(e.id){const i=this.functionExpressionHandler(e);Object.defineProperty(i,"isFunctionDeclareClosure",{value:!0,writable:!1,configurable:!1,enumerable:!1}),this.funcDeclaration(e.id.name,i)}return()=>N}getVariableName(e){if(e.type==="Identifier")return e.name;throw this.createInternalThrowError(R.VariableTypeSyntaxError,e.type,e)}variableDeclarationHandler(e){let i;const s=[];for(let r=0;r<e.declarations.length;r++){const n=e.declarations[r];this.varDeclaration(this.getVariableName(n.id)),n.init&&s.push({type:"AssignmentExpression",operator:"=",left:n.id,right:n.init})}return s.length&&(i=this.createClosure({type:"BlockStatement",body:s})),()=>{if(i){const r=this.isVarDeclMode;this.isVarDeclMode=!0,i(),this.isVarDeclMode=r}return N}}assertVariable(e,i,s){if(e===this.globalScope.data&&!(i in e))throw this.createInternalThrowError(R.VariableUndefinedReferenceError,i,s)}programHandler(e){const i=e.body.map(s=>this.createClosure(s));return()=>{let s=N;for(let r=0;r<i.length;r++){const n=i[r],a=this.setValue(n());if(a!==N&&(s=a,s instanceof J||s instanceof oe||s instanceof ie||s===pe||s===fe))break}return s}}expressionStatementHandler(e){return this.createClosure(e.expression)}emptyStatementHandler(e){return()=>N}returnStatementHandler(e){const i=e.argument?this.createClosure(e.argument):Oe;return()=>new J(i())}ifStatementHandler(e){const i=this.createClosure(e.test),s=this.createClosure(e.consequent),r=e.alternate?this.createClosure(e.alternate):()=>N;return()=>i()?s():r()}conditionalExpressionHandler(e){return this.ifStatementHandler(e)}forStatementHandler(e){let i=Oe,s=e.test?this.createClosure(e.test):()=>!0,r=Oe;const n=this.createClosure(e.body);return e.type==="ForStatement"&&(i=e.init?this.createClosure(e.init):i,r=e.update?this.createClosure(e.update):Oe),a=>{let u,l=N,c=e.type==="DoWhileStatement";for(a&&a.type==="LabeledStatement"&&(u=a.label.name),i();c||s();r()){c=!1;const h=this.setValue(n());if(!(h===N||h===fe)){if(h===pe)break;if(l=h,l instanceof ie&&l.value===u){l=N;continue}if(l instanceof J||l instanceof oe||l instanceof ie)break}}return l}}whileStatementHandler(e){return this.forStatementHandler(e)}doWhileStatementHandler(e){return this.forStatementHandler(e)}forInStatementHandler(e){let i=e.left;const s=this.createClosure(e.right),r=this.createClosure(e.body);return e.left.type==="VariableDeclaration"&&(this.createClosure(e.left)(),i=e.left.declarations[0].id),n=>{let a,u=N,l;n&&n.type==="LabeledStatement"&&(a=n.label.name);const c=s();for(l in c){this.assignmentExpressionHandler({type:"AssignmentExpression",operator:"=",left:i,right:{type:"Literal",value:l}})();const h=this.setValue(r());if(!(h===N||h===fe)){if(h===pe)break;if(u=h,u instanceof ie&&u.value===a){u=N;continue}if(u instanceof J||u instanceof oe||u instanceof ie)break}}return u}}withStatementHandler(e){const i=this.createClosure(e.object),s=this.createClosure(e.body);return()=>{const r=i(),n=this.getCurrentScope(),a=new de(r,n,$t);this.setCurrentScope(a);const u=this.setValue(s());return this.setCurrentScope(n),u}}throwStatementHandler(e){const i=this.createClosure(e.argument);return()=>{throw this.setValue(void 0),i()}}tryStatementHandler(e){const i=this.createClosure(e.block),s=e.handler?this.catchClauseHandler(e.handler):null,r=e.finalizer?this.createClosure(e.finalizer):null;return()=>{const n=this.getCurrentScope(),a=this.getCurrentContext(),u=n.labelStack.concat([]),l=this.callStack.concat([]);let c=N,h,p;const m=()=>{this.setCurrentScope(n),this.setCurrentContext(a),n.labelStack=u,this.callStack=l};try{c=this.setValue(i()),c instanceof J&&(h=c)}catch(d){if(m(),this.isInterruptThrow(d))throw d;if(s)try{c=this.setValue(s(d)),c instanceof J&&(h=c)}catch(g){if(m(),this.isInterruptThrow(g))throw g;p=g}}if(r)try{c=r(),c instanceof J&&(h=c)}catch(d){if(m(),this.isInterruptThrow(d))throw d;p=d}if(p)throw p;return h||c}}catchClauseHandler(e){const i=this.createParamNameGetter(e.param),s=this.createClosure(e.body);return r=>{let n;const u=this.getCurrentScope().data,l=i(),c=Js.call(u,l),h=u[l];return u[l]=r,n=s(),c?u[l]=h:delete u[l],n}}continueStatementHandler(e){return()=>e.label?new ie(e.label.name):fe}breakStatementHandler(e){return()=>e.label?new oe(e.label.name):pe}switchStatementHandler(e){const i=this.createClosure(e.discriminant),s=e.cases.map(r=>this.switchCaseHandler(r));return()=>{const r=i();let n=!1,a,u,l=0,c=!1;for(let h=0;h<2;h++){for(let p=l;p<s.length;p++){const m=s[p](),d=m.testClosure();if(!c&&d===Ut&&(c=!0,l=p),n||d===r){if(n=!0,u=this.setValue(m.bodyClosure()),u===N)continue;if(u===pe||(a=u,a instanceof J||a instanceof oe||a instanceof ie||a===fe))break}}if(!n&&c)n=!0;else break}return a}}switchCaseHandler(e){const i=e.test?this.createClosure(e.test):()=>Ut,s=this.createClosure({type:"BlockStatement",body:e.consequent});return()=>({testClosure:i,bodyClosure:s})}labeledStatementHandler(e){const i=e.label.name,s=this.createClosure(e.body);return()=>{let r;const n=this.getCurrentScope();return n.labelStack.push(i),r=s(e),r instanceof oe&&r.value===i&&(r=N),n.labelStack.pop(),r}}debuggerStatementHandler(e){return()=>{debugger;return N}}createParamNameGetter(e){if(e.type==="Identifier")return()=>e.name;throw this.createInternalThrowError(R.ParamTypeSyntaxError,e.type,e)}createObjectKeyGetter(e){let i;return e.type==="Identifier"?i=()=>e.name:i=this.createClosure(e),function(){return i()}}createMemberKeyGetter(e){return e.computed?this.createClosure(e.property):this.createObjectKeyGetter(e.property)}createObjectGetter(e){switch(e.type){case"Identifier":return()=>this.getScopeDataFromName(e.name,this.getCurrentScope());case"MemberExpression":return this.createClosure(e.object);default:throw this.createInternalThrowError(R.AssignmentTypeSyntaxError,e.type,e)}}createNameGetter(e){switch(e.type){case"Identifier":return()=>e.name;case"MemberExpression":return this.createMemberKeyGetter(e);default:throw this.createInternalThrowError(R.AssignmentTypeSyntaxError,e.type,e)}}varDeclaration(e){const i=this.collectDeclVars;i[e]=void 0}funcDeclaration(e,i){const s=this.collectDeclFuncs;s[e]=i}addDeclarationsToScope(e,i,s){const r=s.data;for(let n in i){const a=i[n];r[n]=a&&a()}for(let n in e)n in r||(r[n]=void 0)}getScopeValue(e,i){return this.getScopeFromName(e,i).data[e]}getScopeDataFromName(e,i){return this.getScopeFromName(e,i).data}getScopeFromName(e,i){let s=i;do if(e in s.data)return s;while(s=s.parent);return this.globalScope}setValue(e){const i=this.callStack.length;return this.isVarDeclMode||i||e===N||e===pe||e===fe||e instanceof oe||e instanceof ie||(this.value=e instanceof J?e.value:e),e}getValue(){return this.value}}j.version=Ks;j.eval=It;j.Function=At;j.ecmaVersion=5;j.globalContextInFunction=void 0;j.global=Object.create(null);const Xs=(()=>{try{return new Function("return 1")(),!0}catch{return!1}})();function Zs(t){if(typeof window>"u")return;const e=window[0]||window;if(e.__simulator__)try{const i=e.__simulator__.engine.provider.errorHandler;i&&i(t)}catch{}}function er(t,e){return new j(e,{rootContext:e,globalContextInFunction:e}).evaluate(`(function($scope){ ${t} }).call(this, this)`)}function be(t,e,i=!1,s=!1,r=!1){try{const n=['"use strict";',"var __self = arguments[0];"];n.push("return ");let a=(t.value||"").trim();r||(a=a.replace(/this(\W|$)/g,(l,c)=>`__self${c}`)),a=n.join(`
|
|
18
|
+
`)+a;const u=r?`
|
|
19
|
+
${a}
|
|
20
|
+
`:`with(${i?"{}":"$scope || {}"}) { ${a} }`;return Xs?new Function("$scope",u)(e):er(u,e)}catch(n){if(f.logger.error("parseExpression.error",n,t,e?.__self??e),Zs(n),s)throw n}}function G(t,e,i=!1,s=!1,r=!1){const n=be(t,e,i,s,r);if(typeof n!="function"&&(f.logger.error("parseFunction.error","not a function",t,e?.__self??e),s))throw new Error(`"${t.value}" not a function`);return n}function D(t){return t&&t.type==="JSExpression"}function M(t){return typeof t=="object"&&t&&t.type==="JSFunction"}function Ui(t){return D(t)||M(t)}function tr(t){return Ui(t)?t.value:JSON.stringify(t)}const ir={session:!1,authKey:"Authorization",storageKey:"ACCESS_STORAGE",storagePrefix:"__VTJ_",unauthorized:void 0,auth:"/#/login",redirectParam:"r",unauthorizedCode:401,unauthorizedMessage:"登录已经失效,请重新登录!",noPermissionMessage:"无权限访问该页面",appName:"",statusKey:"code"},Pt=Symbol("access");class Ke{options;data=null;mode=T.Raw;interceptResponse=!0;isTipShowing=!1;constructor(e){this.options=Object.assign({},ir,e),this.loadData()}enableIntercept(){this.interceptResponse=!0}disableIntercept(){this.interceptResponse=!1}connect(e){const{mode:i,router:s,request:r}=e;this.mode=i,s&&this.mode!==T.Design&&this.setGuard(s),r&&this.setRequest(r)}login(e){const{storageKey:i,storagePrefix:s,session:r,authKey:n}=this.options;this.setData(e),this.data&&(f.storage.save(i,e,{type:"local",prefix:s}),r&&f.cookie.set(n,this.data.token))}clear(){const{storageKey:e,storagePrefix:i,session:s,authKey:r}=this.options;this.data=null,f.storage.remove(e,{type:"local",prefix:i}),s&&f.cookie.remove(r)}logout(){this.clear(),this.toLogin()}getData(){return this.data?this.data:(this.loadData(),this.data)}getToken(){return this.data||this.loadData(),this.data?.token}can(e){const{appName:i}=this.options,{permissions:s={}}=this.data||{};return typeof e=="function"?e(s):f.toArray(e).every(n=>s[n]||s[i+"."+n])}some(e){const{appName:i}=this.options,{permissions:s={}}=this.data||{};return f.toArray(e).some(n=>s[n]||s[i+"."+n])}install(e){e.config.globalProperties.$access=this,e.provide(Pt,this)}isAuthPath(e){const{auth:i,isAuth:s}=this.options;if(s)return s(e);if(e.path&&typeof i=="string"){const r=i.split("#")[1]||i;return e.path===r}return!1}toLogin(){const{auth:e,redirectParam:i}=this.options;if(!e)return;const s=i?`?${i}=${encodeURIComponent(location.href)}`:"";typeof e=="function"?e(s):location.href=i?`${e}${s}`:e}setData(e){const{privateKey:i}=this.options;if(Array.isArray(e)&&i){const s=e.map(r=>f.unRSA(r,i));try{this.data=JSON.parse(s.join(""))}catch(r){console.warn(r)}return}if(typeof e=="string")try{const s=i?f.unRSA(e,i):e;s?this.data=JSON.parse(s):console.warn("RSA解密失败或登录信息缺失")}catch(s){console.warn(s)}else this.data=e}loadData(){const{storageKey:e,storagePrefix:i}=this.options,s=f.storage.get(e,{type:"local",prefix:i});this.setData(s||null)}isLogined(){const{session:e,authKey:i}=this.options;return e&&i?!!f.cookie.get(i):!!this.getToken()}hasRoutePermission(e){if(e.name===xe){const i=e.params.id;return i&&this.can(i)}return e.meta.__vtj__?this.can(e.meta.__vtj__):e.meta.permission?this.can(e.meta.permission):!0}setGuard(e){e.beforeEach((i,s,r)=>this.guard(i,r))}async guard(e,i){if(this.isWhiteList(e)||this.isAuthPath(e))return i();if(this.isLogined()){if(this.hasRoutePermission(e))return i();{const{noPermissionMessage:s="无权限访问",unauthorized:r=!1}=this.options;return await this.showTip(s),f.isFunction(r)?(r(),i(!1)):f.isString(r)?i(r):i(!1)}}i(!1),await f.delay(0),this.toLogin()}isWhiteList(e){const{whiteList:i}=this.options;return i?Array.isArray(i)?i.some(s=>e.fullPath.startsWith(s)):i(e):!1}isUnauthorized(e){const{unauthorizedCode:i=401,statusKey:s="code"}=this.options;return e.status===i||e.data?.[s]===i}async showUnauthorizedAlert(e){const{unauthorizedMessage:i="登录已失效"}=this.options;this.isUnauthorized(e)&&await this.showTip(i)&&this.toLogin()}async showTip(e){const{alert:i}=this.options;return this.isTipShowing?!1:i?(this.isTipShowing=!0,await f.delay(150),await i(e,{title:"提示",type:"warning"})?.catch(()=>!0)?.finally(()=>{this.isTipShowing=!1})):(window.alert(e),!0)}setRequest(e){e.useRequest(i=>(this.data?.token&&(i.headers[this.options.authKey]=this.data?.token),i)),e.useResponse(async i=>(this.interceptResponse&&await this.showUnauthorizedAlert(i),i),async i=>{if(!this.interceptResponse)return Promise.reject(i);const s=i.response||i||{};return await this.showUnauthorizedAlert(s),Promise.reject(i)})}}function $i(){return F.inject(Pt,null)}function sr(t={}){const{notify:e,loading:i,settings:s={},Startup:r,access:n,useTitle:a,alert:u}=t;let l=null;return{request:f.createRequest({adapter:t.axiosAdapter,settings:{type:"form",validSuccess:!0,originResponse:!1,loading:!0,validate:h=>h.data?.code===0||!!h.data?.success,failMessage:!0,showError:h=>{e&&e(h||"未知错误")},showLoading:()=>{l&&l.close(),i&&(l=i())},hideLoading:()=>{l&&(l.close(),l=null)},...s}}),jsonp:f.jsonp,notify:e,loading:i,useTitle:a,alert:u,startupComponent:r,access:n?new Ke({alert:u,...n}):void 0}}function rr(t={}){return new Ke(t)}function Gi(t,e){const{jsonp:i,request:s}=e;if(t.method==="jsonp")return(r={})=>i(t.url,{...t.jsonpOptions,query:r});{const r=t.headers?be(t.headers,{},!0):void 0,n={url:t.url,method:t.method,settings:{...t.settings,headers:r}};return(a,u)=>(delete n.data,s.send(f.merge(n,u||{},{data:a})))}}function qi(t,e){const{metaQuery:i}=e;if(!i)return;const{code:s,queryCode:r}=t;return(n,a)=>{if(!i){console.warn("adapter.metaQuery is not defined!");return}return i(s,r,n,a)}}function Wi(t=[],e=[],i){const s={};for(const r of t){const n=Gi(r,i);s[r.id]=n,s[r.name]=n}for(const r of e)s[r.id]=qi(r,i);return s}async function zi(t=[],e=window){const i=ve(e);i&&(Tt(e),t.forEach(s=>Ji(i,s)))}function Ki(t,e=window){const i=M(t.mockTemplate)&&t.mockTemplate.value?G(t.mockTemplate,{},!0):void 0,s=ve(e);return async(...r)=>{let n={};if(i)try{n=await i.apply(i,r)}catch(a){f.logger.warn("模拟数据模版异常",a)}return s?.mock(n)}}function Ji(t,e){if(!e.mock)return;const{url:i,mockTemplate:s,method:r="get"}=e;if(i&&s)try{const n=f.isUrl(i)?new URL(i).pathname:i,a=f.pathToRegexp(`(.*)${n}(.*)`),u=f.pathToRegexpMatch(n,{decode:decodeURIComponent}),l=be(s,{},!0);t.mock(a,r.toLowerCase(),c=>{const h=f.url.parse(c.url)||{},p=c.body instanceof FormData?f.formDataToJson(c.body):c.body,m=f.isUrl(c.url)?new URL(c.url).pathname:c.url.split("?")[0],d=u(m)?.params;Object.assign(c,{data:p,params:d,query:h});try{return t.mock(l(c))}catch(g){return console.warn("[mockApi]",a,c,g),null}})}catch(n){console.warn("mockApi",n)}}function Tt(t=window){const e=ve(t);e&&(e._mocked={})}class Qi{__id=null;__mode;__instance=null;__contextRefs={};__refs={};__refCaches={};context={};state={};props={};$props={};$refs={};$el=null;$emit=null;$nextTick=null;$parent=null;$root=null;$attrs=null;$slots=null;$watch=null;$options=null;$forceUpdate=null;$components={};$libs={};$apis={};$provider=null;__transform={};constructor(e){const{mode:i,dsl:s,attrs:r}=e;this.__mode=i,s&&(this.__id=s.id||null,this.__transform=s.transform||{}),r&&Object.assign(this,r)}setup(e,i=Be){const s=i.getCurrentInstance();if(!s)return;this.__refs={},this.__refCaches={},this.$refs={},this.context={},this.__contextRefs={},this.__instance=s.proxy;const r=s.appContext.config.globalProperties;Object.assign(this,r),Object.assign(this,e||{}),this.__proxy(),i.onMounted(()=>{this.__proxy()}),i.onUnmounted(()=>{this.__cleanup()}),i.onBeforeUpdate(()=>{this.__reset()})}__proxy(){if(!this.__instance)return;const e=this.__instance;at.forEach(i=>{this[i]=e[i]||e._?.[i.replace("$","")]||null})}__cleanup(){at.forEach(e=>{this[e]=null}),this.__reset()}__reset(){this.__refs={},this.__refCaches={},this.$refs={},this.__contextRefs={},this.context={}}__parseFunction(e){if(e)if(this.__mode===T.Runtime){const{id:i,type:s}=e,r=i?this.__transform[i]??e.value:e.value;return G({type:s,value:r},this)}else return G(e,this)}__parseExpression(e){if(e)if(this.__mode===T.Runtime){const{id:i,type:s}=e,r=i?this.__transform[i]??e.value:e.value;return be({type:s,value:r},this)}else return be(e,this)}__ref(e=null,i){if(this.__mode===T.VNode)return;e&&e!==this.__id&&(this.__contextRefs[e]=this);let s=e?this.__refCaches[e]:null;return s||(s=async r=>{await f.delay(0);let n=r?.$vtjEl||r?.$el||r?._?.vnode?.el||r;if(!n){typeof i=="string"&&(delete this.$refs[i],e&&delete this.__refs[e]);return}return n.nodeType===3&&n.nextSibling&&(n=n.nextSibling),n.__vtj__=e,T.Design===this.__mode&&(n.__context__=this,n.draggable=!0),e&&(this.__refs[e]=this.__getRefEl(this.__refs,e,r)),typeof i=="function"?i(r):i&&(this.$refs[i]=this.__getRefEl(this.$refs,i,r)),r},e&&(this.__refCaches[e]=s),s)}__getRefEl(e,i,s){const r=e[i];if(r&&s!==r){const n=new Set([].concat(r,s));return Array.from(n)}else return s}__clone(e={}){const i={...this.context,...e},s={...i,context:i};return s.context.__proto__=this.context,s.__proto__=this,s}}function Me(t){const{Vue:e=Be,mode:i=T.Runtime,components:s={},libs:r={},apis:n={},loader:a}=t,u=e.computed(()=>t.dsl),l={$components:s,$libs:r,$apis:n},c=new Qi({mode:i,dsl:u.value,attrs:l}),h=e.defineComponent({name:u.value.name,__scopeId:u.value.id?`data-v-${u.value.id}`:void 0,props:{...ar(u.value.props??[],c)},async setup(p={}){c.$props=p,c.props=p,u.value.id&&He(t.window||window,u.value.id,u.value.css||"",!0),c.state=or(e,u.value.state??{},c);const m=ur(e,u.value.computed??{},c),d=cr(u.value.methods??{},c),g=lr(e,u.value.inject,c);for(const[k,P]of Object.entries(g||{}))g[k]=e.inject(k,P);const v=Yi(u.value.dataSources||{},c),y={...g,...m,...d,...v};return c.setup(y,e),hr(e,u.value.watch??[],c),{vtj:c,state:c.state,...p,...m,...d}},emits:nr(u.value.emits),expose:["vtj",...u.value.expose||[]],render(){if(!u.value.nodes)return null;const p=u.value.nodes||[];if(p.length===1)return le(p[0],c,e,a,p);{const m=p.map(d=>le(d,c,e,a,p));return e.createVNode("div",{},m)}},...pr(u.value.lifeCycles??{},c)});return{renderer:e.markRaw(h),context:c}}function nr(t=[]){return t.map(e=>f.isString(e)?e:e.name)}function ar(t=[],e){const i=s=>s?(Array.isArray(s)?s:[s]).map(n=>Jt[n]):void 0;return t.map(s=>f.isString(s)?{name:s}:{name:s.name,type:s.type,required:s.required,default:D(s.default)?e.__parseExpression(s.default):s.default}).reduce((s,r)=>(s[r.name]={type:i(r.type),required:r.required,default:r.default},s),{})}function or(t,e,i){return t.reactive(Object.keys(e||{}).reduce((s,r)=>{let n=e[r];return D(n)?n=i.__parseExpression(n):M(n)&&(n=i.__parseFunction(n)),s[r]=n,s},{}))}function ur(t,e,i){return Object.entries(e??{}).reduce((s,[r,n])=>(s[r]=t.computed(i.__parseFunction(n)),s),{})}function cr(t,e){return Object.entries(t??{}).reduce((i,[s,r])=>(i[s]=e.__parseFunction(r),i),{})}function lr(t,e=[],i){return e.reduce((s,r)=>{const{name:n,from:a}=r||{};r.default;const u=D(a)?i.__parseExpression(a)||n:a??n,l=D(r.default)?i.__parseExpression(r.default):r.default??null;return s[n]=t.inject(u,l),s},{})}function Yi(t,e){return Object.keys(t).reduce((i,s)=>{const r=t[s];if(r.type==="mock")i[s]=Ki(r);else if(r.ref){const n=e.$apis[r.ref],a=M(r.transform)?r.transform.value?e.__parseFunction(r.transform):void 0:r.transform;i[s]=async(...u)=>{const l=await n.apply(e,u);return a?a(l):l}}return i},{})}function hr(t,e=[],i){e.forEach(s=>{t.watch(i.__parseExpression(s.source),i.__parseFunction(s.handler),{deep:s.deep,immediate:s.immediate})})}function pr(t,e){return Object.entries(t??{}).reduce((i,[s,r])=>{const n=e.__parseFunction(r);return i[s]=async()=>{f.isFunction(n)&&(await f.delay(0),await n())},i},{})}class fr{__props={};__events={};__nodes={};constructor(){}setProps(e,i){this.__props[e]=i}getProps(e){return this.__props[e]}loadProps(e,i){const s=e?this.getProps(e):null;return s||(e&&this.setProps(e,i),i)}setEvents(e,i){}getEvents(e){return this.__events[e]}loadEvents(e,i){const s=e?this.getEvents(e):null;return s||(e&&this.setEvents(e,i),i)}setNode(e,i){this.__nodes[e]=i}getNode(e){return this.__nodes[e]}loadNode(e,i){const s=e?this.getNode(e):null;return s||(e&&this.setNode(e,i),i)}isEqual(e,i){return f.isEqual(e,i)}clear(){this.__props={},this.__events={},this.__nodes={}}}const me=new fr,Xi=new f.Queue;let st=[],ue={},Se={};const Zi=(t,e)=>e;async function Nt(t,e=window){const{urls:i=[],library:s}=t,r=i.filter(u=>Te(u));if(r.length===0||!s)return null;const n=i.filter(u=>Pe(u));return n.length&&mt(n,e),await gt(r,s,e).catch(u=>(console.warn("loadScriptUrl error",r,s,u),null))}function De(t){const{getDsl:e,getDslByUrl:i,options:s}=t;return s.window&&(st.forEach(r=>{delete s.window[r]}),st=[]),(r,n,a,u=Be)=>{if(!a||typeof a=="string")return n;let l="";if(a.type==="Schema"&&a.id)return l=a.id+"_"+r,Se[l]||(Se[l]=u.defineAsyncComponent(async()=>{const c=ue[a.id]||await Xi.add(a.id,()=>e(a.id));return c&&(c.name=n,ue[a.id]=c),c?Me({Vue:u,mode:T.Runtime,...s,dsl:f.cloneDeep(c),loader:De(t)}).renderer:null}));if(a.type==="UrlSchema"&&a.url)return l=a.url+"_"+r,Se[l]||(Se[l]=u.defineAsyncComponent(async()=>{const c=ue[a.url]||await i(a.url);return c&&(c.name=n,ue[a.url]=c),c?Me({...s,Vue:u,dsl:f.cloneDeep(c),mode:T.Runtime,loader:De(t)}).renderer:null}));if(a.type==="Plugin"){let c=a.library?ue[a.library]:null;return c||(a.library&&st.push(a.library),c=ue[a.library||Symbol()]=u.defineAsyncComponent(async()=>{const h=await Nt(a,s.window);return h||(console.warn("getPlugin result is null",a),null)}),c)}return n}}function dr(){ue={},Se={},Xi.clearAllCache(),me.clear()}function le(t,e,i=Be,s=Zi,r=[],n=!1,a=0){if(!t||!t.name||t.invisible)return null;const u=i.getCurrentInstance()?.appContext,{id:l=null,directives:c=[]}=t,{vIf:h,vElseIf:p,vElse:m,vFor:d,vShow:g,vModels:v,vBind:y,vHtml:k,others:P}=es(c);if(!n&&(p||m))return null;if(h&&!gr(h,e))return Sr(t,e,i,s,r);const O=(E,Y=0)=>{const Qe=E.$components,Ye=(()=>{if(t.name==="component")return xr(E,t.props?.is);if(t.name==="slot")return t.name;const W=s(`${t.id}_${Y}`,t.name,t.from,i);return f.isString(W)?oi(W)||ui(W)?W:Qe[W]??u?.app?.component(W)??W:W})(),te=vr(l,t.props??{},E),ns=_r(i,t.id,t.events??{},E);if(t.name==="slot")return Cr(i,t,te,E,s);y&&Object.assign(te,E.__parseExpression(y.value)),g&&(te.style=Object.assign(te.style??{},Er(g,E))),k&&Object.assign(te,kr(k,E)),v.forEach(W=>{ft.includes(t.name)?Object.assign(te,Ir(W,E)):Object.assign(te,Ar(i,W,E))});const as=Pr(i,t.children??[],E,s,t),Ft=E?.__id?`data-v-${E.__id}`:void 0,os=Ft?{[Ft]:""}:{},us=E.__mode===T.Design?{"data-vtj":l}:{},Ve=`${l}_${Y}`,Xe={key:Ve,...os,...us,...te,...ns};me.isEqual(Xe,me.getNode(Ve))||me.setNode(Ve,Xe);let Ze=i.createVNode(Ye,me.getNode(Ve)||Xe||{},as);const jt=u?mr(u,P,E):[];return jt.length&&(Ze=i.withDirectives(Ze,jt)),Ze};return d?Rr(d,O,e):O(e,a)}function mr(t,e,i){const s=t.app;return e.map(r=>{const n=typeof r.name=="string"?s.directive(r.name):i.__parseExpression(r.name);if(!n)return null;const a=[n];return r.value&&a.push(i.__parseExpression(r.value)),r.arg&&a.push(r.arg),r.modifiers&&a.push(r.modifiers),a}).filter(r=>!!r)}function es(t=[]){const e=t.find(h=>f.camelCase(h.name)==="vIf"),i=t.find(h=>f.camelCase(h.name)==="vElseIf"),s=t.find(h=>f.camelCase(h.name)==="vElse"),r=t.find(h=>f.camelCase(h.name)==="vFor"),n=t.find(h=>f.camelCase(h.name)==="vShow"),a=t.find(h=>f.camelCase(h.name)==="vBind"),u=t.find(h=>f.camelCase(h.name)==="vHtml"),l=t.filter(h=>f.camelCase(h.name)==="vModel"),c=t.filter(h=>!Kt.includes(f.camelCase(h.name)));return{vIf:e,vElseIf:i,vElse:s,vFor:r,vShow:n,vModels:l,vBind:a,others:c,vHtml:u}}function gr(t,e){return!!e.__parseExpression(t.value)}function xr(t,e){return e?D(e)?t.__parseExpression(e):e:"div"}function vr(t,e,i){const s=ht(e,i);return s.ref=i.__ref(t,s.ref),s}function ht(t,e){return D(t)?e.__parseExpression(t):M(t)?e.__parseFunction(t):Array.isArray(t)?t.map(i=>ht(i,e)):typeof t=="object"?Object.keys(t||{}).reduce((i,s)=>{let r=t[s];return i[s]=ht(r,e),i},{}):t}function yr(t,e){return i=>{i?.key?.toLowerCase()===e.toLowerCase()&&t(i)}}function br(t){return ci(t.value)?t:li(t.value)?{type:"JSFunction",value:`(...args) => (() => {
|
|
13
21
|
return (($event) => {
|
|
14
|
-
${
|
|
22
|
+
${t.value}
|
|
15
23
|
}).apply(this, args);
|
|
16
|
-
})()`}:
|
|
17
|
-
${
|
|
18
|
-
}`:"(v) => {}"};return{[
|
|
24
|
+
})()`}:hi(t.value)?{type:"JSFunction",value:`() => { ${t.value}}`}:t}function _r(t,e,i,s){const r=["passive","capture","once"],n={capture:"Capture",once:"Once",passive:"OnceCapture"};return Object.keys(i||{}).reduce((u,l)=>{const c=i[l],h=Rt(c.modifiers),p=h.find(g=>r.includes(g)),m="on"+f.upperFirstCamelCase(l)+(p&&n[p]||""),d=c.handler?s.__parseFunction(br(c.handler)):null;return d&&(u[m]=t.withModifiers(h.includes("enter")?yr(d,"enter"):d,h)),u},{})}function Sr(t,e,i,s,r=[]){let n=r.findIndex(a=>a.id===t.id);for(let a=++n;a<r.length;a++){const{directives:u=[]}=r[a],{vElseIf:l,vElse:c}=es(u);if(l){if(e.__parseExpression(l.value))return le(r[a],e,i,s,r,!0);continue}if(c)return le(r[a],e,i,s,r,!0)}return null}function Rt(t={},e=!1){const i=Object.keys(t);return e?i.map(s=>"."+s):i}function Cr(t,e,i,s,r){const{children:n}=e,a=wr(e,s),u=s.$slots?.[a.name];return u?u(i):n?f.isString(n)?t.createTextVNode(n):D(n)?t.createTextVNode(dt(s.__parseExpression(n))):Array.isArray(n)?n.map((l,c)=>le(l,s,t,r,n,!1,c)):null:null}function wr(t,e){const{props:i}=t,s=i?.name||"default";return{name:D(s)?e.__parseExpression(s):s,params:[]}}function Er(t,e){return e.__parseExpression(t.value)?{}:{display:"none"}}function kr(t,e){return{innerHTML:e.__parseExpression(t.value)||""}}function Ir(t,e){const i={type:"JSFunction",value:t.value?.value?`(v) => {
|
|
25
|
+
${t.value.value} = v?.target.value;
|
|
26
|
+
}`:"(v) => {}"};return{[D(t.arg)?e.__parseExpression(t.arg):t.arg||"value"]:e.__parseExpression(t.value),onInput:e.__parseFunction(i)}}function Ar(t,e,i){const s={type:"JSFunction",value:e.value?.value?`(v) => {
|
|
19
27
|
${e.value.value} = v;
|
|
20
|
-
}`:"(v) => {}"},r=t.__parseFunction(s),i=ge(b(e.modifiers)?t.__parseExpression(e.modifiers):e.modifiers),o=b(e.arg)?t.__parseExpression(e.arg):e.arg||"modelValue";return{[o]:t.__parseExpression(e.value),[`onUpdate:${o}`]:i.length&&r?n.withModifiers(r,i):r}}function Gt(n,e,t,s,r){if(!e)return null;if(f.isString(e))return{default:()=>e};if(b(e))return{default:()=>ue(t.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const i=zt(e),o=(c,p)=>!c||!r?{}:r?.id&&Object.keys(c).length?p?{[p]:c}:{[`scope_${r.id}`]:c}:p?{[p]:Object.create(null)}:{};return Object.entries(i).reduce((c,[p,{nodes:a,params:l,scope:u}])=>(c[p]=d=>{const h=l.length?f.pick(d??{},l):o(d,u);return a.map((m,g)=>M(m,t.__clone(h),n,s,a,!1,g))},c),{})}return null}function zt(n){const e={};for(const t of n){const s=Vt(t.slot),r=s.name;e[r]?(e[r].nodes.push(t),e[r].params=e[r].params.concat(s.params),e[r].scope=s.scope||""):e[r]={nodes:[t],params:s.params,scope:s.scope||""}}return e}function Vt(n="default"){return f.isString(n)?{name:n,params:[],scope:""}:{params:[],scope:"",...n}}function Wt(n,e,t){const{value:s,iterator:r}=n,{item:i="item",index:o="index"}=r||{};let c=t.__parseExpression(s)||[];return Number.isInteger(c)&&(c=new Array(c).fill(!0).map((p,a)=>a+1)),Array.isArray(c)?c.map((p,a)=>e(t.__clone({[i]:p,[o]:a}),a)):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const re=$.defineComponent({name:"VtjPageContainer",async setup(){const n=ye(),e=Ee.useRoute(),t=e.meta.__vtj__||e.params.id,s=t?n.getPage(t):n.getHomepage(),r=s?await n.getRenderComponent(s.id):null,i=$.ref(Symbol());if(s){Object.assign(e.meta,s.meta||{},{cache:s.cache});const{useTitle:o}=n?.adapter;if(o){const c=e.meta.title||s.title||"VTJ.PRO";o(c)}}return{provider:n,component:r,file:s,query:e.query,meta:e.meta,sid:i,route:e}},render(){const{component:n,query:e,sid:t}=this;return n?$.h(n,{...e,key:t}):$.h("div",{style:{padding:"10px"}},"找不到组件,组件不存在或未发布!")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),Qt=$.defineComponent({name:"VtjStartupContainer",render(){return $.h("div","page not found!")}});function q(n,e,t=[]){const s=[];for(const r of t){const{id:i,title:o,icon:c,children:p,hidden:a,layout:l}=r;if(l){const u=q(n,e,p||[]);s.push(...u)}else{const u={id:i,title:o,icon:c,hidden:a,url:`${n}/${e}/${i}`,children:p&&p.length?q(n,e,p):void 0};s.push(u)}}return s}function _e(n,e){if(!e)return n;let t=[];for(const s of n)if(s.children&&s.children.length){const r=_e(s.children,e);r.length&&(s.children=r,t.push(s))}else e.can(s.id.toString())&&t.push(s);return t}function Yt(n){const{menuPathPrefix:e="",pageRouteName:t="page",disableMenusFilter:s=!1}=n||{},r=ye(),i=Ee.useRoute(),o=qe(),c=$.ref(!1),p=$.ref(!1),a=r.project,l=(h,m)=>{c.value=!h?.mask,p.value=m?.pure??!!h?.pure};$.watchEffect(()=>{const{name:h,params:m,meta:g}=i;if(h===D){const _=r.getPage(m.id);l(_,g)}else if(h===U){const _=r.getHomepage();l(_,g)}else{const _=g.__vtj__;if(_){const y=r.getPage(_);l(y,g)}else c.value=!g.mask,p.value=!!g.pure}});const u=q(e,t,a?.pages),d=a?.config;return{disabled:c,logo:d?.logo,themeSwitchable:d?.themeSwitchable,title:d?.title||a?.description||a?.name||"VTJ App",menus:s?u:_e(u,o),pure:p}}function ie(n,e){const{id:t,title:s,meta:r}=n,{name:i="page",prefix:o="",component:c,routeMeta:p}=e;return{name:t,path:`${o}${i}/${t}`,component:c,meta:{title:s,...p,...r,__vtj__:t}}}function ce(n){const{name:e="page",prefix:t="",pages:s=[],component:r,loader:i,routeMeta:o,homepage:c}=n,p=[];for(const a of s){const{id:l,title:u,dir:d,layout:h,children:m,meta:g}=a;if(d){const _=ce({name:e,prefix:t,component:r,routeMeta:o,homepage:c,loader:i,pages:m||[]});p.push(..._)}else if(h){const _=ce({name:e,prefix:t,component:r,routeMeta:o,homepage:c,loader:i,pages:m||[]}),y={name:`layout_${l}`,path:t,component:()=>i(l),meta:{title:u,...o,...g,__vtj__:l},children:_};p.push(y),p.push(ie(a,n))}else if(p.push(ie(a,n)),c===l){const _=ie(a,n);_.path="",_.name=`home_${l}`,p.push(_)}}return p}function Xt(n={},e){const{css:t,store:s,enhance:r}=n,{window:i,app:o,library:c={},adapter:p,mode:a}=e,{Pinia:l}=c;o.config.globalProperties.$libs=c,Q(i,"global-css",t||""),l&&s&&Zt(s,o,l),ts(o,p,n),!p.access&&n.access&&es(n.access,o,a,p),ss(o,n),r&&ns(r,o,c)}function Zt(n,e,t){const s=t.createPinia();if(e.use(s),C(n)&&n.value){const r=R(n,{},!1,!1,!0),i=t.defineStore("$store",r(e)||{});e.config.globalProperties.$store=i()}}function es(n,e,t,s){if(C(n)&&n.value){const r=R(n,{},!1,!1,!0),{alert:i,request:o}=s,c=new Y({alert:i,storagePrefix:"__VTJ_APP_",...r(e)}),p=e.config.globalProperties.$router;c.connect({mode:t,router:p,request:o}),e.use(c)}}function ts(n,e,t){if(!e.request)return;const{axios:s,request:r,response:i}=t;if(s&&C(s)&&s.value){const o=R(s,{},!1,!1,!0);e.request.setConfig(o(n))}if(r&&C(r)&&r.value){const o=R(r,{},!1,!1,!0),c=e.request;c.__unReq&&c.__unReq(),c.__unReq=e.request.useRequest(p=>o(p,n))}if(i&&C(i)&&i.value){const o=R(i,{},!1,!1,!0),c=e.request;c.__unRes&&c.__unRes(),c.__unRes=e.request.useResponse(p=>o(p,n))}}function ss(n,e){const{beforeEach:t,afterEach:s}=e,r=n.config.globalProperties.$router;if(t&&C(t)&&t.value){const i=R(t,{},!1,!1,!0);r&&r.beforeEach((o,c,p)=>i(o,c,p,n))}if(s&&C(s)&&s.value){const i=R(s,{},!1,!1,!0);r&&r.afterEach((o,c,p)=>i(o,c,p,n))}}function ns(n,e,t={}){C(n)&&n.value&&R(n,{},!1,!1,!0)(e,t)}function rs(n,e,t){if(!n||!e||!t)return;const{VueI18n:s}=e;if(s){const{locale:r,fallbackLocale:i,messages:o=[]}=t,c={};for(let a of o){const l=Object.keys(a).filter(u=>u!=="key");for(const u of l)c[u]||(c[u]={}),c[u][a.key]=a[u]}const p=s.createI18n({legacy:!1,locale:r,fallbackLocale:i,messages:c});n.use(p)}}const ve=Symbol("Provider");var et=(n=>(n.Production="production",n.Development="development",n))(et||{});class tt extends F.Base{constructor(e){super(),this.options=e;const{service:t,mode:s=S.Raw,dependencies:r,materials:i,project:o={},adapter:c={},globals:p={},modules:a={},router:l=null,materialPath:u="./",nodeEnv:d="development"}=e;this.mode=s,this.modules=a,this.service=t,this.router=l,this.materialPath=u,this.nodeEnv=d,r&&(this.dependencies=r),i&&(this.materials=i),Object.assign(this.globals,p),Object.assign(this.adapter,c);const{access:h,request:m}=this.adapter;h&&h.connect({mode:s,router:l,request:m}),o&&s!==S.Design?this.load(o):this.project=o}mode;globals={};modules={};adapter={request:f.request,jsonp:f.jsonp};apis={};dependencies={};materials={};library={};libraryLocales={};libraryLocaleMap={};service;project=null;components={};nodeEnv="development";env={};router=null;materialPath="./";urlDslCaches={};errorHandler=null;createMock(e){return async(...t)=>{let s={};if(e)try{s=await e.apply(e,t)}catch(i){f.logger.warn("模拟数据模版异常",i)}return k()?.mock(s)}}async load(e){const{vtjDir:t=".vtj"}=this.options,s=this.modules[`${t}/projects/${e.id}.json`]||this.modules[`/src/${t}/projects/${e.id}.json`];if(this.project=s?await s():await this.service.init(e),!this.project)throw new Error("project is null");const{apis:r=[],meta:i=[],env:o=[]}=this.project,c=window;c&&(c.CKEDITOR_VERSION=void 0),this.initEnv(o),this.mode===S.Raw?await this.loadDependencies(c):await this.loadAssets(c),this.initMock(c),this.apis=Ke(r,i,this.adapter),he(c),Ge(r,c),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const t=k(e);t&&t.setup({timeout:"50-500"})}async loadDependencies(e={}){const t=Object.entries(this.dependencies);for(const[s,r]of t)e[s]||(e[s]=this.library[s]=await r())}async loadAssets(e={}){const{dependencies:t=[]}=this.project,{dependencies:s,library:r,components:i,materialPath:o,nodeEnv:c,libraryLocales:p}=this,{libraryExports:a,libraryMap:l,materials:u,materialExports:d,materialMapLibrary:h,libraryLocaleMap:m}=Pe(t,o,c==="development");Object.assign(this.libraryLocaleMap,m);for(const g of a){const _=s[g],y=e[g];if(y)r[g]=y;else if(_)e[g]=r[g]=await _();else{const j=l[g]||[];for(const v of j)B(v)&&await Oe(v,f.url.append(v,{v:x})),J(v)&&await f.loadScript(f.url.append(v,{v:x}));r[g]=e[g]}const w=m[g];if(w){const j=s[w];p[w]=j?await j():e[w]}}if(c==="development"){for(const _ of u)await f.loadScript(f.url.append(_,{v:x}));const g=this.materials||{};for(const _ of d){const y=e[h[_]],w=y?.default||y,j=F.BUILT_IN_COMPONENTS[_];if(j)w&&j.forEach(v=>{i[v]=w[v]});else{const v=g[_]?(await g[_]()).default:e[_];v&&w&&(v.components||[]).forEach(A=>{i[A.name]=Ae(A,w)})}}}}initRouter(){const{router:e,project:t,options:s,adapter:r}=this;if(!e)return;const i=t?.platform==="uniapp"?"pages":"page",{routeAppendTo:o,pageRouteName:c=i,routeMeta:p}=s,a=o?"":"/",l={path:`${a}${c}/:id`,name:D,component:re},u=this.getHomepage(),d={path:a,name:U,component:u?re:r.startupComponent||Qt,meta:p};if(e.hasRoute(D)&&e.removeRoute(D),e.hasRoute(U)&&e.removeRoute(U),s.enableStaticRoute){const h=t?.pages||[];ce({name:c,prefix:a,pages:h,component:re,loader:this.getRenderComponent.bind(this),homepage:u?.id}).forEach(g=>{o?e.addRoute(o,g):e.addRoute(g)}),u||(o?e.addRoute(o,d):e.addRoute(d))}else o?(e.addRoute(o,l),e.addRoute(o,d)):(e.addRoute(l),e.addRoute(d))}setErrorHandler(e){e.config.errorHandler=f.debounce((t,s,r)=>{const i=s?.$options.name,o=typeof t=="string"?t:t?.message||t?.msg||"未知错误",c=`[ ${i} ] ${o} ${r}`;["getComputedStyle","ResizeObserver"].some(a=>c.includes(a))||(console.error("[VTJ Error]:",{err:t,instance:s,info:r},t?.stack),this.errorHandler&&this.errorHandler(t),this.adapter.notify&&this.adapter.notify(c,"组件渲染错误","error"))},300)}install(e){const{libraryLocaleMap:t,libraryLocales:s}=this,{libraryOptions:r={}}=this.options,i=e.config.globalProperties.installed||{};for(const[o,c]of Object.entries(this.library))if(!i[o]&&xe(c)){const a={locale:s[t[o]]},l=r[o]||{},u={...a,...l};e.use(c,u),i[o]=!0}e.provide(ve,this),e.config.globalProperties.$provider=this,e.config.globalProperties.$apis=this.apis,e.config.globalProperties.$request=this.adapter?.request,this.options.install&&e.use(this.options.install),this.adapter.access&&e.use(this.adapter.access),this.project?.platform!=="uniapp"&&this.mode!==S.Design&&this.initGlobals(this.project?.globals||{},{app:e,window,adapter:this.adapter,library:this.library,mode:this.mode}),this.mode!==S.Design&&this.project?.i18n&&this.initI18n(e,this.library,this.project.i18n),this.options.enhance&&e.use(this.options.enhance,this),this.mode===S.Design&&this.setErrorHandler(e),e.config.globalProperties.installed=i}getFile(e){const{blocks:t=[]}=this.project||{};return this.getPage(e)||t.find(s=>s.id===e)||null}getPage(e){const{pages:t=[]}=this.project||{},s=(r,i=[])=>{for(const o of i){if(o.id===r)return o;if(o.children&&o.children.length){const c=s(r,o.children);if(c)return c}}};return s(e,t)||null}getFirstPage(){const{pages:e=[]}=this.project||{};if(!e.length)return null;const t=(s=[])=>{for(const r of s){if(r.type==="page"&&!r.dir&&!r.layout)return r;if(r.children&&r.children.length){const i=t(r.children);if(i)return i}}};return t(e)||null}getMenus(e="page",t=""){return q(t,e,this.project?.pages||[])}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):this.getFirstPage()}async getDsl(e){const{vtjDir:t=".vtj"}=this.options,s=this.modules[`${t}/files/${e}.json`]||this.modules[`/src/${t}/files/${e}.json`];return s?await s():this.service.getFile(e,this.project||void 0).catch(()=>null)}async getDslByUrl(e){const t=this.urlDslCaches[e];return t||(this.adapter.request?this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(s=>s.data).catch(()=>null):null)}createDslRenderer(e,t={}){const{library:s,components:r,mode:i,apis:o}=this,c={mode:i,Vue:s.Vue,components:r,libs:s,apis:o,window,...t},p=V({getDsl:async a=>await this.getDsl(a)||null,getDslByUrl:async a=>await this.getDslByUrl(a)||null,options:c});return z({...c,dsl:e,loader:p})}async getRenderComponent(e,t){const s=this.getFile(e);if(!s)return f.logger.warn(`Can not find file: ${e}`),null;if(t&&t(s),this.mode===S.Raw){const{vtjRawDir:i=".vtj/vue"}=this.options,o=`${i}/${e}.vue`,c=this.modules[o]||this.modules[`/src/pages/${e}.vue`];return c?(await c())?.default:this.nodeEnv==="development"&&this.adapter.startupComponent||null}const r=await this.getDsl(s.id);return r?this.createDslRenderer(r).renderer:(f.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,t){return $.defineAsyncComponent(async()=>{const s=await this.getDslByUrl(e);return s?(s.name=t||s.name,this.createDslRenderer(s).renderer):null})}definePluginComponent(e){return $.defineAsyncComponent(async()=>await me(e,window))}initGlobals(e,t){const s=Object.assign({adapter:this.adapter,window},t);Xt(e,s)}initI18n(e,t,s){rs(e,t,s)}initEnv(e=[]){this.env=e.reduce((t,s)=>(t[s.name]=s[this.nodeEnv],t),{})}}function is(n){const e=new tt(n);return{provider:e,onReady:s=>e.ready(s)}}function ye(n={}){const e=$.inject(ve,null);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:t,version:s}=n;t&&s&&(async()=>{const r=await e.getDsl(t);r?.__VERSION__!==s&&e.adapter.notify&&e.adapter.notify(`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,"版本不一致","warning")})()}return e}async function os(n,e=""){const{name:t,urls:s=[]}=n||{},r=s.map(c=>e+c),{css:i,js:o}=Ie(r);if(i.length&&pe(i),o.length)return await fe(o,t).catch(()=>{})}const st={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:n=>n.data?.code===0},as=(n,e="/__vtj__/api/:type.json")=>(t,s,r)=>n.send({url:e,method:"post",params:{type:t},query:r,data:{type:t,data:s},settings:st}),cs=(n,e="/__vtj__/api/uploader.json")=>async(t,s)=>await n.send({url:e,method:"post",data:{files:t,projectId:s},settings:{...st,type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);function ls(n){return f.createRequest({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:e=>e.data?.code===0,showError:e=>{n&&n(e||"未知错误")}}})}class X{constructor(e=f.request){this.req=e,this.api=as(e),this.uploader=cs(e)}api;pluginCaches={};uploader;async getExtension(){console.log("BaseService.getExtension")}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e,t){return!!await this.api("saveProject",e,{type:t}).catch(()=>!1)}async saveMaterials(e,t){return console.log("BaseService.saveMaterials",e,t),!1}async saveFile(e){return console.log("BaseService.saveFile",e),!1}async getFile(e){return console.log("BaseService.getFile",e),{}}async removeFile(e){return console.log("BaseService.removeFile",e),!1}async saveHistory(e){return console.log("BaseService.saveHistory",e),!1}async removeHistory(e){return console.log("BaseService.removeHistory",e),!1}async getHistory(e){return console.log("BaseService.getHistory",e),{}}async getHistoryItem(e,t){return console.log("BaseService.getHistoryItem",e,t),{}}async saveHistoryItem(e,t){return console.log("BaseService.saveHistoryItem",e,t),!1}async removeHistoryItem(e,t){return console.log("BaseService.removeHistoryItem",e,t),!1}async publish(e){return!!await this.api("publish",e).catch(()=>!1)}async publishFile(e,t){return!!await this.api("publishFile",{project:e,file:t}).catch(()=>!1)}async genVueContent(e,t){return await this.api("genVueContent",{project:e,dsl:t}).catch(()=>"")}async parseVue(e,t){return await this.api("parseVue",{project:e,...t})}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,t){return await this.uploader(e,t).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,t){return await this.api("removeStaticFile",{name:e,projectId:t}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:t=[]}=e,s=t.filter(i=>je(i))[0];if(!s)return null;const r=this.pluginCaches[s];return r||(this.pluginCaches[s]=f.request.send({url:s,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(i=>i.data).catch(()=>null))}async genSource(e){return console.log("BaseService.genSource",e),""}}const E=new f.Storage({type:"local",expired:0,prefix:"__VTJ_"});class us extends X{init(e){const t=new F.ProjectModel(e),s=E.get(`project_${t.id}`),r=Object.assign(t.toDsl(),s||{});return E.save(`project_${t.id}`,r),Promise.resolve(r)}saveProject(e){const t=new F.ProjectModel(e);return E.save(`project_${t.id}`,t.toDsl()),Promise.resolve(!0)}saveMaterials(e,t){return E.save(`materials_${e.id}`,f.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return E.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const t=E.get(`file_${e}`);return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return E.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return E.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const t=E.get(`history_${e}`);if(t){const r=(t.items||[]).map(i=>i.id);this.removeHistoryItem(e,r),E.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const t=E.get(`history_${e}`),s=new F.HistoryModel(t||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,t){const s=E.get(`history_${e}_${t}`);return Promise.resolve(s)}saveHistoryItem(e,t){return E.save(`history_${e}_${t.id}`,t),Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{E.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class nt extends X{projects={};materials={};files={};histories={};historyItems={};init(e){const t=new F.ProjectModel(e),s=this.projects[t.id]||{},r=Object.assign(t.toDsl(),s);return this.projects[r.id]=r,Promise.resolve(r)}saveProject(e){const t=new F.ProjectModel(e);return this.projects[t.id]=t.toDsl(),Promise.resolve(!0)}saveMaterials(e,t){return e.id&&(this.materials[e.id]=f.mapToObject(t)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const t=this.files[e];return t?Promise.resolve(t):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const t=this.histories[e];if(t){const r=(t.items||[]).map(i=>i.id);this.removeHistoryItem(e,r),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const t=this.histories[e],s=new F.HistoryModel(t||{id:e});return Promise.resolve(s)}getHistoryItem(e,t){const s=`${e}_${t}`,r=this.historyItems[s]||{};return Promise.resolve(r)}saveHistoryItem(e,t){const s=`${e}_${t.id}`;return this.historyItems[s]=t,Promise.resolve(!0)}removeHistoryItem(e,t){return t.forEach(s=>{const r=`${e}_${s}`;delete this.historyItems[r]}),Promise.resolve(!0)}}let G=null;function ps(){return G||(G=new nt,G)}class fs extends X{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e,t){return!!await this.api("saveProject",e,{type:t}).catch(()=>!1)}async saveMaterials(e,t){return!!await this.api("saveMaterials",{project:e,materials:f.mapToObject(t)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const t=this.getFileCaches[e];return t||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,t){return await this.api("getHistoryItem",{fId:e,id:t}).catch(()=>null)||{}}async saveHistoryItem(e,t){return!!await this.api("saveHistoryItem",{fId:e,item:t}).catch(()=>!1)}async removeHistoryItem(e,t){return!!await this.api("removeHistoryItem",{fId:e,ids:t}).catch(()=>!1)}}exports.ACCESS=pt;exports.ACCESS_KEY=de;exports.Access=Y;exports.BUILD_IN_TAGS=be;exports.BUILT_IN_DIRECTIVES=$e;exports.BaseService=X;exports.CONTEXT_HOST=oe;exports.Context=We;exports.ContextMode=S;exports.DATA_TYPES=Ce;exports.HOMEPAGE_ROUTE_NAME=U;exports.HTML_TAGS=le;exports.JSCodeToString=vt;exports.LIFE_CYCLES_LIST=lt;exports.LocalService=fs;exports.MemoryService=nt;exports.NodeEnv=et;exports.PAGE_ROUTE_NAME=D;exports.Provider=tt;exports.REMOTE=ut;exports.StorageService=us;exports.VTJ_RENDERER_VERSION=x;exports.adoptStylesToInline=mt;exports.adoptedStyleSheets=Q;exports.clearLoaderCache=Ft;exports.compileScopedCSS=Fe;exports.convertCssRpx=Me;exports.createAccess=wt;exports.createAdapter=St;exports.createAssetScripts=ft;exports.createAssetsCss=dt;exports.createDataSources=Qe;exports.createLoader=V;exports.createMemoryService=ps;exports.createMenus=q;exports.createMetaApi=Je;exports.createMock=ze;exports.createProvider=is;exports.createRenderer=z;exports.createSchemaApi=Be;exports.createSchemaApis=Ke;exports.createServiceRequest=ls;exports.defaultLoader=Xe;exports.fillBasePath=N;exports.getMock=k;exports.getModifiers=ge;exports.getPlugin=me;exports.getRawComponent=Ae;exports.isArrowFunction=He;exports.isAssignment=Le;exports.isBuiltInTag=De;exports.isCSSUrl=B;exports.isCallFunction=Ne;exports.isJSCode=Ue;exports.isJSExpression=b;exports.isJSFunction=C;exports.isJSON=je;exports.isJSUrl=J;exports.isNativeTag=ke;exports.isVuePlugin=xe;exports.loadCss=Oe;exports.loadCssUrl=pe;exports.loadEnhance=os;exports.loadScriptUrl=fe;exports.menusFilter=_e;exports.mockApi=Ve;exports.mockApis=Ge;exports.mockCleanup=he;exports.nodeCache=O;exports.nodeRender=M;exports.parseDeps=Pe;exports.parseExpression=H;exports.parseFunction=R;exports.parseUrls=Ie;exports.providerKey=ve;exports.removeProdFlag=Re;exports.rpxToPx=Te;exports.setupPageSetting=gt;exports.toString=ue;exports.useAccess=qe;exports.useMask=Yt;exports.useProvider=ye;
|
|
28
|
+
}`:"(v) => {}"},r=i.__parseFunction(s),n=Rt(D(e.modifiers)?i.__parseExpression(e.modifiers):e.modifiers),a=D(e.arg)?i.__parseExpression(e.arg):e.arg||"modelValue";return{[a]:i.__parseExpression(e.value),[`onUpdate:${a}`]:n.length&&r?t.withModifiers(r,n):r}}function Pr(t,e,i,s,r){if(!e)return null;if(f.isString(e))return{default:()=>e};if(D(e))return{default:()=>dt(i.__parseExpression(e))};if(Array.isArray(e)&&e.length>0){const n=Tr(e),a=(u,l)=>!u||!r?{}:r?.id&&Object.keys(u).length?l?{[l]:u}:{[`scope_${r.id}`]:u}:l?{[l]:Object.create(null)}:{};return Object.entries(n).reduce((u,[l,{nodes:c,params:h,scope:p}])=>(u[l]=m=>{const d=h.length?f.pick(m??{},h):a(m,p);return c.map((g,v)=>le(g,i.__clone(d),t,s,c,!1,v))},u),{})}return null}function Tr(t){const e={};for(const i of t){const s=Nr(i.slot),r=s.name;e[r]?(e[r].nodes.push(i),e[r].params=e[r].params.concat(s.params),e[r].scope=s.scope||""):e[r]={nodes:[i],params:s.params,scope:s.scope||""}}return e}function Nr(t="default"){return f.isString(t)?{name:t,params:[],scope:""}:{params:[],scope:"",...t}}function Rr(t,e,i){const{value:s,iterator:r}=t,{item:n="item",index:a="index"}=r||{};let u=i.__parseExpression(s)||[];return Number.isInteger(u)&&(u=new Array(u).fill(!0).map((l,c)=>c+1)),Array.isArray(u)?u.map((l,c)=>e(i.__clone({[n]:l,[a]:c}),c)):(console.warn("[vForRender]:",`${s?.value} is not a Arrary`),[])}const rt=F.defineComponent({name:"VtjPageContainer",async setup(){const t=Lt(),e=zt.useRoute(),i=e.meta.__vtj__||e.params.id,s=i?t.getPage(i):t.getHomepage(),r=s?await t.getRenderComponent(s.id):null,n=F.ref(Symbol());if(s){Object.assign(e.meta,s.meta||{},{cache:s.cache});const{useTitle:a}=t?.adapter;if(a){const u=e.meta.title||s.title||"VTJ.PRO";a(u)}}return{provider:t,component:r,file:s,query:e.query,meta:e.meta,sid:n,route:e}},render(){const{component:t,query:e,sid:i}=this;return t?F.h(t,{...e,key:i}):F.h("div",{style:{padding:"10px"}},"找不到组件,组件不存在或未发布!")},activated(){this.meta.cache===!1&&(this.sid=Symbol())}}),Vr=F.defineComponent({name:"VtjStartupContainer",render(){return F.h("div","page not found!")}});function Ae(t,e,i=[]){const s=[];for(const r of i){const{id:n,title:a,icon:u,children:l,hidden:c,layout:h}=r;if(h){const p=Ae(t,e,l||[]);s.push(...p)}else{const p={id:n,title:a,icon:u,hidden:c,url:`${t}/${e}/${n}`,children:l&&l.length?Ae(t,e,l):void 0};s.push(p)}}return s}function Vt(t,e){if(!e)return t;let i=[];for(const s of t)if(s.children&&s.children.length){const r=Vt(s.children,e);r.length&&(s.children=r,i.push(s))}else e.can(s.id.toString())&&i.push(s);return i}function Or(t){const{menuPathPrefix:e="",pageRouteName:i="page",disableMenusFilter:s=!1}=t||{},r=Lt(),n=zt.useRoute(),a=$i(),u=F.ref(!1),l=F.ref(!1),c=r.project,h=(d,g)=>{u.value=!d?.mask,l.value=g?.pure??!!d?.pure};F.watchEffect(()=>{const{name:d,params:g,meta:v}=n;if(d===xe){const y=r.getPage(g.id);h(y,v)}else if(d===Ce){const y=r.getHomepage();h(y,v)}else{const y=v.__vtj__;if(y){const k=r.getPage(y);h(k,v)}else u.value=!v.mask,l.value=!!v.pure}});const p=Ae(e,i,c?.pages),m=c?.config;return{disabled:u,logo:m?.logo,themeSwitchable:m?.themeSwitchable,title:m?.title||c?.description||c?.name||"VTJ App",menus:s?p:Vt(p,a),pure:l}}function nt(t,e){const{id:i,title:s,meta:r}=t,{name:n="page",prefix:a="",component:u,routeMeta:l}=e;return{name:i,path:`${a}${n}/${i}`,component:u,meta:{title:s,...l,...r,__vtj__:i}}}function pt(t){const{name:e="page",prefix:i="",pages:s=[],component:r,loader:n,routeMeta:a,homepage:u}=t,l=[];for(const c of s){const{id:h,title:p,dir:m,layout:d,children:g,meta:v}=c;if(m){const y=pt({name:e,prefix:i,component:r,routeMeta:a,homepage:u,loader:n,pages:g||[]});l.push(...y)}else if(d){const y=pt({name:e,prefix:i,component:r,routeMeta:a,homepage:u,loader:n,pages:g||[]}),k={name:`layout_${h}`,path:i,component:()=>n(h),meta:{title:p,...a,...v,__vtj__:h},children:y};l.push(k),l.push(nt(c,t))}else if(l.push(nt(c,t)),u===h){const y=nt(c,t);y.path="",y.name=`home_${h}`,l.push(y)}}return l}function Lr(t={},e){const{css:i,store:s,enhance:r}=t,{window:n,app:a,library:u={},adapter:l,mode:c}=e,{Pinia:h}=u;a.config.globalProperties.$libs=u,He(n,"global-css",i||""),h&&s&&Fr(s,a,h),Mr(a,l,t),!l.access&&t.access&&jr(t.access,a,c,l),Dr(a,t),r&&Br(r,a,u)}function Fr(t,e,i){const s=i.createPinia();if(e.use(s),M(t)&&t.value){const r=G(t,{},!1,!1,!0),n=i.defineStore("$store",r(e)||{});e.config.globalProperties.$store=n()}}function jr(t,e,i,s){if(M(t)&&t.value){const r=G(t,{},!1,!1,!0),{alert:n,request:a}=s,u=new Ke({alert:n,storagePrefix:"__VTJ_APP_",...r(e)}),l=e.config.globalProperties.$router;u.connect({mode:i,router:l,request:a}),e.use(u)}}function Mr(t,e,i){if(!e.request)return;const{axios:s,request:r,response:n}=i;if(s&&M(s)&&s.value){const a=G(s,{},!1,!1,!0);e.request.setConfig(a(t))}if(r&&M(r)&&r.value){const a=G(r,{},!1,!1,!0),u=e.request;u.__unReq&&u.__unReq(),u.__unReq=e.request.useRequest(l=>a(l,t))}if(n&&M(n)&&n.value){const a=G(n,{},!1,!1,!0),u=e.request;u.__unRes&&u.__unRes(),u.__unRes=e.request.useResponse(l=>a(l,t))}}function Dr(t,e){const{beforeEach:i,afterEach:s}=e,r=t.config.globalProperties.$router;if(i&&M(i)&&i.value){const n=G(i,{},!1,!1,!0);r&&r.beforeEach((a,u,l)=>n(a,u,l,t))}if(s&&M(s)&&s.value){const n=G(s,{},!1,!1,!0);r&&r.afterEach((a,u,l)=>n(a,u,l,t))}}function Br(t,e,i={}){M(t)&&t.value&&G(t,{},!1,!1,!0)(e,i)}function Hr(t,e,i){if(!t||!e||!i)return;const{VueI18n:s}=e;if(s){const{locale:r,fallbackLocale:n,messages:a=[]}=i,u={};for(let c of a){const h=Object.keys(c).filter(p=>p!=="key");for(const p of h)u[p]||(u[p]={}),u[p][c.key]=c[p]}const l=s.createI18n({legacy:!1,locale:r,fallbackLocale:n,messages:u});t.use(l)}}const Ot=Symbol("Provider");var ts=(t=>(t.Production="production",t.Development="development",t))(ts||{});class is extends re.Base{constructor(e){super(),this.options=e;const{service:i,mode:s=T.Raw,dependencies:r,materials:n,project:a={},adapter:u={},globals:l={},modules:c={},router:h=null,materialPath:p="./",nodeEnv:m="development"}=e;this.mode=s,this.modules=c,this.service=i,this.router=h,this.materialPath=p,this.nodeEnv=m,r&&(this.dependencies=r),n&&(this.materials=n),Object.assign(this.globals,l),Object.assign(this.adapter,u);const{access:d,request:g}=this.adapter;d&&d.connect({mode:s,router:h,request:g}),a&&s!==T.Design?this.load(a):this.project=a}mode;globals={};modules={};adapter={request:f.request,jsonp:f.jsonp};apis={};dependencies={};materials={};library={};libraryLocales={};libraryLocaleMap={};service;project=null;components={};nodeEnv="development";env={};router=null;materialPath="./";urlDslCaches={};errorHandler=null;createMock(e){return async(...i)=>{let s={};if(e)try{s=await e.apply(e,i)}catch(n){f.logger.warn("模拟数据模版异常",n)}return ve()?.mock(s)}}async load(e){const{vtjDir:i=".vtj"}=this.options,s=this.modules[`${i}/projects/${e.id}.json`]||this.modules[`/src/${i}/projects/${e.id}.json`];if(this.project=s?await s():await this.service.init(e),!this.project)throw new Error("project is null");const{apis:r=[],meta:n=[],env:a=[]}=this.project,u=window;u&&(u.CKEDITOR_VERSION=void 0),this.initEnv(a),this.mode===T.Raw?await this.loadDependencies(u):await this.loadAssets(u),this.initMock(u),this.apis=Wi(r,n,this.adapter),Tt(u),zi(r,u),e.platform!=="uniapp"&&this.initRouter(),this.triggerReady()}initMock(e){const i=ve(e);i&&i.setup({timeout:"50-500"})}async loadDependencies(e={}){const i=Object.entries(this.dependencies);for(const[s,r]of i)e[s]||(e[s]=this.library[s]=await r())}async loadAssets(e={}){const{dependencies:i=[]}=this.project,{dependencies:s,library:r,components:n,materialPath:a,nodeEnv:u,libraryLocales:l}=this,{libraryExports:c,libraryMap:h,materials:p,materialExports:m,materialMapLibrary:d,libraryLocaleMap:g}=Zt(i,a,u==="development");Object.assign(this.libraryLocaleMap,g);for(const v of c){const y=s[v],k=e[v];if(k)r[v]=k;else if(y)e[v]=r[v]=await y();else{const O=h[v]||[];for(const E of O)Pe(E)&&await ni(E,f.url.append(E,{v:ge})),Te(E)&&await f.loadScript(f.url.append(E,{v:ge}));r[v]=e[v]}const P=g[v];if(P){const O=s[P];l[P]=O?await O():e[P]}}if(u==="development"){for(const y of p)await f.loadScript(f.url.append(y,{v:ge}));const v=this.materials||{};for(const y of m){const k=e[d[y]],P=k?.default||k,O=re.BUILT_IN_COMPONENTS[y];if(O)P&&O.forEach(E=>{n[E]=P[E]});else{const E=v[y]?(await v[y]()).default:e[y];E&&P&&(E.components||[]).forEach(Y=>{n[Y.name]=ei(Y,P)})}}}}initRouter(){const{router:e,project:i,options:s,adapter:r}=this;if(!e)return;const n=i?.platform==="uniapp"?"pages":"page",{routeAppendTo:a,pageRouteName:u=n,routeMeta:l}=s,c=a?"":"/",h={path:`${c}${u}/:id`,name:xe,component:rt},p=this.getHomepage(),m={path:c,name:Ce,component:p?rt:r.startupComponent||Vr,meta:l};if(e.hasRoute(xe)&&e.removeRoute(xe),e.hasRoute(Ce)&&e.removeRoute(Ce),s.enableStaticRoute){const d=i?.pages||[];pt({name:u,prefix:c,pages:d,component:rt,loader:this.getRenderComponent.bind(this),homepage:p?.id}).forEach(v=>{a?e.addRoute(a,v):e.addRoute(v)}),p||(a?e.addRoute(a,m):e.addRoute(m))}else a?(e.addRoute(a,h),e.addRoute(a,m)):(e.addRoute(h),e.addRoute(m))}setErrorHandler(e){e.config.errorHandler=f.debounce((i,s,r)=>{const n=s?.$options.name,a=typeof i=="string"?i:i?.message||i?.msg||"未知错误",u=`[ ${n} ] ${a} ${r}`;["getComputedStyle","ResizeObserver"].some(c=>u.includes(c))||(console.error("[VTJ Error]:",{err:i,instance:s,info:r},i?.stack),this.errorHandler&&this.errorHandler(i),this.adapter.notify&&this.adapter.notify(u,"组件渲染错误","error"))},300)}install(e){const{libraryLocaleMap:i,libraryLocales:s}=this,{libraryOptions:r={}}=this.options,n=e.config.globalProperties.installed||{};for(const[a,u]of Object.entries(this.library))if(!n[a]&&ai(u)){const c={locale:s[i[a]]},h=r[a]||{},p={...c,...h};e.use(u,p),n[a]=!0}e.provide(Ot,this),e.config.globalProperties.$provider=this,e.config.globalProperties.$apis=this.apis,e.config.globalProperties.$request=this.adapter?.request,this.options.install&&e.use(this.options.install),this.adapter.access&&e.use(this.adapter.access),this.project?.platform!=="uniapp"&&this.mode!==T.Design&&this.initGlobals(this.project?.globals||{},{app:e,window,adapter:this.adapter,library:this.library,mode:this.mode}),this.mode!==T.Design&&this.project?.i18n&&this.initI18n(e,this.library,this.project.i18n),this.options.enhance&&e.use(this.options.enhance,this),this.mode===T.Design&&this.setErrorHandler(e),e.config.globalProperties.installed=n}getFile(e){const{blocks:i=[]}=this.project||{};return this.getPage(e)||i.find(s=>s.id===e)||null}getPage(e){const{pages:i=[]}=this.project||{},s=(r,n=[])=>{for(const a of n){if(a.id===r)return a;if(a.children&&a.children.length){const u=s(r,a.children);if(u)return u}}};return s(e,i)||null}getFirstPage(){const{pages:e=[]}=this.project||{};if(!e.length)return null;const i=(s=[])=>{for(const r of s){if(r.type==="page"&&!r.dir&&!r.layout)return r;if(r.children&&r.children.length){const n=i(r.children);if(n)return n}}};return i(e)||null}getMenus(e="page",i=""){return Ae(i,e,this.project?.pages||[])}getHomepage(){const{homepage:e}=this.project||{};return e?this.getPage(e):this.getFirstPage()}async getDsl(e){const{vtjDir:i=".vtj"}=this.options,s=this.modules[`${i}/files/${e}.json`]||this.modules[`/src/${i}/files/${e}.json`];return s?await s():this.service.getFile(e,this.project||void 0).catch(()=>null)}async getDslByUrl(e){const i=this.urlDslCaches[e];return i||(this.adapter.request?this.urlDslCaches[e]=this.adapter.request.send({url:e,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(s=>s.data).catch(()=>null):null)}createDslRenderer(e,i={}){const{library:s,components:r,mode:n,apis:a}=this,u={mode:n,Vue:s.Vue,components:r,libs:s,apis:a,window,...i},l=De({getDsl:async c=>await this.getDsl(c)||null,getDslByUrl:async c=>await this.getDslByUrl(c)||null,options:u});return Me({...u,dsl:e,loader:l})}async getRenderComponent(e,i){const s=this.getFile(e);if(!s)return f.logger.warn(`Can not find file: ${e}`),null;if(i&&i(s),this.mode===T.Raw){const{vtjRawDir:n=".vtj/vue"}=this.options,a=`${n}/${e}.vue`,u=this.modules[a]||this.modules[`/src/pages/${e}.vue`];return u?(await u())?.default:this.nodeEnv==="development"&&this.adapter.startupComponent||null}const r=await this.getDsl(s.id);return r?this.createDslRenderer(r).renderer:(f.logger.warn(`Can not find dsl: ${e}`),null)}defineUrlSchemaComponent(e,i){return F.defineAsyncComponent(async()=>{const s=await this.getDslByUrl(e);return s?(s.name=i||s.name,this.createDslRenderer(s).renderer):null})}definePluginComponent(e){return F.defineAsyncComponent(async()=>await Nt(e,window))}initGlobals(e,i){const s=Object.assign({adapter:this.adapter,window},i);Lr(e,s)}initI18n(e,i,s){Hr(e,i,s)}initEnv(e=[]){this.env=e.reduce((i,s)=>(i[s.name]=s[this.nodeEnv],i),{})}}function Ur(t){const e=new is(t);return{provider:e,onReady:s=>e.ready(s)}}function Lt(t={}){const e=F.inject(Ot,null);if(!e)throw new Error("Can not find provider");if(e.nodeEnv==="development"){const{id:i,version:s}=t;i&&s&&(async()=>{const r=await e.getDsl(i);r?.__VERSION__!==s&&e.adapter.notify&&e.adapter.notify(`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,"版本不一致","warning")})()}return e}async function $r(t,e=""){const{name:i,urls:s=[]}=t||{},r=s.map(u=>e+u),{css:n,js:a}=ti(r);if(n.length&&mt(n),a.length)return await gt(a,i).catch(()=>{})}const ss={type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:t=>t.data?.code===0},Gr=(t,e="/__vtj__/api/:type.json")=>(i,s,r)=>t.send({url:e,method:"post",params:{type:i},query:r,data:{type:i,data:s},settings:ss}),qr=(t,e="/__vtj__/api/uploader.json")=>async(i,s)=>await t.send({url:e,method:"post",data:{files:i,projectId:s},settings:{...ss,type:"data"}}).then(r=>r&&r[0]?r[0]:null).catch(()=>null);function Wr(t){return f.createRequest({settings:{type:"json",validSuccess:!0,originResponse:!1,failMessage:!0,validate:e=>e.data?.code===0,showError:e=>{t&&t(e||"未知错误")}}})}class Je{constructor(e=f.request){this.req=e,this.api=Gr(e),this.uploader=qr(e)}api;pluginCaches={};uploader;async getExtension(){console.log("BaseService.getExtension")}async init(e){return console.log("BaseService.init",e),{}}async saveProject(e,i){return!!await this.api("saveProject",e,{type:i}).catch(()=>!1)}async saveMaterials(e,i){return console.log("BaseService.saveMaterials",e,i),!1}async saveFile(e){return console.log("BaseService.saveFile",e),!1}async getFile(e){return console.log("BaseService.getFile",e),{}}async removeFile(e){return console.log("BaseService.removeFile",e),!1}async saveHistory(e){return console.log("BaseService.saveHistory",e),!1}async removeHistory(e){return console.log("BaseService.removeHistory",e),!1}async getHistory(e){return console.log("BaseService.getHistory",e),{}}async getHistoryItem(e,i){return console.log("BaseService.getHistoryItem",e,i),{}}async saveHistoryItem(e,i){return console.log("BaseService.saveHistoryItem",e,i),!1}async removeHistoryItem(e,i){return console.log("BaseService.removeHistoryItem",e,i),!1}async publish(e){return!!await this.api("publish",e).catch(()=>!1)}async publishFile(e,i){return!!await this.api("publishFile",{project:e,file:i}).catch(()=>!1)}async genVueContent(e,i){return await this.api("genVueContent",{project:e,dsl:i}).catch(()=>"")}async parseVue(e,i){return await this.api("parseVue",{project:e,...i})}async createRawPage(e){return await this.api("createRawPage",e).catch(()=>"")}async removeRawPage(e){return await this.api("removeRawPage",e).catch(()=>"")}async uploadStaticFile(e,i){return await this.uploader(e,i).catch(()=>null)}async getStaticFiles(e){return await this.api("getStaticFiles",e).catch(()=>[])}async removeStaticFile(e,i){return await this.api("removeStaticFile",{name:e,projectId:i}).catch(()=>"")}async clearStaticFiles(e){return await this.api("clearStaticFiles",e).catch(()=>"")}async getPluginMaterial(e){const{urls:i=[]}=e,s=i.filter(n=>Yt(n))[0];if(!s)return null;const r=this.pluginCaches[s];return r||(this.pluginCaches[s]=f.request.send({url:s,method:"get",settings:{validSuccess:!1,originResponse:!0}}).then(n=>n.data).catch(()=>null))}async genSource(e){return console.log("BaseService.genSource",e),""}}const L=new f.Storage({type:"local",expired:0,prefix:"__VTJ_"});class zr extends Je{init(e){const i=new re.ProjectModel(e),s=L.get(`project_${i.id}`),r=Object.assign(i.toDsl(),s||{});return L.save(`project_${i.id}`,r),Promise.resolve(r)}saveProject(e){const i=new re.ProjectModel(e);return L.save(`project_${i.id}`,i.toDsl()),Promise.resolve(!0)}saveMaterials(e,i){return L.save(`materials_${e.id}`,f.mapToObject(i)),Promise.resolve(!0)}saveFile(e){return L.save(`file_${e.id}`,e),Promise.resolve(!0)}getFile(e){const i=L.get(`file_${e}`);return i?Promise.resolve(i):Promise.reject(null)}removeFile(e){return L.remove(`file_${e}`),Promise.resolve(!0)}saveHistory(e){return L.save(`history_${e.id}`,e),Promise.resolve(!0)}removeHistory(e){const i=L.get(`history_${e}`);if(i){const r=(i.items||[]).map(n=>n.id);this.removeHistoryItem(e,r),L.remove(`history_${e}`)}return Promise.resolve(!0)}getHistory(e){const i=L.get(`history_${e}`),s=new re.HistoryModel(i||{id:e});return Promise.resolve(s.toDsl())}getHistoryItem(e,i){const s=L.get(`history_${e}_${i}`);return Promise.resolve(s)}saveHistoryItem(e,i){return L.save(`history_${e}_${i.id}`,i),Promise.resolve(!0)}removeHistoryItem(e,i){return i.forEach(s=>{L.remove(`history_${e}_${s}`)}),Promise.resolve(!0)}}class rs extends Je{projects={};materials={};files={};histories={};historyItems={};init(e){const i=new re.ProjectModel(e),s=this.projects[i.id]||{},r=Object.assign(i.toDsl(),s);return this.projects[r.id]=r,Promise.resolve(r)}saveProject(e){const i=new re.ProjectModel(e);return this.projects[i.id]=i.toDsl(),Promise.resolve(!0)}saveMaterials(e,i){return e.id&&(this.materials[e.id]=f.mapToObject(i)),Promise.resolve(!0)}saveFile(e){return this.files[e.id]=e,Promise.resolve(!0)}getFile(e){const i=this.files[e];return i?Promise.resolve(i):Promise.reject(null)}removeFile(e){return delete this.files[e],Promise.resolve(!0)}saveHistory(e){return this.histories[e.id]=e,Promise.resolve(!0)}removeHistory(e){const i=this.histories[e];if(i){const r=(i.items||[]).map(n=>n.id);this.removeHistoryItem(e,r),delete this.historyItems[e]}return Promise.resolve(!0)}getHistory(e){const i=this.histories[e],s=new re.HistoryModel(i||{id:e});return Promise.resolve(s)}getHistoryItem(e,i){const s=`${e}_${i}`,r=this.historyItems[s]||{};return Promise.resolve(r)}saveHistoryItem(e,i){const s=`${e}_${i.id}`;return this.historyItems[s]=i,Promise.resolve(!0)}removeHistoryItem(e,i){return i.forEach(s=>{const r=`${e}_${s}`;delete this.historyItems[r]}),Promise.resolve(!0)}}let Le=null;function Kr(){return Le||(Le=new rs,Le)}class Jr extends Je{getFileCaches={};async getExtension(){return await this.api("getExtension",{}).catch(()=>{})}async init(e){return await this.api("init",e).catch(()=>null)||{}}async saveProject(e,i){return!!await this.api("saveProject",e,{type:i}).catch(()=>!1)}async saveMaterials(e,i){return!!await this.api("saveMaterials",{project:e,materials:f.mapToObject(i)}).catch(()=>!1)}async saveFile(e){return!!await this.api("saveFile",e).catch(()=>!1)}async getFile(e){const i=this.getFileCaches[e];return i||(this.getFileCaches[e]=this.api("getFile",e).catch(()=>null)).finally(()=>{delete this.getFileCaches[e]})}async removeFile(e){return!!await this.api("removeFile",e).catch(()=>!1)}async saveHistory(e){return!!await this.api("saveHistory",e).catch(()=>!1)}async removeHistory(e){return!!await this.api("removeHistory",e).catch(()=>!1)}async getHistory(e){return await this.api("getHistory",e).catch(()=>null)||{}}async getHistoryItem(e,i){return await this.api("getHistoryItem",{fId:e,id:i}).catch(()=>null)||{}}async saveHistoryItem(e,i){return!!await this.api("saveHistoryItem",{fId:e,item:i}).catch(()=>!1)}async removeHistoryItem(e,i){return!!await this.api("removeHistoryItem",{fId:e,ids:i}).catch(()=>!1)}}exports.ACCESS=ps;exports.ACCESS_KEY=Pt;exports.Access=Ke;exports.BUILD_IN_TAGS=Qt;exports.BUILT_IN_DIRECTIVES=Kt;exports.BaseService=Je;exports.CONTEXT_HOST=at;exports.Context=Qi;exports.ContextMode=T;exports.DATA_TYPES=Jt;exports.HOMEPAGE_ROUTE_NAME=Ce;exports.HTML_TAGS=ft;exports.JSCodeToString=tr;exports.LIFE_CYCLES_LIST=ls;exports.LocalService=Jr;exports.MemoryService=rs;exports.NodeEnv=ts;exports.PAGE_ROUTE_NAME=xe;exports.Provider=is;exports.REMOTE=hs;exports.StorageService=zr;exports.VTJ_RENDERER_VERSION=ge;exports.adoptStylesToInline=gs;exports.adoptedStyleSheets=He;exports.clearLoaderCache=dr;exports.compileScopedCSS=ii;exports.convertCssRpx=ri;exports.createAccess=rr;exports.createAdapter=sr;exports.createAssetScripts=fs;exports.createAssetsCss=ds;exports.createDataSources=Yi;exports.createLoader=De;exports.createMemoryService=Kr;exports.createMenus=Ae;exports.createMetaApi=qi;exports.createMock=Ki;exports.createProvider=Ur;exports.createRenderer=Me;exports.createSchemaApi=Gi;exports.createSchemaApis=Wi;exports.createServiceRequest=Wr;exports.defaultLoader=Zi;exports.fillBasePath=_e;exports.getMock=ve;exports.getModifiers=Rt;exports.getPlugin=Nt;exports.getRawComponent=ei;exports.isArrowFunction=ci;exports.isAssignment=hi;exports.isBuiltInTag=oi;exports.isCSSUrl=Pe;exports.isCallFunction=li;exports.isJSCode=Ui;exports.isJSExpression=D;exports.isJSFunction=M;exports.isJSON=Yt;exports.isJSUrl=Te;exports.isNativeTag=ui;exports.isVuePlugin=ai;exports.loadCss=ni;exports.loadCssUrl=mt;exports.loadEnhance=$r;exports.loadScriptUrl=gt;exports.menusFilter=Vt;exports.mockApi=Ji;exports.mockApis=zi;exports.mockCleanup=Tt;exports.nodeCache=me;exports.nodeRender=le;exports.parseDeps=Zt;exports.parseExpression=be;exports.parseFunction=G;exports.parseUrls=ti;exports.providerKey=Ot;exports.removeProdFlag=Xt;exports.rpxToPx=si;exports.setupPageSetting=xs;exports.toString=dt;exports.useAccess=$i;exports.useMask=Or;exports.useProvider=Lt;
|