2025-06-09 08:41:31 +00:00

17 lines
122 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-gdeeYhiO.js","assets/tmagic-utils-DIrSmr3i.js","assets/plugin-vueexport-helper-Dze5743D.js","assets/Container-x381xhtF.js","assets/tmagic-core-BACUJHNP.js","assets/index-FVh2UgkF.js","assets/index-BUgFgCi5.js","assets/index-CQbNZRgE.js","assets/index-C6TiO4v0.js","assets/index-C6zt9Vpa.js","assets/PageFragmentContainer-Akm4fGHF.js","assets/PageFragmentContainer-Dw5-BKqx.css","assets/PageFragment-DNp3glCg.js","assets/IteratorContainer-C0Y5pPhm.js"])))=>i.map(i=>d[i]);
var Q=Object.defineProperty;var G=r=>{throw TypeError(r)};var X=(r,t,e)=>t in r?Q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var m=(r,t,e)=>X(r,typeof t!="symbol"?t+"":t,e),z=(r,t,e)=>t.has(r)||G("Cannot "+e);var R=(r,t,e)=>(z(r,t,"read from private field"),e?e.call(r):t.get(r)),x=(r,t,e)=>t.has(r)?G("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),j=(r,t,e,s)=>(z(r,t,"write to private field"),s?s.call(r,e):t.set(r,e),e);function __vite_legacy_guard(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function e(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(n){if(n.ep)return;n.ep=!0;const i=e(n);fetch(n.href,i)}})();function getDefaultExportFromCjs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var events={exports:{}},hasRequiredEvents;function requireEvents(){if(hasRequiredEvents)return events.exports;hasRequiredEvents=1;var r=typeof Reflect=="object"?Reflect:null,t=r&&typeof r.apply=="function"?r.apply:function(g,b,E){return Function.prototype.apply.call(g,b,E)},e;r&&typeof r.ownKeys=="function"?e=r.ownKeys:Object.getOwnPropertySymbols?e=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:e=function(g){return Object.getOwnPropertyNames(g)};function s(f){console&&console.warn&&console.warn(f)}var n=Number.isNaN||function(g){return g!==g};function i(){i.init.call(this)}events.exports=i,events.exports.once=O,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function o(f){if(typeof f!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof f)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(f){if(typeof f!="number"||f<0||n(f))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+f+".");a=f}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||n(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function u(f){return f._maxListeners===void 0?i.defaultMaxListeners:f._maxListeners}i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(g){for(var b=[],E=1;E<arguments.length;E++)b.push(arguments[E]);var h=g==="error",S=this._events;if(S!==void 0)h=h&&S.error===void 0;else if(!h)return!1;if(h){var T;if(b.length>0&&(T=b[0]),T instanceof Error)throw T;var D=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw D.context=T,D}var _=S[g];if(_===void 0)return!1;if(typeof _=="function")t(_,this,b);else for(var L=_.length,q=v(_,L),E=0;E<L;++E)t(q[E],this,b);return!0};function c(f,g,b,E){var h,S,T;if(o(b),S=f._events,S===void 0?(S=f._events=Object.create(null),f._eventsCount=0):(S.newListener!==void 0&&(f.emit("newListener",g,b.listener?b.listener:b),S=f._events),T=S[g]),T===void 0)T=S[g]=b,++f._eventsCount;else if(typeof T=="function"?T=S[g]=E?[b,T]:[T,b]:E?T.unshift(b):T.push(b),h=u(f),h>0&&T.length>h&&!T.warned){T.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=f,D.type=g,D.count=T.length,s(D)}return f}i.prototype.addListener=function(g,b){return c(this,g,b,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(g,b){return c(this,g,b,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(f,g,b){var E={fired:!1,wrapFn:void 0,target:f,type:g,listener:b},h=l.bind(E);return h.listener=b,E.wrapFn=h,h}i.prototype.once=function(g,b){return o(b),this.on(g,d(this,g,b)),this},i.prototype.prependOnceListener=function(g,b){return o(b),this.prependListener(g,d(this,g,b)),this},i.prototype.removeListener=function(g,b){var E,h,S,T,D;if(o(b),h=this._events,h===void 0)return this;if(E=h[g],E===void 0)return this;if(E===b||E.listener===b)--this._eventsCount===0?this._events=Object.create(null):(delete h[g],h.removeListener&&this.emit("removeListener",g,E.listener||b));else if(typeof E!="function"){for(S=-1,T=E.length-1;T>=0;T--)if(E[T]===b||E[T].listener===b){D=E[T].listener,S=T;break}if(S<0)return this;S===0?E.shift():w(E,S),E.length===1&&(h[g]=E[0]),h.removeListener!==void 0&&this.emit("removeListener",g,D||b)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(g){var b,E,h;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[g]),this;if(arguments.length===0){var S=Object.keys(E),T;for(h=0;h<S.length;++h)T=S[h],T!=="removeListener"&&this.removeAllListeners(T);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(b=E[g],typeof b=="function")this.removeListener(g,b);else if(b!==void 0)for(h=b.length-1;h>=0;h--)this.removeListener(g,b[h]);return this};function p(f,g,b){var E=f._events;if(E===void 0)return[];var h=E[g];return h===void 0?[]:typeof h=="function"?b?[h.listener||h]:[h]:b?C(h):v(h,h.length)}i.prototype.listeners=function(g){return p(this,g,!0)},i.prototype.rawListeners=function(g){return p(this,g,!1)},i.listenerCount=function(f,g){return typeof f.listenerCount=="function"?f.listenerCount(g):y.call(f,g)},i.prototype.listenerCount=y;function y(f){var g=this._events;if(g!==void 0){var b=g[f];if(typeof b=="function")return 1;if(b!==void 0)return b.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]};function v(f,g){for(var b=new Array(g),E=0;E<g;++E)b[E]=f[E];return b}function w(f,g){for(;g+1<f.length;g++)f[g]=f[g+1];f.pop()}function C(f){for(var g=new Array(f.length),b=0;b<g.length;++b)g[b]=f[b].listener||f[b];return g}function O(f,g){return new Promise(function(b,E){function h(T){f.removeListener(g,S),E(T)}function S(){typeof f.removeListener=="function"&&f.removeListener("error",h),b([].slice.call(arguments))}$(f,g,S,{once:!0}),g!=="error"&&A(f,h,{once:!0})})}function A(f,g,b){typeof f.on=="function"&&$(f,"error",g,b)}function $(f,g,b,E){if(typeof f.on=="function")E.once?f.once(g,b):f.on(g,b);else if(typeof f.addEventListener=="function")f.addEventListener(g,function h(S){E.once&&f.removeEventListener(g,h),b(S)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof f)}return events.exports}var eventsExports=requireEvents();const EventEmitter$1=getDefaultExportFromCjs(eventsExports);var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto$d=Object.prototype,hasOwnProperty$a=objectProto$d.hasOwnProperty,nativeObjectToString$1=objectProto$d.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(r){var t=hasOwnProperty$a.call(r,symToStringTag$1),e=r[symToStringTag$1];try{r[symToStringTag$1]=void 0;var s=!0}catch(i){}var n=nativeObjectToString$1.call(r);return s&&(t?r[symToStringTag$1]=e:delete r[symToStringTag$1]),n}var objectProto$c=Object.prototype,nativeObjectToString=objectProto$c.toString;function objectToString(r){return nativeObjectToString.call(r)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(r){return r==null?r===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(r)?getRawTag(r):objectToString(r)}function isObjectLike(r){return r!=null&&typeof r=="object"}var symbolTag$2="[object Symbol]";function isSymbol(r){return typeof r=="symbol"||isObjectLike(r)&&baseGetTag(r)==symbolTag$2}function arrayMap(r,t){for(var e=-1,s=r==null?0:r.length,n=Array(s);++e<s;)n[e]=t(r[e],e,r);return n}var isArray=Array.isArray,symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$1?symbolProto$1.toString:void 0;function baseToString(r){if(typeof r=="string")return r;if(isArray(r))return arrayMap(r,baseToString)+"";if(isSymbol(r))return symbolToString?symbolToString.call(r):"";var t=r+"";return t=="0"&&1/r==-1/0?"-0":t}function isObject$2(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}function identity(r){return r}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(r){if(!isObject$2(r))return!1;var t=baseGetTag(r);return t==funcTag$2||t==genTag$1||t==asyncTag||t==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var r=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function isMasked(r){return!!maskSrcKey&&maskSrcKey in r}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(r){if(r!=null){try{return funcToString$1.call(r)}catch(t){}try{return r+""}catch(t){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$b=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$9=objectProto$b.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$9).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(r){if(!isObject$2(r)||isMasked(r))return!1;var t=isFunction(r)?reIsNative:reIsHostCtor;return t.test(toSource(r))}function getValue(r,t){return r==null?void 0:r[t]}function getNative(r,t){var e=getValue(r,t);return baseIsNative(e)?e:void 0}var WeakMap$1=getNative(root,"WeakMap"),objectCreate=Object.create,baseCreate=function(){function r(){}return function(t){if(!isObject$2(t))return{};if(objectCreate)return objectCreate(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();function apply(r,t,e){switch(e.length){case 0:return r.call(t);case 1:return r.call(t,e[0]);case 2:return r.call(t,e[0],e[1]);case 3:return r.call(t,e[0],e[1],e[2])}return r.apply(t,e)}function noop(){}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(r){var t=0,e=0;return function(){var s=nativeNow(),n=HOT_SPAN-(s-e);if(e=s,n>0){if(++t>=HOT_COUNT)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}function constant(r){return function(){return r}}var defineProperty=function(){try{var r=getNative(Object,"defineProperty");return r({},"",{}),r}catch(t){}}(),baseSetToString=defineProperty?function(r,t){return defineProperty(r,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity,setToString=shortOut(baseSetToString);function arrayEach(r,t){for(var e=-1,s=r==null?0:r.length;++e<s&&t(r[e],e,r)!==!1;);return r}function baseFindIndex(r,t,e,s){for(var n=r.length,i=e+-1;++i<n;)if(t(r[i],i,r))return i;return-1}function baseIsNaN(r){return r!==r}function strictIndexOf(r,t,e){for(var s=e-1,n=r.length;++s<n;)if(r[s]===t)return s;return-1}function baseIndexOf(r,t,e){return t===t?strictIndexOf(r,t,e):baseFindIndex(r,baseIsNaN,e)}function arrayIncludes(r,t){var e=r==null?0:r.length;return!!e&&baseIndexOf(r,t,0)>-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(r,t){var e=typeof r;return t=t==null?MAX_SAFE_INTEGER$1:t,!!t&&(e=="number"||e!="symbol"&&reIsUint.test(r))&&r>-1&&r%1==0&&r<t}function baseAssignValue(r,t,e){t=="__proto__"&&defineProperty?defineProperty(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e}function eq(r,t){return r===t||r!==r&&t!==t}var objectProto$a=Object.prototype,hasOwnProperty$8=objectProto$a.hasOwnProperty;function assignValue(r,t,e){var s=r[t];(!(hasOwnProperty$8.call(r,t)&&eq(s,e))||e===void 0&&!(t in r))&&baseAssignValue(r,t,e)}var nativeMax=Math.max;function overRest(r,t,e){return t=nativeMax(t===void 0?r.length-1:t,0),function(){for(var s=arguments,n=-1,i=nativeMax(s.length-t,0),a=Array(i);++n<i;)a[n]=s[t+n];n=-1;for(var o=Array(t+1);++n<t;)o[n]=s[n];return o[t]=e(a),apply(r,this,o)}}function baseRest(r,t){return setToString(overRest(r,t,identity),r+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=MAX_SAFE_INTEGER}function isArrayLike(r){return r!=null&&isLength(r.length)&&!isFunction(r)}var objectProto$9=Object.prototype;function isPrototype(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||objectProto$9;return r===e}function baseTimes(r,t){for(var e=-1,s=Array(r);++e<r;)s[e]=t(e);return s}var argsTag$2="[object Arguments]";function baseIsArguments(r){return isObjectLike(r)&&baseGetTag(r)==argsTag$2}var objectProto$8=Object.prototype,hasOwnProperty$7=objectProto$8.hasOwnProperty,propertyIsEnumerable$1=objectProto$8.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(r){return isObjectLike(r)&&hasOwnProperty$7.call(r,"callee")&&!propertyIsEnumerable$1.call(r,"callee")};function stubFalse(){return!1}var freeExports$2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$1=moduleExports$2?root.Buffer:void 0,nativeIsBuffer=Buffer$1?Buffer$1.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$1="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$2="[object Number]",objectTag$2="[object Object]",regexpTag$2="[object RegExp]",setTag$5="[object Set]",stringTag$2="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$1]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$2]=typedArrayTags[boolTag$2]=typedArrayTags[dataViewTag$3]=typedArrayTags[dateTag$2]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$2]=typedArrayTags[objectTag$2]=typedArrayTags[regexpTag$2]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$2]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(r){return isObjectLike(r)&&isLength(r.length)&&!!typedArrayTags[baseGetTag(r)]}function baseUnary(r){return function(t){return r(t)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var r=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return r||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(t){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$7=Object.prototype,hasOwnProperty$6=objectProto$7.hasOwnProperty;function arrayLikeKeys(r,t){var e=isArray(r),s=!e&&isArguments(r),n=!e&&!s&&isBuffer(r),i=!e&&!s&&!n&&isTypedArray(r),a=e||s||n||i,o=a?baseTimes(r.length,String):[],u=o.length;for(var c in r)hasOwnProperty$6.call(r,c)&&!(a&&(c=="length"||n&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||isIndex(c,u)))&&o.push(c);return o}function overArg(r,t){return function(e){return r(t(e))}}var nativeKeys=overArg(Object.keys,Object),objectProto$6=Object.prototype,hasOwnProperty$5=objectProto$6.hasOwnProperty;function baseKeys(r){if(!isPrototype(r))return nativeKeys(r);var t=[];for(var e in Object(r))hasOwnProperty$5.call(r,e)&&e!="constructor"&&t.push(e);return t}function keys(r){return isArrayLike(r)?arrayLikeKeys(r):baseKeys(r)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(r,t){if(isArray(r))return!1;var e=typeof r;return e=="number"||e=="symbol"||e=="boolean"||r==null||isSymbol(r)?!0:reIsPlainProp.test(r)||!reIsDeepProp.test(r)||t!=null&&r in Object(t)}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty;function hashGet(r){var t=this.__data__;if(nativeCreate){var e=t[r];return e===HASH_UNDEFINED$2?void 0:e}return hasOwnProperty$4.call(t,r)?t[r]:void 0}var objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty;function hashHas(r){var t=this.__data__;return nativeCreate?t[r]!==void 0:hasOwnProperty$3.call(t,r)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=nativeCreate&&t===void 0?HASH_UNDEFINED$1:t,this}function Hash(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var s=r[t];this.set(s[0],s[1])}}Hash.prototype.clear=hashClear;Hash.prototype.delete=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(r,t){for(var e=r.length;e--;)if(eq(r[e][0],t))return e;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(r){var t=this.__data__,e=assocIndexOf(t,r);if(e<0)return!1;var s=t.length-1;return e==s?t.pop():splice.call(t,e,1),--this.size,!0}function listCacheGet(r){var t=this.__data__,e=assocIndexOf(t,r);return e<0?void 0:t[e][1]}function listCacheHas(r){return assocIndexOf(this.__data__,r)>-1}function listCacheSet(r,t){var e=this.__data__,s=assocIndexOf(e,r);return s<0?(++this.size,e.push([r,t])):e[s][1]=t,this}function ListCache(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var s=r[t];this.set(s[0],s[1])}}ListCache.prototype.clear=listCacheClear;ListCache.prototype.delete=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}function getMapData(r,t){var e=r.__data__;return isKeyable(t)?e[typeof t=="string"?"string":"hash"]:e.map}function mapCacheDelete(r){var t=getMapData(this,r).delete(r);return this.size-=t?1:0,t}function mapCacheGet(r){return getMapData(this,r).get(r)}function mapCacheHas(r){return getMapData(this,r).has(r)}function mapCacheSet(r,t){var e=getMapData(this,r),s=e.size;return e.set(r,t),this.size+=e.size==s?0:1,this}function MapCache(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var s=r[t];this.set(s[0],s[1])}}MapCache.prototype.clear=mapCacheClear;MapCache.prototype.delete=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError(FUNC_ERROR_TEXT);var e=function(){var s=arguments,n=t?t.apply(this,s):s[0],i=e.cache;if(i.has(n))return i.get(n);var a=r.apply(this,s);return e.cache=i.set(n,a)||i,a};return e.cache=new(memoize.Cache||MapCache),e}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(r){var t=memoize(r,function(s){return e.size===MAX_MEMOIZE_SIZE&&e.clear(),s}),e=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(r){var t=[];return r.charCodeAt(0)===46&&t.push(""),r.replace(rePropName,function(e,s,n,i){t.push(n?i.replace(reEscapeChar,"$1"):s||e)}),t});function toString(r){return r==null?"":baseToString(r)}function castPath(r,t){return isArray(r)?r:isKey(r,t)?[r]:stringToPath(toString(r))}function toKey(r){if(typeof r=="string"||isSymbol(r))return r;var t=r+"";return t=="0"&&1/r==-1/0?"-0":t}function arrayPush(r,t){for(var e=-1,s=t.length,n=r.length;++e<s;)r[n+e]=t[e];return r}var spreadableSymbol=Symbol$1?Symbol$1.isConcatSpreadable:void 0;function isFlattenable(r){return isArray(r)||isArguments(r)||!!(spreadableSymbol&&r&&r[spreadableSymbol])}function baseFlatten(r,t,e,s,n){var i=-1,a=r.length;for(e||(e=isFlattenable),n||(n=[]);++i<a;){var o=r[i];e(o)&&arrayPush(n,o)}return n}var getPrototype=overArg(Object.getPrototypeOf,Object);function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}function stackGet(r){return this.__data__.get(r)}function stackHas(r){return this.__data__.has(r)}var LARGE_ARRAY_SIZE$1=200;function stackSet(r,t){var e=this.__data__;if(e instanceof ListCache){var s=e.__data__;if(!Map$1||s.length<LARGE_ARRAY_SIZE$1-1)return s.push([r,t]),this.size=++e.size,this;e=this.__data__=new MapCache(s)}return e.set(r,t),this.size=e.size,this}function Stack(r){var t=this.__data__=new ListCache(r);this.size=t.size}Stack.prototype.clear=stackClear;Stack.prototype.delete=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer=moduleExports?root.Buffer:void 0;Buffer&&Buffer.allocUnsafe;function cloneBuffer(r,t){return r.slice()}function arrayFilter(r,t){for(var e=-1,s=r==null?0:r.length,n=0,i=[];++e<s;){var a=r[e];t(a,e,r)&&(i[n++]=a)}return i}function stubArray(){return[]}var objectProto$3=Object.prototype,propertyIsEnumerable=objectProto$3.propertyIsEnumerable,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols?function(r){return r==null?[]:(r=Object(r),arrayFilter(nativeGetSymbols(r),function(t){return propertyIsEnumerable.call(r,t)}))}:stubArray;function baseGetAllKeys(r,t,e){var s=t(r);return isArray(r)?s:arrayPush(s,e(r))}function getAllKeys(r){return baseGetAllKeys(r,keys,getSymbols)}var DataView=getNative(root,"DataView"),Promise$1=getNative(root,"Promise"),Set$1=getNative(root,"Set"),mapTag$4="[object Map]",objectTag$1="[object Object]",promiseTag="[object Promise]",setTag$4="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag$2||Map$1&&getTag(new Map$1)!=mapTag$4||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$4||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag$1)&&(getTag=function(r){var t=baseGetTag(r),e=t==objectTag$1?r.constructor:void 0,s=e?toSource(e):"";if(s)switch(s){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$4;case promiseCtorString:return promiseTag;case setCtorString:return setTag$4;case weakMapCtorString:return weakMapTag$1}return t});var objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function initCloneArray(r){var t=r.length,e=new r.constructor(t);return t&&typeof r[0]=="string"&&hasOwnProperty$2.call(r,"index")&&(e.index=r.index,e.input=r.input),e}var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(r){var t=new r.constructor(r.byteLength);return new Uint8Array$1(t).set(new Uint8Array$1(r)),t}function cloneDataView(r,t){var e=cloneArrayBuffer(r.buffer);return new r.constructor(e,r.byteOffset,r.byteLength)}var reFlags=/\w*$/;function cloneRegExp(r){var t=new r.constructor(r.source,reFlags.exec(r));return t.lastIndex=r.lastIndex,t}var symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function cloneSymbol(r){return symbolValueOf?Object(symbolValueOf.call(r)):{}}function cloneTypedArray(r,t){var e=cloneArrayBuffer(r.buffer);return new r.constructor(e,r.byteOffset,r.length)}var boolTag$1="[object Boolean]",dateTag$1="[object Date]",mapTag$3="[object Map]",numberTag$1="[object Number]",regexpTag$1="[object RegExp]",setTag$3="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(r,t,e){var s=r.constructor;switch(t){case arrayBufferTag$1:return cloneArrayBuffer(r);case boolTag$1:case dateTag$1:return new s(+r);case dataViewTag$1:return cloneDataView(r);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(r);case mapTag$3:return new s;case numberTag$1:case stringTag$1:return new s(r);case regexpTag$1:return cloneRegExp(r);case setTag$3:return new s;case symbolTag$1:return cloneSymbol(r)}}function initCloneObject(r){return typeof r.constructor=="function"&&!isPrototype(r)?baseCreate(getPrototype(r)):{}}var mapTag$2="[object Map]";function baseIsMap(r){return isObjectLike(r)&&getTag(r)==mapTag$2}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$2="[object Set]";function baseIsSet(r){return isObjectLike(r)&&getTag(r)==setTag$2}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$1="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag$1="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$1]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag$1]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;function baseClone(r,t,e,s,n,i){var a;if(a!==void 0)return a;if(!isObject$2(r))return r;var o=isArray(r);if(o)a=initCloneArray(r);else{var u=getTag(r),c=u==funcTag||u==genTag;if(isBuffer(r))return cloneBuffer(r);if(u==objectTag||u==argsTag||c&&!n)a=c?{}:initCloneObject(r);else{if(!cloneableTags[u])return n?r:{};a=initCloneByTag(r,u)}}i||(i=new Stack);var l=i.get(r);if(l)return l;i.set(r,a),isSet(r)?r.forEach(function(y){a.add(baseClone(y,t,e,y,r,i))}):isMap(r)&&r.forEach(function(y,v){a.set(v,baseClone(y,t,e,v,r,i))});var d=getAllKeys,p=o?void 0:d(r);return arrayEach(p||r,function(y,v){p&&(v=y,y=r[v]),assignValue(a,v,baseClone(y,t,e,v,r,i))}),a}var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(r){return baseClone(r,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(r){return this.__data__.set(r,HASH_UNDEFINED),this}function setCacheHas(r){return this.__data__.has(r)}function SetCache(r){var t=-1,e=r==null?0:r.length;for(this.__data__=new MapCache;++t<e;)this.add(r[t])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;function cacheHas(r,t){return r.has(t)}function setToArray(r){var t=-1,e=Array(r.size);return r.forEach(function(s){e[++t]=s}),e}function hasPath(r,t,e){t=castPath(t,r);for(var s=-1,n=t.length,i=!1;++s<n;){var a=toKey(t[s]);if(!(i=r!=null&&e(r,a)))break;r=r[a]}return i||++s!=n?i:(n=r==null?0:r.length,!!n&&isLength(n)&&isIndex(a,n)&&(isArray(r)||isArguments(r)))}function isArrayLikeObject(r){return isObjectLike(r)&&isArrayLike(r)}var objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseHas(r,t){return r!=null&&hasOwnProperty$1.call(r,t)}function has(r,t){return r!=null&&hasPath(r,t,baseHas)}var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function isEmpty(r){if(r==null)return!0;if(isArrayLike(r)&&(isArray(r)||typeof r=="string"||typeof r.splice=="function"||isBuffer(r)||isTypedArray(r)||isArguments(r)))return!r.length;var t=getTag(r);if(t==mapTag||t==setTag)return!r.size;if(isPrototype(r))return!baseKeys(r).length;for(var e in r)if(hasOwnProperty.call(r,e))return!1;return!0}function baseSet(r,t,e,s){if(!isObject$2(r))return r;t=castPath(t,r);for(var n=-1,i=t.length,a=i-1,o=r;o!=null&&++n<i;){var u=toKey(t[n]),c=e;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(n!=a){var l=o[u];c=void 0,c===void 0&&(c=isObject$2(l)?l:isIndex(t[n+1])?[]:{})}assignValue(o,u,c),o=o[u]}return r}function set(r,t,e){return r==null?r:baseSet(r,t,e)}var INFINITY=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY?function(r){return new Set$1(r)}:noop,LARGE_ARRAY_SIZE=200;function baseUniq(r,t,e){var s=-1,n=arrayIncludes,i=r.length,a=!0,o=[],u=o;if(i>=LARGE_ARRAY_SIZE){var c=createSet(r);if(c)return setToArray(c);a=!1,n=cacheHas,u=new SetCache}else u=o;e:for(;++s<i;){var l=r[s],d=l;if(l=l!==0?l:0,a&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;o.push(l)}else n(u,d,e)||(u!==o&&u.push(d),o.push(l))}return o}var union=baseRest(function(r){return baseUniq(baseFlatten(r,1,isArrayLikeObject))});/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function __awaiter(r,t,e,s){function n(i){return i instanceof e?i:new e(function(a){a(i)})}return new(e||(e=Promise))(function(i,a){function o(l){try{c(s.next(l))}catch(d){a(d)}}function u(l){try{c(s.throw(l))}catch(d){a(d)}}function c(l){l.done?i(l.value):n(l.value).then(o,u)}c((s=s.apply(r,[])).next())})}const segments=[];function Match(r,t,e="*"){if(r===e)return!0;segments.length=0;let s=0,n=0,i=0,a=0;for(let p=0,y=r.length;p<y;p+=1){const v=r[p];v===e&&(s+=1,p>a&&segments.push(r.substring(a,p)),segments.push(v),a=p+1)}if(a<r.length&&segments.push(r.substring(a)),s?(n=r.length-s,i=1/0):i=n=r.length,segments.length===0)return r===t;const o=t.length;if(o<n||o>i)return!1;let u=0,c=segments.length-1,l=t.length-1,d=!1;for(;;){const p=segments[c];if(c-=1,p===e)d=!0;else{const y=l+1-p.length,v=t.lastIndexOf(p,y);if(v===-1||v>y)return!1;if(d)l=v-1,d=!1;else{if(v!==y)return!1;l-=p.length}}if(u>c)break}return!0}class WildcardObject{constructor(t,e,s,n=void 0){this.obj=t,this.delimiter=e,this.wildcard=s,this.is_match=n}shortMatch(t,e){if(t===e||t===this.wildcard)return!0;if(this.is_match)return this.is_match(t,e);const s=t.indexOf(this.wildcard);if(s>-1){const n=t.substr(s+1);if(s===0||e.substring(0,s)===t.substring(0,s)){const i=n.length;return i>0?e.substr(-i)===n:!0}}return!1}match(t,e){return this.is_match?this.is_match(t,e):t===e||t===this.wildcard||e===this.wildcard||this.shortMatch(t,e)||Match(t,e,this.wildcard)}handleArray(t,e,s,n,i={}){let a=t.indexOf(this.delimiter,s),o=!1;a===-1&&(o=!0,a=t.length);const u=t.substring(s,a);let c=0;for(const l of e){const d=c.toString(),p=n===""?d:n+this.delimiter+c;(u===this.wildcard||u===d||this.shortMatch(u,d))&&(o?i[p]=l:this.goFurther(t,l,a+1,p,i)),c++}return i}handleObject(t,e,s,n,i={}){let a=t.indexOf(this.delimiter,s),o=!1;a===-1&&(o=!0,a=t.length);const u=t.substring(s,a);for(let c in e){c=c.toString();const l=n===""?c:n+this.delimiter+c;(u===this.wildcard||u===c||this.shortMatch(u,c))&&(o?i[l]=e[c]:this.goFurther(t,e[c],a+1,l,i))}return i}goFurther(t,e,s,n,i={}){return Array.isArray(e)?this.handleArray(t,e,s,n,i):this.handleObject(t,e,s,n,i)}get(t){return this.goFurther(t,this.obj,0,"")}}class ObjectPath{static get(t,e,s=!1){if(!e)return;let n=e;for(const i of t)if(i in n)n=n[i];else if(s)n[i]=Object.create({}),n=n[i];else return;return n}static set(t,e,s){if(!s)return;if(t.length===0){for(const o in s)delete s[o];for(const o in e)s[o]=e[o];return}const n=t.slice(),i=n.pop(),a=ObjectPath.get(n,s,!0);return typeof a=="object"&&(a[i]=e),e}}let wasm,WASM_VECTOR_LEN=0,cachegetUint8Memory0=null;function getUint8Memory0(){return(cachegetUint8Memory0===null||cachegetUint8Memory0.buffer!==wasm.memory.buffer)&&(cachegetUint8Memory0=new Uint8Array(wasm.memory.buffer)),cachegetUint8Memory0}let cachedTextEncoder=new TextEncoder("utf-8");const encodeString=typeof cachedTextEncoder.encodeInto=="function"?function(r,t){return cachedTextEncoder.encodeInto(r,t)}:function(r,t){const e=cachedTextEncoder.encode(r);return t.set(e),{read:r.length,written:e.length}};function passStringToWasm0(r,t,e){if(e===void 0){const o=cachedTextEncoder.encode(r),u=t(o.length);return getUint8Memory0().subarray(u,u+o.length).set(o),WASM_VECTOR_LEN=o.length,u}let s=r.length,n=t(s);const i=getUint8Memory0();let a=0;for(;a<s;a++){const o=r.charCodeAt(a);if(o>127)break;i[n+a]=o}if(a!==s){a!==0&&(r=r.slice(a)),n=e(n,s,s=a+r.length*3);const o=getUint8Memory0().subarray(n+a,n+s),u=encodeString(r,o);a+=u.written}return WASM_VECTOR_LEN=a,n}function is_match(r,t){var e=passStringToWasm0(r,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),s=WASM_VECTOR_LEN,n=passStringToWasm0(t,wasm.__wbindgen_malloc,wasm.__wbindgen_realloc),i=WASM_VECTOR_LEN,a=wasm.is_match(e,s,n,i);return a!==0}async function load(r,t){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,t)}catch(s){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}const e=await r.arrayBuffer();return await WebAssembly.instantiate(e,t)}else{const e=await WebAssembly.instantiate(r,t);return e instanceof WebAssembly.Instance?{instance:e,module:r}:e}}async function init(r){const t={};(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:e,module:s}=await load(await r,t);return wasm=e.exports,init.__wbindgen_wasm_module=s,wasm}const defaultUpdateOptions={only:[],source:"",debug:!1,data:void 0,queue:!1,force:!1};function log(r,t){console.debug(r,t)}function getDefaultOptions(){return{delimiter:".",debug:!1,extraDebug:!1,useMute:!0,notRecursive:";",param:":",wildcard:"*",experimentalMatch:!1,queue:!1,defaultBulkValue:!0,useCache:!1,useSplitCache:!1,useIndicesCache:!1,maxSimultaneousJobs:1e3,maxQueueRuns:1e3,log,Promise}}function isObject$1(r){return r&&r.constructor?r.constructor.name==="Object":typeof r=="object"&&r!==null}class DeepState{constructor(t={},e={}){this.jobsRunning=0,this.updateQueue=[],this.subscribeQueue=[],this.listenersIgnoreCache=new WeakMap,this.is_match=null,this.destroyed=!1,this.queueRuns=0,this.groupId=0,this.namedGroups=[],this.numberGroups=[],this.traceId=0,this.traceMap=new Map,this.tracing=[],this.savedTrace=[],this.collection=null,this.collections=0,this.cache=new Map,this.splitCache=new Map,this.indices=new Map,this.indicesCount=new Map,this.lastExecs=new WeakMap,this.listeners=new Map,this.waitingListeners=new Map,this.options=Object.assign(Object.assign({},getDefaultOptions()),e),this.data=t,this.id=0,this.options.useCache?(this.pathGet=this.cacheGet,this.pathSet=this.cacheSet):(this.pathGet=ObjectPath.get,this.pathSet=ObjectPath.set),e.Promise?this.resolved=e.Promise.resolve():this.resolved=Promise.resolve(),this.muted=new Set,this.mutedListeners=new Set,this.scan=new WildcardObject(this.data,this.options.delimiter,this.options.wildcard),this.destroyed=!1}getDefaultListenerOptions(){return{bulk:!1,bulkValue:this.options.defaultBulkValue,debug:!1,source:"",data:void 0,queue:!1,group:!1}}cacheGet(t,e=this.data,s=!1){const n=t.join(this.options.delimiter),i=this.cache.get(n);if(i){const o=i.deref();if(o)return o}const a=ObjectPath.get(t,e,s);return(isObject$1(a)||Array.isArray(a))&&this.cache.set(n,new WeakRef(a)),a}cacheSet(t,e,s=this.data){const n=t.join(this.options.delimiter);return isObject$1(e)||Array.isArray(e)?this.cache.set(n,new WeakRef(e)):this.cache.delete(n),ObjectPath.set(t,e,s)}silentSet(t,e){return this.pathSet(this.split(t),e,this.data)}loadWasmMatcher(t){return __awaiter(this,void 0,void 0,function*(){yield init(t),this.is_match=is_match,this.scan=new WildcardObject(this.data,this.options.delimiter,this.options.wildcard,this.is_match)})}same(t,e){return(["number","string","undefined","boolean"].includes(typeof t)||t===null)&&e===t}getListeners(){return this.listeners}destroy(){this.destroyed=!0,this.data=void 0,this.listeners=new Map,this.waitingListeners=new Map,this.updateQueue=[],this.jobsRunning=0}match(t,e,s=!0){return this.is_match?this.is_match(t,e):t===e||t===this.options.wildcard||e===this.options.wildcard?!0:!s&&this.getIndicesCount(this.options.delimiter,t)<this.getIndicesCount(this.options.delimiter,e)?!1:this.scan.match(t,e)}getIndicesOf(t,e){if(this.options.useIndicesCache&&this.indices.has(e))return this.indices.get(e);const s=t.length;if(s==0)return[];let n=0,i,a=[];for(;(i=e.indexOf(t,n))>-1;)a.push(i),n=i+s;return this.options.useIndicesCache&&this.indices.set(e,a),a}getIndicesCount(t,e){if(this.options.useIndicesCache&&this.indicesCount.has(e))return this.indicesCount.get(e);const s=t.length;if(s==0)return 0;let n=0,i,a=0;for(;(i=e.indexOf(t,n))>-1;)a++,n=i+s;return this.options.useIndicesCache&&this.indicesCount.set(e,a),a}cutPath(t,e){if(e==="")return"";if(t=this.cleanNotRecursivePath(t),e=this.cleanNotRecursivePath(e),t===e)return t;const s=this.getIndicesCount(this.options.delimiter,e),n=this.getIndicesOf(this.options.delimiter,t);return t.substring(0,n[s])}trimPath(t){return t=this.cleanNotRecursivePath(t),t.charAt(0)===this.options.delimiter?t.substr(1):t}split(t){if(t==="")return[];if(!this.options.useSplitCache)return t.split(this.options.delimiter);const e=this.splitCache.get(t);if(e)return e.slice();const s=t.split(this.options.delimiter);return this.splitCache.set(t,s.slice()),s}isWildcard(t){return t.includes(this.options.wildcard)||this.hasParams(t)}isNotRecursive(t){return t.endsWith(this.options.notRecursive)}cleanNotRecursivePath(t){return this.isNotRecursive(t)?t.substring(0,t.length-1):t}hasParams(t){return t.includes(this.options.param)}getParamsInfo(t){let e={replaced:"",original:t,params:{}},s=0,n=[];for(const i of this.split(t)){e.params[s]={original:i,replaced:"",name:""};const a=new RegExp("\\".concat(this.options.param,"([^\\").concat(this.options.delimiter,"\\").concat(this.options.param,"]+)"),"g");let o=a.exec(i);if(o)e.params[s].name=o[1];else{delete e.params[s],n.push(i),s++;continue}a.lastIndex=0,e.params[s].replaced=i.replace(a,this.options.wildcard),n.push(e.params[s].replaced),s++}return e.replaced=n.join(this.options.delimiter),e}getParams(t,e){if(!t)return;const s=this.split(e),n={};for(const i in t.params){const a=t.params[i];n[a.name]=s[i]}return n}waitForAll(t,e){const s={};for(let n of t)s[n]={dirty:!1},this.hasParams(n)&&(s[n].paramsInfo=this.getParamsInfo(n)),s[n].isWildcard=this.isWildcard(n),s[n].isRecursive=!this.isNotRecursive(n);return this.waitingListeners.set(t,{fn:e,paths:s}),e(s),function(){this.waitingListeners.delete(t)}}executeWaitingListeners(t){if(!this.destroyed)for(const e of this.waitingListeners.values()){const{fn:s,paths:n}=e;let i=0,a=0;for(let o in n){const u=n[o];let c=!1;u.isRecursive&&(t=this.cutPath(t,o)),u.isWildcard&&this.match(o,t)&&(c=!0),t===o&&(c=!0),c&&(u.dirty=!0),u.dirty&&i++,a++}i===a&&s(n)}}subscribeAll(t,e,s=this.getDefaultListenerOptions()){if(this.destroyed)return()=>{};let n=[],i=0,a=null;typeof s.group=="boolean"&&s.group?(this.groupId++,a=this.groupId,s.bulk=!0):typeof s.group=="string"&&(s.bulk=!0,a=s.group);for(const o of t)n.push(this.subscribe(o,e,s,{all:t,index:i,groupId:a})),i++;return function(){for(const u of n)u()}}getCleanListenersCollection(t={}){return Object.assign({listeners:new Map,isRecursive:!1,isWildcard:!1,hasParams:!1,match:void 0,paramsInfo:void 0,path:void 0,originalPath:void 0,count:0},t)}getCleanListener(t,e=this.getDefaultListenerOptions()){return{fn:t,options:Object.assign(Object.assign({},this.getDefaultListenerOptions()),e),groupId:null}}getListenerCollectionMatch(t,e,s){t=this.cleanNotRecursivePath(t);const n=this;return function(a,o=!1){let u=t;return e?a=n.cutPath(a,t):u=n.cutPath(n.cleanNotRecursivePath(t),a),o&&console.log("[getListenerCollectionMatch]",{listenerPath:t,scopedListenerPath:u,path:a,isRecursive:e,isWildcard:s}),s&&n.match(u,a,e)?!0:u===a}}getListenersCollection(t,e){if(this.listeners.has(t)){let o=this.listeners.get(t);return o.listeners.set(++this.id,e),e.id=this.id,o}const s=this.hasParams(t);let n;s&&(n=this.getParamsInfo(t));let i={isRecursive:!this.isNotRecursive(t),isWildcard:this.isWildcard(t),hasParams:s,paramsInfo:n,originalPath:t,path:s?n.replaced:t};i.isRecursive||(i.path=this.cleanNotRecursivePath(i.path));let a=this.getCleanListenersCollection(Object.assign(Object.assign({},i),{match:this.getListenerCollectionMatch(i.path,i.isRecursive,i.isWildcard)}));return this.id++,a.listeners.set(this.id,e),e.id=this.id,this.listeners.set(i.originalPath,a),a}subscribe(t,e,s=this.getDefaultListenerOptions(),n={all:[t],index:0,groupId:null}){if(this.destroyed)return()=>{};this.jobsRunning++;const i="subscribe";let a=this.getCleanListener(e,s);s.group&&(s.bulk=!0,typeof s.group=="string"?a.groupId=s.group:n.groupId&&(a.groupId=n.groupId)),this.listenersIgnoreCache.set(a,{truthy:[],falsy:[]});const o=this.getListenersCollection(t,a);s.debug&&console.log("[subscribe]",{listenerPath:t,options:s}),o.count++;let u=!0;if(a.groupId&&(typeof a.groupId=="string"?this.namedGroups.includes(a.groupId)?u=!1:this.namedGroups.push(a.groupId):typeof a.groupId=="number"&&(this.numberGroups.includes(a.groupId)?u=!1:this.numberGroups.push(a.groupId))),u){const c=this.cleanNotRecursivePath(o.path),l=this.split(c);if(!o.isWildcard)!this.isMuted(c)&&!this.isMuted(e)&&e(this.pathGet(l,this.data),{type:i,listener:a,listenersCollection:o,path:{listener:t,update:void 0,resolved:this.cleanNotRecursivePath(t)},params:this.getParams(o.paramsInfo,c),options:s});else{const d=this.scan.get(c);if(s.bulk){const p=[];for(const y in d)this.isMuted(y)||p.push({path:y,params:this.getParams(o.paramsInfo,y),value:d[y]});this.isMuted(e)||e(p,{type:i,listener:a,listenersCollection:o,path:{listener:t,update:void 0,resolved:void 0},options:s,params:void 0})}else for(const p in d)!this.isMuted(p)&&!this.isMuted(e)&&e(d[p],{type:i,listener:a,listenersCollection:o,path:{listener:t,update:void 0,resolved:this.cleanNotRecursivePath(p)},params:this.getParams(o.paramsInfo,p),options:s})}}return this.debugSubscribe(a,o,t),this.jobsRunning--,this.unsubscribe(t,this.id)}unsubscribe(t,e){const s=this.listeners,n=s.get(t);return function(){n.listeners.delete(e),n.count--,n.count===0&&s.delete(t)}}runQueuedListeners(){if(!this.destroyed&&this.subscribeQueue.length!==0)if(this.jobsRunning===0){this.queueRuns=0;const t=[...this.subscribeQueue];for(let e=0,s=t.length;e<s;e++)t[e]();this.subscribeQueue.length=0}else{if(this.queueRuns++,this.queueRuns>=this.options.maxQueueRuns)throw this.queueRuns=0,new Error("Maximal number of queue runs exhausted.");Promise.resolve().then(()=>this.runQueuedListeners()).catch(t=>{throw t})}}getQueueNotifyListeners(t,e=[]){for(const s in t){if(this.isMuted(s))continue;let{single:n,bulk:i}=t[s];for(const a of n){let o=!1,u=a.listener.id+":"+a.eventInfo.path.resolved;a.eventInfo.path.resolved||(u=a.listener.id+":"+a.eventInfo.path.listener);for(const l of e)if(u===l.resolvedIdPath){o=!0;break}if(o)continue;const c=this.debugTime(a);if(!this.isMuted(a.listener.fn))if(a.listener.options.queue&&this.jobsRunning)this.subscribeQueue.push(()=>{a.listener.fn(a.value?a.value():void 0,a.eventInfo)});else{let l=a.listener.id+":"+a.eventInfo.path.resolved;a.eventInfo.path.resolved||(l=a.listener.id+":"+a.eventInfo.path.listener),e.push({id:a.listener.id,resolvedPath:a.eventInfo.path.resolved,resolvedIdPath:l,originalFn:a.listener.fn,fn:()=>{a.listener.fn(a.value?a.value():void 0,a.eventInfo)},options:a.listener.options,groupId:a.listener.groupId})}this.debugListener(c,a)}for(const a of i){let o=!1;for(const l of e)if(l.id===a.listener.id){o=!0;break}if(o)continue;const u=this.debugTime(a),c=[];for(const l of a.value)c.push(Object.assign(Object.assign({},l),{value:l.value?l.value():void 0}));if(!this.isMuted(a.listener.fn))if(a.listener.options.queue&&this.jobsRunning)this.subscribeQueue.push(()=>this.jobsRunning?!1:(a.listener.fn(c,a.eventInfo),!0));else{let l=a.listener.id+":"+a.eventInfo.path.resolved;a.eventInfo.path.resolved||(l=a.listener.id+":"+a.eventInfo.path.listener),e.push({id:a.listener.id,resolvedPath:a.eventInfo.path.resolved,resolvedIdPath:l,originalFn:a.listener.fn,fn:()=>{a.listener.fn(c,a.eventInfo)},options:a.listener.options,groupId:a.listener.groupId})}this.debugListener(u,a)}}return Promise.resolve().then(()=>this.runQueuedListeners()),e}shouldIgnore(t,e){if(!t.options.ignore)return!1;for(const s of t.options.ignore){if(e.startsWith(s)||this.is_match&&this.is_match(s,e))return!0;{const n=this.cutPath(e,s);if(this.match(s,n))return!0}}return!1}getSubscribedListeners(t,e,s,n="update",i=null){s=Object.assign(Object.assign({},defaultUpdateOptions),s);const a={};for(let[o,u]of this.listeners)if(u.match(t)){a[o]={single:[],bulk:[],bulkData:[]};const c=u.paramsInfo?this.getParams(u.paramsInfo,t):void 0,l=this.cutPath(t,o),p=u.isRecursive||u.isWildcard?()=>this.get(l):()=>e,y=[{value:p,path:t,params:c}];for(const v of u.listeners.values()){if(this.shouldIgnore(v,t)){v.options.debug&&console.log("[getSubscribedListeners] Listener was not fired because it was ignored.",{listener:v,listenersCollection:u});continue}v.options.bulk?a[o].bulk.push({listener:v,listenersCollection:u,eventInfo:{type:n,listener:v,path:{listener:o,update:i||t,resolved:void 0},params:c,options:s},value:y}):a[o].single.push({listener:v,listenersCollection:u,eventInfo:{type:n,listener:v,path:{listener:o,update:i||t,resolved:this.cleanNotRecursivePath(t)},params:c,options:s},value:p})}}else if(this.options.extraDebug){let c=!1;for(const l of u.listeners.values())l.options.debug&&(c=!0,console.log("[getSubscribedListeners] Listener was not fired because there was no match.",{listener:l,listenersCollection:u,updatePath:t}));c&&u.match(t,!0)}return a}notifySubscribedListeners(t,e,s,n="update",i=null){return this.getQueueNotifyListeners(this.getSubscribedListeners(t,e,s,n,i))}useBulkValue(t){for(const[e,s]of t.listeners)if(s.options.bulk&&s.options.bulkValue||!s.options.bulk)return!0;return!1}getNestedListeners(t,e,s,n="update",i=null){const a={},o={};for(let[u,c]of this.listeners){if(!c.isRecursive)continue;const l=this.cutPath(u,t);if(this.match(l,t)){a[u]={single:[],bulk:[]};const d=this.trimPath(u.substr(l.length)),p=this.useBulkValue(c);let y;p&&(y=o[d]?o[d]:new WildcardObject(e,this.options.delimiter,this.options.wildcard).get(d),o[d]=y);const v=c.paramsInfo?this.getParams(c.paramsInfo,t):void 0,w=[],C={};for(const[O,A]of c.listeners)if(p)for(const $ in y){const f=()=>y[$],g=[t,$].join(this.options.delimiter),b={type:n,listener:A,listenersCollection:c,path:{listener:u,update:i||t,resolved:this.cleanNotRecursivePath(g)},params:v,options:s};this.shouldIgnore(A,t)||(A.options.bulk?(w.push({value:f,path:g,params:v}),C[O]=A):a[u].single.push({listener:A,listenersCollection:c,eventInfo:b,value:f}))}else{const $={type:n,listener:A,listenersCollection:c,path:{listener:u,update:i||t,resolved:void 0},params:v,options:s};if(this.shouldIgnore(A,t))continue;A.options.bulk?(w.push({value:void 0,path:void 0,params:v}),C[O]=A):a[u].single.push({listener:A,listenersCollection:c,eventInfo:$,value:void 0})}for(const O in C){const A=C[O],$={type:n,listener:A,listenersCollection:c,path:{listener:u,update:t,resolved:void 0},options:s,params:v};a[u].bulk.push({listener:A,listenersCollection:c,eventInfo:$,value:w})}}else if(this.options.extraDebug)for(const d of c.listeners.values())d.options.debug&&console.log("[getNestedListeners] Listener was not fired because there was no match.",{listener:d,listenersCollection:c,currentCutPath:l,updatePath:t})}return a}notifyNestedListeners(t,e,s,n="update",i,a=null){return this.getQueueNotifyListeners(this.getNestedListeners(t,e,s,n,a),i)}getNotifyOnlyListeners(t,e,s,n="update",i=null){const a={};if(typeof s.only!="object"||!Array.isArray(s.only)||typeof s.only[0]>"u"||!this.canBeNested(e))return a;for(const o of s.only){const u=new WildcardObject(e,this.options.delimiter,this.options.wildcard).get(o);a[o]={bulk:[],single:[]};for(const c in u){const l=t+this.options.delimiter+c;for(const[d,p]of this.listeners){const y=p.paramsInfo?this.getParams(p.paramsInfo,l):void 0;if(this.match(d,l)){const v=()=>u[c],w=[{value:v,path:l,params:y}];for(const C of p.listeners.values()){const O={type:n,listener:C,listenersCollection:p,path:{listener:d,update:i||t,resolved:this.cleanNotRecursivePath(l)},params:y,options:s};this.shouldIgnore(C,t)||(C.options.bulk?a[o].bulk.some(A=>A.listener===C)||a[o].bulk.push({listener:C,listenersCollection:p,eventInfo:O,value:w}):a[o].single.push({listener:C,listenersCollection:p,eventInfo:O,value:v}))}}}}}return a}runQueue(t){const e=[];for(const s of t)s.options.group?e.includes(s.groupId)||(s.fn(),e.push(s.groupId)):s.fn()}sortAndRunQueue(t,e){t.sort(function(s,n){return s.id-n.id}),this.options.debug&&console.log("[deep-state-observer] queue for ".concat(e),t),this.runQueue(t)}notifyOnly(t,e,s,n="update",i=""){const a=this.getQueueNotifyListeners(this.getNotifyOnlyListeners(t,e,s,n,i));this.sortAndRunQueue(a,t)}canBeNested(t){return typeof t=="object"&&t!==null}getUpdateValues(t,e){let s=e;return typeof e=="function"&&(s=e(t)),{newValue:s,oldValue:t}}wildcardNotify(t,e){let s=[];for(const n of t)this.getQueueNotifyListeners(n,s);for(const n of e)this.executeWaitingListeners(n);return this.jobsRunning--,s}wildcardUpdate(t,e,s=defaultUpdateOptions,n=!1){++this.jobsRunning,s=Object.assign(Object.assign({},defaultUpdateOptions),s);const i=this.scan.get(t),a={};for(const l in i){const d=this.split(l),{oldValue:p,newValue:y}=this.getUpdateValues(i[l],e);(!this.same(y,p)||s.force)&&(this.pathSet(d,y,this.data),a[l]=y)}const o=[],u=[];for(const l in a){const d=a[l];s.only.length?o.push(this.getNotifyOnlyListeners(l,d,s,"update",t)):(o.push(this.getSubscribedListeners(l,d,s,"update",t)),this.canBeNested(d)&&o.push(this.getNestedListeners(l,d,s,"update",t))),s.debug&&this.options.log("Wildcard update",{path:l,newValue:d}),u.push(l)}if(n){const l=this;return function(){const d=l.wildcardNotify(o,u);l.sortAndRunQueue(d,t)}}const c=this.wildcardNotify(o,u);this.sortAndRunQueue(c,t)}runUpdateQueue(){if(!this.destroyed)for(;this.updateQueue.length&&this.updateQueue.length<this.options.maxSimultaneousJobs;){const t=this.updateQueue.shift();t.options.queue=!1,this.update(t.updatePath,t.fnOrValue,t.options,t.multi)}}updateNotify(t,e,s){const n=this.notifySubscribedListeners(t,e,s);this.canBeNested(e)&&this.notifyNestedListeners(t,e,s,"update",n),this.sortAndRunQueue(n,t),this.executeWaitingListeners(t)}updateNotifyAll(t){let e=[];for(const s of t){const n=s.newValue;if(this.tracing.length){const i=this.tracing[this.tracing.length-1],a=this.traceMap.get(i);a.changed.push({traceId:i,updatePath:s.updatePath,fnOrValue:n,options:s.options}),this.traceMap.set(i,a)}e=e.concat(this.notifySubscribedListeners(s.updatePath,n,s.options)),this.canBeNested(s.newValue)&&this.notifyNestedListeners(s.updatePath,n,s.options,"update",e)}this.runQueue(e)}updateNotifyOnly(t,e,s){this.notifyOnly(t,e,s),this.executeWaitingListeners(t)}update(t,e,s=Object.assign({},defaultUpdateOptions),n=!1){if(this.destroyed)return;if(this.collection)return this.collection.update(t,e,s);if(this.tracing.length){const l=this.tracing[this.tracing.length-1],d=this.traceMap.get(l);d.changed.push({traceId:l,updatePath:t,fnOrValue:e,options:s}),this.traceMap.set(l,d)}const i=this.jobsRunning;if((this.options.queue||s.queue)&&i){if(i>this.options.maxSimultaneousJobs)throw new Error("Maximal simultaneous jobs limit reached.");this.updateQueue.push({updatePath:t,fnOrValue:e,options:s,multi:n});const l=Promise.resolve().then(()=>{this.runUpdateQueue()});return n?function(){return l}:l}if(this.isWildcard(t))return this.wildcardUpdate(t,e,s,n);++this.jobsRunning;const a=this.split(t),o=this.pathGet(a,this.data);let{oldValue:u,newValue:c}=this.getUpdateValues(o,e);if(s.debug&&this.options.log("Updating ".concat(t," ").concat(s.source?"from ".concat(s.source):""),{oldValue:u,newValue:c}),this.same(c,u)&&!s.force)return--this.jobsRunning,n?function(){return c}:c;if(this.pathSet(a,c,this.data),s=Object.assign(Object.assign({},defaultUpdateOptions),s),s.only===null)return--this.jobsRunning,n?function(){}:c;if(s.only.length){if(--this.jobsRunning,n){const l=this;return function(){return l.updateNotifyOnly(t,c,s)}}return this.updateNotifyOnly(t,c,s),c}if(n){--this.jobsRunning;const l=this;return function(){return l.updateNotify(t,c,s)}}return this.updateNotify(t,c,s),--this.jobsRunning,c}multi(t=!1){if(this.destroyed)return{update(){return this},done(){},getStack(){return[]}};if(this.collection)return this.collection;const e=this,s=[],n=[];return{update(a,o,u=defaultUpdateOptions){if(t){const c=e.split(a);let l=o;const d=e.pathGet(c,e.data);typeof l=="function"&&(l=l(d)),e.pathSet(c,l,e.data),s.push({updatePath:a,newValue:l,options:u})}else n.push(e.update(a,o,u,!0));return this},done(){if(e.collections===0){if(t)e.updateNotifyAll(s);else for(const a of n)a();s.length=0}},getStack(){return s}}}collect(){return this.collections++,this.collection||(this.collection=this.multi(!0)),this.collection}executeCollected(){if(this.collections--,this.collections===0&&this.collection){const t=this.collection;this.collection=null,t.done()}}getCollectedCount(){return this.collections}getCollectedStack(){return this.collection?this.collection.getStack():[]}get(t=void 0){if(!this.destroyed)return t===void 0||t===""?this.data:this.isWildcard(t)?this.scan.get(t):this.pathGet(this.split(t),this.data)}last(t){let e=this.lastExecs.get(t);e||(e={calls:0},this.lastExecs.set(t,e));const s=++e.calls;this.resolved.then(()=>{s===e.calls&&(this.lastExecs.set(t,{calls:0}),t())})}isMuted(t){if(!this.options.useMute)return!1;if(typeof t=="function")return this.isMutedListener(t);for(const e of this.muted){const s=!this.isNotRecursive(e),n=this.trimPath(e);if(this.match(t,n)||this.match(n,t))return!0;if(s){const i=this.cutPath(n,t);if(this.match(i,e)||this.match(e,i))return!0}}return!1}isMutedListener(t){return this.mutedListeners.has(t)}mute(t){if(typeof t=="function")return this.mutedListeners.add(t);this.muted.add(t)}unmute(t){if(typeof t=="function")return this.mutedListeners.delete(t);this.muted.delete(t)}debugSubscribe(t,e,s){t.options.debug&&this.options.log("listener subscribed",{listenerPath:s,listener:t,listenersCollection:e})}debugListener(t,e){(e.eventInfo.options.debug||e.listener.options.debug)&&this.options.log("Listener fired",{time:Date.now()-t,info:e})}debugTime(t){return t.listener.options.debug||t.eventInfo.options.debug?Date.now():0}startTrace(t,e=null){this.traceId++;const s=this.traceId+":"+t;return this.traceMap.set(s,{id:s,sort:this.traceId,stack:this.tracing.map(n=>n),additionalData:e,changed:[]}),this.tracing.push(s),s}stopTrace(t){const e=this.traceMap.get(t);return this.tracing.pop(),this.traceMap.delete(t),e}saveTrace(t){const e=this.traceMap.get(t);return this.tracing.pop(),this.traceMap.delete(t),this.savedTrace.push(e),e}getSavedTraces(){const t=this.savedTrace.map(e=>e);return t.sort((e,s)=>e.sort-s.sort),this.savedTrace=[],t}}class ObservedData{}class SimpleObservedData extends ObservedData{constructor(e){super();m(this,"data",{});m(this,"event",new eventsExports.EventEmitter);this.data=e}update(e,s){s?setValueByKeyPath(s,e,this.data):this.data=e;const n={updateData:e,path:s!=null?s:""};s&&this.event.emit(s,n),this.event.emit("",n)}on(e,s){this.event.on(e,s)}off(e,s){this.event.off(e,s)}getData(e){return e?getValueByKeyPath(e,this.data):this.data}destroy(){}}var W,U,F,P,N,k;class DataSource extends EventEmitter$1{constructor(e){var i,a,o;super();m(this,"isInit",!1);m(this,"app");m(this,"mockData");x(this,W,"base");x(this,U);x(this,F);x(this,P);x(this,N,[]);x(this,k,[]);j(this,U,e.schema.id),j(this,F,e.schema),this.app=e.app,this.setFields(e.schema.fields),this.setMethods(e.schema.methods||[]);let s=e.initialData;const n=e.ObservedDataClass||SimpleObservedData;if(this.app.platform==="editor"){const u=cloneDeep(e.schema.mocks||[]);this.mockData=((i=u.find(c=>c.useInEditor))==null?void 0:i.data)||this.getDefaultData(),s=cloneDeep(this.mockData)}else if(typeof e.useMock=="boolean"&&e.useMock){const u=cloneDeep(e.schema.mocks||[]);this.mockData=(a=u.find(c=>c.enable))==null?void 0:a.data,s=cloneDeep(this.mockData)||this.getDefaultData()}else if(!e.initialData)s=this.getDefaultData();else{j(this,P,new n((o=e.initialData)!=null?o:{})),this.isInit=!0;return}j(this,P,new n(s!=null?s:{}))}get id(){return R(this,U)}get type(){return R(this,W)}get schema(){return R(this,F)}get fields(){return R(this,N)}get methods(){return R(this,k)}setFields(e){j(this,N,e)}setMethods(e){j(this,k,e)}get data(){return R(this,P).getData("")}setData(e,s){R(this,P).update(e,s);const n={updateData:e,path:s};this.emit("change",n)}setValue(e,s){return this.setData(s,e)}onDataChange(e,s){R(this,P).on(e,s)}offDataChange(e,s){R(this,P).off(e,s)}getDefaultData(){return getDefaultValueFromFields(R(this,N))}async init(){this.isInit=!0}destroy(){j(this,N,[]),this.removeAllListeners(),R(this,P).destroy()}}W=new WeakMap,U=new WeakMap,F=new WeakMap,P=new WeakMap,N=new WeakMap,k=new WeakMap;const urlencoded=r=>Object.entries(r).reduce((t,[e,s])=>{let n=s;return typeof s=="object"&&(n=JSON.stringify(s)),typeof s<"u"?"".concat(t).concat(t?"&":"").concat(globalThis.encodeURIComponent(e),"=").concat(globalThis.encodeURIComponent("".concat(n))):t},""),webRequest=async r=>{var l;const{url:t,method:e="GET",headers:s={},params:n={},data:i={},...a}=r,o=urlencoded(n);let u=JSON.stringify(i);return(l=s["Content-Type"])!=null&&l.includes("application/x-www-form-urlencoded")&&(u=urlencoded(i)),(await globalThis.fetch(o?"".concat(t,"?").concat(o):t,{method:e,headers:s,body:e==="GET"?void 0:u,...a})).json()};var M,H,B,V;class HttpDataSource extends DataSource{constructor(e){const{options:s}=e.schema;super(e);m(this,"isLoading",!1);m(this,"error");m(this,"httpOptions");x(this,M);x(this,H,[]);x(this,B,[]);x(this,V,"http");this.httpOptions=s,typeof e.request=="function"?j(this,M,e.request):typeof globalThis.fetch=="function"&&j(this,M,webRequest),this.methods.forEach(n=>{typeof n.content=="function"&&(n.timing==="beforeRequest"&&R(this,H).push(n.content),n.timing==="afterRequest"&&R(this,B).push(n.content))})}get type(){return R(this,V)}async init(){this.schema.autoFetch&&await this.request(),super.init()}async request(e={}){var c,l;this.isLoading=!0;const{url:s,params:n,data:i,headers:a,...o}=this.httpOptions;let u={url:typeof s=="function"?s({app:this.app,dataSource:this}):s,params:typeof n=="function"?n({app:this.app,dataSource:this}):n,data:typeof i=="function"?i({app:this.app,dataSource:this}):i,headers:typeof a=="function"?a({app:this.app,dataSource:this}):a,...o,...e};try{for(const d of R(this,H))await d({options:u,params:{},dataSource:this,app:this.app});if(typeof this.schema.beforeRequest=="function"&&(u=await this.schema.beforeRequest(u,{app:this.app,dataSource:this})),this.mockData)this.setData(this.mockData);else{let d=await((c=R(this,M))==null?void 0:c.call(this,u));for(const p of R(this,B))await p({res:d,options:u,params:{},dataSource:this,app:this.app});if(typeof this.schema.afterResponse=="function"&&(d=await this.schema.afterResponse(d,{app:this.app,dataSource:this,options:u})),(l=this.schema.responseOptions)!=null&&l.dataPath){const p=getValueByKeyPath(this.schema.responseOptions.dataPath,d);this.setData(p)}else this.setData(d)}this.error=void 0}catch(d){this.error={msg:d.message},this.emit("error",d)}this.isLoading=!1}get(e){return this.request({...e,method:"GET"})}post(e){return this.request({...e,method:"POST"})}}M=new WeakMap,H=new WeakMap,B=new WeakMap,V=new WeakMap;const cache=new Map,getDeps=(r,t,e)=>{let s;if(e){const u=[];t.forEach(c=>{traverseNode(c,l=>{u.push(l.id)})}),s="".concat(r.id,":").concat(u.join(":"))}else s="".concat(r.id,":").concat(t.map(u=>u.id).join(":"));if(cache.has(s))return cache.get(s);const n=new Watcher;n.addTarget(new Target({id:r.id,type:"data-source",isTarget:(u,c)=>"".concat(u).includes(DSL_NODE_KEY_COPY_PREFIX)?!1:isDataSourceTarget(r,u,c,!0)})),n.addTarget(new Target({id:r.id,type:"cond",isTarget:(u,c)=>isDataSourceCondTarget(r,u,c,!0)})),n.collect(t,{},!0);const{deps:i}=n.getTarget(r.id,"data-source"),{deps:a}=n.getTarget(r.id,"cond"),o={deps:i,condDeps:a};return cache.set(s,o),o},compiledCondition=(r,t)=>{let e=!0;for(const{op:s,value:n,range:i,field:a}of r){const[o,...u]=a,c=t[o];if(!c||!u.length)break;try{const l=getValueByKeyPath(u.join("."),c);if(!compiledCond(s,l,n,i)){e=!1;break}}catch(l){console.warn(l)}}return e},compliedConditions=(r,t)=>{if(!r[NODE_CONDS_KEY]||!Array.isArray(r[NODE_CONDS_KEY])||!r[NODE_CONDS_KEY].length)return!0;for(const{cond:e}of r[NODE_CONDS_KEY])if(e&&compiledCondition(e,t))return!0;return!1},updateNode=(r,t)=>{var e;if(isPage(r)||isPageFragment(r)){const s=(e=t.items)==null?void 0:e.findIndex(n=>n.id===r.id);t.items.splice(s,1,r)}else replaceChildNode(r,t.items)},createIteratorContentData=(r,t,e=[],s={})=>{const n={...s,[t]:{}};let i=cloneDeep(s[t]),a=n[t];return e.forEach((o,u)=>{if(Object.assign(a,i),u===e.length-1){a[o]=r;return}Array.isArray(i[o])&&(i[o]={},a[o]={}),i=i[o],a=a[o]}),n},compliedDataSourceField=(r,t)=>{const[e,...s]=r,n=e.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);if(n>-1){const i=e.substring(n+DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length),a=t[i];if(!a)return r;try{return getValueByKeyPath(s.join("."),a)}catch(o){return r}}return r},template=(r,t)=>r.replaceAll(dataSourceTemplateRegExp,(e,s)=>{try{return getValueByKeyPath(s,t)}catch(n){return e}}),compiledNodeField=(r,t)=>typeof r=="string"?template(r,t):r!=null&&r.isBindDataSource&&r.dataSourceId?t[r.dataSourceId]:r!=null&&r.isBindDataSourceField&&r.dataSourceId&&typeof r.template=="string"?template(r.template,t[r.dataSourceId]):Array.isArray(r)&&typeof r[0]=="string"?compliedDataSourceField(r,t):r,compliedIteratorItem=({compile:r,dsId:t,item:e,deps:s,condDeps:n,inEditor:i,ctxData:a})=>{var l,d;const{items:o,...u}=e,c=cloneDeep(u);return(l=n[u.id])!=null&&l.keys.length&&!i&&(c.condResult=compliedConditions(u,a)),Array.isArray(o)&&o.length?c.items=o.map(p=>compliedIteratorItem({compile:r,dsId:t,item:p,deps:s,condDeps:n,inEditor:i,ctxData:a})):o&&(c.items=o),(d=s[c.id])!=null&&d.keys.length?compiledNode(r,c,{[t]:s},t):c},registerDataSourceOnDemand=async(r,t)=>{const{dataSourceMethodsDeps:e={},dataSourceCondDeps:s={},dataSourceDeps:n={},dataSources:i=[]}=r,a={};i.forEach(c=>{let l=s[c.id]||{};Object.keys(l).length||(l=n[c.id]||{}),Object.keys(l).length||(l=e[c.id]||{}),Object.keys(l).length&&t[c.type]&&(a[c.type]=t[c.type])});const o=await Promise.all(Object.values(a).map(c=>c())),u={};return o.forEach((c,l)=>{const d=Object.keys(a)[l];u[d]=c.default}),u},I=class I extends EventEmitter$1{constructor({app:e,useMock:s,initialData:n}){var i,a;super();m(this,"app");m(this,"dataSourceMap",new Map);m(this,"data",{});m(this,"initialData",{});m(this,"useMock",!1);I.waitInitSchemaList.set(this,{}),this.app=e,this.useMock=s,n&&(this.initialData=n,this.data={...n}),(a=(i=e.dsl)==null?void 0:i.dataSources)==null||a.forEach(o=>{this.addDataSource(o)}),this.isAllDataSourceRegistered()?this.callDsInit():this.on("registered-all",()=>{this.callDsInit()})}static register(e,s){var n;I.dataSourceClassMap.set(e,s),(n=I.waitInitSchemaList)==null||n.forEach((i,a)=>{const o=i[e]||[];for(let u=o.shift();u;u=o.shift()){const c=a.addDataSource(u);c&&a.init(c)}})}static getDataSourceClass(e){return I.dataSourceClassMap.get(e)}static clearDataSourceClass(){I.dataSourceClassMap.clear(),I.dataSourceClassMap.set("base",DataSource),I.dataSourceClassMap.set("http",HttpDataSource)}static registerObservedData(e){I.ObservedDataClass=e}async init(e){var s;if(!e.isInit&&!(this.app.jsEngine&&((s=e.schema.disabledInitInJsEngine)!=null&&s.includes(this.app.jsEngine)))){for(const n of e.methods){if(typeof n.content!="function")return;n.timing==="beforeInit"&&await n.content({params:{},dataSource:e,app:this.app})}await e.init();for(const n of e.methods){if(typeof n.content!="function")return;n.timing==="afterInit"&&await n.content({params:{},dataSource:e,app:this.app})}}}get(e){return this.dataSourceMap.get(e)}addDataSource(e){var i;if(!e)return;const s=I.dataSourceClassMap.get(e.type);if(!s){let a=I.waitInitSchemaList.get(this);a||(a={},I.waitInitSchemaList.set(this,a)),a[e.type]?a[e.type].push(e):a[e.type]=[e],this.data[e.id]=(i=this.initialData[e.id])!=null?i:getDefaultValueFromFields(e.fields);return}const n=new s({app:this.app,schema:e,request:this.app.request,useMock:this.useMock,initialData:this.initialData[e.id],ObservedDataClass:I.ObservedDataClass});return this.dataSourceMap.set(e.id,n),this.data[n.id]=n.data,n.on("change",a=>{this.setData(n,a)}),this.isAllDataSourceRegistered()&&this.emit("registered-all"),n}setData(e,s){this.data[e.id]=e.data,this.emit("change",e.id,s)}removeDataSource(e){var s;(s=this.get(e))==null||s.destroy(),delete this.data[e],this.dataSourceMap.delete(e)}updateSchema(e){for(const s of e){if(!this.get(s.id))return;this.removeDataSource(s.id)}for(const s of e){this.addDataSource(cloneDeep(s));const n=this.get(s.id);n&&this.init(n)}}compiledNode({items:e,...s},n,i=!1){var o;const a=cloneDeep(s);return e&&(a.items=Array.isArray(e)&&i?e.map(u=>this.compiledNode(u,n,i)):e),s.condResult===!1||s.visible===!1?a:compiledNode(u=>compiledNodeField(u,this.data),a,((o=this.app.dsl)==null?void 0:o.dataSourceDeps)||{},n)}compliedConds(e){return compliedConditions(e,this.data)}compliedIteratorItemConds(e,s,n=[]){const[i,...a]=n,o=this.get(i);if(!o)return!0;const u=createIteratorContentData(e,o.id,a,this.data);return compliedConditions(s,u)}compliedIteratorItems(e,s,n=[]){const[i,...a]=n,o=this.get(i);if(!o)return s;const u=this.app.platform==="editor",c=createIteratorContentData(e,o.id,a,this.data),{deps:l={},condDeps:d={}}=getDeps(o.schema,s,u);return!Object.keys(l).length&&!Object.keys(d).length?s:s.map(p=>compliedIteratorItem({compile:y=>compiledNodeField(y,c),dsId:o.id,item:p,deps:l,condDeps:d,inEditor:u,ctxData:c}))}isAllDataSourceRegistered(){var e,s;return!((s=(e=this.app.dsl)==null?void 0:e.dataSources)!=null&&s.length)||this.dataSourceMap.size===this.app.dsl.dataSources.length}destroy(){this.removeAllListeners(),this.data={},this.initialData={},this.dataSourceMap.forEach(e=>{e.destroy()}),this.dataSourceMap.clear(),I.waitInitSchemaList.delete(this)}onDataChange(e,s,n){var i;return(i=this.get(e))==null?void 0:i.onDataChange(s,n)}offDataChange(e,s,n){var i;return(i=this.get(e))==null?void 0:i.offDataChange(s,n)}callDsInit(){const e=Array.from(this.dataSourceMap);typeof Promise.allSettled=="function"?Promise.allSettled(e.map(([,s])=>this.init(s))).then(s=>{const n={},i={};s.forEach((a,o)=>{const u=e[o][0];a.status==="fulfilled"?this.data[u]?n[u]=this.data[u]:delete n[u]:a.status==="rejected"&&(delete n[u],i[u]=a.reason)}),this.emit("init",n,i)}):Promise.all(e.map(([,s])=>this.init(s))).then(()=>{this.emit("init",this.data)}).catch(()=>{this.emit("init",this.data)})}};m(I,"dataSourceClassMap",new Map([["base",DataSource],["http",HttpDataSource]])),m(I,"ObservedDataClass",SimpleObservedData),m(I,"waitInitSchemaList",new Map);let DataSourceManager=I;const createDataSourceManager=(r,t,e)=>{const{dsl:s,platform:n}=r;if(!(s!=null&&s.dataSources))return;const i=new DataSourceManager({app:r,useMock:t,initialData:e});return s.dataSources&&s.dataSourceCondDeps&&n!=="editor"&&getNodes(getDepNodeIds(s.dataSourceCondDeps),s.items).forEach(a=>{a.condResult=i.compliedConds(a),updateNode(a,s)}),s.dataSources&&s.dataSourceDeps&&getNodes(getDepNodeIds(s.dataSourceDeps),s.items).forEach(a=>{updateNode(i.compiledNode(a),s)}),r.jsEngine!=="nodejs"&&i.on("change",(a,o)=>{var p,y,v;const u=((p=s.dataSourceDeps)==null?void 0:p[a])||{},c=((y=s.dataSourceCondDeps)==null?void 0:y[a])||{},l=union([...Object.keys(c),...Object.keys(u)]),d=(v=r.page)!=null&&v.data&&r.platform!=="editor"?[r.page.data]:s.items;i.emit("update-data",getNodes(l,d).map(w=>{var O;r.platform!=="editor"&&(w.condResult=i.compliedConds(w));const C=i.compiledNode(w);if(typeof((O=r.page)==null?void 0:O.setData)=="function")if(isPage(C))r.page.setData(C);else{const A=r.page.getNode(w.id);A==null||A.setData(C)}return C}),a,o)}),i},ignoreFirstCall=r=>{let t=0;return(...e)=>{if(t===0){t+=1;return}return r(...e)}};class DeepObservedData extends ObservedData{constructor(e){super();m(this,"state");m(this,"subscribers",new Map);m(this,"update",(e,s)=>{var n;(n=this.state)==null||n.update(s!=null?s:"",e)});m(this,"on",(e,s)=>{var a;const n=this.state.subscribe(e,ignoreFirstCall(s)),i=(a=this.subscribers.get(e))!=null?a:new Map;i.set(s,n),this.subscribers.set(e,i)});m(this,"off",(e,s)=>{var i;const n=this.subscribers.get(e);n&&((i=n.get(s))==null||i(),n.delete(s))});m(this,"getData",e=>{var s;return this.state?(s=this.state)==null?void 0:s.get(e):{}});m(this,"destroy",()=>{this.subscribers.forEach(e=>{e.forEach(s=>s())})});this.state=new DeepState(e)}}var NodeType=(r=>(r.CONTAINER="container",r.PAGE="page",r.ROOT="app",r.PAGE_FRAGMENT="page-fragment",r))(NodeType||{});const NODE_CONDS_KEY="displayConds";var ActionType=(r=>(r.COMP="comp",r.CODE="code",r.DATA_SOURCE="data-source",r))(ActionType||{}),HookType=(r=>(r.CODE="code",r))(HookType||{}),HookCodeType=(r=>(r.CODE="code",r.DATA_SOURCE_METHOD="data-source-method",r))(HookCodeType||{});const toLine=(r="")=>r.replace(/\B([A-Z])/g,"-$1").toLowerCase(),getNodePath=(r,t=[])=>{const e=[],s=function(n,i){if(!Array.isArray(i))return null;for(let a=0,o=i.length;a<o;a++){const u=i[a];if(e.push(u),"".concat(u.id)==="".concat(n))return u;if(u.items){const c=s(n,u.items);if(c)return c}e.pop()}return null};return s(r,t),e},filterXSS=r=>r.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),getUrlParam=(r,t)=>{const e=location.href,s=new RegExp("[?&#]".concat(r,"=([^&#]+)"),"gi"),n=e.match(s);let i;return n&&n.length>0?(i=n[n.length-1].split("="),i&&i.length>1?filterXSS(i[1]):""):""},isObject=r=>Object.prototype.toString.call(r)==="[object Object]",isPage=r=>{var t;return r?((t=r.type)==null?void 0:t.toLowerCase())===NodeType.PAGE:!1},isPageFragment=r=>{var t;return r?((t=r.type)==null?void 0:t.toLowerCase())===NodeType.PAGE_FRAGMENT:!1},isNumber=r=>/^(-?\d+)(\.\d+)?$/.test(r),getKeysArray=r=>"".concat(r).replaceAll(/\[(\d+)\]/g,".$1").split("."),getValueByKeyPath=(r="",t={})=>(Array.isArray(r)?r:getKeysArray(r)).reduce((s,n)=>{if(isObject(s)||Array.isArray(s)&&/^\d*$/.test("".concat(n)))return s[n];throw new Error("".concat(t,"中不存在").concat(r))},t),setValueByKeyPath=(r,t,e={})=>set(e,r,t),getNodes=(r,t=[])=>{const e=[],s=function(n,i){if(Array.isArray(i))for(let a=0,o=i.length;a<o;a++){const u=i[a],c=n.findIndex(l=>"".concat(l)==="".concat(u.id));c>-1&&(n.slice(c,1),e.push(u)),u.items&&s(n,u.items)}};return s(r,t),e},getDepKeys=(r={},t)=>Array.from(Object.values(r).reduce((e,s)=>{var n;return(((n=s[t])==null?void 0:n.keys)||[]).forEach(i=>e.add(i)),e},new Set)),getDepNodeIds=(r={})=>Array.from(Object.values(r).reduce((t,e)=>(Object.keys(e).forEach(s=>{t.add(s)}),t),new Set)),replaceChildNode=(r,t,e)=>{var o;const s=getNodePath(r.id,t),n=s.pop();let i=s.pop();if(!n)throw new Error("未找到目标节点");if(!i)throw new Error("未找到父节点");const a=(o=i.items)==null?void 0:o.findIndex(u=>u.id===n.id);i.items.splice(a,1,r)},DSL_NODE_KEY_COPY_PREFIX="__tmagic__",compiledNode=(r,t,e={},s)=>{let n=[];if(!s)n=getDepKeys(e,t.id);else{const i=e[s];n=(i==null?void 0:i[t.id].keys)||[]}return n.forEach(i=>{const a=getKeysArray(i),o=a.map((l,d)=>d<a.length-1?l:"".concat(DSL_NODE_KEY_COPY_PREFIX).concat(l));let u=getValueByKeyPath(o,t);if(typeof u>"u")try{const l=getValueByKeyPath(i,t);setValueByKeyPath(o.join("."),l,t),u=l}catch(l){console.warn(l);return}let c;try{c=r(u)}catch(l){console.error(l),c=""}setValueByKeyPath(i,c,t)}),t},compiledCond=(r,t,e,s=[])=>{var n,i;switch(typeof t=="string"&&typeof e>"u"&&(e=""),r){case"is":return t===e;case"not":return t!==e;case"=":return t===e;case"!=":return t!==e;case">":return t>e;case">=":return t>=e;case"<":return t<e;case"<=":return t<=e;case"between":return s.length>1&&t>=s[0]&&t<=s[1];case"not_between":return s.length<2||t<s[0]||t>s[1];case"include":return(n=t==null?void 0:t.includes)==null?void 0:n.call(t,e);case"not_include":return typeof t>"u"||!((i=t.includes)!=null&&i.call(t,e))}return!1},getDefaultValueFromFields=r=>{const t={},e={string:void 0,object:{},array:[],boolean:void 0,number:void 0,null:null,any:void 0};return r.forEach(s=>{if(typeof s.defaultValue<"u"){if(s.type==="array"&&!Array.isArray(s.defaultValue)){t[s.name]=e.array;return}if(s.type==="object"&&!isObject(s.defaultValue)){if(typeof s.defaultValue=="string"){try{t[s.name]=JSON.parse(s.defaultValue)}catch(n){t[s.name]=e.object,console.warn("defaultValue 解析失败",s.defaultValue,n)}return}t[s.name]=e.object;return}t[s.name]=cloneDeep(s.defaultValue);return}if(s.type==="object"){t[s.name]=s.fields?getDefaultValueFromFields(s.fields):e.object;return}if(s.type){t[s.name]=e[s.type];return}t[s.name]=void 0}),t},DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX="ds-field::",DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX="ds-field-changed",dataSourceTemplateRegExp=/\$\{([\s\S]+?)\}/g,traverseNode=(r,t,e=[],s=!1)=>{s||t(r,e),Array.isArray(r.items)&&r.items.length&&(e.push(r),r.items.forEach(n=>{traverseNode(n,t,[...e],s)})),s&&t(r,e)};var DepTargetType=(r=>(r.DEFAULT="default",r.CODE_BLOCK="code-block",r.DATA_SOURCE="data-source",r.DATA_SOURCE_METHOD="data-source-method",r.DATA_SOURCE_COND="data-source-cond",r))(DepTargetType||{});class Target{constructor(t){m(this,"isTarget");m(this,"id");m(this,"name");m(this,"type",DepTargetType.DEFAULT);m(this,"deps",{});m(this,"isCollectByDefault");var e;this.isTarget=t.isTarget,this.id=t.id,this.name=t.name,this.isCollectByDefault=(e=t.isCollectByDefault)!=null?e:!0,t.type&&(this.type=t.type),t.initialDeps&&(this.deps=t.initialDeps)}updateDep({id:t,name:e,key:s,data:n}){const i=this.deps[t]||{name:e,keys:[]};i.name=e,i.data=n,this.deps[t]=i,i.keys.indexOf(s)===-1&&i.keys.push(s)}removeDep(t,e){if(typeof t>"u"){Object.keys(this.deps).forEach(n=>{delete this.deps[n]});return}const s=this.deps[t];if(s)if(e){const n=s.keys.indexOf(e);s.keys.splice(n,1),s.keys.length===0&&delete this.deps[t]}else delete this.deps[t]}hasDep(t,e){const s=this.deps[t];return!!(s!=null&&s.keys.find(n=>n===e))}destroy(){this.deps={}}}const isIncludeArrayField=(r,t)=>{let e=t;return r.some((s,n)=>{const i=e.find(({name:a})=>a===s);return e=(i==null?void 0:i.fields)||[],i&&i.type==="array"&&/^(?!\d+$).*$/.test("".concat(r[n+1]))&&n<r.length-1})},isDataSourceTemplate=(r,t,e=!1)=>{const s=r.match(dataSourceTemplateRegExp)||[];if(s.length<=0)return!1;const n=[],i=[];return s.forEach(a=>{const o=a.substring(2,a.length-1),u=getKeysArray(o),c=u.shift();!c||c!==t.id||(isIncludeArrayField(u,t.fields)?n.push(a):i.push(a))}),e?n.length>0:i.length>0},isSpecificDataSourceTemplate=(r,t)=>(r==null?void 0:r.isBindDataSourceField)&&r.dataSourceId&&r.dataSourceId===t&&typeof r.template=="string",isUseDataSourceField=(r,t)=>{if(!Array.isArray(r)||typeof r[0]!="string")return!1;const[e]=r,s=e.indexOf(DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX);return s===-1?!1:e.substring(s+DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX.length)===t},isDataSourceTarget=(r,t,e,s=!1)=>{if(!e||!["string","object"].includes(typeof e)||"".concat(t).startsWith(NODE_CONDS_KEY))return!1;if(typeof e=="string")return isDataSourceTemplate(e,r,s);if(isObject(e)&&(e!=null&&e.isBindDataSource)&&e.dataSourceId&&e.dataSourceId===r.id||isSpecificDataSourceTemplate(e,r.id))return!0;if(isUseDataSourceField(e,r.id)){const[,...n]=e,i=isIncludeArrayField(n,r.fields);return s?i:!i}return!1},isDataSourceCondTarget=(r,t,e,s=!1)=>{var a;if(!Array.isArray(e)||!r)return!1;const[n,...i]=e;if(n!==r.id||!"".concat(t).startsWith(NODE_CONDS_KEY))return!1;if((a=r.fields)!=null&&a.find(o=>o.name===i[0])){const o=isIncludeArrayField(i,r.fields);return s?o:!o}return!1},traverseTarget=(r,t,e)=>{for(const s of Object.values(r))for(const n of Object.values(s))e&&n.type!==e||t(n)};class Watcher{constructor(t){m(this,"targetsList",{});m(this,"childrenProp","items");m(this,"idProp","id");m(this,"nameProp","name");t!=null&&t.initialTargets&&(this.targetsList=t.initialTargets),t!=null&&t.childrenProp&&(this.childrenProp=t.childrenProp)}getTargetsList(){return this.targetsList}getTargets(t=DepTargetType.DEFAULT){return this.targetsList[t]||{}}addTarget(t){const e=this.getTargets(t.type)||{};this.targetsList[t.type]=e,e[t.id]=t}getTarget(t,e=DepTargetType.DEFAULT){return this.getTargets(e)[t]}hasTarget(t,e=DepTargetType.DEFAULT){return!!this.getTarget(t,e)}hasSpecifiedTypeTarget(t=DepTargetType.DEFAULT){return Object.keys(this.getTargets(t)).length>0}removeTarget(t,e=DepTargetType.DEFAULT){const s=this.getTargets(e);s[t]&&(s[t].destroy(),delete s[t])}removeTargets(t=DepTargetType.DEFAULT){const e=this.targetsList[t];if(e){for(const s of Object.values(e))s.destroy();delete this.targetsList[t]}}clearTargets(){for(const t of Object.keys(this.targetsList))delete this.targetsList[t]}collect(t,e={},s=!1,n){this.collectByCallback(t,n,({node:i,target:a})=>{this.removeTargetDep(a,i),this.collectItem(i,a,e,s)})}collectByCallback(t,e,s){traverseTarget(this.targetsList,n=>{if(!(!e&&!n.isCollectByDefault))for(const i of t)s({node:i,target:n})},e)}clear(t,e){let{targetsList:s}=this;e&&(s={[e]:this.getTargets(e)});const n=[];traverseTarget(s,i=>{if(t)for(const a of t)i.removeDep(a[this.idProp]),Array.isArray(a[this.childrenProp])&&a[this.childrenProp].length&&!n.includes(a[this.idProp])&&(n.push(a[this.idProp]),this.clear(a[this.childrenProp]));else i.removeDep()})}clearByType(t,e){this.clear(e,t)}collectItem(t,e,s={},n=!1){const i=(a,o="")=>{const u=(c,l)=>{const d=c===this.childrenProp,p=o?"".concat(o,".").concat(c):c;if(e.isTarget(p,l))e.updateDep({id:t[this.idProp],name:"".concat(t[this.nameProp]||t[this.idProp]),data:s,key:p});else if(!d&&Array.isArray(l))for(let y=0,v=l.length;y<v;y++){const w=l[y];isObject(w)&&i(w,"".concat(p,"[").concat(y,"]"))}else isObject(l)&&i(l,p);if(d&&n&&Array.isArray(l))for(const y of l)this.collectItem(y,e,s,n)};for(const[c,l]of Object.entries(a))typeof l>"u"||l===""||u(c,l)};i(t)}removeTargetDep(t,e,s){if(t.removeDep(e[this.idProp],s),typeof s>"u"&&Array.isArray(e[this.childrenProp])&&e[this.childrenProp].length)for(const n of e[this.childrenProp])this.removeTargetDep(t,n,s)}}class Env{constructor(t=(n=>(n=(s=>(s=globalThis.navigator)==null?void 0:s.userAgent)())!=null?n:"")(),e={}){m(this,"isIos",!1);m(this,"isIphone",!1);m(this,"isIpad",!1);m(this,"isAndroid",!1);m(this,"isAndroidPad",!1);m(this,"isMac",!1);m(this,"isWin",!1);m(this,"isMqq",!1);m(this,"isWechat",!1);m(this,"isWeb",!1);m(this,"isOpenHarmony",!1);t&&(this.isIphone=t.indexOf("iPhone")>=0,this.isIpad=/(iPad).*OS\s([\d_]+)/.test(t),this.isIos=this.isIphone||this.isIpad,this.isAndroid=t.indexOf("Android")>=0,this.isAndroidPad=this.isAndroid&&t.indexOf("Mobile")<0,this.isMac=t.indexOf("Macintosh")>=0,this.isWin=t.indexOf("Windows")>=0,this.isMqq=/QQ\/([\d.]+)/.test(t),this.isWechat=t.indexOf("MicroMessenger")>=0&&t.indexOf("wxwork")<0,this.isOpenHarmony=t.includes("OpenHarmony"),this.isWeb=!this.isIos&&!this.isAndroid&&!this.isOpenHarmony&&!/(WebOS|BlackBerry)/.test(t),Object.entries(e).forEach(([i,a])=>{this[i]=a}))}}class FlowState{constructor(){m(this,"isAbort");this.isAbort=!1}abort(){this.isAbort=!0}reset(){this.isAbort=!1}}class EventHelper extends eventsExports.EventEmitter{constructor({app:e,beforeEventHandler:s,afterEventHandler:n}){super();m(this,"app");m(this,"nodeEventList",new Map);m(this,"dataSourceEventList",new Map);m(this,"beforeEventHandler");m(this,"afterEventHandler");this.beforeEventHandler=s,this.afterEventHandler=n,this.app=e}destroy(){this.removeNodeEvents(),this.removeAllListeners(),this.nodeEventList.clear(),this.dataSourceEventList.clear()}bindNodeEvents(e){var s;(s=e.events)==null||s.forEach((n,i)=>{if(!n.name)return;let a="".concat(n.name,"_").concat(e.data.id);const o=n.name.split(".");o.length>1&&(a="".concat(o[1],"_").concat(o[0]));let u=Symbol(a);e.eventKeys.has(a)?u=e.eventKeys.get(a):e.eventKeys.set(a,u);const c=(l,...d)=>{this.eventHandler(i,e,d)};this.nodeEventList.set(c,u),this.on(u,c)})}removeNodeEvents(){Array.from(this.nodeEventList.keys()).forEach(e=>{const s=this.nodeEventList.get(e);s&&this.off(s,e)}),this.nodeEventList.clear()}bindDataSourceEvents(e){this.removeDataSourceEvents(e),e.forEach(s=>{var i;const n=(i=this.dataSourceEventList.get(s.id))!=null?i:new Map;(s.schema.events||[]).forEach(a=>{var l;const[o,...u]=((l=a.name)==null?void 0:l.split("."))||[];if(!o)return;const c=(...d)=>{this.eventHandler(a,s,d)};n.set(a.name,c),o===DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX?s==null||s.onDataChange(u.join("."),c):s.on(o,c)}),this.dataSourceEventList.set(s.id,n)})}removeDataSourceEvents(e){this.dataSourceEventList.size&&(e.forEach(s=>{const n=this.dataSourceEventList.get(s.id);n&&Array.from(n.keys()).forEach(i=>{const[a,...o]=i.split(".");a===DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX?s.offDataChange(o.join("."),n.get(i)):s.off(a,n.get(i))})}),this.dataSourceEventList.clear())}async eventHandler(e,s,n){const i=typeof e=="number"?s.events[e]:e;if(typeof this.beforeEventHandler=="function"&&this.beforeEventHandler({eventConfig:i,source:s,args:n}),has(i,"actions")){const a=new FlowState,{actions:o}=i;for(let u=0;u<o.length&&!(a!=null&&a.isAbort);u++)if(typeof e=="number"){const c=s.events[e].actions[u];this.actionHandler(c,s,n,a)}else this.actionHandler(o[u],s,n,a);a.reset()}else try{await this.compActionHandler(i,s,n)}catch(a){if(this.app.errorHandler)this.app.errorHandler(a,s,{type:"action-handler",config:i,...n});else throw a}typeof this.afterEventHandler=="function"&&this.afterEventHandler({eventConfig:i,source:s,args:n})}async actionHandler(e,s,n,i){try{if(e.actionType===ActionType.COMP){const a=e;await this.compActionHandler(a,s,n)}else if(e.actionType===ActionType.CODE){const a=e;await this.app.runCode(a.codeId,a.params||{},n,i)}else if(e.actionType===ActionType.DATA_SOURCE){const a=e,[o,u]=a.dataSourceMethod;await this.app.runDataSourceMethod(o,u,a.params||{},n,i)}}catch(a){if(this.app.errorHandler)this.app.errorHandler(a,s,{type:"action-handler",config:e,flowState:i,...n});else throw a}}async compActionHandler(e,s,n){if(!this.app.page)throw new Error("当前没有页面");let{method:i,to:a}=e;Array.isArray(i)&&([a,i]=i);const o=this.app.getNode(a);if(!o)throw new Error("ID为".concat(a,"的组件不存在"));o.instance?typeof o.instance[i]=="function"&&await o.instance[i](s,...n):o.addEventToQueue({method:i,fromCpt:s,args:n})}}class Flexible{constructor(t){m(this,"designWidth",375);m(this,"tid");m(this,"resizeHandler",()=>{clearTimeout(this.tid),this.tid=setTimeout(()=>{this.refreshRem(),this.tid=void 0},300)});m(this,"pageshowHandler",t=>{t.persisted&&this.resizeHandler()});globalThis.document.readyState==="complete"?this.setBodyFontSize():globalThis.document.addEventListener("DOMContentLoaded",this.setBodyFontSize,!1),globalThis.addEventListener("resize",this.resizeHandler,!1),globalThis.addEventListener("pageshow",this.pageshowHandler,!1),typeof(t==null?void 0:t.designWidth)<"u"&&this.setDesignWidth(t.designWidth)}destroy(){globalThis.document.removeEventListener("DOMContentLoaded",this.setBodyFontSize,!1),globalThis.removeEventListener("resize",this.resizeHandler,!1),globalThis.removeEventListener("pageshow",this.pageshowHandler,!1)}setDesignWidth(t){this.designWidth=t,this.refreshRem()}setBodyFontSize(){globalThis.document.body.style.fontSize=".12rem"}refreshRem(){const{width:t}=document.documentElement.getBoundingClientRect(),e=t/(this.designWidth/100);globalThis.document.documentElement.style.fontSize="".concat(e,"px"),globalThis.document.documentElement.style.fontSize="".concat(this.correctRem(e),"px")}correctRem(t){const{document:e}=globalThis,s=e.createElement("div");s.style.cssText="width:1rem;height:0;overflow:hidden;position:absolute;z-index:-1;visibility:hidden;",e.documentElement.appendChild(s);const n=s.offsetWidth;return e.documentElement.removeChild(s),Math.abs(n-t)>1?t**2/n:t}}class Store{constructor({initialData:t={}}={}){m(this,"data");this.data=t}set(t,e){this.data[t]=e}get(t){return this.data[t]}}class Node extends eventsExports.EventEmitter{constructor(e){var s,n;super();m(this,"data");m(this,"style");m(this,"events",[]);m(this,"instance",{});m(this,"page");m(this,"parent");m(this,"app");m(this,"store");m(this,"eventKeys",new Map);m(this,"eventQueue",[]);this.store=new Store({initialData:((n=(s=e.app).nodeStoreInitialData)==null?void 0:n.call(s))||{}}),this.page=e.page,this.parent=e.parent,this.app=e.app,this.setData(e.config),this.listenLifeSafe()}setData(e){this.data=e;const{events:s,style:n}=e;this.events=s||[],this.style=n||{};try{this.instance.config=e}catch(i){}this.emit("update-data",e)}addEventToQueue(e){this.eventQueue.push(e)}registerMethod(e){if(e){this.instance||(this.instance={});for(const[s,n]of Object.entries(e))typeof n=="function"&&(this.instance[s]=n)}}setInstance(e){this.instance=e}async runHookCode(e,s){var i,a,o;if(typeof this.data[e]=="function"){await this.data[e](this);return}const n=this.data[e];if((n==null?void 0:n.hookType)===HookType.CODE)for(const u of n.hookData){const{codeType:c=HookCodeType.CODE,codeId:l,params:d={}}=u;let p;const y={app:this.app,node:this,params:s||d};if(c===HookCodeType.CODE&&typeof l=="string"&&((i=this.app.codeDsl)!=null&&i[l]))p=this.app.codeDsl[l].content;else if(c===HookCodeType.DATA_SOURCE_METHOD&&Array.isArray(l)&&l.length>1){const v=(a=this.app.dataSourceManager)==null?void 0:a.get(l[0]);p=(o=v==null?void 0:v.methods.find(w=>w.name===l[1]))==null?void 0:o.content,y.dataSource=v}p&&typeof p=="function"&&await p(y)}}destroy(){this.eventQueue.length=0,this.instance=null,this.events=[],this.style={},this.removeAllListeners()}listenLifeSafe(){this.once("created",e=>{this.once("destroy",()=>{this.instance=null,typeof this.data.destroy=="function"&&this.data.destroy(this),this.listenLifeSafe()}),e&&this.setInstance(e),this.runHookCode("created")}),this.once("mounted",e=>{(async()=>{e&&this.setInstance(e);for(let n=this.eventQueue.shift();n;n=this.eventQueue.shift())typeof e[n.method]=="function"&&await e[n.method](n.fromCpt,...n.args);this.runHookCode("mounted")})()})}}class IteratorContainer extends Node{constructor(){super(...arguments);m(this,"nodes",[])}setData(e){this.resetNodes(),super.setData(e)}resetNodes(){var e;(e=this.nodes)==null||e.forEach(s=>{s.forEach(n=>{n.destroy()})}),this.nodes=[]}initNode(e,s,n){var a,o,u,c,l,d;if(n.has(e.id)&&((a=n.get(e.id))==null||a.destroy()),e.type&&this.app.iteratorContainerType.has(e.type)){const p=new IteratorContainer({config:e,parent:s,page:this.page,app:this.app});n.set(e.id,p),(o=this.app.eventHelper)==null||o.bindNodeEvents(p);return}const i=new Node({config:e,parent:s,page:this.page,app:this.app});if((u=this.app.eventHelper)==null||u.bindNodeEvents(i),n.set(e.id,i),e.type&&this.app.pageFragmentContainerType.has(e.type)&&e.pageFragmentId){const p=(l=(c=this.app.dsl)==null?void 0:c.items)==null?void 0:l.find(y=>y.id===e.pageFragmentId);p&&(e.items=[p])}(d=e.items)==null||d.forEach(p=>{this.initNode(p,i,n)})}setNodes(e,s){const n=this.nodes[s]||new Map;e.forEach(i=>{this.initNode(i,this,n)}),this.nodes[s]=n}getNode(e,s){var n;return(n=this.nodes[s])==null?void 0:n.get(e)}destroy(){super.destroy(),this.resetNodes()}}class Page extends Node{constructor(e){super(e);m(this,"nodes",new Map);this.setNode(e.config.id,this),e.config.items.forEach(s=>{this.initNode(s,this)})}initNode(e,s){var i,a,o;if(e.type&&this.app.iteratorContainerType.has(e.type)){this.setNode(e.id,new IteratorContainer({config:e,parent:s,page:this,app:this.app}));return}const n=new(e.type&&App.nodeClassMap.get(e.type)||Node)({config:e,parent:s,page:this,app:this.app});if(this.setNode(e.id,n),e.type&&this.app.pageFragmentContainerType.has(e.type)&&e.pageFragmentId){const u=(a=(i=this.app.dsl)==null?void 0:i.items)==null?void 0:a.find(c=>c.id===e.pageFragmentId);u&&(e.items=[u])}(o=e.items)==null||o.forEach(u=>{this.initNode(u,n)})}getNode(e,s,n){if(this.nodes.has(e))return this.nodes.get(e);if(Array.isArray(s)&&s.length&&Array.isArray(n)){let i=this.nodes.get(s[0]);for(let a=1,o=s.length;a<o;a++)i=i==null?void 0:i.getNode(s[a],n[a-1]);return i==null?void 0:i.getNode(e,n[n.length-1])}}setNode(e,s){this.nodes.set(e,s)}deleteNode(e){this.nodes.delete(e)}destroy(){this.nodes.forEach(e=>{e!==this&&e.destroy()}),this.nodes.clear(),super.destroy()}}const style2Obj=r=>{if(typeof r!="string")return r;const t={};return r.split(";").forEach(e=>{if(!e)return;const s=e.split(":");let n=s.shift(),i=s.join(":");n&&(n=n.replace(/^\s*/,"").replace(/\s*$/,""),i=i.replace(/^\s*/,"").replace(/\s*$/,""),n=n.split("-").map((a,o)=>o>0?"".concat(a[0].toUpperCase()).concat(a.substr(1)):a).join(""),t[n]=i)}),t},fillBackgroundImage=r=>r&&!/^url/.test(r)&&!/^linear-gradient/.test(r)?"url(".concat(r,")"):r,getTransform=(r,t)=>{if(!r)return[];const e=Object.entries(r).map(([n,i])=>i.trim()?(n==="rotate"&&isNumber(i)&&(i="".concat(i,"deg")),t!=="hippy"?"".concat(n,"(").concat(i,")"):{[n]:i}):"");if(t==="hippy")return e;const s=e.join(" ");return s.trim()?s:"none"},transformStyle=(r,t)=>{if(!r)return{};let e={};const s={};typeof r=="string"?e=style2Obj(r):e={...r};const n=t==="hippy",i=["zIndex","opacity","fontWeight"];return Object.entries(e).forEach(([a,o])=>{a==="scale"&&!s.transform&&n?s.transform=[{scale:o}]:a==="backgroundImage"&&!n?o&&(s[a]=fillBackgroundImage(o)):a==="transform"&&typeof o!="string"?s[a]=getTransform(o,t):!i.includes(a)&&o&&/^[-]?[0-9]*[.]?[0-9]*$/.test(o)?s[a]=n?o:"".concat(o/100,"rem"):s[a]=o}),s},K=class K extends eventsExports.EventEmitter{constructor(e){var s;super();m(this,"env");m(this,"dsl");m(this,"codeDsl");m(this,"dataSourceManager");m(this,"page");m(this,"useMock",!1);m(this,"platform","mobile");m(this,"jsEngine","browser");m(this,"components",new Map);m(this,"pageFragmentContainerType",new Set(["page-fragment-container"]));m(this,"iteratorContainerType",new Set(["iterator-container"]));m(this,"request");m(this,"transformStyle");m(this,"eventHelper");m(this,"errorHandler");m(this,"nodeStoreInitialData");m(this,"flexible");e.env?this.setEnv(e.env):this.setEnv(e.ua),this.errorHandler=e.errorHandler,this.codeDsl=(s=e.config)==null?void 0:s.codeBlocks,e.platform&&(this.platform=e.platform),e.jsEngine&&(this.jsEngine=e.jsEngine),e.nodeStoreInitialData&&(this.nodeStoreInitialData=e.nodeStoreInitialData),e.pageFragmentContainerType&&(Array.isArray(e.pageFragmentContainerType)?e.pageFragmentContainerType:[e.pageFragmentContainerType]).forEach(i=>{this.pageFragmentContainerType.add(i)}),e.iteratorContainerType&&(Array.isArray(e.iteratorContainerType)?e.iteratorContainerType:[e.iteratorContainerType]).forEach(i=>{this.iteratorContainerType.add(i)}),typeof e.useMock=="boolean"&&(this.useMock=e.useMock),this.jsEngine==="browser"&&!e.disabledFlexible&&(this.flexible=new Flexible({designWidth:e.designWidth})),this.platform!=="editor"&&(this.eventHelper=new EventHelper({app:this,beforeEventHandler:e.beforeEventHandler,afterEventHandler:e.afterEventHandler})),this.transformStyle=e.transformStyle||(n=>transformStyle(n,this.jsEngine)),e.request&&(this.request=e.request),e.config&&this.setConfig(e.config,e.curPage,e.dataSourceManagerInitialData)}static registerNode(e,s){K.nodeClassMap.set(e,s)}setEnv(e){!e||typeof e=="string"?this.env=new Env(e):this.env=e}setDesignWidth(e){var s;(s=this.flexible)==null||s.setDesignWidth(e)}setConfig(e,s,n){var a,o,u;this.dsl=e,!s&&e.items.length&&(s=e.items[0].id),this.dataSourceManager&&this.dataSourceManager.destroy(),this.dataSourceManager=createDataSourceManager(this,this.useMock,n),this.codeDsl=e.codeBlocks;const i=s||((o=(a=this.page)==null?void 0:a.data)==null?void 0:o.id);if(super.emit("dsl-change",{dsl:e,curPage:i}),this.setPage(i),this.dataSourceManager){const c=Array.from(this.dataSourceManager.dataSourceMap.values());(u=this.eventHelper)==null||u.bindDataSourceEvents(c)}}setPage(e){var n;const s=(n=this.dsl)==null?void 0:n.items.find(i=>"".concat(i.id)==="".concat(e));if(!s){this.deletePage(),super.emit("page-change");return}if(this.page){if(s===this.page.data)return;this.page.destroy()}if(this.page=new Page({config:s,app:this}),this.eventHelper){this.eventHelper.removeNodeEvents();for(const[,i]of this.page.nodes)this.eventHelper.bindNodeEvents(i)}super.emit("page-change",this.page)}deletePage(){var e,s;(e=this.page)==null||e.destroy(),(s=this.eventHelper)==null||s.removeNodeEvents(),this.page=void 0}getPage(e){if(!e)return this.page;if(this.page&&"".concat(this.page.data.id)==="".concat(e))return this.page}getNode(e,s,n){var i;return(i=this.page)==null?void 0:i.getNode(e,s,n)}registerComponent(e,s){this.components.set(e,s)}unregisterComponent(e){this.components.delete(e)}resolveComponent(e){return this.components.get(e)}emit(e,...s){var a,o;const[n,...i]=s;return this.eventHelper&&n instanceof Node&&((a=n.data)!=null&&a.id)&&n.eventKeys.has("".concat(String(e),"_").concat(n.data.id))?(o=this.eventHelper)==null?void 0:o.emit(n.eventKeys.get("".concat(String(e),"_").concat(n.data.id)),n,...i):super.emit(e,...s)}async runCode(e,s,n,i){var o,u;if(!e||isEmpty(this.codeDsl))return;const a=(u=(o=this.codeDsl)==null?void 0:o[e])==null?void 0:u.content;if(typeof a=="function")try{await a({app:this,params:s,eventParams:n,flowState:i})}catch(c){if(this.errorHandler)this.errorHandler(c,void 0,{type:"run-code",codeId:e,params:s,eventParams:n,flowState:i});else throw c}}async runDataSourceMethod(e,s,n,i,a){var l;if(!e||!s)return;const o=(l=this.dataSourceManager)==null?void 0:l.get(e);if(!o)return;const c=(o.methods||[]).find(d=>d.name===s);if(c&&typeof c.content=="function")try{await c.content({app:this,params:n,dataSource:o,eventParams:i,flowState:a})}catch(d){if(this.errorHandler)this.errorHandler(d,o,{type:"data-source-method",params:n,eventParams:i,flowState:a});else throw d}}destroy(){var e,s,n;this.removeAllListeners(),this.page=void 0,(e=this.flexible)==null||e.destroy(),this.flexible=void 0,(s=this.eventHelper)==null||s.destroy(),this.dsl=void 0,(n=this.dataSourceManager)==null||n.destroy(),this.dataSourceManager=void 0,this.codeDsl=void 0,this.components.clear(),this.nodeStoreInitialData=void 0}};m(K,"nodeClassMap",new Map);let App=K;const scriptRel="modulepreload",assetsURL=function(r){return"/tmagic-editor/playground/runtime/vue3/page/"+r},seen={},__vitePreload=function(t,e,s){let n=Promise.resolve();if(e&&e.length>0){let a=function(c){return Promise.all(c.map(l=>Promise.resolve(l).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),u=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));n=a(e.map(c=>{if(c=assetsURL(c),c in seen)return;seen[c]=!0;const l=c.endsWith(".css"),d=l?'[rel="stylesheet"]':"";if(document.querySelector('link[href="'.concat(c,'"]').concat(d)))return;const p=document.createElement("link");if(p.rel=l?"stylesheet":scriptRel,l||(p.as="script"),p.crossOrigin="",p.href=c,u&&p.setAttribute("nonce",u),document.head.appendChild(p),l)return new Promise((y,v)=>{p.addEventListener("load",y),p.addEventListener("error",()=>v(new Error("Unable to preload CSS for ".concat(c))))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return n.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})},components={page:()=>__vitePreload(()=>import("./index-gdeeYhiO.js"),__vite__mapDeps([0,1,2])),container:()=>__vitePreload(()=>import("./Container-x381xhtF.js"),__vite__mapDeps([3,4,2,1])),button:()=>__vitePreload(()=>import("./index-FVh2UgkF.js"),__vite__mapDeps([5,4,2])),text:()=>__vitePreload(()=>import("./index-BUgFgCi5.js"),__vite__mapDeps([6,4,2])),img:()=>__vitePreload(()=>import("./index-CQbNZRgE.js"),__vite__mapDeps([7,2])),qrcode:()=>__vitePreload(()=>import("./index-C6TiO4v0.js"),__vite__mapDeps([8,4,2])),overlay:()=>__vitePreload(()=>import("./index-C6zt9Vpa.js"),__vite__mapDeps([9,1,2])),"page-fragment-container":()=>__vitePreload(()=>import("./PageFragmentContainer-Akm4fGHF.js"),__vite__mapDeps([10,1,2,11])),"page-fragment":()=>__vitePreload(()=>import("./PageFragment-DNp3glCg.js"),__vite__mapDeps([12,1,2])),"iterator-container":()=>__vitePreload(()=>import("./IteratorContainer-C0Y5pPhm.js"),__vite__mapDeps([13,4,2]))},datasources={},plugins={};var axios$2={exports:{}},bind,hasRequiredBind;function requireBind(){return hasRequiredBind||(hasRequiredBind=1,bind=function(t,e){return function(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return t.apply(e,n)}}),bind}var utils,hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1;var r=requireBind(),t=Object.prototype.toString;function e(h){return Array.isArray(h)}function s(h){return typeof h>"u"}function n(h){return h!==null&&!s(h)&&h.constructor!==null&&!s(h.constructor)&&typeof h.constructor.isBuffer=="function"&&h.constructor.isBuffer(h)}function i(h){return t.call(h)==="[object ArrayBuffer]"}function a(h){return t.call(h)==="[object FormData]"}function o(h){var S;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?S=ArrayBuffer.isView(h):S=h&&h.buffer&&i(h.buffer),S}function u(h){return typeof h=="string"}function c(h){return typeof h=="number"}function l(h){return h!==null&&typeof h=="object"}function d(h){if(t.call(h)!=="[object Object]")return!1;var S=Object.getPrototypeOf(h);return S===null||S===Object.prototype}function p(h){return t.call(h)==="[object Date]"}function y(h){return t.call(h)==="[object File]"}function v(h){return t.call(h)==="[object Blob]"}function w(h){return t.call(h)==="[object Function]"}function C(h){return l(h)&&w(h.pipe)}function O(h){return t.call(h)==="[object URLSearchParams]"}function A(h){return h.trim?h.trim():h.replace(/^\s+|\s+$/g,"")}function $(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function f(h,S){if(!(h===null||typeof h>"u"))if(typeof h!="object"&&(h=[h]),e(h))for(var T=0,D=h.length;T<D;T++)S.call(null,h[T],T,h);else for(var _ in h)Object.prototype.hasOwnProperty.call(h,_)&&S.call(null,h[_],_,h)}function g(){var h={};function S(_,L){d(h[L])&&d(_)?h[L]=g(h[L],_):d(_)?h[L]=g({},_):e(_)?h[L]=_.slice():h[L]=_}for(var T=0,D=arguments.length;T<D;T++)f(arguments[T],S);return h}function b(h,S,T){return f(S,function(_,L){T&&typeof _=="function"?h[L]=r(_,T):h[L]=_}),h}function E(h){return h.charCodeAt(0)===65279&&(h=h.slice(1)),h}return utils={isArray:e,isArrayBuffer:i,isBuffer:n,isFormData:a,isArrayBufferView:o,isString:u,isNumber:c,isObject:l,isPlainObject:d,isUndefined:s,isDate:p,isFile:y,isBlob:v,isFunction:w,isStream:C,isURLSearchParams:O,isStandardBrowserEnv:$,forEach:f,merge:g,extend:b,trim:A,stripBOM:E},utils}var buildURL,hasRequiredBuildURL;function requireBuildURL(){if(hasRequiredBuildURL)return buildURL;hasRequiredBuildURL=1;var r=requireUtils();function t(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}return buildURL=function(s,n,i){if(!n)return s;var a;if(i)a=i(n);else if(r.isURLSearchParams(n))a=n.toString();else{var o=[];r.forEach(n,function(l,d){l===null||typeof l>"u"||(r.isArray(l)?d=d+"[]":l=[l],r.forEach(l,function(y){r.isDate(y)?y=y.toISOString():r.isObject(y)&&(y=JSON.stringify(y)),o.push(t(d)+"="+t(y))}))}),a=o.join("&")}if(a){var u=s.indexOf("#");u!==-1&&(s=s.slice(0,u)),s+=(s.indexOf("?")===-1?"?":"&")+a}return s},buildURL}var InterceptorManager_1,hasRequiredInterceptorManager;function requireInterceptorManager(){if(hasRequiredInterceptorManager)return InterceptorManager_1;hasRequiredInterceptorManager=1;var r=requireUtils();function t(){this.handlers=[]}return t.prototype.use=function(s,n,i){return this.handlers.push({fulfilled:s,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1},t.prototype.eject=function(s){this.handlers[s]&&(this.handlers[s]=null)},t.prototype.forEach=function(s){r.forEach(this.handlers,function(i){i!==null&&s(i)})},InterceptorManager_1=t,InterceptorManager_1}var normalizeHeaderName,hasRequiredNormalizeHeaderName;function requireNormalizeHeaderName(){if(hasRequiredNormalizeHeaderName)return normalizeHeaderName;hasRequiredNormalizeHeaderName=1;var r=requireUtils();return normalizeHeaderName=function(e,s){r.forEach(e,function(i,a){a!==s&&a.toUpperCase()===s.toUpperCase()&&(e[s]=i,delete e[a])})},normalizeHeaderName}var enhanceError,hasRequiredEnhanceError;function requireEnhanceError(){return hasRequiredEnhanceError||(hasRequiredEnhanceError=1,enhanceError=function(t,e,s,n,i){return t.config=e,s&&(t.code=s),t.request=n,t.response=i,t.isAxiosError=!0,t.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},t}),enhanceError}var createError,hasRequiredCreateError;function requireCreateError(){if(hasRequiredCreateError)return createError;hasRequiredCreateError=1;var r=requireEnhanceError();return createError=function(e,s,n,i,a){var o=new Error(e);return r(o,s,n,i,a)},createError}var settle,hasRequiredSettle;function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var r=requireCreateError();return settle=function(e,s,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):s(r("Request failed with status code "+n.status,n.config,null,n.request,n))},settle}var cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var r=requireUtils();return cookies=r.isStandardBrowserEnv()?function(){return{write:function(s,n,i,a,o,u){var c=[];c.push(s+"="+encodeURIComponent(n)),r.isNumber(i)&&c.push("expires="+new Date(i).toGMTString()),r.isString(a)&&c.push("path="+a),r.isString(o)&&c.push("domain="+o),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(s){var n=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(s){this.write(s,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),cookies}var isAbsoluteURL,hasRequiredIsAbsoluteURL;function requireIsAbsoluteURL(){return hasRequiredIsAbsoluteURL||(hasRequiredIsAbsoluteURL=1,isAbsoluteURL=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}),isAbsoluteURL}var combineURLs,hasRequiredCombineURLs;function requireCombineURLs(){return hasRequiredCombineURLs||(hasRequiredCombineURLs=1,combineURLs=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}),combineURLs}var buildFullPath,hasRequiredBuildFullPath;function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var r=requireIsAbsoluteURL(),t=requireCombineURLs();return buildFullPath=function(s,n){return s&&!r(n)?t(s,n):n},buildFullPath}var parseHeaders,hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var r=requireUtils(),t=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return parseHeaders=function(s){var n={},i,a,o;return s&&r.forEach(s.split("\n"),function(c){if(o=c.indexOf(":"),i=r.trim(c.substr(0,o)).toLowerCase(),a=r.trim(c.substr(o+1)),i){if(n[i]&&t.indexOf(i)>=0)return;i==="set-cookie"?n[i]=(n[i]?n[i]:[]).concat([a]):n[i]=n[i]?n[i]+", "+a:a}}),n},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var r=requireUtils();return isURLSameOrigin=r.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a"),n;function i(a){var o=a;return e&&(s.setAttribute("href",o),o=s.href),s.setAttribute("href",o),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:s.pathname.charAt(0)==="/"?s.pathname:"/"+s.pathname}}return n=i(window.location.href),function(o){var u=r.isString(o)?i(o):o;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}(),isURLSameOrigin}var Cancel_1,hasRequiredCancel;function requireCancel(){if(hasRequiredCancel)return Cancel_1;hasRequiredCancel=1;function r(t){this.message=t}return r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,Cancel_1=r,Cancel_1}var xhr,hasRequiredXhr;function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var r=requireUtils(),t=requireSettle(),e=requireCookies(),s=requireBuildURL(),n=requireBuildFullPath(),i=requireParseHeaders(),a=requireIsURLSameOrigin(),o=requireCreateError(),u=requireDefaults(),c=requireCancel();return xhr=function(d){return new Promise(function(y,v){var w=d.data,C=d.headers,O=d.responseType,A;function $(){d.cancelToken&&d.cancelToken.unsubscribe(A),d.signal&&d.signal.removeEventListener("abort",A)}r.isFormData(w)&&delete C["Content-Type"];var f=new XMLHttpRequest;if(d.auth){var g=d.auth.username||"",b=d.auth.password?unescape(encodeURIComponent(d.auth.password)):"";C.Authorization="Basic "+btoa(g+":"+b)}var E=n(d.baseURL,d.url);f.open(d.method.toUpperCase(),s(E,d.params,d.paramsSerializer),!0),f.timeout=d.timeout;function h(){if(f){var T="getAllResponseHeaders"in f?i(f.getAllResponseHeaders()):null,D=!O||O==="text"||O==="json"?f.responseText:f.response,_={data:D,status:f.status,statusText:f.statusText,headers:T,config:d,request:f};t(function(q){y(q),$()},function(q){v(q),$()},_),f=null}}if("onloadend"in f?f.onloadend=h:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(h)},f.onabort=function(){f&&(v(o("Request aborted",d,"ECONNABORTED",f)),f=null)},f.onerror=function(){v(o("Network Error",d,null,f)),f=null},f.ontimeout=function(){var D=d.timeout?"timeout of "+d.timeout+"ms exceeded":"timeout exceeded",_=d.transitional||u.transitional;d.timeoutErrorMessage&&(D=d.timeoutErrorMessage),v(o(D,d,_.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},r.isStandardBrowserEnv()){var S=(d.withCredentials||a(E))&&d.xsrfCookieName?e.read(d.xsrfCookieName):void 0;S&&(C[d.xsrfHeaderName]=S)}"setRequestHeader"in f&&r.forEach(C,function(D,_){typeof w>"u"&&_.toLowerCase()==="content-type"?delete C[_]:f.setRequestHeader(_,D)}),r.isUndefined(d.withCredentials)||(f.withCredentials=!!d.withCredentials),O&&O!=="json"&&(f.responseType=d.responseType),typeof d.onDownloadProgress=="function"&&f.addEventListener("progress",d.onDownloadProgress),typeof d.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",d.onUploadProgress),(d.cancelToken||d.signal)&&(A=function(T){f&&(v(!T||T&&T.type?new c("canceled"):T),f.abort(),f=null)},d.cancelToken&&d.cancelToken.subscribe(A),d.signal&&(d.signal.aborted?A():d.signal.addEventListener("abort",A))),w||(w=null),f.send(w)})},xhr}var defaults_1,hasRequiredDefaults;function requireDefaults(){if(hasRequiredDefaults)return defaults_1;hasRequiredDefaults=1;var r=requireUtils(),t=requireNormalizeHeaderName(),e=requireEnhanceError(),s={"Content-Type":"application/x-www-form-urlencoded"};function n(u,c){!r.isUndefined(u)&&r.isUndefined(u["Content-Type"])&&(u["Content-Type"]=c)}function i(){var u;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(u=requireXhr()),u}function a(u,c,l){if(r.isString(u))try{return(c||JSON.parse)(u),r.trim(u)}catch(d){if(d.name!=="SyntaxError")throw d}return(l||JSON.stringify)(u)}var o={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:i(),transformRequest:[function(c,l){return t(l,"Accept"),t(l,"Content-Type"),r.isFormData(c)||r.isArrayBuffer(c)||r.isBuffer(c)||r.isStream(c)||r.isFile(c)||r.isBlob(c)?c:r.isArrayBufferView(c)?c.buffer:r.isURLSearchParams(c)?(n(l,"application/x-www-form-urlencoded;charset=utf-8"),c.toString()):r.isObject(c)||l&&l["Content-Type"]==="application/json"?(n(l,"application/json"),a(c)):c}],transformResponse:[function(c){var l=this.transitional||o.transitional,d=l&&l.silentJSONParsing,p=l&&l.forcedJSONParsing,y=!d&&this.responseType==="json";if(y||p&&r.isString(c)&&c.length)try{return JSON.parse(c)}catch(v){if(y)throw v.name==="SyntaxError"?e(v,this,"E_JSON_PARSE"):v}return c}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(c){return c>=200&&c<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return r.forEach(["delete","get","head"],function(c){o.headers[c]={}}),r.forEach(["post","put","patch"],function(c){o.headers[c]=r.merge(s)}),defaults_1=o,defaults_1}var transformData,hasRequiredTransformData;function requireTransformData(){if(hasRequiredTransformData)return transformData;hasRequiredTransformData=1;var r=requireUtils(),t=requireDefaults();return transformData=function(s,n,i){var a=this||t;return r.forEach(i,function(u){s=u.call(a,s,n)}),s},transformData}var isCancel,hasRequiredIsCancel;function requireIsCancel(){return hasRequiredIsCancel||(hasRequiredIsCancel=1,isCancel=function(t){return!!(t&&t.__CANCEL__)}),isCancel}var dispatchRequest,hasRequiredDispatchRequest;function requireDispatchRequest(){if(hasRequiredDispatchRequest)return dispatchRequest;hasRequiredDispatchRequest=1;var r=requireUtils(),t=requireTransformData(),e=requireIsCancel(),s=requireDefaults(),n=requireCancel();function i(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new n("canceled")}return dispatchRequest=function(o){i(o),o.headers=o.headers||{},o.data=t.call(o,o.data,o.headers,o.transformRequest),o.headers=r.merge(o.headers.common||{},o.headers[o.method]||{},o.headers),r.forEach(["delete","get","head","post","put","patch","common"],function(l){delete o.headers[l]});var u=o.adapter||s.adapter;return u(o).then(function(l){return i(o),l.data=t.call(o,l.data,l.headers,o.transformResponse),l},function(l){return e(l)||(i(o),l&&l.response&&(l.response.data=t.call(o,l.response.data,l.response.headers,o.transformResponse))),Promise.reject(l)})},dispatchRequest}var mergeConfig,hasRequiredMergeConfig;function requireMergeConfig(){if(hasRequiredMergeConfig)return mergeConfig;hasRequiredMergeConfig=1;var r=requireUtils();return mergeConfig=function(e,s){s=s||{};var n={};function i(d,p){return r.isPlainObject(d)&&r.isPlainObject(p)?r.merge(d,p):r.isPlainObject(p)?r.merge({},p):r.isArray(p)?p.slice():p}function a(d){if(r.isUndefined(s[d])){if(!r.isUndefined(e[d]))return i(void 0,e[d])}else return i(e[d],s[d])}function o(d){if(!r.isUndefined(s[d]))return i(void 0,s[d])}function u(d){if(r.isUndefined(s[d])){if(!r.isUndefined(e[d]))return i(void 0,e[d])}else return i(void 0,s[d])}function c(d){if(d in s)return i(e[d],s[d]);if(d in e)return i(void 0,e[d])}var l={url:o,method:o,data:o,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return r.forEach(Object.keys(e).concat(Object.keys(s)),function(p){var y=l[p]||a,v=y(p);r.isUndefined(v)&&y!==c||(n[p]=v)}),n},mergeConfig}var data,hasRequiredData;function requireData(){return hasRequiredData||(hasRequiredData=1,data={version:"0.25.0"}),data}var validator,hasRequiredValidator;function requireValidator(){if(hasRequiredValidator)return validator;hasRequiredValidator=1;var r=requireData().version,t={};["object","boolean","number","function","string","symbol"].forEach(function(n,i){t[n]=function(o){return typeof o===n||"a"+(i<1?"n ":" ")+n}});var e={};t.transitional=function(i,a,o){function u(c,l){return"[Axios v"+r+"] Transitional option '"+c+"'"+l+(o?". "+o:"")}return function(c,l,d){if(i===!1)throw new Error(u(l," has been removed"+(a?" in "+a:"")));return a&&!e[l]&&(e[l]=!0,console.warn(u(l," has been deprecated since v"+a+" and will be removed in the near future"))),i?i(c,l,d):!0}};function s(n,i,a){if(typeof n!="object")throw new TypeError("options must be an object");for(var o=Object.keys(n),u=o.length;u-- >0;){var c=o[u],l=i[c];if(l){var d=n[c],p=d===void 0||l(d,c,n);if(p!==!0)throw new TypeError("option "+c+" must be "+p);continue}if(a!==!0)throw Error("Unknown option "+c)}}return validator={assertOptions:s,validators:t},validator}var Axios_1,hasRequiredAxios$2;function requireAxios$2(){if(hasRequiredAxios$2)return Axios_1;hasRequiredAxios$2=1;var r=requireUtils(),t=requireBuildURL(),e=requireInterceptorManager(),s=requireDispatchRequest(),n=requireMergeConfig(),i=requireValidator(),a=i.validators;function o(u){this.defaults=u,this.interceptors={request:new e,response:new e}}return o.prototype.request=function(c,l){if(typeof c=="string"?(l=l||{},l.url=c):l=c||{},!l.url)throw new Error("Provided config url is not valid");l=n(this.defaults,l),l.method?l.method=l.method.toLowerCase():this.defaults.method?l.method=this.defaults.method.toLowerCase():l.method="get";var d=l.transitional;d!==void 0&&i.assertOptions(d,{silentJSONParsing:a.transitional(a.boolean),forcedJSONParsing:a.transitional(a.boolean),clarifyTimeoutError:a.transitional(a.boolean)},!1);var p=[],y=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(l)===!1||(y=y&&g.synchronous,p.unshift(g.fulfilled,g.rejected))});var v=[];this.interceptors.response.forEach(function(g){v.push(g.fulfilled,g.rejected)});var w;if(!y){var C=[s,void 0];for(Array.prototype.unshift.apply(C,p),C=C.concat(v),w=Promise.resolve(l);C.length;)w=w.then(C.shift(),C.shift());return w}for(var O=l;p.length;){var A=p.shift(),$=p.shift();try{O=A(O)}catch(f){$(f);break}}try{w=s(O)}catch(f){return Promise.reject(f)}for(;v.length;)w=w.then(v.shift(),v.shift());return w},o.prototype.getUri=function(c){if(!c.url)throw new Error("Provided config url is not valid");return c=n(this.defaults,c),t(c.url,c.params,c.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],function(c){o.prototype[c]=function(l,d){return this.request(n(d||{},{method:c,url:l,data:(d||{}).data}))}}),r.forEach(["post","put","patch"],function(c){o.prototype[c]=function(l,d,p){return this.request(n(p||{},{method:c,url:l,data:d}))}}),Axios_1=o,Axios_1}var CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var r=requireCancel();function t(e){if(typeof e!="function")throw new TypeError("executor must be a function.");var s;this.promise=new Promise(function(a){s=a});var n=this;this.promise.then(function(i){if(n._listeners){var a,o=n._listeners.length;for(a=0;a<o;a++)n._listeners[a](i);n._listeners=null}}),this.promise.then=function(i){var a,o=new Promise(function(u){n.subscribe(u),a=u}).then(i);return o.cancel=function(){n.unsubscribe(a)},o},e(function(a){n.reason||(n.reason=new r(a),s(n.reason))})}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]},t.prototype.unsubscribe=function(s){if(this._listeners){var n=this._listeners.indexOf(s);n!==-1&&this._listeners.splice(n,1)}},t.source=function(){var s,n=new t(function(a){s=a});return{token:n,cancel:s}},CancelToken_1=t,CancelToken_1}var spread,hasRequiredSpread;function requireSpread(){return hasRequiredSpread||(hasRequiredSpread=1,spread=function(t){return function(s){return t.apply(null,s)}}),spread}var isAxiosError,hasRequiredIsAxiosError;function requireIsAxiosError(){if(hasRequiredIsAxiosError)return isAxiosError;hasRequiredIsAxiosError=1;var r=requireUtils();return isAxiosError=function(e){return r.isObject(e)&&e.isAxiosError===!0},isAxiosError}var hasRequiredAxios$1;function requireAxios$1(){if(hasRequiredAxios$1)return axios$2.exports;hasRequiredAxios$1=1;var r=requireUtils(),t=requireBind(),e=requireAxios$2(),s=requireMergeConfig(),n=requireDefaults();function i(o){var u=new e(o),c=t(e.prototype.request,u);return r.extend(c,e.prototype,u),r.extend(c,u),c.create=function(d){return i(s(o,d))},c}var a=i(n);return a.Axios=e,a.Cancel=requireCancel(),a.CancelToken=requireCancelToken(),a.isCancel=requireIsCancel(),a.VERSION=requireData().version,a.all=function(u){return Promise.all(u)},a.spread=requireSpread(),a.isAxiosError=requireIsAxiosError(),axios$2.exports=a,axios$2.exports.default=a,axios$2.exports}var axios$1,hasRequiredAxios;function requireAxios(){return hasRequiredAxios||(hasRequiredAxios=1,axios$1=requireAxios$1()),axios$1}var axiosExports=requireAxios();const axios=getDefaultExportFromCjs(axiosExports),requestHandler=function(r){return r},responseHandler=function(r){return r},service=axios.create({withCredentials:!0,timeout:7e3});service.interceptors.request.use(requestHandler);service.interceptors.response.use(responseHandler);const request={install(r){r.provide("request",service)}},useDsl=()=>{var s;const r=VueDemi.inject("app");if(!r)throw new Error("useDsl must be used after MagicApp is created");const t=VueDemi.ref(((s=r.page)==null?void 0:s.data)||{});r.on("page-change",()=>{var n;t.value=((n=r.page)==null?void 0:n.data)||{}});const e=(n,i,a)=>{n.forEach(o=>{isPage(o)?t.value=o:replaceChildNode(VueDemi.reactive(o),[t.value])}),VueDemi.nextTick(()=>{r.emit("replaced-node",{nodes:n,sourceId:i,...a})})};return r.dataSourceManager&&(r.dataSourceManager.on("update-data",e),VueDemi.onBeforeUnmount(()=>{r.dataSourceManager.off("update-data",e)})),{app:r,pageConfig:t}};function useComponent(r=""){let t,e,s;return typeof r=="string"?t=r:{componentType:t,app:e}=r,(!t||t==="")&&(t="container"),e||(e=VueDemi.inject("app")),s=resolveComponent({componentType:t,app:e}),!s&&!t.startsWith("magic-ui-")&&(t="magic-ui-".concat(toLine(t)),s=resolveComponent({componentType:t,app:e})),s!=null?s:t}function resolveComponent({componentType:r,app:t}){return t==null?void 0:t.resolveComponent(r)}const _sfc_main=Vue.defineComponent({__name:"App",setup(r){const{pageConfig:t}=useDsl(),e=useComponent("page");return(s,n)=>(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(Vue.unref(e)),{config:Vue.unref(t)},null,8,["config"]))}}),getLocalConfig=()=>{const configStr=localStorage.getItem("magicDSL");if(!configStr)return[];try{return[eval("(".concat(configStr,")"))]}catch(r){return console.error("Error parsing localStorage magicDSL:",r),[]}};DataSourceManager.registerObservedData(DeepObservedData);const vueApp=Vue.createApp(_sfc_main);vueApp.use(request);const dsl=((getUrlParam("localPreview")?getLocalConfig():window.magicDSL)||[])[0]||{},app=new App({ua:window.navigator.userAgent,config:dsl,request:service,curPage:getUrlParam("page"),useMock:!!getUrlParam("useMock")});app.setDesignWidth(app.env.isWeb?window.document.documentElement.getBoundingClientRect().width:375);Object.entries(components).forEach(([r,t])=>{app.registerComponent(r,Vue.defineAsyncComponent(t))});Object.values(plugins).forEach(r=>{vueApp.use(r,{app})});registerDataSourceOnDemand(dsl,datasources).then(r=>{Object.entries(r).forEach(([t,e])=>{DataSourceManager.register(t,e)}),vueApp.config.globalProperties.app=app,vueApp.provide("app",app),vueApp.mount("#app")});export{EventEmitter$1 as E,__vite_legacy_guard,cloneDeep as c,eventsExports as e,getDefaultExportFromCjs as g,set as s};
//# sourceMappingURL=index-B73hqDMn.js.map