UNPKG

@malga-checkout/core

Version:
1 lines 72.7 kB
import{c as e,s as t}from"./p-134227c6.js";import{a as r,c as n}from"./p-3e8ff66b.js";import{a as i,s as a}from"./p-c6a7b0e7.js";import{Z as o}from"./p-f44f58ab.js";import{s as u}from"./p-6e54701d.js";const s=e=>e.replace(/\D/g,"").trim(),c=e=>e?e.replace(/[^a-zA-Z0-9]/g,"").trim():e;var l,f=i,d=new Uint8Array(16);function h(){if(!l&&!(l="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(d)}const b=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function p(e){return"string"==typeof e&&b.test(e)}for(var m=[],v=0;v<256;++v)m.push((v+256).toString(16).substr(1));function y(e,t,r){var n=(e=e||{}).random||(e.rng||h)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase();if(!p(r))throw TypeError("Stringified UUID is invalid");return r}(n)}const{state:F}=e({form:{cardNumber:"",cvv:"",installments:"",name:"",expirationDate:"",saveCard:!1},validations:{allFieldsIsBlank:!1,fields:{name:null,cardNumber:null,cvv:null,installments:null,expirationDate:null}}});var g,x;try{g=Map}catch(e){}try{x=Set}catch(e){}function w(e,t,r){if(!e||"object"!=typeof e||"function"==typeof e)return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(S);if(g&&e instanceof g)return new Map(Array.from(e.entries()));if(x&&e instanceof x)return new Set(Array.from(e.values()));if(e instanceof Object){t.push(e);var n=Object.create(e);for(var i in r.push(n),e){var a=t.findIndex((function(t){return t===e[i]}));n[i]=a>-1?r[a]:w(e[i],t,r)}return n}return e}function S(e){return w(e,[],[])}const O=Object.prototype.toString,E=Error.prototype.toString,j=RegExp.prototype.toString,$="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",M=/^Symbol\((.*)\)(.*)$/;function D(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const r=typeof e;if("number"===r)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===r)return t?`"${e}"`:e;if("function"===r)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===r)return $.call(e).replace(M,"Symbol($1)");const n=O.call(e).slice(8,-1);return"Date"===n?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===n||e instanceof Error?"["+E.call(e)+"]":"RegExp"===n?j.call(e):null}function A(e,t){let r=D(e,t);return null!==r?r:JSON.stringify(e,(function(e,r){let n=D(this[e],t);return null!==n?n:r}),2)}let C={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:r,originalValue:n})=>{let i=null!=n&&n!==r,a=`${e} must be a \`${t}\` type, but the final value was: \`${A(r,!0)}\``+(i?` (cast from the value \`${A(n,!0)}\`).`:".");return null===r&&(a+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),a},defined:"${path} must be defined"},k={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},_={noUnknown:"${path} field has unspecified keys: ${unknown}"};Object.assign(Object.create(null),{mixed:C,string:k,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:{min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},object:_,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"},boolean:{isValue:"${path} field must be ${value}"}});var I,P=Object.prototype.hasOwnProperty,R=function(e,t){return null!=e&&P.call(e,t)},T=Array.isArray,B="object"==typeof r&&r&&r.Object===Object&&r,z="object"==typeof self&&self&&self.Object===Object&&self,N=B||z||Function("return this")(),W=N.Symbol,V=Object.prototype,G=V.hasOwnProperty,U=V.toString,K=W?W.toStringTag:void 0,L=Object.prototype.toString,X=W?W.toStringTag:void 0,q=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":X&&X in Object(e)?function(e){var t=G.call(e,K),r=e[K];try{e[K]=void 0;var n=!0}catch(e){}var i=U.call(e);return n&&(t?e[K]=r:delete e[K]),i}(e):function(e){return L.call(e)}(e)},H=function(e){return null!=e&&"object"==typeof e},Z=function(e){return"symbol"==typeof e||H(e)&&"[object Symbol]"==q(e)},J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,Q=function(e,t){if(T(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Z(e))||Y.test(e)||!J.test(e)||null!=t&&e in Object(t)},ee=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},te=function(e){if(!ee(e))return!1;var t=q(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},re=N["__core-js_shared__"],ne=(I=/[^.]+$/.exec(re&&re.keys&&re.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",ie=Function.prototype.toString,ae=function(e){if(null!=e){try{return ie.call(e)}catch(e){}try{return e+""}catch(e){}}return""},oe=/^\[object .+?Constructor\]$/,ue=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=function(e){return!(!ee(e)||(t=e,ne&&ne in t))&&(te(e)?ue:oe).test(ae(e));var t},ce=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return se(r)?r:void 0},le=ce(Object,"create"),fe=Object.prototype.hasOwnProperty,de=Object.prototype.hasOwnProperty;function he(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}he.prototype.clear=function(){this.__data__=le?le(null):{},this.size=0},he.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},he.prototype.get=function(e){var t=this.__data__;if(le){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return fe.call(t,e)?t[e]:void 0},he.prototype.has=function(e){var t=this.__data__;return le?void 0!==t[e]:de.call(t,e)},he.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=le&&void 0===t?"__lodash_hash_undefined__":t,this};var be=he,pe=function(e,t){return e===t||e!=e&&t!=t},me=function(e,t){for(var r=e.length;r--;)if(pe(e[r][0],t))return r;return-1},ve=Array.prototype.splice;function ye(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ye.prototype.clear=function(){this.__data__=[],this.size=0},ye.prototype.delete=function(e){var t=this.__data__,r=me(t,e);return!(r<0||(r==t.length-1?t.pop():ve.call(t,r,1),--this.size,0))},ye.prototype.get=function(e){var t=this.__data__,r=me(t,e);return r<0?void 0:t[r][1]},ye.prototype.has=function(e){return me(this.__data__,e)>-1},ye.prototype.set=function(e,t){var r=this.__data__,n=me(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var Fe=ye,ge=ce(N,"Map"),xe=function(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map};function we(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}we.prototype.clear=function(){this.size=0,this.__data__={hash:new be,map:new(ge||Fe),string:new be}},we.prototype.delete=function(e){var t=xe(this,e).delete(e);return this.size-=t?1:0,t},we.prototype.get=function(e){return xe(this,e).get(e)},we.prototype.has=function(e){return xe(this,e).has(e)},we.prototype.set=function(e,t){var r=xe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var Se=we;function Oe(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Oe.Cache||Se),r}Oe.Cache=Se;var Ee,je,$e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Me=/\\(\\)?/g,De=(Ee=Oe((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($e,(function(e,r,n,i){t.push(n?i.replace(Me,"$1"):r||e)})),t}),(function(e){return 500===je.size&&je.clear(),e})),je=Ee.cache,Ee),Ae=W?W.prototype:void 0,Ce=Ae?Ae.toString:void 0,ke=function e(t){if("string"==typeof t)return t;if(T(t))return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,e)+"";if(Z(t))return Ce?Ce.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},_e=function(e){return null==e?"":ke(e)},Ie=function(e,t){return T(e)?e:Q(e,t)?[e]:De(_e(e))},Pe=function(e){return H(e)&&"[object Arguments]"==q(e)},Re=Object.prototype,Te=Re.hasOwnProperty,Be=Re.propertyIsEnumerable,ze=Pe(function(){return arguments}())?Pe:function(e){return H(e)&&Te.call(e,"callee")&&!Be.call(e,"callee")},Ne=/^(?:0|[1-9]\d*)$/,We=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Ne.test(e))&&e>-1&&e%1==0&&e<t},Ve=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},Ge=function(e){if("string"==typeof e||Z(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},Ue=function(e,t,r){for(var n=-1,i=(t=Ie(t,e)).length,a=!1;++n<i;){var o=Ge(t[n]);if(!(a=null!=e&&r(e,o)))break;e=e[o]}return a||++n!=i?a:!!(i=null==e?0:e.length)&&Ve(i)&&We(o,i)&&(T(e)||ze(e))},Ke=function(e,t){return null!=e&&Ue(e,t,R)};const Le=e=>e&&e.__isYupSchema__;class Xe{constructor(e,t){if(this.refs=e,this.refs=e,"function"==typeof t)return void(this.fn=t);if(!Ke(t,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:n,otherwise:i}=t,a="function"==typeof r?r:(...e)=>e.every((e=>e===r));this.fn=function(...e){let t=e.pop(),r=e.pop(),o=a(...e)?n:i;if(o)return"function"==typeof o?o(r):r.concat(o.resolve(t))}}resolve(e,t){let r=this.refs.map((e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context))),n=this.fn.apply(e,r.concat(e,t));if(void 0===n||n===e)return e;if(!Le(n))throw new TypeError("conditions must return a schema object");return n.resolve(t)}}function qe(e){return null==e?[]:[].concat(e)}function He(){return(He=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}let Ze=/\$\{\s*(\w+)\s*\}/g;class Je extends Error{static formatError(e,t){const r=t.label||t.path||"this";return r!==t.path&&(t=He({},t,{path:r})),"string"==typeof e?e.replace(Ze,((e,r)=>A(t[r]))):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,r,n){super(),this.name="ValidationError",this.value=t,this.path=r,this.type=n,this.errors=[],this.inner=[],qe(e).forEach((e=>{Je.isError(e)?(this.errors.push(...e.errors),this.inner=this.inner.concat(e.inner.length?e.inner:e)):this.errors.push(e)})),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,Je)}}function Ye(e,t){let{endEarly:r,tests:n,args:i,value:a,errors:o,sort:u,path:s}=e,c=(e=>{let t=!1;return(...r)=>{t||(t=!0,e(...r))}})(t),l=n.length;const f=[];if(o=o||[],!l)return o.length?c(new Je(o,a,s)):c(null,a);for(let e=0;e<n.length;e++)(0,n[e])(i,(function(e){if(e){if(!Je.isError(e))return c(e,a);if(r)return e.value=a,c(e,a);f.push(e)}if(--l<=0){if(f.length&&(u&&f.sort(u),o.length&&f.push(...o),o=f),o.length)return void c(new Je(o,a,s),a);c(null,a)}}))}var Qe=function(){try{var e=ce(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),et=function(e,t,r){"__proto__"==t&&Qe?Qe(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},tt=function(e,t,r){for(var n=-1,i=Object(e),a=r(e),o=a.length;o--;){var u=a[++n];if(!1===t(i[u],u,i))break}return e},rt=function(){return!1},nt=n((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r?N.Buffer:void 0;e.exports=(i?i.isBuffer:void 0)||rt})),it={};it["[object Float32Array]"]=it["[object Float64Array]"]=it["[object Int8Array]"]=it["[object Int16Array]"]=it["[object Int32Array]"]=it["[object Uint8Array]"]=it["[object Uint8ClampedArray]"]=it["[object Uint16Array]"]=it["[object Uint32Array]"]=!0,it["[object Arguments]"]=it["[object Array]"]=it["[object ArrayBuffer]"]=it["[object Boolean]"]=it["[object DataView]"]=it["[object Date]"]=it["[object Error]"]=it["[object Function]"]=it["[object Map]"]=it["[object Number]"]=it["[object Object]"]=it["[object RegExp]"]=it["[object Set]"]=it["[object String]"]=it["[object WeakMap]"]=!1;var at,ot=n((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r&&B.process,a=function(){try{return n&&n.require&&n.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=a})),ut=ot&&ot.isTypedArray,st=ut?(at=ut,function(e){return at(e)}):function(e){return H(e)&&Ve(e.length)&&!!it[q(e)]},ct=Object.prototype.hasOwnProperty,lt=function(e,t){var r=T(e),n=!r&&ze(e),i=!r&&!n&&nt(e),a=!r&&!n&&!i&&st(e),o=r||n||i||a,u=o?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],s=u.length;for(var c in e)!t&&!ct.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||a&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||We(c,s))||u.push(c);return u},ft=Object.prototype,dt=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ht=Object.prototype.hasOwnProperty,bt=function(e){if((t=e)!==("function"==typeof(r=t&&t.constructor)&&r.prototype||ft))return dt(e);var t,r,n=[];for(var i in Object(e))ht.call(e,i)&&"constructor"!=i&&n.push(i);return n},pt=function(e){return null!=(t=e)&&Ve(t.length)&&!te(t)?lt(e):bt(e);var t},mt=function(e,t){return e&&tt(e,t,pt)};function vt(e){var t=this.__data__=new Fe(e);this.size=t.size}vt.prototype.clear=function(){this.__data__=new Fe,this.size=0},vt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},vt.prototype.get=function(e){return this.__data__.get(e)},vt.prototype.has=function(e){return this.__data__.has(e)},vt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Fe){var n=r.__data__;if(!ge||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Se(n)}return r.set(e,t),this.size=r.size,this};var yt=vt;function Ft(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Se;++t<r;)this.add(e[t])}Ft.prototype.add=Ft.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ft.prototype.has=function(e){return this.__data__.has(e)};var gt=Ft,xt=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},wt=function(e,t){return e.has(t)},St=function(e,t,r,n,i,a){var o=1&r,u=e.length,s=t.length;if(u!=s&&!(o&&s>u))return!1;var c=a.get(e),l=a.get(t);if(c&&l)return c==t&&l==e;var f=-1,d=!0,h=2&r?new gt:void 0;for(a.set(e,t),a.set(t,e);++f<u;){var b=e[f],p=t[f];if(n)var m=o?n(p,b,f,t,e,a):n(b,p,f,e,t,a);if(void 0!==m){if(m)continue;d=!1;break}if(h){if(!xt(t,(function(e,t){if(!wt(h,t)&&(b===e||i(b,e,r,n,a)))return h.push(t)}))){d=!1;break}}else if(b!==p&&!i(b,p,r,n,a)){d=!1;break}}return a.delete(e),a.delete(t),d},Ot=N.Uint8Array,Et=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r},jt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},$t=W?W.prototype:void 0,Mt=$t?$t.valueOf:void 0,Dt=Object.prototype.propertyIsEnumerable,At=Object.getOwnPropertySymbols,Ct=At?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}(At(e),(function(t){return Dt.call(e,t)})))}:function(){return[]},kt=function(e){return function(e,t,r){var n=t(e);return T(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,pt,Ct)},_t=Object.prototype.hasOwnProperty,It=ce(N,"DataView"),Pt=ce(N,"Promise"),Rt=ce(N,"Set"),Tt=ce(N,"WeakMap"),Bt=ae(It),zt=ae(ge),Nt=ae(Pt),Wt=ae(Rt),Vt=ae(Tt),Gt=q;(It&&"[object DataView]"!=Gt(new It(new ArrayBuffer(1)))||ge&&"[object Map]"!=Gt(new ge)||Pt&&"[object Promise]"!=Gt(Pt.resolve())||Rt&&"[object Set]"!=Gt(new Rt)||Tt&&"[object WeakMap]"!=Gt(new Tt))&&(Gt=function(e){var t=q(e),r="[object Object]"==t?e.constructor:void 0,n=r?ae(r):"";if(n)switch(n){case Bt:return"[object DataView]";case zt:return"[object Map]";case Nt:return"[object Promise]";case Wt:return"[object Set]";case Vt:return"[object WeakMap]"}return t});var Ut=Gt,Kt="[object Object]",Lt=Object.prototype.hasOwnProperty,Xt=function(e,t,r,n,i,a){var o=T(e),u=T(t),s=o?"[object Array]":Ut(e),c=u?"[object Array]":Ut(t),l=(s="[object Arguments]"==s?Kt:s)==Kt,f=(c="[object Arguments]"==c?Kt:c)==Kt,d=s==c;if(d&&nt(e)){if(!nt(t))return!1;o=!0,l=!1}if(d&&!l)return a||(a=new yt),o||st(e)?St(e,t,r,n,i,a):function(e,t,r,n,i,a,o){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Ot(e),new Ot(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return pe(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var u=Et;case"[object Set]":if(u||(u=jt),e.size!=t.size&&!(1&n))return!1;var s=o.get(e);if(s)return s==t;n|=2,o.set(e,t);var c=St(u(e),u(t),n,i,a,o);return o.delete(e),c;case"[object Symbol]":if(Mt)return Mt.call(e)==Mt.call(t)}return!1}(e,t,s,r,n,i,a);if(!(1&r)){var h=l&&Lt.call(e,"__wrapped__"),b=f&&Lt.call(t,"__wrapped__");if(h||b){var p=h?e.value():e,m=b?t.value():t;return a||(a=new yt),i(p,m,r,n,a)}}return!!d&&(a||(a=new yt),function(e,t,r,n,i,a){var o=1&r,u=kt(e),s=u.length;if(s!=kt(t).length&&!o)return!1;for(var c=s;c--;){var l=u[c];if(!(o?l in t:_t.call(t,l)))return!1}var f=a.get(e),d=a.get(t);if(f&&d)return f==t&&d==e;var h=!0;a.set(e,t),a.set(t,e);for(var b=o;++c<s;){var p=e[l=u[c]],m=t[l];if(n)var v=o?n(m,p,l,t,e,a):n(p,m,l,e,t,a);if(!(void 0===v?p===m||i(p,m,r,n,a):v)){h=!1;break}b||(b="constructor"==l)}if(h&&!b){var y=e.constructor,F=t.constructor;y==F||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof F&&F instanceof F||(h=!1)}return a.delete(e),a.delete(t),h}(e,t,r,n,i,a))},qt=function e(t,r,n,i,a){return t===r||(null==t||null==r||!H(t)&&!H(r)?t!=t&&r!=r:Xt(t,r,n,i,e,a))},Ht=function(e){return e==e&&!ee(e)},Zt=function(e,t){return function(r){return null!=r&&r[e]===t&&(void 0!==t||e in Object(r))}},Jt=function(e){var t=function(e){for(var t=pt(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ht(i)]}return t}(e);return 1==t.length&&t[0][2]?Zt(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r,n){var i=r.length,a=i,o=!n;if(null==e)return!a;for(e=Object(e);i--;){var u=r[i];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){var s=(u=r[i])[0],c=e[s],l=u[1];if(o&&u[2]){if(void 0===c&&!(s in e))return!1}else{var f=new yt;if(n)var d=n(c,l,s,e,t,f);if(!(void 0===d?qt(l,c,3,n,f):d))return!1}}return!0}(r,e,t)}},Yt=function(e,t){for(var r=0,n=(t=Ie(t,e)).length;null!=e&&r<n;)e=e[Ge(t[r++])];return r&&r==n?e:void 0},Qt=function(e,t){return null!=e&&t in Object(e)},er=function(e,t){return Q(e)&&Ht(t)?Zt(Ge(e),t):function(r){var n=function(e,t,r){var n=null==e?void 0:Yt(e,t);return void 0===n?r:n}(r,e);return void 0===n&&n===t?function(e,t){return null!=e&&Ue(e,t,Qt)}(r,e):qt(t,n,3)}},tr=function(e){return e},rr=function(e){return Q(e)?(t=Ge(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Yt(t,e)}}(e);var t},nr=function(e){return"function"==typeof e?e:null==e?tr:"object"==typeof e?T(e)?er(e[0],e[1]):Jt(e):rr(e)},ir=function(e,t){var r={};return t=nr(t),mt(e,(function(e,n,i){et(r,n,t(e,n,i))})),r};function ar(e){this._maxSize=e,this.clear()}ar.prototype.clear=function(){this._size=0,this._values=Object.create(null)},ar.prototype.get=function(e){return this._values[e]},ar.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var or=/[^.^\]^[]+|(?=\[\]|\.\.)/g,ur=/^\d+$/,sr=/^\d/,cr=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,lr=/^\s*(['"]?)(.*?)(\1)\s*$/,fr=new ar(512),dr=new ar(512),hr=new ar(512),br={Cache:ar,split:mr,normalizePath:pr,setter:function(e){var t=pr(e);return dr.get(e)||dr.set(e,(function(e,r){for(var n=0,i=t.length,a=e;n<i-1;){var o=t[n];if("__proto__"===o||"constructor"===o||"prototype"===o)return e;a=a[t[n++]]}a[t[n]]=r}))},getter:function(e,t){var r=pr(e);return hr.get(e)||hr.set(e,(function(e){for(var n=0,i=r.length;n<i;){if(null==e&&t)return;e=e[r[n++]]}return e}))},join:function(e){return e.reduce((function(e,t){return e+(vr(t)||ur.test(t)?"["+t+"]":(e?".":"")+t)}),"")},forEach:function(e,t,r){!function(e,t,r){var n,i,a,o,u=e.length;for(i=0;i<u;i++)(n=e[i])&&(yr(n)&&(n='"'+n+'"'),a=!(o=vr(n))&&/^\d+$/.test(n),t.call(r,n,o,a,i,e))}(Array.isArray(e)?e:mr(e),t,r)}};function pr(e){return fr.get(e)||fr.set(e,mr(e).map((function(e){return e.replace(lr,"$2")})))}function mr(e){return e.match(or)}function vr(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function yr(e){return!vr(e)&&(function(e){return e.match(sr)&&!e.match(ur)}(e)||function(e){return cr.test(e)}(e))}class Fr{constructor(e,t={}){if("string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext="$"===this.key[0],this.isValue="."===this.key[0],this.isSibling=!this.isContext&&!this.isValue,this.path=this.key.slice((this.isContext?"$":this.isValue?".":"").length),this.getter=this.path&&br.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let n=this.isContext?r:this.isValue?e:t;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}function gr(){return(gr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function xr(e){function t(t,r){let{value:n,path:i="",label:a,options:o,originalValue:u,sync:s}=t,c=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(i[r]=e[r]);return i}(t,["value","path","label","options","originalValue","sync"]);const{name:l,test:f,params:d,message:h}=e;let{parent:b,context:p}=o;function m(e){return Fr.isRef(e)?e.getValue(n,b,p):e}function v(e={}){const t=ir(gr({value:n,originalValue:u,label:a,path:e.path||i},d,e.params),m),r=new Je(Je.formatError(e.message||h,t),n,t.path,e.type||l);return r.params=t,r}let y,F=gr({path:i,parent:b,type:l,createError:v,resolve:m,options:o,originalValue:u},c);if(s){try{var g;if(y=f.call(F,n,F),"function"==typeof(null==(g=y)?void 0:g.then))throw new Error(`Validation test of type: "${F.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(e){return void r(e)}Je.isError(y)?r(y):y?r(null,y):r(v())}else try{Promise.resolve(f.call(F,n,F)).then((e=>{Je.isError(e)?r(e):e?r(null,e):r(v())}))}catch(e){r(e)}}return t.OPTIONS=e,t}function wr(e,t,r,n=r){let i,a,o;return t?(br.forEach(t,((u,s,c)=>{let l=s?(e=>e.substr(0,e.length-1).substr(1))(u):u;if((e=e.resolve({context:n,parent:i,value:r})).innerType){let n=c?parseInt(l,10):0;if(r&&n>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${u}, in the path: ${t}. because there is no value at that index. `);i=r,r=r&&r[n],e=e.innerType}if(!c){if(!e.fields||!e.fields[l])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e._type}")`);i=r,r=r&&r[l],e=e.fields[l]}a=l,o=s?"["+u+"]":"."+u})),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}Fr.prototype.__isYupRef=!0;class Sr{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const e=[];for(const t of this.list)e.push(t);for(const[,t]of this.refs)e.push(t.describe());return e}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(e){Fr.isRef(e)?this.refs.set(e.key,e):this.list.add(e)}delete(e){Fr.isRef(e)?this.refs.delete(e.key):this.list.delete(e)}has(e,t){if(this.list.has(e))return!0;let r,n=this.refs.values();for(;r=n.next(),!r.done;)if(t(r.value)===e)return!0;return!1}clone(){const e=new Sr;return e.list=new Set(this.list),e.refs=new Map(this.refs),e}merge(e,t){const r=this.clone();return e.list.forEach((e=>r.add(e))),e.refs.forEach((e=>r.add(e))),t.list.forEach((e=>r.delete(e))),t.refs.forEach((e=>r.delete(e))),r}}function Or(){return(Or=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}class Er{constructor(e){this.deps=[],this.conditions=[],this._whitelist=new Sr,this._blacklist=new Sr,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation((()=>{this.typeError(C.notType)})),this.type=(null==e?void 0:e.type)||"mixed",this.spec=Or({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},null==e?void 0:e.spec)}get _type(){return this.type}_typeCheck(e){return!0}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeError=this._typeError,t._whitelistError=this._whitelistError,t._blacklistError=this._blacklistError,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.exclusiveTests=Or({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=S(Or({},this.spec,e)),t}label(e){var t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const n=Or({},t.spec,r.spec);return r.spec=n,r._typeError||(r._typeError=t._typeError),r._whitelistError||(r._whitelistError=t._whitelistError),r._blacklistError||(r._blacklistError=t._blacklistError),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation((t=>{e.tests.forEach((e=>{t.test(e.OPTIONS)}))})),r}isType(e){return!(!this.spec.nullable||null!==e)||this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce(((t,r)=>r.resolve(t,e)),t),t=t.resolve(e)}return t}cast(e,t={}){let r=this.resolve(Or({value:e},t)),n=r._cast(e,t);if(void 0!==e&&!1!==t.assert&&!0!==r.isType(n)){let i=A(e),a=A(n);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r._type}". \n\nattempted value: ${i} \n`+(a!==i?`result of cast: ${a}`:""))}return n}_cast(e,t){let r=void 0===e?e:this.transforms.reduce(((t,r)=>r.call(this,t,e,this)),e);return void 0===r&&(r=this.getDefault()),r}_validate(e,t={},r){let{sync:n,path:i,from:a=[],originalValue:o=e,strict:u=this.spec.strict,abortEarly:s=this.spec.abortEarly}=t,c=e;u||(c=this._cast(c,Or({assert:!1},t)));let l={value:c,path:i,options:t,originalValue:o,schema:this,label:this.spec.label,sync:n,from:a},f=[];this._typeError&&f.push(this._typeError),this._whitelistError&&f.push(this._whitelistError),this._blacklistError&&f.push(this._blacklistError),Ye({args:l,value:c,path:i,sync:n,tests:f,endEarly:s},(e=>{e?r(e,c):Ye({tests:this.tests,args:l,path:i,sync:n,value:c,endEarly:s},r)}))}validate(e,t,r){let n=this.resolve(Or({},t,{value:e}));return"function"==typeof r?n._validate(e,t,r):new Promise(((r,i)=>n._validate(e,t,((e,t)=>{e?i(e):r(t)}))))}validateSync(e,t){let r;return this.resolve(Or({},t,{value:e}))._validate(e,Or({},t,{sync:!0}),((e,t)=>{if(e)throw e;r=t})),r}isValid(e,t){return this.validate(e,t).then((()=>!0),(e=>{if(Je.isError(e))return!1;throw e}))}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(Je.isError(e))return!1;throw e}}_getDefault(){let e=this.spec.default;return null==e?e:"function"==typeof e?e.call(this):S(e)}getDefault(e){return this.resolve(e||{})._getDefault()}default(e){return 0===arguments.length?this._getDefault():this.clone({default:e})}strict(e=!0){var t=this.clone();return t.spec.strict=e,t}_isPresent(e){return null!=e}defined(e=C.defined){return this.test({message:e,name:"defined",exclusive:!0,test:e=>void 0!==e})}required(e=C.required){return this.clone({presence:"required"}).withMutation((t=>t.test({message:e,name:"required",exclusive:!0,test(e){return this.schema._isPresent(e)}})))}notRequired(){var e=this.clone({presence:"optional"});return e.tests=e.tests.filter((e=>"required"!==e.OPTIONS.name)),e}nullable(e=!0){return this.clone({nullable:!1!==e})}transform(e){var t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=C.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let r=this.clone(),n=xr(t),i=t.exclusive||t.name&&!0===r.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter((e=>{if(e.OPTIONS.name===t.name){if(i)return!1;if(e.OPTIONS.test===n.OPTIONS.test)return!1}return!0})),r.tests.push(n),r}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let r=this.clone(),n=qe(e).map((e=>new Fr(e)));return n.forEach((e=>{e.isSibling&&r.deps.push(e.key)})),r.conditions.push(new Xe(n,t)),r}typeError(e){var t=this.clone();return t._typeError=xr({message:e,name:"typeError",test(e){return!(void 0!==e&&!this.schema.isType(e))||this.createError({params:{type:this.schema._type}})}}),t}oneOf(e,t=C.oneOf){var r=this.clone();return e.forEach((e=>{r._whitelist.add(e),r._blacklist.delete(e)})),r._whitelistError=xr({message:t,name:"oneOf",test(e){if(void 0===e)return!0;let t=this.schema._whitelist;return!!t.has(e,this.resolve)||this.createError({params:{values:t.toArray().join(", ")}})}}),r}notOneOf(e,t=C.notOneOf){var r=this.clone();return e.forEach((e=>{r._blacklist.add(e),r._whitelist.delete(e)})),r._blacklistError=xr({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist;return!t.has(e,this.resolve)||this.createError({params:{values:t.toArray().join(", ")}})}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(){const e=this.clone(),{label:t,meta:r}=e.spec;return{meta:r,label:t,type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map((e=>({name:e.OPTIONS.name,params:e.OPTIONS.params}))).filter(((e,t,r)=>r.findIndex((t=>t.name===e.name))===t))}}}Er.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])Er.prototype[`${e}At`]=function(t,r,n={}){const{parent:i,parentPath:a,schema:o}=wr(this,t,r,n.context);return o[e](i&&i[a],Or({},n,{parent:i,path:t}))};for(const e of["equals","is"])Er.prototype[e]=Er.prototype.oneOf;for(const e of["not","nope"])Er.prototype[e]=Er.prototype.notOneOf;Er.prototype.optional=Er.prototype.notRequired;const jr=e=>null==e;let $r=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,Mr=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Dr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ar=e=>jr(e)||e===e.trim(),Cr={}.toString();function kr(){return new _r}class _r extends Er{constructor(){super({type:"string"}),this.withMutation((()=>{this.transform((function(e){if(this.isType(e))return e;if(Array.isArray(e))return e;const t=null!=e&&e.toString?e.toString():e;return t===Cr?e:t}))}))}_typeCheck(e){return e instanceof String&&(e=e.valueOf()),"string"==typeof e}_isPresent(e){return super._isPresent(e)&&!!e.length}length(e,t=k.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},test(t){return jr(t)||t.length===this.resolve(e)}})}min(e,t=k.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},test(t){return jr(t)||t.length>=this.resolve(e)}})}max(e,t=k.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},test(t){return jr(t)||t.length<=this.resolve(e)}})}matches(e,t){let r,n,i=!1;return t&&("object"==typeof t?({excludeEmptyString:i=!1,message:r,name:n}=t):r=t),this.test({name:n||"matches",message:r||k.matches,params:{regex:e},test:t=>jr(t)||""===t&&i||-1!==t.search(e)})}email(e=k.email){return this.matches($r,{name:"email",message:e,excludeEmptyString:!0})}url(e=k.url){return this.matches(Mr,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=k.uuid){return this.matches(Dr,{name:"uuid",message:e,excludeEmptyString:!1})}ensure(){return this.default("").transform((e=>null===e?"":e))}trim(e=k.trim){return this.transform((e=>null!=e?e.trim():e)).test({message:e,name:"trim",test:Ar})}lowercase(e=k.lowercase){return this.transform((e=>jr(e)?e:e.toLowerCase())).test({message:e,name:"string_case",exclusive:!0,test:e=>jr(e)||e===e.toLowerCase()})}uppercase(e=k.uppercase){return this.transform((e=>jr(e)?e:e.toUpperCase())).test({message:e,name:"string_case",exclusive:!0,test:e=>jr(e)||e===e.toUpperCase()})}}kr.prototype=_r.prototype;var Ir=function(e){return function(t){return null==e?void 0:e[t]}}({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Pr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Rr=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),Tr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Br=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zr="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Nr="["+zr+"]",Wr="\\d+",Vr="[a-z\\xdf-\\xf6\\xf8-\\xff]",Gr="[^\\ud800-\\udfff"+zr+Wr+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Ur="(?:\\ud83c[\\udde6-\\uddff]){2}",Kr="[\\ud800-\\udbff][\\udc00-\\udfff]",Lr="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Xr="(?:"+Vr+"|"+Gr+")",qr="(?:"+Lr+"|"+Gr+")",Hr="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Zr="[\\ufe0e\\ufe0f]?"+Hr+"(?:\\u200d(?:"+["[^\\ud800-\\udfff]",Ur,Kr].join("|")+")[\\ufe0e\\ufe0f]?"+Hr+")*",Jr="(?:"+["[\\u2700-\\u27bf]",Ur,Kr].join("|")+")"+Zr,Yr=RegExp([Lr+"?"+Vr+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[Nr,Lr,"$"].join("|")+")",qr+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[Nr,Lr+Xr,"$"].join("|")+")",Lr+"?"+Xr+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Lr+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Wr,Jr].join("|"),"g"),Qr=function(e,t,r){return e=_e(e),void 0===(t=r?void 0:t)?function(e){return Br.test(e)}(e)?function(e){return e.match(Yr)||[]}(e):function(e){return e.match(Tr)||[]}(e):e.match(t)||[]},en=RegExp("['’]","g"),tn=function(e){return function(t){return function(e,t,r,n){var i=-1,a=null==e?0:e.length;for(n&&a&&(r=e[++i]);++i<a;)r=t(r,e[i],i,e);return r}(Qr(function(e){return(e=_e(e))&&e.replace(Pr,Ir).replace(Rr,"")}(t).replace(en,"")),e,"")}},rn=tn((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),nn=function(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a}(e,t,r)},an=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),on=function(e){return an.test(e)},un="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",sn="\\ud83c[\\udffb-\\udfff]",cn="[^\\ud800-\\udfff]",ln="(?:\\ud83c[\\udde6-\\uddff]){2}",fn="[\\ud800-\\udbff][\\udc00-\\udfff]",dn="(?:"+un+"|"+sn+")?",hn="[\\ufe0e\\ufe0f]?"+dn+"(?:\\u200d(?:"+[cn,ln,fn].join("|")+")[\\ufe0e\\ufe0f]?"+dn+")*",bn="(?:"+[cn+un+"?",un,ln,fn,"[\\ud800-\\udfff]"].join("|")+")",pn=RegExp(sn+"(?="+sn+")|"+bn+hn,"g"),mn=function(e){return on(e)?function(e){return e.match(pn)||[]}(e):function(e){return e.split("")}(e)},vn=function(e){e=_e(e);var t=on(e)?mn(e):void 0,r=t?t[0]:e.charAt(0),n=t?nn(t,1).join(""):e.slice(1);return r.toUpperCase()+n},yn=tn((function(e,t,r){return t=t.toLowerCase(),e+(r?function(e){return vn(_e(e).toLowerCase())}(t):t)})),Fn=function(e){return gn(function(e){for(var t=new Set,r=0,n=e.length;r<n;r++){var i=e[r];t.add(i[0]),t.add(i[1])}return Array.from(t)}(e),e)};function gn(e,t){var r=e.length,n=new Array(r),i={},a=r,o=function(e){for(var t=new Map,r=0,n=e.length;r<n;r++){var i=e[r];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}(t),u=function(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(e[r],r);return t}(e);for(t.forEach((function(e){if(!u.has(e[0])||!u.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")}));a--;)i[a]||s(e[a],a,new Set);return n;function s(e,t,a){if(a.has(e)){var c;try{c=", node was:"+JSON.stringify(e)}catch(e){c=""}throw new Error("Cyclic dependency"+c)}if(!u.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!i[t]){i[t]=!0;var l=o.get(e)||new Set;if(t=(l=Array.from(l)).length){a.add(e);do{var f=l[--t];s(f,u.get(f),a)}while(t);a.delete(e)}n[--r]=e}}}function xn(e,t){let r=1/0;return e.some(((e,n)=>{var i;if(-1!==(null==(i=t.path)?void 0:i.indexOf(e)))return r=n,!0})),r}function wn(e){return(t,r)=>xn(e,t)-xn(e,r)}function Sn(){return(Sn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Fn.array=gn;let On=e=>"[object Object]"===Object.prototype.toString.call(e);const En=wn([]);class jn extends Er{constructor(e){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=En,this._nodes=[],this._excludedEdges=[],this.withMutation((()=>{this.transform((function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e=null}return this.isType(e)?e:null})),e&&this.shape(e)}))}_typeCheck(e){return On(e)||"function"==typeof e}_cast(e,t={}){var r;let n=super._cast(e,t);if(void 0===n)return this.getDefault();if(!this._typeCheck(n))return n;let i=this.fields,a=null!=(r=t.stripUnknown)?r:this.spec.noUnknown,o=this._nodes.concat(Object.keys(n).filter((e=>-1===this._nodes.indexOf(e)))),u={},s=Sn({},t,{parent:u,__validating:t.__validating||!1}),c=!1;for(const e of o){let r=i[e],o=Ke(n,e);if(r){let i,a=n[e];s.path=(t.path?`${t.path}.`:"")+e,r=r.resolve({value:a,context:t.context,parent:u});let o="spec"in r?r.spec:void 0,l=null==o?void 0:o.strict;if(null==o?void 0:o.strip){c=c||e in n;continue}i=t.__validating&&l?n[e]:r.cast(n[e],s),void 0!==i&&(u[e]=i)}else o&&!a&&(u[e]=n[e]);u[e]!==n[e]&&(c=!0)}return c?u:n}_validate(e,t={},r){let n=[],{sync:i,from:a=[],originalValue:o=e,abortEarly:u=this.spec.abortEarly,recursive:s=this.spec.recursive}=t;a=[{schema:this,value:o},...a],t.__validating=!0,t.originalValue=o,t.from=a,super._validate(e,t,((e,c)=>{if(e){if(!Je.isError(e)||u)return void r(e,c);n.push(e)}if(!s||!On(c))return void r(n[0]||null,c);o=o||c;let l=this._nodes.map((e=>(r,n)=>{let i=-1===e.indexOf(".")?(t.path?`${t.path}.`:"")+e:`${t.path||""}["${e}"]`,u=this.fields[e];u&&"validate"in u?u.validate(c[e],Sn({},t,{path:i,from:a,strict:!0,parent:c,originalValue:o[e]}),n):n(null)}));Ye({sync:i,tests:l,value:c,errors:n,endEarly:u,sort:this._sortErrors,path:t.path},r)}))}clone(e){const t=super.clone(e);return t.fields=Sn({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[e,t]of Object.entries(this.fields)){const n=r[e];void 0===n?r[e]=t:n instanceof Er&&t instanceof Er&&(r[e]=t.concat(n))}return t.withMutation((()=>t.shape(r)))}getDefaultFromShape(){let e={};return this._nodes.forEach((t=>{const r=this.fields[t];e[t]="default"in r?r.getDefault():void 0})),e}_getDefault(){return"default"in this.spec?super._getDefault():this._nodes.length?this.getDefaultFromShape():void 0}shape(e,t=[]){let r=this.clone(),n=Object.assign(r.fields,e);if(r.fields=n,r._sortErrors=wn(Object.keys(n)),t.length){Array.isArray(t[0])||(t=[t]);let e=t.map((([e,t])=>`${e}-${t}`));r._excludedEdges=r._excludedEdges.concat(e)}return r._nodes=function(e,t=[]){let r=[],n=[];function i(e,i){var a=br.split(e)[0];~n.indexOf(a)||n.push(a),~t.indexOf(`${i}-${a}`)||r.push([i,a])}for(const t in e)if(Ke(e,t)){let r=e[t];~n.indexOf(t)||n.push(t),Fr.isRef(r)&&r.isSibling?i(r.path,t):Le(r)&&"deps"in r&&r.deps.forEach((e=>i(e,t)))}return Fn.array(n,r).reverse()}(n,r._excludedEdges),r}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.clone().withMutation((e=>(e.fields={},e.shape(t))))}omit(e){const t=this.clone(),r=t.fields;t.fields={};for(const t of e)delete r[t];return t.withMutation((()=>t.shape(r)))}from(e,t,r){let n=br.getter(e,!0);return this.transform((i=>{if(null==i)return i;let a=i;return Ke(i,e)&&(a=Sn({},i),r||delete a[e],a[t]=n(i)),a}))}noUnknown(e=!0,t=_.noUnknown){"string"==typeof e&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const r=function(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter((e=>-1===r.indexOf(e)))}(this.schema,t);return!e||0===r.length||this.createError({params:{unknown:r.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=_.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform((t=>t&&function(e,t){var r={};return t=nr(t),mt(e,(function(e,n,i){et(r,t(e,n,i),e)})),r}(t,((t,r)=>e(r)))))}camelCase(){return this.transformKeys(yn)}snakeCase(){return this.transformKeys(rn)}constantCase(){return this.transformKeys((e=>rn(e).toUpperCase()))}describe(){let e=super.describe();return e.fields=ir(this.fields,(e=>e.describe())),e}}function $n(e){return new jn(e)}$n.prototype=jn.prototype;const Mn=async()=>{var e,r,n,i;const a=null!==(i=null===(n=null===(r=null===(e=t.paymentMethods)||void 0===e?void 0:e.credit)||void 0===r?void 0:r.installments)||void 0===n?void 0:n.show)&&void 0!==i&&i,o=await An(F.form,{hasInstallments:a});return o.isValid||(F.validations.fields=Object.assign(Object.assign({},F.validations.fields),o.errors),Dn(F.form)&&(F.validations.allFieldsIsBlank=!0)),o.isValid},Dn=e=>{const t=Object.entries(e),r=t.map((([e,t])=>{const r=["expirationDate","cvv"].includes(e),n=e.replace(/\D/g,"").trim();return r?n:t})).filter((e=>!e||"none"===e));return t.length===r.length},An=async(e,t,r)=>{try{const n=(e=>$n().shape({cardNumber:kr().required(o("paymentMethods.card.newCard.fields.cardNumber.errorMessageRequired",e)).test("isMin",o("paymentMethods.card.newCard.fields.cardNumber.errorMessageMin",e),(e=>!e||e.length>=14)).test("isMax",o("paymentMethods.card.newCard.fields.cardNumber.errorMessageInvalidFormat",e),(e=>!e||e.length<=22)).test("isNumber",o("paymentMethods.card.newCard.fields.cardNumber.errorMessageInvalidFormat",e),(e=>!e.length||e.length<14||a.valid.number(e).isValid)),expirationDate:kr().required(o("paymentMethods.card.newCard.fields.expirationDate.errorMessageRequired",e)).test("invalidMonth",o("paymentMethods.card.newCard.fields.expirationDate.errorMessageMonthInvalid",e),(e=>{if(!e)return!0;const t=e.slice(0,2),r=parseInt(t,10);return r>=1&&r<=12})).test("isMinDate",o("paymentMethods.card.newCard.fields.expirationDate.errorMessageMin",e),(e=>{const t=e.replace(/\D/g,"").trim().length;return!t||4===t})).test("isValidDate",o("paymentMethods.card.newCard.fields.expirationDate.errorMessageInvalidFormat",e),(e=>{const t=e.replace(/\D/g,"").trim(),r=parseInt(e.slice(0,2),10);if(!t.length||t.length<4||r<1||r>12)return!0;const[n,i]=e.split("/"),a=parseInt(n)-1,o=parseInt(`20${i}`),u=new Date,s=Array.from({length:12}).map(((e,t)=>t)),c=a>=u.getMonth()&&s.includes(a),l=o===u.getFullYear()?c:s.includes(a),f=o>=u.getFullYear();return l&&f})),cvv:kr().required(o("paymentMethods.card.newCard.fields.cvv.errorMessageRequired",e)).test("isMin",o("paymentMethods.card.newCard.fields.cvv.errorMessageMin",e),(e=>!e||e.length>=3)).test("isMax",o("paymentMethods.card.newCard.fields.cvv.errorMessageInvalidFormat",e),(e=>!e||e.length<=4)),name:kr().required(o("paymentMethods.card.newCard.fields.name.errorMessageRequired",e)).test("isValidName",o("paymentMethods.card.newCard.fields.name.errorMessageInvalidFormat",e),(e=>{const t=e.replace(/[^A-Za-z]+/g,""),r=e.replace(/\s/g,"");return t.length===r.length})),installments:kr().when("$hasInstallments",{is:e=>e,then:kr().required(o("paymentMethods.card.newCard.fields.installments.errorMessageRequired",e)).min(1)})}))(r);return await n.validate(e,{abortEarly:!1,context:t}),{isValid:!0}}catch(e){return{isValid:!1,errors:(n=e.inner,n.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.path]:t.message})),{}))}}var n},{state:Cn}=e({configs:{mode:"success",open:!1,amount:0,paymentCode:"",paymentImageUrl:"",expirationDate:"",expirationTime:0,successMessage:"",errorTitle:"",errorMessage:""}}),kn=e=>{if(!e)return{};const t="br"===e.country.toLowerCase()?s(e.zipCode):c(e.zipCode);return{address:{country:e.country,state:e.state,city:e.city,district:e.district,zipCode:t,street:e.street,streetNumber:e.streetNumber,complement:e.complement}}},_n=(e,t=!1)=>{if(!e||"noDocument"===e.type)return t?null:{document:{type:"noDocument"}};const r=["cpf","cnpj"].includes(e.type.toLowerCase())?s(e.number):c(e.number);return{document:{type:t?e.type.toUpperCase():e.type.toLowerCase(),number:r,country:e.country}}},In=(e,t=!1)=>{const r=kn(e.address),n=_n(e.document,t);return Object.assign(Object.assign(Object.assign({},r),n),{phoneNumber:(null==e?void 0:e.phoneNumber)?s(e.phoneNumber):" ",name:e.name,email:e.email})},Pn=e=>{const t=kn(e.address),r=_n(e.document),n=(null==e?void 0:e.phoneNumber)?s(e.phoneNumber):" ",i=Object.values(e.address?e.address:{}).some((e=>e)),a=Object.assign(Object.assign({},r),{name:e.name,email:e.email,phoneNumber:n});return i?Object.assign(Object.assign({},t),a):a};class Rn{constructor({customerId:e,customer:t}){this.customerId=e,this.customer=t}getCustomerMethod(){return this.customerId?{customerId:this.customerId}:{customer:Pn(this.customer)}}getPaymentSource(){const e=this.getCustomerMethod();return Object.assign({sourceType:"customer"},e)}}var Tn=n((function(e,t){(function(){var n={function:!0,object:!0},i=n[typeof window]&&window||this,a=n.object&&t,o=n.object&&e&&!e.nodeType&&e,u=a&&o&&"object"==typeof r&&r;!u||u.global!==u&&u.window!==u&&u.self!==u||(i=u);var s=Math.pow(2,53)-1,c=/\bOpera/,l=Object.prototype,f=l.hasOwnProperty,d=l.toString;function h(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function b(e){return e=F(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:h(e)}function p(e,t){for(var r in e)f.call(e,r)&&t(e[r],r,e)}function m(e){return null==e?h(e):d.call(e).slice(8,-1)}function v(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function y(e,t){var r=null;return function(e,t){var r=-1,n=e?e.length:0;if("number"==typeof n&&n>-1&&n<=s)for(;++r<n;)t(e[r],r);else p(e,t)}(e,(function(n,i){r=t(r,n,i,e)})),r}function F(e){return String(e).replace(/^ +| +$/g,"")}var g=function e(t){var r=i,n=t&&"object"==typeof t&&"String"!=m(t);n&&(r=t,t=null);var a=r.navigator||{},o=a.userAgent||"";t||(t=o);var u,s,l=n?!!a.likeChrome:/\bChrome\b/.test(t)&&!/internal|\n/i.test(d.toString()),f="Object",h=n?f:"ScriptBridgingProxyObject",g=n?f:"Environment",x=n&&r.java?"JavaPackage":m(r.java),w=n?f:"RuntimeObject",S=/\bJava/.test(x)&&r.java,O=S&&m(r.environment)==g,E=S?"a":"α",j=S?"b":"β",$=r.document||{},M=r.operamini||r.opera,D=c.test(D=n&&M?M["[[Class]]"]:m(M))?D:M=null,A=t,C=[],k=null,_=t==o,I=_&&M&&"function"==typeof M.version&&M.version(),P=y([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],(function(e,r){return e||RegExp("\\b"+(r.pattern||v(r))+"\\b","i").exec(t)&&(r.label||r)})),R=y(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"(?:Edge|Edg|EdgA|EdgiOS)"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Vivaldi","Waterfox","WebPositive",{label:"Yandex Browser",pattern:"YaBrowser"},{label:"UC Browser",pattern:"UCBrowser"},"Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chromium","Chrome",{label:"Chrome",pattern:"(?:HeadlessChrome)"},{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"],(function(e,r){return e||RegExp("\\b"+(r.pattern||v(r))+"\\b","i").exec(t)&&(r.label||r)})),T=N([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),B=y({Apple:{iPad:1,iPhone:1,iPod:1},Alcatel:{},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},Huawei:{},Lenovo:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Oppo:{},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1},Xiaomi:{Mi:1,Redmi:1}},(function(e,r,n){return e||(r[T]||r[/^[a-z]+(?: +[a-z]+\b)*/i.exec(T)]||RegExp("\\b"+v(n)+"(?:\\b|\\w*\\d)","i").exec(t))&&n})),z=y(["Windows Phone","KaiOS","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian",{label:"DragonFly BSD",pattern:"DragonFly"},"Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "],(function(e,r){var n=r.pattern||v(r);return!e&&(e=RegExp("\\b"+n+"(?:/[\\d.]+|[ \\w.]*)","i").exec(t))&&(e=function(e,t,r){var n={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return t&&r&&/^Win/i.test(e)&&!/^Windows Phone /i.test(e)&&(n=n[/[\d.]+$/.exec(e)])&&(e="Windows "+n),e=String(e),t&&r&&(e=e.replace(RegExp(t,"i"),r)),b(e.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(e,n,r.label||r)),e}));function N(e){return y(e,(function(e,r){var n=r.pattern||v(r);return!e&&(e=RegExp("\\b"+n+" *\\d+[.\\w_]*","i").exec(t)||RegExp("\\b"+n+" *\\w+-[\\w]*","i").exec(t)||RegExp("\\b"+n+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(t))&&((e=String(r.label&&!RegExp(n,"i").test(r.label)?r.label:e).split("/"))[1]&&!/[\d.]+/.test(e[0])&&(e[0]+=" "+e[1]),r=r.label||r,e=b(e[0].replace(RegExp(n,"i"),r).replace(RegExp("; *(?:"+r+"[_-])?","i")," ").replace(RegExp("("+r+")[-_.]?(\\w)","i"),"$1 $2"))),e}))}function W(e){return y(e,(function(e,r){return e||(RegExp(r+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(t)||0)[1]||null}))}if(P&&(P=[P]),/\bAndroid\b/.test(z)&&!T&&(u=/\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(t))&&(T=F(u[1]).replace(/^[a-z]{2}-[a-z]{2};\s*/i,"")||null),B&&!T?T=N([B]):B&&T&&(T=T.replace(RegExp("^("+v(B)+")[-_.\\s]","i"),B+" ").replace(RegExp("^("+v(B)+")[-_.]?(\\w)","i"),B+" $2")),(u=/\bGoogle TV\b/.exec(T))&&(T=u[0]),/\bSimulator\b/i.test(t)&&(T=(T?T+" ":"")+"Simulator"),"Opera Mini"==R&&/\bOPiOS\b/.test(t)&&C.push("running in Turbo/Uncompressed mode"),"IE"==R&&/\blike iPhone OS\b/.test(t)?(B=(u=e(t.replace(/like iPhone OS/,""))).manufacturer,T=u.product):/^iP/.test(T)?(R||(R="Safari"),z="iOS"+((u=/ OS ([\d_]+)/i.exec(t))?" "+u[1].replace(/_/g,"."):"")):"Konqueror"==R&&/^Linux\b/i.test(z)?z="Kubuntu":B&&"Google"!=B&&(/Chrome/.test(R)&&!/\bMobile Safari\b/i.test(t)||/\bVita\b/.test(T))||/\bAndroid\b/.test(z)&&/^Chrome/.test(R)&&/\bVersion\//i.test(t)?(R="Android Browser",z=/\bAndroid\b/.test(z)?z:"Android"):"Silk"==R?(/\bMobi/i.test(t)||(z="Android",C.unshift("desktop mode")),/Accelerated *= *true/i.test(t)&&C.unshift("accelerated")):"UC Browser"==R&&/\bUCWEB\b/.test(t)?C.push("speed mode"):"PaleMoon"==R&&(u=/\bFirefox\/([\d.]+)\b/.exec(t))?C.push("identifying as Firefox "+u[1]):"Firefox"==R&&(u=/\b(Mobile|Tablet|TV)\b/i.exec(t))?(z||(z="Firefox OS"),T||(T=u[1])):!R||(u=!/\bMinefield\b/i.test(t)&&/\b(?:Firefox|Safari)\b/.exec(R))?(R&&!T&&/[\/,]|^[^(]+?\)/.test(t.slice(t.indexOf(u+"/")+8))&&(R=null),(u=T||B||z)&&(T||B||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(z))&&(R=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(z)?z:u)+" Browser")):"Electron"==R&&(u=(/\bChrome\/([\d.]+)\b/.exec(t)||0)[1])&&C.push("Chromium "+u),I||(I=W(["(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)","Version",v(R),"(?:Firefox|Minefield|NetFront)"])),(u=("iCab"==P&&parseFloat(I)>3?"WebKit":/\bOpera\b/.test(R)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(P)&&"WebKit"||!P&&/\bMSIE\b/i.test(t)&&("Mac OS"==z?"Tasman":"Trident")||"WebKit"==P&&/\bPlayStation\b(?! Vita\b)/i.test(R)&&"NetFront")&&(P=[u]),"IE"==R&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(R+=" Mobile",z="Windows Phone "+(/\+$/.test(u)?u:u+".x"),C.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(R="IE Mobile",z="Windows Phone 8.x",C.unshift("desktop mode"),I||(I=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=R&&"Trident"==P&&(u=/\brv:([\d.]+)/.exec(t))&&(R&&C.push("identifying as "+R+(I?" "+I:"")),R="IE",I=u[1]),_){if(function(e){var t=null!=e?typeof e.global:"number";return!(/^(?:boolean|number|string|undefined)$/.test(t)||"object"==t&&!e.global)}(r))if(S&&(A=(u=S.lang.System).getProperty("os.arch"),z=z||u.getProperty("os.name")+" "+u.getProperty("os.version")),O){try{I=r.require("ringo/engine").version.join("."),R="RingoJS"}catch(e){(u=r.system)&&u.global.system==r.system&&(R="Narwhal",z||(z=u[0].os||null))}R||(R="Rhino")}else"object"==typeof r.process&&!r.process.browser&&(u=r.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(C.push("Node "+u.versions.node),R="Electron",I=u.versions.electron):"string"==typeof u.versions.nw&&(C.push("Chromium "+I,"Node "+u.versions.node),R="NW.js",I=u.versions.nw)),R||(R="Node.js",A=u.arch,z=u.platform,I=(I=/[\d.]+/.exec(u.version))?I[0]:null));else m(u=r.runtime)==h?(R="Adobe AIR",z=u.flash.system.Capabilities.os):m(u=r.phantom)==w?(R="PhantomJS",I=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof $.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?((u=+u[1]+4)!=(I=[I,$.documentMode])[1]&&(C.push("IE "+I[1]+" mode"),P&&(P[1]=""),I[1]=u),I="IE"==R?String(I[1].toFixed(1)):I[0]):"number"==typeof $.documentMode&&/^(?:Chrome|Firefox)\b/.test(R)&&(C.push("masking as "+R+" "+I),R="IE",I="11.0",P=["Trident"],z="Windows");z=z&&b(z)}if(I&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(I)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(_&&a.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(k=/b/i.test(u)?"beta":"alpha",I=I.replace(RegExp(u+"\\+?$"),"")+("beta"==k?j:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==R||"Firefox"==R&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(z))R="Firefox Mobile";else if("Maxthon"==R&&I)I=I.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(T))"Xbox 360"==T&&(z=null),"Xbox 360"==T&&/\bIEMobile\b/.test(t)&&C.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(R)&&(!R||T||/Browser|Mobi/.test(R))||"Windows CE"!=z&&!/Mobi/i.test(t))if("IE"==R&&_)try{null===r.external&&C.unshift("platform preview")}catch(e){C.unshift("embedded")}else(/\bBlackBerry\b/.test(T)||/\bBB10\b/.test(t))&&(u=(RegExp(T.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||I)?(z=((u=[u,/BB10/.test(t)])[1]?(T=null,B="BlackBerry"):"Device Software")+" "+u[0],I=null):this!=p&&"Wii"!=T&&(_&&M||/Opera/.test(R)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==R&&/\bOS X (?:\d+\.){2,}/.test(z)||"IE"==R&&(z&&!/^Win/.test(z)&&I>5.5||/\bWindows XP\b/.test(z)&&I>8||8==I&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(p,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(R)?(/\bIE\b/.test(u)&&"Mac OS"==z&&(z=null),u="identify"+u):(u="mask"+u,R=D?b(D.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(z=null),_||(I=null)),P=["Presto"],C.push(u));else R+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==R&&"+"==u[1].slice(-1)?(R="WebKit Nightly",k="alpha",I=u[1].slice(0,-1)):I!=u[1]&&I!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(I=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==P&&(P=["Blink"]),_&&(l||u[1])?(P&&(P[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=P?"27":"28")):(P&&(P[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),P&&(P[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==R&&(!I||parseInt(I)>45)?I=u:"Chrome"==R&&/\bHeadlessChrome/i.test(t)&&C.unshift("headless")),"Opera"==R&&(u=/\bzbov|zvav$/.exec(z))?(R+=" ",C.unshift("desktop mode"),"zvav"==u?(R+="Mini",I=null):R+="Mobile",z=z.replace(RegExp(" *"+u+"$"),"")):"Safari"==R&&/\bChrome\b/.exec(P&&P[1])?(C.unshift("desktop mode"),R="Chrome Mobile",I=null,/\bOS X\b/.test(z)?(B="Apple",z="iOS 4.3+"):z=null):/\bSRWare Iron\b/.test(R)&&!I&&(I=W("Chrome")),I&&0==I.indexOf(u=/[\d.]+$/.exec(z))&&t.indexOf("/"+u+"-")>-1&&(z=F(z.replace(u,""))),z&&-1!=z.indexOf(R)&&!RegExp(R+" OS").test(z)&&(z=z.replace(RegExp(" *"+v(R)+" *"),"")),P&&!/\b(?:Avant|Nook)\b/.test(R)&&(/Browser|Lunascape|Maxthon/.test(R)||"Safari"!=R&&/^iOS/.test(z)&&/\bSafari\b/.test(P[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(R)&&P[1])&&(u=P[P.length-1])&&C.push(u),C.length&&(C=["("+C.join("; ")+")"]),B&&T&&T.indexOf(B)<0&&C.push("on "+B),T&&C.push((/^on /.test(C[C.length-1])?"":"on ")+T),z&&(u=/ ([\d.+]+)$/.exec(z),s=u&&"/"==z.charAt(z.length-u[0].length-1),z={architecture:32,family:u&&!s?z.replace(u[0],""):z,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(A))&&!/\bi686\b/i.test(A)?(z&&(z.architecture=64,z.family=z.family.replace(RegExp(" *"+u),"")),R&&(/\bWOW64\b/i.test(t)||_&&/\w(?:86|32)$/.test(a.cpuClass||a.platform)&&!/\bWin64; x64\b/i.test(t))&&C.unshift("32-bit")):z&&/^OS X/.test(z.family)&&"Chrome"==R&&parseFloat(I)>=39&&(z.architecture=64),t||(t=null);var V={};return V.description=t,V.layout=P&&P[0],V.manufacturer=B,V.name=R,V.prerelease=k,V.product=T,V.ua=t,V.version=R&&I,V.os=z||{architecture:null,family:null,version:null,toString:function(){return"null"}},V.parse=e,V.toString=function(){return this.description||""},V.version&&C.unshift(I),V.name&&C.unshift(R),z&&R&&(z!=String(z).split(" ")[0]||z!=R.split(" ")[0]&&!T)&&C.push(T?"("+z+")":"on "+z),C.length&&(V.description=C.join(" ")),V}();a&&o?p(g,(function(e,t){a[t]=e})):i.platform=g}).call(r)}));class Bn{constructor(){this.axiosConfig={baseURL:this.getCurrentHost(),headers:{"Content-Type":"application/json","X-Client-Id":t.clientId,"X-Api-Key":t.publicKey}},this.api=f.create(this.axiosConfig)}getCurrentHost(){return t.debug?"https://api.dev.malga.io/v1":t.sandbox?"https://sandbox-api.malga.io/v1":"https://api.malga.io/v1"}async create({endpoint:e,data:t,headers:r}){return this.api.post(e,t,{headers:r})}async fetch({endpoint:e}){return this.api.get(e)}}function zn(e,t=!1){return t?{paymentSource:e.paymentSource,paymentMethod:e.paymentMethod,customerId:e.customerId,fraudAnalysis:e.fraudAnalysis,paymentFlow:e.paymentFlow,splitRules:e.splitRules}:e}class Nn{constructor({provider:e}){this.api=new Bn,this.provider=e}async pay({headers:e,payload:r}){const n=!!t.sessionId,i=n?`/sessions/${t.sessionId}/charge`:"/charges",a=await this.api.create({endpoint:i,data:zn(r,n),headers:e});return{hasError:["failed","charged_back","canceled","voided"].includes(a.data.status),data:a.data}}}class Wn{constructor({provider:e}){this.api=new Bn,this.provider=e,this.payments=new Nn({provider:e})}async create(e){var r,n,i,a,o,u;const s=await(async e=>{var r;const n=(null==e?void 0:e.customer)||t.transactionConfig.customer;if(!e||!(null==n?void 0:n.address)&&!(null==e?void 0:e.usePartialCustomer))return null;const i=In(n,!0),a=i.address&&Object.assign(Object.assign({},i.address),{number:i.address.streetNumber}),o=await(async(e,t)=>{if(!e)return{};const r=await(async()=>{const{data:e}=await f.get("https://geolocation-db.com/json/");return e.IPv4})(),n=location.hostname;return{browser:{browserFingerprint:e,email:t,cookiesAccepted:(()=>{try{document.cookie="cookietest=1; SameSite=Strict;";const e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}})(),hostName:n,ipAddress:r,type:navigator.userAgent}}})(e.browserFingerprint,i.email);a&&delete a.streetNumber;const u=(null===(r=null==i?void 0:i.phoneNumber)||void 0===r?void 0:r.trim())?{phone:i.phoneNumber}:{};return{customer:Object.assign(Object.assign(Object.assign(Object.assign({name:i.name,email:i.email},i.document&&{identityType:i.document.type,identity:i.document.number}),n.address&&{deliveryAddress:a,billingAddress:a}),u),o),cart:{items:e.cart}}})(t.transactionConfig.fraudAnalysis),c=(e=>Object.entries(e).filter((([,e])=>"boolean"==typeof e||!!e)).reduce(((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r})),{}))(Object.assign({customerId:e||t.transactionConfig.customerId,currency:t.transactionConfig.currency,orderId:t.transactionConfig.orderId,description:t.transactionConfig.description,merchantId:t.merchantId,amount:t.transactionConfig.amount,statementDescriptor:t.transactionConfig.statementDescriptor,capture:t.transactionConfig.capture,sessionId:t.sessionId,splitRules:t.transactionConfig.splitRules,providerReferenceKey:t.transactionConfig.providerReferenceKey,fraudAnalysis:s},t.transactionConfig.paymentFlowMetadata&&{paymentFlow:{metadata:t.transactionConfig.paymentFlowMetadata}})),l=Object.assign(Object.assign({},c),{paymentMethod:this.provider.getPaymentMethod(),paymentSource:await this.provider.getPaymentSource(),appInfo:Object.assign(Object.assign({},t.appInfo),{platform:{integrator:"Malga",name:null!==(i=null===(n=null===(r=null==t?void 0:t.appInfo)||void 0===r?void 0:r.platform)||void 0===n?void 0:n.name)&&void 0!==i?i:"Checkout SDK",version:null!==(u=null===(o=null===(a=null==t?void 0:t.appInfo)||void 0===a?void 0:a.platform)||void 0===o?void 0:o.version)&&void 0!==u?u:"1.22.0"},device:{name:Tn.name,version:Tn.version}})});return this.payments.pay({headers:t.idempotencyKey?{"X-Idempotency-Key":t.idempotencyKey}:{},payload:l})}async find(e){const t=await this.api.fetch({endpoint:`/charges/${e}`});return{hasError:["failed","charged_back","canceled","voided","pending"].includes(t.data.status),data:t.data}}}class Vn{constructor(){this.api=new Bn,this.endpoint=t.sessionId?"/sessions/customers":"/customers"}async create(e,t){return this.api.create({endpoint:`${this.endpoint}/${t}/cards`,data:{cardId:e}})}async list(e){return{data:(await this.api.fetch({endpoint:`${this.endpoint}/${e}/cards`})).data}}}class Gn extends Rn{constructor({pix:e}){super({customerId:t.transactionConfig.customerId,customer:t.transactionConfig.customer}),this.pix=e}getPaymentMethod(){const e=(t=this.pix).items&&(null===(r=t.items)||void 0===r?void 0:r.length)?{items:t.items}:{};var t,r;return Object.assign({paymentType:"pix",expiresIn:this.pix.expiresIn},e)}}class Un{constructor({onPaymentSuccess:e,onPaymentFailed:t,onShowDialog:r,data:n}){this.charge=new Wn({provider:new Gn({pix:n})}),this.data=n,this.onPaymentSuccess=e,this.onPaymentFailed=t,this.onShowDialog=r}handlePaymentSuccess(e){u.chargeId=e.id;const r=e.paymentMethod;t.dialogConfig.show&&this.onShowDialog({mode:"pix",amount:e.amount,open:!0,paymentCode:r.qrCodeData,paymentImageUrl:r.qrCodeImageUrl,expirationTime:r.expiresIn}),this.onPaymentSuccess(e)}handlePaymentFailed(e){t.automaticallyGeneratedIdempotencyKey&&(t.idempotencyKey=y()),t.dialogConfig.show&&this.onShowDialog({open:!0,mode:"error",errorMessage:o("dialogs.pix.errorMessage",t.locale)}),this.onPaymentFailed(e)}async pay(){try{const e=await this.charge.create();if(e.hasError)return void this.handlePaymentFailed({type:e.data.status,message:"Your transaction cannot be completed",errorStack:e.data});this.handlePaymentSuccess(e.data)}catch(e){this.handlePaymentFailed({type:e.response.status,message:"Your transaction cannot be completed",errorStack:e.response.data})}}async findCharge(e){try{const r=await this.charge.find(e);if(r.hasError)return this.onShowDialog({open:!0,mode:"error",errorTitle:o("dialogs.pix.errorTitleExpired",t.locale),errorMessage:o("dialogs.pix.errorMessageExpired",t.locale)}),void this.handlePaymentFailed({type:"400",message:"Pix not paid",errorStack:r.data});this.onShowDialog({mode:"success",open:!0,successMessage:o("dialogs.pix.successMessage",t.locale)})}catch(e){this.onShowDialog({open:!0,mode:"error",errorMessage:o("dialogs.pix.errorMessage",t.locale)}),this.handlePaymentFailed({type:"400",message:"Pix not paid",errorStack:e.response.data})}}}export{Bn as A,Rn as B,Wn as C,Un as M,Vn as a,Cn as b,s as c,An as d,f as e,In as f,Mn as h,F as s,y as v}