@avakhula/ui 0.0.505-alpha.50 → 0.0.505-alpha.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11198,6 +11198,7 @@ const M1 = {
11198
11198
  modelValue: {
11199
11199
  type: String
11200
11200
  },
11201
+ value: String,
11201
11202
  inputName: {
11202
11203
  type: String,
11203
11204
  default: "phone"
@@ -11234,7 +11235,7 @@ const M1 = {
11234
11235
  };
11235
11236
  },
11236
11237
  mounted() {
11237
- this.vueTel = this.$refs.vueTel, this.modelValue && (this.phone = this.modelValue[0] === "+" ? this.modelValue : "+" + this.modelValue);
11238
+ this.vueTel = this.$refs.vueTel, this.value ? this.phone = this.value[0] === "+" ? this.value : "+" + this.value : this.modelValue && (this.phone = this.modelValue[0] === "+" ? this.modelValue : "+" + this.modelValue);
11238
11239
  },
11239
11240
  watch: {
11240
11241
  phone(t) {
@@ -86,7 +86,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
86
86
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hf(t,n){if(t){if(typeof t=="string")return ta(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ta(t,n)}}function ta(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}var zf=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ni(t,n,e){if(n=n||{},!(!t.country&&!t.countryCallingCode)){e=new et(e),e.selectNumberingPlan(t.country,t.countryCallingCode);var o=n.v2?t.nationalNumber:t.phone;if(Dt(o,e.nationalNumberPattern())){if(ri(o,"FIXED_LINE",e))return e.type("MOBILE")&&e.type("MOBILE").pattern()===""||!e.type("MOBILE")||ri(o,"MOBILE",e)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var a=qf(zf),r;!(r=a()).done;){var l=r.value;if(ri(o,l,e))return l}}}}function ri(t,n,e){return n=e.type(n),!n||!n.pattern()||n.possibleLengths()&&n.possibleLengths().indexOf(t.length)<0?!1:Dt(t,n.pattern())}function Uf(t,n,e){if(n=n||{},e=new et(e),e.selectNumberingPlan(t.country,t.countryCallingCode),e.hasTypes())return ni(t,n,e.metadata)!==void 0;var o=n.v2?t.nationalNumber:t.phone;return Dt(o,e.nationalNumberPattern())}function Kf(t,n,e){var o=new et(e),a=o.getCountryCodesForCallingCode(t);return a?a.filter(function(r){return Gf(n,r,e)}):[]}function Gf(t,n,e){var o=new et(e);return o.selectNumberingPlan(n),o.numberingPlan.possibleLengths().indexOf(t.length)>=0}function Wf(t){return t.replace(new RegExp("[".concat(sr,"]+"),"g")," ").trim()}var Yf=/(\$\d)/;function Zf(t,n,e){var o=e.useInternationalFormat,a=e.withNationalPrefix;e.carrierCode,e.metadata;var r=t.replace(new RegExp(n.pattern()),o?n.internationalFormat():a&&n.nationalPrefixFormattingRule()?n.format().replace(Yf,n.nationalPrefixFormattingRule()):n.format());return o?Wf(r):r}var Jf=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function Xf(t,n,e){var o=new et(e);if(o.selectNumberingPlan(t,n),o.defaultIDDPrefix())return o.defaultIDDPrefix();if(Jf.test(o.IDDPrefix()))return o.IDDPrefix()}function Qf(t){var n=t.number,e=t.ext;if(!n)return"";if(n[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(n).concat(e?";ext="+e:"")}function eh(t,n){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=th(t))||n&&t&&typeof t.length=="number"){e&&(t=e);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
87
87
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function th(t,n){if(t){if(typeof t=="string")return na(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return na(t,n)}}function na(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function ra(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function ia(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ra(Object(e),!0).forEach(function(o){nh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ra(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function nh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var oa={formatExtension:function(t,n,e){return"".concat(t).concat(e.ext()).concat(n)}};function rh(t,n,e,o){if(e?e=ia(ia({},oa),e):e=oa,o=new et(o),t.country&&t.country!=="001"){if(!o.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));o.country(t.country)}else if(t.countryCallingCode)o.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var a=o.countryCallingCode(),r=e.v2?t.nationalNumber:t.phone,l;switch(n){case"NATIONAL":return r?(l=fr(r,t.carrierCode,"NATIONAL",o,e),ii(l,t.ext,o,e.formatExtension)):"";case"INTERNATIONAL":return r?(l=fr(r,null,"INTERNATIONAL",o,e),l="+".concat(a," ").concat(l),ii(l,t.ext,o,e.formatExtension)):"+".concat(a);case"E.164":return"+".concat(a).concat(r);case"RFC3966":return Qf({number:"+".concat(a).concat(r),ext:t.ext});case"IDD":if(!e.fromCountry)return;var s=oh(r,t.carrierCode,a,e.fromCountry,o);return ii(s,t.ext,o,e.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(n,'"'))}}function fr(t,n,e,o,a){var r=ih(o.formats(),t);return r?Zf(t,r,{useInternationalFormat:e==="INTERNATIONAL",withNationalPrefix:!(r.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&a&&a.nationalPrefix===!1),carrierCode:n,metadata:o}):t}function ih(t,n){for(var e=eh(t),o;!(o=e()).done;){var a=o.value;if(a.leadingDigitsPatterns().length>0){var r=a.leadingDigitsPatterns()[a.leadingDigitsPatterns().length-1];if(n.search(r)!==0)continue}if(Dt(n,a.pattern()))return a}}function ii(t,n,e,o){return n?o(t,n,e):t}function oh(t,n,e,o,a){var r=ei(o,a.metadata);if(r===e){var l=fr(t,n,"NATIONAL",a);return e==="1"?e+" "+l:l}var s=Xf(o,void 0,a.metadata);if(s)return"".concat(s," ").concat(e," ").concat(fr(t,null,"INTERNATIONAL",a))}function aa(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function la(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?aa(Object(e),!0).forEach(function(o){ah(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):aa(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function ah(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function lh(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function sa(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function sh(t,n,e){return n&&sa(t.prototype,n),e&&sa(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var dh=function(){function t(n,e,o){if(lh(this,t),!n)throw new TypeError("`country` or `countryCallingCode` not passed");if(!e)throw new TypeError("`nationalNumber` not passed");if(!o)throw new TypeError("`metadata` not passed");var a=uh(n,o),r=a.country,l=a.countryCallingCode;this.country=r,this.countryCallingCode=l,this.nationalNumber=e,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}return sh(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Kf(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return Ff(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return Uf(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new et(this.getMetadata());return n.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(n){return this.number===n.number&&this.ext===n.ext}},{key:"getType",value:function(){return ni(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,e){return rh(this,n,e?la(la({},e),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(n){return this.format("NATIONAL",n)}},{key:"formatInternational",value:function(n){return this.format("INTERNATIONAL",n)}},{key:"getURI",value:function(n){return this.format("RFC3966",n)}}]),t}(),ch=function(t){return/^[A-Z]{2}$/.test(t)};function uh(t,n){var e,o,a=new et(n);return ch(t)?(e=t,a.selectNumberingPlan(e),o=a.countryCallingCode()):o=t,{country:e,countryCallingCode:o}}var fh=new RegExp("(["+gt+"])");function hh(t,n,e,o){if(n){var a=new et(o);a.selectNumberingPlan(n,e);var r=new RegExp(a.IDDPrefix());if(t.search(r)===0){t=t.slice(t.match(r)[0].length);var l=t.match(fh);if(!(l&&l[1]!=null&&l[1].length>0&&l[1]==="0"))return t}}}function ph(t,n){if(t&&n.numberingPlan.nationalPrefixForParsing()){var e=new RegExp("^(?:"+n.numberingPlan.nationalPrefixForParsing()+")"),o=e.exec(t);if(o){var a,r,l=o.length-1,s=l>0&&o[l];if(n.nationalPrefixTransformRule()&&s)a=t.replace(e,n.nationalPrefixTransformRule()),l>1&&(r=o[1]);else{var c=o[0];a=t.slice(c.length),s&&(r=o[1])}var h;if(s){var p=t.indexOf(o[1]),f=t.slice(0,p);f===n.numberingPlan.nationalPrefix()&&(h=n.numberingPlan.nationalPrefix())}else h=o[0];return{nationalNumber:a,nationalPrefix:h,carrierCode:r}}}return{nationalNumber:t}}function oi(t,n){var e=ph(t,n),o=e.carrierCode,a=e.nationalNumber;if(a!==t){if(!mh(t,a,n))return{nationalNumber:t};if(n.possibleLengths()&&!gh(a,n))return{nationalNumber:t}}return{nationalNumber:a,carrierCode:o}}function mh(t,n,e){return!(Dt(t,e.nationalNumberPattern())&&!Dt(n,e.nationalNumberPattern()))}function gh(t,n){switch(ti(t,n)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function yh(t,n,e,o){var a=n?ei(n,o):e;if(t.indexOf(a)===0){o=new et(o),o.selectNumberingPlan(n,e);var r=t.slice(a.length),l=oi(r,o),s=l.nationalNumber,c=oi(t,o),h=c.nationalNumber;if(!Dt(h,o.nationalNumberPattern())&&Dt(s,o.nationalNumberPattern())||ti(h,o)==="TOO_LONG")return{countryCallingCode:a,number:r}}return{number:t}}function vh(t,n,e,o){if(!t)return{};var a;if(t[0]!=="+"){var r=hh(t,n,e,o);if(r&&r!==t)a=!0,t="+"+r;else{if(n||e){var l=yh(t,n,e,o),s=l.countryCallingCode,c=l.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:c}}return{number:t}}}if(t[1]==="0")return{};o=new et(o);for(var h=2;h-1<=lf&&h<=t.length;){var p=t.slice(1,h);if(o.hasCallingCode(p))return o.selectNumberingPlan(p),{countryCallingCodeSource:a?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:p,number:t.slice(h)};h++}return{}}function bh(t,n){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=_h(t))||n&&t&&typeof t.length=="number"){e&&(t=e);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
88
88
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _h(t,n){if(t){if(typeof t=="string")return da(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return da(t,n)}}function da(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function $h(t,n){var e=n.countries,o=n.defaultCountry,a=n.metadata;a=new et(a);for(var r=[],l=bh(e),s;!(s=l()).done;){var c=s.value;if(a.country(c),a.leadingDigits()){if(t&&t.search(a.leadingDigits())===0)return c}else if(ni({phone:t,country:c},void 0,a.metadata))if(o){if(c===o)return c;r.push(c)}else return c}if(r.length>0)return r[0]}function wh(t,n){var e=n.nationalNumber,o=n.defaultCountry,a=n.metadata,r=a.getCountryCodesForCallingCode(t);if(r)return r.length===1?r[0]:$h(e,{countries:r,defaultCountry:o,metadata:a.metadata})}var ca="+",kh="[\\-\\.\\(\\)]?",ua="(["+gt+"]|"+kh+")",Ch="^\\"+ca+ua+"*["+gt+"]"+ua+"*$",Oh=new RegExp(Ch,"g"),ai=gt,Eh="["+ai+"]+((\\-)*["+ai+"])*",Sh="a-zA-Z",xh="["+Sh+"]+((\\-)*["+ai+"])*",Th="^("+Eh+"\\.)*"+xh+"\\.?$",Nh=new RegExp(Th,"g"),fa="tel:",li=";phone-context=",Ah=";isub=";function Dh(t){var n=t.indexOf(li);if(n<0)return null;var e=n+li.length;if(e>=t.length)return"";var o=t.indexOf(";",e);return o>=0?t.substring(e,o):t.substring(e)}function Ih(t){return t===null?!0:t.length===0?!1:Oh.test(t)||Nh.test(t)}function Ph(t,n){var e=n.extractFormattedPhoneNumber,o=Dh(t);if(!Ih(o))throw new At("NOT_A_NUMBER");var a;if(o===null)a=e(t)||"";else{a="",o.charAt(0)===ca&&(a+=o);var r=t.indexOf(fa),l;r>=0?l=r+fa.length:l=0;var s=t.indexOf(li);a+=t.substring(l,s)}var c=a.indexOf(Ah);if(c>0&&(a=a.substring(0,c)),a!=="")return a}var Mh=250,Bh=new RegExp("["+Xr+gt+"]"),Lh=new RegExp("[^"+gt+"#]+$");function Rh(t,n,e){if(n=n||{},e=new et(e),n.defaultCountry&&!e.hasCountry(n.defaultCountry))throw n.v2?new At("INVALID_COUNTRY"):new Error("Unknown country: ".concat(n.defaultCountry));var o=Vh(t,n.v2,n.extract),a=o.number,r=o.ext,l=o.error;if(!a){if(n.v2)throw l==="TOO_SHORT"?new At("TOO_SHORT"):new At("NOT_A_NUMBER");return{}}var s=qh(a,n.defaultCountry,n.defaultCallingCode,e),c=s.country,h=s.nationalNumber,p=s.countryCallingCode,f=s.countryCallingCodeSource,d=s.carrierCode;if(!e.hasSelectedNumberingPlan()){if(n.v2)throw new At("INVALID_COUNTRY");return{}}if(!h||h.length<Jr){if(n.v2)throw new At("TOO_SHORT");return{}}if(h.length>af){if(n.v2)throw new At("TOO_LONG");return{}}if(n.v2){var u=new dh(p,h,e.metadata);return c&&(u.country=c),d&&(u.carrierCode=d),r&&(u.ext=r),u.__countryCallingCodeSource=f,u}var _=(n.extended?e.hasSelectedNumberingPlan():c)?Dt(h,e.nationalNumberPattern()):!1;return n.extended?{country:c,countryCallingCode:p,carrierCode:d,valid:_,possible:_?!0:!!(n.extended===!0&&e.possibleLengths()&&ea(h,e)),phone:h,ext:r}:_?Fh(c,h,r):{}}function jh(t,n,e){if(t){if(t.length>Mh){if(e)throw new At("TOO_LONG");return}if(n===!1)return t;var o=t.search(Bh);if(!(o<0))return t.slice(o).replace(Lh,"")}}function Vh(t,n,e){var o=Ph(t,{extractFormattedPhoneNumber:function(r){return jh(r,e,n)}});if(!o)return{};if(!Nf(o))return Af(o)?{error:"TOO_SHORT"}:{};var a=Df(o);return a.ext?a:{number:o}}function Fh(t,n,e){var o={country:t,phone:n};return e&&(o.ext=e),o}function qh(t,n,e,o){var a=vh(Jo(t),n,e,o.metadata),r=a.countryCallingCodeSource,l=a.countryCallingCode,s=a.number,c;if(l)o.selectNumberingPlan(l);else if(s&&(n||e))o.selectNumberingPlan(n,e),n&&(c=n),l=e||ei(n,o.metadata);else return{};if(!s)return{countryCallingCodeSource:r,countryCallingCode:l};var h=oi(Jo(s),o),p=h.nationalNumber,f=h.carrierCode,d=wh(l,{nationalNumber:p,defaultCountry:n,metadata:o});return d&&(c=d,d==="001"||o.country(c)),{country:c,countryCallingCode:l,countryCallingCodeSource:r,nationalNumber:p,carrierCode:f}}function ha(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function pa(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ha(Object(e),!0).forEach(function(o){Hh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ha(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function Hh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function zh(t,n,e){return Rh(t,pa(pa({},n),{},{v2:!0}),e)}function ma(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function Uh(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ma(Object(e),!0).forEach(function(o){Kh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ma(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function Kh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function Gh(t,n){return Jh(t)||Zh(t,n)||Yh(t,n)||Wh()}function Wh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
89
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yh(t,n){if(t){if(typeof t=="string")return ga(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ga(t,n)}}function ga(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function Zh(t,n){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var o=[],a=!0,r=!1,l,s;try{for(e=e.call(t);!(a=(l=e.next()).done)&&(o.push(l.value),!(n&&o.length===n));a=!0);}catch(c){r=!0,s=c}finally{try{!a&&e.return!=null&&e.return()}finally{if(r)throw s}}return o}}function Jh(t){if(Array.isArray(t))return t}function Xh(t){var n=Array.prototype.slice.call(t),e=Gh(n,4),o=e[0],a=e[1],r=e[2],l=e[3],s,c,h;if(typeof o=="string")s=o;else throw new TypeError("A text for parsing must be a string.");if(!a||typeof a=="string")l?(c=r,h=l):(c=void 0,h=r),a&&(c=Uh({defaultCountry:a},c));else if(dr(a))r?(c=a,h=r):h=a;else throw new Error("Invalid second argument: ".concat(a));return{text:s,options:c,metadata:h}}function ya(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function va(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ya(Object(e),!0).forEach(function(o){Qh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ya(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function Qh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function e1(t,n,e){n&&n.defaultCountry&&!kf(n.defaultCountry,e)&&(n=va(va({},n),{},{defaultCountry:void 0}));try{return zh(t,n,e)}catch(o){if(!(o instanceof At))throw o}}function t1(){var t=Xh(arguments),n=t.text,e=t.options,o=t.metadata;return e1(n,e,o)}function si(){return Xu(t1,arguments)}const n1={beforeMount(t,n,e){if(typeof n.value!="function"){const o=e.context.name;let a=`[Vue-click-outside:] provided expression ${n.expression} is not a function, but has to be`;o&&(a+=`Found in component ${o}`),console.warn(a)}t.clickOutsideEvent=function(o){const a=o.composedPath?o.composedPath():o.path;t===o.target||t.contains(o.target)||a.includes(t)||n.value(o,t)},document.body.addEventListener("click",t.clickOutsideEvent)},unmounted(t){document.body.removeEventListener("click",t.clickOutsideEvent)}},r1=(t,n)=>{const e=t.__vccOpts||t;for(const[o,a]of n)e[o]=a;return e};function tt(t){const n=Ro.options[t];return typeof n>"u"?Ro.options[t]:n}const i1={name:"VueTelInput",directives:{clickOutside:n1},props:{modelValue:{type:String,default:""},allCountries:{type:Array,default:()=>tt("allCountries")},autoFormat:{type:Boolean,default:()=>tt("autoFormat")},customValidate:{type:[Boolean,RegExp],default:()=>tt("customValidate")},defaultCountry:{type:[String,Number],default:()=>tt("defaultCountry")},disabled:{type:Boolean,default:()=>tt("disabled")},autoDefaultCountry:{type:Boolean,default:()=>tt("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>tt("dropdownOptions")},ignoredCountries:{type:Array,default:()=>tt("ignoredCountries")},inputOptions:{type:Object,default:()=>tt("inputOptions")},invalidMsg:{type:String,default:()=>tt("invalidMsg")},mode:{type:String,default:()=>tt("mode")},onlyCountries:{type:Array,default:()=>tt("onlyCountries")},preferredCountries:{type:Array,default:()=>tt("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>tt("validCharactersOnly")},styleClasses:{type:[String,Array,Object],default:()=>tt("styleClasses")}},data(){return{phone:"",activeCountryCode:"",open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:null,dropdownOpenDirection:"below",parsedPlaceholder:this.inputOptions.placeholder,searchQuery:""}},computed:{activeCountry(){return this.findCountry(this.activeCountryCode)},parsedMode(){return this.mode==="auto"?!this.phone||this.phone[0]!=="+"?"national":"international":["international","national"].includes(this.mode)?this.mode:(console.error('Invalid value of prop "mode"'),"international")},filteredCountries(){return this.onlyCountries.length?this.allCountries.filter(({iso2:t})=>this.onlyCountries.some(n=>n.toUpperCase()===t)):this.ignoredCountries.length?this.allCountries.filter(({iso2:t})=>!this.ignoredCountries.includes(t.toUpperCase())&&!this.ignoredCountries.includes(t.toLowerCase())):this.allCountries},sortedCountries(){const t=[...this.getCountries(this.preferredCountries).map(e=>({...e,preferred:!0})),...this.filteredCountries];if(!this.dropdownOptions.showSearchBox)return t;const n=this.searchQuery.replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]/g,"");return t.filter(e=>new RegExp(n,"i").test(e.name)||new RegExp(n,"i").test(e.iso2)||new RegExp(n,"i").test(e.dialCode))},phoneObject(){var t,n,e;let o;((t=this.phone)==null?void 0:t[0])==="+"?o=si(this.phone)||{}:o=si(this.phone,this.activeCountryCode)||{};const{metadata:a,...r}=o;let l=(n=o.isValid)==null?void 0:n.call(o),s=this.phone;return l&&(s=(e=o.format)==null?void 0:e.call(o,this.parsedMode.toUpperCase())),o.country&&(this.ignoredCountries.length||this.onlyCountries.length)&&(this.findCountry(o.country)||(l=!1,Object.assign(o,{country:null}))),Object.assign(r,{countryCode:o.country,valid:l,country:this.activeCountry,formatted:s}),r}},watch:{activeCountry(t,n){if(!t&&n!=null&&n.iso2){this.activeCountryCode=n.iso2;return}t!=null&&t.iso2&&this.$emit("country-changed",t)},"phoneObject.countryCode":function(t){this.activeCountryCode=t||""},"phoneObject.valid":function(){this.$emit("validate",this.phoneObject)},"phoneObject.formatted":function(t){!this.autoFormat||this.customValidate||(this.emitInput(t),this.$nextTick(()=>{t&&!this.modelValue&&(this.phone=t)}))},"inputOptions.placeholder":function(){this.resetPlaceholder()},modelValue(t,n){this.testCharacters()?this.phone=t:this.$nextTick(()=>{this.phone=n,this.onInput()})},open(t){t?(this.setDropdownPosition(),this.$emit("open")):this.$emit("close")}},mounted(){this.modelValue&&(this.phone=this.modelValue.trim()),this.cleanInvalidCharacters(),this.initializeCountry().then(()=>{var t;!this.phone&&(t=this.inputOptions)!=null&&t.showDialCode&&this.activeCountryCode&&(this.phone=`+${this.activeCountryCode}`),this.$emit("validate",this.phoneObject)}).catch(console.error).then(()=>{this.finishMounted=!0})},methods:{resetPlaceholder(){this.parsedPlaceholder=this.inputOptions.placeholder},initializeCountry(){return new Promise(t=>{var n;if(((n=this.phone)==null?void 0:n[0])==="+"){t();return}if(this.defaultCountry){if(typeof this.defaultCountry=="string"){this.choose(this.defaultCountry),t();return}if(typeof this.defaultCountry=="number"){const o=this.findCountryByDialCode(this.defaultCountry);if(o){this.choose(o.iso2),t();return}}}const e=this.preferredCountries[0]||this.filteredCountries[0];this.autoDefaultCountry?Gu().then(o=>{this.choose(o||this.activeCountryCode)}).catch(o=>{console.warn(o),this.choose(e)}).then(()=>{t()}):(this.choose(e),t())})},getCountries(t=[]){return t.map(n=>this.findCountry(n)).filter(Boolean)},findCountry(t=""){return this.filteredCountries.find(n=>n.iso2===t.toUpperCase())},findCountryByDialCode(t){return this.filteredCountries.find(n=>Number(n.dialCode)===t)},getItemClass(t,n){const e=this.selectedIndex===t,o=t===this.preferredCountries.length-1,a=this.preferredCountries.some(r=>r.toUpperCase()===n);return{highlighted:e,"last-preferred":o,preferred:a}},choose(t){var n,e;let o=t;if(typeof o=="string"&&(o=this.findCountry(o)),!!o){if(((n=this.phone)==null?void 0:n[0])==="+"&&o.iso2&&this.phoneObject.nationalNumber){this.activeCountryCode=o.iso2,this.phone=si(this.phoneObject.nationalNumber,o.iso2).formatInternational();return}if((e=this.inputOptions)!=null&&e.showDialCode&&o){this.phone=`+${o.dialCode}`,this.activeCountryCode=o.iso2||"";return}this.activeCountryCode=o.iso2||"",this.emitInput(this.phone)}},cleanInvalidCharacters(){const t=this.phone;if(this.validCharactersOnly){const n=this.phone.match(/[()\-+0-9\s]*/g);this.phone=n.join("")}if(this.customValidate&&this.customValidate instanceof RegExp){const n=this.phone.match(this.customValidate);this.phone=n.join("")}t!==this.phone&&this.emitInput(this.phone)},testCharacters(){return this.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(this.phone)?!1:this.customValidate?this.testCustomValidate():!0},testCustomValidate(){return this.customValidate instanceof RegExp?this.customValidate.test(this.phone):!1},onInput(){this.$refs.input.setCustomValidity(this.phoneObject.valid?"":this.invalidMsg),this.emitInput(this.phone)},emitInput(t){this.$emit("update:modelValue",t),this.$emit("on-input",t,this.phoneObject,this.$refs.input)},onBlur(){this.$emit("blur")},onFocus(){Wu(this.$refs.input,this.phone.length),this.$emit("focus")},onEnter(){this.$emit("enter")},onSpace(){this.$emit("space")},focus(){this.$refs.input.focus()},toggleDropdown(){this.disabled||this.dropdownOptions.disabled||(this.searchQuery="",this.open=!this.open)},clickedOutside(){this.open=!1},keyboardNav(t){if(t.keyCode===40){t.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=0:this.selectedIndex=Math.min(this.sortedCountries.length-1,this.selectedIndex+1);const n=this.$refs.list.children[this.selectedIndex];n.focus(),n.offsetTop+n.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight&&(this.$refs.list.scrollTop=n.offsetTop-this.$refs.list.clientHeight+n.clientHeight)}else if(t.keyCode===38){t.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=this.sortedCountries.length-1:this.selectedIndex=Math.max(0,this.selectedIndex-1);const n=this.$refs.list.children[this.selectedIndex];n.focus(),n.offsetTop<this.$refs.list.scrollTop&&(this.$refs.list.scrollTop=n.offsetTop)}else if(t.keyCode===13)this.selectedIndex!==null&&this.choose(this.sortedCountries[this.selectedIndex]),this.open=!this.open;else{this.typeToFindInput+=t.key,clearTimeout(this.typeToFindTimer),this.typeToFindTimer=setTimeout(()=>{this.typeToFindInput=""},700);const n=this.sortedCountries.slice(this.preferredCountries.length).findIndex(e=>e.name.toLowerCase().startsWith(this.typeToFindInput));if(n>=0){this.selectedIndex=this.preferredCountries.length+n;const e=this.$refs.list.children[this.selectedIndex],o=e.offsetTop<this.$refs.list.scrollTop,a=e.offsetTop+e.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight;(o||a)&&(this.$refs.list.scrollTop=e.offsetTop-this.$refs.list.clientHeight/2)}}},reset(){this.selectedIndex=this.sortedCountries.map(t=>t.iso2).indexOf(this.activeCountryCode),this.open=!1},setDropdownPosition(){window.innerHeight-this.$el.getBoundingClientRect().bottom>200?this.dropdownOpenDirection="below":this.dropdownOpenDirection="above"}}},o1=["aria-expanded","tabindex"],a1={class:"vti__selection"},l1={key:1,class:"vti__country-code"},s1={class:"vti__dropdown-arrow"},d1=["placeholder"],c1=["onClick","onMousemove","aria-selected"],u1={key:1},f1=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex","value","aria-describedby"];function h1(t,n,e,o,a,r){const l=i.resolveDirective("click-outside");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["vue-tel-input",e.styleClasses,{disabled:e.disabled}])},[i.withDirectives((i.openBlock(),i.createElementBlock("div",{"aria-label":"Country Code Selector","aria-haspopup":"listbox","aria-expanded":a.open,role:"button",class:i.normalizeClass(["vti__dropdown",{open:a.open,disabled:e.dropdownOptions.disabled}]),tabindex:e.dropdownOptions.tabindex,onKeydown:[n[2]||(n[2]=(...s)=>r.keyboardNav&&r.keyboardNav(...s)),n[4]||(n[4]=i.withKeys((...s)=>r.toggleDropdown&&r.toggleDropdown(...s),["space"])),n[5]||(n[5]=i.withKeys((...s)=>r.reset&&r.reset(...s),["esc"])),n[6]||(n[6]=i.withKeys((...s)=>r.reset&&r.reset(...s),["tab"]))],onClick:n[3]||(n[3]=(...s)=>r.toggleDropdown&&r.toggleDropdown(...s))},[i.createElementVNode("span",a1,[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",a.activeCountryCode.toLowerCase()])},null,2)):i.createCommentVNode("",!0),e.dropdownOptions.showDialCodeInSelection?(i.openBlock(),i.createElementBlock("span",l1," +"+i.toDisplayString(r.activeCountry&&r.activeCountry.dialCode),1)):i.createCommentVNode("",!0),i.renderSlot(t.$slots,"arrow-icon",{open:a.open},()=>[i.createElementVNode("span",s1,i.toDisplayString(a.open?"▲":"▼"),1)])]),a.open?(i.openBlock(),i.createElementBlock("ul",{key:0,ref:"list",class:i.normalizeClass(["vti__dropdown-list",a.dropdownOpenDirection]),role:"listbox"},[e.dropdownOptions.showSearchBox?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,class:"vti__input vti__search_box","aria-label":"Search by country name or country code",placeholder:r.sortedCountries.length?r.sortedCountries[0].name:"",type:"text","onUpdate:modelValue":n[0]||(n[0]=s=>a.searchQuery=s),onClick:n[1]||(n[1]=i.withModifiers(()=>{},["stop"]))},null,8,d1)),[[i.vModelText,a.searchQuery]]):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.sortedCountries,(s,c)=>(i.openBlock(),i.createElementBlock("li",{role:"option",class:i.normalizeClass(["vti__dropdown-item",r.getItemClass(c,s.iso2)]),key:s.iso2+(s.preferred?"-preferred":""),tabindex:"-1",onClick:h=>r.choose(s),onMousemove:h=>a.selectedIndex=c,"aria-selected":a.activeCountryCode===s.iso2&&!s.preferred},[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",s.iso2.toLowerCase()])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("strong",null,i.toDisplayString(s.name),1),e.dropdownOptions.showDialCodeInList?(i.openBlock(),i.createElementBlock("span",u1," +"+i.toDisplayString(s.dialCode),1)):i.createCommentVNode("",!0)],42,c1))),128))],2)):i.createCommentVNode("",!0)],42,o1)),[[l,r.clickedOutside]]),i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":n[7]||(n[7]=s=>a.phone=s),ref:"input",type:e.inputOptions.type,autocomplete:e.inputOptions.autocomplete,autofocus:e.inputOptions.autofocus,class:i.normalizeClass(["vti__input",e.inputOptions.styleClasses]),disabled:e.disabled,id:e.inputOptions.id,maxlength:e.inputOptions.maxlength,name:e.inputOptions.name,placeholder:a.parsedPlaceholder,readonly:e.inputOptions.readonly,required:e.inputOptions.required,tabindex:e.inputOptions.tabindex,value:e.modelValue,"aria-describedby":e.inputOptions["aria-describedby"],onBlur:n[8]||(n[8]=(...s)=>r.onBlur&&r.onBlur(...s)),onFocus:n[9]||(n[9]=(...s)=>r.onFocus&&r.onFocus(...s)),onInput:n[10]||(n[10]=(...s)=>r.onInput&&r.onInput(...s)),onKeyup:[n[11]||(n[11]=i.withKeys((...s)=>r.onEnter&&r.onEnter(...s),["enter"])),n[12]||(n[12]=i.withKeys((...s)=>r.onSpace&&r.onSpace(...s),["space"]))]},null,42,f1),[[i.vModelDynamic,a.phone]]),i.renderSlot(t.$slots,"icon-right")],2)}const p1=r1(i1,[["render",h1]]),gp="",yp="",m1={directives:{Outside:Xn},props:{modelValue:{type:String},inputName:{type:String,default:"phone"},autoDefaultCountry:{type:Boolean,default:!0},ignoredCountries:{type:Array,default:()=>[]},error:{type:Boolean,default:!1},errorMessage:{type:String,default:""}},emits:["update:modelValue"],components:{VueTelInput:p1,IbAlert:qt,IbIcon:Be},data(){return{vueTel:null,phone:"",dialCode:"",defaultCountry:"US"}},mounted(){this.vueTel=this.$refs.vueTel,this.modelValue&&(this.phone=this.modelValue[0]==="+"?this.modelValue:"+"+this.modelValue)},watch:{phone(t){this.$emit("update:modelValue",t)}},methods:{countryChanged(t){this.$globalEvents.$on("countrySelectValue",n=>{this.vueTel.choose(n)}),this.phone="+"+t.dialCode,this.dialCode=t.dialCode},clickOutside(){this.vueTel.open&&this.vueTel.clickedOutside()}}};function g1(t,n,e,o,a,r){const l=i.resolveComponent("ib-alert"),s=i.resolveComponent("ib-icon"),c=i.resolveComponent("vue-tel-input"),h=i.resolveDirective("outside");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.errorMessage.length?(i.openBlock(),i.createBlock(l,{key:0,class:"ib-phone-error-message"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(e.errorMessage),1)]),_:1})):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createBlock(c,i.mergeProps({modelValue:a.phone,"onUpdate:modelValue":n[0]||(n[0]=p=>a.phone=p)},t.$attrs,{onCountryChanged:r.countryChanged,"input-options":{name:e.inputName,id:e.inputName},"auto-default-country":e.autoDefaultCountry,"dropdown-options":{showSearchBox:!0,showFlags:!0},defaultCountry:a.defaultCountry,ignoredCountries:e.ignoredCountries,class:{error:e.error||e.errorMessage.length},"style-classes":"ib-phone-input",ref:"vueTel"}),{"arrow-icon":i.withCtx(()=>[i.createVNode(s,{name:"chevron-down-outline"})]),_:1},16,["modelValue","onCountryChanged","input-options","auto-default-country","defaultCountry","ignoredCountries","class"])),[[h,r.clickOutside]])],64)}const y1=_e(m1,[["render",g1]]);var ba={exports:{}};/*!
89
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yh(t,n){if(t){if(typeof t=="string")return ga(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ga(t,n)}}function ga(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function Zh(t,n){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var o=[],a=!0,r=!1,l,s;try{for(e=e.call(t);!(a=(l=e.next()).done)&&(o.push(l.value),!(n&&o.length===n));a=!0);}catch(c){r=!0,s=c}finally{try{!a&&e.return!=null&&e.return()}finally{if(r)throw s}}return o}}function Jh(t){if(Array.isArray(t))return t}function Xh(t){var n=Array.prototype.slice.call(t),e=Gh(n,4),o=e[0],a=e[1],r=e[2],l=e[3],s,c,h;if(typeof o=="string")s=o;else throw new TypeError("A text for parsing must be a string.");if(!a||typeof a=="string")l?(c=r,h=l):(c=void 0,h=r),a&&(c=Uh({defaultCountry:a},c));else if(dr(a))r?(c=a,h=r):h=a;else throw new Error("Invalid second argument: ".concat(a));return{text:s,options:c,metadata:h}}function ya(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function va(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ya(Object(e),!0).forEach(function(o){Qh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ya(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function Qh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function e1(t,n,e){n&&n.defaultCountry&&!kf(n.defaultCountry,e)&&(n=va(va({},n),{},{defaultCountry:void 0}));try{return zh(t,n,e)}catch(o){if(!(o instanceof At))throw o}}function t1(){var t=Xh(arguments),n=t.text,e=t.options,o=t.metadata;return e1(n,e,o)}function si(){return Xu(t1,arguments)}const n1={beforeMount(t,n,e){if(typeof n.value!="function"){const o=e.context.name;let a=`[Vue-click-outside:] provided expression ${n.expression} is not a function, but has to be`;o&&(a+=`Found in component ${o}`),console.warn(a)}t.clickOutsideEvent=function(o){const a=o.composedPath?o.composedPath():o.path;t===o.target||t.contains(o.target)||a.includes(t)||n.value(o,t)},document.body.addEventListener("click",t.clickOutsideEvent)},unmounted(t){document.body.removeEventListener("click",t.clickOutsideEvent)}},r1=(t,n)=>{const e=t.__vccOpts||t;for(const[o,a]of n)e[o]=a;return e};function tt(t){const n=Ro.options[t];return typeof n>"u"?Ro.options[t]:n}const i1={name:"VueTelInput",directives:{clickOutside:n1},props:{modelValue:{type:String,default:""},allCountries:{type:Array,default:()=>tt("allCountries")},autoFormat:{type:Boolean,default:()=>tt("autoFormat")},customValidate:{type:[Boolean,RegExp],default:()=>tt("customValidate")},defaultCountry:{type:[String,Number],default:()=>tt("defaultCountry")},disabled:{type:Boolean,default:()=>tt("disabled")},autoDefaultCountry:{type:Boolean,default:()=>tt("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>tt("dropdownOptions")},ignoredCountries:{type:Array,default:()=>tt("ignoredCountries")},inputOptions:{type:Object,default:()=>tt("inputOptions")},invalidMsg:{type:String,default:()=>tt("invalidMsg")},mode:{type:String,default:()=>tt("mode")},onlyCountries:{type:Array,default:()=>tt("onlyCountries")},preferredCountries:{type:Array,default:()=>tt("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>tt("validCharactersOnly")},styleClasses:{type:[String,Array,Object],default:()=>tt("styleClasses")}},data(){return{phone:"",activeCountryCode:"",open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:null,dropdownOpenDirection:"below",parsedPlaceholder:this.inputOptions.placeholder,searchQuery:""}},computed:{activeCountry(){return this.findCountry(this.activeCountryCode)},parsedMode(){return this.mode==="auto"?!this.phone||this.phone[0]!=="+"?"national":"international":["international","national"].includes(this.mode)?this.mode:(console.error('Invalid value of prop "mode"'),"international")},filteredCountries(){return this.onlyCountries.length?this.allCountries.filter(({iso2:t})=>this.onlyCountries.some(n=>n.toUpperCase()===t)):this.ignoredCountries.length?this.allCountries.filter(({iso2:t})=>!this.ignoredCountries.includes(t.toUpperCase())&&!this.ignoredCountries.includes(t.toLowerCase())):this.allCountries},sortedCountries(){const t=[...this.getCountries(this.preferredCountries).map(e=>({...e,preferred:!0})),...this.filteredCountries];if(!this.dropdownOptions.showSearchBox)return t;const n=this.searchQuery.replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]/g,"");return t.filter(e=>new RegExp(n,"i").test(e.name)||new RegExp(n,"i").test(e.iso2)||new RegExp(n,"i").test(e.dialCode))},phoneObject(){var t,n,e;let o;((t=this.phone)==null?void 0:t[0])==="+"?o=si(this.phone)||{}:o=si(this.phone,this.activeCountryCode)||{};const{metadata:a,...r}=o;let l=(n=o.isValid)==null?void 0:n.call(o),s=this.phone;return l&&(s=(e=o.format)==null?void 0:e.call(o,this.parsedMode.toUpperCase())),o.country&&(this.ignoredCountries.length||this.onlyCountries.length)&&(this.findCountry(o.country)||(l=!1,Object.assign(o,{country:null}))),Object.assign(r,{countryCode:o.country,valid:l,country:this.activeCountry,formatted:s}),r}},watch:{activeCountry(t,n){if(!t&&n!=null&&n.iso2){this.activeCountryCode=n.iso2;return}t!=null&&t.iso2&&this.$emit("country-changed",t)},"phoneObject.countryCode":function(t){this.activeCountryCode=t||""},"phoneObject.valid":function(){this.$emit("validate",this.phoneObject)},"phoneObject.formatted":function(t){!this.autoFormat||this.customValidate||(this.emitInput(t),this.$nextTick(()=>{t&&!this.modelValue&&(this.phone=t)}))},"inputOptions.placeholder":function(){this.resetPlaceholder()},modelValue(t,n){this.testCharacters()?this.phone=t:this.$nextTick(()=>{this.phone=n,this.onInput()})},open(t){t?(this.setDropdownPosition(),this.$emit("open")):this.$emit("close")}},mounted(){this.modelValue&&(this.phone=this.modelValue.trim()),this.cleanInvalidCharacters(),this.initializeCountry().then(()=>{var t;!this.phone&&(t=this.inputOptions)!=null&&t.showDialCode&&this.activeCountryCode&&(this.phone=`+${this.activeCountryCode}`),this.$emit("validate",this.phoneObject)}).catch(console.error).then(()=>{this.finishMounted=!0})},methods:{resetPlaceholder(){this.parsedPlaceholder=this.inputOptions.placeholder},initializeCountry(){return new Promise(t=>{var n;if(((n=this.phone)==null?void 0:n[0])==="+"){t();return}if(this.defaultCountry){if(typeof this.defaultCountry=="string"){this.choose(this.defaultCountry),t();return}if(typeof this.defaultCountry=="number"){const o=this.findCountryByDialCode(this.defaultCountry);if(o){this.choose(o.iso2),t();return}}}const e=this.preferredCountries[0]||this.filteredCountries[0];this.autoDefaultCountry?Gu().then(o=>{this.choose(o||this.activeCountryCode)}).catch(o=>{console.warn(o),this.choose(e)}).then(()=>{t()}):(this.choose(e),t())})},getCountries(t=[]){return t.map(n=>this.findCountry(n)).filter(Boolean)},findCountry(t=""){return this.filteredCountries.find(n=>n.iso2===t.toUpperCase())},findCountryByDialCode(t){return this.filteredCountries.find(n=>Number(n.dialCode)===t)},getItemClass(t,n){const e=this.selectedIndex===t,o=t===this.preferredCountries.length-1,a=this.preferredCountries.some(r=>r.toUpperCase()===n);return{highlighted:e,"last-preferred":o,preferred:a}},choose(t){var n,e;let o=t;if(typeof o=="string"&&(o=this.findCountry(o)),!!o){if(((n=this.phone)==null?void 0:n[0])==="+"&&o.iso2&&this.phoneObject.nationalNumber){this.activeCountryCode=o.iso2,this.phone=si(this.phoneObject.nationalNumber,o.iso2).formatInternational();return}if((e=this.inputOptions)!=null&&e.showDialCode&&o){this.phone=`+${o.dialCode}`,this.activeCountryCode=o.iso2||"";return}this.activeCountryCode=o.iso2||"",this.emitInput(this.phone)}},cleanInvalidCharacters(){const t=this.phone;if(this.validCharactersOnly){const n=this.phone.match(/[()\-+0-9\s]*/g);this.phone=n.join("")}if(this.customValidate&&this.customValidate instanceof RegExp){const n=this.phone.match(this.customValidate);this.phone=n.join("")}t!==this.phone&&this.emitInput(this.phone)},testCharacters(){return this.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(this.phone)?!1:this.customValidate?this.testCustomValidate():!0},testCustomValidate(){return this.customValidate instanceof RegExp?this.customValidate.test(this.phone):!1},onInput(){this.$refs.input.setCustomValidity(this.phoneObject.valid?"":this.invalidMsg),this.emitInput(this.phone)},emitInput(t){this.$emit("update:modelValue",t),this.$emit("on-input",t,this.phoneObject,this.$refs.input)},onBlur(){this.$emit("blur")},onFocus(){Wu(this.$refs.input,this.phone.length),this.$emit("focus")},onEnter(){this.$emit("enter")},onSpace(){this.$emit("space")},focus(){this.$refs.input.focus()},toggleDropdown(){this.disabled||this.dropdownOptions.disabled||(this.searchQuery="",this.open=!this.open)},clickedOutside(){this.open=!1},keyboardNav(t){if(t.keyCode===40){t.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=0:this.selectedIndex=Math.min(this.sortedCountries.length-1,this.selectedIndex+1);const n=this.$refs.list.children[this.selectedIndex];n.focus(),n.offsetTop+n.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight&&(this.$refs.list.scrollTop=n.offsetTop-this.$refs.list.clientHeight+n.clientHeight)}else if(t.keyCode===38){t.preventDefault(),this.open=!0,this.selectedIndex===null?this.selectedIndex=this.sortedCountries.length-1:this.selectedIndex=Math.max(0,this.selectedIndex-1);const n=this.$refs.list.children[this.selectedIndex];n.focus(),n.offsetTop<this.$refs.list.scrollTop&&(this.$refs.list.scrollTop=n.offsetTop)}else if(t.keyCode===13)this.selectedIndex!==null&&this.choose(this.sortedCountries[this.selectedIndex]),this.open=!this.open;else{this.typeToFindInput+=t.key,clearTimeout(this.typeToFindTimer),this.typeToFindTimer=setTimeout(()=>{this.typeToFindInput=""},700);const n=this.sortedCountries.slice(this.preferredCountries.length).findIndex(e=>e.name.toLowerCase().startsWith(this.typeToFindInput));if(n>=0){this.selectedIndex=this.preferredCountries.length+n;const e=this.$refs.list.children[this.selectedIndex],o=e.offsetTop<this.$refs.list.scrollTop,a=e.offsetTop+e.clientHeight>this.$refs.list.scrollTop+this.$refs.list.clientHeight;(o||a)&&(this.$refs.list.scrollTop=e.offsetTop-this.$refs.list.clientHeight/2)}}},reset(){this.selectedIndex=this.sortedCountries.map(t=>t.iso2).indexOf(this.activeCountryCode),this.open=!1},setDropdownPosition(){window.innerHeight-this.$el.getBoundingClientRect().bottom>200?this.dropdownOpenDirection="below":this.dropdownOpenDirection="above"}}},o1=["aria-expanded","tabindex"],a1={class:"vti__selection"},l1={key:1,class:"vti__country-code"},s1={class:"vti__dropdown-arrow"},d1=["placeholder"],c1=["onClick","onMousemove","aria-selected"],u1={key:1},f1=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex","value","aria-describedby"];function h1(t,n,e,o,a,r){const l=i.resolveDirective("click-outside");return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["vue-tel-input",e.styleClasses,{disabled:e.disabled}])},[i.withDirectives((i.openBlock(),i.createElementBlock("div",{"aria-label":"Country Code Selector","aria-haspopup":"listbox","aria-expanded":a.open,role:"button",class:i.normalizeClass(["vti__dropdown",{open:a.open,disabled:e.dropdownOptions.disabled}]),tabindex:e.dropdownOptions.tabindex,onKeydown:[n[2]||(n[2]=(...s)=>r.keyboardNav&&r.keyboardNav(...s)),n[4]||(n[4]=i.withKeys((...s)=>r.toggleDropdown&&r.toggleDropdown(...s),["space"])),n[5]||(n[5]=i.withKeys((...s)=>r.reset&&r.reset(...s),["esc"])),n[6]||(n[6]=i.withKeys((...s)=>r.reset&&r.reset(...s),["tab"]))],onClick:n[3]||(n[3]=(...s)=>r.toggleDropdown&&r.toggleDropdown(...s))},[i.createElementVNode("span",a1,[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",a.activeCountryCode.toLowerCase()])},null,2)):i.createCommentVNode("",!0),e.dropdownOptions.showDialCodeInSelection?(i.openBlock(),i.createElementBlock("span",l1," +"+i.toDisplayString(r.activeCountry&&r.activeCountry.dialCode),1)):i.createCommentVNode("",!0),i.renderSlot(t.$slots,"arrow-icon",{open:a.open},()=>[i.createElementVNode("span",s1,i.toDisplayString(a.open?"▲":"▼"),1)])]),a.open?(i.openBlock(),i.createElementBlock("ul",{key:0,ref:"list",class:i.normalizeClass(["vti__dropdown-list",a.dropdownOpenDirection]),role:"listbox"},[e.dropdownOptions.showSearchBox?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,class:"vti__input vti__search_box","aria-label":"Search by country name or country code",placeholder:r.sortedCountries.length?r.sortedCountries[0].name:"",type:"text","onUpdate:modelValue":n[0]||(n[0]=s=>a.searchQuery=s),onClick:n[1]||(n[1]=i.withModifiers(()=>{},["stop"]))},null,8,d1)),[[i.vModelText,a.searchQuery]]):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.sortedCountries,(s,c)=>(i.openBlock(),i.createElementBlock("li",{role:"option",class:i.normalizeClass(["vti__dropdown-item",r.getItemClass(c,s.iso2)]),key:s.iso2+(s.preferred?"-preferred":""),tabindex:"-1",onClick:h=>r.choose(s),onMousemove:h=>a.selectedIndex=c,"aria-selected":a.activeCountryCode===s.iso2&&!s.preferred},[e.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",s.iso2.toLowerCase()])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("strong",null,i.toDisplayString(s.name),1),e.dropdownOptions.showDialCodeInList?(i.openBlock(),i.createElementBlock("span",u1," +"+i.toDisplayString(s.dialCode),1)):i.createCommentVNode("",!0)],42,c1))),128))],2)):i.createCommentVNode("",!0)],42,o1)),[[l,r.clickedOutside]]),i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":n[7]||(n[7]=s=>a.phone=s),ref:"input",type:e.inputOptions.type,autocomplete:e.inputOptions.autocomplete,autofocus:e.inputOptions.autofocus,class:i.normalizeClass(["vti__input",e.inputOptions.styleClasses]),disabled:e.disabled,id:e.inputOptions.id,maxlength:e.inputOptions.maxlength,name:e.inputOptions.name,placeholder:a.parsedPlaceholder,readonly:e.inputOptions.readonly,required:e.inputOptions.required,tabindex:e.inputOptions.tabindex,value:e.modelValue,"aria-describedby":e.inputOptions["aria-describedby"],onBlur:n[8]||(n[8]=(...s)=>r.onBlur&&r.onBlur(...s)),onFocus:n[9]||(n[9]=(...s)=>r.onFocus&&r.onFocus(...s)),onInput:n[10]||(n[10]=(...s)=>r.onInput&&r.onInput(...s)),onKeyup:[n[11]||(n[11]=i.withKeys((...s)=>r.onEnter&&r.onEnter(...s),["enter"])),n[12]||(n[12]=i.withKeys((...s)=>r.onSpace&&r.onSpace(...s),["space"]))]},null,42,f1),[[i.vModelDynamic,a.phone]]),i.renderSlot(t.$slots,"icon-right")],2)}const p1=r1(i1,[["render",h1]]),gp="",yp="",m1={directives:{Outside:Xn},props:{modelValue:{type:String},value:String,inputName:{type:String,default:"phone"},autoDefaultCountry:{type:Boolean,default:!0},ignoredCountries:{type:Array,default:()=>[]},error:{type:Boolean,default:!1},errorMessage:{type:String,default:""}},emits:["update:modelValue"],components:{VueTelInput:p1,IbAlert:qt,IbIcon:Be},data(){return{vueTel:null,phone:"",dialCode:"",defaultCountry:"US"}},mounted(){this.vueTel=this.$refs.vueTel,this.value?this.phone=this.value[0]==="+"?this.value:"+"+this.value:this.modelValue&&(this.phone=this.modelValue[0]==="+"?this.modelValue:"+"+this.modelValue)},watch:{phone(t){this.$emit("update:modelValue",t)}},methods:{countryChanged(t){this.$globalEvents.$on("countrySelectValue",n=>{this.vueTel.choose(n)}),this.phone="+"+t.dialCode,this.dialCode=t.dialCode},clickOutside(){this.vueTel.open&&this.vueTel.clickedOutside()}}};function g1(t,n,e,o,a,r){const l=i.resolveComponent("ib-alert"),s=i.resolveComponent("ib-icon"),c=i.resolveComponent("vue-tel-input"),h=i.resolveDirective("outside");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.errorMessage.length?(i.openBlock(),i.createBlock(l,{key:0,class:"ib-phone-error-message"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(e.errorMessage),1)]),_:1})):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createBlock(c,i.mergeProps({modelValue:a.phone,"onUpdate:modelValue":n[0]||(n[0]=p=>a.phone=p)},t.$attrs,{onCountryChanged:r.countryChanged,"input-options":{name:e.inputName,id:e.inputName},"auto-default-country":e.autoDefaultCountry,"dropdown-options":{showSearchBox:!0,showFlags:!0},defaultCountry:a.defaultCountry,ignoredCountries:e.ignoredCountries,class:{error:e.error||e.errorMessage.length},"style-classes":"ib-phone-input",ref:"vueTel"}),{"arrow-icon":i.withCtx(()=>[i.createVNode(s,{name:"chevron-down-outline"})]),_:1},16,["modelValue","onCountryChanged","input-options","auto-default-country","defaultCountry","ignoredCountries","class"])),[[h,r.clickOutside]])],64)}const y1=_e(m1,[["render",g1]]);var ba={exports:{}};/*!
90
90
  * Quill Editor v1.3.7
91
91
  * https://quilljs.com/
92
92
  * Copyright (c) 2014, Jason Chen
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.0.505-alpha.50",
3
+ "version": "0.0.505-alpha.51",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
@@ -35,6 +35,7 @@ export default {
35
35
  modelValue: {
36
36
  type: String
37
37
  },
38
+ value: String,
38
39
  inputName: {
39
40
  type: String,
40
41
  default: "phone",
@@ -73,7 +74,9 @@ export default {
73
74
  mounted() {
74
75
  this.vueTel = this.$refs.vueTel;
75
76
 
76
- if (this.modelValue) {
77
+ if (this.value) {
78
+ this.phone = this.value[0] === "+" ? this.value : "+" + this.value;
79
+ } else if (this.modelValue) {
77
80
  this.phone = this.modelValue[0] === "+" ? this.modelValue : "+" + this.modelValue;
78
81
  }
79
82
  },