@myop/react 0.0.33 → 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.
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { jsx as T, jsxs as Pt } from "react/jsx-runtime";
2
- import { useRef as O, useEffect as oe, useState as ie, useCallback as Be } from "react";
3
- const At = `"use strict";var MyopSDK=(()=>{var Ue=Object.defineProperty,ls=Object.defineProperties,fs=Object.getOwnPropertyDescriptor,us=Object.getOwnPropertyDescriptors,gs=Object.getOwnPropertyNames,yn=Object.getOwnPropertySymbols;var hn=Object.prototype.hasOwnProperty,ys=Object.prototype.propertyIsEnumerable;var Bt=(o,n,e)=>n in o?Ue(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,h=(o,n)=>{for(var e in n||(n={}))hn.call(n,e)&&Bt(o,e,n[e]);if(yn)for(var e of yn(n))ys.call(n,e)&&Bt(o,e,n[e]);return o},U=(o,n)=>ls(o,us(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var ee=(o,n)=>{for(var e in n)Ue(o,e,{get:n[e],enumerable:!0})},hs=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of gs(n))!hn.call(o,s)&&s!==e&&Ue(o,s,{get:()=>n[s],enumerable:!(t=fs(n,s))||t.enumerable});return o};var Ms=o=>hs(Ue({},"__esModule",{value:!0}),o);var r=(o,n,e)=>Bt(o,typeof n!="symbol"?n+"":n,e);var qe,Ve,Lt,F,te=m(()=>{"use strict";qe="__federation__",Ve="onLoad",Lt="moduleInstance",F=(o,n)=>{window[qe]&&window[qe][o]&&window[qe][o][Ve]&&window[qe][o][Ve]({[o]:n})}});var ye,je=m(()=>{ye="0.3.17"});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,Is,Cs,Pt,Ot=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)),Is=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("-")},Cs=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))},Pt=o=>{let n=Cs(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(Is(n.slice(t,t+16)));return e}});var In,ne=m(()=>{"use strict";Ot();In=o=>new Promise(n=>setTimeout(n,o))});var v,C,At,R,_,Y,k=m(()=>{"use strict";ne();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}},At=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())}},Y=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=U(h({},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 Cn,Kt,oe,xn=m(()=>{"use strict";k();Cn="ClickReplayMessage",Kt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",Cn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},oe=class extends R{constructor(){super(...arguments);r(this,"messageType",Cn)}}});var $t,wn=m(()=>{"use strict";k();$t=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}}});var bn,xs,ws,Sn,D,se,Ft=m(()=>{"use strict";k();bn="ExecuteScriptReplyMessage",xs=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,ws=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Sn=o=>{let n=o.match(xs);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",bn);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Sn(this.content)}};r(D,"replierKey","send"),r(D,"completeStreamKey","completeStream");se=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",bn)}}});var q,En=m(()=>{"use strict";Ft();q=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=U(h({},t),{_script:e.toString()})}}});var Tn,zt,re,vn=m(()=>{"use strict";k();Tn="EventListenerCallbackMessage",zt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",Tn);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},re=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",Tn);this.content={e:t}}}});var Wt,Rn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}}});var _n,Nt,ie,Ut=m(()=>{"use strict";k();_n="ElementValueReplayMessage",Nt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",_n);r(this,"messageType","GetElementValueMessage")}},ie=class extends R{constructor(e){super();this.content=e;r(this,"messageType",_n)}}});var qt,kn=m(()=>{"use strict";k();qt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}}});var he,_e,ae,Hn=m(()=>{"use strict";k();he=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},_e=class extends he{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},ae=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}}});var Dn,ke,V,Ge=m(()=>{"use strict";k();Dn="RefComponentCreatedMessage",ke=class extends _{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Dn);r(this,"messageType","CreateRefComponentMessage")}},V=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Dn)}}});var He,Vt=m(()=>{"use strict";k();He=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 Bn,jt,pe,Ln=m(()=>{"use strict";k();Bn="DetectedMyopRefsMessage",jt=class extends _{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",Bn)}},pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",Bn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var Pn,Gt,De,On=m(()=>{"use strict";k();Pn="GetAttributeReplayMessage",Gt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",Pn);r(this,"messageType","GetAttributeMessage")}},De=class extends R{constructor(e){super();this.content=e;r(this,"messageType",Pn)}}});var A,An=m(()=>{"use strict";k();A=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}}});var Yt,Be,Kn=m(()=>{"use strict";k();Yt=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Be=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}}});var $n,Le,Pe,Fn=m(()=>{"use strict";k();$n="CleanupReplayMessage",Le=class extends _{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",$n);r(this,"messageType","CleanupMessage")}},Pe=class extends R{constructor(e){super();this.customCleanup=e;r(this,"messageType",$n)}}});var Oe,zn=m(()=>{"use strict";k();Oe=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}}});var Qt,Ae,Wn=m(()=>{"use strict";k();Qt=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},Ae=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}}});var Me={};ee(Me,{AddEventListenerMessage:()=>zt,BaseMyopMessage:()=>C,BindClickMessage:()=>Kt,ChangeTextMessage:()=>$t,CleanupMessage:()=>Le,CleanupReplayMessage:()=>Pe,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>ke,CustomRefMessage:()=>q,DetectMyopRefsMessage:()=>jt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Oe,ElementValueReplayMessage:()=>ie,EnvelopedMessage:()=>He,EventListenerCallbackMessage:()=>re,ExecuteComponentMethod:()=>A,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>Gt,GetAttributeReplayMessage:()=>De,GetElementValueMessage:()=>Nt,InitMessage:()=>he,InitRequest:()=>ae,InitResponse:()=>_e,MessageDirection:()=>v,MutationObserverMessage:()=>Be,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>At,Ref:()=>Y,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>Ae,SetAttributeMessage:()=>Wt,SetInnerHtml:()=>qt,SetMutationObserverMessage:()=>Yt,SetResizeObserverMessage:()=>Qt,stripFunction:()=>Sn});var w=m(()=>{"use strict";k();xn();wn();Ft();En();vn();Rn();Ut();kn();Hn();Ge();Vt();Ln();Ut();On();An();Kn();Fn();zn();Wn()});var z,Ke=m(()=>{"use strict";I();w();$e();z=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 Le(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Oe);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Ie,Nn=m(()=>{"use strict";Ie=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 Un,x,Ye,qn=m(()=>{"use strict";Un=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}},Ye=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var Jt,Ce,Vn=m(()=>{"use strict";I();b();w();Jt=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},Ce=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 Jt(s),this.messageToHost(new _e(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 Pe(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Un(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 j,de,be,xe,ce,Qe,we,b=m(()=>{"use strict";Nn();qn();Vn();j={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},be={message:"message",code:"code"},xe=class{};r(xe,"code","code"),r(xe,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Qe={Segment:"Segment",Promo:"Promo",AB:"AB"},we=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 Xt,bs,Zt,O,me=m(()=>{"use strict";Xt=o=>o!==Object(o),bs=o=>typeof o=="function",Zt=o=>{if(Xt(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(!Zt(e))return!1}else{if(Xt(e))continue;return!1}}return!0},O=(o,n={},e=!0,t=new WeakMap)=>{if(Xt(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]=O(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]=O(o[i],!0,e,t)):typeof a=="object"&&(s[i]=O(o[i],a,e,t)))}return s}return{}}});var jn,Gn=m(()=>{"use strict";jn={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 Fe,Yn=m(()=>{"use strict";Ke();w();Vt();Fe=class extends z{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 He(this.id,e)),e.handler=t,s});r(this,"dispose",()=>{this.isInitiated&&this.send(new A("dispose")),super.dispose()})}hide(){this.send(new A("hide"))}show(){this.send(new A("show"))}inspect(){return this.send(new A("inspect"))}setHeightBasedOnDocumentElement(){this.send(new A("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new A("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var le,en=m(()=>{"use strict";Ke();ze();le=class extends z{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=Se(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 Ss,Se,Qn,Jn,Xn,Es,tn,nn,ze=m(()=>{"use strict";w();w();b();me();Gn();Yn();en();Ss=(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},Se=(o,n,e,t,s,i)=>{let a=Ss("".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)}},Qn=(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),Jn=(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."))},Xn=(o,n,e)=>{let t=n.reduce((i,a)=>U(h({},i),{[a.name]:h({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(Qn(p,a,o))return!1;if(p.behavior.type===be.code){if(o instanceof le)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===j.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return Jn(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(Y.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let l=Me[p.behavior.message];o.send(new l(...c))}):null},set:(i,a,p)=>{let d=t[a];if(Qn(d,a,o))return!1;if(d.behavior.type===be.code){if(o instanceof le){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===j.HTMLLoader&&e.loader.shadowRootMode===de.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(M=>{o.markedForDisposed||p(M.action,M.payload)})}return!0}return Jn(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(Y.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let l=Me[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},Es=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{Zt(p)||jn.notSerializableRefCall(t,p)}),n.send(new q(({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 q(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),tn=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 Fe(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new ke(o.refConfig,n,U(h({},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(M=>M.type.id===u.componentDefinitionId).type,y=new Fe(g,p);y.setInitiated(),p.refs[u.refName]=y,e.push(y)});try{await nn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(u){a(u)}}))})},nn=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==xe.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=Y.create("",i,o);try{let g=await tn(u,l,e);o.refs[i.name]=g,a()}catch(g){p(g)}}else try{let c=Y.create("",i,o);o.refs[i.name]=Es(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}}});var Ee,on=m(()=>{"use strict";Ke();w();ze();I();Ee=class extends z{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;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 Re;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(P,N,ge)=>N!==void 0&&P<N?N:ge!==void 0&&P>ge?ge:P,a=P=>{if(P===void 0)return;if(typeof P=="number")return P;let N=parseFloat(P);return isNaN(N)?void 0:N},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=(Re=e==null?void 0:e.loaderMinHeight)!=null?Re:50,g=(e==null?void 0:e.explicitWidth)!==void 0,y=(e==null?void 0:e.explicitHeight)!==void 0,M=this.container.getBoundingClientRect(),fe=M.width===0,Ne=M.height===0||M.height===u,G=(e!=null&&e.forceAutoSize||fe)&&!g,H=(e!=null&&e.forceAutoSize||Ne)&&!y;if(!G&&!H)return()=>{};let K=()=>{var N;let P=t.contentDocument;if(P){let ge=P.documentElement.getBoundingClientRect(),ln=Math.ceil(ge.width),fn=Math.ceil(ge.height),un=i(ln,p,d),gn=i(fn,c,l);G&&(t.style.width="".concat(un,"px")),H&&(t.style.height="".concat(gn,"px"));let cs=G&&d!==void 0&&ln>d,ms=H&&l!==void 0&&fn>l;P.documentElement.style.overflowX=cs?"auto":"hidden",P.documentElement.style.overflowY=ms?"auto":"hidden",(N=e==null?void 0:e.onSizeChange)==null||N.call(e,{width:un,height:gn,autoSizingWidth:G,autoSizingHeight:H})}};K();let ue=new ResizeObserver(K);return ue.observe(s.body),ue.observe(s.documentElement),()=>{ue.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=h({},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=Se(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 Q,Je=m(()=>{"use strict";Q=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 Ts,Xe,Zn=m(()=>{"use strict";on();Je();ne();b();Ts=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Xe=class extends Q{constructor(){super(...arguments);r(this,"type",j.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=Ts(u,"_myop-comp",d)),a.src=u,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new Ee(e,t,s,a,i)})}}});var Ze,sn=m(()=>{"use strict";Ze={webcomponent_message_key:"myop_webcomponent_message"}});var Te,rn=m(()=>{"use strict";sn();Ke();ze();Te=class extends z{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=h({},e),s=super.send(t),i=new CustomEvent(Ze.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=Se(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 an,et,eo=m(()=>{"use strict";rn();Je();ne();b();an={},et=class extends Q{constructor(){super(...arguments);r(this,"type",j.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;an[a.url]?console.log("Module alreday loaded or in loading process"):an[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 an[a.url],await In(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 Te(e,t,s,d,i)})}}});var T,W=m(()=>{"use strict";b();T=class extends Ye{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(U(h({},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,J=m(()=>{"use strict";B={id:"myop-id"}});var S,to,L=m(()=>{"use strict";J();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),to=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var tt,no=m(()=>{"use strict";I();w();W();L();tt=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 oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var nt,oo=m(()=>{"use strict";I();W();L();nt=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 ot,so=m(()=>{"use strict";b();ot=class extends we{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var st,ro=m(()=>{"use strict";b();J();W();w();I();st=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 Ie(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,i))});r(this,"messageType",f.DetectMyopRefsMessage)}}});var rt,io=m(()=>{"use strict";I();W();L();rt=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 it,ao=m(()=>{"use strict";I();w();W();L();me();it=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 re(e.handlerUniqueId,O(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var at,po=m(()=>{"use strict";I();J();$e();Ge();W();at=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 V(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var pt,pn=m(()=>{"use strict";me();pt=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=O,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)}});var dt,co=m(()=>{"use strict";I();w();W();pn();dt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{pt(e,a=>{s(new se(e.handlerUniqueId,a))},t)})}}});var mo,ct,lo=m(()=>{"use strict";I();w();W();L();J();me();mo=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:mo(i),required:i.required,validity:O(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},ct=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 ie(mo(a)),e)})})}}});var mt,fo=m(()=>{"use strict";I();W();L();mt=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 uo={};ee(uo,{WebComponentSDK:()=>ve});var ve,dn=m(()=>{"use strict";b();I();sn();no();oo();so();ro();te();w();io();ao();po();co();lo();fo();ve=class extends Ce{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(Ze.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 ot(e,t)}}}),setTimeout(()=>{this.messageToHost(new ae)},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 nt(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new tt(this.messageToHost,this.components),new st(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new it(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new at(this.messageToHost,this.components)]);r(this,"init",()=>{})}};F("WebComponentSDK",ve)});var go=m(()=>{"use strict";dn()});var yo,ho=m(()=>{"use strict";yo=""});function _s(o,n){return class extends HTMLElement{connectedCallback(){let e=n===de.open?"open":"closed",t=this.attachShadow({mode:e});xo().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var vs,Rs,Io,Co,lt,xo,ks,Hs,Ds,ft,wo=m(()=>{"use strict";rn();en();Je();ne();b();go();on();ho();vs="<!-- myop-web-component -->",Rs="myop-web-component",Io=new Set,Co=[],xo=async()=>(lt||(lt=new ve,lt.init()),lt);ks=(o,n,e)=>{customElements.define(o,_s(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Hs=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Ds=o=>(o=Hs(o),o.replace(/_/g,"-")),ft=class extends Q{constructor(){super(...arguments);r(this,"type",j.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===de.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=a.HTML;if(i!=null&&i._inspection){let H=new DOMParser().parseFromString(a.HTML,"text/html"),K=H.getElementById("myop_preview");K==null||K.removeAttribute("type");let ue=H.implementation.createHTMLDocument();ue.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let Re=ue.body.firstChild;Re&&H.head&&H.head.insertBefore(H.importNode(Re,!0),H.head.firstChild),y=H.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let H=new DOMParser().parseFromString(a.HTML,"text/html"),K=H.getElementById("myop_preview");K&&(K.remove(),y=H.documentElement.outerHTML)}g.writeln(y);let M='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),fe="<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(M).concat(fe)),(i==null?void 0:i.data)!==void 0){let G="<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>",H=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),K='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(H,";\\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(G+K)}g.close();let Ne=new Ee(e,t,s,u,i);return a.autoHeight&&(u.onload=()=>{Ne.observeSizeBasedOnDocumentElement()}),Ne}if(a.shadowRootMode===de.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,xo().then(l=>{l.connectedCallback(d,d)})}else{let c=Ds(e.name+t.id);Co.includes(c)||(ks(c,a.HTML,a.shadowRootMode),Co.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 Te(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(vs)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Rs);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(Io.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),Io.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 le(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,So,Eo=m(()=>{"use strict";ne();w();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}))}},So=(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 Bs,cn,To,vo=m(()=>{"use strict";Bs=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},cn=(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=h({},o.loader),o.loader.url=Bs(o.loader.url,n),o},To=o=>async n=>cn(n,o)});var Ro,_o,ko=m(()=>{"use strict";w();Ro=(o,n,e)=>{o.send(new q(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},_o=(o,n,e)=>{o.send(new q(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var yt,ut,ht,gt,Ho=m(()=>{"use strict";ne();yt=class yt{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(yt,"create",()=>new yt);ut=yt,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,"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(ht,"create",()=>new ht);gt=ht});var Ls,Mt,Ps,Os,X,Z,Do,Bo=m(()=>{"use strict";b();Ls=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:be.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:be.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),Mt="__MYOP_CLOUD_REPOSITORY_MAIN__",Ps=()=>{if(typeof window<"u")return window[Mt];if(typeof globalThis<"u")return globalThis[Mt]},Os=o=>{typeof window<"u"&&(window[Mt]=o),typeof globalThis<"u"&&(globalThis[Mt]=o)},X=class X{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=Ps();return n||(X._main||(X._main=new X,Os(X._main)),X._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 M=(await(await fetch(u)).json()).item;if(!M){l(new Error('Component "'.concat(n,'" not found')));return}if(!M.consume_variant||!M.consume_variant.length){l(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let fe=Ls(M);c(fe)}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(X,"_main",null);Z=X,Do=Z});var Lo,Po=m(()=>{"use strict";Lo=async o=>await o()});var mn={};ee(mn,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ut,addClass:()=>Ro,applyStylesheet:()=>bo,applyStylesheetLink:()=>So,changeSkinUrlByTokenizer:()=>To,createIframeSkinByTokenizer:()=>cn,exec:()=>Lo,removeClass:()=>_o,v2_CloudRepository:()=>Do});var It=m(()=>{"use strict";Eo();vo();ko();Ho();Bo();Po()});var Oo,Ao=m(()=>{"use strict";Ot();It();b();Oo=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=Pt(t);switch(s){case"component":{let[a,p]=i,d=await Z.Main.fetchComponent(a);if(d&&d.type.skins.find(l=>l.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Pt(t),c=(await Z.Main.fetchFlow(a)).components.find(l=>l.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ce.Segmented&&c.instance.resolvedExperiences){let l=c.instance.resolvedExperiences.find(u=>u.id===p);if((l==null?void 0:l.type)===Qe.Segment){let u=l,y=c.instance.skinSelector.segments.find(M=>M.segmentId===u.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Fo={};ee(Fo,{HostSDK:()=>$,hostSDK:()=>$o});var Ko,$,$o,$e=m(()=>{"use strict";te();I();w();Zn();eo();ze();b();je();wo();Ao();Ko="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",ye);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 he(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===A.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 Xe,new et,new ft];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 ce.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case ce.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===Qe.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 Oo(n);s&&(n=s);let i=h(h({},(l=this.loaderHooks)!=null?l:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=h({},n),n.instance=h({},n.instance);let M=await this.runSkinSelector(n,i);if(!M)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(M=await t.hooks.afterSkinSelected(h({},M))),n.instance.skinSelector={type:ce.Dedicated,skin:M},t&&(t=h({},t),delete t.hooks),await tn(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(h({},p)));let d=this.componentsLoaders.find(M=>M.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(M=>M!==c),this.components2init=this.components2init.filter(M=>M!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=Xn(c,n.type.props,p));try{await nn(c,n,this.components)}catch(M){throw M}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,h({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,h({relative:{direction:"before",child:s}},t))}})}};r($,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ko});if(!window.myop.hostSDK){let o=new $;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ko}),window.myop.hostSDK=o}$o=window.myop.hostSDK;F("hostSDK",$o)});var Ct,zo=m(()=>{"use strict";I();J();b();w();Ct=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 Ie(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,s))})}}});var xt,Wo=m(()=>{"use strict";I();b();w();L();xt=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 oe,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}}});var wt,No=m(()=>{"use strict";I();b();L();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 bt,Uo=m(()=>{"use strict";I();w();b();pn();bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"executor",e=>{pt(e,s=>{this.messageToHost(new se(e.handlerUniqueId,s))},new we(document.documentElement))})}}});var St,qo=m(()=>{"use strict";I();b();w();me();L();St=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 re(e.handlerUniqueId,O(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}}});var Et,Vo=m(()=>{"use strict";I();b();L();Et=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 Tt,jo=m(()=>{"use strict";I();J();b();$e();Ge();Tt=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 V(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var Go,Yo=m(()=>{"use strict";Go=(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 vt,Qo=m(()=>{"use strict";I();w();b();Yo();vt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&Go(document.body,()=>{this.messageToHost(new Be)})})}}});var Jo,Rt,Xo=m(()=>{"use strict";I();J();b();w();me();L();Jo=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:Jo(i),required:i.required,validity:O(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},Rt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new ie(Jo(s)),e)})})}}});var _t,Zo=m(()=>{"use strict";I();b();w();L();_t=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetAttributeMessage);r(this,"executor",e=>{let t=to(e.ref,document);t&&this.messageToHost(new De(t.getAttribute(e.name)),e)})}}});var kt,es=m(()=>{"use strict";w();I();b();kt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new Ae)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Ht,ts=m(()=>{"use strict";I();b();L();Ht=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 ns={};ee(ns,{IframeSDK:()=>Dt});var Dt,os=m(()=>{"use strict";b();zo();Wo();No();Uo();te();qo();Vo();w();jo();Qo();Xo();je();Zo();es();ts();Dt=class extends Ce{constructor(){super();r(this,"version",ye);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(h({},e),"*")});r(this,"supportedHandlers",[new wt(this.messageToHost),new Ht(this.messageToHost),new xt(this.messageToHost),new Ct(this.messageToHost),new bt(this.messageToHost),new St(this.messageToHost),new Et(this.messageToHost),new Rt(this.messageToHost),new vt(this.messageToHost),new kt(this.messageToHost),new _t(this.messageToHost),new Tt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};F("IframeSDK",Dt)});var Ks={};var As,ss=m(()=>{"use strict";w();te();As=h({},Me);F("MyopMessages",As)});var rs={};ee(rs,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ut,addClass:()=>Ro,applyStylesheet:()=>bo,applyStylesheetLink:()=>So,changeSkinUrlByTokenizer:()=>To,createIframeSkinByTokenizer:()=>cn,exec:()=>Lo,removeClass:()=>_o,v2_CloudRepository:()=>Do});var is=m(()=>{"use strict";te();It();It();F("MyopHelpers",mn)});var Ns={};ee(Ns,{getHostModule:()=>as,getIframeModule:()=>ps,getWebcomponentModule:()=>ds});te();var Mn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Mn=document.currentScript)==null?void 0:Mn.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][Lt]);else{let t;window.__federation__[n]={},window.__federation__[n][Ve]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Lt]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};je();console.log("myop root sdk - loaded",document.location.origin);var $s="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",as=()=>Promise.resolve().then(()=>($e(),Fo)),ps=()=>Promise.resolve().then(()=>(os(),ns)),ds=()=>Promise.resolve().then(()=>(dn(),uo)),Fs=()=>Promise.resolve().then(()=>(ss(),Ks)),zs=()=>Promise.resolve().then(()=>(is(),rs)),We=o=>async()=>(await o()).get(),Ws={version:ye,getHostModule:We(as),getIframeModule:We(ps),getWebcomponentModule:We(ds),getMyopMessages:We(Fs),getMyopHelpers:We(zs)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:$s});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=h({rootSDK:Ws},window.myop);return Ms(Ns);})();
1
+ import { jsx as R, jsxs as Ut } from "react/jsx-runtime";
2
+ import { useRef as A, useEffect as le, useState as ne, useCallback as je } from "react";
3
+ 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);})();
4
4
  `;
