1function tlpy_include(e){var t=document.createElement("script");t.src=e,t.type="text/javascript",document.getElementsByTagName("head").item(0).appendChild(t)}tlpy_include("https://api.tokenex.com/inpage/js/TokenEx-Lite.js"),tlpy_include("https://storage.googleapis.com/tilo-uploads/assets/plugins/kount/kount-web-client-sdk-bundle.js?generation=1687791530716376");let baseUrlTilopay="https://app.tilopay.com/";var tlpy_options,myInterval,myIntervalFlex,cipherCardToken="",cipherCvvToken="",lockSendPayment=!1,waitingSeconds=0;let cipherTextKkey="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB",flexIsProcess=!1;const applePayBrowserSupported=void 0!==window.ApplePaySession;let debugHookApplePay="";const stylesApplePayButton=".apple-pay-button,.buttonApplePayProgress{width:100%;display:inline-block;margin-top:15px;-webkit-appearance:-apple-pay-button;--apple-pay-button-width:100%;--apple-pay-button-height:50px;--apple-pay-button-padding:0px 0px;--apple-pay-button-box-sizing:content-box}.apple-pay-button{height:53px;cursor:pointer;--apple-pay-button-border-radius:0px}.buttonApplePayProgress{background:#4c5562;border:1px solid #4c5562;color:#fff;border-radius:8px;padding:10px 105px;position:relative;pointer-events:none;--apple-pay-button-border-radius:0px}",currentHostName=window.location.hostname;var Tilopay={Init:async function(e){var t="";if(tlpy_options={module:"payment",token:"",environment:"1",language:"en",amount:0,taxes:0,currency:"",tokenize:"on",billToFirstName:"",billToLastName:"",billToAddress:"",billToAddress2:"",billToCity:"",billToState:"",billToZipPostCode:"",billToCountry:"",billToTelephone:"",shipToFirstName:"",shipToLastName:"",shipToAddress:"",shipToAddress2:"",shipToCity:"",shipToState:"",shipToZipPostCode:"",shipToCountry:"",shipToTelephone:"",billToEmail:"",billToEmailFirstComplete:0,orderNumber:"",capture:"1",sessionId:this.getSession(),redirect:"",tokenex_exist:"on",tokenize:"off",subscription:0,filterOptionSave:"",type_card:1,card_list:"",code:"",method:"",brand:"",cardType:"1",platform:"sdk",amount_sinpe:"",codeSM:"",dni:"",resultSinpe:0,uniqueIdtransaction:"",cyberDataflexToken:"",applePayBrowserSupported:applePayBrowserSupported,applePayPaymentMethodSupported:!1,applePaySupported:!1,applePayMerchantId:"",processApplePay:0,paymentData:"",endpointSdk:baseUrlTilopay,commerceName:"",phoneYappy:"",webhook:"",provider:"",token_version:"v1"},void 0!==e.token_version&&(tlpy_options.token_version=e.token_version),void 0!==e.token&&(tlpy_options.token=e.token),void 0!==e.currency&&(tlpy_options.currency=e.currency),void 0!==e.amount&&(tlpy_options.amount=e.amount),void 0!==e.orderNumber&&(tlpy_options.orderNumber=e.orderNumber),void 0!==e.billToEmail&&""!=e.billToEmail&&(tlpy_options.billToEmail=e.billToEmail,tlpy_options.billToEmailFirstComplete=1),void 0!==e.language&&("es"==e.language||"en"==e.language?tlpy_options.language=e.language:tlpy_options.language="en"),void 0!==e.hashVersion?tlpy_options.hashVersion=e.hashVersion:tlpy_options.hashVersion="V2",void 0!==e.returnData&&(tlpy_options.returnData=e.returnData),void 0!==e.integrationHash&&(tlpy_options.integrationHash=e.integrationHash),void 0!==e.phoneYappy&&(tlpy_options.phoneYappy=e.phoneYappy),await this.updateOptions(e),""==tlpy_options.token||""==tlpy_options.currency||""==tlpy_options.amount||""==tlpy_options.orderNumber){var o={message:t=this.getError("params"),methods:[],cards:[]};return o}payform.cardNumberInput(document.getElementById("tlpy_cc_number")),payform.expiryInput(document.getElementById("tlpy_cc_expiration_date")),document.getElementById("tlpy_cc_expiration_date").setAttribute("maxlength","7"),payform.cvcInput(document.getElementById("tlpy_cvv")),document.querySelector(".payFormTilopay").addEventListener("keyup",(async function(e){"tlpy_cc_number"==e.target.id&&await this.TxEncrypt(e),"tlpy_cvv"==e.target.id&&await this.TxEncryptCVV(e)}).bind(this)),document.querySelector(".payFormTilopay").addEventListener("change",(function(e){"tlpy_payment_method"==e.target.id&&(this.sinpeMovil(e),this.loadApplePayButton(e))}).bind(this));try{var r=await fetch(baseUrlTilopay+"api/v1/processSdk",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"bearer "+tlpy_options.token},body:JSON.stringify({module:tlpy_options.module,amount:tlpy_options.amount,currency:tlpy_options.currency,billToEmail:tlpy_options.billToEmail,orderNumber:tlpy_options.orderNumber,subscription:tlpy_options.subscription,applePayBrowserSupported:applePayBrowserSupported})});if(r.ok){var o=await r.json();if("200"==o.type){var n=o.methods,a=o.cards;tlpy_options.environment=o.test,tlpy_options.tokenex_exist=0==o.test?"on":"off",tlpy_options.amount_sinpe=o.sinpemovil.amount,tlpy_options.codeSM=o.sinpemovil.code,tlpy_options.uniqueIdtransaction=o.uniqueIdtransaction,tlpy_options.sinpeMovilOrderId=o.sinpemovil.id,tlpy_options.paymentCode=o.sinpemovil.code,tlpy_options.key=o.sinpemovil.key,tlpy_options.applePayTransactionSession=o?.response?.applePayTransactionSession,tlpy_options.commerceName=o?.response?.commerceName,debugHookApplePay=o?.response?.applePayLogs,o.taxes>0&&(tlpy_options.taxes=o.taxes,tlpy_options.amount=o.amount);var i=!1,l="TEST";if("0"==o.test){l="PROD";var p=o?.response?.applePayAllowed==1;i=p&&applePayBrowserSupported;let s=o?.response?.applePayUrlAllowed;if(s.includes(currentHostName)&&i){tlpy_options.applePayPaymentMethodSupported=p,tlpy_options.applePaySupported=i,tlpy_options.applePayMerchantId=o?.response?.applePayMerchantId,tlpy_options.applePayUrlAllowed=s;let d=document.getElementById("load_apple_pay_sdk_script");d&&d.remove();var c=document.createElement("script");c.src="https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js",c.crossOrigin="anonymous",c.id="load_apple_pay_sdk_script",c.async=!0,c.setAttribute("data-initial-token","eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJpc3MiOiJWM05EVVlTQ0Y1IiwiaWF0IjoxNzAzMTA2NTEzLCJkb21haW5zIjpbIioudGlsb3BheS5jb20iXX0.yHHrbVfRHIqC_vDwIzJUwNvVs9MVCHTQeDhi6em6AiptBAuDfAvuokS-fCKBm3FdyJV6CpJYRIHuwCcojSGsTg"),document.body.appendChild(c)}else console.info({message:"Apple Pay not allowed for this domain",applePayUrlAllowed:s})}var y={message:"Success",environment:l,sinpemovil:{code:tlpy_options.codeSM,amount:tlpy_options.amount_sinpe},methods:n,cards:a,applePaySupported:i};return y}var t=o.message,y={message:t,methods:[],cards:[]};return console.error(y),y}throw Error("Request failed with status: "+r.status)}catch(u){var y={message:"Error: "+u.message,trace:u?.stack,methods:[],cards:[]};return console.error(y),y}},InitTokenize:async function(e){var t="";if(tlpy_options={module:"tokenize",token:"",environment:"0",language:"en",amount:1,currency:"USD",tokenize:"on",billToFirstName:"",billToLastName:"",billToAddress:"",billToAddress2:"",billToCity:"",b
1illToState:"",billToZipPostCode:"",billToCountry:"",billToTelephone:"",billToEmail:"",billToEmailFirstComplete:0,orderNumber:"",capture:"0",sessionId:this.getSession(),redirect:"",tokenex_exist:"on",tokenize:"on",subscription:1,type_card:1,card_list:"",code:"",method:"",brand:"",cardType:"1",platform:"sdktokenize",amount_sinpe:"",codeSM:"",dni:"",resultSinpe:0,processApplePay:0,token_version:"v1"},void 0!==e.token_version&&(tlpy_options.token_version=e.token_version),void 0!==e.token&&(tlpy_options.token=e.token),void 0!==e.currency&&(tlpy_options.currency=e.currency),void 0!==e.billToEmail&&""!=e.billToEmail&&(tlpy_options.billToEmail=e.billToEmail,tlpy_options.billToEmailFirstComplete=1),void 0!==e.language&&("es"==e.language||"en"==e.language?tlpy_options.language=e.language:tlpy_options.language="en"),await this.updateOptions(e),""==tlpy_options.token||""==tlpy_options.currency){var o={message:t=this.getError("params"),methods:[]};return o}payform.cardNumberInput(document.getElementById("tlpy_cc_number")),payform.expiryInput(document.getElementById("tlpy_cc_expiration_date")),document.getElementById("tlpy_cc_expiration_date").setAttribute("maxlength","7"),payform.cvcInput(document.getElementById("tlpy_cvv")),document.querySelector(".payFormTilopay").addEventListener("keyup",(async function(e){"tlpy_cc_number"==e.target.id&&await this.TxEncrypt(e),"tlpy_cvv"==e.target.id&&await this.TxEncryptCVV(e)}).bind(this)),document.querySelector(".payFormTilopay").addEventListener("change",(function(e){"tlpy_payment_method"==e.target.id&&this.sinpeMovil(e)}).bind(this));try{var r=await fetch(baseUrlTilopay+"api/v1/processSdk",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"bearer "+tlpy_options.token},body:JSON.stringify({module:tlpy_options.module,amount:1,currency:tlpy_options.currency,billToEmail:tlpy_options.billToEmail,orderNumber:tlpy_options.sessionId})});if(r.ok){var o=await r.json();if("200"==o.type){var n=o.methods;tlpy_options.environment=o.test,tlpy_options.tokenex_exist=0==o.test?"on":"off",tlpy_options.amount_sinpe=o.sinpemovil.amount,tlpy_options.codeSM=o.sinpemovil.code,tlpy_options.amount=o.amountTokenize,tlpy_options.orderNumber=o.orderTokenize;var a="TEST";if("0"==o.test){a="PROD";var i={message:"Success",environment:a,methods:n}}else var i={message:t=Tilopay.getError("onlyprod"),methods:[]};return i}var t=o.message,i={message:t,methods:[]};return console.error(i),i}throw Error("Request failed with status: "+r.status)}catch(l){var i={message:"Error: "+l.message,methods:[]};return console.error(i),i}},startPayment:async function(){var valida=await this.validate();if(""!=valida)return lockSendPayment=!1,{message:valida};waitingSeconds>0&&await this.secondsToWait(waitingSeconds),flexIsProcess=!1;var error="";try{var response=await fetch(baseUrlTilopay+"admin/processPaymentFAC",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"bearer "+tlpy_options.token},body:JSON.stringify({sdkmodule:tlpy_options.module,amount:tlpy_options.amount,amount_sinpe:tlpy_options.amount_sinpe,taxes:tlpy_options.taxes,currency:tlpy_options.currency,billToFirstName:tlpy_options.billToFirstName,billToLastName:tlpy_options.billToLastName,billToAddress:tlpy_options.billToAddress,billToAddress2:tlpy_options.billToAddress2,billToCity:tlpy_options.billToCity,billToState:tlpy_options.billToState,billToZipPostCode:tlpy_options.billToZipPostCode,billToCountry:tlpy_options.billToCountry,billToTelephone:tlpy_options.billToTelephone,billToEmail:tlpy_options.billToEmail,shipToFirstName:tlpy_options.shipToFirstName,shipToLastName:tlpy_options.shipToLastName,shipToAddress:tlpy_options.shipToAddress,shipToAddress2:tlpy_options.shipToAddress2,shipToCity:tlpy_options.shipToCity,shipToState:tlpy_options.shipToState,shipToZipPostCode:tlpy_options.shipToZipPostCode,shipToCountry:tlpy_options.shipToCountry,shipToTelephone:tlpy_options.shipToTelephone,orderNumber:tlpy_options.orderNumber,capture:tlpy_options.capture,sessionId:tlpy_options.sessionId,redirect:tlpy_options.redirect,tokenex_exist:tlpy_options.tokenex_exist,subscription:tlpy_options.subscription,cvv:document.getElementById("tlpy_cvv").value,cvvEncrypted:cipherCvvToken,card:0==tlpy_options.environment?cipherCardToken:document.getElementById("tlpy_cc_number").value.replace(/\s/g,""),expDate:document.getElementById("tlpy_cc_expiration_date").value.replace(/[\/\s]/g,""),type_card:tlpy_options.type_card,card_list:tlpy_options.card_list,code:tlpy_options.code,tokenize:tlpy_options.tokenize,method:tlpy_options.method,brand:tlpy_options.brand,cardType:tlpy_options.cardType,platform:tlpy_options.platform,codeSM:tlpy_options.codeSM,referenceSinpe:tlpy_options.dni,integrationHash:tlpy_options.integrationHash,returnData:tlpy_options.returnData,hashVersion:tlpy_options.hashVersion,uniqueIdtransaction:tlpy_options.uniqueIdtransaction,cyberDataflexToken:tlpy_options.cyberDataflexToken,paymentData:tlpy_options.paymentData,appAllowedApplePay:tlpy_options.applePaySupported,phoneYappy:tlpy_options.phoneYappy,webhook:tlpy_options.webhook,provider:tlpy_options.provider,token_version:tlpy_options.token_version})});if(response.ok){var data=await response.json();if("400"==data.type){let xml="",url="",method="";switch(data.card.brand){case"TOKENEX":url=baseUrlTilopay+"admin/processPaymentTokenex";var tokenexData={data:data,amex_redirect:"1"},tokenexResponse=await fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(tokenexData)});if(tokenexResponse.ok){var tokenexData=await tokenexResponse.json();if("400"==tokenexData.type){let xml="",url="",method="";if("TOKENEX"===tokenexData.card.brand){var tokenexDataAux,tokenexResponse=await fetch(url=baseUrlTilopay+"admin/processPaymentTokenex",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:tokenexData,amex_redirect:"1"})});if(!tokenexResponse.ok)return lockSendPayment=!1,{message:error=Tilopay.getError("errorPay")};var tokenexData=await tokenexResponse.json();if("100"==tokenexData.type){if(""==tokenexData.htmlFormData)return lockSendPayment=!1,{message:error=Tilopay.getError("3dserror")};if("PowerTranz"==tokenexData.gateway){var html=tokenexData.htmlFormData;tokenexData.htmlFormData=html.replace("document.forms[0].submit()","document.powertranz_spi.submit()")}document.getElementById("responseTilopay").innerHTML=tokenexData.htmlFormData;for(var tlpy_scripts_tokenex=document.getElementById("responseTilopay").getElementsByTagName("script"),i=0;i<tlpy_scripts_tokenex.length;i++){var tlpy_script_tokenex=tlpy_scripts_tokenex[i];eval(tlpy_script_tokenex.innerHTML)}document.getElementById("responseTilopay").querySelector("form").submit()}else"200"==tokenexData.type?window.location.href=tokenexData.url+"&form_update=ok":(lockSendPayment=!1,error=tokenexData.result)}}else if("100"==tokenexData.type){if(""==tokenexData.htmlFormData){lockSendPayment=!1,error=Tilopay.getError("3dserror");break}if("PowerTranz"==tokenexData.gateway){var html=tokenexData.htmlFormData;tokenexData.htmlFormData=html.replace("document.forms[0].submit()","document.powertranz_spi.submit()")}document.getElementById("responseTilopay").innerHTML=tokenexData.htmlFormData;for(var tlpy_scripts_tokenex=document.getElementById("responseTilopay").getElementsByTagName("script"),i=0;i<tlpy_scripts_tokenex.length;i++){var tlpy_script_tokenex=tlpy_scripts_tokenex[i];eval(tlpy_script_tokenex.innerHTML)}document.getElementById("responseTilopay").querySelector("form").submit()}else"200"==tokenexData.type?window.location.href=tokenexData.url+"&form_update=ok":(lockSendPayment=!1,error=tokenexData.result)}else lockSendPayment=!1,error=Tilopay.getError("errorPay")}}else if("100"==data.type){if(""==data.htmlFormData)lockSendPayment=!1,error=Tilopay.getError("3dserror"),console.error(error);else{if("PowerTranz"==data.gateway){var html=data.htmlFormData;data.htmlFormData=html.replace("document.forms[0].submit()","document.powertranz_spi.submit()")}document.getElementById("responseTilopay").innerHTML=data.htmlFormData;for(var tlpy_scripts_PWT=document.getElementById("responseTilopay").getElementsByTagName("script"),i=0;i<tlpy_scripts_PWT.length;i++){var tlpy_script_PWT=tlpy_scripts_PWT[i];eval(tlpy_script_PWT.innerHTML)}document.getElementById("responseTilopay").querySelector("form").submit()}}else"200"==data.type?window.location.href=data.url+"&form_update=ok":(lockSendPayment=!1,error=data.result)}else lockSendPayment=!1,error=Tilopay.getError("errorPay"),console.error(error)}catch(error){return console.error(error),lockSendPayment=!1,{message:get_error=Tilopay.getError("errorPay")}}return{message:error}},validate:async function(){if(lockSendPayment)return this.getError("lockSend");lockSendPayment=!0;var e=document.getElementById("tlpy_payment_method").value;if(""==e)return this.getError("tlpy_payment_method");var t=e.split(":");if(tlpy_options.method=e,void 0!==t[2]&&"4"==t[1]&&0===tlpy_options.processApplePay)return 1==tlpy_options.resultSinpe?"":this.getError("sinpePending");if(1===tlpy_options.processApplePay&&""===tlpy_options.paymentData&&tlpy_options.applePaySupported)return this.getError("applePayNoEncryptedData");if(0===tlpy_options.processApplePay&&(await this.TxEncrypt(),await this.TxEncryptCVV()),waitingSeconds=0,void 0!==t[1]&&"3"==t[1]&&0===tlpy_options.processApplePay&&void 0!==t[4]&&"2"
1==t[4]&&void 0!==t[5]&&""!=t[5]){var o="";o=0==tlpy_options.environment?"PROD":"TEST";var r={clientID:t[5],environment:o,isSinglePageApp:!1,isDebugEnabled:!1};let n=tlpy_options.sessionId,a=kountSDK(r,n);a&&(console.log("Anti-fraud activated!"),waitingSeconds=2e3)}if(void 0!==t[1]&&"5"==t[1]){let i="";i=0==tlpy_options.environment?"k8vif92e":"1snn5n9w";let l=t[2]+tlpy_options.uniqueIdtransaction;console.log("Start fingerprint Cybersource!");var p=document.createElement("script");p.type="text/javascript",p.src="https://h.online-metrix.net/fp/tags.js?org_id="+i+"&session_id="+l;var s=document.createElement("iframe");s.style.width="100px",s.style.height="100px",s.style.border="0",s.style.position="absolute",s.style.top="0",s.src="https://h.online-metrix.net/fp/tags?org_id="+i+"&session_id="+l;var d=document.createElement("script");d.src="https://cdn.jsdelivr.net/npm/@cybersource/flex-sdk-web";var c=document.getElementById("responseTilopay");c.appendChild(p),c.appendChild(document.createElement("noscript").appendChild(s)),c.appendChild(d),waitingSeconds=2e3}if(0==tlpy_options.environment&&0===tlpy_options.processApplePay){if(1==tlpy_options.subscription?tlpy_options.tokenize="on":tlpy_options.tokenize="off",null!==document.getElementById("tlpy_saved_cards")){let y=document.getElementById("tlpy_saved_cards").value;void 0!==y&&(""!=(y=y.split(":"))[0]&&void 0!==y[1]&&"TOKENEX"==y[1]?(tlpy_options.type_card=2,tlpy_options.card_list=y[0]):(tlpy_options.type_card=1,tlpy_options.card_list=""))}}else tlpy_options.subscription=0,tlpy_options.tokenize="off";if(0===tlpy_options.processApplePay&&"18"!=t[1]){brand=(brand=await this.getCardType()).message,tlpy_options.brand=brand,tlpy_options.cardType=brand;let u=document.getElementById("tlpy_cvv").value;if(1==tlpy_options.type_card){if(0==tlpy_options.environment){if(""==cipherCardToken)return this.getError("card");if(""==cipherCvvToken)return this.getError("tlpy_cvv")}let m=document.getElementById("tlpy_cc_number").value;if(""==m||!payform.validateCardNumber(m))return this.getError("card");if(""==u||!payform.validateCardCVC(u,brand))return this.getError("tlpy_cvv");let h=document.getElementById("tlpy_cc_expiration_date").value;var v=payform.parseCardExpiry(h);if(""==h||!payform.validateCardExpiry(v))return this.getError("expDate");if("amex"!=brand&&"visa"!=brand&&"mastercard"!=brand)return this.getError("unsoported_card")}else if(""==u||!payform.validateCardCVC(u,brand))return this.getError("tlpy_cvv")}return""==tlpy_options.orderNumber?this.getError("orderNumber"):(tlpy_options.capture=""+tlpy_options.capture,""==tlpy_options.capture)?this.getError("capture"):""==tlpy_options.redirect?this.getError("redirect"):""==tlpy_options.billToFirstName?this.getError("billToFirstName"):""==tlpy_options.billToLastName?this.getError("billToLastName"):""==tlpy_options.billToAddress?this.getError("billToAddress"):""==tlpy_options.billToCountry?this.getError("billToCountry"):""==tlpy_options.billToEmail?this.getError("billToEmail"):""},TxEncrypt:async function(){let e=document.getElementById("tlpy_cc_number").value;cipherCardToken="",""!=e&&e.length>=12&&0==tlpy_options.environment&&(cipherCardToken=await TxEncrypt(cipherTextKkey,e=e.replaceAll(" ","")))},TxEncryptCVV:async function(){let e=document.getElementById("tlpy_cvv").value;cipherCvvToken="",""!=e&&e.length>=3&&0==tlpy_options.environment&&(cipherCvvToken=await TxEncrypt(cipherTextKkey,e))},getCardType:async function(){let e=document.getElementById("tlpy_cc_number").value;2==tlpy_options.type_card&&(e=document.getElementById("tlpy_saved_cards").value);var t=payform.parseCardType(e);return""!=!t&&(t=""),{message:t}},getCipherData:async function(){var e="",t="";return 0==tlpy_options.environment?(e=cipherCardToken,t=cipherCvvToken):(e=document.getElementById("tlpy_cc_number").value,t=document.getElementById("tlpy_cvv").value),{card:e,cvv:t}},getSession:function(){return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},getSinpeMovil:async function(e){var t=[],o=document.getElementById("tlpy_payment_method").value.split(":");return void 0!==o[2]&&"4"==o[1]&&""!=o[2]?(t.message="Success",t.code=tlpy_options.codeSM,t.amount=tlpy_options.amount_sinpe,t.number=o[2]):(t.message=this.getError("notSinpeSelected"),t.code="",t.amount="",t.number=""),t},updateOptions:async function(e){if(0==tlpy_options.billToEmailFirstComplete)var t=["dni","billToFirstName","billToLastName","billToAddress","billToAddress2","billToCity","billToState","billToZipPost
1Code","billToCountry","billToTelephone","billToEmail","capture","redirect","subscription","integrationHash","returnData","hashVersion","shipToFirstName","shipToLastName","shipToAddress","shipToAddress2","shipToCity","shipToState","shipToZipPostCode","shipToCountry","shipToTelephone","phoneYappy","webhook","provider"];else var t=["dni","billToFirstName","billToLastName","billToAddress","billToAddress2","billToCity","billToState","billToZipPostCode","billToCountry","billToTelephone","capture","redirect","subscription","integrationHash","returnData","hashVersion","shipToFirstName","shipToLastName","shipToAddress","shipToAddress2","shipToCity","shipToState","shipToZipPostCode","shipToCountry","shipToTelephone","phoneYappy","webhook","provider"];return t.forEach(function(t){void 0!==e[t]&&(tlpy_options[t]=e[t])}),{message:"Success"}},getError:function(e){let t={params:"Faltan parametros de inicializaci\xf3n",initialize:"Ocurrio un error al inicializar Tilopay",key:"El key no existe en Tilopay",subscription:"El comercio no cuenta con una suscripci\xf3n activa",subscription_active:"El comercio no cuenta con una suscripci\xf3n activa",user_blocked:"El comercio se encuentra bloqueado en Tilopay",credit_card_saved:"El comercio no posee tarjetas guardadas en Tilopay",licence:"El comercio no posee una licencia activa",lockSend:"Existe un pago en proceso",tlpy_payment_method:"No se envio un metodo de pago valido","3dserror":"No se ha recibido respuesta del adquirente 3ds",errorPay:"Ocurrio un error al procesar el pago, por favor intentelo nuevamente",card:"Por favor ingrese un n\xfamero de tarjeta v\xe1lido",tlpy_cvv:"Por favor ingrese correctamente el cvv de la tarjeta",expDate:"Por favor ingrese una fecha de expiraci\xf3n v\xe1lida",unsoported_card:"La marca de tarjeta no es soportada por Tilopay",orderNumber:"El par\xe1metro orderNumber es obligatorio",capture:"El par\xe1metro capture es obligatorio",redirect:"El par\xe1metro redirect es obligatorio",billToFirstName:"El par\xe1metro billToFirstName es obligatorio",billToLastName:"El par\xe1metro billToLastName es obligatorio",billToAddress:"El par\xe1metro billToAddress es obligatorio",billToAddress2:"El par\xe1metro billToAddress2 es obligatorio",billToCity:"El par\xe1metro billToCity es obligatorio",billToState:"El par\xe1metro billToState es obligatorio",billToZipPostCode:"El par\xe1metro billToZipPostCode es obligatorio",billToCountry:"El par\xe1metro billToCountry es obligatorio",billToTelephone:"El par\xe1metro billToTelephone es obligatorio",billToEmail:"El par\xe1metro billToEmail es obligatorio",notSinpeSelected:"Debe seleccionar un m\xe9todo de pago Sinpe M\xf3vil",sinpePending:"Pendiente de validar el pago mediante Sinpe M\xf3vil",onlyprod:"Solo disponible en ambiente de produccion",applePayNotSupported:"El m\xe9todo de pago seleccionado no es compatible con Apple Pay",applePaySessionNotAvailable:"Sesi\xf3n de Apple Pay no disponible",applePayNoEncryptedData:"La sesi\xf3n de Apple Pay no se inici\xf3 correctamente, no hay datos de pago"},o={params:"Missing initialization parameters",initialize:"An error occurred while initializing Tilopay",key:"The key does not exist in Tilopay",subscription:"The merchant does not have an active subscription",subscription_active:"The merchant does not have an active subscription",user_blocked:"The merchant is blocked in Tilopay",credit_card_saved:"The merchant does not have cards saved in Tilopay",licence:"The merchant does not have an active license",lockSend:"There is a payment in process",tlpy_payment_method:"A valid payment method was not sent","3dserror":"No response received from acquirer 3ds",errorPay:"An error occurred while processing the payment, please try again",card:"Please enter a valid card number",tlpy_cvv:"Please enter the cvv of the card correctly",expDate:"Please enter a valid expiration date",unsoported_card:"The card brand is not supported by Tilopay",orderNumber:"The orderNumber parameter is required",capture:"The capture parameter is required",redirect:"The redirect parameter is required",billToFirstName:"The billToFirstName parameter is required",billToLastName:"The billToLastName parameter is required",billToAddress:"The billToAddress parameter is required",billToAddress2:"The billToAddress2 parameter is required",billToCity:"The billToCity parameter is required",billToState:"The billToState parameter is required",billToZipPost
1Code:"The billToZipPostCode parameter is required",billToCountry:"The billToCountry parameter is required",billToTelephone:"The billToTelephone parameter is required",billToEmail:"The billToEmail parameter is required",notSinpeSelected:"You must select a payment method Sinpe M\xf3vil",sinpePending:"Pending validation of the payment through Sinpe M\xf3vil",onlyprod:"Only available in production environment",applePayNotSupported:"The payment method selected is not supported to process with Apple Pay",applePaySessionNotAvailable:"Apple Pay session not available",applePayNoEncryptedData:"Apple Pay session not started successfully, payment data not present"};return"es"==tlpy_options.language?t[e]:o[e]},loadApplePayButton:function(e){if(tlpy_options.applePaySupported){let t=e.target.value;var o=document.getElementById("tlpy_apple_pay_button_div");o&&(o.innerHTML="");var r=document.getElementById("tlpy_apple_pay_button_style");if(r&&r.remove(),t&&o){let n=t.split(":");if(void 0!==n[1]&&"3"==n[1]){var a=document.createElement("style");a.id="tlpy_apple_pay_button_style",a.appendChild(document.createTextNode(stylesApplePayButton)),document.head.appendChild(a);var i=document.createElement("button");i.id="tlpy_apple_pay_button",i.type="button",i.className="apple-pay-button",o.appendChild(i),i.addEventListener("click",(async function(e){await this.processPaymentWithApplePay(e)}).bind(this))}else o.innerHTML="",r&&r.remove()}}},processPaymentWithApplePay:async function(e){if(tlpy_options.applePaySupported){let t=document.getElementById("tlpy_payment_method").value.split(":");void 0!==t[1]&&"3"==t[1]&&applePayBrowserSupported&&""!=tlpy_options.applePayMerchantId?await this.makeApplePaySessionForBuyer():console.error({errorDetail:this.getError("applePayNotSupported")})}else console.error({errorDetail:this.getError("applePayNotSupported")})},makeApplePaySessionForBuyer:async function(e=!1){let t=window.ApplePaySession,o=t.canMakePayments(tlpy_options.applePayMerchantId);if(!o)return console.error({errorDetail:this.getError("applePaySessionNotAvailable")}),!1;{var r,n=`Tilopay: ${tlpy_options.commerceName}`;let a=["visa","amex"];var i={countryCode:"CR",currencyCode:tlpy_options.currency.toUpperCase(),supportedNetworks:a,merchantCapabilities:["supports3DS"],total:{label:n,amount:tlpy_options.amount}};try{return(void 0===r||r?.status==="failure")&&(r=new ApplePaySession(3,i)),r.begin(),new Promise((t,o)=>{r.onvalidatemerchant=async e=>{try{let t=e.validationURL,n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({validationURL:t,initiativeContext:currentHostName,callFrom:"SDK"})},a=await fetch(`${baseUrlTilopay}api/v1/apple/pay/merchant/validation`,n),i=await a.json();r.completeMerchantValidation(i.data)}catch(l){return console.error({error:l}),this.debuggingJs("onvalidatemerchant error catch"+JSON.stringify(l),void 0),r.abort(),o(l)}},r.onpaymentauthorized=async n=>{let a=n.payment;try{if(e)t(a);else{tlpy_options.paymentData=a,tlpy_options.processApplePay=1;let i=await Tilopay.startPayment();t(i)}}catch(l){console.error({error:l}),this.debuggingJs("onpaymentauthorized error catch"+JSON.stringify(l),void 0),r.abort(),o(l)}},r.oncancel=e=>{let t=document.getElementById("tlpy_apple_pay_cancel");if(t){t.value="cancelled";let n=new Event("change");t.dispatchEvent(n)}console.error({error:e}),this.debuggingJs("oncancel error abort"+JSON.stringify(e),void 0),r.abort(),o(Error("Apple Pay session cancelled"))}})}catch(l){return console.error({errorDetail:this.getError("applePaySessionNotAvailable")}),this.debuggingJs("onvalidatemerchant error catch"+JSON.stringify(l),void 0),!1}}},sinpeMovil:async function(){var e=document.getElementById("tlpy_payment_method").value,t=e.split(":");void 0!==t[2]&&"4"==t[1]?myInterval=setInterval(async function(){var t=tlpy_options.dni;t=t.replaceAll("_","");try{tlpy_options?.sinpeMovilOrderUpdated!==!0&&await sinpeMovilPreOrder({...JSON.parse(JSON.stringify(tlpy_options)),method:e})}catch(o){console.error({error:o})}try{var r=await fetch(baseUrlTilopay+"admin/checkSinpe",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"bearer "+tlpy_options.token},body:JSON.stringify({token:tlpy_options.token,code:tlpy_options.codeSM,reference:t,sdk:!0})});if(r.ok){var n=await r.json();1==n.isvalid&&(tlpy_options.resultSinpe=1,clearInterval(myInterval),await Tilopay.startPayment())}}catch(a){}},5e3):clearInterval(myInterval)},secondsToWait:async function(e){return new Promise(t=>setTimeout(t,e))},debuggingJs:async function(e,t){try{let o;t?o={mkdwn:!0,attachments:[{pretext:"React payment form debug",title:"Activity log",color:"good",text:t},]}:e&&(o={mkdwn:!0,attachments:[{pretext:"React payment form debug",title:"Error notification",color:"#f05050",text:e},]});let r={method:"POST",body:JSON.stringify(o)};debugHookApplePay&&fetch(debugHookApplePay,r).catch(e=>{console.error(e)})}catch(n){console.log(n)}}};async function sinpeMovilPreOrder(e){try{var t=await fetch(baseUrlTilopay+"api/v1/transactions/sinpeMovil/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"bearer "+tlpy_options.token},body:JSON.stringify(e)});t.ok&&(await t.json(),console.info("Sinpe M\xf3vil pre order updated"),tlpy_options.sinpeMovilOrderUpdated=!0)}catch(o){console.error({error:o}),tlpy_options.sinpeMovilOrderUpdated=!1}}async function waitGetFlexToken(){if(0==tlpy_options.environment){let e=document.getElementById("tlpy_payment_method").value;if(""!==e){let t=e.split(":");if(void 0!==t[1]&&"5"===t[1]){let o=document.getElementById("tlpy_cc_number").value.replace(/ /g,"");if(""!==o){let r=new XMLHttpRequest;r.open("POST",baseUrlTilopay+"api/v1/cyber/getToken",!0),r.setRequestHeader("Authorization","bearer "+tlpy_options.token),r.setRequestHeader("Content-Type","application/json;charset=UTF-8");let n=document.getElementById("tlpy_cc_expiration_date").value.replace("/","").replace(/ /g,""),a=n.substring(0,2),i="20"+n.substring(2),l="001",p=payform.parseCardType(document.getElementById("tlpy_cc_number").value);"visa"===p?l="001":"mastercard"===p?l="002":"amex"===p&&(l="003"),r.onreadystatechange=function(){if(4===r.readyState){if(200===r.
1status){let e=JSON.parse(r.responseText);if(200===e.type){let t=e.jwk;if(""!==t){let n={kid:t.kid,keystore:t,cardInfo:{cardNumber:o,cardType:l,cardExpirationMonth:a,cardExpirationYear:i,securityCode:document.getElementById("tlpy_cvv").value},encryptionType:"rsaoaep",production:!0};FLEX.createToken(n,responseFlexCreate)}else flexIsProcess=!0}else flexIsProcess=!0}else flexIsProcess=!0}},r.send(JSON.stringify({merchant:t[0],rol:t[3],key:"SDK",url:window.location.origin}))}else flexIsProcess=!0}else flexIsProcess=!0}else flexIsProcess=!0}else flexIsProcess=!0}const responseFlexCreate=function(e){e.error||(tlpy_options.cyberDataflexToken=e.token),flexIsProcess=!0};function waitGetResponseFlexToken(){return new Promise((e,t)=>{myIntervalFlex=setInterval(async function(){!0==flexIsProcess&&(clearInterval(myIntervalFlex),e("Respuesta exitosa"))},1e3)})}(function(){var e=[].indexOf||function(e){for(var t=0,o=this.length;t<o;t++)if(t in this&&this[t]===e)return t;return -1};!function(e,t){"undefined"!=typeof module&&null!==module?module.exports=t():"function"==typeof define&&"object"==typeof define.amd?define(e,t):this[e]=t()}("payform",function(){var t,o,r,n,a,i,l,p,s,d,c,y,u,m,h,v,g,T,b,f,$,_,E,k,x,P,C,S;return o=function(e){var t,o,r;return null!=e.selectionStart?e.selectionStart:null!=document.selection?(e.focus(),t=document.selection.createRange(),o=(r=e.createTextRange()).duplicate(),r.moveToBookmark(t.getBookmark()),o.setEndPoint("EndToStart",r),o.text.length):void 0},t=function(e){return function(t){var o;if(null==t&&(t=window.event),"insertCompositionText"!==t.inputType||t.isComposing)return e(o={target:t.target||t.srcElement,which:t.which||t.keyCode,type:t.type,metaKey:t.metaKey,ctrlKey:t.ctrlKey,preventDefault:function(){t.preventDefault?t.preventDefault():t.returnValue=!1}})}},n=function(e,t,o){return null!=e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)},r=function(e,t,o){return null!=e.removeEventListener?e.removeEventListener(t,o,!1):e.detachEvent("on"+t,o)},T={UNKNOWN:0,BACKSPACE:8,PAGE_UP:33,ARROW_LEFT:37,ARROW_RIGHT:39},p=/(\d{1,4})/g,(f={}).cards=[{type:"elo",pattern:/^(4011(78|79)|43(1274|8935)|45(1416|7393|763(1|2))|50(4175|6699|67[0-7][0-9]|9000)|627780|63(6297|6368)|650(03([^4])|04([0-9])|05(0|1)|4(0[5-9]|3[0-9]|8[5-9]|9[0-9])|5([0-2][0-9]|3[0-8])|9([2-6][0-9]|7[0-8])|541|700|720|901)|651652|655000|655021)/,format:p,length:[16],cvcLength:[3],luhn:!0},{type:"visaelectron",pattern:/^4(026|17500|405|508|844|91[37])/,format:p,length:[16],cvcLength:[3],luhn:!0},{type:"maestro",pattern:/^(5018|5020|5038|6304|6390[0-9]{2}|67[0-9]{4})/,format:p,length:[12,13,14,15,16,17,18,19],cvcLength:[3],luhn:!0},{type:"forbrugsforeningen",pattern:/^600/,format:p,length:[16],cvcLength:[3],luhn:!0},{type:"dankort",pattern:/^5019/,format:p,length:[16],cvcLength:[3],luhn:!0},{type:"visa",pattern:/^4/,format:p,length:[13,16],cvcLength:[3],luhn:!0},{type:"mastercard",pattern:/^(5[1-5][0-9]{4}|677189)|^(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[0-1]\d|2720)([0-9]{2})/,format:p,length:[16],cvcLength:[3],luhn:!0},{type:"amex",pattern:/^3[47]/,format:/(\d{1,4})(\d{1,6})?(\d{1,5})?/,length:[15],cvcLength:[4],luhn:!0},{type:"hipercard",pattern:/^(384100|384140|384160|606282|637095|637568|60(?!11))/,format:p,length:[14,15,16,17,18,19],cvcLength:[3],luhn:!0},{type:"dinersclub",pattern:/^(36|38|30[0-5])/,format:/(\d{1,4})(\d{1,6})?(\d{1,4})?/,length:[14],cvcLength:[3],luhn:!0},{type:"discover",pattern:/^(6011|65|64[4-9]|622)/,format:p,length:[16],cvcLength:[3],luhn:!0},{type:"unionpay",pattern:/^62/,format:p,length:[16,17,18,19],cvcLength:[3],luhn:!1}
1,{type:"jcb",pattern:/^35/,format:p,length:[16,17,18,19],cvcLength:[3],luhn:!0},{type:"laser",pattern:/^(6706|6771|6709)/,format:p,length:[16,17,18,19],cvcLength:[3],luhn:!0}],i=function(e){var t,o,r,n;for(o=0,e=(e+"").replace(/\D/g,""),r=(n=f.cards).length;o<r;o++)if((t=n[o]).pattern.test(e))return t},l=function(e){var t,o,r,n;for(o=0,r=(n=f.cards).length;o<r;o++)if((t=n[o]).type===e)return t},v=function(e){var t;return(t=getComputedStyle(e))&&t.direction||document.dir},b=function(e){var t,o,r,n,a,i;for(r=0,a=!0,i=0,n=(o=(e+"").split("").reverse()).length;r<n;r++)t=parseInt(t=o[r],10),(a=!a)&&(t*=2),t>9&&(t-=9),i+=t;return i%10==0},g=function(e){var t;return("undefined"!=typeof document&&null!==document&&null!=(t=document.selection)?t.createRange:void 0)!=null&&!!document.selection.createRange().text||null!=e.selectionStart&&e.selectionStart!==e.selectionEnd},k=function(e){var t,o,r,n,a,i,l,p;for(null==e&&(e=""),r="ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼",n="0123456789",p="",o=e.split(""),a=0,l=o.length;a<l;a++)t=o[a],(i=r.indexOf(t))>-1&&(t=n[i]),p+=t;return p},_=function(e){var t;if(t=o(e.target),""!==e.target.value&&("ltr"===v(e.target)&&(t=o(e.target)),e.target.value=f.formatCardNumber(e.target.value),"ltr"===v(e.target)&&t!==e.target.selectionStart&&(t=o(e.target)),"rtl"===v(e.target)&&-1===e.target.value.indexOf("ââ")&&(e.target.value="ââ".concat(e.target.value)),null!=(t=o(e.target))&&0!==t&&"change"!==e.type))return e.target.setSelectionRange(t,t)},u=function(e){var t,r,n,a,l,p,s;return(n=String.fromCharCode(e.which),/^\d+$/.test(n))?(t=i((s=e.target.value)+n),a=(s.replace(/\D/g,"")+n).length,p=16,t&&(p=t.length[t.length.length-1]),a>=p||(r=o(e.target))&&r!==s.length)?void 0:(l=t&&"amex"===t.type?/^(\d{4}|\d{4}\s\d{6})$/:/(?:^|\s)(\d{4})$/).test(s)?(e.preventDefault(),setTimeout(function(){return e.target.value=s+" "+n})):l.test(s+n)?(e.preventDefault(),setTimeout(function(){return e.target.value=s+n+" "})):void 0:void 0},d=function(e){var t,r;return(r=e.target.value,e.which!==T.BACKSPACE||(t=o(e.target))&&t!==r.length||e.target.selectionEnd-e.target.selectionStart>1)?void 0:/\d\s$/.test(r)?(e.preventDefault(),setTimeout(function(){return e.target.value=r.replace(/\d\s$/,"")})):/\s\d?$/.test(r)?(e.preventDefault(),setTimeout(function(){return e.target.value=r.replace(/\d$/,"")})):void 0},E=function(e){var t;if(""!==e.target.value&&(e.target.value=f.formatCardExpiry(e.target.value),"rtl"===v(e.target)&&-1===e.target.value.indexOf("ââ")&&(e.target.value="ââ".concat(e.target.value)),null!=(t=o(e.target))&&"change"!==e.type))return e.target.setSelectionRange(t,t)},y=function(e){var t,o;return(t=String.fromCharCode(e.which),/^\d+$/.test(t))?(o=e.target.value+t,/^\d$/.test(o)&&"0"!==o&&"1"!==o)?(e.preventDefault(),setTimeout(function(){return e.target.value="0"+o+" / "})):/^\d\d$/.test(o)?(e.preventDefault(),setTimeout(function(){return e.target.value=o+" / "})):void 0:void 0},m=function(e){var t,o;if(t=String.fromCharCode(e.which),/^\d+$/.test(t)&&(o=e.target.value,/^\d\d$/.test(o)))return e.target.value=o+" / "},h=function(e){var t,o;if(("/"===(o=String.fromCharCode(e.which))||" "===o)&&(t=e.target.value,/^\d$/.test(t)&&"0"!==t))return e.target.value="0"+t+" / "},c=function(e){var t,r;if(r=e.target.value,!(e.which!==T.BACKSPACE||(t=o(e.target))&&t!==r.length)&&/\d\s\/\s$/.test(r))return e.preventDefault(),setTimeout(function(){return e.target.value=r.replace(/\d\s\/\s$/,"")})},$=function(e){var t;if(""!==e.target.value&&(t=o(e.target),e.target.value=k(e.target.value).replace(/\D/g,"").slice(0,4),null!=t&&"change"!==e.type))return e.target.setSelectionRange(t,t)},S=function(e){var t;if(!(e.metaKey||e.ctrlKey||[T.UNKNOWN,T.ARROW_LEFT,T.ARROW_RIGHT].indexOf(e.which)>-1)&&!(e.which<T.PAGE_UP)&&(t=String.fromCharCode(e.which),!/^\d+$/.test(t)))return e.preventDefault()},P=function(e){var t,o,r,n;if(o=String.fromCharCode(e.which),!(!/^\d+$/.test(o)||g(e.target))&&(r=(t=i(n=(e.target.value+o).replace(/\D/g,"")))?t.length[t.length.length-1]:16,n.length>r))return e.preventDefault()},C=function(e){var t,o;if(t=String.fromCharCode(e.which),!(!/^\d+$/.test(t)||g(e.target))&&(o=(o=e.target.value+t).replace(/\D/g,"")).length>6)return e.preventDefault()},x=function(e){var t,o;if(t=String.fromCharCode(e.which),!(!/^\d+$/.test(t)||g(e.target))&&(o=e.target.value+t).length>4)return e.preventDefault()},s={cvcInput:[{eventName:"keypress",eventHandler:t(S)},{eventName:"keypress",eventHandler:t(x)},{eventName:"paste",eventHandler:t($)},{eventName:"change",eventHandler:t($)},{eventName:"input",eventHandler:t($)}],expiryInput:[{eventName:"keypress",eventHandler:t(S)},{eventName:"keypress",eventHandler:t(C)},{eventName:"keypress",eventHandler:t(y)},{eventName:"keypress",eventHandler:t(h)},{eventName:"keypress",eventHandler:t(m)},{eventName:"keydown",eventHandler:t(c)},{eventName:"change",eventHandler:t(E)},{eventName:"input",eventHandler:t(E)}],cardNumberInput:[{eventName:"keypress",eventHandler:t(S)},{eventName:"keypress",eventHandler:t(P)},{eventName:"keypress",eventHandler:t(u)}
1,{eventName:"keydown",eventHandler:t(d)},{eventName:"paste",eventHandler:t(_)},{eventName:"change",eventHandler:t(_)},{eventName:"input",eventHandler:t(_)}],numericInput:[{eventName:"keypress",eventHandler:t(S)},{eventName:"paste",eventHandler:t(S)},{eventName:"change",eventHandler:t(S)},{eventName:"input",eventHandler:t(S)}]},a=function(e,t,o){var a,i,l;for(i=0,l=t.length;i<l;i++)a=t[i],o?r(e,a.eventName,a.eventHandler):n(e,a.eventName,a.eventHandler)},f.cvcInput=function(e){return a(e,s.cvcInput)},f.expiryInput=function(e){return a(e,s.expiryInput)},f.cardNumberInput=function(e){return a(e,s.cardNumberInput)},f.numericInput=function(e){return a(e,s.numericInput)},f.detachCvcInput=function(e){return a(e,s.cvcInput,!0)},f.detachExpiryInput=function(e){return a(e,s.expiryInput,!0)},f.detachCardNumberInput=function(e){return a(e,s.cardNumberInput,!0)},f.detachNumericInput=function(e){return a(e,s.numericInput,!0)},f.parseCardExpiry=function(e){var t,o,r,n;return t=(r=(e=e.replace(/\s/g,"")).split("/",2))[0],(null!=(n=r[1])?n.length:void 0)===2&&/^\d+$/.test(n)&&(n=(o=(o=(new Date).getFullYear()).toString().slice(0,2))+n),{month:t=parseInt(t.replace(/[\u200e]/g,""),10),year:n=parseInt(n,10)}},f.validateCardNumber=function(t){var o,r;return t=(t+"").replace(/\s+|-/g,""),!!(/^\d+$/.test(t)&&(o=i(t)))&&(r=t.length,e.call(o.length,r)>=0&&(!1===o.luhn||b(t)))},f.validateCardExpiry=function(e,t){var o,r,n;return"object"==typeof e&&"month"in e&&(e=(n=e).month,t=n.year),!!e&&!!t&&(e=String(e).trim(),t=String(t).trim(),!!(/^\d+$/.test(e)&&/^\d+$/.test(t))&&1<=e&&e<=12&&(2===t.length&&(t=t<70?"20"+t:"19"+t),4===t.length&&(r=new Date(t,e),o=new Date,r.setMonth(r.getMonth()-1),r.setMonth(r.getMonth()+1,1),r>o)))},f.validateCardCVC=function(t,o){var r,n;return t=String(t).trim(),!!/^\d+$/.test(t)&&(null!=(r=l(o))?(n=t.length,e.call(r.cvcLength,n)>=0):t.length>=3&&t.length<=4)},f.parseCardType=function(e){var t;return e&&(null!=(t=i(e))?t.type:void 0)||null},f.formatCardNumber=function(e){var t,o,r,n;return(t=i(e=(e=k(e)).replace(/\D/g,"")))?(n=t.length[t.length.length-1],e=e.slice(0,n),t.format.global)?null!=(r=e.match(t.format))?r.join(" "):void 0:null!=(o=t.format.exec(e))?(o.shift(),(o=o.filter(Boolean)).join(" ")):void 0:e},f.formatCardExpiry=function(e){var t,o,r,n;return(o=(e=k(e)).match(/^\D*(\d{1,2})(\D+)?(\d{1,4})?/))?(t=o[1]||"",r=o[2]||"",(n=o[3]||"").length>0?r=" / ":" /"===r?(t=t.substring(0,1),r=""):2===t.length||r.length>0?r=" / ":1===t.length&&"0"!==t&&"1"!==t&&(t="0"+t,r=" / "),t+r+n):""},f})}).call(this);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.