import{_ as C}from"./chunk-a66a4022.js";import{b as S}from"./chunk-a740628f.js";import{_ as P}from"./chunk-6dc5d3af.js";import{_ as k}from"./chunk-6deddc2e.js";import{d as E,r as M,c as W,j as B,D as I,m as o,q as h,S as G,k as F,l as v,L as w,F as T,U as L,E as D}from"./chunk-449c23a2.js";import"./chunk-3db18d93.js";import"./chunk-767079b6.js";import"./chunk-9a43cce8.js";import"./chunk-340feaf0.js";/*! * @license * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. *//** * Validation, extraction and creation of IBAN, BBAN, BIC/SWIFT numbers plus some other helpful stuff * @package Documentation * @author Saša Jovanić * @module ibantools * @version 4.3.3 * @license MPL-2.0 * @preferred */function K(r,a){if(a===void 0&&(a={allowQRIBAN:!0}),r==null)return!1;var e=new RegExp("^[0-9]{2}$",""),t=r.slice(0,2),n=_[t];return n===void 0||n.bban_regexp===void 0||n.bban_regexp===null||n.chars===void 0?!1:n.chars===r.length&&e.test(r.slice(2,4))&&Q(r.slice(4),t)&&m(r)&&(a.allowQRIBAN||!l(r))}var b;(function(r){r[r.NoIBANProvided=0]="NoIBANProvided",r[r.NoIBANCountry=1]="NoIBANCountry",r[r.WrongBBANLength=2]="WrongBBANLength",r[r.WrongBBANFormat=3]="WrongBBANFormat",r[r.ChecksumNotNumber=4]="ChecksumNotNumber",r[r.WrongIBANChecksum=5]="WrongIBANChecksum",r[r.WrongAccountBankBranchChecksum=6]="WrongAccountBankBranchChecksum",r[r.QRIBANNotAllowed=7]="QRIBANNotAllowed"})(b||(b={}));function U(r,a){a===void 0&&(a={allowQRIBAN:!0});var e={errorCodes:[],valid:!0};if(r!=null&&r!==""){var t=_[r.slice(0,2)];if(!t||!(t.bban_regexp||t.chars))return e.valid=!1,e.errorCodes.push(b.NoIBANCountry),e;t&&t.chars&&t.chars!==r.length&&(e.valid=!1,e.errorCodes.push(b.WrongBBANLength)),t&&t.bban_regexp&&!d(r.slice(4),t.bban_regexp)&&(e.valid=!1,e.errorCodes.push(b.WrongBBANFormat)),t&&t.bban_validation_func&&!t.bban_validation_func(r.slice(4))&&(e.valid=!1,e.errorCodes.push(b.WrongAccountBankBranchChecksum));var n=new RegExp("^[0-9]{2}$","");n.test(r.slice(2,4))||(e.valid=!1,e.errorCodes.push(b.ChecksumNotNumber)),(e.errorCodes.indexOf(b.WrongBBANFormat)!==-1||!m(r))&&(e.valid=!1,e.errorCodes.push(b.WrongIBANChecksum)),!a.allowQRIBAN&&l(r)&&(e.valid=!1,e.errorCodes.push(b.QRIBANNotAllowed))}else e.valid=!1,e.errorCodes.push(b.NoIBANProvided);return e}function Q(r,a){if(r==null||a===void 0||a===null)return!1;var e=_[a];return e==null||e.bban_regexp===void 0||e.bban_regexp===null||e.chars===void 0||e.chars===null?!1:e.chars-4===r.length&&d(r,e.bban_regexp)?e.bban_validation_func?e.bban_validation_func(r.replace(/[\s.]+/g,"")):!0:!1}function l(r){if(r==null)return!1;var a=r.slice(0,2),e=["LI","CH"];if(!e.includes(a))return!1;var t=new RegExp("^3[0-1]{1}[0-9]{3}$","");return t.test(r.slice(4,9))}function H(r){var a={},e=Z(r);return a.iban=e||r,e&&K(e)?(a.bban=e.slice(4),a.countryCode=e.slice(0,2),a.valid=!0):a.valid=!1,a}function d(r,a){var e=new RegExp(a,"");return e.test(r)}function Z(r){return typeof r!="string"?null:r.replace(/[-\ ]/g,"").toUpperCase()}function f(r,a){if(typeof r!="string")return null;a==null&&(a=" ");var e=Z(r);return e===null?null:e.replace(/(.{4})(?!$)/g,"$1"+a)}function m(r){var a=r.slice(0,2),e=parseInt(r.slice(2,4),10),t=r.slice(4),n=O("".concat(t).concat(a,"00")),s=p(n);return 98-s===e}function O(r){return r.split("").map(function(a){var e=a.charCodeAt(0);return e>=65?(e-55).toString():a}).join("")}var R;(function(r){r[r.NoBICProvided=0]="NoBICProvided",r[r.NoBICCountry=1]="NoBICCountry",r[r.WrongBICFormat=2]="WrongBICFormat"})(R||(R={}));var Y=function(r){for(var a=[5,4,3,2,7,6,5,4,3,2],e=r.replace(/[\s.]+/g,""),t=parseInt(e.charAt(10),10),n=e.substring(0,10),s=0,g=0;g<10;g++)s+=parseInt(n.charAt(g),10)*a[g];var A=s%11;return t===(A===0?0:11-A)},J=function(r){var a=r.replace(/[\s.]+/g,""),e=parseInt(a.substring(0,a.length-2),10),t=parseInt(a.substring(a.length-2,a.length),10),n=e%97===0?97:e%97;return n===t},p=function(r){for(;r.length>2;){var a=r.slice(0,6),e=parseInt(a,10);if(isNaN(e))return NaN;r=e%97+r.slice(a.length)}return parseInt(r,10)%97},i=function(r){var a=r.replace(/[\s.]+/g,""),e=p(a);return e===1},X=function(r){for(var a=[3,9,7,1,3,9,7],e=parseInt(r.charAt(7),10),t=r.substring(0,7),n=0,s=0;s<7;s++)n+=parseInt(t.charAt(s),10)*a[s];var g=n%10;return e===(g===0?0:10-g)},j=function(r){for(var a=[4,8,5,10,9,7,3,6],e=[1,2,4,8,5,10,9,7,3,6],t=parseInt(r.charAt(8),10),n=parseInt(r.charAt(9),10),s=r.substring(0,8),g=r.substring(10,20),A=0,c=0;c<8;c++)A+=parseInt(s.charAt(c),10)*a[c];var u=A%11;if(t!==(u===0?0:u===1?1:11-u))return!1;A=0;for(var c=0;c<10;c++)A+=parseInt(g.charAt(c),10)*e[c];return u=A%11,n===(u===0?0:u===1?1:11-u)},$=function(r,a){for(var e=10,t=0;t=65)switch(n){case 65:case 74:e[t]="1";break;case 66:case 75:case 83:e[t]="2";break;case 67:case 76:case 84:e[t]="3";break;case 68:case 77:case 85:e[t]="4";break;case 69:case 78:case 86:e[t]="5";break;case 70:case 79:case 87:e[t]="6";break;case 71:case 80:case 88:e[t]="7";break;case 72:case 81:case 89:e[t]="8";break;case 73:case 82:case 90:e[t]="9";break}}var s=p(e.join(""));return s===0},q=function(r){for(var a=[9,7,3,1,9,7,3,1,9,7,3,1,9,7,3],e=parseInt(r.charAt(7),10),t=r.substring(0,7),n=0,s=0;srr[a]).filter(Boolean)}const ir=E({__name:"iban-validator-and-parser",setup(r){const a=M(""),e=W(()=>{const n=a.value.toUpperCase().replace(/\s/g,"").replace(/-/g,"");if(n==="")return[];const{valid:s,errorCodes:g}=U(n),{countryCode:A,bban:c}=H(n),u=er(g);return[{label:"Is IBAN valid ?",value:s,showCopyButton:!1},{label:"IBAN errors",value:u.length===0?void 0:u,hideOnNil:!0,showCopyButton:!1},{label:"Is IBAN a QR-IBAN ?",value:l(n),showCopyButton:!1},{label:"Country code",value:A},{label:"BBAN",value:c},{label:"IBAN friendly format",value:f(n)}]}),t=["FR7630006000011234567890189","DE89370400440532013000","GB29NWBK60161331926819"];return(n,s)=>{const g=P,A=S,c=C;return B(),I("div",null,[o(k,{value:h(a),"onUpdate:value":s[0]||(s[0]=u=>G(a)?a.value=u:null),placeholder:"Enter an IBAN to check for validity...","test-id":"iban-input"},null,8,["value"]),h(e).length>0?(B(),F(A,{key:0,"mt-5":""},{default:v(()=>[o(g,{items:h(e),"data-test-id":"iban-info"},null,8,["items"])]),_:1})):w("",!0),o(A,{title:"Valid IBAN examples","mt-5":""},{default:v(()=>[(B(),I(T,null,L(t,u=>D("div",{key:u},[o(c,{value:u,"font-mono":"","displayed-value":h(f)(u)},null,8,["value","displayed-value"])])),64))]),_:1})])}}});export{ir as default};