🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

msf-editor

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msf-editor - npm Package Compare versions

Comparing version
0.8.0
to
0.9.0
dist/cjs/index-2767e21e.js

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+1
import{r as i,c as t,h as s,g as e}from"./p-54bac826.js";let o=class{constructor(s){i(this,s),this.editorEvent=t(this,"editorEvent",7),this.content="",this.assetsLoaded=!1,this.modalOpen=!1}sendMessage(i,t){this.editorFrame.contentWindow.postMessage({action:i,data:t},"*")}async save(i={}){this.sendMessage("save",i)}async test(){console.log("Only a test")}async spinner(i){["hide","show"].includes(i)||(i="hide"),this.sendMessage("showSpinner",{behavior:i})}async start(i){this.sendMessage("load",i)}async sendTest(i){this.sendMessage("sendTest",i)}async beforeUnload(i){this.sendMessage("beforeUnload",i)}async load(i){this.sendMessage("load",i)}async preview(i){this.sendMessage("preview",i)}async initConfig(){console.info("MailStyler Plugin: loading assets .."),this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise&&(this.config.rteToolbars.toolbar_0=await this.config.rteToolbars.toolbar_0),this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise&&(this.config.lang.custom=await this.config.lang.custom),this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise&&(this.config.rteToolbars.toolbar_1=await this.config.rteToolbars.toolbar_1);const i=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=i?"http://localhost:4200":this.editorUrl,this.assetsLoaded=!0,console.info("MailStyler Plugin: assets loaded!")}async componentWillRender(){!this.assetsLoaded&&this.config&&await this.initConfig()}render(){return s("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})}editorDidOpen(){this.load(this.content||"").then((()=>console.log("MailStyler Plugin: Template is loaded succesfully")))}listenMessage(i){if(i.data&&i.data.action){const{action:t,data:s}=i.data;if("appOk"===t)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===t){let i=Object.assign({},this.config);Object.keys(i).filter((t=>"function"==typeof i[t])).forEach((t=>delete i[t])),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:i})}else if("appSave"===t){const i=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(i,""),s.raw_html=s.raw_html.replace(i,""),"function"==typeof this.config.onSave?this.config.onSave(s.html,s.raw_html,s.json,s.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appAutoSave"===t){const i=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(i,""),s.raw_html=s.raw_html.replace(i,""),"function"==typeof this.config.onAutoSave?this.config.onAutoSave(s.html,s.raw_html,s.json,s.opts):console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}else if("appSaveBlock"===t){const i=new RegExp('bgcolor="none"',"g");s.html=s.html.replace(i,""),s.raw_html=s.raw_html.replace(i,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(s.html,s.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===t&&(this.modalOpen="open"===s.env);this.editorEvent.emit({action:t,data:s})}}componentWillLoad(i){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),i&&this.listenMessage(i)}get element(){return e(this)}};o.style=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";export{o as ms_editor}
let t,e,n=!1;const i="undefined"!=typeof window?window:{},s=i.document||{head:{}},l={t:0,i:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,i)=>t.addEventListener(e,n,i),rel:(t,e,n,i)=>t.removeEventListener(e,n,i),ce:(t,e)=>new CustomEvent(t,e)},o=t=>Promise.resolve(t),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(t){}return!1})(),c=(t,e,n)=>{n&&n.map((([n,i,s])=>{const o=f(t,n),r=u(e,s),c=h(n);l.ael(o,i,r,c),(e.l=e.l||[]).push((()=>l.rel(o,i,r,c)))}))},u=(t,e)=>n=>{try{256&t.t?t.o[e](n):(t.u=t.u||[]).push([e,n])}catch(e){bt(e,t.h||null)}},f=(t,e)=>8&e?i:t,h=t=>0!=(2&t),a=new WeakMap,b=t=>"sc-"+t.m,d={},m=t=>"object"==(t=typeof t)||"function"===t,j=(t,e,...n)=>{let i=null,s=!1,l=!1,o=[];const r=e=>{for(let n=0;n<e.length;n++)i=e[n],Array.isArray(i)?r(i):null!=i&&"boolean"!=typeof i&&((s="function"!=typeof t&&!m(i))&&(i+=""),s&&l?o[o.length-1].j+=i:o.push(s?y(null,i):i),l=s)};if(r(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}const c=y(t,null);return c.$=e,o.length>0&&(c.p=o),c},y=(t,e)=>({t:0,O:t,j:e,g:null,p:null,$:null}),$={},p=(t,e,n,i,s,l)=>{if(n!==i){let o=at(t,e);if(e.toLowerCase(),"class"===e){const e=t.classList,s=g(n),l=g(i);e.remove(...s.filter((t=>t&&!l.includes(t)))),e.add(...l.filter((t=>t&&!s.includes(t))))}else{const r=m(i);if((o||r&&null!==i)&&!s)try{if(t.tagName.includes("-"))t[e]=i;else{let s=null==i?"":i;"list"===e?o=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(t){}null==i||!1===i?!1===i&&""!==t.getAttribute(e)||t.removeAttribute(e):(!o||4&l||s)&&!r&&t.setAttribute(e,i=!0===i?"":i)}}},O=/\s/,g=t=>t?t.split(O):[],w=(t,e,n,i)=>{const s=11===e.g.nodeType&&e.g.host?e.g.host:e.g,l=t&&t.$||d,o=e.$||d;for(i in l)i in o||p(s,i,l[i],void 0,n,e.t);for(i in o)p(s,i,l[i],o[i],n,e.t)},v=t=>{class e extends Array{item(t){return this[t]}}const n=Object.getOwnPropertyDescriptor(Node.prototype,"childNodes");n&&Object.defineProperty(t,"__childNodes",n);let i=Object.getOwnPropertyDescriptor(Element.prototype,"children");i||(i=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")),i&&Object.defineProperty(t,"__children",i);const s=Object.getOwnPropertyDescriptor(Element.prototype,"childElementCount");s&&Object.defineProperty(t,"__childElementCount",s),Object.defineProperty(t,"children",{get(){return this.childNodes.map((t=>1===t.nodeType?t:null)).filter((t=>!!t))}}),Object.defineProperty(t,"childElementCount",{get:()=>t.children.length}),n&&Object.defineProperty(t,"childNodes",{get(){const t=this.__childNodes,n=new e;for(let e=0;e<t.length;e++){const i=t[e]["s-nr"];i&&n.push(i)}return n}})},M=t=>{let e=Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML");e||(e=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML")),e&&Object.defineProperty(t,"__innerHTML",e),Object.defineProperty(t,"innerHTML",{get:function(){let t="";return this.childNodes.forEach((e=>t+=e.outerHTML||e.textContent)),t},set:function(t){this.childNodes.forEach((t=>{t["s-ol"]&&t["s-ol"].remove(),t.remove()})),this.insertAdjacentHTML("beforeend",t)}})},T=t=>{let e=Object.getOwnPropertyDescriptor(Element.prototype,"innerText");e||(e=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerText")),e&&Object.defineProperty(t,"__innerText",e),Object.defineProperty(t,"innerText",{get:function(){let t="";return this.childNodes.forEach((e=>t+=e.innerText||e.textContent.trimEnd())),t},set:function(t){this.childNodes.forEach((t=>{t["s-ol"]&&t["s-ol"].remove(),t.remove()})),this.insertAdjacentHTML("beforeend",t)}})},_=t=>{const e=Object.getOwnPropertyDescriptor(Node.prototype,"textContent");e&&Object.defineProperty(t,"__textContent",e),Object.defineProperty(t,"textContent",{get:function(){let t="";return this.childNodes.forEach((e=>t+=e.textContent||"")),t},set:function(t){this.childNodes.forEach((t=>{t["s-ol"]&&t["s-ol"].remove(),t.remove()})),this.insertAdjacentHTML("beforeend",t)}})},E=t=>{t&&!t.__remove&&(t.__remove=t.remove||!0,S(t.parentNode),t.remove=function(){return this.parentNode?this.parentNode.removeChild(this):this.__remove()})},S=t=>{t&&!t.__removeChild&&(t.__removeChild=t.removeChild,t.removeChild=function(t){if(t["s-sn"]){const e=A(this.__childNodes||this.childNodes,t["s-sn"]);return this.__removeChild(t),void(e&&e["s-hsf"]&&q(this))}return this.__removeChild(t)})},C=t=>{t.__appendChild||(t.__appendChild=t.appendChild,t.appendChild=function(t){const e=t["s-sn"]=W(t),n=A(this.__childNodes,e);if(n){const i=document.createTextNode("");i["s-nr"]=t,n["s-cr"].parentNode&&n["s-cr"].parentNode.__appendChild(i),t["s-ol"]=i,E(t);const s=R(n,e),l=s[s.length-1];return l.parentNode.insertBefore(t,l.nextSibling),S(t.parentNode),void(n["s-hsf"]&&q(n.parentNode))}return 1===t.nodeType&&t.getAttribute("slot")&&this.__childNodes&&(t.hidden=!0),this.__appendChild(t)})},x=t=>{t.__prepend||(t.__prepend=t.prepend,t.prepend=function(...t){t.forEach((t=>{"string"==typeof t&&(t=this.ownerDocument.createTextNode(t));const e=t["s-sn"]=W(t),n=A(this.__childNodes,e);if(n){const i=document.createTextNode("");i["s-nr"]=t,n["s-cr"].parentNode&&n["s-cr"].parentNode.__appendChild(i),t["s-ol"]=i,E(t);const s=R(n,e)[0];return s.parentNode.insertBefore(t,s.nextSibling),S(t.parentNode),void(n["s-hsf"]&&q(n.parentNode))}return 1===t.nodeType&&t.getAttribute("slot")&&this.__childNodes&&(t.hidden=!0),this.__prepend(t)}))})},L=t=>{t.__append||(t.__append=t.append,t.append=function(...t){t.forEach((t=>{"string"==typeof t&&(t=this.ownerDocument.createTextNode(t)),this.appendChild(t)}))})},k=t=>{t.__replaceChildren||(t.__replaceChildren=t.replaceChildren,t.replaceChildren=function(...t){const e=A(this.__childNodes,"");e&&(R(e,"").forEach((t=>{t["s-sr"]||t.remove()})),this.append(...t))})},H=t=>{t.__insertAdjacentHTML||(t.__insertAdjacentHTML=t.insertAdjacentHTML,t.insertAdjacentHTML=function(t,e){if("afterbegin"!==t&&"beforeend"!==t)return this.__insertAdjacentHTML(t,e);const n=this.ownerDocument.createElement("_");let i;if(n.innerHTML=e,"afterbegin"===t)for(;i=n.firstChild;)this.prepend(i);else if("beforeend"===t)for(;i=n.firstChild;)this.append(i)})},N=t=>{t.__insertAdjacentText||(t.__insertAdjacentText=t.insertAdjacentText,t.insertAdjacentText=function(t,e){this.insertAdjacentHTML(t,e)})},P=t=>{t.__insertAdjacentElement||(t.__insertAdjacentElement=t.insertAdjacentElement,t.insertAdjacentElement=function(t,e){if("afterbegin"!==t&&"beforeend"!==t)return this.__insertAdjacentElement(t,e);"afterbegin"===t?this.prepend(e):"beforeend"===t&&this.append(e)})},W=t=>t["s-sn"]||1===t.nodeType&&t.getAttribute("slot")||t.slot||"",A=(t,e)=>{let n,i=0;if(!t)return null;for(;i<t.length;i++){if(n=t[i],n["s-sr"]&&n["s-sn"]===e)return n;if(n=A(n.childNodes,e),n)return n}return null},R=(t,e)=>{const n=[t];for(;(t=t.nextSibling)&&t["s-sn"]===e;)n.push(t);return n},U=(t,e)=>{if(!t["s-hsf"])return;let n=t;for(;(n=n.previousSibling||n.parentNode)&&n.tagName!==t["s-hn"];)n["s-sr"]&&e&&n["s-psn"]&&n["s-psn"]===t["s-sn"]?U(n,!0):n["s-sn"]===t["s-sn"]&&(1===n.nodeType?(n.hidden=e,n.style.display=e?"none":""):n["s-sfc"]&&(e?(n["s-sfc"]=n.textContent,n.textContent=""):""===n.textContent.trim()&&(n.textContent=n["s-sfc"])))},q=t=>{let e,n,i,s,l,o,r=t.__childNodes||t.childNodes;for(n=0,i=r.length;n<i;n++){if(e=r[n],e["s-sr"])for(l=e["s-sn"],U(e,!1),s=0;s<i;s++)if(o=r[s].nodeType,!r[s]["s-sf"])if(r[s]["s-hn"]!==e["s-hn"]||""!==l){if(1===o&&l===r[s]["s-sn"]){U(e,!0),E(r[s]);break}}else if(r[s]["s-sn"]===l&&(1===o||3===o&&""!==r[s].textContent.trim())){U(e,!0),E(r[s]);break}q(e)}},F=(e,n,i)=>{let l,o,r=n.p[i],c=0;if(l=r.g=s.createElement(r.O),w(null,r,!1),null!=t&&l["s-si"]!==t&&l.classList.add(l["s-si"]=t),r.p)for(c=0;c<r.p.length;++c)o=F(e,r,c),o&&(l.__appendChild?l.__appendChild(o):l.appendChild(o));return l},V=(t,n,i,s,l,o)=>{let r,c=t;for(c.shadowRoot&&c.tagName===e&&(c=c.shadowRoot);l<=o;++l)s[l]&&(r=F(null,i,l),r&&(s[l].g=r,c.insertBefore(r,n)))},z=(t,e,n,i)=>{for(;e<=n;++e)(i=t[e])&&i.g.remove()},B=(t,e)=>t.O===e.O,D=(t,e)=>{const n=e.g=t.g,i=t.p,s=e.p;w(t,e,!1),null!==i&&null!==s?((t,e,n,i)=>{let s,l,o,r,c,u,f,h,a=0,b=0,d=0,m=0,j=e.length-1,y=e[0],$=e[j],p=i.length-1,O=i[0],g=i[p],w=[],v={};for(;a<=j&&b<=p;)null==y?y=e[++a]:null==$?$=e[--j]:null==O?O=i[++b]:null==g?g=i[--p]:B(y,O)?(D(y,O),y=e[++a],O=i[++b]):B($,g)?(D($,g),$=e[--j],g=i[--p]):B(y,g)?(D(y,g),t.insertBefore(y.g,$.g.nextSibling),y=e[++a],g=i[--p]):B($,O)?(D($,O),t.insertBefore($.g,y.g),$=e[--j],O=i[++b]):(s=F(e&&e[b],n,b),O=i[++b],s&&y.g.parentNode.insertBefore(s,y.g));if(a>j?V(t,null==i[p+1]?null:i[p+1].g,n,i,b,p):b>p&&z(e,a,j),t.parentNode&&n.g["s-hsf"]){for(l=t.parentNode.__childNodes||t.parentNode.childNodes,o=l.length-1,d=0;d<=o;++d)u=l[d],u["s-hsf"]?w.push(u):u["s-sf"]&&(v[u["s-sn"]]||(v[u["s-sn"]]=[]),v[u["s-sn"]].push(u));for(r=w.length-1,d=0;d<=r;++d)if(f=w[d],v[f["s-sn"]])for(c=v[f["s-sn"]].length-1,m=0;m<=c;++m)h=v[f["s-sn"]][m],f.parentNode.insertBefore(h,f)}})(n,i,e,s):null!==s?V(n,null,e,s,0,s.length-1):null!==i&&z(i,0,i.length-1)},G=t=>ut(t).h,I=(t,e,n)=>{const i=G(t);return{emit:t=>J(i,e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t})}},J=(t,e,n)=>{const i=l.ce(e,n);return t.dispatchEvent(i),i},K=(t,e)=>{e&&!t.v&&e["s-p"]&&e["s-p"].push(new Promise((e=>t.v=e)))},Q=(t,e)=>{if(t.t|=16,!(4&t.t))return K(t,t.M),vt((()=>X(t,e)));t.t|=512},X=(t,e)=>{const n=t.h,i=t.o;let s;return e&&(t.t|=256,t.u&&(t.u.map((([t,e])=>nt(i,t,e,n))),t.u=null),s=nt(i,"componentWillLoad",void 0,n)),s=it(s,(()=>nt(i,"componentWillRender",void 0,n))),it(s,(()=>Y(t,i,e)))},Y=async(t,e,n)=>{const i=t.h,l=i["s-rc"];n&&(t=>{const e=t.T,n=t.h,i=e.t,l=((t,e)=>{let n=b(e),i=jt.get(n);if(t=11===t.nodeType?t:s,i)if("string"==typeof i){let e,l=a.get(t=t.head||t);l||a.set(t,l=new Set),l.has(n)||(e=s.createElement("style"),e.innerHTML=i,t.insertBefore(e,t.querySelector("link")),l&&l.add(n))}else t.adoptedStyleSheets.includes(i)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,i]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&i&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);Z(t,e),l&&(l.map((t=>t())),i["s-rc"]=void 0);{const e=i["s-p"],n=()=>tt(t);0===e.length?n():(Promise.all(e).then(n),t.t|=4,e.length=0)}},Z=(n,i)=>{try{i=i.render(),n.t&=-17,n.t|=2,((n,i)=>{const s=n.h,l=n._||y(null,null),o=(t=>t&&t.O===$)(i)?i:j(null,null,i);e=s.tagName,o.O=null,o.t|=4,n._=o,o.g=l.g=s.shadowRoot||s,t=s["s-sc"],D(l,o)})(n,i)}catch(t){bt(t,n.h)}return null},tt=t=>{const e=t.h,n=t.M;64&t.t||(t.t|=64,st(e),t.S(e),n||et()),t.C(e),t.v&&(t.v(),t.v=void 0),512&t.t&&wt((()=>Q(t,!1))),t.t&=-517},et=()=>{st(s.documentElement),wt((()=>J(i,"appload",{detail:{namespace:"msf-editor"}})))},nt=(t,e,n,i)=>{if(t&&t[e])try{return t[e](n)}catch(t){bt(t,i)}},it=(t,e)=>t&&t.then?t.then(e):e(),st=t=>t.classList.add("hydrated"),lt=(t,e,n,i)=>{const s=ut(t),l=s.L.get(e),o=s.t,r=s.o;n=((t,e)=>null==t||m(t)?t:1&e?t+"":t)(n,i.k[e][0]),8&o&&void 0!==l||n===l||(s.L.set(e,n),r&&2==(18&o)&&Q(s,!1))},ot=(t,e,n)=>{if(e.k){const i=Object.entries(e.k),s=t.prototype;if(i.map((([t,[i]])=>{if(31&i||2&n&&32&i){if(0==(2048&i)?Object.defineProperty(s,t,{get(){return((t,e)=>ut(this).L.get(e))(0,t)},set(n){lt(this,t,n,e)},configurable:!0,enumerable:!0}):1&n&&2048&i&&Object.defineProperty(s,t,{get(){const e=ut(this),n=e?e.o:s;if(n)return n[t]},configurable:!0,enumerable:!0}),4096&i){const n=Object.getOwnPropertyDescriptor(s,t).set;Object.defineProperty(s,t,{set(i){const s=ut(this);if(n)return n.call(this,i),void lt(this,t,s.h[t],e);if(!s)return;const l=()=>{s.o[t]=i,lt(this,t,s.o[t],e)};s.o?l():s.H.then((()=>l()))}})}}else 1&n&&64&i&&Object.defineProperty(s,t,{value(...e){const n=ut(this);return n.H.then((()=>n.o[t](...e)))}})})),1&n){const e=new Map;s.attributeChangedCallback=function(t,n,i){l.jmp((()=>{const n=e.get(t);if(this.hasOwnProperty(n))i=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==i)return;const l=Object.getOwnPropertyDescriptor(s,n);l.get&&!l.set||(this[n]=(null!==i||"boolean"!=typeof this[n])&&i)}))},t.observedAttributes=i.filter((([t,e])=>15&e[0])).map((([t,n])=>{const i=n[1]||t;return e.set(i,t),i}))}}return t},rt=(t,e={})=>{const n=[],o=e.exclude||[],u=i.customElements,f=s.head,h=f.querySelector("meta[charset]"),a=s.createElement("style"),d=[];let m,j=!0;Object.assign(l,e),l.i=new URL(e.resourcesUrl||"./",s.baseURI).href,t.map((t=>{t[1].map((e=>{const i={t:e[0],m:e[1],k:e[2],N:e[3]};i.k=e[2],i.N=e[3];const s=i.m,f=class extends HTMLElement{constructor(t){super(t),ht(t=this,i),1&i.t&&t.attachShadow({mode:"open"})}connectedCallback(){m&&(clearTimeout(m),m=null),j?d.push(this):l.jmp((()=>(t=>{if(0==(1&l.t)){const e=ut(t),n=e.T,i=()=>{};if(1&e.t)c(t,e,n.N);else{e.t|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){K(e,e.M=n);break}}n.k&&Object.entries(n.k).map((([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n,i,s)=>{if(0==(32&e.t)){{if(e.t|=32,(s=mt(n,e)).then){const t=()=>{};s=await s,t()}s.isProxied||(ot(s,n,2),s.isProxied=!0);const i=()=>{};e.t|=8;try{new s(e)}catch(e){bt(e,t)}e.t&=-9,i()}if(s.style){let t=s.style;const e=b(n);if(!jt.has(e)){const i=()=>{};((t,e,n)=>{let i=jt.get(t);r&&n?(i=i||new CSSStyleSheet,i.replace(e)):i=e,jt.set(t,i)})(e,t,!!(1&n.t)),i()}}}const l=e.M,o=()=>Q(e,!0);l&&l["s-rc"]?l["s-rc"].push(o):o()})(t,e,n)}i()}})(this)))}disconnectedCallback(){l.jmp((()=>(()=>{if(0==(1&l.t)){const t=ut(this);t.l&&(t.l.map((t=>t())),t.l=void 0)}})()))}componentOnReady(){return ut(this).P}};(4&i.t||8&i.t)&&(t=>{v(t),C(t),L(t),x(t),H(t),N(t),P(t),k(t),M(t),T(t),_(t)})(f.prototype),i.W=t[0],o.includes(s)||u.get(s)||(n.push(s),u.define(s,ot(f,i,1)))}))})),a.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",a.setAttribute("data-styles",""),f.insertBefore(a,h?h.nextSibling:f.firstChild),j=!1,d.length?d.map((t=>t.connectedCallback())):l.jmp((()=>m=setTimeout(et,30)))},ct=new WeakMap,ut=t=>ct.get(t),ft=(t,e)=>ct.set(e.o=t,e),ht=(t,e)=>{const n={t:0,h:t,T:e,L:new Map};return n.H=new Promise((t=>n.C=t)),n.P=new Promise((t=>n.S=t)),t["s-p"]=[],t["s-rc"]=[],c(t,n,e.N),ct.set(t,n)},at=(t,e)=>e in t,bt=(t,e)=>(0,console.error)(t,e),dt=new Map,mt=(t,e)=>{const n=t.m.replace(/-/g,"_"),i=t.W,s=dt.get(i);return s?s[n]:import(`./${i}.entry.js`).then((t=>(dt.set(i,t),t[n])),(t=>{bt(t,e.h)}))},jt=new Map,yt=[],$t=[],pt=(t,e)=>i=>{t.push(i),n||(n=!0,e&&4&l.t?wt(gt):l.raf(gt))},Ot=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){bt(t)}t.length=0},gt=()=>{Ot(yt),Ot($t),(n=yt.length>0)&&l.raf(gt)},wt=t=>o().then(t),vt=pt($t,!0);export{rt as b,I as c,G as g,j as h,o as p,ft as r}
+2
-2

@@ -5,6 +5,6 @@ 'use strict';

const index = require('./index-e2c5be8b.js');
const index = require('./index-2767e21e.js');
/*
Stencil Client Patch Esm v2.14.2 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Esm v2.12.2 | MIT Licensed | https://stenciljs.com
*/

@@ -11,0 +11,0 @@ const patchEsm = () => {

@@ -5,7 +5,7 @@ 'use strict';

const index = require('./index-e2c5be8b.js');
const index = require('./index-2767e21e.js');
const editorCss = ":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";
const Editor = class {
let Editor = class {
constructor(hostRef) {

@@ -12,0 +12,0 @@ index.registerInstance(this, hostRef);

'use strict';
const index = require('./index-e2c5be8b.js');
const index = require('./index-2767e21e.js');
/*
Stencil Client Patch Browser v2.14.2 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Browser v2.12.2 | MIT Licensed | https://stenciljs.com
*/

@@ -8,0 +8,0 @@ const patchBrowser = () => {

@@ -7,4 +7,4 @@ {

"name": "@stencil/core",
"version": "2.14.2",
"typescriptVersion": "4.5.4"
"version": "2.12.2",
"typescriptVersion": "4.3.5"
},

@@ -11,0 +11,0 @@ "collections": [],

@@ -164,2 +164,4 @@ import { Component, Element, Event, h, Listen, Method, Prop, State } from '@stencil/core';

},
"getter": false,
"setter": false,
"attribute": "token",

@@ -182,2 +184,4 @@ "reflect": false

},
"getter": false,
"setter": false,
"attribute": "config",

@@ -200,2 +204,4 @@ "reflect": false

},
"getter": false,
"setter": false,
"attribute": "content",

@@ -202,0 +208,0 @@ "reflect": false,

@@ -1,5 +0,5 @@

import { p as promiseResolve, b as bootstrapLazy } from './index-19dcbd9f.js';
import { p as promiseResolve, b as bootstrapLazy } from './index-91f324f7.js';
/*
Stencil Client Patch Esm v2.14.2 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Esm v2.12.2 | MIT Licensed | https://stenciljs.com
*/

@@ -6,0 +6,0 @@ const patchEsm = () => {

@@ -1,6 +0,6 @@

import { r as registerInstance, c as createEvent, h, g as getElement } from './index-19dcbd9f.js';
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-91f324f7.js';
const editorCss = ":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";
const Editor = class {
let Editor = class {
constructor(hostRef) {

@@ -7,0 +7,0 @@ registerInstance(this, hostRef);

@@ -1,5 +0,5 @@

import { p as promiseResolve, b as bootstrapLazy } from './index-19dcbd9f.js';
import { p as promiseResolve, b as bootstrapLazy } from './index-91f324f7.js';
/*
Stencil Client Patch Browser v2.14.2 | MIT Licensed | https://stenciljs.com
Stencil Client Patch Browser v2.12.2 | MIT Licensed | https://stenciljs.com
*/

@@ -6,0 +6,0 @@ const patchBrowser = () => {

@@ -1,1 +0,1 @@

var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\."+t,"."+r)}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t=s.scopeId+"-"+this.count,o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window);

@@ -1,1 +0,1 @@

import{p as e,b as o}from"./p-046f3240.js";(()=>{const o=import.meta.url,n={};return""!==o&&(n.resourcesUrl=new URL(".",o).href),e(n)})().then((e=>o([["p-42632ca2",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e)));
import{p as e,b as o}from"./p-54bac826.js";(()=>{const o=import.meta.url,n={};return""!==o&&(n.resourcesUrl=new URL(".",o).href),e(n)})().then((e=>o([["p-38c1cc9f",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e)));
declare type CustomMethodDecorator<T> = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
declare type MixinType = {
new (...args: any[]): any;
};
export interface ComponentDecorator {
(opts?: ComponentOptions): ClassDecorator;
}
export interface MixinDecorator {
(arg0: MixinType): ClassDecorator;
}
export interface ComponentOptions {

@@ -166,2 +172,7 @@ /**

/**
* JS class identifier, the content of which will be mixed-in within this component when compiled;
* similar in behaviour to extending from a base class. To correctly type the class use an interface. e.g. `export interface MyComponent extends BaseComponent {}`
*/
export declare const Mixin: MixinDecorator;
/**
* The `@Element()` decorator is a reference to the actual host element

@@ -270,2 +281,15 @@ * once it has rendered.

componentOnReady(): Promise<this>;
readonly __childNodes?: NodeListOf<Node>;
readonly __children?: HTMLCollectionOf<Element>;
readonly __childElementCount?: number;
__innerHTML?: string;
__innerText?: string;
__textContent?: string;
__append?: (...nodes: (Node | string)[]) => void;
__prepend?: (...nodes: (Node | string)[]) => void;
__appendChild?: <T extends Node>(newChild: T) => T;
__replaceChildren?: (...nodes: (Node | string)[]) => void;
__insertAdjacentElement?: (position: InsertPosition, insertedElement: Element) => Element | null;
__insertAdjacentHTML?: (where: InsertPosition, html: string) => void;
__insertAdjacentText?: (where: InsertPosition, text: string) => void;
}

@@ -272,0 +296,0 @@ /**

{
"name": "msf-editor",
"version": "0.8.0",
"version": "0.9.0",
"description": "Stencil Component Starter",

@@ -26,5 +26,5 @@ "main": "dist/index.cjs.js",

"devDependencies": {
"@stencil/core": "^2.14.2"
"@stencil/core": "npm:@johnjenkins/stencil-community@^2.12.2"
},
"license": "MIT"
}
'use strict';
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
});
}
});
}
n['default'] = e;
return Object.freeze(n);
}
const NAMESPACE = 'msf-editor';
let scopeId;
let hostTagName;
let isSvgMode = false;
let queuePending = false;
const win = typeof window !== 'undefined' ? window : {};
const doc = win.document || { head: {} };
const plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: (h) => h(),
raf: (h) => requestAnimationFrame(h),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
ce: (eventName, opts) => new CustomEvent(eventName, opts),
};
const promiseResolve = (v) => Promise.resolve(v);
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
try {
new CSSStyleSheet();
return typeof new CSSStyleSheet().replace === 'function';
}
catch (e) { }
return false;
})()
;
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
if (listeners) {
listeners.map(([flags, name, method]) => {
const target = getHostListenerTarget(elm, flags) ;
const handler = hostListenerProxy(hostRef, method);
const opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
});
}
};
const hostListenerProxy = (hostRef, methodName) => (ev) => {
try {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
}
}
}
catch (e) {
consoleError(e);
}
};
const getHostListenerTarget = (elm, flags) => {
if (flags & 8 /* TargetWindow */)
return win;
return elm;
};
// prettier-ignore
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
const createTime = (fnName, tagName = '') => {
{
return () => {
return;
};
}
};
const uniqueTime = (key, measureText) => {
{
return () => {
return;
};
}
};
const rootAppliedStyles = new WeakMap();
const registerStyle = (scopeId, cssText, allowCS) => {
let style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
let scopeId = getScopeId(cmpMeta);
let style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
}
if (!appliedStyles.has(scopeId)) {
{
{
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
}
}
return scopeId;
};
const attachStyles = (hostRef) => {
const cmpMeta = hostRef.$cmpMeta$;
const elm = hostRef.$hostElement$;
const flags = cmpMeta.$flags$;
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
if (flags & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
const EMPTY_OBJ = {};
const isDef = (v) => v != null;
const isComplexType = (o) => {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
const h = (nodeName, vnodeData, ...children) => {
let child = null;
let simple = false;
let lastSimple = false;
let vNodeChildren = [];
const walk = (c) => {
for (let i = 0; i < c.length; i++) {
child = c[i];
if (Array.isArray(child)) {
walk(child);
}
else if (child != null && typeof child !== 'boolean') {
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
child = String(child);
}
if (simple && lastSimple) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class =
typeof classData !== 'object'
? classData
: Object.keys(classData)
.filter((k) => classData[k])
.join(' ');
}
}
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
const newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null,
};
{
vnode.$attrs$ = null;
}
return vnode;
};
const Host = {};
const isHost = (node) => node && node.$tag$ === Host;
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
if (oldValue !== newValue) {
let isProp = isMemberInElement(elm, memberName);
memberName.toLowerCase();
if (memberName === 'class') {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
const newClasses = parseClassList(newValue);
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
}
else {
// Set property if it exists and it's not a SVG
const isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
let n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
if (newValue !== false || elm.getAttribute(memberName) === '') {
{
elm.removeAttribute(memberName);
}
}
}
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
}
};
const parseClassListRegex = /\s/;
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
? newVnode.$elm$.host
: newVnode.$elm$;
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
// tslint:disable-next-line: prefer-const
let newVNode = newParentVNode.$children$[childIndex];
let i = 0;
let elm;
let childNode;
{
// create element
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = (parentElm);
let childNode;
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
for (; startIdx <= endIdx; ++startIdx) {
if ((vnode = vnodes[startIdx])) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
let oldStartIdx = 0;
let newStartIdx = 0;
let oldEndIdx = oldCh.length - 1;
let oldStartVnode = oldCh[0];
let oldEndVnode = oldCh[oldEndIdx];
let newEndIdx = newCh.length - 1;
let newStartVnode = newCh[0];
let newEndVnode = newCh[newEndIdx];
let node;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
}
else if (newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
const isSameVnode = (vnode1, vnode2) => {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
const patch = (oldVNode, newVNode) => {
const elm = (newVNode.$elm$ = oldVNode.$elm$);
const oldChildren = oldVNode.$children$;
const newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if (oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if (oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
const renderVdom = (hostRef, renderFnResults) => {
const hostElm = hostRef.$hostElement$;
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
hostTagName = hostElm.tagName;
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
const createEvent = (ref, name, flags) => {
const elm = getElement(ref);
return {
emit: (detail) => {
return emitEvent(elm, name, {
bubbles: !!(flags & 4 /* Bubbles */),
composed: !!(flags & 2 /* Composed */),
cancelable: !!(flags & 1 /* Cancellable */),
detail,
});
},
};
};
/**
* Helper function to create & dispatch a custom Event on a provided target
* @param elm the target of the Event
* @param name the name to give the custom Event
* @param opts options for configuring a custom Event
* @returns the custom Event
*/
const emitEvent = (elm, name, opts) => {
const ev = plt.ce(name, opts);
elm.dispatchEvent(ev);
return ev;
};
const attachToAncestor = (hostRef, ancestorComponent) => {
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
}
};
const scheduleUpdate = (hostRef, isInitialLoad) => {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
// there is no ancestor component or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
return writeTask(dispatch) ;
};
const dispatchHooks = (hostRef, isInitialLoad) => {
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
const instance = hostRef.$lazyInstance$ ;
let promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
}
endSchedule();
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
};
const updateComponent = async (hostRef, instance, isInitialLoad) => {
// updateComponent
const elm = hostRef.$hostElement$;
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
const rc = elm['s-rc'];
if (isInitialLoad) {
// DOM WRITE!
attachStyles(hostRef);
}
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
{
callRender(hostRef, instance);
}
if (rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.map((cb) => cb());
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
const childrenPromises = elm['s-p'];
const postUpdate = () => postUpdateComponent(hostRef);
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
const callRender = (hostRef, instance, elm) => {
try {
instance = instance.render() ;
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
{
renderVdom(hostRef, instance);
}
}
}
}
catch (e) {
consoleError(e, hostRef.$hostElement$);
}
return null;
};
const postUpdateComponent = (hostRef) => {
const tagName = hostRef.$cmpMeta$.$tagName$;
const elm = hostRef.$hostElement$;
const endPostUpdate = createTime('postUpdate', tagName);
const ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
addHydratedFlag(elm);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(() => scheduleUpdate(hostRef, false));
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
const appDidLoad = (who) => {
// on appload
// we have finish the first big initial render
{
addHydratedFlag(doc.documentElement);
}
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
};
const safeCall = (instance, method, arg) => {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
const then = (promise, thenFn) => {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
;
/**
* Parse a new property value for a given property type.
*
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
* 1. `any`, the type given to `propValue` in the function signature
* 2. the type stored from `propType`.
*
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
*
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
* ```tsx
* <my-cmp prop-val={0}></my-cmp>
* ```
*
* HTML prop values on the other hand, will always a string
*
* @param propValue the new value to coerce to some type
* @param propType the type of the prop, expressed as a binary number
* @returns the parsed/coerced value
*/
const parsePropertyValue = (propValue, propType) => {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if (propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
const setValue = (ref, propName, newVal, cmpMeta) => {
// check our new property value against our internal value
const hostRef = getHostRef(ref);
const oldVal = hostRef.$instanceValues$.get(propName);
const flags = hostRef.$flags$;
const instance = hostRef.$lazyInstance$ ;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
const didValueChange = newVal !== oldVal && !areBothNaN;
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if (instance) {
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(hostRef, false);
}
}
}
};
const proxyComponent = (Cstr, cmpMeta, flags) => {
if (cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
const members = Object.entries(cmpMeta.$members$);
const prototype = Cstr.prototype;
members.map(([memberName, [memberFlags]]) => {
if ((memberFlags & 31 /* Prop */ ||
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
// proxyComponent - prop
Object.defineProperty(prototype, memberName, {
get() {
// proxyComponent, get value
return getValue(this, memberName);
},
set(newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true,
});
}
else if (flags & 1 /* isElementConstructor */ &&
memberFlags & 64 /* Method */) {
// proxyComponent - method
Object.defineProperty(prototype, memberName, {
value(...args) {
const ref = getHostRef(this);
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
},
});
}
});
if ((flags & 1 /* isElementConstructor */)) {
const attrNameToPropName = new Map();
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
plt.jmp(() => {
const propName = attrNameToPropName.get(attrName);
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
// in the case where an attribute was set inline.
// ```html
// <my-component some-attribute="some-value"></my-component>
// ```
//
// There is an edge case where a developer sets the attribute inline on a custom element and then
// programmatically changes it before it has been upgraded as shown below:
//
// ```html
// <!-- this component has _not_ been upgraded yet -->
// <my-component id="test" some-attribute="some-value"></my-component>
// <script>
// // grab non-upgraded component
// el = document.querySelector("#test");
// el.someAttribute = "another-value";
// // upgrade component
// customElements.define('my-component', MyComponent);
// </script>
// ```
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
// to the value that was set inline i.e. "some-value" from above example. When
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
//
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
// by connectedCallback as this attributeChangedCallback will not fire.
//
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
//
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
// properties here given that this goes against best practices outlined here
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
if (this.hasOwnProperty(propName)) {
newValue = this[propName];
delete this[propName];
}
else if (prototype.hasOwnProperty(propName) &&
typeof this[propName] === 'number' &&
this[propName] == newValue) {
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
return;
}
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
.map(([propName, m]) => {
const attrName = m[1] || propName;
attrNameToPropName.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
{
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime();
Cstr = await Cstr;
endLoad();
}
if (!Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
}
if (Cstr.style) {
// this component has styles but we haven't registered them yet
let style = Cstr.style;
const scopeId = getScopeId(cmpMeta);
if (!styles.has(scopeId)) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(hostRef, true);
if (ancestorComponent && ancestorComponent['s-rc']) {
// this is the initial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};
const connectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
const cmpMeta = hostRef.$cmpMeta$;
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
let ancestorComponent = elm;
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if (ancestorComponent['s-p']) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if (cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
const value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
initializeComponent(elm, hostRef, cmpMeta);
}
}
else {
// not the first time this has connected
// reattach any event listeners to the host
// since they would have been removed when disconnected
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
}
endConnected();
}
};
const disconnectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$.map((rmListener) => rmListener());
hostRef.$rmListeners$ = undefined;
}
}
}
};
const bootstrapLazy = (lazyBundles, options = {}) => {
const endBootstrap = createTime();
const cmpTags = [];
const exclude = options.exclude || [];
const customElements = win.customElements;
const head = doc.head;
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
const deferredConnectedCallbacks = [];
let appLoadFallback;
let isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
lazyBundles.map((lazyBundle) => {
lazyBundle[1].map((compactMeta) => {
const cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
const tagName = cmpMeta.$tagName$;
const HostElement = class extends HTMLElement {
// StencilLazyHost
constructor(self) {
// @ts-ignore
super(self);
self = this;
registerHost(self, cmpMeta);
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
{
{
self.attachShadow({ mode: 'open' });
}
}
}
}
connectedCallback() {
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(() => connectedCallback(this));
}
}
disconnectedCallback() {
plt.jmp(() => disconnectedCallback(this));
}
componentOnReady() {
return getHostRef(this).$onReadyPromise$;
}
};
cmpMeta.$lazyBundleId$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
});
});
{
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
}
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length) {
deferredConnectedCallbacks.map((host) => host.connectedCallback());
}
else {
{
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
}
}
// Fallback appLoad event
endBootstrap();
};
const hostRefs = new WeakMap();
const getHostRef = (ref) => hostRefs.get(ref);
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
const registerHost = (elm, cmpMeta) => {
const hostRef = {
$flags$: 0,
$hostElement$: elm,
$cmpMeta$: cmpMeta,
$instanceValues$: new Map(),
};
{
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
}
{
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
elm['s-p'] = [];
elm['s-rc'] = [];
}
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
return hostRefs.set(elm, hostRef);
};
const isMemberInElement = (elm, memberName) => memberName in elm;
const consoleError = (e, el) => (0, console.error)(e, el);
const cmpModules = /*@__PURE__*/ new Map();
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
// loadModuleImport
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
const bundleId = cmpMeta.$lazyBundleId$;
const module = cmpModules.get(bundleId) ;
if (module) {
return module[exportName];
}
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
{
cmpModules.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
const styles = new Map();
const queueDomReads = [];
const queueDomWrites = [];
const queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
};
const consume = (queue) => {
for (let i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
const flush = () => {
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
// DOM WRITES!!!
{
consume(queueDomWrites);
if ((queuePending = queueDomReads.length > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
}
};
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
exports.bootstrapLazy = bootstrapLazy;
exports.createEvent = createEvent;
exports.getElement = getElement;
exports.h = h;
exports.promiseResolve = promiseResolve;
exports.registerInstance = registerInstance;
const NAMESPACE = 'msf-editor';
let scopeId;
let hostTagName;
let isSvgMode = false;
let queuePending = false;
const win = typeof window !== 'undefined' ? window : {};
const doc = win.document || { head: {} };
const plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: (h) => h(),
raf: (h) => requestAnimationFrame(h),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
ce: (eventName, opts) => new CustomEvent(eventName, opts),
};
const promiseResolve = (v) => Promise.resolve(v);
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
try {
new CSSStyleSheet();
return typeof new CSSStyleSheet().replace === 'function';
}
catch (e) { }
return false;
})()
;
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
if (listeners) {
listeners.map(([flags, name, method]) => {
const target = getHostListenerTarget(elm, flags) ;
const handler = hostListenerProxy(hostRef, method);
const opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
});
}
};
const hostListenerProxy = (hostRef, methodName) => (ev) => {
try {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
}
}
}
catch (e) {
consoleError(e);
}
};
const getHostListenerTarget = (elm, flags) => {
if (flags & 8 /* TargetWindow */)
return win;
return elm;
};
// prettier-ignore
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
const createTime = (fnName, tagName = '') => {
{
return () => {
return;
};
}
};
const uniqueTime = (key, measureText) => {
{
return () => {
return;
};
}
};
const rootAppliedStyles = new WeakMap();
const registerStyle = (scopeId, cssText, allowCS) => {
let style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
let scopeId = getScopeId(cmpMeta);
let style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
}
if (!appliedStyles.has(scopeId)) {
{
{
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
}
}
return scopeId;
};
const attachStyles = (hostRef) => {
const cmpMeta = hostRef.$cmpMeta$;
const elm = hostRef.$hostElement$;
const flags = cmpMeta.$flags$;
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
if (flags & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
const EMPTY_OBJ = {};
const isDef = (v) => v != null;
const isComplexType = (o) => {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
const h = (nodeName, vnodeData, ...children) => {
let child = null;
let simple = false;
let lastSimple = false;
let vNodeChildren = [];
const walk = (c) => {
for (let i = 0; i < c.length; i++) {
child = c[i];
if (Array.isArray(child)) {
walk(child);
}
else if (child != null && typeof child !== 'boolean') {
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
child = String(child);
}
if (simple && lastSimple) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class =
typeof classData !== 'object'
? classData
: Object.keys(classData)
.filter((k) => classData[k])
.join(' ');
}
}
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
const newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null,
};
{
vnode.$attrs$ = null;
}
return vnode;
};
const Host = {};
const isHost = (node) => node && node.$tag$ === Host;
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
if (oldValue !== newValue) {
let isProp = isMemberInElement(elm, memberName);
memberName.toLowerCase();
if (memberName === 'class') {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
const newClasses = parseClassList(newValue);
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
}
else {
// Set property if it exists and it's not a SVG
const isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
let n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
if (newValue !== false || elm.getAttribute(memberName) === '') {
{
elm.removeAttribute(memberName);
}
}
}
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
}
};
const parseClassListRegex = /\s/;
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
? newVnode.$elm$.host
: newVnode.$elm$;
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
// tslint:disable-next-line: prefer-const
let newVNode = newParentVNode.$children$[childIndex];
let i = 0;
let elm;
let childNode;
{
// create element
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = (parentElm);
let childNode;
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
for (; startIdx <= endIdx; ++startIdx) {
if ((vnode = vnodes[startIdx])) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
let oldStartIdx = 0;
let newStartIdx = 0;
let oldEndIdx = oldCh.length - 1;
let oldStartVnode = oldCh[0];
let oldEndVnode = oldCh[oldEndIdx];
let newEndIdx = newCh.length - 1;
let newStartVnode = newCh[0];
let newEndVnode = newCh[newEndIdx];
let node;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
}
else if (newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
const isSameVnode = (vnode1, vnode2) => {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
const patch = (oldVNode, newVNode) => {
const elm = (newVNode.$elm$ = oldVNode.$elm$);
const oldChildren = oldVNode.$children$;
const newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if (oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if (oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
const renderVdom = (hostRef, renderFnResults) => {
const hostElm = hostRef.$hostElement$;
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
hostTagName = hostElm.tagName;
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
const createEvent = (ref, name, flags) => {
const elm = getElement(ref);
return {
emit: (detail) => {
return emitEvent(elm, name, {
bubbles: !!(flags & 4 /* Bubbles */),
composed: !!(flags & 2 /* Composed */),
cancelable: !!(flags & 1 /* Cancellable */),
detail,
});
},
};
};
/**
* Helper function to create & dispatch a custom Event on a provided target
* @param elm the target of the Event
* @param name the name to give the custom Event
* @param opts options for configuring a custom Event
* @returns the custom Event
*/
const emitEvent = (elm, name, opts) => {
const ev = plt.ce(name, opts);
elm.dispatchEvent(ev);
return ev;
};
const attachToAncestor = (hostRef, ancestorComponent) => {
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
}
};
const scheduleUpdate = (hostRef, isInitialLoad) => {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
// there is no ancestor component or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
return writeTask(dispatch) ;
};
const dispatchHooks = (hostRef, isInitialLoad) => {
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
const instance = hostRef.$lazyInstance$ ;
let promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
}
endSchedule();
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
};
const updateComponent = async (hostRef, instance, isInitialLoad) => {
// updateComponent
const elm = hostRef.$hostElement$;
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
const rc = elm['s-rc'];
if (isInitialLoad) {
// DOM WRITE!
attachStyles(hostRef);
}
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
{
callRender(hostRef, instance);
}
if (rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.map((cb) => cb());
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
const childrenPromises = elm['s-p'];
const postUpdate = () => postUpdateComponent(hostRef);
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
const callRender = (hostRef, instance, elm) => {
try {
instance = instance.render() ;
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
{
renderVdom(hostRef, instance);
}
}
}
}
catch (e) {
consoleError(e, hostRef.$hostElement$);
}
return null;
};
const postUpdateComponent = (hostRef) => {
const tagName = hostRef.$cmpMeta$.$tagName$;
const elm = hostRef.$hostElement$;
const endPostUpdate = createTime('postUpdate', tagName);
const ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
addHydratedFlag(elm);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(() => scheduleUpdate(hostRef, false));
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
const appDidLoad = (who) => {
// on appload
// we have finish the first big initial render
{
addHydratedFlag(doc.documentElement);
}
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
};
const safeCall = (instance, method, arg) => {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
const then = (promise, thenFn) => {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
;
/**
* Parse a new property value for a given property type.
*
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
* 1. `any`, the type given to `propValue` in the function signature
* 2. the type stored from `propType`.
*
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
*
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
* ```tsx
* <my-cmp prop-val={0}></my-cmp>
* ```
*
* HTML prop values on the other hand, will always a string
*
* @param propValue the new value to coerce to some type
* @param propType the type of the prop, expressed as a binary number
* @returns the parsed/coerced value
*/
const parsePropertyValue = (propValue, propType) => {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if (propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
const setValue = (ref, propName, newVal, cmpMeta) => {
// check our new property value against our internal value
const hostRef = getHostRef(ref);
const oldVal = hostRef.$instanceValues$.get(propName);
const flags = hostRef.$flags$;
const instance = hostRef.$lazyInstance$ ;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
const didValueChange = newVal !== oldVal && !areBothNaN;
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if (instance) {
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(hostRef, false);
}
}
}
};
const proxyComponent = (Cstr, cmpMeta, flags) => {
if (cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
const members = Object.entries(cmpMeta.$members$);
const prototype = Cstr.prototype;
members.map(([memberName, [memberFlags]]) => {
if ((memberFlags & 31 /* Prop */ ||
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
// proxyComponent - prop
Object.defineProperty(prototype, memberName, {
get() {
// proxyComponent, get value
return getValue(this, memberName);
},
set(newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true,
});
}
else if (flags & 1 /* isElementConstructor */ &&
memberFlags & 64 /* Method */) {
// proxyComponent - method
Object.defineProperty(prototype, memberName, {
value(...args) {
const ref = getHostRef(this);
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
},
});
}
});
if ((flags & 1 /* isElementConstructor */)) {
const attrNameToPropName = new Map();
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
plt.jmp(() => {
const propName = attrNameToPropName.get(attrName);
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
// in the case where an attribute was set inline.
// ```html
// <my-component some-attribute="some-value"></my-component>
// ```
//
// There is an edge case where a developer sets the attribute inline on a custom element and then
// programmatically changes it before it has been upgraded as shown below:
//
// ```html
// <!-- this component has _not_ been upgraded yet -->
// <my-component id="test" some-attribute="some-value"></my-component>
// <script>
// // grab non-upgraded component
// el = document.querySelector("#test");
// el.someAttribute = "another-value";
// // upgrade component
// customElements.define('my-component', MyComponent);
// </script>
// ```
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
// to the value that was set inline i.e. "some-value" from above example. When
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
//
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
// by connectedCallback as this attributeChangedCallback will not fire.
//
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
//
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
// properties here given that this goes against best practices outlined here
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
if (this.hasOwnProperty(propName)) {
newValue = this[propName];
delete this[propName];
}
else if (prototype.hasOwnProperty(propName) &&
typeof this[propName] === 'number' &&
this[propName] == newValue) {
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
return;
}
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
.map(([propName, m]) => {
const attrName = m[1] || propName;
attrNameToPropName.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
{
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime();
Cstr = await Cstr;
endLoad();
}
if (!Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
}
if (Cstr.style) {
// this component has styles but we haven't registered them yet
let style = Cstr.style;
const scopeId = getScopeId(cmpMeta);
if (!styles.has(scopeId)) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(hostRef, true);
if (ancestorComponent && ancestorComponent['s-rc']) {
// this is the initial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};
const connectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
const cmpMeta = hostRef.$cmpMeta$;
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
let ancestorComponent = elm;
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if (ancestorComponent['s-p']) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if (cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
const value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
initializeComponent(elm, hostRef, cmpMeta);
}
}
else {
// not the first time this has connected
// reattach any event listeners to the host
// since they would have been removed when disconnected
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
}
endConnected();
}
};
const disconnectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$.map((rmListener) => rmListener());
hostRef.$rmListeners$ = undefined;
}
}
}
};
const bootstrapLazy = (lazyBundles, options = {}) => {
const endBootstrap = createTime();
const cmpTags = [];
const exclude = options.exclude || [];
const customElements = win.customElements;
const head = doc.head;
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
const deferredConnectedCallbacks = [];
let appLoadFallback;
let isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
lazyBundles.map((lazyBundle) => {
lazyBundle[1].map((compactMeta) => {
const cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
const tagName = cmpMeta.$tagName$;
const HostElement = class extends HTMLElement {
// StencilLazyHost
constructor(self) {
// @ts-ignore
super(self);
self = this;
registerHost(self, cmpMeta);
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
{
{
self.attachShadow({ mode: 'open' });
}
}
}
}
connectedCallback() {
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(() => connectedCallback(this));
}
}
disconnectedCallback() {
plt.jmp(() => disconnectedCallback(this));
}
componentOnReady() {
return getHostRef(this).$onReadyPromise$;
}
};
cmpMeta.$lazyBundleId$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
});
});
{
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
}
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length) {
deferredConnectedCallbacks.map((host) => host.connectedCallback());
}
else {
{
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
}
}
// Fallback appLoad event
endBootstrap();
};
const hostRefs = new WeakMap();
const getHostRef = (ref) => hostRefs.get(ref);
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
const registerHost = (elm, cmpMeta) => {
const hostRef = {
$flags$: 0,
$hostElement$: elm,
$cmpMeta$: cmpMeta,
$instanceValues$: new Map(),
};
{
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
}
{
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
elm['s-p'] = [];
elm['s-rc'] = [];
}
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
return hostRefs.set(elm, hostRef);
};
const isMemberInElement = (elm, memberName) => memberName in elm;
const consoleError = (e, el) => (0, console.error)(e, el);
const cmpModules = /*@__PURE__*/ new Map();
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
// loadModuleImport
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
const bundleId = cmpMeta.$lazyBundleId$;
const module = cmpModules.get(bundleId) ;
if (module) {
return module[exportName];
}
return import(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${''}`).then((importedModule) => {
{
cmpModules.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
const styles = new Map();
const queueDomReads = [];
const queueDomWrites = [];
const queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
};
const consume = (queue) => {
for (let i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
const flush = () => {
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
// DOM WRITES!!!
{
consume(queueDomWrites);
if ((queuePending = queueDomReads.length > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
}
};
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
export { bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const r=a(e,n),c=u(t,s),i=f(n);o.ael(r,l,c,i),(t.o=t.o||[]).push((()=>o.rel(r,l,c,i)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},a=(e,t)=>8&t?l:e,f=e=>0!=(2&e),h=new WeakMap,d=e=>"sc-"+e.h,m={},$=e=>"object"==(e=typeof e)||"function"===e,y=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!$(l))&&(l+=""),s&&o?r[r.length-1].m+=l:r.push(s?p(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=p(e,null);return i.$=t,r.length>0&&(i.p=r),i},p=(e,t)=>({t:0,S:e,m:t,g:null,p:null,$:null}),b={},w=(e,t,n,l,s,o)=>{if(n!==l){let r=I(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,s=g(n),o=g(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else{const c=$(l);if((r||c&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&o||s)&&!c&&e.setAttribute(t,l=!0===l?"":l)}}},S=/\s/,g=e=>e?e.split(S):[],j=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.$||m,r=t.$||m;for(l in o)l in r||w(s,l,o[l],void 0,n,t.t);for(l in r)w(s,l,o[l],r[l],n,t.t)},v=(t,n,l)=>{let o,r,c=n.p[l],i=0;if(o=c.g=s.createElement(c.S),j(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.p)for(i=0;i<c.p.length;++i)r=v(t,c,i),r&&o.appendChild(r);return o},M=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=v(null,l,o),c&&(s[o].g=c,i.insertBefore(c,n)))},O=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.g.remove()},k=(e,t)=>e.S===t.S,C=(e,t)=>{const n=t.g=e.g,l=e.p,s=t.p;j(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],h=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==h?h=l[--a]:k(i,f)?(C(i,f),i=t[++o],f=l[++r]):k(u,h)?(C(u,h),u=t[--c],h=l[--a]):k(i,h)?(C(i,h),e.insertBefore(i.g,u.g.nextSibling),i=t[++o],h=l[--a]):k(u,f)?(C(u,f),e.insertBefore(u.g,i.g),u=t[--c],f=l[++r]):(s=v(t&&t[r],n,r),f=l[++r],s&&i.g.parentNode.insertBefore(s,i.g));o>c?M(e,null==l[a+1]?null:l[a+1].g,n,l,r,a):r>a&&O(t,o,c)})(n,l,t,s):null!==s?M(n,null,t,s,0,s.length-1):null!==l&&O(l,0,l.length-1)},P=e=>B(e).j,W=(e,t,n)=>{const l=P(e);return{emit:e=>x(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},x=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},E=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},L=(e,t)=>{if(e.t|=16,!(4&e.t))return E(e,e.M),se((()=>N(e,t)));e.t|=512},N=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>q(n,e,t))),e.u=null),l=q(n,"componentWillLoad")),l=F(l,(()=>q(n,"componentWillRender"))),F(l,(()=>R(e,n,t)))},R=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.O,n=e.j,l=t.t,o=((e,t)=>{let n=d(t),l=X.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=h.get(e=e.head||e);o||h.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);T(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>A(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},T=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.k||p(null,null),r=(e=>e&&e.S===b)(l)?l:y(null,null,l);t=s.tagName,r.S=null,r.t|=4,n.k=r,r.g=o.g=s.shadowRoot||s,e=s["s-sc"],C(o,r)})(n,l)}catch(e){J(e,n.j)}return null},A=e=>{const t=e.j,n=e.M;64&e.t||(e.t|=64,H(t),e.C(t),n||U()),e.P(t),e.v&&(e.v(),e.v=void 0),512&e.t&&le((()=>L(e,!1))),e.t&=-517},U=()=>{H(s.documentElement),le((()=>x(l,"appload",{detail:{namespace:"msf-editor"}})))},q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},F=(e,t)=>e&&e.then?e.then(t):t(),H=e=>e.classList.add("hydrated"),V=(e,t,n)=>{if(t.W){const l=Object.entries(t.W),s=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,e,{get(){return((e,t)=>B(this).L.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=B(e),o=s.L.get(t),r=s.t,c=s.i;n=((e,t)=>null==e||$(e)?e:1&t?e+"":e)(n,l.W[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.L.set(t,n),c&&2==(18&r)&&L(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,e,{value(...t){const n=B(this);return n.N.then((()=>n.i[e](...t)))}})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},_=(e,t={})=>{const n=[],r=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),h=s.createElement("style"),m=[];let $,y=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],W:t[2],R:t[3]};l.W=t[2],l.R=t[3];const s=l.h,a=class extends HTMLElement{constructor(e){super(e),G(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){$&&(clearTimeout($),$=null),y?m.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=B(e),n=t.O,l=()=>{};if(1&t.t)i(e,t,n.R);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){E(t,t.M=n);break}}n.W&&Object.entries(n.W).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(V(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=d(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.M,r=()=>L(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=B(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return B(this).T}};l.A=e[0],r.includes(s)||u.get(s)||(n.push(s),u.define(s,V(a,l,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),a.insertBefore(h,f?f.nextSibling:a.firstChild),y=!1,m.length?m.map((e=>e.connectedCallback())):o.jmp((()=>$=setTimeout(U,30)))},z=new WeakMap,B=e=>z.get(e),D=(e,t)=>z.set(t.i=e,t),G=(e,t)=>{const n={t:0,j:e,O:t,L:new Map};return n.N=new Promise((e=>n.P=e)),n.T=new Promise((e=>n.C=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.R),z.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?le(ne):o.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(n=Y.length>0)&&o.raf(ne)},le=e=>r().then(e),se=ee(Z,!0);export{_ as b,W as c,P as g,y as h,r as p,D as r}
import{r as i,c as s,h as t,g as e}from"./p-046f3240.js";const o=class{constructor(t){i(this,t),this.editorEvent=s(this,"editorEvent",7),this.content="",this.assetsLoaded=!1,this.modalOpen=!1}sendMessage(i,s){this.editorFrame.contentWindow.postMessage({action:i,data:s},"*")}async save(i={}){this.sendMessage("save",i)}async test(){console.log("Only a test")}async spinner(i){["hide","show"].includes(i)||(i="hide"),this.sendMessage("showSpinner",{behavior:i})}async start(i){this.sendMessage("load",i)}async sendTest(i){this.sendMessage("sendTest",i)}async beforeUnload(i){this.sendMessage("beforeUnload",i)}async load(i){this.sendMessage("load",i)}async preview(i){this.sendMessage("preview",i)}async initConfig(){console.info("MailStyler Plugin: loading assets .."),this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise&&(this.config.rteToolbars.toolbar_0=await this.config.rteToolbars.toolbar_0),this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise&&(this.config.lang.custom=await this.config.lang.custom),this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise&&(this.config.rteToolbars.toolbar_1=await this.config.rteToolbars.toolbar_1);const i=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=i?"http://localhost:4200":this.editorUrl,this.assetsLoaded=!0,console.info("MailStyler Plugin: assets loaded!")}async componentWillRender(){!this.assetsLoaded&&this.config&&await this.initConfig()}render(){return t("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})}editorDidOpen(){this.load(this.content||"").then((()=>console.log("MailStyler Plugin: Template is loaded succesfully")))}listenMessage(i){if(i.data&&i.data.action){const{action:s,data:t}=i.data;if("appOk"===s)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===s){let i=Object.assign({},this.config);Object.keys(i).filter((s=>"function"==typeof i[s])).forEach((s=>delete i[s])),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:i})}else if("appSave"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onSave?this.config.onSave(t.html,t.raw_html,t.json,t.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appAutoSave"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onAutoSave?this.config.onAutoSave(t.html,t.raw_html,t.json,t.opts):console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}else if("appSaveBlock"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(t.html,t.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===s&&(this.modalOpen="open"===t.env);this.editorEvent.emit({action:s,data:t})}}componentWillLoad(i){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),i&&this.listenMessage(i)}get element(){return e(this)}};o.style=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";export{o as ms_editor}