@myop/react 0.0.32 → 0.0.34
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.d.ts +4 -3
- package/dist/index.js +992 -838
- package/dist/index.umd.cjs +23 -23
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const Ot = `"use strict";var MyopSDK=(()=>{var ze=Object.defineProperty,ds=Object.defineProperties,cs=Object.getOwnPropertyDescriptor,ms=Object.getOwnPropertyDescriptors,ls=Object.getOwnPropertyNames,gn=Object.getOwnPropertySymbols;var un=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable;var Dt=(o,t,e)=>t in o?ze(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,h=(o,t)=>{for(var e in t||(t={}))un.call(t,e)&&Dt(o,e,t[e]);if(gn)for(var e of gn(t))fs.call(t,e)&&Dt(o,e,t[e]);return o},N=(o,t)=>ds(o,ms(t));var m=(o,t)=>()=>(o&&(t=o(o=0)),t);var ee=(o,t)=>{for(var e in t)ze(o,e,{get:t[e],enumerable:!0})},gs=(o,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ls(t))!un.call(o,r)&&r!==e&&ze(o,r,{get:()=>t[r],enumerable:!(n=cs(t,r))||n.enumerable});return o};var us=o=>gs(ze({},"__esModule",{value:!0}),o);var s=(o,t,e)=>Dt(o,typeof t!="symbol"?t+"":t,e);var $e,Ue,Bt,z,te=m(()=>{"use strict";$e="__federation__",Ue="onLoad",Bt="moduleInstance",z=(o,t)=>{window[$e]&&window[$e][o]&&window[$e][o][Ue]&&window[$e][o][Ue]({[o]:t})}});var ue,Ne=m(()=>{ue="0.3.13"});var l,I=m(()=>{"use strict";l={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}}});var T,ys,hs,Lt,Ot=m(()=>{"use strict";T=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),ys=o=>{let t=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join("-")},hs=o=>{let t=o.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";let e=atob(t);return Uint8Array.from(e,n=>n.charCodeAt(0))},Lt=o=>{let t=hs(o);if(t.length%16!==0)throw new Error("Invalid input length");let e=[];for(let n=0;n<t.length;n+=16)e.push(ys(t.slice(n,n+16)));return e}});var hn,ne=m(()=>{"use strict";Ot();hn=o=>new Promise(t=>setTimeout(t,o))});var R,C,Pt,v,_,G,k=m(()=>{"use strict";ne();R=class{};s(R,"down","down"),s(R,"up","up");C=class{constructor(){s(this,"id",T());s(this,"myop",!0);s(this,"content");s(this,"source");s(this,"destination");s(this,"route");s(this,"ref");s(this,"direction");s(this,"cleanable",!1)}static create(...t){return new this(...t)}isTypeof(t){return t.messageType===this.messageType}},Pt=class extends C{constructor(e){super();this.ref=e}},v=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;s(this,"handlerUniqueId",T())}},G=class o{constructor(t,e){this.refConfig=t;this.component=e;s(this,"myop",!0);s(this,"__nonProxied");this.__nonProxied=N(h({},this),{component:null})}static create(t,e,n){let r=e;return r||(r={id:"",name:"",description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}}),new o(r,n)}}});var Mn,Kt,oe,In=m(()=>{"use strict";k();Mn="ClickReplayMessage",Kt=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Mn);s(this,"messageType","BindClickMessage");s(this,"cleanable",!0)}},oe=class extends v{constructor(){super(...arguments);s(this,"messageType",Mn)}}});var At,Cn=m(()=>{"use strict";k();At=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","ChangeTextMessage");this.content=n}}});var xn,Ms,Is,wn,D,se,Ft=m(()=>{"use strict";k();xn="ExecuteScriptReplyMessage",Ms=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Is=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,wn=o=>{let t=o.match(Ms);if(t)return t[1]||t[3];{let e=o.match(Is);if(e)return e[1].trim()}},D=class extends _{constructor(e,n=()=>{},r){super(n);this.scriptInputs=r;s(this,"replyMessageKey",xn);s(this,"messageType","ExecuteScriptMessage");s(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=wn(this.content)}};s(D,"replierKey","send"),s(D,"completeStreamKey","completeStream");se=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.content=n;s(this,"messageType",xn)}}});var W,bn=m(()=>{"use strict";Ft();W=class extends D{constructor(e,n,r=()=>{}){super(({rootRef:i,elementId:a,_script:p,__scriptInputs:d})=>{let c=(i.shadowRoot||i.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},r);this.scriptInputs=n;this.scriptInputs=N(h({},n),{_script:e.toString()})}}});var Sn,zt,re,Tn=m(()=>{"use strict";k();Sn="EventListenerCallbackMessage",zt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.type=n;this.handler=r;s(this,"replyMessageKey",Sn);s(this,"messageType","AddEventListenerMessage");s(this,"cleanable",!0);s(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},re=class extends v{constructor(e,n){super(e);this.replayToHandler=e;this.e=n;s(this,"messageType",Sn);this.content={e:n}}}});var $t,En=m(()=>{"use strict";k();$t=class extends C{constructor(e,n,r){super();this.ref=e;this.name=n;this.value=r;s(this,"messageType","SetAttributeMessage")}}});var Rn,Ut,ie,Nt=m(()=>{"use strict";k();Rn="ElementValueReplayMessage",Ut=class extends _{constructor(e,n){super(n);this.ref=e;s(this,"replyMessageKey",Rn);s(this,"messageType","GetElementValueMessage")}},ie=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Rn)}}});var Wt,vn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,n){super();this.ref=e;s(this,"messageType","SetInnerHtml");this.content=n}}});var ye,Re,ae,_n=m(()=>{"use strict";k();ye=class extends C{constructor(e){super();s(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},Re=class extends ye{constructor(){super(...arguments);s(this,"messageType","InitResponse")}},ae=class extends C{constructor(){super(...arguments);s(this,"messageType","InitRequest")}}});var kn,ve,V,We=m(()=>{"use strict";k();kn="RefComponentCreatedMessage",ve=class extends _{constructor(e,n,r,i){super(i);this.refConfig=e;this.nestedComponentConfig=n;this.options=r;s(this,"replyMessageKey",kn);s(this,"messageType","CreateRefComponentMessage")}},V=class extends v{constructor(e,n,r){super(e);this.replayToHandler=e;this.nestedRefs=n;this.failed=r;s(this,"messageType",kn)}}});var _e,Vt=m(()=>{"use strict";k();_e=class extends C{constructor(e,n){super();this.destination=e;this.message=n;s(this,"messageType","EnvelopedMessage");let r=n;this.route=[e,...r.route?r.route:[]]}}});var Hn,qt,pe,Dn=m(()=>{"use strict";k();Hn="DetectedMyopRefsMessage",qt=class extends _{constructor(){super(...arguments);s(this,"messageType","DetectMyopRefsMessage");s(this,"replyMessageKey",Hn)}},pe=class extends v{constructor(e,n){super(e);this.replayToHandler=e;s(this,"messageType",Hn);this.content=n}isTypeof(e){return e.messageType===this.messageType}}});var Bn,jt,ke,Ln=m(()=>{"use strict";k();Bn="GetAttributeReplayMessage",jt=class extends _{constructor(e,n,r){super(r);this.ref=e;this.name=n;s(this,"replyMessageKey",Bn);s(this,"messageType","GetAttributeMessage")}},ke=class extends v{constructor(e){super();this.content=e;s(this,"messageType",Bn)}}});var K,On=m(()=>{"use strict";k();K=class extends C{constructor(e){super();this.method=e;s(this,"messageType","ExecuteComponentMethod")}}});var Gt,He,Pn=m(()=>{"use strict";k();Gt=class extends C{constructor(){super(...arguments);s(this,"messageType","SetMutationObserverMessage")}},He=class extends C{constructor(){super(...arguments);s(this,"messageType","MutationObserverMessage")}}});var Kn,De,Be,An=m(()=>{"use strict";k();Kn="CleanupReplayMessage",De=class extends _{constructor(e,n){super(n);this.cleanupForMessageId=e;s(this,"replyMessageKey",Kn);s(this,"messageType","CleanupMessage")}},Be=class extends v{constructor(e){super();this.customCleanup=e;s(this,"messageType",Kn)}}});var Le,Fn=m(()=>{"use strict";k();Le=class extends C{constructor(){super(...arguments);s(this,"messageType","DisposeMessage")}}});var Jt,Oe,zn=m(()=>{"use strict";k();Jt=class extends C{constructor(){super(...arguments);s(this,"cleanable",!0);s(this,"messageType","SetResizeObserverMessage")}},Oe=class extends C{constructor(){super(...arguments);s(this,"messageType","ResizeObserverMessage")}}});var he={};ee(he,{AddEventListenerMessage:()=>zt,BaseMyopMessage:()=>C,BindClickMessage:()=>Kt,ChangeTextMessage:()=>At,CleanupMessage:()=>De,CleanupReplayMessage:()=>Be,ClickReplayMessage:()=>oe,CreateRefComponentMessage:()=>ve,CustomRefMessage:()=>W,DetectMyopRefsMessage:()=>qt,DetectedMyopRefsMessage:()=>pe,DisposeMessage:()=>Le,ElementValueReplayMessage:()=>ie,EnvelopedMessage:()=>_e,EventListenerCallbackMessage:()=>re,ExecuteComponentMethod:()=>K,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>se,GetAttributeMessage:()=>jt,GetAttributeReplayMessage:()=>ke,GetElementValueMessage:()=>Ut,InitMessage:()=>ye,InitRequest:()=>ae,InitResponse:()=>Re,MessageDirection:()=>R,MutationObserverMessage:()=>He,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>v,MyopElementMessage:()=>Pt,Ref:()=>G,RefComponentCreatedMessage:()=>V,ResizeObserverMessage:()=>Oe,SetAttributeMessage:()=>$t,SetInnerHtml:()=>Wt,SetMutationObserverMessage:()=>Gt,SetResizeObserverMessage:()=>Jt,stripFunction:()=>wn});var w=m(()=>{"use strict";k();In();Cn();Ft();bn();Tn();En();Nt();vn();_n();We();Vt();Dn();Nt();Ln();On();Pn();An();Fn();zn()});var J,Ve=m(()=>{"use strict";I();w();Pe();J=class{constructor(t,e,n){this.componentDefinition=t;this.container=e;s(this,"id","");s(this,"messageHandlers",{});s(this,"element");s(this,"_markedForDisposed",!1);s(this,"bind",(t,e)=>{this.messageHandlers[t]||(this.messageHandlers[t]=[]),this.messageHandlers[t].includes(e)||this.messageHandlers[t].push(e)});s(this,"bindWhen",(t,e,n)=>{if(!n)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[t]||(this.messageHandlers[t]=[]);let r=this.messageHandlers[t],i=a=>e(a)?(n(a),!0):!1;return r.push(i),()=>{let a=r.indexOf(i);a>-1&&r.splice(a,1)}});s(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});s(this,"isInitiated",!1);s(this,"_whenInitiatedResolve");s(this,"_whenInitiatedReject");s(this,"_whenInitiated",new Promise((t,e)=>{this._whenInitiatedResolve=t,this._whenInitiatedReject=e}));s(this,"initiated",()=>this._whenInitiated);s(this,"props",{});s(this,"refs",{});this.id=(n==null?void 0:n.id)||F.Instance().assignId(t);let r=n!=null&&n.timeout?n==null?void 0:n.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(r," ").concat(this.id))},r),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(t){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=t}onMessageReceived(t){if(t.messageType===l.ExecuteComponentMethod){let n=t;return this[n.method]?this[n.method](n.content):console.log("method not found ".concat(n.method," on component"),this),!0}let e=this.messageHandlers[t.messageType];if(e&&e.length){let n=!1;return e.forEach(r=>{n=n||r(t)}),n}return!1}sendCleanupMessage(t){t.source=this.id,t.destination=this.id,t.direction=R.down;let e=this.bindWhen(t.replyMessageKey,r=>r.replayToHandler===t.handlerUniqueId,r=>{t.handler(r),e()}),n=t.handler;delete t.handler,this.send(t),t.handler=n}send(t){t.source||(t.source=this.id),t.destination||(t.destination=this.id),t.direction=R.down;let e;if(t.handler){let n=t;e=this.bindWhen(n.replyMessageKey,r=>r.replayToHandler===n.handlerUniqueId,n.handler),delete t.handler}return t.ref&&(t.ref=t.ref.__nonProxied||t.ref),t.cleanable?()=>{this.sendCleanupMessage(new De(t.id,n=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Le);let t=this.messageHandlers.onDispose;t&&t.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var Me,$n=m(()=>{"use strict";Me=class{constructor(t,e,n,r,i){this.myopId=t;this.htmlTagName=e;this.BoundingRect=n;this.offsetTop=r;this.offsetLeft=i;s(this,"type","MyopElementRef")}}});var Un,x,qe,Nn=m(()=>{"use strict";Un=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let t=await o;typeof t=="function"&&t()}},x=class{constructor(t){this.messageToHost=t}},qe=class extends x{constructor(e,n){super(e);this.messageToHost=e;this.context=n}}});var Yt,Ie,Wn=m(()=>{"use strict";I();b();w();Yt=class{constructor(t,e){this.id=t;this.context=e;s(this,"send",t=>{})}},Ie=class{constructor(){s(this,"messageToHandleAfterInit",[]);s(this,"components",{});s(this,"alwaysPassEnvelopesToHost",!1);s(this,"messageCleanupCache",{})}handleIncomeMessages(t){let e=t.data?t.data:t.detail;if(!(!e||!e.myop)){let n=e;if(n.direction!==R.down)return;if(n.messageType===l.DisposeMessage){n.destination&&delete this.components[n.destination];return}if(n.messageType===l.InitMessage){let r=n.content.id;if(this.components[r])return;this.components[r]=new Yt(r),this.messageToHost(new Re(r));return}if(n.messageType===l.EnvelopedMessage){let r=n,i=r.message;if(n=i,this.alwaysPassEnvelopesToHost||this.components[n.destination]){let a=myop.hostSDK.components.find(d=>d.id===i.destination);if(a){a.send(i);return}let p=myop.hostSDK.components.find(d=>d.id===r.destination);if(p){p.send(i);return}}else return}if(n.messageType){if(n.messageType===l.CleanupMessage){let i=n,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Be(!!a);p.destination=n.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],Un(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let r=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===n.messageType){r=!0;let a=i.executor(n);if(n.cleanable&&a&&(this.messageCleanupCache[n.id]=a),a&&!n.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(n.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&n.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(n.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}}});var q,de,we,Ce,ce,je,xe,b=m(()=>{"use strict";$n();Nn();Wn();q={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},de={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},we={message:"message",code:"code"},Ce=class{};s(Ce,"code","code"),s(Ce,"component","component");ce={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},je={Segment:"Segment",Promo:"Promo",AB:"AB"},xe=class{constructor(t,e){this.container=t;this.shadowRoot=e;s(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));s(this,"getRoot",()=>this.shadowRoot||this.container)}}});var Xt,Cs,Qt,P,me=m(()=>{"use strict";Xt=o=>o!==Object(o),Cs=o=>typeof o=="function",Qt=o=>{if(Xt(o))return!0;if(Cs(o)||Object.getPrototypeOf(o))return!1;for(let t in o){let e=o[t];if(typeof e=="object"){if(!Qt(e))return!1}else{if(Xt(e))continue;return!1}}return!0},P=(o,t={},e=!0,n=new WeakMap)=>{if(Xt(o))return o;if(Array.isArray(o)){if(n.has(o))return n.get(o);let r=[];n.set(o,r);for(let i=0;i<o.length;i++){let a=o[i];r[i]=P(a,t,e,n)}return r}if(o!==null&&typeof o=="object"){if(n.has(o))return n.get(o);let r={};n.set(o,r);for(let i in o){let a=typeof t=="boolean"?t:t[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(r[i]=P(o[i],!0,e,n)):typeof a=="object"&&(r[i]=P(o[i],a,e,n)))}return r}return{}}});var Vn,qn=m(()=>{"use strict";Vn={notSerializableRefCall:(o,t)=>{throw new Error("\\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \\nThe following types of data are considered non-serializable and cannot be processed:\\n\\n- Functions\\n- DOM elements\\n- Class instances\\n- Circular references\\n- Symbols\\n- BigInt values\\n\\nIn the following execution we detected :\\n~~~~~~~~\\n").concat(t," \\n~~~~~~~~\\nas not serializable.\\n\\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \\nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\\n\\nSuggested Fix:\\n1. Remove or replace non-serializable values from your input.\\n2. If using objects, ensure they do not contain any functions or circular references.\\n3. Convert any class instances to plain objects or JSON-compatible formats.\\n4. Use dedicated Myop message.\\n\\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\\n\\n"))}}});var Ke,jn=m(()=>{"use strict";Ve();w();Vt();Ke=class extends J{constructor(e,n,r){super(e,n.container,r);this.componentDefinition=e;this.parent=n;s(this,"send",e=>{let n=e.handler,r=super.send(e);return this.parent.send(new _e(this.id,e)),e.handler=n,r});s(this,"dispose",()=>{this.isInitiated&&this.send(new K("dispose")),super.dispose()})}hide(){this.send(new K("hide"))}show(){this.send(new K("show"))}inspect(){return this.send(new K("inspect"))}setHeightBasedOnDocumentElement(){this.send(new K("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new K("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var xs,Ge,Gn,Jn,Yn,ws,Zt,en,Je=m(()=>{"use strict";w();w();b();me();qn();jn();xs=(o,t,e)=>{let n=document.createElement("a");return n.textContent=o,n.style.position="relative",n.style.padding="0 5px",n.style.fontSize="14px",n.style.top="0",n.style.top="".concat(t,"px"),n.style.transform="translateX(-50%)",n.target="_blank",n.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),n},Ge=(o,t,e,n,r,i)=>{let a=xs("".concat(i.name," : ").concat(t),e,i);return n.insertBefore(a,r),r.style.border="1px solid #007BFF",r.style.display="block",()=>{r.style.border="unset",n.removeChild(a)}},Gn=(o,t,e)=>o?!1:(console.error("Error: Undefined Prop\\n\\nIt looks like you've tried to use a prop that hasn't been defined.\\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\\n\\n"+"Prop Name: ".concat(t,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),Jn=(o,t,e)=>{console.error("Error: Code Prop Not Supported\\n\\nCurrently, code props are only supported in local frame components.\\n\\u26A0\\uFE0F This is a work in progress feature \\u2014 code props will be supported in upcoming versions.\\n\\nIn the meantime, you can use message props.\\n\\n"+"Prop Name: ".concat(t,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},Yn=(o,t,e)=>{let n=t.reduce((i,a)=>N(h({},i),{[a.name]:h({},a)}),{}),r={get:(i,a)=>{let p=n[a];if(Gn(p,a,o))return!1;if(p.behavior.type===we.code){if(e.loader.type===q.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return Jn(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(G.create(p.behavior.ref)),c.push(f=>{d(f)}),p.behavior.params&&c.push(...p.behavior.params);let g=he[p.behavior.message];o.send(new g(...c))}):null},set:(i,a,p)=>{let d=n[a];if(Gn(d,a,o))return!1;if(d.behavior.type===we.code){if(e.loader.type===q.HTMLLoader&&e.loader.shadowRootMode===de.localFrame){let g=d.behavior,f=o.element.contentWindow,u=g.remap||a;if(f[u]=p,u==="myop_cta_handler"&&f.__myop_cta_queue){let y=f.__myop_cta_queue;f.__myop_cta_queue=null,y.forEach(M=>{o.markedForDisposed||p(M.action,M.payload)})}return!0}return Jn(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(G.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let g=he[d.behavior.message];return o.send(new g(...c)),!0}else throw new Error("Error: Unsupported Behavior\\n\\nThe 'behavior' field provided is not supported.\\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\\n\\n")+"Prop Name: ".concat(a,"\\n")+"Behavior Field: ".concat(d.behavior.type,"\\n\\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,r),o},ws=(o,t)=>new Proxy(o,{get(e,n){return e[n]?e[n]:(...i)=>new Promise(a=>{i.forEach(p=>{Qt(p)||Vn.notSerializableRefCall(n,p)}),t.send(new W(({ref:p,propName:d,functionArgs:c,makeSerializable:g})=>{if(p){let f=p[d];return g(typeof f=="function"?p[d](...c):f,!0)}return null},{elementId:e.refConfig.selector,propName:n,functionArgs:i},p=>{a(p.content)}))})},set(e,n,r){return t.send(new W(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:r,propName:n},i=>{})),!0}}),Zt=async(o,t,e,n)=>{let r=o.component;if(!r)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new Ke(t.type,r,n);e.push(p),await r.initiated();let d=setTimeout(()=>{a("timeout")},5e3);r.send(new ve(o.refConfig,t,N(h({},n||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let g=e.find(f=>f.id==p.id);if(g!==p){r.refs[o.refConfig.name]=g,i(g);return}else p.setInitiated(),r.refs[o.refConfig.name]=p;c.nestedRefs.forEach(f=>{let u=t.instance.resolvedNestedComponents.find(M=>M.type.id===f.componentDefinitionId).type,y=new Ke(u,p);y.setInitiated(),p.refs[f.refName]=y,e.push(y)});try{await en(p,t,e,!0),r.setHeightBasedOnScrollHeight&&r.setHeightBasedOnScrollHeight(),i(p)}catch(f){a(f)}}))})},en=async(o,t,e,n=!1)=>{o.refs||(o.refs={});let r=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==Ce.component){if(n){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let g=(d=t.instance.resolvedNestedComponents)==null?void 0:d.find(u=>u.type.id===c);if(!g)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let f=G.create("",i,o);try{let u=await Zt(f,g,e);o.refs[i.name]=u,a()}catch(u){p(u)}}else try{let c=G.create("",i,o);o.refs[i.name]=ws(c,o),a()}catch(c){}}));try{await Promise.all(r)}catch(i){throw i}}});var be,tn=m(()=>{"use strict";Ve();w();Je();I();be=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.componentConfig=e;this.container=r;this.IframeElement=i;s(this,"cleanupInspect");s(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,n=>{this.IframeElement.style.height="".concat(n.content,"px"),e()}))});s(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:n})=>{let{height:r,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();n({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:r,width:i}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px")})));s(this,"observeAutoSize",e=>{var Ee;let n=this.IframeElement,r=n.contentDocument;if(!r)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(O,U,ge)=>U!==void 0&&O<U?U:ge!==void 0&&O>ge?ge:O,a=O=>{if(O===void 0)return;if(typeof O=="number")return O;let U=parseFloat(O);return isNaN(U)?void 0:U},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),g=a(e==null?void 0:e.maxHeight),f=(Ee=e==null?void 0:e.loaderMinHeight)!=null?Ee:50,u=(e==null?void 0:e.explicitWidth)!==void 0,y=(e==null?void 0:e.explicitHeight)!==void 0,M=this.container.getBoundingClientRect(),le=M.width===0,Fe=M.height===0||M.height===f,j=(e!=null&&e.forceAutoSize||le)&&!u,H=(e!=null&&e.forceAutoSize||Fe)&&!y;if(!j&&!H)return()=>{};let A=()=>{var U;let O=n.contentDocument;if(O){let ge=O.documentElement.getBoundingClientRect(),cn=Math.ceil(ge.width),mn=Math.ceil(ge.height),ln=i(cn,p,d),fn=i(mn,c,g);j&&(n.style.width="".concat(ln,"px")),H&&(n.style.height="".concat(fn,"px"));let as=j&&d!==void 0&&cn>d,ps=H&&g!==void 0&&mn>g;O.documentElement.style.overflowX=as?"auto":"hidden",O.documentElement.style.overflowY=ps?"auto":"hidden",(U=e==null?void 0:e.onSizeChange)==null||U.call(e,{width:ln,height:fn,autoSizingWidth:j,autoSizingHeight:H})}};A();let fe=new ResizeObserver(A);return fe.observe(r.body),fe.observe(r.documentElement),()=>{fe.disconnect()}});s(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:n,width:r}=document.documentElement.getBoundingClientRect();return{height:n,width:r}},n=>{this.IframeElement.style.width="".concat(n.content.width,"px"),this.IframeElement.style.height="".concat(n.content.height,"px"),e()}))});s(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let r=0;return r++,r--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+r+"px"},n=>{this.IframeElement.style.height=n.content,e()}))});s(this,"send",e=>{var i,a;let n=h({},e);if(n.messageType===l.ExecuteComponentMethod)return this[n.method](),()=>{};n.direction=R.down;let r=super.send(n);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(n,"*"),r});s(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});n.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Ge(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===l.In.MutationObserverMessage||e.messageType===l.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Y,Ye=m(()=>{"use strict";Y=class{constructor(){s(this,"appendChild",(t,e,n)=>{var r;if(n!=null&&n.relative){if(n.relative.direction==="before")return t.insertBefore(e,n.relative.child);if(n.relative.direction==="after"){let i=(r=n.relative.child)==null?void 0:r.nextSibling;return t.insertBefore(e,i||null)}}else return t.appendChild(e)})}}});var bs,Xe,Xn=m(()=>{"use strict";tn();Ye();ne();b();bs=(o,t,e)=>{let n=new URL(o);return n.searchParams.append(t,e),n.toString()},Xe=class extends Y{constructor(){super(...arguments);s(this,"type",q.IframeLoader);s(this,"load",async(e,n,r,i)=>{let a,p=n.loader;if((r==null?void 0:r.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,r),a=r,a.src=p.url;else{let d=T(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let g="\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n height: ".concat(p.autoHeight||!p.height?"100%":p.height,";\\n width: 100%;\\n overflow: hidden;\\n border: none;\\n opacity: ").concat(i!=null&&i.hidden?"0":"1",";\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n ");a.style.cssText=g,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([u,y])=>{y===""||y===null||y===void 0?a.setAttribute(u,""):a.setAttribute(u,String(y))});let f=n.loader.url;i!=null&&i._hasParent&&(f=bs(f,"_myop-comp",d)),a.src=f,r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),a=this.appendChild(r,a,i)}return new be(e,n,r,a,i)})}}});var Qe,nn=m(()=>{"use strict";Qe={webcomponent_message_key:"myop_webcomponent_message"}});var Se,on=m(()=>{"use strict";nn();Ve();Je();Se=class extends J{constructor(e,n,r,i,a){super(e,r,a);this.container=r;this.customElement=i;s(this,"cleanupInspect",()=>{});s(this,"send",e=>{let n=h({},e),r=super.send(n),i=new CustomEvent(Qe.webcomponent_message_key,{detail:n});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return r});s(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=Ge(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}}});var sn,Ze,Qn=m(()=>{"use strict";on();Ye();ne();b();sn={},Ze=class extends Y{constructor(){super(...arguments);s(this,"type",q.WebComponentLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader;sn[a.url]?console.log("Module alreday loaded or in loading process"):sn[a.url]=new Promise((c,g)=>{let f=a.url,u=document.createElement("script");u.type="module",u.src=f,u.onload=()=>{c()},u.onerror=()=>{g()},document.head.appendChild(u)}),await sn[a.url],await hn(1);let p="myop-comp-".concat(T()),d=document.createElement(a.tag);return r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),i!=null&&i._environment&&(d._myopEnvironment=i==null?void 0:i._environment),this.appendChild(r,d,i),new Se(e,n,r,d,i)})}}});var E,$=m(()=>{"use strict";b();E=class extends qe{constructor(e,n){super(e);this.context=n;s(this,"executor",e=>{if(e.destination){let n=e.destination;if(this.context[n].context){let r=(i,a)=>{this.messageToHost(N(h({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[n].context,r)}else debugger}else debugger})}}});var B,X=m(()=>{"use strict";B={id:"myop-id"}});var S,Zn,L=m(()=>{"use strict";X();S=(o,t)=>t.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),Zn=(o,t)=>{let e=S(o,t);return e.length?e.item(0):null}});var et,eo=m(()=>{"use strict";I();w();$();L();et=class extends E{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{r(new oe(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var tt,to=m(()=>{"use strict";I();$();L();tt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var nt,no=m(()=>{"use strict";b();nt=class extends xe{constructor(e,n){super(e,n);this.container=e;this.shadowRoot=n}}});var ot,oo=m(()=>{"use strict";b();X();$();w();I();ot=class extends E{constructor(){super(...arguments);s(this,"innerExecutor",(e,n)=>{let r=n.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];r.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new Me(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new pe(e.handlerUniqueId,i))});s(this,"messageType",l.DetectMyopRefsMessage)}}});var st,so=m(()=>{"use strict";I();$();L();st=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var rt,ro=m(()=>{"use strict";I();w();$();L();me();rt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"innerExecutor",(e,n,r)=>{let i=S(e.ref,n.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{r(new re(e.handlerUniqueId,P(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var it,io=m(()=>{"use strict";I();X();Pe();We();$();it=class extends E{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"innerExecutor",(e,n,r)=>{(async()=>{let a=n.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=F.Instance(),d=p.components.find(u=>u.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let g=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),f=[];Object.keys(g.refs).forEach(u=>{let y=g.refs[u];y=y.__nonProxied||y,y.componentDefinition&&f.push({refName:u,componentDefinitionId:y.componentDefinition.id})}),r(new V(e.handlerUniqueId,f))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var at,rn=m(()=>{"use strict";me();at=(o,t,e)=>{let n=o.scriptInputs?o.scriptInputs:{};n.makeSerializable=P,n.send=t,n.rootRef=e,n.__scriptInputs=n;let i=new Function("return (".concat(o.script,")(...arguments)"))(n);t(i)}});var pt,ao=m(()=>{"use strict";I();w();$();rn();pt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"innerExecutor",(e,n,r)=>{at(e,a=>{r(new se(e.handlerUniqueId,a))},n)})}}});var po,dt,co=m(()=>{"use strict";I();w();$();L();X();me();po=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:po(i),required:i.required,validity:P(i.validity,!0),myopId:a};p?e.formData[p]?e.formData[p].value?e.unmappedData.push(d):(e.unmappedData.push(e.formData[p]),e.formData[p]=d):e.formData[p]=d:e.unmappedData.push(d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},dt=class extends E{constructor(){super(...arguments);s(this,"messageType",l.GetElementValueMessage);s(this,"innerExecutor",(e,n,r)=>{S(e.ref,n.shadowRoot).forEach(a=>{r(new ie(po(a)),e)})})}}});var ct,mo=m(()=>{"use strict";I();$();L();ct=class extends E{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"innerExecutor",(e,n)=>{S(e.ref,n.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var lo={};ee(lo,{WebComponentSDK:()=>Te});var Te,an=m(()=>{"use strict";b();I();nn();eo();to();no();oo();te();w();so();ro();io();ao();co();mo();Te=class extends Ie{constructor(){super(...arguments);s(this,"alwaysPassEnvelopesToHost",!0);s(this,"connectedCallback",(e,n)=>{e.addEventListener(Qe.webcomponent_message_key,r=>{let i=r.data?r.data:r.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(r),a.messageType===l.InitMessage){let p=a.content.id;this.components[p].context=new nt(e,n)}}}),setTimeout(()=>{this.messageToHost(new ae)},1)});s(this,"messageToHost",(e,n)=>{e.direction=R.up,!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId),window.myop.hostSDK.send(e)});s(this,"supportedHandlers",[new tt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new et(this.messageToHost,this.components),new ot(this.messageToHost,this.components),new st(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new pt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new it(this.messageToHost,this.components)]);s(this,"init",()=>{})}};z("WebComponentSDK",Te)});var fo=m(()=>{"use strict";an()});var go,uo=m(()=>{"use strict";go=""});function Ss(o,t){return class extends HTMLElement{connectedCallback(){let e=t===de.open?"open":"closed",n=this.attachShadow({mode:e});Mo().then(r=>{r.connectedCallback(this,n),n.innerHTML=o})}}}var ho,mt,Mo,Ts,Es,Rs,lt,Io=m(()=>{"use strict";on();Ye();ne();b();fo();tn();uo();ho=[],Mo=async()=>(mt||(mt=new Te,mt.init()),mt);Ts=(o,t,e)=>{customElements.define(o,Ss(t,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Es=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Rs=o=>(o=Es(o),o.replace(/_/g,"-")),lt=class extends Y{constructor(){super(...arguments);s(this,"type",q.HTMLLoader);s(this,"load",async(e,n,r,i)=>{let a=n.loader,p="myop-comp-".concat(T()),d;if(a.shadowRootMode===de.localFrame){let c=T(),g="myop-comp-".concat(c),f=document.createElement("iframe");f.id=g,f.style.cssText="\\n display: block;\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n overflow: hidden;\\n border: none;\\n opacity: ".concat(i!=null&&i.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n "),r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),f=this.appendChild(r,f,i);let u=f.contentDocument||f.contentWindow.document;u.open();let y=a.HTML;if(i!=null&&i._inspection){let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A==null||A.removeAttribute("type");let fe=H.implementation.createHTMLDocument();fe.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let Ee=fe.body.firstChild;Ee&&H.head&&H.head.insertBefore(H.importNode(Ee,!0),H.head.firstChild),y=H.documentElement.outerHTML}else{let H=new DOMParser().parseFromString(a.HTML,"text/html"),A=H.getElementById("myop_preview");A&&(A.remove(),y=H.documentElement.outerHTML)}u.writeln(y);let M='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),le="<script>\\n window.__federation__.__public_path__ = window.__federation__.__public_path__;\\n const __myop_init = async () => {\\n const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());\\n const sdk = new IframeSDK();\\n sdk.init();\\n }\\n __myop_init().then();\\n <\\/script>";if(u.writeln("".concat(M).concat(le)),(i==null?void 0:i.data)!==void 0){let j="<script>\\n window.__myop_cta_queue = [];\\n window.myop_cta_handler = function(action, payload) {\\n window.__myop_cta_queue.push({action: action, payload: payload});\\n };\\n <\\/script>",H=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),A='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(H,";\\n var scriptEl = document.getElementById('__myop_init_data_script');\\n\\n var callInitInterface = function(fn) {\\n var startTime = performance.now();\\n // Mark as pre-injected data call for extension tracking\\n window.__myop_init_preinjected = true;\\n try {\\n fn(data);\\n } finally {\\n window.__myop_init_preinjected = false;\\n }\\n var duration = performance.now() - startTime;\\n\\n // Notify extension via postMessage (init* = pre-injected)\\n try {\\n window.parent.postMessage({\\n type: 'MYOP_PREINJECTED_INIT',\\n payload: {\\n data: data,\\n duration: duration,\\n timestamp: Date.now()\\n }\\n }, '*');\\n } catch (e) {}\\n\\n // Cleanup: remove script tag and stored data\\n if (scriptEl && scriptEl.parentNode) {\\n scriptEl.parentNode.removeChild(scriptEl);\\n }\\n delete window.__myop_init_data;\\n };\\n\\n if (typeof window.myop_init_interface === 'function') {\\n // Function already exists - call immediately\\n callInitInterface(window.myop_init_interface);\\n } else {\\n // Function not yet defined - store data and watch for definition\\n window.__myop_init_data = data;\\n\\n var _original;\\n Object.defineProperty(window, 'myop_init_interface', {\\n configurable: true,\\n enumerable: true,\\n set: function(fn) {\\n _original = fn;\\n if (window.__myop_init_data !== undefined) {\\n var storedData = window.__myop_init_data;\\n delete window.__myop_init_data;\\n callInitInterface(fn);\\n }\\n },\\n get: function() {\\n return _original;\\n }\\n });\\n }\\n })();\\n <\\/script>");u.writeln(j+A)}u.close();let Fe=new be(e,n,r,f,i);return a.autoHeight&&(f.onload=()=>{Fe.observeSizeBasedOnDocumentElement()}),Fe}if(a.shadowRootMode===de.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Mo().then(g=>{g.connectedCallback(d,d)})}else{let c=Rs(e.name+n.id);ho.includes(c)||(Ts(c,a.HTML,a.shadowRootMode),ho.push(c)),d=document.createElement(c)}return r.querySelector('[id^="myop-comp-"]')||(r.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(r,d,i),new Se(e,n,r,d,i)})}}});var Co,xo,wo=m(()=>{"use strict";ne();w();Co=(o,t,e)=>{let n="myop-css-".concat(T());return o.send(new D(({rootRef:r,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let g in i){c+="".concat(g," { ");let f=i[g];for(let u in f)c+="".concat(u,": ").concat(f[u],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(r.shadowRoot||r.container).appendChild(d)},()=>{},{_stylesheet:t,_css:e||"",_tagId:n})),()=>{o.send(new D(({rootRef:r,_tagId:i})=>{let a=(r.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:n}))}},xo=(o,t)=>{let e="myop-css-".concat(T());return o.send(new D(({rootRef:n,_tagId:r,_link:i})=>{let a=document.createElement("link");a.id=r,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(n.shadowRoot||n.container).appendChild(a)},()=>{},{_link:t,_tagId:e})),()=>{o.send(new D(({rootRef:n,_tagId:r})=>{let i=(n.shadowRoot||document).getElementById(r);i&&i.remove()},()=>{},{_tagId:e}))}}});var vs,pn,bo,So=m(()=>{"use strict";vs=(o,t)=>{let e=new RegExp(Object.keys(t).join("|"),"g");return o.replace(e,n=>(t[n]||n).toString())},pn=(o,t)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=h({},o.loader),o.loader.url=vs(o.loader.url,t),o},bo=o=>async t=>pn(t,o)});var To,Eo,Ro=m(()=>{"use strict";w();To=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.add(r)},{elementId:e,_className:t}))},Eo=(o,t,e)=>{o.send(new W(({ref:n,_className:r})=>{n==null||n.classList.remove(r)},{elementId:e,_className:t}))}});var ut,ft,yt,gt,vo=m(()=>{"use strict";ne();ut=class ut{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"id",this._runTimeId);s(this,"name",this._runTimeName);s(this,"description","");s(this,"loader",null);s(this,"withLoader",t=>(this.loader=t,this));s(this,"withHTMLLoader",t=>(t.type="HTMLLoader",this.loader=t,this));s(this,"build",()=>this)}};s(ut,"create",()=>new ut);ft=ut,yt=class yt{constructor(){s(this,"_runTimeInstanceId","runtime-instance-id-"+T());s(this,"_runTimeId","runtime-id-"+T());s(this,"_runTimeName","runtime-name-"+T());s(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});s(this,"name",this._runTimeName);s(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});s(this,"withInstance",t=>(this.instance=t,this));s(this,"withType",t=>(this.type=t,this));s(this,"withName",t=>(this.name=t,this));s(this,"withDefaultSkin",t=>(this.type.skins.push(t),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:t.id}},this));s(this,"withRef",t=>(this.type.refs.push(t),this));s(this,"withBasicRef",t=>{let e={id:"",name:t,description:"",selectorType:"id-attribute",selector:t,behavior:{type:"code"}};return this.type.refs.push(e),this});s(this,"build",()=>JSON.parse(JSON.stringify(this)))}};s(yt,"create",()=>new yt);gt=yt});var _s,ht,ks,Hs,Q,Z,_o,ko=m(()=>{"use strict";b();_s=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:we.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:we.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),ht="__MYOP_CLOUD_REPOSITORY_MAIN__",ks=()=>{if(typeof window<"u")return window[ht];if(typeof globalThis<"u")return globalThis[ht]},Hs=o=>{typeof window<"u"&&(window[ht]=o),typeof globalThis<"u"&&(globalThis[ht]=o)},Q=class Q{constructor(t="https://cloud.myop.dev"){this._baseUrl=t;s(this,"variants",{});s(this,"preloadedComponents",{});s(this,"userFlows",{});s(this,"_defaultEnv","production")}static get Main(){let t=ks();return t||(Q._main||(Q._main=new Q,Hs(Q._main)),Q._main)}setEnvironment(t){this._defaultEnv=t}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(t,e,n){return e!==void 0||n!==void 0?"".concat(t,":").concat(e||this._defaultEnv,":").concat(n?"preview":"live")in this.variants:t in this.preloadedComponents}getPreloadedParams(t){return this.preloadedComponents[t]}async fetchComponentV2(t,e,n){let r=this.preloadedComponents[t],i=e!==void 0||n!==void 0,a,p;!i&&r?(a=r.env,p=r.preview):(a=e||this._defaultEnv,p=n===!0?!0:n===!1?!1:!e);let d="".concat(t,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:t.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[t]||(this.preloadedComponents[t]={env:a,preview:p}),this.variants[d]=new Promise(async(c,g)=>{try{let f="".concat(this._baseUrl,"/consume?id=").concat(t,"&env=").concat(a);p&&(f+="&preview=true");let M=(await(await fetch(f)).json()).item;if(!M){g(new Error('Component "'.concat(t,'" not found')));return}if(!M.consume_variant||!M.consume_variant.length){g(new Error('Component "'.concat(t,'" has no implementation for environment "').concat(a,'"')));return}let le=_s(M);c(le)}catch(f){g(f)}})),await this.variants[d]}async fetchComponentV1(t,e){return e?(await this.fetchFlow(e)).components.find(r=>r.type.id===t):(await this.fetchAutoFlow(t)).components[0]}async fetchAutoFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&auto=true"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchFlow(t){return this.userFlows[t]||(this.userFlows[t]=new Promise(async(e,n)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(t,"&resolve=components"))).json();e(i.item)}catch(r){n(r)}})),await this.userFlows[t]}async fetchComponent(t,e){return this.fetchComponentV1(t,e)}};s(Q,"_main",null);Z=Q,_o=Z});var Ho,Do=m(()=>{"use strict";Ho=async o=>await o()});var dn={};ee(dn,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var Mt=m(()=>{"use strict";wo();So();Ro();vo();ko();Do()});var Bo,Lo=m(()=>{"use strict";Ot();Mt();b();Bo=async o=>{try{let t=new URL(window.location.href),n=new URLSearchParams(t.search).get("myopOverride");if(n){let[r,...i]=Lt(n);switch(r){case"component":{let[a,p]=i,d=await Z.Main.fetchComponent(a);if(d&&d.type.skins.find(g=>g.id===p))return d.instance.skinSelector={type:ce.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Lt(n),c=(await Z.Main.fetchFlow(a)).components.find(g=>g.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ce.Segmented&&c.instance.resolvedExperiences){let g=c.instance.resolvedExperiences.find(f=>f.id===p);if((g==null?void 0:g.type)===je.Segment){let f=g,y=c.instance.skinSelector.segments.find(M=>M.segmentId===f.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Ko={};ee(Ko,{HostSDK:()=>F,hostSDK:()=>Po});var Oo,F,Po,Pe=m(()=>{"use strict";te();I();w();Xn();Qn();Je();b();Ne();Io();Lo();Oo="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",F=class{constructor(){s(this,"components2init",[]);s(this,"components",[]);s(this,"componentsLoaders",[]);s(this,"initiated",!1);s(this,"version",ue);s(this,"type2InstanceCount",{});s(this,"assignId",t=>(this.type2InstanceCount[t.id]||(this.type2InstanceCount[t.id]=0),"".concat(t.id,"_").concat(++this.type2InstanceCount[t.id])));s(this,"inspected",!1);s(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(t=>{t.inspect&&t.inspect()}))});s(this,"incomingMessageHandler",t=>{if(t.origin,document.location.origin,t.data.myop){if(t.data.direction!==R.up&&t.data.messageType!==l.EnvelopedMessage)return;let e=t.data;if(e.messageType===l.InitRequest){this.components2init.forEach(r=>{r.send(new ye(r.id))});return}if(e.messageType===l.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let r=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});r==null||r.setInitiated();return}if(e.messageType===l.EnvelopedMessage){let r=e,i=this.components.find(a=>a.id===r.destination);if(i){if(r.direction===R.down){r.message.messageType===K.name?i.onMessageReceived(r.message):(r.message.route=r.route,i.send(r.message));return}}else{let a=this.components.find(p=>p.id===r.message.destination);a&&a.send(r.message)}return}let n=this.components.find(r=>r.id===e.destination);if(!n){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(n){if(n.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});s(this,"send",t=>{let e=new MessageEvent("",{data:t});this.incomingMessageHandler(e)});s(this,"init",t=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Xe,new Ze,new lt];if(this.componentsLoaders=[...e],t){let n={};t.forEach(r=>{let i=new r(this.componentsLoaders);n[i.type]=i}),this.componentsLoaders.forEach(r=>{n[r.type]||(n[r.type]=r)}),this.componentsLoaders=Object.values(n)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});s(this,"_getSkinIdBySkinSelector",async(t,e=[],n)=>{var i;async function r(a,p){for(let d of a)if(await p(d))return d}switch(t.type){case"DedicatedSkin":case ce.Dedicated:return((i=t.skin)==null?void 0:i.id)||t.skins[0].id;case ce.Segmented:{let p=await r(t.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===je.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let f=c.segment,u=(n||{})[f.function];return u?await u():(console.warn("segmentId:".concat(d.segmentId,", ").concat(f.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});s(this,"runSkinSelector",async(t,e)=>{let n=await this._getSkinIdBySkinSelector(t.instance.skinSelector,t.instance.resolvedExperiences,e);return t.type.skins.find(r=>r.id===n)});s(this,"loaderHooks");s(this,"loadComponent",async(t,e,n)=>{var g,f,u,y;if(!e){debugger;throw new Error("no container was found for this component")}let r=await Bo(t);r&&(t=r);let i=h(h({},(g=this.loaderHooks)!=null?g:{}),(f=n==null?void 0:n.hooks)!=null?f:{}),a=e;if(a.myop)if(a.component){t=h({},t),t.instance=h({},t.instance);let M=await this.runSkinSelector(t,i);if(!M)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(u=n==null?void 0:n.hooks)!=null&&u.afterSkinSelected&&(M=await n.hooks.afterSkinSelected(h({},M))),t.instance.skinSelector={type:ce.Dedicated,skin:M},n&&(n=h({},n),delete n.hooks),await Zt(a,t,this.components,n)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(t,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=n==null?void 0:n.hooks)!=null&&y.afterSkinSelected&&(p=await n.hooks.afterSkinSelected(h({},p)));let d=this.componentsLoaders.find(M=>M.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(t.type,p,e,n);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(M=>M!==c),this.components2init=this.components2init.filter(M=>M!==c),!0)),this.components.push(c),(!n||n.connectProps!==!1)&&(c=Yn(c,t.type.props,p));try{await en(c,t,this.components)}catch(M){throw M}return n!=null&&n.skipInit||await c.initiated(),c});s(this,"navigate",async(t,e,n)=>{if(t.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(n!=null&&n.staged){let r=await this.loadComponent(e,t.container,h({hidden:!0,relative:{direction:"after",child:t.element}},n));return n.init&&await n.init(r),r.show(),t.dispose(),r}else{let r=t.element.nextSibling;return t.dispose(),this.loadComponent(e,t.container,h({relative:{direction:"before",child:r}},n))}})}};s(F,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo});if(!window.myop.hostSDK){let o=new F;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Oo}),window.myop.hostSDK=o}Po=window.myop.hostSDK;z("hostSDK",Po)});var It,Ao=m(()=>{"use strict";I();X();b();w();It=class extends x{constructor(){super(...arguments);s(this,"messageType",l.DetectMyopRefsMessage);s(this,"executor",e=>{let n=document.querySelectorAll("[".concat(B.id,"]")),r=[];n.forEach(i=>{let a=i.getAttribute(B.id);a&&r.push(new Me(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new pe(e.handlerUniqueId,r))})}}});var Ct,Fo=m(()=>{"use strict";I();b();w();L();Ct=class extends x{constructor(){super(...arguments);s(this,"messageType",l.BindClickMessage);s(this,"executor",e=>{let n=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new oe,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};n.push(p)}),()=>{n.forEach(i=>i())}})}}});var xt,zo=m(()=>{"use strict";I();b();L();xt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ChangeTextMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.textContent=e.content})})}}});var wt,$o=m(()=>{"use strict";I();w();b();rn();wt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.ExecuteScriptMessage);s(this,"executor",e=>{at(e,r=>{this.messageToHost(new se(e.handlerUniqueId,r))},new xe(document.documentElement))})}}});var bt,Uo=m(()=>{"use strict";I();b();w();me();L();bt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.AddEventListenerMessage);s(this,"executor",e=>{let n=S(e.ref,document),r=[];return n.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new re(e.handlerUniqueId,P(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),r.push(()=>{i.removeEventListener(e.type,a)})}),()=>{r.forEach(i=>{i()})}})}}});var St,No=m(()=>{"use strict";I();b();L();St=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetAttributeMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.setAttribute(e.name,e.value)})})}}});var Tt,Wo=m(()=>{"use strict";I();X();b();Pe();We();Tt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.CreateRefComponentMessage);s(this,"executor",e=>{(async()=>{let r=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(r.length===1){let a=await F.Instance().loadComponent(e.nestedComponentConfig,r.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new V(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new V(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var Vo,qo=m(()=>{"use strict";Vo=(o,t)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let n=new e(t),r={attributes:!0,childList:!0,subtree:!0};return n.observe(o,r),n}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",t,!1),o.addEventListener("DOMNodeRemoved",t,!1))}});var Et,jo=m(()=>{"use strict";I();w();b();qo();Et=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetMutationObserverMessage);s(this,"executor",e=>{e.source&&Vo(document.body,()=>{this.messageToHost(new He)})})}}});var Go,Rt,Jo=m(()=>{"use strict";I();X();b();w();me();L();Go=o=>{if(!o)return null;if(o.tagName==="FORM"){let t=new FormData(o),e={formData:{},unmappedData:[]},n=o.querySelectorAll("input, select, textarea"),r=-1;return n.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:Go(i),required:i.required,validity:P(i.validity,!0),myopId:a};e.unmappedData.push(d),p&&(!e.formData[p]||!e.formData[p].value||d.value)&&(e.formData[p]=d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},Rt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.GetElementValueMessage);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{this.messageToHost(new ie(Go(r)),e)})})}}});var vt,Yo=m(()=>{"use strict";I();b();w();L();vt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.GetAttributeMessage);s(this,"executor",e=>{let n=Zn(e.ref,document);n&&this.messageToHost(new ke(n.getAttribute(e.name)),e)})}}});var _t,Xo=m(()=>{"use strict";w();I();b();_t=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetResizeObserverMessage);s(this,"executor",e=>{let n=new ResizeObserver(r=>{this.messageToHost(new Oe)});return n.observe(document.body),()=>{n.disconnect()}})}}});var kt,Qo=m(()=>{"use strict";I();b();L();kt=class extends x{constructor(){super(...arguments);s(this,"messageType",l.SetInnerHtml);s(this,"executor",e=>{S(e.ref,document).forEach(r=>{r.innerHTML=e.content})})}}});var Zo={};ee(Zo,{IframeSDK:()=>Ht});var Ht,es=m(()=>{"use strict";b();Ao();Fo();zo();$o();te();Uo();No();w();Wo();jo();Jo();Ne();Yo();Xo();Qo();Ht=class extends Ie{constructor(){super();s(this,"version",ue);s(this,"messageToHost",(e,n)=>{var i;!e.replayToHandler&&(n!=null&&n.handlerUniqueId)&&(e.replayToHandler=n.handlerUniqueId);let r=Object.keys(this.components);e.destination||(n!=null&&n.route?e.destination=n.route[n.route.length-1]:e.destination=r[0]),e.source||(e.source=r[0]),e.direction=R.up,(i=window.parent)==null||i.postMessage(h({},e),"*")});s(this,"supportedHandlers",[new xt(this.messageToHost),new kt(this.messageToHost),new Ct(this.messageToHost),new It(this.messageToHost),new wt(this.messageToHost),new bt(this.messageToHost),new St(this.messageToHost),new Rt(this.messageToHost),new Et(this.messageToHost),new _t(this.messageToHost),new vt(this.messageToHost),new Tt(this.messageToHost)]);s(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ae)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};z("IframeSDK",Ht)});var Bs={};var Ds,ts=m(()=>{"use strict";w();te();Ds=h({},he);z("MyopMessages",Ds)});var ns={};ee(ns,{CloudRepository:()=>Z,ComponentConfig:()=>gt,SkinConfig:()=>ft,addClass:()=>To,applyStylesheet:()=>Co,applyStylesheetLink:()=>xo,changeSkinUrlByTokenizer:()=>bo,createIframeSkinByTokenizer:()=>pn,exec:()=>Ho,removeClass:()=>Eo,v2_CloudRepository:()=>_o});var os=m(()=>{"use strict";te();Mt();Mt();z("MyopHelpers",dn)});var As={};ee(As,{getHostModule:()=>ss,getIframeModule:()=>rs,getWebcomponentModule:()=>is});te();var yn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(yn=document.currentScript)==null?void 0:yn.src,t=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:t,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,t,e)=>{if(window.__federation__[t])console.log("__federation__ module ".concat(t," already loaded.")),e(window.__federation__[t][Bt]);else{let n;window.__federation__[t]={},window.__federation__[t][Ue]=r=>{n&&(document.head.removeChild(n),n=null),window.__federation__[t][Bt]=r,e(r)},n=document.createElement("script"),n.type="module",n.src=o,n.async=!0,document.head.appendChild(n)}};Ne();console.log("myop root sdk - loaded",document.location.origin);var Ls="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",ss=()=>Promise.resolve().then(()=>(Pe(),Ko)),rs=()=>Promise.resolve().then(()=>(es(),Zo)),is=()=>Promise.resolve().then(()=>(an(),lo)),Os=()=>Promise.resolve().then(()=>(ts(),Bs)),Ps=()=>Promise.resolve().then(()=>(os(),ns)),Ae=o=>async()=>(await o()).get(),Ks={version:ue,getHostModule:Ae(ss),getIframeModule:Ae(rs),getWebcomponentModule:Ae(is),getMyopMessages:Ae(Os),getMyopHelpers:Ae(Ps)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ls});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=h({rootSDK:Ks},window.myop);return us(As);})();
|
|
1
|
+
import { jsx as R, jsxs as Ut } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as P, useEffect as le, useState as se, useCallback as Ue } from "react";
|
|
3
|
+
const jt = `"use strict";var MyopSDK=(()=>{var qe=Object.defineProperty,bs=Object.defineProperties,ws=Object.getOwnPropertyDescriptor,Ss=Object.getOwnPropertyDescriptors,Es=Object.getOwnPropertyNames,Tn=Object.getOwnPropertySymbols;var vn=Object.prototype.hasOwnProperty,Ts=Object.prototype.propertyIsEnumerable;var Ot=(o,n,e)=>n in o?qe(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,M=(o,n)=>{for(var e in n||(n={}))vn.call(n,e)&&Ot(o,e,n[e]);if(Tn)for(var e of Tn(n))Ts.call(n,e)&&Ot(o,e,n[e]);return o},q=(o,n)=>bs(o,Ss(n));var m=(o,n)=>()=>(o&&(n=o(o=0)),n);var oe=(o,n)=>{for(var e in n)qe(o,e,{get:n[e],enumerable:!0})},vs=(o,n,e,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Es(n))!vn.call(o,s)&&s!==e&&qe(o,s,{get:()=>n[s],enumerable:!(t=ws(n,s))||t.enumerable});return o};var Rs=o=>vs(qe({},"__esModule",{value:!0}),o);var r=(o,n,e)=>Ot(o,typeof n!="symbol"?n+"":n,e);var Ve,je,At,$,se=m(()=>{"use strict";Ve="__federation__",je="onLoad",At="moduleInstance",$=(o,n)=>{window[Ve]&&window[Ve][o]&&window[Ve][o][je]&&window[Ve][o][je]({[o]:n})}});var Me,Ge=m(()=>{Me="0.3.18"});var f,I=m(()=>{"use strict";f={InitRequest:"InitRequest",InitResponse:"InitResponse",InitMessage:"InitMessage",DisposeMessage:"DisposeMessage",ChangeTextMessage:"ChangeTextMessage",BindClickMessage:"BindClickMessage",DetectMyopRefsMessage:"DetectMyopRefsMessage",ExecuteScriptMessage:"ExecuteScriptMessage",AddEventListenerMessage:"AddEventListenerMessage",SetAttributeMessage:"SetAttributeMessage",CreateRefComponentMessage:"CreateRefComponentMessage",EnvelopedMessage:"EnvelopedMessage",GetElementValueMessage:"GetElementValueMessage",GetAttributeMessage:"GetAttributeMessage",SetInnerHtml:"SetInnerHtml",ExecuteComponentMethod:"ExecuteComponentMethod",SetMutationObserverMessage:"SetMutationObserverMessage",SetResizeObserverMessage:"SetResizeObserverMessage",CleanupMessage:"CleanupMessage",In:{DetectedMyopRefsMessage:"DetectedMyopRefsMessage",ClickReplayMessage:"ClickReplayMessage",ExecuteScriptReplyMessage:"ExecuteScriptReplyMessage",EventListenerCallbackMessage:"EventListenerCallbackMessage",ElementValueReplayMessage:"ElementValueReplayMessage",GetAttributeReplayMessage:"GetAttributeReplayMessage",RefComponentCreatedMessage:"RefComponentCreatedMessage",EnvelopedMessage:"EnvelopedMessage",MutationObserverMessage:"MutationObserverMessage",CleanupReplayMessage:"CleanupReplayMessage",ResizeObserverMessage:"ResizeObserverMessage"}}});var E,_s,ks,Kt,zt=m(()=>{"use strict";E=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16)),_s=o=>{let n=[...o].map(e=>e.toString(16).padStart(2,"0")).join("");return[n.slice(0,8),n.slice(8,12),n.slice(12,16),n.slice(16,20),n.slice(20)].join("-")},ks=o=>{let n=o.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";let e=atob(n);return Uint8Array.from(e,t=>t.charCodeAt(0))},Kt=o=>{let n=ks(o);if(n.length%16!==0)throw new Error("Invalid input length");let e=[];for(let t=0;t<n.length;t+=16)e.push(_s(n.slice(t,t+16)));return e}});var _n,re=m(()=>{"use strict";zt();_n=o=>new Promise(n=>setTimeout(n,o))});var v,C,Ft,R,_,X,k=m(()=>{"use strict";re();v=class{};r(v,"down","down"),r(v,"up","up");C=class{constructor(){r(this,"id",E());r(this,"myop",!0);r(this,"content");r(this,"source");r(this,"destination");r(this,"route");r(this,"ref");r(this,"direction");r(this,"cleanable",!1)}static create(...n){return new this(...n)}isTypeof(n){return n.messageType===this.messageType}},Ft=class extends C{constructor(e){super();this.ref=e}},R=class extends C{constructor(e){super();this.replayToHandler=e}},_=class extends C{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",E())}},X=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=q(M({},this),{component:null})}static create(n,e,t){let s=e;return s||(s={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(s,t)}}});var kn,$t,ie,Hn=m(()=>{"use strict";k();kn="ClickReplayMessage",$t=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",kn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},ie=class extends R{constructor(){super(...arguments);r(this,"messageType",kn)}}});var Wt,Dn=m(()=>{"use strict";k();Wt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}}});var Bn,Hs,Ds,Ln,D,ae,Nt=m(()=>{"use strict";k();Bn="ExecuteScriptReplyMessage",Hs=/(?:function\\s*\\w*\\s*\\([^)]*\\)\\s*\\{([\\s\\S]*?)\\}|(\\([^)]*\\)\\s*=>\\s*\\{([\\s\\S]*?)\\}))\\s*$/,Ds=/\\(\\s*[^)]+\\s*\\)\\s*=>\\s*(.+)/,Ln=o=>{let n=o.match(Hs);if(n)return n[1]||n[3];{let e=o.match(Ds);if(e)return e[1].trim()}},D=class extends _{constructor(e,t=()=>{},s){super(t);this.scriptInputs=s;r(this,"replyMessageKey",Bn);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=Ln(this.content)}};r(D,"replierKey","send"),r(D,"completeStreamKey","completeStream");ae=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",Bn)}}});var V,Pn=m(()=>{"use strict";Nt();V=class extends D{constructor(e,t,s=()=>{}){super(({rootRef:i,elementId:a,_script:p,__scriptInputs:d})=>{let c=(i.shadowRoot||i.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},s);this.scriptInputs=t;this.scriptInputs=q(M({},t),{_script:e.toString()})}}});var On,Ut,pe,An=m(()=>{"use strict";k();On="EventListenerCallbackMessage",Ut=class extends _{constructor(e,t,s){super(s);this.ref=e;this.type=t;this.handler=s;r(this,"replyMessageKey",On);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},pe=class extends R{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",On);this.content={e:t}}}});var qt,Kn=m(()=>{"use strict";k();qt=class extends C{constructor(e,t,s){super();this.ref=e;this.name=t;this.value=s;r(this,"messageType","SetAttributeMessage")}}});var zn,Vt,de,jt=m(()=>{"use strict";k();zn="ElementValueReplayMessage",Vt=class extends _{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",zn);r(this,"messageType","GetElementValueMessage")}},de=class extends R{constructor(e){super();this.content=e;r(this,"messageType",zn)}}});var Gt,Fn=m(()=>{"use strict";k();Gt=class extends C{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}}});var Ie,ke,ce,$n=m(()=>{"use strict";k();Ie=class extends C{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},ke=class extends Ie{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},ce=class extends C{constructor(){super(...arguments);r(this,"messageType","InitRequest")}}});var Wn,He,j,Ye=m(()=>{"use strict";k();Wn="RefComponentCreatedMessage",He=class extends _{constructor(e,t,s,i){super(i);this.refConfig=e;this.nestedComponentConfig=t;this.options=s;r(this,"replyMessageKey",Wn);r(this,"messageType","CreateRefComponentMessage")}},j=class extends R{constructor(e,t,s){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=s;r(this,"messageType",Wn)}}});var De,Yt=m(()=>{"use strict";k();De=class extends C{constructor(e,t){super();this.destination=e;this.message=t;r(this,"messageType","EnvelopedMessage");let s=t;this.route=[e,...s.route?s.route:[]]}}});var Nn,Qt,me,Un=m(()=>{"use strict";k();Nn="DetectedMyopRefsMessage",Qt=class extends _{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",Nn)}},me=class extends R{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",Nn);this.content=t}isTypeof(e){return e.messageType===this.messageType}}});var qn,Jt,Be,Vn=m(()=>{"use strict";k();qn="GetAttributeReplayMessage",Jt=class extends _{constructor(e,t,s){super(s);this.ref=e;this.name=t;r(this,"replyMessageKey",qn);r(this,"messageType","GetAttributeMessage")}},Be=class extends R{constructor(e){super();this.content=e;r(this,"messageType",qn)}}});var z,jn=m(()=>{"use strict";k();z=class extends C{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}}});var Xt,Le,Gn=m(()=>{"use strict";k();Xt=class extends C{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Le=class extends C{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}}});var Yn,Pe,Oe,Qn=m(()=>{"use strict";k();Yn="CleanupReplayMessage",Pe=class extends _{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",Yn);r(this,"messageType","CleanupMessage")}},Oe=class extends R{constructor(e){super();this.customCleanup=e;r(this,"messageType",Yn)}}});var Ae,Jn=m(()=>{"use strict";k();Ae=class extends C{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}}});var Zt,Ke,Xn=m(()=>{"use strict";k();Zt=class extends C{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},Ke=class extends C{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}}});var Ce={};oe(Ce,{AddEventListenerMessage:()=>Ut,BaseMyopMessage:()=>C,BindClickMessage:()=>$t,ChangeTextMessage:()=>Wt,CleanupMessage:()=>Pe,CleanupReplayMessage:()=>Oe,ClickReplayMessage:()=>ie,CreateRefComponentMessage:()=>He,CustomRefMessage:()=>V,DetectMyopRefsMessage:()=>Qt,DetectedMyopRefsMessage:()=>me,DisposeMessage:()=>Ae,ElementValueReplayMessage:()=>de,EnvelopedMessage:()=>De,EventListenerCallbackMessage:()=>pe,ExecuteComponentMethod:()=>z,ExecuteScriptMessage:()=>D,ExecuteScriptReplyMessage:()=>ae,GetAttributeMessage:()=>Jt,GetAttributeReplayMessage:()=>Be,GetElementValueMessage:()=>Vt,InitMessage:()=>Ie,InitRequest:()=>ce,InitResponse:()=>ke,MessageDirection:()=>v,MutationObserverMessage:()=>Le,MyopBindMessage:()=>_,MyopBindReplayMessage:()=>R,MyopElementMessage:()=>Ft,Ref:()=>X,RefComponentCreatedMessage:()=>j,ResizeObserverMessage:()=>Ke,SetAttributeMessage:()=>qt,SetInnerHtml:()=>Gt,SetMutationObserverMessage:()=>Xt,SetResizeObserverMessage:()=>Zt,stripFunction:()=>Ln});var b=m(()=>{"use strict";k();Hn();Dn();Nt();Pn();An();Kn();jt();Fn();$n();Ye();Yt();Un();jt();Vn();jn();Gn();Qn();Jn();Xn()});var W,ze=m(()=>{"use strict";I();b();Fe();W=class{constructor(n,e,t){this.componentDefinition=n;this.container=e;r(this,"id","");r(this,"messageHandlers",{});r(this,"element");r(this,"_markedForDisposed",!1);r(this,"bind",(n,e)=>{this.messageHandlers[n]||(this.messageHandlers[n]=[]),this.messageHandlers[n].includes(e)||this.messageHandlers[n].push(e)});r(this,"bindWhen",(n,e,t)=>{if(!t)throw new Error("can't use component.bindWhen without an handler");this.messageHandlers[n]||(this.messageHandlers[n]=[]);let s=this.messageHandlers[n],i=a=>e(a)?(t(a),!0):!1;return s.push(i),()=>{let a=s.indexOf(i);a>-1&&s.splice(a,1)}});r(this,"setInitiated",()=>{this.isInitiated=!0,this._whenInitiatedResolve&&this._whenInitiatedResolve()});r(this,"isInitiated",!1);r(this,"_whenInitiatedResolve");r(this,"_whenInitiatedReject");r(this,"_whenInitiated",new Promise((n,e)=>{this._whenInitiatedResolve=n,this._whenInitiatedReject=e}));r(this,"initiated",()=>this._whenInitiated);r(this,"props",{});r(this,"refs",{});this.id=(t==null?void 0:t.id)||F.Instance().assignId(n);let s=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&this._whenInitiatedReject("timeout_".concat(s," ").concat(this.id))},s),this.initiated().then(()=>{window.myop.hostSDK.inspected&&this.inspect()})}get markedForDisposed(){return this._markedForDisposed}set markedForDisposed(n){if(this._markedForDisposed)throw new Error("InvalidOperationException: The component is already in the process of being disposed. Dispose operation cannot be performed again until the current disposal process is complete.");this._markedForDisposed=n}onMessageReceived(n){if(n.messageType===f.ExecuteComponentMethod){let t=n;return this[t.method]?this[t.method](t.content):console.log("method not found ".concat(t.method," on component"),this),!0}let e=this.messageHandlers[n.messageType];if(e&&e.length){let t=!1;return e.forEach(s=>{t=t||s(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=v.down;let e=this.bindWhen(n.replyMessageKey,s=>s.replayToHandler===n.handlerUniqueId,s=>{n.handler(s),e()}),t=n.handler;delete n.handler,this.send(n),n.handler=t}send(n){n.source||(n.source=this.id),n.destination||(n.destination=this.id),n.direction=v.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,s=>s.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new Pe(n.id,t=>{})),e&&e()}:()=>{}}dispose(){if(this.markedForDisposed=!0,!this.isInitiated)return;console.log("disposing component",this.id),this.send(new Ae);let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)}),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}}});var xe,Zn=m(()=>{"use strict";xe=class{constructor(n,e,t,s,i){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=s;this.offsetLeft=i;r(this,"type","MyopElementRef")}}});var eo,x,Qe,to=m(()=>{"use strict";eo=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},x=class{constructor(n){this.messageToHost=n}},Qe=class extends x{constructor(e,t){super(e);this.messageToHost=e;this.context=t}}});var en,be,no=m(()=>{"use strict";I();w();b();en=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},be=class{constructor(){r(this,"messageToHandleAfterInit",[]);r(this,"components",{});r(this,"alwaysPassEnvelopesToHost",!1);r(this,"messageCleanupCache",{})}handleIncomeMessages(n){let e=n.data?n.data:n.detail;if(!(!e||!e.myop)){let t=e;if(t.direction!==v.down)return;if(t.messageType===f.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===f.InitMessage){let s=t.content.id;if(this.components[s])return;this.components[s]=new en(s),this.messageToHost(new ke(s));return}if(t.messageType===f.EnvelopedMessage){let s=t,i=s.message;if(t=i,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===i.destination);if(a){a.send(i);return}let p=myop.hostSDK.components.find(d=>d.id===s.destination);if(p){p.send(i);return}}else return}if(t.messageType){if(t.messageType===f.CleanupMessage){let i=t,a=this.messageCleanupCache[i.cleanupForMessageId],p=new Oe(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[i.cleanupForMessageId],eo(a).then(()=>{this.messageToHost(p,i)}).catch(()=>{})):this.messageToHost(p,i);return}let s=!1;this.supportedHandlers.forEach(i=>{if(i.messageType===t.messageType){s=!0;let a=i.executor(t);if(t.cleanable&&a&&(this.messageCleanupCache[t.id]=a),a&&!t.cleanable)throw new Error("Cleanup handler generated for non-cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."));if(!a&&t.cleanable)throw new Error("No cleanup handler generated for a cleanable message. \\nmessageType - ".concat(t.messageType,", handler executor was - ").concat(i.executor,"\\n\\nPlease review the message definition object & message handler.\\nTo ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers."))}})}else console.log("unsupported message type")}}}});var G,le,Ee,we,fe,Je,Se,w=m(()=>{"use strict";Zn();to();no();G={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"},le={open:"open",closed:"closed",none:"none",localFrame:"localFrame"},Ee={message:"message",code:"code"},we=class{};r(we,"code","code"),r(we,"component","component");fe={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Je={Segment:"Segment",Promo:"Promo",AB:"AB"},Se=class{constructor(n,e){this.container=n;this.shadowRoot=e;r(this,"getRootDiv",()=>(this.shadowRoot||this.container).querySelector("div"));r(this,"getRoot",()=>this.shadowRoot||this.container)}}});var tn,Bs,nn,A,ue=m(()=>{"use strict";tn=o=>o!==Object(o),Bs=o=>typeof o=="function",nn=o=>{if(tn(o))return!0;if(Bs(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!nn(e))return!1}else{if(tn(e))continue;return!1}}return!0},A=(o,n={},e=!0,t=new WeakMap)=>{if(tn(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let s=[];t.set(o,s);for(let i=0;i<o.length;i++){let a=o[i];s[i]=A(a,n,e,t)}return s}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let s={};t.set(o,s);for(let i in o){let a=typeof n=="boolean"?n:n[i];a&&(a===!0?(e?o[i]!==void 0:o[i])&&(s[i]=A(o[i],!0,e,t)):typeof a=="object"&&(s[i]=A(o[i],a,e,t)))}return s}return{}}});var oo,so=m(()=>{"use strict";oo={notSerializableRefCall:(o,n)=>{throw new Error("\\nThe input provided to '".concat(o.toString(),"' is not serializable. Serialization is required to ensure that the data can be safely transferred to the skin implementation. \\nThe following types of data are considered non-serializable and cannot be processed:\\n\\n- Functions\\n- DOM elements\\n- Class instances\\n- Circular references\\n- Symbols\\n- BigInt values\\n\\nIn the following execution we detected :\\n~~~~~~~~\\n").concat(n," \\n~~~~~~~~\\nas not serializable.\\n\\nTo resolve this issue, please ensure that all inputs passed to '").concat(o.toString(),"' are in a serializable format.\\nThis typically includes primitive types (strings, numbers, booleans), arrays, and plain objects. \\nIf you need to include complex data types, consider converting them to a serializable structure before passing them to the function.\\nOr use Myop message that support it: CustomRefMessage, AddEventListenerMessage or ExecuteScriptMessage.\\n\\nSuggested Fix:\\n1. Remove or replace non-serializable values from your input.\\n2. If using objects, ensure they do not contain any functions or circular references.\\n3. Convert any class instances to plain objects or JSON-compatible formats.\\n4. Use dedicated Myop message.\\n\\nFor more details on serialization and Myop message examples, refer to https://docs.myop.dev.\\n\\n"))}}});var $e,ro=m(()=>{"use strict";ze();b();Yt();$e=class extends W{constructor(e,t,s){super(e,t.container,s);this.componentDefinition=e;this.parent=t;r(this,"send",e=>{let t=e.handler,s=super.send(e);return this.parent.send(new De(this.id,e)),e.handler=t,s});r(this,"dispose",()=>{this.isInitiated&&this.send(new z("dispose")),super.dispose()})}hide(){this.send(new z("hide"))}show(){this.send(new z("show"))}inspect(){return this.send(new z("inspect"))}setHeightBasedOnDocumentElement(){this.send(new z("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new z("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}}});var ge,on=m(()=>{"use strict";ze();We();ge=class extends W{constructor(e,t,s,i,a,p){super(e,s,p);this.container=s;this.customElement=i;this.tagName=a;r(this,"ctaCleanup");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=super.send(e);return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead",e),t});r(this,"dispose",()=>{var e;this.ctaCleanup&&this.ctaCleanup(),super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i,this.setInitiated()}inspect(){return this.cleanupInspect=Te(this.id,"MyopExtractedWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}initWithData(e){typeof this.customElement.myop_init_interface=="function"&&this.customElement.myop_init_interface(e)}getData(){if(typeof this.customElement.myop_init_interface=="function")return this.customElement.myop_init_interface()}setCtaHandler(e){if(this.ctaCleanup&&this.ctaCleanup(),this._ctaHandler=e,this._ctaQueue.length>0){let s=[...this._ctaQueue];this._ctaQueue=[],s.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}let t=s=>{var a;let i=s;(a=i.detail)!=null&&a.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(i.detail.action,i.detail.payload):this._ctaHandler||this._ctaQueue.push({action:i.detail.action,payload:i.detail.payload}))};this.customElement.addEventListener("myop-cta",t),this.ctaCleanup=()=>{this.customElement.removeEventListener("myop-cta",t)}}}});var Ls,Te,io,ao,po,Ps,sn,rn,We=m(()=>{"use strict";b();b();w();ue();so();ro();on();Ls=(o,n,e)=>{let t=document.createElement("a");return t.textContent=o,t.style.position="relative",t.style.padding="0 5px",t.style.fontSize="14px",t.style.top="0",t.style.top="".concat(n,"px"),t.style.transform="translateX(-50%)",t.target="_blank",t.href="https://dashboard.myop.dev/dashboard/component/".concat(e.id),t},Te=(o,n,e,t,s,i)=>{let a=Ls("".concat(i.name," : ").concat(n),e,i);return t.insertBefore(a,s),s.style.border="1px solid #007BFF",s.style.display="block",()=>{s.style.border="unset",t.removeChild(a)}},io=(o,n,e)=>o?!1:(console.error("Error: Undefined Prop\\n\\nIt looks like you've tried to use a prop that hasn't been defined.\\nPlease check the prop name for any typos or ensure that it is properly defined in the component's prop list.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide.")),!0),ao=(o,n,e)=>{console.error("Error: Code Prop Not Supported\\n\\nCurrently, code props are only supported in local frame components.\\n\\u26A0\\uFE0F This is a work in progress feature \\u2014 code props will be supported in upcoming versions.\\n\\nIn the meantime, you can use message props.\\n\\n"+"Prop Name: ".concat(n,"\\n")+"Component: ".concat(e.componentDefinition.name,", ID: ").concat(e.componentDefinition.id,"\\n\\n")+"For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/".concat(e.componentDefinition.id," or consult the developer guide."))},po=(o,n,e)=>{let t=n.reduce((i,a)=>q(M({},i),{[a.name]:M({},a)}),{}),s={get:(i,a)=>{let p=t[a];if(io(p,a,o))return!1;if(p.behavior.type===Ee.code){if(o instanceof ge)return(p.behavior.remap||a)==="myop_init_interface"?l=>{if(l===void 0)return o.getData();o.initWithData(l)}:void 0;if(e.loader.type===G.HTMLLoader&&e.loader.shadowRootMode===le.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return ao(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(X.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let l=Ce[p.behavior.message];o.send(new l(...c))}):null},set:(i,a,p)=>{let d=t[a];if(io(d,a,o))return!1;if(d.behavior.type===Ee.code){if(o instanceof ge){let l=d.behavior.remap||a;if(l==="myop_cta_handler")return o.setCtaHandler(p),!0;if(l==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===G.HTMLLoader&&e.loader.shadowRootMode===le.localFrame){let l=d.behavior,u=o.element.contentWindow,g=l.remap||a;if(u[g]=p,g==="myop_cta_handler"&&u.__myop_cta_queue){let y=u.__myop_cta_queue;u.__myop_cta_queue=null,y.forEach(h=>{o.markedForDisposed||p(h.action,h.payload)})}return!0}return ao(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(X.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let l=Ce[d.behavior.message];return o.send(new l(...c)),!0}else throw new Error("Error: Unsupported Behavior\\n\\nThe 'behavior' field provided is not supported.\\n"+"Component: ".concat(o.componentDefinition.name,", ID: ").concat(o.componentDefinition.id,"\\n\\n")+"Prop Name: ".concat(a,"\\n")+"Behavior Field: ".concat(d.behavior.type,"\\n\\n")+"Check the documentation for valid behavior options.");return!1}};return o.props={},o.props=new Proxy(o.props,s),o},Ps=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...i)=>new Promise(a=>{i.forEach(p=>{nn(p)||oo.notSerializableRefCall(t,p)}),n.send(new V(({ref:p,propName:d,functionArgs:c,makeSerializable:l})=>{if(p){let u=p[d];return l(typeof u=="function"?p[d](...c):u,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:i},p=>{a(p.content)}))})},set(e,t,s){return n.send(new V(({ref:i,propName:a,propValue:p})=>{i&&(i[a]=p)},{elementId:e.refConfig.selector,propValue:s,propName:t},i=>{})),!0}}),sn=async(o,n,e,t)=>{let s=o.component;if(!s)throw new Error("cant createRefComponent with detached ref");return new Promise(async(i,a)=>{let p=new $e(n.type,s,t);e.push(p),await s.initiated();let d=setTimeout(()=>{a("timeout")},5e3);s.send(new He(o.refConfig,n,q(M({},t||{}),{id:p.id,_hasParent:!0}),async c=>{if(clearTimeout(d),c.failed){a("CreateRefComponentMessage failed");return}let l=e.find(u=>u.id==p.id);if(l!==p){s.refs[o.refConfig.name]=l,i(l);return}else p.setInitiated(),s.refs[o.refConfig.name]=p;c.nestedRefs.forEach(u=>{let g=n.instance.resolvedNestedComponents.find(h=>h.type.id===u.componentDefinitionId).type,y=new $e(g,p);y.setInitiated(),p.refs[u.refName]=y,e.push(y)});try{await rn(p,n,e,!0),s.setHeightBasedOnScrollHeight&&s.setHeightBasedOnScrollHeight(),i(p)}catch(u){a(u)}}))})},rn=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let s=Object.values(o.componentDefinition.refs).map(i=>new Promise(async(a,p)=>{var d;if(i.behavior.type==we.component){if(t){a();return}let c=i.behavior.componentId;c||(c=i.behavior.instance.componentId);let l=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(g=>g.type.id===c);if(!l)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let u=X.create("",i,o);try{let g=await sn(u,l,e);o.refs[i.name]=g,a()}catch(g){p(g)}}else try{let c=X.create("",i,o);o.refs[i.name]=Ps(c,o),a()}catch(c){}}));try{await Promise.all(s)}catch(i){throw i}}});var ve,an=m(()=>{"use strict";ze();b();We();I();ve=class extends W{constructor(e,t,s,i,a){super(e,s,a);this.componentConfig=e;this.container=s;this.IframeElement=i;r(this,"sizeMeta");r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new D(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new D(({send:t})=>{let{height:s,width:i}=document.documentElement.getBoundingClientRect(),a=new ResizeObserver(()=>{let{height:p,width:d}=document.documentElement.getBoundingClientRect();t({height:p,width:d})});return a.observe(document.documentElement),a.observe(document.body),{height:s,width:i}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));r(this,"observeAutoSize",e=>{var yn,hn,Mn,In,Cn,xn,bn;let t=this.IframeElement,s=t.contentDocument;if(!s)return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"),()=>{};let i=(H,K,he)=>K!==void 0&&H<K?K:he!==void 0&&H>he?he:H,a=H=>{if(H===void 0)return;if(typeof H=="number")return H;let K=parseFloat(H);return isNaN(K)?void 0:K},p=a(e==null?void 0:e.minWidth),d=a(e==null?void 0:e.maxWidth),c=a(e==null?void 0:e.minHeight),l=a(e==null?void 0:e.maxHeight),u=(yn=e==null?void 0:e.loaderMinHeight)!=null?yn:50,g=((hn=this.sizeMeta)==null?void 0:hn.width)==="100%"?"100%":void 0,y=((Mn=this.sizeMeta)==null?void 0:Mn.height)==="100%"?"100%":void 0,h=(Cn=(In=e==null?void 0:e.explicitWidth)!=null?In:g)!=null?Cn:"100%",Y=(xn=e==null?void 0:e.explicitHeight)!=null?xn:y,Ue=h!==void 0,ye=Y!==void 0,Q=this.container.getBoundingClientRect(),L=Q.width===0,O=Q.height===0||Q.height===u,U=(e!=null&&e.forceAutoSize||L)&&!Ue,J=(e!=null&&e.forceAutoSize||O)&&!ye;if(!U&&!J){let H=typeof h=="number"?h:void 0,K=typeof Y=="number"?Y:void 0;return(H!==void 0||K!==void 0)&&((bn=e==null?void 0:e.onSizeChange)==null||bn.call(e,{width:H,height:K,autoSizingWidth:!1,autoSizingHeight:!1})),()=>{}}let Lt=()=>{var K;let H=t.contentDocument;if(H){J&&(t.style.height="0px"),U&&(t.style.width="0px");let he=Math.ceil(H.documentElement.scrollWidth),wn=Math.ceil(H.documentElement.scrollHeight),Sn=i(he,p,d),En=i(wn,c,l);U&&(t.style.width="".concat(Sn,"px")),J&&(t.style.height="".concat(En,"px"));let Cs=U&&d!==void 0&&he>d,xs=J&&l!==void 0&&wn>l;H.documentElement.style.overflowX=Cs?"auto":"",H.documentElement.style.overflowY=xs?"auto":"",(K=e==null?void 0:e.onSizeChange)==null||K.call(e,{width:Sn,height:En,autoSizingWidth:U,autoSizingHeight:J})}};Lt();let Pt=new ResizeObserver(Lt);Pt.observe(s.body),Pt.observe(s.documentElement);let gn=new MutationObserver(Lt);return gn.observe(s.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),()=>{Pt.disconnect(),gn.disconnect()}});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new D(()=>{let{height:t,width:s}=document.documentElement.getBoundingClientRect();return{height:t,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px"),e()}))});r(this,"setHeightBasedOnScrollHeight",()=>{let e=this.send(new D(()=>{let s=0;return s++,s--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+s+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});r(this,"send",e=>{var i,a;let t=M({},e);if(t.messageType===f.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=v.down;let s=super.send(t);return(a=(i=this.IframeElement)==null?void 0:i.contentWindow)==null||a.postMessage(t,"*"),s});r(this,"dispose",()=>{this.cleanupInspect&&this.cleanupInspect(),super.dispose(),this.IframeElement.parentNode.removeChild(this.IframeElement)});t.loader.autoHeight&&this.initiated().then(()=>{this.setHeightBasedOnScrollHeight()}),this.element=this.IframeElement}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=Te(this.id,"MyopIframeComponent",10,this.container,this.IframeElement,this.componentDefinition),()=>{this.cleanupInspect(),this.cleanupInspect=void 0})}hide(){this.IframeElement.style.opacity="0",this.IframeElement.style.position="absolute",this.IframeElement.style.pointerEvents="none",this.IframeElement.style.visibility="hidden"}show(){this.IframeElement.style.opacity="1",this.IframeElement.style.position="unset",this.IframeElement.style.pointerEvents="all",this.IframeElement.style.visibility="visible"}onMessageReceived(e){return e.messageType===f.In.MutationObserverMessage||e.messageType===f.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}}});var Z,Xe=m(()=>{"use strict";Z=class{constructor(){r(this,"appendChild",(n,e,t)=>{var s;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let i=(s=t.relative.child)==null?void 0:s.nextSibling;return n.insertBefore(e,i||null)}}else return n.appendChild(e)})}}});var Os,Ze,co=m(()=>{"use strict";an();Xe();re();w();Os=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Ze=class extends Z{constructor(){super(...arguments);r(this,"type",G.IframeLoader);r(this,"load",async(e,t,s,i)=>{let a,p=t.loader;if((s==null?void 0:s.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,s),a=s,a.src=p.url;else{let d=E(),c="myop-comp-".concat(d);a=document.createElement("iframe"),a.id=c;let l="\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n height: ".concat(p.autoHeight||!p.height?"100%":p.height,";\\n width: 100%;\\n overflow: hidden;\\n border: none;\\n opacity: ").concat(i!=null&&i.hidden?"0":"1",";\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n ");a.style.cssText=l,i!=null&&i.elementAttributes&&Object.entries(i.elementAttributes).forEach(([g,y])=>{y===""||y===null||y===void 0?a.setAttribute(g,""):a.setAttribute(g,String(y))});let u=t.loader.url;i!=null&&i._hasParent&&(u=Os(u,"_myop-comp",d)),a.src=u,s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),a=this.appendChild(s,a,i)}return new ve(e,t,s,a,i)})}}});var et,pn=m(()=>{"use strict";et={webcomponent_message_key:"myop_webcomponent_message"}});var Re,dn=m(()=>{"use strict";pn();ze();We();Re=class extends W{constructor(e,t,s,i,a){super(e,s,a);this.container=s;this.customElement=i;r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=M({},e),s=super.send(t),i=new CustomEvent(et.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(i)}catch(a){console.log("error while trying to dispatchEvent",a)}return s});r(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=i}inspect(){return this.cleanupInspect=Te(this.id,"MyopWebComponent",0,this.container,this.customElement,this.componentDefinition),this.cleanupInspect}hide(){this.customElement.style.opacity="0",this.customElement.style.position="absolute",this.customElement.style.pointerEvents="none",this.customElement.style.visibility="hidden",this.customElement.style.height="0",this.customElement.style.width="0"}show(){this.customElement.style.opacity="1",this.customElement.style.position="unset",this.customElement.style.pointerEvents="all",this.customElement.style.visibility="visible",this.customElement.style.height="",this.customElement.style.width=""}}});var cn,tt,mo=m(()=>{"use strict";dn();Xe();re();w();cn={},tt=class extends Z{constructor(){super(...arguments);r(this,"type",G.WebComponentLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;cn[a.url]?console.log("Module alreday loaded or in loading process"):cn[a.url]=new Promise((c,l)=>{let u=a.url,g=document.createElement("script");g.type="module",g.src=u,g.onload=()=>{c()},g.onerror=()=>{l()},document.head.appendChild(g)}),await cn[a.url],await _n(1);let p="myop-comp-".concat(E()),d=document.createElement(a.tag);return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),i!=null&&i._environment&&(d._myopEnvironment=i==null?void 0:i._environment),this.appendChild(s,d,i),new Re(e,t,s,d,i)})}}});var T,N=m(()=>{"use strict";w();T=class extends Qe{constructor(e,t){super(e);this.context=t;r(this,"executor",e=>{if(e.destination){let t=e.destination;if(this.context[t].context){let s=(i,a)=>{this.messageToHost(q(M({},i),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,s)}else debugger}else debugger})}}});var B,ee=m(()=>{"use strict";B={id:"myop-id"}});var S,lo,P=m(()=>{"use strict";ee();S=(o,n)=>n.querySelectorAll("[".concat(B.id,"='").concat(o.refConfig.selector,"']")),lo=(o,n)=>{let e=S(o,n);return e.length?e.item(0):null}});var nt,fo=m(()=>{"use strict";I();b();N();P();nt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=()=>{s(new ie(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}}});var ot,uo=m(()=>{"use strict";I();N();P();ot=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.textContent=e.content})})}}});var st,go=m(()=>{"use strict";w();st=class extends Se{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}}});var rt,yo=m(()=>{"use strict";w();ee();N();b();I();rt=class extends T{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let s=t.shadowRoot.querySelectorAll("[".concat(B.id,"]")),i=[];s.forEach(a=>{let p=a.getAttribute(B.id);p&&i.push(new xe(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new me(e.handlerUniqueId,i))});r(this,"messageType",f.DetectMyopRefsMessage)}}});var it,ho=m(()=>{"use strict";I();N();P();it=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.setAttribute(e.name,e.value)})})}}});var at,Mo=m(()=>{"use strict";I();b();N();P();ue();at=class extends T{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"innerExecutor",(e,t,s)=>{let i=S(e.ref,t.shadowRoot),a=[];return i.forEach(p=>{let d=c=>{s(new pe(e.handlerUniqueId,A(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}}});var pt,Io=m(()=>{"use strict";I();ee();Fe();Ye();N();pt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,s)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=F.Instance(),d=p.components.find(g=>g.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let l=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),u=[];Object.keys(l.refs).forEach(g=>{let y=l.refs[g];y=y.__nonProxied||y,y.componentDefinition&&u.push({refName:g,componentDefinitionId:y.componentDefinition.id})}),s(new j(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var dt,mn=m(()=>{"use strict";ue();dt=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=A,t.send=n,t.rootRef=e,t.__scriptInputs=t;let i=new Function("return (".concat(o.script,")(...arguments)"))(t);n(i)}});var ct,Co=m(()=>{"use strict";I();b();N();mn();ct=class extends T{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,s)=>{dt(e,a=>{s(new ae(e.handlerUniqueId,a))},t)})}}});var xo,mt,bo=m(()=>{"use strict";I();b();N();P();ee();ue();xo=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:xo(i),required:i.required,validity:A(i.validity,!0),myopId:a};p?e.formData[p]?e.formData[p].value?e.unmappedData.push(d):(e.unmappedData.push(e.formData[p]),e.formData[p]=d):e.formData[p]=d:e.unmappedData.push(d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},mt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"innerExecutor",(e,t,s)=>{S(e.ref,t.shadowRoot).forEach(a=>{s(new de(xo(a)),e)})})}}});var lt,wo=m(()=>{"use strict";I();N();P();lt=class extends T{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{S(e.ref,t.shadowRoot).forEach(i=>{i.innerHTML=e.content})})}}});var So={};oe(So,{WebComponentSDK:()=>_e});var _e,ln=m(()=>{"use strict";w();I();pn();fo();uo();go();yo();se();b();ho();Mo();Io();Co();bo();wo();_e=class extends be{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(et.webcomponent_message_key,s=>{let i=s.data?s.data:s.detail;if(!i||!i.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=i;if(this.handleIncomeMessages(s),a.messageType===f.InitMessage){let p=a.content.id;this.components[p].context=new st(e,t)}}}),setTimeout(()=>{this.messageToHost(new ce)},1)});r(this,"messageToHost",(e,t)=>{e.direction=v.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new ot(this.messageToHost,this.components),new lt(this.messageToHost,this.components),new nt(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new it(this.messageToHost,this.components),new at(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new mt(this.messageToHost,this.components),new pt(this.messageToHost,this.components)]);r(this,"init",()=>{})}};$("WebComponentSDK",_e)});var Eo=m(()=>{"use strict";ln()});var To,vo=m(()=>{"use strict";To=""});function zs(o,n){return class extends HTMLElement{connectedCallback(){let e=n===le.open?"open":"closed",t=this.attachShadow({mode:e});Ho().then(s=>{s.connectedCallback(this,t),t.innerHTML=o})}}}var As,Ks,_o,ko,ft,Ho,Fs,$s,Ws,ut,Do=m(()=>{"use strict";dn();on();Xe();re();w();Eo();an();vo();As="<!-- myop-web-component -->",Ks="myop-web-component",_o=new Set,ko=[],Ho=async()=>(ft||(ft=new _e,ft.init()),ft);Fs=(o,n,e)=>{customElements.define(o,zs(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},$s=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\\d+)/g,"-$1").toLowerCase(),Ws=o=>(o=$s(o),o.replace(/_/g,"-")),ut=class extends Z{constructor(){super(...arguments);r(this,"type",G.HTMLLoader);r(this,"load",async(e,t,s,i)=>{let a=t.loader;if(this.isMyopWebComponent(a.HTML))return this.loadExtractedWebComponent(e,t,s,a.HTML,i);let p="myop-comp-".concat(E()),d;if(a.shadowRootMode===le.localFrame){let c=E(),l="myop-comp-".concat(c),u=document.createElement("iframe");u.id=l,u.style.cssText="\\n display: block;\\n padding: 0;\\n margin: 0;\\n position: absolute;\\n inset: 0;\\n overflow: hidden;\\n border: none;\\n opacity: ".concat(i!=null&&i.hidden?"0":"1",";\\n width: 100%;\\n height: 100%;\\n pointer-events: ").concat(i!=null&&i.hidden?"none":"all",";\\n "),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),u=this.appendChild(s,u,i);let g=u.contentDocument||u.contentWindow.document;g.open();let y=null;{let O=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(O)try{y=JSON.parse(O.getAttribute("content")||"{}")}catch(U){}}let h=a.HTML;if(i!=null&&i._inspection){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O==null||O.removeAttribute("type");let U=L.implementation.createHTMLDocument();U.body.innerHTML="<script>\\n const beforeKeysWindow = new Set(Object.keys(window));\\n window.myopState = {\\n beforeKeysWindow,\\n };\\n <\\/script>";let J=U.body.firstChild;J&&L.head&&L.head.insertBefore(L.importNode(J,!0),L.head.firstChild),h=L.documentElement.outerHTML}else if((i==null?void 0:i.data)!==void 0){let L=new DOMParser().parseFromString(a.HTML,"text/html"),O=L.getElementById("myop_preview");O&&(O.remove(),h=L.documentElement.outerHTML)}g.writeln(h);let Y='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\\/script>'),Ue="<script>\\n window.__federation__.__public_path__ = window.__federation__.__public_path__;\\n const __myop_init = async () => {\\n const {IframeSDK} = (await window.myop.rootSDK.getIframeModule());\\n const sdk = new IframeSDK();\\n sdk.init();\\n }\\n __myop_init().then();\\n <\\/script>";if(g.writeln("".concat(Y).concat(Ue)),(i==null?void 0:i.data)!==void 0){let Q="<script>\\n window.__myop_cta_queue = [];\\n window.myop_cta_handler = function(action, payload) {\\n window.__myop_cta_queue.push({action: action, payload: payload});\\n };\\n <\\/script>",L=JSON.stringify(i.data).replace(/<\\/script/gi,"\\\\u003c/script"),O='<script id="__myop_init_data_script">\\n (function() {\\n var data = '.concat(L,";\\n var scriptEl = document.getElementById('__myop_init_data_script');\\n\\n var callInitInterface = function(fn) {\\n var startTime = performance.now();\\n // Mark as pre-injected data call for extension tracking\\n window.__myop_init_preinjected = true;\\n try {\\n fn(data);\\n } finally {\\n window.__myop_init_preinjected = false;\\n }\\n var duration = performance.now() - startTime;\\n\\n // Notify extension via postMessage (init* = pre-injected)\\n try {\\n window.parent.postMessage({\\n type: 'MYOP_PREINJECTED_INIT',\\n payload: {\\n data: data,\\n duration: duration,\\n timestamp: Date.now()\\n }\\n }, '*');\\n } catch (e) {}\\n\\n // Cleanup: remove script tag and stored data\\n if (scriptEl && scriptEl.parentNode) {\\n scriptEl.parentNode.removeChild(scriptEl);\\n }\\n delete window.__myop_init_data;\\n };\\n\\n if (typeof window.myop_init_interface === 'function') {\\n // Function already exists - call immediately\\n callInitInterface(window.myop_init_interface);\\n } else {\\n // Function not yet defined - store data and watch for definition\\n window.__myop_init_data = data;\\n\\n var _original;\\n Object.defineProperty(window, 'myop_init_interface', {\\n configurable: true,\\n enumerable: true,\\n set: function(fn) {\\n _original = fn;\\n if (window.__myop_init_data !== undefined) {\\n var storedData = window.__myop_init_data;\\n delete window.__myop_init_data;\\n callInitInterface(fn);\\n }\\n },\\n get: function() {\\n return _original;\\n }\\n });\\n }\\n })();\\n <\\/script>");g.writeln(Q+O)}g.close();let ye=new ve(e,t,s,u,i);return ye.sizeMeta=y,a.autoHeight&&(u.onload=()=>{ye.observeSizeBasedOnDocumentElement()}),ye}if(a.shadowRootMode===le.none){let c=document.createElement("template");c.innerHTML=a.HTML,d=c.content.firstElementChild,Ho().then(l=>{l.connectedCallback(d,d)})}else{let c=Ws(e.name+t.id);ko.includes(c)||(Fs(c,a.HTML,a.shadowRootMode),ko.push(c)),d=document.createElement(c)}return s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),d.id=p,i!=null&&i.hidden&&(d.style.opacity="0",d.style.position="absolute",d.style.height="0",d.style.width="0",d.style.pointerEvents="none",d.style.visibility="hidden"),this.appendChild(s,d,i),new Re(e,t,s,d,i)})}isMyopWebComponent(e){return e.trimStart().startsWith(As)}extractWebComponentScript(e){let i=new DOMParser().parseFromString(e,"text/html").getElementById(Ks);return(i==null?void 0:i.textContent)||null}executeWebComponentScript(e,t){if(_o.has(t)){console.log("[MyopWebComponent] Script already executed for ".concat(t,", skipping"));return}let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s),_o.add(t),console.log("[MyopWebComponent] Executed web component script: ".concat(t))}async loadExtractedWebComponent(e,t,s,i,a){let p=this.extractWebComponentScript(i);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=window.__MYOP_TAG_NAME__;this.executeWebComponentScript(p,d);let l=window.__MYOP_TAG_NAME__;if(!l)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");c&&c!==l&&console.warn("[MyopWebComponent] __MYOP_TAG_NAME__ changed from ".concat(c," to ").concat(l));let u="myop-comp-".concat(E()),g=document.createElement(l);g.id=u,a!=null&&a.hidden&&(g.style.opacity="0",g.style.position="absolute",g.style.height="0",g.style.width="0",g.style.pointerEvents="none",g.style.visibility="hidden"),s.querySelector('[id^="myop-comp-"]')||(s.innerHTML=""),this.appendChild(s,g,a);let y=new ge(e,t,s,g,l,a);return(a==null?void 0:a.data)!==void 0&&y.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(l,"> into container")),y}}});var Bo,Lo,Po=m(()=>{"use strict";re();b();Bo=(o,n,e)=>{let t="myop-css-".concat(E());return o.send(new D(({rootRef:s,_stylesheet:i,_tagId:a,_css:p})=>{let d=document.createElement("style");d.type="text/css";let c=p;for(let l in i){c+="".concat(l," { ");let u=i[l];for(let g in u)c+="".concat(g,": ").concat(u[g],"; ");c+="} "}d.appendChild(document.createTextNode(c)),d.id=a,(s.shadowRoot||s.container).appendChild(d)},()=>{},{_stylesheet:n,_css:e||"",_tagId:t})),()=>{o.send(new D(({rootRef:s,_tagId:i})=>{let a=(s.shadowRoot||document).getElementById(i);a&&a.remove()},()=>{},{_tagId:t}))}},Lo=(o,n)=>{let e="myop-css-".concat(E());return o.send(new D(({rootRef:t,_tagId:s,_link:i})=>{let a=document.createElement("link");a.id=s,a.rel="stylesheet",a.href=i,document.head.appendChild(a),(t.shadowRoot||t.container).appendChild(a)},()=>{},{_link:n,_tagId:e})),()=>{o.send(new D(({rootRef:t,_tagId:s})=>{let i=(t.shadowRoot||document).getElementById(s);i&&i.remove()},()=>{},{_tagId:e}))}}});var Ns,fn,Oo,Ao=m(()=>{"use strict";Ns=(o,n)=>{let e=new RegExp(Object.keys(n).join("|"),"g");return o.replace(e,t=>(n[t]||t).toString())},fn=(o,n)=>{let e=o.loader;if(e.type!=="IframeLoader")throw new Error('iframeSkinUrlTokenizer received skin with loader type "'.concat(e.type,'", currently only "IframeLoader" is supported'));return o.loader=M({},o.loader),o.loader.url=Ns(o.loader.url,n),o},Oo=o=>async n=>fn(n,o)});var Ko,zo,Fo=m(()=>{"use strict";b();Ko=(o,n,e)=>{o.send(new V(({ref:t,_className:s})=>{t==null||t.classList.add(s)},{elementId:e,_className:n}))},zo=(o,n,e)=>{o.send(new V(({ref:t,_className:s})=>{t==null||t.classList.remove(s)},{elementId:e,_className:n}))}});var ht,gt,Mt,yt,$o=m(()=>{"use strict";re();ht=class ht{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"id",this._runTimeId);r(this,"name",this._runTimeName);r(this,"description","");r(this,"loader",null);r(this,"withLoader",n=>(this.loader=n,this));r(this,"withHTMLLoader",n=>(n.type="HTMLLoader",this.loader=n,this));r(this,"build",()=>this)}};r(ht,"create",()=>new ht);gt=ht,Mt=class Mt{constructor(){r(this,"_runTimeInstanceId","runtime-instance-id-"+E());r(this,"_runTimeId","runtime-id-"+E());r(this,"_runTimeName","runtime-name-"+E());r(this,"instance",{id:this._runTimeInstanceId,componentId:this._runTimeId,componentName:this._runTimeName,skinSelector:null});r(this,"name",this._runTimeName);r(this,"type",{id:this._runTimeId,name:this._runTimeName,description:"",props:[],refs:[],skins:[],defaultSkin:0});r(this,"withInstance",n=>(this.instance=n,this));r(this,"withType",n=>(this.type=n,this));r(this,"withName",n=>(this.name=n,this));r(this,"withDefaultSkin",n=>(this.type.skins.push(n),this.type.defaultSkin=this.type.skins.length-1,this.instance.skinSelector={type:"Dedicated",skin:{id:n.id}},this));r(this,"withRef",n=>(this.type.refs.push(n),this));r(this,"withBasicRef",n=>{let e={id:"",name:n,description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}};return this.type.refs.push(e),this});r(this,"build",()=>JSON.parse(JSON.stringify(this)))}};r(Mt,"create",()=>new Mt);yt=Mt});var Us,It,qs,Vs,te,ne,Wo,No=m(()=>{"use strict";w();Us=o=>({instance:{id:"auto",componentId:o.componentId,componentName:o.name,skinSelector:{type:"Dedicated",skin:{id:"skin_auto_v2_converted"}}},type:{id:o.id,name:o.name,description:o.description,props:[{id:"in_auto_v2_converted",name:"myop_init_interface",type:"any",behavior:{type:Ee.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:Ee.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),It="__MYOP_CLOUD_REPOSITORY_MAIN__",qs=()=>{if(typeof window<"u")return window[It];if(typeof globalThis<"u")return globalThis[It]},Vs=o=>{typeof window<"u"&&(window[It]=o),typeof globalThis<"u"&&(globalThis[It]=o)},te=class te{constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production")}static get Main(){let n=qs();return n||(te._main||(te._main=new te,Vs(te._main)),te._main)}setEnvironment(n){this._defaultEnv=n}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async fetchComponentV2(n,e,t){let s=this.preloadedComponents[n],i=e!==void 0||t!==void 0,a,p;!i&&s?(a=s.env,p=s.preview):(a=e||this._defaultEnv,p=t===!0?!0:t===!1?!1:!e);let d="".concat(n,":").concat(a,":").concat(p?"preview":"live");return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:a,usePreview:p,cacheKey:d,cached:d in this.variants}),this.variants[d]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:a,preview:p}),this.variants[d]=new Promise(async(c,l)=>{try{let u="".concat(this._baseUrl,"/consume?id=").concat(n,"&env=").concat(a);p&&(u+="&preview=true");let h=(await(await fetch(u)).json()).item;if(!h){l(new Error('Component "'.concat(n,'" not found')));return}if(!h.consume_variant||!h.consume_variant.length){l(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(a,'"')));return}let Y=Us(h);c(Y)}catch(u){l(u)}})),await this.variants[d]}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(s=>s.type.id===n):(await this.fetchAutoFlow(n)).components[0]}async fetchAutoFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let i=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(i.item)}catch(s){t(s)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};r(te,"_main",null);ne=te,Wo=ne});var Uo,qo=m(()=>{"use strict";Uo=async o=>await o()});var un={};oe(un,{CloudRepository:()=>ne,ComponentConfig:()=>yt,SkinConfig:()=>gt,addClass:()=>Ko,applyStylesheet:()=>Bo,applyStylesheetLink:()=>Lo,changeSkinUrlByTokenizer:()=>Oo,createIframeSkinByTokenizer:()=>fn,exec:()=>Uo,removeClass:()=>zo,v2_CloudRepository:()=>Wo});var Ct=m(()=>{"use strict";Po();Ao();Fo();$o();No();qo()});var Vo,jo=m(()=>{"use strict";zt();Ct();w();Vo=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[s,...i]=Kt(t);switch(s){case"component":{let[a,p]=i,d=await ne.Main.fetchComponent(a);if(d&&d.type.skins.find(l=>l.id===p))return d.instance.skinSelector={type:fe.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Kt(t),c=(await ne.Main.fetchFlow(a)).components.find(l=>l.type.id===o.type.id);if(c&&c.instance.skinSelector.type===fe.Segmented&&c.instance.resolvedExperiences){let l=c.instance.resolvedExperiences.find(u=>u.id===p);if((l==null?void 0:l.type)===Je.Segment){let u=l,y=c.instance.skinSelector.segments.find(h=>h.segmentId===u.segment.id);if(y)return c.instance.skinSelector=y==null?void 0:y.skinSelector,c}}}break}}}finally{return null}}});var Qo={};oe(Qo,{HostSDK:()=>F,hostSDK:()=>Yo});var Go,F,Yo,Fe=m(()=>{"use strict";se();I();b();co();mo();We();w();Ge();Do();jo();Go="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",F=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"initiated",!1);r(this,"version",Me);r(this,"type2InstanceCount",{});r(this,"assignId",n=>(this.type2InstanceCount[n.id]||(this.type2InstanceCount[n.id]=0),"".concat(n.id,"_").concat(++this.type2InstanceCount[n.id])));r(this,"inspected",!1);r(this,"inspect",()=>{this.inspected||(this.inspected=!0,this.components.forEach(n=>{n.inspect&&n.inspect()}))});r(this,"incomingMessageHandler",n=>{if(n.origin,document.location.origin,n.data.myop){if(n.data.direction!==v.up&&n.data.messageType!==f.EnvelopedMessage)return;let e=n.data;if(e.messageType===f.InitRequest){this.components2init.forEach(s=>{s.send(new Ie(s.id))});return}if(e.messageType===f.InitResponse){this.components2init=this.components2init.filter(i=>i.id!==e.content.id);let s=this.components.find(i=>{var a;return i.id===((a=e.content)==null?void 0:a.id)});s==null||s.setInitiated();return}if(e.messageType===f.EnvelopedMessage){let s=e,i=this.components.find(a=>a.id===s.destination);if(i){if(s.direction===v.down){s.message.messageType===z.name?i.onMessageReceived(s.message):(s.message.route=s.route,i.send(s.message));return}}else{let a=this.components.find(p=>p.id===s.message.destination);a&&a.send(s.message)}return}let t=this.components.find(s=>s.id===e.destination);if(!t){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e);return}if(t){if(t.onMessageReceived(e))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(e)}}});r(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});r(this,"init",n=>{if(this.initiated)throw new Error("hostSDK already initiated");let e=[new Ze,new tt,new ut];if(this.componentsLoaders=[...e],n){let t={};n.forEach(s=>{let i=new s(this.componentsLoaders);t[i.type]=i}),this.componentsLoaders.forEach(s=>{t[s.type]||(t[s.type]=s)}),this.componentsLoaders=Object.values(t)}window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});r(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var i;async function s(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case fe.Dedicated:return((i=n.skin)==null?void 0:i.id)||n.skins[0].id;case fe.Segmented:{let p=await s(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(y=>y.type===Je.Segment?y.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let u=c.segment,g=(t||{})[u.function];return g?await g():(console.warn("segmentId:".concat(d.segmentId,", ").concat(u.function," function not provided !")),!1)});if(p)return this._getSkinIdBySkinSelector(p.skinSelector,e);debugger}break;default:debugger}return""});r(this,"runSkinSelector",async(n,e)=>{let t=await this._getSkinIdBySkinSelector(n.instance.skinSelector,n.instance.resolvedExperiences,e);return n.type.skins.find(s=>s.id===t)});r(this,"loaderHooks");r(this,"loadComponent",async(n,e,t)=>{var l,u,g,y;if(!e){debugger;throw new Error("no container was found for this component")}let s=await Vo(n);s&&(n=s);let i=M(M({},(l=this.loaderHooks)!=null?l:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=M({},n),n.instance=M({},n.instance);let h=await this.runSkinSelector(n,i);if(!h)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(h=await t.hooks.afterSkinSelected(M({},h))),n.instance.skinSelector={type:fe.Dedicated,skin:h},t&&(t=M({},t),delete t.hooks),await sn(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,i);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(y=t==null?void 0:t.hooks)!=null&&y.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(M({},p)));let d=this.componentsLoaders.find(h=>h.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(h=>h!==c),this.components2init=this.components2init.filter(h=>h!==c),!0)),this.components.push(c),(!t||t.connectProps!==!1)&&(c=po(c,n.type.props,p));try{await rn(c,n,this.components)}catch(h){throw h}return t!=null&&t.skipInit||await c.initiated(),c});r(this,"navigate",async(n,e,t)=>{if(n.parent)throw new Error("Navigating on remote ref components is not implemented yet");if(t!=null&&t.staged){let s=await this.loadComponent(e,n.container,M({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(s),s.show(),n.dispose(),s}else{let s=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,M({relative:{direction:"before",child:s}},t))}})}};r(F,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Go});if(!window.myop.hostSDK){let o=new F;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Go}),window.myop.hostSDK=o}Yo=window.myop.hostSDK;$("hostSDK",Yo)});var xt,Jo=m(()=>{"use strict";I();ee();w();b();xt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(B.id,"]")),s=[];t.forEach(i=>{let a=i.getAttribute(B.id);a&&s.push(new xe(a,i.tagName,i.getBoundingClientRect()))}),this.messageToHost(new me(e.handlerUniqueId,s))})}}});var bt,Xo=m(()=>{"use strict";I();w();b();P();bt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.BindClickMessage);r(this,"executor",e=>{let t=[];return S(e.ref,document).forEach(i=>{let a=()=>{this.messageToHost(new ie,e)};i.addEventListener("click",a);let p=()=>{i.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(i=>i())}})}}});var wt,Zo=m(()=>{"use strict";I();w();P();wt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ChangeTextMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.textContent=e.content})})}}});var St,es=m(()=>{"use strict";I();b();w();mn();St=class extends x{constructor(){super(...arguments);r(this,"messageType",f.ExecuteScriptMessage);r(this,"executor",e=>{dt(e,s=>{this.messageToHost(new ae(e.handlerUniqueId,s))},new Se(document.documentElement))})}}});var Et,ts=m(()=>{"use strict";I();w();b();ue();P();Et=class extends x{constructor(){super(...arguments);r(this,"messageType",f.AddEventListenerMessage);r(this,"executor",e=>{let t=S(e.ref,document),s=[];return t.forEach(i=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new pe(e.handlerUniqueId,A(p,e.serializableSkeleton)))})};i.addEventListener(e.type,a),s.push(()=>{i.removeEventListener(e.type,a)})}),()=>{s.forEach(i=>{i()})}})}}});var Tt,ns=m(()=>{"use strict";I();w();P();Tt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetAttributeMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.setAttribute(e.name,e.value)})})}}});var vt,os=m(()=>{"use strict";I();ee();w();Fe();Ye();vt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let s=document.querySelectorAll("[".concat(B.id,"='").concat(e.refConfig.selector,"']"));if(s.length===1){let a=await F.Instance().loadComponent(e.nestedComponentConfig,s.item(0),e.options),p=[];Object.keys(a.refs).forEach(d=>{let c=a.refs[d];c=c.__nonProxied||c,c.componentDefinition&&p.push({refName:d,componentDefinitionId:c.componentDefinition.id})}),this.messageToHost(new j(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new j(e.handlerUniqueId,[],!0));debugger}})().then()})}}});var ss,rs=m(()=>{"use strict";ss=(o,n)=>{if(!o){console.log("n");return}let e=window.MutationObserver||window.WebKitMutationObserver;if(!(!o||o.nodeType!==1))if(e){let t=new e(n),s={attributes:!0,childList:!0,subtree:!0};return t.observe(o,s),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))}});var Rt,is=m(()=>{"use strict";I();b();w();rs();Rt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&ss(document.body,()=>{this.messageToHost(new Le)})})}}});var as,_t,ps=m(()=>{"use strict";I();ee();w();b();ue();P();as=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),s=-1;return t.forEach(i=>{if(typeof i.value=="string"){let a=i.getAttribute(B.id),p=i.getAttribute("name"),d={id:i.id,name:p,value:as(i),required:i.required,validity:A(i.validity,!0),myopId:a};e.unmappedData.push(d),p&&(!e.formData[p]||!e.formData[p].value||d.value)&&(e.formData[p]=d)}}),e}return o.type==="checkbox"||o.type==="radio"?o.checked?o.value:null:o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.tagName==="SELECT"?o.value:o.isContentEditable?o.innerText||o.textContent:null},_t=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetElementValueMessage);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{this.messageToHost(new de(as(s)),e)})})}}});var kt,ds=m(()=>{"use strict";I();w();b();P();kt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.GetAttributeMessage);r(this,"executor",e=>{let t=lo(e.ref,document);t&&this.messageToHost(new Be(t.getAttribute(e.name)),e)})}}});var Ht,cs=m(()=>{"use strict";b();I();w();Ht=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(s=>{this.messageToHost(new Ke)});return t.observe(document.body),()=>{t.disconnect()}})}}});var Dt,ms=m(()=>{"use strict";I();w();P();Dt=class extends x{constructor(){super(...arguments);r(this,"messageType",f.SetInnerHtml);r(this,"executor",e=>{S(e.ref,document).forEach(s=>{s.innerHTML=e.content})})}}});var ls={};oe(ls,{IframeSDK:()=>Bt});var Bt,fs=m(()=>{"use strict";w();Jo();Xo();Zo();es();se();ts();ns();b();os();is();ps();Ge();ds();cs();ms();Bt=class extends be{constructor(){super();r(this,"version",Me);r(this,"messageToHost",(e,t)=>{var i;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let s=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=s[0]),e.source||(e.source=s[0]),e.direction=v.up,(i=window.parent)==null||i.postMessage(M({},e),"*")});r(this,"supportedHandlers",[new wt(this.messageToHost),new Dt(this.messageToHost),new bt(this.messageToHost),new xt(this.messageToHost),new St(this.messageToHost),new Et(this.messageToHost),new Tt(this.messageToHost),new _t(this.messageToHost),new Rt(this.messageToHost),new Ht(this.messageToHost),new kt(this.messageToHost),new vt(this.messageToHost)]);r(this,"init",()=>{window.onmessage=this.handleIncomeMessages.bind(this),this.messageToHost(new ce)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};$("IframeSDK",Bt)});var Gs={};var js,us=m(()=>{"use strict";b();se();js=M({},Ce);$("MyopMessages",js)});var gs={};oe(gs,{CloudRepository:()=>ne,ComponentConfig:()=>yt,SkinConfig:()=>gt,addClass:()=>Ko,applyStylesheet:()=>Bo,applyStylesheetLink:()=>Lo,changeSkinUrlByTokenizer:()=>Oo,createIframeSkinByTokenizer:()=>fn,exec:()=>Uo,removeClass:()=>zo,v2_CloudRepository:()=>Wo});var ys=m(()=>{"use strict";se();Ct();Ct();$("MyopHelpers",un)});var Zs={};oe(Zs,{getHostModule:()=>hs,getIframeModule:()=>Ms,getWebcomponentModule:()=>Is});se();var Rn;if(window.__federation__)console.log("__federation__ loaded more than once.");else{let o=(Rn=document.currentScript)==null?void 0:Rn.src,n=o?o.split("/").slice(0,-1).join("/"):"";window.__federation__={__public_auto_path__:n,__use_public_auto_path__:!0,__public_path__:void 0,__loading_timeout__:5*1e3}}window.__federation__.load__federation__=(o,n,e)=>{if(window.__federation__[n])console.log("__federation__ module ".concat(n," already loaded.")),e(window.__federation__[n][At]);else{let t;window.__federation__[n]={},window.__federation__[n][je]=s=>{t&&(document.head.removeChild(t),t=null),window.__federation__[n][At]=s,e(s)},t=document.createElement("script"),t.type="module",t.src=o,t.async=!0,document.head.appendChild(t)}};Ge();console.log("myop root sdk - loaded",document.location.origin);var Ys="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",hs=()=>Promise.resolve().then(()=>(Fe(),Qo)),Ms=()=>Promise.resolve().then(()=>(fs(),ls)),Is=()=>Promise.resolve().then(()=>(ln(),So)),Qs=()=>Promise.resolve().then(()=>(us(),Gs)),Js=()=>Promise.resolve().then(()=>(ys(),gs)),Ne=o=>async()=>(await o()).get(),Xs={version:Me,getHostModule:Ne(hs),getIframeModule:Ne(Ms),getWebcomponentModule:Ne(Is),getMyopMessages:Ne(Qs),getMyopHelpers:Ne(Js)};window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Ys});window.myop.rootSDK?console.log("myop root host loaded more than once."):window.myop=M({rootSDK:Xs},window.myop);return Rs(Zs);})();
|
|
4
4
|
`;
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
5
|
+
var it = Object.defineProperty, Vt = Object.defineProperties, Gt = Object.getOwnPropertyDescriptors, je = Object.getOwnPropertySymbols, Yt = Object.prototype.hasOwnProperty, Jt = Object.prototype.propertyIsEnumerable, Re = (e, t, s) => t in e ? it(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, b = (e, t) => {
|
|
6
|
+
for (var s in t || (t = {}))
|
|
7
|
+
Yt.call(t, s) && Re(e, s, t[s]);
|
|
8
|
+
if (je)
|
|
9
|
+
for (var s of je(t))
|
|
10
|
+
Jt.call(t, s) && Re(e, s, t[s]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
13
|
-
for (var
|
|
14
|
-
|
|
15
|
-
}, a = (e, t,
|
|
12
|
+
}, fe = (e, t) => Vt(e, Gt(t)), Qt = (e, t) => {
|
|
13
|
+
for (var s in t)
|
|
14
|
+
it(e, s, { get: t[s], enumerable: !0 });
|
|
15
|
+
}, a = (e, t, s) => Re(e, typeof t != "symbol" ? t + "" : t, s), v = (e, t, s) => new Promise((n, i) => {
|
|
16
16
|
var o = (l) => {
|
|
17
17
|
try {
|
|
18
|
-
c(
|
|
18
|
+
c(s.next(l));
|
|
19
19
|
} catch (d) {
|
|
20
20
|
i(d);
|
|
21
21
|
}
|
|
22
22
|
}, r = (l) => {
|
|
23
23
|
try {
|
|
24
|
-
c(
|
|
24
|
+
c(s.throw(l));
|
|
25
25
|
} catch (d) {
|
|
26
26
|
i(d);
|
|
27
27
|
}
|
|
28
|
-
}, c = (l) => l.done ?
|
|
29
|
-
c((
|
|
30
|
-
}),
|
|
31
|
-
window[
|
|
32
|
-
},
|
|
28
|
+
}, c = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(o, r);
|
|
29
|
+
c((s = s.apply(e, t)).next());
|
|
30
|
+
}), Me = "__federation__", Ve = "onLoad", ot = (e, t) => {
|
|
31
|
+
window[Me] && window[Me][e] && window[Me][e][Ve] && window[Me][e][Ve]({ [e]: t });
|
|
32
|
+
}, w = {
|
|
33
33
|
//host to component
|
|
34
34
|
InitRequest: "InitRequest",
|
|
35
35
|
InitResponse: "InitResponse",
|
|
@@ -53,51 +53,51 @@ var Ve = Object.defineProperty, Pt = Object.defineProperties, At = 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: () =>
|
|
74
|
-
ExecuteScriptMessage: () =>
|
|
75
|
-
ExecuteScriptReplyMessage: () =>
|
|
76
|
-
GetAttributeMessage: () =>
|
|
77
|
-
GetAttributeReplayMessage: () =>
|
|
78
|
-
GetElementValueMessage: () =>
|
|
79
|
-
InitMessage: () =>
|
|
80
|
-
InitRequest: () =>
|
|
81
|
-
InitResponse: () =>
|
|
56
|
+
}, De = {};
|
|
57
|
+
Qt(De, {
|
|
58
|
+
AddEventListenerMessage: () => rs,
|
|
59
|
+
BaseMyopMessage: () => S,
|
|
60
|
+
BindClickMessage: () => ss,
|
|
61
|
+
ChangeTextMessage: () => ns,
|
|
62
|
+
CleanupMessage: () => St,
|
|
63
|
+
CleanupReplayMessage: () => It,
|
|
64
|
+
ClickReplayMessage: () => ct,
|
|
65
|
+
CreateRefComponentMessage: () => wt,
|
|
66
|
+
CustomRefMessage: () => ke,
|
|
67
|
+
DetectMyopRefsMessage: () => ds,
|
|
68
|
+
DetectedMyopRefsMessage: () => bt,
|
|
69
|
+
DisposeMessage: () => Tt,
|
|
70
|
+
ElementValueReplayMessage: () => ft,
|
|
71
|
+
EnvelopedMessage: () => _t,
|
|
72
|
+
EventListenerCallbackMessage: () => pt,
|
|
73
|
+
ExecuteComponentMethod: () => U,
|
|
74
|
+
ExecuteScriptMessage: () => j,
|
|
75
|
+
ExecuteScriptReplyMessage: () => ut,
|
|
76
|
+
GetAttributeMessage: () => us,
|
|
77
|
+
GetAttributeReplayMessage: () => hs,
|
|
78
|
+
GetElementValueMessage: () => cs,
|
|
79
|
+
InitMessage: () => Ae,
|
|
80
|
+
InitRequest: () => gt,
|
|
81
|
+
InitResponse: () => yt,
|
|
82
82
|
MessageDirection: () => k,
|
|
83
|
-
MutationObserverMessage: () =>
|
|
84
|
-
MyopBindMessage: () =>
|
|
85
|
-
MyopBindReplayMessage: () =>
|
|
86
|
-
MyopElementMessage: () =>
|
|
87
|
-
Ref: () =>
|
|
88
|
-
RefComponentCreatedMessage: () =>
|
|
89
|
-
ResizeObserverMessage: () =>
|
|
90
|
-
SetAttributeMessage: () =>
|
|
91
|
-
SetInnerHtml: () =>
|
|
92
|
-
SetMutationObserverMessage: () =>
|
|
93
|
-
SetResizeObserverMessage: () =>
|
|
94
|
-
stripFunction: () =>
|
|
83
|
+
MutationObserverMessage: () => ms,
|
|
84
|
+
MyopBindMessage: () => F,
|
|
85
|
+
MyopBindReplayMessage: () => A,
|
|
86
|
+
MyopElementMessage: () => ts,
|
|
87
|
+
Ref: () => ue,
|
|
88
|
+
RefComponentCreatedMessage: () => Le,
|
|
89
|
+
ResizeObserverMessage: () => ys,
|
|
90
|
+
SetAttributeMessage: () => as,
|
|
91
|
+
SetInnerHtml: () => ls,
|
|
92
|
+
SetMutationObserverMessage: () => ps,
|
|
93
|
+
SetResizeObserverMessage: () => fs,
|
|
94
|
+
stripFunction: () => dt
|
|
95
95
|
});
|
|
96
|
-
var
|
|
96
|
+
var Q = () => "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
|
-
),
|
|
100
|
-
const t = [...e].map((
|
|
99
|
+
), Xt = (e) => {
|
|
100
|
+
const t = [...e].map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
101
101
|
return [
|
|
102
102
|
t.slice(0, 8),
|
|
103
103
|
t.slice(8, 12),
|
|
@@ -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
|
+
}, Zt = (e) => {
|
|
109
109
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
110
110
|
for (; t.length % 4; ) t += "=";
|
|
111
|
-
const
|
|
112
|
-
return Uint8Array.from(
|
|
113
|
-
},
|
|
114
|
-
const t =
|
|
111
|
+
const s = atob(t);
|
|
112
|
+
return Uint8Array.from(s, (n) => n.charCodeAt(0));
|
|
113
|
+
}, Ge = (e) => {
|
|
114
|
+
const t = Zt(e);
|
|
115
115
|
if (t.length % 16 !== 0) throw new Error("Invalid input length");
|
|
116
|
-
const
|
|
117
|
-
for (let
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
},
|
|
116
|
+
const s = [];
|
|
117
|
+
for (let n = 0; n < t.length; n += 16)
|
|
118
|
+
s.push(Xt(t.slice(n, n + 16)));
|
|
119
|
+
return s;
|
|
120
|
+
}, es = (e) => new Promise((t) => setTimeout(t, e)), k = class {
|
|
121
121
|
};
|
|
122
122
|
a(k, "down", "down");
|
|
123
123
|
a(k, "up", "up");
|
|
124
|
-
var
|
|
124
|
+
var S = class {
|
|
125
125
|
constructor() {
|
|
126
|
-
a(this, "id",
|
|
126
|
+
a(this, "id", Q()), a(this, "myop", !0), a(this, "content"), a(this, "source"), a(this, "destination"), a(this, "route"), a(this, "ref"), a(this, "direction"), a(this, "cleanable", !1);
|
|
127
127
|
}
|
|
128
128
|
static create(...t) {
|
|
129
129
|
return new this(...t);
|
|
@@ -131,27 +131,27 @@ var b = class {
|
|
|
131
131
|
isTypeof(t) {
|
|
132
132
|
return t.messageType === this.messageType;
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, ts = class extends S {
|
|
135
135
|
constructor(e) {
|
|
136
136
|
super(), this.ref = e;
|
|
137
137
|
}
|
|
138
|
-
},
|
|
138
|
+
}, A = class extends S {
|
|
139
139
|
constructor(e) {
|
|
140
140
|
super(), this.replayToHandler = e;
|
|
141
141
|
}
|
|
142
|
-
},
|
|
142
|
+
}, F = class extends S {
|
|
143
143
|
constructor(t) {
|
|
144
|
-
super(), this.handler = t, a(this, "handlerUniqueId",
|
|
144
|
+
super(), this.handler = t, a(this, "handlerUniqueId", Q());
|
|
145
145
|
}
|
|
146
|
-
},
|
|
147
|
-
constructor(t,
|
|
148
|
-
this.refConfig = t, this.component =
|
|
146
|
+
}, ue = class rt {
|
|
147
|
+
constructor(t, s) {
|
|
148
|
+
this.refConfig = t, this.component = s, a(this, "myop", !0), a(this, "__nonProxied"), this.__nonProxied = fe(b({}, this), {
|
|
149
149
|
component: null
|
|
150
150
|
// in order to be serializable
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
static create(t,
|
|
154
|
-
let i =
|
|
153
|
+
static create(t, s, n) {
|
|
154
|
+
let i = s;
|
|
155
155
|
return i || (i = {
|
|
156
156
|
id: "",
|
|
157
157
|
name: "",
|
|
@@ -161,164 +161,164 @@ var b = class {
|
|
|
161
161
|
behavior: {
|
|
162
162
|
type: "code"
|
|
163
163
|
}
|
|
164
|
-
}), new
|
|
164
|
+
}), new rt(i, n);
|
|
165
165
|
}
|
|
166
|
-
},
|
|
166
|
+
}, at = "ClickReplayMessage", ss = class extends F {
|
|
167
167
|
constructor(e, t) {
|
|
168
|
-
super(t), this.ref = e, a(this, "replyMessageKey",
|
|
168
|
+
super(t), this.ref = e, a(this, "replyMessageKey", at), a(this, "messageType", "BindClickMessage"), a(this, "cleanable", !0);
|
|
169
169
|
}
|
|
170
|
-
},
|
|
170
|
+
}, ct = class extends A {
|
|
171
171
|
constructor() {
|
|
172
|
-
super(...arguments), a(this, "messageType",
|
|
172
|
+
super(...arguments), a(this, "messageType", at);
|
|
173
173
|
}
|
|
174
|
-
},
|
|
174
|
+
}, ns = class extends S {
|
|
175
175
|
constructor(e, t) {
|
|
176
176
|
super(), this.ref = e, a(this, "messageType", "ChangeTextMessage"), this.content = t;
|
|
177
177
|
}
|
|
178
|
-
},
|
|
179
|
-
let t = e.match(
|
|
178
|
+
}, lt = "ExecuteScriptReplyMessage", is = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, os = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, dt = (e) => {
|
|
179
|
+
let t = e.match(is);
|
|
180
180
|
if (t)
|
|
181
181
|
return t[1] || t[3];
|
|
182
182
|
{
|
|
183
|
-
let
|
|
184
|
-
if (
|
|
185
|
-
return
|
|
183
|
+
let s = e.match(os);
|
|
184
|
+
if (s)
|
|
185
|
+
return s[1].trim();
|
|
186
186
|
}
|
|
187
|
-
},
|
|
188
|
-
constructor(t,
|
|
189
|
-
},
|
|
190
|
-
super(
|
|
187
|
+
}, j = class extends F {
|
|
188
|
+
constructor(t, s = () => {
|
|
189
|
+
}, n) {
|
|
190
|
+
super(s), this.scriptInputs = n, a(this, "replyMessageKey", lt), a(this, "messageType", "ExecuteScriptMessage"), a(this, "script", ""), this.script = t.toString(), this.content = t.toString(), this.content = dt(this.content);
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
a(
|
|
194
|
-
a(
|
|
195
|
-
var
|
|
193
|
+
a(j, "replierKey", "send");
|
|
194
|
+
a(j, "completeStreamKey", "completeStream");
|
|
195
|
+
var ut = class extends A {
|
|
196
196
|
constructor(e, t) {
|
|
197
|
-
super(e), this.replayToHandler = e, this.content = t, a(this, "messageType",
|
|
197
|
+
super(e), this.replayToHandler = e, this.content = t, a(this, "messageType", lt);
|
|
198
198
|
}
|
|
199
|
-
},
|
|
200
|
-
constructor(e, t,
|
|
199
|
+
}, ke = class extends j {
|
|
200
|
+
constructor(e, t, s = () => {
|
|
201
201
|
}) {
|
|
202
|
-
super(({ rootRef:
|
|
203
|
-
const c = (
|
|
202
|
+
super(({ rootRef: n, elementId: i, _script: o, __scriptInputs: r }) => {
|
|
203
|
+
const c = (n.shadowRoot || n.container).querySelectorAll(`[myop-id='${i}']`);
|
|
204
204
|
return c.length ? (r.ref = c[0], new Function(`return (${o})(...arguments)`)(r)) : null;
|
|
205
|
-
},
|
|
205
|
+
}, s), this.scriptInputs = t, this.scriptInputs = fe(b({}, t), {
|
|
206
206
|
//_script: stripFunction(script.toString()),
|
|
207
207
|
_script: e.toString()
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
},
|
|
210
|
+
}, ht = "EventListenerCallbackMessage", rs = class extends F {
|
|
211
211
|
// {} // empty
|
|
212
|
-
constructor(e, t,
|
|
213
|
-
super(
|
|
212
|
+
constructor(e, t, s) {
|
|
213
|
+
super(s), this.ref = e, this.type = t, this.handler = s, a(this, "replyMessageKey", ht), a(this, "messageType", "AddEventListenerMessage"), a(this, "cleanable", !0), a(this, "serializableSkeleton", !1);
|
|
214
214
|
}
|
|
215
215
|
withSerializableSkeleton(e) {
|
|
216
216
|
return this.serializableSkeleton = e, this;
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, pt = class extends A {
|
|
219
219
|
constructor(e, t) {
|
|
220
|
-
super(e), this.replayToHandler = e, this.e = t, a(this, "messageType",
|
|
220
|
+
super(e), this.replayToHandler = e, this.e = t, a(this, "messageType", ht), this.content = {
|
|
221
221
|
e: t
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
|
-
},
|
|
225
|
-
constructor(e, t,
|
|
226
|
-
super(), this.ref = e, this.name = t, this.value =
|
|
224
|
+
}, as = class extends S {
|
|
225
|
+
constructor(e, t, s) {
|
|
226
|
+
super(), this.ref = e, this.name = t, this.value = s, a(this, "messageType", "SetAttributeMessage");
|
|
227
227
|
}
|
|
228
|
-
},
|
|
228
|
+
}, mt = "ElementValueReplayMessage", cs = class extends F {
|
|
229
229
|
constructor(e, t) {
|
|
230
|
-
super(t), this.ref = e, a(this, "replyMessageKey",
|
|
230
|
+
super(t), this.ref = e, a(this, "replyMessageKey", mt), a(this, "messageType", "GetElementValueMessage");
|
|
231
231
|
}
|
|
232
|
-
},
|
|
232
|
+
}, ft = class extends A {
|
|
233
233
|
constructor(e) {
|
|
234
|
-
super(), this.content = e, a(this, "messageType",
|
|
234
|
+
super(), this.content = e, a(this, "messageType", mt);
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, ls = class extends S {
|
|
237
237
|
constructor(e, t) {
|
|
238
238
|
super(), this.ref = e, a(this, "messageType", "SetInnerHtml"), this.content = t;
|
|
239
239
|
}
|
|
240
|
-
},
|
|
240
|
+
}, Ae = class extends S {
|
|
241
241
|
constructor(e) {
|
|
242
242
|
super(), a(this, "messageType", "InitMessage"), this.content = { id: e };
|
|
243
243
|
}
|
|
244
244
|
isTypeof(e) {
|
|
245
245
|
return e.messageType === this.messageType;
|
|
246
246
|
}
|
|
247
|
-
},
|
|
247
|
+
}, yt = class extends Ae {
|
|
248
248
|
constructor() {
|
|
249
249
|
super(...arguments), a(this, "messageType", "InitResponse");
|
|
250
250
|
}
|
|
251
|
-
},
|
|
251
|
+
}, gt = class extends S {
|
|
252
252
|
constructor() {
|
|
253
253
|
super(...arguments), a(this, "messageType", "InitRequest");
|
|
254
254
|
}
|
|
255
|
-
},
|
|
256
|
-
constructor(e, t,
|
|
257
|
-
super(
|
|
255
|
+
}, vt = "RefComponentCreatedMessage", wt = class extends F {
|
|
256
|
+
constructor(e, t, s, n) {
|
|
257
|
+
super(n), this.refConfig = e, this.nestedComponentConfig = t, this.options = s, a(this, "replyMessageKey", vt), a(this, "messageType", "CreateRefComponentMessage");
|
|
258
258
|
}
|
|
259
|
-
},
|
|
260
|
-
constructor(e, t,
|
|
261
|
-
super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed =
|
|
259
|
+
}, Le = class extends A {
|
|
260
|
+
constructor(e, t, s) {
|
|
261
|
+
super(e), this.replayToHandler = e, this.nestedRefs = t, this.failed = s, a(this, "messageType", vt);
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, _t = class extends S {
|
|
264
264
|
constructor(e, t) {
|
|
265
265
|
super(), this.destination = e, this.message = t, a(this, "messageType", "EnvelopedMessage");
|
|
266
|
-
const
|
|
267
|
-
this.route = [e, ...
|
|
266
|
+
const s = t;
|
|
267
|
+
this.route = [e, ...s.route ? s.route : []];
|
|
268
268
|
}
|
|
269
|
-
},
|
|
269
|
+
}, Mt = "DetectedMyopRefsMessage", ds = class extends F {
|
|
270
270
|
constructor() {
|
|
271
|
-
super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey",
|
|
271
|
+
super(...arguments), a(this, "messageType", "DetectMyopRefsMessage"), a(this, "replyMessageKey", Mt);
|
|
272
272
|
}
|
|
273
|
-
},
|
|
273
|
+
}, bt = class extends A {
|
|
274
274
|
constructor(e, t) {
|
|
275
|
-
super(e), this.replayToHandler = e, a(this, "messageType",
|
|
275
|
+
super(e), this.replayToHandler = e, a(this, "messageType", Mt), this.content = t;
|
|
276
276
|
}
|
|
277
277
|
isTypeof(e) {
|
|
278
278
|
return e.messageType === this.messageType;
|
|
279
279
|
}
|
|
280
|
-
},
|
|
281
|
-
constructor(e, t,
|
|
282
|
-
super(
|
|
280
|
+
}, Et = "GetAttributeReplayMessage", us = class extends F {
|
|
281
|
+
constructor(e, t, s) {
|
|
282
|
+
super(s), this.ref = e, this.name = t, a(this, "replyMessageKey", Et), a(this, "messageType", "GetAttributeMessage");
|
|
283
283
|
}
|
|
284
|
-
},
|
|
284
|
+
}, hs = class extends A {
|
|
285
285
|
constructor(e) {
|
|
286
|
-
super(), this.content = e, a(this, "messageType",
|
|
286
|
+
super(), this.content = e, a(this, "messageType", Et);
|
|
287
287
|
}
|
|
288
|
-
},
|
|
288
|
+
}, U = class extends S {
|
|
289
289
|
constructor(e) {
|
|
290
290
|
super(), this.method = e, a(this, "messageType", "ExecuteComponentMethod");
|
|
291
291
|
}
|
|
292
|
-
},
|
|
292
|
+
}, ps = class extends S {
|
|
293
293
|
constructor() {
|
|
294
294
|
super(...arguments), a(this, "messageType", "SetMutationObserverMessage");
|
|
295
295
|
}
|
|
296
|
-
},
|
|
296
|
+
}, ms = class extends S {
|
|
297
297
|
constructor() {
|
|
298
298
|
super(...arguments), a(this, "messageType", "MutationObserverMessage");
|
|
299
299
|
}
|
|
300
|
-
},
|
|
300
|
+
}, Ct = "CleanupReplayMessage", St = class extends F {
|
|
301
301
|
constructor(e, t) {
|
|
302
|
-
super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey",
|
|
302
|
+
super(t), this.cleanupForMessageId = e, a(this, "replyMessageKey", Ct), a(this, "messageType", "CleanupMessage");
|
|
303
303
|
}
|
|
304
|
-
},
|
|
304
|
+
}, It = class extends A {
|
|
305
305
|
constructor(e) {
|
|
306
|
-
super(), this.customCleanup = e, a(this, "messageType",
|
|
306
|
+
super(), this.customCleanup = e, a(this, "messageType", Ct);
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, Tt = class extends S {
|
|
309
309
|
constructor() {
|
|
310
310
|
super(...arguments), a(this, "messageType", "DisposeMessage");
|
|
311
311
|
}
|
|
312
|
-
},
|
|
312
|
+
}, fs = class extends S {
|
|
313
313
|
constructor() {
|
|
314
314
|
super(...arguments), a(this, "cleanable", !0), a(this, "messageType", "SetResizeObserverMessage");
|
|
315
315
|
}
|
|
316
|
-
},
|
|
316
|
+
}, ys = class extends S {
|
|
317
317
|
constructor() {
|
|
318
318
|
super(...arguments), a(this, "messageType", "ResizeObserverMessage");
|
|
319
319
|
}
|
|
320
|
-
},
|
|
321
|
-
constructor(e, t,
|
|
320
|
+
}, Ie = class {
|
|
321
|
+
constructor(e, t, s) {
|
|
322
322
|
this.componentDefinition = e, this.container = t, a(this, "id", ""), a(this, "messageHandlers", {}), a(this, "element"), a(this, "_markedForDisposed", !1), a(this, "bind", (i, o) => {
|
|
323
323
|
this.messageHandlers[i] || (this.messageHandlers[i] = []), this.messageHandlers[i].includes(o) || this.messageHandlers[i].push(o);
|
|
324
324
|
}), a(this, "bindWhen", (i, o, r) => {
|
|
@@ -334,11 +334,11 @@ var et = class extends P {
|
|
|
334
334
|
this.isInitiated = !0, this._whenInitiatedResolve && this._whenInitiatedResolve();
|
|
335
335
|
}), a(this, "isInitiated", !1), a(this, "_whenInitiatedResolve"), a(this, "_whenInitiatedReject"), a(this, "_whenInitiated", new Promise((i, o) => {
|
|
336
336
|
this._whenInitiatedResolve = i, this._whenInitiatedReject = o;
|
|
337
|
-
})), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (
|
|
338
|
-
const
|
|
337
|
+
})), a(this, "initiated", () => this._whenInitiated), a(this, "props", {}), a(this, "refs", {}), this.id = (s == null ? void 0 : s.id) || Te.Instance().assignId(e);
|
|
338
|
+
const n = s != null && s.timeout ? s == null ? void 0 : s.timeout : 5 * 1e3;
|
|
339
339
|
setTimeout(() => {
|
|
340
|
-
!this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${
|
|
341
|
-
},
|
|
340
|
+
!this.isInitiated && this._whenInitiatedReject && !this._markedForDisposed && this._whenInitiatedReject(`timeout_${n} ${this.id}`);
|
|
341
|
+
}, n), this.initiated().then(() => {
|
|
342
342
|
window.myop.hostSDK.inspected && this.inspect();
|
|
343
343
|
});
|
|
344
344
|
}
|
|
@@ -351,35 +351,35 @@ var et = class extends P {
|
|
|
351
351
|
this._markedForDisposed = e;
|
|
352
352
|
}
|
|
353
353
|
onMessageReceived(e) {
|
|
354
|
-
if (e.messageType ===
|
|
355
|
-
const
|
|
356
|
-
return this[
|
|
354
|
+
if (e.messageType === w.ExecuteComponentMethod) {
|
|
355
|
+
const s = e;
|
|
356
|
+
return this[s.method] ? this[s.method](s.content) : console.log(`method not found ${s.method} on component`, this), !0;
|
|
357
357
|
}
|
|
358
358
|
const t = this.messageHandlers[e.messageType];
|
|
359
359
|
if (t && t.length) {
|
|
360
|
-
let
|
|
361
|
-
return t.forEach((
|
|
362
|
-
|
|
363
|
-
}),
|
|
360
|
+
let s = !1;
|
|
361
|
+
return t.forEach((n) => {
|
|
362
|
+
s = s || n(e);
|
|
363
|
+
}), s;
|
|
364
364
|
}
|
|
365
365
|
return !1;
|
|
366
366
|
}
|
|
367
367
|
sendCleanupMessage(e) {
|
|
368
368
|
e.source = this.id, e.destination = this.id, e.direction = k.down;
|
|
369
|
-
const t = this.bindWhen(e.replyMessageKey, (
|
|
370
|
-
e.handler(
|
|
371
|
-
}),
|
|
372
|
-
delete e.handler, this.send(e), e.handler =
|
|
369
|
+
const t = this.bindWhen(e.replyMessageKey, (n) => n.replayToHandler === e.handlerUniqueId, (n) => {
|
|
370
|
+
e.handler(n), t();
|
|
371
|
+
}), s = e.handler;
|
|
372
|
+
delete e.handler, this.send(e), e.handler = s;
|
|
373
373
|
}
|
|
374
374
|
send(e) {
|
|
375
375
|
e.source || (e.source = this.id), e.destination || (e.destination = this.id), e.direction = k.down;
|
|
376
376
|
let t;
|
|
377
377
|
if (e.handler) {
|
|
378
|
-
const
|
|
379
|
-
t = this.bindWhen(
|
|
378
|
+
const s = e;
|
|
379
|
+
t = this.bindWhen(s.replyMessageKey, (n) => n.replayToHandler === s.handlerUniqueId, s.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 St(e.id, (s) => {
|
|
383
383
|
})), t && t();
|
|
384
384
|
} : () => {
|
|
385
385
|
};
|
|
@@ -387,68 +387,68 @@ var et = class extends P {
|
|
|
387
387
|
dispose() {
|
|
388
388
|
if (this.markedForDisposed = !0, !this.isInitiated)
|
|
389
389
|
return;
|
|
390
|
-
console.log("disposing component", this.id), this.send(new
|
|
390
|
+
console.log("disposing component", this.id), this.send(new Tt());
|
|
391
391
|
const e = this.messageHandlers.onDispose;
|
|
392
392
|
e && e.forEach((t) => {
|
|
393
393
|
t(null);
|
|
394
394
|
}), this.messageHandlers = {}, this.id += "_disposed", this.isInitiated = !1;
|
|
395
395
|
}
|
|
396
|
-
},
|
|
397
|
-
constructor(e, t,
|
|
398
|
-
this.myopId = e, this.htmlTagName = t, this.BoundingRect =
|
|
396
|
+
}, gs = class {
|
|
397
|
+
constructor(e, t, s, n, i) {
|
|
398
|
+
this.myopId = e, this.htmlTagName = t, this.BoundingRect = s, this.offsetTop = n, this.offsetLeft = i, a(this, "type", "MyopElementRef");
|
|
399
399
|
}
|
|
400
|
-
},
|
|
400
|
+
}, vs = (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
|
+
}), ws = class {
|
|
408
408
|
//TODO : add dispose method
|
|
409
409
|
constructor(e) {
|
|
410
410
|
this.messageToHost = e;
|
|
411
411
|
}
|
|
412
|
-
},
|
|
412
|
+
}, _s = class extends ws {
|
|
413
413
|
constructor(e, t) {
|
|
414
414
|
super(e), this.messageToHost = e, this.context = t;
|
|
415
415
|
}
|
|
416
|
-
},
|
|
416
|
+
}, Ms = class {
|
|
417
417
|
//onMessageReceived: (msg: IMyopMessage) => void;
|
|
418
418
|
constructor(e, t) {
|
|
419
|
-
this.id = e, this.context = t, a(this, "send", (
|
|
419
|
+
this.id = e, this.context = t, a(this, "send", (s) => {
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
|
-
},
|
|
422
|
+
}, bs = class {
|
|
423
423
|
constructor() {
|
|
424
424
|
a(this, "messageToHandleAfterInit", []), a(this, "components", {}), a(this, "alwaysPassEnvelopesToHost", !1), a(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
|
-
let
|
|
430
|
-
if (
|
|
429
|
+
let s = t;
|
|
430
|
+
if (s.direction !== k.down)
|
|
431
431
|
return;
|
|
432
|
-
if (
|
|
433
|
-
|
|
432
|
+
if (s.messageType === w.DisposeMessage) {
|
|
433
|
+
s.destination && delete this.components[s.destination];
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
|
-
if (
|
|
437
|
-
const
|
|
438
|
-
if (this.components[
|
|
436
|
+
if (s.messageType === w.InitMessage) {
|
|
437
|
+
const n = s.content.id;
|
|
438
|
+
if (this.components[n])
|
|
439
439
|
return;
|
|
440
|
-
this.components[
|
|
440
|
+
this.components[n] = new Ms(n), this.messageToHost(new yt(n));
|
|
441
441
|
return;
|
|
442
442
|
}
|
|
443
|
-
if (
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
443
|
+
if (s.messageType === w.EnvelopedMessage) {
|
|
444
|
+
const n = s, i = n.message;
|
|
445
|
+
if (s = i, this.alwaysPassEnvelopesToHost || this.components[s.destination]) {
|
|
446
446
|
const o = myop.hostSDK.components.find((c) => c.id === i.destination);
|
|
447
447
|
if (o) {
|
|
448
448
|
o.send(i);
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
const r = myop.hostSDK.components.find((c) => c.id ===
|
|
451
|
+
const r = myop.hostSDK.components.find((c) => c.id === n.destination);
|
|
452
452
|
if (r) {
|
|
453
453
|
r.send(i);
|
|
454
454
|
return;
|
|
@@ -456,27 +456,27 @@ var et = class extends P {
|
|
|
456
456
|
} else
|
|
457
457
|
return;
|
|
458
458
|
}
|
|
459
|
-
if (
|
|
460
|
-
if (
|
|
461
|
-
const
|
|
462
|
-
o.destination =
|
|
463
|
-
this.messageToHost(o,
|
|
459
|
+
if (s.messageType) {
|
|
460
|
+
if (s.messageType === w.CleanupMessage) {
|
|
461
|
+
const n = s, i = this.messageCleanupCache[n.cleanupForMessageId], o = new It(!!i);
|
|
462
|
+
o.destination = s.destination, i ? (delete this.messageCleanupCache[n.cleanupForMessageId], vs(i).then(() => {
|
|
463
|
+
this.messageToHost(o, n);
|
|
464
464
|
}).catch(() => {
|
|
465
|
-
})) : this.messageToHost(o,
|
|
465
|
+
})) : this.messageToHost(o, n);
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
|
-
this.supportedHandlers.forEach((
|
|
469
|
-
if (
|
|
470
|
-
const i =
|
|
471
|
-
if (
|
|
468
|
+
this.supportedHandlers.forEach((n) => {
|
|
469
|
+
if (n.messageType === s.messageType) {
|
|
470
|
+
const i = n.executor(s);
|
|
471
|
+
if (s.cleanable && i && (this.messageCleanupCache[s.id] = i), i && !s.cleanable)
|
|
472
472
|
throw new Error(`Cleanup handler generated for non-cleanable message.
|
|
473
|
-
messageType - ${
|
|
473
|
+
messageType - ${s.messageType}, handler executor was - ${n.executor}
|
|
474
474
|
|
|
475
475
|
Please review the message definition object & message handler.
|
|
476
476
|
To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);
|
|
477
|
-
if (!i &&
|
|
477
|
+
if (!i && s.cleanable)
|
|
478
478
|
throw new Error(`No cleanup handler generated for a cleanable message.
|
|
479
|
-
messageType - ${
|
|
479
|
+
messageType - ${s.messageType}, handler executor was - ${n.executor}
|
|
480
480
|
|
|
481
481
|
Please review the message definition object & message handler.
|
|
482
482
|
To ensure cleanup properly set 'cleanable' true at message definition and return IMessageExecutorCleanup from your handlers.`);
|
|
@@ -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
|
+
}, he = {
|
|
490
490
|
IframeLoader: "IframeLoader",
|
|
491
491
|
WebComponentLoader: "WebComponentLoader",
|
|
492
492
|
HTMLLoader: "HTMLLoader"
|
|
493
|
-
},
|
|
493
|
+
}, pe = {
|
|
494
494
|
open: "open",
|
|
495
495
|
none: "none",
|
|
496
496
|
localFrame: "localFrame"
|
|
497
|
-
},
|
|
497
|
+
}, Ee = {
|
|
498
498
|
code: "code"
|
|
499
|
-
},
|
|
499
|
+
}, Fe = class {
|
|
500
500
|
};
|
|
501
|
-
a(
|
|
502
|
-
a(
|
|
503
|
-
var
|
|
501
|
+
a(Fe, "code", "code");
|
|
502
|
+
a(Fe, "component", "component");
|
|
503
|
+
var de = {
|
|
504
504
|
Segmented: "Segmented",
|
|
505
505
|
Dedicated: "Dedicated",
|
|
506
506
|
/**
|
|
@@ -510,58 +510,58 @@ var re = {
|
|
|
510
510
|
* @type {string}
|
|
511
511
|
*/
|
|
512
512
|
Default: "Default"
|
|
513
|
-
},
|
|
513
|
+
}, xt = {
|
|
514
514
|
Segment: "Segment",
|
|
515
515
|
Promo: "Promo",
|
|
516
516
|
AB: "AB"
|
|
517
|
-
},
|
|
517
|
+
}, Es = class {
|
|
518
518
|
constructor(e, t) {
|
|
519
519
|
this.container = e, this.shadowRoot = t, a(this, "getRootDiv", () => (this.shadowRoot || this.container).querySelector("div")), a(this, "getRoot", () => this.shadowRoot || this.container);
|
|
520
520
|
}
|
|
521
|
-
},
|
|
522
|
-
if (
|
|
521
|
+
}, Oe = (e) => e !== Object(e), Cs = (e) => typeof e == "function", Ht = (e) => {
|
|
522
|
+
if (Oe(e))
|
|
523
523
|
return !0;
|
|
524
|
-
if (
|
|
524
|
+
if (Cs(e) || Object.getPrototypeOf(e))
|
|
525
525
|
return !1;
|
|
526
526
|
for (const t in e) {
|
|
527
|
-
const
|
|
528
|
-
if (typeof
|
|
529
|
-
if (!
|
|
527
|
+
const s = e[t];
|
|
528
|
+
if (typeof s == "object") {
|
|
529
|
+
if (!Ht(s))
|
|
530
530
|
return !1;
|
|
531
531
|
} else {
|
|
532
|
-
if (
|
|
532
|
+
if (Oe(s))
|
|
533
533
|
continue;
|
|
534
534
|
return !1;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
return !0;
|
|
538
|
-
},
|
|
539
|
-
if (
|
|
538
|
+
}, oe = (e, t = {}, s = !0, n = /* @__PURE__ */ new WeakMap()) => {
|
|
539
|
+
if (Oe(e))
|
|
540
540
|
return e;
|
|
541
541
|
if (Array.isArray(e)) {
|
|
542
|
-
if (
|
|
543
|
-
return
|
|
542
|
+
if (n.has(e))
|
|
543
|
+
return n.get(e);
|
|
544
544
|
const i = [];
|
|
545
|
-
|
|
545
|
+
n.set(e, i);
|
|
546
546
|
for (let o = 0; o < e.length; o++) {
|
|
547
547
|
const r = e[o];
|
|
548
|
-
i[o] =
|
|
548
|
+
i[o] = oe(r, t, s, n);
|
|
549
549
|
}
|
|
550
550
|
return i;
|
|
551
551
|
}
|
|
552
552
|
if (e !== null && typeof e == "object") {
|
|
553
|
-
if (
|
|
554
|
-
return
|
|
553
|
+
if (n.has(e))
|
|
554
|
+
return n.get(e);
|
|
555
555
|
const i = {};
|
|
556
|
-
|
|
556
|
+
n.set(e, i);
|
|
557
557
|
for (const o in e) {
|
|
558
558
|
const r = typeof t == "boolean" ? t : t[o];
|
|
559
|
-
r && (r === !0 ? (
|
|
559
|
+
r && (r === !0 ? (s ? e[o] !== void 0 : e[o]) && (i[o] = oe(e[o], !0, s, n)) : typeof r == "object" && (i[o] = oe(e[o], r, s, n)));
|
|
560
560
|
}
|
|
561
561
|
return i;
|
|
562
562
|
}
|
|
563
563
|
return {};
|
|
564
|
-
},
|
|
564
|
+
}, Ss = {
|
|
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,42 +595,98 @@ For more details on serialization and Myop message examples, refer to https://do
|
|
|
595
595
|
|
|
596
596
|
`);
|
|
597
597
|
}
|
|
598
|
-
},
|
|
599
|
-
constructor(e, t,
|
|
600
|
-
super(e, t.container,
|
|
601
|
-
const i =
|
|
602
|
-
return this.parent.send(new
|
|
598
|
+
}, Ye = class extends Ie {
|
|
599
|
+
constructor(e, t, s) {
|
|
600
|
+
super(e, t.container, s), this.componentDefinition = e, this.parent = t, a(this, "send", (n) => {
|
|
601
|
+
const i = n.handler, o = super.send(n);
|
|
602
|
+
return this.parent.send(new _t(this.id, n)), n.handler = i, o;
|
|
603
603
|
}), a(this, "dispose", () => {
|
|
604
|
-
this.isInitiated && this.send(new
|
|
604
|
+
this.isInitiated && this.send(new U("dispose")), super.dispose();
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
607
|
hide() {
|
|
608
|
-
this.send(new
|
|
608
|
+
this.send(new U("hide"));
|
|
609
609
|
}
|
|
610
610
|
show() {
|
|
611
|
-
this.send(new
|
|
611
|
+
this.send(new U("show"));
|
|
612
612
|
}
|
|
613
613
|
inspect() {
|
|
614
|
-
return this.send(new
|
|
614
|
+
return this.send(new U("inspect"));
|
|
615
615
|
}
|
|
616
616
|
setHeightBasedOnDocumentElement() {
|
|
617
|
-
this.send(new
|
|
617
|
+
this.send(new U("setHeightBasedOnDocumentElement"));
|
|
618
618
|
}
|
|
619
619
|
setHeightBasedOnScrollHeight() {
|
|
620
|
-
this.send(new
|
|
620
|
+
this.send(new U("setHeightBasedOnScrollHeight"));
|
|
621
621
|
}
|
|
622
622
|
onMessageReceived(e) {
|
|
623
623
|
return super.onMessageReceived(e);
|
|
624
624
|
}
|
|
625
|
-
},
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
},
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
625
|
+
}, Pe = class extends Ie {
|
|
626
|
+
constructor(e, t, s, n, i, o) {
|
|
627
|
+
super(e, s, o), this.container = s, this.customElement = n, this.tagName = i, a(this, "ctaCleanup"), a(this, "_ctaHandler"), a(this, "_ctaQueue", []), a(this, "cleanupInspect", () => {
|
|
628
|
+
}), a(this, "send", (r) => {
|
|
629
|
+
const c = super.send(r);
|
|
630
|
+
return console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", r), c;
|
|
631
|
+
}), a(this, "dispose", () => {
|
|
632
|
+
var r;
|
|
633
|
+
this.ctaCleanup && this.ctaCleanup(), super.dispose(), (r = this.customElement.parentNode) == null || r.removeChild(this.customElement);
|
|
634
|
+
}), this.element = n, this.setInitiated();
|
|
635
|
+
}
|
|
636
|
+
inspect() {
|
|
637
|
+
return this.cleanupInspect = Be(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
|
|
638
|
+
}
|
|
639
|
+
hide() {
|
|
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";
|
|
641
|
+
}
|
|
642
|
+
show() {
|
|
643
|
+
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 = "";
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Initialize the component with data by calling myop_init_interface directly
|
|
647
|
+
*/
|
|
648
|
+
initWithData(e) {
|
|
649
|
+
typeof this.customElement.myop_init_interface == "function" && this.customElement.myop_init_interface(e);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Get current data from the component
|
|
653
|
+
*/
|
|
654
|
+
getData() {
|
|
655
|
+
if (typeof this.customElement.myop_init_interface == "function")
|
|
656
|
+
return this.customElement.myop_init_interface();
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Set CTA handler - unified API with iframe components.
|
|
660
|
+
* Called via props.myop_cta_handler = handler
|
|
661
|
+
*/
|
|
662
|
+
setCtaHandler(e) {
|
|
663
|
+
if (this.ctaCleanup && this.ctaCleanup(), this._ctaHandler = e, this._ctaQueue.length > 0) {
|
|
664
|
+
const s = [...this._ctaQueue];
|
|
665
|
+
this._ctaQueue = [], s.forEach((n) => {
|
|
666
|
+
this.markedForDisposed || e(n.action, n.payload);
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
const t = (s) => {
|
|
670
|
+
var n;
|
|
671
|
+
const i = s;
|
|
672
|
+
(n = i.detail) != null && n.action && (this._ctaHandler && !this.markedForDisposed ? this._ctaHandler(i.detail.action, i.detail.payload) : this._ctaHandler || this._ctaQueue.push({
|
|
673
|
+
action: i.detail.action,
|
|
674
|
+
payload: i.detail.payload
|
|
675
|
+
}));
|
|
676
|
+
};
|
|
677
|
+
this.customElement.addEventListener("myop-cta", t), this.ctaCleanup = () => {
|
|
678
|
+
this.customElement.removeEventListener("myop-cta", t);
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
}, Is = (e, t, s) => {
|
|
682
|
+
const n = document.createElement("a");
|
|
683
|
+
return n.textContent = e, n.style.position = "relative", n.style.padding = "0 5px", n.style.fontSize = "14px", n.style.top = "0", n.style.top = `${t}px`, n.style.transform = "translateX(-50%)", n.target = "_blank", n.href = `https://dashboard.myop.dev/dashboard/component/${s.id}`, n;
|
|
684
|
+
}, Be = (e, t, s, n, i, o) => {
|
|
685
|
+
const r = Is(`${o.name} : ${t}`, s, o);
|
|
686
|
+
return n.insertBefore(r, i), i.style.border = "1px solid #007BFF", i.style.display = "block", () => {
|
|
687
|
+
i.style.border = "unset", n.removeChild(r);
|
|
632
688
|
};
|
|
633
|
-
},
|
|
689
|
+
}, Je = (e, t, s) => e ? !1 : (console.error(
|
|
634
690
|
// throw new Error(
|
|
635
691
|
`Error: Undefined Prop
|
|
636
692
|
|
|
@@ -638,10 +694,10 @@ It looks like you've tried to use a prop that hasn't been defined.
|
|
|
638
694
|
Please check the prop name for any typos or ensure that it is properly defined in the component's prop list.
|
|
639
695
|
|
|
640
696
|
Prop Name: ${t}
|
|
641
|
-
Component: ${
|
|
697
|
+
Component: ${s.componentDefinition.name}, ID: ${s.componentDefinition.id}
|
|
642
698
|
|
|
643
|
-
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${
|
|
644
|
-
), !0),
|
|
699
|
+
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`
|
|
700
|
+
), !0), Qe = (e, t, s) => {
|
|
645
701
|
console.error(
|
|
646
702
|
`Error: Code Prop Not Supported
|
|
647
703
|
|
|
@@ -651,55 +707,68 @@ Currently, code props are only supported in local frame components.
|
|
|
651
707
|
In the meantime, you can use message props.
|
|
652
708
|
|
|
653
709
|
Prop Name: ${t}
|
|
654
|
-
Component: ${
|
|
710
|
+
Component: ${s.componentDefinition.name}, ID: ${s.componentDefinition.id}
|
|
655
711
|
|
|
656
|
-
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${
|
|
712
|
+
For more information, refer to the component page https://dashboard.myop.dev/dashboard/component/${s.componentDefinition.id} or consult the developer guide.`
|
|
657
713
|
);
|
|
658
|
-
},
|
|
659
|
-
const
|
|
660
|
-
[r.name]:
|
|
714
|
+
}, Ts = (e, t, s) => {
|
|
715
|
+
const n = t.reduce((o, r) => fe(b({}, o), {
|
|
716
|
+
[r.name]: b({}, r)
|
|
661
717
|
}), {}), i = {
|
|
662
718
|
get: (o, r) => {
|
|
663
|
-
const c =
|
|
664
|
-
if (
|
|
719
|
+
const c = n[r];
|
|
720
|
+
if (Je(c, r, e))
|
|
665
721
|
return !1;
|
|
666
|
-
if (c.behavior.type ===
|
|
667
|
-
if (
|
|
722
|
+
if (c.behavior.type === Ee.code) {
|
|
723
|
+
if (e instanceof Pe)
|
|
724
|
+
return (c.behavior.remap || r) === "myop_init_interface" ? (u) => {
|
|
725
|
+
if (u === void 0)
|
|
726
|
+
return e.getData();
|
|
727
|
+
e.initWithData(u);
|
|
728
|
+
} : void 0;
|
|
729
|
+
if (s.loader.type === he.HTMLLoader && s.loader.shadowRootMode === pe.localFrame) {
|
|
668
730
|
const d = c.behavior;
|
|
669
731
|
return e.element.contentWindow[d.remap || r];
|
|
670
732
|
}
|
|
671
|
-
return
|
|
733
|
+
return Qe(c, r, e), !1;
|
|
672
734
|
}
|
|
673
735
|
return c.mode === "output" ? new Promise((l) => {
|
|
674
736
|
const d = [];
|
|
675
|
-
c.behavior.ref && d.push(
|
|
737
|
+
c.behavior.ref && d.push(ue.create(c.behavior.ref)), d.push((h) => {
|
|
676
738
|
l(h);
|
|
677
739
|
}), c.behavior.params && d.push(...c.behavior.params);
|
|
678
|
-
const u =
|
|
740
|
+
const u = De[c.behavior.message];
|
|
679
741
|
e.send(new u(...d));
|
|
680
742
|
}) : null;
|
|
681
743
|
},
|
|
682
744
|
set: (o, r, c) => {
|
|
683
|
-
const l =
|
|
684
|
-
if (
|
|
745
|
+
const l = n[r];
|
|
746
|
+
if (Je(l, r, e))
|
|
685
747
|
return !1;
|
|
686
|
-
if (l.behavior.type ===
|
|
687
|
-
if (
|
|
688
|
-
const u = l.behavior
|
|
689
|
-
if (
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
748
|
+
if (l.behavior.type === Ee.code) {
|
|
749
|
+
if (e instanceof Pe) {
|
|
750
|
+
const u = l.behavior.remap || r;
|
|
751
|
+
if (u === "myop_cta_handler")
|
|
752
|
+
return e.setCtaHandler(c), !0;
|
|
753
|
+
if (u === "myop_init_interface")
|
|
754
|
+
return e.initWithData(c), !0;
|
|
755
|
+
}
|
|
756
|
+
if (s.loader.type === he.HTMLLoader && s.loader.shadowRootMode === pe.localFrame) {
|
|
757
|
+
const u = l.behavior, h = e.element.contentWindow, m = u.remap || r;
|
|
758
|
+
if (h[m] = c, m === "myop_cta_handler" && h.__myop_cta_queue) {
|
|
759
|
+
const f = h.__myop_cta_queue;
|
|
760
|
+
h.__myop_cta_queue = null, f.forEach((y) => {
|
|
761
|
+
e.markedForDisposed || c(y.action, y.payload);
|
|
693
762
|
});
|
|
694
763
|
}
|
|
695
764
|
return !0;
|
|
696
765
|
}
|
|
697
|
-
return
|
|
766
|
+
return Qe(l, r, e), !1;
|
|
698
767
|
} else if (l.mode === "input")
|
|
699
768
|
if (l.behavior.type === "message") {
|
|
700
769
|
const d = [];
|
|
701
|
-
l.behavior.ref && d.push(
|
|
702
|
-
const u =
|
|
770
|
+
l.behavior.ref && d.push(ue.create(l.behavior.ref)), d.push(c), l.behavior.params && d.push(...l.behavior.params);
|
|
771
|
+
const u = De[l.behavior.message];
|
|
703
772
|
return e.send(new u(...d)), !0;
|
|
704
773
|
} else
|
|
705
774
|
throw new Error(
|
|
@@ -717,12 +786,12 @@ Check the documentation for valid behavior options.`
|
|
|
717
786
|
}
|
|
718
787
|
};
|
|
719
788
|
return e.props = {}, e.props = new Proxy(e.props, i), e;
|
|
720
|
-
},
|
|
721
|
-
get(
|
|
722
|
-
return n
|
|
789
|
+
}, xs = (e, t) => new Proxy(e, {
|
|
790
|
+
get(s, n) {
|
|
791
|
+
return s[n] ? s[n] : (...o) => new Promise((r) => {
|
|
723
792
|
o.forEach((c) => {
|
|
724
|
-
|
|
725
|
-
}), t.send(new
|
|
793
|
+
Ht(c) || Ss.notSerializableRefCall(n, c);
|
|
794
|
+
}), t.send(new ke(
|
|
726
795
|
({ ref: c, propName: l, functionArgs: d, makeSerializable: u }) => {
|
|
727
796
|
if (c) {
|
|
728
797
|
const h = c[l];
|
|
@@ -732,8 +801,8 @@ Check the documentation for valid behavior options.`
|
|
|
732
801
|
},
|
|
733
802
|
{
|
|
734
803
|
//TODO : turn it to config
|
|
735
|
-
elementId:
|
|
736
|
-
propName:
|
|
804
|
+
elementId: s.refConfig.selector,
|
|
805
|
+
propName: n,
|
|
737
806
|
functionArgs: o
|
|
738
807
|
},
|
|
739
808
|
(c) => {
|
|
@@ -742,86 +811,86 @@ Check the documentation for valid behavior options.`
|
|
|
742
811
|
));
|
|
743
812
|
});
|
|
744
813
|
},
|
|
745
|
-
set(
|
|
746
|
-
return t.send(new
|
|
814
|
+
set(s, n, i) {
|
|
815
|
+
return t.send(new ke(
|
|
747
816
|
({ ref: o, propName: r, propValue: c }) => {
|
|
748
817
|
o && (o[r] = c);
|
|
749
818
|
},
|
|
750
819
|
{
|
|
751
820
|
//TODO : fix that
|
|
752
|
-
elementId:
|
|
821
|
+
elementId: s.refConfig.selector,
|
|
753
822
|
propValue: i,
|
|
754
|
-
propName:
|
|
823
|
+
propName: n
|
|
755
824
|
},
|
|
756
825
|
(o) => {
|
|
757
826
|
}
|
|
758
827
|
)), !0;
|
|
759
828
|
}
|
|
760
|
-
}),
|
|
829
|
+
}), Rt = (e, t, s, n) => v(void 0, null, function* () {
|
|
761
830
|
const i = e.component;
|
|
762
831
|
if (!i)
|
|
763
832
|
throw new Error("cant createRefComponent with detached ref");
|
|
764
|
-
return new Promise((o, r) =>
|
|
765
|
-
const c = new
|
|
766
|
-
|
|
833
|
+
return new Promise((o, r) => v(void 0, null, function* () {
|
|
834
|
+
const c = new Ye(t.type, i, n);
|
|
835
|
+
s.push(c), yield i.initiated();
|
|
767
836
|
const l = setTimeout(() => {
|
|
768
837
|
r("timeout");
|
|
769
838
|
}, 5e3);
|
|
770
|
-
i.send(new
|
|
839
|
+
i.send(new wt(
|
|
771
840
|
e.refConfig,
|
|
772
841
|
t,
|
|
773
|
-
|
|
842
|
+
fe(b({}, n || {}), {
|
|
774
843
|
id: c.id,
|
|
775
844
|
_hasParent: !0
|
|
776
845
|
}),
|
|
777
|
-
(d) =>
|
|
846
|
+
(d) => v(void 0, null, function* () {
|
|
778
847
|
if (clearTimeout(l), d.failed) {
|
|
779
848
|
r("CreateRefComponentMessage failed");
|
|
780
849
|
return;
|
|
781
850
|
}
|
|
782
|
-
const u =
|
|
851
|
+
const u = s.find((h) => h.id == c.id);
|
|
783
852
|
if (u !== c) {
|
|
784
853
|
i.refs[e.refConfig.name] = u, o(u);
|
|
785
854
|
return;
|
|
786
855
|
} else
|
|
787
856
|
c.setInitiated(), i.refs[e.refConfig.name] = c;
|
|
788
857
|
d.nestedRefs.forEach((h) => {
|
|
789
|
-
const
|
|
790
|
-
|
|
858
|
+
const m = t.instance.resolvedNestedComponents.find((y) => y.type.id === h.componentDefinitionId).type, f = new Ye(m, c);
|
|
859
|
+
f.setInitiated(), c.refs[h.refName] = f, s.push(f);
|
|
791
860
|
});
|
|
792
861
|
try {
|
|
793
|
-
yield
|
|
862
|
+
yield Dt(c, t, s, !0), i.setHeightBasedOnScrollHeight && i.setHeightBasedOnScrollHeight(), o(c);
|
|
794
863
|
} catch (h) {
|
|
795
864
|
r(h);
|
|
796
865
|
}
|
|
797
866
|
})
|
|
798
867
|
));
|
|
799
868
|
}));
|
|
800
|
-
}),
|
|
869
|
+
}), Dt = (e, t, s, n = !1) => v(void 0, null, function* () {
|
|
801
870
|
e.refs || (e.refs = {});
|
|
802
|
-
const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, c) =>
|
|
871
|
+
const i = Object.values(e.componentDefinition.refs).map((o) => new Promise((r, c) => v(void 0, null, function* () {
|
|
803
872
|
var l;
|
|
804
|
-
if (o.behavior.type ==
|
|
805
|
-
if (
|
|
873
|
+
if (o.behavior.type == Fe.component) {
|
|
874
|
+
if (n) {
|
|
806
875
|
r();
|
|
807
876
|
return;
|
|
808
877
|
}
|
|
809
878
|
let d = o.behavior.componentId;
|
|
810
879
|
d || (d = o.behavior.instance.componentId);
|
|
811
|
-
const u = (l = t.instance.resolvedNestedComponents) == null ? void 0 : l.find((
|
|
880
|
+
const u = (l = t.instance.resolvedNestedComponents) == null ? void 0 : l.find((m) => m.type.id === d);
|
|
812
881
|
if (!u)
|
|
813
882
|
throw new Error("componentConfig provided without nestedComponentConfig check the config object");
|
|
814
|
-
const h =
|
|
883
|
+
const h = ue.create("", o, e);
|
|
815
884
|
try {
|
|
816
|
-
const
|
|
817
|
-
e.refs[o.name] =
|
|
818
|
-
} catch (
|
|
819
|
-
c(
|
|
885
|
+
const m = yield Rt(h, u, s);
|
|
886
|
+
e.refs[o.name] = m, r();
|
|
887
|
+
} catch (m) {
|
|
888
|
+
c(m);
|
|
820
889
|
}
|
|
821
890
|
} else
|
|
822
891
|
try {
|
|
823
|
-
const d =
|
|
824
|
-
e.refs[o.name] =
|
|
892
|
+
const d = ue.create("", o, e);
|
|
893
|
+
e.refs[o.name] = xs(d, e), r();
|
|
825
894
|
} catch {
|
|
826
895
|
}
|
|
827
896
|
})));
|
|
@@ -830,13 +899,13 @@ Check the documentation for valid behavior options.`
|
|
|
830
899
|
} catch (o) {
|
|
831
900
|
throw o;
|
|
832
901
|
}
|
|
833
|
-
}),
|
|
834
|
-
constructor(e, t,
|
|
835
|
-
super(e,
|
|
836
|
-
const o = this.send(new
|
|
902
|
+
}), kt = class extends Ie {
|
|
903
|
+
constructor(e, t, s, n, i) {
|
|
904
|
+
super(e, s, i), this.componentConfig = e, this.container = s, this.IframeElement = n, a(this, "sizeMeta"), a(this, "cleanupInspect"), a(this, "setHeightBasedOnDocumentElement", () => {
|
|
905
|
+
const o = this.send(new j(() => window.document.documentElement.scrollHeight, (r) => {
|
|
837
906
|
this.IframeElement.style.height = `${r.content}px`, o();
|
|
838
907
|
}));
|
|
839
|
-
}), a(this, "observeSizeBasedOnDocumentElement", () => this.send(new
|
|
908
|
+
}), a(this, "observeSizeBasedOnDocumentElement", () => this.send(new j(({ send: r }) => {
|
|
840
909
|
const { height: c, width: l } = document.documentElement.getBoundingClientRect(), d = new ResizeObserver(() => {
|
|
841
910
|
const { height: u, width: h } = document.documentElement.getBoundingClientRect();
|
|
842
911
|
r({ height: u, width: h });
|
|
@@ -845,49 +914,59 @@ Check the documentation for valid behavior options.`
|
|
|
845
914
|
}, (r) => {
|
|
846
915
|
this.IframeElement.style.width = `${r.content.width}px`, this.IframeElement.style.height = `${r.content.height}px`;
|
|
847
916
|
}))), a(this, "observeAutoSize", (o) => {
|
|
848
|
-
var r;
|
|
849
|
-
const
|
|
850
|
-
if (!
|
|
917
|
+
var r, c, l, d, u, h, m;
|
|
918
|
+
const f = this.IframeElement, y = f.contentDocument;
|
|
919
|
+
if (!y)
|
|
851
920
|
return console.warn("[MyopIframeComponent] Cannot observe auto size: contentDocument not accessible"), () => {
|
|
852
921
|
};
|
|
853
|
-
const
|
|
854
|
-
if (
|
|
855
|
-
if (typeof
|
|
856
|
-
const
|
|
857
|
-
return isNaN(
|
|
858
|
-
},
|
|
859
|
-
if (!
|
|
860
|
-
|
|
922
|
+
const x = (g, _, H) => _ !== void 0 && g < _ ? _ : H !== void 0 && g > H ? H : g, I = (g) => {
|
|
923
|
+
if (g === void 0) return;
|
|
924
|
+
if (typeof g == "number") return g;
|
|
925
|
+
const _ = parseFloat(g);
|
|
926
|
+
return isNaN(_) ? void 0 : _;
|
|
927
|
+
}, E = I(o == null ? void 0 : o.minWidth), C = I(o == null ? void 0 : o.maxWidth), L = I(o == null ? void 0 : o.minHeight), D = I(o == null ? void 0 : o.maxHeight), X = (r = o == null ? void 0 : o.loaderMinHeight) != null ? r : 50, ye = ((c = this.sizeMeta) == null ? void 0 : c.width) === "100%" ? "100%" : void 0, ge = ((l = this.sizeMeta) == null ? void 0 : l.height) === "100%" ? "100%" : void 0, ae = (u = (d = o == null ? void 0 : o.explicitWidth) != null ? d : ye) != null ? u : "100%", Y = (h = o == null ? void 0 : o.explicitHeight) != null ? h : ge, Z = ae !== void 0, ce = Y !== void 0, ee = this.container.getBoundingClientRect(), ve = ee.width === 0, we = ee.height === 0 || ee.height === X, N = (o != null && o.forceAutoSize || ve) && !Z, $ = (o != null && o.forceAutoSize || we) && !ce;
|
|
928
|
+
if (!N && !$) {
|
|
929
|
+
const g = typeof ae == "number" ? ae : void 0, _ = typeof Y == "number" ? Y : void 0;
|
|
930
|
+
return (g !== void 0 || _ !== void 0) && ((m = o == null ? void 0 : o.onSizeChange) == null || m.call(o, {
|
|
931
|
+
width: g,
|
|
932
|
+
height: _,
|
|
933
|
+
autoSizingWidth: !1,
|
|
934
|
+
autoSizingHeight: !1
|
|
935
|
+
})), () => {
|
|
861
936
|
};
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
937
|
+
}
|
|
938
|
+
const te = () => {
|
|
939
|
+
var g;
|
|
940
|
+
const _ = f.contentDocument;
|
|
941
|
+
if (_) {
|
|
942
|
+
$ && (f.style.height = "0px"), N && (f.style.width = "0px");
|
|
943
|
+
const H = Math.ceil(_.documentElement.scrollWidth), W = Math.ceil(_.documentElement.scrollHeight), K = x(H, E, C), T = x(W, L, D);
|
|
944
|
+
N && (f.style.width = `${K}px`), $ && (f.style.height = `${T}px`);
|
|
945
|
+
const J = N && C !== void 0 && H > C, O = $ && D !== void 0 && W > D;
|
|
946
|
+
_.documentElement.style.overflowX = J ? "auto" : "", _.documentElement.style.overflowY = O ? "auto" : "", (g = o == null ? void 0 : o.onSizeChange) == null || g.call(o, {
|
|
947
|
+
width: K,
|
|
948
|
+
height: T,
|
|
949
|
+
autoSizingWidth: N,
|
|
950
|
+
autoSizingHeight: $
|
|
874
951
|
});
|
|
875
952
|
}
|
|
876
953
|
};
|
|
877
|
-
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
|
|
954
|
+
te();
|
|
955
|
+
const M = new ResizeObserver(te);
|
|
956
|
+
M.observe(y.body), M.observe(y.documentElement);
|
|
957
|
+
const z = new MutationObserver(te);
|
|
958
|
+
return z.observe(y.body, { childList: !0, subtree: !0, characterData: !0, attributes: !0 }), () => {
|
|
959
|
+
M.disconnect(), z.disconnect();
|
|
881
960
|
};
|
|
882
961
|
}), a(this, "setSizeBasedOnDocumentElement", () => {
|
|
883
|
-
const o = this.send(new
|
|
962
|
+
const o = this.send(new j(() => {
|
|
884
963
|
const { height: r, width: c } = document.documentElement.getBoundingClientRect();
|
|
885
964
|
return { height: r, width: c };
|
|
886
965
|
}, (r) => {
|
|
887
966
|
this.IframeElement.style.width = `${r.content.width}px`, this.IframeElement.style.height = `${r.content.height}px`, o();
|
|
888
967
|
}));
|
|
889
968
|
}), a(this, "setHeightBasedOnScrollHeight", () => {
|
|
890
|
-
const o = this.send(new
|
|
969
|
+
const o = this.send(new j(() => {
|
|
891
970
|
let c = 0;
|
|
892
971
|
return c++, c--, Math.max(
|
|
893
972
|
Math.max(
|
|
@@ -901,8 +980,8 @@ Check the documentation for valid behavior options.`
|
|
|
901
980
|
}));
|
|
902
981
|
}), a(this, "send", (o) => {
|
|
903
982
|
var r, c;
|
|
904
|
-
let l =
|
|
905
|
-
if (l.messageType ===
|
|
983
|
+
let l = b({}, o);
|
|
984
|
+
if (l.messageType === w.ExecuteComponentMethod)
|
|
906
985
|
return this[l.method](), () => {
|
|
907
986
|
};
|
|
908
987
|
l.direction = k.down;
|
|
@@ -915,7 +994,7 @@ Check the documentation for valid behavior options.`
|
|
|
915
994
|
}), this.element = this.IframeElement;
|
|
916
995
|
}
|
|
917
996
|
inspect() {
|
|
918
|
-
return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect =
|
|
997
|
+
return this.cleanupInspect ? this.cleanupInspect : (this.cleanupInspect = Be(this.id, "MyopIframeComponent", 10, this.container, this.IframeElement, this.componentDefinition), () => {
|
|
919
998
|
this.cleanupInspect(), this.cleanupInspect = void 0;
|
|
920
999
|
});
|
|
921
1000
|
}
|
|
@@ -926,35 +1005,35 @@ Check the documentation for valid behavior options.`
|
|
|
926
1005
|
this.IframeElement.style.opacity = "1", this.IframeElement.style.position = "unset", this.IframeElement.style.pointerEvents = "all", this.IframeElement.style.visibility = "visible";
|
|
927
1006
|
}
|
|
928
1007
|
onMessageReceived(e) {
|
|
929
|
-
return e.messageType ===
|
|
1008
|
+
return e.messageType === w.In.MutationObserverMessage || e.messageType === w.In.ResizeObserverMessage ? (this.setHeightBasedOnScrollHeight(), !0) : super.onMessageReceived(e);
|
|
930
1009
|
}
|
|
931
|
-
},
|
|
1010
|
+
}, Ne = class {
|
|
932
1011
|
constructor() {
|
|
933
|
-
a(this, "appendChild", (e, t,
|
|
934
|
-
var
|
|
935
|
-
if (
|
|
936
|
-
if (
|
|
937
|
-
return e.insertBefore(t,
|
|
938
|
-
if (
|
|
939
|
-
const i = (
|
|
1012
|
+
a(this, "appendChild", (e, t, s) => {
|
|
1013
|
+
var n;
|
|
1014
|
+
if (s != null && s.relative) {
|
|
1015
|
+
if (s.relative.direction === "before")
|
|
1016
|
+
return e.insertBefore(t, s.relative.child);
|
|
1017
|
+
if (s.relative.direction === "after") {
|
|
1018
|
+
const i = (n = s.relative.child) == null ? void 0 : n.nextSibling;
|
|
940
1019
|
return e.insertBefore(t, i || null);
|
|
941
1020
|
}
|
|
942
1021
|
} else
|
|
943
1022
|
return e.appendChild(t);
|
|
944
1023
|
});
|
|
945
1024
|
}
|
|
946
|
-
},
|
|
947
|
-
const
|
|
948
|
-
return
|
|
949
|
-
},
|
|
1025
|
+
}, Hs = (e, t, s) => {
|
|
1026
|
+
const n = new URL(e);
|
|
1027
|
+
return n.searchParams.append(t, s), n.toString();
|
|
1028
|
+
}, Rs = class extends Ne {
|
|
950
1029
|
constructor() {
|
|
951
|
-
super(...arguments), a(this, "type",
|
|
1030
|
+
super(...arguments), a(this, "type", he.IframeLoader), a(this, "load", (e, t, s, n) => v(this, null, function* () {
|
|
952
1031
|
let i;
|
|
953
1032
|
const o = t.loader;
|
|
954
|
-
if ((
|
|
955
|
-
console.log("needs to load into an exsisting Iframe...", o.url,
|
|
1033
|
+
if ((s == null ? void 0 : s.nodeName) === "IFRAME")
|
|
1034
|
+
console.log("needs to load into an exsisting Iframe...", o.url, s), i = s, i.src = o.url;
|
|
956
1035
|
else {
|
|
957
|
-
const r =
|
|
1036
|
+
const r = Q(), c = `myop-comp-${r}`;
|
|
958
1037
|
i = document.createElement("iframe"), i.id = c;
|
|
959
1038
|
const l = `
|
|
960
1039
|
padding: 0;
|
|
@@ -965,26 +1044,26 @@ Check the documentation for valid behavior options.`
|
|
|
965
1044
|
width: 100%;
|
|
966
1045
|
overflow: hidden;
|
|
967
1046
|
border: none;
|
|
968
|
-
opacity: ${
|
|
969
|
-
pointer-events: ${
|
|
1047
|
+
opacity: ${n != null && n.hidden ? "0" : "1"};
|
|
1048
|
+
pointer-events: ${n != null && n.hidden ? "none" : "all"};
|
|
970
1049
|
`;
|
|
971
|
-
i.style.cssText = l,
|
|
1050
|
+
i.style.cssText = l, n != null && n.elementAttributes && Object.entries(n.elementAttributes).forEach(([u, h]) => {
|
|
972
1051
|
h === "" || h === null || h === void 0 ? i.setAttribute(u, "") : i.setAttribute(u, String(h));
|
|
973
1052
|
});
|
|
974
1053
|
let d = t.loader.url;
|
|
975
|
-
|
|
1054
|
+
n != null && n._hasParent && (d = Hs(d, "_myop-comp", r)), i.src = d, s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), i = this.appendChild(s, i, n);
|
|
976
1055
|
}
|
|
977
|
-
return new
|
|
1056
|
+
return new kt(e, t, s, i, n);
|
|
978
1057
|
}));
|
|
979
1058
|
}
|
|
980
|
-
},
|
|
1059
|
+
}, Lt = {
|
|
981
1060
|
webcomponent_message_key: "myop_webcomponent_message"
|
|
982
|
-
},
|
|
983
|
-
constructor(e, t,
|
|
984
|
-
super(e,
|
|
1061
|
+
}, Ot = class extends Ie {
|
|
1062
|
+
constructor(e, t, s, n, i) {
|
|
1063
|
+
super(e, s, i), this.container = s, this.customElement = n, a(this, "cleanupInspect", () => {
|
|
985
1064
|
}), a(this, "send", (o) => {
|
|
986
|
-
let r =
|
|
987
|
-
const c = super.send(r), l = new CustomEvent(
|
|
1065
|
+
let r = b({}, o);
|
|
1066
|
+
const c = super.send(r), l = new CustomEvent(Lt.webcomponent_message_key, {
|
|
988
1067
|
// @ts-ignore
|
|
989
1068
|
detail: r
|
|
990
1069
|
// bubbles: true,
|
|
@@ -1000,10 +1079,10 @@ Check the documentation for valid behavior options.`
|
|
|
1000
1079
|
}), a(this, "dispose", () => {
|
|
1001
1080
|
var o;
|
|
1002
1081
|
super.dispose(), (o = this.customElement.parentNode) == null || o.removeChild(this.customElement);
|
|
1003
|
-
}), this.element =
|
|
1082
|
+
}), this.element = n;
|
|
1004
1083
|
}
|
|
1005
1084
|
inspect() {
|
|
1006
|
-
return this.cleanupInspect =
|
|
1085
|
+
return this.cleanupInspect = Be(this.id, "MyopWebComponent", 0, this.container, this.customElement, this.componentDefinition), this.cleanupInspect;
|
|
1007
1086
|
}
|
|
1008
1087
|
hide() {
|
|
1009
1088
|
this.customElement.style.opacity = "0", this.customElement.style.position = "absolute", this.customElement.style.pointerEvents = "none", this.customElement.style.visibility = "hidden", this.customElement.style.height = "0", this.customElement.style.width = "0";
|
|
@@ -1011,51 +1090,51 @@ Check the documentation for valid behavior options.`
|
|
|
1011
1090
|
show() {
|
|
1012
1091
|
this.customElement.style.opacity = "1", this.customElement.style.position = "unset", this.customElement.style.pointerEvents = "all", this.customElement.style.visibility = "visible", this.customElement.style.height = "", this.customElement.style.width = "";
|
|
1013
1092
|
}
|
|
1014
|
-
},
|
|
1093
|
+
}, He = {}, Ds = class extends Ne {
|
|
1015
1094
|
constructor() {
|
|
1016
|
-
super(...arguments), a(this, "type",
|
|
1095
|
+
super(...arguments), a(this, "type", he.WebComponentLoader), a(this, "load", (e, t, s, n) => v(this, null, function* () {
|
|
1017
1096
|
const i = t.loader;
|
|
1018
|
-
|
|
1097
|
+
He[i.url] ? console.log("Module alreday loaded or in loading process") : He[i.url] = new Promise((c, l) => {
|
|
1019
1098
|
const d = i.url, u = document.createElement("script");
|
|
1020
1099
|
u.type = "module", u.src = d, u.onload = () => {
|
|
1021
1100
|
c();
|
|
1022
1101
|
}, u.onerror = () => {
|
|
1023
1102
|
l();
|
|
1024
1103
|
}, document.head.appendChild(u);
|
|
1025
|
-
}), yield
|
|
1026
|
-
let o = `myop-comp-${
|
|
1104
|
+
}), yield He[i.url], yield es(1);
|
|
1105
|
+
let o = `myop-comp-${Q()}`;
|
|
1027
1106
|
const r = document.createElement(i.tag);
|
|
1028
|
-
return
|
|
1107
|
+
return s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), r.id = o, n != null && n.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), n != null && n._environment && (r._myopEnvironment = n == null ? void 0 : n._environment), this.appendChild(s, r, n), new Ot(e, t, s, r, n);
|
|
1029
1108
|
}));
|
|
1030
1109
|
}
|
|
1031
|
-
},
|
|
1110
|
+
}, ks = "0.3.18", B = class extends _s {
|
|
1032
1111
|
constructor(e, t) {
|
|
1033
|
-
super(e), this.context = t, a(this, "executor", (
|
|
1034
|
-
if (
|
|
1035
|
-
const
|
|
1036
|
-
if (this.context[
|
|
1112
|
+
super(e), this.context = t, a(this, "executor", (s) => {
|
|
1113
|
+
if (s.destination) {
|
|
1114
|
+
const n = s.destination;
|
|
1115
|
+
if (this.context[n].context) {
|
|
1037
1116
|
const i = (o, r) => {
|
|
1038
|
-
this.messageToHost(
|
|
1039
|
-
source:
|
|
1040
|
-
destination:
|
|
1117
|
+
this.messageToHost(fe(b({}, o), {
|
|
1118
|
+
source: s.destination ? s.destination : s.source,
|
|
1119
|
+
destination: s.source ? s.source : s.destination
|
|
1041
1120
|
}), r);
|
|
1042
1121
|
};
|
|
1043
|
-
return this.innerExecutor(
|
|
1122
|
+
return this.innerExecutor(s, this.context[n].context, i);
|
|
1044
1123
|
} else
|
|
1045
1124
|
debugger;
|
|
1046
1125
|
} else
|
|
1047
1126
|
debugger;
|
|
1048
1127
|
});
|
|
1049
1128
|
}
|
|
1050
|
-
},
|
|
1129
|
+
}, me = {
|
|
1051
1130
|
id: "myop-id"
|
|
1052
|
-
},
|
|
1131
|
+
}, re = (e, t) => t.querySelectorAll(`[${me.id}='${e.refConfig.selector}']`), Ls = class extends B {
|
|
1053
1132
|
constructor() {
|
|
1054
|
-
super(...arguments), a(this, "messageType",
|
|
1055
|
-
const
|
|
1056
|
-
return
|
|
1133
|
+
super(...arguments), a(this, "messageType", w.BindClickMessage), a(this, "innerExecutor", (e, t, s) => {
|
|
1134
|
+
const n = re(e.ref, t.shadowRoot), i = [];
|
|
1135
|
+
return n.forEach((o) => {
|
|
1057
1136
|
const r = () => {
|
|
1058
|
-
|
|
1137
|
+
s(new ct(e.handlerUniqueId));
|
|
1059
1138
|
};
|
|
1060
1139
|
o.addEventListener("click", r), i.push(() => {
|
|
1061
1140
|
o.removeEventListener("click", r);
|
|
@@ -1065,44 +1144,44 @@ Check the documentation for valid behavior options.`
|
|
|
1065
1144
|
};
|
|
1066
1145
|
});
|
|
1067
1146
|
}
|
|
1068
|
-
},
|
|
1147
|
+
}, Os = class extends B {
|
|
1069
1148
|
constructor() {
|
|
1070
|
-
super(...arguments), a(this, "messageType",
|
|
1071
|
-
|
|
1072
|
-
|
|
1149
|
+
super(...arguments), a(this, "messageType", w.ChangeTextMessage), a(this, "innerExecutor", (e, t) => {
|
|
1150
|
+
re(e.ref, t.shadowRoot).forEach((n) => {
|
|
1151
|
+
n.textContent = e.content;
|
|
1073
1152
|
});
|
|
1074
1153
|
});
|
|
1075
1154
|
}
|
|
1076
|
-
},
|
|
1155
|
+
}, Ps = class extends Es {
|
|
1077
1156
|
constructor(e, t) {
|
|
1078
1157
|
super(e, t), this.container = e, this.shadowRoot = t;
|
|
1079
1158
|
}
|
|
1080
|
-
},
|
|
1159
|
+
}, As = class extends B {
|
|
1081
1160
|
constructor() {
|
|
1082
1161
|
super(...arguments), a(this, "innerExecutor", (e, t) => {
|
|
1083
|
-
const
|
|
1084
|
-
let
|
|
1085
|
-
|
|
1086
|
-
const o = i.getAttribute(
|
|
1087
|
-
o &&
|
|
1088
|
-
}), this.messageToHost(new
|
|
1089
|
-
}), a(this, "messageType",
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1162
|
+
const s = t.shadowRoot.querySelectorAll(`[${me.id}]`);
|
|
1163
|
+
let n = [];
|
|
1164
|
+
s.forEach((i) => {
|
|
1165
|
+
const o = i.getAttribute(me.id);
|
|
1166
|
+
o && n.push(new gs(o, i.tagName, i.getBoundingClientRect(), i.offsetTop, i.offsetLeft));
|
|
1167
|
+
}), this.messageToHost(new bt(e.handlerUniqueId, n));
|
|
1168
|
+
}), a(this, "messageType", w.DetectMyopRefsMessage);
|
|
1169
|
+
}
|
|
1170
|
+
}, Fs = class extends B {
|
|
1092
1171
|
constructor() {
|
|
1093
|
-
super(...arguments), a(this, "messageType",
|
|
1094
|
-
|
|
1095
|
-
|
|
1172
|
+
super(...arguments), a(this, "messageType", w.SetAttributeMessage), a(this, "innerExecutor", (e, t) => {
|
|
1173
|
+
re(e.ref, t.shadowRoot).forEach((n) => {
|
|
1174
|
+
n.setAttribute(e.name, e.value);
|
|
1096
1175
|
});
|
|
1097
1176
|
});
|
|
1098
1177
|
}
|
|
1099
|
-
},
|
|
1178
|
+
}, Bs = class extends B {
|
|
1100
1179
|
constructor() {
|
|
1101
|
-
super(...arguments), a(this, "messageType",
|
|
1102
|
-
const
|
|
1103
|
-
return
|
|
1180
|
+
super(...arguments), a(this, "messageType", w.AddEventListenerMessage), a(this, "innerExecutor", (e, t, s) => {
|
|
1181
|
+
const n = re(e.ref, t.shadowRoot), i = [];
|
|
1182
|
+
return n.forEach((o) => {
|
|
1104
1183
|
const r = (c) => {
|
|
1105
|
-
|
|
1184
|
+
s(new pt(e.handlerUniqueId, oe(c, e.serializableSkeleton)));
|
|
1106
1185
|
};
|
|
1107
1186
|
o.addEventListener(e.type, r), i.push(() => {
|
|
1108
1187
|
o.removeEventListener(e.type, r);
|
|
@@ -1112,13 +1191,13 @@ Check the documentation for valid behavior options.`
|
|
|
1112
1191
|
};
|
|
1113
1192
|
});
|
|
1114
1193
|
}
|
|
1115
|
-
},
|
|
1194
|
+
}, Ns = class extends B {
|
|
1116
1195
|
constructor() {
|
|
1117
|
-
super(...arguments), a(this, "messageType",
|
|
1118
|
-
|
|
1119
|
-
const i = t.shadowRoot.querySelectorAll(`[${
|
|
1196
|
+
super(...arguments), a(this, "messageType", w.CreateRefComponentMessage), a(this, "innerExecutor", (e, t, s) => {
|
|
1197
|
+
v(this, null, function* () {
|
|
1198
|
+
const i = t.shadowRoot.querySelectorAll(`[${me.id}='${e.refConfig.selector}']`);
|
|
1120
1199
|
if (i.length === 1) {
|
|
1121
|
-
const o =
|
|
1200
|
+
const o = Te.Instance(), r = o.components.find((u) => u.id === e.options.id);
|
|
1122
1201
|
r && r.dispose();
|
|
1123
1202
|
const c = o.components.indexOf(r);
|
|
1124
1203
|
c !== -1 && o.components.splice(c, 1);
|
|
@@ -1133,28 +1212,28 @@ Check the documentation for valid behavior options.`
|
|
|
1133
1212
|
refName: u,
|
|
1134
1213
|
componentDefinitionId: h.componentDefinition.id
|
|
1135
1214
|
});
|
|
1136
|
-
}),
|
|
1215
|
+
}), s(new Le(e.handlerUniqueId, d));
|
|
1137
1216
|
} else {
|
|
1138
|
-
console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new
|
|
1217
|
+
console.error("CreateRefComponentMessageHandler - DOM element not found"), this.messageToHost(new Le(e.handlerUniqueId, [], !0));
|
|
1139
1218
|
debugger;
|
|
1140
1219
|
}
|
|
1141
1220
|
}).then();
|
|
1142
1221
|
});
|
|
1143
1222
|
}
|
|
1144
|
-
},
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1147
|
-
const o = new Function(`return (${e.script})(...arguments)`)(
|
|
1223
|
+
}, $s = (e, t, s) => {
|
|
1224
|
+
const n = e.scriptInputs ? e.scriptInputs : {};
|
|
1225
|
+
n.makeSerializable = oe, n.send = t, n.rootRef = s, n.__scriptInputs = n;
|
|
1226
|
+
const o = new Function(`return (${e.script})(...arguments)`)(n);
|
|
1148
1227
|
t(o);
|
|
1149
|
-
},
|
|
1228
|
+
}, zs = class extends B {
|
|
1150
1229
|
constructor() {
|
|
1151
|
-
super(...arguments), a(this, "messageType",
|
|
1152
|
-
|
|
1153
|
-
|
|
1230
|
+
super(...arguments), a(this, "messageType", w.ExecuteScriptMessage), a(this, "innerExecutor", (e, t, s) => {
|
|
1231
|
+
$s(e, (i) => {
|
|
1232
|
+
s(new ut(e.handlerUniqueId, i));
|
|
1154
1233
|
}, t);
|
|
1155
1234
|
});
|
|
1156
1235
|
}
|
|
1157
|
-
},
|
|
1236
|
+
}, Pt = (e) => {
|
|
1158
1237
|
if (!e) return null;
|
|
1159
1238
|
if (e.tagName === "FORM") {
|
|
1160
1239
|
new FormData(e);
|
|
@@ -1162,16 +1241,16 @@ Check the documentation for valid behavior options.`
|
|
|
1162
1241
|
formData: {},
|
|
1163
1242
|
unmappedData: []
|
|
1164
1243
|
};
|
|
1165
|
-
return e.querySelectorAll("input, select, textarea").forEach((
|
|
1166
|
-
if (typeof
|
|
1167
|
-
const i =
|
|
1168
|
-
let o =
|
|
1244
|
+
return e.querySelectorAll("input, select, textarea").forEach((n) => {
|
|
1245
|
+
if (typeof n.value == "string") {
|
|
1246
|
+
const i = n.getAttribute(me.id);
|
|
1247
|
+
let o = n.getAttribute("name");
|
|
1169
1248
|
const r = {
|
|
1170
|
-
id:
|
|
1249
|
+
id: n.id,
|
|
1171
1250
|
name: o,
|
|
1172
|
-
value:
|
|
1173
|
-
required:
|
|
1174
|
-
validity:
|
|
1251
|
+
value: Pt(n),
|
|
1252
|
+
required: n.required,
|
|
1253
|
+
validity: oe(n.validity, !0),
|
|
1175
1254
|
myopId: i
|
|
1176
1255
|
};
|
|
1177
1256
|
o ? t.formData[o] ? t.formData[o].value ? t.unmappedData.push(r) : (t.unmappedData.push(t.formData[o]), t.formData[o] = r) : t.formData[o] = r : t.unmappedData.push(r);
|
|
@@ -1179,80 +1258,82 @@ Check the documentation for valid behavior options.`
|
|
|
1179
1258
|
}), t;
|
|
1180
1259
|
}
|
|
1181
1260
|
return e.type === "checkbox" || e.type === "radio" ? e.checked ? e.value : null : e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" ? e.value : e.isContentEditable ? e.innerText || e.textContent : null;
|
|
1182
|
-
},
|
|
1261
|
+
}, Ws = class extends B {
|
|
1183
1262
|
constructor() {
|
|
1184
|
-
super(...arguments), a(this, "messageType",
|
|
1185
|
-
|
|
1186
|
-
|
|
1263
|
+
super(...arguments), a(this, "messageType", w.GetElementValueMessage), a(this, "innerExecutor", (e, t, s) => {
|
|
1264
|
+
re(e.ref, t.shadowRoot).forEach((i) => {
|
|
1265
|
+
s(new ft(Pt(i)), e);
|
|
1187
1266
|
});
|
|
1188
1267
|
});
|
|
1189
1268
|
}
|
|
1190
|
-
},
|
|
1269
|
+
}, Ks = class extends B {
|
|
1191
1270
|
constructor() {
|
|
1192
|
-
super(...arguments), a(this, "messageType",
|
|
1193
|
-
|
|
1194
|
-
|
|
1271
|
+
super(...arguments), a(this, "messageType", w.SetInnerHtml), a(this, "innerExecutor", (e, t) => {
|
|
1272
|
+
re(e.ref, t.shadowRoot).forEach((n) => {
|
|
1273
|
+
n.innerHTML = e.content;
|
|
1195
1274
|
});
|
|
1196
1275
|
});
|
|
1197
1276
|
}
|
|
1198
|
-
},
|
|
1277
|
+
}, At = class extends bs {
|
|
1199
1278
|
constructor() {
|
|
1200
1279
|
super(...arguments), a(this, "alwaysPassEnvelopesToHost", !0), a(this, "connectedCallback", (e, t) => {
|
|
1201
|
-
e.addEventListener(
|
|
1202
|
-
const
|
|
1203
|
-
if (!
|
|
1280
|
+
e.addEventListener(Lt.webcomponent_message_key, (s) => {
|
|
1281
|
+
const n = s.data ? s.data : s.detail;
|
|
1282
|
+
if (!n || !n.myop) {
|
|
1204
1283
|
debugger;
|
|
1205
1284
|
throw new Error("recvied webcomponent_message with wrong type");
|
|
1206
1285
|
} else {
|
|
1207
|
-
const i =
|
|
1208
|
-
if (this.handleIncomeMessages(
|
|
1286
|
+
const i = n;
|
|
1287
|
+
if (this.handleIncomeMessages(s), i.messageType === w.InitMessage) {
|
|
1209
1288
|
const o = i.content.id;
|
|
1210
|
-
this.components[o].context = new
|
|
1289
|
+
this.components[o].context = new Ps(e, t);
|
|
1211
1290
|
}
|
|
1212
1291
|
}
|
|
1213
1292
|
}), setTimeout(() => {
|
|
1214
|
-
this.messageToHost(new
|
|
1293
|
+
this.messageToHost(new gt());
|
|
1215
1294
|
}, 1);
|
|
1216
1295
|
}), a(this, "messageToHost", (e, t) => {
|
|
1217
1296
|
e.direction = k.up, !e.replayToHandler && (t != null && t.handlerUniqueId) && (e.replayToHandler = t.handlerUniqueId), window.myop.hostSDK.send(e);
|
|
1218
1297
|
}), a(this, "supportedHandlers", [
|
|
1219
|
-
new
|
|
1220
|
-
new
|
|
1221
|
-
new
|
|
1222
|
-
new
|
|
1223
|
-
new
|
|
1224
|
-
new
|
|
1225
|
-
new
|
|
1226
|
-
new
|
|
1298
|
+
new Os(this.messageToHost, this.components),
|
|
1299
|
+
new Ks(this.messageToHost, this.components),
|
|
1300
|
+
new Ls(this.messageToHost, this.components),
|
|
1301
|
+
new As(this.messageToHost, this.components),
|
|
1302
|
+
new Fs(this.messageToHost, this.components),
|
|
1303
|
+
new Bs(this.messageToHost, this.components),
|
|
1304
|
+
new zs(this.messageToHost, this.components),
|
|
1305
|
+
new Ws(this.messageToHost, this.components),
|
|
1227
1306
|
//
|
|
1228
|
-
new
|
|
1307
|
+
new Ns(this.messageToHost, this.components)
|
|
1229
1308
|
]), a(this, "init", () => {
|
|
1230
1309
|
});
|
|
1231
1310
|
}
|
|
1232
1311
|
};
|
|
1233
|
-
|
|
1234
|
-
var
|
|
1235
|
-
return
|
|
1312
|
+
ot("WebComponentSDK", At);
|
|
1313
|
+
var qs = "<!-- myop-web-component -->", Us = "myop-web-component", Xe = /* @__PURE__ */ new Set(), Ze = [], be, Ft = () => v(void 0, null, function* () {
|
|
1314
|
+
return be || (be = new At(), be.init()), be;
|
|
1236
1315
|
});
|
|
1237
|
-
function
|
|
1316
|
+
function js(e, t) {
|
|
1238
1317
|
return class extends HTMLElement {
|
|
1239
1318
|
connectedCallback() {
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1242
|
-
i.connectedCallback(this,
|
|
1319
|
+
const s = t === pe.open ? "open" : "closed", n = this.attachShadow({ mode: s });
|
|
1320
|
+
Ft().then((i) => {
|
|
1321
|
+
i.connectedCallback(this, n), n.innerHTML = e;
|
|
1243
1322
|
});
|
|
1244
1323
|
}
|
|
1245
1324
|
};
|
|
1246
1325
|
}
|
|
1247
|
-
var
|
|
1248
|
-
customElements.define(e,
|
|
1249
|
-
},
|
|
1326
|
+
var Vs = (e, t, s) => {
|
|
1327
|
+
customElements.define(e, js(t, s)), console.log(`define('${e}') was called, web component ready to use`);
|
|
1328
|
+
}, Gs = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/(\d+)/g, "-$1").toLowerCase(), Ys = (e) => (e = Gs(e), e.replace(/_/g, "-")), Js = class extends Ne {
|
|
1250
1329
|
constructor() {
|
|
1251
|
-
super(...arguments), a(this, "type",
|
|
1330
|
+
super(...arguments), a(this, "type", he.HTMLLoader), a(this, "load", (e, t, s, n) => v(this, null, function* () {
|
|
1252
1331
|
const i = t.loader;
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1332
|
+
if (this.isMyopWebComponent(i.HTML))
|
|
1333
|
+
return this.loadExtractedWebComponent(e, t, s, i.HTML, n);
|
|
1334
|
+
let o = `myop-comp-${Q()}`, r;
|
|
1335
|
+
if (i.shadowRootMode === pe.localFrame) {
|
|
1336
|
+
const l = `myop-comp-${Q()}`;
|
|
1256
1337
|
let d = document.createElement("iframe");
|
|
1257
1338
|
d.id = l, d.style.cssText = `
|
|
1258
1339
|
display: block;
|
|
@@ -1262,32 +1343,41 @@ var On = (e, t, n) => {
|
|
|
1262
1343
|
inset: 0;
|
|
1263
1344
|
overflow: hidden;
|
|
1264
1345
|
border: none;
|
|
1265
|
-
opacity: ${
|
|
1346
|
+
opacity: ${n != null && n.hidden ? "0" : "1"};
|
|
1266
1347
|
width: 100%;
|
|
1267
1348
|
height: 100%;
|
|
1268
|
-
pointer-events: ${
|
|
1269
|
-
`,
|
|
1349
|
+
pointer-events: ${n != null && n.hidden ? "none" : "all"};
|
|
1350
|
+
`, s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), d = this.appendChild(s, d, n);
|
|
1270
1351
|
const u = d.contentDocument || d.contentWindow.document;
|
|
1271
1352
|
u.open();
|
|
1272
|
-
let h =
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1353
|
+
let h = null;
|
|
1354
|
+
{
|
|
1355
|
+
const C = new DOMParser().parseFromString(i.HTML, "text/html").querySelector('meta[name="myop:size"]');
|
|
1356
|
+
if (C)
|
|
1357
|
+
try {
|
|
1358
|
+
h = JSON.parse(C.getAttribute("content") || "{}");
|
|
1359
|
+
} catch {
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
let m = i.HTML;
|
|
1363
|
+
if (n != null && n._inspection) {
|
|
1364
|
+
const E = new DOMParser().parseFromString(i.HTML, "text/html"), C = E.getElementById("myop_preview");
|
|
1365
|
+
C == null || C.removeAttribute("type");
|
|
1366
|
+
const L = E.implementation.createHTMLDocument();
|
|
1367
|
+
L.body.innerHTML = `<script>
|
|
1278
1368
|
const beforeKeysWindow = new Set(Object.keys(window));
|
|
1279
1369
|
window.myopState = {
|
|
1280
1370
|
beforeKeysWindow,
|
|
1281
1371
|
};
|
|
1282
1372
|
<\/script>`;
|
|
1283
|
-
const D =
|
|
1284
|
-
D &&
|
|
1285
|
-
} else {
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1373
|
+
const D = L.body.firstChild;
|
|
1374
|
+
D && E.head && E.head.insertBefore(E.importNode(D, !0), E.head.firstChild), m = E.documentElement.outerHTML;
|
|
1375
|
+
} else if ((n == null ? void 0 : n.data) !== void 0) {
|
|
1376
|
+
const E = new DOMParser().parseFromString(i.HTML, "text/html"), C = E.getElementById("myop_preview");
|
|
1377
|
+
C && (C.remove(), m = E.documentElement.outerHTML);
|
|
1288
1378
|
}
|
|
1289
|
-
u.writeln(
|
|
1290
|
-
const f = `<script>${
|
|
1379
|
+
u.writeln(m);
|
|
1380
|
+
const f = `<script>${jt}<\/script>`;
|
|
1291
1381
|
if (u.writeln(`${f}<script>
|
|
1292
1382
|
const __myop_init = async () => {
|
|
1293
1383
|
const iframeModule = await MyopSDK.getIframeModule();
|
|
@@ -1296,15 +1386,15 @@ var On = (e, t, n) => {
|
|
|
1296
1386
|
sdk.init();
|
|
1297
1387
|
}
|
|
1298
1388
|
__myop_init().then();
|
|
1299
|
-
<\/script>`), (
|
|
1300
|
-
const
|
|
1389
|
+
<\/script>`), (n == null ? void 0 : n.data) !== void 0) {
|
|
1390
|
+
const I = `<script>
|
|
1301
1391
|
window.__myop_cta_queue = [];
|
|
1302
1392
|
window.myop_cta_handler = function(action, payload) {
|
|
1303
1393
|
window.__myop_cta_queue.push({action: action, payload: payload});
|
|
1304
1394
|
};
|
|
1305
|
-
<\/script>`,
|
|
1395
|
+
<\/script>`, C = `<script id="__myop_init_data_script">
|
|
1306
1396
|
(function() {
|
|
1307
|
-
var data = ${JSON.stringify(
|
|
1397
|
+
var data = ${JSON.stringify(n.data).replace(/<\/script/gi, "\\u003c/script")};
|
|
1308
1398
|
var scriptEl = document.getElementById('__myop_init_data_script');
|
|
1309
1399
|
|
|
1310
1400
|
var callInitInterface = function(fn) {
|
|
@@ -1363,27 +1453,78 @@ var On = (e, t, n) => {
|
|
|
1363
1453
|
}
|
|
1364
1454
|
})();
|
|
1365
1455
|
<\/script>`;
|
|
1366
|
-
u.writeln(
|
|
1456
|
+
u.writeln(I + C);
|
|
1367
1457
|
}
|
|
1368
1458
|
u.close();
|
|
1369
|
-
const
|
|
1370
|
-
return i.autoHeight && (d.onload = () => {
|
|
1371
|
-
|
|
1372
|
-
}),
|
|
1459
|
+
const x = new kt(e, t, s, d, n);
|
|
1460
|
+
return x.sizeMeta = h, i.autoHeight && (d.onload = () => {
|
|
1461
|
+
x.observeSizeBasedOnDocumentElement();
|
|
1462
|
+
}), x;
|
|
1373
1463
|
}
|
|
1374
|
-
if (i.shadowRootMode ===
|
|
1464
|
+
if (i.shadowRootMode === pe.none) {
|
|
1375
1465
|
const c = document.createElement("template");
|
|
1376
|
-
c.innerHTML = i.HTML, r = c.content.firstElementChild,
|
|
1466
|
+
c.innerHTML = i.HTML, r = c.content.firstElementChild, Ft().then((l) => {
|
|
1377
1467
|
l.connectedCallback(r, r);
|
|
1378
1468
|
});
|
|
1379
1469
|
} else {
|
|
1380
|
-
const c =
|
|
1381
|
-
|
|
1470
|
+
const c = Ys(e.name + t.id);
|
|
1471
|
+
Ze.includes(c) || (Vs(c, i.HTML, i.shadowRootMode), Ze.push(c)), r = document.createElement(c);
|
|
1382
1472
|
}
|
|
1383
|
-
return
|
|
1473
|
+
return s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), r.id = o, n != null && n.hidden && (r.style.opacity = "0", r.style.position = "absolute", r.style.height = "0", r.style.width = "0", r.style.pointerEvents = "none", r.style.visibility = "hidden"), this.appendChild(s, r, n), new Ot(e, t, s, r, n);
|
|
1384
1474
|
}));
|
|
1385
1475
|
}
|
|
1386
|
-
|
|
1476
|
+
/**
|
|
1477
|
+
* Detect if HTML is a Myop Web Component (starts with marker comment)
|
|
1478
|
+
*/
|
|
1479
|
+
isMyopWebComponent(e) {
|
|
1480
|
+
return e.trimStart().startsWith(qs);
|
|
1481
|
+
}
|
|
1482
|
+
/**
|
|
1483
|
+
* Extract the web component script content from HTML
|
|
1484
|
+
*/
|
|
1485
|
+
extractWebComponentScript(e) {
|
|
1486
|
+
const n = new DOMParser().parseFromString(e, "text/html").getElementById(Us);
|
|
1487
|
+
return (n == null ? void 0 : n.textContent) || null;
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Execute the web component script on the host document
|
|
1491
|
+
*/
|
|
1492
|
+
executeWebComponentScript(e, t) {
|
|
1493
|
+
if (Xe.has(t)) {
|
|
1494
|
+
console.log(`[MyopWebComponent] Script already executed for ${t}, skipping`);
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
const s = document.createElement("script");
|
|
1498
|
+
s.textContent = e, s.id = `myop-extracted-${t}`, document.head.appendChild(s), Xe.add(t), console.log(`[MyopWebComponent] Executed web component script: ${t}`);
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Load a Myop Web Component (extracted and run on host document)
|
|
1502
|
+
*/
|
|
1503
|
+
loadExtractedWebComponent(e, t, s, n, i) {
|
|
1504
|
+
return v(this, null, function* () {
|
|
1505
|
+
const o = this.extractWebComponentScript(n);
|
|
1506
|
+
if (!o)
|
|
1507
|
+
throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');
|
|
1508
|
+
const r = `${e.id}-${t.id}`, c = window.__MYOP_TAG_NAME__;
|
|
1509
|
+
this.executeWebComponentScript(o, r);
|
|
1510
|
+
const l = window.__MYOP_TAG_NAME__;
|
|
1511
|
+
if (!l)
|
|
1512
|
+
throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");
|
|
1513
|
+
c && c !== l && console.warn(`[MyopWebComponent] __MYOP_TAG_NAME__ changed from ${c} to ${l}`);
|
|
1514
|
+
const d = `myop-comp-${Q()}`, u = document.createElement(l);
|
|
1515
|
+
u.id = d, i != null && i.hidden && (u.style.opacity = "0", u.style.position = "absolute", u.style.height = "0", u.style.width = "0", u.style.pointerEvents = "none", u.style.visibility = "hidden"), s.querySelector('[id^="myop-comp-"]') || (s.innerHTML = ""), this.appendChild(s, u, i);
|
|
1516
|
+
const h = new Pe(
|
|
1517
|
+
e,
|
|
1518
|
+
t,
|
|
1519
|
+
s,
|
|
1520
|
+
u,
|
|
1521
|
+
l,
|
|
1522
|
+
i
|
|
1523
|
+
);
|
|
1524
|
+
return (i == null ? void 0 : i.data) !== void 0 && h.initWithData(i.data), console.log(`[MyopWebComponent] Loaded <${l}> into container`), h;
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
}, Qs = (e) => ({
|
|
1387
1528
|
instance: {
|
|
1388
1529
|
id: "auto",
|
|
1389
1530
|
componentId: e.componentId,
|
|
@@ -1405,7 +1546,7 @@ var On = (e, t, n) => {
|
|
|
1405
1546
|
name: "myop_init_interface",
|
|
1406
1547
|
type: "any",
|
|
1407
1548
|
behavior: {
|
|
1408
|
-
type:
|
|
1549
|
+
type: Ee.code
|
|
1409
1550
|
}
|
|
1410
1551
|
},
|
|
1411
1552
|
{
|
|
@@ -1413,7 +1554,7 @@ var On = (e, t, n) => {
|
|
|
1413
1554
|
name: "myop_cta_handler",
|
|
1414
1555
|
type: "any",
|
|
1415
1556
|
behavior: {
|
|
1416
|
-
type:
|
|
1557
|
+
type: Ee.code
|
|
1417
1558
|
}
|
|
1418
1559
|
}
|
|
1419
1560
|
],
|
|
@@ -1431,20 +1572,20 @@ var On = (e, t, n) => {
|
|
|
1431
1572
|
defaultSkin: 0
|
|
1432
1573
|
},
|
|
1433
1574
|
name: e.name
|
|
1434
|
-
}),
|
|
1575
|
+
}), Ce = "__MYOP_CLOUD_REPOSITORY_MAIN__", Xs = () => {
|
|
1435
1576
|
if (typeof window < "u")
|
|
1436
|
-
return window[
|
|
1577
|
+
return window[Ce];
|
|
1437
1578
|
if (typeof globalThis < "u")
|
|
1438
|
-
return globalThis[
|
|
1439
|
-
},
|
|
1440
|
-
typeof window < "u" && (window[
|
|
1441
|
-
},
|
|
1579
|
+
return globalThis[Ce];
|
|
1580
|
+
}, Zs = (e) => {
|
|
1581
|
+
typeof window < "u" && (window[Ce] = e), typeof globalThis < "u" && (globalThis[Ce] = e);
|
|
1582
|
+
}, Bt = class ne {
|
|
1442
1583
|
constructor(t = "https://cloud.myop.dev") {
|
|
1443
1584
|
this._baseUrl = t, a(this, "variants", {}), a(this, "preloadedComponents", {}), a(this, "userFlows", {}), a(this, "_defaultEnv", "production");
|
|
1444
1585
|
}
|
|
1445
1586
|
static get Main() {
|
|
1446
|
-
const t =
|
|
1447
|
-
return t || (
|
|
1587
|
+
const t = Xs();
|
|
1588
|
+
return t || (ne._main || (ne._main = new ne(), Zs(ne._main)), ne._main);
|
|
1448
1589
|
}
|
|
1449
1590
|
/**
|
|
1450
1591
|
* Set the default environment for this CloudRepository instance
|
|
@@ -1463,8 +1604,8 @@ var On = (e, t, n) => {
|
|
|
1463
1604
|
* Check if a component is already cached/preloaded (v2)
|
|
1464
1605
|
* If env and preview are not provided, checks if ANY version is preloaded
|
|
1465
1606
|
*/
|
|
1466
|
-
isPreloaded(t,
|
|
1467
|
-
return
|
|
1607
|
+
isPreloaded(t, s, n) {
|
|
1608
|
+
return s !== void 0 || n !== void 0 ? `${t}:${s || this._defaultEnv}:${n ? "preview" : "live"}` in this.variants : t in this.preloadedComponents;
|
|
1468
1609
|
}
|
|
1469
1610
|
/**
|
|
1470
1611
|
* Get the preloaded params for a component (if preloaded)
|
|
@@ -1477,11 +1618,11 @@ var On = (e, t, n) => {
|
|
|
1477
1618
|
* Fetch a v2 component config
|
|
1478
1619
|
* If env/preview not specified and component was preloaded, uses preloaded params
|
|
1479
1620
|
*/
|
|
1480
|
-
fetchComponentV2(t,
|
|
1481
|
-
return
|
|
1482
|
-
const i = this.preloadedComponents[t], o =
|
|
1621
|
+
fetchComponentV2(t, s, n) {
|
|
1622
|
+
return v(this, null, function* () {
|
|
1623
|
+
const i = this.preloadedComponents[t], o = s !== void 0 || n !== void 0;
|
|
1483
1624
|
let r, c;
|
|
1484
|
-
!o && i ? (r = i.env, c = i.preview) : (r =
|
|
1625
|
+
!o && i ? (r = i.env, c = i.preview) : (r = s || this._defaultEnv, c = n === !0 ? !0 : n === !1 ? !1 : !s);
|
|
1485
1626
|
const l = `${t}:${r}:${c ? "preview" : "live"}`;
|
|
1486
1627
|
return console.log("[CloudRepository] fetchComponentV2", {
|
|
1487
1628
|
componentId: t.slice(0, 8) + "...",
|
|
@@ -1490,20 +1631,20 @@ var On = (e, t, n) => {
|
|
|
1490
1631
|
cacheKey: l,
|
|
1491
1632
|
cached: l in this.variants
|
|
1492
1633
|
}), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: r, preview: c }), this.variants[l] = new Promise(
|
|
1493
|
-
(d, u) =>
|
|
1634
|
+
(d, u) => v(this, null, function* () {
|
|
1494
1635
|
try {
|
|
1495
1636
|
let h = `${this._baseUrl}/consume?id=${t}&env=${r}`;
|
|
1496
1637
|
c && (h += "&preview=true");
|
|
1497
|
-
const
|
|
1498
|
-
if (!
|
|
1638
|
+
const y = (yield (yield fetch(h)).json()).item;
|
|
1639
|
+
if (!y) {
|
|
1499
1640
|
u(new Error(`Component "${t}" not found`));
|
|
1500
1641
|
return;
|
|
1501
1642
|
}
|
|
1502
|
-
if (!
|
|
1643
|
+
if (!y.consume_variant || !y.consume_variant.length) {
|
|
1503
1644
|
u(new Error(`Component "${t}" has no implementation for environment "${r}"`));
|
|
1504
1645
|
return;
|
|
1505
1646
|
}
|
|
1506
|
-
const x =
|
|
1647
|
+
const x = Qs(y);
|
|
1507
1648
|
d(x);
|
|
1508
1649
|
} catch (h) {
|
|
1509
1650
|
u(h);
|
|
@@ -1516,38 +1657,38 @@ var On = (e, t, n) => {
|
|
|
1516
1657
|
/**
|
|
1517
1658
|
* Fetch a v1 component from a flow
|
|
1518
1659
|
*/
|
|
1519
|
-
fetchComponentV1(t,
|
|
1520
|
-
return
|
|
1521
|
-
return
|
|
1660
|
+
fetchComponentV1(t, s) {
|
|
1661
|
+
return v(this, null, function* () {
|
|
1662
|
+
return s ? (yield this.fetchFlow(s)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
|
|
1522
1663
|
});
|
|
1523
1664
|
}
|
|
1524
1665
|
fetchAutoFlow(t) {
|
|
1525
|
-
return
|
|
1666
|
+
return v(this, null, function* () {
|
|
1526
1667
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
1527
|
-
(
|
|
1668
|
+
(s, n) => v(this, null, function* () {
|
|
1528
1669
|
try {
|
|
1529
1670
|
const o = yield (yield fetch(
|
|
1530
1671
|
`${this._baseUrl}/flow?id=${t}&auto=true`
|
|
1531
1672
|
)).json();
|
|
1532
|
-
|
|
1673
|
+
s(o.item);
|
|
1533
1674
|
} catch (i) {
|
|
1534
|
-
|
|
1675
|
+
n(i);
|
|
1535
1676
|
}
|
|
1536
1677
|
})
|
|
1537
1678
|
)), yield this.userFlows[t];
|
|
1538
1679
|
});
|
|
1539
1680
|
}
|
|
1540
1681
|
fetchFlow(t) {
|
|
1541
|
-
return
|
|
1682
|
+
return v(this, null, function* () {
|
|
1542
1683
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
1543
|
-
(
|
|
1684
|
+
(s, n) => v(this, null, function* () {
|
|
1544
1685
|
try {
|
|
1545
1686
|
const o = yield (yield fetch(
|
|
1546
1687
|
`${this._baseUrl}/flow?id=${t}&resolve=components`
|
|
1547
1688
|
)).json();
|
|
1548
|
-
|
|
1689
|
+
s(o.item);
|
|
1549
1690
|
} catch (i) {
|
|
1550
|
-
|
|
1691
|
+
n(i);
|
|
1551
1692
|
}
|
|
1552
1693
|
})
|
|
1553
1694
|
)), yield this.userFlows[t];
|
|
@@ -1558,25 +1699,25 @@ var On = (e, t, n) => {
|
|
|
1558
1699
|
* @deprecated Use fetchComponentV2 or fetchComponentV1 explicitly
|
|
1559
1700
|
* Defaults to v1 behavior for backward compatibility with existing code
|
|
1560
1701
|
*/
|
|
1561
|
-
fetchComponent(t,
|
|
1562
|
-
return
|
|
1563
|
-
return this.fetchComponentV1(t,
|
|
1702
|
+
fetchComponent(t, s) {
|
|
1703
|
+
return v(this, null, function* () {
|
|
1704
|
+
return this.fetchComponentV1(t, s);
|
|
1564
1705
|
});
|
|
1565
1706
|
}
|
|
1566
1707
|
};
|
|
1567
|
-
a(
|
|
1568
|
-
var
|
|
1708
|
+
a(Bt, "_main", null);
|
|
1709
|
+
var et = Bt, en = (e) => v(void 0, null, function* () {
|
|
1569
1710
|
try {
|
|
1570
|
-
const t = new URL(window.location.href),
|
|
1571
|
-
if (
|
|
1572
|
-
const [i, ...o] =
|
|
1711
|
+
const t = new URL(window.location.href), n = new URLSearchParams(t.search).get("myopOverride");
|
|
1712
|
+
if (n) {
|
|
1713
|
+
const [i, ...o] = Ge(n);
|
|
1573
1714
|
switch (i) {
|
|
1574
1715
|
case "component":
|
|
1575
1716
|
{
|
|
1576
|
-
const [r, c] = o, l = yield
|
|
1717
|
+
const [r, c] = o, l = yield et.Main.fetchComponent(r);
|
|
1577
1718
|
if (l && l.type.skins.find((u) => u.id === c))
|
|
1578
1719
|
return l.instance.skinSelector = {
|
|
1579
|
-
type:
|
|
1720
|
+
type: de.Dedicated,
|
|
1580
1721
|
skin: {
|
|
1581
1722
|
id: c
|
|
1582
1723
|
}
|
|
@@ -1586,13 +1727,13 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
|
|
|
1586
1727
|
// case 'flow': {
|
|
1587
1728
|
default:
|
|
1588
1729
|
{
|
|
1589
|
-
const [r, c] =
|
|
1590
|
-
if (d && d.instance.skinSelector.type ===
|
|
1730
|
+
const [r, c] = Ge(n), d = (yield et.Main.fetchFlow(r)).components.find((u) => u.type.id === e.type.id);
|
|
1731
|
+
if (d && d.instance.skinSelector.type === de.Segmented && d.instance.resolvedExperiences) {
|
|
1591
1732
|
const u = d.instance.resolvedExperiences.find((h) => h.id === c);
|
|
1592
|
-
if ((u == null ? void 0 : u.type) ===
|
|
1593
|
-
const h = u,
|
|
1594
|
-
if (
|
|
1595
|
-
return d.instance.skinSelector =
|
|
1733
|
+
if ((u == null ? void 0 : u.type) === xt.Segment) {
|
|
1734
|
+
const h = u, f = d.instance.skinSelector.segments.find((y) => y.segmentId === h.segment.id);
|
|
1735
|
+
if (f)
|
|
1736
|
+
return d.instance.skinSelector = f == null ? void 0 : f.skinSelector, d;
|
|
1596
1737
|
}
|
|
1597
1738
|
}
|
|
1598
1739
|
}
|
|
@@ -1602,52 +1743,52 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
|
|
|
1602
1743
|
} finally {
|
|
1603
1744
|
return null;
|
|
1604
1745
|
}
|
|
1605
|
-
}),
|
|
1746
|
+
}), Nt = "https://cdn.myop.dev/sdk/next/myop_sdk.min.js", Te = class {
|
|
1606
1747
|
constructor() {
|
|
1607
|
-
a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version",
|
|
1748
|
+
a(this, "components2init", []), a(this, "components", []), a(this, "componentsLoaders", []), a(this, "initiated", !1), a(this, "version", ks), a(this, "type2InstanceCount", {}), a(this, "assignId", (e) => (this.type2InstanceCount[e.id] || (this.type2InstanceCount[e.id] = 0), `${e.id}_${++this.type2InstanceCount[e.id]}`)), a(this, "inspected", !1), a(this, "inspect", () => {
|
|
1608
1749
|
this.inspected || (this.inspected = !0, this.components.forEach((e) => {
|
|
1609
1750
|
e.inspect && e.inspect();
|
|
1610
1751
|
}));
|
|
1611
1752
|
}), a(this, "incomingMessageHandler", (e) => {
|
|
1612
1753
|
if (e.origin, document.location.origin, e.data.myop) {
|
|
1613
|
-
if (e.data.direction !== k.up && e.data.messageType !==
|
|
1754
|
+
if (e.data.direction !== k.up && e.data.messageType !== w.EnvelopedMessage)
|
|
1614
1755
|
return;
|
|
1615
1756
|
const t = e.data;
|
|
1616
|
-
if (t.messageType ===
|
|
1617
|
-
this.components2init.forEach((
|
|
1618
|
-
|
|
1757
|
+
if (t.messageType === w.InitRequest) {
|
|
1758
|
+
this.components2init.forEach((n) => {
|
|
1759
|
+
n.send(new Ae(n.id));
|
|
1619
1760
|
});
|
|
1620
1761
|
return;
|
|
1621
1762
|
}
|
|
1622
|
-
if (t.messageType ===
|
|
1763
|
+
if (t.messageType === w.InitResponse) {
|
|
1623
1764
|
this.components2init = this.components2init.filter((i) => i.id !== t.content.id);
|
|
1624
|
-
const
|
|
1765
|
+
const n = this.components.find((i) => {
|
|
1625
1766
|
var o;
|
|
1626
1767
|
return i.id === ((o = t.content) == null ? void 0 : o.id);
|
|
1627
1768
|
});
|
|
1628
|
-
|
|
1769
|
+
n == null || n.setInitiated();
|
|
1629
1770
|
return;
|
|
1630
1771
|
}
|
|
1631
|
-
if (t.messageType ===
|
|
1632
|
-
const
|
|
1772
|
+
if (t.messageType === w.EnvelopedMessage) {
|
|
1773
|
+
const n = t, i = this.components.find((o) => o.id === n.destination);
|
|
1633
1774
|
if (i) {
|
|
1634
|
-
if (
|
|
1635
|
-
|
|
1775
|
+
if (n.direction === k.down) {
|
|
1776
|
+
n.message.messageType === U.name ? i.onMessageReceived(n.message) : (n.message.route = n.route, i.send(n.message));
|
|
1636
1777
|
return;
|
|
1637
1778
|
}
|
|
1638
1779
|
} else {
|
|
1639
|
-
const o = this.components.find((r) => r.id ===
|
|
1640
|
-
o && o.send(
|
|
1780
|
+
const o = this.components.find((r) => r.id === n.message.destination);
|
|
1781
|
+
o && o.send(n.message);
|
|
1641
1782
|
}
|
|
1642
1783
|
return;
|
|
1643
1784
|
}
|
|
1644
|
-
const
|
|
1645
|
-
if (!
|
|
1785
|
+
const s = this.components.find((n) => n.id === t.destination);
|
|
1786
|
+
if (!s) {
|
|
1646
1787
|
window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
|
|
1647
1788
|
return;
|
|
1648
1789
|
}
|
|
1649
|
-
if (
|
|
1650
|
-
if (
|
|
1790
|
+
if (s) {
|
|
1791
|
+
if (s.onMessageReceived(t))
|
|
1651
1792
|
return;
|
|
1652
1793
|
window.myop.IframeSDK && window.myop.IframeSDK.messageToHost(t);
|
|
1653
1794
|
}
|
|
@@ -1662,54 +1803,54 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
|
|
|
1662
1803
|
if (this.initiated)
|
|
1663
1804
|
throw new Error("hostSDK already initiated");
|
|
1664
1805
|
const t = [
|
|
1665
|
-
new
|
|
1666
|
-
new
|
|
1667
|
-
new
|
|
1806
|
+
new Rs(),
|
|
1807
|
+
new Ds(),
|
|
1808
|
+
new Js()
|
|
1668
1809
|
];
|
|
1669
1810
|
if (this.componentsLoaders = [
|
|
1670
1811
|
...t
|
|
1671
1812
|
], e) {
|
|
1672
|
-
const
|
|
1673
|
-
e.forEach((
|
|
1674
|
-
const i = new
|
|
1675
|
-
|
|
1676
|
-
}), this.componentsLoaders.forEach((
|
|
1677
|
-
n
|
|
1678
|
-
}), this.componentsLoaders = Object.values(
|
|
1813
|
+
const s = {};
|
|
1814
|
+
e.forEach((n) => {
|
|
1815
|
+
const i = new n(this.componentsLoaders);
|
|
1816
|
+
s[i.type] = i;
|
|
1817
|
+
}), this.componentsLoaders.forEach((n) => {
|
|
1818
|
+
s[n.type] || (s[n.type] = n);
|
|
1819
|
+
}), this.componentsLoaders = Object.values(s);
|
|
1679
1820
|
}
|
|
1680
1821
|
window.addEventListener(
|
|
1681
1822
|
"message",
|
|
1682
1823
|
this.incomingMessageHandler,
|
|
1683
1824
|
!1
|
|
1684
1825
|
), console.log("myop hostSDK initiated", document.location.href), this.initiated = !0;
|
|
1685
|
-
}), a(this, "_getSkinIdBySkinSelector", (e, ...t) =>
|
|
1826
|
+
}), a(this, "_getSkinIdBySkinSelector", (e, ...t) => v(this, [e, ...t], function* (s, n = [], i) {
|
|
1686
1827
|
var o;
|
|
1687
1828
|
function r(c, l) {
|
|
1688
|
-
return
|
|
1829
|
+
return v(this, null, function* () {
|
|
1689
1830
|
for (const d of c)
|
|
1690
1831
|
if (yield l(d))
|
|
1691
1832
|
return d;
|
|
1692
1833
|
});
|
|
1693
1834
|
}
|
|
1694
|
-
switch (
|
|
1835
|
+
switch (s.type) {
|
|
1695
1836
|
// @ts-ignore
|
|
1696
1837
|
case "DedicatedSkin":
|
|
1697
1838
|
//backward compatibility
|
|
1698
|
-
case
|
|
1699
|
-
return ((o =
|
|
1700
|
-
case
|
|
1839
|
+
case de.Dedicated:
|
|
1840
|
+
return ((o = s.skin) == null ? void 0 : o.id) || s.skins[0].id;
|
|
1841
|
+
case de.Segmented:
|
|
1701
1842
|
{
|
|
1702
|
-
const l = yield r(
|
|
1843
|
+
const l = yield r(s.segments, (d) => v(this, null, function* () {
|
|
1703
1844
|
if (d.segmentId === "Default")
|
|
1704
1845
|
return !0;
|
|
1705
|
-
const u =
|
|
1846
|
+
const u = n.find((y) => y.type === xt.Segment ? y.segment.id === d.segmentId : !1);
|
|
1706
1847
|
if (!u)
|
|
1707
1848
|
throw new Error("experience not found");
|
|
1708
|
-
const
|
|
1709
|
-
return
|
|
1849
|
+
const m = u.segment, f = (i || {})[m.function];
|
|
1850
|
+
return f ? yield f() : (console.warn(`segmentId:${d.segmentId}, ${m.function} function not provided !`), !1);
|
|
1710
1851
|
}));
|
|
1711
1852
|
if (l)
|
|
1712
|
-
return this._getSkinIdBySkinSelector(l.skinSelector,
|
|
1853
|
+
return this._getSkinIdBySkinSelector(l.skinSelector, n);
|
|
1713
1854
|
debugger;
|
|
1714
1855
|
}
|
|
1715
1856
|
break;
|
|
@@ -1717,104 +1858,104 @@ var Ue = xt, Nn = (e) => y(void 0, null, function* () {
|
|
|
1717
1858
|
debugger;
|
|
1718
1859
|
}
|
|
1719
1860
|
return "";
|
|
1720
|
-
})), a(this, "runSkinSelector", (e, t) =>
|
|
1721
|
-
const
|
|
1722
|
-
return e.type.skins.find((
|
|
1723
|
-
})), a(this, "loaderHooks"), a(this, "loadComponent", (e, t,
|
|
1724
|
-
var
|
|
1861
|
+
})), a(this, "runSkinSelector", (e, t) => v(this, null, function* () {
|
|
1862
|
+
const s = yield this._getSkinIdBySkinSelector(e.instance.skinSelector, e.instance.resolvedExperiences, t);
|
|
1863
|
+
return e.type.skins.find((n) => n.id === s);
|
|
1864
|
+
})), a(this, "loaderHooks"), a(this, "loadComponent", (e, t, s) => v(this, null, function* () {
|
|
1865
|
+
var n, i, o, r;
|
|
1725
1866
|
if (!t) {
|
|
1726
1867
|
debugger;
|
|
1727
1868
|
throw new Error("no container was found for this component");
|
|
1728
1869
|
}
|
|
1729
|
-
const c = yield
|
|
1870
|
+
const c = yield en(e);
|
|
1730
1871
|
c && (e = c);
|
|
1731
|
-
const l =
|
|
1872
|
+
const l = b(b({}, (n = this.loaderHooks) != null ? n : {}), (i = s == null ? void 0 : s.hooks) != null ? i : {}), d = t;
|
|
1732
1873
|
if (d.myop)
|
|
1733
1874
|
if (d.component) {
|
|
1734
|
-
e =
|
|
1735
|
-
let
|
|
1736
|
-
if (!
|
|
1875
|
+
e = b({}, e), e.instance = b({}, e.instance);
|
|
1876
|
+
let f = yield this.runSkinSelector(e, l);
|
|
1877
|
+
if (!f)
|
|
1737
1878
|
throw new Error("runSkinSelector failed to choose skin, check the provided config");
|
|
1738
|
-
return (o =
|
|
1739
|
-
type:
|
|
1740
|
-
skin:
|
|
1879
|
+
return (o = s == null ? void 0 : s.hooks) != null && o.afterSkinSelected && (f = yield s.hooks.afterSkinSelected(b({}, f))), e.instance.skinSelector = {
|
|
1880
|
+
type: de.Dedicated,
|
|
1881
|
+
skin: f
|
|
1741
1882
|
// skins: [selectedSkin]
|
|
1742
|
-
},
|
|
1883
|
+
}, s && (s = b({}, s), delete s.hooks), yield Rt(d, e, this.components, s);
|
|
1743
1884
|
} else
|
|
1744
1885
|
throw new Error("load component got a detached ref.");
|
|
1745
1886
|
t = t;
|
|
1746
1887
|
let u = yield this.runSkinSelector(e, l);
|
|
1747
1888
|
if (!u)
|
|
1748
1889
|
throw new Error("runSkinSelector failed to choose skin, check the provided config");
|
|
1749
|
-
(r =
|
|
1750
|
-
const h = this.componentsLoaders.find((
|
|
1890
|
+
(r = s == null ? void 0 : s.hooks) != null && r.afterSkinSelected && (u = yield s.hooks.afterSkinSelected(b({}, u)));
|
|
1891
|
+
const h = this.componentsLoaders.find((f) => f.type === u.loader.type);
|
|
1751
1892
|
if (!h) {
|
|
1752
1893
|
debugger;
|
|
1753
1894
|
throw new Error(`no loader "${u.loader.type}" was found for component`);
|
|
1754
1895
|
}
|
|
1755
|
-
let
|
|
1756
|
-
|
|
1896
|
+
let m = yield h.load(e.type, u, t, s);
|
|
1897
|
+
m.isInitiated || this.components2init.push(m), m.bind("onDispose", () => (this.components = this.components.filter((f) => f !== m), this.components2init = this.components2init.filter((f) => f !== m), !0)), this.components.push(m), (!s || s.connectProps !== !1) && (m = Ts(m, e.type.props, u));
|
|
1757
1898
|
try {
|
|
1758
|
-
yield
|
|
1759
|
-
} catch (
|
|
1760
|
-
throw
|
|
1899
|
+
yield Dt(m, e, this.components);
|
|
1900
|
+
} catch (f) {
|
|
1901
|
+
throw f;
|
|
1761
1902
|
}
|
|
1762
|
-
return
|
|
1763
|
-
})), a(this, "navigate", (e, t,
|
|
1903
|
+
return s != null && s.skipInit || (yield m.initiated()), m;
|
|
1904
|
+
})), a(this, "navigate", (e, t, s) => v(this, null, function* () {
|
|
1764
1905
|
if (e.parent)
|
|
1765
1906
|
throw new Error("Navigating on remote ref components is not implemented yet");
|
|
1766
|
-
if (
|
|
1767
|
-
let
|
|
1907
|
+
if (s != null && s.staged) {
|
|
1908
|
+
let n = yield this.loadComponent(t, e.container, b({
|
|
1768
1909
|
hidden: !0,
|
|
1769
1910
|
relative: { direction: "after", child: e.element }
|
|
1770
|
-
},
|
|
1771
|
-
return
|
|
1911
|
+
}, s));
|
|
1912
|
+
return s.init && (yield s.init(n)), n.show(), e.dispose(), n;
|
|
1772
1913
|
} else {
|
|
1773
|
-
const
|
|
1774
|
-
return e.dispose(), this.loadComponent(t, e.container,
|
|
1914
|
+
const n = e.element.nextSibling;
|
|
1915
|
+
return e.dispose(), this.loadComponent(t, e.container, b({
|
|
1775
1916
|
relative: {
|
|
1776
1917
|
direction: "before",
|
|
1777
|
-
child:
|
|
1918
|
+
child: n
|
|
1778
1919
|
}
|
|
1779
|
-
},
|
|
1920
|
+
}, s));
|
|
1780
1921
|
}
|
|
1781
1922
|
}));
|
|
1782
1923
|
}
|
|
1783
1924
|
};
|
|
1784
|
-
a(
|
|
1925
|
+
a(Te, "Instance", () => window.myop.hostSDK);
|
|
1785
1926
|
window.myop || (window.myop = {
|
|
1786
|
-
__ROOT_SDK_PUBLIC_URL__:
|
|
1927
|
+
__ROOT_SDK_PUBLIC_URL__: Nt
|
|
1787
1928
|
});
|
|
1788
1929
|
if (!window.myop.hostSDK) {
|
|
1789
|
-
const e = new
|
|
1930
|
+
const e = new Te();
|
|
1790
1931
|
e.init(), window.myop || (window.myop = {
|
|
1791
|
-
__ROOT_SDK_PUBLIC_URL__:
|
|
1932
|
+
__ROOT_SDK_PUBLIC_URL__: Nt
|
|
1792
1933
|
}), window.myop.hostSDK = e;
|
|
1793
1934
|
}
|
|
1794
|
-
var
|
|
1795
|
-
|
|
1796
|
-
var
|
|
1935
|
+
var $e = window.myop.hostSDK;
|
|
1936
|
+
ot("hostSDK", $e);
|
|
1937
|
+
var tn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", sn = "linear-gradient(135deg, #9CA3AF 0%, #D1D5DB 50%, #E5E7EB 100%)", nn = {
|
|
1797
1938
|
position: "absolute",
|
|
1798
1939
|
top: 0,
|
|
1799
1940
|
left: 0,
|
|
1800
1941
|
right: 0,
|
|
1801
1942
|
bottom: 0,
|
|
1802
1943
|
zIndex: 1,
|
|
1803
|
-
background:
|
|
1944
|
+
background: tn,
|
|
1804
1945
|
display: "flex",
|
|
1805
1946
|
justifyContent: "center",
|
|
1806
1947
|
alignItems: "center"
|
|
1807
|
-
},
|
|
1948
|
+
}, on = {
|
|
1808
1949
|
position: "absolute",
|
|
1809
1950
|
top: 0,
|
|
1810
1951
|
left: 0,
|
|
1811
1952
|
right: 0,
|
|
1812
1953
|
bottom: 0,
|
|
1813
|
-
background:
|
|
1954
|
+
background: sn,
|
|
1814
1955
|
display: "flex",
|
|
1815
1956
|
justifyContent: "center",
|
|
1816
1957
|
alignItems: "center"
|
|
1817
|
-
},
|
|
1958
|
+
}, rn = {
|
|
1818
1959
|
position: "absolute",
|
|
1819
1960
|
top: 0,
|
|
1820
1961
|
left: 0,
|
|
@@ -1824,27 +1965,27 @@ var zn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Un =
|
|
|
1824
1965
|
display: "flex",
|
|
1825
1966
|
justifyContent: "center",
|
|
1826
1967
|
alignItems: "center"
|
|
1827
|
-
},
|
|
1968
|
+
}, an = Object.defineProperty, cn = (e, t, s) => t in e ? an(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, p = (e, t, s) => cn(e, typeof t != "symbol" ? t + "" : t, s), q = (e, t, s) => new Promise((n, i) => {
|
|
1828
1969
|
var o = (l) => {
|
|
1829
1970
|
try {
|
|
1830
|
-
c(
|
|
1971
|
+
c(s.next(l));
|
|
1831
1972
|
} catch (d) {
|
|
1832
1973
|
i(d);
|
|
1833
1974
|
}
|
|
1834
1975
|
}, r = (l) => {
|
|
1835
1976
|
try {
|
|
1836
|
-
c(
|
|
1977
|
+
c(s.throw(l));
|
|
1837
1978
|
} catch (d) {
|
|
1838
1979
|
i(d);
|
|
1839
1980
|
}
|
|
1840
|
-
}, c = (l) => l.done ?
|
|
1841
|
-
c((
|
|
1842
|
-
}),
|
|
1981
|
+
}, c = (l) => l.done ? n(l.value) : Promise.resolve(l.value).then(o, r);
|
|
1982
|
+
c((s = s.apply(e, t)).next());
|
|
1983
|
+
}), V = () => "10000000-1000-4000-8000-100000000000".replace(
|
|
1843
1984
|
/[018]/g,
|
|
1844
1985
|
(e) => (+e ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +e / 4).toString(16)
|
|
1845
|
-
),
|
|
1986
|
+
), ln = class {
|
|
1846
1987
|
constructor() {
|
|
1847
|
-
p(this, "id",
|
|
1988
|
+
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);
|
|
1848
1989
|
}
|
|
1849
1990
|
static create(...e) {
|
|
1850
1991
|
return new this(...e);
|
|
@@ -1852,36 +1993,36 @@ var zn = "linear-gradient(135deg, #FF8651 0%, #FFBEA8 50%, #A397F5 100%)", Un =
|
|
|
1852
1993
|
isTypeof(e) {
|
|
1853
1994
|
return e.messageType === this.messageType;
|
|
1854
1995
|
}
|
|
1855
|
-
},
|
|
1996
|
+
}, dn = class extends ln {
|
|
1856
1997
|
constructor(e) {
|
|
1857
|
-
super(), this.handler = e, p(this, "handlerUniqueId",
|
|
1998
|
+
super(), this.handler = e, p(this, "handlerUniqueId", V());
|
|
1858
1999
|
}
|
|
1859
|
-
},
|
|
1860
|
-
let t = e.match(
|
|
2000
|
+
}, un = "ExecuteScriptReplyMessage", hn = /(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/, pn = /\(\s*[^)]+\s*\)\s*=>\s*(.+)/, mn = (e) => {
|
|
2001
|
+
let t = e.match(hn);
|
|
1861
2002
|
if (t)
|
|
1862
2003
|
return t[1] || t[3];
|
|
1863
2004
|
{
|
|
1864
|
-
let
|
|
1865
|
-
if (
|
|
1866
|
-
return
|
|
2005
|
+
let s = e.match(pn);
|
|
2006
|
+
if (s)
|
|
2007
|
+
return s[1].trim();
|
|
1867
2008
|
}
|
|
1868
|
-
},
|
|
2009
|
+
}, $t = class extends dn {
|
|
1869
2010
|
constructor(e, t = () => {
|
|
1870
|
-
},
|
|
1871
|
-
super(t), this.scriptInputs =
|
|
2011
|
+
}, s) {
|
|
2012
|
+
super(t), this.scriptInputs = s, p(this, "replyMessageKey", un), p(this, "messageType", "ExecuteScriptMessage"), p(this, "script", ""), this.script = e.toString(), this.content = e.toString(), this.content = mn(this.content);
|
|
1872
2013
|
}
|
|
1873
2014
|
};
|
|
1874
|
-
p(
|
|
1875
|
-
p(
|
|
1876
|
-
var
|
|
2015
|
+
p($t, "replierKey", "send");
|
|
2016
|
+
p($t, "completeStreamKey", "completeStream");
|
|
2017
|
+
var tt = class {
|
|
1877
2018
|
constructor() {
|
|
1878
|
-
p(this, "_runTimeInstanceId", "runtime-instance-id-" +
|
|
2019
|
+
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);
|
|
1879
2020
|
}
|
|
1880
2021
|
};
|
|
1881
|
-
p(
|
|
1882
|
-
var
|
|
2022
|
+
p(tt, "create", () => new tt());
|
|
2023
|
+
var st = class {
|
|
1883
2024
|
constructor() {
|
|
1884
|
-
p(this, "_runTimeInstanceId", "runtime-instance-id-" +
|
|
2025
|
+
p(this, "_runTimeInstanceId", "runtime-instance-id-" + V()), p(this, "_runTimeId", "runtime-id-" + V()), p(this, "_runTimeName", "runtime-name-" + V()), p(this, "instance", {
|
|
1885
2026
|
id: this._runTimeInstanceId,
|
|
1886
2027
|
componentId: this._runTimeId,
|
|
1887
2028
|
componentName: this._runTimeName,
|
|
@@ -1900,7 +2041,7 @@ var je = class {
|
|
|
1900
2041
|
id: t.id
|
|
1901
2042
|
}
|
|
1902
2043
|
}, this)), p(this, "withRef", (t) => (this.type.refs.push(t), this)), p(this, "withBasicRef", (t) => {
|
|
1903
|
-
const
|
|
2044
|
+
const s = {
|
|
1904
2045
|
id: "",
|
|
1905
2046
|
name: t,
|
|
1906
2047
|
description: "",
|
|
@@ -1910,14 +2051,14 @@ var je = class {
|
|
|
1910
2051
|
type: "code"
|
|
1911
2052
|
}
|
|
1912
2053
|
};
|
|
1913
|
-
return this.type.refs.push(
|
|
2054
|
+
return this.type.refs.push(s), this;
|
|
1914
2055
|
}), p(this, "build", () => JSON.parse(JSON.stringify(this)));
|
|
1915
2056
|
}
|
|
1916
2057
|
};
|
|
1917
|
-
p(
|
|
1918
|
-
var
|
|
2058
|
+
p(st, "create", () => new st());
|
|
2059
|
+
var nt = {
|
|
1919
2060
|
code: "code"
|
|
1920
|
-
},
|
|
2061
|
+
}, fn = (e) => ({
|
|
1921
2062
|
instance: {
|
|
1922
2063
|
id: "auto",
|
|
1923
2064
|
componentId: e.componentId,
|
|
@@ -1939,7 +2080,7 @@ var We = {
|
|
|
1939
2080
|
name: "myop_init_interface",
|
|
1940
2081
|
type: "any",
|
|
1941
2082
|
behavior: {
|
|
1942
|
-
type:
|
|
2083
|
+
type: nt.code
|
|
1943
2084
|
}
|
|
1944
2085
|
},
|
|
1945
2086
|
{
|
|
@@ -1947,7 +2088,7 @@ var We = {
|
|
|
1947
2088
|
name: "myop_cta_handler",
|
|
1948
2089
|
type: "any",
|
|
1949
2090
|
behavior: {
|
|
1950
|
-
type:
|
|
2091
|
+
type: nt.code
|
|
1951
2092
|
}
|
|
1952
2093
|
}
|
|
1953
2094
|
],
|
|
@@ -1965,20 +2106,20 @@ var We = {
|
|
|
1965
2106
|
defaultSkin: 0
|
|
1966
2107
|
},
|
|
1967
2108
|
name: e.name
|
|
1968
|
-
}),
|
|
2109
|
+
}), Se = "__MYOP_CLOUD_REPOSITORY_MAIN__", yn = () => {
|
|
1969
2110
|
if (typeof window < "u")
|
|
1970
|
-
return window[
|
|
2111
|
+
return window[Se];
|
|
1971
2112
|
if (typeof globalThis < "u")
|
|
1972
|
-
return globalThis[
|
|
1973
|
-
},
|
|
1974
|
-
typeof window < "u" && (window[
|
|
1975
|
-
},
|
|
2113
|
+
return globalThis[Se];
|
|
2114
|
+
}, gn = (e) => {
|
|
2115
|
+
typeof window < "u" && (window[Se] = e), typeof globalThis < "u" && (globalThis[Se] = e);
|
|
2116
|
+
}, zt = class ie {
|
|
1976
2117
|
constructor(t = "https://cloud.myop.dev") {
|
|
1977
2118
|
this._baseUrl = t, p(this, "variants", {}), p(this, "preloadedComponents", {}), p(this, "userFlows", {}), p(this, "_defaultEnv", "production");
|
|
1978
2119
|
}
|
|
1979
2120
|
static get Main() {
|
|
1980
|
-
const t =
|
|
1981
|
-
return t || (
|
|
2121
|
+
const t = yn();
|
|
2122
|
+
return t || (ie._main || (ie._main = new ie(), gn(ie._main)), ie._main);
|
|
1982
2123
|
}
|
|
1983
2124
|
/**
|
|
1984
2125
|
* Set the default environment for this CloudRepository instance
|
|
@@ -1997,8 +2138,8 @@ var We = {
|
|
|
1997
2138
|
* Check if a component is already cached/preloaded (v2)
|
|
1998
2139
|
* If env and preview are not provided, checks if ANY version is preloaded
|
|
1999
2140
|
*/
|
|
2000
|
-
isPreloaded(t,
|
|
2001
|
-
return
|
|
2141
|
+
isPreloaded(t, s, n) {
|
|
2142
|
+
return s !== void 0 || n !== void 0 ? `${t}:${s || this._defaultEnv}:${n ? "preview" : "live"}` in this.variants : t in this.preloadedComponents;
|
|
2002
2143
|
}
|
|
2003
2144
|
/**
|
|
2004
2145
|
* Get the preloaded params for a component (if preloaded)
|
|
@@ -2011,11 +2152,11 @@ var We = {
|
|
|
2011
2152
|
* Fetch a v2 component config
|
|
2012
2153
|
* If env/preview not specified and component was preloaded, uses preloaded params
|
|
2013
2154
|
*/
|
|
2014
|
-
fetchComponentV2(t,
|
|
2015
|
-
return
|
|
2016
|
-
const i = this.preloadedComponents[t], o =
|
|
2155
|
+
fetchComponentV2(t, s, n) {
|
|
2156
|
+
return q(this, null, function* () {
|
|
2157
|
+
const i = this.preloadedComponents[t], o = s !== void 0 || n !== void 0;
|
|
2017
2158
|
let r, c;
|
|
2018
|
-
!o && i ? (r = i.env, c = i.preview) : (r =
|
|
2159
|
+
!o && i ? (r = i.env, c = i.preview) : (r = s || this._defaultEnv, c = n === !0 ? !0 : n === !1 ? !1 : !s);
|
|
2019
2160
|
const l = `${t}:${r}:${c ? "preview" : "live"}`;
|
|
2020
2161
|
return console.log("[CloudRepository] fetchComponentV2", {
|
|
2021
2162
|
componentId: t.slice(0, 8) + "...",
|
|
@@ -2024,20 +2165,20 @@ var We = {
|
|
|
2024
2165
|
cacheKey: l,
|
|
2025
2166
|
cached: l in this.variants
|
|
2026
2167
|
}), this.variants[l] || (this.preloadedComponents[t] || (this.preloadedComponents[t] = { env: r, preview: c }), this.variants[l] = new Promise(
|
|
2027
|
-
(d, u) =>
|
|
2168
|
+
(d, u) => q(this, null, function* () {
|
|
2028
2169
|
try {
|
|
2029
2170
|
let h = `${this._baseUrl}/consume?id=${t}&env=${r}`;
|
|
2030
2171
|
c && (h += "&preview=true");
|
|
2031
|
-
const
|
|
2032
|
-
if (!
|
|
2172
|
+
const y = (yield (yield fetch(h)).json()).item;
|
|
2173
|
+
if (!y) {
|
|
2033
2174
|
u(new Error(`Component "${t}" not found`));
|
|
2034
2175
|
return;
|
|
2035
2176
|
}
|
|
2036
|
-
if (!
|
|
2177
|
+
if (!y.consume_variant || !y.consume_variant.length) {
|
|
2037
2178
|
u(new Error(`Component "${t}" has no implementation for environment "${r}"`));
|
|
2038
2179
|
return;
|
|
2039
2180
|
}
|
|
2040
|
-
const x =
|
|
2181
|
+
const x = fn(y);
|
|
2041
2182
|
d(x);
|
|
2042
2183
|
} catch (h) {
|
|
2043
2184
|
u(h);
|
|
@@ -2050,38 +2191,38 @@ var We = {
|
|
|
2050
2191
|
/**
|
|
2051
2192
|
* Fetch a v1 component from a flow
|
|
2052
2193
|
*/
|
|
2053
|
-
fetchComponentV1(t,
|
|
2054
|
-
return
|
|
2055
|
-
return
|
|
2194
|
+
fetchComponentV1(t, s) {
|
|
2195
|
+
return q(this, null, function* () {
|
|
2196
|
+
return s ? (yield this.fetchFlow(s)).components.find((i) => i.type.id === t) : (yield this.fetchAutoFlow(t)).components[0];
|
|
2056
2197
|
});
|
|
2057
2198
|
}
|
|
2058
2199
|
fetchAutoFlow(t) {
|
|
2059
|
-
return
|
|
2200
|
+
return q(this, null, function* () {
|
|
2060
2201
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
2061
|
-
(
|
|
2202
|
+
(s, n) => q(this, null, function* () {
|
|
2062
2203
|
try {
|
|
2063
2204
|
const o = yield (yield fetch(
|
|
2064
2205
|
`${this._baseUrl}/flow?id=${t}&auto=true`
|
|
2065
2206
|
)).json();
|
|
2066
|
-
|
|
2207
|
+
s(o.item);
|
|
2067
2208
|
} catch (i) {
|
|
2068
|
-
|
|
2209
|
+
n(i);
|
|
2069
2210
|
}
|
|
2070
2211
|
})
|
|
2071
2212
|
)), yield this.userFlows[t];
|
|
2072
2213
|
});
|
|
2073
2214
|
}
|
|
2074
2215
|
fetchFlow(t) {
|
|
2075
|
-
return
|
|
2216
|
+
return q(this, null, function* () {
|
|
2076
2217
|
return this.userFlows[t] || (this.userFlows[t] = new Promise(
|
|
2077
|
-
(
|
|
2218
|
+
(s, n) => q(this, null, function* () {
|
|
2078
2219
|
try {
|
|
2079
2220
|
const o = yield (yield fetch(
|
|
2080
2221
|
`${this._baseUrl}/flow?id=${t}&resolve=components`
|
|
2081
2222
|
)).json();
|
|
2082
|
-
|
|
2223
|
+
s(o.item);
|
|
2083
2224
|
} catch (i) {
|
|
2084
|
-
|
|
2225
|
+
n(i);
|
|
2085
2226
|
}
|
|
2086
2227
|
})
|
|
2087
2228
|
)), yield this.userFlows[t];
|
|
@@ -2092,27 +2233,27 @@ var We = {
|
|
|
2092
2233
|
* @deprecated Use fetchComponentV2 or fetchComponentV1 explicitly
|
|
2093
2234
|
* Defaults to v1 behavior for backward compatibility with existing code
|
|
2094
2235
|
*/
|
|
2095
|
-
fetchComponent(t,
|
|
2096
|
-
return
|
|
2097
|
-
return this.fetchComponentV1(t,
|
|
2236
|
+
fetchComponent(t, s) {
|
|
2237
|
+
return q(this, null, function* () {
|
|
2238
|
+
return this.fetchComponentV1(t, s);
|
|
2098
2239
|
});
|
|
2099
2240
|
}
|
|
2100
2241
|
};
|
|
2101
|
-
p(
|
|
2102
|
-
var
|
|
2103
|
-
const
|
|
2104
|
-
const t =
|
|
2105
|
-
return
|
|
2242
|
+
p(zt, "_main", null);
|
|
2243
|
+
var xe = zt;
|
|
2244
|
+
const Dn = (e) => {
|
|
2245
|
+
const t = P(null), s = P(null), n = P(!1), i = P(null);
|
|
2246
|
+
return le(() => {
|
|
2106
2247
|
let o = !1;
|
|
2107
|
-
|
|
2248
|
+
n.current = !(t != null && t.current);
|
|
2108
2249
|
const r = async (c) => {
|
|
2109
|
-
|
|
2250
|
+
n.current = !0;
|
|
2110
2251
|
try {
|
|
2111
|
-
const l = await
|
|
2252
|
+
const l = await xe.Main.fetchComponent(
|
|
2112
2253
|
c.componentId,
|
|
2113
2254
|
c.flowId
|
|
2114
2255
|
);
|
|
2115
|
-
|
|
2256
|
+
s.current = await $e.loadComponent(
|
|
2116
2257
|
l,
|
|
2117
2258
|
t.current,
|
|
2118
2259
|
{
|
|
@@ -2133,19 +2274,19 @@ const ys = (e) => {
|
|
|
2133
2274
|
// }
|
|
2134
2275
|
}
|
|
2135
2276
|
}
|
|
2136
|
-
), o ?
|
|
2277
|
+
), o ? s.current && s.current.dispose() : c.onReady && c.onReady(s.current);
|
|
2137
2278
|
} catch {
|
|
2138
2279
|
} finally {
|
|
2139
|
-
if (
|
|
2280
|
+
if (n.current = !1, i.current !== null && !o) {
|
|
2140
2281
|
const l = i.current;
|
|
2141
2282
|
i.current = null, await r(l);
|
|
2142
2283
|
}
|
|
2143
2284
|
}
|
|
2144
2285
|
};
|
|
2145
|
-
return
|
|
2146
|
-
o = !0,
|
|
2286
|
+
return n.current ? i.current = { ...e } : r(e).then(), () => {
|
|
2287
|
+
o = !0, s.current && s.current.dispose();
|
|
2147
2288
|
};
|
|
2148
|
-
}, [e.flowId, e.componentId]), /* @__PURE__ */
|
|
2289
|
+
}, [e.flowId, e.componentId]), /* @__PURE__ */ R(
|
|
2149
2290
|
"div",
|
|
2150
2291
|
{
|
|
2151
2292
|
style: {
|
|
@@ -2155,14 +2296,14 @@ const ys = (e) => {
|
|
|
2155
2296
|
ref: t
|
|
2156
2297
|
}
|
|
2157
2298
|
);
|
|
2158
|
-
},
|
|
2299
|
+
}, Wt = () => /* @__PURE__ */ R(
|
|
2159
2300
|
"svg",
|
|
2160
2301
|
{
|
|
2161
2302
|
width: "80",
|
|
2162
2303
|
viewBox: "0 0 525 243",
|
|
2163
2304
|
fill: "none",
|
|
2164
2305
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2165
|
-
children: /* @__PURE__ */
|
|
2306
|
+
children: /* @__PURE__ */ R(
|
|
2166
2307
|
"path",
|
|
2167
2308
|
{
|
|
2168
2309
|
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",
|
|
@@ -2170,169 +2311,182 @@ const ys = (e) => {
|
|
|
2170
2311
|
}
|
|
2171
2312
|
)
|
|
2172
2313
|
}
|
|
2173
|
-
),
|
|
2314
|
+
), vn = ({
|
|
2174
2315
|
opacity: e = 1,
|
|
2175
2316
|
fadeDuration: t = 200,
|
|
2176
|
-
children:
|
|
2317
|
+
children: s
|
|
2177
2318
|
}) => {
|
|
2178
|
-
if (
|
|
2319
|
+
if (s !== void 0) {
|
|
2179
2320
|
const i = {
|
|
2180
|
-
...
|
|
2321
|
+
...rn,
|
|
2181
2322
|
opacity: e,
|
|
2182
2323
|
transition: `opacity ${t}ms ease-out`
|
|
2183
2324
|
};
|
|
2184
|
-
return /* @__PURE__ */
|
|
2325
|
+
return /* @__PURE__ */ R("div", { style: i, children: s });
|
|
2185
2326
|
}
|
|
2186
|
-
const
|
|
2187
|
-
...
|
|
2327
|
+
const n = {
|
|
2328
|
+
...nn,
|
|
2188
2329
|
opacity: e,
|
|
2189
2330
|
transition: `opacity ${t}ms ease-out`
|
|
2190
2331
|
};
|
|
2191
|
-
return /* @__PURE__ */
|
|
2192
|
-
},
|
|
2332
|
+
return /* @__PURE__ */ R("div", { style: n, children: /* @__PURE__ */ R(Wt, {}) });
|
|
2333
|
+
}, wn = {
|
|
2193
2334
|
position: "absolute",
|
|
2194
2335
|
top: 0,
|
|
2195
2336
|
left: 0,
|
|
2196
2337
|
right: 0,
|
|
2197
2338
|
bottom: 0
|
|
2198
|
-
},
|
|
2199
|
-
var
|
|
2200
|
-
const t =
|
|
2339
|
+
}, _n = ({ children: e }) => e !== void 0 ? /* @__PURE__ */ R("div", { style: wn, children: e }) : /* @__PURE__ */ R("div", { style: on, children: /* @__PURE__ */ R(Wt, {}) }), Mn = (e) => `on${e.split("-").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("")}`, kn = (e) => {
|
|
2340
|
+
var ce, ee, ve, we, N, $, te;
|
|
2341
|
+
const t = P(null), s = P(null), n = P(!1), i = P(null), o = e.componentId ? En(e.componentId) : !1, [r, c] = se(!o), [l, d] = se(1), [u, h] = se(!1), [m, f] = se(!1), [y, x] = se(void 0), I = e.autoSize ?? !0, [E, C] = se({ fillWidth: !1, fillHeight: !1 }), L = P(!1), D = e.fadeDuration ?? 200, X = Ue(() => {
|
|
2201
2342
|
d(0), setTimeout(() => {
|
|
2202
2343
|
c(!1);
|
|
2203
|
-
},
|
|
2204
|
-
}, [
|
|
2205
|
-
(
|
|
2206
|
-
console.error("[MyopComponent] Error:",
|
|
2344
|
+
}, D);
|
|
2345
|
+
}, [D]), ye = Ue(
|
|
2346
|
+
(M) => {
|
|
2347
|
+
console.error("[MyopComponent] Error:", M), X(), h(!0), e.onError && e.onError(M);
|
|
2207
2348
|
},
|
|
2208
|
-
[
|
|
2349
|
+
[X, e.onError]
|
|
2209
2350
|
);
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
}, [e.componentId]),
|
|
2213
|
-
if (
|
|
2214
|
-
if (!
|
|
2215
|
-
|
|
2351
|
+
le(() => {
|
|
2352
|
+
L.current = !1;
|
|
2353
|
+
}, [e.componentId]), le(() => {
|
|
2354
|
+
if (m && e.data !== void 0 && s.current) {
|
|
2355
|
+
if (!L.current) {
|
|
2356
|
+
L.current = !0;
|
|
2216
2357
|
return;
|
|
2217
2358
|
}
|
|
2218
|
-
const
|
|
2219
|
-
|
|
2359
|
+
const M = s.current.props.myop_init_interface;
|
|
2360
|
+
M && M(e.data);
|
|
2220
2361
|
}
|
|
2221
|
-
}, [e.data,
|
|
2222
|
-
var
|
|
2223
|
-
if (!
|
|
2362
|
+
}, [e.data, m]), le(() => {
|
|
2363
|
+
var z, g, _, H, W, K, T;
|
|
2364
|
+
if (!m || !((z = s.current) != null && z.observeAutoSize))
|
|
2224
2365
|
return;
|
|
2225
|
-
let
|
|
2226
|
-
return
|
|
2227
|
-
|
|
2228
|
-
|
|
2366
|
+
let M = !0;
|
|
2367
|
+
return s.current.observeAutoSize({
|
|
2368
|
+
// SDK resolves: host props → sizeMeta → defaults (width: "100%", height: auto-size)
|
|
2369
|
+
explicitWidth: (g = e.style) == null ? void 0 : g.width,
|
|
2370
|
+
explicitHeight: (_ = e.style) == null ? void 0 : _.height,
|
|
2229
2371
|
minWidth: (H = e.style) == null ? void 0 : H.minWidth,
|
|
2230
|
-
maxWidth: (
|
|
2231
|
-
minHeight: (
|
|
2232
|
-
maxHeight: (
|
|
2233
|
-
forceAutoSize:
|
|
2372
|
+
maxWidth: (W = e.style) == null ? void 0 : W.maxWidth,
|
|
2373
|
+
minHeight: (K = e.style) == null ? void 0 : K.minHeight,
|
|
2374
|
+
maxHeight: (T = e.style) == null ? void 0 : T.maxHeight,
|
|
2375
|
+
forceAutoSize: I,
|
|
2234
2376
|
loaderMinHeight: 50,
|
|
2235
|
-
onSizeChange: (
|
|
2236
|
-
e.onSizeChange && e.onSizeChange(
|
|
2377
|
+
onSizeChange: (J) => {
|
|
2378
|
+
e.onSizeChange && e.onSizeChange(J) === !1 || (x(J), M && (M = !1, X()));
|
|
2237
2379
|
}
|
|
2238
2380
|
});
|
|
2239
|
-
}, [
|
|
2240
|
-
let
|
|
2241
|
-
|
|
2242
|
-
const
|
|
2243
|
-
var
|
|
2244
|
-
|
|
2381
|
+
}, [I, m, e.onSizeChange, (ce = e.style) == null ? void 0 : ce.width, (ee = e.style) == null ? void 0 : ee.height, (ve = e.style) == null ? void 0 : ve.minWidth, (we = e.style) == null ? void 0 : we.maxWidth, (N = e.style) == null ? void 0 : N.minHeight, ($ = e.style) == null ? void 0 : $.maxHeight]), le(() => {
|
|
2382
|
+
let M = !1;
|
|
2383
|
+
n.current = !(t != null && t.current);
|
|
2384
|
+
const z = async (g) => {
|
|
2385
|
+
var _, H, W, K;
|
|
2386
|
+
n.current = !0;
|
|
2245
2387
|
try {
|
|
2246
|
-
if (!
|
|
2247
|
-
|
|
2388
|
+
if (!g.componentId && !g.componentConfig) {
|
|
2389
|
+
ye("No component configuration provided");
|
|
2248
2390
|
return;
|
|
2249
2391
|
}
|
|
2250
|
-
const
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
),
|
|
2255
|
-
|
|
2392
|
+
const T = await bn().fetchComponentV2(
|
|
2393
|
+
g.componentId,
|
|
2394
|
+
g.environment,
|
|
2395
|
+
g.preview
|
|
2396
|
+
), J = await $e.loadComponent(
|
|
2397
|
+
T,
|
|
2256
2398
|
t.current,
|
|
2257
2399
|
{
|
|
2258
|
-
data:
|
|
2400
|
+
data: g.data,
|
|
2259
2401
|
_environment: {
|
|
2260
|
-
props: { ...
|
|
2402
|
+
props: { ...g }
|
|
2261
2403
|
}
|
|
2262
2404
|
}
|
|
2263
2405
|
);
|
|
2264
|
-
if (
|
|
2265
|
-
|
|
2406
|
+
if (M) {
|
|
2407
|
+
J.dispose();
|
|
2266
2408
|
return;
|
|
2267
2409
|
}
|
|
2268
|
-
if (
|
|
2269
|
-
|
|
2410
|
+
if (s.current = J, await s.current.initiated(), M) {
|
|
2411
|
+
s.current && s.current.dispose();
|
|
2270
2412
|
return;
|
|
2271
2413
|
}
|
|
2272
|
-
if (await new Promise((
|
|
2273
|
-
|
|
2414
|
+
if (await new Promise((_e) => requestAnimationFrame(_e)), M || !s.current || s.current.markedForDisposed) {
|
|
2415
|
+
s.current && !s.current.markedForDisposed && s.current.dispose();
|
|
2274
2416
|
return;
|
|
2275
2417
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2418
|
+
f(!0);
|
|
2419
|
+
const O = (_ = s.current) == null ? void 0 : _.sizeMeta, ze = (O == null ? void 0 : O.width) === "100%", We = (O == null ? void 0 : O.height) === "100%";
|
|
2420
|
+
C({ fillWidth: ze, fillHeight: We });
|
|
2421
|
+
const Kt = (ze || ((H = e.style) == null ? void 0 : H.width)) && (We || ((W = e.style) == null ? void 0 : W.height));
|
|
2422
|
+
(!I || Kt) && X(), (K = s.current) != null && K.props && (s.current.props.myop_cta_handler = (_e, Ke) => {
|
|
2423
|
+
e.on && e.on(_e, Ke);
|
|
2424
|
+
const qt = Mn(_e), qe = e[qt];
|
|
2425
|
+
typeof qe == "function" && qe(Ke);
|
|
2426
|
+
}), g.onLoad && s.current && g.onLoad(s.current);
|
|
2427
|
+
} catch (T) {
|
|
2428
|
+
M || ye((T == null ? void 0 : T.message) || "Unknown error");
|
|
2283
2429
|
} finally {
|
|
2284
|
-
if (
|
|
2285
|
-
const
|
|
2286
|
-
i.current = null, await
|
|
2430
|
+
if (n.current = !1, i.current !== null && !M) {
|
|
2431
|
+
const T = i.current;
|
|
2432
|
+
i.current = null, await z(T);
|
|
2287
2433
|
}
|
|
2288
2434
|
}
|
|
2289
2435
|
};
|
|
2290
|
-
return
|
|
2291
|
-
|
|
2436
|
+
return n.current ? i.current = { ...e } : z(e).then(), () => {
|
|
2437
|
+
M = !0, s.current && s.current.dispose();
|
|
2292
2438
|
};
|
|
2293
2439
|
}, [e.componentId]);
|
|
2294
|
-
const
|
|
2440
|
+
const ge = r ? 50 : void 0, ae = !I || !m || E.fillHeight && !((te = e.style) != null && te.height);
|
|
2441
|
+
let Y, Z;
|
|
2442
|
+
return ae ? (Y = {
|
|
2295
2443
|
position: "relative",
|
|
2296
|
-
width:
|
|
2297
|
-
height:
|
|
2298
|
-
minHeight:
|
|
2299
|
-
overflow: U ? "hidden" : "inherit",
|
|
2444
|
+
width: "100%",
|
|
2445
|
+
height: "100%",
|
|
2446
|
+
minHeight: ge,
|
|
2300
2447
|
...e.style
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2448
|
+
}, Z = {
|
|
2449
|
+
position: "absolute",
|
|
2450
|
+
inset: 0
|
|
2451
|
+
}) : (Y = {
|
|
2452
|
+
position: "relative",
|
|
2453
|
+
width: y != null && y.autoSizingWidth ? y.width : "100%",
|
|
2454
|
+
height: (y == null ? void 0 : y.height) ?? void 0,
|
|
2455
|
+
minHeight: ge,
|
|
2456
|
+
...e.style
|
|
2457
|
+
}, Z = {
|
|
2458
|
+
width: "100%",
|
|
2459
|
+
height: (y == null ? void 0 : y.height) ?? void 0
|
|
2460
|
+
}), /* @__PURE__ */ Ut("div", { style: Y, children: [
|
|
2461
|
+
/* @__PURE__ */ R("div", { ref: t, style: Z }),
|
|
2462
|
+
r && e.loader !== void 0 && /* @__PURE__ */ R(vn, { opacity: l, fadeDuration: D, children: e.loader }),
|
|
2463
|
+
u && /* @__PURE__ */ R(_n, { children: e.fallback })
|
|
2310
2464
|
] });
|
|
2311
2465
|
};
|
|
2312
|
-
let
|
|
2313
|
-
const
|
|
2314
|
-
|
|
2315
|
-
},
|
|
2316
|
-
|
|
2317
|
-
},
|
|
2318
|
-
|
|
2319
|
-
},
|
|
2320
|
-
|
|
2321
|
-
},
|
|
2322
|
-
e.map((
|
|
2466
|
+
let G = xe.Main;
|
|
2467
|
+
const bn = () => G, En = (e, t, s) => G.isPreloaded(e, t, s), Ln = (e) => G.getPreloadedParams(e), On = () => {
|
|
2468
|
+
G = new xe("http://localhost:9292");
|
|
2469
|
+
}, Pn = (e) => {
|
|
2470
|
+
G = new xe(e);
|
|
2471
|
+
}, An = (e) => {
|
|
2472
|
+
G = e;
|
|
2473
|
+
}, Fn = (e) => {
|
|
2474
|
+
G.setEnvironment(e);
|
|
2475
|
+
}, Bn = async (e, t, s) => Promise.allSettled(
|
|
2476
|
+
e.map((n) => G.fetchComponentV2(n, t, s))
|
|
2323
2477
|
);
|
|
2324
2478
|
export {
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2479
|
+
kn as MyopComponent,
|
|
2480
|
+
Dn as MyopContainer,
|
|
2481
|
+
_n as MyopFallback,
|
|
2482
|
+
vn as MyopLoader,
|
|
2483
|
+
kn as MyopV2Container,
|
|
2484
|
+
On as enableLocalDev,
|
|
2485
|
+
bn as getCloudRepository,
|
|
2486
|
+
Ln as getPreloadedParams,
|
|
2487
|
+
En as isPreloaded,
|
|
2488
|
+
Bn as preloadComponents,
|
|
2489
|
+
An as setCloudRepository,
|
|
2490
|
+
Pn as setCloudRepositoryUrl,
|
|
2491
|
+
Fn as setEnvironment
|
|
2338
2492
|
};
|