@myop/sdk 0.4.0-beta.3 → 0.4.0-beta.5
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/bundled-declarations.d.ts +43 -2
- package/dist/cjs/_IframeSDK.47f37ec9.min.js +1 -0
- package/dist/cjs/{_IframeSDK.c2e3efb9.js → _IframeSDK.ac4c28cf.js} +87 -7
- package/dist/cjs/_IframeSDK.ac4c28cf.js.map +7 -0
- package/dist/cjs/{_WebComponentSDK.3728ca8b.js → _WebComponentSDK.4085389a.js} +87 -7
- package/dist/cjs/_WebComponentSDK.4085389a.js.map +7 -0
- package/dist/cjs/_WebComponentSDK.4ca43f0a.min.js +1 -0
- package/dist/cjs/_hostSDK.0443afcd.min.js +1 -0
- package/dist/cjs/{_hostSDK.94744d97.js → _hostSDK.46b85afc.js} +87 -7
- package/dist/cjs/_hostSDK.46b85afc.js.map +7 -0
- package/dist/cjs/myop_sdk.js +11 -11
- package/dist/cjs/myop_sdk.js.map +1 -1
- package/dist/cjs/myop_sdk.min.js +1 -1
- package/dist/cjs-bundled/myop_sdk.bundled.js +88 -8
- package/dist/cjs-bundled/myop_sdk.bundled.js.map +2 -2
- package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -1
- package/dist/module/Iframe/index.js +88 -8
- package/dist/module/Iframe/index.js.map +2 -2
- package/dist/module/SDK.js +88 -8
- package/dist/module/SDK.js.map +2 -2
- package/dist/module/embeddedSDK.js +1 -1
- package/dist/module/host/components/myopExtractedWebComponent.d.ts +24 -1
- package/dist/module/host/embeddedSDK.js +1 -1
- package/dist/module/host/index.js +88 -8
- package/dist/module/host/index.js.map +2 -2
- package/dist/module/host/loaders/HTMLComponentLoader.d.ts +19 -1
- package/dist/module/webcomponent/index.js +88 -8
- package/dist/module/webcomponent/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/cjs/_IframeSDK.3faa31eb.min.js +0 -1
- package/dist/cjs/_IframeSDK.c2e3efb9.js.map +0 -7
- package/dist/cjs/_WebComponentSDK.3728ca8b.js.map +0 -7
- package/dist/cjs/_WebComponentSDK.e517f1a4.min.js +0 -1
- package/dist/cjs/_hostSDK.48b3ff7a.min.js +0 -1
- package/dist/cjs/_hostSDK.94744d97.js.map +0 -7
|
@@ -683,7 +683,7 @@ declare module "@myop/sdk/host/componentCore" {
|
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
declare module "@myop/sdk/host/components/myopExtractedWebComponent" {
|
|
686
|
-
import { BaseMyopComponent } from "@myop/sdk/host/components/IMyopComponent";
|
|
686
|
+
import { AutoSizeOptions, BaseMyopComponent } from "@myop/sdk/host/components/IMyopComponent";
|
|
687
687
|
import { BaseMyopMessage } from "@myop/sdk/messages";
|
|
688
688
|
import { CleanupHandler, IComponentDefinitionConfig, ISkinConfig } from "@myop/sdk/common";
|
|
689
689
|
import { loaderOptions } from "@myop/sdk/host/hostSDK";
|
|
@@ -703,6 +703,29 @@ declare module "@myop/sdk/host/components/myopExtractedWebComponent" {
|
|
|
703
703
|
private _ctaQueue;
|
|
704
704
|
private _ctaListener;
|
|
705
705
|
constructor(componentDefinition: IComponentDefinitionConfig, skin: ISkinConfig, container: HTMLElement, customElement: HTMLElement, tagName: string, options?: loaderOptions);
|
|
706
|
+
private _autoSizeOptions?;
|
|
707
|
+
/**
|
|
708
|
+
* Data-out for size — the extracted counterpart of the iframe implementation.
|
|
709
|
+
*
|
|
710
|
+
* THIS EXISTED ONLY ON MyopIframeComponent, and that was invisible for as long as
|
|
711
|
+
* minification was sending every v2 component down the iframe path. Restoring v2
|
|
712
|
+
* detection moves them to this class, and `@myop/react` drives both through one
|
|
713
|
+
* wrapper: in content mode it hides its loader from the FIRST onSizeChange, so a
|
|
714
|
+
* component whose class has no observeAutoSize leaves a React host on a loader
|
|
715
|
+
* forever. Pic-Time's sizeMeta is width:100% with no height, which is exactly content
|
|
716
|
+
* mode. Caught by v2-data-contract D8 (API parity).
|
|
717
|
+
*
|
|
718
|
+
* It REPORTS rather than imposes. An iframe has no intrinsic size and must be
|
|
719
|
+
* measured inside and then set from outside; a custom element sizes itself from its
|
|
720
|
+
* own content, so the honest thing is to measure it and tell the host, and let the
|
|
721
|
+
* host decide. React then uses width:100% and the measured height.
|
|
722
|
+
*
|
|
723
|
+
* The one thing it does impose is `display: block` when the element computes to
|
|
724
|
+
* `inline`, which is the default for a custom element and measures as zero height no
|
|
725
|
+
* matter what it contains. The iframe path forces width:100% for the same reason —
|
|
726
|
+
* without it the first measurement is 0 and the host sizes the component to nothing.
|
|
727
|
+
*/
|
|
728
|
+
observeAutoSize: (options?: AutoSizeOptions) => CleanupHandler;
|
|
706
729
|
cleanupInspect: CleanupHandler;
|
|
707
730
|
inspect(): CleanupHandler;
|
|
708
731
|
hide(): void;
|
|
@@ -2108,7 +2131,25 @@ declare module "@myop/sdk/host/loaders/HTMLComponentLoader" {
|
|
|
2108
2131
|
export class HTMLComponentLoader extends BaseMyopLoader {
|
|
2109
2132
|
type: "HTMLLoader";
|
|
2110
2133
|
/**
|
|
2111
|
-
* Detect if HTML is a Myop Web Component
|
|
2134
|
+
* Detect if HTML is a Myop Web Component.
|
|
2135
|
+
*
|
|
2136
|
+
* THE MARKER COMMENT ALONE IS NOT A SAFE SIGNAL, BECAUSE MINIFIERS DELETE COMMENTS.
|
|
2137
|
+
*
|
|
2138
|
+
* This used to be `startsWith(MYOP_WEB_COMPONENT_MARKER)` and nothing else. The
|
|
2139
|
+
* delivery lane minifies with `removeComments: true` (myop-server derive.ts MIN_CFG),
|
|
2140
|
+
* so the stored `min` artifact of every v2 web component loses its leading
|
|
2141
|
+
* `<!-- myop-web-component -->`. Detection then returned false, the component fell
|
|
2142
|
+
* back to plain iframe rendering, and the whole authored document was shown --
|
|
2143
|
+
* including the v2 authoring wrapper, so Pic-Time's production dashboard displayed the
|
|
2144
|
+
* preview chrome ("Web Component v2", a tag-name badge reading `loading...`, SIZE /
|
|
2145
|
+
* OVERFLOW / BG controls) instead of their component. Reported 2026-10-18; the served
|
|
2146
|
+
* HTML measured 328,071 bytes against 951,130 at origin, with zero `<!--` left in it.
|
|
2147
|
+
*
|
|
2148
|
+
* The script id is the signal that survives, and it is the one `extractWebComponentScript`
|
|
2149
|
+
* already depends on: if that element is present, extraction works, so detection
|
|
2150
|
+
* should agree. Checked with a regex rather than DOMParser -- this runs for every
|
|
2151
|
+
* HTML component, and parsing a 300 KB document to answer a yes/no question is not
|
|
2152
|
+
* worth it.
|
|
2112
2153
|
*/
|
|
2113
2154
|
private isMyopWebComponent;
|
|
2114
2155
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var dn=Object.defineProperty,Zn=Object.defineProperties;var eo=Object.getOwnPropertyDescriptors;var pn=Object.getOwnPropertySymbols;var to=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable;var vt=(o,n,e)=>n in o?dn(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,h=(o,n)=>{for(var e in n||(n={}))to.call(n,e)&&vt(o,e,n[e]);if(pn)for(var e of pn(n))no.call(n,e)&&vt(o,e,n[e]);return o},z=(o,n)=>Zn(o,eo(n));var oo=(o,n)=>{for(var e in n)dn(o,e,{get:n[e],enumerable:!0})};var r=(o,n,e)=>vt(o,typeof n!="symbol"?n+"":n,e);var ue=class{constructor(n,e,t,i,s){this.myopId=n;this.htmlTagName=e;this.BoundingRect=t;this.offsetTop=i;this.offsetLeft=s;r(this,"type","MyopElementRef")}};var cn=async o=>{if(typeof o=="function")o();else if(o instanceof Promise){let n=await o;typeof n=="function"&&n()}},M=class{constructor(n){this.messageToHost=n}},Fe=class extends M{constructor(e,t){super(e);this.messageToHost=e;this.context=t}};var y={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 We={};oo(We,{AddEventListenerMessage:()=>Ht,BaseMyopMessage:()=>b,BindClickMessage:()=>_t,ChangeTextMessage:()=>Rt,CleanupMessage:()=>_e,CleanupReplayMessage:()=>Re,ClickReplayMessage:()=>Q,CreateRefComponentMessage:()=>Se,CustomRefMessage:()=>X,DetectMyopRefsMessage:()=>Lt,DetectedMyopRefsMessage:()=>oe,DisposeMessage:()=>He,ElementValueReplayMessage:()=>ee,EnvelopedMessage:()=>ve,EventListenerCallbackMessage:()=>Z,ExecuteComponentMethod:()=>O,ExecuteScriptMessage:()=>B,ExecuteScriptReplyMessage:()=>J,GetAttributeMessage:()=>Pt,GetAttributeReplayMessage:()=>Ee,GetElementValueMessage:()=>Dt,InitMessage:()=>te,InitRequest:()=>ne,InitResponse:()=>xe,MessageDirection:()=>S,MutationObserverMessage:()=>Te,MyopBindMessage:()=>E,MyopBindReplayMessage:()=>v,MyopElementMessage:()=>Tt,Ref:()=>j,RefComponentCreatedMessage:()=>N,ResizeObserverMessage:()=>De,SetAttributeMessage:()=>kt,SetInnerHtml:()=>Bt,SetMutationObserverMessage:()=>Ot,SetResizeObserverMessage:()=>ke,stripFunction:()=>fn});var D=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+o/4).toString(16));var so=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("-")};var io=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))};var Et=o=>{let n=io(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(so(n.slice(t,t+16)));return e};var ln=o=>new Promise(n=>setTimeout(n,o));var S=class{};r(S,"down","down"),r(S,"up","up");var b=class{constructor(){r(this,"id",D());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}},Tt=class extends b{constructor(e){super();this.ref=e}},v=class extends b{constructor(e){super();this.replayToHandler=e}},E=class extends b{constructor(e){super();this.handler=e;r(this,"handlerUniqueId",D())}},j=class o{constructor(n,e){this.refConfig=n;this.component=e;r(this,"myop",!0);r(this,"__nonProxied");this.__nonProxied=z(h({},this),{component:null})}static create(n,e,t){let i=e;return i||(i={id:"",name:"",description:"",selectorType:"id-attribute",selector:n,behavior:{type:"code"}}),new o(i,t)}};var mn="ClickReplayMessage",_t=class extends E{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",mn);r(this,"messageType","BindClickMessage");r(this,"cleanable",!0)}},Q=class extends v{constructor(){super(...arguments);r(this,"messageType",mn)}};var Rt=class extends b{constructor(e,t){super();this.ref=e;r(this,"messageType","ChangeTextMessage");this.content=t}};var un="ExecuteScriptReplyMessage",ro=/(?:function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*?)\}|(\([^)]*\)\s*=>\s*\{([\s\S]*?)\}))\s*$/,ao=/\(\s*[^)]+\s*\)\s*=>\s*(.+)/,fn=o=>{let n=o.match(ro);if(n)return n[1]||n[3];{let e=o.match(ao);if(e)return e[1].trim()}},B=class extends E{constructor(e,t=()=>{},i){super(t);this.scriptInputs=i;r(this,"replyMessageKey",un);r(this,"messageType","ExecuteScriptMessage");r(this,"script","");this.script=e.toString(),this.content=e.toString(),this.content=fn(this.content)}};r(B,"replierKey","send"),r(B,"completeStreamKey","completeStream");var J=class extends v{constructor(e,t){super(e);this.replayToHandler=e;this.content=t;r(this,"messageType",un)}};var X=class extends B{constructor(e,t,i=()=>{}){super(({rootRef:s,elementId:a,_script:p,__scriptInputs:d})=>{let c=(s.shadowRoot||s.container).querySelectorAll("[myop-id='".concat(a,"']"));return c.length?(d.ref=c[0],new Function("return (".concat(p,")(...arguments)"))(d)):null},i);this.scriptInputs=t;this.scriptInputs=z(h({},t),{_script:e.toString()})}};var gn="EventListenerCallbackMessage",Ht=class extends E{constructor(e,t,i){super(i);this.ref=e;this.type=t;this.handler=i;r(this,"replyMessageKey",gn);r(this,"messageType","AddEventListenerMessage");r(this,"cleanable",!0);r(this,"serializableSkeleton",!1)}withSerializableSkeleton(e){return this.serializableSkeleton=e,this}},Z=class extends v{constructor(e,t){super(e);this.replayToHandler=e;this.e=t;r(this,"messageType",gn);this.content={e:t}}};var kt=class extends b{constructor(e,t,i){super();this.ref=e;this.name=t;this.value=i;r(this,"messageType","SetAttributeMessage")}};var yn="ElementValueReplayMessage",Dt=class extends E{constructor(e,t){super(t);this.ref=e;r(this,"replyMessageKey",yn);r(this,"messageType","GetElementValueMessage")}},ee=class extends v{constructor(e){super();this.content=e;r(this,"messageType",yn)}};var Bt=class extends b{constructor(e,t){super();this.ref=e;r(this,"messageType","SetInnerHtml");this.content=t}};var te=class extends b{constructor(e){super();r(this,"messageType","InitMessage");this.content={id:e}}isTypeof(e){return e.messageType===this.messageType}},xe=class extends te{constructor(){super(...arguments);r(this,"messageType","InitResponse")}},ne=class extends b{constructor(){super(...arguments);r(this,"messageType","InitRequest")}};var hn="RefComponentCreatedMessage",Se=class extends E{constructor(e,t,i,s){super(s);this.refConfig=e;this.nestedComponentConfig=t;this.options=i;r(this,"replyMessageKey",hn);r(this,"messageType","CreateRefComponentMessage")}},N=class extends v{constructor(e,t,i){super(e);this.replayToHandler=e;this.nestedRefs=t;this.failed=i;r(this,"messageType",hn)}};var ve=class extends b{constructor(e,t){super();this.destination=e;this.message=t;r(this,"messageType","EnvelopedMessage");let i=t;this.route=[e,...i.route?i.route:[]]}};var Mn="DetectedMyopRefsMessage",Lt=class extends E{constructor(){super(...arguments);r(this,"messageType","DetectMyopRefsMessage");r(this,"replyMessageKey",Mn)}},oe=class extends v{constructor(e,t){super(e);this.replayToHandler=e;r(this,"messageType",Mn);this.content=t}isTypeof(e){return e.messageType===this.messageType}};var bn="GetAttributeReplayMessage",Pt=class extends E{constructor(e,t,i){super(i);this.ref=e;this.name=t;r(this,"replyMessageKey",bn);r(this,"messageType","GetAttributeMessage")}},Ee=class extends v{constructor(e){super();this.content=e;r(this,"messageType",bn)}};var O=class extends b{constructor(e){super();this.method=e;r(this,"messageType","ExecuteComponentMethod")}};var Ot=class extends b{constructor(){super(...arguments);r(this,"messageType","SetMutationObserverMessage")}},Te=class extends b{constructor(){super(...arguments);r(this,"messageType","MutationObserverMessage")}};var Cn="CleanupReplayMessage",_e=class extends E{constructor(e,t){super(t);this.cleanupForMessageId=e;r(this,"replyMessageKey",Cn);r(this,"messageType","CleanupMessage")}},Re=class extends v{constructor(e){super();this.customCleanup=e;r(this,"messageType",Cn)}};var He=class extends b{constructor(){super(...arguments);r(this,"messageType","DisposeMessage")}};var ke=class extends b{constructor(){super(...arguments);r(this,"cleanable",!0);r(this,"messageType","SetResizeObserverMessage")}},De=class extends b{constructor(){super(...arguments);r(this,"messageType","ResizeObserverMessage")}};var zt=class{constructor(n,e){this.id=n;this.context=e;r(this,"send",n=>{})}},fe=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!==S.down)return;if(t.messageType===y.DisposeMessage){t.destination&&delete this.components[t.destination];return}if(t.messageType===y.InitMessage){let i=t.content.id;if(this.components[i])return;this.components[i]=new zt(i),this.messageToHost(new xe(i));return}if(t.messageType===y.EnvelopedMessage){let i=t,s=i.message;if(t=s,this.alwaysPassEnvelopesToHost||this.components[t.destination]){let a=myop.hostSDK.components.find(d=>d.id===s.destination);if(a){a.send(s);return}let p=myop.hostSDK.components.find(d=>d.id===i.destination);if(p){p.send(s);return}}else return}if(t.messageType){if(t.messageType===y.CleanupMessage){let s=t,a=this.messageCleanupCache[s.cleanupForMessageId],p=new Re(!!a);p.destination=t.destination,a?(delete this.messageCleanupCache[s.cleanupForMessageId],cn(a).then(()=>{this.messageToHost(p,s)}).catch(()=>{})):this.messageToHost(p,s);return}let i=!1;this.supportedHandlers.forEach(s=>{if(s.messageType===t.messageType){i=!0;let a=s.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(s.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(s.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 U={IframeLoader:"IframeLoader",WebComponentLoader:"WebComponentLoader",HTMLLoader:"HTMLLoader",MinimizedLoader:"MinimizedLoader"};var se={open:"open",closed:"closed",none:"none",localFrame:"localFrame"};var he={message:"message",code:"code"},ge=class{};r(ge,"code","code"),r(ge,"component","component");var ie={Segmented:"Segmented",Dedicated:"Dedicated",Default:"Default"},Ke={Segment:"Segment",Promo:"Promo",AB:"AB"},ye=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 H={id:"myop-id"};var Ne=class extends M{constructor(){super(...arguments);r(this,"messageType",y.DetectMyopRefsMessage);r(this,"executor",e=>{let t=document.querySelectorAll("[".concat(H.id,"]")),i=[];t.forEach(s=>{let a=s.getAttribute(H.id);a&&i.push(new ue(a,s.tagName,s.getBoundingClientRect()))}),this.messageToHost(new oe(e.handlerUniqueId,i))})}};var w=(o,n)=>n.querySelectorAll("[".concat(H.id,"='").concat(o.refConfig.selector,"']")),wn=(o,n)=>{let e=w(o,n);return e.length?e.item(0):null};var Ue=class extends M{constructor(){super(...arguments);r(this,"messageType",y.BindClickMessage);r(this,"executor",e=>{let t=[];return w(e.ref,document).forEach(s=>{let a=()=>{this.messageToHost(new Q,e)};s.addEventListener("click",a);let p=()=>{s.removeEventListener("click",a)};t.push(p)}),()=>{t.forEach(s=>s())}})}};var qe=class extends M{constructor(){super(...arguments);r(this,"messageType",y.ChangeTextMessage);r(this,"executor",e=>{w(e.ref,document).forEach(i=>{i.textContent=e.content})})}};var At=o=>o!==Object(o),po=o=>typeof o=="function",$t=o=>{if(At(o))return!0;if(po(o)||Object.getPrototypeOf(o))return!1;for(let n in o){let e=o[n];if(typeof e=="object"){if(!$t(e))return!1}else{if(At(e))continue;return!1}}return!0},L=(o,n={},e=!0,t=new WeakMap)=>{if(At(o))return o;if(Array.isArray(o)){if(t.has(o))return t.get(o);let i=[];t.set(o,i);for(let s=0;s<o.length;s++){let a=o[s];i[s]=L(a,n,e,t)}return i}if(o!==null&&typeof o=="object"){if(t.has(o))return t.get(o);let i={};t.set(o,i);for(let s in o){let a=typeof n=="boolean"?n:n[s];a&&(a===!0?(e?o[s]!==void 0:o[s])&&(i[s]=L(o[s],!0,e,t)):typeof a=="object"&&(i[s]=L(o[s],a,e,t)))}return i}return{}};var Ve=(o,n,e)=>{let t=o.scriptInputs?o.scriptInputs:{};t.makeSerializable=L,t.send=n,t.rootRef=e,t.__scriptInputs=t;let s=new Function("return (".concat(o.script,")(...arguments)"))(t);n(s)};var je=class extends M{constructor(){super(...arguments);r(this,"messageType",y.ExecuteScriptMessage);r(this,"executor",e=>{Ve(e,i=>{this.messageToHost(new J(e.handlerUniqueId,i))},new ye(document.documentElement))})}};var Ge="__federation__",In="onLoad";var Me=(o,n)=>{window[Ge]&&window[Ge][o]&&window[Ge][o][In]&&window[Ge][o][In]({[o]:n})};var Ye=class extends M{constructor(){super(...arguments);r(this,"messageType",y.AddEventListenerMessage);r(this,"executor",e=>{let t=w(e.ref,document),i=[];return t.forEach(s=>{let a=p=>{requestAnimationFrame(()=>{this.messageToHost(new Z(e.handlerUniqueId,L(p,e.serializableSkeleton)))})};s.addEventListener(e.type,a),i.push(()=>{s.removeEventListener(e.type,a)})}),()=>{i.forEach(s=>{s()})}})}};var Qe=class extends M{constructor(){super(...arguments);r(this,"messageType",y.SetAttributeMessage);r(this,"executor",e=>{w(e.ref,document).forEach(i=>{i.setAttribute(e.name,e.value)})})}};var F=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 i=this.messageHandlers[n],s=a=>e(a)?(t(a),!0):!1;return i.push(s),()=>{let a=i.indexOf(s);a>-1&&i.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)||W.Instance().assignId(n);let i=t!=null&&t.timeout?t==null?void 0:t.timeout:5*1e3;setTimeout(()=>{!this.isInitiated&&this._whenInitiatedReject&&!this._markedForDisposed&&(this._whenInitiatedReject("timeout_".concat(i," ").concat(this.id)),this.dispose())},i),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===y.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(i=>{t=t||i(n)}),t}return!1}sendCleanupMessage(n){n.source=this.id,n.destination=this.id,n.direction=S.down;let e=this.bindWhen(n.replyMessageKey,i=>i.replayToHandler===n.handlerUniqueId,i=>{n.handler(i),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=S.down;let e;if(n.handler){let t=n;e=this.bindWhen(t.replyMessageKey,i=>i.replayToHandler===t.handlerUniqueId,t.handler),delete n.handler}return n.ref&&(n.ref=n.ref.__nonProxied||n.ref),n.cleanable?()=>{this.sendCleanupMessage(new _e(n.id,t=>{})),e&&e()}:()=>{}}runDisposeHandlers(){let n=this.messageHandlers.onDispose;n&&n.forEach(e=>{e(null)})}dispose(){if(this.markedForDisposed=!0,!this.isInitiated){this.runDisposeHandlers(),this.messageHandlers={},this.id+="_disposed";return}console.log("disposing component",this.id),this.send(new He),this.runDisposeHandlers(),this.messageHandlers={},this.id+="_disposed",this.isInitiated=!1}};var xn={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 Be=class extends F{constructor(e,t,i){super(e,t.container,i);this.componentDefinition=e;this.parent=t;r(this,"send",e=>{let t=e.handler,i=super.send(e);return this.parent.send(new ve(this.id,e)),e.handler=t,i});r(this,"dispose",()=>{this.isInitiated&&this.send(new O("dispose")),super.dispose()})}hide(){this.send(new O("hide"))}show(){this.send(new O("show"))}inspect(){return this.send(new O("inspect"))}setHeightBasedOnDocumentElement(){this.send(new O("setHeightBasedOnDocumentElement"))}setHeightBasedOnScrollHeight(){this.send(new O("setHeightBasedOnScrollHeight"))}onMessageReceived(e){return super.onMessageReceived(e)}};var re=class extends F{constructor(e,t,i,s,a,p){super(e,i,p);this.container=i;this.customElement=s;this.tagName=a;r(this,"ctaCleanup");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"_ctaListener",e=>{let t=e.detail;t!=null&&t.action&&(this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(t.action,t.payload):this._ctaHandler||this._ctaQueue.push({action:t.action,payload:t.payload}))});r(this,"_autoSizeOptions");r(this,"observeAutoSize",e=>{this._autoSizeOptions=e;let t=this.customElement;try{getComputedStyle(t).display==="inline"&&(t.style.display="block")}catch(d){}let i=d=>{if(d===void 0)return;if(typeof d=="number")return d;let c=parseFloat(d);return isNaN(c)?void 0:c},s=(d,c,m)=>c!==void 0&&d<c?c:m!==void 0&&d>m?m:d,a=()=>{var u;let d=this._autoSizeOptions,c=t.getBoundingClientRect(),m=(d==null?void 0:d.explicitHeight)===void 0;(u=d==null?void 0:d.onSizeChange)==null||u.call(d,{width:c.width,height:m?s(c.height,i(d==null?void 0:d.minHeight),i(d==null?void 0:d.maxHeight)):c.height,autoSizingWidth:!1,autoSizingHeight:m})},p;try{p=new ResizeObserver(()=>a()),p.observe(t)}catch(d){}return a(),()=>{p==null||p.disconnect(),this._autoSizeOptions=void 0}});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=s,this.customElement.addEventListener("myop-cta",this._ctaListener),this.ctaCleanup=()=>this.customElement.removeEventListener("myop-cta",this._ctaListener),this.setInitiated()}inspect(){return this.cleanupInspect=be(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._ctaHandler=e,this._ctaQueue.length>0){let t=[...this._ctaQueue];this._ctaQueue=[],t.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}}};var co=(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},be=(o,n,e,t,i,s)=>{let a=co("".concat(s.name," : ").concat(n),e,s);return t.insertBefore(a,i),i.style.border="1px solid #007BFF",i.style.display="block",()=>{i.style.border="unset",t.removeChild(a)}},Sn=(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),vn=(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."))},En=(o,n,e)=>{let t=n.reduce((s,a)=>z(h({},s),{[a.name]:h({},a)}),{}),i={get:(s,a)=>{let p=t[a];if(Sn(p,a,o))return!1;if(p.behavior.type===he.code){if(o instanceof re)return(p.behavior.remap||a)==="myop_init_interface"?m=>{if(m===void 0)return o.getData();o.initWithData(m)}:void 0;if(o instanceof q&&o.isolated)return(p.behavior.remap||a)==="myop_init_interface"?m=>{if(m===void 0)return o.getData();o.initWithData(m)}:void 0;if(e.loader.type===U.HTMLLoader&&e.loader.shadowRootMode===se.localFrame){let c=p.behavior;return o.element.contentWindow[c.remap||a]}return vn(p,a,o),!1}return p.mode==="output"?new Promise(d=>{let c=[];p.behavior.ref&&c.push(j.create(p.behavior.ref)),c.push(u=>{d(u)}),p.behavior.params&&c.push(...p.behavior.params);let m=We[p.behavior.message];o.send(new m(...c))}):null},set:(s,a,p)=>{let d=t[a];if(Sn(d,a,o))return!1;if(d.behavior.type===he.code){if(o instanceof re){let m=d.behavior.remap||a;if(m==="myop_cta_handler")return o.setCtaHandler(p),!0;if(m==="myop_init_interface")return o.initWithData(p),!0}if(o instanceof q&&o.isolated){let m=d.behavior.remap||a;if(m==="myop_cta_handler")return o.setCtaHandler(p),!0;if(m==="myop_init_interface")return o.initWithData(p),!0}if(e.loader.type===U.HTMLLoader&&e.loader.shadowRootMode===se.localFrame){let m=d.behavior,u=o.element.contentWindow,f=m.remap||a;if(u[f]=p,f==="myop_cta_handler"&&u.__myop_cta_queue){let g=u.__myop_cta_queue;u.__myop_cta_queue=null,g.forEach(l=>{o.markedForDisposed||p(l.action,l.payload)})}return!0}return vn(d,a,o),!1}else if(d.mode==="input")if(d.behavior.type==="message"){let c=[];d.behavior.ref&&c.push(j.create(d.behavior.ref)),c.push(p),d.behavior.params&&c.push(...d.behavior.params);let m=We[d.behavior.message];return o.send(new m(...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,i),o},lo=(o,n)=>new Proxy(o,{get(e,t){return e[t]?e[t]:(...s)=>new Promise(a=>{s.forEach(p=>{$t(p)||xn.notSerializableRefCall(t,p)}),n.send(new X(({ref:p,propName:d,functionArgs:c,makeSerializable:m})=>{if(p){let u=p[d];return m(typeof u=="function"?p[d](...c):u,!0)}return null},{elementId:e.refConfig.selector,propName:t,functionArgs:s},p=>{a(p.content)}))})},set(e,t,i){return n.send(new X(({ref:s,propName:a,propValue:p})=>{s&&(s[a]=p)},{elementId:e.refConfig.selector,propValue:i,propName:t},s=>{})),!0}}),Ft=async(o,n,e,t)=>{let i=o.component;if(!i)throw new Error("cant createRefComponent with detached ref");return new Promise(async(s,a)=>{let p=new Be(n.type,i,t);e.push(p);let d=()=>{let m=e.indexOf(p);m!==-1&&e.splice(m,1)};await i.initiated();let c=setTimeout(()=>{d(),a("timeout")},5e3);i.send(new Se(o.refConfig,n,z(h({},t||{}),{id:p.id,_hasParent:!0}),async m=>{if(clearTimeout(c),m.failed){d(),a("CreateRefComponentMessage failed");return}let u=e.find(f=>f.id==p.id);if(u&&u!==p){d(),i.refs[o.refConfig.name]=u,s(u);return}else p.setInitiated(),i.refs[o.refConfig.name]=p;m.nestedRefs.forEach(f=>{let g=n.instance.resolvedNestedComponents.find(R=>R.type.id===f.componentDefinitionId).type,l=new Be(g,p);l.setInitiated(),p.refs[f.refName]=l,e.push(l)});try{await Wt(p,n,e,!0),i.setHeightBasedOnScrollHeight&&i.setHeightBasedOnScrollHeight(),s(p)}catch(f){a(f)}}))})},Wt=async(o,n,e,t=!1)=>{o.refs||(o.refs={});let i=Object.values(o.componentDefinition.refs).map(s=>new Promise(async(a,p)=>{var d;if(s.behavior.type==ge.component){if(t){a();return}let c=s.behavior.componentId;c||(c=s.behavior.instance.componentId);let m=(d=n.instance.resolvedNestedComponents)==null?void 0:d.find(f=>f.type.id===c);if(!m)throw new Error("componentConfig provided without nestedComponentConfig check the config object");let u=j.create("",s,o);try{let f=await Ft(u,m,e);o.refs[s.name]=f,a()}catch(f){p(f)}}else try{let c=j.create("",s,o);o.refs[s.name]=lo(c,o),a()}catch(c){}}));try{await Promise.all(i)}catch(s){throw s}};var q=class extends F{constructor(e,t,i,s,a){super(e,i,a);this.componentConfig=e;this.container=i;this.IframeElement=s;r(this,"_autoSizeCleanup");r(this,"_autoSizeOptions");r(this,"_autoSizeUpdate");r(this,"isolated",!1);r(this,"_lastData");r(this,"_ctaHandler");r(this,"_ctaQueue",[]);r(this,"_isoMsgHandler");r(this,"_isoSizeOpts");r(this,"_isoAutoSize",!1);r(this,"_isoLastSize");r(this,"sizeMeta");r(this,"cleanupInspect");r(this,"setHeightBasedOnDocumentElement",()=>{let e=this.send(new B(()=>window.document.documentElement.scrollHeight,t=>{this.IframeElement.style.height="".concat(t.content,"px"),e()}))});r(this,"observeSizeBasedOnDocumentElement",()=>this.send(new B(({send:t})=>{let{height:i,width:s}=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:i,width:s}},t=>{this.IframeElement.style.width="".concat(t.content.width,"px"),this.IframeElement.style.height="".concat(t.content.height,"px")})));r(this,"observeAutoSize",e=>{if(this._autoSizeOptions=e,this.isolated)return this._isoSizeOpts=e,this._isoAutoSize=!0,this._isoLastSize&&this._applyIsoSize(this._isoLastSize.height,this._isoLastSize.width),()=>{this._isoAutoSize=!1,this._isoSizeOpts=void 0};if(this._autoSizeCleanup&&this._autoSizeUpdate)return this._autoSizeUpdate(),this._autoSizeCleanup;let t=this.IframeElement,i=t.contentDocument;if(!i)return this.observeHeightViaBridge();let s=(g,l,R)=>l!==void 0&&g<l?l:R!==void 0&&g>R?R:g,a=g=>{if(g===void 0)return;if(typeof g=="number")return g;let l=parseFloat(g);return isNaN(l)?void 0:l},p=()=>{var Jt,Xt,Zt,en,tn,nn,on,sn;let g=t.contentDocument;if(!g)return;let l=this._autoSizeOptions,R=a(l==null?void 0:l.minWidth),k=a(l==null?void 0:l.maxWidth),V=a(l==null?void 0:l.minHeight),T=a(l==null?void 0:l.maxHeight),pe=(Jt=l==null?void 0:l.loaderMinHeight)!=null?Jt:50,Y=((Xt=this.sizeMeta)==null?void 0:Xt.width)==="100%"?"100%":void 0,P=((Zt=this.sizeMeta)==null?void 0:Zt.height)==="100%"?"100%":void 0,I=(tn=(en=l==null?void 0:l.explicitWidth)!=null?en:Y)!=null?tn:"100%",C=(nn=l==null?void 0:l.explicitHeight)!=null?nn:P,_=I!==void 0,de=C!==void 0,ce=this.container.getBoundingClientRect(),Nn=ce.width===0,Un=ce.height===0||ce.height===pe,le=(l!=null&&l.forceAutoSize||Nn)&&!_,me=(l!=null&&l.forceAutoSize||Un)&&!de;if(!le&&!me){t.style.width=typeof I=="number"?"".concat(I,"px"):"100%",t.style.height=typeof C=="number"?"".concat(C,"px"):"100%",(on=l==null?void 0:l.onSizeChange)==null||on.call(l,{width:typeof I=="number"?I:void 0,height:typeof C=="number"?C:void 0,autoSizingWidth:!1,autoSizingHeight:!1});return}let qn=t.style.transition,K=this.container,Vn=K.style.transition;t.style.transition="none",K.style.transition="none";let qt=t.getBoundingClientRect().height,Vt=t.getBoundingClientRect().width,jt=Math.ceil(Math.max(g.documentElement.scrollHeight,g.body.scrollHeight,g.body.getBoundingClientRect().height)),Gt=Math.ceil(Math.max(g.documentElement.scrollWidth,g.body.scrollWidth,g.body.getBoundingClientRect().width)),we=Gt,Ie=jt,jn=me&&jt>qt+1,Gn=le&&Gt>Vt+1,ze=me&&!jn,Ae=le&&!Gn;if(ze||Ae){let Jn=K.style.minHeight,Xn=K.style.minWidth;ze&&(K.style.minHeight="".concat(qt,"px")),Ae&&(K.style.minWidth="".concat(Vt,"px")),ze&&(t.style.height="0px"),Ae&&(t.style.width="0px"),we=Math.ceil(Math.max(g.documentElement.scrollWidth,g.body.scrollWidth,g.body.getBoundingClientRect().width)),Ie=Math.ceil(Math.max(g.documentElement.scrollHeight,g.body.scrollHeight,g.body.getBoundingClientRect().height));let rn=ze&&Ie<2,an=Ae&&we<2;if(rn||an){let $e=g.createElement("style");$e.id="__myop_measure";let St=[];rn&&St.push("height: auto !important","min-height: 0 !important","max-height: none !important"),an&&St.push("width: auto !important","min-width: 0 !important","max-width: none !important"),$e.textContent="*, *::before, *::after { ".concat(St.join("; "),"; flex-basis: auto !important; flex-grow: 0 !important; }"),g.head.appendChild($e),we=Math.ceil(Math.max(g.documentElement.scrollWidth,g.body.scrollWidth,g.body.getBoundingClientRect().width)),Ie=Math.ceil(Math.max(g.documentElement.scrollHeight,g.body.scrollHeight,g.body.getBoundingClientRect().height)),$e.remove()}K.style.minHeight=Jn,K.style.minWidth=Xn}let Yt=s(we,R,k),Qt=s(Ie,V,T);le?t.style.width="".concat(Yt,"px"):t.style.width=typeof I=="number"?"".concat(I,"px"):"100%",me?t.style.height="".concat(Qt,"px"):t.style.height=typeof C=="number"?"".concat(C,"px"):"100%",t.offsetHeight,t.style.transition=qn,K.style.transition=Vn;let Yn=le&&k!==void 0&&we>k,Qn=me&&T!==void 0&&Ie>T;g.documentElement.style.overflowX=Yn?"auto":"",g.documentElement.style.overflowY=Qn?"auto":"",(sn=l==null?void 0:l.onSizeChange)==null||sn.call(l,{width:Yt,height:Qt,autoSizingWidth:le,autoSizingHeight:me})};p(),this._autoSizeUpdate=p;let d,c=()=>{d===void 0&&(d=requestAnimationFrame(()=>{d=void 0,p()}))},m=new ResizeObserver(()=>c());m.observe(i.body),m.observe(i.documentElement);let u=new MutationObserver(()=>c());u.observe(i.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let f=()=>{m.disconnect(),u.disconnect(),d!==void 0&&(cancelAnimationFrame(d),d=void 0),this._autoSizeUpdate=void 0,this._autoSizeCleanup=void 0};return this._autoSizeCleanup=f,f});r(this,"_bridgeSizeCleanup");r(this,"observeHeightViaBridge",()=>{if(this._bridgeSizeCleanup)return this._bridgeSizeCleanup;let e,t=!1,i=()=>{t=!0,e==null||e(),this._bridgeSizeCleanup=void 0};return this._bridgeSizeCleanup=i,this.initiated().then(()=>{t||this.markedForDisposed||(this.IframeElement.style.position="relative",this.IframeElement.style.inset="auto",this.IframeElement.style.width="100%",this.setHeightBasedOnScrollHeight(),e=this.send(new ke))}).catch(s=>{console.warn("[MyopIframeComponent] auto-height skipped for ".concat(this.id,": ").concat(s))}),i});r(this,"setSizeBasedOnDocumentElement",()=>{let e=this.send(new B(()=>{let{height:t,width:i}=document.documentElement.getBoundingClientRect();return{height:t,width:i}},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 B(()=>{let i=0;return i++,i--,Math.max(Math.max(window.document.body.clientHeight,window.document.body.scrollHeight),window.document.body.offsetHeight)+i+"px"},t=>{this.IframeElement.style.height=t.content,e()}))});r(this,"send",e=>{var s,a;let t=h({},e);if(t.messageType===y.ExecuteComponentMethod)return this[t.method](),()=>{};t.direction=S.down;let i=super.send(t);return(a=(s=this.IframeElement)==null?void 0:s.contentWindow)==null||a.postMessage(t,"*"),i});r(this,"dispose",()=>{var e,t;(e=this._bridgeSizeCleanup)==null||e.call(this),this._autoSizeCleanup&&(this._autoSizeCleanup(),this._autoSizeCleanup=void 0),this._isoMsgHandler&&(window.removeEventListener("message",this._isoMsgHandler),this._isoMsgHandler=void 0),this.cleanupInspect&&this.cleanupInspect(),super.dispose(),(t=this.IframeElement.parentNode)==null||t.removeChild(this.IframeElement)});this.element=this.IframeElement,this._lastData=a==null?void 0:a.data}enableIsolation(){this.isolated=!0,this.setInitiated(),this._isoMsgHandler=e=>{if(e.source!==this.IframeElement.contentWindow)return;let t=e.data;!t||t.__myop!==!0||(t.type==="myop:cta"?this._ctaHandler&&!this.markedForDisposed?this._ctaHandler(t.action,t.payload):this._ctaHandler||this._ctaQueue.push({action:t.action,payload:t.payload}):t.type==="myop:size"&&this._applyIsoSize(t.height,t.width))},window.addEventListener("message",this._isoMsgHandler)}initWithData(e){var t,i;this._lastData=e,(i=(t=this.IframeElement)==null?void 0:t.contentWindow)==null||i.postMessage({__myop:!0,type:"myop:init",data:e},"*")}getData(){return this._lastData}setCtaHandler(e){if(this._ctaHandler=e,this._ctaQueue.length>0){let t=[...this._ctaQueue];this._ctaQueue=[],t.forEach(i=>{this.markedForDisposed||e(i.action,i.payload)})}}_applyIsoSize(e,t){var c;if(!e||Number.isNaN(e)||(this._isoLastSize={height:e,width:t},!this._isoAutoSize))return;let i=this._isoSizeOpts,s=m=>m===void 0?void 0:typeof m=="number"?m:isNaN(parseFloat(m))?void 0:parseFloat(m),a=s(i==null?void 0:i.minHeight),p=s(i==null?void 0:i.maxHeight),d=e;a!==void 0&&d<a&&(d=a),p!==void 0&&d>p&&(d=p),this.IframeElement.style.position="relative",this.IframeElement.style.inset="auto",this.IframeElement.style.height=d+"px",this.IframeElement.style.width="100%",(c=i==null?void 0:i.onSizeChange)==null||c.call(i,{width:t!=null?t:this.IframeElement.clientWidth,height:d,autoSizingWidth:!1,autoSizingHeight:!0})}inspect(){return this.cleanupInspect?this.cleanupInspect:(this.cleanupInspect=be(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===y.In.MutationObserverMessage||e.messageType===y.In.ResizeObserverMessage?(this.setHeightBasedOnScrollHeight(),!0):super.onMessageReceived(e)}};var G=class{constructor(){r(this,"appendChild",(n,e,t)=>{var i;if(t!=null&&t.relative){if(t.relative.direction==="before")return n.insertBefore(e,t.relative.child);if(t.relative.direction==="after"){let s=(i=t.relative.child)==null?void 0:i.nextSibling;return n.insertBefore(e,s||null)}}else return n.appendChild(e)})}};var mo=(o,n,e)=>{let t=new URL(o);return t.searchParams.append(n,e),t.toString()},Je=class extends G{constructor(){super(...arguments);r(this,"type",U.IframeLoader);r(this,"load",async(e,t,i,s)=>{let a,p=t.loader;if((i==null?void 0:i.nodeName)==="IFRAME")console.log("needs to load into an exsisting Iframe...",p.url,i),a=i,a.src=p.url;else{let c=D(),m="myop-comp-".concat(c);a=document.createElement("iframe"),a.id=m;let u="\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(s!=null&&s.hidden?"0":"1",";\n pointer-events: ").concat(s!=null&&s.hidden?"none":"all",";\n ");a.style.cssText=u,s!=null&&s.elementAttributes&&Object.entries(s.elementAttributes).forEach(([g,l])=>{l===""||l===null||l===void 0?a.setAttribute(g,""):a.setAttribute(g,String(l))});let f=t.loader.url;s!=null&&s._hasParent&&(f=mo(f,"_myop-comp",c)),a.src=f,i.querySelector('[id^="myop-comp-"]')||(i.innerHTML=""),a=this.appendChild(i,a,s)}let d=new q(e,t,i,a,s);return p.autoHeight&&(s==null?void 0:s.autoSize)!==!1&&d.observeHeightViaBridge(),d})}};var Xe={webcomponent_message_key:"myop_webcomponent_message"};var Ce=class extends F{constructor(e,t,i,s,a){super(e,i,a);this.container=i;this.customElement=s;r(this,"cleanupInspect",()=>{});r(this,"send",e=>{let t=h({},e),i=super.send(t),s=new CustomEvent(Xe.webcomponent_message_key,{detail:t});try{this.customElement.dispatchEvent(s)}catch(a){console.log("error while trying to dispatchEvent",a)}return i});r(this,"dispose",()=>{var e;super.dispose(),(e=this.customElement.parentNode)==null||e.removeChild(this.customElement)});this.element=s}inspect(){return this.cleanupInspect=be(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 Kt={},Ze=class extends G{constructor(){super(...arguments);r(this,"type",U.WebComponentLoader);r(this,"load",async(e,t,i,s)=>{let a=t.loader;Kt[a.url]?console.log("Module alreday loaded or in loading process"):Kt[a.url]=new Promise((c,m)=>{let u=a.url,f=document.createElement("script");f.type="module",f.src=u,f.onload=()=>{c()},f.onerror=()=>{m()},document.head.appendChild(f)}),await Kt[a.url],await ln(1);let p="myop-comp-".concat(D()),d=document.createElement(a.tag);return i.querySelector('[id^="myop-comp-"]')||(i.innerHTML=""),d.id=p,s!=null&&s.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"),s!=null&&s._environment&&(d._myopEnvironment=s==null?void 0:s._environment),this.appendChild(i,d,s),new Ce(e,t,i,d,s)})}};var et="0.4.0-beta.5";var uo="myop-delivery",ot="components";var tt=null;function fo(){return tt||(tt=new Promise(o=>{try{if(typeof indexedDB>"u")return o(null);let n=indexedDB.open(uo,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(ot)||e.createObjectStore(ot,{keyPath:"key"})},n.onsuccess=()=>o(n.result),n.onerror=()=>o(null),n.onblocked=()=>o(null)}catch(n){o(null)}}),tt)}function nt(o,n){return fo().then(e=>new Promise(t=>{if(!e)return t(null);try{let i=e.transaction(ot,o),s=n(i.objectStore(ot));s.onsuccess=()=>t(s.result),s.onerror=()=>t(null),i.onabort=()=>t(null)}catch(i){t(null)}}))}var Nt="myop.d.";function Tn(o,n,e){try{localStorage.setItem(Nt+o,JSON.stringify({t:n,e}))}catch(t){}}function go(o){try{localStorage.removeItem(Nt+o)}catch(n){}}var Le=new Map,A={key(o,n,e,t,i){return"".concat(o,"|").concat(n,"|").concat(e,"|").concat(t?"preview":"live","|").concat(i||"raw")},async get(o){let n=Le.get(o);if(n)return n;let e=await nt("readonly",t=>t.get(o));return e&&(Le.set(o,e),Tn(o,e.tag,e.storedAt+e.windowMs)),e},async put(o){Le.set(o.key,o),Tn(o.key,o.tag,o.storedAt+o.windowMs),await nt("readwrite",n=>n.put(o))},async drop(o){Le.delete(o),go(o),await nt("readwrite",n=>n.delete(o))},fresh(o){return!!o&&Date.now()-o.storedAt<o.windowMs},windowFrom(o){let n=o.get("cache-control")||"";if(/no-store|no-cache/i.test(n))return 0;let e=/s-maxage\s*=\s*(\d+)/i.exec(n)||/max-age\s*=\s*(\d+)/i.exec(n);if(!e)return 0;let t=Number(e[1]),i=Number(o.get("age")||0);return Math.max(0,t-(isNaN(i)?0:i))*1e3},async clear(){Le.clear();try{for(let o=localStorage.length-1;o>=0;o--){let n=localStorage.key(o);n&&n.startsWith(Nt)&&localStorage.removeItem(n)}}catch(o){}await nt("readwrite",o=>o.clear())}};var _n=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:he.code}},{id:"out_auto_v2_converted",name:"myop_cta_handler",type:"any",behavior:{type:he.code}}],refs:[],skins:[{id:"skin_auto_v2_converted",name:"auto_v2_converted",description:"",loader:o.consume_variant[0].loader}],defaultSkin:0},name:o.name}),st="__MYOP_CLOUD_REPOSITORY_MAIN__",yo=()=>{if(typeof window<"u")return window[st];if(typeof globalThis<"u")return globalThis[st]},ho=o=>{typeof window<"u"&&(window[st]=o),typeof globalThis<"u"&&(globalThis[st]=o)},$=class ${constructor(n="https://cloud.myop.dev"){this._baseUrl=n;r(this,"variants",{});r(this,"preloadedComponents",{});r(this,"userFlows",{});r(this,"_defaultEnv","production");r(this,"_envExplicitlySet",!1);r(this,"_staticMode",!1);r(this,"_queryParams",{});r(this,"_delivery",{minify:!1,host:null,cache:!1});r(this,"_deliveryStats",{requests:0,viaDelivery:0,fellBack:0,lastError:null,fromMemory:0,fromStorage:0,fromNetwork:0,revalidations:0,unchanged:0,bytesSaved:0});r(this,"_localServes",new Map);r(this,"_flushBound",!1)}static get Main(){let n=yo();return n||($._main||($._main=new $,ho($._main)),$._main)}static sizeOfHeld(n){var e,t,i,s,a;try{return(((a=(s=(i=(t=(e=n==null?void 0:n.config)==null?void 0:e.type)==null?void 0:t.skins)==null?void 0:i[0])==null?void 0:s.loader)==null?void 0:a.HTML)||"").length}catch(p){return 0}}setDelivery(n={}){n.minify!==void 0&&(this._delivery.minify=!!n.minify),n.host!==void 0&&(this._delivery.host=n.host),n.cache!==void 0&&(this._delivery.cache=!!n.cache)}deliveryStats(){var n;return z(h({},this._deliveryStats),{host:(n=this._delivery.host)!=null?n:$.DEFAULT_HOST,minify:this._delivery.minify,cache:this._delivery.cache})}async refreshDelivery(){await A.clear()}noteLocalServe(n,e){let t=this._localServes.get(n);t?t.count++:this._localServes.set(n,{env:e,count:1}),this.bindFlush()}bindFlush(){if(this._flushBound||typeof document>"u")return;this._flushBound=!0;let n=()=>{document.visibilityState==="hidden"&&this.flushLocalServes()};document.addEventListener("visibilitychange",n),window.addEventListener("pagehide",()=>this.flushLocalServes())}flushLocalServes(){if(!this._localServes.size)return;let n=[...this._localServes.entries()].map(([e,t])=>"".concat(e,":").concat(t.env,":").concat(t.count)).join(",");this._localServes.clear();try{let e="".concat(this.deliveryHost(),"/clientUsage?b=").concat(encodeURIComponent(n));fetch(e,{keepalive:!0,mode:"cors",credentials:"omit"}).catch(()=>{})}catch(e){}}deliveryHost(){return this._delivery.host||this._baseUrl}async deliveryFetch(n){var s;this._localServes.size&&this.flushLocalServes();let e=this.deliveryHost(),t="".concat(e).concat(n);this._deliveryStats.requests++;let i=e!==this._baseUrl;try{let a=await fetch(t);if(a.ok||a.status<500||!i)return i&&a.ok&&this._deliveryStats.viaDelivery++,a;this._deliveryStats.lastError="HTTP ".concat(a.status," from ").concat(e)}catch(a){if(!i)throw a;this._deliveryStats.lastError=String((s=a==null?void 0:a.message)!=null?s:a)}return this._deliveryStats.fellBack++,console.warn("[myop] delivery host failed (".concat(this._deliveryStats.lastError,") \u2014 falling back to ").concat(this._baseUrl)),await fetch("".concat(this._baseUrl).concat(n))}enableStaticMode(){this._staticMode=!0}setQueryParams(n){this._queryParams=n}setEnvironment(n){this._defaultEnv=n,this._envExplicitlySet=!0}getDefaultEnvironment(){return this._defaultEnv}isPreloaded(n,e,t){return e!==void 0||t!==void 0?"".concat(n,":").concat(e||this._defaultEnv,":").concat(t?"preview":"live")in this.variants:n in this.preloadedComponents}getPreloadedParams(n){return this.preloadedComponents[n]}async resolveComponent(n,e,t){return this.fetchComponentV2(n,e,t)}async fetchComponentV2(n,e,t){let{env:i,usePreview:s,cacheKey:a}=this.resolveParams(n,e,t);return console.log("[CloudRepository] fetchComponentV2",{componentId:n.slice(0,8)+"...",env:i,usePreview:s,cacheKey:a,cached:a in this.variants}),this.variants[a]||(this.preloadedComponents[n]||(this.preloadedComponents[n]={env:i,preview:s}),this.variants[a]=new Promise(async(p,d)=>{try{let c;if(this._staticMode){let V=s?"preview":i;c="".concat(this._baseUrl,"/components/").concat(n,"/").concat(V,".json");let T=new URLSearchParams(this._queryParams).toString();T&&(c+="?".concat(T))}else c="/consume?id=".concat(n,"&env=").concat(i),s&&(c+="&preview=true"),this._delivery.minify&&!s&&(c+="&opt=min");let m=this._delivery.cache&&!this._staticMode&&!s,u=m?A.key(this.deliveryHost(),n,i,s,this._delivery.minify?"min":"raw"):"",f=m?await A.get(u):null;if(f&&A.fresh(f)){this._deliveryStats.fromStorage++,this.noteLocalServe(n,i),this.variants[a].resolved=f.config,p(f.config);return}if(f&&f.tag){let V="/consume?ids=".concat(n,"&env=").concat(i)+(this._delivery.minify?"&opt=min":"")+"&have=".concat(encodeURIComponent(f.tag));this._deliveryStats.revalidations++;try{let T=await this.deliveryFetch(V);if(T.ok){let pe=await T.json();if((pe.unchanged||[]).includes(n)){this._deliveryStats.unchanged++,this._deliveryStats.bytesSaved+=$.sizeOfHeld(f),f.storedAt=Date.now(),f.windowMs=A.windowFrom(T.headers)||f.windowMs,await A.put(f),this.variants[a].resolved=f.config,p(f.config);return}let Y=(pe.items||[])[0];if(Y){let P=_n(Y);this._deliveryStats.fromNetwork++,await A.put({key:u,config:P,tag:Y.tag||null,storedAt:Date.now(),windowMs:A.windowFrom(T.headers),host:this.deliveryHost()}),this.variants[a].resolved=P,p(P);return}}}catch(T){}}let g=this._staticMode?await fetch(c):await this.deliveryFetch(c);if(!g.ok){d(new Error('Failed to load component "'.concat(n,'" (').concat(g.status).concat(this._staticMode?" from ".concat(c):"",")")));return}let R=(await g.json()).item;if(!R){d(new Error('Component "'.concat(n,'" not found')));return}if(!R.consume_variant||!R.consume_variant.length){d(new Error('Component "'.concat(n,'" has no implementation for environment "').concat(i,'"')));return}let k=_n(R);this._deliveryStats.fromNetwork++,m&&await A.put({key:u,config:k,tag:R.tag||null,storedAt:Date.now(),windowMs:A.windowFrom(g.headers),host:this.deliveryHost()}),this.variants[a].resolved=k,p(k)}catch(c){delete this.variants[a],d(c)}})),await this.variants[a]}getResolvedConfig(n,e,t){var s;let{cacheKey:i}=this.resolveParams(n,e,t);return((s=this.variants[i])==null?void 0:s.resolved)||null}resolveParams(n,e,t){let i=this.preloadedComponents[n],s=e!==void 0||t!==void 0,a,p;if(!s&&i)a=i.env,p=i.preview;else{a=e||this._defaultEnv;let d=e||this._envExplicitlySet;p=t===!0?!0:t===!1?!1:!d}return{env:a,usePreview:p,cacheKey:"".concat(n,":").concat(a,":").concat(p?"preview":"live")}}hydrateComponent(n,e,t,i){let{env:s,usePreview:a,cacheKey:p}=this.resolveParams(n,t,i),d=Promise.resolve(e);d.resolved=e,this.variants[p]=d,this.preloadedComponents[n]={env:s,preview:a}}async fetchComponentV1(n,e){return e?(await this.fetchFlow(e)).components.find(i=>i.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 s=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&auto=true"))).json();e(s.item)}catch(i){delete this.userFlows[n],t(i)}})),await this.userFlows[n]}async fetchFlow(n){return this.userFlows[n]||(this.userFlows[n]=new Promise(async(e,t)=>{try{let s=await(await fetch("".concat(this._baseUrl,"/flow?id=").concat(n,"&resolve=components"))).json();e(s.item)}catch(i){delete this.userFlows[n],t(i)}})),await this.userFlows[n]}async fetchComponent(n,e){return this.fetchComponentV1(n,e)}};r($,"_main",null),r($,"DEFAULT_HOST","https://cloud.myop.dev");var ae=$;var it=ae.Main;var Mo="https://delivery.myop.dev",Rn=(o={})=>{var e,t;let n=o.minify!==!1||o.cache===!0;return it.setDelivery({minify:(e=o.minify)!=null?e:!1,cache:(t=o.cache)!=null?t:!1,host:o.host!==void 0?o.host:n?Mo:null}),Pe()},Hn=async()=>(await it.refreshDelivery(),Pe()),Pe=()=>it.deliveryStats(),kn=()=>(it.setDelivery({minify:!1,cache:!1,host:null}),Pe());var x=class extends Fe{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 i=(s,a)=>{this.messageToHost(z(h({},s),{source:e.destination?e.destination:e.source,destination:e.source?e.source:e.destination}),a)};return this.innerExecutor(e,this.context[t].context,i)}else debugger}else debugger})}};var rt=class extends x{constructor(){super(...arguments);r(this,"messageType",y.BindClickMessage);r(this,"innerExecutor",(e,t,i)=>{let s=w(e.ref,t.shadowRoot),a=[];return s.forEach(p=>{let d=()=>{i(new Q(e.handlerUniqueId))};p.addEventListener("click",d),a.push(()=>{p.removeEventListener("click",d)})}),()=>{a.forEach(p=>p())}})}};var at=class extends x{constructor(){super(...arguments);r(this,"messageType",y.ChangeTextMessage);r(this,"innerExecutor",(e,t)=>{w(e.ref,t.shadowRoot).forEach(s=>{s.textContent=e.content})})}};var pt=class extends ye{constructor(e,t){super(e,t);this.container=e;this.shadowRoot=t}};var dt=class extends x{constructor(){super(...arguments);r(this,"innerExecutor",(e,t)=>{let i=t.shadowRoot.querySelectorAll("[".concat(H.id,"]")),s=[];i.forEach(a=>{let p=a.getAttribute(H.id);p&&s.push(new ue(p,a.tagName,a.getBoundingClientRect(),a.offsetTop,a.offsetLeft))}),this.messageToHost(new oe(e.handlerUniqueId,s))});r(this,"messageType",y.DetectMyopRefsMessage)}};var ct=class extends x{constructor(){super(...arguments);r(this,"messageType",y.SetAttributeMessage);r(this,"innerExecutor",(e,t)=>{w(e.ref,t.shadowRoot).forEach(s=>{s.setAttribute(e.name,e.value)})})}};var lt=class extends x{constructor(){super(...arguments);r(this,"messageType",y.AddEventListenerMessage);r(this,"innerExecutor",(e,t,i)=>{let s=w(e.ref,t.shadowRoot),a=[];return s.forEach(p=>{let d=c=>{i(new Z(e.handlerUniqueId,L(c,e.serializableSkeleton)))};p.addEventListener(e.type,d),a.push(()=>{p.removeEventListener(e.type,d)})}),()=>{a.forEach(p=>p())}})}};var mt=class extends x{constructor(){super(...arguments);r(this,"messageType",y.CreateRefComponentMessage);r(this,"innerExecutor",(e,t,i)=>{(async()=>{let a=t.shadowRoot.querySelectorAll("[".concat(H.id,"='").concat(e.refConfig.selector,"']"));if(a.length===1){let p=W.Instance(),d=p.components.find(f=>f.id===e.options.id);d&&d.dispose();let c=p.components.indexOf(d);c!==-1&&p.components.splice(c,1);let m=await p.loadComponent(e.nestedComponentConfig,a.item(0),e.options),u=[];Object.keys(m.refs).forEach(f=>{let g=m.refs[f];g=g.__nonProxied||g,g.componentDefinition&&u.push({refName:f,componentDefinitionId:g.componentDefinition.id})}),i(new N(e.handlerUniqueId,u))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new N(e.handlerUniqueId,[],!0));debugger}})().then()})}};var ut=class extends x{constructor(){super(...arguments);r(this,"messageType",y.ExecuteScriptMessage);r(this,"innerExecutor",(e,t,i)=>{Ve(e,a=>{i(new J(e.handlerUniqueId,a))},t)})}};var Dn=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),i=-1;return t.forEach(s=>{if(typeof s.value=="string"){let a=s.getAttribute(H.id),p=s.getAttribute("name"),d={id:s.id,name:p,value:Dn(s),required:s.required,validity:L(s.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},ft=class extends x{constructor(){super(...arguments);r(this,"messageType",y.GetElementValueMessage);r(this,"innerExecutor",(e,t,i)=>{w(e.ref,t.shadowRoot).forEach(a=>{i(new ee(Dn(a)),e)})})}};var gt=class extends x{constructor(){super(...arguments);r(this,"messageType",y.SetInnerHtml);r(this,"innerExecutor",(e,t)=>{w(e.ref,t.shadowRoot).forEach(s=>{s.innerHTML=e.content})})}};var Oe=class extends fe{constructor(){super(...arguments);r(this,"alwaysPassEnvelopesToHost",!0);r(this,"connectedCallback",(e,t)=>{e.addEventListener(Xe.webcomponent_message_key,i=>{let s=i.data?i.data:i.detail;if(!s||!s.myop){debugger;throw new Error("recvied webcomponent_message with wrong type")}else{let a=s;if(this.handleIncomeMessages(i),a.messageType===y.InitMessage){let p=a.content.id;this.components[p].context=new pt(e,t)}}}),setTimeout(()=>{this.messageToHost(new ne)},1)});r(this,"messageToHost",(e,t)=>{e.direction=S.up,!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId),window.myop.hostSDK.send(e)});r(this,"supportedHandlers",[new at(this.messageToHost,this.components),new gt(this.messageToHost,this.components),new rt(this.messageToHost,this.components),new dt(this.messageToHost,this.components),new ct(this.messageToHost,this.components),new lt(this.messageToHost,this.components),new ut(this.messageToHost,this.components),new ft(this.messageToHost,this.components),new mt(this.messageToHost,this.components)]);r(this,"init",()=>{})}};Me("WebComponentSDK",Oe);var Bn="";var bo="<!-- myop-web-component -->",Pn="myop-web-component",On=new Map,zn=[],yt,An=async()=>(yt||(yt=new Oe,yt.init()),yt);function Co(o,n){return class extends HTMLElement{connectedCallback(){let e=n===se.open?"open":"closed",t=this.attachShadow({mode:e});An().then(i=>{i.connectedCallback(this,t),t.innerHTML=o})}}}var wo=(o,n,e)=>{customElements.define(o,Co(n,e)),console.log("define('".concat(o,"') was called, web component ready to use"))},Io=o=>o.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)/g,"-$1").toLowerCase(),xo=o=>(o=Io(o),o.replace(/_/g,"-"));var ht=class extends G{constructor(){super(...arguments);r(this,"type",U.HTMLLoader);r(this,"load",async(e,t,i,s)=>{let a=t.loader,p=this.isMyopWebComponent(a.HTML),{mode:d,isolate:c}=await this.resolveRenderMode(e,t,a,p,s);if(d===!1)throw new Error('[Myop] Rendering blocked by render policy for component "'.concat(e.id,'"'));if(p){if(d!=="webComponent")throw new Error('[Myop] Web-component rendering denied by render policy for component "'.concat(e.id,'"'));return this.loadExtractedWebComponent(e,t,i,a.HTML,s)}let m="myop-comp-".concat(D()),u;if(a.shadowRootMode===se.localFrame){let f=D(),g="myop-comp-".concat(f),l=document.createElement("iframe");l.id=g,c&&l.setAttribute("sandbox","allow-scripts allow-forms allow-popups"),l.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(s!=null&&s.hidden?"0":"1",";\n width: 100%;\n height: 100%;\n pointer-events: ").concat(s!=null&&s.hidden?"none":"all",";\n "),i.querySelector('[id^="myop-comp-"]')||(i.innerHTML=""),l=this.appendChild(i,l,s);let R=[],k=c?{open(){},writeln(I){R.push(I)},close(){l.srcdoc=R.join("\n")}}:(()=>{let I=l.contentDocument||l.contentWindow.document;return I.open(),I})(),V=null;{let _=new DOMParser().parseFromString(a.HTML,"text/html").querySelector('meta[name="myop:size"]');if(_)try{V=JSON.parse(_.getAttribute("content")||"{}")}catch(de){}}let T=a.HTML;if(s!=null&&s._inspection){let C=new DOMParser().parseFromString(a.HTML,"text/html"),_=C.getElementById("myop_preview");_==null||_.removeAttribute("type");let de=C.implementation.createHTMLDocument();de.body.innerHTML="<script>\n const beforeKeysWindow = new Set(Object.keys(window));\n window.myopState = {\n beforeKeysWindow,\n };\n <\/script>";let ce=de.body.firstChild;ce&&C.head&&C.head.insertBefore(C.importNode(ce,!0),C.head.firstChild),T="<!DOCTYPE html>"+C.documentElement.outerHTML}else if((s==null?void 0:s.data)!==void 0){let C=new DOMParser().parseFromString(a.HTML,"text/html"),_=C.getElementById("myop_preview");_&&(_.remove(),T="<!DOCTYPE html>"+C.documentElement.outerHTML)}if(s!=null&&s.injectCss){let C=new DOMParser().parseFromString(T,"text/html"),_=C.createElement("style");_.setAttribute("data-myop-injected","true"),_.textContent=s.injectCss.replace(/<\s*\/\s*style/gi,"<\\/style"),(C.head||C.documentElement).appendChild(_),T="<!DOCTYPE html>"+C.documentElement.outerHTML}k.writeln(T);let pe='<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__,'"><\/script>'),Y="<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(c||k.writeln("".concat(pe).concat(Y)),!c&&(s==null?void 0:s.data)!==void 0&&(s==null?void 0:s.data)!==null){let I="<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>",C=JSON.stringify(s.data).replace(/<\/script/gi,"\\u003c/script"),_='<script id="__myop_init_data_script">\n (function() {\n var data = '.concat(C,";\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>");k.writeln(I+_)}if(c){let I=(s==null?void 0:s.data)!==void 0&&(s==null?void 0:s.data)!==null?JSON.stringify(s.data).replace(/<\/script/gi,"\\u003c/script"):"undefined";k.writeln(this.buildIsolationBridge(I))}k.close();let P=new q(e,t,i,l,s);return c&&P.enableIsolation(),P.sizeMeta=V,P.initiated().then(()=>{if((s==null?void 0:s.autoSize)===!1)return;let I=!1;P.observeAutoSize({forceAutoSize:!0,onSizeChange:()=>{!I&&!(s!=null&&s.hidden)&&(I=!0,P.show())}})}),P}if(a.shadowRootMode===se.none){let f=document.createElement("template");f.innerHTML=a.HTML,u=f.content.firstElementChild,An().then(g=>{g.connectedCallback(u,u)})}else{let f=xo(e.name+t.id);zn.includes(f)||(wo(f,a.HTML,a.shadowRootMode),zn.push(f)),u=document.createElement(f)}return i.querySelector('[id^="myop-comp-"]')||(i.innerHTML=""),u.id=m,s!=null&&s.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"),this.appendChild(i,u,s),new Ce(e,t,i,u,s)})}isMyopWebComponent(e){return e.trimStart().startsWith(bo)?!0:new RegExp("<script[^>]*\\sid=[\"']?".concat(Pn,"[\"'\\s>]"),"i").test(e)}async resolveRenderMode(e,t,i,s,a){var m,u,f,g;let p=s?"webComponent":i.isolation||a!=null&&a.isolation?"isolatedIframe":"iframe",d=(g=a==null?void 0:a.renderPolicy)!=null?g:(f=(u=(m=window==null?void 0:window.myop)==null?void 0:m.hostSDK)==null?void 0:u.getRenderPolicy)==null?void 0:f.call(u),c=d?await d({componentDefinition:e,skin:t,requestedMode:p,isWebComponent:s}):p;return{mode:c,isolate:c==="isolatedIframe"}}buildIsolationBridge(e){return"<script>\n (function () {\n var __initial = ".concat(e,";\n var __pending;\n // data-out (cta)\n window.myop_cta_handler = function (action, payload) {\n try { parent.postMessage({ __myop: true, type: 'myop:cta', action: action, payload: payload }, '*'); } catch (e) {}\n };\n function callInit(data) {\n if (typeof window.myop_init_interface === 'function') { window.myop_init_interface(data); return true; }\n return false;\n }\n // data-in (init updates)\n window.addEventListener('message', function (e) {\n var d = e.data;\n if (!d || d.__myop !== true) return;\n if (d.type === 'myop:init') { if (!callInit(d.data)) __pending = d.data; }\n });\n // first render: use a pending update if one arrived, else the baked initial data\n (function flushInitial() {\n var data = (__pending !== undefined) ? __pending : __initial;\n if (data === undefined) return;\n if (callInit(data)) { __pending = undefined; __initial = undefined; }\n else requestAnimationFrame(flushInitial);\n })();\n // resize (report content size)\n function contentHeight() {\n // Measure the BODY (content box). documentElement.scrollHeight includes\n // the iframe viewport \u2014 which we're driving \u2014 so it would report the\n // current frame height, not the content, and never shrink.\n var b = document.body;\n if (b) return Math.max(b.scrollHeight, b.offsetHeight);\n return document.documentElement.scrollHeight;\n }\n function postSize() {\n try {\n parent.postMessage({\n __myop: true, type: 'myop:size',\n height: contentHeight(),\n width: document.documentElement.scrollWidth\n }, '*');\n } catch (e) {}\n }\n // Observe the BODY (reflows with content) \u2014 not documentElement, whose box is\n // the iframe viewport and would feed back into a resize loop. A MutationObserver\n // catches content swaps (e.g. innerHTML re-render) that don't change body's box.\n if (window.ResizeObserver) {\n try { var __ro = new ResizeObserver(postSize); if (document.body) __ro.observe(document.body); } catch (e) {}\n }\n if (window.MutationObserver && document.body) {\n try { new MutationObserver(postSize).observe(document.body, { childList: true, subtree: true, attributes: true, characterData: true }); } catch (e) {}\n }\n window.addEventListener('load', postSize);\n postSize();\n })();\n <\/script>")}extractWebComponentScript(e){let s=new DOMParser().parseFromString(e,"text/html").getElementById(Pn);return(s==null?void 0:s.textContent)||null}executeWebComponentScript(e,t){let i=On.get(t);if(i)return console.log("[MyopWebComponent] Script already executed for ".concat(t,", reusing <").concat(i,">")),i;let s=document.createElement("script");s.textContent=e,s.id="myop-extracted-".concat(t),document.head.appendChild(s);let a=window.__MYOP_TAG_NAME__;return a&&On.set(t,a),console.log("[MyopWebComponent] Executed web component script: ".concat(t," -> <").concat(a,">")),a}async loadExtractedWebComponent(e,t,i,s,a){let p=this.extractWebComponentScript(s);if(!p)throw new Error('[MyopWebComponent] No <script id="myop-web-component"> found in HTML');let d="".concat(e.id,"-").concat(t.id),c=this.executeWebComponentScript(p,d);if(!c)throw new Error("[MyopWebComponent] Script did not set window.__MYOP_TAG_NAME__");let m="myop-comp-".concat(D()),u=document.createElement(c);u.id=m,a!=null&&a.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"),i.querySelector('[id^="myop-comp-"]')||(i.innerHTML="");let f=new re(e,t,i,u,c,a);return this.appendChild(i,u,a),(a==null?void 0:a.data)!==void 0&&(a==null?void 0:a.data)!==null&&f.initWithData(a.data),console.log("[MyopWebComponent] Loaded <".concat(c,"> into container")),f}};var $n=async o=>{try{let n=new URL(window.location.href),t=new URLSearchParams(n.search).get("myopOverride");if(t){let[i,...s]=Et(t);switch(i){case"component":{let[a,p]=s,d=await ae.Main.fetchComponent(a);if(d&&d.type.skins.find(m=>m.id===p))return d.instance.skinSelector={type:ie.Dedicated,skin:{id:p}},d}break;default:{let[a,p]=Et(t),c=(await ae.Main.fetchFlow(a)).components.find(m=>m.type.id===o.type.id);if(c&&c.instance.skinSelector.type===ie.Segmented&&c.instance.resolvedExperiences){let m=c.instance.resolvedExperiences.find(u=>u.id===p);if((m==null?void 0:m.type)===Ke.Segment){let u=m,g=c.instance.skinSelector.segments.find(l=>l.segmentId===u.segment.id);if(g)return c.instance.skinSelector=g==null?void 0:g.skinSelector,c}}}break}}}finally{return null}};var Fn="https://cdn.myop.dev/sdk/next/myop_sdk.min.js",W=class{constructor(){r(this,"components2init",[]);r(this,"components",[]);r(this,"componentsLoaders",[]);r(this,"_renderPolicy");r(this,"setRenderPolicy",n=>{this._renderPolicy=n});r(this,"getRenderPolicy",()=>this._renderPolicy);r(this,"initiated",!1);r(this,"version",et);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,"isTrustedSource",n=>{if(!n||n===window)return!0;let e=t=>{let i=t.element;return(i==null?void 0:i.nodeName)==="IFRAME"&&i.contentWindow===n};return this.components.some(e)||this.components2init.some(e)});r(this,"incomingMessageHandler",n=>{var e;if((e=n.data)!=null&&e.myop&&this.isTrustedSource(n.source)&&n.data.myop){if(n.data.direction!==S.up&&n.data.messageType!==y.EnvelopedMessage)return;let t=n.data;if(t.messageType===y.InitRequest){let s=this.components2init.filter(p=>{let d=p.element;return(d==null?void 0:d.nodeName)==="IFRAME"&&d.contentWindow===n.source});(s.length?s:this.components2init).forEach(p=>{p.send(new te(p.id))});return}if(t.messageType===y.InitResponse){this.components2init=this.components2init.filter(a=>a.id!==t.content.id);let s=this.components.find(a=>{var p;return a.id===((p=t.content)==null?void 0:p.id)});s==null||s.setInitiated();return}if(t.messageType===y.EnvelopedMessage){let s=t,a=this.components.find(p=>p.id===s.destination);if(a){if(s.direction===S.down){s.message.messageType===O.name?a.onMessageReceived(s.message):(s.message.route=s.route,a.send(s.message));return}}else{let p=this.components.find(d=>d.id===s.message.destination);p&&p.send(s.message)}return}let i=this.components.find(s=>s.id===t.destination);if(!i){window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t);return}if(i){if(i.onMessageReceived(t))return;window.myop.IframeSDK&&window.myop.IframeSDK.messageToHost(t)}}});r(this,"send",n=>{let e=new MessageEvent("",{data:n});this.incomingMessageHandler(e)});r(this,"init",n=>{if(this.initiated){n!=null&&n.length&&this._registerLoaders(n);return}let e=[new Je,new Ze,new ht];this.componentsLoaders=[...e],n&&this._registerLoaders(n),window.addEventListener("message",this.incomingMessageHandler,!1),console.log("myop hostSDK initiated",document.location.href),this.initiated=!0});r(this,"_registerLoaders",n=>{let e={};n.forEach(t=>{let i=new t(this.componentsLoaders);e[i.type]=i}),this.componentsLoaders.forEach(t=>{e[t.type]||(e[t.type]=t)}),this.componentsLoaders=Object.values(e)});r(this,"_getSkinIdBySkinSelector",async(n,e=[],t)=>{var s;async function i(a,p){for(let d of a)if(await p(d))return d}switch(n.type){case"DedicatedSkin":case ie.Dedicated:return((s=n.skin)==null?void 0:s.id)||n.skins[0].id;case ie.Segmented:{let p=await i(n.segments,async d=>{if(d.segmentId==="Default")return!0;let c=e.find(g=>g.type===Ke.Segment?g.segment.id===d.segmentId:!1);if(!c)throw new Error("experience not found");let u=c.segment,f=(t||{})[u.function];return f?await f():(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(i=>i.id===t)});r(this,"loaderHooks");r(this,"loadComponent",async(n,e,t)=>{var m,u,f,g;if(!e){debugger;throw new Error("no container was found for this component")}let i=await $n(n);i&&(n=i);let s=h(h({},(m=this.loaderHooks)!=null?m:{}),(u=t==null?void 0:t.hooks)!=null?u:{}),a=e;if(a.myop)if(a.component){n=h({},n),n.instance=h({},n.instance);let l=await this.runSkinSelector(n,s);if(!l)throw new Error("runSkinSelector failed to choose skin, check the provided config");return(f=t==null?void 0:t.hooks)!=null&&f.afterSkinSelected&&(l=await t.hooks.afterSkinSelected(h({},l))),n.instance.skinSelector={type:ie.Dedicated,skin:l},t&&(t=h({},t),delete t.hooks),await Ft(a,n,this.components,t)}else throw new Error("load component got a detached ref.");e=e;let p=await this.runSkinSelector(n,s);if(!p)throw new Error("runSkinSelector failed to choose skin, check the provided config");(g=t==null?void 0:t.hooks)!=null&&g.afterSkinSelected&&(p=await t.hooks.afterSkinSelected(h({},p)));let d=this.componentsLoaders.find(l=>l.type===p.loader.type);if(!d){debugger;throw new Error('no loader "'.concat(p.loader.type,'" was found for component'))}let c=await d.load(n.type,p,e,t);c.isInitiated||this.components2init.push(c),c.bind("onDispose",()=>(this.components=this.components.filter(l=>l!==c),this.components2init=this.components2init.filter(l=>l!==c),!0)),this.components.push(c),c.isInitiated||c.send(new te(c.id)),(!t||t.connectProps!==!1)&&(c=En(c,n.type.props,p));try{await Wt(c,n,this.components)}catch(l){throw l}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 i=await this.loadComponent(e,n.container,h({hidden:!0,relative:{direction:"after",child:n.element}},t));return t.init&&await t.init(i),i.show(),n.dispose(),i}else{let i=n.element.nextSibling;return n.dispose(),this.loadComponent(e,n.container,h({relative:{direction:"before",child:i}},t))}})}};r(W,"Instance",()=>window.myop.hostSDK);window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Fn});if(!window.myop.hostSDK){let o=new W;o.init(),window.myop||(window.myop={__ROOT_SDK_PUBLIC_URL__:Fn}),window.myop.hostSDK=o}if(window.myop&&!window.myop.delivery){let o=n=>Rn(n);o.stats=Pe,o.off=kn,o.refresh=Hn,window.myop.delivery=o}var So=window.myop.hostSDK;Me("hostSDK",So);var Mt=class extends M{constructor(){super(...arguments);r(this,"messageType",y.CreateRefComponentMessage);r(this,"executor",e=>{(async()=>{let i=document.querySelectorAll("[".concat(H.id,"='").concat(e.refConfig.selector,"']"));if(i.length===1){let a=await W.Instance().loadComponent(e.nestedComponentConfig,i.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 N(e.handlerUniqueId,p))}else{console.error("CreateRefComponentMessageHandler - DOM element not found"),this.messageToHost(new N(e.handlerUniqueId,[],!0));debugger}})().then()})}};var Wn=(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),i={attributes:!0,childList:!0,subtree:!0};return t.observe(o,i),t}else window.addEventListener&&(o.addEventListener("DOMNodeInserted",n,!1),o.addEventListener("DOMNodeRemoved",n,!1))};var bt=class extends M{constructor(){super(...arguments);r(this,"messageType",y.SetMutationObserverMessage);r(this,"executor",e=>{e.source&&Wn(document.body,()=>{this.messageToHost(new Te)})})}};var Kn=o=>{if(!o)return null;if(o.tagName==="FORM"){let n=new FormData(o),e={formData:{},unmappedData:[]},t=o.querySelectorAll("input, select, textarea"),i=-1;return t.forEach(s=>{if(typeof s.value=="string"){let a=s.getAttribute(H.id),p=s.getAttribute("name"),d={id:s.id,name:p,value:Kn(s),required:s.required,validity:L(s.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},Ct=class extends M{constructor(){super(...arguments);r(this,"messageType",y.GetElementValueMessage);r(this,"executor",e=>{w(e.ref,document).forEach(i=>{this.messageToHost(new ee(Kn(i)),e)})})}};var wt=class extends M{constructor(){super(...arguments);r(this,"messageType",y.GetAttributeMessage);r(this,"executor",e=>{let t=wn(e.ref,document);t&&this.messageToHost(new Ee(t.getAttribute(e.name)),e)})}};var It=class extends M{constructor(){super(...arguments);r(this,"messageType",y.SetResizeObserverMessage);r(this,"executor",e=>{let t=new ResizeObserver(i=>{this.messageToHost(new De)});return t.observe(document.body),()=>{t.disconnect()}})}};var xt=class extends M{constructor(){super(...arguments);r(this,"messageType",y.SetInnerHtml);r(this,"executor",e=>{w(e.ref,document).forEach(i=>{i.innerHTML=e.content})})}};var Ut=class extends fe{constructor(){super();r(this,"version",et);r(this,"messageToHost",(e,t)=>{var s,a;!e.replayToHandler&&(t!=null&&t.handlerUniqueId)&&(e.replayToHandler=t.handlerUniqueId);let i=Object.keys(this.components);e.destination||(t!=null&&t.route?e.destination=t.route[t.route.length-1]:e.destination=i[0]),e.source||(e.source=i[0]),e.direction=S.up,(a=(s=this.hostWindow)!=null?s:window.parent)==null||a.postMessage(h({},e),"*")});r(this,"supportedHandlers",[new qe(this.messageToHost),new xt(this.messageToHost),new Ue(this.messageToHost),new Ne(this.messageToHost),new je(this.messageToHost),new Ye(this.messageToHost),new Qe(this.messageToHost),new Ct(this.messageToHost),new bt(this.messageToHost),new It(this.messageToHost),new wt(this.messageToHost),new Mt(this.messageToHost)]);r(this,"hostWindow",window.parent);r(this,"isFromHostChain",e=>{if(!e||e===window)return!0;let t=window;for(let i=0;i<32;i++){let s=t.parent;if(!s||s===t)return!1;if(e===s)return!0;t=s}return!1});r(this,"init",()=>{window.onmessage=e=>{var t;this.isFromHostChain(e.source)&&(e.source&&e.source!==window&&((t=e.data)==null?void 0:t.messageType)===y.InitMessage&&(this.hostWindow=e.source),this.handleIncomeMessages(e))},this.messageToHost(new ne)});window.myop||(window.myop={}),window.myop.IframeSDK=this}};Me("IframeSDK",Ut);export{Ut as IframeSDK};
|
|
@@ -1188,6 +1188,67 @@ var MyopExtractedWebComponent = class extends BaseMyopComponent {
|
|
|
1188
1188
|
this._ctaQueue.push({ action: detail.action, payload: detail.payload });
|
|
1189
1189
|
}
|
|
1190
1190
|
});
|
|
1191
|
+
__publicField(this, "_autoSizeOptions");
|
|
1192
|
+
/**
|
|
1193
|
+
* Data-out for size — the extracted counterpart of the iframe implementation.
|
|
1194
|
+
*
|
|
1195
|
+
* THIS EXISTED ONLY ON MyopIframeComponent, and that was invisible for as long as
|
|
1196
|
+
* minification was sending every v2 component down the iframe path. Restoring v2
|
|
1197
|
+
* detection moves them to this class, and `@myop/react` drives both through one
|
|
1198
|
+
* wrapper: in content mode it hides its loader from the FIRST onSizeChange, so a
|
|
1199
|
+
* component whose class has no observeAutoSize leaves a React host on a loader
|
|
1200
|
+
* forever. Pic-Time's sizeMeta is width:100% with no height, which is exactly content
|
|
1201
|
+
* mode. Caught by v2-data-contract D8 (API parity).
|
|
1202
|
+
*
|
|
1203
|
+
* It REPORTS rather than imposes. An iframe has no intrinsic size and must be
|
|
1204
|
+
* measured inside and then set from outside; a custom element sizes itself from its
|
|
1205
|
+
* own content, so the honest thing is to measure it and tell the host, and let the
|
|
1206
|
+
* host decide. React then uses width:100% and the measured height.
|
|
1207
|
+
*
|
|
1208
|
+
* The one thing it does impose is `display: block` when the element computes to
|
|
1209
|
+
* `inline`, which is the default for a custom element and measures as zero height no
|
|
1210
|
+
* matter what it contains. The iframe path forces width:100% for the same reason —
|
|
1211
|
+
* without it the first measurement is 0 and the host sizes the component to nothing.
|
|
1212
|
+
*/
|
|
1213
|
+
__publicField(this, "observeAutoSize", (options) => {
|
|
1214
|
+
this._autoSizeOptions = options;
|
|
1215
|
+
const el = this.customElement;
|
|
1216
|
+
try {
|
|
1217
|
+
if (getComputedStyle(el).display === "inline") el.style.display = "block";
|
|
1218
|
+
} catch (e) {
|
|
1219
|
+
}
|
|
1220
|
+
const parse = (v) => {
|
|
1221
|
+
if (v === void 0) return void 0;
|
|
1222
|
+
if (typeof v === "number") return v;
|
|
1223
|
+
const n = parseFloat(v);
|
|
1224
|
+
return isNaN(n) ? void 0 : n;
|
|
1225
|
+
};
|
|
1226
|
+
const clamp = (v, min, max) => min !== void 0 && v < min ? min : max !== void 0 && v > max ? max : v;
|
|
1227
|
+
const report = () => {
|
|
1228
|
+
var _a;
|
|
1229
|
+
const opts = this._autoSizeOptions;
|
|
1230
|
+
const rect = el.getBoundingClientRect();
|
|
1231
|
+
const autoHeight = (opts == null ? void 0 : opts.explicitHeight) === void 0;
|
|
1232
|
+
(_a = opts == null ? void 0 : opts.onSizeChange) == null ? void 0 : _a.call(opts, {
|
|
1233
|
+
width: rect.width,
|
|
1234
|
+
height: autoHeight ? clamp(rect.height, parse(opts == null ? void 0 : opts.minHeight), parse(opts == null ? void 0 : opts.maxHeight)) : rect.height,
|
|
1235
|
+
autoSizingWidth: false,
|
|
1236
|
+
// a web component fills its container's width
|
|
1237
|
+
autoSizingHeight: autoHeight
|
|
1238
|
+
});
|
|
1239
|
+
};
|
|
1240
|
+
let ro;
|
|
1241
|
+
try {
|
|
1242
|
+
ro = new ResizeObserver(() => report());
|
|
1243
|
+
ro.observe(el);
|
|
1244
|
+
} catch (e) {
|
|
1245
|
+
}
|
|
1246
|
+
report();
|
|
1247
|
+
return () => {
|
|
1248
|
+
ro == null ? void 0 : ro.disconnect();
|
|
1249
|
+
this._autoSizeOptions = void 0;
|
|
1250
|
+
};
|
|
1251
|
+
});
|
|
1191
1252
|
__publicField(this, "cleanupInspect", () => {
|
|
1192
1253
|
});
|
|
1193
1254
|
/**
|
|
@@ -2189,7 +2250,7 @@ var WebcomponentLoader = class extends BaseMyopLoader {
|
|
|
2189
2250
|
};
|
|
2190
2251
|
|
|
2191
2252
|
// version:myop-sdk-version
|
|
2192
|
-
var myop_sdk_version_default = "0.4.0-beta.
|
|
2253
|
+
var myop_sdk_version_default = "0.4.0-beta.5";
|
|
2193
2254
|
|
|
2194
2255
|
// src/helpers/deliveryStore.ts
|
|
2195
2256
|
var DB_NAME = "myop-delivery";
|
|
@@ -3351,14 +3412,14 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
3351
3412
|
if (!isolate) {
|
|
3352
3413
|
doc.writeln("".concat(sdkScript).concat(initScript));
|
|
3353
3414
|
}
|
|
3354
|
-
if (!isolate && (options == null ? void 0 : options.data) !== void 0) {
|
|
3415
|
+
if (!isolate && (options == null ? void 0 : options.data) !== void 0 && (options == null ? void 0 : options.data) !== null) {
|
|
3355
3416
|
const ctaQueueScript = "<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>";
|
|
3356
3417
|
const escapedData = JSON.stringify(options.data).replace(/<\/script/gi, "\\u003c/script");
|
|
3357
3418
|
const dataScript = '<script id="__myop_init_data_script">\n (function() {\n var data = '.concat(escapedData, ";\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>");
|
|
3358
3419
|
doc.writeln(ctaQueueScript + dataScript);
|
|
3359
3420
|
}
|
|
3360
3421
|
if (isolate) {
|
|
3361
|
-
const escapedData = (options == null ? void 0 : options.data) !== void 0 ? JSON.stringify(options.data).replace(/<\/script/gi, "\\u003c/script") : "undefined";
|
|
3422
|
+
const escapedData = (options == null ? void 0 : options.data) !== void 0 && (options == null ? void 0 : options.data) !== null ? JSON.stringify(options.data).replace(/<\/script/gi, "\\u003c/script") : "undefined";
|
|
3362
3423
|
doc.writeln(this.buildIsolationBridge(escapedData));
|
|
3363
3424
|
}
|
|
3364
3425
|
doc.close();
|
|
@@ -3413,10 +3474,29 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
3413
3474
|
});
|
|
3414
3475
|
}
|
|
3415
3476
|
/**
|
|
3416
|
-
* Detect if HTML is a Myop Web Component
|
|
3477
|
+
* Detect if HTML is a Myop Web Component.
|
|
3478
|
+
*
|
|
3479
|
+
* THE MARKER COMMENT ALONE IS NOT A SAFE SIGNAL, BECAUSE MINIFIERS DELETE COMMENTS.
|
|
3480
|
+
*
|
|
3481
|
+
* This used to be `startsWith(MYOP_WEB_COMPONENT_MARKER)` and nothing else. The
|
|
3482
|
+
* delivery lane minifies with `removeComments: true` (myop-server derive.ts MIN_CFG),
|
|
3483
|
+
* so the stored `min` artifact of every v2 web component loses its leading
|
|
3484
|
+
* `<!-- myop-web-component -->`. Detection then returned false, the component fell
|
|
3485
|
+
* back to plain iframe rendering, and the whole authored document was shown --
|
|
3486
|
+
* including the v2 authoring wrapper, so Pic-Time's production dashboard displayed the
|
|
3487
|
+
* preview chrome ("Web Component v2", a tag-name badge reading `loading...`, SIZE /
|
|
3488
|
+
* OVERFLOW / BG controls) instead of their component. Reported 2026-10-18; the served
|
|
3489
|
+
* HTML measured 328,071 bytes against 951,130 at origin, with zero `<!--` left in it.
|
|
3490
|
+
*
|
|
3491
|
+
* The script id is the signal that survives, and it is the one `extractWebComponentScript`
|
|
3492
|
+
* already depends on: if that element is present, extraction works, so detection
|
|
3493
|
+
* should agree. Checked with a regex rather than DOMParser -- this runs for every
|
|
3494
|
+
* HTML component, and parsing a 300 KB document to answer a yes/no question is not
|
|
3495
|
+
* worth it.
|
|
3417
3496
|
*/
|
|
3418
3497
|
isMyopWebComponent(html) {
|
|
3419
|
-
|
|
3498
|
+
if (html.trimStart().startsWith(MYOP_WEB_COMPONENT_MARKER)) return true;
|
|
3499
|
+
return new RegExp("<script[^>]*\\sid=[\"']?".concat(MYOP_WEB_COMPONENT_SCRIPT_ID, "[\"'\\s>]"), "i").test(html);
|
|
3420
3500
|
}
|
|
3421
3501
|
/**
|
|
3422
3502
|
* Resolve how this component should render, applying the host render policy.
|
|
@@ -3511,7 +3591,6 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
3511
3591
|
if (!container.querySelector('[id^="myop-comp-"]')) {
|
|
3512
3592
|
container.innerHTML = "";
|
|
3513
3593
|
}
|
|
3514
|
-
this.appendChild(container, element, options);
|
|
3515
3594
|
const component = new MyopExtractedWebComponent(
|
|
3516
3595
|
componentDefinition,
|
|
3517
3596
|
skin,
|
|
@@ -3520,7 +3599,8 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
3520
3599
|
tagName,
|
|
3521
3600
|
options
|
|
3522
3601
|
);
|
|
3523
|
-
|
|
3602
|
+
this.appendChild(container, element, options);
|
|
3603
|
+
if ((options == null ? void 0 : options.data) !== void 0 && (options == null ? void 0 : options.data) !== null) {
|
|
3524
3604
|
component.initWithData(options.data);
|
|
3525
3605
|
}
|
|
3526
3606
|
console.log("[MyopWebComponent] Loaded <".concat(tagName, "> into container"));
|