@soyio/soyio-widget 2.13.3 → 2.13.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/index.js +236 -235
- package/dist/index.umd.cjs +14 -14
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(I,C){typeof exports=="object"&&typeof module!="undefined"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(I=typeof globalThis!="undefined"?globalThis:I||self,C(I["soyio-widget"]={}))})(this,function(I){"use strict";var
|
|
1
|
+
(function(I,C){typeof exports=="object"&&typeof module!="undefined"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(I=typeof globalThis!="undefined"?globalThis:I||self,C(I["soyio-widget"]={}))})(this,function(I){"use strict";var Zn=Object.defineProperty;var Ft=Object.getOwnPropertySymbols,Kn=Object.getPrototypeOf,Xn=Object.prototype.hasOwnProperty,Qn=Object.prototype.propertyIsEnumerable,er=Reflect.get;var tr=(I,C,T)=>C in I?Zn(I,C,{enumerable:!0,configurable:!0,writable:!0,value:T}):I[C]=T;var Ht=(I,C)=>{var T={};for(var _ in I)Xn.call(I,_)&&C.indexOf(_)<0&&(T[_]=I[_]);if(I!=null&&Ft)for(var _ of Ft(I))C.indexOf(_)<0&&Qn.call(I,_)&&(T[_]=I[_]);return T};var M=(I,C,T)=>(tr(I,typeof C!="symbol"?C+"":C,T),T),nr=(I,C,T)=>{if(!C.has(I))throw TypeError("Cannot "+T)};var _t=(I,C,T)=>{if(C.has(I))throw TypeError("Cannot add the same private member more than once");C instanceof WeakSet?C.add(I):C.set(I,T)};var qt=(I,C,T)=>(nr(I,C,"access private method"),T),Bt=(I,C,T)=>er(Kn(I),T,C);var $=(I,C,T)=>new Promise((_,oe)=>{var Ne=Q=>{try{de(T.next(Q))}catch(fe){oe(fe)}},De=Q=>{try{de(T.throw(Q))}catch(fe){oe(fe)}},de=Q=>Q.done?_(Q.value):Promise.resolve(Q.value).then(Ne,De);de((T=T.apply(I,C)).next())});var Ie,Gt;function C(m,f){for(var g=0;g<f.length;g++){const d=f[g];if(typeof d!="string"&&!Array.isArray(d)){for(const v in d)if(v!=="default"&&!(v in m)){const y=Object.getOwnPropertyDescriptor(d,v);y&&Object.defineProperty(m,v,y.get?y:{enumerable:!0,get:()=>d[v]})}}}return Object.freeze(Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}))}const T=!!(typeof window!="undefined"&&window.document&&window.document.createElement),_=200;class oe{constructor(){M(this,"tooltipElement",null);M(this,"tooltipContent",null);M(this,"tooltipClass","soyio-tooltip");M(this,"hideTimeout",null);T&&this.createTooltipElement()}createTooltipElement(){const f=document.querySelector(`.${this.tooltipClass}`);if(f){this.tooltipElement=f,this.tooltipContent=this.tooltipElement.querySelector(".soyio-tooltip-content");return}this.tooltipElement=document.createElement("div"),this.tooltipElement.className=this.tooltipClass,this.tooltipElement.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
z-index: 99999;
|
|
4
4
|
background: rgba(30, 30, 30, 0.9);
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
backdrop-filter: blur(5px);
|
|
17
17
|
-webkit-backdrop-filter: blur(5px);
|
|
18
18
|
transform: scale(0.95);
|
|
19
|
-
`,this.tooltipContent=document.createElement("div"),this.tooltipContent.className="soyio-tooltip-content",this.tooltipElement.appendChild(this.tooltipContent),document.body.appendChild(this.tooltipElement)}show(f,g,d){if(!this.tooltipElement||!this.tooltipContent)return;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=f,this.tooltipElement.style.opacity="0",this.tooltipElement.style.transform="scale(0.95)";const v=this.calculateOptimalPlacement(g,d);this.applyPlacement(v),requestAnimationFrame(()=>{this.tooltipElement&&(this.tooltipElement.style.opacity="1",this.tooltipElement.style.transform="scale(1)")})}calculateOptimalPlacement(f,g){const d=this.tooltipElement.offsetWidth,v=this.tooltipElement.offsetHeight,{innerWidth:y,innerHeight:E}=window,W=4,q={top:{top:g-v-W,left:f-d/2,placement:"top"},bottom:{top:g+W,left:f-d/2,placement:"bottom"},right:{top:g-v/2,left:f+W,placement:"right"},left:{top:g-v/2,left:f-d-W,placement:"left"}};for(const[,H]of Object.entries(q))if(oe.fitsInViewport(H,d,v,y,E))return H;const U=q.top;return U.left=Math.max(W,Math.min(U.left,y-d-W)),U.top=Math.max(W,Math.min(U.top,E-v-W)),U}static fitsInViewport(f,g,d,v,y){return f.top>=0&&f.left>=0&&f.top+d<=y&&f.left+g<=v}applyPlacement(f){this.tooltipElement&&(this.tooltipElement.style.left=`${f.left}px`,this.tooltipElement.style.top=`${f.top}px`)}hide(){this.tooltipElement&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipElement.style.opacity="0",this.tooltipElement.style.transform="scale(0.95)")}destroy(){var f;(f=this.tooltipElement)==null||f.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}function Ne(m,f,g){return $(this,null,function*(){if(!m.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const d=yield Promise.resolve().then(()=>
|
|
19
|
+
`,this.tooltipContent=document.createElement("div"),this.tooltipContent.className="soyio-tooltip-content",this.tooltipElement.appendChild(this.tooltipContent),document.body.appendChild(this.tooltipElement)}show(f,g,d){if(!this.tooltipElement||!this.tooltipContent)return;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipContent.textContent=f,this.tooltipElement.style.opacity="0",this.tooltipElement.style.transform="scale(0.95)";const v=this.calculateOptimalPlacement(g,d);this.applyPlacement(v),requestAnimationFrame(()=>{this.tooltipElement&&(this.tooltipElement.style.opacity="1",this.tooltipElement.style.transform="scale(1)")})}calculateOptimalPlacement(f,g){const d=this.tooltipElement.offsetWidth,v=this.tooltipElement.offsetHeight,{innerWidth:y,innerHeight:E}=window,W=4,q={top:{top:g-v-W,left:f-d/2,placement:"top"},bottom:{top:g+W,left:f-d/2,placement:"bottom"},right:{top:g-v/2,left:f+W,placement:"right"},left:{top:g-v/2,left:f-d-W,placement:"left"}};for(const[,H]of Object.entries(q))if(oe.fitsInViewport(H,d,v,y,E))return H;const U=q.top;return U.left=Math.max(W,Math.min(U.left,y-d-W)),U.top=Math.max(W,Math.min(U.top,E-v-W)),U}static fitsInViewport(f,g,d,v,y){return f.top>=0&&f.left>=0&&f.top+d<=y&&f.left+g<=v}applyPlacement(f){this.tooltipElement&&(this.tooltipElement.style.left=`${f.left}px`,this.tooltipElement.style.top=`${f.top}px`)}hide(){this.tooltipElement&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.tooltipElement.style.opacity="0",this.tooltipElement.style.transform="scale(0.95)")}destroy(){var f;(f=this.tooltipElement)==null||f.remove(),this.tooltipElement=null,this.tooltipContent=null,this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}}function Ne(m,f,g){return $(this,null,function*(){if(!m.contentWindow)throw new Error("Invalid iframe: contentWindow is null");const d=yield Promise.resolve().then(()=>Ue);try{yield d.send(m.contentWindow,"SET_APPEARANCE",{appearance:f,identifier:g})}catch(v){console.error("Failed to send appearance config:",v)}})}const De="IFRAME_READY",de="IFRAME_HEIGHT_CHANGE",Q="TOOLTIP_STATE_CHANGE",fe="INFO_EVENT",$t="CONSENT_STATE_CHANGE",F={onHeightChange:{},onIframeReady:{},onTooltipChange:{},onInfo:{},onStateChange:{}};let Ke,Xe,Qe,et,tt;function Vt(){return $(this,null,function*(){const m=yield Promise.resolve().then(()=>Ue);Ke||Xe||Qe||et||tt||(Ke=m.on(de,f=>$(this,null,function*(){const g=f.data,d=F.onHeightChange[g.identifier];return d&&d(g.height),Promise.resolve()})),Xe=m.on(De,f=>$(this,null,function*(){const g=f.data,d=F.onIframeReady[g.identifier];return d&&d(),Promise.resolve()})),Qe=m.on(Q,f=>$(this,null,function*(){const g=f.data,d=F.onTooltipChange[g.identifier];return d&&d(g),Promise.resolve()})),et=m.on($t,f=>$(this,null,function*(){const g=f.data,d=F.onStateChange[g.identifier];return d&&d(g),Promise.resolve()})),tt=m.on(fe,g=>$(this,[g],function*({data:f}){const E=f,{identifier:d}=E,v=Ht(E,["identifier"]),y=F.onInfo[d];return y&&y(v),Promise.resolve()})))})}function nt(m,f){const{onHeightChange:g,onIframeReady:d,onTooltipChange:v,onStateChange:y,onInfo:E}=f;g&&(F.onHeightChange[m]=g),d&&(F.onIframeReady[m]=d),v&&(F.onTooltipChange[m]=v),y&&(F.onStateChange[m]=y),E&&(F.onInfo[m]=E)}function Jt(m){delete F.onHeightChange[m],delete F.onIframeReady[m],delete F.onTooltipChange[m],delete F.onStateChange[m],delete F.onInfo[m]}function Yt(m){const f=document.getElementById(m);f&&(console.warn("ConsentBox iframe already exists. Removing existing before mounting new one."),f.remove())}function Zt(m){const f=document.querySelector(m);if(!f)throw new Error(`Iframe div container with id '${m}' not found`);if(f.tagName.toLowerCase()!=="div")throw new Error(`Iframe container with id '${m}' must be a <div> element`);const g=f;return g.style.position="relative",g.style.cssText+=`
|
|
20
20
|
padding: 0 !important;
|
|
21
21
|
margin: 0 !important;
|
|
22
22
|
display: flex !important;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
border: none !important;
|
|
26
26
|
transition: height 0.35s !important;
|
|
27
27
|
opacity: 1 !important;
|
|
28
|
-
`,g}function
|
|
28
|
+
`,g}function Kt(m,f,g){const d=document.createElement("iframe");return d.id=f,d.src=m,d.style.cssText+=`
|
|
29
29
|
width: 100% !important;
|
|
30
30
|
min-width: ${g.minWidth} !important;
|
|
31
31
|
border: none !important;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
opacity: 1;
|
|
34
34
|
transition: height 0.35s,
|
|
35
35
|
opacity 0.4s 0.1s;
|
|
36
|
-
`,d}function
|
|
36
|
+
`,d}function Xt(){return Math.random().toString(36).substring(2,10)}const rt="https://app.soyio.id",ot="https://sandbox.soyio.id",Qt="https://privacy.soyio.id",en="https://privacy-sandbox.soyio.id",tn=["DISCLOSURE_REQUEST_SUCCESSFUL","IDENTITY_REGISTERED","IDENTITY_SIGNATURE","UNEXPECTED_ERROR","DENIED_CAMERA_PERMISSION","REJECTED_SIGNATURE","CLOSE_POPUP"],nn="WIDGET_CLOSED",rn=420,on=720,an=500,sn={minWidth:"375px"},un={minWidth:"0px"},cn={minWidth:"375px"};class xe{constructor(f){M(this,"iframe",null);M(this,"skeleton",null);M(this,"options");M(this,"appearance");M(this,"tooltipManager");M(this,"defaultIframeCSSConfig",sn);M(this,"Skeleton",null);M(this,"defaultUniqueId");this.options=f,this.appearance=f.appearance||null,this.tooltipManager=new oe,this.defaultUniqueId=xe.generateUniqueId()}static generateUniqueId(){return Xt()}get uniqueIdentifier(){return this.defaultUniqueId}get iframeIdentifier(){return`${this.defaultIframePrefix}-${this.uniqueIdentifier}`}handleHeightChange(f){if(!this.iframe||(this.iframe.style.height=`${f}px`,f>0))return;const{parentElement:g}=this.iframe;g&&(g.style.display="none")}handleIframeReady(){return $(this,null,function*(){this.iframe&&(this.options.onReady&&this.options.onReady(),yield Ne(this.iframe,this.appearance,this.uniqueIdentifier),this.skeleton&&this.skeleton.hide())})}handleTooltipChange(f){if(!this.iframe)return;const g=this.iframe.getBoundingClientRect(),{text:d,coordinates:v,isVisible:y}=f,E=v.x+g.left,W=v.y+g.top;y?this.tooltipManager.show(d,E,W):this.tooltipManager.hide()}setupListeners(){return $(this,null,function*(){yield Vt();const f={onHeightChange:this.handleHeightChange.bind(this),onIframeReady:this.handleIframeReady.bind(this),onTooltipChange:this.handleTooltipChange.bind(this),onInfo:this.options.onEvent.bind(this)};nt(this.uniqueIdentifier,f)})}mount(f){return $(this,null,function*(){if(!T)return this;yield this.setupListeners(),Yt(this.iframeIdentifier);const g=Zt(f),d=this.iframeUrl();return this.iframe=Kt(d,this.iframeIdentifier,this.defaultIframeCSSConfig),this.Skeleton&&(this.skeleton=new this.Skeleton(this.uniqueIdentifier),this.skeleton.mount(g)),g.appendChild(this.iframe),this})}unmount(){T&&(Jt(this.uniqueIdentifier),this.skeleton&&(this.skeleton.hide(),this.skeleton=null),this.iframe&&(this.iframe.remove(),this.iframe=null))}}class dn{constructor(f){M(this,"element");M(this,"identifier");this.identifier=`skeleton-${f}`,this.element=document.createElement("div"),this.element.id=this.identifier,this.element.style.cssText=`
|
|
37
37
|
position: absolute;
|
|
38
38
|
left: 50%;
|
|
39
39
|
top: 50%;
|
|
@@ -121,24 +121,24 @@
|
|
|
121
121
|
0% { background-position: 200% 0; }
|
|
122
122
|
100% { background-position: -200% 0; }
|
|
123
123
|
}
|
|
124
|
-
`,document.head.appendChild(te)}d.appendChild(v),d.appendChild(y),d.appendChild(E),U.appendChild(H),U.appendChild(he),W.appendChild(q),W.appendChild(U),g.appendChild(d),g.appendChild(W),this.element.appendChild(g)}cleanupExistingSkeleton(){const f=document.getElementById(this.identifier);f&&f.remove()}mount(f){this.cleanupExistingSkeleton(),f.appendChild(this.element)}hide(){this.element.style.opacity="0",setTimeout(()=>this.element.remove(),300)}}function
|
|
124
|
+
`,document.head.appendChild(te)}d.appendChild(v),d.appendChild(y),d.appendChild(E),U.appendChild(H),U.appendChild(he),W.appendChild(q),W.appendChild(U),g.appendChild(d),g.appendChild(W),this.element.appendChild(g)}cleanupExistingSkeleton(){const f=document.getElementById(this.identifier);f&&f.remove()}mount(f){this.cleanupExistingSkeleton(),f.appendChild(this.element)}hide(){this.element.style.opacity="0",setTimeout(()=>this.element.remove(),300)}}const Me="2.13.5";function fn(m){var E;const f=["actionToken","entityId","context","optionalReconsentBehavior","mandatoryReconsentBehavior"],g=(E=m.isSandbox)!=null?E:!1,d=m.developmentUrl||(g?ot:rt),v=new URLSearchParams;v.set("sdkVersion",Me),f.forEach(W=>{m[W]&&v.set(W,m[W])});const y=v.toString();return`${d}/embed/consents/${m.consentTemplateId}${y?`?${y}`:""}`}class je extends xe{constructor(g){super(g);M(this,"defaultIframePrefix","consent-box");M(this,"defaultIframeCSSConfig",un);M(this,"state",{isSelected:!1,actionToken:null});this.Skeleton=dn}get uniqueIdentifier(){return this.options.consentTemplateId}iframeUrl(){return fn(this.options)}handleStateChange(g){const{isSelected:d,actionToken:v}=g;this.state={isSelected:d,actionToken:v},this.options.onEvent({eventName:"CONSENT_CHECKBOX_CHANGE",isSelected:d,actionToken:v})}setupListeners(){return $(this,null,function*(){yield Bt(je.prototype,this,"setupListeners").call(this),nt(this.uniqueIdentifier,{onStateChange:this.handleStateChange.bind(this)})})}getState(){return this.state}}function ln(m){var y,E;const f=(y=m.isSandbox)!=null?y:!1,g=m.developmentUrl||(f?en:Qt),d=new URLSearchParams;d.set("sdkVersion",Me),m.sessionToken?d.set("sessionToken",m.sessionToken):m.companyId&&(d.set("companyId",m.companyId),m.subjectId&&d.set("subjectId",m.subjectId)),(E=m.enabledFeatures)!=null&&E.length&&d.set("enabledFeatures",m.enabledFeatures.join(","));const v=d.toString();return`${g}${v?`?${v}`:""}`}class hn extends xe{constructor(){super(...arguments);M(this,"defaultIframePrefix","privacy-center");M(this,"_uniqueIdentifier","privacy-center");M(this,"defaultIframeCSSConfig",cn)}get uniqueIdentifier(){return this._uniqueIdentifier}iframeUrl(){return ln(this.options)}}const mn=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),pn="WIDGET_EVENT";function vn(m){let f="widget/";return"disclosureRequestId"in m.configProps?f+=["disclosures",m.configProps.disclosureRequestId].join("/"):f+=m.request,f}function wn(m){var y;const f=(y=m.isSandbox)!=null?y:!1,g=m.developmentUrl||(f?ot:rt),d=Object.entries(m.configProps).filter(([E,W])=>W||E==="disclosureRequestId").map(([E,W])=>`${E}=${encodeURIComponent(W)}`).join("&"),v=vn(m);return`${g}/${v}?sdk=web&sdkVersion=${Me}&${d}`}let ee=null,ze=null;function Le(m=null){ee&&!ee.closed&&ee.focus(),m==null||m.preventDefault()}function ke(){document.body.style.filter="",document.body.removeEventListener("click",Le)}function gn(){ze=setInterval(()=>{(!ee||ee.closed)&&(ze&&clearInterval(ze),ke())},an)}function yn(m){const f=wn(m),g=rn,d=on,v=window.screenLeft!==void 0?window.screenLeft:window.screenX,y=window.screenTop!==void 0?window.screenTop:window.screenY,E=window.innerWidth||document.documentElement.clientWidth||window.screen.width,W=window.innerHeight||document.documentElement.clientHeight||window.screen.height,q=E/window.screen.availWidth,U=(E-g)/2/q+v,H=(W-d)/2/q+y;document.body.style.filter="blur(5px)",document.body.addEventListener("click",Le),ee=window.open(f,"Soyio",`scrollbars=yes,
|
|
125
125
|
width=${g},
|
|
126
126
|
height=${d},
|
|
127
127
|
top=${H},
|
|
128
|
-
left=${U}`),
|
|
129
|
-
`;function W(e){return e===void 0&&(e=window),e.location.protocol}function q(e){if(e===void 0&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return W(e)}function U(e){return e===void 0&&(e=window),q(e)==="about:"}function H(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(n){}}function he(e){if(e===void 0&&(e=window),e&&!H(e))try{return e.opener}catch(n){}}function te(e){try{return!0}catch(n){}return!1}function We(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=W(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=H(e);return r&&te()?We(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function B(e){e===void 0&&(e=window);var n=We(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function ie(e){if(!function(n){try{if(n===window)return!0}catch(r){}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch(r){}try{if(U(n)&&te())return!0}catch(r){}try{if(function(r){return r===void 0&&(r=window),q(r)==="mock:"}(n)&&te())return!0}catch(r){}try{if(We(n)===We(window))return!0}catch(r){}return!1}(e))return!1;try{if(e===window||U(e)&&te()||B(window)===B(e))return!0}catch(n){}return!1}function Pe(e){if(!ie(e))throw new Error("Expected window to be same domain");return e}function ut(e,n){if(!e||!n)return!1;var t=H(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch(i){}return o}(n).indexOf(e)!==-1}function ct(e){var n=[],t;try{t=e.frames}catch(u){t=e}var r;try{r=t.length}catch(u){}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(u){continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch(u){return n}if(!c)return n;n.push(c)}return n}var Pn=[],Cn=[];function Z(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch(o){return!0}try{if(!e)return!0}catch(o){return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==E}if(n&&ie(e))try{if(e.mockclosed)return!0}catch(o){}try{if(!e.parent||!e.top)return!0}catch(o){}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch(c){}return-1}(Pn,e);if(t!==-1){var r=Cn[t];if(r&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(r))return!0}return!1}function dt(e){return e===void 0&&(e=window),he(e=e||window)||H(e)||void 0}function ce(e,n){if(typeof e=="string"){if(typeof n=="string")return e==="*"||n===e;if(y(n)||Array.isArray(n))return!1}return y(e)?y(n)?e.toString()===n.toString():!Array.isArray(n)&&!!n.match(e):!!Array.isArray(e)&&(Array.isArray(n)?JSON.stringify(e)===JSON.stringify(n):!y(n)&&e.some(function(t){return ce(t,n)}))}function Ce(e){try{if(e===window)return!0}catch(n){if(n&&n.message===E)return!0}try{if({}.toString.call(e)==="[object Window]")return!0}catch(n){if(n&&n.message===E)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.self===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.parent===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.top===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch(n){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(n){}return!1}function ft(e){if(ie(e))return Pe(e).frameElement;for(var n=0,t=document.querySelectorAll("iframe");n<t.length;n++){var r=t[n];if(r&&r.contentWindow&&r.contentWindow===e)return r}}function Tn(e){if(function(t){return t===void 0&&(t=window),!!H(t)}(e)){var n=ft(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch(t){}}function ae(e){try{if(!e)return!1;if(typeof Promise!="undefined"&&e instanceof Promise)return!0;if(typeof window!="undefined"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window!="undefined"&&typeof window.constructor=="function"&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var t=n.call(e);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof e.then=="function")return!0}catch(r){return!1}return!1}var lt=[],me=[],Ue=0,pe;function ht(){if(!Ue&&pe){var e=pe;pe=null,e.resolve()}}function Fe(){Ue+=1}function ve(){Ue-=1,ht()}var O=function(){function e(t){var r=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var o,i,a=!1,c=!1,u=!1;Fe();try{t(function(s){u?r.resolve(s):(a=!0,o=s)},function(s){u?r.reject(s):(c=!0,i=s)})}catch(s){ve(),this.reject(s);return}ve(),u=!0,a?this.resolve(o):c&&this.reject(i)}}var n=e.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(ae(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},n.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(ae(t))throw new Error("Can not reject promise with another promise");if(!t){var o=t&&typeof t.toString=="function"?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(lt.indexOf(i)===-1){lt.push(i),setTimeout(function(){throw i},1);for(var c=0;c<me.length;c++)me[c](i,a)}}(t,r)},1),this.dispatch(),this},n.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},n.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,Fe();for(var i=function(w,x){return w.then(function(S){x.resolve(S)},function(S){x.reject(S)})},a=0;a<o.length;a++){var c=o[a],u=c.onSuccess,s=c.onError,p=c.promise,l=void 0;if(t)try{l=u?u(this.value):this.value}catch(w){p.reject(w);continue}else if(r){if(!s){p.reject(this.error);continue}try{l=s(this.error)}catch(w){p.reject(w);continue}}if(l instanceof e&&(l.resolved||l.rejected)){var h=l;h.resolved?p.resolve(h.value):p.reject(h.error),h.errorHandled=!0}else ae(l)?l instanceof e&&(l.resolved||l.rejected)?l.resolved?p.resolve(l.value):p.reject(l.error):i(l,p):p.resolve(l)}o.length=0,this.dispatching=!1,ve()}},n.then=function(t,r){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new e;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},n.catch=function(t){return this.then(void 0,t)},n.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},n.timeout=function(t,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},n.toPromise=function(){if(typeof Promise=="undefined")throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:ae(t)?new e(function(r,o){return t.then(r,o)}):new e().resolve(t)},e.reject=function(t){return new e().reject(t)},e.asyncReject=function(t){return new e().asyncReject(t)},e.all=function(t){var r=new e,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(s,p,l){return p.then(function(h){i[s]=h,(o-=1)==0&&r.resolve(i)},function(h){l.reject(h)})},c=0;c<t.length;c++){var u=t[c];if(u instanceof e){if(u.resolved){i[c]=u.value,o-=1;continue}}else if(!ae(u)){i[c]=u,o-=1;continue}a(c,e.resolve(u),r)}return o===0&&r.resolve(i),r},e.hash=function(t){var r={},o=[],i=function(c){if(t.hasOwnProperty(c)){var u=t[c];ae(u)?o.push(u.then(function(s){r[c]=s})):r[c]=u}};for(var a in t)i(a);return e.all(o).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(t){return function(r){return me.push(r),{cancel:function(){me.splice(me.indexOf(r),1)}}}(t)},e.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;Fe();try{i=t.apply(r,o||[])}catch(a){return ve(),e.reject(a)}return ve(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||ae(t)},e.flush=function(){return function(t){var r=pe=pe||new t;return ht(),r}(e)},e}();function Te(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch(r){}return-1}var He=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if(typeof WeakMap=="undefined"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch(o){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}var n=e.prototype;return n._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(Ce(i)&&Z(i)){if(t)try{t.delete(i)}catch(a){}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!Ce(t)},n.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch(p){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch(p){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=Te(c,t);s===-1?(c.push(t),u.push(r)):u[s]=r},n.get=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return r.get(t)}catch(a){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch(a){}this._cleanupClosedWindows();var i=Te(this.keys,t);if(i!==-1)return this.values[i]},n.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch(c){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch(c){}this._cleanupClosedWindows();var i=this.keys,a=Te(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},n.has=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return!0}catch(i){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch(i){}return this._cleanupClosedWindows(),Te(this.keys,t)!==-1},n.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},e}();function mt(e){return e.name||e.__name__||e.displayName||"anonymous"}function pt(e,n){try{delete e.name,e.name=n}catch(t){}return e.__name__=e.displayName=n,e}function X(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(n){if(typeof btoa=="function")return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer!="undefined")return Buffer.from(n,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Oe;function vt(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(Oe=Oe||new He,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Oe.get(r);return o||(o=typeof r+":"+X(),Oe.set(r,o)),o}(t)+"]":typeof window!="undefined"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function On(){return{}}var we=0,wt=0;function ge(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,c=we;we+=1;var u=function(){for(var s=arguments.length,p=new Array(s),l=0;l<s;l++)p[l]=arguments[l];c<wt&&(i=null,a=null,c=we,we+=1);var h;h=r?(a=a||new He).getOrSet(this,On):i=i||{};var w;try{w=vt(p)}catch(R){return e.apply(this,arguments)}var x=h[w];if(x&&o&&Date.now()-x.time<o&&(delete h[w],x=null),x)return x.value;var S=Date.now(),b=e.apply(this,arguments);return h[w]={time:S,value:b},b};return u.reset=function(){i=null,a=null},pt(u,(n.name||mt(e))+"::memoized")}ge.clear=function(){wt=we};function Rn(e){var n={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),c=0;c<i;c++)a[c]=arguments[c];var u=vt(a);return n.hasOwnProperty(u)||(n[u]=O.try(function(){return e.apply(o,r)}).finally(function(){delete n[u]})),n[u]}return t.reset=function(){n={}},pt(t,mt(e)+"::promiseMemoized")}function se(){}function ye(e,n){if(n===void 0&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if(typeof e=="string")return e;if(e instanceof Error){var t=e&&e.stack,r=e&&e.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
|
|
130
|
-
`+t;if(t)return t;if(r)return r}return e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}catch(o){return"Error while stringifying error: "+ye(o,n+1)}}function
|
|
128
|
+
left=${U}`),Le(),gn()}function En(){ee&&(ee.close(),ee=null),ke()}let le=null;function Sn(){le&&(le.cancel(),le=null)}function bn(m){return $(this,null,function*(){const{onEvent:f}=m,g=yield Promise.resolve().then(()=>Ue);le&&Sn(),le=g.on(pn,v=>$(this,[v],function*({data:d}){return f(d),tn.includes(d.eventName)?En():d.eventName===nn&&ke(),Promise.resolve()}))})}function xn(m){bn(m)}class it{constructor(f){_t(this,Ie);M(this,"onEvent");this.onEvent=f.onEvent,T&&(yn(f),xn({onEvent:qt(this,Ie,Gt).bind(this)}))}}Ie=new WeakSet,Gt=function(f){this.onEvent(f)};var In=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Wn(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var at={exports:{}},st={exports:{}};(function(m,f){(function(g,d){m.exports=d()})(typeof self!="undefined"?self:In,function(){return function(g){var d={};function v(y){if(d[y])return d[y].exports;var E=d[y]={i:y,l:!1,exports:{}};return g[y].call(E.exports,E,E.exports,v),E.l=!0,E.exports}return v.m=g,v.c=d,v.d=function(y,E,W){v.o(y,E)||Object.defineProperty(y,E,{enumerable:!0,get:W})},v.r=function(y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(y,"__esModule",{value:!0})},v.t=function(y,E){if(1&E&&(y=v(y)),8&E||4&E&&typeof y=="object"&&y&&y.__esModule)return y;var W=Object.create(null);if(v.r(W),Object.defineProperty(W,"default",{enumerable:!0,value:y}),2&E&&typeof y!="string")for(var q in y)v.d(W,q,function(U){return y[U]}.bind(null,q));return W},v.n=function(y){var E=y&&y.__esModule?function(){return y.default}:function(){return y};return v.d(E,"a",E),E},v.o=function(y,E){return{}.hasOwnProperty.call(y,E)},v.p="",v(v.s=0)}([function(g,d,v){v.r(d),v.d(d,"Promise",function(){return O}),v.d(d,"TYPES",function(){return Jn}),v.d(d,"ProxyWindow",function(){return Y}),v.d(d,"setup",function(){return Ut}),v.d(d,"destroy",function(){return Vn}),v.d(d,"serializeMessage",function(){return qn}),v.d(d,"deserializeMessage",function(){return Bn}),v.d(d,"createProxyWindow",function(){return Gn}),v.d(d,"toProxyWindow",function(){return $n}),v.d(d,"on",function(){return ne}),v.d(d,"once",function(){return _n}),v.d(d,"send",function(){return re}),v.d(d,"markWindowKnown",function(){return Ct}),v.d(d,"cleanUpWindow",function(){return Yn}),v.d(d,"bridge",function(){});function y(e){return{}.toString.call(e)==="[object RegExp]"}var E=`Call was rejected by callee.\r
|
|
129
|
+
`;function W(e){return e===void 0&&(e=window),e.location.protocol}function q(e){if(e===void 0&&(e=window),e.mockDomain){var n=e.mockDomain.split("//")[0];if(n)return n}return W(e)}function U(e){return e===void 0&&(e=window),q(e)==="about:"}function H(e){if(e===void 0&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(n){}}function he(e){if(e===void 0&&(e=window),e&&!H(e))try{return e.opener}catch(n){}}function te(e){try{return!0}catch(n){}return!1}function We(e){e===void 0&&(e=window);var n=e.location;if(!n)throw new Error("Can not read window location");var t=W(e);if(!t)throw new Error("Can not read window protocol");if(t==="file:")return"file://";if(t==="about:"){var r=H(e);return r&&te()?We(r):"about://"}var o=n.host;if(!o)throw new Error("Can not read window host");return t+"//"+o}function B(e){e===void 0&&(e=window);var n=We(e);return n&&e.mockDomain&&e.mockDomain.indexOf("mock:")===0?e.mockDomain:n}function ie(e){if(!function(n){try{if(n===window)return!0}catch(r){}try{var t=Object.getOwnPropertyDescriptor(n,"location");if(t&&t.enumerable===!1)return!1}catch(r){}try{if(U(n)&&te())return!0}catch(r){}try{if(function(r){return r===void 0&&(r=window),q(r)==="mock:"}(n)&&te())return!0}catch(r){}try{if(We(n)===We(window))return!0}catch(r){}return!1}(e))return!1;try{if(e===window||U(e)&&te()||B(window)===B(e))return!0}catch(n){}return!1}function Pe(e){if(!ie(e))throw new Error("Expected window to be same domain");return e}function ct(e,n){if(!e||!n)return!1;var t=H(n);return t?t===e:function(r){var o=[];try{for(;r.parent!==r;)o.push(r.parent),r=r.parent}catch(i){}return o}(n).indexOf(e)!==-1}function dt(e){var n=[],t;try{t=e.frames}catch(u){t=e}var r;try{r=t.length}catch(u){}if(r===0)return n;if(r){for(var o=0;o<r;o++){var i=void 0;try{i=t[o]}catch(u){continue}n.push(i)}return n}for(var a=0;a<100;a++){var c=void 0;try{c=t[a]}catch(u){return n}if(!c)return n;n.push(c)}return n}var Cn=[],Tn=[];function Z(e,n){n===void 0&&(n=!0);try{if(e===window)return!1}catch(o){return!0}try{if(!e)return!0}catch(o){return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==E}if(n&&ie(e))try{if(e.mockclosed)return!0}catch(o){}try{if(!e.parent||!e.top)return!0}catch(o){}var t=function(o,i){for(var a=0;a<o.length;a++)try{if(o[a]===i)return a}catch(c){}return-1}(Cn,e);if(t!==-1){var r=Tn[t];if(r&&function(o){if(!o.contentWindow||!o.parentNode)return!0;var i=o.ownerDocument;if(i&&i.documentElement&&!i.documentElement.contains(o)){for(var a=o;a.parentNode&&a.parentNode!==a;)a=a.parentNode;if(!a.host||!i.documentElement.contains(a.host))return!0}return!1}(r))return!0}return!1}function ft(e){return e===void 0&&(e=window),he(e=e||window)||H(e)||void 0}function ce(e,n){if(typeof e=="string"){if(typeof n=="string")return e==="*"||n===e;if(y(n)||Array.isArray(n))return!1}return y(e)?y(n)?e.toString()===n.toString():!Array.isArray(n)&&!!n.match(e):!!Array.isArray(e)&&(Array.isArray(n)?JSON.stringify(e)===JSON.stringify(n):!y(n)&&e.some(function(t){return ce(t,n)}))}function Ce(e){try{if(e===window)return!0}catch(n){if(n&&n.message===E)return!0}try{if({}.toString.call(e)==="[object Window]")return!0}catch(n){if(n&&n.message===E)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.self===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.parent===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.top===e)return!0}catch(n){if(n&&n.message===E)return!0}try{if(e&&e.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch(n){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(n){}return!1}function lt(e){if(ie(e))return Pe(e).frameElement;for(var n=0,t=document.querySelectorAll("iframe");n<t.length;n++){var r=t[n];if(r&&r.contentWindow&&r.contentWindow===e)return r}}function On(e){if(function(t){return t===void 0&&(t=window),!!H(t)}(e)){var n=lt(e);if(n&&n.parentElement){n.parentElement.removeChild(n);return}}try{e.close()}catch(t){}}function ae(e){try{if(!e)return!1;if(typeof Promise!="undefined"&&e instanceof Promise)return!0;if(typeof window!="undefined"&&typeof window.Window=="function"&&e instanceof window.Window||typeof window!="undefined"&&typeof window.constructor=="function"&&e instanceof window.constructor)return!1;var n={}.toString;if(n){var t=n.call(e);if(t==="[object Window]"||t==="[object global]"||t==="[object DOMWindow]")return!1}if(typeof e.then=="function")return!0}catch(r){return!1}return!1}var ht=[],me=[],Fe=0,pe;function mt(){if(!Fe&&pe){var e=pe;pe=null,e.resolve()}}function He(){Fe+=1}function ve(){Fe-=1,mt()}var O=function(){function e(t){var r=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],t){var o,i,a=!1,c=!1,u=!1;He();try{t(function(s){u?r.resolve(s):(a=!0,o=s)},function(s){u?r.reject(s):(c=!0,i=s)})}catch(s){ve(),this.reject(s);return}ve(),u=!0,a?this.resolve(o):c&&this.reject(i)}}var n=e.prototype;return n.resolve=function(t){if(this.resolved||this.rejected)return this;if(ae(t))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=t,this.dispatch(),this},n.reject=function(t){var r=this;if(this.resolved||this.rejected)return this;if(ae(t))throw new Error("Can not reject promise with another promise");if(!t){var o=t&&typeof t.toString=="function"?t.toString():{}.toString.call(t);t=new Error("Expected reject to be called with Error, got "+o)}return this.rejected=!0,this.error=t,this.errorHandled||setTimeout(function(){r.errorHandled||function(i,a){if(ht.indexOf(i)===-1){ht.push(i),setTimeout(function(){throw i},1);for(var c=0;c<me.length;c++)me[c](i,a)}}(t,r)},1),this.dispatch(),this},n.asyncReject=function(t){return this.errorHandled=!0,this.reject(t),this},n.dispatch=function(){var t=this.resolved,r=this.rejected,o=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,He();for(var i=function(w,x){return w.then(function(S){x.resolve(S)},function(S){x.reject(S)})},a=0;a<o.length;a++){var c=o[a],u=c.onSuccess,s=c.onError,p=c.promise,l=void 0;if(t)try{l=u?u(this.value):this.value}catch(w){p.reject(w);continue}else if(r){if(!s){p.reject(this.error);continue}try{l=s(this.error)}catch(w){p.reject(w);continue}}if(l instanceof e&&(l.resolved||l.rejected)){var h=l;h.resolved?p.resolve(h.value):p.reject(h.error),h.errorHandled=!0}else ae(l)?l instanceof e&&(l.resolved||l.rejected)?l.resolved?p.resolve(l.value):p.reject(l.error):i(l,p):p.resolve(l)}o.length=0,this.dispatching=!1,ve()}},n.then=function(t,r){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&typeof r!="function"&&!r.call)throw new Error("Promise.then expected a function for error handler");var o=new e;return this.handlers.push({promise:o,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),o},n.catch=function(t){return this.then(void 0,t)},n.finally=function(t){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},n.timeout=function(t,r){var o=this;if(this.resolved||this.rejected)return this;var i=setTimeout(function(){o.resolved||o.rejected||o.reject(r||new Error("Promise timed out after "+t+"ms"))},t);return this.then(function(a){return clearTimeout(i),a})},n.toPromise=function(){if(typeof Promise=="undefined")throw new TypeError("Could not find Promise");return Promise.resolve(this)},n.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:ae(t)?new e(function(r,o){return t.then(r,o)}):new e().resolve(t)},e.reject=function(t){return new e().reject(t)},e.asyncReject=function(t){return new e().asyncReject(t)},e.all=function(t){var r=new e,o=t.length,i=[].slice();if(!o)return r.resolve(i),r;for(var a=function(s,p,l){return p.then(function(h){i[s]=h,(o-=1)==0&&r.resolve(i)},function(h){l.reject(h)})},c=0;c<t.length;c++){var u=t[c];if(u instanceof e){if(u.resolved){i[c]=u.value,o-=1;continue}}else if(!ae(u)){i[c]=u,o-=1;continue}a(c,e.resolve(u),r)}return o===0&&r.resolve(i),r},e.hash=function(t){var r={},o=[],i=function(c){if(t.hasOwnProperty(c)){var u=t[c];ae(u)?o.push(u.then(function(s){r[c]=s})):r[c]=u}};for(var a in t)i(a);return e.all(o).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(t){return function(r){return me.push(r),{cancel:function(){me.splice(me.indexOf(r),1)}}}(t)},e.try=function(t,r,o){if(t&&typeof t!="function"&&!t.call)throw new Error("Promise.try expected a function");var i;He();try{i=t.apply(r,o||[])}catch(a){return ve(),e.reject(a)}return ve(),e.resolve(i)},e.delay=function(t){return new e(function(r){setTimeout(r,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||ae(t)},e.flush=function(){return function(t){var r=pe=pe||new t;return mt(),r}(e)},e}();function Te(e,n){for(var t=0;t<e.length;t++)try{if(e[t]===n)return t}catch(r){}return-1}var _e=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if(typeof WeakMap=="undefined"||Object.freeze===void 0)return!1;try{var t=new WeakMap,r={};return Object.freeze(r),t.set(r,"__testvalue__"),t.get(r)==="__testvalue__"}catch(o){return!1}}())try{this.weakmap=new WeakMap}catch(t){}this.keys=[],this.values=[]}var n=e.prototype;return n._cleanupClosedWindows=function(){for(var t=this.weakmap,r=this.keys,o=0;o<r.length;o++){var i=r[o];if(Ce(i)&&Z(i)){if(t)try{t.delete(i)}catch(a){}r.splice(o,1),this.values.splice(o,1),o-=1}}},n.isSafeToReadWrite=function(t){return!Ce(t)},n.set=function(t,r){if(!t)throw new Error("WeakMap expected key");var o=this.weakmap;if(o)try{o.set(t,r)}catch(p){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var i=this.name,a=t[i];a&&a[0]===t?a[1]=r:Object.defineProperty(t,i,{value:[t,r],writable:!0});return}catch(p){}this._cleanupClosedWindows();var c=this.keys,u=this.values,s=Te(c,t);s===-1?(c.push(t),u.push(r)):u[s]=r},n.get=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return r.get(t)}catch(a){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return o&&o[0]===t?o[1]:void 0}catch(a){}this._cleanupClosedWindows();var i=Te(this.keys,t);if(i!==-1)return this.values[i]},n.delete=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.delete(t)}catch(c){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];o&&o[0]===t&&(o[0]=o[1]=void 0)}catch(c){}this._cleanupClosedWindows();var i=this.keys,a=Te(i,t);a!==-1&&(i.splice(a,1),this.values.splice(a,1))},n.has=function(t){if(!t)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{if(r.has(t))return!0}catch(i){delete this.weakmap}if(this.isSafeToReadWrite(t))try{var o=t[this.name];return!(!o||o[0]!==t)}catch(i){}return this._cleanupClosedWindows(),Te(this.keys,t)!==-1},n.getOrSet=function(t,r){if(this.has(t))return this.get(t);var o=r();return this.set(t,o),o},e}();function pt(e){return e.name||e.__name__||e.displayName||"anonymous"}function vt(e,n){try{delete e.name,e.name=n}catch(t){}return e.__name__=e.displayName=n,e}function X(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(n){if(typeof btoa=="function")return btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,function(t,r){return String.fromCharCode(parseInt(r,16))})).replace(/[=]/g,"");if(typeof Buffer!="undefined")return Buffer.from(n,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var Oe;function wt(e){try{return JSON.stringify([].slice.call(e),function(n,t){return typeof t=="function"?"memoize["+function(r){if(Oe=Oe||new _e,r==null||typeof r!="object"&&typeof r!="function")throw new Error("Invalid object");var o=Oe.get(r);return o||(o=typeof r+":"+X(),Oe.set(r,o)),o}(t)+"]":typeof window!="undefined"&&t instanceof window.Element||t!==null&&typeof t=="object"&&t.nodeType===1&&typeof t.style=="object"&&typeof t.ownerDocument=="object"?{}:t})}catch(n){throw new Error("Arguments not serializable -- can not be used to memoize")}}function Rn(){return{}}var we=0,gt=0;function ge(e,n){n===void 0&&(n={});var t=n.thisNamespace,r=t!==void 0&&t,o=n.time,i,a,c=we;we+=1;var u=function(){for(var s=arguments.length,p=new Array(s),l=0;l<s;l++)p[l]=arguments[l];c<gt&&(i=null,a=null,c=we,we+=1);var h;h=r?(a=a||new _e).getOrSet(this,Rn):i=i||{};var w;try{w=wt(p)}catch(R){return e.apply(this,arguments)}var x=h[w];if(x&&o&&Date.now()-x.time<o&&(delete h[w],x=null),x)return x.value;var S=Date.now(),b=e.apply(this,arguments);return h[w]={time:S,value:b},b};return u.reset=function(){i=null,a=null},vt(u,(n.name||pt(e))+"::memoized")}ge.clear=function(){gt=we};function An(e){var n={};function t(){for(var r=arguments,o=this,i=arguments.length,a=new Array(i),c=0;c<i;c++)a[c]=arguments[c];var u=wt(a);return n.hasOwnProperty(u)||(n[u]=O.try(function(){return e.apply(o,r)}).finally(function(){delete n[u]})),n[u]}return t.reset=function(){n={}},vt(t,pt(e)+"::promiseMemoized")}function se(){}function ye(e,n){if(n===void 0&&(n=1),n>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if(typeof e=="string")return e;if(e instanceof Error){var t=e&&e.stack,r=e&&e.message;if(t&&r)return t.indexOf(r)!==-1?t:r+`
|
|
130
|
+
`+t;if(t)return t;if(r)return r}return e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}catch(o){return"Error while stringifying error: "+ye(o,n+1)}}function yt(e){return typeof e=="string"?e:e&&e.toString&&typeof e.toString=="function"?e.toString():{}.toString.call(e)}ge(function(e){if(Object.values)return Object.values(e);var n=[];for(var t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n});function qe(e){return{}.toString.call(e)==="[object RegExp]"}function Ee(e,n,t){if(e.hasOwnProperty(n))return e[n];var r=t();return e[n]=r,r}function Et(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function St(){return!!document.body&&document.readyState==="complete"}function bt(){return!!document.body&&document.readyState==="interactive"}ge(function(){return new O(function(e){if(St()||bt())return e();var n=setInterval(function(){if(St()||bt())return clearInterval(n),e()},10)})});var Re=typeof document!="undefined"?document.currentScript:null,Nn=ge(function(){if(Re||(Re=function(){try{var e=function(){try{throw new Error("_")}catch(a){return a.stack||""}}(),n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),t=n&&n[1];if(!t)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===t)return i}}catch(a){}}()))return Re;throw new Error("Can not determine current script")}),Dn=X();ge(function(){var e;try{e=Nn()}catch(r){return Dn}var n=e.getAttribute("data-uid");if(n&&typeof n=="string"||(n=e.getAttribute("data-uid-auto"))&&typeof n=="string")return n;if(e.src){var t=function(r){for(var o="",i=0;i<r.length;i++){var a=r[i].charCodeAt(0)*i;r[i+1]&&(a+=r[i+1].charCodeAt(0)*(i-1)),o+=String.fromCharCode(97+Math.abs(a)%26)}return o}(JSON.stringify({src:e.src,dataset:e.dataset}));n="uid_"+t.slice(t.length-30)}else n=X();return e.setAttribute("data-uid-auto",n),n});function Se(e){e===void 0&&(e=window);var n="__post_robot_10_0_46__";return e!==window?e[n]:e[n]=e[n]||{}}var xt=function(){return{}};function L(e,n){return e===void 0&&(e="store"),n===void 0&&(n=xt),Ee(Se(),e,function(){var t=n();return{has:function(r){return t.hasOwnProperty(r)},get:function(r,o){return t.hasOwnProperty(r)?t[r]:o},set:function(r,o){return t[r]=o,o},del:function(r){delete t[r]},getOrSet:function(r,o){return Ee(t,r,o)},reset:function(){t=n()},keys:function(){return Object.keys(t)}}})}var Mn=function(){};function Ae(){var e=Se();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new Mn,e.WINDOW_WILDCARD}function G(e,n){return e===void 0&&(e="store"),n===void 0&&(n=xt),L("windowStore").getOrSet(e,function(){var t=new _e,r=function(o){return t.getOrSet(o,n)};return{has:function(o){return r(o).hasOwnProperty(e)},get:function(o,i){var a=r(o);return a.hasOwnProperty(e)?a[e]:i},set:function(o,i){return r(o)[e]=i,i},del:function(o){delete r(o)[e]},getOrSet:function(o,i){return Ee(r(o),e,i)}}})}function It(){return L("instance").getOrSet("instanceID",X)}function Wt(e,n){var t=n.domain,r=G("helloPromises"),o=r.get(e);o&&o.resolve({domain:t});var i=O.resolve({domain:t});return r.set(e,i),i}function Be(e,n){return(0,n.send)(e,"postrobot_hello",{instanceID:It()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,o=t.data.instanceID;return Wt(e,{domain:r}),{win:e,domain:r,instanceID:o}})}function Pt(e,n){var t=n.send;return G("windowInstanceIDPromises").getOrSet(e,function(){return Be(e,{send:t}).then(function(r){return r.instanceID})})}function Ct(e){G("knownWindows").set(e,!0)}function Ge(e){return typeof e=="object"&&e!==null&&typeof e.__type__=="string"}function Tt(e){return e===void 0?"undefined":e===null?"null":Array.isArray(e)?"array":typeof e=="function"?"function":typeof e=="object"?e instanceof Error?"error":typeof e.then=="function"?"promise":{}.toString.call(e)==="[object RegExp]"?"regex":{}.toString.call(e)==="[object Date]"?"date":"object":typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":void 0}function ue(e,n){return{__type__:e,__val__:n}}var V,jn=((V={}).function=function(){},V.error=function(e){return ue("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},V.promise=function(){},V.regex=function(e){return ue("regex",e.source)},V.date=function(e){return ue("date",e.toJSON())},V.array=function(e){return e},V.object=function(e){return e},V.string=function(e){return e},V.number=function(e){return e},V.boolean=function(e){return e},V.null=function(e){return e},V[void 0]=function(e){return ue("undefined",e)},V),zn={},J,Ln=((J={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},J.error=function(e){var n=e.stack,t=e.code,r=e.data,o=new Error(e.message);return o.code=t,r&&(o.data=r),o.stack=n+`
|
|
131
131
|
|
|
132
|
-
`+o.stack,o},J.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},J.regex=function(e){return new RegExp(e)},J.date=function(e){return new Date(e)},J.array=function(e){return e},J.object=function(e){return e},J.string=function(e){return e},J.number=function(e){return e},J.boolean=function(e){return e},J.null=function(e){return e},J[void 0]=function(){},J),
|
|
132
|
+
`+o.stack,o},J.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},J.regex=function(e){return new RegExp(e)},J.date=function(e){return new Date(e)},J.array=function(e){return e},J.object=function(e){return e},J.string=function(e){return e},J.number=function(e){return e},J.boolean=function(e){return e},J.null=function(e){return e},J[void 0]=function(){},J),kn={};new O(function(e){if(window.document&&window.document.body)return e(window.document.body);var n=setInterval(function(){if(window.document&&window.document.body)return clearInterval(n),e(window.document.body)},10)});function $e(){for(var e=L("idToProxyWindow"),n=0,t=e.keys();n<t.length;n++){var r=t[n];e.get(r).shouldClean()&&e.del(r)}}function Ot(e,n){var t=n.send,r=n.id,o=r===void 0?X():r,i=e.then(function(u){if(ie(u))return Pe(u).name}),a=e.then(function(u){if(Z(u))throw new Error("Window is closed, can not determine type");return he(u)?"popup":"iframe"});i.catch(se),a.catch(se);var c=function(){return e.then(function(u){if(!Z(u))return ie(u)?Pe(u).name:i})};return{id:o,getType:function(){return a},getInstanceID:An(function(){return e.then(function(u){return Pt(u,{send:t})})}),close:function(){return e.then(On)},getName:c,focus:function(){return e.then(function(u){u.focus()})},isClosed:function(){return e.then(function(u){return Z(u)})},setLocation:function(u,s){return s===void 0&&(s={}),e.then(function(p){var l=window.location.protocol+"//"+window.location.host,h=s.method,w=h===void 0?"get":h,x=s.body;if(u.indexOf("/")===0)u=""+l+u;else if(!u.match(/^https?:\/\//)&&u.indexOf(l)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(u));if(w==="post")return c().then(function(S){if(!S)throw new Error("Can not post to window without target name");(function(b){var R=b.url,z=b.target,N=b.body,A=b.method,k=A===void 0?"post":A,P=document.createElement("form");if(P.setAttribute("target",z),P.setAttribute("method",k),P.setAttribute("action",R),P.style.display="none",N)for(var D=0,K=Object.keys(N);D<K.length;D++){var j,be=K[D],Ze=document.createElement("input");Ze.setAttribute("name",be),Ze.setAttribute("value",(j=N[be])==null?void 0:j.toString()),P.appendChild(Ze)}Et().appendChild(P),P.submit(),Et().removeChild(P)})({url:u,target:S,method:w,body:x})});if(w!=="get")throw new Error("Unsupported method: "+w);if(ie(p))try{if(p.location&&typeof p.location.replace=="function"){p.location.replace(u);return}}catch(S){}p.location=u})},setName:function(u){return e.then(function(s){var p=ie(s),l=lt(s);if(!p)throw new Error("Can not set name for cross-domain window: "+u);Pe(s).name=u,l&&l.setAttribute("name",u),i=O.resolve(u)})}}}var Y=function(){function e(t){var r=t.send,o=t.win,i=t.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new O,this.serializedWindow=i||Ot(this.actualWindowPromise,{send:r}),L("idToProxyWindow").set(this.getID(),this),o&&this.setWindow(o,{send:r})}var n=e.prototype;return n.getID=function(){return this.serializedWindow.id},n.getType=function(){return this.serializedWindow.getType()},n.isPopup=function(){return this.getType().then(function(t){return t==="popup"})},n.setLocation=function(t,r){var o=this;return this.serializedWindow.setLocation(t,r).then(function(){return o})},n.getName=function(){return this.serializedWindow.getName()},n.setName=function(t){var r=this;return this.serializedWindow.setName(t).then(function(){return r})},n.close=function(){var t=this;return this.serializedWindow.close().then(function(){return t})},n.focus=function(){var t=this,r=this.isPopup(),o=this.getName(),i=O.hash({isPopup:r,name:o}).then(function(c){var u=c.name;c.isPopup&&u&&window.open("",u,"noopener")}),a=this.serializedWindow.focus();return O.all([i,a]).then(function(){return t})},n.isClosed=function(){return this.serializedWindow.isClosed()},n.getWindow=function(){return this.actualWindow},n.setWindow=function(t,r){var o=r.send;this.actualWindow=t,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=Ot(this.actualWindowPromise,{send:o,id:this.getID()}),G("winToProxyWindow").set(t,this)},n.awaitWindow=function(){return this.actualWindowPromise},n.matchWindow=function(t,r){var o=this,i=r.send;return O.try(function(){return o.actualWindow?t===o.actualWindow:O.hash({proxyInstanceID:o.getInstanceID(),knownWindowInstanceID:Pt(t,{send:i})}).then(function(a){var c=a.proxyInstanceID===a.knownWindowInstanceID;return c&&o.setWindow(t,{send:i}),c})})},n.unwrap=function(){return this.actualWindow||this},n.getInstanceID=function(){return this.serializedWindow.getInstanceID()},n.shouldClean=function(){return!!(this.actualWindow&&Z(this.actualWindow))},n.serialize=function(){return this.serializedWindow},e.unwrap=function(t){return e.isProxyWindow(t)?t.unwrap():t},e.serialize=function(t,r){var o=r.send;return $e(),e.toProxyWindow(t,{send:o}).serialize()},e.deserialize=function(t,r){var o=r.send;return $e(),L("idToProxyWindow").get(t.id)||new e({serializedWindow:t,send:o})},e.isProxyWindow=function(t){return!!(t&&!Ce(t)&&t.isProxyWindow)},e.toProxyWindow=function(t,r){var o=r.send;if($e(),e.isProxyWindow(t))return t;var i=t;return G("winToProxyWindow").get(i)||new e({win:i,send:o})},e}();function Ve(e,n,t,r,o){var i=G("methodStore"),a=L("proxyWindowMethods");Y.isProxyWindow(r)?a.set(e,{val:n,name:t,domain:o,source:r}):(a.del(e),i.getOrSet(r,function(){return{}})[e]={domain:o,name:t,val:n,source:r})}function Rt(e,n){var t=G("methodStore"),r=L("proxyWindowMethods");return t.getOrSet(e,function(){return{}})[n]||r.get(n)}function At(e,n,t,r,o){a=(i={on:o.on,send:o.send}).on,c=i.send,L("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(p){var l=p.source,h=p.origin,w=p.data,x=w.id,S=w.name,b=Rt(l,x);if(!b)throw new Error("Could not find method '"+S+"' with id: "+w.id+" in "+B(window));var R=b.source,z=b.domain,N=b.val;return O.try(function(){if(!ce(z,h))throw new Error("Method '"+w.name+"' domain "+JSON.stringify(qe(b.domain)?b.domain.source:b.domain)+" does not match origin "+h+" in "+B(window));if(Y.isProxyWindow(R))return R.matchWindow(l,{send:c}).then(function(A){if(!A)throw new Error("Method call '"+w.name+"' failed - proxy window does not match source in "+B(window))})}).then(function(){return N.apply({source:l,origin:h},w.args)},function(A){return O.try(function(){if(N.onError)return N.onError(A)}).then(function(){throw A.stack&&(A.stack="Remote call to "+S+"("+function(k){return k===void 0&&(k=[]),(P=k,[].slice.call(P)).map(function(D){return typeof D=="string"?"'"+D+"'":D===void 0?"undefined":D===null?"null":typeof D=="boolean"?D.toString():Array.isArray(D)?"[ ... ]":typeof D=="object"?"{ ... }":typeof D=="function"?"() => { ... }":"<"+typeof D+">"}).join(", ");var P}(w.args)+`) failed
|
|
133
133
|
|
|
134
|
-
`+A.stack),A})}).then(function(A){return{result:A,id:x,name:S}})})});var i,a,c,u=t.__id__||X();e=Y.unwrap(e);var s=t.__name__||t.name||r;return typeof s=="string"&&typeof s.indexOf=="function"&&s.indexOf("anonymous::")===0&&(s=s.replace("anonymous::",r+"::")),Y.isProxyWindow(e)?(
|
|
134
|
+
`+A.stack),A})}).then(function(A){return{result:A,id:x,name:S}})})});var i,a,c,u=t.__id__||X();e=Y.unwrap(e);var s=t.__name__||t.name||r;return typeof s=="string"&&typeof s.indexOf=="function"&&s.indexOf("anonymous::")===0&&(s=s.replace("anonymous::",r+"::")),Y.isProxyWindow(e)?(Ve(u,t,s,e,n),e.awaitWindow().then(function(p){Ve(u,t,s,p,n)})):Ve(u,t,s,e,n),ue("cross_domain_function",{id:u,name:s})}function Nt(e,n,t,r){var o,i=r.on,a=r.send;return function(c,u){u===void 0&&(u=zn);var s=JSON.stringify(c,function(p){var l=this[p];if(Ge(this))return l;var h=Tt(l);if(!h)return l;var w=u[h]||jn[h];return w?w(l,p):l});return s===void 0?"undefined":s}(t,((o={}).promise=function(c,u){return function(s,p,l,h,w){return ue("cross_domain_zalgo_promise",{then:At(s,p,function(x,S){return l.then(x,S)},h,{on:w.on,send:w.send})})}(e,n,c,u,{on:i,send:a})},o.function=function(c,u){return At(e,n,c,u,{on:i,send:a})},o.object=function(c){return Ce(c)||Y.isProxyWindow(c)?ue("cross_domain_window",Y.serialize(c,{send:a})):c},o))}function Dt(e,n,t,r){var o,i=r.send;return function(a,c){if(c===void 0&&(c=kn),a!=="undefined")return JSON.parse(a,function(u,s){if(Ge(this))return s;var p,l;if(Ge(s)?(p=s.__type__,l=s.__val__):(p=Tt(s),l=s),!p)return l;var h=c[p]||Ln[p];return h?h(l,u):l})}(t,((o={}).cross_domain_zalgo_promise=function(a){return function(c,u,s){return new O(s.then)}(0,0,a)},o.cross_domain_function=function(a){return function(c,u,s,p){var l=s.id,h=s.name,w=p.send,x=function(b){b===void 0&&(b={});function R(){var z=arguments;return Y.toProxyWindow(c,{send:w}).awaitWindow().then(function(N){var A=Rt(N,l);if(A&&A.val!==R)return A.val.apply({source:window,origin:B()},z);var k=[].slice.call(z);return b.fireAndForget?w(N,"postrobot_method",{id:l,name:h,args:k},{domain:u,fireAndForget:!0}):w(N,"postrobot_method",{id:l,name:h,args:k},{domain:u,fireAndForget:!1}).then(function(P){return P.data.result})}).catch(function(N){throw N})}return R.__name__=h,R.__origin__=u,R.__source__=c,R.__id__=l,R.origin=u,R},S=x();return S.fireAndForget=x({fireAndForget:!0}),S}(e,n,a,{send:i})},o.cross_domain_window=function(a){return Y.deserialize(a,{send:i})},o))}var Je={};Je.postrobot_post_message=function(e,n,t){t.indexOf("file:")===0&&(t="*"),e.postMessage(n,t)};function Ye(e,n,t,r){var o=r.on,i=r.send;return O.try(function(){var a=G().getOrSet(e,function(){return{}});return a.buffer=a.buffer||[],a.buffer.push(t),a.flush=a.flush||O.flush().then(function(){if(Z(e))throw new Error("Window is closed");var c=Nt(e,n,((u={}).__post_robot_10_0_46__=a.buffer||[],u),{on:o,send:i}),u;delete a.buffer;for(var s=Object.keys(Je),p=[],l=0;l<s.length;l++){var h=s[l];try{Je[h](e,c,n)}catch(w){p.push(w)}}if(p.length===s.length)throw new Error(`All post-robot messaging strategies failed:
|
|
135
135
|
|
|
136
136
|
`+p.map(function(w,x){return x+". "+ye(w)}).join(`
|
|
137
137
|
|
|
138
|
-
`))}),a.flush.then(function(){delete a.flush})}).then(se)}function
|
|
138
|
+
`))}),a.flush.then(function(){delete a.flush})}).then(se)}function Mt(e){return L("responseListeners").get(e)}function jt(e){L("responseListeners").del(e)}function zt(e){return L("erroredResponseListeners").has(e)}function Lt(e){var n=e.name,t=e.win,r=e.domain,o=G("requestListeners");if(t==="*"&&(t=null),r==="*"&&(r=null),!n)throw new Error("Name required to get request listener");for(var i=0,a=[t,Ae()];i<a.length;i++){var c=a[i];if(c){var u=o.get(c);if(u){var s=u[n];if(s){if(r&&typeof r=="string"){if(s[r])return s[r];if(s.__domain_regex__)for(var p=0,l=s.__domain_regex__;p<l.length;p++){var h=l[p],w=h.listener;if(ce(h.regex,r))return w}}if(s["*"])return s["*"]}}}}}function Un(e,n,t,r){var o=r.on,i=r.send,a=Lt({name:t.name,win:e,domain:n}),c=t.name==="postrobot_method"&&t.data&&typeof t.data.name=="string"?t.data.name+"()":t.name;function u(s,p,l){return O.flush().then(function(){if(!t.fireAndForget&&!Z(e))try{return Ye(e,n,{id:X(),origin:B(window),type:"postrobot_message_response",hash:t.hash,name:t.name,ack:s,data:p,error:l},{on:o,send:i})}catch(h){throw new Error("Send response message failed for "+c+" in "+B()+`
|
|
139
139
|
|
|
140
|
-
`+ye(h))}})}return O.all([O.flush().then(function(){if(!t.fireAndForget&&!Z(e))try{return
|
|
140
|
+
`+ye(h))}})}return O.all([O.flush().then(function(){if(!t.fireAndForget&&!Z(e))try{return Ye(e,n,{id:X(),origin:B(window),type:"postrobot_message_ack",hash:t.hash,name:t.name},{on:o,send:i})}catch(s){throw new Error("Send ack message failed for "+c+" in "+B()+`
|
|
141
141
|
|
|
142
|
-
`+ye(s))}}),O.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:e,origin:n,data:t.data})}).then(function(s){return u("success",s)},function(s){return u("error",null,s)})]).then(se).catch(function(s){if(a&&a.handleError)return a.handleError(s);throw s})}function
|
|
142
|
+
`+ye(s))}}),O.try(function(){if(!a)throw new Error("No handler found for post message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:e,origin:n,data:t.data})}).then(function(s){return u("success",s)},function(s){return u("error",null,s)})]).then(se).catch(function(s){if(a&&a.handleError)return a.handleError(s);throw s})}function Fn(e,n,t){if(!zt(t.hash)){var r=Mt(t.hash);if(!r)throw new Error("No handler found for post message ack for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!ce(r.domain,n))throw new Error("Ack origin "+n+" does not match domain "+r.domain.toString());if(e!==r.win)throw new Error("Ack source does not match registered window")}catch(o){r.promise.reject(o)}r.ack=!0}}function Hn(e,n,t){if(!zt(t.hash)){var r=Mt(t.hash);if(!r)throw new Error("No handler found for post message response for message: "+t.name+" from "+n+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!ce(r.domain,n))throw new Error("Response origin "+n+" does not match domain "+(o=r.domain,Array.isArray(o)?"("+o.join(" | ")+")":y(o)?"RegExp("+o.toString()+")":o.toString()));var o;if(e!==r.win)throw new Error("Response source does not match registered window");jt(t.hash),t.ack==="error"?r.promise.reject(t.error):t.ack==="success"&&r.promise.resolve({source:e,origin:n,data:t.data})}}function kt(e,n){var t=n.on,r=n.send,o=L("receivedMessages");try{if(!window||window.closed||!e.source)return}catch(p){return}var i=e.source,a=e.origin,c=function(p,l,h,w){var x=w.on,S=w.send,b;try{b=Dt(l,h,p,{on:x,send:S})}catch(z){return}if(b&&typeof b=="object"&&b!==null){var R=b.__post_robot_10_0_46__;if(Array.isArray(R))return R}}(e.data,i,a,{on:t,send:r});if(c){Ct(i);for(var u=0;u<c.length;u++){var s=c[u];if(o.has(s.id)||(o.set(s.id,!0),Z(i)&&!s.fireAndForget))return;s.origin.indexOf("file:")===0&&(a="file://");try{s.type==="postrobot_message_request"?Un(i,a,s,{on:t,send:r}):s.type==="postrobot_message_response"?Hn(i,a,s):s.type==="postrobot_message_ack"&&Fn(i,a,s)}catch(p){setTimeout(function(){throw p},0)}}}}function ne(e,n,t){if(!e)throw new Error("Expected name");if(typeof(n=n||{})=="function"&&(t=n,n={}),!t)throw new Error("Expected handler");var r=function o(i,a){var c=i.name,u=i.win,s=i.domain,p=G("requestListeners");if(!c||typeof c!="string")throw new Error("Name required to add request listener");if(u&&u!=="*"&&Y.isProxyWindow(u)){var l=u.awaitWindow().then(function(j){return o({name:c,win:j,domain:s},a)});return{cancel:function(){l.then(function(j){return j.cancel()},se)}}}var h=u;if(Array.isArray(h)){for(var w=[],x=0,S=h;x<S.length;x++)w.push(o({name:c,domain:s,win:S[x]},a));return{cancel:function(){for(var j=0;j<w.length;j++)w[j].cancel()}}}if(Array.isArray(s)){for(var b=[],R=0,z=s;R<z.length;R++)b.push(o({name:c,win:h,domain:z[R]},a));return{cancel:function(){for(var j=0;j<b.length;j++)b[j].cancel()}}}var N=Lt({name:c,win:h,domain:s});h&&h!=="*"||(h=Ae());var A=(s=s||"*").toString();if(N)throw h&&s?new Error("Request listener already exists for "+c+" on domain "+s.toString()+" for "+(h===Ae()?"wildcard":"specified")+" window"):h?new Error("Request listener already exists for "+c+" for "+(h===Ae()?"wildcard":"specified")+" window"):s?new Error("Request listener already exists for "+c+" on domain "+s.toString()):new Error("Request listener already exists for "+c);var k=p.getOrSet(h,function(){return{}}),P=Ee(k,c,function(){return{}}),D,K;return qe(s)?(D=Ee(P,"__domain_regex__",function(){return[]})).push(K={regex:s,listener:a}):P[A]=a,{cancel:function(){delete P[A],K&&(D.splice(D.indexOf(K,1)),D.length||delete P.__domain_regex__),Object.keys(P).length||delete k[c],h&&!Object.keys(k).length&&p.del(h)}}}({name:e,win:n.window,domain:n.domain||"*"},{handler:t||n.handler,handleError:n.errorHandler||function(o){throw o}});return{cancel:function(){r.cancel()}}}function _n(e,n,t){typeof(n=n||{})=="function"&&(t=n,n={});var r=new O,o;return n.errorHandler=function(i){o.cancel(),r.reject(i)},o=ne(e,n,function(i){if(o.cancel(),r.resolve(i),t)return t(i)}),r.cancel=o.cancel,r}var re=function e(n,t,r,o){var i=(o=o||{}).domain||"*",a=o.timeout||-1,c=o.timeout||5e3,u=o.fireAndForget||!1;return Y.toProxyWindow(n,{send:e}).awaitWindow().then(function(s){return O.try(function(){if(function(p,l,h){if(!p)throw new Error("Expected name");if(h&&typeof h!="string"&&!Array.isArray(h)&&!qe(h))throw new TypeError("Can not send "+p+". Expected domain "+JSON.stringify(h)+" to be a string, array, or regex");if(Z(l))throw new Error("Can not send "+p+". Target window is closed")}(t,s,i),function(p,l){var h=ft(l);if(h)return h===p;if(l===p||function(S){S===void 0&&(S=window);try{if(S.top)return S.top}catch(N){}if(H(S)===S)return S;try{if(ct(window,S)&&window.top)return window.top}catch(N){}try{if(ct(S,window)&&window.top)return window.top}catch(N){}for(var b=0,R=function N(A){for(var k=[],P=0,D=dt(A);P<D.length;P++){var K=D[P];k.push(K);for(var j=0,be=N(K);j<be.length;j++)k.push(be[j])}return k}(S);b<R.length;b++){var z=R[b];try{if(z.top)return z.top}catch(N){}if(H(z)===z)return z}}(l)===l)return!1;for(var w=0,x=dt(p);w<x.length;w++)if(x[w]===l)return!0;return!1}(window,s))return function(p,l,h){l===void 0&&(l=5e3),h===void 0&&(h="Window");var w=function(x){return G("helloPromises").getOrSet(x,function(){return new O})}(p);return l!==-1&&(w=w.timeout(l,new Error(h+" did not load after "+l+"ms"))),w}(s,c)}).then(function(p){return function(l,h,w,x){var S=x.send;return O.try(function(){return typeof h=="string"?h:O.try(function(){return w||Be(l,{send:S}).then(function(b){return b.domain})}).then(function(b){if(!ce(h,h))throw new Error("Domain "+yt(h)+" does not match "+yt(h));return b})})}(s,i,(p===void 0?{}:p).domain,{send:e})}).then(function(p){var l=p,h=t==="postrobot_method"&&r&&typeof r.name=="string"?r.name+"()":t,w=new O,x=t+"_"+X();if(!u){var S={name:t,win:s,domain:l,promise:w};(function(P,D){L("responseListeners").set(P,D)})(x,S);var b=G("requestPromises").getOrSet(s,function(){return[]});b.push(w),w.catch(function(){(function(P){L("erroredResponseListeners").set(P,!0)})(x),jt(x)});var R=function(P){return G("knownWindows").get(P,!1)}(s)?1e4:2e3,z=a,N=R,A=z,k=function(P,D){var K;return function j(){K=setTimeout(function(){(function(){if(Z(s))return w.reject(new Error("Window closed for "+t+" before "+(S.ack?"response":"ack")));if(S.cancelled)return w.reject(new Error("Response listener was cancelled for "+t));N=Math.max(N-500,0),A!==-1&&(A=Math.max(A-500,0)),S.ack||N!==0?A===0&&w.reject(new Error("No response for postMessage "+h+" in "+B()+" in "+z+"ms")):w.reject(new Error("No ack for postMessage "+h+" in "+B()+" in "+R+"ms"))})(),j()},500)}(),{cancel:function(){clearTimeout(K)}}}();w.finally(function(){k.cancel(),b.splice(b.indexOf(w,1))}).catch(se)}return Ye(s,l,{id:X(),origin:B(window),type:"postrobot_message_request",hash:x,name:t,data:r,fireAndForget:u},{on:ne,send:e}).then(function(){return u?w.resolve():w},function(P){throw new Error("Send request message failed for "+h+" in "+B()+`
|
|
143
143
|
|
|
144
|
-
`+ye(P))})})})};function
|
|
144
|
+
`+ye(P))})})})};function qn(e,n,t){return Nt(e,n,t,{on:ne,send:re})}function Bn(e,n,t){return Dt(e,n,t,{on:ne,send:re})}function Gn(e){return new Y({send:re,win:e})}function $n(e){return Y.toProxyWindow(e,{send:re})}function Ut(){Se().initialized||(Se().initialized=!0,n=(e={on:ne,send:re}).on,t=e.send,(r=Se()).receiveMessage=r.receiveMessage||function(o){return kt(o,{on:n,send:t})},function(o){var i=o.on,a=o.send;L().getOrSet("postMessageListener",function(){return function(c,u,s){return c.addEventListener("message",s),{cancel:function(){c.removeEventListener("message",s)}}}(window,0,function(c){(function(u,s){var p=s.on,l=s.send;O.try(function(){var h=u.source||u.sourceElement,w=u.origin||u.originalEvent&&u.originalEvent.origin,x=u.data;if(w==="null"&&(w="file://"),h){if(!w)throw new Error("Post message did not have origin domain");kt({source:h,origin:w,data:x},{on:p,send:l})}})})(c,{on:i,send:a})})})}({on:ne,send:re}),function(o){var i=o.on,a=o.send;L("builtinListeners").getOrSet("helloListener",function(){var c=i("postrobot_hello",{domain:"*"},function(s){return Wt(s.source,{domain:s.origin}),{instanceID:It()}}),u=ft();return u&&Be(u,{send:a}).catch(function(s){}),c})}({on:ne,send:re}));var e,n,t,r}function Vn(){(function(){for(var n=L("responseListeners"),t=0,r=n.keys();t<r.length;t++){var o=r[t],i=n.get(o);i&&(i.cancelled=!0),n.del(o)}})(),(e=L().get("postMessageListener"))&&e.cancel();var e;delete window.__post_robot_10_0_46__}var Jn=!0;function Yn(e){for(var n=0,t=G("requestPromises").get(e,[]);n<t.length;n++)t[n].reject(new Error("Window "+(Z(e)?"closed":"cleaned up")+" before response")).catch(se)}Ut()}])})})(st);var Pn=st.exports;(function(m){m.exports=Pn,m.exports.default=m.exports})(at);var ut=at.exports;const Ue=C({__proto__:null,default:Wn(ut)},[ut]);I.ConsentBox=je,I.PrivacyCenterBox=hn,I.SoyioTypes=mn,I.SoyioWidget=it,I._TooltipManager=oe,I.default=it,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyio/soyio-widget",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"post-robot": "^10.0.46",
|
|
44
|
-
"vite": "^5.
|
|
44
|
+
"vite": "^5.1.8",
|
|
45
45
|
"vite-plugin-dts": "^3.6.4"
|
|
46
46
|
}
|
|
47
47
|
}
|