(()=>{var e={606(e){var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,c=[],d=!1,l=-1;function u(){d&&s&&(d=!1,s.length?c=s.concat(c):l=-1,c.length&&p())}function p(){if(!d){var e=a(u);d=!0;for(var t=c.length;t;){for(s=c,c=[];++l<t;)s&&s[l].run();l=-1,t=c.length}s=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new h(e,t)),1!==c.length||d||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},232(e,t,r){var n;!function(i,o){"use strict";var a="function",s="undefined",c="object",d="string",l="major",u="model",p="name",h="type",m="vendor",f="version",g="architecture",w="console",y="mobile",E="tablet",_="smarttv",b="wearable",v="embedded",A="Amazon",I="Apple",P="ASUS",T="BlackBerry",k="Browser",M="Chrome",C="Firefox",O="Google",R="Honor",N="Huawei",S="LG",F="Microsoft",D="Motorola",L="Nvidia",x="OnePlus",U="Opera",j="OPPO",$="Samsung",W="Sharp",z="Sony",q="Xiaomi",V="Zebra",B="Facebook",G="Chromium OS",Y="Mac OS",K=" Browser",H=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},X=function(e,t){return typeof e===d&&-1!==J(t).indexOf(J(e))},J=function(e){return e.toLowerCase()},Z=function(e,t){if(typeof e===d)return e=e.replace(/^\s\s*/,""),typeof t===s?e:e.substring(0,500)},Q=function(e,t){for(var r,n,i,s,d,l,u=0;u<t.length&&!d;){var p=t[u],h=t[u+1];for(r=n=0;r<p.length&&!d&&p[r];)if(d=p[r++].exec(e))for(i=0;i<h.length;i++)l=d[++n],typeof(s=h[i])===c&&s.length>0?2===s.length?typeof s[1]==a?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:3===s.length?typeof s[1]!==a||s[1].exec&&s[1].test?this[s[0]]=l?l.replace(s[1],s[2]):o:this[s[0]]=l?s[1].call(this,l,s[2]):o:4===s.length&&(this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):o):this[s]=l||o;u+=2}},ee=function(e,t){for(var r in t)if(typeof t[r]===c&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(X(t[r][n],e))return"?"===r?o:r}else if(X(t[r],e))return"?"===r?o:r;return t.hasOwnProperty("*")?t["*"]:e},te={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},re={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,f],[/opios[\/ ]+([\w\.]+)/i],[f,[p,U+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[p,U+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[p,U]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[p,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[f,[p,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[p,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[p,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[p,"UC"+k]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[p,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[p,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[p,"Smart Lenovo "+k]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+k],f],[/\bfocus\/([\w\.]+)/i],[f,[p,C+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[p,U+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[p,U+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[p,"MIUI"+K]],[/fxios\/([\w\.-]+)/i],[f,[p,C]],[/\bqihoobrowser\/?([\w\.]*)/i],[f,[p,"360"]],[/\b(qq)\/([\w\.]+)/i],[[p,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1"+K],f],[/samsungbrowser\/([\w\.]+)/i],[f,[p,$+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[f,[p,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[p,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[p,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[p],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[f,p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,B],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[p,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[p,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[p,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[p,M+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,M+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[p,"Android "+k]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[f,ee,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[p,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],f],[/(wolvic|librewolf)\/([\w\.]+)/i],[p,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[p,C+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[p,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[p,[f,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[g,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[g,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[g,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[g,/ower/,"",J]],[/ sun4\w[;\)]/i],[[g,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[g,J]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[m,$],[h,E]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[u,[m,$],[h,y]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[m,I],[h,y]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[m,I],[h,E]],[/(macintosh);/i],[u,[m,I]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[m,W],[h,y]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[u,[m,R],[h,E]],[/honor([-\w ]+)[;\)]/i],[u,[m,R],[h,y]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[u,[m,N],[h,E]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[m,N],[h,y]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[u,/_/g," "],[m,q],[h,E]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[u,/_/g," "],[m,q],[h,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[m,j],[h,y]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[u,[m,ee,{OnePlus:["304","403","203"],"*":j}],[h,E]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[m,"Vivo"],[h,y]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[m,"Realme"],[h,y]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[m,D],[h,y]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[m,D],[h,E]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[m,S],[h,E]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[m,S],[h,y]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[u,[m,"Lenovo"],[h,E]],[/(nokia) (t[12][01])/i],[m,u,[h,E]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[u,/_/g," "],[h,y],[m,"Nokia"]],[/(pixel (c|tablet))\b/i],[u,[m,O],[h,E]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[m,O],[h,y]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[m,z],[h,y]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[m,z],[h,E]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[m,x],[h,y]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[m,A],[h,E]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[m,A],[h,y]],[/(playbook);[-\w\),; ]+(rim)/i],[u,m,[h,E]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[m,T],[h,y]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[m,P],[h,E]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[m,P],[h,y]],[/(nexus 9)/i],[u,[m,"HTC"],[h,E]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[m,[u,/_/g," "],[h,y]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[u,[m,"TCL"],[h,E]],[/(itel) ((\w+))/i],[[m,J],u,[h,ee,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[m,"Acer"],[h,E]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[m,"Meizu"],[h,y]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[m,"Ulefone"],[h,y]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[u,[m,"Energizer"],[h,y]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[u,[m,"Cat"],[h,y]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[u,[m,"Smartfren"],[h,y]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[m,"Nothing"],[h,y]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[u,[m,"Archos"],[h,E]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[u,[m,"Archos"],[h,y]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[m,u,[h,E]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[m,u,[h,y]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[m,u,[h,E]],[/(surface duo)/i],[u,[m,F],[h,E]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[m,"Fairphone"],[h,y]],[/(u304aa)/i],[u,[m,"AT&T"],[h,y]],[/\bsie-(\w*)/i],[u,[m,"Siemens"],[h,y]],[/\b(rct\w+) b/i],[u,[m,"RCA"],[h,E]],[/\b(venue[\d ]{2,7}) b/i],[u,[m,"Dell"],[h,E]],[/\b(q(?:mv|ta)\w+) b/i],[u,[m,"Verizon"],[h,E]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[m,"Barnes & Noble"],[h,E]],[/\b(tm\d{3}\w+) b/i],[u,[m,"NuVision"],[h,E]],[/\b(k88) b/i],[u,[m,"ZTE"],[h,E]],[/\b(nx\d{3}j) b/i],[u,[m,"ZTE"],[h,y]],[/\b(gen\d{3}) b.+49h/i],[u,[m,"Swiss"],[h,y]],[/\b(zur\d{3}) b/i],[u,[m,"Swiss"],[h,E]],[/\b((zeki)?tb.*\b) b/i],[u,[m,"Zeki"],[h,E]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[m,"Dragon Touch"],u,[h,E]],[/\b(ns-?\w{0,9}) b/i],[u,[m,"Insignia"],[h,E]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[m,"NextBook"],[h,E]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[m,"Voice"],u,[h,y]],[/\b(lvtel\-)?(v1[12]) b/i],[[m,"LvTel"],u,[h,y]],[/\b(ph-1) /i],[u,[m,"Essential"],[h,y]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[m,"Envizen"],[h,E]],[/\b(trio[-\w\. ]+) b/i],[u,[m,"MachSpeed"],[h,E]],[/\btu_(1491) b/i],[u,[m,"Rotor"],[h,E]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[u,[m,L],[h,E]],[/(sprint) (\w+)/i],[m,u,[h,y]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[m,F],[h,y]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[m,V],[h,E]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[m,V],[h,y]],[/smart-tv.+(samsung)/i],[m,[h,_]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[m,$],[h,_]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[m,S],[h,_]],[/(apple) ?tv/i],[m,[u,I+" TV"],[h,_]],[/crkey/i],[[u,M+"cast"],[m,O],[h,_]],[/droid.+aft(\w+)( bui|\))/i],[u,[m,A],[h,_]],[/(shield \w+ tv)/i],[u,[m,L],[h,_]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[m,W],[h,_]],[/(bravia[\w ]+)( bui|\))/i],[u,[m,z],[h,_]],[/(mi(tv|box)-?\w+) bui/i],[u,[m,q],[h,_]],[/Hbbtv.*(technisat) (.*);/i],[m,u,[h,_]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[m,Z],[u,Z],[h,_]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[u,[h,_]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,_]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[m,u,[h,w]],[/droid.+; (shield)( bui|\))/i],[u,[m,L],[h,w]],[/(playstation \w+)/i],[u,[m,z],[h,w]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[m,F],[h,w]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[u,[m,$],[h,b]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[m,u,[h,b]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[u,[m,j],[h,b]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[m,I],[h,b]],[/(opwwe\d{3})/i],[u,[m,x],[h,b]],[/(moto 360)/i],[u,[m,D],[h,b]],[/(smartwatch 3)/i],[u,[m,z],[h,b]],[/(g watch r)/i],[u,[m,S],[h,b]],[/droid.+; (wt63?0{2,3})\)/i],[u,[m,V],[h,b]],[/droid.+; (glass) \d/i],[u,[m,O],[h,b]],[/(pico) (4|neo3(?: link|pro)?)/i],[m,u,[h,b]],[/; (quest( \d| pro)?)/i],[u,[m,B],[h,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[m,[h,v]],[/(aeobc)\b/i],[u,[m,A],[h,v]],[/(homepod).+mac os/i],[u,[m,I],[h,v]],[/windows iot/i],[[h,v]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[h,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[h,E]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,E]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,y]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[u,[m,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[p,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[p,f],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,f],[/ladybird\//i],[[p,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,f],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[p,[f,ee,te]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,ee,te],[p,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,Y],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,p],[/(ubuntu) ([\w\.]+) like android/i],[[p,/(.+)/,"$1 Touch"],f],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[p,f],[/\(bb(10);/i],[f,[p,T]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[f,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[p,C+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[p,M+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,G],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,f],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,f]]},ne=function(e,t){if(typeof e===c&&(t=e,e=o),!(this instanceof ne))return new ne(e,t).getResult();var r=typeof i!==s&&i.navigator?i.navigator:o,n=e||(r&&r.userAgent?r.userAgent:""),w=r&&r.userAgentData?r.userAgentData:o,_=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(re,t):re,b=r&&r.userAgent==n;return this.getBrowser=function(){var e,t={};return t[p]=o,t[f]=o,Q.call(t,n,_.browser),t[l]=typeof(e=t[f])===d?e.replace(/[^\d\.]/g,"").split(".")[0]:o,b&&r&&r.brave&&typeof r.brave.isBrave==a&&(t[p]="Brave"),t},this.getCPU=function(){var e={};return e[g]=o,Q.call(e,n,_.cpu),e},this.getDevice=function(){var e={};return e[m]=o,e[u]=o,e[h]=o,Q.call(e,n,_.device),b&&!e[h]&&w&&w.mobile&&(e[h]=y),b&&"Macintosh"==e[u]&&r&&typeof r.standalone!==s&&r.maxTouchPoints&&r.maxTouchPoints>2&&(e[u]="iPad",e[h]=E),e},this.getEngine=function(){var e={};return e[p]=o,e[f]=o,Q.call(e,n,_.engine),e},this.getOS=function(){var e={};return e[p]=o,e[f]=o,Q.call(e,n,_.os),b&&!e[p]&&w&&w.platform&&"Unknown"!=w.platform&&(e[p]=w.platform.replace(/chrome os/i,G).replace(/macos/i,Y)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===d&&e.length>500?Z(e,500):e,this},this.setUA(n),this};ne.VERSION="1.0.41",ne.BROWSER=H([p,f,l]),ne.CPU=H([g]),ne.DEVICE=H([u,m,h,w,y,_,E,b,v]),ne.ENGINE=ne.OS=H([p,f]),typeof t!==s?(e.exports&&(t=e.exports=ne),t.UAParser=ne):r.amdO?(n=function(){return ne}.call(t,r,t,e))===o||(e.exports=n):typeof i!==s&&(i.UAParser=ne);var ie=typeof i!==s&&(i.jQuery||i.Zepto);if(ie&&!ie.ua){var oe=new ne;ie.ua=oe.getResult(),ie.ua.get=function(){return oe.getUA()},ie.ua.set=function(e){oe.setUA(e);var t=oe.getResult();for(var r in t)ie.ua[r]=t[r]}}}("object"==typeof window?window:this)},529(e){"use strict";e.exports=function(e,t){return{value:e,done:t}}},767(e){"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},117(e){"use strict";e.exports=function(e){return null==e}},859(e){"use strict";e.exports=function(e){e.iterator=e.next=e.nextHandler=e.mapper=e.predicate=e.inner=e.iterables=e.iters=e.openIters=e.padding=e.finishResults=e.buffer=null}},684(e){"use strict";e.exports=function(e,t){var r="function"==typeof Iterator&&Iterator.prototype[e];if(r)try{r.call({next:null},t).next()}catch(e){return!0}}},269(e){"use strict";e.exports=Object.create?Object.create(null):{}},741(e){"use strict";var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},717(e,t){"use strict";t.f=Object.getOwnPropertySymbols},750(e,t,r){"use strict";var n=r(117),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},291(e,t,r){"use strict";var n=r(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},14(e,t,r){"use strict";var n=r(291),i=Math.min;e.exports=function(e){var t=n(e);return t>0?i(t,9007199254740991):0}},981(e,t,r){"use strict";var n=r(750),i=Object;e.exports=function(e){return i(n(e))}},823(e){"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}}};const t={};function r(n){const i=t[n];if(void 0!==i)return i.exports;const o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n;r.amdO={},r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.cw=e=>{var t;return()=>{if(e){var r=e;e=0,t={exports:{}},r.call(t.exports,t,t.exports)}return t.exports}},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach(function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})}),[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach(function(e){e.hasOwnProperty("append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach(function(e){var r=e instanceof Node;t.appendChild(r?e:document.createTextNode(String(e)))}),this.appendChild(t)}})}),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach(function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})}),[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach(function(e){e.hasOwnProperty("append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value:function(){var e=Array.prototype.slice.call(arguments),t=document.createDocumentFragment();e.forEach(function(e){var r=e instanceof Node;t.appendChild(r?e:document.createTextNode(String(e)))}),this.appendChild(t)}})}),Math.asinh||(Math.asinh=function(e){var t=Math.abs(e);if(t<3.725290298461914e-9)return e;if(t>268435456)n=Math.log(t)+Math.LN2;else if(t>2)n=Math.log(2*t+1/(Math.sqrt(e*e+1)+t));else var r=e*e,n=Math.log1p(t+r/(1+Math.sqrt(1+r)));return e>0?n:-n}),Math.log1p=Math.log1p||function(e){if((e=Number(e))<-1||e!=e)return NaN;if(0===e||e===1/0)return e;var t=e+1-1;return 0===t?e:e*(Math.log(e+1)/t)},Math.expm1=Math.expm1||function(e){return Math.exp(e)-1},Math.cbrt||(Math.cbrt=(n=Math.pow,function(e){return e<0?-n(-e,1/3):n(e,1/3)})),Math.sinh=Math.sinh||function(e){var t=Math.exp(e);return(t-1/t)/2},Math.cosh=Math.cosh||function(e){var t=Math.exp(e);return(t+1/t)/2},Math.tanh=Math.tanh||function(e){var t=Math.exp(+e),r=Math.exp(-e);return t==1/0?1:r==1/0?-1:(t-r)/(t+r)},window.crypto=window.crypto||window.msCrypto,function(e){function t(e,t,r){throw new e("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+t+".",r)}"function"!=typeof e.requestSubmit&&(e.requestSubmit=function(e){e?(function(e,r){e instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"==e.type||t(TypeError,"The specified element is not a submit button"),e.form==r||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}(e,this),e.click()):((e=document.createElement("input")).type="submit",e.hidden=!0,this.appendChild(e),e.click(),this.removeChild(e))})}(HTMLFormElement.prototype),(()=>{"use strict";var e=r.cw(function(e,t){var n=r(606);function i(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function o(e,t){for(var r,n="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)r=e.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(o===s-1||1===a);else if(o!==s-1&&2===a){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var c=n.lastIndexOf("/");if(c!==n.length-1){-1===c?(n="",i=0):i=(n=n.slice(0,c)).length-1-n.lastIndexOf("/"),o=s,a=0;continue}}else if(2===n.length||1===n.length){n="",i=0,o=s,a=0;continue}t&&(n.length>0?n+="/..":n="..",i=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var a={resolve:function(){for(var e,t="",r=!1,a=arguments.length-1;a>=-1&&!r;a--){var s;a>=0?s=arguments[a]:(void 0===e&&(e=n.cwd()),s=e),i(s),0!==s.length&&(t=s+"/"+t,r=47===s.charCodeAt(0))}return t=o(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(i(e),0===e.length)return".";var t=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=o(e,!t)).length||t||(e="."),e.length>0&&r&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return i(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var r=arguments[t];i(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":a.normalize(e)},relative:function(e,t){if(i(e),i(t),e===t)return"";if((e=a.resolve(e))===(t=a.resolve(t)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var n=e.length,o=n-r,s=1;s<t.length&&47===t.charCodeAt(s);++s);for(var c=t.length-s,d=o<c?o:c,l=-1,u=0;u<=d;++u){if(u===d){if(c>d){if(47===t.charCodeAt(s+u))return t.slice(s+u+1);if(0===u)return t.slice(s+u)}else o>d&&(47===e.charCodeAt(r+u)?l=u:0===u&&(l=0));break}var p=e.charCodeAt(r+u);if(p!==t.charCodeAt(s+u))break;47===p&&(l=u)}var h="";for(u=r+l+1;u<=n;++u)u!==n&&47!==e.charCodeAt(u)||(0===h.length?h+="..":h+="/..");return h.length>0?h+t.slice(s+l):(s+=l,47===t.charCodeAt(s)&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(i(e),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,n=-1,o=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!o){n=a;break}}else o=!1;return-1===n?r?"/":".":r&&1===n?"//":e.slice(0,n)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');i(e);var r,n=0,o=-1,a=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var s=t.length-1,c=-1;for(r=e.length-1;r>=0;--r){var d=e.charCodeAt(r);if(47===d){if(!a){n=r+1;break}}else-1===c&&(a=!1,c=r+1),s>=0&&(d===t.charCodeAt(s)?-1===--s&&(o=r):(s=-1,o=c))}return n===o?o=c:-1===o&&(o=e.length),e.slice(n,o)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!a){n=r+1;break}}else-1===o&&(a=!1,o=r+1);return-1===o?"":e.slice(n,o)},extname:function(e){i(e);for(var t=-1,r=0,n=-1,o=!0,a=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47!==c)-1===n&&(o=!1,n=s+1),46===c?-1===t?t=s:1!==a&&(a=1):-1!==t&&(a=-1);else if(!o){r=s+1;break}}return-1===t||-1===n||0===a||1===a&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){i(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var r,n=e.charCodeAt(0),o=47===n;o?(t.root="/",r=1):r=0;for(var a=-1,s=0,c=-1,d=!0,l=e.length-1,u=0;l>=r;--l)if(47!==(n=e.charCodeAt(l)))-1===c&&(d=!1,c=l+1),46===n?-1===a?a=l:1!==u&&(u=1):-1!==a&&(u=-1);else if(!d){s=l+1;break}return-1===a||-1===c||0===u||1===u&&a===c-1&&a===s+1?-1!==c&&(t.base=t.name=0===s&&o?e.slice(1,c):e.slice(s,c)):(0===s&&o?(t.name=e.slice(1,a),t.base=e.slice(1,c)):(t.name=e.slice(s,a),t.base=e.slice(s,c)),t.ext=e.slice(a,c)),s>0?t.dir=e.slice(0,s-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};a.posix=a,e.exports=a}),t=r.cw(function(e,t){var r=K(),n=je(),i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(n(e)+" is not a function")}}),n=r.cw(function(e,t){var r=Ve(),n=pe(),i=me().f,o=r("unscopables"),a=Array.prototype;void 0===a[o]&&i(a,o,{configurable:!0,value:n(null)}),e.exports=function(e){a[o][e]=!0}}),i=r.cw(function(e,t){var r=ye(),n=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new n("Incorrect invocation")}}),o=r.cw(function(e,t){var r=J(),n=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw new i(n(e)+" is not an object")}}),a=r.cw(function(e,t){var r=Re(),n=Oe(),i=de(),o=function(e){return function(t,o,a){var s=r(t),c=i(s);if(0===c)return!e&&-1;var d,l=n(a,c);if(e&&o!=o){for(;c>l;)if((d=s[l++])!=d)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===o)return e||l||0;return!e&&-1}};e.exports={m:o(!0),q:o(!1)}}),s=r.cw(function(e,t){var r=o(),n=ne();e.exports=function(e,t,i,o){try{return o?t(r(i)[0],i[1]):t(i)}catch(t){n(e,"throw",t)}}}),c=r.cw(function(e,t){var r=N(),n=r({}.toString),i=r("".slice);e.exports=function(e){return i(n(e),8,-1)}}),d=r.cw(function(e,t){var r=xe(),n=K(),i=c(),o=Ve()("toStringTag"),a=Object,s="Arguments"===i(function(){return arguments}());e.exports=r?i:function(e){var t,r,c;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=a(e),o))?r:s?i(t):"Object"===(c=i(t))&&n(t.callee)?"Arguments":c}}),l=r.cw(function(e,t){var r=j(),n=Ae(),i=fe(),o=me();e.exports=function(e,t,a){for(var s=n(t),c=o.f,d=i.f,l=0;l<s.length;l++){var u=s[l];r(e,u)||a&&r(a,u)||c(e,u,d(t,u))}}}),u=r.cw(function(e,t){var r=P();e.exports=!r(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})}),p=r.cw(function(e,t){var r=E(),n=me(),i=h();e.exports=r?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}}),h=r.cw(function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}}),m=r.cw(function(e,t){var r=E(),n=me(),i=h();e.exports=function(e,t,o){r?n.f(e,t,i(0,o)):e[t]=o}}),f=r.cw(function(e,t){var r=le(),n=me();e.exports=function(e,t,i){return i.get&&r(i.get,t,{getter:!0}),i.set&&r(i.set,t,{setter:!0}),n.f(e,t,i)}}),g=r.cw(function(e,t){var r=K(),n=me(),i=le(),o=y();e.exports=function(e,t,a,s){s||(s={});var c=s.enumerable,d=void 0!==s.name?s.name:t;if(r(a)&&i(a,d,s),s.global)c?e[t]=a:o(t,a);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=a:n.f(e,t,{value:a,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}}),w=r.cw(function(e,t){var r=g();e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}}),y=r.cw(function(e,t){var r=U(),n=Object.defineProperty;e.exports=function(e,t){try{n(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}}),E=r.cw(function(e,t){var r=P();e.exports=!r(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}),_=r.cw(function(e,t){var r=U(),n=J(),i=r.document,o=n(i)&&n(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}}),b=r.cw(function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]}),v=r.cw(function(e,t){var r=U().navigator,n=r&&r.userAgent;e.exports=n?String(n):""}),A=r.cw(function(e,t){var r,n,i=U(),o=v(),a=i.process,s=i.Deno,c=a&&a.versions||s&&s.version,d=c&&c.v8;d&&(n=(r=d.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!n&&o&&(!(r=o.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/))&&(n=+r[1]),e.exports=n}),I=r.cw(function(e,t){var r=U(),n=fe().f,i=p(),o=g(),a=y(),s=l(),c=H();e.exports=function(e,t){var d,l,u,p,h,m=e.target,f=e.global,g=e.stat;if(d=f?r:g?r[m]||a(m,{}):r[m]&&r[m].prototype)for(l in t){if(p=t[l],u=e.dontCallGetSet?(h=n(d,l))&&h.value:d[l],!c(f?l:m+(g?".":"#")+l,e.forced)&&void 0!==u){if(typeof p==typeof u)continue;s(p,u)}(e.sham||u&&u.sham)&&i(p,"sham",!0),o(d,l,p,e)}}}),P=r.cw(function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}}),T=r.cw(function(e,t){var r=M(),n=Function.prototype,i=n.apply,o=n.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?o.bind(i):function(){return o.apply(i,arguments)})}),k=r.cw(function(e,r){var n=R(),i=t(),o=M(),a=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}}),M=r.cw(function(e,t){var r=P();e.exports=!r(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})}),C=r.cw(function(e,t){var r=M(),n=Function.prototype.call;e.exports=r?n.bind(n):function(){return n.apply(n,arguments)}}),O=r.cw(function(e,t){var r=E(),n=j(),i=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,a=n(i,"name")&&(!r||r&&o(i,"name").configurable);e.exports={i2:a}}),R=r.cw(function(e,t){var r=c(),n=N();e.exports=function(e){if("Function"===r(e))return n(e)}}),N=r.cw(function(e,t){var r=M(),n=Function.prototype,i=n.call,o=r&&n.bind.bind(i,i);e.exports=r?o:function(e){return function(){return i.apply(e,arguments)}}}),S=r.cw(function(e,t){var r=U(),n=K();e.exports=function(e,t){return arguments.length<2?(i=r[e],n(i)?i:void 0):r[e]&&r[e][t];var i}}),F=()=>r(767),D=r.cw(function(e,t){var r=C(),n=K(),i=o(),a=je(),s=L(),c=TypeError;e.exports=function(e,t){var o=arguments.length<2?s(e):t;if(n(o))return i(r(o,e));throw new c(a(e)+" is not iterable")}}),L=r.cw(function(e,t){var r=c(),n=X(),i=x(),o=Ve()("iterator"),a=Array.prototype;e.exports=function(e){if(!n(e))return i(e,o)||i(e,"@@iterator")||("Arguments"===r(e)?a[o]:void 0)}}),x=r.cw(function(e,r){var n=t(),i=X();e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}}),U=r.cw(function(e,t){var n=function(e){return e&&e.Math===Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()}),j=r.cw(function(e,t){var r=N(),n=Fe(),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(n(e),t)}}),$=r.cw(function(e,t){e.exports={}}),W=r.cw(function(e,t){var r=S();e.exports=r("document","documentElement")}),z=r.cw(function(e,t){var r=E(),n=P(),i=_();e.exports=!r&&!n(function(){return 7!==Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a})}),q=r.cw(function(e,t){var r=N(),n=P(),i=c(),o=Object,a=r("".split);e.exports=n(function(){return!o("z").propertyIsEnumerable(0)})?function(e){return"String"===i(e)?a(e,""):o(e)}:o}),V=r.cw(function(e,t){var r=N(),n=K(),i=Te(),o=r(Function.toString);n(i.inspectSource)||(i.inspectSource=function(e){return o(e)}),e.exports=i.inspectSource}),B=r.cw(function(e,t){var r,n,i,o=qe(),a=U(),s=J(),c=p(),d=j(),l=Te(),u=Pe(),h=$(),m="Object already initialized",f=a.TypeError,g=a.WeakMap;if(o||l.state){var w=l.state||(l.state=new g);w.get=w.get,w.has=w.has,w.set=w.set,r=function(e,t){if(w.has(e))throw new f(m);return t.facade=e,w.set(e,t),t},n=function(e){return w.get(e)||{}},i=function(e){return w.has(e)}}else{var y=u("state");h[y]=!0,r=function(e,t){if(d(e,y))throw new f(m);return t.facade=e,c(e,y,t),t},n=function(e){return d(e,y)?e[y]:{}},i=function(e){return d(e,y)}}e.exports={set:r,get:n,has:i,enforce:function(e){return i(e)?n(e):r(e,{})},getterFor:function(e){return function(t){var r;if(!s(t)||(r=n(t)).type!==e)throw new f("Incompatible receiver, "+e+" required");return r}}}}),G=r.cw(function(e,t){var r=Ve(),n=ce(),i=r("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||o[i]===e)}}),Y=r.cw(function(e,t){var r=c();e.exports=Array.isArray||function(e){return"Array"===r(e)}}),K=r.cw(function(e,t){var r="object"==typeof document&&document.all;e.exports=void 0===r&&void 0!==r?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}}),H=r.cw(function(e,t){var r=P(),n=K(),i=/#|\.prototype\./,o=function(e,t){var i=s[a(e)];return i===d||i!==c&&(n(t)?r(t):!!t)},a=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},s=o.data={},c=o.NATIVE="N",d=o.POLYFILL="P";e.exports=o}),X=()=>r(117),J=r.cw(function(e,t){var r=K();e.exports=function(e){return"object"==typeof e?null!==e:r(e)}}),Z=r.cw(function(e,t){e.exports=!1}),Q=r.cw(function(e,t){var r=J(),n=B().get;e.exports=function(e){if(!r(e))return!1;var t=n(e);return!!t&&"RawJSON"===t.type}}),ee=r.cw(function(e,t){var r=S(),n=K(),i=ye(),o=We(),a=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return n(t)&&i(t.prototype,a(e))}}),te=r.cw(function(e,t){var r=k(),n=C(),i=o(),a=je(),s=G(),c=de(),d=ye(),l=D(),u=L(),p=ne(),h=TypeError,m=function(e,t){this.stopped=e,this.result=t},f=m.prototype;e.exports=function(e,t,o){var g,w,y,E,_,b,v,A=o&&o.that,I=!(!o||!o.AS_ENTRIES),P=!(!o||!o.IS_RECORD),T=!(!o||!o.IS_ITERATOR),k=!(!o||!o.INTERRUPTED),M=r(t,A),C=function(e){var t=g;return g=void 0,t&&p(t,"normal"),new m(!0,e)},O=function(e){return I?(i(e),k?M(e[0],e[1],C):M(e[0],e[1])):k?M(e,C):M(e)};if(P)g=e.iterator;else if(T)g=e;else{if(!(w=u(e)))throw new h(a(e)+" is not iterable");if(s(w)){for(y=0,E=c(e);E>y;y++)if((_=O(e[y]))&&d(f,_))return _;return new m(!1)}g=l(e,w)}for(b=P?e.next:g.next;!(v=n(b,g)).done;){var R=v.value;try{_=O(R)}catch(e){if(!g)throw e;p(g,"throw",e)}if("object"==typeof _&&_&&d(f,_))return _}return new m(!1)}}),re=r.cw(function(e,t){var r=ne();e.exports=function(e,t,n){for(var i=e.length-1;i>=0;i--)if(void 0!==e[i])try{n=r(e[i].iterator,t,n)}catch(e){t="throw",n=e}if("throw"===t)throw n;return n}}),ne=r.cw(function(e,t){var r=C(),n=o(),i=x();e.exports=function(e,t,o){var a,s;n(e);try{if(!(a=i(e,"return"))){if("throw"===t)throw o;return o}a=r(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw o;if(s)throw a;return n(a),o}}),ie=r.cw(function(e,t){var n=C(),i=pe(),o=p(),a=w(),s=Ve(),c=B(),d=x(),l=se().H,u=r(529),h=ne(),m=re(),f=r(859),g=s("toStringTag"),y="IteratorHelper",E="WrapForValidIterator",_="normal",b="throw",v=c.set,A=function(e){var t=c.getterFor(e?E:y);return a(i(l),{next:function(){var r=t(this);if(e)return r.nextHandler();if(r.done)return u(void 0,!0);try{var n=r.nextHandler();return r.done&&f(r),r.returnHandlerResult?n:u(n,r.done)}catch(e){throw r.done=!0,f(r),e}},return:function(){var r=t(this),i=r.iterator,o=r.inner,a=r.openIters,s=r.done;if(r.done=!0,e){var c=d(i,"return");return c?n(c,i):u(void 0,!0)}if(f(r),s)return u(void 0,!0);if(o)try{h(o.iterator,_)}catch(e){return h(i,b,e)}if(a)try{m(a,_)}catch(e){if(i)return h(i,b,e);throw e}return i&&h(i,_),u(void 0,!0)}})},I=A(!0),P=A(!1);o(P,g,"Iterator Helper"),e.exports=function(e,t,r){var n=function(n,i){i?(i.iterator=n.iterator,i.next=n.next):i=n,i.type=t?E:y,i.returnHandlerResult=!!r,i.nextHandler=e,i.counter=0,i.done=!1,v(this,i)};return n.prototype=t?I:P,n}}),oe=()=>r(684),ae=r.cw(function(e,t){var r=U();e.exports=function(e,t){var n=r.Iterator,i=n&&n.prototype,o=i&&i[e],a=!1;if(o)try{o.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(e){e instanceof t||(a=!1)}if(!a)return o}}),se=r.cw(function(e,t){var r,n,i,o=P(),a=K(),s=J(),c=pe(),d=we(),l=g(),u=Ve(),p=Z(),h=u("iterator");[].keys&&"next"in(i=[].keys())&&(n=d(d(i)))!==Object.prototype&&(r=n),!s(r)||o(function(){var e={};return r[h].call(e)!==e})?r={}:p&&(r=c(r)),a(r[h])||l(r,h,function(){return this}),e.exports={H:r}}),ce=()=>r(269),de=r.cw(function(e,t){var r=Se();e.exports=function(e){return r(e.length)}}),le=r.cw(function(e,t){var r=N(),n=P(),i=K(),o=j(),a=E(),s=O().i2,c=V(),d=B(),l=d.enforce,u=d.get,p=String,h=Object.defineProperty,m=r("".slice),f=r("".replace),g=r([].join),w=a&&!n(function(){return 8!==h(function(){},"length",{value:8}).length}),y=String(String).split("String"),_=e.exports=function(e,t,r){"Symbol("===m(p(t),0,7)&&(t="["+f(p(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!o(e,"name")||s&&e.name!==t)&&(a?h(e,"name",{value:t,configurable:!0}):e.name=t),w&&r&&o(r,"arity")&&e.length!==r.arity&&h(e,"length",{value:r.arity});try{r&&o(r,"constructor")&&r.constructor?a&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=l(e);return o(n,"source")||(n.source=g(y,"string"==typeof t?t:"")),e};Function.prototype.toString=_(function(){return i(this)&&u(this).source||c(this)},"toString")}),ue=r.cw(function(e,t){var r=P();e.exports=!r(function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})}),pe=r.cw(function(e,t){var r,n=o(),i=he(),a=b(),s=$(),c=W(),d=_(),l=Pe(),u="prototype",p="script",h=l("IE_PROTO"),m=function(){},f=function(e){return"<"+p+">"+e+"</"+p+">"},g=function(e){e.write(f("")),e.close();var t=e.parentWindow.Object;return e=null,t},w=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;w="undefined"!=typeof document?document.domain&&r?g(r):(t=d("iframe"),n="java"+p+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(f("document.F=Object")),e.close(),e.F):g(r);for(var i=a.length;i--;)delete w[u][a[i]];return w()};s[h]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(m[u]=n(e),r=new m,m[u]=null,r[h]=e):r=w(),void 0===t?r:i.f(r,t)}}),he=r.cw(function(e,t){var r=E(),n=ze(),i=me(),a=o(),s=Re(),c=_e();t.f=r&&!n?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),o=c(t),d=o.length,l=0;d>l;)i.f(e,r=o[l++],n[r]);return e}}),me=r.cw(function(e,t){var r=E(),n=z(),i=ze(),a=o(),s=Le(),c=TypeError,d=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u="enumerable",p="configurable",h="writable";t.f=r?i?function(e,t,r){if(a(e),t=s(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&h in r&&!r[h]){var n=l(e,t);n&&n[h]&&(e[t]=r.value,r={configurable:p in r?r[p]:n[p],enumerable:u in r?r[u]:n[u],writable:!1})}return d(e,t,r)}:d:function(e,t,r){if(a(e),t=s(t),a(r),n)try{return d(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new c("Accessors not supported");return"value"in r&&(e[t]=r.value),e}}),fe=r.cw(function(e,t){var r=E(),n=C(),i=be(),o=h(),a=Re(),s=Le(),c=j(),d=z(),l=Object.getOwnPropertyDescriptor;t.f=r?l:function(e,t){if(e=a(e),t=s(t),d)try{return l(e,t)}catch(e){}if(c(e,t))return o(!n(i.f,e,t),e[t])}}),ge=r.cw(function(e,t){var r=Ee(),n=b().concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,n)}}),we=r.cw(function(e,t){var r=j(),n=K(),i=Fe(),o=Pe(),a=u(),s=o("IE_PROTO"),c=Object,d=c.prototype;e.exports=a?c.getPrototypeOf:function(e){var t=i(e);if(r(t,s))return t[s];var o=t.constructor;return n(o)&&t instanceof o?o.prototype:t instanceof c?d:null}}),ye=r.cw(function(e,t){var r=N();e.exports=r({}.isPrototypeOf)}),Ee=r.cw(function(e,t){var r=N(),n=j(),i=Re(),o=a().q,s=$(),c=r([].push);e.exports=function(e,t){var r,a=i(e),d=0,l=[];for(r in a)!n(s,r)&&n(a,r)&&c(l,r);for(;t.length>d;)n(a,r=t[d++])&&(~o(l,r)||c(l,r));return l}}),_e=r.cw(function(e,t){var r=Ee(),n=b();e.exports=Object.keys||function(e){return r(e,n)}}),be=r.cw(function(e,t){var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r}),ve=r.cw(function(e,t){var r=C(),n=K(),i=J(),o=TypeError;e.exports=function(e,t){var a,s;if("string"===t&&n(a=e.toString)&&!i(s=r(a,e)))return s;if(n(a=e.valueOf)&&!i(s=r(a,e)))return s;if("string"!==t&&n(a=e.toString)&&!i(s=r(a,e)))return s;throw new o("Can't convert object to primitive value")}}),Ae=r.cw(function(e,t){var n=S(),i=N(),a=ge(),s=r(717),c=o(),d=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=a.f(c(e)),r=s.f;return r?d(t,r(e)):t}}),Ie=r.cw(function(e,t){var r=N(),n=j(),i=SyntaxError,o=parseInt,a=String.fromCharCode,s=r("".charAt),c=r("".slice),d=r(/./.exec),l={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},u=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;e.exports=function(e,t){for(var r=!0,h="";t<e.length;){var m=s(e,t);if("\\"===m){var f=c(e,t,t+2);if(n(l,f))h+=l[f],t+=2;else{if("\\u"!==f)throw new i('Unknown escape sequence: "'+f+'"');var g=c(e,t+=2,t+4);if(!d(u,g))throw new i("Bad Unicode escape at: "+t);h+=a(o(g,16)),t+=4}}else{if('"'===m){r=!1,t++;break}if(d(p,m))throw new i("Bad control character in string literal at: "+t);h+=m,t++}}if(r)throw new i("Unterminated string at: "+t);return{value:h,end:t}}}),Pe=r.cw(function(e,t){var r=ke(),n=$e(),i=r("keys");e.exports=function(e){return i[e]||(i[e]=n(e))}}),Te=r.cw(function(e,t){var r=Z(),n=U(),i=y(),o="__core-js_shared__",a=e.exports=n[o]||i(o,{});(a.versions||(a.versions=[])).push({version:"3.50.0",mode:r?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"})}),ke=r.cw(function(e,t){var r=Te(),n=Object.create||Object;e.exports=function(e,t){return r[e]||(r[e]=t||n(null))}}),Me=r.cw(function(e,t){var r=A(),n=P(),i=U().String;e.exports=!!Object.getOwnPropertySymbols&&!n(function(){var e=Symbol("symbol detection");return!i(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41})}),Ce=r.cw(function(e,t){var r=N();e.exports=r(1.1.valueOf)}),Oe=r.cw(function(e,t){var r=Ne(),n=Math.max,i=Math.min;e.exports=function(e,t){var o=r(e);return o<0?n(o+t,0):i(o,t)}}),Re=r.cw(function(e,t){var n=q(),i=r(750);e.exports=function(e){return n(i(e))}}),Ne=()=>r(291),Se=()=>r(14),Fe=()=>r(981),De=r.cw(function(e,t){var r=C(),n=J(),i=ee(),o=x(),a=ve(),s=Ve(),c=TypeError,d=s("toPrimitive");e.exports=function(e,t){if(!n(e)||i(e))return e;var s,l=o(e,d);if(l){if(void 0===t&&(t="default"),s=r(l,e,t),!n(s)||i(s))return s;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}}),Le=r.cw(function(e,t){var r=De(),n=ee();e.exports=function(e){var t=r(e,"string");return n(t)?t:t+""}}),xe=r.cw(function(e,t){var r={};r[Ve()("toStringTag")]="z",e.exports="[object z]"===String(r)}),Ue=r.cw(function(e,t){var r=d(),n=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return n(e)}}),je=()=>r(823),$e=r.cw(function(e,t){var r=N(),n=0,i=Math.random(),o=r(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++n+i,36)}}),We=r.cw(function(e,t){var r=Me();e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}),ze=r.cw(function(e,t){var r=E(),n=P();e.exports=r&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}),qe=r.cw(function(e,t){var r=U(),n=K(),i=r.WeakMap;e.exports=n(i)&&/native code/.test(String(i))}),Ve=r.cw(function(e,t){var r=U(),n=ke(),i=j(),o=$e(),a=Me(),s=We(),c=r.Symbol,d=n("wks"),l=s?c.for||c:c&&c.withoutSetter||o;e.exports=function(e){return i(d,e)||(d[e]=a&&i(c,e)?c[e]:l("Symbol."+e)),d[e]}}),Be=r.cw(function(e,t){var r=I(),i=a().m,o=P(),s=n(),c=o(function(){return!Array(1).includes()}),d=o(function(){return[,1].includes(void 0,1)});r({target:"Array",proto:!0,forced:c||d},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),s("includes")}),Ge=r.cw(function(e,t){var r=I(),n=U(),a=i(),s=o(),c=K(),d=we(),l=f(),u=m(),p=P(),h=j(),g=Ve(),w=se().H,y=E(),_=Z(),b="constructor",v="Iterator",A=g("toStringTag"),T=TypeError,k=n[v],M=_||!c(k)||k.prototype!==w||!p(function(){k({})}),C=function(){if(a(this,w),d(this)===w)throw new T("Abstract class Iterator not directly constructable")},O=function(e,t){y?l(w,e,{configurable:!0,get:function(){return t},set:function(t){if(s(this),this===w)throw new T("You can't redefine this property");h(this,e)?this[e]=t:u(this,e,t)}}):w[e]=t};h(w,A)||O(A,v),!M&&h(w,b)&&w[b]!==Object||O(b,C),C.prototype=w,r({global:!0,constructor:!0,forced:M},{Iterator:C})}),Ye=r.cw(function(e,r){var n=I(),i=C(),a=te(),s=t(),c=o(),d=F(),l=ne(),u=ae()("every",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(e){c(this);try{s(e)}catch(e){l(this,"throw",e)}if(u)return i(u,this,e);var t=d(this),r=0;return!a(t,function(t,n){if(!e(t,r++))return n()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),Ke=r.cw(function(e,r){var n=I(),i=C(),a=t(),c=o(),d=F(),l=ie(),u=s(),p=Z(),h=ne(),m=oe(),f=ae(),g=!p&&!m("filter",function(){}),w=!p&&!g&&f("filter",TypeError),y=p||g||w,E=l(function(){for(var e,t,r=this.iterator,n=this.predicate,o=this.next;;){if(e=c(i(o,r)),this.done=!!e.done)return;if(t=e.value,u(r,n,[t,this.counter++],!0))return t}});n({target:"Iterator",proto:!0,real:!0,forced:y},{filter:function(e){c(this);try{a(e)}catch(e){h(this,"throw",e)}return w?i(w,this,e):new E(d(this),{predicate:e})}})}),He=r.cw(function(e,r){var n=I(),i=C(),a=te(),s=t(),c=o(),d=F(),l=ne(),u=ae()("find",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(e){c(this);try{s(e)}catch(e){l(this,"throw",e)}if(u)return i(u,this,e);var t=d(this),r=0;return a(t,function(t,n){if(e(t,r++))return n(t)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})}),Xe=r.cw(function(e,r){var n=I(),i=C(),a=te(),s=t(),c=o(),d=F(),l=ne(),u=ae()("forEach",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(e){c(this);try{s(e)}catch(e){l(this,"throw",e)}if(u)return i(u,this,e);var t=d(this),r=0;a(t,function(t){e(t,r++)},{IS_RECORD:!0})}})}),Je=r.cw(function(e,r){var n=I(),i=C(),a=t(),c=o(),d=F(),l=ie(),u=s(),p=ne(),h=oe(),m=ae(),f=Z(),g=!f&&!h("map",function(){}),w=!f&&!g&&m("map",TypeError),y=f||g||w,E=l(function(){var e=this.iterator,t=c(i(this.next,e));if(!(this.done=!!t.done))return u(e,this.mapper,[t.value,this.counter++],!0)});n({target:"Iterator",proto:!0,real:!0,forced:y},{map:function(e){c(this);try{a(e)}catch(e){p(this,"throw",e)}return w?i(w,this,e):new E(d(this),{mapper:e})}})}),Ze=r.cw(function(e,r){var n=I(),i=te(),a=t(),s=o(),c=F(),d=ne(),l=ae(),u=T(),p=P(),h=TypeError,m=p(function(){[].keys().reduce(function(){},void 0)}),f=!m&&l("reduce",h);n({target:"Iterator",proto:!0,real:!0,forced:m||f},{reduce:function(e){s(this);try{a(e)}catch(e){d(this,"throw",e)}var t=arguments.length<2,r=t?void 0:arguments[1];if(f)return u(f,this,t?[e]:[e,r]);var n=c(this),o=0;if(i(n,function(n){t?(t=!1,r=n):r=e(r,n,o),o++},{IS_RECORD:!0}),t)throw new h("Reduce of empty iterator with no initial value");return r}})}),Qe=r.cw(function(e,r){var n=I(),i=C(),a=te(),s=t(),c=o(),d=F(),l=ne(),u=ae()("some",TypeError);n({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(e){c(this);try{s(e)}catch(e){l(this,"throw",e)}if(u)return i(u,this,e);var t=d(this),r=0;return a(t,function(t,n){if(e(t,r++))return n()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),et=r.cw(function(e,t){var r=I(),n=S(),i=C(),o=N(),s=P(),d=Y(),l=K(),u=J(),p=pe(),h=Q(),m=ee(),f=c(),g=Ce(),w=a().m,y=j(),E=Ue(),_=Ie(),b=$e(),v=Me(),A=ue(),T=String,k=TypeError,M=n("JSON","stringify"),O=n("BigInt"),R=o("".valueOf),F=o((!0).valueOf),D=O&&o(O.prototype.valueOf),L=o(/./.exec),x=o("".charAt),U=o("".charCodeAt),$=o("".replace),W=o("".slice),z=o([].push),q=o([].pop),V=o(1.1.toString),B=/[\uD800-\uDFFF]/g,G=/^[\uD800-\uDBFF]$/,H=/^[\uDC00-\uDFFF]$/,X=/^\d+$/,Z=b(),te=b(),re=b(),ne=Z.length,ie=te.length,oe=!v||s(function(){var e=n("Symbol")("stringify detection");return"[null]"!==M([e])||"{}"!==M({a:e})||"{}"!==M(Object(e))}),ae=s(function(){return'"\\udf06\\ud834"'!==M("\udf06\ud834")||'"\\udead"'!==M("\udead")}),se=A?n("JSON","isRawJSON"):h,ce=oe?function(e,t,r){return M(e,function(e,r){var n=i(t,this,e,r);if(!m(n))return n},r)}:M,de=function(e,t,r){var n=x(r,t-1),i=x(r,t+1);return L(G,e)&&!L(H,i)||L(H,e)&&!L(G,n)?"\\u"+V(U(e,0),16):e},le=function(e,t){try{return e(t),!0}catch(e){return!1}},he=function(e,t){return{toJSON:function(){var r=e[t];if(u(r)||"bigint"==typeof r){var n=r.toJSON;l(n)&&(r=i(n,r,t))}return r}}};M&&r({target:"JSON",stat:!0,arity:3,forced:oe||ae||!A},{stringify:function(e,t,r){var n,o=l(t)?t:void 0,a=o?void 0:function(e){if(d(e)){for(var t=e.length,r=[],n=p(null),i=0;i<t;i++){var o,a=e[i];if("string"==typeof a)o=a;else{if("number"!=typeof a&&"Number"!==f(a)&&"String"!==f(a))continue;o=E(a)}y(n,o)||(n[o]=!0,z(r,o))}return r}}(t),s=a&&function(e){for(var t=0,r=e.length;t<r;t++)if(L(X,e[t]))return te;return""}(a),c=[],h=[],m=[],b=!1,v=!0,I=ce(e,function(e,t){if(e=T(e),a){if(e===re)return q(h),void(n=q(m));if(v)v=!1;else if(this!==n&&!d(this)&&!w(a,e))return}else o&&(t=i(o,this,e,t));if(se(t))return A?t:(b=!0,Z+(z(c,t.rawJSON)-1));if(a&&function(e){if(!u(e)||l(e)||d(e))return!1;try{return!function(e){var t=f(e);return"Number"===t&&le(g,e)||"String"===t&&le(R,e)||"Boolean"===t&&le(F,e)||!!D&&"BigInt"===t&&le(D,e)}(e)}catch(e){return!0}}(t)){if(w(h,t))throw new k("Converting circular structure to JSON");var r=function(e,t,r){for(var n=p(null),i=0,o=t.length;i<o;i++){var a=t[i];n[r+a]=he(e,a)}return n[re]=null,n}(t,a,s);return z(h,t),z(m,n),n=r,s&&(b=!0),r}return t},r);if("string"!=typeof I)return I;if(ae&&(I=$(I,B,de)),!b)return I;for(var P="",M=I.length,C=0;C<M;C++){var O=x(I,C);if('"'===O){var N=_(I,++C).end-1,S=W(I,C,N);W(S,0,ne)===Z?P+=c[W(S,ne)]:W(S,0,ie)===te?P+='"'+W(S,ie)+'"':P+='"'+S+'"',C=N}else P+=O}return P}})}),tt=r.cw(function(e,t){Ge()}),rt=r.cw(function(e,t){Ye()}),nt=r.cw(function(e,t){Ke()}),it=r.cw(function(e,t){He()}),ot=r.cw(function(e,t){Xe()}),at=r.cw(function(e,t){Je()}),st=r.cw(function(e,t){Ze()}),ct=r.cw(function(e,t){Qe()});function dt(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}tt(),ot(),e(),function t(){return t.c||(t.c=r.n(e()))}()().resolve("/","..","dist");let lt=function(e){return e[e["es-AR"]=0]="es-AR",e[e["es-CL"]=1]="es-CL",e[e["es-CO"]=2]="es-CO",e[e["es-MX"]=3]="es-MX",e[e["es-VE"]=4]="es-VE",e[e["es-UY"]=5]="es-UY",e[e["es-PE"]=6]="es-PE",e[e["pt-BR"]=7]="pt-BR",e[e["en-US"]=8]="en-US",e}({}),ut=function(e){return e.PRODUCT_ID_MOBILE="BTR2NNPO1F60OR8RLSH0",e.PRODUCT_ID_DESKTOP="BTR2N61O1F60OR8RLSGG",e.PRODUCT_ID_GENERIC_BRICK_MOBILE="CHQBURHMDARLP9CT19E0",e.PRODUCT_ID_GENERIC_BRICK_DESKTOP="CHQBUNESFQCVF58JFECG",e.PRODUCT_ID_CARD_PAYMENT_BRICK_MOBILE="C85Q3OGS4G718CFJS270",e.PRODUCT_ID_CARD_PAYMENT_BRICK_DESKTOP="C85Q6TGS4G718CFJS27G",e}({});const pt=["gateway","aggregator"],ht="aggregator";class mt{static setPublicKey(e){this._publicKey=e}static setInstanceId(e){this._instanceId=e}static setLocale(e){this._locale=e}static setSiteId(e){this._siteId=e}static setDeviceProfile(e){this._deviceProfile=e}static setTrackingDisabled(e){this._trackingDisabled=e}static setIframeEnabled(e){this._iframeEnabled=e}static setFrontendStack(e){this._frontendStack=e||"JS"}static setProductId(e){this._product_id=e}static getPublicKey(){return this._publicKey}static getInstanceId(){return this._instanceId}static getSiteId(){return this._siteId}static getLocale(){return this._locale}static getDeviceProfile(){return this._deviceProfile}static getTrackingDisabled(){return this._trackingDisabled}static getIframeEnabled(){return this._iframeEnabled}static getFrontendStack(){return this._frontendStack}static getProductId(){return this._product_id}}dt(mt,"_publicKey",void 0),dt(mt,"_instanceId",void 0),dt(mt,"_siteId",void 0),dt(mt,"_locale",void 0),dt(mt,"_product_id",void 0),dt(mt,"_deviceProfile",void 0),dt(mt,"_trackingDisabled",void 0),dt(mt,"_iframeEnabled",void 0),dt(mt,"_frontendStack","JS"),Be(),nt(),it(),et();const ft=async e=>{try{const t=await It.fetch("/devices/widgets",{method:"POST",body:JSON.stringify({section:"open_platform_V2",view:"checkout"})}),r=await t.json(),n=document.createElement("script");return e&&(n.nonce=e),n.appendChild(document.createTextNode(r.widget.replace(/<script\b[^<]*">/gi,"").replace(/<\/script>[\s\S]*/gi,""))),document.head.appendChild(n),Promise.resolve(r.session_id)}catch(e){return Promise.reject(e)}};function gt(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],a=[],s={},c=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:c,headers:{keys:function(){return o},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var d in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r}),r(c())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(d,t.headers[d]);i.send(t.body||null)})}r.dn(ft),r.dn(gt);const{protocol:wt,hostname:yt,port:Et}=window.location,_t=`${wt}//${yt}${Et&&":"+Et}`,bt=e=>Object.assign({method:"GET",timeout:2e3,retry:3,defaultQueries:!0},e),vt=async({fetchURL:e,restClientOptions:t})=>{const{retry:r,timeout:n,rejectWithError:i}=t;let o,a=0;do{const r=2**a*n;a++;try{const n=await At({fetchURL:e,restClientOptions:t,timeout:r}),{status:i,ok:o,headers:a,statusText:s}=n;if(!o){const e=Boolean(a.get("content-type")?.includes("json")),{get:t}=a;if(e){const e={...await n.json(),status:i,ok:o,getHeader:t};return Promise.reject(e)}return Promise.reject({message:s,status:i,ok:o,getHeader:t})}return Promise.resolve(n)}catch(e){if(o=e,e instanceof Error&&"Request timed out"!==e.message||a<=0)return Promise.reject(e)}}while(a<r);return i?Promise.reject(o??new Error("restClient: retries exhausted but no underlying error was captured (internal invariant violated)")):Promise.reject()},At=({fetchURL:e,restClientOptions:t,timeout:r})=>{let n;const i=new Promise((r,i)=>gt(e,t).then(r).catch(i).finally(()=>clearTimeout(n))),o=new Promise((e,t)=>n=setTimeout(()=>t(new Error("Request timed out")),r));return Promise.race([i,o])};class It{static async fetch(e,t){const r=bt(t),n=(({endpoint:e,restClientOptions:t})=>{const r=new URL((t.baseURL||"https://api.mercadopago.com/v1")+e);return(({URLObject:e,restClientOptions:t})=>{t?.defaultQueries&&(e=>{e.searchParams.append("public_key",mt.getPublicKey()),e.searchParams.append("locale",mt.getLocale()),e.searchParams.append("js_version","2.83.6"),e.searchParams.append("referer",_t)})(e),(({URLObject:e,restClientOptions:t})=>{const r=t?.query;r&&(Object.entries(r).forEach(([t,r])=>e.searchParams.append(t,r)),delete t?.query)})({URLObject:e,restClientOptions:t})})({URLObject:r,restClientOptions:t}),r.href})({endpoint:e,restClientOptions:r});return vt({fetchURL:n,restClientOptions:r})}static async fetchPage(e,t){const r=bt(t),n=new URL(e).href;return vt({fetchURL:n,restClientOptions:r})}}let Pt={};class Tt{static createContext(e,t={}){if(Pt[e]){const t=`Context '${e}' already exists`;throw gs.sendFrontendMetricsError({name:ps.CONTEXT_ALREADY_EXISTS,product:"core",critical:!1,details:`Context.createContext: ${t}`}),new Error(t)}return Pt[e]=new Map(Object.entries(t)),Pt[e]}static getContext(e){return Pt[e]}static deleteContext(e){delete Pt[e]}static destroyContexts(){Pt={}}}let kt=0,Mt=null;const Ct=new Set;class Ot{static registerInstantiation(e,t){kt>0&&gs.sendFrontendMetricsError({name:ps.CONCURRENT_SDK_INSTANTIATION_DETECTED,product:"core",critical:!1,details:`SdkInstanceCounter.registerInstantiation: previous_instance_id=${Mt} | new_instance_id=${e} | public_key=${t}`}),kt+=1,Mt=e,Ct.add(t)}static hasSinglePublicKey(){return 1===Ct.size}static reset(){kt=0,Mt=null,Ct.clear()}}ct();const Rt=async()=>{const e=await It.fetch("/identification_types");return await e.json()};r.dn(Rt);const Nt=async e=>{const t=await It.fetch("/payment_methods/installments",{method:"GET",query:{...e}});return await t.json()};r.dn(Nt);const St=async e=>{const t=await It.fetch("/payment_methods/search",{method:"GET",query:{marketplace:"NONE",status:"active",...e,product_id:e.product_id||mt.getProductId()}});return await t.json()};r.dn(St),st();const Ft=e=>"object"==typeof e&&null!==e,Dt=e=>"string"==typeof e&&e.length>0;function Lt(e){if(!Ft(e)||!Array.isArray(e.data))return e;const t=e.data,r={no_consent:0,invalid_base_fields:0,duplicate_token:0},n=(e=>{const t=new Map;return e.forEach(e=>{Ft(e)&&"string"==typeof e.token&&t.set(e.token,(t.get(e.token)??0)+1)}),t})(t),i=t.reduce((e,t)=>{if(!Ft(i=t)||"smart_transfer"!==i.type)return e.push(t),e;var i;const o=(e=>{const t=e.financial_account;if(!Ft(t))return;const r=t.external_account_id;return"string"==typeof r&&r.length>0?r:void 0})(t);if(void 0===o)return r.no_consent+=1,e;if(!(e=>Dt(e.id)&&Dt(e.name)&&Dt(e.token)&&(null==e.thumbnail||"string"==typeof e.thumbnail))(t))return r.invalid_base_fields+=1,e;if((n.get(t.token)??0)>1)return r.duplicate_token+=1,e;const a={...t};return delete a.financial_account,null===a.thumbnail&&delete a.thumbnail,e.push({...a,type:"smart_transfer",open_finance_account_id:o}),e},[]);return r.no_consent+r.invalid_base_fields+r.duplicate_token>0&&gs.sendFrontendMetricsError({name:ps.SMART_TRANSFER_DISCARDED,product:"core",critical:!1,details:`normalizeAccountDataPaymentMethodsResponse: no_consent=${r.no_consent} | invalid_base_fields=${r.invalid_base_fields} | duplicate_token=${r.duplicate_token}`}),{...e,data:i}}const xt=async(e,t)=>{const r=await It.fetch("/account-payment-methods",{method:"GET",query:{...e},headers:{...t,...!["prod","lts"].includes("prod")&&{"X-scope":"omega"}}});return Lt(await r.json())};r.dn(xt),rt();const Ut=/^[a-z0-9_]+$/,jt=/^[0-9A-Za-z_-]{1,64}$/,$t={creditCard:"credit_card",debitCard:"debit_card",prepaidCard:"prepaid_card",bankTransfer:"bank_transfer"},Wt={minInstallments:"min_installments",maxInstallments:"max_installments"},zt=e=>{if(Array.isArray(e)&&0!==e.length&&!(e.length>50))return e.every(e=>"string"==typeof e&&jt.test(e))?e.join(","):void 0},qt=e=>"number"==typeof e&&Number.isInteger(e)&&e>=0,Vt=(e={})=>{const t={flow:"payment_brick"};Object.keys($t).forEach(r=>{const n=(e=>{const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e&&Ut.test(e));return t.length>0?t.join(","):void 0})(e?.[r]);void 0!==n&&(t[$t[r]]=n)}),Object.keys(Wt).forEach(r=>{const n=(e=>{let t;return"string"==typeof e?t=e:"number"==typeof e?t=String(e):Array.isArray(e)&&(t=e.join(",")),t||void 0})(e?.[r]);void 0!==n&&(t[Wt[r]]=n)});const r=zt(e?.savedCardsIds);return void 0!==r&&(t.cards_ids=r),t},Bt=async(e,t)=>{const r=await It.fetch("/op-pay/fp/v1/account-payment-methods",{baseURL:"https://api.mercadopago.com",method:"GET",query:Vt(e),headers:t}),n=await r.json(),i=Lt(n),o=n?.replaced_saved_cards;if(void 0===o||"object"!=typeof i||null===i)return i;const a={...i};delete a.replaced_saved_cards;const s=n.data,c=zt(e?.savedCardsIds)?.split(",").length??0,d=Array.isArray(s)?((e,t,r,n)=>{if(Array.isArray(e))return e.reduce((e,i)=>{if("object"!=typeof i||null===i)return e;const{cards_ids_index:o,data_index:a}=i;if(!qt(o)||o>=n)return e;if(!qt(a)||a>=t.length)return e;const s=r.indexOf(t[a]);return-1!==s&&e.push({cards_ids_index:o,data_index:s}),e},[])})(o,s,i.data,c):void 0;return d&&(a.replaced_saved_cards=d),a};r.dn(Bt);const Gt=async(e,t)=>{const r=await It.fetch("/account-payment-methods",{method:"GET",headers:{...t,...!["prod","lts"].includes("prod")&&{"X-scope":"omega"}}}),n=(await r.json()).data.find(t=>t.token===e);if(!n)throw new Error("Payment method not found for pseudotoken");return{data:n}};r.dn(Gt);const Yt=async e=>{const t=await It.fetch("/payment_methods/card_issuers",{method:"GET",query:e});return await t.json()};function Kt({cardNumber:e,cardId:t,cardholderName:r,identificationType:n,identificationNumber:i,securityCode:o,cardExpirationMonth:a,cardExpirationYear:s}){const c=t?{card_id:t,security_code:o}:{card_number:e,cardholder:{name:r,identification:{type:n,number:i}},security_code:o,expiration_month:parseInt(a,10),expiration_year:parseInt(s,10)},d=mt.getDeviceProfile();return d&&(c.device={meli:{session_id:d}}),c}r.dn(Yt);const Ht=async e=>{const t=await It.fetch("/card_tokens",{method:"POST",headers:{"X-Product-Id":e.productId||mt.getProductId()},body:JSON.stringify(Kt(e))});return await t.json()};r.dn(Ht);const Xt=async(e,t)=>{const r=await It.fetch(`/account-payment-methods/${e}`,{method:"GET",headers:{...t,...!["prod","lts"].includes("prod")&&{"X-scope":"omega"}}});return await r.json()};r.dn(Xt);const Jt=async(e,t,r)=>{const n=await It.fetch(`/account-payment-methods/${e}/card-token`,{method:"PUT",headers:{...t,...!["prod","lts"].includes("prod")&&{"X-scope":"omega"}},body:JSON.stringify(r),defaultQueries:!1});return await n.json()};function Zt({securityCode:e,cardExpirationMonth:t,cardExpirationYear:r}){const n={security_code:e,expiration_month:parseInt(t,10),expiration_year:parseInt(r,10)},i=mt.getDeviceProfile();return i&&(n.device={meli:{session_id:i}}),n}r.dn(Jt);const Qt=async e=>{const{securityCode:t,cardExpirationMonth:r,cardExpirationYear:n,token:i}=e,o=await It.fetch(`/card_tokens/${i}`,{method:"PUT",headers:{"X-Product-Id":mt.getProductId()},body:JSON.stringify(Zt({securityCode:t,cardExpirationMonth:r,cardExpirationYear:n}))});return await o.json()};function er(e){return{...e.textColor&&{textSecondaryColor:e.textColor},...e.textSize&&{fontSizeExtraSmall:e.textSize},...e.linkColor&&{baseColor:e.linkColor}}}r.dn(Qt);const tr=class{getIdentificationTypes(){return Rt()}getInstallments(e){return Nt(e)}getPaymentMethods(e){return St(e)}getAccountPaymentMethods(e,t){return xt(e,t)}getFastPaymentsAccountPaymentMethods(e,t){return Bt(e,t)}getAccountPaymentMethod(e,t){return Gt(e,t)}getCardId(e,t){return Xt(e,t)}updatePseudotoken(e,t,r){return Jt(e,t,r)}getIssuers(e){return Yt(e)}createCardToken(e){return Ht(e)}updateCardToken(e){return Qt(e)}createCreditsContract(e){return async function({containerId:e,options:t,bricks:r}){const{customization:n,fastPaymentToken:i,pseudotoken:o,pricingId:a}=t;return new Promise((t,s)=>{try{r.create("creditLegalText",e,{initialization:{fastPaymentToken:i,pseudotoken:o,pricingId:a},callbacks:{onReady:e=>t(e),onError:e=>s(e)},...n&&{customization:{visual:{style:{customVariables:er(n)}}}}})}catch(e){s(e)}})}(e)}checkEligibility(e,t){return(async(e,t)=>{if(!qa(e))return!1;const{publicKey:r,instanceId:n,deviceProfile:i,uid:o}=t;try{const t=await It.fetch("/eligibility/check",{baseURL:"https://api.mercadopago.com/v2",method:"GET",retry:0,headers:{Authorization:r,"X-email":e,"X-SDK-Instance-ID":n,"X-Device-Profile-ID":i,"X-Request-Device-ID":o,...!["prod","lts"].includes("prod")&&{"X-scope":"omega"}},defaultQueries:!1});return!!t.ok&&!0===(await t.json()).eligible}catch{return!1}})(e,t)}};class rr{send(e,t){return Promise.resolve()}addContext(e){}}class nr{sendErrorMetric(e){return Promise.resolve()}sendPerformanceMetric(e){return Promise.resolve()}}at();class ir{static getValue(e){return document.cookie.split(";").map(e=>{const t=e.split("=");return[t[0],t[1]]}).filter(([t])=>t===e).map(([,e])=>e)[0]}}const or={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ar;const sr=new Uint8Array(16),cr=[];for(let e=0;e<256;++e)cr.push((e+256).toString(16).slice(1));const dr=function(e,t,r){if(or.randomUUID&&!t&&!e)return or.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!ar){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ar=crypto.getRandomValues.bind(crypto)}return ar(sr)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return(cr[e[t+0]]+cr[e[t+1]]+cr[e[t+2]]+cr[e[t+3]]+"-"+cr[e[t+4]]+cr[e[t+5]]+"-"+cr[e[t+6]]+cr[e[t+7]]+"-"+cr[e[t+8]]+cr[e[t+9]]+"-"+cr[e[t+10]]+cr[e[t+11]]+cr[e[t+12]]+cr[e[t+13]]+cr[e[t+14]]+cr[e[t+15]]).toLowerCase()}(n)};class lr{static getUid(){return ir.getValue(lr.UID_COOKIE)||dr()}}var ur,pr,hr;ur=lr,hr="_d2id",(pr=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(pr="UID_COOKIE"))in ur?Object.defineProperty(ur,pr,{value:hr,enumerable:!0,configurable:!0,writable:!0}):ur[pr]=hr;const mr=(e=navigator.userAgent||navigator.vendor||window.opera)=>/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)),fr={load_bundle_script_failed:!0,load_translation_failed:!0,load_site_id_failed:!0,load_failed:!1,validation_error:!0,operation_failed:!1};class gr extends Error{constructor(e){super("Wallet initialization failed."),this.category=e}}const wr=e=>{const t=Object.prototype.hasOwnProperty.call(fr,e)?e:"operation_failed";return{name:t,product:"bricks",critical:fr[t],details:"Wallet component failed."}},yr=new Set(["/checkout/bricks/wallet/order_resolution","/checkout/bricks/wallet/open"]),Er=new Set(["/checkout/api_integration/cho_pro/order_render","/checkout/api_integration/cho_pro/order_open"]),_r=new Set(["/checkout/bricks/render","/checkout/bricks/submit","/checkout/bricks/error","/checkout/api_integration/cho_pro","/checkout/api_integration/cho_pro/render","/checkout/api_integration/cho_pro/open"]),br=(e,t)=>yr.has(e)||Er.has(e)||_r.has(e)&&"order"===t?.target_kind,vr=["MLA","MLB","MLM","MCO","MLC","MPE","MLU","unknown"],Ar=Object.freeze({"www.mercadopago.com.ar":"MLA","www.mercadopago.com.br":"MLB","www.mercadopago.com.mx":"MLM","www.mercadopago.com.co":"MCO","www.mercadopago.cl":"MLC","www.mercadopago.com.pe":"MPE","www.mercadopago.com.uy":"MLU"}),Ir={target_kind:["order","preference"],phase:["render","click"],source:["initialization","callback","initialization_fallback"],opening_mode:["modal","self","blank"],checkout_site:vr,outcome:["resolved","failed","cancelled","navigation_dispatched","render_succeeded","modal_opened"],error_category:["none","invalid_source","callback_failed","callback_timeout","not_authorized","unavailable","invalid_response","lookup_failed","lookup_timeout","cancelled","open_failed","invalid_target","initialization_failed","render_failed","navigation_failed","modal_failed","not_ready"]},Pr=["callback_duration_ms","lookup_duration_ms","elapsed_duration_ms"],Tr=["none","invalid_target","initialization_failed","render_failed","navigation_failed","modal_failed","not_ready"],kr=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Mr=(e,t)=>{const r={},n=e.startsWith("/checkout/api_integration/cho_pro"),i=e.endsWith("/order_render")?["render_succeeded","failed"]:e.endsWith("/order_open")?["navigation_dispatched","modal_opened","failed"]:e.endsWith("/order_resolution")?["resolved","failed","cancelled"]:["navigation_dispatched","failed"];for(const[e,o]of Object.entries(Ir)){if(n&&["phase","source"].includes(e))continue;const a=t?.[e];n&&"opening_mode"===e&&"blank"===a||"error_category"===e&&"string"==typeof a&&(n?!Tr.includes(a):Tr.includes(a)&&"none"!==a)||("outcome"!==e||"string"==typeof a&&i.includes(a))&&"string"==typeof a&&o.includes(a)&&(r[e]=a)}for(const e of Pr){if(n&&"elapsed_duration_ms"!==e)continue;const i=t?.[e];"number"==typeof i&&Number.isFinite(i)&&i>=0&&(r[e]=i)}const o=t?.bricks_instance_id;return"string"==typeof o&&kr.test(o)&&(r.bricks_instance_id=o),n&&(r.target_kind="order"),r},Cr=e=>vr.some(t=>t===e)?e:"unknown",Or=e=>"wallet_order"===e||"checkout_order"===e;function Rr(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Nr(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sr(e,t){return e.get(Dr(e,t))}function Fr(e,t,r){return e.set(Dr(e,t),r),r}function Dr(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Lr=new WeakMap,xr=new WeakMap,Ur=new WeakMap,jr=new WeakMap,$r=new WeakMap,Wr=new WeakMap,zr=new WeakMap;class qr{constructor(e,t,r){Rr(this,Lr,void 0),Rr(this,xr,void 0),Rr(this,Ur,void 0),Rr(this,jr,void 0),Rr(this,$r,void 0),Rr(this,Wr,void 0),Rr(this,zr,void 0),Fr(Lr,this,e),Fr(xr,this,t),Fr(Ur,this,r),Fr(jr,this,lr.getUid()),Fr($r,this,mt.getDeviceProfile()),Fr(Wr,this,mt.getPublicKey()),Fr(zr,this,{})}buildEvent(e,t){const r=br(e,t.event_data);return{tracks:[{path:e,type:t.type,user:r?{}:{uid:Sr(jr,this)},id:dr(),user_time:Date.now(),event_data:r?Mr(e,t.event_data):{...t.event_data,...Sr(zr,this),...Sr($r,this)&&{device_profile_id:Sr($r,this)},public_key:Sr(Wr,this)},application:{business:"mercadopago",site_id:r?Cr(Sr(Ur,this)):Sr(Ur,this),version:Sr(xr,this),app_name:Sr(Lr,this)},device:{platform:"/web/"+(mr()?"mobile":"desktop")}}]}}async postEvent(e,t=!1){const r=e.tracks[0];try{const n=await gt(qr.MELIDATA_API_URL,{method:"POST",body:JSON.stringify(e)});n.ok||(t?console.warn("wallet_order_tracking_failed"):console.warn(r.path,`Could not send event id ${r.id}. Status: ${n.status}`))}catch(e){t?console.warn("wallet_order_tracking_failed"):console.warn(r.path,`Could not send event id ${r.id}. Error: ${e}`)}}async validateEvent(e,t=!1){try{const t=e.tracks[0];await gt(qr.MELIDATA_API_URL_VALIDATE,{method:"POST",body:JSON.stringify(t)})}catch(r){t?console.warn("wallet_order_tracking_failed"):console.warn(e.tracks[0].path,`Could not send event id ${e.tracks[0].id}. Error: ${r}`)}}addContext(e){Fr(zr,this,Object.assign(Sr(zr,this),e))}async send(e,t){const r=this.buildEvent(e,t);br(e,t.event_data)?await this.postEvent(r,!0):this.postEvent(r)}}Nr(qr,"MELIDATA_API_URL","https://api.mercadolibre.com/tracks"),Nr(qr,"MELIDATA_API_URL_VALIDATE","https://api.mercadolibre.com/melidata/catalog/validate");var Vr=r(232),Br=r.n(Vr);function Gr(e){const t=Br()(e);return`${t.browser.name?`${t.browser.name} ${t.browser.version}`:"unknown"}${t.device.type?` (${t.device.type})`:""}`}const Yr=e=>Br()(e).browser.name??"",Kr=/\bMacintosh\b.*\bMobile\/\w+/;function Hr(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Xr(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jr(e,t){return e.get(Qr(e,t))}function Zr(e,t,r){return e.set(Qr(e,t),r),r}function Qr(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const en=e=>"supertoken"===e||e.startsWith("supertoken-");var tn=new WeakMap,rn=new WeakMap,nn=new WeakMap,on=new WeakMap;class an{constructor(e,t,r){Hr(this,tn,void 0),Hr(this,rn,void 0),Hr(this,nn,void 0),Hr(this,on,void 0),Zr(tn,this,e),Zr(rn,this,t),Zr(nn,this,r),Zr(on,this,this.getDeviceUidFromCookie())}async sendErrorMetric(e,t=!1){if(Or(e.product))return;t&&(e=wr(e.name));const r=this.buildErrorMetric(e,t);try{{const e=await gt(an.FRONTEND_METRICS_API_BASE_URL+"/error-metric",{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}});if(!e.ok){const t=await e.json();throw new Error(`${e.status} - ${t}`)}}}catch(e){if(t)return void console.warn("wallet_component_metrics_failed");const{name:n,version:i}=r.client,{name:o}=r.error;console.warn(`[${n}/${i}] Could not send error metric ${o}.`,e)}}async sendPerformanceMetric(e,t=!1){if(Or(e.product))return;t&&(e={name:"sdk_init",product:"wallet_brick",timing:Number.isFinite(e.timing)&&e.timing>=0?e.timing:0});const r=this.buildPerformanceMetric(e,t);try{{const e=await gt(an.FRONTEND_METRICS_API_BASE_URL+"/performance-metric",{method:"POST",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}});if(!e.ok){const t=await e.json();throw new Error(`${e.status} - ${t}`)}}}catch(e){if(t)return void console.warn("wallet_component_metrics_failed");const{name:n,version:i}=r.client,{name:o}=r.event;console.warn(`[${n}/${i}] Could not send performance metric ${o}.`,e)}}getDeviceUidFromCookie(){return ir.getValue(an.UID_COOKIE)||dr()}getBaseMetricInfo(e=!1){const t=mt.getFrontendStack();return{client:{name:Jr(tn,this),version:Jr(rn,this),platform:this.getClientPlatform(),technology:e&&!["JS","react","angular","vue"].includes(t)?"JS":t,scope:String("prod")},site_id:e?Cr(Jr(nn,this)):Jr(nn,this)}}buildErrorMetric(e,t=!1){return{...this.getBaseMetricInfo(t),browser:{domain:window.location.origin,user_agent:Gr(navigator.userAgent),...en(e.product)&&{name:Yr(navigator.userAgent)||"unknown"}},device:{uid:Jr(on,this)},error:e}}buildPerformanceMetric(e,t=!1){return e.timing=Number(e.timing.toFixed(2)),{...this.getBaseMetricInfo(t),browser:{domain:window.location.origin,...en(e.product)&&{name:Yr(navigator.userAgent)||"unknown"}},event:e}}getClientPlatform(){return(e=>{if(Kr.test(e))return"ios";const t=Br()(e).os.name?.toLowerCase();return"android"===t?"android":"ios"===t||"ipados"===t?"ios":"desktop"})(navigator.userAgent)}}function sn(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function cn(e,t){return e.get(ln(e,t))}function dn(e,t,r){return e.set(ln(e,t),r),r}function ln(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Xr(an,"UID_COOKIE","_d2id"),Xr(an,"FRONTEND_METRICS_API_BASE_URL","https://api.mercadopago.com/op-frontend-metrics/v1");var un=new WeakMap,pn=new WeakMap;class hn{get supportsWalletOrderPrivacy(){return!0}constructor(e){sn(this,un,void 0),sn(this,pn,void 0);const{appName:t,clientName:r="",siteId:n,version:i}=e;mt.getTrackingDisabled()?(dn(un,this,new rr),dn(pn,this,new nr)):(dn(un,this,new qr(t,i,n)),dn(pn,this,new an(r,i,n)))}melidata(){return cn(un,this)}frontendMetrics(){return cn(pn,this)}}var mn=function(e){return e.PRAPI="prapi",e.FIDO="fido",e.OTP="otp",e.NONE="none",e}(mn||{}),fn=function(e){return e.V1="v1",e.V2="v2",e}(fn||{}),gn=function(e){return e.WEB="web",e.APP="app",e}(gn||{}),wn=function(e){return e.NotInitialized="NOT_INITIALIZED",e.AlreadyShowing="ALREADY_SHOWING",e.SiteIdNotSupported="NOT_SUPPORTED_SITE_ID",e.InvalidEmail="INVALID_EMAIL_ADDRESS",e.InvalidAmount="INVALID_AMOUNT_VALUE",e.AmountDecimalsNotAllowed="AMOUNT_DECIMALS_NOT_ALLOWED",e.PRApiError="PAYMENT_REQUEST_ERROR",e.FidoNotSupported="FIDO_NOT_SUPPORTED",e.FidoBlockedInAppBrowser="FIDO_BLOCKED_IN_APP_BROWSER",e.FidoAuthorizeFailed="FIDO_AUTHORIZE_FAILED",e.FidoCancelled="FIDO_CANCELLED",e.OtpIframeFailed="OTP_IFRAME_FAILED",e.OtpValidateFailed="OTP_VALIDATE_FAILED",e.OtpResendLimitExceeded="OTP_RESEND_LIMIT_EXCEEDED",e.OtpCancelledBottomsheet="OTP_CANCELLED_BOTTOMSHEET",e.OtpClosedBottomsheet="OTP_CLOSED_BOTTOMSHEET",e.OtpErrorIframe="OTP_ERROR_IFRAME",e.PRApiNotSupported="PAYMENT_REQUEST_NOT_SUPPORTED",e.AuthenticationNotSupported="AUTHENTICATION_FLOW_NOT_SUPPORTED",e.AuthorizationErrorIframe="AUTHORIZATION_ERROR_IFRAME",e.AuthorizationCancelledIframe="AUTHORIZATION_CANCELLED_IFRAME",e.AuthorizationUnknownMessage="AUTHORIZATION_UNKNOWN_IFRAME",e.AuthorizationNonCodeErrorIframe="AUTHORIZATION_NON_CODE_ERROR_IFRAME",e.FidoIframeRetryAttempt="FIDO_IFRAME_RETRY_ATTEMPT",e.FidoIframeAuthenticateSuccess="FIDO_IFRAME_AUTHENTICATE_SUCCESS",e.NoApplicationsDetected="NO_APPLICATIONS_DETECTED",e.ApplicationCheckError="APPLICATION_CHECK_ERROR",e.ApiRequestFailed="API_REQUEST_FAILED",e.UserFlows401="USER_FLOWS_401",e.UserFlowsMalformed="USER_FLOWS_MALFORMED",e.BottomsheetLoadingFailed="BOTTOMSHEET_LOADING_FAILED",e.BottomsheetCloseFailed="BOTTOMSHEET_CLOSE_FAILED",e.NoUserConfirmation="NO_USER_CONFIRMATION",e.UnreachableApplication="UNREACHABLE_APPLICATION",e.SecurityBlocked="SECURITY_BLOCKED",e.PublicKeyNotSet="PUBLIC_KEY_NOT_SET",e.InvalidPlatformId="INVALID_PLATFORM_ID",e.PlatformIdHeaderDropped="PLATFORM_ID_HEADER_DROPPED",e.InvalidBricks="INVALID_BRICKS",e.MalformedToken="MALFORMED_TOKEN",e.UnexpectedNullError="UNEXPECTED_NULL_ERROR",e.UnexpectedErrorObject="UNEXPECTED_ERROR_OBJECT",e.NullApplicationError="NULL_APPLICATION_ERROR",e.PreloadedPaymentMethodsEmpty="PRELOADED_PAYMENT_METHODS_EMPTY",e.NoFastPaymentTokenToAuthorize="NO_FAST_PAYMENT_TOKEN_TO_AUTHORIZE",e.InvalidPaymentMethodToken="INVALID_PAYMENT_METHOD_TOKEN",e.SubmitInProgress="SUBMIT_IN_PROGRESS",e.AuthorizationFailed="AUTHORIZATION_FAILED",e.UserCancelled="USER_CANCELLED",e.TransactionCreate="TRANSACTION_CREATE",e.TransactionValidate="TRANSACTION_VALIDATE",e.IframeNoResponse="IFRAME_NO_RESPONSE",e.IframePostMessageFailed="IFRAME_POST_MESSAGE_FAILED",e.FidoPostMessageMissingTransactionId="FIDO_POSTMESSAGE_MISSING_TRANSACTION_ID",e.NotSupportedSiteIdForFidoIframeDomain="NOT_SUPPORTED_SITE_ID_FOR_FIDO_IFRAME_DOMAIN",e.ProviderFallbackAuthenticate="PROVIDER_FALLBACK_AUTHENTICATE",e.ProviderFallbackAuthorize="PROVIDER_FALLBACK_AUTHORIZE",e.UnexpectedFalsyFlowOnInitSuccess="UNEXPECTED_FALSY_FLOW_ON_INIT_SUCCESS",e}(wn||{});const yn=[wn.UserCancelled,wn.UnreachableApplication,wn.SecurityBlocked,wn.AuthorizationFailed];var En=function(e){return e.MercadoLibre="ML",e.MercadoPago="MP",e}(En||{}),_n=function(e){return e.Enrolled="enrolled",e.Installed="installed",e}(_n||{}),bn=function(e){return e.ParamsValidate="params_validate",e.UserFlowsFetch="user_flows_fetch",e.FlowSelect="flow_select",e.ProviderPrepare="provider_prepare",e}(bn||{});const vn=["MLA","MLB","MLM","MLC","MCO"],An=["Chrome","Samsung Internet","Edge","Instagram","Facebook"],In={[En.MercadoLibre]:"mercado_libre",[En.MercadoPago]:"mercado_pago"},Pn=[En.MercadoPago,En.MercadoLibre],Tn=["payment_brick","wallet","authenticator"],kn=/^[A-Za-z0-9]{20}$/,Mn=gn.WEB,Cn=new Set(["MLC","MCO"]),On=[wn.PRApiError,wn.ApiRequestFailed,wn.UserFlowsMalformed,wn.BottomsheetCloseFailed,wn.BottomsheetLoadingFailed,wn.ApplicationCheckError,wn.UnreachableApplication,wn.SecurityBlocked,wn.AuthorizationFailed,wn.MalformedToken,wn.AuthorizationErrorIframe,wn.AuthorizationNonCodeErrorIframe,wn.IframeNoResponse,wn.AuthorizationUnknownMessage,"ACCOUNT_PAYMENT_METHODS_ERROR","ACCOUNT_PAYMENT_METHODS_UNAUTHORIZED"],Rn=e=>On.includes(e),Nn="st-debug-panel-body";let Sn=null;const Fn=()=>(null===Sn&&(Sn=(()=>{try{return!("undefined"==typeof window||!window.location)&&"true"===new URLSearchParams(window.location.search).get("st-debug")}catch{return!1}})()),Sn),Dn={log:"#7ec8e3",warn:"#f5a623",error:"#e74c3c"},Ln=(e,t)=>{const r=(()=>{if("undefined"==typeof document)return null;const e=document.getElementById(Nn);if(e)return e;const t=document.createElement("div");t.id="st-debug-panel",t.style.cssText=["position:fixed","bottom:0","left:0","right:0","z-index:2147483647","font:12px/1.4 monospace","box-sizing:border-box"].join(";");const r=document.createElement("div");r.style.cssText=["display:flex","width:100%","background:rgba(0,0,0,0.9)"].join(";");const n=document.createElement("button");n.id="st-debug-panel-toggle",n.textContent="▼ st-debug",n.style.cssText=["flex:1","background:transparent","color:#7ec8e3","border:none","padding:4px 8px","text-align:left","cursor:pointer","font:12px/1.4 monospace"].join(";");const i=document.createElement("button");i.id="st-debug-panel-copy",i.textContent="copy",i.style.cssText=["background:transparent","color:#7ec8e3","border:none","border-left:1px solid rgba(255,255,255,0.2)","padding:4px 10px","cursor:pointer","font:12px/1.4 monospace"].join(";");const o=document.createElement("div");return o.id=Nn,o.style.cssText=["max-height:200px","overflow-y:auto","background:rgba(0,0,0,0.85)","color:#fff","padding:4px 8px"].join(";"),n.addEventListener("click",()=>{const e="none"===o.style.display;o.style.display=e?"block":"none",n.textContent=e?"▼ st-debug":"▶ st-debug"}),i.addEventListener("click",()=>{const e=Array.from(o.querySelectorAll("div")).map(e=>e.textContent??"").join("\n");navigator.clipboard.writeText(e).then(()=>{i.textContent="copied!",setTimeout(()=>{i.textContent="copy"},1500)}).catch(()=>{i.textContent="error",setTimeout(()=>{i.textContent="copy"},1500)})}),r.appendChild(n),r.appendChild(i),t.appendChild(r),t.appendChild(o),(document.body??document.documentElement).appendChild(t),o})();if(!r)return;const n=document.createElement("div");n.style.cssText=`color:${Dn[e]??"#fff"};border-bottom:1px solid rgba(255,255,255,0.1);padding:2px 0`;const i=(new Date).toISOString().slice(11,23),o=t.map(e=>"object"==typeof e?JSON.stringify(e):String(e)).join(" ");n.textContent=`[${i}] ${e.toUpperCase()} ${o}`,r.appendChild(n),r.scrollTop=r.scrollHeight},xn=(...e)=>{Fn()&&(console.log(...e),Ln("log",e))},Un=(...e)=>{Fn()&&(console.warn(...e),Ln("warn",e))},jn=(...e)=>{Fn()&&(console.error(...e),Ln("error",e))};var $n,Wn=r(606);function zn(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let qn=function(e){return e.INIT="init",e.PRELOAD_PAYMENT_METHODS="preload_payment_methods",e.START="start",e.CONFIRMATION="confirmation",e.CONFIRMATION_CLICK="confirmation_click",e.AUTHENTICATOR="authenticator",e.AUTHORIZATION_SUCCESS="authorization_success",e.AUTHENTICATOR_CANCEL_WEB="authenticator_cancel_web",e.AUTHENTICATOR_VERIFY="authenticator_verify",e.AUTHENTICATOR_RESEND="authenticator_resend",e.RENDER_FRAME="render_frame",e.PAYMENT_METHODS="payment_methods",e.PAYMENT_METHOD="payment_method",e.AUTHORIZATION_RETURN="authorization_return",e.WALLET_SUBMIT="wallet_submit",e.PAYMENT_METHODS_SHOW="payment_methods_show",e.PAYMENT_METHODS_CLICK="payment_methods_click",e.CREDITS_CONTRACT="credits_contract",e.AUTHORIZATION_UNKNOWN_MESSAGE="authorization_unknow_message",e}({});class Vn{}$n=Vn,zn(Vn,"tracker",void 0),zn(Vn,"TRACK_TYPE_VIEW","VIEW"),zn(Vn,"TRACK_TYPE_EVENT","EVENT"),zn(Vn,"TRACK_TYPE_SHOW","SHOW"),zn(Vn,"FRONTEND_METRICS_PRODUCT_NAME","supertoken"),zn(Vn,"TRACKING_APP_NAME","sdk_js"),zn(Vn,"FRONTEND_METRICS_CLIENT_NAME","sdk_js"),zn(Vn,"EVENT_TYPES_MAP",{[qn.INIT]:$n.TRACK_TYPE_VIEW,[qn.PRELOAD_PAYMENT_METHODS]:$n.TRACK_TYPE_SHOW,[qn.START]:$n.TRACK_TYPE_EVENT,[qn.CONFIRMATION]:$n.TRACK_TYPE_VIEW,[qn.CONFIRMATION_CLICK]:$n.TRACK_TYPE_EVENT,[qn.AUTHENTICATOR]:$n.TRACK_TYPE_VIEW,[qn.AUTHORIZATION_SUCCESS]:$n.TRACK_TYPE_EVENT,[qn.AUTHENTICATOR_CANCEL_WEB]:$n.TRACK_TYPE_EVENT,[qn.AUTHENTICATOR_VERIFY]:$n.TRACK_TYPE_EVENT,[qn.AUTHENTICATOR_RESEND]:$n.TRACK_TYPE_EVENT,[qn.AUTHORIZATION_UNKNOWN_MESSAGE]:$n.TRACK_TYPE_EVENT,[qn.RENDER_FRAME]:$n.TRACK_TYPE_VIEW,[qn.PAYMENT_METHODS]:$n.TRACK_TYPE_EVENT,[qn.PAYMENT_METHOD]:$n.TRACK_TYPE_EVENT,[qn.PAYMENT_METHODS_SHOW]:$n.TRACK_TYPE_VIEW,[qn.CREDITS_CONTRACT]:$n.TRACK_TYPE_VIEW,[qn.PAYMENT_METHODS_CLICK]:$n.TRACK_TYPE_EVENT,[qn.AUTHORIZATION_RETURN]:$n.TRACK_TYPE_EVENT,[qn.WALLET_SUBMIT]:$n.TRACK_TYPE_EVENT}),zn(Vn,"basePath","/order/supertoken/");var Bn={_:({version:e,siteId:t})=>{try{const r={appName:$n.TRACKING_APP_NAME,clientName:$n.FRONTEND_METRICS_CLIENT_NAME,version:e||"",siteId:t};$n.tracker=new hn(r)}catch(e){Un("[Mercado Pago] [TrackerClient]: Failed to initialize")}}};zn(Vn,"setContext",({siteId:e,version:t,instanceId:r})=>{try{$n.tracker||Bn._.call($n,{version:t,siteId:e}),$n.tracker.melidata().addContext({sdk_instance_id:r||mt.getInstanceId()})}catch{Un("[Mercado Pago] [TrackerClient]: Failed to set context")}});var Gn={_:void 0};zn(Vn,"setIntegration",e=>{Gn._=$n.resolveIntegration(e)}),zn(Vn,"resolveIntegration",e=>e&&Tn.includes(e)?e:"authenticator"),zn(Vn,"forIntegration",e=>{const t=$n.resolveIntegration(e);let r;return{integration:t,FRONTEND_METRICS_PRODUCT_NAME:$n.FRONTEND_METRICS_PRODUCT_NAME,send:$n.send,sendError:(e,r,n,i)=>$n.sendError(e,r,n,i,t),sendFrontendMetricsError:e=>$n.sendFrontendMetricsError(e,t),sendFrontendMetricsPerformance:e=>$n.sendFrontendMetricsPerformance(e,t),sendInitMetrics:e=>$n.sendInitMetrics({...e,integration:t}),setPlatformId:e=>{r=e,$n.setPlatformId(e)},getPlatformId:()=>r??$n.getPlatformId()}});var Yn={_:new Map},Kn={_:(e,t)=>`${e}\0${t??""}`};zn(Vn,"bindSession",(e,t,r)=>{if(!e)return;const n=Yn._,i=Kn._.call($n,e,t);if(n.delete(i),n.set(i,r),n.size>500){const e=n.keys().next().value;void 0!==e&&n.delete(e)}}),zn(Vn,"forSession",(e,t)=>{if(!e)return $n;const r=Yn._,n=Kn._.call($n,e,t),i=r.get(n);return i?(r.delete(n),r.set(n,i),i):$n});var Hn={_:(e,t=Gn._)=>e.product===$n.FRONTEND_METRICS_PRODUCT_NAME&&t?{...e,product:`${e.product}-${t}`}:e},Xn={_:"none"};zn(Vn,"setPlatformId",e=>{Xn._=e}),zn(Vn,"getPlatformId",()=>Xn._),zn(Vn,"send",(e,t)=>{try{$n.tracker&&$n.tracker.melidata().send(`${$n.basePath}${e}`,{type:$n.EVENT_TYPES_MAP[e],event_data:t||{}})}catch{Un("[Mercado Pago] [TrackerClient]: Failed to send track")}}),zn(Vn,"sendError",(e,t,r,n,i)=>{try{gs.sendError({type:gs.TRACK_TYPE_EVENT,eventData:{type:t.error_critical?gs.ERROR_TYPE_CRITICAL:gs.ERROR_TYPE_WARNING,origin:`Supertoken.${e}`,reason:t.error_name,platform_id:void 0===t.platform_id?$n.getPlatformId():t.platform_id||"none",...n&&{challenge_id:n}}});const o={name:t.error_name,product:$n.FRONTEND_METRICS_PRODUCT_NAME,critical:Rn(t.error_name),details:r||"none"};i?$n.sendFrontendMetricsError(o,i):$n.sendFrontendMetricsError(o)}catch{Un("[Mercado Pago] [TrackerClient]: Failed to send track")}}),zn(Vn,"sendFrontendMetricsError",(e,t)=>{try{$n.tracker?.frontendMetrics().sendErrorMetric(Hn._.call($n,e,t))}catch{Un("Failed to send frontend metrics error track on TrackerClient")}}),zn(Vn,"sendFrontendMetricsPerformance",(e,t)=>{try{$n.tracker?.frontendMetrics().sendPerformanceMetric(Hn._.call($n,e,t))}catch{Un("Failed to send frontend metrics performance track on TrackerClient")}}),zn(Vn,"sendInitMetrics",({flowVersion:e,flow:t,availableFlows:r,error:n,errorDetails:i,critical:o,platformId:a,bricks:s,authLevel:c,application:d,applications:l,sessionId:u,amount:p,hasRequiredInstrument:h,instanceId:m,breadcrumb:f,integration:g})=>{const w={flow_version:e,locale:mt.getLocale(),scope:Wn.env.scope||"prod",hostname:_t,bricks:s||!1,flow:t||mn.NONE,...r&&{all_flows:r},order_mode:"automatic",user_agent:Gr(navigator.userAgent),platform_id:a||"none",auth_level:c||"none",applications:l||[],...d&&{application:d},...u&&{supertoken:u},...p&&{amount:p},...h&&{has_required_instrument:h}};if(w.flow===mn.NONE){const e={name:wn.UnexpectedFalsyFlowOnInitSuccess,product:$n.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`Authenticator.#initialize: firstFlow=${String(w.flow)} | instance=${m} | breadcrumb=${f} | eventData=${JSON.stringify(w)}${n?` | error=${n}`:""}${i?` | errorDetails=${i}`:""}`};g?$n.sendFrontendMetricsError(e,g):$n.sendFrontendMetricsError(e)}n?$n.sendError(qn.INIT,{...w,platform_id:a??$n.getPlatformId(),error_name:n,error_critical:o||!1},...g?[i,void 0,g]:[i]):$n.send(qn.INIT,{...w,...t&&{flow:t}})});const Jn=Vn;function Zn(e){return(t,r)=>async function(e,t){const r=performance.now();let n="success";try{return await t()}catch(e){throw n="error",e}finally{e.sendPerformance({name:`${e.name}_${n}`,product:e.product,timing:performance.now()-r})}}({...e,name:t},r)}const Qn=e=>Zn({product:e.FRONTEND_METRICS_PRODUCT_NAME,sendPerformance:t=>e.sendFrontendMetricsPerformance(t)}),ei="MPHiddenInput",ti={TOKEN:"token",PAYMENT_METHOD:"paymentMethod",PROCESSING_MODE:"processingMode",MERCHANT_ACCOUNT_ID:"merchantAccountId"},ri=["credit_card","debit_card","prepaid_card"],ni=[{path:"root",name:"amount",type:"string",required:!0,isAllowed:()=>!0,isDOMElement:!1},{path:"root",name:"autoMount",type:"boolean",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"root",name:"processingMode",type:"string",acceptedValues:pt,required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"form",name:"id",type:"string",required:!0,isAllowed:()=>!0,isDOMElement:!0,tagName:["FORM","DIV"]},{path:"form",name:"cardNumber",type:"string",required:!0,isAllowed:()=>!0,isDOMElement:!0,tagName:["INPUT","DIV"],pci:!0},{path:"form",name:"securityCode",type:"string",required:!1,isAllowed:()=>!0,isDOMElement:!0,tagName:["INPUT","DIV"],pci:!0},{path:"form",name:"cardExpirationMonth",type:"string",required:!0,isAllowed:e=>!e.form.cardExpirationDate,isDOMElement:!0,tagName:["INPUT","SELECT","DIV"],pci:!0},{path:"form",name:"cardExpirationYear",type:"string",required:!0,isAllowed:e=>!e.form.cardExpirationDate,isDOMElement:!0,tagName:["INPUT","SELECT","DIV"],pci:!0},{path:"form",name:"cardExpirationDate",type:"string",required:!0,isAllowed:e=>!(e.form.cardExpirationMonth||e.form.cardExpirationYear),isDOMElement:!0,tagName:["INPUT","SELECT","DIV"],pci:!0},{path:"form",name:"cardholderName",type:"string",required:!0,isAllowed:()=>!0,isDOMElement:!0,tagName:["INPUT"]},{path:"form",name:"cardholderEmail",type:"string",required:!1,isAllowed:()=>!0,isDOMElement:!0,tagName:["INPUT"]},{path:"form",name:"installments",type:"string",required:!0,isAllowed:()=>!0,isDOMElement:!0,tagName:["SELECT"]},{path:"form",name:"issuer",type:"string",required:!0,isAllowed:()=>!0,isDOMElement:!0,tagName:["SELECT"],pci:!0},{path:"form",name:"cardholderIdentificationType",type:"string",required:!1,isAllowed:()=>!0,isDOMElement:!0,tagName:["SELECT"]},{path:"form",name:"cardholderIdentificationNumber",type:"string",required:!1,isAllowed:()=>!0,isDOMElement:!0,tagName:["INPUT"]},{path:"callbacks",name:"onFormMounted",type:"function",required:!0,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onIdentificationTypesReceived",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onPaymentMethodsReceived",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onInstallmentsReceived",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onCardTokenReceived",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onIssuersReceived",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onFormUnmounted",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onSubmit",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onFetching",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onReady",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onValidityChange",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1},{path:"callbacks",name:"onError",type:"function",required:!1,isAllowed:()=>!0,isDOMElement:!1}],ii=ni.filter(({isDOMElement:e})=>e),oi=e=>e.charAt(0).toUpperCase()+e.slice(1),ai=(e,t)=>{const r=ii.find(({name:t})=>("id"===t?"form":t)===e),n=document.getElementById(t);if(!n){const e=`MercadoPago.js - Could not find HTML element for provided id: ${t}`;throw gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"card_form",critical:!1,details:`DomHelper.getHTMLElementFrom: Could not find HTML element for provided id: ${t}`}),new Error(e)}const i=r?.tagName;if(i&&!i.includes(n.tagName)){const t=`MercadoPago.js - ${e}: wrong HTML Element type: expected ${i.join(" or ")}. Received ${n.tagName}`;throw gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"card_form",critical:!1,details:`DomHelper.getHTMLElementFrom: ${e}: wrong HTML Element type: expected ${i.join(" or ")}. Received ${n.tagName}`}),new Error(t)}const o=r?.pci,a=n.getAttribute("name");return o&&a&&(n.setAttribute("data-name",a),n.removeAttribute("name"),n.setAttribute("autocomplete","off")),n},si=e=>{const t=[...e?.children];t?.forEach(e=>e.remove())},ci=e=>{const t=Tt.getContext("formMap");return e.map(e=>{const r=t?.get(e)?.element;return r?.value})},di=(e,t)=>{const r=Tt.getContext("formMap"),n=r?.get(e)?.element;n?.setAttribute("value",t)},li=(e,t="")=>{const r=document.createElement("option");r.textContent=t,r.dataset.placeholder="",r.setAttribute("selected",""),r.setAttribute("disabled",""),e.appendChild(r)},ui=e=>{const t=(e=as(os(e))).length,r=Tt.getContext("bin"),n=r.get("bin")?.bin,i=Tt.getContext("customCallbacks").get("onBinChange"),[o]=ci(["paymentMethods"]);if(t<8&&o){const t=Tt.getContext("cardSettings"),n=Tt.getContext("formMap"),o=n.get("installments"),a=n.get("issuer"),{element:s,placeholder:c}=o,{element:d,placeholder:l}=a;return di("paymentMethods",""),di("merchantAccountId",""),si(s),li(s,c),si(d),li(d,l),t.delete("additional_info_needed"),t.delete("security_code"),t.delete("card_number"),r.set("bin",{bin:e}),void i?.(e)}if(t>=8&&e!==n){const e=Tt.getContext("cardFormModules").get("getPaymentMethods");e?.()}r.set("bin",{bin:e}),i?.(e)},pi={},hi=(e,t)=>{const r=pi[e];r&&clearTimeout(r),pi[e]=setTimeout(()=>{t()},500)};let mi;const fi=(e,t)=>{const r=es({field:t,value:e});return r.length?r:void 0},gi=(e,t)=>{mi=Tt.getContext("customCallbacks");const r=mi?.get("onValidityChange");r?.(e,t)},wi={form:[{event:["select","copy","cut","drop","drag"],fn:e=>e.preventDefault()},{event:["submit"],fn:async e=>{const t=(()=>{const e=Tt.getContext("cardFormOptions"),t=Tt.getContext("formMap"),r=e?.get("amount"),n=t?.get("form"),i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name",`${ei}Amount`),i.setAttribute("value",r),n.element?.appendChild(i),()=>i.remove()})();try{const[t]=ci(["token"]);if(!t){e.preventDefault();const t=Tt.getContext("cardFormModules").get("createCardToken");return await(t?.()),e.target.requestSubmit()}}catch(e){return console.warn("MercadoPago.js - Form could not be submitted: ",e)}finally{t()}mi=Tt.getContext("customCallbacks");const r=mi?.get("onSubmit");r?.(e)}}],cardNumber:[{event:["input"],fn:e=>hi("cardNumber",async()=>{const t=e.target,{value:r=""}=t,n=Tt.getContext("cardFormModules").get("setBin");n?.(r),ui(r)})},{event:["input"],fn:e=>hi("cardNumber-validityChange",()=>{if(!e.isTrusted)return;const t=e.target.value,r=fi(t,"cardNumber");gi(r,"cardNumber")})}],cardExpirationDate:[{event:["input"],fn:e=>{!function(e){const t=e.target,r=t.value.length,n=t.selectionStart||0;!function({maskedValue:e,currentValueLength:t,target:r,cursorIndex:n}){const i=e.length-t;r.setSelectionRange(n+i,n+i)}({maskedValue:yi(t),currentValueLength:r,target:t,cursorIndex:n})}(e)}},{event:["input"],fn:e=>hi("cardExpirationDate",()=>{const t=e.target.value,[r,n]=t.split("/"),i=fi(r,"cardExpirationMonth"),o=fi(n,"cardExpirationYear");if(!i&&!o)return void gi(i,"cardExpirationDate");const a=Tt.getContext("expirationFields").has("expirationDate")?"expirationDate":"cardExpirationDate";let s=[];s=i?[...s,...i]:s,s=o?[...s,...o]:s,gi(s,a)})}],cardholderName:[{event:["input"],fn:e=>hi("cardholderName",()=>{const t=e.target.value,r=fi(t,"cardholderName");gi(r,"cardholderName")})}],cardholderEmail:[{event:["input"],fn:e=>hi("cardholderEmail",()=>{const t=e.target.value,r=fi(t,"cardholderEmail");gi(r,"cardholderEmail")})}],securityCode:[{event:["input"],fn:e=>hi("securityCode",()=>{const t=e.target.value,r=fi(t,"securityCode");gi(r,"securityCode")})}],cardExpirationMonth:[{event:["input"],fn:e=>hi("cardExpirationMonth",()=>{const t=e.target.value,r=Tt.getContext("expirationFields").has("expirationMonth")?"expirationMonth":"cardExpirationMonth",n=fi(t,"cardExpirationMonth");gi(n,r)})}],cardExpirationYear:[{event:["input"],fn:e=>hi("cardExpirationYear",()=>{const t=e.target.value,r=Tt.getContext("expirationFields").has("expirationYear")?"expirationYear":"cardExpirationYear",n=fi(t,"cardExpirationYear");gi(n,r)})}],identificationNumber:[{event:["input"],fn:e=>hi("identificationNumber",()=>{const t=e.target.value,r=fi(t,"identificationNumber");gi(r,"identificationNumber")})}]};function yi(e){const t=e.value.replace(/\D/g,"").replace(/^(\d{2})(?=\d)/,"$1/");return e.value=t,t}function Ei(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class _i{constructor({waitFieldsReady:e}){Ei(this,"formMap",void 0),Ei(this,"cardFormModules",void 0),Ei(this,"cardSettings",void 0),Ei(this,"eventsToWait",new Set),Ei(this,"completedEvents",void 0),Ei(this,"fields",{}),this.formMap=Tt.getContext("formMap"),this.cardFormModules=Tt.getContext("cardFormModules"),this.cardSettings=Tt.getContext("cardSettings"),this.completedEvents=Tt.createContext("completedEvents"),this.initEventsToWait({waitFieldsReady:e})}initEventsToWait({waitFieldsReady:e}){this.eventsToWait.add("onMount"),this.formMap.has("identificationType")&&this.eventsToWait.add("onIdentificationTypesReceived"),e&&this.eventsToWait.add("fields")}onFormMounted({error:e,customCallback:t}){if(e)return t?.(e);const r=this.cardFormModules.get("getIdentificationTypes");this.formMap.get("identificationType")&&r?.(),t?.()}onIdentificationTypesReceived({error:e,data:t,customCallback:r}){if(e)return r?.(e);const n=this.formMap.get("identificationType")?.element,i=document.createDocumentFragment();t?.forEach(e=>{const t=document.createElement("option");t.value=e.id,t.textContent=e.name,i.appendChild(t)}),si(n),n?.appendChild(i),r?.(e,t)}onPaymentMethodsReceived({error:e,data:t,customCallback:r,handler:n}){return e?r?.(e):t?.length?(n.onPaymentMethodsReceived({paymentMethods:t,customCallback:r,cardFormModules:this.cardFormModules,cardSettings:this.cardSettings,formMap:this.formMap}),void r?.(e,t)):r?.(new Error("MercadoPago.js - No payment methods found"))}onInstallmentsReceived({error:e,data:t,customCallback:r}){if(e)return r?.(e);const n=this.formMap.get("installments")?.element,i=document.createDocumentFragment();t?.payer_costs?.forEach(e=>{const t=document.createElement("option");t.value=e.installments,t.textContent=e.recommended_message,i.appendChild(t)}),si(n),n?.appendChild(i),r?.(e,t)}onIssuersReceived({error:e,data:t,customCallback:r}){if(e)return r?.(e);const n=this.formMap.get("issuer")?.element,i=document.createDocumentFragment();t?.forEach(e=>{const t=document.createElement("option");t.value=e.id,t.textContent=e.name,i.appendChild(t)});const o=this.cardFormModules.get("getInstallments");si(n),n?.appendChild(i),o?.(),r?.(e,t)}onCardTokenReceived({error:e,data:t,customCallback:r}){if(e)return r?.(e);di("token",t?.token),r?.(e,t)}onReady({customCallback:e,data:t}){t.fields&&(this.fields=Object.fromEntries(t.fields)),this.completedEvents.set(t.event,!0),this.eventsToWait.size===this.completedEvents.size&&(Object.keys(this.fields).length>0?e?.(this.fields):e?.())}}function bi(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function vi(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ai(e,t){return e.get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t))}var Ii=new WeakMap,Pi=new WeakMap,Ti=new WeakMap,ki=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,Oi=new WeakMap,Ri=new WeakMap,Ni=new WeakMap;class Si{constructor(e,t=ys()){vi(this,"coreModules",void 0),vi(this,"productId",void 0),bi(this,Ii,({field:e,value:t,fieldSettings:r})=>{if("string"!=typeof t)return void console.warn(`MercadoPago.js - Error setting placeholder for field ${e}: placeholder should be a string. Ignoring...`);const n=r.element;if(r&&n&&!r.hidden){if("SELECT"===n.tagName&&n.querySelector("[data-placeholder]"))return si(n),void li(n,t);n.setAttribute("placeholder",t)}}),bi(this,Pi,new Map([["placeholder",Ai(Ii,this).bind(this)]])),bi(this,Ti,(e,t)=>{const r=t?.get(e),n={element:ai(e,r.id),...r};t?.set(e,n)}),bi(this,ki,(e,t)=>{const r=t?.get(e),n={listeners:(({optionName:e})=>wi[e])({optionName:e}),...r};t?.set(e,n)}),bi(this,Mi,(e,t)=>{const{element:r,listeners:n}=t?.get(e);if(n?.length)try{n.forEach(e=>{e?.event.forEach(t=>{r?.addEventListener(t,e?.fn)})})}catch(e){const t=`MercadoPago.js - Something went wrong adding EventListeners: ${e.message}`;throw gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!0,details:`DefaultCardHandler.applyFormMapEventListeners: ${e.message}`}),new Error(t)}}),bi(this,Ci,(e,t)=>{const{placeholder:r,element:n,style:i,customFonts:o,mode:a}=t?.get(e);r&&("SELECT"===n?.tagName?li(n,r):n.placeholder=r),i&&console.warn(`MercadoPago.js - Ignoring styles for ${e}: styles are only available for 'cardNumber', 'securityCode', 'expirationDate', 'expirationMonth' and 'expirationYear' when the 'iframe' option is true`),o&&console.warn(`MercadoPago.js - Ignoring customFonts for ${e}: customFonts are only available for 'cardNumber', 'securityCode', 'expirationDate', 'expirationMonth' and 'expirationYear' when the 'iframe' option is true`),a&&console.warn(`MercadoPago.js - Ignoring mode for ${e}: mode is only available for 'expirationYear' or 'expirationDate' when the 'iframe' option is true`)}),bi(this,Oi,e=>{const t=e?.get("form")?.id,r=document.getElementById(t);Object.values(ti).forEach(e=>{const t=document.getElementById(`${ei}${oi(e)}`);t&&r?.removeChild(t)})}),bi(this,Ri,()=>{["cardSettings","customCallbacks","cardFormModules"].forEach(e=>Tt.deleteContext(e))}),bi(this,Ni,(e,t)=>{const r=t-e+1;return Array.from({length:r},(t,r)=>e+r)}),this.coreModules=e,this.productId=t}createField(e,t,r,n=!0){Ai(Ti,this).call(this,e,r),t||(n&&Ai(Ci,this).call(this,e,r),Ai(ki,this).call(this,e,r),Ai(Mi,this).call(this,e,r))}getNonPCIValues(){return ci(["identificationType","identificationNumber","cardholderName"])}destroyCardForm(e){Ai(Ri,this).call(this),Ai(Oi,this).call(this,e)}async getTokenRaw(){const[e,t,r,n,i]=ci(["cardNumber","cardExpirationMonth","cardExpirationYear","cardExpirationDate","securityCode"]),[o,a,s]=this.getNonPCIValues();let c=t,d=r;return n&&([c,d]=n.split("/")),await(this.coreModules?.createCardToken({cardNumber:os(e),cardholderName:s,identificationType:o,cardExpirationMonth:c,identificationNumber:a,cardExpirationYear:d,securityCode:i,productId:this.productId},{cardNumber:!0,cardExpirationMonth:!0,cardExpirationYear:!0,securityCode:!0}))}onPaymentMethodsReceived({paymentMethods:e,customCallback:t,cardFormModules:r,cardSettings:n,formMap:i}){const o=e?.[0].payment_type_id;if(!ri.includes(o))return t?.(new Error(`Payment Method ${o} not supported.`));const a=r.get("getInstallments"),s=r.get("getIssuers"),{id:c,additional_info_needed:d,issuer:l,card:u,merchant_account_id:p,payment_type_id:h}=e?.[0];if(!u)return t?.(new Error("Payment method configuration not found."));const m={mode:u.security_code.mode,card_location:u.security_code.location,length:u.security_code.length},f={allowedLengths:Ai(Ni,this).call(this,u.length.min,u.length.max),validation:u.validation};n.set("payment_type_id",h),n.set("additional_info_needed",d),n.set("security_code",m),n.set("card_number",f);const g=String(l?.id);di("paymentMethods",c),p&&di("merchantAccountId",p),d.includes("issuer_id")?s?.():(()=>{const e=i.get("issuer")?.element;e.setAttribute("value",g);const t=document.createElement("option");t.value=g,t.textContent=l.name,si(e),e.append(t),a?.()})()}update({field:e,properties:t,fieldSettings:r}){Ai(Pi,this).forEach((n,i)=>{const o=t[i];o&&n({field:e,value:o,fieldSettings:r})})}}function Fi(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Di(e,t){return e.get(xi(e,t))}function Li(e,t,r){return e.set(xi(e,t),r),r}function xi(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Ui=new WeakMap,ji=new WeakMap,$i=new WeakMap;class Wi{constructor({component:e,event:t,fn:r}){Fi(this,Ui,void 0),Fi(this,ji,void 0),Fi(this,$i,void 0),Li(Ui,this,r),Li(ji,this,e),Li($i,this,t)}addEventListener(){Di(ji,this).addEventListener(Di($i,this),Di(Ui,this),!0)}removeEventListener(){Di(ji,this).removeEventListener(Di($i,this),Di(Ui,this),!0)}}const zi="cardNumber",qi="securityCode",Vi="expirationYear",Bi="expirationMonth",Gi="expirationDate",Yi={default:["focus","blur","ready","validityChange","error","change","paste"],cardNumber:["binChange"],securityCode:[],expirationYear:[],expirationMonth:[],expirationDate:[]},Ki={test1:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},test2:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},test3:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},test4:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},test5:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},gama:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},beta:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"},prod:{cacheUrl:"https://secure-fields.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields"},lts:{cacheUrl:"https://secure-fields.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields"},development:{cacheUrl:"http://localhost:8080/secure-fields",sourceUrl:"http://localhost:8080/secure-fields"},development_bricks:{cacheUrl:"https://secure-fields-stg.mercadopago.com/",sourceUrl:"https://api-static.mercadopago.com/secure-fields/staging"}};function Hi(){return Ki.prod||Ki.development}let Xi;function Ji(){return Xi}var Zi;function Qi(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eo{static triggerEvent(e,t){const r=eo.customEventListeners.find(({event:r,field:n,group:i})=>r===e&&t.field===n&&(!t.group||t.group===i));r&&r.fn(t)}}function to(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function ro(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function no(e,t){return e.get(io(e,t))}function io(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Zi=eo,Qi(eo,"customEventListeners",[]),Qi(eo,"eventListener",void 0),Qi(eo,"addWindowEventListener",()=>{Zi.eventListener=new Wi({component:window,event:"message",fn:Zi.callbackFn}),Zi.eventListener.addEventListener()}),Qi(eo,"removeWindowEventListener",()=>{Zi.eventListener?.removeEventListener()}),Qi(eo,"addCustomEventListener",e=>{Zi.customEventListeners.push(e)}),Qi(eo,"removeCustomEventListeners",e=>{const t=Zi.customEventListeners.filter(t=>e!==t.field);Zi.customEventListeners=t}),Qi(eo,"callbackFn",e=>{const t=Ji();if(!t)return;const{origin:r}=new URL(t),{origin:n,data:{message:i,data:o}}=e;n===r&&Zi.triggerEvent(i,o)});var oo=new WeakMap,ao=new WeakMap,so=new WeakMap;class co{constructor(){to(this,oo,void 0),ro(this,"createIFrame",(e,t,r)=>{const n={frameBorder:0,allowtransparency:!0,scrolling:"no",height:"100%",width:"100%",name:_o({field:e.type,group:r}),style:"color-scheme: normal"},i=document.createElement("iframe");return Object.keys(n).forEach(e=>{const t=n[e];i.setAttribute(e,t)}),!t.length&&(co.preflight=It.fetchPage(Hi().cacheUrl).catch(()=>It.fetchPage(Hi().sourceUrl))),co.preflight.then(({url:n})=>{!function(e){Xi=e}(n),i.src=n,no(ao,this).call(this,{iFrame:i,fieldProperties:e,types:t,group:r})}).catch(t=>{const r=`Unable to load ${e.type}: ${t.message||"Failed to fetch"}`;gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"fields",critical:!0,details:`IFrameHandler.createIFrame: ${r}`}),eo.triggerEvent("error",{field:e.type,error:r})}),i}),ro(this,"removeIFrameFromContainer",({iFrame:e})=>{e.parentNode?.removeChild(e)}),ro(this,"appendIFrameToContainer",({iFrame:e,container:t})=>{go({container:t}),t.innerHTML="",t.appendChild(e)}),to(this,ao,({iFrame:e,fieldProperties:t,types:r,group:n})=>{!function(e,t,r){e.set(io(e,t),r)}(oo,this,new Wi({component:e,event:"load",fn:()=>no(so,this).call(this,{iFrame:e,fieldProperties:t,types:r,group:n})})),no(oo,this).addEventListener()}),ro(this,"removeIframeEventListeners",()=>{no(oo,this)?.removeEventListener()}),to(this,so,({iFrame:e,fieldProperties:t,types:r,group:n})=>{const i=e.contentWindow;if(i){const{style:e,placeholder:o,type:a,customFonts:s,mode:c,enableLuhnValidation:d,srLabel:l,ariaRequired:u}=t;i.postMessage({message:"initialize",field:a,options:{style:e,placeholder:o,customFonts:s,mode:c,enableLuhnValidation:d,group:n,srLabel:l,ariaRequired:u},createdFields:r},Ji())}})}}function lo(e,t){return e.get(po(e,t))}function uo(e,t,r){return e.set(po(e,t),r),r}function po(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}ro(co,"preflight",void 0);var ho=new WeakMap;class mo{constructor(){(function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)})(this,ho,void 0),uo(ho,this,[])}getFields(){return lo(ho,this)}addField(e){lo(ho,this).push(e)}removeField({field:e}){const t=e.type;return uo(ho,this,lo(ho,this).filter(e=>e.type!==t)),lo(ho,this)}getFieldsType(){return lo(ho,this).map(e=>e.type)}getPrimaryField(){return lo(ho,this).find(e=>e.isPrimary)}}function fo(e){const t=e[0];t.iFrame.setAttribute("data-primary","true"),t.isPrimary=!0}const go=({container:e})=>{if("DIV"!==e.tagName){const e="[Fields] The container must be a div";throw gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"fields",critical:!1,details:"ValidationHelper.validateContainer: The container must be a div"}),new Error(e)}},wo=e=>{const t=e.getFieldsType(),r=t.includes(Bi),n=t.includes(Vi);return t.includes(Gi)||!(r&&!n||n&&!r)},yo="",Eo="";function _o({field:e,group:t=Eo,separator:r=yo}){return r&&t?e+r+t:e}function bo(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function vo(e,t){return e.get(Io(e,t))}function Ao(e,t,r){return e.set(Io(e,t),r),r}function Io(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const Po=["securityCode","cardExpirationMonth","cardExpirationYear","cardExpirationDate","cardNumber"];var To=new WeakMap,ko=new WeakMap,Mo=new WeakMap,Co=new WeakMap,Oo=new WeakMap,Ro=new WeakMap,No=new WeakMap,So=new WeakMap,Fo=new WeakMap;class Do extends Si{constructor(e,t=ys()){super(e,t),bo(this,To,void 0),bo(this,ko,void 0),bo(this,Mo,void 0),bo(this,Co,void 0),bo(this,Oo,0),bo(this,Ro,(e,t)=>{const r=t?.get(e),n=vo(No,this).call(this,e),i=this.coreModules?.fields.create(n,vo(ko,this),{placeholder:r.placeholder,style:r.style,customFonts:r.customFonts,mode:r.mode,enableLuhnValidation:r.enableLuhnValidation,srLabel:r.srLabel,ariaRequired:r.ariaRequired});i.mount(r.id),vo(To,this).set(n,i),i.on("ready",()=>{var e;if(Ao(Oo,this,(e=vo(Oo,this),++e)),vo(Oo,this)===vo(To,this).size){const e=vo(Mo,this).get("onReady"),t=vo(Co,this).get("onReady");t?.({customCallback:e,data:{event:"fields",fields:vo(To,this)}})}}),i.on("validityChange",({field:e,errorMessages:t})=>{const r=vo(Mo,this).get("onValidityChange"),n=t.length?vo(Fo,this).call(this,t):void 0;r?.(n,e)}),i.on("error",({error:e})=>{const t=vo(Mo,this).get("onError");t?.(us(e),"onIframeLoad")}),n===zi&&i.on("binChange",({bin:e})=>{const t=Tt.getContext("cardFormModules").get("setBin");e||(e=""),t?.(e),ui(e)})}),bo(this,No,e=>({securityCode:qi,cardExpirationMonth:Bi,cardExpirationYear:Vi,cardExpirationDate:Gi,cardNumber:zi}[e])),bo(this,So,()=>{vo(To,this).forEach(e=>e?.unmount())}),function(e,t,r){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"destroyCardForm",e=>{super.destroyCardForm(e),vo(So,this).call(this)}),bo(this,Fo,e=>e.map(e=>({code:e.cause,message:e.message}))),Ao(ko,this,new mo),Ao(Mo,this,Tt.getContext("customCallbacks")),Ao(Co,this,Tt.getContext("internalCallbacks")),Ao(To,this,new Map);const r=Tt.getContext("formMap");Po.forEach(e=>{r.has(e)&&vo(To,this).set(vo(No,this).call(this,e),void 0)})}async getTokenRaw(){const[e,t,r]=super.getNonPCIValues();return await(this.coreModules?.fields.createCardToken({identificationNumber:t,identificationType:e,cardholderName:r},vo(ko,this),{group:"",productId:this.productId}))}createField(e,t,r){const n=Po.includes(e);super.createField(e,t,r,!n),n&&vo(Ro,this).call(this,e,r)}onPaymentMethodsReceived({paymentMethods:e,customCallback:t,cardFormModules:r,cardSettings:n,formMap:i}){super.onPaymentMethodsReceived({paymentMethods:e,customCallback:t,cardFormModules:r,cardSettings:n,formMap:i});const o=n.get("security_code"),a=vo(To,this).get(qi);a&&a.update({settings:o});const s=n.get("card_number"),c=vo(To,this).get(zi);c&&c.update({settings:s})}update({field:e,properties:t,fieldSettings:r}){const n=vo(To,this).get(vo(No,this).call(this,e));n?n.update(t):super.update({field:e,properties:t,fieldSettings:r})}}class Lo{constructor(){}static build({coreModules:e,iframe:t,productId:r}){return t?new Do(e,r):new Si(e,r)}}function xo(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Uo(e,t){return e.get($o(e,t))}function jo(e,t,r){return e.set($o(e,t),r),r}function $o(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}let Wo;var zo=new WeakMap,qo=new WeakMap,Vo=new WeakMap,Bo=new WeakMap,Go=new WeakMap,Yo=new WeakMap,Ko=new WeakMap,Ho=new WeakMap,Xo=new WeakMap,Jo=new WeakMap,Zo=new WeakMap,Qo=new WeakMap,ea=new WeakMap,ta=new WeakMap,ra=new WeakMap,na=new WeakMap,ia=new WeakMap,oa=new WeakMap,aa=new WeakMap,sa=new WeakMap,ca=new WeakMap,da=new WeakMap,la=new WeakMap,ua=new WeakMap,pa=new WeakMap,ha=new WeakMap,ma=new WeakMap,fa=new WeakMap;class ga{constructor(e,t){if(xo(this,zo,void 0),xo(this,qo,void 0),xo(this,Vo,void 0),xo(this,Bo,void 0),xo(this,Go,void 0),xo(this,Yo,void 0),xo(this,Ko,void 0),xo(this,Ho,void 0),xo(this,Xo,void 0),xo(this,Jo,void 0),xo(this,Zo,void 0),xo(this,Qo,ys()),xo(this,ea,()=>{const e=Uo(Vo,this)?.get("cardNumber"),t=e?.element;Uo(Zo,this)||(({element:e,eventName:t})=>{const r=new Event(t);e.dispatchEvent(r)})({element:t,eventName:"input"})}),xo(this,ta,async()=>{let e,t,r;await Uo(Ho,this),Uo(ca,this).call(this);const n=Uo(Bo,this)?.onIdentificationTypesReceived;try{r=Uo(Bo,this)?.onFetching?.("identificationTypes");const e=await(Uo(qo,this)?.getIdentificationTypes());return t=e&&(e=>e.map(({id:e,name:t})=>({id:e,name:t})))(e),Uo(Yo,this)?.onReady({customCallback:Uo(Bo,this)?.onReady,data:{event:"onIdentificationTypesReceived"}}),Promise.resolve(t)}catch(t){e=t,n||console.warn("MercadoPago.js - Failed to get identification types. Use cardForm callbacks to intercept the error ",t);const r=us(e);Uo(Bo,this)?.onError?.(r,"onIdentificationTypesReceived"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.getIdentificationTypes: ${e.message}`})}finally{Uo(ma,this).call(this,r)&&r?.(),Uo(Yo,this)?.onIdentificationTypesReceived({error:e,customCallback:n,data:t})}}),xo(this,ra,e=>{jo(Jo,this,e)}),xo(this,na,async()=>{let e,t,r;await Uo(Ho,this),Uo(ca,this).call(this);const n=Uo(Bo,this)?.onPaymentMethodsReceived;try{r=Uo(Bo,this)?.onFetching?.("paymentMethods");const[e]=ci(["processingMode"]),n=await(Uo(qo,this)?.getPaymentMethods({bin:os(Uo(Jo,this)),processingMode:e,product_id:Uo(Qo,this)}));return t=n&&n.results.map(e=>{const{issuer:t,id:r,payment_type_id:n,thumbnail:i,marketplace:o,deferred_capture:a,agreements:s,labels:c,name:d,site_id:l,processing_mode:u,additional_info_needed:p,status:h,settings:m,merchant_account_id:f}=e;return{issuer:t,id:r,payment_type_id:n,thumbnail:i,marketplace:o,deferred_capture:a,agreements:s,labels:c,name:d,site_id:l,processing_mode:u,additional_info_needed:p,status:h,settings:m,card:"card"in e?e.card:void 0,merchant_account_id:f}}),Promise.resolve(t)}catch(t){e=t,n||console.warn("MercadoPago.js - Failed to get payment methods. Use cardForm callbacks to intercept the error ",t);const r=us(e);Uo(Bo,this)?.onError?.(r,"onPaymentMethodsReceived"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.getPaymentMethods: ${e.message}`})}finally{Uo(ma,this).call(this,r)&&r?.(),Uo(Yo,this)?.onPaymentMethodsReceived({error:e,customCallback:n,data:t,handler:Uo(Xo,this)})}}),xo(this,ia,async()=>{let e,t,r;await Uo(Ho,this),Uo(ca,this).call(this);const n=Uo(Bo,this)?.onIssuersReceived;try{r=Uo(Bo,this)?.onFetching?.("issuers");const[e]=ci(["paymentMethods"]),n=await(Uo(qo,this)?.getIssuers({paymentMethodId:e,bin:os(Uo(Jo,this)),product_id:Uo(Qo,this)}));return t=n&&n.map(({id:e,name:t,thumbnail:r,processing_mode:n,merchant_account_id:i})=>({id:e,name:t,thumbnail:r,processing_mode:n,merchant_account_id:i})),Promise.resolve(t)}catch(t){e=t,n||console.warn("MercadoPago.js - Failed to get issuers. Use cardForm callbacks to intercept the error ",t);const r=us(e);Uo(Bo,this)?.onError?.(r,"onIssuersReceived"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.getIssuers: ${e.message}`})}finally{Uo(ma,this).call(this,r)&&r?.(),Uo(Yo,this)?.onIssuersReceived({error:e,customCallback:n,data:t})}}),xo(this,oa,async()=>{let e,t,r;await Uo(Ho,this),Uo(ca,this).call(this);const n=Uo(Bo,this)?.onInstallmentsReceived;try{r=Uo(Bo,this)?.onFetching?.("installments");const e=Tt.getContext("cardSettings"),[n]=ci(["processingMode"]),i=await(Uo(qo,this)?.getInstallments({amount:Uo(Go,this)?.get("amount"),bin:os(Uo(Jo,this)),processingMode:n,paymentTypeId:e.get("payment_type_id"),product_id:Uo(Qo,this)}));if(!i)throw new Error("No installments found");return t=(e=>{const{payer_costs:t,merchant_account_id:r=""}=e[0];return{merchant_account_id:r,payer_costs:t.map(({installments:e,installment_rate:t,discount_rate:r,reimbursement_rate:n,labels:i,min_allowed_amount:o,max_allowed_amount:a,recommended_message:s,installment_amount:c,total_amount:d,installment_rate_collector:l,payment_method_option_id:u})=>({installments:String(e),installment_rate:t,discount_rate:r,reimbursement_rate:n,labels:i,min_allowed_amount:o,max_allowed_amount:a,recommended_message:s,installment_amount:c,total_amount:d,payment_method_option_id:u,installment_rate_collector:l}))}})(i),Promise.resolve(t)}catch(t){e=t,n||console.warn("MercadoPago.js - Failed to get installments. Use cardForm callbacks to intercept the error ",t);const r=us(e);Uo(Bo,this)?.onError?.(r,"onInstallmentsReceived"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.getInstallments: ${e.message}`})}finally{Uo(ma,this).call(this,r)&&r?.(),Uo(Yo,this)?.onInstallmentsReceived({error:e,customCallback:n,data:t})}}),xo(this,aa,()=>{Uo(Vo,this)?.forEach(({hidden:e},t)=>{Uo(Xo,this).createField(t,e,Uo(Vo,this))})}),xo(this,sa,()=>{Uo(Vo,this)?.forEach(({element:e,listeners:t})=>{e&&t&&t.forEach(t=>{t.event.forEach(r=>e.removeEventListener(r,t.fn))})})}),xo(this,ca,()=>{if(!Uo(zo,this))throw new Error("MercadoPago.js - CardForm is not mounted")}),xo(this,da,()=>{jo(Ko,this,()=>{this.mount(),document.removeEventListener("DOMContentLoaded",Uo(Ko,this))}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Uo(Ko,this)):this.mount()}),xo(this,la,()=>{Uo(pa,this).call(this),Uo(ha,this).call(this),jo(Yo,this,new _i({waitFieldsReady:Uo(Zo,this)})),Tt.createContext("internalCallbacks",{onReady:Uo(Yo,this)?.onReady.bind(Uo(Yo,this))})}),xo(this,ua,()=>{Uo(Xo,this).destroyCardForm(Uo(Vo,this)),jo(Yo,this,void 0)}),xo(this,pa,()=>{Tt.createContext("cardSettings"),Tt.createContext("customCallbacks",Uo(Bo,this)),Tt.createContext("cardFormModules",{getIdentificationTypes:Uo(ta,this).bind(this),getInstallments:Uo(oa,this).bind(this),getIssuers:Uo(ia,this).bind(this),getPaymentMethods:Uo(na,this).bind(this),setBin:Uo(ra,this).bind(this),createCardToken:this.createCardToken.bind(this),getCardFormData:this.getCardFormData.bind(this)}),Tt.createContext("bin",{bin:""})}),xo(this,ha,()=>{const e=document.createDocumentFragment();Object.values(ti).forEach(t=>{const r=document.createElement("input");r.setAttribute("id",`${ei}${oi(t)}`),r.setAttribute("name",`${ei}${oi(t)}`),r.setAttribute("type","hidden"),"processingMode"===t&&r.setAttribute("value",Uo(Go,this)?.get("processingMode")),e.appendChild(r)});const t=Uo(Vo,this)?.get("form")?.id,r=document.getElementById(t);r?.appendChild(e)}),xo(this,ma,e=>!(!e||"function"!=typeof e&&(console.warn("MercadoPago.js - The return value of onFetching callback must be a function"),gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"card_form",critical:!1,details:"CardForm.validateFetchCallback: onFetching is not a function"}),1))),xo(this,fa,e=>{const t={};["expirationDate","expirationMonth","expirationYear"].filter(t=>Boolean(e[t])).forEach(r=>{const n=`card${r?.charAt(0).toUpperCase()}${r.slice(1)}`;e[n]=e[r],t[r]=!0,delete e[r]}),Tt.createContext("expirationFields",t)}),Wo)return console.warn("MercadoPago.js - Cardform already instantiated. Returning existing instance..."),Wo;jo(Ho,this,t);const r={...e.form};Uo(fa,this).call(this,r);const n=(e=>{const t=new ls;return ni.forEach(({name:r,type:n,required:i,path:o,acceptedValues:a,isAllowed:s})=>{const c="root"===o?e[r]:e[o]?.[r],d="object"==typeof c?c.id:c,l=typeof d,u=s(e);!d&&u&&i&&t.addError({...xa.default,description:`Required field "${r}" is missing`}),d&&!u&&t.addError({...xa[r].allowed,description:`Field "${r} is not allowed with this configuration"`}),d&&l!==n&&t.addError({...xa.default,description:`Type of ${r} must be ${n}. Received ${l}`}),d&&a&&!a.includes(d)&&t.addError({...xa.default,description:`Invalid option value "${d}". Available option(s): ${a.join(" or ")}`})}),t.getErrors()})({...e,form:r});if(n.length)throw n;const{amount:i,autoMount:o=!0,processingMode:a=ht,callbacks:s={},iframe:c=!1}=e;jo(Go,this,Tt.createContext("cardFormOptions",{amount:i,processingMode:a})),jo(Vo,this,Tt.createContext("formMap",wa(r))),jo(Bo,this,s),jo(qo,this,new Fa({services:new tr})),jo(Zo,this,c),Uo(la,this).call(this),jo(Xo,this,Lo.build({coreModules:Uo(qo,this),iframe:c,productId:Uo(Qo,this)})),o&&Uo(da,this).call(this),mt.setIframeEnabled(Uo(Zo,this)),Wo=this}mount(){if(Uo(zo,this))throw new Error("CardForm already mounted");let e;try{Uo(aa,this).call(this),jo(zo,this,!0),Uo(ea,this).call(this),Uo(Yo,this)?.onReady({customCallback:Uo(Bo,this)?.onReady,data:{event:"onMount"}})}catch(t){e=t;const r=us(e);Uo(Bo,this)?.onError?.(r,"onFormMounted"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.mount: ${e.message}`})}finally{const t=Uo(Bo,this)?.onFormMounted;Uo(Yo,this)?.onFormMounted({error:e,customCallback:t}),document.removeEventListener("DOMContentLoaded",Uo(Ko,this))}}unmount(){let e;Uo(ca,this).call(this);try{Uo(sa,this).call(this),Uo(ua,this).call(this),Tt.destroyContexts(),jo(Go,this,void 0),jo(Vo,this,void 0),jo(qo,this,void 0),jo(zo,this,!1),Wo=void 0}catch(t){e=t;const r=us(e);Uo(Bo,this)?.onError?.(r,"onFormUnmounted"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.unmount: ${e.message}`})}finally{Uo(Bo,this)?.onFormUnmounted?.(e),jo(Bo,this,void 0)}}submit(){Uo(ca,this).call(this);try{const e=Uo(Vo,this)?.get("form"),t=e?.element;return t.requestSubmit()}catch(e){throw gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.submit: ${e.message}`}),new Error(`MercadoPago.js - Error submitting form : ${e.message}`)}}update(e,t){if("string"!=typeof e)return console.warn("MercadoPago.js - Error updating: field parameter should be a string. Ignoring..."),void gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"card_form",critical:!1,details:"CardForm.update: field parameter should be a string"});const r=Uo(Vo,this)?.get(e);if(!r)return void console.warn(`MercadoPago.js - Error updating field ${e}: not found. Ignoring...`);const{placeholder:n=r.placeholder,style:i=r.style}=t;Uo(Vo,this)?.set(e,{...r,placeholder:n,style:i}),Uo(Xo,this).update({field:e,properties:t,fieldSettings:r})}async createCardToken(){let e,t,r;await Uo(Ho,this),Uo(ca,this).call(this);const n=Uo(Bo,this)?.onCardTokenReceived;try{r=Uo(Bo,this)?.onFetching?.("cardToken");const e=await(Uo(Xo,this)?.getTokenRaw?.());return t=e&&(e=>({token:e.id}))(e),gs.send({path:"/card_form/create_card_token",type:gs.TRACK_TYPE_EVENT,eventData:{is_iframe:mt.getIframeEnabled()}}),Promise.resolve(t)}catch(t){e=t,n||console.warn("MercadoPago.js - Failed to create card token. Use cardForm callbacks to intercept the error ",t);const r=us(e);return Uo(Bo,this)?.onError?.(r,"onCardTokenReceived"),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:`CardForm.createCardToken: ${e.message}`}),Promise.reject(t)}finally{Uo(ma,this).call(this,r)&&r?.(),Uo(Yo,this)?.onCardTokenReceived({error:e,customCallback:n,data:t})}}getCardFormData(){let e;Uo(ca,this).call(this);try{const[t,r,n,i,o,a,s,c,d]=ci(["installments","identificationType","identificationNumber","issuer","paymentMethods","token","processingMode","merchantAccountId","cardholderEmail"]),l=Uo(Go,this)?.get("amount");return e={amount:l,paymentMethodId:o,token:a,issuerId:i,installments:t,identificationType:r,identificationNumber:n,processingMode:s,merchantAccountId:c,cardholderEmail:d},e}catch(e){return gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"card_form",critical:!1,details:"CardForm.getCardFormData: Preparing cardform data"}),e}}}const wa=({id:e,...t})=>{const{PAYMENT_METHOD:r,TOKEN:n,PROCESSING_MODE:i,MERCHANT_ACCOUNT_ID:o}=ti;return{form:{id:e},paymentMethods:{id:`${ei}${oi(r)}`,hidden:!0},token:{id:`${ei}${oi(n)}`,hidden:!0},processingMode:{id:`${ei}${oi(i)}`,hidden:!0},merchantAccountId:{id:`${ei}${oi(o)}`,hidden:!0},...t}},ya=(e,t)=>e&&"string"!=typeof e?{...e,clientScope:"prod"===t||"lts"===t?"prod":"beta"}:e;function Ea(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function _a(e,t){return e.get(va(e,t))}function ba(e,t,r){return e.set(va(e,t),r),r}function va(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Aa=new WeakMap,Ia=new WeakMap,Pa=new WeakMap,Ta=new WeakMap,ka=new WeakMap;class Ma{constructor({field:e,options:t,metadata:r}){Ea(this,Aa,void 0),Ea(this,Ia,void 0),Ea(this,Pa,void 0),Ea(this,Ta,void 0),Ea(this,ka,void 0),(({field:e,createdFields:t,group:r})=>{const n=_o({field:e,group:r});if(t.includes(n)){const t=`[Fields] The field ${e} has already been created${r?" on group "+r:""}`;throw gs.sendFrontendMetricsError({name:ps.CONTEXT_ALREADY_EXISTS,product:"fields",critical:!1,details:`ValidationHelper.validateFieldType: The field ${e} has already been created${r?" on group "+r:""}`}),new Error(t)}})({field:e,createdFields:r.getFieldsType(),group:t?.group}),ba(Aa,this,r),ba(Ia,this,(({field:e,options:t={}})=>{const{placeholder:r,style:n,customFonts:i,mode:o,enableLuhnValidation:a,srLabel:s,ariaRequired:c}=t;return{type:e,style:n,placeholder:r,customFonts:i,mode:o,enableLuhnValidation:a,srLabel:s,ariaRequired:c}})({field:e,options:t})),ba(Pa,this,!1),ba(Ta,this,new co),ba(ka,this,t?.group||"")}mount(e){if(_a(Pa,this))throw new Error(`Field '${_a(Ia,this).type}' already mounted`);try{const t=document.getElementById(e);if(!t)throw new Error("Container not found");const r=_a(Ta,this).createIFrame(_a(Ia,this),_a(Aa,this).getFieldsType(),_a(ka,this));_a(Ta,this).appendIFrameToContainer({iFrame:r,container:t}),_a(Aa,this).addField({iFrame:r,isPrimary:!1,type:_o({field:_a(Ia,this).type,group:_a(ka,this)})}),_a(Aa,this).getPrimaryField()||(fo(_a(Aa,this).getFields()),eo.addWindowEventListener()),ba(Pa,this,!0)}catch(t){const r=t,n=`MercadoPago.js - Error when mounting field ${e}: ${r.message}`;console.warn(n),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"fields",critical:!1,details:`Fields.mount: ${r.message}`}),setTimeout(()=>{eo.triggerEvent("error",{field:_a(Ia,this).type,error:n})})}return this}unmount(){if(!_a(Pa,this))throw new Error(`Field '${_a(Ia,this).type}' already unmounted`);try{const e=_a(Aa,this).getFields().find(e=>e.type===_o({field:_a(Ia,this).type,group:_a(ka,this)}));if(!e)throw new Error("Field not found");const t=_a(Aa,this).getPrimaryField(),r=t?.type===_a(Ia,this).type,{iFrame:n}=e;_a(Ta,this).removeIFrameFromContainer({iFrame:n}),_a(Ta,this).removeIframeEventListeners(),eo.removeCustomEventListeners(function({iframeName:e,separator:t=yo}){return t?e.split(t)[0]:e}({iframeName:e.type}));const i=_a(Aa,this).removeField({field:e});i.length||eo.removeWindowEventListener(),r&&i.length&&fo(i),ba(Pa,this,!1)}catch(e){const t=e,r=`MercadoPago.js - Error when unmounting field ${_a(Ia,this).type}: ${t.message}`;console.warn(r),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"fields",critical:!1,details:`Fields.unmount: ${t.message}`}),setTimeout(()=>{eo.triggerEvent("error",{field:_a(Ia,this).type,error:r})})}}on(e,t){try{(({field:e,event:t,fn:r})=>{if(![...Yi[e],...Yi.default].includes(t)){const r=`[Fields] ${t} event is not valid for ${e}`;throw gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"fields",critical:!1,details:`ValidationHelper.validateAllowedEvents: ${t} event is not valid for ${e}`}),new Error(r)}if("function"!=typeof r){const t=`[Fields] You must pass a function arg for ${e}`;throw gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"fields",critical:!1,details:`ValidationHelper.validateAllowedEvents: You must pass a function arg for ${e}`}),new Error(t)}})({field:_a(Ia,this).type,event:e,fn:t}),eo.addCustomEventListener({field:_a(Ia,this).type,event:e,group:_a(ka,this),fn:t})}catch(e){console.warn(`MercadoPago.js - Error when adding on function : ${e.message}`),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"fields",critical:!1,details:`Fields.on: ${e.message}`})}return this}update(e){this.dispatchEvent({eventName:"update",properties:e})}focus(){this.dispatchEvent({eventName:"focus"})}blur(){this.dispatchEvent({eventName:"blur"})}dispatchEvent({eventName:e,properties:t}){const r=_a(Aa,this).getFields(),n=_a(Ia,this).type,i=r.find(e=>e.type===_o({field:n,group:_a(ka,this)}));if(!i)return console.warn(`MercadoPago.js - Error on ${e} event on ${n}: not found. Ignoring...`),void gs.sendFrontendMetricsError({name:ps.FIELD_NOT_FOUND,product:"fields",critical:!1,details:`Fields.dispatchEvent: Field to ${e}: ${n} not found`});i.iFrame.contentWindow?.postMessage({message:e,field:n,options:{group:_a(ka,this)},createdFields:_a(Aa,this).getFieldsType(),...t&&{properties:t}||{}},Ji())}static getCardToken({metadata:e,nonPCIData:t,options:r}){const n=e.getPrimaryField();if(!n)return gs.sendFrontendMetricsError({name:ps.NO_PRIMARY_FIELD,product:"fields",critical:!1,details:"Fields.getCardToken: No primary field found"}),Promise.reject({message:"No primary field found. Please create and mount one before calling 'createCardToken'. Ignoring call..."});if(!wo(e))return gs.sendFrontendMetricsError({name:ps.EXPIRATION_CONFLICT,product:"fields",critical:!1,details:"Fields.getCardToken: Received expirationDate and expirationMonth together"}),Promise.reject({message:"You must create 'expirationDate' alone or 'expirationMonth' and 'expirationYear' together"});const i=Xa({methodName:"createCardToken",incomingParams:t});return i.length?(console.warn("MercadoPago.js - Form could not be submitted",i),i.map(e=>{gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"fields",critical:!1,details:`Fields.getCardToken: ${e.message}`})}),Promise.reject(i)):new Promise((i,o)=>{if(n.iFrame.contentWindow){const a=new MessageChannel;a.port1.onmessage=({data:e})=>{a.port1.close(),e.error?o(e.error):i(e)},n.iFrame.contentWindow.postMessage({message:"createCardToken",createdFields:e.getFieldsType(),nonPCIData:Kt(t),query:{public_key:mt.getPublicKey(),locale:mt.getLocale(),js_version:"2.83.6",referer:_t},isMobile:mr(),options:ya(r,"prod")},Ji(),[a.port2])}else o({message:"Error trying to create cardToken: The iFrame does not have a window"}),gs.sendFrontendMetricsError({name:ps.MESSAGE_CHANNEL_ERROR,product:"fields",critical:!0,details:"Fields.getCardToken: Error to init message channel"})})}static updateCardToken({token:e,metadata:t,options:r}){const n=t.getPrimaryField();return n?wo(t)?e?new Promise((i,o)=>{if(n.iFrame.contentWindow){const a=new MessageChannel;a.port1.onmessage=({data:e})=>{a.port1.close(),e.error?o(e.error):i(e)},n.iFrame.contentWindow.postMessage({message:"updateCardToken",createdFields:t.getFieldsType(),token:e,query:{public_key:mt.getPublicKey(),locale:mt.getLocale(),js_version:"2.83.6",referer:_t},isMobile:mr(),options:ya(r,"prod")},Ji(),[a.port2])}else o({message:"Error trying to create cardToken: The iFrame does not have a window"}),gs.sendFrontendMetricsError({name:ps.MESSAGE_CHANNEL_ERROR,product:"fields",critical:!0,details:"Fields.updateCardToken: Error to init message channel"})}):(gs.sendFrontendMetricsError({name:ps.MISSING_TOKEN,product:"fields",critical:!1,details:"Fields.updateCardToken: Token to update not received"}),Promise.reject({message:"You must send token to update"})):(gs.sendFrontendMetricsError({name:ps.EXPIRATION_CONFLICT,product:"fields",critical:!1,details:"Fields.updateCardToken: Received expirationDate and expirationMonth together"}),Promise.reject({message:"You must create 'expirationDate' alone or 'expirationMonth' and 'expirationYear' together"})):(gs.sendFrontendMetricsError({name:ps.NO_PRIMARY_FIELD,product:"fields",critical:!1,details:"Fields.updateCardToken: No primary field found"}),Promise.reject({message:"No primary field found. Please create and mount one before calling 'createCardToken'. Ignoring call..."}))}}const Ca=({authorization:e,sessionId:t})=>({Authorization:`Bearer ${e}`,"X-Session-Id":t});function Oa(e){return e?Array.isArray(e)?e.map(e=>({id:e.id,type:e.type,last_four_digits:"card"in e?e.card.card_number.last_four_digits:"NOT_APPLY"})):e.data?.length?e.data.map(e=>({id:e.id,type:e.type,last_four_digits:"card"in e?e.card.card_number.last_four_digits:"NOT_APPLY",should_ask_security_code:"security_code_settings"in e&&"mandatory"===e.security_code_settings.mode})):[]:[]}const Ra=[];function Na(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Sa=e=>{try{const t=JSON.parse(atob(e))?.headers;return Jn.forSession(t?.sessionId,t?.authorization)}catch{return Jn}};class Fa{constructor({services:e}){Na(this,"services",void 0),Na(this,"fields",{create:(e,t,r)=>new Ma({field:e,options:r,metadata:t}),createCardToken:(e,t,r)=>Ma.getCardToken({metadata:t,nonPCIData:e,options:r}),updateCardToken:(e,t,r)=>Ma.updateCardToken({token:e,metadata:t,options:r})}),this.services=e}async getIdentificationTypes(){try{return await this.services.getIdentificationTypes()}catch(e){return console.error("failed to get identification types",e),gs.sendFrontendMetricsError({name:ps.EXTERNAL_SERVICE_ERROR,product:"core_methods",critical:!0,details:"Modules.getIdentificationTypes"}),Promise.reject(e)}}async getPaymentMethods(e){const t=Xa({methodName:"getPaymentMethods",incomingParams:e});if(t.length>0)throw t;const{bin:r,processingMode:n=ht,...i}=e;try{return await this.services.getPaymentMethods({bins:as(r),processing_mode:n,...i})}catch(e){return console.error("failed to get payment methods",e),gs.sendFrontendMetricsError({name:ps.EXTERNAL_SERVICE_ERROR,product:"core_methods",critical:!0,details:"Modules.getPaymentMethods"}),Promise.reject(e)}}async getAccountPaymentMethods(e){const t=Sa(e);try{const r=La(e);if(r.length>0)throw t.sendError(qn.PAYMENT_METHODS,{payment_methods:[],error_critical:!1,error_name:wn.MalformedToken}),r;const n=JSON.parse(atob(e)),i=Xa({methodName:"getAccountPaymentMethods",incomingParams:n.params||{}}),o=Qa({methodName:"getAccountPaymentMethods",incomingHeaders:n.headers||{}});if(i.length>0||o.length>0)throw t.sendError(qn.PAYMENT_METHODS,{payment_methods:[],error_critical:!1,error_name:wn.MalformedToken}),[...i,...o];const a=Ca(n.headers),s=e=>e.data.some(e=>"has_esc"in e&&!0===e.has_esc),c=Ra.includes(mt.getSiteId()),d=async(e=1)=>{const t=await this.services.getAccountPaymentMethods(n.params,a);return c&&!s(t)&&e<3?(await new Promise(e=>setTimeout(e,200)),d(e+1)):t},l=await Qn(t)("supertoken_payment_methods_fetch",()=>d());return t.send(qn.PAYMENT_METHODS,{payment_methods:Oa(l),platform_id:t.getPlatformId()}),l}catch(e){return t.sendError(qn.PAYMENT_METHODS,{payment_methods:[],error_critical:!0,error_name:"API_REQUEST_FAILED"}),Promise.reject({message:"[MERCADO PAGO]: Error while fetching account payment methods",details:e?.errors||e,errorCode:"API_REQUEST_FAILED"})}}async getFastPaymentsAccountPaymentMethods(e,t){const r=Sa(e);try{const n=La(e);if(n.length>0)throw r.sendError(qn.PAYMENT_METHODS,{payment_methods:[],error_critical:!1,error_name:wn.MalformedToken}),n;const{headers:i}=JSON.parse(atob(e)),o=Qa({methodName:"getAccountPaymentMethods",incomingHeaders:i||{}});if(o.length>0)throw r.sendError(qn.PAYMENT_METHODS,{payment_methods:[],error_critical:!1,error_name:wn.MalformedToken}),o;const a=await Qn(r)("supertoken_payment_methods_fetch",()=>this.services.getFastPaymentsAccountPaymentMethods(t,Ca(i)));return r.send(qn.PAYMENT_METHODS,{payment_methods:Oa(a),platform_id:r.getPlatformId()}),a}catch(e){const t=e?.status,n="number"==typeof t?t:0;return r.sendError(qn.PAYMENT_METHODS,{payment_methods:[],error_critical:!0,error_name:"API_REQUEST_FAILED"}),Promise.reject({message:"[MERCADO PAGO]: Error while fetching account payment methods",details:e?.errors||e,errorCode:"API_REQUEST_FAILED",status:n})}}async getAccountPaymentMethod(e,t){const r=Sa(e);try{const n=La(e);if(n.length>0)throw r.sendError(qn.PAYMENT_METHOD,{error_critical:!1,error_name:wn.MalformedToken}),n;const{headers:i}=JSON.parse(atob(e)),o=Qa({methodName:"getAccountPaymentMethod",incomingHeaders:i||{}}),a=Ja({methodName:"getAccountPaymentMethod",incomingPath:{pseudotoken:t}});if(o.length>0||a.length>0)throw r.sendError(qn.PAYMENT_METHOD,{error_critical:!1,error_name:wn.MalformedToken}),[...o,...a];const s=Ca(i),c=e=>{const t=e.data;return"security_code_settings"in t&&!0===t.has_esc&&"mandatory"===t.security_code_settings?.mode},d=async(e=1)=>{const r=await this.services.getAccountPaymentMethod(t,s);return c(r)&&e<10?(await new Promise(e=>setTimeout(e,1e3)),d(e+1)):r};return await d()}catch(e){return Array.isArray(e)||r.sendError(qn.PAYMENT_METHOD,{error_critical:!0,error_name:"API_REQUEST_FAILED"}),Promise.reject({message:"[MERCADO PAGO]: Error while fetching account payment method",details:e?.errors||e,errorCode:"API_REQUEST_FAILED"})}finally{this.getAccountPaymentMethods(e).catch(()=>{})}}async getCardId(e,t){try{const r=La(e);if(r.length>0)throw r;const{headers:{authorization:n}}=JSON.parse(atob(e)),i={authorization:n,publicKey:mt.getPublicKey()},o=Ja({methodName:"getCardId",incomingPath:{pseudotoken:t}}),a=Qa({methodName:"getCardId",incomingHeaders:i||{}});if(o.length>0||a.length>0)throw gs.sendError({type:gs.TRACK_TYPE_EVENT,eventData:{type:gs.ERROR_TYPE_CRITICAL,origin:"Modules.getCardId",reason:"parameters error"}}),[...o,...a];return await this.services.getCardId(t,(({authorization:e,publicKey:t})=>({Authorization:`Bearer ${e}`,"X-Public-key":t}))(i))}catch(e){return gs.sendError({type:gs.TRACK_TYPE_EVENT,eventData:{type:gs.ERROR_TYPE_CRITICAL,origin:"Modules.getCardId",reason:"external service error"}}),Promise.reject({message:"[MERCADO PAGO]: Error while getting card id",details:e?.errors||e,errorCode:"API_REQUEST_FAILED"})}}async updatePseudotoken(e,t,r){try{const n=La(e);if(n.length>0)throw n;const{headers:{authorization:i}}=JSON.parse(atob(e)),o={authorization:i,publicKey:mt.getPublicKey()},a={id:r},s=Ja({methodName:"updatePseudotoken",incomingPath:{pseudotoken:t}}),c=Qa({methodName:"updatePseudotoken",incomingHeaders:o||{}}),d=Za({methodName:"updatePseudotoken",incomingBody:a||{}});if(s.length>0||c.length>0||d.length>0)throw gs.sendError({type:gs.TRACK_TYPE_EVENT,eventData:{type:gs.ERROR_TYPE_CRITICAL,origin:"Modules.updatePseudotoken",reason:"parameters error"}}),[...s,...c,...d];return await this.services.updatePseudotoken(t,(({authorization:e,publicKey:t})=>({Authorization:`Bearer ${e}`,"X-Public-key":t}))(o),a)}catch(e){return gs.sendError({type:gs.TRACK_TYPE_EVENT,eventData:{type:gs.ERROR_TYPE_CRITICAL,origin:"Modules.updatePseudotoken",reason:"external service error"}}),Promise.reject({message:"[MERCADO PAGO]: Error while updating pseudotoken",details:e?.errors||e,errorCode:"API_REQUEST_FAILED"})}}async getIssuers(e){const t=Xa({methodName:"getIssuers",incomingParams:e});if(t.length>0)throw t;const{bin:r,paymentMethodId:n,product_id:i=mt.getProductId(),...o}=e;try{return await this.services.getIssuers({bin:as(r),payment_method_id:n,product_id:i,...o})}catch(e){return console.error("failed to get issuers",e),gs.sendFrontendMetricsError({name:ps.EXTERNAL_SERVICE_ERROR,product:"core_methods",critical:!0,details:"Modules.getIssuers"}),Promise.reject(e)}}async getInstallments(e){const t=Xa({methodName:"getInstallments",incomingParams:e});if(t.length>0)throw t;const{bin:r,processingMode:n=ht,paymentTypeId:i="",product_id:o=mt.getProductId(),...a}=e;try{return await this.services.getInstallments({bin:as(r),processing_mode:n,payment_type_id:i,product_id:o,...a})}catch(e){return console.error("failed to get installments",e),gs.sendFrontendMetricsError({name:ps.EXTERNAL_SERVICE_ERROR,product:"core_methods",critical:!0,details:"Modules.getInstallments"}),Promise.reject(e)}}async createCardToken(e,t){if(!ns())return Promise.reject("MercadoPago.js - Your payment cannot be processed because the website contains credit card data and is not using a secure connection.SSL certificate is required to operate.");const r=Xa({methodName:"createCardToken",incomingParams:e,validateFieldsParams:t});if(r.length>0)throw r;Da(e);try{return await this.services.createCardToken(e)}catch(e){return console.error("failed to create card token",e),gs.sendFrontendMetricsError({name:ps.EXTERNAL_SERVICE_ERROR,product:"core_methods",critical:!0,details:"Modules.createCardToken"}),Promise.reject(e)}}async updateCardToken(e,t){if(!ns())return Promise.reject("MercadoPago.js - Your payment cannot be processed because the website contains credit card data and is not using a secure connection.SSL certificate is required to operate.");const r=Xa({methodName:"updateCardToken",incomingParams:e,validateFieldsParams:t});if(r.length>0)throw r;Da(e);try{return await this.services.updateCardToken(e)}catch(e){return console.error("failed to update card token",e),gs.sendFrontendMetricsError({name:ps.EXTERNAL_SERVICE_ERROR,product:"core_methods",critical:!0,details:"Modules.updateCardToken"}),Promise.reject(e)}}async checkEligibility(e){try{return await this.services.checkEligibility(e,{publicKey:mt.getPublicKey(),instanceId:mt.getInstanceId(),deviceProfile:mt.getDeviceProfile(),uid:lr.getUid()})}catch{return!1}}async renderCreditsContract(e,t,r){const n=rs(e,t);if(n.length>0)throw n;try{return await this.services.createCreditsContract({containerId:e,options:t,bricks:r})}catch(e){return console.error("failed to render credits contract",e),gs.sendFrontendMetricsError({name:ps.RENDER_CREDITS_CONTRACT_FAILED,product:"core_methods",critical:!0,details:"Modules.renderCreditsContract"}),Promise.reject(e)}}}function Da(e){const t=e.cardExpirationYear;2===t?.length&&(e.cardExpirationYear=`20${t}`)}const La=e=>{try{if("object"!=typeof JSON.parse(atob(e)))throw new Error;return[]}catch(e){return[{...xa.default,description:"Expecting an valid base64 encoded JSON as argument"}]}},xa={amount:{empty:{code:"000",message:"parameter amount can not be null/empty"},invalid:{code:"000",message:"invalid parameter amount"}},id:{empty:{code:"000",message:"parameter id can not be null/empty"}},authorization:{empty:{code:"000",message:"parameter authorization can not be null/empty"},invalid:{code:"000",message:"invalid parameter authorization"}},sessionId:{empty:{code:"000",message:"parameter sessionId can not be null/empty"}},pseudotoken:{empty:{code:"000",message:"pseudotoken can not be null/empty"},invalid:{code:"000",message:"invalid parameter pseudotoken"}},publicKey:{empty:{code:"000",message:"parameter publicKey can not be null/empty"}},bin:{empty:{code:"000",message:"parameter bin can not be null/empty"},invalid:{code:"000",message:"invalid parameter bin"}},paymentMethodId:{empty:{code:"000",message:"parameter paymentMethodId can not be null/empty"},invalid:{code:"000",message:"invalid parameter paymentMethodId"}},processingMode:{empty:{code:"000",message:"parameter processingMode can not be null/empty"},invalid:{code:"000",message:"invalid parameter processingMode"}},cardNumber:{empty:{code:"205",message:"parameter cardNumber can not be null/empty"},invalid:{code:"E301",message:"invalid parameter cardNumber"}},cardExpirationMonth:{empty:{code:"208",message:"parameter cardExpirationMonth can not be null/empty"},invalid:{code:"325",message:"invalid parameter cardExpirationMonth"},allowed:{code:"XXX",message:"field cardExpirationMonth cannot coexist with cardExpirationDate"}},cardExpirationYear:{empty:{code:"209",message:"parameter cardExpirationYear can not be null/empty"},invalid:{code:"326",message:"invalid parameter cardExpirationYear"},allowed:{code:"XXX",message:"field cardExpirationYear cannot coexist with cardExpirationDate"}},cardExpirationDate:{allowed:{code:"XXX",message:"field cardExpirationDate cannot coexist with cardExpirationMonth or cardExpirationYear"}},identificationType:{empty:{code:"212",message:"parameter identificationType can not be null/empty"},invalid:{code:"322",message:"invalid parameter identificationType"}},identificationNumber:{empty:{code:"214",message:"parameter identificationNumber can not be null/empty"},invalid:{code:"324",message:"invalid parameter identificationNumber"}},cardIssuerId:{empty:{code:"220",message:"parameter cardIssuerId can not be null/empty"}},cardholderName:{empty:{code:"221",message:"parameter cardholderName can not be null/empty"},invalid:{code:"316",message:"invalid parameter cardholderName"}},securityCode:{empty:{code:"224",message:"parameter securityCode can not be null/empty"},invalid:{code:"E302",message:"invalid parameter securityCode"}},containerId:{empty:{code:"000",message:"parameter containerId can not be null/empty"},invalid:{code:"000",message:"invalid parameter containerId"}},supertoken:{empty:{code:"000",message:"parameter supertoken can not be null/empty"},invalid:{code:"000",message:"invalid parameter supertoken"}},textColor:{invalid:{code:"000",message:"invalid parameter textColor"}},textSize:{invalid:{code:"000",message:"invalid parameter textSize"}},linkColor:{invalid:{code:"000",message:"invalid parameter linkColor"}},default:{code:"default",message:"Another error"}},Ua=({required:e})=>({type:"string",required:e}),ja=({required:e})=>({type:"string",required:e}),$a=({required:e})=>({type:"string",required:e}),Wa=({required:e})=>({type:"string",required:e}),za=({required:e})=>({type:"string",required:e}),qa=e=>/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(e),Va={processingMode:({required:e})=>({type:"string",validateFn:e=>pt.includes(e),required:e}),bin:({required:e})=>({type:"string",validateFn:e=>/^\d{6,16}$/.test(e),required:e}),amount:({required:e})=>({type:"string",validateFn:e=>/([0-9]*[.])?[0-9]+/.test(e),required:e}),locale:({required:e})=>({type:"string",validateFn:e=>/^[a-z]{2}-[A-Z]{2}$/.test(e),required:e}),cardNumber:({required:e,allowedLengths:t})=>({type:"string",validateFn:e=>!isNaN(Number(e))&&(t&&t.length>0?t.includes(e.length):e.length>8&&e.length<19),required:e}),paymentMethodId:({required:e})=>({type:"string",required:e}),cardIssuerId:({required:e})=>({type:"string",required:e}),cardholderName:({required:e})=>({type:"string",validateFn:e=>/^[a-zA-Z0-9ãÃáÁàÀâÂäÄẽẼéÉèÈêÊëËĩĨíÍìÌîÎïÏõÕóÓòÒôÔöÖũŨúÚùÙûÛüÜçÇ'ñÑ .'-]*$/.test(e),required:e}),cardholderEmail:({required:e})=>({type:"string",validateFn:e=>qa(e),required:e}),identificationType:({required:e})=>({type:"string",required:e}),identificationNumber:({required:e})=>({type:"string",validateFn:e=>/^[a-zA-Z\d]*$/.test(e),required:e}),securityCode:({required:e})=>({type:"string",validateFn:e=>/^\d*$/.test(e),required:e}),cardExpirationMonth:({required:e})=>({type:"string",validateFn:e=>/(0[1-9]|1[0-2])/.test(e),required:e}),cardExpirationYear:({required:e})=>({type:"string",validateFn:e=>/^\d{2}(\d{2})?$/.test(e),required:e})},Ba={getCardId:()=>({pseudotoken:Ua({required:!0})}),updatePseudotoken:()=>({pseudotoken:Ua({required:!0})}),getAccountPaymentMethod:()=>({pseudotoken:Ua({required:!0})})},Ga={getAccountPaymentMethods:()=>({authorization:$a({required:!0}),sessionId:Wa({required:!0})}),getAccountPaymentMethod:()=>({authorization:$a({required:!0}),sessionId:Wa({required:!0})}),getCardId:()=>({authorization:$a({required:!0}),publicKey:za({required:!0})}),updatePseudotoken:()=>({authorization:$a({required:!0}),publicKey:za({required:!0})})},Ya={updatePseudotoken:()=>({id:ja({required:!0})})},Ka={getPaymentMethods:()=>({bin:Va.bin({required:!0}),processingMode:Va.processingMode({required:!1})}),getAccountPaymentMethods:()=>({amount:Va.amount({required:!0})}),getIssuers:()=>({paymentMethodId:Va.paymentMethodId({required:!0}),bin:Va.bin({required:!0})}),getInstallments:()=>({bin:Va.bin({required:!0}),amount:Va.amount({required:!0}),processingMode:Va.processingMode({required:!1}),locale:Va.locale({required:!1}),paymentMethodId:Va.paymentMethodId({required:!1}),cardIssuerId:Va.cardIssuerId({required:!1})}),createCardToken:(e,t)=>{const r=e?.get("additional_info_needed"),n=e?.get("security_code"),i=e?.get("card_number");return{cardNumber:Va.cardNumber({required:t?.cardNumber,allowedLengths:i?.allowedLengths}),cardholderName:Va.cardholderName({required:r?.includes("cardholder_name")}),cardholderEmail:Va.cardholderEmail({required:!1}),identificationType:Va.identificationType({required:r?.includes("cardholder_identification_type")}),identificationNumber:Va.identificationNumber({required:r?.includes("cardholder_identification_number")}),securityCode:Va.securityCode({required:"mandatory"===n?.mode&&t?.securityCode}),cardExpirationMonth:Va.cardExpirationMonth({required:t?.cardExpirationMonth}),cardExpirationYear:Va.cardExpirationYear({required:t?.cardExpirationYear})}},updateCardToken:(e,t)=>{const r=e?.get("security_code");return{securityCode:Va.securityCode({required:"mandatory"===r?.mode&&t?.securityCode}),cardExpirationMonth:Va.cardExpirationMonth({required:t?.cardExpirationMonth}),cardExpirationYear:Va.cardExpirationYear({required:t?.cardExpirationYear})}}},Ha=(e,t,r,n=[])=>{const i=new ls;return r?t&&"object"==typeof t?(Object.entries(r).forEach(([e,r])=>{const o=t[e];!o&&n.includes(e)||i.addErrors(es({field:e,value:o,config:r}))}),i.getErrors()):(i.addError({...xa.default,description:"Expecting an object as argument"}),i.getErrors()):(i.addError({...xa.default,description:`Could not find validation for ${e}`}),i.getErrors())},Xa=({methodName:e,incomingParams:t,validateFieldsParams:r})=>{const n=((e,t,r)=>Ka[e](t,r))(e,Tt.getContext("cardSettings"),r);return Ha(e,t,n,["identificationType","identificationNumber"])},Ja=({methodName:e,incomingPath:t})=>{const r=(e=>Ba[e]())(e);return Ha(e,t,r,[])},Za=({methodName:e,incomingBody:t})=>{const r=(e=>Ya[e]())(e);return Ha(e,t,r,[])},Qa=({methodName:e,incomingHeaders:t})=>{const r=(e=>Ga[e]())(e);return Ha(e,t,r,[])},es=({field:e,value:t,config:r})=>{const n=new ls;if(!r){const t=Va[e];if(!t)return n.addError({...xa.default,description:`Could not find validation for ${e}`}),n.getErrors();r=t({required:!0})}const{type:i,required:o,validateFn:a}=r,s=xa[e]?.invalid||xa.default,c=xa[e]?.empty||xa.default;return!t&&o?(n.addError(ts(c,e)),n.getErrors()):t?(t&&typeof t!==i&&n.addError(ts(s,e)),a&&!a(t)&&n.addError(ts(s,e)),n.getErrors()):n.getErrors()},ts=(e,t)=>{if(t.includes("cardE")){const r=Tt.getContext("expirationFields");if(!r)return e;const n=r.has(t.replace("cardE","e"))||r.has("expirationDate");e.message.includes("cardE")&&n&&(e.message=e.message.replace("cardE","e"))}return e},rs=(e,t)=>{const r=new ls;if("string"!=typeof e?r.addError({...xa.containerId.invalid,description:"Type of containerId must be string. Received "+typeof e}):e&&0!==e.trim().length||r.addError({...xa.containerId.empty,description:"containerId cannot be empty or whitespace"}),!t||"object"!=typeof t)return r.addError({...xa.default,description:"Expecting an object as options argument"}),r.getErrors();const{fastPaymentToken:n,pseudotoken:i,customization:o}=t;if("string"!=typeof n?r.addError({...xa.supertoken.invalid,description:"Type of fastPaymentToken must be string. Received "+typeof n}):n&&0!==n.trim().length?La(n).length>0&&r.addError({...xa.supertoken.invalid,description:"fastPaymentToken must be a valid base64 encoded JSON"}):r.addError({...xa.supertoken.empty,description:"fastPaymentToken cannot be empty"}),"string"!=typeof i?r.addError({...xa.pseudotoken.invalid,description:"Type of pseudotoken must be string. Received "+typeof i}):i&&0!==i.trim().length||r.addError({...xa.pseudotoken.empty,description:"pseudotoken cannot be empty"}),o&&"object"==typeof o){const{textColor:e,textSize:t,linkColor:n}=o;void 0!==e&&("string"!=typeof e?r.addError({...xa.textColor.invalid,description:"Type of textColor must be string. Received "+typeof e}):/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)||r.addError({...xa.textColor.invalid,description:"textColor must be a valid color format (hex)"})),void 0!==n&&("string"!=typeof n?r.addError({...xa.linkColor.invalid,description:"Type of linkColor must be string. Received "+typeof n}):/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(n)||r.addError({...xa.linkColor.invalid,description:"linkColor must be a valid color format (hex)"})),void 0!==t&&("string"!=typeof t?r.addError({...xa.textSize.invalid,description:"Type of textSize must be string. Received "+typeof t}):/^\d+(\.\d+)?(px)$/.test(t)||r.addError({...xa.textSize.invalid,description:"textSize must be a valid size format (px)"}))}return r.getErrors()},ns=()=>{const e=mt.getPublicKey();return"https:"===window?.location?.protocol||/^TEST/.test(e)},is=()=>{const e=document.querySelector("html");return e&&e.lang?e.lang:window.navigator?.language||window.navigator?.languages?.[0]||window.navigator?.browserLanguage||window.navigator?.userLanguage||window.navigator?.systemLanguage},os=e=>e.replace(/\D+/g,""),as=e=>e.slice(0,8),ss=new Map;let cs=!1;class ds extends Error{}class ls{constructor(){(function(e,t,r){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})(this,"errors",void 0),this.errors=[]}addError(e){this.errors.push(e)}getErrors(){return this.errors}addErrors(e){this.errors=[...this.errors,...e]}}function us(e){return"string"==typeof e?[{message:e}]:e instanceof ProgressEvent?[{message:"Failed to fetch"}]:Array.isArray(e)?e.map(({message:e})=>({message:e})):[{message:e?.message||"Unknown error"}]}let ps=function(e){return e.LOAD_BUNDLE_SCRIPT_FAILED="load_bundle_script_failed",e.LOAD_TRANSLATION_FAILED="load_translation_failed",e.LOAD_SITE_ID_FAILED="load_site_id_failed",e.EXTERNAL_SERVICE_ERROR="external_service_error",e.OPERATION_FAILED="operation_failed",e.LOAD_FAILED="load_failed",e.VALIDATION_ERROR="validation_error",e.NO_PRIMARY_FIELD="no_primary_field",e.EXPIRATION_CONFLICT="expiration_conflict",e.MESSAGE_CHANNEL_ERROR="message_channel_error",e.MISSING_TOKEN="missing_token",e.FIELD_NOT_FOUND="field_not_found",e.CONTEXT_ALREADY_EXISTS="context_already_exists",e.RENDER_CREDITS_CONTRACT_FAILED="render_credits_contract_failed",e.APPLE_PAY_INCOMPLETE_PAYMENT_DATA="apple_pay_incomplete_payment_data",e.APPLE_PAY_UNSUPPORTED_NETWORK="apple_pay_unsupported_network",e.APPLE_PAY_SDK_LOAD_FAILED="apple_pay_sdk_load_failed",e.APPLE_PAY_MERCHANT_VALIDATION_FAILED="apple_pay_merchant_validation_failed",e.APPLE_PAY_TOKENIZE_FAILED="apple_pay_tokenize_failed",e.APPLE_PAY_WALLETS_FETCH_FAILED="apple_pay_wallets_fetch_failed",e.APPLE_PAY_WALLETS_INVALID_RESPONSE="apple_pay_wallets_invalid_response",e.APPLE_PAY_WALLET_NOT_AVAILABLE="apple_pay_wallet_not_available",e.APPLE_PAY_NO_SUPPORTED_NETWORKS="apple_pay_no_supported_networks",e.GOOGLE_PAY_SDK_LOAD_FAILED="google_pay_sdk_load_failed",e.GOOGLE_PAY_NOT_AVAILABLE="google_pay_not_available",e.GOOGLE_PAY_WALLETS_FETCH_FAILED="google_pay_wallets_fetch_failed",e.GOOGLE_PAY_WALLETS_INVALID_RESPONSE="google_pay_wallets_invalid_response",e.GOOGLE_PAY_WALLET_NOT_AVAILABLE="google_pay_wallet_not_available",e.GOOGLE_PAY_NO_SUPPORTED_NETWORKS="google_pay_no_supported_networks",e.GOOGLE_PAY_TOKENIZE_FAILED="google_pay_tokenize_failed",e.USER_ENROLLED_EXCEPTION="user_enrolled_exception",e.CONCURRENT_SDK_INSTANTIATION_DETECTED="concurrent_sdk_instantiation_detected",e.SMART_TRANSFER_DISCARDED="smart_transfer_discarded",e}({});var hs;function ms(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class fs{}hs=fs,ms(fs,"tracker",void 0),ms(fs,"ERROR_TYPE_WARNING","warning"),ms(fs,"ERROR_TYPE_CRITICAL","critical"),ms(fs,"ERROR_TYPE_INTEGRATION","integration"),ms(fs,"TRACK_TYPE_VIEW","VIEW"),ms(fs,"TRACK_TYPE_EVENT","EVENT"),ms(fs,"init",({version:e,siteId:t})=>{try{const r={appName:"sdk_js",clientName:"sdk_js",version:e||"",siteId:t};hs.tracker=new hn(r)}catch(e){console.warn("Failed on init TrackerClient")}}),ms(fs,"setContext",({siteId:e,advancedFraudPrevention:t,locale:r,publicKey:n,version:i})=>{try{hs.tracker||hs.init({version:i,siteId:e}),hs.tracker.melidata().addContext({instance_id:mt.getInstanceId(),public_key:n,is_test_user:n.startsWith("TEST-"),locale:r||"",is_advanced_fraud_prevention_enabled:Boolean(t),user_agent:Gr(navigator.userAgent),hostname:_t})}catch{console.warn("Failed to set context on TrackerClient")}}),ms(fs,"send",({path:e,type:t,eventData:r})=>{try{hs.tracker?.melidata().send(`/checkout/api_integration${e}`,{type:t,event_data:r})}catch{console.warn("Failed to send track on TrackerClient")}}),ms(fs,"sendError",({type:e,eventData:t})=>{try{hs.tracker?.melidata().send("/checkout/api_integration/error",{type:e,event_data:t})}catch{console.warn("Failed to send track on TrackerClient")}}),ms(fs,"sendFrontendMetricsError",e=>{try{hs.tracker?.frontendMetrics().sendErrorMetric(e)}catch{console.warn("Failed to send frontend metrics error track on TrackerClient")}}),ms(fs,"sendFrontendMetricsPerformance",e=>{try{hs.tracker?.frontendMetrics().sendPerformanceMetric(e)}catch{console.warn("Failed to send frontend metrics performance track on TrackerClient")}});const gs=fs;let ws=function(e){return e.payment="payment_brick",e.cardPayment="card_payment_brick",e.wallet="wallet_brick",e.statusScreen="status_screen_brick",e.brand="brand_brick",e.confirmationBottomsheet="confirmation_bottomsheet_brick",e}({});const ys=e=>{const t=mr();let r=t?ut.PRODUCT_ID_MOBILE:ut.PRODUCT_ID_DESKTOP;return e===ws.cardPayment?r=t?ut.PRODUCT_ID_CARD_PAYMENT_BRICK_MOBILE:ut.PRODUCT_ID_CARD_PAYMENT_BRICK_DESKTOP:e&&((e,t=[ws.confirmationBottomsheet])=>{const r=new Set(t);return e.filter(e=>!r.has(e))})(Object.values(ws)).includes(e)&&(r=t?ut.PRODUCT_ID_GENERIC_BRICK_MOBILE:ut.PRODUCT_ID_GENERIC_BRICK_DESKTOP),r},Es=e=>ws[e]||"";function _s(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var bs=new WeakMap;class vs{constructor(){(function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)})(this,bs,void 0),function(e,t,r){e.set(_s(e,t),r)}(bs,this,new tr)}async getSiteId(e=!1){const t=await(r=bs,r.get(_s(r,this))).getPaymentMethods({limit:1});var r;if(0===t.results.length){if(e)throw new gr("validation_error");const t="Payment methods returned empty results";throw gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"bricks",critical:!0,details:`RemoteSiteIdApi.getSiteId: ${t}`}),new Error(t)}const n=t.results.find(e=>e.site_id)?.site_id;if(!n){if(e)throw new gr("load_failed");const t="Could not get valid siteId";throw gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"bricks",critical:!1,details:`RemoteSiteIdApi.getSiteId: ${t}`}),new Error(t)}return n}}function As(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Is=new WeakMap;class Ps{constructor(e){(function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)})(this,Is,void 0),function(e,t,r){e.set(As(e,t),r)}(Is,this,e)}getURL(e,t){const r=new URL((n=Is).get(As(n,this))+e);var n;return t?(Object.entries(t).forEach(([e,t])=>r.searchParams.append(e,t)),r.href):r.href}assignDefaultRequestOptions(e){return Object.assign({method:"GET",retry:!0,numOfRetries:3},e)}mapToHttpResponse(e){return Object.assign({},e)}async executeCall(e,t){try{const r=this.assignDefaultRequestOptions(t),n={...r};delete n.protectedWallet;const{retry:i=!1,numOfRetries:o}=r;let a=o||0;do{const t=await gt(this.getURL(e,r.queryParams),n);if(t.ok||this.isClientError(t.status))return this.mapToHttpResponse(t)}while(i&&--a>0);throw new Error(`Exceeded number of retries: ${o}`)}catch(e){if(t?.protectedWallet)throw new Error("Wallet initialization failed.");throw gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"bricks",critical:!1,details:`HttpClient.executeCall: ${e.message}`}),new Error(e.message)}}isClientError(e){return e>=400&&e<=499}}var Ts=r(606);const ks={test1:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},test2:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},test3:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},test4:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},test5:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},beta:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},gama:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},prod:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks"},lts:{assetsBaseUrl:"https://http2.mlstatic.com/frontend-assets/op-cho-bricks",apiBaseUrl:"https://api.mercadopago.com/bricks"},development:{assetsBaseUrl:"http://localhost:8081",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},development_bricks:{assetsBaseUrl:"http://localhost:8081",apiBaseUrl:"https://api.mercadopago.com/bricks/beta"},development_bricks_local:{assetsBaseUrl:"http://localhost:8081",apiBaseUrl:"http://localhost:8080/bricks"}};function Ms(){const e="prod",t=Ts.env.API_SOURCE;return ks[t?`${e}_${t}`:e]||ks.prod}function Cs(e){return String(e?"3.20.2":"3.18.6")}function Os(e){return`/build/${Cs(e)}`}function Rs(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Ns(e,t){return e.get(Ss(e,t))}function Ss(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Fs=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,xs=new WeakMap;class Us{constructor(){var e;Rs(this,Fs,void 0),Rs(this,Ds,"en"),Rs(this,Ls,["en","es","pt"]),Rs(this,xs,{"es-ar":"es-ar","es-cl":"es-cl","es-co":"es-co","es-mx":"es-mx","es-ve":"es","es-uy":"es-uy","es-pe":"es-pe","pt-br":"pt","en-us":"en"}),function(e,t,r){e.set(Ss(e,t),r)}(Fs,this,(e=Ms().assetsBaseUrl,new Ps(e)))}containsInLocales(e){return Object.keys(Ns(xs,this)).includes(e)}isFallbackLocale(e){return Ns(Ls,this).some(t=>t===e)}getFallbackLocale(e){for(let t=0;t<Ns(Ls,this).length;t++){const r=Ns(Ls,this)[t];if(e.startsWith(r))return r}return Ns(Ds,this)}validateLocale(e,t=!1){const r=e.toLowerCase().match(/^[a-z]{2}(-[a-z]{2})?$/),n=r?r[0]:"";let i;if(this.containsInLocales(n))i=Ns(xs,this)[n];else if(this.isFallbackLocale(n))i=n;else{i=this.getFallbackLocale(n);const e=`[BRICKS] The requested locale '${n}' is not supported. The selected fallback locale was '${i}'.`;t?console.warn("wallet_order_locale_fallback"):console.warn(e)}return i}async getTranslation(e,t,r,n=!1){const i=this.validateLocale(t,n),o=`${Os(r)}/i18n/${i}/${e}/index.json`,a=n?await Ns(Fs,this).executeCall(o,{method:"GET",protectedWallet:!0}):await Ns(Fs,this).executeCall(o);if(!a.ok){if(n)throw new gr("load_translation_failed");const t=`Could not fetch remote ${e} translation. Status: ${a.status}`;throw gs.sendFrontendMetricsError({name:ps.LOAD_TRANSLATION_FAILED,product:Es(e),critical:!0,details:`RemoteTranslationApi.getTranslation: ${t}`}),new Error(t)}return await a.json()}}function js(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const $s="2147483647";class Ws{constructor({id:e,src:t,styles:r,render:n=!0,container:i,showLoader:o=!0,hidden:a=!1,bodyOverflow:s=!0,closeButton:c=!1}){js(this,"id",void 0),js(this,"src",void 0),js(this,"hidden",void 0),js(this,"closeButton",void 0),js(this,"styles",void 0),js(this,"bodyOverflow",void 0),js(this,"showLoader",void 0),js(this,"spinner",void 0),js(this,"wrapper",void 0),js(this,"container",void 0),js(this,"el",void 0),this.id=e,this.src=t,this.hidden=a,this.closeButton=c,this.styles=r||{},this.bodyOverflow=s,this.showLoader=o,this.spinner=this.showLoader&&this.createSpinner(),this.wrapper=this.createWrapper(),this.el=null,this.container=i,this.attachStylesAndWrapper(),n&&(this.el=this.create(),this.render())}createWrapper(){const e=document.createElement("div");return e.classList.add(`mp-${this.id}-wrapper`),this.showLoader&&(e.innerHTML='\n        <svg class="mp-spinner" viewBox="25 25 50 50" >\n          <circle class="mp-spinner-path" cx="50" cy="50" r="20" fill="none" stroke-miterlimit="10" />\n        </svg>\n      '),e.setAttribute("style",this.styles.wrapper),e}create(){const e=document.createElement("iframe");return e.id=this.id,e.src=this.src,e.setAttribute("width","100%"),e.setAttribute("height","100%"),this.styles.iframe&&e.setAttribute("style",this.styles.iframe),e.frameBorder="0",e.setAttribute("transition","height 2s ease"),e}createSpinner(){const e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML="\n  @keyframes loading-rotate {\n    100% {\n      transform: rotate(360deg);\n    }\n  }\n\n  @keyframes loading-dash {\n    0% {\n      stroke-dasharray: 1, 200;\n      stroke-dashoffset: 0;\n    }\n    50% {\n      stroke-dasharray: 100, 200;\n      stroke-dashoffset: -20px;\n    }\n    100% {\n      stroke-dasharray: 89, 200;\n      stroke-dashoffset: -124px;\n    }\n  }\n\n  @keyframes loading-fade-in {\n    from {\n      opacity: 0;\n    }\n    to {\n      opacity: 1;\n    }\n  }\n\n  .mp-spinner {\n    position: absolute;\n    top: 100px;\n    left: 50%;\n    font-size: 70px;\n    margin-left: -35px;\n    animation: loading-rotate 2.5s linear infinite;\n    transform-origin: center center;\n    width: 1em;\n    height: 1em;\n  }\n\n  .mp-spinner-path {\n    stroke-dasharray: 1, 200;\n    stroke-dashoffset: 0;\n    animation: loading-dash 1.5s ease-in-out infinite;\n    stroke-linecap: round;\n    stroke-width: 2px;\n    stroke: #009ee3;\n  }\n",e}attachStylesAndWrapper(){this.spinner&&document.head.appendChild(this.spinner),this.container.appendChild(this.wrapper)}render(){return this.el||(this.el=this.create()),this.wrapper.appendChild(this.el),this.open(),this}getContentWindow(){return this.el?.ownerDocument?.documentElement.contains(this.el)?this.el.contentWindow:null}onLoad(e){return"function"==typeof e&&(this.el.onload=e),this}open(){if(this.wrapper.style["z-index"]=$s,this.wrapper.style.visibility="visible",this.wrapper.style.width="100%",this.wrapper.style.height="100%",this.wrapper.style.opacity=this.hidden?"0":"1",this.hidden=!1,this.bodyOverflow&&(document.body.style.overflow="hidden"),this.closeButton&&!this.wrapper.querySelector("span")&&!this.wrapper.querySelector("style")){const e=document.createElement("style"),t=document.createElement("span");e.setAttribute("type","text/css"),t.addEventListener("click",()=>window.postMessage({type:"close"},"*")),e.innerHTML='\n.close-button {\n  position: absolute;\n  right: 15px;\n  top: 15px;\n  width: 20px;\n  height: 20px;\n  opacity: 0.6;\n}\n\n.close-button:hover {\n  opacity: 1;\n}\n\n.close-button:before, .close-button:after {\n  position: absolute;\n  left: 15px;\n  content: " ";\n  height: 20px;\n  width: 2px;\n  background-color: #fff;\n}\n\n.close-button:before {\n  transform: rotate(45deg);\n}\n\n.close-button:after {\n  transform: rotate(-45deg);\n}\n',t.classList.add("close-button"),this.wrapper.appendChild(e),this.wrapper.appendChild(t)}}slideUp(){this.wrapper.style.opacity=1,this.el.style.bottom=0}remove(e){this.wrapper.style.opacity="0",window.setTimeout(()=>{this.el.parentNode?.removeChild(this.el),this.wrapper.style["z-index"]=`-${$s}`,this.wrapper.style.visibility="hidden",this.wrapper.style.width="0",this.wrapper.style.height="0",document.body.style.overflow=""},220),"function"==typeof e&&e()}resize(e){const t=Math.min(e,.8*document.documentElement.clientHeight);this.el.style.maxHeight=`${t}px`,this.el.style.minHeight=`${t}px`}}function zs(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class qs{constructor(e){zs(this,"options",void 0),zs(this,"buttonElement",void 0),zs(this,"styles",void 0),this.options=e,this.buttonElement=this.create(),this.styles=this.createStyles()}createStyles(){const e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML="\n.mercadopago-button--credits-container {\n  max-width: 275px;\n  display: flex;\n  flex-flow: row wrap;\n  gap: 8px;\n}\n\n.mercadopago-button--credits-label {\n  width: 100%;\n  font-family: Proxima Nova, sans-serif;\n  font-size: 12px;\n  font-weight: 600;\n  line-height: 15px;\n  text-align: center;\n  color: #183C73;\n  overflow: hidden;\n  white-space: nowrap;\n  text-overflow: ellipsis;\n}\n\n.mercadopago-button--yellow-blue-light {\n  display: flex;\n  gap: 8px;\n  flex-flow: row nowrap;\n  justify-content: center;\n  align-items: center;\n  padding: 10px 30px;\n  background-color: #FFE600;\n  border: 1px solid #AB9300;\n  border-radius: 6px;\n  cursor: pointer;\n  height: 48px;\n  width: 275px;\n}\n\n.mercadopago-button--yellow-blue-light:hover {\n  background-color: #FBD100;\n}\n\n.mercadopago-button--yellow-blue-light:active {\n  background-color: #F5B800;\n}\n\n.mercadopago-button--yellow-blue-light #mercadopago-button__logo {\n  height: 28px;\n  width: 196px;\n}\n",e}getCreditsLabel(){if("credits"!==this.options.type)return;const e=mt.getSiteId();return["MLA","MLB","MLM"].includes(e)?{MLA:"Hasta 12 cuotas sin tarjeta",MLB:"Até 12x com Linha de Crédito",MLM:"Hasta 12 mensualidades sin tarjeta"}[e]:void 0}create(){const e=document.createElement("button");e.setAttribute("type","submit"),e.setAttribute("formmethod","post"),e.ariaLabel="Pagar con Mercado Pago",e.className="mercadopago-button--yellow-blue-light";const t=document.createElement("img");t.src="https://http2.mlstatic.com/storage/logos-api-admin/5c2a84d0-ccfc-11ef-b4ad-3f7be6b695b7-xl.png",t.id="mercadopago-button__logo",e.appendChild(t);const r=this.getCreditsLabel();if(r){const t=document.createElement("div");t.className="mercadopago-button--credits-container";const n=document.createElement("span");return n.className="mercadopago-button--credits-label",n.textContent=r,t.appendChild(e),t.appendChild(n),t}return e}render(e){const t=e.childNodes;0===e.childNodes.length?e.appendChild(this.buttonElement):e.insertBefore(this.buttonElement,t[t.length-1].nextSibling),document.head.appendChild(this.styles)}}const Vs=e=>Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&"),Bs=e=>{let t="";return void 0!==e&&"object"==typeof e&&Object.keys(e).forEach(r=>{Object.prototype.hasOwnProperty.call(e,r)&&(t+=`${r}:${e[r]};`)}),t},Gs=(e,t,r)=>{if(e){if(e.addEventListener)return void e.addEventListener(t,r,!1);e.attachEvent?.(`on${t}`,r)}},Ys={"internal-configurations":"internalConfigurations","header-color":"theme.headerColor","elements-color":"theme.elementsColor"},Ks={"public-key":"tokenizer.publicKey","transaction-amount":"tokenizer.totalAmount","summary-product":"tokenizer.summary.product","summary-product-label":"tokenizer.summary.productLabel","summary-discount":"tokenizer.summary.discount","summary-discount-label":"tokenizer.summary.discountLabel","summary-charge":"tokenizer.summary.charge","summary-taxes":"tokenizer.summary.taxes","summary-arrears":"tokenizer.summary.arrears","summary-shipping":"tokenizer.summary.shipping","summary-title":"tokenizer.summary.title","summary-total-label":"tokenizer.summary.totalLabel","button-confirm-label":"tokenizer.buttonConfirmLabel","customer-id":"tokenizer.savedCards.customerId","payer-id":"tokenizer.savedCards.payerId","card-ids":"tokenizer.savedCards.cardIds","default-card-id":"tokenizer.savedCards.defaultCardId","differential-pricing-id":"tokenizer.differentialPricingId","excluded-payment-methods":"tokenizer.exclusions.paymentMethods","excluded-payment-types":"tokenizer.exclusions.paymentTypes","express-flow":"tokenizer.expressFlow","processing-modes":"tokenizer.processingModes","min-installments":"tokenizer.installments.minInstallments","max-installments":"tokenizer.installments.maxInstallments","trial-payment":"tokenizer.trialPayment","alternative-payment":"tokenizer.alternativePayment",action:"tokenizer.backUrl"},Hs={"preference-id":"preference.id","summary-title":"summary.title","summary-total-label":"summary.totalLabel","button-confirm-label":"buttonConfirmLabel","total-amount":"preference.totalAmount"},Xs=(e,t)=>{const r={};return Object.keys(t).filter(e=>!mr()&&"action"!==e||mr()).forEach(n=>{const i=(o=e,t[n].split(".").reduce((e,t)=>e&&e[t]?e[t]:null,o));var o;i&&(r[n]=i)}),r},Js=(e={})=>Xs(e,{...Ys,...Hs}),Zs=(e={})=>(e.tokenizer.publicKey=mt.getPublicKey(),Xs(e,{...Ys,...Ks})),Qs=new Set(Object.keys(Ar)),ec=e=>/%(?![a-fA-F0-9]{2})/.test(e),tc=e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError("MercadoPago.js - Invalid Checkout options");if(["orderId","clientToken","order_id","client_token"].some(t=>t in e))throw new TypeError("MercadoPago.js - Order credentials are not Checkout options");if(void 0!==e.checkoutUrl&&(void 0!==e.preference||void 0!==e.tokenizer))throw new TypeError("MercadoPago.js - Checkout targets are mutually exclusive");if(void 0!==e.checkoutUrl&&null===(e=>{if("string"!=typeof e||"https://"!==e.slice(0,8).toLowerCase()||e.length>8192)return null;for(const t of e){const e=t.charCodeAt(0);if(e<=32||127===e||"\\"===t)return null}if((new TextEncoder).encode(e).length>8192)return null;const t=e.slice(8).search(/[/?#]/),r=-1===t?e.length:t+8,n=e.slice(8,r);if(!Qs.has(n))return null;const i=e.indexOf("?",r),o=e.indexOf("#",r),a=Math.min(-1===i?e.length:i,-1===o?e.length:o);if(ec(e.slice(r,a))||-1!==o&&ec(e.slice(o+1)))return null;try{const t=new URL(e);return"https:"!==t.protocol||t.username||t.password||t.origin!==`https://${n}`?null:e}catch{return null}})(e.checkoutUrl))throw new TypeError("MercadoPago.js - Invalid Checkout destination")},rc={MLA:"https://mercadopago.com.ar/checkout/v1/",MLB:"https://mercadopago.com.br/checkout/v1/",MLM:"https://mercadopago.com.mx/checkout/v1/",MLU:"https://mercadopago.com.uy/checkout/v1/",MCO:"https://mercadopago.com.co/checkout/v1/",MLC:"https://mercadopago.cl/checkout/v1/",MPE:"https://mercadopago.com.pe/checkout/v1/",MLV:"https://mercadopago.com.ve/checkout/v1/"},nc=new Set(["mercadopago.com.ar","mercadopago.com.br","mercadopago.com.mx","mercadopago.com.uy","mercadopago.com.co","mercadopago.cl","mercadopago.com.pe","mercadopago.com.ve"]),ic={getFullUrl:async(e,t)=>{const r=mt.getSiteId(),n="modal"===e?"&from-widget=true":"";if(r)return`${rc[r]}${e}?${Vs(t)}${n}`;throw gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"checkout",critical:!0,details:"checkoutUrlHelper.getFullUrl: Failed to get the site id"}),new ds("Failed to get the site id")},getCanonicalRedirectOrigin:e=>{try{const{protocol:t,host:r}=new URL(e);return"https:"===t&&nc.has(r)?`https://www.${r}`:null}catch{return null}}},oc=ic,ac={wrapper:Bs({"z-index":"-2147483647",display:"block",background:"rgba(0, 0, 0, 0.7)",border:"0",overflow:"hidden",visibility:"hidden",margin:"0",padding:"0",position:"fixed",left:"0",top:"0",width:"0",opacity:"0",height:"0",transition:"opacity 220ms ease-in"}),iframe:Bs({"z-index":"1",display:"block",position:"fixed",left:"0",top:"0"})},sc=e=>{window.location.href=e},cc=e=>{try{const t=e?new URL(e).hostname:"";return Object.prototype.hasOwnProperty.call(Ar,t)?Ar[t]:"unknown"}catch{return"unknown"}},dc=({operation:e,outcome:t,mode:r,started:n,instanceId:i,checkoutUrl:o,errorCategory:a="none"})=>{const s=performance.now()-n,c=()=>console.warn("wallet_order_tracking_failed");try{const n=gs.tracker||new hn({appName:"sdk_js",version:"2.83.6",siteId:cc(o)});return Promise.resolve(n.melidata().send(`/checkout/api_integration/cho_pro/order_${e}`,{type:gs.TRACK_TYPE_EVENT,event_data:{target_kind:"order",opening_mode:r,checkout_site:cc(o),outcome:t,error_category:a,elapsed_duration_ms:Number.isFinite(s)&&s>=0?s:0,bricks_instance_id:i}})).catch(c),!0}catch{return c(),!1}};var lc;function uc(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pc(e,t,r){hc(e,t),t.set(e,r)}function hc(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function mc(e,t,r){return e.set(gc(e,t),r),r}function fc(e,t){return e.get(gc(e,t))}function gc(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var wc=new WeakMap,yc=new WeakMap,Ec=new WeakMap,_c=new WeakMap,bc=new WeakMap,vc=new WeakMap,Ac=new WeakMap,Ic=new WeakMap,Pc=new WeakMap,Tc=new WeakMap,kc=new WeakMap,Mc=new WeakMap,Cc=new WeakMap,Oc=new WeakMap,Rc=new WeakMap,Nc=new WeakMap,Sc=new WeakMap,Fc=new WeakMap,Dc=new WeakMap,Lc=new WeakMap,xc=new WeakMap,Uc=new WeakSet,jc=new WeakMap,$c=new WeakMap,Wc=new WeakMap,zc=new WeakMap,qc=new WeakMap,Vc=new WeakMap,Bc=new WeakMap,Gc=new WeakMap;class Yc{get supportsCheckoutUrlModal(){return!1}constructor(e,t){!function(e,t){hc(e,t),t.add(e)}(this,Uc),pc(this,wc,void 0),pc(this,yc,void 0),pc(this,Ec,void 0),pc(this,_c,void 0),pc(this,bc,void 0),pc(this,vc,void 0),pc(this,Ac,void 0),pc(this,Ic,void 0),pc(this,Pc,void 0),pc(this,Tc,void 0),pc(this,kc,void 0),pc(this,Mc,void 0),pc(this,Cc,void 0),pc(this,Oc,void 0),pc(this,Rc,void 0),pc(this,Nc,void 0),pc(this,Sc,void 0),pc(this,Fc,void 0),pc(this,Dc,void 0),pc(this,Lc,void 0),pc(this,xc,()=>(fc(Lc,this)||mc(Lc,this,dr()),fc(Lc,this))),pc(this,jc,async(e,t)=>{const r=e.checkoutUrl;if(void 0!==r)return r;let n;return await fc(Oc,this),n=t?Zs(e):Js(e),oc.getFullUrl(fc(Ic,this),n)}),pc(this,$c,e=>{e&&e.value&&Array.isArray(e.value)?e.value.forEach(e=>{if("back_url"===e.id)try{const t=new URL(e.value);"https:"===t.protocol||"http:"===t.protocol?window.location.href=e.value:(fc(wc,this).remove(),fc(Sc,this)?dc({operation:"open",outcome:"failed",mode:"self",started:performance.now(),instanceId:fc(xc,this).call(this),checkoutUrl:void 0,errorCategory:"invalid_target"}):gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"checkout",critical:!1,details:"Checkout.close: blocked navigation to disallowed URL scheme"}))}catch{fc(wc,this).remove(),fc(Sc,this)?dc({operation:"open",outcome:"failed",mode:"self",started:performance.now(),instanceId:fc(xc,this).call(this),checkoutUrl:void 0,errorCategory:"invalid_target"}):gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"checkout",critical:!1,details:"Checkout.close: blocked navigation to malformed URL"})}else fc(wc,this).remove()}):fc(wc,this).remove(),mc(Cc,this,!1),fc(zc,this).call(this)}),pc(this,Wc,e=>{fc(bc,this)&&e.value&&fc(Vc,this).call(this,{value:e.value}),fc(wc,this).remove(),mc(Cc,this,!1),fc(zc,this).call(this)}),pc(this,zc,()=>{fc(Dc,this)&&window.removeEventListener("message",fc(Dc,this)),mc(Dc,this,void 0)}),pc(this,qc,(e,t)=>{fc(zc,this).call(this);let r=null;if(t)try{r=new URL(t).origin}catch{}const n=fc(Sc,this)?null:oc.getCanonicalRedirectOrigin(t),i=new Set([r,n].filter(e=>null!==e)),o=t=>{if(fc(Cc,this)&&fc(wc,this)===e){if(fc(Sc,this)){const r=e.getContentWindow(),n=null!==r&&r===t.source;if(!(t.origin===window.location.origin&&t.source===window&&"close"===t.data?.type||n&&i.has(t.origin)))return}else if(t.origin!==r&&t.origin!==window.location.origin){const r=e.getContentWindow();if(null===r||r!==t.source||null===n||t.origin!==n)return}switch(t.data?.type){case"submit":fc(Wc,this).call(this,t.data);break;case"close":fc($c,this).call(this,t.data)}}};mc(Dc,this,o),Gs(window,"message",o)}),pc(this,Vc,e=>{mc(_c,this,document.createElement("form")),fc(_c,this).action=fc(Ac,this),fc(_c,this).method="POST",fc(_c,this).style.visibility="hidden",e.value.forEach(e=>{const t=document.createElement("input");t.name=e.id,t.value=e.value,fc(_c,this).appendChild(t)}),document.body.appendChild(fc(_c,this)),fc(_c,this).submit()}),pc(this,Bc,()=>{Gs(fc(Ec,this).buttonElement,"click",()=>{this.open()})}),uc(this,"render",async e=>{const t=performance.now();try{fc(Sc,this)||await fc(Oc,this),fc(Sc,this)||gs.send({path:"/cho_pro/render",type:gs.TRACK_TYPE_EVENT,eventData:{integration_type:e.type||"default",preference_id:fc(Rc,this)}});let r=null,n=null;if(fc(Mc,this))throw fc(Sc,this)||gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"checkout",critical:!1,details:'Checkout.render: Already setting "render" from class constructor options'}),new Error('MercadoPago.js - Already setting "render" from class constructor options');if(!e.container)throw fc(Sc,this)||gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"checkout",critical:!1,details:"Checkout.render: Must specify a container to render the Payment Button"}),new Error("MercadoPago.js - Must specify a container to render the Payment Button");mc(yc,this,document.querySelector(e.container)),e.label&&(r=e.label),e.type&&(n=e.type),mc(Ec,this,new qs({label:r,type:n,containerSelector:e.container})),fc(Bc,this).call(this),fc(Ec,this).render(fc(yc,this)),fc(Sc,this)&&dc({operation:"render",outcome:"render_succeeded",mode:"self",started:t,instanceId:fc(xc,this).call(this),checkoutUrl:fc(Tc,this)})}catch(e){if(!fc(Sc,this))throw e;throw console.warn("wallet_order_render_failed"),new(dc({operation:"render",outcome:"failed",mode:"self",started:t,instanceId:fc(xc,this).call(this),checkoutUrl:fc(Tc,this),errorCategory:"render_failed"})?ds:Error)("MercadoPago.js - Direct Checkout rendering failed")}}),pc(this,Gc,async(e,t=mc(Fc,this,(lc=fc(Fc,this),++lc)))=>{const r=e.preference?.id||"",n=void 0!==e.checkoutUrl,i=!n&&(fc(vc,this)??!!e.tokenizer),o=e.tokenizer?.backUrl||null,a=n||r||e.tokenizer?await fc(jc,this).call(this,e,i):void 0;return t===fc(Fc,this)&&!fc(Cc,this)&&(mc(Rc,this,r),mc(bc,this,i),mc(Sc,this,n),mc(Ac,this,o),mc(Tc,this,a),!0)}),uc(this,"open",async e=>{var t;let r=e;const n=performance.now(),i=r&&"object"==typeof r?void 0!==r.checkoutUrl:fc(Sc,this);try{e&&(tc(e),r={...e},tc(r))}catch(e){if(!i)throw e;throw dc({operation:"open",outcome:"failed",mode:"self",started:n,instanceId:fc(xc,this).call(this),checkoutUrl:void 0,errorCategory:"invalid_target"}),new TypeError("MercadoPago.js - Invalid Checkout destination")}const o=r&&!fc(Cc,this)?mc(Fc,this,(t=fc(Fc,this),++t)):void 0;try{if(i?await Promise.resolve():await fc(Oc,this),fc(Cc,this))return void console.warn("MercadoPago.js - There is already a checkout instance open");if(r&&(!await fc(Gc,this).call(this,r,o)||fc(Cc,this)))return;if(fc(Sc,this)||gs.send({path:"/cho_pro/open",type:gs.TRACK_TYPE_EVENT,eventData:{preference_id:fc(Rc,this)}}),!fc(Tc,this))return mc(Pc,this,!0),console.warn("MercadoPago.js - You are using open() before checkout instantiation has resolved. Try using 'autoOpen' configuration instead"),void(fc(Sc,this)?dc({operation:"open",outcome:"failed",mode:"self",started:n,instanceId:fc(xc,this).call(this),checkoutUrl:void 0,errorCategory:"not_ready"}):gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"checkout",critical:!1,details:"Checkout.open: You are using open before checkout"}));if(fc(Sc,this)&&("redirect"===fc(Ic,this)||!this.supportsCheckoutUrlModal))return"redirect"!==fc(Ic,this)&&console.warn("wallet_order_modal_fallback",{requested_mode:"modal",effective_mode:"self"}),sc(fc(Tc,this)),void dc({operation:"open",outcome:"navigation_dispatched",mode:"self",started:n,instanceId:fc(xc,this).call(this),checkoutUrl:fc(Tc,this)});if("redirect"===fc(Ic,this))return void sc(fc(Tc,this));mc(wc,this,new Ws({id:fc(kc,this),src:fc(Tc,this),container:document.body,render:!1,styles:ac})),mc(Cc,this,!0),fc(qc,this).call(this,fc(wc,this),fc(Tc,this)),fc(wc,this).render(),fc(Sc,this)&&dc({operation:"open",outcome:"modal_opened",mode:"modal",started:n,instanceId:fc(xc,this).call(this),checkoutUrl:fc(Tc,this)})}catch(e){if(void 0!==o&&o!==fc(Fc,this))return;if(!i)throw e;mc(Cc,this,!1),fc(zc,this).call(this);const t=this.supportsCheckoutUrlModal&&"redirect"!==fc(Ic,this)?"modal_failed":"navigation_failed";throw console.warn("wallet_order_open_failed"),new(dc({operation:"open",outcome:"failed",mode:"modal_failed"===t?"modal":"self",started:n,instanceId:fc(xc,this).call(this),checkoutUrl:fc(Tc,this),errorCategory:t})?ds:Error)("MercadoPago.js - Direct Checkout opening failed")}}),tc(e),mc(bc,this,!!e.tokenizer),mc(vc,this,e.preference?.id||e.tokenizer?fc(bc,this):void 0),mc(Ac,this,null),mc(Ic,this,mr()?"redirect":"modal"),mc(Pc,this,!!e.autoOpen),mc(kc,this,"mercadopago-checkout"),mc(Mc,this,!1),mc(Cc,this,!1),mc(Oc,this,t),t.catch(()=>{}),mc(Rc,this,e.preference?.id||""),mc(Nc,this,new tr),mc(Sc,this,void 0!==e.checkoutUrl),mc(Tc,this,e.checkoutUrl),mc(Fc,this,0),gc(Uc,this,Kc).call(this,e)}}async function Kc(e){const t=performance.now();if(e.render&&!fc(Pc,this)&&this.render({container:e.render.container,openMode:e.render.openMode,label:e.render.label,type:e.render.type}).then(()=>{mc(Mc,this,!0)}).catch(e=>{if(!fc(Sc,this))throw e}),void 0!==e.checkoutUrl||e?.preference?.id||e?.tokenizer){const r=fc(Fc,this)+1;fc(Gc,this).call(this,e).then(e=>{if(e&&fc(Pc,this)){if(fc(Sc,this))return this.open();this.open()}}).catch(e=>{if(r===fc(Fc,this)&&(console.warn("MercadoPago.js - There was an error creating a new checkout instance"),!(e instanceof ds))){if(fc(Sc,this))return void dc({operation:"open",outcome:"failed",mode:"self",started:t,instanceId:fc(xc,this).call(this),checkoutUrl:void 0,errorCategory:"initialization_failed"});gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"checkout",critical:!1,details:`Checkout.init: ${e?.message??"unknown error"}`})}})}}const Hc={cardPayment:"cardPayment.js",payment:"payment.js",statusScreen:"statusScreen.js",wallet:"walletButton.js",brand:"ads.js",confirmationBottomsheet:"confirmationBottomsheet.js",creditLegalText:"creditLegalText.js"},Xc=(e,t,r=!1)=>new Promise((n,i)=>{new Promise((e,t)=>{const r=setTimeout(t,5e3),n=()=>{clearTimeout(r),e()};document?.body?n():document.addEventListener("DOMContentLoaded",()=>{if(document?.body)return n();t()})}).then(()=>{const o=((e,t)=>`${Ms().assetsBaseUrl}${Os(t)}/components/${Hc[e]}`)(e,t),a=document.createElement("script");a.setAttribute("type","text/javascript"),a.setAttribute("charset","utf-8"),a.setAttribute("src",o),a.addEventListener("load",()=>((e,t)=>{componentModule||t("Component module is empty"),e(componentModule.default.prototype)})(n,i)),a.addEventListener("error",()=>{r?i(new gr("load_bundle_script_failed")):(gs.sendFrontendMetricsError({name:ps.LOAD_BUNDLE_SCRIPT_FAILED,product:Es(e),critical:!0,service_url:o,details:`loadBundleScript: Could not load bundle ${e} from source: ${o}`}),i(new ds(`Could not load bundle ${e} from source: ${o}`)))}),document.body.appendChild(a)}).catch(()=>{i("Could not find document.body")})}),Jc=["fastPayment","wallet"],Zc=(e,t)=>{if("object"==typeof e&&null!==e)return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0},Qc=e=>{const t=Zc(e,"initialization");return["orderId","clientToken","order_id","client_token"].some(e=>void 0!==Zc(t,e))},ed=(e,t)=>"wallet"===e&&(Qc(t)||"function"==typeof Zc(Zc(t,"callbacks"),"onSubmit")),td=e=>{const t=Zc(Zc(e,"initialization"),"redirectMode");return{source:"function"==typeof Zc(Zc(e,"callbacks"),"onSubmit")?"callback":"initialization",openingMode:"self"===t||"blank"===t?t:"modal",...Qc(e)&&{orderSource:!0}}};function rd(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function nd(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function id(e,t){return e.get(ad(e,t))}function od(e,t,r){return e.set(ad(e,t),r),r}function ad(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var sd=new WeakMap,cd=new WeakMap,dd=new WeakMap,ld=new WeakMap,ud=new WeakMap,pd=new WeakMap,hd=new WeakMap,md=new WeakMap,fd=new WeakMap,gd=new WeakMap,wd=new WeakMap,yd=new WeakMap,Ed=new WeakMap,_d=new WeakMap,bd=new WeakMap,vd=new WeakMap,Ad=new WeakMap;class Id{constructor(e,t,r){rd(this,sd,void 0),rd(this,cd,void 0),rd(this,dd,void 0),rd(this,ld,void 0),rd(this,ud,void 0),rd(this,pd,void 0),rd(this,hd,void 0),rd(this,md,void 0),rd(this,fd,void 0),rd(this,gd,void 0),rd(this,wd,async(e,t,r=!1)=>{if(id(ld,this)!==e.locale&&(od(ld,this,e.locale),od(ud,this,await id(Ad,this).call(this,t,r))),!id(ud,this)||!id(hd,this)){const e="translations or trackingManager not found";if(r||gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"bricks",critical:!0,details:`BaseBricksComponent.validateSettings: ${e}`}),r)throw new gr("validation_error");throw new Error(e)}return{...e,restClient:id(md,this),translation:id(ud,this),trackingManager:id(hd,this),siteId:id(fd,this)}}),rd(this,yd,(e,t)=>{const r={appName:Id.TRACKING_APP_NAME_PREFIX+id(sd,this),clientName:Id.FRONTEND_METRICS_CLIENT_NAME,version:e||"",siteId:t};od(hd,this,new hn(r)),id(hd,this).melidata().addContext({scope:"prod"})}),rd(this,Ed,async(e=!1)=>await(id(gd,this)?.call(this).catch(()=>{}))??id(_d,this).call(this,e)),rd(this,_d,async(e=!1)=>(e?id(cd,this).getSiteId(!0):id(cd,this).getSiteId()).catch(t=>{if(e)throw t instanceof gr?t:new gr("load_site_id_failed");const r=`Could not fetch site ID: ${t.message}`;throw gs.sendFrontendMetricsError({name:ps.LOAD_SITE_ID_FAILED,product:Es(id(sd,this)),critical:!0,details:`BaseBricksComponent.fetchSiteID: ${r}`,status_code:t.status}),new ds(r)})),rd(this,bd,(e,t,r)=>{id(vd,this).call(this,()=>{if(id(hd,this)||id(yd,this).call(this,Cs(!1),"unknown"),!e.orderSource)return id(hd,this)?.frontendMetrics().sendErrorMetric(wr(r instanceof gr?r.category:"operation_failed"),!0);const n=performance.now()-t;return id(hd,this)?.melidata().send("/checkout/bricks/wallet/order_resolution",{type:"EVENT",event_data:{phase:"render",source:e.source,opening_mode:e.openingMode,checkout_site:Cr(id(fd,this)),outcome:"failed",error_category:"unavailable",callback_duration_ms:0,lookup_duration_ms:0,elapsed_duration_ms:Number.isFinite(n)&&n>=0?n:0,bricks_instance_id:dr()}})})}),rd(this,vd,e=>{try{Promise.resolve(e()).catch(()=>{})}catch{}}),rd(this,Ad,async(e,t=!1)=>t?id(dd,this).getTranslation(id(sd,this),id(ld,this),e,!0).catch(()=>{throw new gr("load_translation_failed")}):id(dd,this).getTranslation(id(sd,this),id(ld,this),e)),od(sd,this,e),od(cd,this,new vs),od(dd,this,new Us),od(ld,this,t),od(md,this,It),od(fd,this,""),od(gd,this,r)}async init(e,t=!1,r={source:"initialization",openingMode:"modal"}){const n=performance.now();try{t&&id(yd,this).call(this,Cs(e),"unknown");const[r,n,i]=await Promise.all([t?Xc(id(sd,this),e,!0).catch(()=>{throw new gr("load_bundle_script_failed")}):Xc(id(sd,this),e),id(Ad,this).call(this,e,t),id(Ed,this).call(this,t)]);return od(pd,this,r),od(ud,this,n),od(fd,this,i),id(yd,this).call(this,Cs(e),id(fd,this)),Promise.resolve()}catch(e){if(t)throw id(bd,this).call(this,r,n,e),new ds("Wallet initialization failed.");if(!(e instanceof ds)){const t=e instanceof Error?e.message:String(e);gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"bricks",critical:!1,details:`BaseBricksComponent.init: ${t}`})}return Promise.reject(e)}}async render(e,t,r,n){if(ed(id(sd,this),t)){const i=performance.now(),o=td(t);let a;try{if(!id(pd,this))throw new Error("Wallet initialization unavailable.");a=await id(wd,this).call(this,t,n,!0)}catch(e){if(id(bd,this).call(this,o,i,e),!o.orderSource)throw new Error("Wallet rendering failed.");return null}if(!o.orderSource){const e=performance.now()-r.timing;id(vd,this).call(this,()=>id(hd,this)?.frontendMetrics().sendPerformanceMetric({name:"sdk_init",product:"wallet_brick",timing:Number.isFinite(e)&&e>=0?e:0},!0))}try{const t=id(pd,this).initialize(e,a);return Promise.resolve(t).catch(()=>{if(id(bd,this).call(this,o,i),!o.orderSource)throw new Error("Wallet rendering failed.");return null})}catch{return id(bd,this).call(this,o,i),null}}if(!id(pd,this)){const e="Remote component must be initialized before rendering";throw gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"bricks",critical:!1,details:`BaseBricksComponent.render: ${e}`}),new Error(e)}const i=await id(wd,this).call(this,t,n);try{return r.timing=performance.now()-r.timing,id(hd,this)?.frontendMetrics().sendPerformanceMetric(r),id(pd,this).initialize(e,i)}catch(e){return console.error(e),gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"bricks",critical:!1,details:`BaseBricksComponent.render: ${e instanceof Error?e.message:String(e)}`}),Promise.resolve(null)}}}nd(Id,"TRACKING_APP_NAME_PREFIX","op-checkout-bricks_"),nd(Id,"FRONTEND_METRICS_CLIENT_NAME","checkout_bricks");const Pd=/^[0-9]+(\.[0-9]{1,2})?$/,Td=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),kd=(e,t)=>{const r=(e=>{if(!e)return null;const t="string"==typeof e?e.trim().replace(",","."):String(e);if(!Pd.test(t))return null;const r=parseFloat(t);return isNaN(r)||!isFinite(r)||r<=0?null:t})(e);if(null===r)return{valid:!1,error:wn.InvalidAmount};if(!Cn.has(t))return{valid:!0,value:r};const[n,i]=r.split(".");return void 0!==i&&0!==Number(i)?{valid:!1,error:wn.AmountDecimalsNotAllowed}:{valid:!0,value:n}},Md=e=>void 0===e||"boolean"==typeof e,Cd=e=>void 0===e||"string"==typeof e&&e.length>0;function Od(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Rd extends Error{constructor(e,t,r){super(e),Od(this,"errorCode",void 0),Od(this,"details",void 0),Error.captureStackTrace&&Error.captureStackTrace(this,Rd),this.errorCode=t,this.name="AuthenticationError",this.details=r||[]}}const Nd=e=>({MLA:"ARS",MLB:"BRL",MLM:"MXN",MLC:"CLP",MCO:"COP",MPE:"PEN",MLU:"UYU"}[e]||"USD"),Sd=(e,t,r=Jn)=>{try{Jn.bindSession(e.sessionId,e.token,r);const n={authorization:e.token,sessionId:e.sessionId},i={amount:t};return window.btoa(JSON.stringify({params:i,headers:n}))}catch(e){throw new Error(wn.MalformedToken)}},Fd={MLB:"mercadolivre.com.br",MLA:"mercadolibre.com.ar",MLM:"mercadolibre.com.mx",MLC:"mercadolibre.cl",MLU:"mercadolibre.com.uy",MPE:"mercadolibre.com.pe",MCO:"mercadolibre.com.co"},Dd=(e,t)=>({total:{label:"Mercado Pago",amount:{currency:Nd(e),value:t}}}),Ld=e=>`https://sdk.mercadopago.com/op-pay/prapi/index.html?app=${e}`,xd=async(e,t,r)=>{const n=Dd(e,t);return await new PaymentRequest([{supportedMethods:Ld(r)}],n).canMakePayment()},Ud=e=>{switch(!0){case null===e:case void 0===e:return wn.UnexpectedNullError;case"function"!=typeof e.toString:return wn.UnexpectedErrorObject;case e.toString().includes("NotSupportedError"):case e.toString().includes("AbortError")&&!e.toString().includes("RESULT_CANCELED"):case e.toString().includes("InvalidStateError"):return wn.UnreachableApplication;case e.toString().includes("SecurityError"):return wn.SecurityBlocked;case e.toString().includes("AUTHORIZATION_FAILED"):return wn.AuthorizationFailed;case e.toString().includes("RESULT_CANCELED"):return wn.UserCancelled;default:return wn.PRApiError}},jd=async(e,t)=>{const r=Pn.map(async r=>({application:r,isInstalled:await xd(e,t,r)}));return(await Promise.all(r)).reduce((e,t)=>t.isInstalled?[...e,t.application]:e,[])},$d=e=>0===e.length?null:Pn.find(t=>e.includes(t))||null,Wd=[{type:mn.PRAPI,fallbackFlowOnAuthenticate:null,fallbackFlowOnAuthorize:null},{type:mn.FIDO,fallbackFlowOnAuthenticate:null,fallbackFlowOnAuthorize:null},{type:mn.OTP,fallbackFlowOnAuthenticate:null,fallbackFlowOnAuthorize:null}],zd=new WeakMap,qd=(e,t)=>{zd.set(e,t)},Vd=e=>e?zd.get(e):void 0;function Bd(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gd(e,t,r){Yd(e,t),t.set(e,r)}function Yd(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Kd(e,t){return e.get(Xd(e,t))}function Hd(e,t,r){return e.set(Xd(e,t),r),r}function Xd(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Jd=new WeakMap,Zd=new WeakMap,Qd=new WeakMap,el=new WeakMap,tl=new WeakMap,rl=new WeakMap,nl=new WeakMap,il=new WeakMap,ol=new WeakMap,al=new WeakMap,sl=new WeakSet;class cl{constructor(e,t=Jn){!function(e,t){Yd(e,t),t.add(e)}(this,sl),Gd(this,Jd,void 0),Gd(this,Zd,void 0),Gd(this,Qd,void 0),Gd(this,el,void 0),Gd(this,tl,void 0),Gd(this,rl,void 0),Gd(this,nl,void 0),Gd(this,il,void 0),Gd(this,ol,void 0),Gd(this,al,void 0),Hd(al,this,t),qd(this,t),Hd(Zd,this,!1),Hd(Jd,this,!1),Hd(Qd,this,null),Hd(el,this,[]),Hd(tl,this,""),Hd(rl,this,""),Hd(nl,this,e),Hd(il,this,null),Hd(ol,this,void 0)}static async create(e,t,r,n){const i=Jn.resolveIntegration(n?.integration);if(cl.instance){const{amount:r,email:n}=cl.instance.getPaymentInformation(),o=kd(e,mt.getSiteId());if(o.valid&&r===o.value&&n===t&&Kd(al,cl.instance).integration===i)return Promise.resolve(cl.instance);cl.resetInstance()}if(cl.initializationPromise&&cl.initializationIntegration===i)return cl.initializationPromise;Jn.setIntegration(i);const o=Jn.forIntegration(i),a=cl.creationCount+=1,s=(async()=>{const i=new cl(r,o);return Jn.setContext({siteId:mt.getSiteId(),version:"2.83.6"}),await Xd(sl,i,dl).call(i,e,t,n),Hd(Jd,i,!0),a===cl.creationCount&&(cl.instance=i),i})().finally(()=>{cl.initializationPromise===s&&(cl.initializationPromise=null,cl.initializationIntegration=null)});return cl.initializationPromise=s,cl.initializationIntegration=i,s}async show(e){const t=!!(e=>void 0===e||"boolean"==typeof e)(e?.skipAllUserConfirmation)&&!!e?.skipAllUserConfirmation,r=(e=>{if(!e)return Mn;const t=e.toString().trim().toLowerCase(),r=Object.values(gn);return r.includes(t)?t:(Un(`[MERCADO PAGO]: Invalid confirmationLocation "${e}". Expected one of: ${r.join(", ")}. Using: '${Mn}'`),Mn)})(e?.confirmationLocation),n=!t&&r===gn.WEB;if(!Kd(Jd,this))throw Kd(al,this).sendError(qn.START,{error_name:wn.NotInitialized,error_critical:!0,applications:Kd(el,this)}),new Rd("[MERCADO PAGO]: Authenticator is not yet initialized",wn.NotInitialized);if(Kd(Zd,this))return Kd(al,this).sendError(qn.START,{error_name:wn.AlreadyShowing,error_critical:!1,applications:Kd(el,this)}),console.log(`[MERCADO PAGO]: Authenticator is already showing. Error: ${wn.AlreadyShowing}`),null;if(Kd(al,this).send(qn.START,{applications:Kd(el,this)}),Hd(Zd,this,!0),t&&(Kd(al,this).send(qn.CONFIRMATION,{skip_confirmation:!0}),Kd(al,this).send(qn.CONFIRMATION_CLICK)),n){try{await Xd(sl,this,ll).call(this)}catch(e){const t=e,r=t===wn.NoUserConfirmation;throw r?Kd(al,this).sendError(qn.CONFIRMATION_CLICK,{error_name:t,error_critical:!0}):Kd(al,this).sendError(qn.CONFIRMATION,{skip_confirmation:!1,error_name:t,error_critical:!0}),cl.resetInstance(),Kd(il,this)?.unmount(),Hd(Zd,this,!1),new Rd("[MERCADO PAGO]: Error while processing Payment Request: "+(r?"User cancelled":"Error loading confirmation"),t)}Kd(al,this).send(qn.CONFIRMATION_CLICK)}try{const e=await(async(e,t,r,n,i,o)=>{if(!o)throw wn.NullApplicationError;const a=Dd(r,t),s=[{supportedMethods:Ld(o),data:{siteId:r,publicKey:n,email:e,userConfirmation:i,productId:mt.getProductId(),sdkInstanceId:mt.getInstanceId(),deviceProfileId:mt.getDeviceProfile()}}];try{const e=new PaymentRequest(s,a),t=await e.show();if(await t.complete("success"),!t?.details?.token||!t?.details?.sessionId)throw new Error("no token data was returned from the provider");return{token:t.details.token,sessionId:t.details.sessionId}}catch(e){throw Ud(e)}})(Kd(rl,this),Kd(tl,this),mt.getSiteId(),mt.getPublicKey(),t||r===gn.WEB,Kd(Qd,this));return Sd(e,Kd(tl,this),Kd(al,this))}catch(e){const t=e;throw Kd(al,this).sendError(qn.AUTHENTICATOR,{error_name:t,error_critical:!0,application:Kd(Qd,this)||"none",origin:"native",auth_type:"none"}),cl.resetInstance(),new Rd(`[MERCADO PAGO]: Error while processing Payment Request: ${t}`,wn.PRApiError)}finally{try{await(Kd(il,this)?.close()),Kd(il,this)?.unmount()}catch(e){Kd(il,this)?.unmount(),Kd(al,this).sendError(qn.CONFIRMATION_CLICK,{error_critical:!1,error_name:wn.BottomsheetCloseFailed})}finally{Hd(Zd,this,!1)}}}getApplication(){return Kd(Qd,this)||null}getPaymentInformation(){return{amount:Kd(tl,this),email:Kd(rl,this)}}static resetInstance(){cl.instance=null,cl.initializationPromise=null,cl.initializationIntegration=null}static getInstance(){return cl.instance}getPreloadedPaymentMethods(){return Kd(ol,this)?Kd(al,this).send(qn.PRELOAD_PAYMENT_METHODS,{preload_payment_methods:Oa(Kd(ol,this))}):Kd(al,this).sendError(qn.PRELOAD_PAYMENT_METHODS,{preload_payment_methods:[],error_name:wn.PreloadedPaymentMethodsEmpty,error_critical:!1}),Kd(ol,this)}}async function dl(e,t,r){mt.setProductId(ys());const n=mt.getSiteId();let{bricks:i,platformId:o}=r||{};const a=Cd(o);if(a||(o="none"),Kd(al,this).setPlatformId(o??"none"),a||(Kd(al,this).sendInitMetrics({error:wn.InvalidPlatformId,critical:!1,flowVersion:fn.V1}),console.warn("[MERCADO PAGO]: Invalid platform Id provided. Please check the options before initializing.")),Md(i)||(Kd(al,this).sendInitMetrics({error:wn.InvalidBricks,critical:!1,platformId:o,flowVersion:fn.V1}),console.warn("[MERCADO PAGO]: Invalid bricks provided. Please check the options before initializing."),i=!1),!vn.includes(n))throw Kd(al,this).sendInitMetrics({error:wn.SiteIdNotSupported,critical:!0,platformId:o,bricks:i,flowVersion:fn.V1}),new Rd(`[MERCADO PAGO]: The Site ID ${n} is not supported`,wn.SiteIdNotSupported);if(!Td(t))throw Kd(al,this).sendInitMetrics({error:wn.InvalidEmail,critical:!0,platformId:o,bricks:i,flowVersion:fn.V1}),new Rd("[MERCADO PAGO]: Invalid email address provided",wn.InvalidEmail);const s=kd(e,n);if(!s.valid)throw Kd(al,this).sendInitMetrics({error:s.error,critical:!0,platformId:o,bricks:i,flowVersion:fn.V1}),new Rd(s.error===wn.AmountDecimalsNotAllowed?`[MERCADO PAGO]: The currency of site ${n} does not accept decimals, but the amount provided has them: ${e}`:`[MERCADO PAGO]: Invalid amount value provided: ${e}`,s.error);if(Hd(tl,this,s.value),!mt.getPublicKey())throw Kd(al,this).sendInitMetrics({error:wn.PublicKeyNotSet,critical:!1,platformId:o,bricks:i,flowVersion:fn.V1}),new Rd("[MERCADO PAGO]: Public key not set. Please set the public key before initializing.",wn.PublicKeyNotSet);let c=[];try{const e=await(async(e,t,r)=>{const{publicKey:n,instanceId:i,deviceProfile:o,uid:a}=r,s=await It.fetch(`/user-flows?amount=${encodeURIComponent(e)}`,{method:"GET",retry:0,headers:{Authorization:n,"X-Email":t,"X-SDK-Instance-ID":i,"X-Device-Profile-ID":o,"X-Request-Device-ID":a,...!["prod","lts"].includes("prod")&&{"X-Scope":"omega"}},defaultQueries:!1});if(!s.ok)throw new Error("The API request has failed. Status:"+s.status);return await s.json()})(Kd(tl,this),t,{publicKey:mt.getPublicKey(),instanceId:mt.getInstanceId(),deviceProfile:mt.getDeviceProfile(),uid:lr.getUid()}),r=(e=>({availableFlows:e.user_flows,...e.payment_methods?.length&&e.payment_methods?.length>0&&{preloadedPaymentMethods:e.payment_methods}}))(e);c=r.availableFlows,r.preloadedPaymentMethods&&Hd(ol,this,r.preloadedPaymentMethods)}catch(e){Kd(al,this).sendInitMetrics({error:wn.ApiRequestFailed,critical:!0,platformId:o,bricks:i,flowVersion:fn.V1});const t=e;throw new Rd("[MERCADO PAGO]: Error while fetching user flows",wn.ApiRequestFailed,t?.errors)}const d=((e,t,r=Jn)=>{switch(!0){case(()=>{if(!("PaymentRequest"in window&&mr()&&(()=>{const e=Yr(navigator.userAgent);return An.includes(e)})()))throw r.sendInitMetrics({error:wn.PRApiNotSupported,critical:!0,flowVersion:t}),new Rd("[MERCADO PAGO]: PaymentRequest API is not supported on this browser",wn.PRApiNotSupported);return e.includes(mn.PRAPI)})():return mn.PRAPI;case e.includes(mn.FIDO):return mn.FIDO;default:return null}})(c,fn.V1,Kd(al,this));if(!d)throw Kd(al,this).sendInitMetrics({error:wn.AuthenticationNotSupported,critical:!0,platformId:o,bricks:i,flowVersion:fn.V1}),new Rd("[MERCADO PAGO]: Authenticator flow is not supported",wn.AuthenticationNotSupported);Hd(rl,this,t),Hd(Qd,this,await Xd(sl,this,ul).call(this,n)),Kd(al,this).sendInitMetrics({flow:d,platformId:o,bricks:i,flowVersion:fn.V1})}async function ll(){return new Promise((e,t)=>{const r=document.createElement("div");r.setAttribute("id","bottomsheet_container"),document.body.appendChild(r);try{Kd(nl,this).create("confirmationBottomsheet","bottomsheet_container",{callbacks:{onContinue:()=>{e()},onCancel:()=>{t(wn.NoUserConfirmation)},onReady:()=>Kd(al,this).send(qn.CONFIRMATION,{skip_confirmation:!1})},customization:{theme:In[Kd(Qd,this)]}}).then(e=>{e||t(wn.BottomsheetLoadingFailed),Hd(il,this,e)})}catch(e){t(wn.BottomsheetLoadingFailed)}})}async function ul(e){let t=[],r=null;try{t=await jd(e,Kd(tl,this)),Hd(el,this,t),r=$d(t)}catch(e){throw Kd(al,this).sendInitMetrics({error:wn.ApplicationCheckError,critical:!0,flowVersion:fn.V1}),new Rd(`[MERCADO PAGO]: Error while checking installed applications: ${e?.message||e}`,wn.ApplicationCheckError)}if(!r||0===t.length)throw Kd(al,this).sendInitMetrics({error:wn.NoApplicationsDetected,critical:!0,flowVersion:fn.V1}),new Rd("[MERCADO PAGO]: No applications were detected on device. Supported options: Mercado Pago and Mercado Libre.",wn.NoApplicationsDetected);return r}function pl(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function hl(e,t){return e.get(fl(e,t))}function ml(e,t,r){return e.set(fl(e,t),r),r}function fl(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}Bd(cl,"instance",null),Bd(cl,"initializationPromise",null),Bd(cl,"initializationIntegration",null),Bd(cl,"creationCount",0);const gl={wallet:e=>({...e,checkout:new Yc({preference:{id:""}},Promise.resolve())}),payment:(e,t)=>({...e,...cl.getInstance()&&{authenticator:cl.getInstance()},...cl.getInstance()&&{supertokenTracker:Vd(cl.getInstance())??Jn},...t&&{getFastPaymentsAccountPaymentMethods:t}})};var wl=new WeakMap,yl=new WeakMap,El=new WeakMap,_l=new WeakMap,bl=new WeakMap,vl=new WeakMap,Al=new WeakMap,Il=new WeakMap,Pl=new WeakMap,Tl=new WeakMap,kl=new WeakMap;class Ml{constructor(e,t,r,n){pl(this,wl,void 0),pl(this,yl,void 0),pl(this,El,void 0),pl(this,_l,void 0),pl(this,bl,void 0),pl(this,vl,void 0),pl(this,Al,(e,t)=>`${e}:${t?"wallet":"default"}`),pl(this,Il,e=>Object.keys(Hc).includes(e)),pl(this,Pl,(e,t={},r=mt.getProductId(),n)=>{const i={...t,sdkInstance:hl(El,this),publicKey:mt.getPublicKey(),productId:r,assetsBaseUrl:Ms().assetsBaseUrl,apiBaseUrl:Ms().apiBaseUrl,version:Cs(n),isMobile:mr(),locale:t.locale||mt.getLocale()},o=hl(Tl,this).call(this,i),a=gl[e];return a?a(o,hl(_l,this)):o}),pl(this,Tl,e=>{const{customization:t}=e,{style:r}=t?.visual||{},n=r?{theme:r.theme||hl(vl,this).theme,customVariables:r.customVariables||hl(vl,this).customVariables}:hl(vl,this);return{...e,customization:{...t,visual:{...t?.visual,style:n}}}}),pl(this,kl,async(e,t,r,n,i)=>e.render(t,r,n,i)),ml(vl,this,e||{}),ml(El,this,t),ml(_l,this,r),ml(bl,this,n),ml(yl,this,{}),ml(wl,this,!0)}isInitialized(){return hl(wl,this)}async create(e,t,...[r]){const n=performance.now();if(!hl(Il,this).call(this,e))return console.error(`[BRICKS]: component name: ${e} is invalid.`),gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"bricks",critical:!1,details:`Bricks.create: ${e}`}),Promise.resolve(null);const i=Es(e),o=ys(i);mt.setProductId(o);const a=((e,t={})=>{if("payment"!==e)return!1;const r=Zc(t,"customization"),n=Zc(r,"paymentMethods");return"all"===Jc.map(e=>Zc(n,e)).find(e=>void 0!==e)})(e,r),s=hl(Al,this).call(this,e,a);let c=hl(yl,this)[s];const d=hl(Pl,this).call(this,e,r,o,a);if(!c){const t=hl(bl,this),{publicKey:r}=d;c=function(e,t,r){return new Id(e,t,r)}(e,d.locale,t?()=>t(r):void 0);try{ed(e,d)?await c.init(a,!0,td(d)):await c.init(a)}catch(e){return console.error("Bricks.create: Bricks component initialization failed"),Promise.resolve(null)}hl(yl,this)[s]=c}const l={product:i,timing:n,name:"sdk_init"};return hl(kl,this).call(this,c,t,d,l,a)}}const Cl=["applePay","googlePay"],Ol="quick_checkout";class Rl{static validateCheckoutTypes(e){const{checkoutTypes:t}=e;if(!t)throw new Error("checkoutTypes parameter is required");if(!Array.isArray(t))throw new Error("checkoutTypes must be an array");if(0===t.length)throw new Error("checkoutTypes array cannot be empty");if(t.some(e=>!Cl.includes(e))){const e=`Unsupported checkoutTypes: ${t.join(", ")}. Supported: ${Cl.join(", ")}.`;throw new Error(e)}}}const Nl="supports3DS",Sl="https://api.mercadopago.com",Fl={visa:"visa",master:"masterCard"},Dl={visa:"visa",mastercard:"master"};class Ll{static validateApplePayMandatorySettings(e){if(!e.applePay?.paymentRequest)throw new Error("applePay.paymentRequest is required");if(!e.applePay?.sessionRequest)throw new Error("applePay.sessionRequest is required");if(!e.applePay?.callbacks?.onTokenGenerated)throw new Error("applePay.callbacks.onTokenGenerated is required");const{supportedNetworks:t,merchantCapabilities:r}=e.applePay.paymentRequest;if(!t)throw new Error("supportedNetworks property is required");if(!Array.isArray(t))throw new Error("supportedNetworks must be an array");if(0===t.length)throw new Error("supportedNetworks array cannot be empty");e.applePay.paymentRequest.merchantCapabilities=Ll.validateMerchantCapabilities(r)}static validateSupportedNetworks(e,t){const r=e.applePay?.paymentRequest;if(!r?.supportedNetworks)return;const n=r.supportedNetworks,i=n.filter(e=>t.includes(e));if(0===i.length)throw new Error(`None of the requested networks [${n.join(", ")}] are available. Available networks: [${t.join(", ")}]`);r.supportedNetworks=i}static validatePreSDKRequirements(e){if(!window.isSecureContext)throw new Error("Apple Pay requires HTTPS - current page is not secure");if(!document.getElementById(e))throw new Error(`Container with id "${e}" not found`)}static validateApplePayAvailability(){if(!window.ApplePaySession)throw new Error("Apple Pay not supported - browser missing ApplePaySession API");let e;try{e=window.ApplePaySession.canMakePayments()}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Apple Pay unavailable - ${t}`)}if(!e)throw new Error("Apple Pay unavailable - no payment methods configured on device")}static validateMerchantCapabilities(e){if(!e||0===e.length)return[Nl];const t=this.removeDebitForMLB(e);return this.ensure3DSCapability(t)}static removeDebitForMLB(e){return"MLB"===mt.getSiteId()?e.filter(e=>"supportsDebit"!==e):e}static ensure3DSCapability(e){return e.includes(Nl)?e:[...e,Nl]}}class xl{static async createApplePaySession(e){const{paymentRequest:t,sessionRequest:r,callbacks:n}=e.applePay,i=e.applePay?.testing?.scope,o=new window.ApplePaySession(3,t);return o.onvalidatemerchant=t=>this.handleMerchantValidation(t,o,r,e,i),o.onpaymentauthorized=t=>this.handlePaymentAuthorization(t,o,e,i),o.oncancel=()=>this.handleSessionCancellation(e),o.begin(),n?.onReady&&await n.onReady(),o}static async handleMerchantValidation(e,t,r,n,i){try{const n={...r,validationURL:e.validationURL},o=await(async(e,t)=>{const r={"Content-Type":"application/json","X-Public-key":mt.getPublicKey()};t&&(r["X-Scope"]=t);const n=await It.fetch("/applepay/v1/session",{baseURL:Sl,method:"POST",headers:r,body:JSON.stringify(e),defaultQueries:!1});if(!n.ok)throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_MERCHANT_VALIDATION_FAILED,product:Ol,critical:!1,status_code:n.status}),new Error("Apple Pay session request failed. Status: "+n.status);return await n.json()})(n,i);t.completeMerchantValidation(o)}catch(e){t.abort();const r=e instanceof Error?e.message:"Unknown error",i=new Error(`Merchant validation failed: ${r}`);throw gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:Ol,critical:!0,details:`ApplePayClick.handleMerchantValidation: ${r}`}),n.applePay?.callbacks?.onError&&await n.applePay.callbacks.onError(i),i}}static async handlePaymentAuthorization(e,t,r,n){let i=window.ApplePaySession.STATUS_FAILURE;try{const{token:t}=e.payment;if(!t||!t.transactionIdentifier)throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_INCOMPLETE_PAYMENT_DATA,product:Ol,critical:!1,details:"ApplePayClick.handlePaymentAuthorization: Incomplete payment data"}),new Error("Incomplete payment data");const{transactionIdentifier:o}=t,a=t.paymentMethod.network,s=this.mapNetworkToPaymentMethodId(a),c=btoa(JSON.stringify(t.paymentData)),d=r.applePay?.testStatus,l=await(async(e,t,r,n)=>{const i=performance.now(),o={payment_method:{type:"applepay",payment_data:e},transaction_identifier:t,device:{meli:{session_id:mt.getDeviceProfile()}}},a={"Content-Type":"application/json","X-Caller-SiteId":mt.getSiteId(),"X-Product-Id":mt.getProductId(),"X-Public-key":mt.getPublicKey()},s=mt.getPublicKey().startsWith("TEST-");r&&s&&(a["X-Test-Status"]=r);const c="staging"===n?"/platforms/staging/pci/applepay/v1/tokenize":"/platforms/pci/applepay/v1/tokenize",d=await It.fetch(c,{baseURL:Sl,method:"POST",headers:a,body:JSON.stringify(o),defaultQueries:!1});if(!d.ok)throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_TOKENIZE_FAILED,product:Ol,critical:!1,status_code:d.status}),new Error(`Tokenization failed: ${d.status}`);const l=await d.json();return gs.sendFrontendMetricsPerformance({name:"apple_pay_tokenize",product:Ol,timing:performance.now()-i}),l})(c,o,d,n);if(!l||!l.id)throw new Error("Token generation failed");gs.send({path:"/quick_checkout/apple_pay/tokenize",type:gs.TRACK_TYPE_EVENT,eventData:{wallet_type:"applePay",payment_method:s}}),r.applePay?.callbacks?.onTokenGenerated&&await r.applePay.callbacks.onTokenGenerated(l.id,l.bin,s),i=window.ApplePaySession.STATUS_SUCCESS}catch(e){const t=e instanceof Error?e.message:"Unknown error";gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:Ol,critical:!0,details:`ApplePayClick.handlePaymentAuthorization: ${t}`}),r.applePay?.callbacks?.onError&&await r.applePay.callbacks.onError(e),i=window.ApplePaySession.STATUS_FAILURE}t.completePayment(i)}static mapNetworkToPaymentMethodId(e){const t=e.toLowerCase(),r=Dl[t];if(!r){const t=Object.keys(Dl);throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_UNSUPPORTED_NETWORK,product:Ol,critical:!1,details:`ApplePayClick.mapNetworkToPaymentMethodId: Network: ${e}`}),new Error(`Unsupported card network: ${e}. Only ${t.join(", ")} are supported.`)}return r}static async handleSessionCancellation(e){gs.send({path:"/quick_checkout/apple_pay/cancel",type:gs.TRACK_TYPE_EVENT,eventData:{wallet_type:"applePay"}}),e.applePay?.callbacks?.onCancel&&await e.applePay.callbacks.onCancel()}}class Ul{static loadApplePaySDK(){return new Promise((e,t)=>{if(window.ApplePaySession&&customElements?.get?.("apple-pay-button"))return void e();const r=performance.now(),n=document.createElement("script");n.src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",n.crossOrigin="anonymous",n.onload=()=>{gs.sendFrontendMetricsPerformance({name:"apple_pay_sdk_load",product:Ol,timing:performance.now()-r}),e()},n.onerror=()=>{gs.sendFrontendMetricsError({name:ps.APPLE_PAY_SDK_LOAD_FAILED,product:Ol,critical:!1,details:"ApplePayManager.loadApplePaySDK: Failed to load Apple Pay SDK"}),t(new Error("Failed to load Apple Pay SDK"))},document.head.appendChild(n)})}static renderApplePayButton(e,t){const r=document.getElementById(e),n=document.createElement("apple-pay-button"),i=t.applePay?.customization?.buttonStyle||"black",o=t.applePay?.customization?.buttonType||"pay",a=t.applePay?.customization?.locale||"en-US";n.setAttribute("buttonstyle",i),n.setAttribute("type",o),n.setAttribute("locale",a),n.addEventListener("click",async()=>{gs.send({path:"/quick_checkout/apple_pay/submit",type:gs.TRACK_TYPE_EVENT,eventData:{wallet_type:"applePay"}});try{await xl.createApplePaySession(t)}catch(e){const r=e instanceof Error?e.message:"Unknown error";gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:Ol,critical:!0,details:`ApplePayManager.renderApplePayButton: ${r}`}),t.applePay?.callbacks?.onError&&await t.applePay.callbacks.onError(e)}}),r.appendChild(n),gs.send({path:"/quick_checkout/apple_pay/render",type:gs.TRACK_TYPE_VIEW,eventData:{wallet_type:"applePay"}})}}const jl={VISA:"visa",MASTERCARD:"master"},$l={visa:"VISA",master:"MASTERCARD"},Wl=Object.freeze(["en","ar","bg","ca","cs","da","de","el","es","et","fi","fr","hr","id","it","ja","ko","ms","nl","no","pl","pt","ru","sk","sl","sr","sv","th","tr","uk","zh"]),zl=["CRYPTOGRAM_3DS"];function ql(e){return!e.startsWith("TEST-")}const Vl=/^[A-Z]{3}$/,Bl=/^[A-Z]{2}$/,Gl=/^[0-9]+(?:\.[0-9]{2})?$/,Yl=/^.{12,18}$/;class Kl extends Error{constructor(e,t){super(t),function(e,t,r){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"cause",void 0),this.name="GooglePayValidationError",this.cause=e}}class Hl{static validateGooglePayMandatorySettings(e){const t=e.googlePay?.paymentRequest;if(t&&"object"==typeof t&&!Array.isArray(t)||this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest must be an object","payment_request_invalid"),"string"==typeof t.currencyCode&&Vl.test(t.currencyCode)||this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest.currencyCode must be a three-letter uppercase ISO 4217 code","currency_code_invalid"),"string"==typeof t.totalPrice&&Gl.test(t.totalPrice)||this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest.totalPrice must be a non-negative amount with up to two decimal places","total_price_invalid"),void 0===t.countryCode||"string"==typeof t.countryCode&&Bl.test(t.countryCode)||this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest.countryCode must be a two-letter uppercase ISO 3166-1 alpha-2 code","country_code_invalid"),void 0!==t.merchantInfo&&(("object"!=typeof t.merchantInfo||null===t.merchantInfo||Array.isArray(t.merchantInfo))&&this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest.merchantInfo must be an object","merchant_info_invalid"),"string"==typeof t.merchantInfo.merchantName&&0!==t.merchantInfo.merchantName.trim().length||this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest.merchantInfo.merchantName must be a non-empty string","merchant_name_invalid")),ql(mt.getPublicKey())){const e=t.merchantInfo?.merchantId;"string"==typeof e&&Yl.test(e)||this.throwValidationError(ps.OPERATION_FAILED,"googlePay.paymentRequest.merchantInfo.merchantId is required in PRODUCTION and must be the merchant ID issued by Google (12-18 characters) after registering in the Google Pay & Wallet Console","merchant_id_invalid")}"function"!=typeof e.googlePay?.callbacks?.onTokenGenerated&&this.throwValidationError(ps.OPERATION_FAILED,"googlePay.callbacks.onTokenGenerated must be a function","on_token_generated_invalid")}static validatePreSDKRequirements(e){window.isSecureContext||this.throwValidationError(ps.OPERATION_FAILED,"Google Pay requires HTTPS - current page is not secure","insecure_context"),document.getElementById(e)||this.throwValidationError(ps.OPERATION_FAILED,`Container with id "${e}" not found`,"container_not_found")}static validateGooglePaySDKLoaded(){"function"!=typeof window.google?.payments?.api?.PaymentsClient&&this.throwValidationError(ps.GOOGLE_PAY_SDK_LOAD_FAILED,"Google Pay SDK is not loaded","sdk_not_loaded")}static validateGooglePayWalletAvailability(e){this.assertNetworksAvailable(e,ps.GOOGLE_PAY_WALLET_NOT_AVAILABLE,"Google Pay wallet is not available","wallet_not_available")}static async validateGooglePayAvailability(e,t){const r=this.createIsReadyToPayRequest(t);try{const t=await e.isReadyToPay(r);!0!==t?.result&&this.throwValidationError(ps.GOOGLE_PAY_NOT_AVAILABLE,"Google Pay is not available for this buyer","buyer_not_eligible")}catch(e){if(e instanceof Kl)throw e;this.throwValidationError(ps.GOOGLE_PAY_NOT_AVAILABLE,"Google Pay availability check failed","availability_check_failed")}}static validateSupportedNetworks(e){this.assertNetworksAvailable(e,ps.GOOGLE_PAY_NO_SUPPORTED_NETWORKS,"No supported Google Pay networks are available","no_supported_networks")}static assertNetworksAvailable(e,t,r,n){0===e.length&&this.throwValidationError(t,r,n)}static createIsReadyToPayRequest(e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:zl,allowedCardNetworks:e}}]}}static throwValidationError(e,t,r){throw gs.sendFrontendMetricsError({name:e,product:Ol,critical:!1,details:`GooglePayValidator: ${r}`}),new Kl(e,t)}}class Xl{static loadGooglePaySDK(){if(window.google?.payments?.api?.PaymentsClient)return Promise.resolve();if(this.sdkLoadPromise)return this.sdkLoadPromise;const e=new Promise((e,t)=>{const r=performance.now();let n=!1;const i=()=>{n||(n=!0,gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_SDK_LOAD_FAILED,product:Ol,critical:!1,details:"GooglePayManager.loadGooglePaySDK: Failed to load Google Pay SDK"}),t(new Error("Failed to load Google Pay SDK")))};try{const t=document.createElement("script");t.src="https://pay.google.com/gp/p/js/pay.js",t.onload=()=>{window.google?.payments?.api?.PaymentsClient?n||(n=!0,gs.sendFrontendMetricsPerformance({name:"google_pay_sdk_load",product:Ol,timing:performance.now()-r}),e()):i()},t.onerror=i,document.head.appendChild(t)}catch{i()}}).finally(()=>{this.sdkLoadPromise===e&&(this.sdkLoadPromise=void 0)});return this.sdkLoadPromise=e,e}static createPaymentsClient(e){const t=window.google?.payments?.api?.PaymentsClient;if(!t)throw new Error("Google Pay SDK is not loaded");return new t({environment:ql(e)?"PRODUCTION":"TEST"})}static renderGooglePayButton(e,t,r,n){const i=document.getElementById(e);if(!i)throw new Error(`Container with id "${e}" not found`);const o=t.googlePay?.button,a=r.createButton({onClick:()=>{gs.send({path:"/quick_checkout/google_pay/submit",type:gs.TRACK_TYPE_EVENT,eventData:{wallet_type:"googlePay"}}),n()},buttonType:o?.type??"pay",buttonColor:o?.color??"black",buttonSizeMode:o?.sizeMode??"static",buttonLocale:this.normalizeButtonLocale(o?.locale)});i.appendChild(a),gs.send({path:"/quick_checkout/google_pay/render",type:gs.TRACK_TYPE_VIEW,eventData:{wallet_type:"googlePay"}})}static normalizeButtonLocale(e){return e&&Wl.includes(e)?e:"en"}}!function(e,t,r){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Xl,"sdkLoadPromise",void 0);class Jl{static async loadPaymentData(e,t,r){let n,i;try{const i=await t.loadPaymentData(this.buildPaymentDataRequest(e,r));n=this.extractPaymentData(i)}catch(t){return this.isCancellation(t)?(gs.send({path:"/quick_checkout/google_pay/cancel",type:gs.TRACK_TYPE_EVENT,eventData:{wallet_type:"googlePay"}}),this.invokeCallback(e,e.callbacks.onCancel,[],{stage:"on_cancel",fallbackMessage:"Google Pay onCancel callback failed"})):this.reportFailure(e,new Error("Failed to load Google Pay payment data"),"load_payment_data")}try{i=await(async(e,t)=>{const r=performance.now(),n={payment_method:{type:"googlepay",payment_data:e},transaction_identifier:dr(),device:{meli:{session_id:mt.getDeviceProfile()}}},i=ql(mt.getPublicKey())?"https://api.mercadopago.com/platforms/pci/googlepay/v1/tokenize":"https://api.mercadopago.com/platforms/staging/pci/googlepay/v1/tokenize",o={"Content-Type":"application/json","X-Caller-SiteId":mt.getSiteId(),"X-Product-Id":mt.getProductId(),"X-Public-key":mt.getPublicKey()},a=!ql(mt.getPublicKey());let s;t&&a&&(o["X-Test-Status"]=t);try{const e=await It.fetch("",{baseURL:i,method:"POST",headers:o,body:JSON.stringify(n),defaultQueries:!1,rejectWithError:!0});s=await e.json()}catch(e){const t="object"==typeof e&&null!==e&&"status"in e?e.status:void 0;throw gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_TOKENIZE_FAILED,product:Ol,critical:!1,status_code:t}),new Error(t?`Tokenization failed: ${t}`:"Tokenization failed: network error")}if(!("object"==typeof(c=s)&&null!==c&&"string"==typeof c.id&&c.id.length>0&&"string"==typeof c.bin&&c.bin.length>0))throw gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_TOKENIZE_FAILED,product:Ol,critical:!1}),new Error("Tokenization failed: malformed Gateway response");var c;return gs.sendFrontendMetricsPerformance({name:"google_pay_tokenize",product:Ol,timing:performance.now()-r}),s})(n.token,e.testStatus)}catch(t){return this.reportFailure(e,t instanceof Error?t:new Error("Failed to tokenize Google Pay payment"),"tokenize")}return gs.send({path:"/quick_checkout/google_pay/tokenize",type:gs.TRACK_TYPE_EVENT,eventData:{wallet_type:"googlePay",payment_method:n.paymentMethodId}}),this.invokeCallback(e,e.callbacks.onTokenGenerated,[i.id,i.bin,n.paymentMethodId],{stage:"on_token_generated",fallbackMessage:"Google Pay onTokenGenerated callback failed"})}static async invokeCallback(e,t,r,n){try{await(t?.(...r))}catch(t){return this.reportFailure(e,t instanceof Error?t:new Error(n.fallbackMessage),n.stage)}}static async reportFailure(e,t,r){gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:Ol,critical:!0,details:`GooglePayClick.loadPaymentData: ${r}_failed`});try{await(e.callbacks.onError?.(t))}catch{gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:Ol,critical:!0,details:`GooglePayClick.reportFailure: on_error_failed (stage: ${r})`})}}static buildPaymentDataRequest(e,t){const{paymentRequest:r}=e;return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:[...zl],allowedCardNetworks:[...t]},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"mercadopago",gatewayMerchantId:mt.getPublicKey()}}}],merchantInfo:r.merchantInfo?{...r.merchantInfo}:{},transactionInfo:{totalPrice:r.totalPrice,totalPriceStatus:"FINAL",currencyCode:r.currencyCode,countryCode:r.countryCode}}}static extractPaymentData(e){const t=e?.paymentMethodData?.tokenizationData?.token,r=e?.paymentMethodData?.info?.cardNetwork;if("string"!=typeof t||0===t.length)throw new Error("Incomplete Google Pay payment data");if("string"!=typeof r||!Object.prototype.hasOwnProperty.call(jl,r))throw new Error("Unsupported Google Pay card network");return{token:t,cardNetwork:r,paymentMethodId:jl[r]}}static isCancellation(e){return"object"==typeof e&&null!==e&&"statusCode"in e&&"CANCELED"===e.statusCode}}function Zl(e,t,r){Ql(e,t),t.set(e,r)}function Ql(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function eu(e,t){return e.get(ru(e,t))}function tu(e,t,r){return e.set(ru(e,t),r),r}function ru(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var nu=new WeakMap,iu=new WeakMap,ou=new WeakSet;class au{constructor(e){!function(e,t){Ql(e,t),t.add(e)}(this,ou),Zl(this,nu,!1),Zl(this,iu,void 0),tu(iu,this,e)}async create(e,t){try{if(eu(nu,this))throw new Error("QuickCheckout already initialized. Operation skipped.");await eu(iu,this),Rl.validateCheckoutTypes(t),t.checkoutTypes.forEach(e=>{gs.send({path:"/quick_checkout",type:gs.TRACK_TYPE_VIEW,eventData:{wallet_type:e}})});const r=[];t.checkoutTypes.includes("applePay")&&r.push(()=>ru(ou,this,su).call(this,e,t)),t.checkoutTypes.includes("googlePay")&&r.push(()=>ru(ou,this,cu).call(this,e,t));const n=await Promise.allSettled(r.map(e=>e())),i=n.filter(e=>"rejected"===e.status);if(i.length===n.length)throw i[0].reason;tu(nu,this,!0)}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:Ol,critical:!0,details:`QuickCheckout.create: ${t}`}),e}}isInitialized(){return eu(nu,this)}}async function su(e,t){Ll.validateApplePayMandatorySettings(t),Ll.validatePreSDKRequirements(e),await Ul.loadApplePaySDK(),Ll.validateApplePayAvailability();const r=await(async()=>{const e=performance.now(),{apiBaseUrl:t}=Ms(),r=await It.fetch("/wallets",{baseURL:t,method:"GET",headers:{"Content-Type":"application/json"},query:{public_key:mt.getPublicKey(),product_id:String(mt.getProductId())},defaultQueries:!1});if(!r.ok)throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_WALLETS_FETCH_FAILED,product:Ol,critical:!1,status_code:r.status}),new Error(`Failed to fetch available wallets: ${r.status}`);const n=await r.json();if(!Array.isArray(n))throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_WALLETS_INVALID_RESPONSE,product:Ol,critical:!1}),new Error("Unexpected response format from wallets API");const i=n.find(e=>"apple_pay"===e?.code);if(!i)throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_WALLET_NOT_AVAILABLE,product:Ol,critical:!1}),new Error("Apple Pay wallet is not available");if(!Array.isArray(i.supported_payment_methods))throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_WALLETS_INVALID_RESPONSE,product:Ol,critical:!1}),new Error("Unexpected supported_payment_methods format in wallets API response");const o=i.supported_payment_methods.map(e=>Fl[e?.id]).filter(e=>Boolean(e));if(0===o.length)throw gs.sendFrontendMetricsError({name:ps.APPLE_PAY_NO_SUPPORTED_NETWORKS,product:Ol,critical:!1}),new Error("No supported payment networks found for Apple Pay");return gs.sendFrontendMetricsPerformance({name:"apple_pay_wallets_fetch",product:Ol,timing:performance.now()-e}),o})();Ll.validateSupportedNetworks(t,r),Ul.renderApplePayButton(e,t)}async function cu(e,t){Hl.validateGooglePayMandatorySettings(t),Hl.validatePreSDKRequirements(e),await Xl.loadGooglePaySDK();const r=Xl.createPaymentsClient(mt.getPublicKey()),n=await(async()=>{const e=performance.now(),{apiBaseUrl:t}=Ms();let r,n;try{r=await It.fetch("/wallets",{baseURL:t,method:"GET",headers:{"Content-Type":"application/json"},query:{public_key:mt.getPublicKey(),product_id:String(mt.getProductId())},defaultQueries:!1,rejectWithError:!0})}catch(e){const t="object"==typeof e&&null!==e&&"status"in e?e.status:void 0;throw gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_WALLETS_FETCH_FAILED,product:Ol,critical:!1,status_code:t}),new Error(t?`Failed to fetch available wallets: ${t}`:"Failed to fetch available wallets: network error")}try{n=await r.json()}catch{throw gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_WALLETS_INVALID_RESPONSE,product:Ol,critical:!1}),new Error("Unexpected response format from wallets API")}if(!Array.isArray(n))throw gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_WALLETS_INVALID_RESPONSE,product:Ol,critical:!1}),new Error("Unexpected response format from wallets API");const i=n.find(e=>"google_pay"===e?.code);if(!i)return gs.sendFrontendMetricsPerformance({name:"google_pay_wallets_fetch",product:Ol,timing:performance.now()-e}),[];if(!Array.isArray(i.supported_payment_methods))throw gs.sendFrontendMetricsError({name:ps.GOOGLE_PAY_WALLETS_INVALID_RESPONSE,product:Ol,critical:!1}),new Error("Unexpected supported_payment_methods format in wallets API response");const o=i.supported_payment_methods.map(e=>e?.id&&Object.prototype.hasOwnProperty.call($l,e.id)?$l[e.id]:void 0).filter(e=>Boolean(e));return gs.sendFrontendMetricsPerformance({name:"google_pay_wallets_fetch",product:Ol,timing:performance.now()-e}),o})();Hl.validateGooglePayWalletAvailability(n),await Hl.validateGooglePayAvailability(r,n);const i=t.googlePay;Xl.renderGooglePayButton(e,t,r,()=>{Jl.loadPaymentData(i,r,n)})}const du=async e=>{const t={requestId:dr(),...e},r=await It.fetch("/platforms/pci/yape/v1/payment",{baseURL:"https://api.mercadopago.com",retry:0,method:"POST",body:JSON.stringify(t)});return await r.json()};r.dn(du);const lu=class{createYape(e){return du(e)}};function uu(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function pu(e,t){return e.get(mu(e,t))}function hu(e,t,r){return e.set(mu(e,t),r),r}function mu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var fu=new WeakMap,gu=new WeakMap;class wu{constructor(e){uu(this,fu,void 0),uu(this,gu,void 0),hu(gu,this,e),hu(fu,this,new lu)}async create(){try{return gs.send({path:"/yape/create_token",type:gs.TRACK_TYPE_EVENT}),await pu(fu,this).createYape(pu(gu,this))}catch(e){const t=e instanceof Error?e.message:"Unknown error";return gs.sendFrontendMetricsError({name:ps.OPERATION_FAILED,product:"yape",critical:!0,details:`Yape.create: ${t}`}),Promise.reject(e)}}}const yu=["public_key","email","totalAmount","action","cancelURL"],Eu=/^(https?):\/\/[^\s$.?#].[^\s]*$/;let _u=function(e){return e.email="email",e.action="action",e.totalAmount="total_amount",e.cancelURL="cancel_url",e.public_key="public_key",e}({});const bu=[{path:"root",name:"type",type:"string",acceptedValues:["webpay"],required:!0},{path:"root",name:"email",type:"string",required:!0,pattern:/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/},{path:"root",name:"totalAmount",type:"number",required:!0},{path:"root",name:"action",type:"string",required:!0,pattern:Eu},{path:"root",name:"cancelURL",type:"string",required:!0,pattern:Eu}];function vu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Au=new WeakMap;class Iu{constructor(e={type:"",email:"",action:"",totalAmount:""}){(function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)})(this,Au,void 0),e.cancelURL||(e.cancelURL=window.top?.location.href||window.location.href);const t=(e=>{const t=new ls;return bu.forEach(({name:r,type:n,required:i,path:o,acceptedValues:a,pattern:s})=>{const c="root"===o?e[r]:e[o]?.[r],d=typeof c,l=(e=>xa[e]?.invalid||xa.default)(r);!c&&i&&t.addError({...l,description:`Required field "${r}" is missing`}),c&&(d!==n&&t.addError({...l,description:`Type of ${r} must be ${n}. Received ${d}`}),a&&!a.includes(c)&&t.addError({...l,description:`Invalid option value "${c}". Available option(s): ${a.join(" or ")}`}),s&&!s.test(c)&&t.addError({...l,description:`Invalid parameter "${r}"`}))}),t.getErrors()})(e);if(t.length)throw t;!function(e,t,r){e.set(vu(e,t),r)}(Au,this,e)}open(){gs.send({path:"/tokenizer/open_url",type:gs.TRACK_TYPE_EVENT}),window.location.href=this.getRedirectURL()}getRedirectURL(){return gs.send({path:"/tokenizer/generate_url",type:gs.TRACK_TYPE_EVENT}),(e=>{const t=new URL("https://www.mercadopago.cl/webpay-one-click/init"),r=(e,r)=>{r&&t.searchParams.append(_u[e],r)};return yu.forEach(t=>{if(Array.isArray(t)){const[n,i]=t;e[n]&&e[n][i]&&r(i,e[n][i])}else r(t,e[t])}),t.href})({public_key:mt.getPublicKey(),...(e=Au,e.get(vu(e,this)))});var e}}function Pu(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Tu{static isNumericText(e){return this.NUMERIC_TEXT_REGEX.test(e)}static isRepeatedDigitText(e){return this.DIGITS_SEQUENCE_REGEX.test(e)}static isAlphaNumeric(e){return this.ALPHA_NUMERIC_REGEX.test(e)}static isRepeatedAlphanumericPattern(e){return this.REPEATED_ALPHANUMERIC_REGEX.test(e.toUpperCase())}static getCharacterValue(e){return e.toUpperCase().charCodeAt(0)-this.ASCII_OFFSET}static getNextCheckDigitMLB(e){const t=e.split("").map(e=>Number(e));let r=0,n=2;for(let e=t.length-1;e>=0;e--)r+=t[e]*n,n=9==n&&t.length>11?2:n+1;const i=r%11;return i<2?0:11-i}static getNextCheckDigitAlphanumericCNPJ(e){const t=12===e.length?[5,4,3,2,9,8,7,6,5,4,3,2]:[6,5,4,3,2,9,8,7,6,5,4,3,2],r=e.split("").reduce((e,r,n)=>e+this.getCharacterValue(r)*t[n],0)%11;return r<2?0:11-r}}Pu(Tu,"NUMERIC_TEXT_REGEX",/^\d*$/),Pu(Tu,"DIGITS_SEQUENCE_REGEX",/^(\d)\1*$/),Pu(Tu,"ALPHA_NUMERIC_REGEX",/^[a-zA-Z0-9]+$/),Pu(Tu,"REPEATED_ALPHANUMERIC_REGEX",/^(.)\1*$/),Pu(Tu,"ASCII_OFFSET",48);class ku{validate(e){if(!Tu.isNumericText(e))return!1;if(7!=e.length&&8!=e.length)return!1;const t=parseInt(e[e.length-1]);let r=0;for(let t=0;t<e.length-1;t++)r+=parseInt(e.substring(t,t+1))*ku.ALGORITHM_FACTORS[t];return t===(10-r%10)%10}}!function(e,t,r){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(ku,"ALGORITHM_FACTORS",[2,9,8,7,6,3,4]);class Mu{validate(e){if(!Tu.isNumericText(e))return!1;if(e.length!=this.getDocumentLength())return!1;if(Tu.isRepeatedDigitText(e))return!1;const t=this.getDocumentLength()-1,r=Tu.getNextCheckDigitMLB(e.substring(0,t-1)),n=Tu.getNextCheckDigitMLB(e.substring(0,t));return e===e.substring(0,t-1)+r+n}}function Cu(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Ou extends Mu{getDocumentLength(){return Ou.DOCUMENT_LENGTH}}Cu(Ou,"DOCUMENT_LENGTH",14);class Ru{getDocumentLength(){return Ru.DOCUMENT_LENGTH}validate(e){return e.length===Ru.DOCUMENT_LENGTH&&(Tu.isNumericText(e)?this.validateNumericCNPJ(e):this.validateAlphanumericCNPJ(e))}validateNumericCNPJ(e){return(new Ou).validate(e)}validateAlphanumericCNPJ(e){const t=e.substring(0,Ru.ALPHANUMERIC_BODY_LENGTH).toUpperCase(),r=e.substring(Ru.ALPHANUMERIC_BODY_LENGTH);if(!Tu.isAlphaNumeric(t))return!1;if(!Tu.isNumericText(r))return!1;if(Tu.isRepeatedAlphanumericPattern(t))return!1;const n=Tu.getNextCheckDigitAlphanumericCNPJ(t);return r===`${n}${Tu.getNextCheckDigitAlphanumericCNPJ(t+n)}`}}Cu(Ru,"DOCUMENT_LENGTH",14),Cu(Ru,"ALPHANUMERIC_BODY_LENGTH",12);class Nu extends Mu{getDocumentLength(){return Nu.DOCUMENT_LENGTH}}function Su(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Fu(e,t){return e.get(Lu(e,t))}function Du(e,t,r){return e.set(Lu(e,t),r),r}function Lu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}!function(e,t){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:11,enumerable:!0,configurable:!0,writable:!0}):e[t]=11}(Nu,"DOCUMENT_LENGTH");var xu=new WeakMap,Uu=new WeakMap;class ju{constructor(e,t){Su(this,xu,void 0),Su(this,Uu,void 0),Du(xu,this,e),Du(Uu,this,t)}validate(e){return!(!Tu.isNumericText(e)||Tu.isRepeatedDigitText(e))&&e.length>=Fu(xu,this)&&e.length<=Fu(Uu,this)}}function $u(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Wu(e,t){return e.get(qu(e,t))}function zu(e,t,r){return e.set(qu(e,t),r),r}function qu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Vu=new WeakMap,Bu=new WeakMap;class Gu{constructor(e,t){$u(this,Vu,void 0),$u(this,Bu,void 0),zu(Vu,this,e),zu(Bu,this,t)}validate(e){return!(!Tu.isAlphaNumeric(e)||Tu.isRepeatedDigitText(e))&&e.length>=Wu(Vu,this)&&e.length<=Wu(Bu,this)}}class Yu{validate(e){const t=e.replace(".","").replace("-",""),r=t.slice(0,-1);let n=t.slice(-1).toUpperCase();if(r.length<7)return!1;let i=0,o=2;for(let e=1;e<=r.length;e++)i+=o*Number(t.charAt(r.length-e)),o=o<7?o+1:2;const a=String(11-i%11);return"K"===n&&(n="10"),0===Number(n)&&(n="11"),a===n}}const Ku=e=>{gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"core",critical:!1,details:`Validators.getDocumentValidator: ${e}`})};function Hu(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Xu(e,t){return e.get(Zu(e,t))}function Ju(e,t,r){return e.set(Zu(e,t),r),r}function Zu(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Qu=new WeakMap,ep=new WeakMap,tp=new WeakMap,rp=new WeakMap;class np{constructor(e){Hu(this,Qu,void 0),Hu(this,ep,void 0),Hu(this,tp,void 0),Hu(this,rp,!1),Ju(Qu,this,"pk_live_3dbgckKc3uxhHS6WJYyHdkcM3uow_CVQ"),Ju(ep,this,"pk_test_R6tj8sqsYSXunCyL2yKysyscv2Kg2Rx-"),Ju(rp,this,e?.sandbox||!1)}close(){Xu(tp,this)?.close&&(Xu(tp,this).close(),gs.send({path:"/fintoc/close",type:gs.TRACK_TYPE_EVENT}))}destroy(){Xu(tp,this)?.destroy&&(Xu(tp,this).destroy(),gs.send({path:"/fintoc/destroy",type:gs.TRACK_TYPE_EVENT}))}async open(e){if(this.isScriptInjected()||await this.inject(),!window.Fintoc.create)throw gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"fintoc",critical:!0,details:"Fintoc.open: Failed to load Fintoc"}),new Error("Failed to load Fintoc");Ju(tp,this,await window.Fintoc.create({holderType:"individual",product:"payments",country:"cl",widgetToken:e.widgetToken,...e.institutionId?{institutionId:e.institutionId}:{},...e.username?{username:e.username}:{},...e.onSuccess?{onSuccess:e.onSuccess}:{},...e.onExit?{onExit:e.onExit}:{},...e.onEvent?{onEvent:e.onEvent}:{},publicKey:Xu(rp,this)?Xu(ep,this):Xu(Qu,this)})),Xu(tp,this)?.open(),gs.send({path:"/fintoc/open",type:gs.TRACK_TYPE_EVENT})}isScriptInjected(){return!!window.Fintoc}inject(){return new Promise((e,t)=>{const r=document.createElement("script");r.src="https://js.fintoc.com/v1/",r.onload=async()=>{await this.waitForScriptInjection(),e()},r.onerror=()=>{gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"fintoc",critical:!0,details:"Fintoc.inject: Failed to inject Fintoc"}),t(new Error("Failed to inject Fintoc"))},document.head.appendChild(r)})}waitForScriptInjection(){return new Promise((e,t)=>{const r=Date.now();let n;const i=()=>{this.isScriptInjected()?(clearTimeout(n),e()):Date.now()-r>=5e3?(clearTimeout(n),gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"fintoc",critical:!0,details:"Fintoc.waitForScriptInjection: Failed to load Fintoc - timeout"}),t(new Error("Failed to load Fintoc - timeout"))):n=setTimeout(i,100)};i()})}}const ip=[bn.ParamsValidate,bn.UserFlowsFetch,bn.FlowSelect,bn.ProviderPrepare],op=ip.length,ap=e=>{const t=(e=>ip.indexOf(e)+1)(e),r={step:e,current:t,total:op,timestamp:Date.now()},n=new CustomEvent("authenticator:init_progress",{detail:r,bubbles:!0});window.dispatchEvent(n)};let sp=function(e){return e.NoFlowAvailable="NO_FLOW_AVAILABLE",e.PrapiEnrollmentFailed="PRAPI_ENROLLMENT_FAILED",e.PrapiAuthorizeFailed="PRAPI_AUTHORIZE_FAILED",e.FidoAuthorizeFailed="FIDO_AUTHORIZE_FAILED",e.OtpTransactionFailed="OTP_TRANSACTION_FAILED",e.OtpIframeFailed="OTP_IFRAME_FAILED",e.OtpCancelled="OTP_CANCELLED",e.OtpValidateFailed="OTP_VALIDATE_FAILED",e}({});const cp={userFlows:3,prapiEnrollment:0,transactionCreate:3,iframe:3,transactionValidate:3};function dp(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function lp(e,t){return e.get(pp(e,t))}function up(e,t,r){return e.set(pp(e,t),r),r}function pp(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var hp=new WeakMap,mp=new WeakMap,fp=new WeakMap,gp=new WeakMap,wp=new WeakMap,yp=new WeakMap;class Ep{constructor(e,t,r,n){dp(this,hp,void 0),dp(this,mp,void 0),dp(this,fp,void 0),dp(this,gp,{}),dp(this,wp,void 0),dp(this,yp,void 0),up(hp,this,e),up(mp,this,t),up(fp,this,n),up(wp,this,t.fallbackFlowOnAuthenticate?r[t.fallbackFlowOnAuthenticate]:null),up(yp,this,t.fallbackFlowOnAuthorize?r[t.fallbackFlowOnAuthorize]:null)}static async create(e,t,r,n){xn("[ST] userFlows da API",r);const i=new URLSearchParams(window.location.search).get("st-disable");xn("[MercadoPago]: flows to be disabled",i);const o=await Promise.all(Wd.reduce((e,n)=>{if(!r.includes(n.type))return e;const o=i?.includes(n.type);if(xn(`[MercadoPago]: flow ${n.type} to be disabled was found=${o} `),o)return e;const a=t[n.type];return[...e,a?.isSupported().then(e=>({definition:n,it:a,isSupported:e}))]},[]));xn("[MercadoPago] Flow support results:",o),n?.add(`isSupported:${o.map(e=>`${e.definition.type}=${e.isSupported}`).join(",")}`);const a=o.find(e=>e.isSupported);if(!a)throw(e.tracker??Jn).sendInitMetrics({error:wn.AuthenticationNotSupported,critical:!0,platformId:e.platformId,bricks:e.bricks??!1,flowVersion:fn.V2,errorDetails:`instance_id=${e.instanceId}`}),new Rd("[MERCADO PAGO]: Authenticator flow is not supported",wn.AuthenticationNotSupported);return xn("[MercadoPago] Selected flow:",a.definition.type),n?.add(`orchestrator:selected=${a.definition.type}`),new Ep(a.it,a.definition,t,e)}async authenticate(){try{up(gp,this,await lp(hp,this).authenticate())}catch(e){if(!lp(wp,this))throw e;(lp(fp,this).tracker??Jn).sendFrontendMetricsError({name:wn.ProviderFallbackAuthenticate,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`instance_id=${lp(fp,this).instanceId} | first=${lp(mp,this).type} | fallback=${lp(mp,this).fallbackFlowOnAuthenticate} | error=${e?.message??"unknown"}`}),up(gp,this,await lp(wp,this).authenticate())}}async authorize(e){try{await lp(hp,this).authorize(e)}catch(e){if(!lp(yp,this))throw e;(lp(fp,this).tracker??Jn).sendFrontendMetricsError({name:wn.ProviderFallbackAuthorize,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`instance_id=${lp(fp,this).instanceId} | first=${lp(mp,this).type} | fallback=${lp(mp,this).fallbackFlowOnAuthorize} | error=${e?.message??"unknown"}`}),up(gp,this,await lp(yp,this).authenticate())}}get simplifiedAuthAvailable(){return lp(hp,this).simplifiedAuthAvailable}get firstFlow(){return lp(mp,this).type}get authResult(){return lp(gp,this)}}function _p(e,t,r){bp(e,t),t.set(e,r)}function bp(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function vp(e,t){return e.get(Ip(e,t))}function Ap(e,t,r){return e.set(Ip(e,t),r),r}function Ip(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Pp=new WeakMap,Tp=new WeakMap,kp=new WeakMap,Mp=new WeakMap,Cp=new WeakSet;class Op{constructor(e,t,r){!function(e,t){bp(e,t),t.add(e)}(this,Cp),_p(this,Pp,void 0),_p(this,Tp,void 0),_p(this,kp,void 0),_p(this,Mp,""),Ap(Pp,this,e),Ap(Tp,this,t),Ap(kp,this,r)}async isSupported(){return!0}get simplifiedAuthAvailable(){return!0}async authenticate(){return{}}async authorize(e){await Ip(Cp,this,Rp).call(this)}}async function Rp(){await Ip(Cp,this,Np).call(this),(vp(Pp,this).tracker??Jn).send(qn.AUTHORIZATION_SUCCESS,{flow:mn.OTP,challenge_id:vp(Mp,this)||vp(Pp,this).sessionId,supertoken:vp(Pp,this).sessionId})}async function Np(){let e="";for(let t=0;t<=vp(Tp,this).iframe;t+=1){const t=await vp(kp,this).runIframe(vp(Pp,this));if(t.ok)return void Ap(Mp,this,t.challengeId??"");if(e=t.cancelled?"user cancelled":"iframe step failed",!t.retriable){if(t.cancelled)throw new Rd(`[MERCADO PAGO]: OTP iframe cancelled: ${e}`,sp.OtpCancelled);throw new Rd(`[MERCADO PAGO]: OTP iframe failed: ${e}`,sp.OtpIframeFailed)}}throw(vp(Pp,this).tracker??Jn).sendFrontendMetricsError({name:sp.OtpIframeFailed,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!0,details:`instance_id=${vp(Pp,this).instanceId} | retries exhausted | ${e}`}),new Rd(`[MERCADO PAGO]: OTP iframe failed: ${e||"retries exhausted"}`,sp.OtpIframeFailed)}function Sp(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class Fp{constructor(e,t,r){this.iframe=e,this.targetOrigin=t,this.callbacks=r,Sp(this,"pendingChannels",[]),Sp(this,"boundPort",null),Sp(this,"payload",null),Sp(this,"attempts",0),Sp(this,"retryId",null),Sp(this,"timeoutId",null),Sp(this,"destroyed",!1)}init(e){this.payload||this.destroyed||(this.payload=e,this.sendAttempt())}nudge(){!this.payload||this.boundPort||this.destroyed||this.sendAttempt()}sendAttempt(){if(this.clearRetry(),!this.payload)return;const e=new MessageChannel;e.port1.onmessage=t=>this.handlePortMessage(e.port1,t),this.pendingChannels.push(e),this.attempts+=1;const t={type:"INIT",payload:this.payload};this.iframe.contentWindow?.postMessage(t,this.targetOrigin,[e.port2]);const r=this.attempts<40?250:2e3;this.retryId=setTimeout(()=>this.sendAttempt(),r)}handlePortMessage(e,t){this.boundPort||this.bind(e),e===this.boundPort&&this.handleMessage(t)}bind(e){this.boundPort=e,this.clearRetry(),this.pendingChannels.forEach(t=>{t.port1!==e&&t.port1.close()}),this.pendingChannels=[],this.timeoutId=setTimeout(()=>{this.callbacks.onError({code:"IFRAME_READY_TIMEOUT",message:"Iframe did not respond in time",recoverable:!1})},15e3)}handleMessage(e){const t=e.data;if(t?.type)switch(t.type){case"INIT_RECEIVED":this.callbacks.onInitReceived?.({attempts:this.attempts});break;case"IFRAME_READY":null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.callbacks.onReady(t.payload);break;case"OTP_SUCCESS":this.callbacks.onSuccess(t.payload);break;case"OTP_ERROR":this.callbacks.onError(t.payload);break;case"OTP_CANCELLED":this.callbacks.onCancelled(t.payload);break;case"OTP_RESEND_ISSUED":this.callbacks.onResendIssued(t.payload);break;case"OTP_VERIFY_RESULT":this.callbacks.onVerifyResult(t.payload)}}clearRetry(){null!==this.retryId&&(clearTimeout(this.retryId),this.retryId=null)}destroy(){this.destroyed=!0,this.clearRetry(),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.pendingChannels.forEach(e=>e.port1.close()),this.pendingChannels=[],this.boundPort?.close(),this.boundPort=null}}const Dp={MLA:"https://mercadopago.com",MLB:"https://mercadopago.com",MLM:"https://mercadopago.com",MLC:"https://mercadopago.com",MCO:"https://mercadopago.com",MPE:"https://mercadopago.com",MLU:"https://mercadopago.com",MPA:"https://mercadopago.com"};Object.values({MLA:"https://beta.mercadopago.com.ar",MLB:"https://beta.mercadopago.com.br",MLM:"https://beta.mercadopago.com.mx",MLC:"https://beta.mercadopago.cl",MCO:"https://beta.mercadopago.com.co",MPE:"https://beta.mercadopago.com.pe",MLU:"https://beta.mercadopago.com.uy",MPA:"https://beta.mercadopago.com"}),Object.values(Dp);const Lp="bottomsheet_container",xp="mp-otp-collapsed-viewport-fix";function Up(e,t,r){jp(e,t),t.set(e,r)}function jp(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $p(e,t){return e.get(zp(e,t))}function Wp(e,t,r){return e.set(zp(e,t),r),r}function zp(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const qp=new Set(["iframe_ready_timeout","phone_not_found","session_not_found","challenge_not_found","otp_challenge_closed","otp_attempts_exceeded","internal_error"]),Vp=new Set(["user_dismissed","session_expired","max_attempts"]),Bp=[["filter","none"],["opacity","1"],["pointer-events","auto"]],Gp=e=>Math.max(1,Math.round(performance.now()-e)),Yp=(e,t)=>{const r=String(e??"").toLowerCase();return t.has(r)?r:"other"};var Kp=new WeakMap,Hp=new WeakMap,Xp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,eh=new WeakMap,th=new WeakMap,rh=new WeakMap,nh=new WeakSet;class ih{constructor(e){!function(e,t){jp(e,t),t.add(e)}(this,nh),Up(this,Kp,void 0),Up(this,Hp,null),Up(this,Xp,null),Up(this,Jp,null),Up(this,Zp,null),Up(this,Qp,null),Up(this,eh,null),Up(this,th,""),Up(this,rh,void 0),Wp(Kp,this,e),Wp(rh,this,e.tracker??Jn)}async run(){return new Promise(e=>{const t=performance.now(),r=(e,t)=>{$p(rh,this).sendFrontendMetricsPerformance({name:e,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,timing:Gp(t)})};let n=!1,i=!1;const o=t=>{i||(i=!0,zp(nh,this,oh).call(this),e(t))},a=document.createElement("div");Wp(Zp,this,a),a.setAttribute("id",Lp),a.setAttribute("data-mercadopago-otp-container","true"),Bp.forEach(([e,t])=>{a.style.setProperty(e,t,"important")}),document.body.appendChild(a),"mobile"===$p(Kp,this).platform&&function(e=document){try{const t=e.documentElement;if(!(e.body&&t&&t.clientHeight>0))return!1;const r=e.createElement("div");r.style.cssText="position:fixed;top:0;left:0;width:1px;height:100vh;visibility:hidden;pointer-events:none",e.body.appendChild(r);const n=r.getBoundingClientRect().height;return r.remove(),0===n}catch{return!1}}()&&(Wp(eh,this,function(e,t=document){const r=t.getElementById(xp);if(r)return()=>r.remove();const n=`#${e} [data-testid='modal-wrapper']`,i=t.createElement("style");return i.id=xp,i.textContent=`${n}{inset:0 !important;width:auto !important;height:auto !important;}${n} > div{height:60% !important;}`,(t.head||t.documentElement).appendChild(i),()=>i.remove()}(Lp)),$p(rh,this).sendFrontendMetricsError({name:"otp_web.viewport_units_collapsed",product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1}));const s=new URL($p(Kp,this).iframeBaseOrigin+"/op-pay/otp/phone-validation"),c=setTimeout(()=>{Un("[MercadoPago] OTP iframe timed out after",6e5,"ms"),$p(rh,this).sendFrontendMetricsError({name:"supertoken.otp.iframe_timeout_total",product:"supertoken",critical:!1}),$p(rh,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.IframeNoResponse,platform_id:$p(Kp,this).platformId,error_critical:!0},`OTP iframe timed out after 600000ms without a terminal outcome | has_challenge=${Boolean($p(th,this))}`,$p(th,this)),o({ok:!1,retriable:!1})},6e5),d=s.origin;$p(Kp,this).bricks.create("confirmationBottomsheet",Lp,{iframe:{src:s.toString(),title:"Confirmar pagamento via SMS",sandbox:"allow-scripts allow-same-origin allow-forms"},callbacks:{onReady:()=>{const e=$p(Zp,this)?.querySelector("iframe");if(!e)return jn("[MercadoPago] OTP bottomsheet onReady fired but iframe element was not found in DOM"),$p(rh,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.BottomsheetLoadingFailed,platform_id:$p(Kp,this).platformId,error_critical:!0},"OTP iframe element not found in DOM after brick onReady"),clearTimeout(c),void o({ok:!1,retriable:!1});if(Wp(Xp,this,e),$p(eh,this)){const t=Math.round(e.getBoundingClientRect().height);$p(rh,this).sendFrontendMetricsError({name:t>0?"otp_web.viewport_fix.sheet_visible":"otp_web.viewport_fix.sheet_collapsed",product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`iframe_height=${t}`})}const i=performance.now();r("supertoken_otp_bottomsheet_ready",t),$p(rh,this).send(qn.RENDER_FRAME,{flow:mn.OTP});let a=!1;const s=()=>{a||(a=!0,r("supertoken_otp_page_boot",i),$p(rh,this).sendFrontendMetricsError({name:"otp_web.page_boot",product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1}))};Wp(Jp,this,new Fp(e,d,{onInitReceived:({attempts:t})=>{s(),$p(rh,this).sendFrontendMetricsError({name:"otp_web.init_received",product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`attempts=${t}`}),e.focus(),e.contentWindow?.focus()},onReady:e=>{Wp(th,this,e.challengeId),n||(n=!0,r("supertoken_otp_challenge_ready",t)),$p(rh,this).send(qn.AUTHENTICATOR,{origin:"web",flow:mn.OTP,challenge_id:e.challengeId,user_matches:!$p(Kp,this).isRequiredInstrument,authenticator_mode:"not_apply"})},onSuccess:e=>{clearTimeout(c),o({ok:!0,challengeId:e.challengeId||$p(th,this)})},onError:e=>{jn("[MercadoPago] OTP iframe ERROR | code:",e.code,"| recoverable:",e.recoverable);const t=e.challengeId||$p(th,this);$p(rh,this).sendFrontendMetricsError({name:"supertoken.otp.iframe_error_total",product:"supertoken",critical:!1,details:`code=${e.code}`}),$p(rh,this).sendFrontendMetricsError({name:`otp_web.iframe_error.${Yp(e.code,qp)}`,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1}),$p(rh,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.OtpErrorIframe,platform_id:$p(Kp,this).platformId,error_critical:!e.recoverable},`code=${e.code} | recoverable=${e.recoverable}`,t),clearTimeout(c),o({ok:!1,retriable:e.recoverable})},onCancelled:e=>{Un("[OTP] authenticator_cancel_web",{reason:e.reason,challenge_id:$p(th,this)}),$p(rh,this).send(qn.AUTHENTICATOR_CANCEL_WEB,{flow:mn.OTP,challenge_id:$p(th,this)}),$p(rh,this).sendFrontendMetricsError({name:wn.OtpCancelledBottomsheet,product:"supertoken",critical:!1,details:`reason=${e.reason}`}),$p(rh,this).sendFrontendMetricsError({name:`otp_web.cancelled.${Yp(e.reason,Vp)}`,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1}),clearTimeout(c),o({ok:!1,retriable:!1,cancelled:"user_dismissed"===e.reason})},onResendIssued:e=>{$p(rh,this).send(qn.AUTHENTICATOR_RESEND,{challenge_id:e.challengeId,resend_limit_exceeded:e.resendLimitExceeded}),e.resendLimitExceeded&&($p(rh,this).sendFrontendMetricsError({name:"supertoken.otp.resend_limit_exceeded_total",product:"supertoken",critical:!1,details:`channel=${e.channel}`}),$p(rh,this).sendError(qn.AUTHENTICATOR_RESEND,{error_name:wn.OtpResendLimitExceeded,platform_id:$p(Kp,this).platformId,error_critical:!1},`resend_limit_exceeded | channel=${e.channel}`,e.challengeId))},onVerifyResult:e=>{$p(rh,this).send(qn.AUTHENTICATOR_VERIFY,{challenge_id:e.challengeId,validation_status:e.validationStatus,attempts_exceeded:e.attemptsExceeded,fulfillment_method:e.fulfillmentMethod})}})),$p(Jp,this).init({theme:"mercado_pago"===$p(Kp,this).theme?"light":"dark",locale:$p(Kp,this).locale,sessionId:$p(Kp,this).sessionId,platform:$p(Kp,this).platform});const l=t=>{const r=t.data;"OTP_PAGE_READY"===r?.type&&t.source===e.contentWindow&&(window.removeEventListener("message",l),Wp(Qp,this,null),s(),$p(Jp,this)?.nudge())};window.addEventListener("message",l),Wp(Qp,this,()=>window.removeEventListener("message",l))},onClose:()=>{Un("[OTP] authenticator_cancel_web (bottomsheet fechado)",{challenge_id:$p(th,this)}),$p(rh,this).send(qn.AUTHENTICATOR_CANCEL_WEB,{flow:mn.OTP,challenge_id:$p(th,this)}),$p(rh,this).sendFrontendMetricsError({name:wn.OtpClosedBottomsheet,product:"supertoken",critical:!1,details:"reason=bottomsheet_closed"}),clearTimeout(c),o({ok:!1,retriable:!1,cancelled:!0})}}}).then(e=>{Wp(Hp,this,e)}).catch(()=>{jn("[MercadoPago] OTP confirmationBottomsheet brick failed to mount"),$p(rh,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.BottomsheetLoadingFailed,platform_id:$p(Kp,this).platformId,error_critical:!0},"confirmationBottomsheet brick failed to mount"),clearTimeout(c),o({ok:!1,retriable:!1})})})}}function oh(){if($p(Qp,this)?.call(this),Wp(Qp,this,null),$p(Jp,this)?.destroy(),Wp(Jp,this,null),Wp(Xp,this,null),$p(Hp,this)?.unmount)try{$p(Hp,this).unmount()}catch{}Wp(Hp,this,null),$p(Zp,this)?.parentNode&&$p(Zp,this).parentNode.removeChild($p(Zp,this)),Wp(Zp,this,null),$p(eh,this)?.call(this),Wp(eh,this,null)}function ah(e,t){return e.get(sh(e,t))}function sh(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var ch=new WeakMap;class dh{constructor(e){(function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)})(this,ch,void 0),function(e,t,r){e.set(sh(e,t),r)}(ch,this,e)}async runIframe(e){return new ih({bricks:ah(ch,this).bricks,sessionId:e.sessionId,theme:ah(ch,this).theme,locale:ah(ch,this).locale,iframeBaseOrigin:ah(ch,this).iframeBaseOrigin,environment:ah(ch,this).environment,isRequiredInstrument:e.isRequiredInstrument,platform:ah(ch,this).platform,tracker:e.tracker,platformId:e.platformId}).run()}}async function lh(e){if((e.headers.get("content-type")??"").includes("application/json"))try{const{code:t,message:r}=await e.json();return[{code:t,message:r}]}catch{return[{code:"malformed_json_response",message:`Invalid JSON body for status ${e.status}`}]}return[{code:"unexpected_error",message:await e.text()}]}const uh=/Version\/|CriOS\/|FxiOS\/|EdgiOS\/|OPiOS\/|OPT\//;function ph(e,t,r){hh(e,t),t.set(e,r)}function hh(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function mh(e,t){return e.get(gh(e,t))}function fh(e,t,r){return e.set(gh(e,t),r),r}function gh(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const wh="mercadopago-passkey-auth",yh=e=>{if("object"!=typeof e||null===e)return e;const{token:t,...r}=e;return r},Eh=e=>{if(void 0===e)return"";let t;try{t="string"==typeof e?e:JSON.stringify(e)}catch{return"[unserializable]"}return void 0===t?"":t.length>2e3?`${t.slice(0,2e3)}…[truncated]`:t},_h=e=>null==e||""===e?"none":String(e).replace(/[^a-zA-Z0-9_]/g,"_").slice(0,50),bh=(...e)=>{const t=e.map(_h).filter(e=>"none"!==e);return t.length?t.join("."):"none"};var vh=function(e){return e.AUTHENTICATE="authenticate",e.ERROR="error",e.CANCELLED="cancelled",e}(vh||{}),Ah=new WeakMap,Ih=new WeakMap,Ph=new WeakMap,Th=new WeakMap,kh=new WeakMap,Mh=new WeakSet;class Ch{constructor(e){!function(e,t){hh(e,t),t.add(e)}(this,Mh),ph(this,Ah,void 0),ph(this,Ih,void 0),ph(this,Ph,void 0),ph(this,Th,""),ph(this,kh,""),fh(Ah,this,e),fh(Ih,this,e.tracker??Jn),fh(Ph,this,Zn({product:mh(Ih,this).FRONTEND_METRICS_PRODUCT_NAME,sendPerformance:e=>mh(Ih,this).sendFrontendMetricsPerformance(e)}))}async isSupported(){const e=navigator.userAgent,t=Yr(e);if((e=>(e=>/; wv\)/.test(e))(e)||(e=>/iPhone|iPad|iPod/.test(e)&&/AppleWebKit/.test(e)&&!uh.test(e))(e))(e))return xn("[MercadoPago] FIDO blocked — in-app browser:",t),mh(Ih,this).sendInitMetrics({error:wn.FidoBlockedInAppBrowser,platformId:mh(Ah,this).platformId,critical:!0,flowVersion:fn.V2,flow:mn.FIDO,errorDetails:`instance_id=${mh(Ah,this).instanceId} | browser=${t}`}),!1;const r=!!window.PublicKeyCredential;return xn("[MercadoPago] FIDO support:",r,"| browser:",t),r||mh(Ih,this).sendInitMetrics({error:wn.FidoNotSupported,platformId:mh(Ah,this).platformId,critical:!0,flowVersion:fn.V2,flow:mn.FIDO,errorDetails:`instance_id=${mh(Ah,this).instanceId} | browser=${t}`}),r}get simplifiedAuthAvailable(){return!0}async authenticate(){return{}}async authorize(){xn("[MercadoPago] FIDO authorize | site:",mh(Ah,this).siteId);try{const e=await mh(Ph,this).call(this,"supertoken_create_transaction",()=>async function(e,t,r,n,i,o){const a=await It.fetch("/transaction",{baseURL:"https://api.mercadopago.com/op-pay/web/v1",method:"POST",retry:3,headers:{"Content-Type":"application/json","X-Public-Key":n,Authorization:`Bearer ${t}`,"X-Session-Id":e,"X-SDK-Instance-ID":i,"X-Flow":o,...!["prod","lts"].includes("prod")&&{"X-Scope":"omega"}},defaultQueries:!1});if(!a.ok){const e=await lh(a);throw new Rd(`Transaction creation failed. Status: ${a.status} ${a.statusText}`,wn.TransactionCreate,e)}return a.json()}(mh(Ah,this).sessionId,mh(Ah,this).token,0,mh(Ah,this).publicKey,mh(Ah,this).instanceId,mn.FIDO));fh(Th,this,e.transaction_id)}catch(e){if(jn("[MercadoPago] createTransaction FAILED:",e),mh(Ih,this).sendFrontendMetricsError({name:wn.TransactionCreate,critical:!0,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,details:`instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | api_details=${JSON.stringify(e?.details)}`}),e instanceof Rd)throw e;throw new Rd("[MERCADO PAGO]: Transaction creation failed",wn.TransactionCreate)}await mh(Ph,this).call(this,"supertoken_run_iframe",async()=>{const e=await gh(Mh,this,Oh).call(this);if(!e.ok){if(e.cancelled)throw new Rd("[MERCADO PAGO]: Payment Authorization cancelled!",wn.FidoCancelled);throw new Rd(`[MERCADO PAGO]: Payment Authorization failed: ${e.error?.message}`,wn.FidoAuthorizeFailed)}});try{await mh(Ph,this).call(this,"supertoken_validate_transaction",()=>async function(e,t,r,n,i,o,a){const s=await It.fetch("/transaction/validate",{baseURL:"https://api.mercadopago.com/op-pay/web/v1",method:"POST",retry:3,headers:{"Content-Type":"application/json","X-Public-Key":e,Authorization:`Bearer ${r}`,"X-SDK-Instance-ID":o,"X-Flow":a,...!["prod","lts"].includes("prod")&&{"X-Scope":"omega"}},body:JSON.stringify({session_id:t,trx_code:n,transaction_id:i}),defaultQueries:!1});if(!s.ok){const e=await lh(s);throw new Rd(`Transaction validation failed. Status: ${s.status} ${s.statusText}`,wn.TransactionValidate,e)}}(mh(Ah,this).publicKey,mh(Ah,this).sessionId,mh(Ah,this).token,mh(kh,this),mh(Th,this),mh(Ah,this).instanceId,mn.FIDO)),mh(Ih,this).send(qn.AUTHORIZATION_SUCCESS,{flow:mn.FIDO,challenge_id:mh(Th,this),supertoken:mh(Ah,this).sessionId})}catch(e){if(jn("[MercadoPago] validateTransaction FAILED:",e),mh(Ih,this).sendFrontendMetricsError({name:wn.TransactionValidate,critical:!0,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,details:`instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | api_details=${JSON.stringify(e?.details)}`}),e instanceof Rd)throw e;throw new Rd("[MERCADO PAGO]: Transaction validation failed",wn.TransactionValidate)}}}async function Oh(e=0){const t=await gh(Mh,this,Rh).call(this);if(!t.ok&&!t.cancelled&&t.error?.retriable&&e<3){Un("[MercadoPago] retriable error — retrying iframe:",t.error.cause);const r=`${wn.FidoIframeRetryAttempt}.${_h(t.error.stage)}.${bh(t.error.code||t.error.message,t.error.webauthnStatus,t.error.webauthnErrorName,t.error.status)}`;return mh(Ih,this).sendFrontendMetricsError({critical:!1,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,name:r,details:`Retrying iframe after retriable failure: instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | attempt=${e+1} | cause=${t.error.cause} | retriable=${t.error.retriable} | stage=${t.error.stage} | status=${t.error.status} | code=${t.error.code} | webauthn_status=${t.error.webauthnStatus} | webauthn_error_name=${t.error.webauthnErrorName} | webauthn_error_message=${t.error.webauthnErrorMessage} | server_error=${Eh(t.error.serverError)} | server_error_message=${Eh(t.error.serverErrorMessage)} | error_message=${t.error.message} | error_category=${r}`}),gh(Mh,this,Oh).call(this,e+1)}return t}async function Rh(){const e=((e,t,r=Jn)=>Fd[e]?Fd[e]:(r.sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.NotSupportedSiteIdForFidoIframeDomain,error_critical:!0,platform_id:t},`siteid received: ${e}`),Fd.MLB))(mh(Ah,this).siteId,mh(Ah,this).platformId,mh(Ih,this)),t=`https://www.${e}/passkey/stand-alone`,r=`https://www.${e}`;return new Promise(n=>{xn("[MercadoPago] opening iframe","| domain:",e);const i=document.createElement("iframe");i.setAttribute("id",wh),i.src=t,i.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),i.setAttribute("allow","publickey-credentials-get; publickey-credentials-create"),mr()||(i.style.width="0",i.style.height="0",i.style.pointerEvents="none",i.setAttribute("tabindex","-1"),i.setAttribute("aria-hidden","true")),document.body.appendChild(i);const o=()=>{const e=document.getElementById(wh);e&&e.remove()};let a=!1;const s=()=>{if(a)return;a=!0,mh(Ih,this).send(qn.RENDER_FRAME,{flow:mn.FIDO});const t=new MessageChannel;t.port1.onmessage=e=>{t.port1.close();const{message:r,data:i,...a}=e.data;if(xn("[MercadoPago] iframe response",JSON.stringify({message:r,data:yh(i),...a})),o(),r===vh.AUTHENTICATE){if(!i.transactionCode)return jn("[MercadoPago] FIDO AUTHENTICATE missing transactionCode — contract broken"),mh(Ih,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.AuthorizationNonCodeErrorIframe,platform_id:mh(Ah,this).platformId,error_critical:!0},`instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | Missing transactionCode in iframe AUTHENTICATE response | data=${Eh(yh(i))}`,mh(Th,this)),void n({ok:!1});fh(kh,this,i.transactionCode),mh(Ih,this).sendFrontendMetricsError({critical:!1,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,name:wn.FidoIframeAuthenticateSuccess,details:`Iframe authenticate success: instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | error_message=${i.errorMessage}`}),mh(Ih,this).send(qn.AUTHENTICATOR,{origin:"web",user_matches:!mh(Ah,this).isRequiredInstrument,authenticator_mode:"none",flow:mn.FIDO,challenge_id:mh(Th,this)}),xn("[MercadoPago] FIDO success"),n({ok:!0,transactionCode:i.transactionCode})}else if(r===vh.ERROR){const e=`${wn.AuthorizationErrorIframe}.${_h(i.error?.stage)}.${bh(i.error?.code||i.error?.message,i.error?.webauthnStatus,i.error?.webauthnErrorName,i.error?.status)}`,t=`Error when Iframe Auth: instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | cause=${i.error?.cause} | retriable=${i.error?.retriable??!1} | stage=${i.error?.stage} | status=${i.error?.status} | code=${i.error?.code} | webauthn_status=${i.error?.webauthnStatus} | webauthn_error_name=${i.error?.webauthnErrorName} | webauthn_error_message=${i.error?.webauthnErrorMessage} | server_error=${Eh(i.error?.serverError)} | server_error_message=${Eh(i.error?.serverErrorMessage)} | error_message=${i.error?.message} | message=${i.message} | error_category=${e} | rest=${Eh(a)}`;mh(Ih,this).sendError(qn.AUTHORIZATION_RETURN,{error_critical:!0,error_name:wn.AuthorizationErrorIframe,platform_id:mh(Ah,this).platformId},t,mh(Th,this)),mh(Ih,this).sendFrontendMetricsError({critical:!0,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,name:e,details:t}),jn("[MercadoPago] Error during payment authorization",JSON.stringify(i.error)),n({ok:!1,error:i.error})}else if(r===vh.CANCELLED){mh(Ih,this).send(qn.AUTHENTICATOR_CANCEL_WEB,{flow:mn.FIDO,challenge_id:mh(Th,this)});const e=`${wn.AuthorizationCancelledIframe}.${bh(i.code,i.webauthnErrorName)}`,t=`Cancel when Iframe Auth: instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | code=${i.code} | webauthn_error_name=${i.webauthnErrorName} | webauthn_error_message=${i.webauthnErrorMessage} | message=${i.message} | error_category=${e} | rest=${Eh(a)}`;mh(Ih,this).sendFrontendMetricsError({critical:!1,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,name:wn.AuthorizationCancelledIframe,details:t}),mh(Ih,this).sendFrontendMetricsError({critical:!1,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,name:e,details:t}),Un("[MercadoPago] Payment Authorization cancelled by user. More information:",JSON.stringify(a),JSON.stringify(yh(i))),n({ok:!1,cancelled:!0})}else{const e=`Unknown flow when Iframe Auth: instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | message=${r} | data=${Eh(yh(i))} | rest=${Eh(a)}`;mh(Ih,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.AuthorizationUnknownMessage,platform_id:mh(Ah,this).platformId,error_critical:!1},e,mh(Th,this)),Un(`[MercadoPago] Payment Authorization unknown message from iframe:', ${r}. More information: ${JSON.stringify(a)}`),n({ok:!1})}},xn("[MercadoPago] start comunicating with Iframe","| domain:",e),mh(Th,this)||(jn("[MercadoPago] sending FIDO postMessage with empty transactionId"),mh(Ih,this).sendFrontendMetricsError({critical:!0,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,name:wn.FidoPostMessageMissingTransactionId,details:`instance_id=${mh(Ah,this).instanceId} | postMessage sent to iframe with empty transactionId`}));try{i.contentWindow?.postMessage({message:vh.AUTHENTICATE,data:{transactionId:mh(Th,this)}},r,[t.port2])}catch(e){const t=e;return o(),mh(Ih,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:wn.IframePostMessageFailed,platform_id:mh(Ah,this).platformId,error_critical:!0},`instance_id=${mh(Ah,this).instanceId} | challenge_id=${mh(Th,this)} | postMessage failed: ${String(t)}`,mh(Th,this)),void n({ok:!1})}i.focus(),i.contentWindow?.focus()};i.addEventListener("load",()=>setTimeout(s,1e3))})}function Nh(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function Sh(e,t){return e.get(Dh(e,t))}function Fh(e,t,r){return e.set(Dh(e,t),r),r}function Dh(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var Lh=new WeakMap,xh=new WeakMap,Uh=new WeakMap,jh=new WeakMap,$h=new WeakMap,Wh=new WeakMap;class zh{constructor(e){Nh(this,Lh,void 0),Nh(this,xh,void 0),Nh(this,Uh,void 0),Nh(this,jh,!1),Nh(this,$h,null),Nh(this,Wh,[]),Fh(Lh,this,e),Fh(xh,this,e.tracker??Jn),Fh(Uh,this,Zn({product:Sh(xh,this).FRONTEND_METRICS_PRODUCT_NAME,sendPerformance:e=>Sh(xh,this).sendFrontendMetricsPerformance(e)}))}async isSupported(){const e="PaymentRequest"in window&&mr()&&An.includes(Yr(navigator.userAgent));if(xn("[MercadoPago] PRAPI browser support:",e,"| browser:",Yr(navigator.userAgent)),!e)return Sh(xh,this).sendInitMetrics({error:wn.PRApiNotSupported,platformId:Sh(Lh,this).platformId,critical:!0,flowVersion:fn.V2,flow:mn.PRAPI,errorDetails:`instance_id=${Sh(Lh,this).instanceId}`}),!1;try{Fh(Wh,this,await Sh(Uh,this).call(this,"supertoken_applications_detect",()=>jd(Sh(Lh,this).siteId,Sh(Lh,this).amount))),xn("[MercadoPago] PRAPI installed apps:",JSON.stringify(Sh(Wh,this)))}catch(e){return Sh(xh,this).sendInitMetrics({error:wn.ApplicationCheckError,platformId:Sh(Lh,this).platformId,errorDetails:`instance_id=${Sh(Lh,this).instanceId} | error=${e.message}`,critical:!0,flowVersion:fn.V2,flow:mn.PRAPI,applications:[]}),!1}const t=$d(Sh(Wh,this));return t?(Fh($h,this,t),xn("[MercadoPago] PRAPI preferred app:",t),!0):(Sh(xh,this).sendInitMetrics({error:wn.NoApplicationsDetected,platformId:Sh(Lh,this).platformId,critical:!0,flowVersion:fn.V2,flow:mn.PRAPI,applications:Sh(Wh,this),errorDetails:`instance_id=${Sh(Lh,this).instanceId}`}),!1)}get simplifiedAuthAvailable(){return!Sh(Lh,this).isRequiredInstrument||Sh(jh,this)}get application(){return Sh($h,this)}get installedApplications(){return Sh(Wh,this)}async authenticate(){return Sh(Lh,this).isRequiredInstrument?(xn("[MercadoPago] PRAPI enrollment check | app:",Sh($h,this)),Fh(jh,this,await(async(e,t,r,n=Jn)=>{let i="user_enrolled_true";const o=performance.now();try{const n=await(async(e,t,r)=>{const{siteId:n,amount:i}=e,{email:o,publicKey:a,productId:s,sessionId:c,instanceId:d}=t,l=Dd(n,i),u=new PaymentRequest([{supportedMethods:Ld(r),data:{version:"v2",action:"verify",email:o,publicKey:a,productId:s,sessionId:c,amount:i,sdkInstanceId:d||mt.getInstanceId(),deviceProfileId:mt.getDeviceProfile()}}],l);return u.hasEnrolledInstrument?.()})(e,t,r);return!1===n&&(i="user_enrolled_false"),n||!1}catch(e){return i="user_enrolled_exception",xn("[MercadoPago] isUserEnrolledInApplication error",e?.message||"Empty error message"),n.sendFrontendMetricsError({name:ps.USER_ENROLLED_EXCEPTION,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`instance_id=${t.instanceId} | error=${e?.message||"Empty error message"}`}),!1}finally{n.sendFrontendMetricsPerformance({name:i,product:"supertoken",timing:performance.now()-o})}})({siteId:Sh(Lh,this).siteId,amount:Sh(Lh,this).amount},{email:Sh(Lh,this).email,publicKey:mt.getPublicKey(),productId:mt.getProductId(),sessionId:Sh(Lh,this).sessionId,instanceId:Sh(Lh,this).instanceId},Sh($h,this),Sh(xh,this))),xn("[MercadoPago] PRAPI enrolled:",Sh(jh,this))):Fh(jh,this,!0),{application:Sh($h,this),applications:[...Sh(Wh,this)],authLevel:Sh(jh,this)?_n.Enrolled:_n.Installed}}async authorize(e){xn("[MercadoPago] PRAPI authorize | app:",Sh($h,this));try{await(async({email:e,amount:t,siteId:r,publicKey:n,pseudotoken:i,sessionId:o,application:a,instanceId:s})=>{if(!a)throw wn.NullApplicationError;const c=Dd(r,t),d=[{supportedMethods:Ld(a),data:{version:"v2",action:"authorize",email:e,publicKey:n,productId:mt.getProductId(),sessionId:o,amount:t,token:i,sdkInstanceId:s||mt.getInstanceId(),deviceProfileId:mt.getDeviceProfile(),site_id:r}}];try{const e=new PaymentRequest(d,c),t=await e.show();if(await t.complete("success"),!1===t?.details?.success)throw wn.AuthorizationFailed}catch(e){const t=e;throw{error:t.toString(),indexedError:Ud(t)}}})({email:Sh(Lh,this).email,amount:Sh(Lh,this).amount,siteId:Sh(Lh,this).siteId,publicKey:Sh(Lh,this).publicKey,pseudotoken:e,sessionId:Sh(Lh,this).sessionId,application:Sh($h,this),instanceId:Sh(Lh,this).instanceId})}catch(e){const{indexedError:t}=e??{},r=(e=>yn.includes(e)?e:wn.PRApiError)(t);throw jn("[MercadoPago] PRAPI authorize failed | errorCode:",r),Sh(xh,this).sendError(qn.AUTHORIZATION_RETURN,{error_name:r,platform_id:Sh(Lh,this).platformId,error_critical:Rn(r)},`instance_id=${Sh(Lh,this).instanceId} | error_code=${r}`),new Rd(`[MERCADO PAGO]: Error while authorizing payment: ${r}`,r)}}}function qh(e,t){return e.get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t))}var Vh=new WeakMap;class Bh{constructor(){!function(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}(this,Vh,[])}add(e){qh(Vh,this).push(e)}toString(){return qh(Vh,this).join("|")}}function Gh(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yh(e,t,r){Kh(e,t),t.set(e,r)}function Kh(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Hh(e,t){return e.get(Jh(e,t))}function Xh(e,t,r){return e.set(Jh(e,t),r),r}function Jh(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const Zh=new WeakMap;var Qh=new WeakMap,em=new WeakMap,tm=new WeakMap,rm=new WeakMap,nm=new WeakMap,im=new WeakMap,om=new WeakMap,am=new WeakMap,sm=new WeakMap,cm=new WeakMap,dm=new WeakMap,lm=new WeakMap,um=new WeakMap,pm=new WeakMap,hm=new WeakSet;class mm{constructor(e,t=Jn){!function(e,t){Kh(e,t),t.add(e)}(this,hm),Yh(this,Qh,void 0),Yh(this,em,void 0),Yh(this,tm,void 0),Yh(this,rm,void 0),Yh(this,nm,void 0),Yh(this,im,void 0),Yh(this,om,void 0),Yh(this,am,void 0),Yh(this,sm,void 0),Yh(this,cm,void 0),Yh(this,dm,void 0),Yh(this,lm,void 0),Yh(this,um,void 0),Yh(this,pm,void 0),Xh(um,this,t),qd(this,t),Xh(pm,this,Qn(t)),Xh(em,this,!1),Xh(Qh,this,!1),Xh(tm,this,""),Xh(rm,this,""),Xh(nm,this,e),Xh(im,this,""),Xh(om,this,""),Xh(am,this,""),Xh(sm,this,!1),Xh(dm,this,""),Xh(lm,this,!1)}static async create(e,t,r,n){const i=Jn.resolveIntegration(n?.integration);mm.resetInstance(),Jn.setIntegration(i);const o=Jn.forIntegration(i),a=mm.creationCount+=1;return Qn(o)("supertoken_create",async()=>{const i=new mm(r,o);return Jn.setContext({siteId:mt.getSiteId(),version:"2.83.6",instanceId:mt.getInstanceId()}),await Jh(hm,i,fm).call(i,e,t,n),Xh(Qh,i,!0),Zh.set(i,{Authorization:`Bearer ${Hh(im,i)}`,"X-Session-Id":Hh(om,i)}),a===mm.creationCount&&(mm.instance=i),i})}async authorizePayment(e){if(!e)throw new Rd("[MERCADO PAGO]: Payment method token is required to authorize payment",wn.InvalidPaymentMethodToken);if(!Hh(Qh,this))throw Hh(um,this).sendError(qn.START,{error_name:wn.NotInitialized,platform_id:Hh(dm,this),error_critical:!0,applications:[]},`instance_id=${Hh(am,this)}`),new Rd("[MERCADO PAGO]: Authenticator is not yet initialized",wn.NotInitialized);if(!this.getSimplifiedAuth())throw Un("[MercadoPago] authorizePayment blocked — simplifiedAuth not available (is_required_instrument=true, not enrolled)"),Hh(um,this).sendError(qn.START,{error_name:wn.NoFastPaymentTokenToAuthorize,platform_id:Hh(dm,this),error_critical:!0,flow:Hh(cm,this).firstFlow??void 0,applications:Hh(cm,this).authResult.applications??[]},`instance_id=${Hh(am,this)}`),new Rd("[MERCADO PAGO]: There is no fast payment token to authorize",wn.NoFastPaymentTokenToAuthorize);if(Hh(em,this))throw Hh(um,this).sendError(qn.START,{error_name:wn.AlreadyShowing,platform_id:Hh(dm,this),error_critical:!1,flow:Hh(cm,this).firstFlow??void 0,applications:Hh(cm,this).authResult.applications??[]},`instance_id=${Hh(am,this)}`),new Rd("[MERCADO PAGO]: Authenticator is already showing",wn.AlreadyShowing);Hh(um,this).send(qn.START,{flow:Hh(cm,this).firstFlow??void 0,applications:Hh(cm,this).authResult.applications??[]}),Xh(em,this,!0);try{await Hh(pm,this).call(this,`supertoken_authorize_payment_${Hh(cm,this).firstFlow}`,()=>Hh(cm,this).authorize(e))}finally{Xh(em,this,!1)}}getSimplifiedAuth(){return Hh(cm,this).simplifiedAuthAvailable}getPaymentInformation(){return{amount:Hh(tm,this),email:Hh(rm,this)}}static resetInstance(){mm.instance&&Zh.delete(mm.instance),mm.instance=null}static getInstance(){return mm.instance}getFastPaymentToken(){return Hh(cm,this).simplifiedAuthAvailable?Sd({token:Hh(im,this),sessionId:Hh(om,this)},Hh(tm,this),Hh(um,this)):null}getApplication(){return Hh(cm,this).authResult.application??null}}async function fm(e,t,r){mt.setProductId(ys());const n=mt.getSiteId();Xh(am,this,mt.getInstanceId());const i=new Bh;i.add("ctor");let{bricks:o,platformId:a}=r||{};ap(bn.ParamsValidate);const s=Cd(a);if(s||(a="none"),Hh(um,this).setPlatformId(a??"none"),Xh(dm,this,a??""),s||(Hh(um,this).sendInitMetrics({error:wn.InvalidPlatformId,critical:!1,flowVersion:fn.V2}),Un("[MERCADO PAGO]: Invalid platform Id provided. Please check the options before initializing.")),Md(o)||(Hh(um,this).sendInitMetrics({error:wn.InvalidBricks,critical:!1,platformId:a,flowVersion:fn.V2}),Un("[MERCADO PAGO]: Invalid bricks provided. Please check the options before initializing."),o=!1),Xh(lm,this,o??!1),!vn.includes(n))throw Hh(um,this).sendInitMetrics({error:wn.SiteIdNotSupported,critical:!0,platformId:a,bricks:o,flowVersion:fn.V2}),new Rd(`[MERCADO PAGO]: The Site ID ${n} is not supported`,wn.SiteIdNotSupported);if(!Td(t))throw Hh(um,this).sendInitMetrics({error:wn.InvalidEmail,critical:!0,platformId:a,bricks:o,flowVersion:fn.V2}),new Rd("[MERCADO PAGO]: Invalid email address provided",wn.InvalidEmail);const c=kd(e,n);if(!c.valid)throw Hh(um,this).sendInitMetrics({error:c.error,critical:!0,platformId:a,bricks:o,flowVersion:fn.V2}),new Rd(c.error===wn.AmountDecimalsNotAllowed?`[MERCADO PAGO]: The currency of site ${n} does not accept decimals, but the amount provided has them: ${e}`:`[MERCADO PAGO]: Invalid amount value provided: ${e}`,c.error);if(Xh(tm,this,c.value),!mt.getPublicKey())throw Hh(um,this).sendInitMetrics({error:wn.PublicKeyNotSet,critical:!0,platformId:a,bricks:o,flowVersion:fn.V2}),new Rd("[MERCADO PAGO]: Public key not set. Please set the public key before initializing.",wn.PublicKeyNotSet);i.add("paramsValidated");const d=mr()?"mobile":"desktop";let l=[];ap(bn.UserFlowsFetch);const u=mt.getDeviceProfile();xn("[MercadoPago]: User-Agent: ",navigator.userAgent,"| Device Profile Id: ",u);try{const e=await Hh(pm,this).call(this,"supertoken_user_flows_fetch",()=>(async(e,t,r)=>{const{publicKey:n,instanceId:i,deviceProfile:o,uid:a,platformId:s,tracker:c=Jn}=r,d=(e=>void 0!==e&&"none"!==e&&kn.test(e))(s);let l;Boolean(s)&&"none"!==s&&!d&&c.sendFrontendMetricsError({name:wn.PlatformIdHeaderDropped,product:Jn.FRONTEND_METRICS_PRODUCT_NAME,critical:!1,details:`platformId did not match header allowlist pattern | instance_id=${i}`});try{l=await It.fetch(`/v2/user-flows?amount=${encodeURIComponent(e)}`,{baseURL:"https://api.mercadopago.com",method:"GET",retry:0,rejectWithError:!0,headers:{Authorization:n,"X-Email":t,"X-SDK-Instance-ID":i,"X-Device-Profile-ID":o,"X-Request-Device-ID":a,...d&&{"X-Platform-Id":s},...!["prod","lts"].includes("prod")&&{"X-Scope":"omega"}},defaultQueries:!1})}catch(e){if(e instanceof Error&&!(e instanceof Rd))throw new Rd(e.message||"User flows request has failed",wn.ApiRequestFailed);const t=e;if(401===t?.status)throw new Rd("User flows request has failed with status 401",wn.UserFlows401,t?.errors);throw new Rd("User flows request has failed",wn.ApiRequestFailed,t?.errors)}return(e=>{if(!e.user_flows)throw jn("[MercadoPago] FAIL #1: user_flows missing/falsy →",e.user_flows),new Rd("user_flows property is missing in the response",wn.UserFlowsMalformed);if(!Array.isArray(e.user_flows))throw jn("[MercadoPago] FAIL #2: user_flows not array →",e.user_flows),new Rd("user_flows property must be an array",wn.UserFlowsMalformed);const t=0===e.user_flows.length,r=1===e.user_flows.length&&"guest"===e.user_flows[0];if(xn("[MercadoPago] isEmpty:",t,"| isGuestOnly:",r),t||r)return xn("[MercadoPago] EARLY RETURN (empty or guest-only) → token/session_id zeroed"),{user_flows:e.user_flows,token:"",session_id:"",is_required_instrument:!1};if(!e.token)throw jn("[MercadoPago] FAIL #3: token missing/falsy"),new Rd("token property is missing in the response",wn.UserFlowsMalformed);if("string"!=typeof e.token)throw jn("[MercadoPago] FAIL #4: token not string → typeof=",typeof e.token),new Rd("token property must be a string",wn.UserFlowsMalformed);if(!e.session_id)throw jn("[MercadoPago] FAIL #5: session_id missing/falsy"),new Rd("session_id property is missing in the response",wn.UserFlowsMalformed);if("string"!=typeof e.session_id)throw jn("[MercadoPago] FAIL #6: session_id not string → typeof=",typeof e.session_id),new Rd("session_id property must be a string",wn.UserFlowsMalformed);if(void 0===e.is_required_instrument||null===e.is_required_instrument)throw jn("[MercadoPago] FAIL #7: is_required_instrument null/undefined →",e.is_required_instrument),new Rd("is_required_instrument property is not defined",wn.UserFlowsMalformed);if("boolean"!=typeof e.is_required_instrument)throw jn("[MercadoPago] FAIL #8: is_required_instrument not boolean → typeof=",typeof e.is_required_instrument,"| value=",e.is_required_instrument),new Rd("is_required_instrument must be a boolean",wn.UserFlowsMalformed);const n={user_flows:e.user_flows,token:e.token,session_id:e.session_id,is_required_instrument:e.is_required_instrument};return xn("[MercadoPago]:",{userFlows:n.user_flows,is_required_instrument:n.is_required_instrument}),n})(await l.json())})(Hh(tm,this),t,{publicKey:mt.getPublicKey(),instanceId:Hh(am,this),deviceProfile:u,uid:lr.getUid(),platformId:a,tracker:Hh(um,this)}));l=e.user_flows,Xh(im,this,e.token),Xh(om,this,e.session_id),Xh(sm,this,e.is_required_instrument),i.add("userFlows:ok")}catch(e){const t=(e=>{if(e instanceof Rd)return e;const t=e instanceof Error?e.message:null;return new Rd(t||"User flows request has failed",wn.ApiRequestFailed)})(e);throw Hh(um,this).sendInitMetrics({error:t.errorCode,errorDetails:`instance_id=${Hh(am,this)} | ${t?.details?.length?JSON.stringify(t.details):t.message}`,critical:t.errorCode!==wn.UserFlows401,platformId:a,bricks:o,flowVersion:fn.V2}),new Rd("[MERCADO PAGO]: Error while fetching user flows",t.errorCode,t?.details)}ap(bn.FlowSelect),Xh(rm,this,t),i.add("buildOrchestrator:start"),Xh(cm,this,await Jh(hm,this,gm).call(this,l,d,i)),ap(bn.ProviderPrepare),await Hh(cm,this).authenticate(),i.add("authenticate:ok"),xn("[MercadoPago] init complete","| selected flow:",Hh(cm,this).firstFlow);const p=Hh(cm,this).firstFlow;Hh(um,this).sendInitMetrics({flow:p??void 0,availableFlows:l,platformId:a,bricks:o,flowVersion:fn.V2,sessionId:Hh(om,this),hasRequiredInstrument:Hh(sm,this),amount:Hh(tm,this),instanceId:Hh(am,this),breadcrumb:i.toString(),application:Hh(cm,this).authResult.application,applications:Hh(cm,this).authResult.applications??[],authLevel:Hh(cm,this).authResult.authLevel})}async function gm(e,t,r){const n={email:Hh(rm,this),publicKey:mt.getPublicKey(),amount:Hh(tm,this),token:Hh(im,this),sessionId:Hh(om,this),siteId:mt.getSiteId(),instanceId:Hh(am,this),productId:mt.getProductId(),isRequiredInstrument:Hh(sm,this),platformId:Hh(dm,this),bricks:Hh(lm,this),tracker:Hh(um,this)},i=function(e){const t=Dp[e];if(!t)throw new Error(`[MERCADO PAGO]: OTP prod origin not mapped for siteId "${e}"`);return t}(mt.getSiteId()),o=new dh({bricks:Hh(nm,this),iframeBaseOrigin:i,environment:"prod",theme:"mercado_pago",locale:mt.getLocale(),meliSessionId:Hh(om,this),deviceId:"",platform:t}),a=new Op(n,cp,o),s=new Ch(n),c=new zh(n),d={[mn.PRAPI]:c,[mn.FIDO]:s,[mn.OTP]:a};return Ep.create(n,d,e,r)}function wm(e){return{available:!1,paymentMethods:[],application:null,getPaymentInformation:()=>({amount:e.amount,email:e.payer.email}),async submit(e){throw new Rd("[MERCADO PAGO]: Wallet is not available",wn.AuthenticationNotSupported)},mountSecurityCode(e,t){},destroy(){}}}function ym(e,t=wn.ApiRequestFailed,r="[MERCADO PAGO]: Wallet request has failed"){if(e instanceof Rd)return e;if(e instanceof Error)return new Rd(e.message||r,t);const n=function(e){if("object"!=typeof e||null===e)return null;const{message:t,status:r}=e,n=[];return"string"==typeof t&&t.length>0&&n.push(t),"number"==typeof r&&n.push(`status ${r}`),n.length>0?n.join(" | "):null}(e);return new Rd(n?`${r}: ${n}`:r,t)}function Em(e,t,r){return Promise.resolve().then(e).catch(e=>{throw ym(e,t,r)})}Gh(mm,"instance",null),Gh(mm,"creationCount",0);const _m="[MERCADO PAGO][wallet]",bm=e=>Date.now()-e+"ms",vm=e=>`chars=${"string"==typeof e?e.length:0}`;async function Am(e,t,r){const n=Date.now();try{const i=await t();return xn(`${_m} ${e} ok · ${r?`${r(i)} · `:""}${bm(n)}`),i}catch(t){throw xn(`${_m} ${e} FAILED · errorCode=${(e=>e instanceof Rd?e.errorCode:"unknown")(t)} · ${bm(n)}`),t}}function Im(e,t,r){return{amount:e,payment_method:{id:t.id,token:t.token,type:t.type,...void 0!==r&&{open_finance_account_id:r}}}}let Pm=!1;function Tm(e,t){let r=!1;return function(){r||(r=!0,t(),e())}}const km="https://http2.mlstatic.com/frontend-assets/op-cho-bricks/img/issuers",Mm=Object.freeze({MLB:"https://www.mercadopago.com.br/privacidade",MLA:"https://www.mercadopago.com.ar/privacidad",MLM:"https://www.mercadopago.com.mx/privacidad",MLC:"https://www.mercadopago.cl/privacidad",MCO:"https://www.mercadopago.com.co/privacidad"}),Cm=Object.freeze({MLB:"Saldo no Mercado Pago",MLA:"Dinero disponible en Mercado Pago",MLM:"Saldo disponible en Mercado Pago",MLC:"Dinero disponible en Mercado Pago",MCO:"Dinero disponible en Mercado Pago"}),Om=Object.freeze({MLB:{credit:"Crédito",debit:"Débito"},MLA:{credit:"Crédito",debit:"Débito"},MLM:{credit:"Crédito",debit:"Débito"},MLC:{credit:"Crédito",debit:"Débito"},MCO:{credit:"Crédito",debit:"Débito"}}),Rm=Object.freeze({amex:"amex.svg",argencard:"argencard.svg",cabal:"cabal.svg",cencosud:"cencosud.svg",cmr:"cmr.svg",codensa:"codensa.svg",cordobesa:"cordobesa.svg",debmaster:"debmaster.svg",diners:"diners.svg",elo:"elo.svg",hipercard:"hipercard.svg",lider:"lider.svg",maestro:"maestro.svg",master:"master.svg",mercadopago:"mercadopago.svg",naranja:"naranja.svg",nativa:"nativa.svg",oca:"oca.svg",presto:"presto.svg",redcompra:"redcompra.svg",tarshop:"tarshop.svg",visa:"visa.svg"});function Nm(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Sm(e,t){if("account_money"===e.type)return Nm(Cm,t)??e.name;if("credit_card"!==e.type&&"debit_card"!==e.type)return e.name;const r=Nm(Om,t);if(!r||!e.issuerName||!e.lastFourDigits)return e.name;const n="credit_card"===e.type?r.credit:r.debit;return`${e.issuerName} ${n} •••• ${e.lastFourDigits}`}function Fm(e){if("account_money"===e.type)return`${km}/account-money.svg`;if("credit_card"!==e.type&&"debit_card"!==e.type)return e.thumbnail??"";const t=Nm(Rm,e.id);return t?`${km}/${t}`:e.thumbnail??""}async function Dm(e,t,r,n){const i=e.getPaymentInformation();let o,a;try{const e=(await xt({amount:i.amount},n)).data??[];o=function(e,t=""){return e.map(e=>{const r=function(e){return"credit_card"===e.type||"debit_card"===e.type}(e),n={id:e.id,token:e.token,type:e.type,name:Sm(r?{type:e.type,name:e.name,issuerName:e.issuer.name,lastFourDigits:e.card.card_number.last_four_digits}:{type:e.type,name:e.name},t),thumbnail:Fm(e),...Array.isArray(e.installments)&&{installments:(i=e.installments,i.map(e=>({installments:e.installments,installmentAmount:e.installment_amount,totalAmount:e.total_amount,installmentRate:e.installment_rate,labels:e.labels??[]})))}};var i;return r?{...n,bin:e.card.card_number.bin,lastFourDigits:e.card.card_number.last_four_digits,securityCode:{length:e.security_code_settings.length,required:"mandatory"===e.security_code_settings.mode}}:n})}(e,mt.getSiteId()),a=function(e){const t=new Map;return e.forEach(e=>{"smart_transfer"===e.type&&t.set(e.token,e.open_finance_account_id)}),t}(e)}catch(e){throw Un(`[MERCADO PAGO]: getAccountPaymentMethods failed (status: ${e?.status??"unknown"}).`),r(),ym(e,wn.ApiRequestFailed,"[MERCADO PAGO]: Failed to fetch the account payment methods")}let s=null,c=null,d=!1,l=null;const u=(p=mt.getSiteId(),Nm(Mm,p));var p;const h=function(e){let t=!1;return Object.assign(async function(r){if(t)throw new Rd("[MERCADO PAGO]: A Wallet submit is already in progress — wait for it to resolve before retrying",wn.SubmitInProgress);t=!0;try{return await(async({token:t,getCardToken:r})=>{(e.tracker??Jn).send(qn.WALLET_SUBMIT,{card_tokenization_source:"function"==typeof r?"integrator":"sdk"});const n=e.paymentMethods.find(e=>e.token===t);if(!n)throw new Rd("[MERCADO PAGO]: token not found in this Wallet's payment methods",wn.InvalidPaymentMethodToken);const i=n.token,o=Date.now(),a="credit_card"===n.type||"debit_card"===n.type,s=!0===n.securityCode?.required,c=a&&s;if(xn(`${_m} submit start · mode=${r?"B":"A"} · type=${n.type} · cvvRequired=${s}`),!c)return a&&r&&Un("[MERCADO PAGO]: getCardToken ignored because this card does not require CVV tokenization."),xn(`${_m} no CVV to tokenize · authorizing only`),await Am("authorize payer",()=>Em(()=>e.authorizePayment(i),wn.ApiRequestFailed,"[MERCADO PAGO]: Failed to authorize the payment")),xn(`${_m} submit ok · total=${bm(o)}`),Im(e.amount,n,e.getOpenFinanceAccountId(n.token));const d={Authorization:e.getAuthorizationHeader(),"X-Public-key":mt.getPublicKey()};let l;if(r){e.hasMountedCvv(i)&&Un("[MERCADO PAGO]: a CVV secure-field is mounted for this payment method but getCardToken was provided — Modo B takes precedence and the mounted field is not used.");const{card_id:t}=await Am("resolve card_id",()=>Em(()=>Xt(i,d),wn.ApiRequestFailed,"[MERCADO PAGO]: Failed to resolve card_id for BYO tokenization"),e=>vm(e.card_id));if("string"!=typeof t||0===t.trim().length)throw new Rd("[MERCADO PAGO]: This payment method has no card_id to tokenize against",wn.ApiRequestFailed);const n=await Am("integrator tokenizer",()=>Em(()=>r(t),wn.ApiRequestFailed,"[MERCADO PAGO]: BYO tokenization failed — getCardToken rejected"),e=>vm(e?.id));if(!n||"string"!=typeof n.id||0===n.id.trim().length)throw new Rd("[MERCADO PAGO]: BYO tokenization failed — getCardToken returned an invalid card token",wn.ApiRequestFailed);l=n.id}else{const{createCardToken:t}=e;if(!t)throw new Rd("[MERCADO PAGO]: The fields API is unavailable — secure-fields tokenization cannot run (Mode A)",wn.AuthenticationNotSupported);if(!e.hasMountedCvv(i))throw new Rd("[MERCADO PAGO]: No CVV field is mounted for this payment method — call mountSecurityCode(selector, { token }) before submit(), or pass getCardToken (Mode B)",wn.AuthenticationNotSupported);const{card_id:r}=await Em(()=>Xt(i,d),wn.ApiRequestFailed,"[MERCADO PAGO]: Failed to resolve card_id for CVV tokenization"),n=await Am("secure-fields tokenizer",()=>Em(()=>t(r,i),wn.ApiRequestFailed,"[MERCADO PAGO]: CVV tokenization failed — secure-fields rejected"),e=>vm(e?.id));if(!n||"string"!=typeof n.id||0===n.id.trim().length)throw new Rd("[MERCADO PAGO]: CVV tokenization failed — secure-fields returned an invalid card token",wn.ApiRequestFailed);l=n.id}return await Am("link card token",()=>Em(()=>Jt(i,d,{id:l}),wn.ApiRequestFailed,"[MERCADO PAGO]: Failed to update pseudotoken with the resolved card token")),await Am("authorize payer",()=>Em(()=>e.authorizePayment(i),wn.ApiRequestFailed,"[MERCADO PAGO]: Failed to authorize the payment")),xn(`${_m} submit ok · total=${bm(o)}`),Im(e.amount,n,e.getOpenFinanceAccountId(n.token))})(r)}finally{t=!1}},{isInFlight:()=>t})}({paymentMethods:o,getOpenFinanceAccountId:e=>a.get(e),amount:i.amount,getAuthorizationHeader:()=>n.Authorization,createCardToken:t?(e,r)=>t.createCardToken({cardId:e},{group:r}):void 0,hasMountedCvv:e=>null!==s&&c===e,authorizePayment:t=>e.authorizePayment(t),tracker:Vd(e)});return{available:!0,paymentMethods:o,...u&&{privacyPolicyUrl:u},application:(m=e.getApplication(),m===En.MercadoPago?"MP":m===En.MercadoLibre?"ML":null),getPaymentInformation:()=>i,submit(e){if(d)return Promise.reject(new Rd("[MERCADO PAGO]: This Wallet was destroyed — create a new one before calling submit()",wn.AuthenticationNotSupported));const t=h.isInFlight(),r=h(e);if(t)return r;const n=r.catch(()=>{}).finally(()=>{l===n&&(l=null)});return l=n,r},mountSecurityCode(e,r){if(!t)return void Un("[MERCADO PAGO]: mountSecurityCode called but the fields API is unavailable.");if(d)return void Un("[MERCADO PAGO]: mountSecurityCode called on a destroyed Wallet — ignoring.");const n=o.find(e=>e.token===r.token);if(!n)throw new Rd("[MERCADO PAGO]: token not found in this Wallet's payment methods",wn.InvalidPaymentMethodToken);if(s&&(s.unmount(),s=null),c=null,!n.securityCode)return void Un(`[MERCADO PAGO]: mountSecurityCode is not applicable to payment method type "${n.type}" — ignoring.`);if(!n.securityCode.required)return void Un("[MERCADO PAGO]: mountSecurityCode ignored because this card is already tokenized.");const i=function(e,t,r){if(!1===r.securityCode?.required)return;const n=e.create("securityCode",{group:r.token});if(r.securityCode){const e={length:r.securityCode.length,mode:r.securityCode.required?"mandatory":"optional",card_location:"back"};n.on("ready",()=>{n.update({settings:e})})}return n.mount(t),n}(t,e,{...r,securityCode:n.securityCode});i&&(s=i,c=n.token)},destroy:Tm(()=>l?l.finally(r):r(),()=>{d=!0;const e=()=>{s&&(s.unmount(),s=null),c=null};l?l.finally(e):e()})};var m}function Lm(e,t,r){xm(e,t),t.set(e,r)}function xm(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Um(e,t,r){return e.set($m(e,t),r),r}function jm(e,t){return e.get($m(e,t))}function $m(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const Wm=new Set([wn.SiteIdNotSupported,wn.NoApplicationsDetected,wn.PRApiNotSupported,wn.AuthenticationNotSupported,wn.FidoNotSupported,wn.FidoBlockedInAppBrowser]);var zm=new WeakMap,qm=new WeakMap,Vm=new WeakMap,Bm=new WeakMap,Gm=new WeakMap,Ym=new WeakMap,Km=new WeakMap,Hm=new WeakSet,Xm=new WeakMap,Jm=new WeakMap,Zm=new WeakMap,Qm=new WeakMap,ef=new WeakMap,tf=new WeakMap,rf=new WeakMap,nf=new WeakMap,of=new WeakMap;async function af(e,t){return await jm(qm,this),jm(Bm,this).getFastPaymentsAccountPaymentMethods(e,t)}window.MercadoPago=class{constructor(e,t={}){var r;!function(e,t){xm(e,t),t.add(e)}(this,Hm),Lm(this,zm,void 0),Lm(this,qm,void 0),Lm(this,Vm,null),Lm(this,Bm,void 0),Lm(this,Gm,void 0),Lm(this,Ym,void 0),Lm(this,Km,void 0),function(e,t,r){(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"fields",{create:(e,t)=>(mt.setIframeEnabled(!0),jm(Bm,this).fields.create(e,jm(Ym,this),t)),createCardToken:async(e,t)=>{gs.send({path:"/core_methods/create_card_token",type:gs.TRACK_TYPE_EVENT,eventData:{is_iframe:mt.getIframeEnabled()}});const r=this.formatTokenOptions(t);return jm(Bm,this).fields.createCardToken(e,jm(Ym,this),r)},updateCardToken:async(e,t)=>{gs.send({path:"/core_methods/update_card_token",type:gs.TRACK_TYPE_EVENT,eventData:{is_iframe:mt.getIframeEnabled()}});const r=this.formatTokenOptions(t);return jm(Bm,this).fields.updateCardToken(e,jm(Ym,this),r)}}),Lm(this,Xm,()=>Ot.hasSinglePublicKey()&&!cs),Lm(this,Jm,async e=>{if(!jm(Xm,this).call(this))return;let t;const r=new Promise(e=>{t=setTimeout(()=>e(!1),2e3)});try{if(!await Promise.race([jm(qm,this).then(()=>!0),r]))return}catch{return}finally{clearTimeout(t)}return jm(Xm,this).call(this)?(e=>cs?void 0:ss.get(e))(e):void 0}),Lm(this,Zm,e=>{const t=(e=>{const t=typeof e;return"string"!==t?new Error(`MercadoPago.js - Type of public_key must be string. Received ${t}`):e&&0!==e.trim().length?/\s/g.test(e)?new Error("MercadoPago.js - Your public_key is invalid, as it contains whitespaces."):void 0:new Error("MercadoPago.js - Your public_key cannot be empty.")})(e);if(t)throw t}),Lm(this,Qm,e=>{const t=(e=>{const t=new ls,{locale:r,advancedFraudPrevention:n,deviceProfileCspNonce:i}=e;if(r&&("string"!=typeof r&&t.addError({...xa.default,description:"Type of locale must be string. Received "+typeof r}),!Object.keys(lt).includes(r))){let t=Object.keys(lt).find(e=>e.toLowerCase().startsWith(r));t=t?"es"===r.toLowerCase()?"es-CO":t:"en-US",e.locale=t,console.warn(`The requested language '${r}' is not supported, using the fallback language '${t}'.`)}return n&&"boolean"!=typeof n&&t.addError({...xa.default,description:"Type of advancedFraudPrevention must be boolean. Received "+typeof n}),void 0!==i&&("string"!=typeof i?t.addError({...xa.default,description:"Type of deviceProfileCspNonce must be string. Received "+typeof i}):i.trim()?/\s/.test(i)&&t.addError({...xa.default,description:"deviceProfileCspNonce cannot contain whitespaces."}):t.addError({...xa.default,description:"deviceProfileCspNonce cannot be empty."})),t.getErrors()})(e);if(t.length)throw console.warn("MercadoPago.js - Invalid options: ",t),t.forEach(e=>{gs.sendFrontendMetricsError({name:ps.VALIDATION_ERROR,product:"core",critical:!1,details:`Core.validateOptions: ${e.description}`})}),new Error("MercadoPago.js could not be loaded")}),Lm(this,ef,e=>Object.assign({locale:is(),advancedFraudPrevention:!0,trackingDisabled:!1},e)),Lm(this,tf,async()=>{Um(Gm,this,new tr),Um(Bm,this,new Fa({services:jm(Gm,this)})),await(async e=>{if(mt.getSiteId())return;const t=mt.getPublicKey(),r=(await e.getPaymentMethods({limit:1,public_key:t})).results.find(e=>e.site_id),n=r?.site_id;n&&(mt.setSiteId(n),ss.set(t,n))})(jm(Gm,this)),gs.setContext({siteId:mt.getSiteId(),advancedFraudPrevention:jm(zm,this).advancedFraudPrevention,locale:jm(zm,this).locale,publicKey:mt.getPublicKey(),version:"2.83.6"})}),Lm(this,rf,async(e,t)=>{await jm(qm,this),jm(Km,this)||gs.send({path:`${e||""}`,type:gs.TRACK_TYPE_VIEW,eventData:t}),e&&Um(Km,this,!0)}),Lm(this,nf,async e=>{await jm(rf,this).call(this,"/core_methods",{is_iframe:mt.getIframeEnabled()}),gs.send({path:`/core_methods${e}`,type:gs.TRACK_TYPE_EVENT,eventData:{is_iframe:mt.getIframeEnabled()}})}),Lm(this,of,()=>(jm(Vm,this)||Um(Vm,this,(async()=>{try{const{advancedFraudPrevention:e}=jm(zm,this);if(!e)return;const t=await ft(jm(zm,this).deviceProfileCspNonce);mt.setDeviceProfile(t)}catch(e){console.warn("MercadoPago.js - DeviceProfile could not be loaded",e),gs.sendFrontendMetricsError({name:ps.LOAD_FAILED,product:"core",critical:!1,details:`Core.setupDeviceProfile: ${e instanceof Error?e.message:String(e)}`})}})()),jm(Vm,this))),mt.setInstanceId(dr()),jm(Zm,this).call(this,e),jm(Qm,this).call(this,t),Ot.registerInstantiation(mt.getInstanceId(),e),Um(zm,this,jm(ef,this).call(this,t)),Um(Ym,this,new mo),Um(Km,this,!1),t.siteId&&(r=t.siteId,mt.setSiteId(r),cs=!0),mt.setPublicKey(e),mt.setLocale(jm(zm,this).locale),mt.setIframeEnabled(!1),mt.setTrackingDisabled(jm(zm,this).trackingDisabled),mt.setFrontendStack(jm(zm,this).frontEndStack),mt.setProductId(ys()),Um(qm,this,jm(tf,this).call(this)),jm(rf,this).call(this,"",{success:!0,frontEndStack:mt.getFrontendStack()}).catch(()=>{}),jm(of,this).call(this)}async getIdentificationTypes(){return await jm(qm,this),await jm(nf,this).call(this,"/identification_types"),jm(Bm,this).getIdentificationTypes()}async getPaymentMethods(e){return await jm(qm,this),await jm(nf,this).call(this,"/payment_methods"),jm(Bm,this).getPaymentMethods(e)}async getAccountPaymentMethods(e){return await jm(qm,this),jm(Bm,this).getAccountPaymentMethods(e)}async getAccountPaymentMethod(e,t){return await jm(qm,this),jm(Bm,this).getAccountPaymentMethod(e,t)}async getCardId(e,t){return await jm(qm,this),jm(Bm,this).getCardId(e,t)}async updatePseudotoken(e,t,r){return await jm(qm,this),jm(Bm,this).updatePseudotoken(e,t,r)}async getIssuers(e){return await jm(qm,this),await jm(nf,this).call(this,"/issuers"),jm(Bm,this).getIssuers(e)}async getInstallments(e){return await jm(qm,this),await jm(nf,this).call(this,"/installments"),jm(Bm,this).getInstallments(e)}async createCardToken(e,t){return await jm(qm,this),await jm(nf,this).call(this,"/create_card_token"),jm(Bm,this).createCardToken(e,t)}async updateCardToken(e,t){return await jm(qm,this),await jm(nf,this).call(this,"/update_card_token"),jm(Bm,this).updateCardToken(e,t)}async checkEligibility(e){return await jm(qm,this),jm(Bm,this).checkEligibility(e)}getDocumentValidator(e,t,r){return function(e,t,r){switch(e){case"CPF":return new Nu;case"CNPJ":return new Ru;case"CI":return new ku;case"RUT":return new Yu;case"Otro":if(!t||!r){const e="Invalid value of minLength or maxLength for other validator";throw Ku(e),new Error(e)}return new Gu(t,r);default:if(!t||!r){const e="Invalid value of minLength or maxLength for general validator";throw Ku(e),new Error(e)}return new ju(t,r)}}(e,t,r)}getSDKInstanceId(){return mt.getInstanceId()}formatTokenOptions(e){return"object"!=typeof e?{productId:e,group:""}:e}bricks(e){return new Ml(e,this,(e,t)=>$m(Hm,this,af).call(this,e,t),jm(Jm,this))}quickCheckout(){return new au(jm(qm,this))}async authenticator(e,t,r){return await Promise.all([jm(of,this).call(this),jm(qm,this)]),2===r?.version?mm.create(e,t,this.bricks({}),r):cl.create(e,t,this.bricks({}),r)}async wallet(e){await Promise.all([jm(of,this).call(this),jm(qm,this)]);const t=kd(e.amount,mt.getSiteId()),r=t.valid?{...e,amount:t.value}:e,n=function(){if(Pm)throw new Rd("[MERCADO PAGO]: A Wallet instance is already active — call destroy() before creating a new one",wn.AlreadyShowing);Pm=!0;let e=!1;return function(){e||(e=!0,Pm=!1)}}();try{const e=await mm.create(r.amount,r.payer.email,this.bricks({}),{version:2,integration:"wallet"});if(!e.getSimplifiedAuth())return n(),wm(r);const t=function(e){const t=Zh.get(e);if(!t)throw new Rd("[MERCADO PAGO]: Wallet session credentials are unavailable",wn.NotInitialized);return{...t}}(e);return await Dm(e,this.fields,n,t)}catch(e){if(n(),e instanceof Rd&&Wm.has(e.errorCode))return wm(r);throw ym(e)}}cardForm(e){return jm(rf,this).call(this,"/card_form",{is_iframe:Boolean(e.iframe)}),new ga(e,jm(qm,this))}checkout(e){return e&&"object"==typeof e&&void 0!==e.checkoutUrl||jm(rf,this).call(this,"/cho_pro",{preference_id:e.preference?.id||""}),new Yc(e,jm(qm,this))}tokenizer(e){return jm(rf,this).call(this,"/tokenizer"),new Iu(e)}yape(e){return jm(rf,this).call(this,"/yape"),new wu(e)}fintoc(e){return jm(rf,this).call(this,"/fintoc"),new np(e)}async renderCreditsContract(e,t){await jm(qm,this),jm(rf,this).call(this,"/credits_contract");const r=this.bricks({});return jm(Bm,this).renderCreditsContract(e,t,r)}}})()})();