@myop/react 0.0.37 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +830 -816
- package/dist/index.umd.cjs +26 -26
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const jt = `"use strict";var MyopSDK=(()=>{var Ve=Object.defineProperty,Ds=Object.defineProperties,Bs=Object.getOwnPropertyDescriptor,Ls=Object.getOwnPropertyDescriptors,Ps=Object.getOwnPropertyNames,Rn=Object.getOwnPropertySymbols;var _n=Object.prototype.hasOwnProperty,Os=Object.prototype.propertyIsEnumerable;var At=(o,n,e)=>n in o?Ve(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))_n.call(n,e)&&At(o,e,n[e]);if(Rn)for(var e of Rn(n))Os.call(n,e)&&At(o,e,n[e]);return o},V=(o,n)=>Ds(o,Ls(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var se=(o,n)=>{for(var e in n)Ve(o,e,{get:n[e],enumerable:!0})},As=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Ps(n))!_n.call(o,s)&&s!==e&&Ve(o,s,{get:()=>n[s],enumerable:!(t=Bs(n,s))||t.enumerable});return o};var Ks=o=>As(Ve({},"__esModule",{value:!0}),o);var r=(o,n,e)=>At(o,typeof n!="symbol"?n+"":n,e);var je,Ge,Kt,W,re=m(()=>{"use strict";je="__federation__",Ge="onLoad",Kt="moduleInstance",W=(o,n)=>{window[je]&&window[je][o]&&window[je][o][Ge]&&window[je][o][Ge]({[o]:n})}});var Ie,Ye=m(()=>{Ie="0.3.19"});var f,I=m(()=>{"use strict";f={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}}});var E,zs,Fs,zt,Ft=m(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),zs=o=>{let n=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-")},Fs=o=>{let n=o.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";let e=atob(n);return Uint8Array.from(e,t=>t.charCodeAt(0))},zt=o=>{let n=Fs(o);if(n.length%16!==0)throw new Error("Invalid input length");let e=[];for(let t=0;t<n.length;t+=16)e.push(zs(n.slice(t,t+16)));return e}});var Hn,ie=m(()=>{"use strict";Ft();Hn=o=>new Promise(n=>setTimeout(n,o))});var v,C,$t,R,_,Z,k=m(()=>{"use strict";ie();v=class{};r(v,"down","down"),r(v,"up","up");C=class{constructor(){r(this,"id",E());r(this,"myop",!0);r(this,"content");r(this,"source");r(this,"destination");r(this,"route");r(this,"ref");r(this,"direction");r(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},$t=class extends C{constructor(e){super();this.ref=e}},R=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",E())}},Z=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=V(M({},this),{component:null})}static create(n,e,t){let s=e;return s||(s={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(s,t)}}});var Dn,Wt,ae,Bn=m(()=>{"use strict";k();Dn="ClickReplayMessage",Wt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",Dn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},ae=class extends R{constructor(){super(...arguments);r(this,"messageType",Dn)}}});var Nt,Ln=m(()=>{"use strict";k();Nt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}}});var Pn,$s,Ws,On,D,pe,Ut=m(()=>{"use strict";k();Pn="ExecuteScriptReplyMessage",$s=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Ws=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,On=o=>{let n=o.match($s);if(n)return n[1]||n[3];{let e=o.match(Ws);if(e)return e[1].trim()}},D=class extends _{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;r(this,"replyMessageKey",Pn);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=On(this.content)}};r(D,"replierKey","send"),r(D,"completeStreamKey","completeStream");pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",Pn)}}});var j,An=m(()=>{"use strict";Ut();j=class extends D{constructor(e,t,s=()=>{}){super(({rootRef:i,elementId:a,_script:p,__scriptInputs:d})=>{let c=(i.shadowRoot||i.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=V(M({},t),{_script:e.toString()})}}});var Kn,qt,de,zn=m(()=>{"use strict";k();Kn="EventListenerCallbackMessage",qt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",Kn);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},de=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",Kn);this.content={e:t}}}});var Vt,Fn=m(()=>{"use strict";k();Vt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}}});var $n,jt,ce,Gt=m(()=>{"use strict";k();$n="ElementValueReplayMessage",jt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",$n);r(this,"messageType","GetElementValueMessage")}},ce=class extends R{constructor(e){super();this.content=e;r(this,"messageType",$n)}}});var Yt,Wn=m(()=>{"use strict";k();Yt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}}});var Ce,He,me,Nn=m(()=>{"use strict";k();Ce=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},He=class extends Ce{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},me=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}}});var Un,De,G,Qe=m(()=>{"use strict";k();Un="RefComponentCreatedMessage",De=class extends _{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Un);r(this,"messageType","CreateRefComponentMessage")}},G=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Un)}}});var Be,Qt=m(()=>{"use strict";k();Be=class extends C{constructor(e,t){super();this.destination=e;this.message=t;r(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var qn,Jt,le,Vn=m(()=>{"use strict";k();qn="DetectedMyopRefsMessage",Jt=class extends _{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",qn)}},le=class extends R{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",qn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var jn,Xt,Le,Gn=m(()=>{"use strict";k();jn="GetAttributeReplayMessage",Xt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",jn);r(this,"messageType","GetAttributeMessage")}},Le=class extends R{constructor(e){super();this.content=e;r(this,"messageType",jn)}}});var z,Yn=m(()=>{"use strict";k();z=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}}});var Zt,Pe,Qn=m(()=>{"use strict";k();Zt=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Pe=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}}});var Jn,Oe,Ae,Xn=m(()=>{"use strict";k();Jn="CleanupReplayMessage",Oe=class extends _{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",Jn);r(this,"messageType","CleanupMessage")}},Ae=class extends R{constructor(e){super();this.customCleanup=e;r(this,"messageType",Jn)}}});var Ke,Zn=m(()=>{"use strict";k();Ke=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}}});var en,ze,eo=m(()=>{"use strict";k();en=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},ze=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}}});var xe={};se(xe,{AddEventListenerMessage:()=>qt,BaseMyopMessage:()=>C,BindClickMessage:()=>Wt,ChangeTextMessage:()=>Nt,CleanupMessage:()=>Oe,CleanupReplayMessage:()=>Ae,ClickReplayMessage:()=>ae,CreateRefComponentMessage:()=>De,CustomRefMessage:()=>j,DetectMyopRefsMessage:()=>Jt,DetectedMyopRefsMessage:()=>le,DisposeMessage:()=>Ke,ElementValueReplayMessage:()=>ce,EnvelopedMessage:()=>Be,EventListenerCallbackMessage:()=>de,ExecuteComponentMethod:()=>z,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>pe,GetAttributeMessage:()=>Xt,GetAttributeReplayMessage:()=>Le,GetElementValueMessage:()=>jt,InitMessage:()=>Ce,InitRequest:()=>me,InitResponse:()=>He,MessageDirection:()=>v,MutationObserverMessage:()=>Pe,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>$t,Ref:()=>Z,RefComponentCreatedMessage:()=>G,ResizeObserverMessage:()=>ze,SetAttributeMessage:()=>Vt,SetInnerHtml:()=>Yt,SetMutationObserverMessage:()=>Zt,SetResizeObserverMessage:()=>en,stripFunction:()=>On});var b=m(()=>{"use strict";k();Bn();Ln();Ut();An();zn();Fn();Gt();Wn();Nn();Qe();Qt();Vn();Gt();Gn();Yn();Qn();Xn();Zn();eo()});var N,Fe=m(()=>{"use strict";I();b();$e();N=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;r(this,"id","");r(this,"messageHandlers",{});r(this,"element");r(this,"_markedForDisposed",!1);r(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});r(this,"bindWhen",(n,e,t)=>{if(!t)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[n]||(this.messageHandlers[n]=[]);let s=this.messageHandlers[n],i=a=>e(a)?(t(a),!0):!1;return s.push(i),()=>{let a=s.indexOf(i);a>-1&&s.splice(a,1)}});r(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});r(this,"isInitiated",!1);r(this,"_whenInitiatedResolve");r(this,"_whenInitiatedReject");r(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));r(this,"initiated",()=>this._whenInitiated);r(this,"props",{});r(this,"refs",{});this.id=(t==null?void 0:t.id)||$.Instance().assignId(n);let s=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(s," ").concat(this.id))},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(n){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=n}onMessageReceived(n){if(n.messageType===f.ExecuteComponentMethod){let t=n;return this[t.method]?this[t.method](t.content):console.log("method not found ".concat(t.method," on component"),this),!0}let e=this.messageHandlers[n.messageType];if(e&&e.length){let t=!1;return e.forEach(s=>{t=t||s(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=v.down;let e=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,s=>{n.handler(s),e()}),t=n.handler;delete n.handler,this.send(n),n.handler=t}send(n){n.source||(n.source=this.id),n.destination||(n.destination=this.id),n.direction=v.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,s=>s.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new Oe(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Ke);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var be,to=m(()=>{"use strict";be=class{constructor(n,e,t,s,i){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=i;r(this,"type","MyopElementRef")}}});var no,x,Je,oo=m(()=>{"use strict";no=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},x=class{constructor(n){this.messageToHost=n}},Je=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var tn,we,so=m(()=>{"use strict";I();w();b();tn=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},we=class{constructor(){r(this,"messageToHandleAfterInit",[]);r(this,"components",{});r(this,"alwaysPassEnvelopesToHost",!1);r(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==v.down)return;if(t.messageType===f.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===f.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new tn(s),this.messageToHost(new He(s));return}if(t.messageType===f.EnvelopedMessage){let s=t,i=s.message;if(t=i,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===i.destination);if(a){a.send(i);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(i);return}}else return}if(t.messageType){if(t.messageType===f.CleanupMessage){let i=t,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Ae(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],no(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let s=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===t.messageType){s=!0;let a=i.executor(t);if(t.cleanable&&a&&(this.messageCleanupCache[t.id]=a),a&&!t.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&t.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}}});var Y,fe,Te,Se,ue,Xe,Ee,w=m(()=>{"use strict";to();oo();so();Y={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},fe={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},Te={message:"message",code:"code"},Se=class{};r(Se,"code","code"),r(Se,"component","component");ue={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Xe={Segment:"Segment",Promo:"Promo",AB:"AB"},Ee=class{constructor(n,e){this.container=n;this.shadowRoot=e;r(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));r(this,"getRoot",()=>this.shadowRoot||this.container)}}});var nn,Ns,on,A,ge=m(()=>{"use strict";nn=o=>o!==Object(o),Ns=o=>typeof o=="function",on=o=>{if(nn(o))return!0;if(Ns(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!on(e))return!1}else{if(nn(e))continue;return!1}}return!0},A=(o,n={},e=!0,t=new WeakMap)=>{if(nn(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let i=0;i<o.length;i++){let a=o[i];s[i]=A(a,n,e,t)}return s}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let s={};t.set(o,s);for(let i in o){let a=typeof n=="boolean"?n:n[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(s[i]=A(o[i],!0,e,t)):typeof a=="object"&&(s[i]=A(o[i],a,e,t)))}return s}return{}}});var ro,io=m(()=>{"use strict";ro={notSerializableRefCall:(o,n)=>{throw new Error("\\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \\nThe following types of data are considered non-serializable and cannot be processed:\\n\\n- Functions\\n- DOM elements\\n- Class instances\\n- Circular references\\n- Symbols\\n- BigInt values\\n\\nIn the following execution we detected :\\n~~~~~~~~\\n").concat(n," \\n~~~~~~~~\\nas not serializable.\\n\\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \\nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\\n\\nSuggested Fix:\\n1. Remove or replace non-serializable values from your input.\\n2. If using objects, ensure they do not contain any functions or circular references.\\n3. Convert any class instances to plain objects or JSON-compatible formats.\\n4. Use dedicated Myop message.\\n\\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\\n\\n"))}}});var We,ao=m(()=>{"use strict";Fe();b();Qt();We=class extends N{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;r(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new Be(this.id,e)),e.handler=t,s});r(this,"dispose",()=>{this.isInitiated&&this.send(new z("dispose")),super.dispose()})}hide(){this.send(new z("hide"))}show(){this.send(new z("show"))}inspect(){return this.send(new z("inspect"))}setHeightBasedOnDocumentElement(){this.send(new z("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new z("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var ye,sn=m(()=>{"use strict";Fe();Ne();ye=class extends N{constructor(e,t,s,i,a,p){super(e,s,p);this.container=s;this.customElement=i;this.tagName=a;r(this,"ctaCleanup");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});r(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i,this.setInitiated()}inspect(){return this.cleanupInspect=ve(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){let s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}let t=s=>{var a;let i=s;(a=i.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var Us,ve,po,co,mo,qs,rn,an,Ne=m(()=>{"use strict";b();b();w();ge();io();ao();sn();Us=(o,n,e)=>{let t=document.createElement("a");return t.textContent=o,t.style.position="relative",t.style.padding="0 5px",t.style.fontSize="14px",t.style.top="0",t.style.top="".concat(n,"px"),t.style.transform="translateX(-50%)",t.target="_blank",t.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),t},ve=(o,n,e,t,s,i)=>{let a=Us("".concat(i.name," : ").concat(n),e,i);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},po=(o,n,e)=>o?!1:(console.error("Error: Undefined Prop\\n\\nIt looks like you've tried to use a prop that hasn't been defined.\\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),co=(o,n,e)=>{console.error("Error: Code Prop Not Supported\\n\\nCurrently, code props are only supported in local frame components.\\n\\u26A0\\uFE0F This is a work in progress feature \\u2014 code props will be supported in upcoming versions.\\n\\nIn the meantime, you can use message props.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},mo=(o,n,e)=>{let t=n.reduce((i,a)=>V(M({},i),{[a.name]:M({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(po(p,a,o))return!1;if(p.behavior.type===Te.code){if(o instanceof ye)return(p.behavior.remap||a)==="myop_init_interface"?l=>{if(l===void 0)return o.getData();o.initWithData(l)}:void 0;if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return co(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(Z.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let l=xe[p.behavior.message];o.send(new l(...c))}):null},set:(i,a,p)=>{let d=t[a];if(po(d,a,o))return!1;if(d.behavior.type===Te.code){if(o instanceof ye){let l=d.behavior.remap||a;if(l==="myop_cta_handler")return o.setCtaHandler(p),!0;if(l==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let l=d.behavior,u=o.element.contentWindow,g=l.remap||a;if(u[g]=p,g==="myop_cta_handler"&&u.__myop_cta_queue){let y=u.__myop_cta_queue;u.__myop_cta_queue=null,y.forEach(h=>{o.markedForDisposed||p(h.action,h.payload)})}return!0}return co(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(Z.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let l=xe[d.behavior.message];return o.send(new l(...c)),!0}else throw new Error("Error: Unsupported Behavior\\n\\nThe 'behavior' field provided is not supported.\\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\\n\\n")+"Prop Name: ".concat(a,"\\n")+"Behavior Field: ".concat(d.behavior.type,"\\n\\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,s),o},qs=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{on(p)||ro.notSerializableRefCall(t,p)}),n.send(new j(({ref:p,propName:d,functionArgs:c,makeSerializable:l})=>{if(p){let u=p[d];return l(typeof u=="function"?p[d](...c):u,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:i},p=>{a(p.content)}))})},set(e,t,s){return n.send(new j(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),rn=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new We(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new De(o.refConfig,n,V(M({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let l=e.find(u=>u.id==p.id);if(l!==p){s.refs[o.refConfig.name]=l,i(l);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(u=>{let g=n.instance.resolvedNestedComponents.find(h=>h.type.id===u.componentDefinitionId).type,y=new We(g,p);y.setInitiated(),p.refs[u.refName]=y,e.push(y)});try{await an(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(u){a(u)}}))})},an=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==Se.component){if(t){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let l=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(g=>g.type.id===c);if(!l)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let u=Z.create("",i,o);try{let g=await rn(u,l,e);o.refs[i.name]=g,a()}catch(g){p(g)}}else try{let c=Z.create("",i,o);o.refs[i.name]=qs(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}}});var Re,pn=m(()=>{"use strict";Fe();b();Ne();I();Re=class extends N{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;r(this,"sizeMeta");r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:t})=>{let{height:s,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();t({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:s,width:i}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));r(this,"observeAutoSize",e=>{var Mn,In,Cn,xn,bn,wn,Sn;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(H,K,Me)=>K!==void 0&&H<K?K:Me!==void 0&&H>Me?Me:H,a=H=>{if(H===void 0)return;if(typeof H=="number")return H;let K=parseFloat(H);return isNaN(K)?void 0:K},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),l=a(e==null?void 0:e.maxHeight),u=(Mn=e==null?void 0:e.loaderMinHeight)!=null?Mn:50,g=((In=this.sizeMeta)==null?void 0:In.width)==="100%"?"100%":void 0,y=((Cn=this.sizeMeta)==null?void 0:Cn.height)==="100%"?"100%":void 0,h=(bn=(xn=e==null?void 0:e.explicitWidth)!=null?xn:g)!=null?bn:"100%",Q=(wn=e==null?void 0:e.explicitHeight)!=null?wn:y,qe=h!==void 0,he=Q!==void 0,J=this.container.getBoundingClientRect(),L=J.width===0,O=J.height===0||J.height===u,q=(e!=null&&e.forceAutoSize||L)&&!qe,X=(e!=null&&e.forceAutoSize||O)&&!he;if(!q&&!X){let H=typeof h=="number"?h:void 0,K=typeof Q=="number"?Q:void 0;return(H!==void 0||K!==void 0)&&((Sn=e==null?void 0:e.onSizeChange)==null||Sn.call(e,{width:H,height:K,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}let Pt=()=>{var K;let H=t.contentDocument;if(H){X&&(t.style.height="0px"),q&&(t.style.width="0px");let Me=Math.ceil(H.documentElement.scrollWidth),En=Math.ceil(H.documentElement.scrollHeight),Tn=i(Me,p,d),vn=i(En,c,l);q&&(t.style.width="".concat(Tn,"px")),X&&(t.style.height="".concat(vn,"px"));let ks=q&&d!==void 0&&Me>d,Hs=X&&l!==void 0&&En>l;H.documentElement.style.overflowX=ks?"auto":"",H.documentElement.style.overflowY=Hs?"auto":"",(K=e==null?void 0:e.onSizeChange)==null||K.call(e,{width:Tn,height:vn,autoSizingWidth:q,autoSizingHeight:X})}};Pt();let Ot=new ResizeObserver(Pt);Ot.observe(s.body),Ot.observe(s.documentElement);let hn=new MutationObserver(Pt);return hn.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{Ot.disconnect(),hn.disconnect()}});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});r(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});r(this,"send",e=>{var i,a;let t=M({},e);if(t.messageType===f.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.down;let s=super.send(t);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(t,"*"),s});r(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=ve(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===f.In.MutationObserverMessage||e.messageType===f.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var ee,Ze=m(()=>{"use strict";ee=class{constructor(){r(this,"appendChild",(n,e,t)=>{var s;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let i=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,i||null)}}else return n.appendChild(e)})}}});var Vs,et,lo=m(()=>{"use strict";pn();Ze();ie();w();Vs=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},et=class extends ee{constructor(){super(...arguments);r(this,"type",Y.IframeLoader);r(this,"load",async(e,t,s,i)=>{let a,p=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,s),a=s,a.src=p.url;else{let d=E(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let l="\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n height: ".concat(p.autoHeight||!p.height?"100%":p.height,";\\n width: 100%;\\n overflow: hidden;\\n border: none;\\n opacity: ").concat(i!=null&&i.hidden?"0":"1",";\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n ");a.style.cssText=l,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([g,y])=>{y===""||y===null||y===void 0?a.setAttribute(g,""):a.setAttribute(g,String(y))});let u=t.loader.url;i!=null&&i._hasParent&&(u=Vs(u,"_myop-comp",d)),a.src=u,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new Re(e,t,s,a,i)})}}});var tt,dn=m(()=>{"use strict";tt={webcomponent_message_key:"myop_webcomponent_message"}});var _e,cn=m(()=>{"use strict";dn();Fe();Ne();_e=class extends N{constructor(e,t,s,i,a){super(e,s,a);this.container=s;this.customElement=i;r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=M({},e),s=super.send(t),i=new CustomEvent(tt.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});r(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=ve(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}}});var mn,nt,fo=m(()=>{"use strict";cn();Ze();ie();w();mn={},nt=class extends ee{constructor(){super(...arguments);r(this,"type",Y.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;mn[a.url]?console.log("Module alreday loaded or in loading process"):mn[a.url]=new Promise((c,l)=>{let u=a.url,g=document.createElement("script");g.type="module",g.src=u,g.onload=()=>{c()},g.onerror=()=>{l()},document.head.appendChild(g)}),await mn[a.url],await Hn(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),i!=null&&i._environment&&(d._myopEnvironment=i==null?void 0:i._environment),this.appendChild(s,d,i),new _e(e,t,s,d,i)})}}});var T,U=m(()=>{"use strict";w();T=class extends Je{constructor(e,t){super(e);this.context=t;r(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(i,a)=>{this.messageToHost(V(M({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,s)}else debugger}else debugger})}}});var B,te=m(()=>{"use strict";B={id:"myop-id"}});var S,uo,P=m(()=>{"use strict";te();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),uo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var ot,go=m(()=>{"use strict";I();b();U();P();ot=class extends T{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{s(new ae(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var st,yo=m(()=>{"use strict";I();U();P();st=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var rt,ho=m(()=>{"use strict";w();rt=class extends Ee{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var it,Mo=m(()=>{"use strict";w();te();U();b();I();it=class extends T{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];s.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new be(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new le(e.handlerUniqueId,i))});r(this,"messageType",f.DetectMyopRefsMessage)}}});var at,Io=m(()=>{"use strict";I();U();P();at=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var pt,Co=m(()=>{"use strict";I();b();U();P();ge();pt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{s(new de(e.handlerUniqueId,A(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var dt,xo=m(()=>{"use strict";I();te();$e();Qe();U();dt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=$.Instance(),d=p.components.find(g=>g.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let l=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),u=[];Object.keys(l.refs).forEach(g=>{let y=l.refs[g];y=y.__nonProxied||y,y.componentDefinition&&u.push({refName:g,componentDefinitionId:y.componentDefinition.id})}),s(new G(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new G(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var ct,ln=m(()=>{"use strict";ge();ct=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=A,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)}});var mt,bo=m(()=>{"use strict";I();b();U();ln();mt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{ct(e,a=>{s(new pe(e.handlerUniqueId,a))},t)})}}});var wo,lt,So=m(()=>{"use strict";I();b();U();P();te();ge();wo=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:wo(i),required:i.required,validity:A(i.validity,!0),myopId:a};p?e.formData[p]?e.formData[p].value?e.unmappedData.push(d):(e.unmappedData.push(e.formData[p]),e.formData[p]=d):e.formData[p]=d:e.unmappedData.push(d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},lt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new ce(wo(a)),e)})})}}});var ft,Eo=m(()=>{"use strict";I();U();P();ft=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var To={};se(To,{WebComponentSDK:()=>ke});var ke,fn=m(()=>{"use strict";w();I();dn();go();yo();ho();Mo();re();b();Io();Co();xo();bo();So();Eo();ke=class extends we{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(tt.webcomponent_message_key,s=>{let i=s.data?s.data:s.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(s),a.messageType===f.InitMessage){let p=a.content.id;this.components[p].context=new rt(e,t)}}}),setTimeout(()=>{this.messageToHost(new me)},1)});r(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new st(this.messageToHost,this.components),new ft(this.messageToHost,this.components),new ot(this.messageToHost,this.components),new it(this.messageToHost,this.components),new at(this.messageToHost,this.components),new pt(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new lt(this.messageToHost,this.components),new dt(this.messageToHost,this.components)]);r(this,"init",()=>{})}};W("WebComponentSDK",ke)});var vo=m(()=>{"use strict";fn()});var Ro,_o=m(()=>{"use strict";Ro=""});function Ys(o,n){return class extends HTMLElement{connectedCallback(){let e=n===fe.open?"open":"closed",t=this.attachShadow({mode:e});Bo().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var js,Gs,Ho,Do,ut,Bo,Qs,Js,Xs,gt,Lo=m(()=>{"use strict";cn();sn();Ze();ie();w();vo();pn();_o();js="<!-- myop-web-component -->",Gs="myop-web-component",Ho=new Set,Do=[],Bo=async()=>(ut||(ut=new ke,ut.init()),ut);Qs=(o,n,e)=>{customElements.define(o,Ys(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Js=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Xs=o=>(o=Js(o),o.replace(/_/g,"-")),gt=class extends ee{constructor(){super(...arguments);r(this,"type",Y.HTMLLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,i);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===fe.localFrame){let c=E(),l="myop-comp-".concat(c),u=document.createElement("iframe");u.id=l,u.style.cssText="\\n display: block;\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n overflow: hidden;\\n border: none;\\n opacity: ".concat(i!=null&&i.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),u=this.appendChild(s,u,i);let g=u.contentDocument||u.contentWindow.document;g.open();let y=null;{let O=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(O)try{y=JSON.parse(O.getAttribute("content")||"{}")}catch(q){}}let h=a.HTML;if(i!=null&&i._inspection){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O==null||O.removeAttribute("type");let q=L.implementation.createHTMLDocument();q.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let X=q.body.firstChild;X&&L.head&&L.head.insertBefore(L.importNode(X,!0),L.head.firstChild),h=L.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O&&(O.remove(),h=L.documentElement.outerHTML)}g.writeln(h);let Q='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),qe="<script>\\n window.__federation__.__public_path__ = window.__federation__.__public_path__;\\n const __myop_init = async () => {\\n const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());\\n const sdk = new IframeSDK();\\n sdk.init();\\n }\\n __myop_init().then();\\n <\\/script>";if(g.writeln("".concat(Q).concat(qe)),(i==null?void 0:i.data)!==void 0){let J="<script>\\n window.__myop_cta_queue = [];\\n window.myop_cta_handler = function(action, payload) {\\n window.__myop_cta_queue.push({action: action, payload: payload});\\n };\\n <\\/script>",L=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),O='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(L,";\\n var scriptEl = document.getElementById('__myop_init_data_script');\\n\\n var callInitInterface = function(fn) {\\n var startTime = performance.now();\\n // Mark as pre-injected data call for extension tracking\\n window.__myop_init_preinjected = true;\\n try {\\n fn(data);\\n } finally {\\n window.__myop_init_preinjected = false;\\n }\\n var duration = performance.now() - startTime;\\n\\n // Notify extension via postMessage (init* = pre-injected)\\n try {\\n window.parent.postMessage({\\n type: 'MYOP_PREINJECTED_INIT',\\n payload: {\\n data: data,\\n duration: duration,\\n timestamp: Date.now()\\n }\\n }, '*');\\n } catch (e) {}\\n\\n // Cleanup: remove script tag and stored data\\n if (scriptEl && scriptEl.parentNode) {\\n scriptEl.parentNode.removeChild(scriptEl);\\n }\\n delete window.__myop_init_data;\\n };\\n\\n if (typeof window.myop_init_interface === 'function') {\\n // Function already exists - call immediately\\n callInitInterface(window.myop_init_interface);\\n } else {\\n // Function not yet defined - store data and watch for definition\\n window.__myop_init_data = data;\\n\\n var _original;\\n Object.defineProperty(window, 'myop_init_interface', {\\n configurable: true,\\n enumerable: true,\\n set: function(fn) {\\n _original = fn;\\n if (window.__myop_init_data !== undefined) {\\n var storedData = window.__myop_init_data;\\n delete window.__myop_init_data;\\n callInitInterface(fn);\\n }\\n },\\n get: function() {\\n return _original;\\n }\\n });\\n }\\n })();\\n <\\/script>");g.writeln(J+O)}g.close();let he=new Re(e,t,s,u,i);return he.sizeMeta=y,a.autoHeight&&(u.onload=()=>{he.observeSizeBasedOnDocumentElement()}),he}if(a.shadowRootMode===fe.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Bo().then(l=>{l.connectedCallback(d,d)})}else{let c=Xs(e.name+t.id);Do.includes(c)||(Qs(c,a.HTML,a.shadowRootMode),Do.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(s,d,i),new _e(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(js)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Gs);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(Ho.has(t)){console.log("[MyopWebComponent] Script already executed for ".concat(t,", skipping"));return}let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s),Ho.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,i,a){let p=this.extractWebComponentScript(i);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(l));let u="myop-comp-".concat(E()),g=document.createElement(l);g.id=u,a!=null&&a.hidden&&(g.style.opacity="0",g.style.position="absolute",g.style.height="0",g.style.width="0",g.style.pointerEvents="none",g.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,g,a);let y=new ye(e,t,s,g,l,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(l,"> into container")),y}}});var Po,Oo,Ao=m(()=>{"use strict";ie();b();Po=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new D(({rootRef:s,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let l in i){c+="".concat(l," { ");let u=i[l];for(let g in u)c+="".concat(g,": ").concat(u[g],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new D(({rootRef:s,_tagId:i})=>{let a=(s.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:t}))}},Oo=(o,n)=>{let e="myop-css-".concat(E());return o.send(new D(({rootRef:t,_tagId:s,_link:i})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new D(({rootRef:t,_tagId:s})=>{let i=(t.shadowRoot||document).getElementById(s);i&&i.remove()},()=>{},{_tagId:e}))}}});var Zs,un,Ko,zo=m(()=>{"use strict";Zs=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},un=(o,n)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=M({},o.loader),o.loader.url=Zs(o.loader.url,n),o},Ko=o=>async n=>un(n,o)});var Fo,$o,Wo=m(()=>{"use strict";b();Fo=(o,n,e)=>{o.send(new j(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},$o=(o,n,e)=>{o.send(new j(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var Mt,yt,It,ht,No=m(()=>{"use strict";ie();Mt=class Mt{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"id",this._runTimeId);r(this,"name",this._runTimeName);r(this,"description","");r(this,"loader",null);r(this,"withLoader",n=>(this.loader=n,this));r(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));r(this,"build",()=>this)}};r(Mt,"create",()=>new Mt);yt=Mt,It=class It{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});r(this,"name",this._runTimeName);r(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});r(this,"withInstance",n=>(this.instance=n,this));r(this,"withType",n=>(this.type=n,this));r(this,"withName",n=>(this.name=n,this));r(this,"withDefaultSkin",n=>(this.type.skins.push(n),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:n.id}},this));r(this,"withRef",n=>(this.type.refs.push(n),this));r(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});r(this,"build",()=>JSON.parse(JSON.stringify(this)))}};r(It,"create",()=>new It);ht=It});var er,Ct,tr,nr,ne,F,Uo,gn=m(()=>{"use strict";w();er=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Te.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Te.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),Ct="__MYOP_CLOUD_REPOSITORY_MAIN__",tr=()=>{if(typeof window<"u")return window[Ct];if(typeof globalThis<"u")return globalThis[Ct]},nr=o=>{typeof window<"u"&&(window[Ct]=o),typeof globalThis<"u"&&(globalThis[Ct]=o)},ne=class ne{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production");r(this,"_envExplicitlySet",!1)}static get Main(){let n=tr();return n||(ne._main||(ne._main=new ne,nr(ne._main)),ne._main)}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],i=e!==void 0||t!==void 0,a,p;if(!i&&s)a=s.env,p=s.preview;else{a=e||this._defaultEnv;let c=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!c}let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,l)=>{try{let u="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(u+="&preview=true");let h=(await(await fetch(u)).json()).item;if(!h){l(new Error('Component "'.concat(n,'" not found')));return}if(!h.consume_variant||!h.consume_variant.length){l(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let Q=er(h);c(Q)}catch(u){l(u)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};r(ne,"_main",null);F=ne,Uo=F});var qo,Vo=m(()=>{"use strict";qo=async o=>await o()});var oe,jo,Go,Yo,Qo,Jo,Xo,Zo,es,ts=m(()=>{"use strict";gn();oe=F.Main,jo=()=>oe,Go=(o,n,e)=>oe.isPreloaded(o,n,e),Yo=o=>oe.getPreloadedParams(o),Qo=()=>{oe=new F("http://localhost:9292")},Jo=o=>{oe=new F(o)},Xo=o=>{oe=o},Zo=o=>{oe.setEnvironment(o)},es=async(o,n,e)=>Promise.allSettled(o.map(t=>oe.fetchComponentV2(t,n,e)))});var yn={};se(yn,{CloudRepository:()=>F,ComponentConfig:()=>ht,SkinConfig:()=>yt,addClass:()=>Fo,applyStylesheet:()=>Po,applyStylesheetLink:()=>Oo,changeSkinUrlByTokenizer:()=>Ko,createIframeSkinByTokenizer:()=>un,enableLocalDev:()=>Qo,exec:()=>qo,getCloudRepository:()=>jo,getPreloadedParams:()=>Yo,isPreloaded:()=>Go,preloadComponents:()=>es,removeClass:()=>$o,setCloudRepository:()=>Xo,setCloudRepositoryUrl:()=>Jo,setEnvironment:()=>Zo,v2_CloudRepository:()=>Uo});var xt=m(()=>{"use strict";Ao();zo();Wo();No();gn();Vo();ts()});var ns,os=m(()=>{"use strict";Ft();xt();w();ns=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=zt(t);switch(s){case"component":{let[a,p]=i,d=await F.Main.fetchComponent(a);if(d&&d.type.skins.find(l=>l.id===p))return d.instance.skinSelector={type:ue.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=zt(t),c=(await F.Main.fetchFlow(a)).components.find(l=>l.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ue.Segmented&&c.instance.resolvedExperiences){let l=c.instance.resolvedExperiences.find(u=>u.id===p);if((l==null?void 0:l.type)===Xe.Segment){let u=l,y=c.instance.skinSelector.segments.find(h=>h.segmentId===u.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var is={};se(is,{HostSDK:()=>$,hostSDK:()=>rs});var ss,$,rs,$e=m(()=>{"use strict";re();I();b();lo();fo();Ne();w();Ye();Lo();os();ss="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",$=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"initiated",!1);r(this,"version",Ie);r(this,"type2InstanceCount",{});r(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));r(this,"inspected",!1);r(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});r(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==v.up&&n.data.messageType!==f.EnvelopedMessage)return;let e=n.data;if(e.messageType===f.InitRequest){this.components2init.forEach(s=>{s.send(new Ce(s.id))});return}if(e.messageType===f.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let s=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===f.EnvelopedMessage){let s=e,i=this.components.find(a=>a.id===s.destination);if(i){if(s.direction===v.down){s.message.messageType===z.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{let a=this.components.find(p=>p.id===s.message.destination);a&&a.send(s.message)}return}let t=this.components.find(s=>s.id===e.destination);if(!t){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(t){if(t.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});r(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});r(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new et,new nt,new gt];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let i=new s(this.componentsLoaders);t[i.type]=i}),this.componentsLoaders.forEach(s=>{t[s.type]||(t[s.type]=s)}),this.componentsLoaders=Object.values(t)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});r(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var i;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case ue.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case ue.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===Xe.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let u=c.segment,g=(t||{})[u.function];return g?await g():(console.warn("segmentId:".concat(d.segmentId,", ").concat(u.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});r(this,"runSkinSelector",async(n,e)=>{let t=await this._getSkinIdBySkinSelector(n.instance.skinSelector,n.instance.resolvedExperiences,e);return n.type.skins.find(s=>s.id===t)});r(this,"loaderHooks");r(this,"loadComponent",async(n,e,t)=>{var l,u,g,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await ns(n);s&&(n=s);let i=M(M({},(l=this.loaderHooks)!=null?l:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let h=await this.runSkinSelector(n,i);if(!h)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(h=await t.hooks.afterSkinSelected(M({},h))),n.instance.skinSelector={type:ue.Dedicated,skin:h},t&&(t=M({},t),delete t.hooks),await rn(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=t==null?void 0:t.hooks)!=null&&y.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(M({},p)));let d=this.componentsLoaders.find(h=>h.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(h=>h!==c),this.components2init=this.components2init.filter(h=>h!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=mo(c,n.type.props,p));try{await an(c,n,this.components)}catch(h){throw h}return t!=null&&t.skipInit||await c.initiated(),c});r(this,"navigate",async(n,e,t)=>{if(n.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(t!=null&&t.staged){let s=await this.loadComponent(e,n.container,M({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(s),s.show(),n.dispose(),s}else{let s=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,M({relative:{direction:"before",child:s}},t))}})}};r($,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:ss});if(!window.myop.hostSDK){let o=new $;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:ss}),window.myop.hostSDK=o}rs=window.myop.hostSDK;W("hostSDK",rs)});var bt,as=m(()=>{"use strict";I();te();w();b();bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(B.id,"]")),s=[];t.forEach(i=>{let a=i.getAttribute(B.id);a&&s.push(new be(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new le(e.handlerUniqueId,s))})}}});var wt,ps=m(()=>{"use strict";I();w();b();P();wt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new ae,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}}});var St,ds=m(()=>{"use strict";I();w();P();St=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var Et,cs=m(()=>{"use strict";I();b();w();ln();Et=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"executor",e=>{ct(e,s=>{this.messageToHost(new pe(e.handlerUniqueId,s))},new Ee(document.documentElement))})}}});var Tt,ms=m(()=>{"use strict";I();w();b();ge();P();Tt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new de(e.handlerUniqueId,A(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}}});var vt,ls=m(()=>{"use strict";I();w();P();vt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var Rt,fs=m(()=>{"use strict";I();te();w();$e();Qe();Rt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await $.Instance().loadComponent(e.nestedComponentConfig,s.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new G(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new G(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var us,gs=m(()=>{"use strict";us=(o,n)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let t=new e(n),s={attributes:!0,childList:!0,subtree:!0};return t.observe(o,s),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))}});var _t,ys=m(()=>{"use strict";I();b();w();gs();_t=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&us(document.body,()=>{this.messageToHost(new Pe)})})}}});var hs,kt,Ms=m(()=>{"use strict";I();te();w();b();ge();P();hs=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:hs(i),required:i.required,validity:A(i.validity,!0),myopId:a};e.unmappedData.push(d),p&&(!e.formData[p]||!e.formData[p].value||d.value)&&(e.formData[p]=d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},kt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new ce(hs(s)),e)})})}}});var Ht,Is=m(()=>{"use strict";I();w();b();P();Ht=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetAttributeMessage);r(this,"executor",e=>{let t=uo(e.ref,document);t&&this.messageToHost(new Le(t.getAttribute(e.name)),e)})}}});var Dt,Cs=m(()=>{"use strict";b();I();w();Dt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new ze)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Bt,xs=m(()=>{"use strict";I();w();P();Bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var bs={};se(bs,{IframeSDK:()=>Lt});var Lt,ws=m(()=>{"use strict";w();as();ps();ds();cs();re();ms();ls();b();fs();ys();Ms();Ye();Is();Cs();xs();Lt=class extends we{constructor(){super();r(this,"version",Ie);r(this,"messageToHost",(e,t)=>{var i;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let s=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=s[0]),e.source||(e.source=s[0]),e.direction=v.up,(i=window.parent)==null||i.postMessage(M({},e),"*")});r(this,"supportedHandlers",[new St(this.messageToHost),new Bt(this.messageToHost),new wt(this.messageToHost),new bt(this.messageToHost),new Et(this.messageToHost),new Tt(this.messageToHost),new vt(this.messageToHost),new kt(this.messageToHost),new _t(this.messageToHost),new Dt(this.messageToHost),new Ht(this.messageToHost),new Rt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new me)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};W("IframeSDK",Lt)});var sr={};var or,Ss=m(()=>{"use strict";b();re();or=M({},xe);W("MyopMessages",or)});var Es={};se(Es,{CloudRepository:()=>F,ComponentConfig:()=>ht,SkinConfig:()=>yt,addClass:()=>Fo,applyStylesheet:()=>Po,applyStylesheetLink:()=>Oo,changeSkinUrlByTokenizer:()=>Ko,createIframeSkinByTokenizer:()=>un,enableLocalDev:()=>Qo,exec:()=>qo,getCloudRepository:()=>jo,getPreloadedParams:()=>Yo,isPreloaded:()=>Go,preloadComponents:()=>es,removeClass:()=>$o,setCloudRepository:()=>Xo,setCloudRepositoryUrl:()=>Jo,setEnvironment:()=>Zo,v2_CloudRepository:()=>Uo});var Ts=m(()=>{"use strict";re();xt();xt();W("MyopHelpers",yn)});var dr={};se(dr,{getHostModule:()=>vs,getIframeModule:()=>Rs,getWebcomponentModule:()=>_s});re();var kn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(kn=document.currentScript)==null?void 0:kn.src,n=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:n,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,n,e)=>{if(window.__federation__[n])console.log("__federation__ module ".concat(n," already loaded.")),e(window.__federation__[n][Kt]);else{let t;window.__federation__[n]={},window.__federation__[n][Ge]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Kt]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Ye();console.log("myop root sdk - loaded",document.location.origin);var rr="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",vs=()=>Promise.resolve().then(()=>($e(),is)),Rs=()=>Promise.resolve().then(()=>(ws(),bs)),_s=()=>Promise.resolve().then(()=>(fn(),To)),ir=()=>Promise.resolve().then(()=>(Ss(),sr)),ar=()=>Promise.resolve().then(()=>(Ts(),Es)),Ue=o=>async()=>(await o()).get(),pr={version:Ie,getHostModule:Ue(vs),getIframeModule:Ue(Rs),getWebcomponentModule:Ue(_s),getMyopMessages:Ue(ir),getMyopHelpers:Ue(ar)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:rr});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:pr},window.myop);return Ks(dr);})();
|
|
1
|
+
import { jsx as L, jsxs as tn } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as N, useEffect as he, useState as se, useCallback as et } from "react";
|
|
3
|
+
const nn = `"use strict";var MyopSDK=(()=>{var Ye=Object.defineProperty,Ys=Object.defineProperties,Qs=Object.getOwnPropertyDescriptor,Js=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertyNames,zn=Object.getOwnPropertySymbols;var $n=Object.prototype.hasOwnProperty,Zs=Object.prototype.propertyIsEnumerable;var Nt=(o,n,e)=>n in o?Ye(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))$n.call(n,e)&&Nt(o,e,n[e]);if(zn)for(var e of zn(n))Zs.call(n,e)&&Nt(o,e,n[e]);return o},V=(o,n)=>Ys(o,Js(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var se=(o,n)=>{for(var e in n)Ye(o,e,{get:n[e],enumerable:!0})},ei=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Xs(n))!$n.call(o,s)&&s!==e&&Ye(o,s,{get:()=>n[s],enumerable:!(t=Qs(n,s))||t.enumerable});return o};var ti=o=>ei(Ye({},"__esModule",{value:!0}),o);var i=(o,n,e)=>Nt(o,typeof n!="symbol"?n+"":n,e);var Qe,Je,Ut,F,ie=m(()=>{"use strict";Qe="__federation__",Je="onLoad",Ut="moduleInstance",F=(o,n)=>{window[Qe]&&window[Qe][o]&&window[Qe][o][Je]&&window[Qe][o][Je]({[o]:n})}});var Ce,Xe=m(()=>{Ce="0.3.22"});var u,C=m(()=>{"use strict";u={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}}});var E,ni,oi,qt,Vt=m(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),ni=o=>{let n=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-")},oi=o=>{let n=o.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";let e=atob(n);return Uint8Array.from(e,t=>t.charCodeAt(0))},qt=o=>{let n=oi(o);if(n.length%16!==0)throw new Error("Invalid input length");let e=[];for(let t=0;t<n.length;t+=16)e.push(ni(n.slice(t,t+16)));return e}});var Fn,re=m(()=>{"use strict";Vt();Fn=o=>new Promise(n=>setTimeout(n,o))});var v,I,Gt,_,R,J,H=m(()=>{"use strict";re();v=class{};i(v,"down","down"),i(v,"up","up");I=class{constructor(){i(this,"id",E());i(this,"myop",!0);i(this,"content");i(this,"source");i(this,"destination");i(this,"route");i(this,"ref");i(this,"direction");i(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},Gt=class extends I{constructor(e){super();this.ref=e}},_=class extends I{constructor(e){super();this.replayToHandler=e}},R=class extends I{constructor(e){super();this.handler=e;i(this,"handlerUniqueId",E())}},J=class o{constructor(n,e){this.refConfig=n;this.component=e;i(this,"myop",!0);i(this,"__nonProxied");this.__nonProxied=V(M({},this),{component:null})}static create(n,e,t){let s=e;return s||(s={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(s,t)}}});var Nn,jt,ae,Un=m(()=>{"use strict";H();Nn="ClickReplayMessage",jt=class extends R{constructor(e,t){super(t);this.ref=e;i(this,"replyMessageKey",Nn);i(this,"messageType","BindClickMessage");i(this,"cleanable",!0)}},ae=class extends _{constructor(){super(...arguments);i(this,"messageType",Nn)}}});var Yt,qn=m(()=>{"use strict";H();Yt=class extends I{constructor(e,t){super();this.ref=e;i(this,"messageType","ChangeTextMessage");this.content=t}}});var Vn,si,ii,Gn,k,pe,Qt=m(()=>{"use strict";H();Vn="ExecuteScriptReplyMessage",si=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,ii=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Gn=o=>{let n=o.match(si);if(n)return n[1]||n[3];{let e=o.match(ii);if(e)return e[1].trim()}},k=class extends R{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;i(this,"replyMessageKey",Vn);i(this,"messageType","ExecuteScriptMessage");i(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Gn(this.content)}};i(k,"replierKey","send"),i(k,"completeStreamKey","completeStream");pe=class extends _{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;i(this,"messageType",Vn)}}});var G,jn=m(()=>{"use strict";Qt();G=class extends k{constructor(e,t,s=()=>{}){super(({rootRef:r,elementId:a,_script:p,__scriptInputs:d})=>{let c=(r.shadowRoot||r.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=V(M({},t),{_script:e.toString()})}}});var Yn,Jt,de,Qn=m(()=>{"use strict";H();Yn="EventListenerCallbackMessage",Jt=class extends R{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;i(this,"replyMessageKey",Yn);i(this,"messageType","AddEventListenerMessage");i(this,"cleanable",!0);i(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},de=class extends _{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;i(this,"messageType",Yn);this.content={e:t}}}});var Xt,Jn=m(()=>{"use strict";H();Xt=class extends I{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;i(this,"messageType","SetAttributeMessage")}}});var Xn,Zt,ce,en=m(()=>{"use strict";H();Xn="ElementValueReplayMessage",Zt=class extends R{constructor(e,t){super(t);this.ref=e;i(this,"replyMessageKey",Xn);i(this,"messageType","GetElementValueMessage")}},ce=class extends _{constructor(e){super();this.content=e;i(this,"messageType",Xn)}}});var tn,Zn=m(()=>{"use strict";H();tn=class extends I{constructor(e,t){super();this.ref=e;i(this,"messageType","SetInnerHtml");this.content=t}}});var Ie,Be,me,eo=m(()=>{"use strict";H();Ie=class extends I{constructor(e){super();i(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Be=class extends Ie{constructor(){super(...arguments);i(this,"messageType","InitResponse")}},me=class extends I{constructor(){super(...arguments);i(this,"messageType","InitRequest")}}});var to,Le,j,Ze=m(()=>{"use strict";H();to="RefComponentCreatedMessage",Le=class extends R{constructor(e,t,s,r){super(r);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;i(this,"replyMessageKey",to);i(this,"messageType","CreateRefComponentMessage")}},j=class extends _{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;i(this,"messageType",to)}}});var Pe,nn=m(()=>{"use strict";H();Pe=class extends I{constructor(e,t){super();this.destination=e;this.message=t;i(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var no,on,le,oo=m(()=>{"use strict";H();no="DetectedMyopRefsMessage",on=class extends R{constructor(){super(...arguments);i(this,"messageType","DetectMyopRefsMessage");i(this,"replyMessageKey",no)}},le=class extends _{constructor(e,t){super(e);this.replayToHandler=e;i(this,"messageType",no);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var so,sn,Oe,io=m(()=>{"use strict";H();so="GetAttributeReplayMessage",sn=class extends R{constructor(e,t,s){super(s);this.ref=e;this.name=t;i(this,"replyMessageKey",so);i(this,"messageType","GetAttributeMessage")}},Oe=class extends _{constructor(e){super();this.content=e;i(this,"messageType",so)}}});var A,ro=m(()=>{"use strict";H();A=class extends I{constructor(e){super();this.method=e;i(this,"messageType","ExecuteComponentMethod")}}});var rn,Ae,ao=m(()=>{"use strict";H();rn=class extends I{constructor(){super(...arguments);i(this,"messageType","SetMutationObserverMessage")}},Ae=class extends I{constructor(){super(...arguments);i(this,"messageType","MutationObserverMessage")}}});var po,Ke,ze,co=m(()=>{"use strict";H();po="CleanupReplayMessage",Ke=class extends R{constructor(e,t){super(t);this.cleanupForMessageId=e;i(this,"replyMessageKey",po);i(this,"messageType","CleanupMessage")}},ze=class extends _{constructor(e){super();this.customCleanup=e;i(this,"messageType",po)}}});var $e,mo=m(()=>{"use strict";H();$e=class extends I{constructor(){super(...arguments);i(this,"messageType","DisposeMessage")}}});var an,We,lo=m(()=>{"use strict";H();an=class extends I{constructor(){super(...arguments);i(this,"cleanable",!0);i(this,"messageType","SetResizeObserverMessage")}},We=class extends I{constructor(){super(...arguments);i(this,"messageType","ResizeObserverMessage")}}});var xe={};se(xe,{AddEventListenerMessage:()=>Jt,BaseMyopMessage:()=>I,BindClickMessage:()=>jt,ChangeTextMessage:()=>Yt,CleanupMessage:()=>Ke,CleanupReplayMessage:()=>ze,ClickReplayMessage:()=>ae,CreateRefComponentMessage:()=>Le,CustomRefMessage:()=>G,DetectMyopRefsMessage:()=>on,DetectedMyopRefsMessage:()=>le,DisposeMessage:()=>$e,ElementValueReplayMessage:()=>ce,EnvelopedMessage:()=>Pe,EventListenerCallbackMessage:()=>de,ExecuteComponentMethod:()=>A,ExecuteScriptMessage:()=>k,ExecuteScriptReplyMessage:()=>pe,GetAttributeMessage:()=>sn,GetAttributeReplayMessage:()=>Oe,GetElementValueMessage:()=>Zt,InitMessage:()=>Ie,InitRequest:()=>me,InitResponse:()=>Be,MessageDirection:()=>v,MutationObserverMessage:()=>Ae,MyopBindMessage:()=>R,MyopBindReplayMessage:()=>_,MyopElementMessage:()=>Gt,Ref:()=>J,RefComponentCreatedMessage:()=>j,ResizeObserverMessage:()=>We,SetAttributeMessage:()=>Xt,SetInnerHtml:()=>tn,SetMutationObserverMessage:()=>rn,SetResizeObserverMessage:()=>an,stripFunction:()=>Gn});var b=m(()=>{"use strict";H();Un();qn();Qt();jn();Qn();Jn();en();Zn();eo();Ze();nn();oo();en();io();ro();ao();co();mo();lo()});var N,Fe=m(()=>{"use strict";C();b();Ne();N=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;i(this,"id","");i(this,"messageHandlers",{});i(this,"element");i(this,"_markedForDisposed",!1);i(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});i(this,"bindWhen",(n,e,t)=>{if(!t)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[n]||(this.messageHandlers[n]=[]);let s=this.messageHandlers[n],r=a=>e(a)?(t(a),!0):!1;return s.push(r),()=>{let a=s.indexOf(r);a>-1&&s.splice(a,1)}});i(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});i(this,"isInitiated",!1);i(this,"_whenInitiatedResolve");i(this,"_whenInitiatedReject");i(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));i(this,"initiated",()=>this._whenInitiated);i(this,"props",{});i(this,"refs",{});this.id=(t==null?void 0:t.id)||z.Instance().assignId(n);let s=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(s," ").concat(this.id))},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(n){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=n}onMessageReceived(n){if(n.messageType===u.ExecuteComponentMethod){let t=n;return this[t.method]?this[t.method](t.content):console.log("method not found ".concat(t.method," on component"),this),!0}let e=this.messageHandlers[n.messageType];if(e&&e.length){let t=!1;return e.forEach(s=>{t=t||s(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=v.down;let e=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,s=>{n.handler(s),e()}),t=n.handler;delete n.handler,this.send(n),n.handler=t}send(n){n.source||(n.source=this.id),n.destination||(n.destination=this.id),n.direction=v.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,s=>s.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new Ke(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new $e);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var be,fo=m(()=>{"use strict";be=class{constructor(n,e,t,s,r){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=r;i(this,"type","MyopElementRef")}}});var uo,x,et,go=m(()=>{"use strict";uo=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},x=class{constructor(n){this.messageToHost=n}},et=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var pn,we,yo=m(()=>{"use strict";C();w();b();pn=class{constructor(n,e){this.id=n;this.context=e;i(this,"send",n=>{})}},we=class{constructor(){i(this,"messageToHandleAfterInit",[]);i(this,"components",{});i(this,"alwaysPassEnvelopesToHost",!1);i(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==v.down)return;if(t.messageType===u.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===u.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new pn(s),this.messageToHost(new Be(s));return}if(t.messageType===u.EnvelopedMessage){let s=t,r=s.message;if(t=r,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===r.destination);if(a){a.send(r);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(r);return}}else return}if(t.messageType){if(t.messageType===u.CleanupMessage){let r=t,a=this.messageCleanupCache[r.cleanupForMessageId],p=new ze(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[r.cleanupForMessageId],uo(a).then(()=>{this.messageToHost(p,r)}).catch(()=>{})):this.messageToHost(p,r);return}let s=!1;this.supportedHandlers.forEach(r=>{if(r.messageType===t.messageType){s=!0;let a=r.executor(t);if(t.cleanable&&a&&(this.messageCleanupCache[t.id]=a),a&&!t.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(r.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&t.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(r.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}}});var Y,fe,Te,Se,ue,tt,Ee,w=m(()=>{"use strict";fo();go();yo();Y={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},fe={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},Te={message:"message",code:"code"},Se=class{};i(Se,"code","code"),i(Se,"component","component");ue={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},tt={Segment:"Segment",Promo:"Promo",AB:"AB"},Ee=class{constructor(n,e){this.container=n;this.shadowRoot=e;i(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));i(this,"getRoot",()=>this.shadowRoot||this.container)}}});var dn,ri,cn,O,ge=m(()=>{"use strict";dn=o=>o!==Object(o),ri=o=>typeof o=="function",cn=o=>{if(dn(o))return!0;if(ri(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!cn(e))return!1}else{if(dn(e))continue;return!1}}return!0},O=(o,n={},e=!0,t=new WeakMap)=>{if(dn(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let r=0;r<o.length;r++){let a=o[r];s[r]=O(a,n,e,t)}return s}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let s={};t.set(o,s);for(let r in o){let a=typeof n=="boolean"?n:n[r];a&&(a===!0?(e?o[r]!==void 0:o[r])&&(s[r]=O(o[r],!0,e,t)):typeof a=="object"&&(s[r]=O(o[r],a,e,t)))}return s}return{}}});var ho,Mo=m(()=>{"use strict";ho={notSerializableRefCall:(o,n)=>{throw new Error("\\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \\nThe following types of data are considered non-serializable and cannot be processed:\\n\\n- Functions\\n- DOM elements\\n- Class instances\\n- Circular references\\n- Symbols\\n- BigInt values\\n\\nIn the following execution we detected :\\n~~~~~~~~\\n").concat(n," \\n~~~~~~~~\\nas not serializable.\\n\\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \\nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\\n\\nSuggested Fix:\\n1. Remove or replace non-serializable values from your input.\\n2. If using objects, ensure they do not contain any functions or circular references.\\n3. Convert any class instances to plain objects or JSON-compatible formats.\\n4. Use dedicated Myop message.\\n\\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\\n\\n"))}}});var Ue,Co=m(()=>{"use strict";Fe();b();nn();Ue=class extends N{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;i(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new Pe(this.id,e)),e.handler=t,s});i(this,"dispose",()=>{this.isInitiated&&this.send(new A("dispose")),super.dispose()})}hide(){this.send(new A("hide"))}show(){this.send(new A("show"))}inspect(){return this.send(new A("inspect"))}setHeightBasedOnDocumentElement(){this.send(new A("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new A("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var ye,mn=m(()=>{"use strict";Fe();qe();ye=class extends N{constructor(e,t,s,r,a,p){super(e,s,p);this.container=s;this.customElement=r;this.tagName=a;i(this,"ctaCleanup");i(this,"_ctaHandler");i(this,"_ctaQueue",[]);i(this,"cleanupInspect",()=>{});i(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});i(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=r,this.setInitiated()}inspect(){return this.cleanupInspect=ve(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){let s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(r=>{this.markedForDisposed||e(r.action,r.payload)})}let t=s=>{var a;let r=s;(a=r.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(r.detail.action,r.detail.payload):this._ctaHandler||this._ctaQueue.push({action:r.detail.action,payload:r.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var ai,ve,Io,xo,bo,pi,ln,fn,qe=m(()=>{"use strict";b();b();w();ge();Mo();Co();mn();ai=(o,n,e)=>{let t=document.createElement("a");return t.textContent=o,t.style.position="relative",t.style.padding="0 5px",t.style.fontSize="14px",t.style.top="0",t.style.top="".concat(n,"px"),t.style.transform="translateX(-50%)",t.target="_blank",t.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),t},ve=(o,n,e,t,s,r)=>{let a=ai("".concat(r.name," : ").concat(n),e,r);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},Io=(o,n,e)=>o?!1:(console.error("Error: Undefined Prop\\n\\nIt looks like you've tried to use a prop that hasn't been defined.\\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),xo=(o,n,e)=>{console.error("Error: Code Prop Not Supported\\n\\nCurrently, code props are only supported in local frame components.\\n\\u26A0\\uFE0F This is a work in progress feature \\u2014 code props will be supported in upcoming versions.\\n\\nIn the meantime, you can use message props.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},bo=(o,n,e)=>{let t=n.reduce((r,a)=>V(M({},r),{[a.name]:M({},a)}),{}),s={get:(r,a)=>{let p=t[a];if(Io(p,a,o))return!1;if(p.behavior.type===Te.code){if(o instanceof ye)return(p.behavior.remap||a)==="myop_init_interface"?f=>{if(f===void 0)return o.getData();o.initWithData(f)}:void 0;if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return xo(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(J.create(p.behavior.ref)),c.push(g=>{d(g)}),p.behavior.params&&c.push(...p.behavior.params);let f=xe[p.behavior.message];o.send(new f(...c))}):null},set:(r,a,p)=>{let d=t[a];if(Io(d,a,o))return!1;if(d.behavior.type===Te.code){if(o instanceof ye){let f=d.behavior.remap||a;if(f==="myop_cta_handler")return o.setCtaHandler(p),!0;if(f==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===Y.HTMLLoader&&e.loader.shadowRootMode===fe.localFrame){let f=d.behavior,g=o.element.contentWindow,h=f.remap||a;if(g[h]=p,h==="myop_cta_handler"&&g.__myop_cta_queue){let y=g.__myop_cta_queue;g.__myop_cta_queue=null,y.forEach(l=>{o.markedForDisposed||p(l.action,l.payload)})}return!0}return xo(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(J.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let f=xe[d.behavior.message];return o.send(new f(...c)),!0}else throw new Error("Error: Unsupported Behavior\\n\\nThe 'behavior' field provided is not supported.\\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\\n\\n")+"Prop Name: ".concat(a,"\\n")+"Behavior Field: ".concat(d.behavior.type,"\\n\\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,s),o},pi=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...r)=>new Promise(a=>{r.forEach(p=>{cn(p)||ho.notSerializableRefCall(t,p)}),n.send(new G(({ref:p,propName:d,functionArgs:c,makeSerializable:f})=>{if(p){let g=p[d];return f(typeof g=="function"?p[d](...c):g,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:r},p=>{a(p.content)}))})},set(e,t,s){return n.send(new G(({ref:r,propName:a,propValue:p})=>{r&&(r[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},r=>{})),!0}}),ln=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(r,a)=>{let p=new Ue(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new Le(o.refConfig,n,V(M({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let f=e.find(g=>g.id==p.id);if(f!==p){s.refs[o.refConfig.name]=f,r(f);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(g=>{let h=n.instance.resolvedNestedComponents.find(l=>l.type.id===g.componentDefinitionId).type,y=new Ue(h,p);y.setInitiated(),p.refs[g.refName]=y,e.push(y)});try{await fn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),r(p)}catch(g){a(g)}}))})},fn=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(r=>new Promise(async(a,p)=>{var d;if(r.behavior.type==Se.component){if(t){a();return}let c=r.behavior.componentId;c||(c=r.behavior.instance.componentId);let f=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(h=>h.type.id===c);if(!f)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let g=J.create("",r,o);try{let h=await ln(g,f,e);o.refs[r.name]=h,a()}catch(h){p(h)}}else try{let c=J.create("",r,o);o.refs[r.name]=pi(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(r){throw r}}});var _e,un=m(()=>{"use strict";Fe();b();qe();C();_e=class extends N{constructor(e,t,s,r,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=r;i(this,"_autoSizeCleanup");i(this,"_autoSizeOptions");i(this,"_autoSizeUpdate");i(this,"sizeMeta");i(this,"cleanupInspect");i(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new k(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});i(this,"observeSizeBasedOnDocumentElement",()=>this.send(new k(({send:t})=>{let{height:s,width:r}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();t({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:s,width:r}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));i(this,"observeAutoSize",e=>{if(this._autoSizeOptions=e,this._autoSizeCleanup&&this._autoSizeUpdate)return this._autoSizeUpdate(),this._autoSizeCleanup;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let r=(y,l,$)=>l!==void 0&&y<l?l:$!==void 0&&y>$?$:y,a=y=>{if(y===void 0)return;if(typeof y=="number")return y;let l=parseFloat(y);return isNaN(l)?void 0:l},p=()=>{var kn,Dn,Bn,Ln,Pn,On,An,Kn;let y=t.contentDocument;if(!y)return;let l=this._autoSizeOptions,$=a(l==null?void 0:l.minWidth),ke=a(l==null?void 0:l.maxWidth),ne=a(l==null?void 0:l.minHeight),Q=a(l==null?void 0:l.maxHeight),B=(kn=l==null?void 0:l.loaderMinHeight)!=null?kn:50,P=((Dn=this.sizeMeta)==null?void 0:Dn.width)==="100%"?"100%":void 0,De=((Bn=this.sizeMeta)==null?void 0:Bn.height)==="100%"?"100%":void 0,W=(Pn=(Ln=l==null?void 0:l.explicitWidth)!=null?Ln:P)!=null?Pn:"100%",oe=(On=l==null?void 0:l.explicitHeight)!=null?On:De,wn=W!==void 0,Sn=oe!==void 0,Kt=this.container.getBoundingClientRect(),Ws=Kt.width===0,Fs=Kt.height===0||Kt.height===B,he=(l!=null&&l.forceAutoSize||Ws)&&!wn,Me=(l!=null&&l.forceAutoSize||Fs)&&!Sn;if(!he&&!Me){t.style.width=typeof W=="number"?"".concat(W,"px"):"100%",t.style.height=typeof oe=="number"?"".concat(oe,"px"):"100%";let Ge=typeof W=="number"?W:void 0,je=typeof oe=="number"?oe:void 0;(Ge!==void 0||je!==void 0)&&((An=l==null?void 0:l.onSizeChange)==null||An.call(l,{width:Ge,height:je,autoSizingWidth:!1,autoSizingHeight:!1}));return}let Ns=t.style.transition,q=this.container,Us=q.style.transition;t.style.transition="none",q.style.transition="none";let En=t.getBoundingClientRect().height,Tn=t.getBoundingClientRect().width,vn=Math.ceil(Math.max(y.documentElement.scrollHeight,y.body.scrollHeight)),_n=Math.ceil(Math.max(y.documentElement.scrollWidth,y.body.scrollWidth)),zt=_n,$t=vn,qs=Me&&vn>En+1,Vs=he&&_n>Tn+1,Wt=Me&&!qs,Ft=he&&!Vs;if(Wt||Ft){let Ge=q.style.minHeight,je=q.style.minWidth;Wt&&(q.style.minHeight="".concat(En,"px")),Ft&&(q.style.minWidth="".concat(Tn,"px")),Wt&&(t.style.height="0px"),Ft&&(t.style.width="0px"),zt=Math.ceil(Math.max(y.documentElement.scrollWidth,y.body.scrollWidth)),$t=Math.ceil(Math.max(y.documentElement.scrollHeight,y.body.scrollHeight)),q.style.minHeight=Ge,q.style.minWidth=je}let Rn=r(zt,$,ke),Hn=r($t,ne,Q);he?t.style.width="".concat(Rn,"px"):t.style.width=typeof W=="number"?"".concat(W,"px"):"100%",Me?t.style.height="".concat(Hn,"px"):t.style.height=typeof oe=="number"?"".concat(oe,"px"):"100%",t.offsetHeight,t.style.transition=Ns,q.style.transition=Us;let Gs=he&&ke!==void 0&&zt>ke,js=Me&&Q!==void 0&&$t>Q;y.documentElement.style.overflowX=Gs?"auto":"",y.documentElement.style.overflowY=js?"auto":"",(Kn=l==null?void 0:l.onSizeChange)==null||Kn.call(l,{width:Rn,height:Hn,autoSizingWidth:he,autoSizingHeight:Me})};p(),this._autoSizeUpdate=p;let d,c=()=>{d===void 0&&(d=requestAnimationFrame(()=>{d=void 0,p()}))},f=new ResizeObserver(()=>c());f.observe(s.body),f.observe(s.documentElement);let g=new MutationObserver(()=>c());g.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let h=()=>{f.disconnect(),g.disconnect(),d!==void 0&&(cancelAnimationFrame(d),d=void 0),this._autoSizeUpdate=void 0,this._autoSizeCleanup=void 0};return this._autoSizeCleanup=h,h});i(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new k(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});i(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new k(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});i(this,"send",e=>{var r,a;let t=M({},e);if(t.messageType===u.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.down;let s=super.send(t);return(a=(r=this.IframeElement)==null?void 0:r.contentWindow)==null||a.postMessage(t,"*"),s});i(this,"dispose",()=>{this._autoSizeCleanup&&(this._autoSizeCleanup(),this._autoSizeCleanup=void 0),this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=ve(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===u.In.MutationObserverMessage||e.messageType===u.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var X,nt=m(()=>{"use strict";X=class{constructor(){i(this,"appendChild",(n,e,t)=>{var s;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let r=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,r||null)}}else return n.appendChild(e)})}}});var di,ot,wo=m(()=>{"use strict";un();nt();re();w();di=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},ot=class extends X{constructor(){super(...arguments);i(this,"type",Y.IframeLoader);i(this,"load",async(e,t,s,r)=>{let a,p=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,s),a=s,a.src=p.url;else{let d=E(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let f="\\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(r!=null&&r.hidden?"0":"1",";\\n pointer-events: ").concat(r!=null&&r.hidden?"none":"all",";\\n ");a.style.cssText=f,r!=null&&r.elementAttributes&&Object.entries(r.elementAttributes).forEach(([h,y])=>{y===""||y===null||y===void 0?a.setAttribute(h,""):a.setAttribute(h,String(y))});let g=t.loader.url;r!=null&&r._hasParent&&(g=di(g,"_myop-comp",d)),a.src=g,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,r)}return new _e(e,t,s,a,r)})}}});var st,gn=m(()=>{"use strict";st={webcomponent_message_key:"myop_webcomponent_message"}});var Re,yn=m(()=>{"use strict";gn();Fe();qe();Re=class extends N{constructor(e,t,s,r,a){super(e,s,a);this.container=s;this.customElement=r;i(this,"cleanupInspect",()=>{});i(this,"send",e=>{let t=M({},e),s=super.send(t),r=new CustomEvent(st.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(r)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});i(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=r}inspect(){return this.cleanupInspect=ve(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}}});var hn,it,So=m(()=>{"use strict";yn();nt();re();w();hn={},it=class extends X{constructor(){super(...arguments);i(this,"type",Y.WebComponentLoader);i(this,"load",async(e,t,s,r)=>{let a=t.loader;hn[a.url]?console.log("Module alreday loaded or in loading process"):hn[a.url]=new Promise((c,f)=>{let g=a.url,h=document.createElement("script");h.type="module",h.src=g,h.onload=()=>{c()},h.onerror=()=>{f()},document.head.appendChild(h)}),await hn[a.url],await Fn(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,r!=null&&r.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"),r!=null&&r._environment&&(d._myopEnvironment=r==null?void 0:r._environment),this.appendChild(s,d,r),new Re(e,t,s,d,r)})}}});var T,U=m(()=>{"use strict";w();T=class extends et{constructor(e,t){super(e);this.context=t;i(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(r,a)=>{this.messageToHost(V(M({},r),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,s)}else debugger}else debugger})}}});var D,Z=m(()=>{"use strict";D={id:"myop-id"}});var S,Eo,L=m(()=>{"use strict";Z();S=(o,n)=>n.querySelectorAll("[".concat(D.id,"='").concat(o.refConfig.selector,"']")),Eo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var rt,To=m(()=>{"use strict";C();b();U();L();rt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.BindClickMessage);i(this,"innerExecutor",(e,t,s)=>{let r=S(e.ref,t.shadowRoot),a=[];return r.forEach(p=>{let d=()=>{s(new ae(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var at,vo=m(()=>{"use strict";C();U();L();at=class extends T{constructor(){super(...arguments);i(this,"messageType",u.ChangeTextMessage);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.textContent=e.content})})}}});var pt,_o=m(()=>{"use strict";w();pt=class extends Ee{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var dt,Ro=m(()=>{"use strict";w();Z();U();b();C();dt=class extends T{constructor(){super(...arguments);i(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(D.id,"]")),r=[];s.forEach(a=>{let p=a.getAttribute(D.id);p&&r.push(new be(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new le(e.handlerUniqueId,r))});i(this,"messageType",u.DetectMyopRefsMessage)}}});var ct,Ho=m(()=>{"use strict";C();U();L();ct=class extends T{constructor(){super(...arguments);i(this,"messageType",u.SetAttributeMessage);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var mt,ko=m(()=>{"use strict";C();b();U();L();ge();mt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.AddEventListenerMessage);i(this,"innerExecutor",(e,t,s)=>{let r=S(e.ref,t.shadowRoot),a=[];return r.forEach(p=>{let d=c=>{s(new de(e.handlerUniqueId,O(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var lt,Do=m(()=>{"use strict";C();Z();Ne();Ze();U();lt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.CreateRefComponentMessage);i(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(D.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=z.Instance(),d=p.components.find(h=>h.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let f=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),g=[];Object.keys(f.refs).forEach(h=>{let y=f.refs[h];y=y.__nonProxied||y,y.componentDefinition&&g.push({refName:h,componentDefinitionId:y.componentDefinition.id})}),s(new j(e.handlerUniqueId,g))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var ft,Mn=m(()=>{"use strict";ge();ft=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=O,t.send=n,t.rootRef=e,t.__scriptInputs=t;let r=new Function("return (".concat(o.script,")(...arguments)"))(t);n(r)}});var ut,Bo=m(()=>{"use strict";C();b();U();Mn();ut=class extends T{constructor(){super(...arguments);i(this,"messageType",u.ExecuteScriptMessage);i(this,"innerExecutor",(e,t,s)=>{ft(e,a=>{s(new pe(e.handlerUniqueId,a))},t)})}}});var Lo,gt,Po=m(()=>{"use strict";C();b();U();L();Z();ge();Lo=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(r=>{if(typeof r.value=="string"){let a=r.getAttribute(D.id),p=r.getAttribute("name"),d={id:r.id,name:p,value:Lo(r),required:r.required,validity:O(r.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},gt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.GetElementValueMessage);i(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new ce(Lo(a)),e)})})}}});var yt,Oo=m(()=>{"use strict";C();U();L();yt=class extends T{constructor(){super(...arguments);i(this,"messageType",u.SetInnerHtml);i(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(r=>{r.innerHTML=e.content})})}}});var Ao={};se(Ao,{WebComponentSDK:()=>He});var He,Cn=m(()=>{"use strict";w();C();gn();To();vo();_o();Ro();ie();b();Ho();ko();Do();Bo();Po();Oo();He=class extends we{constructor(){super(...arguments);i(this,"alwaysPassEnvelopesToHost",!0);i(this,"connectedCallback",(e,t)=>{e.addEventListener(st.webcomponent_message_key,s=>{let r=s.data?s.data:s.detail;if(!r||!r.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=r;if(this.handleIncomeMessages(s),a.messageType===u.InitMessage){let p=a.content.id;this.components[p].context=new pt(e,t)}}}),setTimeout(()=>{this.messageToHost(new me)},1)});i(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});i(this,"supportedHandlers",[new at(this.messageToHost,this.components),new yt(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new ut(this.messageToHost,this.components),new gt(this.messageToHost,this.components),new lt(this.messageToHost,this.components)]);i(this,"init",()=>{})}};F("WebComponentSDK",He)});var Ko=m(()=>{"use strict";Cn()});var zo,$o=m(()=>{"use strict";zo=""});function li(o,n){return class extends HTMLElement{connectedCallback(){let e=n===fe.open?"open":"closed",t=this.attachShadow({mode:e});Uo().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var ci,mi,Fo,No,ht,Uo,fi,ui,gi,Mt,qo=m(()=>{"use strict";yn();mn();nt();re();w();Ko();un();$o();ci="<!-- myop-web-component -->",mi="myop-web-component",Fo=new Set,No=[],Uo=async()=>(ht||(ht=new He,ht.init()),ht);fi=(o,n,e)=>{customElements.define(o,li(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},ui=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),gi=o=>(o=ui(o),o.replace(/_/g,"-")),Mt=class extends X{constructor(){super(...arguments);i(this,"type",Y.HTMLLoader);i(this,"load",async(e,t,s,r)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,r);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===fe.localFrame){let c=E(),f="myop-comp-".concat(c),g=document.createElement("iframe");g.id=f,g.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(r!=null&&r.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(r!=null&&r.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),g=this.appendChild(s,g,r);let h=g.contentDocument||g.contentWindow.document;h.open();let y=null;{let P=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(P)try{y=JSON.parse(P.getAttribute("content")||"{}")}catch(De){}}let l=a.HTML;if(r!=null&&r._inspection){let B=new DOMParser().parseFromString(a.HTML,"text/html"),P=B.getElementById("myop_preview");P==null||P.removeAttribute("type");let De=B.implementation.createHTMLDocument();De.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let W=De.body.firstChild;W&&B.head&&B.head.insertBefore(B.importNode(W,!0),B.head.firstChild),l=B.documentElement.outerHTML}else if((r==null?void 0:r.data)!==void 0){let B=new DOMParser().parseFromString(a.HTML,"text/html"),P=B.getElementById("myop_preview");P&&(P.remove(),l=B.documentElement.outerHTML)}h.writeln(l);let $='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),ke="<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(h.writeln("".concat($).concat(ke)),(r==null?void 0:r.data)!==void 0){let Q="<script>\\n window.__myop_cta_queue = [];\\n window.myop_cta_handler = function(action, payload) {\\n window.__myop_cta_queue.push({action: action, payload: payload});\\n };\\n <\\/script>",B=JSON.stringify(r.data).replace(/<\\/script/gi,"\\\\u003c/script"),P='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(B,";\\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>");h.writeln(Q+P)}h.close();let ne=new _e(e,t,s,g,r);return ne.sizeMeta=y,ne.initiated().then(()=>{ne.observeAutoSize({forceAutoSize:!0}),r!=null&&r.hidden||ne.show()}),ne}if(a.shadowRootMode===fe.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Uo().then(f=>{f.connectedCallback(d,d)})}else{let c=gi(e.name+t.id);No.includes(c)||(fi(c,a.HTML,a.shadowRootMode),No.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,r!=null&&r.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(s,d,r),new Re(e,t,s,d,r)})}isMyopWebComponent(e){return e.trimStart().startsWith(ci)}extractWebComponentScript(e){let r=new DOMParser().parseFromString(e,"text/html").getElementById(mi);return(r==null?void 0:r.textContent)||null}executeWebComponentScript(e,t){if(Fo.has(t)){console.log("[MyopWebComponent] Script already executed for ".concat(t,", skipping"));return}let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s),Fo.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,r,a){let p=this.extractWebComponentScript(r);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let f=window.__MYOP_TAG_NAME__;if(!f)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==f&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(f));let g="myop-comp-".concat(E()),h=document.createElement(f);h.id=g,a!=null&&a.hidden&&(h.style.opacity="0",h.style.position="absolute",h.style.height="0",h.style.width="0",h.style.pointerEvents="none",h.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,h,a);let y=new ye(e,t,s,h,f,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(f,"> into container")),y}}});var Vo,Go,jo=m(()=>{"use strict";re();b();Vo=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new k(({rootRef:s,_stylesheet:r,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let f in r){c+="".concat(f," { ");let g=r[f];for(let h in g)c+="".concat(h,": ").concat(g[h],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new k(({rootRef:s,_tagId:r})=>{let a=(s.shadowRoot||document).getElementById(r);a&&a.remove()},()=>{},{_tagId:t}))}},Go=(o,n)=>{let e="myop-css-".concat(E());return o.send(new k(({rootRef:t,_tagId:s,_link:r})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=r,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new k(({rootRef:t,_tagId:s})=>{let r=(t.shadowRoot||document).getElementById(s);r&&r.remove()},()=>{},{_tagId:e}))}}});var yi,In,Yo,Qo=m(()=>{"use strict";yi=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},In=(o,n)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=M({},o.loader),o.loader.url=yi(o.loader.url,n),o},Yo=o=>async n=>In(n,o)});var Jo,Xo,Zo=m(()=>{"use strict";b();Jo=(o,n,e)=>{o.send(new G(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},Xo=(o,n,e)=>{o.send(new G(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var xt,Ct,bt,It,es=m(()=>{"use strict";re();xt=class xt{constructor(){i(this,"_runTimeInstanceId","runtime-instance-id-"+E());i(this,"_runTimeId","runtime-id-"+E());i(this,"_runTimeName","runtime-name-"+E());i(this,"id",this._runTimeId);i(this,"name",this._runTimeName);i(this,"description","");i(this,"loader",null);i(this,"withLoader",n=>(this.loader=n,this));i(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));i(this,"build",()=>this)}};i(xt,"create",()=>new xt);Ct=xt,bt=class bt{constructor(){i(this,"_runTimeInstanceId","runtime-instance-id-"+E());i(this,"_runTimeId","runtime-id-"+E());i(this,"_runTimeName","runtime-name-"+E());i(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});i(this,"name",this._runTimeName);i(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});i(this,"withInstance",n=>(this.instance=n,this));i(this,"withType",n=>(this.type=n,this));i(this,"withName",n=>(this.name=n,this));i(this,"withDefaultSkin",n=>(this.type.skins.push(n),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:n.id}},this));i(this,"withRef",n=>(this.type.refs.push(n),this));i(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});i(this,"build",()=>JSON.parse(JSON.stringify(this)))}};i(bt,"create",()=>new bt);It=bt});var hi,wt,Mi,Ci,ee,K,ts,xn=m(()=>{"use strict";w();hi=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Te.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Te.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),wt="__MYOP_CLOUD_REPOSITORY_MAIN__",Mi=()=>{if(typeof window<"u")return window[wt];if(typeof globalThis<"u")return globalThis[wt]},Ci=o=>{typeof window<"u"&&(window[wt]=o),typeof globalThis<"u"&&(globalThis[wt]=o)},ee=class ee{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;i(this,"variants",{});i(this,"preloadedComponents",{});i(this,"userFlows",{});i(this,"_defaultEnv","production");i(this,"_envExplicitlySet",!1)}static get Main(){let n=Mi();return n||(ee._main||(ee._main=new ee,Ci(ee._main)),ee._main)}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],r=e!==void 0||t!==void 0,a,p;if(!r&&s)a=s.env,p=s.preview;else{a=e||this._defaultEnv;let c=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!c}let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,f)=>{try{let g="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(g+="&preview=true");let l=(await(await fetch(g)).json()).item;if(!l){f(new Error('Component "'.concat(n,'" not found')));return}if(!l.consume_variant||!l.consume_variant.length){f(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let $=hi(l);c($)}catch(g){f(g)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let r=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(r.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let r=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(r.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};i(ee,"_main",null);K=ee,ts=K});var ns,os=m(()=>{"use strict";ns=async o=>await o()});var te,ss,is,rs,as,ps,ds,cs,ms,ls=m(()=>{"use strict";xn();te=K.Main,ss=()=>te,is=(o,n,e)=>te.isPreloaded(o,n,e),rs=o=>te.getPreloadedParams(o),as=()=>{te=new K("http://localhost:9292")},ps=o=>{te=new K(o)},ds=o=>{te=o},cs=o=>{te.setEnvironment(o)},ms=async(o,n,e)=>Promise.allSettled(o.map(t=>te.fetchComponentV2(t,n,e)))});var bn={};se(bn,{CloudRepository:()=>K,ComponentConfig:()=>It,SkinConfig:()=>Ct,addClass:()=>Jo,applyStylesheet:()=>Vo,applyStylesheetLink:()=>Go,changeSkinUrlByTokenizer:()=>Yo,createIframeSkinByTokenizer:()=>In,enableLocalDev:()=>as,exec:()=>ns,getCloudRepository:()=>ss,getPreloadedParams:()=>rs,isPreloaded:()=>is,preloadComponents:()=>ms,removeClass:()=>Xo,setCloudRepository:()=>ds,setCloudRepositoryUrl:()=>ps,setEnvironment:()=>cs,v2_CloudRepository:()=>ts});var St=m(()=>{"use strict";jo();Qo();Zo();es();xn();os();ls()});var fs,us=m(()=>{"use strict";Vt();St();w();fs=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...r]=qt(t);switch(s){case"component":{let[a,p]=r,d=await K.Main.fetchComponent(a);if(d&&d.type.skins.find(f=>f.id===p))return d.instance.skinSelector={type:ue.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=qt(t),c=(await K.Main.fetchFlow(a)).components.find(f=>f.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ue.Segmented&&c.instance.resolvedExperiences){let f=c.instance.resolvedExperiences.find(g=>g.id===p);if((f==null?void 0:f.type)===tt.Segment){let g=f,y=c.instance.skinSelector.segments.find(l=>l.segmentId===g.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var hs={};se(hs,{HostSDK:()=>z,hostSDK:()=>ys});var gs,z,ys,Ne=m(()=>{"use strict";ie();C();b();wo();So();qe();w();Xe();qo();us();gs="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",z=class{constructor(){i(this,"components2init",[]);i(this,"components",[]);i(this,"componentsLoaders",[]);i(this,"initiated",!1);i(this,"version",Ce);i(this,"type2InstanceCount",{});i(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));i(this,"inspected",!1);i(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});i(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==v.up&&n.data.messageType!==u.EnvelopedMessage)return;let e=n.data;if(e.messageType===u.InitRequest){this.components2init.forEach(s=>{s.send(new Ie(s.id))});return}if(e.messageType===u.InitResponse){this.components2init=this.components2init.filter(r=>r.id!==e.content.id);let s=this.components.find(r=>{var a;return r.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===u.EnvelopedMessage){let s=e,r=this.components.find(a=>a.id===s.destination);if(r){if(s.direction===v.down){s.message.messageType===A.name?r.onMessageReceived(s.message):(s.message.route=s.route,r.send(s.message));return}}else{let a=this.components.find(p=>p.id===s.message.destination);a&&a.send(s.message)}return}let t=this.components.find(s=>s.id===e.destination);if(!t){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(t){if(t.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});i(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});i(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new ot,new it,new Mt];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let r=new s(this.componentsLoaders);t[r.type]=r}),this.componentsLoaders.forEach(s=>{t[s.type]||(t[s.type]=s)}),this.componentsLoaders=Object.values(t)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});i(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var r;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case ue.Dedicated:return((r=n.skin)==null?void 0:r.id)||n.skins[0].id;case ue.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===tt.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let g=c.segment,h=(t||{})[g.function];return h?await h():(console.warn("segmentId:".concat(d.segmentId,", ").concat(g.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});i(this,"runSkinSelector",async(n,e)=>{let t=await this._getSkinIdBySkinSelector(n.instance.skinSelector,n.instance.resolvedExperiences,e);return n.type.skins.find(s=>s.id===t)});i(this,"loaderHooks");i(this,"loadComponent",async(n,e,t)=>{var f,g,h,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await fs(n);s&&(n=s);let r=M(M({},(f=this.loaderHooks)!=null?f:{}),(g=t==null?void 0:t.hooks)!=null?g:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let l=await this.runSkinSelector(n,r);if(!l)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(h=t==null?void 0:t.hooks)!=null&&h.afterSkinSelected&&(l=await t.hooks.afterSkinSelected(M({},l))),n.instance.skinSelector={type:ue.Dedicated,skin:l},t&&(t=M({},t),delete t.hooks),await ln(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,r);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=t==null?void 0:t.hooks)!=null&&y.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(M({},p)));let d=this.componentsLoaders.find(l=>l.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(l=>l!==c),this.components2init=this.components2init.filter(l=>l!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=bo(c,n.type.props,p));try{await fn(c,n,this.components)}catch(l){throw l}return t!=null&&t.skipInit||await c.initiated(),c});i(this,"navigate",async(n,e,t)=>{if(n.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(t!=null&&t.staged){let s=await this.loadComponent(e,n.container,M({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(s),s.show(),n.dispose(),s}else{let s=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,M({relative:{direction:"before",child:s}},t))}})}};i(z,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:gs});if(!window.myop.hostSDK){let o=new z;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:gs}),window.myop.hostSDK=o}ys=window.myop.hostSDK;F("hostSDK",ys)});var Et,Ms=m(()=>{"use strict";C();Z();w();b();Et=class extends x{constructor(){super(...arguments);i(this,"messageType",u.DetectMyopRefsMessage);i(this,"executor",e=>{let t=document.querySelectorAll("[".concat(D.id,"]")),s=[];t.forEach(r=>{let a=r.getAttribute(D.id);a&&s.push(new be(a,r.tagName,r.getBoundingClientRect()))}),this.messageToHost(new le(e.handlerUniqueId,s))})}}});var Tt,Cs=m(()=>{"use strict";C();w();b();L();Tt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.BindClickMessage);i(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(r=>{let a=()=>{this.messageToHost(new ae,e)};r.addEventListener("click",a);let p=()=>{r.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(r=>r())}})}}});var vt,Is=m(()=>{"use strict";C();w();L();vt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.ChangeTextMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var _t,xs=m(()=>{"use strict";C();b();w();Mn();_t=class extends x{constructor(){super(...arguments);i(this,"messageType",u.ExecuteScriptMessage);i(this,"executor",e=>{ft(e,s=>{this.messageToHost(new pe(e.handlerUniqueId,s))},new Ee(document.documentElement))})}}});var Rt,bs=m(()=>{"use strict";C();w();b();ge();L();Rt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.AddEventListenerMessage);i(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(r=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new de(e.handlerUniqueId,O(p,e.serializableSkeleton)))})};r.addEventListener(e.type,a),s.push(()=>{r.removeEventListener(e.type,a)})}),()=>{s.forEach(r=>{r()})}})}}});var Ht,ws=m(()=>{"use strict";C();w();L();Ht=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetAttributeMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var kt,Ss=m(()=>{"use strict";C();Z();w();Ne();Ze();kt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.CreateRefComponentMessage);i(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(D.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await z.Instance().loadComponent(e.nestedComponentConfig,s.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new j(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var Es,Ts=m(()=>{"use strict";Es=(o,n)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let t=new e(n),s={attributes:!0,childList:!0,subtree:!0};return t.observe(o,s),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))}});var Dt,vs=m(()=>{"use strict";C();b();w();Ts();Dt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetMutationObserverMessage);i(this,"executor",e=>{e.source&&Es(document.body,()=>{this.messageToHost(new Ae)})})}}});var _s,Bt,Rs=m(()=>{"use strict";C();Z();w();b();ge();L();_s=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(r=>{if(typeof r.value=="string"){let a=r.getAttribute(D.id),p=r.getAttribute("name"),d={id:r.id,name:p,value:_s(r),required:r.required,validity:O(r.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},Bt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.GetElementValueMessage);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new ce(_s(s)),e)})})}}});var Lt,Hs=m(()=>{"use strict";C();w();b();L();Lt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.GetAttributeMessage);i(this,"executor",e=>{let t=Eo(e.ref,document);t&&this.messageToHost(new Oe(t.getAttribute(e.name)),e)})}}});var Pt,ks=m(()=>{"use strict";b();C();w();Pt=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetResizeObserverMessage);i(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new We)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Ot,Ds=m(()=>{"use strict";C();w();L();Ot=class extends x{constructor(){super(...arguments);i(this,"messageType",u.SetInnerHtml);i(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var Bs={};se(Bs,{IframeSDK:()=>At});var At,Ls=m(()=>{"use strict";w();Ms();Cs();Is();xs();ie();bs();ws();b();Ss();vs();Rs();Xe();Hs();ks();Ds();At=class extends we{constructor(){super();i(this,"version",Ce);i(this,"messageToHost",(e,t)=>{var r;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let s=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=s[0]),e.source||(e.source=s[0]),e.direction=v.up,(r=window.parent)==null||r.postMessage(M({},e),"*")});i(this,"supportedHandlers",[new vt(this.messageToHost),new Ot(this.messageToHost),new Tt(this.messageToHost),new Et(this.messageToHost),new _t(this.messageToHost),new Rt(this.messageToHost),new Ht(this.messageToHost),new Bt(this.messageToHost),new Dt(this.messageToHost),new Pt(this.messageToHost),new Lt(this.messageToHost),new kt(this.messageToHost)]);i(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new me)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};F("IframeSDK",At)});var xi={};var Ii,Ps=m(()=>{"use strict";b();ie();Ii=M({},xe);F("MyopMessages",Ii)});var Os={};se(Os,{CloudRepository:()=>K,ComponentConfig:()=>It,SkinConfig:()=>Ct,addClass:()=>Jo,applyStylesheet:()=>Vo,applyStylesheetLink:()=>Go,changeSkinUrlByTokenizer:()=>Yo,createIframeSkinByTokenizer:()=>In,enableLocalDev:()=>as,exec:()=>ns,getCloudRepository:()=>ss,getPreloadedParams:()=>rs,isPreloaded:()=>is,preloadComponents:()=>ms,removeClass:()=>Xo,setCloudRepository:()=>ds,setCloudRepositoryUrl:()=>ps,setEnvironment:()=>cs,v2_CloudRepository:()=>ts});var As=m(()=>{"use strict";ie();St();St();F("MyopHelpers",bn)});var Ti={};se(Ti,{getHostModule:()=>Ks,getIframeModule:()=>zs,getWebcomponentModule:()=>$s});ie();var Wn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Wn=document.currentScript)==null?void 0:Wn.src,n=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:n,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,n,e)=>{if(window.__federation__[n])console.log("__federation__ module ".concat(n," already loaded.")),e(window.__federation__[n][Ut]);else{let t;window.__federation__[n]={},window.__federation__[n][Je]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][Ut]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Xe();console.log("myop root sdk - loaded",document.location.origin);var bi="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",Ks=()=>Promise.resolve().then(()=>(Ne(),hs)),zs=()=>Promise.resolve().then(()=>(Ls(),Bs)),$s=()=>Promise.resolve().then(()=>(Cn(),Ao)),wi=()=>Promise.resolve().then(()=>(Ps(),xi)),Si=()=>Promise.resolve().then(()=>(As(),Os)),Ve=o=>async()=>(await o()).get(),Ei={version:Ce,getHostModule:Ve(Ks),getIframeModule:Ve(zs),getWebcomponentModule:Ve($s),getMyopMessages:Ve(wi),getMyopHelpers:Ve(Si)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:bi});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:Ei},window.myop);return ti(Ti);})();
|
|
4
4
|
`;
|
|
5
|
-
var
|
|
5
|
+
var ht = Object.defineProperty, sn = Object.defineProperties, on = Object.getOwnPropertyDescriptors, tt = Object.getOwnPropertySymbols, rn = Object.prototype.hasOwnProperty, an = Object.prototype.propertyIsEnumerable, Ne = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t) => {
|
|
6
6
|
for (var n in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var n of
|
|
10
|
-
|
|
7
|
+
rn.call(t, n) && Ne(e, n, t[n]);
|
|
8
|
+
if (tt)
|
|
9
|
+
for (var n of tt(t))
|
|
10
|
+
an.call(t, n) && Ne(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
12
|
+
}, ve = (e, t) => sn(e, on(t)), cn = (e, t) => {
|
|
13
13
|
for (var n in t)
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
var
|
|
14
|
+
ht(e, n, { get: t[n], enumerable: !0 });
|
|
15
|
+
}, r = (e, t, n) => Ne(e, typeof t != "symbol" ? t + "" : t, n), v = (e, t, n) => new Promise((s, i) => {
|
|
16
|
+
var a = (l) => {
|
|
17
17
|
try {
|
|
18
18
|
c(n.next(l));
|
|
19
19
|
} catch (d) {
|
|
20
20
|
i(d);
|
|
21
21
|
}
|
|
22
|
-
},
|
|
22
|
+
}, o = (l) => {
|
|
23
23
|
try {
|
|
24
24
|
c(n.throw(l));
|
|
25
25
|
} catch (d) {
|
|
26
26
|
i(d);
|
|
27
27
|
}
|
|
28
|
-
}, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(
|
|
28
|
+
}, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(a, o);
|
|
29
29
|
c((n = n.apply(e, t)).next());
|
|
30
|
-
}),
|
|
31
|
-
window[
|
|
32
|
-
},
|
|
30
|
+
}), Ie = "__federation__", nt = "onLoad", pt = (e, t) => {
|
|
31
|
+
window[Ie] && window[Ie][e] && window[Ie][e][nt] && window[Ie][e][nt]({ [e]: t });
|
|
32
|
+
}, M = {
|
|
33
33
|
//host to component
|
|
34
34
|
InitRequest: "InitRequest",
|
|
35
35
|
InitResponse: "InitResponse",
|
|
@@ -53,50 +53,50 @@ var it = Object.defineProperty, Vt = Object.defineProperties, Gt = Object.getOwn
|
|
|
53
53
|
MutationObserverMessage: "MutationObserverMessage",
|
|
54
54
|
ResizeObserverMessage: "ResizeObserverMessage"
|
|
55
55
|
}
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
AddEventListenerMessage: () =>
|
|
59
|
-
BaseMyopMessage: () =>
|
|
60
|
-
BindClickMessage: () =>
|
|
61
|
-
ChangeTextMessage: () =>
|
|
62
|
-
CleanupMessage: () =>
|
|
63
|
-
CleanupReplayMessage: () =>
|
|
64
|
-
ClickReplayMessage: () =>
|
|
65
|
-
CreateRefComponentMessage: () =>
|
|
66
|
-
CustomRefMessage: () =>
|
|
67
|
-
DetectMyopRefsMessage: () =>
|
|
68
|
-
DetectedMyopRefsMessage: () =>
|
|
69
|
-
DisposeMessage: () =>
|
|
70
|
-
ElementValueReplayMessage: () =>
|
|
71
|
-
EnvelopedMessage: () =>
|
|
72
|
-
EventListenerCallbackMessage: () =>
|
|
73
|
-
ExecuteComponentMethod: () =>
|
|
56
|
+
}, $e = {};
|
|
57
|
+
cn($e, {
|
|
58
|
+
AddEventListenerMessage: () => gn,
|
|
59
|
+
BaseMyopMessage: () => x,
|
|
60
|
+
BindClickMessage: () => pn,
|
|
61
|
+
ChangeTextMessage: () => mn,
|
|
62
|
+
CleanupMessage: () => Lt,
|
|
63
|
+
CleanupReplayMessage: () => Ot,
|
|
64
|
+
ClickReplayMessage: () => yt,
|
|
65
|
+
CreateRefComponentMessage: () => Tt,
|
|
66
|
+
CustomRefMessage: () => We,
|
|
67
|
+
DetectMyopRefsMessage: () => Mn,
|
|
68
|
+
DetectedMyopRefsMessage: () => Rt,
|
|
69
|
+
DisposeMessage: () => Pt,
|
|
70
|
+
ElementValueReplayMessage: () => Et,
|
|
71
|
+
EnvelopedMessage: () => It,
|
|
72
|
+
EventListenerCallbackMessage: () => Mt,
|
|
73
|
+
ExecuteComponentMethod: () => q,
|
|
74
74
|
ExecuteScriptMessage: () => j,
|
|
75
|
-
ExecuteScriptReplyMessage: () =>
|
|
76
|
-
GetAttributeMessage: () =>
|
|
77
|
-
GetAttributeReplayMessage: () =>
|
|
78
|
-
GetElementValueMessage: () =>
|
|
79
|
-
InitMessage: () =>
|
|
80
|
-
InitRequest: () =>
|
|
81
|
-
InitResponse: () =>
|
|
82
|
-
MessageDirection: () =>
|
|
83
|
-
MutationObserverMessage: () =>
|
|
84
|
-
MyopBindMessage: () =>
|
|
85
|
-
MyopBindReplayMessage: () =>
|
|
86
|
-
MyopElementMessage: () =>
|
|
87
|
-
Ref: () =>
|
|
88
|
-
RefComponentCreatedMessage: () =>
|
|
89
|
-
ResizeObserverMessage: () =>
|
|
90
|
-
SetAttributeMessage: () =>
|
|
91
|
-
SetInnerHtml: () =>
|
|
92
|
-
SetMutationObserverMessage: () =>
|
|
93
|
-
SetResizeObserverMessage: () =>
|
|
94
|
-
stripFunction: () =>
|
|
75
|
+
ExecuteScriptReplyMessage: () => wt,
|
|
76
|
+
GetAttributeMessage: () => bn,
|
|
77
|
+
GetAttributeReplayMessage: () => En,
|
|
78
|
+
GetElementValueMessage: () => wn,
|
|
79
|
+
InitMessage: () => Ve,
|
|
80
|
+
InitRequest: () => St,
|
|
81
|
+
InitResponse: () => Ct,
|
|
82
|
+
MessageDirection: () => P,
|
|
83
|
+
MutationObserverMessage: () => Sn,
|
|
84
|
+
MyopBindMessage: () => W,
|
|
85
|
+
MyopBindReplayMessage: () => $,
|
|
86
|
+
MyopElementMessage: () => hn,
|
|
87
|
+
Ref: () => me,
|
|
88
|
+
RefComponentCreatedMessage: () => Ke,
|
|
89
|
+
ResizeObserverMessage: () => Tn,
|
|
90
|
+
SetAttributeMessage: () => vn,
|
|
91
|
+
SetInnerHtml: () => _n,
|
|
92
|
+
SetMutationObserverMessage: () => Cn,
|
|
93
|
+
SetResizeObserverMessage: () => xn,
|
|
94
|
+
stripFunction: () => vt
|
|
95
95
|
});
|
|
96
|
-
var
|
|
96
|
+
var Z = () => "10000000-1000-4000-8000-100000000000".replace(
|
|
97
97
|
/[018]/g,
|
|
98
98
|
(e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
|
|
99
|
-
),
|
|
99
|
+
), ln = (e) => {
|
|
100
100
|
const t = [...e].map((n) => n.toString(16).padStart(2, "0")).join("");
|
|
101
101
|
return [
|
|
102
102
|
t.slice(0, 8),
|
|
@@ -105,25 +105,25 @@ var J = () => "10000000-1000-4000-8000-100000000000".replace(
|
|
|
105
105
|
t.slice(16, 20),
|
|
106
106
|
t.slice(20)
|
|
107
107
|
].join("-");
|
|
108
|
-
},
|
|
108
|
+
}, dn = (e) => {
|
|
109
109
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
110
110
|
for (; t.length % 4; ) t += "=";
|
|
111
111
|
const n = atob(t);
|
|
112
112
|
return Uint8Array.from(n, (s) => s.charCodeAt(0));
|
|
113
|
-
},
|
|
114
|
-
const t =
|
|
113
|
+
}, st = (e) => {
|
|
114
|
+
const t = dn(e);
|
|
115
115
|
if (t.length % 16 !== 0) throw new Error("Invalid input length");
|
|
116
116
|
const n = [];
|
|
117
117
|
for (let s = 0; s < t.length; s += 16)
|
|
118
|
-
n.push(
|
|
118
|
+
n.push(ln(t.slice(s, s + 16)));
|
|
119
119
|
return n;
|
|
120
|
-
},
|
|
120
|
+
}, un = (e) => new Promise((t) => setTimeout(t, e)), P = class {
|
|
121
121
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var
|
|
122
|
+
r(P, "down", "down");
|
|
123
|
+
r(P, "up", "up");
|
|
124
|
+
var x = class {
|
|
125
125
|
constructor() {
|
|
126
|
-
|
|
126
|
+
r(this, "id", Z()), r(this, "myop", !0), r(this, "content"), r(this, "source"), r(this, "destination"), r(this, "route"), r(this, "ref"), r(this, "direction"), r(this, "cleanable", !1);
|
|
127
127
|
}
|
|
128
128
|
static create(...t) {
|
|
129
129
|
return new this(...t);
|
|
@@ -131,21 +131,21 @@ var S = class {
|
|
|
131
131
|
isTypeof(t) {
|
|
132
132
|
return t.messageType === this.messageType;
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, hn = class extends x {
|
|
135
135
|
constructor(e) {
|
|
136
136
|
super(), this.ref = e;
|
|
137
137
|
}
|
|
138
|
-
},
|
|
138
|
+
}, $ = class extends x {
|
|
139
139
|
constructor(e) {
|
|
140
140
|
super(), this.replayToHandler = e;
|
|
141
141
|
}
|
|
142
|
-
},
|
|
142
|
+
}, W = class extends x {
|
|
143
143
|
constructor(t) {
|
|
144
|
-
super(), this.handler = t,
|
|
144
|
+
super(), this.handler = t, r(this, "handlerUniqueId", Z());
|
|
145
145
|
}
|
|
146
|
-
},
|
|
146
|
+
}, me = class mt {
|
|
147
147
|
constructor(t, n) {
|
|
148
|
-
this.refConfig = t, this.component = n,
|
|
148
|
+
this.refConfig = t, this.component = n, r(this, "myop", !0), r(this, "__nonProxied"), this.__nonProxied = ve(S({}, this), {
|
|
149
149
|
component: null
|
|
150
150
|
// in order to be serializable
|
|
151
151
|
});
|
|
@@ -161,180 +161,180 @@ var S = class {
|
|
|
161
161
|
behavior: {
|
|
162
162
|
type: "code"
|
|
163
163
|
}
|
|
164
|
-
}), new
|
|
164
|
+
}), new mt(i, s);
|
|
165
165
|
}
|
|
166
|
-
},
|
|
166
|
+
}, ft = "ClickReplayMessage", pn = class extends W {
|
|
167
167
|
constructor(e, t) {
|
|
168
|
-
super(t), this.ref = e,
|
|
168
|
+
super(t), this.ref = e, r(this, "replyMessageKey", ft), r(this, "messageType", "BindClickMessage"), r(this, "cleanable", !0);
|
|
169
169
|
}
|
|
170
|
-
},
|
|
170
|
+
}, yt = class extends $ {
|
|
171
171
|
constructor() {
|
|
172
|
-
super(...arguments),
|
|
172
|
+
super(...arguments), r(this, "messageType", ft);
|
|
173
173
|
}
|
|
174
|
-
},
|
|
174
|
+
}, mn = class extends x {
|
|
175
175
|
constructor(e, t) {
|
|
176
|
-
super(), this.ref = e,
|
|
176
|
+
super(), this.ref = e, r(this, "messageType", "ChangeTextMessage"), this.content = t;
|
|
177
177
|
}
|
|
178
|
-
},
|
|
179
|
-
let t = e.match(
|
|
178
|
+
}, gt = "ExecuteScriptReplyMessage", fn = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, yn = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, vt = (e) => {
|
|
179
|
+
let t = e.match(fn);
|
|
180
180
|
if (t)
|
|
181
181
|
return t[1] || t[3];
|
|
182
182
|
{
|
|
183
|
-
let n = e.match(
|
|
183
|
+
let n = e.match(yn);
|
|
184
184
|
if (n)
|
|
185
185
|
return n[1].trim();
|
|
186
186
|
}
|
|
187
|
-
}, j = class extends
|
|
187
|
+
}, j = class extends W {
|
|
188
188
|
constructor(t, n = () => {
|
|
189
189
|
}, s) {
|
|
190
|
-
super(n), this.scriptInputs = s,
|
|
190
|
+
super(n), this.scriptInputs = s, r(this, "replyMessageKey", gt), r(this, "messageType", "ExecuteScriptMessage"), r(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = vt(this.content);
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var
|
|
193
|
+
r(j, "replierKey", "send");
|
|
194
|
+
r(j, "completeStreamKey", "completeStream");
|
|
195
|
+
var wt = class extends $ {
|
|
196
196
|
constructor(e, t) {
|
|
197
|
-
super(e), this.replayToHandler = e, this.content = t,
|
|
197
|
+
super(e), this.replayToHandler = e, this.content = t, r(this, "messageType", gt);
|
|
198
198
|
}
|
|
199
|
-
},
|
|
199
|
+
}, We = class extends j {
|
|
200
200
|
constructor(e, t, n = () => {
|
|
201
201
|
}) {
|
|
202
|
-
super(({ rootRef: s, elementId: i, _script:
|
|
202
|
+
super(({ rootRef: s, elementId: i, _script: a, __scriptInputs: o }) => {
|
|
203
203
|
const c = (s.shadowRoot || s.container).querySelectorAll(`[myop-id='${i}']`);
|
|
204
|
-
return c.length ? (
|
|
205
|
-
}, n), this.scriptInputs = t, this.scriptInputs =
|
|
204
|
+
return c.length ? (o.ref = c[0], new Function(`return (${a})(...arguments)`)(o)) : null;
|
|
205
|
+
}, n), this.scriptInputs = t, this.scriptInputs = ve(S({}, t), {
|
|
206
206
|
//_script: stripFunction(script.toString()),
|
|
207
207
|
_script: e.toString()
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
},
|
|
210
|
+
}, _t = "EventListenerCallbackMessage", gn = class extends W {
|
|
211
211
|
// {} // empty
|
|
212
212
|
constructor(e, t, n) {
|
|
213
|
-
super(n), this.ref = e, this.type = t, this.handler = n,
|
|
213
|
+
super(n), this.ref = e, this.type = t, this.handler = n, r(this, "replyMessageKey", _t), r(this, "messageType", "AddEventListenerMessage"), r(this, "cleanable", !0), r(this, "serializableSkeleton", !1);
|
|
214
214
|
}
|
|
215
215
|
withSerializableSkeleton(e) {
|
|
216
216
|
return this.serializableSkeleton = e, this;
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, Mt = class extends $ {
|
|
219
219
|
constructor(e, t) {
|
|
220
|
-
super(e), this.replayToHandler = e, this.e = t,
|
|
220
|
+
super(e), this.replayToHandler = e, this.e = t, r(this, "messageType", _t), this.content = {
|
|
221
221
|
e: t
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, vn = class extends x {
|
|
225
225
|
constructor(e, t, n) {
|
|
226
|
-
super(), this.ref = e, this.name = t, this.value = n,
|
|
226
|
+
super(), this.ref = e, this.name = t, this.value = n, r(this, "messageType", "SetAttributeMessage");
|
|
227
227
|
}
|
|
228
|
-
},
|
|
228
|
+
}, bt = "ElementValueReplayMessage", wn = class extends W {
|
|
229
229
|
constructor(e, t) {
|
|
230
|
-
super(t), this.ref = e,
|
|
230
|
+
super(t), this.ref = e, r(this, "replyMessageKey", bt), r(this, "messageType", "GetElementValueMessage");
|
|
231
231
|
}
|
|
232
|
-
},
|
|
232
|
+
}, Et = class extends $ {
|
|
233
233
|
constructor(e) {
|
|
234
|
-
super(), this.content = e,
|
|
234
|
+
super(), this.content = e, r(this, "messageType", bt);
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, _n = class extends x {
|
|
237
237
|
constructor(e, t) {
|
|
238
|
-
super(), this.ref = e,
|
|
238
|
+
super(), this.ref = e, r(this, "messageType", "SetInnerHtml"), this.content = t;
|
|
239
239
|
}
|
|
240
|
-
},
|
|
240
|
+
}, Ve = class extends x {
|
|
241
241
|
constructor(e) {
|
|
242
|
-
super(),
|
|
242
|
+
super(), r(this, "messageType", "InitMessage"), this.content = { id: e };
|
|
243
243
|
}
|
|
244
244
|
isTypeof(e) {
|
|
245
245
|
return e.messageType === this.messageType;
|
|
246
246
|
}
|
|
247
|
-
},
|
|
247
|
+
}, Ct = class extends Ve {
|
|
248
248
|
constructor() {
|
|
249
|
-
super(...arguments),
|
|
249
|
+
super(...arguments), r(this, "messageType", "InitResponse");
|
|
250
250
|
}
|
|
251
|
-
},
|
|
251
|
+
}, St = class extends x {
|
|
252
252
|
constructor() {
|
|
253
|
-
super(...arguments),
|
|
253
|
+
super(...arguments), r(this, "messageType", "InitRequest");
|
|
254
254
|
}
|
|
255
|
-
},
|
|
255
|
+
}, xt = "RefComponentCreatedMessage", Tt = class extends W {
|
|
256
256
|
constructor(e, t, n, s) {
|
|
257
|
-
super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n,
|
|
257
|
+
super(s), this.refConfig = e, this.nestedComponentConfig = t, this.options = n, r(this, "replyMessageKey", xt), r(this, "messageType", "CreateRefComponentMessage");
|
|
258
258
|
}
|
|
259
|
-
},
|
|
259
|
+
}, Ke = class extends $ {
|
|
260
260
|
constructor(e, t, n) {
|
|
261
|
-
super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n,
|
|
261
|
+
super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = n, r(this, "messageType", xt);
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, It = class extends x {
|
|
264
264
|
constructor(e, t) {
|
|
265
|
-
super(), this.destination = e, this.message = t,
|
|
265
|
+
super(), this.destination = e, this.message = t, r(this, "messageType", "EnvelopedMessage");
|
|
266
266
|
const n = t;
|
|
267
267
|
this.route = [e, ...n.route ? n.route : []];
|
|
268
268
|
}
|
|
269
|
-
},
|
|
269
|
+
}, Ht = "DetectedMyopRefsMessage", Mn = class extends W {
|
|
270
270
|
constructor() {
|
|
271
|
-
super(...arguments),
|
|
271
|
+
super(...arguments), r(this, "messageType", "DetectMyopRefsMessage"), r(this, "replyMessageKey", Ht);
|
|
272
272
|
}
|
|
273
|
-
},
|
|
273
|
+
}, Rt = class extends $ {
|
|
274
274
|
constructor(e, t) {
|
|
275
|
-
super(e), this.replayToHandler = e,
|
|
275
|
+
super(e), this.replayToHandler = e, r(this, "messageType", Ht), this.content = t;
|
|
276
276
|
}
|
|
277
277
|
isTypeof(e) {
|
|
278
278
|
return e.messageType === this.messageType;
|
|
279
279
|
}
|
|
280
|
-
},
|
|
280
|
+
}, Dt = "GetAttributeReplayMessage", bn = class extends W {
|
|
281
281
|
constructor(e, t, n) {
|
|
282
|
-
super(n), this.ref = e, this.name = t,
|
|
282
|
+
super(n), this.ref = e, this.name = t, r(this, "replyMessageKey", Dt), r(this, "messageType", "GetAttributeMessage");
|
|
283
283
|
}
|
|
284
|
-
},
|
|
284
|
+
}, En = class extends $ {
|
|
285
285
|
constructor(e) {
|
|
286
|
-
super(), this.content = e,
|
|
286
|
+
super(), this.content = e, r(this, "messageType", Dt);
|
|
287
287
|
}
|
|
288
|
-
},
|
|
288
|
+
}, q = class extends x {
|
|
289
289
|
constructor(e) {
|
|
290
|
-
super(), this.method = e,
|
|
290
|
+
super(), this.method = e, r(this, "messageType", "ExecuteComponentMethod");
|
|
291
291
|
}
|
|
292
|
-
},
|
|
292
|
+
}, Cn = class extends x {
|
|
293
293
|
constructor() {
|
|
294
|
-
super(...arguments),
|
|
294
|
+
super(...arguments), r(this, "messageType", "SetMutationObserverMessage");
|
|
295
295
|
}
|
|
296
|
-
},
|
|
296
|
+
}, Sn = class extends x {
|
|
297
297
|
constructor() {
|
|
298
|
-
super(...arguments),
|
|
298
|
+
super(...arguments), r(this, "messageType", "MutationObserverMessage");
|
|
299
299
|
}
|
|
300
|
-
},
|
|
300
|
+
}, kt = "CleanupReplayMessage", Lt = class extends W {
|
|
301
301
|
constructor(e, t) {
|
|
302
|
-
super(t), this.cleanupForMessageId = e,
|
|
302
|
+
super(t), this.cleanupForMessageId = e, r(this, "replyMessageKey", kt), r(this, "messageType", "CleanupMessage");
|
|
303
303
|
}
|
|
304
|
-
},
|
|
304
|
+
}, Ot = class extends $ {
|
|
305
305
|
constructor(e) {
|
|
306
|
-
super(), this.customCleanup = e,
|
|
306
|
+
super(), this.customCleanup = e, r(this, "messageType", kt);
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, Pt = class extends x {
|
|
309
309
|
constructor() {
|
|
310
|
-
super(...arguments),
|
|
310
|
+
super(...arguments), r(this, "messageType", "DisposeMessage");
|
|
311
311
|
}
|
|
312
|
-
},
|
|
312
|
+
}, xn = class extends x {
|
|
313
313
|
constructor() {
|
|
314
|
-
super(...arguments),
|
|
314
|
+
super(...arguments), r(this, "cleanable", !0), r(this, "messageType", "SetResizeObserverMessage");
|
|
315
315
|
}
|
|
316
|
-
},
|
|
316
|
+
}, Tn = class extends x {
|
|
317
317
|
constructor() {
|
|
318
|
-
super(...arguments),
|
|
318
|
+
super(...arguments), r(this, "messageType", "ResizeObserverMessage");
|
|
319
319
|
}
|
|
320
|
-
},
|
|
320
|
+
}, Le = class {
|
|
321
321
|
constructor(e, t, n) {
|
|
322
|
-
this.componentDefinition = e, this.container = t,
|
|
323
|
-
this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(
|
|
324
|
-
}),
|
|
325
|
-
if (!
|
|
322
|
+
this.componentDefinition = e, this.container = t, r(this, "id", ""), r(this, "messageHandlers", {}), r(this, "element"), r(this, "_markedForDisposed", !1), r(this, "bind", (i, a) => {
|
|
323
|
+
this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(a) || this.messageHandlers[i].push(a);
|
|
324
|
+
}), r(this, "bindWhen", (i, a, o) => {
|
|
325
|
+
if (!o)
|
|
326
326
|
throw new Error("can't use component.bindWhen without an handler");
|
|
327
327
|
this.messageHandlers[i] || (this.messageHandlers[i] = []);
|
|
328
|
-
const c = this.messageHandlers[i], l = (d) =>
|
|
328
|
+
const c = this.messageHandlers[i], l = (d) => a(d) ? (o(d), !0) : !1;
|
|
329
329
|
return c.push(l), () => {
|
|
330
330
|
const d = c.indexOf(l);
|
|
331
331
|
d > -1 && c.splice(d, 1);
|
|
332
332
|
};
|
|
333
|
-
}),
|
|
333
|
+
}), r(this, "setInitiated", () => {
|
|
334
334
|
this.isInitiated = !0, this._whenInitiatedResolve && this._whenInitiatedResolve();
|
|
335
|
-
}),
|
|
336
|
-
this._whenInitiatedResolve = i, this._whenInitiatedReject =
|
|
337
|
-
})),
|
|
335
|
+
}), r(this, "isInitiated", !1), r(this, "_whenInitiatedResolve"), r(this, "_whenInitiatedReject"), r(this, "_whenInitiated", new Promise((i, a) => {
|
|
336
|
+
this._whenInitiatedResolve = i, this._whenInitiatedReject = a;
|
|
337
|
+
})), r(this, "initiated", () => this._whenInitiated), r(this, "props", {}), r(this, "refs", {}), this.id = (n == null ? void 0 : n.id) || Oe.Instance().assignId(e);
|
|
338
338
|
const s = n != null && n.timeout ? n == null ? void 0 : n.timeout : 5 * 1e3;
|
|
339
339
|
setTimeout(() => {
|
|
340
340
|
!this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${s} ${this.id}`);
|
|
@@ -351,7 +351,7 @@ var ut = class extends F {
|
|
|
351
351
|
this._markedForDisposed = e;
|
|
352
352
|
}
|
|
353
353
|
onMessageReceived(e) {
|
|
354
|
-
if (e.messageType ===
|
|
354
|
+
if (e.messageType === M.ExecuteComponentMethod) {
|
|
355
355
|
const n = e;
|
|
356
356
|
return this[n.method] ? this[n.method](n.content) : console.log(`method not found ${n.method} on component`, this), !0;
|
|
357
357
|
}
|
|
@@ -365,21 +365,21 @@ var ut = class extends F {
|
|
|
365
365
|
return !1;
|
|
366
366
|
}
|
|
367
367
|
sendCleanupMessage(e) {
|
|
368
|
-
e.source = this.id, e.destination = this.id, e.direction =
|
|
368
|
+
e.source = this.id, e.destination = this.id, e.direction = P.down;
|
|
369
369
|
const t = this.bindWhen(e.replyMessageKey, (s) => s.replayToHandler === e.handlerUniqueId, (s) => {
|
|
370
370
|
e.handler(s), t();
|
|
371
371
|
}), n = e.handler;
|
|
372
372
|
delete e.handler, this.send(e), e.handler = n;
|
|
373
373
|
}
|
|
374
374
|
send(e) {
|
|
375
|
-
e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction =
|
|
375
|
+
e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = P.down;
|
|
376
376
|
let t;
|
|
377
377
|
if (e.handler) {
|
|
378
378
|
const n = e;
|
|
379
379
|
t = this.bindWhen(n.replyMessageKey, (s) => s.replayToHandler === n.handlerUniqueId, n.handler), delete e.handler;
|
|
380
380
|
}
|
|
381
381
|
return e.ref && (e.ref = e.ref.__nonProxied || e.ref), e.cleanable ? () => {
|
|
382
|
-
this.sendCleanupMessage(new
|
|
382
|
+
this.sendCleanupMessage(new Lt(e.id, (n) => {
|
|
383
383
|
})), t && t();
|
|
384
384
|
} : () => {
|
|
385
385
|
};
|
|
@@ -387,82 +387,82 @@ var ut = class extends F {
|
|
|
387
387
|
dispose() {
|
|
388
388
|
if (this.markedForDisposed = !0, !this.isInitiated)
|
|
389
389
|
return;
|
|
390
|
-
console.log("disposing component", this.id), this.send(new
|
|
390
|
+
console.log("disposing component", this.id), this.send(new Pt());
|
|
391
391
|
const e = this.messageHandlers.onDispose;
|
|
392
392
|
e && e.forEach((t) => {
|
|
393
393
|
t(null);
|
|
394
394
|
}), this.messageHandlers = {}, this.id += "_disposed", this.isInitiated = !1;
|
|
395
395
|
}
|
|
396
|
-
},
|
|
396
|
+
}, In = class {
|
|
397
397
|
constructor(e, t, n, s, i) {
|
|
398
|
-
this.myopId = e, this.htmlTagName = t, this.BoundingRect = n, this.offsetTop = s, this.offsetLeft = i,
|
|
398
|
+
this.myopId = e, this.htmlTagName = t, this.BoundingRect = n, this.offsetTop = s, this.offsetLeft = i, r(this, "type", "MyopElementRef");
|
|
399
399
|
}
|
|
400
|
-
},
|
|
400
|
+
}, Hn = (e) => v(void 0, null, function* () {
|
|
401
401
|
if (typeof e == "function")
|
|
402
402
|
e();
|
|
403
403
|
else if (e instanceof Promise) {
|
|
404
404
|
const t = yield e;
|
|
405
405
|
typeof t == "function" && t();
|
|
406
406
|
}
|
|
407
|
-
}),
|
|
407
|
+
}), Rn = class {
|
|
408
408
|
//TODO : add dispose method
|
|
409
409
|
constructor(e) {
|
|
410
410
|
this.messageToHost = e;
|
|
411
411
|
}
|
|
412
|
-
},
|
|
412
|
+
}, Dn = class extends Rn {
|
|
413
413
|
constructor(e, t) {
|
|
414
414
|
super(e), this.messageToHost = e, this.context = t;
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, kn = class {
|
|
417
417
|
//onMessageReceived: (msg: IMyopMessage) => void;
|
|
418
418
|
constructor(e, t) {
|
|
419
|
-
this.id = e, this.context = t,
|
|
419
|
+
this.id = e, this.context = t, r(this, "send", (n) => {
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
},
|
|
422
|
+
}, Ln = class {
|
|
423
423
|
constructor() {
|
|
424
|
-
|
|
424
|
+
r(this, "messageToHandleAfterInit", []), r(this, "components", {}), r(this, "alwaysPassEnvelopesToHost", !1), r(this, "messageCleanupCache", {});
|
|
425
425
|
}
|
|
426
426
|
handleIncomeMessages(e) {
|
|
427
427
|
const t = e.data ? e.data : e.detail;
|
|
428
428
|
if (!(!t || !t.myop)) {
|
|
429
429
|
let n = t;
|
|
430
|
-
if (n.direction !==
|
|
430
|
+
if (n.direction !== P.down)
|
|
431
431
|
return;
|
|
432
|
-
if (n.messageType ===
|
|
432
|
+
if (n.messageType === M.DisposeMessage) {
|
|
433
433
|
n.destination && delete this.components[n.destination];
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
|
-
if (n.messageType ===
|
|
436
|
+
if (n.messageType === M.InitMessage) {
|
|
437
437
|
const s = n.content.id;
|
|
438
438
|
if (this.components[s])
|
|
439
439
|
return;
|
|
440
|
-
this.components[s] = new
|
|
440
|
+
this.components[s] = new kn(s), this.messageToHost(new Ct(s));
|
|
441
441
|
return;
|
|
442
442
|
}
|
|
443
|
-
if (n.messageType ===
|
|
443
|
+
if (n.messageType === M.EnvelopedMessage) {
|
|
444
444
|
const s = n, i = s.message;
|
|
445
445
|
if (n = i, this.alwaysPassEnvelopesToHost || this.components[n.destination]) {
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
|
|
446
|
+
const a = myop.hostSDK.components.find((c) => c.id === i.destination);
|
|
447
|
+
if (a) {
|
|
448
|
+
a.send(i);
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
if (
|
|
453
|
-
|
|
451
|
+
const o = myop.hostSDK.components.find((c) => c.id === s.destination);
|
|
452
|
+
if (o) {
|
|
453
|
+
o.send(i);
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
456
456
|
} else
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
459
|
if (n.messageType) {
|
|
460
|
-
if (n.messageType ===
|
|
461
|
-
const s = n, i = this.messageCleanupCache[s.cleanupForMessageId],
|
|
462
|
-
|
|
463
|
-
this.messageToHost(
|
|
460
|
+
if (n.messageType === M.CleanupMessage) {
|
|
461
|
+
const s = n, i = this.messageCleanupCache[s.cleanupForMessageId], a = new Ot(!!i);
|
|
462
|
+
a.destination = n.destination, i ? (delete this.messageCleanupCache[s.cleanupForMessageId], Hn(i).then(() => {
|
|
463
|
+
this.messageToHost(a, s);
|
|
464
464
|
}).catch(() => {
|
|
465
|
-
})) : this.messageToHost(
|
|
465
|
+
})) : this.messageToHost(a, s);
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
this.supportedHandlers.forEach((s) => {
|
|
@@ -486,21 +486,21 @@ To ensure cleanup properly set 'cleanable' true at message definition and return
|
|
|
486
486
|
console.log("unsupported message type");
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
},
|
|
489
|
+
}, fe = {
|
|
490
490
|
IframeLoader: "IframeLoader",
|
|
491
491
|
WebComponentLoader: "WebComponentLoader",
|
|
492
492
|
HTMLLoader: "HTMLLoader"
|
|
493
|
-
},
|
|
493
|
+
}, ye = {
|
|
494
494
|
open: "open",
|
|
495
495
|
none: "none",
|
|
496
496
|
localFrame: "localFrame"
|
|
497
|
-
},
|
|
497
|
+
}, Re = {
|
|
498
498
|
code: "code"
|
|
499
|
-
},
|
|
499
|
+
}, Ge = class {
|
|
500
500
|
};
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
var
|
|
501
|
+
r(Ge, "code", "code");
|
|
502
|
+
r(Ge, "component", "component");
|
|
503
|
+
var pe = {
|
|
504
504
|
Segmented: "Segmented",
|
|
505
505
|
Dedicated: "Dedicated",
|
|
506
506
|
/**
|
|
@@ -510,42 +510,42 @@ var de = {
|
|
|
510
510
|
* @type {string}
|
|
511
511
|
*/
|
|
512
512
|
Default: "Default"
|
|
513
|
-
},
|
|
513
|
+
}, At = {
|
|
514
514
|
Segment: "Segment",
|
|
515
515
|
Promo: "Promo",
|
|
516
516
|
AB: "AB"
|
|
517
|
-
},
|
|
517
|
+
}, On = class {
|
|
518
518
|
constructor(e, t) {
|
|
519
|
-
this.container = e, this.shadowRoot = t,
|
|
519
|
+
this.container = e, this.shadowRoot = t, r(this, "getRootDiv", () => (this.shadowRoot || this.container).querySelector("div")), r(this, "getRoot", () => this.shadowRoot || this.container);
|
|
520
520
|
}
|
|
521
|
-
},
|
|
522
|
-
if (
|
|
521
|
+
}, Ue = (e) => e !== Object(e), Pn = (e) => typeof e == "function", zt = (e) => {
|
|
522
|
+
if (Ue(e))
|
|
523
523
|
return !0;
|
|
524
|
-
if (
|
|
524
|
+
if (Pn(e) || Object.getPrototypeOf(e))
|
|
525
525
|
return !1;
|
|
526
526
|
for (const t in e) {
|
|
527
527
|
const n = e[t];
|
|
528
528
|
if (typeof n == "object") {
|
|
529
|
-
if (!
|
|
529
|
+
if (!zt(n))
|
|
530
530
|
return !1;
|
|
531
531
|
} else {
|
|
532
|
-
if (
|
|
532
|
+
if (Ue(n))
|
|
533
533
|
continue;
|
|
534
534
|
return !1;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
return !0;
|
|
538
|
-
},
|
|
539
|
-
if (
|
|
538
|
+
}, re = (e, t = {}, n = !0, s = /* @__PURE__ */ new WeakMap()) => {
|
|
539
|
+
if (Ue(e))
|
|
540
540
|
return e;
|
|
541
541
|
if (Array.isArray(e)) {
|
|
542
542
|
if (s.has(e))
|
|
543
543
|
return s.get(e);
|
|
544
544
|
const i = [];
|
|
545
545
|
s.set(e, i);
|
|
546
|
-
for (let
|
|
547
|
-
const
|
|
548
|
-
i[
|
|
546
|
+
for (let a = 0; a < e.length; a++) {
|
|
547
|
+
const o = e[a];
|
|
548
|
+
i[a] = re(o, t, n, s);
|
|
549
549
|
}
|
|
550
550
|
return i;
|
|
551
551
|
}
|
|
@@ -554,14 +554,14 @@ var de = {
|
|
|
554
554
|
return s.get(e);
|
|
555
555
|
const i = {};
|
|
556
556
|
s.set(e, i);
|
|
557
|
-
for (const
|
|
558
|
-
const
|
|
559
|
-
|
|
557
|
+
for (const a in e) {
|
|
558
|
+
const o = typeof t == "boolean" ? t : t[a];
|
|
559
|
+
o && (o === !0 ? (n ? e[a] !== void 0 : e[a]) && (i[a] = re(e[a], !0, n, s)) : typeof o == "object" && (i[a] = re(e[a], o, n, s)));
|
|
560
560
|
}
|
|
561
561
|
return i;
|
|
562
562
|
}
|
|
563
563
|
return {};
|
|
564
|
-
},
|
|
564
|
+
}, An = {
|
|
565
565
|
notSerializableRefCall: (e, t) => {
|
|
566
566
|
throw new Error(`
|
|
567
567
|
The input provided to '${e.toString()}' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation.
|
|
@@ -595,46 +595,46 @@ For more details on serialization and Myop message examples, refer to https://do
|
|
|
595
595
|
|
|
596
596
|
`);
|
|
597
597
|
}
|
|
598
|
-
},
|
|
598
|
+
}, it = class extends Le {
|
|
599
599
|
constructor(e, t, n) {
|
|
600
|
-
super(e, t.container, n), this.componentDefinition = e, this.parent = t,
|
|
601
|
-
const i = s.handler,
|
|
602
|
-
return this.parent.send(new
|
|
603
|
-
}),
|
|
604
|
-
this.isInitiated && this.send(new
|
|
600
|
+
super(e, t.container, n), this.componentDefinition = e, this.parent = t, r(this, "send", (s) => {
|
|
601
|
+
const i = s.handler, a = super.send(s);
|
|
602
|
+
return this.parent.send(new It(this.id, s)), s.handler = i, a;
|
|
603
|
+
}), r(this, "dispose", () => {
|
|
604
|
+
this.isInitiated && this.send(new q("dispose")), super.dispose();
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
607
|
hide() {
|
|
608
|
-
this.send(new
|
|
608
|
+
this.send(new q("hide"));
|
|
609
609
|
}
|
|
610
610
|
show() {
|
|
611
|
-
this.send(new
|
|
611
|
+
this.send(new q("show"));
|
|
612
612
|
}
|
|
613
613
|
inspect() {
|
|
614
|
-
return this.send(new
|
|
614
|
+
return this.send(new q("inspect"));
|
|
615
615
|
}
|
|
616
616
|
setHeightBasedOnDocumentElement() {
|
|
617
|
-
this.send(new
|
|
617
|
+
this.send(new q("setHeightBasedOnDocumentElement"));
|
|
618
618
|
}
|
|
619
619
|
setHeightBasedOnScrollHeight() {
|
|
620
|
-
this.send(new
|
|
620
|
+
this.send(new q("setHeightBasedOnScrollHeight"));
|
|
621
621
|
}
|
|
622
622
|
onMessageReceived(e) {
|
|
623
623
|
return super.onMessageReceived(e);
|
|
624
624
|
}
|
|
625
|
-
},
|
|
626
|
-
constructor(e, t, n, s, i,
|
|
627
|
-
super(e, n,
|
|
628
|
-
}),
|
|
629
|
-
const c = super.send(
|
|
630
|
-
return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",
|
|
631
|
-
}),
|
|
632
|
-
var
|
|
633
|
-
this.ctaCleanup && this.ctaCleanup(), super.dispose(), (
|
|
625
|
+
}, qe = class extends Le {
|
|
626
|
+
constructor(e, t, n, s, i, a) {
|
|
627
|
+
super(e, n, a), this.container = n, this.customElement = s, this.tagName = i, r(this, "ctaCleanup"), r(this, "_ctaHandler"), r(this, "_ctaQueue", []), r(this, "cleanupInspect", () => {
|
|
628
|
+
}), r(this, "send", (o) => {
|
|
629
|
+
const c = super.send(o);
|
|
630
|
+
return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", o), c;
|
|
631
|
+
}), r(this, "dispose", () => {
|
|
632
|
+
var o;
|
|
633
|
+
this.ctaCleanup && this.ctaCleanup(), super.dispose(), (o = this.customElement.parentNode) == null || o.removeChild(this.customElement);
|
|
634
634
|
}), this.element = s, this.setInitiated();
|
|
635
635
|
}
|
|
636
636
|
inspect() {
|
|
637
|
-
return this.cleanupInspect =
|
|
637
|
+
return this.cleanupInspect = Ye(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
|
|
638
638
|
}
|
|
639
639
|
hide() {
|
|
640
640
|
this.customElement.style.opacity = "0", this.customElement.style.position = "absolute", this.customElement.style.pointerEvents = "none", this.customElement.style.visibility = "hidden", this.customElement.style.height = "0", this.customElement.style.width = "0";
|
|
@@ -678,15 +678,15 @@ For more details on serialization and Myop message examples, refer to https://do
|
|
|
678
678
|
this.customElement.removeEventListener("myop-cta", t);
|
|
679
679
|
};
|
|
680
680
|
}
|
|
681
|
-
},
|
|
681
|
+
}, zn = (e, t, n) => {
|
|
682
682
|
const s = document.createElement("a");
|
|
683
683
|
return s.textContent = e, s.style.position = "relative", s.style.padding = "0 5px", s.style.fontSize = "14px", s.style.top = "0", s.style.top = `${t}px`, s.style.transform = "translateX(-50%)", s.target = "_blank", s.href = `https://dashboard.myop.dev/dashboard/component/${n.id}`, s;
|
|
684
|
-
},
|
|
685
|
-
const
|
|
686
|
-
return s.insertBefore(
|
|
687
|
-
i.style.border = "unset", s.removeChild(
|
|
684
|
+
}, Ye = (e, t, n, s, i, a) => {
|
|
685
|
+
const o = zn(`${a.name} : ${t}`, n, a);
|
|
686
|
+
return s.insertBefore(o, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
|
|
687
|
+
i.style.border = "unset", s.removeChild(o);
|
|
688
688
|
};
|
|
689
|
-
},
|
|
689
|
+
}, ot = (e, t, n) => e ? !1 : (console.error(
|
|
690
690
|
// throw new Error(
|
|
691
691
|
`Error: Undefined Prop
|
|
692
692
|
|
|
@@ -697,7 +697,7 @@ Prop Name: ${t}
|
|
|
697
697
|
Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
|
|
698
698
|
|
|
699
699
|
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
|
|
700
|
-
), !0),
|
|
700
|
+
), !0), rt = (e, t, n) => {
|
|
701
701
|
console.error(
|
|
702
702
|
`Error: Code Prop Not Supported
|
|
703
703
|
|
|
@@ -711,64 +711,64 @@ Component: ${n.componentDefinition.name}, ID: ${n.componentDefinition.id}
|
|
|
711
711
|
|
|
712
712
|
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${n.componentDefinition.id} or consult the developer guide.`
|
|
713
713
|
);
|
|
714
|
-
},
|
|
715
|
-
const s = t.reduce((
|
|
716
|
-
[
|
|
714
|
+
}, Fn = (e, t, n) => {
|
|
715
|
+
const s = t.reduce((a, o) => ve(S({}, a), {
|
|
716
|
+
[o.name]: S({}, o)
|
|
717
717
|
}), {}), i = {
|
|
718
|
-
get: (
|
|
719
|
-
const c = s[
|
|
720
|
-
if (
|
|
718
|
+
get: (a, o) => {
|
|
719
|
+
const c = s[o];
|
|
720
|
+
if (ot(c, o, e))
|
|
721
721
|
return !1;
|
|
722
|
-
if (c.behavior.type ===
|
|
723
|
-
if (e instanceof
|
|
724
|
-
return (c.behavior.remap ||
|
|
722
|
+
if (c.behavior.type === Re.code) {
|
|
723
|
+
if (e instanceof qe)
|
|
724
|
+
return (c.behavior.remap || o) === "myop_init_interface" ? (u) => {
|
|
725
725
|
if (u === void 0)
|
|
726
726
|
return e.getData();
|
|
727
727
|
e.initWithData(u);
|
|
728
728
|
} : void 0;
|
|
729
|
-
if (n.loader.type ===
|
|
729
|
+
if (n.loader.type === fe.HTMLLoader && n.loader.shadowRootMode === ye.localFrame) {
|
|
730
730
|
const d = c.behavior;
|
|
731
|
-
return e.element.contentWindow[d.remap ||
|
|
731
|
+
return e.element.contentWindow[d.remap || o];
|
|
732
732
|
}
|
|
733
|
-
return
|
|
733
|
+
return rt(c, o, e), !1;
|
|
734
734
|
}
|
|
735
735
|
return c.mode === "output" ? new Promise((l) => {
|
|
736
736
|
const d = [];
|
|
737
|
-
c.behavior.ref && d.push(
|
|
737
|
+
c.behavior.ref && d.push(me.create(c.behavior.ref)), d.push((h) => {
|
|
738
738
|
l(h);
|
|
739
739
|
}), c.behavior.params && d.push(...c.behavior.params);
|
|
740
|
-
const u =
|
|
740
|
+
const u = $e[c.behavior.message];
|
|
741
741
|
e.send(new u(...d));
|
|
742
742
|
}) : null;
|
|
743
743
|
},
|
|
744
|
-
set: (
|
|
745
|
-
const l = s[
|
|
746
|
-
if (
|
|
744
|
+
set: (a, o, c) => {
|
|
745
|
+
const l = s[o];
|
|
746
|
+
if (ot(l, o, e))
|
|
747
747
|
return !1;
|
|
748
|
-
if (l.behavior.type ===
|
|
749
|
-
if (e instanceof
|
|
750
|
-
const u = l.behavior.remap ||
|
|
748
|
+
if (l.behavior.type === Re.code) {
|
|
749
|
+
if (e instanceof qe) {
|
|
750
|
+
const u = l.behavior.remap || o;
|
|
751
751
|
if (u === "myop_cta_handler")
|
|
752
752
|
return e.setCtaHandler(c), !0;
|
|
753
753
|
if (u === "myop_init_interface")
|
|
754
754
|
return e.initWithData(c), !0;
|
|
755
755
|
}
|
|
756
|
-
if (n.loader.type ===
|
|
757
|
-
const u = l.behavior, h = e.element.contentWindow, m = u.remap ||
|
|
756
|
+
if (n.loader.type === fe.HTMLLoader && n.loader.shadowRootMode === ye.localFrame) {
|
|
757
|
+
const u = l.behavior, h = e.element.contentWindow, m = u.remap || o;
|
|
758
758
|
if (h[m] = c, m === "myop_cta_handler" && h.__myop_cta_queue) {
|
|
759
|
-
const
|
|
760
|
-
h.__myop_cta_queue = null,
|
|
761
|
-
e.markedForDisposed || c(
|
|
759
|
+
const y = h.__myop_cta_queue;
|
|
760
|
+
h.__myop_cta_queue = null, y.forEach((f) => {
|
|
761
|
+
e.markedForDisposed || c(f.action, f.payload);
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
return !0;
|
|
765
765
|
}
|
|
766
|
-
return
|
|
766
|
+
return rt(l, o, e), !1;
|
|
767
767
|
} else if (l.mode === "input")
|
|
768
768
|
if (l.behavior.type === "message") {
|
|
769
769
|
const d = [];
|
|
770
|
-
l.behavior.ref && d.push(
|
|
771
|
-
const u =
|
|
770
|
+
l.behavior.ref && d.push(me.create(l.behavior.ref)), d.push(c), l.behavior.params && d.push(...l.behavior.params);
|
|
771
|
+
const u = $e[l.behavior.message];
|
|
772
772
|
return e.send(new u(...d)), !0;
|
|
773
773
|
} else
|
|
774
774
|
throw new Error(
|
|
@@ -777,7 +777,7 @@ For more information, refer to the component page https://dashboard.myop.dev/das
|
|
|
777
777
|
The 'behavior' field provided is not supported.
|
|
778
778
|
Component: ${e.componentDefinition.name}, ID: ${e.componentDefinition.id}
|
|
779
779
|
|
|
780
|
-
Prop Name: ${
|
|
780
|
+
Prop Name: ${o}
|
|
781
781
|
Behavior Field: ${l.behavior.type}
|
|
782
782
|
|
|
783
783
|
Check the documentation for valid behavior options.`
|
|
@@ -786,12 +786,12 @@ Check the documentation for valid behavior options.`
|
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
788
|
return e.props = {}, e.props = new Proxy(e.props, i), e;
|
|
789
|
-
},
|
|
789
|
+
}, Bn = (e, t) => new Proxy(e, {
|
|
790
790
|
get(n, s) {
|
|
791
|
-
return n[s] ? n[s] : (...
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}), t.send(new
|
|
791
|
+
return n[s] ? n[s] : (...a) => new Promise((o) => {
|
|
792
|
+
a.forEach((c) => {
|
|
793
|
+
zt(c) || An.notSerializableRefCall(s, c);
|
|
794
|
+
}), t.send(new We(
|
|
795
795
|
({ ref: c, propName: l, functionArgs: d, makeSerializable: u }) => {
|
|
796
796
|
if (c) {
|
|
797
797
|
const h = c[l];
|
|
@@ -803,18 +803,18 @@ Check the documentation for valid behavior options.`
|
|
|
803
803
|
//TODO : turn it to config
|
|
804
804
|
elementId: n.refConfig.selector,
|
|
805
805
|
propName: s,
|
|
806
|
-
functionArgs:
|
|
806
|
+
functionArgs: a
|
|
807
807
|
},
|
|
808
808
|
(c) => {
|
|
809
|
-
|
|
809
|
+
o(c.content);
|
|
810
810
|
}
|
|
811
811
|
));
|
|
812
812
|
});
|
|
813
813
|
},
|
|
814
814
|
set(n, s, i) {
|
|
815
|
-
return t.send(new
|
|
816
|
-
({ ref:
|
|
817
|
-
|
|
815
|
+
return t.send(new We(
|
|
816
|
+
({ ref: a, propName: o, propValue: c }) => {
|
|
817
|
+
a && (a[o] = c);
|
|
818
818
|
},
|
|
819
819
|
{
|
|
820
820
|
//TODO : fix that
|
|
@@ -822,151 +822,167 @@ Check the documentation for valid behavior options.`
|
|
|
822
822
|
propValue: i,
|
|
823
823
|
propName: s
|
|
824
824
|
},
|
|
825
|
-
(
|
|
825
|
+
(a) => {
|
|
826
826
|
}
|
|
827
827
|
)), !0;
|
|
828
828
|
}
|
|
829
|
-
}),
|
|
829
|
+
}), Ft = (e, t, n, s) => v(void 0, null, function* () {
|
|
830
830
|
const i = e.component;
|
|
831
831
|
if (!i)
|
|
832
832
|
throw new Error("cant createRefComponent with detached ref");
|
|
833
|
-
return new Promise((
|
|
834
|
-
const c = new
|
|
833
|
+
return new Promise((a, o) => v(void 0, null, function* () {
|
|
834
|
+
const c = new it(t.type, i, s);
|
|
835
835
|
n.push(c), yield i.initiated();
|
|
836
836
|
const l = setTimeout(() => {
|
|
837
|
-
|
|
837
|
+
o("timeout");
|
|
838
838
|
}, 5e3);
|
|
839
|
-
i.send(new
|
|
839
|
+
i.send(new Tt(
|
|
840
840
|
e.refConfig,
|
|
841
841
|
t,
|
|
842
|
-
|
|
842
|
+
ve(S({}, s || {}), {
|
|
843
843
|
id: c.id,
|
|
844
844
|
_hasParent: !0
|
|
845
845
|
}),
|
|
846
846
|
(d) => v(void 0, null, function* () {
|
|
847
847
|
if (clearTimeout(l), d.failed) {
|
|
848
|
-
|
|
848
|
+
o("CreateRefComponentMessage failed");
|
|
849
849
|
return;
|
|
850
850
|
}
|
|
851
851
|
const u = n.find((h) => h.id == c.id);
|
|
852
852
|
if (u !== c) {
|
|
853
|
-
i.refs[e.refConfig.name] = u,
|
|
853
|
+
i.refs[e.refConfig.name] = u, a(u);
|
|
854
854
|
return;
|
|
855
855
|
} else
|
|
856
856
|
c.setInitiated(), i.refs[e.refConfig.name] = c;
|
|
857
857
|
d.nestedRefs.forEach((h) => {
|
|
858
|
-
const m = t.instance.resolvedNestedComponents.find((
|
|
859
|
-
|
|
858
|
+
const m = t.instance.resolvedNestedComponents.find((f) => f.type.id === h.componentDefinitionId).type, y = new it(m, c);
|
|
859
|
+
y.setInitiated(), c.refs[h.refName] = y, n.push(y);
|
|
860
860
|
});
|
|
861
861
|
try {
|
|
862
|
-
yield
|
|
862
|
+
yield Bt(c, t, n, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), a(c);
|
|
863
863
|
} catch (h) {
|
|
864
|
-
|
|
864
|
+
o(h);
|
|
865
865
|
}
|
|
866
866
|
})
|
|
867
867
|
));
|
|
868
868
|
}));
|
|
869
|
-
}),
|
|
869
|
+
}), Bt = (e, t, n, s = !1) => v(void 0, null, function* () {
|
|
870
870
|
e.refs || (e.refs = {});
|
|
871
|
-
const i = Object.values(e.componentDefinition.refs).map((
|
|
871
|
+
const i = Object.values(e.componentDefinition.refs).map((a) => new Promise((o, c) => v(void 0, null, function* () {
|
|
872
872
|
var l;
|
|
873
|
-
if (
|
|
873
|
+
if (a.behavior.type == Ge.component) {
|
|
874
874
|
if (s) {
|
|
875
|
-
|
|
875
|
+
o();
|
|
876
876
|
return;
|
|
877
877
|
}
|
|
878
|
-
let d =
|
|
879
|
-
d || (d =
|
|
878
|
+
let d = a.behavior.componentId;
|
|
879
|
+
d || (d = a.behavior.instance.componentId);
|
|
880
880
|
const u = (l = t.instance.resolvedNestedComponents) == null ? void 0 : l.find((m) => m.type.id === d);
|
|
881
881
|
if (!u)
|
|
882
882
|
throw new Error("componentConfig provided without nestedComponentConfig check the config object");
|
|
883
|
-
const h =
|
|
883
|
+
const h = me.create("", a, e);
|
|
884
884
|
try {
|
|
885
|
-
const m = yield
|
|
886
|
-
e.refs[
|
|
885
|
+
const m = yield Ft(h, u, n);
|
|
886
|
+
e.refs[a.name] = m, o();
|
|
887
887
|
} catch (m) {
|
|
888
888
|
c(m);
|
|
889
889
|
}
|
|
890
890
|
} else
|
|
891
891
|
try {
|
|
892
|
-
const d =
|
|
893
|
-
e.refs[
|
|
892
|
+
const d = me.create("", a, e);
|
|
893
|
+
e.refs[a.name] = Bn(d, e), o();
|
|
894
894
|
} catch {
|
|
895
895
|
}
|
|
896
896
|
})));
|
|
897
897
|
try {
|
|
898
898
|
yield Promise.all(i);
|
|
899
|
-
} catch (
|
|
900
|
-
throw
|
|
899
|
+
} catch (a) {
|
|
900
|
+
throw a;
|
|
901
901
|
}
|
|
902
|
-
}),
|
|
902
|
+
}), Nt = class extends Le {
|
|
903
903
|
constructor(e, t, n, s, i) {
|
|
904
|
-
super(e, n, i), this.componentConfig = e, this.container = n, this.IframeElement = s,
|
|
905
|
-
const
|
|
906
|
-
this.IframeElement.style.height = `${
|
|
904
|
+
super(e, n, i), this.componentConfig = e, this.container = n, this.IframeElement = s, r(this, "_autoSizeCleanup"), r(this, "_autoSizeOptions"), r(this, "_autoSizeUpdate"), r(this, "sizeMeta"), r(this, "cleanupInspect"), r(this, "setHeightBasedOnDocumentElement", () => {
|
|
905
|
+
const a = this.send(new j(() => window.document.documentElement.scrollHeight, (o) => {
|
|
906
|
+
this.IframeElement.style.height = `${o.content}px`, a();
|
|
907
907
|
}));
|
|
908
|
-
}),
|
|
908
|
+
}), r(this, "observeSizeBasedOnDocumentElement", () => this.send(new j(({ send: o }) => {
|
|
909
909
|
const { height: c, width: l } = document.documentElement.getBoundingClientRect(), d = new ResizeObserver(() => {
|
|
910
910
|
const { height: u, width: h } = document.documentElement.getBoundingClientRect();
|
|
911
|
-
|
|
911
|
+
o({ height: u, width: h });
|
|
912
912
|
});
|
|
913
913
|
return d.observe(document.documentElement), d.observe(document.body), { height: c, width: l };
|
|
914
|
-
}, (
|
|
915
|
-
this.IframeElement.style.width = `${
|
|
916
|
-
}))),
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
914
|
+
}, (o) => {
|
|
915
|
+
this.IframeElement.style.width = `${o.content.width}px`, this.IframeElement.style.height = `${o.content.height}px`;
|
|
916
|
+
}))), r(this, "observeAutoSize", (a) => {
|
|
917
|
+
if (this._autoSizeOptions = a, this._autoSizeCleanup && this._autoSizeUpdate)
|
|
918
|
+
return this._autoSizeUpdate(), this._autoSizeCleanup;
|
|
919
|
+
const o = this.IframeElement, c = o.contentDocument;
|
|
920
|
+
if (!c)
|
|
920
921
|
return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"), () => {
|
|
921
922
|
};
|
|
922
|
-
const
|
|
923
|
-
if (
|
|
924
|
-
if (typeof
|
|
925
|
-
const
|
|
926
|
-
return isNaN(
|
|
927
|
-
},
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
});
|
|
923
|
+
const l = (b, w, E) => w !== void 0 && b < w ? w : E !== void 0 && b > E ? E : b, d = (b) => {
|
|
924
|
+
if (b === void 0) return;
|
|
925
|
+
if (typeof b == "number") return b;
|
|
926
|
+
const w = parseFloat(b);
|
|
927
|
+
return isNaN(w) ? void 0 : w;
|
|
928
|
+
}, u = () => {
|
|
929
|
+
var b, w, E, O, A, Y, ce, le;
|
|
930
|
+
const H = o.contentDocument;
|
|
931
|
+
if (!H) return;
|
|
932
|
+
const g = this._autoSizeOptions, de = d(g == null ? void 0 : g.minWidth), ee = d(g == null ? void 0 : g.maxWidth), we = d(g == null ? void 0 : g.minHeight), te = d(g == null ? void 0 : g.maxHeight), _e = (b = g == null ? void 0 : g.loaderMinHeight) != null ? b : 50, Me = ((w = this.sizeMeta) == null ? void 0 : w.width) === "100%" ? "100%" : void 0, be = ((E = this.sizeMeta) == null ? void 0 : E.height) === "100%" ? "100%" : void 0, _ = (A = (O = g == null ? void 0 : g.explicitWidth) != null ? O : Me) != null ? A : "100%", R = (Y = g == null ? void 0 : g.explicitHeight) != null ? Y : be, T = _ !== void 0, U = R !== void 0, z = this.container.getBoundingClientRect(), J = z.width === 0, Q = z.height === 0 || z.height === _e, C = (g != null && g.forceAutoSize || J) && !T, D = (g != null && g.forceAutoSize || Q) && !U;
|
|
933
|
+
if (!C && !D) {
|
|
934
|
+
o.style.width = typeof _ == "number" ? `${_}px` : "100%", o.style.height = typeof R == "number" ? `${R}px` : "100%";
|
|
935
|
+
const xe = typeof _ == "number" ? _ : void 0, Te = typeof R == "number" ? R : void 0;
|
|
936
|
+
(xe !== void 0 || Te !== void 0) && ((ce = g == null ? void 0 : g.onSizeChange) == null || ce.call(g, {
|
|
937
|
+
width: xe,
|
|
938
|
+
height: Te,
|
|
939
|
+
autoSizingWidth: !1,
|
|
940
|
+
autoSizingHeight: !1
|
|
941
|
+
}));
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const F = o.style.transition, k = this.container, Ee = k.style.transition;
|
|
945
|
+
o.style.transition = "none", k.style.transition = "none";
|
|
946
|
+
const Ce = o.getBoundingClientRect().height, X = o.getBoundingClientRect().width, ue = Math.ceil(Math.max(H.documentElement.scrollHeight, H.body.scrollHeight)), Se = Math.ceil(Math.max(H.documentElement.scrollWidth, H.body.scrollWidth));
|
|
947
|
+
let ne = Se, Ae = ue;
|
|
948
|
+
const Qt = D && ue > Ce + 1, Xt = C && Se > X + 1, ze = D && !Qt, Fe = C && !Xt;
|
|
949
|
+
if (ze || Fe) {
|
|
950
|
+
const xe = k.style.minHeight, Te = k.style.minWidth;
|
|
951
|
+
ze && (k.style.minHeight = `${Ce}px`), Fe && (k.style.minWidth = `${X}px`), ze && (o.style.height = "0px"), Fe && (o.style.width = "0px"), ne = Math.ceil(Math.max(H.documentElement.scrollWidth, H.body.scrollWidth)), Ae = Math.ceil(Math.max(H.documentElement.scrollHeight, H.body.scrollHeight)), k.style.minHeight = xe, k.style.minWidth = Te;
|
|
952
952
|
}
|
|
953
|
+
const Xe = l(ne, de, ee), Ze = l(Ae, we, te);
|
|
954
|
+
C ? o.style.width = `${Xe}px` : o.style.width = typeof _ == "number" ? `${_}px` : "100%", D ? o.style.height = `${Ze}px` : o.style.height = typeof R == "number" ? `${R}px` : "100%", o.offsetHeight, o.style.transition = F, k.style.transition = Ee;
|
|
955
|
+
const Zt = C && ee !== void 0 && ne > ee, en = D && te !== void 0 && Ae > te;
|
|
956
|
+
H.documentElement.style.overflowX = Zt ? "auto" : "", H.documentElement.style.overflowY = en ? "auto" : "", (le = g == null ? void 0 : g.onSizeChange) == null || le.call(g, {
|
|
957
|
+
width: Xe,
|
|
958
|
+
height: Ze,
|
|
959
|
+
autoSizingWidth: C,
|
|
960
|
+
autoSizingHeight: D
|
|
961
|
+
});
|
|
953
962
|
};
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
963
|
+
u(), this._autoSizeUpdate = u;
|
|
964
|
+
let h;
|
|
965
|
+
const m = () => {
|
|
966
|
+
h === void 0 && (h = requestAnimationFrame(() => {
|
|
967
|
+
h = void 0, u();
|
|
968
|
+
}));
|
|
969
|
+
}, y = new ResizeObserver(() => m());
|
|
970
|
+
y.observe(c.body), y.observe(c.documentElement);
|
|
971
|
+
const f = new MutationObserver(() => m());
|
|
972
|
+
f.observe(c.body, { childList: !0, subtree: !0, characterData: !0, attributes: !0 });
|
|
973
|
+
const I = () => {
|
|
974
|
+
y.disconnect(), f.disconnect(), h !== void 0 && (cancelAnimationFrame(h), h = void 0), this._autoSizeUpdate = void 0, this._autoSizeCleanup = void 0;
|
|
960
975
|
};
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
976
|
+
return this._autoSizeCleanup = I, I;
|
|
977
|
+
}), r(this, "setSizeBasedOnDocumentElement", () => {
|
|
978
|
+
const a = this.send(new j(() => {
|
|
979
|
+
const { height: o, width: c } = document.documentElement.getBoundingClientRect();
|
|
980
|
+
return { height: o, width: c };
|
|
981
|
+
}, (o) => {
|
|
982
|
+
this.IframeElement.style.width = `${o.content.width}px`, this.IframeElement.style.height = `${o.content.height}px`, a();
|
|
967
983
|
}));
|
|
968
|
-
}),
|
|
969
|
-
const
|
|
984
|
+
}), r(this, "setHeightBasedOnScrollHeight", () => {
|
|
985
|
+
const a = this.send(new j(() => {
|
|
970
986
|
let c = 0;
|
|
971
987
|
return c++, c--, Math.max(
|
|
972
988
|
Math.max(
|
|
@@ -975,26 +991,24 @@ Check the documentation for valid behavior options.`
|
|
|
975
991
|
),
|
|
976
992
|
window.document.body.offsetHeight
|
|
977
993
|
) + c + "px";
|
|
978
|
-
}, (
|
|
979
|
-
this.IframeElement.style.height =
|
|
994
|
+
}, (o) => {
|
|
995
|
+
this.IframeElement.style.height = o.content, a();
|
|
980
996
|
}));
|
|
981
|
-
}),
|
|
982
|
-
var
|
|
983
|
-
let l =
|
|
984
|
-
if (l.messageType ===
|
|
997
|
+
}), r(this, "send", (a) => {
|
|
998
|
+
var o, c;
|
|
999
|
+
let l = S({}, a);
|
|
1000
|
+
if (l.messageType === M.ExecuteComponentMethod)
|
|
985
1001
|
return this[l.method](), () => {
|
|
986
1002
|
};
|
|
987
|
-
l.direction =
|
|
1003
|
+
l.direction = P.down;
|
|
988
1004
|
const d = super.send(l);
|
|
989
|
-
return (c = (
|
|
990
|
-
}),
|
|
991
|
-
this.cleanupInspect && this.cleanupInspect(), super.dispose(), this.IframeElement.parentNode.removeChild(this.IframeElement);
|
|
992
|
-
}), t.loader.autoHeight && this.initiated().then(() => {
|
|
993
|
-
this.setHeightBasedOnScrollHeight();
|
|
1005
|
+
return (c = (o = this.IframeElement) == null ? void 0 : o.contentWindow) == null || c.postMessage(l, "*"), d;
|
|
1006
|
+
}), r(this, "dispose", () => {
|
|
1007
|
+
this._autoSizeCleanup && (this._autoSizeCleanup(), this._autoSizeCleanup = void 0), this.cleanupInspect && this.cleanupInspect(), super.dispose(), this.IframeElement.parentNode.removeChild(this.IframeElement);
|
|
994
1008
|
}), this.element = this.IframeElement;
|
|
995
1009
|
}
|
|
996
1010
|
inspect() {
|
|
997
|
-
return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect =
|
|
1011
|
+
return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = Ye(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
|
|
998
1012
|
this.cleanupInspect(), this.cleanupInspect = void 0;
|
|
999
1013
|
});
|
|
1000
1014
|
}
|
|
@@ -1005,11 +1019,11 @@ Check the documentation for valid behavior options.`
|
|
|
1005
1019
|
this.IframeElement.style.opacity = "1", this.IframeElement.style.position = "unset", this.IframeElement.style.pointerEvents = "all", this.IframeElement.style.visibility = "visible";
|
|
1006
1020
|
}
|
|
1007
1021
|
onMessageReceived(e) {
|
|
1008
|
-
return e.messageType ===
|
|
1022
|
+
return e.messageType === M.In.MutationObserverMessage || e.messageType === M.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
|
|
1009
1023
|
}
|
|
1010
|
-
},
|
|
1024
|
+
}, Je = class {
|
|
1011
1025
|
constructor() {
|
|
1012
|
-
|
|
1026
|
+
r(this, "appendChild", (e, t, n) => {
|
|
1013
1027
|
var s;
|
|
1014
1028
|
if (n != null && n.relative) {
|
|
1015
1029
|
if (n.relative.direction === "before")
|
|
@@ -1022,25 +1036,25 @@ Check the documentation for valid behavior options.`
|
|
|
1022
1036
|
return e.appendChild(t);
|
|
1023
1037
|
});
|
|
1024
1038
|
}
|
|
1025
|
-
},
|
|
1039
|
+
}, Nn = (e, t, n) => {
|
|
1026
1040
|
const s = new URL(e);
|
|
1027
1041
|
return s.searchParams.append(t, n), s.toString();
|
|
1028
|
-
},
|
|
1042
|
+
}, $n = class extends Je {
|
|
1029
1043
|
constructor() {
|
|
1030
|
-
super(...arguments),
|
|
1044
|
+
super(...arguments), r(this, "type", fe.IframeLoader), r(this, "load", (e, t, n, s) => v(this, null, function* () {
|
|
1031
1045
|
let i;
|
|
1032
|
-
const
|
|
1046
|
+
const a = t.loader;
|
|
1033
1047
|
if ((n == null ? void 0 : n.nodeName) === "IFRAME")
|
|
1034
|
-
console.log("needs to load into an exsisting Iframe...",
|
|
1048
|
+
console.log("needs to load into an exsisting Iframe...", a.url, n), i = n, i.src = a.url;
|
|
1035
1049
|
else {
|
|
1036
|
-
const
|
|
1050
|
+
const o = Z(), c = `myop-comp-${o}`;
|
|
1037
1051
|
i = document.createElement("iframe"), i.id = c;
|
|
1038
1052
|
const l = `
|
|
1039
1053
|
padding: 0;
|
|
1040
1054
|
margin: 0;
|
|
1041
1055
|
position: absolute;
|
|
1042
1056
|
inset: 0;
|
|
1043
|
-
height: ${
|
|
1057
|
+
height: ${a.autoHeight || !a.height ? "100%" : a.height};
|
|
1044
1058
|
width: 100%;
|
|
1045
1059
|
overflow: hidden;
|
|
1046
1060
|
border: none;
|
|
@@ -1051,21 +1065,21 @@ Check the documentation for valid behavior options.`
|
|
|
1051
1065
|
h === "" || h === null || h === void 0 ? i.setAttribute(u, "") : i.setAttribute(u, String(h));
|
|
1052
1066
|
});
|
|
1053
1067
|
let d = t.loader.url;
|
|
1054
|
-
s != null && s._hasParent && (d =
|
|
1068
|
+
s != null && s._hasParent && (d = Nn(d, "_myop-comp", o)), i.src = d, n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), i = this.appendChild(n, i, s);
|
|
1055
1069
|
}
|
|
1056
|
-
return new
|
|
1070
|
+
return new Nt(e, t, n, i, s);
|
|
1057
1071
|
}));
|
|
1058
1072
|
}
|
|
1059
|
-
},
|
|
1073
|
+
}, $t = {
|
|
1060
1074
|
webcomponent_message_key: "myop_webcomponent_message"
|
|
1061
|
-
},
|
|
1075
|
+
}, Wt = class extends Le {
|
|
1062
1076
|
constructor(e, t, n, s, i) {
|
|
1063
|
-
super(e, n, i), this.container = n, this.customElement = s,
|
|
1064
|
-
}),
|
|
1065
|
-
let
|
|
1066
|
-
const c = super.send(
|
|
1077
|
+
super(e, n, i), this.container = n, this.customElement = s, r(this, "cleanupInspect", () => {
|
|
1078
|
+
}), r(this, "send", (a) => {
|
|
1079
|
+
let o = S({}, a);
|
|
1080
|
+
const c = super.send(o), l = new CustomEvent($t.webcomponent_message_key, {
|
|
1067
1081
|
// @ts-ignore
|
|
1068
|
-
detail:
|
|
1082
|
+
detail: o
|
|
1069
1083
|
// bubbles: true,
|
|
1070
1084
|
// cancelable: false,
|
|
1071
1085
|
// composed: true
|
|
@@ -1076,13 +1090,13 @@ Check the documentation for valid behavior options.`
|
|
|
1076
1090
|
console.log("error while trying to dispatchEvent", d);
|
|
1077
1091
|
}
|
|
1078
1092
|
return c;
|
|
1079
|
-
}),
|
|
1080
|
-
var
|
|
1081
|
-
super.dispose(), (
|
|
1093
|
+
}), r(this, "dispose", () => {
|
|
1094
|
+
var a;
|
|
1095
|
+
super.dispose(), (a = this.customElement.parentNode) == null || a.removeChild(this.customElement);
|
|
1082
1096
|
}), this.element = s;
|
|
1083
1097
|
}
|
|
1084
1098
|
inspect() {
|
|
1085
|
-
return this.cleanupInspect =
|
|
1099
|
+
return this.cleanupInspect = Ye(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
|
|
1086
1100
|
}
|
|
1087
1101
|
hide() {
|
|
1088
1102
|
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";
|
|
@@ -1090,34 +1104,34 @@ Check the documentation for valid behavior options.`
|
|
|
1090
1104
|
show() {
|
|
1091
1105
|
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 = "";
|
|
1092
1106
|
}
|
|
1093
|
-
},
|
|
1107
|
+
}, Be = {}, Wn = class extends Je {
|
|
1094
1108
|
constructor() {
|
|
1095
|
-
super(...arguments),
|
|
1109
|
+
super(...arguments), r(this, "type", fe.WebComponentLoader), r(this, "load", (e, t, n, s) => v(this, null, function* () {
|
|
1096
1110
|
const i = t.loader;
|
|
1097
|
-
|
|
1111
|
+
Be[i.url] ? console.log("Module alreday loaded or in loading process") : Be[i.url] = new Promise((c, l) => {
|
|
1098
1112
|
const d = i.url, u = document.createElement("script");
|
|
1099
1113
|
u.type = "module", u.src = d, u.onload = () => {
|
|
1100
1114
|
c();
|
|
1101
1115
|
}, u.onerror = () => {
|
|
1102
1116
|
l();
|
|
1103
1117
|
}, document.head.appendChild(u);
|
|
1104
|
-
}), yield
|
|
1105
|
-
let
|
|
1106
|
-
const
|
|
1107
|
-
return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""),
|
|
1118
|
+
}), yield Be[i.url], yield un(1);
|
|
1119
|
+
let a = `myop-comp-${Z()}`;
|
|
1120
|
+
const o = document.createElement(i.tag);
|
|
1121
|
+
return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), o.id = a, s != null && s.hidden && (o.style.opacity = "0", o.style.position = "absolute", o.style.height = "0", o.style.width = "0", o.style.pointerEvents = "none", o.style.visibility = "hidden"), s != null && s._environment && (o._myopEnvironment = s == null ? void 0 : s._environment), this.appendChild(n, o, s), new Wt(e, t, n, o, s);
|
|
1108
1122
|
}));
|
|
1109
1123
|
}
|
|
1110
|
-
},
|
|
1124
|
+
}, Kn = "0.3.22", K = class extends Dn {
|
|
1111
1125
|
constructor(e, t) {
|
|
1112
|
-
super(e), this.context = t,
|
|
1126
|
+
super(e), this.context = t, r(this, "executor", (n) => {
|
|
1113
1127
|
if (n.destination) {
|
|
1114
1128
|
const s = n.destination;
|
|
1115
1129
|
if (this.context[s].context) {
|
|
1116
|
-
const i = (
|
|
1117
|
-
this.messageToHost(
|
|
1130
|
+
const i = (a, o) => {
|
|
1131
|
+
this.messageToHost(ve(S({}, a), {
|
|
1118
1132
|
source: n.destination ? n.destination : n.source,
|
|
1119
1133
|
destination: n.source ? n.source : n.destination
|
|
1120
|
-
}),
|
|
1134
|
+
}), o);
|
|
1121
1135
|
};
|
|
1122
1136
|
return this.innerExecutor(n, this.context[s].context, i);
|
|
1123
1137
|
} else
|
|
@@ -1126,82 +1140,82 @@ Check the documentation for valid behavior options.`
|
|
|
1126
1140
|
debugger;
|
|
1127
1141
|
});
|
|
1128
1142
|
}
|
|
1129
|
-
},
|
|
1143
|
+
}, ge = {
|
|
1130
1144
|
id: "myop-id"
|
|
1131
|
-
},
|
|
1145
|
+
}, ae = (e, t) => t.querySelectorAll(`[${ge.id}='${e.refConfig.selector}']`), Un = class extends K {
|
|
1132
1146
|
constructor() {
|
|
1133
|
-
super(...arguments),
|
|
1134
|
-
const s =
|
|
1135
|
-
return s.forEach((
|
|
1136
|
-
const
|
|
1137
|
-
n(new
|
|
1147
|
+
super(...arguments), r(this, "messageType", M.BindClickMessage), r(this, "innerExecutor", (e, t, n) => {
|
|
1148
|
+
const s = ae(e.ref, t.shadowRoot), i = [];
|
|
1149
|
+
return s.forEach((a) => {
|
|
1150
|
+
const o = () => {
|
|
1151
|
+
n(new yt(e.handlerUniqueId));
|
|
1138
1152
|
};
|
|
1139
|
-
|
|
1140
|
-
|
|
1153
|
+
a.addEventListener("click", o), i.push(() => {
|
|
1154
|
+
a.removeEventListener("click", o);
|
|
1141
1155
|
});
|
|
1142
1156
|
}), () => {
|
|
1143
|
-
i.forEach((
|
|
1157
|
+
i.forEach((a) => a());
|
|
1144
1158
|
};
|
|
1145
1159
|
});
|
|
1146
1160
|
}
|
|
1147
|
-
},
|
|
1161
|
+
}, qn = class extends K {
|
|
1148
1162
|
constructor() {
|
|
1149
|
-
super(...arguments),
|
|
1150
|
-
|
|
1163
|
+
super(...arguments), r(this, "messageType", M.ChangeTextMessage), r(this, "innerExecutor", (e, t) => {
|
|
1164
|
+
ae(e.ref, t.shadowRoot).forEach((s) => {
|
|
1151
1165
|
s.textContent = e.content;
|
|
1152
1166
|
});
|
|
1153
1167
|
});
|
|
1154
1168
|
}
|
|
1155
|
-
},
|
|
1169
|
+
}, jn = class extends On {
|
|
1156
1170
|
constructor(e, t) {
|
|
1157
1171
|
super(e, t), this.container = e, this.shadowRoot = t;
|
|
1158
1172
|
}
|
|
1159
|
-
},
|
|
1173
|
+
}, Vn = class extends K {
|
|
1160
1174
|
constructor() {
|
|
1161
|
-
super(...arguments),
|
|
1162
|
-
const n = t.shadowRoot.querySelectorAll(`[${
|
|
1175
|
+
super(...arguments), r(this, "innerExecutor", (e, t) => {
|
|
1176
|
+
const n = t.shadowRoot.querySelectorAll(`[${ge.id}]`);
|
|
1163
1177
|
let s = [];
|
|
1164
1178
|
n.forEach((i) => {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
}), this.messageToHost(new
|
|
1168
|
-
}),
|
|
1179
|
+
const a = i.getAttribute(ge.id);
|
|
1180
|
+
a && s.push(new In(a, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
|
|
1181
|
+
}), this.messageToHost(new Rt(e.handlerUniqueId, s));
|
|
1182
|
+
}), r(this, "messageType", M.DetectMyopRefsMessage);
|
|
1169
1183
|
}
|
|
1170
|
-
},
|
|
1184
|
+
}, Gn = class extends K {
|
|
1171
1185
|
constructor() {
|
|
1172
|
-
super(...arguments),
|
|
1173
|
-
|
|
1186
|
+
super(...arguments), r(this, "messageType", M.SetAttributeMessage), r(this, "innerExecutor", (e, t) => {
|
|
1187
|
+
ae(e.ref, t.shadowRoot).forEach((s) => {
|
|
1174
1188
|
s.setAttribute(e.name, e.value);
|
|
1175
1189
|
});
|
|
1176
1190
|
});
|
|
1177
1191
|
}
|
|
1178
|
-
},
|
|
1192
|
+
}, Yn = class extends K {
|
|
1179
1193
|
constructor() {
|
|
1180
|
-
super(...arguments),
|
|
1181
|
-
const s =
|
|
1182
|
-
return s.forEach((
|
|
1183
|
-
const
|
|
1184
|
-
n(new
|
|
1194
|
+
super(...arguments), r(this, "messageType", M.AddEventListenerMessage), r(this, "innerExecutor", (e, t, n) => {
|
|
1195
|
+
const s = ae(e.ref, t.shadowRoot), i = [];
|
|
1196
|
+
return s.forEach((a) => {
|
|
1197
|
+
const o = (c) => {
|
|
1198
|
+
n(new Mt(e.handlerUniqueId, re(c, e.serializableSkeleton)));
|
|
1185
1199
|
};
|
|
1186
|
-
|
|
1187
|
-
|
|
1200
|
+
a.addEventListener(e.type, o), i.push(() => {
|
|
1201
|
+
a.removeEventListener(e.type, o);
|
|
1188
1202
|
});
|
|
1189
1203
|
}), () => {
|
|
1190
|
-
i.forEach((
|
|
1204
|
+
i.forEach((a) => a());
|
|
1191
1205
|
};
|
|
1192
1206
|
});
|
|
1193
1207
|
}
|
|
1194
|
-
},
|
|
1208
|
+
}, Jn = class extends K {
|
|
1195
1209
|
constructor() {
|
|
1196
|
-
super(...arguments),
|
|
1210
|
+
super(...arguments), r(this, "messageType", M.CreateRefComponentMessage), r(this, "innerExecutor", (e, t, n) => {
|
|
1197
1211
|
v(this, null, function* () {
|
|
1198
|
-
const i = t.shadowRoot.querySelectorAll(`[${
|
|
1212
|
+
const i = t.shadowRoot.querySelectorAll(`[${ge.id}='${e.refConfig.selector}']`);
|
|
1199
1213
|
if (i.length === 1) {
|
|
1200
|
-
const
|
|
1201
|
-
|
|
1202
|
-
const c =
|
|
1203
|
-
c !== -1 &&
|
|
1204
|
-
const l = yield
|
|
1214
|
+
const a = Oe.Instance(), o = a.components.find((u) => u.id === e.options.id);
|
|
1215
|
+
o && o.dispose();
|
|
1216
|
+
const c = a.components.indexOf(o);
|
|
1217
|
+
c !== -1 && a.components.splice(c, 1);
|
|
1218
|
+
const l = yield a.loadComponent(
|
|
1205
1219
|
e.nestedComponentConfig,
|
|
1206
1220
|
i.item(0),
|
|
1207
1221
|
e.options
|
|
@@ -1212,28 +1226,28 @@ Check the documentation for valid behavior options.`
|
|
|
1212
1226
|
refName: u,
|
|
1213
1227
|
componentDefinitionId: h.componentDefinition.id
|
|
1214
1228
|
});
|
|
1215
|
-
}), n(new
|
|
1229
|
+
}), n(new Ke(e.handlerUniqueId, d));
|
|
1216
1230
|
} else {
|
|
1217
|
-
console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new
|
|
1231
|
+
console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Ke(e.handlerUniqueId, [], !0));
|
|
1218
1232
|
debugger;
|
|
1219
1233
|
}
|
|
1220
1234
|
}).then();
|
|
1221
1235
|
});
|
|
1222
1236
|
}
|
|
1223
|
-
},
|
|
1237
|
+
}, Qn = (e, t, n) => {
|
|
1224
1238
|
const s = e.scriptInputs ? e.scriptInputs : {};
|
|
1225
|
-
s.makeSerializable =
|
|
1226
|
-
const
|
|
1227
|
-
t(
|
|
1228
|
-
},
|
|
1239
|
+
s.makeSerializable = re, s.send = t, s.rootRef = n, s.__scriptInputs = s;
|
|
1240
|
+
const a = new Function(`return (${e.script})(...arguments)`)(s);
|
|
1241
|
+
t(a);
|
|
1242
|
+
}, Xn = class extends K {
|
|
1229
1243
|
constructor() {
|
|
1230
|
-
super(...arguments),
|
|
1231
|
-
|
|
1232
|
-
n(new
|
|
1244
|
+
super(...arguments), r(this, "messageType", M.ExecuteScriptMessage), r(this, "innerExecutor", (e, t, n) => {
|
|
1245
|
+
Qn(e, (i) => {
|
|
1246
|
+
n(new wt(e.handlerUniqueId, i));
|
|
1233
1247
|
}, t);
|
|
1234
1248
|
});
|
|
1235
1249
|
}
|
|
1236
|
-
},
|
|
1250
|
+
}, Kt = (e) => {
|
|
1237
1251
|
if (!e) return null;
|
|
1238
1252
|
if (e.tagName === "FORM") {
|
|
1239
1253
|
new FormData(e);
|
|
@@ -1243,97 +1257,97 @@ Check the documentation for valid behavior options.`
|
|
|
1243
1257
|
};
|
|
1244
1258
|
return e.querySelectorAll("input, select, textarea").forEach((s) => {
|
|
1245
1259
|
if (typeof s.value == "string") {
|
|
1246
|
-
const i = s.getAttribute(
|
|
1247
|
-
let
|
|
1248
|
-
const
|
|
1260
|
+
const i = s.getAttribute(ge.id);
|
|
1261
|
+
let a = s.getAttribute("name");
|
|
1262
|
+
const o = {
|
|
1249
1263
|
id: s.id,
|
|
1250
|
-
name:
|
|
1251
|
-
value:
|
|
1264
|
+
name: a,
|
|
1265
|
+
value: Kt(s),
|
|
1252
1266
|
required: s.required,
|
|
1253
|
-
validity:
|
|
1267
|
+
validity: re(s.validity, !0),
|
|
1254
1268
|
myopId: i
|
|
1255
1269
|
};
|
|
1256
|
-
|
|
1270
|
+
a ? t.formData[a] ? t.formData[a].value ? t.unmappedData.push(o) : (t.unmappedData.push(t.formData[a]), t.formData[a] = o) : t.formData[a] = o : t.unmappedData.push(o);
|
|
1257
1271
|
}
|
|
1258
1272
|
}), t;
|
|
1259
1273
|
}
|
|
1260
1274
|
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;
|
|
1261
|
-
},
|
|
1275
|
+
}, Zn = class extends K {
|
|
1262
1276
|
constructor() {
|
|
1263
|
-
super(...arguments),
|
|
1264
|
-
|
|
1265
|
-
n(new
|
|
1277
|
+
super(...arguments), r(this, "messageType", M.GetElementValueMessage), r(this, "innerExecutor", (e, t, n) => {
|
|
1278
|
+
ae(e.ref, t.shadowRoot).forEach((i) => {
|
|
1279
|
+
n(new Et(Kt(i)), e);
|
|
1266
1280
|
});
|
|
1267
1281
|
});
|
|
1268
1282
|
}
|
|
1269
|
-
},
|
|
1283
|
+
}, es = class extends K {
|
|
1270
1284
|
constructor() {
|
|
1271
|
-
super(...arguments),
|
|
1272
|
-
|
|
1285
|
+
super(...arguments), r(this, "messageType", M.SetInnerHtml), r(this, "innerExecutor", (e, t) => {
|
|
1286
|
+
ae(e.ref, t.shadowRoot).forEach((s) => {
|
|
1273
1287
|
s.innerHTML = e.content;
|
|
1274
1288
|
});
|
|
1275
1289
|
});
|
|
1276
1290
|
}
|
|
1277
|
-
},
|
|
1291
|
+
}, Ut = class extends Ln {
|
|
1278
1292
|
constructor() {
|
|
1279
|
-
super(...arguments),
|
|
1280
|
-
e.addEventListener(
|
|
1293
|
+
super(...arguments), r(this, "alwaysPassEnvelopesToHost", !0), r(this, "connectedCallback", (e, t) => {
|
|
1294
|
+
e.addEventListener($t.webcomponent_message_key, (n) => {
|
|
1281
1295
|
const s = n.data ? n.data : n.detail;
|
|
1282
1296
|
if (!s || !s.myop) {
|
|
1283
1297
|
debugger;
|
|
1284
1298
|
throw new Error("recvied webcomponent_message with wrong type");
|
|
1285
1299
|
} else {
|
|
1286
1300
|
const i = s;
|
|
1287
|
-
if (this.handleIncomeMessages(n), i.messageType ===
|
|
1288
|
-
const
|
|
1289
|
-
this.components[
|
|
1301
|
+
if (this.handleIncomeMessages(n), i.messageType === M.InitMessage) {
|
|
1302
|
+
const a = i.content.id;
|
|
1303
|
+
this.components[a].context = new jn(e, t);
|
|
1290
1304
|
}
|
|
1291
1305
|
}
|
|
1292
1306
|
}), setTimeout(() => {
|
|
1293
|
-
this.messageToHost(new
|
|
1307
|
+
this.messageToHost(new St());
|
|
1294
1308
|
}, 1);
|
|
1295
|
-
}),
|
|
1296
|
-
e.direction =
|
|
1297
|
-
}),
|
|
1298
|
-
new Pn(this.messageToHost, this.components),
|
|
1309
|
+
}), r(this, "messageToHost", (e, t) => {
|
|
1310
|
+
e.direction = P.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
|
|
1311
|
+
}), r(this, "supportedHandlers", [
|
|
1299
1312
|
new qn(this.messageToHost, this.components),
|
|
1300
|
-
new
|
|
1301
|
-
new
|
|
1302
|
-
new
|
|
1303
|
-
new
|
|
1304
|
-
new
|
|
1305
|
-
new
|
|
1313
|
+
new es(this.messageToHost, this.components),
|
|
1314
|
+
new Un(this.messageToHost, this.components),
|
|
1315
|
+
new Vn(this.messageToHost, this.components),
|
|
1316
|
+
new Gn(this.messageToHost, this.components),
|
|
1317
|
+
new Yn(this.messageToHost, this.components),
|
|
1318
|
+
new Xn(this.messageToHost, this.components),
|
|
1319
|
+
new Zn(this.messageToHost, this.components),
|
|
1306
1320
|
//
|
|
1307
|
-
new
|
|
1308
|
-
]),
|
|
1321
|
+
new Jn(this.messageToHost, this.components)
|
|
1322
|
+
]), r(this, "init", () => {
|
|
1309
1323
|
});
|
|
1310
1324
|
}
|
|
1311
1325
|
};
|
|
1312
|
-
|
|
1313
|
-
var
|
|
1314
|
-
return
|
|
1326
|
+
pt("WebComponentSDK", Ut);
|
|
1327
|
+
var ts = "<!-- myop-web-component -->", ns = "myop-web-component", at = /* @__PURE__ */ new Set(), ct = [], He, qt = () => v(void 0, null, function* () {
|
|
1328
|
+
return He || (He = new Ut(), He.init()), He;
|
|
1315
1329
|
});
|
|
1316
|
-
function
|
|
1330
|
+
function ss(e, t) {
|
|
1317
1331
|
return class extends HTMLElement {
|
|
1318
1332
|
connectedCallback() {
|
|
1319
|
-
const n = t ===
|
|
1320
|
-
|
|
1333
|
+
const n = t === ye.open ? "open" : "closed", s = this.attachShadow({ mode: n });
|
|
1334
|
+
qt().then((i) => {
|
|
1321
1335
|
i.connectedCallback(this, s), s.innerHTML = e;
|
|
1322
1336
|
});
|
|
1323
1337
|
}
|
|
1324
1338
|
};
|
|
1325
1339
|
}
|
|
1326
|
-
var
|
|
1327
|
-
customElements.define(e,
|
|
1328
|
-
},
|
|
1340
|
+
var is = (e, t, n) => {
|
|
1341
|
+
customElements.define(e, ss(t, n)), console.log(`define('${e}') was called, web component ready to use`);
|
|
1342
|
+
}, os = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), rs = (e) => (e = os(e), e.replace(/_/g, "-")), as = class extends Je {
|
|
1329
1343
|
constructor() {
|
|
1330
|
-
super(...arguments),
|
|
1344
|
+
super(...arguments), r(this, "type", fe.HTMLLoader), r(this, "load", (e, t, n, s) => v(this, null, function* () {
|
|
1331
1345
|
const i = t.loader;
|
|
1332
1346
|
if (this.isMyopWebComponent(i.HTML))
|
|
1333
1347
|
return this.loadExtractedWebComponent(e, t, n, i.HTML, s);
|
|
1334
|
-
let
|
|
1335
|
-
if (i.shadowRootMode ===
|
|
1336
|
-
const l = `myop-comp-${
|
|
1348
|
+
let a = `myop-comp-${Z()}`, o;
|
|
1349
|
+
if (i.shadowRootMode === ye.localFrame) {
|
|
1350
|
+
const l = `myop-comp-${Z()}`;
|
|
1337
1351
|
let d = document.createElement("iframe");
|
|
1338
1352
|
d.id = l, d.style.cssText = `
|
|
1339
1353
|
display: block;
|
|
@@ -1352,33 +1366,33 @@ var Gn = (e, t, n) => {
|
|
|
1352
1366
|
u.open();
|
|
1353
1367
|
let h = null;
|
|
1354
1368
|
{
|
|
1355
|
-
const
|
|
1356
|
-
if (
|
|
1369
|
+
const E = new DOMParser().parseFromString(i.HTML, "text/html").querySelector('meta[name="myop:size"]');
|
|
1370
|
+
if (E)
|
|
1357
1371
|
try {
|
|
1358
|
-
h = JSON.parse(
|
|
1372
|
+
h = JSON.parse(E.getAttribute("content") || "{}");
|
|
1359
1373
|
} catch {
|
|
1360
1374
|
}
|
|
1361
1375
|
}
|
|
1362
1376
|
let m = i.HTML;
|
|
1363
1377
|
if (s != null && s._inspection) {
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1366
|
-
const
|
|
1367
|
-
|
|
1378
|
+
const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
|
|
1379
|
+
E == null || E.removeAttribute("type");
|
|
1380
|
+
const O = w.implementation.createHTMLDocument();
|
|
1381
|
+
O.body.innerHTML = `<script>
|
|
1368
1382
|
const beforeKeysWindow = new Set(Object.keys(window));
|
|
1369
1383
|
window.myopState = {
|
|
1370
1384
|
beforeKeysWindow,
|
|
1371
1385
|
};
|
|
1372
1386
|
<\/script>`;
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1387
|
+
const A = O.body.firstChild;
|
|
1388
|
+
A && w.head && w.head.insertBefore(w.importNode(A, !0), w.head.firstChild), m = w.documentElement.outerHTML;
|
|
1375
1389
|
} else if ((s == null ? void 0 : s.data) !== void 0) {
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1390
|
+
const w = new DOMParser().parseFromString(i.HTML, "text/html"), E = w.getElementById("myop_preview");
|
|
1391
|
+
E && (E.remove(), m = w.documentElement.outerHTML);
|
|
1378
1392
|
}
|
|
1379
1393
|
u.writeln(m);
|
|
1380
|
-
const
|
|
1381
|
-
if (u.writeln(`${
|
|
1394
|
+
const y = `<script>${nn}<\/script>`;
|
|
1395
|
+
if (u.writeln(`${y}<script>
|
|
1382
1396
|
const __myop_init = async () => {
|
|
1383
1397
|
const iframeModule = await MyopSDK.getIframeModule();
|
|
1384
1398
|
const IframeSDK = iframeModule.IframeSDK;
|
|
@@ -1387,12 +1401,12 @@ var Gn = (e, t, n) => {
|
|
|
1387
1401
|
}
|
|
1388
1402
|
__myop_init().then();
|
|
1389
1403
|
<\/script>`), (s == null ? void 0 : s.data) !== void 0) {
|
|
1390
|
-
const
|
|
1404
|
+
const b = `<script>
|
|
1391
1405
|
window.__myop_cta_queue = [];
|
|
1392
1406
|
window.myop_cta_handler = function(action, payload) {
|
|
1393
1407
|
window.__myop_cta_queue.push({action: action, payload: payload});
|
|
1394
1408
|
};
|
|
1395
|
-
<\/script>`,
|
|
1409
|
+
<\/script>`, E = `<script id="__myop_init_data_script">
|
|
1396
1410
|
(function() {
|
|
1397
1411
|
var data = ${JSON.stringify(s.data).replace(/<\/script/gi, "\\u003c/script")};
|
|
1398
1412
|
var scriptEl = document.getElementById('__myop_init_data_script');
|
|
@@ -1453,67 +1467,67 @@ var Gn = (e, t, n) => {
|
|
|
1453
1467
|
}
|
|
1454
1468
|
})();
|
|
1455
1469
|
<\/script>`;
|
|
1456
|
-
u.writeln(
|
|
1470
|
+
u.writeln(b + E);
|
|
1457
1471
|
}
|
|
1458
1472
|
u.close();
|
|
1459
|
-
const
|
|
1460
|
-
return
|
|
1461
|
-
|
|
1462
|
-
}),
|
|
1473
|
+
const I = new Nt(e, t, n, d, s);
|
|
1474
|
+
return I.sizeMeta = h, I.initiated().then(() => {
|
|
1475
|
+
I.observeAutoSize({ forceAutoSize: !0 }), s != null && s.hidden || I.show();
|
|
1476
|
+
}), I;
|
|
1463
1477
|
}
|
|
1464
|
-
if (i.shadowRootMode ===
|
|
1478
|
+
if (i.shadowRootMode === ye.none) {
|
|
1465
1479
|
const c = document.createElement("template");
|
|
1466
|
-
c.innerHTML = i.HTML,
|
|
1467
|
-
l.connectedCallback(
|
|
1480
|
+
c.innerHTML = i.HTML, o = c.content.firstElementChild, qt().then((l) => {
|
|
1481
|
+
l.connectedCallback(o, o);
|
|
1468
1482
|
});
|
|
1469
1483
|
} else {
|
|
1470
|
-
const c =
|
|
1471
|
-
|
|
1484
|
+
const c = rs(e.name + t.id);
|
|
1485
|
+
ct.includes(c) || (is(c, i.HTML, i.shadowRootMode), ct.push(c)), o = document.createElement(c);
|
|
1472
1486
|
}
|
|
1473
|
-
return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""),
|
|
1487
|
+
return n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), o.id = a, s != null && s.hidden && (o.style.opacity = "0", o.style.position = "absolute", o.style.height = "0", o.style.width = "0", o.style.pointerEvents = "none", o.style.visibility = "hidden"), this.appendChild(n, o, s), new Wt(e, t, n, o, s);
|
|
1474
1488
|
}));
|
|
1475
1489
|
}
|
|
1476
1490
|
/**
|
|
1477
1491
|
* Detect if HTML is a Myop Web Component (starts with marker comment)
|
|
1478
1492
|
*/
|
|
1479
1493
|
isMyopWebComponent(e) {
|
|
1480
|
-
return e.trimStart().startsWith(
|
|
1494
|
+
return e.trimStart().startsWith(ts);
|
|
1481
1495
|
}
|
|
1482
1496
|
/**
|
|
1483
1497
|
* Extract the web component script content from HTML
|
|
1484
1498
|
*/
|
|
1485
1499
|
extractWebComponentScript(e) {
|
|
1486
|
-
const s = new DOMParser().parseFromString(e, "text/html").getElementById(
|
|
1500
|
+
const s = new DOMParser().parseFromString(e, "text/html").getElementById(ns);
|
|
1487
1501
|
return (s == null ? void 0 : s.textContent) || null;
|
|
1488
1502
|
}
|
|
1489
1503
|
/**
|
|
1490
1504
|
* Execute the web component script on the host document
|
|
1491
1505
|
*/
|
|
1492
1506
|
executeWebComponentScript(e, t) {
|
|
1493
|
-
if (
|
|
1507
|
+
if (at.has(t)) {
|
|
1494
1508
|
console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);
|
|
1495
1509
|
return;
|
|
1496
1510
|
}
|
|
1497
1511
|
const n = document.createElement("script");
|
|
1498
|
-
n.textContent = e, n.id = `myop-extracted-${t}`, document.head.appendChild(n),
|
|
1512
|
+
n.textContent = e, n.id = `myop-extracted-${t}`, document.head.appendChild(n), at.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
|
|
1499
1513
|
}
|
|
1500
1514
|
/**
|
|
1501
1515
|
* Load a Myop Web Component (extracted and run on host document)
|
|
1502
1516
|
*/
|
|
1503
1517
|
loadExtractedWebComponent(e, t, n, s, i) {
|
|
1504
1518
|
return v(this, null, function* () {
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1519
|
+
const a = this.extractWebComponentScript(s);
|
|
1520
|
+
if (!a)
|
|
1507
1521
|
throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');
|
|
1508
|
-
const
|
|
1509
|
-
this.executeWebComponentScript(
|
|
1522
|
+
const o = `${e.id}-${t.id}`, c = window.__MYOP_TAG_NAME__;
|
|
1523
|
+
this.executeWebComponentScript(a, o);
|
|
1510
1524
|
const l = window.__MYOP_TAG_NAME__;
|
|
1511
1525
|
if (!l)
|
|
1512
1526
|
throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");
|
|
1513
1527
|
c && c !== l && console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);
|
|
1514
|
-
const d = `myop-comp-${
|
|
1528
|
+
const d = `myop-comp-${Z()}`, u = document.createElement(l);
|
|
1515
1529
|
u.id = d, i != null && i.hidden && (u.style.opacity = "0", u.style.position = "absolute", u.style.height = "0", u.style.width = "0", u.style.pointerEvents = "none", u.style.visibility = "hidden"), n.querySelector('[id^="myop-comp-"]') || (n.innerHTML = ""), this.appendChild(n, u, i);
|
|
1516
|
-
const h = new
|
|
1530
|
+
const h = new qe(
|
|
1517
1531
|
e,
|
|
1518
1532
|
t,
|
|
1519
1533
|
n,
|
|
@@ -1524,7 +1538,7 @@ var Gn = (e, t, n) => {
|
|
|
1524
1538
|
return (i == null ? void 0 : i.data) !== void 0 && h.initWithData(i.data), console.log(`[MyopWebComponent] Loaded <${l}> into container`), h;
|
|
1525
1539
|
});
|
|
1526
1540
|
}
|
|
1527
|
-
},
|
|
1541
|
+
}, cs = (e) => ({
|
|
1528
1542
|
instance: {
|
|
1529
1543
|
id: "auto",
|
|
1530
1544
|
componentId: e.componentId,
|
|
@@ -1546,7 +1560,7 @@ var Gn = (e, t, n) => {
|
|
|
1546
1560
|
name: "myop_init_interface",
|
|
1547
1561
|
type: "any",
|
|
1548
1562
|
behavior: {
|
|
1549
|
-
type:
|
|
1563
|
+
type: Re.code
|
|
1550
1564
|
}
|
|
1551
1565
|
},
|
|
1552
1566
|
{
|
|
@@ -1554,7 +1568,7 @@ var Gn = (e, t, n) => {
|
|
|
1554
1568
|
name: "myop_cta_handler",
|
|
1555
1569
|
type: "any",
|
|
1556
1570
|
behavior: {
|
|
1557
|
-
type:
|
|
1571
|
+
type: Re.code
|
|
1558
1572
|
}
|
|
1559
1573
|
}
|
|
1560
1574
|
],
|
|
@@ -1572,20 +1586,20 @@ var Gn = (e, t, n) => {
|
|
|
1572
1586
|
defaultSkin: 0
|
|
1573
1587
|
},
|
|
1574
1588
|
name: e.name
|
|
1575
|
-
}),
|
|
1589
|
+
}), De = "__MYOP_CLOUD_REPOSITORY_MAIN__", ls = () => {
|
|
1576
1590
|
if (typeof window < "u")
|
|
1577
|
-
return window[
|
|
1591
|
+
return window[De];
|
|
1578
1592
|
if (typeof globalThis < "u")
|
|
1579
|
-
return globalThis[
|
|
1580
|
-
},
|
|
1581
|
-
typeof window < "u" && (window[
|
|
1582
|
-
},
|
|
1593
|
+
return globalThis[De];
|
|
1594
|
+
}, ds = (e) => {
|
|
1595
|
+
typeof window < "u" && (window[De] = e), typeof globalThis < "u" && (globalThis[De] = e);
|
|
1596
|
+
}, jt = class ie {
|
|
1583
1597
|
constructor(t = "https://cloud.myop.dev") {
|
|
1584
|
-
this._baseUrl = t,
|
|
1598
|
+
this._baseUrl = t, r(this, "variants", {}), r(this, "preloadedComponents", {}), r(this, "userFlows", {}), r(this, "_defaultEnv", "production"), r(this, "_envExplicitlySet", !1);
|
|
1585
1599
|
}
|
|
1586
1600
|
static get Main() {
|
|
1587
|
-
const t =
|
|
1588
|
-
return t || (
|
|
1601
|
+
const t = ls();
|
|
1602
|
+
return t || (ie._main || (ie._main = new ie(), ds(ie._main)), ie._main);
|
|
1589
1603
|
}
|
|
1590
1604
|
/**
|
|
1591
1605
|
* Set the default environment for this CloudRepository instance
|
|
@@ -1620,38 +1634,38 @@ var Gn = (e, t, n) => {
|
|
|
1620
1634
|
*/
|
|
1621
1635
|
fetchComponentV2(t, n, s) {
|
|
1622
1636
|
return v(this, null, function* () {
|
|
1623
|
-
const i = this.preloadedComponents[t],
|
|
1624
|
-
let
|
|
1625
|
-
if (!
|
|
1626
|
-
|
|
1637
|
+
const i = this.preloadedComponents[t], a = n !== void 0 || s !== void 0;
|
|
1638
|
+
let o, c;
|
|
1639
|
+
if (!a && i)
|
|
1640
|
+
o = i.env, c = i.preview;
|
|
1627
1641
|
else {
|
|
1628
|
-
|
|
1642
|
+
o = n || this._defaultEnv;
|
|
1629
1643
|
const d = n || this._envExplicitlySet;
|
|
1630
1644
|
c = s === !0 ? !0 : s === !1 ? !1 : !d;
|
|
1631
1645
|
}
|
|
1632
|
-
const l = `${t}:${
|
|
1646
|
+
const l = `${t}:${o}:${c ? "preview" : "live"}`;
|
|
1633
1647
|
return console.log("[CloudRepository] fetchComponentV2", {
|
|
1634
1648
|
componentId: t.slice(0, 8) + "...",
|
|
1635
|
-
env:
|
|
1649
|
+
env: o,
|
|
1636
1650
|
usePreview: c,
|
|
1637
1651
|
cacheKey: l,
|
|
1638
1652
|
cached: l in this.variants
|
|
1639
|
-
}), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env:
|
|
1653
|
+
}), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: o, preview: c }), this.variants[l] = new Promise(
|
|
1640
1654
|
(d, u) => v(this, null, function* () {
|
|
1641
1655
|
try {
|
|
1642
|
-
let h = `${this._baseUrl}/consume?id=${t}&env=${
|
|
1656
|
+
let h = `${this._baseUrl}/consume?id=${t}&env=${o}`;
|
|
1643
1657
|
c && (h += "&preview=true");
|
|
1644
|
-
const
|
|
1645
|
-
if (!
|
|
1658
|
+
const f = (yield (yield fetch(h)).json()).item;
|
|
1659
|
+
if (!f) {
|
|
1646
1660
|
u(new Error(`Component "${t}" not found`));
|
|
1647
1661
|
return;
|
|
1648
1662
|
}
|
|
1649
|
-
if (!
|
|
1650
|
-
u(new Error(`Component "${t}" has no implementation for environment "${
|
|
1663
|
+
if (!f.consume_variant || !f.consume_variant.length) {
|
|
1664
|
+
u(new Error(`Component "${t}" has no implementation for environment "${o}"`));
|
|
1651
1665
|
return;
|
|
1652
1666
|
}
|
|
1653
|
-
const
|
|
1654
|
-
d(
|
|
1667
|
+
const I = cs(f);
|
|
1668
|
+
d(I);
|
|
1655
1669
|
} catch (h) {
|
|
1656
1670
|
u(h);
|
|
1657
1671
|
}
|
|
@@ -1673,10 +1687,10 @@ var Gn = (e, t, n) => {
|
|
|
1673
1687
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
1674
1688
|
(n, s) => v(this, null, function* () {
|
|
1675
1689
|
try {
|
|
1676
|
-
const
|
|
1690
|
+
const a = yield (yield fetch(
|
|
1677
1691
|
`${this._baseUrl}/flow?id=${t}&auto=true`
|
|
1678
1692
|
)).json();
|
|
1679
|
-
n(
|
|
1693
|
+
n(a.item);
|
|
1680
1694
|
} catch (i) {
|
|
1681
1695
|
s(i);
|
|
1682
1696
|
}
|
|
@@ -1689,10 +1703,10 @@ var Gn = (e, t, n) => {
|
|
|
1689
1703
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
1690
1704
|
(n, s) => v(this, null, function* () {
|
|
1691
1705
|
try {
|
|
1692
|
-
const
|
|
1706
|
+
const a = yield (yield fetch(
|
|
1693
1707
|
`${this._baseUrl}/flow?id=${t}&resolve=components`
|
|
1694
1708
|
)).json();
|
|
1695
|
-
n(
|
|
1709
|
+
n(a.item);
|
|
1696
1710
|
} catch (i) {
|
|
1697
1711
|
s(i);
|
|
1698
1712
|
}
|
|
@@ -1711,21 +1725,21 @@ var Gn = (e, t, n) => {
|
|
|
1711
1725
|
});
|
|
1712
1726
|
}
|
|
1713
1727
|
};
|
|
1714
|
-
|
|
1715
|
-
var
|
|
1716
|
-
|
|
1717
|
-
var
|
|
1728
|
+
r(jt, "_main", null);
|
|
1729
|
+
var je = jt;
|
|
1730
|
+
je.Main;
|
|
1731
|
+
var us = (e) => v(void 0, null, function* () {
|
|
1718
1732
|
try {
|
|
1719
1733
|
const t = new URL(window.location.href), s = new URLSearchParams(t.search).get("myopOverride");
|
|
1720
1734
|
if (s) {
|
|
1721
|
-
const [i, ...
|
|
1735
|
+
const [i, ...a] = st(s);
|
|
1722
1736
|
switch (i) {
|
|
1723
1737
|
case "component":
|
|
1724
1738
|
{
|
|
1725
|
-
const [
|
|
1739
|
+
const [o, c] = a, l = yield je.Main.fetchComponent(o);
|
|
1726
1740
|
if (l && l.type.skins.find((u) => u.id === c))
|
|
1727
1741
|
return l.instance.skinSelector = {
|
|
1728
|
-
type:
|
|
1742
|
+
type: pe.Dedicated,
|
|
1729
1743
|
skin: {
|
|
1730
1744
|
id: c
|
|
1731
1745
|
}
|
|
@@ -1735,13 +1749,13 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1735
1749
|
// case 'flow': {
|
|
1736
1750
|
default:
|
|
1737
1751
|
{
|
|
1738
|
-
const [
|
|
1739
|
-
if (d && d.instance.skinSelector.type ===
|
|
1752
|
+
const [o, c] = st(s), d = (yield je.Main.fetchFlow(o)).components.find((u) => u.type.id === e.type.id);
|
|
1753
|
+
if (d && d.instance.skinSelector.type === pe.Segmented && d.instance.resolvedExperiences) {
|
|
1740
1754
|
const u = d.instance.resolvedExperiences.find((h) => h.id === c);
|
|
1741
|
-
if ((u == null ? void 0 : u.type) ===
|
|
1742
|
-
const h = u,
|
|
1743
|
-
if (
|
|
1744
|
-
return d.instance.skinSelector =
|
|
1755
|
+
if ((u == null ? void 0 : u.type) === At.Segment) {
|
|
1756
|
+
const h = u, y = d.instance.skinSelector.segments.find((f) => f.segmentId === h.segment.id);
|
|
1757
|
+
if (y)
|
|
1758
|
+
return d.instance.skinSelector = y == null ? void 0 : y.skinSelector, d;
|
|
1745
1759
|
}
|
|
1746
1760
|
}
|
|
1747
1761
|
}
|
|
@@ -1751,42 +1765,42 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1751
1765
|
} finally {
|
|
1752
1766
|
return null;
|
|
1753
1767
|
}
|
|
1754
|
-
}),
|
|
1768
|
+
}), Vt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", Oe = class {
|
|
1755
1769
|
constructor() {
|
|
1756
|
-
|
|
1770
|
+
r(this, "components2init", []), r(this, "components", []), r(this, "componentsLoaders", []), r(this, "initiated", !1), r(this, "version", Kn), r(this, "type2InstanceCount", {}), r(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), r(this, "inspected", !1), r(this, "inspect", () => {
|
|
1757
1771
|
this.inspected || (this.inspected = !0, this.components.forEach((e) => {
|
|
1758
1772
|
e.inspect && e.inspect();
|
|
1759
1773
|
}));
|
|
1760
|
-
}),
|
|
1774
|
+
}), r(this, "incomingMessageHandler", (e) => {
|
|
1761
1775
|
if (e.origin, document.location.origin, e.data.myop) {
|
|
1762
|
-
if (e.data.direction !==
|
|
1776
|
+
if (e.data.direction !== P.up && e.data.messageType !== M.EnvelopedMessage)
|
|
1763
1777
|
return;
|
|
1764
1778
|
const t = e.data;
|
|
1765
|
-
if (t.messageType ===
|
|
1779
|
+
if (t.messageType === M.InitRequest) {
|
|
1766
1780
|
this.components2init.forEach((s) => {
|
|
1767
|
-
s.send(new
|
|
1781
|
+
s.send(new Ve(s.id));
|
|
1768
1782
|
});
|
|
1769
1783
|
return;
|
|
1770
1784
|
}
|
|
1771
|
-
if (t.messageType ===
|
|
1785
|
+
if (t.messageType === M.InitResponse) {
|
|
1772
1786
|
this.components2init = this.components2init.filter((i) => i.id !== t.content.id);
|
|
1773
1787
|
const s = this.components.find((i) => {
|
|
1774
|
-
var
|
|
1775
|
-
return i.id === ((
|
|
1788
|
+
var a;
|
|
1789
|
+
return i.id === ((a = t.content) == null ? void 0 : a.id);
|
|
1776
1790
|
});
|
|
1777
1791
|
s == null || s.setInitiated();
|
|
1778
1792
|
return;
|
|
1779
1793
|
}
|
|
1780
|
-
if (t.messageType ===
|
|
1781
|
-
const s = t, i = this.components.find((
|
|
1794
|
+
if (t.messageType === M.EnvelopedMessage) {
|
|
1795
|
+
const s = t, i = this.components.find((a) => a.id === s.destination);
|
|
1782
1796
|
if (i) {
|
|
1783
|
-
if (s.direction ===
|
|
1784
|
-
s.message.messageType ===
|
|
1797
|
+
if (s.direction === P.down) {
|
|
1798
|
+
s.message.messageType === q.name ? i.onMessageReceived(s.message) : (s.message.route = s.route, i.send(s.message));
|
|
1785
1799
|
return;
|
|
1786
1800
|
}
|
|
1787
1801
|
} else {
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1802
|
+
const a = this.components.find((o) => o.id === s.message.destination);
|
|
1803
|
+
a && a.send(s.message);
|
|
1790
1804
|
}
|
|
1791
1805
|
return;
|
|
1792
1806
|
}
|
|
@@ -1801,19 +1815,19 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1801
1815
|
window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
|
|
1802
1816
|
}
|
|
1803
1817
|
}
|
|
1804
|
-
}),
|
|
1818
|
+
}), r(this, "send", (e) => {
|
|
1805
1819
|
const t = new MessageEvent(
|
|
1806
1820
|
"",
|
|
1807
1821
|
{ data: e }
|
|
1808
1822
|
);
|
|
1809
1823
|
this.incomingMessageHandler(t);
|
|
1810
|
-
}),
|
|
1824
|
+
}), r(this, "init", (e) => {
|
|
1811
1825
|
if (this.initiated)
|
|
1812
1826
|
throw new Error("hostSDK already initiated");
|
|
1813
1827
|
const t = [
|
|
1814
|
-
new
|
|
1815
|
-
new
|
|
1816
|
-
new
|
|
1828
|
+
new $n(),
|
|
1829
|
+
new Wn(),
|
|
1830
|
+
new as()
|
|
1817
1831
|
];
|
|
1818
1832
|
if (this.componentsLoaders = [
|
|
1819
1833
|
...t
|
|
@@ -1831,9 +1845,9 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1831
1845
|
this.incomingMessageHandler,
|
|
1832
1846
|
!1
|
|
1833
1847
|
), console.log("myop hostSDK initiated", document.location.href), this.initiated = !0;
|
|
1834
|
-
}),
|
|
1835
|
-
var
|
|
1836
|
-
function
|
|
1848
|
+
}), r(this, "_getSkinIdBySkinSelector", (e, ...t) => v(this, [e, ...t], function* (n, s = [], i) {
|
|
1849
|
+
var a;
|
|
1850
|
+
function o(c, l) {
|
|
1837
1851
|
return v(this, null, function* () {
|
|
1838
1852
|
for (const d of c)
|
|
1839
1853
|
if (yield l(d))
|
|
@@ -1844,18 +1858,18 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1844
1858
|
// @ts-ignore
|
|
1845
1859
|
case "DedicatedSkin":
|
|
1846
1860
|
//backward compatibility
|
|
1847
|
-
case
|
|
1848
|
-
return ((
|
|
1849
|
-
case
|
|
1861
|
+
case pe.Dedicated:
|
|
1862
|
+
return ((a = n.skin) == null ? void 0 : a.id) || n.skins[0].id;
|
|
1863
|
+
case pe.Segmented:
|
|
1850
1864
|
{
|
|
1851
|
-
const l = yield
|
|
1865
|
+
const l = yield o(n.segments, (d) => v(this, null, function* () {
|
|
1852
1866
|
if (d.segmentId === "Default")
|
|
1853
1867
|
return !0;
|
|
1854
|
-
const u = s.find((
|
|
1868
|
+
const u = s.find((f) => f.type === At.Segment ? f.segment.id === d.segmentId : !1);
|
|
1855
1869
|
if (!u)
|
|
1856
1870
|
throw new Error("experience not found");
|
|
1857
|
-
const m = u.segment,
|
|
1858
|
-
return
|
|
1871
|
+
const m = u.segment, y = (i || {})[m.function];
|
|
1872
|
+
return y ? yield y() : (console.warn(`segmentId:${d.segmentId}, ${m.function} function not provided !`), !1);
|
|
1859
1873
|
}));
|
|
1860
1874
|
if (l)
|
|
1861
1875
|
return this._getSkinIdBySkinSelector(l.skinSelector, s);
|
|
@@ -1866,61 +1880,61 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1866
1880
|
debugger;
|
|
1867
1881
|
}
|
|
1868
1882
|
return "";
|
|
1869
|
-
})),
|
|
1883
|
+
})), r(this, "runSkinSelector", (e, t) => v(this, null, function* () {
|
|
1870
1884
|
const n = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
|
|
1871
1885
|
return e.type.skins.find((s) => s.id === n);
|
|
1872
|
-
})),
|
|
1873
|
-
var s, i,
|
|
1886
|
+
})), r(this, "loaderHooks"), r(this, "loadComponent", (e, t, n) => v(this, null, function* () {
|
|
1887
|
+
var s, i, a, o;
|
|
1874
1888
|
if (!t) {
|
|
1875
1889
|
debugger;
|
|
1876
1890
|
throw new Error("no container was found for this component");
|
|
1877
1891
|
}
|
|
1878
|
-
const c = yield
|
|
1892
|
+
const c = yield us(e);
|
|
1879
1893
|
c && (e = c);
|
|
1880
|
-
const l =
|
|
1894
|
+
const l = S(S({}, (s = this.loaderHooks) != null ? s : {}), (i = n == null ? void 0 : n.hooks) != null ? i : {}), d = t;
|
|
1881
1895
|
if (d.myop)
|
|
1882
1896
|
if (d.component) {
|
|
1883
|
-
e =
|
|
1884
|
-
let
|
|
1885
|
-
if (!
|
|
1897
|
+
e = S({}, e), e.instance = S({}, e.instance);
|
|
1898
|
+
let y = yield this.runSkinSelector(e, l);
|
|
1899
|
+
if (!y)
|
|
1886
1900
|
throw new Error("runSkinSelector failed to choose skin, check the provided config");
|
|
1887
|
-
return (
|
|
1888
|
-
type:
|
|
1889
|
-
skin:
|
|
1901
|
+
return (a = n == null ? void 0 : n.hooks) != null && a.afterSkinSelected && (y = yield n.hooks.afterSkinSelected(S({}, y))), e.instance.skinSelector = {
|
|
1902
|
+
type: pe.Dedicated,
|
|
1903
|
+
skin: y
|
|
1890
1904
|
// skins: [selectedSkin]
|
|
1891
|
-
}, n && (n =
|
|
1905
|
+
}, n && (n = S({}, n), delete n.hooks), yield Ft(d, e, this.components, n);
|
|
1892
1906
|
} else
|
|
1893
1907
|
throw new Error("load component got a detached ref.");
|
|
1894
1908
|
t = t;
|
|
1895
1909
|
let u = yield this.runSkinSelector(e, l);
|
|
1896
1910
|
if (!u)
|
|
1897
1911
|
throw new Error("runSkinSelector failed to choose skin, check the provided config");
|
|
1898
|
-
(
|
|
1899
|
-
const h = this.componentsLoaders.find((
|
|
1912
|
+
(o = n == null ? void 0 : n.hooks) != null && o.afterSkinSelected && (u = yield n.hooks.afterSkinSelected(S({}, u)));
|
|
1913
|
+
const h = this.componentsLoaders.find((y) => y.type === u.loader.type);
|
|
1900
1914
|
if (!h) {
|
|
1901
1915
|
debugger;
|
|
1902
1916
|
throw new Error(`no loader "${u.loader.type}" was found for component`);
|
|
1903
1917
|
}
|
|
1904
1918
|
let m = yield h.load(e.type, u, t, n);
|
|
1905
|
-
m.isInitiated || this.components2init.push(m), m.bind("onDispose", () => (this.components = this.components.filter((
|
|
1919
|
+
m.isInitiated || this.components2init.push(m), m.bind("onDispose", () => (this.components = this.components.filter((y) => y !== m), this.components2init = this.components2init.filter((y) => y !== m), !0)), this.components.push(m), (!n || n.connectProps !== !1) && (m = Fn(m, e.type.props, u));
|
|
1906
1920
|
try {
|
|
1907
|
-
yield
|
|
1908
|
-
} catch (
|
|
1909
|
-
throw
|
|
1921
|
+
yield Bt(m, e, this.components);
|
|
1922
|
+
} catch (y) {
|
|
1923
|
+
throw y;
|
|
1910
1924
|
}
|
|
1911
1925
|
return n != null && n.skipInit || (yield m.initiated()), m;
|
|
1912
|
-
})),
|
|
1926
|
+
})), r(this, "navigate", (e, t, n) => v(this, null, function* () {
|
|
1913
1927
|
if (e.parent)
|
|
1914
1928
|
throw new Error("Navigating on remote ref components is not implemented yet");
|
|
1915
1929
|
if (n != null && n.staged) {
|
|
1916
|
-
let s = yield this.loadComponent(t, e.container,
|
|
1930
|
+
let s = yield this.loadComponent(t, e.container, S({
|
|
1917
1931
|
hidden: !0,
|
|
1918
1932
|
relative: { direction: "after", child: e.element }
|
|
1919
1933
|
}, n));
|
|
1920
1934
|
return n.init && (yield n.init(s)), s.show(), e.dispose(), s;
|
|
1921
1935
|
} else {
|
|
1922
1936
|
const s = e.element.nextSibling;
|
|
1923
|
-
return e.dispose(), this.loadComponent(t, e.container,
|
|
1937
|
+
return e.dispose(), this.loadComponent(t, e.container, S({
|
|
1924
1938
|
relative: {
|
|
1925
1939
|
direction: "before",
|
|
1926
1940
|
child: s
|
|
@@ -1930,40 +1944,40 @@ var ts = (e) => v(void 0, null, function* () {
|
|
|
1930
1944
|
}));
|
|
1931
1945
|
}
|
|
1932
1946
|
};
|
|
1933
|
-
|
|
1947
|
+
r(Oe, "Instance", () => window.myop.hostSDK);
|
|
1934
1948
|
window.myop || (window.myop = {
|
|
1935
|
-
__ROOT_SDK_PUBLIC_URL__:
|
|
1949
|
+
__ROOT_SDK_PUBLIC_URL__: Vt
|
|
1936
1950
|
});
|
|
1937
1951
|
if (!window.myop.hostSDK) {
|
|
1938
|
-
const e = new
|
|
1952
|
+
const e = new Oe();
|
|
1939
1953
|
e.init(), window.myop || (window.myop = {
|
|
1940
|
-
__ROOT_SDK_PUBLIC_URL__:
|
|
1954
|
+
__ROOT_SDK_PUBLIC_URL__: Vt
|
|
1941
1955
|
}), window.myop.hostSDK = e;
|
|
1942
1956
|
}
|
|
1943
|
-
var
|
|
1944
|
-
|
|
1945
|
-
var
|
|
1957
|
+
var Qe = window.myop.hostSDK;
|
|
1958
|
+
pt("hostSDK", Qe);
|
|
1959
|
+
var hs = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", ps = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", ms = {
|
|
1946
1960
|
position: "absolute",
|
|
1947
1961
|
top: 0,
|
|
1948
1962
|
left: 0,
|
|
1949
1963
|
right: 0,
|
|
1950
1964
|
bottom: 0,
|
|
1951
1965
|
zIndex: 1,
|
|
1952
|
-
background:
|
|
1966
|
+
background: hs,
|
|
1953
1967
|
display: "flex",
|
|
1954
1968
|
justifyContent: "center",
|
|
1955
1969
|
alignItems: "center"
|
|
1956
|
-
},
|
|
1970
|
+
}, fs = {
|
|
1957
1971
|
position: "absolute",
|
|
1958
1972
|
top: 0,
|
|
1959
1973
|
left: 0,
|
|
1960
1974
|
right: 0,
|
|
1961
1975
|
bottom: 0,
|
|
1962
|
-
background:
|
|
1976
|
+
background: ps,
|
|
1963
1977
|
display: "flex",
|
|
1964
1978
|
justifyContent: "center",
|
|
1965
1979
|
alignItems: "center"
|
|
1966
|
-
},
|
|
1980
|
+
}, ys = {
|
|
1967
1981
|
position: "absolute",
|
|
1968
1982
|
top: 0,
|
|
1969
1983
|
left: 0,
|
|
@@ -1973,25 +1987,25 @@ var ns = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", ss =
|
|
|
1973
1987
|
display: "flex",
|
|
1974
1988
|
justifyContent: "center",
|
|
1975
1989
|
alignItems: "center"
|
|
1976
|
-
},
|
|
1977
|
-
var
|
|
1990
|
+
}, gs = Object.defineProperty, vs = (e, t, n) => t in e ? gs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, p = (e, t, n) => vs(e, typeof t != "symbol" ? t + "" : t, n), B = (e, t, n) => new Promise((s, i) => {
|
|
1991
|
+
var a = (l) => {
|
|
1978
1992
|
try {
|
|
1979
1993
|
c(n.next(l));
|
|
1980
1994
|
} catch (d) {
|
|
1981
1995
|
i(d);
|
|
1982
1996
|
}
|
|
1983
|
-
},
|
|
1997
|
+
}, o = (l) => {
|
|
1984
1998
|
try {
|
|
1985
1999
|
c(n.throw(l));
|
|
1986
2000
|
} catch (d) {
|
|
1987
2001
|
i(d);
|
|
1988
2002
|
}
|
|
1989
|
-
}, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(
|
|
2003
|
+
}, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(a, o);
|
|
1990
2004
|
c((n = n.apply(e, t)).next());
|
|
1991
2005
|
}), V = () => "10000000-1000-4000-8000-100000000000".replace(
|
|
1992
2006
|
/[018]/g,
|
|
1993
2007
|
(e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
|
|
1994
|
-
),
|
|
2008
|
+
), ws = class {
|
|
1995
2009
|
constructor() {
|
|
1996
2010
|
p(this, "id", V()), p(this, "myop", !0), p(this, "content"), p(this, "source"), p(this, "destination"), p(this, "route"), p(this, "ref"), p(this, "direction"), p(this, "cleanable", !1);
|
|
1997
2011
|
}
|
|
@@ -2001,34 +2015,34 @@ var ns = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", ss =
|
|
|
2001
2015
|
isTypeof(e) {
|
|
2002
2016
|
return e.messageType === this.messageType;
|
|
2003
2017
|
}
|
|
2004
|
-
},
|
|
2018
|
+
}, _s = class extends ws {
|
|
2005
2019
|
constructor(e) {
|
|
2006
2020
|
super(), this.handler = e, p(this, "handlerUniqueId", V());
|
|
2007
2021
|
}
|
|
2008
|
-
},
|
|
2009
|
-
let t = e.match(
|
|
2022
|
+
}, Ms = "ExecuteScriptReplyMessage", bs = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, Es = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, Cs = (e) => {
|
|
2023
|
+
let t = e.match(bs);
|
|
2010
2024
|
if (t)
|
|
2011
2025
|
return t[1] || t[3];
|
|
2012
2026
|
{
|
|
2013
|
-
let n = e.match(
|
|
2027
|
+
let n = e.match(Es);
|
|
2014
2028
|
if (n)
|
|
2015
2029
|
return n[1].trim();
|
|
2016
2030
|
}
|
|
2017
|
-
},
|
|
2031
|
+
}, Gt = class extends _s {
|
|
2018
2032
|
constructor(e, t = () => {
|
|
2019
2033
|
}, n) {
|
|
2020
|
-
super(t), this.scriptInputs = n, p(this, "replyMessageKey",
|
|
2034
|
+
super(t), this.scriptInputs = n, p(this, "replyMessageKey", Ms), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = Cs(this.content);
|
|
2021
2035
|
}
|
|
2022
2036
|
};
|
|
2023
|
-
p(
|
|
2024
|
-
p(
|
|
2025
|
-
var
|
|
2037
|
+
p(Gt, "replierKey", "send");
|
|
2038
|
+
p(Gt, "completeStreamKey", "completeStream");
|
|
2039
|
+
var lt = class {
|
|
2026
2040
|
constructor() {
|
|
2027
2041
|
p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), p(this, "id", this._runTimeId), p(this, "name", this._runTimeName), p(this, "description", ""), p(this, "loader", null), p(this, "withLoader", (t) => (this.loader = t, this)), p(this, "withHTMLLoader", (t) => (t.type = "HTMLLoader", this.loader = t, this)), p(this, "build", () => this);
|
|
2028
2042
|
}
|
|
2029
2043
|
};
|
|
2030
|
-
p(
|
|
2031
|
-
var
|
|
2044
|
+
p(lt, "create", () => new lt());
|
|
2045
|
+
var dt = class {
|
|
2032
2046
|
constructor() {
|
|
2033
2047
|
p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), p(this, "instance", {
|
|
2034
2048
|
id: this._runTimeInstanceId,
|
|
@@ -2063,10 +2077,10 @@ var nt = class {
|
|
|
2063
2077
|
}), p(this, "build", () => JSON.parse(JSON.stringify(this)));
|
|
2064
2078
|
}
|
|
2065
2079
|
};
|
|
2066
|
-
p(
|
|
2067
|
-
var
|
|
2080
|
+
p(dt, "create", () => new dt());
|
|
2081
|
+
var ut = {
|
|
2068
2082
|
code: "code"
|
|
2069
|
-
},
|
|
2083
|
+
}, Ss = (e) => ({
|
|
2070
2084
|
instance: {
|
|
2071
2085
|
id: "auto",
|
|
2072
2086
|
componentId: e.componentId,
|
|
@@ -2088,7 +2102,7 @@ var st = {
|
|
|
2088
2102
|
name: "myop_init_interface",
|
|
2089
2103
|
type: "any",
|
|
2090
2104
|
behavior: {
|
|
2091
|
-
type:
|
|
2105
|
+
type: ut.code
|
|
2092
2106
|
}
|
|
2093
2107
|
},
|
|
2094
2108
|
{
|
|
@@ -2096,7 +2110,7 @@ var st = {
|
|
|
2096
2110
|
name: "myop_cta_handler",
|
|
2097
2111
|
type: "any",
|
|
2098
2112
|
behavior: {
|
|
2099
|
-
type:
|
|
2113
|
+
type: ut.code
|
|
2100
2114
|
}
|
|
2101
2115
|
}
|
|
2102
2116
|
],
|
|
@@ -2114,20 +2128,20 @@ var st = {
|
|
|
2114
2128
|
defaultSkin: 0
|
|
2115
2129
|
},
|
|
2116
2130
|
name: e.name
|
|
2117
|
-
}),
|
|
2131
|
+
}), ke = "__MYOP_CLOUD_REPOSITORY_MAIN__", xs = () => {
|
|
2118
2132
|
if (typeof window < "u")
|
|
2119
|
-
return window[
|
|
2133
|
+
return window[ke];
|
|
2120
2134
|
if (typeof globalThis < "u")
|
|
2121
|
-
return globalThis[
|
|
2122
|
-
},
|
|
2123
|
-
typeof window < "u" && (window[
|
|
2124
|
-
},
|
|
2135
|
+
return globalThis[ke];
|
|
2136
|
+
}, Ts = (e) => {
|
|
2137
|
+
typeof window < "u" && (window[ke] = e), typeof globalThis < "u" && (globalThis[ke] = e);
|
|
2138
|
+
}, Yt = class oe {
|
|
2125
2139
|
constructor(t = "https://cloud.myop.dev") {
|
|
2126
2140
|
this._baseUrl = t, p(this, "variants", {}), p(this, "preloadedComponents", {}), p(this, "userFlows", {}), p(this, "_defaultEnv", "production"), p(this, "_envExplicitlySet", !1);
|
|
2127
2141
|
}
|
|
2128
2142
|
static get Main() {
|
|
2129
|
-
const t =
|
|
2130
|
-
return t || (
|
|
2143
|
+
const t = xs();
|
|
2144
|
+
return t || (oe._main || (oe._main = new oe(), Ts(oe._main)), oe._main);
|
|
2131
2145
|
}
|
|
2132
2146
|
/**
|
|
2133
2147
|
* Set the default environment for this CloudRepository instance
|
|
@@ -2161,39 +2175,39 @@ var st = {
|
|
|
2161
2175
|
* If env/preview not specified and component was preloaded, uses preloaded params
|
|
2162
2176
|
*/
|
|
2163
2177
|
fetchComponentV2(t, n, s) {
|
|
2164
|
-
return
|
|
2165
|
-
const i = this.preloadedComponents[t],
|
|
2166
|
-
let
|
|
2167
|
-
if (!
|
|
2168
|
-
|
|
2178
|
+
return B(this, null, function* () {
|
|
2179
|
+
const i = this.preloadedComponents[t], a = n !== void 0 || s !== void 0;
|
|
2180
|
+
let o, c;
|
|
2181
|
+
if (!a && i)
|
|
2182
|
+
o = i.env, c = i.preview;
|
|
2169
2183
|
else {
|
|
2170
|
-
|
|
2184
|
+
o = n || this._defaultEnv;
|
|
2171
2185
|
const d = n || this._envExplicitlySet;
|
|
2172
2186
|
c = s === !0 ? !0 : s === !1 ? !1 : !d;
|
|
2173
2187
|
}
|
|
2174
|
-
const l = `${t}:${
|
|
2188
|
+
const l = `${t}:${o}:${c ? "preview" : "live"}`;
|
|
2175
2189
|
return console.log("[CloudRepository] fetchComponentV2", {
|
|
2176
2190
|
componentId: t.slice(0, 8) + "...",
|
|
2177
|
-
env:
|
|
2191
|
+
env: o,
|
|
2178
2192
|
usePreview: c,
|
|
2179
2193
|
cacheKey: l,
|
|
2180
2194
|
cached: l in this.variants
|
|
2181
|
-
}), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env:
|
|
2182
|
-
(d, u) =>
|
|
2195
|
+
}), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: o, preview: c }), this.variants[l] = new Promise(
|
|
2196
|
+
(d, u) => B(this, null, function* () {
|
|
2183
2197
|
try {
|
|
2184
|
-
let h = `${this._baseUrl}/consume?id=${t}&env=${
|
|
2198
|
+
let h = `${this._baseUrl}/consume?id=${t}&env=${o}`;
|
|
2185
2199
|
c && (h += "&preview=true");
|
|
2186
|
-
const
|
|
2187
|
-
if (!
|
|
2200
|
+
const f = (yield (yield fetch(h)).json()).item;
|
|
2201
|
+
if (!f) {
|
|
2188
2202
|
u(new Error(`Component "${t}" not found`));
|
|
2189
2203
|
return;
|
|
2190
2204
|
}
|
|
2191
|
-
if (!
|
|
2192
|
-
u(new Error(`Component "${t}" has no implementation for environment "${
|
|
2205
|
+
if (!f.consume_variant || !f.consume_variant.length) {
|
|
2206
|
+
u(new Error(`Component "${t}" has no implementation for environment "${o}"`));
|
|
2193
2207
|
return;
|
|
2194
2208
|
}
|
|
2195
|
-
const
|
|
2196
|
-
d(
|
|
2209
|
+
const I = Ss(f);
|
|
2210
|
+
d(I);
|
|
2197
2211
|
} catch (h) {
|
|
2198
2212
|
u(h);
|
|
2199
2213
|
}
|
|
@@ -2206,19 +2220,19 @@ var st = {
|
|
|
2206
2220
|
* Fetch a v1 component from a flow
|
|
2207
2221
|
*/
|
|
2208
2222
|
fetchComponentV1(t, n) {
|
|
2209
|
-
return
|
|
2223
|
+
return B(this, null, function* () {
|
|
2210
2224
|
return n ? (yield this.fetchFlow(n)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
|
|
2211
2225
|
});
|
|
2212
2226
|
}
|
|
2213
2227
|
fetchAutoFlow(t) {
|
|
2214
|
-
return
|
|
2228
|
+
return B(this, null, function* () {
|
|
2215
2229
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
2216
|
-
(n, s) =>
|
|
2230
|
+
(n, s) => B(this, null, function* () {
|
|
2217
2231
|
try {
|
|
2218
|
-
const
|
|
2232
|
+
const a = yield (yield fetch(
|
|
2219
2233
|
`${this._baseUrl}/flow?id=${t}&auto=true`
|
|
2220
2234
|
)).json();
|
|
2221
|
-
n(
|
|
2235
|
+
n(a.item);
|
|
2222
2236
|
} catch (i) {
|
|
2223
2237
|
s(i);
|
|
2224
2238
|
}
|
|
@@ -2227,14 +2241,14 @@ var st = {
|
|
|
2227
2241
|
});
|
|
2228
2242
|
}
|
|
2229
2243
|
fetchFlow(t) {
|
|
2230
|
-
return
|
|
2244
|
+
return B(this, null, function* () {
|
|
2231
2245
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
2232
|
-
(n, s) =>
|
|
2246
|
+
(n, s) => B(this, null, function* () {
|
|
2233
2247
|
try {
|
|
2234
|
-
const
|
|
2248
|
+
const a = yield (yield fetch(
|
|
2235
2249
|
`${this._baseUrl}/flow?id=${t}&resolve=components`
|
|
2236
2250
|
)).json();
|
|
2237
|
-
n(
|
|
2251
|
+
n(a.item);
|
|
2238
2252
|
} catch (i) {
|
|
2239
2253
|
s(i);
|
|
2240
2254
|
}
|
|
@@ -2248,38 +2262,38 @@ var st = {
|
|
|
2248
2262
|
* Defaults to v1 behavior for backward compatibility with existing code
|
|
2249
2263
|
*/
|
|
2250
2264
|
fetchComponent(t, n) {
|
|
2251
|
-
return
|
|
2265
|
+
return B(this, null, function* () {
|
|
2252
2266
|
return this.fetchComponentV1(t, n);
|
|
2253
2267
|
});
|
|
2254
2268
|
}
|
|
2255
2269
|
};
|
|
2256
|
-
p(
|
|
2257
|
-
var
|
|
2258
|
-
G = new
|
|
2259
|
-
},
|
|
2260
|
-
G = new
|
|
2261
|
-
},
|
|
2270
|
+
p(Yt, "_main", null);
|
|
2271
|
+
var Pe = Yt, G = Pe.Main, Is = () => G, Hs = (e, t, n) => G.isPreloaded(e, t, n), $s = (e) => G.getPreloadedParams(e), Ws = () => {
|
|
2272
|
+
G = new Pe("http://localhost:9292");
|
|
2273
|
+
}, Ks = (e) => {
|
|
2274
|
+
G = new Pe(e);
|
|
2275
|
+
}, Us = (e) => {
|
|
2262
2276
|
G = e;
|
|
2263
|
-
},
|
|
2277
|
+
}, qs = (e) => {
|
|
2264
2278
|
G.setEnvironment(e);
|
|
2265
|
-
},
|
|
2279
|
+
}, js = (e, t, n) => B(void 0, null, function* () {
|
|
2266
2280
|
return Promise.allSettled(
|
|
2267
2281
|
e.map((s) => G.fetchComponentV2(s, t, n))
|
|
2268
2282
|
);
|
|
2269
2283
|
});
|
|
2270
|
-
const
|
|
2271
|
-
const t =
|
|
2272
|
-
return
|
|
2273
|
-
let
|
|
2284
|
+
const Vs = (e) => {
|
|
2285
|
+
const t = N(null), n = N(null), s = N(!1), i = N(null);
|
|
2286
|
+
return he(() => {
|
|
2287
|
+
let a = !1;
|
|
2274
2288
|
s.current = !(t != null && t.current);
|
|
2275
|
-
const
|
|
2289
|
+
const o = async (c) => {
|
|
2276
2290
|
s.current = !0;
|
|
2277
2291
|
try {
|
|
2278
|
-
const l = await
|
|
2292
|
+
const l = await Pe.Main.fetchComponent(
|
|
2279
2293
|
c.componentId,
|
|
2280
2294
|
c.flowId
|
|
2281
2295
|
);
|
|
2282
|
-
n.current = await
|
|
2296
|
+
n.current = await Qe.loadComponent(
|
|
2283
2297
|
l,
|
|
2284
2298
|
t.current,
|
|
2285
2299
|
{
|
|
@@ -2300,19 +2314,19 @@ const Fs = (e) => {
|
|
|
2300
2314
|
// }
|
|
2301
2315
|
}
|
|
2302
2316
|
}
|
|
2303
|
-
),
|
|
2317
|
+
), a ? n.current && n.current.dispose() : c.onReady && c.onReady(n.current);
|
|
2304
2318
|
} catch {
|
|
2305
2319
|
} finally {
|
|
2306
|
-
if (s.current = !1, i.current !== null && !
|
|
2320
|
+
if (s.current = !1, i.current !== null && !a) {
|
|
2307
2321
|
const l = i.current;
|
|
2308
|
-
i.current = null, await
|
|
2322
|
+
i.current = null, await o(l);
|
|
2309
2323
|
}
|
|
2310
2324
|
}
|
|
2311
2325
|
};
|
|
2312
|
-
return s.current ? i.current = { ...e } :
|
|
2313
|
-
|
|
2326
|
+
return s.current ? i.current = { ...e } : o(e).then(), () => {
|
|
2327
|
+
a = !0, n.current && n.current.dispose();
|
|
2314
2328
|
};
|
|
2315
|
-
}, [e.flowId, e.componentId]), /* @__PURE__ */
|
|
2329
|
+
}, [e.flowId, e.componentId]), /* @__PURE__ */ L(
|
|
2316
2330
|
"div",
|
|
2317
2331
|
{
|
|
2318
2332
|
style: {
|
|
@@ -2322,14 +2336,14 @@ const Fs = (e) => {
|
|
|
2322
2336
|
ref: t
|
|
2323
2337
|
}
|
|
2324
2338
|
);
|
|
2325
|
-
},
|
|
2339
|
+
}, Jt = () => /* @__PURE__ */ L(
|
|
2326
2340
|
"svg",
|
|
2327
2341
|
{
|
|
2328
2342
|
width: "80",
|
|
2329
2343
|
viewBox: "0 0 525 243",
|
|
2330
2344
|
fill: "none",
|
|
2331
2345
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2332
|
-
children: /* @__PURE__ */
|
|
2346
|
+
children: /* @__PURE__ */ L(
|
|
2333
2347
|
"path",
|
|
2334
2348
|
{
|
|
2335
2349
|
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",
|
|
@@ -2337,170 +2351,170 @@ const Fs = (e) => {
|
|
|
2337
2351
|
}
|
|
2338
2352
|
)
|
|
2339
2353
|
}
|
|
2340
|
-
),
|
|
2354
|
+
), Rs = ({
|
|
2341
2355
|
opacity: e = 1,
|
|
2342
2356
|
fadeDuration: t = 200,
|
|
2343
2357
|
children: n
|
|
2344
2358
|
}) => {
|
|
2345
2359
|
if (n !== void 0) {
|
|
2346
2360
|
const i = {
|
|
2347
|
-
...
|
|
2361
|
+
...ys,
|
|
2348
2362
|
opacity: e,
|
|
2349
2363
|
transition: `opacity ${t}ms ease-out`
|
|
2350
2364
|
};
|
|
2351
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ L("div", { style: i, children: n });
|
|
2352
2366
|
}
|
|
2353
2367
|
const s = {
|
|
2354
|
-
...
|
|
2368
|
+
...ms,
|
|
2355
2369
|
opacity: e,
|
|
2356
2370
|
transition: `opacity ${t}ms ease-out`
|
|
2357
2371
|
};
|
|
2358
|
-
return /* @__PURE__ */
|
|
2359
|
-
},
|
|
2372
|
+
return /* @__PURE__ */ L("div", { style: s, children: /* @__PURE__ */ L(Jt, {}) });
|
|
2373
|
+
}, Ds = {
|
|
2360
2374
|
position: "absolute",
|
|
2361
2375
|
top: 0,
|
|
2362
2376
|
left: 0,
|
|
2363
2377
|
right: 0,
|
|
2364
2378
|
bottom: 0
|
|
2365
|
-
},
|
|
2366
|
-
var
|
|
2367
|
-
const t =
|
|
2379
|
+
}, ks = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ L("div", { style: Ds, children: e }) : /* @__PURE__ */ L("div", { style: fs, children: /* @__PURE__ */ L(Jt, {}) }), Ls = (e) => `on${e.split("-").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join("")}`, Gs = (e) => {
|
|
2380
|
+
var ee, we, te, _e, Me, be;
|
|
2381
|
+
const t = N(null), n = N(null), s = N(!1), i = N(null), a = e.componentId ? Hs(e.componentId) : !1, [o, c] = se(!a), [l, d] = se(1), [u, h] = se(!1), [m, y] = se(!1), [f, I] = se(void 0), b = e.autoSize ?? !0, [w, E] = se({ fillWidth: !1, fillHeight: !1 }), O = N(!1), A = e.fadeDuration ?? 200, Y = et(() => {
|
|
2368
2382
|
d(0), setTimeout(() => {
|
|
2369
2383
|
c(!1);
|
|
2370
|
-
},
|
|
2371
|
-
}, [
|
|
2372
|
-
(
|
|
2373
|
-
console.error("[MyopComponent] Error:",
|
|
2384
|
+
}, A);
|
|
2385
|
+
}, [A]), ce = et(
|
|
2386
|
+
(_) => {
|
|
2387
|
+
console.error("[MyopComponent] Error:", _), Y(), h(!0), e.onError && e.onError(_);
|
|
2374
2388
|
},
|
|
2375
|
-
[
|
|
2389
|
+
[Y, e.onError]
|
|
2376
2390
|
);
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
}, [e.componentId]),
|
|
2391
|
+
he(() => {
|
|
2392
|
+
O.current = !1;
|
|
2393
|
+
}, [e.componentId]), he(() => {
|
|
2380
2394
|
if (m && e.data !== void 0 && n.current) {
|
|
2381
|
-
if (!
|
|
2382
|
-
|
|
2395
|
+
if (!O.current) {
|
|
2396
|
+
O.current = !0;
|
|
2383
2397
|
return;
|
|
2384
2398
|
}
|
|
2385
|
-
const
|
|
2386
|
-
|
|
2399
|
+
const _ = n.current.props.myop_init_interface;
|
|
2400
|
+
_ && _(e.data);
|
|
2387
2401
|
}
|
|
2388
|
-
}, [e.data, m]),
|
|
2389
|
-
var
|
|
2390
|
-
if (!m || !((
|
|
2402
|
+
}, [e.data, m]), he(() => {
|
|
2403
|
+
var R, T, U, z, J, Q, C;
|
|
2404
|
+
if (!m || !((R = n.current) != null && R.observeAutoSize))
|
|
2391
2405
|
return;
|
|
2392
|
-
let
|
|
2406
|
+
let _ = !0;
|
|
2393
2407
|
return n.current.observeAutoSize({
|
|
2394
2408
|
// SDK resolves: host props → sizeMeta → defaults (width: "100%", height: auto-size)
|
|
2395
|
-
explicitWidth: (
|
|
2396
|
-
explicitHeight: (
|
|
2397
|
-
minWidth: (
|
|
2398
|
-
maxWidth: (
|
|
2399
|
-
minHeight: (
|
|
2400
|
-
maxHeight: (
|
|
2401
|
-
forceAutoSize:
|
|
2409
|
+
explicitWidth: (T = e.style) == null ? void 0 : T.width,
|
|
2410
|
+
explicitHeight: (U = e.style) == null ? void 0 : U.height,
|
|
2411
|
+
minWidth: (z = e.style) == null ? void 0 : z.minWidth,
|
|
2412
|
+
maxWidth: (J = e.style) == null ? void 0 : J.maxWidth,
|
|
2413
|
+
minHeight: (Q = e.style) == null ? void 0 : Q.minHeight,
|
|
2414
|
+
maxHeight: (C = e.style) == null ? void 0 : C.maxHeight,
|
|
2415
|
+
forceAutoSize: b,
|
|
2402
2416
|
loaderMinHeight: 50,
|
|
2403
|
-
onSizeChange: (
|
|
2404
|
-
e.onSizeChange && e.onSizeChange(
|
|
2417
|
+
onSizeChange: (D) => {
|
|
2418
|
+
e.onSizeChange && e.onSizeChange(D) === !1 || (I(D), _ && (_ = !1, Y()));
|
|
2405
2419
|
}
|
|
2406
2420
|
});
|
|
2407
|
-
}, [
|
|
2408
|
-
let
|
|
2421
|
+
}, [b, m, e.onSizeChange, (ee = e.style) == null ? void 0 : ee.width, (we = e.style) == null ? void 0 : we.height, (te = e.style) == null ? void 0 : te.minWidth, (_e = e.style) == null ? void 0 : _e.maxWidth, (Me = e.style) == null ? void 0 : Me.minHeight, (be = e.style) == null ? void 0 : be.maxHeight]), he(() => {
|
|
2422
|
+
let _ = !1;
|
|
2409
2423
|
s.current = !(t != null && t.current);
|
|
2410
|
-
const
|
|
2411
|
-
var
|
|
2424
|
+
const R = async (T) => {
|
|
2425
|
+
var U, z, J, Q;
|
|
2412
2426
|
s.current = !0;
|
|
2413
2427
|
try {
|
|
2414
|
-
if (!
|
|
2415
|
-
|
|
2428
|
+
if (!T.componentId && !T.componentConfig) {
|
|
2429
|
+
ce("No component configuration provided");
|
|
2416
2430
|
return;
|
|
2417
2431
|
}
|
|
2418
|
-
const
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
),
|
|
2423
|
-
|
|
2432
|
+
const C = await Is().fetchComponentV2(
|
|
2433
|
+
T.componentId,
|
|
2434
|
+
T.environment,
|
|
2435
|
+
T.preview
|
|
2436
|
+
), D = await Qe.loadComponent(
|
|
2437
|
+
C,
|
|
2424
2438
|
t.current,
|
|
2425
2439
|
{
|
|
2426
|
-
data:
|
|
2440
|
+
data: T.data,
|
|
2427
2441
|
_environment: {
|
|
2428
|
-
props: { ...
|
|
2442
|
+
props: { ...T }
|
|
2429
2443
|
}
|
|
2430
2444
|
}
|
|
2431
2445
|
);
|
|
2432
|
-
if (
|
|
2433
|
-
|
|
2446
|
+
if (_) {
|
|
2447
|
+
D.dispose();
|
|
2434
2448
|
return;
|
|
2435
2449
|
}
|
|
2436
|
-
if (n.current =
|
|
2450
|
+
if (n.current = D, await n.current.initiated(), _) {
|
|
2437
2451
|
n.current && n.current.dispose();
|
|
2438
2452
|
return;
|
|
2439
2453
|
}
|
|
2440
|
-
if (await new Promise((
|
|
2454
|
+
if (await new Promise((X) => requestAnimationFrame(X)), _ || !n.current || n.current.markedForDisposed) {
|
|
2441
2455
|
n.current && !n.current.markedForDisposed && n.current.dispose();
|
|
2442
2456
|
return;
|
|
2443
2457
|
}
|
|
2444
|
-
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2447
|
-
const
|
|
2448
|
-
(!
|
|
2449
|
-
e.on && e.on(
|
|
2450
|
-
const
|
|
2451
|
-
typeof
|
|
2452
|
-
}),
|
|
2453
|
-
} catch (
|
|
2454
|
-
|
|
2458
|
+
y(!0);
|
|
2459
|
+
const F = (U = n.current) == null ? void 0 : U.sizeMeta, k = (F == null ? void 0 : F.width) === "100%", Ee = (F == null ? void 0 : F.height) === "100%";
|
|
2460
|
+
E({ fillWidth: k, fillHeight: Ee });
|
|
2461
|
+
const Ce = (k || ((z = e.style) == null ? void 0 : z.width)) && (Ee || ((J = e.style) == null ? void 0 : J.height));
|
|
2462
|
+
(!b || Ce) && Y(), (Q = n.current) != null && Q.props && (n.current.props.myop_cta_handler = (X, ue) => {
|
|
2463
|
+
e.on && e.on(X, ue);
|
|
2464
|
+
const Se = Ls(X), ne = e[Se];
|
|
2465
|
+
typeof ne == "function" && ne(ue);
|
|
2466
|
+
}), T.onLoad && n.current && T.onLoad(n.current);
|
|
2467
|
+
} catch (C) {
|
|
2468
|
+
_ || ce((C == null ? void 0 : C.message) || "Unknown error");
|
|
2455
2469
|
} finally {
|
|
2456
|
-
if (s.current = !1, i.current !== null && !
|
|
2457
|
-
const
|
|
2458
|
-
i.current = null, await
|
|
2470
|
+
if (s.current = !1, i.current !== null && !_) {
|
|
2471
|
+
const C = i.current;
|
|
2472
|
+
i.current = null, await R(C);
|
|
2459
2473
|
}
|
|
2460
2474
|
}
|
|
2461
2475
|
};
|
|
2462
|
-
return s.current ? i.current = { ...e } :
|
|
2463
|
-
|
|
2476
|
+
return s.current ? i.current = { ...e } : R(e).then(), () => {
|
|
2477
|
+
_ = !0, n.current && n.current.dispose();
|
|
2464
2478
|
};
|
|
2465
2479
|
}, [e.componentId]);
|
|
2466
|
-
const
|
|
2467
|
-
let
|
|
2468
|
-
return
|
|
2480
|
+
const le = o ? 50 : void 0, H = !b || !m || w.fillHeight;
|
|
2481
|
+
let g, de;
|
|
2482
|
+
return H ? (g = {
|
|
2469
2483
|
position: "relative",
|
|
2470
2484
|
width: "100%",
|
|
2471
2485
|
height: "100%",
|
|
2472
|
-
minHeight:
|
|
2486
|
+
minHeight: le,
|
|
2473
2487
|
...e.style
|
|
2474
|
-
},
|
|
2488
|
+
}, de = {
|
|
2475
2489
|
position: "absolute",
|
|
2476
2490
|
inset: 0
|
|
2477
|
-
}) : (
|
|
2491
|
+
}) : (g = {
|
|
2478
2492
|
position: "relative",
|
|
2479
|
-
width:
|
|
2480
|
-
height: (
|
|
2481
|
-
minHeight:
|
|
2493
|
+
width: f != null && f.autoSizingWidth ? f.width : "100%",
|
|
2494
|
+
height: (f == null ? void 0 : f.height) ?? void 0,
|
|
2495
|
+
minHeight: le,
|
|
2482
2496
|
...e.style
|
|
2483
|
-
},
|
|
2497
|
+
}, de = {
|
|
2484
2498
|
width: "100%",
|
|
2485
|
-
height: (
|
|
2486
|
-
}), /* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
|
|
2489
|
-
u && /* @__PURE__ */
|
|
2499
|
+
height: (f == null ? void 0 : f.height) ?? void 0
|
|
2500
|
+
}), /* @__PURE__ */ tn("div", { style: g, children: [
|
|
2501
|
+
/* @__PURE__ */ L("div", { ref: t, style: de }),
|
|
2502
|
+
o && e.loader !== void 0 && /* @__PURE__ */ L(Rs, { opacity: l, fadeDuration: A, children: e.loader }),
|
|
2503
|
+
u && /* @__PURE__ */ L(ks, { children: e.fallback })
|
|
2490
2504
|
] });
|
|
2491
2505
|
};
|
|
2492
2506
|
export {
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2507
|
+
Gs as MyopComponent,
|
|
2508
|
+
Vs as MyopContainer,
|
|
2509
|
+
ks as MyopFallback,
|
|
2510
|
+
Rs as MyopLoader,
|
|
2511
|
+
Gs as MyopV2Container,
|
|
2512
|
+
Ws as enableLocalDev,
|
|
2513
|
+
Is as getCloudRepository,
|
|
2514
|
+
$s as getPreloadedParams,
|
|
2515
|
+
Hs as isPreloaded,
|
|
2516
|
+
js as preloadComponents,
|
|
2517
|
+
Us as setCloudRepository,
|
|
2518
|
+
Ks as setCloudRepositoryUrl,
|
|
2519
|
+
qs as setEnvironment
|
|
2506
2520
|
};
|