@myop/react 0.0.30 → 0.0.32
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/README.md +40 -4
- package/dist/index.d.ts +35 -1
- package/dist/index.js +123 -128
- package/dist/index.umd.cjs +9 -9
- package/package.json +17 -3
package/dist/index.umd.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(_,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],E):(_=typeof globalThis<"u"?globalThis:_||self,E(_["@myop/react"]={},_.React,_.React))})(this,(function(_,E,w){"use strict";const Ot=`"use strict";var MyopSDK=(()=>{var ze=Object.defineProperty,ds=Object.defineProperties,cs=Object.getOwnPropertyDescriptor,ms=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertyNames,gn=Object.getOwnPropertySymbols;var un=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable;var Dt=(o,t,e)=>t in o?ze(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,h=(o,t)=>{for(var e in t||(t={}))un.call(t,e)&&Dt(o,e,t[e]);if(gn)for(var e of gn(t))fs.call(t,e)&&Dt(o,e,t[e]);return o},N=(o,t)=>ds(o,ms(t));var m=(o,t)=>()=>(o&&(t=o(o=0)),t);var ee=(o,t)=>{for(var e in t)ze(o,e,{get:t[e],enumerable:!0})},gs=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ls(t))!un.call(o,r)&&r!==e&&ze(o,r,{get:()=>t[r],enumerable:!(n=cs(t,r))||n.enumerable});return o};var us=o=>gs(ze({},"__esModule",{value:!0}),o);var s=(o,t,e)=>Dt(o,typeof t!="symbol"?t+"":t,e);var $e,Ue,Bt,z,te=m(()=>{"use strict";$e="__federation__",Ue="onLoad",Bt="moduleInstance",z=(o,t)=>{window[$e]&&window[$e][o]&&window[$e][o][Ue]&&window[$e][o][Ue]({[o]:t})}});var ue,Ne=m(()=>{ue="0.3.12"});var l,I=m(()=>{"use strict";l={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 T,ys,hs,Lt,Ot=m(()=>{"use strict";T=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),ys=o=>{let t=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},hs=o=>{let t=o.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let e=atob(t);return Uint8Array.from(e,n=>n.charCodeAt(0))},Lt=o=>{let t=hs(o);if(t.length%16!==0)throw new Error("Invalid input length");let e=[];for(let n=0;n<t.length;n+=16)e.push(ys(t.slice(n,n+16)));return e}});var hn,ne=m(()=>{"use strict";Ot();hn=o=>new Promise(t=>setTimeout(t,o))});var R,C,Pt,v,_,G,k=m(()=>{"use strict";ne();R=class{};s(R,"down","down"),s(R,"up","up");C=class{constructor(){s(this,"id",T());s(this,"myop",!0);s(this,"content");s(this,"source");s(this,"destination");s(this,"route");s(this,"ref");s(this,"direction");s(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},Pt=class extends C{constructor(e){super();this.ref=e}},v=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;s(this,"handlerUniqueId",T())}},G=class o{constructor(t,e){this.refConfig=t;this.component=e;s(this,"myop",!0);s(this,"__nonProxied");this.__nonProxied=N(h({},this),{component:null})}static create(t,e,n){let r=e;return r||(r={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new o(r,n)}}});var Mn,Kt,oe,In=m(()=>{"use strict";k();Mn="ClickReplayMessage",Kt=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Mn);s(this,"messageType","BindClickMessage");s(this,"cleanable",!0)}},oe=class extends v{constructor(){super(...arguments);s(this,"messageType",Mn)}}});var At,Cn=m(()=>{"use strict";k();At=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","ChangeTextMessage");this.content=n}}});var xn,Ms,Is,wn,D,se,Ft=m(()=>{"use strict";k();xn="ExecuteScriptReplyMessage",Ms=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Is=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,wn=o=>{let t=o.match(Ms);if(t)return t[1]||t[3];{let e=o.match(Is);if(e)return e[1].trim()}},D=class extends _{constructor(e,n=()=>{},r){super(n);this.scriptInputs=r;s(this,"replyMessageKey",xn);s(this,"messageType","ExecuteScriptMessage");s(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=wn(this.content)}};s(D,"replierKey","send"),s(D,"completeStreamKey","completeStream");se=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.content=n;s(this,"messageType",xn)}}});var W,bn=m(()=>{"use strict";Ft();W=class extends D{constructor(e,n,r=()=>{}){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},r);this.scriptInputs=n;this.scriptInputs=N(h({},n),{_script:e.toString()})}}});var Sn,zt,re,Tn=m(()=>{"use strict";k();Sn="EventListenerCallbackMessage",zt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.type=n;this.handler=r;s(this,"replyMessageKey",Sn);s(this,"messageType","AddEventListenerMessage");s(this,"cleanable",!0);s(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},re=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.e=n;s(this,"messageType",Sn);this.content={e:n}}}});var $t,En=m(()=>{"use strict";k();$t=class extends C{constructor(e,n,r){super();this.ref=e;this.name=n;this.value=r;s(this,"messageType","SetAttributeMessage")}}});var Rn,Ut,ie,Nt=m(()=>{"use strict";k();Rn="ElementValueReplayMessage",Ut=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Rn);s(this,"messageType","GetElementValueMessage")}},ie=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Rn)}}});var Wt,vn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","SetInnerHtml");this.content=n}}});var ye,Re,ae,_n=m(()=>{"use strict";k();ye=class extends C{constructor(e){super();s(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Re=class extends ye{constructor(){super(...arguments);s(this,"messageType","InitResponse")}},ae=class extends C{constructor(){super(...arguments);s(this,"messageType","InitRequest")}}});var kn,ve,V,We=m(()=>{"use strict";k();kn="RefComponentCreatedMessage",ve=class extends _{constructor(e,n,r,i){super(i);this.refConfig=e;this.nestedComponentConfig=n;this.options=r;s(this,"replyMessageKey",kn);s(this,"messageType","CreateRefComponentMessage")}},V=class extends v{constructor(e,n,r){super(e);this.replayToHandler=e;this.nestedRefs=n;this.failed=r;s(this,"messageType",kn)}}});var _e,Vt=m(()=>{"use strict";k();_e=class extends C{constructor(e,n){super();this.destination=e;this.message=n;s(this,"messageType","EnvelopedMessage");let r=n;this.route=[e,...r.route?r.route:[]]}}});var Hn,qt,pe,Dn=m(()=>{"use strict";k();Hn="DetectedMyopRefsMessage",qt=class extends _{constructor(){super(...arguments);s(this,"messageType","DetectMyopRefsMessage");s(this,"replyMessageKey",Hn)}},pe=class extends v{constructor(e,n){super(e);this.replayToHandler=e;s(this,"messageType",Hn);this.content=n}isTypeof(e){return e.messageType===this.messageType}}});var Bn,jt,ke,Ln=m(()=>{"use strict";k();Bn="GetAttributeReplayMessage",jt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.name=n;s(this,"replyMessageKey",Bn);s(this,"messageType","GetAttributeMessage")}},ke=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Bn)}}});var K,On=m(()=>{"use strict";k();K=class extends C{constructor(e){super();this.method=e;s(this,"messageType","ExecuteComponentMethod")}}});var Gt,He,Pn=m(()=>{"use strict";k();Gt=class extends C{constructor(){super(...arguments);s(this,"messageType","SetMutationObserverMessage")}},He=class extends C{constructor(){super(...arguments);s(this,"messageType","MutationObserverMessage")}}});var Kn,De,Be,An=m(()=>{"use strict";k();Kn="CleanupReplayMessage",De=class extends _{constructor(e,n){super(n);this.cleanupForMessageId=e;s(this,"replyMessageKey",Kn);s(this,"messageType","CleanupMessage")}},Be=class extends v{constructor(e){super();this.customCleanup=e;s(this,"messageType",Kn)}}});var Le,Fn=m(()=>{"use strict";k();Le=class extends C{constructor(){super(...arguments);s(this,"messageType","DisposeMessage")}}});var Jt,Oe,zn=m(()=>{"use strict";k();Jt=class extends C{constructor(){super(...arguments);s(this,"cleanable",!0);s(this,"messageType","SetResizeObserverMessage")}},Oe=class extends C{constructor(){super(...arguments);s(this,"messageType","ResizeObserverMessage")}}});var he={};ee(he,{AddEventListenerMessage:()=>zt,BaseMyopMessage:()=>C,BindClickMessage:()=>Kt,ChangeTextMessage:()=>At,CleanupMessage:()=>De,CleanupReplayMessage:()=>Be,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>ve,CustomRefMessage:()=>W,DetectMyopRefsMessage:()=>qt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Le,ElementValueReplayMessage:()=>ie,EnvelopedMessage:()=>_e,EventListenerCallbackMessage:()=>re,ExecuteComponentMethod:()=>K,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>jt,GetAttributeReplayMessage:()=>ke,GetElementValueMessage:()=>Ut,InitMessage:()=>ye,InitRequest:()=>ae,InitResponse:()=>Re,MessageDirection:()=>R,MutationObserverMessage:()=>He,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>v,MyopElementMessage:()=>Pt,Ref:()=>G,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>Oe,SetAttributeMessage:()=>$t,SetInnerHtml:()=>Wt,SetMutationObserverMessage:()=>Gt,SetResizeObserverMessage:()=>Jt,stripFunction:()=>wn});var w=m(()=>{"use strict";k();In();Cn();Ft();bn();Tn();En();Nt();vn();_n();We();Vt();Dn();Nt();Ln();On();Pn();An();Fn();zn()});var J,Ve=m(()=>{"use strict";I();w();Pe();J=class{constructor(t,e,n){this.componentDefinition=t;this.container=e;s(this,"id","");s(this,"messageHandlers",{});s(this,"element");s(this,"_markedForDisposed",!1);s(this,"bind",(t,e)=>{this.messageHandlers[t]||(this.messageHandlers[t]=[]),this.messageHandlers[t].includes(e)||this.messageHandlers[t].push(e)});s(this,"bindWhen",(t,e,n)=>{if(!n)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[t]||(this.messageHandlers[t]=[]);let r=this.messageHandlers[t],i=a=>e(a)?(n(a),!0):!1;return r.push(i),()=>{let a=r.indexOf(i);a>-1&&r.splice(a,1)}});s(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});s(this,"isInitiated",!1);s(this,"_whenInitiatedResolve");s(this,"_whenInitiatedReject");s(this,"_whenInitiated",new Promise((t,e)=>{this._whenInitiatedResolve=t,this._whenInitiatedReject=e}));s(this,"initiated",()=>this._whenInitiated);s(this,"props",{});s(this,"refs",{});this.id=(n==null?void 0:n.id)||F.Instance().assignId(t);let r=n!=null&&n.timeout?n==null?void 0:n.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(r," ").concat(this.id))},r),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(t){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=t}onMessageReceived(t){if(t.messageType===l.ExecuteComponentMethod){let n=t;return this[n.method]?this[n.method](n.content):console.log("method not found ".concat(n.method," on component"),this),!0}let e=this.messageHandlers[t.messageType];if(e&&e.length){let n=!1;return e.forEach(r=>{n=n||r(t)}),n}return!1}sendCleanupMessage(t){t.source=this.id,t.destination=this.id,t.direction=R.down;let e=this.bindWhen(t.replyMessageKey,r=>r.replayToHandler===t.handlerUniqueId,r=>{t.handler(r),e()}),n=t.handler;delete t.handler,this.send(t),t.handler=n}send(t){t.source||(t.source=this.id),t.destination||(t.destination=this.id),t.direction=R.down;let e;if(t.handler){let n=t;e=this.bindWhen(n.replyMessageKey,r=>r.replayToHandler===n.handlerUniqueId,n.handler),delete t.handler}return t.ref&&(t.ref=t.ref.__nonProxied||t.ref),t.cleanable?()=>{this.sendCleanupMessage(new De(t.id,n=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Le);let t=this.messageHandlers.onDispose;t&&t.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Me,$n=m(()=>{"use strict";Me=class{constructor(t,e,n,r,i){this.myopId=t;this.htmlTagName=e;this.BoundingRect=n;this.offsetTop=r;this.offsetLeft=i;s(this,"type","MyopElementRef")}}});var Un,x,qe,Nn=m(()=>{"use strict";Un=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let t=await o;typeof t=="function"&&t()}},x=class{constructor(t){this.messageToHost=t}},qe=class extends x{constructor(e,n){super(e);this.messageToHost=e;this.context=n}}});var Yt,Ie,Wn=m(()=>{"use strict";I();b();w();Yt=class{constructor(t,e){this.id=t;this.context=e;s(this,"send",t=>{})}},Ie=class{constructor(){s(this,"messageToHandleAfterInit",[]);s(this,"components",{});s(this,"alwaysPassEnvelopesToHost",!1);s(this,"messageCleanupCache",{})}handleIncomeMessages(t){let e=t.data?t.data:t.detail;if(!(!e||!e.myop)){let n=e;if(n.direction!==R.down)return;if(n.messageType===l.DisposeMessage){n.destination&&delete this.components[n.destination];return}if(n.messageType===l.InitMessage){let r=n.content.id;if(this.components[r])return;this.components[r]=new Yt(r),this.messageToHost(new Re(r));return}if(n.messageType===l.EnvelopedMessage){let r=n,i=r.message;if(n=i,this.alwaysPassEnvelopesToHost||this.components[n.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===r.destination);if(p){p.send(i);return}}else return}if(n.messageType){if(n.messageType===l.CleanupMessage){let i=n,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Be(!!a);p.destination=n.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Un(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let r=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===n.messageType){r=!0;let a=i.executor(n);if(n.cleanable&&a&&(this.messageCleanupCache[n.id]=a),a&&!n.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(n.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&&n.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(n.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 q,de,we,Ce,ce,je,xe,b=m(()=>{"use strict";$n();Nn();Wn();q={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},we={message:"message",code:"code"},Ce=class{};s(Ce,"code","code"),s(Ce,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},je={Segment:"Segment",Promo:"Promo",AB:"AB"},xe=class{constructor(t,e){this.container=t;this.shadowRoot=e;s(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));s(this,"getRoot",()=>this.shadowRoot||this.container)}}});var Xt,Cs,Qt,P,me=m(()=>{"use strict";Xt=o=>o!==Object(o),Cs=o=>typeof o=="function",Qt=o=>{if(Xt(o))return!0;if(Cs(o)||Object.getPrototypeOf(o))return!1;for(let t in o){let e=o[t];if(typeof e=="object"){if(!Qt(e))return!1}else{if(Xt(e))continue;return!1}}return!0},P=(o,t={},e=!0,n=new WeakMap)=>{if(Xt(o))return o;if(Array.isArray(o)){if(n.has(o))return n.get(o);let r=[];n.set(o,r);for(let i=0;i<o.length;i++){let a=o[i];r[i]=P(a,t,e,n)}return r}if(o!==null&&typeof o=="object"){if(n.has(o))return n.get(o);let r={};n.set(o,r);for(let i in o){let a=typeof t=="boolean"?t:t[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(r[i]=P(o[i],!0,e,n)):typeof a=="object"&&(r[i]=P(o[i],a,e,n)))}return r}return{}}});var Vn,qn=m(()=>{"use strict";Vn={notSerializableRefCall:(o,t)=>{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(t," \\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 Ke,jn=m(()=>{"use strict";Ve();w();Vt();Ke=class extends J{constructor(e,n,r){super(e,n.container,r);this.componentDefinition=e;this.parent=n;s(this,"send",e=>{let n=e.handler,r=super.send(e);return this.parent.send(new _e(this.id,e)),e.handler=n,r});s(this,"dispose",()=>{this.isInitiated&&this.send(new K("dispose")),super.dispose()})}hide(){this.send(new K("hide"))}show(){this.send(new K("show"))}inspect(){return this.send(new K("inspect"))}setHeightBasedOnDocumentElement(){this.send(new K("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new K("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var xs,Ge,Gn,Jn,Yn,ws,Zt,en,Je=m(()=>{"use strict";w();w();b();me();qn();jn();xs=(o,t,e)=>{let n=document.createElement("a");return n.textContent=o,n.style.position="relative",n.style.padding="0 5px",n.style.fontSize="14px",n.style.top="0",n.style.top="".concat(t,"px"),n.style.transform="translateX(-50%)",n.target="_blank",n.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),n},Ge=(o,t,e,n,r,i)=>{let a=xs("".concat(i.name," : ").concat(t),e,i);return n.insertBefore(a,r),r.style.border="1px solid #007BFF",r.style.display="block",()=>{r.style.border="unset",n.removeChild(a)}},Gn=(o,t,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(t,"\\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,t,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(t,"\\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."))},Yn=(o,t,e)=>{let n=t.reduce((i,a)=>N(h({},i),{[a.name]:h({},a)}),{}),r={get:(i,a)=>{let p=n[a];if(Gn(p,a,o))return!1;if(p.behavior.type===we.code){if(e.loader.type===q.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(G.create(p.behavior.ref)),c.push(f=>{d(f)}),p.behavior.params&&c.push(...p.behavior.params);let g=he[p.behavior.message];o.send(new g(...c))}):null},set:(i,a,p)=>{let d=n[a];if(Gn(d,a,o))return!1;if(d.behavior.type===we.code){if(e.loader.type===q.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let g=d.behavior,f=o.element.contentWindow,u=g.remap||a;if(f[u]=p,u==="myop_cta_handler"&&f.__myop_cta_queue){let y=f.__myop_cta_queue;f.__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(G.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let g=he[d.behavior.message];return o.send(new g(...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,r),o},ws=(o,t)=>new Proxy(o,{get(e,n){return e[n]?e[n]:(...i)=>new Promise(a=>{i.forEach(p=>{Qt(p)||Vn.notSerializableRefCall(n,p)}),t.send(new W(({ref:p,propName:d,functionArgs:c,makeSerializable:g})=>{if(p){let f=p[d];return g(typeof f=="function"?p[d](...c):f,!0)}return null},{elementId:e.refConfig.selector,propName:n,functionArgs:i},p=>{a(p.content)}))})},set(e,n,r){return t.send(new W(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:r,propName:n},i=>{})),!0}}),Zt=async(o,t,e,n)=>{let r=o.component;if(!r)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new Ke(t.type,r,n);e.push(p),await r.initiated();let d=setTimeout(()=>{a("timeout")},5e3);r.send(new ve(o.refConfig,t,N(h({},n||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let g=e.find(f=>f.id==p.id);if(g!==p){r.refs[o.refConfig.name]=g,i(g);return}else p.setInitiated(),r.refs[o.refConfig.name]=p;c.nestedRefs.forEach(f=>{let u=t.instance.resolvedNestedComponents.find(M=>M.type.id===f.componentDefinitionId).type,y=new Ke(u,p);y.setInitiated(),p.refs[f.refName]=y,e.push(y)});try{await en(p,t,e,!0),r.setHeightBasedOnScrollHeight&&r.setHeightBasedOnScrollHeight(),i(p)}catch(f){a(f)}}))})},en=async(o,t,e,n=!1)=>{o.refs||(o.refs={});let r=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==Ce.component){if(n){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let g=(d=t.instance.resolvedNestedComponents)==null?void 0:d.find(u=>u.type.id===c);if(!g)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let f=G.create("",i,o);try{let u=await Zt(f,g,e);o.refs[i.name]=u,a()}catch(u){p(u)}}else try{let c=G.create("",i,o);o.refs[i.name]=ws(c,o),a()}catch(c){}}));try{await Promise.all(r)}catch(i){throw i}}});var be,tn=m(()=>{"use strict";Ve();w();Je();I();be=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.componentConfig=e;this.container=r;this.IframeElement=i;s(this,"cleanupInspect");s(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,n=>{this.IframeElement.style.height="".concat(n.content,"px"),e()}))});s(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:n})=>{let{height:r,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();n({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:r,width:i}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px")})));s(this,"observeAutoSize",e=>{var Ee;let n=this.IframeElement,r=n.contentDocument;if(!r)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(O,U,ge)=>U!==void 0&&O<U?U:ge!==void 0&&O>ge?ge:O,a=O=>{if(O===void 0)return;if(typeof O=="number")return O;let U=parseFloat(O);return isNaN(U)?void 0:U},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),g=a(e==null?void 0:e.maxHeight),f=(Ee=e==null?void 0:e.loaderMinHeight)!=null?Ee:50,u=(e==null?void 0:e.explicitWidth)!==void 0,y=(e==null?void 0:e.explicitHeight)!==void 0,M=this.container.getBoundingClientRect(),le=M.width===0,Fe=M.height===0||M.height===f,j=(e!=null&&e.forceAutoSize||le)&&!u,H=(e!=null&&e.forceAutoSize||Fe)&&!y;if(!j&&!H)return()=>{};let A=()=>{var U;let O=n.contentDocument;if(O){let ge=O.documentElement.getBoundingClientRect(),cn=Math.ceil(ge.width),mn=Math.ceil(ge.height),ln=i(cn,p,d),fn=i(mn,c,g);j&&(n.style.width="".concat(ln,"px")),H&&(n.style.height="".concat(fn,"px"));let as=j&&d!==void 0&&cn>d,ps=H&&g!==void 0&&mn>g;O.documentElement.style.overflowX=as?"auto":"hidden",O.documentElement.style.overflowY=ps?"auto":"hidden",(U=e==null?void 0:e.onSizeChange)==null||U.call(e,{width:ln,height:fn,autoSizingWidth:j,autoSizingHeight:H})}};A();let fe=new ResizeObserver(A);return fe.observe(r.body),fe.observe(r.documentElement),()=>{fe.disconnect()}});s(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:n,width:r}=document.documentElement.getBoundingClientRect();return{height:n,width:r}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px"),e()}))});s(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let r=0;return r++,r--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+r+"px"},n=>{this.IframeElement.style.height=n.content,e()}))});s(this,"send",e=>{var i,a;let n=h({},e);if(n.messageType===l.ExecuteComponentMethod)return this[n.method](),()=>{};n.direction=R.down;let r=super.send(n);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(n,"*"),r});s(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});n.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Ge(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===l.In.MutationObserverMessage||e.messageType===l.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Y,Ye=m(()=>{"use strict";Y=class{constructor(){s(this,"appendChild",(t,e,n)=>{var r;if(n!=null&&n.relative){if(n.relative.direction==="before")return t.insertBefore(e,n.relative.child);if(n.relative.direction==="after"){let i=(r=n.relative.child)==null?void 0:r.nextSibling;return t.insertBefore(e,i||null)}}else return t.appendChild(e)})}}});var bs,Xe,Xn=m(()=>{"use strict";tn();Ye();ne();b();bs=(o,t,e)=>{let n=new URL(o);return n.searchParams.append(t,e),n.toString()},Xe=class extends Y{constructor(){super(...arguments);s(this,"type",q.IframeLoader);s(this,"load",async(e,n,r,i)=>{let a,p=n.loader;if((r==null?void 0:r.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,r),a=r,a.src=p.url;else{let d=T(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let g="\\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=g,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([u,y])=>{y===""||y===null||y===void 0?a.setAttribute(u,""):a.setAttribute(u,String(y))});let f=n.loader.url;i!=null&&i._hasParent&&(f=bs(f,"_myop-comp",d)),a.src=f,r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),a=this.appendChild(r,a,i)}return new be(e,n,r,a,i)})}}});var Qe,nn=m(()=>{"use strict";Qe={webcomponent_message_key:"myop_webcomponent_message"}});var Se,on=m(()=>{"use strict";nn();Ve();Je();Se=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.container=r;this.customElement=i;s(this,"cleanupInspect",()=>{});s(this,"send",e=>{let n=h({},e),r=super.send(n),i=new CustomEvent(Qe.webcomponent_message_key,{detail:n});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return r});s(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=Ge(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 sn,Ze,Qn=m(()=>{"use strict";on();Ye();ne();b();sn={},Ze=class extends Y{constructor(){super(...arguments);s(this,"type",q.WebComponentLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader;sn[a.url]?console.log("Module alreday loaded or in loading process"):sn[a.url]=new Promise((c,g)=>{let f=a.url,u=document.createElement("script");u.type="module",u.src=f,u.onload=()=>{c()},u.onerror=()=>{g()},document.head.appendChild(u)}),await sn[a.url],await hn(1);let p="myop-comp-".concat(T()),d=document.createElement(a.tag);return r.querySelector('[id^="myop-comp-"]')||(r.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(r,d,i),new Se(e,n,r,d,i)})}}});var E,$=m(()=>{"use strict";b();E=class extends qe{constructor(e,n){super(e);this.context=n;s(this,"executor",e=>{if(e.destination){let n=e.destination;if(this.context[n].context){let r=(i,a)=>{this.messageToHost(N(h({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[n].context,r)}else debugger}else debugger})}}});var B,X=m(()=>{"use strict";B={id:"myop-id"}});var S,Zn,L=m(()=>{"use strict";X();S=(o,t)=>t.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),Zn=(o,t)=>{let e=S(o,t);return e.length?e.item(0):null}});var et,eo=m(()=>{"use strict";I();w();$();L();et=class extends E{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{r(new oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var tt,to=m(()=>{"use strict";I();$();L();tt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var nt,no=m(()=>{"use strict";b();nt=class extends xe{constructor(e,n){super(e,n);this.container=e;this.shadowRoot=n}}});var ot,oo=m(()=>{"use strict";b();X();$();w();I();ot=class extends E{constructor(){super(...arguments);s(this,"innerExecutor",(e,n)=>{let r=n.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];r.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new Me(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,i))});s(this,"messageType",l.DetectMyopRefsMessage)}}});var st,so=m(()=>{"use strict";I();$();L();st=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var rt,ro=m(()=>{"use strict";I();w();$();L();me();rt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{r(new re(e.handlerUniqueId,P(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var it,io=m(()=>{"use strict";I();X();Pe();We();$();it=class extends E{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"innerExecutor",(e,n,r)=>{(async()=>{let a=n.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=F.Instance(),d=p.components.find(u=>u.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let g=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),f=[];Object.keys(g.refs).forEach(u=>{let y=g.refs[u];y=y.__nonProxied||y,y.componentDefinition&&f.push({refName:u,componentDefinitionId:y.componentDefinition.id})}),r(new V(e.handlerUniqueId,f))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var at,rn=m(()=>{"use strict";me();at=(o,t,e)=>{let n=o.scriptInputs?o.scriptInputs:{};n.makeSerializable=P,n.send=t,n.rootRef=e,n.__scriptInputs=n;let i=new Function("return (".concat(o.script,")(...arguments)"))(n);t(i)}});var pt,ao=m(()=>{"use strict";I();w();$();rn();pt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"innerExecutor",(e,n,r)=>{at(e,a=>{r(new se(e.handlerUniqueId,a))},n)})}}});var po,dt,co=m(()=>{"use strict";I();w();$();L();X();me();po=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:po(i),required:i.required,validity:P(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},dt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.GetElementValueMessage);s(this,"innerExecutor",(e,n,r)=>{S(e.ref,n.shadowRoot).forEach(a=>{r(new ie(po(a)),e)})})}}});var ct,mo=m(()=>{"use strict";I();$();L();ct=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var lo={};ee(lo,{WebComponentSDK:()=>Te});var Te,an=m(()=>{"use strict";b();I();nn();eo();to();no();oo();te();w();so();ro();io();ao();co();mo();Te=class extends Ie{constructor(){super(...arguments);s(this,"alwaysPassEnvelopesToHost",!0);s(this,"connectedCallback",(e,n)=>{e.addEventListener(Qe.webcomponent_message_key,r=>{let i=r.data?r.data:r.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(r),a.messageType===l.InitMessage){let p=a.content.id;this.components[p].context=new nt(e,n)}}}),setTimeout(()=>{this.messageToHost(new ae)},1)});s(this,"messageToHost",(e,n)=>{e.direction=R.up,!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId),window.myop.hostSDK.send(e)});s(this,"supportedHandlers",[new tt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new et(this.messageToHost,this.components),new ot(this.messageToHost,this.components),new st(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new pt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new it(this.messageToHost,this.components)]);s(this,"init",()=>{})}};z("WebComponentSDK",Te)});var fo=m(()=>{"use strict";an()});var go,uo=m(()=>{"use strict";go=""});function Ss(o,t){return class extends HTMLElement{connectedCallback(){let e=t===de.open?"open":"closed",n=this.attachShadow({mode:e});Mo().then(r=>{r.connectedCallback(this,n),n.innerHTML=o})}}}var ho,mt,Mo,Ts,Es,Rs,lt,Io=m(()=>{"use strict";on();Ye();ne();b();fo();tn();uo();ho=[],Mo=async()=>(mt||(mt=new Te,mt.init()),mt);Ts=(o,t,e)=>{customElements.define(o,Ss(t,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Es=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Rs=o=>(o=Es(o),o.replace(/_/g,"-")),lt=class extends Y{constructor(){super(...arguments);s(this,"type",q.HTMLLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader,p="myop-comp-".concat(T()),d;if(a.shadowRootMode===de.localFrame){let c=T(),g="myop-comp-".concat(c),f=document.createElement("iframe");f.id=g,f.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 "),r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),f=this.appendChild(r,f,i);let u=f.contentDocument||f.contentWindow.document;u.open();let y=a.HTML;if(i!=null&&i._inspection){let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A==null||A.removeAttribute("type");let fe=H.implementation.createHTMLDocument();fe.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let Ee=fe.body.firstChild;Ee&&H.head&&H.head.insertBefore(H.importNode(Ee,!0),H.head.firstChild),y=H.documentElement.outerHTML}else{let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A&&(A.remove(),y=H.documentElement.outerHTML)}u.writeln(y);let M='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),le="<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(u.writeln("".concat(M).concat(le)),(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>",H=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),A='<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>");u.writeln(j+A)}u.close();let Fe=new be(e,n,r,f,i);return a.autoHeight&&(f.onload=()=>{Fe.observeSizeBasedOnDocumentElement()}),Fe}if(a.shadowRootMode===de.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Mo().then(g=>{g.connectedCallback(d,d)})}else{let c=Rs(e.name+n.id);ho.includes(c)||(Ts(c,a.HTML,a.shadowRootMode),ho.push(c)),d=document.createElement(c)}return r.querySelector('[id^="myop-comp-"]')||(r.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(r,d,i),new Se(e,n,r,d,i)})}}});var Co,xo,wo=m(()=>{"use strict";ne();w();Co=(o,t,e)=>{let n="myop-css-".concat(T());return o.send(new D(({rootRef:r,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let g in i){c+="".concat(g," { ");let f=i[g];for(let u in f)c+="".concat(u,": ").concat(f[u],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(r.shadowRoot||r.container).appendChild(d)},()=>{},{_stylesheet:t,_css:e||"",_tagId:n})),()=>{o.send(new D(({rootRef:r,_tagId:i})=>{let a=(r.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:n}))}},xo=(o,t)=>{let e="myop-css-".concat(T());return o.send(new D(({rootRef:n,_tagId:r,_link:i})=>{let a=document.createElement("link");a.id=r,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(n.shadowRoot||n.container).appendChild(a)},()=>{},{_link:t,_tagId:e})),()=>{o.send(new D(({rootRef:n,_tagId:r})=>{let i=(n.shadowRoot||document).getElementById(r);i&&i.remove()},()=>{},{_tagId:e}))}}});var vs,pn,bo,So=m(()=>{"use strict";vs=(o,t)=>{let e=new RegExp(Object.keys(t).join("|"),"g");return o.replace(e,n=>(t[n]||n).toString())},pn=(o,t)=>{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=vs(o.loader.url,t),o},bo=o=>async t=>pn(t,o)});var To,Eo,Ro=m(()=>{"use strict";w();To=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.add(r)},{elementId:e,_className:t}))},Eo=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.remove(r)},{elementId:e,_className:t}))}});var ut,ft,yt,gt,vo=m(()=>{"use strict";ne();ut=class ut{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"id",this._runTimeId);s(this,"name",this._runTimeName);s(this,"description","");s(this,"loader",null);s(this,"withLoader",t=>(this.loader=t,this));s(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this));s(this,"build",()=>this)}};s(ut,"create",()=>new ut);ft=ut,yt=class yt{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});s(this,"name",this._runTimeName);s(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});s(this,"withInstance",t=>(this.instance=t,this));s(this,"withType",t=>(this.type=t,this));s(this,"withName",t=>(this.name=t,this));s(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this));s(this,"withRef",t=>(this.type.refs.push(t),this));s(this,"withBasicRef",t=>{let e={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(e),this});s(this,"build",()=>JSON.parse(JSON.stringify(this)))}};s(yt,"create",()=>new yt);gt=yt});var _s,ht,ks,Hs,Q,Z,_o,ko=m(()=>{"use strict";b();_s=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:we.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:we.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),ht="__MYOP_CLOUD_REPOSITORY_MAIN__",ks=()=>{if(typeof window<"u")return window[ht];if(typeof globalThis<"u")return globalThis[ht]},Hs=o=>{typeof window<"u"&&(window[ht]=o),typeof globalThis<"u"&&(globalThis[ht]=o)},Q=class Q{constructor(t="https://cloud.myop.dev"){this._baseUrl=t;s(this,"variants",{});s(this,"preloadedComponents",{});s(this,"userFlows",{});s(this,"_defaultEnv","production")}static get Main(){let t=ks();return t||(Q._main||(Q._main=new Q,Hs(Q._main)),Q._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,e,n){return e!==void 0||n!==void 0?"".concat(t,":").concat(e||this._defaultEnv,":").concat(n?"preview":"live")in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}async fetchComponentV2(t,e,n){let r=this.preloadedComponents[t],i=e!==void 0||n!==void 0,a,p;!i&&r?(a=r.env,p=r.preview):(a=e||this._defaultEnv,p=n===!0?!0:n===!1?!1:!e);let d="".concat(t,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:a,preview:p}),this.variants[d]=new Promise(async(c,g)=>{try{let f="".concat(this._baseUrl,"/consume?id=").concat(t,"&env=").concat(a);p&&(f+="&preview=true");let M=(await(await fetch(f)).json()).item;if(!M){g(new Error('Component "'.concat(t,'" not found')));return}if(!M.consume_variant||!M.consume_variant.length){g(new Error('Component "'.concat(t,'" has no implementation for environment "').concat(a,'"')));return}let le=_s(M);c(le)}catch(f){g(f)}})),await this.variants[d]}async fetchComponentV1(t,e){return e?(await this.fetchFlow(e)).components.find(r=>r.type.id===t):(await this.fetchAutoFlow(t)).components[0]}async fetchAutoFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&auto=true"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&resolve=components"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchComponent(t,e){return this.fetchComponentV1(t,e)}};s(Q,"_main",null);Z=Q,_o=Z});var Ho,Do=m(()=>{"use strict";Ho=async o=>await o()});var dn={};ee(dn,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var Mt=m(()=>{"use strict";wo();So();Ro();vo();ko();Do()});var Bo,Lo=m(()=>{"use strict";Ot();Mt();b();Bo=async o=>{try{let t=new URL(window.location.href),n=new URLSearchParams(t.search).get("myopOverride");if(n){let[r,...i]=Lt(n);switch(r){case"component":{let[a,p]=i,d=await Z.Main.fetchComponent(a);if(d&&d.type.skins.find(g=>g.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Lt(n),c=(await Z.Main.fetchFlow(a)).components.find(g=>g.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ce.Segmented&&c.instance.resolvedExperiences){let g=c.instance.resolvedExperiences.find(f=>f.id===p);if((g==null?void 0:g.type)===je.Segment){let f=g,y=c.instance.skinSelector.segments.find(M=>M.segmentId===f.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Ko={};ee(Ko,{HostSDK:()=>F,hostSDK:()=>Po});var Oo,F,Po,Pe=m(()=>{"use strict";te();I();w();Xn();Qn();Je();b();Ne();Io();Lo();Oo="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",F=class{constructor(){s(this,"components2init",[]);s(this,"components",[]);s(this,"componentsLoaders",[]);s(this,"initiated",!1);s(this,"version",ue);s(this,"type2InstanceCount",{});s(this,"assignId",t=>(this.type2InstanceCount[t.id]||(this.type2InstanceCount[t.id]=0),"".concat(t.id,"_").concat(++this.type2InstanceCount[t.id])));s(this,"inspected",!1);s(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(t=>{t.inspect&&t.inspect()}))});s(this,"incomingMessageHandler",t=>{if(t.origin,document.location.origin,t.data.myop){if(t.data.direction!==R.up&&t.data.messageType!==l.EnvelopedMessage)return;let e=t.data;if(e.messageType===l.InitRequest){this.components2init.forEach(r=>{r.send(new ye(r.id))});return}if(e.messageType===l.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let r=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});r==null||r.setInitiated();return}if(e.messageType===l.EnvelopedMessage){let r=e,i=this.components.find(a=>a.id===r.destination);if(i){if(r.direction===R.down){r.message.messageType===K.name?i.onMessageReceived(r.message):(r.message.route=r.route,i.send(r.message));return}}else{let a=this.components.find(p=>p.id===r.message.destination);a&&a.send(r.message)}return}let n=this.components.find(r=>r.id===e.destination);if(!n){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(n){if(n.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});s(this,"send",t=>{let e=new MessageEvent("",{data:t});this.incomingMessageHandler(e)});s(this,"init",t=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Xe,new Ze,new lt];if(this.componentsLoaders=[...e],t){let n={};t.forEach(r=>{let i=new r(this.componentsLoaders);n[i.type]=i}),this.componentsLoaders.forEach(r=>{n[r.type]||(n[r.type]=r)}),this.componentsLoaders=Object.values(n)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});s(this,"_getSkinIdBySkinSelector",async(t,e=[],n)=>{var i;async function r(a,p){for(let d of a)if(await p(d))return d}switch(t.type){case"DedicatedSkin":case ce.Dedicated:return((i=t.skin)==null?void 0:i.id)||t.skins[0].id;case ce.Segmented:{let p=await r(t.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===je.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let f=c.segment,u=(n||{})[f.function];return u?await u():(console.warn("segmentId:".concat(d.segmentId,", ").concat(f.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});s(this,"runSkinSelector",async(t,e)=>{let n=await this._getSkinIdBySkinSelector(t.instance.skinSelector,t.instance.resolvedExperiences,e);return t.type.skins.find(r=>r.id===n)});s(this,"loaderHooks");s(this,"loadComponent",async(t,e,n)=>{var g,f,u,y;if(!e){debugger;throw new Error("no container was found for this component")}let r=await Bo(t);r&&(t=r);let i=h(h({},(g=this.loaderHooks)!=null?g:{}),(f=n==null?void 0:n.hooks)!=null?f:{}),a=e;if(a.myop)if(a.component){t=h({},t),t.instance=h({},t.instance);let M=await this.runSkinSelector(t,i);if(!M)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(u=n==null?void 0:n.hooks)!=null&&u.afterSkinSelected&&(M=await n.hooks.afterSkinSelected(h({},M))),t.instance.skinSelector={type:ce.Dedicated,skin:M},n&&(n=h({},n),delete n.hooks),await Zt(a,t,this.components,n)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(t,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=n==null?void 0:n.hooks)!=null&&y.afterSkinSelected&&(p=await n.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(t.type,p,e,n);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),(!n||n.connectProps!==!1)&&(c=Yn(c,t.type.props,p));try{await en(c,t,this.components)}catch(M){throw M}return n!=null&&n.skipInit||await c.initiated(),c});s(this,"navigate",async(t,e,n)=>{if(t.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(n!=null&&n.staged){let r=await this.loadComponent(e,t.container,h({hidden:!0,relative:{direction:"after",child:t.element}},n));return n.init&&await n.init(r),r.show(),t.dispose(),r}else{let r=t.element.nextSibling;return t.dispose(),this.loadComponent(e,t.container,h({relative:{direction:"before",child:r}},n))}})}};s(F,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo});if(!window.myop.hostSDK){let o=new F;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo}),window.myop.hostSDK=o}Po=window.myop.hostSDK;z("hostSDK",Po)});var It,Ao=m(()=>{"use strict";I();X();b();w();It=class extends x{constructor(){super(...arguments);s(this,"messageType",l.DetectMyopRefsMessage);s(this,"executor",e=>{let n=document.querySelectorAll("[".concat(B.id,"]")),r=[];n.forEach(i=>{let a=i.getAttribute(B.id);a&&r.push(new Me(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,r))})}}});var Ct,Fo=m(()=>{"use strict";I();b();w();L();Ct=class extends x{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"executor",e=>{let n=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new oe,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};n.push(p)}),()=>{n.forEach(i=>i())}})}}});var xt,zo=m(()=>{"use strict";I();b();L();xt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.textContent=e.content})})}}});var wt,$o=m(()=>{"use strict";I();w();b();rn();wt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"executor",e=>{at(e,r=>{this.messageToHost(new se(e.handlerUniqueId,r))},new xe(document.documentElement))})}}});var bt,Uo=m(()=>{"use strict";I();b();w();me();L();bt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"executor",e=>{let n=S(e.ref,document),r=[];return n.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new re(e.handlerUniqueId,P(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),r.push(()=>{i.removeEventListener(e.type,a)})}),()=>{r.forEach(i=>{i()})}})}}});var St,No=m(()=>{"use strict";I();b();L();St=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var Tt,Wo=m(()=>{"use strict";I();X();b();Pe();We();Tt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"executor",e=>{(async()=>{let r=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(r.length===1){let a=await F.Instance().loadComponent(e.nestedComponentConfig,r.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 Vo,qo=m(()=>{"use strict";Vo=(o,t)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let n=new e(t),r={attributes:!0,childList:!0,subtree:!0};return n.observe(o,r),n}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",t,!1),o.addEventListener("DOMNodeRemoved",t,!1))}});var Et,jo=m(()=>{"use strict";I();w();b();qo();Et=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetMutationObserverMessage);s(this,"executor",e=>{e.source&&Vo(document.body,()=>{this.messageToHost(new He)})})}}});var Go,Rt,Jo=m(()=>{"use strict";I();X();b();w();me();L();Go=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:Go(i),required:i.required,validity:P(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);s(this,"messageType",l.GetElementValueMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{this.messageToHost(new ie(Go(r)),e)})})}}});var vt,Yo=m(()=>{"use strict";I();b();w();L();vt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.GetAttributeMessage);s(this,"executor",e=>{let n=Zn(e.ref,document);n&&this.messageToHost(new ke(n.getAttribute(e.name)),e)})}}});var _t,Xo=m(()=>{"use strict";w();I();b();_t=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetResizeObserverMessage);s(this,"executor",e=>{let n=new ResizeObserver(r=>{this.messageToHost(new Oe)});return n.observe(document.body),()=>{n.disconnect()}})}}});var kt,Qo=m(()=>{"use strict";I();b();L();kt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.innerHTML=e.content})})}}});var Zo={};ee(Zo,{IframeSDK:()=>Ht});var Ht,es=m(()=>{"use strict";b();Ao();Fo();zo();$o();te();Uo();No();w();Wo();jo();Jo();Ne();Yo();Xo();Qo();Ht=class extends Ie{constructor(){super();s(this,"version",ue);s(this,"messageToHost",(e,n)=>{var i;!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId);let r=Object.keys(this.components);e.destination||(n!=null&&n.route?e.destination=n.route[n.route.length-1]:e.destination=r[0]),e.source||(e.source=r[0]),e.direction=R.up,(i=window.parent)==null||i.postMessage(h({},e),"*")});s(this,"supportedHandlers",[new xt(this.messageToHost),new kt(this.messageToHost),new Ct(this.messageToHost),new It(this.messageToHost),new wt(this.messageToHost),new bt(this.messageToHost),new St(this.messageToHost),new Rt(this.messageToHost),new Et(this.messageToHost),new _t(this.messageToHost),new vt(this.messageToHost),new Tt(this.messageToHost)]);s(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};z("IframeSDK",Ht)});var Bs={};var Ds,ts=m(()=>{"use strict";w();te();Ds=h({},he);z("MyopMessages",Ds)});var ns={};ee(ns,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var os=m(()=>{"use strict";te();Mt();Mt();z("MyopHelpers",dn)});var As={};ee(As,{getHostModule:()=>ss,getIframeModule:()=>rs,getWebcomponentModule:()=>is});te();var yn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(yn=document.currentScript)==null?void 0:yn.src,t=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:t,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,t,e)=>{if(window.__federation__[t])console.log("__federation__ module ".concat(t," already loaded.")),e(window.__federation__[t][Bt]);else{let n;window.__federation__[t]={},window.__federation__[t][Ue]=r=>{n&&(document.head.removeChild(n),n=null),window.__federation__[t][Bt]=r,e(r)},n=document.createElement("script"),n.type="module",n.src=o,n.async=!0,document.head.appendChild(n)}};Ne();console.log("myop root sdk - loaded",document.location.origin);var Ls="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",ss=()=>Promise.resolve().then(()=>(Pe(),Ko)),rs=()=>Promise.resolve().then(()=>(es(),Zo)),is=()=>Promise.resolve().then(()=>(an(),lo)),Os=()=>Promise.resolve().then(()=>(ts(),Bs)),Ps=()=>Promise.resolve().then(()=>(os(),ns)),Ae=o=>async()=>(await o()).get(),Ks={version:ue,getHostModule:Ae(ss),getIframeModule:Ae(rs),getWebcomponentModule:Ae(is),getMyopMessages:Ae(Os),getMyopHelpers:Ae(Ps)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ls});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=h({rootSDK:Ks},window.myop);return us(As);})();
|
|
2
|
-
`;var Oe=Object.defineProperty,Pt=Object.defineProperties,At=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,be=(e,t,n)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))Bt.call(t,n)&&be(e,n,t[n]);if(Pe)for(var n of Pe(t))Ft.call(t,n)&&be(e,n,t[n]);return e},Z=(e,t)=>Pt(e,At(t)),$t=(e,t)=>{for(var n in t)Oe(e,n,{get:t[n],enumerable:!0})},a=(e,t,n)=>be(e,typeof t!="symbol"?t+"":t,n),y=(e,t,n)=>new Promise((s,i)=>{var o=l=>{try{c(n.next(l))}catch(d){i(d)}},r=l=>{try{c(n.throw(l))}catch(d){i(d)}},c=l=>l.done?s(l.value):Promise.resolve(l.value).then(o,r);c((n=n.apply(e,t)).next())}),he="__federation__",Ae="onLoad",Be=(e,t)=>{window[he]&&window[he][e]&&window[he][e][Ae]&&window[he][e][Ae]({[e]:t})},v={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",CleanupMessage:"CleanupMessage",In:{MutationObserverMessage:"MutationObserverMessage",ResizeObserverMessage:"ResizeObserverMessage"}},Ee={};$t(Ee,{AddEventListenerMessage:()=>Gt,BaseMyopMessage:()=>T,BindClickMessage:()=>qt,ChangeTextMessage:()=>jt,CleanupMessage:()=>st,CleanupReplayMessage:()=>it,ClickReplayMessage:()=>Ke,CreateRefComponentMessage:()=>Xe,CustomRefMessage:()=>Ce,DetectMyopRefsMessage:()=>Qt,DetectedMyopRefsMessage:()=>et,DisposeMessage:()=>ot,ElementValueReplayMessage:()=>Ve,EnvelopedMessage:()=>Qe,EventListenerCallbackMessage:()=>je,ExecuteComponentMethod:()=>K,ExecuteScriptMessage:()=>$,ExecuteScriptReplyMessage:()=>Ue,GetAttributeMessage:()=>Zt,GetAttributeReplayMessage:()=>en,GetElementValueMessage:()=>Jt,InitMessage:()=>Te,InitRequest:()=>Ye,InitResponse:()=>Ge,MessageDirection:()=>k,MutationObserverMessage:()=>nn,MyopBindMessage:()=>P,MyopBindReplayMessage:()=>O,MyopElementMessage:()=>Ut,Ref:()=>ee,RefComponentCreatedMessage:()=>Ie,ResizeObserverMessage:()=>on,SetAttributeMessage:()=>Yt,SetInnerHtml:()=>Xt,SetMutationObserverMessage:()=>tn,SetResizeObserverMessage:()=>sn,stripFunction:()=>ze});var V=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),Kt=e=>{const t=[...e].map(n=>n.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},Nt=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";const n=atob(t);return Uint8Array.from(n,s=>s.charCodeAt(0))},Fe=e=>{const t=Nt(e);if(t.length%16!==0)throw new Error("Invalid input length");const n=[];for(let s=0;s<t.length;s+=16)n.push(Kt(t.slice(s,s+16)));return n},zt=e=>new Promise(t=>setTimeout(t,e)),k=class{};a(k,"down","down"),a(k,"up","up");var T=class{constructor(){a(this,"id",V()),a(this,"myop",!0),a(this,"content"),a(this,"source"),a(this,"destination"),a(this,"route"),a(this,"ref"),a(this,"direction"),a(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},Ut=class extends T{constructor(e){super(),this.ref=e}},O=class extends T{constructor(e){super(),this.replayToHandler=e}},P=class extends T{constructor(t){super(),this.handler=t,a(this,"handlerUniqueId",V())}},ee=class Lt{constructor(t,n){this.refConfig=t,this.component=n,a(this,"myop",!0),a(this,"__nonProxied"),this.__nonProxied=Z(C({},this),{component:null})}static create(t,n,s){let i=n;return i||(i={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new Lt(i,s)}},$e="ClickReplayMessage",qt=class extends P{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",$e),a(this,"messageType","BindClickMessage"),a(this,"cleanable",!0)}},Ke=class extends O{constructor(){super(...arguments),a(this,"messageType",$e)}},jt=class extends T{constructor(e,t){super(),this.ref=e,a(this,"messageType","ChangeTextMessage"),this.content=t}},Ne="ExecuteScriptReplyMessage",Wt=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,Vt=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,ze=e=>{let t=e.match(Wt);if(t)return t[1]||t[3];{let n=e.match(Vt);if(n)return n[1].trim()}},$=class extends P{constructor(t,n=()=>{},s){super(n),this.scriptInputs=s,a(this,"replyMessageKey",Ne),a(this,"messageType","ExecuteScriptMessage"),a(this,"script",""),this.script=t.toString(),this.content=t.toString(),this.content=ze(this.content)}};a($,"replierKey","send"),a($,"completeStreamKey","completeStream");var Ue=class extends O{constructor(e,t){super(e),this.replayToHandler=e,this.content=t,a(this,"messageType",Ne)}},Ce=class extends ${constructor(e,t,n=()=>{}){super(({rootRef:s,elementId:i,_script:o,__scriptInputs:r})=>{const c=(s.shadowRoot||s.container).querySelectorAll(`[myop-id='${i}']`);return c.length?(r.ref=c[0],new Function(`return (${o})(...arguments)`)(r)):null},n),this.scriptInputs=t,this.scriptInputs=Z(C({},t),{_script:e.toString()})}},qe="EventListenerCallbackMessage",Gt=class extends P{constructor(e,t,n){super(n),this.ref=e,this.type=t,this.handler=n,a(this,"replyMessageKey",qe),a(this,"messageType","AddEventListenerMessage"),a(this,"cleanable",!0),a(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},je=class extends O{constructor(e,t){super(e),this.replayToHandler=e,this.e=t,a(this,"messageType",qe),this.content={e:t}}},Yt=class extends T{constructor(e,t,n){super(),this.ref=e,this.name=t,this.value=n,a(this,"messageType","SetAttributeMessage")}},We="ElementValueReplayMessage",Jt=class extends P{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",We),a(this,"messageType","GetElementValueMessage")}},Ve=class extends O{constructor(e){super(),this.content=e,a(this,"messageType",We)}},Xt=class extends T{constructor(e,t){super(),this.ref=e,a(this,"messageType","SetInnerHtml"),this.content=t}},Te=class extends T{constructor(e){super(),a(this,"messageType","InitMessage"),this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Ge=class extends Te{constructor(){super(...arguments),a(this,"messageType","InitResponse")}},Ye=class extends T{constructor(){super(...arguments),a(this,"messageType","InitRequest")}},Je="RefComponentCreatedMessage",Xe=class extends P{constructor(e,t,n,s){super(s),this.refConfig=e,this.nestedComponentConfig=t,this.options=n,a(this,"replyMessageKey",Je),a(this,"messageType","CreateRefComponentMessage")}},Ie=class extends O{constructor(e,t,n){super(e),this.replayToHandler=e,this.nestedRefs=t,this.failed=n,a(this,"messageType",Je)}},Qe=class extends T{constructor(e,t){super(),this.destination=e,this.message=t,a(this,"messageType","EnvelopedMessage");const n=t;this.route=[e,...n.route?n.route:[]]}},Ze="DetectedMyopRefsMessage",Qt=class extends P{constructor(){super(...arguments),a(this,"messageType","DetectMyopRefsMessage"),a(this,"replyMessageKey",Ze)}},et=class extends O{constructor(e,t){super(e),this.replayToHandler=e,a(this,"messageType",Ze),this.content=t}isTypeof(e){return e.messageType===this.messageType}},tt="GetAttributeReplayMessage",Zt=class extends P{constructor(e,t,n){super(n),this.ref=e,this.name=t,a(this,"replyMessageKey",tt),a(this,"messageType","GetAttributeMessage")}},en=class extends O{constructor(e){super(),this.content=e,a(this,"messageType",tt)}},K=class extends T{constructor(e){super(),this.method=e,a(this,"messageType","ExecuteComponentMethod")}},tn=class extends T{constructor(){super(...arguments),a(this,"messageType","SetMutationObserverMessage")}},nn=class extends T{constructor(){super(...arguments),a(this,"messageType","MutationObserverMessage")}},nt="CleanupReplayMessage",st=class extends P{constructor(e,t){super(t),this.cleanupForMessageId=e,a(this,"replyMessageKey",nt),a(this,"messageType","CleanupMessage")}},it=class extends O{constructor(e){super(),this.customCleanup=e,a(this,"messageType",nt)}},ot=class extends T{constructor(){super(...arguments),a(this,"messageType","DisposeMessage")}},sn=class extends T{constructor(){super(...arguments),a(this,"cleanable",!0),a(this,"messageType","SetResizeObserverMessage")}},on=class extends T{constructor(){super(...arguments),a(this,"messageType","ResizeObserverMessage")}},Se=class{constructor(e,t,n){this.componentDefinition=e,this.container=t,a(this,"id",""),a(this,"messageHandlers",{}),a(this,"element"),a(this,"_markedForDisposed",!1),a(this,"bind",(i,o)=>{this.messageHandlers[i]||(this.messageHandlers[i]=[]),this.messageHandlers[i].includes(o)||this.messageHandlers[i].push(o)}),a(this,"bindWhen",(i,o,r)=>{if(!r)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[i]||(this.messageHandlers[i]=[]);const c=this.messageHandlers[i],l=d=>o(d)?(r(d),!0):!1;return c.push(l),()=>{const d=c.indexOf(l);d>-1&&c.splice(d,1)}}),a(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()}),a(this,"isInitiated",!1),a(this,"_whenInitiatedResolve"),a(this,"_whenInitiatedReject"),a(this,"_whenInitiated",new Promise((i,o)=>{this._whenInitiatedResolve=i,this._whenInitiatedReject=o})),a(this,"initiated",()=>this._whenInitiated),a(this,"props",{}),a(this,"refs",{}),this.id=(n==null?void 0:n.id)||ge.Instance().assignId(e);const s=n!=null&&n.timeout?n==null?void 0:n.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject(`timeout_${s} ${this.id}`)},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(e){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=e}onMessageReceived(e){if(e.messageType===v.ExecuteComponentMethod){const n=e;return this[n.method]?this[n.method](n.content):console.log(`method not found ${n.method} on component`,this),!0}const t=this.messageHandlers[e.messageType];if(t&&t.length){let n=!1;return t.forEach(s=>{n=n||s(e)}),n}return!1}sendCleanupMessage(e){e.source=this.id,e.destination=this.id,e.direction=k.down;const t=this.bindWhen(e.replyMessageKey,s=>s.replayToHandler===e.handlerUniqueId,s=>{e.handler(s),t()}),n=e.handler;delete e.handler,this.send(e),e.handler=n}send(e){e.source||(e.source=this.id),e.destination||(e.destination=this.id),e.direction=k.down;let t;if(e.handler){const n=e;t=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,n.handler),delete e.handler}return e.ref&&(e.ref=e.ref.__nonProxied||e.ref),e.cleanable?()=>{this.sendCleanupMessage(new st(e.id,n=>{})),t&&t()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new ot);const e=this.messageHandlers.onDispose;e&&e.forEach(t=>{t(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}},rn=class{constructor(e,t,n,s,i){this.myopId=e,this.htmlTagName=t,this.BoundingRect=n,this.offsetTop=s,this.offsetLeft=i,a(this,"type","MyopElementRef")}},an=e=>y(void 0,null,function*(){if(typeof e=="function")e();else if(e instanceof Promise){const t=yield e;typeof t=="function"&&t()}}),cn=class{constructor(e){this.messageToHost=e}},ln=class extends cn{constructor(e,t){super(e),this.messageToHost=e,this.context=t}},dn=class{constructor(e,t){this.id=e,this.context=t,a(this,"send",n=>{})}},un=class{constructor(){a(this,"messageToHandleAfterInit",[]),a(this,"components",{}),a(this,"alwaysPassEnvelopesToHost",!1),a(this,"messageCleanupCache",{})}handleIncomeMessages(e){const t=e.data?e.data:e.detail;if(!(!t||!t.myop)){let n=t;if(n.direction!==k.down)return;if(n.messageType===v.DisposeMessage){n.destination&&delete this.components[n.destination];return}if(n.messageType===v.InitMessage){const s=n.content.id;if(this.components[s])return;this.components[s]=new dn(s),this.messageToHost(new Ge(s));return}if(n.messageType===v.EnvelopedMessage){const s=n,i=s.message;if(n=i,this.alwaysPassEnvelopesToHost||this.components[n.destination]){const o=myop.hostSDK.components.find(c=>c.id===i.destination);if(o){o.send(i);return}const r=myop.hostSDK.components.find(c=>c.id===s.destination);if(r){r.send(i);return}}else return}if(n.messageType){if(n.messageType===v.CleanupMessage){const s=n,i=this.messageCleanupCache[s.cleanupForMessageId],o=new it(!!i);o.destination=n.destination,i?(delete this.messageCleanupCache[s.cleanupForMessageId],an(i).then(()=>{this.messageToHost(o,s)}).catch(()=>{})):this.messageToHost(o,s);return}this.supportedHandlers.forEach(s=>{if(s.messageType===n.messageType){const i=s.executor(n);if(n.cleanable&&i&&(this.messageCleanupCache[n.id]=i),i&&!n.cleanable)throw new Error(`Cleanup handler generated for non-cleanable message.
|
|
1
|
+
(function(_,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],E):(_=typeof globalThis<"u"?globalThis:_||self,E(_["@myop/react"]={},_.React,_.React))})(this,(function(_,E,w){"use strict";const At=`"use strict";var MyopSDK=(()=>{var ze=Object.defineProperty,ds=Object.defineProperties,cs=Object.getOwnPropertyDescriptor,ms=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertyNames,gn=Object.getOwnPropertySymbols;var un=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable;var Dt=(o,t,e)=>t in o?ze(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,h=(o,t)=>{for(var e in t||(t={}))un.call(t,e)&&Dt(o,e,t[e]);if(gn)for(var e of gn(t))fs.call(t,e)&&Dt(o,e,t[e]);return o},N=(o,t)=>ds(o,ms(t));var m=(o,t)=>()=>(o&&(t=o(o=0)),t);var ee=(o,t)=>{for(var e in t)ze(o,e,{get:t[e],enumerable:!0})},gs=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ls(t))!un.call(o,r)&&r!==e&&ze(o,r,{get:()=>t[r],enumerable:!(n=cs(t,r))||n.enumerable});return o};var us=o=>gs(ze({},"__esModule",{value:!0}),o);var s=(o,t,e)=>Dt(o,typeof t!="symbol"?t+"":t,e);var $e,Ue,Bt,z,te=m(()=>{"use strict";$e="__federation__",Ue="onLoad",Bt="moduleInstance",z=(o,t)=>{window[$e]&&window[$e][o]&&window[$e][o][Ue]&&window[$e][o][Ue]({[o]:t})}});var ue,Ne=m(()=>{ue="0.3.13"});var l,I=m(()=>{"use strict";l={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 T,ys,hs,Lt,Ot=m(()=>{"use strict";T=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),ys=o=>{let t=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},hs=o=>{let t=o.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let e=atob(t);return Uint8Array.from(e,n=>n.charCodeAt(0))},Lt=o=>{let t=hs(o);if(t.length%16!==0)throw new Error("Invalid input length");let e=[];for(let n=0;n<t.length;n+=16)e.push(ys(t.slice(n,n+16)));return e}});var hn,ne=m(()=>{"use strict";Ot();hn=o=>new Promise(t=>setTimeout(t,o))});var R,C,Pt,v,_,G,k=m(()=>{"use strict";ne();R=class{};s(R,"down","down"),s(R,"up","up");C=class{constructor(){s(this,"id",T());s(this,"myop",!0);s(this,"content");s(this,"source");s(this,"destination");s(this,"route");s(this,"ref");s(this,"direction");s(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},Pt=class extends C{constructor(e){super();this.ref=e}},v=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;s(this,"handlerUniqueId",T())}},G=class o{constructor(t,e){this.refConfig=t;this.component=e;s(this,"myop",!0);s(this,"__nonProxied");this.__nonProxied=N(h({},this),{component:null})}static create(t,e,n){let r=e;return r||(r={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new o(r,n)}}});var Mn,Kt,oe,In=m(()=>{"use strict";k();Mn="ClickReplayMessage",Kt=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Mn);s(this,"messageType","BindClickMessage");s(this,"cleanable",!0)}},oe=class extends v{constructor(){super(...arguments);s(this,"messageType",Mn)}}});var At,Cn=m(()=>{"use strict";k();At=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","ChangeTextMessage");this.content=n}}});var xn,Ms,Is,wn,D,se,Ft=m(()=>{"use strict";k();xn="ExecuteScriptReplyMessage",Ms=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Is=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,wn=o=>{let t=o.match(Ms);if(t)return t[1]||t[3];{let e=o.match(Is);if(e)return e[1].trim()}},D=class extends _{constructor(e,n=()=>{},r){super(n);this.scriptInputs=r;s(this,"replyMessageKey",xn);s(this,"messageType","ExecuteScriptMessage");s(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=wn(this.content)}};s(D,"replierKey","send"),s(D,"completeStreamKey","completeStream");se=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.content=n;s(this,"messageType",xn)}}});var W,bn=m(()=>{"use strict";Ft();W=class extends D{constructor(e,n,r=()=>{}){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},r);this.scriptInputs=n;this.scriptInputs=N(h({},n),{_script:e.toString()})}}});var Sn,zt,re,Tn=m(()=>{"use strict";k();Sn="EventListenerCallbackMessage",zt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.type=n;this.handler=r;s(this,"replyMessageKey",Sn);s(this,"messageType","AddEventListenerMessage");s(this,"cleanable",!0);s(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},re=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.e=n;s(this,"messageType",Sn);this.content={e:n}}}});var $t,En=m(()=>{"use strict";k();$t=class extends C{constructor(e,n,r){super();this.ref=e;this.name=n;this.value=r;s(this,"messageType","SetAttributeMessage")}}});var Rn,Ut,ie,Nt=m(()=>{"use strict";k();Rn="ElementValueReplayMessage",Ut=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Rn);s(this,"messageType","GetElementValueMessage")}},ie=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Rn)}}});var Wt,vn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","SetInnerHtml");this.content=n}}});var ye,Re,ae,_n=m(()=>{"use strict";k();ye=class extends C{constructor(e){super();s(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Re=class extends ye{constructor(){super(...arguments);s(this,"messageType","InitResponse")}},ae=class extends C{constructor(){super(...arguments);s(this,"messageType","InitRequest")}}});var kn,ve,V,We=m(()=>{"use strict";k();kn="RefComponentCreatedMessage",ve=class extends _{constructor(e,n,r,i){super(i);this.refConfig=e;this.nestedComponentConfig=n;this.options=r;s(this,"replyMessageKey",kn);s(this,"messageType","CreateRefComponentMessage")}},V=class extends v{constructor(e,n,r){super(e);this.replayToHandler=e;this.nestedRefs=n;this.failed=r;s(this,"messageType",kn)}}});var _e,Vt=m(()=>{"use strict";k();_e=class extends C{constructor(e,n){super();this.destination=e;this.message=n;s(this,"messageType","EnvelopedMessage");let r=n;this.route=[e,...r.route?r.route:[]]}}});var Hn,qt,pe,Dn=m(()=>{"use strict";k();Hn="DetectedMyopRefsMessage",qt=class extends _{constructor(){super(...arguments);s(this,"messageType","DetectMyopRefsMessage");s(this,"replyMessageKey",Hn)}},pe=class extends v{constructor(e,n){super(e);this.replayToHandler=e;s(this,"messageType",Hn);this.content=n}isTypeof(e){return e.messageType===this.messageType}}});var Bn,jt,ke,Ln=m(()=>{"use strict";k();Bn="GetAttributeReplayMessage",jt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.name=n;s(this,"replyMessageKey",Bn);s(this,"messageType","GetAttributeMessage")}},ke=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Bn)}}});var K,On=m(()=>{"use strict";k();K=class extends C{constructor(e){super();this.method=e;s(this,"messageType","ExecuteComponentMethod")}}});var Gt,He,Pn=m(()=>{"use strict";k();Gt=class extends C{constructor(){super(...arguments);s(this,"messageType","SetMutationObserverMessage")}},He=class extends C{constructor(){super(...arguments);s(this,"messageType","MutationObserverMessage")}}});var Kn,De,Be,An=m(()=>{"use strict";k();Kn="CleanupReplayMessage",De=class extends _{constructor(e,n){super(n);this.cleanupForMessageId=e;s(this,"replyMessageKey",Kn);s(this,"messageType","CleanupMessage")}},Be=class extends v{constructor(e){super();this.customCleanup=e;s(this,"messageType",Kn)}}});var Le,Fn=m(()=>{"use strict";k();Le=class extends C{constructor(){super(...arguments);s(this,"messageType","DisposeMessage")}}});var Jt,Oe,zn=m(()=>{"use strict";k();Jt=class extends C{constructor(){super(...arguments);s(this,"cleanable",!0);s(this,"messageType","SetResizeObserverMessage")}},Oe=class extends C{constructor(){super(...arguments);s(this,"messageType","ResizeObserverMessage")}}});var he={};ee(he,{AddEventListenerMessage:()=>zt,BaseMyopMessage:()=>C,BindClickMessage:()=>Kt,ChangeTextMessage:()=>At,CleanupMessage:()=>De,CleanupReplayMessage:()=>Be,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>ve,CustomRefMessage:()=>W,DetectMyopRefsMessage:()=>qt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Le,ElementValueReplayMessage:()=>ie,EnvelopedMessage:()=>_e,EventListenerCallbackMessage:()=>re,ExecuteComponentMethod:()=>K,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>jt,GetAttributeReplayMessage:()=>ke,GetElementValueMessage:()=>Ut,InitMessage:()=>ye,InitRequest:()=>ae,InitResponse:()=>Re,MessageDirection:()=>R,MutationObserverMessage:()=>He,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>v,MyopElementMessage:()=>Pt,Ref:()=>G,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>Oe,SetAttributeMessage:()=>$t,SetInnerHtml:()=>Wt,SetMutationObserverMessage:()=>Gt,SetResizeObserverMessage:()=>Jt,stripFunction:()=>wn});var w=m(()=>{"use strict";k();In();Cn();Ft();bn();Tn();En();Nt();vn();_n();We();Vt();Dn();Nt();Ln();On();Pn();An();Fn();zn()});var J,Ve=m(()=>{"use strict";I();w();Pe();J=class{constructor(t,e,n){this.componentDefinition=t;this.container=e;s(this,"id","");s(this,"messageHandlers",{});s(this,"element");s(this,"_markedForDisposed",!1);s(this,"bind",(t,e)=>{this.messageHandlers[t]||(this.messageHandlers[t]=[]),this.messageHandlers[t].includes(e)||this.messageHandlers[t].push(e)});s(this,"bindWhen",(t,e,n)=>{if(!n)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[t]||(this.messageHandlers[t]=[]);let r=this.messageHandlers[t],i=a=>e(a)?(n(a),!0):!1;return r.push(i),()=>{let a=r.indexOf(i);a>-1&&r.splice(a,1)}});s(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});s(this,"isInitiated",!1);s(this,"_whenInitiatedResolve");s(this,"_whenInitiatedReject");s(this,"_whenInitiated",new Promise((t,e)=>{this._whenInitiatedResolve=t,this._whenInitiatedReject=e}));s(this,"initiated",()=>this._whenInitiated);s(this,"props",{});s(this,"refs",{});this.id=(n==null?void 0:n.id)||F.Instance().assignId(t);let r=n!=null&&n.timeout?n==null?void 0:n.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(r," ").concat(this.id))},r),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(t){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=t}onMessageReceived(t){if(t.messageType===l.ExecuteComponentMethod){let n=t;return this[n.method]?this[n.method](n.content):console.log("method not found ".concat(n.method," on component"),this),!0}let e=this.messageHandlers[t.messageType];if(e&&e.length){let n=!1;return e.forEach(r=>{n=n||r(t)}),n}return!1}sendCleanupMessage(t){t.source=this.id,t.destination=this.id,t.direction=R.down;let e=this.bindWhen(t.replyMessageKey,r=>r.replayToHandler===t.handlerUniqueId,r=>{t.handler(r),e()}),n=t.handler;delete t.handler,this.send(t),t.handler=n}send(t){t.source||(t.source=this.id),t.destination||(t.destination=this.id),t.direction=R.down;let e;if(t.handler){let n=t;e=this.bindWhen(n.replyMessageKey,r=>r.replayToHandler===n.handlerUniqueId,n.handler),delete t.handler}return t.ref&&(t.ref=t.ref.__nonProxied||t.ref),t.cleanable?()=>{this.sendCleanupMessage(new De(t.id,n=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Le);let t=this.messageHandlers.onDispose;t&&t.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Me,$n=m(()=>{"use strict";Me=class{constructor(t,e,n,r,i){this.myopId=t;this.htmlTagName=e;this.BoundingRect=n;this.offsetTop=r;this.offsetLeft=i;s(this,"type","MyopElementRef")}}});var Un,x,qe,Nn=m(()=>{"use strict";Un=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let t=await o;typeof t=="function"&&t()}},x=class{constructor(t){this.messageToHost=t}},qe=class extends x{constructor(e,n){super(e);this.messageToHost=e;this.context=n}}});var Yt,Ie,Wn=m(()=>{"use strict";I();b();w();Yt=class{constructor(t,e){this.id=t;this.context=e;s(this,"send",t=>{})}},Ie=class{constructor(){s(this,"messageToHandleAfterInit",[]);s(this,"components",{});s(this,"alwaysPassEnvelopesToHost",!1);s(this,"messageCleanupCache",{})}handleIncomeMessages(t){let e=t.data?t.data:t.detail;if(!(!e||!e.myop)){let n=e;if(n.direction!==R.down)return;if(n.messageType===l.DisposeMessage){n.destination&&delete this.components[n.destination];return}if(n.messageType===l.InitMessage){let r=n.content.id;if(this.components[r])return;this.components[r]=new Yt(r),this.messageToHost(new Re(r));return}if(n.messageType===l.EnvelopedMessage){let r=n,i=r.message;if(n=i,this.alwaysPassEnvelopesToHost||this.components[n.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===r.destination);if(p){p.send(i);return}}else return}if(n.messageType){if(n.messageType===l.CleanupMessage){let i=n,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Be(!!a);p.destination=n.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Un(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let r=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===n.messageType){r=!0;let a=i.executor(n);if(n.cleanable&&a&&(this.messageCleanupCache[n.id]=a),a&&!n.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(n.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&&n.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(n.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 q,de,we,Ce,ce,je,xe,b=m(()=>{"use strict";$n();Nn();Wn();q={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},we={message:"message",code:"code"},Ce=class{};s(Ce,"code","code"),s(Ce,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},je={Segment:"Segment",Promo:"Promo",AB:"AB"},xe=class{constructor(t,e){this.container=t;this.shadowRoot=e;s(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));s(this,"getRoot",()=>this.shadowRoot||this.container)}}});var Xt,Cs,Qt,P,me=m(()=>{"use strict";Xt=o=>o!==Object(o),Cs=o=>typeof o=="function",Qt=o=>{if(Xt(o))return!0;if(Cs(o)||Object.getPrototypeOf(o))return!1;for(let t in o){let e=o[t];if(typeof e=="object"){if(!Qt(e))return!1}else{if(Xt(e))continue;return!1}}return!0},P=(o,t={},e=!0,n=new WeakMap)=>{if(Xt(o))return o;if(Array.isArray(o)){if(n.has(o))return n.get(o);let r=[];n.set(o,r);for(let i=0;i<o.length;i++){let a=o[i];r[i]=P(a,t,e,n)}return r}if(o!==null&&typeof o=="object"){if(n.has(o))return n.get(o);let r={};n.set(o,r);for(let i in o){let a=typeof t=="boolean"?t:t[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(r[i]=P(o[i],!0,e,n)):typeof a=="object"&&(r[i]=P(o[i],a,e,n)))}return r}return{}}});var Vn,qn=m(()=>{"use strict";Vn={notSerializableRefCall:(o,t)=>{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(t," \\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 Ke,jn=m(()=>{"use strict";Ve();w();Vt();Ke=class extends J{constructor(e,n,r){super(e,n.container,r);this.componentDefinition=e;this.parent=n;s(this,"send",e=>{let n=e.handler,r=super.send(e);return this.parent.send(new _e(this.id,e)),e.handler=n,r});s(this,"dispose",()=>{this.isInitiated&&this.send(new K("dispose")),super.dispose()})}hide(){this.send(new K("hide"))}show(){this.send(new K("show"))}inspect(){return this.send(new K("inspect"))}setHeightBasedOnDocumentElement(){this.send(new K("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new K("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var xs,Ge,Gn,Jn,Yn,ws,Zt,en,Je=m(()=>{"use strict";w();w();b();me();qn();jn();xs=(o,t,e)=>{let n=document.createElement("a");return n.textContent=o,n.style.position="relative",n.style.padding="0 5px",n.style.fontSize="14px",n.style.top="0",n.style.top="".concat(t,"px"),n.style.transform="translateX(-50%)",n.target="_blank",n.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),n},Ge=(o,t,e,n,r,i)=>{let a=xs("".concat(i.name," : ").concat(t),e,i);return n.insertBefore(a,r),r.style.border="1px solid #007BFF",r.style.display="block",()=>{r.style.border="unset",n.removeChild(a)}},Gn=(o,t,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(t,"\\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,t,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(t,"\\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."))},Yn=(o,t,e)=>{let n=t.reduce((i,a)=>N(h({},i),{[a.name]:h({},a)}),{}),r={get:(i,a)=>{let p=n[a];if(Gn(p,a,o))return!1;if(p.behavior.type===we.code){if(e.loader.type===q.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(G.create(p.behavior.ref)),c.push(f=>{d(f)}),p.behavior.params&&c.push(...p.behavior.params);let g=he[p.behavior.message];o.send(new g(...c))}):null},set:(i,a,p)=>{let d=n[a];if(Gn(d,a,o))return!1;if(d.behavior.type===we.code){if(e.loader.type===q.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let g=d.behavior,f=o.element.contentWindow,u=g.remap||a;if(f[u]=p,u==="myop_cta_handler"&&f.__myop_cta_queue){let y=f.__myop_cta_queue;f.__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(G.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let g=he[d.behavior.message];return o.send(new g(...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,r),o},ws=(o,t)=>new Proxy(o,{get(e,n){return e[n]?e[n]:(...i)=>new Promise(a=>{i.forEach(p=>{Qt(p)||Vn.notSerializableRefCall(n,p)}),t.send(new W(({ref:p,propName:d,functionArgs:c,makeSerializable:g})=>{if(p){let f=p[d];return g(typeof f=="function"?p[d](...c):f,!0)}return null},{elementId:e.refConfig.selector,propName:n,functionArgs:i},p=>{a(p.content)}))})},set(e,n,r){return t.send(new W(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:r,propName:n},i=>{})),!0}}),Zt=async(o,t,e,n)=>{let r=o.component;if(!r)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new Ke(t.type,r,n);e.push(p),await r.initiated();let d=setTimeout(()=>{a("timeout")},5e3);r.send(new ve(o.refConfig,t,N(h({},n||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let g=e.find(f=>f.id==p.id);if(g!==p){r.refs[o.refConfig.name]=g,i(g);return}else p.setInitiated(),r.refs[o.refConfig.name]=p;c.nestedRefs.forEach(f=>{let u=t.instance.resolvedNestedComponents.find(M=>M.type.id===f.componentDefinitionId).type,y=new Ke(u,p);y.setInitiated(),p.refs[f.refName]=y,e.push(y)});try{await en(p,t,e,!0),r.setHeightBasedOnScrollHeight&&r.setHeightBasedOnScrollHeight(),i(p)}catch(f){a(f)}}))})},en=async(o,t,e,n=!1)=>{o.refs||(o.refs={});let r=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==Ce.component){if(n){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let g=(d=t.instance.resolvedNestedComponents)==null?void 0:d.find(u=>u.type.id===c);if(!g)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let f=G.create("",i,o);try{let u=await Zt(f,g,e);o.refs[i.name]=u,a()}catch(u){p(u)}}else try{let c=G.create("",i,o);o.refs[i.name]=ws(c,o),a()}catch(c){}}));try{await Promise.all(r)}catch(i){throw i}}});var be,tn=m(()=>{"use strict";Ve();w();Je();I();be=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.componentConfig=e;this.container=r;this.IframeElement=i;s(this,"cleanupInspect");s(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,n=>{this.IframeElement.style.height="".concat(n.content,"px"),e()}))});s(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:n})=>{let{height:r,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();n({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:r,width:i}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px")})));s(this,"observeAutoSize",e=>{var Ee;let n=this.IframeElement,r=n.contentDocument;if(!r)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(O,U,ge)=>U!==void 0&&O<U?U:ge!==void 0&&O>ge?ge:O,a=O=>{if(O===void 0)return;if(typeof O=="number")return O;let U=parseFloat(O);return isNaN(U)?void 0:U},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),g=a(e==null?void 0:e.maxHeight),f=(Ee=e==null?void 0:e.loaderMinHeight)!=null?Ee:50,u=(e==null?void 0:e.explicitWidth)!==void 0,y=(e==null?void 0:e.explicitHeight)!==void 0,M=this.container.getBoundingClientRect(),le=M.width===0,Fe=M.height===0||M.height===f,j=(e!=null&&e.forceAutoSize||le)&&!u,H=(e!=null&&e.forceAutoSize||Fe)&&!y;if(!j&&!H)return()=>{};let A=()=>{var U;let O=n.contentDocument;if(O){let ge=O.documentElement.getBoundingClientRect(),cn=Math.ceil(ge.width),mn=Math.ceil(ge.height),ln=i(cn,p,d),fn=i(mn,c,g);j&&(n.style.width="".concat(ln,"px")),H&&(n.style.height="".concat(fn,"px"));let as=j&&d!==void 0&&cn>d,ps=H&&g!==void 0&&mn>g;O.documentElement.style.overflowX=as?"auto":"hidden",O.documentElement.style.overflowY=ps?"auto":"hidden",(U=e==null?void 0:e.onSizeChange)==null||U.call(e,{width:ln,height:fn,autoSizingWidth:j,autoSizingHeight:H})}};A();let fe=new ResizeObserver(A);return fe.observe(r.body),fe.observe(r.documentElement),()=>{fe.disconnect()}});s(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:n,width:r}=document.documentElement.getBoundingClientRect();return{height:n,width:r}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px"),e()}))});s(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let r=0;return r++,r--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+r+"px"},n=>{this.IframeElement.style.height=n.content,e()}))});s(this,"send",e=>{var i,a;let n=h({},e);if(n.messageType===l.ExecuteComponentMethod)return this[n.method](),()=>{};n.direction=R.down;let r=super.send(n);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(n,"*"),r});s(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});n.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Ge(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===l.In.MutationObserverMessage||e.messageType===l.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Y,Ye=m(()=>{"use strict";Y=class{constructor(){s(this,"appendChild",(t,e,n)=>{var r;if(n!=null&&n.relative){if(n.relative.direction==="before")return t.insertBefore(e,n.relative.child);if(n.relative.direction==="after"){let i=(r=n.relative.child)==null?void 0:r.nextSibling;return t.insertBefore(e,i||null)}}else return t.appendChild(e)})}}});var bs,Xe,Xn=m(()=>{"use strict";tn();Ye();ne();b();bs=(o,t,e)=>{let n=new URL(o);return n.searchParams.append(t,e),n.toString()},Xe=class extends Y{constructor(){super(...arguments);s(this,"type",q.IframeLoader);s(this,"load",async(e,n,r,i)=>{let a,p=n.loader;if((r==null?void 0:r.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,r),a=r,a.src=p.url;else{let d=T(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let g="\\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=g,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([u,y])=>{y===""||y===null||y===void 0?a.setAttribute(u,""):a.setAttribute(u,String(y))});let f=n.loader.url;i!=null&&i._hasParent&&(f=bs(f,"_myop-comp",d)),a.src=f,r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),a=this.appendChild(r,a,i)}return new be(e,n,r,a,i)})}}});var Qe,nn=m(()=>{"use strict";Qe={webcomponent_message_key:"myop_webcomponent_message"}});var Se,on=m(()=>{"use strict";nn();Ve();Je();Se=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.container=r;this.customElement=i;s(this,"cleanupInspect",()=>{});s(this,"send",e=>{let n=h({},e),r=super.send(n),i=new CustomEvent(Qe.webcomponent_message_key,{detail:n});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return r});s(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=Ge(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 sn,Ze,Qn=m(()=>{"use strict";on();Ye();ne();b();sn={},Ze=class extends Y{constructor(){super(...arguments);s(this,"type",q.WebComponentLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader;sn[a.url]?console.log("Module alreday loaded or in loading process"):sn[a.url]=new Promise((c,g)=>{let f=a.url,u=document.createElement("script");u.type="module",u.src=f,u.onload=()=>{c()},u.onerror=()=>{g()},document.head.appendChild(u)}),await sn[a.url],await hn(1);let p="myop-comp-".concat(T()),d=document.createElement(a.tag);return r.querySelector('[id^="myop-comp-"]')||(r.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(r,d,i),new Se(e,n,r,d,i)})}}});var E,$=m(()=>{"use strict";b();E=class extends qe{constructor(e,n){super(e);this.context=n;s(this,"executor",e=>{if(e.destination){let n=e.destination;if(this.context[n].context){let r=(i,a)=>{this.messageToHost(N(h({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[n].context,r)}else debugger}else debugger})}}});var B,X=m(()=>{"use strict";B={id:"myop-id"}});var S,Zn,L=m(()=>{"use strict";X();S=(o,t)=>t.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),Zn=(o,t)=>{let e=S(o,t);return e.length?e.item(0):null}});var et,eo=m(()=>{"use strict";I();w();$();L();et=class extends E{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{r(new oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var tt,to=m(()=>{"use strict";I();$();L();tt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var nt,no=m(()=>{"use strict";b();nt=class extends xe{constructor(e,n){super(e,n);this.container=e;this.shadowRoot=n}}});var ot,oo=m(()=>{"use strict";b();X();$();w();I();ot=class extends E{constructor(){super(...arguments);s(this,"innerExecutor",(e,n)=>{let r=n.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];r.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new Me(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,i))});s(this,"messageType",l.DetectMyopRefsMessage)}}});var st,so=m(()=>{"use strict";I();$();L();st=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var rt,ro=m(()=>{"use strict";I();w();$();L();me();rt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{r(new re(e.handlerUniqueId,P(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var it,io=m(()=>{"use strict";I();X();Pe();We();$();it=class extends E{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"innerExecutor",(e,n,r)=>{(async()=>{let a=n.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=F.Instance(),d=p.components.find(u=>u.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let g=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),f=[];Object.keys(g.refs).forEach(u=>{let y=g.refs[u];y=y.__nonProxied||y,y.componentDefinition&&f.push({refName:u,componentDefinitionId:y.componentDefinition.id})}),r(new V(e.handlerUniqueId,f))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var at,rn=m(()=>{"use strict";me();at=(o,t,e)=>{let n=o.scriptInputs?o.scriptInputs:{};n.makeSerializable=P,n.send=t,n.rootRef=e,n.__scriptInputs=n;let i=new Function("return (".concat(o.script,")(...arguments)"))(n);t(i)}});var pt,ao=m(()=>{"use strict";I();w();$();rn();pt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"innerExecutor",(e,n,r)=>{at(e,a=>{r(new se(e.handlerUniqueId,a))},n)})}}});var po,dt,co=m(()=>{"use strict";I();w();$();L();X();me();po=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:po(i),required:i.required,validity:P(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},dt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.GetElementValueMessage);s(this,"innerExecutor",(e,n,r)=>{S(e.ref,n.shadowRoot).forEach(a=>{r(new ie(po(a)),e)})})}}});var ct,mo=m(()=>{"use strict";I();$();L();ct=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var lo={};ee(lo,{WebComponentSDK:()=>Te});var Te,an=m(()=>{"use strict";b();I();nn();eo();to();no();oo();te();w();so();ro();io();ao();co();mo();Te=class extends Ie{constructor(){super(...arguments);s(this,"alwaysPassEnvelopesToHost",!0);s(this,"connectedCallback",(e,n)=>{e.addEventListener(Qe.webcomponent_message_key,r=>{let i=r.data?r.data:r.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(r),a.messageType===l.InitMessage){let p=a.content.id;this.components[p].context=new nt(e,n)}}}),setTimeout(()=>{this.messageToHost(new ae)},1)});s(this,"messageToHost",(e,n)=>{e.direction=R.up,!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId),window.myop.hostSDK.send(e)});s(this,"supportedHandlers",[new tt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new et(this.messageToHost,this.components),new ot(this.messageToHost,this.components),new st(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new pt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new it(this.messageToHost,this.components)]);s(this,"init",()=>{})}};z("WebComponentSDK",Te)});var fo=m(()=>{"use strict";an()});var go,uo=m(()=>{"use strict";go=""});function Ss(o,t){return class extends HTMLElement{connectedCallback(){let e=t===de.open?"open":"closed",n=this.attachShadow({mode:e});Mo().then(r=>{r.connectedCallback(this,n),n.innerHTML=o})}}}var ho,mt,Mo,Ts,Es,Rs,lt,Io=m(()=>{"use strict";on();Ye();ne();b();fo();tn();uo();ho=[],Mo=async()=>(mt||(mt=new Te,mt.init()),mt);Ts=(o,t,e)=>{customElements.define(o,Ss(t,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Es=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Rs=o=>(o=Es(o),o.replace(/_/g,"-")),lt=class extends Y{constructor(){super(...arguments);s(this,"type",q.HTMLLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader,p="myop-comp-".concat(T()),d;if(a.shadowRootMode===de.localFrame){let c=T(),g="myop-comp-".concat(c),f=document.createElement("iframe");f.id=g,f.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 "),r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),f=this.appendChild(r,f,i);let u=f.contentDocument||f.contentWindow.document;u.open();let y=a.HTML;if(i!=null&&i._inspection){let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A==null||A.removeAttribute("type");let fe=H.implementation.createHTMLDocument();fe.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let Ee=fe.body.firstChild;Ee&&H.head&&H.head.insertBefore(H.importNode(Ee,!0),H.head.firstChild),y=H.documentElement.outerHTML}else{let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A&&(A.remove(),y=H.documentElement.outerHTML)}u.writeln(y);let M='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),le="<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(u.writeln("".concat(M).concat(le)),(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>",H=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),A='<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>");u.writeln(j+A)}u.close();let Fe=new be(e,n,r,f,i);return a.autoHeight&&(f.onload=()=>{Fe.observeSizeBasedOnDocumentElement()}),Fe}if(a.shadowRootMode===de.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Mo().then(g=>{g.connectedCallback(d,d)})}else{let c=Rs(e.name+n.id);ho.includes(c)||(Ts(c,a.HTML,a.shadowRootMode),ho.push(c)),d=document.createElement(c)}return r.querySelector('[id^="myop-comp-"]')||(r.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(r,d,i),new Se(e,n,r,d,i)})}}});var Co,xo,wo=m(()=>{"use strict";ne();w();Co=(o,t,e)=>{let n="myop-css-".concat(T());return o.send(new D(({rootRef:r,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let g in i){c+="".concat(g," { ");let f=i[g];for(let u in f)c+="".concat(u,": ").concat(f[u],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(r.shadowRoot||r.container).appendChild(d)},()=>{},{_stylesheet:t,_css:e||"",_tagId:n})),()=>{o.send(new D(({rootRef:r,_tagId:i})=>{let a=(r.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:n}))}},xo=(o,t)=>{let e="myop-css-".concat(T());return o.send(new D(({rootRef:n,_tagId:r,_link:i})=>{let a=document.createElement("link");a.id=r,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(n.shadowRoot||n.container).appendChild(a)},()=>{},{_link:t,_tagId:e})),()=>{o.send(new D(({rootRef:n,_tagId:r})=>{let i=(n.shadowRoot||document).getElementById(r);i&&i.remove()},()=>{},{_tagId:e}))}}});var vs,pn,bo,So=m(()=>{"use strict";vs=(o,t)=>{let e=new RegExp(Object.keys(t).join("|"),"g");return o.replace(e,n=>(t[n]||n).toString())},pn=(o,t)=>{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=vs(o.loader.url,t),o},bo=o=>async t=>pn(t,o)});var To,Eo,Ro=m(()=>{"use strict";w();To=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.add(r)},{elementId:e,_className:t}))},Eo=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.remove(r)},{elementId:e,_className:t}))}});var ut,ft,yt,gt,vo=m(()=>{"use strict";ne();ut=class ut{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"id",this._runTimeId);s(this,"name",this._runTimeName);s(this,"description","");s(this,"loader",null);s(this,"withLoader",t=>(this.loader=t,this));s(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this));s(this,"build",()=>this)}};s(ut,"create",()=>new ut);ft=ut,yt=class yt{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});s(this,"name",this._runTimeName);s(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});s(this,"withInstance",t=>(this.instance=t,this));s(this,"withType",t=>(this.type=t,this));s(this,"withName",t=>(this.name=t,this));s(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this));s(this,"withRef",t=>(this.type.refs.push(t),this));s(this,"withBasicRef",t=>{let e={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(e),this});s(this,"build",()=>JSON.parse(JSON.stringify(this)))}};s(yt,"create",()=>new yt);gt=yt});var _s,ht,ks,Hs,Q,Z,_o,ko=m(()=>{"use strict";b();_s=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:we.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:we.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),ht="__MYOP_CLOUD_REPOSITORY_MAIN__",ks=()=>{if(typeof window<"u")return window[ht];if(typeof globalThis<"u")return globalThis[ht]},Hs=o=>{typeof window<"u"&&(window[ht]=o),typeof globalThis<"u"&&(globalThis[ht]=o)},Q=class Q{constructor(t="https://cloud.myop.dev"){this._baseUrl=t;s(this,"variants",{});s(this,"preloadedComponents",{});s(this,"userFlows",{});s(this,"_defaultEnv","production")}static get Main(){let t=ks();return t||(Q._main||(Q._main=new Q,Hs(Q._main)),Q._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,e,n){return e!==void 0||n!==void 0?"".concat(t,":").concat(e||this._defaultEnv,":").concat(n?"preview":"live")in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}async fetchComponentV2(t,e,n){let r=this.preloadedComponents[t],i=e!==void 0||n!==void 0,a,p;!i&&r?(a=r.env,p=r.preview):(a=e||this._defaultEnv,p=n===!0?!0:n===!1?!1:!e);let d="".concat(t,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:a,preview:p}),this.variants[d]=new Promise(async(c,g)=>{try{let f="".concat(this._baseUrl,"/consume?id=").concat(t,"&env=").concat(a);p&&(f+="&preview=true");let M=(await(await fetch(f)).json()).item;if(!M){g(new Error('Component "'.concat(t,'" not found')));return}if(!M.consume_variant||!M.consume_variant.length){g(new Error('Component "'.concat(t,'" has no implementation for environment "').concat(a,'"')));return}let le=_s(M);c(le)}catch(f){g(f)}})),await this.variants[d]}async fetchComponentV1(t,e){return e?(await this.fetchFlow(e)).components.find(r=>r.type.id===t):(await this.fetchAutoFlow(t)).components[0]}async fetchAutoFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&auto=true"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&resolve=components"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchComponent(t,e){return this.fetchComponentV1(t,e)}};s(Q,"_main",null);Z=Q,_o=Z});var Ho,Do=m(()=>{"use strict";Ho=async o=>await o()});var dn={};ee(dn,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var Mt=m(()=>{"use strict";wo();So();Ro();vo();ko();Do()});var Bo,Lo=m(()=>{"use strict";Ot();Mt();b();Bo=async o=>{try{let t=new URL(window.location.href),n=new URLSearchParams(t.search).get("myopOverride");if(n){let[r,...i]=Lt(n);switch(r){case"component":{let[a,p]=i,d=await Z.Main.fetchComponent(a);if(d&&d.type.skins.find(g=>g.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Lt(n),c=(await Z.Main.fetchFlow(a)).components.find(g=>g.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ce.Segmented&&c.instance.resolvedExperiences){let g=c.instance.resolvedExperiences.find(f=>f.id===p);if((g==null?void 0:g.type)===je.Segment){let f=g,y=c.instance.skinSelector.segments.find(M=>M.segmentId===f.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Ko={};ee(Ko,{HostSDK:()=>F,hostSDK:()=>Po});var Oo,F,Po,Pe=m(()=>{"use strict";te();I();w();Xn();Qn();Je();b();Ne();Io();Lo();Oo="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",F=class{constructor(){s(this,"components2init",[]);s(this,"components",[]);s(this,"componentsLoaders",[]);s(this,"initiated",!1);s(this,"version",ue);s(this,"type2InstanceCount",{});s(this,"assignId",t=>(this.type2InstanceCount[t.id]||(this.type2InstanceCount[t.id]=0),"".concat(t.id,"_").concat(++this.type2InstanceCount[t.id])));s(this,"inspected",!1);s(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(t=>{t.inspect&&t.inspect()}))});s(this,"incomingMessageHandler",t=>{if(t.origin,document.location.origin,t.data.myop){if(t.data.direction!==R.up&&t.data.messageType!==l.EnvelopedMessage)return;let e=t.data;if(e.messageType===l.InitRequest){this.components2init.forEach(r=>{r.send(new ye(r.id))});return}if(e.messageType===l.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let r=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});r==null||r.setInitiated();return}if(e.messageType===l.EnvelopedMessage){let r=e,i=this.components.find(a=>a.id===r.destination);if(i){if(r.direction===R.down){r.message.messageType===K.name?i.onMessageReceived(r.message):(r.message.route=r.route,i.send(r.message));return}}else{let a=this.components.find(p=>p.id===r.message.destination);a&&a.send(r.message)}return}let n=this.components.find(r=>r.id===e.destination);if(!n){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(n){if(n.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});s(this,"send",t=>{let e=new MessageEvent("",{data:t});this.incomingMessageHandler(e)});s(this,"init",t=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Xe,new Ze,new lt];if(this.componentsLoaders=[...e],t){let n={};t.forEach(r=>{let i=new r(this.componentsLoaders);n[i.type]=i}),this.componentsLoaders.forEach(r=>{n[r.type]||(n[r.type]=r)}),this.componentsLoaders=Object.values(n)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});s(this,"_getSkinIdBySkinSelector",async(t,e=[],n)=>{var i;async function r(a,p){for(let d of a)if(await p(d))return d}switch(t.type){case"DedicatedSkin":case ce.Dedicated:return((i=t.skin)==null?void 0:i.id)||t.skins[0].id;case ce.Segmented:{let p=await r(t.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===je.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let f=c.segment,u=(n||{})[f.function];return u?await u():(console.warn("segmentId:".concat(d.segmentId,", ").concat(f.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});s(this,"runSkinSelector",async(t,e)=>{let n=await this._getSkinIdBySkinSelector(t.instance.skinSelector,t.instance.resolvedExperiences,e);return t.type.skins.find(r=>r.id===n)});s(this,"loaderHooks");s(this,"loadComponent",async(t,e,n)=>{var g,f,u,y;if(!e){debugger;throw new Error("no container was found for this component")}let r=await Bo(t);r&&(t=r);let i=h(h({},(g=this.loaderHooks)!=null?g:{}),(f=n==null?void 0:n.hooks)!=null?f:{}),a=e;if(a.myop)if(a.component){t=h({},t),t.instance=h({},t.instance);let M=await this.runSkinSelector(t,i);if(!M)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(u=n==null?void 0:n.hooks)!=null&&u.afterSkinSelected&&(M=await n.hooks.afterSkinSelected(h({},M))),t.instance.skinSelector={type:ce.Dedicated,skin:M},n&&(n=h({},n),delete n.hooks),await Zt(a,t,this.components,n)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(t,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=n==null?void 0:n.hooks)!=null&&y.afterSkinSelected&&(p=await n.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(t.type,p,e,n);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),(!n||n.connectProps!==!1)&&(c=Yn(c,t.type.props,p));try{await en(c,t,this.components)}catch(M){throw M}return n!=null&&n.skipInit||await c.initiated(),c});s(this,"navigate",async(t,e,n)=>{if(t.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(n!=null&&n.staged){let r=await this.loadComponent(e,t.container,h({hidden:!0,relative:{direction:"after",child:t.element}},n));return n.init&&await n.init(r),r.show(),t.dispose(),r}else{let r=t.element.nextSibling;return t.dispose(),this.loadComponent(e,t.container,h({relative:{direction:"before",child:r}},n))}})}};s(F,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo});if(!window.myop.hostSDK){let o=new F;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo}),window.myop.hostSDK=o}Po=window.myop.hostSDK;z("hostSDK",Po)});var It,Ao=m(()=>{"use strict";I();X();b();w();It=class extends x{constructor(){super(...arguments);s(this,"messageType",l.DetectMyopRefsMessage);s(this,"executor",e=>{let n=document.querySelectorAll("[".concat(B.id,"]")),r=[];n.forEach(i=>{let a=i.getAttribute(B.id);a&&r.push(new Me(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,r))})}}});var Ct,Fo=m(()=>{"use strict";I();b();w();L();Ct=class extends x{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"executor",e=>{let n=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new oe,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};n.push(p)}),()=>{n.forEach(i=>i())}})}}});var xt,zo=m(()=>{"use strict";I();b();L();xt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.textContent=e.content})})}}});var wt,$o=m(()=>{"use strict";I();w();b();rn();wt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"executor",e=>{at(e,r=>{this.messageToHost(new se(e.handlerUniqueId,r))},new xe(document.documentElement))})}}});var bt,Uo=m(()=>{"use strict";I();b();w();me();L();bt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"executor",e=>{let n=S(e.ref,document),r=[];return n.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new re(e.handlerUniqueId,P(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),r.push(()=>{i.removeEventListener(e.type,a)})}),()=>{r.forEach(i=>{i()})}})}}});var St,No=m(()=>{"use strict";I();b();L();St=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var Tt,Wo=m(()=>{"use strict";I();X();b();Pe();We();Tt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"executor",e=>{(async()=>{let r=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(r.length===1){let a=await F.Instance().loadComponent(e.nestedComponentConfig,r.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 Vo,qo=m(()=>{"use strict";Vo=(o,t)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let n=new e(t),r={attributes:!0,childList:!0,subtree:!0};return n.observe(o,r),n}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",t,!1),o.addEventListener("DOMNodeRemoved",t,!1))}});var Et,jo=m(()=>{"use strict";I();w();b();qo();Et=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetMutationObserverMessage);s(this,"executor",e=>{e.source&&Vo(document.body,()=>{this.messageToHost(new He)})})}}});var Go,Rt,Jo=m(()=>{"use strict";I();X();b();w();me();L();Go=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:Go(i),required:i.required,validity:P(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);s(this,"messageType",l.GetElementValueMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{this.messageToHost(new ie(Go(r)),e)})})}}});var vt,Yo=m(()=>{"use strict";I();b();w();L();vt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.GetAttributeMessage);s(this,"executor",e=>{let n=Zn(e.ref,document);n&&this.messageToHost(new ke(n.getAttribute(e.name)),e)})}}});var _t,Xo=m(()=>{"use strict";w();I();b();_t=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetResizeObserverMessage);s(this,"executor",e=>{let n=new ResizeObserver(r=>{this.messageToHost(new Oe)});return n.observe(document.body),()=>{n.disconnect()}})}}});var kt,Qo=m(()=>{"use strict";I();b();L();kt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.innerHTML=e.content})})}}});var Zo={};ee(Zo,{IframeSDK:()=>Ht});var Ht,es=m(()=>{"use strict";b();Ao();Fo();zo();$o();te();Uo();No();w();Wo();jo();Jo();Ne();Yo();Xo();Qo();Ht=class extends Ie{constructor(){super();s(this,"version",ue);s(this,"messageToHost",(e,n)=>{var i;!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId);let r=Object.keys(this.components);e.destination||(n!=null&&n.route?e.destination=n.route[n.route.length-1]:e.destination=r[0]),e.source||(e.source=r[0]),e.direction=R.up,(i=window.parent)==null||i.postMessage(h({},e),"*")});s(this,"supportedHandlers",[new xt(this.messageToHost),new kt(this.messageToHost),new Ct(this.messageToHost),new It(this.messageToHost),new wt(this.messageToHost),new bt(this.messageToHost),new St(this.messageToHost),new Rt(this.messageToHost),new Et(this.messageToHost),new _t(this.messageToHost),new vt(this.messageToHost),new Tt(this.messageToHost)]);s(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};z("IframeSDK",Ht)});var Bs={};var Ds,ts=m(()=>{"use strict";w();te();Ds=h({},he);z("MyopMessages",Ds)});var ns={};ee(ns,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var os=m(()=>{"use strict";te();Mt();Mt();z("MyopHelpers",dn)});var As={};ee(As,{getHostModule:()=>ss,getIframeModule:()=>rs,getWebcomponentModule:()=>is});te();var yn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(yn=document.currentScript)==null?void 0:yn.src,t=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:t,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,t,e)=>{if(window.__federation__[t])console.log("__federation__ module ".concat(t," already loaded.")),e(window.__federation__[t][Bt]);else{let n;window.__federation__[t]={},window.__federation__[t][Ue]=r=>{n&&(document.head.removeChild(n),n=null),window.__federation__[t][Bt]=r,e(r)},n=document.createElement("script"),n.type="module",n.src=o,n.async=!0,document.head.appendChild(n)}};Ne();console.log("myop root sdk - loaded",document.location.origin);var Ls="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",ss=()=>Promise.resolve().then(()=>(Pe(),Ko)),rs=()=>Promise.resolve().then(()=>(es(),Zo)),is=()=>Promise.resolve().then(()=>(an(),lo)),Os=()=>Promise.resolve().then(()=>(ts(),Bs)),Ps=()=>Promise.resolve().then(()=>(os(),ns)),Ae=o=>async()=>(await o()).get(),Ks={version:ue,getHostModule:Ae(ss),getIframeModule:Ae(rs),getWebcomponentModule:Ae(is),getMyopMessages:Ae(Os),getMyopHelpers:Ae(Ps)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ls});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=h({rootSDK:Ks},window.myop);return us(As);})();
|
|
2
|
+
`;var Oe=Object.defineProperty,Bt=Object.defineProperties,Ft=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,$t=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable,be=(e,t,n)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))$t.call(t,n)&&be(e,n,t[n]);if(Pe)for(var n of Pe(t))Kt.call(t,n)&&be(e,n,t[n]);return e},Z=(e,t)=>Bt(e,Ft(t)),Nt=(e,t)=>{for(var n in t)Oe(e,n,{get:t[n],enumerable:!0})},a=(e,t,n)=>be(e,typeof t!="symbol"?t+"":t,n),y=(e,t,n)=>new Promise((s,i)=>{var o=l=>{try{c(n.next(l))}catch(d){i(d)}},r=l=>{try{c(n.throw(l))}catch(d){i(d)}},c=l=>l.done?s(l.value):Promise.resolve(l.value).then(o,r);c((n=n.apply(e,t)).next())}),he="__federation__",Ae="onLoad",Be=(e,t)=>{window[he]&&window[he][e]&&window[he][e][Ae]&&window[he][e][Ae]({[e]:t})},v={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",CleanupMessage:"CleanupMessage",In:{MutationObserverMessage:"MutationObserverMessage",ResizeObserverMessage:"ResizeObserverMessage"}},Ee={};Nt(Ee,{AddEventListenerMessage:()=>Jt,BaseMyopMessage:()=>T,BindClickMessage:()=>Wt,ChangeTextMessage:()=>Vt,CleanupMessage:()=>st,CleanupReplayMessage:()=>it,ClickReplayMessage:()=>Ke,CreateRefComponentMessage:()=>Xe,CustomRefMessage:()=>Ce,DetectMyopRefsMessage:()=>en,DetectedMyopRefsMessage:()=>et,DisposeMessage:()=>ot,ElementValueReplayMessage:()=>Ve,EnvelopedMessage:()=>Qe,EventListenerCallbackMessage:()=>je,ExecuteComponentMethod:()=>K,ExecuteScriptMessage:()=>$,ExecuteScriptReplyMessage:()=>Ue,GetAttributeMessage:()=>tn,GetAttributeReplayMessage:()=>nn,GetElementValueMessage:()=>Qt,InitMessage:()=>Te,InitRequest:()=>Ye,InitResponse:()=>Ge,MessageDirection:()=>k,MutationObserverMessage:()=>on,MyopBindMessage:()=>P,MyopBindReplayMessage:()=>O,MyopElementMessage:()=>jt,Ref:()=>ee,RefComponentCreatedMessage:()=>Ie,ResizeObserverMessage:()=>an,SetAttributeMessage:()=>Xt,SetInnerHtml:()=>Zt,SetMutationObserverMessage:()=>sn,SetResizeObserverMessage:()=>rn,stripFunction:()=>ze});var V=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),zt=e=>{const t=[...e].map(n=>n.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},Ut=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";const n=atob(t);return Uint8Array.from(n,s=>s.charCodeAt(0))},Fe=e=>{const t=Ut(e);if(t.length%16!==0)throw new Error("Invalid input length");const n=[];for(let s=0;s<t.length;s+=16)n.push(zt(t.slice(s,s+16)));return n},qt=e=>new Promise(t=>setTimeout(t,e)),k=class{};a(k,"down","down"),a(k,"up","up");var T=class{constructor(){a(this,"id",V()),a(this,"myop",!0),a(this,"content"),a(this,"source"),a(this,"destination"),a(this,"route"),a(this,"ref"),a(this,"direction"),a(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},jt=class extends T{constructor(e){super(),this.ref=e}},O=class extends T{constructor(e){super(),this.replayToHandler=e}},P=class extends T{constructor(t){super(),this.handler=t,a(this,"handlerUniqueId",V())}},ee=class Pt{constructor(t,n){this.refConfig=t,this.component=n,a(this,"myop",!0),a(this,"__nonProxied"),this.__nonProxied=Z(C({},this),{component:null})}static create(t,n,s){let i=n;return i||(i={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new Pt(i,s)}},$e="ClickReplayMessage",Wt=class extends P{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",$e),a(this,"messageType","BindClickMessage"),a(this,"cleanable",!0)}},Ke=class extends O{constructor(){super(...arguments),a(this,"messageType",$e)}},Vt=class extends T{constructor(e,t){super(),this.ref=e,a(this,"messageType","ChangeTextMessage"),this.content=t}},Ne="ExecuteScriptReplyMessage",Gt=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,Yt=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,ze=e=>{let t=e.match(Gt);if(t)return t[1]||t[3];{let n=e.match(Yt);if(n)return n[1].trim()}},$=class extends P{constructor(t,n=()=>{},s){super(n),this.scriptInputs=s,a(this,"replyMessageKey",Ne),a(this,"messageType","ExecuteScriptMessage"),a(this,"script",""),this.script=t.toString(),this.content=t.toString(),this.content=ze(this.content)}};a($,"replierKey","send"),a($,"completeStreamKey","completeStream");var Ue=class extends O{constructor(e,t){super(e),this.replayToHandler=e,this.content=t,a(this,"messageType",Ne)}},Ce=class extends ${constructor(e,t,n=()=>{}){super(({rootRef:s,elementId:i,_script:o,__scriptInputs:r})=>{const c=(s.shadowRoot||s.container).querySelectorAll(`[myop-id='${i}']`);return c.length?(r.ref=c[0],new Function(`return (${o})(...arguments)`)(r)):null},n),this.scriptInputs=t,this.scriptInputs=Z(C({},t),{_script:e.toString()})}},qe="EventListenerCallbackMessage",Jt=class extends P{constructor(e,t,n){super(n),this.ref=e,this.type=t,this.handler=n,a(this,"replyMessageKey",qe),a(this,"messageType","AddEventListenerMessage"),a(this,"cleanable",!0),a(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},je=class extends O{constructor(e,t){super(e),this.replayToHandler=e,this.e=t,a(this,"messageType",qe),this.content={e:t}}},Xt=class extends T{constructor(e,t,n){super(),this.ref=e,this.name=t,this.value=n,a(this,"messageType","SetAttributeMessage")}},We="ElementValueReplayMessage",Qt=class extends P{constructor(e,t){super(t),this.ref=e,a(this,"replyMessageKey",We),a(this,"messageType","GetElementValueMessage")}},Ve=class extends O{constructor(e){super(),this.content=e,a(this,"messageType",We)}},Zt=class extends T{constructor(e,t){super(),this.ref=e,a(this,"messageType","SetInnerHtml"),this.content=t}},Te=class extends T{constructor(e){super(),a(this,"messageType","InitMessage"),this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Ge=class extends Te{constructor(){super(...arguments),a(this,"messageType","InitResponse")}},Ye=class extends T{constructor(){super(...arguments),a(this,"messageType","InitRequest")}},Je="RefComponentCreatedMessage",Xe=class extends P{constructor(e,t,n,s){super(s),this.refConfig=e,this.nestedComponentConfig=t,this.options=n,a(this,"replyMessageKey",Je),a(this,"messageType","CreateRefComponentMessage")}},Ie=class extends O{constructor(e,t,n){super(e),this.replayToHandler=e,this.nestedRefs=t,this.failed=n,a(this,"messageType",Je)}},Qe=class extends T{constructor(e,t){super(),this.destination=e,this.message=t,a(this,"messageType","EnvelopedMessage");const n=t;this.route=[e,...n.route?n.route:[]]}},Ze="DetectedMyopRefsMessage",en=class extends P{constructor(){super(...arguments),a(this,"messageType","DetectMyopRefsMessage"),a(this,"replyMessageKey",Ze)}},et=class extends O{constructor(e,t){super(e),this.replayToHandler=e,a(this,"messageType",Ze),this.content=t}isTypeof(e){return e.messageType===this.messageType}},tt="GetAttributeReplayMessage",tn=class extends P{constructor(e,t,n){super(n),this.ref=e,this.name=t,a(this,"replyMessageKey",tt),a(this,"messageType","GetAttributeMessage")}},nn=class extends O{constructor(e){super(),this.content=e,a(this,"messageType",tt)}},K=class extends T{constructor(e){super(),this.method=e,a(this,"messageType","ExecuteComponentMethod")}},sn=class extends T{constructor(){super(...arguments),a(this,"messageType","SetMutationObserverMessage")}},on=class extends T{constructor(){super(...arguments),a(this,"messageType","MutationObserverMessage")}},nt="CleanupReplayMessage",st=class extends P{constructor(e,t){super(t),this.cleanupForMessageId=e,a(this,"replyMessageKey",nt),a(this,"messageType","CleanupMessage")}},it=class extends O{constructor(e){super(),this.customCleanup=e,a(this,"messageType",nt)}},ot=class extends T{constructor(){super(...arguments),a(this,"messageType","DisposeMessage")}},rn=class extends T{constructor(){super(...arguments),a(this,"cleanable",!0),a(this,"messageType","SetResizeObserverMessage")}},an=class extends T{constructor(){super(...arguments),a(this,"messageType","ResizeObserverMessage")}},Se=class{constructor(e,t,n){this.componentDefinition=e,this.container=t,a(this,"id",""),a(this,"messageHandlers",{}),a(this,"element"),a(this,"_markedForDisposed",!1),a(this,"bind",(i,o)=>{this.messageHandlers[i]||(this.messageHandlers[i]=[]),this.messageHandlers[i].includes(o)||this.messageHandlers[i].push(o)}),a(this,"bindWhen",(i,o,r)=>{if(!r)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[i]||(this.messageHandlers[i]=[]);const c=this.messageHandlers[i],l=d=>o(d)?(r(d),!0):!1;return c.push(l),()=>{const d=c.indexOf(l);d>-1&&c.splice(d,1)}}),a(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()}),a(this,"isInitiated",!1),a(this,"_whenInitiatedResolve"),a(this,"_whenInitiatedReject"),a(this,"_whenInitiated",new Promise((i,o)=>{this._whenInitiatedResolve=i,this._whenInitiatedReject=o})),a(this,"initiated",()=>this._whenInitiated),a(this,"props",{}),a(this,"refs",{}),this.id=(n==null?void 0:n.id)||ge.Instance().assignId(e);const s=n!=null&&n.timeout?n==null?void 0:n.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject(`timeout_${s} ${this.id}`)},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(e){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=e}onMessageReceived(e){if(e.messageType===v.ExecuteComponentMethod){const n=e;return this[n.method]?this[n.method](n.content):console.log(`method not found ${n.method} on component`,this),!0}const t=this.messageHandlers[e.messageType];if(t&&t.length){let n=!1;return t.forEach(s=>{n=n||s(e)}),n}return!1}sendCleanupMessage(e){e.source=this.id,e.destination=this.id,e.direction=k.down;const t=this.bindWhen(e.replyMessageKey,s=>s.replayToHandler===e.handlerUniqueId,s=>{e.handler(s),t()}),n=e.handler;delete e.handler,this.send(e),e.handler=n}send(e){e.source||(e.source=this.id),e.destination||(e.destination=this.id),e.direction=k.down;let t;if(e.handler){const n=e;t=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,n.handler),delete e.handler}return e.ref&&(e.ref=e.ref.__nonProxied||e.ref),e.cleanable?()=>{this.sendCleanupMessage(new st(e.id,n=>{})),t&&t()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new ot);const e=this.messageHandlers.onDispose;e&&e.forEach(t=>{t(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}},cn=class{constructor(e,t,n,s,i){this.myopId=e,this.htmlTagName=t,this.BoundingRect=n,this.offsetTop=s,this.offsetLeft=i,a(this,"type","MyopElementRef")}},ln=e=>y(void 0,null,function*(){if(typeof e=="function")e();else if(e instanceof Promise){const t=yield e;typeof t=="function"&&t()}}),dn=class{constructor(e){this.messageToHost=e}},un=class extends dn{constructor(e,t){super(e),this.messageToHost=e,this.context=t}},hn=class{constructor(e,t){this.id=e,this.context=t,a(this,"send",n=>{})}},pn=class{constructor(){a(this,"messageToHandleAfterInit",[]),a(this,"components",{}),a(this,"alwaysPassEnvelopesToHost",!1),a(this,"messageCleanupCache",{})}handleIncomeMessages(e){const t=e.data?e.data:e.detail;if(!(!t||!t.myop)){let n=t;if(n.direction!==k.down)return;if(n.messageType===v.DisposeMessage){n.destination&&delete this.components[n.destination];return}if(n.messageType===v.InitMessage){const s=n.content.id;if(this.components[s])return;this.components[s]=new hn(s),this.messageToHost(new Ge(s));return}if(n.messageType===v.EnvelopedMessage){const s=n,i=s.message;if(n=i,this.alwaysPassEnvelopesToHost||this.components[n.destination]){const o=myop.hostSDK.components.find(c=>c.id===i.destination);if(o){o.send(i);return}const r=myop.hostSDK.components.find(c=>c.id===s.destination);if(r){r.send(i);return}}else return}if(n.messageType){if(n.messageType===v.CleanupMessage){const s=n,i=this.messageCleanupCache[s.cleanupForMessageId],o=new it(!!i);o.destination=n.destination,i?(delete this.messageCleanupCache[s.cleanupForMessageId],ln(i).then(()=>{this.messageToHost(o,s)}).catch(()=>{})):this.messageToHost(o,s);return}this.supportedHandlers.forEach(s=>{if(s.messageType===n.messageType){const i=s.executor(n);if(n.cleanable&&i&&(this.messageCleanupCache[n.id]=i),i&&!n.cleanable)throw new Error(`Cleanup handler generated for non-cleanable message.
|
|
3
3
|
messageType - ${n.messageType}, handler executor was - ${s.executor}
|
|
4
4
|
|
|
5
5
|
Please review the message definition object & message handler.
|
|
@@ -7,7 +7,7 @@ To ensure cleanup properly set 'cleanable' true at message definition and return
|
|
|
7
7
|
messageType - ${n.messageType}, handler executor was - ${s.executor}
|
|
8
8
|
|
|
9
9
|
Please review the message definition object & message handler.
|
|
10
|
-
To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`)}})}else console.log("unsupported message type")}}},te={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader"},ne={open:"open",none:"none",localFrame:"localFrame"},pe={code:"code"},xe=class{};a(xe,"code","code"),a(xe,"component","component");var se={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},rt={Segment:"Segment",Promo:"Promo",AB:"AB"},
|
|
10
|
+
To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`)}})}else console.log("unsupported message type")}}},te={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader"},ne={open:"open",none:"none",localFrame:"localFrame"},pe={code:"code"},xe=class{};a(xe,"code","code"),a(xe,"component","component");var se={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},rt={Segment:"Segment",Promo:"Promo",AB:"AB"},mn=class{constructor(e,t){this.container=e,this.shadowRoot=t,a(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div")),a(this,"getRoot",()=>this.shadowRoot||this.container)}},Re=e=>e!==Object(e),fn=e=>typeof e=="function",at=e=>{if(Re(e))return!0;if(fn(e)||Object.getPrototypeOf(e))return!1;for(const t in e){const n=e[t];if(typeof n=="object"){if(!at(n))return!1}else{if(Re(n))continue;return!1}}return!0},G=(e,t={},n=!0,s=new WeakMap)=>{if(Re(e))return e;if(Array.isArray(e)){if(s.has(e))return s.get(e);const i=[];s.set(e,i);for(let o=0;o<e.length;o++){const r=e[o];i[o]=G(r,t,n,s)}return i}if(e!==null&&typeof e=="object"){if(s.has(e))return s.get(e);const i={};s.set(e,i);for(const o in e){const r=typeof t=="boolean"?t:t[o];r&&(r===!0?(n?e[o]!==void 0:e[o])&&(i[o]=G(e[o],!0,n,s)):typeof r=="object"&&(i[o]=G(e[o],r,n,s)))}return i}return{}},gn={notSerializableRefCall:(e,t)=>{throw new Error(`
|
|
11
11
|
The input provided to '${e.toString()}' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation.
|
|
12
12
|
The following types of data are considered non-serializable and cannot be processed:
|
|
13
13
|
|
|
@@ -37,7 +37,7 @@ Suggested Fix:
|
|
|
37
37
|
|
|
38
38
|
For more details on serialization and Myop message examples, refer to https://docs.myop.dev.
|
|
39
39
|
|
|
40
|
-
`)}},ct=class extends Se{constructor(e,t,n){super(e,t.container,n),this.componentDefinition=e,this.parent=t,a(this,"send",s=>{const i=s.handler,o=super.send(s);return this.parent.send(new Qe(this.id,s)),s.handler=i,o}),a(this,"dispose",()=>{this.isInitiated&&this.send(new K("dispose")),super.dispose()})}hide(){this.send(new K("hide"))}show(){this.send(new K("show"))}inspect(){return this.send(new K("inspect"))}setHeightBasedOnDocumentElement(){this.send(new K("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new K("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}},
|
|
40
|
+
`)}},ct=class extends Se{constructor(e,t,n){super(e,t.container,n),this.componentDefinition=e,this.parent=t,a(this,"send",s=>{const i=s.handler,o=super.send(s);return this.parent.send(new Qe(this.id,s)),s.handler=i,o}),a(this,"dispose",()=>{this.isInitiated&&this.send(new K("dispose")),super.dispose()})}hide(){this.send(new K("hide"))}show(){this.send(new K("show"))}inspect(){return this.send(new K("inspect"))}setHeightBasedOnDocumentElement(){this.send(new K("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new K("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}},yn=(e,t,n)=>{const s=document.createElement("a");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},lt=(e,t,n,s,i,o)=>{const r=yn(`${o.name} : ${t}`,n,o);return s.insertBefore(r,i),i.style.border="1px solid #007BFF",i.style.display="block",()=>{i.style.border="unset",s.removeChild(r)}},dt=(e,t,n)=>e?!1:(console.error(`Error: Undefined Prop
|
|
41
41
|
|
|
42
42
|
It looks like you've tried to use a prop that hasn't been defined.
|
|
43
43
|
Please check the prop name for any typos or ensure that it is properly defined in the component's prop list.
|
|
@@ -55,7 +55,7 @@ In the meantime, you can use message props.
|
|
|
55
55
|
Prop Name: ${t}
|
|
56
56
|
Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
|
|
57
57
|
|
|
58
|
-
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`)},
|
|
58
|
+
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`)},vn=(e,t,n)=>{const s=t.reduce((o,r)=>Z(C({},o),{[r.name]:C({},r)}),{}),i={get:(o,r)=>{const c=s[r];if(dt(c,r,e))return!1;if(c.behavior.type===pe.code){if(n.loader.type===te.HTMLLoader&&n.loader.shadowRootMode===ne.localFrame){const d=c.behavior;return e.element.contentWindow[d.remap||r]}return ut(c,r,e),!1}return c.mode==="output"?new Promise(l=>{const d=[];c.behavior.ref&&d.push(ee.create(c.behavior.ref)),d.push(h=>{l(h)}),c.behavior.params&&d.push(...c.behavior.params);const u=Ee[c.behavior.message];e.send(new u(...d))}):null},set:(o,r,c)=>{const l=s[r];if(dt(l,r,e))return!1;if(l.behavior.type===pe.code){if(n.loader.type===te.HTMLLoader&&n.loader.shadowRootMode===ne.localFrame){const u=l.behavior,h=e.element.contentWindow,f=u.remap||r;if(h[f]=c,f==="myop_cta_handler"&&h.__myop_cta_queue){const g=h.__myop_cta_queue;h.__myop_cta_queue=null,g.forEach(m=>{e.markedForDisposed||c(m.action,m.payload)})}return!0}return ut(l,r,e),!1}else if(l.mode==="input")if(l.behavior.type==="message"){const d=[];l.behavior.ref&&d.push(ee.create(l.behavior.ref)),d.push(c),l.behavior.params&&d.push(...l.behavior.params);const u=Ee[l.behavior.message];return e.send(new u(...d)),!0}else throw new Error(`Error: Unsupported Behavior
|
|
59
59
|
|
|
60
60
|
The 'behavior' field provided is not supported.
|
|
61
61
|
Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
|
|
@@ -63,7 +63,7 @@ Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
|
|
|
63
63
|
Prop Name: ${r}
|
|
64
64
|
Behavior Field: ${l.behavior.type}
|
|
65
65
|
|
|
66
|
-
Check the documentation for valid behavior options.`);return!1}};return e.props={},e.props=new Proxy(e.props,i),e},
|
|
66
|
+
Check the documentation for valid behavior options.`);return!1}};return e.props={},e.props=new Proxy(e.props,i),e},wn=(e,t)=>new Proxy(e,{get(n,s){return n[s]?n[s]:(...o)=>new Promise(r=>{o.forEach(c=>{at(c)||gn.notSerializableRefCall(s,c)}),t.send(new Ce(({ref:c,propName:l,functionArgs:d,makeSerializable:u})=>{if(c){const h=c[l];return u(typeof h=="function"?c[l](...d):h,!0)}return null},{elementId:n.refConfig.selector,propName:s,functionArgs:o},c=>{r(c.content)}))})},set(n,s,i){return t.send(new Ce(({ref:o,propName:r,propValue:c})=>{o&&(o[r]=c)},{elementId:n.refConfig.selector,propValue:i,propName:s},o=>{})),!0}}),ht=(e,t,n,s)=>y(void 0,null,function*(){const i=e.component;if(!i)throw new Error("cant createRefComponent with detached ref");return new Promise((o,r)=>y(void 0,null,function*(){const c=new ct(t.type,i,s);n.push(c),yield i.initiated();const l=setTimeout(()=>{r("timeout")},5e3);i.send(new Xe(e.refConfig,t,Z(C({},s||{}),{id:c.id,_hasParent:!0}),d=>y(void 0,null,function*(){if(clearTimeout(l),d.failed){r("CreateRefComponentMessage failed");return}const u=n.find(h=>h.id==c.id);if(u!==c){i.refs[e.refConfig.name]=u,o(u);return}else c.setInitiated(),i.refs[e.refConfig.name]=c;d.nestedRefs.forEach(h=>{const f=t.instance.resolvedNestedComponents.find(m=>m.type.id===h.componentDefinitionId).type,g=new ct(f,c);g.setInitiated(),c.refs[h.refName]=g,n.push(g)});try{yield pt(c,t,n,!0),i.setHeightBasedOnScrollHeight&&i.setHeightBasedOnScrollHeight(),o(c)}catch(h){r(h)}})))}))}),pt=(e,t,n,s=!1)=>y(void 0,null,function*(){e.refs||(e.refs={});const i=Object.values(e.componentDefinition.refs).map(o=>new Promise((r,c)=>y(void 0,null,function*(){var l;if(o.behavior.type==xe.component){if(s){r();return}let d=o.behavior.componentId;d||(d=o.behavior.instance.componentId);const u=(l=t.instance.resolvedNestedComponents)==null?void 0:l.find(f=>f.type.id===d);if(!u)throw new Error("componentConfig provided without nestedComponentConfig check the config object");const h=ee.create("",o,e);try{const f=yield ht(h,u,n);e.refs[o.name]=f,r()}catch(f){c(f)}}else try{const d=ee.create("",o,e);e.refs[o.name]=wn(d,e),r()}catch{}})));try{yield Promise.all(i)}catch(o){throw o}}),mt=class extends Se{constructor(e,t,n,s,i){super(e,n,i),this.componentConfig=e,this.container=n,this.IframeElement=s,a(this,"cleanupInspect"),a(this,"setHeightBasedOnDocumentElement",()=>{const o=this.send(new $(()=>window.document.documentElement.scrollHeight,r=>{this.IframeElement.style.height=`${r.content}px`,o()}))}),a(this,"observeSizeBasedOnDocumentElement",()=>this.send(new $(({send:r})=>{const{height:c,width:l}=document.documentElement.getBoundingClientRect(),d=new ResizeObserver(()=>{const{height:u,width:h}=document.documentElement.getBoundingClientRect();r({height:u,width:h})});return d.observe(document.documentElement),d.observe(document.body),{height:c,width:l}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`}))),a(this,"observeAutoSize",o=>{var r;const c=this.IframeElement,l=c.contentDocument;if(!l)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};const d=(S,x,F)=>x!==void 0&&S<x?x:F!==void 0&&S>F?F:S,u=S=>{if(S===void 0)return;if(typeof S=="number")return S;const x=parseFloat(S);return isNaN(x)?void 0:x},h=u(o==null?void 0:o.minWidth),f=u(o==null?void 0:o.maxWidth),g=u(o==null?void 0:o.minHeight),m=u(o==null?void 0:o.maxHeight),H=(r=o==null?void 0:o.loaderMinHeight)!=null?r:50,M=(o==null?void 0:o.explicitWidth)!==void 0,I=(o==null?void 0:o.explicitHeight)!==void 0,D=this.container.getBoundingClientRect(),B=D.width===0,we=D.height===0||D.height===H,J=(o!=null&&o.forceAutoSize||B)&&!M,q=(o!=null&&o.forceAutoSize||we)&&!I;if(!J&&!q)return()=>{};const _e=()=>{var S;const x=c.contentDocument;if(x){const F=x.documentElement.getBoundingClientRect(),re=Math.ceil(F.width),ae=Math.ceil(F.height),ce=d(re,h,f),b=d(ae,g,m);J&&(c.style.width=`${ce}px`),q&&(c.style.height=`${b}px`);const j=J&&f!==void 0&&re>f,R=q&&m!==void 0&&ae>m;x.documentElement.style.overflowX=j?"auto":"hidden",x.documentElement.style.overflowY=R?"auto":"hidden",(S=o==null?void 0:o.onSizeChange)==null||S.call(o,{width:ce,height:b,autoSizingWidth:J,autoSizingHeight:q})}};_e();const oe=new ResizeObserver(_e);return oe.observe(l.body),oe.observe(l.documentElement),()=>{oe.disconnect()}}),a(this,"setSizeBasedOnDocumentElement",()=>{const o=this.send(new $(()=>{const{height:r,width:c}=document.documentElement.getBoundingClientRect();return{height:r,width:c}},r=>{this.IframeElement.style.width=`${r.content.width}px`,this.IframeElement.style.height=`${r.content.height}px`,o()}))}),a(this,"setHeightBasedOnScrollHeight",()=>{const o=this.send(new $(()=>{let c=0;return c++,c--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+c+"px"},r=>{this.IframeElement.style.height=r.content,o()}))}),a(this,"send",o=>{var r,c;let l=C({},o);if(l.messageType===v.ExecuteComponentMethod)return this[l.method](),()=>{};l.direction=k.down;const d=super.send(l);return(c=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||c.postMessage(l,"*"),d}),a(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)}),t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=lt(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===v.In.MutationObserverMessage||e.messageType===v.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}},He=class{constructor(){a(this,"appendChild",(e,t,n)=>{var s;if(n!=null&&n.relative){if(n.relative.direction==="before")return e.insertBefore(t,n.relative.child);if(n.relative.direction==="after"){const i=(s=n.relative.child)==null?void 0:s.nextSibling;return e.insertBefore(t,i||null)}}else return e.appendChild(t)})}},_n=(e,t,n)=>{const s=new URL(e);return s.searchParams.append(t,n),s.toString()},Mn=class extends He{constructor(){super(...arguments),a(this,"type",te.IframeLoader),a(this,"load",(e,t,n,s)=>y(this,null,function*(){let i;const o=t.loader;if((n==null?void 0:n.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",o.url,n),i=n,i.src=o.url;else{const r=V(),c=`myop-comp-${r}`;i=document.createElement("iframe"),i.id=c;const l=`
|
|
67
67
|
padding: 0;
|
|
68
68
|
margin: 0;
|
|
69
69
|
position: absolute;
|
|
@@ -74,7 +74,7 @@ Check the documentation for valid behavior options.`);return!1}};return e.props=
|
|
|
74
74
|
border: none;
|
|
75
75
|
opacity: ${s!=null&&s.hidden?"0":"1"};
|
|
76
76
|
pointer-events: ${s!=null&&s.hidden?"none":"all"};
|
|
77
|
-
`;i.style.cssText=l,s!=null&&s.elementAttributes&&Object.entries(s.elementAttributes).forEach(([u,h])=>{h===""||h===null||h===void 0?i.setAttribute(u,""):i.setAttribute(u,String(h))});let d=t.loader.url;s!=null&&s._hasParent&&(d=
|
|
77
|
+
`;i.style.cssText=l,s!=null&&s.elementAttributes&&Object.entries(s.elementAttributes).forEach(([u,h])=>{h===""||h===null||h===void 0?i.setAttribute(u,""):i.setAttribute(u,String(h))});let d=t.loader.url;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)}return new mt(e,t,n,i,s)}))}},ft={webcomponent_message_key:"myop_webcomponent_message"},gt=class extends Se{constructor(e,t,n,s,i){super(e,n,i),this.container=n,this.customElement=s,a(this,"cleanupInspect",()=>{}),a(this,"send",o=>{let r=C({},o);const c=super.send(r),l=new CustomEvent(ft.webcomponent_message_key,{detail:r});try{this.customElement.dispatchEvent(l)}catch(d){console.log("error while trying to dispatchEvent",d)}return c}),a(this,"dispose",()=>{var o;super.dispose(),(o=this.customElement.parentNode)==null||o.removeChild(this.customElement)}),this.element=s}inspect(){return this.cleanupInspect=lt(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=""}},ke={},bn=class extends He{constructor(){super(...arguments),a(this,"type",te.WebComponentLoader),a(this,"load",(e,t,n,s)=>y(this,null,function*(){const i=t.loader;ke[i.url]?console.log("Module alreday loaded or in loading process"):ke[i.url]=new Promise((c,l)=>{const d=i.url,u=document.createElement("script");u.type="module",u.src=d,u.onload=()=>{c()},u.onerror=()=>{l()},document.head.appendChild(u)}),yield ke[i.url],yield qt(1);let o=`myop-comp-${V()}`;const r=document.createElement(i.tag);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 gt(e,t,n,r,s)}))}},En="0.3.13",A=class extends un{constructor(e,t){super(e),this.context=t,a(this,"executor",n=>{if(n.destination){const s=n.destination;if(this.context[s].context){const i=(o,r)=>{this.messageToHost(Z(C({},o),{source:n.destination?n.destination:n.source,destination:n.source?n.source:n.destination}),r)};return this.innerExecutor(n,this.context[s].context,i)}else debugger}else debugger})}},ie={id:"myop-id"},Y=(e,t)=>t.querySelectorAll(`[${ie.id}='${e.refConfig.selector}']`),Cn=class extends A{constructor(){super(...arguments),a(this,"messageType",v.BindClickMessage),a(this,"innerExecutor",(e,t,n)=>{const s=Y(e.ref,t.shadowRoot),i=[];return s.forEach(o=>{const r=()=>{n(new Ke(e.handlerUniqueId))};o.addEventListener("click",r),i.push(()=>{o.removeEventListener("click",r)})}),()=>{i.forEach(o=>o())}})}},Tn=class extends A{constructor(){super(...arguments),a(this,"messageType",v.ChangeTextMessage),a(this,"innerExecutor",(e,t)=>{Y(e.ref,t.shadowRoot).forEach(s=>{s.textContent=e.content})})}},In=class extends mn{constructor(e,t){super(e,t),this.container=e,this.shadowRoot=t}},Sn=class extends A{constructor(){super(...arguments),a(this,"innerExecutor",(e,t)=>{const n=t.shadowRoot.querySelectorAll(`[${ie.id}]`);let s=[];n.forEach(i=>{const o=i.getAttribute(ie.id);o&&s.push(new cn(o,i.tagName,i.getBoundingClientRect(),i.offsetTop,i.offsetLeft))}),this.messageToHost(new et(e.handlerUniqueId,s))}),a(this,"messageType",v.DetectMyopRefsMessage)}},xn=class extends A{constructor(){super(...arguments),a(this,"messageType",v.SetAttributeMessage),a(this,"innerExecutor",(e,t)=>{Y(e.ref,t.shadowRoot).forEach(s=>{s.setAttribute(e.name,e.value)})})}},Rn=class extends A{constructor(){super(...arguments),a(this,"messageType",v.AddEventListenerMessage),a(this,"innerExecutor",(e,t,n)=>{const s=Y(e.ref,t.shadowRoot),i=[];return s.forEach(o=>{const r=c=>{n(new je(e.handlerUniqueId,G(c,e.serializableSkeleton)))};o.addEventListener(e.type,r),i.push(()=>{o.removeEventListener(e.type,r)})}),()=>{i.forEach(o=>o())}})}},Hn=class extends A{constructor(){super(...arguments),a(this,"messageType",v.CreateRefComponentMessage),a(this,"innerExecutor",(e,t,n)=>{y(this,null,function*(){const i=t.shadowRoot.querySelectorAll(`[${ie.id}='${e.refConfig.selector}']`);if(i.length===1){const o=ge.Instance(),r=o.components.find(u=>u.id===e.options.id);r&&r.dispose();const c=o.components.indexOf(r);c!==-1&&o.components.splice(c,1);const l=yield o.loadComponent(e.nestedComponentConfig,i.item(0),e.options),d=[];Object.keys(l.refs).forEach(u=>{let h=l.refs[u];h=h.__nonProxied||h,h.componentDefinition&&d.push({refName:u,componentDefinitionId:h.componentDefinition.id})}),n(new Ie(e.handlerUniqueId,d))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new Ie(e.handlerUniqueId,[],!0));debugger}}).then()})}},kn=(e,t,n)=>{const s=e.scriptInputs?e.scriptInputs:{};s.makeSerializable=G,s.send=t,s.rootRef=n,s.__scriptInputs=s;const o=new Function(`return (${e.script})(...arguments)`)(s);t(o)},Dn=class extends A{constructor(){super(...arguments),a(this,"messageType",v.ExecuteScriptMessage),a(this,"innerExecutor",(e,t,n)=>{kn(e,i=>{n(new Ue(e.handlerUniqueId,i))},t)})}},yt=e=>{if(!e)return null;if(e.tagName==="FORM"){new FormData(e);const t={formData:{},unmappedData:[]};return e.querySelectorAll("input, select, textarea").forEach(s=>{if(typeof s.value=="string"){const i=s.getAttribute(ie.id);let o=s.getAttribute("name");const r={id:s.id,name:o,value:yt(s),required:s.required,validity:G(s.validity,!0),myopId:i};o?t.formData[o]?t.formData[o].value?t.unmappedData.push(r):(t.unmappedData.push(t.formData[o]),t.formData[o]=r):t.formData[o]=r:t.unmappedData.push(r)}}),t}return e.type==="checkbox"||e.type==="radio"?e.checked?e.value:null:e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?e.value:e.isContentEditable?e.innerText||e.textContent:null},Ln=class extends A{constructor(){super(...arguments),a(this,"messageType",v.GetElementValueMessage),a(this,"innerExecutor",(e,t,n)=>{Y(e.ref,t.shadowRoot).forEach(i=>{n(new Ve(yt(i)),e)})})}},On=class extends A{constructor(){super(...arguments),a(this,"messageType",v.SetInnerHtml),a(this,"innerExecutor",(e,t)=>{Y(e.ref,t.shadowRoot).forEach(s=>{s.innerHTML=e.content})})}},vt=class extends pn{constructor(){super(...arguments),a(this,"alwaysPassEnvelopesToHost",!0),a(this,"connectedCallback",(e,t)=>{e.addEventListener(ft.webcomponent_message_key,n=>{const s=n.data?n.data:n.detail;if(!s||!s.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{const i=s;if(this.handleIncomeMessages(n),i.messageType===v.InitMessage){const o=i.content.id;this.components[o].context=new In(e,t)}}}),setTimeout(()=>{this.messageToHost(new Ye)},1)}),a(this,"messageToHost",(e,t)=>{e.direction=k.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)}),a(this,"supportedHandlers",[new Tn(this.messageToHost,this.components),new On(this.messageToHost,this.components),new Cn(this.messageToHost,this.components),new Sn(this.messageToHost,this.components),new xn(this.messageToHost,this.components),new Rn(this.messageToHost,this.components),new Dn(this.messageToHost,this.components),new Ln(this.messageToHost,this.components),new Hn(this.messageToHost,this.components)]),a(this,"init",()=>{})}};Be("WebComponentSDK",vt);var wt=[],me,_t=()=>y(void 0,null,function*(){return me||(me=new vt,me.init()),me});function Pn(e,t){return class extends HTMLElement{connectedCallback(){const n=t===ne.open?"open":"closed",s=this.attachShadow({mode:n});_t().then(i=>{i.connectedCallback(this,s),s.innerHTML=e})}}}var An=(e,t,n)=>{customElements.define(e,Pn(t,n)),console.log(`define('${e}') was called, web component ready to use`)},Bn=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)/g,"-$1").toLowerCase(),Fn=e=>(e=Bn(e),e.replace(/_/g,"-")),$n=class extends He{constructor(){super(...arguments),a(this,"type",te.HTMLLoader),a(this,"load",(e,t,n,s)=>y(this,null,function*(){const i=t.loader;let o=`myop-comp-${V()}`,r;if(i.shadowRootMode===ne.localFrame){const l=`myop-comp-${V()}`;let d=document.createElement("iframe");d.id=l,d.style.cssText=`
|
|
78
78
|
display: block;
|
|
79
79
|
padding: 0;
|
|
80
80
|
margin: 0;
|
|
@@ -91,7 +91,7 @@ Check the documentation for valid behavior options.`);return!1}};return e.props=
|
|
|
91
91
|
window.myopState = {
|
|
92
92
|
beforeKeysWindow,
|
|
93
93
|
};
|
|
94
|
-
<\/script>`;const B=D.body.firstChild;B&&M.head&&M.head.insertBefore(M.importNode(B,!0),M.head.firstChild),h=M.documentElement.outerHTML}else{const M=new DOMParser().parseFromString(i.HTML,"text/html"),I=M.getElementById("myop_preview");I&&(I.remove(),h=M.documentElement.outerHTML)}u.writeln(h);const f=`<script>${
|
|
94
|
+
<\/script>`;const B=D.body.firstChild;B&&M.head&&M.head.insertBefore(M.importNode(B,!0),M.head.firstChild),h=M.documentElement.outerHTML}else{const M=new DOMParser().parseFromString(i.HTML,"text/html"),I=M.getElementById("myop_preview");I&&(I.remove(),h=M.documentElement.outerHTML)}u.writeln(h);const f=`<script>${At}<\/script>`;if(u.writeln(`${f}<script>
|
|
95
95
|
const __myop_init = async () => {
|
|
96
96
|
const iframeModule = await MyopSDK.getIframeModule();
|
|
97
97
|
const IframeSDK = iframeModule.IframeSDK;
|
|
@@ -164,4 +164,4 @@ Check the documentation for valid behavior options.`);return!1}};return e.props=
|
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
})();
|
|
167
|
-
<\/script>`;u.writeln(H+I)}u.close();const m=new mt(e,t,n,d,s);return i.autoHeight&&(d.onload=()=>{m.observeSizeBasedOnDocumentElement()}),m}if(i.shadowRootMode===ne.none){const c=document.createElement("template");c.innerHTML=i.HTML,r=c.content.firstElementChild,_t().then(l=>{l.connectedCallback(r,r)})}else{const c=An(e.name+t.id);wt.includes(c)||(On(c,i.HTML,i.shadowRootMode),wt.push(c)),r=document.createElement(c)}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 gt(e,t,n,r,s)}))}},Fn=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:pe.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:pe.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),fe="__MYOP_CLOUD_REPOSITORY_MAIN__",$n=()=>{if(typeof window<"u")return window[fe];if(typeof globalThis<"u")return globalThis[fe]},Kn=e=>{typeof window<"u"&&(window[fe]=e),typeof globalThis<"u"&&(globalThis[fe]=e)},Mt=class X{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,a(this,"variants",{}),a(this,"preloadedComponents",{}),a(this,"userFlows",{}),a(this,"_defaultEnv","production")}static get Main(){const t=$n();return t||(X._main||(X._main=new X,Kn(X._main)),X._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,n,s){return n!==void 0||s!==void 0?`${t}:${n||this._defaultEnv}:${s?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,n,s){return y(this,null,function*(){const i=this.preloadedComponents[t],o=n!==void 0||s!==void 0;let r,c;!o&&i?(r=i.env,c=i.preview):(r=n||this._defaultEnv,c=s===!0?!0:s===!1?!1:!n);const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>y(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const m=(yield(yield fetch(h)).json()).item;if(!m){u(new Error(`Component "${t}" not found`));return}if(!m.consume_variant||!m.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const H=Fn(m);d(H)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,n){return y(this,null,function*(){return n?(yield this.fetchFlow(n)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return y(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>y(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return y(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>y(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchComponent(t,n){return y(this,null,function*(){return this.fetchComponentV1(t,n)})}};a(Mt,"_main",null);var bt=Mt,Nn=e=>y(void 0,null,function*(){try{const t=new URL(window.location.href),s=new URLSearchParams(t.search).get("myopOverride");if(s){const[i,...o]=Fe(s);switch(i){case"component":{const[r,c]=o,l=yield bt.Main.fetchComponent(r);if(l&&l.type.skins.find(u=>u.id===c))return l.instance.skinSelector={type:se.Dedicated,skin:{id:c}},l}break;default:{const[r,c]=Fe(s),d=(yield bt.Main.fetchFlow(r)).components.find(u=>u.type.id===e.type.id);if(d&&d.instance.skinSelector.type===se.Segmented&&d.instance.resolvedExperiences){const u=d.instance.resolvedExperiences.find(h=>h.id===c);if((u==null?void 0:u.type)===rt.Segment){const h=u,g=d.instance.skinSelector.segments.find(m=>m.segmentId===h.segment.id);if(g)return d.instance.skinSelector=g==null?void 0:g.skinSelector,d}}}break}}}finally{return null}}),Et="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",ge=class{constructor(){a(this,"components2init",[]),a(this,"components",[]),a(this,"componentsLoaders",[]),a(this,"initiated",!1),a(this,"version",Mn),a(this,"type2InstanceCount",{}),a(this,"assignId",e=>(this.type2InstanceCount[e.id]||(this.type2InstanceCount[e.id]=0),`${e.id}_${++this.type2InstanceCount[e.id]}`)),a(this,"inspected",!1),a(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(e=>{e.inspect&&e.inspect()}))}),a(this,"incomingMessageHandler",e=>{if(e.origin,document.location.origin,e.data.myop){if(e.data.direction!==k.up&&e.data.messageType!==v.EnvelopedMessage)return;const t=e.data;if(t.messageType===v.InitRequest){this.components2init.forEach(s=>{s.send(new Te(s.id))});return}if(t.messageType===v.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==t.content.id);const s=this.components.find(i=>{var o;return i.id===((o=t.content)==null?void 0:o.id)});s==null||s.setInitiated();return}if(t.messageType===v.EnvelopedMessage){const s=t,i=this.components.find(o=>o.id===s.destination);if(i){if(s.direction===k.down){s.message.messageType===K.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{const o=this.components.find(r=>r.id===s.message.destination);o&&o.send(s.message)}return}const n=this.components.find(s=>s.id===t.destination);if(!n){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t);return}if(n){if(n.onMessageReceived(t))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t)}}}),a(this,"send",e=>{const t=new MessageEvent("",{data:e});this.incomingMessageHandler(t)}),a(this,"init",e=>{if(this.initiated)throw new Error("hostSDK already initiated");const t=[new wn,new _n,new Bn];if(this.componentsLoaders=[...t],e){const n={};e.forEach(s=>{const i=new s(this.componentsLoaders);n[i.type]=i}),this.componentsLoaders.forEach(s=>{n[s.type]||(n[s.type]=s)}),this.componentsLoaders=Object.values(n)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0}),a(this,"_getSkinIdBySkinSelector",(e,...t)=>y(this,[e,...t],function*(n,s=[],i){var o;function r(c,l){return y(this,null,function*(){for(const d of c)if(yield l(d))return d})}switch(n.type){case"DedicatedSkin":case se.Dedicated:return((o=n.skin)==null?void 0:o.id)||n.skins[0].id;case se.Segmented:{const l=yield r(n.segments,d=>y(this,null,function*(){if(d.segmentId==="Default")return!0;const u=s.find(m=>m.type===rt.Segment?m.segment.id===d.segmentId:!1);if(!u)throw new Error("experience not found");const f=u.segment,g=(i||{})[f.function];return g?yield g():(console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`),!1)}));if(l)return this._getSkinIdBySkinSelector(l.skinSelector,s);debugger}break;default:debugger}return""})),a(this,"runSkinSelector",(e,t)=>y(this,null,function*(){const n=yield this._getSkinIdBySkinSelector(e.instance.skinSelector,e.instance.resolvedExperiences,t);return e.type.skins.find(s=>s.id===n)})),a(this,"loaderHooks"),a(this,"loadComponent",(e,t,n)=>y(this,null,function*(){var s,i,o,r;if(!t){debugger;throw new Error("no container was found for this component")}const c=yield Nn(e);c&&(e=c);const l=C(C({},(s=this.loaderHooks)!=null?s:{}),(i=n==null?void 0:n.hooks)!=null?i:{}),d=t;if(d.myop)if(d.component){e=C({},e),e.instance=C({},e.instance);let g=yield this.runSkinSelector(e,l);if(!g)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(o=n==null?void 0:n.hooks)!=null&&o.afterSkinSelected&&(g=yield n.hooks.afterSkinSelected(C({},g))),e.instance.skinSelector={type:se.Dedicated,skin:g},n&&(n=C({},n),delete n.hooks),yield ht(d,e,this.components,n)}else throw new Error("load component got a detached ref.");t=t;let u=yield this.runSkinSelector(e,l);if(!u)throw new Error("runSkinSelector failed to choose skin, check the provided config");(r=n==null?void 0:n.hooks)!=null&&r.afterSkinSelected&&(u=yield n.hooks.afterSkinSelected(C({},u)));const h=this.componentsLoaders.find(g=>g.type===u.loader.type);if(!h){debugger;throw new Error(`no loader "${u.loader.type}" was found for component`)}let f=yield h.load(e.type,u,t,n);f.isInitiated||this.components2init.push(f),f.bind("onDispose",()=>(this.components=this.components.filter(g=>g!==f),this.components2init=this.components2init.filter(g=>g!==f),!0)),this.components.push(f),(!n||n.connectProps!==!1)&&(f=gn(f,e.type.props,u));try{yield pt(f,e,this.components)}catch(g){throw g}return n!=null&&n.skipInit||(yield f.initiated()),f})),a(this,"navigate",(e,t,n)=>y(this,null,function*(){if(e.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(n!=null&&n.staged){let s=yield this.loadComponent(t,e.container,C({hidden:!0,relative:{direction:"after",child:e.element}},n));return n.init&&(yield n.init(s)),s.show(),e.dispose(),s}else{const s=e.element.nextSibling;return e.dispose(),this.loadComponent(t,e.container,C({relative:{direction:"before",child:s}},n))}}))}};if(a(ge,"Instance",()=>window.myop.hostSDK),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Et}),!window.myop.hostSDK){const e=new ge;e.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Et}),window.myop.hostSDK=e}var De=window.myop.hostSDK;Be("hostSDK",De);var zn=Object.defineProperty,Un=(e,t,n)=>t in e?zn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t,n)=>Un(e,typeof t!="symbol"?t+"":t,n),N=(e,t,n)=>new Promise((s,i)=>{var o=l=>{try{c(n.next(l))}catch(d){i(d)}},r=l=>{try{c(n.throw(l))}catch(d){i(d)}},c=l=>l.done?s(l.value):Promise.resolve(l.value).then(o,r);c((n=n.apply(e,t)).next())}),z=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),qn=class{constructor(){p(this,"id",z()),p(this,"myop",!0),p(this,"content"),p(this,"source"),p(this,"destination"),p(this,"route"),p(this,"ref"),p(this,"direction"),p(this,"cleanable",!1)}static create(...e){return new this(...e)}isTypeof(e){return e.messageType===this.messageType}},jn=class extends qn{constructor(e){super(),this.handler=e,p(this,"handlerUniqueId",z())}},Wn="ExecuteScriptReplyMessage",Vn=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,Gn=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,Yn=e=>{let t=e.match(Vn);if(t)return t[1]||t[3];{let n=e.match(Gn);if(n)return n[1].trim()}},Ct=class extends jn{constructor(e,t=()=>{},n){super(t),this.scriptInputs=n,p(this,"replyMessageKey",Wn),p(this,"messageType","ExecuteScriptMessage"),p(this,"script",""),this.script=e.toString(),this.content=e.toString(),this.content=Yn(this.content)}};p(Ct,"replierKey","send"),p(Ct,"completeStreamKey","completeStream");var Tt=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+z()),p(this,"_runTimeId","runtime-id-"+z()),p(this,"_runTimeName","runtime-name-"+z()),p(this,"id",this._runTimeId),p(this,"name",this._runTimeName),p(this,"description",""),p(this,"loader",null),p(this,"withLoader",t=>(this.loader=t,this)),p(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this)),p(this,"build",()=>this)}};p(Tt,"create",()=>new Tt);var It=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+z()),p(this,"_runTimeId","runtime-id-"+z()),p(this,"_runTimeName","runtime-name-"+z()),p(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null}),p(this,"name",this._runTimeName),p(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0}),p(this,"withInstance",t=>(this.instance=t,this)),p(this,"withType",t=>(this.type=t,this)),p(this,"withName",t=>(this.name=t,this)),p(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this)),p(this,"withRef",t=>(this.type.refs.push(t),this)),p(this,"withBasicRef",t=>{const n={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(n),this}),p(this,"build",()=>JSON.parse(JSON.stringify(this)))}};p(It,"create",()=>new It);var St={code:"code"},Jn=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:St.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:St.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),ye="__MYOP_CLOUD_REPOSITORY_MAIN__",Xn=()=>{if(typeof window<"u")return window[ye];if(typeof globalThis<"u")return globalThis[ye]},Qn=e=>{typeof window<"u"&&(window[ye]=e),typeof globalThis<"u"&&(globalThis[ye]=e)},xt=class Q{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,p(this,"variants",{}),p(this,"preloadedComponents",{}),p(this,"userFlows",{}),p(this,"_defaultEnv","production")}static get Main(){const t=Xn();return t||(Q._main||(Q._main=new Q,Qn(Q._main)),Q._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,n,s){return n!==void 0||s!==void 0?`${t}:${n||this._defaultEnv}:${s?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,n,s){return N(this,null,function*(){const i=this.preloadedComponents[t],o=n!==void 0||s!==void 0;let r,c;!o&&i?(r=i.env,c=i.preview):(r=n||this._defaultEnv,c=s===!0?!0:s===!1?!1:!n);const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>N(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const m=(yield(yield fetch(h)).json()).item;if(!m){u(new Error(`Component "${t}" not found`));return}if(!m.consume_variant||!m.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const H=Jn(m);d(H)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,n){return N(this,null,function*(){return n?(yield this.fetchFlow(n)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return N(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>N(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return N(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>N(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchComponent(t,n){return N(this,null,function*(){return this.fetchComponentV1(t,n)})}};p(xt,"_main",null);var ve=xt;const Zn=e=>{const t=w.useRef(null),n=w.useRef(null),s=w.useRef(!1),i=w.useRef(null);return w.useEffect(()=>{let o=!1;s.current=!(t!=null&&t.current);const r=async c=>{s.current=!0;try{const l=await ve.Main.fetchComponent(c.componentId,c.flowId);n.current=await De.loadComponent(l,t.current,{_environment:{props:{...c}}}),o?n.current&&n.current.dispose():c.onReady&&c.onReady(n.current)}catch{}finally{if(s.current=!1,i.current!==null&&!o){const l=i.current;i.current=null,await r(l)}}};return s.current?i.current={...e}:r(e).then(),()=>{o=!0,n.current&&n.current.dispose()}},[e.flowId,e.componentId]),E.jsx("div",{style:{height:"100%",overflow:"inherit"},ref:t})},es={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,background:"linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)",display:"flex",justifyContent:"center",alignItems:"center",transition:"opacity 0.2s ease-out"},Rt=()=>E.jsx("svg",{width:"80",viewBox:"0 0 525 243",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{d:"M151.438 2.7168C177.625 2.76042 248.179 4.2832 300.4 56.7441C350.671 107.245 364.44 114.452 389.967 119.211C392.576 119.436 397.472 119.394 400.802 116.521C403.011 114.614 403.921 109.518 404.265 104.627V5.95996C404.265 4.85556 405.16 3.96023 406.265 3.95996H522.711C523.815 3.95996 524.711 4.85539 524.711 5.95996V122.405C524.711 123.51 523.815 124.405 522.711 124.405H421.998C418.579 124.728 413.852 125.627 410.974 128.095C407.879 130.748 407.042 137.805 406.845 142.661V240.414C406.845 241.436 406.111 242.292 405.093 242.38C366.548 245.717 277.079 228.462 235.837 173.668C202.909 129.919 173.882 122.474 151.458 122.077C150.354 122.058 149.459 121.164 149.459 120.06V4.71582C149.459 3.6114 150.334 2.71519 151.438 2.7168ZM62.2031 0C96.5566 0.000213148 124.405 27.8496 124.405 62.2031C124.405 96.5564 96.5564 124.405 62.2031 124.405C27.8496 124.405 0.000213175 96.5566 0 62.2031C0 27.8495 27.8495 0 62.2031 0Z",fill:"white"})}),ts={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,display:"flex",justifyContent:"center",alignItems:"center",transition:"opacity 0.2s ease-out"},ns=({opacity:e=1,fadeDuration:t=200,children:n})=>n!==void 0?E.jsx("div",{style:{...ts,opacity:e,transition:`opacity ${t}ms ease-out`},children:n}):E.jsx("div",{style:{...es,opacity:e,transitionDuration:`${t}ms`},children:E.jsx(Rt,{})}),ss={position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)",display:"flex",justifyContent:"center",alignItems:"center"},is={position:"absolute",top:0,left:0,right:0,bottom:0},os=({children:e})=>e!==void 0?E.jsx("div",{style:is,children:e}):E.jsx("div",{style:ss,children:E.jsx(Rt,{})}),rs=e=>`on${e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}`,Ht=e=>{var S,x,F,re,ae,ce;const t=w.useRef(null),n=w.useRef(null),s=w.useRef(!1),i=w.useRef(null),o=e.componentId?Dt(e.componentId):!1,[r,c]=w.useState(!o),[l,d]=w.useState(1),[u,h]=w.useState(!1),[f,g]=w.useState(!1),[m,H]=w.useState(void 0),M=e.autoSize??!1,I=w.useRef(!1),D=e.fadeDuration??200,B=w.useCallback(()=>{d(0),setTimeout(()=>{c(!1)},D)},[D]),we=w.useCallback(b=>{console.error("[MyopComponent] Error:",b),B(),h(!0),e.onError&&e.onError(b)},[B,e.onError]);w.useEffect(()=>{I.current=!1},[e.componentId]),w.useEffect(()=>{if(f&&e.data!==void 0&&n.current){if(!I.current){I.current=!0;return}const b=n.current.props.myop_init_interface;b&&b(e.data)}},[e.data,f]),w.useEffect(()=>{var j,R,le,L,de,W,ue;if(!f||!((j=n.current)!=null&&j.observeAutoSize))return;let b=!0;return n.current.observeAutoSize({explicitWidth:(R=e.style)==null?void 0:R.width,explicitHeight:(le=e.style)==null?void 0:le.height,minWidth:(L=e.style)==null?void 0:L.minWidth,maxWidth:(de=e.style)==null?void 0:de.maxWidth,minHeight:(W=e.style)==null?void 0:W.minHeight,maxHeight:(ue=e.style)==null?void 0:ue.maxHeight,forceAutoSize:M,loaderMinHeight:50,onSizeChange:Me=>{e.onSizeChange&&e.onSizeChange(Me)===!1||(H(Me),b&&(b=!1,B()))}})},[M,f,e.onSizeChange,(S=e.style)==null?void 0:S.width,(x=e.style)==null?void 0:x.height,(F=e.style)==null?void 0:F.minWidth,(re=e.style)==null?void 0:re.maxWidth,(ae=e.style)==null?void 0:ae.minHeight,(ce=e.style)==null?void 0:ce.maxHeight]),w.useEffect(()=>{let b=!1;s.current=!(t!=null&&t.current);const j=async R=>{var le;s.current=!0;try{if(!R.componentId&&!R.componentConfig){we("No component configuration provided");return}const L=await kt().fetchComponentV2(R.componentId,R.environment,R.preview),de=await De.loadComponent(L,t.current,{data:R.data,_environment:{props:{...R}}});if(b){de.dispose();return}if(n.current=de,await n.current.initiated(),b){n.current&&n.current.dispose();return}if(await new Promise(W=>requestAnimationFrame(W)),b||!n.current||n.current.markedForDisposed){n.current&&!n.current.markedForDisposed&&n.current.dispose();return}g(!0),M||B(),(le=n.current)!=null&&le.props&&(n.current.props.myop_cta_handler=(W,ue)=>{e.on&&e.on(W,ue);const Me=rs(W),Le=e[Me];typeof Le=="function"&&Le(ue)}),R.onLoad&&n.current&&R.onLoad(n.current)}catch(L){b||we((L==null?void 0:L.message)||"Unknown error")}finally{if(s.current=!1,i.current!==null&&!b){const L=i.current;i.current=null,await j(L)}}};return s.current?i.current={...e}:j(e).then(),()=>{b=!0,n.current&&n.current.dispose()}},[e.componentId]);const J=r?50:void 0,q=(m==null?void 0:m.autoSizingWidth)||(m==null?void 0:m.autoSizingHeight),_e={position:"relative",width:m!=null&&m.autoSizingWidth?m.width:"100%",height:m!=null&&m.autoSizingHeight?m.height:"100%",minHeight:J,overflow:q?"hidden":"inherit",...e.style},oe={position:"absolute",inset:0,overflow:q?"hidden":void 0};return E.jsxs("div",{style:_e,children:[E.jsx("div",{ref:t,style:oe}),r&&E.jsx(ns,{opacity:l,fadeDuration:D,children:e.loader}),u&&E.jsx(os,{children:e.fallback})]})};let U=ve.Main;const kt=()=>U,Dt=(e,t,n)=>U.isPreloaded(e,t,n),as=e=>U.getPreloadedParams(e),cs=()=>{U=new ve("http://localhost:9292")},ls=e=>{U=new ve(e)},ds=e=>{U=e},us=e=>{U.setEnvironment(e)},hs=async(e,t,n)=>Promise.allSettled(e.map(s=>U.fetchComponentV2(s,t,n)));_.MyopComponent=Ht,_.MyopContainer=Zn,_.MyopV2Container=Ht,_.enableLocalDev=cs,_.getCloudRepository=kt,_.getPreloadedParams=as,_.isPreloaded=Dt,_.preloadComponents=hs,_.setCloudRepository=ds,_.setCloudRepositoryUrl=ls,_.setEnvironment=us,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
167
|
+
<\/script>`;u.writeln(H+I)}u.close();const m=new mt(e,t,n,d,s);return i.autoHeight&&(d.onload=()=>{m.observeSizeBasedOnDocumentElement()}),m}if(i.shadowRootMode===ne.none){const c=document.createElement("template");c.innerHTML=i.HTML,r=c.content.firstElementChild,_t().then(l=>{l.connectedCallback(r,r)})}else{const c=Fn(e.name+t.id);wt.includes(c)||(An(c,i.HTML,i.shadowRootMode),wt.push(c)),r=document.createElement(c)}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 gt(e,t,n,r,s)}))}},Kn=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:pe.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:pe.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),fe="__MYOP_CLOUD_REPOSITORY_MAIN__",Nn=()=>{if(typeof window<"u")return window[fe];if(typeof globalThis<"u")return globalThis[fe]},zn=e=>{typeof window<"u"&&(window[fe]=e),typeof globalThis<"u"&&(globalThis[fe]=e)},Mt=class X{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,a(this,"variants",{}),a(this,"preloadedComponents",{}),a(this,"userFlows",{}),a(this,"_defaultEnv","production")}static get Main(){const t=Nn();return t||(X._main||(X._main=new X,zn(X._main)),X._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,n,s){return n!==void 0||s!==void 0?`${t}:${n||this._defaultEnv}:${s?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,n,s){return y(this,null,function*(){const i=this.preloadedComponents[t],o=n!==void 0||s!==void 0;let r,c;!o&&i?(r=i.env,c=i.preview):(r=n||this._defaultEnv,c=s===!0?!0:s===!1?!1:!n);const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>y(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const m=(yield(yield fetch(h)).json()).item;if(!m){u(new Error(`Component "${t}" not found`));return}if(!m.consume_variant||!m.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const H=Kn(m);d(H)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,n){return y(this,null,function*(){return n?(yield this.fetchFlow(n)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return y(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>y(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return y(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>y(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchComponent(t,n){return y(this,null,function*(){return this.fetchComponentV1(t,n)})}};a(Mt,"_main",null);var bt=Mt,Un=e=>y(void 0,null,function*(){try{const t=new URL(window.location.href),s=new URLSearchParams(t.search).get("myopOverride");if(s){const[i,...o]=Fe(s);switch(i){case"component":{const[r,c]=o,l=yield bt.Main.fetchComponent(r);if(l&&l.type.skins.find(u=>u.id===c))return l.instance.skinSelector={type:se.Dedicated,skin:{id:c}},l}break;default:{const[r,c]=Fe(s),d=(yield bt.Main.fetchFlow(r)).components.find(u=>u.type.id===e.type.id);if(d&&d.instance.skinSelector.type===se.Segmented&&d.instance.resolvedExperiences){const u=d.instance.resolvedExperiences.find(h=>h.id===c);if((u==null?void 0:u.type)===rt.Segment){const h=u,g=d.instance.skinSelector.segments.find(m=>m.segmentId===h.segment.id);if(g)return d.instance.skinSelector=g==null?void 0:g.skinSelector,d}}}break}}}finally{return null}}),Et="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",ge=class{constructor(){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",()=>{this.inspected||(this.inspected=!0,this.components.forEach(e=>{e.inspect&&e.inspect()}))}),a(this,"incomingMessageHandler",e=>{if(e.origin,document.location.origin,e.data.myop){if(e.data.direction!==k.up&&e.data.messageType!==v.EnvelopedMessage)return;const t=e.data;if(t.messageType===v.InitRequest){this.components2init.forEach(s=>{s.send(new Te(s.id))});return}if(t.messageType===v.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==t.content.id);const s=this.components.find(i=>{var o;return i.id===((o=t.content)==null?void 0:o.id)});s==null||s.setInitiated();return}if(t.messageType===v.EnvelopedMessage){const s=t,i=this.components.find(o=>o.id===s.destination);if(i){if(s.direction===k.down){s.message.messageType===K.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{const o=this.components.find(r=>r.id===s.message.destination);o&&o.send(s.message)}return}const n=this.components.find(s=>s.id===t.destination);if(!n){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t);return}if(n){if(n.onMessageReceived(t))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t)}}}),a(this,"send",e=>{const t=new MessageEvent("",{data:e});this.incomingMessageHandler(t)}),a(this,"init",e=>{if(this.initiated)throw new Error("hostSDK already initiated");const t=[new Mn,new bn,new $n];if(this.componentsLoaders=[...t],e){const n={};e.forEach(s=>{const i=new s(this.componentsLoaders);n[i.type]=i}),this.componentsLoaders.forEach(s=>{n[s.type]||(n[s.type]=s)}),this.componentsLoaders=Object.values(n)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0}),a(this,"_getSkinIdBySkinSelector",(e,...t)=>y(this,[e,...t],function*(n,s=[],i){var o;function r(c,l){return y(this,null,function*(){for(const d of c)if(yield l(d))return d})}switch(n.type){case"DedicatedSkin":case se.Dedicated:return((o=n.skin)==null?void 0:o.id)||n.skins[0].id;case se.Segmented:{const l=yield r(n.segments,d=>y(this,null,function*(){if(d.segmentId==="Default")return!0;const u=s.find(m=>m.type===rt.Segment?m.segment.id===d.segmentId:!1);if(!u)throw new Error("experience not found");const f=u.segment,g=(i||{})[f.function];return g?yield g():(console.warn(`segmentId:${d.segmentId}, ${f.function} function not provided !`),!1)}));if(l)return this._getSkinIdBySkinSelector(l.skinSelector,s);debugger}break;default:debugger}return""})),a(this,"runSkinSelector",(e,t)=>y(this,null,function*(){const n=yield this._getSkinIdBySkinSelector(e.instance.skinSelector,e.instance.resolvedExperiences,t);return e.type.skins.find(s=>s.id===n)})),a(this,"loaderHooks"),a(this,"loadComponent",(e,t,n)=>y(this,null,function*(){var s,i,o,r;if(!t){debugger;throw new Error("no container was found for this component")}const c=yield Un(e);c&&(e=c);const l=C(C({},(s=this.loaderHooks)!=null?s:{}),(i=n==null?void 0:n.hooks)!=null?i:{}),d=t;if(d.myop)if(d.component){e=C({},e),e.instance=C({},e.instance);let g=yield this.runSkinSelector(e,l);if(!g)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(o=n==null?void 0:n.hooks)!=null&&o.afterSkinSelected&&(g=yield n.hooks.afterSkinSelected(C({},g))),e.instance.skinSelector={type:se.Dedicated,skin:g},n&&(n=C({},n),delete n.hooks),yield ht(d,e,this.components,n)}else throw new Error("load component got a detached ref.");t=t;let u=yield this.runSkinSelector(e,l);if(!u)throw new Error("runSkinSelector failed to choose skin, check the provided config");(r=n==null?void 0:n.hooks)!=null&&r.afterSkinSelected&&(u=yield n.hooks.afterSkinSelected(C({},u)));const h=this.componentsLoaders.find(g=>g.type===u.loader.type);if(!h){debugger;throw new Error(`no loader "${u.loader.type}" was found for component`)}let f=yield h.load(e.type,u,t,n);f.isInitiated||this.components2init.push(f),f.bind("onDispose",()=>(this.components=this.components.filter(g=>g!==f),this.components2init=this.components2init.filter(g=>g!==f),!0)),this.components.push(f),(!n||n.connectProps!==!1)&&(f=vn(f,e.type.props,u));try{yield pt(f,e,this.components)}catch(g){throw g}return n!=null&&n.skipInit||(yield f.initiated()),f})),a(this,"navigate",(e,t,n)=>y(this,null,function*(){if(e.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(n!=null&&n.staged){let s=yield this.loadComponent(t,e.container,C({hidden:!0,relative:{direction:"after",child:e.element}},n));return n.init&&(yield n.init(s)),s.show(),e.dispose(),s}else{const s=e.element.nextSibling;return e.dispose(),this.loadComponent(t,e.container,C({relative:{direction:"before",child:s}},n))}}))}};if(a(ge,"Instance",()=>window.myop.hostSDK),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Et}),!window.myop.hostSDK){const e=new ge;e.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Et}),window.myop.hostSDK=e}var De=window.myop.hostSDK;Be("hostSDK",De);var qn="linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)",jn="linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)",Wn={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,background:qn,display:"flex",justifyContent:"center",alignItems:"center"},Vn={position:"absolute",top:0,left:0,right:0,bottom:0,background:jn,display:"flex",justifyContent:"center",alignItems:"center"},Gn={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,display:"flex",justifyContent:"center",alignItems:"center"},Yn=Object.defineProperty,Jn=(e,t,n)=>t in e?Yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t,n)=>Jn(e,typeof t!="symbol"?t+"":t,n),N=(e,t,n)=>new Promise((s,i)=>{var o=l=>{try{c(n.next(l))}catch(d){i(d)}},r=l=>{try{c(n.throw(l))}catch(d){i(d)}},c=l=>l.done?s(l.value):Promise.resolve(l.value).then(o,r);c((n=n.apply(e,t)).next())}),z=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),Xn=class{constructor(){p(this,"id",z()),p(this,"myop",!0),p(this,"content"),p(this,"source"),p(this,"destination"),p(this,"route"),p(this,"ref"),p(this,"direction"),p(this,"cleanable",!1)}static create(...e){return new this(...e)}isTypeof(e){return e.messageType===this.messageType}},Qn=class extends Xn{constructor(e){super(),this.handler=e,p(this,"handlerUniqueId",z())}},Zn="ExecuteScriptReplyMessage",es=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,ts=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,ns=e=>{let t=e.match(es);if(t)return t[1]||t[3];{let n=e.match(ts);if(n)return n[1].trim()}},Ct=class extends Qn{constructor(e,t=()=>{},n){super(t),this.scriptInputs=n,p(this,"replyMessageKey",Zn),p(this,"messageType","ExecuteScriptMessage"),p(this,"script",""),this.script=e.toString(),this.content=e.toString(),this.content=ns(this.content)}};p(Ct,"replierKey","send"),p(Ct,"completeStreamKey","completeStream");var Tt=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+z()),p(this,"_runTimeId","runtime-id-"+z()),p(this,"_runTimeName","runtime-name-"+z()),p(this,"id",this._runTimeId),p(this,"name",this._runTimeName),p(this,"description",""),p(this,"loader",null),p(this,"withLoader",t=>(this.loader=t,this)),p(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this)),p(this,"build",()=>this)}};p(Tt,"create",()=>new Tt);var It=class{constructor(){p(this,"_runTimeInstanceId","runtime-instance-id-"+z()),p(this,"_runTimeId","runtime-id-"+z()),p(this,"_runTimeName","runtime-name-"+z()),p(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null}),p(this,"name",this._runTimeName),p(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0}),p(this,"withInstance",t=>(this.instance=t,this)),p(this,"withType",t=>(this.type=t,this)),p(this,"withName",t=>(this.name=t,this)),p(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this)),p(this,"withRef",t=>(this.type.refs.push(t),this)),p(this,"withBasicRef",t=>{const n={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(n),this}),p(this,"build",()=>JSON.parse(JSON.stringify(this)))}};p(It,"create",()=>new It);var St={code:"code"},ss=e=>({instance:{id:"auto",componentId:e.componentId,componentName:e.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:e.id,name:e.name,description:e.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:St.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:St.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:e.consume_variant[0].loader}],defaultSkin:0},name:e.name}),ye="__MYOP_CLOUD_REPOSITORY_MAIN__",is=()=>{if(typeof window<"u")return window[ye];if(typeof globalThis<"u")return globalThis[ye]},os=e=>{typeof window<"u"&&(window[ye]=e),typeof globalThis<"u"&&(globalThis[ye]=e)},xt=class Q{constructor(t="https://cloud.myop.dev"){this._baseUrl=t,p(this,"variants",{}),p(this,"preloadedComponents",{}),p(this,"userFlows",{}),p(this,"_defaultEnv","production")}static get Main(){const t=is();return t||(Q._main||(Q._main=new Q,os(Q._main)),Q._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,n,s){return n!==void 0||s!==void 0?`${t}:${n||this._defaultEnv}:${s?"preview":"live"}`in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}fetchComponentV2(t,n,s){return N(this,null,function*(){const i=this.preloadedComponents[t],o=n!==void 0||s!==void 0;let r,c;!o&&i?(r=i.env,c=i.preview):(r=n||this._defaultEnv,c=s===!0?!0:s===!1?!1:!n);const l=`${t}:${r}:${c?"preview":"live"}`;return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:r,usePreview:c,cacheKey:l,cached:l in this.variants}),this.variants[l]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:r,preview:c}),this.variants[l]=new Promise((d,u)=>N(this,null,function*(){try{let h=`${this._baseUrl}/consume?id=${t}&env=${r}`;c&&(h+="&preview=true");const m=(yield(yield fetch(h)).json()).item;if(!m){u(new Error(`Component "${t}" not found`));return}if(!m.consume_variant||!m.consume_variant.length){u(new Error(`Component "${t}" has no implementation for environment "${r}"`));return}const H=ss(m);d(H)}catch(h){u(h)}}))),yield this.variants[l]})}fetchComponentV1(t,n){return N(this,null,function*(){return n?(yield this.fetchFlow(n)).components.find(i=>i.type.id===t):(yield this.fetchAutoFlow(t)).components[0]})}fetchAutoFlow(t){return N(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>N(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&auto=true`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchFlow(t){return N(this,null,function*(){return this.userFlows[t]||(this.userFlows[t]=new Promise((n,s)=>N(this,null,function*(){try{const o=yield(yield fetch(`${this._baseUrl}/flow?id=${t}&resolve=components`)).json();n(o.item)}catch(i){s(i)}}))),yield this.userFlows[t]})}fetchComponent(t,n){return N(this,null,function*(){return this.fetchComponentV1(t,n)})}};p(xt,"_main",null);var ve=xt;const rs=e=>{const t=w.useRef(null),n=w.useRef(null),s=w.useRef(!1),i=w.useRef(null);return w.useEffect(()=>{let o=!1;s.current=!(t!=null&&t.current);const r=async c=>{s.current=!0;try{const l=await ve.Main.fetchComponent(c.componentId,c.flowId);n.current=await De.loadComponent(l,t.current,{_environment:{props:{...c}}}),o?n.current&&n.current.dispose():c.onReady&&c.onReady(n.current)}catch{}finally{if(s.current=!1,i.current!==null&&!o){const l=i.current;i.current=null,await r(l)}}};return s.current?i.current={...e}:r(e).then(),()=>{o=!0,n.current&&n.current.dispose()}},[e.flowId,e.componentId]),E.jsx("div",{style:{height:"100%",overflow:"inherit"},ref:t})},Rt=()=>E.jsx("svg",{width:"80",viewBox:"0 0 525 243",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.jsx("path",{d:"M151.438 2.7168C177.625 2.76042 248.179 4.2832 300.4 56.7441C350.671 107.245 364.44 114.452 389.967 119.211C392.576 119.436 397.472 119.394 400.802 116.521C403.011 114.614 403.921 109.518 404.265 104.627V5.95996C404.265 4.85556 405.16 3.96023 406.265 3.95996H522.711C523.815 3.95996 524.711 4.85539 524.711 5.95996V122.405C524.711 123.51 523.815 124.405 522.711 124.405H421.998C418.579 124.728 413.852 125.627 410.974 128.095C407.879 130.748 407.042 137.805 406.845 142.661V240.414C406.845 241.436 406.111 242.292 405.093 242.38C366.548 245.717 277.079 228.462 235.837 173.668C202.909 129.919 173.882 122.474 151.458 122.077C150.354 122.058 149.459 121.164 149.459 120.06V4.71582C149.459 3.6114 150.334 2.71519 151.438 2.7168ZM62.2031 0C96.5566 0.000213148 124.405 27.8496 124.405 62.2031C124.405 96.5564 96.5564 124.405 62.2031 124.405C27.8496 124.405 0.000213175 96.5566 0 62.2031C0 27.8495 27.8495 0 62.2031 0Z",fill:"white"})}),Ht=({opacity:e=1,fadeDuration:t=200,children:n})=>{if(n!==void 0){const i={...Gn,opacity:e,transition:`opacity ${t}ms ease-out`};return E.jsx("div",{style:i,children:n})}const s={...Wn,opacity:e,transition:`opacity ${t}ms ease-out`};return E.jsx("div",{style:s,children:E.jsx(Rt,{})})},as={position:"absolute",top:0,left:0,right:0,bottom:0},kt=({children:e})=>e!==void 0?E.jsx("div",{style:as,children:e}):E.jsx("div",{style:Vn,children:E.jsx(Rt,{})}),cs=e=>`on${e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}`,Dt=e=>{var S,x,F,re,ae,ce;const t=w.useRef(null),n=w.useRef(null),s=w.useRef(!1),i=w.useRef(null),o=e.componentId?Ot(e.componentId):!1,[r,c]=w.useState(!o),[l,d]=w.useState(1),[u,h]=w.useState(!1),[f,g]=w.useState(!1),[m,H]=w.useState(void 0),M=e.autoSize??!1,I=w.useRef(!1),D=e.fadeDuration??200,B=w.useCallback(()=>{d(0),setTimeout(()=>{c(!1)},D)},[D]),we=w.useCallback(b=>{console.error("[MyopComponent] Error:",b),B(),h(!0),e.onError&&e.onError(b)},[B,e.onError]);w.useEffect(()=>{I.current=!1},[e.componentId]),w.useEffect(()=>{if(f&&e.data!==void 0&&n.current){if(!I.current){I.current=!0;return}const b=n.current.props.myop_init_interface;b&&b(e.data)}},[e.data,f]),w.useEffect(()=>{var j,R,le,L,de,W,ue;if(!f||!((j=n.current)!=null&&j.observeAutoSize))return;let b=!0;return n.current.observeAutoSize({explicitWidth:(R=e.style)==null?void 0:R.width,explicitHeight:(le=e.style)==null?void 0:le.height,minWidth:(L=e.style)==null?void 0:L.minWidth,maxWidth:(de=e.style)==null?void 0:de.maxWidth,minHeight:(W=e.style)==null?void 0:W.minHeight,maxHeight:(ue=e.style)==null?void 0:ue.maxHeight,forceAutoSize:M,loaderMinHeight:50,onSizeChange:Me=>{e.onSizeChange&&e.onSizeChange(Me)===!1||(H(Me),b&&(b=!1,B()))}})},[M,f,e.onSizeChange,(S=e.style)==null?void 0:S.width,(x=e.style)==null?void 0:x.height,(F=e.style)==null?void 0:F.minWidth,(re=e.style)==null?void 0:re.maxWidth,(ae=e.style)==null?void 0:ae.minHeight,(ce=e.style)==null?void 0:ce.maxHeight]),w.useEffect(()=>{let b=!1;s.current=!(t!=null&&t.current);const j=async R=>{var le;s.current=!0;try{if(!R.componentId&&!R.componentConfig){we("No component configuration provided");return}const L=await Lt().fetchComponentV2(R.componentId,R.environment,R.preview),de=await De.loadComponent(L,t.current,{data:R.data,_environment:{props:{...R}}});if(b){de.dispose();return}if(n.current=de,await n.current.initiated(),b){n.current&&n.current.dispose();return}if(await new Promise(W=>requestAnimationFrame(W)),b||!n.current||n.current.markedForDisposed){n.current&&!n.current.markedForDisposed&&n.current.dispose();return}g(!0),M||B(),(le=n.current)!=null&&le.props&&(n.current.props.myop_cta_handler=(W,ue)=>{e.on&&e.on(W,ue);const Me=cs(W),Le=e[Me];typeof Le=="function"&&Le(ue)}),R.onLoad&&n.current&&R.onLoad(n.current)}catch(L){b||we((L==null?void 0:L.message)||"Unknown error")}finally{if(s.current=!1,i.current!==null&&!b){const L=i.current;i.current=null,await j(L)}}};return s.current?i.current={...e}:j(e).then(),()=>{b=!0,n.current&&n.current.dispose()}},[e.componentId]);const J=r?50:void 0,q=(m==null?void 0:m.autoSizingWidth)||(m==null?void 0:m.autoSizingHeight),_e={position:"relative",width:m!=null&&m.autoSizingWidth?m.width:"100%",height:m!=null&&m.autoSizingHeight?m.height:"100%",minHeight:J,overflow:q?"hidden":"inherit",...e.style},oe={position:"absolute",inset:0,overflow:q?"hidden":void 0};return E.jsxs("div",{style:_e,children:[E.jsx("div",{ref:t,style:oe}),r&&e.loader!==void 0&&E.jsx(Ht,{opacity:l,fadeDuration:D,children:e.loader}),u&&E.jsx(kt,{children:e.fallback})]})};let U=ve.Main;const Lt=()=>U,Ot=(e,t,n)=>U.isPreloaded(e,t,n),ls=e=>U.getPreloadedParams(e),ds=()=>{U=new ve("http://localhost:9292")},us=e=>{U=new ve(e)},hs=e=>{U=e},ps=e=>{U.setEnvironment(e)},ms=async(e,t,n)=>Promise.allSettled(e.map(s=>U.fetchComponentV2(s,t,n)));_.MyopComponent=Dt,_.MyopContainer=rs,_.MyopFallback=kt,_.MyopLoader=Ht,_.MyopV2Container=Dt,_.enableLocalDev=ds,_.getCloudRepository=Lt,_.getPreloadedParams=ls,_.isPreloaded=Ot,_.preloadComponents=ms,_.setCloudRepository=hs,_.setCloudRepositoryUrl=us,_.setEnvironment=ps,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|