marlim-sdk-3ds 1.0.7 → 1.0.8

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/README.md CHANGED
@@ -152,13 +152,16 @@ type CustomerData = {
152
152
  - `card_hash?: CardHash` - Dados do cartão criptografado (Acesse a [documentação](https://docs.api.marlim.co/transactions/card_hash_key) e confira o passo a passo para criptografar os dados do cartão.)
153
153
 
154
154
  #### Campos Opcionais
155
- - `challenge?: boolean` - Forçar fluxo de desafio (apenas sandbox)
155
+ - `challenge?: boolean` - Força o fluxo de desafio 3DS. Disponível apenas em sandbox.
156
+ - `softDescriptorChallenge?: string` - Nome exibido no desafio 3DS. Máximo de 30 caracteres, aceitando letras, números e espaços. Quando não informado, utiliza o nome padrão do seller.
156
157
 
157
158
  **Exemplo:**
158
159
 
159
160
  ```typescript
160
161
  await MarlimSDK_3DS.authenticate({
161
162
  amount: 1000,
163
+ challenge: true, // Opcional: força o desafio 3DS apenas em sandbox
164
+ softDescriptorChallenge: 'LOJA EXEMPLO',
162
165
  card: {
163
166
  number: '1111111111111111',
164
167
  expirationDate: '0126',
@@ -208,4 +211,6 @@ await MarlimSDK_3DS.authenticate({
208
211
 
209
212
  4. **Parâmetro Challenge**: Disponível apenas no ambiente sandbox para fins de teste
210
213
 
211
- 5. **Cartão vs Card Hash**: Você deve fornecer **OU** detalhes do `card` **OU** `card_hash`, mas não ambos
214
+ 5. **Cartão vs Card Hash**: Você deve fornecer **OU** detalhes do `card` **OU** `card_hash`, mas não ambos
215
+
216
+ 6. **Nome no desafio 3DS**: `softDescriptorChallenge` altera apenas o nome exibido durante o desafio 3DS. Ele não substitui o `soft_descriptor` enviado no endpoint de transação.
@@ -18,6 +18,5 @@ declare const CHALLENGE_FORM_ID = "step-up-form";
18
18
  declare function showChallengeModal(): void;
19
19
  declare function closeChallengeModal(): void;
20
20
  export declare function processChallengeWithIframe(config: ChallengeConfig): Promise<void>;
21
- export { closeChallengeModal, showChallengeModal };
22
- export { WINDOW_SIZE_MAP, CHALLENGE_IFRAME_NAME, CHALLENGE_FORM_ID };
21
+ export { CHALLENGE_FORM_ID, CHALLENGE_IFRAME_NAME, closeChallengeModal, showChallengeModal, WINDOW_SIZE_MAP, };
23
22
  export type { ChallengeConfig, ChallengeElements };
@@ -11,5 +11,5 @@ interface ProfilePayload {
11
11
  declare const SESSION_IFRAME_NAME = "session-iframe";
12
12
  declare const SESSION_FORM_ID = "session-form";
13
13
  export declare function processSessionHandler(sessionConfig: SessionConfig): Promise<void>;
14
- export { SESSION_IFRAME_NAME, SESSION_FORM_ID };
15
- export type { SessionConfig, ProfilePayload };
14
+ export { SESSION_FORM_ID, SESSION_IFRAME_NAME };
15
+ export type { ProfilePayload, SessionConfig };
@@ -1 +1 @@
1
- var MarlimSDK_3DS=function(e){"use strict";var t=Object.defineProperty,n=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:s,toStringTag:a}=Symbol,c=(e=>t=>{const n=o.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),u=e=>(e=e.toLowerCase(),t=>c(t)===e),l=e=>t=>typeof t===e,{isArray:d}=Array,f=l("undefined");function p(e){return null!==e&&!f(e)&&null!==e.constructor&&!f(e.constructor)&&g(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const h=u("ArrayBuffer");const m=l("string"),g=l("function"),v=l("number"),y=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==c(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||a in e||s in e)},w=u("Date"),_=u("File"),E=u("Blob"),z=u("FileList"),k=u("URLSearchParams"),[O,x,S,A]=["ReadableStream","Request","Response","Headers"].map(u);function T(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),d(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(p(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function R(e,t){if(p(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,P=e=>!f(e)&&e!==N;const j=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&i(Uint8Array)),$=u("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),I=u("RegExp"),Z=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};T(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const F=u("AsyncFunction"),U=(D="function"==typeof setImmediate,L=g(N.postMessage),D?setImmediate:L?(B=`axios@${Math.random()}`,M=[],N.addEventListener("message",({source:e,data:t})=>{e===N&&t===B&&M.length&&M.shift()()},!1),e=>{M.push(e),N.postMessage(B,"*")}):e=>setTimeout(e));var D,L,B,M;const q="undefined"!=typeof queueMicrotask?queueMicrotask.bind(N):"undefined"!=typeof process&&process.nextTick||U,V={isArray:d,isArrayBuffer:h,isBuffer:p,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||g(e.append)&&("formdata"===(t=c(e))||"object"===t&&g(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:m,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:b,isEmptyObject:e=>{if(!y(e)||p(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:O,isRequest:x,isResponse:S,isHeaders:A,isUndefined:f,isDate:w,isFile:_,isBlob:E,isRegExp:I,isFunction:g,isStream:e=>y(e)&&g(e.pipe),isURLSearchParams:k,isTypedArray:j,isFileList:z,forEach:T,merge:function e(){const{caseless:t,skipUndefined:n}=P(this)&&this||{},r={},o=(o,i)=>{const s=t&&R(r,i)||i;b(r[s])&&b(o)?r[s]=e(r[s],o):b(o)?r[s]=e({},o):d(o)?r[s]=o.slice():n&&f(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&T(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:o}={})=>(T(t,(t,o)=>{n&&g(t)?e[o]=r(t,n):e[o]=t},{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:c,kindOfTest:u,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(d(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[s]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:$,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:Z,freezeMethods:e=>{Z(e,(t,n)=>{if(g(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];g(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return d(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:R,global:N,isContextDefined:P,isSpecCompliantForm:function(e){return!!(e&&g(e.append)&&"FormData"===e[a]&&e[s])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(p(e))return e;if(!("toJSON"in e)){t[r]=e;const o=d(e)?[]:{};return T(e,(e,t)=>{const i=n(e,r+1);!f(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:F,isThenable:e=>e&&(y(e)||g(e))&&g(e.then)&&g(e.catch),setImmediate:U,asap:q,isIterable:e=>null!=e&&g(e[s])};function W(e,t,n,r,o){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),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}V.inherits(W,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:V.toJSONObject(this.config),code:this.code,status:this.status}}});const J=W.prototype,H={};["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=>{H[e]={value:e}}),Object.defineProperties(W,H),Object.defineProperty(J,"isAxiosError",{value:!0}),W.from=(e,t,n,r,o,i)=>{const s=Object.create(J);V.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return W.call(s,a,c,n,r,o),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",i&&Object.assign(s,i),s};function K(e){return V.isPlainObject(e)||V.isArray(e)}function G(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=G(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Y=V.toFlatObject(V,{},null,function(e){return/^is[A-Z]/.test(e)});function Q(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!V.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(V.isDate(e))return e.toISOString();if(V.isBoolean(e))return e.toString();if(!a&&V.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(e)||V.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(V.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(V.isArray(e)&&function(e){return V.isArray(e)&&!e.some(K)}(e)||(V.isFileList(e)||V.endsWith(n,"[]"))&&(a=V.toArray(e)))return n=G(n),a.forEach(function(e,r){!V.isUndefined(e)&&null!==e&&t.append(!0===s?X([n],r,i):null===s?n:n+"[]",c(e))}),!1;return!!K(e)||(t.append(X(o,n,i),c(e)),!1)}const l=[],d=Object.assign(Y,{defaultVisitor:u,convertValue:c,isVisitable:K});if(!V.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!V.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),V.forEach(n,function(n,i){!0===(!(V.isUndefined(n)||null===n)&&o.call(t,n,V.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t}function ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function te(e,t){this._pairs=[],e&&Q(e,this,t)}const ne=te.prototype;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function oe(e,t,n){if(!t)return e;const r=n&&n.encode||re;V.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(i=o?o(t,n):V.isURLSearchParams(t)?t.toString():new te(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}ne.append=function(e,t){this._pairs.push([e,t])},ne.toString=function(e){const t=e?function(t){return e.call(this,t,ee)}:ee;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class ie{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){V.forEach(this.handlers,function(t){null!==t&&e(t)})}}const se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:te,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ce="undefined"!=typeof window&&"undefined"!=typeof document,ue="object"==typeof navigator&&navigator||void 0,le=ce&&(!ue||["ReactNative","NativeScript","NS"].indexOf(ue.product)<0),de="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,fe=ce&&window.location.href||"http://localhost",pe={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ce,hasStandardBrowserEnv:le,hasStandardBrowserWebWorkerEnv:de,navigator:ue,origin:fe},Symbol.toStringTag,{value:"Module"})),...ae};function he(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&V.isArray(r)?r.length:i,a)return V.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&V.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&V.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(e,r)=>{t(function(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const me={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=V.isObject(e);o&&V.isHTMLForm(e)&&(e=new FormData(e));if(V.isFormData(e))return r?JSON.stringify(he(e)):e;if(V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)||V.isReadableStream(e))return e;if(V.isArrayBufferView(e))return e.buffer;if(V.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new pe.classes.URLSearchParams,{visitor:function(e,t,n,r){return pe.isNode&&V.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=V.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||me.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(V.isResponse(e)||V.isReadableStream(e))return e;if(e&&V.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(n){if("SyntaxError"===o.name)throw W.from(o,W.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{me.headers[e]={}});const ge=V.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"]),ve=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:V.isArray(e)?e.map(be):String(e)}function we(e,t,n,r,o){return V.isFunction(r)?r.call(this,t,n):(o&&(t=n),V.isString(t)?V.isString(r)?-1!==t.indexOf(r):V.isRegExp(r)?r.test(t):void 0:void 0)}let _e=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ye(t);if(!o)throw new Error("header name must be a non-empty string");const i=V.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=be(e))}const i=(e,t)=>V.forEach(e,(e,n)=>o(e,n,t));if(V.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(V.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ge[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(V.isObject(e)&&V.isIterable(e)){let n,r,o={};for(const t of e){if(!V.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?V.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ye(e)){const n=V.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(V.isFunction(t))return t.call(this,e,n);if(V.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=V.findKey(this,e);return!(!n||void 0===this[n]||t&&!we(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ye(e)){const o=V.findKey(n,e);!o||t&&!we(0,n[o],o,t)||(delete n[o],r=!0)}}return V.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!we(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return V.forEach(this,(r,o)=>{const i=V.findKey(n,o);if(i)return t[i]=be(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=be(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return V.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&V.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ve]=this[ve]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return V.isArray(e)?e.forEach(r):r(e),this}};function Ee(e,t){const n=this||me,r=t||n,o=_e.from(r.headers);let i=r.data;return V.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ze(e){return!(!e||!e.__CANCEL__)}function ke(e,t,n){W.call(this,null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError"}function Oe(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}_e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),V.reduceDescriptors(_e.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),V.freezeMethods(_e),V.inherits(ke,W,{__CANCEL__:!0});const xe=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,c=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},Se=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ae=e=>(...t)=>V.asap(()=>e(...t)),Te=pe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,Re=pe.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),V.isString(r)&&s.push("path="+r),V.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ne(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Pe=e=>e instanceof _e?{...e}:e;function je(e,t){t=t||{};const n={};function r(e,t,n,r){return V.isPlainObject(e)&&V.isPlainObject(t)?V.merge.call({caseless:r},e,t):V.isPlainObject(t)?V.merge({},t):V.isArray(t)?t.slice():t}function o(e,t,n,o){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!V.isUndefined(t))return r(void 0,t)}function s(e,t){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(Pe(e),Pe(t),0,!0)};return V.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,s=i(e[r],t[r],r);V.isUndefined(s)&&i!==a||(n[r]=s)}),n}const $e=e=>{const t=je({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=_e.from(s),t.url=oe(Ne(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),V.isFormData(n))if(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(V.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(pe.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||!1!==r&&Te(t.url))){const e=o&&i&&Re.read(i);e&&s.set(o,e)}return t},Ce="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=$e(e);let o=r.data;const i=_e.from(r.headers).normalize();let s,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=_e.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Oe(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new W(t&&t.message?t.message:"Network Error",W.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,o.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&V.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),V.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=xe(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=xe(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new ke(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===pe.protocols.indexOf(v)?n(new W("Unsupported protocol "+v+":",W.ERR_BAD_REQUEST,e)):m.send(o||null)})},Ie=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new ke(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new W(`timeout ${t} of ms exceeded`,W.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>V.asap(s),a}},Ze=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Fe=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ue=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Fe(e))yield*Ze(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:De}=V,Le=(({Request:e,Response:t})=>({Request:e,Response:t}))(V.global),{ReadableStream:Be,TextEncoder:Me}=V.global,qe=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},Ve=e=>{e=V.merge.call({skipUndefined:!0},Le,e);const{fetch:t,Request:n,Response:r}=e,o=t?De(t):"function"==typeof fetch,i=De(n),s=De(r);if(!o)return!1;const a=o&&De(Be),c=o&&("function"==typeof Me?(e=>t=>e.encode(t))(new Me):async e=>new Uint8Array(await new n(e).arrayBuffer())),u=i&&a&&qe(()=>{let e=!1;const t=new n(pe.origin,{body:new Be,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),l=s&&a&&qe(()=>V.isReadableStream(new r("").body)),d={stream:l&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=V.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(V.isBlob(e))return e.size;if(V.isSpecCompliantForm(e)){const t=new n(pe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return V.isArrayBufferView(e)||V.isArrayBuffer(e)?e.byteLength:(V.isURLSearchParams(e)&&(e+=""),V.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:c,cancelToken:p,timeout:h,onDownloadProgress:m,onUploadProgress:g,responseType:v,headers:y,withCredentials:b="same-origin",fetchOptions:w}=$e(e),_=t||fetch;v=v?(v+"").toLowerCase():"text";let E=Ie([c,p&&p.toAbortSignal()],h),z=null;const k=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let O;try{if(g&&u&&"get"!==s&&"head"!==s&&0!==(O=await f(y,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(V.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,n]=Se(O,xe(Ae(g)));a=Ue(t.body,65536,e,n)}}V.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...w,signal:E,method:s.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};z=i&&new n(o,c);let p=await(i?_(z,w):_(o,c));const h=l&&("stream"===v||"response"===v);if(l&&(m||h&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=V.toFiniteNumber(p.headers.get("content-length")),[n,o]=m&&Se(t,xe(Ae(m),!0))||[];p=new r(Ue(p.body,65536,n,()=>{o&&o(),k&&k()}),e)}v=v||"text";let x=await d[V.findKey(d,v)||"text"](p,e);return!h&&k&&k(),await new Promise((t,n)=>{Oe(t,n,{data:x,headers:_e.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:z})})}catch(x){if(k&&k(),x&&"TypeError"===x.name&&/Load failed|fetch/i.test(x.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,z),{cause:x.cause||x});throw W.from(x,x&&x.code,e,z)}}},We=new Map,Je=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,c=i.length,u=We;for(;c--;)s=i[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:Ve(t)),u=a;return a};Je();const He={http:null,xhr:Ce,fetch:{get:Je}};V.forEach(He,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const Ke=e=>`- ${e}`,Ge=e=>V.isFunction(e)||null===e||!1===e,Xe=(e,t)=>{e=V.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ge(r)&&(o=He[(n=String(r)).toLowerCase()],void 0===o))throw new W(`Unknown adapter '${n}'`);if(o&&(V.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new W("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Ke).join("\n"):" "+Ke(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function Ye(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ke(null,e)}function Qe(e){Ye(e),e.headers=_e.from(e.headers),e.data=Ee.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Xe(e.adapter||me.adapter,e)(e).then(function(t){return Ye(e),t.data=Ee.call(e,e.transformResponse,t),t.headers=_e.from(t.headers),t},function(t){return ze(t)||(Ye(e),t&&t.response&&(t.response.data=Ee.call(e,e.transformResponse,t.response),t.response.headers=_e.from(t.response.headers))),Promise.reject(t)})}const et="1.12.2",tt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nt={};tt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+et+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new W(r(o," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!nt[o]&&(nt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},tt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const rt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new W("option "+i+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+i,W.ERR_BAD_OPTION)}},validators:tt},ot=rt.validators;let it=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=je(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&rt.assertOptions(n,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean)},!1),null!=r&&(V.isFunction(r)?t.paramsSerializer={serialize:r}:rt.assertOptions(r,{encode:ot.function,serialize:ot.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rt.assertOptions(t,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&V.merge(o.common,o[t.method]);o&&V.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=_e.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[Qe.bind(this),void 0];for(e.unshift(...s),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=s.length;let f=t;for(;d<l;){const e=s[d++],t=s[d++];try{f=e(f)}catch(p){t.call(this,p);break}}try{u=Qe.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return oe(Ne((e=je(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};V.forEach(["delete","get","head","options"],function(e){it.prototype[e]=function(t,n){return this.request(je(n||{},{method:e,url:t,data:(n||{}).data}))}}),V.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(je(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}it.prototype[e]=t(),it.prototype[e+"Form"]=t(!0)});const st={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(st).forEach(([e,t])=>{st[t]=e});const at=function e(t){const n=new it(t),o=r(it.prototype.request,n);return V.extend(o,it.prototype,n,{allOwnKeys:!0}),V.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(je(t,n))},o}(me);at.Axios=it,at.CanceledError=ke,at.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ke(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},at.isCancel=ze,at.VERSION=et,at.toFormData=Q,at.AxiosError=W,at.Cancel=at.CanceledError,at.all=function(e){return Promise.all(e)},at.spread=function(e){return function(t){return e.apply(null,t)}},at.isAxiosError=function(e){return V.isObject(e)&&!0===e.isAxiosError},at.mergeConfig=je,at.AxiosHeaders=_e,at.formToJSON=e=>he(V.isHTMLForm(e)?new FormData(e):e),at.getAdapter=Xe,at.HttpStatusCode=st,at.default=at;const{Axios:ct,AxiosError:ut,CanceledError:lt,isCancel:dt,CancelToken:ft,VERSION:pt,all:ht,Cancel:mt,isAxiosError:gt,spread:vt,toFormData:yt,AxiosHeaders:bt,HttpStatusCode:wt,formToJSON:_t,getAdapter:Et,mergeConfig:zt}=at;function kt(e){const t="sandbox"===e?"https://sandbox.api.marlim.co":"https://api.marlim.co";if(!t)throw new Error("Base URL is not defined");return at.create({baseURL:t,timeout:1e4,headers:{"Content-Type":"application/json"}})}kt("sandbox"),kt("production");class Ot{constructor(e){n(this,"env"),n(this,"apiVersion"),n(this,"api"),n(this,"bearerToken"),this.apiVersion="v3",this.env=e.env,this.bearerToken=e.token,this.api=kt(this.env),this.api.interceptors.request.use(e=>(this.bearerToken&&(e.headers.Authorization=`Bearer ${this.bearerToken}`),e))}async createSetup(e){try{return(await this.api.post(`/${this.apiVersion}/3ds/setup`,e)).data}catch(t){throw this.handleError(t)}}async authenticate(e){try{return(await this.api.post(`/${this.apiVersion}/3ds/authenticate`,e)).data}catch(t){throw this.handleError(t)}}handleError(e){var t,n;return at.isAxiosError(e)?new Error((null==(n=null==(t=e.response)?void 0:t.data)?void 0:n.message)||"Request error."):e}}const xt={"01":{width:400,height:250},"02":{width:400,height:390},"03":{width:600,height:500},"04":{width:400,height:600},"05":{width:window.screen.width,height:window.screen.height}},St="step-up-iframe",At="step-up-form",Tt="challenge-modal-overlay";function Rt(e,t,n=null,r=null){e&&e.parentNode&&e.parentNode.removeChild(e),t&&t.parentNode&&t.parentNode.removeChild(t),n&&n.parentNode&&n.parentNode.removeChild(n),r&&r.parentNode&&r.parentNode.removeChild(r),document.body.classList.remove("challenge-modal-open")}function Nt(){const e=e=>{"Escape"===e.key&&function(){const e=document.getElementById(Tt);e&&(e.classList.remove("show"),document.body.classList.remove("challenge-modal-open"),setTimeout(()=>{Rt(document.getElementsByName(St)[0],document.getElementById(At),e,null)},300))}()};document.addEventListener("keydown",e),window.challengeModalKeyHandler=e}async function Pt(e){return new Promise((t,n)=>{let r=null,o=null,i=null,s=null,a=null;try{!function(){if(document.getElementById("challenge-modal-css"))return;const e=document.createElement("style");e.id="challenge-modal-css",e.innerHTML="\n .challenge-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.6);\n z-index: 9998;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n visibility: hidden;\n }\n\n .challenge-modal-overlay.show {\n opacity: 1;\n visibility: visible;\n }\n\n .challenge-modal-wrapper {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .challenge-modal-container {\n position: relative;\n border-radius: 8px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);\n background: white;\n max-width: 90vw;\n max-height: 90vh;\n overflow: hidden;\n }\n\n .challenge-modal-iframe {\n border: none;\n border-radius: 8px;\n display: block;\n background: white;\n }\n\n .challenge-modal-close {\n position: absolute;\n top: -15px;\n right: -15px;\n width: 30px;\n height: 30px;\n border-radius: 50%;\n background: #333;\n color: white;\n border: 2px solid white;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n font-weight: bold;\n z-index: 10000;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n line-height: 1;\n }\n\n @media (max-width: 768px) {\n .challenge-modal-container {\n margin: 20px;\n max-width: calc(100vw - 40px);\n max-height: calc(100vh - 40px);\n }\n \n .challenge-modal-iframe {\n width: 100% !important;\n min-height: 300px;\n }\n }\n\n body.challenge-modal-open {\n overflow: hidden;\n }\n ",document.head.appendChild(e)}();const n=function(e){const t=xt[e]||xt["01"];return"05"===e?{width:Math.min(.9*window.innerWidth,1200),height:Math.min(.9*window.innerHeight,800)}:t}(e.windowSize);i=function(){const e=document.createElement("div");return e.id=Tt,e.className="challenge-modal-overlay",document.body.appendChild(e),e}(),s=function(e){const t=document.createElement("div");return t.id="challenge-modal-container",t.className="challenge-modal-container",t.style.width=`${e.width}px`,t.style.height=`${e.height}px`,t}(n),r=function(e){const t=document.createElement("iframe");return t.name=St,t.className="challenge-modal-iframe",t.height=e.height.toString(),t.width=e.width.toString(),t.setAttribute("allowfullscreen","true"),t.setAttribute("frameborder","0"),t}(n),o=function(e){const t=document.createElement("form");t.id=At,t.target=St,t.method="POST",t.action=e.url,t.style.display="none";const n=document.createElement("input");return n.type="hidden",n.name="JWT",n.value=e.accessToken,t.appendChild(n),document.body.appendChild(t),t}(e);const c=document.createElement("div");c.className="challenge-modal-wrapper",s.appendChild(r),c.appendChild(s),i.appendChild(c),Nt(),function(){const e=document.getElementById(Tt);e&&(document.body.classList.add("challenge-modal-open"),setTimeout(()=>{e.classList.add("show")},10))}(),a=function(e,t,n,r,o){return i=>{try{"completed"===i.data.status&&(console.log("Challenge completed"),Rt(e,t,n,r),o())}catch(s){console.error("Erro ao processar message do Session:",s)}}}(r,o,i,s,t),window.addEventListener("message",a,!1),o.submit()}catch(c){console.error("Erro ao processar desafio de autenticação:",c),Rt(r,o,i,s),n(c)}})}const jt="session-iframe";function $t(e){return new Promise((t,n)=>{const{env:r,accessToken:o,dataCollectionUrl:i}=e;let s=null,a=null;const c=()=>{!function(e){e&&window.removeEventListener("message",e)}(a)};try{!function(){const e=document.createElement("iframe");e.name=jt,e.height="1",e.width="1",e.style.display="none",document.body.appendChild(e)}(),s=function(e,t){const n=document.createElement("form");n.id="session-form",n.target=jt,n.method="POST",n.action=e;const r=document.createElement("input");return r.type="hidden",r.name="JWT",r.value=t,n.appendChild(r),document.body.appendChild(n),n}(i,o),a=function(e,t,n){return r=>{try{r.origin===("sandbox"===e?"https://centinelapistag.cardinalcommerce.com":"https://centinelapi.cardinalcommerce.com")&&"profile.completed"===JSON.parse(r.data).MessageType&&(console.log("Profile completed"),n(),t())}catch(o){console.error("Erro ao processar message do Session:",o)}}}(r,t,c),window.addEventListener("message",a,!1),s.submit()}catch(u){c(),n(u)}})}function Ct(){try{return"undefined"!=typeof window&&("undefined"!=typeof document&&("undefined"!=typeof Array&&"undefined"!=typeof Object))}catch(e){return!1}}function It(e,t,n){function r(n,r){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,r);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=r}const o=(null==n?void 0:n.Parent)??Object;class i extends o{}function s(e){var t;const o=(null==n?void 0:n.Parent)?new i:this;r(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r,o;return!!((null==n?void 0:n.Parent)&&t instanceof n.Parent)||(null==(o=null==(r=null==t?void 0:t._zod)?void 0:r.traits)?void 0:o.has(e))}}),Object.defineProperty(s,"name",{value:e}),s}class Zt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ft extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Ut={};function Dt(e){return Ut}function Lt(e,t){return"bigint"==typeof t?t.toString():t}function Bt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mt(e){return null==e}function qt(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Vt=Symbol("evaluating");function Wt(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Vt)return void 0===r&&(r=Vt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Jt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ht(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Kt(e){return JSON.stringify(e)}const Gt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Yt=Bt(()=>{var e;if("undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.includes("Cloudflare")))return!1;try{return new Function(""),!0}catch(t){return!1}});function Qt(e){if(!1===Xt(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==Xt(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function en(e){return Qt(e)?{...e}:Array.isArray(e)?[...e]:e}const tn=new Set(["string","number","symbol"]);function nn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!(null==n?void 0:n.parent)||(r._zod.parent=e),r}function on(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==(null==t?void 0:t.message)){if(void 0!==(null==t?void 0:t.error))throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const sn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function an(e,t=0){var n;if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==(null==(n=e.issues[r])?void 0:n.continue))return!0;return!1}function cn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function un(e){return"string"==typeof e?e:null==e?void 0:e.message}function ln(e,t,n){var r,o,i,s,a,c;const u={...e,path:e.path??[]};if(!e.message){const l=un(null==(i=null==(o=null==(r=e.inst)?void 0:r._zod.def)?void 0:o.error)?void 0:i.call(o,e))??un(null==(s=null==t?void 0:t.error)?void 0:s.call(t,e))??un(null==(a=n.customError)?void 0:a.call(n,e))??un(null==(c=n.localeError)?void 0:c.call(n,e))??"Invalid input";u.message=l}return delete u.inst,delete u.continue,(null==t?void 0:t.reportInput)||delete u.input,u}function dn(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function fn(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const pn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Lt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},hn=It("$ZodError",pn),mn=It("$ZodError",pn,{Parent:Error});const gn=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Zt;if(s.issues.length){const t=new((null==o?void 0:o.Err)??e)(s.issues.map(e=>ln(e,i,Dt())));throw Gt(t,null==o?void 0:o.callee),t}return s.value},vn=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new((null==o?void 0:o.Err)??e)(s.issues.map(e=>ln(e,i,Dt())));throw Gt(t,null==o?void 0:o.callee),t}return s.value},yn=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Zt;return i.issues.length?{success:!1,error:new(e??hn)(i.issues.map(e=>ln(e,o,Dt())))}:{success:!0,data:i.value}},bn=yn(mn),wn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>ln(e,o,Dt())))}:{success:!0,data:i.value}},_n=wn(mn),En=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return gn(e)(t,n,o)},zn=e=>(t,n,r)=>gn(e)(t,n,r),kn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vn(e)(t,n,o)},On=e=>async(t,n,r)=>vn(e)(t,n,r),xn=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return yn(e)(t,n,o)},Sn=e=>(t,n,r)=>yn(e)(t,n,r),An=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return wn(e)(t,n,o)},Tn=e=>async(t,n,r)=>wn(e)(t,n,r),Rn=/^[cC][^\s-]{8,}$/,Nn=/^[0-9a-z]+$/,Pn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jn=/^[0-9a-vA-V]{20}$/,$n=/^[A-Za-z0-9]{27}$/,Cn=/^[a-zA-Z0-9_-]{21}$/,In=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Un=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Dn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Mn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vn=/^[A-Za-z0-9_-]*$/,Wn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Jn=/^\+(?:[0-9]){6,14}[0-9]$/,Hn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Kn=new RegExp(`^${Hn}$`);function Gn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Xn=/^-?\d+$/,Yn=/^-?\d+(?:\.\d+)?/,Qn=/^(?:true|false)$/i,er=/^[^A-Z]*$/,tr=/^[^a-z]*$/,nr=It("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rr={number:"number",bigint:"bigint",object:"date"},or=It("$ZodCheckLessThan",(e,t)=>{nr.init(e,t);const n=rr[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ir=It("$ZodCheckGreaterThan",(e,t)=>{nr.init(e,t);const n=rr[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sr=It("$ZodCheckMultipleOf",(e,t)=>{nr.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(o=Number.parseInt(e[1]))}const i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ar=It("$ZodCheckNumberFormat",(e,t)=>{var n;nr.init(e,t),t.format=t.format||"float64";const r=null==(n=t.format)?void 0:n.includes("int"),o=r?"int":"number",[i,s]=sn[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=s,r&&(n.pattern=Xn)}),e._zod.check=n=>{const a=n.value;if(r){if(!Number.isInteger(a))return void n.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?n.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):n.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}))}a<i&&n.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&n.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),cr=It("$ZodCheckMaxLength",(e,t)=>{var n;nr.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Mt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=dn(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ur=It("$ZodCheckMinLength",(e,t)=>{var n;nr.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Mt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=dn(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lr=It("$ZodCheckLengthEquals",(e,t)=>{var n;nr.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Mt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const i=dn(r),s=o>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),dr=It("$ZodCheckStringFormat",(e,t)=>{var n,r;nr.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),fr=It("$ZodCheckRegex",(e,t)=>{dr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pr=It("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=er),dr.init(e,t)}),hr=It("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=tr),dr.init(e,t)}),mr=It("$ZodCheckIncludes",(e,t)=>{nr.init(e,t);const n=nn(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),gr=It("$ZodCheckStartsWith",(e,t)=>{nr.init(e,t);const n=new RegExp(`^${nn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vr=It("$ZodCheckEndsWith",(e,t)=>{nr.init(e,t);const n=new RegExp(`.*${nn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),yr=It("$ZodCheckOverwrite",(e,t)=>{nr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class br{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const o of r)this.content.push(o)}compile(){return new Function(...null==this?void 0:this.args,[...((null==this?void 0:this.content)??[""]).map(e=>` ${e}`)].join("\n"))}}const wr={major:4,minor:1,patch:12},_r=It("$ZodType",(e,t)=>{var n,r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wr;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const i of o)for(const t of i._zod.onattach)t(e);if(0===o.length)(r=e._zod).deferred??(r.deferred=[]),null==(n=e._zod.deferred)||n.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,o=an(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&!1===(null==n?void 0:n.async))throw new Zt;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(o||(o=an(e,t)))});else{if(e.issues.length===t)continue;o||(o=an(e,t))}}return r?r.then(()=>e):e},n=(n,r,i)=>{if(an(n))return n.aborted=!0,n;const s=t(r,o,i);if(s instanceof Promise){if(!1===i.async)throw new Zt;return s.then(t=>e._zod.parse(t,i))}return e._zod.parse(s,i)};e._zod.run=(r,i)=>{if(i.skipChecks)return e._zod.parse(r,i);if("backward"===i.direction){const t=e._zod.parse({value:r.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,i)):n(t,r,i)}const s=e._zod.parse(r,i);if(s instanceof Promise){if(!1===i.async)throw new Zt;return s.then(e=>t(e,o,i))}return t(s,o,i)}}e["~standard"]={validate:t=>{var n;try{const r=bn(e,t);return r.success?{value:r.data}:{issues:null==(n=r.error)?void 0:n.issues}}catch(r){return _n(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:null==(t=e.error)?void 0:t.issues}})}},vendor:"zod",version:1}}),Er=It("$ZodString",(e,t)=>{var n;_r.init(e,t),e._zod.pattern=[...(null==(n=null==e?void 0:e._zod.bag)?void 0:n.patterns)??[]].pop()??(e=>{const t=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)})(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),zr=It("$ZodStringFormat",(e,t)=>{dr.init(e,t),Er.init(e,t)}),kr=It("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zn),zr.init(e,t)}),Or=It("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Fn(e))}else t.pattern??(t.pattern=Fn());zr.init(e,t)}),xr=It("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Un),zr.init(e,t)}),Sr=It("$ZodURL",(e,t)=>{zr.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Wn.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ar=It("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zr.init(e,t)}),Tr=It("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Cn),zr.init(e,t)}),Rr=It("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rn),zr.init(e,t)}),Nr=It("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nn),zr.init(e,t)}),Pr=It("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Pn),zr.init(e,t)}),jr=It("$ZodXID",(e,t)=>{t.pattern??(t.pattern=jn),zr.init(e,t)}),$r=It("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=$n),zr.init(e,t)}),Cr=It("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Gn({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Hn}T(?:${r})$`)}(t)),zr.init(e,t)}),Ir=It("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Kn),zr.init(e,t)}),Zr=It("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Gn(t)}$`)),zr.init(e,t)}),Fr=It("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=In),zr.init(e,t)}),Ur=It("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dn),zr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Dr=It("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ln),zr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Lr=It("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bn),zr.init(e,t)}),Br=It("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Mn),zr.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Mr(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const qr=It("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qn),zr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{Mr(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const Vr=It("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Vn),zr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{(function(e){if(!Vn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Mr(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Wr=It("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Jn),zr.init(e,t)});const Jr=It("$ZodJWT",(e,t)=>{zr.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&"JWT"!==(null==o?void 0:o.typ)||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Hr=It("$ZodNumber",(e,t)=>{_r.init(e,t),e._zod.pattern=e._zod.bag.pattern??Yn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Kr=It("$ZodNumber",(e,t)=>{ar.init(e,t),Hr.init(e,t)}),Gr=It("$ZodBoolean",(e,t)=>{_r.init(e,t),e._zod.pattern=Qn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Xr=It("$ZodAny",(e,t)=>{_r.init(e,t),e._zod.parse=e=>e}),Yr=It("$ZodUnknown",(e,t)=>{_r.init(e,t),e._zod.parse=e=>e}),Qr=It("$ZodNever",(e,t)=>{_r.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function eo(e,t,n){e.issues.length&&t.issues.push(...cn(n,e.issues)),t.value[n]=e.value}const to=It("$ZodArray",(e,t)=>{_r.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(t=>eo(t,n,e))):eo(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function no(e,t,n,r){e.issues.length&&t.issues.push(...cn(n,e.issues)),void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ro(e){var t,n,r,o;const i=Object.keys(e.shape);for(const c of i)if(!(null==(o=null==(r=null==(n=null==(t=e.shape)?void 0:t[c])?void 0:n._zod)?void 0:r.traits)?void 0:o.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const s=(a=e.shape,Object.keys(a).filter(e=>"optional"===a[e]._zod.optin&&"optional"===a[e]._zod.optout));var a;return{...e,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(s)}}function oo(e,t,n,r,o,i){const s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(const l of Object.keys(t)){if(a.has(l))continue;if("never"===u){s.push(l);continue}const o=c.run({value:t[l],issues:[]},r);o instanceof Promise?e.push(o.then(e=>no(e,n,l,t))):no(o,n,l,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const io=It("$ZodObject",(e,t)=>{_r.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(null==n?void 0:n.get)){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=Bt(()=>ro(t));Wt(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const o=Xt,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!o(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],u=s.shape;for(const e of s.keys){const r=u[e]._zod.run({value:a[e],issues:[]},n);r instanceof Promise?c.push(r.then(n=>no(n,t,e,a))):no(r,t,e,a)}return i?oo(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),so=It("$ZodObjectJIT",(e,t)=>{io.init(e,t);const n=e._zod.parse,r=Bt(()=>ro(t));let o;const i=Xt,s=!Ut.jitless,a=s&&Yt.value,c=t.catchall;let u;e._zod.parse=(l,d)=>{u??(u=r.value);const f=l.value;return i(f)?s&&a&&!1===(null==d?void 0:d.async)&&!0!==d.jitless?(o||(o=(e=>{const t=new br(["shape","payload","ctx"]),n=r.value,o=e=>{const t=Kt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const r of n.keys)i[r]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const e=i[r],n=Kt(r);t.write(`const ${e} = ${o(r)};`),t.write(`\n if (${e}.issues.length) {\n payload.issues = payload.issues.concat(${e}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}]\n })));\n }\n \n \n if (${e}.value === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n newResult[${n}] = ${e}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),l=o(l,d),c?oo([],f,l,d,u,e):l):n(l,d):(l.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),l)}});function ao(e,t,n,r){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const o=e.filter(e=>!an(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ln(e,r,Dt())))}),t)}const co=It("$ZodUnion",(e,t)=>{_r.init(e,t),Wt(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Wt(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Wt(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Wt(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>qt(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>ao(t,o,e,i)):ao(a,o,e,i)}}),uo=It("$ZodIntersection",(e,t)=>{_r.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,o=t.left._zod.run({value:r,issues:[]},n),i=t.right._zod.run({value:r,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([t,n])=>fo(e,t,n)):fo(e,o,i)}});function lo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Qt(e)&&Qt(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),o={...e,...t};for(const i of r){const n=lo(e[i],t[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o[i]=n.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=lo(e[r],t[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fo(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),an(e))return e;const r=lo(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const po=It("$ZodEnum",(e,t)=>{_r.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>tn.has(typeof e)).map(e=>"string"==typeof e?nn(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return r.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),ho=It("$ZodTransform",(e,t)=>{_r.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Ft(e.constructor.name);const o=t.transform(n.value,n);if(r.async){return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n))}if(o instanceof Promise)throw new Zt;return n.value=o,n}});function mo(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const go=It("$ZodOptional",(e,t)=>{_r.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Wt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Wt(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${qt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>mo(t,e.value)):mo(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),vo=It("$ZodNullable",(e,t)=>{_r.init(e,t),Wt(e._zod,"optin",()=>t.innerType._zod.optin),Wt(e._zod,"optout",()=>t.innerType._zod.optout),Wt(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${qt(e.source)}|null)$`):void 0}),Wt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),yo=It("$ZodDefault",(e,t)=>{_r.init(e,t),e._zod.optin="optional",Wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>bo(e,t)):bo(r,t)}});function bo(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const wo=It("$ZodPrefault",(e,t)=>{_r.init(e,t),e._zod.optin="optional",Wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),_o=It("$ZodNonOptional",(e,t)=>{_r.init(e,t),Wt(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(t=>Eo(t,e)):Eo(o,e)}});function Eo(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const zo=It("$ZodCatch",(e,t)=>{_r.init(e,t),Wt(e._zod,"optin",()=>t.innerType._zod.optin),Wt(e._zod,"optout",()=>t.innerType._zod.optout),Wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ln(e,n,Dt()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ln(e,n,Dt()))},input:e.value}),e.issues=[]),e)}}),ko=It("$ZodPipe",(e,t)=>{_r.init(e,t),Wt(e._zod,"values",()=>t.in._zod.values),Wt(e._zod,"optin",()=>t.in._zod.optin),Wt(e._zod,"optout",()=>t.out._zod.optout),Wt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Oo(e,t.in,n)):Oo(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Oo(e,t.out,n)):Oo(r,t.out,n)}});function Oo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const xo=It("$ZodReadonly",(e,t)=>{_r.init(e,t),Wt(e._zod,"propValues",()=>t.innerType._zod.propValues),Wt(e._zod,"values",()=>t.innerType._zod.values),Wt(e._zod,"optin",()=>t.innerType._zod.optin),Wt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(So):So(r)}});function So(e){return e.value=Object.freeze(e.value),e}const Ao=It("$ZodCustom",(e,t)=>{nr.init(e,t),_r.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>To(t,n,r,e));To(o,n,r,e)}});function To(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(fn(e))}}class Ro{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function No(){return new Ro}const Po=No();function jo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...on(t)})}function $o(e,t){return new or({check:"less_than",...on(t),value:e,inclusive:!1})}function Co(e,t){return new or({check:"less_than",...on(t),value:e,inclusive:!0})}function Io(e,t){return new ir({check:"greater_than",...on(t),value:e,inclusive:!1})}function Zo(e,t){return new ir({check:"greater_than",...on(t),value:e,inclusive:!0})}function Fo(e,t){return new sr({check:"multiple_of",...on(t),value:e})}function Uo(e,t){return new cr({check:"max_length",...on(t),maximum:e})}function Do(e,t){return new ur({check:"min_length",...on(t),minimum:e})}function Lo(e,t){return new lr({check:"length_equals",...on(t),length:e})}function Bo(e){return new yr({check:"overwrite",tx:e})}function Mo(e){const t=function(e,t){const n=new nr({check:"custom",...on(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(fn(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(fn(r))}},e(n.value,n)));return t}const qo=It("ZodISODateTime",(e,t)=>{Cr.init(e,t),mi.init(e,t)});function Vo(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...on(t)})}(qo,e)}const Wo=It("ZodISODate",(e,t)=>{Ir.init(e,t),mi.init(e,t)});function Jo(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...on(t)})}(Wo,e)}const Ho=It("ZodISOTime",(e,t)=>{Zr.init(e,t),mi.init(e,t)});function Ko(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...on(t)})}(Ho,e)}const Go=It("ZodISODuration",(e,t)=>{Fr.init(e,t),mi.init(e,t)});function Xo(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...on(t)})}(Go,e)}const Yo=It("ZodError",(e,t)=>{hn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e}));else if("invalid_key"===o.code)r({issues:o.issues});else if("invalid_element"===o.code)r({issues:o.issues});else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Lt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Lt,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),Qo=gn(Yo),ei=vn(Yo),ti=yn(Yo),ni=wn(Yo),ri=En(Yo),oi=zn(Yo),ii=kn(Yo),si=On(Yo),ai=xn(Yo),ci=Sn(Yo),ui=An(Yo),li=Tn(Yo),di=It("ZodType",(e,t)=>(_r.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ht(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,n)=>rn(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>Qo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ti(e,t,n),e.parseAsync=async(t,n)=>ei(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ni(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ri(e,t,n),e.decode=(t,n)=>oi(e,t,n),e.encodeAsync=async(t,n)=>ii(e,t,n),e.decodeAsync=async(t,n)=>si(e,t,n),e.safeEncode=(t,n)=>ai(e,t,n),e.safeDecode=(t,n)=>ci(e,t,n),e.safeEncodeAsync=async(t,n)=>ui(e,t,n),e.safeDecodeAsync=async(t,n)=>li(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...on(n)})}(us,e,t)}(t,n)),e.superRefine=t=>e.check(Mo(t)),e.overwrite=t=>e.check(Bo(t)),e.optional=()=>Qi(e),e.nullable=()=>ts(e),e.nullish=()=>Qi(ts(e)),e.nonoptional=t=>function(e,t){return new os({type:"nonoptional",innerType:e,...on(t)})}(e,t),e.array=()=>{return function(e,t,n){return new e({type:"array",element:t,...on(n)})}(qi,e,t);var t},e.or=t=>{return new Ji({type:"union",options:[e,t],...on(n)});var n},e.and=t=>new Hi({type:"intersection",left:e,right:t}),e.transform=t=>as(e,new Xi({type:"transform",transform:t})),e.default=t=>{return n=t,new ns({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():en(n)}});var n},e.prefault=t=>{return n=t,new rs({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():en(n)}});var n},e.catch=t=>{return new is({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>as(e,t),e.readonly=()=>new cs({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Po.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){var t;return null==(t=Po.get(e))?void 0:t.description},configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Po.get(e);const n=e.clone();return Po.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),fi=It("_ZodString",(e,t)=>{Er.init(e,t),di.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new fr({check:"string_format",format:"regex",...on(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new mr({check:"string_format",format:"includes",...on(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new gr({check:"string_format",format:"starts_with",...on(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new vr({check:"string_format",format:"ends_with",...on(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Do(...t)),e.max=(...t)=>e.check(Uo(...t)),e.length=(...t)=>e.check(Lo(...t)),e.nonempty=(...t)=>e.check(Do(1,...t)),e.lowercase=t=>e.check(function(e){return new pr({check:"string_format",format:"lowercase",...on(e)})}(t)),e.uppercase=t=>e.check(function(e){return new hr({check:"string_format",format:"uppercase",...on(e)})}(t)),e.trim=()=>e.check(Bo(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Bo(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Bo(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Bo(e=>e.toUpperCase()))}),pi=It("ZodString",(e,t)=>{Er.init(e,t),fi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...on(t)})}(gi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...on(t)})}(bi,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...on(t)})}($i,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...on(t)})}(wi,t)),e.guid=t=>e.check(jo(vi,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...on(t)})}(yi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...on(t)})}(yi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...on(t)})}(yi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...on(t)})}(yi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...on(t)})}(_i,t)),e.guid=t=>e.check(jo(vi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...on(t)})}(Ei,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...on(t)})}(zi,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...on(t)})}(ki,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...on(t)})}(Ni,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...on(t)})}(Pi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...on(t)})}(Oi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...on(t)})}(xi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...on(t)})}(Si,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...on(t)})}(Ai,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...on(t)})}(Ti,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...on(t)})}(Ri,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...on(t)})}(ji,t)),e.datetime=t=>e.check(Vo(t)),e.date=t=>e.check(Jo(t)),e.time=t=>e.check(Ko(t)),e.duration=t=>e.check(Xo(t))});function hi(e){return function(e,t){return new e({type:"string",...on(t)})}(pi,e)}const mi=It("ZodStringFormat",(e,t)=>{zr.init(e,t),fi.init(e,t)}),gi=It("ZodEmail",(e,t)=>{xr.init(e,t),mi.init(e,t)}),vi=It("ZodGUID",(e,t)=>{kr.init(e,t),mi.init(e,t)}),yi=It("ZodUUID",(e,t)=>{Or.init(e,t),mi.init(e,t)}),bi=It("ZodURL",(e,t)=>{Sr.init(e,t),mi.init(e,t)}),wi=It("ZodEmoji",(e,t)=>{Ar.init(e,t),mi.init(e,t)}),_i=It("ZodNanoID",(e,t)=>{Tr.init(e,t),mi.init(e,t)}),Ei=It("ZodCUID",(e,t)=>{Rr.init(e,t),mi.init(e,t)}),zi=It("ZodCUID2",(e,t)=>{Nr.init(e,t),mi.init(e,t)}),ki=It("ZodULID",(e,t)=>{Pr.init(e,t),mi.init(e,t)}),Oi=It("ZodXID",(e,t)=>{jr.init(e,t),mi.init(e,t)}),xi=It("ZodKSUID",(e,t)=>{$r.init(e,t),mi.init(e,t)}),Si=It("ZodIPv4",(e,t)=>{Ur.init(e,t),mi.init(e,t)}),Ai=It("ZodIPv6",(e,t)=>{Dr.init(e,t),mi.init(e,t)}),Ti=It("ZodCIDRv4",(e,t)=>{Lr.init(e,t),mi.init(e,t)}),Ri=It("ZodCIDRv6",(e,t)=>{Br.init(e,t),mi.init(e,t)}),Ni=It("ZodBase64",(e,t)=>{qr.init(e,t),mi.init(e,t)}),Pi=It("ZodBase64URL",(e,t)=>{Vr.init(e,t),mi.init(e,t)}),ji=It("ZodE164",(e,t)=>{Wr.init(e,t),mi.init(e,t)}),$i=It("ZodJWT",(e,t)=>{Jr.init(e,t),mi.init(e,t)}),Ci=It("ZodNumber",(e,t)=>{Hr.init(e,t),di.init(e,t),e.gt=(t,n)=>e.check(Io(t,n)),e.gte=(t,n)=>e.check(Zo(t,n)),e.min=(t,n)=>e.check(Zo(t,n)),e.lt=(t,n)=>e.check($o(t,n)),e.lte=(t,n)=>e.check(Co(t,n)),e.max=(t,n)=>e.check(Co(t,n)),e.int=t=>e.check(Zi(t)),e.safe=t=>e.check(Zi(t)),e.positive=t=>e.check(Io(0,t)),e.nonnegative=t=>e.check(Zo(0,t)),e.negative=t=>e.check($o(0,t)),e.nonpositive=t=>e.check(Co(0,t)),e.multipleOf=(t,n)=>e.check(Fo(t,n)),e.step=(t,n)=>e.check(Fo(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});const Ii=It("ZodNumberFormat",(e,t)=>{Kr.init(e,t),Ci.init(e,t)});function Zi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...on(t)})}(Ii,e)}const Fi=It("ZodBoolean",(e,t)=>{Gr.init(e,t),di.init(e,t)});const Ui=It("ZodAny",(e,t)=>{Xr.init(e,t),di.init(e,t)});const Di=It("ZodUnknown",(e,t)=>{Yr.init(e,t),di.init(e,t)});function Li(){return new Di({type:"unknown"})}const Bi=It("ZodNever",(e,t)=>{Qr.init(e,t),di.init(e,t)});function Mi(e){return function(e,t){return new e({type:"never",...on(t)})}(Bi,e)}const qi=It("ZodArray",(e,t)=>{to.init(e,t),di.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Do(t,n)),e.nonempty=t=>e.check(Do(1,t)),e.max=(t,n)=>e.check(Uo(t,n)),e.length=(t,n)=>e.check(Lo(t,n)),e.unwrap=()=>e.element});const Vi=It("ZodObject",(e,t)=>{so.init(e,t),di.init(e,t),Wt(e,"shape",()=>t.shape),e.keyof=()=>Gi(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Li()}),e.loose=()=>e.clone({...e._zod.def,catchall:Li()}),e.strict=()=>e.clone({...e._zod.def,catchall:Mi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Qt(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Ht(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Jt(this,"shape",n),n},checks:[]});return rn(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!Qt(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Jt(this,"shape",n),n},checks:e._zod.def.checks};return rn(e,n)}(e,t),e.merge=t=>function(e,t){const n=Ht(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Jt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return rn(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return rn(e,Ht(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Jt(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=Ht(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Jt(this,"shape",r),r},checks:[]});return rn(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const r=Ht(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)o[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Jt(this,"shape",o),o},checks:[]});return rn(t,r)}(Yi,e,t[0]),e.required=(...t)=>function(e,t,n){const r=Ht(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)o[t]=new e({type:"nonoptional",innerType:r[t]});return Jt(this,"shape",o),o},checks:[]});return rn(t,r)}(os,e,t[0])});function Wi(e,t){const n={type:"object",shape:e??{},...on(t)};return new Vi(n)}const Ji=It("ZodUnion",(e,t)=>{co.init(e,t),di.init(e,t),e.options=t.options});const Hi=It("ZodIntersection",(e,t)=>{uo.init(e,t),di.init(e,t)});const Ki=It("ZodEnum",(e,t)=>{po.init(e,t),di.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new Ki({...t,checks:[],...on(r),entries:o})},e.exclude=(e,r)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new Ki({...t,checks:[],...on(r),entries:o})}});function Gi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ki({type:"enum",entries:n,...on(t)})}const Xi=It("ZodTransform",(e,t)=>{ho.init(e,t),di.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Ft(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(fn(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(fn(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n)):(n.value=o,n)}});const Yi=It("ZodOptional",(e,t)=>{go.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Qi(e){return new Yi({type:"optional",innerType:e})}const es=It("ZodNullable",(e,t)=>{vo.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ts(e){return new es({type:"nullable",innerType:e})}const ns=It("ZodDefault",(e,t)=>{yo.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const rs=It("ZodPrefault",(e,t)=>{wo.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType});const os=It("ZodNonOptional",(e,t)=>{_o.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType});const is=It("ZodCatch",(e,t)=>{zo.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const ss=It("ZodPipe",(e,t)=>{ko.init(e,t),di.init(e,t),e.in=t.in,e.out=t.out});function as(e,t){return new ss({type:"pipe",in:e,out:t})}const cs=It("ZodReadonly",(e,t)=>{xo.init(e,t),di.init(e,t),e.unwrap=()=>e._zod.def.innerType});const us=It("ZodCustom",(e,t)=>{Ao.init(e,t),di.init(e,t)});const ls=Wi({token:hi({message:"token is required"}),env:Gi(["sandbox","production"],{message:"env is required and only sandbox or production are supported"})});const ds={amount:(fs={error:"Amount is required"},function(e,t){return new e({type:"number",checks:[],...on(t)})}(Ci,fs)),card_hash:hi().optional(),card:Wi({number:hi({error:"Card number is required"}),expirationDate:hi().refine(function(e){if(!/^(0[1-9]|1[0-2])\d{2}$/.test(e))return!1;const t=parseInt(e.substring(0,2),10),n=2e3+parseInt(e.substring(2),10),r=new Date,o=r.getFullYear(),i=r.getMonth()+1;return!(n<o)&&!(n===o&&t<i)},{error:"Invalid expiration date"}),cvv:hi({error:"CVV is required"}).regex(/^\d{3,4}$/,{message:"CVV must be 3 or 4 digits"}),holderName:hi({error:"Holder name is required"})}).optional(),customer:Wi({name:hi({error:"Name is required"}),documentNumber:hi({error:"Document number is required"}).regex(/^\d+$/,{message:"Document number must not contain special characters"}),email:hi({error:"Invalid email"}),phone:Wi({number:hi({error:"Phone number is required"}),areaCode:hi({error:"Area code is required"}),countryCode:hi({error:"Country code is required"})}),address:Wi({country:hi({error:"Country is required"}),state:hi({error:"State is required"}),city:hi({error:"City is required"}),neighborhood:hi({error:"Neighborhood is required"}),number:hi({error:"Number is required"}),street:hi({error:"Street is required"}),zipcode:hi({error:"Zipcode is required"}),complement:hi().optional()})})};var fs;const ps=Wi({...ds,challenge:function(e){return function(e,t){return new e({type:"boolean",...on(t)})}(Fi,e)}().default(!1)}).refine(e=>e.card_hash||e.card,{error:"At least one of card_hash, or card must be provided"}).refine(e=>1===[e.card_hash,e.card].filter(Boolean).length,{error:"Only one of card_hash, or card can be provided"}),hs=Wi({...ds,challenge:new Ui({type:"any"}).refine(e=>void 0===e,{error:"The field 'challenge' is only allowed in test environments."})}).refine(e=>e.card_hash||e.card,{error:"At least one of card_id, card_hash, or card must be provided"}).refine(e=>1===[e.card_hash,e.card].filter(Boolean).length,{error:"Only one of card_id, card_hash, or card can be provided"});let ms=null;function gs(e){if("undefined"==typeof window||"undefined"==typeof document)throw new Error("Marlim3dsSdk can only be called in a browser environment.");const t=ls.safeParse(e);if(!t.success)throw new Error(t.error.message);ms=t.data}async function vs(e){if(!ms)throw new Error("Marlim SDK not initialized");const t=("sandbox"===ms.env?ps:hs).safeParse(e);if(!t.success)throw new Error(t.error.message);const n={token:ms.token,env:ms.env},r=t.data.card,o=t.data.customer,i=t.data.card_hash,s=await async function(e,t){try{const n=new Ot(e),r=await n.createSetup(t),{access_token:o,data_collection_url:i,session_id:s,card_id:a}=r;if(!o||!i)throw new Error("Invalid API response: access_token or data_collection_url are missing.");return await $t({accessToken:o,dataCollectionUrl:i,env:e.env}),{sessionId:s,cardId:a}}catch(n){let e="Error creating 3DS session";throw n instanceof Error&&(e=n.message),new Error(e)}}(n,{card_hash:i,card_cvv:null==r?void 0:r.cvv,card_expiration_date:null==r?void 0:r.expirationDate,card_holder_name:null==r?void 0:r.holderName,card_number:null==r?void 0:r.number}),a={challenge:t.data.challenge,amount:t.data.amount,card_id:s.cardId,session_id:s.sessionId,customer:{name:o.name,document_number:o.documentNumber,email:o.email,phone:{number:o.phone.number,area_code:o.phone.areaCode,country_code:o.phone.countryCode},address:{country:o.address.country,state:o.address.state,city:o.address.city,neighborhood:o.address.neighborhood,number:o.address.number,street:o.address.street,zipcode:o.address.zipcode,complement:o.address.complement}},device:{channel:"BROWSER",color_depth:window.screen.colorDepth,screen_height:window.screen.height,screen_width:window.screen.width,time_zone_offset:(new Date).getTimezoneOffset().toString(),java_enabled:!!window.WebGLRenderingContext,javascript_enabled:Ct()}},c=await function(e,t){return new Promise(async(n,r)=>{try{const r=new Ot(e),o=await r.authenticate(t);if(o.challenge)return await Pt({url:o.challenge.url,accessToken:o.challenge.access_token,windowSize:o.challenge.window_size}),n({threedsAuthenticationId:o.authentication_id});n({threedsAuthenticationId:o.authentication_id})}catch(o){let e="Error 3DS authentication";o instanceof Error&&(e=o.message),r(e)}})}(n,a);return{card_id:s.cardId,threeds_authentication_id:c.threedsAuthenticationId}}const ys={init:gs,authenticate:vs};return e.authenticate=vs,e.default=ys,e.init=gs,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});
1
+ var MarlimSDK_3DS=function(e){"use strict";var t=Object.defineProperty,n=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);function r(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:s,toStringTag:a}=Symbol,c=(e=>t=>{const n=o.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),u=e=>(e=e.toLowerCase(),t=>c(t)===e),l=e=>t=>typeof t===e,{isArray:d}=Array,f=l("undefined");function p(e){return null!==e&&!f(e)&&null!==e.constructor&&!f(e.constructor)&&g(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const h=u("ArrayBuffer");const m=l("string"),g=l("function"),v=l("number"),y=e=>null!==e&&"object"==typeof e,b=e=>{if("object"!==c(e))return!1;const t=i(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||a in e||s in e)},w=u("Date"),_=u("File"),E=u("Blob"),z=u("FileList"),k=u("URLSearchParams"),[O,x,S,T]=["ReadableStream","Request","Response","Headers"].map(u);function A(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),d(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(p(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let s;for(r=0;r<i;r++)s=o[r],t.call(null,e[s],s,e)}}function R(e,t){if(p(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,P=e=>!f(e)&&e!==N;const j=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&i(Uint8Array)),$=u("HTMLFormElement"),C=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),I=u("RegExp"),Z=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};A(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const F=u("AsyncFunction"),U=(D="function"==typeof setImmediate,L=g(N.postMessage),D?setImmediate:L?(B=`axios@${Math.random()}`,M=[],N.addEventListener("message",({source:e,data:t})=>{e===N&&t===B&&M.length&&M.shift()()},!1),e=>{M.push(e),N.postMessage(B,"*")}):e=>setTimeout(e));var D,L,B,M;const q="undefined"!=typeof queueMicrotask?queueMicrotask.bind(N):"undefined"!=typeof process&&process.nextTick||U,V={isArray:d,isArrayBuffer:h,isBuffer:p,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||g(e.append)&&("formdata"===(t=c(e))||"object"===t&&g(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:m,isNumber:v,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:b,isEmptyObject:e=>{if(!y(e)||p(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(t){return!1}},isReadableStream:O,isRequest:x,isResponse:S,isHeaders:T,isUndefined:f,isDate:w,isFile:_,isBlob:E,isRegExp:I,isFunction:g,isStream:e=>y(e)&&g(e.pipe),isURLSearchParams:k,isTypedArray:j,isFileList:z,forEach:A,merge:function e(){const{caseless:t,skipUndefined:n}=P(this)&&this||{},r={},o=(o,i)=>{const s=t&&R(r,i)||i;b(r[s])&&b(o)?r[s]=e(r[s],o):b(o)?r[s]=e({},o):d(o)?r[s]=o.slice():n&&f(o)||(r[s]=o)};for(let i=0,s=arguments.length;i<s;i++)arguments[i]&&A(arguments[i],o);return r},extend:(e,t,n,{allOwnKeys:o}={})=>(A(t,(t,o)=>{n&&g(t)?e[o]=r(t,n):e[o]=t},{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,s,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)a=o[s],r&&!r(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:c,kindOfTest:u,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(d(e))return e;let t=e.length;if(!v(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[s]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:$,hasOwnProperty:C,hasOwnProp:C,reduceDescriptors:Z,freezeMethods:e=>{Z(e,(t,n)=>{if(g(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];g(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return d(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:R,global:N,isContextDefined:P,isSpecCompliantForm:function(e){return!!(e&&g(e.append)&&"FormData"===e[a]&&e[s])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(p(e))return e;if(!("toJSON"in e)){t[r]=e;const o=d(e)?[]:{};return A(e,(e,t)=>{const i=n(e,r+1);!f(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:F,isThenable:e=>e&&(y(e)||g(e))&&g(e.then)&&g(e.catch),setImmediate:U,asap:q,isIterable:e=>null!=e&&g(e[s])};function W(e,t,n,r,o){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),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}V.inherits(W,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:V.toJSONObject(this.config),code:this.code,status:this.status}}});const J=W.prototype,H={};["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=>{H[e]={value:e}}),Object.defineProperties(W,H),Object.defineProperty(J,"isAxiosError",{value:!0}),W.from=(e,t,n,r,o,i)=>{const s=Object.create(J);V.toFlatObject(e,s,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return W.call(s,a,c,n,r,o),e&&null==s.cause&&Object.defineProperty(s,"cause",{value:e,configurable:!0}),s.name=e&&e.name||"Error",i&&Object.assign(s,i),s};function K(e){return V.isPlainObject(e)||V.isArray(e)}function G(e){return V.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,n){return e?e.concat(t).map(function(e,t){return e=G(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Y=V.toFlatObject(V,{},null,function(e){return/^is[A-Z]/.test(e)});function Q(e,t,n){if(!V.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=V.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!V.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&V.isSpecCompliantForm(t);if(!V.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(V.isDate(e))return e.toISOString();if(V.isBoolean(e))return e.toString();if(!a&&V.isBlob(e))throw new W("Blob is not supported. Use a Buffer instead.");return V.isArrayBuffer(e)||V.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(V.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(V.isArray(e)&&function(e){return V.isArray(e)&&!e.some(K)}(e)||(V.isFileList(e)||V.endsWith(n,"[]"))&&(a=V.toArray(e)))return n=G(n),a.forEach(function(e,r){!V.isUndefined(e)&&null!==e&&t.append(!0===s?X([n],r,i):null===s?n:n+"[]",c(e))}),!1;return!!K(e)||(t.append(X(o,n,i),c(e)),!1)}const l=[],d=Object.assign(Y,{defaultVisitor:u,convertValue:c,isVisitable:K});if(!V.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!V.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),V.forEach(n,function(n,i){!0===(!(V.isUndefined(n)||null===n)&&o.call(t,n,V.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t}function ee(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function te(e,t){this._pairs=[],e&&Q(e,this,t)}const ne=te.prototype;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function oe(e,t,n){if(!t)return e;const r=n&&n.encode||re;V.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let i;if(i=o?o(t,n):V.isURLSearchParams(t)?t.toString():new te(t,n).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}ne.append=function(e,t){this._pairs.push([e,t])},ne.toString=function(e){const t=e?function(t){return e.call(this,t,ee)}:ee;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class ie{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){V.forEach(this.handlers,function(t){null!==t&&e(t)})}}const se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:te,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ce="undefined"!=typeof window&&"undefined"!=typeof document,ue="object"==typeof navigator&&navigator||void 0,le=ce&&(!ue||["ReactNative","NativeScript","NS"].indexOf(ue.product)<0),de="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,fe=ce&&window.location.href||"http://localhost",pe={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ce,hasStandardBrowserEnv:le,hasStandardBrowserWebWorkerEnv:de,navigator:ue,origin:fe},Symbol.toStringTag,{value:"Module"})),...ae};function he(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const s=Number.isFinite(+i),a=o>=e.length;if(i=!i&&V.isArray(r)?r.length:i,a)return V.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!s;r[i]&&V.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&V.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r<o;r++)i=n[r],t[i]=e[i];return t}(r[i])),!s}if(V.isFormData(e)&&V.isFunction(e.entries)){const n={};return V.forEachEntry(e,(e,r)=>{t(function(e){return V.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const me={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=V.isObject(e);o&&V.isHTMLForm(e)&&(e=new FormData(e));if(V.isFormData(e))return r?JSON.stringify(he(e)):e;if(V.isArrayBuffer(e)||V.isBuffer(e)||V.isStream(e)||V.isFile(e)||V.isBlob(e)||V.isReadableStream(e))return e;if(V.isArrayBufferView(e))return e.buffer;if(V.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new pe.classes.URLSearchParams,{visitor:function(e,t,n,r){return pe.isNode&&V.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=V.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(V.isString(e))try{return(t||JSON.parse)(e),V.trim(e)}catch(r){if("SyntaxError"!==r.name)throw r}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||me.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(V.isResponse(e)||V.isReadableStream(e))return e;if(e&&V.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(n){if("SyntaxError"===o.name)throw W.from(o,W.ERR_BAD_RESPONSE,this,null,this.response);throw o}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};V.forEach(["delete","get","head","post","put","patch"],e=>{me.headers[e]={}});const ge=V.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"]),ve=Symbol("internals");function ye(e){return e&&String(e).trim().toLowerCase()}function be(e){return!1===e||null==e?e:V.isArray(e)?e.map(be):String(e)}function we(e,t,n,r,o){return V.isFunction(r)?r.call(this,t,n):(o&&(t=n),V.isString(t)?V.isString(r)?-1!==t.indexOf(r):V.isRegExp(r)?r.test(t):void 0:void 0)}let _e=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ye(t);if(!o)throw new Error("header name must be a non-empty string");const i=V.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=be(e))}const i=(e,t)=>V.forEach(e,(e,n)=>o(e,n,t));if(V.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(V.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ge[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(V.isObject(e)&&V.isIterable(e)){let n,r,o={};for(const t of e){if(!V.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?V.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ye(e)){const n=V.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(V.isFunction(t))return t.call(this,e,n);if(V.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=V.findKey(this,e);return!(!n||void 0===this[n]||t&&!we(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ye(e)){const o=V.findKey(n,e);!o||t&&!we(0,n[o],o,t)||(delete n[o],r=!0)}}return V.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!we(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return V.forEach(this,(r,o)=>{const i=V.findKey(n,o);if(i)return t[i]=be(r),void delete t[o];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();s!==o&&delete t[o],t[s]=be(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return V.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&V.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ve]=this[ve]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=V.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return V.isArray(e)?e.forEach(r):r(e),this}};function Ee(e,t){const n=this||me,r=t||n,o=_e.from(r.headers);let i=r.data;return V.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ze(e){return!(!e||!e.__CANCEL__)}function ke(e,t,n){W.call(this,null==e?"canceled":e,W.ERR_CANCELED,t,n),this.name="CanceledError"}function Oe(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new W("Request failed with status code "+n.status,[W.ERR_BAD_REQUEST,W.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}_e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),V.reduceDescriptors(_e.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),V.freezeMethods(_e),V.inherits(ke,W,{__CANCEL__:!0});const xe=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[s];o||(o=c),n[i]=a,r[i]=c;let l=s,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(1e3*d/f):void 0}}(50,250);return function(e,t){let n,r,o=0,i=1e3/t;const s=(t,i=Date.now())=>{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=i?s(e,t):(n=e,r||(r=setTimeout(()=>{r=null,s(n)},i-a)))},()=>n&&s(n)]}(n=>{const i=n.loaded,s=n.lengthComputable?n.total:void 0,a=i-r,c=o(a);r=i;e({loaded:i,total:s,progress:s?i/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&i<=s?(s-i)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})},n)},Se=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Te=e=>(...t)=>V.asap(()=>e(...t)),Ae=pe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,Re=pe.hasStandardBrowserEnv?{write(e,t,n,r,o,i){const s=[e+"="+encodeURIComponent(t)];V.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),V.isString(r)&&s.push("path="+r),V.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ne(e,t,n){let r=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Pe=e=>e instanceof _e?{...e}:e;function je(e,t){t=t||{};const n={};function r(e,t,n,r){return V.isPlainObject(e)&&V.isPlainObject(t)?V.merge.call({caseless:r},e,t):V.isPlainObject(t)?V.merge({},t):V.isArray(t)?t.slice():t}function o(e,t,n,o){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!V.isUndefined(t))return r(void 0,t)}function s(e,t){return V.isUndefined(t)?V.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>o(Pe(e),Pe(t),0,!0)};return V.forEach(Object.keys({...e,...t}),function(r){const i=c[r]||o,s=i(e[r],t[r],r);V.isUndefined(s)&&i!==a||(n[r]=s)}),n}const $e=e=>{const t=je({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:s,auth:a}=t;if(t.headers=s=_e.from(s),t.url=oe(Ne(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),V.isFormData(n))if(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(V.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&s.set(e,n)})}if(pe.hasStandardBrowserEnv&&(r&&V.isFunction(r)&&(r=r(t)),r||!1!==r&&Ae(t.url))){const e=o&&i&&Re.read(i);e&&s.set(o,e)}return t},Ce="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=$e(e);let o=r.data;const i=_e.from(r.headers).normalize();let s,a,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:p}=r;function h(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(s),r.signal&&r.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=_e.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Oe(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new W("Request aborted",W.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new W(t&&t.message?t.message:"Network Error",W.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new W(t,o.clarifyTimeoutError?W.ETIMEDOUT:W.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&V.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),V.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=xe(p,!0),m.addEventListener("progress",c)),f&&m.upload&&([a,u]=xe(f),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(s=t=>{m&&(n(!t||t.type?new ke(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(s),r.signal&&(r.signal.aborted?s():r.signal.addEventListener("abort",s)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===pe.protocols.indexOf(v)?n(new W("Unsupported protocol "+v+":",W.ERR_BAD_REQUEST,e)):m.send(o||null)})},Ie=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof W?t:new ke(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new W(`timeout ${t} of ms exceeded`,W.ETIMEDOUT))},t);const s=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>V.asap(s),a}},Ze=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},Fe=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Ue=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of Fe(e))yield*Ze(n,t)}(e,t);let i,s=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=s+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(t){throw a(t),t}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:De}=V,Le=(({Request:e,Response:t})=>({Request:e,Response:t}))(V.global),{ReadableStream:Be,TextEncoder:Me}=V.global,qe=(e,...t)=>{try{return!!e(...t)}catch(n){return!1}},Ve=e=>{e=V.merge.call({skipUndefined:!0},Le,e);const{fetch:t,Request:n,Response:r}=e,o=t?De(t):"function"==typeof fetch,i=De(n),s=De(r);if(!o)return!1;const a=o&&De(Be),c=o&&("function"==typeof Me?(e=>t=>e.encode(t))(new Me):async e=>new Uint8Array(await new n(e).arrayBuffer())),u=i&&a&&qe(()=>{let e=!1;const t=new n(pe.origin,{body:new Be,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),l=s&&a&&qe(()=>V.isReadableStream(new r("").body)),d={stream:l&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new W(`Response type '${e}' is not supported`,W.ERR_NOT_SUPPORT,n)})});const f=async(e,t)=>{const r=V.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(V.isBlob(e))return e.size;if(V.isSpecCompliantForm(e)){const t=new n(pe.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return V.isArrayBufferView(e)||V.isArrayBuffer(e)?e.byteLength:(V.isURLSearchParams(e)&&(e+=""),V.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:s,data:a,signal:c,cancelToken:p,timeout:h,onDownloadProgress:m,onUploadProgress:g,responseType:v,headers:y,withCredentials:b="same-origin",fetchOptions:w}=$e(e),_=t||fetch;v=v?(v+"").toLowerCase():"text";let E=Ie([c,p&&p.toAbortSignal()],h),z=null;const k=E&&E.unsubscribe&&(()=>{E.unsubscribe()});let O;try{if(g&&u&&"get"!==s&&"head"!==s&&0!==(O=await f(y,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if(V.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,n]=Se(O,xe(Te(g)));a=Ue(t.body,65536,e,n)}}V.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...w,signal:E,method:s.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?b:void 0};z=i&&new n(o,c);let p=await(i?_(z,w):_(o,c));const h=l&&("stream"===v||"response"===v);if(l&&(m||h&&k)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=p[t]});const t=V.toFiniteNumber(p.headers.get("content-length")),[n,o]=m&&Se(t,xe(Te(m),!0))||[];p=new r(Ue(p.body,65536,n,()=>{o&&o(),k&&k()}),e)}v=v||"text";let x=await d[V.findKey(d,v)||"text"](p,e);return!h&&k&&k(),await new Promise((t,n)=>{Oe(t,n,{data:x,headers:_e.from(p.headers),status:p.status,statusText:p.statusText,config:e,request:z})})}catch(x){if(k&&k(),x&&"TypeError"===x.name&&/Load failed|fetch/i.test(x.message))throw Object.assign(new W("Network Error",W.ERR_NETWORK,e,z),{cause:x.cause||x});throw W.from(x,x&&x.code,e,z)}}},We=new Map,Je=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let s,a,c=i.length,u=We;for(;c--;)s=i[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:Ve(t)),u=a;return a};Je();const He={http:null,xhr:Ce,fetch:{get:Je}};V.forEach(He,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(n){}Object.defineProperty(e,"adapterName",{value:t})}});const Ke=e=>`- ${e}`,Ge=e=>V.isFunction(e)||null===e||!1===e,Xe=(e,t)=>{e=V.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let s=0;s<n;s++){let n;if(r=e[s],o=r,!Ge(r)&&(o=He[(n=String(r)).toLowerCase()],void 0===o))throw new W(`Unknown adapter '${n}'`);if(o&&(V.isFunction(o)||(o=o.get(t))))break;i[n||"#"+s]=o}if(!o){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new W("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Ke).join("\n"):" "+Ke(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function Ye(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ke(null,e)}function Qe(e){Ye(e),e.headers=_e.from(e.headers),e.data=Ee.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Xe(e.adapter||me.adapter,e)(e).then(function(t){return Ye(e),t.data=Ee.call(e,e.transformResponse,t),t.headers=_e.from(t.headers),t},function(t){return ze(t)||(Ye(e),t&&t.response&&(t.response.data=Ee.call(e,e.transformResponse,t.response),t.response.headers=_e.from(t.response.headers))),Promise.reject(t)})}const et="1.12.2",tt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nt={};tt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+et+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new W(r(o," has been removed"+(t?" in "+t:"")),W.ERR_DEPRECATED);return t&&!nt[o]&&(nt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},tt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const rt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new W("options must be an object",W.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],s=t[i];if(s){const t=e[i],n=void 0===t||s(t,i,e);if(!0!==n)throw new W("option "+i+" must be "+n,W.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new W("Unknown option "+i,W.ERR_BAD_OPTION)}},validators:tt},ot=rt.validators;let it=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ie,response:new ie}}async request(e,t){try{return await this._request(e,t)}catch(n){if(n instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const t=e.stack?e.stack.replace(/^.+\n/,""):"";try{n.stack?t&&!String(n.stack).endsWith(t.replace(/^.+\n.+\n/,""))&&(n.stack+="\n"+t):n.stack=t}catch(r){}}throw n}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=je(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&rt.assertOptions(n,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean)},!1),null!=r&&(V.isFunction(r)?t.paramsSerializer={serialize:r}:rt.assertOptions(r,{encode:ot.function,serialize:ot.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rt.assertOptions(t,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&V.merge(o.common,o[t.method]);o&&V.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=_e.concat(i,o);const s=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!a){const e=[Qe.bind(this),void 0];for(e.unshift(...s),e.push(...c),l=e.length,u=Promise.resolve(t);d<l;)u=u.then(e[d++],e[d++]);return u}l=s.length;let f=t;for(;d<l;){const e=s[d++],t=s[d++];try{f=e(f)}catch(p){t.call(this,p);break}}try{u=Qe.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,l=c.length;d<l;)u=u.then(c[d++],c[d++]);return u}getUri(e){return oe(Ne((e=je(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};V.forEach(["delete","get","head","options"],function(e){it.prototype[e]=function(t,n){return this.request(je(n||{},{method:e,url:t,data:(n||{}).data}))}}),V.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(je(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}it.prototype[e]=t(),it.prototype[e+"Form"]=t(!0)});const st={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(st).forEach(([e,t])=>{st[t]=e});const at=function e(t){const n=new it(t),o=r(it.prototype.request,n);return V.extend(o,it.prototype,n,{allOwnKeys:!0}),V.extend(o,n,null,{allOwnKeys:!0}),o.create=function(n){return e(je(t,n))},o}(me);at.Axios=it,at.CanceledError=ke,at.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ke(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},at.isCancel=ze,at.VERSION=et,at.toFormData=Q,at.AxiosError=W,at.Cancel=at.CanceledError,at.all=function(e){return Promise.all(e)},at.spread=function(e){return function(t){return e.apply(null,t)}},at.isAxiosError=function(e){return V.isObject(e)&&!0===e.isAxiosError},at.mergeConfig=je,at.AxiosHeaders=_e,at.formToJSON=e=>he(V.isHTMLForm(e)?new FormData(e):e),at.getAdapter=Xe,at.HttpStatusCode=st,at.default=at;const{Axios:ct,AxiosError:ut,CanceledError:lt,isCancel:dt,CancelToken:ft,VERSION:pt,all:ht,Cancel:mt,isAxiosError:gt,spread:vt,toFormData:yt,AxiosHeaders:bt,HttpStatusCode:wt,formToJSON:_t,getAdapter:Et,mergeConfig:zt}=at;function kt(e){const t="sandbox"===e?"https://sandbox.api.marlim.co":"https://api.marlim.co";if(!t)throw new Error("Base URL is not defined");return at.create({baseURL:t,timeout:1e4,headers:{"Content-Type":"application/json"}})}kt("sandbox"),kt("production");class Ot{constructor(e){n(this,"env"),n(this,"apiVersion"),n(this,"api"),n(this,"bearerToken"),this.apiVersion="v3",this.env=e.env,this.bearerToken=e.token,this.api=kt(this.env),this.api.interceptors.request.use(e=>(this.bearerToken&&(e.headers.Authorization=`Bearer ${this.bearerToken}`),e))}async createSetup(e){try{return(await this.api.post(`/${this.apiVersion}/3ds/setup`,e)).data}catch(t){throw this.handleError(t)}}async authenticate(e){try{return(await this.api.post(`/${this.apiVersion}/3ds/authenticate`,e)).data}catch(t){throw this.handleError(t)}}handleError(e){var t,n;return at.isAxiosError(e)?new Error((null==(n=null==(t=e.response)?void 0:t.data)?void 0:n.message)||"Request error."):e}}const xt={"01":{width:400,height:250},"02":{width:400,height:390},"03":{width:600,height:500},"04":{width:400,height:600},"05":{width:window.screen.width,height:window.screen.height}},St="step-up-iframe",Tt="step-up-form",At="challenge-modal-overlay";function Rt(e,t,n=null,r=null){e&&e.parentNode&&e.parentNode.removeChild(e),t&&t.parentNode&&t.parentNode.removeChild(t),n&&n.parentNode&&n.parentNode.removeChild(n),r&&r.parentNode&&r.parentNode.removeChild(r),document.body.classList.remove("challenge-modal-open")}function Nt(){const e=e=>{"Escape"===e.key&&function(){const e=document.getElementById(At);e&&(e.classList.remove("show"),document.body.classList.remove("challenge-modal-open"),setTimeout(()=>{Rt(document.getElementsByName(St)[0],document.getElementById(Tt),e,null)},300))}()};document.addEventListener("keydown",e),window.challengeModalKeyHandler=e}async function Pt(e){return new Promise((t,n)=>{let r=null,o=null,i=null,s=null,a=null;try{!function(){if(document.getElementById("challenge-modal-css"))return;const e=document.createElement("style");e.id="challenge-modal-css",e.innerHTML="\n .challenge-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.6);\n z-index: 9998;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n visibility: hidden;\n }\n\n .challenge-modal-overlay.show {\n opacity: 1;\n visibility: visible;\n }\n\n .challenge-modal-wrapper {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .challenge-modal-container {\n position: relative;\n border-radius: 8px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);\n background: white;\n max-width: 90vw;\n max-height: 90vh;\n overflow: hidden;\n }\n\n .challenge-modal-iframe {\n border: none;\n border-radius: 8px;\n display: block;\n background: white;\n }\n\n .challenge-modal-close {\n position: absolute;\n top: -15px;\n right: -15px;\n width: 30px;\n height: 30px;\n border-radius: 50%;\n background: #333;\n color: white;\n border: 2px solid white;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n font-weight: bold;\n z-index: 10000;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n line-height: 1;\n }\n\n @media (max-width: 768px) {\n .challenge-modal-container {\n margin: 20px;\n max-width: calc(100vw - 40px);\n max-height: calc(100vh - 40px);\n }\n\n .challenge-modal-iframe {\n width: 100% !important;\n min-height: 300px;\n }\n }\n\n body.challenge-modal-open {\n overflow: hidden;\n }\n ",document.head.appendChild(e)}();const n=function(e){const t=xt[e]||xt["01"];return"05"===e?{width:Math.min(.9*window.innerWidth,1200),height:Math.min(.9*window.innerHeight,800)}:t}(e.windowSize);i=function(){const e=document.createElement("div");return e.id=At,e.className="challenge-modal-overlay",document.body.appendChild(e),e}(),s=function(e){const t=document.createElement("div");return t.id="challenge-modal-container",t.className="challenge-modal-container",t.style.width=`${e.width}px`,t.style.height=`${e.height}px`,t}(n),r=function(e){const t=document.createElement("iframe");return t.name=St,t.className="challenge-modal-iframe",t.height=e.height.toString(),t.width=e.width.toString(),t.setAttribute("allowfullscreen","true"),t.setAttribute("frameborder","0"),t}(n),o=function(e){const t=document.createElement("form");t.id=Tt,t.target=St,t.method="POST",t.action=e.url,t.style.display="none";const n=document.createElement("input");return n.type="hidden",n.name="JWT",n.value=e.accessToken,t.appendChild(n),document.body.appendChild(t),t}(e);const c=document.createElement("div");c.className="challenge-modal-wrapper",s.appendChild(r),c.appendChild(s),i.appendChild(c),Nt(),function(){const e=document.getElementById(At);e&&(document.body.classList.add("challenge-modal-open"),setTimeout(()=>{e.classList.add("show")},10))}(),a=function(e,t,n,r,o){return i=>{try{"completed"===i.data.status&&(console.log("Challenge completed"),Rt(e,t,n,r),o())}catch(s){console.error("Erro ao processar message do Session:",s)}}}(r,o,i,s,t),window.addEventListener("message",a,!1),o.submit()}catch(c){console.error("Erro ao processar desafio de autenticação:",c),Rt(r,o,i,s),n(c)}})}const jt="session-iframe",$t={sandbox:["https://centinelapistag.cardinalcommerce.com","https://geostag.cardinalcommerce.com","https://cas.client.cardinaltrusted.com"],production:["https://centinelapi.cardinalcommerce.com","https://geo.cardinalcommerce.com"]};function Ct(e,t){const n=new Set($t[e]),r=function(e){return"sandbox"===e?"https://centinelapistag.cardinalcommerce.com":"https://centinelapi.cardinalcommerce.com"}(e),o=function(e){try{return new URL(e).origin}catch{return null}}(t);return n.add(r),o&&n.add(o),n}function It(e,t,n,r){const o=Ct(e,t);return e=>{try{if(!o.has(e.origin))return;const t=function(e){if("string"==typeof e)try{return JSON.parse(e)}catch{return null}return e&&"object"==typeof e?e:null}(e.data);"profile.completed"===(null==t?void 0:t.MessageType)&&(console.log("Profile completed"),r(),n())}catch(t){console.error("Erro ao processar message do Session:",t)}}}function Zt(e){return new Promise((t,n)=>{const{env:r,accessToken:o,dataCollectionUrl:i}=e;let s=null,a=null,c=null;const u=()=>{c&&(clearTimeout(c),c=null),function(e){e&&window.removeEventListener("message",e)}(a)};try{!function(){const e=document.createElement("iframe");e.name=jt,e.height="1",e.width="1",e.style.display="none",document.body.appendChild(e)}(),s=function(e,t){const n=document.createElement("form");n.id="session-form",n.target=jt,n.method="POST",n.action=e;const r=document.createElement("input");return r.type="hidden",r.name="JWT",r.value=t,n.appendChild(r),document.body.appendChild(n),n}(i,o),a=It(r,i,t,u),window.addEventListener("message",a,!1),c=setTimeout(()=>{u(),console.warn("Device data collection timed out before profile.completed. Continuing 3DS authentication."),t()},1e4),s.submit()}catch(l){u(),n(l)}})}function Ft(){try{return"undefined"!=typeof window&&("undefined"!=typeof document&&("undefined"!=typeof Array&&"undefined"!=typeof Object))}catch{return!1}}function Ut(e,t,n){function r(n,r){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,r);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=r}const o=(null==n?void 0:n.Parent)??Object;class i extends o{}function s(e){var t;const o=(null==n?void 0:n.Parent)?new i:this;r(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>{var r,o;return!!((null==n?void 0:n.Parent)&&t instanceof n.Parent)||(null==(o=null==(r=null==t?void 0:t._zod)?void 0:r.traits)?void 0:o.has(e))}}),Object.defineProperty(s,"name",{value:e}),s}class Dt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Lt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Bt={};function Mt(e){return Bt}function qt(e,t){return"bigint"==typeof t?t.toString():t}function Vt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wt(e){return null==e}function Jt(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Ht=Symbol("evaluating");function Kt(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ht)return void 0===r&&(r=Ht,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Gt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xt(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Yt(e){return JSON.stringify(e)}const Qt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function en(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const tn=Vt(()=>{var e;if("undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.includes("Cloudflare")))return!1;try{return new Function(""),!0}catch(t){return!1}});function nn(e){if(!1===en(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==en(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function rn(e){return nn(e)?{...e}:Array.isArray(e)?[...e]:e}const on=new Set(["string","number","symbol"]);function sn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function an(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!(null==n?void 0:n.parent)||(r._zod.parent=e),r}function cn(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==(null==t?void 0:t.message)){if(void 0!==(null==t?void 0:t.error))throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const un={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ln(e,t=0){var n;if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==(null==(n=e.issues[r])?void 0:n.continue))return!0;return!1}function dn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function fn(e){return"string"==typeof e?e:null==e?void 0:e.message}function pn(e,t,n){var r,o,i,s,a,c;const u={...e,path:e.path??[]};if(!e.message){const l=fn(null==(i=null==(o=null==(r=e.inst)?void 0:r._zod.def)?void 0:o.error)?void 0:i.call(o,e))??fn(null==(s=null==t?void 0:t.error)?void 0:s.call(t,e))??fn(null==(a=n.customError)?void 0:a.call(n,e))??fn(null==(c=n.localeError)?void 0:c.call(n,e))??"Invalid input";u.message=l}return delete u.inst,delete u.continue,(null==t?void 0:t.reportInput)||delete u.input,u}function hn(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function mn(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const gn=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,qt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vn=Ut("$ZodError",gn),yn=Ut("$ZodError",gn,{Parent:Error});const bn=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Dt;if(s.issues.length){const t=new((null==o?void 0:o.Err)??e)(s.issues.map(e=>pn(e,i,Mt())));throw Qt(t,null==o?void 0:o.callee),t}return s.value},wn=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new((null==o?void 0:o.Err)??e)(s.issues.map(e=>pn(e,i,Mt())));throw Qt(t,null==o?void 0:o.callee),t}return s.value},_n=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Dt;return i.issues.length?{success:!1,error:new(e??vn)(i.issues.map(e=>pn(e,o,Mt())))}:{success:!0,data:i.value}},En=_n(yn),zn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>pn(e,o,Mt())))}:{success:!0,data:i.value}},kn=zn(yn),On=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bn(e)(t,n,o)},xn=e=>(t,n,r)=>bn(e)(t,n,r),Sn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return wn(e)(t,n,o)},Tn=e=>async(t,n,r)=>wn(e)(t,n,r),An=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return _n(e)(t,n,o)},Rn=e=>(t,n,r)=>_n(e)(t,n,r),Nn=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return zn(e)(t,n,o)},Pn=e=>async(t,n,r)=>zn(e)(t,n,r),jn=/^[cC][^\s-]{8,}$/,$n=/^[0-9a-z]+$/,Cn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,In=/^[0-9a-vA-V]{20}$/,Zn=/^[A-Za-z0-9]{27}$/,Fn=/^[a-zA-Z0-9_-]{21}$/,Un=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Dn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ln=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Bn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Mn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,qn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Wn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hn=/^[A-Za-z0-9_-]*$/,Kn=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Gn=/^\+(?:[0-9]){6,14}[0-9]$/,Xn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Yn=new RegExp(`^${Xn}$`);function Qn(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const er=/^-?\d+$/,tr=/^-?\d+(?:\.\d+)?/,nr=/^(?:true|false)$/i,rr=/^[^A-Z]*$/,or=/^[^a-z]*$/,ir=Ut("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sr={number:"number",bigint:"bigint",object:"date"},ar=Ut("$ZodCheckLessThan",(e,t)=>{ir.init(e,t);const n=sr[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cr=Ut("$ZodCheckGreaterThan",(e,t)=>{ir.init(e,t);const n=sr[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ur=Ut("$ZodCheckMultipleOf",(e,t)=>{ir.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(o=Number.parseInt(e[1]))}const i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lr=Ut("$ZodCheckNumberFormat",(e,t)=>{var n;ir.init(e,t),t.format=t.format||"float64";const r=null==(n=t.format)?void 0:n.includes("int"),o=r?"int":"number",[i,s]=un[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=i,n.maximum=s,r&&(n.pattern=er)}),e._zod.check=n=>{const a=n.value;if(r){if(!Number.isInteger(a))return void n.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?n.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):n.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}))}a<i&&n.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&n.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),dr=Ut("$ZodCheckMaxLength",(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Wt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const o=hn(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fr=Ut("$ZodCheckMinLength",(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Wt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const o=hn(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pr=Ut("$ZodCheckLengthEquals",(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Wt(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const r=n.value,o=r.length;if(o===t.length)return;const i=hn(r),s=o>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hr=Ut("$ZodCheckStringFormat",(e,t)=>{var n,r;ir.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mr=Ut("$ZodCheckRegex",(e,t)=>{hr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gr=Ut("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rr),hr.init(e,t)}),vr=Ut("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=or),hr.init(e,t)}),yr=Ut("$ZodCheckIncludes",(e,t)=>{ir.init(e,t);const n=sn(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),br=Ut("$ZodCheckStartsWith",(e,t)=>{ir.init(e,t);const n=new RegExp(`^${sn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),wr=Ut("$ZodCheckEndsWith",(e,t)=>{ir.init(e,t);const n=new RegExp(`.*${sn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),_r=Ut("$ZodCheckOverwrite",(e,t)=>{ir.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Er{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const o of r)this.content.push(o)}compile(){return new Function(...null==this?void 0:this.args,[...((null==this?void 0:this.content)??[""]).map(e=>` ${e}`)].join("\n"))}}const zr={major:4,minor:1,patch:12},kr=Ut("$ZodType",(e,t)=>{var n,r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zr;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const i of o)for(const t of i._zod.onattach)t(e);if(0===o.length)(r=e._zod).deferred??(r.deferred=[]),null==(n=e._zod.deferred)||n.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,o=ln(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&!1===(null==n?void 0:n.async))throw new Dt;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s;e.issues.length!==t&&(o||(o=ln(e,t)))});else{if(e.issues.length===t)continue;o||(o=ln(e,t))}}return r?r.then(()=>e):e},n=(n,r,i)=>{if(ln(n))return n.aborted=!0,n;const s=t(r,o,i);if(s instanceof Promise){if(!1===i.async)throw new Dt;return s.then(t=>e._zod.parse(t,i))}return e._zod.parse(s,i)};e._zod.run=(r,i)=>{if(i.skipChecks)return e._zod.parse(r,i);if("backward"===i.direction){const t=e._zod.parse({value:r.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,i)):n(t,r,i)}const s=e._zod.parse(r,i);if(s instanceof Promise){if(!1===i.async)throw new Dt;return s.then(e=>t(e,o,i))}return t(s,o,i)}}e["~standard"]={validate:t=>{var n;try{const r=En(e,t);return r.success?{value:r.data}:{issues:null==(n=r.error)?void 0:n.issues}}catch(r){return kn(e,t).then(e=>{var t;return e.success?{value:e.data}:{issues:null==(t=e.error)?void 0:t.issues}})}},vendor:"zod",version:1}}),Or=Ut("$ZodString",(e,t)=>{var n;kr.init(e,t),e._zod.pattern=[...(null==(n=null==e?void 0:e._zod.bag)?void 0:n.patterns)??[]].pop()??(e=>{const t=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)})(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),xr=Ut("$ZodStringFormat",(e,t)=>{hr.init(e,t),Or.init(e,t)}),Sr=Ut("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Dn),xr.init(e,t)}),Tr=Ut("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ln(e))}else t.pattern??(t.pattern=Ln());xr.init(e,t)}),Ar=Ut("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bn),xr.init(e,t)}),Rr=Ut("$ZodURL",(e,t)=>{xr.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Kn.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Nr=Ut("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),xr.init(e,t)}),Pr=Ut("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fn),xr.init(e,t)}),jr=Ut("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=jn),xr.init(e,t)}),$r=Ut("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$n),xr.init(e,t)}),Cr=Ut("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cn),xr.init(e,t)}),Ir=Ut("$ZodXID",(e,t)=>{t.pattern??(t.pattern=In),xr.init(e,t)}),Zr=Ut("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Zn),xr.init(e,t)}),Fr=Ut("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Qn({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Xn}T(?:${r})$`)}(t)),xr.init(e,t)}),Ur=Ut("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Yn),xr.init(e,t)}),Dr=Ut("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Qn(t)}$`)),xr.init(e,t)}),Lr=Ut("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Un),xr.init(e,t)}),Br=Ut("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Mn),xr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Mr=Ut("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qn),xr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),qr=Ut("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Vn),xr.init(e,t)}),Vr=Ut("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Wn),xr.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Wr(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Jr=Ut("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Jn),xr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{Wr(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const Hr=Ut("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Hn),xr.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{(function(e){if(!Hn.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Wr(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Kr=Ut("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Gn),xr.init(e,t)});const Gr=Ut("$ZodJWT",(e,t)=>{xr.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&"JWT"!==(null==o?void 0:o.typ)||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Xr=Ut("$ZodNumber",(e,t)=>{kr.init(e,t),e._zod.pattern=e._zod.bag.pattern??tr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Yr=Ut("$ZodNumber",(e,t)=>{lr.init(e,t),Xr.init(e,t)}),Qr=Ut("$ZodBoolean",(e,t)=>{kr.init(e,t),e._zod.pattern=nr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),eo=Ut("$ZodAny",(e,t)=>{kr.init(e,t),e._zod.parse=e=>e}),to=Ut("$ZodUnknown",(e,t)=>{kr.init(e,t),e._zod.parse=e=>e}),no=Ut("$ZodNever",(e,t)=>{kr.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function ro(e,t,n){e.issues.length&&t.issues.push(...dn(n,e.issues)),t.value[n]=e.value}const oo=Ut("$ZodArray",(e,t)=>{kr.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?i.push(a.then(t=>ro(t,n,e))):ro(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function io(e,t,n,r){e.issues.length&&t.issues.push(...dn(n,e.issues)),void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function so(e){var t,n,r,o;const i=Object.keys(e.shape);for(const c of i)if(!(null==(o=null==(r=null==(n=null==(t=e.shape)?void 0:t[c])?void 0:n._zod)?void 0:r.traits)?void 0:o.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const s=(a=e.shape,Object.keys(a).filter(e=>"optional"===a[e]._zod.optin&&"optional"===a[e]._zod.optout));var a;return{...e,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(s)}}function ao(e,t,n,r,o,i){const s=[],a=o.keySet,c=o.catchall._zod,u=c.def.type;for(const l of Object.keys(t)){if(a.has(l))continue;if("never"===u){s.push(l);continue}const o=c.run({value:t[l],issues:[]},r);o instanceof Promise?e.push(o.then(e=>io(e,n,l,t))):io(o,n,l,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const co=Ut("$ZodObject",(e,t)=>{kr.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(null==n?void 0:n.get)){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const r=Vt(()=>so(t));Kt(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n});const o=en,i=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=r.value);const a=t.value;if(!o(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],u=s.shape;for(const e of s.keys){const r=u[e]._zod.run({value:a[e],issues:[]},n);r instanceof Promise?c.push(r.then(n=>io(n,t,e,a))):io(r,t,e,a)}return i?ao(c,a,t,n,r.value,e):c.length?Promise.all(c).then(()=>t):t}}),uo=Ut("$ZodObjectJIT",(e,t)=>{co.init(e,t);const n=e._zod.parse,r=Vt(()=>so(t));let o;const i=en,s=!Bt.jitless,a=s&&tn.value,c=t.catchall;let u;e._zod.parse=(l,d)=>{u??(u=r.value);const f=l.value;return i(f)?s&&a&&!1===(null==d?void 0:d.async)&&!0!==d.jitless?(o||(o=(e=>{const t=new Er(["shape","payload","ctx"]),n=r.value,o=e=>{const t=Yt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const r of n.keys)i[r]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const e=i[r],n=Yt(r);t.write(`const ${e} = ${o(r)};`),t.write(`\n if (${e}.issues.length) {\n payload.issues = payload.issues.concat(${e}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}]\n })));\n }\n \n \n if (${e}.value === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n newResult[${n}] = ${e}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),l=o(l,d),c?ao([],f,l,d,u,e):l):n(l,d):(l.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),l)}});function lo(e,t,n,r){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const o=e.filter(e=>!ln(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>pn(e,r,Mt())))}),t)}const fo=Ut("$ZodUnion",(e,t)=>{kr.init(e,t),Kt(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Kt(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Kt(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Kt(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>Jt(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>lo(t,o,e,i)):lo(a,o,e,i)}}),po=Ut("$ZodIntersection",(e,t)=>{kr.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,o=t.left._zod.run({value:r,issues:[]},n),i=t.right._zod.run({value:r,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([t,n])=>mo(e,t,n)):mo(e,o,i)}});function ho(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(nn(e)&&nn(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),o={...e,...t};for(const i of r){const n=ho(e[i],t[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};o[i]=n.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=ho(e[r],t[r]);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mo(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),ln(e))return e;const r=ho(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const go=Ut("$ZodEnum",(e,t)=>{kr.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>on.has(typeof e)).map(e=>"string"==typeof e?sn(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return r.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),vo=Ut("$ZodTransform",(e,t)=>{kr.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Lt(e.constructor.name);const o=t.transform(n.value,n);if(r.async){return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n))}if(o instanceof Promise)throw new Dt;return n.value=o,n}});function yo(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const bo=Ut("$ZodOptional",(e,t)=>{kr.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Kt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Kt(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Jt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>yo(t,e.value)):yo(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),wo=Ut("$ZodNullable",(e,t)=>{kr.init(e,t),Kt(e._zod,"optin",()=>t.innerType._zod.optin),Kt(e._zod,"optout",()=>t.innerType._zod.optout),Kt(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Jt(e.source)}|null)$`):void 0}),Kt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),_o=Ut("$ZodDefault",(e,t)=>{kr.init(e,t),e._zod.optin="optional",Kt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Eo(e,t)):Eo(r,t)}});function Eo(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const zo=Ut("$ZodPrefault",(e,t)=>{kr.init(e,t),e._zod.optin="optional",Kt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ko=Ut("$ZodNonOptional",(e,t)=>{kr.init(e,t),Kt(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(t=>Oo(t,e)):Oo(o,e)}});function Oo(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const xo=Ut("$ZodCatch",(e,t)=>{kr.init(e,t),Kt(e._zod,"optin",()=>t.innerType._zod.optin),Kt(e._zod,"optout",()=>t.innerType._zod.optout),Kt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>pn(e,n,Mt()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>pn(e,n,Mt()))},input:e.value}),e.issues=[]),e)}}),So=Ut("$ZodPipe",(e,t)=>{kr.init(e,t),Kt(e._zod,"values",()=>t.in._zod.values),Kt(e._zod,"optin",()=>t.in._zod.optin),Kt(e._zod,"optout",()=>t.out._zod.optout),Kt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>To(e,t.in,n)):To(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>To(e,t.out,n)):To(r,t.out,n)}});function To(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ao=Ut("$ZodReadonly",(e,t)=>{kr.init(e,t),Kt(e._zod,"propValues",()=>t.innerType._zod.propValues),Kt(e._zod,"values",()=>t.innerType._zod.values),Kt(e._zod,"optin",()=>t.innerType._zod.optin),Kt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ro):Ro(r)}});function Ro(e){return e.value=Object.freeze(e.value),e}const No=Ut("$ZodCustom",(e,t)=>{ir.init(e,t),kr.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(t=>Po(t,n,r,e));Po(o,n,r,e)}});function Po(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(mn(e))}}class jo{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function $o(){return new jo}const Co=$o();function Io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...cn(t)})}function Zo(e,t){return new ar({check:"less_than",...cn(t),value:e,inclusive:!1})}function Fo(e,t){return new ar({check:"less_than",...cn(t),value:e,inclusive:!0})}function Uo(e,t){return new cr({check:"greater_than",...cn(t),value:e,inclusive:!1})}function Do(e,t){return new cr({check:"greater_than",...cn(t),value:e,inclusive:!0})}function Lo(e,t){return new ur({check:"multiple_of",...cn(t),value:e})}function Bo(e,t){return new dr({check:"max_length",...cn(t),maximum:e})}function Mo(e,t){return new fr({check:"min_length",...cn(t),minimum:e})}function qo(e,t){return new pr({check:"length_equals",...cn(t),length:e})}function Vo(e){return new _r({check:"overwrite",tx:e})}function Wo(e){const t=function(e,t){const n=new ir({check:"custom",...cn(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(mn(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(mn(r))}},e(n.value,n)));return t}const Jo=Ut("ZodISODateTime",(e,t)=>{Fr.init(e,t),yi.init(e,t)});function Ho(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...cn(t)})}(Jo,e)}const Ko=Ut("ZodISODate",(e,t)=>{Ur.init(e,t),yi.init(e,t)});function Go(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...cn(t)})}(Ko,e)}const Xo=Ut("ZodISOTime",(e,t)=>{Dr.init(e,t),yi.init(e,t)});function Yo(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...cn(t)})}(Xo,e)}const Qo=Ut("ZodISODuration",(e,t)=>{Lr.init(e,t),yi.init(e,t)});function ei(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...cn(t)})}(Qo,e)}const ti=Ut("ZodError",(e,t)=>{vn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e}));else if("invalid_key"===o.code)r({issues:o.issues});else if("invalid_element"===o.code)r({issues:o.issues});else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,qt,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,qt,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),ni=bn(ti),ri=wn(ti),oi=_n(ti),ii=zn(ti),si=On(ti),ai=xn(ti),ci=Sn(ti),ui=Tn(ti),li=An(ti),di=Rn(ti),fi=Nn(ti),pi=Pn(ti),hi=Ut("ZodType",(e,t)=>(kr.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Xt(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,n)=>an(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>ni(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>oi(e,t,n),e.parseAsync=async(t,n)=>ri(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ii(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>si(e,t,n),e.decode=(t,n)=>ai(e,t,n),e.encodeAsync=async(t,n)=>ci(e,t,n),e.decodeAsync=async(t,n)=>ui(e,t,n),e.safeEncode=(t,n)=>li(e,t,n),e.safeDecode=(t,n)=>di(e,t,n),e.safeEncodeAsync=async(t,n)=>fi(e,t,n),e.safeDecodeAsync=async(t,n)=>pi(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...cn(n)})}(fs,e,t)}(t,n)),e.superRefine=t=>e.check(Wo(t)),e.overwrite=t=>e.check(Vo(t)),e.optional=()=>ns(e),e.nullable=()=>os(e),e.nullish=()=>ns(os(e)),e.nonoptional=t=>function(e,t){return new as({type:"nonoptional",innerType:e,...cn(t)})}(e,t),e.array=()=>{return function(e,t,n){return new e({type:"array",element:t,...cn(n)})}(Ji,e,t);var t},e.or=t=>{return new Gi({type:"union",options:[e,t],...cn(n)});var n},e.and=t=>new Xi({type:"intersection",left:e,right:t}),e.transform=t=>ls(e,new es({type:"transform",transform:t})),e.default=t=>{return n=t,new is({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():rn(n)}});var n},e.prefault=t=>{return n=t,new ss({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():rn(n)}});var n},e.catch=t=>{return new cs({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>ls(e,t),e.readonly=()=>new ds({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Co.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){var t;return null==(t=Co.get(e))?void 0:t.description},configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Co.get(e);const n=e.clone();return Co.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),mi=Ut("_ZodString",(e,t)=>{Or.init(e,t),hi.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new mr({check:"string_format",format:"regex",...cn(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new yr({check:"string_format",format:"includes",...cn(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new br({check:"string_format",format:"starts_with",...cn(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new wr({check:"string_format",format:"ends_with",...cn(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Mo(...t)),e.max=(...t)=>e.check(Bo(...t)),e.length=(...t)=>e.check(qo(...t)),e.nonempty=(...t)=>e.check(Mo(1,...t)),e.lowercase=t=>e.check(function(e){return new gr({check:"string_format",format:"lowercase",...cn(e)})}(t)),e.uppercase=t=>e.check(function(e){return new vr({check:"string_format",format:"uppercase",...cn(e)})}(t)),e.trim=()=>e.check(Vo(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Vo(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Vo(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Vo(e=>e.toUpperCase()))}),gi=Ut("ZodString",(e,t)=>{Or.init(e,t),mi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...cn(t)})}(bi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...cn(t)})}(Ei,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...cn(t)})}(Zi,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...cn(t)})}(zi,t)),e.guid=t=>e.check(Io(wi,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...cn(t)})}(_i,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...cn(t)})}(_i,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...cn(t)})}(_i,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...cn(t)})}(_i,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...cn(t)})}(ki,t)),e.guid=t=>e.check(Io(wi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...cn(t)})}(Oi,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...cn(t)})}(xi,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...cn(t)})}(Si,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...cn(t)})}($i,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...cn(t)})}(Ci,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...cn(t)})}(Ti,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...cn(t)})}(Ai,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...cn(t)})}(Ri,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...cn(t)})}(Ni,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...cn(t)})}(Pi,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...cn(t)})}(ji,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...cn(t)})}(Ii,t)),e.datetime=t=>e.check(Ho(t)),e.date=t=>e.check(Go(t)),e.time=t=>e.check(Yo(t)),e.duration=t=>e.check(ei(t))});function vi(e){return function(e,t){return new e({type:"string",...cn(t)})}(gi,e)}const yi=Ut("ZodStringFormat",(e,t)=>{xr.init(e,t),mi.init(e,t)}),bi=Ut("ZodEmail",(e,t)=>{Ar.init(e,t),yi.init(e,t)}),wi=Ut("ZodGUID",(e,t)=>{Sr.init(e,t),yi.init(e,t)}),_i=Ut("ZodUUID",(e,t)=>{Tr.init(e,t),yi.init(e,t)}),Ei=Ut("ZodURL",(e,t)=>{Rr.init(e,t),yi.init(e,t)}),zi=Ut("ZodEmoji",(e,t)=>{Nr.init(e,t),yi.init(e,t)}),ki=Ut("ZodNanoID",(e,t)=>{Pr.init(e,t),yi.init(e,t)}),Oi=Ut("ZodCUID",(e,t)=>{jr.init(e,t),yi.init(e,t)}),xi=Ut("ZodCUID2",(e,t)=>{$r.init(e,t),yi.init(e,t)}),Si=Ut("ZodULID",(e,t)=>{Cr.init(e,t),yi.init(e,t)}),Ti=Ut("ZodXID",(e,t)=>{Ir.init(e,t),yi.init(e,t)}),Ai=Ut("ZodKSUID",(e,t)=>{Zr.init(e,t),yi.init(e,t)}),Ri=Ut("ZodIPv4",(e,t)=>{Br.init(e,t),yi.init(e,t)}),Ni=Ut("ZodIPv6",(e,t)=>{Mr.init(e,t),yi.init(e,t)}),Pi=Ut("ZodCIDRv4",(e,t)=>{qr.init(e,t),yi.init(e,t)}),ji=Ut("ZodCIDRv6",(e,t)=>{Vr.init(e,t),yi.init(e,t)}),$i=Ut("ZodBase64",(e,t)=>{Jr.init(e,t),yi.init(e,t)}),Ci=Ut("ZodBase64URL",(e,t)=>{Hr.init(e,t),yi.init(e,t)}),Ii=Ut("ZodE164",(e,t)=>{Kr.init(e,t),yi.init(e,t)}),Zi=Ut("ZodJWT",(e,t)=>{Gr.init(e,t),yi.init(e,t)}),Fi=Ut("ZodNumber",(e,t)=>{Xr.init(e,t),hi.init(e,t),e.gt=(t,n)=>e.check(Uo(t,n)),e.gte=(t,n)=>e.check(Do(t,n)),e.min=(t,n)=>e.check(Do(t,n)),e.lt=(t,n)=>e.check(Zo(t,n)),e.lte=(t,n)=>e.check(Fo(t,n)),e.max=(t,n)=>e.check(Fo(t,n)),e.int=t=>e.check(Di(t)),e.safe=t=>e.check(Di(t)),e.positive=t=>e.check(Uo(0,t)),e.nonnegative=t=>e.check(Do(0,t)),e.negative=t=>e.check(Zo(0,t)),e.nonpositive=t=>e.check(Fo(0,t)),e.multipleOf=(t,n)=>e.check(Lo(t,n)),e.step=(t,n)=>e.check(Lo(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});const Ui=Ut("ZodNumberFormat",(e,t)=>{Yr.init(e,t),Fi.init(e,t)});function Di(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...cn(t)})}(Ui,e)}const Li=Ut("ZodBoolean",(e,t)=>{Qr.init(e,t),hi.init(e,t)});const Bi=Ut("ZodAny",(e,t)=>{eo.init(e,t),hi.init(e,t)});const Mi=Ut("ZodUnknown",(e,t)=>{to.init(e,t),hi.init(e,t)});function qi(){return new Mi({type:"unknown"})}const Vi=Ut("ZodNever",(e,t)=>{no.init(e,t),hi.init(e,t)});function Wi(e){return function(e,t){return new e({type:"never",...cn(t)})}(Vi,e)}const Ji=Ut("ZodArray",(e,t)=>{oo.init(e,t),hi.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Mo(t,n)),e.nonempty=t=>e.check(Mo(1,t)),e.max=(t,n)=>e.check(Bo(t,n)),e.length=(t,n)=>e.check(qo(t,n)),e.unwrap=()=>e.element});const Hi=Ut("ZodObject",(e,t)=>{uo.init(e,t),hi.init(e,t),Kt(e,"shape",()=>t.shape),e.keyof=()=>Qi(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:qi()}),e.loose=()=>e.clone({...e._zod.def,catchall:qi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Wi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!nn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const r=Xt(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Gt(this,"shape",n),n},checks:[]});return an(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Gt(this,"shape",n),n},checks:e._zod.def.checks};return an(e,n)}(e,t),e.merge=t=>function(e,t){const n=Xt(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Gt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return an(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return an(e,Xt(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Gt(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Gt(this,"shape",r),r},checks:[]});return an(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const r=Xt(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)o[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Gt(this,"shape",o),o},checks:[]});return an(t,r)}(ts,e,t[0]),e.required=(...t)=>function(e,t,n){const r=Xt(t._zod.def,{get shape(){const r=t._zod.def.shape,o={...r};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)o[t]=new e({type:"nonoptional",innerType:r[t]});return Gt(this,"shape",o),o},checks:[]});return an(t,r)}(as,e,t[0])});function Ki(e,t){const n={type:"object",shape:e??{},...cn(t)};return new Hi(n)}const Gi=Ut("ZodUnion",(e,t)=>{fo.init(e,t),hi.init(e,t),e.options=t.options});const Xi=Ut("ZodIntersection",(e,t)=>{po.init(e,t),hi.init(e,t)});const Yi=Ut("ZodEnum",(e,t)=>{go.init(e,t),hi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new Yi({...t,checks:[],...cn(r),entries:o})},e.exclude=(e,r)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new Yi({...t,checks:[],...cn(r),entries:o})}});function Qi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Yi({type:"enum",entries:n,...cn(t)})}const es=Ut("ZodTransform",(e,t)=>{vo.init(e,t),hi.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Lt(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(mn(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(mn(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n)):(n.value=o,n)}});const ts=Ut("ZodOptional",(e,t)=>{bo.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ns(e){return new ts({type:"optional",innerType:e})}const rs=Ut("ZodNullable",(e,t)=>{wo.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function os(e){return new rs({type:"nullable",innerType:e})}const is=Ut("ZodDefault",(e,t)=>{_o.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const ss=Ut("ZodPrefault",(e,t)=>{zo.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType});const as=Ut("ZodNonOptional",(e,t)=>{ko.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType});const cs=Ut("ZodCatch",(e,t)=>{xo.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const us=Ut("ZodPipe",(e,t)=>{So.init(e,t),hi.init(e,t),e.in=t.in,e.out=t.out});function ls(e,t){return new us({type:"pipe",in:e,out:t})}const ds=Ut("ZodReadonly",(e,t)=>{Ao.init(e,t),hi.init(e,t),e.unwrap=()=>e._zod.def.innerType});const fs=Ut("ZodCustom",(e,t)=>{No.init(e,t),hi.init(e,t)});const ps=Ki({token:vi({message:"token is required"}),env:Qi(["sandbox","production"],{message:"env is required and only sandbox or production are supported"})});const hs={amount:(ms={error:"Amount is required"},function(e,t){return new e({type:"number",checks:[],...cn(t)})}(Fi,ms)),softDescriptorChallenge:vi().trim().min(1,{message:"Soft descriptor challenge must not be empty"}).max(30,{message:"Soft descriptor challenge must be at most 30 characters long"}).regex(/^[A-Za-z0-9 ]+$/,{message:"Soft descriptor challenge must not contain special characters"}).optional(),card_hash:vi().optional(),card:Ki({number:vi({error:"Card number is required"}),expirationDate:vi().refine(function(e){if(!/^(0[1-9]|1[0-2])\d{2}$/.test(e))return!1;const t=parseInt(e.substring(0,2),10),n=2e3+parseInt(e.substring(2),10),r=new Date,o=r.getFullYear(),i=r.getMonth()+1;return!(n<o)&&!(n===o&&t<i)},{error:"Invalid expiration date"}),cvv:vi({error:"CVV is required"}).regex(/^\d{3,4}$/,{message:"CVV must be 3 or 4 digits"}),holderName:vi({error:"Holder name is required"})}).optional(),customer:Ki({name:vi({error:"Name is required"}),documentNumber:vi({error:"Document number is required"}).regex(/^\d+$/,{message:"Document number must not contain special characters"}),email:vi({error:"Invalid email"}),phone:Ki({number:vi({error:"Phone number is required"}),areaCode:vi({error:"Area code is required"}),countryCode:vi({error:"Country code is required"})}),address:Ki({country:vi({error:"Country is required"}),state:vi({error:"State is required"}),city:vi({error:"City is required"}),neighborhood:vi({error:"Neighborhood is required"}),number:vi({error:"Number is required"}),street:vi({error:"Street is required"}),zipcode:vi({error:"Zipcode is required"}),complement:vi().optional()})})};var ms;const gs=Ki({...hs,challenge:function(e){return function(e,t){return new e({type:"boolean",...cn(t)})}(Li,e)}().default(!1)}).refine(e=>e.card_hash||e.card,{error:"At least one of card_hash, or card must be provided"}).refine(e=>1===[e.card_hash,e.card].filter(Boolean).length,{error:"Only one of card_hash, or card can be provided"}),vs=Ki({...hs,challenge:new Bi({type:"any"}).refine(e=>void 0===e,{error:"The field 'challenge' is only allowed in test environments."})}).refine(e=>e.card_hash||e.card,{error:"At least one of card_id, card_hash, or card must be provided"}).refine(e=>1===[e.card_hash,e.card].filter(Boolean).length,{error:"Only one of card_id, card_hash, or card can be provided"});let ys=null;function bs(e){if("undefined"==typeof window||"undefined"==typeof document)throw new Error("Marlim3dsSdk can only be called in a browser environment.");const t=ps.safeParse(e);if(!t.success)throw new Error(t.error.message);ys=t.data}async function ws(e){if(!ys)throw new Error("Marlim SDK not initialized");const t=("sandbox"===ys.env?gs:vs).safeParse(e);if(!t.success)throw new Error(t.error.message);const n={token:ys.token,env:ys.env},r=t.data.card,o=t.data.customer,i=t.data.card_hash,s=await async function(e,t){try{const n=new Ot(e),r=await n.createSetup(t),{access_token:o,data_collection_url:i,session_id:s,card_id:a}=r;if(!o||!i)throw new Error("Invalid API response: access_token or data_collection_url are missing.");return await Zt({accessToken:o,dataCollectionUrl:i,env:e.env}),{sessionId:s,cardId:a}}catch(n){let e="Error creating 3DS session";throw n instanceof Error&&(e=n.message),new Error(e)}}(n,{card_hash:i,card_cvv:null==r?void 0:r.cvv,card_expiration_date:null==r?void 0:r.expirationDate,card_holder_name:null==r?void 0:r.holderName,card_number:null==r?void 0:r.number}),a={challenge:t.data.challenge,amount:t.data.amount,soft_descriptor_challenge:t.data.softDescriptorChallenge,card_id:s.cardId,session_id:s.sessionId,customer:{name:o.name,document_number:o.documentNumber,email:o.email,phone:{number:o.phone.number,area_code:o.phone.areaCode,country_code:o.phone.countryCode},address:{country:o.address.country,state:o.address.state,city:o.address.city,neighborhood:o.address.neighborhood,number:o.address.number,street:o.address.street,zipcode:o.address.zipcode,complement:o.address.complement}},device:{channel:"BROWSER",color_depth:window.screen.colorDepth,screen_height:window.screen.height,screen_width:window.screen.width,time_zone_offset:(new Date).getTimezoneOffset().toString(),java_enabled:!!window.WebGLRenderingContext,javascript_enabled:Ft()}},c=await function(e,t){return new Promise(async(n,r)=>{try{const r=new Ot(e),o=await r.authenticate(t);if(o.challenge)return await Pt({url:o.challenge.url,accessToken:o.challenge.access_token,windowSize:o.challenge.window_size}),n({threedsAuthenticationId:o.authentication_id});n({threedsAuthenticationId:o.authentication_id})}catch(o){let e="Error 3DS authentication";o instanceof Error&&(e=o.message),r(e)}})}(n,a);return{card_id:s.cardId,threeds_authentication_id:c.threedsAuthenticationId}}const _s={init:bs,authenticate:ws};return e.authenticate=ws,e.default=_s,e.init=bs,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});
@@ -2615,7 +2615,7 @@ function loadModalCSS() {
2615
2615
  max-width: calc(100vw - 40px);
2616
2616
  max-height: calc(100vh - 40px);
2617
2617
  }
2618
-
2618
+
2619
2619
  .challenge-modal-iframe {
2620
2620
  width: 100% !important;
2621
2621
  min-height: 300px;
@@ -2669,9 +2669,7 @@ function createChallengeForm(config2) {
2669
2669
  return form;
2670
2670
  }
2671
2671
  function showChallengeModal() {
2672
- const overlay = document.getElementById(
2673
- CHALLENGE_MODAL_OVERLAY_ID
2674
- );
2672
+ const overlay = document.getElementById(CHALLENGE_MODAL_OVERLAY_ID);
2675
2673
  if (overlay) {
2676
2674
  document.body.classList.add("challenge-modal-open");
2677
2675
  setTimeout(() => {
@@ -2680,19 +2678,13 @@ function showChallengeModal() {
2680
2678
  }
2681
2679
  }
2682
2680
  function closeChallengeModal() {
2683
- const overlay = document.getElementById(
2684
- CHALLENGE_MODAL_OVERLAY_ID
2685
- );
2681
+ const overlay = document.getElementById(CHALLENGE_MODAL_OVERLAY_ID);
2686
2682
  if (overlay) {
2687
2683
  overlay.classList.remove("show");
2688
2684
  document.body.classList.remove("challenge-modal-open");
2689
2685
  setTimeout(() => {
2690
- const iframe = document.getElementsByName(
2691
- CHALLENGE_IFRAME_NAME
2692
- )[0];
2693
- const form = document.getElementById(
2694
- CHALLENGE_FORM_ID
2695
- );
2686
+ const iframe = document.getElementsByName(CHALLENGE_IFRAME_NAME)[0];
2687
+ const form = document.getElementById(CHALLENGE_FORM_ID);
2696
2688
  cleanupChallengeElements(iframe, form, overlay, null);
2697
2689
  }, 300);
2698
2690
  }
@@ -2737,12 +2729,7 @@ function setupChallengeMessageListener(iframeElement, formElement, overlayElemen
2737
2729
  const eventData = event.data;
2738
2730
  if (eventData.status === "completed") {
2739
2731
  console.log("Challenge completed");
2740
- cleanupChallengeElements(
2741
- iframeElement,
2742
- formElement,
2743
- overlayElement,
2744
- containerElement
2745
- );
2732
+ cleanupChallengeElements(iframeElement, formElement, overlayElement, containerElement);
2746
2733
  resolve();
2747
2734
  }
2748
2735
  } catch (error) {
@@ -2782,18 +2769,22 @@ async function processChallengeWithIframe(config2) {
2782
2769
  formElement.submit();
2783
2770
  } catch (error) {
2784
2771
  console.error("Erro ao processar desafio de autenticação:", error);
2785
- cleanupChallengeElements(
2786
- iframeElement,
2787
- formElement,
2788
- overlayElement,
2789
- containerElement
2790
- );
2772
+ cleanupChallengeElements(iframeElement, formElement, overlayElement, containerElement);
2791
2773
  reject(error);
2792
2774
  }
2793
2775
  });
2794
2776
  }
2795
2777
  const SESSION_IFRAME_NAME = "session-iframe";
2796
2778
  const SESSION_FORM_ID = "session-form";
2779
+ const SESSION_TIMEOUT_MS = 1e4;
2780
+ const CARDINAL_DEVICE_DATA_COLLECTION_ORIGINS = {
2781
+ sandbox: [
2782
+ "https://centinelapistag.cardinalcommerce.com",
2783
+ "https://geostag.cardinalcommerce.com",
2784
+ "https://cas.client.cardinaltrusted.com"
2785
+ ],
2786
+ production: ["https://centinelapi.cardinalcommerce.com", "https://geo.cardinalcommerce.com"]
2787
+ };
2797
2788
  function createSessionIframe() {
2798
2789
  const iframe = document.createElement("iframe");
2799
2790
  iframe.name = SESSION_IFRAME_NAME;
@@ -2817,18 +2808,53 @@ function createSessionForm(dataCollectionUrl, accessToken) {
2817
2808
  document.body.appendChild(form);
2818
2809
  return form;
2819
2810
  }
2820
- function setupSessionMessageListener(env, resolve, cleanup) {
2811
+ function getOriginFromUrl(url) {
2812
+ try {
2813
+ return new URL(url).origin;
2814
+ } catch {
2815
+ return null;
2816
+ }
2817
+ }
2818
+ function getConfiguredDeviceDataCollectionOrigin(env) {
2819
+ return env === "sandbox" ? "https://centinelapistag.cardinalcommerce.com" : "https://centinelapi.cardinalcommerce.com";
2820
+ }
2821
+ function getAllowedDeviceDataCollectionOrigins(env, dataCollectionUrl) {
2822
+ const origins = new Set(CARDINAL_DEVICE_DATA_COLLECTION_ORIGINS[env]);
2823
+ const configuredOrigin = getConfiguredDeviceDataCollectionOrigin(env);
2824
+ const dataCollectionOrigin = getOriginFromUrl(dataCollectionUrl);
2825
+ {
2826
+ origins.add(configuredOrigin);
2827
+ }
2828
+ if (dataCollectionOrigin) {
2829
+ origins.add(dataCollectionOrigin);
2830
+ }
2831
+ return origins;
2832
+ }
2833
+ function parseProfilePayload(data) {
2834
+ if (typeof data === "string") {
2835
+ try {
2836
+ return JSON.parse(data);
2837
+ } catch {
2838
+ return null;
2839
+ }
2840
+ }
2841
+ if (data && typeof data === "object") {
2842
+ return data;
2843
+ }
2844
+ return null;
2845
+ }
2846
+ function setupSessionMessageListener(env, dataCollectionUrl, resolve, cleanup) {
2847
+ const allowedOrigins = getAllowedDeviceDataCollectionOrigins(env, dataCollectionUrl);
2821
2848
  return (event) => {
2822
2849
  try {
2823
- const origin2 = event.origin;
2824
- const deviceDataCollectionOriginUrl = env === "sandbox" ? "https://centinelapistag.cardinalcommerce.com" : "https://centinelapi.cardinalcommerce.com";
2825
- if (origin2 === deviceDataCollectionOriginUrl) {
2826
- const eventData = JSON.parse(event.data);
2827
- if (eventData.MessageType === "profile.completed") {
2828
- console.log("Profile completed");
2829
- cleanup();
2830
- resolve();
2831
- }
2850
+ if (!allowedOrigins.has(event.origin)) {
2851
+ return;
2852
+ }
2853
+ const eventData = parseProfilePayload(event.data);
2854
+ if ((eventData == null ? void 0 : eventData.MessageType) === "profile.completed") {
2855
+ console.log("Profile completed");
2856
+ cleanup();
2857
+ resolve();
2832
2858
  }
2833
2859
  } catch (error) {
2834
2860
  console.error("Erro ao processar message do Session:", error);
@@ -2845,14 +2871,26 @@ function processSessionHandler(sessionConfig) {
2845
2871
  const { env, accessToken, dataCollectionUrl } = sessionConfig;
2846
2872
  let formElement = null;
2847
2873
  let messageListener = null;
2874
+ let timeoutId = null;
2848
2875
  const cleanup = () => {
2876
+ if (timeoutId) {
2877
+ clearTimeout(timeoutId);
2878
+ timeoutId = null;
2879
+ }
2849
2880
  cleanupEventListener(messageListener);
2850
2881
  };
2851
2882
  try {
2852
2883
  createSessionIframe();
2853
2884
  formElement = createSessionForm(dataCollectionUrl, accessToken);
2854
- messageListener = setupSessionMessageListener(env, resolve, cleanup);
2885
+ messageListener = setupSessionMessageListener(env, dataCollectionUrl, resolve, cleanup);
2855
2886
  window.addEventListener("message", messageListener, false);
2887
+ timeoutId = setTimeout(() => {
2888
+ cleanup();
2889
+ console.warn(
2890
+ "Device data collection timed out before profile.completed. Continuing 3DS authentication."
2891
+ );
2892
+ resolve();
2893
+ }, SESSION_TIMEOUT_MS);
2856
2894
  formElement.submit();
2857
2895
  } catch (error) {
2858
2896
  cleanup();
@@ -2860,6 +2898,33 @@ function processSessionHandler(sessionConfig) {
2860
2898
  }
2861
2899
  });
2862
2900
  }
2901
+ function authenticate$1(clientConfig, authenticateParams) {
2902
+ return new Promise(async (resolve, reject) => {
2903
+ try {
2904
+ const httpClient = new HttpClient(clientConfig);
2905
+ const response = await httpClient.authenticate(authenticateParams);
2906
+ if (response.challenge) {
2907
+ await processChallengeWithIframe({
2908
+ url: response.challenge.url,
2909
+ accessToken: response.challenge.access_token,
2910
+ windowSize: response.challenge.window_size
2911
+ });
2912
+ return resolve({
2913
+ threedsAuthenticationId: response.authentication_id
2914
+ });
2915
+ }
2916
+ resolve({
2917
+ threedsAuthenticationId: response.authentication_id
2918
+ });
2919
+ } catch (error) {
2920
+ let errorMessage = "Error 3DS authentication";
2921
+ if (error instanceof Error) {
2922
+ errorMessage = error.message;
2923
+ }
2924
+ reject(errorMessage);
2925
+ }
2926
+ });
2927
+ }
2863
2928
  async function createSetup(clientConfig, setupParams) {
2864
2929
  try {
2865
2930
  const apiClient = new HttpClient(clientConfig);
@@ -2871,9 +2936,7 @@ async function createSetup(clientConfig, setupParams) {
2871
2936
  card_id: cardId
2872
2937
  } = apiResponse;
2873
2938
  if (!accessToken || !dataCollectionUrl) {
2874
- throw new Error(
2875
- "Invalid API response: access_token or data_collection_url are missing."
2876
- );
2939
+ throw new Error("Invalid API response: access_token or data_collection_url are missing.");
2877
2940
  }
2878
2941
  await processSessionHandler({
2879
2942
  accessToken,
@@ -2895,15 +2958,6 @@ async function createSetup(clientConfig, setupParams) {
2895
2958
  function getBrowserColorDepth() {
2896
2959
  return window.screen.colorDepth;
2897
2960
  }
2898
- function getBrowserScreenHeight() {
2899
- return window.screen.height;
2900
- }
2901
- function getBrowserScreenWidth() {
2902
- return window.screen.width;
2903
- }
2904
- function getBrowserTimeDifference() {
2905
- return (/* @__PURE__ */ new Date()).getTimezoneOffset().toString();
2906
- }
2907
2961
  function getBrowserCapability() {
2908
2962
  return !!window.WebGLRenderingContext;
2909
2963
  }
@@ -2919,36 +2973,18 @@ function getBrowserJavascriptEnabled() {
2919
2973
  return false;
2920
2974
  }
2921
2975
  return true;
2922
- } catch (error) {
2976
+ } catch {
2923
2977
  return false;
2924
2978
  }
2925
2979
  }
2926
- function authenticate$1(clientConfig, authenticateParams) {
2927
- return new Promise(async (resolve, reject) => {
2928
- try {
2929
- const httpClient = new HttpClient(clientConfig);
2930
- const response = await httpClient.authenticate(authenticateParams);
2931
- if (response.challenge) {
2932
- await processChallengeWithIframe({
2933
- url: response.challenge.url,
2934
- accessToken: response.challenge.access_token,
2935
- windowSize: response.challenge.window_size
2936
- });
2937
- return resolve({
2938
- threedsAuthenticationId: response.authentication_id
2939
- });
2940
- }
2941
- resolve({
2942
- threedsAuthenticationId: response.authentication_id
2943
- });
2944
- } catch (error) {
2945
- let errorMessage = "Error 3DS authentication";
2946
- if (error instanceof Error) {
2947
- errorMessage = error.message;
2948
- }
2949
- reject(errorMessage);
2950
- }
2951
- });
2980
+ function getBrowserScreenHeight() {
2981
+ return window.screen.height;
2982
+ }
2983
+ function getBrowserScreenWidth() {
2984
+ return window.screen.width;
2985
+ }
2986
+ function getBrowserTimeDifference() {
2987
+ return (/* @__PURE__ */ new Date()).getTimezoneOffset().toString();
2952
2988
  }
2953
2989
  function $constructor(name, initializer2, params) {
2954
2990
  function init2(inst, def) {
@@ -6276,6 +6312,13 @@ const baseFields = {
6276
6312
  amount: number({
6277
6313
  error: "Amount is required"
6278
6314
  }),
6315
+ softDescriptorChallenge: string().trim().min(1, {
6316
+ message: "Soft descriptor challenge must not be empty"
6317
+ }).max(30, {
6318
+ message: "Soft descriptor challenge must be at most 30 characters long"
6319
+ }).regex(/^[A-Za-z0-9 ]+$/, {
6320
+ message: "Soft descriptor challenge must not contain special characters"
6321
+ }).optional(),
6279
6322
  card_hash: string().optional(),
6280
6323
  card: object({
6281
6324
  number: string({
@@ -6388,9 +6431,7 @@ function getThreedsAuthenticateSchema(env) {
6388
6431
  let sdkConfig = null;
6389
6432
  function init(params) {
6390
6433
  if (typeof window === "undefined" || typeof document === "undefined") {
6391
- throw new Error(
6392
- "Marlim3dsSdk can only be called in a browser environment."
6393
- );
6434
+ throw new Error("Marlim3dsSdk can only be called in a browser environment.");
6394
6435
  }
6395
6436
  const initResult = setupParamsSchema.safeParse(params);
6396
6437
  if (!initResult.success) {
@@ -6424,6 +6465,7 @@ async function authenticate(params) {
6424
6465
  const authenticateParams = {
6425
6466
  challenge: authenticate3DSResult.data.challenge,
6426
6467
  amount: authenticate3DSResult.data.amount,
6468
+ soft_descriptor_challenge: authenticate3DSResult.data.softDescriptorChallenge,
6427
6469
  card_id: setup.cardId,
6428
6470
  session_id: setup.sessionId,
6429
6471
  customer: {
@@ -6456,10 +6498,7 @@ async function authenticate(params) {
6456
6498
  javascript_enabled: getBrowserJavascriptEnabled()
6457
6499
  }
6458
6500
  };
6459
- const authenticationResult = await authenticate$1(
6460
- clientConfig,
6461
- authenticateParams
6462
- );
6501
+ const authenticationResult = await authenticate$1(clientConfig, authenticateParams);
6463
6502
  return {
6464
6503
  card_id: setup.cardId,
6465
6504
  threeds_authentication_id: authenticationResult.threedsAuthenticationId
@@ -1,4 +1,4 @@
1
- import { HttpClientConfig } from '../types/http-client';
2
1
  import { AuthenticateParams, AuthenticateResult } from '../types/authenticate';
2
+ import { HttpClientConfig } from '../types/http-client';
3
3
 
4
4
  export declare function authenticate(clientConfig: HttpClientConfig, authenticateParams: AuthenticateParams): Promise<AuthenticateResult>;
@@ -32,6 +32,7 @@ interface Device {
32
32
  interface AuthenticateParams {
33
33
  challenge?: boolean;
34
34
  amount: number;
35
+ soft_descriptor_challenge?: string;
35
36
  card_id: string;
36
37
  session_id: string;
37
38
  customer: Customer;
@@ -4,6 +4,7 @@ import { Env } from '../types/env';
4
4
  declare function getThreedsAuthenticateSchema(env: Env): z.ZodObject<{
5
5
  challenge: z.ZodDefault<z.ZodBoolean>;
6
6
  amount: z.ZodNumber;
7
+ softDescriptorChallenge: z.ZodOptional<z.ZodString>;
7
8
  card_hash: z.ZodOptional<z.ZodString>;
8
9
  card: z.ZodOptional<z.ZodObject<{
9
10
  number: z.ZodString;
@@ -34,6 +35,7 @@ declare function getThreedsAuthenticateSchema(env: Env): z.ZodObject<{
34
35
  }, z.core.$strip> | z.ZodObject<{
35
36
  challenge: z.ZodAny;
36
37
  amount: z.ZodNumber;
38
+ softDescriptorChallenge: z.ZodOptional<z.ZodString>;
37
39
  card_hash: z.ZodOptional<z.ZodString>;
38
40
  card: z.ZodOptional<z.ZodObject<{
39
41
  number: z.ZodString;
@@ -65,6 +67,7 @@ declare function getThreedsAuthenticateSchema(env: Env): z.ZodObject<{
65
67
  type ThreedsAuthenticateParams = {
66
68
  challenge?: boolean;
67
69
  amount: number;
70
+ softDescriptorChallenge?: string;
68
71
  card_hash?: string;
69
72
  card?: {
70
73
  number: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marlim-sdk-3ds",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "SDK 3DS para integração com a API Marlim",
5
5
  "license": "MIT",
6
6
  "main": "dist/marlim-3ds-sdk.min.js",