@veypi/vhtml 0.7.4
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/LICENSE +73 -0
- package/README.md +605 -0
- package/dist/vhtml.js +5798 -0
- package/dist/vhtml.min.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t;t=function(){const t=new class{constructor(){this.scopeAttribute="",this.scopeBody="",this.scopedKeyframes=new Map}parse(t,e){return this.scopeAttribute=`[vrefof="${e}"]`,this.scopeBody=`[vref="${e}"]`,this.scopedKeyframes.clear(),this.scopeSuffix=e.replace(/[^a-zA-Z0-9]/g,""),t=this.removeComments(t),this.collectKeyframes(t),this.parseRules(t)}collectKeyframes(t){const e=/@keyframes\s+([^\s{]+)/gi;let n;for(;null!==(n=e.exec(t));){const t=n[1],e=t+"-"+this.scopeSuffix;this.scopedKeyframes.set(t,e)}}removeComments(t){return t.replace(/\/\*[\s\S]*?\*\//g,"")}parseRules(t){let e="",n=0;for(;n<t.length;){for(;n<t.length&&/\s/.test(t[n]);)e+=t[n],n++;if(n>=t.length)break;if("@"===t[n]){const r=this.parseAtRule(t,n);e+=r.content,n=r.endIndex}else{const r=this.parseNormalRule(t,n);e+=r.content,n=r.endIndex}}return e}parseAtRule(t,e){let n=e,r="";for(;n<t.length&&"{"!==t[n];)r+=t[n],n++;if(n>=t.length)return{content:r,endIndex:n};const o=r.toLowerCase().trim();if(o.startsWith("@keyframes"))return this.parseKeyframes(t,e);if(o.startsWith("@media"))return this.parseMedia(t,e);if(o.startsWith("@supports"))return this.parseSupports(t,e);{const e=this.findMatchingBrace(t,n);return{content:r+e.content,endIndex:e.endIndex}}}parseKeyframes(t,e){let n=e,r="";for(;n<t.length&&"{"!==t[n];)r+=t[n],n++;if(n>=t.length)return{content:r,endIndex:n};const o=this.findMatchingBrace(t,n),i=o.content,s=this.extractKeyframeName(r),c=this.scopedKeyframes.get(s);return c&&(r=r.replace(s,c)),r+=i,{content:r,endIndex:o.endIndex}}extractKeyframeName(t){const e=t.match(/@keyframes\s+([^\s{]+)/i);return e?e[1]:""}parseMedia(t,e){let n=e,r="";for(;n<t.length&&"{"!==t[n];)r+=t[n],n++;if(n>=t.length)return{content:r,endIndex:n};r+="{",n++;let o=1,i="";for(;n<t.length&&o>0;){if("{"===t[n])o++;else if("}"===t[n]&&(o--,0===o))break;i+=t[n],n++}return r+=this.parseRules(i),n<t.length&&"}"===t[n]&&(r+="}",n++),{content:r,endIndex:n}}parseSupports(t,e){return this.parseMedia(t,e)}parseNormalRule(t,e){let n=e,r="";for(;n<t.length&&"{"!==t[n];)r+=t[n],n++;if(n>=t.length)return{content:r,endIndex:n};const o=this.addScopeToSelector(r.trim()),i=this.findMatchingBrace(t,n);return{content:o+this.processRuleContent(i.content),endIndex:i.endIndex}}processRuleContent(t){let e=t;return e=e.replace(/animation\s*:\s*([^;]+);/gi,((t,e)=>`animation: ${this.processAnimationValue(e)};`)),e=e.replace(/animation-name\s*:\s*([^;]+);/gi,((t,e)=>`animation-name: ${this.processAnimationNames(e)};`)),e}processAnimationValue(t){return t.split(",").map((t=>t.trim())).map((t=>{const e=t.split(/\s+/);for(let n=0;n<e.length;n++){const t=e[n];if(/^\d+(\.\d+)?(s|ms)$/.test(t))continue;if(/^\d+(\.\d+)?$/.test(t))continue;if(["ease","ease-in","ease-out","ease-in-out","linear","infinite","normal","reverse","alternate","alternate-reverse","forwards","backwards","both","running","paused"].includes(t))continue;if(t.startsWith("cubic-bezier("))continue;const r=this.scopedKeyframes.get(t);r&&(e[n]=r);break}return e.join(" ")})).join(", ")}processAnimationNames(t){return t.split(",").map((t=>{const e=t.trim();return this.scopedKeyframes.get(e)||e})).join(", ")}addScopeToSelector(t){return t.trim()?t.split(",").map((t=>t.trim())).map((t=>this.addScopeToSingleSelector(t))).join(", "):t}addScopeToSingleSelector(t){if(!t.trim())return t;if(t.includes("::")){const e=t.split("::"),n=e[0],r="::"+e.slice(1).join("::");return this.addScopeToSelectorPart(n)+r}if(t.includes(":")&&!t.includes("::")){const e=t.match(/^([^:]+)(:.+)$/);if(e){const t=e[1],n=e[2];return this.addScopeToSelectorPart(t)+n}}return"*"===t||t.startsWith("@")?t:this.addScopeToSelectorPart(t)}addScopeToSelectorPart(t){const e=/(\s*[>+~]\s*|\s+)/;if(e.test(t)){const n=t.split(e);if(/^body(?:$|[:\[ ])/.test(n[0]))return n[0]=this.scopeBody+n[0].slice(4),n.join("");if(/^:root(?:$|[:\[ ])/.test(n[0]))return n[0]=this.scopeBody+n[0].slice(5),n.join("");for(let t=n.length-1;t>=0;t--)if(n[t].trim()&&!e.test(n[t])){let e=n[t].trim();n[t]=/^body(?:$|[:\[ ])/.test(e)?this.scopeBody+e.slice(4):/^:root(?:$:[$:\[ ])/.test(e)?this.scopeBody+e.slice(5):n[t].trim()+this.scopeAttribute;break}return n.join("")}let n=(t=t.trim()).trim();return/^body(?:$|[:\[ ])/.test(n)?this.scopeBody+n.slice(4):/^:root(?:$:[$:\[ ])/.test(n)?this.scopeBody+n.slice(5):n+this.scopeAttribute}findMatchingBrace(t,e){let n=e,r="",o=0;for(;n<t.length;){if(r+=t[n],"{"===t[n])o++;else if("}"===t[n]&&(o--,0===o)){n++;break}n++}return{content:r,endIndex:n}}},e=[],n=[];let r=!1;const o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(window):t=>setTimeout(t,16),i=()=>{r=!1;const t=new Set(n.splice(0));let o=0;for(const n of t)e[n]&&(e[n](),o++);return o},s=()=>{r||(r=!0,o(i))};function c(){return`${performance.now().toString(36)}-${Math.random().toString(36).substring(2,5)}`}function u(t,e=new Set){if(t&&"object"==typeof t&&!e.has(t)){e.add(t);for(let n in t)u(t[n],e)}return t}window.$vupdate=t=>{"function"==typeof e[t]&&e[t]()};var a=[];const l=Symbol("isProxy"),f=Symbol("DataID"),h=Symbol("bind"),d=Symbol("root");function p(t,e){t[d]=e}function m(t){return!(!t||"object"!=typeof t||t instanceof Node||t instanceof Date||t instanceof RegExp||t instanceof Event||t.o||t.constructor!==Object&&t.constructor!==Array)}function y(t,e){if(!t||!t[l]||!m(e))return e;let n=t[h];if(!e[l]){if(Array.isArray(e)&&Array.isArray(t)){t.length=0;for(let n=0;n<e.length;n++)t.push(e[n]);return t}return Object.keys(t).forEach((n=>{e.hasOwnProperty(n)||delete t[n]})),Object.keys(e).forEach((n=>{t[n]?.[l]?t[n]=y(t[n],e[n]):t[n]=e[n]})),t}if(e[f]===t[f])return e;for(let r in n)if(e[h][r]?.indexOf){const t=e[h][r],o=new Set(t);for(let e of n[r])o.has(e)||(t.push(e),o.add(e))}else e[h][r]=n[r];for(let r in e)r in t&&t[r]?.[l]&&(e[r]=y(t[r],e[r]));return e}const w={console,window,prompt:prompt.bind(window),alert:alert.bind(window),confirm:confirm.bind(window),RegExp,document,Array,Object,Math,Date,JSON,Symbol,Number,eval,isNaN,parseInt,parseFloat,setTimeout:setTimeout.bind(window),setInterval:setInterval.bind(window),clearTimeout:clearTimeout.bind(window),clearInterval:clearInterval.bind(window),encodeURIComponent,btoa:btoa.bind(window),fetch:fetch.bind(window),TextDecoder,history,requestAnimationFrame:requestAnimationFrame.bind(window),getComputedStyle:getComputedStyle.bind(window)};function b(t,e={},n={}){const r=e||{},o=n||{},i=r?.$sys||null,s=r?.$ctx||null,c=r?.$mod||null,u=new Proxy(t,{has:(t,e)=>!0,get(e,n,r){let u;return"$data"===n?u=t:"$sys"===n?u=i:"$ctx"===n?u=s:"$mod"===n?u=c:i&&n in i?u=i[n]:n in e?u=Reflect.get(e,n,r):s&&n in s?u=s[n]:c&&n in c?u=c[n]:o&&n in o?u=o[n]:n in w?u=w[n]:n in window&&(u=window[n]),u},set:(t,e,n,r)=>Reflect.set(t,e,n,r)});return u}const v=new Map;function g(t,e,n,r={}){let o=e.get(t);if(o)return o;let i=t.trim();const s=i.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,"").trim(),c=/^(var|let|const|if|for|while|switch|try|throw|class|function|return|debugger)\b/.test(s),u=-1===i.indexOf("\n");!1!==r.returnExpression&&!c&&u&&(i="return "+i);const a=`\nwith (sandbox) {\n${i}\n}`;try{return o=n(a),e.set(t,o),o}catch(l){return null}}const x=Object.getPrototypeOf((async function(){})).constructor,R=new Map,O={Wrap:function t(r,o=void 0){const i=c();let u=!1;"[object Array]"==={}.toString.call(r)&&(u=!0),o&&p(r,o),r[f]=i;const w={},b={get(e,n,r){if(n===f)return i;if(n===l)return!0;if(n===h)return w;const o=Reflect.has(e,n),s=Reflect.get(e,n,r);if(!o&&e[d]&&n in e[d])return e[d][n];if("function"==typeof s)return s;let c=-1;if(a.length>0){let t=n;c=a[a.length-1],u&&(t=""),w.hasOwnProperty(t)?-1==w[t].indexOf(c)&&w[t].push(c):w[t]=[c]}if(m(s)&&!s[l]){let o=t(s,void 0);return Reflect.set(e,n,o,r),o}return s},set(t,r,o,i){const c=Reflect.get(t,r,i);if(c===o)return!0;let f=!0;if(Array.isArray(o)&&Array.isArray(c)){c.length=0;for(let t=0;t<o.length;t++)c.push(o[t])}else c&&c[l]&&m(o)?(o=y(c,o),f=Reflect.set(t,r,o,i)):f=Reflect.set(t,r,o,i);if(f&&0===a.length){let t=r;if(u&&(t=""),w[t]){let r=0;for(;r<w[t].length;){let o=w[t][r];e[o]?(r++,n.push(o),s()):w[t].splice(r,1)}}}return f},has:(t,e)=>!!Reflect.has(t,e)||!(!t[d]||!(e in t[d])),deleteProperty(t,r){const o=Reflect.deleteProperty(t,r);if(o&&0===a.length){let t=r;if(u&&(t=""),w[t]){let r=0;for(;r<w[t].length;){let o=w[t][r];e[o]?(r++,n.push(o),s()):w[t].splice(r,1)}}}return o}};return new Proxy(r,b)},Watch:function(t,n,r){let o=e.length;const i=()=>{a.push(o);try{const e=t();return r&&r.deep&&u(e),e}catch(E){return}finally{a.pop()}};"function"==typeof n?e.push((()=>{n(i())})):e.push(i);const s=i();return"function"==typeof n&&n(s),o},Cancel:function(t){t>=0&&t<e.length&&(e[t]=null)},ForceUpdate:function(){for(let t of e)t&&t()},SetDataRoot:p,DataID:f,GenUniqueID:c,Run:function(t,e,n,r){return function(t,e,n,r,o){if(t)try{return t(b(n,r,o))}catch(i){}}(g(t,v,(t=>Function("sandbox",t)),{label:"Run"}),0,e,n,r)},AsyncRun:async function(t,e,n,r){const o=g(t,R,(t=>new x("sandbox",t)),{label:"AsyncRun",returnExpression:!0});return await async function(t,e,n,r,o){if(t)try{return await t(b(n,r,o))}catch(i){throw i}}(o,0,e,n,r)}};class S{constructor(){this.events={}}on(t,e,n=null){if("function"!=typeof e)throw Error("\u56de\u8c03\u51fd\u6570\u5fc5\u987b\u662f\u4e00\u4e2a\u51fd\u6570");this.events[t]||(this.events[t]=[]);const r={callback:e,context:n};return this.events[t].push(r),()=>this.off(t,e,n)}once(t,e,n=null){const r=(...o)=>{this.off(t,r,n),e.apply(n,o)};return this.on(t,r,n)}off(t,e=null,n=null){this.events[t]&&(e?(this.events[t]=this.events[t].filter((t=>!(t.callback===e&&t.context===n))),0===this.events[t].length&&delete this.events[t]):delete this.events[t])}emit(t,...e){this.events[t]&&[...this.events[t]].forEach((t=>{try{t.callback.apply(t.context,e)}catch(n){}}))}listenerCount(t){return this.events[t]?this.events[t].length:0}eventNames(){return Object.keys(this.events)}removeAllListeners(){this.events={}}hasListeners(t){return this.listenerCount(t)>0}}function E(t,e){return function(){return t.apply(e,arguments)}}const{toString:j}=Object.prototype,{getPrototypeOf:A}=Object,{iterator:k,toStringTag:T}=Symbol,$=(N=Object.create(null),t=>{const e=j.call(t);return N[e]||(N[e]=e.slice(8,-1).toLowerCase())});var N;const C=t=>(t=t.toLowerCase(),e=>$(e)===t),P=t=>e=>typeof e===t,{isArray:L}=Array,U=P("undefined"),D=C("ArrayBuffer"),F=P("string"),I=P("function"),M=P("number"),q=t=>null!==t&&"object"==typeof t,B=t=>{if("object"!==$(t))return!1;const e=A(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||T in t||k in t)},_=C("Date"),z=C("File"),H=C("Blob"),W=C("FileList"),J=C("URLSearchParams"),[K,V,X,G]=["ReadableStream","Request","Response","Headers"].map(C);function Z(t,e,{allOwnKeys:n=!1}={}){if(null==t)return;let r,o;if("object"!=typeof t&&(t=[t]),L(t))for(r=0,o=t.length;o>r;r++)e.call(null,t[r],r,t);else{const o=n?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let s;for(r=0;i>r;r++)s=o[r],e.call(null,t[s],s,t)}}function Y(t,e){e=e.toLowerCase();const n=Object.keys(t);let r,o=n.length;for(;o-- >0;)if(r=n[o],e===r.toLowerCase())return r;return null}const Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,tt=t=>!U(t)&&t!==Q,et=(nt="undefined"!=typeof Uint8Array&&A(Uint8Array),t=>nt&&t instanceof nt);var nt;const rt=C("HTMLFormElement"),ot=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),it=C("RegExp"),st=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Z(n,((n,o)=>{let i;!1!==(i=e(n,o,t))&&(r[o]=i||n)})),Object.defineProperties(t,r)},ct=C("AsyncFunction"),ut=(at="function"==typeof setImmediate,lt=I(Q.postMessage),at?setImmediate:lt?(ft="axios@"+Math.random(),ht=[],Q.addEventListener("message",(({source:t,data:e})=>{t===Q&&e===ft&&ht.length&&ht.shift()()}),!1),t=>{ht.push(t),Q.postMessage(ft,"*")}):t=>setTimeout(t));var at,lt,ft,ht;const dt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Q):"undefined"!=typeof process&&process.nextTick||ut,pt={isArray:L,isArrayBuffer:D,isBuffer:function(t){return null!==t&&!U(t)&&null!==t.constructor&&!U(t.constructor)&&I(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||I(t.append)&&("formdata"===(e=$(t))||"object"===e&&I(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&D(t.buffer),e},isString:F,isNumber:M,isBoolean:t=>!0===t||!1===t,isObject:q,isPlainObject:B,isReadableStream:K,isRequest:V,isResponse:X,isHeaders:G,isUndefined:U,isDate:_,isFile:z,isBlob:H,isRegExp:it,isFunction:I,isStream:t=>q(t)&&I(t.pipe),isURLSearchParams:J,isTypedArray:et,isFileList:W,forEach:Z,merge:function t(){const{caseless:e}=tt(this)&&this||{},n={},r=(r,o)=>{const i=e&&Y(n,o)||o;B(n[i])&&B(r)?n[i]=t(n[i],r):B(r)?n[i]=t({},r):L(r)?n[i]=r.slice():n[i]=r};for(let o=0,i=arguments.length;i>o;o++)arguments[o]&&Z(arguments[o],r);return n},extend:(t,e,n,{allOwnKeys:r}={})=>(Z(e,((e,r)=>{n&&I(e)?t[r]=E(e,n):t[r]=e}),{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},toFlatObject:(t,e,n,r)=>{let o,i,s;const c={};if(e=e||{},null==t)return e;do{for(o=Object.getOwnPropertyNames(t),i=o.length;i-- >0;)s=o[i],r&&!r(s,t,e)||c[s]||(e[s]=t[s],c[s]=!0);t=!1!==n&&A(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:$,kindOfTest:C,endsWith:(t,e,n)=>{t+="",(void 0===n||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return-1!==r&&r===n},toArray:t=>{if(!t)return null;if(L(t))return t;let e=t.length;if(!M(e))return null;const n=Array(e);for(;e-- >0;)n[e]=t[e];return n},forEachEntry:(t,e)=>{const n=(t&&t[k]).call(t);let r;for(;(r=n.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},matchAll:(t,e)=>{let n;const r=[];for(;null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:rt,hasOwnProperty:ot,hasOwnProp:ot,reduceDescriptors:st,freezeMethods:t=>{st(t,((e,n)=>{if(I(t)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=t[n];I(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(t,e)=>{const n={},r=t=>{t.forEach((t=>{n[t]=!0}))};return L(t)?r(t):r((t+"").split(e)),n},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,n){return e.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:Y,global:Q,isContextDefined:tt,isSpecCompliantForm:function(t){return!!(t&&I(t.append)&&"FormData"===t[T]&&t[k])},toJSONObject:t=>{const e=[,,,,,,,,,,],n=(t,r)=>{if(q(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const o=L(t)?[]:{};return Z(t,((t,e)=>{const i=n(t,r+1);!U(i)&&(o[e]=i)})),e[r]=void 0,o}}return t};return n(t,0)},isAsyncFn:ct,isThenable:t=>t&&(q(t)||I(t))&&I(t.then)&&I(t.catch),setImmediate:ut,asap:dt,isIterable:t=>null!=t&&I(t[k])};function mt(t,e,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}pt.inherits(mt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:pt.toJSONObject(this.config),code:this.code,status:this.status}}});const yt=mt.prototype,wt={};function bt(t){return pt.isPlainObject(t)||pt.isArray(t)}function vt(t){return pt.endsWith(t,"[]")?t.slice(0,-2):t}function gt(t,e,n){return t?t.concat(e).map((function(t,e){return t=vt(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{wt[t]={value:t}})),Object.defineProperties(mt,wt),Object.defineProperty(yt,"isAxiosError",{value:!0}),mt.from=(t,e,n,r,o,i)=>{const s=Object.create(yt);return pt.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),mt.call(s,t.message,e,n,r,o),s.cause=t,s.name=t.name,i&&Object.assign(s,i),s};const xt=pt.toFlatObject(pt,{},null,(function(t){return/^is[A-Z]/.test(t)}));function Rt(t,e,n){if(!pt.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(n=pt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!pt.isUndefined(e[t])}))).metaTokens,o=n.visitor||a,i=n.dots,s=n.indexes,c=(n.Blob||"undefined"!=typeof Blob&&Blob)&&pt.isSpecCompliantForm(e);if(!pt.isFunction(o))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(pt.isDate(t))return t.toISOString();if(pt.isBoolean(t))return t.toString();if(!c&&pt.isBlob(t))throw new mt("Blob is not supported. Use a Buffer instead.");return pt.isArrayBuffer(t)||pt.isTypedArray(t)?c&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function a(t,n,o){let c=t;if(t&&!o&&"object"==typeof t)if(pt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),t=JSON.stringify(t);else if(pt.isArray(t)&&function(t){return pt.isArray(t)&&!t.some(bt)}(t)||(pt.isFileList(t)||pt.endsWith(n,"[]"))&&(c=pt.toArray(t)))return n=vt(n),c.forEach((function(t,r){!pt.isUndefined(t)&&null!==t&&e.append(!0===s?gt([n],r,i):null===s?n:n+"[]",u(t))})),!1;return!!bt(t)||(e.append(gt(o,n,i),u(t)),!1)}const l=[],f=Object.assign(xt,{defaultVisitor:a,convertValue:u,isVisitable:bt});if(!pt.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!pt.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),pt.forEach(n,(function(n,i){!0===(!(pt.isUndefined(n)||null===n)&&o.call(e,n,pt.isString(i)?i.trim():i,r,f))&&t(n,r?r.concat(i):[i])})),l.pop()}}(t),e}function Ot(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function St(t,e){this.i=[],t&&Rt(t,this,e)}const Et=St.prototype;function jt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function At(t,e,n){if(!e)return t;const r=n&&n.encode||jt;pt.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(i=o?o(e,n):pt.isURLSearchParams(e)?e.toString():new St(e,n).toString(r),i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}Et.append=function(t,e){this.i.push([t,e])},Et.toString=function(t){const e=t?function(e){return t.call(this,e,Ot)}:Ot;return this.i.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const kt=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){pt.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},Tt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},$t={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:St,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Nt="undefined"!=typeof window&&"undefined"!=typeof document,Ct="object"==typeof navigator&&navigator||void 0,Pt=Nt&&(!Ct||0>["ReactNative","NativeScript","NS"].indexOf(Ct.product)),Lt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ut=Nt&&window.location.href||"http://localhost",Dt={...Object.freeze({__proto__:null,hasBrowserEnv:Nt,hasStandardBrowserWebWorkerEnv:Lt,hasStandardBrowserEnv:Pt,navigator:Ct,origin:Ut}),...$t};function Ft(t){function e(t,n,r,o){let i=t[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),c=o>=t.length;return i=!i&&pt.isArray(r)?r.length:i,c?(pt.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s):(r[i]&&pt.isObject(r[i])||(r[i]=[]),e(t,n,r[i],o)&&pt.isArray(r[i])&&(r[i]=function(t){const e={},n=Object.keys(t);let r;const o=n.length;let i;for(r=0;o>r;r++)i=n[r],e[i]=t[i];return e}(r[i])),!s)}if(pt.isFormData(t)&&pt.isFunction(t.entries)){const n={};return pt.forEachEntry(t,((t,r)=>{e(function(t){return pt.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),r,n,0)})),n}return null}const It={transitional:Tt,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,o=pt.isObject(t);if(o&&pt.isHTMLForm(t)&&(t=new FormData(t)),pt.isFormData(t))return r?JSON.stringify(Ft(t)):t;if(pt.isArrayBuffer(t)||pt.isBuffer(t)||pt.isStream(t)||pt.isFile(t)||pt.isBlob(t)||pt.isReadableStream(t))return t;if(pt.isArrayBufferView(t))return t.buffer;if(pt.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Rt(t,new Dt.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,r){return Dt.isNode&&pt.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((i=pt.isFileList(t))||n.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Rt(i?{"files[]":t}:t,e&&new e,this.formSerializer)}}return o||r?(e.setContentType("application/json",!1),function(t){if(pt.isString(t))try{return(0,JSON.parse)(t),pt.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||It.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(pt.isResponse(t)||pt.isReadableStream(t))return t;if(t&&pt.isString(t)&&(n&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw mt.from(t,mt.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Dt.classes.FormData,Blob:Dt.classes.Blob},validateStatus:function(t){return t>=200&&300>t},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};pt.forEach(["delete","get","head","post","put","patch"],(t=>{It.headers[t]={}}));const Mt=It,qt=pt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Bt=Symbol("internals");function _t(t){return t&&(t+"").trim().toLowerCase()}function zt(t){return!1===t||null==t?t:pt.isArray(t)?t.map(zt):t+""}function Ht(t,e,n,r,o){return pt.isFunction(r)?r.call(this,e,n):(o&&(e=n),pt.isString(e)?pt.isString(r)?-1!==e.indexOf(r):pt.isRegExp(r)?r.test(e):void 0:void 0)}class Wt{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function o(t,e,n){const o=_t(e);if(!o)throw Error("header name must be a non-empty string");const i=pt.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||e]=zt(t))}const i=(t,e)=>pt.forEach(t,((t,n)=>o(t,n,e)));if(pt.isPlainObject(t)||t instanceof this.constructor)i(t,e);else if(pt.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))i((t=>{const e={};let n,r,o;return t&&t.split("\n").forEach((function(t){o=t.indexOf(":"),n=t.substring(0,o).trim().toLowerCase(),r=t.substring(o+1).trim(),!n||e[n]&&qt[n]||("set-cookie"===n?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)})),e})(t),e);else if(pt.isObject(t)&&pt.isIterable(t)){let n,r,o={};for(const e of t){if(!pt.isArray(e))throw TypeError("Object iterator must return a key-value pair");o[r=e[0]]=(n=o[r])?pt.isArray(n)?[...n,e[1]]:[n,e[1]]:e[1]}i(o,e)}else null!=t&&o(e,t,n);return this}get(t,e){if(t=_t(t)){const n=pt.findKey(this,t);if(n){const t=this[n];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}(t);if(pt.isFunction(e))return e.call(this,t,n);if(pt.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=_t(t)){const n=pt.findKey(this,t);return!(!n||void 0===this[n]||e&&!Ht(0,this[n],n,e))}return!1}delete(t,e){const n=this;let r=!1;function o(t){if(t=_t(t)){const o=pt.findKey(n,t);!o||e&&!Ht(0,n[o],o,e)||(delete n[o],r=!0)}}return pt.isArray(t)?t.forEach(o):o(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const o=e[n];t&&!Ht(0,this[o],o,t,!0)||(delete this[o],r=!0)}return r}normalize(t){const e=this,n={};return pt.forEach(this,((r,o)=>{const i=pt.findKey(n,o);if(i)return e[i]=zt(r),void delete e[o];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}(o):(o+"").trim();s!==o&&delete e[o],e[s]=zt(r),n[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return pt.forEach(this,((n,r)=>{null!=n&&!1!==n&&(e[r]=t&&pt.isArray(n)?n.join(", "):n)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach((t=>n.set(t))),n}static accessor(t){const e=(this[Bt]=this[Bt]={accessors:{}}).accessors,n=this.prototype;function r(t){const r=_t(t);e[r]||(function(t,e){const n=pt.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+n,{value:function(t,n,o){return this[r].call(this,e,t,n,o)},configurable:!0})}))}(n,t),e[r]=!0)}return pt.isArray(t)?t.forEach(r):r(t),this}}Wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),pt.reduceDescriptors(Wt.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}})),pt.freezeMethods(Wt);const Jt=Wt;function Kt(t,e){const n=this||Mt,r=e||n,o=Jt.from(r.headers);let i=r.data;return pt.forEach(t,(function(t){i=t.call(n,i,o.normalize(),e?e.status:void 0)})),o.normalize(),i}function Vt(t){return!(!t||!t.u)}function Xt(t,e,n){mt.call(this,t??"canceled",mt.ERR_CANCELED,e,n),this.name="CanceledError"}function Gt(t,e,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?e(new mt("Request failed with status code "+n.status,[mt.ERR_BAD_REQUEST,mt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}pt.inherits(Xt,mt,{u:!0});const Zt=(t,e,n=3)=>{let r=0;const o=function(t,e){const n=Array(t=t||10),r=Array(t);let o,i=0,s=0;return e=void 0!==e?e:1e3,function(c){const u=Date.now(),a=r[s];o||(o=u),n[i]=c,r[i]=u;let l=s,f=0;for(;l!==i;)f+=n[l++],l%=t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),e>u-o)return;const h=a&&u-a;return h?Math.round(1e3*f/h):void 0}}(50,250);return function(t,e){let n,r,o=0,i=1e3/e;const s=(e,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),t.apply(null,e)};return[(...t)=>{const e=Date.now(),c=e-o;i>c?(n=t,r||(r=setTimeout((()=>{r=null,s(n)}),i-c))):s(t,e)},()=>n&&s(n)]}((n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,c=i-r,u=o(c);r=i,t({loaded:i,total:s,progress:s?i/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s&&s>=i?(s-i)/u:void 0,event:n,lengthComputable:null!=s,[e?"download":"upload"]:!0})}),n)},Yt=(t,e)=>{const n=null!=t;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Qt=t=>(...e)=>pt.asap((()=>t(...e))),te=Dt.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Dt.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Dt.origin),Dt.navigator&&/(msie|trident)/i.test(Dt.navigator.userAgent)):()=>!0,ee=Dt.hasStandardBrowserEnv?{write(t,e,n,r,o,i){const s=[t+"="+encodeURIComponent(e)];pt.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),pt.isString(r)&&s.push("path="+r),pt.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function ne(t,e,n){return!t||/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)&&0!=n?e:function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e)}const re=t=>t instanceof Jt?{...t}:t;function oe(t,e){e=e||{};const n={};function r(t,e,n,r){return pt.isPlainObject(t)&&pt.isPlainObject(e)?pt.merge.call({caseless:r},t,e):pt.isPlainObject(e)?pt.merge({},e):pt.isArray(e)?e.slice():e}function o(t,e,n,o){return pt.isUndefined(e)?pt.isUndefined(t)?void 0:r(void 0,t,0,o):r(t,e,0,o)}function i(t,e){if(!pt.isUndefined(e))return r(void 0,e)}function s(t,e){return pt.isUndefined(e)?pt.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function c(n,o,i){return i in e?r(n,o):i in t?r(void 0,n):void 0}const u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c,headers:(t,e,n)=>o(re(t),re(e),0,!0)};return pt.forEach(Object.keys(Object.assign({},t,e)),(function(r){const i=u[r]||o,s=i(t[r],e[r],r);pt.isUndefined(s)&&i!==c||(n[r]=s)})),n}const ie=t=>{const e=oe({},t);let n,{data:r,withXSRFToken:o,xsrfHeaderName:i,xsrfCookieName:s,headers:c,auth:u}=e;if(e.headers=c=Jt.from(c),e.url=At(ne(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&c.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),pt.isFormData(r))if(Dt.hasStandardBrowserEnv||Dt.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(!1!==(n=c.getContentType())){const[t,...e]=n?n.split(";").map((t=>t.trim())).filter(Boolean):[];c.setContentType([t||"multipart/form-data",...e].join("; "))}if(Dt.hasStandardBrowserEnv&&(o&&pt.isFunction(o)&&(o=o(e)),o||!1!==o&&te(e.url))){const t=i&&s&&ee.read(s);t&&c.set(i,t)}return e},se="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,n){const r=ie(t);let o=r.data;const i=Jt.from(r.headers).normalize();let s,c,u,a,l,{responseType:f,onUploadProgress:h,onDownloadProgress:d}=r;function p(){a&&a(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Jt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Gt((function(t){e(t),p()}),(function(t){n(t),p()}),{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:t,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new mt("Request aborted",mt.ECONNABORTED,t,m)),m=null)},m.onerror=function(){n(new mt("Network Error",mt.ERR_NETWORK,t,m)),m=null},m.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Tt;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new mt(e,o.clarifyTimeoutError?mt.ETIMEDOUT:mt.ECONNABORTED,t,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&pt.forEach(i.toJSON(),(function(t,e){m.setRequestHeader(e,t)})),pt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),d&&([u,l]=Zt(d,!0),m.addEventListener("progress",u)),h&&m.upload&&([c,a]=Zt(h),m.upload.addEventListener("progress",c),m.upload.addEventListener("loadend",a)),(r.cancelToken||r.signal)&&(s=e=>{m&&(n(!e||e.type?new Xt(null,t,m):e),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const w=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(r.url);w&&-1===Dt.protocols.indexOf(w)?n(new mt("Unsupported protocol "+w+":",mt.ERR_BAD_REQUEST,t)):m.send(o||null)}))},ce=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n,r=new AbortController;const o=function(t){if(!n){n=!0,s();const e=t instanceof Error?t:this.reason;r.abort(e instanceof mt?e:new Xt(e instanceof Error?e.message:e))}};let i=e&&setTimeout((()=>{i=null,o(new mt(`timeout ${e} of ms exceeded`,mt.ETIMEDOUT))}),e);const s=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach((t=>{t.unsubscribe?t.unsubscribe(o):t.removeEventListener("abort",o)})),t=null)};t.forEach((t=>t.addEventListener("abort",o)));const{signal:c}=r;return c.unsubscribe=()=>pt.asap(s),c}},ue=function*(t,e){let n=t.byteLength;if(e>n)return void(yield t);let r,o=0;for(;n>o;)r=o+e,yield t.slice(o,r),o=r},ae=(t,e,n,r)=>{const o=async function*(t,e){for await(const n of async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}}(t))yield*ue(n,e)}(t,e);let i,s=0,c=t=>{i||(i=!0,r&&r(t))};return new ReadableStream({async pull(t){try{const{done:e,value:r}=await o.next();if(e)return c(),void t.close();let i=r.byteLength;if(n){let t=s+=i;n(t)}t.enqueue(new Uint8Array(r))}catch(t){throw c(t),t}},cancel:t=>(c(t),o.return())},{highWaterMark:2})},le="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,fe=le&&"function"==typeof ReadableStream,he=le&&("function"==typeof TextEncoder?(de=new TextEncoder,t=>de.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var de;const pe=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},me=fe&&pe((()=>{let t=!1;const e=new Request(Dt.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e})),ye=fe&&pe((()=>pt.isReadableStream(new Response("").body))),we={stream:ye&&(t=>t.body)};var be;le&&(be=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!we[t]&&(we[t]=pt.isFunction(be[t])?e=>e[t]():(e,n)=>{throw new mt(`Response type '${t}' is not supported`,mt.ERR_NOT_SUPPORT,n)})})));const ve={http:null,xhr:se,fetch:le&&(async t=>{let{url:e,method:n,data:r,signal:o,cancelToken:i,timeout:s,onDownloadProgress:c,onUploadProgress:u,responseType:a,headers:l,withCredentials:f="same-origin",fetchOptions:h}=ie(t);a=a?(a+"").toLowerCase():"text";let d,p=ce([o,i&&i.toAbortSignal()],s);const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(u&&me&&"get"!==n&&"head"!==n&&0!==(y=await(async(t,e)=>pt.toFiniteNumber(t.getContentLength())??(async t=>{if(null==t)return 0;if(pt.isBlob(t))return t.size;if(pt.isSpecCompliantForm(t)){const e=new Request(Dt.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return pt.isArrayBufferView(t)||pt.isArrayBuffer(t)?t.byteLength:(pt.isURLSearchParams(t)&&(t+=""),pt.isString(t)?(await he(t)).byteLength:void 0)})(e))(l,r))){let t,n=new Request(e,{method:"POST",body:r,duplex:"half"});if(pt.isFormData(r)&&(t=n.headers.get("content-type"))&&l.setContentType(t),n.body){const[t,e]=Yt(y,Zt(Qt(u)));r=ae(n.body,65536,t,e)}}pt.isString(f)||(f=f?"include":"omit");const o="credentials"in Request.prototype;d=new Request(e,{...h,signal:p,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:o?f:void 0});let i=await fetch(d,h);const s=ye&&("stream"===a||"response"===a);if(ye&&(c||s&&m)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=i[e]}));const e=pt.toFiniteNumber(i.headers.get("content-length")),[n,r]=c&&Yt(e,Zt(Qt(c),!0))||[];i=new Response(ae(i.body,65536,n,(()=>{r&&r(),m&&m()})),t)}a=a||"text";let w=await we[pt.findKey(we,a)||"text"](i,t);return!s&&m&&m(),await new Promise(((e,n)=>{Gt(e,n,{data:w,headers:Jt.from(i.headers),status:i.status,statusText:i.statusText,config:t,request:d})}))}catch(e){if(m&&m(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new mt("Network Error",mt.ERR_NETWORK,t,d),{cause:e.cause||e});throw mt.from(e,e&&e.code,t,d)}})};pt.forEach(ve,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const ge=t=>"- "+t,xe=t=>pt.isFunction(t)||null===t||!1===t,Re=t=>{t=pt.isArray(t)?t:[t];const{length:e}=t;let n,r;const o={};for(let i=0;e>i;i++){let e;if(n=t[i],r=n,!xe(n)&&(r=ve[(e=n+"").toLowerCase()],void 0===r))throw new mt(`Unknown adapter '${e}'`);if(r)break;o[e||"#"+i]=r}if(!r){const t=Object.entries(o).map((([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));throw new mt("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(ge).join("\n"):" "+ge(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function Oe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Xt(null,t)}function Se(t){return Oe(t),t.headers=Jt.from(t.headers),t.data=Kt.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Re(t.adapter||Mt.adapter)(t).then((function(e){return Oe(t),e.data=Kt.call(t,t.transformResponse,e),e.headers=Jt.from(e.headers),e}),(function(e){return Vt(e)||(Oe(t),e&&e.response&&(e.response.data=Kt.call(t,t.transformResponse,e.response),e.response.headers=Jt.from(e.response.headers))),Promise.reject(e)}))}const Ee={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ee[t]=function(n){return typeof n===t||"a"+(1>e?"n ":" ")+t}}));const je={};Ee.transitional=function(t,e,n){function r(t,e){return"[Axios v1.10.0] Transitional option '"+t+"'"+e+(n?". "+n:"")}return(n,o,i)=>{if(!1===t)throw new mt(r(o," has been removed"+(e?" in "+e:"")),mt.ERR_DEPRECATED);return e&&!je[o]&&(je[o]=!0),!t||t(n,o,i)}},Ee.spelling=function(t){return(t,e)=>!0};const Ae={assertOptions:function(t,e,n){if("object"!=typeof t)throw new mt("options must be an object",mt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const i=r[o],s=e[i];if(s){const e=t[i],n=void 0===e||s(e,i,t);if(!0!==n)throw new mt("option "+i+" must be "+n,mt.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new mt("Unknown option "+i,mt.ERR_BAD_OPTION)}},validators:Ee},ke=Ae.validators;class Te{constructor(t){this.defaults=t||{},this.interceptors={request:new kt,response:new kt}}async request(t,e){try{return await this.l(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=Error();const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?n&&!(t.stack+"").endsWith(n.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+n):t.stack=n}catch(t){}}throw t}}l(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=oe(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:o}=e;void 0!==n&&Ae.assertOptions(n,{silentJSONParsing:ke.transitional(ke.boolean),forcedJSONParsing:ke.transitional(ke.boolean),clarifyTimeoutError:ke.transitional(ke.boolean)},!1),null!=r&&(pt.isFunction(r)?e.paramsSerializer={serialize:r}:Ae.assertOptions(r,{encode:ke.function,serialize:ke.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ae.assertOptions(e,{baseUrl:ke.spelling("baseURL"),withXsrfToken:ke.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=o&&pt.merge(o.common,o[e.method]);o&&pt.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete o[t]})),e.headers=Jt.concat(i,o);const s=[];let c=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(c=c&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const u=[];let a;this.interceptors.response.forEach((function(t){u.push(t.fulfilled,t.rejected)}));let l,f=0;if(!c){const t=[Se.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,u),l=t.length,a=Promise.resolve(e);l>f;)a=a.then(t[f++],t[f++]);return a}l=s.length;let h=e;for(f=0;l>f;){const e=s[f++],n=s[f++];try{h=e(h)}catch(t){n.call(this,t);break}}try{a=Se(h)}catch(t){return Promise.reject(t)}for(f=0,l=u.length;l>f;)a=a.then(u[f++],u[f++]);return a}getUri(t){return At(ne((t=oe(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}pt.forEach(["delete","get","head","options"],(function(t){Te.prototype[t]=function(e,n){return this.request(oe(n||{},{method:t,url:e,data:(n||{}).data}))}})),pt.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,o){return this.request(oe(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Te.prototype[t]=e(),Te.prototype[t+"Form"]=e(!0)}));const $e=Te;class Ne{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const n=this;this.promise.then((t=>{if(!n.h)return;let e=n.h.length;for(;e-- >0;)n.h[e](t);n.h=null})),this.promise.then=t=>{let e;const r=new Promise((t=>{n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,r,o){n.reason||(n.reason=new Xt(t,r,o),e(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this.h?this.h.push(t):this.h=[t]}unsubscribe(t){if(!this.h)return;const e=this.h.indexOf(t);-1!==e&&this.h.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new Ne((function(e){t=e})),cancel:t}}}const Ce=Ne,Pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pe).forEach((([t,e])=>{Pe[e]=t}));const Le=Pe,Ue=function t(e){const n=new $e(e),r=E($e.prototype.request,n);return pt.extend(r,$e.prototype,n,{allOwnKeys:!0}),pt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return t(oe(e,n))},r}(Mt);Ue.Axios=$e,Ue.CanceledError=Xt,Ue.CancelToken=Ce,Ue.isCancel=Vt,Ue.VERSION="1.10.0",Ue.toFormData=Rt,Ue.AxiosError=mt,Ue.Cancel=Ue.CanceledError,Ue.all=function(t){return Promise.all(t)},Ue.spread=function(t){return function(e){return t.apply(null,e)}},Ue.isAxiosError=function(t){return pt.isObject(t)&&!0===t.isAxiosError},Ue.mergeConfig=oe,Ue.AxiosHeaders=Jt,Ue.formToJSON=t=>Ft(pt.isHTMLForm(t)?new FormData(t):t),Ue.getAdapter=Re,Ue.HttpStatusCode=Le,Ue.default=Ue;const De=Ue,{Axios:Fe,AxiosError:Ie,CanceledError:Me,isCancel:qe,CancelToken:Be,VERSION:_e,all:ze,Cancel:He,isAxiosError:We,spread:Je,toFormData:Ke,AxiosHeaders:Ve,HttpStatusCode:Xe,formToJSON:Ge,getAdapter:Ze,mergeConfig:Ye}=De;class Qe{shared={locale:"zh-CN",fallback:"en-US"};constructor(t={}){this.shared=t||this.shared,this.messages={},this.p=new Map}setLocale(t){return this.shared.locale===t||(this.shared.locale=t,document.documentElement.lang=t,this.p.clear()),this}getLocale(){return this.shared.locale}load(t,e=!0){return e?Object.keys(t).forEach((e=>{this.messages[e]={...this.messages[e],...t[e]}})):this.messages=t,this}t(t,e={}){const{locale:n=this.shared.locale,fallback:r=this.shared.fallback,count:o,...i}=e,s=void 0===o?i:{...i,count:o};let c=this.messages[n]?.[t]||this.messages[r]?.[t]||t;return void 0!==o&&"object"==typeof c&&(c=0===o&&c.zero?c.zero:1===o&&c.one?c.one:c.other||c.one||t),"string"!=typeof c?t:(Object.keys(s).forEach((t=>{c=c.replace(RegExp(`{{?${t}}}?`,"g"),s[t])})),c)}d(t,e={}){const{locale:n=this.shared.locale,...r}=e,o=`d:${n}:${JSON.stringify(r)}`;this.p.has(o)||this.p.set(o,new Intl.DateTimeFormat(n,{year:"numeric",month:"short",day:"numeric",...r}));const i="string"==typeof t?new Date(t):t;return this.p.get(o).format(i)}n(t,e={}){const{locale:n=this.shared.locale,...r}=e,o=`n:${n}:${JSON.stringify(r)}`;return this.p.has(o)||this.p.set(o,new Intl.NumberFormat(n,{minimumFractionDigits:0,maximumFractionDigits:2,...r})),this.p.get(o).format(t)}c(t,e="CNY",n={}){return this.n(t,{style:"currency",currency:e,...n})}rtf(t,e="day",n={}){const{locale:r=this.shared.locale,...o}=n,i=`rtf:${r}:${JSON.stringify(o)}`;return this.p.has(i)||this.p.set(i,new Intl.RelativeTimeFormat(r,{numeric:"auto",...o})),this.p.get(i).format(t,e)}m(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&["zero","one","other"].some((e=>e in t))}has(t,e=this.shared.locale){const n=this.messages[e]?.[t];return void 0!==n&&(!this.m(n)||void 0!==n.one||void 0!==n.other)}getLocales(){return Object.keys(this.messages)}}const tn="vhtml-message-style";class en{constructor(){this.container=null,this.messageTimers=new WeakMap}ensureReady(){return!("undefined"==typeof document||!document.head||!document.body||(this.ensureStyle(),this.ensureContainer(),0))}ensureStyle(){if(document.getElementById(tn))return;const t=document.createElement("style");t.id=tn,t.textContent="\n .vmsg-container {\n position: fixed;\n top: 60px;\n left: 50%;\n transform: translateX(-50%);\n z-index: 9999;\n width: min(300px, calc(100vw - 32px));\n }\n\n .vmsg-item {\n margin-bottom: 10px;\n padding: 15px;\n border-radius: 4px;\n box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);\n transform: translateY(100%);\n opacity: 0;\n transition: all 0.3s ease;\n display: flex;\n align-items: flex-start;\n }\n\n .vmsg-item.show {\n transform: translateY(0);\n opacity: 1;\n }\n\n .vmsg-icon {\n margin-right: 10px;\n font-size: 16px;\n line-height: 1;\n }\n\n .vmsg-content {\n flex: 1;\n font-size: 14px;\n line-height: 1.4;\n }\n\n .vmsg-close {\n margin-left: 10px;\n cursor: pointer;\n font-size: 16px;\n opacity: 0.7;\n transition: opacity 0.2s;\n }\n\n .vmsg-close:hover {\n opacity: 1;\n }\n\n .vmsg-success {\n background-color: #f0f9eb;\n border: 1px solid #e1f3d8;\n color: var(--color-success, #67c23a);\n }\n\n .vmsg-warning {\n background-color: #fdf6ec;\n border: 1px solid #faecd8;\n color: #e6a23c;\n }\n\n .vmsg-error {\n background-color: #fef0f0;\n border: 1px solid #fde2e2;\n color: #f56c6c;\n }\n\n .vmsg-info {\n background-color: #edf2fc;\n border: 1px solid #ebeef5;\n color: #409eff;\n }\n\n .vmsg-overlay {\n position: fixed;\n inset: 0;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 10000;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transition: opacity 0.3s ease;\n }\n\n .vmsg-overlay.show {\n opacity: 1;\n }\n\n .vmsg-dialog {\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n min-width: min(400px, calc(100vw - 32px));\n max-width: min(500px, calc(100vw - 32px));\n transform: scale(0.8);\n transition: transform 0.3s ease;\n }\n\n .vmsg-overlay.show .vmsg-dialog {\n transform: scale(1);\n }\n\n .vmsg-header {\n padding: 20px 20px 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #eee;\n }\n\n .vmsg-title {\n font-size: 18px;\n font-weight: 500;\n margin: 0;\n }\n\n .vmsg-close-btn {\n cursor: pointer;\n font-size: 20px;\n color: #999;\n border: none;\n background: none;\n padding: 0;\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .vmsg-close-btn:hover {\n color: #666;\n }\n\n .vmsg-body {\n padding: 20px;\n }\n\n .vmsg-prompt-content {\n margin-bottom: 20px;\n font-size: 14px;\n line-height: 1.5;\n color: #333;\n }\n\n .vmsg-input {\n width: 100%;\n padding: 10px 12px;\n border: 1px solid #dcdfe6;\n border-radius: 4px;\n font-size: 14px;\n box-sizing: border-box;\n transition: border-color 0.2s;\n }\n\n .vmsg-input:focus {\n outline: none;\n border-color: #409eff;\n }\n\n .vmsg-footer {\n padding: 15px 20px;\n text-align: right;\n border-top: 1px solid #eee;\n }\n\n .vmsg-btn {\n padding: 8px 16px;\n border: 1px solid #dcdfe6;\n border-radius: 4px;\n font-size: 14px;\n cursor: pointer;\n margin-left: 10px;\n transition: all 0.2s;\n }\n\n .vmsg-btn-cancel {\n background: white;\n color: #606266;\n }\n\n .vmsg-btn-cancel:hover {\n background: #f5f7fa;\n border-color: #c0c4cc;\n }\n\n .vmsg-btn-confirm {\n background: #409eff;\n color: white;\n border-color: #409eff;\n }\n\n .vmsg-btn-confirm:hover {\n background: #66b1ff;\n border-color: #66b1ff;\n }\n",document.head.appendChild(t)}ensureContainer(){return this.container?.isConnected||(this.container=document.createElement("div"),this.container.className="vmsg-container",document.body.appendChild(this.container)),this.container}queue(t){if(this.ensureReady())return t();const e=()=>{window.removeEventListener("DOMContentLoaded",e),t()};return window.addEventListener("DOMContentLoaded",e,{once:!0}),null}schedule(t,e){return window.setTimeout(t,e)}trackTimers(t,e){t&&0!==e.length&&this.messageTimers.set(t,e)}clearTimers(t){const e=this.messageTimers.get(t);e&&(e.forEach((t=>window.clearTimeout(t))),this.messageTimers.delete(t))}}const nn=new class{constructor(t=new en){this.runtime=t}createMessage(t,e,n={}){return this.runtime.queue((()=>{const{duration:r=3e3,showClose:o=!0,onClose:i=null}=n,s=this.runtime.ensureContainer(),c=document.createElement("div");c.className="vmsg-item vmsg-"+t;const u={success:"\u2713",warning:"\u26a0",error:"\u2715",info:"\u2139"},a=document.createElement("span");a.className="vmsg-icon",a.textContent=u[t]||u.info;const l=document.createElement("div");l.className="vmsg-content",l.textContent=e,c.appendChild(a),c.appendChild(l);let f=!1;const h=()=>{f||(f=!0,this.removeMessage(c),"function"==typeof i&&i())};if(o){const t=document.createElement("span");t.className="vmsg-close",t.innerHTML="×",t.addEventListener("click",h),c.appendChild(t)}s.appendChild(c);const d=[this.runtime.schedule((()=>{c.classList.add("show")}),10)];return r>0&&d.push(this.runtime.schedule(h,r)),this.runtime.trackTimers(c,d),c}))}removeMessage(t){if(!t||!t.parentNode)return;this.runtime.clearTimers(t),t.classList.remove("show");const e=this.runtime.schedule((()=>{t.parentNode&&t.parentNode.removeChild(t)}),300);this.runtime.trackTimers(t,[e])}success(t,e={}){return this.createMessage("success",t,e)}warning(t,e={}){return this.createMessage("warning",t,e)}error(t,e={}){return this.createMessage("error",t,e)}info(t,e={}){return this.createMessage("info",t,e)}v(t,e={}){return new Promise(((n,r)=>{this.runtime.queue((()=>{const{title:o="\u63d0\u793a",type:i="confirm",inputValue:s="",confirmText:c="\u786e\u5b9a",cancelText:u="\u53d6\u6d88",onConfirm:a=null,onCancel:l=null}=e,f=document.createElement("div");f.className="vmsg-overlay";const h=document.createElement("div");h.className="vmsg-dialog";const d=document.createElement("div");d.className="vmsg-header";const p=document.createElement("h3");p.className="vmsg-title",p.textContent=o;const m=document.createElement("button");m.className="vmsg-close-btn",m.innerHTML="×",d.appendChild(p),d.appendChild(m);const y=document.createElement("div");y.className="vmsg-body";const w=document.createElement("div");w.className="vmsg-prompt-content",w.textContent=t,y.appendChild(w);let b=null;"input"===i&&(b=document.createElement("input"),b.className="vmsg-input",b.type="text",b.value=s,y.appendChild(b));const v=document.createElement("div");v.className="vmsg-footer";const g=document.createElement("button");g.className="vmsg-btn vmsg-btn-cancel",g.textContent=u;const x=document.createElement("button");x.className="vmsg-btn vmsg-btn-confirm",x.textContent=c,v.appendChild(g),v.appendChild(x),h.appendChild(d),h.appendChild(y),h.appendChild(v),f.appendChild(h),document.body.appendChild(f);const R=[];let O=!1;const S=t=>{O||(O=!0,f.classList.remove("show"),R.splice(0).forEach((t=>t())),window.setTimeout((()=>{f.remove(),t()}),300))},E=()=>{S((()=>{"function"==typeof l&&l(),r(Error("cancelled"))}))},j=t=>{"Escape"===t.key&&E()};document.addEventListener("keydown",j),R.push((()=>document.removeEventListener("keydown",j))),m.addEventListener("click",E),g.addEventListener("click",E),x.addEventListener("click",(()=>{const t=!b||b.value;S((()=>{n(t),"function"==typeof a&&a(t)}))})),f.addEventListener("click",(t=>{t.target===f&&E()}));const A=this.runtime.schedule((()=>{f.classList.add("show")}),10);if(R.push((()=>window.clearTimeout(A))),b){const t=this.runtime.schedule((()=>{b.focus(),b.select()}),300);R.push((()=>window.clearTimeout(t)))}}))}))}confirm(t,e={}){return this.v(t,{...e,type:"confirm"})}prompt(t,e,n={}){return this.v(t,{...n,type:"input",inputValue:e})}};function rn(t=null){const e=function(t=null){return t&&"object"==typeof t?t.$mod||t:null}(t);return e?.scoped||""}function on(t=null,e={}){const n=Object.create(t||null);return{}.hasOwnProperty.call(n,"$message")||(n.$message=nn),e&&"object"==typeof e&&Object.assign(n,e),n}function sn(t=null,e={}){const n=e&&"object"==typeof e?{...e}:{};return O.Wrap(n,t||void 0)}function cn(t){return De.create({baseURL:t})}const un=new Set(["scoped","baseURL","origin","$axios","$bus","$i18n","$t"]);function an(t){return t&&"/"!==t?t.endsWith("/")?t.slice(0,-1):t:t||""}function ln(t=""){if(!t)return"";if(/^https?:\/\//.test(t)){const e=new URL(t),n=an(e.pathname);return`${e.origin}${"/"===n?"":n}`}const e=an(t);return e?e.startsWith("/")?e:"/"+e:""}function fn(t="",e=""){if(!t)return t;if(t.startsWith("@"))return t.slice(1);if(/^https?:\/\//.test(t))return t;if(!t.startsWith("/"))return t;const n=ln(e);return n?`${n}${t}`:t}function hn(t=""){const e=ln(t);return e?/^https?:\/\//.test(e)?e:`${window.location.origin}${e}`:window.location.origin}function dn(t=null,e=null,n={},r={}){return function(t=null,e=null,n={},r={}){const o=t?.$sys||null,i=t?.$ctx||null;return{$sys:on(o,n),$ctx:sn(i,r),$mod:e||t?.$mod||null}}(t,e,n,r)}const pn=new class{constructor(){this.modMap=new Map,this.wrappers=[],this.sharedLocale=O.Wrap({locale:localStorage.getItem("i18n_locale")||"zh-CN",fallback:"en-US"}),this.initLocaleWatcher()}initLocaleWatcher(){O.Watch((()=>this.sharedLocale.locale),(t=>{localStorage.setItem("i18n_locale",t),document.documentElement.lang=t}))}addWrapper(t){if("function"==typeof t){this.wrappers.push(t);for(const[e,n]of this.modMap.entries())t(e,n)}}clear(){this.modMap.clear(),this.wrappers=[]}async getModule(t=""){const e=ln(t||"");let n=this.modMap.get(e);return n||(n=await this.createModule(e),this.modMap.set(e,n)),n}patchModule(t,e={}){return function(t,e={}){e&&"object"==typeof e&&Object.entries(e).forEach((([e,n])=>{un.has(e)||(t[e]=n)}))}(t,e),t}async createModule(t,e={}){const n=hn(t),r=function(t,e,n,r={}){const o={...r,scoped:t,baseURL:e,origin:window.location.origin,$bus:new S,$i18n:new Qe(n)};return o.$t=(t,e={})=>o.$i18n.t(t,e),o}(t,n,this.sharedLocale,{$axios:cn(n)});this.patchModule(r,e),await this.loadEnvConfig(r);for(const o of this.wrappers)o(t,r);return r}async loadEnvConfig(t){const e=hn(t.scoped)+"/env.js";try{const n=await import(e);"function"==typeof n.default&&await n.default(t,this)}catch(n){}}};function mn(t,e=""){return t&&"/"!==t?t.startsWith("@")?t.slice(1):/^https?:\/\//.test(t)?t:t.startsWith("/")?fn(t,e):fn("/"+t,e):fn("/",e)}class yn{constructor(){this.templates=new Map,this.pending=new Map}clear(){this.templates.clear(),this.pending.clear()}}class wn{constructor(){this.loadedLinks=new Set,this.loadedScripts=new Set,this.loadedStyles=new Set}resolveUrl(t,e){return mn(t,e)}loadLink(t,e){const n=this.resolveUrl(t.getAttribute("href"),rn(e)),r=t.getAttribute("key")||n;if(!r||this.loadedLinks.has(r))return;this.loadedLinks.add(r);const o=t.cloneNode(!0);o.setAttribute("href",n),document.head.appendChild(o)}async loadScript(t,e){const n=this.resolveUrl(t.getAttribute("src"),rn(e)),r=t.getAttribute("key"),o=r||n;if(!o||this.loadedScripts.has(o))return;this.loadedScripts.add(o);const i=document.createElement("script");n&&(i.src=n),r&&i.setAttribute("key",r),i.type=t.getAttribute("type")||"text/javascript",await new Promise(((t,e)=>{i.onload=()=>t(i),i.onerror=()=>e(Error("Failed to load script "+n)),document.head.appendChild(i)}))}loadStyle(t,e){if(!t)return;const n=`${e}::${t}`;if(this.loadedStyles.has(n))return;this.loadedStyles.add(n);const r=document.createElement("style");r.innerHTML=t,r.setAttribute("vref",e),document.head.appendChild(r)}async loadHeads(t,e,n){for(const r of t){const t=r.nodeName.toLowerCase();"link"===t?this.loadLink(r,e):"script"===t?await this.loadScript(r,e):"title"===t&&(n.title=r.innerText)}}}class bn{constructor(t){this.resourceLoader=t}createDescriptor(t,e,n,r,o){return{url:n,scoped:r,mod:e,heads:Array.from(o.querySelector("head")?.children||[]),body:document.createElement("div"),setup:void 0,scripts:[],styles:"",title:"",txt:t,tmp:o,customAttrs:{},err:null}}processStyles(e){e.tmp.querySelectorAll("style").forEach((n=>{null===n.getAttribute("unscoped")?e.styles+=t.parse(n.innerHTML,e.url):e.styles+=n.innerHTML})),this.resourceLoader.loadStyle(e.styles,e.url)}processBody(t){const e=t.tmp.querySelector("body");e&&(t.body.append(...e.childNodes),Array.from(e.attributes).forEach((e=>{/^[a-zA-Z]/.test(e.name)?t.body.setAttribute(e.name,e.value):t.customAttrs[e.name]=e.value})),t.body.setAttribute("vref",t.url))}processScripts(t){t.body.querySelectorAll("script").forEach((e=>{e.innerHTML.trim()?(e.hasAttribute("setup")?t.setup=e:e.hasAttribute("no-vhtml")||t.scripts.push(e),e.remove()):e.remove()}))}syncRefOwnerId(t,e){Array.from(t.childNodes).forEach((t=>{1===t.nodeType&&(t.setAttribute("vrefof",e),this.syncRefOwnerId(t,e))}))}async parse(t,e,n,r=!1){const o=(new DOMParser).parseFromString(t,"text/html");if(o.body.hasAttribute("scoped")&&!r)throw Error("HTTP error! status: 404");const i=this.createDescriptor(t,e,n,rn(e),o);return this.processStyles(i),this.processBody(i),this.processScripts(i),this.syncRefOwnerId(i.body,n),r||await this.resourceLoader.loadHeads(i.heads,e,i),i}create404Descriptor(t,e,n){const r=document.createElement("div");return r.style.cssText="background:#aaa;height:100%;width:100%;display:grid;place-items:center;",r.innerHTML=`<div style="width:20rem;height:15rem;border-radius:1rem;padding:1rem;background:#cfc0aa;display:grid;place-items:center;"><div style="font-size:2rem">404</div><p>${t}</p></div>`,{url:t,scoped:rn(e),mod:e,heads:[],body:r,setup:void 0,scripts:[],styles:"",title:"",txt:"",tmp:null,customAttrs:{},err:n}}}const vn=new class{constructor(t=pn){this.moduleManager=t,this.cache=new yn,this.resourceLoader=new wn,this.parser=new bn(this.resourceLoader)}clear(){this.cache.clear(),this.moduleManager.clear()}addWrapper(t){this.moduleManager.addWrapper(t)}async getModule(t){return this.moduleManager.getModule(t)}readScopedHeaders(t){const e={};for(const[n,r]of t.headers.entries())n.startsWith("vhtml-")&&(e[n.slice(6)]=r);return e}async fetchFile(t){const e=await fetch(t);if(!e.ok)throw Error("HTTP error! status: "+e.status);return e.text()}async parseUI(t,e,n,r=!1){const o=n?.endsWith(".html")?n.slice(0,-5):n||"#inline",i=await this.moduleManager.getModule("");return this.parser.parse(t,i,o,r)}async fetchUI(t,e={},n=!1){const r=mn(t,rn(e));if(this.cache.templates.has(r))return this.cache.templates.get(r);if(this.cache.pending.has(r))return this.cache.pending.get(r);const o=this.doFetchUI(r,e,n);return this.cache.pending.set(r,o),o.finally((()=>{this.cache.pending.delete(r)}))}async doFetchUI(t,e={},n=!1){e=e||{};try{const e=await fetch(t);if(!e.ok)throw Error("HTTP error! status: "+e.status);const r=this.readScopedHeaders(e),o=ln(r.scoped||""),i=await this.moduleManager.getModule(o);this.moduleManager.patchModule(i,r);const s=await e.text(),c=t.endsWith(".html")?t.slice(0,-5):t,u=await this.parser.parse(s,i,c,n);return this.cache.templates.set(t,u),u}catch(r){const e=await this.moduleManager.getModule(""),n=this.parser.create404Descriptor(t,e,r);return this.cache.templates.set(t,n),n}}},gn={FetchUI:(t,e,n)=>vn.fetchUI(t,e,n),FetchFile:t=>vn.fetchFile(t),LoadScript:(t,e)=>vn.resourceLoader.loadScript(t,e),LoadLink:(t,e)=>vn.resourceLoader.loadLink(t,e),ParseUI:(t,e,n,r)=>vn.parseUI(t,e,n,r),getInstance:()=>vn,clearCache:()=>vn.clear(),addWrapper:t=>vn.addWrapper(t)};class xn{constructor(t,e="component"){this.host=t,this.kind=e,this.parent=null,this.children=new Set,this.vsrc="",this.data=null,this.runtime=null,this.ctx=null,this.mod=null,this.sys=null,this.router=null,this.route=null,this.cacheKey=null,this.scope=null,this.slots=null,this.slotOutletState=null,this.sourceNodes=null,this.vforData=null,this.events=null,this.parsed=!1,this.meta=null}}function Rn(t,e=null,n="component"){return function(t,e){return e?(e.parent&&e.parent!==t&&e.parent.children.delete(e),e.parent=t||null,t&&t.children.add(e),e):e}(e,new xn(t,n))}function On(t){t&&(t.parent&&(t.parent.children.delete(t),t.parent=null),t.children.forEach((t=>{t.parent=null})),t.children.clear())}class Sn{#t=new Set;#e=!1;#n=null;#r=null;onChange(t){return this.#t.add(t),()=>{this.#t.delete(t)}}notify(t){for(const e of this.#t)e(t)}init(){this.#e||(this.#e=!0,this.#n=t=>{const e=t.target.closest("a");if(!e)return;const n=e.getAttribute("href");!n||n.startsWith("http")||n.startsWith("#")||(t.preventDefault(),e.hasAttribute("reload")?window.location.href=n:this.push(n))},this.#r=()=>{this.notify({type:"popstate",url:window.location.href})},document.body.addEventListener("click",this.#n,!0),window.addEventListener("popstate",this.#r))}push(t){this.notify({type:"push",to:t})}replace(t){this.notify({type:"replace",to:t})}go(t){history.go(t)}back(){history.back()}forward(){history.forward()}}function En(t,e){let n,r="";if(t.startsWith("http://")||t.startsWith("https://")){if(n=new URL(t),n.origin!==window.location.origin)return null;r=n.pathname}else n=new URL(t,window.location.href),r=n.pathname;e&&r.startsWith(e)&&(r=r.slice(e.length)||"/");const o={};return n.searchParams.forEach(((t,e)=>{o[e]=t})),{path:r,query:o,hash:n.hash}}class jn{constructor(t,e){this.originalPath=t,this.name=e,this.keys=[],this.regexp=this.pathToRegexp(t)}pathToRegexp(t){let e=t.replace(/\/:([^(/?]+)\?/g,((t,e)=>(this.keys.push(e),`(?:/(?<${e}>[^/]+))?`)));return e=e.replace(/:([^(/?]+)/g,((t,e)=>(this.keys.push(e),`(?<${e}>[^/]+)`))),e=e.replace(/\*(\w+)/g,((t,e)=>(this.keys.push(e),`(?<${e}>.*)`))),e=e.replace(/\*/g,".*"),RegExp(`^${e}$`)}match(t){let e;if("string"==typeof t)e=t;else{if(!t?.path)return t?.name===this.name?{path:this.originalPath,params:t.params||{},matched:this.originalPath}:null;e=t.path}const n=this.regexp.exec(e);if(!n)return null;const r={};return this.keys.forEach((t=>{void 0!==n.groups?.[t]&&(r[t]=n.groups[t])})),{path:this.originalPath,params:r,matched:n[0]}}}function An(t){return Array.isArray(t)?{routes:t,beforeEnter:null,afterEnter:null}:Array.isArray(t?.routes)?{routes:t.routes,beforeEnter:t.beforeEnter||null,afterEnter:t.afterEnter||null}:{routes:[],beforeEnter:t?.beforeEnter||null,afterEnter:t?.afterEnter||null}}const kn=new WeakMap,Tn=new WeakSet;function $n(t,e=!1){if(!t)return null;let n=kn.get(t);return!n&&e&&(n={},kn.set(t,n)),n}function Nn(t,e){const n=$n(t);n&&(delete n[e],0===Object.keys(n).length&&kn.delete(t))}function Cn(t,e,n=null){return $n(t)?.[e]??n}function Pn(t,e,n){return null==n?(Nn(t,e),n):($n(t,!0)[e]=n,n)}function Ln(t){t&&!Tn.has(t)&&(Object.defineProperties(t,{$data:{configurable:!0,enumerable:!1,get:()=>Wn(t)},$sys:{configurable:!0,enumerable:!1,get:()=>function(t){return Un(t)?.sys??Cn(t,"sys")}(t)},$ctx:{configurable:!0,enumerable:!1,get:()=>function(t){return Un(t)?.ctx??Cn(t,"ctx")}(t)},$mod:{configurable:!0,enumerable:!1,get:()=>function(t){return Un(t)?.mod??Cn(t,"mod")}(t)},$router:{configurable:!0,enumerable:!1,get:()=>_n(t)}}),Tn.add(t))}function Un(t){return Cn(t,"instance")}function Dn(t,e){return Ln(t),Pn(t,"instance",e)}function Fn(t,e=null){let n=t;for(;n;){const t=Un(n);if(t)return t;n=n.parentNode||n.host||null}return e}function In(t){return Un(t)?.scope??Cn(t,"scope")}function Mn(t,e){const n=Un(t);return n&&(n.scope=e||null),Pn(t,"scope",e)}function qn(t){return Un(t)?.runtime??Cn(t,"runtime")}function Bn(t,e){Ln(t);const n=Un(t);return n&&(n.runtime=e||null,n.sys=e?.$sys||null,n.ctx=e?.$ctx||null,n.mod=e?.$mod||null),Pn(t,"sys",e?.$sys||null),Pn(t,"ctx",e?.$ctx||null),Pn(t,"mod",e?.$mod||null),Pn(t,"runtime",e)}function _n(t){return Un(t)?.router??Cn(t,"router")}function zn(t,e){Ln(t);const n=Un(t);return n&&(n.router=e||null),Pn(t,"router",e)}function Hn(t,e=null){let n=t;for(;n;){const t=_n(n);if(t)return t;n=n.parentNode||n.host||null}return e}function Wn(t){return Un(t)?.data??Cn(t,"data")}function Jn(t,e){Ln(t);const n=Un(t);return n&&(n.data=e||null),Pn(t,"data",e)}function Kn(t){return Un(t)?.sourceNodes??Cn(t,"sourceNodes")}function Vn(t,e){const n=Un(t);return n&&(n.sourceNodes=e||null),Pn(t,"sourceNodes",e)}function Xn(t,e){const n=Un(t);return n&&(n.vforData=e||null),Pn(t,"vforData",e)}function Gn(t){const e=Un(t);return!!(e?.parsed??Cn(t,"parsed",!1))}function Zn(t,e=!0){const n=Un(t);return n&&(n.parsed=e),$n(t,!0).parsed=e,e}function Yn(t,e=!0){if(!t)return;const n=Kn(t),r=Un(t);kn.delete(t),r&&(On(r),Dn(t,null)),e&&void 0!==n&&Vn(t,n)}function Qn(t){t&&(Array.from(t.children).forEach((t=>{Qn(t)})),t.scope?.dispose(t.host),Yn(t.host))}function tr(t){if(!t||1!==t.nodeType)return;const e=Un(t);e?Qn(e):(In(t)?.dispose(t),Yn(t),t.childNodes?.forEach((t=>{1===t.nodeType&&tr(t)})))}function er(t,e){if(!t||"string"!=typeof e)return;const n=Fn(t,null);if(n){const t=new Set,r=n=>{if(!n||t.has(n))return;t.add(n);const o=n.scope;o&&"function"==typeof o[e]&&o[e](n.host),n.children.forEach((t=>{r(t)}))};return void r(n)}const r=In(t);r&&"function"==typeof r[e]&&r[e](t)}class nr{constructor(t,e,n,r,o){this.ownerView=t,this.vhtml=e,this.node=n,this.instance=Rn(n,t.instance,"page"),this.instance.meta={htmlPath:this.resolveHtmlPath(r),title:"",titleWatchers:[],didInitialActivation:!1,layoutOutlet:null},this.instance.route=r,this.instance.cacheKey=o,this.layoutInstance=null}get meta(){return this.instance.meta}get matchedRoute(){return this.instance.route}set matchedRoute(t){this.instance.route=t||null}get cacheKey(){return this.instance.cacheKey}get htmlPath(){return this.meta.htmlPath}get dom(){return this.instance.host}set dom(t){this.instance.host=t||null}get layoutDom(){return this.layoutInstance?.host||null}set layoutDom(t){t?this.layoutInstance?this.layoutInstance.host=t:this.layoutInstance=Rn(t,this.instance,"layout"):this.layoutInstance&&(this.layoutInstance.host=null)}resolveHtmlPath(t){let e=t.route.component||t.route.path;return"function"==typeof e&&(e=e(t.path)),Object.entries(t.params).forEach((([t,n])=>{e=e.replace(":"+t,n)})),e.startsWith("/")||(e="/"+e),e.endsWith("/")&&(e=e.slice(0,-1)),e.endsWith(".html")||(e+=".html"),e}updateRouter(t){this.matchedRoute=t;const e=this.runtime()?.$sys?.$router;e&&Object.assign(e.current,{path:t.path,fullPath:t.fullPath,params:t.params,query:t.query,hash:new URL(t.fullPath,window.location.origin).hash,meta:t.route?.meta||{},name:t.route?.name})}roots(){return this.layoutInstance?.host?[this.layoutInstance.host]:this.instance.host?[this.instance.host]:[]}runtime(){return this.instance.runtime||this.layoutInstance?.runtime||qn(this.dom)||qn(this.layoutDom)||null}outlet(){return this.layoutDom?(this.meta.layoutOutlet=this.meta.layoutOutlet||this.layoutDom.querySelector("[data-vrouter-outlet]")||this.layoutDom,this.meta.layoutOutlet):this.node}attach(){if(this.layoutDom){this.layoutDom.isConnected||(this.node.innerHTML="",this.node.append(this.layoutDom));const t=this.outlet();return this.dom&&this.dom.parentNode!==t&&(t.innerHTML="",t.append(this.dom)),this.layoutInstance.host=this.layoutDom,this.layoutInstance.runtime=qn(this.layoutDom)||this.runtime(),this.instance.host=this.dom,void(this.instance.runtime=qn(this.dom)||this.layoutInstance.runtime)}this.dom&&!this.dom.isConnected&&(this.node.innerHTML="",this.node.append(this.dom)),this.instance.host=this.dom,this.instance.runtime=qn(this.dom)||this.ownerView.instance.runtime}async mount(t,e){const n=await gn.FetchUI(this.htmlPath,t);if(n.err)throw Error(`load page failed: ${this.htmlPath} ${n.err}`);if(this.meta.title=n.title||"",this.dom=document.createElement("div"),this.dom.setAttribute("vsrc",this.htmlPath),this.dom.setAttribute("data-vrouter-cache",""),!e)return this.node.innerHTML="",this.node.append(this.dom),await this.vhtml.parseRef(this.htmlPath,this.dom,{},t,null),this.instance.host=this.dom,this.instance.runtime=qn(this.dom)||t||null,void this.activate();let r=e;r.startsWith("/")||(r="/"+r),r.endsWith(".html")||(r+=".html"),r.startsWith("/layout")||(r="/layout"+r);const o=await gn.FetchUI(r,t);if(o.err)throw Error(`load layout failed: ${r} ${o.err}`);this.layoutDom=function(t){if(!t)return null;const e=t.querySelector("vslot:not([name])")||t.querySelector("vslot");return e?(e.setAttribute("data-vrouter-outlet",""),e.setAttribute("data-vrouter-managed",""),t):t}(o.body.cloneNode(!0)),this.layoutDom?.setAttribute("data-vrouter-layout",""),this.node.innerHTML="",this.node.append(this.layoutDom),await this.vhtml.parseRef("/layout/"+e,this.layoutDom,{},t,null,!0);const i=qn(this.layoutDom)||t||null;this.layoutInstance.runtime=i,this.outlet().innerHTML="",this.outlet().append(this.dom),await this.vhtml.parseRef(this.htmlPath,this.dom,{},i,null),this.instance.host=this.dom,this.instance.runtime=qn(this.dom)||this.layoutInstance.runtime,this.activate()}updateTitle(){if(this.clearTitleWatchers(),!this.meta.title)return;const t=this.meta.title.trim();if(!t.includes("{{"))return void(document.title=t);if(!this.dom&&!this.layoutDom)return;const e=this.runtime()||{},n=/{{|}}/g;let r,o=0,i=-1;const s=[];for(;null!==(r=n.exec(t));)if("{{"===r[0])i=r.index;else if(i>=0){o!==i&&s.push(t.slice(o,i)),s.push("");const n=t.slice(i+2,r.index),c=s.length-1;o=r.index+2,i=-1;const u=O.Watch((()=>{let t=O.Run(n,{},e||{});"function"==typeof t?t=t():"object"==typeof t&&t&&(t=JSON.stringify(t)),s[c]=t,document.title=s.join("")}));this.meta.titleWatchers.push(u)}s.push(t.slice(o)),document.title=s.join("")}clearTitleWatchers(){for(;this.meta.titleWatchers.length>0;)O.Cancel(this.meta.titleWatchers.pop())}activate(){this.updateTitle(),this.attach(),this.meta.didInitialActivation?this.roots().forEach((t=>er(t,"activate"))):this.meta.didInitialActivation=!0}deactive(){this.clearTitleWatchers(),this.meta.didInitialActivation&&this.roots().forEach((t=>er(t,"deactive")))}destroy(){this.clearTitleWatchers(),On(this.layoutInstance),On(this.instance),this.layoutInstance=null}}class rr{#o=[];#i=[];#s=new Map;#c=null;constructor(t){this.#c=t,this.instance=Rn(null,null,"router-view"),this.instance.data=O.Wrap({}),this.instance.route=this.instance.data,this.instance.meta={history:[],pageCache:new Map,routesSource:"/routes.js",beforeEnter:null,afterEnter:null,listeners:new Set,hostNode:null,renderer:null,disposeNavListener:null}}get routes(){return[...this.#o,...this.#i]}get history(){return this.instance.meta.history.slice()}get current(){return this.instance.data}get query(){return this.instance.data?.query||{}}get params(){return this.instance.data?.params||{}}get modulePath(){return rn(this.instance.runtime)}get routesSource(){return this.instance.meta.routesSource}get runtime(){return this.instance.runtime}get activePage(){return this.instance.currentPage||null}set activePage(t){this.instance.currentPage=t||null}get beforeEnter(){return this.instance.meta.beforeEnter}set beforeEnter(t){this.instance.meta.beforeEnter="function"==typeof t?t:null}get afterEnter(){return this.instance.meta.afterEnter}set afterEnter(t){this.instance.meta.afterEnter="function"==typeof t?t:null}get pageCache(){return this.instance.meta.pageCache}get listeners(){return this.instance.meta.listeners}get hostNode(){return this.instance.meta.hostNode}set hostNode(t){this.instance.meta.hostNode=t||null}get renderer(){return this.instance.meta.renderer}set renderer(t){this.instance.meta.renderer=t||null}get disposeNavListener(){return this.instance.meta.disposeNavListener||null}set disposeNavListener(t){this.instance.meta.disposeNavListener=t||null}onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}#u(t,e){for(const n of this.listeners)n(t,e)}#a(t){return{path:t.path,fullPath:t.fullPath,params:{...t.params||{}},query:{...t.query||{}},hash:t.hash||"",meta:{...t.meta||{}},description:t.description||"",layout:t.layout||"",name:t.name,matched:[...t.matched||[]]}}#l(t,e="push"){const n=this.#a(this.current),r=this.#a({path:t.path,fullPath:t.fullPath,params:t.params||{},query:t.query||{},hash:new URL(t.fullPath,window.location.origin).hash,meta:t.route?.meta||{},description:t.route?.description||"",layout:t.route?.layout||"",name:t.route?.name,matched:t.route?[t.route]:[]});Object.assign(this.current,r),"replace"===e&&this.instance.meta.history.length>0?this.instance.meta.history[this.instance.meta.history.length-1]=r:this.instance.meta.history.push(r);const o=this.modulePath&&!t.fullPath.startsWith("http")?`${this.modulePath}${t.fullPath}`:t.fullPath;"replace"===e?history.replaceState({},"",o):history.pushState({},"",o),this.#u(this.current,n)}#f(t){return/[:*?()[\]{}^$+.]/.test(t)}addRoute(t){if(!t.path)throw Error("Route must have a path");"/"!==t.path&&t.path.endsWith("/")&&(t.path=t.path.slice(0,-1));const e={path:t.path,component:t.component,redirect:t.redirect,name:t.name,meta:t.meta||{},children:t.children||[],matcher:new jn(t.path,t.name),description:t.description||"",layout:t.layout||"",cacheKey:t.cacheKey};this.#f(t.path)?this.#i.push(e):this.#o.push(e),t.name&&this.#s.set(t.name,e),t.children?.length>0&&t.children.forEach((n=>{const r=t.path+(n.path.startsWith("/")?n.path:"/"+n.path),o=n.layout||t.layout||"",i={...t.meta,...n.meta};this.addRoute({...n,path:r,parent:e,layout:o,meta:i})}))}addRoutes(t){t.forEach((t=>this.addRoute(t)))}resetRoutes(){this.activePage?.deactive(),this.pageCache.forEach((t=>{t.destroy()})),this.#o=[],this.#i=[],this.#s=new Map,this.instance.meta.history=[],this.instance.meta.pageCache=new Map,this.activePage=null}normalizeRouteTarget(t){let e,n,r={},o={},i="";if("string"==typeof t){const n=En(t,this.modulePath);if(!n)return null;e=n.path,r={...n.query},i=n.hash}else{if(!t||"object"!=typeof t)return null;if(t.path){const n=En(t.path,this.modulePath);if(!n)return null;e=n.path,r={...n.query,...t.query||{}},i=t.hash||n.hash,o=t.params||{}}else{if(!t.name)return null;n=t.name,r=t.query||{},o=t.params||{},i=t.hash||""}}return e&&!e.startsWith("/")&&(e="/"+e),this.modulePath&&e?.startsWith(this.modulePath)&&(e=e.slice(this.modulePath.length)||"/"),e&&!e.startsWith("/")&&(e="/"+e),"/"!==e&&e?.endsWith("/")&&(e=e.slice(0,-1)),{path:e,query:r,params:o,hash:i,name:n}}matchRoute(t){const e=this.normalizeRouteTarget(t);if(!e)return null;const{path:n,query:r,params:o,name:i}=e;if(i){const t=this.#s.get(i);if(!t)return null;let e=t.path;Object.entries(o).forEach((([t,n])=>{e=e.replace(":"+t,n)}));const n=t.matcher.match(e);return n?{route:t,params:{...n.params,...o},matched:n.matched,path:e,query:r,name:i}:null}for(const s of this.#o)if(s.path===n&&(s.component||s.redirect))return{route:s,params:{...o},matched:n,path:n,query:r,name:s.name};for(const s of this.#i){const t=s.matcher.match(n);if(t&&(s.component||s.redirect))return{route:s,params:{...t.params,...o},matched:t.matched,path:n,query:r,name:s.name}}return null}matchTo(t){const e=this.matchRoute(t);if(!e)return null;const{route:n,params:r,query:o,path:i,name:s}=e;let c="";o&&Object.keys(o).length>0&&(c="?"+Object.entries(o).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`)).join("&"));const u=`${i||e.path}${c}`;return{route:n,params:r,query:o,name:s||n.name,path:i||e.path,fullPath:u,matched:[n]}}resolveCacheKey(t,e){const n=t.cacheKey;return!1===n?null:void 0===n||!0===n?e.fullPath:"string"==typeof n?n:"function"==typeof n?n(e):e.fullPath}async#h(t,e="push"){if(!t)return;const{route:n,params:r,query:o}=t;if(n.redirect){const e="function"==typeof n.redirect?n.redirect(t):n.redirect;return void this.push(e)}if(this.activePage&&this.current?.fullPath===t.fullPath)return;const i={path:t.path,fullPath:t.fullPath,params:r,query:o,hash:new URL(t.fullPath,window.location.origin).hash,meta:n.meta,description:n.description,layout:n.layout,name:n.name,matched:[n]};if(this.beforeEnter){let t=!0;if(!1===await this.beforeEnter(i,this.current,(e=>{e&&(t=!1,this.push(e))}))||!t)return}const s=this.resolveCacheKey(n,t);if(this.activePage?.deactive(),this.#l(t,e),s&&this.pageCache.has(s)){const e=this.pageCache.get(s);return e.matchedRoute.fullPath!==t.fullPath&&e.updateRouter(t),e.activate(),this.activePage=e,void("function"==typeof this.afterEnter&&this.afterEnter(i,this.current))}const c=new nr(this,this.renderer,this.hostNode,t,s);s&&this.pageCache.set(s,c),await c.mount(this.runtime,i.layout),this.activePage=c,"function"==typeof this.afterEnter&&this.afterEnter(i,this.current)}async push(t){this.#c.push(t)}replace(t){this.#c.replace(t)}go(t){this.#c.go(t)}back(){this.#c.back()}forward(){this.#c.forward()}resolveRoutesUrl(t=this.routesSource,e=this.runtime||{}){const n=t||"/routes.js";return/^https?:\/\//.test(n)?n:n.startsWith("/")?fn(n,rn(e)):fn("/"+n.replace(/^\.?\//,""),rn(e))}async loadRoutes(){const t=this.resolveRoutesUrl(this.routesSource,this.runtime||{});return async function(t,e={}){let n=t;if("function"==typeof n?.default)n=await n.default(e);else if("function"==typeof n)n=await n(e);else if(n?.default){const t=An(n.default);if(t.routes.length||t.beforeEnter||t.afterEnter)return{routes:t.routes,beforeEnter:t.beforeEnter||n.beforeEnter||null,afterEnter:t.afterEnter||n.afterEnter||null}}return An(n)}(await import(t),{$mod:this.runtime?.$mod||null,router:this})}async handleNavigation(t){const e="popstate"===t?.type?t.url:t?.to,n="replace"===t?.type||"popstate"===t?.type?"replace":"push";if(!e)return;const r=this.matchTo(e);r&&await this.#h(r,n)}async mount(t,e,n){this.hostNode=e,this.instance.runtime=dn(n||null,n?.$mod||n||null,{$router:this}),this.instance.host=e,this.instance.router=this,zn(e,this),this.instance.meta.routesSource=e.getAttribute("routes")||"/routes.js",this.renderer=t,this.resetRoutes(),this.disposeNavListener?.(),this.disposeNavListener=this.#c.onChange((t=>{this.handleNavigation(t)}));const r=await this.loadRoutes();this.beforeEnter=r.beforeEnter||null,this.afterEnter=r.afterEnter||null,this.addRoutes(r.routes),await this.handleNavigation({type:"replace",to:window.location.href})}}const or=new class{#c=new Sn;#d=new WeakMap;constructor(){this.#c.init()}push(t){this.#c.push(t)}replace(t){this.#c.replace(t)}go(t){this.#c.go(t)}back(){this.#c.back()}forward(){this.#c.forward()}mountView(t,e,n){let r=this.#d.get(e);return r||(r=new rr(this.#c),this.#d.set(e,r)),r.mount(t,e,n),r}},ir={$router:or},sr=[];document.addEventListener("click",(t=>{sr.forEach((e=>{e?.dom instanceof Element&&"function"==typeof e?.callback&&(e.dom.contains(t.target)||e.callback(t))}))}));const cr={CamelToKebabCase:function(t){return 0===t.length?"":t.charAt(0).toLowerCase()+t.slice(1).replace(/([A-Z])/g,(function(t,e){return"-"+e.toLowerCase()}))},EventsList:["load","unload","beforeunload","resize","scroll","submit","reset","input","change","focus","blur","keydown","keypress","keyup","click","dblclick","contextmenu","mousedown","mouseup","mousemove","mouseover","mouseout","mouseenter","mouseleave","touchstart","touchmove","touchend","touchcancel","drag","dragstart","dragend","dragover","dragenter","dragleave","drop","copy","cut","paste","animationstart","animationend","animationiteration","transitionend","abort","error","loadstart","progress","play","pause","ended","volumechange","timeupdate","loadeddata","waiting","playing","online","offline","storage","visibilitychange"],BindInputDomValue:function(t,e,n,r,o){const i="string"==typeof t?document.querySelector(t):t;if(!i)return;const s=(t,e)=>r(t,e),c=(t,e)=>{o?.addEventListener?o.addEventListener(i,t,e):i.addEventListener(t,e)};switch(i.type||i.tagName.toLowerCase()){case"text":case"password":case"email":case"tel":case"url":case"search":case"number":case"range":case"color":case"date":case"time":case"datetime-local":case"month":case"week":case"hidden":case"textarea":s((()=>e[n]),(t=>{i.value=void 0===t?"":t})),c("input",(function(){e[n]=this.value}));break;case"checkbox":s((function(){i.checked=!!e[n]})),c("change",(function(){e[n]=this.checked}));break;case"radio":s((()=>{i.checked=i.value===e[n]})),c("change",(function(){this.checked&&(e[n]=this.value)}));break;case"select-one":case"select-multiple":s((()=>{let t=e[n];if(i.multiple){const e=Array.isArray(t)?t:[];for(let t=0;t<i.options.length;t++)i.options[t].selected=e.includes(i.options[t].value)}else i.value=t||""})),c("change",(function(){if(this.multiple){const t=[];for(let e=0;e<this.options.length;e++)this.options[e].selected&&t.push(this.options[e].value);e[n]=t}else e[n]=this.value}));break;default:return!1}return!0},SetAttr:function(t,e,n){"function"==typeof n&&(n=n());const r=new Set(["innerHTML","innerText","outerHTML","textContent","value","checked","selected","disabled","readOnly","maxLength","minLength","htmlFor","tabIndex","scrollTop","scrollLeft","scrollWidth","scrollHeight","clientWidth","clientHeight","offsetWidth","offsetHeight","style","dataset"]),o=new Set(["checked","selected","disabled","readonly","required","hidden","autofocus","multiple","novalidate"]),i=e.toLowerCase(),s={htmlfor:"htmlFor",readonly:"readOnly",maxlength:"maxLength",minlength:"minLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable",spellcheck:"spellcheck",innerhtml:"innerHTML",innertext:"innerText",autocapitalize:"autocapitalize"}[i]||e;r.has(s)?t[s]=void 0===n?"":n:o.has(i)?n?t.setAttribute(i,""):t.removeAttribute(i):void 0===n?t.removeAttribute(e):t.setAttribute(e,n)},AddClicker:(t,e,n)=>{if("outer"===e){let e=sr.length;return sr.push({dom:t,callback:n}),()=>{sr[e]=null}}}};function ur(t,e,n,r){const o=Un(e),i=o?.data||Wn(e)||n||{},s=o?.runtime||qn(e)||r||{};return s.$sys&&(s.$sys.$router=Hn(e,s.$sys.$router||null)),O.AsyncRun(t,i,s,function(t,e,n){const r=Un(t);return{$node:t,$watch:(e,n,o)=>{const i=r?.scope||In(t),s=O.Watch(e,n,o);return i?.addWatcher((()=>O.Cancel(s))),s},$scope:r?.scope||In(t),$router:Hn(t,n?.$sys?.$router||null)}}(e,0,s)).catch((t=>{throw t}))}function ar(t,e,n,r){const o=t.innerHTML,i=Un(e),s=i?.scope||In(e);t.hasAttribute("active")?s?.onActive((()=>{ur(o,e,n,qn(e)||r)})):t.hasAttribute("deactive")?s?.onDeactive((()=>{ur(o,e,n,qn(e)||r)})):t.hasAttribute("dispose")?s?.onDispose((()=>{ur(o,e,n,qn(e)||r)})):ur(o,e,n,qn(e)||r||{})}function lr(t,e){return t.contextOf?t.contextOf(e).scope:t.scopeOf(e)||In(e)}function fr(t,e,n,r){const o=lr(t,e);if(!e.hasAttribute("href")&&!e.hasAttribute(":href"))return;if(e.hasAttribute(":href")){const i=e.getAttribute(":href");e.removeAttribute(":href"),t.watch(o,(()=>{let t=O.Run(i,n,r);!t||t.startsWith("#")||t.startsWith("http")||(t.startsWith("@")?e.setAttribute("href",t.slice(1)):(r?.$mod?.scoped&&(t=r.$mod.scoped+t),e.setAttribute("href",t)))}))}else{let t=e.getAttribute("href");if(!t||t.startsWith("#")||t.startsWith("http"))return;t.startsWith("@")?e.setAttribute("href",t.slice(1)):(r?.$mod?.scoped&&(t=r.$mod.scoped+t),e.setAttribute("href",t))}const i=t=>{const n=t?.fullPath;e.getAttribute("href")===n?e.setAttribute("active",""):e.removeAttribute("active")},s=function(t,e){let n=t;for(;n;){const t=_n(n);if(t)return t;n=n.parentNode||n.host||null}return e?.$sys?.$router||null}(e,r);if(!s)return;i(s?.current);const c=s?.onChange?.(i);o?.addCleanup(c)}function hr(t,e,n,r,o,i){const s=lr(t,e);if(n.startsWith(":")){const c=n.slice(1);return"class"===c||"style"===c?dr(t,e,c,r,o,i):t.watch(s,(()=>{const t=r?O.Run(r,o,i):o[c];cr.SetAttr(e,c,t)})),!0}if(n.startsWith("@"))return pr(t,e,n,r,o,i),!0;if(n.indexOf("!")>-1);else if(n.startsWith("v:")){const n=t.findLastAccess(r,o);if(n&&n.data&&n.key)return cr.BindInputDomValue(e,n.data,n.key,((e,n)=>t.watch(s,e,n)),s)}else if("ref"===n){const t=r?.trim?.()||"",n=function(t){return t&&"object"==typeof t?(t.$refs&&"object"==typeof t.$refs||(t.$refs=O.Wrap({})),t.$refs):null}(o);return t&&n&&(n[t]=e,s?.addCleanup((()=>{n[t]===e&&(n[t]=null)}))),!0}return!1}function dr(t,e,n,r,o,i){const s=lr(t,e);let c="";t.watch(s,(()=>{let t=O.Run(r,o,i);if("function"==typeof t&&(t=t()),"class"===n){if(c&&(e.classList.remove(...c.split(/\s+/)),c=""),t instanceof Array)c="",t.forEach((t=>{if("string"==typeof t&&t.length)c+=" "+t;else if("object"==typeof t&&t)for(const e in t)t[e]&&(c+=" "+e)}));else if("string"==typeof t&&t.length)c=t.trim();else if("object"==typeof t&&t){c="";for(const e in t)t[e]&&(c+=" "+e)}return c=c.trim(),void(c&&e.classList.add(...c.split(/\s+/)))}if(c)if("object"==typeof c)for(const n in c)n.startsWith("--")?e.style.removeProperty(n):e.style[n]="";else"string"==typeof c&&c.split(";").forEach((t=>{const n=t.split(":");if(2!==n.length)return;const r=n[0].trim();r.startsWith("--")?e.style.removeProperty(r):e.style[r]=""}));if("object"==typeof t&&t)for(const n in t)n.startsWith("--")?e.style.setProperty(n,t[n]):e.style[n]=t[n];else"string"==typeof t&&t.split(";").forEach((t=>{const n=t.split(":");if(2!==n.length)return;const r=n[0].trim(),o=n[1].trim();r.startsWith("--")?e.style.setProperty(r,o):e.style[r]=o}));c=t}))}function pr(t,e,n,r,o,i){const s=lr(t,e),c=n.slice(1).split("."),u={self:!1,prevent:!1,stop:!1},a=c[0];if("mounted"===a)return void t.onMountedRun(e,(t=>{!function(t,e,n,r){let o=O.Run(r,e,n);"function"==typeof o&&o(t)}(t,o,i,r)}),!1);if("outerclick"===a){const t=t=>{const e=O.Run(r,o,i,{$event:t});"function"==typeof e&&e(t)},n=cr.AddClicker(e,"outer",t);return void s?.addCleanup(n)}if(-1===cr.EventsList.indexOf(a))return void((function(t){const e=Un(t);e&&(e.events||(e.events={}));const n=$n(t,!0);return n.events||(n.events={}),e?.events||n.events}(e))[a]=(...t)=>{const e=O.Run(r,o,i,{});"function"==typeof e&&e(...t)});"keydown"!==a&&"keyup"!==a&&"keypress"!==a||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.setAttribute("tabindex","0");let l=t=>{const e=O.Run(r,o,i,{$event:t});"function"==typeof e&&e(t)},f=null;c.slice(1).forEach((t=>{if(t.startsWith("delay")){let e=t.slice(5);e=e?e.endsWith("ms")?+e.slice(0,-2):e.endsWith("s")?1e3*+e.slice(0,-1):+e:1e3,isNaN(e)&&(e=1e3),l=t=>{"number"==typeof f&&(s?.clearTimeout(f)||clearTimeout(f)),f=s?.setTimeout((()=>{const e=O.Run(r,o,i,{$event:t});"function"==typeof e&&e(t)}),e)||setTimeout((()=>{const e=O.Run(r,o,i,{$event:t});"function"==typeof e&&e(t)}),e)}}u[t]=!0}));const h=t=>{(1>=c.length||"keydown"!==a&&"keyup"!==a&&"keypress"!==a||c[1]===t.key?.toLowerCase())&&(u.self&&t.currentTarget!==t.target||(u.prevent&&t.preventDefault(),u.stop&&t.stopPropagation(),l(t)))};s?.addEventListener?s.addEventListener(e,a,h):e.addEventListener(a,h)}class mr{constructor(t=null){this.host=t,this.cleanups=[],this.timers=new Set,this.intervals=new Set,this.lifecycle={active:[],deactive:[],dispose:[]},this.state="created"}addCleanup(t){return"function"==typeof t&&this.cleanups.push(t),t}addWatcher(t){return this.addCleanup(t)}addEventListener(t,e,n,r){return t?.addEventListener&&"function"==typeof n?(t.addEventListener(e,n,r),this.addCleanup((()=>t.removeEventListener(e,n,r))),n):null}setTimeout(t,e){const n=window.setTimeout((()=>{this.timers.delete(n),t()}),e);return this.timers.add(n),n}setInterval(t,e){const n=window.setInterval(t,e);return this.intervals.add(n),n}clearTimeout(t){this.timers.has(t)&&(this.timers.delete(t),window.clearTimeout(t))}clearInterval(t){this.intervals.has(t)&&(this.intervals.delete(t),window.clearInterval(t))}onActive(t){"function"==typeof t&&this.lifecycle.active.push(t)}onDeactive(t){"function"==typeof t&&this.lifecycle.deactive.push(t)}onDispose(t){"function"==typeof t&&this.lifecycle.dispose.push(t)}activate(t){this.state="active";for(const e of this.lifecycle.active)e(t)}deactive(t){this.state="inactive";for(const e of this.lifecycle.deactive)e(t)}dispose(t){if("disposed"!==this.state){this.state="disposed";for(const e of this.lifecycle.dispose)e(t);for(const t of this.cleanups.splice(0))t();for(const t of this.timers)window.clearTimeout(t);this.timers.clear();for(const t of this.intervals)window.clearInterval(t);this.intervals.clear()}}}const yr=/{{|}}/g,wr=/^\s*(?:\((\w+)\s*,\s*(\w+)\)|(\w+))\s+in\s+(.+?)\s*$/;function br(t,e,n=null){return t.runtimeOf?t.runtimeOf(e,n):{instance:Un(e)||Fn(e,null),scope:t.scopeOf(e)||In(e),runtime:qn(e)||n}}function vr(t,e,n){let r=Un(t);r||(r=Rn(t,Fn(t.parentNode||null,null),"boundary"),Dn(t,r)),r.scope||Mn(t,new mr(t)),void 0!==e&&Jn(t,e);const o=n||qn(t)||null;return o&&(Bn(t,o),zn(t,Hn(t,o.$sys?.$router||null))),r}function gr(t){if(!t||1!==t.nodeType)return;const e=In(t);e?.dispose(t),On(Un(t)),function(t){Yn(t)}(t)}function xr(t,e){return t.contextOf?t.contextOf(e):{instance:Un(e)||Fn(e,null),scope:t.scopeOf(e)||In(e)}}function Rr(t){return(t||[]).map((t=>t.cloneNode(!0)))}function Or(t){return null==t?"":t+""}function Sr(t,e,n,r,o){e.innerHTML="",e.append(...Rr(n));const i=xr(t,e).scope;t.parseVif(Array.from(e.childNodes),r,o).forEach((e=>{1===e.nodeType?function(t,e,n){vr(t,e,n)}(e,r,o):(Bn(e,o),i&&Mn(e,i)),t.parseDom(e,r,o,i)}))}function Er(t){t.cleanup?.(),t.cleanup=null}function jr(t,e,n,r){if(e.hasAttribute?.("data-vrouter-managed"))return t.parseAttrs(e,n,r),e;const o=function(t){const e=t.getAttribute("vrefof");let n=t.closest(`*[vref='${e}']`);if(!n)return null;for(;;){const t=n?.parentNode?.closest?.("*[vref]");if(!t)break;if(t.getAttribute("vref")!==e)break;n=t}return n}(e);if(!o)return t.onMountedRun(e,(e=>{jr(t,e,n,r)})),e;const i=function(t){const e=(n=t,Un(n)?.slotOutletState??Cn(n,"slotOutletState"));var n;if(e)return e;const r={fallbackTemplates:Rr(Array.from(t.childNodes)),currentKey:"",currentMode:"",cleanup:null};return t.innerHTML="",function(t,e){const n=Un(t);n&&(n.slotOutletState=e||null),Pn(t,"slotOutletState",e)}(t,r),r}(e),s=xr(t,e);return t.watch(s.scope,(()=>{const t=function(t,e,n){return t.hasAttribute(":name")?Or(O.Run(t.getAttribute(":name"),e,n)):Or(t.getAttribute("name"))}(e,n,r),i=Fn(o,null);var s;return{slotName:t,selected:(i?.slots||(s=o,Un(s)?.slots??Cn(s,"slotContents"))||{})[t]||null}}),(({slotName:o,selected:s})=>{if(s){const r=`projected:${o}:${s.id}`;if(i.currentKey===r&&"projected"===i.currentMode)return;Er(i);const c=function(t,e,n,r){const o=e.getAttribute("vbind");if(!o)return{data:r,cleanup:null};const i=O.Wrap({});O.SetDataRoot(i,r);const s=o.split(",").map((t=>t.trim())).filter(Boolean),c=xr(t,e).scope,u=[];return s.forEach((e=>{const r=t.watch(c,(()=>n[e]),(t=>{i[e]=t}),{deep:!0});u.push(r),i[e]=n[e]})),{data:i,cleanup:()=>u.forEach((t=>O.Cancel(t)))}}(t,e,n,s.data);return Sr(t,e,s.templates,c.data,s.runtime),i.currentKey=r,i.currentMode="projected",void(i.cleanup=c.cleanup)}const c="fallback:"+o;i.currentKey===c&&"fallback"===i.currentMode||(Er(i),Sr(t,e,i.fallbackTemplates,n,r),i.currentKey=c,i.currentMode="fallback")})),t.parseAttrs(e,n,r),e}function Ar(t,e){if(t.startsWith("/"))return t;const n=e.substring(0,e.lastIndexOf("/")).split("/").filter((t=>""!==t)),r=t.split("/").filter((t=>""!==t));for(const o of r)".."!==o?"."!==o&&n.push(o):n.length>0&&n.pop();return"/"+n.join("/")}function kr(t,e,n){return t.startsWith("@")?t=t.slice(1):t.startsWith("http")||(t=t.startsWith("/")?e?`${e}${t}`:t:Ar(t,n)),t.endsWith(".js")||(t+=".js"),t.startsWith("http")||(t=`${window.location.origin}${t}`),t}function Tr(t,e){const n=t.trim();if(/^\w+$/.test(n))return n;if(/^{[\w\s,]+}$/.test(n))return n.slice(1,-1).split(",").map((t=>t.trim())).filter(Boolean);throw Error("unsupported import: "+e)}async function $r(t,e,n){if("string"==typeof t)return void(n[t]=e.default??e);const r=e.default||{};t.forEach((t=>{t in e?n[t]=e[t]:t in r&&(n[t]=r[t])}))}function Nr(t,e,n=null){return t.runtimeOf?t.runtimeOf(e,n):{instance:Un(e),scope:In(e),runtime:qn(e)||n}}async function Cr(t,e,n,r,o,i=!1){const s=O.Wrap({$refs:O.Wrap({})}),c=Nr(t,e,r);if(o.setup){let n=o.setup.innerHTML;n=await async function(t,e={},n={},r=""){const o=rn(n),i=function(t="",e=""){return t?t.startsWith("http")||!e||t.startsWith(e)?t:`${e}${t}`:e||"/"}(r,o);let s,c=t;const u=/await import\(['"]([^'"]+)['"]\)/gm;for(;null!==(s=u.exec(t));){let t=s[1];t.startsWith("http")||(t=Ar(t,i),t=`${window.location.origin}${t}`),c=c.replace(s[0],`await import('${t}')`)}const a=/^[\s/]*import\s+([\w{},\s]+)\s+from\s+['"]([^'"]+)['"][;\s]*$/gm;for(;null!==(s=a.exec(t));)if(c=c.replace(s[0],""),!s[0].trim().startsWith("//"))try{const t=kr(s[2],o,i),n=Tr(s[1],s[0]),r=await import(t);await $r(n,r,e)}catch(l){}return c.trim()}(n,s,c.runtime,o.url),await O.AsyncRun(n,s,c.runtime,{$node:e,$watch:(n,r,o)=>{const i=Nr(t,e,c.runtime).scope,s=()=>{t.watch(Nr(t,e,c.runtime).scope,n,r,o)};i?i.setTimeout(s,50):setTimeout(s,50)}})}if(s.$refs&&"object"==typeof s.$refs||(s.$refs=O.Wrap({})),Jn(e,s),i)return s;Kn(e)||Vn(e,Array.from(e.childNodes).map((t=>t.cloneNode(!0))));const u=function(t,e,n){const r=Object.create(null);return t.forEach((t=>{const o=t.cloneNode(!0),i=Or(o.getAttribute?.("vslot"));o.removeAttribute?.("vslot"),r[i]||(r[i]={id:O.GenUniqueID(),name:i,templates:[],data:e,runtime:n}),r[i].templates.push(o)})),r}(Kn(e)||[],n,r);!function(t,e){const n=Un(t);n&&(n.slots=e||null),Pn(t,"slotContents",e)}(e,u),e.innerHTML="";const a=o.body.cloneNode(!0);e.append(...a.childNodes),Object.keys(s).forEach((o=>{const i=cr.CamelToKebabCase(o);if("boolean"==typeof s[o]?(e.hasAttribute(o)||e.hasAttribute(i))&&(s[o]=!0):e.hasAttribute(o)?(s[o]=e.getAttribute(o),e.removeAttribute(o)):e.hasAttribute(i)&&(s[o]=e.getAttribute(i),e.removeAttribute(i)),e.hasAttribute(":"+o)||e.hasAttribute(":"+i)){const c=e.getAttribute(":"+o)||e.getAttribute(":"+i);e.removeAttribute(":"+o),e.removeAttribute(":"+i),delete s[o],c?t.watch(Nr(t,e,r).scope,(()=>O.Run(c,n,r)),(()=>{s[o]=O.Run(c,n,r)}),{deep:!0}):t.watch(Nr(t,e,r).scope,(()=>n[o]),(()=>{s[o]=n[o]}),{deep:!0})}if(e.hasAttribute("v:"+o)||e.hasAttribute("v:"+i)){let c=e.getAttribute("v:"+o)||e.getAttribute("v:"+i);e.removeAttribute("v:"+o),e.removeAttribute("v:"+i),c||(c=o);const u=t.findLastAccess(c,n);if(!u||!u.key||void 0===u.data)return;void 0!==u.data[u.key]&&null!==u.data[u.key]&&delete s[o],t.watch(Nr(t,e,r).scope,(()=>u.data[u.key]),(()=>{s[o]=u.data[u.key]})),t.watch(Nr(t,e,r).scope,(()=>s[o]),(()=>{u.data[u.key]=s[o]}))}}));let l=Array.from(a.attributes);return l=l.filter((n=>!t.parseAttr(e,n.name,n.value,s,Nr(t,e,r).runtime)||(a.removeAttribute(n.name),!1))),l.forEach((t=>{"class"===t.name?e.classList.add(...t.value.trim().split(/\s+/)):"style"===t.name?t.value.split(";").forEach((t=>{const n=t.split(":");if(2!==n.length||e.style[n[0]])return;const r=n[0].trim(),o=n[1].trim();r.startsWith("--")?e.style.setProperty(r,o):e.style[r]=o})):e.getAttribute(t.name)||e.setAttribute(t.name,t.value)})),s}function Pr(t,e,n,r,o){Nr(t,e,r).scope||Mn(e,new mr(e));for(const i of o.scripts)ar(i,e,n,r)}let Lr=!1;function Ur(){if(Lr)return;Lr=!0;const t=document.createElement("style");t.innerHTML="\n [vref] {\n display: block;\n }\n [vparsing] {\n display: none;\n -webkit-text-fill-color: transparent;\n }\n vslot, vrouter {\n display: block;\n }\n",document.head.firstChild?document.head.insertBefore(t,document.head.firstChild):document.head.appendChild(t);const e=[],n=new WeakMap,r=t=>{if(!t.isConnected)return;let n=t.getAttribute("vdelay");if(n){let r=e[n];r&&r(t)}},o=t=>{if(!t||1!==t.nodeType)return;const e=n.get(t);e&&(cancelAnimationFrame(e),n.delete(t)),t.querySelectorAll?.("*").forEach((t=>{const e=n.get(t);e&&(cancelAnimationFrame(e),n.delete(t))}))},i=t=>{if(!t||1!==t.nodeType)return;if(t.hasAttribute?.("data-vrouter-cache")||t.hasAttribute?.("data-vrouter-layout"))return;o(t);const e=requestAnimationFrame((()=>{n.delete(t),t.isConnected||(t=>{t&&1===t.nodeType&&(t.isConnected||tr(t))})(t)}));n.set(t,e)};new MutationObserver((function(t,e){t.forEach((function(t){for(let e of t.addedNodes)1===e.nodeType&&(o(e),r(e),e.querySelectorAll("*[vdelay]").forEach(r));for(let e of t.removedNodes)i(e)}))})).observe(document.body,{attributes:!1,childList:!0,subtree:!0,characterData:!1}),window.__VhtmlRuntime__=class{app=null;modulePath=null;vget=gn;vproxy=O;Wrap=O.Wrap;o=!0;$router=ir.$router;constructor(t){"string"==typeof t?this.app=document.getElementById(t):t instanceof HTMLElement?this.app=t:this.app=document.body,this.app&&(async()=>{let t=await gn.FetchUI(window.location.pathname,{},!0);this.modulePath=t.mod?.scoped||"",this.parseRef("root",this.app,{},t.mod||{},t,!0)})()}watch(t,e,n,r){const o=O.Watch(e,n,r);return t?.addWatcher((()=>O.Cancel(o))),o}findLastAccess(t,e){return function(t,e){const n=Function("sandbox",t=`with (sandbox) { ${t} }`);let r={data:null,key:null};const o=t=>new Proxy(t,{has:(t,e)=>!0,get(t,e,n){if(e===Symbol.unscopables)return;let i=Reflect.get(t,e,n);return r.data=t,r.key=e,"object"==typeof i&&i?o(i):i},set:(t,e,n,r)=>!1});return n(o(e)),r}(t,e)}runtimeOf(t,e=null){if(!t)return{instance:null,scope:null,runtime:e};const n=Fn(t,null),r=In(t),o=qn(t);return{instance:n,scope:r||n?.scope||null,runtime:o||n?.runtime||e}}scopeOf(t){return this.runtimeOf(t).scope}async parseDom(t,e={},n,r=this.scopeOf(t)){if(n instanceof HTMLElement)throw Error("runtime error");const o=this.runtimeOf(t,n),i=r||o.scope,s=o.runtime||n;let c=t.nodeName.toLowerCase();if(3===t.nodeType)return void this.parseTextNode(t,e,s,i);if(8===t.nodeType)return void t.remove();if(1!==t.nodeType)return;if(t.hasAttribute("no-vhtml")||Gn(t))return;Kn(t)||Vn(t,Array.from(t.childNodes).map((t=>t.cloneNode(!0))));let u=t.getAttribute("v-for");if(null!==u)return void this.parseVfor(u,t,e,s);if(-1!==c.indexOf("-")){let n="/"+c.split("-").join("/"),r=t.hasAttribute("single");return this.parseRef(n,t,e,s,null,r),void Zn(t)}if(t.getAttribute(":vsrc")){let n=t.getAttribute(":vsrc");t.removeAttribute(":vsrc");let r=Array.from(t.attributes).map((t=>({name:t.name,value:t.value}))),o=Array.from(t.childNodes);return void this.watch(i,(()=>{Nn(t,"parsed"),t.setAttribute("vparsing","");let i=O.Run(n,e,s);i&&(Array.from(t.attributes).forEach((e=>{t.removeAttribute(e.name)})),t.innerHTML="",r.forEach((e=>{t.setAttribute(e.name,e.value)})),o.forEach((e=>{t.appendChild(e.cloneNode(!0))})),this.parseRef(i,t,e,s,null,!1),Zn(t))}))}if(t.getAttribute("vsrc")){let n=t.hasAttribute("single");return this.parseRef(t.getAttribute("vsrc"),t,e,s,null,n),void Zn(t)}if("div"===c&&t.getAttribute("v-html")){let n=t.getAttribute("v-html");return t.removeAttribute("v-html"),t.innerHTML="",this.parseAttrs(t,e,s),Zn(t),void this.watch(i,(()=>{let r=O.Run(n,e,s);t.innerHTML=r;let o=this.parseVif(Array.from(t.childNodes),e,s);for(let t of o)this.parseDom(t,e,s,i)}))}if("vslot"===c)return this.parseSlots(t,e,s),void Zn(t);if("vrouter"===c)return this.parseAttrs(t,e,s),void ir.$router.mountView(this,t,s);this.parseAttrs(t,e,s);let a=this.parseVif(Array.from(t.childNodes),e,s);for(let l of a)this.parseDom(l,e,s,i);Zn(t)}onMountedRun(t,n,r=!0){if(r){if(t.isConnected)return void n(t);let r=e.push((t=>{t.removeAttribute("vdelay"),n(t)}));return void t.setAttribute("vdelay",r-1)}t.isConnected&&n(t);let o=e.push(n);t.setAttribute("vdelay",o-1)}async parseRaw(t,e,n,r){return async function(t,e,n,r,o){const i="_"+Math.random().toString(36).slice(2),s=await gn.ParseUI(o,r||{},i);t.parseRef(i,e,n||{},{...r},s)}(this,t,e,n,r)}async parseRef(t,e,n,r,o,i=!1){return async function(t,e,n,r,o,i,s=!1){const c=Un(n),u=Fn(n.parentNode||null,null),a=In(n);a&&a.dispose(n),c&&On(c);const l=Rn(n,u,"component");Dn(n,l),Mn(n,new mr(n)),n.setAttribute("vparsing","");const f=o,h=n.getAttribute("vrefof"),d=n.closest(`*[vref='${h}']`);d&&(o=qn(d)),!i&&e&&(e.endsWith(".html")||(e+=".html"),i=await gn.FetchUI(e,o,n.hasAttribute("scoped")));const p=i?.mod||o?.$mod||null,m=Hn(n,o?.$sys?.$router||null),y=dn(o||null,p,{$router:m});y.$sys.$emit=(t,...e)=>{t=t.toLowerCase();const r=(o=n,Un(o)?.events??Cn(o,"events"));var o;if(!r)return;const i=r[t];"function"==typeof i&&i(...e)},Bn(n,y),zn(n,m),function(t,e){const n=Un(t);n&&(n.vsrc=e||""),Pn(t,"vsrc",e||null)}(n,e);const w=await Cr(t,n,r,f,i,s);s?t.parseAttrs(n,w,y,i?.customAttrs):t.parseAttrs(n,r,f,i?.customAttrs);const b=t.parseVif(Array.from(n.childNodes),w,y);for(const v of b)t.parseDom(v,w,y);n.removeAttribute("vparsing"),Pr(t,n,w,y,i),Nr(t,n,y).scope?.activate(n)}(this,t,e,n,r,o,i)}async setupRef(t,e,n,r,o=!1){return Cr(this,t,e,n,r,o)}async mountRef(t,e,n,r){return Pr(this,t,e,n,r)}parseAttrs(t,e,n,r){return function(t,e,n,r,o){const i=lr(t,e);if("A"===e.nodeName&&fr(t,e,n,r),Array.from(e.attributes).forEach((o=>{hr(t,e,o.name,o.value,n,r)&&e.removeAttribute(o.name)})),o&&Object.keys(o).forEach((n=>{hr(t,e,n,o[n],Wn(e),r)})),e.hasAttribute("v-show")){const o=e.getAttribute("v-show"),s=e.style.display;t.watch(i,(()=>{const t=O.Run(o,n,r);e.style.display=t?s:"none"}))}}(this,t,e,n,r)}parseAHref(t,e,n){return fr(this,t,e,n)}parseAttr(t,e,n,r,o){return hr(this,t,e,n,r,o)}handleStyle(t,e,n,r,o){return dr(this,t,e,n,r,o)}handleEvent(t,e,n,r,o){return pr(this,t,e,n,r,o)}parseTextNode(t,e,n,r=this.scopeOf(t)){return function(t,e,n,r,o=t.scopeOf(e)){const i=o||br(t,e,r).scope,s=e.nodeValue.trim();if(!s)return;let c,u=0,a=-1;const l=[];for(;null!==(c=yr.exec(s));)if("{{"===c[0])a=c.index;else if("}}"===c[0]&&a>=0){u!==a&&l.push(s.slice(u,a)),l.push("");const o=s.slice(a+2,c.index),f=l.length-1;a=-1,u=c.index+2,t.watch(i,(()=>{let t=O.Run(o,n,r);"function"==typeof t?t=t():"object"==typeof t&&t&&(t=JSON.stringify(t)),l[f]=t,e.nodeValue=l.join("").trim()}))}l.push(s.slice(u)),e.nodeValue=l.join("")}(this,t,e,n,r)}parseVfor(t,e,n,r){return function(t,e,n,r,o){n.removeAttribute("v-for");const i=wr.exec(e);if(5!==i?.length)return;const s=i[1]||i[3],c=i[2],u=i[4],a=document.createElement("div");a.style.display="none";const l=O.GenUniqueID(),f=Object.create(null),h=(e,r,i=!1)=>{const s=n.cloneNode(!0);return i&&s.removeAttribute("v-if"),vr(s,e,o),a.parentNode.insertBefore(s,r),t.parseDom(s,e,o,br(t,s,o).scope),s},d=t=>{let e=!1;for(const n of Object.keys(f)){if(n===t){e=!0;continue}if(!e)continue;const r=f[n]?.dom;if(r?.isConnected)return r}return a},p=br(t,n.parentNode,o).scope;p?.addCleanup((()=>{Object.keys(f).forEach((t=>{const e=f[t];0>e?.watchId||O.Cancel(e.watchId),gr(e?.dom),e?.dom?.remove?.(),delete f[t]}))})),n.parentNode.replaceChild(a,n),t.watch(p||br(t,a.parentNode||n.parentNode,o).scope,(()=>{let e=O.Run(u,r,o);const i=new Set;"function"==typeof e&&(e=e()),"number"==typeof e&&(e=Array.from({length:e},((t,e)=>e))),null==e&&(e=[]);let m=e.length;if("object"!=typeof e)return m;const y=[];Object.keys(e).forEach((t=>{let n="";n=e[t]&&e[t][O.DataID]?e[t][O.DataID]:`${t}.${e[t]}`,n=`${l}.${n}`,i.add(n),y.push({key:t,cacheKey:n,value:e[t]})})),Object.keys(f).forEach((t=>{if(!i.has(t)){const e=f[t];0>e?.watchId||O.Cancel(e.watchId),gr(e?.dom),e?.dom?.remove?.(),delete f[t]}}));let w=a;for(let u=y.length-1;u>=0;u--){const{key:e,cacheKey:i,value:l}=y[u],m=f[i];if(m){const t=m.data||(b=m.dom,Un(b)?.vforData??Cn(b,"vforData"));t&&(t[s]=l,c&&(t[c]="0"===e?0:+e||e));const n=m.dom;!n||n.nextSibling===w&&n.isConnected||a.parentNode.insertBefore(n,w),n?.isConnected&&(w=n);continue}let v={[s]:l};c&&(v[c]="0"===e?0:+e||e),v=O.Wrap(v,r);const g={data:v,dom:null,watchId:-1};f[i]=g;const x=n.getAttribute("v-if");if(x)g.watchId=t.watch(p||br(t,a.parentNode||n.parentNode,o).scope,(()=>{const t=f[i];if(t)return O.Run(x,t.data,o);O.Cancel(g.watchId)}),(t=>{const e=f[i];if(e)if(t){if(!e.dom){const t=h(e.data,d(i),!0);Xn(t,e.data),e.dom=t}e.dom.isConnected||a.parentNode.insertBefore(e.dom,d(i))}else e.dom&&(gr(e.dom),e.dom.remove(),e.dom=null);else O.Cancel(g.watchId)}));else{const t=h(v,w);Xn(t,v),g.dom=t,w=t}}var b;return m}))}(this,t,e,n,r)}parseVif(t,e,n){return function(t,e,n,r){let o={now:document.createElement("div"),conds:[],doms:[]};const i=e=>{const o={now:e.now,conds:e.conds,doms:e.doms},i=`let res = [${o.conds.map((t=>""===t?"true":`Boolean(${t})`)).join(",")}]\n return res.indexOf(true)`;t.watch(br(t,o.now,r).scope,(()=>{const t=O.Run(i,n,r);let e=o.doms[t];return e||(e=document.createElement("div"),e.style.display="none"),e}),(e=>{if(!e)return;t.onMountedRun(o.now,(t=>{t.replaceWith(e),o.now=e}));const i=In(e);if(!Gn(e)||"disposed"===i?.state){"disposed"===i?.state&&disposeRuntimeSubtree(e);const o=Kn(e);o?.length&&(e.innerHTML="",o.forEach((t=>{e.appendChild(t.cloneNode(!0))}))),vr(e,n,r),t.parseDom(e,n,r,br(t,e,r).scope)}}))},s=e.filter((t=>!(t.getAttribute&&!t.getAttribute("v-for")&&(null!==t.getAttribute("v-if")?(o.conds.length>0&&(i(o),o={now:document.createElement("div"),conds:[],doms:[]}),t.replaceWith(o.now),o.conds.push(t.getAttribute("v-if")),t.removeAttribute("v-if"),o.doms.push(t),1):null!==t.getAttribute("v-else-if")?(o.conds.push(t.getAttribute("v-else-if")),t.removeAttribute("v-else-if"),o.doms.push(t),t.remove(),1):null!==t.getAttribute("v-else")&&(o.conds.push(""),t.removeAttribute("v-else"),o.doms.push(t),t.remove(),1)))));return o.conds.length>0&&i(o),s}(this,t,e,n)}parseSlots(t,e,n){return jr(this,t,e,n)}}}!function(t=document.body){Ur(),window.$vhtml||(window.$vhtml=function(t=document.body){return Ur(),new(0,window.__VhtmlRuntime__)(t)}(t)),window.$vhtml}(document.body)},"function"==typeof define&&define.amd?define(t):t();
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@veypi/vhtml",
|
|
3
|
+
"version": "0.7.4",
|
|
4
|
+
"description": "vhtml is a lightweight JavaScript library for parsing and manipulating HTML content with ease.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./dist/vhtml.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/vhtml.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "vite build",
|
|
17
|
+
"build:watch": "vite build --watch",
|
|
18
|
+
"dev": "vite build --watch --mode development",
|
|
19
|
+
"preview": "vite preview",
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"javascript",
|
|
25
|
+
"library"
|
|
26
|
+
],
|
|
27
|
+
"author": "veypi",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"vite": "^5.3.0",
|
|
31
|
+
"terser": "^5.19.0",
|
|
32
|
+
"@types/node": "^20.0.0"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/veypi/vhtml.git"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
}
|
|
41
|
+
}
|