var Q=Object.defineProperty;var Z=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var I=(e,t,n)=>(Z(e,typeof t!="symbol"?t+"":t,n),n);function __vite_legacy_guard(){import("data:text/javascript,")}const p=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerpolicy&&(o.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?o.credentials="include":r.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}};p();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,n,i){return Function.prototype.apply.call(t,n,i)},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 n=[],i=1;i0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(u===void 0)return!1;if(typeof u=="function")ReflectApply(u,this,n);else for(var c=u.length,l=arrayClone(u,c),i=0;i0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,ProcessEmitWarning(a)}return e}EventEmitter.prototype.addListener=function(t,n){return _addListener(this,t,n,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(t,n){return _addListener(this,t,n,!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,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=onceWrapper.bind(i);return r.listener=n,i.wrapFn=r,r}EventEmitter.prototype.once=function(t,n){return checkListener(n),this.on(t,_onceWrap(this,t,n)),this};EventEmitter.prototype.prependOnceListener=function(t,n){return checkListener(n),this.prependListener(t,_onceWrap(this,t,n)),this};EventEmitter.prototype.removeListener=function(t,n){var i,r,o,s,a;if(checkListener(n),r=this._events,r===void 0)return this;if(i=r[t],i===void 0)return this;if(i===n||i.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||n));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===n||i[s].listener===n){a=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():spliceOne(i,o),i.length===1&&(r[t]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(t){var n,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var o=Object.keys(i),s;for(r=0;r=0;r--)this.removeListener(t,n[r]);return this};function _listeners(e,t,n){var i=e._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?n?[r.listener||r]:[r]:n?unwrapListeners(r):arrayClone(r,r.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 n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(e,t){for(var n=new Array(t),i=0;i=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(n).forEach(([i,r])=>{this[i]=r})}}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"},DEFAULT_EVENTS=[{label:"\u70B9\u51FB",value:`${COMMON_EVENT_PREFIX}click`}],getCommonEventName=(e,t)=>{const n=`${e}:${t}`;return e.startsWith(COMMON_EVENT_PREFIX)?n:`${COMMON_EVENT_PREFIX}${n}`},isCommonMethod=e=>e.startsWith(COMMON_METHOD_PREFIX),getDirectComponent=(e,t)=>{var i;if(!e)return!1;if(!e.id)return getDirectComponent(e.parentElement,t);const n=(i=t.page)==null?void 0:i.getNode(e.id);return n||!1},commonClickEventHandler=(e,t,n)=>{const i=getDirectComponent(n.target,e);if(i){const{instance:r,data:o}=i;e.emit(getCommonEventName(t,o.id),r)}},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:n}=t;switch(e.replace(COMMON_METHOD_PREFIX,"")){case CommonMethod.SHOW:n.show();break;case CommonMethod.HIDE:n.hide();break;case CommonMethod.SCROLL_TO_VIEW:n.$el.scrollIntoView({behavior:"smooth"});break;case CommonMethod.SCROLL_TO_TOP:window.scrollTo({top:0,behavior:"smooth"});break}};class Store{constructor(){I(this,"data",{})}set(t,n){this.data[t]=n}get(t){return this.data[t]}}class Node extends events.exports.EventEmitter{constructor(n){super();I(this,"data");I(this,"style");I(this,"events");I(this,"instance");I(this,"page");I(this,"parent");I(this,"app");I(this,"store",new Store);this.page=n.page,this.parent=n.parent,this.app=n.app;const{events:i}=n.config;this.data=n.config,this.events=i,this.listenLifeSafe(),this.once("destroy",()=>{this.instance=null,typeof this.data.destroy=="function"&&this.data.destroy(this),this.listenLifeSafe()})}listenLifeSafe(){this.once("created",n=>{this.instance=n,typeof this.data.created=="function"&&this.data.created(this)}),this.once("mounted",n=>{this.instance=n;const i=this.app.eventQueueMap[n.config.id]||[];for(let r=i.shift();r;r=i.shift())this.app.eventHandler(r.eventConfig,r.fromCpt,r.args);typeof this.data.mounted=="function"&&this.data.mounted(this)})}}class Page extends Node{constructor(n){super(n);I(this,"nodes",new Map);this.setNode(n.config.id,this),this.initNode(n.config,this)}initNode(n,i){var o;const r=new Node({config:n,parent:i,page:this,app:this.app});this.setNode(n.id,r),(o=n.items)==null||o.forEach(s=>{this.initNode(s,r)})}getNode(n){return this.nodes.get(n)}setNode(n,i){this.nodes.set(n,i)}deleteNode(n){this.nodes.delete(n)}}const style2Obj=e=>{if(typeof e!="string")return e;const t={};return e.split(";").forEach(n=>{if(!n)return;const i=n.split(":");let r=i.shift(),o=i.join(":");!r||(r=r.replace(/^\s*/,"").replace(/\s*$/,""),o=o.replace(/^\s*/,"").replace(/\s*$/,""),r=r.split("-").map((s,a)=>a>0?`${s[0].toUpperCase()}${s.substr(1)}`:s).join(""),t[r]=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(n){super();I(this,"env");I(this,"pages",new Map);I(this,"page");I(this,"platform","mobile");I(this,"jsEngine","browser");I(this,"designWidth",375);I(this,"components",new Map);I(this,"eventQueueMap",{});if(this.env=new Env(n.ua),n.platform&&(this.platform=n.platform),n.jsEngine&&(this.jsEngine=n.jsEngine),n.designWidth&&(this.designWidth=n.designWidth),this.platform==="mobile"||this.platform==="editor"){const i=()=>{let{width:r}=document.documentElement.getBoundingClientRect();r=Math.min(800,r);const o=r/(this.designWidth/100);document.documentElement.style.fontSize=`${o}px`};i(),document.body.style.fontSize="14px",globalThis.addEventListener("resize",i)}n.transformStyle&&(this.transformStyle=n.transformStyle),n.config&&this.setConfig(n.config,n.curPage),bindCommonEventListener(this)}transformStyle(n){if(!n)return{};let i={};const r={};typeof n=="string"?i=style2Obj(n):i={...n};const o=["zIndex","opacity","fontWeight"];return Object.entries(i).forEach(([s,a])=>{s==="backgroundImage"?a&&(r[s]=fillBackgroundImage(a)):s==="transform"&&typeof a!="string"?r[s]=Object.entries(a).map(([u,c])=>{let l=0;return u==="scale"&&(l=1),u==="rotate"&&isNumber$1(c)&&(c=`${c}deg`),`${u}(${c||l})`}).join(" "):!o.includes(s)&&a&&/^[-]?[0-9]*[.]?[0-9]*$/.test(a)?r[s]=`${a/100}rem`:r[s]=a}),r}setConfig(n,i){var r,o,s;this.pages=new Map,(r=n.items)==null||r.forEach(a=>{this.pages.set(a.id,new Page({config:a,app:this}))}),this.setPage(i||((s=(o=this.page)==null?void 0:o.data)==null?void 0:s.id))}setPage(n){let i;n&&(i=this.pages.get(n)),i||(i=this.pages.get(this.pages.keys().next().value)),this.page=i,this.platform!=="magic"&&this.bindEvents()}registerComponent(n,i){this.components.set(n,i)}unregisterComponent(n){this.components.delete(n)}resolveComponent(n){return this.components.get(n)}bindEvents(){var n;if(!!this.page){this.removeAllListeners();for(const[,i]of this.page.nodes)(n=i.events)==null||n.forEach(r=>this.bindEvent(r,`${i.data.id}`))}}bindEvent(n,i){let{name:r}=n;DEFAULT_EVENTS.findIndex(o=>o.value===r)>-1&&(r=getCommonEventName(r,i)),this.on(r,(o,...s)=>{this.eventHandler(n,o,s)})}eventHandler(n,i,r){if(!this.page)throw new Error("\u5F53\u524D\u6CA1\u6709\u9875\u9762");const{method:o,to:s}=n,a=this.page.getNode(s);if(!a)throw`ID\u4E3A${s}\u7684\u7EC4\u4EF6\u4E0D\u5B58\u5728`;if(isCommonMethod(o))return triggerCommonMethod(o,a);a.instance?typeof a.instance[o]=="function"&&a.instance[o](i,...r):this.addEventToMap({eventConfig:n,fromCpt:i,args:r})}destroy(){this.removeAllListeners(),this.pages.clear()}addEventToMap(n){this.eventQueueMap[n.eventConfig.to]?this.eventQueueMap[n.eventConfig.to].push(n):this.eventQueueMap[n.eventConfig.to]=[n]}}var dayjs_min={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(commonjsGlobal,function(){var n=1e3,i=6e4,r=36e5,o="millisecond",s="second",a="minute",u="hour",c="day",l="week",f="month",C="quarter",g="year",$="date",h="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|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,b={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("_")},E=function(_,y,m){var A=String(_);return!A||A.length>=y?_:""+Array(y+1-A.length).join(m)+_},d={s:E,z:function(_){var y=-_.utcOffset(),m=Math.abs(y),A=Math.floor(m/60),v=m%60;return(y<=0?"+":"-")+E(A,2,"0")+":"+E(v,2,"0")},m:function _(y,m){if(y.date()1)return _(L[0])}else{var P=y.name;O[P]=y,v=P}return!A&&v&&(T=v),v||!A&&T},N=function(_,y){if(D(_))return _.clone();var m=typeof y=="object"?y:{};return m.date=_,m.args=arguments,new q(m)},S=d;S.l=U,S.i=D,S.w=function(_,y){return N(_,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var q=function(){function _(m){this.$L=U(m.locale,null,!0),this.parse(m)}var y=_.prototype;return y.parse=function(m){this.$d=function(A){var v=A.date,M=A.utc;if(v===null)return new Date(NaN);if(S.u(v))return new Date;if(v instanceof Date)return new Date(v);if(typeof v=="string"&&!/Z$/i.test(v)){var L=v.match(B);if(L){var P=L[2]-1||0,k=(L[7]||"0").substring(0,3);return M?new Date(Date.UTC(L[1],P,L[3]||1,L[4]||0,L[5]||0,L[6]||0,k)):new Date(L[1],P,L[3]||1,L[4]||0,L[5]||0,L[6]||0,k)}}return new Date(v)}(m),this.$x=m.x||{},this.init()},y.init=function(){var m=this.$d;this.$y=m.getFullYear(),this.$M=m.getMonth(),this.$D=m.getDate(),this.$W=m.getDay(),this.$H=m.getHours(),this.$m=m.getMinutes(),this.$s=m.getSeconds(),this.$ms=m.getMilliseconds()},y.$utils=function(){return S},y.isValid=function(){return this.$d.toString()!==h},y.isSame=function(m,A){var v=N(m);return this.startOf(A)<=v&&v<=this.endOf(A)},y.isAfter=function(m,A){return N(m)e.replace(/\B([A-Z])/g,"-$1").toLowerCase(),filterXSS=e=>e.replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),getUrlParam=(e,t)=>{const n=t||location.href,i=new RegExp(`[?&#]${e}=([^&#]+)`,"gi"),r=n.match(i);let o;return r&&r.length>0?(o=r[r.length-1].split("="),o&&o.length>1?filterXSS(o[1]):""):""},_sfc_main$8=Vue.defineComponent({name:"magic-ui-component",props:{config:{type:Object,default:()=>({})}},setup(e){var i;const t=(i=Vue.getCurrentInstance())==null?void 0:i.proxy,n=Vue.inject("app");return Vue.provide("hoc",t),{tagName:Vue.computed(()=>`magic-ui-${toLine(e.config.type)}`),style:Vue.computed(()=>n==null?void 0:n.transformStyle(e.config.style)),display:()=>{var o;const r=(o=e.config)==null?void 0:o.display;return typeof r=="function"?r(n):r!==!1}}}}),_export_sfc=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};function _sfc_render$7(e,t,n,i,r,o){return e.display()?(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(e.tagName),{key:0,id:e.config.id,class:Vue.normalizeClass(`magic-ui-component${e.config.className?` ${e.config.className}`:""}`),style:Vue.normalizeStyle(e.style),config:e.config},null,8,["id","class","style","config"])):Vue.createCommentVNode("v-if",!0)}const Component=_export_sfc(_sfc_main$8,[["render",_sfc_render$7],["__file","/data/magic/tmagic-editor/packages/ui/src/Component.vue"]]),useApp=e=>{var r,o;const t=Vue.inject("app"),n=(r=t==null?void 0:t.page)==null?void 0:r.getNode(e.config.id),i=(o=Vue.getCurrentInstance())==null?void 0:o.proxy;return n==null||n.emit("created",i),Vue.onMounted(()=>{n==null||n.emit("mounted",i)}),Vue.onUnmounted(()=>{n==null||n.emit("destroy",i)}),t},_sfc_main$7=Vue.defineComponent({name:"magic-ui-page",components:{"magic-ui-component":Component},props:{config:{type:Object,default:()=>({})}},setup(e){const t=useApp(e);return{style:Vue.computed(()=>t==null?void 0:t.transformStyle(e.config.style||{})),refresh(){window.location.reload()}}}}),_hoisted_1$3=["id"];function _sfc_render$6(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-component");return Vue.openBlock(),Vue.createElementBlock("div",{id:`${e.config.id||""}`,class:Vue.normalizeClass(`magic-ui-page magic-ui-container${e.config.className?` ${e.config.className}`:""}`),style:Vue.normalizeStyle(e.style)},[Vue.renderSlot(e.$slots,"default"),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.config.items,a=>(Vue.openBlock(),Vue.createBlock(s,{key:a.id,config:a},null,8,["config"]))),128))],14,_hoisted_1$3)}const page=_export_sfc(_sfc_main$7,[["render",_sfc_render$6],["__file","/data/magic/tmagic-editor/packages/ui/src/page/src/index.vue"]]),useCommonMethod=e=>({show:()=>{e.config.style.display="initial"},hide:()=>{e.config.style.display="none"}}),_sfc_main$6=Vue.defineComponent({name:"magic-ui-container",components:{"magic-ui-component":Component},props:{config:{type:Object,default:()=>({})}},setup(e){const t=useApp(e);return{style:Vue.computed(()=>t==null?void 0:t.transformStyle(e.config.style||{})),display:()=>{var i;const n=(i=e.config)==null?void 0:i.display;return typeof n=="function"?n(t):n!==!1},...useCommonMethod(e)}}}),_hoisted_1$2=["id"];function _sfc_render$5(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-component");return e.display()?(Vue.openBlock(),Vue.createElementBlock("div",{key:0,id:`${e.config.id||""}`,class:Vue.normalizeClass(`magic-ui-container${e.config.className?` ${e.config.className}`:""}`),style:Vue.normalizeStyle(e.style)},[Vue.renderSlot(e.$slots,"default"),(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.config.items,a=>(Vue.openBlock(),Vue.createBlock(s,{key:a.id,config:a},null,8,["config"]))),128))],14,_hoisted_1$2)):Vue.createCommentVNode("v-if",!0)}const container=_export_sfc(_sfc_main$6,[["render",_sfc_render$5],["__file","/data/magic/tmagic-editor/packages/ui/src/container/src/Container.vue"]]),_sfc_main$5=Vue.defineComponent({name:"magic-ui-button",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var a;useApp(e);const t=(a=Vue.getCurrentInstance())==null?void 0:a.proxy,n=Vue.reactive([]),i=Vue.computed(()=>[typeof e.config.preAction=="function"?e.config.preAction:()=>!0,...n,typeof e.config.postAction=="function"?e.config.postAction:()=>!0]);function r(u){n.push(u)}async function o(){for(const u of i.value)if(typeof u=="function"&&await u(t,{model:e.model})===!1)break}const s=Vue.computed(()=>{var u,c,l;return{type:"text",text:((u=e.config)==null?void 0:u.text)||"",disabledText:((c=e.config)==null?void 0:c.disabledText)||"",html:((l=e.config)==null?void 0:l.html)||""}});return{pushAction:r,clickHandler:o,textConfig:s}}});function _sfc_render$4(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-text");return Vue.openBlock(),Vue.createElementBlock("button",{class:"magic-ui-button",onClick:t[0]||(t[0]=(...a)=>e.clickHandler&&e.clickHandler(...a))},[Vue.renderSlot(e.$slots,"default",{},()=>[Vue.createVNode(s,{config:e.textConfig},null,8,["config"])])])}const button=_export_sfc(_sfc_main$5,[["render",_sfc_render$4],["__file","/data/magic/tmagic-editor/packages/ui/src/button/src/index.vue"]]),_sfc_main$4=Vue.defineComponent({name:"magic-ui-text",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})},vars:{type:Object,default:()=>({})}},setup(e){var r;useApp(e);const t=(r=Vue.getCurrentInstance())==null?void 0:r.proxy,n=Vue.inject("hoc");return{displayText:Vue.computed(()=>{var a,u;let o=((a=e.config)==null?void 0:a.text)||"";const{vars:s}=e;if((n==null?void 0:n.disabled)&&((u=e.config)==null?void 0:u.disabledText)&&(o=e.config.disabledText),typeof o=="function")return o.bind(t)(t,{model:e.model});if(Object.prototype.toString.call(s)==="[object Object]"){let c=o;return Object.entries(s).forEach(([l,f])=>{c=c.replace(new RegExp(`{{${l}}}`,"g"),f)}),c}return o||""})}},render(){var t,n,i,r;const e=(t=this.config)!=null&&t.multiple?"magic-ui-text":"magic-ui-text magic-ui-text--single-line";return typeof((n=this.$slots)==null?void 0:n.default)=="function"?Vue.h("span",{class:e},[((r=(i=this.$slots)==null?void 0:i.default)==null?void 0:r.call(i))||""]):Vue.h("span",{class:e,...this.displayText?{innerHTML:this.displayText}:{}})}}),text=_export_sfc(_sfc_main$4,[["__file","/data/magic/tmagic-editor/packages/ui/src/text/src/index.vue"]]),_sfc_main$3=Vue.defineComponent({name:"magic-ui-img",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){return useApp(e),{clickHandler(){e.config.url&&(window.location.href=e.config.url)}}}}),_hoisted_1$1=["src"];function _sfc_render$3(e,t,n,i,r,o){return Vue.openBlock(),Vue.createElementBlock("img",{class:"magic-ui-img",src:e.config.src,onClick:t[0]||(t[0]=(...s)=>e.clickHandler&&e.clickHandler(...s))},null,8,_hoisted_1$1)}const img=_export_sfc(_sfc_main$3,[["render",_sfc_render$3],["__file","/data/magic/tmagic-editor/packages/ui/src/img/src/index.vue"]]);var browser={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode$1={},utils$a={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$a.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};utils$a.getSymbolTotalCodewords=function(t){return CODEWORDS_COUNT[t]};utils$a.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};utils$a.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=t};utils$a.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$a.toSJIS=function(t){return toSJISFunction(t)};var errorCorrectionLevel={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,r){if(e.isValid(i))return i;try{return t(i)}catch{return r}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let n=0;n>>t-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}BitMatrix$1.prototype.set=function(e,t,n,i){const r=e*this.size+t;this.data[r]=n,i&&(this.reservedBit[r]=!0)};BitMatrix$1.prototype.get=function(e,t){return this.data[e*this.size+t]};BitMatrix$1.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n};BitMatrix$1.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(e){const t=utils$a.getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const r=Math.floor(i/7)+2,o=t(i),s=o===145?26:Math.ceil((o-13)/(2*r-2))*2,a=[o-7];for(let u=1;u=0&&r<=7},e.from=function(r){return e.isValid(r)?parseInt(r,10):void 0},e.getPenaltyN1=function(r){const o=r.size;let s=0,a=0,u=0,c=null,l=null;for(let f=0;f=5&&(s+=t.N1+(a-5)),c=g,a=1),g=r.get(C,f),g===l?u++:(u>=5&&(s+=t.N1+(u-5)),l=g,u=1)}a>=5&&(s+=t.N1+(a-5)),u>=5&&(s+=t.N1+(u-5))}return s},e.getPenaltyN2=function(r){const o=r.size;let s=0;for(let a=0;a=10&&(a===1488||a===93)&&s++,u=u<<1&2047|r.get(l,c),l>=10&&(u===1488||u===93)&&s++}return s*t.N3},e.getPenaltyN4=function(r){let o=0;const s=r.data.length;for(let u=0;u=0;){const s=o[0];for(let u=0;u0){const o=new Uint8Array(this.degree);return o.set(i,r),o}return i};var reedSolomonEncoder=ReedSolomonEncoder$1,version={},mode={},versionCheck={};versionCheck.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r ]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(t){return TEST_KANJI.test(t)};regex.testNumeric=function(t){return TEST_NUMERIC.test(t)};regex.testAlphanumeric=function(t){return TEST_ALPHANUMERIC.test(t)};(function(e){const t=versionCheck,n=regex;e.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return n.testNumeric(o)?e.NUMERIC:n.testAlphanumeric(o)?e.ALPHANUMERIC:n.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function i(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+r)}}e.from=function(o,s){if(e.isValid(o))return o;try{return i(o)}catch{return s}}})(mode);(function(e){const t=utils$a,n=errorCorrectionCode,i=errorCorrectionLevel,r=mode,o=versionCheck,s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,a=t.getBCHDigit(s);function u(C,g,$){for(let h=1;h<=40;h++)if(g<=e.getCapacity(h,$,C))return h}function c(C,g){return r.getCharCountIndicator(C,g)+4}function l(C,g){let $=0;return C.forEach(function(h){$+=c(h.mode,g)+h.getBitsLength()}),$}function f(C,g){for(let $=1;$<=40;$++)if(l(C,$)<=e.getCapacity($,g,r.MIXED))return $}e.from=function(g,$){return o.isValid(g)?parseInt(g,10):$},e.getCapacity=function(g,$,h){if(!o.isValid(g))throw new Error("Invalid QR Code version");typeof h>"u"&&(h=r.BYTE);const B=t.getSymbolTotalCodewords(g),w=n.getTotalCodewordsCount(g,$),b=(B-w)*8;if(h===r.MIXED)return b;const E=b-c(h,g);switch(h){case r.NUMERIC:return Math.floor(E/10*3);case r.ALPHANUMERIC:return Math.floor(E/11*2);case r.KANJI:return Math.floor(E/13);case r.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(g,$){let h;const B=i.from($,i.M);if(Array.isArray(g)){if(g.length>1)return f(g,B);if(g.length===0)return 1;h=g[0]}else h=g;return u(h.mode,h.getLength(),B)},e.getEncodedBits=function(g){if(!o.isValid(g)||g<7)throw new Error("Invalid QR Code version");let $=g<<12;for(;t.getBCHDigit($)-a>=0;)$^=s<=0;)r^=G15<0&&(i=this.data.substr(n),r=parseInt(i,10),t.put(r,o*3+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(e){this.mode=Mode$3.ALPHANUMERIC,this.data=e}AlphanumericData.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(t){let n;for(n=0;n+2<=this.data.length;n+=2){let i=ALPHA_NUM_CHARS.indexOf(this.data[n])*45;i+=ALPHA_NUM_CHARS.indexOf(this.data[n+1]),t.put(i,11)}this.data.length%2&&t.put(ALPHA_NUM_CHARS.indexOf(this.data[n]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(t){for(var n=[],i=t.length,r=0;r=55296&&o<=56319&&i>r+1){var s=t.charCodeAt(r+1);s>=56320&&s<=57343&&(o=(o-55296)*1024+s-56320+65536,r+=1)}if(o<128){n.push(o);continue}if(o<2048){n.push(o>>6|192),n.push(o&63|128);continue}if(o<55296||o>=57344&&o<65536){n.push(o>>12|224),n.push(o>>6&63|128),n.push(o&63|128);continue}if(o>=65536&&o<=1114111){n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(o&63|128);continue}n.push(239,191,189)}return new Uint8Array(n).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(e){this.mode=Mode$2.BYTE,this.data=new Uint8Array(encodeUtf8(e))}ByteData.getBitsLength=function(t){return t*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(e){for(let t=0,n=this.data.length;t=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(e){var t={single_source_shortest_paths:function(n,i,r){var o={},s={};s[i]=0;var a=t.PriorityQueue.make();a.push(i,0);for(var u,c,l,f,C,g,$,h,B;!a.empty();){u=a.pop(),c=u.value,f=u.cost,C=n[c]||{};for(l in C)C.hasOwnProperty(l)&&(g=C[l],$=f+g,h=s[l],B=typeof s[l]>"u",(B||h>$)&&(s[l]=$,a.push(l,$),o[l]=c))}if(typeof r<"u"&&typeof s[r]>"u"){var w=["Could not find a path from ",i," to ",r,"."].join("");throw new Error(w)}return o},extract_shortest_path_from_predecessor_list:function(n,i){for(var r=[],o=i;o;)r.push(o),n[o],o=n[o];return r.reverse(),r},find_path:function(n,i,r){var o=t.single_source_shortest_paths(n,i,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(n){var i=t.PriorityQueue,r={},o;n=n||{};for(o in i)i.hasOwnProperty(o)&&(r[o]=i[o]);return r.queue=[],r.sorter=n.sorter||i.default_sorter,r},default_sorter:function(n,i){return n.cost-i.cost},push:function(n,i){var r={value:n,cost:i};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(dijkstra);(function(e){const t=mode,n=numericData,i=alphanumericData,r=byteData,o=kanjiData,s=regex,a=utils$a,u=dijkstra.exports;function c(w){return unescape(encodeURIComponent(w)).length}function l(w,b,E){const d=[];let T;for(;(T=w.exec(E))!==null;)d.push({data:T[0],index:T.index,mode:b,length:T[0].length});return d}function f(w){const b=l(s.NUMERIC,t.NUMERIC,w),E=l(s.ALPHANUMERIC,t.ALPHANUMERIC,w);let d,T;return a.isKanjiModeEnabled()?(d=l(s.BYTE,t.BYTE,w),T=l(s.KANJI,t.KANJI,w)):(d=l(s.BYTE_KANJI,t.BYTE,w),T=[]),b.concat(E,d,T).sort(function(D,U){return D.index-U.index}).map(function(D){return{data:D.data,mode:D.mode,length:D.length}})}function C(w,b){switch(b){case t.NUMERIC:return n.getBitsLength(w);case t.ALPHANUMERIC:return i.getBitsLength(w);case t.KANJI:return o.getBitsLength(w);case t.BYTE:return r.getBitsLength(w)}}function g(w){return w.reduce(function(b,E){const d=b.length-1>=0?b[b.length-1]:null;return d&&d.mode===E.mode?(b[b.length-1].data+=E.data,b):(b.push(E),b)},[])}function $(w){const b=[];for(let E=0;E=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?e.set(o+a,s+u,!0,!0):e.set(o+a,s+u,!1,!0))}}function setupTimingPattern(e){const t=e.size;for(let n=8;n>a&1)===1,e.set(r,o,s,!0),e.set(o,r,s,!0)}function setupFormatInfo(e,t,n){const i=e.size,r=FormatInfo.getEncodedBits(t,n);let o,s;for(o=0;o<15;o++)s=(r>>o&1)===1,o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(i-15+o,8,s,!0),o<8?e.set(8,i-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(i-8,8,1,!0)}function setupData(e,t){const n=e.size;let i=-1,r=n-1,o=7,s=0;for(let a=n-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!e.isReserved(r,a-u)){let c=!1;s>>o&1)===1),e.set(r,a-u,c),o--,o===-1&&(s++,o=7)}if(r+=i,r<0||n<=r){r-=i,i=-i;break}}}function createData(e,t,n){const i=new BitBuffer;n.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),Mode.getCharCountIndicator(u.mode,e)),u.write(i)});const r=Utils$1.getSymbolTotalCodewords(e),o=ECCode.getTotalCodewordsCount(e,t),s=(r-o)*8;for(i.getLengthInBits()+4<=s&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);const a=(s-i.getLengthInBits())/8;for(let u=0;u=7&&setupVersionInfo(u,t),setupData(u,s),isNaN(i)&&(i=MaskPattern.getBestMask(u,setupFormatInfo.bind(null,u,n))),MaskPattern.applyMask(i,u),setupFormatInfo(u,n,i),{modules:u,version:t,errorCorrectionLevel:n,maskPattern:i,segments:r}}qrcode$1.create=function(t,n){if(typeof t>"u"||t==="")throw new Error("No input text");let i=ECLevel.M,r,o;return typeof n<"u"&&(i=ECLevel.from(n.errorCorrectionLevel,ECLevel.M),r=Version.from(n.version),o=MaskPattern.from(n.maskPattern),n.toSJISFunc&&Utils$1.setToSJISFunction(n.toSJISFunc)),createSymbol(t,r,i,o)};var canvas={},utils$9={};(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let i=n.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+n);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(o){return[o,o]}))),i.length===6&&i.push("F","F");const r=parseInt(i.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const r=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,o=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:o,scale:o?4:s,margin:r,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,r){return r.width&&r.width>=i+r.margin*2?r.width/(i+r.margin*2):r.scale},e.getImageWidth=function(i,r){const o=e.getScale(i,r);return Math.floor((i+r.margin*2)*o)},e.qrToImageData=function(i,r,o){const s=r.modules.size,a=r.modules.data,u=e.getScale(s,o),c=Math.floor((s+o.margin*2)*u),l=o.margin*u,f=[o.color.light,o.color.dark];for(let C=0;C=l&&g>=l&&C"u"&&(!s||!s.getContext)&&(u=s,s=void 0),s||(c=i()),u=t.getOptions(u);const l=t.getImageWidth(o.modules.size,u),f=c.getContext("2d"),C=f.createImageData(l,l);return t.qrToImageData(C.data,o,u),n(f,c,l),f.putImageData(C,0,0),c},e.renderToDataURL=function(o,s,a){let u=a;typeof u>"u"&&(!s||!s.getContext)&&(u=s,s=void 0),u||(u={});const c=e.render(o,s,u),l=u.type||"image/png",f=u.rendererOpts||{};return c.toDataURL(l,f.quality)}})(canvas);var svgTag={};const Utils=utils$9;function getColorAttrib(e,t){const n=e.a/255,i=t+'="'+e.hex+'"';return n<1?i+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':i}function svgCmd(e,t,n){let i=e+t;return typeof n<"u"&&(i+=" "+n),i}function qrToPath(e,t,n){let i="",r=0,o=!1,s=0;for(let a=0;a0&&u>0&&e[a-1]||(i+=o?svgCmd("M",u+n,.5+c+n):svgCmd("m",r,0),r=0,o=!1),u+1':"",c="',l='viewBox="0 0 '+a+" "+a+'"',f=r.width?'width="'+r.width+'" height="'+r.width+'" ':"",C=''+u+c+` `;return typeof i=="function"&&i(null,C),C};const canPromise=canPromise$1,QRCode=qrcode$1,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(e,t,n,i,r){const o=[].slice.call(arguments,1),s=o.length,a=typeof o[s-1]=="function";if(!a&&!canPromise())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(r=n,n=t,t=i=void 0):s===3&&(t.getContext&&typeof r>"u"?(r=i,i=void 0):(r=i,i=n,n=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(n=t,t=i=void 0):s===2&&!t.getContext&&(i=n,n=t,t=void 0),new Promise(function(u,c){try{const l=QRCode.create(n,i);u(e(l,t,i))}catch(l){c(l)}})}try{const u=QRCode.create(n,i);r(null,e(u,t,i))}catch(u){r(u)}}browser.create=QRCode.create;browser.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser.toString=renderCanvas.bind(null,function(e,t,n){return SvgRenderer.render(e,n)});const _sfc_main$2=Vue.defineComponent({name:"magic-ui-qrcode",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){useApp(e);const t=Vue.ref();return Vue.watch(()=>e.config.url,(n="")=>{browser.toDataURL(n,(i,r)=>{i&&console.error(i),t.value=r})},{immediate:!0}),{imgUrl:t}}}),_hoisted_1=["src"];function _sfc_render$2(e,t,n,i,r,o){return Vue.openBlock(),Vue.createElementBlock("img",{class:"magic-ui-qrcode",src:e.imgUrl},null,8,_hoisted_1)}const qrcode=_export_sfc(_sfc_main$2,[["render",_sfc_render$2],["__file","/data/magic/tmagic-editor/packages/ui/src/qrcode/src/index.vue"]]),_sfc_main$1=Vue.defineComponent({name:"magic-ui-overlay",props:{config:{type:Object,default:()=>({})},model:{type:Object,default:()=>({})}},setup(e){var s;const t=Vue.ref(!1),n=useApp(e),i=(s=n==null?void 0:n.page)==null?void 0:s.getNode(e.config.id),r=()=>{t.value=!0,n&&n.emit("overlay:open",i)},o=()=>{t.value=!1,n&&n.emit("overlay:close",i)};return n==null||n.on("editor:select",(a,u)=>{u.find(c=>c.id===e.config.id)?r():o()}),{visible:t,openOverlay:r,closeOverlay:o}}});function _sfc_render$1(e,t,n,i,r,o){const s=Vue.resolveComponent("magic-ui-container");return e.visible?(Vue.openBlock(),Vue.createBlock(s,{key:0,class:"magic-ui-overlay",config:{items:e.config.items}},{default:Vue.withCtx(()=>[Vue.renderSlot(e.$slots,"default")]),_:3},8,["config"])):Vue.createCommentVNode("v-if",!0)}const overlay=_export_sfc(_sfc_main$1,[["render",_sfc_render$1],["__file","/data/magic/tmagic-editor/packages/ui/src/overlay/src/index.vue"]]),components={page,container,button,text,img,qrcode,overlay},plugins={};var axios$3={exports:{}},axios$2={exports:{}},bind$2=function(t,n){return function(){for(var r=new Array(arguments.length),o=0;o"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 n=0,i=e.length;n"u"||(utils$7.isArray(u)?c=c+"[]":u=[u],utils$7.forEach(u,function(f){utils$7.isDate(f)?f=f.toISOString():utils$7.isObject(f)&&(f=JSON.stringify(f)),o.push(encode(c)+"="+encode(f))}))}),r=o.join("&")}if(r){var s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+r}return t},utils$6=utils$8;function InterceptorManager$1(){this.handlers=[]}InterceptorManager$1.prototype.use=function(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.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(i){i!==null&&t(i)})};var InterceptorManager_1=InterceptorManager$1,utils$5=utils$8,normalizeHeaderName=function(t,n){utils$5.forEach(t,function(r,o){o!==n&&o.toUpperCase()===n.toUpperCase()&&(t[n]=r,delete t[o])})},enhanceError=function(t,n,i,r,o){return t.config=n,i&&(t.code=i),t.request=r,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(n,i,r,o,s){var a=new Error(n);return e(a,i,r,o,s)},createError}var settle,hasRequiredSettle;function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var e=requireCreateError();return settle=function(n,i,r){var o=r.config.validateStatus;!r.status||!o||o(r.status)?n(r):i(e("Request failed with status code "+r.status,r.config,null,r.request,r))},settle}var cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var e=utils$8;return cookies=e.isStandardBrowserEnv()?function(){return{write:function(i,r,o,s,a,u){var c=[];c.push(i+"="+encodeURIComponent(r)),e.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),e.isString(s)&&c.push("path="+s),e.isString(a)&&c.push("domain="+a),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(i){var r=document.cookie.match(new RegExp("(^|;\\s*)("+i+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(i){this.write(i,"",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,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t}),combineURLs}var buildFullPath,hasRequiredBuildFullPath;function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var e=requireIsAbsoluteURL(),t=requireCombineURLs();return buildFullPath=function(i,r){return i&&!e(r)?t(i,r):r},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(i){var r={},o,s,a;return i&&e.forEach(i.split(` `),function(c){if(a=c.indexOf(":"),o=e.trim(c.substr(0,a)).toLowerCase(),s=e.trim(c.substr(a+1)),o){if(r[o]&&t.indexOf(o)>=0)return;o==="set-cookie"?r[o]=(r[o]?r[o]:[]).concat([s]):r[o]=r[o]?r[o]+", "+s:s}}),r},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var e=utils$8;return isURLSameOrigin=e.isStandardBrowserEnv()?function(){var n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),r;function o(s){var a=s;return n&&(i.setAttribute("href",a),a=i.href),i.setAttribute("href",a),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:i.pathname.charAt(0)==="/"?i.pathname:"/"+i.pathname}}return r=o(window.location.href),function(a){var u=e.isString(a)?o(a):a;return u.protocol===r.protocol&&u.host===r.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(),n=requireCookies(),i=buildURL$1,r=requireBuildFullPath(),o=requireParseHeaders(),s=requireIsURLSameOrigin(),a=requireCreateError(),u=requireDefaults(),c=requireCancel();return xhr=function(f){return new Promise(function(g,$){var h=f.data,B=f.headers,w=f.responseType,b;function E(){f.cancelToken&&f.cancelToken.unsubscribe(b),f.signal&&f.signal.removeEventListener("abort",b)}e.isFormData(h)&&delete B["Content-Type"];var d=new XMLHttpRequest;if(f.auth){var T=f.auth.username||"",O=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";B.Authorization="Basic "+btoa(T+":"+O)}var D=r(f.baseURL,f.url);d.open(f.method.toUpperCase(),i(D,f.params,f.paramsSerializer),!0),d.timeout=f.timeout;function U(){if(!!d){var S="getAllResponseHeaders"in d?o(d.getAllResponseHeaders()):null,q=!w||w==="text"||w==="json"?d.responseText:d.response,j={data:q,status:d.status,statusText:d.statusText,headers:S,config:f,request:d};t(function(y){g(y),E()},function(y){$(y),E()},j),d=null}}if("onloadend"in d?d.onloadend=U:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(U)},d.onabort=function(){!d||($(a("Request aborted",f,"ECONNABORTED",d)),d=null)},d.onerror=function(){$(a("Network Error",f,null,d)),d=null},d.ontimeout=function(){var q=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",j=f.transitional||u.transitional;f.timeoutErrorMessage&&(q=f.timeoutErrorMessage),$(a(q,f,j.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",d)),d=null},e.isStandardBrowserEnv()){var N=(f.withCredentials||s(D))&&f.xsrfCookieName?n.read(f.xsrfCookieName):void 0;N&&(B[f.xsrfHeaderName]=N)}"setRequestHeader"in d&&e.forEach(B,function(q,j){typeof h>"u"&&j.toLowerCase()==="content-type"?delete B[j]:d.setRequestHeader(j,q)}),e.isUndefined(f.withCredentials)||(d.withCredentials=!!f.withCredentials),w&&w!=="json"&&(d.responseType=f.responseType),typeof f.onDownloadProgress=="function"&&d.addEventListener("progress",f.onDownloadProgress),typeof f.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(b=function(S){!d||($(!S||S&&S.type?new c("canceled"):S),d.abort(),d=null)},f.cancelToken&&f.cancelToken.subscribe(b),f.signal&&(f.signal.aborted?b():f.signal.addEventListener("abort",b))),h||(h=null),d.send(h)})},xhr}var defaults_1,hasRequiredDefaults;function requireDefaults(){if(hasRequiredDefaults)return defaults_1;hasRequiredDefaults=1;var e=utils$8,t=normalizeHeaderName,n=enhanceError,i={"Content-Type":"application/x-www-form-urlencoded"};function r(u,c){!e.isUndefined(u)&&e.isUndefined(u["Content-Type"])&&(u["Content-Type"]=c)}function o(){var u;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(u=requireXhr()),u}function s(u,c,l){if(e.isString(u))try{return(c||JSON.parse)(u),e.trim(u)}catch(f){if(f.name!=="SyntaxError")throw f}return(l||JSON.stringify)(u)}var a={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:o(),transformRequest:[function(c,l){return t(l,"Accept"),t(l,"Content-Type"),e.isFormData(c)||e.isArrayBuffer(c)||e.isBuffer(c)||e.isStream(c)||e.isFile(c)||e.isBlob(c)?c:e.isArrayBufferView(c)?c.buffer:e.isURLSearchParams(c)?(r(l,"application/x-www-form-urlencoded;charset=utf-8"),c.toString()):e.isObject(c)||l&&l["Content-Type"]==="application/json"?(r(l,"application/json"),s(c)):c}],transformResponse:[function(c){var l=this.transitional||a.transitional,f=l&&l.silentJSONParsing,C=l&&l.forcedJSONParsing,g=!f&&this.responseType==="json";if(g||C&&e.isString(c)&&c.length)try{return JSON.parse(c)}catch($){if(g)throw $.name==="SyntaxError"?n($,this,"E_JSON_PARSE"):$}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 e.forEach(["delete","get","head"],function(c){a.headers[c]={}}),e.forEach(["post","put","patch"],function(c){a.headers[c]=e.merge(i)}),defaults_1=a,defaults_1}var utils$4=utils$8,defaults$2=requireDefaults(),transformData$1=function(t,n,i){var r=this||defaults$2;return utils$4.forEach(i,function(s){t=s.call(r,t,n)}),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(r){delete t.headers[r]});var n=t.adapter||defaults$1.adapter;return n(t).then(function(r){return throwIfCancellationRequested(t),r.data=transformData.call(t,r.data,r.headers,t.transformResponse),r},function(r){return isCancel(r)||(throwIfCancellationRequested(t),r&&r.response&&(r.response.data=transformData.call(t,r.response.data,r.response.headers,t.transformResponse))),Promise.reject(r)})},utils$2=utils$8,mergeConfig$2=function(t,n){n=n||{};var i={};function r(l,f){return utils$2.isPlainObject(l)&&utils$2.isPlainObject(f)?utils$2.merge(l,f):utils$2.isPlainObject(f)?utils$2.merge({},f):utils$2.isArray(f)?f.slice():f}function o(l){if(utils$2.isUndefined(n[l])){if(!utils$2.isUndefined(t[l]))return r(void 0,t[l])}else return r(t[l],n[l])}function s(l){if(!utils$2.isUndefined(n[l]))return r(void 0,n[l])}function a(l){if(utils$2.isUndefined(n[l])){if(!utils$2.isUndefined(t[l]))return r(void 0,t[l])}else return r(void 0,n[l])}function u(l){if(l in n)return r(t[l],n[l]);if(l in t)return r(void 0,t[l])}var c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};return utils$2.forEach(Object.keys(t).concat(Object.keys(n)),function(f){var C=c[f]||o,g=C(f);utils$2.isUndefined(g)&&C!==u||(i[f]=g)}),i},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(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});var deprecatedWarnings={};validators$1.transitional=function(t,n,i){function r(o,s){return"[Axios v"+VERSION+"] Transitional option '"+o+"'"+s+(i?". "+i:"")}return function(o,s,a){if(t===!1)throw new Error(r(s," has been removed"+(n?" in "+n:"")));return n&&!deprecatedWarnings[s]&&(deprecatedWarnings[s]=!0,console.warn(r(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,s,a):!0}};function assertOptions(e,t,n){if(typeof e!="object")throw new TypeError("options must be an object");for(var i=Object.keys(e),r=i.length;r-- >0;){var o=i[r],s=t[o];if(s){var a=e[o],u=a===void 0||s(a,o,e);if(u!==!0)throw new TypeError("option "+o+" must be "+u);continue}if(n!==!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,n){if(typeof t=="string"?(n=n||{},n.url=t):n=t||{},!n.url)throw new Error("Provided config url is not valid");n=mergeConfig$1(this.defaults,n),n.method?n.method=n.method.toLowerCase():this.defaults.method?n.method=this.defaults.method.toLowerCase():n.method="get";var i=n.transitional;i!==void 0&&validator.assertOptions(i,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1);var r=[],o=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(o=o&&g.synchronous,r.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var a;if(!o){var u=[dispatchRequest,void 0];for(Array.prototype.unshift.apply(u,r),u=u.concat(s),a=Promise.resolve(n);u.length;)a=a.then(u.shift(),u.shift());return a}for(var c=n;r.length;){var l=r.shift(),f=r.shift();try{c=l(c)}catch(C){f(C);break}}try{a=dispatchRequest(c)}catch(C){return Promise.reject(C)}for(;s.length;)a=a.then(s.shift(),s.shift());return a};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(n,i){return this.request(mergeConfig$1(i||{},{method:t,url:n,data:(i||{}).data}))}});utils$1.forEach(["post","put","patch"],function(t){Axios$1.prototype[t]=function(n,i,r){return this.request(mergeConfig$1(r||{},{method:t,url:n,data:i}))}});var Axios_1=Axios$1,CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var e=requireCancel();function t(n){if(typeof n!="function")throw new TypeError("executor must be a function.");var i;this.promise=new Promise(function(s){i=s});var r=this;this.promise.then(function(o){if(!!r._listeners){var s,a=r._listeners.length;for(s=0;s{const configStr=localStorage.getItem("magicDSL");if(!configStr)return[];try{return[eval(`(${configStr})`)]}catch(e){return[]}},magicApp=Vue.createApp(AppComponent);magicApp.use(request);Object.values(components).forEach(e=>{magicApp.component(e.name,e)});Object.values(plugins).forEach(e=>{magicApp.use(e)});const app=new App({config:((getUrlParam("localPreview")?getLocalConfig():window.magicDSL)||[])[0]||{},curPage:getUrlParam("page")});magicApp.config.globalProperties.app=app;magicApp.provide("app",app);magicApp.mount("#app");export{__vite_legacy_guard}; //# sourceMappingURL=index.30b4791d.js.map