mirror of
https://github.com/vft-magic/tmagic-admin.git
synced 2025-12-15 14:42:49 +00:00
4 lines
55 KiB
JavaScript
4 lines
55 KiB
JavaScript
var Q=Object.defineProperty;var Z=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var w=(e,t,r)=>(Z(e,typeof t!="symbol"?t+"":t,r),r);function __vite_legacy_guard(){import("data:text/javascript,")}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&s(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(t,r,s){return Function.prototype.apply.call(t,r,s)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:ReflectOwnKeys=function(t){return Object.getOwnPropertyNames(t)};function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}var NumberIsNaN=Number.isNaN||function(t){return t!==t};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(e){if(typeof e!="number"||e<0||NumberIsNaN(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");defaultMaxListeners=e}});EventEmitter.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};EventEmitter.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||NumberIsNaN(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function _getMaxListeners(e){return e._maxListeners===void 0?EventEmitter.defaultMaxListeners:e._maxListeners}EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function(t){for(var r=[],s=1;s<arguments.length;s++)r.push(arguments[s]);var i=t==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var a;if(r.length>0&&(a=r[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw u.context=a,u}var c=o[t];if(c===void 0)return!1;if(typeof c=="function")ReflectApply(c,this,r);else for(var l=c.length,m=arrayClone(c,l),s=0;s<l;++s)ReflectApply(m[s],this,r);return!0};function _addListener(e,t,r,s){var i,o,a;if(checkListener(r),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),a===void 0)a=o[t]=r,++e._eventsCount;else if(typeof a=="function"?a=o[t]=s?[r,a]:[a,r]:s?a.unshift(r):a.push(r),i=_getMaxListeners(e),i>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,ProcessEmitWarning(u)}return e}EventEmitter.prototype.addListener=function(t,r){return _addListener(this,t,r,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(t,r){return _addListener(this,t,r,!0)};function onceWrapper(){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 _onceWrap(e,t,r){var s={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=onceWrapper.bind(s);return i.listener=r,s.wrapFn=i,i}EventEmitter.prototype.once=function(t,r){return checkListener(r),this.on(t,_onceWrap(this,t,r)),this};EventEmitter.prototype.prependOnceListener=function(t,r){return checkListener(r),this.prependListener(t,_onceWrap(this,t,r)),this};EventEmitter.prototype.removeListener=function(t,r){var s,i,o,a,u;if(checkListener(r),i=this._events,i===void 0)return this;if(s=i[t],s===void 0)return this;if(s===r||s.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,s.listener||r));else if(typeof s!="function"){for(o=-1,a=s.length-1;a>=0;a--)if(s[a]===r||s[a].listener===r){u=s[a].listener,o=a;break}if(o<0)return this;o===0?s.shift():spliceOne(s,o),s.length===1&&(i[t]=s[0]),i.removeListener!==void 0&&this.emit("removeListener",t,u||r)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(t){var r,s,i;if(s=this._events,s===void 0)return this;if(s.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):s[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete s[t]),this;if(arguments.length===0){var o=Object.keys(s),a;for(i=0;i<o.length;++i)a=o[i],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=s[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(t,r[i]);return this};function _listeners(e,t,r){var s=e._events;if(s===void 0)return[];var i=s[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?unwrapListeners(i):arrayClone(i,i.length)}EventEmitter.prototype.listeners=function(t){return _listeners(this,t,!0)};EventEmitter.prototype.rawListeners=function(t){return _listeners(this,t,!1)};EventEmitter.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):listenerCount.call(e,t)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(e,t){for(var r=new Array(t),s=0;s<t;++s)r[s]=e[s];return r}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function once(e,t){return new Promise(function(r,s){function i(a){e.removeListener(t,o),s(a)}function o(){typeof e.removeListener=="function"&&e.removeListener("error",i),r([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,o,{once:!0}),t!=="error"&&addErrorHandlerIfEventEmitter(e,i,{once:!0})})}function addErrorHandlerIfEventEmitter(e,t,r){typeof e.on=="function"&&eventTargetAgnosticAddListener(e,"error",t,r)}function eventTargetAgnosticAddListener(e,t,r,s){if(typeof e.on=="function")s.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function i(o){s.once&&e.removeEventListener(t,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;const freeGlobal$1=freeGlobal;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")();const root$1=root;var Symbol$1=root$1.Symbol;const Symbol$2=Symbol$1;var objectProto$6=Object.prototype,hasOwnProperty$4=objectProto$6.hasOwnProperty,nativeObjectToString$1=objectProto$6.toString,symToStringTag$1=Symbol$2?Symbol$2.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$4.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var s=!0}catch(o){}var i=nativeObjectToString$1.call(e);return s&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$5=Object.prototype,nativeObjectToString=objectProto$5.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$2?Symbol$2.toStringTag:void 0;function baseGetTag(e){return e==null?e===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return e!=null&&typeof e=="object"}var isArray$1=Array.isArray;const isArray$2=isArray$1;function isObject$1(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){if(!isObject$1(e))return!1;var t=baseGetTag(e);return t==funcTag$1||t==genTag||t==asyncTag||t==proxyTag}var coreJsData=root$1["__core-js_shared__"];const coreJsData$1=coreJsData;var maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(e!=null){try{return funcToString$1.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$4=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$3=objectProto$4.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$3).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){if(!isObject$1(e)||isMasked(e))return!1;var t=isFunction$1(e)?reIsNative:reIsHostCtor;return t.test(toSource(e))}function getValue(e,t){return e==null?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var WeakMap=getNative(root$1,"WeakMap");const WeakMap$1=WeakMap;var MAX_SAFE_INTEGER=9007199254740991;function isLength(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction$1(e)}var objectProto$3=Object.prototype;function isPrototype(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||objectProto$3;return e===r}var argsTag$1="[object Arguments]";function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==argsTag$1}var objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty,propertyIsEnumerable=objectProto$2.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&hasOwnProperty$2.call(e,"callee")&&!propertyIsEnumerable.call(e,"callee")};const isArguments$1=isArguments;function stubFalse(){return!1}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,Buffer=moduleExports$1?root$1.Buffer:void 0,nativeIsBuffer=Buffer?Buffer.isBuffer:void 0,isBuffer$1=nativeIsBuffer||stubFalse;const isBuffer$2=isBuffer$1;var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag$2="[object Map]",numberTag="[object Number]",objectTag$1="[object Object]",regexpTag="[object RegExp]",setTag$2="[object Set]",stringTag="[object String]",weakMapTag$1="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag$1="[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]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag$1]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag$2]=typedArrayTags[numberTag]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag]=typedArrayTags[setTag$2]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag$1]=!1;function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,freeProcess=moduleExports&&freeGlobal$1.process,nodeUtil=function(){try{var e=freeModule&&freeModule.require&&freeModule.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(t){}}();const nodeUtil$1=nodeUtil;var nodeIsTypedArray=nodeUtil$1&&nodeUtil$1.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;const isTypedArray$1=isTypedArray;function overArg(e,t){return function(r){return e(t(r))}}var nativeKeys=overArg(Object.keys,Object);const nativeKeys$1=nativeKeys;var objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return nativeKeys$1(e);var t=[];for(var r in Object(e))hasOwnProperty$1.call(e,r)&&r!="constructor"&&t.push(r);return t}var Map$1=getNative(root$1,"Map");const Map$2=Map$1;var DataView=getNative(root$1,"DataView");const DataView$1=DataView;var Promise$1=getNative(root$1,"Promise");const Promise$2=Promise$1;var Set=getNative(root$1,"Set");const Set$1=Set;var mapTag$1="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag$1="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$2),promiseCtorString=toSource(Promise$2),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag||Map$2&&getTag(new Map$2)!=mapTag$1||Promise$2&&getTag(Promise$2.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$1||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag)&&(getTag=function(e){var t=baseGetTag(e),r=t==objectTag?e.constructor:void 0,s=r?toSource(r):"";if(s)switch(s){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag$1;case promiseCtorString:return promiseTag;case setCtorString:return setTag$1;case weakMapCtorString:return weakMapTag}return t});const getTag$1=getTag;var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function isEmpty(e){if(e==null)return!0;if(isArrayLike(e)&&(isArray$2(e)||typeof e=="string"||typeof e.splice=="function"||isBuffer$2(e)||isTypedArray$1(e)||isArguments$1(e)))return!e.length;var t=getTag$1(e);if(t==mapTag||t==setTag)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var r in e)if(hasOwnProperty.call(e,r))return!1;return!0}var n=(e=>(e.CODE="code",e))(n||{});class Env{constructor(t=globalThis.navigator.userAgent,r={}){w(this,"isIos",!1);w(this,"isIphone",!1);w(this,"isIpad",!1);w(this,"isAndroid",!1);w(this,"isAndroidPad",!1);w(this,"isMac",!1);w(this,"isWin",!1);w(this,"isMqq",!1);w(this,"isWechat",!1);w(this,"isWeb",!1);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.isWeb=!this.isIos&&!this.isAndroid&&!/(WebOS|BlackBerry)/.test(t),Object.entries(r).forEach(([s,i])=>{this[s]=i})}}const COMMON_EVENT_PREFIX="magic:common:events:",COMMON_METHOD_PREFIX="magic:common:actions:",CommonMethod={SHOW:"show",HIDE:"hide",SCROLL_TO_VIEW:"scrollIntoView",SCROLL_TO_TOP:"scrollToTop"},getCommonEventName=e=>e.startsWith(COMMON_EVENT_PREFIX)?e:`${COMMON_EVENT_PREFIX}${e}`,isCommonMethod=e=>e.startsWith(COMMON_METHOD_PREFIX),getDirectComponent=(e,t)=>{var s;if(!e)return!1;if(!e.id)return getDirectComponent(e.parentElement,t);const r=(s=t.page)==null?void 0:s.getNode(e.id);return r||!1},commonClickEventHandler=(e,t,r)=>{const s=getDirectComponent(r.target,e);s&&e.emit(getCommonEventName(t),s)},bindCommonEventListener=e=>{window.document.body.addEventListener("click",t=>{commonClickEventHandler(e,"click",t)}),window.document.body.addEventListener("click",t=>{commonClickEventHandler(e,"click:capture",t)},!0)},triggerCommonMethod=(e,t)=>{const{instance:r}=t;switch(e.replace(COMMON_METHOD_PREFIX,"")){case CommonMethod.SHOW:r.show();break;case CommonMethod.HIDE:r.hide();break;case CommonMethod.SCROLL_TO_VIEW:r.$el.scrollIntoView({behavior:"smooth"});break;case CommonMethod.SCROLL_TO_TOP:window.scrollTo({top:0,behavior:"smooth"});break}};class Store{constructor(){w(this,"data",{})}set(t,r){this.data[t]=r}get(t){return this.data[t]}}class Node extends events.exports.EventEmitter{constructor(r){super();w(this,"data");w(this,"style");w(this,"events");w(this,"instance");w(this,"page");w(this,"parent");w(this,"app");w(this,"store",new Store);this.page=r.page,this.parent=r.parent,this.app=r.app;const{events:s}=r.config;this.data=r.config,this.events=s,this.listenLifeSafe(),this.once("destroy",()=>{this.instance=null,typeof this.data.destroy=="function"&&this.data.destroy(this),this.listenLifeSafe()})}listenLifeSafe(){this.once("created",async r=>{this.instance=r,await this.runCodeBlock("created")}),this.once("mounted",async r=>{this.instance=r;const s=this.app.eventQueueMap[r.config.id]||[];for(let i=s.shift();i;i=s.shift())this.app.eventHandler(i.eventConfig,i.fromCpt,i.args);await this.runCodeBlock("mounted")})}async runCodeBlock(r){var s,i,o,a;if(typeof this.data[r]=="function"){await this.data[r](this);return}if(!(((s=this.data[r])==null?void 0:s.hookType)!==n.CODE||!this.app.codeDsl||isEmpty((i=this.app)==null?void 0:i.codeDsl)))for(const u of this.data[r].hookData){const{codeId:c,params:l={}}=u;this.app.codeDsl[c]&&typeof((a=(o=this.app)==null?void 0:o.codeDsl[c])==null?void 0:a.content)=="function"&&await this.app.codeDsl[c].content({app:this.app,params:l})}}}class Page extends Node{constructor(r){super(r);w(this,"nodes",new Map);this.setNode(r.config.id,this),this.initNode(r.config,this)}initNode(r,s){var o;const i=new Node({config:r,parent:s,page:this,app:this.app});this.setNode(r.id,i),(o=r.items)==null||o.forEach(a=>{this.initNode(a,i)})}getNode(r){return this.nodes.get(r)}setNode(r,s){this.nodes.set(r,s)}deleteNode(r){this.nodes.delete(r)}}const style2Obj=e=>{if(typeof e!="string")return e;const t={};return e.split(";").forEach(r=>{if(!r)return;const s=r.split(":");let i=s.shift(),o=s.join(":");!i||(i=i.replace(/^\s*/,"").replace(/\s*$/,""),o=o.replace(/^\s*/,"").replace(/\s*$/,""),i=i.split("-").map((a,u)=>u>0?`${a[0].toUpperCase()}${a.substr(1)}`:a).join(""),t[i]=o)}),t},fillBackgroundImage=e=>e&&!/^url/.test(e)&&!/^linear-gradient/.test(e)?`url(${e})`:e,isNumber$1=e=>/^(-?\d+)(\.\d+)?$/.test(e);class App extends events.exports.EventEmitter{constructor(r){var s;super();w(this,"env");w(this,"codeDsl");w(this,"pages",new Map);w(this,"page");w(this,"platform","mobile");w(this,"jsEngine","browser");w(this,"designWidth",375);w(this,"components",new Map);w(this,"eventQueueMap",{});if(this.env=new Env(r.ua),this.codeDsl=(s=r.config)==null?void 0:s.codeBlocks,r.platform&&(this.platform=r.platform),r.jsEngine&&(this.jsEngine=r.jsEngine),r.designWidth&&(this.designWidth=r.designWidth),this.platform==="mobile"||this.platform==="editor"){const i=()=>{const{width:o}=document.documentElement.getBoundingClientRect(),a=o/(this.designWidth/100);document.documentElement.style.fontSize=`${a}px`};i(),document.body.style.fontSize="14px",globalThis.addEventListener("resize",i)}r.transformStyle&&(this.transformStyle=r.transformStyle),r.config&&this.setConfig(r.config,r.curPage),bindCommonEventListener(this)}transformStyle(r){if(!r)return{};let s={};const i={};typeof r=="string"?s=style2Obj(r):s={...r};const o=["zIndex","opacity","fontWeight"];return Object.entries(s).forEach(([a,u])=>{if(a==="backgroundImage")u&&(i[a]=fillBackgroundImage(u));else if(a==="transform"&&typeof u!="string"){const c=Object.entries(u).map(([l,m])=>m.trim()?(l==="rotate"&&isNumber$1(m)&&(m=`${m}deg`),`${l}(${m})`):"").join(" ");i[a]=c.trim()?c:"none"}else!o.includes(a)&&u&&/^[-]?[0-9]*[.]?[0-9]*$/.test(u)?i[a]=`${u/100}rem`:i[a]=u}),i}setConfig(r,s){var i,o,a;this.codeDsl=r.codeBlocks,this.pages=new Map,(i=r.items)==null||i.forEach(u=>{this.pages.set(u.id,new Page({config:u,app:this}))}),this.setPage(s||((a=(o=this.page)==null?void 0:o.data)==null?void 0:a.id))}setPage(r){let s;r&&(s=this.pages.get(r)),s||(s=this.pages.get(this.pages.keys().next().value)),this.page=s,this.platform!=="magic"&&this.bindEvents()}registerComponent(r,s){this.components.set(r,s)}unregisterComponent(r){this.components.delete(r)}resolveComponent(r){return this.components.get(r)}bindEvents(){var r;if(!!this.page){this.removeAllListeners();for(const[,s]of this.page.nodes)(r=s.events)==null||r.forEach(i=>this.bindEvent(i,`${s.data.id}`))}}bindEvent(r,s){const{name:i}=r;this.on(`${i}_${s}`,(o,...a)=>{this.eventHandler(r,o,a)})}emit(r,s,...i){var o;return(o=s==null?void 0:s.data)!=null&&o.id?super.emit(`${String(r)}_${s.data.id}`,s,...i):super.emit(r,s,...i)}eventHandler(r,s,i){if(!this.page)throw new Error("\u5F53\u524D\u6CA1\u6709\u9875\u9762");const{method:o,to:a}=r,u=this.page.getNode(a);if(!u)throw`ID\u4E3A${a}\u7684\u7EC4\u4EF6\u4E0D\u5B58\u5728`;if(isCommonMethod(o))return triggerCommonMethod(o,u);u.instance?typeof u.instance[o]=="function"&&u.instance[o](s,...i):this.addEventToMap({eventConfig:r,fromCpt:s,args:i})}destroy(){this.removeAllListeners(),this.pages.clear()}addEventToMap(r){this.eventQueueMap[r.eventConfig.to]?this.eventQueueMap[r.eventConfig.to].push(r):this.eventQueueMap[r.eventConfig.to]=[r]}}var dayjs_min={exports:{}};(function(e,t){(function(r,s){e.exports=s()})(commonjsGlobal,function(){var r=1e3,s=6e4,i=36e5,o="millisecond",a="second",u="minute",c="hour",l="day",m="week",f="month",M="quarter",O="year",L="date",g="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,I=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},j=function($,p,d){var y=String($);return!y||y.length>=p?$:""+Array(p+1-y.length).join(d)+$},v={s:j,z:function($){var p=-$.utcOffset(),d=Math.abs(p),y=Math.floor(d/60),h=d%60;return(p<=0?"+":"-")+j(y,2,"0")+":"+j(h,2,"0")},m:function $(p,d){if(p.date()<d.date())return-$(d,p);var y=12*(d.year()-p.year())+(d.month()-p.month()),h=p.clone().add(y,f),E=d-h<0,b=p.clone().add(y+(E?-1:1),f);return+(-(y+(d-h)/(E?h-b:b-h))||0)},a:function($){return $<0?Math.ceil($)||0:Math.floor($)},p:function($){return{M:f,y:O,w:m,d:l,D:L,h:c,m:u,s:a,ms:o,Q:M}[$]||String($||"").toLowerCase().replace(/s$/,"")},u:function($){return $===void 0}},U="en",N={};N[U]=D;var B=function($){return $ instanceof k},H=function $(p,d,y){var h;if(!p)return U;if(typeof p=="string"){var E=p.toLowerCase();N[E]&&(h=E),d&&(N[E]=d,h=E);var b=p.split("-");if(!h&&b.length>1)return $(b[0])}else{var S=p.name;N[S]=p,h=S}return!y&&h&&(U=h),h||!y&&U},C=function($,p){if(B($))return $.clone();var d=typeof p=="object"?p:{};return d.date=$,d.args=arguments,new k(d)},T=v;T.l=H,T.i=B,T.w=function($,p){return C($,{locale:p.$L,utc:p.$u,x:p.$x,$offset:p.$offset})};var k=function(){function $(d){this.$L=H(d.locale,null,!0),this.parse(d)}var p=$.prototype;return p.parse=function(d){this.$d=function(y){var h=y.date,E=y.utc;if(h===null)return new Date(NaN);if(T.u(h))return new Date;if(h instanceof Date)return new Date(h);if(typeof h=="string"&&!/Z$/i.test(h)){var b=h.match(x);if(b){var S=b[2]-1||0,A=(b[7]||"0").substring(0,3);return E?new Date(Date.UTC(b[1],S,b[3]||1,b[4]||0,b[5]||0,b[6]||0,A)):new Date(b[1],S,b[3]||1,b[4]||0,b[5]||0,b[6]||0,A)}}return new Date(h)}(d),this.$x=d.x||{},this.init()},p.init=function(){var d=this.$d;this.$y=d.getFullYear(),this.$M=d.getMonth(),this.$D=d.getDate(),this.$W=d.getDay(),this.$H=d.getHours(),this.$m=d.getMinutes(),this.$s=d.getSeconds(),this.$ms=d.getMilliseconds()},p.$utils=function(){return T},p.isValid=function(){return this.$d.toString()!==g},p.isSame=function(d,y){var h=C(d);return this.startOf(y)<=h&&h<=this.endOf(y)},p.isAfter=function(d,y){return C(d)<this.startOf(y)},p.isBefore=function(d,y){return this.endOf(y)<C(d)},p.$g=function(d,y,h){return T.u(d)?this[y]:this.set(h,d)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(d,y){var h=this,E=!!T.u(y)||y,b=T.p(d),S=function(z,q){var J=T.w(h.$u?Date.UTC(h.$y,q,z):new Date(h.$y,q,z),h);return E?J:J.endOf(l)},A=function(z,q){return T.w(h.toDate()[z].apply(h.toDate("s"),(E?[0,0,0,0]:[23,59,59,999]).slice(q)),h)},_=this.$W,P=this.$M,V=this.$D,W="set"+(this.$u?"UTC":"");switch(b){case O:return E?S(1,0):S(31,11);case f:return E?S(1,P):S(0,P+1);case m:var Y=this.$locale().weekStart||0,X=(_<Y?_+7:_)-Y;return S(E?V-X:V+(6-X),P);case l:case L:return A(W+"Hours",0);case c:return A(W+"Minutes",1);case u:return A(W+"Seconds",2);case a:return A(W+"Milliseconds",3);default:return this.clone()}},p.endOf=function(d){return this.startOf(d,!1)},p.$set=function(d,y){var h,E=T.p(d),b="set"+(this.$u?"UTC":""),S=(h={},h[l]=b+"Date",h[L]=b+"Date",h[f]=b+"Month",h[O]=b+"FullYear",h[c]=b+"Hours",h[u]=b+"Minutes",h[a]=b+"Seconds",h[o]=b+"Milliseconds",h)[E],A=E===l?this.$D+(y-this.$W):y;if(E===f||E===O){var _=this.clone().set(L,1);_.$d[S](A),_.init(),this.$d=_.set(L,Math.min(this.$D,_.daysInMonth())).$d}else S&&this.$d[S](A);return this.init(),this},p.set=function(d,y){return this.clone().$set(d,y)},p.get=function(d){return this[T.p(d)]()},p.add=function(d,y){var h,E=this;d=Number(d);var b=T.p(y),S=function(P){var V=C(E);return T.w(V.date(V.date()+Math.round(P*d)),E)};if(b===f)return this.set(f,this.$M+d);if(b===O)return this.set(O,this.$y+d);if(b===l)return S(1);if(b===m)return S(7);var A=(h={},h[u]=s,h[c]=i,h[a]=r,h)[b]||1,_=this.$d.getTime()+d*A;return T.w(_,this)},p.subtract=function(d,y){return this.add(-1*d,y)},p.format=function(d){var y=this,h=this.$locale();if(!this.isValid())return h.invalidDate||g;var E=d||"YYYY-MM-DDTHH:mm:ssZ",b=T.z(this),S=this.$H,A=this.$m,_=this.$M,P=h.weekdays,V=h.months,W=function(q,J,G,K){return q&&(q[J]||q(y,E))||G[J].slice(0,K)},Y=function(q){return T.s(S%12||12,q,"0")},X=h.meridiem||function(q,J,G){var K=q<12?"AM":"PM";return G?K.toLowerCase():K},z={YY:String(this.$y).slice(-2),YYYY:this.$y,M:_+1,MM:T.s(_+1,2,"0"),MMM:W(h.monthsShort,_,V,3),MMMM:W(V,_),D:this.$D,DD:T.s(this.$D,2,"0"),d:String(this.$W),dd:W(h.weekdaysMin,this.$W,P,2),ddd:W(h.weekdaysShort,this.$W,P,3),dddd:P[this.$W],H:String(S),HH:T.s(S,2,"0"),h:Y(1),hh:Y(2),a:X(S,A,!0),A:X(S,A,!1),m:String(A),mm:T.s(A,2,"0"),s:String(this.$s),ss:T.s(this.$s,2,"0"),SSS:T.s(this.$ms,3,"0"),Z:b};return E.replace(I,function(q,J){return J||z[q]||b.replace(":","")})},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(d,y,h){var E,b=T.p(y),S=C(d),A=(S.utcOffset()-this.utcOffset())*s,_=this-S,P=T.m(this,S);return P=(E={},E[O]=P/12,E[f]=P,E[M]=P/3,E[m]=(_-A)/6048e5,E[l]=(_-A)/864e5,E[c]=_/i,E[u]=_/s,E[a]=_/r,E)[b]||_,h?P:T.a(P)},p.daysInMonth=function(){return this.endOf(f).$D},p.$locale=function(){return N[this.$L]},p.locale=function(d,y){if(!d)return this.$L;var h=this.clone(),E=H(d,y,!0);return E&&(h.$L=E),h},p.clone=function(){return T.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},$}(),F=k.prototype;return C.prototype=F,[["$ms",o],["$s",a],["$m",u],["$H",c],["$W",l],["$M",f],["$y",O],["$D",L]].forEach(function($){F[$[1]]=function(p){return this.$g(p,$[0],$[1])}}),C.extend=function($,p){return $.$i||($(p,k,C),$.$i=!0),C},C.locale=H,C.isDayjs=B,C.unix=function($){return C(1e3*$)},C.en=N[U],C.Ls=N,C.p={},C})})(dayjs_min);const dayjs=dayjs_min.exports;var utc$1={exports:{}};(function(e,t){(function(r,s){e.exports=s()})(commonjsGlobal,function(){var r="minute",s=/[+-]\d\d(?::?\d\d)?/g,i=/([+-]|\d\d)/g;return function(o,a,u){var c=a.prototype;u.utc=function(g){var x={date:g,utc:!0,args:arguments};return new a(x)},c.utc=function(g){var x=u(this.toDate(),{locale:this.$L,utc:!0});return g?x.add(this.utcOffset(),r):x},c.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var l=c.parse;c.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),l.call(this,g)};var m=c.init;c.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else m.call(this)};var f=c.utcOffset;c.utcOffset=function(g,x){var I=this.$utils().u;if(I(g))return this.$u?0:I(this.$offset)?f.call(this):this.$offset;if(typeof g=="string"&&(g=function(U){U===void 0&&(U="");var N=U.match(s);if(!N)return null;var B=(""+N[0]).match(i)||["-",0,0],H=B[0],C=60*+B[1]+ +B[2];return C===0?0:H==="+"?C:-C}(g),g===null))return this;var D=Math.abs(g)<=16?60*g:g,j=this;if(x)return j.$offset=D,j.$u=g===0,j;if(g!==0){var v=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(j=this.local().add(D+v,r)).$offset=D,j.$x.$localOffset=v}else j=this.utc();return j};var M=c.format;c.format=function(g){var x=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return M.call(this,x)},c.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},c.isUTC=function(){return!!this.$u},c.toISOString=function(){return this.toDate().toISOString()},c.toString=function(){return this.toDate().toUTCString()};var O=c.toDate;c.toDate=function(g){return g==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():O.call(this)};var L=c.diff;c.diff=function(g,x,I){if(g&&this.$u===g.$u)return L.call(this,g,x,I);var D=this.local(),j=u(g).local();return L.call(D,j,x,I)}}})})(utc$1);const utc=utc$1.exports;dayjs.extend(utc);const toLine=(e="")=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),filterXSS=e=>e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),getUrlParam=(e,t)=>{const r=t||location.href,s=new RegExp(`[?&#]${e}=([^&#]+)`,"gi"),i=r.match(s);let o;return i&&i.length>0?(o=i[i.length-1].split("="),o&&o.length>1?filterXSS(o[1]):""):""},scriptRel="modulepreload",assetsURL=function(e){return"/static/vue3/runtime/page/"+e},seen={},__vitePreload=function(t,r,s){return!r||r.length===0?t():Promise.all(r.map(i=>{if(i=assetsURL(i),i in seen)return;seen[i]=!0;const o=i.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const u=document.createElement("link");if(u.rel=o?"stylesheet":scriptRel,o||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),o)return new Promise((c,l)=>{u.addEventListener("load",c),u.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},components={page:()=>__vitePreload(()=>import("./index.ee5b9415.js"),["assets/index.ee5b9415.js","assets/Component.aeed2f79.js","assets/useApp.8bd6dbd4.js"]),container:()=>__vitePreload(()=>import("./Container.7997a01b.js"),["assets/Container.7997a01b.js","assets/Component.aeed2f79.js","assets/useApp.8bd6dbd4.js"]),button:()=>__vitePreload(()=>import("./index.d9593460.js"),["assets/index.d9593460.js","assets/useApp.8bd6dbd4.js"]),text:()=>__vitePreload(()=>import("./index.55a4739f.js"),["assets/index.55a4739f.js","assets/useApp.8bd6dbd4.js"]),img:()=>__vitePreload(()=>import("./index.fb366993.js"),["assets/index.fb366993.js","assets/useApp.8bd6dbd4.js"]),qrcode:()=>__vitePreload(()=>import("./index.c14edb3a.js"),["assets/index.c14edb3a.js","assets/useApp.8bd6dbd4.js"]),overlay:()=>__vitePreload(()=>import("./index.fed7c0dd.js"),["assets/index.fed7c0dd.js","assets/useApp.8bd6dbd4.js"])},plugins={};var axios$3={exports:{}},axios$2={exports:{}},bind$2=function(t,r){return function(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];return t.apply(r,i)}},bind$1=bind$2,toString=Object.prototype.toString;function isArray(e){return Array.isArray(e)}function isUndefined(e){return typeof e>"u"}function isBuffer(e){return e!==null&&!isUndefined(e)&&e.constructor!==null&&!isUndefined(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function isArrayBuffer(e){return toString.call(e)==="[object ArrayBuffer]"}function isFormData(e){return toString.call(e)==="[object FormData]"}function isArrayBufferView(e){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&isArrayBuffer(e.buffer),t}function isString(e){return typeof e=="string"}function isNumber(e){return typeof e=="number"}function isObject(e){return e!==null&&typeof e=="object"}function isPlainObject(e){if(toString.call(e)!=="[object Object]")return!1;var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function isDate(e){return toString.call(e)==="[object Date]"}function isFile(e){return toString.call(e)==="[object File]"}function isBlob(e){return toString.call(e)==="[object Blob]"}function isFunction(e){return toString.call(e)==="[object Function]"}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isURLSearchParams(e){return toString.call(e)==="[object URLSearchParams]"}function trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function isStandardBrowserEnv(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function forEach(e,t){if(!(e===null||typeof e>"u"))if(typeof e!="object"&&(e=[e]),isArray(e))for(var r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}function merge(){var e={};function t(i,o){isPlainObject(e[o])&&isPlainObject(i)?e[o]=merge(e[o],i):isPlainObject(i)?e[o]=merge({},i):isArray(i)?e[o]=i.slice():e[o]=i}for(var r=0,s=arguments.length;r<s;r++)forEach(arguments[r],t);return e}function extend(e,t,r){return forEach(t,function(i,o){r&&typeof i=="function"?e[o]=bind$1(i,r):e[o]=i}),e}function stripBOM(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}var utils$8={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber,isObject,isPlainObject,isUndefined,isDate,isFile,isBlob,isFunction,isStream,isURLSearchParams,isStandardBrowserEnv,forEach,merge,extend,trim,stripBOM},utils$7=utils$8;function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL$1=function(t,r,s){if(!r)return t;var i;if(s)i=s(r);else if(utils$7.isURLSearchParams(r))i=r.toString();else{var o=[];utils$7.forEach(r,function(c,l){c===null||typeof c>"u"||(utils$7.isArray(c)?l=l+"[]":c=[c],utils$7.forEach(c,function(f){utils$7.isDate(f)?f=f.toISOString():utils$7.isObject(f)&&(f=JSON.stringify(f)),o.push(encode(l)+"="+encode(f))}))}),i=o.join("&")}if(i){var a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t},utils$6=utils$8;function InterceptorManager$1(){this.handlers=[]}InterceptorManager$1.prototype.use=function(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1};InterceptorManager$1.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};InterceptorManager$1.prototype.forEach=function(t){utils$6.forEach(this.handlers,function(s){s!==null&&t(s)})};var InterceptorManager_1=InterceptorManager$1,utils$5=utils$8,normalizeHeaderName=function(t,r){utils$5.forEach(t,function(i,o){o!==r&&o.toUpperCase()===r.toUpperCase()&&(t[r]=i,delete t[o])})},enhanceError=function(t,r,s,i,o){return t.config=r,s&&(t.code=s),t.request=i,t.response=o,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},createError,hasRequiredCreateError;function requireCreateError(){if(hasRequiredCreateError)return createError;hasRequiredCreateError=1;var e=enhanceError;return createError=function(r,s,i,o,a){var u=new Error(r);return e(u,s,i,o,a)},createError}var settle,hasRequiredSettle;function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var e=requireCreateError();return settle=function(r,s,i){var o=i.config.validateStatus;!i.status||!o||o(i.status)?r(i):s(e("Request failed with status code "+i.status,i.config,null,i.request,i))},settle}var cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var e=utils$8;return cookies=e.isStandardBrowserEnv()?function(){return{write:function(s,i,o,a,u,c){var l=[];l.push(s+"="+encodeURIComponent(i)),e.isNumber(o)&&l.push("expires="+new Date(o).toGMTString()),e.isString(a)&&l.push("path="+a),e.isString(u)&&l.push("domain="+u),c===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(s){var i=document.cookie.match(new RegExp("(^|;\\s*)("+s+")=([^;]*)"));return i?decodeURIComponent(i[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,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t}),combineURLs}var buildFullPath,hasRequiredBuildFullPath;function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var e=requireIsAbsoluteURL(),t=requireCombineURLs();return buildFullPath=function(s,i){return s&&!e(i)?t(s,i):i},buildFullPath}var parseHeaders,hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var e=utils$8,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 i={},o,a,u;return s&&e.forEach(s.split(`
|
|
`),function(l){if(u=l.indexOf(":"),o=e.trim(l.substr(0,u)).toLowerCase(),a=e.trim(l.substr(u+1)),o){if(i[o]&&t.indexOf(o)>=0)return;o==="set-cookie"?i[o]=(i[o]?i[o]:[]).concat([a]):i[o]=i[o]?i[o]+", "+a:a}}),i},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var e=utils$8;return isURLSameOrigin=e.isStandardBrowserEnv()?function(){var r=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a"),i;function o(a){var u=a;return r&&(s.setAttribute("href",u),u=s.href),s.setAttribute("href",u),{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 i=o(window.location.href),function(u){var c=e.isString(u)?o(u):u;return c.protocol===i.protocol&&c.host===i.host}}():function(){return function(){return!0}}(),isURLSameOrigin}var Cancel_1,hasRequiredCancel;function requireCancel(){if(hasRequiredCancel)return Cancel_1;hasRequiredCancel=1;function e(t){this.message=t}return e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,Cancel_1=e,Cancel_1}var xhr,hasRequiredXhr;function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var e=utils$8,t=requireSettle(),r=requireCookies(),s=buildURL$1,i=requireBuildFullPath(),o=requireParseHeaders(),a=requireIsURLSameOrigin(),u=requireCreateError(),c=requireDefaults(),l=requireCancel();return xhr=function(f){return new Promise(function(O,L){var g=f.data,x=f.headers,I=f.responseType,D;function j(){f.cancelToken&&f.cancelToken.unsubscribe(D),f.signal&&f.signal.removeEventListener("abort",D)}e.isFormData(g)&&delete x["Content-Type"];var v=new XMLHttpRequest;if(f.auth){var U=f.auth.username||"",N=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";x.Authorization="Basic "+btoa(U+":"+N)}var B=i(f.baseURL,f.url);v.open(f.method.toUpperCase(),s(B,f.params,f.paramsSerializer),!0),v.timeout=f.timeout;function H(){if(!!v){var T="getAllResponseHeaders"in v?o(v.getAllResponseHeaders()):null,k=!I||I==="text"||I==="json"?v.responseText:v.response,F={data:k,status:v.status,statusText:v.statusText,headers:T,config:f,request:v};t(function(p){O(p),j()},function(p){L(p),j()},F),v=null}}if("onloadend"in v?v.onloadend=H:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(H)},v.onabort=function(){!v||(L(u("Request aborted",f,"ECONNABORTED",v)),v=null)},v.onerror=function(){L(u("Network Error",f,null,v)),v=null},v.ontimeout=function(){var k=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",F=f.transitional||c.transitional;f.timeoutErrorMessage&&(k=f.timeoutErrorMessage),L(u(k,f,F.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",v)),v=null},e.isStandardBrowserEnv()){var C=(f.withCredentials||a(B))&&f.xsrfCookieName?r.read(f.xsrfCookieName):void 0;C&&(x[f.xsrfHeaderName]=C)}"setRequestHeader"in v&&e.forEach(x,function(k,F){typeof g>"u"&&F.toLowerCase()==="content-type"?delete x[F]:v.setRequestHeader(F,k)}),e.isUndefined(f.withCredentials)||(v.withCredentials=!!f.withCredentials),I&&I!=="json"&&(v.responseType=f.responseType),typeof f.onDownloadProgress=="function"&&v.addEventListener("progress",f.onDownloadProgress),typeof f.onUploadProgress=="function"&&v.upload&&v.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(D=function(T){!v||(L(!T||T&&T.type?new l("canceled"):T),v.abort(),v=null)},f.cancelToken&&f.cancelToken.subscribe(D),f.signal&&(f.signal.aborted?D():f.signal.addEventListener("abort",D))),g||(g=null),v.send(g)})},xhr}var defaults_1,hasRequiredDefaults;function requireDefaults(){if(hasRequiredDefaults)return defaults_1;hasRequiredDefaults=1;var e=utils$8,t=normalizeHeaderName,r=enhanceError,s={"Content-Type":"application/x-www-form-urlencoded"};function i(c,l){!e.isUndefined(c)&&e.isUndefined(c["Content-Type"])&&(c["Content-Type"]=l)}function o(){var c;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(c=requireXhr()),c}function a(c,l,m){if(e.isString(c))try{return(l||JSON.parse)(c),e.trim(c)}catch(f){if(f.name!=="SyntaxError")throw f}return(m||JSON.stringify)(c)}var u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:o(),transformRequest:[function(l,m){return t(m,"Accept"),t(m,"Content-Type"),e.isFormData(l)||e.isArrayBuffer(l)||e.isBuffer(l)||e.isStream(l)||e.isFile(l)||e.isBlob(l)?l:e.isArrayBufferView(l)?l.buffer:e.isURLSearchParams(l)?(i(m,"application/x-www-form-urlencoded;charset=utf-8"),l.toString()):e.isObject(l)||m&&m["Content-Type"]==="application/json"?(i(m,"application/json"),a(l)):l}],transformResponse:[function(l){var m=this.transitional||u.transitional,f=m&&m.silentJSONParsing,M=m&&m.forcedJSONParsing,O=!f&&this.responseType==="json";if(O||M&&e.isString(l)&&l.length)try{return JSON.parse(l)}catch(L){if(O)throw L.name==="SyntaxError"?r(L,this,"E_JSON_PARSE"):L}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};return e.forEach(["delete","get","head"],function(l){u.headers[l]={}}),e.forEach(["post","put","patch"],function(l){u.headers[l]=e.merge(s)}),defaults_1=u,defaults_1}var utils$4=utils$8,defaults$2=requireDefaults(),transformData$1=function(t,r,s){var i=this||defaults$2;return utils$4.forEach(s,function(a){t=a.call(i,t,r)}),t},isCancel$1,hasRequiredIsCancel;function requireIsCancel(){return hasRequiredIsCancel||(hasRequiredIsCancel=1,isCancel$1=function(t){return!!(t&&t.__CANCEL__)}),isCancel$1}var utils$3=utils$8,transformData=transformData$1,isCancel=requireIsCancel(),defaults$1=requireDefaults(),Cancel=requireCancel();function throwIfCancellationRequested(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Cancel("canceled")}var dispatchRequest$1=function(t){throwIfCancellationRequested(t),t.headers=t.headers||{},t.data=transformData.call(t,t.data,t.headers,t.transformRequest),t.headers=utils$3.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),utils$3.forEach(["delete","get","head","post","put","patch","common"],function(i){delete t.headers[i]});var r=t.adapter||defaults$1.adapter;return r(t).then(function(i){return throwIfCancellationRequested(t),i.data=transformData.call(t,i.data,i.headers,t.transformResponse),i},function(i){return isCancel(i)||(throwIfCancellationRequested(t),i&&i.response&&(i.response.data=transformData.call(t,i.response.data,i.response.headers,t.transformResponse))),Promise.reject(i)})},utils$2=utils$8,mergeConfig$2=function(t,r){r=r||{};var s={};function i(m,f){return utils$2.isPlainObject(m)&&utils$2.isPlainObject(f)?utils$2.merge(m,f):utils$2.isPlainObject(f)?utils$2.merge({},f):utils$2.isArray(f)?f.slice():f}function o(m){if(utils$2.isUndefined(r[m])){if(!utils$2.isUndefined(t[m]))return i(void 0,t[m])}else return i(t[m],r[m])}function a(m){if(!utils$2.isUndefined(r[m]))return i(void 0,r[m])}function u(m){if(utils$2.isUndefined(r[m])){if(!utils$2.isUndefined(t[m]))return i(void 0,t[m])}else return i(void 0,r[m])}function c(m){if(m in r)return i(t[m],r[m]);if(m in t)return i(void 0,t[m])}var l={url:a,method:a,data:a,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 utils$2.forEach(Object.keys(t).concat(Object.keys(r)),function(f){var M=l[f]||o,O=M(f);utils$2.isUndefined(O)&&M!==c||(s[f]=O)}),s},data,hasRequiredData;function requireData(){return hasRequiredData||(hasRequiredData=1,data={version:"0.25.0"}),data}var VERSION=requireData().version,validators$1={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){validators$1[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});var deprecatedWarnings={};validators$1.transitional=function(t,r,s){function i(o,a){return"[Axios v"+VERSION+"] Transitional option '"+o+"'"+a+(s?". "+s:"")}return function(o,a,u){if(t===!1)throw new Error(i(a," has been removed"+(r?" in "+r:"")));return r&&!deprecatedWarnings[a]&&(deprecatedWarnings[a]=!0,console.warn(i(a," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,a,u):!0}};function assertOptions(e,t,r){if(typeof e!="object")throw new TypeError("options must be an object");for(var s=Object.keys(e),i=s.length;i-- >0;){var o=s[i],a=t[o];if(a){var u=e[o],c=u===void 0||a(u,o,e);if(c!==!0)throw new TypeError("option "+o+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+o)}}var validator$1={assertOptions,validators:validators$1},utils$1=utils$8,buildURL=buildURL$1,InterceptorManager=InterceptorManager_1,dispatchRequest=dispatchRequest$1,mergeConfig$1=mergeConfig$2,validator=validator$1,validators=validator.validators;function Axios$1(e){this.defaults=e,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios$1.prototype.request=function(t,r){if(typeof t=="string"?(r=r||{},r.url=t):r=t||{},!r.url)throw new Error("Provided config url is not valid");r=mergeConfig$1(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var s=r.transitional;s!==void 0&&validator.assertOptions(s,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1);var i=[],o=!0;this.interceptors.request.forEach(function(O){typeof O.runWhen=="function"&&O.runWhen(r)===!1||(o=o&&O.synchronous,i.unshift(O.fulfilled,O.rejected))});var a=[];this.interceptors.response.forEach(function(O){a.push(O.fulfilled,O.rejected)});var u;if(!o){var c=[dispatchRequest,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(a),u=Promise.resolve(r);c.length;)u=u.then(c.shift(),c.shift());return u}for(var l=r;i.length;){var m=i.shift(),f=i.shift();try{l=m(l)}catch(M){f(M);break}}try{u=dispatchRequest(l)}catch(M){return Promise.reject(M)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};Axios$1.prototype.getUri=function(t){if(!t.url)throw new Error("Provided config url is not valid");return t=mergeConfig$1(this.defaults,t),buildURL(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")};utils$1.forEach(["delete","get","head","options"],function(t){Axios$1.prototype[t]=function(r,s){return this.request(mergeConfig$1(s||{},{method:t,url:r,data:(s||{}).data}))}});utils$1.forEach(["post","put","patch"],function(t){Axios$1.prototype[t]=function(r,s,i){return this.request(mergeConfig$1(i||{},{method:t,url:r,data:s}))}});var Axios_1=Axios$1,CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var e=requireCancel();function t(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var s;this.promise=new Promise(function(a){s=a});var i=this;this.promise.then(function(o){if(!!i._listeners){var a,u=i._listeners.length;for(a=0;a<u;a++)i._listeners[a](o);i._listeners=null}}),this.promise.then=function(o){var a,u=new Promise(function(c){i.subscribe(c),a=c}).then(o);return u.cancel=function(){i.unsubscribe(a)},u},r(function(a){i.reason||(i.reason=new e(a),s(i.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 i=this._listeners.indexOf(s);i!==-1&&this._listeners.splice(i,1)}},t.source=function(){var s,i=new t(function(a){s=a});return{token:i,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 e=utils$8;return isAxiosError=function(r){return e.isObject(r)&&r.isAxiosError===!0},isAxiosError}var utils=utils$8,bind=bind$2,Axios=Axios_1,mergeConfig=mergeConfig$2,defaults=requireDefaults();function createInstance(e){var t=new Axios(e),r=bind(Axios.prototype.request,t);return utils.extend(r,Axios.prototype,t),utils.extend(r,t),r.create=function(i){return createInstance(mergeConfig(e,i))},r}var axios$1=createInstance(defaults);axios$1.Axios=Axios;axios$1.Cancel=requireCancel();axios$1.CancelToken=requireCancelToken();axios$1.isCancel=requireIsCancel();axios$1.VERSION=requireData().version;axios$1.all=function(t){return Promise.all(t)};axios$1.spread=requireSpread();axios$1.isAxiosError=requireIsAxiosError();axios$2.exports=axios$1;axios$2.exports.default=axios$1;(function(e){e.exports=axios$2.exports})(axios$3);const axios=getDefaultExportFromCjs(axios$3.exports),service=axios.create({withCredentials:!0,timeout:7e3}),requestHandler=function(e){return e},responseHandler=function(e){return e};service.interceptors.request.use(requestHandler);service.interceptors.response.use(responseHandler);const request={install(e){e.provide("request",service)}},_sfc_main=Vue.defineComponent({name:"App",setup(){var r;const e=Vue.inject("app");return{pageConfig:Vue.reactive(((r=e==null?void 0:e.page)==null?void 0:r.data)||{})}}}),_export_sfc=(e,t)=>{const r=e.__vccOpts||e;for(const[s,i]of t)r[s]=i;return r};function _sfc_render(e,t,r,s,i,o){const a=Vue.resolveComponent("magic-ui-page");return Vue.openBlock(),Vue.createBlock(a,{config:e.pageConfig},null,8,["config"])}const AppComponent=_export_sfc(_sfc_main,[["render",_sfc_render],["__file","/parisma/github/tmagic-editor/runtime/vue3/page/App.vue"]]),getLocalConfig=()=>{const configStr=localStorage.getItem("magicDSL");if(!configStr)return[];try{return[eval(`(${configStr})`)]}catch(e){return[]}},magicApp=Vue.createApp(AppComponent);magicApp.use(request);Object.entries(components).forEach(([e,t])=>{magicApp.component(`magic-ui-${e}`,Vue.defineAsyncComponent(t))});Object.values(plugins).forEach(e=>{magicApp.use(e)});const designWidth=document.documentElement.getBoundingClientRect().width,app=new App({designWidth,config:((getUrlParam("localPreview")?getLocalConfig():window.magicDSL)||[])[0]||{},curPage:getUrlParam("page")});magicApp.config.globalProperties.app=app;magicApp.provide("app",app);magicApp.mount("#app");export{_export_sfc as _,__vite_legacy_guard,toLine as t};
|
|
//# sourceMappingURL=index.2a9a64ca.js.map
|