"use strict";(self.webpackChunkchatgot_client_deepsider=self.webpackChunkchatgot_client_deepsider||[]).push([[190],{28190:function(e,n,t){t.r(n),t.d(n,{confirmPaymentIntent:function(){return m},confirmPaymentIntentWithSavedCard:function(){return f},createElement:function(){return c},createPaymentConsent:function(){return A},createPaymentMethod:function(){return x},destroyElement:function(){return u},getDeviceFingerprint:function(){return h},getElement:function(){return s},getGatewayUrl:function(){return i},getPaymentIntent:function(){return y},init:function(){return w},loadAirwallex:function(){return a},loadAirwallexJs:function(){return l},redirectToCheckout:function(){return d}});const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},i=e=>`https://${r[e]||r.prod}`,o="/assets/elements.bundle.min.js?version=1.119.1",l=e=>{const n=document.createElement("script");n.src=`${e}${o}`,n.crossOrigin="anonymous";const t=document.head||document.body;if(!t)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return t.appendChild(n),n},a=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const t=async()=>{const n=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(i((null==e?void 0:e.env)||"prod"));return new Promise(((t,r)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),t(window.Airwallex)):r(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{r(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await t()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},w=e=>{window.Airwallex&&window.Airwallex.init(e)},d=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e)},c=(e,n)=>window.Airwallex?window.Airwallex.createElement(e,n):null,u=e=>!!window.Airwallex&&window.Airwallex.destroyElement(e),s=e=>window.Airwallex?window.Airwallex.getElement(e):null,m=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);throw new Error("Please loadAirwallex() before confirmPaymentIntent();")},f=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);throw new Error("Please loadAirwallex() before confirmPaymentIntentWithSavedCard();")},x=async(e,n)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,n);throw new Error("Please loadAirwallex() before createPaymentMethod();")},y=async(e,n)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,n);throw new Error("Please loadAirwallex() before getPaymentIntent();")},A=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);throw new Error("Please loadAirwallex() before createPaymentConsent();")},h=e=>window.Airwallex.getDeviceFingerprint(e);var P={getGatewayUrl:i,loadAirwallex:a,loadAirwallexJs:l,init:w,redirectToCheckout:d,createElement:c,destroyElement:u,getDeviceFingerprint:h,getElement:s,getPaymentIntent:y,createPaymentMethod:x,createPaymentConsent:A,confirmPaymentIntent:m,confirmPaymentIntentWithSavedCard:f};n.default=P}}]);