@starfish-codes/hellgate 1.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +49 -0
- package/dist/__tests__/hellgate.spec.d.ts +1 -0
- package/dist/__tests__/utils.spec.d.ts +1 -0
- package/dist/card/card-handler.d.ts +32 -0
- package/dist/card/consts.d.ts +2 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/card/typings.d.ts +34 -0
- package/dist/hellgate-sdk.mjs +3562 -0
- package/dist/hellgate-sdk.umd.js +3 -0
- package/dist/hellgate.d.ts +24 -0
- package/dist/index.d.ts +4 -0
- package/dist/manifest.json +7 -0
- package/dist/session/__tests__/fake.d.ts +4 -0
- package/dist/session/__tests__/session.spec.d.ts +1 -0
- package/dist/session/api.d.ts +16 -0
- package/dist/session/index.d.ts +3 -0
- package/dist/session/session.d.ts +21 -0
- package/dist/session/typings.d.ts +15 -0
- package/dist/untils.d.ts +3 -0
- package/package.json +69 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function($,V){typeof exports=="object"&&typeof module<"u"?V(exports):typeof define=="function"&&define.amd?define(["exports"],V):($=typeof globalThis<"u"?globalThis:$||self,V($.HellgateSDK={}))})(this,function($){"use strict";var V=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xr(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){if(this instanceof n){var s=[null];s.push.apply(s,arguments);var o=Function.bind.apply(t,s);return new o}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}var Rt={},ne={},z={};Object.defineProperty(z,"__esModule",{value:!0}),z.makeRequestWithoutElementsPayloadCheck=z.makeRequestWithElementsPayloadCheck=void 0;function Dr(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}class gt extends Dr(Error){constructor(t){super(t),this.name="NoElementsError"}}const Ur=(e,t,r,n,s={})=>{if(e!=null&&e.hasElement(n))return e.client[t](r,n,s);let o="Elements not initialized.";throw e&&(o="Element not found in payload."),new gt(`${o} Use a regular HTTP client if no elements are needed.`)};z.makeRequestWithElementsPayloadCheck=Ur;const Mr=(e,t,r,n={})=>{if(e)return e.client[t](r,n);throw new gt("Elements not initialized. Use a regular HTTP client if no elements are needed.")};z.makeRequestWithoutElementsPayloadCheck=Mr;var St={},se={},v={},_={};Object.defineProperty(_,"__esModule",{value:!0}),_.USER_AGENT_HEADER=_.USER_AGENT_CLIENT=_.MERGE_CONTENT_TYPE=_.DEFAULT_ELEMENTS_BASE_URL=_.DEFAULT_BASE_URL=_.CONTENT_TYPE_HEADER=_.CLIENT_USER_AGENT_HEADER=_.CLIENT_BASE_PATHS=_.BT_TRANSACTION_ID_HEADER=_.BT_TRACE_ID_HEADER=_.BT_IDEMPOTENCY_KEY_HEADER=_.BT_EXPOSE_PROXY_RESPONSE_HEADER=_.BROWSER_LIST=_.API_KEY_HEADER=void 0;const Ir="BT-API-KEY";_.API_KEY_HEADER=Ir;const $r="bt-trace-id";_.BT_TRACE_ID_HEADER=$r;const Hr="bt-idempotency-key";_.BT_IDEMPOTENCY_KEY_HEADER=Hr;const qr="BT-EXPOSE-RAW-PROXY-RESPONSE";_.BT_EXPOSE_PROXY_RESPONSE_HEADER=qr;const Fr="BT-TRANSACTION-ID";_.BT_TRANSACTION_ID_HEADER=Fr;const zr="Content-Type";_.CONTENT_TYPE_HEADER=zr;const kr="application/merge-patch+json";_.MERGE_CONTENT_TYPE=kr;const Gr="User-Agent";_.USER_AGENT_HEADER=Gr;const Wr="BT-CLIENT-USER-AGENT";_.CLIENT_USER_AGENT_HEADER=Wr;const Vr="BasisTheoryJS";_.USER_AGENT_CLIENT=Vr;const Kr="https://api.basistheory.com";_.DEFAULT_BASE_URL=Kr;const Jr="https://js.basistheory.com/hosted-elements";_.DEFAULT_ELEMENTS_BASE_URL=Jr;const Yr={tokens:"tokens",tokenize:"tokenize",applications:"applications",tenants:"tenants/self",logs:"logs",reactorFormulas:"reactor-formulas",reactors:"reactors",permissions:"permissions",proxies:"proxies",proxy:"proxy",sessions:"sessions",transactions:"transactions"};_.CLIENT_BASE_PATHS=Yr;const Xr=[{browserName:"Firefox",browserUA:"Firefox"},{browserName:"SamsungBrowser",browserUA:"SamsungBrowser"},{browserName:"Opera",browserUA:"Opera"},{browserName:"Opera",browserUA:"OPR"},{browserName:"Microsoft Internet Explorer",browserUA:"Trident"},{browserName:"Microsoft Edge (Legacy)",browserUA:"Edge"},{browserName:"Microsoft Edge (Chromium)",browserUA:"Edg"},{browserName:"Google Chrome/Chromium",browserUA:"Chrome"},{browserName:"Safari",browserUA:"Safari"}];_.BROWSER_LIST=Xr;var h={};function Ot(e,t){return function(){return e.apply(t,arguments)}}const{toString:Qr}=Object.prototype,{getPrototypeOf:ze}=Object,oe=(e=>t=>{const r=Qr.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),P=e=>(e=e.toLowerCase(),t=>oe(t)===e),ie=e=>t=>typeof t===e,{isArray:k}=Array,K=ie("undefined");function Zr(e){return e!==null&&!K(e)&&e.constructor!==null&&!K(e.constructor)&&C(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vt=P("ArrayBuffer");function en(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&vt(e.buffer),t}const tn=ie("string"),C=ie("function"),wt=ie("number"),ae=e=>e!==null&&typeof e=="object",rn=e=>e===!0||e===!1,ce=e=>{if(oe(e)!=="object")return!1;const t=ze(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},nn=P("Date"),sn=P("File"),on=P("Blob"),an=P("FileList"),cn=e=>ae(e)&&C(e.pipe),un=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||C(e.append)&&((t=oe(e))==="formdata"||t==="object"&&C(e.toString)&&e.toString()==="[object FormData]"))},ln=P("URLSearchParams"),dn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function J(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,s;if(typeof e!="object"&&(e=[e]),k(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let a;for(n=0;n<i;n++)a=o[n],t.call(null,e[a],a,e)}}function Ct(e,t){t=t.toLowerCase();const r=Object.keys(e);let n=r.length,s;for(;n-- >0;)if(s=r[n],t===s.toLowerCase())return s;return null}const At=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:V)(),Pt=e=>!K(e)&&e!==At;function ke(){const{caseless:e}=Pt(this)&&this||{},t={},r=(n,s)=>{const o=e&&Ct(t,s)||s;ce(t[o])&&ce(n)?t[o]=ke(t[o],n):ce(n)?t[o]=ke({},n):k(n)?t[o]=n.slice():t[o]=n};for(let n=0,s=arguments.length;n<s;n++)arguments[n]&&J(arguments[n],r);return t}const fn=(e,t,r,{allOwnKeys:n}={})=>(J(t,(s,o)=>{r&&C(s)?e[o]=Ot(s,r):e[o]=s},{allOwnKeys:n}),e),hn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),pn=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},mn=(e,t,r,n)=>{let s,o,i;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!n||n(i,e,t))&&!a[i]&&(t[i]=e[i],a[i]=!0);e=r!==!1&&ze(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},En=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},_n=e=>{if(!e)return null;if(k(e))return e;let t=e.length;if(!wt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},bn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ze(Uint8Array)),yn=(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=n.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Tn=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Rn=P("HTMLFormElement"),gn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),Bt=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Sn=P("RegExp"),Nt=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};J(r,(s,o)=>{t(s,o,e)!==!1&&(n[o]=s)}),Object.defineProperties(e,n)},On=e=>{Nt(e,(t,r)=>{if(C(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(C(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},vn=(e,t)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return k(e)?n(e):n(String(e).split(t)),r},wn=()=>{},Cn=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Ge="abcdefghijklmnopqrstuvwxyz",jt="0123456789",Lt={DIGIT:jt,ALPHA:Ge,ALPHA_DIGIT:Ge+Ge.toUpperCase()+jt},An=(e=16,t=Lt.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r};function Pn(e){return!!(e&&C(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Bn=e=>{const t=new Array(10),r=(n,s)=>{if(ae(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[s]=n;const o=k(n)?[]:{};return J(n,(i,a)=>{const d=r(i,s+1);!K(d)&&(o[a]=d)}),t[s]=void 0,o}}return n};return r(e,0)},Nn=P("AsyncFunction");var c={isArray:k,isArrayBuffer:vt,isBuffer:Zr,isFormData:un,isArrayBufferView:en,isString:tn,isNumber:wt,isBoolean:rn,isObject:ae,isPlainObject:ce,isUndefined:K,isDate:nn,isFile:sn,isBlob:on,isRegExp:Sn,isFunction:C,isStream:cn,isURLSearchParams:ln,isTypedArray:bn,isFileList:an,forEach:J,merge:ke,extend:fn,trim:dn,stripBOM:hn,inherits:pn,toFlatObject:mn,kindOf:oe,kindOfTest:P,endsWith:En,toArray:_n,forEachEntry:yn,matchAll:Tn,isHTMLForm:Rn,hasOwnProperty:Bt,hasOwnProp:Bt,reduceDescriptors:Nt,freezeMethods:On,toObjectSet:vn,toCamelCase:gn,noop:wn,toFiniteNumber:Cn,findKey:Ct,global:At,isContextDefined:Pt,ALPHABET:Lt,generateString:An,isSpecCompliantForm:Pn,toJSONObject:Bn,isAsyncFn:Nn,isThenable:e=>e&&(ae(e)||C(e))&&C(e.then)&&C(e.catch)};function E(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s)}c.inherits(E,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const xt=E.prototype,Dt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Dt[e]={value:e}}),Object.defineProperties(E,Dt),Object.defineProperty(xt,"isAxiosError",{value:!0}),E.from=(e,t,r,n,s,o)=>{const i=Object.create(xt);return c.toFlatObject(e,i,function(d){return d!==Error.prototype},a=>a!=="isAxiosError"),E.call(i,e.message,t,r,n,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};var jn=null;function We(e){return c.isPlainObject(e)||c.isArray(e)}function Ut(e){return c.endsWith(e,"[]")?e.slice(0,-2):e}function Mt(e,t,r){return e?e.concat(t).map(function(s,o){return s=Ut(s),!r&&o?"["+s+"]":s}).join(r?".":""):t}function Ln(e){return c.isArray(e)&&!e.some(We)}const xn=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function ue(e,t,r){if(!c.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=c.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,U){return!c.isUndefined(U[m])});const n=r.metaTokens,s=r.visitor||l,o=r.dots,i=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(t);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(c.isDate(p))return p.toISOString();if(!d&&c.isBlob(p))throw new E("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(p)||c.isTypedArray(p)?d&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function l(p,m,U){let A=p;if(p&&!U&&typeof p=="object"){if(c.endsWith(m,"{}"))m=n?m:m.slice(0,-2),p=JSON.stringify(p);else if(c.isArray(p)&&Ln(p)||(c.isFileList(p)||c.endsWith(m,"[]"))&&(A=c.toArray(p)))return m=Ut(m),A.forEach(function(Fe,Ii){!(c.isUndefined(Fe)||Fe===null)&&t.append(i===!0?Mt([m],Ii,o):i===null?m:m+"[]",u(Fe))}),!1}return We(p)?!0:(t.append(Mt(U,m,o),u(p)),!1)}const f=[],y=Object.assign(xn,{defaultVisitor:l,convertValue:u,isVisitable:We});function T(p,m){if(!c.isUndefined(p)){if(f.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(p),c.forEach(p,function(A,W){(!(c.isUndefined(A)||A===null)&&s.call(t,A,c.isString(W)?W.trim():W,m,y))===!0&&T(A,m?m.concat(W):[W])}),f.pop()}}if(!c.isObject(e))throw new TypeError("data must be an object");return T(e),t}function It(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Ve(e,t){this._pairs=[],e&&ue(e,this,t)}const $t=Ve.prototype;$t.append=function(t,r){this._pairs.push([t,r])},$t.toString=function(t){const r=t?function(n){return t.call(this,n,It)}:It;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function Dn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ht(e,t,r){if(!t)return e;const n=r&&r.encode||Dn,s=r&&r.serialize;let o;if(s?o=s(t,r):o=c.isURLSearchParams(t)?t.toString():new Ve(t,r).toString(n),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Un{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){c.forEach(this.handlers,function(n){n!==null&&t(n)})}}var qt=Un,Ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Mn=typeof URLSearchParams<"u"?URLSearchParams:Ve,In=typeof FormData<"u"?FormData:null,$n=typeof Blob<"u"?Blob:null;const Hn=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),qn=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")();var B={isBrowser:!0,classes:{URLSearchParams:Mn,FormData:In,Blob:$n},isStandardBrowserEnv:Hn,isStandardBrowserWebWorkerEnv:qn,protocols:["http","https","file","blob","url","data"]};function Fn(e,t){return ue(e,new B.classes.URLSearchParams,Object.assign({visitor:function(r,n,s,o){return B.isNode&&c.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function zn(e){return c.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function kn(e){const t={},r=Object.keys(e);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],t[o]=e[o];return t}function zt(e){function t(r,n,s,o){let i=r[o++];const a=Number.isFinite(+i),d=o>=r.length;return i=!i&&c.isArray(s)?s.length:i,d?(c.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!a):((!s[i]||!c.isObject(s[i]))&&(s[i]=[]),t(r,n,s[i],o)&&c.isArray(s[i])&&(s[i]=kn(s[i])),!a)}if(c.isFormData(e)&&c.isFunction(e.entries)){const r={};return c.forEachEntry(e,(n,s)=>{t(zn(n),s,r,0)}),r}return null}const Gn={"Content-Type":void 0};function Wn(e,t,r){if(c.isString(e))try{return(t||JSON.parse)(e),c.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const le={transitional:Ft,adapter:["xhr","http"],transformRequest:[function(t,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=c.isObject(t);if(o&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return s&&s?JSON.stringify(zt(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Fn(t,this.formSerializer).toString();if((a=c.isFileList(t))||n.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return ue(a?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Wn(t)):t}],transformResponse:[function(t){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(t&&c.isString(t)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(a){if(i)throw a.name==="SyntaxError"?E.from(a,E.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:B.classes.FormData,Blob:B.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};c.forEach(["delete","get","head"],function(t){le.headers[t]={}}),c.forEach(["post","put","patch"],function(t){le.headers[t]=c.merge(Gn)});var Ke=le;const Vn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var Kn=e=>{const t={};let r,n,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||t[r]&&Vn[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};const kt=Symbol("internals");function Y(e){return e&&String(e).trim().toLowerCase()}function de(e){return e===!1||e==null?e:c.isArray(e)?e.map(de):String(e)}function Jn(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const Yn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Je(e,t,r,n,s){if(c.isFunction(n))return n.call(this,t,r);if(s&&(t=r),!!c.isString(t)){if(c.isString(n))return t.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(t)}}function Xn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function Qn(e,t){const r=c.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(s,o,i){return this[n].call(this,t,s,o,i)},configurable:!0})})}class fe{constructor(t){t&&this.set(t)}set(t,r,n){const s=this;function o(a,d,u){const l=Y(d);if(!l)throw new Error("header name must be a non-empty string");const f=c.findKey(s,l);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||d]=de(a))}const i=(a,d)=>c.forEach(a,(u,l)=>o(u,l,d));return c.isPlainObject(t)||t instanceof this.constructor?i(t,r):c.isString(t)&&(t=t.trim())&&!Yn(t)?i(Kn(t),r):t!=null&&o(r,t,n),this}get(t,r){if(t=Y(t),t){const n=c.findKey(this,t);if(n){const s=this[n];if(!r)return s;if(r===!0)return Jn(s);if(c.isFunction(r))return r.call(this,s,n);if(c.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Y(t),t){const n=c.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Je(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let s=!1;function o(i){if(i=Y(i),i){const a=c.findKey(n,i);a&&(!r||Je(n,n[a],a,r))&&(delete n[a],s=!0)}}return c.isArray(t)?t.forEach(o):o(t),s}clear(t){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!t||Je(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const r=this,n={};return c.forEach(this,(s,o)=>{const i=c.findKey(n,o);if(i){r[i]=de(s),delete r[o];return}const a=t?Xn(o):String(o).trim();a!==o&&delete r[o],r[a]=de(s),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return c.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=t&&c.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(s=>n.set(s)),n}static accessor(t){const n=(this[kt]=this[kt]={accessors:{}}).accessors,s=this.prototype;function o(i){const a=Y(i);n[a]||(Qn(s,i),n[a]=!0)}return c.isArray(t)?t.forEach(o):o(t),this}}fe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.freezeMethods(fe.prototype),c.freezeMethods(fe);var x=fe;function Ye(e,t){const r=this||Ke,n=t||r,s=x.from(n.headers);let o=n.data;return c.forEach(e,function(a){o=a.call(r,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Gt(e){return!!(e&&e.__CANCEL__)}function X(e,t,r){E.call(this,e??"canceled",E.ERR_CANCELED,t,r),this.name="CanceledError"}c.inherits(X,E,{__CANCEL__:!0});function Zn(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new E("Request failed with status code "+r.status,[E.ERR_BAD_REQUEST,E.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var es=B.isStandardBrowserEnv?function(){return{write:function(r,n,s,o,i,a){const d=[];d.push(r+"="+encodeURIComponent(n)),c.isNumber(s)&&d.push("expires="+new Date(s).toGMTString()),c.isString(o)&&d.push("path="+o),c.isString(i)&&d.push("domain="+i),a===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(r){const n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function ts(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function rs(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Wt(e,t){return e&&!ts(t)?rs(e,t):t}var ns=B.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");let n;function s(o){let i=o;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(i){const a=c.isString(i)?s(i):i;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function ss(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function os(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=n[o];i||(i=u),r[s]=d,n[s]=u;let f=o,y=0;for(;f!==s;)y+=r[f++],f=f%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const T=l&&u-l;return T?Math.round(y*1e3/T):void 0}}function Vt(e,t){let r=0;const n=os(50,250);return s=>{const o=s.loaded,i=s.lengthComputable?s.total:void 0,a=o-r,d=n(a),u=o<=i;r=o;const l={loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:d||void 0,estimated:d&&i&&u?(i-o)/d:void 0,event:s};l[t?"download":"upload"]=!0,e(l)}}var is=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,n){let s=e.data;const o=x.from(e.headers).normalize(),i=e.responseType;let a;function d(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}c.isFormData(s)&&(B.isStandardBrowserEnv||B.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.setContentType("multipart/form-data;",!1));let u=new XMLHttpRequest;if(e.auth){const T=e.auth.username||"",p=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(T+":"+p))}const l=Wt(e.baseURL,e.url);u.open(e.method.toUpperCase(),Ht(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function f(){if(!u)return;const T=x.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!i||i==="text"||i==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:T,config:e,request:u};Zn(function(A){r(A),d()},function(A){n(A),d()},m),u=null}if("onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(f)},u.onabort=function(){u&&(n(new E("Request aborted",E.ECONNABORTED,e,u)),u=null)},u.onerror=function(){n(new E("Network Error",E.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let p=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const m=e.transitional||Ft;e.timeoutErrorMessage&&(p=e.timeoutErrorMessage),n(new E(p,m.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,e,u)),u=null},B.isStandardBrowserEnv){const T=(e.withCredentials||ns(l))&&e.xsrfCookieName&&es.read(e.xsrfCookieName);T&&o.set(e.xsrfHeaderName,T)}s===void 0&&o.setContentType(null),"setRequestHeader"in u&&c.forEach(o.toJSON(),function(p,m){u.setRequestHeader(m,p)}),c.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&i!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Vt(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Vt(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=T=>{u&&(n(!T||T.type?new X(null,e,u):T),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const y=ss(l);if(y&&B.protocols.indexOf(y)===-1){n(new E("Unsupported protocol "+y+":",E.ERR_BAD_REQUEST,e));return}u.send(s||null)})};const he={http:jn,xhr:is};c.forEach(he,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var as={getAdapter:e=>{e=c.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let s=0;s<t&&(r=e[s],!(n=c.isString(r)?he[r.toLowerCase()]:r));s++);if(!n)throw n===!1?new E(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(c.hasOwnProp(he,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`);if(!c.isFunction(n))throw new TypeError("adapter is not a function");return n},adapters:he};function Xe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new X(null,e)}function Kt(e){return Xe(e),e.headers=x.from(e.headers),e.data=Ye.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),as.getAdapter(e.adapter||Ke.adapter)(e).then(function(n){return Xe(e),n.data=Ye.call(e,e.transformResponse,n),n.headers=x.from(n.headers),n},function(n){return Gt(n)||(Xe(e),n&&n.response&&(n.response.data=Ye.call(e,e.transformResponse,n.response),n.response.headers=x.from(n.response.headers))),Promise.reject(n)})}const Jt=e=>e instanceof x?e.toJSON():e;function G(e,t){t=t||{};const r={};function n(u,l,f){return c.isPlainObject(u)&&c.isPlainObject(l)?c.merge.call({caseless:f},u,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function s(u,l,f){if(c.isUndefined(l)){if(!c.isUndefined(u))return n(void 0,u,f)}else return n(u,l,f)}function o(u,l){if(!c.isUndefined(l))return n(void 0,l)}function i(u,l){if(c.isUndefined(l)){if(!c.isUndefined(u))return n(void 0,u)}else return n(void 0,l)}function a(u,l,f){if(f in t)return n(u,l);if(f in e)return n(void 0,u)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,l)=>s(Jt(u),Jt(l),!0)};return c.forEach(Object.keys(Object.assign({},e,t)),function(l){const f=d[l]||s,y=f(e[l],t[l],l);c.isUndefined(y)&&f!==a||(r[l]=y)}),r}const Yt="1.4.0",Qe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qe[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Xt={};Qe.transitional=function(t,r,n){function s(o,i){return"[Axios v"+Yt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,a)=>{if(t===!1)throw new E(s(i," has been removed"+(r?" in "+r:"")),E.ERR_DEPRECATED);return r&&!Xt[i]&&(Xt[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,i,a):!0}};function cs(e,t,r){if(typeof e!="object")throw new E("options must be an object",E.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const o=n[s],i=t[o];if(i){const a=e[o],d=a===void 0||i(a,o,e);if(d!==!0)throw new E("option "+o+" must be "+d,E.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new E("Unknown option "+o,E.ERR_BAD_OPTION)}}var Ze={assertOptions:cs,validators:Qe};const M=Ze.validators;class pe{constructor(t){this.defaults=t,this.interceptors={request:new qt,response:new qt}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=G(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&Ze.assertOptions(n,{silentJSONParsing:M.transitional(M.boolean),forcedJSONParsing:M.transitional(M.boolean),clarifyTimeoutError:M.transitional(M.boolean)},!1),s!=null&&(c.isFunction(s)?r.paramsSerializer={serialize:s}:Ze.assertOptions(s,{encode:M.function,serialize:M.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i;i=o&&c.merge(o.common,o[r.method]),i&&c.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),r.headers=x.concat(i,o);const a=[];let d=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(r)===!1||(d=d&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,f=0,y;if(!d){const p=[Kt.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,u),y=p.length,l=Promise.resolve(r);f<y;)l=l.then(p[f++],p[f++]);return l}y=a.length;let T=r;for(f=0;f<y;){const p=a[f++],m=a[f++];try{T=p(T)}catch(U){m.call(this,U);break}}try{l=Kt.call(this,T)}catch(p){return Promise.reject(p)}for(f=0,y=u.length;f<y;)l=l.then(u[f++],u[f++]);return l}getUri(t){t=G(this.defaults,t);const r=Wt(t.baseURL,t.url);return Ht(r,t.params,t.paramsSerializer)}}c.forEach(["delete","get","head","options"],function(t){pe.prototype[t]=function(r,n){return this.request(G(n||{},{method:t,url:r,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(t){function r(n){return function(o,i,a){return this.request(G(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}pe.prototype[t]=r(),pe.prototype[t+"Form"]=r(!0)});var me=pe;class et{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(a=>{n.subscribe(a),o=a}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},t(function(o,i,a){n.reason||(n.reason=new X(o,i,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new et(function(s){t=s}),cancel:t}}}var us=et;function ls(e){return function(r){return e.apply(null,r)}}function ds(e){return c.isObject(e)&&e.isAxiosError===!0}const tt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(tt).forEach(([e,t])=>{tt[t]=e});var fs=tt;function Qt(e){const t=new me(e),r=Ot(me.prototype.request,t);return c.extend(r,me.prototype,t,{allOwnKeys:!0}),c.extend(r,t,null,{allOwnKeys:!0}),r.create=function(s){return Qt(G(e,s))},r}const g=Qt(Ke);g.Axios=me,g.CanceledError=X,g.CancelToken=us,g.isCancel=Gt,g.VERSION=Yt,g.toFormData=ue,g.AxiosError=E,g.Cancel=g.CanceledError,g.all=function(t){return Promise.all(t)},g.spread=ls,g.isAxiosError=ds,g.mergeConfig=G,g.AxiosHeaders=x,g.formToJSON=e=>zt(c.isHTMLForm(e)?new FormData(e):e),g.HttpStatusCode=fs,g.default=g;var Zt=g,rt={exports:{}};const er=e=>typeof e=="object"&&e!==null,tr=Symbol("skip"),rr=e=>er(e)&&!(e instanceof RegExp)&&!(e instanceof Error)&&!(e instanceof Date),nt=(e,t,r,n=new WeakMap)=>{if(r={deep:!1,target:{},...r},n.has(e))return n.get(e);n.set(e,r.target);const{target:s}=r;delete r.target;const o=i=>i.map(a=>rr(a)?nt(a,t,r,n):a);if(Array.isArray(e))return o(e);for(const[i,a]of Object.entries(e)){const d=t(i,a,e);if(d===tr)continue;let[u,l,{shouldRecurse:f=!0}={}]=d;u!=="__proto__"&&(r.deep&&f&&rr(l)&&(l=Array.isArray(l)?o(l):nt(l,t,r,n)),s[u]=l)}return s};rt.exports=(e,t,r)=>{if(!er(e))throw new TypeError(`Expected an object, got \`${e}\` (${typeof e})`);return nt(e,t,r)},rt.exports.mapObjectSkip=tr;var nr=rt.exports,st={exports:{}};const hs=e=>{let t=!1,r=!1,n=!1;for(let s=0;s<e.length;s++){const o=e[s];t&&/[a-zA-Z]/.test(o)&&o.toUpperCase()===o?(e=e.slice(0,s)+"-"+e.slice(s),t=!1,n=r,r=!0,s++):r&&n&&/[a-zA-Z]/.test(o)&&o.toLowerCase()===o?(e=e.slice(0,s-1)+"-"+e.slice(s-1),n=r,r=!1,t=!0):(t=o.toLowerCase()===o&&o.toUpperCase()!==o,n=r,r=o.toUpperCase()===o&&o.toLowerCase()!==o)}return e},sr=(e,t)=>{if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");t=Object.assign({pascalCase:!1},t);const r=s=>t.pascalCase?s.charAt(0).toUpperCase()+s.slice(1):s;return Array.isArray(e)?e=e.map(s=>s.trim()).filter(s=>s.length).join("-"):e=e.trim(),e.length===0?"":e.length===1?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=hs(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(s,o)=>o.toUpperCase()).replace(/\d+(\w|$)/g,s=>s.toUpperCase()),r(e))};st.exports=sr,st.exports.default=sr;var ps=st.exports;class ms{constructor(t={}){if(!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=t.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(t,r){this.cache.set(t,r),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t)){const r=this.oldCache.get(t);return this.oldCache.delete(t),this._set(t,r),r}}set(t,r){return this.cache.has(t)?this.cache.set(t,r):this._set(t,r),this}has(t){return this.cache.has(t)||this.oldCache.has(t)}peek(t){if(this.cache.has(t))return this.cache.get(t);if(this.oldCache.has(t))return this.oldCache.get(t)}delete(t){const r=this.cache.delete(t);return r&&this._size--,this.oldCache.delete(t)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache)yield t;for(const t of this.oldCache){const[r]=t;this.cache.has(r)||(yield t)}}get size(){let t=0;for(const r of this.oldCache.keys())this.cache.has(r)||t++;return this._size+t}}var Es=ms;const or=nr,_s=ps,bs=Es,ys=(e,t)=>e.some(r=>typeof r=="string"?r===t:(r.lastIndex=0,r.test(t))),ot=new bs({maxSize:1e5}),ir=e=>typeof e=="object"&&e!==null&&!(e instanceof RegExp)&&!(e instanceof Error)&&!(e instanceof Date),ar=(e,t)=>{if(!ir(e))return e;t={deep:!1,pascalCase:!1,...t};const{exclude:r,pascalCase:n,stopPaths:s,deep:o}=t,i=new Set(s),a=d=>(u,l)=>{if(o&&ir(l)){const f=d===void 0?u:`${d}.${u}`;i.has(f)||(l=or(l,a(f)))}if(!(r&&ys(r,u))){const f=n?`${u}_`:u;if(ot.has(f))u=ot.get(f);else{const y=_s(u,{pascalCase:n});u.length<100&&ot.set(f,y),u=y}}return[u,l]};return or(e,a(void 0))};var Ts=(e,t)=>Array.isArray(e)?Object.keys(e).map(r=>ar(e[r],t)):ar(e,t),it,cr;function ur(){return cr||(cr=1,it=ur()),it}var Ee=function(){return Ee=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},Ee.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Rs(e){return e.toLowerCase()}var gs=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Ss=/[^A-Z0-9]+/gi;function Os(e,t){t===void 0&&(t={});for(var r=t.splitRegexp,n=r===void 0?gs:r,s=t.stripRegexp,o=s===void 0?Ss:s,i=t.transform,a=i===void 0?Rs:i,d=t.delimiter,u=d===void 0?" ":d,l=lr(lr(e,n,"$1\0$2"),o,"\0"),f=0,y=l.length;l.charAt(f)==="\0";)f++;for(;l.charAt(y-1)==="\0";)y--;return l.slice(f,y).split("\0").map(a).join(u)}function lr(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce(function(n,s){return n.replace(s,r)},e)}function vs(e,t){return t===void 0&&(t={}),Os(e,Ee({delimiter:"."},t))}function ws(e,t){return t===void 0&&(t={}),vs(e,Ee({delimiter:"_"},t))}const Cs=xr(Object.freeze(Object.defineProperty({__proto__:null,snakeCase:ws},Symbol.toStringTag,{value:"Module"})));var As=js,Ps=/\s/,Bs=/(_|-|\.|:)/,Ns=/([a-z][A-Z]|[A-Z][a-z])/;function js(e){return Ps.test(e)?e.toLowerCase():Bs.test(e)?(xs(e)||e).toLowerCase():Ns.test(e)?Us(e).toLowerCase():e.toLowerCase()}var Ls=/[\W_]+(.|$)/g;function xs(e){return e.replace(Ls,function(t,r){return r?" "+r:""})}var Ds=/(.)([A-Z]+)/g;function Us(e){return e.replace(Ds,function(t,r,n){return r+" "+n.toLowerCase().split("").join(" ")})}var Ms=As,Is=$s;function $s(e){return Ms(e).replace(/[\W_]+(.|$)/g,function(t,r){return r?" "+r:""}).trim()}var Hs=Is,qs=Fs;function Fs(e){return Hs(e).replace(/\s/g,"_")}const zs=nr,ks=qs;var Gs=function(e,t){return t=Object.assign({deep:!0,exclude:[]},t),zs(e,function(r,n){return[Ws(t.exclude,r)?r:ks(r),n]},t)};function Ws(e,t){return e.some(function(r){return typeof r=="string"?r===t:r.test(t)})}var Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.BasisTheoryApiError=void 0;function Vs(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}class at extends Vs(Error){constructor(t,r,n){super(t),this.status=r,this.data=n,this.name="BasisTheoryApiError",Object.setPrototypeOf(this,at.prototype)}}Q.BasisTheoryApiError=at,Object.defineProperty(h,"__esModule",{value:!0}),h.transformTokenResponseCamelCase=h.transformTokenRequestSnakeCase=h.transformResponseCamelCase=h.transformRequestSnakeCase=h.transformReactorResponseCamelCase=h.transformReactorRequestSnakeCase=h.transformProxyResponseCamelCase=h.transformProxyRequestSnakeCase=h.proxyRaw=h.getRuntime=h.getQueryParams=h.getOSVersion=h.getBrowser=h.errorInterceptor=h.dataExtractor=h.dataAndHeadersExtractor=h.createRequestConfig=h.concatResponseTransformerWithDefault=h.concatRequestTransformerWithDefault=h.buildUserAgentString=h.buildClientUserAgentString=h.assertInit=void 0;var dr=_e(Zt),N=_e(Ts),fr=_e(ur()),Ks=Cs,Z=_e(Gs),Js=Q,H=_;function _e(e){return e&&e.__esModule?e:{default:e}}const Ys=e=>{if(e==null)throw new Error("BasisTheory has not yet been properly initialized.");return e};h.assertInit=Ys;const Xs=e=>{if(!(typeof e>"u"))return(0,Z.default)(e,{deep:!0})};h.transformRequestSnakeCase=Xs;const Qs=e=>e;h.proxyRaw=Qs;const Zs=e=>{if(!(typeof e>"u"))return{...(0,Z.default)(e,{deep:!0}),...e.configuration!==void 0?{configuration:e.configuration}:{}}};h.transformReactorRequestSnakeCase=Zs;const eo=e=>{if(!(typeof e>"u"))return{...(0,Z.default)(e,{deep:!0}),...e.configuration!==void 0?{configuration:e.configuration}:{}}};h.transformProxyRequestSnakeCase=eo;const to=e=>{if(!(typeof e>"u"))return{...(0,Z.default)(e,{deep:!0}),...e.data!==void 0?{data:e.data}:{},...e.metadata!==void 0?{metadata:e.metadata}:{}}};h.transformTokenRequestSnakeCase=to;const ct=e=>e&&(e==null?void 0:e.pagination)!==void 0&&(e==null?void 0:e.data)!==void 0,ro=e=>{if(!(typeof e>"u"))return ct(e)?{data:e.data.map(n=>({...(0,N.default)(n,{deep:!0}),...n.data!==void 0?{data:n.data}:{},...n.metadata!==void 0?{metadata:n.metadata}:{}})),pagination:(0,N.default)(e.pagination,{deep:!0})}:{...(0,N.default)(e,{deep:!0}),...e.data!==void 0?{data:e.data}:{},...e.metadata!==void 0?{metadata:e.metadata}:{}}};h.transformTokenResponseCamelCase=ro;const no=e=>{if(!(typeof e>"u"))return ct(e)?{data:e.data.map(n=>({...(0,N.default)(n,{deep:!0}),...n.configuration!==void 0?{configuration:n.configuration}:{}})),pagination:(0,N.default)(e.pagination,{deep:!0})}:{...(0,N.default)(e,{deep:!0}),...e.configuration!==void 0?{configuration:e.configuration}:{}}};h.transformReactorResponseCamelCase=no;const so=e=>{if(!(typeof e>"u"))return ct(e)?{data:e.data.map(n=>({...(0,N.default)(n,{deep:!0}),...n.configuration!==void 0?{configuration:n.configuration}:{}})),pagination:(0,N.default)(e.pagination,{deep:!0})}:{...(0,N.default)(e,{deep:!0}),...e.configuration!==void 0?{configuration:e.configuration}:{}}};h.transformProxyResponseCamelCase=so;const oo=e=>{if(!(typeof e>"u"))return(0,N.default)(e,{deep:!0})};h.transformResponseCamelCase=oo;const io=e=>e==null?void 0:e.data;h.dataExtractor=io;const ao=e=>({data:e==null?void 0:e.data,headers:e==null?void 0:e.headers});h.dataAndHeadersExtractor=ao;const ut=e=>[e,...dr.default.defaults.transformRequest];h.concatRequestTransformerWithDefault=ut;const lt=e=>[...dr.default.defaults.transformResponse,e];h.concatResponseTransformerWithDefault=lt;const co=(e,t)=>{if(!e)return t?{...t.transformRequest!==void 0?{transformRequest:ut(t.transformRequest)}:{},...t.transformResponse!==void 0?{transformResponse:lt(t.transformResponse)}:{}}:void 0;const{apiKey:r,correlationId:n,idempotencyKey:s,transactionId:o,query:i,headers:a}=e,d=r?{[H.API_KEY_HEADER]:r}:{},u=n?{[H.BT_TRACE_ID_HEADER]:n}:{},l=s?{[H.BT_IDEMPOTENCY_KEY_HEADER]:s}:{},f=o?{[H.BT_TRANSACTION_ID_HEADER]:o}:{};return{headers:{...d,...u,...l,...f,...typeof a<"u"&&{...a}},...typeof i<"u"&&{params:i},...(t==null?void 0:t.transformRequest)!==void 0?{transformRequest:ut(t.transformRequest)}:{},...(t==null?void 0:t.transformResponse)!==void 0?{transformResponse:lt(t.transformResponse)}:{}}};h.createRequestConfig=co;const uo=e=>{var t,r;const n=((t=e.response)===null||t===void 0?void 0:t.status)||-1,s=(r=e.response)===null||r===void 0?void 0:r.data;throw new Js.BasisTheoryApiError(e.message,n,s)};h.errorInterceptor=uo;const lo=(e={})=>{const t=Object.keys(e);if(t.length){const r=new URLSearchParams,n=(s,o,i=!1)=>{const a=typeof o,d=i?s:(0,Ks.snakeCase)(s);(o===null||["boolean","number","string"].includes(a))&&r.append(d,o)};return t.forEach(s=>{const o=e[s];Array.isArray(o)?o.forEach(i=>{n(String(s),i)}):o&&typeof o=="object"?Object.keys(o).forEach(a=>{n(`${String(s)}.${a}`,o[a],!0)}):n(String(s),o)}),`?${r.toString()}`}return""};h.getQueryParams=lo;const fo=e=>`(${e.name||""}; ${e.version||""}; ${e.url||""})`,ho=e=>{let t=`${H.USER_AGENT_CLIENT}/unknown`;return e&&Object.keys(e||{}).length&&(t+=` ${fo(e)}`),t};h.buildUserAgentString=ho;const hr=()=>{const{userAgent:e}=window.navigator;let t="unknown";const r=H.BROWSER_LIST.find(n=>e.includes(n.browserUA));if(r)try{t=e.split(`${r.browserUA}/`)[1]}catch{t="unknown"}return`${(r==null?void 0:r.browserName)||"unknown"}/${t}`};h.getBrowser=hr;const pr=()=>{if(typeof window>"u")try{return`${fr.default.type()}/${fr.default.version()}`}catch{return"unknown"}try{const t=window.navigator.appVersion.match(/\(([^)]+)\)/u);return t&&t.length>1?t[1]:"unknown"}catch{return"unknown"}};h.getOSVersion=pr;const mr=()=>typeof window>"u"?`NodeJS/${process.version}`:hr();h.getRuntime=mr;const po=e=>{const t={client:H.USER_AGENT_CLIENT,clientVersion:"unknown",osVersion:pr(),runtimeVersion:mr(),application:{}};return e&&(t.application=e),JSON.stringify((0,Z.default)(t))};h.buildClientUserAgentString=po;var be={};Object.defineProperty(be,"__esModule",{value:!0}),be.BasisTheoryValidationError=void 0;function mo(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}class dt extends mo(Error){constructor(t,r,n){super(t),this.details=r,this.validation=n,this.name="BasisTheoryValidationError",Object.setPrototypeOf(this,dt.prototype)}}be.BasisTheoryValidationError=dt;var ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.HttpClientError=void 0;function Eo(e){function t(){var r=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}class ft extends Eo(Error){constructor(t,r,n,s){super(t),this.name="HttpClientError",this.status=r,this.data=n,this.headers=s,Object.setPrototypeOf(this,ft.prototype)}}ye.HttpClientError=ft,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t={BasisTheoryApiError:!0,BasisTheoryValidationError:!0,HttpClientError:!0};Object.defineProperty(e,"BasisTheoryApiError",{enumerable:!0,get:function(){return s.BasisTheoryApiError}}),Object.defineProperty(e,"BasisTheoryValidationError",{enumerable:!0,get:function(){return o.BasisTheoryValidationError}}),Object.defineProperty(e,"HttpClientError",{enumerable:!0,get:function(){return i.HttpClientError}});var r=_;Object.keys(r).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(t,a)||a in e&&e[a]===r[a]||Object.defineProperty(e,a,{enumerable:!0,get:function(){return r[a]}})});var n=h;Object.keys(n).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(t,a)||a in e&&e[a]===n[a]||Object.defineProperty(e,a,{enumerable:!0,get:function(){return n[a]}})});var s=Q,o=be,i=ye}(v);var w={},_o={},Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.BasisTheoryService=void 0;var ht=bo(Zt),I=v;function bo(e){return e&&e.__esModule?e:{default:e}}class yo{constructor(t){const{apiKey:r,baseURL:n,transformRequest:s,transformResponse:o,appInfo:i}=t;this.client=ht.default.create({baseURL:n,headers:{[I.API_KEY_HEADER]:r,[I.CLIENT_USER_AGENT_HEADER]:(0,I.buildClientUserAgentString)(i),...typeof window>"u"&&{[I.USER_AGENT_HEADER]:(0,I.buildUserAgentString)(i)}},transformRequest:[].concat(s||I.transformRequestSnakeCase,ht.default.defaults.transformRequest),transformResponse:ht.default.defaults.transformResponse.concat(o||I.transformResponseCamelCase)}),this.client.interceptors.response.use(void 0,I.errorInterceptor)}}Te.BasisTheoryService=yo,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=_o;Object.keys(t).forEach(function(n){n==="default"||n==="__esModule"||n in e&&e[n]===t[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var r=Te;Object.keys(r).forEach(function(n){n==="default"||n==="__esModule"||n in e&&e[n]===r[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r[n]}})})}(w),Object.defineProperty(se,"__esModule",{value:!0}),se.BasisTheoryTransactions=void 0;var pt=v,ee=h,To=w;class Ro extends To.BasisTheoryService{constructor(t){const r={...t};r.transformRequest=[].concat(ee.transformProxyRequestSnakeCase,t.transformRequest||[]),r.transformResponse=[].concat(ee.transformProxyResponseCamelCase,t.transformResponse||[]),super(r)}create(t={}){return this.client.post("/",void 0,(0,pt.createRequestConfig)(t)).then(ee.dataExtractor)}commit(t,r={}){const n=`/${t}/commit`;return this.client.post(n,void 0,(0,pt.createRequestConfig)(r)).then(ee.dataExtractor)}rollback(t,r={}){const n=`/${t}/rollback`;return this.client.post(n,void 0,(0,pt.createRequestConfig)(r)).then(ee.dataExtractor)}}se.BasisTheoryTransactions=Ro,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=se;Object.keys(t).forEach(function(r){r==="default"||r==="__esModule"||r in e&&e[r]===t[r]||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})}(St);var mt={},Re={},j={};Object.defineProperty(j,"__esModule",{value:!0}),j.CrudBuilder=void 0;var O=v;const go=e=>class extends e{create(r,n){return this.client.post("/",r,(0,O.createRequestConfig)(n)).then(O.dataExtractor)}},So=e=>class extends e{retrieve(r,n){return this.client.get(r,(0,O.createRequestConfig)(n)).then(O.dataExtractor)}},Oo=e=>class extends e{update(r,n,s){return this.client.put(r,n,(0,O.createRequestConfig)(s)).then(O.dataExtractor)}},vo=e=>class extends e{patch(r,n,s){const o=(0,O.createRequestConfig)(s);return this.client.patch(r,n,{...o,headers:{...(o==null?void 0:o.headers)||{},[O.CONTENT_TYPE_HEADER]:O.MERGE_CONTENT_TYPE}}).then(O.dataExtractor)}},wo=e=>class extends e{async delete(r,n){await this.client.delete(r,(0,O.createRequestConfig)(n))}},Co=e=>class extends e{list(r={},n={}){const s=`/${(0,O.getQueryParams)(r)}`;return this.client.get(s,(0,O.createRequestConfig)(n)).then(O.dataExtractor)}};class Ao{constructor(t){this.BaseService=t}create(){return this.BaseService=go(this.BaseService),this}retrieve(){return this.BaseService=So(this.BaseService),this}update(){return this.BaseService=Oo(this.BaseService),this}patch(){return this.BaseService=vo(this.BaseService),this}delete(){return this.BaseService=wo(this.BaseService),this}list(){return this.BaseService=Co(this.BaseService),this}build(){return this.BaseService}}j.CrudBuilder=Ao,Object.defineProperty(Re,"__esModule",{value:!0}),Re.BasisTheoryApplications=void 0;var ge=v,Po=w,Bo=j;const No=new Bo.CrudBuilder(class extends Po.BasisTheoryService{getApplicationByKey(){return this.retrieveByKey()}retrieveByKey(t){return this.client.get("/key",(0,ge.createRequestConfig)(t)).then(ge.dataExtractor)}regenerateKey(t,r){return this.client.post(`${t}/regenerate`,void 0,(0,ge.createRequestConfig)(r)).then(ge.dataExtractor)}}).create().retrieve().update().delete().list().build();Re.BasisTheoryApplications=No,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryApplications",{enumerable:!0,get:function(){return t.BasisTheoryApplications}});var t=Re}(mt);var Er={},_r={},Se={},br={},Oe={};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.BasisTheoryTokenize=void 0;var ve=v,jo=w;class Lo extends jo.BasisTheoryService{tokenize(t,r={}){return this.client.post("/",t,(0,ve.createRequestConfig)(r,{transformRequest:ve.proxyRaw,transformResponse:ve.proxyRaw})).then(ve.dataExtractor)}}Oe.BasisTheoryTokenize=Lo,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryTokenize",{enumerable:!0,get:function(){return t.BasisTheoryTokenize}});var t=Oe}(br),Object.defineProperty(Se,"__esModule",{value:!0}),Se.delegateTokenize=void 0;var xo=br;const Do=e=>class extends xo.BasisTheoryTokenize{tokenize(r,n){return e!=null&&e.hasElement(r)?e.tokenize(r,n):super.tokenize(r,n)}};Se.delegateTokenize=Do;var we={},Et={},Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.BasisTheoryTokens=void 0;var L=v,q=h,Uo=w,Mo=j;const Io=new Mo.CrudBuilder(class extends Uo.BasisTheoryService{constructor(t){const r=t;r.transformRequest=[].concat(q.transformTokenRequestSnakeCase,t.transformRequest||[]),r.transformResponse=[].concat(q.transformTokenResponseCamelCase,t.transformResponse||[]),super(r)}retrieve(t,r={}){const n=`/${t}`;return this.client.get(n,(0,L.createRequestConfig)(r)).then(q.dataExtractor)}update(t,r,n={}){const s=`/${t}`,o=(0,L.createRequestConfig)(n);return this.client.patch(s,r,{...o,headers:{...(o==null?void 0:o.headers)||{},[L.CONTENT_TYPE_HEADER]:L.MERGE_CONTENT_TYPE}}).then(q.dataExtractor)}async createAssociation(t,r,n){const s=`/${t}/children/${r}`;await this.client.post(s,{},(0,L.createRequestConfig)(n))}async deleteAssociation(t,r,n){const s=`/${t}/children/${r}`;await this.client.delete(s,(0,L.createRequestConfig)(n))}createChild(t,r,n){const s=`/${t}/children`;return this.client.post(s,r,(0,L.createRequestConfig)(n)).then(q.dataExtractor)}listChildren(t,r={},n={}){const s=`/${t}/children${(0,L.getQueryParams)(r)}`;return this.client.get(s,(0,L.createRequestConfig)(n)).then(q.dataExtractor)}search(t,r){return this.client.post("/search",t,(0,L.createRequestConfig)(r)).then(q.dataExtractor)}}).create().delete().list().build();Ce.BasisTheoryTokens=Io,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryTokens",{enumerable:!0,get:function(){return t.BasisTheoryTokens}});var t=Ce}(Et),Object.defineProperty(we,"__esModule",{value:!0}),we.delegateTokens=void 0;var $o=Et;const Ho=e=>class extends $o.BasisTheoryTokens{create(r,n){return e!=null&&e.hasElement(r)?e.tokens.create(r,n):super.create(r,n)}update(r,n,s){return e!=null&&e.hasElement(n)?e.tokens.update(r,n,s):super.update(r,n,s)}retrieve(r,n){return e!==void 0?e.tokens.retrieve(r,n):super.retrieve(r,n)}};we.delegateTokens=Ho;var Ae={},yr={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.BasisTheoryProxy=void 0;var D=v,qo=w;class Fo extends qo.BasisTheoryService{get(t){return this.proxyRequest("get",t)}post(t){return this.proxyRequest("post",t)}put(t){return this.proxyRequest("put",t)}patch(t){return this.proxyRequest("patch",t)}delete(t){return this.proxyRequest("delete",t)}proxyRequest(t,r){var n;if(t==="post"||t==="put"||t==="patch"){var s,o;const i=r!=null&&r.includeResponseHeaders&&t==="post"?D.dataAndHeadersExtractor:D.dataExtractor;return this.client[t]((s=r==null?void 0:r.path)!==null&&s!==void 0?s:"",(o=r==null?void 0:r.body)!==null&&o!==void 0?o:void 0,(0,D.createRequestConfig)(r,{transformRequest:D.proxyRaw,transformResponse:D.proxyRaw})).then(i)}return this.client[t]((n=r==null?void 0:r.path)!==null&&n!==void 0?n:"/",(0,D.createRequestConfig)(r,{transformRequest:D.proxyRaw,transformResponse:D.proxyRaw})).then(D.dataExtractor)}}Pe.BasisTheoryProxy=Fo,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Pe;Object.keys(t).forEach(function(r){r==="default"||r==="__esModule"||r in e&&e[r]===t[r]||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})}(yr),Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.delegateProxy=void 0;var zo=yr;const ko=e=>class extends zo.BasisTheoryProxy{get(r){return e!==void 0?e.proxy.get(r):super.get(r)}post(r){return e!==void 0?e.proxy.post(r):super.post(r)}put(r){return e!==void 0?e.proxy.put(r):super.put(r)}patch(r){return e!==void 0?e.proxy.patch(r):super.patch(r)}delete(r){return e!==void 0?e.proxy.delete(r):super.delete(r)}};Ae.delegateProxy=ko,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Se;Object.keys(t).forEach(function(s){s==="default"||s==="__esModule"||s in e&&e[s]===t[s]||Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[s]}})});var r=we;Object.keys(r).forEach(function(s){s==="default"||s==="__esModule"||s in e&&e[s]===r[s]||Object.defineProperty(e,s,{enumerable:!0,get:function(){return r[s]}})});var n=Ae;Object.keys(n).forEach(function(s){s==="default"||s==="__esModule"||s in e&&e[s]===n[s]||Object.defineProperty(e,s,{enumerable:!0,get:function(){return n[s]}})})}(_r);var F={};Object.defineProperty(F,"__esModule",{value:!0}),F.injectScript=F.findScript=void 0;const Go=e=>document.querySelector(`script[src^="${e}"]`);F.findScript=Go;const Wo=e=>{const t=document.createElement("script");t.src=e;const r=document.head||document.body;if(!r)throw new Error("No <head> or <body> elements found in document.");return r.append(t),t};F.injectScript=Wo;var Be={},S={};Object.defineProperty(S,"__esModule",{value:!0}),S.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE=S.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE=S.ELEMENTS_NOM_DOM_ERROR_MESSAGE=S.ELEMENTS_INIT_ERROR_MESSAGE=S.CARD_ICON_POSITIONS=S.CARD_BRANDS=S.AUTOCOMPLETE_VALUES=void 0;const Vo="BasisTheory Elements was not properly initialized.";S.ELEMENTS_INIT_ERROR_MESSAGE=Vo;const Ko="Tried to load BasisTheoryElements in a non-DOM environment.";S.ELEMENTS_NOM_DOM_ERROR_MESSAGE=Ko;const Jo="Basis Theory Elements did not load properly.";S.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE=Jo;const Yo="There was an unknown error when loading Basis Theory Elements. Check the console for details.";S.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE=Yo;const Xo=["visa","mastercard","american-express","discover","diners-club","jcb","unionpay","maestro","elo","hiper","hipercard","mir","unknown"];S.CARD_BRANDS=Xo;const Qo=["left","right","none"];S.CARD_ICON_POSITIONS=Qo;const Zo=["off","on"];S.AUTOCOMPLETE_VALUES=Zo,Object.defineProperty(Be,"__esModule",{value:!0}),Be.loadElements=void 0;var _t=S,Tr=F;let bt;const ei=e=>(bt||(bt=new Promise((t,r)=>{if(typeof window!="object"){r(new Error(_t.ELEMENTS_NOM_DOM_ERROR_MESSAGE));return}if(window.BasisTheoryElements){t(window.BasisTheoryElements);return}try{let n="https://js.basistheory.com/elements";if(typeof e<"u")try{n=new URL(e).toString().replace(/\/$/u,"")}catch{throw new Error("Invalid format for the given Elements client url.")}let s=(0,Tr.findScript)(n);s||(s=(0,Tr.injectScript)(n)),s.addEventListener("load",()=>{window.BasisTheoryElements?t(window.BasisTheoryElements):r(new Error(_t.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE))}),s.addEventListener("error",o=>{r((o==null?void 0:o.error)||new Error(_t.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE))})}catch(n){r(n);return}})),bt);Be.loadElements=ei,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=_r;Object.keys(t).forEach(function(s){s==="default"||s==="__esModule"||s in e&&e[s]===t[s]||Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[s]}})});var r=F;Object.keys(r).forEach(function(s){s==="default"||s==="__esModule"||s in e&&e[s]===r[s]||Object.defineProperty(e,s,{enumerable:!0,get:function(){return r[s]}})});var n=Be;Object.keys(n).forEach(function(s){s==="default"||s==="__esModule"||s in e&&e[s]===n[s]||Object.defineProperty(e,s,{enumerable:!0,get:function(){return n[s]}})})}(Er);var Rr={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.BasisTheoryLogs=void 0;var ti=w,ri=j;const ni=new ri.CrudBuilder(class extends ti.BasisTheoryService{}).list().build();Ne.BasisTheoryLogs=ni,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryLogs",{enumerable:!0,get:function(){return t.BasisTheoryLogs}});var t=Ne}(Rr);var gr={},je={};Object.defineProperty(je,"__esModule",{value:!0}),je.BasisTheoryPermissions=void 0;var Sr=v,si=w;class oi extends si.BasisTheoryService{list(t){return this.client.get("/",(0,Sr.createRequestConfig)(t)).then(Sr.dataExtractor)}}je.BasisTheoryPermissions=oi,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryPermissions",{enumerable:!0,get:function(){return t.BasisTheoryPermissions}});var t=je}(gr);var Or={},Le={};Object.defineProperty(Le,"__esModule",{value:!0}),Le.BasisTheoryProxies=void 0;var vr=h,ii=w,ai=j;const ci=new ai.CrudBuilder(class extends ii.BasisTheoryService{constructor(t){const r={...t};r.transformRequest=[].concat(vr.transformProxyRequestSnakeCase,t.transformRequest||[]),r.transformResponse=[].concat(vr.transformProxyResponseCamelCase,t.transformResponse||[]),super(r)}}).create().retrieve().update().patch().delete().list().build();Le.BasisTheoryProxies=ci,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Le;Object.keys(t).forEach(function(r){r==="default"||r==="__esModule"||r in e&&e[r]===t[r]||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})}(Or);var wr={},xe={};Object.defineProperty(xe,"__esModule",{value:!0}),xe.BasisTheoryReactorFormulas=void 0;var ui=w,li=j;const di=new li.CrudBuilder(class extends ui.BasisTheoryService{}).create().retrieve().update().delete().list().build();xe.BasisTheoryReactorFormulas=di,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryReactorFormulas",{enumerable:!0,get:function(){return t.BasisTheoryReactorFormulas}});var t=xe}(wr);var Cr={},De={};Object.defineProperty(De,"__esModule",{value:!0}),De.BasisTheoryReactors=void 0;var Ue=v,Ar=h,fi=w,hi=j;const pi=new hi.CrudBuilder(class extends fi.BasisTheoryService{constructor(t){const r={...t};r.transformRequest=[].concat(Ar.transformReactorRequestSnakeCase,t.transformRequest||[]),r.transformResponse=[].concat(Ar.transformReactorResponseCamelCase,t.transformResponse||[]),super(r)}react(t,r,n){return this.client.post(`/${t}/react`,r,(0,Ue.createRequestConfig)(n,{transformRequest:Ue.proxyRaw,transformResponse:Ue.proxyRaw})).then(Ue.dataExtractor)}}).create().retrieve().update().patch().delete().list().build();De.BasisTheoryReactors=pi,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryReactors",{enumerable:!0,get:function(){return t.BasisTheoryReactors}});var t=De}(Cr);var Pr={},Me={};Object.defineProperty(Me,"__esModule",{value:!0}),Me.BasisTheorySessions=void 0;var Br=v,Ie=h,mi=w;class Ei extends mi.BasisTheoryService{constructor(t){const r={...t};r.transformRequest=[].concat(Ie.transformProxyRequestSnakeCase,t.transformRequest||[]),r.transformResponse=[].concat(Ie.transformProxyResponseCamelCase,t.transformResponse||[]),super(r)}create(t={}){return this.client.post("/",void 0,(0,Br.createRequestConfig)(t)).then(Ie.dataExtractor)}authorize(t,r={}){const n="/authorize";return this.client.post(n,t,(0,Br.createRequestConfig)(r)).then(Ie.dataExtractor)}}Me.BasisTheorySessions=Ei,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheorySessions",{enumerable:!0,get:function(){return t.BasisTheorySessions}});var t=Me}(Pr);var Nr={},$e={};Object.defineProperty($e,"__esModule",{value:!0}),$e.BasisTheoryTenants=void 0;var R=v,_i=w,bi=j;const yi=new bi.CrudBuilder(class extends _i.BasisTheoryService{retrieve(t){return this.client.get("/",(0,R.createRequestConfig)(t)).then(R.dataExtractor)}update(t,r){return this.client.put("/",t,(0,R.createRequestConfig)(r)).then(R.dataExtractor)}async delete(t){await this.client.delete("/",(0,R.createRequestConfig)(t))}retrieveUsageReport(t){return this.client.get("/reports/usage",(0,R.createRequestConfig)(t)).then(R.dataExtractor)}createInvitation(t,r){return this.client.post("/invitations",t,(0,R.createRequestConfig)(r)).then(R.dataExtractor)}resendInvitation(t,r){return this.client.post(`/invitations/${t}/resend`,{},(0,R.createRequestConfig)(r)).then(R.dataExtractor)}listInvitations(t,r){const n=`/invitations${(0,R.getQueryParams)(t)}`;return this.client.get(n,(0,R.createRequestConfig)(r)).then(R.dataExtractor)}retrieveInvitation(t,r){return this.client.get(`/invitations/${t}`,(0,R.createRequestConfig)(r)).then(R.dataExtractor)}async deleteInvitation(t,r){await this.client.delete(`/invitations/${t}`,(0,R.createRequestConfig)(r))}listMembers(t,r){const n=`/members${(0,R.getQueryParams)(t)}`;return this.client.get(n,(0,R.createRequestConfig)(r)).then(R.dataExtractor)}async deleteMember(t,r){await this.client.delete(`/members/${t}`,(0,R.createRequestConfig)(r))}}).build();$e.BasisTheoryTenants=yi,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BasisTheoryTenants",{enumerable:!0,get:function(){return t.BasisTheoryTenants}});var t=$e}(Nr),Object.defineProperty(ne,"__esModule",{value:!0}),ne.BasisTheory=void 0;var te=z,Ti=St,Ri=mt,b=v,He=Er,gi=S,Si=Rr,Oi=gr,vi=Or,wi=wr,Ci=Cr,Ai=Pr,Pi=Nr;function Bi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ni={apiBaseUrl:b.DEFAULT_BASE_URL,elements:!1,appInfo:{}};class ji{constructor(){Bi(this,"_initStatus","not-started")}async init(t,r={}){if(this._initStatus!=="not-started"&&this._initStatus!=="error")throw new Error("This BasisTheory instance has been already initialized.");this._initStatus="in-progress";try{this._initOptions=Object.freeze({...Ni,...r});let n=this._initOptions.apiBaseUrl;try{const o=new URL(this.initOptions.apiBaseUrl);o.hostname==="localhost"?o.protocol="http":o.protocol="https",n=o.toString().replace(/\/$/u,"")}catch{throw new Error("Invalid format for the given API base url.")}const s=this._initOptions.appInfo;this._initOptions.elements&&await this.loadElements(t),this._tokens=new((0,He.delegateTokens)(this._elements))({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.tokens,n).toString(),appInfo:s}),this._tokenize=new((0,He.delegateTokenize)(this._elements))({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.tokenize,n).toString(),appInfo:s}),this._applications=new Ri.BasisTheoryApplications({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.applications,n).toString(),appInfo:s}),this._tenants=new Pi.BasisTheoryTenants({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.tenants,n).toString(),appInfo:s}),this._logs=new Si.BasisTheoryLogs({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.logs,n).toString(),appInfo:s}),this._reactorFormulas=new wi.BasisTheoryReactorFormulas({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.reactorFormulas,n).toString(),appInfo:s}),this._reactors=new Ci.BasisTheoryReactors({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.reactors,n).toString(),appInfo:s}),this._permissions=new Oi.BasisTheoryPermissions({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.permissions,n).toString(),appInfo:s}),this._proxies=new vi.BasisTheoryProxies({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.proxies,n).toString(),appInfo:s}),this._proxy=new((0,He.delegateProxy)(this._elements))({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.proxy,n).toString(),appInfo:s}),this._sessions=new Ai.BasisTheorySessions({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.sessions,n).toString(),appInfo:s}),this._transactions=new Ti.BasisTheoryTransactions({apiKey:t,baseURL:new URL(b.CLIENT_BASE_PATHS.transactions,n).toString(),appInfo:s}),this._initStatus="done"}catch(n){throw this._initStatus="error",n}return this}createElement(t,r){if(!this._elements)throw new Error(gi.ELEMENTS_INIT_ERROR_MESSAGE);return this._elements.createElement(t,r)}tokenize(t,r){return(0,b.assertInit)(this._tokenize).tokenize(t,r)}post(t,r,n){return(0,te.makeRequestWithElementsPayloadCheck)(this._elements,"post",t,r,n)}put(t,r,n){return(0,te.makeRequestWithElementsPayloadCheck)(this._elements,"put",t,r,n)}patch(t,r,n){return(0,te.makeRequestWithElementsPayloadCheck)(this._elements,"patch",t,r,n)}get(t,r){return(0,te.makeRequestWithoutElementsPayloadCheck)(this._elements,"get",t,r)}delete(t,r){return(0,te.makeRequestWithoutElementsPayloadCheck)(this._elements,"delete",t,r)}async loadElements(t){let r;try{r=new URL(this.initOptions.elementsBaseUrl||b.DEFAULT_ELEMENTS_BASE_URL)}catch{throw new Error("Invalid format for the given Elements base url.")}const n=await(0,He.loadElements)(this.initOptions.elementsClientUrl);await n.init(t,r.toString().replace(/\/$/u,"")),this.elements=n}get initOptions(){return(0,b.assertInit)(this._initOptions)}get tokens(){return(0,b.assertInit)(this._tokens)}get applications(){return(0,b.assertInit)(this._applications)}get tenants(){return(0,b.assertInit)(this._tenants)}get logs(){return(0,b.assertInit)(this._logs)}get reactorFormulas(){return(0,b.assertInit)(this._reactorFormulas)}get reactors(){return(0,b.assertInit)(this._reactors)}get permissions(){return(0,b.assertInit)(this._permissions)}get proxies(){return(0,b.assertInit)(this._proxies)}get proxy(){return(0,b.assertInit)(this._proxy)}get sessions(){return(0,b.assertInit)(this._sessions)}get transactions(){return(0,b.assertInit)(this._transactions)}get elements(){return(0,b.assertInit)(this._elements)}set elements(t){this._elements=t}}ne.BasisTheory=ji,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t={_instance:!0};e._instance=void 0;var r=ne;Object.keys(r).forEach(function(i){i==="default"||i==="__esModule"||Object.prototype.hasOwnProperty.call(t,i)||i in e&&e[i]===r[i]||Object.defineProperty(e,i,{enumerable:!0,get:function(){return r[i]}})});var n=mt;Object.keys(n).forEach(function(i){i==="default"||i==="__esModule"||Object.prototype.hasOwnProperty.call(t,i)||i in e&&e[i]===n[i]||Object.defineProperty(e,i,{enumerable:!0,get:function(){return n[i]}})});var s=Et;Object.keys(s).forEach(function(i){i==="default"||i==="__esModule"||Object.prototype.hasOwnProperty.call(t,i)||i in e&&e[i]===s[i]||Object.defineProperty(e,i,{enumerable:!0,get:function(){return s[i]}})});const o=new r.BasisTheory;e._instance=o}(Rt);function jr(e){return Array.isArray(e)?e.filter(Boolean):Object.fromEntries(Object.entries(e).map(([t,r])=>[t,typeof r=="object"&&r&&!Array.isArray(r)?jr(r):r]).filter(([t,r])=>typeof r=="object"&&r&&!Array.isArray(r)?!!Object.keys(r).length:r!=null&&r!=null))}function re(e,t){const r={...e,...t},n=Object.keys(r);for(const s of n){const o=e[s],i=t[s];typeof o=="object"&&!Array.isArray(o)&&o&&typeof i=="object"&&!Array.isArray(i)&&i&&(r[s]=re(o,i))}return r}const Lr={base:{":disabled":{backgroundColor:"transparent"}}};class qe{static async init(t,r){const n=await new Rt.BasisTheory().init(r,{elements:!0});return new qe(t,n)}constructor(t,r){Object.defineProperty(this,"session",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"bt",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:this.createFieldDefaultState()}),Object.defineProperty(this,"cardElements",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"stateChangeHandlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"createForm",{enumerable:!0,configurable:!0,writable:!0,value:(n={})=>{if(this.hasFormElements())throw new Error("Form elements can't be initialized twice. You can call `reset()` method or create new Hellgate client.");const s=re({disabled:!1,autoComplete:"on",style:{...Lr}},n),o=this.bt.createElement("card",s);return this.cardElements.card={element:o,state:this.createFieldDefaultState()},this.addElementStateListener("card"),o}}),Object.defineProperty(this,"createFormFields",{enumerable:!0,configurable:!0,writable:!0,value:(n={})=>{if(this.hasFormElements())throw new Error("Form elements can't be initialized twice. You can call `reset()` method or create new Hellgate client.");const s={disabled:!1,autoComplete:"on",validateOnChange:!0,style:{...Lr}},{cardNumber:o={},expiryDate:i={},securityCode:a={},...d}=n,u=this.bt.createElement("cardNumber",{...re(s,{...d,...o}),targetId:"cardNumber"}),l=this.bt.createElement("cardExpirationDate",{...re(s,{...d,...i}),targetId:"expirationDate"}),f=this.bt.createElement("cardVerificationCode",{...re(s,{...d,...a}),targetId:"cvc"});return this.cardElements={cardNumber:{element:u,state:this.createFieldDefaultState()},cardExpirationDate:{element:l,state:this.createFieldDefaultState()},cardVerificationCode:{element:f,state:this.createFieldDefaultState()}},this.addElementStateListener("cardNumber"),this.addElementStateListener("cardExpirationDate"),this.addElementStateListener("cardVerificationCode"),{cardNumber:u,expiryDate:l,securityCode:f}}}),Object.defineProperty(this,"tokenize",{enumerable:!0,configurable:!0,writable:!0,value:async()=>{const{card:n,cardNumber:s,cardExpirationDate:o,cardVerificationCode:i}=this.cardElements,a="{{ data.number }}|{{ data.expiration_month }}|{{ data.expiration_year }}|{{ data.cvc }}";if(n)return this.bt.tokenize({type:"card",data:n.element,deduplicate_token:!0,fingerprint_expression:a});if(s&&o&&i)return this.bt.tokenize({type:"card",data:{number:s.element,expiration_month:o.element.month(),expiration_year:o.element.year(),cvc:i.element},deduplicate_token:!0,fingerprint_expression:a});throw new Error("Form elements must be initialized before tokenization")}}),Object.defineProperty(this,"onStateChange",{enumerable:!0,configurable:!0,writable:!0,value:n=>{this.stateChangeHandlers.push(n),n(this.state)}}),Object.defineProperty(this,"clear",{enumerable:!0,configurable:!0,writable:!0,value:()=>{Object.values(this.cardElements).forEach(n=>n==null?void 0:n.element.clear())}}),Object.defineProperty(this,"reset",{enumerable:!0,configurable:!0,writable:!0,value:()=>{Object.values(this.cardElements).forEach(n=>n==null?void 0:n.element.unmount()),this.cardElements={}}}),Object.defineProperty(this,"dispose",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.reset()}}),Object.defineProperty(this,"process",{enumerable:!0,configurable:!0,writable:!0,value:async n=>{if(!this.hasFormElements())throw new Error("Card form must be initialized and completed before processing");const s=n?this.extractAdditionalData(n):void 0;this.disableFormElements();const o=await this.tokenize();await this.session.completeAction({action:"tokenize_card",result:{bt_token_id:o.id,additional_data:s}})}})}hasFormElements(){return!!Object.keys(this.cardElements).length}disableFormElements(){Object.values(this.cardElements).forEach(({element:t})=>{t.update({disabled:!0})})}extractAdditionalData({cardholder_name:t,billing_address:r={}}){return jr({cardholder_name:t,billing_address:{line1:r.line1,line2:r.line2,line3:r.line3,city:r.city,postal_code:r.postal_code}})}addElementStateListener(t){const r=this.cardElements[t];r&&r.element.on("change",n=>{r.state=n,this.updateFormState()})}updateFormState(){const t=Object.values(this.cardElements);t.length?this.state=t.reduce((r,{state:n})=>(r.valid=!!r.valid&&!!n.valid,r.complete=!!r.complete&&!!n.complete,r.empty=!!r.empty||!!n.empty,r.errors=[...r.errors,...n.errors||[]],r),{valid:!0,complete:!0,empty:!1,errors:[]}):this.state=this.createFieldDefaultState(),this.stateChangeHandlers.forEach(r=>r(this.state))}createFieldDefaultState(){return{empty:!0,complete:!1,valid:!1}}}class Li{constructor(t="https://api.hellgate.io",r=new AbortController){Object.defineProperty(this,"abortCtrl",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=t.endsWith("/")?t.substring(0,t.length-1):t}getSession(t){return fetch(`${this.baseUrl}/sessions/${t}`,{signal:this.abortCtrl.signal}).then(r=>yt(r))}completeAction(t,r){return fetch(`${this.baseUrl}/sessions/${t}/complete-action`,{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({data:r}),signal:this.abortCtrl.signal}).then(n=>yt(n))}completeSession(t){return fetch(`${this.baseUrl}/sessions/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:JSON.stringify({data:{result:{}}}),signal:this.abortCtrl.signal}).then(r=>yt(r))}cancelAll(){this.abortCtrl.abort()}}function yt(e){if(!e.ok)throw e;return e.json()}const xi=2e3;class Di{constructor(t,r){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"api",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"stateChangeHandlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"onCloseHandlers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pollingTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"init",{enumerable:!0,configurable:!0,writable:!0,value:async()=>new Promise((n,s)=>{const o=this.onStateChange(i=>{switch(i.next_action){case"tokenize_card":{n(i),o();return}}});this.updateSessionState().catch(i=>{i instanceof Response&&i.status===404&&s(new Error(`Session ${this.id} doesn't exist or has expired`)),s(i)})})}),Object.defineProperty(this,"onStateChange",{enumerable:!0,configurable:!0,writable:!0,value:n=>(this.stateChangeHandlers.push(n),this.state&&n(this.state),()=>this.stateChangeHandlers=this.stateChangeHandlers.filter(s=>s!==n))}),Object.defineProperty(this,"onClose",{enumerable:!0,configurable:!0,writable:!0,value:n=>(this.onCloseHandlers.push(n),()=>this.onCloseHandlers=this.onCloseHandlers.filter(s=>s!==n))}),Object.defineProperty(this,"completeAction",{enumerable:!0,configurable:!0,writable:!0,value:async n=>{const s=this.state;return new Promise((o,i)=>{const a=this.onStateChange(d=>{d.next_action!==(s==null?void 0:s.next_action)&&d.next_action!=="wait"&&(o(!0),a())});this.api.completeAction(this.id,n).then(({data:d})=>this.newStateHandle(d,i)).catch(async d=>i(await Ui(d)))})}}),Object.defineProperty(this,"completeSession",{enumerable:!0,configurable:!0,writable:!0,value:async n=>{await this.api.completeSession(this.id),this.onCloseHandlers.forEach(s=>s(n)),this.stop()}}),Object.defineProperty(this,"dispose",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.stop(),this.api.cancelAll()}})}stop(){window.clearTimeout(this.pollingTimer),this.stateChangeHandlers=[],this.onCloseHandlers=[]}async updateSessionState(t){const{data:r}=await this.api.getSession(this.id);this.newStateHandle(r,t)}newStateHandle(t,r){var n;switch(t.next_action!==((n=this.state)==null?void 0:n.next_action)&&this.stateChangeHandlers.forEach(s=>s(t)),t.next_action){case"wait":{window.clearTimeout(this.pollingTimer),this.pollingTimer=window.setTimeout(()=>this.updateSessionState(r).catch(s=>{s instanceof Response&&s.status===404&&(r==null||r(new Error(`Session ${this.id} has expired`)))}),xi);break}case"close_session":{this.completeSession(t.configuration);break}}this.state=t}}async function Ui(e){if(!e.ok)switch(e.status){case 400:{const t=await e.json();return new Error([t.classifier,t.message].filter(Boolean).join(". "))}}return e}const Mi={base_url:"https://api.hellgate.io"};class Tt{constructor(t,r){Object.defineProperty(this,"session",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"paymentMethods",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"eventsHandlers",{enumerable:!0,configurable:!0,writable:!0,value:{closed:[]}}),Object.defineProperty(this,"dispose",{enumerable:!0,configurable:!0,writable:!0,value:()=>{this.session.dispose(),Object.values(this.paymentMethods).forEach(n=>n.dispose())}})}use(t){return this.paymentMethods[t]}on(t,r){switch(this.eventsHandlers[t].push(r),t){case"closed":return this.session.onClose(r);default:throw new Error(`Unknown event: ${t}`)}}static async init(t,r={}){const n={...Mi,...r},s=new Li(n.base_url,n.abortCtrl),o=new Di(t,s),i=await o.init(),a=i.next_action==="tokenize_card"?await qe.init(o,i.configuration.bt_api_key):void 0;return new Tt(o,{CARD:a})}}$.Hellgate=Tt,$.HellgateCardHandler=qe,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});globalThis.HellgateSDK&&(globalThis.Hellgate=globalThis.HellgateSDK.Hellgate,delete globalThis.HellgateSDK);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HellgateCardHandler } from './card';
|
|
2
|
+
import { HellgateSession, SessionOnCloseHandler } from './session';
|
|
3
|
+
type PaymentMethodHandlers = {
|
|
4
|
+
CARD?: HellgateCardHandler;
|
|
5
|
+
};
|
|
6
|
+
type HellgateOptions = {
|
|
7
|
+
base_url: string;
|
|
8
|
+
abortCtrl?: AbortController;
|
|
9
|
+
};
|
|
10
|
+
type EventName = 'closed';
|
|
11
|
+
type EventsHandlers = {
|
|
12
|
+
closed: SessionOnCloseHandler[];
|
|
13
|
+
};
|
|
14
|
+
export declare class Hellgate {
|
|
15
|
+
private session;
|
|
16
|
+
private paymentMethods;
|
|
17
|
+
private eventsHandlers;
|
|
18
|
+
constructor(session: HellgateSession, paymentMethods: PaymentMethodHandlers);
|
|
19
|
+
use(paymentMethod: keyof PaymentMethodHandlers): HellgateCardHandler | undefined;
|
|
20
|
+
on<T extends EventName>(eventName: T, handler: EventsHandlers[T][0]): () => SessionOnCloseHandler[];
|
|
21
|
+
dispose: () => void;
|
|
22
|
+
static init(sessionId: string, options?: Partial<HellgateOptions>): Promise<Hellgate>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CompleteActionDTO, SessionStateDTO } from './typings';
|
|
2
|
+
export declare class HellgateAPIClient {
|
|
3
|
+
private abortCtrl;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
constructor(baseUrl?: string, abortCtrl?: AbortController);
|
|
6
|
+
getSession(id: string): Promise<{
|
|
7
|
+
data: SessionStateDTO;
|
|
8
|
+
}>;
|
|
9
|
+
completeAction(id: string, data: CompleteActionDTO): Promise<{
|
|
10
|
+
data: SessionStateDTO;
|
|
11
|
+
}>;
|
|
12
|
+
completeSession(id: string): Promise<{
|
|
13
|
+
data: Record<string, never>;
|
|
14
|
+
}>;
|
|
15
|
+
cancelAll(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HellgateAPIClient } from './api';
|
|
2
|
+
import { CompleteActionDTO, CompleteActionResult, SessionStateDTO } from './typings';
|
|
3
|
+
export type SessionOnCloseHandler = (result: CompleteActionResult) => void;
|
|
4
|
+
export declare class HellgateSession {
|
|
5
|
+
id: string;
|
|
6
|
+
private api;
|
|
7
|
+
state: SessionStateDTO | null;
|
|
8
|
+
private stateChangeHandlers;
|
|
9
|
+
private onCloseHandlers;
|
|
10
|
+
private pollingTimer?;
|
|
11
|
+
constructor(id: string, api: HellgateAPIClient);
|
|
12
|
+
init: () => Promise<SessionStateDTO>;
|
|
13
|
+
onStateChange: (fn: (state: SessionStateDTO) => void) => () => ((state: SessionStateDTO) => void)[];
|
|
14
|
+
onClose: (fn: SessionOnCloseHandler) => () => SessionOnCloseHandler[];
|
|
15
|
+
completeAction: (action: CompleteActionDTO) => Promise<unknown>;
|
|
16
|
+
completeSession: (result: CompleteActionResult) => Promise<void>;
|
|
17
|
+
dispose: () => void;
|
|
18
|
+
private stop;
|
|
19
|
+
private updateSessionState;
|
|
20
|
+
private newStateHandle;
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TokenizeCardActionDTO, TokenizeCardSessionStateDTO } from '../card/typings';
|
|
2
|
+
export type SessionStateDTO = TokenizeCardSessionStateDTO | {
|
|
3
|
+
next_action: 'wait';
|
|
4
|
+
configuration: Record<string, never>;
|
|
5
|
+
} | {
|
|
6
|
+
next_action: 'close_session';
|
|
7
|
+
configuration: CompleteActionResult;
|
|
8
|
+
};
|
|
9
|
+
export type CompleteActionDTO = TokenizeCardActionDTO;
|
|
10
|
+
export type CompleteActionResult = {
|
|
11
|
+
success: true;
|
|
12
|
+
} | {
|
|
13
|
+
success: false;
|
|
14
|
+
reason: string;
|
|
15
|
+
};
|
package/dist/untils.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@starfish-codes/hellgate",
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Starfish GmbH & Co. KG",
|
|
7
|
+
"email": "hellgate.service@starfish.team"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://developer.hellgate.io/docs/head-less-web-sdk-overview",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"main": "./dist/hellgate-sdk.umd.js",
|
|
14
|
+
"module": "./dist/hellgate-sdk.mjs",
|
|
15
|
+
"typings": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/hellgate-sdk.mjs",
|
|
19
|
+
"require": "./dist/hellgate-sdk.umd.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"start": "vite serve demo",
|
|
24
|
+
"build": "tsc && vite build",
|
|
25
|
+
"build:watch": "tsc && vite build --watch",
|
|
26
|
+
"lint": "eslint src demo --ext ts --report-unused-disable-directives --max-warnings 0",
|
|
27
|
+
"test": "vitest",
|
|
28
|
+
"test:ci": "vitest run --silent --reporter verbose",
|
|
29
|
+
"prepare": "husky install && vite build",
|
|
30
|
+
"preview": "vite preview"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
35
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
36
|
+
"@vitest/browser": "^0.34.2",
|
|
37
|
+
"eslint": "^8.45.0",
|
|
38
|
+
"husky": "^8.0.3",
|
|
39
|
+
"lint-staged": "^13.2.3",
|
|
40
|
+
"playwright": "^1.36.2",
|
|
41
|
+
"prettier": "^3.0.0",
|
|
42
|
+
"rollup-plugin-typescript-paths": "^1.4.0",
|
|
43
|
+
"typescript": "^5.0.2",
|
|
44
|
+
"vite": "^4.4.0",
|
|
45
|
+
"vite-plugin-checker": "^0.6.1",
|
|
46
|
+
"vite-plugin-top-level-await": "^1.3.1",
|
|
47
|
+
"vitest": "^0.34.2",
|
|
48
|
+
"vitest-fetch-mock": "^0.2.2",
|
|
49
|
+
"webdriverio": "^8.14.1"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@basis-theory/basis-theory-js": "^1.79.2"
|
|
53
|
+
},
|
|
54
|
+
"lint-staged": {
|
|
55
|
+
"*.ts*": [
|
|
56
|
+
"prettier --config .prettierrc --write",
|
|
57
|
+
"eslint --fix --report-unused-disable-directives --max-warnings 0"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"payments",
|
|
62
|
+
"hellgate",
|
|
63
|
+
"starfish",
|
|
64
|
+
"headless"
|
|
65
|
+
],
|
|
66
|
+
"msw": {
|
|
67
|
+
"workerDirectory": "public"
|
|
68
|
+
}
|
|
69
|
+
}
|