5
- var Je = Object.defineProperty, Bt = Object.defineProperties, Ft = Object.getOwnPropertyDescriptors, Fe = Object.getOwnPropertySymbols, Nt = Object.prototype.hasOwnProperty, $t = Object.prototype.propertyIsEnumerable, Ie = (e, t, n) => t in e ? Je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t) => {
5
+ var it = Object.defineProperty, Vt = Object.defineProperties, Gt = Object.getOwnPropertyDescriptors, Ve = Object.getOwnPropertySymbols, Yt = Object.prototype.hasOwnProperty, Qt = Object.prototype.propertyIsEnumerable, Re = (e, t, n) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t) => {
6
6
  for (var n in t || (t = {}))
7
- Nt.call(t, n) && Ie(e, n, t[n]);
8
- if (Fe)
9
- for (var n of Fe(t))
10
- $t.call(t, n) && Ie(e, n, t[n]);
7
+ Yt.call(t, n) && Re(e, n, t[n]);
8
+ if (Ve)
9
+ for (var n of Ve(t))
10
+ Qt.call(t, n) && Re(e, n, t[n]);
11
11
  return e;
12
- }, ue = (e, t) => Bt(e, Ft(t)), Wt = (e, t) => {
12
+ }, fe = (e, t) => Vt(e, Gt(t)), Jt = (e, t) => {
13
13
  for (var n in t)
14
- Je(e, n, { get: t[n], enumerable: !0 });
15
- }, a = (e, t, n) => Ie(e, typeof t != "symbol" ? t + "" : t, n), g = (e, t, n) => new Promise((s, i) => {
14
+ it(e, n, { get: t[n], enumerable: !0 });
15
+ }, a = (e, t, n) => Re(e, typeof t != "symbol" ? t + "" : t, n), v = (e, t, n) => new Promise((s, i) => {
16
16
  var o = (l) => {
17
17
  try {
18
18
  c(n.next(l));
@@ -27,9 +27,9 @@ var Je = Object.defineProperty, Bt = Object.defineProperties, Ft = Object.getOwn
27
27
  }
28
28
  }, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(o, r);
29
29
  c((n = n.apply(e, t)).next());
30
- }), ye = "__federation__", Ne = "onLoad", Qe = (e, t) => {
31
- window[ye] && window[ye][e] && window[ye][e][Ne] && window[ye][e][Ne]({ [e]: t });
32
- }, v = {
30
+ }), Me = "__federation__", Ge = "onLoad", ot = (e, t) => {
31
+ window[Me] && window[Me][e] && window[Me][e][Ge] && window[Me][e][Ge]({ [e]: t });
32
+ }, w = {
33
33
  //host to component
34
34
  InitRequest: "InitRequest",
35
35
  InitResponse: "InitResponse",
@@ -53,50 +53,50 @@ var Je = Object.defineProperty, Bt = Object.defineProperties, Ft = Object.getOwn
53
53
  MutationObserverMessage: "MutationObserverMessage",
54
54
  ResizeObserverMessage: "ResizeObserverMessage"
55
55
  }
