@quidgest/ui 0.18.0 → 0.20.0
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/CHANGELOG.md +89 -0
- package/dist/json/api.json +1328 -215
- package/dist/manifest/components.json +3 -1
- package/dist/ui.css +1448 -185
- package/dist/ui.esm.js +1448 -825
- package/dist/ui.js +1411 -788
- package/dist/ui.min.css +2 -1
- package/dist/ui.min.js +1411 -788
- package/dist/ui.scss +597 -157
- package/esm/components/QField/QField.d.ts.map +1 -1
- package/esm/components/QField/QField.vue.js +1 -1
- package/esm/components/QGrid/QCol.vue.js +1 -1
- package/esm/components/QInputGroup/QInputGroup.d.ts +147 -3
- package/esm/components/QInputGroup/QInputGroup.d.ts.map +1 -1
- package/esm/components/QInputGroup/QInputGroup.vue.js +32 -23
- package/esm/components/QInputGroup/index.d.ts +81 -4
- package/esm/components/QInputGroup/index.d.ts.map +1 -1
- package/esm/components/QList/QList.d.ts.map +1 -1
- package/esm/components/QList/QList.vue.js +3 -1
- package/esm/components/QList/QListItem.d.ts.map +1 -1
- package/esm/components/QList/QListItem.vue.js +24 -28
- package/esm/components/QList/types.d.ts +1 -1
- package/esm/components/QOverlay/types.d.ts +3 -1
- package/esm/components/QOverlay/types.d.ts.map +1 -1
- package/esm/components/QPhoneField/QPhoneField.d.ts +2263 -0
- package/esm/components/QPhoneField/QPhoneField.d.ts.map +1 -0
- package/esm/components/QPhoneField/QPhoneField.vue.js +478 -0
- package/esm/components/QPhoneField/QPhoneField2.vue.js +5 -0
- package/esm/components/QPhoneField/constants.d.ts +11 -0
- package/esm/components/QPhoneField/constants.d.ts.map +1 -0
- package/esm/components/QPhoneField/constants.js +14 -0
- package/esm/components/QPhoneField/index.d.ts +1253 -0
- package/esm/components/QPhoneField/index.d.ts.map +1 -0
- package/esm/components/QPhoneField/index.js +6 -0
- package/esm/components/QPhoneField/types.d.ts +108 -0
- package/esm/components/QPhoneField/types.d.ts.map +1 -0
- package/esm/components/{QGroupBox/QGroupBox.d.ts → QSection/QSection.d.ts} +4 -4
- package/esm/components/QSection/QSection.d.ts.map +1 -0
- package/esm/components/{QGroupBox/QGroupBox.vue.js → QSection/QSection.vue.js} +8 -8
- package/esm/components/QSection/QSection2.vue.js +5 -0
- package/esm/components/{QGroupBox → QSection}/index.d.ts +8 -8
- package/esm/components/QSection/index.d.ts.map +1 -0
- package/esm/components/QSection/index.js +6 -0
- package/esm/components/QSection/types.d.ts +32 -0
- package/esm/components/QSection/types.d.ts.map +1 -0
- package/esm/components/QSelect/QSelect.d.ts +16 -1
- package/esm/components/QSelect/QSelect.d.ts.map +1 -1
- package/esm/components/QSelect/QSelect.vue.js +158 -129
- package/esm/components/QSelect/index.d.ts +31 -3
- package/esm/components/QSelect/index.d.ts.map +1 -1
- package/esm/components/QSelect/types.d.ts +13 -0
- package/esm/components/QSelect/types.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebar.d.ts +53 -6
- package/esm/components/QSidebar/QSidebar.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebar.vue.js +76 -106
- package/esm/components/QSidebar/QSidebarAnchor.d.ts +24 -210
- package/esm/components/QSidebar/QSidebarAnchor.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebarAnchor.vue.js +47 -59
- package/esm/components/QSidebar/QSidebarItem.d.ts +213 -0
- package/esm/components/QSidebar/QSidebarItem.d.ts.map +1 -0
- package/esm/components/QSidebar/QSidebarItem.vue.js +130 -0
- package/esm/components/QSidebar/QSidebarItem2.vue.js +5 -0
- package/esm/components/QSidebar/QSidebarPanel.d.ts +1 -7
- package/esm/components/QSidebar/QSidebarPanel.d.ts.map +1 -1
- package/esm/components/QSidebar/QSidebarPanel.vue.js +4 -10
- package/esm/components/QSidebar/context.d.ts +108 -0
- package/esm/components/QSidebar/context.d.ts.map +1 -0
- package/esm/components/QSidebar/context.js +4 -0
- package/esm/components/QSidebar/index.d.ts +166 -8
- package/esm/components/QSidebar/index.d.ts.map +1 -1
- package/esm/components/QSidebar/index.js +3 -2
- package/esm/components/QSidebar/types.d.ts +77 -42
- package/esm/components/QSidebar/types.d.ts.map +1 -1
- package/esm/components/QTabs/QTab.d.ts +1 -0
- package/esm/components/QTabs/QTab.d.ts.map +1 -1
- package/esm/components/QTabs/QTab.vue.js +2 -1
- package/esm/components/QTabs/QTabs.d.ts +2 -0
- package/esm/components/QTabs/QTabs.d.ts.map +1 -1
- package/esm/components/QTabs/QTabs.vue.js +125 -46
- package/esm/components/QTabs/context.d.ts +10 -3
- package/esm/components/QTabs/context.d.ts.map +1 -1
- package/esm/components/QTabs/index.d.ts +2 -0
- package/esm/components/QTabs/index.d.ts.map +1 -1
- package/esm/components/QTabs/types.d.ts +3 -1
- package/esm/components/QTabs/types.d.ts.map +1 -1
- package/esm/components/index.d.ts +2 -1
- package/esm/components/index.d.ts.map +1 -1
- package/esm/components/index.js +48 -45
- package/esm/composables/useDialog/index.d.ts +2 -88
- package/esm/composables/useDialog/index.d.ts.map +1 -1
- package/esm/composables/useDialog/index.js +6 -6
- package/esm/composables/useDialog/types.d.ts +14 -4
- package/esm/composables/useDialog/types.d.ts.map +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/vendors/country-flag-icons/modules/countries.json.js +4 -0
- package/esm/vendors/country-flag-icons/modules/hasFlag.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouType.js +312 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +142 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +145 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +45 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeFormatter.js +258 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeFormatter.util.js +57 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeParser.js +242 -0
- package/esm/vendors/libphonenumber-js/es6/AsYouTypeState.js +115 -0
- package/esm/vendors/libphonenumber-js/es6/ParseError.js +116 -0
- package/esm/vendors/libphonenumber-js/es6/PhoneNumber.js +164 -0
- package/esm/vendors/libphonenumber-js/es6/constants.js +4 -0
- package/esm/vendors/libphonenumber-js/es6/format.js +77 -0
- package/esm/vendors/libphonenumber-js/es6/formatIncompletePhoneNumber.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/getCountries.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/getExampleNumber.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/RFC3966.js +9 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/checkNumberLength.js +21 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js +11 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extension/extractExtension.js +16 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +36 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +21 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js +18 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extractNationalNumber.js +27 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +27 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/extractPhoneContext.js +15 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +11 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/getCountryAndCallingCodeFromOneOfThem.js +13 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +12 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +43 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/getIddPrefix.js +10 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/getNumberType.js +61 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +14 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/isCallingCode.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/isCountryCode.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/isObject.js +7 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/isViablePhoneNumber.js +12 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/matchesEntirely.js +6 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/mergeArrays.js +39 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/parseDigits.js +82 -0
- package/esm/vendors/libphonenumber-js/es6/helpers/stripIddPrefix.js +18 -0
- package/esm/vendors/libphonenumber-js/es6/isPossible.js +32 -0
- package/esm/vendors/libphonenumber-js/es6/isValid.js +11 -0
- package/esm/vendors/libphonenumber-js/es6/metadata.js +474 -0
- package/esm/vendors/libphonenumber-js/es6/normalizeArguments.js +110 -0
- package/esm/vendors/libphonenumber-js/es6/parse.js +103 -0
- package/esm/vendors/libphonenumber-js/es6/parseIncompletePhoneNumber.js +48 -0
- package/esm/vendors/libphonenumber-js/es6/parsePhoneNumber.js +9 -0
- package/esm/vendors/libphonenumber-js/es6/parsePhoneNumberWithError_.js +58 -0
- package/esm/vendors/libphonenumber-js/es6/parsePhoneNumber_.js +66 -0
- package/esm/vendors/libphonenumber-js/es6/tools/semver-compare.js +14 -0
- package/esm/vendors/libphonenumber-js/examples.mobile.json.js +250 -0
- package/esm/vendors/libphonenumber-js/max/exports/AsYouType.js +9 -0
- package/esm/vendors/libphonenumber-js/max/exports/formatIncompletePhoneNumber.js +8 -0
- package/esm/vendors/libphonenumber-js/max/exports/getCountries.js +8 -0
- package/esm/vendors/libphonenumber-js/max/exports/getCountryCallingCode.js +8 -0
- package/esm/vendors/libphonenumber-js/max/exports/getExampleNumber.js +8 -0
- package/esm/vendors/libphonenumber-js/max/exports/isSupportedCountry.js +8 -0
- package/esm/vendors/libphonenumber-js/max/exports/parsePhoneNumber.js +8 -0
- package/esm/vendors/libphonenumber-js/max/exports/withMetadataArgument.js +8 -0
- package/esm/vendors/libphonenumber-js/metadata.max.json.js +10489 -0
- package/package.json +9 -6
- package/esm/components/QGroupBox/QGroupBox.d.ts.map +0 -1
- package/esm/components/QGroupBox/QGroupBox2.vue.js +0 -5
- package/esm/components/QGroupBox/index.d.ts.map +0 -1
- package/esm/components/QGroupBox/index.js +0 -6
- package/esm/components/QGroupBox/types.d.ts +0 -32
- package/esm/components/QGroupBox/types.d.ts.map +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { VALID_PUNCTUATION as e } from "./constants.js";
|
|
2
|
+
import t from "./helpers/parseDigits.js";
|
|
3
|
+
import n from "./helpers/applyInternationalSeparatorStyle.js";
|
|
4
|
+
import { FIRST_GROUP_PATTERN as r } from "./helpers/formatNationalNumberUsingFormat.js";
|
|
5
|
+
import { cutAndStripNonPairedParens as i, populateTemplateWithDigits as a, repeat as o } from "./AsYouTypeFormatter.util.js";
|
|
6
|
+
import s, { canFormatCompleteNumber as c } from "./AsYouTypeFormatter.complete.js";
|
|
7
|
+
import l from "./AsYouTypeFormatter.PatternMatcher.js";
|
|
8
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.13.7/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js
|
|
9
|
+
function u(e) {
|
|
10
|
+
"@babel/helpers - typeof";
|
|
11
|
+
return u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
12
|
+
return typeof e;
|
|
13
|
+
} : function(e) {
|
|
14
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
15
|
+
}, u(e);
|
|
16
|
+
}
|
|
17
|
+
function d(e, t) {
|
|
18
|
+
var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
19
|
+
if (n) return (n = n.call(e)).next.bind(n);
|
|
20
|
+
if (Array.isArray(e) || (n = f(e)) || t && e && typeof e.length == "number") {
|
|
21
|
+
n && (e = n);
|
|
22
|
+
var r = 0;
|
|
23
|
+
return function() {
|
|
24
|
+
return r >= e.length ? { done: !0 } : {
|
|
25
|
+
done: !1,
|
|
26
|
+
value: e[r++]
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
31
|
+
}
|
|
32
|
+
function f(e, t) {
|
|
33
|
+
if (e) {
|
|
34
|
+
if (typeof e == "string") return p(e, t);
|
|
35
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
36
|
+
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? p(e, t) : void 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function p(e, t) {
|
|
40
|
+
(t == null || t > e.length) && (t = e.length);
|
|
41
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
42
|
+
return r;
|
|
43
|
+
}
|
|
44
|
+
function m(e, t) {
|
|
45
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
46
|
+
}
|
|
47
|
+
function h(e, t) {
|
|
48
|
+
for (var n = 0; n < t.length; n++) {
|
|
49
|
+
var r = t[n];
|
|
50
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, _(r.key), r);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function g(e, t, n) {
|
|
54
|
+
return t && h(e.prototype, t), n && h(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
55
|
+
}
|
|
56
|
+
function _(e) {
|
|
57
|
+
var t = v(e, "string");
|
|
58
|
+
return u(t) == "symbol" ? t : t + "";
|
|
59
|
+
}
|
|
60
|
+
function v(e, t) {
|
|
61
|
+
if (u(e) != "object" || !e) return e;
|
|
62
|
+
var n = e[Symbol.toPrimitive];
|
|
63
|
+
if (n !== void 0) {
|
|
64
|
+
var r = n.call(e, t || "default");
|
|
65
|
+
if (u(r) != "object") return r;
|
|
66
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
67
|
+
}
|
|
68
|
+
return (t === "string" ? String : Number)(e);
|
|
69
|
+
}
|
|
70
|
+
var y = "9", b = o(y, 15), x = /[- ]/, S = !0, C = S && function() {
|
|
71
|
+
return /\[([^\[\]])*\]/g;
|
|
72
|
+
}, w = S && function() {
|
|
73
|
+
return /\d(?=[^,}][^,}])/g;
|
|
74
|
+
}, T = RegExp("[" + e + "]*\\$1[" + e + "]*(\\$\\d[" + e + "]*)*$"), E = 3, D = /*#__PURE__*/ function() {
|
|
75
|
+
function e(t) {
|
|
76
|
+
t.state;
|
|
77
|
+
var n = t.metadata;
|
|
78
|
+
m(this, e), this.metadata = n, this.resetFormat();
|
|
79
|
+
}
|
|
80
|
+
return g(e, [
|
|
81
|
+
{
|
|
82
|
+
key: "resetFormat",
|
|
83
|
+
value: function() {
|
|
84
|
+
this.chosenFormat = void 0, this.template = void 0, this.nationalNumberTemplate = void 0, this.populatedNationalNumberTemplate = void 0, this.populatedNationalNumberTemplatePosition = -1;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: "reset",
|
|
89
|
+
value: function(e, t) {
|
|
90
|
+
this.resetFormat(), e ? (this.isNANP = e.callingCode() === "1", this.matchingFormats = e.formats(), t.nationalSignificantNumber && this.narrowDownMatchingFormats(t)) : (this.isNANP = void 0, this.matchingFormats = []);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "format",
|
|
95
|
+
value: function(e, t) {
|
|
96
|
+
var n = this;
|
|
97
|
+
if (c(t.nationalSignificantNumber, this.metadata)) for (var r = d(this.matchingFormats), i; !(i = r()).done;) {
|
|
98
|
+
var a = i.value, o = s(t, a, {
|
|
99
|
+
metadata: this.metadata,
|
|
100
|
+
shouldTryNationalPrefixFormattingRule: function(e) {
|
|
101
|
+
return n.shouldTryNationalPrefixFormattingRule(e, {
|
|
102
|
+
international: t.international,
|
|
103
|
+
nationalPrefix: t.nationalPrefix
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
getSeparatorAfterNationalPrefix: function(e) {
|
|
107
|
+
return n.getSeparatorAfterNationalPrefix(e);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (o) return this.resetFormat(), this.chosenFormat = a, this.setNationalNumberTemplate(o.replace(/\d/g, "x"), t), this.populatedNationalNumberTemplate = o, this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf("x"), o;
|
|
111
|
+
}
|
|
112
|
+
return this.formatNationalNumberWithNextDigits(e, t);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "formatNationalNumberWithNextDigits",
|
|
117
|
+
value: function(e, t) {
|
|
118
|
+
var n = this.chosenFormat, r = this.chooseFormat(t);
|
|
119
|
+
if (r) return r === n ? this.formatNextNationalNumberDigits(e) : this.formatNextNationalNumberDigits(t.getNationalDigits());
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
key: "narrowDownMatchingFormats",
|
|
124
|
+
value: function(e) {
|
|
125
|
+
var t = this, n = e.nationalSignificantNumber, r = e.nationalPrefix, i = e.international, a = n, o = a.length - E;
|
|
126
|
+
o < 0 && (o = 0), this.matchingFormats = this.matchingFormats.filter(function(e) {
|
|
127
|
+
return t.formatSuits(e, i, r) && t.formatMatches(e, a, o);
|
|
128
|
+
}), this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1 && this.resetFormat();
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
key: "formatSuits",
|
|
133
|
+
value: function(e, t, n) {
|
|
134
|
+
return !(n && !e.usesNationalPrefix() && !e.nationalPrefixIsOptionalWhenFormattingInNationalFormat() || !t && !n && e.nationalPrefixIsMandatoryWhenFormattingInNationalFormat());
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
key: "formatMatches",
|
|
139
|
+
value: function(e, t, n) {
|
|
140
|
+
var r = e.leadingDigitsPatterns().length;
|
|
141
|
+
if (r === 0) return !0;
|
|
142
|
+
n = Math.min(n, r - 1);
|
|
143
|
+
var i = e.leadingDigitsPatterns()[n];
|
|
144
|
+
if (t.length < E) try {
|
|
145
|
+
return new l(i).match(t, { allowOverflow: !0 }) !== void 0;
|
|
146
|
+
} catch (e) /* istanbul ignore next */ {
|
|
147
|
+
return console.error(e), !0;
|
|
148
|
+
}
|
|
149
|
+
return RegExp(`^(${i})`).test(t);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: "getFormatFormat",
|
|
154
|
+
value: function(e, t) {
|
|
155
|
+
return t ? e.internationalFormat() : e.format();
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "chooseFormat",
|
|
160
|
+
value: function(e) {
|
|
161
|
+
/* istanbul ignore next */
|
|
162
|
+
for (var t = this, n = function() {
|
|
163
|
+
var n = a.value;
|
|
164
|
+
return t.chosenFormat === n ? 0 :
|
|
165
|
+
/* istanbul ignore if */
|
|
166
|
+
T.test(t.getFormatFormat(n, e.international)) ? t.createTemplateForFormat(n, e) ? (t.chosenFormat = n, 0) : (t.matchingFormats = t.matchingFormats.filter(function(e) {
|
|
167
|
+
return e !== n;
|
|
168
|
+
}), 1) : 1;
|
|
169
|
+
}, r, i = d(this.matchingFormats.slice()), a; !(a = i()).done && (r = n(), r !== 0););
|
|
170
|
+
return this.chosenFormat || this.resetFormat(), this.chosenFormat;
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
key: "createTemplateForFormat",
|
|
175
|
+
value: function(e, t) {
|
|
176
|
+
if (!(S && e.pattern().indexOf("|") >= 0)) {
|
|
177
|
+
var n = this.getTemplateForFormat(e, t);
|
|
178
|
+
if (n) return this.setNationalNumberTemplate(n, t), !0;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
key: "getSeparatorAfterNationalPrefix",
|
|
184
|
+
value: function(e) {
|
|
185
|
+
return this.isNANP || e && e.nationalPrefixFormattingRule() && x.test(e.nationalPrefixFormattingRule()) ? " " : "";
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
190
|
+
value: function(e, t) {
|
|
191
|
+
var n = e.IDDPrefix, r = e.missingPlus;
|
|
192
|
+
return n ? t && t.spacing === !1 ? n : n + " " : r ? "" : "+";
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
key: "getTemplate",
|
|
197
|
+
value: function(e) {
|
|
198
|
+
if (this.template) {
|
|
199
|
+
for (var t = -1, n = 0, r = e.international ? this.getInternationalPrefixBeforeCountryCallingCode(e, { spacing: !1 }) : ""; n < r.length + e.getDigitsWithoutInternationalPrefix().length;) t = this.template.indexOf("x", t + 1), n++;
|
|
200
|
+
return i(this.template, t + 1);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
key: "setNationalNumberTemplate",
|
|
206
|
+
value: function(e, t) {
|
|
207
|
+
this.nationalNumberTemplate = e, this.populatedNationalNumberTemplate = e, this.populatedNationalNumberTemplatePosition = -1, t.international ? this.template = this.getInternationalPrefixBeforeCountryCallingCode(t).replace(/[\d\+]/g, "x") + o("x", t.callingCode.length) + " " + e : this.template = e;
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
key: "getTemplateForFormat",
|
|
212
|
+
value: function(e, i) {
|
|
213
|
+
var a = i.nationalSignificantNumber, s = i.international, c = i.nationalPrefix, l = i.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, u = e.pattern();
|
|
214
|
+
/* istanbul ignore else */
|
|
215
|
+
S && (u = u.replace(C(), "\\d").replace(w(), "\\d"));
|
|
216
|
+
var d = b.match(u)[0];
|
|
217
|
+
if (!(a.length > d.length)) {
|
|
218
|
+
var f = RegExp("^" + u + "$"), p = a.replace(/\d/g, y);
|
|
219
|
+
f.test(p) && (d = p);
|
|
220
|
+
var m = this.getFormatFormat(e, s), h;
|
|
221
|
+
if (this.shouldTryNationalPrefixFormattingRule(e, {
|
|
222
|
+
international: s,
|
|
223
|
+
nationalPrefix: c
|
|
224
|
+
})) {
|
|
225
|
+
var g = m.replace(r, e.nationalPrefixFormattingRule());
|
|
226
|
+
/* istanbul ignore else */
|
|
227
|
+
if (t(e.nationalPrefixFormattingRule()) === (c || "") + t("$1") && (m = g, h = !0, c)) for (var _ = c.length; _ > 0;) m = m.replace(/\d/, "x"), _--;
|
|
228
|
+
}
|
|
229
|
+
var v = d.replace(new RegExp(u), m).replace(new RegExp(y, "g"), "x");
|
|
230
|
+
return h || (l ? v = o("x", l.length) + " " + v : c && (v = o("x", c.length) + this.getSeparatorAfterNationalPrefix(e) + v)), s && (v = n(v)), v;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
key: "formatNextNationalNumberDigits",
|
|
236
|
+
value: function(e) {
|
|
237
|
+
var t = a(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, e);
|
|
238
|
+
if (!t) {
|
|
239
|
+
this.resetFormat();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
return this.populatedNationalNumberTemplate = t[0], this.populatedNationalNumberTemplatePosition = t[1], i(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
key: "shouldTryNationalPrefixFormattingRule",
|
|
247
|
+
value: function(e, t) {
|
|
248
|
+
var n = t.international, r = t.nationalPrefix;
|
|
249
|
+
if (e.nationalPrefixFormattingRule()) {
|
|
250
|
+
var i = e.usesNationalPrefix();
|
|
251
|
+
if (i && r || !i && !n) return !0;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
]);
|
|
256
|
+
}();
|
|
257
|
+
//#endregion
|
|
258
|
+
export { D as default };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.13.7/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js
|
|
2
|
+
function e(e, n) {
|
|
3
|
+
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
4
|
+
if (r) return (r = r.call(e)).next.bind(r);
|
|
5
|
+
if (Array.isArray(e) || (r = t(e)) || n && e && typeof e.length == "number") {
|
|
6
|
+
r && (e = r);
|
|
7
|
+
var i = 0;
|
|
8
|
+
return function() {
|
|
9
|
+
return i >= e.length ? { done: !0 } : {
|
|
10
|
+
done: !1,
|
|
11
|
+
value: e[i++]
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
16
|
+
}
|
|
17
|
+
function t(e, t) {
|
|
18
|
+
if (e) {
|
|
19
|
+
if (typeof e == "string") return n(e, t);
|
|
20
|
+
var r = {}.toString.call(e).slice(8, -1);
|
|
21
|
+
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(e, t) : void 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function n(e, t) {
|
|
25
|
+
(t == null || t > e.length) && (t = e.length);
|
|
26
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
27
|
+
return r;
|
|
28
|
+
}
|
|
29
|
+
var r = /* @__PURE__ */ RegExp("x");
|
|
30
|
+
function i(e, t) {
|
|
31
|
+
if (t < 1) return "";
|
|
32
|
+
for (var n = ""; t > 1;) t & 1 && (n += e), t >>= 1, e += e;
|
|
33
|
+
return n + e;
|
|
34
|
+
}
|
|
35
|
+
function a(e, t) {
|
|
36
|
+
return e[t] === ")" && t++, o(e.slice(0, t));
|
|
37
|
+
}
|
|
38
|
+
function o(e) {
|
|
39
|
+
for (var t = [], n = 0; n < e.length;) e[n] === "(" ? t.push(n) : e[n] === ")" && t.pop(), n++;
|
|
40
|
+
var r = 0, i = "";
|
|
41
|
+
t.push(e.length);
|
|
42
|
+
for (var a = 0, o = t; a < o.length; a++) {
|
|
43
|
+
var s = o[a];
|
|
44
|
+
i += e.slice(r, s), r = s + 1;
|
|
45
|
+
}
|
|
46
|
+
return i;
|
|
47
|
+
}
|
|
48
|
+
function s(t, n, i) {
|
|
49
|
+
for (var a = e(i.split("")), o; !(o = a()).done;) {
|
|
50
|
+
var s = o.value;
|
|
51
|
+
if (t.slice(n + 1).search(r) < 0) return;
|
|
52
|
+
n = t.search(r), t = t.replace(r, s);
|
|
53
|
+
}
|
|
54
|
+
return [t, n];
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { a as cutAndStripNonPairedParens, s as populateTemplateWithDigits, i as repeat, o as stripNonPairedParens };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { PLUS_CHARS as e, VALID_DIGITS as t, VALID_PUNCTUATION as n } from "./constants.js";
|
|
2
|
+
import r from "./helpers/parseDigits.js";
|
|
3
|
+
import i from "./helpers/stripIddPrefix.js";
|
|
4
|
+
import a from "./helpers/extractNationalNumberFromPossiblyIncompleteNumber.js";
|
|
5
|
+
import o from "./helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js";
|
|
6
|
+
import s from "./helpers/extractCountryCallingCode.js";
|
|
7
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.13.7/node_modules/libphonenumber-js/es6/AsYouTypeParser.js
|
|
8
|
+
function c(e) {
|
|
9
|
+
"@babel/helpers - typeof";
|
|
10
|
+
return c = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
11
|
+
return typeof e;
|
|
12
|
+
} : function(e) {
|
|
13
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
14
|
+
}, c(e);
|
|
15
|
+
}
|
|
16
|
+
function l(e, t) {
|
|
17
|
+
return m(e) || p(e, t) || d(e, t) || u();
|
|
18
|
+
}
|
|
19
|
+
function u() {
|
|
20
|
+
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21
|
+
}
|
|
22
|
+
function d(e, t) {
|
|
23
|
+
if (e) {
|
|
24
|
+
if (typeof e == "string") return f(e, t);
|
|
25
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
26
|
+
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? f(e, t) : void 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function f(e, t) {
|
|
30
|
+
(t == null || t > e.length) && (t = e.length);
|
|
31
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
32
|
+
return r;
|
|
33
|
+
}
|
|
34
|
+
function p(e, t) {
|
|
35
|
+
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
36
|
+
if (n != null) {
|
|
37
|
+
var r, i, a, o, s = [], c = !0, l = !1;
|
|
38
|
+
try {
|
|
39
|
+
if (a = (n = n.call(e)).next, t === 0) {
|
|
40
|
+
if (Object(n) !== n) return;
|
|
41
|
+
c = !1;
|
|
42
|
+
} else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
l = !0, i = e;
|
|
45
|
+
} finally {
|
|
46
|
+
try {
|
|
47
|
+
if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
48
|
+
} finally {
|
|
49
|
+
if (l) throw i;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return s;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function m(e) {
|
|
56
|
+
if (Array.isArray(e)) return e;
|
|
57
|
+
}
|
|
58
|
+
function h(e, t) {
|
|
59
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
60
|
+
}
|
|
61
|
+
function g(e, t) {
|
|
62
|
+
for (var n = 0; n < t.length; n++) {
|
|
63
|
+
var r = t[n];
|
|
64
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, v(r.key), r);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function _(e, t, n) {
|
|
68
|
+
return t && g(e.prototype, t), n && g(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
69
|
+
}
|
|
70
|
+
function v(e) {
|
|
71
|
+
var t = y(e, "string");
|
|
72
|
+
return c(t) == "symbol" ? t : t + "";
|
|
73
|
+
}
|
|
74
|
+
function y(e, t) {
|
|
75
|
+
if (c(e) != "object" || !e) return e;
|
|
76
|
+
var n = e[Symbol.toPrimitive];
|
|
77
|
+
if (n !== void 0) {
|
|
78
|
+
var r = n.call(e, t || "default");
|
|
79
|
+
if (c(r) != "object") return r;
|
|
80
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
81
|
+
}
|
|
82
|
+
return (t === "string" ? String : Number)(e);
|
|
83
|
+
}
|
|
84
|
+
var b = "[" + n + t + "]+", x = RegExp("^" + b + "$", "i"), S = "(?:[" + e + "][" + n + t + "]*|[" + n + t + "]+)", C = RegExp("[^" + n + t + "]+.*$"), w = /[^\d\[\]]/, T = /*#__PURE__*/ function() {
|
|
85
|
+
function e(t) {
|
|
86
|
+
var n = t.defaultCountry, r = t.defaultCallingCode, i = t.metadata, a = t.onNationalSignificantNumberChange;
|
|
87
|
+
h(this, e), this.defaultCountry = n, this.defaultCallingCode = r, this.metadata = i, this.onNationalSignificantNumberChange = a;
|
|
88
|
+
}
|
|
89
|
+
return _(e, [
|
|
90
|
+
{
|
|
91
|
+
key: "input",
|
|
92
|
+
value: function(e, t) {
|
|
93
|
+
var n = l(O(e), 2), i = n[0], a = n[1], o = r(i), s;
|
|
94
|
+
return a && (t.digits || (t.startInternationalNumber(void 0, void 0), o || (s = !0))), o && this.inputDigits(o, t), {
|
|
95
|
+
digits: o,
|
|
96
|
+
justLeadingPlus: s
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "inputDigits",
|
|
102
|
+
value: function(e, t) {
|
|
103
|
+
var n = t.digits, r = n.length < 3 && n.length + e.length >= 3;
|
|
104
|
+
if (t.appendDigits(e), r && this.extractIddPrefix(t), this.isWaitingForCountryCallingCode(t)) {
|
|
105
|
+
if (!this.extractCountryCallingCode(t)) return;
|
|
106
|
+
} else t.appendNationalSignificantNumberDigits(e);
|
|
107
|
+
t.international || this.hasExtractedNationalSignificantNumber || this.extractNationalSignificantNumber(t.getNationalDigits(), function(e) {
|
|
108
|
+
return t.update(e);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: "isWaitingForCountryCallingCode",
|
|
114
|
+
value: function(e) {
|
|
115
|
+
var t = e.international, n = e.callingCode;
|
|
116
|
+
return t && !n;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
key: "extractCountryCallingCode",
|
|
121
|
+
value: function(e) {
|
|
122
|
+
var t = s("+" + e.getDigitsWithoutInternationalPrefix(), e.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata), n = t.countryCallingCode, r = t.number;
|
|
123
|
+
if (n) return e.setCallingCode(n), e.update({ nationalSignificantNumber: r }), !0;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: "reset",
|
|
128
|
+
value: function(e) {
|
|
129
|
+
if (e) {
|
|
130
|
+
this.hasSelectedNumberingPlan = !0;
|
|
131
|
+
var t = e._nationalPrefixForParsing();
|
|
132
|
+
this.couldPossiblyExtractAnotherNationalSignificantNumber = t && w.test(t);
|
|
133
|
+
} else this.hasSelectedNumberingPlan = void 0, this.couldPossiblyExtractAnotherNationalSignificantNumber = void 0;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: "extractNationalSignificantNumber",
|
|
138
|
+
value: function(e, t) {
|
|
139
|
+
if (this.hasSelectedNumberingPlan) {
|
|
140
|
+
var n = a(e, this.metadata), r = n.nationalPrefix, i = n.nationalNumber, o = n.carrierCode;
|
|
141
|
+
if (i !== e) return this.onExtractedNationalNumber(r, o, i, e, t), !0;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: "extractAnotherNationalSignificantNumber",
|
|
147
|
+
value: function(e, t, n) {
|
|
148
|
+
if (!this.hasExtractedNationalSignificantNumber) return this.extractNationalSignificantNumber(e, n);
|
|
149
|
+
if (this.couldPossiblyExtractAnotherNationalSignificantNumber) {
|
|
150
|
+
var r = a(e, this.metadata), i = r.nationalPrefix, o = r.nationalNumber, s = r.carrierCode;
|
|
151
|
+
if (o !== t) return this.onExtractedNationalNumber(i, s, o, e, n), !0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
key: "onExtractedNationalNumber",
|
|
157
|
+
value: function(e, t, n, r, i) {
|
|
158
|
+
var a = !1, o, s = r.lastIndexOf(n);
|
|
159
|
+
if (s < 0 || s !== r.length - n.length) a = !0;
|
|
160
|
+
else {
|
|
161
|
+
var c = r.slice(0, s);
|
|
162
|
+
/* istanbul ignore if */
|
|
163
|
+
c && c !== e && (o = c);
|
|
164
|
+
}
|
|
165
|
+
i({
|
|
166
|
+
nationalPrefix: e,
|
|
167
|
+
carrierCode: t,
|
|
168
|
+
nationalSignificantNumber: n,
|
|
169
|
+
nationalSignificantNumberIsModified: a,
|
|
170
|
+
prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix: o
|
|
171
|
+
}), this.hasExtractedNationalSignificantNumber = !0, this.onNationalSignificantNumberChange();
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
key: "reExtractNationalSignificantNumber",
|
|
176
|
+
value: function(e) {
|
|
177
|
+
if (this.extractAnotherNationalSignificantNumber(e.getNationalDigits(), e.nationalSignificantNumber, function(t) {
|
|
178
|
+
return e.update(t);
|
|
179
|
+
})) return !0;
|
|
180
|
+
if (this.extractIddPrefix(e) || this.fixMissingPlus(e)) return this.extractCallingCodeAndNationalSignificantNumber(e), !0;
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "extractIddPrefix",
|
|
185
|
+
value: function(e) {
|
|
186
|
+
var t = e.international, n = e.IDDPrefix, r = e.digits;
|
|
187
|
+
if (e.nationalSignificantNumber, !(t || n)) {
|
|
188
|
+
var a = i(r, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);
|
|
189
|
+
if (a !== void 0 && a !== r) return e.update({ IDDPrefix: r.slice(0, r.length - a.length) }), this.startInternationalNumber(e, {
|
|
190
|
+
country: void 0,
|
|
191
|
+
callingCode: void 0
|
|
192
|
+
}), !0;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: "fixMissingPlus",
|
|
198
|
+
value: function(e) {
|
|
199
|
+
if (!e.international) {
|
|
200
|
+
var t = o(e.digits, e.country, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata).countryCallingCode;
|
|
201
|
+
if (t) return e.update({ missingPlus: !0 }), this.startInternationalNumber(e, {
|
|
202
|
+
country: e.country,
|
|
203
|
+
callingCode: t
|
|
204
|
+
}), !0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
key: "startInternationalNumber",
|
|
210
|
+
value: function(e, t) {
|
|
211
|
+
var n = t.country, r = t.callingCode;
|
|
212
|
+
e.startInternationalNumber(n, r), e.nationalSignificantNumber && (e.resetNationalSignificantNumber(), this.onNationalSignificantNumberChange(), this.hasExtractedNationalSignificantNumber = void 0);
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
key: "extractCallingCodeAndNationalSignificantNumber",
|
|
217
|
+
value: function(e) {
|
|
218
|
+
this.extractCountryCallingCode(e) && this.extractNationalSignificantNumber(e.getNationalDigits(), function(t) {
|
|
219
|
+
return e.update(t);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
]);
|
|
224
|
+
}();
|
|
225
|
+
function E(e) {
|
|
226
|
+
var t = e.search(S);
|
|
227
|
+
if (!(t < 0)) {
|
|
228
|
+
e = e.slice(t);
|
|
229
|
+
var n;
|
|
230
|
+
return e[0] === "+" && (n = !0, e = e.slice(1)), e = e.replace(C, ""), n && (e = "+" + e), e;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function D(e) {
|
|
234
|
+
var t = E(e) || "";
|
|
235
|
+
return t[0] === "+" ? [t.slice(1), !0] : [t];
|
|
236
|
+
}
|
|
237
|
+
function O(e) {
|
|
238
|
+
var t = l(D(e), 2), n = t[0], r = t[1];
|
|
239
|
+
return x.test(n) || (n = ""), [n, r];
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
242
|
+
export { T as default, O as extractFormattedDigitsAndPlus };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/libphonenumber-js@1.13.7/node_modules/libphonenumber-js/es6/AsYouTypeState.js
|
|
2
|
+
function e(t) {
|
|
3
|
+
"@babel/helpers - typeof";
|
|
4
|
+
return e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
5
|
+
return typeof e;
|
|
6
|
+
} : function(e) {
|
|
7
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
8
|
+
}, e(t);
|
|
9
|
+
}
|
|
10
|
+
function t(e, t) {
|
|
11
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
12
|
+
}
|
|
13
|
+
function n(e, t) {
|
|
14
|
+
for (var n = 0; n < t.length; n++) {
|
|
15
|
+
var r = t[n];
|
|
16
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, i(r.key), r);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function r(e, t, r) {
|
|
20
|
+
return t && n(e.prototype, t), r && n(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
21
|
+
}
|
|
22
|
+
function i(t) {
|
|
23
|
+
var n = a(t, "string");
|
|
24
|
+
return e(n) == "symbol" ? n : n + "";
|
|
25
|
+
}
|
|
26
|
+
function a(t, n) {
|
|
27
|
+
if (e(t) != "object" || !t) return t;
|
|
28
|
+
var r = t[Symbol.toPrimitive];
|
|
29
|
+
if (r !== void 0) {
|
|
30
|
+
var i = r.call(t, n || "default");
|
|
31
|
+
if (e(i) != "object") return i;
|
|
32
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
33
|
+
}
|
|
34
|
+
return (n === "string" ? String : Number)(t);
|
|
35
|
+
}
|
|
36
|
+
var o = /*#__PURE__*/ function() {
|
|
37
|
+
function e(n) {
|
|
38
|
+
var r = n.onCountryChange, i = n.onCallingCodeChange;
|
|
39
|
+
t(this, e), this.onCountryChange = r, this.onCallingCodeChange = i;
|
|
40
|
+
}
|
|
41
|
+
return r(e, [
|
|
42
|
+
{
|
|
43
|
+
key: "reset",
|
|
44
|
+
value: function(e) {
|
|
45
|
+
var t = e.country, n = e.callingCode;
|
|
46
|
+
this.international = !1, this.missingPlus = !1, this.IDDPrefix = void 0, this.callingCode = void 0, this.digits = "", this.resetNationalSignificantNumber(), this.initCountryAndCallingCode(t, n);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: "resetNationalSignificantNumber",
|
|
51
|
+
value: function() {
|
|
52
|
+
this.nationalSignificantNumber = this.getNationalDigits(), this.nationalSignificantNumberIsModified = !1, this.nationalPrefix = void 0, this.carrierCode = void 0, this.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix = void 0;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "update",
|
|
57
|
+
value: function(e) {
|
|
58
|
+
for (var t = 0, n = Object.keys(e); t < n.length; t++) {
|
|
59
|
+
var r = n[t];
|
|
60
|
+
this[r] = e[r];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "initCountryAndCallingCode",
|
|
66
|
+
value: function(e, t) {
|
|
67
|
+
this.setCountry(e), this.setCallingCode(t);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "setCountry",
|
|
72
|
+
value: function(e) {
|
|
73
|
+
this.country = e, this.onCountryChange(e);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: "setCallingCode",
|
|
78
|
+
value: function(e) {
|
|
79
|
+
this.callingCode = e, this.onCallingCodeChange(e, this.country);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: "startInternationalNumber",
|
|
84
|
+
value: function(e, t) {
|
|
85
|
+
this.international = !0, this.initCountryAndCallingCode(e, t);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: "appendDigits",
|
|
90
|
+
value: function(e) {
|
|
91
|
+
this.digits += e;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "appendNationalSignificantNumberDigits",
|
|
96
|
+
value: function(e) {
|
|
97
|
+
this.nationalSignificantNumber += e;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "getNationalDigits",
|
|
102
|
+
value: function() {
|
|
103
|
+
return this.international ? this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0)) : this.digits;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "getDigitsWithoutInternationalPrefix",
|
|
108
|
+
value: function() {
|
|
109
|
+
return this.international && this.IDDPrefix ? this.digits.slice(this.IDDPrefix.length) : this.digits;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]);
|
|
113
|
+
}();
|
|
114
|
+
//#endregion
|
|
115
|
+
export { o as default };
|