@chamn/render 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -3,7 +3,7 @@
3
3
  data struct format is invalidate`);return o.message||r?console.warn(`${o.message||r}
4
4
  originData: ${JSON.stringify(e)}`):console.warn(`${JSON.stringify(e)}
5
5
  data struct format is invalidate`),o},pr=t=>{const{data:e,message:r,throwError:n,dataStruct:o}=t;return Cf(({data:a})=>{try{return Yn(a,o),{isValidate:!0}}catch(s){let i=s;return s instanceof Qn&&(i=s.failures().map(c=>`【${c.path.join(".")}】: ${c.message}
6
- `)),{isValidate:!1,message:i,error:s}}})({data:e,message:r,throwError:n})};var $t=(t=>(t.ROOT_CONTAINER="RootContainer",t))($t||{});const wf=w({type:U(z.FUNCTION),value:h()}),Ef=ar(Kn(Tt,["componentName"]),w({componentName:U("RootContainer")}));function Nf(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(o){o(r)}),(n=t.get("*"))&&n.slice().map(function(o){o(e,r)})}}}const Kt=Nf(),Tf=(t,e)=>{const r={...t,value:[]},n=t.value;let o=new vt([]);return e&&(o=e.materialsMode||new vt([])),n&&(x(n)?r.value=n.map(a=>new A(a,{parent:e,materials:o})):B(n)&&r.value.push(new A(n,{parent:e,materials:o}))),r};class At{constructor(e,r){j(this,"nodeType","SLOT"),j(this,"rawData"),j(this,"parent"),j(this,"emitter",Kt),j(this,"data"),j(this,"id"),j(this,"materialsMode"),this.parent=(r==null?void 0:r.parent)||null,this.rawData=e;const n=(r==null?void 0:r.materials)||new vt([]);this.materialsMode=n,this.id=X(),this.data=Tf(e,this)}get value(){return this.data}export(e){const r=this.data,n=o=>{if(o instanceof A)return o.export(e);if(B(o)){const a={};return Object.keys(o||{}).forEach(s=>{a[s]=n(o[s])}),a}return x(o)?o.map(a=>n(a)):(e==="design"&&delete o.id,o)};return n(r)}}const ro=t=>{let e=[];return t.forEach(r=>{const n=r;n.type?n.type===dr.SINGLE?e.push(n.content):n.type===dr.GROUP&&(e=[...e,...ro(n.content)]):e.push(r)}),e},hr=(t,e,r)=>{if(t.type)return t.type===z.SLOT?new At(t,{parent:e,materials:r}):t;if(B(t)){const n={};return Object.keys(t).forEach(o=>{n[o]=mr(t[o],e,r)}),n}else return Array.isArray(t)?t.map(n=>hr(n,e,r)):t},mr=(t,e,r)=>B(t)?hr(t,e,r):x(t)?t.map(n=>hr(n,e,r)):t;class it{constructor(e,r,n){j(this,"nodeType","PROP"),j(this,"rawData"),j(this,"parent"),j(this,"emitter",Kt),j(this,"data"),j(this,"name"),j(this,"materialsMode");const o=(n==null?void 0:n.materials)||new vt([]);this.materialsMode=o,this.parent=n==null?void 0:n.parent,this.rawData=r,this.name=e,this.data=mr(r,this,o)}isIncludeSlot(){return!1}isIncludeExpression(){return!1}get value(){return this.data}updateValue(e){const r=this.data;this.data=mr(e??r,this,this.materialsMode),this.emitter.emit("onPropChange",{value:this.data,preValue:r,node:this}),this.parent&&!(this.parent instanceof At)&&this.emitter.emit("onNodeChange",{value:this.parent.value,preValue:this.parent.value,node:this.parent})}get material(){const e=this.parent;if(e instanceof A){const r=e.material;return ro((r==null?void 0:r.value.props)||[]).find(n=>n.name===this.name)}else return null}export(e){const r=this.data,n=o=>{if(o instanceof it||o instanceof At||o instanceof A)return o.export(e);if(x(o))return o.map(a=>n(a));if(B(o)){const a={};return Object.keys(o||{}).forEach(s=>{a[s]=n(o[s])}),a}return o};return n(r)}}const $f=t=>{if(typeof t=="string")return!0;pr({data:t,dataStruct:Tt,throwError:!1})},no=(t,e,r=new vt([]))=>{if(typeof t=="string")return t;const n={...t,id:t.id??X(),children:[],props:{},methods:t.methods||[],configure:Jn(t.configure||{},{propsSetter:{},advanceSetter:{}})},o=Object.keys(t.props||{});return o.length&&o.forEach(a=>{var s;const i=(s=t.props)==null?void 0:s[a];if(i instanceof it){n.props[a]=i;return}n.props[a]=new it(a,i||"",{parent:e,materials:r})}),t.children&&(Array.isArray(t.children)?n.children=t.children.map(a=>{if(a instanceof A)return a;if(B(a)){const s=a;return new A(s,{parent:e,materials:r})}else return a}):(t.children instanceof A&&(n.children=[t.children]),n.children=[new A(t.children,{parent:e,materials:r})])),n};class A{constructor(e,r){j(this,"nodeType","NODE"),j(this,"rawData"),j(this,"data"),j(this,"emitter",Kt),j(this,"parent"),j(this,"materialsModel"),j(this,"listenerHandle"),j(this,"onChangeCbQueue"),this.rawData=JSON.parse(JSON.stringify(e)),$f(e);const n=(r==null?void 0:r.materials)||new vt([]);this.parent=(r==null?void 0:r.parent)||null,this.materialsModel=n,this.data=no(e,this,n),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener()}registerListener(){const e=r=>{const{node:n}=r;n===this&&n.id===this.id&&this.onChangeCbQueue.forEach(o=>o(r))};this.emitter.on("onNodeChange",e),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",e)})}onChange(e){return this.onChangeCbQueue.push(e),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(r=>r!==e)}}destroy(){this.listenerHandle.forEach(e=>e())}get id(){return this.data.id}get value(){return this.data}clone(e){const r={...this.export("design"),id:e||X()};return new A(r,{materials:this.materialsModel})}updateValue(e){const r=this.data,n={...this.data,...e};this.data=no(n,this),this.emitter.emit("onNodeChange",{value:n,preValue:r,node:this})}contains(e){return yr(this,e)}get props(){return this.data.props}get material(){const e=this.materialsModel;return e==null?void 0:e.findByComponentName(this.data.componentName)}getPlainProps(){const e=this.data,r={};return Object.keys(e.props||{}).forEach(n=>{r[n]=e.props[n].export("design")}),r}getNodeConfig(e){var r;return this.data.configure[e]!==void 0?this.data.configure.isContainer:(r=this.material)==null?void 0:r.value.isContainer}isContainer(){return this.getNodeConfig("isContainer")}export(e){var r;const n=this.data;if(typeof n=="string")return n;const o={};Object.keys(n.props||{}).forEach(l=>{o[l]=n.props[l].export(e)});const a=(r=n.children)==null?void 0:r.map(l=>l instanceof A?l.export(e):l),s=n.configure||{},i=s.propsSetter||{},c={};Object.keys(i).forEach(l=>{const d=un(i,l,!1);d&&(c[l]=d)}),s.propsSetter=c,this.material&&this.materialsModel.usedMaterials.push(this.material);let u={...n,configure:s,props:o,children:a};return e==="design"&&delete u.id,u=gr(u),u}}const oo=(t,e,r)=>{const n={...t,id:X(),props:{},componentName:$t.ROOT_CONTAINER,children:[],methods:t.methods||[],configure:Jn(t.configure||{},{propsSetter:{},advanceSetter:{}})};let o=[];x(t.children)?o=t.children.map(s=>s instanceof A?s:B(s)?new A(s,{parent:e,materials:r}):s):t.children instanceof A?o.push(t.children):t.children&&B(t.children)&&o.push(new A(t.children,{parent:e,materials:r}));const a=Object.keys(t.props||{});return a.length&&a.forEach(s=>{var i;const c=(i=t.props)==null?void 0:i[s];c instanceof it?n.props[s]=c:n.props[s]=new it(s,c||"",{parent:e,materials:r})}),n.children=o,n};class Xt{constructor(e,{parent:r,materials:n}){j(this,"rawData"),j(this,"data"),j(this,"nodeType",$t.ROOT_CONTAINER),j(this,"emitter",Kt),j(this,"materialsModel"),j(this,"listenerHandle"),j(this,"onChangeCbQueue"),j(this,"parent"),this.materialsModel=n,this.rawData=JSON.parse(JSON.stringify(e)),this.data=oo(e,this,n),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener(),this.parent=r}registerListener(){const e=r=>{const{node:n}=r;n===this&&n.id===this.id&&this.onChangeCbQueue.forEach(o=>o(r))};this.emitter.on("onNodeChange",e),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",e)})}onChange(e){return this.onChangeCbQueue.push(e),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(r=>r!==e)}}get id(){return this.data.id}get value(){return this.data}get props(){return this.data.props}get material(){const e=this.materialsModel;return e==null?void 0:e.findByComponentName(this.data.componentName)}updateValue(e){const r=this.data,n={...this.data,...e};this.data=oo(n,this,this.materialsModel),this.emitter.emit("onNodeChange",{value:this.data,preValue:r,node:this})}contains(e){return yr(this,e)}getMaterialConfig(e){var r;return this.data.configure[e]!==void 0?this.data.configure.isContainer:(r=this.material)==null?void 0:r.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(e=cr.SAVE){var r;const n=this.data,o={};Object.keys(n.props||{}).forEach(c=>{o[c]=n.props[c].export(e)});const a=((r=n.children)==null?void 0:r.map(c=>{var u;return(u=c==null?void 0:c.export)==null?void 0:u.call(c,e)}))||[],s={...n,props:o,children:a.filter(c=>c)};let i=Wn(s,["id"]);return i=gr(i),i}getPlainProps(){const e=this.data,r={};return Object.keys(e.props||{}).forEach(n=>{r[n]=e.props[n].export("design")}),r}destroy(){this.listenerHandle.forEach(e=>e())}clone(e){const r={...this.export("design"),id:e||X()};return new Xt(r,{materials:this.materialsModel,parent:null})}}const mt=t=>(t==null?void 0:t.type)===z.EXPRESSION,Af=t=>(t==null?void 0:t.type)===z.FUNCTION,X=()=>Math.random().toString(32).slice(3,9),Mf=t=>(t==null?void 0:t.nodeType)==="NODE",vr=t=>(t==null?void 0:t.nodeType)==="PROP",Pf=t=>(t==null?void 0:t.nodeType)==="SLOT",gr=t=>Xl(t,e=>B(e)?!Object.keys(e).length:x(e)?!e.length:!e);function Df(t,e){const r=[t];for(;r.length;){const n=r.shift();if(n&&e(n))return n;const o=(n==null?void 0:n.props)||{},a=i=>{if(i instanceof A){r.push(i);return}if(i instanceof At&&a(i.value.value),i instanceof it){a(i.value);return}if(B(i)){const c=i;Object.keys(c).forEach(u=>{a(c[u])});return}if(x(i)){i.forEach(c=>{a(c)});return}};a(o);const s=(n==null?void 0:n.value.children.filter(i=>i instanceof A))||[];r.push(...s)}}function yr(t,e){return Df(t,r=>r.id===e)}const xf=t=>{const e=In(t),r=e.snippets;return delete e.snippets,e.snippets=r.map(n=>({...e,...n,id:n.id||`${t.componentName}-${X()}`,title:n.title||t.title,category:n.category||t.category,tags:[...n.tags||[],...t.tags||[]],groupName:n.groupName||t.groupName,snapshot:n.snapshot||t.icon,snapshotText:n.snapshotText,schema:{...n.schema,componentName:n.schema.componentName||t.componentName}})),e};class If{constructor(e){j(this,"rawData"),j(this,"data"),this.rawData=e,this.data=xf(e)}get value(){return this.data}get rawValue(){return this.rawData}get componentName(){return this.data.componentName}get snippets(){return this.data.snippets}getSnippetById(e){return this.data.snippets.find(r=>r.id===e)}}const Rf=t=>{if(!x(t))throw new Error("Materials must be a array");return t.map(e=>new If(e))},Lf=t=>{t==null||t.forEach(e=>{pr({data:e,dataStruct:Of,throwError:!1})})};class vt{constructor(e){j(this,"rawData"),j(this,"data"),j(this,"usedMaterials",[]),this.rawData=e,Lf(e),this.data=Rf(e)}findByComponentName(e){return this.data.find(r=>r.componentName===e)}findSnippetById(e){const r=[...this.data];let n=null;for(;!n&&r.length;){const o=r.pop();n=o==null?void 0:o.getSnippetById(e)}return n}getAllSnippets(){let e=this.data.reduce((a,s)=>(a.push(...s.snippets),a),[]);const r=[],n={default:[]};e=e.sort((a,s)=>(a.category||"")>(s.category||"")?1:-1),e.forEach(a=>{const s=a.groupName||"default";r.includes(s)||(r.push(s),n[s]=[]),n[s].push(a)});const o=[];return r.forEach(a=>{const s=["default"],i={default:[]},c=n[a];if(c.length!==0){c.forEach(d=>{const f=d.category||"default";s.includes(f)||(s.push(f),i[f]=[]),i[f].push(d)});const u=[];s.forEach(d=>{i[d].length&&u.push({name:d,list:i[d]})});const l={name:a,list:u};o.push(l)}}),o}get value(){return this.data}get rawValue(){return this.rawData}}const Ff=w({version:h(),name:h(),css:m(h()),renderType:m(L([U("COMPONENT"),U("PAGE")])),methods:m(M(wf)),componentsMeta:M(ar(w({componentName:h()}),sr)),thirdLibs:m(mf),componentsTree:Ef,assets:m(M(I()))}),ao=t=>(pr({data:t,dataStruct:Ff,throwError:!1}),t),br=(t,e,r)=>({...t,componentsTree:new Xt(t.componentsTree,{parent:e,materials:r})});class ge{constructor(e,r){j(this,"nodeType","PAGE"),j(this,"rawData"),j(this,"emitter",Kt),j(this,"data"),j(this,"parent"),j(this,"materialsModel"),j(this,"assetPackagesList"),ao(e),this.rawData=JSON.parse(JSON.stringify(e)),this.materialsModel=new vt((r==null?void 0:r.materials)||[]),this.data=br(e,this,this.materialsModel),this.assetPackagesList=[...(r==null?void 0:r.assetPackagesList)||[],...this.data.assets||[]]}updatePage(e){const r=this.data;this.rawData=JSON.parse(JSON.stringify(e)),this.data=br(e,this,this.materialsModel),this.emitter.emit("onPageChange",{value:this.data,preValue:r,node:this})}reloadPage(e){const r=this.data;this.rawData=JSON.parse(JSON.stringify(e)),this.data=br(e,this,this.materialsModel),this.emitter.emit("onReloadPage",{value:this.data,preValue:r,node:this})}get value(){return this.data}getNode(e){if(!e)return;const r=this.data.componentsTree;return yr(r,e)}addNode(e,r,n="AFTER"){var o;if(n==="AFTER"||n==="BEFORE"){const a=r.parent;if(a===null&&r instanceof Xt)return console.warn("Not found parent node"),!1;if(a instanceof it)return console.warn("CProp can not add node"),!1;if(a instanceof At){const i=a.value.value,c=i.findIndex(u=>u===r)??-1;return c>=0?(n==="BEFORE"?i.splice(c,0,e):i.splice(c+1,0,e),e.parent=a,(o=a.parent)==null||o.updateValue(),!0):!1}if(a instanceof ge)return!1;const s=(a==null?void 0:a.value.children.findIndex(i=>i===r))??-1;return s>=0?(n==="BEFORE"?a==null||a.value.children.splice(s,0,e):a==null||a.value.children.splice(s+1,0,e),e.parent=a,a==null||a.updateValue(),!0):(console.warn("Not found target node"),!1)}if(n==="CHILD_START")return r.value.children.unshift(e),e.parent=r,r.updateValue(),!0;if(n==="CHILD_END")return r.value.children.push(e),e.parent=r,r.updateValue(),!0;if(B(n)){const a=n;if(a.type==="CHILD"){const s=a.pos,i=a.index||0;return s==="BEFORE"?r==null||r.value.children.splice(i,0,e):r==null||r.value.children.splice(i+1,0,e),e.parent=r,r.updateValue(),!0}else console.warn("Can not parse pos obj")}return!1}createNode(e){return delete e.id,new A(e,{parent:null,materials:this.materialsModel})}addNodeById(e,r,n="AFTER"){const o=this.getNode(r);return o?this.addNode(e,o,n):(console.warn(`Not find a node by ${r}, pls check it`),!1)}copyNode(e){const r=e.export("design");r.id=X();const n=new A(r,{parent:e.parent,materials:this.materialsModel});return this.addNode(n,e,"AFTER"),n}copyNodeById(e){const r=this.getNode(e);return r&&r instanceof A?this.copyNode(r):!1}moveNode(e,r,n){this.deleteNode(e);let o=r;return["AFTER","BEFORE"].includes(n)&&(o=r.parent),e.parent=o,this.addNode(e,r,n)}moveNodeById(e,r,n){const o=this.getNode(e),a=this.getNode(r);return o&&a&&o instanceof A&&a instanceof A?this.moveNode(o,a,n):!1}deleteNode(e){var r;const n=e.parent;if(!n)throw new Error("parent node is null or undefined, pls check it");if(n instanceof At){const o=n.value.value,a=o.findIndex(i=>i===e),s=o[a];return o.splice(a,1),(r=n.parent)==null||r.updateValue(),s}if(n instanceof A||n instanceof Xt){const o=n.value.children,a=o.findIndex(i=>i===e),s=o[a];return o.splice(a,1),n.updateValue(),s}}deleteNodeById(e){const r=this.getNode(e);if(r)return this.deleteNode(r)}export(e=cr.SAVE){var r;const n=this.data.componentsTree.export(e),o=this.assetPackagesList,a=[],s=this.materialsModel.usedMaterials.map(c=>{const u=o.find(l=>{var d;return l.package===((d=c.value.npm)==null?void 0:d.package)});return u&&a.push(u),{componentName:c.componentName,...In(c.value.npm||{})}}).filter(c=>!!(c.componentName&&c.package&&c.version));this.materialsModel.usedMaterials=[];let i={...this.data,componentsTree:gr(n),componentsMeta:s,thirdLibs:this.data.thirdLibs,assets:[]};return(r=this.data.thirdLibs)==null||r.forEach(c=>{const u=o.find(l=>c.package===l.package);u&&a.push(u)}),i.assets=af(a,c=>c.package),i=Wn(i,["id"]),JSON.parse(JSON.stringify(i))}getRootNode(){return this.data.componentsTree}}$t.ROOT_CONTAINER;var Bf=typeof global=="object"&&global&&global.Object===Object&&global;const io=Bf;var Uf=typeof self=="object"&&self&&self.Object===Object&&self,kf=io||Uf||Function("return this")();const Mt=kf;var Vf=Mt.Symbol;const Pt=Vf;var so=Object.prototype,zf=so.hasOwnProperty,Gf=so.toString,Zt=Pt?Pt.toStringTag:void 0;function Hf(t){var e=zf.call(t,Zt),r=t[Zt];try{t[Zt]=void 0;var n=!0}catch{}var o=Gf.call(t);return n&&(e?t[Zt]=r:delete t[Zt]),o}var Jf=Object.prototype,Wf=Jf.toString;function Qf(t){return Wf.call(t)}var qf="[object Null]",Yf="[object Undefined]",co=Pt?Pt.toStringTag:void 0;function te(t){return t==null?t===void 0?Yf:qf:co&&co in Object(t)?Hf(t):Qf(t)}function Dt(t){return t!=null&&typeof t=="object"}var Kf="[object Symbol]";function Xf(t){return typeof t=="symbol"||Dt(t)&&te(t)==Kf}function Zf(t,e){for(var r=-1,n=t==null?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var td=Array.isArray;const xt=td;var ed=1/0,uo=Pt?Pt.prototype:void 0,lo=uo?uo.toString:void 0;function fo(t){if(typeof t=="string")return t;if(xt(t))return Zf(t,fo)+"";if(Xf(t))return lo?lo.call(t):"";var e=t+"";return e=="0"&&1/t==-ed?"-0":e}function gt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function po(t){return t}var rd="[object AsyncFunction]",nd="[object Function]",od="[object GeneratorFunction]",ad="[object Proxy]";function _r(t){if(!gt(t))return!1;var e=te(t);return e==nd||e==od||e==rd||e==ad}var id=Mt["__core-js_shared__"];const Sr=id;var ho=function(){var t=/[^.]+$/.exec(Sr&&Sr.keys&&Sr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function sd(t){return!!ho&&ho in t}var cd=Function.prototype,ud=cd.toString;function ld(t){if(t!=null){try{return ud.call(t)}catch{}try{return t+""}catch{}}return""}var fd=/[\\^$.*+?()[\]{}|]/g,dd=/^\[object .+?Constructor\]$/,pd=Function.prototype,hd=Object.prototype,md=pd.toString,vd=hd.hasOwnProperty,gd=RegExp("^"+md.call(vd).replace(fd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function yd(t){if(!gt(t)||sd(t))return!1;var e=_r(t)?gd:dd;return e.test(ld(t))}function bd(t,e){return t==null?void 0:t[e]}function jr(t,e){var r=bd(t,e);return yd(r)?r:void 0}var mo=Object.create,_d=function(){function t(){}return function(e){if(!gt(e))return{};if(mo)return mo(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();const Sd=_d;function jd(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Od(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Cd=800,wd=16,Ed=Date.now;function Nd(t){var e=0,r=0;return function(){var n=Ed(),o=wd-(n-r);if(r=n,o>0){if(++e>=Cd)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Td(t){return function(){return t}}var $d=function(){try{var t=jr(Object,"defineProperty");return t({},"",{}),t}catch{}}();const ye=$d;var Ad=ye?function(t,e){return ye(t,"toString",{configurable:!0,enumerable:!1,value:Td(e),writable:!0})}:po,Md=Nd(Ad);const Pd=Md;var Dd=9007199254740991,xd=/^(?:0|[1-9]\d*)$/;function vo(t,e){var r=typeof t;return e=e??Dd,!!e&&(r=="number"||r!="symbol"&&xd.test(t))&&t>-1&&t%1==0&&t<e}function Or(t,e,r){e=="__proto__"&&ye?ye(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function be(t,e){return t===e||t!==t&&e!==e}var Id=Object.prototype,Rd=Id.hasOwnProperty;function Ld(t,e,r){var n=t[e];(!(Rd.call(t,e)&&be(n,r))||r===void 0&&!(e in t))&&Or(t,e,r)}function Fd(t,e,r,n){var o=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var i=e[a],c=n?n(r[i],t[i],i,r,t):void 0;c===void 0&&(c=t[i]),o?Or(r,i,c):Ld(r,i,c)}return r}var go=Math.max;function Bd(t,e,r){return e=go(e===void 0?t.length-1:e,0),function(){for(var n=arguments,o=-1,a=go(n.length-e,0),s=Array(a);++o<a;)s[o]=n[e+o];o=-1;for(var i=Array(e+1);++o<e;)i[o]=n[o];return i[e]=r(s),jd(t,this,i)}}function Ud(t,e){return Pd(Bd(t,e,po),t+"")}var kd=9007199254740991;function yo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=kd}function Cr(t){return t!=null&&yo(t.length)&&!_r(t)}function Vd(t,e,r){if(!gt(r))return!1;var n=typeof e;return(n=="number"?Cr(r)&&vo(e,r.length):n=="string"&&e in r)?be(r[e],t):!1}function zd(t){return Ud(function(e,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(o--,a):void 0,s&&Vd(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),e=Object(e);++n<o;){var i=r[n];i&&t(e,i,n,a)}return e})}var Gd=Object.prototype;function bo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Gd;return t===r}function Hd(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Jd="[object Arguments]";function _o(t){return Dt(t)&&te(t)==Jd}var So=Object.prototype,Wd=So.hasOwnProperty,Qd=So.propertyIsEnumerable,qd=_o(function(){return arguments}())?_o:function(t){return Dt(t)&&Wd.call(t,"callee")&&!Qd.call(t,"callee")};const wr=qd;function Yd(){return!1}var jo=typeof v=="object"&&v&&!v.nodeType&&v,Oo=jo&&typeof module=="object"&&module&&!module.nodeType&&module,Kd=Oo&&Oo.exports===jo,Co=Kd?Mt.Buffer:void 0,Xd=Co?Co.isBuffer:void 0,Zd=Xd||Yd;const wo=Zd;var tp="[object Arguments]",ep="[object Array]",rp="[object Boolean]",np="[object Date]",op="[object Error]",ap="[object Function]",ip="[object Map]",sp="[object Number]",cp="[object Object]",up="[object RegExp]",lp="[object Set]",fp="[object String]",dp="[object WeakMap]",pp="[object ArrayBuffer]",hp="[object DataView]",mp="[object Float32Array]",vp="[object Float64Array]",gp="[object Int8Array]",yp="[object Int16Array]",bp="[object Int32Array]",_p="[object Uint8Array]",Sp="[object Uint8ClampedArray]",jp="[object Uint16Array]",Op="[object Uint32Array]",$={};$[mp]=$[vp]=$[gp]=$[yp]=$[bp]=$[_p]=$[Sp]=$[jp]=$[Op]=!0,$[tp]=$[ep]=$[pp]=$[rp]=$[hp]=$[np]=$[op]=$[ap]=$[ip]=$[sp]=$[cp]=$[up]=$[lp]=$[fp]=$[dp]=!1;function Cp(t){return Dt(t)&&yo(t.length)&&!!$[te(t)]}function wp(t){return function(e){return t(e)}}var Eo=typeof v=="object"&&v&&!v.nodeType&&v,ee=Eo&&typeof module=="object"&&module&&!module.nodeType&&module,Ep=ee&&ee.exports===Eo,Er=Ep&&io.process,Np=function(){try{var t=ee&&ee.require&&ee.require("util").types;return t||Er&&Er.binding&&Er.binding("util")}catch{}}();const No=Np;var To=No&&No.isTypedArray,Tp=To?wp(To):Cp;const $o=Tp;var $p=Object.prototype,Ap=$p.hasOwnProperty;function Mp(t,e){var r=xt(t),n=!r&&wr(t),o=!r&&!n&&wo(t),a=!r&&!n&&!o&&$o(t),s=r||n||o||a,i=s?Hd(t.length,String):[],c=i.length;for(var u in t)(e||Ap.call(t,u))&&!(s&&(u=="length"||o&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||vo(u,c)))&&i.push(u);return i}function Pp(t,e){return function(r){return t(e(r))}}function Dp(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var xp=Object.prototype,Ip=xp.hasOwnProperty;function Rp(t){if(!gt(t))return Dp(t);var e=bo(t),r=[];for(var n in t)n=="constructor"&&(e||!Ip.call(t,n))||r.push(n);return r}function Ao(t){return Cr(t)?Mp(t,!0):Rp(t)}var Lp=jr(Object,"create");const re=Lp;function Fp(){this.__data__=re?re(null):{},this.size=0}function Bp(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Up="__lodash_hash_undefined__",kp=Object.prototype,Vp=kp.hasOwnProperty;function zp(t){var e=this.__data__;if(re){var r=e[t];return r===Up?void 0:r}return Vp.call(e,t)?e[t]:void 0}var Gp=Object.prototype,Hp=Gp.hasOwnProperty;function Jp(t){var e=this.__data__;return re?e[t]!==void 0:Hp.call(e,t)}var Wp="__lodash_hash_undefined__";function Qp(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=re&&e===void 0?Wp:e,this}function yt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}yt.prototype.clear=Fp,yt.prototype.delete=Bp,yt.prototype.get=zp,yt.prototype.has=Jp,yt.prototype.set=Qp;function qp(){this.__data__=[],this.size=0}function _e(t,e){for(var r=t.length;r--;)if(be(t[r][0],e))return r;return-1}var Yp=Array.prototype,Kp=Yp.splice;function Xp(t){var e=this.__data__,r=_e(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Kp.call(e,r,1),--this.size,!0}function Zp(t){var e=this.__data__,r=_e(e,t);return r<0?void 0:e[r][1]}function th(t){return _e(this.__data__,t)>-1}function eh(t,e){var r=this.__data__,n=_e(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function nt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}nt.prototype.clear=qp,nt.prototype.delete=Xp,nt.prototype.get=Zp,nt.prototype.has=th,nt.prototype.set=eh;var rh=jr(Mt,"Map");const Mo=rh;function nh(){this.size=0,this.__data__={hash:new yt,map:new(Mo||nt),string:new yt}}function oh(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Se(t,e){var r=t.__data__;return oh(e)?r[typeof e=="string"?"string":"hash"]:r.map}function ah(t){var e=Se(this,t).delete(t);return this.size-=e?1:0,e}function ih(t){return Se(this,t).get(t)}function sh(t){return Se(this,t).has(t)}function ch(t,e){var r=Se(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}function It(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}It.prototype.clear=nh,It.prototype.delete=ah,It.prototype.get=ih,It.prototype.has=sh,It.prototype.set=ch;function Po(t){return t==null?"":fo(t)}var uh=Pp(Object.getPrototypeOf,Object);const Do=uh;var lh="[object Object]",fh=Function.prototype,dh=Object.prototype,xo=fh.toString,ph=dh.hasOwnProperty,hh=xo.call(Object);function Rt(t){if(!Dt(t)||te(t)!=lh)return!1;var e=Do(t);if(e===null)return!0;var r=ph.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&xo.call(r)==hh}function mh(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(o);++n<o;)a[n]=t[n+e];return a}function vh(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:mh(t,e,r)}var gh="\\ud800-\\udfff",yh="\\u0300-\\u036f",bh="\\ufe20-\\ufe2f",_h="\\u20d0-\\u20ff",Sh=yh+bh+_h,jh="\\ufe0e\\ufe0f",Oh="\\u200d",Ch=RegExp("["+Oh+gh+Sh+jh+"]");function Io(t){return Ch.test(t)}function wh(t){return t.split("")}var Ro="\\ud800-\\udfff",Eh="\\u0300-\\u036f",Nh="\\ufe20-\\ufe2f",Th="\\u20d0-\\u20ff",$h=Eh+Nh+Th,Ah="\\ufe0e\\ufe0f",Mh="["+Ro+"]",Nr="["+$h+"]",Tr="\\ud83c[\\udffb-\\udfff]",Ph="(?:"+Nr+"|"+Tr+")",Lo="[^"+Ro+"]",Fo="(?:\\ud83c[\\udde6-\\uddff]){2}",Bo="[\\ud800-\\udbff][\\udc00-\\udfff]",Dh="\\u200d",Uo=Ph+"?",ko="["+Ah+"]?",xh="(?:"+Dh+"(?:"+[Lo,Fo,Bo].join("|")+")"+ko+Uo+")*",Ih=ko+Uo+xh,Rh="(?:"+[Lo+Nr+"?",Nr,Fo,Bo,Mh].join("|")+")",Lh=RegExp(Tr+"(?="+Tr+")|"+Rh+Ih,"g");function Fh(t){return t.match(Lh)||[]}function Bh(t){return Io(t)?Fh(t):wh(t)}function Uh(t){return function(e){e=Po(e);var r=Io(e)?Bh(e):void 0,n=r?r[0]:e.charAt(0),o=r?vh(r,1).join(""):e.slice(1);return n[t]()+o}}var kh=Uh("toUpperCase");const Vh=kh;function zh(t){return Vh(Po(t).toLowerCase())}function Gh(){this.__data__=new nt,this.size=0}function Hh(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function Jh(t){return this.__data__.get(t)}function Wh(t){return this.__data__.has(t)}var Qh=200;function qh(t,e){var r=this.__data__;if(r instanceof nt){var n=r.__data__;if(!Mo||n.length<Qh-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new It(n)}return r.set(t,e),this.size=r.size,this}function Lt(t){var e=this.__data__=new nt(t);this.size=e.size}Lt.prototype.clear=Gh,Lt.prototype.delete=Hh,Lt.prototype.get=Jh,Lt.prototype.has=Wh,Lt.prototype.set=qh;var Vo=typeof v=="object"&&v&&!v.nodeType&&v,zo=Vo&&typeof module=="object"&&module&&!module.nodeType&&module,Yh=zo&&zo.exports===Vo,Go=Yh?Mt.Buffer:void 0,Ho=Go?Go.allocUnsafe:void 0;function Kh(t,e){if(e)return t.slice();var r=t.length,n=Ho?Ho(r):new t.constructor(r);return t.copy(n),n}var Xh=Mt.Uint8Array;const Jo=Xh;function Zh(t){var e=new t.constructor(t.byteLength);return new Jo(e).set(new Jo(t)),e}function tm(t,e){var r=e?Zh(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function em(t){return typeof t.constructor=="function"&&!bo(t)?Sd(Do(t)):{}}function rm(t){return function(e,r,n){for(var o=-1,a=Object(e),s=n(e),i=s.length;i--;){var c=s[t?i:++o];if(r(a[c],c,a)===!1)break}return e}}var nm=rm();const om=nm;function $r(t,e,r){(r!==void 0&&!be(t[e],r)||r===void 0&&!(e in t))&&Or(t,e,r)}function am(t){return Dt(t)&&Cr(t)}function Ar(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function im(t){return Fd(t,Ao(t))}function sm(t,e,r,n,o,a,s){var i=Ar(t,r),c=Ar(e,r),u=s.get(c);if(u){$r(t,r,u);return}var l=a?a(i,c,r+"",t,e,s):void 0,d=l===void 0;if(d){var f=xt(c),p=!f&&wo(c),g=!f&&!p&&$o(c);l=c,f||p||g?xt(i)?l=i:am(i)?l=Od(i):p?(d=!1,l=Kh(c,!0)):g?(d=!1,l=tm(c,!0)):l=[]:Rt(c)||wr(c)?(l=i,wr(i)?l=im(i):(!gt(i)||_r(i))&&(l=em(c))):d=!1}d&&(s.set(c,l),o(l,c,n,a,s),s.delete(c)),$r(t,r,l)}function Wo(t,e,r,n,o){t!==e&&om(e,function(a,s){if(o||(o=new Lt),gt(a))sm(t,e,s,r,Wo,n,o);else{var i=n?n(Ar(t,s),a,s+"",t,e,o):void 0;i===void 0&&(i=a),$r(t,s,i)}},Ao)}var cm=zd(function(t,e,r){Wo(t,e,r)});const um=cm,lm=function(t){return!(!t||typeof t!="function"||!t.prototype)};function Qo(t){const e=t.prototype;return!!(e&&e.isReactComponent)}function qo(t){var n,o;const r=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.forward_ref"):60112;return(t==null?void 0:t.$$typeof)===r||((n=t==null?void 0:t.prototype)==null?void 0:n.isReactComponent)||((o=t==null?void 0:t.prototype)==null?void 0:o.setState)||t._forwardRef}function Yo(t){class e extends S.Component{render(){return S.createElement(t,this.props)}}return e.displayName=t.displayName,e}const bt=(t,e)=>{const r=n=>{const a=`
6
+ `)),{isValidate:!1,message:i,error:s}}})({data:e,message:r,throwError:n})};var $t=(t=>(t.ROOT_CONTAINER="RootContainer",t))($t||{});const wf=w({type:U(z.FUNCTION),value:h()}),Ef=ar(Kn(Tt,["componentName"]),w({componentName:U("RootContainer")}));function Nf(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(o){o(r)}),(n=t.get("*"))&&n.slice().map(function(o){o(e,r)})}}}const Kt=Nf(),Tf=(t,e)=>{const r={...t,value:[]},n=t.value;let o=new vt([]);return e&&(o=e.materialsMode||new vt([])),n&&(x(n)?r.value=n.map(a=>new A(a,{parent:e,materials:o})):B(n)&&r.value.push(new A(n,{parent:e,materials:o}))),r};class At{constructor(e,r){j(this,"nodeType","SLOT"),j(this,"rawData"),j(this,"parent"),j(this,"emitter",Kt),j(this,"data"),j(this,"id"),j(this,"materialsMode"),this.parent=(r==null?void 0:r.parent)||null,this.rawData=e;const n=(r==null?void 0:r.materials)||new vt([]);this.materialsMode=n,this.id=X(),this.data=Tf(e,this)}get value(){return this.data}export(e){const r=this.data,n=o=>{if(o instanceof A)return o.export(e);if(B(o)){const a={};return Object.keys(o||{}).forEach(s=>{a[s]=n(o[s])}),a}return x(o)?o.map(a=>n(a)):(e==="design"&&delete o.id,o)};return n(r)}}const ro=t=>{let e=[];return t.forEach(r=>{const n=r;n.type?n.type===dr.SINGLE?e.push(n.content):n.type===dr.GROUP&&(e=[...e,...ro(n.content)]):e.push(r)}),e},hr=(t,e,r)=>{if(t.type)return t.type===z.SLOT?new At(t,{parent:e,materials:r}):t;if(B(t)){const n={};return Object.keys(t).forEach(o=>{n[o]=mr(t[o],e,r)}),n}else return Array.isArray(t)?t.map(n=>hr(n,e,r)):t},mr=(t,e,r)=>B(t)?hr(t,e,r):x(t)?t.map(n=>hr(n,e,r)):t;class it{constructor(e,r,n){j(this,"nodeType","PROP"),j(this,"rawData"),j(this,"parent"),j(this,"emitter",Kt),j(this,"data"),j(this,"name"),j(this,"materialsMode");const o=(n==null?void 0:n.materials)||new vt([]);this.materialsMode=o,this.parent=n==null?void 0:n.parent,this.rawData=r,this.name=e,this.data=mr(r,this,o)}isIncludeSlot(){return!1}isIncludeExpression(){return!1}get value(){return this.data}updateValue(e){const r=this.data;this.data=mr(e??r,this,this.materialsMode),this.emitter.emit("onPropChange",{value:this.data,preValue:r,node:this}),this.parent&&!(this.parent instanceof At)&&this.emitter.emit("onNodeChange",{value:this.parent.value,preValue:this.parent.value,node:this.parent})}get material(){const e=this.parent;if(e instanceof A){const r=e.material;return ro((r==null?void 0:r.value.props)||[]).find(n=>n.name===this.name)}else return null}export(e){const r=this.data,n=o=>{if(o instanceof it||o instanceof At||o instanceof A)return o.export(e);if(x(o))return o.map(a=>n(a));if(B(o)){const a={};return Object.keys(o||{}).forEach(s=>{a[s]=n(o[s])}),a}return o};return n(r)}}const $f=t=>{if(typeof t=="string")return!0;pr({data:t,dataStruct:Tt,throwError:!1})},no=(t,e,r=new vt([]))=>{if(typeof t=="string")return t;const n={...t,id:t.id??X(),children:[],props:{},methods:t.methods||[],configure:Jn(t.configure||{},{propsSetter:{},advanceSetter:{}})},o=Object.keys(t.props||{});return o.length&&o.forEach(a=>{var s;const i=(s=t.props)==null?void 0:s[a];if(i instanceof it){n.props[a]=i;return}n.props[a]=new it(a,i||"",{parent:e,materials:r})}),t.children&&(Array.isArray(t.children)?n.children=t.children.map(a=>{if(a instanceof A)return a;if(B(a)){const s=a;return new A(s,{parent:e,materials:r})}else return a}):(t.children instanceof A&&(n.children=[t.children]),n.children=[new A(t.children,{parent:e,materials:r})])),n};class A{constructor(e,r){j(this,"nodeType","NODE"),j(this,"rawData"),j(this,"data"),j(this,"emitter",Kt),j(this,"parent"),j(this,"materialsModel"),j(this,"listenerHandle"),j(this,"onChangeCbQueue"),this.rawData=JSON.parse(JSON.stringify(e)),$f(e);const n=(r==null?void 0:r.materials)||new vt([]);this.parent=(r==null?void 0:r.parent)||null,this.materialsModel=n,this.data=no(e,this,n),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener()}registerListener(){const e=r=>{const{node:n}=r;n===this&&n.id===this.id&&this.onChangeCbQueue.forEach(o=>o(r))};this.emitter.on("onNodeChange",e),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",e)})}onChange(e){return this.onChangeCbQueue.push(e),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(r=>r!==e)}}destroy(){this.listenerHandle.forEach(e=>e())}get id(){return this.data.id}get value(){return this.data}clone(e){const r={...this.export("design"),id:e||X()};return new A(r,{materials:this.materialsModel})}updateValue(e){const r=this.data,n={...this.data,...e};this.data=no(n,this),this.emitter.emit("onNodeChange",{value:n,preValue:r,node:this})}contains(e){return yr(this,e)}get props(){return this.data.props}get material(){const e=this.materialsModel;return e==null?void 0:e.findByComponentName(this.data.componentName)}getPlainProps(){const e=this.data,r={};return Object.keys(e.props||{}).forEach(n=>{r[n]=e.props[n].export("design")}),r}getMaterialConfig(e){var r;return this.data.configure[e]!==void 0?this.data.configure.isContainer:(r=this.material)==null?void 0:r.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(e){var r;const n=this.data;if(typeof n=="string")return n;const o={};Object.keys(n.props||{}).forEach(l=>{o[l]=n.props[l].export(e)});const a=(r=n.children)==null?void 0:r.map(l=>l instanceof A?l.export(e):l),s=n.configure||{},i=s.propsSetter||{},c={};Object.keys(i).forEach(l=>{const d=un(i,l,!1);d&&(c[l]=d)}),s.propsSetter=c,this.material&&this.materialsModel.usedMaterials.push(this.material);let u={...n,configure:s,props:o,children:a};return e==="design"&&delete u.id,u=gr(u),u}}const oo=(t,e,r)=>{const n={...t,id:X(),props:{},componentName:$t.ROOT_CONTAINER,children:[],methods:t.methods||[],configure:Jn(t.configure||{},{propsSetter:{},advanceSetter:{}})};let o=[];x(t.children)?o=t.children.map(s=>s instanceof A?s:B(s)?new A(s,{parent:e,materials:r}):s):t.children instanceof A?o.push(t.children):t.children&&B(t.children)&&o.push(new A(t.children,{parent:e,materials:r}));const a=Object.keys(t.props||{});return a.length&&a.forEach(s=>{var i;const c=(i=t.props)==null?void 0:i[s];c instanceof it?n.props[s]=c:n.props[s]=new it(s,c||"",{parent:e,materials:r})}),n.children=o,n};class Xt{constructor(e,{parent:r,materials:n}){j(this,"rawData"),j(this,"data"),j(this,"nodeType",$t.ROOT_CONTAINER),j(this,"emitter",Kt),j(this,"materialsModel"),j(this,"listenerHandle"),j(this,"onChangeCbQueue"),j(this,"parent"),this.materialsModel=n,this.rawData=JSON.parse(JSON.stringify(e)),this.data=oo(e,this,n),this.listenerHandle=[],this.onChangeCbQueue=[],this.registerListener(),this.parent=r}registerListener(){const e=r=>{const{node:n}=r;n===this&&n.id===this.id&&this.onChangeCbQueue.forEach(o=>o(r))};this.emitter.on("onNodeChange",e),this.listenerHandle.push(()=>{this.emitter.off("onNodeChange",e)})}onChange(e){return this.onChangeCbQueue.push(e),()=>{this.onChangeCbQueue=this.onChangeCbQueue.filter(r=>r!==e)}}get id(){return this.data.id}get value(){return this.data}get props(){return this.data.props}get material(){const e=this.materialsModel;return e==null?void 0:e.findByComponentName(this.data.componentName)}updateValue(e){const r=this.data,n={...this.data,...e};this.data=oo(n,this,this.materialsModel),this.emitter.emit("onNodeChange",{value:this.data,preValue:r,node:this})}contains(e){return yr(this,e)}getMaterialConfig(e){var r;return this.data.configure[e]!==void 0?this.data.configure.isContainer:(r=this.material)==null?void 0:r.value.isContainer}isContainer(){return this.getMaterialConfig("isContainer")}export(e=cr.SAVE){var r;const n=this.data,o={};Object.keys(n.props||{}).forEach(c=>{o[c]=n.props[c].export(e)});const a=((r=n.children)==null?void 0:r.map(c=>{var u;return(u=c==null?void 0:c.export)==null?void 0:u.call(c,e)}))||[],s={...n,props:o,children:a.filter(c=>c)};let i=Wn(s,["id"]);return i=gr(i),i}getPlainProps(){const e=this.data,r={};return Object.keys(e.props||{}).forEach(n=>{r[n]=e.props[n].export("design")}),r}destroy(){this.listenerHandle.forEach(e=>e())}clone(e){const r={...this.export("design"),id:e||X()};return new Xt(r,{materials:this.materialsModel,parent:null})}}const mt=t=>(t==null?void 0:t.type)===z.EXPRESSION,Af=t=>(t==null?void 0:t.type)===z.FUNCTION,X=()=>Math.random().toString(32).slice(3,9),Mf=t=>(t==null?void 0:t.nodeType)==="NODE",vr=t=>(t==null?void 0:t.nodeType)==="PROP",Pf=t=>(t==null?void 0:t.nodeType)==="SLOT",gr=t=>Xl(t,e=>B(e)?!Object.keys(e).length:x(e)?!e.length:!e);function Df(t,e){const r=[t];for(;r.length;){const n=r.shift();if(n&&e(n))return n;const o=(n==null?void 0:n.props)||{},a=i=>{if(i instanceof A){r.push(i);return}if(i instanceof At&&a(i.value.value),i instanceof it){a(i.value);return}if(B(i)){const c=i;Object.keys(c).forEach(u=>{a(c[u])});return}if(x(i)){i.forEach(c=>{a(c)});return}};a(o);const s=(n==null?void 0:n.value.children.filter(i=>i instanceof A))||[];r.push(...s)}}function yr(t,e){return Df(t,r=>r.id===e)}const xf=t=>{const e=In(t),r=e.snippets;return delete e.snippets,e.snippets=r.map(n=>({...e,...n,id:n.id||`${t.componentName}-${X()}`,title:n.title||t.title,category:n.category||t.category,tags:[...n.tags||[],...t.tags||[]],groupName:n.groupName||t.groupName,snapshot:n.snapshot||t.icon,snapshotText:n.snapshotText,schema:{...n.schema,componentName:n.schema.componentName||t.componentName}})),e};class If{constructor(e){j(this,"rawData"),j(this,"data"),this.rawData=e,this.data=xf(e)}get value(){return this.data}get rawValue(){return this.rawData}get componentName(){return this.data.componentName}get snippets(){return this.data.snippets}getSnippetById(e){return this.data.snippets.find(r=>r.id===e)}}const Rf=t=>{if(!x(t))throw new Error("Materials must be a array");return t.map(e=>new If(e))},Lf=t=>{t==null||t.forEach(e=>{pr({data:e,dataStruct:Of,throwError:!1})})};class vt{constructor(e){j(this,"rawData"),j(this,"data"),j(this,"usedMaterials",[]),this.rawData=e,Lf(e),this.data=Rf(e)}findByComponentName(e){return this.data.find(r=>r.componentName===e)}findSnippetById(e){const r=[...this.data];let n=null;for(;!n&&r.length;){const o=r.pop();n=o==null?void 0:o.getSnippetById(e)}return n}getAllSnippets(){let e=this.data.reduce((a,s)=>(a.push(...s.snippets),a),[]);const r=[],n={default:[]};e=e.sort((a,s)=>(a.category||"")>(s.category||"")?1:-1),e.forEach(a=>{const s=a.groupName||"default";r.includes(s)||(r.push(s),n[s]=[]),n[s].push(a)});const o=[];return r.forEach(a=>{const s=["default"],i={default:[]},c=n[a];if(c.length!==0){c.forEach(d=>{const f=d.category||"default";s.includes(f)||(s.push(f),i[f]=[]),i[f].push(d)});const u=[];s.forEach(d=>{i[d].length&&u.push({name:d,list:i[d]})});const l={name:a,list:u};o.push(l)}}),o}get value(){return this.data}get rawValue(){return this.rawData}}const Ff=w({version:h(),name:h(),css:m(h()),renderType:m(L([U("COMPONENT"),U("PAGE")])),methods:m(M(wf)),componentsMeta:M(ar(w({componentName:h()}),sr)),thirdLibs:m(mf),componentsTree:Ef,assets:m(M(I()))}),ao=t=>(pr({data:t,dataStruct:Ff,throwError:!1}),t),br=(t,e,r)=>({...t,componentsTree:new Xt(t.componentsTree,{parent:e,materials:r})});class ge{constructor(e,r){j(this,"nodeType","PAGE"),j(this,"rawData"),j(this,"emitter",Kt),j(this,"data"),j(this,"parent"),j(this,"materialsModel"),j(this,"assetPackagesList"),ao(e),this.rawData=JSON.parse(JSON.stringify(e)),this.materialsModel=new vt((r==null?void 0:r.materials)||[]),this.data=br(e,this,this.materialsModel),this.assetPackagesList=[...(r==null?void 0:r.assetPackagesList)||[],...this.data.assets||[]]}updatePage(e){const r=this.data;this.rawData=JSON.parse(JSON.stringify(e)),this.data=br(e,this,this.materialsModel),this.emitter.emit("onPageChange",{value:this.data,preValue:r,node:this})}reloadPage(e){const r=this.data;this.rawData=JSON.parse(JSON.stringify(e)),this.data=br(e,this,this.materialsModel),this.emitter.emit("onReloadPage",{value:this.data,preValue:r,node:this})}get value(){return this.data}getNode(e){if(!e)return;const r=this.data.componentsTree;return yr(r,e)}addNode(e,r,n="AFTER"){var o;if(n==="AFTER"||n==="BEFORE"){const a=r.parent;if(a===null&&r instanceof Xt)return console.warn("Not found parent node"),!1;if(a instanceof it)return console.warn("CProp can not add node"),!1;if(a instanceof At){const i=a.value.value,c=i.findIndex(u=>u===r)??-1;return c>=0?(n==="BEFORE"?i.splice(c,0,e):i.splice(c+1,0,e),e.parent=a,(o=a.parent)==null||o.updateValue(),!0):!1}if(a instanceof ge)return!1;const s=(a==null?void 0:a.value.children.findIndex(i=>i===r))??-1;return s>=0?(n==="BEFORE"?a==null||a.value.children.splice(s,0,e):a==null||a.value.children.splice(s+1,0,e),e.parent=a,a==null||a.updateValue(),!0):(console.warn("Not found target node"),!1)}if(n==="CHILD_START")return r.value.children.unshift(e),e.parent=r,r.updateValue(),!0;if(n==="CHILD_END")return r.value.children.push(e),e.parent=r,r.updateValue(),!0;if(B(n)){const a=n;if(a.type==="CHILD"){const s=a.pos,i=a.index||0;return s==="BEFORE"?r==null||r.value.children.splice(i,0,e):r==null||r.value.children.splice(i+1,0,e),e.parent=r,r.updateValue(),!0}else console.warn("Can not parse pos obj")}return!1}createNode(e){return delete e.id,new A(e,{parent:null,materials:this.materialsModel})}addNodeById(e,r,n="AFTER"){const o=this.getNode(r);return o?this.addNode(e,o,n):(console.warn(`Not find a node by ${r}, pls check it`),!1)}copyNode(e){const r=e.export("design");r.id=X();const n=new A(r,{parent:e.parent,materials:this.materialsModel});return this.addNode(n,e,"AFTER"),n}copyNodeById(e){const r=this.getNode(e);return r&&r instanceof A?this.copyNode(r):!1}moveNode(e,r,n){this.deleteNode(e);let o=r;return["AFTER","BEFORE"].includes(n)&&(o=r.parent),e.parent=o,this.addNode(e,r,n)}moveNodeById(e,r,n){const o=this.getNode(e),a=this.getNode(r);return o&&a&&o instanceof A&&a instanceof A?this.moveNode(o,a,n):!1}deleteNode(e){var r;const n=e.parent;if(!n)throw new Error("parent node is null or undefined, pls check it");if(n instanceof At){const o=n.value.value,a=o.findIndex(i=>i===e),s=o[a];return o.splice(a,1),(r=n.parent)==null||r.updateValue(),s}if(n instanceof A||n instanceof Xt){const o=n.value.children,a=o.findIndex(i=>i===e),s=o[a];return o.splice(a,1),n.updateValue(),s}}deleteNodeById(e){const r=this.getNode(e);if(r)return this.deleteNode(r)}export(e=cr.SAVE){var r;const n=this.data.componentsTree.export(e),o=this.assetPackagesList,a=[],s=this.materialsModel.usedMaterials.map(c=>{const u=o.find(l=>{var d;return l.package===((d=c.value.npm)==null?void 0:d.package)});return u&&a.push(u),{componentName:c.componentName,...In(c.value.npm||{})}}).filter(c=>!!(c.componentName&&c.package&&c.version));this.materialsModel.usedMaterials=[];let i={...this.data,componentsTree:gr(n),componentsMeta:s,thirdLibs:this.data.thirdLibs,assets:[]};return(r=this.data.thirdLibs)==null||r.forEach(c=>{const u=o.find(l=>c.package===l.package);u&&a.push(u)}),i.assets=af(a,c=>c.package),i=Wn(i,["id"]),JSON.parse(JSON.stringify(i))}getRootNode(){return this.data.componentsTree}}$t.ROOT_CONTAINER;var Bf=typeof global=="object"&&global&&global.Object===Object&&global;const io=Bf;var Uf=typeof self=="object"&&self&&self.Object===Object&&self,kf=io||Uf||Function("return this")();const Mt=kf;var Vf=Mt.Symbol;const Pt=Vf;var so=Object.prototype,zf=so.hasOwnProperty,Gf=so.toString,Zt=Pt?Pt.toStringTag:void 0;function Hf(t){var e=zf.call(t,Zt),r=t[Zt];try{t[Zt]=void 0;var n=!0}catch{}var o=Gf.call(t);return n&&(e?t[Zt]=r:delete t[Zt]),o}var Jf=Object.prototype,Wf=Jf.toString;function Qf(t){return Wf.call(t)}var qf="[object Null]",Yf="[object Undefined]",co=Pt?Pt.toStringTag:void 0;function te(t){return t==null?t===void 0?Yf:qf:co&&co in Object(t)?Hf(t):Qf(t)}function Dt(t){return t!=null&&typeof t=="object"}var Kf="[object Symbol]";function Xf(t){return typeof t=="symbol"||Dt(t)&&te(t)==Kf}function Zf(t,e){for(var r=-1,n=t==null?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var td=Array.isArray;const xt=td;var ed=1/0,uo=Pt?Pt.prototype:void 0,lo=uo?uo.toString:void 0;function fo(t){if(typeof t=="string")return t;if(xt(t))return Zf(t,fo)+"";if(Xf(t))return lo?lo.call(t):"";var e=t+"";return e=="0"&&1/t==-ed?"-0":e}function gt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function po(t){return t}var rd="[object AsyncFunction]",nd="[object Function]",od="[object GeneratorFunction]",ad="[object Proxy]";function _r(t){if(!gt(t))return!1;var e=te(t);return e==nd||e==od||e==rd||e==ad}var id=Mt["__core-js_shared__"];const Sr=id;var ho=function(){var t=/[^.]+$/.exec(Sr&&Sr.keys&&Sr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function sd(t){return!!ho&&ho in t}var cd=Function.prototype,ud=cd.toString;function ld(t){if(t!=null){try{return ud.call(t)}catch{}try{return t+""}catch{}}return""}var fd=/[\\^$.*+?()[\]{}|]/g,dd=/^\[object .+?Constructor\]$/,pd=Function.prototype,hd=Object.prototype,md=pd.toString,vd=hd.hasOwnProperty,gd=RegExp("^"+md.call(vd).replace(fd,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function yd(t){if(!gt(t)||sd(t))return!1;var e=_r(t)?gd:dd;return e.test(ld(t))}function bd(t,e){return t==null?void 0:t[e]}function jr(t,e){var r=bd(t,e);return yd(r)?r:void 0}var mo=Object.create,_d=function(){function t(){}return function(e){if(!gt(e))return{};if(mo)return mo(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();const Sd=_d;function jd(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Od(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Cd=800,wd=16,Ed=Date.now;function Nd(t){var e=0,r=0;return function(){var n=Ed(),o=wd-(n-r);if(r=n,o>0){if(++e>=Cd)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function Td(t){return function(){return t}}var $d=function(){try{var t=jr(Object,"defineProperty");return t({},"",{}),t}catch{}}();const ye=$d;var Ad=ye?function(t,e){return ye(t,"toString",{configurable:!0,enumerable:!1,value:Td(e),writable:!0})}:po,Md=Nd(Ad);const Pd=Md;var Dd=9007199254740991,xd=/^(?:0|[1-9]\d*)$/;function vo(t,e){var r=typeof t;return e=e??Dd,!!e&&(r=="number"||r!="symbol"&&xd.test(t))&&t>-1&&t%1==0&&t<e}function Or(t,e,r){e=="__proto__"&&ye?ye(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function be(t,e){return t===e||t!==t&&e!==e}var Id=Object.prototype,Rd=Id.hasOwnProperty;function Ld(t,e,r){var n=t[e];(!(Rd.call(t,e)&&be(n,r))||r===void 0&&!(e in t))&&Or(t,e,r)}function Fd(t,e,r,n){var o=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var i=e[a],c=n?n(r[i],t[i],i,r,t):void 0;c===void 0&&(c=t[i]),o?Or(r,i,c):Ld(r,i,c)}return r}var go=Math.max;function Bd(t,e,r){return e=go(e===void 0?t.length-1:e,0),function(){for(var n=arguments,o=-1,a=go(n.length-e,0),s=Array(a);++o<a;)s[o]=n[e+o];o=-1;for(var i=Array(e+1);++o<e;)i[o]=n[o];return i[e]=r(s),jd(t,this,i)}}function Ud(t,e){return Pd(Bd(t,e,po),t+"")}var kd=9007199254740991;function yo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=kd}function Cr(t){return t!=null&&yo(t.length)&&!_r(t)}function Vd(t,e,r){if(!gt(r))return!1;var n=typeof e;return(n=="number"?Cr(r)&&vo(e,r.length):n=="string"&&e in r)?be(r[e],t):!1}function zd(t){return Ud(function(e,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=t.length>3&&typeof a=="function"?(o--,a):void 0,s&&Vd(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),e=Object(e);++n<o;){var i=r[n];i&&t(e,i,n,a)}return e})}var Gd=Object.prototype;function bo(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Gd;return t===r}function Hd(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Jd="[object Arguments]";function _o(t){return Dt(t)&&te(t)==Jd}var So=Object.prototype,Wd=So.hasOwnProperty,Qd=So.propertyIsEnumerable,qd=_o(function(){return arguments}())?_o:function(t){return Dt(t)&&Wd.call(t,"callee")&&!Qd.call(t,"callee")};const wr=qd;function Yd(){return!1}var jo=typeof v=="object"&&v&&!v.nodeType&&v,Oo=jo&&typeof module=="object"&&module&&!module.nodeType&&module,Kd=Oo&&Oo.exports===jo,Co=Kd?Mt.Buffer:void 0,Xd=Co?Co.isBuffer:void 0,Zd=Xd||Yd;const wo=Zd;var tp="[object Arguments]",ep="[object Array]",rp="[object Boolean]",np="[object Date]",op="[object Error]",ap="[object Function]",ip="[object Map]",sp="[object Number]",cp="[object Object]",up="[object RegExp]",lp="[object Set]",fp="[object String]",dp="[object WeakMap]",pp="[object ArrayBuffer]",hp="[object DataView]",mp="[object Float32Array]",vp="[object Float64Array]",gp="[object Int8Array]",yp="[object Int16Array]",bp="[object Int32Array]",_p="[object Uint8Array]",Sp="[object Uint8ClampedArray]",jp="[object Uint16Array]",Op="[object Uint32Array]",$={};$[mp]=$[vp]=$[gp]=$[yp]=$[bp]=$[_p]=$[Sp]=$[jp]=$[Op]=!0,$[tp]=$[ep]=$[pp]=$[rp]=$[hp]=$[np]=$[op]=$[ap]=$[ip]=$[sp]=$[cp]=$[up]=$[lp]=$[fp]=$[dp]=!1;function Cp(t){return Dt(t)&&yo(t.length)&&!!$[te(t)]}function wp(t){return function(e){return t(e)}}var Eo=typeof v=="object"&&v&&!v.nodeType&&v,ee=Eo&&typeof module=="object"&&module&&!module.nodeType&&module,Ep=ee&&ee.exports===Eo,Er=Ep&&io.process,Np=function(){try{var t=ee&&ee.require&&ee.require("util").types;return t||Er&&Er.binding&&Er.binding("util")}catch{}}();const No=Np;var To=No&&No.isTypedArray,Tp=To?wp(To):Cp;const $o=Tp;var $p=Object.prototype,Ap=$p.hasOwnProperty;function Mp(t,e){var r=xt(t),n=!r&&wr(t),o=!r&&!n&&wo(t),a=!r&&!n&&!o&&$o(t),s=r||n||o||a,i=s?Hd(t.length,String):[],c=i.length;for(var u in t)(e||Ap.call(t,u))&&!(s&&(u=="length"||o&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||vo(u,c)))&&i.push(u);return i}function Pp(t,e){return function(r){return t(e(r))}}function Dp(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var xp=Object.prototype,Ip=xp.hasOwnProperty;function Rp(t){if(!gt(t))return Dp(t);var e=bo(t),r=[];for(var n in t)n=="constructor"&&(e||!Ip.call(t,n))||r.push(n);return r}function Ao(t){return Cr(t)?Mp(t,!0):Rp(t)}var Lp=jr(Object,"create");const re=Lp;function Fp(){this.__data__=re?re(null):{},this.size=0}function Bp(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Up="__lodash_hash_undefined__",kp=Object.prototype,Vp=kp.hasOwnProperty;function zp(t){var e=this.__data__;if(re){var r=e[t];return r===Up?void 0:r}return Vp.call(e,t)?e[t]:void 0}var Gp=Object.prototype,Hp=Gp.hasOwnProperty;function Jp(t){var e=this.__data__;return re?e[t]!==void 0:Hp.call(e,t)}var Wp="__lodash_hash_undefined__";function Qp(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=re&&e===void 0?Wp:e,this}function yt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}yt.prototype.clear=Fp,yt.prototype.delete=Bp,yt.prototype.get=zp,yt.prototype.has=Jp,yt.prototype.set=Qp;function qp(){this.__data__=[],this.size=0}function _e(t,e){for(var r=t.length;r--;)if(be(t[r][0],e))return r;return-1}var Yp=Array.prototype,Kp=Yp.splice;function Xp(t){var e=this.__data__,r=_e(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Kp.call(e,r,1),--this.size,!0}function Zp(t){var e=this.__data__,r=_e(e,t);return r<0?void 0:e[r][1]}function th(t){return _e(this.__data__,t)>-1}function eh(t,e){var r=this.__data__,n=_e(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function nt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}nt.prototype.clear=qp,nt.prototype.delete=Xp,nt.prototype.get=Zp,nt.prototype.has=th,nt.prototype.set=eh;var rh=jr(Mt,"Map");const Mo=rh;function nh(){this.size=0,this.__data__={hash:new yt,map:new(Mo||nt),string:new yt}}function oh(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Se(t,e){var r=t.__data__;return oh(e)?r[typeof e=="string"?"string":"hash"]:r.map}function ah(t){var e=Se(this,t).delete(t);return this.size-=e?1:0,e}function ih(t){return Se(this,t).get(t)}function sh(t){return Se(this,t).has(t)}function ch(t,e){var r=Se(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}function It(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}It.prototype.clear=nh,It.prototype.delete=ah,It.prototype.get=ih,It.prototype.has=sh,It.prototype.set=ch;function Po(t){return t==null?"":fo(t)}var uh=Pp(Object.getPrototypeOf,Object);const Do=uh;var lh="[object Object]",fh=Function.prototype,dh=Object.prototype,xo=fh.toString,ph=dh.hasOwnProperty,hh=xo.call(Object);function Rt(t){if(!Dt(t)||te(t)!=lh)return!1;var e=Do(t);if(e===null)return!0;var r=ph.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&xo.call(r)==hh}function mh(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var a=Array(o);++n<o;)a[n]=t[n+e];return a}function vh(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:mh(t,e,r)}var gh="\\ud800-\\udfff",yh="\\u0300-\\u036f",bh="\\ufe20-\\ufe2f",_h="\\u20d0-\\u20ff",Sh=yh+bh+_h,jh="\\ufe0e\\ufe0f",Oh="\\u200d",Ch=RegExp("["+Oh+gh+Sh+jh+"]");function Io(t){return Ch.test(t)}function wh(t){return t.split("")}var Ro="\\ud800-\\udfff",Eh="\\u0300-\\u036f",Nh="\\ufe20-\\ufe2f",Th="\\u20d0-\\u20ff",$h=Eh+Nh+Th,Ah="\\ufe0e\\ufe0f",Mh="["+Ro+"]",Nr="["+$h+"]",Tr="\\ud83c[\\udffb-\\udfff]",Ph="(?:"+Nr+"|"+Tr+")",Lo="[^"+Ro+"]",Fo="(?:\\ud83c[\\udde6-\\uddff]){2}",Bo="[\\ud800-\\udbff][\\udc00-\\udfff]",Dh="\\u200d",Uo=Ph+"?",ko="["+Ah+"]?",xh="(?:"+Dh+"(?:"+[Lo,Fo,Bo].join("|")+")"+ko+Uo+")*",Ih=ko+Uo+xh,Rh="(?:"+[Lo+Nr+"?",Nr,Fo,Bo,Mh].join("|")+")",Lh=RegExp(Tr+"(?="+Tr+")|"+Rh+Ih,"g");function Fh(t){return t.match(Lh)||[]}function Bh(t){return Io(t)?Fh(t):wh(t)}function Uh(t){return function(e){e=Po(e);var r=Io(e)?Bh(e):void 0,n=r?r[0]:e.charAt(0),o=r?vh(r,1).join(""):e.slice(1);return n[t]()+o}}var kh=Uh("toUpperCase");const Vh=kh;function zh(t){return Vh(Po(t).toLowerCase())}function Gh(){this.__data__=new nt,this.size=0}function Hh(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function Jh(t){return this.__data__.get(t)}function Wh(t){return this.__data__.has(t)}var Qh=200;function qh(t,e){var r=this.__data__;if(r instanceof nt){var n=r.__data__;if(!Mo||n.length<Qh-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new It(n)}return r.set(t,e),this.size=r.size,this}function Lt(t){var e=this.__data__=new nt(t);this.size=e.size}Lt.prototype.clear=Gh,Lt.prototype.delete=Hh,Lt.prototype.get=Jh,Lt.prototype.has=Wh,Lt.prototype.set=qh;var Vo=typeof v=="object"&&v&&!v.nodeType&&v,zo=Vo&&typeof module=="object"&&module&&!module.nodeType&&module,Yh=zo&&zo.exports===Vo,Go=Yh?Mt.Buffer:void 0,Ho=Go?Go.allocUnsafe:void 0;function Kh(t,e){if(e)return t.slice();var r=t.length,n=Ho?Ho(r):new t.constructor(r);return t.copy(n),n}var Xh=Mt.Uint8Array;const Jo=Xh;function Zh(t){var e=new t.constructor(t.byteLength);return new Jo(e).set(new Jo(t)),e}function tm(t,e){var r=e?Zh(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function em(t){return typeof t.constructor=="function"&&!bo(t)?Sd(Do(t)):{}}function rm(t){return function(e,r,n){for(var o=-1,a=Object(e),s=n(e),i=s.length;i--;){var c=s[t?i:++o];if(r(a[c],c,a)===!1)break}return e}}var nm=rm();const om=nm;function $r(t,e,r){(r!==void 0&&!be(t[e],r)||r===void 0&&!(e in t))&&Or(t,e,r)}function am(t){return Dt(t)&&Cr(t)}function Ar(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function im(t){return Fd(t,Ao(t))}function sm(t,e,r,n,o,a,s){var i=Ar(t,r),c=Ar(e,r),u=s.get(c);if(u){$r(t,r,u);return}var l=a?a(i,c,r+"",t,e,s):void 0,d=l===void 0;if(d){var f=xt(c),p=!f&&wo(c),g=!f&&!p&&$o(c);l=c,f||p||g?xt(i)?l=i:am(i)?l=Od(i):p?(d=!1,l=Kh(c,!0)):g?(d=!1,l=tm(c,!0)):l=[]:Rt(c)||wr(c)?(l=i,wr(i)?l=im(i):(!gt(i)||_r(i))&&(l=em(c))):d=!1}d&&(s.set(c,l),o(l,c,n,a,s),s.delete(c)),$r(t,r,l)}function Wo(t,e,r,n,o){t!==e&&om(e,function(a,s){if(o||(o=new Lt),gt(a))sm(t,e,s,r,Wo,n,o);else{var i=n?n(Ar(t,s),a,s+"",t,e,o):void 0;i===void 0&&(i=a),$r(t,s,i)}},Ao)}var cm=zd(function(t,e,r){Wo(t,e,r)});const um=cm,lm=function(t){return!(!t||typeof t!="function"||!t.prototype)};function Qo(t){const e=t.prototype;return!!(e&&e.isReactComponent)}function qo(t){var n,o;const r=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.forward_ref"):60112;return(t==null?void 0:t.$$typeof)===r||((n=t==null?void 0:t.prototype)==null?void 0:n.isReactComponent)||((o=t==null?void 0:t.prototype)==null?void 0:o.setState)||t._forwardRef}function Yo(t){class e extends S.Component{render(){return S.createElement(t,this.props)}}return e.displayName=t.displayName,e}const bt=(t,e)=>{const r=n=>{const a=`
7
7
  ${Object.keys(e).map(s=>`const ${s} = $$context['${s}'];`).join(`
8
8
  `)}
9
9
  return ${n};