56
- }, Te = {};
57
- Wt(Te, {
58
- AddEventListenerMessage: () => Jt,
59
- BaseMyopMessage: () => b,
60
- BindClickMessage: () => jt,
61
- ChangeTextMessage: () => Vt,
62
- CleanupMessage: () => gt,
63
- CleanupReplayMessage: () => vt,
64
- ClickReplayMessage: () => et,
65
- CreateRefComponentMessage: () => ut,
66
- CustomRefMessage: () => xe,
67
- DetectMyopRefsMessage: () => en,
68
- DetectedMyopRefsMessage: () => mt,
69
- DisposeMessage: () => wt,
70
- ElementValueReplayMessage: () => at,
71
- EnvelopedMessage: () => ht,
72
- EventListenerCallbackMessage: () => ot,
73
- ExecuteComponentMethod: () => N,
74
- ExecuteScriptMessage: () => $,
75
- ExecuteScriptReplyMessage: () => st,
76
- GetAttributeMessage: () => tn,
77
- GetAttributeReplayMessage: () => nn,
78
- GetElementValueMessage: () => Xt,
79
- InitMessage: () => ke,
80
- InitRequest: () => lt,
81
- InitResponse: () => ct,
82
- MessageDirection: () => D,
83
- MutationObserverMessage: () => on,
84
- MyopBindMessage: () => A,
85
- MyopBindReplayMessage: () => P,
86
- MyopElementMessage: () => Ut,
87
- Ref: () => ae,
88
- RefComponentCreatedMessage: () => Re,
89
- ResizeObserverMessage: () => an,
90
- SetAttributeMessage: () => Qt,
91
- SetInnerHtml: () => Zt,
92
- SetMutationObserverMessage: () => sn,
93
- SetResizeObserverMessage: () => rn,
94
- stripFunction: () => nt
56
+ }, De = {};
57
+ Jt(De, {
58
+ AddEventListenerMessage: () => an,
59
+ BaseMyopMessage: () => S,
60
+ BindClickMessage: () => nn,
61
+ ChangeTextMessage: () => sn,
62
+ CleanupMessage: () => St,
63
+ CleanupReplayMessage: () => It,
64
+ ClickReplayMessage: () => ct,
65
+ CreateRefComponentMessage: () => wt,
66
+ CustomRefMessage: () => ke,
67
+ DetectMyopRefsMessage: () => un,
68
+ DetectedMyopRefsMessage: () => bt,
69
+ DisposeMessage: () => Tt,
70
+ ElementValueReplayMessage: () => ft,
71
+ EnvelopedMessage: () => _t,
72
+ EventListenerCallbackMessage: () => pt,
73
+ ExecuteComponentMethod: () => U,
74
+ ExecuteScriptMessage: () => j,
75
+ ExecuteScriptReplyMessage: () => ut,
76
+ GetAttributeMessage: () => hn,
77
+ GetAttributeReplayMessage: () => pn,
78
+ GetElementValueMessage: () => ln,
79
+ InitMessage: () => Fe,
80
+ InitRequest: () => gt,
81
+ InitResponse: () => yt,
82
+ MessageDirection: () => k,
83
+ MutationObserverMessage: () => fn,
84
+ MyopBindMessage: () => B,
85
+ MyopBindReplayMessage: () => F,
86
+ MyopElementMessage: () => tn,
87
+ Ref: () => ue,
88
+ RefComponentCreatedMessage: () => Le,
89
+ ResizeObserverMessage: () => gn,
90
+ SetAttributeMessage: () => cn,
91
+ SetInnerHtml: () => dn,
92
+ SetMutationObserverMessage: () => mn,
93
+ SetResizeObserverMessage: () => yn,
94
+ stripFunction: () => dt
95
95
  });
96
- var j = () => "10000000-1000-4000-8000-100000000000".replace(
96
+ var J = () => "10000000-1000-4000-8000-100000000000".replace(
97
97
  /[018]/g,
98
98
  (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
99
- ), Kt = (e) => {
99
+ ), Xt = (e) => {
100
100
  const t = [...e].map((n) => n.toString(16).padStart(2, "0")).join("");
101
101
  return [
102
102
  t.slice(0, 8),
@@ -105,25 +105,25 @@ var j = () => "10000000-1000-4000-8000-100000000000".replace(
105
105
  t.slice(16, 20),
106
106
  t.slice(20)
107
107
  ].join("-");
108
- }, zt = (e) => {
108
+ }, Zt = (e) => {
109
109
  let t = e.replace(/-/g, "+").replace(/_/g, "/");
110
110
  for (; t.length % 4; ) t += "=";
111
111
  const n = atob(t);
112
112
  return Uint8Array.from(n, (s) => s.charCodeAt(0));
113
- }, $e = (e) => {
114
- const t = zt(e);
113
+ }, Ye = (e) => {
114
+ const t = Zt(e);
115
115
  if (t.length % 16 !== 0) throw new Error("Invalid input length");
116
116
  const n = [];
117
117
  for (let s = 0; s < t.length; s += 16)
118
- n.push(Kt(t.slice(s, s + 16)));
118
+ n.push(Xt(t.slice(s, s + 16)));
119
119
  return n;
120
- }, qt = (e) => new Promise((t) => setTimeout(t, e)), D = class {
120
+ }, en = (e) => new Promise((t) => setTimeout(t, e)), k = class {
121
121
  };
122
- a(D, "down", "down");
123
- a(D, "up", "up");
124
- var b = class {
122
+ a(k, "down", "down");
123
+ a(k, "up", "up");
124
+ var S = class {
125
125
  constructor() {
126
- 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);
126
+ 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);
127
127
  }
128
128
  static create(...t) {
129
129
  return new this(...t);
@@ -131,21 +131,21 @@ var b = class {
131
131
  isTypeof(t) {
132
132
  return t.messageType === this.messageType;
133
133
  }
134
- }, Ut = class extends b {
134
+ }, tn = class extends S {
135
135
  constructor(e) {
136
136
  super(), this.ref = e;
137
137
  }
138
- }, P = class extends b {
138
+ }, F = class extends S {
139
139
  constructor(e) {
140
140
  super(), this.replayToHandler = e;
141
141
  }
142
- }, A = class extends b {
142
+ }, B = class extends S {
143
143
  constructor(t) {
144
- super(), this.handler = t, a(this, "handlerUniqueId", j());
144
+ super(), this.handler = t, a(this, "handlerUniqueId", J());
145
145
  }
146
- }, ae = class Xe {
146
+ }, ue = class rt {
147
147
  constructor(t, n) {
148
- this.refConfig = t, this.component = n, a(this, "myop", !0), a(this, "__nonProxied"), this.__nonProxied = ue(M({}, this), {
148
+ this.refConfig = t, this.component = n, a(this, "myop", !0), a(this, "__nonProxied"), this.__nonProxied = fe(b({}, this), {
149
149
  component: null
150
150
  // in order to be serializable
151
151
  });
@@ -161,163 +161,163 @@ var b = class {
161
161
  behavior: {
162
162
  type: "code"
163
163
  }
164
- }), new Xe(i, s);
164
+ }), new rt(i, s);
165
165
  }
166
- }, Ze = "ClickReplayMessage", jt = class extends A {
166
+ }, at = "ClickReplayMessage", nn = class extends B {
167
167
  constructor(e, t) {
168
- super(t), this.ref = e, a(this, "replyMessageKey", Ze), a(this, "messageType", "BindClickMessage"), a(this, "cleanable", !0);
168
+ super(t), this.ref = e, a(this, "replyMessageKey", at), a(this, "messageType", "BindClickMessage"), a(this, "cleanable", !0);
169
169
  }
170
- }, et = class extends P {
170
+ }, ct = class extends F {
171
171
  constructor() {
172
- super(...arguments), a(this, "messageType", Ze);
172
+ super(...arguments), a(this, "messageType", at);
173
173
  }
174
- }, Vt = class extends b {
174
+ }, sn = class extends S {
175
175
  constructor(e, t) {
176
176
  super(), this.ref = e, a(this, "messageType", "ChangeTextMessage"), this.content = t;
177
177
  }
178
- }, tt = "ExecuteScriptReplyMessage", Gt = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Yt = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, nt = (e) => {
179
- let t = e.match(Gt);
178
+ }, lt = "ExecuteScriptReplyMessage", on = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, rn = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, dt = (e) => {
179
+ let t = e.match(on);
180
180
  if (t)
181
181
  return t[1] || t[3];
182
182
  {
183
- let n = e.match(Yt);
183
+ let n = e.match(rn);
184
184
  if (n)
185
185
  return n[1].trim();
186
186
  }
187
- }, $ = class extends A {
187
+ }, j = class extends B {
188
188
  constructor(t, n = () => {
189
189
  }, s) {
190
- super(n), this.scriptInputs = s, a(this, "replyMessageKey", tt), a(this, "messageType", "ExecuteScriptMessage"), a(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = nt(this.content);
190
+ super(n), this.scriptInputs = s, a(this, "replyMessageKey", lt), a(this, "messageType", "ExecuteScriptMessage"), a(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = dt(this.content);
191
191
  }
192
192
  };
193
- a($, "replierKey", "send");
194
- a($, "completeStreamKey", "completeStream");
195
- var st = class extends P {
193
+ a(j, "replierKey", "send");
194
+ a(j, "completeStreamKey", "completeStream");
195
+ var ut = class extends F {
196
196
  constructor(e, t) {
197
- super(e), this.replayToHandler = e, this.content = t, a(this, "messageType", tt);
197
+ super(e), this.replayToHandler = e, this.content = t, a(this, "messageType", lt);
198
198
  }
199
- }, xe = class extends $ {
199
+ }, ke = class extends j {
200
200
  constructor(e, t, n = () => {
201
201
  }) {
202
202
  super(({ rootRef: s, elementId: i, _script: o, __scriptInputs: r }) => {
203
203
  const c = (s.shadowRoot || s.container).querySelectorAll(`[myop-id='${i}']`);
204
204
  return c.length ? (r.ref = c[0], new Function(`return (${o})(...arguments)`)(r)) : null;
205
- }, n), this.scriptInputs = t, this.scriptInputs = ue(M({}, t), {
205
+ }, n), this.scriptInputs = t, this.scriptInputs = fe(b({}, t), {
206
206
  //_script: stripFunction(script.toString()),
207
207
  _script: e.toString()
208
208
  });
209
209
  }
210
- }, it = "EventListenerCallbackMessage", Jt = class extends A {
210
+ }, ht = "EventListenerCallbackMessage", an = class extends B {
211
211
  // {} // empty
212
212
  constructor(e, t, n) {
213
- super(n), this.ref = e, this.type = t, this.handler = n, a(this, "replyMessageKey", it), a(this, "messageType", "AddEventListenerMessage"), a(this, "cleanable", !0), a(this, "serializableSkeleton", !1);
213
+ super(n), this.ref = e, this.type = t, this.handler = n, a(this, "replyMessageKey", ht), a(this, "messageType", "AddEventListenerMessage"), a(this, "cleanable", !0), a(this, "serializableSkeleton", !1);
214
214
  }
215
215
  withSerializableSkeleton(e) {
216
216
  return this.serializableSkeleton = e, this;
217
217
  }
218
- }, ot = class extends P {
218
+ }, pt = class extends F {
219
219
  constructor(e, t) {
220
- super(e), this.replayToHandler = e, this.e = t, a(this, "messageType", it), this.content = {
220
+ super(e), this.replayToHandler = e, this.e = t, a(this, "messageType", ht), this.content = {
221
221
  e: t
222
222
  };
223
223
  }
224
- }, Qt = class extends b {
224
+ }, cn = class extends S {
225
225
  constructor(e, t, n) {
226
226
  super(), this.ref = e, this.name = t, this.value = n, a(this, "messageType", "SetAttributeMessage");
227
227
  }
228
- }, rt = "ElementValueReplayMessage", Xt = class extends A {
228
+ }, mt = "ElementValueReplayMessage", ln = class extends B {
229
229
  constructor(e, t) {
230
- super(t), this.ref = e, a(this, "replyMessageKey", rt), a(this, "messageType", "GetElementValueMessage");
230
+ super(t), this.ref = e, a(this, "replyMessageKey", mt), a(this, "messageType", "GetElementValueMessage");
231
231
  }
232
- }, at = class extends P {
232
+ }, ft = class extends F {
233
233
  constructor(e) {
234
- super(), this.content = e, a(this, "messageType", rt);
234
+ super(), this.content = e, a(this, "messageType", mt);
235
235
  }
236
- }, Zt = class extends b {
236
+ }, dn = class extends S {
237
237
  constructor(e, t) {
238
238
  super(), this.ref = e, a(this, "messageType", "SetInnerHtml"), this.content = t;
239
239
  }
240
- }, ke = class extends b {
240
+ }, Fe = class extends S {
241
241
  constructor(e) {
242
242
  super(), a(this, "messageType", "InitMessage"), this.content = { id: e };
243
243
  }
244
244
  isTypeof(e) {
245
245
  return e.messageType === this.messageType;
246
246
  }
247
- }, ct = class extends ke {
247
+ }, yt = class extends Fe {
248
248
  constructor() {
249
249
  super(...arguments), a(this, "messageType", "InitResponse");
250
250
  }
251
- }, lt = class extends b {
251
+ }, gt = class extends S {
252
252
  constructor() {
253
253
  super(...arguments), a(this, "messageType", "InitRequest");
254
254
  }
255
- }, dt = "RefComponentCreatedMessage", ut = class extends A {
255
+ }, vt = "RefComponentCreatedMessage", wt = class extends B {
256
256
  constructor(e, t, n, s) {
257
- super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n, a(this, "replyMessageKey", dt), a(this, "messageType", "CreateRefComponentMessage");
257
+ super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n, a(this, "replyMessageKey", vt), a(this, "messageType", "CreateRefComponentMessage");
258
258
  }
259
- }, Re = class extends P {
259
+ }, Le = class extends F {
260
260
  constructor(e, t, n) {
261
- super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n, a(this, "messageType", dt);
261
+ super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n, a(this, "messageType", vt);
262
262
  }
263
- }, ht = class extends b {
263
+ }, _t = class extends S {
264
264
  constructor(e, t) {
265
265
  super(), this.destination = e, this.message = t, a(this, "messageType", "EnvelopedMessage");
266
266
  const n = t;
267
267
  this.route = [e, ...n.route ? n.route : []];
268
268
  }
269
- }, pt = "DetectedMyopRefsMessage", en = class extends A {
269
+ }, Mt = "DetectedMyopRefsMessage", un = class extends B {
270
270
  constructor() {
271
- super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey", pt);
271
+ super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey", Mt);
272
272
  }
273
- }, mt = class extends P {
273
+ }, bt = class extends F {
274
274
  constructor(e, t) {
275
- super(e), this.replayToHandler = e, a(this, "messageType", pt), this.content = t;
275
+ super(e), this.replayToHandler = e, a(this, "messageType", Mt), this.content = t;
276
276
  }
277
277
  isTypeof(e) {
278
278
  return e.messageType === this.messageType;
279
279
  }
280
- }, ft = "GetAttributeReplayMessage", tn = class extends A {
280
+ }, Et = "GetAttributeReplayMessage", hn = class extends B {
281
281
  constructor(e, t, n) {
282
- super(n), this.ref = e, this.name = t, a(this, "replyMessageKey", ft), a(this, "messageType", "GetAttributeMessage");
282
+ super(n), this.ref = e, this.name = t, a(this, "replyMessageKey", Et), a(this, "messageType", "GetAttributeMessage");
283
283
  }
284
- }, nn = class extends P {
284
+ }, pn = class extends F {
285
285
  constructor(e) {
286
- super(), this.content = e, a(this, "messageType", ft);
286
+ super(), this.content = e, a(this, "messageType", Et);
287
287
  }
288
- }, N = class extends b {
288
+ }, U = class extends S {
289
289
  constructor(e) {
290
290
  super(), this.method = e, a(this, "messageType", "ExecuteComponentMethod");
291
291
  }
292
- }, sn = class extends b {
292
+ }, mn = class extends S {
293
293
  constructor() {
294
294
  super(...arguments), a(this, "messageType", "SetMutationObserverMessage");
295
295
  }
296
- }, on = class extends b {
296
+ }, fn = class extends S {
297
297
  constructor() {
298
298
  super(...arguments), a(this, "messageType", "MutationObserverMessage");
299
299
  }
300
- }, yt = "CleanupReplayMessage", gt = class extends A {
300
+ }, Ct = "CleanupReplayMessage", St = class extends B {
301
301
  constructor(e, t) {
302
- super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey", yt), a(this, "messageType", "CleanupMessage");
302
+ super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey", Ct), a(this, "messageType", "CleanupMessage");
303
303
  }
304
- }, vt = class extends P {
304
+ }, It = class extends F {
305
305
  constructor(e) {
306
- super(), this.customCleanup = e, a(this, "messageType", yt);
306
+ super(), this.customCleanup = e, a(this, "messageType", Ct);
307
307
  }
308
- }, wt = class extends b {
308
+ }, Tt = class extends S {
309
309
  constructor() {
310
310
  super(...arguments), a(this, "messageType", "DisposeMessage");
311
311
  }
312
- }, rn = class extends b {
312
+ }, yn = class extends S {
313
313
  constructor() {
314
314
  super(...arguments), a(this, "cleanable", !0), a(this, "messageType", "SetResizeObserverMessage");
315
315
  }
316
- }, an = class extends b {
316
+ }, gn = class extends S {
317
317
  constructor() {
318
318
  super(...arguments), a(this, "messageType", "ResizeObserverMessage");
319
319
  }
320
- }, Me = class {
320
+ }, Ie = class {
321
321
  constructor(e, t, n) {
322
322
  this.componentDefinition = e, this.container = t, a(this, "id", ""), a(this, "messageHandlers", {}), a(this, "element"), a(this, "_markedForDisposed", !1), a(this, "bind", (i, o) => {
323
323
  this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(o) || this.messageHandlers[i].push(o);
@@ -334,7 +334,7 @@ var st = class extends P {
334
334
  this.isInitiated = !0, this._whenInitiatedResolve && this._whenInitiatedResolve();
335
335
  }), a(this, "isInitiated", !1), a(this, "_whenInitiatedResolve"), a(this, "_whenInitiatedReject"), a(this, "_whenInitiated", new Promise((i, o) => {
336
336
  this._whenInitiatedResolve = i, this._whenInitiatedReject = o;
337
- })), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (n == null ? void 0 : n.id) || be.Instance().assignId(e);
337
+ })), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (n == null ? void 0 : n.id) || Te.Instance().assignId(e);
338
338
  const s = n != null && n.timeout ? n == null ? void 0 : n.timeout : 5 * 1e3;
339
339
  setTimeout(() => {
340
340
  !this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${s} ${this.id}`);
@@ -351,7 +351,7 @@ var st = class extends P {
351
351
  this._markedForDisposed = e;
352
352
  }
353
353
  onMessageReceived(e) {
354
- if (e.messageType === v.ExecuteComponentMethod) {
354
+ if (e.messageType === w.ExecuteComponentMethod) {
355
355
  const n = e;
356
356
  return this[n.method] ? this[n.method](n.content) : console.log(`method not found ${n.method} on component`, this), !0;
357
357
  }
@@ -365,21 +365,21 @@ var st = class extends P {
365
365
  return !1;
366
366
  }
367
367
  sendCleanupMessage(e) {
368
- e.source = this.id, e.destination = this.id, e.direction = D.down;
368
+ e.source = this.id, e.destination = this.id, e.direction = k.down;
369
369
  const t = this.bindWhen(e.replyMessageKey, (s) => s.replayToHandler === e.handlerUniqueId, (s) => {
370
370
  e.handler(s), t();
371
371
  }), n = e.handler;
372
372
  delete e.handler, this.send(e), e.handler = n;
373
373
  }
374
374
  send(e) {
375
- e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = D.down;
375
+ e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = k.down;
376
376
  let t;
377
377
  if (e.handler) {
378
378
  const n = e;
379
379
  t = this.bindWhen(n.replyMessageKey, (s) => s.replayToHandler === n.handlerUniqueId, n.handler), delete e.handler;
380
380
  }
381
381
  return e.ref && (e.ref = e.ref.__nonProxied || e.ref), e.cleanable ? () => {
382
- this.sendCleanupMessage(new gt(e.id, (n) => {
382
+ this.sendCleanupMessage(new St(e.id, (n) => {
383
383
  })), t && t();
384
384
  } : () => {
385
385
  };
@@ -387,39 +387,39 @@ var st = class extends P {
387
387
  dispose() {
388
388
  if (this.markedForDisposed = !0, !this.isInitiated)
389
389
  return;
390
- console.log("disposing component", this.id), this.send(new wt());
390
+ console.log("disposing component", this.id), this.send(new Tt());
391
391
  const e = this.messageHandlers.onDispose;
392
392
  e && e.forEach((t) => {
393
393
  t(null);
394
394
  }), this.messageHandlers = {}, this.id += "_disposed", this.isInitiated = !1;
395
395
  }
396
- }, cn = class {
396
+ }, vn = class {
397
397
  constructor(e, t, n, s, i) {
398
398
  this.myopId = e, this.htmlTagName = t, this.BoundingRect = n, this.offsetTop = s, this.offsetLeft = i, a(this, "type", "MyopElementRef");
399
399
  }
400
- }, ln = (e) => g(void 0, null, function* () {
400
+ }, wn = (e) => v(void 0, null, function* () {
401
401
  if (typeof e == "function")
402
402
  e();
403
403
  else if (e instanceof Promise) {
404
404
  const t = yield e;
405
405
  typeof t == "function" && t();
406
406
  }
407
- }), dn = class {
407
+ }), _n = class {
408
408
  //TODO : add dispose method
409
409
  constructor(e) {
410
410
  this.messageToHost = e;
411
411
  }
412
- }, un = class extends dn {
412
+ }, Mn = class extends _n {
413
413
  constructor(e, t) {
414
414
  super(e), this.messageToHost = e, this.context = t;
415
415
  }
416
- }, hn = class {
416
+ }, bn = class {
417
417
  //onMessageReceived: (msg: IMyopMessage) => void;
418
418
  constructor(e, t) {
419
419
  this.id = e, this.context = t, a(this, "send", (n) => {
420
420
  });
421
421
  }
422
- }, pn = class {
422
+ }, En = class {
423
423
  constructor() {
424
424
  a(this, "messageToHandleAfterInit", []), a(this, "components", {}), a(this, "alwaysPassEnvelopesToHost", !1), a(this, "messageCleanupCache", {});
425
425
  }
@@ -427,20 +427,20 @@ var st = class extends P {
427
427
  const t = e.data ? e.data : e.detail;
428
428
  if (!(!t || !t.myop)) {
429
429
  let n = t;
430
- if (n.direction !== D.down)
430
+ if (n.direction !== k.down)
431
431
  return;
432
- if (n.messageType === v.DisposeMessage) {
432
+ if (n.messageType === w.DisposeMessage) {
433
433
  n.destination && delete this.components[n.destination];
434
434
  return;
435
435
  }
436
- if (n.messageType === v.InitMessage) {
436
+ if (n.messageType === w.InitMessage) {
437
437
  const s = n.content.id;
438
438
  if (this.components[s])
439
439
  return;
440
- this.components[s] = new hn(s), this.messageToHost(new ct(s));
440
+ this.components[s] = new bn(s), this.messageToHost(new yt(s));
441
441
  return;
442
442
  }
443
- if (n.messageType === v.EnvelopedMessage) {
443
+ if (n.messageType === w.EnvelopedMessage) {
444
444
  const s = n, i = s.message;
445
445
  if (n = i, this.alwaysPassEnvelopesToHost || this.components[n.destination]) {
446
446
  const o = myop.hostSDK.components.find((c) => c.id === i.destination);
@@ -457,9 +457,9 @@ var st = class extends P {
457
457
  return;
458
458
  }
459
459
  if (n.messageType) {
460
- if (n.messageType === v.CleanupMessage) {
461
- const s = n, i = this.messageCleanupCache[s.cleanupForMessageId], o = new vt(!!i);
462
- o.destination = n.destination, i ? (delete this.messageCleanupCache[s.cleanupForMessageId], ln(i).then(() => {
460
+ if (n.messageType === w.CleanupMessage) {
461
+ const s = n, i = this.messageCleanupCache[s.cleanupForMessageId], o = new It(!!i);
462
+ o.destination = n.destination, i ? (delete this.messageCleanupCache[s.cleanupForMessageId], wn(i).then(() => {
463
463
  this.messageToHost(o, s);
464
464
  }).catch(() => {
465
465
  })) : this.messageToHost(o, s);
@@ -486,21 +486,21 @@ To ensure cleanup properly set 'cleanable' true at message definition and return
486
486
  console.log("unsupported message type");
487
487
  }
488
488
  }
489
- }, ce = {
489
+ }, he = {
490
490
  IframeLoader: "IframeLoader",
491
491
  WebComponentLoader: "WebComponentLoader",
492
492
  HTMLLoader: "HTMLLoader"
493
- }, le = {
493
+ }, pe = {
494
494
  open: "open",
495
495
  none: "none",
496
496
  localFrame: "localFrame"
497
- }, ve = {
497
+ }, Ee = {
498
498
  code: "code"
499
- }, Le = class {
499
+ }, Be = class {
500
500
  };
501
- a(Le, "code", "code");
502
- a(Le, "component", "component");
503
- var re = {
501
+ a(Be, "code", "code");
502
+ a(Be, "component", "component");
503
+ var de = {
504
504
  Segmented: "Segmented",
505
505
  Dedicated: "Dedicated",
506
506
  /**
@@ -510,33 +510,33 @@ var re = {
510
510
  * @type {string}
511
511
  */
512
512
  Default: "Default"
513
- }, _t = {
513
+ }, xt = {
514
514
  Segment: "Segment",
515
515
  Promo: "Promo",
516
516
  AB: "AB"
517
- }, mn = class {
517
+ }, Cn = class {
518
518
  constructor(e, t) {
519
519
  this.container = e, this.shadowRoot = t, a(this, "getRootDiv", () => (this.shadowRoot || this.container).querySelector("div")), a(this, "getRoot", () => this.shadowRoot || this.container);
520
520
  }
521
- }, He = (e) => e !== Object(e), fn = (e) => typeof e == "function", Mt = (e) => {
522
- if (He(e))
521
+ }, Oe = (e) => e !== Object(e), Sn = (e) => typeof e == "function", Ht = (e) => {
522
+ if (Oe(e))
523
523
  return !0;
524
- if (fn(e) || Object.getPrototypeOf(e))
524
+ if (Sn(e) || Object.getPrototypeOf(e))
525
525
  return !1;
526
526
  for (const t in e) {
527
527
  const n = e[t];
528
528
  if (typeof n == "object") {
529
- if (!Mt(n))
529
+ if (!Ht(n))
530
530
  return !1;
531
531
  } else {
532
- if (He(n))
532
+ if (Oe(n))
533
533
  continue;
534
534
  return !1;
535
535
  }
536
536
  }
537
537
  return !0;
538
- }, J = (e, t = {}, n = !0, s = /* @__PURE__ */ new WeakMap()) => {
539
- if (He(e))
538
+ }, oe = (e, t = {}, n = !0, s = /* @__PURE__ */ new WeakMap()) => {
539
+ if (Oe(e))
540
540
  return e;
541
541
  if (Array.isArray(e)) {
542
542
  if (s.has(e))
@@ -545,7 +545,7 @@ var re = {
545
545
  s.set(e, i);
546
546
  for (let o = 0; o < e.length; o++) {
547
547
  const r = e[o];
548
- i[o] = J(r, t, n, s);
548
+ i[o] = oe(r, t, n, s);
549
549
  }
550
550
  return i;
551
551
  }
@@ -556,12 +556,12 @@ var re = {
556
556
  s.set(e, i);
557
557
  for (const o in e) {
558
558
  const r = typeof t == "boolean" ? t : t[o];
559
- r && (r === !0 ? (n ? e[o] !== void 0 : e[o]) && (i[o] = J(e[o], !0, n, s)) : typeof r == "object" && (i[o] = J(e[o], r, n, s)));
559
+ r && (r === !0 ? (n ? e[o] !== void 0 : e[o]) && (i[o] = oe(e[o], !0, n, s)) : typeof r == "object" && (i[o] = oe(e[o], r, n, s)));
560
560
  }
561
561
  return i;
562
562
  }
563
563
  return {};
564
- }, yn = {
564
+ }, In = {
565
565
  notSerializableRefCall: (e, t) => {
566
566
  throw new Error(`
567
567
  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.
@@ -595,34 +595,34 @@ For more details on serialization and Myop message examples, refer to https://do
595
595
 
596
596
  `);
597
597
  }
598
- }, We = class extends Me {
598
+ }, Qe = class extends Ie {
599
599
  constructor(e, t, n) {
600
600
  super(e, t.container, n), this.componentDefinition = e, this.parent = t, a(this, "send", (s) => {
601
601
  const i = s.handler, o = super.send(s);
602
- return this.parent.send(new ht(this.id, s)), s.handler = i, o;
602
+ return this.parent.send(new _t(this.id, s)), s.handler = i, o;
603
603
  }), a(this, "dispose", () => {
604
- this.isInitiated && this.send(new N("dispose")), super.dispose();
604
+ this.isInitiated && this.send(new U("dispose")), super.dispose();
605
605
  });
606
606
  }
607
607
  hide() {
608
- this.send(new N("hide"));
608
+ this.send(new U("hide"));
609
609
  }
610
610
  show() {
611
- this.send(new N("show"));
611
+ this.send(new U("show"));
612
612
  }
613
613
  inspect() {
614
- return this.send(new N("inspect"));
614
+ return this.send(new U("inspect"));
615
615
  }
616
616
  setHeightBasedOnDocumentElement() {
617
- this.send(new N("setHeightBasedOnDocumentElement"));
617
+ this.send(new U("setHeightBasedOnDocumentElement"));
618
618
  }
619
619
  setHeightBasedOnScrollHeight() {
620
- this.send(new N("setHeightBasedOnScrollHeight"));
620
+ this.send(new U("setHeightBasedOnScrollHeight"));
621
621
  }
622
622
  onMessageReceived(e) {
623
623
  return super.onMessageReceived(e);
624
624
  }
625
- }, De = class extends Me {
625
+ }, Pe = class extends Ie {
626
626
  constructor(e, t, n, s, i, o) {
627
627
  super(e, n, o), this.container = n, this.customElement = s, this.tagName = i, a(this, "ctaCleanup"), a(this, "_ctaHandler"), a(this, "_ctaQueue", []), a(this, "cleanupInspect", () => {
628
628
  }), a(this, "send", (r) => {
@@ -634,7 +634,7 @@ For more details on serialization and Myop message examples, refer to https://do
634
634
  }), this.element = s, this.setInitiated();
635
635
  }
636
636
  inspect() {
637
- return this.cleanupInspect = Oe(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
637
+ return this.cleanupInspect = Ne(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
638
638
  }
639
639
  hide() {
640
640
  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";
@@ -678,15 +678,15 @@ For more details on serialization and Myop message examples, refer to https://do
678
678
  this.customElement.removeEventListener("myop-cta", t);
679
679
  };
680
680
  }
681
- }, gn = (e, t, n) => {
681
+ }, Tn = (e, t, n) => {
682
682
  const s = document.createElement("a");
683
683
  return s.textContent = e, s.style.position = "relative", s.style.padding = "0 5px", s.style.fontSize = "14px", s.style.top = "0", s.style.top = `${t}px`, s.style.transform = "translateX(-50%)", s.target = "_blank", s.href = `https://dashboard.myop.dev/dashboard/component/${n.id}`, s;
684
- }, Oe = (e, t, n, s, i, o) => {
685
- const r = gn(`${o.name} : ${t}`, n, o);
684
+ }, Ne = (e, t, n, s, i, o) => {
685
+ const r = Tn(`${o.name} : ${t}`, n, o);
686
686
  return s.insertBefore(r, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
687
687
  i.style.border = "unset", s.removeChild(r);
688
688
  };
689
- }, Ke = (e, t, n) => e ? !1 : (console.error(
689
+ }, Je = (e, t, n) => e ? !1 : (console.error(
690
690
  // throw new Error(
691
691
  `Error: Undefined Prop
692
692
 
@@ -697,7 +697,7 @@ Prop Name: ${t}
697
697
  Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
698
698
 
699
699
  For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
700
- ), !0), ze = (e, t, n) => {
700
+ ), !0), Xe = (e, t, n) => {
701
701
  console.error(
702
702
  `Error: Code Prop Not Supported
703
703
 
@@ -711,64 +711,64 @@ Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
711
711
 
712
712
  For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
713
713
  );
714
- }, vn = (e, t, n) => {
715
- const s = t.reduce((o, r) => ue(M({}, o), {
716
- [r.name]: M({}, r)
714
+ }, xn = (e, t, n) => {
715
+ const s = t.reduce((o, r) => fe(b({}, o), {
716
+ [r.name]: b({}, r)
717
717
  }), {}), i = {
718
718
  get: (o, r) => {
719
719
  const c = s[r];
720
- if (Ke(c, r, e))
720
+ if (Je(c, r, e))
721
721
  return !1;
722
- if (c.behavior.type === ve.code) {
723
- if (e instanceof De)
722
+ if (c.behavior.type === Ee.code) {
723
+ if (e instanceof Pe)
724
724
  return (c.behavior.remap || r) === "myop_init_interface" ? (u) => {
725
725
  if (u === void 0)
726
726
  return e.getData();
727
727
  e.initWithData(u);
728
728
  } : void 0;
729
- if (n.loader.type === ce.HTMLLoader && n.loader.shadowRootMode === le.localFrame) {
729
+ if (n.loader.type === he.HTMLLoader && n.loader.shadowRootMode === pe.localFrame) {
730
730
  const d = c.behavior;
731
731
  return e.element.contentWindow[d.remap || r];
732
732
  }
733
- return ze(c, r, e), !1;
733
+ return Xe(c, r, e), !1;
734
734
  }
735
735
  return c.mode === "output" ? new Promise((l) => {
736
736
  const d = [];
737
- c.behavior.ref && d.push(ae.create(c.behavior.ref)), d.push((h) => {
737
+ c.behavior.ref && d.push(ue.create(c.behavior.ref)), d.push((h) => {
738
738
  l(h);
739
739
  }), c.behavior.params && d.push(...c.behavior.params);
740
- const u = Te[c.behavior.message];
740
+ const u = De[c.behavior.message];
741
741
  e.send(new u(...d));
742
742
  }) : null;
743
743
  },
744
744
  set: (o, r, c) => {
745
745
  const l = s[r];
746
- if (Ke(l, r, e))
746
+ if (Je(l, r, e))
747
747
  return !1;
748
- if (l.behavior.type === ve.code) {
749
- if (e instanceof De) {
748
+ if (l.behavior.type === Ee.code) {
749
+ if (e instanceof Pe) {
750
750
  const u = l.behavior.remap || r;
751
751
  if (u === "myop_cta_handler")
752
752
  return e.setCtaHandler(c), !0;
753
753
  if (u === "myop_init_interface")
754
754
  return e.initWithData(c), !0;
755
755
  }
756
- if (n.loader.type === ce.HTMLLoader && n.loader.shadowRootMode === le.localFrame) {
757
- const u = l.behavior, h = e.element.contentWindow, f = u.remap || r;
758
- if (h[f] = c, f === "myop_cta_handler" && h.__myop_cta_queue) {
759
- const y = h.__myop_cta_queue;
760
- h.__myop_cta_queue = null, y.forEach((m) => {
761
- e.markedForDisposed || c(m.action, m.payload);
756
+ if (n.loader.type === he.HTMLLoader && n.loader.shadowRootMode === pe.localFrame) {
757
+ const u = l.behavior, h = e.element.contentWindow, m = u.remap || r;
758
+ if (h[m] = c, m === "myop_cta_handler" && h.__myop_cta_queue) {
759
+ const f = h.__myop_cta_queue;
760
+ h.__myop_cta_queue = null, f.forEach((y) => {
761
+ e.markedForDisposed || c(y.action, y.payload);
762
762
  });
763
763
  }
764
764
  return !0;
765
765
  }
766
- return ze(l, r, e), !1;
766
+ return Xe(l, r, e), !1;
767
767
  } else if (l.mode === "input")
768
768
  if (l.behavior.type === "message") {
769
769
  const d = [];
770
- l.behavior.ref && d.push(ae.create(l.behavior.ref)), d.push(c), l.behavior.params && d.push(...l.behavior.params);
771
- const u = Te[l.behavior.message];
770
+ l.behavior.ref && d.push(ue.create(l.behavior.ref)), d.push(c), l.behavior.params && d.push(...l.behavior.params);
771
+ const u = De[l.behavior.message];
772
772
  return e.send(new u(...d)), !0;
773
773
  } else
774
774
  throw new Error(
@@ -786,12 +786,12 @@ Check the documentation for valid behavior options.`
786
786
  }
787
787
  };
788
788
  return e.props = {}, e.props = new Proxy(e.props, i), e;
789
- }, wn = (e, t) => new Proxy(e, {
789
+ }, Hn = (e, t) => new Proxy(e, {
790
790
  get(n, s) {
791
791
  return n[s] ? n[s] : (...o) => new Promise((r) => {
792
792
  o.forEach((c) => {
793
- Mt(c) || yn.notSerializableRefCall(s, c);
794
- }), t.send(new xe(
793
+ Ht(c) || In.notSerializableRefCall(s, c);
794
+ }), t.send(new ke(
795
795
  ({ ref: c, propName: l, functionArgs: d, makeSerializable: u }) => {
796
796
  if (c) {
797
797
  const h = c[l];
@@ -812,7 +812,7 @@ Check the documentation for valid behavior options.`
812
812
  });
813
813
  },
814
814
  set(n, s, i) {
815
- return t.send(new xe(
815
+ return t.send(new ke(
816
816
  ({ ref: o, propName: r, propValue: c }) => {
817
817
  o && (o[r] = c);
818
818
  },
@@ -826,24 +826,24 @@ Check the documentation for valid behavior options.`
826
826
  }
827
827
  )), !0;
828
828
  }
829
- }), bt = (e, t, n, s) => g(void 0, null, function* () {
829
+ }), Rt = (e, t, n, s) => v(void 0, null, function* () {
830
830
  const i = e.component;
831
831
  if (!i)
832
832
  throw new Error("cant createRefComponent with detached ref");
833
- return new Promise((o, r) => g(void 0, null, function* () {
834
- const c = new We(t.type, i, s);
833
+ return new Promise((o, r) => v(void 0, null, function* () {
834
+ const c = new Qe(t.type, i, s);
835
835
  n.push(c), yield i.initiated();
836
836
  const l = setTimeout(() => {
837
837
  r("timeout");
838
838
  }, 5e3);
839
- i.send(new ut(
839
+ i.send(new wt(
840
840
  e.refConfig,
841
841
  t,
842
- ue(M({}, s || {}), {
842
+ fe(b({}, s || {}), {
843
843
  id: c.id,
844
844
  _hasParent: !0
845
845
  }),
846
- (d) => g(void 0, null, function* () {
846
+ (d) => v(void 0, null, function* () {
847
847
  if (clearTimeout(l), d.failed) {
848
848
  r("CreateRefComponentMessage failed");
849
849
  return;
@@ -855,42 +855,42 @@ Check the documentation for valid behavior options.`
855
855
  } else
856
856
  c.setInitiated(), i.refs[e.refConfig.name] = c;
857
857
  d.nestedRefs.forEach((h) => {
858
- const f = t.instance.resolvedNestedComponents.find((m) => m.type.id === h.componentDefinitionId).type, y = new We(f, c);
859
- y.setInitiated(), c.refs[h.refName] = y, n.push(y);
858
+ const m = t.instance.resolvedNestedComponents.find((y) => y.type.id === h.componentDefinitionId).type, f = new Qe(m, c);
859
+ f.setInitiated(), c.refs[h.refName] = f, n.push(f);
860
860
  });
861
861
  try {
862
- yield Et(c, t, n, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), o(c);
862
+ yield Dt(c, t, n, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), o(c);
863
863
  } catch (h) {
864
864
  r(h);
865
865
  }
866
866
  })
867
867
  ));
868
868
  }));
869
- }), Et = (e, t, n, s = !1) => g(void 0, null, function* () {
869
+ }), Dt = (e, t, n, s = !1) => v(void 0, null, function* () {
870
870
  e.refs || (e.refs = {});
871
- const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, c) => g(void 0, null, function* () {
871
+ const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, c) => v(void 0, null, function* () {
872
872
  var l;
873
- if (o.behavior.type == Le.component) {
873
+ if (o.behavior.type == Be.component) {
874
874
  if (s) {
875
875
  r();
876
876
  return;
877
877
  }
878
878
  let d = o.behavior.componentId;
879
879
  d || (d = o.behavior.instance.componentId);
880
- const u = (l = t.instance.resolvedNestedComponents) == null ? void 0 : l.find((f) => f.type.id === d);
880
+ const u = (l = t.instance.resolvedNestedComponents) == null ? void 0 : l.find((m) => m.type.id === d);
881
881
  if (!u)
882
882
  throw new Error("componentConfig provided without nestedComponentConfig check the config object");
883
- const h = ae.create("", o, e);
883
+ const h = ue.create("", o, e);
884
884
  try {
885
- const f = yield bt(h, u, n);
886
- e.refs[o.name] = f, r();
887
- } catch (f) {
888
- c(f);
885
+ const m = yield Rt(h, u, n);
886
+ e.refs[o.name] = m, r();
887
+ } catch (m) {
888
+ c(m);
889
889
  }
890
890
  } else
891
891
  try {
892
- const d = ae.create("", o, e);
893
- e.refs[o.name] = wn(d, e), r();
892
+ const d = ue.create("", o, e);
893
+ e.refs[o.name] = Hn(d, e), r();
894
894
  } catch {
895
895
  }
896
896
  })));
@@ -899,13 +899,13 @@ Check the documentation for valid behavior options.`
899
899
  } catch (o) {
900
900
  throw o;
901
901
  }
902
- }), Ct = class extends Me {
902
+ }), kt = class extends Ie {
903
903
  constructor(e, t, n, s, i) {
904
- super(e, n, i), this.componentConfig = e, this.container = n, this.IframeElement = s, a(this, "cleanupInspect"), a(this, "setHeightBasedOnDocumentElement", () => {
905
- const o = this.send(new $(() => window.document.documentElement.scrollHeight, (r) => {
904
+ super(e, n, i), this.componentConfig = e, this.container = n, this.IframeElement = s, a(this, "sizeMeta"), a(this, "cleanupInspect"), a(this, "setHeightBasedOnDocumentElement", () => {
905
+ const o = this.send(new j(() => window.document.documentElement.scrollHeight, (r) => {
906
906
  this.IframeElement.style.height = `${r.content}px`, o();
907
907
  }));
908
- }), a(this, "observeSizeBasedOnDocumentElement", () => this.send(new $(({ send: r }) => {
908
+ }), a(this, "observeSizeBasedOnDocumentElement", () => this.send(new j(({ send: r }) => {
909
909
  const { height: c, width: l } = document.documentElement.getBoundingClientRect(), d = new ResizeObserver(() => {
910
910
  const { height: u, width: h } = document.documentElement.getBoundingClientRect();
911
911
  r({ height: u, width: h });
@@ -914,49 +914,59 @@ Check the documentation for valid behavior options.`
914
914
  }, (r) => {
915
915
  this.IframeElement.style.width = `${r.content.width}px`, this.IframeElement.style.height = `${r.content.height}px`;
916
916
  }))), a(this, "observeAutoSize", (o) => {
917
- var r;
918
- const c = this.IframeElement, l = c.contentDocument;
919
- if (!l)
917
+ var r, c, l, d, u, h, m;
918
+ const f = this.IframeElement, y = f.contentDocument;
919
+ if (!y)
920
920
  return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"), () => {
921
921
  };
922
- const d = (C, S, L) => S !== void 0 && C < S ? S : L !== void 0 && C > L ? L : C, u = (C) => {
923
- if (C === void 0) return;
924
- if (typeof C == "number") return C;
925
- const S = parseFloat(C);
926
- return isNaN(S) ? void 0 : S;
927
- }, h = u(o == null ? void 0 : o.minWidth), f = u(o == null ? void 0 : o.maxWidth), y = u(o == null ? void 0 : o.minHeight), m = u(o == null ? void 0 : o.maxHeight), x = (r = o == null ? void 0 : o.loaderMinHeight) != null ? r : 50, w = (o == null ? void 0 : o.explicitWidth) !== void 0, E = (o == null ? void 0 : o.explicitHeight) !== void 0, R = this.container.getBoundingClientRect(), k = R.width === 0, he = R.height === 0 || R.height === x, V = (o != null && o.forceAutoSize || k) && !w, z = (o != null && o.forceAutoSize || he) && !E;
928
- if (!V && !z)
929
- return () => {
922
+ const x = (g, _, H) => _ !== void 0 && g < _ ? _ : H !== void 0 && g > H ? H : g, I = (g) => {
923
+ if (g === void 0) return;
924
+ if (typeof g == "number") return g;
925
+ const _ = parseFloat(g);
926
+ return isNaN(_) ? void 0 : _;
927
+ }, E = I(o == null ? void 0 : o.minWidth), C = I(o == null ? void 0 : o.maxWidth), L = I(o == null ? void 0 : o.minHeight), D = I(o == null ? void 0 : o.maxHeight), X = (r = o == null ? void 0 : o.loaderMinHeight) != null ? r : 50, ye = ((c = this.sizeMeta) == null ? void 0 : c.width) === "100%" ? "100%" : void 0, ge = ((l = this.sizeMeta) == null ? void 0 : l.height) === "100%" ? "100%" : void 0, ae = (u = (d = o == null ? void 0 : o.explicitWidth) != null ? d : ye) != null ? u : "100%", Y = (h = o == null ? void 0 : o.explicitHeight) != null ? h : ge, Z = ae !== void 0, ce = Y !== void 0, ee = this.container.getBoundingClientRect(), ve = ee.width === 0, we = ee.height === 0 || ee.height === X, $ = (o != null && o.forceAutoSize || ve) && !Z, z = (o != null && o.forceAutoSize || we) && !ce;
928
+ if (!$ && !z) {
929
+ const g = typeof ae == "number" ? ae : void 0, _ = typeof Y == "number" ? Y : void 0;
930
+ return (g !== void 0 || _ !== void 0) && ((m = o == null ? void 0 : o.onSizeChange) == null || m.call(o, {
931
+ width: g,
932
+ height: _,
933
+ autoSizingWidth: !1,
934
+ autoSizingHeight: !1
935
+ })), () => {
930
936
  };
931
- const pe = () => {
932
- var C;
933
- const S = c.contentDocument;
934
- if (S) {
935
- const L = S.documentElement.getBoundingClientRect(), X = Math.ceil(L.width), Z = Math.ceil(L.height), ee = d(X, h, f), _ = d(Z, y, m);
936
- V && (c.style.width = `${ee}px`), z && (c.style.height = `${_}px`);
937
- const q = V && f !== void 0 && X > f, I = z && m !== void 0 && Z > m;
938
- S.documentElement.style.overflowX = q ? "auto" : "hidden", S.documentElement.style.overflowY = I ? "auto" : "hidden", (C = o == null ? void 0 : o.onSizeChange) == null || C.call(o, {
939
- width: ee,
940
- height: _,
941
- autoSizingWidth: V,
937
+ }
938
+ const te = () => {
939
+ var g;
940
+ const _ = f.contentDocument;
941
+ if (_) {
942
+ z && (f.style.height = "0px"), $ && (f.style.width = "0px");
943
+ const H = Math.ceil(_.documentElement.scrollWidth), K = Math.ceil(_.documentElement.scrollHeight), q = x(H, E, C), T = x(K, L, D);
944
+ $ && (f.style.width = `${q}px`), z && (f.style.height = `${T}px`);
945
+ const Q = $ && C !== void 0 && H > C, O = z && D !== void 0 && K > D;
946
+ _.documentElement.style.overflowX = Q ? "auto" : "", _.documentElement.style.overflowY = O ? "auto" : "", (g = o == null ? void 0 : o.onSizeChange) == null || g.call(o, {
947
+ width: q,
948
+ height: T,
949
+ autoSizingWidth: $,
942
950
  autoSizingHeight: z
943
951
  });
944
952
  }
945
953
  };
946
- pe();
947
- const me = new ResizeObserver(pe);
948
- return me.observe(l.body), me.observe(l.documentElement), () => {
949
- me.disconnect();
954
+ te();
955
+ const M = new ResizeObserver(te);
956
+ M.observe(y.body), M.observe(y.documentElement);
957
+ const W = new MutationObserver(te);
958
+ return W.observe(y.body, { childList: !0, subtree: !0, characterData: !0, attributes: !0 }), () => {
959
+ M.disconnect(), W.disconnect();
950
960
  };
951
961
  }), a(this, "setSizeBasedOnDocumentElement", () => {
952
- const o = this.send(new $(() => {
962
+ const o = this.send(new j(() => {
953
963
  const { height: r, width: c } = document.documentElement.getBoundingClientRect();
954
964
  return { height: r, width: c };
955
965
  }, (r) => {
956
966
  this.IframeElement.style.width = `${r.content.width}px`, this.IframeElement.style.height = `${r.content.height}px`, o();
957
967
  }));
958
968
  }), a(this, "setHeightBasedOnScrollHeight", () => {
959
- const o = this.send(new $(() => {
969
+ const o = this.send(new j(() => {
960
970
  let c = 0;
961
971
  return c++, c--, Math.max(
962
972
  Math.max(
@@ -970,11 +980,11 @@ Check the documentation for valid behavior options.`
970
980
  }));
971
981
  }), a(this, "send", (o) => {
972
982
  var r, c;
973
- let l = M({}, o);
974
- if (l.messageType === v.ExecuteComponentMethod)
983
+ let l = b({}, o);
984
+ if (l.messageType === w.ExecuteComponentMethod)
975
985
  return this[l.method](), () => {
976
986
  };
977
- l.direction = D.down;
987
+ l.direction = k.down;
978
988
  const d = super.send(l);
979
989
  return (c = (r = this.IframeElement) == null ? void 0 : r.contentWindow) == null || c.postMessage(l, "*"), d;
980
990
  }), a(this, "dispose", () => {
@@ -984,7 +994,7 @@ Check the documentation for valid behavior options.`
984
994
  }), this.element = this.IframeElement;
985
995
  }
986
996
  inspect() {
987
- return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = Oe(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
997
+ return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = Ne(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
988
998
  this.cleanupInspect(), this.cleanupInspect = void 0;
989
999
  });
990
1000
  }
@@ -995,9 +1005,9 @@ Check the documentation for valid behavior options.`
995
1005
  this.IframeElement.style.opacity = "1", this.IframeElement.style.position = "unset", this.IframeElement.style.pointerEvents = "all", this.IframeElement.style.visibility = "visible";
996
1006
  }
997
1007
  onMessageReceived(e) {
998
- return e.messageType === v.In.MutationObserverMessage || e.messageType === v.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
1008
+ return e.messageType === w.In.MutationObserverMessage || e.messageType === w.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
999
1009
  }
1000
- }, Pe = class {
1010
+ }, $e = class {
1001
1011
  constructor() {
1002
1012
  a(this, "appendChild", (e, t, n) => {
1003
1013
  var s;
@@ -1012,18 +1022,18 @@ Check the documentation for valid behavior options.`
1012
1022
  return e.appendChild(t);
1013
1023
  });
1014
1024
  }
1015
- }, _n = (e, t, n) => {
1025
+ }, Rn = (e, t, n) => {
1016
1026
  const s = new URL(e);
1017
1027
  return s.searchParams.append(t, n), s.toString();
1018
- }, Mn = class extends Pe {
1028
+ }, Dn = class extends $e {
1019
1029
  constructor() {
1020
- super(...arguments), a(this, "type", ce.IframeLoader), a(this, "load", (e, t, n, s) => g(this, null, function* () {
1030
+ super(...arguments), a(this, "type", he.IframeLoader), a(this, "load", (e, t, n, s) => v(this, null, function* () {
1021
1031
  let i;
1022
1032
  const o = t.loader;
1023
1033
  if ((n == null ? void 0 : n.nodeName) === "IFRAME")
1024
1034
  console.log("needs to load into an exsisting Iframe...", o.url, n), i = n, i.src = o.url;
1025
1035
  else {
1026
- const r = j(), c = `myop-comp-${r}`;
1036
+ const r = J(), c = `myop-comp-${r}`;
1027
1037
  i = document.createElement("iframe"), i.id = c;
1028
1038
  const l = `
1029
1039
  padding: 0;
@@ -1041,19 +1051,19 @@ Check the documentation for valid behavior options.`
1041
1051
  h === "" || h === null || h === void 0 ? i.setAttribute(u, "") : i.setAttribute(u, String(h));
1042
1052
  });
1043
1053
  let d = t.loader.url;
1044
- s != null && s._hasParent && (d = _n(d, "_myop-comp", r)), i.src = d, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), i = this.appendChild(n, i, s);
1054
+ s != null && s._hasParent && (d = Rn(d, "_myop-comp", r)), i.src = d, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), i = this.appendChild(n, i, s);
1045
1055
  }
1046
- return new Ct(e, t, n, i, s);
1056
+ return new kt(e, t, n, i, s);
1047
1057
  }));
1048
1058
  }
1049
- }, St = {
1059
+ }, Lt = {
1050
1060
  webcomponent_message_key: "myop_webcomponent_message"
1051
- }, It = class extends Me {
1061
+ }, Ot = class extends Ie {
1052
1062
  constructor(e, t, n, s, i) {
1053
1063
  super(e, n, i), this.container = n, this.customElement = s, a(this, "cleanupInspect", () => {
1054
1064
  }), a(this, "send", (o) => {
1055
- let r = M({}, o);
1056
- const c = super.send(r), l = new CustomEvent(St.webcomponent_message_key, {
1065
+ let r = b({}, o);
1066
+ const c = super.send(r), l = new CustomEvent(Lt.webcomponent_message_key, {
1057
1067
  // @ts-ignore
1058
1068
  detail: r
1059
1069
  // bubbles: true,
@@ -1072,7 +1082,7 @@ Check the documentation for valid behavior options.`
1072
1082
  }), this.element = s;
1073
1083
  }
1074
1084
  inspect() {
1075
- return this.cleanupInspect = Oe(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1085
+ return this.cleanupInspect = Ne(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
1076
1086
  }
1077
1087
  hide() {
1078
1088
  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";
@@ -1080,31 +1090,31 @@ Check the documentation for valid behavior options.`
1080
1090
  show() {
1081
1091
  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 = "";
1082
1092
  }
1083
- }, Se = {}, bn = class extends Pe {
1093
+ }, He = {}, kn = class extends $e {
1084
1094
  constructor() {
1085
- super(...arguments), a(this, "type", ce.WebComponentLoader), a(this, "load", (e, t, n, s) => g(this, null, function* () {
1095
+ super(...arguments), a(this, "type", he.WebComponentLoader), a(this, "load", (e, t, n, s) => v(this, null, function* () {
1086
1096
  const i = t.loader;
1087
- Se[i.url] ? console.log("Module alreday loaded or in loading process") : Se[i.url] = new Promise((c, l) => {
1097
+ He[i.url] ? console.log("Module alreday loaded or in loading process") : He[i.url] = new Promise((c, l) => {
1088
1098
  const d = i.url, u = document.createElement("script");
1089
1099
  u.type = "module", u.src = d, u.onload = () => {
1090
1100
  c();
1091
1101
  }, u.onerror = () => {
1092
1102
  l();
1093
1103
  }, document.head.appendChild(u);
1094
- }), yield Se[i.url], yield qt(1);
1095
- let o = `myop-comp-${j()}`;
1104
+ }), yield He[i.url], yield en(1);
1105
+ let o = `myop-comp-${J()}`;
1096
1106
  const r = document.createElement(i.tag);
1097
- return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.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"), s != null && s._environment && (r._myopEnvironment = s == null ? void 0 : s._environment), this.appendChild(n, r, s), new It(e, t, n, r, s);
1107
+ return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.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"), s != null && s._environment && (r._myopEnvironment = s == null ? void 0 : s._environment), this.appendChild(n, r, s), new Ot(e, t, n, r, s);
1098
1108
  }));
1099
1109
  }
1100
- }, En = "0.3.17", B = class extends un {
1110
+ }, Ln = "0.3.19", N = class extends Mn {
1101
1111
  constructor(e, t) {
1102
1112
  super(e), this.context = t, a(this, "executor", (n) => {
1103
1113
  if (n.destination) {
1104
1114
  const s = n.destination;
1105
1115
  if (this.context[s].context) {
1106
1116
  const i = (o, r) => {
1107
- this.messageToHost(ue(M({}, o), {
1117
+ this.messageToHost(fe(b({}, o), {
1108
1118
  source: n.destination ? n.destination : n.source,
1109
1119
  destination: n.source ? n.source : n.destination
1110
1120
  }), r);
@@ -1116,15 +1126,15 @@ Check the documentation for valid behavior options.`
1116
1126
  debugger;
1117
1127
  });
1118
1128
  }
1119
- }, de = {
1129
+ }, me = {
1120
1130
  id: "myop-id"
1121
- }, Q = (e, t) => t.querySelectorAll(`[${de.id}='${e.refConfig.selector}']`), Cn = class extends B {
1131
+ }, re = (e, t) => t.querySelectorAll(`[${me.id}='${e.refConfig.selector}']`), On = class extends N {
1122
1132
  constructor() {
1123
- super(...arguments), a(this, "messageType", v.BindClickMessage), a(this, "innerExecutor", (e, t, n) => {
1124
- const s = Q(e.ref, t.shadowRoot), i = [];
1133
+ super(...arguments), a(this, "messageType", w.BindClickMessage), a(this, "innerExecutor", (e, t, n) => {
1134
+ const s = re(e.ref, t.shadowRoot), i = [];
1125
1135
  return s.forEach((o) => {
1126
1136
  const r = () => {
1127
- n(new et(e.handlerUniqueId));
1137
+ n(new ct(e.handlerUniqueId));
1128
1138
  };
1129
1139
  o.addEventListener("click", r), i.push(() => {
1130
1140
  o.removeEventListener("click", r);
@@ -1134,44 +1144,44 @@ Check the documentation for valid behavior options.`
1134
1144
  };
1135
1145
  });
1136
1146
  }
1137
- }, Sn = class extends B {
1147
+ }, Pn = class extends N {
1138
1148
  constructor() {
1139
- super(...arguments), a(this, "messageType", v.ChangeTextMessage), a(this, "innerExecutor", (e, t) => {
1140
- Q(e.ref, t.shadowRoot).forEach((s) => {
1149
+ super(...arguments), a(this, "messageType", w.ChangeTextMessage), a(this, "innerExecutor", (e, t) => {
1150
+ re(e.ref, t.shadowRoot).forEach((s) => {
1141
1151
  s.textContent = e.content;
1142
1152
  });
1143
1153
  });
1144
1154
  }
1145
- }, In = class extends mn {
1155
+ }, An = class extends Cn {
1146
1156
  constructor(e, t) {
1147
1157
  super(e, t), this.container = e, this.shadowRoot = t;
1148
1158
  }
1149
- }, Tn = class extends B {
1159
+ }, Fn = class extends N {
1150
1160
  constructor() {
1151
1161
  super(...arguments), a(this, "innerExecutor", (e, t) => {
1152
- const n = t.shadowRoot.querySelectorAll(`[${de.id}]`);
1162
+ const n = t.shadowRoot.querySelectorAll(`[${me.id}]`);
1153
1163
  let s = [];
1154
1164
  n.forEach((i) => {
1155
- const o = i.getAttribute(de.id);
1156
- o && s.push(new cn(o, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1157
- }), this.messageToHost(new mt(e.handlerUniqueId, s));
1158
- }), a(this, "messageType", v.DetectMyopRefsMessage);
1165
+ const o = i.getAttribute(me.id);
1166
+ o && s.push(new vn(o, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
1167
+ }), this.messageToHost(new bt(e.handlerUniqueId, s));
1168
+ }), a(this, "messageType", w.DetectMyopRefsMessage);
1159
1169
  }
1160
- }, xn = class extends B {
1170
+ }, Bn = class extends N {
1161
1171
  constructor() {
1162
- super(...arguments), a(this, "messageType", v.SetAttributeMessage), a(this, "innerExecutor", (e, t) => {
1163
- Q(e.ref, t.shadowRoot).forEach((s) => {
1172
+ super(...arguments), a(this, "messageType", w.SetAttributeMessage), a(this, "innerExecutor", (e, t) => {
1173
+ re(e.ref, t.shadowRoot).forEach((s) => {
1164
1174
  s.setAttribute(e.name, e.value);
1165
1175
  });
1166
1176
  });
1167
1177
  }
1168
- }, Rn = class extends B {
1178
+ }, Nn = class extends N {
1169
1179
  constructor() {
1170
- super(...arguments), a(this, "messageType", v.AddEventListenerMessage), a(this, "innerExecutor", (e, t, n) => {
1171
- const s = Q(e.ref, t.shadowRoot), i = [];
1180
+ super(...arguments), a(this, "messageType", w.AddEventListenerMessage), a(this, "innerExecutor", (e, t, n) => {
1181
+ const s = re(e.ref, t.shadowRoot), i = [];
1172
1182
  return s.forEach((o) => {
1173
1183
  const r = (c) => {
1174
- n(new ot(e.handlerUniqueId, J(c, e.serializableSkeleton)));
1184
+ n(new pt(e.handlerUniqueId, oe(c, e.serializableSkeleton)));
1175
1185
  };
1176
1186
  o.addEventListener(e.type, r), i.push(() => {
1177
1187
  o.removeEventListener(e.type, r);
@@ -1181,13 +1191,13 @@ Check the documentation for valid behavior options.`
1181
1191
  };
1182
1192
  });
1183
1193
  }
1184
- }, Hn = class extends B {
1194
+ }, $n = class extends N {
1185
1195
  constructor() {
1186
- super(...arguments), a(this, "messageType", v.CreateRefComponentMessage), a(this, "innerExecutor", (e, t, n) => {
1187
- g(this, null, function* () {
1188
- const i = t.shadowRoot.querySelectorAll(`[${de.id}='${e.refConfig.selector}']`);
1196
+ super(...arguments), a(this, "messageType", w.CreateRefComponentMessage), a(this, "innerExecutor", (e, t, n) => {
1197
+ v(this, null, function* () {
1198
+ const i = t.shadowRoot.querySelectorAll(`[${me.id}='${e.refConfig.selector}']`);
1189
1199
  if (i.length === 1) {
1190
- const o = be.Instance(), r = o.components.find((u) => u.id === e.options.id);
1200
+ const o = Te.Instance(), r = o.components.find((u) => u.id === e.options.id);
1191
1201
  r && r.dispose();
1192
1202
  const c = o.components.indexOf(r);
1193
1203
  c !== -1 && o.components.splice(c, 1);
@@ -1202,28 +1212,28 @@ Check the documentation for valid behavior options.`
1202
1212
  refName: u,
1203
1213
  componentDefinitionId: h.componentDefinition.id
1204
1214
  });
1205
- }), n(new Re(e.handlerUniqueId, d));
1215
+ }), n(new Le(e.handlerUniqueId, d));
1206
1216
  } else {
1207
- console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Re(e.handlerUniqueId, [], !0));
1217
+ console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Le(e.handlerUniqueId, [], !0));
1208
1218
  debugger;
1209
1219
  }
1210
1220
  }).then();
1211
1221
  });
1212
1222
  }
1213
- }, Dn = (e, t, n) => {
1223
+ }, zn = (e, t, n) => {
1214
1224
  const s = e.scriptInputs ? e.scriptInputs : {};
1215
- s.makeSerializable = J, s.send = t, s.rootRef = n, s.__scriptInputs = s;
1225
+ s.makeSerializable = oe, s.send = t, s.rootRef = n, s.__scriptInputs = s;
1216
1226
  const o = new Function(`return (${e.script})(...arguments)`)(s);
1217
1227
  t(o);
1218
- }, kn = class extends B {
1228
+ }, Wn = class extends N {
1219
1229
  constructor() {
1220
- super(...arguments), a(this, "messageType", v.ExecuteScriptMessage), a(this, "innerExecutor", (e, t, n) => {
1221
- Dn(e, (i) => {
1222
- n(new st(e.handlerUniqueId, i));
1230
+ super(...arguments), a(this, "messageType", w.ExecuteScriptMessage), a(this, "innerExecutor", (e, t, n) => {
1231
+ zn(e, (i) => {
1232
+ n(new ut(e.handlerUniqueId, i));
1223
1233
  }, t);
1224
1234
  });
1225
1235
  }
1226
- }, Tt = (e) => {
1236
+ }, Pt = (e) => {
1227
1237
  if (!e) return null;
1228
1238
  if (e.tagName === "FORM") {
1229
1239
  new FormData(e);
@@ -1233,14 +1243,14 @@ Check the documentation for valid behavior options.`
1233
1243
  };
1234
1244
  return e.querySelectorAll("input, select, textarea").forEach((s) => {
1235
1245
  if (typeof s.value == "string") {
1236
- const i = s.getAttribute(de.id);
1246
+ const i = s.getAttribute(me.id);
1237
1247
  let o = s.getAttribute("name");
1238
1248
  const r = {
1239
1249
  id: s.id,
1240
1250
  name: o,
1241
- value: Tt(s),
1251
+ value: Pt(s),
1242
1252
  required: s.required,
1243
- validity: J(s.validity, !0),
1253
+ validity: oe(s.validity, !0),
1244
1254
  myopId: i
1245
1255
  };
1246
1256
  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);
@@ -1248,82 +1258,82 @@ Check the documentation for valid behavior options.`
1248
1258
  }), t;
1249
1259
  }
1250
1260
  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;
1251
- }, Ln = class extends B {
1261
+ }, Kn = class extends N {
1252
1262
  constructor() {
1253
- super(...arguments), a(this, "messageType", v.GetElementValueMessage), a(this, "innerExecutor", (e, t, n) => {
1254
- Q(e.ref, t.shadowRoot).forEach((i) => {
1255
- n(new at(Tt(i)), e);
1263
+ super(...arguments), a(this, "messageType", w.GetElementValueMessage), a(this, "innerExecutor", (e, t, n) => {
1264
+ re(e.ref, t.shadowRoot).forEach((i) => {
1265
+ n(new ft(Pt(i)), e);
1256
1266
  });
1257
1267
  });
1258
1268
  }
1259
- }, On = class extends B {
1269
+ }, qn = class extends N {
1260
1270
  constructor() {
1261
- super(...arguments), a(this, "messageType", v.SetInnerHtml), a(this, "innerExecutor", (e, t) => {
1262
- Q(e.ref, t.shadowRoot).forEach((s) => {
1271
+ super(...arguments), a(this, "messageType", w.SetInnerHtml), a(this, "innerExecutor", (e, t) => {
1272
+ re(e.ref, t.shadowRoot).forEach((s) => {
1263
1273
  s.innerHTML = e.content;
1264
1274
  });
1265
1275
  });
1266
1276
  }
1267
- }, xt = class extends pn {
1277
+ }, At = class extends En {
1268
1278
  constructor() {
1269
1279
  super(...arguments), a(this, "alwaysPassEnvelopesToHost", !0), a(this, "connectedCallback", (e, t) => {
1270
- e.addEventListener(St.webcomponent_message_key, (n) => {
1280
+ e.addEventListener(Lt.webcomponent_message_key, (n) => {
1271
1281
  const s = n.data ? n.data : n.detail;
1272
1282
  if (!s || !s.myop) {
1273
1283
  debugger;
1274
1284
  throw new Error("recvied webcomponent_message with wrong type");
1275
1285
  } else {
1276
1286
  const i = s;
1277
- if (this.handleIncomeMessages(n), i.messageType === v.InitMessage) {
1287
+ if (this.handleIncomeMessages(n), i.messageType === w.InitMessage) {
1278
1288
  const o = i.content.id;
1279
- this.components[o].context = new In(e, t);
1289
+ this.components[o].context = new An(e, t);
1280
1290
  }
1281
1291
  }
1282
1292
  }), setTimeout(() => {
1283
- this.messageToHost(new lt());
1293
+ this.messageToHost(new gt());
1284
1294
  }, 1);
1285
1295
  }), a(this, "messageToHost", (e, t) => {
1286
- e.direction = D.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1296
+ e.direction = k.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
1287
1297
  }), a(this, "supportedHandlers", [
1288
- new Sn(this.messageToHost, this.components),
1298
+ new Pn(this.messageToHost, this.components),
1299
+ new qn(this.messageToHost, this.components),
1289
1300
  new On(this.messageToHost, this.components),
1290
- new Cn(this.messageToHost, this.components),
1291
- new Tn(this.messageToHost, this.components),
1292
- new xn(this.messageToHost, this.components),
1293
- new Rn(this.messageToHost, this.components),
1294
- new kn(this.messageToHost, this.components),
1295
- new Ln(this.messageToHost, this.components),
1301
+ new Fn(this.messageToHost, this.components),
1302
+ new Bn(this.messageToHost, this.components),
1303
+ new Nn(this.messageToHost, this.components),
1304
+ new Wn(this.messageToHost, this.components),
1305
+ new Kn(this.messageToHost, this.components),
1296
1306
  //
1297
- new Hn(this.messageToHost, this.components)
1307
+ new $n(this.messageToHost, this.components)
1298
1308
  ]), a(this, "init", () => {
1299
1309
  });
1300
1310
  }
1301
1311
  };
1302
- Qe("WebComponentSDK", xt);
1303
- var Pn = "<!-- myop-web-component -->", An = "myop-web-component", qe = /* @__PURE__ */ new Set(), Ue = [], ge, Rt = () => g(void 0, null, function* () {
1304
- return ge || (ge = new xt(), ge.init()), ge;
1312
+ ot("WebComponentSDK", At);
1313
+ var Un = "<!-- myop-web-component -->", jn = "myop-web-component", Ze = /* @__PURE__ */ new Set(), et = [], be, Ft = () => v(void 0, null, function* () {
1314
+ return be || (be = new At(), be.init()), be;
1305
1315
  });
1306
- function Bn(e, t) {
1316
+ function Vn(e, t) {
1307
1317
  return class extends HTMLElement {
1308
1318
  connectedCallback() {
1309
- const n = t === le.open ? "open" : "closed", s = this.attachShadow({ mode: n });
1310
- Rt().then((i) => {
1319
+ const n = t === pe.open ? "open" : "closed", s = this.attachShadow({ mode: n });
1320
+ Ft().then((i) => {
1311
1321
  i.connectedCallback(this, s), s.innerHTML = e;
1312
1322
  });
1313
1323
  }
1314
1324
  };
1315
1325
  }
1316
- var Fn = (e, t, n) => {
1317
- customElements.define(e, Bn(t, n)), console.log(`define('${e}') was called, web component ready to use`);
1318
- }, Nn = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), $n = (e) => (e = Nn(e), e.replace(/_/g, "-")), Wn = class extends Pe {
1326
+ var Gn = (e, t, n) => {
1327
+ customElements.define(e, Vn(t, n)), console.log(`define('${e}') was called, web component ready to use`);
1328
+ }, Yn = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), Qn = (e) => (e = Yn(e), e.replace(/_/g, "-")), Jn = class extends $e {
1319
1329
  constructor() {
1320
- super(...arguments), a(this, "type", ce.HTMLLoader), a(this, "load", (e, t, n, s) => g(this, null, function* () {
1330
+ super(...arguments), a(this, "type", he.HTMLLoader), a(this, "load", (e, t, n, s) => v(this, null, function* () {
1321
1331
  const i = t.loader;
1322
1332
  if (this.isMyopWebComponent(i.HTML))
1323
1333
  return this.loadExtractedWebComponent(e, t, n, i.HTML, s);
1324
- let o = `myop-comp-${j()}`, r;
1325
- if (i.shadowRootMode === le.localFrame) {
1326
- const l = `myop-comp-${j()}`;
1334
+ let o = `myop-comp-${J()}`, r;
1335
+ if (i.shadowRootMode === pe.localFrame) {
1336
+ const l = `myop-comp-${J()}`;
1327
1337
  let d = document.createElement("iframe");
1328
1338
  d.id = l, d.style.cssText = `
1329
1339
  display: block;
@@ -1340,25 +1350,34 @@ var Fn = (e, t, n) => {
1340
1350
  `, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), d = this.appendChild(n, d, s);
1341
1351
  const u = d.contentDocument || d.contentWindow.document;
1342
1352
  u.open();
1343
- let h = i.HTML;
1353
+ let h = null;
1354
+ {
1355
+ const C = new DOMParser().parseFromString(i.HTML, "text/html").querySelector('meta[name="myop:size"]');
1356
+ if (C)
1357
+ try {
1358
+ h = JSON.parse(C.getAttribute("content") || "{}");
1359
+ } catch {
1360
+ }
1361
+ }
1362
+ let m = i.HTML;
1344
1363
  if (s != null && s._inspection) {
1345
- const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
1346
- E == null || E.removeAttribute("type");
1347
- const R = w.implementation.createHTMLDocument();
1348
- R.body.innerHTML = `<script>
1364
+ const E = new DOMParser().parseFromString(i.HTML, "text/html"), C = E.getElementById("myop_preview");
1365
+ C == null || C.removeAttribute("type");
1366
+ const L = E.implementation.createHTMLDocument();
1367
+ L.body.innerHTML = `<script>
1349
1368
  const beforeKeysWindow = new Set(Object.keys(window));
1350
1369
  window.myopState = {
1351
1370
  beforeKeysWindow,
1352
1371
  };
1353
1372
  <\/script>`;
1354
- const k = R.body.firstChild;
1355
- k && w.head && w.head.insertBefore(w.importNode(k, !0), w.head.firstChild), h = w.documentElement.outerHTML;
1373
+ const D = L.body.firstChild;
1374
+ D && E.head && E.head.insertBefore(E.importNode(D, !0), E.head.firstChild), m = E.documentElement.outerHTML;
1356
1375
  } else if ((s == null ? void 0 : s.data) !== void 0) {
1357
- const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
1358
- E && (E.remove(), h = w.documentElement.outerHTML);
1376
+ const E = new DOMParser().parseFromString(i.HTML, "text/html"), C = E.getElementById("myop_preview");
1377
+ C && (C.remove(), m = E.documentElement.outerHTML);
1359
1378
  }
1360
- u.writeln(h);
1361
- const f = `<script>${At}<\/script>`;
1379
+ u.writeln(m);
1380
+ const f = `<script>${jt}<\/script>`;
1362
1381
  if (u.writeln(`${f}<script>
1363
1382
  const __myop_init = async () => {
1364
1383
  const iframeModule = await MyopSDK.getIframeModule();
@@ -1368,12 +1387,12 @@ var Fn = (e, t, n) => {
1368
1387
  }
1369
1388
  __myop_init().then();
1370
1389
  <\/script>`), (s == null ? void 0 : s.data) !== void 0) {
1371
- const x = `<script>
1390
+ const I = `<script>
1372
1391
  window.__myop_cta_queue = [];
1373
1392
  window.myop_cta_handler = function(action, payload) {
1374
1393
  window.__myop_cta_queue.push({action: action, payload: payload});
1375
1394
  };
1376
- <\/script>`, E = `<script id="__myop_init_data_script">
1395
+ <\/script>`, C = `<script id="__myop_init_data_script">
1377
1396
  (function() {
1378
1397
  var data = ${JSON.stringify(s.data).replace(/<\/script/gi, "\\u003c/script")};
1379
1398
  var scriptEl = document.getElementById('__myop_init_data_script');
@@ -1434,55 +1453,55 @@ var Fn = (e, t, n) => {
1434
1453
  }
1435
1454
  })();
1436
1455
  <\/script>`;
1437
- u.writeln(x + E);
1456
+ u.writeln(I + C);
1438
1457
  }
1439
1458
  u.close();
1440
- const m = new Ct(e, t, n, d, s);
1441
- return i.autoHeight && (d.onload = () => {
1442
- m.observeSizeBasedOnDocumentElement();
1443
- }), m;
1459
+ const x = new kt(e, t, n, d, s);
1460
+ return x.sizeMeta = h, i.autoHeight && (d.onload = () => {
1461
+ x.observeSizeBasedOnDocumentElement();
1462
+ }), x;
1444
1463
  }
1445
- if (i.shadowRootMode === le.none) {
1464
+ if (i.shadowRootMode === pe.none) {
1446
1465
  const c = document.createElement("template");
1447
- c.innerHTML = i.HTML, r = c.content.firstElementChild, Rt().then((l) => {
1466
+ c.innerHTML = i.HTML, r = c.content.firstElementChild, Ft().then((l) => {
1448
1467
  l.connectedCallback(r, r);
1449
1468
  });
1450
1469
  } else {
1451
- const c = $n(e.name + t.id);
1452
- Ue.includes(c) || (Fn(c, i.HTML, i.shadowRootMode), Ue.push(c)), r = document.createElement(c);
1470
+ const c = Qn(e.name + t.id);
1471
+ et.includes(c) || (Gn(c, i.HTML, i.shadowRootMode), et.push(c)), r = document.createElement(c);
1453
1472
  }
1454
- return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.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(n, r, s), new It(e, t, n, r, s);
1473
+ return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), r.id = o, s != null && s.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(n, r, s), new Ot(e, t, n, r, s);
1455
1474
  }));
1456
1475
  }
1457
1476
  /**
1458
1477
  * Detect if HTML is a Myop Web Component (starts with marker comment)
1459
1478
  */
1460
1479
  isMyopWebComponent(e) {
1461
- return e.trimStart().startsWith(Pn);
1480
+ return e.trimStart().startsWith(Un);
1462
1481
  }
1463
1482
  /**
1464
1483
  * Extract the web component script content from HTML
1465
1484
  */
1466
1485
  extractWebComponentScript(e) {
1467
- const s = new DOMParser().parseFromString(e, "text/html").getElementById(An);
1486
+ const s = new DOMParser().parseFromString(e, "text/html").getElementById(jn);
1468
1487
  return (s == null ? void 0 : s.textContent) || null;
1469
1488
  }
1470
1489
  /**
1471
1490
  * Execute the web component script on the host document
1472
1491
  */
1473
1492
  executeWebComponentScript(e, t) {
1474
- if (qe.has(t)) {
1493
+ if (Ze.has(t)) {
1475
1494
  console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);
1476
1495
  return;
1477
1496
  }
1478
1497
  const n = document.createElement("script");
1479
- n.textContent = e, n.id = `myop-extracted-${t}`, document.head.appendChild(n), qe.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
1498
+ n.textContent = e, n.id = `myop-extracted-${t}`, document.head.appendChild(n), Ze.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
1480
1499
  }
1481
1500
  /**
1482
1501
  * Load a Myop Web Component (extracted and run on host document)
1483
1502
  */
1484
1503
  loadExtractedWebComponent(e, t, n, s, i) {
1485
- return g(this, null, function* () {
1504
+ return v(this, null, function* () {
1486
1505
  const o = this.extractWebComponentScript(s);
1487
1506
  if (!o)
1488
1507
  throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');
@@ -1492,9 +1511,9 @@ var Fn = (e, t, n) => {
1492
1511
  if (!l)
1493
1512
  throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");
1494
1513
  c && c !== l && console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);
1495
- const d = `myop-comp-${j()}`, u = document.createElement(l);
1514
+ const d = `myop-comp-${J()}`, u = document.createElement(l);
1496
1515
  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"), n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), this.appendChild(n, u, i);
1497
- const h = new De(
1516
+ const h = new Pe(
1498
1517
  e,
1499
1518
  t,
1500
1519
  n,
@@ -1505,7 +1524,7 @@ var Fn = (e, t, n) => {
1505
1524
  return (i == null ? void 0 : i.data) !== void 0 && h.initWithData(i.data), console.log(`[MyopWebComponent] Loaded <${l}> into container`), h;
1506
1525
  });
1507
1526
  }
1508
- }, Kn = (e) => ({
1527
+ }, Xn = (e) => ({
1509
1528
  instance: {
1510
1529
  id: "auto",
1511
1530
  componentId: e.componentId,
@@ -1527,7 +1546,7 @@ var Fn = (e, t, n) => {
1527
1546
  name: "myop_init_interface",
1528
1547
  type: "any",
1529
1548
  behavior: {
1530
- type: ve.code
1549
+ type: Ee.code
1531
1550
  }
1532
1551
  },
1533
1552
  {
@@ -1535,7 +1554,7 @@ var Fn = (e, t, n) => {
1535
1554
  name: "myop_cta_handler",
1536
1555
  type: "any",
1537
1556
  behavior: {
1538
- type: ve.code
1557
+ type: Ee.code
1539
1558
  }
1540
1559
  }
1541
1560
  ],
@@ -1553,26 +1572,26 @@ var Fn = (e, t, n) => {
1553
1572
  defaultSkin: 0
1554
1573
  },
1555
1574
  name: e.name
1556
- }), we = "__MYOP_CLOUD_REPOSITORY_MAIN__", zn = () => {
1575
+ }), Ce = "__MYOP_CLOUD_REPOSITORY_MAIN__", Zn = () => {
1557
1576
  if (typeof window < "u")
1558
- return window[we];
1577
+ return window[Ce];
1559
1578
  if (typeof globalThis < "u")
1560
- return globalThis[we];
1561
- }, qn = (e) => {
1562
- typeof window < "u" && (window[we] = e), typeof globalThis < "u" && (globalThis[we] = e);
1563
- }, Ht = class G {
1579
+ return globalThis[Ce];
1580
+ }, es = (e) => {
1581
+ typeof window < "u" && (window[Ce] = e), typeof globalThis < "u" && (globalThis[Ce] = e);
1582
+ }, Bt = class se {
1564
1583
  constructor(t = "https://cloud.myop.dev") {
1565
- this._baseUrl = t, a(this, "variants", {}), a(this, "preloadedComponents", {}), a(this, "userFlows", {}), a(this, "_defaultEnv", "production");
1584
+ this._baseUrl = t, a(this, "variants", {}), a(this, "preloadedComponents", {}), a(this, "userFlows", {}), a(this, "_defaultEnv", "production"), a(this, "_envExplicitlySet", !1);
1566
1585
  }
1567
1586
  static get Main() {
1568
- const t = zn();
1569
- return t || (G._main || (G._main = new G(), qn(G._main)), G._main);
1587
+ const t = Zn();
1588
+ return t || (se._main || (se._main = new se(), es(se._main)), se._main);
1570
1589
  }
1571
1590
  /**
1572
1591
  * Set the default environment for this CloudRepository instance
1573
1592
  */
1574
1593
  setEnvironment(t) {
1575
- this._defaultEnv = t;
1594
+ this._defaultEnv = t, this._envExplicitlySet = !0;
1576
1595
  }
1577
1596
  /**
1578
1597
  * Get the current default environment
@@ -1600,10 +1619,16 @@ var Fn = (e, t, n) => {
1600
1619
  * If env/preview not specified and component was preloaded, uses preloaded params
1601
1620
  */
1602
1621
  fetchComponentV2(t, n, s) {
1603
- return g(this, null, function* () {
1622
+ return v(this, null, function* () {
1604
1623
  const i = this.preloadedComponents[t], o = n !== void 0 || s !== void 0;
1605
1624
  let r, c;
1606
- !o && i ? (r = i.env, c = i.preview) : (r = n || this._defaultEnv, c = s === !0 ? !0 : s === !1 ? !1 : !n);
1625
+ if (!o && i)
1626
+ r = i.env, c = i.preview;
1627
+ else {
1628
+ r = n || this._defaultEnv;
1629
+ const d = n || this._envExplicitlySet;
1630
+ c = s === !0 ? !0 : s === !1 ? !1 : !d;
1631
+ }
1607
1632
  const l = `${t}:${r}:${c ? "preview" : "live"}`;
1608
1633
  return console.log("[CloudRepository] fetchComponentV2", {
1609
1634
  componentId: t.slice(0, 8) + "...",
@@ -1612,20 +1637,20 @@ var Fn = (e, t, n) => {
1612
1637
  cacheKey: l,
1613
1638
  cached: l in this.variants
1614
1639
  }), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: r, preview: c }), this.variants[l] = new Promise(
1615
- (d, u) => g(this, null, function* () {
1640
+ (d, u) => v(this, null, function* () {
1616
1641
  try {
1617
1642
  let h = `${this._baseUrl}/consume?id=${t}&env=${r}`;
1618
1643
  c && (h += "&preview=true");
1619
- const m = (yield (yield fetch(h)).json()).item;
1620
- if (!m) {
1644
+ const y = (yield (yield fetch(h)).json()).item;
1645
+ if (!y) {
1621
1646
  u(new Error(`Component "${t}" not found`));
1622
1647
  return;
1623
1648
  }
1624
- if (!m.consume_variant || !m.consume_variant.length) {
1649
+ if (!y.consume_variant || !y.consume_variant.length) {
1625
1650
  u(new Error(`Component "${t}" has no implementation for environment "${r}"`));
1626
1651
  return;
1627
1652
  }
1628
- const x = Kn(m);
1653
+ const x = Xn(y);
1629
1654
  d(x);
1630
1655
  } catch (h) {
1631
1656
  u(h);
@@ -1639,14 +1664,14 @@ var Fn = (e, t, n) => {
1639
1664
  * Fetch a v1 component from a flow
1640
1665
  */
1641
1666
  fetchComponentV1(t, n) {
1642
- return g(this, null, function* () {
1667
+ return v(this, null, function* () {
1643
1668
  return n ? (yield this.fetchFlow(n)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
1644
1669
  });
1645
1670
  }
1646
1671
  fetchAutoFlow(t) {
1647
- return g(this, null, function* () {
1672
+ return v(this, null, function* () {
1648
1673
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
1649
- (n, s) => g(this, null, function* () {
1674
+ (n, s) => v(this, null, function* () {
1650
1675
  try {
1651
1676
  const o = yield (yield fetch(
1652
1677
  `${this._baseUrl}/flow?id=${t}&auto=true`
@@ -1660,9 +1685,9 @@ var Fn = (e, t, n) => {
1660
1685
  });
1661
1686
  }
1662
1687
  fetchFlow(t) {
1663
- return g(this, null, function* () {
1688
+ return v(this, null, function* () {
1664
1689
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
1665
- (n, s) => g(this, null, function* () {
1690
+ (n, s) => v(this, null, function* () {
1666
1691
  try {
1667
1692
  const o = yield (yield fetch(
1668
1693
  `${this._baseUrl}/flow?id=${t}&resolve=components`
@@ -1681,24 +1706,26 @@ var Fn = (e, t, n) => {
1681
1706
  * Defaults to v1 behavior for backward compatibility with existing code
1682
1707
  */
1683
1708
  fetchComponent(t, n) {
1684
- return g(this, null, function* () {
1709
+ return v(this, null, function* () {
1685
1710
  return this.fetchComponentV1(t, n);
1686
1711
  });
1687
1712
  }
1688
1713
  };
1689
- a(Ht, "_main", null);
1690
- var je = Ht, Un = (e) => g(void 0, null, function* () {
1714
+ a(Bt, "_main", null);
1715
+ var Ae = Bt;
1716
+ Ae.Main;
1717
+ var ts = (e) => v(void 0, null, function* () {
1691
1718
  try {
1692
1719
  const t = new URL(window.location.href), s = new URLSearchParams(t.search).get("myopOverride");
1693
1720
  if (s) {
1694
- const [i, ...o] = $e(s);
1721
+ const [i, ...o] = Ye(s);
1695
1722
  switch (i) {
1696
1723
  case "component":
1697
1724
  {
1698
- const [r, c] = o, l = yield je.Main.fetchComponent(r);
1725
+ const [r, c] = o, l = yield Ae.Main.fetchComponent(r);
1699
1726
  if (l && l.type.skins.find((u) => u.id === c))
1700
1727
  return l.instance.skinSelector = {
1701
- type: re.Dedicated,
1728
+ type: de.Dedicated,
1702
1729
  skin: {
1703
1730
  id: c
1704
1731
  }
@@ -1708,13 +1735,13 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1708
1735
  // case 'flow': {
1709
1736
  default:
1710
1737
  {
1711
- const [r, c] = $e(s), d = (yield je.Main.fetchFlow(r)).components.find((u) => u.type.id === e.type.id);
1712
- if (d && d.instance.skinSelector.type === re.Segmented && d.instance.resolvedExperiences) {
1738
+ const [r, c] = Ye(s), d = (yield Ae.Main.fetchFlow(r)).components.find((u) => u.type.id === e.type.id);
1739
+ if (d && d.instance.skinSelector.type === de.Segmented && d.instance.resolvedExperiences) {
1713
1740
  const u = d.instance.resolvedExperiences.find((h) => h.id === c);
1714
- if ((u == null ? void 0 : u.type) === _t.Segment) {
1715
- const h = u, y = d.instance.skinSelector.segments.find((m) => m.segmentId === h.segment.id);
1716
- if (y)
1717
- return d.instance.skinSelector = y == null ? void 0 : y.skinSelector, d;
1741
+ if ((u == null ? void 0 : u.type) === xt.Segment) {
1742
+ const h = u, f = d.instance.skinSelector.segments.find((y) => y.segmentId === h.segment.id);
1743
+ if (f)
1744
+ return d.instance.skinSelector = f == null ? void 0 : f.skinSelector, d;
1718
1745
  }
1719
1746
  }
1720
1747
  }
@@ -1724,24 +1751,24 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1724
1751
  } finally {
1725
1752
  return null;
1726
1753
  }
1727
- }), Dt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", be = class {
1754
+ }), Nt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", Te = class {
1728
1755
  constructor() {
1729
- a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version", En), 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", () => {
1756
+ a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version", Ln), 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", () => {
1730
1757
  this.inspected || (this.inspected = !0, this.components.forEach((e) => {
1731
1758
  e.inspect && e.inspect();
1732
1759
  }));
1733
1760
  }), a(this, "incomingMessageHandler", (e) => {
1734
1761
  if (e.origin, document.location.origin, e.data.myop) {
1735
- if (e.data.direction !== D.up && e.data.messageType !== v.EnvelopedMessage)
1762
+ if (e.data.direction !== k.up && e.data.messageType !== w.EnvelopedMessage)
1736
1763
  return;
1737
1764
  const t = e.data;
1738
- if (t.messageType === v.InitRequest) {
1765
+ if (t.messageType === w.InitRequest) {
1739
1766
  this.components2init.forEach((s) => {
1740
- s.send(new ke(s.id));
1767
+ s.send(new Fe(s.id));
1741
1768
  });
1742
1769
  return;
1743
1770
  }
1744
- if (t.messageType === v.InitResponse) {
1771
+ if (t.messageType === w.InitResponse) {
1745
1772
  this.components2init = this.components2init.filter((i) => i.id !== t.content.id);
1746
1773
  const s = this.components.find((i) => {
1747
1774
  var o;
@@ -1750,11 +1777,11 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1750
1777
  s == null || s.setInitiated();
1751
1778
  return;
1752
1779
  }
1753
- if (t.messageType === v.EnvelopedMessage) {
1780
+ if (t.messageType === w.EnvelopedMessage) {
1754
1781
  const s = t, i = this.components.find((o) => o.id === s.destination);
1755
1782
  if (i) {
1756
- if (s.direction === D.down) {
1757
- s.message.messageType === N.name ? i.onMessageReceived(s.message) : (s.message.route = s.route, i.send(s.message));
1783
+ if (s.direction === k.down) {
1784
+ s.message.messageType === U.name ? i.onMessageReceived(s.message) : (s.message.route = s.route, i.send(s.message));
1758
1785
  return;
1759
1786
  }
1760
1787
  } else {
@@ -1784,9 +1811,9 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1784
1811
  if (this.initiated)
1785
1812
  throw new Error("hostSDK already initiated");
1786
1813
  const t = [
1787
- new Mn(),
1788
- new bn(),
1789
- new Wn()
1814
+ new Dn(),
1815
+ new kn(),
1816
+ new Jn()
1790
1817
  ];
1791
1818
  if (this.componentsLoaders = [
1792
1819
  ...t
@@ -1804,10 +1831,10 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1804
1831
  this.incomingMessageHandler,
1805
1832
  !1
1806
1833
  ), console.log("myop hostSDK initiated", document.location.href), this.initiated = !0;
1807
- }), a(this, "_getSkinIdBySkinSelector", (e, ...t) => g(this, [e, ...t], function* (n, s = [], i) {
1834
+ }), a(this, "_getSkinIdBySkinSelector", (e, ...t) => v(this, [e, ...t], function* (n, s = [], i) {
1808
1835
  var o;
1809
1836
  function r(c, l) {
1810
- return g(this, null, function* () {
1837
+ return v(this, null, function* () {
1811
1838
  for (const d of c)
1812
1839
  if (yield l(d))
1813
1840
  return d;
@@ -1817,18 +1844,18 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1817
1844
  // @ts-ignore
1818
1845
  case "DedicatedSkin":
1819
1846
  //backward compatibility
1820
- case re.Dedicated:
1847
+ case de.Dedicated:
1821
1848
  return ((o = n.skin) == null ? void 0 : o.id) || n.skins[0].id;
1822
- case re.Segmented:
1849
+ case de.Segmented:
1823
1850
  {
1824
- const l = yield r(n.segments, (d) => g(this, null, function* () {
1851
+ const l = yield r(n.segments, (d) => v(this, null, function* () {
1825
1852
  if (d.segmentId === "Default")
1826
1853
  return !0;
1827
- const u = s.find((m) => m.type === _t.Segment ? m.segment.id === d.segmentId : !1);
1854
+ const u = s.find((y) => y.type === xt.Segment ? y.segment.id === d.segmentId : !1);
1828
1855
  if (!u)
1829
1856
  throw new Error("experience not found");
1830
- const f = u.segment, y = (i || {})[f.function];
1831
- return y ? yield y() : (console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`), !1);
1857
+ const m = u.segment, f = (i || {})[m.function];
1858
+ return f ? yield f() : (console.warn(`segmentId:${d.segmentId}, ${m.function} function not provided !`), !1);
1832
1859
  }));
1833
1860
  if (l)
1834
1861
  return this._getSkinIdBySkinSelector(l.skinSelector, s);
@@ -1839,61 +1866,61 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1839
1866
  debugger;
1840
1867
  }
1841
1868
  return "";
1842
- })), a(this, "runSkinSelector", (e, t) => g(this, null, function* () {
1869
+ })), a(this, "runSkinSelector", (e, t) => v(this, null, function* () {
1843
1870
  const n = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
1844
1871
  return e.type.skins.find((s) => s.id === n);
1845
- })), a(this, "loaderHooks"), a(this, "loadComponent", (e, t, n) => g(this, null, function* () {
1872
+ })), a(this, "loaderHooks"), a(this, "loadComponent", (e, t, n) => v(this, null, function* () {
1846
1873
  var s, i, o, r;
1847
1874
  if (!t) {
1848
1875
  debugger;
1849
1876
  throw new Error("no container was found for this component");
1850
1877
  }
1851
- const c = yield Un(e);
1878
+ const c = yield ts(e);
1852
1879
  c && (e = c);
1853
- const l = M(M({}, (s = this.loaderHooks) != null ? s : {}), (i = n == null ? void 0 : n.hooks) != null ? i : {}), d = t;
1880
+ const l = b(b({}, (s = this.loaderHooks) != null ? s : {}), (i = n == null ? void 0 : n.hooks) != null ? i : {}), d = t;
1854
1881
  if (d.myop)
1855
1882
  if (d.component) {
1856
- e = M({}, e), e.instance = M({}, e.instance);
1857
- let y = yield this.runSkinSelector(e, l);
1858
- if (!y)
1883
+ e = b({}, e), e.instance = b({}, e.instance);
1884
+ let f = yield this.runSkinSelector(e, l);
1885
+ if (!f)
1859
1886
  throw new Error("runSkinSelector failed to choose skin, check the provided config");
1860
- return (o = n == null ? void 0 : n.hooks) != null && o.afterSkinSelected && (y = yield n.hooks.afterSkinSelected(M({}, y))), e.instance.skinSelector = {
1861
- type: re.Dedicated,
1862
- skin: y
1887
+ return (o = n == null ? void 0 : n.hooks) != null && o.afterSkinSelected && (f = yield n.hooks.afterSkinSelected(b({}, f))), e.instance.skinSelector = {
1888
+ type: de.Dedicated,
1889
+ skin: f
1863
1890
  // skins: [selectedSkin]
1864
- }, n && (n = M({}, n), delete n.hooks), yield bt(d, e, this.components, n);
1891
+ }, n && (n = b({}, n), delete n.hooks), yield Rt(d, e, this.components, n);
1865
1892
  } else
1866
1893
  throw new Error("load component got a detached ref.");
1867
1894
  t = t;
1868
1895
  let u = yield this.runSkinSelector(e, l);
1869
1896
  if (!u)
1870
1897
  throw new Error("runSkinSelector failed to choose skin, check the provided config");
1871
- (r = n == null ? void 0 : n.hooks) != null && r.afterSkinSelected && (u = yield n.hooks.afterSkinSelected(M({}, u)));
1872
- const h = this.componentsLoaders.find((y) => y.type === u.loader.type);
1898
+ (r = n == null ? void 0 : n.hooks) != null && r.afterSkinSelected && (u = yield n.hooks.afterSkinSelected(b({}, u)));
1899
+ const h = this.componentsLoaders.find((f) => f.type === u.loader.type);
1873
1900
  if (!h) {
1874
1901
  debugger;
1875
1902
  throw new Error(`no loader "${u.loader.type}" was found for component`);
1876
1903
  }
1877
- let f = yield h.load(e.type, u, t, n);
1878
- f.isInitiated || this.components2init.push(f), f.bind("onDispose", () => (this.components = this.components.filter((y) => y !== f), this.components2init = this.components2init.filter((y) => y !== f), !0)), this.components.push(f), (!n || n.connectProps !== !1) && (f = vn(f, e.type.props, u));
1904
+ let m = yield h.load(e.type, u, t, n);
1905
+ 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), (!n || n.connectProps !== !1) && (m = xn(m, e.type.props, u));
1879
1906
  try {
1880
- yield Et(f, e, this.components);
1881
- } catch (y) {
1882
- throw y;
1907
+ yield Dt(m, e, this.components);
1908
+ } catch (f) {
1909
+ throw f;
1883
1910
  }
1884
- return n != null && n.skipInit || (yield f.initiated()), f;
1885
- })), a(this, "navigate", (e, t, n) => g(this, null, function* () {
1911
+ return n != null && n.skipInit || (yield m.initiated()), m;
1912
+ })), a(this, "navigate", (e, t, n) => v(this, null, function* () {
1886
1913
  if (e.parent)
1887
1914
  throw new Error("Navigating on remote ref components is not implemented yet");
1888
1915
  if (n != null && n.staged) {
1889
- let s = yield this.loadComponent(t, e.container, M({
1916
+ let s = yield this.loadComponent(t, e.container, b({
1890
1917
  hidden: !0,
1891
1918
  relative: { direction: "after", child: e.element }
1892
1919
  }, n));
1893
1920
  return n.init && (yield n.init(s)), s.show(), e.dispose(), s;
1894
1921
  } else {
1895
1922
  const s = e.element.nextSibling;
1896
- return e.dispose(), this.loadComponent(t, e.container, M({
1923
+ return e.dispose(), this.loadComponent(t, e.container, b({
1897
1924
  relative: {
1898
1925
  direction: "before",
1899
1926
  child: s
@@ -1903,40 +1930,40 @@ var je = Ht, Un = (e) => g(void 0, null, function* () {
1903
1930
  }));
1904
1931
  }
1905
1932
  };
1906
- a(be, "Instance", () => window.myop.hostSDK);
1933
+ a(Te, "Instance", () => window.myop.hostSDK);
1907
1934
  window.myop || (window.myop = {
1908
- __ROOT_SDK_PUBLIC_URL__: Dt
1935
+ __ROOT_SDK_PUBLIC_URL__: Nt
1909
1936
  });
1910
1937
  if (!window.myop.hostSDK) {
1911
- const e = new be();
1938
+ const e = new Te();
1912
1939
  e.init(), window.myop || (window.myop = {
1913
- __ROOT_SDK_PUBLIC_URL__: Dt
1940
+ __ROOT_SDK_PUBLIC_URL__: Nt
1914
1941
  }), window.myop.hostSDK = e;
1915
1942
  }
1916
- var Ae = window.myop.hostSDK;
1917
- Qe("hostSDK", Ae);
1918
- var jn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Vn = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", Gn = {
1943
+ var ze = window.myop.hostSDK;
1944
+ ot("hostSDK", ze);
1945
+ var ns = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", ss = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", is = {
1919
1946
  position: "absolute",
1920
1947
  top: 0,
1921
1948
  left: 0,
1922
1949
  right: 0,
1923
1950
  bottom: 0,
1924
1951
  zIndex: 1,
1925
- background: jn,
1952
+ background: ns,
1926
1953
  display: "flex",
1927
1954
  justifyContent: "center",
1928
1955
  alignItems: "center"
1929
- }, Yn = {
1956
+ }, os = {
1930
1957
  position: "absolute",
1931
1958
  top: 0,
1932
1959
  left: 0,
1933
1960
  right: 0,
1934
1961
  bottom: 0,
1935
- background: Vn,
1962
+ background: ss,
1936
1963
  display: "flex",
1937
1964
  justifyContent: "center",
1938
1965
  alignItems: "center"
1939
- }, Jn = {
1966
+ }, rs = {
1940
1967
  position: "absolute",
1941
1968
  top: 0,
1942
1969
  left: 0,
@@ -1946,7 +1973,7 @@ var jn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Vn =
1946
1973
  display: "flex",
1947
1974
  justifyContent: "center",
1948
1975
  alignItems: "center"
1949
- }, Qn = Object.defineProperty, Xn = (e, t, n) => t in e ? Qn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, p = (e, t, n) => Xn(e, typeof t != "symbol" ? t + "" : t, n), F = (e, t, n) => new Promise((s, i) => {
1976
+ }, as = Object.defineProperty, cs = (e, t, n) => t in e ? as(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, p = (e, t, n) => cs(e, typeof t != "symbol" ? t + "" : t, n), P = (e, t, n) => new Promise((s, i) => {
1950
1977
  var o = (l) => {
1951
1978
  try {
1952
1979
  c(n.next(l));
@@ -1961,12 +1988,12 @@ var jn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Vn =
1961
1988
  }
1962
1989
  }, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(o, r);
1963
1990
  c((n = n.apply(e, t)).next());
1964
- }), W = () => "10000000-1000-4000-8000-100000000000".replace(
1991
+ }), V = () => "10000000-1000-4000-8000-100000000000".replace(
1965
1992
  /[018]/g,
1966
1993
  (e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
1967
- ), Zn = class {
1994
+ ), ls = class {
1968
1995
  constructor() {
1969
- p(this, "id", W()), 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);
1996
+ p(this, "id", V()), 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);
1970
1997
  }
1971
1998
  static create(...e) {
1972
1999
  return new this(...e);
@@ -1974,36 +2001,36 @@ var jn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Vn =
1974
2001
  isTypeof(e) {
1975
2002
  return e.messageType === this.messageType;
1976
2003
  }
1977
- }, es = class extends Zn {
2004
+ }, ds = class extends ls {
1978
2005
  constructor(e) {
1979
- super(), this.handler = e, p(this, "handlerUniqueId", W());
2006
+ super(), this.handler = e, p(this, "handlerUniqueId", V());
1980
2007
  }
1981
- }, ts = "ExecuteScriptReplyMessage", ns = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, ss = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, is = (e) => {
1982
- let t = e.match(ns);
2008
+ }, us = "ExecuteScriptReplyMessage", hs = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, ps = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, ms = (e) => {
2009
+ let t = e.match(hs);
1983
2010
  if (t)
1984
2011
  return t[1] || t[3];
1985
2012
  {
1986
- let n = e.match(ss);
2013
+ let n = e.match(ps);
1987
2014
  if (n)
1988
2015
  return n[1].trim();
1989
2016
  }
1990
- }, kt = class extends es {
2017
+ }, $t = class extends ds {
1991
2018
  constructor(e, t = () => {
1992
2019
  }, n) {
1993
- super(t), this.scriptInputs = n, p(this, "replyMessageKey", ts), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = is(this.content);
2020
+ super(t), this.scriptInputs = n, p(this, "replyMessageKey", us), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = ms(this.content);
1994
2021
  }
1995
2022
  };
1996
- p(kt, "replierKey", "send");
1997
- p(kt, "completeStreamKey", "completeStream");
1998
- var Ve = class {
2023
+ p($t, "replierKey", "send");
2024
+ p($t, "completeStreamKey", "completeStream");
2025
+ var tt = class {
1999
2026
  constructor() {
2000
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + W()), p(this, "_runTimeId", "runtime-id-" + W()), p(this, "_runTimeName", "runtime-name-" + W()), 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);
2027
+ p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), 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);
2001
2028
  }
2002
2029
  };
2003
- p(Ve, "create", () => new Ve());
2004
- var Ge = class {
2030
+ p(tt, "create", () => new tt());
2031
+ var nt = class {
2005
2032
  constructor() {
2006
- p(this, "_runTimeInstanceId", "runtime-instance-id-" + W()), p(this, "_runTimeId", "runtime-id-" + W()), p(this, "_runTimeName", "runtime-name-" + W()), p(this, "instance", {
2033
+ p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), p(this, "instance", {
2007
2034
  id: this._runTimeInstanceId,
2008
2035
  componentId: this._runTimeId,
2009
2036
  componentName: this._runTimeName,
@@ -2036,10 +2063,10 @@ var Ge = class {
2036
2063
  }), p(this, "build", () => JSON.parse(JSON.stringify(this)));
2037
2064
  }
2038
2065
  };
2039
- p(Ge, "create", () => new Ge());
2040
- var Ye = {
2066
+ p(nt, "create", () => new nt());
2067
+ var st = {
2041
2068
  code: "code"
2042
- }, os = (e) => ({
2069
+ }, fs = (e) => ({
2043
2070
  instance: {
2044
2071
  id: "auto",
2045
2072
  componentId: e.componentId,
@@ -2061,7 +2088,7 @@ var Ye = {
2061
2088
  name: "myop_init_interface",
2062
2089
  type: "any",
2063
2090
  behavior: {
2064
- type: Ye.code
2091
+ type: st.code
2065
2092
  }
2066
2093
  },
2067
2094
  {
@@ -2069,7 +2096,7 @@ var Ye = {
2069
2096
  name: "myop_cta_handler",
2070
2097
  type: "any",
2071
2098
  behavior: {
2072
- type: Ye.code
2099
+ type: st.code
2073
2100
  }
2074
2101
  }
2075
2102
  ],
@@ -2087,26 +2114,26 @@ var Ye = {
2087
2114
  defaultSkin: 0
2088
2115
  },
2089
2116
  name: e.name
2090
- }), _e = "__MYOP_CLOUD_REPOSITORY_MAIN__", rs = () => {
2117
+ }), Se = "__MYOP_CLOUD_REPOSITORY_MAIN__", ys = () => {
2091
2118
  if (typeof window < "u")
2092
- return window[_e];
2119
+ return window[Se];
2093
2120
  if (typeof globalThis < "u")
2094
- return globalThis[_e];
2095
- }, as = (e) => {
2096
- typeof window < "u" && (window[_e] = e), typeof globalThis < "u" && (globalThis[_e] = e);
2097
- }, Lt = class Y {
2121
+ return globalThis[Se];
2122
+ }, gs = (e) => {
2123
+ typeof window < "u" && (window[Se] = e), typeof globalThis < "u" && (globalThis[Se] = e);
2124
+ }, zt = class ie {
2098
2125
  constructor(t = "https://cloud.myop.dev") {
2099
- this._baseUrl = t, p(this, "variants", {}), p(this, "preloadedComponents", {}), p(this, "userFlows", {}), p(this, "_defaultEnv", "production");
2126
+ this._baseUrl = t, p(this, "variants", {}), p(this, "preloadedComponents", {}), p(this, "userFlows", {}), p(this, "_defaultEnv", "production"), p(this, "_envExplicitlySet", !1);
2100
2127
  }
2101
2128
  static get Main() {
2102
- const t = rs();
2103
- return t || (Y._main || (Y._main = new Y(), as(Y._main)), Y._main);
2129
+ const t = ys();
2130
+ return t || (ie._main || (ie._main = new ie(), gs(ie._main)), ie._main);
2104
2131
  }
2105
2132
  /**
2106
2133
  * Set the default environment for this CloudRepository instance
2107
2134
  */
2108
2135
  setEnvironment(t) {
2109
- this._defaultEnv = t;
2136
+ this._defaultEnv = t, this._envExplicitlySet = !0;
2110
2137
  }
2111
2138
  /**
2112
2139
  * Get the current default environment
@@ -2134,10 +2161,16 @@ var Ye = {
2134
2161
  * If env/preview not specified and component was preloaded, uses preloaded params
2135
2162
  */
2136
2163
  fetchComponentV2(t, n, s) {
2137
- return F(this, null, function* () {
2164
+ return P(this, null, function* () {
2138
2165
  const i = this.preloadedComponents[t], o = n !== void 0 || s !== void 0;
2139
2166
  let r, c;
2140
- !o && i ? (r = i.env, c = i.preview) : (r = n || this._defaultEnv, c = s === !0 ? !0 : s === !1 ? !1 : !n);
2167
+ if (!o && i)
2168
+ r = i.env, c = i.preview;
2169
+ else {
2170
+ r = n || this._defaultEnv;
2171
+ const d = n || this._envExplicitlySet;
2172
+ c = s === !0 ? !0 : s === !1 ? !1 : !d;
2173
+ }
2141
2174
  const l = `${t}:${r}:${c ? "preview" : "live"}`;
2142
2175
  return console.log("[CloudRepository] fetchComponentV2", {
2143
2176
  componentId: t.slice(0, 8) + "...",
@@ -2146,20 +2179,20 @@ var Ye = {
2146
2179
  cacheKey: l,
2147
2180
  cached: l in this.variants
2148
2181
  }), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: r, preview: c }), this.variants[l] = new Promise(
2149
- (d, u) => F(this, null, function* () {
2182
+ (d, u) => P(this, null, function* () {
2150
2183
  try {
2151
2184
  let h = `${this._baseUrl}/consume?id=${t}&env=${r}`;
2152
2185
  c && (h += "&preview=true");
2153
- const m = (yield (yield fetch(h)).json()).item;
2154
- if (!m) {
2186
+ const y = (yield (yield fetch(h)).json()).item;
2187
+ if (!y) {
2155
2188
  u(new Error(`Component "${t}" not found`));
2156
2189
  return;
2157
2190
  }
2158
- if (!m.consume_variant || !m.consume_variant.length) {
2191
+ if (!y.consume_variant || !y.consume_variant.length) {
2159
2192
  u(new Error(`Component "${t}" has no implementation for environment "${r}"`));
2160
2193
  return;
2161
2194
  }
2162
- const x = os(m);
2195
+ const x = fs(y);
2163
2196
  d(x);
2164
2197
  } catch (h) {
2165
2198
  u(h);
@@ -2173,14 +2206,14 @@ var Ye = {
2173
2206
  * Fetch a v1 component from a flow
2174
2207
  */
2175
2208
  fetchComponentV1(t, n) {
2176
- return F(this, null, function* () {
2209
+ return P(this, null, function* () {
2177
2210
  return n ? (yield this.fetchFlow(n)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
2178
2211
  });
2179
2212
  }
2180
2213
  fetchAutoFlow(t) {
2181
- return F(this, null, function* () {
2214
+ return P(this, null, function* () {
2182
2215
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
2183
- (n, s) => F(this, null, function* () {
2216
+ (n, s) => P(this, null, function* () {
2184
2217
  try {
2185
2218
  const o = yield (yield fetch(
2186
2219
  `${this._baseUrl}/flow?id=${t}&auto=true`
@@ -2194,9 +2227,9 @@ var Ye = {
2194
2227
  });
2195
2228
  }
2196
2229
  fetchFlow(t) {
2197
- return F(this, null, function* () {
2230
+ return P(this, null, function* () {
2198
2231
  return this.userFlows[t] || (this.userFlows[t] = new Promise(
2199
- (n, s) => F(this, null, function* () {
2232
+ (n, s) => P(this, null, function* () {
2200
2233
  try {
2201
2234
  const o = yield (yield fetch(
2202
2235
  `${this._baseUrl}/flow?id=${t}&resolve=components`
@@ -2215,26 +2248,38 @@ var Ye = {
2215
2248
  * Defaults to v1 behavior for backward compatibility with existing code
2216
2249
  */
2217
2250
  fetchComponent(t, n) {
2218
- return F(this, null, function* () {
2251
+ return P(this, null, function* () {
2219
2252
  return this.fetchComponentV1(t, n);
2220
2253
  });
2221
2254
  }
2222
2255
  };
2223
- p(Lt, "_main", null);
2224
- var Ee = Lt;
2225
- const Ms = (e) => {
2226
- const t = O(null), n = O(null), s = O(!1), i = O(null);
2227
- return oe(() => {
2256
+ p(zt, "_main", null);
2257
+ var xe = zt, G = xe.Main, vs = () => G, ws = (e, t, n) => G.isPreloaded(e, t, n), Ds = (e) => G.getPreloadedParams(e), ks = () => {
2258
+ G = new xe("http://localhost:9292");
2259
+ }, Ls = (e) => {
2260
+ G = new xe(e);
2261
+ }, Os = (e) => {
2262
+ G = e;
2263
+ }, Ps = (e) => {
2264
+ G.setEnvironment(e);
2265
+ }, As = (e, t, n) => P(void 0, null, function* () {
2266
+ return Promise.allSettled(
2267
+ e.map((s) => G.fetchComponentV2(s, t, n))
2268
+ );
2269
+ });
2270
+ const Fs = (e) => {
2271
+ const t = A(null), n = A(null), s = A(!1), i = A(null);
2272
+ return le(() => {
2228
2273
  let o = !1;
2229
2274
  s.current = !(t != null && t.current);
2230
2275
  const r = async (c) => {
2231
2276
  s.current = !0;
2232
2277
  try {
2233
- const l = await Ee.Main.fetchComponent(
2278
+ const l = await xe.Main.fetchComponent(
2234
2279
  c.componentId,
2235
2280
  c.flowId
2236
2281
  );
2237
- n.current = await Ae.loadComponent(
2282
+ n.current = await ze.loadComponent(
2238
2283
  l,
2239
2284
  t.current,
2240
2285
  {
@@ -2267,7 +2312,7 @@ const Ms = (e) => {
2267
2312
  return s.current ? i.current = { ...e } : r(e).then(), () => {
2268
2313
  o = !0, n.current && n.current.dispose();
2269
2314
  };
2270
- }, [e.flowId, e.componentId]), /* @__PURE__ */ T(
2315
+ }, [e.flowId, e.componentId]), /* @__PURE__ */ R(
2271
2316
  "div",
2272
2317
  {
2273
2318
  style: {
@@ -2277,14 +2322,14 @@ const Ms = (e) => {
2277
2322
  ref: t
2278
2323
  }
2279
2324
  );
2280
- }, Ot = () => /* @__PURE__ */ T(
2325
+ }, Wt = () => /* @__PURE__ */ R(
2281
2326
  "svg",
2282
2327
  {
2283
2328
  width: "80",
2284
2329
  viewBox: "0 0 525 243",
2285
2330
  fill: "none",
2286
2331
  xmlns: "http://www.w3.org/2000/svg",
2287
- children: /* @__PURE__ */ T(
2332
+ children: /* @__PURE__ */ R(
2288
2333
  "path",
2289
2334
  {
2290
2335
  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",
@@ -2292,169 +2337,170 @@ const Ms = (e) => {
2292
2337
  }
2293
2338
  )
2294
2339
  }
2295
- ), cs = ({
2340
+ ), _s = ({
2296
2341
  opacity: e = 1,
2297
2342
  fadeDuration: t = 200,
2298
2343
  children: n
2299
2344
  }) => {
2300
2345
  if (n !== void 0) {
2301
2346
  const i = {
2302
- ...Jn,
2347
+ ...rs,
2303
2348
  opacity: e,
2304
2349
  transition: `opacity ${t}ms ease-out`
2305
2350
  };
2306
- return /* @__PURE__ */ T("div", { style: i, children: n });
2351
+ return /* @__PURE__ */ R("div", { style: i, children: n });
2307
2352
  }
2308
2353
  const s = {
2309
- ...Gn,
2354
+ ...is,
2310
2355
  opacity: e,
2311
2356
  transition: `opacity ${t}ms ease-out`
2312
2357
  };
2313
- return /* @__PURE__ */ T("div", { style: s, children: /* @__PURE__ */ T(Ot, {}) });
2314
- }, ls = {
2358
+ return /* @__PURE__ */ R("div", { style: s, children: /* @__PURE__ */ R(Wt, {}) });
2359
+ }, Ms = {
2315
2360
  position: "absolute",
2316
2361
  top: 0,
2317
2362
  left: 0,
2318
2363
  right: 0,
2319
2364
  bottom: 0
2320
- }, ds = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ T("div", { style: ls, children: e }) : /* @__PURE__ */ T("div", { style: Yn, children: /* @__PURE__ */ T(Ot, {}) }), us = (e) => `on${e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("")}`, bs = (e) => {
2321
- var C, S, L, X, Z, ee;
2322
- const t = O(null), n = O(null), s = O(!1), i = O(null), o = e.componentId ? ps(e.componentId) : !1, [r, c] = ie(!o), [l, d] = ie(1), [u, h] = ie(!1), [f, y] = ie(!1), [m, x] = ie(void 0), w = e.autoSize ?? !1, E = O(!1), R = e.fadeDuration ?? 200, k = Be(() => {
2365
+ }, bs = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ R("div", { style: Ms, children: e }) : /* @__PURE__ */ R("div", { style: os, children: /* @__PURE__ */ R(Wt, {}) }), Es = (e) => `on${e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("")}`, Bs = (e) => {
2366
+ var ce, ee, ve, we, $, z, te;
2367
+ const t = A(null), n = A(null), s = A(!1), i = A(null), o = e.componentId ? ws(e.componentId) : !1, [r, c] = ne(!o), [l, d] = ne(1), [u, h] = ne(!1), [m, f] = ne(!1), [y, x] = ne(void 0), I = e.autoSize ?? !0, [E, C] = ne({ fillWidth: !1, fillHeight: !1 }), L = A(!1), D = e.fadeDuration ?? 200, X = je(() => {
2323
2368
  d(0), setTimeout(() => {
2324
2369
  c(!1);
2325
- }, R);
2326
- }, [R]), he = Be(
2327
- (_) => {
2328
- console.error("[MyopComponent] Error:", _), k(), h(!0), e.onError && e.onError(_);
2370
+ }, D);
2371
+ }, [D]), ye = je(
2372
+ (M) => {
2373
+ console.error("[MyopComponent] Error:", M), X(), h(!0), e.onError && e.onError(M);
2329
2374
  },
2330
- [k, e.onError]
2375
+ [X, e.onError]
2331
2376
  );
2332
- oe(() => {
2333
- E.current = !1;
2334
- }, [e.componentId]), oe(() => {
2335
- if (f && e.data !== void 0 && n.current) {
2336
- if (!E.current) {
2337
- E.current = !0;
2377
+ le(() => {
2378
+ L.current = !1;
2379
+ }, [e.componentId]), le(() => {
2380
+ if (m && e.data !== void 0 && n.current) {
2381
+ if (!L.current) {
2382
+ L.current = !0;
2338
2383
  return;
2339
2384
  }
2340
- const _ = n.current.props.myop_init_interface;
2341
- _ && _(e.data);
2385
+ const M = n.current.props.myop_init_interface;
2386
+ M && M(e.data);
2342
2387
  }
2343
- }, [e.data, f]), oe(() => {
2344
- var q, I, te, H, ne, U, se;
2345
- if (!f || !((q = n.current) != null && q.observeAutoSize))
2388
+ }, [e.data, m]), le(() => {
2389
+ var W, g, _, H, K, q, T;
2390
+ if (!m || !((W = n.current) != null && W.observeAutoSize))
2346
2391
  return;
2347
- let _ = !0;
2392
+ let M = !0;
2348
2393
  return n.current.observeAutoSize({
2349
- explicitWidth: (I = e.style) == null ? void 0 : I.width,
2350
- explicitHeight: (te = e.style) == null ? void 0 : te.height,
2394
+ // SDK resolves: host props sizeMeta defaults (width: "100%", height: auto-size)
2395
+ explicitWidth: (g = e.style) == null ? void 0 : g.width,
2396
+ explicitHeight: (_ = e.style) == null ? void 0 : _.height,
2351
2397
  minWidth: (H = e.style) == null ? void 0 : H.minWidth,
2352
- maxWidth: (ne = e.style) == null ? void 0 : ne.maxWidth,
2353
- minHeight: (U = e.style) == null ? void 0 : U.minHeight,
2354
- maxHeight: (se = e.style) == null ? void 0 : se.maxHeight,
2355
- forceAutoSize: w,
2398
+ maxWidth: (K = e.style) == null ? void 0 : K.maxWidth,
2399
+ minHeight: (q = e.style) == null ? void 0 : q.minHeight,
2400
+ maxHeight: (T = e.style) == null ? void 0 : T.maxHeight,
2401
+ forceAutoSize: I,
2356
2402
  loaderMinHeight: 50,
2357
- onSizeChange: (fe) => {
2358
- e.onSizeChange && e.onSizeChange(fe) === !1 || (x(fe), _ && (_ = !1, k()));
2403
+ onSizeChange: (Q) => {
2404
+ e.onSizeChange && e.onSizeChange(Q) === !1 || (x(Q), M && (M = !1, X()));
2359
2405
  }
2360
2406
  });
2361
- }, [w, f, e.onSizeChange, (C = e.style) == null ? void 0 : C.width, (S = e.style) == null ? void 0 : S.height, (L = e.style) == null ? void 0 : L.minWidth, (X = e.style) == null ? void 0 : X.maxWidth, (Z = e.style) == null ? void 0 : Z.minHeight, (ee = e.style) == null ? void 0 : ee.maxHeight]), oe(() => {
2362
- let _ = !1;
2407
+ }, [I, m, e.onSizeChange, (ce = e.style) == null ? void 0 : ce.width, (ee = e.style) == null ? void 0 : ee.height, (ve = e.style) == null ? void 0 : ve.minWidth, (we = e.style) == null ? void 0 : we.maxWidth, ($ = e.style) == null ? void 0 : $.minHeight, (z = e.style) == null ? void 0 : z.maxHeight]), le(() => {
2408
+ let M = !1;
2363
2409
  s.current = !(t != null && t.current);
2364
- const q = async (I) => {
2365
- var te;
2410
+ const W = async (g) => {
2411
+ var _, H, K, q;
2366
2412
  s.current = !0;
2367
2413
  try {
2368
- if (!I.componentId && !I.componentConfig) {
2369
- he("No component configuration provided");
2414
+ if (!g.componentId && !g.componentConfig) {
2415
+ ye("No component configuration provided");
2370
2416
  return;
2371
2417
  }
2372
- const H = await hs().fetchComponentV2(
2373
- I.componentId,
2374
- I.environment,
2375
- I.preview
2376
- ), ne = await Ae.loadComponent(
2377
- H,
2418
+ const T = await vs().fetchComponentV2(
2419
+ g.componentId,
2420
+ g.environment,
2421
+ g.preview
2422
+ ), Q = await ze.loadComponent(
2423
+ T,
2378
2424
  t.current,
2379
2425
  {
2380
- data: I.data,
2426
+ data: g.data,
2381
2427
  _environment: {
2382
- props: { ...I }
2428
+ props: { ...g }
2383
2429
  }
2384
2430
  }
2385
2431
  );
2386
- if (_) {
2387
- ne.dispose();
2432
+ if (M) {
2433
+ Q.dispose();
2388
2434
  return;
2389
2435
  }
2390
- if (n.current = ne, await n.current.initiated(), _) {
2436
+ if (n.current = Q, await n.current.initiated(), M) {
2391
2437
  n.current && n.current.dispose();
2392
2438
  return;
2393
2439
  }
2394
- if (await new Promise((U) => requestAnimationFrame(U)), _ || !n.current || n.current.markedForDisposed) {
2440
+ if (await new Promise((_e) => requestAnimationFrame(_e)), M || !n.current || n.current.markedForDisposed) {
2395
2441
  n.current && !n.current.markedForDisposed && n.current.dispose();
2396
2442
  return;
2397
2443
  }
2398
- y(!0), w || k(), (te = n.current) != null && te.props && (n.current.props.myop_cta_handler = (U, se) => {
2399
- e.on && e.on(U, se);
2400
- const fe = us(U), Ce = e[fe];
2401
- typeof Ce == "function" && Ce(se);
2402
- }), I.onLoad && n.current && I.onLoad(n.current);
2403
- } catch (H) {
2404
- _ || he((H == null ? void 0 : H.message) || "Unknown error");
2444
+ f(!0);
2445
+ const O = (_ = n.current) == null ? void 0 : _.sizeMeta, We = (O == null ? void 0 : O.width) === "100%", Ke = (O == null ? void 0 : O.height) === "100%";
2446
+ C({ fillWidth: We, fillHeight: Ke });
2447
+ const Kt = (We || ((H = e.style) == null ? void 0 : H.width)) && (Ke || ((K = e.style) == null ? void 0 : K.height));
2448
+ (!I || Kt) && X(), (q = n.current) != null && q.props && (n.current.props.myop_cta_handler = (_e, qe) => {
2449
+ e.on && e.on(_e, qe);
2450
+ const qt = Es(_e), Ue = e[qt];
2451
+ typeof Ue == "function" && Ue(qe);
2452
+ }), g.onLoad && n.current && g.onLoad(n.current);
2453
+ } catch (T) {
2454
+ M || ye((T == null ? void 0 : T.message) || "Unknown error");
2405
2455
  } finally {
2406
- if (s.current = !1, i.current !== null && !_) {
2407
- const H = i.current;
2408
- i.current = null, await q(H);
2456
+ if (s.current = !1, i.current !== null && !M) {
2457
+ const T = i.current;
2458
+ i.current = null, await W(T);
2409
2459
  }
2410
2460
  }
2411
2461
  };
2412
- return s.current ? i.current = { ...e } : q(e).then(), () => {
2413
- _ = !0, n.current && n.current.dispose();
2462
+ return s.current ? i.current = { ...e } : W(e).then(), () => {
2463
+ M = !0, n.current && n.current.dispose();
2414
2464
  };
2415
2465
  }, [e.componentId]);
2416
- const V = r ? 50 : void 0, z = (m == null ? void 0 : m.autoSizingWidth) || (m == null ? void 0 : m.autoSizingHeight), pe = {
2466
+ const ge = r ? 50 : void 0, ae = !I || !m || E.fillHeight && !((te = e.style) != null && te.height);
2467
+ let Y, Z;
2468
+ return ae ? (Y = {
2417
2469
  position: "relative",
2418
- width: m != null && m.autoSizingWidth ? m.width : "100%",
2419
- height: m != null && m.autoSizingHeight ? m.height : "100%",
2420
- minHeight: V,
2421
- overflow: z ? "hidden" : "inherit",
2470
+ width: "100%",
2471
+ height: "100%",
2472
+ minHeight: ge,
2422
2473
  ...e.style
2423
- };
2424
- return /* @__PURE__ */ Pt("div", { style: pe, children: [
2425
- /* @__PURE__ */ T("div", { ref: t, style: {
2426
- position: "absolute",
2427
- inset: 0,
2428
- overflow: z ? "hidden" : void 0
2429
- } }),
2430
- r && e.loader !== void 0 && /* @__PURE__ */ T(cs, { opacity: l, fadeDuration: R, children: e.loader }),
2431
- u && /* @__PURE__ */ T(ds, { children: e.fallback })
2474
+ }, Z = {
2475
+ position: "absolute",
2476
+ inset: 0
2477
+ }) : (Y = {
2478
+ position: "relative",
2479
+ width: y != null && y.autoSizingWidth ? y.width : "100%",
2480
+ height: (y == null ? void 0 : y.height) ?? void 0,
2481
+ minHeight: ge,
2482
+ ...e.style
2483
+ }, Z = {
2484
+ width: "100%",
2485
+ height: (y == null ? void 0 : y.height) ?? void 0
2486
+ }), /* @__PURE__ */ Ut("div", { style: Y, children: [
2487
+ /* @__PURE__ */ R("div", { ref: t, style: Z }),
2488
+ r && e.loader !== void 0 && /* @__PURE__ */ R(_s, { opacity: l, fadeDuration: D, children: e.loader }),
2489
+ u && /* @__PURE__ */ R(bs, { children: e.fallback })
2432
2490
  ] });
2433
2491
  };
2434
- let K = Ee.Main;
2435
- const hs = () => K, ps = (e, t, n) => K.isPreloaded(e, t, n), Es = (e) => K.getPreloadedParams(e), Cs = () => {
2436
- K = new Ee("http://localhost:9292");
2437
- }, Ss = (e) => {
2438
- K = new Ee(e);
2439
- }, Is = (e) => {
2440
- K = e;
2441
- }, Ts = (e) => {
2442
- K.setEnvironment(e);
2443
- }, xs = async (e, t, n) => Promise.allSettled(
2444
- e.map((s) => K.fetchComponentV2(s, t, n))
2445
- );
2446
2492
  export {
2447
- bs as MyopComponent,
2448
- Ms as MyopContainer,
2449
- ds as MyopFallback,
2450
- cs as MyopLoader,
2451
- bs as MyopV2Container,
2452
- Cs as enableLocalDev,
2453
- hs as getCloudRepository,
2454
- Es as getPreloadedParams,
2455
- ps as isPreloaded,
2456
- xs as preloadComponents,
2457
- Is as setCloudRepository,
2458
- Ss as setCloudRepositoryUrl,
2459
- Ts as setEnvironment
2493
+ Bs as MyopComponent,
2494
+ Fs as MyopContainer,
2495
+ bs as MyopFallback,
2496
+ _s as MyopLoader,
2497
+ Bs as MyopV2Container,
2498
+ ks as enableLocalDev,
2499
+ vs as getCloudRepository,
2500
+ Ds as getPreloadedParams,
2501
+ ws as isPreloaded,
2502
+ As as preloadComponents,
2503
+ Os as setCloudRepository,
2504
+ Ls as setCloudRepositoryUrl,
2505
+ Ps as setEnvironment
2460
2506
  };