mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 15:13:29 +01:00
10 lines
11 KiB
JavaScript
Vendored
10 lines
11 KiB
JavaScript
Vendored
import{A as J}from"./index-08e160a7.js";import{c as u,g as X}from"./_commonjsHelpers-725317a4.js";var q={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292,810,[8110,8131],[8132,8151],[8152,8163],[8164,8171]],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,504174],[504176,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,63737423,63743358,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}},W=q,P={},b={};Object.defineProperty(b,"__esModule",{value:!0});b.clone=void 0;function K(e){return e?JSON.parse(JSON.stringify(e)):null}b.clone=K;var A={};Object.defineProperty(A,"__esModule",{value:!0});A.matches=void 0;function Q(e,r,t){var n=String(r).length,a=e.substr(0,n),i=parseInt(a,10);return r=parseInt(String(r).substr(0,a.length),10),t=parseInt(String(t).substr(0,a.length),10),i>=r&&i<=t}function Z(e,r){return r=String(r),r.substring(0,e.length)===e.substring(0,r.length)}function k(e,r){return Array.isArray(r)?Q(e,r[0],r[1]):Z(e,r)}A.matches=k;Object.defineProperty(P,"__esModule",{value:!0});P.addMatchingCardsToResults=void 0;var ee=b,re=A;function te(e,r,t){var n,a;for(n=0;n<r.patterns.length;n++){var i=r.patterns[n];if(re.matches(e,i)){var l=ee.clone(r);Array.isArray(i)?a=String(i[0]).length:a=String(i).length,e.length>=a&&(l.matchStrength=a),t.push(l);break}}}P.addMatchingCardsToResults=te;var R={};Object.defineProperty(R,"__esModule",{value:!0});R.isValidInputType=void 0;function ne(e){return typeof e=="string"||e instanceof String}R.isValidInputType=ne;var D={};Object.defineProperty(D,"__esModule",{value:!0});D.findBestMatch=void 0;function ae(e){var r=e.filter(function(t){return t.matchStrength}).length;return r>0&&r===e.length}function ie(e){return ae(e)?e.reduce(function(r,t){return!r||Number(r.matchStrength)<Number(t.matchStrength)?t:r}):null}D.findBestMatch=ie;var T=u&&u.__assign||function(){return T=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},T.apply(this,arguments)},z=W,se=P,oe=R,le=D,M=b,C={},o={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},H=[o.VISA,o.MASTERCARD,o.AMERICAN_EXPRESS,o.DINERS_CLUB,o.DISCOVER,o.JCB,o.UNIONPAY,o.MAESTRO,o.ELO,o.MIR,o.HIPER,o.HIPERCARD],c=M.clone(H);function B(e){return C[e]||z[e]}function ue(){return c.map(function(e){return M.clone(B(e))})}function U(e,r){r===void 0&&(r=!1);var t=c.indexOf(e);if(!r&&t===-1)throw new Error('"'+e+'" is not a supported card type.');return t}function d(e){var r=[];if(!oe.isValidInputType(e))return r;if(e.length===0)return ue();c.forEach(function(n){var a=B(n);se.addMatchingCardsToResults(e,a,r)});var t=le.findBestMatch(r);return t?[t]:r}d.getTypeInfo=function(e){return M.clone(B(e))};d.removeCard=function(e){var r=U(e);c.splice(r,1)};d.addCard=function(e){var r=U(e.type,!0);C[e.type]=e,r===-1&&c.push(e.type)};d.updateCard=function(e,r){var t=C[e]||z[e];if(!t)throw new Error('"'+e+"\" is not a recognized type. Use `addCard` instead.'");if(r.type&&t.type!==r.type)throw new Error("Cannot overwrite type parameter.");var n=M.clone(t);n=T(T({},n),r),C[n.type]=n};d.changeOrder=function(e,r){var t=U(e);c.splice(t,1),c.splice(r,0,e)};d.resetModifications=function(){c=M.clone(H),C={}};d.types=o;var F=d,E={};Object.defineProperty(E,"__esModule",{value:!0});E.cardholderName=void 0;var fe=/^[\d\s-]*$/,ce=255;function g(e,r){return{isValid:e,isPotentiallyValid:r}}function de(e){return typeof e!="string"?g(!1,!1):e.length===0?g(!1,!0):e.length>ce?g(!1,!1):fe.test(e)?g(!1,!0):g(!0,!0)}E.cardholderName=de;var S={};function pe(e){for(var r=0,t=!1,n=e.length-1,a;n>=0;)a=parseInt(e.charAt(n),10),t&&(a*=2,a>9&&(a=a%10+1)),t=!t,r+=a,n--;return r%10===0}var ve=pe;Object.defineProperty(S,"__esModule",{value:!0});S.cardNumber=void 0;var he=ve,L=F;function v(e,r,t){return{card:e,isPotentiallyValid:r,isValid:t}}function ye(e,r){r===void 0&&(r={});var t,n,a;if(typeof e!="string"&&typeof e!="number")return v(null,!1,!1);var i=String(e).replace(/-|\s/g,"");if(!/^\d*$/.test(i))return v(null,!1,!1);var l=L(i);if(l.length===0)return v(null,!1,!1);if(l.length!==1)return v(null,!0,!1);var s=l[0];if(r.maxLength&&i.length>r.maxLength)return v(s,!1,!1);s.type===L.types.UNIONPAY&&r.luhnValidateUnionPay!==!0?n=!0:n=he(i),a=Math.max.apply(null,s.lengths),r.maxLength&&(a=Math.min(r.maxLength,a));for(var p=0;p<s.lengths.length;p++)if(s.lengths[p]===i.length)return t=i.length<a||n,v(s,t,n);return v(s,i.length<a,!1)}S.cardNumber=ye;var I={},$={},y={};Object.defineProperty(y,"__esModule",{value:!0});y.expirationYear=void 0;var ge=19;function f(e,r,t){return{isValid:e,isPotentiallyValid:r,isCurrentYear:t||!1}}function _e(e,r){r===void 0&&(r=ge);var t;if(typeof e!="string")return f(!1,!1);if(e.replace(/\s/g,"")==="")return f(!1,!0);if(!/^\d*$/.test(e))return f(!1,!1);var n=e.length;if(n<2)return f(!1,!0);var a=new Date().getFullYear();if(n===3){var i=e.slice(0,2),l=String(a).slice(0,2);return f(!1,i===l)}if(n>4)return f(!1,!1);var s=parseInt(e,10),p=Number(String(a).substr(2,2)),O=!1;if(n===2){if(String(a).substr(0,2)===e)return f(!1,!0);t=p===s,O=s>=p&&s<=p+r}else n===4&&(t=a===s,O=s>=a&&s<=a+r);return f(O,O,t)}y.expirationYear=_e;var N={};Object.defineProperty(N,"__esModule",{value:!0});N.isArray=void 0;N.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};Object.defineProperty($,"__esModule",{value:!0});$.parseDate=void 0;var me=y,Ce=N;function be(e){var r=Number(e[0]),t;return r===0?2:r>1||r===1&&Number(e[1])>2?1:r===1?(t=e.substr(1),me.expirationYear(t).isPotentiallyValid?1:2):e.length===5?1:e.length>5?2:1}function Me(e){var r;if(/^\d{4}-\d{1,2}$/.test(e)?r=e.split("-").reverse():/\//.test(e)?r=e.split(/\s*\/\s*/g):/\s/.test(e)&&(r=e.split(/ +/g)),Ce.isArray(r))return{month:r[0]||"",year:r.slice(1).join()};var t=be(e),n=e.substr(0,t);return{month:n,year:e.substr(n.length)}}$.parseDate=Me;var V={};Object.defineProperty(V,"__esModule",{value:!0});V.expirationMonth=void 0;function _(e,r,t){return{isValid:e,isPotentiallyValid:r,isValidForThisYear:t||!1}}function Ve(e){var r=new Date().getMonth()+1;if(typeof e!="string")return _(!1,!1);if(e.replace(/\s/g,"")===""||e==="0")return _(!1,!0);if(!/^\d*$/.test(e))return _(!1,!1);var t=parseInt(e,10);if(isNaN(Number(e)))return _(!1,!1);var n=t>0&&t<13;return _(n,n,n&&t>=r)}V.expirationMonth=Ve;var Y=u&&u.__assign||function(){return Y=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Y.apply(this,arguments)};Object.defineProperty(I,"__esModule",{value:!0});I.expirationDate=void 0;var Oe=$,Te=V,Pe=y;function m(e,r,t,n){return{isValid:e,isPotentiallyValid:r,month:t,year:n}}function Ae(e,r){var t;if(typeof e=="string")e=e.replace(/^(\d\d) (\d\d(\d\d)?)$/,"$1/$2"),t=Oe.parseDate(String(e));else if(e!==null&&typeof e=="object"){var n=Y({},e);t={month:String(n.month),year:String(n.year)}}else return m(!1,!1,null,null);var a=Te.expirationMonth(t.month),i=Pe.expirationYear(t.year,r);if(a.isValid){if(i.isCurrentYear){var l=a.isValidForThisYear;return m(l,l,t.month,t.year)}if(i.isValid)return m(!0,!0,t.month,t.year)}return a.isPotentiallyValid&&i.isPotentiallyValid?m(!1,!0,null,null):m(!1,!1,null,null)}I.expirationDate=Ae;var j={};Object.defineProperty(j,"__esModule",{value:!0});j.cvv=void 0;var G=3;function Re(e,r){for(var t=0;t<e.length;t++)if(r===e[t])return!0;return!1}function De(e){for(var r=G,t=0;t<e.length;t++)r=e[t]>r?e[t]:r;return r}function h(e,r){return{isValid:e,isPotentiallyValid:r}}function Ee(e,r){return r===void 0&&(r=G),r=r instanceof Array?r:[r],typeof e!="string"||!/^\d*$/.test(e)?h(!1,!1):Re(r,e.length)?h(!0,!0):e.length<Math.min.apply(null,r)?h(!1,!0):e.length>De(r)?h(!1,!1):h(!0,!0)}j.cvv=Ee;var x={};Object.defineProperty(x,"__esModule",{value:!0});x.postalCode=void 0;var Se=3;function w(e,r){return{isValid:e,isPotentiallyValid:r}}function Ie(e,r){r===void 0&&(r={});var t=r.minLength||Se;return typeof e!="string"?w(!1,!1):e.length<t?w(!1,!0):w(!0,!0)}x.postalCode=Ie;var $e=u&&u.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),Ne=u&&u.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),je=u&&u.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)t!=="default"&&Object.prototype.hasOwnProperty.call(e,t)&&$e(r,e,t);return Ne(r,e),r},xe=je(F),we=E,Ye=S,Be=I,Ue=V,Le=y,ze=j,He=x,Fe={creditCardType:xe,cardholderName:we.cardholderName,number:Ye.cardNumber,expirationDate:Be.expirationDate,expirationMonth:Ue.expirationMonth,expirationYear:Le.expirationYear,cvv:ze.cvv,postalCode:He.postalCode},Ge=Fe;const Je=X(Ge);/**
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
*/window.axios=J;window.valid=Je;document.querySelectorAll(".disposable-alert").forEach(e=>{setTimeout(()=>{e.remove()},5e3)});
|