@kupola/kupola 1.9.9 → 1.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs.js +1 -1
- package/dist/core.esm.js +1 -106
- package/dist/core.umd.js +1 -1
- package/dist/kupola-lite.cjs.js +1 -1
- package/dist/kupola-lite.esm.js +1 -1
- package/dist/kupola.cjs.js +1 -1
- package/dist/kupola.esm.js +1 -9965
- package/dist/kupola.min.js +1 -1
- package/dist/kupola.umd.js +1 -1
- package/package.json +3 -3
package/dist/core.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./core-D0uN-4lt.cjs");exports.BRAND_OPTIONS=e.BRAND_OPTIONS,exports.CacheEntry=e.CacheEntry,exports.CacheManager=e.CacheManager,exports.ComponentInitializerRegistry=e.ComponentInitializerRegistry,exports.DependsError=e.DependsError,exports.DependsSource=e.DependsSource,exports.FetchedSource=e.FetchedSource,exports.FunctionSource=e.FunctionSource,exports.GlobalEvents=e.GlobalEvents,exports.KupolaComponent=e.KupolaComponent,exports.KupolaComponentRegistry=e.KupolaComponentRegistry,exports.KupolaDataBind=e.KupolaDataBind,exports.KupolaEventBus=e.KupolaEventBus,exports.KupolaI18n=e.KupolaI18n,exports.KupolaLifecycle=e.KupolaLifecycle,exports.KupolaStore=e.KupolaStore,exports.KupolaStoreManager=e.KupolaStoreManager,exports.KupolaUtils=e.KupolaUtils,exports.RouteSource=e.RouteSource,exports.Scheduler=e.Scheduler,exports.StaticSource=e.StaticSource,exports.StorageSource=e.StorageSource,exports.WebSocketSource=e.WebSocketSource,exports.applyMixin=e.applyMixin,exports.arrayUtils=e.arrayUtils,exports.bootstrapComponents=e.bootstrapComponents,exports.clearCache=e.clearCache,exports.configureHttpClient=e.configureHttpClient,exports.createBrandPicker=e.createBrandPicker,exports.createI18n=e.createI18n,exports.createLifecycle=e.createLifecycle,exports.createSource=e.createSource,exports.createStore=e.createStore,exports.createThemeToggle=e.createThemeToggle,exports.cryptoUtils=e.cryptoUtils,exports.dateUtils=e.dateUtils,exports.debounce=e.debounce,exports.defineComponent=e.defineComponent,exports.defineMixin=e.defineMixin,exports.emit=e.emit,exports.emitGlobal=e.emitGlobal,exports.escapeHtml=e.escapeHtml,exports.formatCurrency=e.formatCurrency,exports.formatDate=e.formatDate,exports.formatNumber=e.formatNumber,exports.generateSecureId=e.generateSecureId,exports.getBasePath=e.getBasePath,exports.getBrand=e.getBrand,exports.getConfig=e.getConfig,exports.getDefaultBrand=e.getDefaultBrand,exports.getDefaultTheme=e.getDefaultTheme,exports.getHttpClient=e.getHttpClient,exports.getHttpConfig=e.getHttpConfig,exports.getIconsPath=e.getIconsPath,exports.getListenerCount=e.getListenerCount,exports.getLocale=e.getLocale,exports.getMessageConfig=e.getMessageConfig,exports.getNotificationConfig=e.getNotificationConfig,exports.getPerformanceConfig=e.getPerformanceConfig,exports.getSecurityConfig=e.getSecurityConfig,exports.getStore=e.getStore,exports.getTheme=e.getTheme,exports.getUiConfig=e.getUiConfig,exports.getValidationConfig=e.getValidationConfig,exports.globalEvents=e.globalEvents,exports.initTheme=e.initTheme,exports.kupolaBootstrap=e.kupolaBootstrap,exports.kupolaData=e.kupolaData,exports.kupolaEvents=e.kupolaEvents,exports.kupolaI18n=e.kupolaI18n,exports.kupolaInitializer=e.kupolaInitializer,exports.kupolaLifecycle=e.kupolaLifecycle,Object.defineProperty(exports,"kupolaRegistry",{enumerable:!0,get:()=>e.kupolaRegistry}),exports.kupolaStoreManager=e.kupolaStoreManager,exports.maskData=e.maskData,exports.n=e.n,exports.numberUtils=e.numberUtils,exports.objectUtils=e.objectUtils,exports.off=e.off,exports.offAll=e.offAll,exports.offByScope=e.offByScope,exports.offConfigChange=e.offConfigChange,exports.on=e.on,exports.onConfigChange=e.onConfigChange,exports.once=e.once,exports.preloadUtils=e.preloadUtils,exports.ref=e.ref,exports.registerComponent=e.registerComponent,exports.registerLazyComponent=e.registerLazyComponent,exports.resetHttpClient=e.resetHttpClient,exports.sanitizeHtml=e.sanitizeHtml,exports.setBrand=e.setBrand,exports.setConfig=e.setConfig,exports.setLocale=e.setLocale,exports.setTheme=e.setTheme,exports.stringUtils=e.stringUtils,exports.stripHtml=e.stripHtml,exports.t=e.t,exports.throttle=e.throttle,exports.useDeps=e.useDeps,exports.useMixin=e.useMixin,exports.useQuery=e.useQuery,exports.validatorUtils=e.validatorUtils;
|
|
1
|
+
"use strict";class t{constructor(t="app"){this.scope=t,this.hooks=new Map,this.state="created",this.stateHistory=["created"],this.transitions=new Map([["created",["bootstrapped","destroyed"]],["bootstrapped",["mounted","destroyed"]],["mounted",["updated","unmounted","destroyed"]],["updated",["updated","unmounted","destroyed"]],["unmounted",["mounted","destroyed"]],["destroyed",[]]]),this.phaseStateMap={bootstrap:{from:"created",to:"bootstrapped"},mount:{from:["bootstrapped","unmounted"],to:"mounted"},update:{from:["mounted","updated"],to:"updated"},unmount:{from:["mounted","updated"],to:"unmounted"},destroy:{from:["bootstrapped","mounted","updated","unmounted"],to:"destroyed"}},this.basePhases=["bootstrap","mount","update","unmount","destroy"],this.allPhases=["error","errorBoundary"],this.basePhases.forEach(t=>{this.allPhases.push(`before${t.charAt(0).toUpperCase()+t.slice(1)}`),this.allPhases.push(t),this.allPhases.push(`after${t.charAt(0).toUpperCase()+t.slice(1)}`)}),this.allPhases.forEach(t=>{this.hooks.set(t,[])}),this.pendingHooks=new Set,this.trace=[],this.errorHandler=null,this.errorBoundary=null,this.lastError=null,this.errorCount=0,this.maxErrors=10,this.i=null}o(t){const n=this.transitions.get(this.state);if(!n||!n.includes(t))throw new Error(`Invalid state transition: ${this.state} -> ${t}`);return!0}u(t){this.o(t),this.state=t,this.stateHistory.push(t)}h(t){const n=this.hooks.get(t);n&&n.forEach(t=>{t.resolved=!1})}on(t,n,e={}){if(!this.allPhases.includes(t))throw new Error(`Unknown lifecycle phase: ${t}`);const r=this.hooks.get(t);return r.push({handler:n,priority:e.priority||0,depends:e.depends||[],name:e.name||n.name||`anonymous_${r.length}`}),r.sort((t,n)=>n.priority-t.priority),()=>{const t=r.findIndex(t=>t.handler===n);t>-1&&r.splice(t,1)}}async l(t,n){if(t&&0!==t.length)for(const e of t){const t=this.hooks.get(n).find(t=>t.name===e);t&&!t.resolved&&(await t.handler(),t.resolved=!0)}}async emit(t,...n){if("destroyed"===this.state&&"error"!==t)return;const e=this.hooks.get(t);if(!e||0===e.length)return;const r=`${t}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;this.pendingHooks.add(r);const s=performance.now();try{for(const s of e){await this.l(s.depends,t);const e=performance.now();let i,o;try{i=s.handler(...n),i instanceof Promise&&await i,s.resolved=!0}catch(e){o=e,"error"!==t&&await this.p({phase:t,hook:s.name,error:e,args:n})}const c=performance.now()-e;this.trace.push({emitId:r,phase:t,hookName:s.name,duration:c,status:o?"error":"success",error:o?o.message:null,timestamp:Date.now()})}performance.now()}finally{this.pendingHooks.delete(r)}}async runPhase(t,...n){if(!this.basePhases.includes(t))throw new Error(`Unknown base phase: ${t}`);const e=this.phaseStateMap[t];if(e)if(Array.isArray(e.from)){if(!e.from.includes(this.state))throw new Error(`Cannot ${t} from state ${this.state}, expected one of: ${e.from.join(", ")}`)}else if(this.state!==e.from)throw new Error(`Cannot ${t} from state ${this.state}, expected ${e.from}`);const r=`before${t.charAt(0).toUpperCase()+t.slice(1)}`,s=`after${t.charAt(0).toUpperCase()+t.slice(1)}`;this.h(r),this.h(t),this.h(s),this.allPhases.includes(r)&&await this.emit(r,...n),await this.emit(t,...n),e&&this.u(e.to),this.allPhases.includes(s)&&await this.emit(s,...n)}async bootstrap(...t){await this.runPhase("bootstrap",...t)}async m(){return new Promise(t=>{if("complete"===document.readyState||"interactive"===document.readyState)return void t();const n=()=>{document.removeEventListener("DOMContentLoaded",n),window.removeEventListener("load",n),t()};document.addEventListener("DOMContentLoaded",n),window.addEventListener("load",n)})}async mount(...t){await this.runPhase("mount",...t)}async mountWithDOMReady(...t){await this.m(),await this.runPhase("mount",...t)}async update(...t){await this.runPhase("update",...t)}async unmount(...t){await this.runPhase("unmount",...t)}async destroy(...t){await this.runPhase("destroy",...t),this.hooks.forEach(t=>{t.length=0})}getPhaseHandlers(t){return this.hooks.get(t)||[]}hasHandlers(t){const n=this.hooks.get(t);return n&&n.length>0}getTrace(){return[...this.trace]}clearTrace(){this.trace=[]}getState(){return this.state}getStateHistory(){return[...this.stateHistory]}isInState(t){return this.state===t}onError(t){return this.i=t,this.on("error",t)}setErrorBoundary(t){return this.errorBoundary=t,this.on("errorBoundary",n=>"function"==typeof t?t(n):null)}setMaxErrors(t){this.maxErrors=t}getErrorCount(){return this.errorCount}getLastError(){return this.lastError}resetErrorCount(){this.errorCount=0,this.lastError=null}async p(t){if(this.errorCount++,this.lastError=t.error,this.errorCount>=this.maxErrors)return;if(await this.emit("error",t),"function"==typeof this.i)try{await this.i(t)}catch(t){}const n=this.hooks.get("errorBoundary");if(n&&n.length>0)for(const e of n)try{const n=e.handler(t);if(n instanceof Promise&&await n,"handled"===n)return}catch(t){}}}const n=new t("app");const e=new Set(["__proto__","prototype","constructor"]);function r(t){return e.has(t)}const s={trim:function(t){return t?t.trim():""},trimLeft:function(t){return t?t.replace(/^\s+/,""):""},trimRight:function(t){return t?t.replace(/\s+$/,""):""},toUpperCase:function(t){return t?t.toUpperCase():""},toLowerCase:function(t){return t?t.toLowerCase():""},capitalize:function(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""},camelize:function(t){return t?t.replace(/-(\w)/g,(t,n)=>n?n.toUpperCase():""):""},hyphenate:function(t){return t?t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):""},padStart:function(t,n,e=" "){return(String(t)||"").padStart(n,e)},padEnd:function(t,n,e=" "){return(String(t)||"").padEnd(n,e)},truncate:function(t,n,e="..."){return!t||t.length<=n?t||"":t.slice(0,n)+e},replaceAll:function(t,n,e){return t?t.split(n).join(e):""},format:function(t,n){return t?t.replace(/\{\{(\w+)\}\}/g,(t,e)=>void 0!==n[e]?n[e]:`{{${e}}}`):""},startsWith:function(t,n){return(t||"").startsWith(n)},endsWith:function(t,n){return(t||"").endsWith(n)},includes:function(t,n){return(t||"").includes(n)},repeat:function(t,n){return(t||"").repeat(n)},reverse:function(t){return(t||"").split("").reverse().join("")},countOccurrences:function(t,n){return t&&n?t.split(n).length-1:0},escapeHtml:function(t){if(!t)return"";const n=document.createElement("div");return n.textContent=t,n.innerHTML},unescapeHtml:function(t){if(!t)return"";const n=document.createElement("div");return n.innerHTML=t,n.textContent},generateRandom:function(t=8){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";for(let r=0;r<t;r++)e+=n.charAt(Math.floor(62*Math.random()));return e},generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}};function i(t){return t?t.reduce((t,n)=>t+(Number(n)||0),0):0}const o={isArray:function(t){return Array.isArray(t)},isEmpty:function(t){return!t||0===t.length},size:function(t){return t?t.length:0},first:function(t,n){return t&&t.length>0?t[0]:n},last:function(t,n){return t&&t.length>0?t[t.length-1]:n},get:function(t,n,e){return t&&void 0!==t[n]?t[n]:e},slice:function(t,n,e){return t?t.slice(n,e):[]},concat:function(...t){return t.reduce((t,n)=>t.concat(n||[]),[])},join:function(t,n=","){return t?t.join(n):""},indexOf:function(t,n,e=0){if(!t)return-1;if(Number.isNaN(n)){for(let n=e;n<t.length;n++)if(Number.isNaN(t[n]))return n;return-1}return t.indexOf(n,e)},lastIndexOf:function(t,n,e){if(!t)return-1;if(Number.isNaN(n)){for(let n=void 0!==e?e:t.length-1;n>=0;n--)if(Number.isNaN(t[n]))return n;return-1}return t.lastIndexOf(n,e)},includes:function(t,n){return!!t&&t.includes(n)},push:function(t,...n){return t&&t.push(...n),t},pop:function(t){return t?t.pop():void 0},shift:function(t){return t?t.shift():void 0},unshift:function(t,...n){return t&&t.unshift(...n),t},remove:function(t,n){if(!t)return t;const e=Number.isNaN(n)?t.findIndex(t=>Number.isNaN(t)):t.indexOf(n);return e>-1&&t.splice(e,1),t},removeAt:function(t,n){return!t||n<0||n>=t.length||t.splice(n,1),t},insert:function(t,n,e){return t?(t.splice(n,0,e),t):t},reverse:function(t){return t?t.slice().reverse():[]},sort:function(t,n){return t?t.slice().sort(n):[]},sortBy:function(t,n,e="asc"){return t?t.slice().sort((t,r)=>{const s="object"==typeof t?t[n]:t,i="object"==typeof r?r[n]:r;return s<i?"asc"===e?-1:1:s>i?"asc"===e?1:-1:0}):[]},filter:function(t,n){return t?t.filter(n):[]},map:function(t,n){return t?t.map(n):[]},reduce:function(t,n,e){return t?t.reduce(n,e):e},forEach:function(t,n){t&&t.forEach(n)},every:function(t,n){return!t||t.every(n)},some:function(t,n){return!!t&&t.some(n)},find:function(t,n){return t?t.find(n):void 0},findIndex:function(t,n){return t?t.findIndex(n):-1},flat:function(t,n=1){return t?t.flat(n):[]},flattenDeep:function t(n){return n?n.reduce((n,e)=>Array.isArray(e)?n.concat(t(e)):n.concat(e),[]):[]},unique:function(t){return t?[...new Set(t)]:[]},uniqueBy:function(t,n){if(!t)return[];const e=new Set;return t.filter(t=>{const r="object"==typeof t?t[n]:t;return!e.has(r)&&(e.add(r),!0)})},chunk:function(t,n){if(!t||n<=0)return[];const e=[];for(let r=0;r<t.length;r+=n)e.push(t.slice(r,r+n));return e},shuffle:function(t){if(!t)return[];const n=t.slice();for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n},sum:i,average:function(t){return t&&0!==t.length?i(t)/t.length:0},max:function(t){return t&&t.length>0?Math.max(...t):-1/0},min:function(t){return t&&t.length>0?Math.min(...t):1/0},intersection:function(...t){return 0===t.length?[]:t.reduce((t,n)=>t.filter(t=>n&&n.includes(t)))},union:function(...t){return[...new Set(t.flat().filter(Boolean))]},difference:function(t,n){return t?t.filter(t=>!n||!n.includes(t)):[]},zip:function(...t){if(0===t.length)return[];const n=Math.max(...t.map(t=>t?t.length:0));return Array.from({length:n},(n,e)=>t.map(t=>t&&t[e]))}};function c(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}const a={isObject:c,isEmpty:function(t){return!t||"object"!=typeof t||0===Object.keys(t).length},keys:function(t){return t?Object.keys(t):[]},values:function(t){return t?Object.values(t):[]},entries:function(t){return t?Object.entries(t):[]},has:function(t,n){return!!t&&Object.prototype.hasOwnProperty.call(t,n)},get:function(t,n,e){if(!t)return e;const s=n.split(".");return s.some(r)?e:s.reduce((t,n)=>t&&t[n],t)??e},set:function(t,n,e){if(!t||"object"!=typeof t)return t;const s=n.split(".");if(s.some(r))return t;const i=s.pop();let o=t;return s.forEach(t=>{o[t]&&"object"==typeof o[t]||(o[t]={}),o=o[t]}),o[i]=e,t},pick:function(t,n){return t?n.reduce((n,e)=>(void 0!==t[e]&&(n[e]=t[e]),n),{}):{}},omit:function(t,n){return t?Object.keys(t).reduce((e,r)=>(n.includes(r)||(e[r]=t[r]),e),{}):{}},merge:function t(...n){return n.reduce((n,e)=>(e&&"object"==typeof e&&Object.keys(e).forEach(s=>{r(s)||(c(e[s])&&c(n[s])?n[s]=t(n[s],e[s]):n[s]=e[s])}),n),{})},clone:function(t){return t?JSON.parse(JSON.stringify(t)):t},deepClone:function t(n,e=new WeakMap){if(!n||"object"!=typeof n)return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n);if(n instanceof RegExp)return new RegExp(n);if(n instanceof Map){const r=new Map;return e.set(n,r),n.forEach((n,s)=>r.set(s,t(n,e))),r}if(n instanceof Set){const r=new Set;return e.set(n,r),n.forEach(n=>r.add(t(n,e))),r}if(Array.isArray(n)){const r=[];return e.set(n,r),n.forEach(n=>r.push(t(n,e))),r}const s={};return e.set(n,s),Object.keys(n).forEach(i=>{r(i)||(s[i]=t(n[i],e))}),s},forEach:function(t,n){t&&Object.keys(t).forEach(e=>n(t[e],e,t))},map:function(t,n){if(!t)return{};const e={};return Object.keys(t).forEach(r=>{e[r]=n(t[r],r,t)}),e},filter:function(t,n){if(!t)return{};const e={};return Object.keys(t).forEach(r=>{n(t[r],r,t)&&(e[r]=t[r])}),e},reduce:function(t,n,e){return t?Object.keys(t).reduce((e,r)=>n(e,t[r],r,t),e):e},toArray:function(t){return t?Object.keys(t).map(n=>({key:n,value:t[n]})):[]},fromArray:function(t,n,e){return t?t.reduce((t,r)=>{const s="object"==typeof r?r[n]:r,i=e?r[e]:r;return void 0!==s&&(t[s]=i),t},{}):{}},size:function(t){return t?Object.keys(t).length:0},invert:function(t){if(!t)return{};const n={};return Object.keys(t).forEach(e=>{n[t[e]]=e}),n},isEqual:function t(n,e){if(n===e)return!0;if(!n||!e||"object"!=typeof n||"object"!=typeof e)return!1;const r=Object.keys(n),s=Object.keys(e);return r.length===s.length&&r.every(r=>t(n[r],e[r]))},freeze:function t(n){return n?(Object.freeze(n),Object.keys(n).forEach(e=>{"object"==typeof n[e]&&t(n[e])}),n):n},seal:function(t){return t?Object.seal(t):t}};function u(t){return"number"==typeof t&&!isNaN(t)}function h(...t){return t.flat().filter(u).reduce((t,n)=>t+n,0)}function f(t=0,n=1){return Math.random()*(n-t)+t}const d={isNumber:u,isInteger:function(t){return Number.isInteger(t)},isFloat:function(t){return u(t)&&!Number.isInteger(t)},isPositive:function(t){return u(t)&&t>0},isNegative:function(t){return u(t)&&t<0},isZero:function(t){return u(t)&&0===t},clamp:function(t,n,e){return u(t)?Math.min(Math.max(t,n),e):t},round:function(t,n=0){if(!u(t))return t;const e=Math.pow(10,n);return Math.round(t*e)/e},floor:function(t){return u(t)?Math.floor(t):t},ceil:function(t){return u(t)?Math.ceil(t):t},abs:function(t){return u(t)?Math.abs(t):t},min:function(...t){const n=t.filter(u);return n.length>0?Math.min(...n):void 0},max:function(...t){const n=t.filter(u);return n.length>0?Math.max(...n):void 0},sum:h,average:function(...t){const n=t.flat().filter(u);return n.length>0?h(n)/n.length:0},random:f,randomInt:function(t,n){return Math.floor(f(t,n+1))},format:function(t,n=2){return u(t)?t.toFixed(n):String(t)},formatCurrency:function(t,n="CNY",e=2){return u(t)?new Intl.NumberFormat("zh-CN",{style:"currency",currency:n,minimumFractionDigits:e,maximumFractionDigits:e}).format(t):String(t)},formatPercent:function(t,n=0){return u(t)?`${(100*t).toFixed(n)}%`:String(t)},toFixed:function(t,n=0){return u(t)?t.toFixed(n):String(t)},toPrecision:function(t,n=6){return u(t)?t.toPrecision(n):String(t)},isNaN:function(t){return Number.isNaN(t)},isFinite:function(t){return Number.isFinite(t)},parseInt:function(t,n=10){return Number.parseInt(t,n)},parseFloat:function(t){return Number.parseFloat(t)},toNumber:function(t,n=0){const e=Number(t);return isNaN(e)?n:e},safeDivide:function(t,n,e=0){return u(t)&&u(n)&&0!==n?t/n:e},safeMultiply:function(...t){return t.reduce((t,n)=>u(t)&&u(n)?t*n:0,1)}};function l(){return Date.now()}function p(){const t=new Date;return t.setHours(0,0,0,0),t}function m(t){return t instanceof Date&&!isNaN(t.getTime())}function y(t){return m(t)}function w(t,n){if(!m(t)||!m(n))return 0;const e=new Date(t);e.setHours(0,0,0,0);const r=new Date(n);return r.setHours(0,0,0,0),Math.floor((e.getTime()-r.getTime())/864e5)}function b(t,n=1){if(!m(t))return t;const e=new Date(t),r=e.getDay(),s=r>=n?r-n:r+(7-n);return e.setDate(e.getDate()-s),e.setHours(0,0,0,0),e}const g={now:l,today:p,tomorrow:function(){const t=p();return t.setDate(t.getDate()+1),t},yesterday:function(){const t=p();return t.setDate(t.getDate()-1),t},isDate:m,isValid:y,parse:function(t){const n=new Date(t);return y(n)?n:null},format:function(t,n="YYYY-MM-DD HH:mm:ss"){if(!m(t))return"";const e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),a=String(t.getMilliseconds()).padStart(3,"0"),u=["日","一","二","三","四","五","六"][t.getDay()];return n.replace("YYYY",e).replace("MM",r).replace("DD",s).replace("HH",i).replace("mm",o).replace("ss",c).replace("SSS",a).replace("D",t.getDate()).replace("M",t.getMonth()+1).replace("H",t.getHours()).replace("m",t.getMinutes()).replace("s",t.getSeconds()).replace("W",u)},toISO:function(t){return m(t)?t.toISOString():""},toUTC:function(t){return m(t)?new Date(t.toUTCString()):null},addDays:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setDate(e.getDate()+n),e},addHours:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setHours(e.getHours()+n),e},addMinutes:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setMinutes(e.getMinutes()+n),e},addSeconds:function(t,n){if(!m(t))return t;const e=new Date(t);return e.setSeconds(e.getSeconds()+n),e},diffDays:w,diffHours:function(t,n){return m(t)&&m(n)?Math.floor((t.getTime()-n.getTime())/36e5):0},diffMinutes:function(t,n){return m(t)&&m(n)?Math.floor((t.getTime()-n.getTime())/6e4):0},diffSeconds:function(t,n){return m(t)&&m(n)?Math.floor((t.getTime()-n.getTime())/1e3):0},isToday:function(t){return!!m(t)&&0===w(t,p())},isYesterday:function(t){return!!m(t)&&-1===w(t,p())},isTomorrow:function(t){return!!m(t)&&1===w(t,p())},isFuture:function(t){return!!m(t)&&t.getTime()>l()},isPast:function(t){return!!m(t)&&t.getTime()<l()},isLeapYear:function(t){if(!m(t))return!1;const n=t.getFullYear();return n%4==0&&(n%100!=0||n%400==0)},getDaysInMonth:function(t){return m(t)?new Date(t.getFullYear(),t.getMonth()+1,0).getDate():0},getWeekOfYear:function(t){if(!m(t))return 0;const n=new Date(t.getFullYear(),0,1),e=t.getTime()-n.getTime();return Math.ceil(e/6048e5)},getQuarter:function(t){return m(t)?Math.ceil((t.getMonth()+1)/3):0},startOfDay:function(t){if(!m(t))return t;const n=new Date(t);return n.setHours(0,0,0,0),n},endOfDay:function(t){if(!m(t))return t;const n=new Date(t);return n.setHours(23,59,59,999),n},startOfMonth:function(t){return m(t)?new Date(t.getFullYear(),t.getMonth(),1):t},endOfMonth:function(t){return m(t)?new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59,999):t},startOfWeek:b,endOfWeek:function(t,n=1){if(!m(t))return t;const e=b(t,n),r=new Date(e);return r.setDate(r.getDate()+6),r.setHours(23,59,59,999),r},getAge:function(t){if(!m(t))return 0;const n=new Date;let e=n.getFullYear()-t.getFullYear();return(n.getMonth()<t.getMonth()||n.getMonth()===t.getMonth()&&n.getDate()<t.getDate())&&e--,Math.max(0,e)},fromNow:function(t){if(!m(t))return"";const n=l()-t.getTime(),e=6e4,r=36e5,s=24*r,i=7*s,o=30*s,c=365*s;return n<e?"刚刚":n<r?`${Math.floor(n/e)}分钟前`:n<s?`${Math.floor(n/r)}小时前`:n<i?`${Math.floor(n/s)}天前`:n<o?`${Math.floor(n/i)}周前`:n<c?`${Math.floor(n/o)}个月前`:`${Math.floor(n/c)}年前`}};function x(t,n,e={}){let r=null,s=null,i=null,o=0;const c=e.leading||!1,a=!1!==e.trailing;function u(){t.apply(i,s)}function h(){r=null,a&&s&&u(),s=null,i=null}return function(...t){s=t,i=this,o=Date.now(),r?(clearTimeout(r),r=setTimeout(h,Math.max(0,n-(Date.now()-o)))):(o=Date.now(),c?(r=setTimeout(h,n),u()):r=setTimeout(h,n))}}function _(t,n,e={}){let r=!1;const s=e.trailing||!1;let i=null,o=null;function c(){t.apply(o,i),i=null,o=null}return function(...t){r?s&&(i=t,o=this):(r=!0,i=t,o=this,c(),setTimeout(()=>{r=!1,s&&i&&c()},n))}}function v(t){return/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(t||"")}function S(t){return/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test(t||"")}function $(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t||"")}function O(t){const n=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(t||"");return!!n&&n.slice(1).every(t=>parseInt(t)>=0&&parseInt(t)<=255)}function k(t){const n=/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*([01]|0\.\d+)\)$/.exec(t||"");if(!n)return!1;const[,e,r,s,i]=n;return parseInt(e)>=0&&parseInt(e)<=255&&parseInt(r)>=0&&parseInt(r)<=255&&parseInt(s)>=0&&parseInt(s)<=255&&parseFloat(i)>=0&&parseFloat(i)<=1}function M(t,n){return(t||"").includes(n)}const j={isEmail:function(t){return/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t||"")},isPhone:function(t){return/^1[3-9]\d{9}$/.test(t||"")},isURL:function(t){return/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w.-]*)*\/?$/.test(t||"")},isIPv4:v,isIPv6:S,isIP:function(t){return v(t)||S(t)},isIDCard:function(t){return/^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(t||"")},isPassport:function(t){return/^[A-Z][0-9]{8}$|^[A-Z]{2}[0-9]{7}$/.test(t||"")},isCreditCard:function(t){const n=t.replace(/\s/g,"");if(!/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9]{2})[0-9]{12}|3[47][0-9]{13})$/.test(n))return!1;let e=0,r=!1;for(let t=n.length-1;t>=0;t--){let s=parseInt(n[t],10);r&&(s*=2,s>9&&(s-=9)),e+=s,r=!r}return e%10==0},isHexColor:$,isRGB:O,isRGBA:k,isColor:function(t){return $(t)||O(t)||k(t)},isDate:function(t){return!isNaN(new Date(t).getTime())},isJSON:function(t){try{return JSON.parse(t),!0}catch{return!1}},isEmpty:function(t){return!t||""===t.trim()},isWhitespace:function(t){return/^\s+$/.test(t||"")},isNumber:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},isInteger:function(t){return/^-?\d+$/.test(t||"")},isFloat:function(t){return/^-?\d+\.\d+$/.test(t||"")},isPositive:function(t){const n=parseFloat(t);return!isNaN(n)&&n>0},isNegative:function(t){const n=parseFloat(t);return!isNaN(n)&&n<0},isAlpha:function(t){return/^[a-zA-Z]+$/.test(t||"")},isAlphaNumeric:function(t){return/^[a-zA-Z0-9]+$/.test(t||"")},isChinese:function(t){return/^[\u4e00-\u9fa5]+$/.test(t||"")},isLength:function(t,n,e){const r=(t||"").length;return r>=n&&(void 0===e||r<=e)},minLength:function(t,n){return(t||"").length>=n},maxLength:function(t,n){return(t||"").length<=n},matches:function(t,n){return n instanceof RegExp&&n.test(t||"")},equals:function(t,n){return String(t)===String(n)},contains:M,notContains:function(t,n){return!M(t,n)},isArray:function(t){return Array.isArray(t)},arrayLength:function(t,n,e){const r=t?t.length:0;return r>=n&&(void 0===e||r<=e)},arrayMinLength:function(t,n){return!!t&&t.length>=n},arrayMaxLength:function(t,n){return!!t&&t.length<=n},isObject:function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},hasKeys:function(t,n){return!!(t&&n&&Array.isArray(n))&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n))},validate:function(t,n){const e={};return Object.keys(n).forEach(r=>{const s=t[r],i=n[r],o=[];i.forEach(n=>{if("string"==typeof n){const[t,...e]=n.split(":");j[t](s,...e)||o.push(t)}else if("function"==typeof n){const e=n(s,t);!0!==e&&o.push(e||"validation_failed")}}),o.length>0&&(e[r]=o)}),{valid:0===Object.keys(e).length,errors:e}}};const C={md5:function(t){const n=t?String(t):"",e=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745],r=[[7,12,17,22],[5,9,14,20],[4,11,16,23],[6,10,15,21]];function s(t,n){return t<<n|t>>>32-n}function i(t,n){const[i,o,c,a]=n,u=[];for(let n=0;n<16;n++)u[n]=255&t.charCodeAt(4*n)|(255&t.charCodeAt(4*n+1))<<8|(255&t.charCodeAt(4*n+2))<<16|(255&t.charCodeAt(4*n+3))<<24;let h=i,f=o,d=c,l=a;for(let t=0;t<64;t++){let n,i;const o=Math.floor(t/16),c=t%16;0===o?(n=f&d|~f&l,i=c):1===o?(n=l&f|~l&d,i=(5*c+1)%16):2===o?(n=f^d^l,i=(3*c+5)%16):(n=d^(f|~l),i=7*c%16);const a=l;l=d,d=f,f+=s(h+n+e[t]+u[i]&4294967295,r[o][t%4]),h=a}return[i+h&4294967295,o+f&4294967295,c+d&4294967295,a+l&4294967295]}const o=function(t){const n=8*t.length;for(t+="";t.length%64!=56;)t+="\0";const e=4294967295&n,r=n>>>32&4294967295;for(let n=0;n<4;n++)t+=String.fromCharCode(e>>>8*n&255);for(let n=0;n<4;n++)t+=String.fromCharCode(r>>>8*n&255);return t}(n);let c=[1732584193,4023233417,2562383102,271733878];for(let t=0;t<o.length;t+=64)c=i(o.substring(t,t+64),c);let a="";return c.forEach(t=>{for(let n=0;n<4;n++)a+=(t>>>8*n&255).toString(16).padStart(2,"0")}),a},sha256:function(t){const n=t?String(t):"",e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function r(t,n){return t>>>n|t<<32-n}function s(t,n){const s=[];for(let n=0;n<16;n++)s[n]=255&t.charCodeAt(4*n)|(255&t.charCodeAt(4*n+1))<<8|(255&t.charCodeAt(4*n+2))<<16|(255&t.charCodeAt(4*n+3))<<24;for(let t=16;t<64;t++){const n=r(s[t-15],7)^r(s[t-15],18)^s[t-15]>>>3,e=r(s[t-2],17)^r(s[t-2],19)^s[t-2]>>>10;s[t]=s[t-16]+n+s[t-7]+e&4294967295}let[i,o,c,a,u,h,f,d]=n;for(let t=0;t<64;t++){const n=d+(r(u,6)^r(u,11)^r(u,25))+(u&h^~u&f)+e[t]+s[t]&4294967295,l=i&o^i&c^o&c;d=f,f=h,h=u,u=a+n&4294967295,a=c,c=o,o=i,i=n+((r(i,2)^r(i,13)^r(i,22))+l&4294967295)&4294967295}return[n[0]+i&4294967295,n[1]+o&4294967295,n[2]+c&4294967295,n[3]+a&4294967295,n[4]+u&4294967295,n[5]+h&4294967295,n[6]+f&4294967295,n[7]+d&4294967295]}const i=function(t){const n=8*t.length;for(t+="";t.length%64!=56;)t+="\0";const e=4294967295&n,r=n>>>32&4294967295;for(let n=0;n<4;n++)t+=String.fromCharCode(r>>>8*n&255);for(let n=0;n<4;n++)t+=String.fromCharCode(e>>>8*n&255);return t}(n);let o=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];for(let t=0;t<i.length;t+=64)o=s(i.substring(t,t+64),o);let c="";return o.forEach(t=>{for(let n=3;n>=0;n--)c+=(t>>>8*n&255).toString(16).padStart(2,"0")}),c},base64Encode:function(t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let e="",r=0;const s=t?t.split("").map(t=>t.charCodeAt(0)):[];for(;r<s.length;){const t=s[r++],i=s[r++]||0,o=s[r++]||0,c=(15&i)<<2|o>>6,a=63&o;e+=n[t>>2]+n[(3&t)<<4|i>>4]+(r>s.length+1?"=":n[c])+(r>s.length?"=":n[a])}return e},base64Decode:function(t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let e="",r=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");r<t.length;){const s=n.indexOf(t.charAt(r++)),i=n.indexOf(t.charAt(r++)),o=n.indexOf(t.charAt(r++)),c=n.indexOf(t.charAt(r++)),a=s<<2|i>>4,u=(15&i)<<4|o>>2,h=(3&o)<<6|c;e+=String.fromCharCode(a),64!==o&&(e+=String.fromCharCode(u)),64!==c&&(e+=String.fromCharCode(h))}return e},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}},E=new Map;async function D(t,n={}){const{crossOrigin:e="anonymous"}=n;return E.has(t)?E.get(t):new Promise((n,r)=>{const s=new Image;s.crossOrigin=e,s.onload=()=>{E.set(t,s),n(s)},s.onerror=()=>{r(new Error(`Failed to load image: ${t}`))},s.src=t})}async function N(t,n={}){const{type:e="text/javascript",async:r=!0,defer:s=!1}=n;return E.has(t)?E.get(t):new Promise((n,i)=>{const o=document.createElement("script");o.type=e,o.async=r,o.defer=s,o.onload=()=>{E.set(t,o),n(o)},o.onerror=()=>{o.remove(),i(new Error(`Failed to load script: ${t}`))},o.src=t,document.head.appendChild(o)})}async function R(t,n={}){const{media:e="all"}=n;return E.has(t)?E.get(t):new Promise((n,r)=>{const s=document.createElement("link");s.rel="stylesheet",s.href=t,s.media=e,s.onload=()=>{E.set(t,s),n(s)},s.onerror=()=>{s.remove(),r(new Error(`Failed to load stylesheet: ${t}`))},document.head.appendChild(s)})}const A={loadImage:D,loadImages:async function(t,n={}){const{parallel:e=!0}=n;if(e)return Promise.all(t.map(t=>D(t,n)));const r=[];for(const e of t)r.push(await D(e,n));return r},loadScript:N,loadStylesheet:R,loadFont:async function(t,n,e={}){const{weight:r="normal",style:s="normal"}=e,i=new FontFace(t,`url(${n})`,{weight:r,style:s});try{return await i.load(),document.fonts.add(i),i}catch(n){throw new Error(`Failed to load font: ${t}`)}},preload:async function(t,n="image"){switch(n){case"image":return D(t);case"script":return N(t);case"stylesheet":case"style":return R(t);default:throw new Error(`Unsupported preload type: ${n}`)}},isLoaded:function(t){return E.has(t)},clearCache:function(){E.clear()},clearCacheByUrl:function(t){E.delete(t)}},T={string:s,array:o,object:a,number:d,date:g,debounce:x,throttle:_,validator:j,crypto:C,preload:A};class F{constructor(){this.children={},this.keys=[]}}class P{constructor(){this.root=new F}insert(t){let n=this.root;const e=t.split(".");e.forEach((r,s)=>{n.children[r]||(n.children[r]=new F),n=n.children[r],s===e.length-1&&n.keys.push(t)})}getSubKeys(t){let n=this.root;const e=t.split("."),r=[];for(let t=0;t<e.length;t++){const s=e[t];if(!n.children[s])break;n=n.children[s];const i=t=>{t.keys.length>0&&r.push(...t.keys),Object.values(t.children).forEach(t=>i(t))};i(n)}return[...new Set(r)]}getParentKeys(t){const n=t.split("."),e=[];for(let t=1;t<=n.length;t++){const r=n.slice(0,t).join(".");e.push(r)}return e}}const I=Symbol("reactive_parent"),L=Symbol("reactive_path"),U=Symbol("reactive_is_reactive");class z{constructor(){this.rawData={},this.data=null,this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new P,this.updateQueue=new Map,this.isProcessing=!1,this.pendingComputed=new Set,this.persistedKeys=new Map,this.snapshots=[],this.snapshotLimit=10,this._=new WeakMap,this.createReactiveData()}createReactiveData(){const t={get:(t,n,e)=>{if("__raw__"===n)return t;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,n):r},set:(t,n,e,r)=>{const s=Reflect.get(t,n,r),i=Reflect.set(t,n,e,r),o=this.resolvePath(t,n);return this.notify(o,e,s),this.queueUpdate(o,e),i},deleteProperty:(t,n)=>{const e=Reflect.get(t,n,receiver),r=Reflect.deleteProperty(t,n),s=this.resolvePath(t,n);return this.notify(s,void 0,e),this.queueUpdate(s,void 0),r}};this.data=new Proxy(this.rawData,t),this.data.v=null,this.data.S=""}wrapReactive(t,n){if(t[U])return t;if(this._.has(t))return this._.get(t);const e=new Proxy(t,{get:(t,n,e)=>{if("__raw__"===n)return t;if(n===I||"__parent__"===n)return t[I];if(n===L||"__path__"===n)return t[L];if(n===U||"__isReactive__"===n)return!0;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,`${t[L]}${t[L]?".":""}${n}`):r},set:(t,n,e,r)=>{if(n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n)return!0;const s=Reflect.get(t,n,r),i=Reflect.set(t,n,e,r),o=`${t[L]}${t[L]?".":""}${n}`;return this.notify(o,e,s),this.queueUpdate(o,e),i},deleteProperty:(t,n)=>{if(n===I||n===L||n===U)return!1;const e=Reflect.get(t,n),r=Reflect.deleteProperty(t,n),s=`${t[L]}${t[L]?".":""}${n}`;return this.notify(s,void 0,e),this.queueUpdate(s,void 0),r},has:(t,n)=>"__raw__"===n||n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n||n in t,ownKeys:t=>Reflect.ownKeys(t).filter(t=>t!==I&&t!==L&&t!==U),getOwnPropertyDescriptor:(t,n)=>n===I||n===L||n===U?{configurable:!1,enumerable:!1,writable:!1,value:t[n]}:Reflect.getOwnPropertyDescriptor(t,n)});return t[I]=t,t[L]=n,t[U]=!0,this._.set(t,e),Object.keys(t).forEach(e=>{t[e]&&"object"==typeof t[e]&&!Array.isArray(t[e])&&(t[e]=this.wrapReactive(t[e],`${n}${n?".":""}${e}`))}),e}resolvePath(t,n){return t[L]?`${t[L]}.${n}`:n}queueUpdate(t,n){this.updateQueue.set(t,n),this.isProcessing||(this.isProcessing=!0,requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){const t=new Set;this.updateQueue.forEach((n,e)=>{t.add(e),this.updateElementsDirect(e,n);this.pathTrie.getSubKeys(e).forEach(n=>{if(!t.has(n)){const e=this.get(n);this.updateElementsDirect(n,e),t.add(n)}})}),this.updateQueue.clear(),this.processComputed(),this.isProcessing=!1}updateElementsDirect(t,n){this.elements[t]&&this.elements[t].forEach(t=>{this.updateElement(t,n)})}processComputed(){Object.keys(this.computedProperties).forEach(t=>{this.computedProperties[t].deps.some(t=>this.updateQueue.has(t)||this.pathTrie.getSubKeys(t).some(t=>this.updateQueue.has(t)))&&this.updateComputedProperty(t)})}set(t,n,e=!1){const r=this.get(t);"object"==typeof t?(Object.assign(this.rawData,t),Object.keys(t).forEach(n=>{e||(this.notify(n,t[n],r?.[n]),this.queueUpdate(n,t[n]))})):(t.includes(".")?this.setNested(t,n):this.rawData[t]=n,e||(this.notify(t,n,r),this.queueUpdate(t,n))),e||this.processComputed()}get(t){if(t)return t.includes(".")?this.getNested(t):this.rawData[t]}getNested(t){if(t)return t.split(".").reduce((t,n)=>t?.[n],this.rawData)}setNested(t,n){const e=t.split("."),r=e.pop(),s=e.reduce((t,n)=>(t[n]||(t[n]={}),t[n]),this.rawData),i=s[r];s[r]=n,this.notify(t,n,i),this.queueUpdate(t,n)}observe(t,n){this.observers[t]||(this.observers[t]=[]),this.observers[t].push(n)}unobserve(t,n){this.observers[t]&&(this.observers[t]=this.observers[t].filter(t=>t!==n))}notify(t,n,e){this.observers[t]&&this.observers[t].forEach(t=>{try{t(n,e)}catch(t){}}),this.observers["*"]?.forEach(r=>{try{r(t,n,e)}catch(t){}})}updateElement(t,n){const e=t.getAttribute("data-bind");if(!e)return;e.split("|").forEach(e=>{const r=e.split(":"),s=r[0].trim(),i=r[1]?.trim();switch(s){case"text":t.textContent!==String(n??"")&&(t.textContent=n??"");break;case"html":const e=function(t){if(!t)return"";let n=String(t);const e=/<\s*(script|iframe|object|embed|applet|form|base|link|meta|style)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>|<\s*(script|iframe|object|embed|applet|form|base|link|meta|style)\b[^>]*\/?>/gi;let r;do{r=n,n=n.replace(e,"")}while(n!==r);return n=n.replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),n=n.replace(/(href|src|action|background)\s*=\s*(?:"[^"]*(?:javascript|vbscript|data)\s*:[^"]*"|'[^']*(?:javascript|vbscript|data)\s*:[^']*'|[^\s>]*(?:javascript|vbscript|data)\s*:[^\s>]*)/gi,'$1=""'),n=n.replace(/expression\s*\([^)]*\)/gi,""),n}(n);t.innerHTML!==e&&(t.innerHTML=e);break;case"value":"checkbox"===t.type?t.checked!==!!n&&(t.checked=!!n):t.value!==String(n??"")&&(t.value=n??"");break;case"checked":t.checked!==!!n&&(t.checked=!!n);break;case"disabled":t.disabled!==!!n&&(t.disabled=!!n);break;case"hidden":const r=n?"none":"";t.style.display!==r&&(t.style.display=r);break;case"class":i&&(n?t.classList.add(i):t.classList.remove(i));break;case"style":i&&t.style[i]!==String(n??"")&&(t.style[i]=n??"");break;case"attr":if(i){t.getAttribute(i)!==String(n??"")&&t.setAttribute(i,n??"")}break;case"src":t.src!==String(n??"")&&(t.src=n??"");break;case"href":t.href!==String(n??"")&&(t.href=n??"");break;case"placeholder":t.placeholder!==String(n??"")&&(t.placeholder=n??"")}})}computed(t,n,e){this.computedProperties[t]={deps:n,callback:e},n.forEach(t=>{this.pathTrie.insert(t)}),this.updateComputedProperty(t)}updateComputedProperty(t){const n=this.computedProperties[t];if(n)try{const e=n.deps.map(t=>this.get(t)),r=n.callback(...e);this.set(t,r,!0)}catch(t){}}load(t){Object.keys(t).forEach(n=>{t[n]&&"object"==typeof t[n]&&!Array.isArray(t[n])?this.rawData[n]=this.wrapReactive(t[n],n):this.rawData[n]=t[n],this.queueUpdate(n,this.rawData[n])}),this.processComputed()}reset(){this.rawData={},this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new P,this.updateQueue.clear(),this.snapshots=[],this.createReactiveData(),this.bind()}persist(t,n={}){const{storage:e="local",debounce:r=0,version:s=1,encrypt:i=!1,encryptionKey:o=null}=n,c="session"===e?sessionStorage:localStorage;this.persistedKeys.set(t,{storage:c,debounce:r,timeout:null,version:s,encrypt:i,encryptionKey:o});const a=this.get(t);void 0!==a&&this.$(t,a,c,{version:s,encrypt:i,encryptionKey:o}),this.observe(t,n=>{const e=this.persistedKeys.get(t);e&&(e.debounce>0?(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(()=>{this.$(t,n,e.storage,{version:e.version,encrypt:e.encrypt,encryptionKey:e.encryptionKey})},e.debounce)):this.$(t,n,e.storage,{version:e.version,encrypt:e.encrypt,encryptionKey:e.encryptionKey}))})}$(t,n,e,r={}){try{const{version:s=1,encrypt:i=!1,encryptionKey:o=null}=r,c={value:n,version:s,timestamp:Date.now()};let a=JSON.stringify(c);i&&o&&(a=this.O(a,o)),this.k(e),e.setItem(`kupola:${t}`,a)}catch(r){if("QuotaExceededError"===r.name&&e===localStorage)try{sessionStorage.setItem(`kupola:${t}`,JSON.stringify({value:n,version:1}))}catch(t){}}}k(t){try{const n="kupola:__storage_test__";t.setItem(n,"test"),t.removeItem(n)}catch(n){"QuotaExceededError"===n.name&&this.M(t)}}M(t){const n=Date.now();for(let e=0;e<t.length;e++){const r=t.key(e);if(r?.startsWith("kupola:"))try{const e=JSON.parse(t.getItem(r));e.timestamp&&n-e.timestamp>2592e6&&t.removeItem(r)}catch(n){t.removeItem(r)}}}O(t,n){return window.CryptoJS?window.CryptoJS.AES.encrypt(t,n).toString():t}j(t,n){if(!window.CryptoJS)return t;try{return window.CryptoJS.AES.decrypt(t,n).toString(window.CryptoJS.enc.Utf8)}catch(n){return t}}unpersist(t){const n=this.persistedKeys.get(t);n&&(n.timeout&&clearTimeout(n.timeout),n.storage.removeItem(`kupola:${t}`),this.persistedKeys.delete(t))}loadPersisted(t={}){const n={},{encryptionKey:e=null}=t;for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);if(s?.startsWith("kupola:")){const r=s.replace("kupola:","");try{const i=localStorage.getItem(s);let o;if(e){const t=this.j(i,e);o=JSON.parse(t)}else o=JSON.parse(i);if(void 0!==o.version&&o.version!==t.version)continue;n[r]=void 0!==o.value?o.value:o}catch(t){}}}for(let r=0;r<sessionStorage.length;r++){const s=sessionStorage.key(r);if(s?.startsWith("kupola:")){const r=s.replace("kupola:","");try{const i=sessionStorage.getItem(s);let o;if(e){const t=this.j(i,e);o=JSON.parse(t)}else o=JSON.parse(i);if(void 0!==o.version&&o.version!==t.version)continue;n[r]=void 0!==o.value?o.value:o}catch(t){}}}return Object.keys(n).length>0&&this.load(n),n}C(t){if("function"==typeof structuredClone)try{return structuredClone(t)}catch(t){}return JSON.parse(JSON.stringify(t))}snapshot(){const t=this.C(this.rawData);return this.snapshots.push(t),this.snapshots.length>this.snapshotLimit&&this.snapshots.shift(),this.snapshots.length-1}rollback(t=-1){if(0===this.snapshots.length)return!1;const n=t>=0?t:this.snapshots.length-1,e=this.snapshots[n];return!!e&&(this.rawData=this.C(e),this.createReactiveData(),Object.keys(this.rawData).forEach(t=>{this.queueUpdate(t,this.rawData[t])}),this.processComputed(),!0)}getSnapshotCount(){return this.snapshots.length}clearSnapshots(){this.snapshots=[]}serializeForm(t){const n={};return t.querySelectorAll("input, select, textarea").forEach(t=>{const e=t.getAttribute("data-bind");if(!e)return;const r=e.split(":"),s=r[1]?.trim();s&&("checkbox"===t.type?(n[s]||(n[s]=[]),t.checked&&n[s].push(t.value)):"radio"===t.type?t.checked&&(n[s]=t.value):n[s]=t.value)}),n}fillForm(t,n){Object.keys(n).forEach(e=>{t.querySelectorAll('[data-bind*=":'+e+'"]').forEach(t=>{"checkbox"===t.type?t.checked=Array.isArray(n[e])?n[e].includes(t.value):!!n[e]:"radio"===t.type?t.checked=t.value===n[e]:t.value=n[e]??""})})}createReactive(t,n=""){if(t[U])return t;if(this._.has(t))return this._.get(t);const e={get:(t,n,e)=>{if("__raw__"===n)return t;if(n===I||"__parent__"===n)return t[I];if(n===L||"__path__"===n)return t[L];if(n===U||"__isReactive__"===n)return!0;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,`${t[L]}${t[L]?".":""}${n}`):r},set:(t,n,e,r)=>{if(n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n)return!0;const s=Reflect.get(t,n,r),i=Reflect.set(t,n,e,r),o=`${t[L]}${t[L]?".":""}${n}`;return this.notify(o,e,s),this.queueUpdate(o,e),i},deleteProperty:(t,n)=>{if(n===I||n===L||n===U)return!1;const e=Reflect.get(t,n),r=Reflect.deleteProperty(t,n),s=`${t[L]}${t[L]?".":""}${n}`;return this.notify(s,void 0,e),this.queueUpdate(s,void 0),r},has:(t,n)=>"__raw__"===n||n===I||n===L||n===U||"__parent__"===n||"__path__"===n||"__isReactive__"===n||n in t,ownKeys:t=>Reflect.ownKeys(t).filter(t=>t!==I&&t!==L&&t!==U),getOwnPropertyDescriptor:(t,n)=>n===I||n===L||n===U?{configurable:!1,enumerable:!1,writable:!1,value:t[n]}:Reflect.getOwnPropertyDescriptor(t,n)},r=new Proxy(t,e);return t[I]=t,t[L]=n,t[U]=!0,this._.set(t,r),Object.keys(t).forEach(e=>{t[e]&&"object"==typeof t[e]&&!Array.isArray(t[e])&&(t[e]=this.wrapReactive(t[e],`${n}${n?".":""}${e}`))}),r}bind(){document.querySelectorAll("[data-bind]").forEach(t=>{this.D(t)}),this.N||(this.R=!1,this.N=new MutationObserver(t=>{if(!this.R){this.R=!0;try{t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){t.querySelectorAll("[data-bind]").forEach(t=>this.D(t)),t.hasAttribute&&t.hasAttribute("data-bind")&&this.D(t)}})})}finally{this.R=!1}}}),this.N.observe(document.body,{childList:!0,subtree:!0}))}D(t){const n=t.getAttribute("data-bind").split(":");n[0].split("|")[0].trim();const e=n[1]?.trim();if(e){if(this.pathTrie.insert(e),this.elements[e]||(this.elements[e]=[]),this.elements[e].includes(t)||this.elements[e].push(t),"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName){const n=t.A;n&&t.removeEventListener("input",n);const r=()=>{const n="checkbox"===t.type?t.checked:t.value;e.includes(".")?this.setNested(e,n):this.set(e,n)};t.A=r,t.addEventListener("input",r)}void 0!==this.rawData[e]&&this.updateElement(t,this.rawData[e])}}destroy(){this.N&&(this.N.disconnect(),this.N=null),Object.values(this.elements).forEach(t=>{t.forEach(t=>{const n=t.A;n&&(t.removeEventListener("input",n),delete t.A)})}),this.persistedKeys.forEach((t,n)=>{t.timeout&&clearTimeout(t.timeout)}),this.persistedKeys.clear(),this.rawData={},this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new P,this.updateQueue.clear(),this.snapshots=[]}}class H{constructor(t,n={}){this.name=t,this.T=`__store_${t}__`;const e=n.state?n.state():{};this.getters=n.getters||{},this.actions=n.actions||{},this.mutations=n.mutations||{},this.observers={},K?(K.set(this.T,e),this.state=K.data?.[this.T]||K.createReactive(e,this.T),K.observe(this.T,t=>{this.notify(t)})):this.state=e,this.F(),this.P()}F(){Object.keys(this.getters).forEach(t=>{Object.defineProperty(this,t,{get:()=>this.getters[t](this.state),enumerable:!0})})}P(){Object.keys(this.actions).forEach(t=>{this[t]=(...n)=>this.actions[t]({state:this.state,commit:this.commit.bind(this),dispatch:this.dispatch.bind(this),getters:this},...n)})}commit(t,n){const e=this.mutations[t];e&&e(this.state,n)}dispatch(t,n){const e=this.actions[t];if(e)return e({state:this.state,commit:this.commit.bind(this),dispatch:this.dispatch.bind(this),getters:this},n)}observe(t){return this.observers["*"]||(this.observers["*"]=[]),this.observers["*"].push(t),t}unobserve(t){this.observers["*"]&&(this.observers["*"]=this.observers["*"].filter(n=>n!==t))}notify(t){this.observers["*"]&&this.observers["*"].forEach(n=>{try{n(t)}catch(t){}}),K&&K.set(this.name,t)}toJSON(){return{name:this.name,state:this.state,getters:Object.keys(this.getters).reduce((t,n)=>(t[n]=this[n],t),{})}}}class B{constructor(){this.stores=new Map}createStore(t,n){const e=new H(t,n);return this.stores.set(t,e),e}getStore(t){return this.stores.get(t)}registerStore(t){t instanceof H&&this.stores.set(t.name,t)}dispose(){this.stores.clear()}}class J{constructor(){this.events={},this.delegatedEvents={},this.eventListeners={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),n}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(t=>t!==n))}emit(t,n){this.events[t]&&this.events[t].forEach(t=>{try{t(n)}catch(t){}}),this.events["*"]?.forEach(e=>{try{e(t,n)}catch(t){}})}once(t,n){const e=r=>{n(r),this.off(t,e)};return this.on(t,e),e}delegate(t,n,e){if(!this.delegatedEvents[n]){this.delegatedEvents[n]=[];const t=t=>{this.delegatedEvents[n].forEach(({selector:n,cb:e})=>{(t.target.matches(n)||t.target.closest(n))&&e(t)})};document.addEventListener(n,t),this.eventListeners[n]=t}return this.delegatedEvents[n].push({selector:t,cb:e}),e}undelegate(t,n){if(this.delegatedEvents[n]&&(this.delegatedEvents[n]=this.delegatedEvents[n].filter(n=>n.selector!==t),0===this.delegatedEvents[n].length)){const t=this.eventListeners[n];t&&(document.removeEventListener(n,t),delete this.eventListeners[n]),delete this.delegatedEvents[n]}}destroy(){Object.entries(this.eventListeners).forEach(([t,n])=>{document.removeEventListener(t,n)}),this.events={},this.delegatedEvents={},this.eventListeners={}}}function W(t=null){const n={I:t,L:new Set};return Object.defineProperty(n,"value",{configurable:!0,enumerable:!0,get:()=>n.I,set(t){t!==n.I&&(n.I=t,n.L.forEach(n=>n(t)))}}),n.subscribe=t=>(n.L.add(t),{unsubscribe(){n.L.delete(t)}}),n}const K=new z,q=new J,Y=new B;const Z={paths:{icons:"/icons/",base:"/"},theme:{default:"dark",brand:"zengqing"},i18n:{locale:"zh-CN",fallbackLocale:"en-US"},http:{baseURL:"",timeout:1e4,headers:{},withCredentials:!1},zIndex:{modal:1e3,dropdown:2e3,tooltip:2100,popover:2200,datepicker:2300,message:3e3,notification:3100,loading:5e3},ui:{defaultSize:"md",modal:{backdropClick:!0},dropdown:{closeOnClick:!0},datepicker:{weekStart:1},tooltip:{delay:300}},performance:{lazyLoad:!1,debounceDelay:200,throttleDelay:100,animationEnabled:!0},security:{xssProtection:!0,sanitizeHtml:{enabled:!0,allowedTags:["b","i","u","em","strong","a","br","p","span","div","img"],allowedAttributes:{a:["href","target","rel"],img:["src","alt","width","height"],span:["class","style"],div:["class","style"]}},maskData:{enabled:!0,patterns:{phone:{regex:"^(\\d{3})\\d{4}(\\d{4})$",replace:"$1****$2"},email:{regex:"^(.)(.*)(@.*)$",replace:"$1***$3"},idCard:{regex:"^(\\d{6})\\d{8}(\\d{4})$",replace:"$1********$2"},bankCard:{regex:"^(\\d{4})\\d{8}(\\d{4})$",replace:"$1 **** **** $2"}}},secureId:{length:16,charset:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}},message:{duration:3e3,position:"top-right",maxCount:5},notification:{duration:4500,position:"top-right"},validation:{defaultRules:[],showErrors:!0,trigger:"blur"},components:{autoInit:!0,silentErrors:!1}},X=[];function G(){if("undefined"!=typeof window&&window.kupolaConfig)try{it(Z,window.kupolaConfig),Q()}catch(t){}}function Q(){X.forEach(t=>{try{t(Z)}catch(t){}})}function V(t){"function"==typeof t&&X.push(t)}function tt(t){return t?function(t,n){return n.split(".").reduce((t,n)=>void 0!==(t&&t[n])?t[n]:void 0,t)}(Z,t):Z}function nt(){return Z.paths.base+Z.paths.icons.replace(/^\//,"")}function et(){return Z.theme.default}function rt(){return Z.theme.brand}function st(){return Z.security}function it(t,n){for(const e in n)n[e]instanceof Object&&e in t&&t[e]instanceof Object?it(t[e],n[e]):t[e]=n[e];return t}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",G):G());const ot="kupola-theme",ct="kupola-brand";V(t=>{const n=document.querySelector("[data-theme-toggle]");if(n){const t=ut();lt(n),ht(t)}});const at=[{id:"green",name:"翠绿",color:"#32F08C"},{id:"xionghuang",name:"雄黄",color:"#FF9900"},{id:"jianghuang",name:"姜黄",color:"#E2C027"},{id:"lanlv",name:"蓝绿",color:"#12A182"},{id:"kongquelan",name:"孔雀蓝",color:"#0EB0C9"},{id:"meiguizi",name:"玫瑰紫",color:"#BA2F7B"},{id:"shihong",name:"柿红",color:"#F2481B"},{id:"quhong",name:"紫云",color:"#B1A6CC"},{id:"shanchahong",name:"山茶红",color:"#F05A46"},{id:"zengqing",name:"曾青",color:"#535164"},{id:"roulan",name:"柔蓝",color:"#106898"}];function ut(){return localStorage.getItem(ot)||et()}function ht(t){if("dark"!==t&&"light"!==t)return;var n=document.documentElement;n.hasAttribute("data-kupola-theme-preloaded")&&(n.style.removeProperty("--bg-base-default"),n.style.removeProperty("--text-default"),n.removeAttribute("data-kupola-theme-preloaded")),n.setAttribute("data-theme",t),localStorage.setItem(ot,t);const e=document.querySelector("[data-theme-toggle]");e&&(e.setAttribute("data-current-theme",t),lt(e))}function ft(){return localStorage.getItem(ct)||rt()}function dt(t){const n=at.find(n=>n.id===t);if(!n)return;document.documentElement.setAttribute("data-brand",t),localStorage.setItem(ct,t);const e=document.querySelector("[data-brand-toggle]");if(e){e.setAttribute("data-current-brand",t);const r=e.querySelector(".brand-icon");r&&(r.style.backgroundColor=n.color);const s=e.querySelector(".brand-name");s&&(s.textContent=n.name)}document.querySelectorAll("[data-brand-btn]").forEach(n=>{n.getAttribute("data-brand-btn")===t?n.classList.add("is-active"):n.classList.remove("is-active")})}function lt(t){const n=t.querySelector(".theme-icon");if(n){const t=ut(),e=nt();n.src="dark"===t?e+"sun.svg":e+"moon.svg"}}function pt(t){t.preventDefault();ht("dark"===ut()?"light":"dark")}function mt(){var t=document.documentElement;t.hasAttribute("data-kupola-theme-preloaded")&&(t.style.removeProperty("--bg-base-default"),t.style.removeProperty("--text-default"),t.removeAttribute("data-kupola-theme-preloaded"));const n=document.querySelector("[data-theme-toggle]");ht(ut());dt(ft()),document.body.classList.add("theme-initialized"),setTimeout(()=>{document.body.classList.add("theme-initialized")},1500),n&&(lt(n),n.removeEventListener("click",pt),n.addEventListener("click",pt));let e=document.getElementById("brand-picker");e||(e=document.createElement("div"),e.id="brand-picker",e.style.position="fixed",e.style.top="64px",e.style.right="16px",e.style.zIndex="9998",e.style.display="none",e.style.padding="12px",e.style.width="200px",e.style.gridTemplateColumns="repeat(3, 1fr)",e.style.gap="6px",e.style.backgroundColor="var(--bg-base-secondary)",e.style.border="1px solid var(--border-neutral-l1)",e.style.borderRadius="8px",e.style.boxShadow="0 4px 20px rgba(0, 0, 0, 0.2)",e.style.overflow="hidden",at.forEach(t=>{const n=document.createElement("button");n.setAttribute("data-brand-btn",t.id),n.style.display="flex",n.style.justifyContent="center",n.style.alignItems="center",n.style.height="60px",n.style.backgroundColor=t.color,n.style.color=["#32F08C","#FF9900","#E2C027","#0EB0C9","#B1A6CC"].includes(t.color)?"#0C0C0D":"#FFFFFF",n.style.fontWeight="500",n.style.borderRadius="4px",n.style.border="none",n.style.cursor="pointer",n.style.margin="0",n.style.padding="0",n.textContent=t.name,e.appendChild(n)}),document.body.appendChild(e));const r=document.querySelector("[data-brand-toggle]");function s(t){e&&r&&(e.contains(t.target)||r.contains(t.target)||(e.style.display="none",document.removeEventListener("click",s,!0)))}r&&e&&(r.onclick=function(t){t.stopPropagation(),t.preventDefault();const n="none"===e.style.display;e.style.display=n?"grid":"none",n?setTimeout(()=>{document.addEventListener("click",s,!0)},0):document.removeEventListener("click",s,!0)},e.onclick=function(t){t.stopPropagation()});document.querySelectorAll("[data-brand-btn]").forEach(t=>{t.addEventListener("click",n=>{n.stopPropagation();dt(t.getAttribute("data-brand-btn")),e&&(e.style.display="none")})})}class yt{constructor(){this.initializers=new Map,this.cleanupFunctions=new Map,this.processedElements=new WeakSet,this.U=["data-component"],this.H=[],this.B=null}register(t,n,e=null,r={}){this.initializers.set(t,n),e&&this.cleanupFunctions.set(t,e),r.dataAttribute&&!this.U.includes(r.dataAttribute)&&(this.U.push(r.dataAttribute),this.B=null),r.cssClass&&!this.H.includes(r.cssClass)&&(this.H.push(r.cssClass),this.B=null)}unregister(t){this.initializers.delete(t),this.cleanupFunctions.delete(t)}has(t){return this.initializers.has(t)}get(t){return this.initializers.get(t)}J(){if(null!==this.B)return this.B;const t=this.U.map(t=>`[${t}]`);for(const n of this.H)t.push(`.${n}`);return this.B=t.join(", "),this.B}async initialize(t){if(this.processedElements.has(t))return;for(const n of this.U){const e=t.getAttribute(n);if(null!==e){const r=e||n.replace("data-",""),s=this.initializers.get(r)||this.initializers.get(n.replace("data-",""));if(s){try{await s(t),this.processedElements.add(t)}catch(t){}return}}}const n=t.className;if("string"==typeof n)for(const e of this.H){if(new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)){const n=e.replace("ds-",""),r=this.initializers.get(n)||this.initializers.get(e);if(r){try{await r(t),this.processedElements.add(t)}catch(t){}return}}}}cleanup(t){for(const n of this.U){const e=t.getAttribute(n);if(null!==e){const r=e||n.replace("data-",""),s=this.cleanupFunctions.get(r)||this.cleanupFunctions.get(n.replace("data-",""));if(s){try{s(t)}catch(t){}return void this.processedElements.delete(t)}}}const n=t.className;if("string"==typeof n)for(const e of this.H){if(new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)){const n=e.replace("ds-",""),r=this.cleanupFunctions.get(n)||this.cleanupFunctions.get(e);if(r){try{r(t)}catch(t){}return void this.processedElements.delete(t)}}}}async initializeAll(t=document){const n=this.J();if(!n)return;const e=t.querySelectorAll(n),r=[];e.forEach(t=>{this.processedElements.has(t)||r.push(this.initialize(t))}),await Promise.all(r)}}const wt=new yt,bt=[{attr:"data-dropdown",cls:"ds-dropdown"},{attr:"data-select",cls:"ds-select"},{attr:"data-datepicker",cls:"ds-datepicker"},{attr:"data-timepicker",cls:"ds-timepicker"},{attr:"data-slider",cls:"ds-slider"},{attr:"data-carousel",cls:"ds-carousel"},{attr:"data-drawer",cls:"ds-drawer"},{attr:"data-modal",cls:"ds-modal"},{attr:"data-dialog",cls:"ds-dialog"},{attr:"data-color-picker",cls:"ds-color-picker"},{attr:"data-calendar",cls:"ds-calendar"},{attr:"data-slide-captcha",cls:"ds-slide-captcha"},{attr:"data-heatmap",cls:"ds-heatmap"},{cls:"ds-tooltip"},{cls:"ds-tag"},{cls:"ds-statcard"},{cls:"ds-collapse"},{cls:"ds-fileupload"},{cls:"ds-notification"},{cls:"ds-message"}];for(const t of bt)t.attr&&!wt.U.includes(t.attr)&&wt.U.push(t.attr),t.cls&&!wt.H.includes(t.cls)&&wt.H.push(t.cls);class gt{constructor(n){this.element=n,this.isMounted=!1,this.isDestroyed=!1,this.props=this.W(),this.state={},this.slots=this.K(),this.q={},this.Y=[],this.lifecycle=new t,this.setupContext=null}W(){const t={};for(const n of this.element.attributes)if(n.name.startsWith("data-prop-")){const e=n.name.replace("data-prop-","");let r=n.value;try{r=JSON.parse(r)}catch(t){}t[e]=r}return t}K(){const t={};return this.element.querySelectorAll("[data-slot]").forEach(n=>{const e=n.getAttribute("data-slot")||"default";t[e]=n.innerHTML.trim(),n.remove()}),!t.default&&this.element.children.length>0&&(t.default=this.element.innerHTML.trim()),t}$slot(t="default"){return this.slots[t]||""}$emit(t,n){if((this.q[t]||[]).forEach(t=>{try{t(n)}catch(t){}}),this.element){const e=new CustomEvent(`kupola:${t}`,{detail:n,bubbles:!0,cancelable:!0});this.element.dispatchEvent(e)}}$on(t,n){return this.q[t]||(this.q[t]=[]),this.q[t].push(n),n}$off(t,n){this.q[t]&&(this.q[t]=this.q[t].filter(t=>t!==n))}async setProps(t){try{this.props={...this.props,...t},await this.lifecycle.update(),this.setupContext?.Z()}catch(n){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"update",hook:"setProps",error:n,args:[t]})}}async setState(t){try{this.state={...this.state,...t},await this.lifecycle.update(),this.setupContext?.Z()}catch(n){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"update",hook:"setState",error:n,args:[t]})}}async mount(){if(!this.isMounted&&!this.isDestroyed)try{if(this.X(),await this.lifecycle.bootstrap(),"function"==typeof this.setup){const t=this.setup();t instanceof Promise&&await t}this.isMounted=!0,await this.lifecycle.mount(),this.setupContext?.G()}catch(t){if(this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"mount",hook:"component",error:t,args:[]}),"function"==typeof this.renderError)try{this.renderError(t)}catch(t){}else this.element.innerHTML=`\n <div style="padding: 16px; background: #fee2e2; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b;">\n <div style="font-weight: bold; margin-bottom: 8px;">Component Error</div>\n <div style="font-size: 12px; white-space: pre-wrap;">${t.message}</div>\n </div>\n `}}X(){if(this.V)return;const t={beforeMount:"beforeMount",render:["mount","update"],afterMount:"afterMount",updated:"afterUpdate",beforeUnmount:"beforeUnmount",afterUnmount:"afterUnmount",renderError:"errorBoundary"};let n=Object.getPrototypeOf(this);const e=new Set;for(;n&&n.constructor!==Object&&n.constructor!==gt;){for(const[r,s]of Object.entries(t))e.has(r)||n.hasOwnProperty(r)&&(Array.isArray(s)?s.forEach(t=>{"render"===r&&this.lifecycle.on(t,()=>this.render?.())}):"renderError"===r?this.lifecycle.on(s,t=>(this.renderError(t.error),"handled")):this.lifecycle.on(s,()=>this[r]?.()),e.add(r));n=Object.getPrototypeOf(n)}this.V=!0}async unmount(){if(this.isMounted&&!this.isDestroyed)try{this.setupContext?.tt(),await this.lifecycle.unmount(),this.isMounted=!1,this.isDestroyed=!0,await this.lifecycle.destroy()}catch(t){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"unmount",hook:"component",error:t,args:[]}),this.isMounted=!1,this.isDestroyed=!0}}beforeMount(){}afterMount(){}beforeUnmount(){}afterUnmount(){}render(){}renderError(t){}updated(){}setup(){}}function xt(t,n){Object.keys(n).forEach(e=>{if("constructor"!==e)if("function"==typeof n[e]){const r=t.prototype[e];t.prototype[e]=r?function(...t){return n[e].apply(this,t),r.apply(this,t)}:n[e]}else t.prototype[e]=n[e]})}class _t{constructor(){this.components=new Map,this.lazyComponents=new Map,this.loadedComponents=new Map,this.instances=new Map,this.observer=null,this.mixins=new Map,this.loadingPromises=new Map}register(t,n){if(!(n.prototype instanceof gt))throw new Error(`Component ${t} must extend KupolaComponent`);this.components.set(t,n)}registerLazy(t,n){this.lazyComponents.set(t,n)}unregister(t){this.components.delete(t),this.lazyComponents.delete(t),this.loadedComponents.delete(t),this.loadingPromises.delete(t)}get(t){return this.components.get(t)||this.loadedComponents.get(t)}async getAsync(t){const n=this.components.get(t)||this.loadedComponents.get(t);if(n)return n;if(this.loadingPromises.has(t))return this.loadingPromises.get(t);const e=this.lazyComponents.get(t);if(!e)throw new Error(`Component ${t} not found`);const r=(async()=>{try{const n=await e(),r=n.default||n;if(!(r.prototype instanceof gt))throw new Error(`Component ${t} must extend KupolaComponent`);return this.loadedComponents.set(t,r),r}catch(n){throw this.loadingPromises.delete(t),n}})();return this.loadingPromises.set(t,r),r}defineMixin(t,n){this.mixins.set(t,n)}useMixin(t,...n){n.forEach(n=>{const e=this.mixins.get(n);e&&xt(t,e)})}async bootstrap(t=document){await this.nt(t),this.et(t)}async nt(t){const n=t.querySelectorAll("[data-component]"),e=[];n.forEach(t=>{e.push(this.rt(t))}),await Promise.all(e)}async rt(t){if(!t.st&&!t.it){t.it=!0;try{const n=t.getAttribute("data-component");if(n){const e=wt.get(n);if(e)try{return void await e(t)}catch(t){}}let e=this.components.get(n);if(!e){try{e=await this.getAsync(n)}catch(t){return}if(!t.isConnected)return}const r=t.getAttribute("data-mixins"),s=e;r&&r.split(",").forEach(t=>{const n=this.mixins.get(t.trim());n&&xt(s,n)});const i=new s(t);t.st=i,this.instances.set(t,i),i.mount()}finally{t.it=!1}}}et(t){this.observer||(this.observer=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){t.hasAttribute("data-component")&&this.rt(t).catch(t=>{}),this.nt(t).catch(t=>{}),wt.initialize(t).catch(()=>{});const n=wt.J();n&&t.querySelectorAll?.(n).forEach(t=>{wt.initialize(t).catch(()=>{})})}}),t.removedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const n=this.instances.get(t);n&&(n.unmount(),this.instances.delete(t)),t.querySelectorAll("[data-component]").forEach(t=>{const n=this.instances.get(t);n&&(n.unmount(),this.instances.delete(t))}),wt.cleanup(t),t.querySelectorAll?.("*").forEach(t=>{wt.cleanup(t)})}})})}),this.observer.observe(t,{childList:!0,subtree:!0}))}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.instances.forEach(t=>{t.unmount()}),this.instances.clear(),this.components.clear(),this.mixins.clear()}}async function vt(){if("undefined"!=typeof window){!function(){if(st().xssProtection&&"undefined"!=typeof document){let t=document.querySelector('meta[http-equiv="X-XSS-Protection"]');t||(t=document.createElement("meta"),t.setAttribute("http-equiv","X-XSS-Protection"),t.setAttribute("content","1; mode=block"),document.head.insertBefore(t,document.head.firstChild)),t=document.querySelector('meta[http-equiv="X-Content-Type-Options"]'),t||(t=document.createElement("meta"),t.setAttribute("http-equiv","X-Content-Type-Options"),t.setAttribute("content","nosniff"),document.head.insertBefore(t,document.head.firstChild))}}();const t=tt();K.loadPersisted(),K.bind(),mt(),!1!==t.components?.autoInit&&(await wt.initializeAll(),exports.kupolaRegistry&&await exports.kupolaRegistry.bootstrap())}}exports.kupolaRegistry=null,"undefined"!=typeof window&&(exports.kupolaRegistry=new _t),"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",vt):"undefined"!=typeof window&&setTimeout(vt,0);class St{constructor(t={}){const n=tt();this.locales=t.locales||{},this.currentLocale=t.defaultLocale||n.i18n?.locale||"zh-CN",this.fallbackLocale=t.fallbackLocale||n.i18n?.fallbackLocale||"en-US",this.delimiter=t.delimiter||".",this.missingHandler=t.missingHandler||(t=>t),this.ot()}ot(){document.querySelectorAll('script[type="application/json"][data-kupola-i18n]').forEach(t=>{const n=t.dataset.kupolaI18n;if(n)try{const e=JSON.parse(t.textContent);this.addLocale(n,e)}catch(t){}});const t=document.documentElement.lang;t&&this.locales[t]&&(this.currentLocale=t)}addLocale(t,n){this.locales[t]||(this.locales[t]={}),this.ct(this.locales[t],n)}ct(t,n){for(const e of Object.keys(n))n[e]instanceof Object&&e in t?this.ct(t[e],n[e]):t[e]=n[e]}setLocale(t){return!!this.locales[t]&&(this.currentLocale=t,document.documentElement.lang=t,this.ut(),!0)}getLocale(){return this.currentLocale}t(t,n={}){let e=this.ht(t,this.currentLocale);return e||(e=this.ht(t,this.fallbackLocale)),e?this.ft(e,n):this.missingHandler(t)}ht(t,n){if(!this.locales[n])return null;const e=t.split(this.delimiter);let r=this.locales[n];for(const t of e){if(!r||"object"!=typeof r||!(t in r))return null;r=r[t]}return"string"==typeof r?r:null}ft(t,n){return t.replace(/\{(\w+)\}/g,(t,e)=>void 0!==n[e]?n[e]:t)}n(t,n,e={}){const r=this.t(t,{...e,count:n});if(!r)return r;const s=r.split("|");return 1===s.length?r.replace("{count}",n):2===s.length?1===n?s[0]:s[1]:s.length>=3?0===n?s[0]:1===n?s[1]:s[2]:r}ut(){const t=new CustomEvent("kupola:i18n:change",{detail:{locale:this.currentLocale},bubbles:!0});document.dispatchEvent(t)}async loadLocale(t,n){try{const e=await fetch(n),r=await e.json();return this.addLocale(t,r),!0}catch(t){return!1}}getAvailableLocales(){return Object.keys(this.locales)}hasLocale(t){return!!this.locales[t]}formatDate(t,n={}){const e=n.locale||this.currentLocale,r="string"==typeof t?new Date(t):t;return new Intl.DateTimeFormat(e,n).format(r)}formatNumber(t,n={}){const e=n.locale||this.currentLocale;return new Intl.NumberFormat(e,n).format(t)}formatCurrency(t,n,e={}){const r=e.locale||this.currentLocale;return new Intl.NumberFormat(r,{style:"currency",currency:n,...e}).format(t)}formatRelativeTime(t,n,e={}){const r=e.locale||this.currentLocale;return new Intl.RelativeTimeFormat(r,e).format(t,n)}}const $t=new St;class Ot{constructor(){this.dt=new Map,this.lt=new Map}on(t,n,e,r={}){const{scope:s=null,once:i=!1,passive:o=!1,capture:c=!1}=r,a=this.yt(),u={id:a,target:t,eventName:n,handler:e,scope:s,once:i,wrappedHandler:null};u.wrappedHandler=n=>{i&&this.offById(a),e.call(t,n)};const h=this.wt(t,n);return this.dt.has(h)||this.dt.set(h,[]),this.dt.get(h).push(u),s&&(this.lt.has(s)||this.lt.set(s,[]),this.lt.get(s).push(a)),t.addEventListener(n,u.wrappedHandler,{passive:o,capture:c}),{unsubscribe:()=>this.offById(a)}}once(t,n,e,r={}){return this.on(t,n,e,{...r,once:!0})}off(t,n,e){const r=this.wt(t,n);if(!this.dt.has(r))return;const s=this.dt.get(r),i=s.filter(t=>t.handler!==e);s.forEach(r=>{r.handler===e&&(t.removeEventListener(n,r.wrappedHandler),this.bt(r))}),0===i.length?this.dt.delete(r):this.dt.set(r,i)}offById(t){for(const[n,e]of this.dt){const r=e.findIndex(n=>n.id===t);if(-1!==r){const t=e[r];return t.target.removeEventListener(t.eventName,t.wrappedHandler),e.splice(r,1),0===e.length&&this.dt.delete(n),this.bt(t),!0}}return!1}offByScope(t){if(!this.lt.has(t))return;this.lt.get(t).forEach(t=>{this.offById(t)}),this.lt.delete(t)}offAll(t,n=null){if(n){const e=this.wt(t,n);if(!this.dt.has(e))return;this.dt.get(e).forEach(e=>{t.removeEventListener(n,e.wrappedHandler),this.bt(e)}),this.dt.delete(e)}else for(const[n,e]of this.dt){const[r]=n.split(":");this.gt(t)===r&&(e.forEach(n=>{t.removeEventListener(n.eventName,n.wrappedHandler),this.bt(n)}),this.dt.delete(n))}}emit(t,n,e={}){const r=new CustomEvent(n,{detail:e,bubbles:!0,cancelable:!0});return t.dispatchEvent(r),r}emitGlobal(t,n={}){return this.emit(document,t,n)}emitToScope(t,n,e={}){if(!this.lt.has(t))return;const r=this.lt.get(t),s=new Set;for(const[t,n]of this.dt)n.forEach(t=>{r.includes(t.id)&&s.add(t.target)});s.forEach(t=>{this.emit(t,n,e)})}getListenerCount(t,n=null){if(n){const e=this.wt(t,n);return this.dt.has(e)?this.dt.get(e).length:0}let e=0;const r=this.gt(t);for(const[t,n]of this.dt){const[s]=t.split(":");s===r&&(e+=n.length)}return e}getScopeListenerCount(t){return this.lt.has(t)?this.lt.get(t).length:0}hasListeners(t,n=null){return this.getListenerCount(t,n)>0}wt(t,n){return`${this.gt(t)}:${n}`}gt(t){return t===document?"document":t===window?"window":t===document.body?"body":(t.xt||(t.xt=this.yt()),t.xt)}yt(){return`ge-${Math.random().toString(36).substr(2,9)}-${Date.now()}`}bt(t){if(!t.scope||!this.lt.has(t.scope))return;const n=this.lt.get(t.scope),e=n.indexOf(t.id);-1!==e&&(n.splice(e,1),0===n.length&&this.lt.delete(t.scope))}destroy(){for(const[t,n]of this.dt)n.forEach(t=>{t.target.removeEventListener(t.eventName,t.wrappedHandler)});this.dt.clear(),this.lt.clear()}}const kt=new Ot;class Mt{constructor(){this._t=new Set,this.vt=!1,this.St=0,this.$t=10}schedule(t){this._t.add(t),this.vt||(this.vt=!0,queueMicrotask(()=>this.Ot()))}Ot(){if(this.St>=this.$t)return this._t.clear(),void(this.vt=!1);const t=Array.from(this._t);this._t.clear(),this.vt=!1,this.St++;const n=new Set;for(const e of t)if(!n.has(e)){n.add(e);try{e()}catch(t){}}this.St--}}const jt=new Mt;class Ct{constructor(t,n){this.data=t,this.createdAt=Date.now(),this.ttl=n}get isFresh(){return Date.now()-this.createdAt<this.ttl}get isStale(){return!this.isFresh}}class Et{constructor(){this.kt=new Map}get(t){const n=this.kt.get(t);return n||null}set(t,n,e=6e4){this.kt.set(t,new Ct(n,e))}has(t){return this.kt.has(t)}delete(t){this.kt.delete(t)}clear(){this.kt.clear()}getStale(t){const n=this.kt.get(t);return n?n.data:null}}class Dt extends Error{constructor(t,n,e){super(t),this.name="DependsError",this.code=n,this.cause=e,this.timestamp=Date.now()}}let Nt="undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch.bind(globalThis):"undefined"!=typeof window&&window.fetch?window.fetch.bind(window):null;class Rt{constructor(t,n){this.config=t,this.cacheKey=t.cacheKey||String(t.source),this.staleTime=t.staleTime??6e4,this.cache=n,this.subscribers=[],this.pending=null,this.retryCount=t.retry??0,this.retryDelay=t.retryDelay??1e3,this.onError=t.onError||null}subscribe(t){return this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);n>-1&&this.subscribers.splice(n,1)}}notify(){jt.schedule(()=>{this.subscribers.forEach(t=>{try{t()}catch(t){}})})}async fetch(t){throw new Dt("Source fetch not implemented","NOT_IMPLEMENTED")}async getValue(t){const n=this.cache.get(this.cacheKey);return n&&n.isFresh?n.data:n&&n.isStale?(this.Mt(t),n.data):this.jt(t)}async jt(t,n=0){try{const n=await this.fetch(t);return this.cache.set(this.cacheKey,n,this.staleTime),this.notify(),n}catch(e){if(n<this.retryCount){const e=this.retryDelay*Math.pow(2,n),r=e+Math.random()*e*.5;return await new Promise(t=>setTimeout(t,r)),this.jt(t,n+1)}const r=e instanceof Dt?e:new Dt(e.message||"Fetch failed","FETCH_ERROR",e);if(this.onError)try{this.onError(r)}catch(t){}throw r}}async Mt(t){try{await this.jt(t)}catch(t){}}invalidate(){this.cache.delete(this.cacheKey),this.pending=null}destroy(){this.subscribers=[],this.pending=null}}class At extends Rt{constructor(t,n){super(t,n),this.method=t.method||"GET",this.headers=t.headers||{},this.queryParams=t.query||{}}async fetch(t){let n=this.config.source;const e=tt("http");!e?.baseURL||n.startsWith("http://")||n.startsWith("https://")||(n=e.baseURL+n.replace(/^\//,""));for(const e in t)n=n.replace(`:${e}`,encodeURIComponent(t[e]));const r=[];for(const[t,n]of Object.entries(this.queryParams||{}))r.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);for(const n in t)this.config.source.includes(`:${n}`)||r.push(`${encodeURIComponent(n)}=${encodeURIComponent(t[n])}`);r.length>0&&(n+=(n.includes("?")?"&":"?")+r.join("&"));const s=e?.headers||{},i={method:this.method.toUpperCase(),headers:{"Content-Type":"application/json",...s,...this.headers}};e?.withCredentials&&(i.credentials="include"),["POST","PUT","PATCH"].includes(i.method)&&(i.body=JSON.stringify(t));const o=Nt;if(!o)throw new Dt("No HTTP client available. Use configureHttpClient() to set one.","NO_HTTP_CLIENT");const c=await o(n,i),a="boolean"==typeof c.ok?c.ok:c.status>=200&&c.status<300,u="number"==typeof c.status?c.status:0;if(!a)throw new Dt(`HTTP ${u}`,"HTTP_ERROR");return"function"==typeof c.json?await c.json():void 0!==c.data?c.data:c}}class Tt extends Rt{constructor(t,n){super(t,n),this.storageKey=t.source.replace("localStorage:",""),this.defaultValue=t.default,this.sync=!1!==t.sync,this.sync&&"undefined"!=typeof window&&(this.Ct=t=>{t.key===this.storageKey&&(this.cache.delete(this.cacheKey),this.notify())},window.addEventListener("storage",this.Ct))}async fetch(){try{const t=localStorage.getItem(this.storageKey);if(null===t)return this.defaultValue;try{return JSON.parse(t)}catch(n){return t}}catch(t){return this.defaultValue}}setValue(t){const n="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(this.storageKey,n),this.cache.delete(this.cacheKey),this.notify()}destroy(){super.destroy(),this.Ct&&window.removeEventListener("storage",this.Ct)}}class Ft extends Rt{constructor(t,n){super(t,n),this.paramName=t.source.replace("route:","")}async fetch(){if("undefined"==typeof window)return"";const t=location.hash.slice(1).match(new RegExp(`/${this.paramName}/([^/]+)`));if(t)return decodeURIComponent(t[1]);return new URLSearchParams(location.search).get(this.paramName)||""}}class Pt extends Rt{async fetch(t){return await this.config.source(t)}}class It extends Rt{async fetch(){return this.config.source}}class Lt extends Rt{constructor(t,n){super(t,n),this.ws=null,this.reconnect=!1!==t.reconnect,this.reconnectDelay=t.reconnectDelay||3e3,this.Et=0,this.Dt=t.maxReconnectDelay||3e4,this.messageHandler=null,this.Nt=!1,this.Rt=!1}async fetch(){return new Promise((t,n)=>{try{this.ws=new WebSocket(this.config.source),this.ws.onopen=()=>{this.Nt=!0,this.Et=0,t(this.cache.getStale(this.cacheKey))},this.messageHandler=t=>{let n;try{n=JSON.parse(t.data)}catch(e){n=t.data}this.cache.set(this.cacheKey,n,this.staleTime),this.notify()},this.ws.onmessage=this.messageHandler,this.ws.onerror=t=>{this.Nt||n(new Dt("WebSocket connection failed","WS_ERROR",t))},this.ws.onclose=()=>{if(this.Nt=!1,this.reconnect&&!this.Rt){const t=this.reconnectDelay*Math.pow(2,this.Et),n=Math.random()*t*.3,e=Math.min(t+n,this.Dt);this.Et++,setTimeout(()=>{this.Rt||this.fetch().catch(()=>{})},e)}}}catch(t){n(new Dt("WebSocket creation failed","WS_ERROR",t))}})}send(t){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send("string"==typeof t?t:JSON.stringify(t))}destroy(){this.Rt=!0,super.destroy(),this.ws&&(this.ws.onmessage=null,this.ws.onclose=null,this.ws.close(),this.ws=null)}}function Ut(t,n){const e=t.source;return"function"==typeof e?new Pt(t,n):"string"==typeof e&&(e.startsWith("ws://")||e.startsWith("wss://"))?new Lt(t,n):"string"==typeof e&&(e.startsWith("/")||e.startsWith("http"))?new At(t,n):"string"==typeof e&&e.startsWith("localStorage:")?new Tt(t,n):"string"==typeof e&&e.startsWith("route:")?new Ft(t,n):new It(t,n)}function zt(t){const n={};for(const e in t){const r=t[e];n[e]=r&&"object"==typeof r&&"value"in r?r.value:r}return n}exports.BRAND_OPTIONS=at,exports.CacheEntry=Ct,exports.CacheManager=Et,exports.ComponentInitializerRegistry=yt,exports.DependsError=Dt,exports.DependsSource=Rt,exports.FetchedSource=At,exports.FunctionSource=Pt,exports.GlobalEvents=Ot,exports.KupolaComponent=gt,exports.KupolaComponentRegistry=_t,exports.KupolaDataBind=z,exports.KupolaEventBus=J,exports.KupolaI18n=St,exports.KupolaLifecycle=t,exports.KupolaStore=H,exports.KupolaStoreManager=B,exports.KupolaUtils=T,exports.RouteSource=Ft,exports.Scheduler=Mt,exports.StaticSource=It,exports.StorageSource=Tt,exports.WebSocketSource=Lt,exports.applyMixin=xt,exports.arrayUtils=o,exports.bootstrapComponents=function(t){return exports.kupolaRegistry?exports.kupolaRegistry.bootstrap(t):Promise.resolve()},exports.clearCache=function(){},exports.configureHttpClient=function(t){if(!t||"function"!=typeof t.fetch)throw new TypeError("[Kupola] configureHttpClient: client must provide a fetch function");Nt=t.fetch.bind(t)},exports.createBrandPicker=function(){const t=document.createElement("div");t.id="brand-picker-auto",t.style.position="fixed",t.style.top="56px",t.style.right="16px",t.style.zIndex="9998",t.style.display="none",t.style.padding="12px",t.style.width="200px",t.style.gridTemplateColumns="repeat(3, 1fr)",t.style.gap="6px",t.style.backgroundColor="var(--bg-base-secondary)",t.style.border="1px solid var(--border-neutral-l1)",t.style.borderRadius="8px",t.style.boxShadow="0 4px 20px rgba(0, 0, 0, 0.2)",t.style.overflow="hidden",at.forEach(n=>{const e=document.createElement("button");e.setAttribute("data-brand-btn",n.id),e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.height="60px",e.style.backgroundColor=n.color,e.style.color=["#32F08C","#FF9900","#E2C027","#0EB0C9","#B1A6CC"].includes(n.color)?"#0C0C0D":"#FFFFFF",e.style.fontWeight="500",e.style.borderRadius="4px",e.style.border="none",e.style.cursor="pointer",e.style.margin="0",e.style.padding="0",e.textContent=n.name,t.appendChild(e)}),document.body.appendChild(t);const n=document.createElement("button");n.setAttribute("data-brand-toggle",""),n.setAttribute("data-current-brand",ft()),n.className="ds-btn ds-btn--ghost ds-btn--sm",n.style.position="fixed",n.style.top="16px",n.style.right="56px",n.style.zIndex="9999",n.style.display="flex",n.style.alignItems="center",n.style.gap="6px";const e=document.createElement("span");e.className="brand-icon",e.style.width="12px",e.style.height="12px",e.style.borderRadius="50%",e.style.backgroundColor=at.find(t=>t.id===ft()).color;const r=document.createElement("span");function s(e){t.contains(e.target)||n.contains(e.target)||(t.style.display="none",document.removeEventListener("click",s,!0))}return r.className="brand-name",r.style.fontSize="11px",r.textContent=at.find(t=>t.id===ft()).name,n.appendChild(e),n.appendChild(r),document.body.appendChild(n),n.onclick=function(n){n.stopPropagation(),n.preventDefault();const e="none"===t.style.display;t.style.display=e?"grid":"none",e?setTimeout(()=>{document.addEventListener("click",s,!0)},0):document.removeEventListener("click",s,!0)},t.onclick=function(t){t.stopPropagation()},t.querySelectorAll("[data-brand-btn]").forEach(n=>{n.addEventListener("click",e=>{e.stopPropagation();dt(n.getAttribute("data-brand-btn")),t.style.display="none"})}),{toggleBtn:n,container:t}},exports.createI18n=function(t){return new St(t)},exports.createLifecycle=function(n="app"){return new t(n)},exports.createSource=Ut,exports.createStore=function(t,n){return Y.createStore(t,n)},exports.createThemeToggle=function(){const t=document.createElement("button");t.setAttribute("data-theme-toggle",""),t.setAttribute("data-current-theme",ut()),t.className="ds-btn ds-btn--ghost ds-btn--sm ds-btn--icon",t.style.position="fixed",t.style.top="16px",t.style.right="16px",t.style.zIndex="9999";const n=document.createElement("img");n.className="theme-icon";const e=nt();return n.src="dark"===ut()?e+"sun.svg":e+"moon.svg",n.width=14,n.height=14,n.alt="Toggle theme",t.appendChild(n),document.body.appendChild(t),t.onclick=function(t){t.preventDefault();ht("dark"===ut()?"light":"dark")},t},exports.cryptoUtils=C,exports.dateUtils=g,exports.debounce=x,exports.defineComponent=function(t,n){if(!n||"object"!=typeof n)throw new Error(`defineComponent("${t}"): options must be an object`);n.componentClass?exports.kupolaRegistry&&exports.kupolaRegistry.register(t,n.componentClass):n.lazy&&exports.kupolaRegistry&&exports.kupolaRegistry.registerLazy(t,n.lazy),n.init?wt.register(t,n.init,n.cleanup||null,{dataAttribute:n.dataAttribute,cssClass:n.cssClass}):(n.dataAttribute||n.cssClass)&&wt.register(t,()=>{},null,{dataAttribute:n.dataAttribute,cssClass:n.cssClass})},exports.defineMixin=function(t,n){exports.kupolaRegistry&&exports.kupolaRegistry.defineMixin(t,n)},exports.emit=function(t,n,e){return kt.emit(t,n,e)},exports.emitGlobal=function(t,n){return kt.emitGlobal(t,n)},exports.escapeHtml=function(t){if("string"!=typeof t)return t;const n=document.createElement("div");return n.textContent=t,n.innerHTML},exports.formatCurrency=function(t,n,e={}){return $t.formatCurrency(t,n,e)},exports.formatDate=function(t,n={}){return $t.formatDate(t,n)},exports.formatNumber=function(t,n={}){return $t.formatNumber(t,n)},exports.generateSecureId=function(t,n){const e=st(),r=e?.secureId||{},s=t||r.length||16,i=r.charset||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";if("undefined"==typeof crypto||!crypto.getRandomValues){let t="";for(let n=0;n<s;n++)t+=i[Math.floor(Math.random()*i.length)];return n?`${n}_${t}`:t}const o=new Uint32Array(s);crypto.getRandomValues(o);let c="";for(let t=0;t<s;t++)c+=i[o[t]%i.length];return n?`${n}_${c}`:c},exports.getBasePath=function(){return Z.paths.base},exports.getBrand=ft,exports.getConfig=tt,exports.getDefaultBrand=rt,exports.getDefaultTheme=et,exports.getHttpClient=function(){return Nt},exports.getHttpConfig=function(){return Z.http},exports.getIconsPath=nt,exports.getListenerCount=function(t,n){return kt.getListenerCount(t,n)},exports.getLocale=function(){return $t.getLocale()},exports.getMessageConfig=function(){return Z.message},exports.getNotificationConfig=function(){return Z.notification},exports.getPerformanceConfig=function(){return Z.performance},exports.getSecurityConfig=st,exports.getStore=function(t){return Y.getStore(t)},exports.getTheme=ut,exports.getUiConfig=function(){return Z.ui},exports.getValidationConfig=function(){return Z.validation},exports.globalEvents=kt,exports.initTheme=mt,exports.kupolaBootstrap=vt,exports.kupolaData=K,exports.kupolaEvents=q,exports.kupolaI18n=$t,exports.kupolaInitializer=wt,exports.kupolaLifecycle=n,exports.kupolaStoreManager=Y,exports.maskData=function(t,n,e={}){const r=st(),s=r?.maskData||{};if(!s.enabled&&!e.force)return t;if(null==t)return t;const i=(e.patterns||s.patterns||{})[n];if(!i)return t;const o="string"==typeof i.regex?new RegExp(i.regex):i.regex;return String(t).replace(o,i.replace)},exports.n=function(t,n,e={}){return $t.n(t,n,e)},exports.numberUtils=d,exports.objectUtils=a,exports.off=function(t,n,e){kt.off(t,n,e)},exports.offAll=function(t,n){kt.offAll(t,n)},exports.offByScope=function(t){kt.offByScope(t)},exports.offConfigChange=function(t){const n=X.indexOf(t);n>-1&&X.splice(n,1)},exports.on=function(t,n,e,r){return kt.on(t,n,e,r)},exports.onConfigChange=V,exports.once=function(t,n,e,r){return kt.once(t,n,e,r)},exports.preloadUtils=A,exports.ref=W,exports.registerComponent=function(t,n){exports.kupolaRegistry&&exports.kupolaRegistry.register(t,n)},exports.registerLazyComponent=function(t,n){exports.kupolaRegistry&&exports.kupolaRegistry.registerLazy(t,n)},exports.resetHttpClient=function(){Nt="undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch.bind(globalThis):"undefined"!=typeof window&&window.fetch?window.fetch.bind(window):null},exports.sanitizeHtml=function(t,n={}){const e=st(),r=e?.sanitizeHtml||{};if(!r.enabled&&!n.force)return t;const s=n.allowedTags||r.allowedTags||[],i=n.allowedAttributes||r.allowedAttributes||{};if("string"!=typeof t)return t;const o=(new DOMParser).parseFromString(t,"text/html");return o.body.querySelectorAll("*").forEach(t=>{const n=t.tagName.toLowerCase();s.includes(n)?Array.from(t.attributes).forEach(e=>{const r=e.name.toLowerCase();(i[n]||[]).includes(r)||t.removeAttribute(e.name)}):t.remove()}),o.body.innerHTML},exports.setBrand=dt,exports.setConfig=function(t){it(Z,t),Q()},exports.setLocale=function(t){return $t.setLocale(t)},exports.setTheme=ht,exports.stringUtils=s,exports.stripHtml=function(t){return"string"!=typeof t?t:(new DOMParser).parseFromString(t,"text/html").body.textContent||""},exports.t=function(t,n={}){return $t.t(t,n)},exports.throttle=_,exports.useDeps=function(t,n){const e={},r=new Et,s=[];for(const i in n){let o=n[i];"string"==typeof o&&(o={source:o});const c=Ut({...o,cacheKey:o.cacheKey||`${i}-${JSON.stringify(zt(t))}`},r),a=W(null),u=W(!0),h=W(null),f=W(null);let d=0;async function l(){const n=++d;u.value=!0,h.value=null;try{const e=await c.getValue(zt(t));if(n!==d)return;a.value=e,f.value=Date.now()}catch(t){if(n!==d)return;h.value=t.message||"Unknown error"}finally{n===d&&(u.value=!1)}}l();const p=c.subscribe(()=>{const t=r.getStale(c.cacheKey);null!=t&&(a.value=t,f.value=Date.now())});s.push(p);const m=Object.keys(t);m.length>0&&m.forEach(n=>{const e=t[n];if(e&&"object"==typeof e&&"value"in e&&e.L){const t=()=>{c.invalidate(),l()};e.L.add(t),s.push(()=>e.L.delete(t))}}),e[i]={data:a,loading:u,error:h,lastUpdated:f,refresh:()=>(c.invalidate(),l()),setValue(t){c instanceof Tt&&(c.setValue(t),a.value=t)},send(t){c instanceof Lt&&c.send(t)},At:c}}return e.Tt=()=>{if(s.forEach(t=>t()),window.__kupolaDepInstances){const t=window.__kupolaDepInstances.indexOf(e);-1!==t&&window.__kupolaDepInstances.splice(t,1)}},window.__kupolaDepInstances||(window.__kupolaDepInstances=[]),window.__kupolaDepInstances.push(e),e},exports.useMixin=function(t,...n){exports.kupolaRegistry&&exports.kupolaRegistry.useMixin(t,...n)},exports.useQuery=function(t){const n=new Et,e=Ut(t,n),r=W(null),s=W(!0),i=W(null);let o=0;async function c(){const n=++o;s.value=!0,i.value=null;try{const s=await e.getValue(t.params||{});if(n!==o)return;r.value=s}catch(t){if(n!==o)return;i.value=t.message||"Unknown error"}finally{n===o&&(s.value=!1)}}return c(),e.subscribe(()=>{const t=n.getStale(e.cacheKey);null!=t&&(r.value=t)}),{data:r,loading:s,error:i,refresh:()=>(e.invalidate(),c())}},exports.validatorUtils=j;
|
package/dist/core.esm.js
CHANGED
|
@@ -1,106 +1 @@
|
|
|
1
|
-
import { B, C, h, i, D, j, F, l, G, K, m, n, o, p, q, s, t, u, R, S, v, w, W, x, y, z, A, E, H, I, J, L, M, N, O, P, Q, T, U, V, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, d, c, f, ab, ac, ad, g, e, a, ae, af, ag, ah, ai, k, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, r, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN } from "./core-oOQWnSRW.js";
|
|
2
|
-
export {
|
|
3
|
-
B as BRAND_OPTIONS,
|
|
4
|
-
C as CacheEntry,
|
|
5
|
-
h as CacheManager,
|
|
6
|
-
i as ComponentInitializerRegistry,
|
|
7
|
-
D as DependsError,
|
|
8
|
-
j as DependsSource,
|
|
9
|
-
F as FetchedSource,
|
|
10
|
-
l as FunctionSource,
|
|
11
|
-
G as GlobalEvents,
|
|
12
|
-
K as KupolaComponent,
|
|
13
|
-
m as KupolaComponentRegistry,
|
|
14
|
-
n as KupolaDataBind,
|
|
15
|
-
o as KupolaEventBus,
|
|
16
|
-
p as KupolaI18n,
|
|
17
|
-
q as KupolaLifecycle,
|
|
18
|
-
s as KupolaStore,
|
|
19
|
-
t as KupolaStoreManager,
|
|
20
|
-
u as KupolaUtils,
|
|
21
|
-
R as RouteSource,
|
|
22
|
-
S as Scheduler,
|
|
23
|
-
v as StaticSource,
|
|
24
|
-
w as StorageSource,
|
|
25
|
-
W as WebSocketSource,
|
|
26
|
-
x as applyMixin,
|
|
27
|
-
y as arrayUtils,
|
|
28
|
-
z as bootstrapComponents,
|
|
29
|
-
A as clearCache,
|
|
30
|
-
E as configureHttpClient,
|
|
31
|
-
H as createBrandPicker,
|
|
32
|
-
I as createI18n,
|
|
33
|
-
J as createLifecycle,
|
|
34
|
-
L as createSource,
|
|
35
|
-
M as createStore,
|
|
36
|
-
N as createThemeToggle,
|
|
37
|
-
O as cryptoUtils,
|
|
38
|
-
P as dateUtils,
|
|
39
|
-
Q as debounce,
|
|
40
|
-
T as defineComponent,
|
|
41
|
-
U as defineMixin,
|
|
42
|
-
V as emit,
|
|
43
|
-
X as emitGlobal,
|
|
44
|
-
Y as escapeHtml,
|
|
45
|
-
Z as formatCurrency,
|
|
46
|
-
_ as formatDate,
|
|
47
|
-
$ as formatNumber,
|
|
48
|
-
a0 as generateSecureId,
|
|
49
|
-
a1 as getBasePath,
|
|
50
|
-
a2 as getBrand,
|
|
51
|
-
a3 as getConfig,
|
|
52
|
-
a4 as getDefaultBrand,
|
|
53
|
-
a5 as getDefaultTheme,
|
|
54
|
-
a6 as getHttpClient,
|
|
55
|
-
a7 as getHttpConfig,
|
|
56
|
-
a8 as getIconsPath,
|
|
57
|
-
a9 as getListenerCount,
|
|
58
|
-
aa as getLocale,
|
|
59
|
-
d as getMessageConfig,
|
|
60
|
-
c as getNotificationConfig,
|
|
61
|
-
f as getPerformanceConfig,
|
|
62
|
-
ab as getSecurityConfig,
|
|
63
|
-
ac as getStore,
|
|
64
|
-
ad as getTheme,
|
|
65
|
-
g as getUiConfig,
|
|
66
|
-
e as getValidationConfig,
|
|
67
|
-
a as globalEvents,
|
|
68
|
-
ae as initTheme,
|
|
69
|
-
af as kupolaBootstrap,
|
|
70
|
-
ag as kupolaData,
|
|
71
|
-
ah as kupolaEvents,
|
|
72
|
-
ai as kupolaI18n,
|
|
73
|
-
k as kupolaInitializer,
|
|
74
|
-
aj as kupolaLifecycle,
|
|
75
|
-
ak as kupolaRegistry,
|
|
76
|
-
al as kupolaStoreManager,
|
|
77
|
-
am as maskData,
|
|
78
|
-
an as n,
|
|
79
|
-
ao as numberUtils,
|
|
80
|
-
ap as objectUtils,
|
|
81
|
-
aq as off,
|
|
82
|
-
ar as offAll,
|
|
83
|
-
as as offByScope,
|
|
84
|
-
at as offConfigChange,
|
|
85
|
-
au as on,
|
|
86
|
-
av as onConfigChange,
|
|
87
|
-
aw as once,
|
|
88
|
-
ax as preloadUtils,
|
|
89
|
-
r as ref,
|
|
90
|
-
ay as registerComponent,
|
|
91
|
-
az as registerLazyComponent,
|
|
92
|
-
aA as resetHttpClient,
|
|
93
|
-
aB as sanitizeHtml,
|
|
94
|
-
aC as setBrand,
|
|
95
|
-
aD as setConfig,
|
|
96
|
-
aE as setLocale,
|
|
97
|
-
aF as setTheme,
|
|
98
|
-
aG as stringUtils,
|
|
99
|
-
aH as stripHtml,
|
|
100
|
-
aI as t,
|
|
101
|
-
aJ as throttle,
|
|
102
|
-
aK as useDeps,
|
|
103
|
-
aL as useMixin,
|
|
104
|
-
aM as useQuery,
|
|
105
|
-
aN as validatorUtils
|
|
106
|
-
};
|
|
1
|
+
class t{constructor(t="app"){this.scope=t,this.hooks=new Map,this.state="created",this.stateHistory=["created"],this.transitions=new Map([["created",["bootstrapped","destroyed"]],["bootstrapped",["mounted","destroyed"]],["mounted",["updated","unmounted","destroyed"]],["updated",["updated","unmounted","destroyed"]],["unmounted",["mounted","destroyed"]],["destroyed",[]]]),this.phaseStateMap={bootstrap:{from:"created",to:"bootstrapped"},mount:{from:["bootstrapped","unmounted"],to:"mounted"},update:{from:["mounted","updated"],to:"updated"},unmount:{from:["mounted","updated"],to:"unmounted"},destroy:{from:["bootstrapped","mounted","updated","unmounted"],to:"destroyed"}},this.basePhases=["bootstrap","mount","update","unmount","destroy"],this.allPhases=["error","errorBoundary"],this.basePhases.forEach(t=>{this.allPhases.push(`before${t.charAt(0).toUpperCase()+t.slice(1)}`),this.allPhases.push(t),this.allPhases.push(`after${t.charAt(0).toUpperCase()+t.slice(1)}`)}),this.allPhases.forEach(t=>{this.hooks.set(t,[])}),this.pendingHooks=new Set,this.trace=[],this.errorHandler=null,this.errorBoundary=null,this.lastError=null,this.errorCount=0,this.maxErrors=10,this.i=null}o(t){const n=this.transitions.get(this.state);if(!n||!n.includes(t))throw new Error(`Invalid state transition: ${this.state} -> ${t}`);return!0}u(t){this.o(t),this.state=t,this.stateHistory.push(t)}h(t){const n=this.hooks.get(t);n&&n.forEach(t=>{t.resolved=!1})}on(t,n,e={}){if(!this.allPhases.includes(t))throw new Error(`Unknown lifecycle phase: ${t}`);const r=this.hooks.get(t);return r.push({handler:n,priority:e.priority||0,depends:e.depends||[],name:e.name||n.name||`anonymous_${r.length}`}),r.sort((t,n)=>n.priority-t.priority),()=>{const t=r.findIndex(t=>t.handler===n);t>-1&&r.splice(t,1)}}async l(t,n){if(t&&0!==t.length)for(const e of t){const t=this.hooks.get(n).find(t=>t.name===e);t&&!t.resolved&&(await t.handler(),t.resolved=!0)}}async emit(t,...n){if("destroyed"===this.state&&"error"!==t)return;const e=this.hooks.get(t);if(!e||0===e.length)return;const r=`${t}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;this.pendingHooks.add(r);const i=performance.now();try{for(const i of e){await this.l(i.depends,t);const e=performance.now();let s,o;try{s=i.handler(...n),s instanceof Promise&&await s,i.resolved=!0}catch(e){o=e,"error"!==t&&await this.p({phase:t,hook:i.name,error:e,args:n})}const c=performance.now()-e;this.trace.push({emitId:r,phase:t,hookName:i.name,duration:c,status:o?"error":"success",error:o?o.message:null,timestamp:Date.now()})}performance.now()}finally{this.pendingHooks.delete(r)}}async runPhase(t,...n){if(!this.basePhases.includes(t))throw new Error(`Unknown base phase: ${t}`);const e=this.phaseStateMap[t];if(e)if(Array.isArray(e.from)){if(!e.from.includes(this.state))throw new Error(`Cannot ${t} from state ${this.state}, expected one of: ${e.from.join(", ")}`)}else if(this.state!==e.from)throw new Error(`Cannot ${t} from state ${this.state}, expected ${e.from}`);const r=`before${t.charAt(0).toUpperCase()+t.slice(1)}`,i=`after${t.charAt(0).toUpperCase()+t.slice(1)}`;this.h(r),this.h(t),this.h(i),this.allPhases.includes(r)&&await this.emit(r,...n),await this.emit(t,...n),e&&this.u(e.to),this.allPhases.includes(i)&&await this.emit(i,...n)}async bootstrap(...t){await this.runPhase("bootstrap",...t)}async m(){return new Promise(t=>{if("complete"===document.readyState||"interactive"===document.readyState)return void t();const n=()=>{document.removeEventListener("DOMContentLoaded",n),window.removeEventListener("load",n),t()};document.addEventListener("DOMContentLoaded",n),window.addEventListener("load",n)})}async mount(...t){await this.runPhase("mount",...t)}async mountWithDOMReady(...t){await this.m(),await this.runPhase("mount",...t)}async update(...t){await this.runPhase("update",...t)}async unmount(...t){await this.runPhase("unmount",...t)}async destroy(...t){await this.runPhase("destroy",...t),this.hooks.forEach(t=>{t.length=0})}getPhaseHandlers(t){return this.hooks.get(t)||[]}hasHandlers(t){const n=this.hooks.get(t);return n&&n.length>0}getTrace(){return[...this.trace]}clearTrace(){this.trace=[]}getState(){return this.state}getStateHistory(){return[...this.stateHistory]}isInState(t){return this.state===t}onError(t){return this.i=t,this.on("error",t)}setErrorBoundary(t){return this.errorBoundary=t,this.on("errorBoundary",n=>"function"==typeof t?t(n):null)}setMaxErrors(t){this.maxErrors=t}getErrorCount(){return this.errorCount}getLastError(){return this.lastError}resetErrorCount(){this.errorCount=0,this.lastError=null}async p(t){if(this.errorCount++,this.lastError=t.error,this.errorCount>=this.maxErrors)return;if(await this.emit("error",t),"function"==typeof this.i)try{await this.i(t)}catch(t){}const n=this.hooks.get("errorBoundary");if(n&&n.length>0)for(const e of n)try{const n=e.handler(t);if(n instanceof Promise&&await n,"handled"===n)return}catch(t){}}}const n=new t("app");function e(n="app"){return new t(n)}const r=new Set(["__proto__","prototype","constructor"]);function i(t){return r.has(t)}const s={trim:function(t){return t?t.trim():""},trimLeft:function(t){return t?t.replace(/^\s+/,""):""},trimRight:function(t){return t?t.replace(/\s+$/,""):""},toUpperCase:function(t){return t?t.toUpperCase():""},toLowerCase:function(t){return t?t.toLowerCase():""},capitalize:function(t){return t?t.charAt(0).toUpperCase()+t.slice(1):""},camelize:function(t){return t?t.replace(/-(\w)/g,(t,n)=>n?n.toUpperCase():""):""},hyphenate:function(t){return t?t.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):""},padStart:function(t,n,e=" "){return(String(t)||"").padStart(n,e)},padEnd:function(t,n,e=" "){return(String(t)||"").padEnd(n,e)},truncate:function(t,n,e="..."){return!t||t.length<=n?t||"":t.slice(0,n)+e},replaceAll:function(t,n,e){return t?t.split(n).join(e):""},format:function(t,n){return t?t.replace(/\{\{(\w+)\}\}/g,(t,e)=>void 0!==n[e]?n[e]:`{{${e}}}`):""},startsWith:function(t,n){return(t||"").startsWith(n)},endsWith:function(t,n){return(t||"").endsWith(n)},includes:function(t,n){return(t||"").includes(n)},repeat:function(t,n){return(t||"").repeat(n)},reverse:function(t){return(t||"").split("").reverse().join("")},countOccurrences:function(t,n){return t&&n?t.split(n).length-1:0},escapeHtml:function(t){if(!t)return"";const n=document.createElement("div");return n.textContent=t,n.innerHTML},unescapeHtml:function(t){if(!t)return"";const n=document.createElement("div");return n.innerHTML=t,n.textContent},generateRandom:function(t=8){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";for(let r=0;r<t;r++)e+=n.charAt(Math.floor(62*Math.random()));return e},generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}};function o(t){return t?t.reduce((t,n)=>t+(Number(n)||0),0):0}const c={isArray:function(t){return Array.isArray(t)},isEmpty:function(t){return!t||0===t.length},size:function(t){return t?t.length:0},first:function(t,n){return t&&t.length>0?t[0]:n},last:function(t,n){return t&&t.length>0?t[t.length-1]:n},get:function(t,n,e){return t&&void 0!==t[n]?t[n]:e},slice:function(t,n,e){return t?t.slice(n,e):[]},concat:function(...t){return t.reduce((t,n)=>t.concat(n||[]),[])},join:function(t,n=","){return t?t.join(n):""},indexOf:function(t,n,e=0){if(!t)return-1;if(Number.isNaN(n)){for(let n=e;n<t.length;n++)if(Number.isNaN(t[n]))return n;return-1}return t.indexOf(n,e)},lastIndexOf:function(t,n,e){if(!t)return-1;if(Number.isNaN(n)){for(let n=void 0!==e?e:t.length-1;n>=0;n--)if(Number.isNaN(t[n]))return n;return-1}return t.lastIndexOf(n,e)},includes:function(t,n){return!!t&&t.includes(n)},push:function(t,...n){return t&&t.push(...n),t},pop:function(t){return t?t.pop():void 0},shift:function(t){return t?t.shift():void 0},unshift:function(t,...n){return t&&t.unshift(...n),t},remove:function(t,n){if(!t)return t;const e=Number.isNaN(n)?t.findIndex(t=>Number.isNaN(t)):t.indexOf(n);return e>-1&&t.splice(e,1),t},removeAt:function(t,n){return!t||n<0||n>=t.length||t.splice(n,1),t},insert:function(t,n,e){return t?(t.splice(n,0,e),t):t},reverse:function(t){return t?t.slice().reverse():[]},sort:function(t,n){return t?t.slice().sort(n):[]},sortBy:function(t,n,e="asc"){return t?t.slice().sort((t,r)=>{const i="object"==typeof t?t[n]:t,s="object"==typeof r?r[n]:r;return i<s?"asc"===e?-1:1:i>s?"asc"===e?1:-1:0}):[]},filter:function(t,n){return t?t.filter(n):[]},map:function(t,n){return t?t.map(n):[]},reduce:function(t,n,e){return t?t.reduce(n,e):e},forEach:function(t,n){t&&t.forEach(n)},every:function(t,n){return!t||t.every(n)},some:function(t,n){return!!t&&t.some(n)},find:function(t,n){return t?t.find(n):void 0},findIndex:function(t,n){return t?t.findIndex(n):-1},flat:function(t,n=1){return t?t.flat(n):[]},flattenDeep:function t(n){return n?n.reduce((n,e)=>Array.isArray(e)?n.concat(t(e)):n.concat(e),[]):[]},unique:function(t){return t?[...new Set(t)]:[]},uniqueBy:function(t,n){if(!t)return[];const e=new Set;return t.filter(t=>{const r="object"==typeof t?t[n]:t;return!e.has(r)&&(e.add(r),!0)})},chunk:function(t,n){if(!t||n<=0)return[];const e=[];for(let r=0;r<t.length;r+=n)e.push(t.slice(r,r+n));return e},shuffle:function(t){if(!t)return[];const n=t.slice();for(let t=n.length-1;t>0;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n},sum:o,average:function(t){return t&&0!==t.length?o(t)/t.length:0},max:function(t){return t&&t.length>0?Math.max(...t):-1/0},min:function(t){return t&&t.length>0?Math.min(...t):1/0},intersection:function(...t){return 0===t.length?[]:t.reduce((t,n)=>t.filter(t=>n&&n.includes(t)))},union:function(...t){return[...new Set(t.flat().filter(Boolean))]},difference:function(t,n){return t?t.filter(t=>!n||!n.includes(t)):[]},zip:function(...t){if(0===t.length)return[];const n=Math.max(...t.map(t=>t?t.length:0));return Array.from({length:n},(n,e)=>t.map(t=>t&&t[e]))}};function a(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)}const u={isObject:a,isEmpty:function(t){return!t||"object"!=typeof t||0===Object.keys(t).length},keys:function(t){return t?Object.keys(t):[]},values:function(t){return t?Object.values(t):[]},entries:function(t){return t?Object.entries(t):[]},has:function(t,n){return!!t&&Object.prototype.hasOwnProperty.call(t,n)},get:function(t,n,e){if(!t)return e;const r=n.split(".");return r.some(i)?e:r.reduce((t,n)=>t&&t[n],t)??e},set:function(t,n,e){if(!t||"object"!=typeof t)return t;const r=n.split(".");if(r.some(i))return t;const s=r.pop();let o=t;return r.forEach(t=>{o[t]&&"object"==typeof o[t]||(o[t]={}),o=o[t]}),o[s]=e,t},pick:function(t,n){return t?n.reduce((n,e)=>(void 0!==t[e]&&(n[e]=t[e]),n),{}):{}},omit:function(t,n){return t?Object.keys(t).reduce((e,r)=>(n.includes(r)||(e[r]=t[r]),e),{}):{}},merge:function t(...n){return n.reduce((n,e)=>(e&&"object"==typeof e&&Object.keys(e).forEach(r=>{i(r)||(a(e[r])&&a(n[r])?n[r]=t(n[r],e[r]):n[r]=e[r])}),n),{})},clone:function(t){return t?JSON.parse(JSON.stringify(t)):t},deepClone:function t(n,e=new WeakMap){if(!n||"object"!=typeof n)return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n);if(n instanceof RegExp)return new RegExp(n);if(n instanceof Map){const r=new Map;return e.set(n,r),n.forEach((n,i)=>r.set(i,t(n,e))),r}if(n instanceof Set){const r=new Set;return e.set(n,r),n.forEach(n=>r.add(t(n,e))),r}if(Array.isArray(n)){const r=[];return e.set(n,r),n.forEach(n=>r.push(t(n,e))),r}const r={};return e.set(n,r),Object.keys(n).forEach(s=>{i(s)||(r[s]=t(n[s],e))}),r},forEach:function(t,n){t&&Object.keys(t).forEach(e=>n(t[e],e,t))},map:function(t,n){if(!t)return{};const e={};return Object.keys(t).forEach(r=>{e[r]=n(t[r],r,t)}),e},filter:function(t,n){if(!t)return{};const e={};return Object.keys(t).forEach(r=>{n(t[r],r,t)&&(e[r]=t[r])}),e},reduce:function(t,n,e){return t?Object.keys(t).reduce((e,r)=>n(e,t[r],r,t),e):e},toArray:function(t){return t?Object.keys(t).map(n=>({key:n,value:t[n]})):[]},fromArray:function(t,n,e){return t?t.reduce((t,r)=>{const i="object"==typeof r?r[n]:r,s=e?r[e]:r;return void 0!==i&&(t[i]=s),t},{}):{}},size:function(t){return t?Object.keys(t).length:0},invert:function(t){if(!t)return{};const n={};return Object.keys(t).forEach(e=>{n[t[e]]=e}),n},isEqual:function t(n,e){if(n===e)return!0;if(!n||!e||"object"!=typeof n||"object"!=typeof e)return!1;const r=Object.keys(n),i=Object.keys(e);return r.length===i.length&&r.every(r=>t(n[r],e[r]))},freeze:function t(n){return n?(Object.freeze(n),Object.keys(n).forEach(e=>{"object"==typeof n[e]&&t(n[e])}),n):n},seal:function(t){return t?Object.seal(t):t}};function h(t){return"number"==typeof t&&!isNaN(t)}function f(...t){return t.flat().filter(h).reduce((t,n)=>t+n,0)}function d(t=0,n=1){return Math.random()*(n-t)+t}const l={isNumber:h,isInteger:function(t){return Number.isInteger(t)},isFloat:function(t){return h(t)&&!Number.isInteger(t)},isPositive:function(t){return h(t)&&t>0},isNegative:function(t){return h(t)&&t<0},isZero:function(t){return h(t)&&0===t},clamp:function(t,n,e){return h(t)?Math.min(Math.max(t,n),e):t},round:function(t,n=0){if(!h(t))return t;const e=Math.pow(10,n);return Math.round(t*e)/e},floor:function(t){return h(t)?Math.floor(t):t},ceil:function(t){return h(t)?Math.ceil(t):t},abs:function(t){return h(t)?Math.abs(t):t},min:function(...t){const n=t.filter(h);return n.length>0?Math.min(...n):void 0},max:function(...t){const n=t.filter(h);return n.length>0?Math.max(...n):void 0},sum:f,average:function(...t){const n=t.flat().filter(h);return n.length>0?f(n)/n.length:0},random:d,randomInt:function(t,n){return Math.floor(d(t,n+1))},format:function(t,n=2){return h(t)?t.toFixed(n):String(t)},formatCurrency:function(t,n="CNY",e=2){return h(t)?new Intl.NumberFormat("zh-CN",{style:"currency",currency:n,minimumFractionDigits:e,maximumFractionDigits:e}).format(t):String(t)},formatPercent:function(t,n=0){return h(t)?`${(100*t).toFixed(n)}%`:String(t)},toFixed:function(t,n=0){return h(t)?t.toFixed(n):String(t)},toPrecision:function(t,n=6){return h(t)?t.toPrecision(n):String(t)},isNaN:function(t){return Number.isNaN(t)},isFinite:function(t){return Number.isFinite(t)},parseInt:function(t,n=10){return Number.parseInt(t,n)},parseFloat:function(t){return Number.parseFloat(t)},toNumber:function(t,n=0){const e=Number(t);return isNaN(e)?n:e},safeDivide:function(t,n,e=0){return h(t)&&h(n)&&0!==n?t/n:e},safeMultiply:function(...t){return t.reduce((t,n)=>h(t)&&h(n)?t*n:0,1)}};function p(){return Date.now()}function m(){const t=new Date;return t.setHours(0,0,0,0),t}function y(t){return t instanceof Date&&!isNaN(t.getTime())}function w(t){return y(t)}function b(t,n){if(!y(t)||!y(n))return 0;const e=new Date(t);e.setHours(0,0,0,0);const r=new Date(n);return r.setHours(0,0,0,0),Math.floor((e.getTime()-r.getTime())/864e5)}function g(t,n=1){if(!y(t))return t;const e=new Date(t),r=e.getDay(),i=r>=n?r-n:r+(7-n);return e.setDate(e.getDate()-i),e.setHours(0,0,0,0),e}const x={now:p,today:m,tomorrow:function(){const t=m();return t.setDate(t.getDate()+1),t},yesterday:function(){const t=m();return t.setDate(t.getDate()-1),t},isDate:y,isValid:w,parse:function(t){const n=new Date(t);return w(n)?n:null},format:function(t,n="YYYY-MM-DD HH:mm:ss"){if(!y(t))return"";const e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),a=String(t.getMilliseconds()).padStart(3,"0"),u=["日","一","二","三","四","五","六"][t.getDay()];return n.replace("YYYY",e).replace("MM",r).replace("DD",i).replace("HH",s).replace("mm",o).replace("ss",c).replace("SSS",a).replace("D",t.getDate()).replace("M",t.getMonth()+1).replace("H",t.getHours()).replace("m",t.getMinutes()).replace("s",t.getSeconds()).replace("W",u)},toISO:function(t){return y(t)?t.toISOString():""},toUTC:function(t){return y(t)?new Date(t.toUTCString()):null},addDays:function(t,n){if(!y(t))return t;const e=new Date(t);return e.setDate(e.getDate()+n),e},addHours:function(t,n){if(!y(t))return t;const e=new Date(t);return e.setHours(e.getHours()+n),e},addMinutes:function(t,n){if(!y(t))return t;const e=new Date(t);return e.setMinutes(e.getMinutes()+n),e},addSeconds:function(t,n){if(!y(t))return t;const e=new Date(t);return e.setSeconds(e.getSeconds()+n),e},diffDays:b,diffHours:function(t,n){return y(t)&&y(n)?Math.floor((t.getTime()-n.getTime())/36e5):0},diffMinutes:function(t,n){return y(t)&&y(n)?Math.floor((t.getTime()-n.getTime())/6e4):0},diffSeconds:function(t,n){return y(t)&&y(n)?Math.floor((t.getTime()-n.getTime())/1e3):0},isToday:function(t){return!!y(t)&&0===b(t,m())},isYesterday:function(t){return!!y(t)&&-1===b(t,m())},isTomorrow:function(t){return!!y(t)&&1===b(t,m())},isFuture:function(t){return!!y(t)&&t.getTime()>p()},isPast:function(t){return!!y(t)&&t.getTime()<p()},isLeapYear:function(t){if(!y(t))return!1;const n=t.getFullYear();return n%4==0&&(n%100!=0||n%400==0)},getDaysInMonth:function(t){return y(t)?new Date(t.getFullYear(),t.getMonth()+1,0).getDate():0},getWeekOfYear:function(t){if(!y(t))return 0;const n=new Date(t.getFullYear(),0,1),e=t.getTime()-n.getTime();return Math.ceil(e/6048e5)},getQuarter:function(t){return y(t)?Math.ceil((t.getMonth()+1)/3):0},startOfDay:function(t){if(!y(t))return t;const n=new Date(t);return n.setHours(0,0,0,0),n},endOfDay:function(t){if(!y(t))return t;const n=new Date(t);return n.setHours(23,59,59,999),n},startOfMonth:function(t){return y(t)?new Date(t.getFullYear(),t.getMonth(),1):t},endOfMonth:function(t){return y(t)?new Date(t.getFullYear(),t.getMonth()+1,0,23,59,59,999):t},startOfWeek:g,endOfWeek:function(t,n=1){if(!y(t))return t;const e=g(t,n),r=new Date(e);return r.setDate(r.getDate()+6),r.setHours(23,59,59,999),r},getAge:function(t){if(!y(t))return 0;const n=new Date;let e=n.getFullYear()-t.getFullYear();return(n.getMonth()<t.getMonth()||n.getMonth()===t.getMonth()&&n.getDate()<t.getDate())&&e--,Math.max(0,e)},fromNow:function(t){if(!y(t))return"";const n=p()-t.getTime(),e=6e4,r=36e5,i=24*r,s=7*i,o=30*i,c=365*i;return n<e?"刚刚":n<r?`${Math.floor(n/e)}分钟前`:n<i?`${Math.floor(n/r)}小时前`:n<s?`${Math.floor(n/i)}天前`:n<o?`${Math.floor(n/s)}周前`:n<c?`${Math.floor(n/o)}个月前`:`${Math.floor(n/c)}年前`}};function _(t,n,e={}){let r=null,i=null,s=null,o=0;const c=e.leading||!1,a=!1!==e.trailing;function u(){t.apply(s,i)}function h(){r=null,a&&i&&u(),i=null,s=null}return function(...t){i=t,s=this,o=Date.now(),r?(clearTimeout(r),r=setTimeout(h,Math.max(0,n-(Date.now()-o)))):(o=Date.now(),c?(r=setTimeout(h,n),u()):r=setTimeout(h,n))}}function v(t,n,e={}){let r=!1;const i=e.trailing||!1;let s=null,o=null;function c(){t.apply(o,s),s=null,o=null}return function(...t){r?i&&(s=t,o=this):(r=!0,s=t,o=this,c(),setTimeout(()=>{r=!1,i&&s&&c()},n))}}function S(t){return/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(t||"")}function $(t){return/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test(t||"")}function O(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t||"")}function k(t){const n=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(t||"");return!!n&&n.slice(1).every(t=>parseInt(t)>=0&&parseInt(t)<=255)}function M(t){const n=/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*([01]|0\.\d+)\)$/.exec(t||"");if(!n)return!1;const[,e,r,i,s]=n;return parseInt(e)>=0&&parseInt(e)<=255&&parseInt(r)>=0&&parseInt(r)<=255&&parseInt(i)>=0&&parseInt(i)<=255&&parseFloat(s)>=0&&parseFloat(s)<=1}function j(t,n){return(t||"").includes(n)}const C={isEmail:function(t){return/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t||"")},isPhone:function(t){return/^1[3-9]\d{9}$/.test(t||"")},isURL:function(t){return/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w.-]*)*\/?$/.test(t||"")},isIPv4:S,isIPv6:$,isIP:function(t){return S(t)||$(t)},isIDCard:function(t){return/^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/.test(t||"")},isPassport:function(t){return/^[A-Z][0-9]{8}$|^[A-Z]{2}[0-9]{7}$/.test(t||"")},isCreditCard:function(t){const n=t.replace(/\s/g,"");if(!/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9]{2})[0-9]{12}|3[47][0-9]{13})$/.test(n))return!1;let e=0,r=!1;for(let t=n.length-1;t>=0;t--){let i=parseInt(n[t],10);r&&(i*=2,i>9&&(i-=9)),e+=i,r=!r}return e%10==0},isHexColor:O,isRGB:k,isRGBA:M,isColor:function(t){return O(t)||k(t)||M(t)},isDate:function(t){return!isNaN(new Date(t).getTime())},isJSON:function(t){try{return JSON.parse(t),!0}catch{return!1}},isEmpty:function(t){return!t||""===t.trim()},isWhitespace:function(t){return/^\s+$/.test(t||"")},isNumber:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},isInteger:function(t){return/^-?\d+$/.test(t||"")},isFloat:function(t){return/^-?\d+\.\d+$/.test(t||"")},isPositive:function(t){const n=parseFloat(t);return!isNaN(n)&&n>0},isNegative:function(t){const n=parseFloat(t);return!isNaN(n)&&n<0},isAlpha:function(t){return/^[a-zA-Z]+$/.test(t||"")},isAlphaNumeric:function(t){return/^[a-zA-Z0-9]+$/.test(t||"")},isChinese:function(t){return/^[\u4e00-\u9fa5]+$/.test(t||"")},isLength:function(t,n,e){const r=(t||"").length;return r>=n&&(void 0===e||r<=e)},minLength:function(t,n){return(t||"").length>=n},maxLength:function(t,n){return(t||"").length<=n},matches:function(t,n){return n instanceof RegExp&&n.test(t||"")},equals:function(t,n){return String(t)===String(n)},contains:j,notContains:function(t,n){return!j(t,n)},isArray:function(t){return Array.isArray(t)},arrayLength:function(t,n,e){const r=t?t.length:0;return r>=n&&(void 0===e||r<=e)},arrayMinLength:function(t,n){return!!t&&t.length>=n},arrayMaxLength:function(t,n){return!!t&&t.length<=n},isObject:function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)},hasKeys:function(t,n){return!!(t&&n&&Array.isArray(n))&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n))},validate:function(t,n){const e={};return Object.keys(n).forEach(r=>{const i=t[r],s=n[r],o=[];s.forEach(n=>{if("string"==typeof n){const[t,...e]=n.split(":");C[t](i,...e)||o.push(t)}else if("function"==typeof n){const e=n(i,t);!0!==e&&o.push(e||"validation_failed")}}),o.length>0&&(e[r]=o)}),{valid:0===Object.keys(e).length,errors:e}}};const E={md5:function(t){const n=t?String(t):"",e=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745],r=[[7,12,17,22],[5,9,14,20],[4,11,16,23],[6,10,15,21]];function i(t,n){return t<<n|t>>>32-n}function s(t,n){const[s,o,c,a]=n,u=[];for(let n=0;n<16;n++)u[n]=255&t.charCodeAt(4*n)|(255&t.charCodeAt(4*n+1))<<8|(255&t.charCodeAt(4*n+2))<<16|(255&t.charCodeAt(4*n+3))<<24;let h=s,f=o,d=c,l=a;for(let t=0;t<64;t++){let n,s;const o=Math.floor(t/16),c=t%16;0===o?(n=f&d|~f&l,s=c):1===o?(n=l&f|~l&d,s=(5*c+1)%16):2===o?(n=f^d^l,s=(3*c+5)%16):(n=d^(f|~l),s=7*c%16);const a=l;l=d,d=f,f+=i(h+n+e[t]+u[s]&4294967295,r[o][t%4]),h=a}return[s+h&4294967295,o+f&4294967295,c+d&4294967295,a+l&4294967295]}const o=function(t){const n=8*t.length;for(t+="";t.length%64!=56;)t+="\0";const e=4294967295&n,r=n>>>32&4294967295;for(let n=0;n<4;n++)t+=String.fromCharCode(e>>>8*n&255);for(let n=0;n<4;n++)t+=String.fromCharCode(r>>>8*n&255);return t}(n);let c=[1732584193,4023233417,2562383102,271733878];for(let t=0;t<o.length;t+=64)c=s(o.substring(t,t+64),c);let a="";return c.forEach(t=>{for(let n=0;n<4;n++)a+=(t>>>8*n&255).toString(16).padStart(2,"0")}),a},sha256:function(t){const n=t?String(t):"",e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function r(t,n){return t>>>n|t<<32-n}function i(t,n){const i=[];for(let n=0;n<16;n++)i[n]=255&t.charCodeAt(4*n)|(255&t.charCodeAt(4*n+1))<<8|(255&t.charCodeAt(4*n+2))<<16|(255&t.charCodeAt(4*n+3))<<24;for(let t=16;t<64;t++){const n=r(i[t-15],7)^r(i[t-15],18)^i[t-15]>>>3,e=r(i[t-2],17)^r(i[t-2],19)^i[t-2]>>>10;i[t]=i[t-16]+n+i[t-7]+e&4294967295}let[s,o,c,a,u,h,f,d]=n;for(let t=0;t<64;t++){const n=d+(r(u,6)^r(u,11)^r(u,25))+(u&h^~u&f)+e[t]+i[t]&4294967295,l=s&o^s&c^o&c;d=f,f=h,h=u,u=a+n&4294967295,a=c,c=o,o=s,s=n+((r(s,2)^r(s,13)^r(s,22))+l&4294967295)&4294967295}return[n[0]+s&4294967295,n[1]+o&4294967295,n[2]+c&4294967295,n[3]+a&4294967295,n[4]+u&4294967295,n[5]+h&4294967295,n[6]+f&4294967295,n[7]+d&4294967295]}const s=function(t){const n=8*t.length;for(t+="";t.length%64!=56;)t+="\0";const e=4294967295&n,r=n>>>32&4294967295;for(let n=0;n<4;n++)t+=String.fromCharCode(r>>>8*n&255);for(let n=0;n<4;n++)t+=String.fromCharCode(e>>>8*n&255);return t}(n);let o=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];for(let t=0;t<s.length;t+=64)o=i(s.substring(t,t+64),o);let c="";return o.forEach(t=>{for(let n=3;n>=0;n--)c+=(t>>>8*n&255).toString(16).padStart(2,"0")}),c},base64Encode:function(t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let e="",r=0;const i=t?t.split("").map(t=>t.charCodeAt(0)):[];for(;r<i.length;){const t=i[r++],s=i[r++]||0,o=i[r++]||0,c=(15&s)<<2|o>>6,a=63&o;e+=n[t>>2]+n[(3&t)<<4|s>>4]+(r>i.length+1?"=":n[c])+(r>i.length?"=":n[a])}return e},base64Decode:function(t){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let e="",r=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");r<t.length;){const i=n.indexOf(t.charAt(r++)),s=n.indexOf(t.charAt(r++)),o=n.indexOf(t.charAt(r++)),c=n.indexOf(t.charAt(r++)),a=i<<2|s>>4,u=(15&s)<<4|o>>2,h=(3&o)<<6|c;e+=String.fromCharCode(a),64!==o&&(e+=String.fromCharCode(u)),64!==c&&(e+=String.fromCharCode(h))}return e},uuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=16*Math.random()|0;return("x"===t?n:3&n|8).toString(16)})}},D=new Map;async function N(t,n={}){const{crossOrigin:e="anonymous"}=n;return D.has(t)?D.get(t):new Promise((n,r)=>{const i=new Image;i.crossOrigin=e,i.onload=()=>{D.set(t,i),n(i)},i.onerror=()=>{r(new Error(`Failed to load image: ${t}`))},i.src=t})}async function R(t,n={}){const{type:e="text/javascript",async:r=!0,defer:i=!1}=n;return D.has(t)?D.get(t):new Promise((n,s)=>{const o=document.createElement("script");o.type=e,o.async=r,o.defer=i,o.onload=()=>{D.set(t,o),n(o)},o.onerror=()=>{o.remove(),s(new Error(`Failed to load script: ${t}`))},o.src=t,document.head.appendChild(o)})}async function A(t,n={}){const{media:e="all"}=n;return D.has(t)?D.get(t):new Promise((n,r)=>{const i=document.createElement("link");i.rel="stylesheet",i.href=t,i.media=e,i.onload=()=>{D.set(t,i),n(i)},i.onerror=()=>{i.remove(),r(new Error(`Failed to load stylesheet: ${t}`))},document.head.appendChild(i)})}const T={loadImage:N,loadImages:async function(t,n={}){const{parallel:e=!0}=n;if(e)return Promise.all(t.map(t=>N(t,n)));const r=[];for(const e of t)r.push(await N(e,n));return r},loadScript:R,loadStylesheet:A,loadFont:async function(t,n,e={}){const{weight:r="normal",style:i="normal"}=e,s=new FontFace(t,`url(${n})`,{weight:r,style:i});try{return await s.load(),document.fonts.add(s),s}catch(n){throw new Error(`Failed to load font: ${t}`)}},preload:async function(t,n="image"){switch(n){case"image":return N(t);case"script":return R(t);case"stylesheet":case"style":return A(t);default:throw new Error(`Unsupported preload type: ${n}`)}},isLoaded:function(t){return D.has(t)},clearCache:function(){D.clear()},clearCacheByUrl:function(t){D.delete(t)}},F={string:s,array:c,object:u,number:l,date:x,debounce:_,throttle:v,validator:C,crypto:E,preload:T};class P{constructor(){this.children={},this.keys=[]}}class I{constructor(){this.root=new P}insert(t){let n=this.root;const e=t.split(".");e.forEach((r,i)=>{n.children[r]||(n.children[r]=new P),n=n.children[r],i===e.length-1&&n.keys.push(t)})}getSubKeys(t){let n=this.root;const e=t.split("."),r=[];for(let t=0;t<e.length;t++){const i=e[t];if(!n.children[i])break;n=n.children[i];const s=t=>{t.keys.length>0&&r.push(...t.keys),Object.values(t.children).forEach(t=>s(t))};s(n)}return[...new Set(r)]}getParentKeys(t){const n=t.split("."),e=[];for(let t=1;t<=n.length;t++){const r=n.slice(0,t).join(".");e.push(r)}return e}}const L=Symbol("reactive_parent"),U=Symbol("reactive_path"),z=Symbol("reactive_is_reactive");class H{constructor(){this.rawData={},this.data=null,this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new I,this.updateQueue=new Map,this.isProcessing=!1,this.pendingComputed=new Set,this.persistedKeys=new Map,this.snapshots=[],this.snapshotLimit=10,this._=new WeakMap,this.createReactiveData()}createReactiveData(){const t={get:(t,n,e)=>{if("__raw__"===n)return t;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,n):r},set:(t,n,e,r)=>{const i=Reflect.get(t,n,r),s=Reflect.set(t,n,e,r),o=this.resolvePath(t,n);return this.notify(o,e,i),this.queueUpdate(o,e),s},deleteProperty:(t,n)=>{const e=Reflect.get(t,n,receiver),r=Reflect.deleteProperty(t,n),i=this.resolvePath(t,n);return this.notify(i,void 0,e),this.queueUpdate(i,void 0),r}};this.data=new Proxy(this.rawData,t),this.data.v=null,this.data.S=""}wrapReactive(t,n){if(t[z])return t;if(this._.has(t))return this._.get(t);const e=new Proxy(t,{get:(t,n,e)=>{if("__raw__"===n)return t;if(n===L||"__parent__"===n)return t[L];if(n===U||"__path__"===n)return t[U];if(n===z||"__isReactive__"===n)return!0;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,`${t[U]}${t[U]?".":""}${n}`):r},set:(t,n,e,r)=>{if(n===L||n===U||n===z||"__parent__"===n||"__path__"===n||"__isReactive__"===n)return!0;const i=Reflect.get(t,n,r),s=Reflect.set(t,n,e,r),o=`${t[U]}${t[U]?".":""}${n}`;return this.notify(o,e,i),this.queueUpdate(o,e),s},deleteProperty:(t,n)=>{if(n===L||n===U||n===z)return!1;const e=Reflect.get(t,n),r=Reflect.deleteProperty(t,n),i=`${t[U]}${t[U]?".":""}${n}`;return this.notify(i,void 0,e),this.queueUpdate(i,void 0),r},has:(t,n)=>"__raw__"===n||n===L||n===U||n===z||"__parent__"===n||"__path__"===n||"__isReactive__"===n||n in t,ownKeys:t=>Reflect.ownKeys(t).filter(t=>t!==L&&t!==U&&t!==z),getOwnPropertyDescriptor:(t,n)=>n===L||n===U||n===z?{configurable:!1,enumerable:!1,writable:!1,value:t[n]}:Reflect.getOwnPropertyDescriptor(t,n)});return t[L]=t,t[U]=n,t[z]=!0,this._.set(t,e),Object.keys(t).forEach(e=>{t[e]&&"object"==typeof t[e]&&!Array.isArray(t[e])&&(t[e]=this.wrapReactive(t[e],`${n}${n?".":""}${e}`))}),e}resolvePath(t,n){return t[U]?`${t[U]}.${n}`:n}queueUpdate(t,n){this.updateQueue.set(t,n),this.isProcessing||(this.isProcessing=!0,requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){const t=new Set;this.updateQueue.forEach((n,e)=>{t.add(e),this.updateElementsDirect(e,n);this.pathTrie.getSubKeys(e).forEach(n=>{if(!t.has(n)){const e=this.get(n);this.updateElementsDirect(n,e),t.add(n)}})}),this.updateQueue.clear(),this.processComputed(),this.isProcessing=!1}updateElementsDirect(t,n){this.elements[t]&&this.elements[t].forEach(t=>{this.updateElement(t,n)})}processComputed(){Object.keys(this.computedProperties).forEach(t=>{this.computedProperties[t].deps.some(t=>this.updateQueue.has(t)||this.pathTrie.getSubKeys(t).some(t=>this.updateQueue.has(t)))&&this.updateComputedProperty(t)})}set(t,n,e=!1){const r=this.get(t);"object"==typeof t?(Object.assign(this.rawData,t),Object.keys(t).forEach(n=>{e||(this.notify(n,t[n],r?.[n]),this.queueUpdate(n,t[n]))})):(t.includes(".")?this.setNested(t,n):this.rawData[t]=n,e||(this.notify(t,n,r),this.queueUpdate(t,n))),e||this.processComputed()}get(t){if(t)return t.includes(".")?this.getNested(t):this.rawData[t]}getNested(t){if(t)return t.split(".").reduce((t,n)=>t?.[n],this.rawData)}setNested(t,n){const e=t.split("."),r=e.pop(),i=e.reduce((t,n)=>(t[n]||(t[n]={}),t[n]),this.rawData),s=i[r];i[r]=n,this.notify(t,n,s),this.queueUpdate(t,n)}observe(t,n){this.observers[t]||(this.observers[t]=[]),this.observers[t].push(n)}unobserve(t,n){this.observers[t]&&(this.observers[t]=this.observers[t].filter(t=>t!==n))}notify(t,n,e){this.observers[t]&&this.observers[t].forEach(t=>{try{t(n,e)}catch(t){}}),this.observers["*"]?.forEach(r=>{try{r(t,n,e)}catch(t){}})}updateElement(t,n){const e=t.getAttribute("data-bind");if(!e)return;e.split("|").forEach(e=>{const r=e.split(":"),i=r[0].trim(),s=r[1]?.trim();switch(i){case"text":t.textContent!==String(n??"")&&(t.textContent=n??"");break;case"html":const e=function(t){if(!t)return"";let n=String(t);const e=/<\s*(script|iframe|object|embed|applet|form|base|link|meta|style)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>|<\s*(script|iframe|object|embed|applet|form|base|link|meta|style)\b[^>]*\/?>/gi;let r;do{r=n,n=n.replace(e,"")}while(n!==r);return n=n.replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,""),n=n.replace(/(href|src|action|background)\s*=\s*(?:"[^"]*(?:javascript|vbscript|data)\s*:[^"]*"|'[^']*(?:javascript|vbscript|data)\s*:[^']*'|[^\s>]*(?:javascript|vbscript|data)\s*:[^\s>]*)/gi,'$1=""'),n=n.replace(/expression\s*\([^)]*\)/gi,""),n}(n);t.innerHTML!==e&&(t.innerHTML=e);break;case"value":"checkbox"===t.type?t.checked!==!!n&&(t.checked=!!n):t.value!==String(n??"")&&(t.value=n??"");break;case"checked":t.checked!==!!n&&(t.checked=!!n);break;case"disabled":t.disabled!==!!n&&(t.disabled=!!n);break;case"hidden":const r=n?"none":"";t.style.display!==r&&(t.style.display=r);break;case"class":s&&(n?t.classList.add(s):t.classList.remove(s));break;case"style":s&&t.style[s]!==String(n??"")&&(t.style[s]=n??"");break;case"attr":if(s){t.getAttribute(s)!==String(n??"")&&t.setAttribute(s,n??"")}break;case"src":t.src!==String(n??"")&&(t.src=n??"");break;case"href":t.href!==String(n??"")&&(t.href=n??"");break;case"placeholder":t.placeholder!==String(n??"")&&(t.placeholder=n??"")}})}computed(t,n,e){this.computedProperties[t]={deps:n,callback:e},n.forEach(t=>{this.pathTrie.insert(t)}),this.updateComputedProperty(t)}updateComputedProperty(t){const n=this.computedProperties[t];if(n)try{const e=n.deps.map(t=>this.get(t)),r=n.callback(...e);this.set(t,r,!0)}catch(t){}}load(t){Object.keys(t).forEach(n=>{t[n]&&"object"==typeof t[n]&&!Array.isArray(t[n])?this.rawData[n]=this.wrapReactive(t[n],n):this.rawData[n]=t[n],this.queueUpdate(n,this.rawData[n])}),this.processComputed()}reset(){this.rawData={},this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new I,this.updateQueue.clear(),this.snapshots=[],this.createReactiveData(),this.bind()}persist(t,n={}){const{storage:e="local",debounce:r=0,version:i=1,encrypt:s=!1,encryptionKey:o=null}=n,c="session"===e?sessionStorage:localStorage;this.persistedKeys.set(t,{storage:c,debounce:r,timeout:null,version:i,encrypt:s,encryptionKey:o});const a=this.get(t);void 0!==a&&this.$(t,a,c,{version:i,encrypt:s,encryptionKey:o}),this.observe(t,n=>{const e=this.persistedKeys.get(t);e&&(e.debounce>0?(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(()=>{this.$(t,n,e.storage,{version:e.version,encrypt:e.encrypt,encryptionKey:e.encryptionKey})},e.debounce)):this.$(t,n,e.storage,{version:e.version,encrypt:e.encrypt,encryptionKey:e.encryptionKey}))})}$(t,n,e,r={}){try{const{version:i=1,encrypt:s=!1,encryptionKey:o=null}=r,c={value:n,version:i,timestamp:Date.now()};let a=JSON.stringify(c);s&&o&&(a=this.O(a,o)),this.k(e),e.setItem(`kupola:${t}`,a)}catch(r){if("QuotaExceededError"===r.name&&e===localStorage)try{sessionStorage.setItem(`kupola:${t}`,JSON.stringify({value:n,version:1}))}catch(t){}}}k(t){try{const n="kupola:__storage_test__";t.setItem(n,"test"),t.removeItem(n)}catch(n){"QuotaExceededError"===n.name&&this.M(t)}}M(t){const n=Date.now();for(let e=0;e<t.length;e++){const r=t.key(e);if(r?.startsWith("kupola:"))try{const e=JSON.parse(t.getItem(r));e.timestamp&&n-e.timestamp>2592e6&&t.removeItem(r)}catch(n){t.removeItem(r)}}}O(t,n){return window.CryptoJS?window.CryptoJS.AES.encrypt(t,n).toString():t}j(t,n){if(!window.CryptoJS)return t;try{return window.CryptoJS.AES.decrypt(t,n).toString(window.CryptoJS.enc.Utf8)}catch(n){return t}}unpersist(t){const n=this.persistedKeys.get(t);n&&(n.timeout&&clearTimeout(n.timeout),n.storage.removeItem(`kupola:${t}`),this.persistedKeys.delete(t))}loadPersisted(t={}){const n={},{encryptionKey:e=null}=t;for(let r=0;r<localStorage.length;r++){const i=localStorage.key(r);if(i?.startsWith("kupola:")){const r=i.replace("kupola:","");try{const s=localStorage.getItem(i);let o;if(e){const t=this.j(s,e);o=JSON.parse(t)}else o=JSON.parse(s);if(void 0!==o.version&&o.version!==t.version)continue;n[r]=void 0!==o.value?o.value:o}catch(t){}}}for(let r=0;r<sessionStorage.length;r++){const i=sessionStorage.key(r);if(i?.startsWith("kupola:")){const r=i.replace("kupola:","");try{const s=sessionStorage.getItem(i);let o;if(e){const t=this.j(s,e);o=JSON.parse(t)}else o=JSON.parse(s);if(void 0!==o.version&&o.version!==t.version)continue;n[r]=void 0!==o.value?o.value:o}catch(t){}}}return Object.keys(n).length>0&&this.load(n),n}C(t){if("function"==typeof structuredClone)try{return structuredClone(t)}catch(t){}return JSON.parse(JSON.stringify(t))}snapshot(){const t=this.C(this.rawData);return this.snapshots.push(t),this.snapshots.length>this.snapshotLimit&&this.snapshots.shift(),this.snapshots.length-1}rollback(t=-1){if(0===this.snapshots.length)return!1;const n=t>=0?t:this.snapshots.length-1,e=this.snapshots[n];return!!e&&(this.rawData=this.C(e),this.createReactiveData(),Object.keys(this.rawData).forEach(t=>{this.queueUpdate(t,this.rawData[t])}),this.processComputed(),!0)}getSnapshotCount(){return this.snapshots.length}clearSnapshots(){this.snapshots=[]}serializeForm(t){const n={};return t.querySelectorAll("input, select, textarea").forEach(t=>{const e=t.getAttribute("data-bind");if(!e)return;const r=e.split(":"),i=r[1]?.trim();i&&("checkbox"===t.type?(n[i]||(n[i]=[]),t.checked&&n[i].push(t.value)):"radio"===t.type?t.checked&&(n[i]=t.value):n[i]=t.value)}),n}fillForm(t,n){Object.keys(n).forEach(e=>{t.querySelectorAll('[data-bind*=":'+e+'"]').forEach(t=>{"checkbox"===t.type?t.checked=Array.isArray(n[e])?n[e].includes(t.value):!!n[e]:"radio"===t.type?t.checked=t.value===n[e]:t.value=n[e]??""})})}createReactive(t,n=""){if(t[z])return t;if(this._.has(t))return this._.get(t);const e={get:(t,n,e)=>{if("__raw__"===n)return t;if(n===L||"__parent__"===n)return t[L];if(n===U||"__path__"===n)return t[U];if(n===z||"__isReactive__"===n)return!0;const r=Reflect.get(t,n,e);return r&&"object"==typeof r&&!Array.isArray(r)?this.wrapReactive(r,`${t[U]}${t[U]?".":""}${n}`):r},set:(t,n,e,r)=>{if(n===L||n===U||n===z||"__parent__"===n||"__path__"===n||"__isReactive__"===n)return!0;const i=Reflect.get(t,n,r),s=Reflect.set(t,n,e,r),o=`${t[U]}${t[U]?".":""}${n}`;return this.notify(o,e,i),this.queueUpdate(o,e),s},deleteProperty:(t,n)=>{if(n===L||n===U||n===z)return!1;const e=Reflect.get(t,n),r=Reflect.deleteProperty(t,n),i=`${t[U]}${t[U]?".":""}${n}`;return this.notify(i,void 0,e),this.queueUpdate(i,void 0),r},has:(t,n)=>"__raw__"===n||n===L||n===U||n===z||"__parent__"===n||"__path__"===n||"__isReactive__"===n||n in t,ownKeys:t=>Reflect.ownKeys(t).filter(t=>t!==L&&t!==U&&t!==z),getOwnPropertyDescriptor:(t,n)=>n===L||n===U||n===z?{configurable:!1,enumerable:!1,writable:!1,value:t[n]}:Reflect.getOwnPropertyDescriptor(t,n)},r=new Proxy(t,e);return t[L]=t,t[U]=n,t[z]=!0,this._.set(t,r),Object.keys(t).forEach(e=>{t[e]&&"object"==typeof t[e]&&!Array.isArray(t[e])&&(t[e]=this.wrapReactive(t[e],`${n}${n?".":""}${e}`))}),r}bind(){document.querySelectorAll("[data-bind]").forEach(t=>{this.D(t)}),this.N||(this.R=!1,this.N=new MutationObserver(t=>{if(!this.R){this.R=!0;try{t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){t.querySelectorAll("[data-bind]").forEach(t=>this.D(t)),t.hasAttribute&&t.hasAttribute("data-bind")&&this.D(t)}})})}finally{this.R=!1}}}),this.N.observe(document.body,{childList:!0,subtree:!0}))}D(t){const n=t.getAttribute("data-bind").split(":");n[0].split("|")[0].trim();const e=n[1]?.trim();if(e){if(this.pathTrie.insert(e),this.elements[e]||(this.elements[e]=[]),this.elements[e].includes(t)||this.elements[e].push(t),"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName){const n=t.A;n&&t.removeEventListener("input",n);const r=()=>{const n="checkbox"===t.type?t.checked:t.value;e.includes(".")?this.setNested(e,n):this.set(e,n)};t.A=r,t.addEventListener("input",r)}void 0!==this.rawData[e]&&this.updateElement(t,this.rawData[e])}}destroy(){this.N&&(this.N.disconnect(),this.N=null),Object.values(this.elements).forEach(t=>{t.forEach(t=>{const n=t.A;n&&(t.removeEventListener("input",n),delete t.A)})}),this.persistedKeys.forEach((t,n)=>{t.timeout&&clearTimeout(t.timeout)}),this.persistedKeys.clear(),this.rawData={},this.observers={},this.elements={},this.computedProperties={},this.pathTrie=new I,this.updateQueue.clear(),this.snapshots=[]}}class B{constructor(t,n={}){this.name=t,this.T=`__store_${t}__`;const e=n.state?n.state():{};this.getters=n.getters||{},this.actions=n.actions||{},this.mutations=n.mutations||{},this.observers={},q?(q.set(this.T,e),this.state=q.data?.[this.T]||q.createReactive(e,this.T),q.observe(this.T,t=>{this.notify(t)})):this.state=e,this.F(),this.P()}F(){Object.keys(this.getters).forEach(t=>{Object.defineProperty(this,t,{get:()=>this.getters[t](this.state),enumerable:!0})})}P(){Object.keys(this.actions).forEach(t=>{this[t]=(...n)=>this.actions[t]({state:this.state,commit:this.commit.bind(this),dispatch:this.dispatch.bind(this),getters:this},...n)})}commit(t,n){const e=this.mutations[t];e&&e(this.state,n)}dispatch(t,n){const e=this.actions[t];if(e)return e({state:this.state,commit:this.commit.bind(this),dispatch:this.dispatch.bind(this),getters:this},n)}observe(t){return this.observers["*"]||(this.observers["*"]=[]),this.observers["*"].push(t),t}unobserve(t){this.observers["*"]&&(this.observers["*"]=this.observers["*"].filter(n=>n!==t))}notify(t){this.observers["*"]&&this.observers["*"].forEach(n=>{try{n(t)}catch(t){}}),q&&q.set(this.name,t)}toJSON(){return{name:this.name,state:this.state,getters:Object.keys(this.getters).reduce((t,n)=>(t[n]=this[n],t),{})}}}class J{constructor(){this.stores=new Map}createStore(t,n){const e=new B(t,n);return this.stores.set(t,e),e}getStore(t){return this.stores.get(t)}registerStore(t){t instanceof B&&this.stores.set(t.name,t)}dispose(){this.stores.clear()}}class W{constructor(){this.events={},this.delegatedEvents={},this.eventListeners={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),n}off(t,n){this.events[t]&&(this.events[t]=this.events[t].filter(t=>t!==n))}emit(t,n){this.events[t]&&this.events[t].forEach(t=>{try{t(n)}catch(t){}}),this.events["*"]?.forEach(e=>{try{e(t,n)}catch(t){}})}once(t,n){const e=r=>{n(r),this.off(t,e)};return this.on(t,e),e}delegate(t,n,e){if(!this.delegatedEvents[n]){this.delegatedEvents[n]=[];const t=t=>{this.delegatedEvents[n].forEach(({selector:n,cb:e})=>{(t.target.matches(n)||t.target.closest(n))&&e(t)})};document.addEventListener(n,t),this.eventListeners[n]=t}return this.delegatedEvents[n].push({selector:t,cb:e}),e}undelegate(t,n){if(this.delegatedEvents[n]&&(this.delegatedEvents[n]=this.delegatedEvents[n].filter(n=>n.selector!==t),0===this.delegatedEvents[n].length)){const t=this.eventListeners[n];t&&(document.removeEventListener(n,t),delete this.eventListeners[n]),delete this.delegatedEvents[n]}}destroy(){Object.entries(this.eventListeners).forEach(([t,n])=>{document.removeEventListener(t,n)}),this.events={},this.delegatedEvents={},this.eventListeners={}}}function K(t=null){const n={I:t,L:new Set};return Object.defineProperty(n,"value",{configurable:!0,enumerable:!0,get:()=>n.I,set(t){t!==n.I&&(n.I=t,n.L.forEach(n=>n(t)))}}),n.subscribe=t=>(n.L.add(t),{unsubscribe(){n.L.delete(t)}}),n}const q=new H,Y=new W,Z=new J;function X(t,n){return Z.createStore(t,n)}function G(t){return Z.getStore(t)}const Q={paths:{icons:"/icons/",base:"/"},theme:{default:"dark",brand:"zengqing"},i18n:{locale:"zh-CN",fallbackLocale:"en-US"},http:{baseURL:"",timeout:1e4,headers:{},withCredentials:!1},zIndex:{modal:1e3,dropdown:2e3,tooltip:2100,popover:2200,datepicker:2300,message:3e3,notification:3100,loading:5e3},ui:{defaultSize:"md",modal:{backdropClick:!0},dropdown:{closeOnClick:!0},datepicker:{weekStart:1},tooltip:{delay:300}},performance:{lazyLoad:!1,debounceDelay:200,throttleDelay:100,animationEnabled:!0},security:{xssProtection:!0,sanitizeHtml:{enabled:!0,allowedTags:["b","i","u","em","strong","a","br","p","span","div","img"],allowedAttributes:{a:["href","target","rel"],img:["src","alt","width","height"],span:["class","style"],div:["class","style"]}},maskData:{enabled:!0,patterns:{phone:{regex:"^(\\d{3})\\d{4}(\\d{4})$",replace:"$1****$2"},email:{regex:"^(.)(.*)(@.*)$",replace:"$1***$3"},idCard:{regex:"^(\\d{6})\\d{8}(\\d{4})$",replace:"$1********$2"},bankCard:{regex:"^(\\d{4})\\d{8}(\\d{4})$",replace:"$1 **** **** $2"}}},secureId:{length:16,charset:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}},message:{duration:3e3,position:"top-right",maxCount:5},notification:{duration:4500,position:"top-right"},validation:{defaultRules:[],showErrors:!0,trigger:"blur"},components:{autoInit:!0,silentErrors:!1}},V=[];function tt(){if("undefined"!=typeof window&&window.kupolaConfig)try{wt(Q,window.kupolaConfig),nt()}catch(t){}}function nt(){V.forEach(t=>{try{t(Q)}catch(t){}})}function et(t){"function"==typeof t&&V.push(t)}function rt(t){const n=V.indexOf(t);n>-1&&V.splice(n,1)}function it(t){wt(Q,t),nt()}function st(t){return t?function(t,n){return n.split(".").reduce((t,n)=>void 0!==(t&&t[n])?t[n]:void 0,t)}(Q,t):Q}function ot(){return Q.paths.base+Q.paths.icons.replace(/^\//,"")}function ct(){return Q.paths.base}function at(){return Q.theme.default}function ut(){return Q.theme.brand}function ht(){return Q.http}function ft(){return Q.ui}function dt(){return Q.security}function lt(){return Q.performance}function pt(){return Q.message}function mt(){return Q.notification}function yt(){return Q.validation}function wt(t,n){for(const e in n)n[e]instanceof Object&&e in t&&t[e]instanceof Object?wt(t[e],n[e]):t[e]=n[e];return t}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",tt):tt());const bt="kupola-theme",gt="kupola-brand";et(t=>{const n=document.querySelector("[data-theme-toggle]");if(n){const t=_t();Ot(n),vt(t)}});const xt=[{id:"green",name:"翠绿",color:"#32F08C"},{id:"xionghuang",name:"雄黄",color:"#FF9900"},{id:"jianghuang",name:"姜黄",color:"#E2C027"},{id:"lanlv",name:"蓝绿",color:"#12A182"},{id:"kongquelan",name:"孔雀蓝",color:"#0EB0C9"},{id:"meiguizi",name:"玫瑰紫",color:"#BA2F7B"},{id:"shihong",name:"柿红",color:"#F2481B"},{id:"quhong",name:"紫云",color:"#B1A6CC"},{id:"shanchahong",name:"山茶红",color:"#F05A46"},{id:"zengqing",name:"曾青",color:"#535164"},{id:"roulan",name:"柔蓝",color:"#106898"}];function _t(){return localStorage.getItem(bt)||at()}function vt(t){if("dark"!==t&&"light"!==t)return;var n=document.documentElement;n.hasAttribute("data-kupola-theme-preloaded")&&(n.style.removeProperty("--bg-base-default"),n.style.removeProperty("--text-default"),n.removeAttribute("data-kupola-theme-preloaded")),n.setAttribute("data-theme",t),localStorage.setItem(bt,t);const e=document.querySelector("[data-theme-toggle]");e&&(e.setAttribute("data-current-theme",t),Ot(e))}function St(){return localStorage.getItem(gt)||ut()}function $t(t){const n=xt.find(n=>n.id===t);if(!n)return;document.documentElement.setAttribute("data-brand",t),localStorage.setItem(gt,t);const e=document.querySelector("[data-brand-toggle]");if(e){e.setAttribute("data-current-brand",t);const r=e.querySelector(".brand-icon");r&&(r.style.backgroundColor=n.color);const i=e.querySelector(".brand-name");i&&(i.textContent=n.name)}document.querySelectorAll("[data-brand-btn]").forEach(n=>{n.getAttribute("data-brand-btn")===t?n.classList.add("is-active"):n.classList.remove("is-active")})}function Ot(t){const n=t.querySelector(".theme-icon");if(n){const t=_t(),e=ot();n.src="dark"===t?e+"sun.svg":e+"moon.svg"}}function kt(t){t.preventDefault();vt("dark"===_t()?"light":"dark")}function Mt(){var t=document.documentElement;t.hasAttribute("data-kupola-theme-preloaded")&&(t.style.removeProperty("--bg-base-default"),t.style.removeProperty("--text-default"),t.removeAttribute("data-kupola-theme-preloaded"));const n=document.querySelector("[data-theme-toggle]");vt(_t());$t(St()),document.body.classList.add("theme-initialized"),setTimeout(()=>{document.body.classList.add("theme-initialized")},1500),n&&(Ot(n),n.removeEventListener("click",kt),n.addEventListener("click",kt));let e=document.getElementById("brand-picker");e||(e=document.createElement("div"),e.id="brand-picker",e.style.position="fixed",e.style.top="64px",e.style.right="16px",e.style.zIndex="9998",e.style.display="none",e.style.padding="12px",e.style.width="200px",e.style.gridTemplateColumns="repeat(3, 1fr)",e.style.gap="6px",e.style.backgroundColor="var(--bg-base-secondary)",e.style.border="1px solid var(--border-neutral-l1)",e.style.borderRadius="8px",e.style.boxShadow="0 4px 20px rgba(0, 0, 0, 0.2)",e.style.overflow="hidden",xt.forEach(t=>{const n=document.createElement("button");n.setAttribute("data-brand-btn",t.id),n.style.display="flex",n.style.justifyContent="center",n.style.alignItems="center",n.style.height="60px",n.style.backgroundColor=t.color,n.style.color=["#32F08C","#FF9900","#E2C027","#0EB0C9","#B1A6CC"].includes(t.color)?"#0C0C0D":"#FFFFFF",n.style.fontWeight="500",n.style.borderRadius="4px",n.style.border="none",n.style.cursor="pointer",n.style.margin="0",n.style.padding="0",n.textContent=t.name,e.appendChild(n)}),document.body.appendChild(e));const r=document.querySelector("[data-brand-toggle]");function i(t){e&&r&&(e.contains(t.target)||r.contains(t.target)||(e.style.display="none",document.removeEventListener("click",i,!0)))}r&&e&&(r.onclick=function(t){t.stopPropagation(),t.preventDefault();const n="none"===e.style.display;e.style.display=n?"grid":"none",n?setTimeout(()=>{document.addEventListener("click",i,!0)},0):document.removeEventListener("click",i,!0)},e.onclick=function(t){t.stopPropagation()});document.querySelectorAll("[data-brand-btn]").forEach(t=>{t.addEventListener("click",n=>{n.stopPropagation();$t(t.getAttribute("data-brand-btn")),e&&(e.style.display="none")})})}function jt(){const t=document.createElement("button");t.setAttribute("data-theme-toggle",""),t.setAttribute("data-current-theme",_t()),t.className="ds-btn ds-btn--ghost ds-btn--sm ds-btn--icon",t.style.position="fixed",t.style.top="16px",t.style.right="16px",t.style.zIndex="9999";const n=document.createElement("img");n.className="theme-icon";const e=ot();return n.src="dark"===_t()?e+"sun.svg":e+"moon.svg",n.width=14,n.height=14,n.alt="Toggle theme",t.appendChild(n),document.body.appendChild(t),t.onclick=function(t){t.preventDefault();vt("dark"===_t()?"light":"dark")},t}function Ct(){const t=document.createElement("div");t.id="brand-picker-auto",t.style.position="fixed",t.style.top="56px",t.style.right="16px",t.style.zIndex="9998",t.style.display="none",t.style.padding="12px",t.style.width="200px",t.style.gridTemplateColumns="repeat(3, 1fr)",t.style.gap="6px",t.style.backgroundColor="var(--bg-base-secondary)",t.style.border="1px solid var(--border-neutral-l1)",t.style.borderRadius="8px",t.style.boxShadow="0 4px 20px rgba(0, 0, 0, 0.2)",t.style.overflow="hidden",xt.forEach(n=>{const e=document.createElement("button");e.setAttribute("data-brand-btn",n.id),e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center",e.style.height="60px",e.style.backgroundColor=n.color,e.style.color=["#32F08C","#FF9900","#E2C027","#0EB0C9","#B1A6CC"].includes(n.color)?"#0C0C0D":"#FFFFFF",e.style.fontWeight="500",e.style.borderRadius="4px",e.style.border="none",e.style.cursor="pointer",e.style.margin="0",e.style.padding="0",e.textContent=n.name,t.appendChild(e)}),document.body.appendChild(t);const n=document.createElement("button");n.setAttribute("data-brand-toggle",""),n.setAttribute("data-current-brand",St()),n.className="ds-btn ds-btn--ghost ds-btn--sm",n.style.position="fixed",n.style.top="16px",n.style.right="56px",n.style.zIndex="9999",n.style.display="flex",n.style.alignItems="center",n.style.gap="6px";const e=document.createElement("span");e.className="brand-icon",e.style.width="12px",e.style.height="12px",e.style.borderRadius="50%",e.style.backgroundColor=xt.find(t=>t.id===St()).color;const r=document.createElement("span");function i(e){t.contains(e.target)||n.contains(e.target)||(t.style.display="none",document.removeEventListener("click",i,!0))}r.className="brand-name",r.style.fontSize="11px",r.textContent=xt.find(t=>t.id===St()).name,n.appendChild(e),n.appendChild(r),document.body.appendChild(n),n.onclick=function(n){n.stopPropagation(),n.preventDefault();const e="none"===t.style.display;t.style.display=e?"grid":"none",e?setTimeout(()=>{document.addEventListener("click",i,!0)},0):document.removeEventListener("click",i,!0)},t.onclick=function(t){t.stopPropagation()};return t.querySelectorAll("[data-brand-btn]").forEach(n=>{n.addEventListener("click",e=>{e.stopPropagation();$t(n.getAttribute("data-brand-btn")),t.style.display="none"})}),{toggleBtn:n,container:t}}function Et(t,n={}){const e=dt(),r=e?.sanitizeHtml||{};if(!r.enabled&&!n.force)return t;const i=n.allowedTags||r.allowedTags||[],s=n.allowedAttributes||r.allowedAttributes||{};if("string"!=typeof t)return t;const o=(new DOMParser).parseFromString(t,"text/html");return o.body.querySelectorAll("*").forEach(t=>{const n=t.tagName.toLowerCase();i.includes(n)?Array.from(t.attributes).forEach(e=>{const r=e.name.toLowerCase();(s[n]||[]).includes(r)||t.removeAttribute(e.name)}):t.remove()}),o.body.innerHTML}function Dt(t){if("string"!=typeof t)return t;const n=document.createElement("div");return n.textContent=t,n.innerHTML}function Nt(t){if("string"!=typeof t)return t;return(new DOMParser).parseFromString(t,"text/html").body.textContent||""}function Rt(t,n,e={}){const r=dt(),i=r?.maskData||{};if(!i.enabled&&!e.force)return t;if(null==t)return t;const s=(e.patterns||i.patterns||{})[n];if(!s)return t;const o="string"==typeof s.regex?new RegExp(s.regex):s.regex;return String(t).replace(o,s.replace)}function At(t,n){const e=dt(),r=e?.secureId||{},i=t||r.length||16,s=r.charset||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";if("undefined"==typeof crypto||!crypto.getRandomValues){let t="";for(let n=0;n<i;n++)t+=s[Math.floor(Math.random()*s.length)];return n?`${n}_${t}`:t}const o=new Uint32Array(i);crypto.getRandomValues(o);let c="";for(let t=0;t<i;t++)c+=s[o[t]%s.length];return n?`${n}_${c}`:c}class Tt{constructor(){this.initializers=new Map,this.cleanupFunctions=new Map,this.processedElements=new WeakSet,this.U=["data-component"],this.H=[],this.B=null}register(t,n,e=null,r={}){this.initializers.set(t,n),e&&this.cleanupFunctions.set(t,e),r.dataAttribute&&!this.U.includes(r.dataAttribute)&&(this.U.push(r.dataAttribute),this.B=null),r.cssClass&&!this.H.includes(r.cssClass)&&(this.H.push(r.cssClass),this.B=null)}unregister(t){this.initializers.delete(t),this.cleanupFunctions.delete(t)}has(t){return this.initializers.has(t)}get(t){return this.initializers.get(t)}J(){if(null!==this.B)return this.B;const t=this.U.map(t=>`[${t}]`);for(const n of this.H)t.push(`.${n}`);return this.B=t.join(", "),this.B}async initialize(t){if(this.processedElements.has(t))return;for(const n of this.U){const e=t.getAttribute(n);if(null!==e){const r=e||n.replace("data-",""),i=this.initializers.get(r)||this.initializers.get(n.replace("data-",""));if(i){try{await i(t),this.processedElements.add(t)}catch(t){}return}}}const n=t.className;if("string"==typeof n)for(const e of this.H){if(new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)){const n=e.replace("ds-",""),r=this.initializers.get(n)||this.initializers.get(e);if(r){try{await r(t),this.processedElements.add(t)}catch(t){}return}}}}cleanup(t){for(const n of this.U){const e=t.getAttribute(n);if(null!==e){const r=e||n.replace("data-",""),i=this.cleanupFunctions.get(r)||this.cleanupFunctions.get(n.replace("data-",""));if(i){try{i(t)}catch(t){}return void this.processedElements.delete(t)}}}const n=t.className;if("string"==typeof n)for(const e of this.H){if(new RegExp(`(^|\\s)${e}(\\s|$)`).test(n)){const n=e.replace("ds-",""),r=this.cleanupFunctions.get(n)||this.cleanupFunctions.get(e);if(r){try{r(t)}catch(t){}return void this.processedElements.delete(t)}}}}async initializeAll(t=document){const n=this.J();if(!n)return;const e=t.querySelectorAll(n),r=[];e.forEach(t=>{this.processedElements.has(t)||r.push(this.initialize(t))}),await Promise.all(r)}}const Ft=new Tt,Pt=[{attr:"data-dropdown",cls:"ds-dropdown"},{attr:"data-select",cls:"ds-select"},{attr:"data-datepicker",cls:"ds-datepicker"},{attr:"data-timepicker",cls:"ds-timepicker"},{attr:"data-slider",cls:"ds-slider"},{attr:"data-carousel",cls:"ds-carousel"},{attr:"data-drawer",cls:"ds-drawer"},{attr:"data-modal",cls:"ds-modal"},{attr:"data-dialog",cls:"ds-dialog"},{attr:"data-color-picker",cls:"ds-color-picker"},{attr:"data-calendar",cls:"ds-calendar"},{attr:"data-slide-captcha",cls:"ds-slide-captcha"},{attr:"data-heatmap",cls:"ds-heatmap"},{cls:"ds-tooltip"},{cls:"ds-tag"},{cls:"ds-statcard"},{cls:"ds-collapse"},{cls:"ds-fileupload"},{cls:"ds-notification"},{cls:"ds-message"}];for(const t of Pt)t.attr&&!Ft.U.includes(t.attr)&&Ft.U.push(t.attr),t.cls&&!Ft.H.includes(t.cls)&&Ft.H.push(t.cls);class It{constructor(n){this.element=n,this.isMounted=!1,this.isDestroyed=!1,this.props=this.W(),this.state={},this.slots=this.K(),this.q={},this.Y=[],this.lifecycle=new t,this.setupContext=null}W(){const t={};for(const n of this.element.attributes)if(n.name.startsWith("data-prop-")){const e=n.name.replace("data-prop-","");let r=n.value;try{r=JSON.parse(r)}catch(t){}t[e]=r}return t}K(){const t={};return this.element.querySelectorAll("[data-slot]").forEach(n=>{const e=n.getAttribute("data-slot")||"default";t[e]=n.innerHTML.trim(),n.remove()}),!t.default&&this.element.children.length>0&&(t.default=this.element.innerHTML.trim()),t}$slot(t="default"){return this.slots[t]||""}$emit(t,n){if((this.q[t]||[]).forEach(t=>{try{t(n)}catch(t){}}),this.element){const e=new CustomEvent(`kupola:${t}`,{detail:n,bubbles:!0,cancelable:!0});this.element.dispatchEvent(e)}}$on(t,n){return this.q[t]||(this.q[t]=[]),this.q[t].push(n),n}$off(t,n){this.q[t]&&(this.q[t]=this.q[t].filter(t=>t!==n))}async setProps(t){try{this.props={...this.props,...t},await this.lifecycle.update(),this.setupContext?.Z()}catch(n){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"update",hook:"setProps",error:n,args:[t]})}}async setState(t){try{this.state={...this.state,...t},await this.lifecycle.update(),this.setupContext?.Z()}catch(n){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"update",hook:"setState",error:n,args:[t]})}}async mount(){if(!this.isMounted&&!this.isDestroyed)try{if(this.X(),await this.lifecycle.bootstrap(),"function"==typeof this.setup){const t=this.setup();t instanceof Promise&&await t}this.isMounted=!0,await this.lifecycle.mount(),this.setupContext?.G()}catch(t){if(this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"mount",hook:"component",error:t,args:[]}),"function"==typeof this.renderError)try{this.renderError(t)}catch(t){}else this.element.innerHTML=`\n <div style="padding: 16px; background: #fee2e2; border: 1px solid #fecaca; border-radius: 8px; color: #991b1b;">\n <div style="font-weight: bold; margin-bottom: 8px;">Component Error</div>\n <div style="font-size: 12px; white-space: pre-wrap;">${t.message}</div>\n </div>\n `}}X(){if(this.V)return;const t={beforeMount:"beforeMount",render:["mount","update"],afterMount:"afterMount",updated:"afterUpdate",beforeUnmount:"beforeUnmount",afterUnmount:"afterUnmount",renderError:"errorBoundary"};let n=Object.getPrototypeOf(this);const e=new Set;for(;n&&n.constructor!==Object&&n.constructor!==It;){for(const[r,i]of Object.entries(t))e.has(r)||n.hasOwnProperty(r)&&(Array.isArray(i)?i.forEach(t=>{"render"===r&&this.lifecycle.on(t,()=>this.render?.())}):"renderError"===r?this.lifecycle.on(i,t=>(this.renderError(t.error),"handled")):this.lifecycle.on(i,()=>this[r]?.()),e.add(r));n=Object.getPrototypeOf(n)}this.V=!0}async unmount(){if(this.isMounted&&!this.isDestroyed)try{this.setupContext?.tt(),await this.lifecycle.unmount(),this.isMounted=!1,this.isDestroyed=!0,await this.lifecycle.destroy()}catch(t){this.lifecycle&&"function"==typeof this.lifecycle.p&&await this.lifecycle.p({phase:"unmount",hook:"component",error:t,args:[]}),this.isMounted=!1,this.isDestroyed=!0}}beforeMount(){}afterMount(){}beforeUnmount(){}afterUnmount(){}render(){}renderError(t){}updated(){}setup(){}}function Lt(t,n){Object.keys(n).forEach(e=>{if("constructor"!==e)if("function"==typeof n[e]){const r=t.prototype[e];t.prototype[e]=r?function(...t){return n[e].apply(this,t),r.apply(this,t)}:n[e]}else t.prototype[e]=n[e]})}class Ut{constructor(){this.components=new Map,this.lazyComponents=new Map,this.loadedComponents=new Map,this.instances=new Map,this.observer=null,this.mixins=new Map,this.loadingPromises=new Map}register(t,n){if(!(n.prototype instanceof It))throw new Error(`Component ${t} must extend KupolaComponent`);this.components.set(t,n)}registerLazy(t,n){this.lazyComponents.set(t,n)}unregister(t){this.components.delete(t),this.lazyComponents.delete(t),this.loadedComponents.delete(t),this.loadingPromises.delete(t)}get(t){return this.components.get(t)||this.loadedComponents.get(t)}async getAsync(t){const n=this.components.get(t)||this.loadedComponents.get(t);if(n)return n;if(this.loadingPromises.has(t))return this.loadingPromises.get(t);const e=this.lazyComponents.get(t);if(!e)throw new Error(`Component ${t} not found`);const r=(async()=>{try{const n=await e(),r=n.default||n;if(!(r.prototype instanceof It))throw new Error(`Component ${t} must extend KupolaComponent`);return this.loadedComponents.set(t,r),r}catch(n){throw this.loadingPromises.delete(t),n}})();return this.loadingPromises.set(t,r),r}defineMixin(t,n){this.mixins.set(t,n)}useMixin(t,...n){n.forEach(n=>{const e=this.mixins.get(n);e&&Lt(t,e)})}async bootstrap(t=document){await this.nt(t),this.et(t)}async nt(t){const n=t.querySelectorAll("[data-component]"),e=[];n.forEach(t=>{e.push(this.rt(t))}),await Promise.all(e)}async rt(t){if(!t.it&&!t.st){t.st=!0;try{const n=t.getAttribute("data-component");if(n){const e=Ft.get(n);if(e)try{return void await e(t)}catch(t){}}let e=this.components.get(n);if(!e){try{e=await this.getAsync(n)}catch(t){return}if(!t.isConnected)return}const r=t.getAttribute("data-mixins"),i=e;r&&r.split(",").forEach(t=>{const n=this.mixins.get(t.trim());n&&Lt(i,n)});const s=new i(t);t.it=s,this.instances.set(t,s),s.mount()}finally{t.st=!1}}}et(t){this.observer||(this.observer=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){t.hasAttribute("data-component")&&this.rt(t).catch(t=>{}),this.nt(t).catch(t=>{}),Ft.initialize(t).catch(()=>{});const n=Ft.J();n&&t.querySelectorAll?.(n).forEach(t=>{Ft.initialize(t).catch(()=>{})})}}),t.removedNodes.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const n=this.instances.get(t);n&&(n.unmount(),this.instances.delete(t)),t.querySelectorAll("[data-component]").forEach(t=>{const n=this.instances.get(t);n&&(n.unmount(),this.instances.delete(t))}),Ft.cleanup(t),t.querySelectorAll?.("*").forEach(t=>{Ft.cleanup(t)})}})})}),this.observer.observe(t,{childList:!0,subtree:!0}))}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.instances.forEach(t=>{t.unmount()}),this.instances.clear(),this.components.clear(),this.mixins.clear()}}let zt=null;async function Ht(){if("undefined"!=typeof window){!function(){if(dt().xssProtection&&"undefined"!=typeof document){let t=document.querySelector('meta[http-equiv="X-XSS-Protection"]');t||(t=document.createElement("meta"),t.setAttribute("http-equiv","X-XSS-Protection"),t.setAttribute("content","1; mode=block"),document.head.insertBefore(t,document.head.firstChild)),t=document.querySelector('meta[http-equiv="X-Content-Type-Options"]'),t||(t=document.createElement("meta"),t.setAttribute("http-equiv","X-Content-Type-Options"),t.setAttribute("content","nosniff"),document.head.insertBefore(t,document.head.firstChild))}}();const t=st();q.loadPersisted(),q.bind(),Mt(),!1!==t.components?.autoInit&&(await Ft.initializeAll(),zt&&await zt.bootstrap())}}function Bt(t,n){zt&&zt.register(t,n)}function Jt(t,n){zt&&zt.registerLazy(t,n)}function Wt(t){return zt?zt.bootstrap(t):Promise.resolve()}function Kt(t,n){zt&&zt.defineMixin(t,n)}function qt(t,...n){zt&&zt.useMixin(t,...n)}function Yt(t,n){if(!n||"object"!=typeof n)throw new Error(`defineComponent("${t}"): options must be an object`);n.componentClass?zt&&zt.register(t,n.componentClass):n.lazy&&zt&&zt.registerLazy(t,n.lazy),n.init?Ft.register(t,n.init,n.cleanup||null,{dataAttribute:n.dataAttribute,cssClass:n.cssClass}):(n.dataAttribute||n.cssClass)&&Ft.register(t,()=>{},null,{dataAttribute:n.dataAttribute,cssClass:n.cssClass})}"undefined"!=typeof window&&(zt=new Ut),"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Ht):"undefined"!=typeof window&&setTimeout(Ht,0);class Zt{constructor(t={}){const n=st();this.locales=t.locales||{},this.currentLocale=t.defaultLocale||n.i18n?.locale||"zh-CN",this.fallbackLocale=t.fallbackLocale||n.i18n?.fallbackLocale||"en-US",this.delimiter=t.delimiter||".",this.missingHandler=t.missingHandler||(t=>t),this.ot()}ot(){document.querySelectorAll('script[type="application/json"][data-kupola-i18n]').forEach(t=>{const n=t.dataset.kupolaI18n;if(n)try{const e=JSON.parse(t.textContent);this.addLocale(n,e)}catch(t){}});const t=document.documentElement.lang;t&&this.locales[t]&&(this.currentLocale=t)}addLocale(t,n){this.locales[t]||(this.locales[t]={}),this.ct(this.locales[t],n)}ct(t,n){for(const e of Object.keys(n))n[e]instanceof Object&&e in t?this.ct(t[e],n[e]):t[e]=n[e]}setLocale(t){return!!this.locales[t]&&(this.currentLocale=t,document.documentElement.lang=t,this.ut(),!0)}getLocale(){return this.currentLocale}t(t,n={}){let e=this.ht(t,this.currentLocale);return e||(e=this.ht(t,this.fallbackLocale)),e?this.ft(e,n):this.missingHandler(t)}ht(t,n){if(!this.locales[n])return null;const e=t.split(this.delimiter);let r=this.locales[n];for(const t of e){if(!r||"object"!=typeof r||!(t in r))return null;r=r[t]}return"string"==typeof r?r:null}ft(t,n){return t.replace(/\{(\w+)\}/g,(t,e)=>void 0!==n[e]?n[e]:t)}n(t,n,e={}){const r=this.t(t,{...e,count:n});if(!r)return r;const i=r.split("|");return 1===i.length?r.replace("{count}",n):2===i.length?1===n?i[0]:i[1]:i.length>=3?0===n?i[0]:1===n?i[1]:i[2]:r}ut(){const t=new CustomEvent("kupola:i18n:change",{detail:{locale:this.currentLocale},bubbles:!0});document.dispatchEvent(t)}async loadLocale(t,n){try{const e=await fetch(n),r=await e.json();return this.addLocale(t,r),!0}catch(t){return!1}}getAvailableLocales(){return Object.keys(this.locales)}hasLocale(t){return!!this.locales[t]}formatDate(t,n={}){const e=n.locale||this.currentLocale,r="string"==typeof t?new Date(t):t;return new Intl.DateTimeFormat(e,n).format(r)}formatNumber(t,n={}){const e=n.locale||this.currentLocale;return new Intl.NumberFormat(e,n).format(t)}formatCurrency(t,n,e={}){const r=e.locale||this.currentLocale;return new Intl.NumberFormat(r,{style:"currency",currency:n,...e}).format(t)}formatRelativeTime(t,n,e={}){const r=e.locale||this.currentLocale;return new Intl.RelativeTimeFormat(r,e).format(t,n)}}const Xt=new Zt;function Gt(t){return new Zt(t)}function Qt(t,n={}){return Xt.t(t,n)}function Vt(t,n,e={}){return Xt.n(t,n,e)}function tn(t){return Xt.setLocale(t)}function nn(){return Xt.getLocale()}function en(t,n={}){return Xt.formatDate(t,n)}function rn(t,n={}){return Xt.formatNumber(t,n)}function sn(t,n,e={}){return Xt.formatCurrency(t,n,e)}class on{constructor(){this.dt=new Map,this.lt=new Map}on(t,n,e,r={}){const{scope:i=null,once:s=!1,passive:o=!1,capture:c=!1}=r,a=this.yt(),u={id:a,target:t,eventName:n,handler:e,scope:i,once:s,wrappedHandler:null};u.wrappedHandler=n=>{s&&this.offById(a),e.call(t,n)};const h=this.wt(t,n);return this.dt.has(h)||this.dt.set(h,[]),this.dt.get(h).push(u),i&&(this.lt.has(i)||this.lt.set(i,[]),this.lt.get(i).push(a)),t.addEventListener(n,u.wrappedHandler,{passive:o,capture:c}),{unsubscribe:()=>this.offById(a)}}once(t,n,e,r={}){return this.on(t,n,e,{...r,once:!0})}off(t,n,e){const r=this.wt(t,n);if(!this.dt.has(r))return;const i=this.dt.get(r),s=i.filter(t=>t.handler!==e);i.forEach(r=>{r.handler===e&&(t.removeEventListener(n,r.wrappedHandler),this.bt(r))}),0===s.length?this.dt.delete(r):this.dt.set(r,s)}offById(t){for(const[n,e]of this.dt){const r=e.findIndex(n=>n.id===t);if(-1!==r){const t=e[r];return t.target.removeEventListener(t.eventName,t.wrappedHandler),e.splice(r,1),0===e.length&&this.dt.delete(n),this.bt(t),!0}}return!1}offByScope(t){if(!this.lt.has(t))return;this.lt.get(t).forEach(t=>{this.offById(t)}),this.lt.delete(t)}offAll(t,n=null){if(n){const e=this.wt(t,n);if(!this.dt.has(e))return;this.dt.get(e).forEach(e=>{t.removeEventListener(n,e.wrappedHandler),this.bt(e)}),this.dt.delete(e)}else for(const[n,e]of this.dt){const[r]=n.split(":");this.gt(t)===r&&(e.forEach(n=>{t.removeEventListener(n.eventName,n.wrappedHandler),this.bt(n)}),this.dt.delete(n))}}emit(t,n,e={}){const r=new CustomEvent(n,{detail:e,bubbles:!0,cancelable:!0});return t.dispatchEvent(r),r}emitGlobal(t,n={}){return this.emit(document,t,n)}emitToScope(t,n,e={}){if(!this.lt.has(t))return;const r=this.lt.get(t),i=new Set;for(const[t,n]of this.dt)n.forEach(t=>{r.includes(t.id)&&i.add(t.target)});i.forEach(t=>{this.emit(t,n,e)})}getListenerCount(t,n=null){if(n){const e=this.wt(t,n);return this.dt.has(e)?this.dt.get(e).length:0}let e=0;const r=this.gt(t);for(const[t,n]of this.dt){const[i]=t.split(":");i===r&&(e+=n.length)}return e}getScopeListenerCount(t){return this.lt.has(t)?this.lt.get(t).length:0}hasListeners(t,n=null){return this.getListenerCount(t,n)>0}wt(t,n){return`${this.gt(t)}:${n}`}gt(t){return t===document?"document":t===window?"window":t===document.body?"body":(t.xt||(t.xt=this.yt()),t.xt)}yt(){return`ge-${Math.random().toString(36).substr(2,9)}-${Date.now()}`}bt(t){if(!t.scope||!this.lt.has(t.scope))return;const n=this.lt.get(t.scope),e=n.indexOf(t.id);-1!==e&&(n.splice(e,1),0===n.length&&this.lt.delete(t.scope))}destroy(){for(const[t,n]of this.dt)n.forEach(t=>{t.target.removeEventListener(t.eventName,t.wrappedHandler)});this.dt.clear(),this.lt.clear()}}const cn=new on;function an(t,n,e,r){return cn.on(t,n,e,r)}function un(t,n,e,r){return cn.once(t,n,e,r)}function hn(t,n,e){cn.off(t,n,e)}function fn(t,n,e){return cn.emit(t,n,e)}function dn(t,n){return cn.emitGlobal(t,n)}function ln(t){cn.offByScope(t)}function pn(t,n){cn.offAll(t,n)}function mn(t,n){return cn.getListenerCount(t,n)}class yn{constructor(){this._t=new Set,this.vt=!1,this.St=0,this.$t=10}schedule(t){this._t.add(t),this.vt||(this.vt=!0,queueMicrotask(()=>this.Ot()))}Ot(){if(this.St>=this.$t)return this._t.clear(),void(this.vt=!1);const t=Array.from(this._t);this._t.clear(),this.vt=!1,this.St++;const n=new Set;for(const e of t)if(!n.has(e)){n.add(e);try{e()}catch(t){}}this.St--}}const wn=new yn;class bn{constructor(t,n){this.data=t,this.createdAt=Date.now(),this.ttl=n}get isFresh(){return Date.now()-this.createdAt<this.ttl}get isStale(){return!this.isFresh}}class gn{constructor(){this.kt=new Map}get(t){const n=this.kt.get(t);return n||null}set(t,n,e=6e4){this.kt.set(t,new bn(n,e))}has(t){return this.kt.has(t)}delete(t){this.kt.delete(t)}clear(){this.kt.clear()}getStale(t){const n=this.kt.get(t);return n?n.data:null}}class xn extends Error{constructor(t,n,e){super(t),this.name="DependsError",this.code=n,this.cause=e,this.timestamp=Date.now()}}let _n="undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch.bind(globalThis):"undefined"!=typeof window&&window.fetch?window.fetch.bind(window):null;function vn(t){if(!t||"function"!=typeof t.fetch)throw new TypeError("[Kupola] configureHttpClient: client must provide a fetch function");_n=t.fetch.bind(t)}function Sn(){return _n}function $n(){_n="undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch.bind(globalThis):"undefined"!=typeof window&&window.fetch?window.fetch.bind(window):null}class On{constructor(t,n){this.config=t,this.cacheKey=t.cacheKey||String(t.source),this.staleTime=t.staleTime??6e4,this.cache=n,this.subscribers=[],this.pending=null,this.retryCount=t.retry??0,this.retryDelay=t.retryDelay??1e3,this.onError=t.onError||null}subscribe(t){return this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);n>-1&&this.subscribers.splice(n,1)}}notify(){wn.schedule(()=>{this.subscribers.forEach(t=>{try{t()}catch(t){}})})}async fetch(t){throw new xn("Source fetch not implemented","NOT_IMPLEMENTED")}async getValue(t){const n=this.cache.get(this.cacheKey);return n&&n.isFresh?n.data:n&&n.isStale?(this.Mt(t),n.data):this.jt(t)}async jt(t,n=0){try{const n=await this.fetch(t);return this.cache.set(this.cacheKey,n,this.staleTime),this.notify(),n}catch(e){if(n<this.retryCount){const e=this.retryDelay*Math.pow(2,n),r=e+Math.random()*e*.5;return await new Promise(t=>setTimeout(t,r)),this.jt(t,n+1)}const r=e instanceof xn?e:new xn(e.message||"Fetch failed","FETCH_ERROR",e);if(this.onError)try{this.onError(r)}catch(t){}throw r}}async Mt(t){try{await this.jt(t)}catch(t){}}invalidate(){this.cache.delete(this.cacheKey),this.pending=null}destroy(){this.subscribers=[],this.pending=null}}class kn extends On{constructor(t,n){super(t,n),this.method=t.method||"GET",this.headers=t.headers||{},this.queryParams=t.query||{}}async fetch(t){let n=this.config.source;const e=st("http");!e?.baseURL||n.startsWith("http://")||n.startsWith("https://")||(n=e.baseURL+n.replace(/^\//,""));for(const e in t)n=n.replace(`:${e}`,encodeURIComponent(t[e]));const r=[];for(const[t,n]of Object.entries(this.queryParams||{}))r.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);for(const n in t)this.config.source.includes(`:${n}`)||r.push(`${encodeURIComponent(n)}=${encodeURIComponent(t[n])}`);r.length>0&&(n+=(n.includes("?")?"&":"?")+r.join("&"));const i=e?.headers||{},s={method:this.method.toUpperCase(),headers:{"Content-Type":"application/json",...i,...this.headers}};e?.withCredentials&&(s.credentials="include"),["POST","PUT","PATCH"].includes(s.method)&&(s.body=JSON.stringify(t));const o=_n;if(!o)throw new xn("No HTTP client available. Use configureHttpClient() to set one.","NO_HTTP_CLIENT");const c=await o(n,s),a="boolean"==typeof c.ok?c.ok:c.status>=200&&c.status<300,u="number"==typeof c.status?c.status:0;if(!a)throw new xn(`HTTP ${u}`,"HTTP_ERROR");return"function"==typeof c.json?await c.json():void 0!==c.data?c.data:c}}class Mn extends On{constructor(t,n){super(t,n),this.storageKey=t.source.replace("localStorage:",""),this.defaultValue=t.default,this.sync=!1!==t.sync,this.sync&&"undefined"!=typeof window&&(this.Ct=t=>{t.key===this.storageKey&&(this.cache.delete(this.cacheKey),this.notify())},window.addEventListener("storage",this.Ct))}async fetch(){try{const t=localStorage.getItem(this.storageKey);if(null===t)return this.defaultValue;try{return JSON.parse(t)}catch(n){return t}}catch(t){return this.defaultValue}}setValue(t){const n="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(this.storageKey,n),this.cache.delete(this.cacheKey),this.notify()}destroy(){super.destroy(),this.Ct&&window.removeEventListener("storage",this.Ct)}}class jn extends On{constructor(t,n){super(t,n),this.paramName=t.source.replace("route:","")}async fetch(){if("undefined"==typeof window)return"";const t=location.hash.slice(1).match(new RegExp(`/${this.paramName}/([^/]+)`));if(t)return decodeURIComponent(t[1]);return new URLSearchParams(location.search).get(this.paramName)||""}}class Cn extends On{async fetch(t){return await this.config.source(t)}}class En extends On{async fetch(){return this.config.source}}class Dn extends On{constructor(t,n){super(t,n),this.ws=null,this.reconnect=!1!==t.reconnect,this.reconnectDelay=t.reconnectDelay||3e3,this.Et=0,this.Dt=t.maxReconnectDelay||3e4,this.messageHandler=null,this.Nt=!1,this.Rt=!1}async fetch(){return new Promise((t,n)=>{try{this.ws=new WebSocket(this.config.source),this.ws.onopen=()=>{this.Nt=!0,this.Et=0,t(this.cache.getStale(this.cacheKey))},this.messageHandler=t=>{let n;try{n=JSON.parse(t.data)}catch(e){n=t.data}this.cache.set(this.cacheKey,n,this.staleTime),this.notify()},this.ws.onmessage=this.messageHandler,this.ws.onerror=t=>{this.Nt||n(new xn("WebSocket connection failed","WS_ERROR",t))},this.ws.onclose=()=>{if(this.Nt=!1,this.reconnect&&!this.Rt){const t=this.reconnectDelay*Math.pow(2,this.Et),n=Math.random()*t*.3,e=Math.min(t+n,this.Dt);this.Et++,setTimeout(()=>{this.Rt||this.fetch().catch(()=>{})},e)}}}catch(t){n(new xn("WebSocket creation failed","WS_ERROR",t))}})}send(t){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send("string"==typeof t?t:JSON.stringify(t))}destroy(){this.Rt=!0,super.destroy(),this.ws&&(this.ws.onmessage=null,this.ws.onclose=null,this.ws.close(),this.ws=null)}}function Nn(t,n){const e=t.source;return"function"==typeof e?new Cn(t,n):"string"==typeof e&&(e.startsWith("ws://")||e.startsWith("wss://"))?new Dn(t,n):"string"==typeof e&&(e.startsWith("/")||e.startsWith("http"))?new kn(t,n):"string"==typeof e&&e.startsWith("localStorage:")?new Mn(t,n):"string"==typeof e&&e.startsWith("route:")?new jn(t,n):new En(t,n)}function Rn(t,n){const e={},r=new gn,i=[];for(const s in n){let o=n[s];"string"==typeof o&&(o={source:o});const c=Nn({...o,cacheKey:o.cacheKey||`${s}-${JSON.stringify(Tn(t))}`},r),a=K(null),u=K(!0),h=K(null),f=K(null);let d=0;async function l(){const n=++d;u.value=!0,h.value=null;try{const e=await c.getValue(Tn(t));if(n!==d)return;a.value=e,f.value=Date.now()}catch(t){if(n!==d)return;h.value=t.message||"Unknown error"}finally{n===d&&(u.value=!1)}}l();const p=c.subscribe(()=>{const t=r.getStale(c.cacheKey);null!=t&&(a.value=t,f.value=Date.now())});i.push(p);const m=Object.keys(t);m.length>0&&m.forEach(n=>{const e=t[n];if(e&&"object"==typeof e&&"value"in e&&e.L){const t=()=>{c.invalidate(),l()};e.L.add(t),i.push(()=>e.L.delete(t))}}),e[s]={data:a,loading:u,error:h,lastUpdated:f,refresh:()=>(c.invalidate(),l()),setValue(t){c instanceof Mn&&(c.setValue(t),a.value=t)},send(t){c instanceof Dn&&c.send(t)},At:c}}return e.Tt=()=>{if(i.forEach(t=>t()),window.__kupolaDepInstances){const t=window.__kupolaDepInstances.indexOf(e);-1!==t&&window.__kupolaDepInstances.splice(t,1)}},window.__kupolaDepInstances||(window.__kupolaDepInstances=[]),window.__kupolaDepInstances.push(e),e}function An(t){const n=new gn,e=Nn(t,n),r=K(null),i=K(!0),s=K(null);let o=0;async function c(){const n=++o;i.value=!0,s.value=null;try{const i=await e.getValue(t.params||{});if(n!==o)return;r.value=i}catch(t){if(n!==o)return;s.value=t.message||"Unknown error"}finally{n===o&&(i.value=!1)}}return c(),e.subscribe(()=>{const t=n.getStale(e.cacheKey);null!=t&&(r.value=t)}),{data:r,loading:i,error:s,refresh:()=>(e.invalidate(),c())}}function Tn(t){const n={};for(const e in t){const r=t[e];n[e]=r&&"object"==typeof r&&"value"in r?r.value:r}return n}function Fn(){}export{xt as BRAND_OPTIONS,bn as CacheEntry,gn as CacheManager,Tt as ComponentInitializerRegistry,xn as DependsError,On as DependsSource,kn as FetchedSource,Cn as FunctionSource,on as GlobalEvents,It as KupolaComponent,Ut as KupolaComponentRegistry,H as KupolaDataBind,W as KupolaEventBus,Zt as KupolaI18n,t as KupolaLifecycle,B as KupolaStore,J as KupolaStoreManager,F as KupolaUtils,jn as RouteSource,yn as Scheduler,En as StaticSource,Mn as StorageSource,Dn as WebSocketSource,Lt as applyMixin,c as arrayUtils,Wt as bootstrapComponents,Fn as clearCache,vn as configureHttpClient,Ct as createBrandPicker,Gt as createI18n,e as createLifecycle,Nn as createSource,X as createStore,jt as createThemeToggle,E as cryptoUtils,x as dateUtils,_ as debounce,Yt as defineComponent,Kt as defineMixin,fn as emit,dn as emitGlobal,Dt as escapeHtml,sn as formatCurrency,en as formatDate,rn as formatNumber,At as generateSecureId,ct as getBasePath,St as getBrand,st as getConfig,ut as getDefaultBrand,at as getDefaultTheme,Sn as getHttpClient,ht as getHttpConfig,ot as getIconsPath,mn as getListenerCount,nn as getLocale,pt as getMessageConfig,mt as getNotificationConfig,lt as getPerformanceConfig,dt as getSecurityConfig,G as getStore,_t as getTheme,ft as getUiConfig,yt as getValidationConfig,cn as globalEvents,Mt as initTheme,Ht as kupolaBootstrap,q as kupolaData,Y as kupolaEvents,Xt as kupolaI18n,Ft as kupolaInitializer,n as kupolaLifecycle,zt as kupolaRegistry,Z as kupolaStoreManager,Rt as maskData,Vt as n,l as numberUtils,u as objectUtils,hn as off,pn as offAll,ln as offByScope,rt as offConfigChange,an as on,et as onConfigChange,un as once,T as preloadUtils,K as ref,Bt as registerComponent,Jt as registerLazyComponent,$n as resetHttpClient,Et as sanitizeHtml,$t as setBrand,it as setConfig,tn as setLocale,vt as setTheme,s as stringUtils,Nt as stripHtml,Qt as t,v as throttle,Rn as useDeps,qt as useMixin,An as useQuery,C as validatorUtils};
|