UNPKG

23.4 kBJavaScriptView Raw
1/* Partytown 0.2.1 - MIT builder.io */
2(e=>{const t=()=>!0,r=e=>e.length,n=e=>{try{return e.constructor.name}catch(e){}return""},s=(e,t)=>e.startsWith(t),o=e=>!(s(e,"webkit")||s(e,"toJSON")||s(e,"constructor")||s(e,"toString")||s(e,"_")),i=()=>Math.round(999999999*Math.random()+4),a=Symbol(),c=Symbol(),l=new Map,u=new Map,h={},p=new WeakMap,d=(e,t,r)=>e?e===e.window?0:"#document"===(r=e.nodeName)?1:"HTML"===r?2:"HEAD"===r?3:"BODY"===r?4:("number"!=typeof(t=e[a])&&g(e,t=i()),t):-1,m=(e,t,r,n,s)=>{if((r=h[e])&&(n=r.H))return s=n.document,0===t?n:1===t?s:2===t?s.documentElement:3===t?s.head:4===t?s.body:l.get(t)},g=(e,t,r)=>{e&&(l.set(t,e),e[a]=t,e[c]=r=Date.now(),r>f+5e3&&(l.forEach(((e,t)=>{e[c]<f&&e.nodeType&&!e.isConnected&&l.delete(t)})),f=r))};let f=0;const w=e.parent,y=document,$=w.partytown||{},v=($.lib||"/~partytown/")+"",b=(e,t,r,o,i)=>void 0!==t&&(o=typeof t)?"string"===o||"number"===o||"boolean"===o||null==t?[0,t]:"function"===o?[6]:(r=r||new Set)&&Array.isArray(t)?r.has(t)?[1,[]]:r.add(t)&&[1,t.map((t=>b(e,t,r)))]:"object"===o?""===(i=n(t))?[2,{}]:"Window"===i?[3,{I:e,q:0}]:"HTMLCollection"===i||"NodeList"===i?[7,Array.from(t).map((t=>b(e,t,r)[1]))]:"Event"===i?[5,S(e,t,r)]:"CSSRuleList"===i?[12,Array.from(t).map(I)]:s(i,"CSS")&&i.endsWith("Rule")?[11,I(t)]:"CSSStyleDeclaration"===i?[13,S(e,t,r)]:"Attr"===i?[10,[t.name,t.value]]:t.nodeType?[3,{I:e,q:d(t),x:t.nodeName}]:[2,S(e,t,r,!0,!0)]:void 0:t,S=(e,t,r,n,s,i,a,c)=>{if(i={},!r.has(t))for(a in r.add(t),t)o(a)&&(c=t[a],(n||"function"!=typeof c)&&(s||""!==c)&&(i[a]=b(e,c,r)));return i},I=e=>{let t,r={};for(t in e)x.includes(t)&&(r[t]=e[t]);return r},T=(t,r,n,s)=>r?(n=r[0],s=r[1],0===n?s:4===n?E(t,s):1===n?s.map((e=>T(t,e))):3===n?m(s.I,s.q):5===n?N(L(t,s)):2===n?L(t,s):8===n?s:9===n?new e[r[2]](s):void 0):void 0,E=(e,{I:t,q:r,B:n},s)=>((s=u.get(n))||(s=function(...s){const o={q:r,B:n,F:b(t,this),b:b(t,s)};e.postMessage([7,o])},u.set(n,s)),s),N=e=>new("detail"in e?CustomEvent:Event)(e.type,e),L=(e,t,r,n)=>{for(n in r={},t)r[n]=T(e,t[n]);return r},x="cssText,selectorText,href,media,namespaceURI,prefix,name,conditionText".split(","),A=async(e,t)=>{let n,s,o,i,a,c={w:t.w},l=r(t.E),u=0;for(;u<l;u++)try{n=t.E[u],s=n.I,o=n.a,h[s]||await new Promise((e=>{let t=0,r=()=>{h[s]||t++>999?e():setTimeout(r,9)};r()})),1===o[0]&&o[1]in h[s].H?g(new h[s].H[o[1]](...T(e,o[2])),n.q):(i=m(s,n.q),i?(a=M(e,i,o,n.n),n.c&&g(a,n.c),"object"==typeof(p=a)&&p&&p.then&&(a=await a,c.s=!0),c.C=b(s,a)):c.l=n.q+" not found")}catch(e){u===l-1?c.l=String(e.stack||e):console.error(e)}var p;return c},M=(e,t,n,s)=>{let o,i,a,c,l,u=0,h=r(n);for(;u<h;u++){i=n[u],o=n[u+1],a=n[u-1];try{if(!Array.isArray(o))if("string"==typeof i||"number"==typeof i){if(u+1===h&&s)return l={},s.map((e=>l[e]=t[e])),l;t=t[i]}else{if(0===o)return void(t[a]=T(e,i));if("function"==typeof t[a]&&(c=T(e,i),"insertRule"===a&&c[1]>r(t.cssRules)&&(c[1]=r(t.cssRules)),t=t[a].apply(t,c),"play"===a))return Promise.resolve()}}catch(e){console.debug(e)}}return t},O=(e,t,r)=>{if(!p.has(r)){p.set(r,t);const n=r.document,s=r.history,o={I:t,z:p.get(r.parent),G:n.baseURI},i=()=>e.postMessage([3,o]),a=s.pushState.bind(s),c=s.replaceState.bind(s),l=()=>setTimeout((()=>e.postMessage([11,t,n.baseURI])));s.pushState=(e,t,r)=>{a(e,t,r),l()},s.replaceState=(e,t,r)=>{c(e,t,r),l()},r.addEventListener("popstate",l),r.addEventListener("hashchange",l),h[t]={I:t,H:r},"complete"===n.readyState?i():r.addEventListener("load",i)}},C=(e,t)=>{let n,s,o=t.I,i=t.H,a=i.document,c=a.querySelector('script[type="text/partytown"]:not([data-ptid]):not([data-pterror]):not([async]):not([defer])');c||(c=a.querySelector('script[type="text/partytown"]:not([data-ptid]):not([data-pterror])')),c?(c.dataset.ptid=n=d(c,o),s={I:o,q:n},c.src?(s.G=c.src,s.y=c.dataset.ptsrc||c.src):s.g=c.innerHTML,e.postMessage([6,s])):t.r||(t.r=1,((e,t,n)=>{let s,o,i=n._ptf,a=(n.partytown||{}).forward||[],c=(r,n)=>e.postMessage([8,{I:t,m:r,b:b(t,Array.from(n))}]);if(n._ptf=void 0,a.map((e=>{o=n,e.split(".").map(((e,t,n)=>{o=o[n[t]]=t+1<r(n)?o[n[t]]||("push"===n[t+1]?[]:{}):(...e)=>c(n,e)}))})),i)for(s=0;s<r(i);s+=2)c(i[s],i[s+1])})(e,o,i),a.dispatchEvent(new CustomEvent("pt0")),e.postMessage([4,o]))},j=(e,t,r)=>{let n=[],s=[e,"Object",n];for(r in t)P(n,t,r);return s},D=(e,t,r,s,o)=>{if("Object"!==t&&!e.some((e=>e[0]===t))){const i=Object.getPrototypeOf(r),a=n(i),c=[];D(e,a,i,s,o),Object.keys(Object.getOwnPropertyDescriptors(r)).map((e=>P(c,s,e))),e.push([t,a,c,o,s.nodeName])}},P=(e,t,r,s,i,a)=>{try{o(r)&&isNaN(r[0])&&"all"!==r&&("function"==(i=typeof(s=t[r]))?(String(s).includes("[native")||Object.getPrototypeOf(t)[r])&&e.push([r,5]):"object"===i&&null!=s?"Object"!==(a=n(s))&&self[a]&&e.push([r,s.nodeType||a]):"symbol"!==i&&(r.toUpperCase()===r?e.push([r,6,s]):e.push([r,6])))}catch(e){console.warn(e)}},R={Anchor:"A",DList:"DL",Image:"IMG",OList:"OL",Paragraph:"P",TableCaption:"CAPTION",TableCell:"TD",TableCol:"COLGROUP",TableRow:"TR",TableSection:"TBODY",UList:"UL"},H=e=>{let t,n=[],s=0,o=r(w[e]);for(;s<o;s++)t=w[e].key(s),n.push([t,w[e].getItem(t)]);return n};let U;(async e=>{const r=new SharedArrayBuffer(1073741824),s=new Int32Array(r);return(o,a)=>{const c=a[0],l=a[1];if(0===c){const e=(()=>{const e=y.implementation.createHTMLDocument(),r=e.createTextNode(""),s=e.createComment(""),o=e.createDocumentFragment(),i=e.createElementNS("http://www.w3.org/2000/svg","svg"),a=new MutationObserver(t),c=new ResizeObserver(t),l=w.performance,u=w.screen,h=Object.getOwnPropertyNames(w).filter((e=>/^HTML.+Element$/.test(e))).map((t=>{return[e.createElement((r=t,r=r.slice(4).replace("Element",""),R[r]||r))];var r})),p=h[0][0],d=[[w.history],[l],[l.navigation],[l.timing],[u],[u.orientation],[a,12],[c,12],[r],[s],[o],[p],[p.attributes],[p.classList],[p.dataset],[p.style],[i],[e],[e.doctype],...h].filter((e=>e[0])).map((e=>{const t=e[0],r=e[1],s=n(t);return[s,w[s].prototype,t,r]})),m=[j("Window",w),j("Node",r)],g={f:JSON.stringify($,((e,t)=>("function"==typeof t&&(t=String(t)).startsWith(e+"(")&&(t="function "+t),t))),t:new URL(v,w.location)+"",p:m,u:H("localStorage"),D:H("sessionStorage")};return d.map((([e,t,r,n])=>D(m,e,t,r,n))),g})();e.$sharedDataBuffer$=r,o.postMessage([1,e])}else 9===c?e(l,(e=>{const t=JSON.stringify(e),r=t.length;for(let e=0;e<r;e++)s[e+1]=t.charCodeAt(e);s[0]=r,Atomics.notify(s,0)})):((e,t,r)=>{2===t[0]?O(e,i(),w):(r=h[t[1]])&&(6===t[0]?C(e,r):5===t[0]&&((e,t,r,n,s)=>{(s=t.H.document.querySelector(`[data-ptid="${r}"]`))&&(n?s.dataset.pterror=n:s.type+="-x"),C(e,t)})(e,r,t[2],t[3]))})(o,a)}})(((e,t)=>A(U,e).then(t))).then((e=>{e&&(U=new Worker(URL.createObjectURL(new Blob(['/* Partytown 0.2.1 - MIT builder.io */\n(e=>{const t=Symbol(),r=Symbol(),n=Symbol(),s=Symbol(),i=Symbol(),o=Symbol(),a=Symbol(),c=Symbol(),l=new Map,u={},h=new WeakMap,$={},d=new Map,p={},g={},m=new Map,f=new Map,w=e=>e.split(","),y=w("clientWidth,clientHeight,clientTop,clientLeft,innerWidth,innerHeight,offsetWidth,offsetHeight,offsetTop,offsetLeft,outerWidth,outerHeight,pageXOffset,pageYOffset,scrollWidth,scrollHeight,scrollTop,scrollLeft"),I=w("childNodes,firstChild,isConnected,lastChild,nextSibling,parentElement,parentNode,previousSibling"),v=w("childElementCount,children,firstElementChild,lastElementChild,nextElementSibling,previousElementSibling"),S=w("insertBefore,remove,removeChild,replaceChild"),b=w("className,width,height,hidden,innerHTML,innerText,textContent"),T=w("setAttribute,setProperty"),E=w("getClientRects,getBoundingClientRect"),N=["getComputedStyle"],M=w("addEventListener,dispatchEvent,removeEventListener"),x=()=>!0,C=e=>e.length,L=e=>{try{return e.constructor.name}catch(e){}return""},A=[],P=()=>Math.round(999999999*Math.random()+4),W="text/partytown",H=(e,t,r)=>Object.defineProperty(e,t,{...r,configurable:!0}),R=(e,t)=>H(e,"name",{value:t}),O=(e,t,r)=>H(e.prototype,t,r),D=(e,t)=>Object.defineProperties(e.prototype,t),B=(e,t,r)=>O(e,t,{value:r,writable:!0}),k=(e,t)=>t in e[o],j=(e,t)=>e[o][t],U=(e,t,r)=>e[o][t]=r,F=[];let _=0;const V=(e,n,s,o,a,c,l)=>{if(l={I:e[t],q:e[r],a:[...e[i],...n],c:o,n:a},3===s)p.A([10,{w:P(),E:[l]}],c?[c instanceof ArrayBuffer?c:c.buffer]:void 0);else{if(F.push(l),1===s)return z(!0);_=setTimeout(z,20)}},z=e=>{if(clearTimeout(_),C(F)){const t=F[C(F)-1],r={w:P(),E:F.slice()};if(F.length=0,e){const e=((e,t)=>{const r=e.$sharedDataBuffer$,n=new Int32Array(r);Atomics.store(n,0,0),e.A([9,t]),Atomics.wait(n,0,0);let s=Atomics.load(n,0),i="",o=0;for(;o<s;o++)i+=String.fromCharCode(n[o+1]);return JSON.parse(i)})(p,r),n=e.s,s=Le(t.I,t.q,t.a,e.C);if(e.l){if(n)return Promise.reject(e.l);throw new Error(e.l)}return n?Promise.resolve(s):s}p.A([10,r])}},q=(e,t,r,n)=>p.f.get&&(n=p.f.get(G(e,t)))!==a?n:n=V(e,t,1,void 0,r),J=(e,t,r,n)=>{if(p.f.set){if((n=p.f.set({value:r,prevent:c,...G(e,t)}))===c)return;n!==a&&(r=n)}b.some((e=>t.includes(e)))&&(m.clear(),t[t.length-1]),t=[...t,Ce(e,r),0],V(e,t,2)},X=(e,t,r,n,s,i,o,c)=>p.f.apply&&(o=p.f.apply({args:r,...G(e,t)}))!==a?o:(c=t[C(t)-1],t=[...t,Ce(e,r)],n=n||1,"setAttribute"===c&&k(e,r[0])?U(e,r[0],r[1]):S.includes(c)?(m.clear(),f.clear()):T.includes(c)&&(n=2,m.clear()),o=V(e,t,n,s,void 0,i)),Y=(e,t,r)=>{V(e,[1,t,Ce(e,r)],1)},G=(e,t)=>({name:t.join("."),continue:a,nodeName:e[n],constructor:L(e)}),K=(e,t,r)=>{let n,s,i=e=>r.findIndex((t=>t[Q]===e)),o={getItem:e=>(n=i(e),n>-1?r[n][Z]:null),setItem(s,o){n=i(s),n>-1?r[n][Z]=o:r.push([s,o]),X(e,[t,"setItem"],[s,o],2)},removeItem(s){n=i(s),n>-1&&r.splice(n,1),X(e,[t,"removeItem"],[s],2)},key:e=>(s=r[e],s?s[Q]:null),clear(){r.length=0,X(e,[t,"clear"],A,2)},get length(){return r.length}};e[t]=o},Q=0,Z=1;class ee{constructor(e,a,c,l,u){this[t]=e,this[r]=a,this[i]=c||[],this[n]=l,this[o]={},u&&(this[s]=u)}}class te extends ee{}M.map((e=>te.prototype[e]=function(...t){return X(this,[e],t,2)}));class re extends ee{constructor(e,t,r,n){return super(e,t,r,n),new Proxy(this,{get:(e,t)=>q(e,[t]),set:(e,t,r)=>(J(e,[t],r),!0)})}}const ne=()=>(e.ptm||(e.ptm=[q,J,X,Y,D,P,ee,te,t,r,i],p.$importScripts$(p.t+"partytown-media.js")),e.ptm),se=w("AUDIO,CANVAS,VIDEO"),ie=w("Audio,MediaSource"),oe=(e,t,r,n,s)=>((s=l.get(t))||(s=ae(e,t,r,n),l.set(t,s)),s),ae=(t,r,n,s)=>(se.includes(n)&&ne(),new($[n]?$[n]:n.includes("-")?$.UNKNOWN:e.HTMLElement)(t,r,[],n,s)),ce=(e,t,r,n,s)=>{try{e.h=t,le(e,r)}catch(e){console.error(r,e),s=String(e.stack||e)}return e.h=-1,s},le=(e,t,r)=>new Function(`with(this){${t.replace(/\\bthis\\b/g,"thi$(this)").replace(/\\/\\/# so/g,"//Xso")};function thi$(t){return t===this?window:t}}`+(r?"\\n//# sourceURL="+r:"")).call(e.H),ue=(e,t,r)=>{(r=j(e,t))&&setTimeout((()=>r.map((e=>e({type:t})))))},he=(e,t,r,n)=>{for(n=e.v;!n.host&&(n=(e=g[e.z]).v,e.I!==e.z););const s=new URL(t||"",n);if(!r&&p.f.resolveUrl){const e=p.f.resolveUrl(s,n);if(e)return e}return s},$e=(e,t,r)=>he(e,t,r)+"",de=e=>he(we(e),j(e,4)),pe=()=>`<script src=${JSON.stringify(p.t+"partytown.js")} async><\\/script>`,ge=e=>class{constructor(){this.s="",this.l=[],this.e=[]}get src(){return this.s}set src(t){fetch($e(e,t,!0),{mode:"no-cors",keepalive:!0}).then((e=>{e.ok||0===e.status?this.l.map((e=>e({type:"load"}))):this.e.map((e=>e({type:"error"})))}),(()=>this.e.forEach((e=>e({type:"error"})))))}addEventListener(e,t){"load"===e&&this.l.push(t),"error"===e&&this.e.push(t)}get onload(){return this.l[0]}set onload(e){this.l=[e]}get onerror(){return this.e[0]}set onerror(e){this.e=[e]}};class me extends URL{assign(){}reload(){}replace(){}}class Window extends ee{constructor(t,r,n){super(t,0);let s,i,o,a=this;for(s in e)if(!(s in a)&&"onmessage"!==s&&(i=e[s],null!=i)){const t="function"==typeof i&&!i.toString().startsWith("class");a[s]=t?i.bind(e):i}return Object.getOwnPropertyNames(e).map((t=>{t in a||(a[t]=e[t])})),d.forEach(((e,r)=>{a[r]=R(class{constructor(...n){const s=new e(t,P());return Y(s,r,n),s}},r)})),ie.map((e=>H(a,e,{get(){delete a[e];const t=ne()[e];return a[e]=t(we(a),a,e)}}))),"trustedTypes"in e&&(a.trustedTypes=e.trustedTypes),o=new Proxy(a,{has:()=>!0}),g[t]={I:t,z:r,H:o,j:ae(t,1,"#document"),k:ae(t,2,"HTML"),o:ae(t,3,"HEAD"),d:ae(t,4,"BODY"),v:new me(n)},a.requestAnimationFrame=e=>setTimeout((()=>e(performance.now())),9),a.cancelAnimationFrame=e=>clearTimeout(e),a.requestIdleCallback=(e,t)=>(t=Date.now(),setTimeout((()=>e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})),1)),a.cancelIdleCallback=e=>clearTimeout(e),K(a,"localStorage",p.u),K(a,"sessionStorage",p.D),a.Worker=void 0,o}get body(){return we(this).d}get document(){return we(this).j}get documentElement(){return we(this).k}fetch(e,t){return e="string"==typeof e||e instanceof URL?String(e):e.url,fetch($e(we(this),e),t)}get frameElement(){const e=we(this),t=e.z,r=e.I;return r===t?null:oe(t,r,"IFRAME")}get globalThis(){return this}get head(){return we(this).o}get location(){return we(this).v}set location(e){we(this).v.href=e+""}get Image(){return ge(we(this))}get name(){return name+this[t]}get navigator(){return(t=>{const r=e.navigator;return r.sendBeacon=(e,r)=>{try{return fetch($e(t,e,!0),{method:"POST",body:r,mode:"no-cors",keepalive:!0}),!0}catch(e){return console.error(e),!1}},r})(we(this))}get origin(){return we(this).v.origin}get parent(){return g[we(this).z].H}get self(){return this}get top(){for(let e in g)if(g[e].I===g[e].z)return g[e].H}get window(){return this}}const fe=({I:e,z:t,G:r})=>(g[e]?g[e].v.href=r:new Window(e,t,r),p.A([6,e]),g[e]),we=e=>g[e[t]],ye={addEventListener:{value(...e){const t=e[0],r=j(this,t)||[];r.push(e[1]),U(this,t,r)}},async:{get:x,set:x},defer:{get:x,set:x},onload:{get(){let e=j(this,"load");return e&&e[0]||null},set(e){U(this,"load",e?[e]:null)}},onerror:{get(){let e=j(this,"error");return e&&e[0]||null},set(e){U(this,"error",e?[e]:null)}}},Ie={get(){return j(this,3)||""},set(e){U(this,3,e)}},ve={innerHTML:Ie,innerText:Ie,src:{get(){return j(this,4)||""},set(e){const t=we(this),r=$e(t,e,!0);e=$e(t,e),U(this,4,e),J(this,["src"],e),r!==e&&J(this,["dataset","ptsrc"],r)}},getAttribute:{value(e){return"src"===e?this.src:X(this,["getAttribute"],[e])}},setAttribute:{value(e,t){be.includes(e)?this[e]=t:X(this,["setAttribute"],[e,t])}},textContent:Ie,type:{get(){return q(this,["type"])},set(e){Se(e)||(U(this,5,e),J(this,["type"],e))}},...ye},Se=e=>!e||"text/javascript"===e,be=w("src,type");class Node extends ee{appendChild(e){return this.insertBefore(e,null)}get href(){}set href(e){}insertBefore(e,s){const i=e[t]=this[t],o=e[r],a=e[n],c="SCRIPT"===a,l="IFRAME"===a;if(c){const t=j(e,3),r=j(e,5);if(t){if(Se(r)){const r=ce(we(e),o,t,0,""),n=r?"pterror":"ptid",s=r||o;J(e,["type"],W+"-x"),J(e,["dataset",n],s)}J(e,["innerHTML"],t)}}return X(this,["insertBefore"],[e,s]),l&&((e,t)=>{let r,n,s=0;const i=()=>{g[e]&&g[e].r?(r=j(t,1)?"error":"load",n=j(t,r),n&&n.map((e=>e({type:r})))):s++>2e3?(n=j(t,"error"),n&&n.map((e=>e({type:"error"})))):setTimeout(i,9)};i()})(o,e),c&&(z(!0),p.A([6,i])),e}get nodeName(){return this[n]}get nodeType(){return 3}get ownerDocument(){return we(this).j}}class Te{constructor(e){this.name=e[0],this.value=e[1]}get nodeName(){return this.name}get nodeType(){return 2}}class Ee extends ee{constructor(e,t,r,n){return super(e,t,r),Object.assign(this,n),new Proxy(this,{get:(e,t)=>e[t],set:(e,t,r)=>(J(e,[t],r),m.clear(),!0)})}getPropertyValue(e){return this[e]}setProperty(e,t){this[e]=t}}class NodeList{constructor(e){(this._=e).map(((e,t)=>this[t]=e))}entries(){return this._.entries()}forEach(e,t){this._.map(e,t)}item(e){return this[e]}keys(){return this._.keys()}get length(){return C(this._)}values(){return this._.values()}[Symbol.iterator](){return this._[Symbol.iterator]()}}const Ne=(e,n,s,i,o)=>{return void 0!==s&&(o=typeof s)?"string"===o||"boolean"===o||"number"===o||null==s?[0,s]:"function"===o?[4,{I:e,q:n,B:(a=s,(c=h.get(a))||(h.set(a,c=P()),u[c]=a),c)}]:(i=i||new Set)&&Array.isArray(s)?i.has(s)?[1,[]]:i.add(s)&&[1,s.map((t=>Ne(e,n,t,i)))]:"object"===o?"number"==typeof s[r]?[3,{I:s[t],q:s[r]}]:s instanceof Event?[5,xe(e,n,s,!1,i)]:Me&&s instanceof TrustedHTML?[0,s.toString()]:s instanceof ArrayBuffer?[8,s]:ArrayBuffer.isView(s)?[9,s.buffer,L(s)]:[2,xe(e,n,s,!0,i)]:void 0:s;var a,c},Me="undefined"!=typeof TrustedHTML,xe=(e,t,r,n,s,i,o,a)=>{if(i={},!s.has(r))for(o in s.add(r),r)a=r[o],(n||"function"!=typeof a)&&(i[o]=Ne(e,t,a,s));return i},Ce=(e,n)=>e?Ne(e[t],e[r],n):[0,n],Le=(e,t,r,n,s,i,o,a)=>{if(n){if(s=n[0],i=n[1],0===s||11===s||12===s)return i;if(4===s)return We(r,i);if(6===s)return x;if(3===s)return Ae(i);if(7===s)return new NodeList(i.map(Ae));if(10===s)return new Te(i);if(1===s)return i.map((n=>Le(e,t,r,n)));for(a in o={},i)o[a]=Le(e,t,[...r,a],i[a]);if(13===s)return new Ee(e,t,r,o);if(5===s)return c=o,new Proxy(new Event(c.type,c),{get:(e,t)=>t in c?c[t]:e[String(t)]});if(2===s)return o}var c},Ae=({I:e,q:t,x:r})=>Pe(e,t)||oe(e,t,r),Pe=(e,t)=>{const r=g[e];return 0===t?r.H:1===t?r.j:2===t?r.k:3===t?r.o:4===t?r.d:void 0},We=(e,{I:t,q:r,x:n,B:s})=>(u[s]||h.set(u[s]=function(...s){const i=oe(t,r,n);return X(i,e,s)},s),u[s]),He={sheet:{get(){return new Re(this)}}};class Re{constructor(e){this.ownerNode=e}get cssRules(){const e=this.ownerNode;return new Proxy({},{get(t,r){const n=String(r);return"item"===n?t=>De(e,t):"length"===n?Oe(e).length:isNaN(n)?t[r]:De(e,n)}})}insertRule(e,t){const r=Oe(this.ownerNode);return(t=void 0===t?0:t)>=0&&t<=r.length&&(X(this.ownerNode,["sheet","insertRule"],[e,t]),r.splice(t,0,0)),this.ownerNode,m.clear(),t}deleteRule(e){X(this.ownerNode,["sheet","deleteRule"],[e]),Oe(this.ownerNode).splice(e,1),this.ownerNode,m.clear()}}const Oe=(e,t)=>((t=j(e,2))||(t=q(e,["sheet","cssRules"]),U(e,2,t)),t),De=(e,t,r)=>(0===(r=Oe(e))[t]&&(r[t]=q(e,["sheet","cssRules",parseInt(t,10)])),r[t]),Be={body:{get(){return we(this).d}},createElement:{value(e){e=e.toUpperCase();const r=this[t],n=P(),s=oe(r,n,e);if(X(this,["createElement"],[e],2,n),"IFRAME"===e)fe({I:n,z:r,G:"about:blank"}).H.fetch=fetch,J(s,["srcdoc"],pe());else if("SCRIPT"===e){const e=j(s,5);Se(e)&&J(s,["type"],W)}return s}},createElementNS:{value(e,r){r=r.toLowerCase();const n=this[t],s=P(),i=oe(n,s,r,e);return X(this,["createElementNS"],[e,r],2,s),i}},createTextNode:{value(e){const r=this[t],n=P(),s=oe(r,n,"#text");return X(this,["createTextNode"],[e],2,n),s}},createEvent:{value:e=>new Event(e)},currentScript:{get(){const e=this[t],r=we(this).h;return r>0?oe(e,r,"SCRIPT"):null}},defaultView:{get(){return we(this).H}},documentElement:{get(){return we(this).k}},getElementsByTagName:{value(e){return"BODY"===(e=e.toUpperCase())?[we(this).d]:"HEAD"===e?[we(this).o]:X(this,["getElementsByTagName"],[e])}},head:{get(){return we(this).o}},implementation:{value:{hasFeature:x}},location:{get(){return we(this).v},set(e){we(this).v.href=e+""}},nodeType:{value:9},parentNode:{value:null},parentElement:{value:null},readyState:{value:"complete"}},ke={parentElement:{get(){return this.parentNode}},parentNode:{get(){return we(this).k}}},je={parentElement:{value:null},parentNode:{get(){return we(this).j}}},Ue={localName:{get(){return this[n].toLowerCase()}},namespaceURI:{get(){return this[s]||"http://www.w3.org/1999/xhtml"}},nodeType:{value:1},tagName:{get(){return this[n]}}},Fe={hash:{get(){return de(this).hash}},host:{get(){return de(this).host}},hostname:{get(){return de(this).hostname}},href:{get(){return de(this).href},set(e){U(this,4,e+=""),J(this,["href"],e)}},origin:{get(){return de(this).origin}},pathname:{get(){return de(this).pathname}},port:{get(){return de(this).port}},protocol:{get(){return de(this).protocol}},search:{get(){return de(this).search}}},_e={contentDocument:{get(){return this.contentWindow.document}},contentWindow:{get(){const e=this[r];return g[e].H}},src:{get(){return j(this,4)||""},set(e){let t,r=new XMLHttpRequest;e=$e(we(this),e),U(this,1,void 0),U(this,4,e),r.open("GET",e,!1),r.send(),t=r.status,t>199&&t<300?J(this,["srcdoc"],((e,t)=>`<base href="${e}">`+t.replace(/<script>/g,\'<script type="text/partytown">\').replace(/<script /g,\'<script type="text/partytown" \').replace(/text\\/javascript/g,W)+pe())(e,r.responseText)):U(this,1,t)}},...ye},Ve=([s,o,a,c,l])=>{const u=ze[s]?re:"EventTarget"===o?te:"Object"===o?ee:e[o],h=e[s]=R(e[s]||class extends u{},s);12===c&&d.set(s,h),l&&($[l]=h),a.map((([s,o,a])=>{s in h.prototype||s in u.prototype||("string"==typeof o?O(h,s,{get(){if(!k(this,s)){const a=this[t],c=this[r],l=[...this[i],s],u=this[n],h=e[o];U(this,s,new h(a,c,l,u))}return j(this,s)},set(e){U(this,s,e)}}):5===o?B(h,s,(function(...e){return X(this,[s],e)})):o>0&&(void 0!==a?B(h,s,a):O(h,s,{get(){return q(this,[s])},set(e){return J(this,[s],e)}})))}))},ze={CSSStyleDeclaration:1,DOMStringMap:1,NamedNodeMap:1},qe=(e,t)=>B(e,"nodeType",t),Je=(e,t)=>t.map((t=>O(e,t,{get(){let e=Xe(this,t),r=f.get(e);return r||(r=q(this,[t]),f.set(e,r)),r}}))),Xe=(e,n,s)=>[e[t],e[r],n,...(s||A).map((e=>String(e&&e[t]?e[r]:e)))].join("."),Ye=(e,t)=>w(t).map((t=>O(e,t,{get(){return k(this,t)||U(this,t,q(this,[t])),j(this,t)},set(e){j(this,t)!==e&&J(this,[t],e),U(this,t,e)}}))),Ge=e=>y.map((t=>O(e,t,{get(){const e=m.get(Xe(this,t));if("number"==typeof e)return e;const r=q(this,[t],y);return r&&"object"==typeof r?(Object.entries(r).map((([e,t])=>m.set(Xe(this,e),t))),r[t]):r}}))),Ke=(e,t)=>t.map((t=>{e.prototype[t]=function(...e){let r=Xe(this,t,e),n=m.get(r);return n||(n=X(this,[t],e),m.set(r,n)),n}}));class Qe extends ee{now(){return performance.now()}}const Ze=[],et=t=>{const r=t.data,n=r[0];p.r?6===n?(async t=>{let r,n=t.I,s=t.q,i=oe(n,s,"SCRIPT"),o=t.g,a=t.G,c=t.y,l="",u=g[n];if(a)try{a=he(u,a)+"",U(i,4,a),r=await e.fetch(a),r.ok?(o=await r.text(),u.h=s,le(u,o,c||a),ue(i,"load")):(l=r.statusText,ue(i,"error"))}catch(e){console.error(e),l=String(e.stack||e),ue(i,"error")}else o&&(l=ce(u,s,o,0,l));u.h=-1,p.A([5,n,s,l])})(r[1]):7===n?(({q:e,B:t,F:r,b:n})=>{if(u[t])try{const s=Le(null,e,[],r),i=Le(null,e,[],n);u[t].apply(s,i)}catch(e){console.error(e)}})(r[1]):8===n?(({I:e,m:t,b:r})=>{try{let n=g[e].H,s=0,i=C(t);for(;s<i;s++)s+1<i?n=n[t[s]]:n[t[s]].apply(n,Le(null,0,[],r))}catch(e){console.error(e)}})(r[1]):3===n?fe(r[1]):4===n?g[r[1]].r=1:11===n&&(g[r[1]].v.href=r[2]):1===n?((t=>{const r=p.f=JSON.parse(t.f);["resolveUrl","get","set","apply"].map((e=>{r[e]&&(r[e]=new Function("return "+r[e])())})),p.$importScripts$=importScripts.bind(e),p.t=t.t,p.u=t.u,p.D=t.D,p.A=postMessage.bind(e),p.$sharedDataBuffer$=t.$sharedDataBuffer$,e.postMessage=e.importScripts=void 0,e.Node=Node,e.Window=Window,e.CSSStyleSheet=Re,e.Performance=Qe,t.p.map(Ve),(()=>{const t=e.Document,r=e.DocumentFragment,n=e.Element;var s,i;w("atob,btoa,crypto,indexedDB,setTimeout,setInterval,clearTimeout,clearInterval").map((e=>delete Window.prototype[e])),D(n,Ue),D(t,Be),D(e.HTMLAnchorElement,Fe),D(e.HTMLIFrameElement,_e),D(e.HTMLScriptElement,ve),D(e.HTMLStyleElement,He),D(e.HTMLHeadElement,ke),D(e.HTMLBodyElement,ke),D(e.HTMLHtmlElement,je),s=Re,i={type:"text/css"},Object.keys(i).map((e=>B(s,e,i[e]))),qe(e.Comment,8),qe(e.DocumentType,10),qe(r,11),Je(Node,I),Je(n,v),Je(r,v),Ge(n),Ke(n,E),Ge(Window),Ke(Window,N),Ye(Window,"devicePixelRatio"),Ye(t,"compatMode,referrer"),Ye(n,"id")})(),p.r=1})(r[1]),p.A([2]),Ze.slice().forEach(et),Ze.length=0):Ze.push(t)};e.onmessage=et,postMessage([0])})(self);\n'],{type:"text/javascript"})),{name:"Partytown 🎉"}),U.onmessage=t=>{const r=t.data;10===r[0]?A(U,r[1]):e(U,r)},w.addEventListener("pt1",(e=>O(U,d(e.detail.frameElement),e.detail))))}))})(window);