@spot-flow/checkout-inline-js 0.1.37 → 0.1.38-dev.1
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/checkout-inline.es.js +98 -99
- package/dist/checkout-inline.js +18 -18
- package/dist/utils/redirectTo.d.ts +1 -1
- package/package.json +1 -1
package/dist/checkout-inline.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
</div>
|
|
47
47
|
<!-- end of footer -->
|
|
48
48
|
</div>
|
|
49
|
-
</div>`,ve=(n,e)=>e||n;let Y=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},Be=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const Oe=(n,e,i)=>{if(!n)throw new Be("Missing authorization token");const t=new Headers;return i||t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${n}`),e&&t.append("Spotflow-Payment-Code",e),t},Ue="https://api.spotflow.co/api/v1",As=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},li=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Bt=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xs=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new Y(l.message,s.status):new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},
|
|
49
|
+
</div>`,ve=(n,e)=>e||n;let Y=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},Be=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const Oe=(n,e,i)=>{if(!n)throw new Be("Missing authorization token");const t=new Headers;return i||t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${n}`),e&&t.append("Spotflow-Payment-Code",e),t},Ue="https://api.spotflow.co/api/v1",As=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},li=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Bt=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xs=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new Y(l.message,s.status):new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},an=async(n,e,i,t,o)=>{try{const s=Oe(n,t),a=await fetch(`${ve(Ue,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!a.ok){const d=await a.json();throw d.message?new Y(d.message,a.status):new Y("Network response was not ok",a.status)}return{data:await a.json(),headers:a.headers}}catch(s){throw s instanceof Y?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof Be?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function Ls(n,e,i,t,o){const s=Oe(n,i);try{const a=await fetch(`${ve(Ue,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!a.ok){const l=await a.json();throw l.message?new Y(l.message,a.status):new Y("Network response was not okay",a.status)}return await a.json()}catch(a){throw a instanceof Y?console.error(`FetchError: ${a.message} (status: ${a.status})`):a instanceof Be?console.error(`AuthorizationError: ${a.message}`):console.error(`Unexpected error: ${a}`),a}}const Ts=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Es=async(n,e,i,t)=>{try{const o=Oe(n,i,!0),s=await fetch(`${ve(Ue,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Ps=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const a=await s.json();throw a.message?new Y(a.message,s.status):new Y("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},di=async(n,e,i,t)=>{try{const o=Oe(n,i),s=await fetch(`${ve(Ue,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new Y("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof Y?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof Be?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}};async function Is(n,e,i,t,o){try{const s=Oe(n,t),a=await fetch(`${ve(Ue,o)}/payments/tax-quotes?amount=${e||""}¤cy=${i||""}`,{headers:s,method:"GET"});if(!a.ok){const l=await a.json();throw l.message?new Y(l.message,a.status):new Y("Network response was not ok",a.status)}return a.json()}catch(s){throw s instanceof Y?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof Be?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}}const xe=(n,e)=>{const i=new Intl.NumberFormat("ng-NG",{style:"decimal",maximumFractionDigits:e||0,minimumFractionDigits:e||0});return isNaN(parseFloat(i.format(n)))?"-":i.format(n)},be={card:{key:"card",label:"Pay with Card",icon:`<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
50
50
|
<path d="M1.83398 6.16992H15.1673" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
51
51
|
<path d="M4.5 11.5034H5.83333" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
52
52
|
<path d="M7.5 11.5034H10.1667" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -715,7 +715,7 @@
|
|
|
715
715
|
stroke-linejoin="round" />
|
|
716
716
|
</svg>`),y.innerHTML=`<span class="bg-primary text-white text-sm font-semibold py-2 px-3 rounded-md" id="upload-btn-text">
|
|
717
717
|
Upload
|
|
718
|
-
</span>`,p&&(p.textContent="Tap to Upload"),g&&(g.textContent="PDF, PNG, JPG | 10MB max."))})}else return}),C&&C.addEventListener("submit",A=>{var T;A.preventDefault();const{reason:_}=this.formValues;this.onAction({transactionReference:(T=this.paymentResponse)==null?void 0:T.reference,reportingReason:_,disputeSource:"CUSTOMER",supportingDocuments:this.documents})})}handleInputChange(e,i){const t=e.target,{name:o,value:s}=t;if(this.formValues={...this.formValues,[o]:s},this.validateForm())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}validateForm(){return Object.values(this.formValues).every(i=>!!i)}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Ys}}function
|
|
718
|
+
</span>`,p&&(p.textContent="Tap to Upload"),g&&(g.textContent="PDF, PNG, JPG | 10MB max."))})}else return}),C&&C.addEventListener("submit",A=>{var T;A.preventDefault();const{reason:_}=this.formValues;this.onAction({transactionReference:(T=this.paymentResponse)==null?void 0:T.reference,reportingReason:_,disputeSource:"CUSTOMER",supportingDocuments:this.documents})})}handleInputChange(e,i){const t=e.target,{name:o,value:s}=t;if(this.formValues={...this.formValues,[o]:s},this.validateForm())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}validateForm(){return Object.values(this.formValues).every(i=>!!i)}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Ys}}function Ze(n,e,i){const o=e.get("spf-redirect-url")||i;o&&setTimeout(()=>{const s=new URL(o);s.searchParams.append("status",n.status),s.searchParams.append("reference",n.reference),window.location.href=s.toString()},1800)}class hi{constructor(e){h(this,"container");h(this,"transactionIssuesForm");h(this,"_currentStep");h(this,"onAction");h(this,"url");h(this,"token");h(this,"rdtCode");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"callbackUrl");this.container=e.container,this._currentStep=1,this.onAction=e.onAction,this.url=e.url||"",this.token=e.token,this.rdtCode=e.rdtCode||"",this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.callbackUrl=e.callBackUrl}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransactionIssuesComponent()}attachListener(){const e=this.container.querySelector("#back"),i=document.querySelector("#main-header"),t=document.querySelector("#main-content"),o=document.querySelector("#main-footer");e&&e.addEventListener("click",()=>{this.onAction(),i.style.display="block",t.classList.add("box-container"),o.style.display="block"})}uploadEvidenceFile(e){const i=new FormData;return i.append("file",e),Es(this.token,i,this.rdtCode,this.url).then(t=>({message:"Upload successfully",status:"success",url:t.data})).catch(t=>({message:"Error uploading file. Please try again",status:"error",url:""}))}submitDisputeForm(e){Ps(this.token,e,this.rdtCode,this.url).then(t=>{this.container.innerHTML=this.renderSuccessComponent();const o=document.querySelector("#go-back-merchant");o&&o.addEventListener("click",()=>{Ze(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})}).catch(t=>{this.container.innerHTML=this.renderErrorComponent();const o=document.querySelector("#go-back-merchant");o&&o.addEventListener("click",()=>{Ze(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})})}renderSuccessComponent(){return`<div id="paymentSuccess">
|
|
719
719
|
<div class="container-center min-h-[40dvh]">
|
|
720
720
|
<div>
|
|
721
721
|
<div class="container-center mb-5">
|
|
@@ -758,7 +758,7 @@
|
|
|
758
758
|
</div>
|
|
759
759
|
</div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),i=document.querySelector("#main-content"),t=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),i&&i.classList.remove("box-container"),t&&(t.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new Qs({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var le;(function(n){n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment"})(le||(le={}));function Xs(n){return n.nodeType===n.ELEMENT_NODE}function qn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function Wn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function ea(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n}function na(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const i=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"}function mi(n){try{const e=n.rules||n.cssRules;return e?ea(Array.from(e,Ot).join("")):null}catch{return null}}function Ot(n){let e;if(ta(n))try{e=mi(n.styleSheet)||na(n)}catch{}else if(oa(n)&&n.selectorText.includes(":"))return ia(n.cssText);return e||n.cssText}function ia(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function ta(n){return"styleSheet"in n}function oa(n){return"selectorText"in n}class Ut{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const t=(i=this.getMeta(e))===null||i===void 0?void 0:i.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const t=i.id;this.idNodeMap.set(t,e),this.nodeMetaMap.set(e,i)}replace(e,i){const t=this.getNode(e);if(t){const o=this.nodeMetaMap.get(t);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function sa(){return new Ut}function qi({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let a=o||"";const l=t&&yn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?a=s(a,n):a="*".repeat(a.length)),a}function yn(n){return n.toLowerCase()}const Vt="__rrweb_original__";function aa(n){const e=n.getContext("2d");if(!e)return!0;const i=50;for(let t=0;t<n.width;t+=i)for(let o=0;o<n.height;o+=i){const s=e.getImageData,a=Vt in s?s[Vt]:s;if(new Uint32Array(a.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(d=>d!==0))return!1}return!0}function Wi(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?yn(e):null}function jt(n,e){var i;let t;try{t=new URL(n,e??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(o);return(i=s==null?void 0:s[1])!==null&&i!==void 0?i:null}let ra=1;const la=new RegExp("[^a-z0-9-_:]"),Zn=-2;function Kt(){return ra++}function da(n){if(n instanceof HTMLFormElement)return"form";const e=yn(n.tagName);return la.test(e)?"div":e}function ca(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let Pn,Gt;const ua=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ha=/^(?:[a-z+]+:)?\/\//i,ma=/^www\..*/i,pa=/^(data:)([^,]*),(.*)/i;function pi(n,e){return(n||"").replace(ua,(i,t,o,s,a,l)=>{const d=o||a||l,v=t||s||"";if(!d)return i;if(ha.test(d)||ma.test(d))return`url(${v}${d}${v})`;if(pa.test(d))return`url(${v}${d}${v})`;if(d[0]==="/")return`url(${v}${ca(e)+d}${v})`;const p=e.split("/"),g=d.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${v}${p.join("/")}${v})`})}const va=/^[^ \t\n\r\u000c]+/,ba=/^[, \t\n\r\u000c]+/;function fa(n,e){if(e.trim()==="")return e;let i=0;function t(s){let a;const l=s.exec(e.substring(i));return l?(a=l[0],i+=a.length,a):""}const o=[];for(;t(ba),!(i>=e.length);){let s=t(va);if(s.slice(-1)===",")s=In(n,s.substring(0,s.length-1)),o.push(s);else{let a="";s=In(n,s);let l=!1;for(;;){const d=e.charAt(i);if(d===""){o.push((s+a).trim());break}else if(l)d===")"&&(l=!1);else if(d===","){i+=1,o.push((s+a).trim());break}else d==="("&&(l=!0);a+=d,i+=1}}}return o.join(", ")}function In(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function ga(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function Zi(){const n=document.createElement("a");return n.href="",n.href}function zt(n,e,i,t){return t&&(i==="src"||i==="href"&&!(e==="use"&&t[0]==="#")||i==="xlink:href"&&t[0]!=="#"||i==="background"&&(e==="table"||e==="td"||e==="th")?In(n,t):i==="srcset"?fa(n,t):i==="style"?pi(t,Zi()):e==="object"&&i==="data"?In(n,t):t)}function Ft(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function ya(n,e,i){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}if(i)return n.matches(i)}catch{}return!1}function vi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?vi(n.parentNode,e,i):!1;for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}return i?vi(n.parentNode,e,i):!1}function qt(n,e,i,t){try{const o=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(o===null)return!1;if(typeof e=="string"){if(t){if(o.closest(`.${e}`))return!0}else if(o.classList.contains(e))return!0}else if(vi(o,e,t))return!0;if(i){if(t){if(o.closest(i))return!0}else if(o.matches(i))return!0}}catch{}return!1}function Ca(n,e,i){const t=n.contentWindow;if(!t)return;let o=!1,s;try{s=t.document.readyState}catch{return}if(s!=="complete"){const l=setTimeout(()=>{o||(e(),o=!0)},i);n.addEventListener("load",()=>{clearTimeout(l),o=!0,e()});return}const a="about:blank";if(t.location.href!==a||n.src===a||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function ka(n,e,i){let t=!1,o;try{o=n.sheet}catch{return}if(o)return;const s=setTimeout(()=>{t||(e(),t=!0)},i);n.addEventListener("load",()=>{clearTimeout(s),t=!0,e()})}function wa(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:l,maskInputOptions:d={},maskTextFn:v,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:w,newlyAddedElement:C=!1}=e,S=Sa(i,t);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:le.Document,childNodes:[],compatMode:n.compatMode}:{type:le.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:le.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:S};case n.ELEMENT_NODE:return Ma(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:d,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:w,newlyAddedElement:C,rootId:S});case n.TEXT_NODE:return _a(n,{needsMask:a,maskTextFn:v,rootId:S});case n.CDATA_SECTION_NODE:return{type:le.CDATA,textContent:"",rootId:S};case n.COMMENT_NODE:return{type:le.Comment,textContent:n.textContent||"",rootId:S};default:return!1}}function Sa(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function _a(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,a=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const d=a==="STYLE"?!0:void 0,v=a==="SCRIPT"?!0:void 0;if(d&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=mi(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=pi(l,Zi())}return v&&(l="SCRIPT_PLACEHOLDER"),!d&&!v&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:d,rootId:s}}function Ma(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:d={},inlineImages:v,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,w=ya(n,t,o),C=da(n);let S={};const M=n.attributes.length;for(let _=0;_<M;_++){const T=n.attributes[_];Ft(C,T.name,T.value)||(S[T.name]=zt(i,C,yn(T.name),T.value))}if(C==="link"&&s){const _=Array.from(i.styleSheets).find(I=>I.href===n.href);let T=null;_&&(T=mi(_)),T&&(delete S.rel,delete S.href,S._cssText=pi(T,_.href))}if(C==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=mi(n.sheet);_&&(S._cssText=pi(_,Zi()))}if(C==="input"||C==="textarea"||C==="select"){const _=n.value,T=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=qi({element:n,type:Wi(n),tagName:C,value:_,maskInputOptions:a,maskInputFn:l}):T&&(S.checked=T)}if(C==="option"&&(n.selected&&!a.select?S.selected=!0:delete S.selected),C==="canvas"&&p){if(n.__context==="2d")aa(n)||(S.rr_dataURL=n.toDataURL(d.type,d.quality));else if(!("__context"in n)){const _=n.toDataURL(d.type,d.quality),T=document.createElement("canvas");T.width=n.width,T.height=n.height;const I=T.toDataURL(d.type,d.quality);_!==I&&(S.rr_dataURL=_)}}if(C==="img"&&v){Pn||(Pn=i.createElement("canvas"),Gt=Pn.getContext("2d"));const _=n,T=_.crossOrigin;_.crossOrigin="anonymous";const I=()=>{_.removeEventListener("load",I);try{Pn.width=_.naturalWidth,Pn.height=_.naturalHeight,Gt.drawImage(_,0,0),S.rr_dataURL=Pn.toDataURL(d.type,d.quality)}catch(K){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${K}`)}T?S.crossOrigin=T:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?I():_.addEventListener("load",I)}if(C==="audio"||C==="video"){const _=S;_.rr_mediaState=n.paused?"paused":"played",_.rr_mediaCurrentTime=n.currentTime,_.rr_mediaPlaybackRate=n.playbackRate,_.rr_mediaMuted=n.muted,_.rr_mediaLoop=n.loop,_.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(S.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(S.rr_scrollTop=n.scrollTop)),w){const{width:_,height:T}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${T}px`}}C==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let A;try{customElements.get(C)&&(A=!0)}catch{}return{type:le.Element,tagName:C,attributes:S,childNodes:[],isSVG:ga(n)||void 0,needBlock:w,rootId:y,isCustom:A}}function ne(n){return n==null?"":n.toLowerCase()}function Aa(n,e){if(e.comment&&n.type===le.Comment)return!0;if(n.type===le.Element){if(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")&&n.attributes.as==="script"||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&jt(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ne(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ne(n.attributes.name)==="application-name"||ne(n.attributes.rel)==="icon"||ne(n.attributes.rel)==="apple-touch-icon"||ne(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ne(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ne(n.attributes.property).match(/^(og|twitter|fb):/)||ne(n.attributes.name).match(/^(og|twitter):/)||ne(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ne(n.attributes.name)==="robots"||ne(n.attributes.name)==="googlebot"||ne(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ne(n.attributes.name)==="author"||ne(n.attributes.name)==="generator"||ne(n.attributes.name)==="framework"||ne(n.attributes.name)==="publisher"||ne(n.attributes.name)==="progid"||ne(n.attributes.property).match(/^article:/)||ne(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ne(n.attributes.name)==="google-site-verification"||ne(n.attributes.name)==="yandex-verification"||ne(n.attributes.name)==="csrf-token"||ne(n.attributes.name)==="p:domain_verify"||ne(n.attributes.name)==="verify-v1"||ne(n.attributes.name)==="verification"||ne(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Nn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:l,skipChild:d=!1,inlineStylesheet:v=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:w={},inlineImages:C=!1,recordCanvas:S=!1,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_=5e3,onStylesheetLoad:T,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:K=()=>!1,newlyAddedElement:z=!1}=e;let{needsMask:U}=e,{preserveWhiteSpace:G=!0}=e;!U&&n.childNodes&&(U=qt(n,a,l,U===void 0));const oe=wa(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:w,inlineImages:C,recordCanvas:S,keepIframeSrcFn:K,newlyAddedElement:z});if(!oe)return console.warn(n,"not serialized"),null;let ge;t.hasNode(n)?ge=t.getId(n):Aa(oe,y)||!G&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?ge=Zn:ge=Kt();const V=Object.assign(oe,{id:ge});if(t.add(n,V),ge===Zn)return null;M&&M(n);let _e=!d;if(V.type===le.Element){_e=_e&&!V.needBlock,delete V.needBlock;const ue=n.shadowRoot;ue&&Wn(ue)&&(V.isShadowHost=!0)}if((V.type===le.Document||V.type===le.Element)&&_e){y.headWhitespace&&V.type===le.Element&&V.tagName==="head"&&(G=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:a,maskTextSelector:l,skipChild:d,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:w,inlineImages:C,recordCanvas:S,preserveWhiteSpace:G,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K};if(!(V.type===le.Element&&V.tagName==="textarea"&&V.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Me=Nn(Te,ue);Me&&V.childNodes.push(Me)}if(Xs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Me=Nn(Te,ue);Me&&(Wn(n.shadowRoot)&&(Me.isShadow=!0),V.childNodes.push(Me))}}return n.parentNode&&qn(n.parentNode)&&Wn(n.parentNode)&&(V.isShadow=!0),V.type===le.Element&&V.tagName==="iframe"&&Ca(n,()=>{const ue=n.contentDocument;if(ue&&A){const Te=Nn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:w,inlineImages:C,recordCanvas:S,preserveWhiteSpace:G,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K});Te&&A(n,Te)}},_),V.type===le.Element&&V.tagName==="link"&&typeof V.attributes.rel=="string"&&(V.attributes.rel==="stylesheet"||V.attributes.rel==="preload"&&typeof V.attributes.href=="string"&&jt(V.attributes.href)==="css")&&ka(n,()=>{if(T){const ue=Nn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:v,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:w,inlineImages:C,recordCanvas:S,preserveWhiteSpace:G,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:T,stylesheetLoadTimeout:I,keepIframeSrcFn:K});ue&&T(n,ue)}},I),V}function xa(n,e){const{mirror:i=new Ut,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:d=!1,recordCanvas:v=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:w,preserveWhiteSpace:C,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:T,keepIframeSrcFn:I=()=>!1}=e||{};return Nn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p===!1?{password:!0}:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:y===!1?{}:y,dataURLOptions:w,inlineImages:d,recordCanvas:v,preserveWhiteSpace:C,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:T,keepIframeSrcFn:I,newlyAddedElement:!1})}function we(n,e,i=document){const t={capture:!0,passive:!0};return i.addEventListener(n,e,t),()=>i.removeEventListener(n,e,t)}const Bn=`Please stop import mirror directly. Instead of that,\r
|
|
760
760
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
761
|
-
or you can use record.mirror to access the mirror instance during recording.`;let Wt={map:{},getId(){return console.error(Bn),-1},getNode(){return console.error(Bn),null},removeNodeFromMap(){console.error(Bn)},has(){return console.error(Bn),!1},reset(){console.error(Bn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Wt=new Proxy(Wt,{get(n,e,i){return e==="map"&&console.error(Bn),Reflect.get(n,e,i)}}));function Jn(n,e,i={}){let t=null,o=0;return function(...s){const a=Date.now();!o&&i.leading===!1&&(o=a);const l=e-(a-o),d=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=a,n.apply(d,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(d,s)},l))}}function bi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(a){setTimeout(()=>{i.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>bi(n,e,s||{},!0)}function Dn(n,e,i){try{if(!(e in n))return()=>{};const t=n[e],o=i(t);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:t}})),n[e]=o,()=>{n[e]=t}}catch{return()=>{}}}let fi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(fi=()=>new Date().getTime());function Zt(n){var e,i,t,o,s,a;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((i=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||i===void 0?void 0:i.scrollLeft)||((t=l==null?void 0:l.body)===null||t===void 0?void 0:t.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((s=(o=l==null?void 0:l.body)===null||o===void 0?void 0:o.parentElement)===null||s===void 0?void 0:s.scrollTop)||((a=l==null?void 0:l.body)===null||a===void 0?void 0:a.scrollTop)||0}}function Jt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $t(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Yt(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function Se(n,e,i,t){if(!n)return!1;const o=Yt(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(vi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function La(n,e){return e.getId(n)!==-1}function Ji(n,e){return e.getId(n)===Zn}function Qt(n,e){if(qn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?Qt(n.parentNode,e):!0:!0}function $i(n){return!!n.changedTouches}function Ta(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===i)return!0;while(i=i&&i.parentNode);return!1})}function Xt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function eo(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Yi(n){return!!(n!=null&&n.shadowRoot)}class Ea{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return(i=this.styleIDMap.get(e))!==null&&i!==void 0?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let t;return i===void 0?t=this.id++:t=i,this.styleIDMap.set(e,t),this.idStyleMap.set(t,e),t}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function no(n){var e,i;let t=null;return((i=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||i===void 0?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(t=n.getRootNode().host),t}function Pa(n){let e=n,i;for(;i=no(e);)e=i;return e}function Ia(n){const e=n.ownerDocument;if(!e)return!1;const i=Pa(n);return e.contains(i)}function io(n){const e=n.ownerDocument;return e?e.contains(n)||Ia(n):!1}var W=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(W||{}),F=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(F||{}),Le=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Le||{}),Ze=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Ze||{}),Rn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Rn||{});function to(n){return"__ln"in n}class Na{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let i=this.head;for(let t=0;t<e;t++)i=(i==null?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&to(e.previousSibling)){const t=e.previousSibling.__ln.next;i.next=t,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,t&&(t.previous=i)}else if(e.nextSibling&&to(e.nextSibling)&&e.nextSibling.__ln.previous){const t=e.nextSibling.__ln.previous;i.previous=t,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,t&&(t.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const oo=(n,e)=>`${n}@${e}`;class Ba{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],i=new Set,t=new Na,o=d=>{let v=d,p=Zn;for(;p===Zn;)v=v&&v.nextSibling,p=v&&this.mirror.getId(v);return p},s=d=>{if(!d.parentNode||!io(d)||d.parentNode.tagName==="TEXTAREA")return;const v=qn(d.parentNode)?this.mirror.getId(no(d)):this.mirror.getId(d.parentNode),p=o(d);if(v===-1||p===-1)return t.addNode(d);const g=Nn(d,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{Xt(f,this.mirror)&&this.iframeManager.addIframe(f),eo(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Yi(d)&&this.shadowDomManager.addShadowRoot(d.shadowRoot,this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)}});g&&(e.push({parentId:v,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const d of this.movedSet)so(this.removes,d,this.mirror)&&!this.movedSet.has(d.parentNode)||s(d);for(const d of this.addedSet)!ro(this.droppedSet,d)&&!so(this.removes,d,this.mirror)||ro(this.movedSet,d)?s(d):this.droppedSet.add(d);let a=null;for(;t.length;){let d=null;if(a){const v=this.mirror.getId(a.value.parentNode),p=o(a.value);v!==-1&&p!==-1&&(d=a)}if(!d){let v=t.tail;for(;v;){const p=v;if(v=v.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){d=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=y.parentNode.host;if(this.mirror.getId(w)!==-1){d=p;break}}}}}}if(!d){for(;t.head;)t.removeNode(t.head.value);break}a=d.previous,t.removeNode(d.value),s(d.value)}const l={texts:this.texts.map(d=>{const v=d.node;return v.parentNode&&v.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(v.parentNode),{id:this.mirror.getId(v),value:d.value}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{const{attributes:v}=d;if(typeof v.style=="string"){const p=JSON.stringify(d.styleDiff),g=JSON.stringify(d._unchangedStyles);p.length<v.style.length&&(p+g).split("var(").length===v.style.split("var(").length&&(v.style=d.styleDiff)}return{id:this.mirror.getId(d.node),attributes:v}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.genTextAreaValueMutation=e=>{let i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,t=>t.textContent||"").join("")},this.processMutation=e=>{if(!Ji(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!Se(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:qt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,Yt(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const i=e.target;let t=e.attributeName,o=e.target.getAttribute(t);if(t==="value"){const a=Wi(i);o=qi({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(Se(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(i.tagName==="IFRAME"&&t==="src"&&!this.keepIframeSrcFn(o))if(!i.contentDocument)t="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),t==="type"&&i.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Ft(i.tagName,t)&&(s.attributes[t]=zt(this.doc,yn(i.tagName),yn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const d=i.style.getPropertyValue(l),v=i.style.getPropertyPriority(l);d!==a.style.getPropertyValue(l)||v!==a.style.getPropertyPriority(l)?v===""?s.styleDiff[l]=d:s.styleDiff[l]=[d,v]:s._unchangedStyles[l]=[d,v]}for(const l of Array.from(a.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(Se(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(i=>this.genAdds(i,e.target)),e.removedNodes.forEach(i=>{const t=this.mirror.getId(i),o=qn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Se(e.target,this.blockClass,this.blockSelector,!1)||Ji(i,this.mirror)||!La(i,this.mirror)||(this.addedSet.has(i)?(Qi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||Qt(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[oo(t,o)]?Qi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:qn(e.target)&&Wn(e.target)?!0:void 0})),this.mapRemoves.push(i))});break}}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ji(e,this.mirror))return;this.movedSet.add(e);let t=null;i&&this.mirror.hasNode(i)&&(t=this.mirror.getId(i)),t&&t!==-1&&(this.movedMap[oo(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Se(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),Yi(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(i=>{this[i]=e[i]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Qi(n,e){n.delete(e),e.childNodes.forEach(i=>Qi(n,i))}function so(n,e,i){return n.length===0?!1:ao(n,e,i)}function ao(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:ao(n,t,i)}function ro(n,e){return n.size===0?!1:lo(n,e)}function lo(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:lo(n,i):!1}let $n;function Da(n){$n=n}function Ra(){$n=void 0}const q=n=>$n?(...i)=>{try{return n(...i)}catch(t){if($n&&$n(t)===!0)return;throw t}}:n,Cn=[];function Yn(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function co(n,e){var i,t;const o=new Ba;Cn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const a=(t=(i=window==null?void 0:window.Zone)===null||i===void 0?void 0:i.__symbol__)===null||t===void 0?void 0:t.call(i,"MutationObserver");a&&window[a]&&(s=window[a]);const l=new s(q(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function Ha({mousemoveCb:n,sampling:e,doc:i,mirror:t}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const d=Jn(q(g=>{const f=Date.now()-l;n(a.map(y=>(y.timeOffset-=f,y)),g),a=[],l=null}),s),v=q(Jn(q(g=>{const f=Yn(g),{clientX:y,clientY:w}=$i(g)?g.changedTouches[0]:g;l||(l=fi()),a.push({x:y,y:w,id:t.getId(f),timeOffset:fi()-l}),d(typeof DragEvent<"u"&&g instanceof DragEvent?F.Drag:g instanceof MouseEvent?F.MouseMove:F.TouchMove)}),o,{trailing:!1})),p=[we("mousemove",v,i),we("touchmove",v,i),we("drag",v,i)];return q(()=>{p.forEach(g=>g())})}function Oa({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let d=null;const v=p=>g=>{const f=Yn(g);if(Se(f,t,o,!0))return;let y=null,w=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Ze.Mouse;break;case"touch":y=Ze.Touch;break;case"pen":y=Ze.Pen;break}y===Ze.Touch?Le[p]===Le.MouseDown?w="TouchStart":Le[p]===Le.MouseUp&&(w="TouchEnd"):Ze.Pen}else $i(g)&&(y=Ze.Touch);y!==null?(d=y,(w.startsWith("Touch")&&y===Ze.Touch||w.startsWith("Mouse")&&y===Ze.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=d,d=null);const C=$i(g)?g.changedTouches[0]:g;if(!C)return;const S=i.getId(f),{clientX:M,clientY:A}=C;q(n)(Object.assign({type:Le[w],id:S,x:M,y:A},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&a[p]!==!1).forEach(p=>{let g=yn(p);const f=v(p);if(window.PointerEvent)switch(Le[p]){case Le.MouseDown:case Le.MouseUp:g=g.replace("mouse","pointer");break;case Le.TouchStart:case Le.TouchEnd:return}l.push(we(g,f,e))}),q(()=>{l.forEach(p=>p())})}function uo({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const a=q(Jn(q(l=>{const d=Yn(l);if(!d||Se(d,t,o,!0))return;const v=i.getId(d);if(d===e&&e.defaultView){const p=Zt(e.defaultView);n({id:v,x:p.left,y:p.top})}else n({id:v,x:d.scrollLeft,y:d.scrollTop})}),s.scroll||100));return we("scroll",a,e)}function Ua({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q(Jn(q(()=>{const s=Jt(),a=$t();(i!==s||t!==a)&&(n({width:Number(a),height:Number(s)}),i=s,t=a)}),200));return we("resize",o,e)}const Va=["INPUT","TEXTAREA","SELECT"],ho=new WeakMap;function ja({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:l,maskInputFn:d,sampling:v,userTriggeredOnInput:p}){function g(A){let _=Yn(A);const T=A.isTrusted,I=_&&_.tagName;if(_&&I==="OPTION"&&(_=_.parentElement),!_||!I||Va.indexOf(I)<0||Se(_,t,o,!0)||_.classList.contains(s)||a&&_.matches(a))return;let K=_.value,z=!1;const U=Wi(_)||"";U==="radio"||U==="checkbox"?z=_.checked:(l[I.toLowerCase()]||l[U])&&(K=qi({element:_,maskInputOptions:l,tagName:I,type:U,value:K,maskInputFn:d})),f(_,p?{text:K,isChecked:z,userTriggered:T}:{text:K,isChecked:z});const G=_.name;U==="radio"&&G&&z&&e.querySelectorAll(`input[type="radio"][name="${G}"]`).forEach(oe=>{if(oe!==_){const ge=oe.value;f(oe,p?{text:ge,isChecked:!z,userTriggered:!1}:{text:ge,isChecked:!z})}})}function f(A,_){const T=ho.get(A);if(!T||T.text!==_.text||T.isChecked!==_.isChecked){ho.set(A,_);const I=i.getId(A);q(n)(Object.assign(Object.assign({},_),{id:I}))}}const w=(v.input==="last"?["change"]:["input","change"]).map(A=>we(A,q(g),e)),C=e.defaultView;if(!C)return()=>{w.forEach(A=>A())};const S=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),M=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&w.push(...M.map(A=>bi(A[0],A[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,C))),q(()=>{w.forEach(A=>A())})}function gi(n){const e=[];function i(t,o){if(yi("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||yi("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||yi("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||yi("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const a=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(a)}else if(t.parentStyleSheet){const a=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(a)}return o}return i(n,e)}function rn(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Ka({styleSheetRuleCb:n,mirror:e,stylesheetManager:i},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const o=t.CSSStyleSheet.prototype.insertRule;t.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:q((p,g,f)=>{const[y,w]=f,{id:C,styleId:S}=rn(g,e,i.styleMirror);return(C&&C!==-1||S&&S!==-1)&&n({id:C,styleId:S,adds:[{rule:y,index:w}]}),p.apply(g,f)})});const s=t.CSSStyleSheet.prototype.deleteRule;t.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:q((p,g,f)=>{const[y]=f,{id:w,styleId:C}=rn(g,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,removes:[{index:y}]}),p.apply(g,f)})});let a;t.CSSStyleSheet.prototype.replace&&(a=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:q((p,g,f)=>{const[y]=f,{id:w,styleId:C}=rn(g,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replace:y}),p.apply(g,f)})}));let l;t.CSSStyleSheet.prototype.replaceSync&&(l=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:q((p,g,f)=>{const[y]=f,{id:w,styleId:C}=rn(g,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replaceSync:y}),p.apply(g,f)})}));const d={};Ci("CSSGroupingRule")?d.CSSGroupingRule=t.CSSGroupingRule:(Ci("CSSMediaRule")&&(d.CSSMediaRule=t.CSSMediaRule),Ci("CSSConditionRule")&&(d.CSSConditionRule=t.CSSConditionRule),Ci("CSSSupportsRule")&&(d.CSSSupportsRule=t.CSSSupportsRule));const v={};return Object.entries(d).forEach(([p,g])=>{v[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(v[p].insertRule,{apply:q((f,y,w)=>{const[C,S]=w,{id:M,styleId:A}=rn(y.parentStyleSheet,e,i.styleMirror);return(M&&M!==-1||A&&A!==-1)&&n({id:M,styleId:A,adds:[{rule:C,index:[...gi(y),S||0]}]}),f.apply(y,w)})}),g.prototype.deleteRule=new Proxy(v[p].deleteRule,{apply:q((f,y,w)=>{const[C]=w,{id:S,styleId:M}=rn(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||M&&M!==-1)&&n({id:S,styleId:M,removes:[{index:[...gi(y),C]}]}),f.apply(y,w)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,a&&(t.CSSStyleSheet.prototype.replace=a),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach(([p,g])=>{g.prototype.insertRule=v[p].insertRule,g.prototype.deleteRule=v[p].deleteRule})})}function mo({mirror:n,stylesheetManager:e},i){var t,o,s;let a=null;i.nodeName==="#document"?a=n.getId(i):a=n.getId(i.host);const l=i.nodeName==="#document"?(t=i.defaultView)===null||t===void 0?void 0:t.Document:(s=(o=i.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,d=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!d?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get(){var v;return(v=d.get)===null||v===void 0?void 0:v.call(this)},set(v){var p;const g=(p=d.set)===null||p===void 0?void 0:p.call(this,v);if(a!==null&&a!==-1)try{e.adoptStyleSheets(v,a)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))}function Ga({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:i,stylesheetManager:t},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:q((l,d,v)=>{var p;const[g,f,y]=v;if(i.has(g))return s.apply(d,[g,f,y]);const{id:w,styleId:C}=rn((p=d.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,set:{property:g,value:f,priority:y},index:gi(d.parentRule)}),l.apply(d,v)})});const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:q((l,d,v)=>{var p;const[g]=v;if(i.has(g))return a.apply(d,[g]);const{id:f,styleId:y}=rn((p=d.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&n({id:f,styleId:y,remove:{property:g},index:gi(d.parentRule)}),l.apply(d,v)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function za({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const a=q(d=>Jn(q(v=>{const p=Yn(v);if(!p||Se(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:w,loop:C}=p;n({type:d,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:w,loop:C})}),o.media||500)),l=[we("play",a(0),s),we("pause",a(1),s),we("seeked",a(2),s),we("volumechange",a(3),s),we("ratechange",a(4),s)];return q(()=>{l.forEach(d=>d())})}function Fa({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(d,v,p){const g=new s(d,v,p);return o.set(g,{family:d,buffer:typeof v!="string",descriptors:p,fontSource:typeof v=="string"?v:JSON.stringify(Array.from(new Uint8Array(v)))}),g};const a=Dn(e.fonts,"add",function(l){return function(d){return setTimeout(q(()=>{const v=o.get(d);v&&(n(v),o.delete(d))}),0),l.apply(this,[d])}});return t.push(()=>{i.FontFace=s}),t.push(a),q(()=>{t.forEach(l=>l())})}function qa(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let a=!0;const l=q(()=>{const d=e.getSelection();if(!d||a&&(d!=null&&d.isCollapsed))return;a=d.isCollapsed||!1;const v=[],p=d.rangeCount||0;for(let g=0;g<p;g++){const f=d.getRangeAt(g),{startContainer:y,startOffset:w,endContainer:C,endOffset:S}=f;Se(y,t,o,!0)||Se(C,t,o,!0)||v.push({start:i.getId(y),startOffset:w,end:i.getId(C),endOffset:S})}s({ranges:v})});return l(),we("selectionchange",l)}function Wa({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:Dn(i.customElements,"define",function(o){return function(s,a,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,l])}})}function Za(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:l,mediaInteractionCb:d,styleSheetRuleCb:v,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:w}=n;n.mutationCb=(...C)=>{e.mutation&&e.mutation(...C),i(...C)},n.mousemoveCb=(...C)=>{e.mousemove&&e.mousemove(...C),t(...C)},n.mouseInteractionCb=(...C)=>{e.mouseInteraction&&e.mouseInteraction(...C),o(...C)},n.scrollCb=(...C)=>{e.scroll&&e.scroll(...C),s(...C)},n.viewportResizeCb=(...C)=>{e.viewportResize&&e.viewportResize(...C),a(...C)},n.inputCb=(...C)=>{e.input&&e.input(...C),l(...C)},n.mediaInteractionCb=(...C)=>{e.mediaInteaction&&e.mediaInteaction(...C),d(...C)},n.styleSheetRuleCb=(...C)=>{e.styleSheetRule&&e.styleSheetRule(...C),v(...C)},n.styleDeclarationCb=(...C)=>{e.styleDeclaration&&e.styleDeclaration(...C),p(...C)},n.canvasMutationCb=(...C)=>{e.canvasMutation&&e.canvasMutation(...C),g(...C)},n.fontCb=(...C)=>{e.font&&e.font(...C),f(...C)},n.selectionCb=(...C)=>{e.selection&&e.selection(...C),y(...C)},n.customElementCb=(...C)=>{e.customElement&&e.customElement(...C),w(...C)}}function Ja(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Za(n,e);let t;n.recordDOM&&(t=co(n,n.doc));const o=Ha(n),s=Oa(n),a=uo(n),l=Ua(n,{win:i}),d=ja(n),v=za(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Ka(n,{win:i}),g=mo(n,n.doc),f=Ga(n,{win:i}),n.collectFonts&&(y=Fa(n)));const w=qa(n),C=Wa(n),S=[];for(const M of n.plugins)S.push(M.observer(M.callback,i,M.options));return q(()=>{Cn.forEach(M=>M.reset()),t==null||t.disconnect(),o(),s(),a(),l(),d(),v(),p(),g(),f(),y(),w(),C(),S.forEach(M=>M())})}function yi(n){return typeof window[n]<"u"}function Ci(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class po{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),a.set(l,i)),l}getIds(e,i){const t=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return i.map(s=>this.getId(e,s,t,o))}getRemoteId(e,i,t){const o=t||this.getRemoteIdToIdMap(e);if(typeof i!="number")return i;const s=o.get(i);return s||-1}getRemoteIds(e,i){const t=this.getRemoteIdToIdMap(e);return i.map(o=>this.getRemoteId(e,o,t))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class $a{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new po(Kt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new po(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,i){var t;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(t=this.loadListener)===null||t===void 0||t.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const i=e;if(i.data.type!=="rrweb"||i.origin!==i.data.origin||!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var t;switch(i.type){case W.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:W.IncrementalSnapshot,data:{source:F.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case W.Meta:case W.Load:case W.DomContentLoaded:return!1;case W.Plugin:return i;case W.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case W.IncrementalSnapshot:switch(i.data.source){case F.Mutation:return i.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(o.node,s)}),i.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),i.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),i.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.Drag:case F.TouchMove:case F.MouseMove:return i.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.ViewportResize:return!1;case F.MediaInteraction:case F.MouseInteraction:case F.Scroll:case F.CanvasMutation:case F.Input:return this.replaceIds(i.data,e,["id"]),i;case F.StyleSheetRule:case F.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case F.Font:return i;case F.Selection:return i.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),i;case F.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),(t=i.data.styles)===null||t===void 0||t.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),i}}return!1}replace(e,i,t,o){for(const s of o)!Array.isArray(i[s])&&typeof i[s]!="number"||(Array.isArray(i[s])?i[s]=e.getIds(t,i[s]):i[s]=e.getId(t,i[s]));return i}replaceIds(e,i,t){return this.replace(this.crossOriginIframeMirror,e,i,t)}replaceStyleIds(e,i,t){return this.replace(this.crossOriginIframeStyleMirror,e,i,t)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(t=>{this.replaceIdOnNode(t,i)})}patchRootIdOnNode(e,i){e.type!==le.Document&&!e.rootId&&(e.rootId=i),"childNodes"in e&&e.childNodes.forEach(t=>{this.patchRootIdOnNode(t,i)})}}class Ya{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,i){if(!Wn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=co(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>t.disconnect()),this.restoreHandlers.push(uo(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(mo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(Dn(e.prototype,"attachShadow",function(o){return function(s){const a=o.call(this,s);return this.shadowRoot&&io(this)&&t.addShadowRoot(this.shadowRoot,i),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
|
|
761
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Wt={map:{},getId(){return console.error(Bn),-1},getNode(){return console.error(Bn),null},removeNodeFromMap(){console.error(Bn)},has(){return console.error(Bn),!1},reset(){console.error(Bn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Wt=new Proxy(Wt,{get(n,e,i){return e==="map"&&console.error(Bn),Reflect.get(n,e,i)}}));function Jn(n,e,i={}){let t=null,o=0;return function(...s){const a=Date.now();!o&&i.leading===!1&&(o=a);const l=e-(a-o),d=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=a,n.apply(d,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(d,s)},l))}}function bi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(a){setTimeout(()=>{i.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>bi(n,e,s||{},!0)}function Dn(n,e,i){try{if(!(e in n))return()=>{};const t=n[e],o=i(t);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:t}})),n[e]=o,()=>{n[e]=t}}catch{return()=>{}}}let fi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(fi=()=>new Date().getTime());function Zt(n){var e,i,t,o,s,a;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((i=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||i===void 0?void 0:i.scrollLeft)||((t=l==null?void 0:l.body)===null||t===void 0?void 0:t.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((s=(o=l==null?void 0:l.body)===null||o===void 0?void 0:o.parentElement)===null||s===void 0?void 0:s.scrollTop)||((a=l==null?void 0:l.body)===null||a===void 0?void 0:a.scrollTop)||0}}function Jt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function $t(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Yt(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function Se(n,e,i,t){if(!n)return!1;const o=Yt(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(vi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function La(n,e){return e.getId(n)!==-1}function Ji(n,e){return e.getId(n)===Zn}function Qt(n,e){if(qn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?Qt(n.parentNode,e):!0:!0}function $i(n){return!!n.changedTouches}function Ta(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===i)return!0;while(i=i&&i.parentNode);return!1})}function Xt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function eo(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function Yi(n){return!!(n!=null&&n.shadowRoot)}class Ea{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return(i=this.styleIDMap.get(e))!==null&&i!==void 0?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let t;return i===void 0?t=this.id++:t=i,this.styleIDMap.set(e,t),this.idStyleMap.set(t,e),t}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function no(n){var e,i;let t=null;return((i=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||i===void 0?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(t=n.getRootNode().host),t}function Pa(n){let e=n,i;for(;i=no(e);)e=i;return e}function Ia(n){const e=n.ownerDocument;if(!e)return!1;const i=Pa(n);return e.contains(i)}function io(n){const e=n.ownerDocument;return e?e.contains(n)||Ia(n):!1}var W=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(W||{}),F=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(F||{}),Le=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Le||{}),Je=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Je||{}),Rn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Rn||{});function to(n){return"__ln"in n}class Na{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let i=this.head;for(let t=0;t<e;t++)i=(i==null?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&to(e.previousSibling)){const t=e.previousSibling.__ln.next;i.next=t,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,t&&(t.previous=i)}else if(e.nextSibling&&to(e.nextSibling)&&e.nextSibling.__ln.previous){const t=e.nextSibling.__ln.previous;i.previous=t,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,t&&(t.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const oo=(n,e)=>`${n}@${e}`;class Ba{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],i=new Set,t=new Na,o=d=>{let v=d,p=Zn;for(;p===Zn;)v=v&&v.nextSibling,p=v&&this.mirror.getId(v);return p},s=d=>{if(!d.parentNode||!io(d)||d.parentNode.tagName==="TEXTAREA")return;const v=qn(d.parentNode)?this.mirror.getId(no(d)):this.mirror.getId(d.parentNode),p=o(d);if(v===-1||p===-1)return t.addNode(d);const g=Nn(d,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{Xt(f,this.mirror)&&this.iframeManager.addIframe(f),eo(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Yi(d)&&this.shadowDomManager.addShadowRoot(d.shadowRoot,this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)}});g&&(e.push({parentId:v,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const d of this.movedSet)so(this.removes,d,this.mirror)&&!this.movedSet.has(d.parentNode)||s(d);for(const d of this.addedSet)!ro(this.droppedSet,d)&&!so(this.removes,d,this.mirror)||ro(this.movedSet,d)?s(d):this.droppedSet.add(d);let a=null;for(;t.length;){let d=null;if(a){const v=this.mirror.getId(a.value.parentNode),p=o(a.value);v!==-1&&p!==-1&&(d=a)}if(!d){let v=t.tail;for(;v;){const p=v;if(v=v.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){d=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=y.parentNode.host;if(this.mirror.getId(w)!==-1){d=p;break}}}}}}if(!d){for(;t.head;)t.removeNode(t.head.value);break}a=d.previous,t.removeNode(d.value),s(d.value)}const l={texts:this.texts.map(d=>{const v=d.node;return v.parentNode&&v.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(v.parentNode),{id:this.mirror.getId(v),value:d.value}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.id)),attributes:this.attributes.map(d=>{const{attributes:v}=d;if(typeof v.style=="string"){const p=JSON.stringify(d.styleDiff),g=JSON.stringify(d._unchangedStyles);p.length<v.style.length&&(p+g).split("var(").length===v.style.split("var(").length&&(v.style=d.styleDiff)}return{id:this.mirror.getId(d.node),attributes:v}}).filter(d=>!i.has(d.id)).filter(d=>this.mirror.has(d.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.genTextAreaValueMutation=e=>{let i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,t=>t.textContent||"").join("")},this.processMutation=e=>{if(!Ji(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!Se(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:qt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,Yt(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const i=e.target;let t=e.attributeName,o=e.target.getAttribute(t);if(t==="value"){const a=Wi(i);o=qi({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(Se(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(i.tagName==="IFRAME"&&t==="src"&&!this.keepIframeSrcFn(o))if(!i.contentDocument)t="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),t==="type"&&i.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Ft(i.tagName,t)&&(s.attributes[t]=zt(this.doc,yn(i.tagName),yn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const d=i.style.getPropertyValue(l),v=i.style.getPropertyPriority(l);d!==a.style.getPropertyValue(l)||v!==a.style.getPropertyPriority(l)?v===""?s.styleDiff[l]=d:s.styleDiff[l]=[d,v]:s._unchangedStyles[l]=[d,v]}for(const l of Array.from(a.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(Se(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(i=>this.genAdds(i,e.target)),e.removedNodes.forEach(i=>{const t=this.mirror.getId(i),o=qn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);Se(e.target,this.blockClass,this.blockSelector,!1)||Ji(i,this.mirror)||!La(i,this.mirror)||(this.addedSet.has(i)?(Qi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||Qt(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[oo(t,o)]?Qi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:qn(e.target)&&Wn(e.target)?!0:void 0})),this.mapRemoves.push(i))});break}}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ji(e,this.mirror))return;this.movedSet.add(e);let t=null;i&&this.mirror.hasNode(i)&&(t=this.mirror.getId(i)),t&&t!==-1&&(this.movedMap[oo(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Se(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),Yi(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(i=>{this[i]=e[i]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Qi(n,e){n.delete(e),e.childNodes.forEach(i=>Qi(n,i))}function so(n,e,i){return n.length===0?!1:ao(n,e,i)}function ao(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:ao(n,t,i)}function ro(n,e){return n.size===0?!1:lo(n,e)}function lo(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:lo(n,i):!1}let $n;function Da(n){$n=n}function Ra(){$n=void 0}const q=n=>$n?(...i)=>{try{return n(...i)}catch(t){if($n&&$n(t)===!0)return;throw t}}:n,Cn=[];function Yn(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function co(n,e){var i,t;const o=new Ba;Cn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const a=(t=(i=window==null?void 0:window.Zone)===null||i===void 0?void 0:i.__symbol__)===null||t===void 0?void 0:t.call(i,"MutationObserver");a&&window[a]&&(s=window[a]);const l=new s(q(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function Ha({mousemoveCb:n,sampling:e,doc:i,mirror:t}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const d=Jn(q(g=>{const f=Date.now()-l;n(a.map(y=>(y.timeOffset-=f,y)),g),a=[],l=null}),s),v=q(Jn(q(g=>{const f=Yn(g),{clientX:y,clientY:w}=$i(g)?g.changedTouches[0]:g;l||(l=fi()),a.push({x:y,y:w,id:t.getId(f),timeOffset:fi()-l}),d(typeof DragEvent<"u"&&g instanceof DragEvent?F.Drag:g instanceof MouseEvent?F.MouseMove:F.TouchMove)}),o,{trailing:!1})),p=[we("mousemove",v,i),we("touchmove",v,i),we("drag",v,i)];return q(()=>{p.forEach(g=>g())})}function Oa({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let d=null;const v=p=>g=>{const f=Yn(g);if(Se(f,t,o,!0))return;let y=null,w=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Je.Mouse;break;case"touch":y=Je.Touch;break;case"pen":y=Je.Pen;break}y===Je.Touch?Le[p]===Le.MouseDown?w="TouchStart":Le[p]===Le.MouseUp&&(w="TouchEnd"):Je.Pen}else $i(g)&&(y=Je.Touch);y!==null?(d=y,(w.startsWith("Touch")&&y===Je.Touch||w.startsWith("Mouse")&&y===Je.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=d,d=null);const C=$i(g)?g.changedTouches[0]:g;if(!C)return;const S=i.getId(f),{clientX:M,clientY:A}=C;q(n)(Object.assign({type:Le[w],id:S,x:M,y:A},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&a[p]!==!1).forEach(p=>{let g=yn(p);const f=v(p);if(window.PointerEvent)switch(Le[p]){case Le.MouseDown:case Le.MouseUp:g=g.replace("mouse","pointer");break;case Le.TouchStart:case Le.TouchEnd:return}l.push(we(g,f,e))}),q(()=>{l.forEach(p=>p())})}function uo({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const a=q(Jn(q(l=>{const d=Yn(l);if(!d||Se(d,t,o,!0))return;const v=i.getId(d);if(d===e&&e.defaultView){const p=Zt(e.defaultView);n({id:v,x:p.left,y:p.top})}else n({id:v,x:d.scrollLeft,y:d.scrollTop})}),s.scroll||100));return we("scroll",a,e)}function Ua({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q(Jn(q(()=>{const s=Jt(),a=$t();(i!==s||t!==a)&&(n({width:Number(a),height:Number(s)}),i=s,t=a)}),200));return we("resize",o,e)}const Va=["INPUT","TEXTAREA","SELECT"],ho=new WeakMap;function ja({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:l,maskInputFn:d,sampling:v,userTriggeredOnInput:p}){function g(A){let _=Yn(A);const T=A.isTrusted,I=_&&_.tagName;if(_&&I==="OPTION"&&(_=_.parentElement),!_||!I||Va.indexOf(I)<0||Se(_,t,o,!0)||_.classList.contains(s)||a&&_.matches(a))return;let K=_.value,z=!1;const U=Wi(_)||"";U==="radio"||U==="checkbox"?z=_.checked:(l[I.toLowerCase()]||l[U])&&(K=qi({element:_,maskInputOptions:l,tagName:I,type:U,value:K,maskInputFn:d})),f(_,p?{text:K,isChecked:z,userTriggered:T}:{text:K,isChecked:z});const G=_.name;U==="radio"&&G&&z&&e.querySelectorAll(`input[type="radio"][name="${G}"]`).forEach(oe=>{if(oe!==_){const ge=oe.value;f(oe,p?{text:ge,isChecked:!z,userTriggered:!1}:{text:ge,isChecked:!z})}})}function f(A,_){const T=ho.get(A);if(!T||T.text!==_.text||T.isChecked!==_.isChecked){ho.set(A,_);const I=i.getId(A);q(n)(Object.assign(Object.assign({},_),{id:I}))}}const w=(v.input==="last"?["change"]:["input","change"]).map(A=>we(A,q(g),e)),C=e.defaultView;if(!C)return()=>{w.forEach(A=>A())};const S=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),M=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&w.push(...M.map(A=>bi(A[0],A[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,C))),q(()=>{w.forEach(A=>A())})}function gi(n){const e=[];function i(t,o){if(yi("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||yi("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||yi("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||yi("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const a=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(a)}else if(t.parentStyleSheet){const a=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(a)}return o}return i(n,e)}function rn(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Ka({styleSheetRuleCb:n,mirror:e,stylesheetManager:i},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const o=t.CSSStyleSheet.prototype.insertRule;t.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:q((p,g,f)=>{const[y,w]=f,{id:C,styleId:S}=rn(g,e,i.styleMirror);return(C&&C!==-1||S&&S!==-1)&&n({id:C,styleId:S,adds:[{rule:y,index:w}]}),p.apply(g,f)})});const s=t.CSSStyleSheet.prototype.deleteRule;t.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:q((p,g,f)=>{const[y]=f,{id:w,styleId:C}=rn(g,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,removes:[{index:y}]}),p.apply(g,f)})});let a;t.CSSStyleSheet.prototype.replace&&(a=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:q((p,g,f)=>{const[y]=f,{id:w,styleId:C}=rn(g,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replace:y}),p.apply(g,f)})}));let l;t.CSSStyleSheet.prototype.replaceSync&&(l=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:q((p,g,f)=>{const[y]=f,{id:w,styleId:C}=rn(g,e,i.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,replaceSync:y}),p.apply(g,f)})}));const d={};Ci("CSSGroupingRule")?d.CSSGroupingRule=t.CSSGroupingRule:(Ci("CSSMediaRule")&&(d.CSSMediaRule=t.CSSMediaRule),Ci("CSSConditionRule")&&(d.CSSConditionRule=t.CSSConditionRule),Ci("CSSSupportsRule")&&(d.CSSSupportsRule=t.CSSSupportsRule));const v={};return Object.entries(d).forEach(([p,g])=>{v[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(v[p].insertRule,{apply:q((f,y,w)=>{const[C,S]=w,{id:M,styleId:A}=rn(y.parentStyleSheet,e,i.styleMirror);return(M&&M!==-1||A&&A!==-1)&&n({id:M,styleId:A,adds:[{rule:C,index:[...gi(y),S||0]}]}),f.apply(y,w)})}),g.prototype.deleteRule=new Proxy(v[p].deleteRule,{apply:q((f,y,w)=>{const[C]=w,{id:S,styleId:M}=rn(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||M&&M!==-1)&&n({id:S,styleId:M,removes:[{index:[...gi(y),C]}]}),f.apply(y,w)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,a&&(t.CSSStyleSheet.prototype.replace=a),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach(([p,g])=>{g.prototype.insertRule=v[p].insertRule,g.prototype.deleteRule=v[p].deleteRule})})}function mo({mirror:n,stylesheetManager:e},i){var t,o,s;let a=null;i.nodeName==="#document"?a=n.getId(i):a=n.getId(i.host);const l=i.nodeName==="#document"?(t=i.defaultView)===null||t===void 0?void 0:t.Document:(s=(o=i.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,d=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!d?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get(){var v;return(v=d.get)===null||v===void 0?void 0:v.call(this)},set(v){var p;const g=(p=d.set)===null||p===void 0?void 0:p.call(this,v);if(a!==null&&a!==-1)try{e.adoptStyleSheets(v,a)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))}function Ga({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:i,stylesheetManager:t},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:q((l,d,v)=>{var p;const[g,f,y]=v;if(i.has(g))return s.apply(d,[g,f,y]);const{id:w,styleId:C}=rn((p=d.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(w&&w!==-1||C&&C!==-1)&&n({id:w,styleId:C,set:{property:g,value:f,priority:y},index:gi(d.parentRule)}),l.apply(d,v)})});const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:q((l,d,v)=>{var p;const[g]=v;if(i.has(g))return a.apply(d,[g]);const{id:f,styleId:y}=rn((p=d.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&n({id:f,styleId:y,remove:{property:g},index:gi(d.parentRule)}),l.apply(d,v)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function za({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const a=q(d=>Jn(q(v=>{const p=Yn(v);if(!p||Se(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:w,loop:C}=p;n({type:d,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:w,loop:C})}),o.media||500)),l=[we("play",a(0),s),we("pause",a(1),s),we("seeked",a(2),s),we("volumechange",a(3),s),we("ratechange",a(4),s)];return q(()=>{l.forEach(d=>d())})}function Fa({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(d,v,p){const g=new s(d,v,p);return o.set(g,{family:d,buffer:typeof v!="string",descriptors:p,fontSource:typeof v=="string"?v:JSON.stringify(Array.from(new Uint8Array(v)))}),g};const a=Dn(e.fonts,"add",function(l){return function(d){return setTimeout(q(()=>{const v=o.get(d);v&&(n(v),o.delete(d))}),0),l.apply(this,[d])}});return t.push(()=>{i.FontFace=s}),t.push(a),q(()=>{t.forEach(l=>l())})}function qa(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let a=!0;const l=q(()=>{const d=e.getSelection();if(!d||a&&(d!=null&&d.isCollapsed))return;a=d.isCollapsed||!1;const v=[],p=d.rangeCount||0;for(let g=0;g<p;g++){const f=d.getRangeAt(g),{startContainer:y,startOffset:w,endContainer:C,endOffset:S}=f;Se(y,t,o,!0)||Se(C,t,o,!0)||v.push({start:i.getId(y),startOffset:w,end:i.getId(C),endOffset:S})}s({ranges:v})});return l(),we("selectionchange",l)}function Wa({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:Dn(i.customElements,"define",function(o){return function(s,a,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,l])}})}function Za(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:l,mediaInteractionCb:d,styleSheetRuleCb:v,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:w}=n;n.mutationCb=(...C)=>{e.mutation&&e.mutation(...C),i(...C)},n.mousemoveCb=(...C)=>{e.mousemove&&e.mousemove(...C),t(...C)},n.mouseInteractionCb=(...C)=>{e.mouseInteraction&&e.mouseInteraction(...C),o(...C)},n.scrollCb=(...C)=>{e.scroll&&e.scroll(...C),s(...C)},n.viewportResizeCb=(...C)=>{e.viewportResize&&e.viewportResize(...C),a(...C)},n.inputCb=(...C)=>{e.input&&e.input(...C),l(...C)},n.mediaInteractionCb=(...C)=>{e.mediaInteaction&&e.mediaInteaction(...C),d(...C)},n.styleSheetRuleCb=(...C)=>{e.styleSheetRule&&e.styleSheetRule(...C),v(...C)},n.styleDeclarationCb=(...C)=>{e.styleDeclaration&&e.styleDeclaration(...C),p(...C)},n.canvasMutationCb=(...C)=>{e.canvasMutation&&e.canvasMutation(...C),g(...C)},n.fontCb=(...C)=>{e.font&&e.font(...C),f(...C)},n.selectionCb=(...C)=>{e.selection&&e.selection(...C),y(...C)},n.customElementCb=(...C)=>{e.customElement&&e.customElement(...C),w(...C)}}function Ja(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Za(n,e);let t;n.recordDOM&&(t=co(n,n.doc));const o=Ha(n),s=Oa(n),a=uo(n),l=Ua(n,{win:i}),d=ja(n),v=za(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Ka(n,{win:i}),g=mo(n,n.doc),f=Ga(n,{win:i}),n.collectFonts&&(y=Fa(n)));const w=qa(n),C=Wa(n),S=[];for(const M of n.plugins)S.push(M.observer(M.callback,i,M.options));return q(()=>{Cn.forEach(M=>M.reset()),t==null||t.disconnect(),o(),s(),a(),l(),d(),v(),p(),g(),f(),y(),w(),C(),S.forEach(M=>M())})}function yi(n){return typeof window[n]<"u"}function Ci(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class po{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),a.set(l,i)),l}getIds(e,i){const t=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return i.map(s=>this.getId(e,s,t,o))}getRemoteId(e,i,t){const o=t||this.getRemoteIdToIdMap(e);if(typeof i!="number")return i;const s=o.get(i);return s||-1}getRemoteIds(e,i){const t=this.getRemoteIdToIdMap(e);return i.map(o=>this.getRemoteId(e,o,t))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class $a{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new po(Kt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new po(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,i){var t;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(t=this.loadListener)===null||t===void 0||t.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const i=e;if(i.data.type!=="rrweb"||i.origin!==i.data.origin||!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var t;switch(i.type){case W.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:W.IncrementalSnapshot,data:{source:F.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case W.Meta:case W.Load:case W.DomContentLoaded:return!1;case W.Plugin:return i;case W.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case W.IncrementalSnapshot:switch(i.data.source){case F.Mutation:return i.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(o.node,s)}),i.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),i.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),i.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.Drag:case F.TouchMove:case F.MouseMove:return i.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.ViewportResize:return!1;case F.MediaInteraction:case F.MouseInteraction:case F.Scroll:case F.CanvasMutation:case F.Input:return this.replaceIds(i.data,e,["id"]),i;case F.StyleSheetRule:case F.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case F.Font:return i;case F.Selection:return i.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),i;case F.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),(t=i.data.styles)===null||t===void 0||t.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),i}}return!1}replace(e,i,t,o){for(const s of o)!Array.isArray(i[s])&&typeof i[s]!="number"||(Array.isArray(i[s])?i[s]=e.getIds(t,i[s]):i[s]=e.getId(t,i[s]));return i}replaceIds(e,i,t){return this.replace(this.crossOriginIframeMirror,e,i,t)}replaceStyleIds(e,i,t){return this.replace(this.crossOriginIframeStyleMirror,e,i,t)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(t=>{this.replaceIdOnNode(t,i)})}patchRootIdOnNode(e,i){e.type!==le.Document&&!e.rootId&&(e.rootId=i),"childNodes"in e&&e.childNodes.forEach(t=>{this.patchRootIdOnNode(t,i)})}}class Ya{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,i){if(!Wn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=co(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>t.disconnect()),this.restoreHandlers.push(uo(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(mo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(Dn(e.prototype,"attachShadow",function(o){return function(s){const a=o.call(this,s);return this.shadowRoot&&io(this)&&t.addShadowRoot(this.shadowRoot,i),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
|
|
762
762
|
Copyright (c) Microsoft Corporation.
|
|
763
763
|
|
|
764
764
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -786,13 +786,13 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
786
786
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
787
787
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
788
788
|
PERFORMANCE OF THIS SOFTWARE.
|
|
789
|
-
***************************************************************************** */function n(v,p,g,f){function y(w){return w instanceof g?w:new g(function(C){C(w)})}return new(g||(g=Promise))(function(w,C){function S(_){try{A(f.next(_))}catch(T){C(T)}}function M(_){try{A(f.throw(_))}catch(T){C(T)}}function A(_){_.done?w(_.value):y(_.value).then(S,M)}A((f=f.apply(v,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=typeof Uint8Array>"u"?[]:new Uint8Array(256),t=0;t<e.length;t++)i[e.charCodeAt(t)]=t;var o=function(v){var p=new Uint8Array(v),g,f=p.length,y="";for(g=0;g<f;g+=3)y+=e[p[g]>>2],y+=e[(p[g]&3)<<4|p[g+1]>>4],y+=e[(p[g+1]&15)<<2|p[g+2]>>6],y+=e[p[g+2]&63];return f%3===2?y=y.substring(0,y.length-1)+"=":f%3===1&&(y=y.substring(0,y.length-2)+"=="),y};const s=new Map,a=new Map;function l(v,p,g){return n(this,void 0,void 0,function*(){const f=`${v}-${p}`;if("OffscreenCanvas"in globalThis){if(a.has(f))return a.get(f);const y=new OffscreenCanvas(v,p);y.getContext("2d");const C=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(C);return a.set(f,S),S}else return""})}const d=self;d.onmessage=function(v){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:w}=v.data,C=l(f,y,w),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const A=yield S.convertToBlob(w),_=A.type,T=yield A.arrayBuffer(),I=o(T);if(!s.has(p)&&(yield C)===I)return s.set(p,I),d.postMessage({id:p});if(s.get(p)===I)return d.postMessage({id:p});d.postMessage({id:p,type:_,base64:I,width:f,height:y}),s.set(p,I)}else return d.postMessage({id:v.data.id})})}})()});class cr{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(d,v)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(d)||this.pendingCanvasMutations.set(d,[]),this.pendingCanvasMutations.get(d).push(v)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&i==="all"&&this.initCanvasMutationObserver(t,o,s),a&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const a=yo(i,t,o,!0),l=new Map,d=new dr;d.onmessage=w=>{const{id:C}=w.data;if(l.set(C,!1),!("base64"in w.data))return;const{base64:S,type:M,width:A,height:_}=w.data;this.mutationCb({id:C,type:Rn["2D"],commands:[{property:"clearRect",args:[0,0,A,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const v=1e3/e;let p=0,g;const f=()=>{const w=[];return i.document.querySelectorAll("canvas").forEach(C=>{Se(C,t,o,!0)||w.push(C)}),w},y=w=>{if(p&&w-p<v){g=requestAnimationFrame(y);return}p=w,f().forEach(C=>Xa(this,void 0,void 0,function*(){var S;const M=this.mirror.getId(C);if(l.get(M)||C.width===0||C.height===0)return;if(l.set(M,!0),["webgl","webgl2"].includes(C.__context)){const _=C.getContext(C.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(C);d.postMessage({id:M,bitmap:A,width:C.width,height:C.height,dataURLOptions:s.dataURLOptions},[A])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{a(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=yo(e,i,t,!1),s=tr(this.processMutation.bind(this),e,i,t),a=sr(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=i=>{this.rafStamps.latestId=i,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,i)=>{const t=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,t)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const t=this.pendingCanvasMutations.get(e);if(!t||i===-1)return;const o=t.map(a=>Qa(a,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class ur{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ea,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(e.length===0)return;const t={id:i,styleIds:[]},o=[];for(const s of e){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(l,d)=>({rule:Ot(l),index:d}))})),t.styleIds.push(a)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class hr{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,i){const t=this.nodeMap.get(e);return t&&Array.from(t).some(o=>o!==i)}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function de(n){return Object.assign(Object.assign({},n),{timestamp:fi()})}let ae,Si,Xi,_i=!1;const Ve=sa();function Qn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:d="rr-mask",maskTextSelector:v=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:w,maskTextFn:C,hooks:S,packFn:M,sampling:A={},dataURLOptions:_={},mousemoveWait:T,recordDOM:I=!0,recordCanvas:K=!1,recordCrossOriginIframes:z=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:oe=!1,inlineImages:ge=!1,plugins:V,keepIframeSrcFn:_e=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Da(Te);const Me=z?window.parent===window:!0;let Xe=!1;if(!Me)try{window.parent.document&&(Xe=!1)}catch{Xe=!0}if(Me&&!e)throw new Error("emit function is required");T!==void 0&&A.mousemove===void 0&&(A.mousemove=T),Ve.reset();const vn=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},en=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};Ta();let _n,bn=0;const Ee=B=>{for(const he of V||[])he.eventProcessor&&(B=he.eventProcessor(B));return M&&!Xe&&(B=M(B)),B};ae=(B,he)=>{var Q;if(!((Q=Cn[0])===null||Q===void 0)&&Q.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===F.Mutation)&&Cn.forEach(me=>me.unfreeze()),Me)e==null||e(Ee(B),he);else if(Xe){const me={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:he};window.parent.postMessage(me,"*")}if(B.type===W.FullSnapshot)_n=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===F.Mutation&&B.data.isAttachIframe)return;bn++;const me=t&&bn>=t,Ie=i&&B.timestamp-_n.timestamp>i;(me||Ie)&&Si(!0)}};const nn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Mutation},B)}))},Mn=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Scroll},B)})),re=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CanvasMutation},B)})),fe=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.AdoptedStyleSheet},B)})),He=new ur({mutationCb:nn,adoptedStyleSheetCb:fe}),Pe=new $a({mirror:Ve,mutationCb:nn,stylesheetManager:He,recordCrossOriginIframes:z,wrappedEmit:ae});for(const B of V||[])B.getMirror&&B.getMirror({nodeMirror:Ve,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const ke=new hr;Xi=new cr({recordCanvas:K,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Ve,sampling:A.canvas,dataURLOptions:_});const We=new Ya({mutationCb:nn,scrollCb:Mn,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskInputOptions:vn,dataURLOptions:_,maskTextFn:C,maskInputFn:w,recordCanvas:K,inlineImages:ge,sampling:A,slimDOMOptions:en,iframeManager:Pe,stylesheetManager:He,canvasManager:Xi,keepIframeSrcFn:_e,processedNodeManager:ke},mirror:Ve});Si=(B=!1)=>{if(!I)return;ae(de({type:W.Meta,data:{href:window.location.href,width:$t(),height:Jt()}}),B),He.reset(),We.init(),Cn.forEach(Q=>Q.lock());const he=xa(document,{mirror:Ve,blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskAllInputs:vn,maskTextFn:C,slimDOM:en,dataURLOptions:_,recordCanvas:K,inlineImages:ge,onSerialize:Q=>{Xt(Q,Ve)&&Pe.addIframe(Q),eo(Q,Ve)&&He.trackLinkElement(Q),Yi(Q)&&We.addShadowRoot(Q.shadowRoot,document)},onIframeLoad:(Q,me)=>{Pe.attachIframe(Q,me),We.observeAttachShadow(Q)},onStylesheetLoad:(Q,me)=>{He.attachLinkElement(Q,me)},keepIframeSrcFn:_e});if(!he)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:he,initialOffset:Zt(window)}}),B),Cn.forEach(Q=>Q.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&He.adoptStyleSheets(document.adoptedStyleSheets,Ve.getId(document))};try{const B=[],he=me=>{var Ie;return q(Ja)({mutationCb:nn,mousemoveCb:($,fn)=>ae(de({type:W.IncrementalSnapshot,data:{source:fn,positions:$}})),mouseInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MouseInteraction},$)})),scrollCb:Mn,viewportResizeCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.ViewportResize},$)})),inputCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Input},$)})),mediaInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MediaInteraction},$)})),styleSheetRuleCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleSheetRule},$)})),styleDeclarationCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleDeclaration},$)})),canvasMutationCb:re,fontCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Font},$)})),selectionCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Selection},$)}))},customElementCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CustomElement},$)}))},blockClass:o,ignoreClass:a,ignoreSelector:l,maskTextClass:d,maskTextSelector:v,maskInputOptions:vn,inlineStylesheet:p,sampling:A,recordDOM:I,recordCanvas:K,inlineImages:ge,userTriggeredOnInput:G,collectFonts:oe,doc:me,maskInputFn:w,maskTextFn:C,keepIframeSrcFn:_e,blockSelector:s,slimDOMOptions:en,dataURLOptions:_,mirror:Ve,iframeManager:Pe,stylesheetManager:He,shadowDomManager:We,processedNodeManager:ke,canvasManager:Xi,ignoreCSSAttributes:ue,plugins:((Ie=V==null?void 0:V.filter($=>$.observer))===null||Ie===void 0?void 0:Ie.map($=>({observer:$.observer,options:$.options,callback:fn=>ae(de({type:W.Plugin,data:{plugin:$.name,payload:fn}}))})))||[]},S)};Pe.addLoadListener(me=>{try{B.push(he(me.contentDocument))}catch(Ie){console.warn(Ie)}});const Q=()=>{Si(),B.push(he(document)),_i=!0};return document.readyState==="interactive"||document.readyState==="complete"?Q():(B.push(we("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&Q()})),B.push(we("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&Q()},window))),()=>{B.forEach(me=>me()),ke.destroy(),_i=!1,Ra()}}catch(B){console.warn(B)}}Qn.addCustomEvent=(n,e)=>{if(!_i)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Qn.freezePage=()=>{Cn.forEach(n=>n.freeze())},Qn.takeFullSnapshot=n=>{if(!_i)throw new Error("please take full snapshot after start recording");Si(n)},Qn.mirror=Ve;var ko=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(ko||{}),ze=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(ze||{}),Je={DEBUG:!1,LIB_VERSION:"2.55.1"},D;if(typeof window>"u"){var wo={hostname:""};D={navigator:{userAgent:"",onLine:!0},document:{location:wo,referrer:""},screen:{width:0,height:0},location:wo}}else D=window;var Xn=24*60*60*1e3,et=8*1e3,Mi=Array.prototype,mr=Function.prototype,So=Object.prototype,ln=Mi.slice,ei=So.toString,Ai=So.hasOwnProperty,ce=D.console,dn=D.navigator,ee=D.document,xi=D.opera,Li=D.screen,Fe=dn.userAgent,nt=mr.bind,_o=Mi.forEach,Mo=Mi.indexOf,Ao=Mi.map,pr=Array.isArray,it={},m={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{m.each(arguments,function(e){ce.log(e)})}},warn:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(m.toArray(arguments));try{ce.warn.apply(ce,n)}catch{m.each(n,function(i){ce.warn(i)})}}},error:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}},critical:function(){if(!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}}},tt=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Ti=function(n){return{log:tt(J.log,n),error:tt(J.error,n),critical:tt(J.critical,n)}};m.bind=function(n,e){var i,t;if(nt&&n.bind===nt)return nt.apply(n,ln.call(arguments,1));if(!m.isFunction(n))throw new TypeError;return i=ln.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(ln.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var a=n.apply(s,i.concat(ln.call(arguments)));return Object(a)===a?a:s},t},m.each=function(n,e,i){if(n!=null){if(_o&&n.forEach===_o)n.forEach(e,i);else if(n.length===+n.length){for(var t=0,o=n.length;t<o;t++)if(t in n&&e.call(i,n[t],t,n)===it)return}else for(var s in n)if(Ai.call(n,s)&&e.call(i,n[s],s,n)===it)return}},m.extend=function(n){return m.each(ln.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},m.isArray=pr||function(n){return ei.call(n)==="[object Array]"},m.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},m.isArguments=function(n){return!!(n&&Ai.call(n,"callee"))},m.toArray=function(n){return n?n.toArray?n.toArray():m.isArray(n)||m.isArguments(n)?ln.call(n):m.values(n):[]},m.map=function(n,e,i){if(Ao&&n.map===Ao)return n.map(e,i);var t=[];return m.each(n,function(o){t.push(e.call(i,o))}),t},m.keys=function(n){var e=[];return n===null||m.each(n,function(i,t){e[e.length]=t}),e},m.values=function(n){var e=[];return n===null||m.each(n,function(i){e[e.length]=i}),e},m.include=function(n,e){var i=!1;return n===null?i:Mo&&n.indexOf===Mo?n.indexOf(e)!=-1:(m.each(n,function(t){if(i||(i=t===e))return it}),i)},m.includes=function(n,e){return n.indexOf(e)!==-1},m.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},m.isObject=function(n){return n===Object(n)&&!m.isArray(n)},m.isEmptyObject=function(n){if(m.isObject(n)){for(var e in n)if(Ai.call(n,e))return!1;return!0}return!1},m.isUndefined=function(n){return n===void 0},m.isString=function(n){return ei.call(n)=="[object String]"},m.isDate=function(n){return ei.call(n)=="[object Date]"},m.isNumber=function(n){return ei.call(n)=="[object Number]"},m.isElement=function(n){return!!(n&&n.nodeType===1)},m.encodeDates=function(n){return m.each(n,function(e,i){m.isDate(e)?n[i]=m.formatDate(e):m.isObject(e)&&(n[i]=m.encodeDates(e))}),n},m.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},m.formatDate=function(n){function e(i){return i<10?"0"+i:i}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},m.strip_empty_properties=function(n){var e={};return m.each(n,function(i,t){m.isString(i)&&i.length>0&&(e[t]=i)}),e},m.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):m.isArray(n)?(i=[],m.each(n,function(t){i.push(m.truncate(t,e))})):m.isObject(n)?(i={},m.each(n,function(t,o){i[o]=m.truncate(t,e)})):i=n,i},m.JSONEncode=function(){return function(n){var e=n,i=function(o){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var d=a[l];return typeof d=="string"?d:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var a="",l=" ",d=0,v="",p="",g=0,f=a,y=[],w=s[o];switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(o)),typeof w){case"string":return i(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":return String(w);case"object":if(!w)return"null";if(a+=l,y=[],ei.apply(w)==="[object Array]"){for(g=w.length,d=0;d<g;d+=1)y[d]=t(d,w)||"null";return p=y.length===0?"[]":a?`[
|
|
789
|
+
***************************************************************************** */function n(v,p,g,f){function y(w){return w instanceof g?w:new g(function(C){C(w)})}return new(g||(g=Promise))(function(w,C){function S(_){try{A(f.next(_))}catch(T){C(T)}}function M(_){try{A(f.throw(_))}catch(T){C(T)}}function A(_){_.done?w(_.value):y(_.value).then(S,M)}A((f=f.apply(v,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=typeof Uint8Array>"u"?[]:new Uint8Array(256),t=0;t<e.length;t++)i[e.charCodeAt(t)]=t;var o=function(v){var p=new Uint8Array(v),g,f=p.length,y="";for(g=0;g<f;g+=3)y+=e[p[g]>>2],y+=e[(p[g]&3)<<4|p[g+1]>>4],y+=e[(p[g+1]&15)<<2|p[g+2]>>6],y+=e[p[g+2]&63];return f%3===2?y=y.substring(0,y.length-1)+"=":f%3===1&&(y=y.substring(0,y.length-2)+"=="),y};const s=new Map,a=new Map;function l(v,p,g){return n(this,void 0,void 0,function*(){const f=`${v}-${p}`;if("OffscreenCanvas"in globalThis){if(a.has(f))return a.get(f);const y=new OffscreenCanvas(v,p);y.getContext("2d");const C=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(C);return a.set(f,S),S}else return""})}const d=self;d.onmessage=function(v){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:w}=v.data,C=l(f,y,w),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const A=yield S.convertToBlob(w),_=A.type,T=yield A.arrayBuffer(),I=o(T);if(!s.has(p)&&(yield C)===I)return s.set(p,I),d.postMessage({id:p});if(s.get(p)===I)return d.postMessage({id:p});d.postMessage({id:p,type:_,base64:I,width:f,height:y}),s.set(p,I)}else return d.postMessage({id:v.data.id})})}})()});class cr{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(d,v)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(d)||this.pendingCanvasMutations.set(d,[]),this.pendingCanvasMutations.get(d).push(v)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&i==="all"&&this.initCanvasMutationObserver(t,o,s),a&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const a=yo(i,t,o,!0),l=new Map,d=new dr;d.onmessage=w=>{const{id:C}=w.data;if(l.set(C,!1),!("base64"in w.data))return;const{base64:S,type:M,width:A,height:_}=w.data;this.mutationCb({id:C,type:Rn["2D"],commands:[{property:"clearRect",args:[0,0,A,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const v=1e3/e;let p=0,g;const f=()=>{const w=[];return i.document.querySelectorAll("canvas").forEach(C=>{Se(C,t,o,!0)||w.push(C)}),w},y=w=>{if(p&&w-p<v){g=requestAnimationFrame(y);return}p=w,f().forEach(C=>Xa(this,void 0,void 0,function*(){var S;const M=this.mirror.getId(C);if(l.get(M)||C.width===0||C.height===0)return;if(l.set(M,!0),["webgl","webgl2"].includes(C.__context)){const _=C.getContext(C.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(C);d.postMessage({id:M,bitmap:A,width:C.width,height:C.height,dataURLOptions:s.dataURLOptions},[A])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{a(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=yo(e,i,t,!1),s=tr(this.processMutation.bind(this),e,i,t),a=sr(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=i=>{this.rafStamps.latestId=i,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,i)=>{const t=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,t)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const t=this.pendingCanvasMutations.get(e);if(!t||i===-1)return;const o=t.map(a=>Qa(a,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class ur{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ea,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(e.length===0)return;const t={id:i,styleIds:[]},o=[];for(const s of e){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(l,d)=>({rule:Ot(l),index:d}))})),t.styleIds.push(a)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class hr{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,i){const t=this.nodeMap.get(e);return t&&Array.from(t).some(o=>o!==i)}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function de(n){return Object.assign(Object.assign({},n),{timestamp:fi()})}let ae,Si,Xi,_i=!1;const Ve=sa();function Qn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:d="rr-mask",maskTextSelector:v=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:w,maskTextFn:C,hooks:S,packFn:M,sampling:A={},dataURLOptions:_={},mousemoveWait:T,recordDOM:I=!0,recordCanvas:K=!1,recordCrossOriginIframes:z=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:oe=!1,inlineImages:ge=!1,plugins:V,keepIframeSrcFn:_e=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Da(Te);const Me=z?window.parent===window:!0;let en=!1;if(!Me)try{window.parent.document&&(en=!1)}catch{en=!0}if(Me&&!e)throw new Error("emit function is required");T!==void 0&&A.mousemove===void 0&&(A.mousemove=T),Ve.reset();const vn=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},nn=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};Ta();let _n,bn=0;const Ee=B=>{for(const he of V||[])he.eventProcessor&&(B=he.eventProcessor(B));return M&&!en&&(B=M(B)),B};ae=(B,he)=>{var Q;if(!((Q=Cn[0])===null||Q===void 0)&&Q.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===F.Mutation)&&Cn.forEach(me=>me.unfreeze()),Me)e==null||e(Ee(B),he);else if(en){const me={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:he};window.parent.postMessage(me,"*")}if(B.type===W.FullSnapshot)_n=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===F.Mutation&&B.data.isAttachIframe)return;bn++;const me=t&&bn>=t,Ie=i&&B.timestamp-_n.timestamp>i;(me||Ie)&&Si(!0)}};const tn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Mutation},B)}))},Mn=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Scroll},B)})),re=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CanvasMutation},B)})),fe=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.AdoptedStyleSheet},B)})),He=new ur({mutationCb:tn,adoptedStyleSheetCb:fe}),Pe=new $a({mirror:Ve,mutationCb:tn,stylesheetManager:He,recordCrossOriginIframes:z,wrappedEmit:ae});for(const B of V||[])B.getMirror&&B.getMirror({nodeMirror:Ve,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const ke=new hr;Xi=new cr({recordCanvas:K,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Ve,sampling:A.canvas,dataURLOptions:_});const We=new Ya({mutationCb:tn,scrollCb:Mn,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskInputOptions:vn,dataURLOptions:_,maskTextFn:C,maskInputFn:w,recordCanvas:K,inlineImages:ge,sampling:A,slimDOMOptions:nn,iframeManager:Pe,stylesheetManager:He,canvasManager:Xi,keepIframeSrcFn:_e,processedNodeManager:ke},mirror:Ve});Si=(B=!1)=>{if(!I)return;ae(de({type:W.Meta,data:{href:window.location.href,width:$t(),height:Jt()}}),B),He.reset(),We.init(),Cn.forEach(Q=>Q.lock());const he=xa(document,{mirror:Ve,blockClass:o,blockSelector:s,maskTextClass:d,maskTextSelector:v,inlineStylesheet:p,maskAllInputs:vn,maskTextFn:C,slimDOM:nn,dataURLOptions:_,recordCanvas:K,inlineImages:ge,onSerialize:Q=>{Xt(Q,Ve)&&Pe.addIframe(Q),eo(Q,Ve)&&He.trackLinkElement(Q),Yi(Q)&&We.addShadowRoot(Q.shadowRoot,document)},onIframeLoad:(Q,me)=>{Pe.attachIframe(Q,me),We.observeAttachShadow(Q)},onStylesheetLoad:(Q,me)=>{He.attachLinkElement(Q,me)},keepIframeSrcFn:_e});if(!he)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:he,initialOffset:Zt(window)}}),B),Cn.forEach(Q=>Q.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&He.adoptStyleSheets(document.adoptedStyleSheets,Ve.getId(document))};try{const B=[],he=me=>{var Ie;return q(Ja)({mutationCb:tn,mousemoveCb:($,fn)=>ae(de({type:W.IncrementalSnapshot,data:{source:fn,positions:$}})),mouseInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MouseInteraction},$)})),scrollCb:Mn,viewportResizeCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.ViewportResize},$)})),inputCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Input},$)})),mediaInteractionCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MediaInteraction},$)})),styleSheetRuleCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleSheetRule},$)})),styleDeclarationCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleDeclaration},$)})),canvasMutationCb:re,fontCb:$=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Font},$)})),selectionCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Selection},$)}))},customElementCb:$=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CustomElement},$)}))},blockClass:o,ignoreClass:a,ignoreSelector:l,maskTextClass:d,maskTextSelector:v,maskInputOptions:vn,inlineStylesheet:p,sampling:A,recordDOM:I,recordCanvas:K,inlineImages:ge,userTriggeredOnInput:G,collectFonts:oe,doc:me,maskInputFn:w,maskTextFn:C,keepIframeSrcFn:_e,blockSelector:s,slimDOMOptions:nn,dataURLOptions:_,mirror:Ve,iframeManager:Pe,stylesheetManager:He,shadowDomManager:We,processedNodeManager:ke,canvasManager:Xi,ignoreCSSAttributes:ue,plugins:((Ie=V==null?void 0:V.filter($=>$.observer))===null||Ie===void 0?void 0:Ie.map($=>({observer:$.observer,options:$.options,callback:fn=>ae(de({type:W.Plugin,data:{plugin:$.name,payload:fn}}))})))||[]},S)};Pe.addLoadListener(me=>{try{B.push(he(me.contentDocument))}catch(Ie){console.warn(Ie)}});const Q=()=>{Si(),B.push(he(document)),_i=!0};return document.readyState==="interactive"||document.readyState==="complete"?Q():(B.push(we("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&Q()})),B.push(we("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&Q()},window))),()=>{B.forEach(me=>me()),ke.destroy(),_i=!1,Ra()}}catch(B){console.warn(B)}}Qn.addCustomEvent=(n,e)=>{if(!_i)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Qn.freezePage=()=>{Cn.forEach(n=>n.freeze())},Qn.takeFullSnapshot=n=>{if(!_i)throw new Error("please take full snapshot after start recording");Si(n)},Qn.mirror=Ve;var ko=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(ko||{}),ze=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(ze||{}),$e={DEBUG:!1,LIB_VERSION:"2.55.1"},D;if(typeof window>"u"){var wo={hostname:""};D={navigator:{userAgent:"",onLine:!0},document:{location:wo,referrer:""},screen:{width:0,height:0},location:wo}}else D=window;var Xn=24*60*60*1e3,et=8*1e3,Mi=Array.prototype,mr=Function.prototype,So=Object.prototype,ln=Mi.slice,ei=So.toString,Ai=So.hasOwnProperty,ce=D.console,dn=D.navigator,ee=D.document,xi=D.opera,Li=D.screen,Fe=dn.userAgent,nt=mr.bind,_o=Mi.forEach,Mo=Mi.indexOf,Ao=Mi.map,pr=Array.isArray,it={},m={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{m.each(arguments,function(e){ce.log(e)})}},warn:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(m.toArray(arguments));try{ce.warn.apply(ce,n)}catch{m.each(n,function(i){ce.warn(i)})}}},error:function(){if($e.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}},critical:function(){if(!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}}},tt=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Ti=function(n){return{log:tt(J.log,n),error:tt(J.error,n),critical:tt(J.critical,n)}};m.bind=function(n,e){var i,t;if(nt&&n.bind===nt)return nt.apply(n,ln.call(arguments,1));if(!m.isFunction(n))throw new TypeError;return i=ln.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(ln.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var a=n.apply(s,i.concat(ln.call(arguments)));return Object(a)===a?a:s},t},m.each=function(n,e,i){if(n!=null){if(_o&&n.forEach===_o)n.forEach(e,i);else if(n.length===+n.length){for(var t=0,o=n.length;t<o;t++)if(t in n&&e.call(i,n[t],t,n)===it)return}else for(var s in n)if(Ai.call(n,s)&&e.call(i,n[s],s,n)===it)return}},m.extend=function(n){return m.each(ln.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},m.isArray=pr||function(n){return ei.call(n)==="[object Array]"},m.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},m.isArguments=function(n){return!!(n&&Ai.call(n,"callee"))},m.toArray=function(n){return n?n.toArray?n.toArray():m.isArray(n)||m.isArguments(n)?ln.call(n):m.values(n):[]},m.map=function(n,e,i){if(Ao&&n.map===Ao)return n.map(e,i);var t=[];return m.each(n,function(o){t.push(e.call(i,o))}),t},m.keys=function(n){var e=[];return n===null||m.each(n,function(i,t){e[e.length]=t}),e},m.values=function(n){var e=[];return n===null||m.each(n,function(i){e[e.length]=i}),e},m.include=function(n,e){var i=!1;return n===null?i:Mo&&n.indexOf===Mo?n.indexOf(e)!=-1:(m.each(n,function(t){if(i||(i=t===e))return it}),i)},m.includes=function(n,e){return n.indexOf(e)!==-1},m.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},m.isObject=function(n){return n===Object(n)&&!m.isArray(n)},m.isEmptyObject=function(n){if(m.isObject(n)){for(var e in n)if(Ai.call(n,e))return!1;return!0}return!1},m.isUndefined=function(n){return n===void 0},m.isString=function(n){return ei.call(n)=="[object String]"},m.isDate=function(n){return ei.call(n)=="[object Date]"},m.isNumber=function(n){return ei.call(n)=="[object Number]"},m.isElement=function(n){return!!(n&&n.nodeType===1)},m.encodeDates=function(n){return m.each(n,function(e,i){m.isDate(e)?n[i]=m.formatDate(e):m.isObject(e)&&(n[i]=m.encodeDates(e))}),n},m.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},m.formatDate=function(n){function e(i){return i<10?"0"+i:i}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},m.strip_empty_properties=function(n){var e={};return m.each(n,function(i,t){m.isString(i)&&i.length>0&&(e[t]=i)}),e},m.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):m.isArray(n)?(i=[],m.each(n,function(t){i.push(m.truncate(t,e))})):m.isObject(n)?(i={},m.each(n,function(t,o){i[o]=m.truncate(t,e)})):i=n,i},m.JSONEncode=function(){return function(n){var e=n,i=function(o){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var d=a[l];return typeof d=="string"?d:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var a="",l=" ",d=0,v="",p="",g=0,f=a,y=[],w=s[o];switch(w&&typeof w=="object"&&typeof w.toJSON=="function"&&(w=w.toJSON(o)),typeof w){case"string":return i(w);case"number":return isFinite(w)?String(w):"null";case"boolean":case"null":return String(w);case"object":if(!w)return"null";if(a+=l,y=[],ei.apply(w)==="[object Array]"){for(g=w.length,d=0;d<g;d+=1)y[d]=t(d,w)||"null";return p=y.length===0?"[]":a?`[
|
|
790
790
|
`+a+y.join(`,
|
|
791
791
|
`+a)+`
|
|
792
792
|
`+f+"]":"["+y.join(",")+"]",a=f,p}for(v in w)Ai.call(w,v)&&(p=t(v,w),p&&y.push(i(v)+(a?": ":":")+p));return p=y.length===0?"{}":a?"{"+y.join(",")+f+"}":"{"+y.join(",")+"}",a=f,p}};return t("",{"":e})}}(),m.JSONDecode=function(){var n,e,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
793
793
|
`,r:"\r",t:" "},t,o=function(y){var w=new SyntaxError(y);throw w.at=n,w.text=t,w},s=function(y){return y&&y!==e&&o("Expected '"+y+"' instead of '"+e+"'"),e=t.charAt(n),n+=1,e},a=function(){var y,w="";for(e==="-"&&(w="-",s("-"));e>="0"&&e<="9";)w+=e,s();if(e===".")for(w+=".";s()&&e>="0"&&e<="9";)w+=e;if(e==="e"||e==="E")for(w+=e,s(),(e==="-"||e==="+")&&(w+=e,s());e>="0"&&e<="9";)w+=e,s();if(y=+w,!isFinite(y))o("Bad number");else return y},l=function(){var y,w,C="",S;if(e==='"')for(;s();){if(e==='"')return s(),C;if(e==="\\")if(s(),e==="u"){for(S=0,w=0;w<4&&(y=parseInt(s(),16),!!isFinite(y));w+=1)S=S*16+y;C+=String.fromCharCode(S)}else if(typeof i[e]=="string")C+=i[e];else break;else C+=e}o("Bad string")},d=function(){for(;e&&e<=" ";)s()},v=function(){switch(e){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null}o('Unexpected "'+e+'"')},p,g=function(){var y=[];if(e==="["){if(s("["),d(),e==="]")return s("]"),y;for(;e;){if(y.push(p()),d(),e==="]")return s("]"),y;s(","),d()}}o("Bad array")},f=function(){var y,w={};if(e==="{"){if(s("{"),d(),e==="}")return s("}"),w;for(;e;){if(y=l(),d(),s(":"),Object.hasOwnProperty.call(w,y)&&o('Duplicate key "'+y+'"'),w[y]=p(),d(),e==="}")return s("}"),w;s(","),d()}}o("Bad object")};return p=function(){switch(d(),e){case"{":return f();case"[":return g();case'"':return l();case"-":return a();default:return e>="0"&&e<="9"?a():v()}},function(y){var w;return t=y,n=0,e=" ",w=p(),d(),e&&o("Syntax error"),w}}(),m.base64Encode=function(n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i,t,o,s,a,l,d,v,p=0,g=0,f="",y=[];if(!n)return n;n=m.utf8Encode(n);do i=n.charCodeAt(p++),t=n.charCodeAt(p++),o=n.charCodeAt(p++),v=i<<16|t<<8|o,s=v>>18&63,a=v>>12&63,l=v>>6&63,d=v&63,y[g++]=e.charAt(s)+e.charAt(a)+e.charAt(l)+e.charAt(d);while(p<n.length);switch(f=y.join(""),n.length%3){case 1:f=f.slice(0,-2)+"==";break;case 2:f=f.slice(0,-1)+"=";break}return f},m.utf8Encode=function(n){n=(n+"").replace(/\r\n/g,`
|
|
794
794
|
`).replace(/\r/g,`
|
|
795
|
-
`);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var a=n.charCodeAt(s),l=null;a<128?t++:a>127&&a<2048?l=String.fromCharCode(a>>6|192,a&63|128):l=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},m.UUID=function(){var n=function(){var t=1*new Date,o;if(D.performance&&D.performance.now)o=D.performance.now();else for(o=0;t==1*new Date;)o++;return t.toString(16)+Math.floor(o).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},i=function(){var t=Fe,o,s,a=[],l=0;function d(v,p){var g,f=0;for(g=0;g<p.length;g++)f|=a[g]<<g*8;return v^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),a.unshift(s&255),a.length>=4&&(l=d(l,a),a=[]);return a.length>0&&(l=d(l,a)),l.toString(16)};return function(){var t=(Li.height*Li.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var xo=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<xo.length;e++)if(n.indexOf(xo[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var i,t,o=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(s,a){i=encodeURIComponent(s.toString()),t=encodeURIComponent(a),o[o.length]=t+"="+i}),o.join(e)},m.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i="[\\?&]"+e+"=([^&#]*)",t=new RegExp(i),o=t.exec(n);if(o===null||o&&typeof o[1]!="string"&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch{J.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},m.cookie={get:function(n){for(var e=n+"=",i=ee.cookie.split(";"),t=0;t<i.length;t++){for(var o=i[t];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}return null},parse:function(n){var e;try{e=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=Lo(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure"),ee.cookie=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v},set:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=Lo(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure");var f=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v;return ee.cookie=f,f},remove:function(n,e,i){m.cookie.set(n,"",-1,e,!1,!1,i)}};var ot=null,Ei=function(n,e){if(ot!==null&&!e)return ot;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+st(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return ot=i,i};m.localStorage={is_supported:function(n){var e=Ei(null,n);return e||J.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){J.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){m.localStorage.error(e)}return null},parse:function(n){try{return m.JSONDecode(m.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){m.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){m.localStorage.error(e)}}},m.register_event=function(){var n=function(t,o,s,a,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!a)t.addEventListener(o,s,!!l);else{var d="on"+o,v=t[d];t[d]=e(t,s,v)}};function e(t,o,s){var a=function(l){if(l=l||i(window.event),!!l){var d=!0,v,p;return m.isFunction(s)&&(v=s(l)),p=o.call(t,l),(v===!1||p===!1)&&(d=!1),d}};return a}function i(t){return t&&(t.preventDefault=i.preventDefault,t.stopPropagation=i.stopPropagation),t}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},n}();var vr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var a=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(a)>=0}function t(o){if(!ee.getElementsByTagName)return[];var s=o.split(" "),a,l,d,v,p,g,f,y,w,C,S=[ee];for(g=0;g<s.length;g++){if(a=s[g].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){l=a.split("#"),d=l[0];var M=l[1],A=ee.getElementById(M);if(!A||d&&A.nodeName.toLowerCase()!=d)return[];S=[A];continue}if(a.indexOf(".")>-1){l=a.split("."),d=l[0];var _=l[1];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?w=n(S[f]):w=S[f].getElementsByTagName(d),y=0;y<w.length;y++)v[p++]=w[y];for(S=[],C=0,f=0;f<v.length;f++)v[f].className&&m.isString(v[f].className)&&i(v[f],_)&&(S[C++]=v[f]);continue}var T=a.match(vr);if(T){d=T[1];var I=T[2],K=T[3],z=T[4];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?w=n(S[f]):w=S[f].getElementsByTagName(d),y=0;y<w.length;y++)v[p++]=w[y];S=[],C=0;var U;switch(K){case"=":U=function(G){return G.getAttribute(I)==z};break;case"~":U=function(G){return G.getAttribute(I).match(new RegExp("\\b"+z+"\\b"))};break;case"|":U=function(G){return G.getAttribute(I).match(new RegExp("^"+z+"-?"))};break;case"^":U=function(G){return G.getAttribute(I).indexOf(z)===0};break;case"$":U=function(G){return G.getAttribute(I).lastIndexOf(z)==G.getAttribute(I).length-z.length};break;case"*":U=function(G){return G.getAttribute(I).indexOf(z)>-1};break;default:U=function(G){return G.getAttribute(I)}}for(S=[],C=0,f=0;f<v.length;f++)U(v[f])&&(S[C++]=v[f]);continue}for(d=a,v=[],p=0,f=0;f<S.length;f++)for(w=S[f].getElementsByTagName(d),y=0;y<w.length;y++)v[p++]=w[y];S=v}return S}return function(o){return m.isElement(o)?[o]:m.isObject(o)&&!m.isUndefined(o.length)?o:t.call(this,o)}}();var br=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",i={};return m.each(br,function(t){e=m.getQueryParam(ee.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return m.each(fr,function(i){n=m.getQueryParam(ee.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=m.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=m.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=m.info.browser(n,e,i),o={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},s=o[t];if(s===void 0)return null;var a=n.match(s);return a?parseFloat(a[a.length-2]):null},os:function(){var n=Fe;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return D.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(Fe,dn.vendor,xi),$referrer:ee.referrer,$referring_domain:m.info.referringDomain(ee.referrer),$device:m.info.device(Fe)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(Fe,dn.vendor,xi),$screen_height:Li.height,$screen_width:Li.width,mp_lib:"web",$lib_version:Je.LIB_VERSION,$insert_id:st(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(Fe,dn.vendor,xi)}),{$browser_version:m.info.browserVersion(Fe,dn.vendor,xi)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:ee.title,current_domain:D.location.hostname,current_url_path:D.location.pathname,current_url_protocol:D.location.protocol,current_url_search:D.location.search})}};var st=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},gr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,yr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Lo=function(n){var e=yr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=gr);var o=n.match(e);return o?o[0]:""},Cr=function(){var n=D.navigator.onLine;return m.isUndefined(n)||n},Pi=null,Ii=null;typeof JSON<"u"&&(Pi=JSON.stringify,Ii=JSON.parse),Pi=Pi||m.JSONEncode,Ii=Ii||m.JSONDecode,m.toArray=m.toArray,m.isObject=m.isObject,m.JSONEncode=m.JSONEncode,m.JSONDecode=m.JSONDecode,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.info=m.info,m.info.device=m.info.device,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.properties=m.info.properties;var kr="__mp_opt_in_out_";function wr(n,e){Po(!0,n,e)}function Sr(n,e){Po(!1,n,e)}function _r(n,e){return Eo(n,e)==="1"}function To(n,e){if(Ar(e))return J.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var i=Eo(n,e)==="0";return i&&J.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function cn(n){return lt(n,function(e){return this.get_config(e)})}function un(n){return lt(n,function(e){return this._get_config(e)})}function On(n){return lt(n,function(e){return this._get_config(e)})}function Mr(n,e){e=e||{},at(e).remove(rt(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function at(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function rt(n,e){return e=e||{},(e.persistencePrefix||kr)+n}function Eo(n,e){return at(e).get(rt(n,e))}function Ar(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||D,i=e.navigator||{},t=!1;return m.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){m.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function Po(n,e,i){if(!m.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},at(i).set(rt(e,i),n?1:0,m.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&n&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})}function lt(n,e){return function(){var i=!1;try{var t=e.call(this,"token"),o=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),a=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=To(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:a,window:l}))}catch(v){J.error("Unexpected error when checking tracking opt-out status: "+v)}if(!i)return n.apply(this,arguments);var d=arguments[arguments.length-1];typeof d=="function"&&d(0)}}var xr=Ti("lock"),Io=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Io.prototype.withLock=function(n,e,i){!i&&typeof e!="function"&&(i=e,e=null);var t=i||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),s=this.storageKey,a=this.pollIntervalMS,l=this.timeoutMS,d=this.storage,v=s+":X",p=s+":Y",g=s+":Z",f=function(A){e&&e(A)},y=function(A){if(new Date().getTime()-o>l){xr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),d.removeItem(g),d.removeItem(p),S();return}setTimeout(function(){try{A()}catch(_){f(_)}},a*(Math.random()+.1))},w=function(A,_){A()?_():y(function(){w(A,_)})},C=function(){var A=d.getItem(p);if(A&&A!==t)return!1;if(d.setItem(p,t),d.getItem(p)===t)return!0;if(!Ei(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){d.setItem(v,t),w(C,function(){if(d.getItem(v)===t){M();return}y(function(){if(d.getItem(p)!==t){S();return}w(function(){return!d.getItem(g)},M)})})},M=function(){d.setItem(g,"1");try{n()}finally{d.removeItem(g),d.getItem(p)===t&&d.removeItem(p),d.getItem(v)===t&&d.removeItem(v)}};try{if(Ei(d,!0))S();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var No=Ti("batch"),hn=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||m.bind(No.error,No),this.lock=new Io(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};hn.prototype.enqueue=function(n,e,i){var t={id:st(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(m.bind(function(){var s;try{var a=this.readFromStorage();a.push(t),s=this.saveToStorage(a),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),m.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},hn.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var i=this.readFromStorage();if(i.length){var t={};m.each(e,function(a){t[a.id]=!0});for(var o=0;o<i.length;o++){var s=i[o];if(new Date().getTime()>s.flushAfter&&!t[s.id]&&(s.orphaned=!0,e.push(s),e.length>=n))break}}}return e};var Bo=function(n,e){var i=[];return m.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};hn.prototype.removeItemsByID=function(n,e){var i={};if(m.each(n,function(o){i[o]=!0}),this.memQueue=Bo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=m.bind(function(){var o;try{var s=this.readFromStorage();if(s=Bo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var a=0;a<s.length;a++){var l=s[a];if(l.id&&i[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),o=!1}return o},this);this.lock.withLock(function(){var s=t();e&&e(s)},m.bind(function(s){var a=!1;if(this.reportError("Error acquiring storage lock",s),!Ei(this.storage,!0)&&(a=t(),!a))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(a)},this),this.pid)}};var Do=function(n,e){var i=[];return m.each(n,function(t){var o=t.id;if(o in e){var s=e[o];s!==null&&(t.payload=s,i.push(t))}else i.push(t)}),i};hn.prototype.updatePayloads=function(n,e){this.memQueue=Do(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){var t;try{var o=this.readFromStorage();o=Do(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),m.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},hn.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Ii(n),m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},hn.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Pi(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},hn.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=10*60*1e3,ni=Ti("batch"),je=function(n,e){this.errorReporter=e.errorReporter,this.queue=new hn(n,{errorReporter:m.bind(this.reportError,this),storage:e.storage,usePersistence:e.usePersistence}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1};je.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},je.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},je.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},je.prototype.clear=function(){this.queue.clear()},je.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},je.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},je.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},je.prototype.flush=function(n){try{if(this.requestInProgress){ni.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,i=new Date().getTime(),t=this.batchSize,o=this.queue.fillBatch(t),s=o.length===t,a=[],l={};if(m.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=m.extend({},g.properties,{mp_sent_by_lib_version:Je.LIB_VERSION}));var f=!0,y=p.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:p,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[y]}),f=!1):this.reportError("[dupe] found item with no ID",{item:p}),f&&a.push(g)}l[p.id]=g},this),a.length<1){this.resetFlush();return}this.requestInProgress=!0;var d=m.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(m.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(m.isObject(p)&&(p.httpStatusCode>=500||p.httpStatusCode===429||p.httpStatusCode<=0&&!Cr()||p.error==="timeout")){var f=this.flushInterval*2;p.retryAfter&&(f=parseInt(p.retryAfter,10)*1e3||f),f=Math.min(Lr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(m.isObject(p)&&p.httpStatusCode===413)if(o.length>1){var y=Math.max(1,Math.floor(t/2));this.batchSize=Math.min(this.batchSize,y,o.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",o),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(m.map(o,function(w){return w.id}),m.bind(function(w){w?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!s?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),m.each(o,m.bind(function(w){var C=w.id;C?(this.itemIdsSentSuccessfully[C]=this.itemIdsSentSuccessfully[C]||0,this.itemIdsSentSuccessfully[C]++,this.itemIdsSentSuccessfully[C]>5&&this.reportError("[dupe] item ID sent too many times",{item:w,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[C]})):this.reportError("[dupe] found item with no ID while removing",{item:w})},this)))}catch(w){this.reportError("Error handling API response",w),this.resetFlush()}},this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(v.transport="sendBeacon"),ni.log("MIXPANEL REQUEST:",a),this.sendRequest(a,v,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},je.prototype.reportError=function(n,e){if(ni.error.apply(ni.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){ni.error(i)}};var kn=Ti("recorder"),Ro=D.CompressionStream,Tr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Er=new Set([ze.MouseMove,ze.MouseInteraction,ze.Scroll,ze.ViewportResize,ze.Input,ze.TouchMove,ze.MediaInteraction,ze.Drag,ze.Selection]);function Pr(n){return n.type===ko.IncrementalSnapshot&&Er.has(n.data.source)}var Ke=function(n){this._mixpanel=n,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=Xn,this.recordMinMs=0,this._initBatcher()};Ke.prototype._initBatcher=function(){this.batcher=new je("__mprec",{libConfig:Tr,sendRequestFunc:m.bind(this.flushEventsWithOptOut,this),errorReporter:m.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ke.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ke.prototype.startRecording=function(n){if(this._stopRecording!==null){kn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>Xn&&(this.recordMaxMs=Xn,kn.critical("record_max_ms cannot be greater than "+Xn+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>et&&(this.recordMinMs=et,kn.critical("record_min_ms cannot be greater than "+et+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=m.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=m.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(m.bind(function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),i=this.get_config("record_block_selector");(i===""||i===null)&&(i=void 0),this._stopRecording=Qn({emit:m.bind(function(t){this.batcher.enqueue(t),Pr(t)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:i,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),e(),this.maxTimeoutId=setTimeout(m.bind(this.resetRecording,this),this.recordMaxMs)},Ke.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ke.prototype.stopRecording=function(){this._stopRecording!==null&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},Ke.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,m.bind(this._onOptOut,this))},Ke.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ke.prototype._sendRequest=function(n,e,i,t){var o=m.bind(function(s,a){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:a,retryAfter:s.headers.get("Retry-After")})},this);D.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:i}).then(function(s){s.json().then(function(a){o(s,a)}).catch(function(a){t({error:a})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ke.prototype._flushEvents=cn(function(n,e,i){const t=n.length;if(t>0){var o=this.replayId,s=n[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=s);var a=n[t-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:s/1e3,replay_id:o,replay_length_ms:a,replay_start_time:this.replayStartTime/1e3},d=m.JSONEncode(n),v=this._mixpanel.get_property("$device_id");v&&(l.$device_id=v);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),Ro){var g=new Blob([d],{type:"application/json"}).stream(),f=g.pipeThrough(new Ro("gzip"));new Response(f).blob().then(m.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,d,i)}}),Ke.prototype.reportError=function(n,e){kn.error.apply(kn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){kn.error(i)}},D.__mp_recorder=Ke;var $e=function(){};$e.prototype.create_properties=function(){},$e.prototype.event_handler=function(){},$e.prototype.after_track_handler=function(){},$e.prototype.init=function(n){return this.mp=n,this},$e.prototype.track=function(n,e,i,t){var o=this,s=m.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return m.each(s,function(a){m.register_event(a,this.override_event,function(l){var d={},v=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,d),window.setTimeout(o.track_callback(t,v,d,!0),p),o.mp.track(e,v,o.track_callback(t,v,d))})},this),!0},$e.prototype.track_callback=function(n,e,i,t){t=t||!1;var o=this;return function(){i.callback_fired||(i.callback_fired=!0,!(n&&n(t,e)===!1)&&o.after_track_handler(e,i,t))}},$e.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=m.extend({},n),i};var Un=function(){this.override_event="click"};m.inherit(Un,$e),Un.prototype.create_properties=function(n,e){var i=Un.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},Un.prototype.event_handler=function(n,e,i){i.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",i.href=e.href,i.new_tab||n.preventDefault()},Un.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ni=function(){this.override_event="submit"};m.inherit(Ni,$e),Ni.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Ni.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var mn="$set",Vn="$set_once",Ge="$unset",wn="$add",qe="$append",Sn="$union",Ye="$remove",Ir="$delete",Ho={set_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[mn]=t,i},unset_action:function(n){var e={},i=[];return m.isArray(n)||(n=[n]),m.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Ge]=i,e},set_once_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Vn]=t,i},union_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=m.isArray(o)?o:[o])},this):t[n]=m.isArray(e)?e:[e],i[Sn]=t,i},append_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[qe]=t,i},remove_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Ye]=t,i},delete_action:function(){var n={};return n[Ir]="",n}},ie=function(){};m.extend(ie.prototype,Ho),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=On(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=On(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=On(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=On(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=On(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=On(function(n,e,i){var t=this.remove_action(n,e);return this._send_request(t,i)}),ie.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var i=m.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},ie.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},ie.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ie.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},ie.prototype.remove=ie.prototype.remove,ie.prototype.set=ie.prototype.set,ie.prototype.set_once=ie.prototype.set_once,ie.prototype.union=ie.prototype.union,ie.prototype.unset=ie.prototype.unset,ie.prototype.toString=ie.prototype.toString;var R=function(){};m.extend(R.prototype,Ho),R.prototype._init=function(n){this._mixpanel=n},R.prototype.set=un(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[mn]=m.extend({},m.info.people_properties(),t[mn]),this._send_request(t,i)}),R.prototype.set_once=un(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),R.prototype.unset=un(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),R.prototype.increment=un(function(n,e,i){var t={},o={};return m.isObject(n)?(m.each(n,function(s,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[a]=s},this),i=e):(m.isUndefined(e)&&(e=1),o[n]=e),t[wn]=o,this._send_request(t,i)}),R.prototype.append=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),R.prototype.remove=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),R.prototype.union=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),R.prototype.track_charge=un(function(n,e,i){if(!m.isNumber(n)&&(n=parseFloat(n),isNaN(n))){J.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",m.extend({$amount:n},e),i)}),R.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},R.prototype.delete_user=function(){if(!this._identify_called()){J.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},R.prototype.toString=function(){return this._mixpanel.toString()+".people"},R.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),t=this._mixpanel.get_property("$user_id"),o=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(n.$device_id=i),t&&(n.$user_id=t),o&&(n.$had_persisted_distinct_id=o);var s=m.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(s,255))},R.prototype._get_config=function(n){return this._mixpanel.get_config(n)},R.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},R.prototype._enqueue=function(n){mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):Vn in n?this._mixpanel.persistence._add_to_people_queue(Vn,n):Ge in n?this._mixpanel.persistence._add_to_people_queue(Ge,n):wn in n?this._mixpanel.persistence._add_to_people_queue(wn,n):qe in n?this._mixpanel.persistence._add_to_people_queue(qe,n):Ye in n?this._mixpanel.persistence._add_to_people_queue(Ye,n):Sn in n?this._mixpanel.persistence._add_to_people_queue(Sn,n):J.error("Invalid call to _enqueue():",n)},R.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=m.extend({},this._mixpanel.persistence.load_queue(n)),a=s;!m.isUndefined(s)&&m.isObject(s)&&!m.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(a=t(s)),e.call(o,a,function(l,d){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),m.isUndefined(i)||i(l,d)}))},R.prototype._flush=function(n,e,i,t,o,s,a){var l=this;this._flush_one_queue(mn,this.set,n),this._flush_one_queue(Vn,this.set_once,t),this._flush_one_queue(Ge,this.unset,s,function(S){return m.keys(S)}),this._flush_one_queue(wn,this.increment,e),this._flush_one_queue(Sn,this.union,o);var d=this._mixpanel.persistence.load_queue(qe);if(!m.isUndefined(d)&&m.isArray(d)&&d.length)for(var v,p=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(qe,v),m.isUndefined(i)||i(S,M)},g=d.length-1;g>=0;g--)d=this._mixpanel.persistence.load_queue(qe),v=d.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(v)||l.append(v,p);var f=this._mixpanel.persistence.load_queue(Ye);if(!m.isUndefined(f)&&m.isArray(f)&&f.length)for(var y,w=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Ye,y),m.isUndefined(a)||a(S,M)},C=f.length-1;C>=0;C--)f=this._mixpanel.persistence.load_queue(Ye),y=f.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(y)||l.remove(y,w)},R.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},R.prototype.set=R.prototype.set,R.prototype.set_once=R.prototype.set_once,R.prototype.unset=R.prototype.unset,R.prototype.increment=R.prototype.increment,R.prototype.append=R.prototype.append,R.prototype.remove=R.prototype.remove,R.prototype.union=R.prototype.union,R.prototype.track_charge=R.prototype.track_charge,R.prototype.clear_charges=R.prototype.clear_charges,R.prototype.delete_user=R.prototype.delete_user,R.prototype.toString=R.prototype.toString;var dt="__mps",ct="__mpso",ut="__mpus",ht="__mpa",mt="__mpap",pt="__mpr",vt="__mpu",Oo="$people_distinct_id",Bi="__alias",ii="__timers",Nr=[dt,ct,ut,ht,mt,pt,vt,Oo,Bi,ii],j=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(J.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,i){m.include(Nr,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,m.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},j.prototype.load_prop=function(n){return this.load(),this.props[n]},j.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},j.prototype.clear=function(){this.remove(),this.props={}},j.prototype.register_once=function(n,e,i){return m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),m.each(n,function(t,o){(!this.props.hasOwnProperty(o)||this.props[o]===e)&&(this.props[o]=t)},this),this.save(),!0):!1},j.prototype.register=function(n,e){return m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.extend(this.props,n),this.save(),!0):!1},j.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},j.prototype.update_search_keyword=function(n){this.register(m.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return m.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},j.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},j.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},j.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},j.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},j.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},j.prototype.get_cross_subdomain=function(){return this.cross_subdomain},j.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},j.prototype._add_to_people_queue=function(n,e){var i=this._get_queue_key(n),t=e[n],o=this._get_or_create_queue(mn),s=this._get_or_create_queue(Vn),a=this._get_or_create_queue(Ge),l=this._get_or_create_queue(wn),d=this._get_or_create_queue(Sn),v=this._get_or_create_queue(Ye,[]),p=this._get_or_create_queue(qe,[]);i===dt?(m.extend(o,t),this._pop_from_people_queue(wn,t),this._pop_from_people_queue(Sn,t),this._pop_from_people_queue(Ge,t)):i===ct?(m.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Ge,t)):i===ut?m.each(t,function(g){m.each([o,s,l,d],function(f){g in f&&delete f[g]}),m.each(p,function(f){g in f&&delete f[g]}),a[g]=!0}):i===ht?(m.each(t,function(g,f){f in o?o[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(Ge,t)):i===vt?(m.each(t,function(g,f){m.isArray(g)&&(f in d||(d[f]=[]),d[f]=d[f].concat(g))}),this._pop_from_people_queue(Ge,t)):i===pt?(v.push(t),this._pop_from_people_queue(qe,t)):i===mt&&(p.push(t),this._pop_from_people_queue(Ge,t)),J.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),J.log(e),this.save()},j.prototype._pop_from_people_queue=function(n,e){var i=this.props[this._get_queue_key(n)];m.isUndefined(i)||m.each(e,function(t,o){n===qe||n===Ye?m.each(i,function(s){s[o]===t&&delete s[o]}):delete i[o]},this)},j.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},j.prototype._get_queue_key=function(n){if(n===mn)return dt;if(n===Vn)return ct;if(n===Ge)return ut;if(n===wn)return ht;if(n===qe)return mt;if(n===Ye)return pt;if(n===Sn)return vt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(ii)||{};i[n]=e,this.props[ii]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(ii)||{},i=e[n];return m.isUndefined(i)||(delete this.props[ii][n],this.save()),i};var bt,Uo=function(n,e){throw new Error(n+" not available in this build.")},Ce,Vo=0,Br=1,Dr=function(n){return n},ti=function(){},Re="mixpanel",jo="base64",Rr="json",ft="$device:",jn=D.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Ko=!jn&&Fe.indexOf("MSIE")===-1&&Fe.indexOf("Mozilla")===-1,Di=null;dn.sendBeacon&&(Di=function(){return dn.sendBeacon.apply(dn,arguments)});var Go={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},zo={api_host:"https://api-js.mixpanel.com",api_routes:Go,api_method:"POST",api_transport:"XHR",api_payload_format:jo,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:ti,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:ti,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:Xn,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Fo=!1,x=function(){},gt=function(n,e,i){var t,o=i===Re?Ce:Ce[i];if(o&&bt===Vo)t=o;else{if(o&&!m.isArray(o)){J.error("You have already initialized "+i);return}t=new x}if(t._cached_groups={},t._init(n,e,i),t.people=new R,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=m.info.campaignParams(null),a={},l=!1;m.each(s,function(d,v){a["initial_"+v]=d,d&&(l=!0)}),l&&t.people.set_once(a)}return Je.DEBUG=Je.DEBUG||t.get_config("debug"),!m.isUndefined(o)&&m.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(m.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===Re){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=gt(n,e,i);return Ce[i]=t,t._loaded(),t},x.prototype._init=function(n,e,i){e=e||{},this.__loaded=!0,this.config={};var t={};if(!("api_payload_format"in e)){var o=e.api_host||zo.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=Rr)}if(this.set_config(m.extend({},zo,t,e,{name:i,token:n,callback_fn:(i===Re?i:Re+"."+i)+"._jsc"})),this._jsc=ti,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!m.localStorage.is_supported(!0)||!jn)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(d){J.log("Clearing batch queue "+d.queue_key),m.localStorage.remove(d.queue_key)});else if(this.init_batchers(),Di&&D.addEventListener){var s=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);D.addEventListener("pagehide",function(d){d.persisted&&s()}),D.addEventListener("visibilitychange",function(){ee.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:ft+a,$device_id:a},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},x.prototype.start_session_recording=cn(function(){if(!D.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=m.bind(function(){this._recorder=this._recorder||new D.__mp_recorder(this),this._recorder.startRecording()},this);m.isUndefined(D.__mp_recorder)?Uo(this.get_config("recorder_src"),n):n()}),x.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():J.critical("Session recorder module not loaded")},x.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},x.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=m.info.campaignParams(null);m.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ee.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ee.referrer)},x.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},x.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Fo)return this.__dom_loaded_queue.push([n,e]),!1;var i=new n().init(this);return i.track.apply(i,e)},x.prototype._init_url_change_tracking=function(n){var e="",i=this.track_pageview();if(i&&(e=m.info.currentUrl()),m.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){D.addEventListener("popstate",function(){D.dispatchEvent(new Event("mp_locationchange"))}),D.addEventListener("hashchange",function(){D.dispatchEvent(new Event("mp_locationchange"))});var t=D.history.pushState;typeof t=="function"&&(D.history.pushState=function(s,a,l){t.call(D.history,s,a,l),D.dispatchEvent(new Event("mp_locationchange"))});var o=D.history.replaceState;typeof o=="function"&&(D.history.replaceState=function(s,a,l){o.call(D.history,s,a,l),D.dispatchEvent(new Event("mp_locationchange"))}),D.addEventListener("mp_locationchange",(function(){var s=m.info.currentUrl(),a=!1;if(n==="full-url"?a=s!==e:n==="url-with-path-and-query-string"?a=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(a=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),a){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(jn){var i=function(a){n(a,e)};return i}else{var t=this._jsc,o=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+o+"]";return t[o]=function(a){delete t[o],n(a,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Ko)return this.__request_queue.push(arguments),o;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},a=null;!t&&(m.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=m.extend(s,i||{}),jn||(i.method="GET");var l=i.method==="POST",d=Di&&l&&i.transport.toLowerCase()==="sendbeacon",v=i.verbose;e.verbose&&(v=!0),this.get_config("test")&&(e.test=1),v&&(e.verbose=1),this.get_config("img")&&(e.img=1),jn||(t?e.callback=t:(v||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(a="data="+encodeURIComponent(e.data),delete e.data),n+="?"+m.HTTPBuildQuery(e);var p=this;if("img"in e){var g=ee.createElement("img");g.src=n,ee.body.appendChild(g)}else if(d){try{o=Di(n,a)}catch(M){p.report_error(M),o=!1}try{t&&t(o?1:0)}catch(M){p.report_error(M)}}else if(jn)try{var f=new XMLHttpRequest;f.open(i.method,n,!0);var y=this.get_config("xhr_headers");if(l&&(y["Content-Type"]="application/x-www-form-urlencoded"),m.each(y,function(M,A){f.setRequestHeader(A,M)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var w=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(v){var M;try{M=m.JSONDecode(f.responseText)}catch(T){if(p.report_error(T),i.ignore_json_errors)M=f.responseText;else return}t(M)}else t(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-w>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(A),t)if(v){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:A,retryAfter:_["Retry-After"]})}else t(0)}},f.send(a)}catch(M){p.report_error(M),o=!1}else{var C=ee.createElement("script");C.type="text/javascript",C.async=!0,C.defer=!0,C.src=n;var S=ee.getElementsByTagName("script")[0];S.parentNode.insertBefore(C,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];m.each(n,function(a){a&&(e=a[0],m.isArray(e)?o.push(a):typeof a=="function"?a.call(this):m.isArray(a)&&e==="alias"?i.push(a):m.isArray(a)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(a):t.push(a))},this);var s=function(a,l){m.each(a,function(d){if(m.isArray(d[0])){var v=l;m.each(d,function(p){v=v[p[0]].apply(v,p.slice(1))})}else this[d[0]].apply(this,d.slice(1))},l)};s(i,this),s(t,this),s(o,this)},x.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},x.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:n+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:n+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:n+"_gr"}},this._batcher_configs},x.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=m.bind(function(i){return new je(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.bind(function(t,o,s){this._send_request(this.get_config("api_host")+i.endpoint,this._encode_data_for_request(t),o,this._prepare_callback(s,t))},this),beforeSendHook:m.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:m.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},x.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,m.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.each(this.request_batchers,function(n){n.stop(),n.clear()})},x.prototype.push=function(n){this._execute_array([n])},x.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},x.prototype._encode_data_for_request=function(n){var e=m.JSONEncode(n);return this.get_config("api_payload_format")===jo&&(e=m.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=m.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,a=n.send_request_options||{};e=e||ti;var l=!0,d=m.bind(function(){return a.skip_hooks||(i=this._run_hook("before_send_"+n.type,i)),i?(J.log("MIXPANEL REQUEST:"),J.log(i),this._send_request(t,this._encode_data_for_request(i),a,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(v){v?e(1,i):d()}):l=d(),l&&i},x.prototype.track=cn(function(n,e,i,t){!t&&typeof i=="function"&&(t=i,i=null),i=i||{};var o=i.transport;o&&(i.transport=o);var s=i.send_immediately;if(typeof t!="function"&&(t=ti),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=m.extend({},e),e.token=this.get_config("token");var a=this.persistence.remove_event_timer(n);if(!m.isUndefined(a)){var l=new Date().getTime()-a;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var v=this.get_config("property_blacklist");m.isArray(v)?m.each(v,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+v);var p={event:n,properties:e},g=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:i},t);return g}),x.prototype.set_group=cn(function(n,e,i){m.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=cn(function(n,e,i){var t=this.get_property(n),o={};return t===void 0?(o[n]=[e],this.register(o)):t.indexOf(e)===-1&&(t.push(e),o[n]=t,this.register(o)),this.people.union(n,e,i)}),x.prototype.remove_group=cn(function(n,e,i){var t=this.get_property(n);if(t!==void 0){var o=t.indexOf(e);o>-1&&(t.splice(o,1),this.register({group_key:t})),t.length===0&&this.unregister(n)}return this.people.remove(n,e,i)}),x.prototype.track_with_groups=cn(function(n,e,i,t){var o=m.extend({},e||{});return m.each(i,function(s,a){s!=null&&(o[a]=s)}),this.track(n,o,t)}),x.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},x.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},x.prototype.get_group=function(n,e){var i=this._create_map_key(n,e),t=this._cached_groups[i];return(t===void 0||t._group_key!==n||t._group_id!==e)&&(t=new ie,t._init(this,n,e),this._cached_groups[i]=t),t},x.prototype.track_pageview=cn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),o=m.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,Un,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Ni,arguments)},x.prototype.time_event=function(n){if(m.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var Hr={persistent:!0},yt=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},Hr,e)};x.prototype.register=function(n,e){var i=yt(e);i.persistent?this.persistence.register(n,i.days):m.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=yt(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),m.each(n,function(o,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=o)},this))},x.prototype.unregister=function(n,e){e=yt(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},x.prototype._register_single=function(n,e){var i={};i[n]=e,this.register(i)},x.prototype.identify=function(n,e,i,t,o,s,a,l){var d=this.get_distinct_id();if(n&&d!==n){if(typeof n=="string"&&n.indexOf(ft)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var v=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}n!==d&&n!==this.get_property(Bi)&&(this.unregister(Bi),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,a,l),n!==d&&this.track("$identify",{distinct_id:n,$anon_distinct_id:d},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:ft+n,$device_id:n},"")},x.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},x.prototype.alias=function(n,e){if(n===this.get_property(Oo))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Bi,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){i.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},x.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},x.prototype.set_config=function(n){if(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.each(this.request_batchers,function(i){i.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Je.DEBUG=Je.DEBUG||this.get_config("debug")}},x.prototype.get_config=function(n){return this.config[n]},x.prototype._run_hook=function(n){var e=(this.config.hooks[n]||Dr).apply(this,ln.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},x.prototype.get_property=function(n){return this.persistence.load_prop([n])},x.prototype.toString=function(){var n=this.get_config("name");return n!==Re&&(n=Re+"."+n),n},x.prototype._event_is_disabled=function(n){return m.isBlockedUA(Fe)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||m.cookie.get("mp_optout"))&&(m.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},x.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},x.prototype._gdpr_call_func=function(n,e){return e=m.extend({track:m.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),m.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},x.prototype.opt_in_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(wr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=m.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(Sr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(_r,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(To,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(Mr,n),this._gdpr_update_persistence(n)},x.prototype.report_error=function(n,e){J.error.apply(J.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){J.error(i)}},x.prototype.init=x.prototype.init,x.prototype.reset=x.prototype.reset,x.prototype.disable=x.prototype.disable,x.prototype.time_event=x.prototype.time_event,x.prototype.track=x.prototype.track,x.prototype.track_links=x.prototype.track_links,x.prototype.track_forms=x.prototype.track_forms,x.prototype.track_pageview=x.prototype.track_pageview,x.prototype.register=x.prototype.register,x.prototype.register_once=x.prototype.register_once,x.prototype.unregister=x.prototype.unregister,x.prototype.identify=x.prototype.identify,x.prototype.alias=x.prototype.alias,x.prototype.name_tag=x.prototype.name_tag,x.prototype.set_config=x.prototype.set_config,x.prototype.get_config=x.prototype.get_config,x.prototype.get_property=x.prototype.get_property,x.prototype.get_distinct_id=x.prototype.get_distinct_id,x.prototype.toString=x.prototype.toString,x.prototype.opt_out_tracking=x.prototype.opt_out_tracking,x.prototype.opt_in_tracking=x.prototype.opt_in_tracking,x.prototype.has_opted_out_tracking=x.prototype.has_opted_out_tracking,x.prototype.has_opted_in_tracking=x.prototype.has_opted_in_tracking,x.prototype.clear_opt_in_out_tracking=x.prototype.clear_opt_in_out_tracking,x.prototype.get_group=x.prototype.get_group,x.prototype.set_group=x.prototype.set_group,x.prototype.add_group=x.prototype.add_group,x.prototype.remove_group=x.prototype.remove_group,x.prototype.track_with_groups=x.prototype.track_with_groups,x.prototype.start_batch_senders=x.prototype.start_batch_senders,x.prototype.stop_batch_senders=x.prototype.stop_batch_senders,x.prototype.start_session_recording=x.prototype.start_session_recording,x.prototype.stop_session_recording=x.prototype.stop_session_recording,x.prototype.get_session_recording_properties=x.prototype.get_session_recording_properties,x.prototype.DEFAULT_API_ROUTES=Go,j.prototype.properties=j.prototype.properties,j.prototype.update_search_keyword=j.prototype.update_search_keyword,j.prototype.update_referrer_info=j.prototype.update_referrer_info,j.prototype.get_cross_subdomain=j.prototype.get_cross_subdomain,j.prototype.clear=j.prototype.clear;var Kn={},Or=function(){m.each(Kn,function(n,e){e!==Re&&(Ce[e]=n)}),Ce._=m},Ur=function(){Ce.init=function(n,e,i){if(i)return Ce[i]||(Ce[i]=Kn[i]=gt(n,e,i),Ce[i]._loaded()),Ce[i];var t=Ce;Kn[Re]?t=Kn[Re]:n&&(t=gt(n,e,Re),t._loaded(),Kn[Re]=t),Ce=t,bt===Br&&(D[Re]=Ce),Or()}},Vr=function(){function n(){n.done||(n.done=!0,Fo=!0,Ko=!1,m.each(Kn,function(t){t._dom_loaded()}))}function e(){try{ee.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(ee.addEventListener)ee.readyState==="complete"?n():ee.addEventListener("DOMContentLoaded",n,!1);else if(ee.attachEvent){ee.attachEvent("onreadystatechange",n);var i=!1;try{i=D.frameElement===null}catch{}ee.documentElement.doScroll&&i&&e()}m.register_event(D,"load",n,!0)};function jr(n){return Uo=n,bt=Vo,Ce=new x,Ur(),Ce.init(),Vr(),Ce}function Kr(n,e){e()}var P=jr(Kr);const qo=`<div id="checkoutConfirmationEnd">
|
|
795
|
+
`);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var a=n.charCodeAt(s),l=null;a<128?t++:a>127&&a<2048?l=String.fromCharCode(a>>6|192,a&63|128):l=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},m.UUID=function(){var n=function(){var t=1*new Date,o;if(D.performance&&D.performance.now)o=D.performance.now();else for(o=0;t==1*new Date;)o++;return t.toString(16)+Math.floor(o).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},i=function(){var t=Fe,o,s,a=[],l=0;function d(v,p){var g,f=0;for(g=0;g<p.length;g++)f|=a[g]<<g*8;return v^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),a.unshift(s&255),a.length>=4&&(l=d(l,a),a=[]);return a.length>0&&(l=d(l,a)),l.toString(16)};return function(){var t=(Li.height*Li.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var xo=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<xo.length;e++)if(n.indexOf(xo[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var i,t,o=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(s,a){i=encodeURIComponent(s.toString()),t=encodeURIComponent(a),o[o.length]=t+"="+i}),o.join(e)},m.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i="[\\?&]"+e+"=([^&#]*)",t=new RegExp(i),o=t.exec(n);if(o===null||o&&typeof o[1]!="string"&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch{J.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},m.cookie={get:function(n){for(var e=n+"=",i=ee.cookie.split(";"),t=0;t<i.length;t++){for(var o=i[t];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}return null},parse:function(n){var e;try{e=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=Lo(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure"),ee.cookie=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v},set:function(n,e,i,t,o,s,a){var l="",d="",v="";if(a)l="; domain="+a;else if(t){var p=Lo(ee.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),d="; expires="+g.toGMTString()}s&&(o=!0,v="; SameSite=None"),o&&(v+="; secure");var f=n+"="+encodeURIComponent(e)+d+"; path=/"+l+v;return ee.cookie=f,f},remove:function(n,e,i){m.cookie.set(n,"",-1,e,!1,!1,i)}};var ot=null,Ei=function(n,e){if(ot!==null&&!e)return ot;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+st(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return ot=i,i};m.localStorage={is_supported:function(n){var e=Ei(null,n);return e||J.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){J.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){m.localStorage.error(e)}return null},parse:function(n){try{return m.JSONDecode(m.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){m.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){m.localStorage.error(e)}}},m.register_event=function(){var n=function(t,o,s,a,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!a)t.addEventListener(o,s,!!l);else{var d="on"+o,v=t[d];t[d]=e(t,s,v)}};function e(t,o,s){var a=function(l){if(l=l||i(window.event),!!l){var d=!0,v,p;return m.isFunction(s)&&(v=s(l)),p=o.call(t,l),(v===!1||p===!1)&&(d=!1),d}};return a}function i(t){return t&&(t.preventDefault=i.preventDefault,t.stopPropagation=i.stopPropagation),t}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},n}();var vr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var a=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(a)>=0}function t(o){if(!ee.getElementsByTagName)return[];var s=o.split(" "),a,l,d,v,p,g,f,y,w,C,S=[ee];for(g=0;g<s.length;g++){if(a=s[g].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){l=a.split("#"),d=l[0];var M=l[1],A=ee.getElementById(M);if(!A||d&&A.nodeName.toLowerCase()!=d)return[];S=[A];continue}if(a.indexOf(".")>-1){l=a.split("."),d=l[0];var _=l[1];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?w=n(S[f]):w=S[f].getElementsByTagName(d),y=0;y<w.length;y++)v[p++]=w[y];for(S=[],C=0,f=0;f<v.length;f++)v[f].className&&m.isString(v[f].className)&&i(v[f],_)&&(S[C++]=v[f]);continue}var T=a.match(vr);if(T){d=T[1];var I=T[2],K=T[3],z=T[4];for(d||(d="*"),v=[],p=0,f=0;f<S.length;f++)for(d=="*"?w=n(S[f]):w=S[f].getElementsByTagName(d),y=0;y<w.length;y++)v[p++]=w[y];S=[],C=0;var U;switch(K){case"=":U=function(G){return G.getAttribute(I)==z};break;case"~":U=function(G){return G.getAttribute(I).match(new RegExp("\\b"+z+"\\b"))};break;case"|":U=function(G){return G.getAttribute(I).match(new RegExp("^"+z+"-?"))};break;case"^":U=function(G){return G.getAttribute(I).indexOf(z)===0};break;case"$":U=function(G){return G.getAttribute(I).lastIndexOf(z)==G.getAttribute(I).length-z.length};break;case"*":U=function(G){return G.getAttribute(I).indexOf(z)>-1};break;default:U=function(G){return G.getAttribute(I)}}for(S=[],C=0,f=0;f<v.length;f++)U(v[f])&&(S[C++]=v[f]);continue}for(d=a,v=[],p=0,f=0;f<S.length;f++)for(w=S[f].getElementsByTagName(d),y=0;y<w.length;y++)v[p++]=w[y];S=v}return S}return function(o){return m.isElement(o)?[o]:m.isObject(o)&&!m.isUndefined(o.length)?o:t.call(this,o)}}();var br=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",i={};return m.each(br,function(t){e=m.getQueryParam(ee.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return m.each(fr,function(i){n=m.getQueryParam(ee.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=m.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=m.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=m.info.browser(n,e,i),o={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},s=o[t];if(s===void 0)return null;var a=n.match(s);return a?parseFloat(a[a.length-2]):null},os:function(){var n=Fe;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return D.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(Fe,dn.vendor,xi),$referrer:ee.referrer,$referring_domain:m.info.referringDomain(ee.referrer),$device:m.info.device(Fe)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(Fe,dn.vendor,xi),$screen_height:Li.height,$screen_width:Li.width,mp_lib:"web",$lib_version:$e.LIB_VERSION,$insert_id:st(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(Fe,dn.vendor,xi)}),{$browser_version:m.info.browserVersion(Fe,dn.vendor,xi)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:ee.title,current_domain:D.location.hostname,current_url_path:D.location.pathname,current_url_protocol:D.location.protocol,current_url_search:D.location.search})}};var st=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},gr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,yr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Lo=function(n){var e=yr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=gr);var o=n.match(e);return o?o[0]:""},Cr=function(){var n=D.navigator.onLine;return m.isUndefined(n)||n},Pi=null,Ii=null;typeof JSON<"u"&&(Pi=JSON.stringify,Ii=JSON.parse),Pi=Pi||m.JSONEncode,Ii=Ii||m.JSONDecode,m.toArray=m.toArray,m.isObject=m.isObject,m.JSONEncode=m.JSONEncode,m.JSONDecode=m.JSONDecode,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.info=m.info,m.info.device=m.info.device,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.properties=m.info.properties;var kr="__mp_opt_in_out_";function wr(n,e){Po(!0,n,e)}function Sr(n,e){Po(!1,n,e)}function _r(n,e){return Eo(n,e)==="1"}function To(n,e){if(Ar(e))return J.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var i=Eo(n,e)==="0";return i&&J.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function cn(n){return lt(n,function(e){return this.get_config(e)})}function un(n){return lt(n,function(e){return this._get_config(e)})}function On(n){return lt(n,function(e){return this._get_config(e)})}function Mr(n,e){e=e||{},at(e).remove(rt(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function at(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function rt(n,e){return e=e||{},(e.persistencePrefix||kr)+n}function Eo(n,e){return at(e).get(rt(n,e))}function Ar(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||D,i=e.navigator||{},t=!1;return m.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){m.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function Po(n,e,i){if(!m.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},at(i).set(rt(e,i),n?1:0,m.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&n&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})}function lt(n,e){return function(){var i=!1;try{var t=e.call(this,"token"),o=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),a=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=To(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:a,window:l}))}catch(v){J.error("Unexpected error when checking tracking opt-out status: "+v)}if(!i)return n.apply(this,arguments);var d=arguments[arguments.length-1];typeof d=="function"&&d(0)}}var xr=Ti("lock"),Io=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Io.prototype.withLock=function(n,e,i){!i&&typeof e!="function"&&(i=e,e=null);var t=i||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),s=this.storageKey,a=this.pollIntervalMS,l=this.timeoutMS,d=this.storage,v=s+":X",p=s+":Y",g=s+":Z",f=function(A){e&&e(A)},y=function(A){if(new Date().getTime()-o>l){xr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),d.removeItem(g),d.removeItem(p),S();return}setTimeout(function(){try{A()}catch(_){f(_)}},a*(Math.random()+.1))},w=function(A,_){A()?_():y(function(){w(A,_)})},C=function(){var A=d.getItem(p);if(A&&A!==t)return!1;if(d.setItem(p,t),d.getItem(p)===t)return!0;if(!Ei(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){d.setItem(v,t),w(C,function(){if(d.getItem(v)===t){M();return}y(function(){if(d.getItem(p)!==t){S();return}w(function(){return!d.getItem(g)},M)})})},M=function(){d.setItem(g,"1");try{n()}finally{d.removeItem(g),d.getItem(p)===t&&d.removeItem(p),d.getItem(v)===t&&d.removeItem(v)}};try{if(Ei(d,!0))S();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var No=Ti("batch"),hn=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||m.bind(No.error,No),this.lock=new Io(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};hn.prototype.enqueue=function(n,e,i){var t={id:st(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(m.bind(function(){var s;try{var a=this.readFromStorage();a.push(t),s=this.saveToStorage(a),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),m.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},hn.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var i=this.readFromStorage();if(i.length){var t={};m.each(e,function(a){t[a.id]=!0});for(var o=0;o<i.length;o++){var s=i[o];if(new Date().getTime()>s.flushAfter&&!t[s.id]&&(s.orphaned=!0,e.push(s),e.length>=n))break}}}return e};var Bo=function(n,e){var i=[];return m.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};hn.prototype.removeItemsByID=function(n,e){var i={};if(m.each(n,function(o){i[o]=!0}),this.memQueue=Bo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=m.bind(function(){var o;try{var s=this.readFromStorage();if(s=Bo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var a=0;a<s.length;a++){var l=s[a];if(l.id&&i[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),o=!1}return o},this);this.lock.withLock(function(){var s=t();e&&e(s)},m.bind(function(s){var a=!1;if(this.reportError("Error acquiring storage lock",s),!Ei(this.storage,!0)&&(a=t(),!a))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(a)},this),this.pid)}};var Do=function(n,e){var i=[];return m.each(n,function(t){var o=t.id;if(o in e){var s=e[o];s!==null&&(t.payload=s,i.push(t))}else i.push(t)}),i};hn.prototype.updatePayloads=function(n,e){this.memQueue=Do(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){var t;try{var o=this.readFromStorage();o=Do(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),m.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},hn.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Ii(n),m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},hn.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Pi(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},hn.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=10*60*1e3,ni=Ti("batch"),je=function(n,e){this.errorReporter=e.errorReporter,this.queue=new hn(n,{errorReporter:m.bind(this.reportError,this),storage:e.storage,usePersistence:e.usePersistence}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1};je.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},je.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},je.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},je.prototype.clear=function(){this.queue.clear()},je.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},je.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},je.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},je.prototype.flush=function(n){try{if(this.requestInProgress){ni.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,i=new Date().getTime(),t=this.batchSize,o=this.queue.fillBatch(t),s=o.length===t,a=[],l={};if(m.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=m.extend({},g.properties,{mp_sent_by_lib_version:$e.LIB_VERSION}));var f=!0,y=p.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:p,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[y]}),f=!1):this.reportError("[dupe] found item with no ID",{item:p}),f&&a.push(g)}l[p.id]=g},this),a.length<1){this.resetFlush();return}this.requestInProgress=!0;var d=m.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(m.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(m.isObject(p)&&(p.httpStatusCode>=500||p.httpStatusCode===429||p.httpStatusCode<=0&&!Cr()||p.error==="timeout")){var f=this.flushInterval*2;p.retryAfter&&(f=parseInt(p.retryAfter,10)*1e3||f),f=Math.min(Lr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(m.isObject(p)&&p.httpStatusCode===413)if(o.length>1){var y=Math.max(1,Math.floor(t/2));this.batchSize=Math.min(this.batchSize,y,o.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",o),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(m.map(o,function(w){return w.id}),m.bind(function(w){w?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!s?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),m.each(o,m.bind(function(w){var C=w.id;C?(this.itemIdsSentSuccessfully[C]=this.itemIdsSentSuccessfully[C]||0,this.itemIdsSentSuccessfully[C]++,this.itemIdsSentSuccessfully[C]>5&&this.reportError("[dupe] item ID sent too many times",{item:w,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[C]})):this.reportError("[dupe] found item with no ID while removing",{item:w})},this)))}catch(w){this.reportError("Error handling API response",w),this.resetFlush()}},this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(v.transport="sendBeacon"),ni.log("MIXPANEL REQUEST:",a),this.sendRequest(a,v,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},je.prototype.reportError=function(n,e){if(ni.error.apply(ni.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){ni.error(i)}};var kn=Ti("recorder"),Ro=D.CompressionStream,Tr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Er=new Set([ze.MouseMove,ze.MouseInteraction,ze.Scroll,ze.ViewportResize,ze.Input,ze.TouchMove,ze.MediaInteraction,ze.Drag,ze.Selection]);function Pr(n){return n.type===ko.IncrementalSnapshot&&Er.has(n.data.source)}var Ke=function(n){this._mixpanel=n,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=Xn,this.recordMinMs=0,this._initBatcher()};Ke.prototype._initBatcher=function(){this.batcher=new je("__mprec",{libConfig:Tr,sendRequestFunc:m.bind(this.flushEventsWithOptOut,this),errorReporter:m.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ke.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ke.prototype.startRecording=function(n){if(this._stopRecording!==null){kn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>Xn&&(this.recordMaxMs=Xn,kn.critical("record_max_ms cannot be greater than "+Xn+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>et&&(this.recordMinMs=et,kn.critical("record_min_ms cannot be greater than "+et+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=m.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=m.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(m.bind(function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),i=this.get_config("record_block_selector");(i===""||i===null)&&(i=void 0),this._stopRecording=Qn({emit:m.bind(function(t){this.batcher.enqueue(t),Pr(t)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:i,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),e(),this.maxTimeoutId=setTimeout(m.bind(this.resetRecording,this),this.recordMaxMs)},Ke.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ke.prototype.stopRecording=function(){this._stopRecording!==null&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},Ke.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,m.bind(this._onOptOut,this))},Ke.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ke.prototype._sendRequest=function(n,e,i,t){var o=m.bind(function(s,a){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:a,retryAfter:s.headers.get("Retry-After")})},this);D.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:i}).then(function(s){s.json().then(function(a){o(s,a)}).catch(function(a){t({error:a})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ke.prototype._flushEvents=cn(function(n,e,i){const t=n.length;if(t>0){var o=this.replayId,s=n[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=s);var a=n[t-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:s/1e3,replay_id:o,replay_length_ms:a,replay_start_time:this.replayStartTime/1e3},d=m.JSONEncode(n),v=this._mixpanel.get_property("$device_id");v&&(l.$device_id=v);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),Ro){var g=new Blob([d],{type:"application/json"}).stream(),f=g.pipeThrough(new Ro("gzip"));new Response(f).blob().then(m.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,d,i)}}),Ke.prototype.reportError=function(n,e){kn.error.apply(kn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){kn.error(i)}},D.__mp_recorder=Ke;var Ye=function(){};Ye.prototype.create_properties=function(){},Ye.prototype.event_handler=function(){},Ye.prototype.after_track_handler=function(){},Ye.prototype.init=function(n){return this.mp=n,this},Ye.prototype.track=function(n,e,i,t){var o=this,s=m.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return m.each(s,function(a){m.register_event(a,this.override_event,function(l){var d={},v=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,d),window.setTimeout(o.track_callback(t,v,d,!0),p),o.mp.track(e,v,o.track_callback(t,v,d))})},this),!0},Ye.prototype.track_callback=function(n,e,i,t){t=t||!1;var o=this;return function(){i.callback_fired||(i.callback_fired=!0,!(n&&n(t,e)===!1)&&o.after_track_handler(e,i,t))}},Ye.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=m.extend({},n),i};var Un=function(){this.override_event="click"};m.inherit(Un,Ye),Un.prototype.create_properties=function(n,e){var i=Un.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},Un.prototype.event_handler=function(n,e,i){i.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",i.href=e.href,i.new_tab||n.preventDefault()},Un.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ni=function(){this.override_event="submit"};m.inherit(Ni,Ye),Ni.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Ni.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var mn="$set",Vn="$set_once",Ge="$unset",wn="$add",qe="$append",Sn="$union",Qe="$remove",Ir="$delete",Ho={set_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[mn]=t,i},unset_action:function(n){var e={},i=[];return m.isArray(n)||(n=[n]),m.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Ge]=i,e},set_once_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Vn]=t,i},union_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=m.isArray(o)?o:[o])},this):t[n]=m.isArray(e)?e:[e],i[Sn]=t,i},append_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[qe]=t,i},remove_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Qe]=t,i},delete_action:function(){var n={};return n[Ir]="",n}},ie=function(){};m.extend(ie.prototype,Ho),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=On(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=On(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=On(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=On(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=On(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=On(function(n,e,i){var t=this.remove_action(n,e);return this._send_request(t,i)}),ie.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var i=m.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},ie.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},ie.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ie.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},ie.prototype.remove=ie.prototype.remove,ie.prototype.set=ie.prototype.set,ie.prototype.set_once=ie.prototype.set_once,ie.prototype.union=ie.prototype.union,ie.prototype.unset=ie.prototype.unset,ie.prototype.toString=ie.prototype.toString;var R=function(){};m.extend(R.prototype,Ho),R.prototype._init=function(n){this._mixpanel=n},R.prototype.set=un(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[mn]=m.extend({},m.info.people_properties(),t[mn]),this._send_request(t,i)}),R.prototype.set_once=un(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),R.prototype.unset=un(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),R.prototype.increment=un(function(n,e,i){var t={},o={};return m.isObject(n)?(m.each(n,function(s,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[a]=s},this),i=e):(m.isUndefined(e)&&(e=1),o[n]=e),t[wn]=o,this._send_request(t,i)}),R.prototype.append=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),R.prototype.remove=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),R.prototype.union=un(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),R.prototype.track_charge=un(function(n,e,i){if(!m.isNumber(n)&&(n=parseFloat(n),isNaN(n))){J.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",m.extend({$amount:n},e),i)}),R.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},R.prototype.delete_user=function(){if(!this._identify_called()){J.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},R.prototype.toString=function(){return this._mixpanel.toString()+".people"},R.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),t=this._mixpanel.get_property("$user_id"),o=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(n.$device_id=i),t&&(n.$user_id=t),o&&(n.$had_persisted_distinct_id=o);var s=m.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(s,255))},R.prototype._get_config=function(n){return this._mixpanel.get_config(n)},R.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},R.prototype._enqueue=function(n){mn in n?this._mixpanel.persistence._add_to_people_queue(mn,n):Vn in n?this._mixpanel.persistence._add_to_people_queue(Vn,n):Ge in n?this._mixpanel.persistence._add_to_people_queue(Ge,n):wn in n?this._mixpanel.persistence._add_to_people_queue(wn,n):qe in n?this._mixpanel.persistence._add_to_people_queue(qe,n):Qe in n?this._mixpanel.persistence._add_to_people_queue(Qe,n):Sn in n?this._mixpanel.persistence._add_to_people_queue(Sn,n):J.error("Invalid call to _enqueue():",n)},R.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=m.extend({},this._mixpanel.persistence.load_queue(n)),a=s;!m.isUndefined(s)&&m.isObject(s)&&!m.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(a=t(s)),e.call(o,a,function(l,d){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),m.isUndefined(i)||i(l,d)}))},R.prototype._flush=function(n,e,i,t,o,s,a){var l=this;this._flush_one_queue(mn,this.set,n),this._flush_one_queue(Vn,this.set_once,t),this._flush_one_queue(Ge,this.unset,s,function(S){return m.keys(S)}),this._flush_one_queue(wn,this.increment,e),this._flush_one_queue(Sn,this.union,o);var d=this._mixpanel.persistence.load_queue(qe);if(!m.isUndefined(d)&&m.isArray(d)&&d.length)for(var v,p=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(qe,v),m.isUndefined(i)||i(S,M)},g=d.length-1;g>=0;g--)d=this._mixpanel.persistence.load_queue(qe),v=d.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(v)||l.append(v,p);var f=this._mixpanel.persistence.load_queue(Qe);if(!m.isUndefined(f)&&m.isArray(f)&&f.length)for(var y,w=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Qe,y),m.isUndefined(a)||a(S,M)},C=f.length-1;C>=0;C--)f=this._mixpanel.persistence.load_queue(Qe),y=f.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(y)||l.remove(y,w)},R.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},R.prototype.set=R.prototype.set,R.prototype.set_once=R.prototype.set_once,R.prototype.unset=R.prototype.unset,R.prototype.increment=R.prototype.increment,R.prototype.append=R.prototype.append,R.prototype.remove=R.prototype.remove,R.prototype.union=R.prototype.union,R.prototype.track_charge=R.prototype.track_charge,R.prototype.clear_charges=R.prototype.clear_charges,R.prototype.delete_user=R.prototype.delete_user,R.prototype.toString=R.prototype.toString;var dt="__mps",ct="__mpso",ut="__mpus",ht="__mpa",mt="__mpap",pt="__mpr",vt="__mpu",Oo="$people_distinct_id",Bi="__alias",ii="__timers",Nr=[dt,ct,ut,ht,mt,pt,vt,Oo,Bi,ii],j=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(J.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,i){m.include(Nr,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,m.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},j.prototype.load_prop=function(n){return this.load(),this.props[n]},j.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},j.prototype.clear=function(){this.remove(),this.props={}},j.prototype.register_once=function(n,e,i){return m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),m.each(n,function(t,o){(!this.props.hasOwnProperty(o)||this.props[o]===e)&&(this.props[o]=t)},this),this.save(),!0):!1},j.prototype.register=function(n,e){return m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.extend(this.props,n),this.save(),!0):!1},j.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},j.prototype.update_search_keyword=function(n){this.register(m.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return m.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},j.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},j.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},j.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},j.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},j.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},j.prototype.get_cross_subdomain=function(){return this.cross_subdomain},j.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},j.prototype._add_to_people_queue=function(n,e){var i=this._get_queue_key(n),t=e[n],o=this._get_or_create_queue(mn),s=this._get_or_create_queue(Vn),a=this._get_or_create_queue(Ge),l=this._get_or_create_queue(wn),d=this._get_or_create_queue(Sn),v=this._get_or_create_queue(Qe,[]),p=this._get_or_create_queue(qe,[]);i===dt?(m.extend(o,t),this._pop_from_people_queue(wn,t),this._pop_from_people_queue(Sn,t),this._pop_from_people_queue(Ge,t)):i===ct?(m.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Ge,t)):i===ut?m.each(t,function(g){m.each([o,s,l,d],function(f){g in f&&delete f[g]}),m.each(p,function(f){g in f&&delete f[g]}),a[g]=!0}):i===ht?(m.each(t,function(g,f){f in o?o[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(Ge,t)):i===vt?(m.each(t,function(g,f){m.isArray(g)&&(f in d||(d[f]=[]),d[f]=d[f].concat(g))}),this._pop_from_people_queue(Ge,t)):i===pt?(v.push(t),this._pop_from_people_queue(qe,t)):i===mt&&(p.push(t),this._pop_from_people_queue(Ge,t)),J.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),J.log(e),this.save()},j.prototype._pop_from_people_queue=function(n,e){var i=this.props[this._get_queue_key(n)];m.isUndefined(i)||m.each(e,function(t,o){n===qe||n===Qe?m.each(i,function(s){s[o]===t&&delete s[o]}):delete i[o]},this)},j.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},j.prototype._get_queue_key=function(n){if(n===mn)return dt;if(n===Vn)return ct;if(n===Ge)return ut;if(n===wn)return ht;if(n===qe)return mt;if(n===Qe)return pt;if(n===Sn)return vt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(ii)||{};i[n]=e,this.props[ii]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(ii)||{},i=e[n];return m.isUndefined(i)||(delete this.props[ii][n],this.save()),i};var bt,Uo=function(n,e){throw new Error(n+" not available in this build.")},Ce,Vo=0,Br=1,Dr=function(n){return n},ti=function(){},Re="mixpanel",jo="base64",Rr="json",ft="$device:",jn=D.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Ko=!jn&&Fe.indexOf("MSIE")===-1&&Fe.indexOf("Mozilla")===-1,Di=null;dn.sendBeacon&&(Di=function(){return dn.sendBeacon.apply(dn,arguments)});var Go={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},zo={api_host:"https://api-js.mixpanel.com",api_routes:Go,api_method:"POST",api_transport:"XHR",api_payload_format:jo,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:ti,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:ti,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:Xn,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Fo=!1,x=function(){},gt=function(n,e,i){var t,o=i===Re?Ce:Ce[i];if(o&&bt===Vo)t=o;else{if(o&&!m.isArray(o)){J.error("You have already initialized "+i);return}t=new x}if(t._cached_groups={},t._init(n,e,i),t.people=new R,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=m.info.campaignParams(null),a={},l=!1;m.each(s,function(d,v){a["initial_"+v]=d,d&&(l=!0)}),l&&t.people.set_once(a)}return $e.DEBUG=$e.DEBUG||t.get_config("debug"),!m.isUndefined(o)&&m.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(m.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===Re){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=gt(n,e,i);return Ce[i]=t,t._loaded(),t},x.prototype._init=function(n,e,i){e=e||{},this.__loaded=!0,this.config={};var t={};if(!("api_payload_format"in e)){var o=e.api_host||zo.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=Rr)}if(this.set_config(m.extend({},zo,t,e,{name:i,token:n,callback_fn:(i===Re?i:Re+"."+i)+"._jsc"})),this._jsc=ti,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!m.localStorage.is_supported(!0)||!jn)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(d){J.log("Clearing batch queue "+d.queue_key),m.localStorage.remove(d.queue_key)});else if(this.init_batchers(),Di&&D.addEventListener){var s=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);D.addEventListener("pagehide",function(d){d.persisted&&s()}),D.addEventListener("visibilitychange",function(){ee.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:ft+a,$device_id:a},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},x.prototype.start_session_recording=cn(function(){if(!D.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=m.bind(function(){this._recorder=this._recorder||new D.__mp_recorder(this),this._recorder.startRecording()},this);m.isUndefined(D.__mp_recorder)?Uo(this.get_config("recorder_src"),n):n()}),x.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():J.critical("Session recorder module not loaded")},x.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},x.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=m.info.campaignParams(null);m.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(ee.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(ee.referrer)},x.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},x.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Fo)return this.__dom_loaded_queue.push([n,e]),!1;var i=new n().init(this);return i.track.apply(i,e)},x.prototype._init_url_change_tracking=function(n){var e="",i=this.track_pageview();if(i&&(e=m.info.currentUrl()),m.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){D.addEventListener("popstate",function(){D.dispatchEvent(new Event("mp_locationchange"))}),D.addEventListener("hashchange",function(){D.dispatchEvent(new Event("mp_locationchange"))});var t=D.history.pushState;typeof t=="function"&&(D.history.pushState=function(s,a,l){t.call(D.history,s,a,l),D.dispatchEvent(new Event("mp_locationchange"))});var o=D.history.replaceState;typeof o=="function"&&(D.history.replaceState=function(s,a,l){o.call(D.history,s,a,l),D.dispatchEvent(new Event("mp_locationchange"))}),D.addEventListener("mp_locationchange",(function(){var s=m.info.currentUrl(),a=!1;if(n==="full-url"?a=s!==e:n==="url-with-path-and-query-string"?a=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(a=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),a){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(jn){var i=function(a){n(a,e)};return i}else{var t=this._jsc,o=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+o+"]";return t[o]=function(a){delete t[o],n(a,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Ko)return this.__request_queue.push(arguments),o;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},a=null;!t&&(m.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=m.extend(s,i||{}),jn||(i.method="GET");var l=i.method==="POST",d=Di&&l&&i.transport.toLowerCase()==="sendbeacon",v=i.verbose;e.verbose&&(v=!0),this.get_config("test")&&(e.test=1),v&&(e.verbose=1),this.get_config("img")&&(e.img=1),jn||(t?e.callback=t:(v||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(a="data="+encodeURIComponent(e.data),delete e.data),n+="?"+m.HTTPBuildQuery(e);var p=this;if("img"in e){var g=ee.createElement("img");g.src=n,ee.body.appendChild(g)}else if(d){try{o=Di(n,a)}catch(M){p.report_error(M),o=!1}try{t&&t(o?1:0)}catch(M){p.report_error(M)}}else if(jn)try{var f=new XMLHttpRequest;f.open(i.method,n,!0);var y=this.get_config("xhr_headers");if(l&&(y["Content-Type"]="application/x-www-form-urlencoded"),m.each(y,function(M,A){f.setRequestHeader(A,M)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var w=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(v){var M;try{M=m.JSONDecode(f.responseText)}catch(T){if(p.report_error(T),i.ignore_json_errors)M=f.responseText;else return}t(M)}else t(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-w>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(A),t)if(v){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:A,retryAfter:_["Retry-After"]})}else t(0)}},f.send(a)}catch(M){p.report_error(M),o=!1}else{var C=ee.createElement("script");C.type="text/javascript",C.async=!0,C.defer=!0,C.src=n;var S=ee.getElementsByTagName("script")[0];S.parentNode.insertBefore(C,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];m.each(n,function(a){a&&(e=a[0],m.isArray(e)?o.push(a):typeof a=="function"?a.call(this):m.isArray(a)&&e==="alias"?i.push(a):m.isArray(a)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(a):t.push(a))},this);var s=function(a,l){m.each(a,function(d){if(m.isArray(d[0])){var v=l;m.each(d,function(p){v=v[p[0]].apply(v,p.slice(1))})}else this[d[0]].apply(this,d.slice(1))},l)};s(i,this),s(t,this),s(o,this)},x.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},x.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:n+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:n+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:n+"_gr"}},this._batcher_configs},x.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=m.bind(function(i){return new je(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.bind(function(t,o,s){this._send_request(this.get_config("api_host")+i.endpoint,this._encode_data_for_request(t),o,this._prepare_callback(s,t))},this),beforeSendHook:m.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:m.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},x.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,m.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.each(this.request_batchers,function(n){n.stop(),n.clear()})},x.prototype.push=function(n){this._execute_array([n])},x.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},x.prototype._encode_data_for_request=function(n){var e=m.JSONEncode(n);return this.get_config("api_payload_format")===jo&&(e=m.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=m.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,a=n.send_request_options||{};e=e||ti;var l=!0,d=m.bind(function(){return a.skip_hooks||(i=this._run_hook("before_send_"+n.type,i)),i?(J.log("MIXPANEL REQUEST:"),J.log(i),this._send_request(t,this._encode_data_for_request(i),a,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(v){v?e(1,i):d()}):l=d(),l&&i},x.prototype.track=cn(function(n,e,i,t){!t&&typeof i=="function"&&(t=i,i=null),i=i||{};var o=i.transport;o&&(i.transport=o);var s=i.send_immediately;if(typeof t!="function"&&(t=ti),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=m.extend({},e),e.token=this.get_config("token");var a=this.persistence.remove_event_timer(n);if(!m.isUndefined(a)){var l=new Date().getTime()-a;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var v=this.get_config("property_blacklist");m.isArray(v)?m.each(v,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+v);var p={event:n,properties:e},g=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:i},t);return g}),x.prototype.set_group=cn(function(n,e,i){m.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=cn(function(n,e,i){var t=this.get_property(n),o={};return t===void 0?(o[n]=[e],this.register(o)):t.indexOf(e)===-1&&(t.push(e),o[n]=t,this.register(o)),this.people.union(n,e,i)}),x.prototype.remove_group=cn(function(n,e,i){var t=this.get_property(n);if(t!==void 0){var o=t.indexOf(e);o>-1&&(t.splice(o,1),this.register({group_key:t})),t.length===0&&this.unregister(n)}return this.people.remove(n,e,i)}),x.prototype.track_with_groups=cn(function(n,e,i,t){var o=m.extend({},e||{});return m.each(i,function(s,a){s!=null&&(o[a]=s)}),this.track(n,o,t)}),x.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},x.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},x.prototype.get_group=function(n,e){var i=this._create_map_key(n,e),t=this._cached_groups[i];return(t===void 0||t._group_key!==n||t._group_id!==e)&&(t=new ie,t._init(this,n,e),this._cached_groups[i]=t),t},x.prototype.track_pageview=cn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),o=m.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,Un,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Ni,arguments)},x.prototype.time_event=function(n){if(m.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var Hr={persistent:!0},yt=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},Hr,e)};x.prototype.register=function(n,e){var i=yt(e);i.persistent?this.persistence.register(n,i.days):m.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=yt(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),m.each(n,function(o,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=o)},this))},x.prototype.unregister=function(n,e){e=yt(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},x.prototype._register_single=function(n,e){var i={};i[n]=e,this.register(i)},x.prototype.identify=function(n,e,i,t,o,s,a,l){var d=this.get_distinct_id();if(n&&d!==n){if(typeof n=="string"&&n.indexOf(ft)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var v=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}n!==d&&n!==this.get_property(Bi)&&(this.unregister(Bi),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,a,l),n!==d&&this.track("$identify",{distinct_id:n,$anon_distinct_id:d},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:ft+n,$device_id:n},"")},x.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},x.prototype.alias=function(n,e){if(n===this.get_property(Oo))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Bi,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){i.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},x.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},x.prototype.set_config=function(n){if(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.each(this.request_batchers,function(i){i.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),$e.DEBUG=$e.DEBUG||this.get_config("debug")}},x.prototype.get_config=function(n){return this.config[n]},x.prototype._run_hook=function(n){var e=(this.config.hooks[n]||Dr).apply(this,ln.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},x.prototype.get_property=function(n){return this.persistence.load_prop([n])},x.prototype.toString=function(){var n=this.get_config("name");return n!==Re&&(n=Re+"."+n),n},x.prototype._event_is_disabled=function(n){return m.isBlockedUA(Fe)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||m.cookie.get("mp_optout"))&&(m.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},x.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},x.prototype._gdpr_call_func=function(n,e){return e=m.extend({track:m.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),m.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},x.prototype.opt_in_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(wr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=m.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(Sr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(_r,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(To,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(Mr,n),this._gdpr_update_persistence(n)},x.prototype.report_error=function(n,e){J.error.apply(J.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){J.error(i)}},x.prototype.init=x.prototype.init,x.prototype.reset=x.prototype.reset,x.prototype.disable=x.prototype.disable,x.prototype.time_event=x.prototype.time_event,x.prototype.track=x.prototype.track,x.prototype.track_links=x.prototype.track_links,x.prototype.track_forms=x.prototype.track_forms,x.prototype.track_pageview=x.prototype.track_pageview,x.prototype.register=x.prototype.register,x.prototype.register_once=x.prototype.register_once,x.prototype.unregister=x.prototype.unregister,x.prototype.identify=x.prototype.identify,x.prototype.alias=x.prototype.alias,x.prototype.name_tag=x.prototype.name_tag,x.prototype.set_config=x.prototype.set_config,x.prototype.get_config=x.prototype.get_config,x.prototype.get_property=x.prototype.get_property,x.prototype.get_distinct_id=x.prototype.get_distinct_id,x.prototype.toString=x.prototype.toString,x.prototype.opt_out_tracking=x.prototype.opt_out_tracking,x.prototype.opt_in_tracking=x.prototype.opt_in_tracking,x.prototype.has_opted_out_tracking=x.prototype.has_opted_out_tracking,x.prototype.has_opted_in_tracking=x.prototype.has_opted_in_tracking,x.prototype.clear_opt_in_out_tracking=x.prototype.clear_opt_in_out_tracking,x.prototype.get_group=x.prototype.get_group,x.prototype.set_group=x.prototype.set_group,x.prototype.add_group=x.prototype.add_group,x.prototype.remove_group=x.prototype.remove_group,x.prototype.track_with_groups=x.prototype.track_with_groups,x.prototype.start_batch_senders=x.prototype.start_batch_senders,x.prototype.stop_batch_senders=x.prototype.stop_batch_senders,x.prototype.start_session_recording=x.prototype.start_session_recording,x.prototype.stop_session_recording=x.prototype.stop_session_recording,x.prototype.get_session_recording_properties=x.prototype.get_session_recording_properties,x.prototype.DEFAULT_API_ROUTES=Go,j.prototype.properties=j.prototype.properties,j.prototype.update_search_keyword=j.prototype.update_search_keyword,j.prototype.update_referrer_info=j.prototype.update_referrer_info,j.prototype.get_cross_subdomain=j.prototype.get_cross_subdomain,j.prototype.clear=j.prototype.clear;var Kn={},Or=function(){m.each(Kn,function(n,e){e!==Re&&(Ce[e]=n)}),Ce._=m},Ur=function(){Ce.init=function(n,e,i){if(i)return Ce[i]||(Ce[i]=Kn[i]=gt(n,e,i),Ce[i]._loaded()),Ce[i];var t=Ce;Kn[Re]?t=Kn[Re]:n&&(t=gt(n,e,Re),t._loaded(),Kn[Re]=t),Ce=t,bt===Br&&(D[Re]=Ce),Or()}},Vr=function(){function n(){n.done||(n.done=!0,Fo=!0,Ko=!1,m.each(Kn,function(t){t._dom_loaded()}))}function e(){try{ee.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(ee.addEventListener)ee.readyState==="complete"?n():ee.addEventListener("DOMContentLoaded",n,!1);else if(ee.attachEvent){ee.attachEvent("onreadystatechange",n);var i=!1;try{i=D.frameElement===null}catch{}ee.documentElement.doScroll&&i&&e()}m.register_event(D,"load",n,!0)};function jr(n){return Uo=n,bt=Vo,Ce=new x,Ur(),Ce.init(),Vr(),Ce}function Kr(n,e){e()}var P=jr(Kr);const qo=`<div id="checkoutConfirmationEnd">
|
|
796
796
|
<div class="w-full">
|
|
797
797
|
<div id="otp-content" class=" grid gap-4">
|
|
798
798
|
<h5 class="text-black" id="otp-message">
|
|
@@ -820,7 +820,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
820
820
|
</div>
|
|
821
821
|
</div>
|
|
822
822
|
</div>
|
|
823
|
-
</div>`;class Wo{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{
|
|
823
|
+
</div>`;class Wo{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return qo}}const Gr=`<div id="confirmationProgress">
|
|
824
824
|
<div class="min-h-[20dvh]">
|
|
825
825
|
<div>
|
|
826
826
|
<div class="grid grid-rows-[auto_1fr] gap-4 mx-5">
|
|
@@ -849,11 +849,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
849
849
|
|
|
850
850
|
</div>
|
|
851
851
|
</div>
|
|
852
|
-
</div>`;class zr{constructor(e){h(this,"container");h(this,"onAction");h(this,"onSuccess");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"setPaymentResponses");h(this,"step");h(this,"paymentMethod");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses,this.step=e.step,this.paymentMethod=e.paymentMethod}attachListeners(){this.initialTime=300,this.timeLeft=this.initialTime;const e=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyCardPayment(this.token,e,({data:i,headers:t})=>{this.onAction(this.step.success),this.redirectTo(i,t,"success")},()=>{this.onAction(this.step.failed)})},5e3),this.startTimer()}async verifyCardPayment(e,i,t,o){let s=0,a=i,l=!0,d;this.abortController&&(d=this.abortController.signal);const v=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(this.step.end);return}s+=1;try{const p=await
|
|
852
|
+
</div>`;class zr{constructor(e){h(this,"container");h(this,"onAction");h(this,"onSuccess");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"setPaymentResponses");h(this,"step");h(this,"paymentMethod");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses,this.step=e.step,this.paymentMethod=e.paymentMethod}attachListeners(){this.initialTime=300,this.timeLeft=this.initialTime;const e=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyCardPayment(this.token,e,({data:i,headers:t})=>{this.onAction(this.step.success),this.redirectTo(i,t,"success")},()=>{this.onAction(this.step.failed)})},5e3),this.startTimer()}async verifyCardPayment(e,i,t,o){let s=0,a=i,l=!0,d;this.abortController&&(d=this.abortController.signal);const v=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(this.step.end);return}s+=1;try{const p=await an(e,this.ref,d,this.rdtCode,this.url);p.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(p.data,p.headers),P.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Failed"}),o(p)),p.data.status==="inProgress"&&(l&&(a=i*(s+1),this.timer=setTimeout(v,a)),this.setPaymentResponses(p.data,p.headers)),(p.data.status==="success"||p.data.status==="successful")&&(this.setPaymentResponses(p.data,p.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:this.paymentMethod,verification_status:"Success"}),t(p))}catch{l&&(a=i*(s+1),this.timer=setTimeout(v,a))}};v()}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(this.step.end))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Gr}}class Fr{constructor({amount:e,totalAmount:i,container:t,email:o,encryption:s,planId:a,token:l,currency:d,rdtCode:v,url:p,reference:g,onSuccess:f,callBackUrl:y,metadata:w,localCurrency:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"email");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"confirmationProgress");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=d,this.onSuccess=f||(()=>null),this.container=t,this.encryption=s,this.token=l,this.email=o,this.planId=a,this.amount=e,this.totalAmount=i,this.rdtCode=v,this.url=p,this.reference=g,this.callBackUrl=y,this.metadata=w,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.restartTransactionProcess=_,this.retryingPayment=T,this.isMaxRetriesReached=!1,this.renderCardContent(),P.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await js(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{var l;if(this.retryingPayment){const d={channel:"card",reference:this.reference,encryptedCard:s};return di(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:{email:this.email},reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((l=this.merchantPlanDetail)==null?void 0:l.taxQuoteId)&&{taxQuoteId:this.merchantPlanDetail.taxQuoteId}};return As(this.token,d,this.rdtCode,this.url)}})().then(({data:l,headers:d})=>{var v,p,g,f,y,w,C,S;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=d,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=d,l!=null&&l.authorization){if(this.activeRef=l.reference,((v=l==null?void 0:l.authorization)==null?void 0:v.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((S=l==null?void 0:l.authorization)==null?void 0:S.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment"),this.warningScreen.hideReportIssue();else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=d,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,d,"success"))}).catch(l=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),l.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue())}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const i={authorization:{pin:e},reference:this.activeRef};P.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const t=this.container.querySelector("#pin-loader"),o=this.container.querySelector("#cancel-payment");t&&(t.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
853
853
|
<path
|
|
854
854
|
d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
|
|
855
855
|
stroke="black" stroke-width="4" stroke-linejoin="round" />
|
|
856
|
-
</svg>`),o&&o.classList.add("hidden"),li(this.token,i,this.rdtCode,this.url).then(({data:a,headers:l})=>{var d,v,p,g,f,y,w;if(a.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(v=a==null?void 0:a.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=a==null?void 0:a.authorization)==null?void 0:p.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml);return}if(((y=a==null?void 0:a.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((w=a==null?void 0:a.authorization)==null?void 0:w.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).catch(a=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new De(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:a})=>{const l=document.createElement("button");l.textContent=a,l.setAttribute("id",s),l.classList.add("warning-button");const d=document.createElement("div");d.appendChild(l),t.appendChild(d)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),li(this.token,s,this.rdtCode,this.url).then(({data:l,headers:d})=>{var v,p,g,f,y,w,C;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,d,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((v=l==null?void 0:l.authorization)==null?void 0:v.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}this.currentStep=10}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),li(this.token,t,this.rdtCode,this.url).then(({data:s,headers:a})=>{var l,d,v,p,g,f,y;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,a,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((d=s==null?void 0:s.authorization)==null?void 0:d.mode)==="3DS"){(v=s==null?void 0:s.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl),(g=s==null?void 0:s.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=s==null?void 0:s.authorization)==null?void 0:f.embeddedHtml);return}if(((y=s==null?void 0:s.authorization)==null?void 0:y.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const i=window.open("","_blank");if(!i){alert("Please enable popups for this site to complete the authentication.");return}i.location.href=e,P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const i=atob(e),t=new Blob([i],{type:"text/html"}),o=URL.createObjectURL(t),s=window.open(o,"_blank");if(s){s.document.close(),P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{s.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:d})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,d,"success")},({data:l})=>{this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await sn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):(["success","successful"].includes(t.data.status)&&e(t),t.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await sn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Rt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency!==this.currency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new qs({container:this.contents,onClose:this.onClose,onAction:a=>this.handlePinRequest.bind(this)(a)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new zs({container:this.contents,onClose:this.onClose,onAction:a=>l=>this.submitOtp.bind(this)(a,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new gn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Js({container:this.contents,onAction:a=>l=>this.validatedAVS.bind(this)(a,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var a;this.currentStep=4,this.warningScreen.setPaymentError(((a=this.cardResponse)==null?void 0:a.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new Wo({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new zr({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(a,l)=>{this.cardResponse=a,this.cardResponseHeader=l},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.confirmationProgress.renderComponent();break;default:this.cardDetailForm=new Rt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,a;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,d=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${d} ${xe(this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(l==="USD"?(a=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:a.rate:1),2)}`}}}const qr=`<div>
|
|
856
|
+
</svg>`),o&&o.classList.add("hidden"),li(this.token,i,this.rdtCode,this.url).then(({data:a,headers:l})=>{var d,v,p,g,f,y,w;if(a.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(a.status))this.currentStep=5,this.redirectTo(a,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="3DS"){(v=a==null?void 0:a.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=a==null?void 0:a.authorization)==null?void 0:p.redirectUrl),(g=a==null?void 0:a.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=a==null?void 0:a.authorization)==null?void 0:f.embeddedHtml);return}if(((y=a==null?void 0:a.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=a,this.currentStep=3;return}if(((w=a==null?void 0:a.authorization)==null?void 0:w.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).catch(a=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new De(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:a})=>{const l=document.createElement("button");l.textContent=a,l.setAttribute("id",s),l.classList.add("warning-button");const d=document.createElement("div");d.appendChild(l),t.appendChild(d)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),li(this.token,s,this.rdtCode,this.url).then(({data:l,headers:d})=>{var v,p,g,f,y,w,C;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,d,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((v=l==null?void 0:l.authorization)==null?void 0:v.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),(y=l==null?void 0:l.authorization)!=null&&y.embeddedHtml&&this.redirectToPreciumDoc((w=l==null?void 0:l.authorization)==null?void 0:w.embeddedHtml);return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}this.currentStep=10}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),li(this.token,t,this.rdtCode,this.url).then(({data:s,headers:a})=>{var l,d,v,p,g,f,y;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue();else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,a,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((d=s==null?void 0:s.authorization)==null?void 0:d.mode)==="3DS"){(v=s==null?void 0:s.authorization)!=null&&v.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl),(g=s==null?void 0:s.authorization)!=null&&g.embeddedHtml&&this.redirectToPreciumDoc((f=s==null?void 0:s.authorization)==null?void 0:f.embeddedHtml);return}if(((y=s==null?void 0:s.authorization)==null?void 0:y.mode)==="avs"){this.currentStep=7;return}this.currentStep=10}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})}redirectTo3DS(e){const i=window.open("","_blank");if(!i){alert("Please enable popups for this site to complete the authentication.");return}i.location.href=e,P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}redirectToPreciumDoc(e){const i=atob(e),t=new Blob([i],{type:"text/html"}),o=URL.createObjectURL(t),s=window.open(o,"_blank");if(s){s.document.close(),P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const a=setInterval(()=>{s.closed&&(clearInterval(a),this.verifyPayment(({data:l,headers:d})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(l,d,"success")},({data:l})=>{this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue(),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await an(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):(["success","successful"].includes(t.data.status)&&e(t),t.data.status==="inProgress"&&(this.currentStep=10))}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await an(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Rt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency!==this.currency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new qs({container:this.contents,onClose:this.onClose,onAction:a=>this.handlePinRequest.bind(this)(a)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new zs({container:this.contents,onClose:this.onClose,onAction:a=>l=>this.submitOtp.bind(this)(a,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new gn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Js({container:this.contents,onAction:a=>l=>this.validatedAVS.bind(this)(a,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var a;this.currentStep=4,this.warningScreen.setPaymentError(((a=this.cardResponse)==null?void 0:a.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new Wo({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;case 10:this.confirmationProgress=new zr({container:this.contents,onAction:a=>{this.currentStep=a},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(a,l)=>{this.cardResponse=a,this.cardResponseHeader=l},step:{failed:4,success:5,end:9},paymentMethod:"Card"}),this.confirmationProgress.renderComponent();break;default:this.cardDetailForm=new Rt({container:this.contents,onAction:a=>l=>this.submitCardDetails.bind(this)(a,l),merchantName:this.merchantPlanDetail.merchantName,currency:this.localCurrency?this.localCurrency:this.currency}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,a;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,d=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${d} ${xe(this.totalAmount!==this.amount?this.totalAmount:(this.amount||0)*(l==="USD"?(a=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:a.rate:1),2)}`}}}const qr=`<div>
|
|
857
857
|
<div class="container-center h-[40vh] hidden" id="loader">
|
|
858
858
|
<img src="" alt="loader gif" />
|
|
859
859
|
</div>
|
|
@@ -950,8 +950,8 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
950
950
|
*
|
|
951
951
|
* Copyright 2020, Pusher
|
|
952
952
|
* Released under the MIT licence.
|
|
953
|
-
*/(function(n,e){(function(t,o){n.exports=o()})(window,function(){return function(i){var t={};function o(s){if(t[s])return t[s].exports;var a=t[s]={i:s,l:!1,exports:{}};return i[s].call(a.exports,a,a.exports,o),a.l=!0,a.exports}return o.m=i,o.c=t,o.d=function(s,a,l){o.o(s,a)||Object.defineProperty(s,a,{enumerable:!0,get:l})},o.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.t=function(s,a){if(a&1&&(s=o(s)),a&8||a&4&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),a&2&&typeof s!="string")for(var d in s)o.d(l,d,(function(v){return s[v]}).bind(null,d));return l},o.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(a,"a",a),a},o.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var C=function(S,M){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,_){A.__proto__=_}||function(A,_){for(var T in _)_.hasOwnProperty(T)&&(A[T]=_[T])},C(S,M)};return function(S,M){C(S,M);function A(){this.constructor=S}S.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=256,l=function(){function C(S){S===void 0&&(S="="),this._paddingCharacter=S}return C.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},C.prototype.encode=function(S){for(var M="",A=0;A<S.length-2;A+=3){var _=S[A]<<16|S[A+1]<<8|S[A+2];M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),M+=this._encodeByte(_>>>1*6&63),M+=this._encodeByte(_>>>0*6&63)}var T=S.length-A;if(T>0){var _=S[A]<<16|(T===2?S[A+1]<<8:0);M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),T===2?M+=this._encodeByte(_>>>1*6&63):M+=this._paddingCharacter||"",M+=this._paddingCharacter||""}return M},C.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},C.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},C.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var M=this._getPaddingLength(S),A=S.length-M,_=new Uint8Array(this.maxDecodedLength(A)),T=0,I=0,K=0,z=0,U=0,G=0,oe=0;I<A-4;I+=4)z=this._decodeChar(S.charCodeAt(I+0)),U=this._decodeChar(S.charCodeAt(I+1)),G=this._decodeChar(S.charCodeAt(I+2)),oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=z<<2|U>>>4,_[T++]=U<<4|G>>>2,_[T++]=G<<6|oe,K|=z&a,K|=U&a,K|=G&a,K|=oe&a;if(I<A-1&&(z=this._decodeChar(S.charCodeAt(I)),U=this._decodeChar(S.charCodeAt(I+1)),_[T++]=z<<2|U>>>4,K|=z&a,K|=U&a),I<A-2&&(G=this._decodeChar(S.charCodeAt(I+2)),_[T++]=U<<4|G>>>2,K|=G&a),I<A-3&&(oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=G<<6|oe,K|=oe&a),K!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},C.prototype._encodeByte=function(S){var M=S;return M+=65,M+=25-S>>>8&6,M+=51-S>>>8&-75,M+=61-S>>>8&-15,M+=62-S>>>8&3,String.fromCharCode(M)},C.prototype._decodeChar=function(S){var M=a;return M+=(42-S&S-44)>>>8&-a+S-43+62,M+=(46-S&S-48)>>>8&-a+S-47+63,M+=(47-S&S-58)>>>8&-a+S-48+52,M+=(64-S&S-91)>>>8&-a+S-65+0,M+=(96-S&S-123)>>>8&-a+S-97+26,M},C.prototype._getPaddingLength=function(S){var M=0;if(this._paddingCharacter){for(var A=S.length-1;A>=0&&S[A]===this._paddingCharacter;A--)M++;if(S.length<4||M>2)throw new Error("Base64Coder: incorrect padding")}return M},C}();t.Coder=l;var d=new l;function v(C){return d.encode(C)}t.encode=v;function p(C){return d.decode(C)}t.decode=p;var g=function(C){s(S,C);function S(){return C!==null&&C.apply(this,arguments)||this}return S.prototype._encodeByte=function(M){var A=M;return A+=65,A+=25-M>>>8&6,A+=51-M>>>8&-75,A+=61-M>>>8&-13,A+=62-M>>>8&49,String.fromCharCode(A)},S.prototype._decodeChar=function(M){var A=a;return A+=(44-M&M-46)>>>8&-a+M-45+62,A+=(94-M&M-96)>>>8&-a+M-95+63,A+=(47-M&M-58)>>>8&-a+M-48+52,A+=(64-M&M-91)>>>8&-a+M-65+0,A+=(96-M&M-123)>>>8&-a+M-97+26,A},S}(l);t.URLSafeCoder=g;var f=new g;function y(C){return f.encode(C)}t.encodeURLSafe=y;function w(C){return f.decode(C)}t.decodeURLSafe=w,t.encodedLength=function(C){return d.encodedLength(C)},t.maxDecodedLength=function(C){return d.maxDecodedLength(C)},t.decodedLength=function(C){return d.decodedLength(C)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",a="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(d(p)),f=0,y=0;y<p.length;y++){var w=p.charCodeAt(y);w<128?g[f++]=w:w<2048?(g[f++]=192|w>>6,g[f++]=128|w&63):w<55296?(g[f++]=224|w>>12,g[f++]=128|w>>6&63,g[f++]=128|w&63):(y++,w=(w&1023)<<10,w|=p.charCodeAt(y)&1023,w+=65536,g[f++]=240|w>>18,g[f++]=128|w>>12&63,g[f++]=128|w>>6&63,g[f++]=128|w&63)}return g}t.encode=l;function d(p){for(var g=0,f=0;f<p.length;f++){var y=p.charCodeAt(f);if(y<128)g+=1;else if(y<2048)g+=2;else if(y<55296)g+=3;else if(y<=57343){if(f>=p.length-1)throw new Error(s);f++,g+=4}else throw new Error(s)}return g}t.encodedLength=d;function v(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var w=void 0;if(y<224){if(f>=p.length)throw new Error(a);var C=p[++f];if((C&192)!==128)throw new Error(a);y=(y&31)<<6|C&63,w=128}else if(y<240){if(f>=p.length-1)throw new Error(a);var C=p[++f],S=p[++f];if((C&192)!==128||(S&192)!==128)throw new Error(a);y=(y&15)<<12|(C&63)<<6|S&63,w=2048}else if(y<248){if(f>=p.length-2)throw new Error(a);var C=p[++f],S=p[++f],M=p[++f];if((C&192)!==128||(S&192)!==128||(M&192)!==128)throw new Error(a);y=(y&15)<<18|(C&63)<<12|(S&63)<<6|M&63,w=65536}else throw new Error(a);if(y<w||y>=55296&&y<=57343)throw new Error(a);if(y>=65536){if(y>1114111)throw new Error(a);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=v},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(r,c){this.lastId=0,this.prefix=r,this.name=c}create(r){this.lastId++;var c=this.lastId,b=this.prefix+c,k=this.name+"["+c+"]",L=!1,E=function(){L||(r.apply(null,arguments),L=!0)};return this[c]=E,{number:c,id:b,name:k,callback:E}}remove(r){delete this[r.number]}}var a=new s("_pusher_script_","Pusher.ScriptReceivers"),l={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},d=l;class v{constructor(r){this.options=r,this.receivers=r.receivers||a,this.loading={}}load(r,c,b){var k=this;if(k.loading[r]&&k.loading[r].length>0)k.loading[r].push(b);else{k.loading[r]=[b];var L=O.createScriptRequest(k.getPath(r,c)),E=k.receivers.create(function(N){if(k.receivers.remove(E),k.loading[r]){var H=k.loading[r];delete k.loading[r];for(var Z=function(pe){pe||L.cleanup()},X=0;X<H.length;X++)H[X](N,Z)}});L.send(E)}}getRoot(r){var c,b=O.getDocument().location.protocol;return r&&r.useTLS||b==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(r,c){return this.getRoot(c)+"/"+r+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new v({cdn_http:d.cdn_http,cdn_https:d.cdn_https,version:d.VERSION,suffix:d.dependency_suffix,receivers:p});const f={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var w={buildLogSuffix:function(u){const r="See:",c=f.urls[u];if(!c)return"";let b;return c.fullUrl?b=c.fullUrl:c.path&&(b=f.baseUrl+c.path),b?`${r} ${b}`:""}},C;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(C||(C={}));class S extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class T extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class I extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class z extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(r,c){super(c),this.status=r,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,r,c,b,k){const L=O.createXHR();L.open("POST",c.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)L.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let N=c.headersProvider();for(var E in N)L.setRequestHeader(E,N[E])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let N,H=!1;try{N=JSON.parse(L.responseText),H=!0}catch{k(new U(200,`JSON returned from ${b.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}H&&k(null,N)}else{let N="";switch(b){case C.UserAuthentication:N=w.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:N=`Clients must be authorized to join private or presence channels. ${w.buildLogSuffix("authorizationEndpoint")}`;break}k(new U(L.status,`Unable to retrieve auth string from ${b.toString()} endpoint - received status: ${L.status} from ${c.endpoint}. ${N}`),null)}},L.send(r),L};function ge(u){return Xe(Te(u))}var V=String.fromCharCode,_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var r=u.charCodeAt(0);return r<128?u:r<2048?V(192|r>>>6)+V(128|r&63):V(224|r>>>12&15)+V(128|r>>>6&63)+V(128|r&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Me=function(u){var r=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),b=[_e.charAt(c>>>18),_e.charAt(c>>>12&63),r>=2?"=":_e.charAt(c>>>6&63),r>=1?"=":_e.charAt(c&63)];return b.join("")},Xe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Me)};class vn{constructor(r,c,b,k){this.clear=c,this.timer=r(()=>{this.timer&&(this.timer=k(this.timer))},b)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var en=vn;function _n(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends en{constructor(r,c){super(setTimeout,_n,r,function(b){return c(),null})}}class nn extends en{constructor(r,c){super(setInterval,bn,r,function(b){return c(),b})}}var Mn={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...r){var c=Array.prototype.slice.call(arguments,1);return function(b){return b[u].apply(b,c.concat(arguments))}}},re=Mn;function fe(u,...r){for(var c=0;c<r.length;c++){var b=r[c];for(var k in b)b[k]&&b[k].constructor&&b[k].constructor===Object?u[k]=fe(u[k]||{},b[k]):u[k]=b[k]}return u}function He(){for(var u=["Pusher"],r=0;r<arguments.length;r++)typeof arguments[r]=="string"?u.push(arguments[r]):u.push(An(arguments[r]));return u.join(" : ")}function Pe(u,r){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(r);for(var b=0,k=u.length;b<k;b++)if(u[b]===r)return b;return-1}function ke(u,r){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&r(u[c],c,u)}function We(u){var r=[];return ke(u,function(c,b){r.push(b)}),r}function B(u){var r=[];return ke(u,function(c){r.push(c)}),r}function he(u,r,c){for(var b=0;b<u.length;b++)r.call(c||window,u[b],b,u)}function Q(u,r){for(var c=[],b=0;b<u.length;b++)c.push(r(u[b],b,u,c));return c}function me(u,r){var c={};return ke(u,function(b,k){c[k]=r(b)}),c}function Ie(u,r){r=r||function(k){return!!k};for(var c=[],b=0;b<u.length;b++)r(u[b],b,u,c)&&c.push(u[b]);return c}function $(u,r){var c={};return ke(u,function(b,k){(r&&r(b,k,u,c)||b)&&(c[k]=b)}),c}function fn(u){var r=[];return ke(u,function(c,b){r.push([b,c])}),r}function oi(u,r){for(var c=0;c<u.length;c++)if(r(u[c],c,u))return!0;return!1}function Hi(u,r){for(var c=0;c<u.length;c++)if(!r(u[c],c,u))return!1;return!0}function Oi(u){return me(u,function(r){return typeof r=="object"&&(r=An(r)),encodeURIComponent(ge(r.toString()))})}function Ui(u){var r=$(u,function(b){return b!==void 0}),c=Q(fn(Oi(r)),re.method("join","=")).join("&");return c}function Vi(u){var r=[],c=[];return function b(k,L){var E,N,H;switch(typeof k){case"object":if(!k)return null;for(E=0;E<r.length;E+=1)if(r[E]===k)return{$ref:c[E]};if(r.push(k),c.push(L),Object.prototype.toString.apply(k)==="[object Array]")for(H=[],E=0;E<k.length;E+=1)H[E]=b(k[E],L+"["+E+"]");else{H={};for(N in k)Object.prototype.hasOwnProperty.call(k,N)&&(H[N]=b(k[N],L+"["+JSON.stringify(N)+"]"))}return H;case"number":case"string":case"boolean":return k}}(u,"$")}function An(u){try{return JSON.stringify(u)}catch{return JSON.stringify(Vi(u))}}class si{constructor(){this.globalLog=r=>{window.console&&window.console.log&&window.console.log(r)}}debug(...r){this.log(this.globalLog,r)}warn(...r){this.log(this.globalLogWarn,r)}error(...r){this.log(this.globalLogError,r)}globalLogWarn(r){window.console&&window.console.warn?window.console.warn(r):this.globalLog(r)}globalLogError(r){window.console&&window.console.error?window.console.error(r):this.globalLogWarn(r)}log(r,...c){var b=He.apply(this,arguments);Pt.log?Pt.log(b):Pt.logToConsole&&r.bind(this)(b)}}var se=new si,El=function(u,r,c,b,k){(c.headers!==void 0||c.headersProvider!=null)&&se.warn(`To send headers with the ${b.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var E=u.getDocument(),N=E.createElement("script");u.auth_callbacks[L]=function(X){k(null,X)};var H="Pusher.auth_callbacks['"+L+"']";N.src=c.endpoint+"?callback="+encodeURIComponent(H)+"&"+r;var Z=E.getElementsByTagName("head")[0]||E.documentElement;Z.insertBefore(N,Z.firstChild)},Pl=El;class Il{constructor(r){this.src=r}send(r){var c=this,b="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=r.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){r.callback(b)},c.script.onload=function(){r.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&r.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=r.id+"_error",c.errorScript.text=r.name+"('"+b+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var k=document.getElementsByTagName("head")[0];k.insertBefore(c.script,k.firstChild),c.errorScript&&k.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Nl{constructor(r,c){this.url=r,this.data=c}send(r){if(!this.request){var c=Ui(this.data),b=this.url+"/"+r.number+"?"+c;this.request=O.createScriptRequest(b),this.request.send(r)}}cleanup(){this.request&&this.request.cleanup()}}var Bl=function(u,r){return function(c,b){var k="http"+(r?"s":"")+"://",L=k+(u.host||u.options.host)+u.options.path,E=O.createJSONPRequest(L,c),N=O.ScriptReceivers.create(function(H,Z){a.remove(N),E.cleanup(),Z&&Z.host&&(u.host=Z.host),b&&b(H,Z)});E.send(N)}},Dl={name:"jsonp",getAgent:Bl},Rl=Dl;function kt(u,r,c){var b=u+(r.useTLS?"s":""),k=r.useTLS?r.hostTLS:r.hostNonTLS;return b+"://"+k+c}function wt(u,r){var c="/app/"+u,b="?protocol="+d.PROTOCOL+"&client=js&version="+d.VERSION+(r?"&"+r:"");return c+b}var Hl={getInitial:function(u,r){var c=(r.httpPath||"")+wt(u,"flash=false");return kt("ws",r,c)}},Ol={getInitial:function(u,r){var c=(r.httpPath||"/pusher")+wt(u);return kt("http",r,c)}},Ul={getInitial:function(u,r){return kt("http",r,r.httpPath||"/pusher")},getPath:function(u,r){return wt(u)}};class Vl{constructor(){this._callbacks={}}get(r){return this._callbacks[St(r)]}add(r,c,b){var k=St(r);this._callbacks[k]=this._callbacks[k]||[],this._callbacks[k].push({fn:c,context:b})}remove(r,c,b){if(!r&&!c&&!b){this._callbacks={};return}var k=r?[St(r)]:We(this._callbacks);c||b?this.removeCallback(k,c,b):this.removeAllCallbacks(k)}removeCallback(r,c,b){he(r,function(k){this._callbacks[k]=Ie(this._callbacks[k]||[],function(L){return c&&c!==L.fn||b&&b!==L.context}),this._callbacks[k].length===0&&delete this._callbacks[k]},this)}removeAllCallbacks(r){he(r,function(c){delete this._callbacks[c]},this)}}function St(u){return"_"+u}class tn{constructor(r){this.callbacks=new Vl,this.global_callbacks=[],this.failThrough=r}bind(r,c,b){return this.callbacks.add(r,c,b),this}bind_global(r){return this.global_callbacks.push(r),this}unbind(r,c,b){return this.callbacks.remove(r,c,b),this}unbind_global(r){return r?(this.global_callbacks=Ie(this.global_callbacks||[],c=>c!==r),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(r,c,b){for(var k=0;k<this.global_callbacks.length;k++)this.global_callbacks[k](r,c);var L=this.callbacks.get(r),E=[];if(b?E.push(c,b):c&&E.push(c),L&&L.length>0)for(var k=0;k<L.length;k++)L[k].fn.apply(L[k].context||window,E);else this.failThrough&&this.failThrough(r,c);return this}}class jl extends tn{constructor(r,c,b,k,L){super(),this.initialize=O.transportConnectionInitializer,this.hooks=r,this.name=c,this.priority=b,this.key=k,this.options=L,this.state="new",this.timeline=L.timeline,this.activityTimeout=L.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var r=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(r,this.options)}catch(c){return re.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:r}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(r){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(r)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(r){this.emit("error",{type:"WebSocketError",error:r}),this.timeline.error(this.buildTimelineMessage({error:r.toString()}))}onClose(r){r?this.changeState("closed",{code:r.code,reason:r.reason,wasClean:r.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(r){this.emit("message",r)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=r=>{this.onError(r)},this.socket.onclose=r=>{this.onClose(r)},this.socket.onmessage=r=>{this.onMessage(r)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(r,c){this.state=r,this.timeline.info(this.buildTimelineMessage({state:r,params:c})),this.emit(r,c)}buildTimelineMessage(r){return fe({cid:this.id},r)}}class Gn{constructor(r){this.hooks=r}isSupported(r){return this.hooks.isSupported(r)}createConnection(r,c,b,k){return new jl(this.hooks,r,c,b,k)}}var Kl=new Gn({urls:Hl,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!O.getWebSocketAPI()},isSupported:function(){return!!O.getWebSocketAPI()},getSocket:function(u){return O.createWebSocket(u)}}),ss={urls:Ol,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},as=fe({getSocket:function(u){return O.HTTPFactory.createStreamingSocket(u)}},ss),rs=fe({getSocket:function(u){return O.HTTPFactory.createPollingSocket(u)}},ss),ls={isSupported:function(){return O.isXHRSupported()}},Gl=new Gn(fe({},as,ls)),zl=new Gn(fe({},rs,ls)),Fl={ws:Kl,xhr_streaming:Gl,xhr_polling:zl},ji=Fl,ql=new Gn({file:"sockjs",urls:Ul,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,r){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:r.useTLS}),ignore_null_origin:r.ignoreNullOrigin})},beforeOpen:function(u,r){u.send(JSON.stringify({path:r}))}}),ds={isSupported:function(u){var r=O.isXDRSupported(u.useTLS);return r}},Wl=new Gn(fe({},as,ds)),Zl=new Gn(fe({},rs,ds));ji.xdr_streaming=Wl,ji.xdr_polling=Zl,ji.sockjs=ql;var Jl=ji;class $l extends tn{constructor(){super();var r=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){r.emit("online")},!1),window.addEventListener("offline",function(){r.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Yl=new $l;class Ql{constructor(r,c,b){this.manager=r,this.transport=c,this.minPingDelay=b.minPingDelay,this.maxPingDelay=b.maxPingDelay,this.pingDelay=void 0}createConnection(r,c,b,k){k=fe({},k,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(r,c,b,k),E=null,N=function(){L.unbind("open",N),L.bind("closed",H),E=re.now()},H=Z=>{if(L.unbind("closed",H),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&E){var X=re.now()-E;X<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(X/2,this.minPingDelay))}};return L.bind("open",N),L}isSupported(r){return this.manager.isAlive()&&this.transport.isSupported(r)}}const cs={decodeMessage:function(u){try{var r=JSON.parse(u.data),c=r.data;if(typeof c=="string")try{c=JSON.parse(r.data)}catch{}var b={event:r.event,channel:r.channel,data:c};return r.user_id&&(b.user_id=r.user_id),b}catch(k){throw{type:"MessageParseError",error:k,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var r=cs.decodeMessage(u);if(r.event==="pusher:connection_established"){if(!r.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:r.data.socket_id,activityTimeout:r.data.activity_timeout*1e3}}else{if(r.event==="pusher:error")return{action:this.getCloseAction(r.data),error:this.getCloseError(r.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}};var xn=cs;class Xl extends tn{constructor(r,c){super(),this.id=r,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(r){return this.transport.send(r)}send_event(r,c,b){var k={event:r,data:c};return b&&(k.channel=b),se.debug("Event sent",k),this.send(xn.encodeMessage(k))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var r={message:b=>{var k;try{k=xn.decodeMessage(b)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:b.data})}if(k!==void 0){switch(se.debug("Event recd",k),k.event){case"pusher:error":this.emit("error",{type:"PusherError",data:k.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",k)}},activity:()=>{this.emit("activity")},error:b=>{this.emit("error",b)},closed:b=>{c(),b&&b.code&&this.handleCloseEvent(b),this.transport=null,this.emit("closed")}},c=()=>{ke(r,(b,k)=>{this.transport.unbind(k,b)})};ke(r,(b,k)=>{this.transport.bind(k,b)})}handleCloseEvent(r){var c=xn.getCloseAction(r),b=xn.getCloseError(r);b&&this.emit("error",b),c&&this.emit(c,{action:c,error:b})}}class ed{constructor(r,c){this.transport=r,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=r=>{this.unbindListeners();var c;try{c=xn.processHandshake(r)}catch(b){this.finish("error",{error:b}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new Xl(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=r=>{this.unbindListeners();var c=xn.getCloseAction(r)||"backoff",b=xn.getCloseError(r);this.finish(c,{error:b})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(r,c){this.callback(fe({transport:this.transport,action:r},c))}}class nd{constructor(r,c){this.timeline=r,this.options=c||{}}send(r,c){this.timeline.isEmpty()||this.timeline.send(O.TimelineTransport.getAgent(this,r),c)}}class _t extends tn{constructor(r,c){super(function(b,k){se.debug("No callbacks on "+r+" for "+b)}),this.name=r,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(r,c){return c(null,{auth:""})}trigger(r,c){if(r.indexOf("client-")!==0)throw new S("Event '"+r+"' does not start with 'client-'");if(!this.subscribed){var b=w.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${b}`)}return this.pusher.send_event(r,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(r){var c=r.event,b=r.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(r);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(r);else if(c.indexOf("pusher_internal:")!==0){var k={};this.emit(c,b,k)}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",r.data)}handleSubscriptionCountEvent(r){r.data.subscription_count&&(this.subscriptionCount=r.data.subscription_count),this.emit("pusher:subscription_count",r.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(r,c)=>{r?(this.subscriptionPending=!1,se.error(r.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:r.message},r instanceof U?{status:r.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class Mt extends _t{authorize(r,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:r},c)}}class id{constructor(){this.reset()}get(r){return Object.prototype.hasOwnProperty.call(this.members,r)?{id:r,info:this.members[r]}:null}each(r){ke(this.members,(c,b)=>{r(this.get(b))})}setMyID(r){this.myID=r}onSubscription(r){this.members=r.presence.hash,this.count=r.presence.count,this.me=this.get(this.myID)}addMember(r){return this.get(r.user_id)===null&&this.count++,this.members[r.user_id]=r.user_info,this.get(r.user_id)}removeMember(r){var c=this.get(r.user_id);return c&&(delete this.members[r.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var td=function(u,r,c,b){function k(L){return L instanceof c?L:new c(function(E){E(L)})}return new(c||(c=Promise))(function(L,E){function N(X){try{Z(b.next(X))}catch(pe){E(pe)}}function H(X){try{Z(b.throw(X))}catch(pe){E(pe)}}function Z(X){X.done?L(X.value):k(X.value).then(N,H)}Z((b=b.apply(u,r||[])).next())})};class od extends Mt{constructor(r,c){super(r,c),this.members=new id}authorize(r,c){super.authorize(r,(b,k)=>td(this,void 0,void 0,function*(){if(!b)if(k=k,k.channel_data!=null){var L=JSON.parse(k.channel_data);this.members.setMyID(L.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=w.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(b,k)}))}handleEvent(r){var c=r.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(r);else{var b=r.data,k={};r.user_id&&(k.user_id=r.user_id),this.emit(c,b,k)}}handleInternalEvent(r){var c=r.event,b=r.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(r);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(r);break;case"pusher_internal:member_added":var k=this.members.addMember(b);this.emit("pusher:member_added",k);break;case"pusher_internal:member_removed":var L=this.members.removeMember(b);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(r.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var sd=o(1),At=o(0);class ad extends Mt{constructor(r,c,b){super(r,c),this.key=null,this.nacl=b}authorize(r,c){super.authorize(r,(b,k)=>{if(b){c(b,k);return}let L=k.shared_secret;if(!L){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(At.decode)(L),delete k.shared_secret,c(null,k)})}trigger(r,c){throw new I("Client events are not currently supported for encrypted channels")}handleEvent(r){var c=r.event,b=r.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(r);return}this.handleEncryptedEvent(c,b)}handleEncryptedEvent(r,c){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let b=Object(At.decode)(c.ciphertext);if(b.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${b.length}`);return}let k=Object(At.decode)(c.nonce);if(k.length<this.nacl.secretbox.nonceLength){se.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${k.length}`);return}let L=this.nacl.secretbox.open(b,k,this.key);if(L===null){se.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,N)=>{if(E){se.error(`Failed to make a request to the authEndpoint: ${N}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(b,k,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(r,this.getDataToEmit(L))});return}this.emit(r,this.getDataToEmit(L))}getDataToEmit(r){let c=Object(sd.decode)(r);try{return JSON.parse(c)}catch{return c}}}class rd extends tn{constructor(r,c){super(),this.state="initialized",this.connection=null,this.key=r,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var b=O.getNetwork();b.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),b.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(r){return this.connection?this.connection.send(r):!1}send_event(r,c,b){return this.connection?this.connection.send_event(r,c,b):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var r=(c,b)=>{c?this.runner=this.strategy.connect(0,r):b.action==="error"?(this.emit("error",{type:"HandshakeError",error:b.error}),this.timeline.error({handshakeError:b.error})):(this.abortConnecting(),this.handshakeCallbacks[b.action](b))};this.runner=this.strategy.connect(0,r)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var r=this.abandonConnection();r.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(r){this.timeline.info({action:"retry",delay:r}),r>0&&this.emit("connecting_in",Math.round(r/1e3)),this.retryTimer=new Ee(r||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ee(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ee(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Ee(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(r){return fe({},r,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(r){return fe({},r,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let r=c=>b=>{b.error&&this.emit("error",{type:"WebSocketError",error:b.error}),c(b)};return{tls_only:r(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:r(()=>{this.disconnect()}),backoff:r(()=>{this.retryIn(1e3)}),retry:r(()=>{this.retryIn(0)})}}setConnection(r){this.connection=r;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var r in this.connectionCallbacks)this.connection.unbind(r,this.connectionCallbacks[r]);var c=this.connection;return this.connection=null,c}}updateState(r,c){var b=this.state;if(this.state=r,b!==r){var k=r;k==="connected"&&(k+=" with new socket ID "+c.socket_id),se.debug("State changed",b+" -> "+k),this.timeline.info({state:r,params:c}),this.emit("state_change",{previous:b,current:r}),this.emit(r,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ld{constructor(){this.channels={}}add(r,c){return this.channels[r]||(this.channels[r]=dd(r,c)),this.channels[r]}all(){return B(this.channels)}find(r){return this.channels[r]}remove(r){var c=this.channels[r];return delete this.channels[r],c}disconnect(){ke(this.channels,function(r){r.disconnect()})}}function dd(u,r){if(u.indexOf("private-encrypted-")===0){if(r.config.nacl)return on.createEncryptedChannel(u,r,r.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",b=w.buildLogSuffix("encryptedChannelSupport");throw new I(`${c}. ${b}`)}else{if(u.indexOf("private-")===0)return on.createPrivateChannel(u,r);if(u.indexOf("presence-")===0)return on.createPresenceChannel(u,r);if(u.indexOf("#")===0)throw new M('Cannot create a channel with name "'+u+'".');return on.createChannel(u,r)}}var cd={createChannels(){return new ld},createConnectionManager(u,r){return new rd(u,r)},createChannel(u,r){return new _t(u,r)},createPrivateChannel(u,r){return new Mt(u,r)},createPresenceChannel(u,r){return new od(u,r)},createEncryptedChannel(u,r,c){return new ad(u,r,c)},createTimelineSender(u,r){return new nd(u,r)},createHandshake(u,r){return new ed(u,r)},createAssistantToTheTransportManager(u,r,c){return new Ql(u,r,c)}},on=cd;class us{constructor(r){this.options=r||{},this.livesLeft=this.options.lives||1/0}getAssistant(r){return on.createAssistantToTheTransportManager(this,r,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Ln{constructor(r,c){this.strategies=r,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return oi(this.strategies,re.method("isSupported"))}connect(r,c){var b=this.strategies,k=0,L=this.timeout,E=null,N=(H,Z)=>{Z?c(null,Z):(k=k+1,this.loop&&(k=k%b.length),k<b.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),E=this.tryStrategy(b[k],r,{timeout:L,failFast:this.failFast},N)):c(!0))};return E=this.tryStrategy(b[k],r,{timeout:L,failFast:this.failFast},N),{abort:function(){E.abort()},forceMinPriority:function(H){r=H,E&&E.forceMinPriority(H)}}}tryStrategy(r,c,b,k){var L=null,E=null;return b.timeout>0&&(L=new Ee(b.timeout,function(){E.abort(),k(!0)})),E=r.connect(c,function(N,H){N&&L&&L.isRunning()&&!b.failFast||(L&&L.ensureAborted(),k(N,H))}),{abort:function(){L&&L.ensureAborted(),E.abort()},forceMinPriority:function(N){E.forceMinPriority(N)}}}}class xt{constructor(r){this.strategies=r}isSupported(){return oi(this.strategies,re.method("isSupported"))}connect(r,c){return ud(this.strategies,r,function(b,k){return function(L,E){if(k[b].error=L,L){hd(k)&&c(!0);return}he(k,function(N){N.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function ud(u,r,c){var b=Q(u,function(k,L,E,N){return k.connect(r,c(L,N))});return{abort:function(){he(b,md)},forceMinPriority:function(k){he(b,function(L){L.forceMinPriority(k)})}}}function hd(u){return Hi(u,function(r){return!!r.error})}function md(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class pd{constructor(r,c,b){this.strategy=r,this.transports=c,this.ttl=b.ttl||1800*1e3,this.usingTLS=b.useTLS,this.timeline=b.timeline}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.usingTLS,k=vd(b),L=k&&k.cacheSkipCount?k.cacheSkipCount:0,E=[this.strategy];if(k&&k.timestamp+this.ttl>=re.now()){var N=this.transports[k.transport];N&&(["ws","wss"].includes(k.transport)||L>3?(this.timeline.info({cached:!0,transport:k.transport,latency:k.latency}),E.push(new Ln([N],{timeout:k.latency*2+1e3,failFast:!0}))):L++)}var H=re.now(),Z=E.pop().connect(r,function X(pe,zi){pe?(hs(b),E.length>0?(H=re.now(),Z=E.pop().connect(r,X)):c(pe)):(bd(b,zi.transport.name,re.now()-H,L),c(null,zi))});return{abort:function(){Z.abort()},forceMinPriority:function(X){r=X,Z&&Z.forceMinPriority(X)}}}}function Lt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function vd(u){var r=O.getLocalStorage();if(r)try{var c=r[Lt(u)];if(c)return JSON.parse(c)}catch{hs(u)}return null}function bd(u,r,c,b){var k=O.getLocalStorage();if(k)try{k[Lt(u)]=An({timestamp:re.now(),transport:r,latency:c,cacheSkipCount:b})}catch{}}function hs(u){var r=O.getLocalStorage();if(r)try{delete r[Lt(u)]}catch{}}class Ki{constructor(r,{delay:c}){this.strategy=r,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy,k,L=new Ee(this.options.delay,function(){k=b.connect(r,c)});return{abort:function(){L.ensureAborted(),k&&k.abort()},forceMinPriority:function(E){r=E,k&&k.forceMinPriority(E)}}}}class ai{constructor(r,c,b){this.test=r,this.trueBranch=c,this.falseBranch=b}isSupported(){var r=this.test()?this.trueBranch:this.falseBranch;return r.isSupported()}connect(r,c){var b=this.test()?this.trueBranch:this.falseBranch;return b.connect(r,c)}}class fd{constructor(r){this.strategy=r}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy.connect(r,function(k,L){L&&b.abort(),c(k,L)});return b}}function ri(u){return function(){return u.isSupported()}}var gd=function(u,r,c){var b={};function k(Ss,fc,gc,yc,Cc){var _s=c(u,Ss,fc,gc,yc,Cc);return b[Ss]=_s,_s}var L=Object.assign({},r,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),E=Object.assign({},L,{useTLS:!0}),N=Object.assign({},r,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),H={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new us({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),X=new us({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),pe=k("ws","ws",3,L,Z),zi=k("wss","ws",3,E,Z),hc=k("sockjs","sockjs",1,N),fs=k("xhr_streaming","xhr_streaming",1,N,X),mc=k("xdr_streaming","xdr_streaming",1,N,X),gs=k("xhr_polling","xhr_polling",1,N),pc=k("xdr_polling","xdr_polling",1,N),ys=new Ln([pe],H),vc=new Ln([zi],H),bc=new Ln([hc],H),Cs=new Ln([new ai(ri(fs),fs,mc)],H),ks=new Ln([new ai(ri(gs),gs,pc)],H),ws=new Ln([new ai(ri(Cs),new xt([Cs,new Ki(ks,{delay:4e3})]),ks)],H),It=new ai(ri(ws),ws,bc),Nt;return r.useTLS?Nt=new xt([ys,new Ki(It,{delay:2e3})]):Nt=new xt([ys,new Ki(vc,{delay:2e3}),new Ki(It,{delay:5e3})]),new pd(new fd(new ai(ri(pe),Nt,It)),b,{ttl:18e5,timeline:r.timeline,useTLS:r.useTLS})},yd=gd,Cd=function(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),g.load(u.hooks.file,{useTLS:u.options.useTLS},function(r,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(r&&u.onError(r),u.onClose(),c(!1))})):u.onClose()},kd={getRequest:function(u){var r=new window.XDomainRequest;return r.ontimeout=function(){u.emit("error",new A),u.close()},r.onerror=function(c){u.emit("error",c),u.close()},r.onprogress=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText)},r.onload=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText),u.emit("finished",200),u.close()},r},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},wd=kd;const Sd=256*1024;class _d extends tn{constructor(r,c,b){super(),this.hooks=r,this.method=c,this.url=b}start(r){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},O.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(r)}close(){this.unloader&&(O.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(r,c){for(;;){var b=this.advanceBuffer(c);if(b)this.emit("chunk",{status:r,data:b});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(r){var c=r.slice(this.position),b=c.indexOf(`
|
|
954
|
-
`);return b!==-1?(this.position+=b+1,c.slice(0,b)):null}isBufferTooLong(r){return this.position===r.length&&r.length>Sd}}var Tt;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Tt||(Tt={}));var Tn=Tt,Md=1;class Ad{constructor(r,c){this.hooks=r,this.session=ps(1e3)+"/"+Ed(8),this.location=xd(c),this.readyState=Tn.CONNECTING,this.openStream()}send(r){return this.sendRaw(JSON.stringify([r]))}ping(){this.hooks.sendHeartbeat(this)}close(r,c){this.onClose(r,c,!0)}sendRaw(r){if(this.readyState===Tn.OPEN)try{return O.createSocketRequest("POST",ms(Ld(this.location,this.session))).start(r),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(r,c,b){this.closeStream(),this.readyState=Tn.CLOSED,this.onclose&&this.onclose({code:r,reason:c,wasClean:b})}onChunk(r){if(r.status===200){this.readyState===Tn.OPEN&&this.onActivity();var c,b=r.data.slice(0,1);switch(b){case"o":c=JSON.parse(r.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(r.data.slice(1)||"[]");for(var k=0;k<c.length;k++)this.onEvent(c[k]);break;case"m":c=JSON.parse(r.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(r.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(r){this.readyState===Tn.CONNECTING?(r&&r.hostname&&(this.location.base=Td(this.location.base,r.hostname)),this.readyState=Tn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(r){this.readyState===Tn.OPEN&&this.onmessage&&this.onmessage({data:r})}onActivity(){this.onactivity&&this.onactivity()}onError(r){this.onerror&&this.onerror(r)}openStream(){this.stream=O.createSocketRequest("POST",ms(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",r=>{this.onChunk(r)}),this.stream.bind("finished",r=>{this.hooks.onFinished(this,r)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(r){re.defer(()=>{this.onError(r),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function xd(u){var r=/([^\?]*)\/*(\??.*)/.exec(u);return{base:r[1],queryString:r[2]}}function Ld(u,r){return u.base+"/"+r+"/xhr_send"}function ms(u){var r=u.indexOf("?")===-1?"?":"&";return u+r+"t="+ +new Date+"&n="+Md++}function Td(u,r){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+r+c[3]}function ps(u){return O.randomInt(u)}function Ed(u){for(var r=[],c=0;c<u;c++)r.push(ps(32).toString(32));return r.join("")}var Pd=Ad,Id={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Nd=Id,Bd={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){r===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Dd=Bd,Rd={getRequest:function(u){var r=O.getXHRAPI(),c=new r;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Hd=Rd,Od={createStreamingSocket(u){return this.createSocket(Nd,u)},createPollingSocket(u){return this.createSocket(Dd,u)},createSocket(u,r){return new Pd(u,r)},createXHR(u,r){return this.createRequest(Hd,u,r)},createRequest(u,r,c){return new _d(u,r,c)}},vs=Od;vs.createXDR=function(u,r){return this.createRequest(wd,u,r)};var Ud=vs,Vd={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:a,DependenciesReceivers:p,getDefaultStrategy:yd,Transports:Jl,transportConnectionInitializer:Cd,HTTPFactory:Ud,TimelineTransport:Rl,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var r=()=>{this.onDocumentBody(u.ready)};window.JSON?r():g.load("json2",{},r)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:Pl}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,r){return new Nl(u,r)},createScriptRequest(u){return new Il(u)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Yl},createWebSocket(u){var r=this.getWebSocketAPI();return new r(u)},createSocketRequest(u,r){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,r);if(this.isXDRSupported(r.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,r);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var r=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===r},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}},O=Vd,Et;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(Et||(Et={}));var Gi=Et;class jd{constructor(r,c,b){this.key=r,this.session=c,this.events=[],this.options=b||{},this.sent=0,this.uniqueID=0}log(r,c){r<=this.options.level&&(this.events.push(fe({},c,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(r){this.log(Gi.ERROR,r)}info(r){this.log(Gi.INFO,r)}debug(r){this.log(Gi.DEBUG,r)}isEmpty(){return this.events.length===0}send(r,c){var b=fe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],r(b,(k,L)=>{k||this.sent++,c&&c(k,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Kd{constructor(r,c,b,k){this.name=r,this.priority=c,this.transport=b,this.options=k||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(r,c){if(this.isSupported()){if(this.priority<r)return bs(new _,c)}else return bs(new z,c);var b=!1,k=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,E=function(){k.unbind("initialized",E),k.connect()},N=function(){L=on.createHandshake(k,function(pe){b=!0,X(),c(null,pe)})},H=function(pe){X(),c(pe)},Z=function(){X();var pe;pe=An(k),c(new T(pe))},X=function(){k.unbind("initialized",E),k.unbind("open",N),k.unbind("error",H),k.unbind("closed",Z)};return k.bind("initialized",E),k.bind("open",N),k.bind("error",H),k.bind("closed",Z),k.initialize(),{abort:()=>{b||(X(),L?L.close():k.close())},forceMinPriority:pe=>{b||this.priority<pe&&(L?L.close():k.close())}}}}function bs(u,r){return re.defer(function(){r(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Gd}=O;var zd=function(u,r,c,b,k,L){var E=Gd[c];if(!E)throw new K(c);var N=(!u.enabledTransports||Pe(u.enabledTransports,r)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,r)===-1),H;return N?(k=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},k),H=new Kd(r,b,L?L.getAssistant(E):E,k)):H=Fd,H},Fd={isSupported:function(){return!1},connect:function(u,r){var c=re.defer(function(){r(new z)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function qd(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&se.warn("The disableStats option is deprecated in favor of enableStats")}const Wd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let k=r.paramsProvider();for(var b in k)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(k[b])}return c};var Zd=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Wd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.UserAuthentication,c)}};const Jd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let k=r.paramsProvider();for(var b in k)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(k[b])}return c};var $d=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Jd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.ChannelAuthorization,c)}};const Yd=(u,r,c)=>{const b={authTransport:r.transport,authEndpoint:r.endpoint,auth:{params:r.params,headers:r.headers}};return(k,L)=>{const E=u.channel(k.channelName);c(E,b).authorize(k.socketId,L)}};function Qd(u,r){let c={activityTimeout:u.activityTimeout||d.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||d.httpPath,httpPort:u.httpPort||d.httpPort,httpsPort:u.httpsPort||d.httpsPort,pongTimeout:u.pongTimeout||d.pongTimeout,statsHost:u.statsHost||d.stats_host,unavailableTimeout:u.unavailableTimeout||d.unavailableTimeout,wsPath:u.wsPath||d.wsPath,wsPort:u.wsPort||d.wsPort,wssPort:u.wssPort||d.wssPort,enableStats:tc(u),httpHost:Xd(u),useTLS:ic(u),wsHost:ec(u),userAuthenticator:oc(u),channelAuthorizer:ac(u,r)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function Xd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:d.httpHost}function ec(u){return u.wsHost?u.wsHost:nc(u.cluster)}function nc(u){return`ws-${u}.pusher.com`}function ic(u){return O.getProtocol()==="https:"?!0:u.forceTLS!==!1}function tc(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function oc(u){const r=Object.assign(Object.assign({},d.userAuthentication),u.userAuthentication);return"customHandler"in r&&r.customHandler!=null?r.customHandler:Zd(r)}function sc(u,r){let c;return"channelAuthorization"in u?c=Object.assign(Object.assign({},d.channelAuthorization),u.channelAuthorization):(c={transport:u.authTransport||d.authTransport,endpoint:u.authEndpoint||d.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u&&(c.customHandler=Yd(r,c,u.authorizer))),c}function ac(u,r){const c=sc(u,r);return"customHandler"in c&&c.customHandler!=null?c.customHandler:$d(c)}class rc extends tn{constructor(r){super(function(c,b){se.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=r,this.bindWatchlistInternalEvent()}handleEvent(r){r.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",r=>{var c=r.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(r)})}}function lc(){let u,r;return{promise:new Promise((b,k)=>{u=b,r=k}),resolve:u,reject:r}}var dc=lc;class cc extends tn{constructor(r){super(function(c,b){se.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,b)=>{if(c){se.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:b.auth,user_data:b.user_data})},this.pusher=r,this.pusher.connection.bind("state_change",({previous:c,current:b})=>{c!=="connected"&&b==="connected"&&this._signin(),c==="connected"&&b!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new rc(r),this.pusher.connection.bind("message",c=>{var b=c.event;b==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(r){try{this.user_data=JSON.parse(r.user_data)}catch{se.error(`Failed parsing user data after signin: ${r.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){se.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const r=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new _t(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,b)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,b)}),r(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:r,resolve:c,reject:b}=dc();r.done=!1;const k=()=>{r.done=!0};r.then(k).catch(k),this.signinDonePromise=r,this._signinDoneResolve=c}}class ye{static ready(){ye.isReady=!0;for(var r=0,c=ye.instances.length;r<c;r++)ye.instances[r].connect()}static getClientFeatures(){return We($({ws:O.Transports.ws},function(r){return r.isSupported({})}))}constructor(r,c){uc(r),qd(c),this.key=r,this.config=Qd(c,this),this.channels=on.createChannels(),this.global_emitter=new tn,this.sessionID=O.randomInt(1e9),this.timeline=new jd(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Gi.INFO,version:d.VERSION}),this.config.enableStats&&(this.timelineSender=on.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+O.TimelineTransport.name}));var b=k=>O.getDefaultStrategy(this.config,k,zd);this.connection=on.createConnectionManager(this.key,{getStrategy:b,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",k=>{var L=k.event,E=L.indexOf("pusher_internal:")===0;if(k.channel){var N=this.channel(k.channel);N&&N.handleEvent(k)}E||this.global_emitter.emit(k.event,k.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",k=>{se.warn(k)}),ye.instances.push(this),this.timeline.info({instances:ye.instances.length}),this.user=new cc(this),ye.isReady&&this.connect()}channel(r){return this.channels.find(r)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var r=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new nn(6e4,function(){c.send(r)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(r,c,b){return this.global_emitter.bind(r,c,b),this}unbind(r,c,b){return this.global_emitter.unbind(r,c,b),this}bind_global(r){return this.global_emitter.bind_global(r),this}unbind_global(r){return this.global_emitter.unbind_global(r),this}unbind_all(r){return this.global_emitter.unbind_all(),this}subscribeAll(){var r;for(r in this.channels.channels)this.channels.channels.hasOwnProperty(r)&&this.subscribe(r)}subscribe(r){var c=this.channels.add(r,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(r){var c=this.channels.find(r);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(r),c&&c.subscribed&&c.unsubscribe())}send_event(r,c,b){return this.connection.send_event(r,c,b)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=O,ye.ScriptReceivers=O.ScriptReceivers,ye.DependenciesReceivers=O.DependenciesReceivers,ye.auth_callbacks=O.auth_callbacks;var Pt=t.default=ye;function uc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}O.setup(ye)}])})})(Zo);var Zr=Zo.exports;const Jr=Wr(Zr);class Jo{constructor(e){h(this,"container");h(this,"onAction");h(this,"onFail");h(this,"initialTime");h(this,"timeLeft");h(this,"timerId");h(this,"payment");this.container=e.container,this.onAction=e.onAction,this.onFail=e.onFail,this.initialTime=1800,this.timeLeft=this.initialTime,this.timerId=null}attachListener(){const e=this.container.querySelector("#transfer-acn"),i=this.container.querySelector("#copy-acn"),t=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),s=this.container.querySelector("#copy-amount"),a=this.container.querySelector("#amount-tooltip"),l=this.container.querySelector("#transfer-button");i&&e&&i.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started"}),t&&this.copyToClipboard(e.innerHTML,t)}),s&&o&&s.addEventListener("click",()=>{P.track("copy_transferAmount",{payment_method:"Transfer"}),a&&this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),a)}),l&&l.addEventListener("click",()=>{this.onAction(5)})}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const i=this.container.querySelector("#time-left");i&&(i.innerHTML=zn(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){var g,f,y,w,C,S;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-amount"),t=this.container.querySelector("#transfer-bank"),o=this.container.querySelector("#account-name"),s=this.container.querySelector("#transfer-acn"),a=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",d=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(i&&(i.innerHTML=`${d} ${xe(this.payment.totalTaxAmount?this.payment.totalLocalAmount:l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(w=this.payment)==null?void 0:w.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(C=this.payment.bankDetails)==null?void 0:C.bankName),o&&this.payment.bankDetails&&(o.innerHTML=(S=this.payment.bankDetails)==null?void 0:S.accountName),s&&this.payment.bankDetails&&(s.innerHTML=this.payment.bankDetails.accountNumber),a&&(a.innerHTML=zn(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const M="45654f3ce4c9512ea9a4",A="us2";var v=new Jr(M,{cluster:A}),p=v.subscribe(e.reference);p.bind("payment_status",_=>{_.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),_!=null&&_.redirectUrl&&setTimeout(()=>{const T=new URL(_.redirectUrl);T.searchParams.append("status",_.status),T.searchParams.append("reference",_.reference),window.location.href=T.toString()},1800)):_.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return qr}}const $r=`<div id="trasferConfirmationProgress">
|
|
953
|
+
*/(function(n,e){(function(t,o){n.exports=o()})(window,function(){return function(i){var t={};function o(s){if(t[s])return t[s].exports;var a=t[s]={i:s,l:!1,exports:{}};return i[s].call(a.exports,a,a.exports,o),a.l=!0,a.exports}return o.m=i,o.c=t,o.d=function(s,a,l){o.o(s,a)||Object.defineProperty(s,a,{enumerable:!0,get:l})},o.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.t=function(s,a){if(a&1&&(s=o(s)),a&8||a&4&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),a&2&&typeof s!="string")for(var d in s)o.d(l,d,(function(v){return s[v]}).bind(null,d));return l},o.n=function(s){var a=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(a,"a",a),a},o.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var C=function(S,M){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,_){A.__proto__=_}||function(A,_){for(var T in _)_.hasOwnProperty(T)&&(A[T]=_[T])},C(S,M)};return function(S,M){C(S,M);function A(){this.constructor=S}S.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=256,l=function(){function C(S){S===void 0&&(S="="),this._paddingCharacter=S}return C.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},C.prototype.encode=function(S){for(var M="",A=0;A<S.length-2;A+=3){var _=S[A]<<16|S[A+1]<<8|S[A+2];M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),M+=this._encodeByte(_>>>1*6&63),M+=this._encodeByte(_>>>0*6&63)}var T=S.length-A;if(T>0){var _=S[A]<<16|(T===2?S[A+1]<<8:0);M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),T===2?M+=this._encodeByte(_>>>1*6&63):M+=this._paddingCharacter||"",M+=this._paddingCharacter||""}return M},C.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},C.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},C.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var M=this._getPaddingLength(S),A=S.length-M,_=new Uint8Array(this.maxDecodedLength(A)),T=0,I=0,K=0,z=0,U=0,G=0,oe=0;I<A-4;I+=4)z=this._decodeChar(S.charCodeAt(I+0)),U=this._decodeChar(S.charCodeAt(I+1)),G=this._decodeChar(S.charCodeAt(I+2)),oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=z<<2|U>>>4,_[T++]=U<<4|G>>>2,_[T++]=G<<6|oe,K|=z&a,K|=U&a,K|=G&a,K|=oe&a;if(I<A-1&&(z=this._decodeChar(S.charCodeAt(I)),U=this._decodeChar(S.charCodeAt(I+1)),_[T++]=z<<2|U>>>4,K|=z&a,K|=U&a),I<A-2&&(G=this._decodeChar(S.charCodeAt(I+2)),_[T++]=U<<4|G>>>2,K|=G&a),I<A-3&&(oe=this._decodeChar(S.charCodeAt(I+3)),_[T++]=G<<6|oe,K|=oe&a),K!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},C.prototype._encodeByte=function(S){var M=S;return M+=65,M+=25-S>>>8&6,M+=51-S>>>8&-75,M+=61-S>>>8&-15,M+=62-S>>>8&3,String.fromCharCode(M)},C.prototype._decodeChar=function(S){var M=a;return M+=(42-S&S-44)>>>8&-a+S-43+62,M+=(46-S&S-48)>>>8&-a+S-47+63,M+=(47-S&S-58)>>>8&-a+S-48+52,M+=(64-S&S-91)>>>8&-a+S-65+0,M+=(96-S&S-123)>>>8&-a+S-97+26,M},C.prototype._getPaddingLength=function(S){var M=0;if(this._paddingCharacter){for(var A=S.length-1;A>=0&&S[A]===this._paddingCharacter;A--)M++;if(S.length<4||M>2)throw new Error("Base64Coder: incorrect padding")}return M},C}();t.Coder=l;var d=new l;function v(C){return d.encode(C)}t.encode=v;function p(C){return d.decode(C)}t.decode=p;var g=function(C){s(S,C);function S(){return C!==null&&C.apply(this,arguments)||this}return S.prototype._encodeByte=function(M){var A=M;return A+=65,A+=25-M>>>8&6,A+=51-M>>>8&-75,A+=61-M>>>8&-13,A+=62-M>>>8&49,String.fromCharCode(A)},S.prototype._decodeChar=function(M){var A=a;return A+=(44-M&M-46)>>>8&-a+M-45+62,A+=(94-M&M-96)>>>8&-a+M-95+63,A+=(47-M&M-58)>>>8&-a+M-48+52,A+=(64-M&M-91)>>>8&-a+M-65+0,A+=(96-M&M-123)>>>8&-a+M-97+26,A},S}(l);t.URLSafeCoder=g;var f=new g;function y(C){return f.encode(C)}t.encodeURLSafe=y;function w(C){return f.decode(C)}t.decodeURLSafe=w,t.encodedLength=function(C){return d.encodedLength(C)},t.maxDecodedLength=function(C){return d.maxDecodedLength(C)},t.decodedLength=function(C){return d.decodedLength(C)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",a="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(d(p)),f=0,y=0;y<p.length;y++){var w=p.charCodeAt(y);w<128?g[f++]=w:w<2048?(g[f++]=192|w>>6,g[f++]=128|w&63):w<55296?(g[f++]=224|w>>12,g[f++]=128|w>>6&63,g[f++]=128|w&63):(y++,w=(w&1023)<<10,w|=p.charCodeAt(y)&1023,w+=65536,g[f++]=240|w>>18,g[f++]=128|w>>12&63,g[f++]=128|w>>6&63,g[f++]=128|w&63)}return g}t.encode=l;function d(p){for(var g=0,f=0;f<p.length;f++){var y=p.charCodeAt(f);if(y<128)g+=1;else if(y<2048)g+=2;else if(y<55296)g+=3;else if(y<=57343){if(f>=p.length-1)throw new Error(s);f++,g+=4}else throw new Error(s)}return g}t.encodedLength=d;function v(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var w=void 0;if(y<224){if(f>=p.length)throw new Error(a);var C=p[++f];if((C&192)!==128)throw new Error(a);y=(y&31)<<6|C&63,w=128}else if(y<240){if(f>=p.length-1)throw new Error(a);var C=p[++f],S=p[++f];if((C&192)!==128||(S&192)!==128)throw new Error(a);y=(y&15)<<12|(C&63)<<6|S&63,w=2048}else if(y<248){if(f>=p.length-2)throw new Error(a);var C=p[++f],S=p[++f],M=p[++f];if((C&192)!==128||(S&192)!==128||(M&192)!==128)throw new Error(a);y=(y&15)<<18|(C&63)<<12|(S&63)<<6|M&63,w=65536}else throw new Error(a);if(y<w||y>=55296&&y<=57343)throw new Error(a);if(y>=65536){if(y>1114111)throw new Error(a);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=v},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(r,c){this.lastId=0,this.prefix=r,this.name=c}create(r){this.lastId++;var c=this.lastId,b=this.prefix+c,k=this.name+"["+c+"]",L=!1,E=function(){L||(r.apply(null,arguments),L=!0)};return this[c]=E,{number:c,id:b,name:k,callback:E}}remove(r){delete this[r.number]}}var a=new s("_pusher_script_","Pusher.ScriptReceivers"),l={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},d=l;class v{constructor(r){this.options=r,this.receivers=r.receivers||a,this.loading={}}load(r,c,b){var k=this;if(k.loading[r]&&k.loading[r].length>0)k.loading[r].push(b);else{k.loading[r]=[b];var L=O.createScriptRequest(k.getPath(r,c)),E=k.receivers.create(function(N){if(k.receivers.remove(E),k.loading[r]){var H=k.loading[r];delete k.loading[r];for(var Z=function(pe){pe||L.cleanup()},X=0;X<H.length;X++)H[X](N,Z)}});L.send(E)}}getRoot(r){var c,b=O.getDocument().location.protocol;return r&&r.useTLS||b==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(r,c){return this.getRoot(c)+"/"+r+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new v({cdn_http:d.cdn_http,cdn_https:d.cdn_https,version:d.VERSION,suffix:d.dependency_suffix,receivers:p});const f={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var w={buildLogSuffix:function(u){const r="See:",c=f.urls[u];if(!c)return"";let b;return c.fullUrl?b=c.fullUrl:c.path&&(b=f.baseUrl+c.path),b?`${r} ${b}`:""}},C;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(C||(C={}));class S extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class T extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class I extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class z extends Error{constructor(r){super(r),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(r,c){super(c),this.status=r,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,r,c,b,k){const L=O.createXHR();L.open("POST",c.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)L.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let N=c.headersProvider();for(var E in N)L.setRequestHeader(E,N[E])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let N,H=!1;try{N=JSON.parse(L.responseText),H=!0}catch{k(new U(200,`JSON returned from ${b.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}H&&k(null,N)}else{let N="";switch(b){case C.UserAuthentication:N=w.buildLogSuffix("authenticationEndpoint");break;case C.ChannelAuthorization:N=`Clients must be authorized to join private or presence channels. ${w.buildLogSuffix("authorizationEndpoint")}`;break}k(new U(L.status,`Unable to retrieve auth string from ${b.toString()} endpoint - received status: ${L.status} from ${c.endpoint}. ${N}`),null)}},L.send(r),L};function ge(u){return en(Te(u))}var V=String.fromCharCode,_e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var r=u.charCodeAt(0);return r<128?u:r<2048?V(192|r>>>6)+V(128|r&63):V(224|r>>>12&15)+V(128|r>>>6&63)+V(128|r&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Me=function(u){var r=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),b=[_e.charAt(c>>>18),_e.charAt(c>>>12&63),r>=2?"=":_e.charAt(c>>>6&63),r>=1?"=":_e.charAt(c&63)];return b.join("")},en=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Me)};class vn{constructor(r,c,b,k){this.clear=c,this.timer=r(()=>{this.timer&&(this.timer=k(this.timer))},b)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var nn=vn;function _n(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends nn{constructor(r,c){super(setTimeout,_n,r,function(b){return c(),null})}}class tn extends nn{constructor(r,c){super(setInterval,bn,r,function(b){return c(),b})}}var Mn={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...r){var c=Array.prototype.slice.call(arguments,1);return function(b){return b[u].apply(b,c.concat(arguments))}}},re=Mn;function fe(u,...r){for(var c=0;c<r.length;c++){var b=r[c];for(var k in b)b[k]&&b[k].constructor&&b[k].constructor===Object?u[k]=fe(u[k]||{},b[k]):u[k]=b[k]}return u}function He(){for(var u=["Pusher"],r=0;r<arguments.length;r++)typeof arguments[r]=="string"?u.push(arguments[r]):u.push(An(arguments[r]));return u.join(" : ")}function Pe(u,r){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(r);for(var b=0,k=u.length;b<k;b++)if(u[b]===r)return b;return-1}function ke(u,r){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&r(u[c],c,u)}function We(u){var r=[];return ke(u,function(c,b){r.push(b)}),r}function B(u){var r=[];return ke(u,function(c){r.push(c)}),r}function he(u,r,c){for(var b=0;b<u.length;b++)r.call(c||window,u[b],b,u)}function Q(u,r){for(var c=[],b=0;b<u.length;b++)c.push(r(u[b],b,u,c));return c}function me(u,r){var c={};return ke(u,function(b,k){c[k]=r(b)}),c}function Ie(u,r){r=r||function(k){return!!k};for(var c=[],b=0;b<u.length;b++)r(u[b],b,u,c)&&c.push(u[b]);return c}function $(u,r){var c={};return ke(u,function(b,k){(r&&r(b,k,u,c)||b)&&(c[k]=b)}),c}function fn(u){var r=[];return ke(u,function(c,b){r.push([b,c])}),r}function oi(u,r){for(var c=0;c<u.length;c++)if(r(u[c],c,u))return!0;return!1}function Hi(u,r){for(var c=0;c<u.length;c++)if(!r(u[c],c,u))return!1;return!0}function Oi(u){return me(u,function(r){return typeof r=="object"&&(r=An(r)),encodeURIComponent(ge(r.toString()))})}function Ui(u){var r=$(u,function(b){return b!==void 0}),c=Q(fn(Oi(r)),re.method("join","=")).join("&");return c}function Vi(u){var r=[],c=[];return function b(k,L){var E,N,H;switch(typeof k){case"object":if(!k)return null;for(E=0;E<r.length;E+=1)if(r[E]===k)return{$ref:c[E]};if(r.push(k),c.push(L),Object.prototype.toString.apply(k)==="[object Array]")for(H=[],E=0;E<k.length;E+=1)H[E]=b(k[E],L+"["+E+"]");else{H={};for(N in k)Object.prototype.hasOwnProperty.call(k,N)&&(H[N]=b(k[N],L+"["+JSON.stringify(N)+"]"))}return H;case"number":case"string":case"boolean":return k}}(u,"$")}function An(u){try{return JSON.stringify(u)}catch{return JSON.stringify(Vi(u))}}class si{constructor(){this.globalLog=r=>{window.console&&window.console.log&&window.console.log(r)}}debug(...r){this.log(this.globalLog,r)}warn(...r){this.log(this.globalLogWarn,r)}error(...r){this.log(this.globalLogError,r)}globalLogWarn(r){window.console&&window.console.warn?window.console.warn(r):this.globalLog(r)}globalLogError(r){window.console&&window.console.error?window.console.error(r):this.globalLogWarn(r)}log(r,...c){var b=He.apply(this,arguments);Pt.log?Pt.log(b):Pt.logToConsole&&r.bind(this)(b)}}var se=new si,El=function(u,r,c,b,k){(c.headers!==void 0||c.headersProvider!=null)&&se.warn(`To send headers with the ${b.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var E=u.getDocument(),N=E.createElement("script");u.auth_callbacks[L]=function(X){k(null,X)};var H="Pusher.auth_callbacks['"+L+"']";N.src=c.endpoint+"?callback="+encodeURIComponent(H)+"&"+r;var Z=E.getElementsByTagName("head")[0]||E.documentElement;Z.insertBefore(N,Z.firstChild)},Pl=El;class Il{constructor(r){this.src=r}send(r){var c=this,b="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=r.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){r.callback(b)},c.script.onload=function(){r.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&r.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=r.id+"_error",c.errorScript.text=r.name+"('"+b+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var k=document.getElementsByTagName("head")[0];k.insertBefore(c.script,k.firstChild),c.errorScript&&k.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Nl{constructor(r,c){this.url=r,this.data=c}send(r){if(!this.request){var c=Ui(this.data),b=this.url+"/"+r.number+"?"+c;this.request=O.createScriptRequest(b),this.request.send(r)}}cleanup(){this.request&&this.request.cleanup()}}var Bl=function(u,r){return function(c,b){var k="http"+(r?"s":"")+"://",L=k+(u.host||u.options.host)+u.options.path,E=O.createJSONPRequest(L,c),N=O.ScriptReceivers.create(function(H,Z){a.remove(N),E.cleanup(),Z&&Z.host&&(u.host=Z.host),b&&b(H,Z)});E.send(N)}},Dl={name:"jsonp",getAgent:Bl},Rl=Dl;function kt(u,r,c){var b=u+(r.useTLS?"s":""),k=r.useTLS?r.hostTLS:r.hostNonTLS;return b+"://"+k+c}function wt(u,r){var c="/app/"+u,b="?protocol="+d.PROTOCOL+"&client=js&version="+d.VERSION+(r?"&"+r:"");return c+b}var Hl={getInitial:function(u,r){var c=(r.httpPath||"")+wt(u,"flash=false");return kt("ws",r,c)}},Ol={getInitial:function(u,r){var c=(r.httpPath||"/pusher")+wt(u);return kt("http",r,c)}},Ul={getInitial:function(u,r){return kt("http",r,r.httpPath||"/pusher")},getPath:function(u,r){return wt(u)}};class Vl{constructor(){this._callbacks={}}get(r){return this._callbacks[St(r)]}add(r,c,b){var k=St(r);this._callbacks[k]=this._callbacks[k]||[],this._callbacks[k].push({fn:c,context:b})}remove(r,c,b){if(!r&&!c&&!b){this._callbacks={};return}var k=r?[St(r)]:We(this._callbacks);c||b?this.removeCallback(k,c,b):this.removeAllCallbacks(k)}removeCallback(r,c,b){he(r,function(k){this._callbacks[k]=Ie(this._callbacks[k]||[],function(L){return c&&c!==L.fn||b&&b!==L.context}),this._callbacks[k].length===0&&delete this._callbacks[k]},this)}removeAllCallbacks(r){he(r,function(c){delete this._callbacks[c]},this)}}function St(u){return"_"+u}class on{constructor(r){this.callbacks=new Vl,this.global_callbacks=[],this.failThrough=r}bind(r,c,b){return this.callbacks.add(r,c,b),this}bind_global(r){return this.global_callbacks.push(r),this}unbind(r,c,b){return this.callbacks.remove(r,c,b),this}unbind_global(r){return r?(this.global_callbacks=Ie(this.global_callbacks||[],c=>c!==r),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(r,c,b){for(var k=0;k<this.global_callbacks.length;k++)this.global_callbacks[k](r,c);var L=this.callbacks.get(r),E=[];if(b?E.push(c,b):c&&E.push(c),L&&L.length>0)for(var k=0;k<L.length;k++)L[k].fn.apply(L[k].context||window,E);else this.failThrough&&this.failThrough(r,c);return this}}class jl extends on{constructor(r,c,b,k,L){super(),this.initialize=O.transportConnectionInitializer,this.hooks=r,this.name=c,this.priority=b,this.key=k,this.options=L,this.state="new",this.timeline=L.timeline,this.activityTimeout=L.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var r=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(r,this.options)}catch(c){return re.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:r}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(r){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(r)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(r){this.emit("error",{type:"WebSocketError",error:r}),this.timeline.error(this.buildTimelineMessage({error:r.toString()}))}onClose(r){r?this.changeState("closed",{code:r.code,reason:r.reason,wasClean:r.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(r){this.emit("message",r)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=r=>{this.onError(r)},this.socket.onclose=r=>{this.onClose(r)},this.socket.onmessage=r=>{this.onMessage(r)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(r,c){this.state=r,this.timeline.info(this.buildTimelineMessage({state:r,params:c})),this.emit(r,c)}buildTimelineMessage(r){return fe({cid:this.id},r)}}class Gn{constructor(r){this.hooks=r}isSupported(r){return this.hooks.isSupported(r)}createConnection(r,c,b,k){return new jl(this.hooks,r,c,b,k)}}var Kl=new Gn({urls:Hl,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!O.getWebSocketAPI()},isSupported:function(){return!!O.getWebSocketAPI()},getSocket:function(u){return O.createWebSocket(u)}}),ss={urls:Ol,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},as=fe({getSocket:function(u){return O.HTTPFactory.createStreamingSocket(u)}},ss),rs=fe({getSocket:function(u){return O.HTTPFactory.createPollingSocket(u)}},ss),ls={isSupported:function(){return O.isXHRSupported()}},Gl=new Gn(fe({},as,ls)),zl=new Gn(fe({},rs,ls)),Fl={ws:Kl,xhr_streaming:Gl,xhr_polling:zl},ji=Fl,ql=new Gn({file:"sockjs",urls:Ul,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,r){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:r.useTLS}),ignore_null_origin:r.ignoreNullOrigin})},beforeOpen:function(u,r){u.send(JSON.stringify({path:r}))}}),ds={isSupported:function(u){var r=O.isXDRSupported(u.useTLS);return r}},Wl=new Gn(fe({},as,ds)),Zl=new Gn(fe({},rs,ds));ji.xdr_streaming=Wl,ji.xdr_polling=Zl,ji.sockjs=ql;var Jl=ji;class $l extends on{constructor(){super();var r=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){r.emit("online")},!1),window.addEventListener("offline",function(){r.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Yl=new $l;class Ql{constructor(r,c,b){this.manager=r,this.transport=c,this.minPingDelay=b.minPingDelay,this.maxPingDelay=b.maxPingDelay,this.pingDelay=void 0}createConnection(r,c,b,k){k=fe({},k,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(r,c,b,k),E=null,N=function(){L.unbind("open",N),L.bind("closed",H),E=re.now()},H=Z=>{if(L.unbind("closed",H),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&E){var X=re.now()-E;X<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(X/2,this.minPingDelay))}};return L.bind("open",N),L}isSupported(r){return this.manager.isAlive()&&this.transport.isSupported(r)}}const cs={decodeMessage:function(u){try{var r=JSON.parse(u.data),c=r.data;if(typeof c=="string")try{c=JSON.parse(r.data)}catch{}var b={event:r.event,channel:r.channel,data:c};return r.user_id&&(b.user_id=r.user_id),b}catch(k){throw{type:"MessageParseError",error:k,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var r=cs.decodeMessage(u);if(r.event==="pusher:connection_established"){if(!r.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:r.data.socket_id,activityTimeout:r.data.activity_timeout*1e3}}else{if(r.event==="pusher:error")return{action:this.getCloseAction(r.data),error:this.getCloseError(r.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}};var xn=cs;class Xl extends on{constructor(r,c){super(),this.id=r,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(r){return this.transport.send(r)}send_event(r,c,b){var k={event:r,data:c};return b&&(k.channel=b),se.debug("Event sent",k),this.send(xn.encodeMessage(k))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var r={message:b=>{var k;try{k=xn.decodeMessage(b)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:b.data})}if(k!==void 0){switch(se.debug("Event recd",k),k.event){case"pusher:error":this.emit("error",{type:"PusherError",data:k.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",k)}},activity:()=>{this.emit("activity")},error:b=>{this.emit("error",b)},closed:b=>{c(),b&&b.code&&this.handleCloseEvent(b),this.transport=null,this.emit("closed")}},c=()=>{ke(r,(b,k)=>{this.transport.unbind(k,b)})};ke(r,(b,k)=>{this.transport.bind(k,b)})}handleCloseEvent(r){var c=xn.getCloseAction(r),b=xn.getCloseError(r);b&&this.emit("error",b),c&&this.emit(c,{action:c,error:b})}}class ed{constructor(r,c){this.transport=r,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=r=>{this.unbindListeners();var c;try{c=xn.processHandshake(r)}catch(b){this.finish("error",{error:b}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new Xl(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=r=>{this.unbindListeners();var c=xn.getCloseAction(r)||"backoff",b=xn.getCloseError(r);this.finish(c,{error:b})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(r,c){this.callback(fe({transport:this.transport,action:r},c))}}class nd{constructor(r,c){this.timeline=r,this.options=c||{}}send(r,c){this.timeline.isEmpty()||this.timeline.send(O.TimelineTransport.getAgent(this,r),c)}}class _t extends on{constructor(r,c){super(function(b,k){se.debug("No callbacks on "+r+" for "+b)}),this.name=r,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(r,c){return c(null,{auth:""})}trigger(r,c){if(r.indexOf("client-")!==0)throw new S("Event '"+r+"' does not start with 'client-'");if(!this.subscribed){var b=w.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${b}`)}return this.pusher.send_event(r,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(r){var c=r.event,b=r.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(r);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(r);else if(c.indexOf("pusher_internal:")!==0){var k={};this.emit(c,b,k)}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",r.data)}handleSubscriptionCountEvent(r){r.data.subscription_count&&(this.subscriptionCount=r.data.subscription_count),this.emit("pusher:subscription_count",r.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(r,c)=>{r?(this.subscriptionPending=!1,se.error(r.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:r.message},r instanceof U?{status:r.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class Mt extends _t{authorize(r,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:r},c)}}class id{constructor(){this.reset()}get(r){return Object.prototype.hasOwnProperty.call(this.members,r)?{id:r,info:this.members[r]}:null}each(r){ke(this.members,(c,b)=>{r(this.get(b))})}setMyID(r){this.myID=r}onSubscription(r){this.members=r.presence.hash,this.count=r.presence.count,this.me=this.get(this.myID)}addMember(r){return this.get(r.user_id)===null&&this.count++,this.members[r.user_id]=r.user_info,this.get(r.user_id)}removeMember(r){var c=this.get(r.user_id);return c&&(delete this.members[r.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var td=function(u,r,c,b){function k(L){return L instanceof c?L:new c(function(E){E(L)})}return new(c||(c=Promise))(function(L,E){function N(X){try{Z(b.next(X))}catch(pe){E(pe)}}function H(X){try{Z(b.throw(X))}catch(pe){E(pe)}}function Z(X){X.done?L(X.value):k(X.value).then(N,H)}Z((b=b.apply(u,r||[])).next())})};class od extends Mt{constructor(r,c){super(r,c),this.members=new id}authorize(r,c){super.authorize(r,(b,k)=>td(this,void 0,void 0,function*(){if(!b)if(k=k,k.channel_data!=null){var L=JSON.parse(k.channel_data);this.members.setMyID(L.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=w.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(b,k)}))}handleEvent(r){var c=r.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(r);else{var b=r.data,k={};r.user_id&&(k.user_id=r.user_id),this.emit(c,b,k)}}handleInternalEvent(r){var c=r.event,b=r.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(r);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(r);break;case"pusher_internal:member_added":var k=this.members.addMember(b);this.emit("pusher:member_added",k);break;case"pusher_internal:member_removed":var L=this.members.removeMember(b);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(r){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(r.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var sd=o(1),At=o(0);class ad extends Mt{constructor(r,c,b){super(r,c),this.key=null,this.nacl=b}authorize(r,c){super.authorize(r,(b,k)=>{if(b){c(b,k);return}let L=k.shared_secret;if(!L){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(At.decode)(L),delete k.shared_secret,c(null,k)})}trigger(r,c){throw new I("Client events are not currently supported for encrypted channels")}handleEvent(r){var c=r.event,b=r.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(r);return}this.handleEncryptedEvent(c,b)}handleEncryptedEvent(r,c){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let b=Object(At.decode)(c.ciphertext);if(b.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${b.length}`);return}let k=Object(At.decode)(c.nonce);if(k.length<this.nacl.secretbox.nonceLength){se.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${k.length}`);return}let L=this.nacl.secretbox.open(b,k,this.key);if(L===null){se.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,N)=>{if(E){se.error(`Failed to make a request to the authEndpoint: ${N}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(b,k,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(r,this.getDataToEmit(L))});return}this.emit(r,this.getDataToEmit(L))}getDataToEmit(r){let c=Object(sd.decode)(r);try{return JSON.parse(c)}catch{return c}}}class rd extends on{constructor(r,c){super(),this.state="initialized",this.connection=null,this.key=r,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var b=O.getNetwork();b.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),b.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(r){return this.connection?this.connection.send(r):!1}send_event(r,c,b){return this.connection?this.connection.send_event(r,c,b):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var r=(c,b)=>{c?this.runner=this.strategy.connect(0,r):b.action==="error"?(this.emit("error",{type:"HandshakeError",error:b.error}),this.timeline.error({handshakeError:b.error})):(this.abortConnecting(),this.handshakeCallbacks[b.action](b))};this.runner=this.strategy.connect(0,r)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var r=this.abandonConnection();r.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(r){this.timeline.info({action:"retry",delay:r}),r>0&&this.emit("connecting_in",Math.round(r/1e3)),this.retryTimer=new Ee(r||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ee(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ee(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Ee(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(r){return fe({},r,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(r){return fe({},r,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let r=c=>b=>{b.error&&this.emit("error",{type:"WebSocketError",error:b.error}),c(b)};return{tls_only:r(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:r(()=>{this.disconnect()}),backoff:r(()=>{this.retryIn(1e3)}),retry:r(()=>{this.retryIn(0)})}}setConnection(r){this.connection=r;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var r in this.connectionCallbacks)this.connection.unbind(r,this.connectionCallbacks[r]);var c=this.connection;return this.connection=null,c}}updateState(r,c){var b=this.state;if(this.state=r,b!==r){var k=r;k==="connected"&&(k+=" with new socket ID "+c.socket_id),se.debug("State changed",b+" -> "+k),this.timeline.info({state:r,params:c}),this.emit("state_change",{previous:b,current:r}),this.emit(r,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ld{constructor(){this.channels={}}add(r,c){return this.channels[r]||(this.channels[r]=dd(r,c)),this.channels[r]}all(){return B(this.channels)}find(r){return this.channels[r]}remove(r){var c=this.channels[r];return delete this.channels[r],c}disconnect(){ke(this.channels,function(r){r.disconnect()})}}function dd(u,r){if(u.indexOf("private-encrypted-")===0){if(r.config.nacl)return sn.createEncryptedChannel(u,r,r.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",b=w.buildLogSuffix("encryptedChannelSupport");throw new I(`${c}. ${b}`)}else{if(u.indexOf("private-")===0)return sn.createPrivateChannel(u,r);if(u.indexOf("presence-")===0)return sn.createPresenceChannel(u,r);if(u.indexOf("#")===0)throw new M('Cannot create a channel with name "'+u+'".');return sn.createChannel(u,r)}}var cd={createChannels(){return new ld},createConnectionManager(u,r){return new rd(u,r)},createChannel(u,r){return new _t(u,r)},createPrivateChannel(u,r){return new Mt(u,r)},createPresenceChannel(u,r){return new od(u,r)},createEncryptedChannel(u,r,c){return new ad(u,r,c)},createTimelineSender(u,r){return new nd(u,r)},createHandshake(u,r){return new ed(u,r)},createAssistantToTheTransportManager(u,r,c){return new Ql(u,r,c)}},sn=cd;class us{constructor(r){this.options=r||{},this.livesLeft=this.options.lives||1/0}getAssistant(r){return sn.createAssistantToTheTransportManager(this,r,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Ln{constructor(r,c){this.strategies=r,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return oi(this.strategies,re.method("isSupported"))}connect(r,c){var b=this.strategies,k=0,L=this.timeout,E=null,N=(H,Z)=>{Z?c(null,Z):(k=k+1,this.loop&&(k=k%b.length),k<b.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),E=this.tryStrategy(b[k],r,{timeout:L,failFast:this.failFast},N)):c(!0))};return E=this.tryStrategy(b[k],r,{timeout:L,failFast:this.failFast},N),{abort:function(){E.abort()},forceMinPriority:function(H){r=H,E&&E.forceMinPriority(H)}}}tryStrategy(r,c,b,k){var L=null,E=null;return b.timeout>0&&(L=new Ee(b.timeout,function(){E.abort(),k(!0)})),E=r.connect(c,function(N,H){N&&L&&L.isRunning()&&!b.failFast||(L&&L.ensureAborted(),k(N,H))}),{abort:function(){L&&L.ensureAborted(),E.abort()},forceMinPriority:function(N){E.forceMinPriority(N)}}}}class xt{constructor(r){this.strategies=r}isSupported(){return oi(this.strategies,re.method("isSupported"))}connect(r,c){return ud(this.strategies,r,function(b,k){return function(L,E){if(k[b].error=L,L){hd(k)&&c(!0);return}he(k,function(N){N.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function ud(u,r,c){var b=Q(u,function(k,L,E,N){return k.connect(r,c(L,N))});return{abort:function(){he(b,md)},forceMinPriority:function(k){he(b,function(L){L.forceMinPriority(k)})}}}function hd(u){return Hi(u,function(r){return!!r.error})}function md(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class pd{constructor(r,c,b){this.strategy=r,this.transports=c,this.ttl=b.ttl||1800*1e3,this.usingTLS=b.useTLS,this.timeline=b.timeline}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.usingTLS,k=vd(b),L=k&&k.cacheSkipCount?k.cacheSkipCount:0,E=[this.strategy];if(k&&k.timestamp+this.ttl>=re.now()){var N=this.transports[k.transport];N&&(["ws","wss"].includes(k.transport)||L>3?(this.timeline.info({cached:!0,transport:k.transport,latency:k.latency}),E.push(new Ln([N],{timeout:k.latency*2+1e3,failFast:!0}))):L++)}var H=re.now(),Z=E.pop().connect(r,function X(pe,zi){pe?(hs(b),E.length>0?(H=re.now(),Z=E.pop().connect(r,X)):c(pe)):(bd(b,zi.transport.name,re.now()-H,L),c(null,zi))});return{abort:function(){Z.abort()},forceMinPriority:function(X){r=X,Z&&Z.forceMinPriority(X)}}}}function Lt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function vd(u){var r=O.getLocalStorage();if(r)try{var c=r[Lt(u)];if(c)return JSON.parse(c)}catch{hs(u)}return null}function bd(u,r,c,b){var k=O.getLocalStorage();if(k)try{k[Lt(u)]=An({timestamp:re.now(),transport:r,latency:c,cacheSkipCount:b})}catch{}}function hs(u){var r=O.getLocalStorage();if(r)try{delete r[Lt(u)]}catch{}}class Ki{constructor(r,{delay:c}){this.strategy=r,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy,k,L=new Ee(this.options.delay,function(){k=b.connect(r,c)});return{abort:function(){L.ensureAborted(),k&&k.abort()},forceMinPriority:function(E){r=E,k&&k.forceMinPriority(E)}}}}class ai{constructor(r,c,b){this.test=r,this.trueBranch=c,this.falseBranch=b}isSupported(){var r=this.test()?this.trueBranch:this.falseBranch;return r.isSupported()}connect(r,c){var b=this.test()?this.trueBranch:this.falseBranch;return b.connect(r,c)}}class fd{constructor(r){this.strategy=r}isSupported(){return this.strategy.isSupported()}connect(r,c){var b=this.strategy.connect(r,function(k,L){L&&b.abort(),c(k,L)});return b}}function ri(u){return function(){return u.isSupported()}}var gd=function(u,r,c){var b={};function k(Ss,fc,gc,yc,Cc){var _s=c(u,Ss,fc,gc,yc,Cc);return b[Ss]=_s,_s}var L=Object.assign({},r,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),E=Object.assign({},L,{useTLS:!0}),N=Object.assign({},r,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),H={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new us({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),X=new us({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),pe=k("ws","ws",3,L,Z),zi=k("wss","ws",3,E,Z),hc=k("sockjs","sockjs",1,N),fs=k("xhr_streaming","xhr_streaming",1,N,X),mc=k("xdr_streaming","xdr_streaming",1,N,X),gs=k("xhr_polling","xhr_polling",1,N),pc=k("xdr_polling","xdr_polling",1,N),ys=new Ln([pe],H),vc=new Ln([zi],H),bc=new Ln([hc],H),Cs=new Ln([new ai(ri(fs),fs,mc)],H),ks=new Ln([new ai(ri(gs),gs,pc)],H),ws=new Ln([new ai(ri(Cs),new xt([Cs,new Ki(ks,{delay:4e3})]),ks)],H),It=new ai(ri(ws),ws,bc),Nt;return r.useTLS?Nt=new xt([ys,new Ki(It,{delay:2e3})]):Nt=new xt([ys,new Ki(vc,{delay:2e3}),new Ki(It,{delay:5e3})]),new pd(new fd(new ai(ri(pe),Nt,It)),b,{ttl:18e5,timeline:r.timeline,useTLS:r.useTLS})},yd=gd,Cd=function(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),g.load(u.hooks.file,{useTLS:u.options.useTLS},function(r,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(r&&u.onError(r),u.onClose(),c(!1))})):u.onClose()},kd={getRequest:function(u){var r=new window.XDomainRequest;return r.ontimeout=function(){u.emit("error",new A),u.close()},r.onerror=function(c){u.emit("error",c),u.close()},r.onprogress=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText)},r.onload=function(){r.responseText&&r.responseText.length>0&&u.onChunk(200,r.responseText),u.emit("finished",200),u.close()},r},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},wd=kd;const Sd=256*1024;class _d extends on{constructor(r,c,b){super(),this.hooks=r,this.method=c,this.url=b}start(r){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},O.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(r)}close(){this.unloader&&(O.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(r,c){for(;;){var b=this.advanceBuffer(c);if(b)this.emit("chunk",{status:r,data:b});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(r){var c=r.slice(this.position),b=c.indexOf(`
|
|
954
|
+
`);return b!==-1?(this.position+=b+1,c.slice(0,b)):null}isBufferTooLong(r){return this.position===r.length&&r.length>Sd}}var Tt;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Tt||(Tt={}));var Tn=Tt,Md=1;class Ad{constructor(r,c){this.hooks=r,this.session=ps(1e3)+"/"+Ed(8),this.location=xd(c),this.readyState=Tn.CONNECTING,this.openStream()}send(r){return this.sendRaw(JSON.stringify([r]))}ping(){this.hooks.sendHeartbeat(this)}close(r,c){this.onClose(r,c,!0)}sendRaw(r){if(this.readyState===Tn.OPEN)try{return O.createSocketRequest("POST",ms(Ld(this.location,this.session))).start(r),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(r,c,b){this.closeStream(),this.readyState=Tn.CLOSED,this.onclose&&this.onclose({code:r,reason:c,wasClean:b})}onChunk(r){if(r.status===200){this.readyState===Tn.OPEN&&this.onActivity();var c,b=r.data.slice(0,1);switch(b){case"o":c=JSON.parse(r.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(r.data.slice(1)||"[]");for(var k=0;k<c.length;k++)this.onEvent(c[k]);break;case"m":c=JSON.parse(r.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(r.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(r){this.readyState===Tn.CONNECTING?(r&&r.hostname&&(this.location.base=Td(this.location.base,r.hostname)),this.readyState=Tn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(r){this.readyState===Tn.OPEN&&this.onmessage&&this.onmessage({data:r})}onActivity(){this.onactivity&&this.onactivity()}onError(r){this.onerror&&this.onerror(r)}openStream(){this.stream=O.createSocketRequest("POST",ms(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",r=>{this.onChunk(r)}),this.stream.bind("finished",r=>{this.hooks.onFinished(this,r)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(r){re.defer(()=>{this.onError(r),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function xd(u){var r=/([^\?]*)\/*(\??.*)/.exec(u);return{base:r[1],queryString:r[2]}}function Ld(u,r){return u.base+"/"+r+"/xhr_send"}function ms(u){var r=u.indexOf("?")===-1?"?":"&";return u+r+"t="+ +new Date+"&n="+Md++}function Td(u,r){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+r+c[3]}function ps(u){return O.randomInt(u)}function Ed(u){for(var r=[],c=0;c<u;c++)r.push(ps(32).toString(32));return r.join("")}var Pd=Ad,Id={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Nd=Id,Bd={getReceiveURL:function(u,r){return u.base+"/"+r+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,r){r===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+r+")",!1)}},Dd=Bd,Rd={getRequest:function(u){var r=O.getXHRAPI(),c=new r;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Hd=Rd,Od={createStreamingSocket(u){return this.createSocket(Nd,u)},createPollingSocket(u){return this.createSocket(Dd,u)},createSocket(u,r){return new Pd(u,r)},createXHR(u,r){return this.createRequest(Hd,u,r)},createRequest(u,r,c){return new _d(u,r,c)}},vs=Od;vs.createXDR=function(u,r){return this.createRequest(wd,u,r)};var Ud=vs,Vd={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:a,DependenciesReceivers:p,getDefaultStrategy:yd,Transports:Jl,transportConnectionInitializer:Cd,HTTPFactory:Ud,TimelineTransport:Rl,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var r=()=>{this.onDocumentBody(u.ready)};window.JSON?r():g.load("json2",{},r)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:Pl}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,r){return new Nl(u,r)},createScriptRequest(u){return new Il(u)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Yl},createWebSocket(u){var r=this.getWebSocketAPI();return new r(u)},createSocketRequest(u,r){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,r);if(this.isXDRSupported(r.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,r);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var r=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===r},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}},O=Vd,Et;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(Et||(Et={}));var Gi=Et;class jd{constructor(r,c,b){this.key=r,this.session=c,this.events=[],this.options=b||{},this.sent=0,this.uniqueID=0}log(r,c){r<=this.options.level&&(this.events.push(fe({},c,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(r){this.log(Gi.ERROR,r)}info(r){this.log(Gi.INFO,r)}debug(r){this.log(Gi.DEBUG,r)}isEmpty(){return this.events.length===0}send(r,c){var b=fe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],r(b,(k,L)=>{k||this.sent++,c&&c(k,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Kd{constructor(r,c,b,k){this.name=r,this.priority=c,this.transport=b,this.options=k||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(r,c){if(this.isSupported()){if(this.priority<r)return bs(new _,c)}else return bs(new z,c);var b=!1,k=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,E=function(){k.unbind("initialized",E),k.connect()},N=function(){L=sn.createHandshake(k,function(pe){b=!0,X(),c(null,pe)})},H=function(pe){X(),c(pe)},Z=function(){X();var pe;pe=An(k),c(new T(pe))},X=function(){k.unbind("initialized",E),k.unbind("open",N),k.unbind("error",H),k.unbind("closed",Z)};return k.bind("initialized",E),k.bind("open",N),k.bind("error",H),k.bind("closed",Z),k.initialize(),{abort:()=>{b||(X(),L?L.close():k.close())},forceMinPriority:pe=>{b||this.priority<pe&&(L?L.close():k.close())}}}}function bs(u,r){return re.defer(function(){r(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Gd}=O;var zd=function(u,r,c,b,k,L){var E=Gd[c];if(!E)throw new K(c);var N=(!u.enabledTransports||Pe(u.enabledTransports,r)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,r)===-1),H;return N?(k=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},k),H=new Kd(r,b,L?L.getAssistant(E):E,k)):H=Fd,H},Fd={isSupported:function(){return!1},connect:function(u,r){var c=re.defer(function(){r(new z)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function qd(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&se.warn("The disableStats option is deprecated in favor of enableStats")}const Wd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let k=r.paramsProvider();for(var b in k)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(k[b])}return c};var Zd=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Wd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.UserAuthentication,c)}};const Jd=(u,r)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var b in r.params)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(r.params[b]);if(r.paramsProvider!=null){let k=r.paramsProvider();for(var b in k)c+="&"+encodeURIComponent(b)+"="+encodeURIComponent(k[b])}return c};var $d=u=>{if(typeof O.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(r,c)=>{const b=Jd(r,u);O.getAuthorizers()[u.transport](O,b,u,C.ChannelAuthorization,c)}};const Yd=(u,r,c)=>{const b={authTransport:r.transport,authEndpoint:r.endpoint,auth:{params:r.params,headers:r.headers}};return(k,L)=>{const E=u.channel(k.channelName);c(E,b).authorize(k.socketId,L)}};function Qd(u,r){let c={activityTimeout:u.activityTimeout||d.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||d.httpPath,httpPort:u.httpPort||d.httpPort,httpsPort:u.httpsPort||d.httpsPort,pongTimeout:u.pongTimeout||d.pongTimeout,statsHost:u.statsHost||d.stats_host,unavailableTimeout:u.unavailableTimeout||d.unavailableTimeout,wsPath:u.wsPath||d.wsPath,wsPort:u.wsPort||d.wsPort,wssPort:u.wssPort||d.wssPort,enableStats:tc(u),httpHost:Xd(u),useTLS:ic(u),wsHost:ec(u),userAuthenticator:oc(u),channelAuthorizer:ac(u,r)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function Xd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:d.httpHost}function ec(u){return u.wsHost?u.wsHost:nc(u.cluster)}function nc(u){return`ws-${u}.pusher.com`}function ic(u){return O.getProtocol()==="https:"?!0:u.forceTLS!==!1}function tc(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function oc(u){const r=Object.assign(Object.assign({},d.userAuthentication),u.userAuthentication);return"customHandler"in r&&r.customHandler!=null?r.customHandler:Zd(r)}function sc(u,r){let c;return"channelAuthorization"in u?c=Object.assign(Object.assign({},d.channelAuthorization),u.channelAuthorization):(c={transport:u.authTransport||d.authTransport,endpoint:u.authEndpoint||d.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u&&(c.customHandler=Yd(r,c,u.authorizer))),c}function ac(u,r){const c=sc(u,r);return"customHandler"in c&&c.customHandler!=null?c.customHandler:$d(c)}class rc extends on{constructor(r){super(function(c,b){se.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=r,this.bindWatchlistInternalEvent()}handleEvent(r){r.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",r=>{var c=r.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(r)})}}function lc(){let u,r;return{promise:new Promise((b,k)=>{u=b,r=k}),resolve:u,reject:r}}var dc=lc;class cc extends on{constructor(r){super(function(c,b){se.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,b)=>{if(c){se.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:b.auth,user_data:b.user_data})},this.pusher=r,this.pusher.connection.bind("state_change",({previous:c,current:b})=>{c!=="connected"&&b==="connected"&&this._signin(),c==="connected"&&b!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new rc(r),this.pusher.connection.bind("message",c=>{var b=c.event;b==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(r){try{this.user_data=JSON.parse(r.user_data)}catch{se.error(`Failed parsing user data after signin: ${r.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){se.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const r=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new _t(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,b)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,b)}),r(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:r,resolve:c,reject:b}=dc();r.done=!1;const k=()=>{r.done=!0};r.then(k).catch(k),this.signinDonePromise=r,this._signinDoneResolve=c}}class ye{static ready(){ye.isReady=!0;for(var r=0,c=ye.instances.length;r<c;r++)ye.instances[r].connect()}static getClientFeatures(){return We($({ws:O.Transports.ws},function(r){return r.isSupported({})}))}constructor(r,c){uc(r),qd(c),this.key=r,this.config=Qd(c,this),this.channels=sn.createChannels(),this.global_emitter=new on,this.sessionID=O.randomInt(1e9),this.timeline=new jd(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Gi.INFO,version:d.VERSION}),this.config.enableStats&&(this.timelineSender=sn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+O.TimelineTransport.name}));var b=k=>O.getDefaultStrategy(this.config,k,zd);this.connection=sn.createConnectionManager(this.key,{getStrategy:b,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",k=>{var L=k.event,E=L.indexOf("pusher_internal:")===0;if(k.channel){var N=this.channel(k.channel);N&&N.handleEvent(k)}E||this.global_emitter.emit(k.event,k.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",k=>{se.warn(k)}),ye.instances.push(this),this.timeline.info({instances:ye.instances.length}),this.user=new cc(this),ye.isReady&&this.connect()}channel(r){return this.channels.find(r)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var r=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new tn(6e4,function(){c.send(r)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(r,c,b){return this.global_emitter.bind(r,c,b),this}unbind(r,c,b){return this.global_emitter.unbind(r,c,b),this}bind_global(r){return this.global_emitter.bind_global(r),this}unbind_global(r){return this.global_emitter.unbind_global(r),this}unbind_all(r){return this.global_emitter.unbind_all(),this}subscribeAll(){var r;for(r in this.channels.channels)this.channels.channels.hasOwnProperty(r)&&this.subscribe(r)}subscribe(r){var c=this.channels.add(r,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(r){var c=this.channels.find(r);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(r),c&&c.subscribed&&c.unsubscribe())}send_event(r,c,b){return this.connection.send_event(r,c,b)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=O,ye.ScriptReceivers=O.ScriptReceivers,ye.DependenciesReceivers=O.DependenciesReceivers,ye.auth_callbacks=O.auth_callbacks;var Pt=t.default=ye;function uc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}O.setup(ye)}])})})(Zo);var Zr=Zo.exports;const Jr=Wr(Zr);class Jo{constructor(e){h(this,"container");h(this,"onAction");h(this,"onFail");h(this,"initialTime");h(this,"timeLeft");h(this,"timerId");h(this,"payment");this.container=e.container,this.onAction=e.onAction,this.onFail=e.onFail,this.initialTime=1800,this.timeLeft=this.initialTime,this.timerId=null}attachListener(){const e=this.container.querySelector("#transfer-acn"),i=this.container.querySelector("#copy-acn"),t=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),s=this.container.querySelector("#copy-amount"),a=this.container.querySelector("#amount-tooltip"),l=this.container.querySelector("#transfer-button");i&&e&&i.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started"}),t&&this.copyToClipboard(e.innerHTML,t)}),s&&o&&s.addEventListener("click",()=>{P.track("copy_transferAmount",{payment_method:"Transfer"}),a&&this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),a)}),l&&l.addEventListener("click",()=>{this.onAction(5)})}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const i=this.container.querySelector("#time-left");i&&(i.innerHTML=zn(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){var g,f,y,w,C,S;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-amount"),t=this.container.querySelector("#transfer-bank"),o=this.container.querySelector("#account-name"),s=this.container.querySelector("#transfer-acn"),a=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",d=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(i&&(i.innerHTML=`${d} ${xe(this.payment.totalTaxAmount?this.payment.totalLocalAmount:l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(w=this.payment)==null?void 0:w.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(C=this.payment.bankDetails)==null?void 0:C.bankName),o&&this.payment.bankDetails&&(o.innerHTML=(S=this.payment.bankDetails)==null?void 0:S.accountName),s&&this.payment.bankDetails&&(s.innerHTML=this.payment.bankDetails.accountNumber),a&&(a.innerHTML=zn(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const M="45654f3ce4c9512ea9a4",A="us2";var v=new Jr(M,{cluster:A}),p=v.subscribe(e.reference);p.bind("payment_status",_=>{_.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),_!=null&&_.redirectUrl&&setTimeout(()=>{const T=new URL(_.redirectUrl);T.searchParams.append("status",_.status),T.searchParams.append("reference",_.reference),window.location.href=T.toString()},1800)):_.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return qr}}const $r=`<div id="trasferConfirmationProgress">
|
|
955
955
|
<div>
|
|
956
956
|
<div>
|
|
957
957
|
<div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
|
|
@@ -1032,7 +1032,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1032
1032
|
</div>
|
|
1033
1033
|
</div>
|
|
1034
1034
|
</div>
|
|
1035
|
-
</div>`;class Yr{constructor(e){h(this,"container");h(this,"onAction");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"payment");h(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#show-acn");e&&e.addEventListener("click",()=>{this.onAction(1),clearTimeout(this.timer)});const i=this.container.querySelector("#transfer-acn-pr"),t=this.container.querySelector("#copy-acn-pr"),o=this.container.querySelector("#acn-tooltip-pr");t&&i&&t.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Verification"}),o&&this.copyToClipboard(i.innerHTML,o)}),this.initialTime=300,this.timeLeft=this.initialTime;const s=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyTransfer(this.token,s,({data:a,headers:l})=>{this.onAction(6),this.redirectTo(a,l)})},5e3),this.startTimer()}updateProgressTimerContent(){const i=2*Math.PI*40,o=(this.initialTime-this.timeLeft)/this.initialTime*100/100*i,s=this.container.querySelector(".circle-progress");s&&(s.setAttribute("stroke-dasharray",`${i}`),s.setAttribute("stroke-dashoffset",`${o}`))}async verifyTransfer(e,i,t){let o=0,s=i,a=!0,l;this.abortController&&(l=this.abortController.signal);const d=async()=>{if(this.timeLeft<=0){a=!1,this.onAction(8)
|
|
1035
|
+
</div>`;class Yr{constructor(e){h(this,"container");h(this,"onAction");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"payment");h(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){const e=this.container.querySelector("#show-acn");e&&e.addEventListener("click",()=>{this.onAction(1),clearTimeout(this.timer)});const i=this.container.querySelector("#transfer-acn-pr"),t=this.container.querySelector("#copy-acn-pr"),o=this.container.querySelector("#acn-tooltip-pr");t&&i&&t.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Verification"}),o&&this.copyToClipboard(i.innerHTML,o)}),this.initialTime=300,this.timeLeft=this.initialTime;const s=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyTransfer(this.token,s,({data:a,headers:l})=>{this.onAction(6),this.redirectTo(a,l)})},5e3),this.startTimer()}updateProgressTimerContent(){const i=2*Math.PI*40,o=(this.initialTime-this.timeLeft)/this.initialTime*100/100*i,s=this.container.querySelector(".circle-progress");s&&(s.setAttribute("stroke-dasharray",`${i}`),s.setAttribute("stroke-dashoffset",`${o}`))}async verifyTransfer(e,i,t){let o=0,s=i,a=!0,l;this.abortController&&(l=this.abortController.signal);const d=async()=>{if(this.timeLeft<=0){a=!1,this.onAction(8);return}o+=1;try{const v=await an(e,this.ref,l,this.rdtCode,this.url);v.data.status==="inProgress"?(a&&(s=i*(o+1),this.timer=setTimeout(d,s)),this.setPaymentResponses(v.data,v.headers)):v.data.status==="successful"||v.data.status==="success"?(this.setPaymentResponses(v.data,v.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),t(v)):v.data.status==="failed"&&(this.setPaymentResponses(v.data,v.headers),a=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.onAction(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))}catch{a&&(s=i*(o+1),this.timer=setTimeout(d,s))}};d()}redirectTo(e,i){const t=i.get("spf-redirect-url");this.callBackUrl=t||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const o=new URL(this.callBackUrl);o.searchParams.append("status",e.status),o.searchParams.append("reference",e.reference),window.location.href=o.toString()},1800)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer()),this.updateProgressTimerContent()):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderTransferDetailsComponent(e){var s,a;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-bank"),t=this.container.querySelector("#transfer-acn-pr"),o=this.container.querySelector("#account-name");i&&e.bankDetails&&(i.innerHTML=(s=e.bankDetails)==null?void 0:s.bankName),t&&e.bankDetails&&(t.innerHTML=e.bankDetails.accountNumber),o&&e.bankDetails&&(o.innerHTML=(a=e.bankDetails)==null?void 0:a.accountName)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){this.container.innerHTML=this.render(),this.renderTransferDetailsComponent(e),this.attachListeners()}render(){return $r}}const Qr=`<div id="paymenExpired">
|
|
1036
1036
|
<div class="container-center min-h-[30dvh]">
|
|
1037
1037
|
<div>
|
|
1038
1038
|
<div class="container-center mb-5">
|
|
@@ -1055,7 +1055,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1055
1055
|
</div> -->
|
|
1056
1056
|
</div>
|
|
1057
1057
|
</div>
|
|
1058
|
-
</div>`;class Xr{constructor(e){h(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return Qr}}class el{constructor({amount:e,totalAmount:i,closeModal:t,container:o,email:s,token:a,currency:l,rdtCode:d,url:v,reference:p,callBackUrl:g,metadata:f,localCurrency:y,disablePaymentMethods:w,restartTransactionProcess:C,hidePaymentMethods:S,retryingPayment:M}){h(this,"container");h(this,"contents");h(this,"closeModal");h(this,"email");h(this,"transferDetails");h(this,"transferConfirmationProgress");h(this,"transferConfirmationEnd");h(this,"transferExpired");h(this,"mainLoader");h(this,"warningScreen");h(this,"successScreen");h(this,"merchantPlanDetail",{});h(this,"token");h(this,"currency");h(this,"amount");h(this,"totalAmount");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"_currentStep");h(this,"activeRef");h(this,"paymentResponse");h(this,"timerId");h(this,"abortController",null);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"transactionIssuesScreen");h(this,"disablePaymentMethods");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"hidePaymentMethods");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=l,this.container=o,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=t,this.token=a,this.email=s,this.amount=e,this.totalAmount=i,this.rdtCode=d,this.url=v,this.reference=p,this._currentStep=1,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.disablePaymentMethods=w,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=S,this.retryingPayment=M,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new De(this.contents),P.track("transfer_opens",{payment_method:"Transfer"}),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),i=this.container.querySelector("#transfer-sent"),t=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),i&&i.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),t&&t.addEventListener("click",()=>{this.closeModal(),P.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await sn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=7}}async createTransfer(){requestAnimationFrame(()=>{const e=this.container.querySelector("#loader"),i=this.container.querySelector("#details-content");i&&(this.mainLoader=new De(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_transferProcess",{payment_method:"Transfer"}),(()=>{var o,s;if(this.retryingPayment){const a={channel:"bank_transfer",reference:this.reference};return di(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Bt(this.token,a,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"?(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue(),P.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"})):(e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber?(this.transferDetails=new Jo({container:this.contents,onAction:a=>{this.onSentVerify.bind(this)(a)},onFail:(a,l)=>{this.currentStep=a,a===7&&l&&this.warningScreen.setPaymentError(l)}}),this.transferDetails.renderComponent(this.paymentResponse||o)):(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Error fetching bank details")))}).catch(o=>{P.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=7,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()})})}goBackToMerchant(){an(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(i==null||i.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):i==null||i.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new Jo({container:this.contents,onAction:o=>{this.onSentVerify.bind(this)(o)},onFail:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)}});break;case 2:this.transferExpired=new Xr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Yr({container:this.contents,onAction:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new gn({container:this.contents,onReportIssue:()=>this.currentStep=8,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render();break;case 8:this.transferConfirmationEnd=new Wo({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var o;this.currentStep=7,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"Payment failed")},token:this.token,rdtCode:this.rdtCode,url:this.url,paymentChannel:"bank_transfer",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}stopProgressBar(){const e=this.container.querySelector(".progress-bar");e&&(e.style.animationPlayState="paused")}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function $o(){return function(n,e){let i=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>i,set:s=>{i=s}})}}class te extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}}class Qe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class Ct{constructor(e){h(this,"token");h(this,"baseurl","https://api.spotflow.co/api/v1");h(this,"headers");h(this,"rdtCode");h(this,"url");h(this,"getHeaders",(e,i)=>{if(!e)throw new Qe("Missing authorization token");const t=new Headers;return t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${e}`),i&&t.append("Spotflow-Payment-Code",i),t});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class Yo extends Ct{constructor(e){super(e)}async createCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createUssdPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async validateCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async authorizeCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createTransferPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async verifyPayment(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:i});if(!t.ok){const s=await t.json();throw s.message?new te(s.message,t.status):new te("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class nl extends Ct{constructor(e){super(e)}async getMerchantConfig(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/checkout-configurations?currency=${i}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!t.ok){const o=await t.json();throw o.message?new te(o.message,t.status):new te("Network response was not ok",t.status)}return t.json()}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class il extends Ct{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ve(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const i=await e.json();throw i.message?new te(i.message,e.status):new te("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof te?(ui.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Qe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const tl=`<form id="ussdBanks">
|
|
1058
|
+
</div>`;class Xr{constructor(e){h(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return Qr}}class el{constructor({amount:e,totalAmount:i,closeModal:t,container:o,email:s,token:a,currency:l,rdtCode:d,url:v,reference:p,callBackUrl:g,metadata:f,localCurrency:y,disablePaymentMethods:w,restartTransactionProcess:C,hidePaymentMethods:S,retryingPayment:M}){h(this,"container");h(this,"contents");h(this,"closeModal");h(this,"email");h(this,"transferDetails");h(this,"transferConfirmationProgress");h(this,"transferConfirmationEnd");h(this,"transferExpired");h(this,"mainLoader");h(this,"warningScreen");h(this,"successScreen");h(this,"merchantPlanDetail",{});h(this,"token");h(this,"currency");h(this,"amount");h(this,"totalAmount");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"_currentStep");h(this,"activeRef");h(this,"paymentResponse");h(this,"timerId");h(this,"abortController",null);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"transactionIssuesScreen");h(this,"disablePaymentMethods");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"hidePaymentMethods");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=l,this.container=o,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=t,this.token=a,this.email=s,this.amount=e,this.totalAmount=i,this.rdtCode=d,this.url=v,this.reference=p,this._currentStep=1,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.disablePaymentMethods=w,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=S,this.retryingPayment=M,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new De(this.contents),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),i=this.container.querySelector("#transfer-sent"),t=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),i&&i.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),t&&t.addEventListener("click",()=>{this.closeModal(),P.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await an(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=7}}async createTransfer(){requestAnimationFrame(()=>{const e=this.container.querySelector("#loader"),i=this.container.querySelector("#details-content");i&&(this.mainLoader=new De(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_payment",{payment_method:"Transfer"}),(()=>{var o,s;if(this.retryingPayment){const a={channel:"bank_transfer",reference:this.reference};return di(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Bt(this.token,a,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"?(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue(),P.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"})):(e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber?(this.transferDetails=new Jo({container:this.contents,onAction:a=>{this.onSentVerify.bind(this)(a)},onFail:(a,l)=>{this.currentStep=a,a===7&&l&&this.warningScreen.setPaymentError(l)}}),this.transferDetails.renderComponent(this.paymentResponse||o)):(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Error fetching bank details")))}).catch(o=>{P.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=7,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()})})}goBackToMerchant(){Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(i==null||i.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):i==null||i.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new Jo({container:this.contents,onAction:o=>{this.onSentVerify.bind(this)(o)},onFail:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)}});break;case 2:this.transferExpired=new Xr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Yr({container:this.contents,onAction:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new gn({container:this.contents,onReportIssue:()=>this.currentStep=8,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render();break;case 8:this.transferConfirmationEnd=new Wo({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var o;this.currentStep=7,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"Payment failed")},token:this.token,rdtCode:this.rdtCode,url:this.url,paymentChannel:"bank_transfer",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}stopProgressBar(){const e=this.container.querySelector(".progress-bar");e&&(e.style.animationPlayState="paused")}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function $o(){return function(n,e){let i=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>i,set:s=>{i=s}})}}class te extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}}class Xe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class Ct{constructor(e){h(this,"token");h(this,"baseurl","https://api.spotflow.co/api/v1");h(this,"headers");h(this,"rdtCode");h(this,"url");h(this,"getHeaders",(e,i)=>{if(!e)throw new Xe("Missing authorization token");const t=new Headers;return t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${e}`),i&&t.append("Spotflow-Payment-Code",i),t});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class Yo extends Ct{constructor(e){super(e)}async createCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Xe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createUssdPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Xe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async validateCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Xe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async authorizeCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Xe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createTransferPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Xe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async verifyPayment(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:i});if(!t.ok){const s=await t.json();throw s.message?new te(s.message,t.status):new te("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Xe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class nl extends Ct{constructor(e){super(e)}async getMerchantConfig(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/checkout-configurations?currency=${i}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!t.ok){const o=await t.json();throw o.message?new te(o.message,t.status):new te("Network response was not ok",t.status)}return t.json()}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Xe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class il extends Ct{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ve(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const i=await e.json();throw i.message?new te(i.message,e.status):new te("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof te?(ui.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Xe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const tl=`<form id="ussdBanks">
|
|
1059
1059
|
<div>
|
|
1060
1060
|
<h5 class="text-grey-400 font-semibold text-sm">Please choose your bank to begin payment</h5>
|
|
1061
1061
|
<div class="mt-2">
|
|
@@ -1127,7 +1127,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1127
1127
|
payment</button>
|
|
1128
1128
|
</div>
|
|
1129
1129
|
</div>
|
|
1130
|
-
</div>`;class sl{constructor(e){h(this,"container");h(this,"selected");h(this,"secret");h(this,"onAction");h(this,"paymentService");h(this,"currency");h(this,"amount");h(this,"ussd_detail");h(this,"reference");h(this,"email");h(this,"activeRef","");h(this,"pageLoader");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.paymentService=new Yo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.email=e.email,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new De(this.container),this.pageLoader.mountLoader("25dvh"),this.pageLoader.updateMessage("Fetching selected bank code detail")}makePayment(){var e;P.track("start_ussdProcess",{payment_method:"USSD"}),this.paymentService.createUssdPayment({amount:this.amount,currency:this.currency,channel:"ussd",customer:{email:this.email},bank:{code:((e=this.selected)==null?void 0:e.code)||""},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0}).then(({data:i,headers:t})=>{var o;if(this.ussd_detail=i.ussd,this.activeRef=i.reference||"",i.status==="failed"){this.onError(i.providerMessage||"Payment failed"),P.track("stop_ussdProcess",{payment_method:"USSD"});const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const a=new URL(this.callBackUrl);a.searchParams.append("status",i.status),a.searchParams.append("reference",i.reference),window.location.href=a.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),a=this.container.querySelector("#bank-dial-code");a&&(a.innerHTML=((o=i==null?void 0:i.ussd)==null?void 0:o.paymentCode)||"");const l=this.container.querySelector("#bank-name-ussd");l&&(l.innerHTML=this.selected.name),Array.from(s).forEach(v=>{var p;v.innerHTML=((p=i==null?void 0:i.ussd)==null?void 0:p.code)||""}),this.attachListener();return}else if(i.providerMessage){this.onError(i.providerMessage);return}else{this.onError("Unable to fetch bank details");return}this.container.innerHTML=this.render(),this.attachListener()}).catch(i=>{i!=null&&i.message?this.onError(i.message):this.onError("Payment failed")})}attachListener(){const e=this.container.querySelectorAll(".copy-code-button"),i=this.container.querySelectorAll(".copy-code-button-1"),t=this.container.querySelector("#bank-completed-payment");Array.from(e).forEach(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),Array.from(i).forEach(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),t&&t.addEventListener("click",a=>{a.preventDefault(),this.onAction(this.selected,this.activeRef)})}renderComponent(){this.makePayment(),this.attachListener()}render(){return ol}}var al=Object.defineProperty,rl=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,a;s>=0;s--)(a=n[s])&&(o=a(e,i,o)||o);return o&&al(e,i,o),o};class Xo{constructor({container:e,onSuccess:i,secret:t,amount:o,totalAmount:s,currency:a,email:l,reference:d,rdtCode:v,url:p,callBackUrl:g,metadata:f,localCurrency:y,hidePaymentMethods:w,showPaymentMethods:C,disablePaymentMethods:S}){h(this,"contents");h(this,"selectedCode");h(this,"secret");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"email");h(this,"pageLoader");h(this,"reference");h(this,"onSuccess");h(this,"warningScreen");h(this,"bankDetail");h(this,"viewUssdCode");h(this,"_currentStep");h(this,"container");h(this,"paymentService");h(this,"successScreen");h(this,"activeRef","");h(this,"abortController");h(this,"_retry_count",10);h(this,"intervalPayment");h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"merchantDetails");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.totalAmount=s,this.currency=a,this.reference=d,this.email=l,this.rdtCode=v,this.url=p,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.merchantDetails={},this.hidePaymentMethods=w,this.showPaymentMethods=C,this.disablePaymentMethods=S,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new Yo({token:this.secret,rdtCode:this.rdtCode,url:this.url}),P.track("ussd_opens",{payment_method:"USSD"})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderUssdContent()}onCodeSelect(e){this.selectedCode=e||"",this.currentStep=2}validate(){let e;if(this.abortController?e=this.abortController.signal:(this.abortController=new AbortController,e=this.abortController.signal),this._retry_count<=0){clearInterval(this.intervalPayment),this.currentStep=3
|
|
1130
|
+
</div>`;class sl{constructor(e){h(this,"container");h(this,"selected");h(this,"secret");h(this,"onAction");h(this,"paymentService");h(this,"currency");h(this,"amount");h(this,"ussd_detail");h(this,"reference");h(this,"email");h(this,"activeRef","");h(this,"pageLoader");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.paymentService=new Yo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.email=e.email,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new De(this.container),this.pageLoader.mountLoader("25dvh"),this.pageLoader.updateMessage("Fetching selected bank code detail")}makePayment(){var e;P.track("start_ussdProcess",{payment_method:"USSD"}),this.paymentService.createUssdPayment({amount:this.amount,currency:this.currency,channel:"ussd",customer:{email:this.email},bank:{code:((e=this.selected)==null?void 0:e.code)||""},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0}).then(({data:i,headers:t})=>{var o;if(this.ussd_detail=i.ussd,this.activeRef=i.reference||"",i.status==="failed"){this.onError(i.providerMessage||"Payment failed"),P.track("stop_ussdProcess",{payment_method:"USSD"});const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const a=new URL(this.callBackUrl);a.searchParams.append("status",i.status),a.searchParams.append("reference",i.reference),window.location.href=a.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),a=this.container.querySelector("#bank-dial-code");a&&(a.innerHTML=((o=i==null?void 0:i.ussd)==null?void 0:o.paymentCode)||"");const l=this.container.querySelector("#bank-name-ussd");l&&(l.innerHTML=this.selected.name),Array.from(s).forEach(v=>{var p;v.innerHTML=((p=i==null?void 0:i.ussd)==null?void 0:p.code)||""}),this.attachListener();return}else if(i.providerMessage){this.onError(i.providerMessage);return}else{this.onError("Unable to fetch bank details");return}this.container.innerHTML=this.render(),this.attachListener()}).catch(i=>{i!=null&&i.message?this.onError(i.message):this.onError("Payment failed")})}attachListener(){const e=this.container.querySelectorAll(".copy-code-button"),i=this.container.querySelectorAll(".copy-code-button-1"),t=this.container.querySelector("#bank-completed-payment");Array.from(e).forEach(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),Array.from(i).forEach(a=>{a.addEventListener("click",l=>{var d;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((d=this.ussd_detail)==null?void 0:d.code)||"")})}),t&&t.addEventListener("click",a=>{a.preventDefault(),this.onAction(this.selected,this.activeRef)})}renderComponent(){this.makePayment(),this.attachListener()}render(){return ol}}var al=Object.defineProperty,rl=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,a;s>=0;s--)(a=n[s])&&(o=a(e,i,o)||o);return o&&al(e,i,o),o};class Xo{constructor({container:e,onSuccess:i,secret:t,amount:o,totalAmount:s,currency:a,email:l,reference:d,rdtCode:v,url:p,callBackUrl:g,metadata:f,localCurrency:y,hidePaymentMethods:w,showPaymentMethods:C,disablePaymentMethods:S}){h(this,"contents");h(this,"selectedCode");h(this,"secret");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"email");h(this,"pageLoader");h(this,"reference");h(this,"onSuccess");h(this,"warningScreen");h(this,"bankDetail");h(this,"viewUssdCode");h(this,"_currentStep");h(this,"container");h(this,"paymentService");h(this,"successScreen");h(this,"activeRef","");h(this,"abortController");h(this,"_retry_count",10);h(this,"intervalPayment");h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"merchantDetails");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.totalAmount=s,this.currency=a,this.reference=d,this.email=l,this.rdtCode=v,this.url=p,this.callBackUrl=g,this.metadata=f,this.localCurrency=y,this.merchantDetails={},this.hidePaymentMethods=w,this.showPaymentMethods=C,this.disablePaymentMethods=S,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new Yo({token:this.secret,rdtCode:this.rdtCode,url:this.url}),P.track("ussd_opens",{payment_method:"USSD"})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderUssdContent()}onCodeSelect(e){this.selectedCode=e||"",this.currentStep=2}validate(){let e;if(this.abortController?e=this.abortController.signal:(this.abortController=new AbortController,e=this.abortController.signal),this._retry_count<=0){clearInterval(this.intervalPayment),this.currentStep=3;return}this.paymentService.verifyPayment(this.activeRef,e||this.abortController.signal).then(({data:i,headers:t})=>{i.status==="failed"?(this.currentStep=3,clearInterval(this.intervalPayment),this.redirectTo(i,t,"failed")):["successful","failed"].includes(i.status)?i.status==="inProgress"?this._retry_count-=1:["success","successful"].includes(i.status)&&(this.currentStep=5,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Success"}),this.redirectTo(i,t,"success")):this._retry_count-=1}).catch(i=>{i.message?this.warningScreen.setPaymentError(i.message):this.warningScreen.setPaymentError("Payment failed"),this.currentStep=3,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Failed"})})}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}renderUssdContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3||this.currentStep===5?this.hidePaymentMethods():this.showPaymentMethods(),this.currentStep===2&&this.disablePaymentMethods("ussd"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep){case 1:this.bankDetail=new Qo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount,totalAmount:this.totalAmount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new sl({container:this.contents,onAction:(t,o)=>{this.activeRef=o,this.currentStep=4,this.intervalPayment=setInterval(()=>{this.validate()},5e3)},selected:this.selectedCode||{},secret:this.secret,amount:this.amount,totalAmount:this.totalAmount,currency:this.currency,email:this.email||"",onError:t=>{this.currentStep=3,this.warningScreen.setPaymentError(t)},reference:this.reference,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency}),this.viewUssdCode.renderComponent();break;case 3:this.contents.innerHTML=Ht,this.warningScreen=new gn({container:this.contents});break;case 4:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader("25vh"),this.pageLoader.updateMessage("We are confirming transaction status. This might take a few seconds.","Please do not refresh this page");break;case 5:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;default:this.bankDetail=new Qo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount,totalAmount:this.totalAmount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}rl([$o(),$o()],Xo.prototype,"selectedCode");const ll={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},dl=n=>n==null?void 0:n.replace(/_/g," ");function cl(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Ri=n=>{if(n){const e=dl(n);return cl(e)}return""},ul=`<div>
|
|
1131
1131
|
<button id="go-back" class="md:hidden" aria-label="Go back">
|
|
1132
1132
|
</button>
|
|
1133
1133
|
</div>
|
|
@@ -1263,7 +1263,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1263
1263
|
|
|
1264
1264
|
<!-- Tab options -->
|
|
1265
1265
|
</div>
|
|
1266
|
-
</div>`;class hl{constructor(e){h(this,"container");h(this,"email");h(this,"amount",0);h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"merchantDetail");h(this,"onAction");h(this,"isMobile");h(this,"onClose");h(this,"currentPaymentMethod");this.container=e.container,this.email=e.email,this.amount=e.amount||0,this.metadata=e.metadata,this.currency=e.currency,this.localCurrency=e.localCurrency,this.merchantDetail=e.merchantDetail,this.onAction=e.onAction,this.isMobile=e.isMobile,this.onClose=e.onClose,this.currentPaymentMethod=e.currentPaymentMethod}attachListeners(){const e=this.container.querySelectorAll(".tab-button");Array.from(e).forEach(s=>{const a=s.dataset.name||"",l=s.querySelector(".tab-button-icon"),d=s.querySelector(".tab-button-label");l&&(l.innerHTML=be[a].icon),d&&(d.textContent=be[a].label),s.addEventListener("click",v=>{v.preventDefault(),this.onAction(a)})});const t=this.container.querySelector("#close-btn");t&&t.addEventListener("click",()=>{this.onClose(!0)});const o=document.getElementById("go-back");o==null||o.addEventListener("click",()=>{this.onAction("")})}renderComponent(){var z,U,G,oe,ge,V,_e,ue,Te,Me,
|
|
1266
|
+
</div>`;class hl{constructor(e){h(this,"container");h(this,"email");h(this,"amount",0);h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"merchantDetail");h(this,"onAction");h(this,"isMobile");h(this,"onClose");h(this,"currentPaymentMethod");this.container=e.container,this.email=e.email,this.amount=e.amount||0,this.metadata=e.metadata,this.currency=e.currency,this.localCurrency=e.localCurrency,this.merchantDetail=e.merchantDetail,this.onAction=e.onAction,this.isMobile=e.isMobile,this.onClose=e.onClose,this.currentPaymentMethod=e.currentPaymentMethod}attachListeners(){const e=this.container.querySelectorAll(".tab-button");Array.from(e).forEach(s=>{const a=s.dataset.name||"",l=s.querySelector(".tab-button-icon"),d=s.querySelector(".tab-button-label");l&&(l.innerHTML=be[a].icon),d&&(d.textContent=be[a].label),s.addEventListener("click",v=>{v.preventDefault(),this.onAction(a)})});const t=this.container.querySelector("#close-btn");t&&t.addEventListener("click",()=>{this.onClose(!0)});const o=document.getElementById("go-back");o==null||o.addEventListener("click",()=>{this.onAction("")})}renderComponent(){var z,U,G,oe,ge,V,_e,ue,Te,Me,en,vn,nn,_n,bn,Ee,tn,Mn,re,fe,He,Pe,ke,We,B,he,Q,me,Ie,$,fn,oi,Hi,Oi,Ui,Vi,An;this.container.innerHTML=this.render(),this.amount=this.amount;const e=this.container.querySelector("#merchant-logo-container"),i=this.container.querySelector("#merchant-logo"),t=this.container.querySelector("#merchant-email"),o=this.container.querySelector("#merchant-email-mob"),s=this.container.querySelector("#plan-name"),a=this.container.querySelector("#plan-name-mob"),l=this.container.querySelector("#payment-fees"),d=this.container.querySelector("#currency-cursor"),v=this.container.querySelector("#currency-cursor-mob"),p=this.container.querySelector("#payment-rate-display"),g=this.container.querySelector("#payment-rate-display-mob"),f=this.container.querySelector("#designated-rate"),y=this.container.querySelector("#designated-rate-mob"),w=this.container.querySelector("#designated-rate-no-plan"),C=this.container.querySelector("#source-rate"),S=this.container.querySelector("#source-rate-mob"),M=this.container.querySelector("#tax-rate"),A=this.container.querySelector("#tax-rate-mob"),_=this.container.querySelector("#tooltip-localCurrency"),T=this.container.querySelector("#tooltip-localCurrency-mob");if((z=this.merchantDetail)!=null&&z.merchantLogo?i&&i.setAttribute("src",(U=this.merchantDetail)==null?void 0:U.merchantLogo):e&&(i==null||i.remove(),e.innerHTML=`<div class="font-semibold text-tone-100 rounded-2xl w-8 h-8 bg-tone-10 container-center uppercase">${this.merchantDetail.merchantName[0]}</div>`),t&&(t.innerHTML=this.email),o&&(o.innerHTML=this.email),s){if((oe=(G=this.merchantDetail)==null?void 0:G.plan)!=null&&oe.title){const si=((V=(ge=this.merchantDetail)==null?void 0:ge.plan)==null?void 0:V.title)||"";s.textContent=Ri(si)}(_e=this.metadata)!=null&&_e.productName&&(s.textContent=Ri(this.metadata.productName))}if(a){if((Te=(ue=this.merchantDetail)==null?void 0:ue.plan)!=null&&Te.title){const si=((en=(Me=this.merchantDetail)==null?void 0:Me.plan)==null?void 0:en.title)||"";a.textContent=Ri(si)}(vn=this.metadata)!=null&&vn.productName&&(a.textContent=Ri(this.metadata.productName))}d&&(this.currency==="USD"?p&&(p.innerHTML=`1 ${((_n=(nn=this.merchantDetail)==null?void 0:nn.rate)==null?void 0:_n.to)||"-"} = ${((Ee=(bn=this.merchantDetail)==null?void 0:bn.rate)==null?void 0:Ee.from)||"-"} ${xe(((tn=this.merchantDetail.rate)==null?void 0:tn.rate)||1,2)} `):d.innerHTML=""),v&&(this.currency==="USD"?g&&(g.innerHTML=`1 ${((re=(Mn=this.merchantDetail)==null?void 0:Mn.rate)==null?void 0:re.to)||"-"} = ${((He=(fe=this.merchantDetail)==null?void 0:fe.rate)==null?void 0:He.from)||"-"} ${xe(((Pe=this.merchantDetail.rate)==null?void 0:Pe.rate)||1,2)} `):v.innerHTML=""),(We=(ke=this.merchantDetail)==null?void 0:ke.plan)!=null&&We.title||(B=this.metadata)!=null&&B.productName?f&&(f.innerHTML=`${this.currency} ${xe(this.amount,2)}`):(w&&(w.innerHTML=`<span> ${this.currency} ${xe(this.amount,2)} </span>`),s&&a&&(s.remove(),a==null||a.remove()),this.localCurrency?f==null||f.remove():l&&l.remove()),y&&(y.innerHTML=`${this.currency} ${xe(this.amount,2)}`),C&&(this.localCurrency&&this.localCurrency!==this.currency?C.children[1].innerHTML=`${this.localCurrency} ${xe(this.amount*(((Q=(he=this.merchantDetail)==null?void 0:he.rate)==null?void 0:Q.rate)||1),2)}`:C.remove()),S&&(this.localCurrency&&this.localCurrency!==this.currency?S.children[1].innerHTML=`${this.localCurrency} ${xe(this.amount*(((Ie=(me=this.merchantDetail)==null?void 0:me.rate)==null?void 0:Ie.rate)||1),2)}`:S.remove());const I=this.localCurrency!==this.currency?this.amount*(((fn=($=this.merchantDetail)==null?void 0:$.rate)==null?void 0:fn.rate)||1):this.amount;M&&(oi=this.merchantDetail)!=null&&oi.taxQuoteId&&(Hi=this.merchantDetail)!=null&&Hi.totalAmount&&(M.classList.remove("hidden"),M.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(((Oi=this.merchantDetail)==null?void 0:Oi.totalAmount)-I,2)}`),A&&(Ui=this.merchantDetail)!=null&&Ui.taxQuoteId&&(Vi=this.merchantDetail)!=null&&Vi.totalAmount&&(A.classList.remove("hidden"),A.children[1].innerHTML=`${this.localCurrency!==this.currency?this.localCurrency:this.currency} ${xe(((An=this.merchantDetail)==null?void 0:An.totalAmount)-I,2)}`);const K=ll[this.localCurrency];_&&this.localCurrency&&(_.innerHTML=K?`${K} (${this.localCurrency})`:this.localCurrency),T&&this.localCurrency&&(T.innerHTML=K?`${K} (${this.localCurrency})`:this.localCurrency),this.renderPaymentOptions(this.container),this.attachListeners()}renderPaymentOptions(e){const i=e.querySelector(".payment-options"),t=this.localCurrency!==this.currency?this.localCurrency:this.currency;if(i){const o=this.merchantDetail.plan?[be.card]:this.merchantDetail.paymentMethods.filter(s=>s!=="ussd").map(s=>be[s]);if(this.isMobile){let s='<div class="">';o.forEach(a=>{s+=`
|
|
1267
1267
|
<div key=${a.key}>
|
|
1268
1268
|
<button class="tab-button gap-2 mb-4 group" data-name="${a.key}">
|
|
1269
1269
|
<div class="lg:block">${a.icon}</div>
|
|
@@ -1306,7 +1306,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1306
1306
|
`;a+="</div>"}a+="</div>"}a+="</div>",i.innerHTML=a}}}render(){return ul}}const ml=`<div class="flex items-center justify-center md:justify-between w-full text-xxs mt-5">
|
|
1307
1307
|
<div class="text-tone-60"><span>Powered by</span> <span class="font-bold">Spotflow</span></div>
|
|
1308
1308
|
<div class="align-center text-tone-60 hidden md:flex gap-4">
|
|
1309
|
-
|
|
1309
|
+
<span id="test-cards-link" class="hover:font-bold">Test Cards</span>
|
|
1310
1310
|
<a href="https://ribbon-scowl-35f.notion.site/Terms-Conditions-940742f0a1b144498ffc1786c5bc6a08?pvs=4" target="_blank" class="hover:font-bold">Terms</a>
|
|
1311
1311
|
<a href="https://ribbon-scowl-35f.notion.site/Privacy-Policy-Spotflow-3997ee8d923d4cd39a3dc43b7249b713" target="_blank" class="hover:font-bold">Privacy</a>
|
|
1312
1312
|
<a href="mailto:hello@spotflow.one" class="hover:font-bold">Contact</a>
|
|
@@ -1664,7 +1664,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1664
1664
|
|
|
1665
1665
|
</div>
|
|
1666
1666
|
</div>
|
|
1667
|
-
</div>`;class fl{constructor(e){h(this,"container");h(this,"onAction");h(this,"onSuccess");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){this.initialTime=300,this.timeLeft=this.initialTime;const e=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyMobileMoney(this.token,e,({data:i,headers:t})=>{this.onAction(4),this.redirectTo(i,t,"success")},()=>{this.onAction(5)})},5e3),this.startTimer()}async verifyMobileMoney(e,i,t,o){let s=0,a=i,l=!0,d;this.abortController&&(d=this.abortController.signal);const v=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(8);return}s+=1;try{const p=await
|
|
1667
|
+
</div>`;class fl{constructor(e){h(this,"container");h(this,"onAction");h(this,"onSuccess");h(this,"ref");h(this,"token");h(this,"initialTime",300);h(this,"abortController");h(this,"timeLeft");h(this,"timer");h(this,"timerId",null);h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"setPaymentResponses");this.container=e.container,this.timeLeft=this.initialTime,this.onAction=e.onAction,this.ref=e.ref,this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.onSuccess=e.onSuccess,this.callBackUrl=e.callBackUrl,this.setPaymentResponses=e.setPaymentResponses}attachListeners(){this.initialTime=300,this.timeLeft=this.initialTime;const e=3e4;this.abortController=new AbortController,setTimeout(()=>{this.verifyMobileMoney(this.token,e,({data:i,headers:t})=>{this.onAction(4),this.redirectTo(i,t,"success")},()=>{this.onAction(5)})},5e3),this.startTimer()}async verifyMobileMoney(e,i,t,o){let s=0,a=i,l=!0,d;this.abortController&&(d=this.abortController.signal);const v=async()=>{if(this.timeLeft<=0){l=!1,this.onAction(8);return}s+=1;try{const p=await an(e,this.ref,d,this.rdtCode,this.url);p.data.status==="failed"&&(l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),this.setPaymentResponses(p.data,p.headers),P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed"}),o(p)),p.data.status==="inProgress"&&(l&&(a=i*(s+1),this.timer=setTimeout(v,a)),this.setPaymentResponses(p.data,p.headers)),(p.data.status==="success"||p.data.status==="successful")&&(this.setPaymentResponses(p.data,p.headers),l=!1,clearTimeout(this.timer),clearInterval(this.timerId||void 0),P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Success"}),t(p))}catch{l&&(a=i*(s+1),this.timer=setTimeout(v,a))}};v()}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}startTimer(){const e=this.container.querySelector("#ctd-timer");this.stopTimer(),this.timerId=window.setInterval(()=>{this.timeLeft>0?(this.timeLeft-=1,e&&(e.innerHTML=zn(this.timeLeft),this.startTimer())):(this.stopTimer(),this.onAction(8))},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return bl}}const gl=`<form id="mobile-money-form">
|
|
1668
1668
|
<div>
|
|
1669
1669
|
<h5 class="text-grey-400 font-semibold text-sm">Please enter your Mobile Money details to begin payment</h5>
|
|
1670
1670
|
|
|
@@ -1773,7 +1773,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1773
1773
|
<path
|
|
1774
1774
|
d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
|
|
1775
1775
|
stroke="black" stroke-width="4" stroke-linejoin="round" />
|
|
1776
|
-
</svg>`),t&&t.classList.add("hidden"),i&&i.setAttribute("disabled","true"),e&&(e.value="",this.momoOtp="",e.setAttribute("disabled","true")),this.onClose(!1)})}handleOtpInput(e,i){const t=e.target,o=e.data;o&&this.momoOtp.length<6?this.momoOtp+=o:e.inputType==="deleteContentBackward"&&(this.momoOtp=this.momoOtp.slice(0,-1)),t.value="*".repeat(this.momoOtp.length),this.momoOtp.length>=6&&i&&i.removeAttribute("disabled");const s=this.container.querySelector("#otp-error");this.momoOtp.length<6&&(i&&i.setAttribute("disabled","true"),s&&(s.innerHTML=""))}renderComponent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#otp-message");e&&(e.innerHTML=this.otpMessage),this.attachListener()}render(){return Cl}}class wl{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{an(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return qo}}class Sl{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:a,reference:l,onSuccess:d,url:v,email:p,amount:g,totalAmount:f,token:y,currency:w,disablePaymentMethods:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T}){h(this,"contents");h(this,"mobileMoneyForm");h(this,"mobileMoneyValidationForm");h(this,"onSuccess");h(this,"mobileMoneyConfirmation");h(this,"mobileMoneyConfirmationEnd");h(this,"transactionIssuesScreen");h(this,"container");h(this,"pageLoader");h(this,"mainLoader");h(this,"_currentStep");h(this,"successScreen");h(this,"email");h(this,"activeRef");h(this,"warningScreen");h(this,"amount");h(this,"totalAmount");h(this,"url");h(this,"reference");h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"token");h(this,"callBackUrl");h(this,"rdtCode");h(this,"merchantDetails");h(this,"onClose");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.container=e,this.onSuccess=d||(()=>null),this.token=y,this.currency=w,this.amount=g,this.totalAmount=f,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.email=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=a,this.url=v,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=_,this.retryingPayment=T,this.isMaxRetriesReached=!1,P.track("mobile_money_opens",{payment_method:"Mobile Money"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderMobileMoneyContent()}attachInputListeners(){}async createMobileMoney(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text");t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{var a,l;if(this.retryingPayment){const d={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber}};return di(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((a=this.merchantDetails)==null?void 0:a.taxQuoteId)&&{taxQuoteId:(l=this.merchantDetails)==null?void 0:l.taxQuoteId}};return xs(this.token,d,this.rdtCode,this.url)}})().then(({data:a,headers:l})=>{var d;if(this.paymentResponse=a,this.paymentResponseHeaders=l,a.status==="failed"){this.currentStep=5,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue(),P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Failed"});return}else if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="otp"){this.activeRef=a.reference,this.currentStep=6;return}else this.currentStep=3}).catch(a=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),a.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=5,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new De(this.contents),this.pageLoader.mountLoader()}submitOtp(e,i){e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text"),s={authorization:{otp:i},reference:this.activeRef};P.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),li(this.token,s,this.rdtCode,this.url).then(({data:l})=>{l.status==="failed"?(this.activeRef=l.reference,this.currentStep=3):["success","successful","failed"].includes(l.status)?["success","successful"].includes(l.status)&&(this.activeRef=l.reference,this.currentStep=3):(this.activeRef=l.reference,this.currentStep=3)}).catch(l=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const d=this.container.querySelector("#otp-error");l.code==="invalid_otp"?d&&(d.innerHTML=l.message):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await sn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){an(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new yl({container:this.contents,merchantKey:this.token,url:this.url,onAction:t=>o=>this.createMobileMoney.bind(this)(t,o),ref:this.activeRef,switchScreen:t=>{this.currentStep=t},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,totalAmount:this.totalAmount,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantDetails:this.merchantDetails}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new De(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new fl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(t,o)=>{this.paymentResponse=t,this.paymentResponseHeaders=o}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new gn({container:this.contents,onReportIssue:()=>this.currentStep=9,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 6:this.mobileMoneyValidationForm=new kl({container:this.contents,onClose:this.onClose,onAction:t=>o=>this.submitOtp.bind(this)(t,o),otpMessage:((i=this.paymentResponse)==null?void 0:i.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new wl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var t;this.currentStep=5,this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const _l=`<div id="eft-authenticate-container">
|
|
1776
|
+
</svg>`),t&&t.classList.add("hidden"),i&&i.setAttribute("disabled","true"),e&&(e.value="",this.momoOtp="",e.setAttribute("disabled","true")),this.onClose(!1)})}handleOtpInput(e,i){const t=e.target,o=e.data;o&&this.momoOtp.length<6?this.momoOtp+=o:e.inputType==="deleteContentBackward"&&(this.momoOtp=this.momoOtp.slice(0,-1)),t.value="*".repeat(this.momoOtp.length),this.momoOtp.length>=6&&i&&i.removeAttribute("disabled");const s=this.container.querySelector("#otp-error");this.momoOtp.length<6&&(i&&i.setAttribute("disabled","true"),s&&(s.innerHTML=""))}renderComponent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#otp-message");e&&(e.innerHTML=this.otpMessage),this.attachListener()}render(){return Cl}}class wl{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return qo}}class Sl{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:a,reference:l,onSuccess:d,url:v,email:p,amount:g,totalAmount:f,token:y,currency:w,disablePaymentMethods:C,hidePaymentMethods:S,showPaymentMethods:M,onClose:A,restartTransactionProcess:_,retryingPayment:T}){h(this,"contents");h(this,"mobileMoneyForm");h(this,"mobileMoneyValidationForm");h(this,"onSuccess");h(this,"mobileMoneyConfirmation");h(this,"mobileMoneyConfirmationEnd");h(this,"transactionIssuesScreen");h(this,"container");h(this,"pageLoader");h(this,"mainLoader");h(this,"_currentStep");h(this,"successScreen");h(this,"email");h(this,"activeRef");h(this,"warningScreen");h(this,"amount");h(this,"totalAmount");h(this,"url");h(this,"reference");h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"token");h(this,"callBackUrl");h(this,"rdtCode");h(this,"merchantDetails");h(this,"onClose");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.container=e,this.onSuccess=d||(()=>null),this.token=y,this.currency=w,this.amount=g,this.totalAmount=f,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.email=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=a,this.url=v,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=S,this.showPaymentMethods=M,this.onClose=A,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=_,this.retryingPayment=T,this.isMaxRetriesReached=!1,P.track("mobile_money_opens",{payment_method:"Mobile Money"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderMobileMoneyContent()}attachInputListeners(){}async createMobileMoney(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text");t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{var a,l;if(this.retryingPayment){const d={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber}};return di(this.token,d,this.rdtCode,this.url)}else{const d={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((a=this.merchantDetails)==null?void 0:a.taxQuoteId)&&{taxQuoteId:(l=this.merchantDetails)==null?void 0:l.taxQuoteId}};return xs(this.token,d,this.rdtCode,this.url)}})().then(({data:a,headers:l})=>{var d;if(this.paymentResponse=a,this.paymentResponseHeaders=l,a.status==="failed"){this.currentStep=5,a.providerMessage?this.warningScreen.setPaymentError(a.providerMessage):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue(),P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Failed"});return}else if(a.status==="success"||a.status==="successful"){this.currentStep=4,P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Success"}),Ze(a,l,a==null?void 0:a.callBackUrl);return}else if(((d=a==null?void 0:a.authorization)==null?void 0:d.mode)==="otp"){this.activeRef=a.reference,this.currentStep=6;return}else this.currentStep=3}).catch(a=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),a.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=5,a.message?this.warningScreen.setPaymentError(a.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new De(this.contents),this.pageLoader.mountLoader()}submitOtp(e,i){e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text"),s={authorization:{otp:i},reference:this.activeRef};P.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),li(this.token,s,this.rdtCode,this.url).then(({data:l})=>{l.status==="failed"?(this.activeRef=l.reference,this.currentStep=3):["success","successful","failed"].includes(l.status)?["success","successful"].includes(l.status)&&(this.activeRef=l.reference,this.currentStep=3):(this.activeRef=l.reference,this.currentStep=3)}).catch(l=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const d=this.container.querySelector("#otp-error");l.code==="invalid_otp"?(d&&(d.innerHTML=l.message),P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"})):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await an(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new yl({container:this.contents,merchantKey:this.token,url:this.url,onAction:t=>o=>this.createMobileMoney.bind(this)(t,o),ref:this.activeRef,switchScreen:t=>{this.currentStep=t},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,totalAmount:this.totalAmount,restartTransactionProcess:this.restartTransactionProcess.bind(this),merchantDetails:this.merchantDetails}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new De(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new fl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(t,o)=>{this.paymentResponse=t,this.paymentResponseHeaders=o}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new gn({container:this.contents,onReportIssue:()=>this.currentStep=9,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 6:this.mobileMoneyValidationForm=new kl({container:this.contents,onClose:this.onClose,onAction:t=>o=>this.submitOtp.bind(this)(t,o),otpMessage:((i=this.paymentResponse)==null?void 0:i.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new wl({container:this.contents,onAction:t=>{this.currentStep=t},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var t;this.currentStep=5,this.warningScreen.setPaymentError(((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const _l=`<div id="eft-authenticate-container">
|
|
1777
1777
|
<div class="pt-3">
|
|
1778
1778
|
<div class="container-center">
|
|
1779
1779
|
<svg width="98" height="32" viewBox="0 0 98 32" fill="none" xmlns="http://www.w3.org/2000/svg"
|
|
@@ -1810,7 +1810,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
1810
1810
|
</div>
|
|
1811
1811
|
</div>
|
|
1812
1812
|
|
|
1813
|
-
</div>`;class ts{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"onAction");h(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn");e&&e.addEventListener("click",()=>{this.onAction(),P.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return _l}}class Ml{constructor({amount:e,totalAmount:i,container:t,email:o,token:s,currency:a,rdtCode:l,url:d,reference:v,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:w,restartTransactionProcess:C,retryingPayment:S}){h(this,"contents");h(this,"eftAuthenticate");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"email");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"_currentStep");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"merchantPlanDetail",{});h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.currency=a,this.container=t,this.token=s,this.email=o,this.amount=e,this.totalAmount=i,this.rdtCode=l,this.url=d,this.reference=v,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=y,this.showPaymentMethods=w,this.restartTransactionProcess=C,this.retryingPayment=S,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.renderEftContent(),P.track("eft_opens",{payment_method:"EFT"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderEftContent()}showLoader(){this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text");i&&(i.textContent=e)}goBackToMerchant(){an(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#authenticate-button-text");e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{var o,s;if(this.retryingPayment){const a={channel:"eft",reference:this.reference};return di(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"eft",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Bt(this.token,a,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var a,l,d;if(this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((a=o==null?void 0:o.authorization)==null?void 0:a.mode)==="redirect"){(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((d=o==null?void 0:o.authorization)==null?void 0:d.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(o==null?void 0:o.providerMessage):this.warningScreen.setPaymentError("Unable to get redirect URL")}).catch(o=>{o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed"))}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}redirectToOzow(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await sn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const i=this.paymentResponse.status;i==="successful"?(this.currentStep=2,P.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),an(this.paymentResponse,this.paymentResponseHeaders,"success")):i==="failed"?(this.currentStep=4,P.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):i==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError("Payment Cancelled","You have cancelled the payment. Go back to merchant website to start the payment process again.","Go back to Merchant"))}catch{this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")}}renderEftContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.eftAuthenticate=new ts({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new gn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var s;this.currentStep=4,this.warningScreen.setPaymentError(((s=this.paymentResponse)==null?void 0:s.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"eft",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.eftAuthenticate=new ts({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}const o=this.container.querySelector("#card-currency");o&&(o.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}}class Al{constructor({container:e,email:i,phoneNumber:t,code:o,encryption:s,merchantKey:a,modalContainer:l,amount:d,planId:v,rdtCode:p,url:g,reference:f,callBackUrl:y,metadata:w,localCurrency:C,closePayment:S}){h(this,"validChannels",[]);h(this,"disabledChannels",[]);h(this,"selectedChannel");h(this,"modalContainer");h(this,"currentPaymentMethod");h(this,"mainLayout");h(this,"mainHeader");h(this,"mainFooter");h(this,"testCard");h(this,"merchantPlanDetail",{});h(this,"mainScreen");h(this,"currency");h(this,"card");h(this,"transfer");h(this,"ussd");h(this,"mobileMoney");h(this,"eft");h(this,"encryption");h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"phoneNumber");h(this,"code");h(this,"amount",0);h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"isMobile",!1);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"closePayment");h(this,"retryingPayment");h(this,"totalAmount");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=l,this.encryption=s,this.planId=v||"",this.merchantKey=a,this.email=i,this.phoneNumber=t,this.code=o,this.amount=d||0,this.rdtCode=p||"",this.url=g||"",this.reference=f,this.mainLayout=e,this.callBackUrl=y,this.metadata=w||{},this.localCurrency=C||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=S,this.retryingPayment=!1,this.totalAmount=0}mountScreen(e,i,t,o){var a,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(a=this.merchantPlanDetail.plan)==null?void 0:a.pricingOptions)==null?void 0:l.find(d=>d.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.totalAmount=this.merchantPlanDetail.totalAmount||this.amount,this.mainHeader=new hl({container:document.getElementById("main-header"),email:this.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:d=>{this.closeBTN.bind(this)(d)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.testCard=new es({container:document.getElementById("test-container"),closeCallback:()=>{const d=document.getElementById("test-container");d&&(d.innerHTML="",d.classList.add("hidden"))}}),this.mainFooter=new is({container:document.getElementById("main-footer"),testCardContainer:document.getElementById("test-container")}),document.addEventListener("DOMContentLoaded",()=>{const d=document.getElementById("main-footer"),v=document.getElementById("test-container");new is({container:d,testCardContainer:v}).renderComponent()}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.totalAmount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{t.removeAttribute("disabled"),t.classList.remove("hidden","disabled","limit-exceeded");const o=t.querySelector(".disabled-indicator");o&&t.removeChild(o)});const i=[...this.validChannels,...this.disabledChannels];e.forEach(t=>{const o=t.getAttribute("data-name");o&&!i.includes(o)&&t.classList.add("hidden")}),this.disabledChannels.forEach(t=>{const o=Array.from(e).find(s=>s.getAttribute("data-name")===t);if(o){o.setAttribute("disabled","true"),o.classList.add("disabled","limit-exceeded"),o.setAttribute("title","Transaction amount exceeds limit for this payment method");const s=document.createElement("span");s.classList.add("disabled-indicator"),s.style.fontSize="10px",s.style.color="#FF5733",s.style.display="block",o.appendChild(s)}})}attachListeners(){const e=document.getElementById("go-back"),i=document.getElementById("select-payment-method-text");this.isMobile&&(this.currentPaymentMethod?(e&&(e.classList.add("flex","items-center","gap-2","mb-2"),e.innerHTML=` <svg width="9" height="18" viewBox="0 0 9 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1813
|
+
</div>`;class ts{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"onAction");h(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new gn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn");e&&e.addEventListener("click",()=>{this.onAction(),P.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return _l}}class Ml{constructor({amount:e,totalAmount:i,container:t,email:o,token:s,currency:a,rdtCode:l,url:d,reference:v,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:w,restartTransactionProcess:C,retryingPayment:S}){h(this,"contents");h(this,"eftAuthenticate");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"email");h(this,"token");h(this,"amount");h(this,"totalAmount");h(this,"currency");h(this,"_currentStep");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"merchantPlanDetail",{});h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.currency=a,this.container=t,this.token=s,this.email=o,this.amount=e,this.totalAmount=i,this.rdtCode=l,this.url=d,this.reference=v,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this._currentStep=1,this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=y,this.showPaymentMethods=w,this.restartTransactionProcess=C,this.retryingPayment=S,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.renderEftContent(),P.track("eft_opens",{payment_method:"EFT"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderEftContent()}showLoader(){this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text");i&&(i.textContent=e)}goBackToMerchant(){Ze(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#authenticate-button-text");e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{var o,s;if(this.retryingPayment){const a={channel:"eft",reference:this.reference};return di(this.token,a,this.rdtCode,this.url)}else{const a={amount:this.amount,channel:"eft",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0,...((o=this.merchantPlanDetail)==null?void 0:o.taxQuoteId)&&{taxQuoteId:(s=this.merchantPlanDetail)==null?void 0:s.taxQuoteId}};return Bt(this.token,a,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var a,l,d;if(this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((a=o==null?void 0:o.authorization)==null?void 0:a.mode)==="redirect"){(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((d=o==null?void 0:o.authorization)==null?void 0:d.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(o==null?void 0:o.providerMessage):this.warningScreen.setPaymentError("Unable to get redirect URL")}).catch(o=>{o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed"))}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}redirectToOzow(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await an(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const i=this.paymentResponse.status;i==="successful"?(this.currentStep=2,P.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),Ze(this.paymentResponse,this.paymentResponseHeaders,"success")):i==="failed"?(this.currentStep=4,P.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):i==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError("Payment Cancelled","You have cancelled the payment. Go back to merchant website to start the payment process again.","Go back to Merchant"))}catch{this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")}}renderEftContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.eftAuthenticate=new ts({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Fn({container:this.contents,amount:this.totalAmount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new De(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new gn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new hi({container:this.contents,onAction:()=>{var s;this.currentStep=4,this.warningScreen.setPaymentError(((s=this.paymentResponse)==null?void 0:s.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"eft",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.eftAuthenticate=new ts({container:this.contents,onAction:this.createEftPayment.bind(this),restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}const o=this.container.querySelector("#card-currency");o&&(o.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}}class Al{constructor({container:e,email:i,phoneNumber:t,code:o,encryption:s,merchantKey:a,modalContainer:l,amount:d,planId:v,rdtCode:p,url:g,reference:f,callBackUrl:y,metadata:w,localCurrency:C,closePayment:S}){h(this,"validChannels",[]);h(this,"disabledChannels",[]);h(this,"selectedChannel");h(this,"modalContainer");h(this,"currentPaymentMethod");h(this,"mainLayout");h(this,"mainHeader");h(this,"mainFooter");h(this,"testCard");h(this,"merchantPlanDetail",{});h(this,"mainScreen");h(this,"currency");h(this,"card");h(this,"transfer");h(this,"ussd");h(this,"mobileMoney");h(this,"eft");h(this,"encryption");h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"phoneNumber");h(this,"code");h(this,"amount",0);h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"isMobile",!1);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"closePayment");h(this,"retryingPayment");h(this,"totalAmount");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=l,this.encryption=s,this.planId=v||"",this.merchantKey=a,this.email=i,this.phoneNumber=t,this.code=o,this.amount=d||0,this.rdtCode=p||"",this.url=g||"",this.reference=f,this.mainLayout=e,this.callBackUrl=y,this.metadata=w||{},this.localCurrency=C||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=S,this.retryingPayment=!1,this.totalAmount=0}mountScreen(e,i,t,o){var a,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(a=this.merchantPlanDetail.plan)==null?void 0:a.pricingOptions)==null?void 0:l.find(d=>d.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.totalAmount=this.merchantPlanDetail.totalAmount||this.amount,this.mainHeader=new hl({container:document.getElementById("main-header"),email:this.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:d=>{this.closeBTN.bind(this)(d)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.testCard=new es({container:document.getElementById("test-container"),closeCallback:()=>{const d=document.getElementById("test-container");d&&(d.innerHTML="",d.classList.add("hidden"))}}),this.mainFooter=new is({container:document.getElementById("main-footer"),testCardContainer:document.getElementById("test-container")}),document.addEventListener("DOMContentLoaded",()=>{const d=document.getElementById("main-footer"),v=document.getElementById("test-container");new is({container:d,testCardContainer:v}).renderComponent()}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.totalAmount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{t.removeAttribute("disabled"),t.classList.remove("hidden","disabled","limit-exceeded");const o=t.querySelector(".disabled-indicator");o&&t.removeChild(o)});const i=[...this.validChannels,...this.disabledChannels];e.forEach(t=>{const o=t.getAttribute("data-name");o&&!i.includes(o)&&t.classList.add("hidden")}),this.disabledChannels.forEach(t=>{const o=Array.from(e).find(s=>s.getAttribute("data-name")===t);if(o){o.setAttribute("disabled","true"),o.classList.add("disabled","limit-exceeded"),o.setAttribute("title","Transaction amount exceeds limit for this payment method");const s=document.createElement("span");s.classList.add("disabled-indicator"),s.style.fontSize="10px",s.style.color="#FF5733",s.style.display="block",o.appendChild(s)}})}attachListeners(){const e=document.getElementById("go-back"),i=document.getElementById("select-payment-method-text");this.isMobile&&(this.currentPaymentMethod?(e&&(e.classList.add("flex","items-center","gap-2","mb-2"),e.innerHTML=` <svg width="9" height="18" viewBox="0 0 9 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1814
1814
|
<path d="M7.99984 16.9201L1.47984 10.4001C0.709844 9.63008 0.709844 8.37008 1.47984 7.60008L7.99984 1.08008" stroke="#0D0716" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1815
1815
|
</svg>
|
|
1816
1816
|
<span class="text-tone-100 font-semibold">
|