@myop/react 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- (function(b,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],C):(b=typeof globalThis<"u"?globalThis:b||self,C(b["@myop/react"]={},b.React,b.React))})(this,(function(b,C,w){"use strict";const jt=`"use strict";var MyopSDK=(()=>{var qe=Object.defineProperty,bs=Object.defineProperties,ws=Object.getOwnPropertyDescriptor,Ss=Object.getOwnPropertyDescriptors,Es=Object.getOwnPropertyNames,Tn=Object.getOwnPropertySymbols;var vn=Object.prototype.hasOwnProperty,Ts=Object.prototype.propertyIsEnumerable;var Ot=(o,n,e)=>n in o?qe(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))vn.call(n,e)&&Ot(o,e,n[e]);if(Tn)for(var e of Tn(n))Ts.call(n,e)&&Ot(o,e,n[e]);return o},q=(o,n)=>bs(o,Ss(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var oe=(o,n)=>{for(var e in n)qe(o,e,{get:n[e],enumerable:!0})},vs=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Es(n))!vn.call(o,s)&&s!==e&&qe(o,s,{get:()=>n[s],enumerable:!(t=ws(n,s))||t.enumerable});return o};var Rs=o=>vs(qe({},"__esModule",{value:!0}),o);var r=(o,n,e)=>Ot(o,typeof n!="symbol"?n+"":n,e);var Ve,je,At,$,se=m(()=>{"use strict";Ve="__federation__",je="onLoad",At="moduleInstance",$=(o,n)=>{window[Ve]&&window[Ve][o]&&window[Ve][o][je]&&window[Ve][o][je]({[o]:n})}});var Me,Ge=m(()=>{Me="0.3.18"});var f,I=m(()=>{"use strict";f={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}}});var E,_s,ks,Kt,zt=m(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),_s=o=>{let n=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-")},ks=o=>{let n=o.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";let e=atob(n);return Uint8Array.from(e,t=>t.charCodeAt(0))},Kt=o=>{let n=ks(o);if(n.length%16!==0)throw new Error("Invalid input length");let e=[];for(let t=0;t<n.length;t+=16)e.push(_s(n.slice(t,t+16)));return e}});var _n,re=m(()=>{"use strict";zt();_n=o=>new Promise(n=>setTimeout(n,o))});var v,C,Ft,R,_,X,k=m(()=>{"use strict";re();v=class{};r(v,"down","down"),r(v,"up","up");C=class{constructor(){r(this,"id",E());r(this,"myop",!0);r(this,"content");r(this,"source");r(this,"destination");r(this,"route");r(this,"ref");r(this,"direction");r(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},Ft=class extends C{constructor(e){super();this.ref=e}},R=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",E())}},X=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=q(M({},this),{component:null})}static create(n,e,t){let s=e;return s||(s={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(s,t)}}});var kn,$t,ie,Hn=m(()=>{"use strict";k();kn="ClickReplayMessage",$t=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",kn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},ie=class extends R{constructor(){super(...arguments);r(this,"messageType",kn)}}});var Wt,Dn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}}});var Bn,Hs,Ds,Ln,D,ae,Nt=m(()=>{"use strict";k();Bn="ExecuteScriptReplyMessage",Hs=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Ds=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Ln=o=>{let n=o.match(Hs);if(n)return n[1]||n[3];{let e=o.match(Ds);if(e)return e[1].trim()}},D=class extends _{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;r(this,"replyMessageKey",Bn);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Ln(this.content)}};r(D,"replierKey","send"),r(D,"completeStreamKey","completeStream");ae=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",Bn)}}});var V,Pn=m(()=>{"use strict";Nt();V=class extends D{constructor(e,t,s=()=>{}){super(({rootRef:i,elementId:a,_script:p,__scriptInputs:d})=>{let c=(i.shadowRoot||i.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=q(M({},t),{_script:e.toString()})}}});var On,Ut,pe,An=m(()=>{"use strict";k();On="EventListenerCallbackMessage",Ut=class extends _{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",On);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",On);this.content={e:t}}}});var qt,Kn=m(()=>{"use strict";k();qt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}}});var zn,Vt,de,jt=m(()=>{"use strict";k();zn="ElementValueReplayMessage",Vt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",zn);r(this,"messageType","GetElementValueMessage")}},de=class extends R{constructor(e){super();this.content=e;r(this,"messageType",zn)}}});var Gt,Fn=m(()=>{"use strict";k();Gt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}}});var Ie,ke,ce,$n=m(()=>{"use strict";k();Ie=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},ke=class extends Ie{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},ce=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}}});var Wn,He,j,Ye=m(()=>{"use strict";k();Wn="RefComponentCreatedMessage",He=class extends _{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Wn);r(this,"messageType","CreateRefComponentMessage")}},j=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Wn)}}});var De,Yt=m(()=>{"use strict";k();De=class extends C{constructor(e,t){super();this.destination=e;this.message=t;r(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var Nn,Qt,me,Un=m(()=>{"use strict";k();Nn="DetectedMyopRefsMessage",Qt=class extends _{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",Nn)}},me=class extends R{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",Nn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var qn,Jt,Be,Vn=m(()=>{"use strict";k();qn="GetAttributeReplayMessage",Jt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",qn);r(this,"messageType","GetAttributeMessage")}},Be=class extends R{constructor(e){super();this.content=e;r(this,"messageType",qn)}}});var z,jn=m(()=>{"use strict";k();z=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}}});var Xt,Le,Gn=m(()=>{"use strict";k();Xt=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Le=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}}});var Yn,Pe,Oe,Qn=m(()=>{"use strict";k();Yn="CleanupReplayMessage",Pe=class extends _{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",Yn);r(this,"messageType","CleanupMessage")}},Oe=class extends R{constructor(e){super();this.customCleanup=e;r(this,"messageType",Yn)}}});var Ae,Jn=m(()=>{"use strict";k();Ae=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}}});var Zt,Ke,Xn=m(()=>{"use strict";k();Zt=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},Ke=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}}});var Ce={};oe(Ce,{AddEventListenerMessage:()=>Ut,BaseMyopMessage:()=>C,BindClickMessage:()=>$t,ChangeTextMessage:()=>Wt,CleanupMessage:()=>Pe,CleanupReplayMessage:()=>Oe,ClickReplayMessage:()=>ie,CreateRefComponentMessage:()=>He,CustomRefMessage:()=>V,DetectMyopRefsMessage:()=>Qt,DetectedMyopRefsMessage:()=>me,DisposeMessage:()=>Ae,ElementValueReplayMessage:()=>de,EnvelopedMessage:()=>De,EventListenerCallbackMessage:()=>pe,ExecuteComponentMethod:()=>z,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>ae,GetAttributeMessage:()=>Jt,GetAttributeReplayMessage:()=>Be,GetElementValueMessage:()=>Vt,InitMessage:()=>Ie,InitRequest:()=>ce,InitResponse:()=>ke,MessageDirection:()=>v,MutationObserverMessage:()=>Le,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>Ft,Ref:()=>X,RefComponentCreatedMessage:()=>j,ResizeObserverMessage:()=>Ke,SetAttributeMessage:()=>qt,SetInnerHtml:()=>Gt,SetMutationObserverMessage:()=>Xt,SetResizeObserverMessage:()=>Zt,stripFunction:()=>Ln});var b=m(()=>{"use strict";k();Hn();Dn();Nt();Pn();An();Kn();jt();Fn();$n();Ye();Yt();Un();jt();Vn();jn();Gn();Qn();Jn();Xn()});var W,ze=m(()=>{"use strict";I();b();Fe();W=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;r(this,"id","");r(this,"messageHandlers",{});r(this,"element");r(this,"_markedForDisposed",!1);r(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});r(this,"bindWhen",(n,e,t)=>{if(!t)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[n]||(this.messageHandlers[n]=[]);let s=this.messageHandlers[n],i=a=>e(a)?(t(a),!0):!1;return s.push(i),()=>{let a=s.indexOf(i);a>-1&&s.splice(a,1)}});r(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});r(this,"isInitiated",!1);r(this,"_whenInitiatedResolve");r(this,"_whenInitiatedReject");r(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));r(this,"initiated",()=>this._whenInitiated);r(this,"props",{});r(this,"refs",{});this.id=(t==null?void 0:t.id)||F.Instance().assignId(n);let s=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(s," ").concat(this.id))},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(n){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=n}onMessageReceived(n){if(n.messageType===f.ExecuteComponentMethod){let t=n;return this[t.method]?this[t.method](t.content):console.log("method not found ".concat(t.method," on component"),this),!0}let e=this.messageHandlers[n.messageType];if(e&&e.length){let t=!1;return e.forEach(s=>{t=t||s(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=v.down;let e=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,s=>{n.handler(s),e()}),t=n.handler;delete n.handler,this.send(n),n.handler=t}send(n){n.source||(n.source=this.id),n.destination||(n.destination=this.id),n.direction=v.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,s=>s.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new Pe(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Ae);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var xe,Zn=m(()=>{"use strict";xe=class{constructor(n,e,t,s,i){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=i;r(this,"type","MyopElementRef")}}});var eo,x,Qe,to=m(()=>{"use strict";eo=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},x=class{constructor(n){this.messageToHost=n}},Qe=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var en,be,no=m(()=>{"use strict";I();w();b();en=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},be=class{constructor(){r(this,"messageToHandleAfterInit",[]);r(this,"components",{});r(this,"alwaysPassEnvelopesToHost",!1);r(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==v.down)return;if(t.messageType===f.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===f.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new en(s),this.messageToHost(new ke(s));return}if(t.messageType===f.EnvelopedMessage){let s=t,i=s.message;if(t=i,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===i.destination);if(a){a.send(i);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(i);return}}else return}if(t.messageType){if(t.messageType===f.CleanupMessage){let i=t,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Oe(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],eo(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let s=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===t.messageType){s=!0;let a=i.executor(t);if(t.cleanable&&a&&(this.messageCleanupCache[t.id]=a),a&&!t.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&t.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}}});var G,le,Ee,we,fe,Je,Se,w=m(()=>{"use strict";Zn();to();no();G={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},le={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},Ee={message:"message",code:"code"},we=class{};r(we,"code","code"),r(we,"component","component");fe={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Je={Segment:"Segment",Promo:"Promo",AB:"AB"},Se=class{constructor(n,e){this.container=n;this.shadowRoot=e;r(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));r(this,"getRoot",()=>this.shadowRoot||this.container)}}});var tn,Bs,nn,A,ue=m(()=>{"use strict";tn=o=>o!==Object(o),Bs=o=>typeof o=="function",nn=o=>{if(tn(o))return!0;if(Bs(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!nn(e))return!1}else{if(tn(e))continue;return!1}}return!0},A=(o,n={},e=!0,t=new WeakMap)=>{if(tn(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let i=0;i<o.length;i++){let a=o[i];s[i]=A(a,n,e,t)}return s}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let s={};t.set(o,s);for(let i in o){let a=typeof n=="boolean"?n:n[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(s[i]=A(o[i],!0,e,t)):typeof a=="object"&&(s[i]=A(o[i],a,e,t)))}return s}return{}}});var oo,so=m(()=>{"use strict";oo={notSerializableRefCall:(o,n)=>{throw new Error("\\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \\nThe following types of data are considered non-serializable and cannot be processed:\\n\\n- Functions\\n- DOM elements\\n- Class instances\\n- Circular references\\n- Symbols\\n- BigInt values\\n\\nIn the following execution we detected :\\n~~~~~~~~\\n").concat(n," \\n~~~~~~~~\\nas not serializable.\\n\\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \\nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\\n\\nSuggested Fix:\\n1. Remove or replace non-serializable values from your input.\\n2. If using objects, ensure they do not contain any functions or circular references.\\n3. Convert any class instances to plain objects or JSON-compatible formats.\\n4. Use dedicated Myop message.\\n\\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\\n\\n"))}}});var $e,ro=m(()=>{"use strict";ze();b();Yt();$e=class extends W{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;r(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new De(this.id,e)),e.handler=t,s});r(this,"dispose",()=>{this.isInitiated&&this.send(new z("dispose")),super.dispose()})}hide(){this.send(new z("hide"))}show(){this.send(new z("show"))}inspect(){return this.send(new z("inspect"))}setHeightBasedOnDocumentElement(){this.send(new z("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new z("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var ge,on=m(()=>{"use strict";ze();We();ge=class extends W{constructor(e,t,s,i,a,p){super(e,s,p);this.container=s;this.customElement=i;this.tagName=a;r(this,"ctaCleanup");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});r(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i,this.setInitiated()}inspect(){return this.cleanupInspect=Te(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){let s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}let t=s=>{var a;let i=s;(a=i.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var Ls,Te,io,ao,po,Ps,sn,rn,We=m(()=>{"use strict";b();b();w();ue();so();ro();on();Ls=(o,n,e)=>{let t=document.createElement("a");return t.textContent=o,t.style.position="relative",t.style.padding="0 5px",t.style.fontSize="14px",t.style.top="0",t.style.top="".concat(n,"px"),t.style.transform="translateX(-50%)",t.target="_blank",t.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),t},Te=(o,n,e,t,s,i)=>{let a=Ls("".concat(i.name," : ").concat(n),e,i);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},io=(o,n,e)=>o?!1:(console.error("Error: Undefined Prop\\n\\nIt looks like you've tried to use a prop that hasn't been defined.\\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),ao=(o,n,e)=>{console.error("Error: Code Prop Not Supported\\n\\nCurrently, code props are only supported in local frame components.\\n\\u26A0\\uFE0F This is a work in progress feature \\u2014 code props will be supported in upcoming versions.\\n\\nIn the meantime, you can use message props.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},po=(o,n,e)=>{let t=n.reduce((i,a)=>q(M({},i),{[a.name]:M({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(io(p,a,o))return!1;if(p.behavior.type===Ee.code){if(o instanceof ge)return(p.behavior.remap||a)==="myop_init_interface"?l=>{if(l===void 0)return o.getData();o.initWithData(l)}:void 0;if(e.loader.type===G.HTMLLoader&&e.loader.shadowRootMode===le.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return ao(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(X.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let l=Ce[p.behavior.message];o.send(new l(...c))}):null},set:(i,a,p)=>{let d=t[a];if(io(d,a,o))return!1;if(d.behavior.type===Ee.code){if(o instanceof ge){let l=d.behavior.remap||a;if(l==="myop_cta_handler")return o.setCtaHandler(p),!0;if(l==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===G.HTMLLoader&&e.loader.shadowRootMode===le.localFrame){let l=d.behavior,u=o.element.contentWindow,g=l.remap||a;if(u[g]=p,g==="myop_cta_handler"&&u.__myop_cta_queue){let y=u.__myop_cta_queue;u.__myop_cta_queue=null,y.forEach(h=>{o.markedForDisposed||p(h.action,h.payload)})}return!0}return ao(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(X.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let l=Ce[d.behavior.message];return o.send(new l(...c)),!0}else throw new Error("Error: Unsupported Behavior\\n\\nThe 'behavior' field provided is not supported.\\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\\n\\n")+"Prop Name: ".concat(a,"\\n")+"Behavior Field: ".concat(d.behavior.type,"\\n\\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,s),o},Ps=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{nn(p)||oo.notSerializableRefCall(t,p)}),n.send(new V(({ref:p,propName:d,functionArgs:c,makeSerializable:l})=>{if(p){let u=p[d];return l(typeof u=="function"?p[d](...c):u,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:i},p=>{a(p.content)}))})},set(e,t,s){return n.send(new V(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),sn=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new $e(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new He(o.refConfig,n,q(M({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let l=e.find(u=>u.id==p.id);if(l!==p){s.refs[o.refConfig.name]=l,i(l);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(u=>{let g=n.instance.resolvedNestedComponents.find(h=>h.type.id===u.componentDefinitionId).type,y=new $e(g,p);y.setInitiated(),p.refs[u.refName]=y,e.push(y)});try{await rn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(u){a(u)}}))})},rn=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==we.component){if(t){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let l=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(g=>g.type.id===c);if(!l)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let u=X.create("",i,o);try{let g=await sn(u,l,e);o.refs[i.name]=g,a()}catch(g){p(g)}}else try{let c=X.create("",i,o);o.refs[i.name]=Ps(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}}});var ve,an=m(()=>{"use strict";ze();b();We();I();ve=class extends W{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;r(this,"sizeMeta");r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:t})=>{let{height:s,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();t({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:s,width:i}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));r(this,"observeAutoSize",e=>{var yn,hn,Mn,In,Cn,xn,bn;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(H,K,he)=>K!==void 0&&H<K?K:he!==void 0&&H>he?he:H,a=H=>{if(H===void 0)return;if(typeof H=="number")return H;let K=parseFloat(H);return isNaN(K)?void 0:K},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),l=a(e==null?void 0:e.maxHeight),u=(yn=e==null?void 0:e.loaderMinHeight)!=null?yn:50,g=((hn=this.sizeMeta)==null?void 0:hn.width)==="100%"?"100%":void 0,y=((Mn=this.sizeMeta)==null?void 0:Mn.height)==="100%"?"100%":void 0,h=(Cn=(In=e==null?void 0:e.explicitWidth)!=null?In:g)!=null?Cn:"100%",Y=(xn=e==null?void 0:e.explicitHeight)!=null?xn:y,Ue=h!==void 0,ye=Y!==void 0,Q=this.container.getBoundingClientRect(),L=Q.width===0,O=Q.height===0||Q.height===u,U=(e!=null&&e.forceAutoSize||L)&&!Ue,J=(e!=null&&e.forceAutoSize||O)&&!ye;if(!U&&!J){let H=typeof h=="number"?h:void 0,K=typeof Y=="number"?Y:void 0;return(H!==void 0||K!==void 0)&&((bn=e==null?void 0:e.onSizeChange)==null||bn.call(e,{width:H,height:K,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}let Lt=()=>{var K;let H=t.contentDocument;if(H){J&&(t.style.height="0px"),U&&(t.style.width="0px");let he=Math.ceil(H.documentElement.scrollWidth),wn=Math.ceil(H.documentElement.scrollHeight),Sn=i(he,p,d),En=i(wn,c,l);U&&(t.style.width="".concat(Sn,"px")),J&&(t.style.height="".concat(En,"px"));let Cs=U&&d!==void 0&&he>d,xs=J&&l!==void 0&&wn>l;H.documentElement.style.overflowX=Cs?"auto":"",H.documentElement.style.overflowY=xs?"auto":"",(K=e==null?void 0:e.onSizeChange)==null||K.call(e,{width:Sn,height:En,autoSizingWidth:U,autoSizingHeight:J})}};Lt();let Pt=new ResizeObserver(Lt);Pt.observe(s.body),Pt.observe(s.documentElement);let gn=new MutationObserver(Lt);return gn.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{Pt.disconnect(),gn.disconnect()}});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});r(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});r(this,"send",e=>{var i,a;let t=M({},e);if(t.messageType===f.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.down;let s=super.send(t);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(t,"*"),s});r(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Te(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===f.In.MutationObserverMessage||e.messageType===f.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Z,Xe=m(()=>{"use strict";Z=class{constructor(){r(this,"appendChild",(n,e,t)=>{var s;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let i=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,i||null)}}else return n.appendChild(e)})}}});var Os,Ze,co=m(()=>{"use strict";an();Xe();re();w();Os=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Ze=class extends Z{constructor(){super(...arguments);r(this,"type",G.IframeLoader);r(this,"load",async(e,t,s,i)=>{let a,p=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,s),a=s,a.src=p.url;else{let d=E(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let l="\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n height: ".concat(p.autoHeight||!p.height?"100%":p.height,";\\n width: 100%;\\n overflow: hidden;\\n border: none;\\n opacity: ").concat(i!=null&&i.hidden?"0":"1",";\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n ");a.style.cssText=l,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([g,y])=>{y===""||y===null||y===void 0?a.setAttribute(g,""):a.setAttribute(g,String(y))});let u=t.loader.url;i!=null&&i._hasParent&&(u=Os(u,"_myop-comp",d)),a.src=u,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new ve(e,t,s,a,i)})}}});var et,pn=m(()=>{"use strict";et={webcomponent_message_key:"myop_webcomponent_message"}});var Re,dn=m(()=>{"use strict";pn();ze();We();Re=class extends W{constructor(e,t,s,i,a){super(e,s,a);this.container=s;this.customElement=i;r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=M({},e),s=super.send(t),i=new CustomEvent(et.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});r(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=Te(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}}});var cn,tt,mo=m(()=>{"use strict";dn();Xe();re();w();cn={},tt=class extends Z{constructor(){super(...arguments);r(this,"type",G.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;cn[a.url]?console.log("Module alreday loaded or in loading process"):cn[a.url]=new Promise((c,l)=>{let u=a.url,g=document.createElement("script");g.type="module",g.src=u,g.onload=()=>{c()},g.onerror=()=>{l()},document.head.appendChild(g)}),await cn[a.url],await _n(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),i!=null&&i._environment&&(d._myopEnvironment=i==null?void 0:i._environment),this.appendChild(s,d,i),new Re(e,t,s,d,i)})}}});var T,N=m(()=>{"use strict";w();T=class extends Qe{constructor(e,t){super(e);this.context=t;r(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(i,a)=>{this.messageToHost(q(M({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,s)}else debugger}else debugger})}}});var B,ee=m(()=>{"use strict";B={id:"myop-id"}});var S,lo,P=m(()=>{"use strict";ee();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),lo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var nt,fo=m(()=>{"use strict";I();b();N();P();nt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{s(new ie(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var ot,uo=m(()=>{"use strict";I();N();P();ot=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var st,go=m(()=>{"use strict";w();st=class extends Se{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var rt,yo=m(()=>{"use strict";w();ee();N();b();I();rt=class extends T{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];s.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new xe(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new me(e.handlerUniqueId,i))});r(this,"messageType",f.DetectMyopRefsMessage)}}});var it,ho=m(()=>{"use strict";I();N();P();it=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var at,Mo=m(()=>{"use strict";I();b();N();P();ue();at=class extends T{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{s(new pe(e.handlerUniqueId,A(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var pt,Io=m(()=>{"use strict";I();ee();Fe();Ye();N();pt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=F.Instance(),d=p.components.find(g=>g.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let l=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),u=[];Object.keys(l.refs).forEach(g=>{let y=l.refs[g];y=y.__nonProxied||y,y.componentDefinition&&u.push({refName:g,componentDefinitionId:y.componentDefinition.id})}),s(new j(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var dt,mn=m(()=>{"use strict";ue();dt=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=A,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)}});var ct,Co=m(()=>{"use strict";I();b();N();mn();ct=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{dt(e,a=>{s(new ae(e.handlerUniqueId,a))},t)})}}});var xo,mt,bo=m(()=>{"use strict";I();b();N();P();ee();ue();xo=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:xo(i),required:i.required,validity:A(i.validity,!0),myopId:a};p?e.formData[p]?e.formData[p].value?e.unmappedData.push(d):(e.unmappedData.push(e.formData[p]),e.formData[p]=d):e.formData[p]=d:e.unmappedData.push(d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},mt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new de(xo(a)),e)})})}}});var lt,wo=m(()=>{"use strict";I();N();P();lt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var So={};oe(So,{WebComponentSDK:()=>_e});var _e,ln=m(()=>{"use strict";w();I();pn();fo();uo();go();yo();se();b();ho();Mo();Io();Co();bo();wo();_e=class extends be{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(et.webcomponent_message_key,s=>{let i=s.data?s.data:s.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(s),a.messageType===f.InitMessage){let p=a.content.id;this.components[p].context=new st(e,t)}}}),setTimeout(()=>{this.messageToHost(new ce)},1)});r(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new ot(this.messageToHost,this.components),new lt(this.messageToHost,this.components),new nt(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new it(this.messageToHost,this.components),new at(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new pt(this.messageToHost,this.components)]);r(this,"init",()=>{})}};$("WebComponentSDK",_e)});var Eo=m(()=>{"use strict";ln()});var To,vo=m(()=>{"use strict";To=""});function zs(o,n){return class extends HTMLElement{connectedCallback(){let e=n===le.open?"open":"closed",t=this.attachShadow({mode:e});Ho().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var As,Ks,_o,ko,ft,Ho,Fs,$s,Ws,ut,Do=m(()=>{"use strict";dn();on();Xe();re();w();Eo();an();vo();As="<!-- myop-web-component -->",Ks="myop-web-component",_o=new Set,ko=[],Ho=async()=>(ft||(ft=new _e,ft.init()),ft);Fs=(o,n,e)=>{customElements.define(o,zs(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},$s=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Ws=o=>(o=$s(o),o.replace(/_/g,"-")),ut=class extends Z{constructor(){super(...arguments);r(this,"type",G.HTMLLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,i);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===le.localFrame){let c=E(),l="myop-comp-".concat(c),u=document.createElement("iframe");u.id=l,u.style.cssText="\\n display: block;\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n overflow: hidden;\\n border: none;\\n opacity: ".concat(i!=null&&i.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),u=this.appendChild(s,u,i);let g=u.contentDocument||u.contentWindow.document;g.open();let y=null;{let O=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(O)try{y=JSON.parse(O.getAttribute("content")||"{}")}catch(U){}}let h=a.HTML;if(i!=null&&i._inspection){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O==null||O.removeAttribute("type");let U=L.implementation.createHTMLDocument();U.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let J=U.body.firstChild;J&&L.head&&L.head.insertBefore(L.importNode(J,!0),L.head.firstChild),h=L.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O&&(O.remove(),h=L.documentElement.outerHTML)}g.writeln(h);let Y='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),Ue="<script>\\n window.__federation__.__public_path__ = window.__federation__.__public_path__;\\n const __myop_init = async () => {\\n const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());\\n const sdk = new IframeSDK();\\n sdk.init();\\n }\\n __myop_init().then();\\n <\\/script>";if(g.writeln("".concat(Y).concat(Ue)),(i==null?void 0:i.data)!==void 0){let Q="<script>\\n window.__myop_cta_queue = [];\\n window.myop_cta_handler = function(action, payload) {\\n window.__myop_cta_queue.push({action: action, payload: payload});\\n };\\n <\\/script>",L=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),O='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(L,";\\n var scriptEl = document.getElementById('__myop_init_data_script');\\n\\n var callInitInterface = function(fn) {\\n var startTime = performance.now();\\n // Mark as pre-injected data call for extension tracking\\n window.__myop_init_preinjected = true;\\n try {\\n fn(data);\\n } finally {\\n window.__myop_init_preinjected = false;\\n }\\n var duration = performance.now() - startTime;\\n\\n // Notify extension via postMessage (init* = pre-injected)\\n try {\\n window.parent.postMessage({\\n type: 'MYOP_PREINJECTED_INIT',\\n payload: {\\n data: data,\\n duration: duration,\\n timestamp: Date.now()\\n }\\n }, '*');\\n } catch (e) {}\\n\\n // Cleanup: remove script tag and stored data\\n if (scriptEl && scriptEl.parentNode) {\\n scriptEl.parentNode.removeChild(scriptEl);\\n }\\n delete window.__myop_init_data;\\n };\\n\\n if (typeof window.myop_init_interface === 'function') {\\n // Function already exists - call immediately\\n callInitInterface(window.myop_init_interface);\\n } else {\\n // Function not yet defined - store data and watch for definition\\n window.__myop_init_data = data;\\n\\n var _original;\\n Object.defineProperty(window, 'myop_init_interface', {\\n configurable: true,\\n enumerable: true,\\n set: function(fn) {\\n _original = fn;\\n if (window.__myop_init_data !== undefined) {\\n var storedData = window.__myop_init_data;\\n delete window.__myop_init_data;\\n callInitInterface(fn);\\n }\\n },\\n get: function() {\\n return _original;\\n }\\n });\\n }\\n })();\\n <\\/script>");g.writeln(Q+O)}g.close();let ye=new ve(e,t,s,u,i);return ye.sizeMeta=y,a.autoHeight&&(u.onload=()=>{ye.observeSizeBasedOnDocumentElement()}),ye}if(a.shadowRootMode===le.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Ho().then(l=>{l.connectedCallback(d,d)})}else{let c=Ws(e.name+t.id);ko.includes(c)||(Fs(c,a.HTML,a.shadowRootMode),ko.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(s,d,i),new Re(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(As)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Ks);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(_o.has(t)){console.log("[MyopWebComponent] Script already executed for ".concat(t,", skipping"));return}let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s),_o.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,i,a){let p=this.extractWebComponentScript(i);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(l));let u="myop-comp-".concat(E()),g=document.createElement(l);g.id=u,a!=null&&a.hidden&&(g.style.opacity="0",g.style.position="absolute",g.style.height="0",g.style.width="0",g.style.pointerEvents="none",g.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,g,a);let y=new ge(e,t,s,g,l,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(l,"> into container")),y}}});var Bo,Lo,Po=m(()=>{"use strict";re();b();Bo=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new D(({rootRef:s,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let l in i){c+="".concat(l," { ");let u=i[l];for(let g in u)c+="".concat(g,": ").concat(u[g],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new D(({rootRef:s,_tagId:i})=>{let a=(s.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:t}))}},Lo=(o,n)=>{let e="myop-css-".concat(E());return o.send(new D(({rootRef:t,_tagId:s,_link:i})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new D(({rootRef:t,_tagId:s})=>{let i=(t.shadowRoot||document).getElementById(s);i&&i.remove()},()=>{},{_tagId:e}))}}});var Ns,fn,Oo,Ao=m(()=>{"use strict";Ns=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},fn=(o,n)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=M({},o.loader),o.loader.url=Ns(o.loader.url,n),o},Oo=o=>async n=>fn(n,o)});var Ko,zo,Fo=m(()=>{"use strict";b();Ko=(o,n,e)=>{o.send(new V(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},zo=(o,n,e)=>{o.send(new V(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var ht,gt,Mt,yt,$o=m(()=>{"use strict";re();ht=class ht{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"id",this._runTimeId);r(this,"name",this._runTimeName);r(this,"description","");r(this,"loader",null);r(this,"withLoader",n=>(this.loader=n,this));r(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));r(this,"build",()=>this)}};r(ht,"create",()=>new ht);gt=ht,Mt=class Mt{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});r(this,"name",this._runTimeName);r(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});r(this,"withInstance",n=>(this.instance=n,this));r(this,"withType",n=>(this.type=n,this));r(this,"withName",n=>(this.name=n,this));r(this,"withDefaultSkin",n=>(this.type.skins.push(n),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:n.id}},this));r(this,"withRef",n=>(this.type.refs.push(n),this));r(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});r(this,"build",()=>JSON.parse(JSON.stringify(this)))}};r(Mt,"create",()=>new Mt);yt=Mt});var Us,It,qs,Vs,te,ne,Wo,No=m(()=>{"use strict";w();Us=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Ee.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Ee.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),It="__MYOP_CLOUD_REPOSITORY_MAIN__",qs=()=>{if(typeof window<"u")return window[It];if(typeof globalThis<"u")return globalThis[It]},Vs=o=>{typeof window<"u"&&(window[It]=o),typeof globalThis<"u"&&(globalThis[It]=o)},te=class te{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production")}static get Main(){let n=qs();return n||(te._main||(te._main=new te,Vs(te._main)),te._main)}setEnvironment(n){this._defaultEnv=n}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],i=e!==void 0||t!==void 0,a,p;!i&&s?(a=s.env,p=s.preview):(a=e||this._defaultEnv,p=t===!0?!0:t===!1?!1:!e);let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,l)=>{try{let u="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(u+="&preview=true");let h=(await(await fetch(u)).json()).item;if(!h){l(new Error('Component "'.concat(n,'" not found')));return}if(!h.consume_variant||!h.consume_variant.length){l(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let Y=Us(h);c(Y)}catch(u){l(u)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};r(te,"_main",null);ne=te,Wo=ne});var Uo,qo=m(()=>{"use strict";Uo=async o=>await o()});var un={};oe(un,{CloudRepository:()=>ne,ComponentConfig:()=>yt,SkinConfig:()=>gt,addClass:()=>Ko,applyStylesheet:()=>Bo,applyStylesheetLink:()=>Lo,changeSkinUrlByTokenizer:()=>Oo,createIframeSkinByTokenizer:()=>fn,exec:()=>Uo,removeClass:()=>zo,v2_CloudRepository:()=>Wo});var Ct=m(()=>{"use strict";Po();Ao();Fo();$o();No();qo()});var Vo,jo=m(()=>{"use strict";zt();Ct();w();Vo=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=Kt(t);switch(s){case"component":{let[a,p]=i,d=await ne.Main.fetchComponent(a);if(d&&d.type.skins.find(l=>l.id===p))return d.instance.skinSelector={type:fe.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Kt(t),c=(await ne.Main.fetchFlow(a)).components.find(l=>l.type.id===o.type.id);if(c&&c.instance.skinSelector.type===fe.Segmented&&c.instance.resolvedExperiences){let l=c.instance.resolvedExperiences.find(u=>u.id===p);if((l==null?void 0:l.type)===Je.Segment){let u=l,y=c.instance.skinSelector.segments.find(h=>h.segmentId===u.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Qo={};oe(Qo,{HostSDK:()=>F,hostSDK:()=>Yo});var Go,F,Yo,Fe=m(()=>{"use strict";se();I();b();co();mo();We();w();Ge();Do();jo();Go="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",F=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"initiated",!1);r(this,"version",Me);r(this,"type2InstanceCount",{});r(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));r(this,"inspected",!1);r(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});r(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==v.up&&n.data.messageType!==f.EnvelopedMessage)return;let e=n.data;if(e.messageType===f.InitRequest){this.components2init.forEach(s=>{s.send(new Ie(s.id))});return}if(e.messageType===f.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let s=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===f.EnvelopedMessage){let s=e,i=this.components.find(a=>a.id===s.destination);if(i){if(s.direction===v.down){s.message.messageType===z.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{let a=this.components.find(p=>p.id===s.message.destination);a&&a.send(s.message)}return}let t=this.components.find(s=>s.id===e.destination);if(!t){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(t){if(t.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});r(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});r(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Ze,new tt,new ut];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let i=new s(this.componentsLoaders);t[i.type]=i}),this.componentsLoaders.forEach(s=>{t[s.type]||(t[s.type]=s)}),this.componentsLoaders=Object.values(t)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});r(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var i;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case fe.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case fe.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===Je.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let u=c.segment,g=(t||{})[u.function];return g?await g():(console.warn("segmentId:".concat(d.segmentId,", ").concat(u.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});r(this,"runSkinSelector",async(n,e)=>{let t=await this._getSkinIdBySkinSelector(n.instance.skinSelector,n.instance.resolvedExperiences,e);return n.type.skins.find(s=>s.id===t)});r(this,"loaderHooks");r(this,"loadComponent",async(n,e,t)=>{var l,u,g,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await Vo(n);s&&(n=s);let i=M(M({},(l=this.loaderHooks)!=null?l:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let h=await this.runSkinSelector(n,i);if(!h)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(h=await t.hooks.afterSkinSelected(M({},h))),n.instance.skinSelector={type:fe.Dedicated,skin:h},t&&(t=M({},t),delete t.hooks),await sn(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=t==null?void 0:t.hooks)!=null&&y.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(M({},p)));let d=this.componentsLoaders.find(h=>h.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(h=>h!==c),this.components2init=this.components2init.filter(h=>h!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=po(c,n.type.props,p));try{await rn(c,n,this.components)}catch(h){throw h}return t!=null&&t.skipInit||await c.initiated(),c});r(this,"navigate",async(n,e,t)=>{if(n.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(t!=null&&t.staged){let s=await this.loadComponent(e,n.container,M({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(s),s.show(),n.dispose(),s}else{let s=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,M({relative:{direction:"before",child:s}},t))}})}};r(F,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Go});if(!window.myop.hostSDK){let o=new F;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Go}),window.myop.hostSDK=o}Yo=window.myop.hostSDK;$("hostSDK",Yo)});var xt,Jo=m(()=>{"use strict";I();ee();w();b();xt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(B.id,"]")),s=[];t.forEach(i=>{let a=i.getAttribute(B.id);a&&s.push(new xe(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new me(e.handlerUniqueId,s))})}}});var bt,Xo=m(()=>{"use strict";I();w();b();P();bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new ie,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}}});var wt,Zo=m(()=>{"use strict";I();w();P();wt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var St,es=m(()=>{"use strict";I();b();w();mn();St=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"executor",e=>{dt(e,s=>{this.messageToHost(new ae(e.handlerUniqueId,s))},new Se(document.documentElement))})}}});var Et,ts=m(()=>{"use strict";I();w();b();ue();P();Et=class extends x{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new pe(e.handlerUniqueId,A(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}}});var Tt,ns=m(()=>{"use strict";I();w();P();Tt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var vt,os=m(()=>{"use strict";I();ee();w();Fe();Ye();vt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await F.Instance().loadComponent(e.nestedComponentConfig,s.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new j(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var ss,rs=m(()=>{"use strict";ss=(o,n)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let t=new e(n),s={attributes:!0,childList:!0,subtree:!0};return t.observe(o,s),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))}});var Rt,is=m(()=>{"use strict";I();b();w();rs();Rt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&ss(document.body,()=>{this.messageToHost(new Le)})})}}});var as,_t,ps=m(()=>{"use strict";I();ee();w();b();ue();P();as=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:as(i),required:i.required,validity:A(i.validity,!0),myopId:a};e.unmappedData.push(d),p&&(!e.formData[p]||!e.formData[p].value||d.value)&&(e.formData[p]=d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},_t=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new de(as(s)),e)})})}}});var kt,ds=m(()=>{"use strict";I();w();b();P();kt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetAttributeMessage);r(this,"executor",e=>{let t=lo(e.ref,document);t&&this.messageToHost(new Be(t.getAttribute(e.name)),e)})}}});var Ht,cs=m(()=>{"use strict";b();I();w();Ht=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new Ke)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Dt,ms=m(()=>{"use strict";I();w();P();Dt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var ls={};oe(ls,{IframeSDK:()=>Bt});var Bt,fs=m(()=>{"use strict";w();Jo();Xo();Zo();es();se();ts();ns();b();os();is();ps();Ge();ds();cs();ms();Bt=class extends be{constructor(){super();r(this,"version",Me);r(this,"messageToHost",(e,t)=>{var i;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let s=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=s[0]),e.source||(e.source=s[0]),e.direction=v.up,(i=window.parent)==null||i.postMessage(M({},e),"*")});r(this,"supportedHandlers",[new wt(this.messageToHost),new Dt(this.messageToHost),new bt(this.messageToHost),new xt(this.messageToHost),new St(this.messageToHost),new Et(this.messageToHost),new Tt(this.messageToHost),new _t(this.messageToHost),new Rt(this.messageToHost),new Ht(this.messageToHost),new kt(this.messageToHost),new vt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ce)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};$("IframeSDK",Bt)});var Gs={};var js,us=m(()=>{"use strict";b();se();js=M({},Ce);$("MyopMessages",js)});var gs={};oe(gs,{CloudRepository:()=>ne,ComponentConfig:()=>yt,SkinConfig:()=>gt,addClass:()=>Ko,applyStylesheet:()=>Bo,applyStylesheetLink:()=>Lo,changeSkinUrlByTokenizer:()=>Oo,createIframeSkinByTokenizer:()=>fn,exec:()=>Uo,removeClass:()=>zo,v2_CloudRepository:()=>Wo});var ys=m(()=>{"use strict";se();Ct();Ct();$("MyopHelpers",un)});var Zs={};oe(Zs,{getHostModule:()=>hs,getIframeModule:()=>Ms,getWebcomponentModule:()=>Is});se();var Rn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Rn=document.currentScript)==null?void 0:Rn.src,n=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:n,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,n,e)=>{if(window.__federation__[n])console.log("__federation__ module ".concat(n," already loaded.")),e(window.__federation__[n][At]);else{let t;window.__federation__[n]={},window.__federation__[n][je]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][At]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Ge();console.log("myop root sdk - loaded",document.location.origin);var Ys="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",hs=()=>Promise.resolve().then(()=>(Fe(),Qo)),Ms=()=>Promise.resolve().then(()=>(fs(),ls)),Is=()=>Promise.resolve().then(()=>(ln(),So)),Qs=()=>Promise.resolve().then(()=>(us(),Gs)),Js=()=>Promise.resolve().then(()=>(ys(),gs)),Ne=o=>async()=>(await o()).get(),Xs={version:Me,getHostModule:Ne(hs),getIframeModule:Ne(Ms),getWebcomponentModule:Ne(Is),getMyopMessages:Ne(Qs),getMyopHelpers:Ne(Js)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ys});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:Xs},window.myop);return Rs(Zs);})();
2
- `;var $e=Object.defineProperty,Vt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,ze=Object.getOwnPropertySymbols,Yt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,xe=(e,t,s)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,S=(e,t)=>{for(var s in t||(t={}))Yt.call(t,s)&&xe(e,s,t[s]);if(ze)for(var s of ze(t))Jt.call(t,s)&&xe(e,s,t[s]);return e},ae=(e,t)=>Vt(e,Gt(t)),Qt=(e,t)=>{for(var s in t)$e(e,s,{get:t[s],enumerable:!0})},a=(e,t,s)=>xe(e,typeof t!="symbol"?t+"":t,s),g=(e,t,s)=>new Promise((n,i)=>{var o=l=>{try{c(s.next(l))}catch(d){i(d)}},r=l=>{try{c(s.throw(l))}catch(d){i(d)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,r);c((s=s.apply(e,t)).next())}),fe="__federation__",We="onLoad",Ke=(e,t)=>{window[fe]&&window[fe][e]&&window[fe][e][We]&&window[fe][e][We]({[e]:t})},_={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",CleanupMessage:"CleanupMessage",In:{MutationObserverMessage:"MutationObserverMessage",ResizeObserverMessage:"ResizeObserverMessage"}},He={};Qt(He,{AddEventListenerMessage:()=>rs,BaseMyopMessage:()=>I,BindClickMessage:()=>ss,ChangeTextMessage:()=>ns,CleanupMessage:()=>lt,CleanupReplayMessage:()=>dt,ClickReplayMessage:()=>je,CreateRefComponentMessage:()=>nt,CustomRefMessage:()=>Re,DetectMyopRefsMessage:()=>ds,DetectedMyopRefsMessage:()=>rt,DisposeMessage:()=>ut,ElementValueReplayMessage:()=>Ze,EnvelopedMessage:()=>it,EventListenerCallbackMessage:()=>Qe,ExecuteComponentMethod:()=>z,ExecuteScriptMessage:()=>$,ExecuteScriptReplyMessage:()=>Ye,GetAttributeMessage:()=>us,GetAttributeReplayMessage:()=>hs,GetElementValueMessage:()=>cs,InitMessage:()=>De,InitRequest:()=>tt,InitResponse:()=>et,MessageDirection:()=>L,MutationObserverMessage:()=>ms,MyopBindMessage:()=>A,MyopBindReplayMessage:()=>P,MyopElementMessage:()=>ts,Ref:()=>ce,RefComponentCreatedMessage:()=>ke,ResizeObserverMessage:()=>ys,SetAttributeMessage:()=>as,SetInnerHtml:()=>ls,SetMutationObserverMessage:()=>ps,SetResizeObserverMessage:()=>fs,stripFunction:()=>Ge});var J=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),Xt=e=>{const t=[...e].map(s=>s.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},Zt=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";const s=atob(t);return Uint8Array.from(s,n=>n.charCodeAt(0))},qe=e=>{const t=Zt(e);if(t.length%16!==0)throw new Error("Invalid input length");const s=[];for(let n=0;n<t.length;n+=16)s.push(Xt(t.slice(n,n+16)));return s},es=e=>new Promise(t=>setTimeout(t,e)),L=class{};a(L,"down","down"),a(L,"up","up");var I=class{constructor(){a(this,"id",J()),a(this,"myop",!0),a(this,"content"),a(this,"source"),a(this,"destination"),a(this,"route"),a(this,"ref"),a(this,"direction"),a(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},ts=class extends I{constructor(e){super(),this.ref=e}},P=class extends I{constructor(e){super(),this.replayToHandler=e}},A=class extends I{constructor(t){super(),this.handler=t,a(this,"handlerUniqueId",J())}},ce=class Ut{constructor(t,s){this.refConfig=t,this.component=s,a(this,"myop",!0),a(this,"__nonProxied"),this.__nonProxied=ae(S({},this),{component:null})}static create(t,s,n){let i=s;return i||(i={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new Ut(i,n)}},Ue="ClickReplayMessage",ss=class extends A{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",Ue),a(this,"messageType","BindClickMessage"),a(this,"cleanable",!0)}},je=class extends P{constructor(){super(...arguments),a(this,"messageType",Ue)}},ns=class extends I{constructor(e,t){super(),this.ref=e,a(this,"messageType","ChangeTextMessage"),this.content=t}},Ve="ExecuteScriptReplyMessage",is=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,os=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,Ge=e=>{let t=e.match(is);if(t)return t[1]||t[3];{let s=e.match(os);if(s)return s[1].trim()}},$=class extends A{constructor(t,s=()=>{},n){super(s),this.scriptInputs=n,a(this,"replyMessageKey",Ve),a(this,"messageType","ExecuteScriptMessage"),a(this,"script",""),this.script=t.toString(),this.content=t.toString(),this.content=Ge(this.content)}};a($,"replierKey","send"),a($,"completeStreamKey","completeStream");var Ye=class extends P{constructor(e,t){super(e),this.replayToHandler=e,this.content=t,a(this,"messageType",Ve)}},Re=class extends ${constructor(e,t,s=()=>{}){super(({rootRef:n,elementId:i,_script:o,__scriptInputs:r})=>{const c=(n.shadowRoot||n.container).querySelectorAll(`[myop-id='${i}']`);return c.length?(r.ref=c[0],new Function(`return (${o})(...arguments)`)(r)):null},s),this.scriptInputs=t,this.scriptInputs=ae(S({},t),{_script:e.toString()})}},Je="EventListenerCallbackMessage",rs=class extends A{constructor(e,t,s){super(s),this.ref=e,this.type=t,this.handler=s,a(this,"replyMessageKey",Je),a(this,"messageType","AddEventListenerMessage"),a(this,"cleanable",!0),a(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},Qe=class extends P{constructor(e,t){super(e),this.replayToHandler=e,this.e=t,a(this,"messageType",Je),this.content={e:t}}},as=class extends I{constructor(e,t,s){super(),this.ref=e,this.name=t,this.value=s,a(this,"messageType","SetAttributeMessage")}},Xe="ElementValueReplayMessage",cs=class extends A{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",Xe),a(this,"messageType","GetElementValueMessage")}},Ze=class extends P{constructor(e){super(),this.content=e,a(this,"messageType",Xe)}},ls=class extends I{constructor(e,t){super(),this.ref=e,a(this,"messageType","SetInnerHtml"),this.content=t}},De=class extends I{constructor(e){super(),a(this,"messageType","InitMessage"),this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},et=class extends De{constructor(){super(...arguments),a(this,"messageType","InitResponse")}},tt=class extends I{constructor(){super(...arguments),a(this,"messageType","InitRequest")}},st="RefComponentCreatedMessage",nt=class extends A{constructor(e,t,s,n){super(n),this.refConfig=e,this.nestedComponentConfig=t,this.options=s,a(this,"replyMessageKey",st),a(this,"messageType","CreateRefComponentMessage")}},ke=class extends P{constructor(e,t,s){super(e),this.replayToHandler=e,this.nestedRefs=t,this.failed=s,a(this,"messageType",st)}},it=class extends I{constructor(e,t){super(),this.destination=e,this.message=t,a(this,"messageType","EnvelopedMessage");const s=t;this.route=[e,...s.route?s.route:[]]}},ot="DetectedMyopRefsMessage",ds=class extends A{constructor(){super(...arguments),a(this,"messageType","DetectMyopRefsMessage"),a(this,"replyMessageKey",ot)}},rt=class extends P{constructor(e,t){super(e),this.replayToHandler=e,a(this,"messageType",ot),this.content=t}isTypeof(e){return e.messageType===this.messageType}},at="GetAttributeReplayMessage",us=class extends A{constructor(e,t,s){super(s),this.ref=e,this.name=t,a(this,"replyMessageKey",at),a(this,"messageType","GetAttributeMessage")}},hs=class extends P{constructor(e){super(),this.content=e,a(this,"messageType",at)}},z=class extends I{constructor(e){super(),this.method=e,a(this,"messageType","ExecuteComponentMethod")}},ps=class extends I{constructor(){super(...arguments),a(this,"messageType","SetMutationObserverMessage")}},ms=class extends I{constructor(){super(...arguments),a(this,"messageType","MutationObserverMessage")}},ct="CleanupReplayMessage",lt=class extends A{constructor(e,t){super(t),this.cleanupForMessageId=e,a(this,"replyMessageKey",ct),a(this,"messageType","CleanupMessage")}},dt=class extends P{constructor(e){super(),this.customCleanup=e,a(this,"messageType",ct)}},ut=class extends I{constructor(){super(...arguments),a(this,"messageType","DisposeMessage")}},fs=class extends I{constructor(){super(...arguments),a(this,"cleanable",!0),a(this,"messageType","SetResizeObserverMessage")}},ys=class extends I{constructor(){super(...arguments),a(this,"messageType","ResizeObserverMessage")}},ye=class{constructor(e,t,s){this.componentDefinition=e,this.container=t,a(this,"id",""),a(this,"messageHandlers",{}),a(this,"element"),a(this,"_markedForDisposed",!1),a(this,"bind",(i,o)=>{this.messageHandlers[i]||(this.messageHandlers[i]=[]),this.messageHandlers[i].includes(o)||this.messageHandlers[i].push(o)}),a(this,"bindWhen",(i,o,r)=>{if(!r)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[i]||(this.messageHandlers[i]=[]);const c=this.messageHandlers[i],l=d=>o(d)?(r(d),!0):!1;return c.push(l),()=>{const d=c.indexOf(l);d>-1&&c.splice(d,1)}}),a(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()}),a(this,"isInitiated",!1),a(this,"_whenInitiatedResolve"),a(this,"_whenInitiatedReject"),a(this,"_whenInitiated",new Promise((i,o)=>{this._whenInitiatedResolve=i,this._whenInitiatedReject=o})),a(this,"initiated",()=>this._whenInitiated),a(this,"props",{}),a(this,"refs",{}),this.id=(s==null?void 0:s.id)||_e.Instance().assignId(e);const n=s!=null&&s.timeout?s==null?void 0:s.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject(`timeout_${n} ${this.id}`)},n),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(e){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=e}onMessageReceived(e){if(e.messageType===_.ExecuteComponentMethod){const s=e;return this[s.method]?this[s.method](s.content):console.log(`method not found ${s.method} on component`,this),!0}const t=this.messageHandlers[e.messageType];if(t&&t.length){let s=!1;return t.forEach(n=>{s=s||n(e)}),s}return!1}sendCleanupMessage(e){e.source=this.id,e.destination=this.id,e.direction=L.down;const t=this.bindWhen(e.replyMessageKey,n=>n.replayToHandler===e.handlerUniqueId,n=>{e.handler(n),t()}),s=e.handler;delete e.handler,this.send(e),e.handler=s}send(e){e.source||(e.source=this.id),e.destination||(e.destination=this.id),e.direction=L.down;let t;if(e.handler){const s=e;t=this.bindWhen(s.replyMessageKey,n=>n.replayToHandler===s.handlerUniqueId,s.handler),delete e.handler}return e.ref&&(e.ref=e.ref.__nonProxied||e.ref),e.cleanable?()=>{this.sendCleanupMessage(new lt(e.id,s=>{})),t&&t()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new ut);const e=this.messageHandlers.onDispose;e&&e.forEach(t=>{t(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}},gs=class{constructor(e,t,s,n,i){this.myopId=e,this.htmlTagName=t,this.BoundingRect=s,this.offsetTop=n,this.offsetLeft=i,a(this,"type","MyopElementRef")}},vs=e=>g(void 0,null,function*(){if(typeof e=="function")e();else if(e instanceof Promise){const t=yield e;typeof t=="function"&&t()}}),ws=class{constructor(e){this.messageToHost=e}},_s=class extends ws{constructor(e,t){super(e),this.messageToHost=e,this.context=t}},Ms=class{constructor(e,t){this.id=e,this.context=t,a(this,"send",s=>{})}},bs=class{constructor(){a(this,"messageToHandleAfterInit",[]),a(this,"components",{}),a(this,"alwaysPassEnvelopesToHost",!1),a(this,"messageCleanupCache",{})}handleIncomeMessages(e){const t=e.data?e.data:e.detail;if(!(!t||!t.myop)){let s=t;if(s.direction!==L.down)return;if(s.messageType===_.DisposeMessage){s.destination&&delete this.components[s.destination];return}if(s.messageType===_.InitMessage){const n=s.content.id;if(this.components[n])return;this.components[n]=new Ms(n),this.messageToHost(new et(n));return}if(s.messageType===_.EnvelopedMessage){const n=s,i=n.message;if(s=i,this.alwaysPassEnvelopesToHost||this.components[s.destination]){const o=myop.hostSDK.components.find(c=>c.id===i.destination);if(o){o.send(i);return}const r=myop.hostSDK.components.find(c=>c.id===n.destination);if(r){r.send(i);return}}else return}if(s.messageType){if(s.messageType===_.CleanupMessage){const n=s,i=this.messageCleanupCache[n.cleanupForMessageId],o=new dt(!!i);o.destination=s.destination,i?(delete this.messageCleanupCache[n.cleanupForMessageId],vs(i).then(()=>{this.messageToHost(o,n)}).catch(()=>{})):this.messageToHost(o,n);return}this.supportedHandlers.forEach(n=>{if(n.messageType===s.messageType){const i=n.executor(s);if(s.cleanable&&i&&(this.messageCleanupCache[s.id]=i),i&&!s.cleanable)throw new Error(`Cleanup handler generated for non-cleanable message.
1
+ (function(b,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],C):(b=typeof globalThis<"u"?globalThis:b||self,C(b["@myop/react"]={},b.React,b.React))})(this,(function(b,C,w){"use strict";const jt=`"use strict";var MyopSDK=(()=>{var Ve=Object.defineProperty,Ds=Object.defineProperties,Bs=Object.getOwnPropertyDescriptor,Ls=Object.getOwnPropertyDescriptors,Ps=Object.getOwnPropertyNames,Rn=Object.getOwnPropertySymbols;var _n=Object.prototype.hasOwnProperty,Os=Object.prototype.propertyIsEnumerable;var At=(o,n,e)=>n in o?Ve(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))_n.call(n,e)&&At(o,e,n[e]);if(Rn)for(var e of Rn(n))Os.call(n,e)&&At(o,e,n[e]);return o},V=(o,n)=>Ds(o,Ls(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var se=(o,n)=>{for(var e in n)Ve(o,e,{get:n[e],enumerable:!0})},As=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Ps(n))!_n.call(o,s)&&s!==e&&Ve(o,s,{get:()=>n[s],enumerable:!(t=Bs(n,s))||t.enumerable});return o};var Ks=o=>As(Ve({},"__esModule",{value:!0}),o);var r=(o,n,e)=>At(o,typeof n!="symbol"?n+"":n,e);var je,Ge,Kt,W,re=m(()=>{"use strict";je="__federation__",Ge="onLoad",Kt="moduleInstance",W=(o,n)=>{window[je]&&window[je][o]&&window[je][o][Ge]&&window[je][o][Ge]({[o]:n})}});var Ie,Ye=m(()=>{Ie="0.3.19"});var f,I=m(()=>{"use strict";f={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}}});var E,zs,Fs,zt,Ft=m(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),zs=o=>{let n=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-")},Fs=o=>{let n=o.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";let e=atob(n);return Uint8Array.from(e,t=>t.charCodeAt(0))},zt=o=>{let n=Fs(o);if(n.length%16!==0)throw new Error("Invalid input length");let e=[];for(let t=0;t<n.length;t+=16)e.push(zs(n.slice(t,t+16)));return e}});var Hn,ie=m(()=>{"use strict";Ft();Hn=o=>new Promise(n=>setTimeout(n,o))});var v,C,$t,R,_,Z,k=m(()=>{"use strict";ie();v=class{};r(v,"down","down"),r(v,"up","up");C=class{constructor(){r(this,"id",E());r(this,"myop",!0);r(this,"content");r(this,"source");r(this,"destination");r(this,"route");r(this,"ref");r(this,"direction");r(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},$t=class extends C{constructor(e){super();this.ref=e}},R=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",E())}},Z=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=V(M({},this),{component:null})}static create(n,e,t){let s=e;return s||(s={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(s,t)}}});var Dn,Wt,ae,Bn=m(()=>{"use strict";k();Dn="ClickReplayMessage",Wt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",Dn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},ae=class extends R{constructor(){super(...arguments);r(this,"messageType",Dn)}}});var Nt,Ln=m(()=>{"use strict";k();Nt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}}});var Pn,$s,Ws,On,D,pe,Ut=m(()=>{"use strict";k();Pn="ExecuteScriptReplyMessage",$s=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Ws=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,On=o=>{let n=o.match($s);if(n)return n[1]||n[3];{let e=o.match(Ws);if(e)return e[1].trim()}},D=class extends _{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;r(this,"replyMessageKey",Pn);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=On(this.content)}};r(D,"replierKey","send"),r(D,"completeStreamKey","completeStream");pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",Pn)}}});var j,An=m(()=>{"use strict";Ut();j=class extends D{constructor(e,t,s=()=>{}){super(({rootRef:i,elementId:a,_script:p,__scriptInputs:d})=>{let c=(i.shadowRoot||i.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=V(M({},t),{_script:e.toString()})}}});var Kn,qt,de,zn=m(()=>{"use strict";k();Kn="EventListenerCallbackMessage",qt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",Kn);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},de=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",Kn);this.content={e:t}}}});var Vt,Fn=m(()=>{"use strict";k();Vt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}}});var $n,jt,ce,Gt=m(()=>{"use strict";k();$n="ElementValueReplayMessage",jt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",$n);r(this,"messageType","GetElementValueMessage")}},ce=class extends R{constructor(e){super();this.content=e;r(this,"messageType",$n)}}});var Yt,Wn=m(()=>{"use strict";k();Yt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}}});var Ce,He,me,Nn=m(()=>{"use strict";k();Ce=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},He=class extends Ce{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},me=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}}});var Un,De,G,Qe=m(()=>{"use strict";k();Un="RefComponentCreatedMessage",De=class extends _{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Un);r(this,"messageType","CreateRefComponentMessage")}},G=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Un)}}});var Be,Qt=m(()=>{"use strict";k();Be=class extends C{constructor(e,t){super();this.destination=e;this.message=t;r(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var qn,Jt,le,Vn=m(()=>{"use strict";k();qn="DetectedMyopRefsMessage",Jt=class extends _{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",qn)}},le=class extends R{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",qn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var jn,Xt,Le,Gn=m(()=>{"use strict";k();jn="GetAttributeReplayMessage",Xt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",jn);r(this,"messageType","GetAttributeMessage")}},Le=class extends R{constructor(e){super();this.content=e;r(this,"messageType",jn)}}});var z,Yn=m(()=>{"use strict";k();z=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}}});var Zt,Pe,Qn=m(()=>{"use strict";k();Zt=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Pe=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}}});var Jn,Oe,Ae,Xn=m(()=>{"use strict";k();Jn="CleanupReplayMessage",Oe=class extends _{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",Jn);r(this,"messageType","CleanupMessage")}},Ae=class extends R{constructor(e){super();this.customCleanup=e;r(this,"messageType",Jn)}}});var Ke,Zn=m(()=>{"use strict";k();Ke=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}}});var en,ze,eo=m(()=>{"use strict";k();en=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},ze=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}}});var xe={};se(xe,{AddEventListenerMessage:()=>qt,BaseMyopMessage:()=>C,BindClickMessage:()=>Wt,ChangeTextMessage:()=>Nt,CleanupMessage:()=>Oe,CleanupReplayMessage:()=>Ae,ClickReplayMessage:()=>ae,CreateRefComponentMessage:()=>De,CustomRefMessage:()=>j,DetectMyopRefsMessage:()=>Jt,DetectedMyopRefsMessage:()=>le,DisposeMessage:()=>Ke,ElementValueReplayMessage:()=>ce,EnvelopedMessage:()=>Be,EventListenerCallbackMessage:()=>de,ExecuteComponentMethod:()=>z,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>pe,GetAttributeMessage:()=>Xt,GetAttributeReplayMessage:()=>Le,GetElementValueMessage:()=>jt,InitMessage:()=>Ce,InitRequest:()=>me,InitResponse:()=>He,MessageDirection:()=>v,MutationObserverMessage:()=>Pe,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>$t,Ref:()=>Z,RefComponentCreatedMessage:()=>G,ResizeObserverMessage:()=>ze,SetAttributeMessage:()=>Vt,SetInnerHtml:()=>Yt,SetMutationObserverMessage:()=>Zt,SetResizeObserverMessage:()=>en,stripFunction:()=>On});var b=m(()=>{"use strict";k();Bn();Ln();Ut();An();zn();Fn();Gt();Wn();Nn();Qe();Qt();Vn();Gt();Gn();Yn();Qn();Xn();Zn();eo()});var N,Fe=m(()=>{"use strict";I();b();$e();N=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;r(this,"id","");r(this,"messageHandlers",{});r(this,"element");r(this,"_markedForDisposed",!1);r(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});r(this,"bindWhen",(n,e,t)=>{if(!t)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[n]||(this.messageHandlers[n]=[]);let s=this.messageHandlers[n],i=a=>e(a)?(t(a),!0):!1;return s.push(i),()=>{let a=s.indexOf(i);a>-1&&s.splice(a,1)}});r(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});r(this,"isInitiated",!1);r(this,"_whenInitiatedResolve");r(this,"_whenInitiatedReject");r(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));r(this,"initiated",()=>this._whenInitiated);r(this,"props",{});r(this,"refs",{});this.id=(t==null?void 0:t.id)||$.Instance().assignId(n);let s=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(s," ").concat(this.id))},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(n){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=n}onMessageReceived(n){if(n.messageType===f.ExecuteComponentMethod){let t=n;return this[t.method]?this[t.method](t.content):console.log("method not found ".concat(t.method," on component"),this),!0}let e=this.messageHandlers[n.messageType];if(e&&e.length){let t=!1;return e.forEach(s=>{t=t||s(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=v.down;let e=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,s=>{n.handler(s),e()}),t=n.handler;delete n.handler,this.send(n),n.handler=t}send(n){n.source||(n.source=this.id),n.destination||(n.destination=this.id),n.direction=v.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,s=>s.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new Oe(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Ke);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var be,to=m(()=>{"use strict";be=class{constructor(n,e,t,s,i){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=i;r(this,"type","MyopElementRef")}}});var no,x,Je,oo=m(()=>{"use strict";no=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},x=class{constructor(n){this.messageToHost=n}},Je=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var tn,we,so=m(()=>{"use strict";I();w();b();tn=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},we=class{constructor(){r(this,"messageToHandleAfterInit",[]);r(this,"components",{});r(this,"alwaysPassEnvelopesToHost",!1);r(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==v.down)return;if(t.messageType===f.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===f.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new tn(s),this.messageToHost(new He(s));return}if(t.messageType===f.EnvelopedMessage){let s=t,i=s.message;if(t=i,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===i.destination);if(a){a.send(i);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(i);return}}else return}if(t.messageType){if(t.messageType===f.CleanupMessage){let i=t,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Ae(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],no(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let s=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===t.messageType){s=!0;let a=i.executor(t);if(t.cleanable&&a&&(this.messageCleanupCache[t.id]=a),a&&!t.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&t.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}}});var Y,fe,Te,Se,ue,Xe,Ee,w=m(()=>{"use strict";to();oo();so();Y={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},fe={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},Te={message:"message",code:"code"},Se=class{};r(Se,"code","code"),r(Se,"component","component");ue={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Xe={Segment:"Segment",Promo:"Promo",AB:"AB"},Ee=class{constructor(n,e){this.container=n;this.shadowRoot=e;r(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));r(this,"getRoot",()=>this.shadowRoot||this.container)}}});var nn,Ns,on,A,ge=m(()=>{"use strict";nn=o=>o!==Object(o),Ns=o=>typeof o=="function",on=o=>{if(nn(o))return!0;if(Ns(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!on(e))return!1}else{if(nn(e))continue;return!1}}return!0},A=(o,n={},e=!0,t=new WeakMap)=>{if(nn(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let i=0;i<o.length;i++){let a=o[i];s[i]=A(a,n,e,t)}return s}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let s={};t.set(o,s);for(let i in o){let a=typeof n=="boolean"?n:n[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(s[i]=A(o[i],!0,e,t)):typeof a=="object"&&(s[i]=A(o[i],a,e,t)))}return s}return{}}});var ro,io=m(()=>{"use strict";ro={notSerializableRefCall:(o,n)=>{throw new Error("\\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \\nThe following types of data are considered non-serializable and cannot be processed:\\n\\n- Functions\\n- DOM elements\\n- Class instances\\n- Circular references\\n- Symbols\\n- BigInt values\\n\\nIn the following execution we detected :\\n~~~~~~~~\\n").concat(n," \\n~~~~~~~~\\nas not serializable.\\n\\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \\nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\\n\\nSuggested Fix:\\n1. Remove or replace non-serializable values from your input.\\n2. If using objects, ensure they do not contain any functions or circular references.\\n3. Convert any class instances to plain objects or JSON-compatible formats.\\n4. Use dedicated Myop message.\\n\\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\\n\\n"))}}});var We,ao=m(()=>{"use strict";Fe();b();Qt();We=class extends N{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;r(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new Be(this.id,e)),e.handler=t,s});r(this,"dispose",()=>{this.isInitiated&&this.send(new z("dispose")),super.dispose()})}hide(){this.send(new z("hide"))}show(){this.send(new z("show"))}inspect(){return this.send(new z("inspect"))}setHeightBasedOnDocumentElement(){this.send(new z("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new z("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var ye,sn=m(()=>{"use strict";Fe();Ne();ye=class extends N{constructor(e,t,s,i,a,p){super(e,s,p);this.container=s;this.customElement=i;this.tagName=a;r(this,"ctaCleanup");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});r(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i,this.setInitiated()}inspect(){return this.cleanupInspect=ve(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){let s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}let t=s=>{var a;let i=s;(a=i.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var Us,ve,po,co,mo,qs,rn,an,Ne=m(()=>{"use strict";b();b();w();ge();io();ao();sn();Us=(o,n,e)=>{let t=document.createElement("a");return t.textContent=o,t.style.position="relative",t.style.padding="0 5px",t.style.fontSize="14px",t.style.top="0",t.style.top="".concat(n,"px"),t.style.transform="translateX(-50%)",t.target="_blank",t.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),t},ve=(o,n,e,t,s,i)=>{let a=Us("".concat(i.name," : ").concat(n),e,i);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},po=(o,n,e)=>o?!1:(console.error("Error: Undefined Prop\\n\\nIt looks like you've tried to use a prop that hasn't been defined.\\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),co=(o,n,e)=>{console.error("Error: Code Prop Not Supported\\n\\nCurrently, code props are only supported in local frame components.\\n\\u26A0\\uFE0F This is a work in progress feature \\u2014 code props will be supported in upcoming versions.\\n\\nIn the meantime, you can use message props.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},mo=(o,n,e)=>{let t=n.reduce((i,a)=>V(M({},i),{[a.name]:M({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(po(p,a,o))return!1;if(p.behavior.type===Te.code){if(o instanceof ye)return(p.behavior.remap||a)==="myop_init_interface"?l=>{if(l===void 0)return o.getData();o.initWithData(l)}:void 0;if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return co(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(Z.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let l=xe[p.behavior.message];o.send(new l(...c))}):null},set:(i,a,p)=>{let d=t[a];if(po(d,a,o))return!1;if(d.behavior.type===Te.code){if(o instanceof ye){let l=d.behavior.remap||a;if(l==="myop_cta_handler")return o.setCtaHandler(p),!0;if(l==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let l=d.behavior,u=o.element.contentWindow,g=l.remap||a;if(u[g]=p,g==="myop_cta_handler"&&u.__myop_cta_queue){let y=u.__myop_cta_queue;u.__myop_cta_queue=null,y.forEach(h=>{o.markedForDisposed||p(h.action,h.payload)})}return!0}return co(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(Z.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let l=xe[d.behavior.message];return o.send(new l(...c)),!0}else throw new Error("Error: Unsupported Behavior\\n\\nThe 'behavior' field provided is not supported.\\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\\n\\n")+"Prop Name: ".concat(a,"\\n")+"Behavior Field: ".concat(d.behavior.type,"\\n\\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,s),o},qs=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{on(p)||ro.notSerializableRefCall(t,p)}),n.send(new j(({ref:p,propName:d,functionArgs:c,makeSerializable:l})=>{if(p){let u=p[d];return l(typeof u=="function"?p[d](...c):u,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:i},p=>{a(p.content)}))})},set(e,t,s){return n.send(new j(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),rn=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new We(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new De(o.refConfig,n,V(M({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let l=e.find(u=>u.id==p.id);if(l!==p){s.refs[o.refConfig.name]=l,i(l);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(u=>{let g=n.instance.resolvedNestedComponents.find(h=>h.type.id===u.componentDefinitionId).type,y=new We(g,p);y.setInitiated(),p.refs[u.refName]=y,e.push(y)});try{await an(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(u){a(u)}}))})},an=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==Se.component){if(t){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let l=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(g=>g.type.id===c);if(!l)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let u=Z.create("",i,o);try{let g=await rn(u,l,e);o.refs[i.name]=g,a()}catch(g){p(g)}}else try{let c=Z.create("",i,o);o.refs[i.name]=qs(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}}});var Re,pn=m(()=>{"use strict";Fe();b();Ne();I();Re=class extends N{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;r(this,"sizeMeta");r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:t})=>{let{height:s,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();t({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:s,width:i}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));r(this,"observeAutoSize",e=>{var Mn,In,Cn,xn,bn,wn,Sn;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(H,K,Me)=>K!==void 0&&H<K?K:Me!==void 0&&H>Me?Me:H,a=H=>{if(H===void 0)return;if(typeof H=="number")return H;let K=parseFloat(H);return isNaN(K)?void 0:K},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),l=a(e==null?void 0:e.maxHeight),u=(Mn=e==null?void 0:e.loaderMinHeight)!=null?Mn:50,g=((In=this.sizeMeta)==null?void 0:In.width)==="100%"?"100%":void 0,y=((Cn=this.sizeMeta)==null?void 0:Cn.height)==="100%"?"100%":void 0,h=(bn=(xn=e==null?void 0:e.explicitWidth)!=null?xn:g)!=null?bn:"100%",Q=(wn=e==null?void 0:e.explicitHeight)!=null?wn:y,qe=h!==void 0,he=Q!==void 0,J=this.container.getBoundingClientRect(),L=J.width===0,O=J.height===0||J.height===u,q=(e!=null&&e.forceAutoSize||L)&&!qe,X=(e!=null&&e.forceAutoSize||O)&&!he;if(!q&&!X){let H=typeof h=="number"?h:void 0,K=typeof Q=="number"?Q:void 0;return(H!==void 0||K!==void 0)&&((Sn=e==null?void 0:e.onSizeChange)==null||Sn.call(e,{width:H,height:K,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}let Pt=()=>{var K;let H=t.contentDocument;if(H){X&&(t.style.height="0px"),q&&(t.style.width="0px");let Me=Math.ceil(H.documentElement.scrollWidth),En=Math.ceil(H.documentElement.scrollHeight),Tn=i(Me,p,d),vn=i(En,c,l);q&&(t.style.width="".concat(Tn,"px")),X&&(t.style.height="".concat(vn,"px"));let ks=q&&d!==void 0&&Me>d,Hs=X&&l!==void 0&&En>l;H.documentElement.style.overflowX=ks?"auto":"",H.documentElement.style.overflowY=Hs?"auto":"",(K=e==null?void 0:e.onSizeChange)==null||K.call(e,{width:Tn,height:vn,autoSizingWidth:q,autoSizingHeight:X})}};Pt();let Ot=new ResizeObserver(Pt);Ot.observe(s.body),Ot.observe(s.documentElement);let hn=new MutationObserver(Pt);return hn.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{Ot.disconnect(),hn.disconnect()}});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});r(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});r(this,"send",e=>{var i,a;let t=M({},e);if(t.messageType===f.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.down;let s=super.send(t);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(t,"*"),s});r(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=ve(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===f.In.MutationObserverMessage||e.messageType===f.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var ee,Ze=m(()=>{"use strict";ee=class{constructor(){r(this,"appendChild",(n,e,t)=>{var s;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let i=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,i||null)}}else return n.appendChild(e)})}}});var Vs,et,lo=m(()=>{"use strict";pn();Ze();ie();w();Vs=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},et=class extends ee{constructor(){super(...arguments);r(this,"type",Y.IframeLoader);r(this,"load",async(e,t,s,i)=>{let a,p=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,s),a=s,a.src=p.url;else{let d=E(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let l="\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n height: ".concat(p.autoHeight||!p.height?"100%":p.height,";\\n width: 100%;\\n overflow: hidden;\\n border: none;\\n opacity: ").concat(i!=null&&i.hidden?"0":"1",";\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n ");a.style.cssText=l,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([g,y])=>{y===""||y===null||y===void 0?a.setAttribute(g,""):a.setAttribute(g,String(y))});let u=t.loader.url;i!=null&&i._hasParent&&(u=Vs(u,"_myop-comp",d)),a.src=u,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new Re(e,t,s,a,i)})}}});var tt,dn=m(()=>{"use strict";tt={webcomponent_message_key:"myop_webcomponent_message"}});var _e,cn=m(()=>{"use strict";dn();Fe();Ne();_e=class extends N{constructor(e,t,s,i,a){super(e,s,a);this.container=s;this.customElement=i;r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=M({},e),s=super.send(t),i=new CustomEvent(tt.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});r(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=ve(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}}});var mn,nt,fo=m(()=>{"use strict";cn();Ze();ie();w();mn={},nt=class extends ee{constructor(){super(...arguments);r(this,"type",Y.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;mn[a.url]?console.log("Module alreday loaded or in loading process"):mn[a.url]=new Promise((c,l)=>{let u=a.url,g=document.createElement("script");g.type="module",g.src=u,g.onload=()=>{c()},g.onerror=()=>{l()},document.head.appendChild(g)}),await mn[a.url],await Hn(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),i!=null&&i._environment&&(d._myopEnvironment=i==null?void 0:i._environment),this.appendChild(s,d,i),new _e(e,t,s,d,i)})}}});var T,U=m(()=>{"use strict";w();T=class extends Je{constructor(e,t){super(e);this.context=t;r(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(i,a)=>{this.messageToHost(V(M({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,s)}else debugger}else debugger})}}});var B,te=m(()=>{"use strict";B={id:"myop-id"}});var S,uo,P=m(()=>{"use strict";te();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),uo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var ot,go=m(()=>{"use strict";I();b();U();P();ot=class extends T{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{s(new ae(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var st,yo=m(()=>{"use strict";I();U();P();st=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var rt,ho=m(()=>{"use strict";w();rt=class extends Ee{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var it,Mo=m(()=>{"use strict";w();te();U();b();I();it=class extends T{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];s.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new be(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new le(e.handlerUniqueId,i))});r(this,"messageType",f.DetectMyopRefsMessage)}}});var at,Io=m(()=>{"use strict";I();U();P();at=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var pt,Co=m(()=>{"use strict";I();b();U();P();ge();pt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{s(new de(e.handlerUniqueId,A(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var dt,xo=m(()=>{"use strict";I();te();$e();Qe();U();dt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=$.Instance(),d=p.components.find(g=>g.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let l=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),u=[];Object.keys(l.refs).forEach(g=>{let y=l.refs[g];y=y.__nonProxied||y,y.componentDefinition&&u.push({refName:g,componentDefinitionId:y.componentDefinition.id})}),s(new G(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new G(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var ct,ln=m(()=>{"use strict";ge();ct=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=A,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)}});var mt,bo=m(()=>{"use strict";I();b();U();ln();mt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{ct(e,a=>{s(new pe(e.handlerUniqueId,a))},t)})}}});var wo,lt,So=m(()=>{"use strict";I();b();U();P();te();ge();wo=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:wo(i),required:i.required,validity:A(i.validity,!0),myopId:a};p?e.formData[p]?e.formData[p].value?e.unmappedData.push(d):(e.unmappedData.push(e.formData[p]),e.formData[p]=d):e.formData[p]=d:e.unmappedData.push(d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},lt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new ce(wo(a)),e)})})}}});var ft,Eo=m(()=>{"use strict";I();U();P();ft=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var To={};se(To,{WebComponentSDK:()=>ke});var ke,fn=m(()=>{"use strict";w();I();dn();go();yo();ho();Mo();re();b();Io();Co();xo();bo();So();Eo();ke=class extends we{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(tt.webcomponent_message_key,s=>{let i=s.data?s.data:s.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(s),a.messageType===f.InitMessage){let p=a.content.id;this.components[p].context=new rt(e,t)}}}),setTimeout(()=>{this.messageToHost(new me)},1)});r(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new st(this.messageToHost,this.components),new ft(this.messageToHost,this.components),new ot(this.messageToHost,this.components),new it(this.messageToHost,this.components),new at(this.messageToHost,this.components),new pt(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new lt(this.messageToHost,this.components),new dt(this.messageToHost,this.components)]);r(this,"init",()=>{})}};W("WebComponentSDK",ke)});var vo=m(()=>{"use strict";fn()});var Ro,_o=m(()=>{"use strict";Ro=""});function Ys(o,n){return class extends HTMLElement{connectedCallback(){let e=n===fe.open?"open":"closed",t=this.attachShadow({mode:e});Bo().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var js,Gs,Ho,Do,ut,Bo,Qs,Js,Xs,gt,Lo=m(()=>{"use strict";cn();sn();Ze();ie();w();vo();pn();_o();js="<!-- myop-web-component -->",Gs="myop-web-component",Ho=new Set,Do=[],Bo=async()=>(ut||(ut=new ke,ut.init()),ut);Qs=(o,n,e)=>{customElements.define(o,Ys(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Js=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Xs=o=>(o=Js(o),o.replace(/_/g,"-")),gt=class extends ee{constructor(){super(...arguments);r(this,"type",Y.HTMLLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,i);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===fe.localFrame){let c=E(),l="myop-comp-".concat(c),u=document.createElement("iframe");u.id=l,u.style.cssText="\\n display: block;\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n overflow: hidden;\\n border: none;\\n opacity: ".concat(i!=null&&i.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),u=this.appendChild(s,u,i);let g=u.contentDocument||u.contentWindow.document;g.open();let y=null;{let O=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(O)try{y=JSON.parse(O.getAttribute("content")||"{}")}catch(q){}}let h=a.HTML;if(i!=null&&i._inspection){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O==null||O.removeAttribute("type");let q=L.implementation.createHTMLDocument();q.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let X=q.body.firstChild;X&&L.head&&L.head.insertBefore(L.importNode(X,!0),L.head.firstChild),h=L.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O&&(O.remove(),h=L.documentElement.outerHTML)}g.writeln(h);let Q='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),qe="<script>\\n window.__federation__.__public_path__ = window.__federation__.__public_path__;\\n const __myop_init = async () => {\\n const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());\\n const sdk = new IframeSDK();\\n sdk.init();\\n }\\n __myop_init().then();\\n <\\/script>";if(g.writeln("".concat(Q).concat(qe)),(i==null?void 0:i.data)!==void 0){let J="<script>\\n window.__myop_cta_queue = [];\\n window.myop_cta_handler = function(action, payload) {\\n window.__myop_cta_queue.push({action: action, payload: payload});\\n };\\n <\\/script>",L=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),O='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(L,";\\n var scriptEl = document.getElementById('__myop_init_data_script');\\n\\n var callInitInterface = function(fn) {\\n var startTime = performance.now();\\n // Mark as pre-injected data call for extension tracking\\n window.__myop_init_preinjected = true;\\n try {\\n fn(data);\\n } finally {\\n window.__myop_init_preinjected = false;\\n }\\n var duration = performance.now() - startTime;\\n\\n // Notify extension via postMessage (init* = pre-injected)\\n try {\\n window.parent.postMessage({\\n type: 'MYOP_PREINJECTED_INIT',\\n payload: {\\n data: data,\\n duration: duration,\\n timestamp: Date.now()\\n }\\n }, '*');\\n } catch (e) {}\\n\\n // Cleanup: remove script tag and stored data\\n if (scriptEl && scriptEl.parentNode) {\\n scriptEl.parentNode.removeChild(scriptEl);\\n }\\n delete window.__myop_init_data;\\n };\\n\\n if (typeof window.myop_init_interface === 'function') {\\n // Function already exists - call immediately\\n callInitInterface(window.myop_init_interface);\\n } else {\\n // Function not yet defined - store data and watch for definition\\n window.__myop_init_data = data;\\n\\n var _original;\\n Object.defineProperty(window, 'myop_init_interface', {\\n configurable: true,\\n enumerable: true,\\n set: function(fn) {\\n _original = fn;\\n if (window.__myop_init_data !== undefined) {\\n var storedData = window.__myop_init_data;\\n delete window.__myop_init_data;\\n callInitInterface(fn);\\n }\\n },\\n get: function() {\\n return _original;\\n }\\n });\\n }\\n })();\\n <\\/script>");g.writeln(J+O)}g.close();let he=new Re(e,t,s,u,i);return he.sizeMeta=y,a.autoHeight&&(u.onload=()=>{he.observeSizeBasedOnDocumentElement()}),he}if(a.shadowRootMode===fe.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Bo().then(l=>{l.connectedCallback(d,d)})}else{let c=Xs(e.name+t.id);Do.includes(c)||(Qs(c,a.HTML,a.shadowRootMode),Do.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(s,d,i),new _e(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(js)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Gs);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(Ho.has(t)){console.log("[MyopWebComponent] Script already executed for ".concat(t,", skipping"));return}let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s),Ho.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,i,a){let p=this.extractWebComponentScript(i);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(l));let u="myop-comp-".concat(E()),g=document.createElement(l);g.id=u,a!=null&&a.hidden&&(g.style.opacity="0",g.style.position="absolute",g.style.height="0",g.style.width="0",g.style.pointerEvents="none",g.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,g,a);let y=new ye(e,t,s,g,l,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(l,"> into container")),y}}});var Po,Oo,Ao=m(()=>{"use strict";ie();b();Po=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new D(({rootRef:s,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let l in i){c+="".concat(l," { ");let u=i[l];for(let g in u)c+="".concat(g,": ").concat(u[g],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new D(({rootRef:s,_tagId:i})=>{let a=(s.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:t}))}},Oo=(o,n)=>{let e="myop-css-".concat(E());return o.send(new D(({rootRef:t,_tagId:s,_link:i})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new D(({rootRef:t,_tagId:s})=>{let i=(t.shadowRoot||document).getElementById(s);i&&i.remove()},()=>{},{_tagId:e}))}}});var Zs,un,Ko,zo=m(()=>{"use strict";Zs=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},un=(o,n)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=M({},o.loader),o.loader.url=Zs(o.loader.url,n),o},Ko=o=>async n=>un(n,o)});var Fo,$o,Wo=m(()=>{"use strict";b();Fo=(o,n,e)=>{o.send(new j(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},$o=(o,n,e)=>{o.send(new j(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var Mt,yt,It,ht,No=m(()=>{"use strict";ie();Mt=class Mt{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"id",this._runTimeId);r(this,"name",this._runTimeName);r(this,"description","");r(this,"loader",null);r(this,"withLoader",n=>(this.loader=n,this));r(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));r(this,"build",()=>this)}};r(Mt,"create",()=>new Mt);yt=Mt,It=class It{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});r(this,"name",this._runTimeName);r(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});r(this,"withInstance",n=>(this.instance=n,this));r(this,"withType",n=>(this.type=n,this));r(this,"withName",n=>(this.name=n,this));r(this,"withDefaultSkin",n=>(this.type.skins.push(n),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:n.id}},this));r(this,"withRef",n=>(this.type.refs.push(n),this));r(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});r(this,"build",()=>JSON.parse(JSON.stringify(this)))}};r(It,"create",()=>new It);ht=It});var er,Ct,tr,nr,ne,F,Uo,gn=m(()=>{"use strict";w();er=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Te.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Te.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),Ct="__MYOP_CLOUD_REPOSITORY_MAIN__",tr=()=>{if(typeof window<"u")return window[Ct];if(typeof globalThis<"u")return globalThis[Ct]},nr=o=>{typeof window<"u"&&(window[Ct]=o),typeof globalThis<"u"&&(globalThis[Ct]=o)},ne=class ne{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production");r(this,"_envExplicitlySet",!1)}static get Main(){let n=tr();return n||(ne._main||(ne._main=new ne,nr(ne._main)),ne._main)}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],i=e!==void 0||t!==void 0,a,p;if(!i&&s)a=s.env,p=s.preview;else{a=e||this._defaultEnv;let c=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!c}let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,l)=>{try{let u="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(u+="&preview=true");let h=(await(await fetch(u)).json()).item;if(!h){l(new Error('Component "'.concat(n,'" not found')));return}if(!h.consume_variant||!h.consume_variant.length){l(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let Q=er(h);c(Q)}catch(u){l(u)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};r(ne,"_main",null);F=ne,Uo=F});var qo,Vo=m(()=>{"use strict";qo=async o=>await o()});var oe,jo,Go,Yo,Qo,Jo,Xo,Zo,es,ts=m(()=>{"use strict";gn();oe=F.Main,jo=()=>oe,Go=(o,n,e)=>oe.isPreloaded(o,n,e),Yo=o=>oe.getPreloadedParams(o),Qo=()=>{oe=new F("http://localhost:9292")},Jo=o=>{oe=new F(o)},Xo=o=>{oe=o},Zo=o=>{oe.setEnvironment(o)},es=async(o,n,e)=>Promise.allSettled(o.map(t=>oe.fetchComponentV2(t,n,e)))});var yn={};se(yn,{CloudRepository:()=>F,ComponentConfig:()=>ht,SkinConfig:()=>yt,addClass:()=>Fo,applyStylesheet:()=>Po,applyStylesheetLink:()=>Oo,changeSkinUrlByTokenizer:()=>Ko,createIframeSkinByTokenizer:()=>un,enableLocalDev:()=>Qo,exec:()=>qo,getCloudRepository:()=>jo,getPreloadedParams:()=>Yo,isPreloaded:()=>Go,preloadComponents:()=>es,removeClass:()=>$o,setCloudRepository:()=>Xo,setCloudRepositoryUrl:()=>Jo,setEnvironment:()=>Zo,v2_CloudRepository:()=>Uo});var xt=m(()=>{"use strict";Ao();zo();Wo();No();gn();Vo();ts()});var ns,os=m(()=>{"use strict";Ft();xt();w();ns=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=zt(t);switch(s){case"component":{let[a,p]=i,d=await F.Main.fetchComponent(a);if(d&&d.type.skins.find(l=>l.id===p))return d.instance.skinSelector={type:ue.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=zt(t),c=(await F.Main.fetchFlow(a)).components.find(l=>l.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ue.Segmented&&c.instance.resolvedExperiences){let l=c.instance.resolvedExperiences.find(u=>u.id===p);if((l==null?void 0:l.type)===Xe.Segment){let u=l,y=c.instance.skinSelector.segments.find(h=>h.segmentId===u.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var is={};se(is,{HostSDK:()=>$,hostSDK:()=>rs});var ss,$,rs,$e=m(()=>{"use strict";re();I();b();lo();fo();Ne();w();Ye();Lo();os();ss="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",$=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"initiated",!1);r(this,"version",Ie);r(this,"type2InstanceCount",{});r(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));r(this,"inspected",!1);r(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});r(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==v.up&&n.data.messageType!==f.EnvelopedMessage)return;let e=n.data;if(e.messageType===f.InitRequest){this.components2init.forEach(s=>{s.send(new Ce(s.id))});return}if(e.messageType===f.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let s=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===f.EnvelopedMessage){let s=e,i=this.components.find(a=>a.id===s.destination);if(i){if(s.direction===v.down){s.message.messageType===z.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{let a=this.components.find(p=>p.id===s.message.destination);a&&a.send(s.message)}return}let t=this.components.find(s=>s.id===e.destination);if(!t){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(t){if(t.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});r(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});r(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new et,new nt,new gt];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let i=new s(this.componentsLoaders);t[i.type]=i}),this.componentsLoaders.forEach(s=>{t[s.type]||(t[s.type]=s)}),this.componentsLoaders=Object.values(t)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});r(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var i;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case ue.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case ue.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===Xe.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let u=c.segment,g=(t||{})[u.function];return g?await g():(console.warn("segmentId:".concat(d.segmentId,", ").concat(u.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});r(this,"runSkinSelector",async(n,e)=>{let t=await this._getSkinIdBySkinSelector(n.instance.skinSelector,n.instance.resolvedExperiences,e);return n.type.skins.find(s=>s.id===t)});r(this,"loaderHooks");r(this,"loadComponent",async(n,e,t)=>{var l,u,g,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await ns(n);s&&(n=s);let i=M(M({},(l=this.loaderHooks)!=null?l:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let h=await this.runSkinSelector(n,i);if(!h)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(h=await t.hooks.afterSkinSelected(M({},h))),n.instance.skinSelector={type:ue.Dedicated,skin:h},t&&(t=M({},t),delete t.hooks),await rn(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=t==null?void 0:t.hooks)!=null&&y.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(M({},p)));let d=this.componentsLoaders.find(h=>h.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(h=>h!==c),this.components2init=this.components2init.filter(h=>h!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=mo(c,n.type.props,p));try{await an(c,n,this.components)}catch(h){throw h}return t!=null&&t.skipInit||await c.initiated(),c});r(this,"navigate",async(n,e,t)=>{if(n.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(t!=null&&t.staged){let s=await this.loadComponent(e,n.container,M({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(s),s.show(),n.dispose(),s}else{let s=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,M({relative:{direction:"before",child:s}},t))}})}};r($,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:ss});if(!window.myop.hostSDK){let o=new $;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:ss}),window.myop.hostSDK=o}rs=window.myop.hostSDK;W("hostSDK",rs)});var bt,as=m(()=>{"use strict";I();te();w();b();bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(B.id,"]")),s=[];t.forEach(i=>{let a=i.getAttribute(B.id);a&&s.push(new be(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new le(e.handlerUniqueId,s))})}}});var wt,ps=m(()=>{"use strict";I();w();b();P();wt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new ae,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}}});var St,ds=m(()=>{"use strict";I();w();P();St=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var Et,cs=m(()=>{"use strict";I();b();w();ln();Et=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"executor",e=>{ct(e,s=>{this.messageToHost(new pe(e.handlerUniqueId,s))},new Ee(document.documentElement))})}}});var Tt,ms=m(()=>{"use strict";I();w();b();ge();P();Tt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new de(e.handlerUniqueId,A(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}}});var vt,ls=m(()=>{"use strict";I();w();P();vt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var Rt,fs=m(()=>{"use strict";I();te();w();$e();Qe();Rt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await $.Instance().loadComponent(e.nestedComponentConfig,s.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new G(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new G(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var us,gs=m(()=>{"use strict";us=(o,n)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let t=new e(n),s={attributes:!0,childList:!0,subtree:!0};return t.observe(o,s),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))}});var _t,ys=m(()=>{"use strict";I();b();w();gs();_t=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&us(document.body,()=>{this.messageToHost(new Pe)})})}}});var hs,kt,Ms=m(()=>{"use strict";I();te();w();b();ge();P();hs=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:hs(i),required:i.required,validity:A(i.validity,!0),myopId:a};e.unmappedData.push(d),p&&(!e.formData[p]||!e.formData[p].value||d.value)&&(e.formData[p]=d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},kt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new ce(hs(s)),e)})})}}});var Ht,Is=m(()=>{"use strict";I();w();b();P();Ht=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetAttributeMessage);r(this,"executor",e=>{let t=uo(e.ref,document);t&&this.messageToHost(new Le(t.getAttribute(e.name)),e)})}}});var Dt,Cs=m(()=>{"use strict";b();I();w();Dt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new ze)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Bt,xs=m(()=>{"use strict";I();w();P();Bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var bs={};se(bs,{IframeSDK:()=>Lt});var Lt,ws=m(()=>{"use strict";w();as();ps();ds();cs();re();ms();ls();b();fs();ys();Ms();Ye();Is();Cs();xs();Lt=class extends we{constructor(){super();r(this,"version",Ie);r(this,"messageToHost",(e,t)=>{var i;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let s=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=s[0]),e.source||(e.source=s[0]),e.direction=v.up,(i=window.parent)==null||i.postMessage(M({},e),"*")});r(this,"supportedHandlers",[new St(this.messageToHost),new Bt(this.messageToHost),new wt(this.messageToHost),new bt(this.messageToHost),new Et(this.messageToHost),new Tt(this.messageToHost),new vt(this.messageToHost),new kt(this.messageToHost),new _t(this.messageToHost),new Dt(this.messageToHost),new Ht(this.messageToHost),new Rt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new me)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};W("IframeSDK",Lt)});var sr={};var or,Ss=m(()=>{"use strict";b();re();or=M({},xe);W("MyopMessages",or)});var Es={};se(Es,{CloudRepository:()=>F,ComponentConfig:()=>ht,SkinConfig:()=>yt,addClass:()=>Fo,applyStylesheet:()=>Po,applyStylesheetLink:()=>Oo,changeSkinUrlByTokenizer:()=>Ko,createIframeSkinByTokenizer:()=>un,enableLocalDev:()=>Qo,exec:()=>qo,getCloudRepository:()=>jo,getPreloadedParams:()=>Yo,isPreloaded:()=>Go,preloadComponents:()=>es,removeClass:()=>$o,setCloudRepository:()=>Xo,setCloudRepositoryUrl:()=>Jo,setEnvironment:()=>Zo,v2_CloudRepository:()=>Uo});var Ts=m(()=>{"use strict";re();xt();xt();W("MyopHelpers",yn)});var dr={};se(dr,{getHostModule:()=>vs,getIframeModule:()=>Rs,getWebcomponentModule:()=>_s});re();var kn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(kn=document.currentScript)==null?void 0:kn.src,n=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:n,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,n,e)=>{if(window.__federation__[n])console.log("__federation__ module ".concat(n," already loaded.")),e(window.__federation__[n][Kt]);else{let t;window.__federation__[n]={},window.__federation__[n][Ge]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Kt]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Ye();console.log("myop root sdk - loaded",document.location.origin);var rr="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",vs=()=>Promise.resolve().then(()=>($e(),is)),Rs=()=>Promise.resolve().then(()=>(ws(),bs)),_s=()=>Promise.resolve().then(()=>(fn(),To)),ir=()=>Promise.resolve().then(()=>(Ss(),sr)),ar=()=>Promise.resolve().then(()=>(Ts(),Es)),Ue=o=>async()=>(await o()).get(),pr={version:Ie,getHostModule:Ue(vs),getIframeModule:Ue(Rs),getWebcomponentModule:Ue(_s),getMyopMessages:Ue(ir),getMyopHelpers:Ue(ar)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:rr});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:pr},window.myop);return Ks(dr);})();
2
+ `;var ze=Object.defineProperty,Vt=Object.defineProperties,Gt=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertySymbols,Yt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable,xe=(e,t,s)=>t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,S=(e,t)=>{for(var s in t||(t={}))Yt.call(t,s)&&xe(e,s,t[s]);if(We)for(var s of We(t))Qt.call(t,s)&&xe(e,s,t[s]);return e},ae=(e,t)=>Vt(e,Gt(t)),Jt=(e,t)=>{for(var s in t)ze(e,s,{get:t[s],enumerable:!0})},a=(e,t,s)=>xe(e,typeof t!="symbol"?t+"":t,s),g=(e,t,s)=>new Promise((n,i)=>{var o=l=>{try{c(s.next(l))}catch(d){i(d)}},r=l=>{try{c(s.throw(l))}catch(d){i(d)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,r);c((s=s.apply(e,t)).next())}),fe="__federation__",Ke="onLoad",qe=(e,t)=>{window[fe]&&window[fe][e]&&window[fe][e][Ke]&&window[fe][e][Ke]({[e]:t})},_={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",CleanupMessage:"CleanupMessage",In:{MutationObserverMessage:"MutationObserverMessage",ResizeObserverMessage:"ResizeObserverMessage"}},He={};Jt(He,{AddEventListenerMessage:()=>rs,BaseMyopMessage:()=>T,BindClickMessage:()=>ss,ChangeTextMessage:()=>ns,CleanupMessage:()=>dt,CleanupReplayMessage:()=>ut,ClickReplayMessage:()=>Ve,CreateRefComponentMessage:()=>it,CustomRefMessage:()=>Re,DetectMyopRefsMessage:()=>ds,DetectedMyopRefsMessage:()=>at,DisposeMessage:()=>ht,ElementValueReplayMessage:()=>et,EnvelopedMessage:()=>ot,EventListenerCallbackMessage:()=>Xe,ExecuteComponentMethod:()=>W,ExecuteScriptMessage:()=>z,ExecuteScriptReplyMessage:()=>Qe,GetAttributeMessage:()=>us,GetAttributeReplayMessage:()=>hs,GetElementValueMessage:()=>cs,InitMessage:()=>De,InitRequest:()=>st,InitResponse:()=>tt,MessageDirection:()=>L,MutationObserverMessage:()=>ms,MyopBindMessage:()=>A,MyopBindReplayMessage:()=>P,MyopElementMessage:()=>ts,Ref:()=>ce,RefComponentCreatedMessage:()=>ke,ResizeObserverMessage:()=>ys,SetAttributeMessage:()=>as,SetInnerHtml:()=>ls,SetMutationObserverMessage:()=>ps,SetResizeObserverMessage:()=>fs,stripFunction:()=>Ye});var Q=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),Xt=e=>{const t=[...e].map(s=>s.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},Zt=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";const s=atob(t);return Uint8Array.from(s,n=>n.charCodeAt(0))},Ue=e=>{const t=Zt(e);if(t.length%16!==0)throw new Error("Invalid input length");const s=[];for(let n=0;n<t.length;n+=16)s.push(Xt(t.slice(n,n+16)));return s},es=e=>new Promise(t=>setTimeout(t,e)),L=class{};a(L,"down","down"),a(L,"up","up");var T=class{constructor(){a(this,"id",Q()),a(this,"myop",!0),a(this,"content"),a(this,"source"),a(this,"destination"),a(this,"route"),a(this,"ref"),a(this,"direction"),a(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},ts=class extends T{constructor(e){super(),this.ref=e}},P=class extends T{constructor(e){super(),this.replayToHandler=e}},A=class extends T{constructor(t){super(),this.handler=t,a(this,"handlerUniqueId",Q())}},ce=class Ut{constructor(t,s){this.refConfig=t,this.component=s,a(this,"myop",!0),a(this,"__nonProxied"),this.__nonProxied=ae(S({},this),{component:null})}static create(t,s,n){let i=s;return i||(i={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new Ut(i,n)}},je="ClickReplayMessage",ss=class extends A{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",je),a(this,"messageType","BindClickMessage"),a(this,"cleanable",!0)}},Ve=class extends P{constructor(){super(...arguments),a(this,"messageType",je)}},ns=class extends T{constructor(e,t){super(),this.ref=e,a(this,"messageType","ChangeTextMessage"),this.content=t}},Ge="ExecuteScriptReplyMessage",is=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,os=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,Ye=e=>{let t=e.match(is);if(t)return t[1]||t[3];{let s=e.match(os);if(s)return s[1].trim()}},z=class extends A{constructor(t,s=()=>{},n){super(s),this.scriptInputs=n,a(this,"replyMessageKey",Ge),a(this,"messageType","ExecuteScriptMessage"),a(this,"script",""),this.script=t.toString(),this.content=t.toString(),this.content=Ye(this.content)}};a(z,"replierKey","send"),a(z,"completeStreamKey","completeStream");var Qe=class extends P{constructor(e,t){super(e),this.replayToHandler=e,this.content=t,a(this,"messageType",Ge)}},Re=class extends z{constructor(e,t,s=()=>{}){super(({rootRef:n,elementId:i,_script:o,__scriptInputs:r})=>{const c=(n.shadowRoot||n.container).querySelectorAll(`[myop-id='${i}']`);return c.length?(r.ref=c[0],new Function(`return (${o})(...arguments)`)(r)):null},s),this.scriptInputs=t,this.scriptInputs=ae(S({},t),{_script:e.toString()})}},Je="EventListenerCallbackMessage",rs=class extends A{constructor(e,t,s){super(s),this.ref=e,this.type=t,this.handler=s,a(this,"replyMessageKey",Je),a(this,"messageType","AddEventListenerMessage"),a(this,"cleanable",!0),a(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},Xe=class extends P{constructor(e,t){super(e),this.replayToHandler=e,this.e=t,a(this,"messageType",Je),this.content={e:t}}},as=class extends T{constructor(e,t,s){super(),this.ref=e,this.name=t,this.value=s,a(this,"messageType","SetAttributeMessage")}},Ze="ElementValueReplayMessage",cs=class extends A{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",Ze),a(this,"messageType","GetElementValueMessage")}},et=class extends P{constructor(e){super(),this.content=e,a(this,"messageType",Ze)}},ls=class extends T{constructor(e,t){super(),this.ref=e,a(this,"messageType","SetInnerHtml"),this.content=t}},De=class extends T{constructor(e){super(),a(this,"messageType","InitMessage"),this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},tt=class extends De{constructor(){super(...arguments),a(this,"messageType","InitResponse")}},st=class extends T{constructor(){super(...arguments),a(this,"messageType","InitRequest")}},nt="RefComponentCreatedMessage",it=class extends A{constructor(e,t,s,n){super(n),this.refConfig=e,this.nestedComponentConfig=t,this.options=s,a(this,"replyMessageKey",nt),a(this,"messageType","CreateRefComponentMessage")}},ke=class extends P{constructor(e,t,s){super(e),this.replayToHandler=e,this.nestedRefs=t,this.failed=s,a(this,"messageType",nt)}},ot=class extends T{constructor(e,t){super(),this.destination=e,this.message=t,a(this,"messageType","EnvelopedMessage");const s=t;this.route=[e,...s.route?s.route:[]]}},rt="DetectedMyopRefsMessage",ds=class extends A{constructor(){super(...arguments),a(this,"messageType","DetectMyopRefsMessage"),a(this,"replyMessageKey",rt)}},at=class extends P{constructor(e,t){super(e),this.replayToHandler=e,a(this,"messageType",rt),this.content=t}isTypeof(e){return e.messageType===this.messageType}},ct="GetAttributeReplayMessage",us=class extends A{constructor(e,t,s){super(s),this.ref=e,this.name=t,a(this,"replyMessageKey",ct),a(this,"messageType","GetAttributeMessage")}},hs=class extends P{constructor(e){super(),this.content=e,a(this,"messageType",ct)}},W=class extends T{constructor(e){super(),this.method=e,a(this,"messageType","ExecuteComponentMethod")}},ps=class extends T{constructor(){super(...arguments),a(this,"messageType","SetMutationObserverMessage")}},ms=class extends T{constructor(){super(...arguments),a(this,"messageType","MutationObserverMessage")}},lt="CleanupReplayMessage",dt=class extends A{constructor(e,t){super(t),this.cleanupForMessageId=e,a(this,"replyMessageKey",lt),a(this,"messageType","CleanupMessage")}},ut=class extends P{constructor(e){super(),this.customCleanup=e,a(this,"messageType",lt)}},ht=class extends T{constructor(){super(...arguments),a(this,"messageType","DisposeMessage")}},fs=class extends T{constructor(){super(...arguments),a(this,"cleanable",!0),a(this,"messageType","SetResizeObserverMessage")}},ys=class extends T{constructor(){super(...arguments),a(this,"messageType","ResizeObserverMessage")}},ye=class{constructor(e,t,s){this.componentDefinition=e,this.container=t,a(this,"id",""),a(this,"messageHandlers",{}),a(this,"element"),a(this,"_markedForDisposed",!1),a(this,"bind",(i,o)=>{this.messageHandlers[i]||(this.messageHandlers[i]=[]),this.messageHandlers[i].includes(o)||this.messageHandlers[i].push(o)}),a(this,"bindWhen",(i,o,r)=>{if(!r)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[i]||(this.messageHandlers[i]=[]);const c=this.messageHandlers[i],l=d=>o(d)?(r(d),!0):!1;return c.push(l),()=>{const d=c.indexOf(l);d>-1&&c.splice(d,1)}}),a(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()}),a(this,"isInitiated",!1),a(this,"_whenInitiatedResolve"),a(this,"_whenInitiatedReject"),a(this,"_whenInitiated",new Promise((i,o)=>{this._whenInitiatedResolve=i,this._whenInitiatedReject=o})),a(this,"initiated",()=>this._whenInitiated),a(this,"props",{}),a(this,"refs",{}),this.id=(s==null?void 0:s.id)||_e.Instance().assignId(e);const n=s!=null&&s.timeout?s==null?void 0:s.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject(`timeout_${n} ${this.id}`)},n),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(e){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=e}onMessageReceived(e){if(e.messageType===_.ExecuteComponentMethod){const s=e;return this[s.method]?this[s.method](s.content):console.log(`method not found ${s.method} on component`,this),!0}const t=this.messageHandlers[e.messageType];if(t&&t.length){let s=!1;return t.forEach(n=>{s=s||n(e)}),s}return!1}sendCleanupMessage(e){e.source=this.id,e.destination=this.id,e.direction=L.down;const t=this.bindWhen(e.replyMessageKey,n=>n.replayToHandler===e.handlerUniqueId,n=>{e.handler(n),t()}),s=e.handler;delete e.handler,this.send(e),e.handler=s}send(e){e.source||(e.source=this.id),e.destination||(e.destination=this.id),e.direction=L.down;let t;if(e.handler){const s=e;t=this.bindWhen(s.replyMessageKey,n=>n.replayToHandler===s.handlerUniqueId,s.handler),delete e.handler}return e.ref&&(e.ref=e.ref.__nonProxied||e.ref),e.cleanable?()=>{this.sendCleanupMessage(new dt(e.id,s=>{})),t&&t()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new ht);const e=this.messageHandlers.onDispose;e&&e.forEach(t=>{t(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}},gs=class{constructor(e,t,s,n,i){this.myopId=e,this.htmlTagName=t,this.BoundingRect=s,this.offsetTop=n,this.offsetLeft=i,a(this,"type","MyopElementRef")}},vs=e=>g(void 0,null,function*(){if(typeof e=="function")e();else if(e instanceof Promise){const t=yield e;typeof t=="function"&&t()}}),ws=class{constructor(e){this.messageToHost=e}},_s=class extends ws{constructor(e,t){super(e),this.messageToHost=e,this.context=t}},Ms=class{constructor(e,t){this.id=e,this.context=t,a(this,"send",s=>{})}},bs=class{constructor(){a(this,"messageToHandleAfterInit",[]),a(this,"components",{}),a(this,"alwaysPassEnvelopesToHost",!1),a(this,"messageCleanupCache",{})}handleIncomeMessages(e){const t=e.data?e.data:e.detail;if(!(!t||!t.myop)){let s=t;if(s.direction!==L.down)return;if(s.messageType===_.DisposeMessage){s.destination&&delete this.components[s.destination];return}if(s.messageType===_.InitMessage){const n=s.content.id;if(this.components[n])return;this.components[n]=new Ms(n),this.messageToHost(new tt(n));return}if(s.messageType===_.EnvelopedMessage){const n=s,i=n.message;if(s=i,this.alwaysPassEnvelopesToHost||this.components[s.destination]){const o=myop.hostSDK.components.find(c=>c.id===i.destination);if(o){o.send(i);return}const r=myop.hostSDK.components.find(c=>c.id===n.destination);if(r){r.send(i);return}}else return}if(s.messageType){if(s.messageType===_.CleanupMessage){const n=s,i=this.messageCleanupCache[n.cleanupForMessageId],o=new ut(!!i);o.destination=s.destination,i?(delete this.messageCleanupCache[n.cleanupForMessageId],vs(i).then(()=>{this.messageToHost(o,n)}).catch(()=>{})):this.messageToHost(o,n);return}this.supportedHandlers.forEach(n=>{if(n.messageType===s.messageType){const i=n.executor(s);if(s.cleanable&&i&&(this.messageCleanupCache[s.id]=i),i&&!s.cleanable)throw new Error(`Cleanup handler generated for non-cleanable message.
3
3
  messageType - ${s.messageType}, handler executor was - ${n.executor}
4
4
 
5
5
  Please review the message definition object & message handler.
@@ -7,7 +7,7 @@ To ensure cleanup properly set 'cleanable' true at message definition and return
7
7
  messageType - ${s.messageType}, handler executor was - ${n.executor}
8
8
 
9
9
  Please review the message definition object & message handler.
10
- To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`)}})}else console.log("unsupported message type")}}},le={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader"},de={open:"open",none:"none",localFrame:"localFrame"},ge={code:"code"},Le=class{};a(Le,"code","code"),a(Le,"component","component");var ue={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},ht={Segment:"Segment",Promo:"Promo",AB:"AB"},Es=class{constructor(e,t){this.container=e,this.shadowRoot=t,a(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div")),a(this,"getRoot",()=>this.shadowRoot||this.container)}},Oe=e=>e!==Object(e),Cs=e=>typeof e=="function",pt=e=>{if(Oe(e))return!0;if(Cs(e)||Object.getPrototypeOf(e))return!1;for(const t in e){const s=e[t];if(typeof s=="object"){if(!pt(s))return!1}else{if(Oe(s))continue;return!1}}return!0},Z=(e,t={},s=!0,n=new WeakMap)=>{if(Oe(e))return e;if(Array.isArray(e)){if(n.has(e))return n.get(e);const i=[];n.set(e,i);for(let o=0;o<e.length;o++){const r=e[o];i[o]=Z(r,t,s,n)}return i}if(e!==null&&typeof e=="object"){if(n.has(e))return n.get(e);const i={};n.set(e,i);for(const o in e){const r=typeof t=="boolean"?t:t[o];r&&(r===!0?(s?e[o]!==void 0:e[o])&&(i[o]=Z(e[o],!0,s,n)):typeof r=="object"&&(i[o]=Z(e[o],r,s,n)))}return i}return{}},Ss={notSerializableRefCall:(e,t)=>{throw new Error(`
10
+ To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`)}})}else console.log("unsupported message type")}}},le={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader"},de={open:"open",none:"none",localFrame:"localFrame"},ge={code:"code"},Le=class{};a(Le,"code","code"),a(Le,"component","component");var ue={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},pt={Segment:"Segment",Promo:"Promo",AB:"AB"},Es=class{constructor(e,t){this.container=e,this.shadowRoot=t,a(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div")),a(this,"getRoot",()=>this.shadowRoot||this.container)}},Oe=e=>e!==Object(e),Cs=e=>typeof e=="function",mt=e=>{if(Oe(e))return!0;if(Cs(e)||Object.getPrototypeOf(e))return!1;for(const t in e){const s=e[t];if(typeof s=="object"){if(!mt(s))return!1}else{if(Oe(s))continue;return!1}}return!0},Z=(e,t={},s=!0,n=new WeakMap)=>{if(Oe(e))return e;if(Array.isArray(e)){if(n.has(e))return n.get(e);const i=[];n.set(e,i);for(let o=0;o<e.length;o++){const r=e[o];i[o]=Z(r,t,s,n)}return i}if(e!==null&&typeof e=="object"){if(n.has(e))return n.get(e);const i={};n.set(e,i);for(const o in e){const r=typeof t=="boolean"?t:t[o];r&&(r===!0?(s?e[o]!==void 0:e[o])&&(i[o]=Z(e[o],!0,s,n)):typeof r=="object"&&(i[o]=Z(e[o],r,s,n)))}return i}return{}},Ss={notSerializableRefCall:(e,t)=>{throw new Error(`
11
11
  The input provided to '${e.toString()}' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation.
12
12
  The following types of data are considered non-serializable and cannot be processed:
13
13
 
@@ -37,7 +37,7 @@ Suggested Fix:
37
37
 
38
38
  For more details on serialization and Myop message examples, refer to https://docs.myop.dev.
39
39
 
40
- `)}},mt=class extends ye{constructor(e,t,s){super(e,t.container,s),this.componentDefinition=e,this.parent=t,a(this,"send",n=>{const i=n.handler,o=super.send(n);return this.parent.send(new it(this.id,n)),n.handler=i,o}),a(this,"dispose",()=>{this.isInitiated&&this.send(new z("dispose")),super.dispose()})}hide(){this.send(new z("hide"))}show(){this.send(new z("show"))}inspect(){return this.send(new z("inspect"))}setHeightBasedOnDocumentElement(){this.send(new z("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new z("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}},Pe=class extends ye{constructor(e,t,s,n,i,o){super(e,s,o),this.container=s,this.customElement=n,this.tagName=i,a(this,"ctaCleanup"),a(this,"_ctaHandler"),a(this,"_ctaQueue",[]),a(this,"cleanupInspect",()=>{}),a(this,"send",r=>{const c=super.send(r);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",r),c}),a(this,"dispose",()=>{var r;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(r=this.customElement.parentNode)==null||r.removeChild(this.customElement)}),this.element=n,this.setInitiated()}inspect(){return this.cleanupInspect=Ae(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){const s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(n=>{this.markedForDisposed||e(n.action,n.payload)})}const t=s=>{var n;const i=s;(n=i.detail)!=null&&n.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}},Is=(e,t,s)=>{const n=document.createElement("a");return n.textContent=e,n.style.position="relative",n.style.padding="0 5px",n.style.fontSize="14px",n.style.top="0",n.style.top=`${t}px`,n.style.transform="translateX(-50%)",n.target="_blank",n.href=`https://dashboard.myop.dev/dashboard/component/${s.id}`,n},Ae=(e,t,s,n,i,o)=>{const r=Is(`${o.name} : ${t}`,s,o);return n.insertBefore(r,i),i.style.border="1px solid #007BFF",i.style.display="block",()=>{i.style.border="unset",n.removeChild(r)}},ft=(e,t,s)=>e?!1:(console.error(`Error: Undefined Prop
40
+ `)}},ft=class extends ye{constructor(e,t,s){super(e,t.container,s),this.componentDefinition=e,this.parent=t,a(this,"send",n=>{const i=n.handler,o=super.send(n);return this.parent.send(new ot(this.id,n)),n.handler=i,o}),a(this,"dispose",()=>{this.isInitiated&&this.send(new W("dispose")),super.dispose()})}hide(){this.send(new W("hide"))}show(){this.send(new W("show"))}inspect(){return this.send(new W("inspect"))}setHeightBasedOnDocumentElement(){this.send(new W("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new W("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}},Pe=class extends ye{constructor(e,t,s,n,i,o){super(e,s,o),this.container=s,this.customElement=n,this.tagName=i,a(this,"ctaCleanup"),a(this,"_ctaHandler"),a(this,"_ctaQueue",[]),a(this,"cleanupInspect",()=>{}),a(this,"send",r=>{const c=super.send(r);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",r),c}),a(this,"dispose",()=>{var r;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(r=this.customElement.parentNode)==null||r.removeChild(this.customElement)}),this.element=n,this.setInitiated()}inspect(){return this.cleanupInspect=Ae(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){const s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(n=>{this.markedForDisposed||e(n.action,n.payload)})}const t=s=>{var n;const i=s;(n=i.detail)!=null&&n.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}},Ts=(e,t,s)=>{const n=document.createElement("a");return n.textContent=e,n.style.position="relative",n.style.padding="0 5px",n.style.fontSize="14px",n.style.top="0",n.style.top=`${t}px`,n.style.transform="translateX(-50%)",n.target="_blank",n.href=`https://dashboard.myop.dev/dashboard/component/${s.id}`,n},Ae=(e,t,s,n,i,o)=>{const r=Ts(`${o.name} : ${t}`,s,o);return n.insertBefore(r,i),i.style.border="1px solid #007BFF",i.style.display="block",()=>{i.style.border="unset",n.removeChild(r)}},yt=(e,t,s)=>e?!1:(console.error(`Error: Undefined Prop
41
41
 
42
42
  It looks like you've tried to use a prop that hasn't been defined.
43
43
  Please check the prop name for any typos or ensure that it is properly defined in the component's prop list.
@@ -45,7 +45,7 @@ Please check the prop name for any typos or ensure that it is properly defined i
45
45
  Prop Name: ${t}
46
46
  Component: ${s.componentDefinition.name}, ID: ${s.componentDefinition.id}
47
47
 
48
- For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`),!0),yt=(e,t,s)=>{console.error(`Error: Code Prop Not Supported
48
+ For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`),!0),gt=(e,t,s)=>{console.error(`Error: Code Prop Not Supported
49
49
 
50
50
  Currently, code props are only supported in local frame components.
51
51
  ⚠️ This is a work in progress feature — code props will be supported in upcoming versions.
@@ -55,7 +55,7 @@ In the meantime, you can use message props.
55
55
  Prop Name: ${t}
56
56
  Component: ${s.componentDefinition.name}, ID: ${s.componentDefinition.id}
57
57
 
58
- For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`)},Ts=(e,t,s)=>{const n=t.reduce((o,r)=>ae(S({},o),{[r.name]:S({},r)}),{}),i={get:(o,r)=>{const c=n[r];if(ft(c,r,e))return!1;if(c.behavior.type===ge.code){if(e instanceof Pe)return(c.behavior.remap||r)==="myop_init_interface"?u=>{if(u===void 0)return e.getData();e.initWithData(u)}:void 0;if(s.loader.type===le.HTMLLoader&&s.loader.shadowRootMode===de.localFrame){const d=c.behavior;return e.element.contentWindow[d.remap||r]}return yt(c,r,e),!1}return c.mode==="output"?new Promise(l=>{const d=[];c.behavior.ref&&d.push(ce.create(c.behavior.ref)),d.push(h=>{l(h)}),c.behavior.params&&d.push(...c.behavior.params);const u=He[c.behavior.message];e.send(new u(...d))}):null},set:(o,r,c)=>{const l=n[r];if(ft(l,r,e))return!1;if(l.behavior.type===ge.code){if(e instanceof Pe){const u=l.behavior.remap||r;if(u==="myop_cta_handler")return e.setCtaHandler(c),!0;if(u==="myop_init_interface")return e.initWithData(c),!0}if(s.loader.type===le.HTMLLoader&&s.loader.shadowRootMode===de.localFrame){const u=l.behavior,h=e.element.contentWindow,m=u.remap||r;if(h[m]=c,m==="myop_cta_handler"&&h.__myop_cta_queue){const f=h.__myop_cta_queue;h.__myop_cta_queue=null,f.forEach(y=>{e.markedForDisposed||c(y.action,y.payload)})}return!0}return yt(l,r,e),!1}else if(l.mode==="input")if(l.behavior.type==="message"){const d=[];l.behavior.ref&&d.push(ce.create(l.behavior.ref)),d.push(c),l.behavior.params&&d.push(...l.behavior.params);const u=He[l.behavior.message];return e.send(new u(...d)),!0}else throw new Error(`Error: Unsupported Behavior
58
+ For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`)},Is=(e,t,s)=>{const n=t.reduce((o,r)=>ae(S({},o),{[r.name]:S({},r)}),{}),i={get:(o,r)=>{const c=n[r];if(yt(c,r,e))return!1;if(c.behavior.type===ge.code){if(e instanceof Pe)return(c.behavior.remap||r)==="myop_init_interface"?u=>{if(u===void 0)return e.getData();e.initWithData(u)}:void 0;if(s.loader.type===le.HTMLLoader&&s.loader.shadowRootMode===de.localFrame){const d=c.behavior;return e.element.contentWindow[d.remap||r]}return gt(c,r,e),!1}return c.mode==="output"?new Promise(l=>{const d=[];c.behavior.ref&&d.push(ce.create(c.behavior.ref)),d.push(h=>{l(h)}),c.behavior.params&&d.push(...c.behavior.params);const u=He[c.behavior.message];e.send(new u(...d))}):null},set:(o,r,c)=>{const l=n[r];if(yt(l,r,e))return!1;if(l.behavior.type===ge.code){if(e instanceof Pe){const u=l.behavior.remap||r;if(u==="myop_cta_handler")return e.setCtaHandler(c),!0;if(u==="myop_init_interface")return e.initWithData(c),!0}if(s.loader.type===le.HTMLLoader&&s.loader.shadowRootMode===de.localFrame){const u=l.behavior,h=e.element.contentWindow,m=u.remap||r;if(h[m]=c,m==="myop_cta_handler"&&h.__myop_cta_queue){const f=h.__myop_cta_queue;h.__myop_cta_queue=null,f.forEach(y=>{e.markedForDisposed||c(y.action,y.payload)})}return!0}return gt(l,r,e),!1}else if(l.mode==="input")if(l.behavior.type==="message"){const d=[];l.behavior.ref&&d.push(ce.create(l.behavior.ref)),d.push(c),l.behavior.params&&d.push(...l.behavior.params);const u=He[l.behavior.message];return e.send(new u(...d)),!0}else throw new Error(`Error: Unsupported Behavior
59
59
 
60
60
  The 'behavior' field provided is not supported.
61
61
  Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
@@ -63,7 +63,7 @@ Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
63
63
  Prop Name: ${r}
64
64
  Behavior Field: ${l.behavior.type}
65
65
 
66
- Check the documentation for valid behavior options.`);return!1}};return e.props={},e.props=new Proxy(e.props,i),e},xs=(e,t)=>new Proxy(e,{get(s,n){return s[n]?s[n]:(...o)=>new Promise(r=>{o.forEach(c=>{pt(c)||Ss.notSerializableRefCall(n,c)}),t.send(new Re(({ref:c,propName:l,functionArgs:d,makeSerializable:u})=>{if(c){const h=c[l];return u(typeof h=="function"?c[l](...d):h,!0)}return null},{elementId:s.refConfig.selector,propName:n,functionArgs:o},c=>{r(c.content)}))})},set(s,n,i){return t.send(new Re(({ref:o,propName:r,propValue:c})=>{o&&(o[r]=c)},{elementId:s.refConfig.selector,propValue:i,propName:n},o=>{})),!0}}),gt=(e,t,s,n)=>g(void 0,null,function*(){const i=e.component;if(!i)throw new Error("cant createRefComponent with detached ref");return new Promise((o,r)=>g(void 0,null,function*(){const c=new mt(t.type,i,n);s.push(c),yield i.initiated();const l=setTimeout(()=>{r("timeout")},5e3);i.send(new nt(e.refConfig,t,ae(S({},n||{}),{id:c.id,_hasParent:!0}),d=>g(void 0,null,function*(){if(clearTimeout(l),d.failed){r("CreateRefComponentMessage failed");return}const u=s.find(h=>h.id==c.id);if(u!==c){i.refs[e.refConfig.name]=u,o(u);return}else c.setInitiated(),i.refs[e.refConfig.name]=c;d.nestedRefs.forEach(h=>{const m=t.instance.resolvedNestedComponents.find(y=>y.type.id===h.componentDefinitionId).type,f=new mt(m,c);f.setInitiated(),c.refs[h.refName]=f,s.push(f)});try{yield vt(c,t,s,!0),i.setHeightBasedOnScrollHeight&&i.setHeightBasedOnScrollHeight(),o(c)}catch(h){r(h)}})))}))}),vt=(e,t,s,n=!1)=>g(void 0,null,function*(){e.refs||(e.refs={});const i=Object.values(e.componentDefinition.refs).map(o=>new Promise((r,c)=>g(void 0,null,function*(){var l;if(o.behavior.type==Le.component){if(n){r();return}let d=o.behavior.componentId;d||(d=o.behavior.instance.componentId);const u=(l=t.instance.resolvedNestedComponents)==null?void 0:l.find(m=>m.type.id===d);if(!u)throw new Error("componentConfig provided without nestedComponentConfig check the config object");const h=ce.create("",o,e);try{const m=yield gt(h,u,s);e.refs[o.name]=m,r()}catch(m){c(m)}}else try{const d=ce.create("",o,e);e.refs[o.name]=xs(d,e),r()}catch{}})));try{yield Promise.all(i)}catch(o){throw o}}),wt=class extends ye{constructor(e,t,s,n,i){super(e,s,i),this.componentConfig=e,this.container=s,this.IframeElement=n,a(this,"sizeMeta"),a(this,"cleanupInspect"),a(this,"setHeightBasedOnDocumentElement",()=>{const o=this.send(new $(()=>window.document.documentElement.scrollHeight,r=>{this.IframeElement.style.height=`${r.content}px`,o()}))}),a(this,"observeSizeBasedOnDocumentElement",()=>this.send(new $(({send:r})=>{const{height:c,width:l}=document.documentElement.getBoundingClientRect(),d=new ResizeObserver(()=>{const{height:u,width:h}=document.documentElement.getBoundingClientRect();r({height:u,width:h})});return d.observe(document.documentElement),d.observe(document.body),{height:c,width:l}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`}))),a(this,"observeAutoSize",o=>{var r,c,l,d,u,h,m;const f=this.IframeElement,y=f.contentDocument;if(!y)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};const D=(v,M,k)=>M!==void 0&&v<M?M:k!==void 0&&v>k?k:v,H=v=>{if(v===void 0)return;if(typeof v=="number")return v;const M=parseFloat(v);return isNaN(M)?void 0:M},T=H(o==null?void 0:o.minWidth),x=H(o==null?void 0:o.maxWidth),B=H(o==null?void 0:o.minHeight),O=H(o==null?void 0:o.maxHeight),te=(r=o==null?void 0:o.loaderMinHeight)!=null?r:50,Ee=((c=this.sizeMeta)==null?void 0:c.width)==="100%"?"100%":void 0,Ce=((l=this.sizeMeta)==null?void 0:l.height)==="100%"?"100%":void 0,pe=(u=(d=o==null?void 0:o.explicitWidth)!=null?d:Ee)!=null?u:"100%",Q=(h=o==null?void 0:o.explicitHeight)!=null?h:Ce,se=pe!==void 0,me=Q!==void 0,ne=this.container.getBoundingClientRect(),Se=ne.width===0,Ie=ne.height===0||ne.height===te,U=(o!=null&&o.forceAutoSize||Se)&&!se,j=(o!=null&&o.forceAutoSize||Ie)&&!me;if(!U&&!j){const v=typeof pe=="number"?pe:void 0,M=typeof Q=="number"?Q:void 0;return(v!==void 0||M!==void 0)&&((m=o==null?void 0:o.onSizeChange)==null||m.call(o,{width:v,height:M,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}const ie=()=>{var v;const M=f.contentDocument;if(M){j&&(f.style.height="0px"),U&&(f.style.width="0px");const k=Math.ceil(M.documentElement.scrollWidth),G=Math.ceil(M.documentElement.scrollHeight),Y=D(k,T,x),R=D(G,B,O);U&&(f.style.width=`${Y}px`),j&&(f.style.height=`${R}px`);const X=U&&x!==void 0&&k>x,N=j&&O!==void 0&&G>O;M.documentElement.style.overflowX=X?"auto":"",M.documentElement.style.overflowY=N?"auto":"",(v=o==null?void 0:o.onSizeChange)==null||v.call(o,{width:Y,height:R,autoSizingWidth:U,autoSizingHeight:j})}};ie();const E=new ResizeObserver(ie);E.observe(y.body),E.observe(y.documentElement);const V=new MutationObserver(ie);return V.observe(y.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{E.disconnect(),V.disconnect()}}),a(this,"setSizeBasedOnDocumentElement",()=>{const o=this.send(new $(()=>{const{height:r,width:c}=document.documentElement.getBoundingClientRect();return{height:r,width:c}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`,o()}))}),a(this,"setHeightBasedOnScrollHeight",()=>{const o=this.send(new $(()=>{let c=0;return c++,c--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+c+"px"},r=>{this.IframeElement.style.height=r.content,o()}))}),a(this,"send",o=>{var r,c;let l=S({},o);if(l.messageType===_.ExecuteComponentMethod)return this[l.method](),()=>{};l.direction=L.down;const d=super.send(l);return(c=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||c.postMessage(l,"*"),d}),a(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)}),t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Ae(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===_.In.MutationObserverMessage||e.messageType===_.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}},Fe=class{constructor(){a(this,"appendChild",(e,t,s)=>{var n;if(s!=null&&s.relative){if(s.relative.direction==="before")return e.insertBefore(t,s.relative.child);if(s.relative.direction==="after"){const i=(n=s.relative.child)==null?void 0:n.nextSibling;return e.insertBefore(t,i||null)}}else return e.appendChild(t)})}},Hs=(e,t,s)=>{const n=new URL(e);return n.searchParams.append(t,s),n.toString()},Rs=class extends Fe{constructor(){super(...arguments),a(this,"type",le.IframeLoader),a(this,"load",(e,t,s,n)=>g(this,null,function*(){let i;const o=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",o.url,s),i=s,i.src=o.url;else{const r=J(),c=`myop-comp-${r}`;i=document.createElement("iframe"),i.id=c;const l=`
66
+ Check the documentation for valid behavior options.`);return!1}};return e.props={},e.props=new Proxy(e.props,i),e},xs=(e,t)=>new Proxy(e,{get(s,n){return s[n]?s[n]:(...o)=>new Promise(r=>{o.forEach(c=>{mt(c)||Ss.notSerializableRefCall(n,c)}),t.send(new Re(({ref:c,propName:l,functionArgs:d,makeSerializable:u})=>{if(c){const h=c[l];return u(typeof h=="function"?c[l](...d):h,!0)}return null},{elementId:s.refConfig.selector,propName:n,functionArgs:o},c=>{r(c.content)}))})},set(s,n,i){return t.send(new Re(({ref:o,propName:r,propValue:c})=>{o&&(o[r]=c)},{elementId:s.refConfig.selector,propValue:i,propName:n},o=>{})),!0}}),vt=(e,t,s,n)=>g(void 0,null,function*(){const i=e.component;if(!i)throw new Error("cant createRefComponent with detached ref");return new Promise((o,r)=>g(void 0,null,function*(){const c=new ft(t.type,i,n);s.push(c),yield i.initiated();const l=setTimeout(()=>{r("timeout")},5e3);i.send(new it(e.refConfig,t,ae(S({},n||{}),{id:c.id,_hasParent:!0}),d=>g(void 0,null,function*(){if(clearTimeout(l),d.failed){r("CreateRefComponentMessage failed");return}const u=s.find(h=>h.id==c.id);if(u!==c){i.refs[e.refConfig.name]=u,o(u);return}else c.setInitiated(),i.refs[e.refConfig.name]=c;d.nestedRefs.forEach(h=>{const m=t.instance.resolvedNestedComponents.find(y=>y.type.id===h.componentDefinitionId).type,f=new ft(m,c);f.setInitiated(),c.refs[h.refName]=f,s.push(f)});try{yield wt(c,t,s,!0),i.setHeightBasedOnScrollHeight&&i.setHeightBasedOnScrollHeight(),o(c)}catch(h){r(h)}})))}))}),wt=(e,t,s,n=!1)=>g(void 0,null,function*(){e.refs||(e.refs={});const i=Object.values(e.componentDefinition.refs).map(o=>new Promise((r,c)=>g(void 0,null,function*(){var l;if(o.behavior.type==Le.component){if(n){r();return}let d=o.behavior.componentId;d||(d=o.behavior.instance.componentId);const u=(l=t.instance.resolvedNestedComponents)==null?void 0:l.find(m=>m.type.id===d);if(!u)throw new Error("componentConfig provided without nestedComponentConfig check the config object");const h=ce.create("",o,e);try{const m=yield vt(h,u,s);e.refs[o.name]=m,r()}catch(m){c(m)}}else try{const d=ce.create("",o,e);e.refs[o.name]=xs(d,e),r()}catch{}})));try{yield Promise.all(i)}catch(o){throw o}}),_t=class extends ye{constructor(e,t,s,n,i){super(e,s,i),this.componentConfig=e,this.container=s,this.IframeElement=n,a(this,"sizeMeta"),a(this,"cleanupInspect"),a(this,"setHeightBasedOnDocumentElement",()=>{const o=this.send(new z(()=>window.document.documentElement.scrollHeight,r=>{this.IframeElement.style.height=`${r.content}px`,o()}))}),a(this,"observeSizeBasedOnDocumentElement",()=>this.send(new z(({send:r})=>{const{height:c,width:l}=document.documentElement.getBoundingClientRect(),d=new ResizeObserver(()=>{const{height:u,width:h}=document.documentElement.getBoundingClientRect();r({height:u,width:h})});return d.observe(document.documentElement),d.observe(document.body),{height:c,width:l}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`}))),a(this,"observeAutoSize",o=>{var r,c,l,d,u,h,m;const f=this.IframeElement,y=f.contentDocument;if(!y)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};const D=(v,M,k)=>M!==void 0&&v<M?M:k!==void 0&&v>k?k:v,H=v=>{if(v===void 0)return;if(typeof v=="number")return v;const M=parseFloat(v);return isNaN(M)?void 0:M},I=H(o==null?void 0:o.minWidth),x=H(o==null?void 0:o.maxWidth),N=H(o==null?void 0:o.minHeight),O=H(o==null?void 0:o.maxHeight),te=(r=o==null?void 0:o.loaderMinHeight)!=null?r:50,Ee=((c=this.sizeMeta)==null?void 0:c.width)==="100%"?"100%":void 0,Ce=((l=this.sizeMeta)==null?void 0:l.height)==="100%"?"100%":void 0,pe=(u=(d=o==null?void 0:o.explicitWidth)!=null?d:Ee)!=null?u:"100%",J=(h=o==null?void 0:o.explicitHeight)!=null?h:Ce,se=pe!==void 0,me=J!==void 0,ne=this.container.getBoundingClientRect(),Se=ne.width===0,Te=ne.height===0||ne.height===te,U=(o!=null&&o.forceAutoSize||Se)&&!se,j=(o!=null&&o.forceAutoSize||Te)&&!me;if(!U&&!j){const v=typeof pe=="number"?pe:void 0,M=typeof J=="number"?J:void 0;return(v!==void 0||M!==void 0)&&((m=o==null?void 0:o.onSizeChange)==null||m.call(o,{width:v,height:M,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}const ie=()=>{var v;const M=f.contentDocument;if(M){j&&(f.style.height="0px"),U&&(f.style.width="0px");const k=Math.ceil(M.documentElement.scrollWidth),G=Math.ceil(M.documentElement.scrollHeight),Y=D(k,I,x),R=D(G,N,O);U&&(f.style.width=`${Y}px`),j&&(f.style.height=`${R}px`);const X=U&&x!==void 0&&k>x,$=j&&O!==void 0&&G>O;M.documentElement.style.overflowX=X?"auto":"",M.documentElement.style.overflowY=$?"auto":"",(v=o==null?void 0:o.onSizeChange)==null||v.call(o,{width:Y,height:R,autoSizingWidth:U,autoSizingHeight:j})}};ie();const E=new ResizeObserver(ie);E.observe(y.body),E.observe(y.documentElement);const V=new MutationObserver(ie);return V.observe(y.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{E.disconnect(),V.disconnect()}}),a(this,"setSizeBasedOnDocumentElement",()=>{const o=this.send(new z(()=>{const{height:r,width:c}=document.documentElement.getBoundingClientRect();return{height:r,width:c}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`,o()}))}),a(this,"setHeightBasedOnScrollHeight",()=>{const o=this.send(new z(()=>{let c=0;return c++,c--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+c+"px"},r=>{this.IframeElement.style.height=r.content,o()}))}),a(this,"send",o=>{var r,c;let l=S({},o);if(l.messageType===_.ExecuteComponentMethod)return this[l.method](),()=>{};l.direction=L.down;const d=super.send(l);return(c=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||c.postMessage(l,"*"),d}),a(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)}),t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Ae(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===_.In.MutationObserverMessage||e.messageType===_.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}},Fe=class{constructor(){a(this,"appendChild",(e,t,s)=>{var n;if(s!=null&&s.relative){if(s.relative.direction==="before")return e.insertBefore(t,s.relative.child);if(s.relative.direction==="after"){const i=(n=s.relative.child)==null?void 0:n.nextSibling;return e.insertBefore(t,i||null)}}else return e.appendChild(t)})}},Hs=(e,t,s)=>{const n=new URL(e);return n.searchParams.append(t,s),n.toString()},Rs=class extends Fe{constructor(){super(...arguments),a(this,"type",le.IframeLoader),a(this,"load",(e,t,s,n)=>g(this,null,function*(){let i;const o=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",o.url,s),i=s,i.src=o.url;else{const r=Q(),c=`myop-comp-${r}`;i=document.createElement("iframe"),i.id=c;const l=`
67
67
  padding: 0;
68
68
  margin: 0;
69
69
  position: absolute;
@@ -74,7 +74,7 @@ Check the documentation for valid behavior options.`);return!1}};return e.props=
74
74
  border: none;
75
75
  opacity: ${n!=null&&n.hidden?"0":"1"};
76
76
  pointer-events: ${n!=null&&n.hidden?"none":"all"};
77
- `;i.style.cssText=l,n!=null&&n.elementAttributes&&Object.entries(n.elementAttributes).forEach(([u,h])=>{h===""||h===null||h===void 0?i.setAttribute(u,""):i.setAttribute(u,String(h))});let d=t.loader.url;n!=null&&n._hasParent&&(d=Hs(d,"_myop-comp",r)),i.src=d,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),i=this.appendChild(s,i,n)}return new wt(e,t,s,i,n)}))}},_t={webcomponent_message_key:"myop_webcomponent_message"},Mt=class extends ye{constructor(e,t,s,n,i){super(e,s,i),this.container=s,this.customElement=n,a(this,"cleanupInspect",()=>{}),a(this,"send",o=>{let r=S({},o);const c=super.send(r),l=new CustomEvent(_t.webcomponent_message_key,{detail:r});try{this.customElement.dispatchEvent(l)}catch(d){console.log("error while trying to dispatchEvent",d)}return c}),a(this,"dispose",()=>{var o;super.dispose(),(o=this.customElement.parentNode)==null||o.removeChild(this.customElement)}),this.element=n}inspect(){return this.cleanupInspect=Ae(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}},Be={},Ds=class extends Fe{constructor(){super(...arguments),a(this,"type",le.WebComponentLoader),a(this,"load",(e,t,s,n)=>g(this,null,function*(){const i=t.loader;Be[i.url]?console.log("Module alreday loaded or in loading process"):Be[i.url]=new Promise((c,l)=>{const d=i.url,u=document.createElement("script");u.type="module",u.src=d,u.onload=()=>{c()},u.onerror=()=>{l()},document.head.appendChild(u)}),yield Be[i.url],yield es(1);let o=`myop-comp-${J()}`;const r=document.createElement(i.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),r.id=o,n!=null&&n.hidden&&(r.style.opacity="0",r.style.position="absolute",r.style.height="0",r.style.width="0",r.style.pointerEvents="none",r.style.visibility="hidden"),n!=null&&n._environment&&(r._myopEnvironment=n==null?void 0:n._environment),this.appendChild(s,r,n),new Mt(e,t,s,r,n)}))}},ks="0.3.18",F=class extends _s{constructor(e,t){super(e),this.context=t,a(this,"executor",s=>{if(s.destination){const n=s.destination;if(this.context[n].context){const i=(o,r)=>{this.messageToHost(ae(S({},o),{source:s.destination?s.destination:s.source,destination:s.source?s.source:s.destination}),r)};return this.innerExecutor(s,this.context[n].context,i)}else debugger}else debugger})}},he={id:"myop-id"},ee=(e,t)=>t.querySelectorAll(`[${he.id}='${e.refConfig.selector}']`),Ls=class extends F{constructor(){super(...arguments),a(this,"messageType",_.BindClickMessage),a(this,"innerExecutor",(e,t,s)=>{const n=ee(e.ref,t.shadowRoot),i=[];return n.forEach(o=>{const r=()=>{s(new je(e.handlerUniqueId))};o.addEventListener("click",r),i.push(()=>{o.removeEventListener("click",r)})}),()=>{i.forEach(o=>o())}})}},Os=class extends F{constructor(){super(...arguments),a(this,"messageType",_.ChangeTextMessage),a(this,"innerExecutor",(e,t)=>{ee(e.ref,t.shadowRoot).forEach(n=>{n.textContent=e.content})})}},Ps=class extends Es{constructor(e,t){super(e,t),this.container=e,this.shadowRoot=t}},As=class extends F{constructor(){super(...arguments),a(this,"innerExecutor",(e,t)=>{const s=t.shadowRoot.querySelectorAll(`[${he.id}]`);let n=[];s.forEach(i=>{const o=i.getAttribute(he.id);o&&n.push(new gs(o,i.tagName,i.getBoundingClientRect(),i.offsetTop,i.offsetLeft))}),this.messageToHost(new rt(e.handlerUniqueId,n))}),a(this,"messageType",_.DetectMyopRefsMessage)}},Fs=class extends F{constructor(){super(...arguments),a(this,"messageType",_.SetAttributeMessage),a(this,"innerExecutor",(e,t)=>{ee(e.ref,t.shadowRoot).forEach(n=>{n.setAttribute(e.name,e.value)})})}},Bs=class extends F{constructor(){super(...arguments),a(this,"messageType",_.AddEventListenerMessage),a(this,"innerExecutor",(e,t,s)=>{const n=ee(e.ref,t.shadowRoot),i=[];return n.forEach(o=>{const r=c=>{s(new Qe(e.handlerUniqueId,Z(c,e.serializableSkeleton)))};o.addEventListener(e.type,r),i.push(()=>{o.removeEventListener(e.type,r)})}),()=>{i.forEach(o=>o())}})}},Ns=class extends F{constructor(){super(...arguments),a(this,"messageType",_.CreateRefComponentMessage),a(this,"innerExecutor",(e,t,s)=>{g(this,null,function*(){const i=t.shadowRoot.querySelectorAll(`[${he.id}='${e.refConfig.selector}']`);if(i.length===1){const o=_e.Instance(),r=o.components.find(u=>u.id===e.options.id);r&&r.dispose();const c=o.components.indexOf(r);c!==-1&&o.components.splice(c,1);const l=yield o.loadComponent(e.nestedComponentConfig,i.item(0),e.options),d=[];Object.keys(l.refs).forEach(u=>{let h=l.refs[u];h=h.__nonProxied||h,h.componentDefinition&&d.push({refName:u,componentDefinitionId:h.componentDefinition.id})}),s(new ke(e.handlerUniqueId,d))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new ke(e.handlerUniqueId,[],!0));debugger}}).then()})}},$s=(e,t,s)=>{const n=e.scriptInputs?e.scriptInputs:{};n.makeSerializable=Z,n.send=t,n.rootRef=s,n.__scriptInputs=n;const o=new Function(`return (${e.script})(...arguments)`)(n);t(o)},zs=class extends F{constructor(){super(...arguments),a(this,"messageType",_.ExecuteScriptMessage),a(this,"innerExecutor",(e,t,s)=>{$s(e,i=>{s(new Ye(e.handlerUniqueId,i))},t)})}},bt=e=>{if(!e)return null;if(e.tagName==="FORM"){new FormData(e);const t={formData:{},unmappedData:[]};return e.querySelectorAll("input, select, textarea").forEach(n=>{if(typeof n.value=="string"){const i=n.getAttribute(he.id);let o=n.getAttribute("name");const r={id:n.id,name:o,value:bt(n),required:n.required,validity:Z(n.validity,!0),myopId:i};o?t.formData[o]?t.formData[o].value?t.unmappedData.push(r):(t.unmappedData.push(t.formData[o]),t.formData[o]=r):t.formData[o]=r:t.unmappedData.push(r)}}),t}return e.type==="checkbox"||e.type==="radio"?e.checked?e.value:null:e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?e.value:e.isContentEditable?e.innerText||e.textContent:null},Ws=class extends F{constructor(){super(...arguments),a(this,"messageType",_.GetElementValueMessage),a(this,"innerExecutor",(e,t,s)=>{ee(e.ref,t.shadowRoot).forEach(i=>{s(new Ze(bt(i)),e)})})}},Ks=class extends F{constructor(){super(...arguments),a(this,"messageType",_.SetInnerHtml),a(this,"innerExecutor",(e,t)=>{ee(e.ref,t.shadowRoot).forEach(n=>{n.innerHTML=e.content})})}},Et=class extends bs{constructor(){super(...arguments),a(this,"alwaysPassEnvelopesToHost",!0),a(this,"connectedCallback",(e,t)=>{e.addEventListener(_t.webcomponent_message_key,s=>{const n=s.data?s.data:s.detail;if(!n||!n.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{const i=n;if(this.handleIncomeMessages(s),i.messageType===_.InitMessage){const o=i.content.id;this.components[o].context=new Ps(e,t)}}}),setTimeout(()=>{this.messageToHost(new tt)},1)}),a(this,"messageToHost",(e,t)=>{e.direction=L.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)}),a(this,"supportedHandlers",[new Os(this.messageToHost,this.components),new Ks(this.messageToHost,this.components),new Ls(this.messageToHost,this.components),new As(this.messageToHost,this.components),new Fs(this.messageToHost,this.components),new Bs(this.messageToHost,this.components),new zs(this.messageToHost,this.components),new Ws(this.messageToHost,this.components),new Ns(this.messageToHost,this.components)]),a(this,"init",()=>{})}};Ke("WebComponentSDK",Et);var qs="<!-- myop-web-component -->",Us="myop-web-component",Ct=new Set,St=[],ve,It=()=>g(void 0,null,function*(){return ve||(ve=new Et,ve.init()),ve});function js(e,t){return class extends HTMLElement{connectedCallback(){const s=t===de.open?"open":"closed",n=this.attachShadow({mode:s});It().then(i=>{i.connectedCallback(this,n),n.innerHTML=e})}}}var Vs=(e,t,s)=>{customElements.define(e,js(t,s)),console.log(`define('${e}') was called, web component ready to use`)},Gs=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)/g,"-$1").toLowerCase(),Ys=e=>(e=Gs(e),e.replace(/_/g,"-")),Js=class extends Fe{constructor(){super(...arguments),a(this,"type",le.HTMLLoader),a(this,"load",(e,t,s,n)=>g(this,null,function*(){const i=t.loader;if(this.isMyopWebComponent(i.HTML))return this.loadExtractedWebComponent(e,t,s,i.HTML,n);let o=`myop-comp-${J()}`,r;if(i.shadowRootMode===de.localFrame){const l=`myop-comp-${J()}`;let d=document.createElement("iframe");d.id=l,d.style.cssText=`
77
+ `;i.style.cssText=l,n!=null&&n.elementAttributes&&Object.entries(n.elementAttributes).forEach(([u,h])=>{h===""||h===null||h===void 0?i.setAttribute(u,""):i.setAttribute(u,String(h))});let d=t.loader.url;n!=null&&n._hasParent&&(d=Hs(d,"_myop-comp",r)),i.src=d,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),i=this.appendChild(s,i,n)}return new _t(e,t,s,i,n)}))}},Mt={webcomponent_message_key:"myop_webcomponent_message"},bt=class extends ye{constructor(e,t,s,n,i){super(e,s,i),this.container=s,this.customElement=n,a(this,"cleanupInspect",()=>{}),a(this,"send",o=>{let r=S({},o);const c=super.send(r),l=new CustomEvent(Mt.webcomponent_message_key,{detail:r});try{this.customElement.dispatchEvent(l)}catch(d){console.log("error while trying to dispatchEvent",d)}return c}),a(this,"dispose",()=>{var o;super.dispose(),(o=this.customElement.parentNode)==null||o.removeChild(this.customElement)}),this.element=n}inspect(){return this.cleanupInspect=Ae(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}},Be={},Ds=class extends Fe{constructor(){super(...arguments),a(this,"type",le.WebComponentLoader),a(this,"load",(e,t,s,n)=>g(this,null,function*(){const i=t.loader;Be[i.url]?console.log("Module alreday loaded or in loading process"):Be[i.url]=new Promise((c,l)=>{const d=i.url,u=document.createElement("script");u.type="module",u.src=d,u.onload=()=>{c()},u.onerror=()=>{l()},document.head.appendChild(u)}),yield Be[i.url],yield es(1);let o=`myop-comp-${Q()}`;const r=document.createElement(i.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),r.id=o,n!=null&&n.hidden&&(r.style.opacity="0",r.style.position="absolute",r.style.height="0",r.style.width="0",r.style.pointerEvents="none",r.style.visibility="hidden"),n!=null&&n._environment&&(r._myopEnvironment=n==null?void 0:n._environment),this.appendChild(s,r,n),new bt(e,t,s,r,n)}))}},ks="0.3.19",F=class extends _s{constructor(e,t){super(e),this.context=t,a(this,"executor",s=>{if(s.destination){const n=s.destination;if(this.context[n].context){const i=(o,r)=>{this.messageToHost(ae(S({},o),{source:s.destination?s.destination:s.source,destination:s.source?s.source:s.destination}),r)};return this.innerExecutor(s,this.context[n].context,i)}else debugger}else debugger})}},he={id:"myop-id"},ee=(e,t)=>t.querySelectorAll(`[${he.id}='${e.refConfig.selector}']`),Ls=class extends F{constructor(){super(...arguments),a(this,"messageType",_.BindClickMessage),a(this,"innerExecutor",(e,t,s)=>{const n=ee(e.ref,t.shadowRoot),i=[];return n.forEach(o=>{const r=()=>{s(new Ve(e.handlerUniqueId))};o.addEventListener("click",r),i.push(()=>{o.removeEventListener("click",r)})}),()=>{i.forEach(o=>o())}})}},Os=class extends F{constructor(){super(...arguments),a(this,"messageType",_.ChangeTextMessage),a(this,"innerExecutor",(e,t)=>{ee(e.ref,t.shadowRoot).forEach(n=>{n.textContent=e.content})})}},Ps=class extends Es{constructor(e,t){super(e,t),this.container=e,this.shadowRoot=t}},As=class extends F{constructor(){super(...arguments),a(this,"innerExecutor",(e,t)=>{const s=t.shadowRoot.querySelectorAll(`[${he.id}]`);let n=[];s.forEach(i=>{const o=i.getAttribute(he.id);o&&n.push(new gs(o,i.tagName,i.getBoundingClientRect(),i.offsetTop,i.offsetLeft))}),this.messageToHost(new at(e.handlerUniqueId,n))}),a(this,"messageType",_.DetectMyopRefsMessage)}},Fs=class extends F{constructor(){super(...arguments),a(this,"messageType",_.SetAttributeMessage),a(this,"innerExecutor",(e,t)=>{ee(e.ref,t.shadowRoot).forEach(n=>{n.setAttribute(e.name,e.value)})})}},Bs=class extends F{constructor(){super(...arguments),a(this,"messageType",_.AddEventListenerMessage),a(this,"innerExecutor",(e,t,s)=>{const n=ee(e.ref,t.shadowRoot),i=[];return n.forEach(o=>{const r=c=>{s(new Xe(e.handlerUniqueId,Z(c,e.serializableSkeleton)))};o.addEventListener(e.type,r),i.push(()=>{o.removeEventListener(e.type,r)})}),()=>{i.forEach(o=>o())}})}},Ns=class extends F{constructor(){super(...arguments),a(this,"messageType",_.CreateRefComponentMessage),a(this,"innerExecutor",(e,t,s)=>{g(this,null,function*(){const i=t.shadowRoot.querySelectorAll(`[${he.id}='${e.refConfig.selector}']`);if(i.length===1){const o=_e.Instance(),r=o.components.find(u=>u.id===e.options.id);r&&r.dispose();const c=o.components.indexOf(r);c!==-1&&o.components.splice(c,1);const l=yield o.loadComponent(e.nestedComponentConfig,i.item(0),e.options),d=[];Object.keys(l.refs).forEach(u=>{let h=l.refs[u];h=h.__nonProxied||h,h.componentDefinition&&d.push({refName:u,componentDefinitionId:h.componentDefinition.id})}),s(new ke(e.handlerUniqueId,d))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new ke(e.handlerUniqueId,[],!0));debugger}}).then()})}},$s=(e,t,s)=>{const n=e.scriptInputs?e.scriptInputs:{};n.makeSerializable=Z,n.send=t,n.rootRef=s,n.__scriptInputs=n;const o=new Function(`return (${e.script})(...arguments)`)(n);t(o)},zs=class extends F{constructor(){super(...arguments),a(this,"messageType",_.ExecuteScriptMessage),a(this,"innerExecutor",(e,t,s)=>{$s(e,i=>{s(new Qe(e.handlerUniqueId,i))},t)})}},Et=e=>{if(!e)return null;if(e.tagName==="FORM"){new FormData(e);const t={formData:{},unmappedData:[]};return e.querySelectorAll("input, select, textarea").forEach(n=>{if(typeof n.value=="string"){const i=n.getAttribute(he.id);let o=n.getAttribute("name");const r={id:n.id,name:o,value:Et(n),required:n.required,validity:Z(n.validity,!0),myopId:i};o?t.formData[o]?t.formData[o].value?t.unmappedData.push(r):(t.unmappedData.push(t.formData[o]),t.formData[o]=r):t.formData[o]=r:t.unmappedData.push(r)}}),t}return e.type==="checkbox"||e.type==="radio"?e.checked?e.value:null:e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?e.value:e.isContentEditable?e.innerText||e.textContent:null},Ws=class extends F{constructor(){super(...arguments),a(this,"messageType",_.GetElementValueMessage),a(this,"innerExecutor",(e,t,s)=>{ee(e.ref,t.shadowRoot).forEach(i=>{s(new et(Et(i)),e)})})}},Ks=class extends F{constructor(){super(...arguments),a(this,"messageType",_.SetInnerHtml),a(this,"innerExecutor",(e,t)=>{ee(e.ref,t.shadowRoot).forEach(n=>{n.innerHTML=e.content})})}},Ct=class extends bs{constructor(){super(...arguments),a(this,"alwaysPassEnvelopesToHost",!0),a(this,"connectedCallback",(e,t)=>{e.addEventListener(Mt.webcomponent_message_key,s=>{const n=s.data?s.data:s.detail;if(!n||!n.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{const i=n;if(this.handleIncomeMessages(s),i.messageType===_.InitMessage){const o=i.content.id;this.components[o].context=new Ps(e,t)}}}),setTimeout(()=>{this.messageToHost(new st)},1)}),a(this,"messageToHost",(e,t)=>{e.direction=L.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)}),a(this,"supportedHandlers",[new Os(this.messageToHost,this.components),new Ks(this.messageToHost,this.components),new Ls(this.messageToHost,this.components),new As(this.messageToHost,this.components),new Fs(this.messageToHost,this.components),new Bs(this.messageToHost,this.components),new zs(this.messageToHost,this.components),new Ws(this.messageToHost,this.components),new Ns(this.messageToHost,this.components)]),a(this,"init",()=>{})}};qe("WebComponentSDK",Ct);var qs="<!-- myop-web-component -->",Us="myop-web-component",St=new Set,Tt=[],ve,It=()=>g(void 0,null,function*(){return ve||(ve=new Ct,ve.init()),ve});function js(e,t){return class extends HTMLElement{connectedCallback(){const s=t===de.open?"open":"closed",n=this.attachShadow({mode:s});It().then(i=>{i.connectedCallback(this,n),n.innerHTML=e})}}}var Vs=(e,t,s)=>{customElements.define(e,js(t,s)),console.log(`define('${e}') was called, web component ready to use`)},Gs=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)/g,"-$1").toLowerCase(),Ys=e=>(e=Gs(e),e.replace(/_/g,"-")),Qs=class extends Fe{constructor(){super(...arguments),a(this,"type",le.HTMLLoader),a(this,"load",(e,t,s,n)=>g(this,null,function*(){const i=t.loader;if(this.isMyopWebComponent(i.HTML))return this.loadExtractedWebComponent(e,t,s,i.HTML,n);let o=`myop-comp-${Q()}`,r;if(i.shadowRootMode===de.localFrame){const l=`myop-comp-${Q()}`;let d=document.createElement("iframe");d.id=l,d.style.cssText=`
78
78
  display: block;
79
79
  padding: 0;
80
80
  margin: 0;
@@ -86,12 +86,12 @@ Check the documentation for valid behavior options.`);return!1}};return e.props=
86
86
  width: 100%;
87
87
  height: 100%;
88
88
  pointer-events: ${n!=null&&n.hidden?"none":"all"};
89
- `,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d=this.appendChild(s,d,n);const u=d.contentDocument||d.contentWindow.document;u.open();let h=null;{const x=new DOMParser().parseFromString(i.HTML,"text/html").querySelector('meta[name="myop:size"]');if(x)try{h=JSON.parse(x.getAttribute("content")||"{}")}catch{}}let m=i.HTML;if(n!=null&&n._inspection){const T=new DOMParser().parseFromString(i.HTML,"text/html"),x=T.getElementById("myop_preview");x==null||x.removeAttribute("type");const B=T.implementation.createHTMLDocument();B.body.innerHTML=`<script>
89
+ `,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d=this.appendChild(s,d,n);const u=d.contentDocument||d.contentWindow.document;u.open();let h=null;{const x=new DOMParser().parseFromString(i.HTML,"text/html").querySelector('meta[name="myop:size"]');if(x)try{h=JSON.parse(x.getAttribute("content")||"{}")}catch{}}let m=i.HTML;if(n!=null&&n._inspection){const I=new DOMParser().parseFromString(i.HTML,"text/html"),x=I.getElementById("myop_preview");x==null||x.removeAttribute("type");const N=I.implementation.createHTMLDocument();N.body.innerHTML=`<script>
90
90
  const beforeKeysWindow = new Set(Object.keys(window));
91
91
  window.myopState = {
92
92
  beforeKeysWindow,
93
93
  };
94
- <\/script>`;const O=B.body.firstChild;O&&T.head&&T.head.insertBefore(T.importNode(O,!0),T.head.firstChild),m=T.documentElement.outerHTML}else if((n==null?void 0:n.data)!==void 0){const T=new DOMParser().parseFromString(i.HTML,"text/html"),x=T.getElementById("myop_preview");x&&(x.remove(),m=T.documentElement.outerHTML)}u.writeln(m);const f=`<script>${jt}<\/script>`;if(u.writeln(`${f}<script>
94
+ <\/script>`;const O=N.body.firstChild;O&&I.head&&I.head.insertBefore(I.importNode(O,!0),I.head.firstChild),m=I.documentElement.outerHTML}else if((n==null?void 0:n.data)!==void 0){const I=new DOMParser().parseFromString(i.HTML,"text/html"),x=I.getElementById("myop_preview");x&&(x.remove(),m=I.documentElement.outerHTML)}u.writeln(m);const f=`<script>${jt}<\/script>`;if(u.writeln(`${f}<script>
95
95
  const __myop_init = async () => {
96
96
  const iframeModule = await MyopSDK.getIframeModule();
97
97
  const IframeSDK = iframeModule.IframeSDK;
@@ -164,4 +164,4 @@ Check the documentation for valid behavior options.`);return!1}};return e.props=
164
164
  });
165
165
  }
166
166
  })();
167
- <\/script>`;u.writeln(H+x)}u.close();const D=new wt(e,t,s,d,n);return D.sizeMeta=h,i.autoHeight&&(d.onload=()=>{D.observeSizeBasedOnDocumentElement()}),D}if(i.shadowRootMode===de.none){const c=document.createElement("template");c.innerHTML=i.HTML,r=c.content.firstElementChild,It().then(l=>{l.connectedCallback(r,r)})}else{const c=Ys(e.name+t.id);St.includes(c)||(Vs(c,i.HTML,i.shadowRootMode),St.push(c)),r=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),r.id=o,n!=null&&n.hidden&&(r.style.opacity="0",r.style.position="absolute",r.style.height="0",r.style.width="0",r.style.pointerEvents="none",r.style.visibility="hidden"),this.appendChild(s,r,n),new Mt(e,t,s,r,n)}))}isMyopWebComponent(e){return e.trimStart().startsWith(qs)}extractWebComponentScript(e){const n=new DOMParser().parseFromString(e,"text/html").getElementById(Us);return(n==null?void 0:n.textContent)||null}executeWebComponentScript(e,t){if(Ct.has(t)){console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);return}const s=document.createElement("script");s.textContent=e,s.id=`myop-extracted-${t}`,document.head.appendChild(s),Ct.add(t),console.log(`[MyopWebComponent] Executed web component script: ${t}`)}loadExtractedWebComponent(e,t,s,n,i){return g(this,null,function*(){const o=this.extractWebComponentScript(n);if(!o)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');const r=`${e.id}-${t.id}`,c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(o,r);const l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);const d=`myop-comp-${J()}`,u=document.createElement(l);u.id=d,i!=null&&i.hidden&&(u.style.opacity="0",u.style.position="absolute",u.style.height="0",u.style.width="0",u.style.pointerEvents="none",u.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,u,i);const h=new Pe(e,t,s,u,l,i);return(i==null?void 0:i.data)!==void 0&&h.initWithData(i.data),console.log(`[MyopWebComponent] Loaded <${l}> into container`),h})}},Qs=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:ge.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:ge.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),we="__MYOP_CLOUD_REPOSITORY_MAIN__",Xs=()=>{if(typeof window<"u")return window[we];if(typeof globalThis<"u")return globalThis[we]},Zs=e=>{typeof window<"u"&&(window[we]=e),typeof globalThis<"u"&&(globalThis[we]=e)},Tt=class oe{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,a(this,"variants",{}),a(this,"preloadedComponents",{}),a(this,"userFlows",{}),a(this,"_defaultEnv","production")}static get Main(){const t=Xs();return t||(oe._main||(oe._main=new oe,Zs(oe._main)),oe._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,s,n){return s!==void 0||n!==void 0?`${t}:${s||this._defaultEnv}:${n?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,s,n){return g(this,null,function*(){const i=this.preloadedComponents[t],o=s!==void 0||n!==void 0;let r,c;!o&&i?(r=i.env,c=i.preview):(r=s||this._defaultEnv,c=n===!0?!0:n===!1?!1:!s);const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>g(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const y=(yield(yield fetch(h)).json()).item;if(!y){u(new Error(`Component "${t}" not found`));return}if(!y.consume_variant||!y.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const D=Qs(y);d(D)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,s){return g(this,null,function*(){return s?(yield this.fetchFlow(s)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return g(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>g(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return g(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>g(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchComponent(t,s){return g(this,null,function*(){return this.fetchComponentV1(t,s)})}};a(Tt,"_main",null);var xt=Tt,en=e=>g(void 0,null,function*(){try{const t=new URL(window.location.href),n=new URLSearchParams(t.search).get("myopOverride");if(n){const[i,...o]=qe(n);switch(i){case"component":{const[r,c]=o,l=yield xt.Main.fetchComponent(r);if(l&&l.type.skins.find(u=>u.id===c))return l.instance.skinSelector={type:ue.Dedicated,skin:{id:c}},l}break;default:{const[r,c]=qe(n),d=(yield xt.Main.fetchFlow(r)).components.find(u=>u.type.id===e.type.id);if(d&&d.instance.skinSelector.type===ue.Segmented&&d.instance.resolvedExperiences){const u=d.instance.resolvedExperiences.find(h=>h.id===c);if((u==null?void 0:u.type)===ht.Segment){const h=u,f=d.instance.skinSelector.segments.find(y=>y.segmentId===h.segment.id);if(f)return d.instance.skinSelector=f==null?void 0:f.skinSelector,d}}}break}}}finally{return null}}),Ht="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",_e=class{constructor(){a(this,"components2init",[]),a(this,"components",[]),a(this,"componentsLoaders",[]),a(this,"initiated",!1),a(this,"version",ks),a(this,"type2InstanceCount",{}),a(this,"assignId",e=>(this.type2InstanceCount[e.id]||(this.type2InstanceCount[e.id]=0),`${e.id}_${++this.type2InstanceCount[e.id]}`)),a(this,"inspected",!1),a(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(e=>{e.inspect&&e.inspect()}))}),a(this,"incomingMessageHandler",e=>{if(e.origin,document.location.origin,e.data.myop){if(e.data.direction!==L.up&&e.data.messageType!==_.EnvelopedMessage)return;const t=e.data;if(t.messageType===_.InitRequest){this.components2init.forEach(n=>{n.send(new De(n.id))});return}if(t.messageType===_.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==t.content.id);const n=this.components.find(i=>{var o;return i.id===((o=t.content)==null?void 0:o.id)});n==null||n.setInitiated();return}if(t.messageType===_.EnvelopedMessage){const n=t,i=this.components.find(o=>o.id===n.destination);if(i){if(n.direction===L.down){n.message.messageType===z.name?i.onMessageReceived(n.message):(n.message.route=n.route,i.send(n.message));return}}else{const o=this.components.find(r=>r.id===n.message.destination);o&&o.send(n.message)}return}const s=this.components.find(n=>n.id===t.destination);if(!s){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t);return}if(s){if(s.onMessageReceived(t))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t)}}}),a(this,"send",e=>{const t=new MessageEvent("",{data:e});this.incomingMessageHandler(t)}),a(this,"init",e=>{if(this.initiated)throw new Error("hostSDK already initiated");const t=[new Rs,new Ds,new Js];if(this.componentsLoaders=[...t],e){const s={};e.forEach(n=>{const i=new n(this.componentsLoaders);s[i.type]=i}),this.componentsLoaders.forEach(n=>{s[n.type]||(s[n.type]=n)}),this.componentsLoaders=Object.values(s)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0}),a(this,"_getSkinIdBySkinSelector",(e,...t)=>g(this,[e,...t],function*(s,n=[],i){var o;function r(c,l){return g(this,null,function*(){for(const d of c)if(yield l(d))return d})}switch(s.type){case"DedicatedSkin":case ue.Dedicated:return((o=s.skin)==null?void 0:o.id)||s.skins[0].id;case ue.Segmented:{const l=yield r(s.segments,d=>g(this,null,function*(){if(d.segmentId==="Default")return!0;const u=n.find(y=>y.type===ht.Segment?y.segment.id===d.segmentId:!1);if(!u)throw new Error("experience not found");const m=u.segment,f=(i||{})[m.function];return f?yield f():(console.warn(`segmentId:${d.segmentId}, ${m.function} function not provided !`),!1)}));if(l)return this._getSkinIdBySkinSelector(l.skinSelector,n);debugger}break;default:debugger}return""})),a(this,"runSkinSelector",(e,t)=>g(this,null,function*(){const s=yield this._getSkinIdBySkinSelector(e.instance.skinSelector,e.instance.resolvedExperiences,t);return e.type.skins.find(n=>n.id===s)})),a(this,"loaderHooks"),a(this,"loadComponent",(e,t,s)=>g(this,null,function*(){var n,i,o,r;if(!t){debugger;throw new Error("no container was found for this component")}const c=yield en(e);c&&(e=c);const l=S(S({},(n=this.loaderHooks)!=null?n:{}),(i=s==null?void 0:s.hooks)!=null?i:{}),d=t;if(d.myop)if(d.component){e=S({},e),e.instance=S({},e.instance);let f=yield this.runSkinSelector(e,l);if(!f)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(o=s==null?void 0:s.hooks)!=null&&o.afterSkinSelected&&(f=yield s.hooks.afterSkinSelected(S({},f))),e.instance.skinSelector={type:ue.Dedicated,skin:f},s&&(s=S({},s),delete s.hooks),yield gt(d,e,this.components,s)}else throw new Error("load component got a detached ref.");t=t;let u=yield this.runSkinSelector(e,l);if(!u)throw new Error("runSkinSelector failed to choose skin, check the provided config");(r=s==null?void 0:s.hooks)!=null&&r.afterSkinSelected&&(u=yield s.hooks.afterSkinSelected(S({},u)));const h=this.componentsLoaders.find(f=>f.type===u.loader.type);if(!h){debugger;throw new Error(`no loader "${u.loader.type}" was found for component`)}let m=yield h.load(e.type,u,t,s);m.isInitiated||this.components2init.push(m),m.bind("onDispose",()=>(this.components=this.components.filter(f=>f!==m),this.components2init=this.components2init.filter(f=>f!==m),!0)),this.components.push(m),(!s||s.connectProps!==!1)&&(m=Ts(m,e.type.props,u));try{yield vt(m,e,this.components)}catch(f){throw f}return s!=null&&s.skipInit||(yield m.initiated()),m})),a(this,"navigate",(e,t,s)=>g(this,null,function*(){if(e.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(s!=null&&s.staged){let n=yield this.loadComponent(t,e.container,S({hidden:!0,relative:{direction:"after",child:e.element}},s));return s.init&&(yield s.init(n)),n.show(),e.dispose(),n}else{const n=e.element.nextSibling;return e.dispose(),this.loadComponent(t,e.container,S({relative:{direction:"before",child:n}},s))}}))}};if(a(_e,"Instance",()=>window.myop.hostSDK),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ht}),!window.myop.hostSDK){const e=new _e;e.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ht}),window.myop.hostSDK=e}var Ne=window.myop.hostSDK;Ke("hostSDK",Ne);var tn="linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)",sn="linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)",nn={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,background:tn,display:"flex",justifyContent:"center",alignItems:"center"},on={position:"absolute",top:0,left:0,right:0,bottom:0,background:sn,display:"flex",justifyContent:"center",alignItems:"center"},rn={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,display:"flex",justifyContent:"center",alignItems:"center"},an=Object.defineProperty,cn=(e,t,s)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,p=(e,t,s)=>cn(e,typeof t!="symbol"?t+"":t,s),W=(e,t,s)=>new Promise((n,i)=>{var o=l=>{try{c(s.next(l))}catch(d){i(d)}},r=l=>{try{c(s.throw(l))}catch(d){i(d)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,r);c((s=s.apply(e,t)).next())}),K=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),ln=class{constructor(){p(this,"id",K()),p(this,"myop",!0),p(this,"content"),p(this,"source"),p(this,"destination"),p(this,"route"),p(this,"ref"),p(this,"direction"),p(this,"cleanable",!1)}static create(...e){return new this(...e)}isTypeof(e){return e.messageType===this.messageType}},dn=class extends ln{constructor(e){super(),this.handler=e,p(this,"handlerUniqueId",K())}},un="ExecuteScriptReplyMessage",hn=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,pn=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,mn=e=>{let t=e.match(hn);if(t)return t[1]||t[3];{let s=e.match(pn);if(s)return s[1].trim()}},Rt=class extends dn{constructor(e,t=()=>{},s){super(t),this.scriptInputs=s,p(this,"replyMessageKey",un),p(this,"messageType","ExecuteScriptMessage"),p(this,"script",""),this.script=e.toString(),this.content=e.toString(),this.content=mn(this.content)}};p(Rt,"replierKey","send"),p(Rt,"completeStreamKey","completeStream");var Dt=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+K()),p(this,"_runTimeId","runtime-id-"+K()),p(this,"_runTimeName","runtime-name-"+K()),p(this,"id",this._runTimeId),p(this,"name",this._runTimeName),p(this,"description",""),p(this,"loader",null),p(this,"withLoader",t=>(this.loader=t,this)),p(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this)),p(this,"build",()=>this)}};p(Dt,"create",()=>new Dt);var kt=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+K()),p(this,"_runTimeId","runtime-id-"+K()),p(this,"_runTimeName","runtime-name-"+K()),p(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null}),p(this,"name",this._runTimeName),p(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0}),p(this,"withInstance",t=>(this.instance=t,this)),p(this,"withType",t=>(this.type=t,this)),p(this,"withName",t=>(this.name=t,this)),p(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this)),p(this,"withRef",t=>(this.type.refs.push(t),this)),p(this,"withBasicRef",t=>{const s={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(s),this}),p(this,"build",()=>JSON.parse(JSON.stringify(this)))}};p(kt,"create",()=>new kt);var Lt={code:"code"},fn=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Lt.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Lt.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),Me="__MYOP_CLOUD_REPOSITORY_MAIN__",yn=()=>{if(typeof window<"u")return window[Me];if(typeof globalThis<"u")return globalThis[Me]},gn=e=>{typeof window<"u"&&(window[Me]=e),typeof globalThis<"u"&&(globalThis[Me]=e)},Ot=class re{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,p(this,"variants",{}),p(this,"preloadedComponents",{}),p(this,"userFlows",{}),p(this,"_defaultEnv","production")}static get Main(){const t=yn();return t||(re._main||(re._main=new re,gn(re._main)),re._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,s,n){return s!==void 0||n!==void 0?`${t}:${s||this._defaultEnv}:${n?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,s,n){return W(this,null,function*(){const i=this.preloadedComponents[t],o=s!==void 0||n!==void 0;let r,c;!o&&i?(r=i.env,c=i.preview):(r=s||this._defaultEnv,c=n===!0?!0:n===!1?!1:!s);const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>W(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const y=(yield(yield fetch(h)).json()).item;if(!y){u(new Error(`Component "${t}" not found`));return}if(!y.consume_variant||!y.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const D=fn(y);d(D)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,s){return W(this,null,function*(){return s?(yield this.fetchFlow(s)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return W(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>W(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return W(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>W(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchComponent(t,s){return W(this,null,function*(){return this.fetchComponentV1(t,s)})}};p(Ot,"_main",null);var be=Ot;const vn=e=>{const t=w.useRef(null),s=w.useRef(null),n=w.useRef(!1),i=w.useRef(null);return w.useEffect(()=>{let o=!1;n.current=!(t!=null&&t.current);const r=async c=>{n.current=!0;try{const l=await be.Main.fetchComponent(c.componentId,c.flowId);s.current=await Ne.loadComponent(l,t.current,{_environment:{props:{...c}}}),o?s.current&&s.current.dispose():c.onReady&&c.onReady(s.current)}catch{}finally{if(n.current=!1,i.current!==null&&!o){const l=i.current;i.current=null,await r(l)}}};return n.current?i.current={...e}:r(e).then(),()=>{o=!0,s.current&&s.current.dispose()}},[e.flowId,e.componentId]),C.jsx("div",{style:{height:"100%",overflow:"inherit"},ref:t})},Pt=()=>C.jsx("svg",{width:"80",viewBox:"0 0 525 243",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:C.jsx("path",{d:"M151.438 2.7168C177.625 2.76042 248.179 4.2832 300.4 56.7441C350.671 107.245 364.44 114.452 389.967 119.211C392.576 119.436 397.472 119.394 400.802 116.521C403.011 114.614 403.921 109.518 404.265 104.627V5.95996C404.265 4.85556 405.16 3.96023 406.265 3.95996H522.711C523.815 3.95996 524.711 4.85539 524.711 5.95996V122.405C524.711 123.51 523.815 124.405 522.711 124.405H421.998C418.579 124.728 413.852 125.627 410.974 128.095C407.879 130.748 407.042 137.805 406.845 142.661V240.414C406.845 241.436 406.111 242.292 405.093 242.38C366.548 245.717 277.079 228.462 235.837 173.668C202.909 129.919 173.882 122.474 151.458 122.077C150.354 122.058 149.459 121.164 149.459 120.06V4.71582C149.459 3.6114 150.334 2.71519 151.438 2.7168ZM62.2031 0C96.5566 0.000213148 124.405 27.8496 124.405 62.2031C124.405 96.5564 96.5564 124.405 62.2031 124.405C27.8496 124.405 0.000213175 96.5566 0 62.2031C0 27.8495 27.8495 0 62.2031 0Z",fill:"white"})}),At=({opacity:e=1,fadeDuration:t=200,children:s})=>{if(s!==void 0){const i={...rn,opacity:e,transition:`opacity ${t}ms ease-out`};return C.jsx("div",{style:i,children:s})}const n={...nn,opacity:e,transition:`opacity ${t}ms ease-out`};return C.jsx("div",{style:n,children:C.jsx(Pt,{})})},wn={position:"absolute",top:0,left:0,right:0,bottom:0},Ft=({children:e})=>e!==void 0?C.jsx("div",{style:wn,children:e}):C.jsx("div",{style:on,children:C.jsx(Pt,{})}),_n=e=>`on${e.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join("")}`,Bt=e=>{var me,ne,Se,Ie,U,j,ie;const t=w.useRef(null),s=w.useRef(null),n=w.useRef(!1),i=w.useRef(null),o=e.componentId?$t(e.componentId):!1,[r,c]=w.useState(!o),[l,d]=w.useState(1),[u,h]=w.useState(!1),[m,f]=w.useState(!1),[y,D]=w.useState(void 0),H=e.autoSize??!0,[T,x]=w.useState({fillWidth:!1,fillHeight:!1}),B=w.useRef(!1),O=e.fadeDuration??200,te=w.useCallback(()=>{d(0),setTimeout(()=>{c(!1)},O)},[O]),Ee=w.useCallback(E=>{console.error("[MyopComponent] Error:",E),te(),h(!0),e.onError&&e.onError(E)},[te,e.onError]);w.useEffect(()=>{B.current=!1},[e.componentId]),w.useEffect(()=>{if(m&&e.data!==void 0&&s.current){if(!B.current){B.current=!0;return}const E=s.current.props.myop_init_interface;E&&E(e.data)}},[e.data,m]),w.useEffect(()=>{var V,v,M,k,G,Y,R;if(!m||!((V=s.current)!=null&&V.observeAutoSize))return;let E=!0;return s.current.observeAutoSize({explicitWidth:(v=e.style)==null?void 0:v.width,explicitHeight:(M=e.style)==null?void 0:M.height,minWidth:(k=e.style)==null?void 0:k.minWidth,maxWidth:(G=e.style)==null?void 0:G.maxWidth,minHeight:(Y=e.style)==null?void 0:Y.minHeight,maxHeight:(R=e.style)==null?void 0:R.maxHeight,forceAutoSize:H,loaderMinHeight:50,onSizeChange:X=>{e.onSizeChange&&e.onSizeChange(X)===!1||(D(X),E&&(E=!1,te()))}})},[H,m,e.onSizeChange,(me=e.style)==null?void 0:me.width,(ne=e.style)==null?void 0:ne.height,(Se=e.style)==null?void 0:Se.minWidth,(Ie=e.style)==null?void 0:Ie.maxWidth,(U=e.style)==null?void 0:U.minHeight,(j=e.style)==null?void 0:j.maxHeight]),w.useEffect(()=>{let E=!1;n.current=!(t!=null&&t.current);const V=async v=>{var M,k,G,Y;n.current=!0;try{if(!v.componentId&&!v.componentConfig){Ee("No component configuration provided");return}const R=await Nt().fetchComponentV2(v.componentId,v.environment,v.preview),X=await Ne.loadComponent(R,t.current,{data:v.data,_environment:{props:{...v}}});if(E){X.dispose();return}if(s.current=X,await s.current.initiated(),E){s.current&&s.current.dispose();return}if(await new Promise(Te=>requestAnimationFrame(Te)),E||!s.current||s.current.markedForDisposed){s.current&&!s.current.markedForDisposed&&s.current.dispose();return}f(!0);const N=(M=s.current)==null?void 0:M.sizeMeta,zt=(N==null?void 0:N.width)==="100%",Wt=(N==null?void 0:N.height)==="100%";x({fillWidth:zt,fillHeight:Wt});const Tn=(zt||((k=e.style)==null?void 0:k.width))&&(Wt||((G=e.style)==null?void 0:G.height));(!H||Tn)&&te(),(Y=s.current)!=null&&Y.props&&(s.current.props.myop_cta_handler=(Te,Kt)=>{e.on&&e.on(Te,Kt);const xn=_n(Te),qt=e[xn];typeof qt=="function"&&qt(Kt)}),v.onLoad&&s.current&&v.onLoad(s.current)}catch(R){E||Ee((R==null?void 0:R.message)||"Unknown error")}finally{if(n.current=!1,i.current!==null&&!E){const R=i.current;i.current=null,await V(R)}}};return n.current?i.current={...e}:V(e).then(),()=>{E=!0,s.current&&s.current.dispose()}},[e.componentId]);const Ce=r?50:void 0,pe=!H||!m||T.fillHeight&&!((ie=e.style)!=null&&ie.height);let Q,se;return pe?(Q={position:"relative",width:"100%",height:"100%",minHeight:Ce,...e.style},se={position:"absolute",inset:0}):(Q={position:"relative",width:y!=null&&y.autoSizingWidth?y.width:"100%",height:(y==null?void 0:y.height)??void 0,minHeight:Ce,...e.style},se={width:"100%",height:(y==null?void 0:y.height)??void 0}),C.jsxs("div",{style:Q,children:[C.jsx("div",{ref:t,style:se}),r&&e.loader!==void 0&&C.jsx(At,{opacity:l,fadeDuration:O,children:e.loader}),u&&C.jsx(Ft,{children:e.fallback})]})};let q=be.Main;const Nt=()=>q,$t=(e,t,s)=>q.isPreloaded(e,t,s),Mn=e=>q.getPreloadedParams(e),bn=()=>{q=new be("http://localhost:9292")},En=e=>{q=new be(e)},Cn=e=>{q=e},Sn=e=>{q.setEnvironment(e)},In=async(e,t,s)=>Promise.allSettled(e.map(n=>q.fetchComponentV2(n,t,s)));b.MyopComponent=Bt,b.MyopContainer=vn,b.MyopFallback=Ft,b.MyopLoader=At,b.MyopV2Container=Bt,b.enableLocalDev=bn,b.getCloudRepository=Nt,b.getPreloadedParams=Mn,b.isPreloaded=$t,b.preloadComponents=In,b.setCloudRepository=Cn,b.setCloudRepositoryUrl=En,b.setEnvironment=Sn,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
167
+ <\/script>`;u.writeln(H+x)}u.close();const D=new _t(e,t,s,d,n);return D.sizeMeta=h,i.autoHeight&&(d.onload=()=>{D.observeSizeBasedOnDocumentElement()}),D}if(i.shadowRootMode===de.none){const c=document.createElement("template");c.innerHTML=i.HTML,r=c.content.firstElementChild,It().then(l=>{l.connectedCallback(r,r)})}else{const c=Ys(e.name+t.id);Tt.includes(c)||(Vs(c,i.HTML,i.shadowRootMode),Tt.push(c)),r=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),r.id=o,n!=null&&n.hidden&&(r.style.opacity="0",r.style.position="absolute",r.style.height="0",r.style.width="0",r.style.pointerEvents="none",r.style.visibility="hidden"),this.appendChild(s,r,n),new bt(e,t,s,r,n)}))}isMyopWebComponent(e){return e.trimStart().startsWith(qs)}extractWebComponentScript(e){const n=new DOMParser().parseFromString(e,"text/html").getElementById(Us);return(n==null?void 0:n.textContent)||null}executeWebComponentScript(e,t){if(St.has(t)){console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);return}const s=document.createElement("script");s.textContent=e,s.id=`myop-extracted-${t}`,document.head.appendChild(s),St.add(t),console.log(`[MyopWebComponent] Executed web component script: ${t}`)}loadExtractedWebComponent(e,t,s,n,i){return g(this,null,function*(){const o=this.extractWebComponentScript(n);if(!o)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');const r=`${e.id}-${t.id}`,c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(o,r);const l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);const d=`myop-comp-${Q()}`,u=document.createElement(l);u.id=d,i!=null&&i.hidden&&(u.style.opacity="0",u.style.position="absolute",u.style.height="0",u.style.width="0",u.style.pointerEvents="none",u.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,u,i);const h=new Pe(e,t,s,u,l,i);return(i==null?void 0:i.data)!==void 0&&h.initWithData(i.data),console.log(`[MyopWebComponent] Loaded <${l}> into container`),h})}},Js=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:ge.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:ge.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),we="__MYOP_CLOUD_REPOSITORY_MAIN__",Xs=()=>{if(typeof window<"u")return window[we];if(typeof globalThis<"u")return globalThis[we]},Zs=e=>{typeof window<"u"&&(window[we]=e),typeof globalThis<"u"&&(globalThis[we]=e)},xt=class oe{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,a(this,"variants",{}),a(this,"preloadedComponents",{}),a(this,"userFlows",{}),a(this,"_defaultEnv","production"),a(this,"_envExplicitlySet",!1)}static get Main(){const t=Xs();return t||(oe._main||(oe._main=new oe,Zs(oe._main)),oe._main)}setEnvironment(t){this._defaultEnv=t,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,s,n){return s!==void 0||n!==void 0?`${t}:${s||this._defaultEnv}:${n?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,s,n){return g(this,null,function*(){const i=this.preloadedComponents[t],o=s!==void 0||n!==void 0;let r,c;if(!o&&i)r=i.env,c=i.preview;else{r=s||this._defaultEnv;const d=s||this._envExplicitlySet;c=n===!0?!0:n===!1?!1:!d}const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>g(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const y=(yield(yield fetch(h)).json()).item;if(!y){u(new Error(`Component "${t}" not found`));return}if(!y.consume_variant||!y.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const D=Js(y);d(D)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,s){return g(this,null,function*(){return s?(yield this.fetchFlow(s)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return g(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>g(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return g(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>g(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchComponent(t,s){return g(this,null,function*(){return this.fetchComponentV1(t,s)})}};a(xt,"_main",null);var Ne=xt;Ne.Main;var en=e=>g(void 0,null,function*(){try{const t=new URL(window.location.href),n=new URLSearchParams(t.search).get("myopOverride");if(n){const[i,...o]=Ue(n);switch(i){case"component":{const[r,c]=o,l=yield Ne.Main.fetchComponent(r);if(l&&l.type.skins.find(u=>u.id===c))return l.instance.skinSelector={type:ue.Dedicated,skin:{id:c}},l}break;default:{const[r,c]=Ue(n),d=(yield Ne.Main.fetchFlow(r)).components.find(u=>u.type.id===e.type.id);if(d&&d.instance.skinSelector.type===ue.Segmented&&d.instance.resolvedExperiences){const u=d.instance.resolvedExperiences.find(h=>h.id===c);if((u==null?void 0:u.type)===pt.Segment){const h=u,f=d.instance.skinSelector.segments.find(y=>y.segmentId===h.segment.id);if(f)return d.instance.skinSelector=f==null?void 0:f.skinSelector,d}}}break}}}finally{return null}}),Ht="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",_e=class{constructor(){a(this,"components2init",[]),a(this,"components",[]),a(this,"componentsLoaders",[]),a(this,"initiated",!1),a(this,"version",ks),a(this,"type2InstanceCount",{}),a(this,"assignId",e=>(this.type2InstanceCount[e.id]||(this.type2InstanceCount[e.id]=0),`${e.id}_${++this.type2InstanceCount[e.id]}`)),a(this,"inspected",!1),a(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(e=>{e.inspect&&e.inspect()}))}),a(this,"incomingMessageHandler",e=>{if(e.origin,document.location.origin,e.data.myop){if(e.data.direction!==L.up&&e.data.messageType!==_.EnvelopedMessage)return;const t=e.data;if(t.messageType===_.InitRequest){this.components2init.forEach(n=>{n.send(new De(n.id))});return}if(t.messageType===_.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==t.content.id);const n=this.components.find(i=>{var o;return i.id===((o=t.content)==null?void 0:o.id)});n==null||n.setInitiated();return}if(t.messageType===_.EnvelopedMessage){const n=t,i=this.components.find(o=>o.id===n.destination);if(i){if(n.direction===L.down){n.message.messageType===W.name?i.onMessageReceived(n.message):(n.message.route=n.route,i.send(n.message));return}}else{const o=this.components.find(r=>r.id===n.message.destination);o&&o.send(n.message)}return}const s=this.components.find(n=>n.id===t.destination);if(!s){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t);return}if(s){if(s.onMessageReceived(t))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t)}}}),a(this,"send",e=>{const t=new MessageEvent("",{data:e});this.incomingMessageHandler(t)}),a(this,"init",e=>{if(this.initiated)throw new Error("hostSDK already initiated");const t=[new Rs,new Ds,new Qs];if(this.componentsLoaders=[...t],e){const s={};e.forEach(n=>{const i=new n(this.componentsLoaders);s[i.type]=i}),this.componentsLoaders.forEach(n=>{s[n.type]||(s[n.type]=n)}),this.componentsLoaders=Object.values(s)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0}),a(this,"_getSkinIdBySkinSelector",(e,...t)=>g(this,[e,...t],function*(s,n=[],i){var o;function r(c,l){return g(this,null,function*(){for(const d of c)if(yield l(d))return d})}switch(s.type){case"DedicatedSkin":case ue.Dedicated:return((o=s.skin)==null?void 0:o.id)||s.skins[0].id;case ue.Segmented:{const l=yield r(s.segments,d=>g(this,null,function*(){if(d.segmentId==="Default")return!0;const u=n.find(y=>y.type===pt.Segment?y.segment.id===d.segmentId:!1);if(!u)throw new Error("experience not found");const m=u.segment,f=(i||{})[m.function];return f?yield f():(console.warn(`segmentId:${d.segmentId}, ${m.function} function not provided !`),!1)}));if(l)return this._getSkinIdBySkinSelector(l.skinSelector,n);debugger}break;default:debugger}return""})),a(this,"runSkinSelector",(e,t)=>g(this,null,function*(){const s=yield this._getSkinIdBySkinSelector(e.instance.skinSelector,e.instance.resolvedExperiences,t);return e.type.skins.find(n=>n.id===s)})),a(this,"loaderHooks"),a(this,"loadComponent",(e,t,s)=>g(this,null,function*(){var n,i,o,r;if(!t){debugger;throw new Error("no container was found for this component")}const c=yield en(e);c&&(e=c);const l=S(S({},(n=this.loaderHooks)!=null?n:{}),(i=s==null?void 0:s.hooks)!=null?i:{}),d=t;if(d.myop)if(d.component){e=S({},e),e.instance=S({},e.instance);let f=yield this.runSkinSelector(e,l);if(!f)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(o=s==null?void 0:s.hooks)!=null&&o.afterSkinSelected&&(f=yield s.hooks.afterSkinSelected(S({},f))),e.instance.skinSelector={type:ue.Dedicated,skin:f},s&&(s=S({},s),delete s.hooks),yield vt(d,e,this.components,s)}else throw new Error("load component got a detached ref.");t=t;let u=yield this.runSkinSelector(e,l);if(!u)throw new Error("runSkinSelector failed to choose skin, check the provided config");(r=s==null?void 0:s.hooks)!=null&&r.afterSkinSelected&&(u=yield s.hooks.afterSkinSelected(S({},u)));const h=this.componentsLoaders.find(f=>f.type===u.loader.type);if(!h){debugger;throw new Error(`no loader "${u.loader.type}" was found for component`)}let m=yield h.load(e.type,u,t,s);m.isInitiated||this.components2init.push(m),m.bind("onDispose",()=>(this.components=this.components.filter(f=>f!==m),this.components2init=this.components2init.filter(f=>f!==m),!0)),this.components.push(m),(!s||s.connectProps!==!1)&&(m=Is(m,e.type.props,u));try{yield wt(m,e,this.components)}catch(f){throw f}return s!=null&&s.skipInit||(yield m.initiated()),m})),a(this,"navigate",(e,t,s)=>g(this,null,function*(){if(e.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(s!=null&&s.staged){let n=yield this.loadComponent(t,e.container,S({hidden:!0,relative:{direction:"after",child:e.element}},s));return s.init&&(yield s.init(n)),n.show(),e.dispose(),n}else{const n=e.element.nextSibling;return e.dispose(),this.loadComponent(t,e.container,S({relative:{direction:"before",child:n}},s))}}))}};if(a(_e,"Instance",()=>window.myop.hostSDK),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ht}),!window.myop.hostSDK){const e=new _e;e.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ht}),window.myop.hostSDK=e}var $e=window.myop.hostSDK;qe("hostSDK",$e);var tn="linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)",sn="linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)",nn={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,background:tn,display:"flex",justifyContent:"center",alignItems:"center"},on={position:"absolute",top:0,left:0,right:0,bottom:0,background:sn,display:"flex",justifyContent:"center",alignItems:"center"},rn={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,display:"flex",justifyContent:"center",alignItems:"center"},an=Object.defineProperty,cn=(e,t,s)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,p=(e,t,s)=>cn(e,typeof t!="symbol"?t+"":t,s),B=(e,t,s)=>new Promise((n,i)=>{var o=l=>{try{c(s.next(l))}catch(d){i(d)}},r=l=>{try{c(s.throw(l))}catch(d){i(d)}},c=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,r);c((s=s.apply(e,t)).next())}),K=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),ln=class{constructor(){p(this,"id",K()),p(this,"myop",!0),p(this,"content"),p(this,"source"),p(this,"destination"),p(this,"route"),p(this,"ref"),p(this,"direction"),p(this,"cleanable",!1)}static create(...e){return new this(...e)}isTypeof(e){return e.messageType===this.messageType}},dn=class extends ln{constructor(e){super(),this.handler=e,p(this,"handlerUniqueId",K())}},un="ExecuteScriptReplyMessage",hn=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,pn=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,mn=e=>{let t=e.match(hn);if(t)return t[1]||t[3];{let s=e.match(pn);if(s)return s[1].trim()}},Rt=class extends dn{constructor(e,t=()=>{},s){super(t),this.scriptInputs=s,p(this,"replyMessageKey",un),p(this,"messageType","ExecuteScriptMessage"),p(this,"script",""),this.script=e.toString(),this.content=e.toString(),this.content=mn(this.content)}};p(Rt,"replierKey","send"),p(Rt,"completeStreamKey","completeStream");var Dt=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+K()),p(this,"_runTimeId","runtime-id-"+K()),p(this,"_runTimeName","runtime-name-"+K()),p(this,"id",this._runTimeId),p(this,"name",this._runTimeName),p(this,"description",""),p(this,"loader",null),p(this,"withLoader",t=>(this.loader=t,this)),p(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this)),p(this,"build",()=>this)}};p(Dt,"create",()=>new Dt);var kt=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+K()),p(this,"_runTimeId","runtime-id-"+K()),p(this,"_runTimeName","runtime-name-"+K()),p(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null}),p(this,"name",this._runTimeName),p(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0}),p(this,"withInstance",t=>(this.instance=t,this)),p(this,"withType",t=>(this.type=t,this)),p(this,"withName",t=>(this.name=t,this)),p(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this)),p(this,"withRef",t=>(this.type.refs.push(t),this)),p(this,"withBasicRef",t=>{const s={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(s),this}),p(this,"build",()=>JSON.parse(JSON.stringify(this)))}};p(kt,"create",()=>new kt);var Lt={code:"code"},fn=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Lt.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Lt.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),Me="__MYOP_CLOUD_REPOSITORY_MAIN__",yn=()=>{if(typeof window<"u")return window[Me];if(typeof globalThis<"u")return globalThis[Me]},gn=e=>{typeof window<"u"&&(window[Me]=e),typeof globalThis<"u"&&(globalThis[Me]=e)},Ot=class re{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,p(this,"variants",{}),p(this,"preloadedComponents",{}),p(this,"userFlows",{}),p(this,"_defaultEnv","production"),p(this,"_envExplicitlySet",!1)}static get Main(){const t=yn();return t||(re._main||(re._main=new re,gn(re._main)),re._main)}setEnvironment(t){this._defaultEnv=t,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,s,n){return s!==void 0||n!==void 0?`${t}:${s||this._defaultEnv}:${n?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,s,n){return B(this,null,function*(){const i=this.preloadedComponents[t],o=s!==void 0||n!==void 0;let r,c;if(!o&&i)r=i.env,c=i.preview;else{r=s||this._defaultEnv;const d=s||this._envExplicitlySet;c=n===!0?!0:n===!1?!1:!d}const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>B(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const y=(yield(yield fetch(h)).json()).item;if(!y){u(new Error(`Component "${t}" not found`));return}if(!y.consume_variant||!y.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const D=fn(y);d(D)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,s){return B(this,null,function*(){return s?(yield this.fetchFlow(s)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return B(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>B(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return B(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((s,n)=>B(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();s(o.item)}catch(i){n(i)}}))),yield this.userFlows[t]})}fetchComponent(t,s){return B(this,null,function*(){return this.fetchComponentV1(t,s)})}};p(Ot,"_main",null);var be=Ot,q=be.Main,Pt=()=>q,At=(e,t,s)=>q.isPreloaded(e,t,s),vn=e=>q.getPreloadedParams(e),wn=()=>{q=new be("http://localhost:9292")},_n=e=>{q=new be(e)},Mn=e=>{q=e},bn=e=>{q.setEnvironment(e)},En=(e,t,s)=>B(void 0,null,function*(){return Promise.allSettled(e.map(n=>q.fetchComponentV2(n,t,s)))});const Cn=e=>{const t=w.useRef(null),s=w.useRef(null),n=w.useRef(!1),i=w.useRef(null);return w.useEffect(()=>{let o=!1;n.current=!(t!=null&&t.current);const r=async c=>{n.current=!0;try{const l=await be.Main.fetchComponent(c.componentId,c.flowId);s.current=await $e.loadComponent(l,t.current,{_environment:{props:{...c}}}),o?s.current&&s.current.dispose():c.onReady&&c.onReady(s.current)}catch{}finally{if(n.current=!1,i.current!==null&&!o){const l=i.current;i.current=null,await r(l)}}};return n.current?i.current={...e}:r(e).then(),()=>{o=!0,s.current&&s.current.dispose()}},[e.flowId,e.componentId]),C.jsx("div",{style:{height:"100%",overflow:"inherit"},ref:t})},Ft=()=>C.jsx("svg",{width:"80",viewBox:"0 0 525 243",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:C.jsx("path",{d:"M151.438 2.7168C177.625 2.76042 248.179 4.2832 300.4 56.7441C350.671 107.245 364.44 114.452 389.967 119.211C392.576 119.436 397.472 119.394 400.802 116.521C403.011 114.614 403.921 109.518 404.265 104.627V5.95996C404.265 4.85556 405.16 3.96023 406.265 3.95996H522.711C523.815 3.95996 524.711 4.85539 524.711 5.95996V122.405C524.711 123.51 523.815 124.405 522.711 124.405H421.998C418.579 124.728 413.852 125.627 410.974 128.095C407.879 130.748 407.042 137.805 406.845 142.661V240.414C406.845 241.436 406.111 242.292 405.093 242.38C366.548 245.717 277.079 228.462 235.837 173.668C202.909 129.919 173.882 122.474 151.458 122.077C150.354 122.058 149.459 121.164 149.459 120.06V4.71582C149.459 3.6114 150.334 2.71519 151.438 2.7168ZM62.2031 0C96.5566 0.000213148 124.405 27.8496 124.405 62.2031C124.405 96.5564 96.5564 124.405 62.2031 124.405C27.8496 124.405 0.000213175 96.5566 0 62.2031C0 27.8495 27.8495 0 62.2031 0Z",fill:"white"})}),Bt=({opacity:e=1,fadeDuration:t=200,children:s})=>{if(s!==void 0){const i={...rn,opacity:e,transition:`opacity ${t}ms ease-out`};return C.jsx("div",{style:i,children:s})}const n={...nn,opacity:e,transition:`opacity ${t}ms ease-out`};return C.jsx("div",{style:n,children:C.jsx(Ft,{})})},Sn={position:"absolute",top:0,left:0,right:0,bottom:0},Nt=({children:e})=>e!==void 0?C.jsx("div",{style:Sn,children:e}):C.jsx("div",{style:on,children:C.jsx(Ft,{})}),Tn=e=>`on${e.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join("")}`,$t=e=>{var me,ne,Se,Te,U,j,ie;const t=w.useRef(null),s=w.useRef(null),n=w.useRef(!1),i=w.useRef(null),o=e.componentId?At(e.componentId):!1,[r,c]=w.useState(!o),[l,d]=w.useState(1),[u,h]=w.useState(!1),[m,f]=w.useState(!1),[y,D]=w.useState(void 0),H=e.autoSize??!0,[I,x]=w.useState({fillWidth:!1,fillHeight:!1}),N=w.useRef(!1),O=e.fadeDuration??200,te=w.useCallback(()=>{d(0),setTimeout(()=>{c(!1)},O)},[O]),Ee=w.useCallback(E=>{console.error("[MyopComponent] Error:",E),te(),h(!0),e.onError&&e.onError(E)},[te,e.onError]);w.useEffect(()=>{N.current=!1},[e.componentId]),w.useEffect(()=>{if(m&&e.data!==void 0&&s.current){if(!N.current){N.current=!0;return}const E=s.current.props.myop_init_interface;E&&E(e.data)}},[e.data,m]),w.useEffect(()=>{var V,v,M,k,G,Y,R;if(!m||!((V=s.current)!=null&&V.observeAutoSize))return;let E=!0;return s.current.observeAutoSize({explicitWidth:(v=e.style)==null?void 0:v.width,explicitHeight:(M=e.style)==null?void 0:M.height,minWidth:(k=e.style)==null?void 0:k.minWidth,maxWidth:(G=e.style)==null?void 0:G.maxWidth,minHeight:(Y=e.style)==null?void 0:Y.minHeight,maxHeight:(R=e.style)==null?void 0:R.maxHeight,forceAutoSize:H,loaderMinHeight:50,onSizeChange:X=>{e.onSizeChange&&e.onSizeChange(X)===!1||(D(X),E&&(E=!1,te()))}})},[H,m,e.onSizeChange,(me=e.style)==null?void 0:me.width,(ne=e.style)==null?void 0:ne.height,(Se=e.style)==null?void 0:Se.minWidth,(Te=e.style)==null?void 0:Te.maxWidth,(U=e.style)==null?void 0:U.minHeight,(j=e.style)==null?void 0:j.maxHeight]),w.useEffect(()=>{let E=!1;n.current=!(t!=null&&t.current);const V=async v=>{var M,k,G,Y;n.current=!0;try{if(!v.componentId&&!v.componentConfig){Ee("No component configuration provided");return}const R=await Pt().fetchComponentV2(v.componentId,v.environment,v.preview),X=await $e.loadComponent(R,t.current,{data:v.data,_environment:{props:{...v}}});if(E){X.dispose();return}if(s.current=X,await s.current.initiated(),E){s.current&&s.current.dispose();return}if(await new Promise(Ie=>requestAnimationFrame(Ie)),E||!s.current||s.current.markedForDisposed){s.current&&!s.current.markedForDisposed&&s.current.dispose();return}f(!0);const $=(M=s.current)==null?void 0:M.sizeMeta,zt=($==null?void 0:$.width)==="100%",Wt=($==null?void 0:$.height)==="100%";x({fillWidth:zt,fillHeight:Wt});const In=(zt||((k=e.style)==null?void 0:k.width))&&(Wt||((G=e.style)==null?void 0:G.height));(!H||In)&&te(),(Y=s.current)!=null&&Y.props&&(s.current.props.myop_cta_handler=(Ie,Kt)=>{e.on&&e.on(Ie,Kt);const xn=Tn(Ie),qt=e[xn];typeof qt=="function"&&qt(Kt)}),v.onLoad&&s.current&&v.onLoad(s.current)}catch(R){E||Ee((R==null?void 0:R.message)||"Unknown error")}finally{if(n.current=!1,i.current!==null&&!E){const R=i.current;i.current=null,await V(R)}}};return n.current?i.current={...e}:V(e).then(),()=>{E=!0,s.current&&s.current.dispose()}},[e.componentId]);const Ce=r?50:void 0,pe=!H||!m||I.fillHeight&&!((ie=e.style)!=null&&ie.height);let J,se;return pe?(J={position:"relative",width:"100%",height:"100%",minHeight:Ce,...e.style},se={position:"absolute",inset:0}):(J={position:"relative",width:y!=null&&y.autoSizingWidth?y.width:"100%",height:(y==null?void 0:y.height)??void 0,minHeight:Ce,...e.style},se={width:"100%",height:(y==null?void 0:y.height)??void 0}),C.jsxs("div",{style:J,children:[C.jsx("div",{ref:t,style:se}),r&&e.loader!==void 0&&C.jsx(Bt,{opacity:l,fadeDuration:O,children:e.loader}),u&&C.jsx(Nt,{children:e.fallback})]})};b.MyopComponent=$t,b.MyopContainer=Cn,b.MyopFallback=Nt,b.MyopLoader=Bt,b.MyopV2Container=$t,b.enableLocalDev=wn,b.getCloudRepository=Pt,b.getPreloadedParams=vn,b.isPreloaded=At,b.preloadComponents=En,b.setCloudRepository=Mn,b.setCloudRepositoryUrl=_n,b.setEnvironment=bn,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));