intl-tel-input 26.0.0-beta.1 → 26.0.2
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/README.md +29 -26
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +16 -6
- package/angular/build/IntlTelInputWithUtils.js +140 -191
- package/angular/build/types/intl-tel-input/i18n/index.d.ts +1 -0
- package/angular/build/types/intl-tel-input/i18n/zh-hk/index.d.ts +3 -0
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/i18n/ar/countries.js +245 -0
- package/build/js/i18n/ar/index.js +1 -0
- package/build/js/i18n/ar/interface.js +23 -0
- package/build/js/i18n/bg/countries.js +245 -0
- package/build/js/i18n/bg/index.js +1 -0
- package/build/js/i18n/bg/interface.js +13 -0
- package/build/js/i18n/bn/countries.js +245 -0
- package/build/js/i18n/bn/index.js +1 -0
- package/build/js/i18n/bn/interface.js +13 -0
- package/build/js/i18n/bs/countries.js +245 -0
- package/build/js/i18n/bs/index.js +1 -0
- package/build/js/i18n/bs/interface.js +20 -0
- package/build/js/i18n/ca/countries.js +245 -0
- package/build/js/i18n/ca/index.js +1 -0
- package/build/js/i18n/ca/interface.js +13 -0
- package/build/js/i18n/cs/countries.js +245 -0
- package/build/js/i18n/cs/index.js +1 -0
- package/build/js/i18n/cs/interface.js +20 -0
- package/build/js/i18n/da/countries.js +245 -0
- package/build/js/i18n/da/index.js +1 -0
- package/build/js/i18n/da/interface.js +13 -0
- package/build/js/i18n/de/countries.js +245 -0
- package/build/js/i18n/de/index.js +1 -0
- package/build/js/i18n/de/interface.js +13 -0
- package/build/js/i18n/ee/countries.js +245 -0
- package/build/js/i18n/ee/index.js +1 -0
- package/build/js/i18n/ee/interface.js +13 -0
- package/build/js/i18n/el/countries.js +245 -0
- package/build/js/i18n/el/index.js +1 -0
- package/build/js/i18n/el/interface.js +13 -0
- package/build/js/i18n/en/countries.js +245 -0
- package/build/js/i18n/en/interface.js +14 -0
- package/build/js/i18n/es/countries.js +245 -0
- package/build/js/i18n/es/index.js +1 -0
- package/build/js/i18n/es/interface.js +13 -0
- package/build/js/i18n/fa/countries.js +245 -0
- package/build/js/i18n/fa/index.js +1 -0
- package/build/js/i18n/fa/interface.js +13 -0
- package/build/js/i18n/fi/countries.js +245 -0
- package/build/js/i18n/fi/index.js +1 -0
- package/build/js/i18n/fi/interface.js +13 -0
- package/build/js/i18n/fr/countries.js +245 -0
- package/build/js/i18n/fr/index.js +1 -0
- package/build/js/i18n/fr/interface.js +13 -0
- package/build/js/i18n/hi/countries.js +245 -0
- package/build/js/i18n/hi/index.js +1 -0
- package/build/js/i18n/hi/interface.js +13 -0
- package/build/js/i18n/hr/countries.js +245 -0
- package/build/js/i18n/hr/index.js +1 -0
- package/build/js/i18n/hr/interface.js +20 -0
- package/build/js/i18n/hu/countries.js +245 -0
- package/build/js/i18n/hu/index.js +1 -0
- package/build/js/i18n/hu/interface.js +13 -0
- package/build/js/i18n/id/countries.js +245 -0
- package/build/js/i18n/id/index.js +1 -0
- package/build/js/i18n/id/interface.js +13 -0
- package/build/js/i18n/index.js +1 -0
- package/build/js/i18n/it/countries.js +245 -0
- package/build/js/i18n/it/index.js +1 -0
- package/build/js/i18n/it/interface.js +13 -0
- package/build/js/i18n/ja/countries.js +245 -0
- package/build/js/i18n/ja/index.js +1 -0
- package/build/js/i18n/ja/interface.js +13 -0
- package/build/js/i18n/ko/countries.js +245 -0
- package/build/js/i18n/ko/index.js +1 -0
- package/build/js/i18n/ko/interface.js +13 -0
- package/build/js/i18n/lt/countries.js +245 -0
- package/build/js/i18n/lt/interface.js +26 -0
- package/build/js/i18n/mr/countries.js +245 -0
- package/build/js/i18n/mr/index.js +1 -0
- package/build/js/i18n/mr/interface.js +13 -0
- package/build/js/i18n/nl/countries.js +245 -0
- package/build/js/i18n/nl/index.js +1 -0
- package/build/js/i18n/nl/interface.js +13 -0
- package/build/js/i18n/no/countries.js +245 -0
- package/build/js/i18n/no/index.js +1 -0
- package/build/js/i18n/no/interface.js +13 -0
- package/build/js/i18n/pl/countries.js +245 -0
- package/build/js/i18n/pl/index.js +1 -0
- package/build/js/i18n/pl/interface.js +19 -0
- package/build/js/i18n/pt/countries.js +245 -0
- package/build/js/i18n/pt/index.js +1 -0
- package/build/js/i18n/pt/interface.js +13 -0
- package/build/js/i18n/ro/countries.js +245 -0
- package/build/js/i18n/ro/index.js +1 -0
- package/build/js/i18n/ro/interface.js +18 -0
- package/build/js/i18n/ru/countries.js +245 -0
- package/build/js/i18n/ru/index.js +1 -0
- package/build/js/i18n/ru/interface.js +20 -0
- package/build/js/i18n/sk/countries.js +245 -0
- package/build/js/i18n/sk/index.js +1 -0
- package/build/js/i18n/sk/interface.js +20 -0
- package/build/js/i18n/sl/countries.js +245 -0
- package/build/js/i18n/sl/interface.js +25 -0
- package/build/js/i18n/sq/countries.js +245 -0
- package/build/js/i18n/sq/interface.js +14 -0
- package/build/js/i18n/sr/countries.js +245 -0
- package/build/js/i18n/sr/interface.js +21 -0
- package/build/js/i18n/sv/countries.js +245 -0
- package/build/js/i18n/sv/index.js +1 -0
- package/build/js/i18n/sv/interface.js +13 -0
- package/build/js/i18n/te/countries.js +245 -0
- package/build/js/i18n/te/index.js +1 -0
- package/build/js/i18n/te/interface.js +13 -0
- package/build/js/i18n/th/countries.js +245 -0
- package/build/js/i18n/th/index.js +1 -0
- package/build/js/i18n/th/interface.js +13 -0
- package/build/js/i18n/tr/countries.js +245 -0
- package/build/js/i18n/tr/index.js +1 -0
- package/build/js/i18n/tr/interface.js +13 -0
- package/build/js/i18n/uk/countries.js +245 -0
- package/build/js/i18n/uk/index.js +1 -0
- package/build/js/i18n/uk/interface.js +20 -0
- package/build/js/i18n/ur/countries.js +245 -0
- package/build/js/i18n/ur/index.js +1 -0
- package/build/js/i18n/ur/interface.js +13 -0
- package/build/js/i18n/uz/countries.js +245 -0
- package/build/js/i18n/uz/index.js +1 -0
- package/build/js/i18n/uz/interface.js +13 -0
- package/build/js/i18n/vi/countries.js +245 -0
- package/build/js/i18n/vi/index.js +1 -0
- package/build/js/i18n/vi/interface.js +13 -0
- package/build/js/i18n/zh/countries.js +245 -0
- package/build/js/i18n/zh/index.js +1 -0
- package/build/js/i18n/zh/interface.js +13 -0
- package/build/js/i18n/zh-hk/countries.js +245 -0
- package/build/js/i18n/zh-hk/index.js +18 -0
- package/build/js/i18n/zh-hk/interface.js +14 -0
- package/build/js/intlTelInput.d.ts +6 -0
- package/build/js/intlTelInput.js +17 -7
- package/build/js/intlTelInput.min.js +3 -3
- package/build/js/intlTelInputWithUtils.js +141 -192
- package/build/js/intlTelInputWithUtils.min.js +3 -3
- package/build/js/utils.js +53 -54
- package/package.json +2 -2
- package/react/README.md +4 -2
- package/react/build/IntlTelInput.cjs +16 -6
- package/react/build/IntlTelInput.d.ts +6 -0
- package/react/build/IntlTelInput.js +16 -6
- package/react/build/IntlTelInputWithUtils.cjs +140 -191
- package/react/build/IntlTelInputWithUtils.js +140 -191
- package/svelte/README.md +7 -9
- package/svelte/build/IntlTelInput.mjs +1446 -1440
- package/svelte/build/IntlTelInputWithUtils.mjs +1795 -1850
- package/vue/README.md +12 -10
- package/vue/build/IntlTelInput.vue.d.ts +2 -0
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +2 -0
- package/vue/build/exports/IntlTelInput.mjs +17 -16
- package/vue/build/exports/IntlTelInputWithUtils.mjs +176 -236
- package/vue/build/intl-tel-input/i18n/index.d.ts +1 -0
- package/vue/build/intl-tel-input/i18n/zh-hk/index.d.ts +3 -0
- package/vue/build/{intl-tel-input-f0-6rrpA.mjs → intl-tel-input-DYFK-Vt4.mjs} +12 -6
|
@@ -1,222 +1,235 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Se = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var Fn = Object.defineProperty;
|
|
2
|
+
var Se = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
import { onMount as
|
|
9
|
-
const
|
|
5
|
+
var Bn = (t, e, n) => e in t ? Fn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
6
|
+
var tt = (t, e, n) => Bn(t, typeof e != "symbol" ? e + "" : e, n), te = (t, e, n) => e.has(t) || Se("Cannot " + n);
|
|
7
|
+
var L = (t, e, n) => (te(t, e, "read from private field"), n ? n.call(t) : e.get(t)), Z = (t, e, n) => e.has(t) ? Se("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), mt = (t, e, n, i) => (te(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n), lt = (t, e, n) => (te(t, e, "access private method"), n);
|
|
8
|
+
import { onMount as Vn, onDestroy as Wn } from "svelte";
|
|
9
|
+
const jn = "5";
|
|
10
10
|
var $e;
|
|
11
|
-
typeof window < "u" && (($e = window.__svelte ?? (window.__svelte = {})).v ?? ($e.v = /* @__PURE__ */ new Set())).add(
|
|
12
|
-
const
|
|
13
|
-
var Xe = Array.isArray,
|
|
14
|
-
function
|
|
15
|
-
for (var
|
|
16
|
-
e
|
|
11
|
+
typeof window < "u" && (($e = window.__svelte ?? (window.__svelte = {})).v ?? ($e.v = /* @__PURE__ */ new Set())).add(jn);
|
|
12
|
+
const Gn = 1, Yn = 4, Kn = 8, zn = 16, qn = 2, P = Symbol(), $n = "http://www.w3.org/1999/xhtml", Xn = "@attach", ce = !1;
|
|
13
|
+
var Xe = Array.isArray, Qn = Array.prototype.indexOf, Zn = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Jn = Object.getOwnPropertyDescriptors, ti = Object.prototype, ei = Array.prototype, Qe = Object.getPrototypeOf;
|
|
14
|
+
function ni(t) {
|
|
15
|
+
for (var e = 0; e < t.length; e++)
|
|
16
|
+
t[e]();
|
|
17
17
|
}
|
|
18
18
|
function Ze() {
|
|
19
|
-
var
|
|
20
|
-
|
|
19
|
+
var t, e, n = new Promise((i, s) => {
|
|
20
|
+
t = i, e = s;
|
|
21
21
|
});
|
|
22
|
-
return { promise: n, resolve:
|
|
22
|
+
return { promise: n, resolve: t, reject: e };
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const k = 2, Gt = 4, ge = 8, me = 1 << 24, yt = 16, vt = 32, Pt = 64, Je = 128, Y = 512, x = 1024, W = 2048, rt = 4096, Et = 8192, J = 16384, be = 32768, Pe = 65536, Oe = 1 << 17, tn = 1 << 18, Zt = 1 << 19, ii = 1 << 20, _t = 32768, de = 1 << 21, we = 1 << 22, et = 1 << 23, ft = Symbol("$state"), si = Symbol("legacy props"), ri = Symbol(""), bt = new class extends Error {
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
tt(this, "name", "StaleReactionError");
|
|
28
|
+
tt(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
|
|
29
29
|
}
|
|
30
30
|
}();
|
|
31
|
-
function
|
|
31
|
+
function oi() {
|
|
32
32
|
throw new Error("https://svelte.dev/e/async_derived_orphan");
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function li(t) {
|
|
35
35
|
throw new Error("https://svelte.dev/e/effect_in_teardown");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function ui() {
|
|
38
38
|
throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function ai(t) {
|
|
41
41
|
throw new Error("https://svelte.dev/e/effect_orphan");
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function ci() {
|
|
44
44
|
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function di(t) {
|
|
47
47
|
throw new Error("https://svelte.dev/e/props_invalid_value");
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function fi() {
|
|
50
50
|
throw new Error("https://svelte.dev/e/state_descriptors_fixed");
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function hi() {
|
|
53
53
|
throw new Error("https://svelte.dev/e/state_prototype_fixed");
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function pi() {
|
|
56
56
|
throw new Error("https://svelte.dev/e/state_unsafe_mutation");
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function _i() {
|
|
59
59
|
console.warn("https://svelte.dev/e/select_multiple_invalid_value");
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
return
|
|
61
|
+
function en(t) {
|
|
62
|
+
return t === this.v;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
64
|
+
function Ci(t, e) {
|
|
65
|
+
return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return !
|
|
67
|
+
function yi(t) {
|
|
68
|
+
return !Ci(t, this.v);
|
|
69
69
|
}
|
|
70
|
-
let
|
|
71
|
-
function Yt(
|
|
72
|
-
|
|
70
|
+
let vi = !1, X = null;
|
|
71
|
+
function Yt(t) {
|
|
72
|
+
X = t;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
p:
|
|
74
|
+
function gi(t, e = !1, n) {
|
|
75
|
+
X = {
|
|
76
|
+
p: X,
|
|
77
77
|
i: !1,
|
|
78
78
|
c: null,
|
|
79
79
|
e: null,
|
|
80
|
-
s:
|
|
80
|
+
s: t,
|
|
81
81
|
x: null,
|
|
82
82
|
l: null
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function mi(
|
|
86
|
-
var
|
|
85
|
+
function mi(t) {
|
|
86
|
+
var e = (
|
|
87
87
|
/** @type {ComponentContext} */
|
|
88
|
-
|
|
89
|
-
), n =
|
|
88
|
+
X
|
|
89
|
+
), n = e.e;
|
|
90
90
|
if (n !== null) {
|
|
91
|
-
|
|
91
|
+
e.e = null;
|
|
92
92
|
for (var i of n)
|
|
93
|
-
|
|
93
|
+
Cn(i);
|
|
94
94
|
}
|
|
95
|
-
return
|
|
95
|
+
return t !== void 0 && (e.x = t), e.i = !0, X = e.p, t ?? /** @type {T} */
|
|
96
96
|
{};
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function nn() {
|
|
99
99
|
return !0;
|
|
100
100
|
}
|
|
101
|
-
let
|
|
102
|
-
function
|
|
103
|
-
var
|
|
104
|
-
|
|
101
|
+
let wt = [];
|
|
102
|
+
function bi() {
|
|
103
|
+
var t = wt;
|
|
104
|
+
wt = [], ni(t);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
if (
|
|
108
|
-
var
|
|
106
|
+
function Jt(t) {
|
|
107
|
+
if (wt.length === 0) {
|
|
108
|
+
var e = wt;
|
|
109
109
|
queueMicrotask(() => {
|
|
110
|
-
|
|
110
|
+
e === wt && bi();
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
wt.push(t);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
var
|
|
117
|
-
if (
|
|
118
|
-
return w.f |=
|
|
119
|
-
if ((
|
|
120
|
-
if ((
|
|
121
|
-
throw
|
|
122
|
-
|
|
115
|
+
function wi(t) {
|
|
116
|
+
var e = N;
|
|
117
|
+
if (e === null)
|
|
118
|
+
return w.f |= et, t;
|
|
119
|
+
if ((e.f & be) === 0) {
|
|
120
|
+
if ((e.f & Je) === 0)
|
|
121
|
+
throw t;
|
|
122
|
+
e.b.error(t);
|
|
123
123
|
} else
|
|
124
|
-
Kt(
|
|
124
|
+
Kt(t, e);
|
|
125
125
|
}
|
|
126
|
-
function Kt(
|
|
127
|
-
for (;
|
|
128
|
-
if ((
|
|
126
|
+
function Kt(t, e) {
|
|
127
|
+
for (; e !== null; ) {
|
|
128
|
+
if ((e.f & Je) !== 0)
|
|
129
129
|
try {
|
|
130
|
-
|
|
130
|
+
e.b.error(t);
|
|
131
131
|
return;
|
|
132
132
|
} catch (n) {
|
|
133
|
-
|
|
133
|
+
t = n;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
e = e.parent;
|
|
136
136
|
}
|
|
137
|
-
throw
|
|
137
|
+
throw t;
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
const Ii = -7169;
|
|
140
|
+
function H(t, e) {
|
|
141
|
+
t.f = t.f & Ii | e;
|
|
142
|
+
}
|
|
143
|
+
function Ie(t) {
|
|
144
|
+
(t.f & Y) !== 0 || t.deps === null ? H(t, x) : H(t, rt);
|
|
145
|
+
}
|
|
146
|
+
function sn(t) {
|
|
147
|
+
if (t !== null)
|
|
148
|
+
for (const e of t)
|
|
149
|
+
(e.f & k) === 0 || (e.f & _t) === 0 || (e.f ^= _t, sn(
|
|
150
|
+
/** @type {Derived} */
|
|
151
|
+
e.deps
|
|
152
|
+
));
|
|
153
|
+
}
|
|
154
|
+
function Ei(t, e, n) {
|
|
155
|
+
(t.f & W) !== 0 ? e.add(t) : (t.f & rt) !== 0 && n.add(t), sn(t.deps), H(t, x);
|
|
156
|
+
}
|
|
157
|
+
const Ht = /* @__PURE__ */ new Set();
|
|
158
|
+
let T = null, R = null, $ = [], Ee = null, fe = !1;
|
|
159
|
+
var Dt, Lt, ct, dt, xt, At, Tt, K, he, pe, rn, on;
|
|
160
|
+
const Qt = class Qt {
|
|
143
161
|
constructor() {
|
|
144
|
-
|
|
145
|
-
|
|
162
|
+
Z(this, K);
|
|
163
|
+
tt(this, "committed", !1);
|
|
146
164
|
/**
|
|
147
165
|
* The current values of any sources that are updated in this batch
|
|
148
166
|
* They keys of this map are identical to `this.#previous`
|
|
149
167
|
* @type {Map<Source, any>}
|
|
150
168
|
*/
|
|
151
|
-
|
|
169
|
+
tt(this, "current", /* @__PURE__ */ new Map());
|
|
152
170
|
/**
|
|
153
171
|
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
154
172
|
* They keys of this map are identical to `this.#current`
|
|
155
173
|
* @type {Map<Source, any>}
|
|
156
174
|
*/
|
|
157
|
-
|
|
175
|
+
tt(this, "previous", /* @__PURE__ */ new Map());
|
|
158
176
|
/**
|
|
159
177
|
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
160
178
|
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
161
179
|
* @type {Set<() => void>}
|
|
162
180
|
*/
|
|
163
|
-
|
|
181
|
+
Z(this, Dt, /* @__PURE__ */ new Set());
|
|
164
182
|
/**
|
|
165
183
|
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
166
184
|
* @type {Set<(batch: Batch) => void>}
|
|
167
185
|
*/
|
|
168
|
-
|
|
186
|
+
Z(this, Lt, /* @__PURE__ */ new Set());
|
|
169
187
|
/**
|
|
170
188
|
* The number of async effects that are currently in flight
|
|
171
189
|
*/
|
|
172
|
-
|
|
190
|
+
Z(this, ct, 0);
|
|
173
191
|
/**
|
|
174
192
|
* The number of async effects that are currently in flight, _not_ inside a pending boundary
|
|
175
193
|
*/
|
|
176
|
-
|
|
194
|
+
Z(this, dt, 0);
|
|
177
195
|
/**
|
|
178
196
|
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
179
197
|
* TODO replace with Promise.withResolvers once supported widely enough
|
|
180
198
|
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
181
199
|
*/
|
|
182
|
-
|
|
200
|
+
Z(this, xt, null);
|
|
183
201
|
/**
|
|
184
202
|
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
185
203
|
* @type {Set<Effect>}
|
|
186
204
|
*/
|
|
187
|
-
|
|
205
|
+
Z(this, At, /* @__PURE__ */ new Set());
|
|
188
206
|
/**
|
|
189
207
|
* Deferred effects that are MAYBE_DIRTY
|
|
190
208
|
* @type {Set<Effect>}
|
|
191
209
|
*/
|
|
192
|
-
|
|
210
|
+
Z(this, Tt, /* @__PURE__ */ new Set());
|
|
193
211
|
/**
|
|
194
212
|
* A set of branches that still exist, but will be destroyed when this batch
|
|
195
213
|
* is committed — we skip over these during `process`
|
|
196
214
|
* @type {Set<Effect>}
|
|
197
215
|
*/
|
|
198
|
-
|
|
199
|
-
|
|
216
|
+
tt(this, "skipped_effects", /* @__PURE__ */ new Set());
|
|
217
|
+
tt(this, "is_fork", !1);
|
|
200
218
|
}
|
|
201
219
|
is_deferred() {
|
|
202
|
-
return this.is_fork ||
|
|
220
|
+
return this.is_fork || L(this, dt) > 0;
|
|
203
221
|
}
|
|
204
222
|
/**
|
|
205
223
|
*
|
|
206
224
|
* @param {Effect[]} root_effects
|
|
207
225
|
*/
|
|
208
|
-
process(
|
|
209
|
-
var
|
|
226
|
+
process(e) {
|
|
227
|
+
var s;
|
|
210
228
|
$ = [], this.apply();
|
|
211
|
-
var n =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
render_effects: []
|
|
216
|
-
};
|
|
217
|
-
for (const s of t)
|
|
218
|
-
K(this, k, pe).call(this, s, n);
|
|
219
|
-
this.is_fork || K(this, k, rn).call(this), this.is_deferred() ? (K(this, k, Rt).call(this, n.effects), K(this, k, Rt).call(this, n.render_effects)) : (N = null, Re(n.render_effects), Re(n.effects), (i = A(this, Ut)) == null || i.resolve()), P = null;
|
|
229
|
+
var n = [], i = [];
|
|
230
|
+
for (const r of e)
|
|
231
|
+
lt(this, K, he).call(this, r, n, i);
|
|
232
|
+
this.is_fork || lt(this, K, rn).call(this), this.is_deferred() ? (lt(this, K, pe).call(this, i), lt(this, K, pe).call(this, n)) : (T = null, Re(i), Re(n), (s = L(this, xt)) == null || s.resolve()), R = null;
|
|
220
233
|
}
|
|
221
234
|
/**
|
|
222
235
|
* Associate a change to a given source with the current
|
|
@@ -224,215 +237,193 @@ const Zt = class Zt {
|
|
|
224
237
|
* @param {Source} source
|
|
225
238
|
* @param {any} value
|
|
226
239
|
*/
|
|
227
|
-
capture(
|
|
228
|
-
this.previous.has(
|
|
240
|
+
capture(e, n) {
|
|
241
|
+
n !== P && !this.previous.has(e) && this.previous.set(e, n), (e.f & et) === 0 && (this.current.set(e, e.v), R == null || R.set(e, e.v));
|
|
229
242
|
}
|
|
230
243
|
activate() {
|
|
231
|
-
|
|
244
|
+
T = this, this.apply();
|
|
232
245
|
}
|
|
233
246
|
deactivate() {
|
|
234
|
-
|
|
247
|
+
T === this && (T = null, R = null);
|
|
235
248
|
}
|
|
236
249
|
flush() {
|
|
237
250
|
if (this.activate(), $.length > 0) {
|
|
238
|
-
if (
|
|
251
|
+
if (Ni(), T !== null && T !== this)
|
|
239
252
|
return;
|
|
240
|
-
} else
|
|
253
|
+
} else L(this, ct) === 0 && this.process([]);
|
|
241
254
|
this.deactivate();
|
|
242
255
|
}
|
|
243
256
|
discard() {
|
|
244
|
-
for (const
|
|
245
|
-
|
|
257
|
+
for (const e of L(this, Lt)) e(this);
|
|
258
|
+
L(this, Lt).clear();
|
|
246
259
|
}
|
|
247
260
|
/**
|
|
248
261
|
*
|
|
249
262
|
* @param {boolean} blocking
|
|
250
263
|
*/
|
|
251
|
-
increment(
|
|
252
|
-
mt(this,
|
|
264
|
+
increment(e) {
|
|
265
|
+
mt(this, ct, L(this, ct) + 1), e && mt(this, dt, L(this, dt) + 1);
|
|
253
266
|
}
|
|
254
267
|
/**
|
|
255
268
|
*
|
|
256
269
|
* @param {boolean} blocking
|
|
257
270
|
*/
|
|
258
|
-
decrement(
|
|
259
|
-
mt(this,
|
|
271
|
+
decrement(e) {
|
|
272
|
+
mt(this, ct, L(this, ct) - 1), e && mt(this, dt, L(this, dt) - 1), this.revive();
|
|
260
273
|
}
|
|
261
274
|
revive() {
|
|
262
|
-
for (const
|
|
263
|
-
|
|
264
|
-
for (const
|
|
265
|
-
|
|
275
|
+
for (const e of L(this, At))
|
|
276
|
+
L(this, Tt).delete(e), H(e, W), St(e);
|
|
277
|
+
for (const e of L(this, Tt))
|
|
278
|
+
H(e, rt), St(e);
|
|
266
279
|
this.flush();
|
|
267
280
|
}
|
|
268
281
|
/** @param {() => void} fn */
|
|
269
|
-
oncommit(
|
|
270
|
-
|
|
282
|
+
oncommit(e) {
|
|
283
|
+
L(this, Dt).add(e);
|
|
271
284
|
}
|
|
272
285
|
/** @param {(batch: Batch) => void} fn */
|
|
273
|
-
ondiscard(
|
|
274
|
-
|
|
286
|
+
ondiscard(e) {
|
|
287
|
+
L(this, Lt).add(e);
|
|
275
288
|
}
|
|
276
289
|
settled() {
|
|
277
|
-
return (
|
|
290
|
+
return (L(this, xt) ?? mt(this, xt, Ze())).promise;
|
|
278
291
|
}
|
|
279
292
|
static ensure() {
|
|
280
|
-
if (
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
293
|
+
if (T === null) {
|
|
294
|
+
const e = T = new Qt();
|
|
295
|
+
Ht.add(T), Qt.enqueue(() => {
|
|
296
|
+
T === e && e.flush();
|
|
284
297
|
});
|
|
285
298
|
}
|
|
286
|
-
return
|
|
299
|
+
return T;
|
|
287
300
|
}
|
|
288
301
|
/** @param {() => void} task */
|
|
289
|
-
static enqueue(
|
|
290
|
-
|
|
302
|
+
static enqueue(e) {
|
|
303
|
+
Jt(e);
|
|
291
304
|
}
|
|
292
305
|
apply() {
|
|
293
306
|
}
|
|
294
307
|
};
|
|
295
|
-
|
|
308
|
+
Dt = new WeakMap(), Lt = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), xt = new WeakMap(), At = new WeakMap(), Tt = new WeakMap(), K = new WeakSet(), /**
|
|
296
309
|
* Traverse the effect tree, executing effects or stashing
|
|
297
310
|
* them for later execution as appropriate
|
|
298
311
|
* @param {Effect} root
|
|
299
|
-
* @param {
|
|
312
|
+
* @param {Effect[]} effects
|
|
313
|
+
* @param {Effect[]} render_effects
|
|
300
314
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
render_effects: []
|
|
311
|
-
}), !l && i.fn !== null) {
|
|
312
|
-
r ? i.f ^= H : (s & ge) !== 0 ? n.effects.push(i) : Ht(i) && ((i.f & _t) !== 0 && A(this, Lt).add(i), xt(i));
|
|
313
|
-
var a = i.first;
|
|
314
|
-
if (a !== null) {
|
|
315
|
-
i = a;
|
|
315
|
+
he = function(e, n, i) {
|
|
316
|
+
e.f ^= x;
|
|
317
|
+
for (var s = e.first, r = null; s !== null; ) {
|
|
318
|
+
var o = s.f, l = (o & (vt | Pt)) !== 0, u = l && (o & x) !== 0, a = u || (o & Et) !== 0 || this.skipped_effects.has(s);
|
|
319
|
+
if (!a && s.fn !== null) {
|
|
320
|
+
l ? s.f ^= x : r !== null && (o & (Gt | ge | me)) !== 0 ? r.b.defer_effect(s) : (o & Gt) !== 0 ? n.push(s) : Ut(s) && ((o & yt) !== 0 && L(this, At).add(s), Mt(s));
|
|
321
|
+
var c = s.first;
|
|
322
|
+
if (c !== null) {
|
|
323
|
+
s = c;
|
|
316
324
|
continue;
|
|
317
325
|
}
|
|
318
326
|
}
|
|
319
|
-
var
|
|
320
|
-
for (
|
|
321
|
-
|
|
322
|
-
n.parent), i = u.next, u = u.parent;
|
|
327
|
+
var d = s.parent;
|
|
328
|
+
for (s = s.next; s === null && d !== null; )
|
|
329
|
+
d === r && (r = null), s = d.next, d = d.parent;
|
|
323
330
|
}
|
|
324
331
|
}, /**
|
|
325
332
|
* @param {Effect[]} effects
|
|
326
333
|
*/
|
|
327
|
-
|
|
328
|
-
for (
|
|
329
|
-
(n
|
|
330
|
-
}, /**
|
|
331
|
-
* @param {Value[] | null} deps
|
|
332
|
-
*/
|
|
333
|
-
_e = function(t) {
|
|
334
|
-
if (t !== null)
|
|
335
|
-
for (const n of t)
|
|
336
|
-
(n.f & M) === 0 || (n.f & ht) === 0 || (n.f ^= ht, K(this, k, _e).call(
|
|
337
|
-
this,
|
|
338
|
-
/** @type {Derived} */
|
|
339
|
-
n.deps
|
|
340
|
-
));
|
|
334
|
+
pe = function(e) {
|
|
335
|
+
for (var n = 0; n < e.length; n += 1)
|
|
336
|
+
Ei(e[n], L(this, At), L(this, Tt));
|
|
341
337
|
}, rn = function() {
|
|
342
|
-
if (
|
|
343
|
-
for (const
|
|
344
|
-
|
|
338
|
+
if (L(this, dt) === 0) {
|
|
339
|
+
for (const e of L(this, Dt)) e();
|
|
340
|
+
L(this, Dt).clear();
|
|
345
341
|
}
|
|
346
|
-
|
|
342
|
+
L(this, ct) === 0 && lt(this, K, on).call(this);
|
|
347
343
|
}, on = function() {
|
|
348
|
-
var
|
|
349
|
-
if (
|
|
344
|
+
var s;
|
|
345
|
+
if (Ht.size > 1) {
|
|
350
346
|
this.previous.clear();
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
effects: [],
|
|
355
|
-
render_effects: []
|
|
356
|
-
};
|
|
357
|
-
for (const o of Ft) {
|
|
358
|
-
if (o === this) {
|
|
347
|
+
var e = R, n = !0;
|
|
348
|
+
for (const r of Ht) {
|
|
349
|
+
if (r === this) {
|
|
359
350
|
n = !1;
|
|
360
351
|
continue;
|
|
361
352
|
}
|
|
362
|
-
const
|
|
363
|
-
for (const [u,
|
|
364
|
-
if (
|
|
365
|
-
if (n &&
|
|
366
|
-
|
|
353
|
+
const o = [];
|
|
354
|
+
for (const [u, a] of this.current) {
|
|
355
|
+
if (r.current.has(u))
|
|
356
|
+
if (n && a !== r.current.get(u))
|
|
357
|
+
r.current.set(u, a);
|
|
367
358
|
else
|
|
368
359
|
continue;
|
|
369
|
-
|
|
360
|
+
o.push(u);
|
|
370
361
|
}
|
|
371
|
-
if (
|
|
362
|
+
if (o.length === 0)
|
|
372
363
|
continue;
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
375
|
-
var
|
|
364
|
+
const l = [...r.current.keys()].filter((u) => !this.current.has(u));
|
|
365
|
+
if (l.length > 0) {
|
|
366
|
+
var i = $;
|
|
376
367
|
$ = [];
|
|
377
|
-
const u = /* @__PURE__ */ new Set(),
|
|
378
|
-
for (const
|
|
379
|
-
ln(
|
|
368
|
+
const u = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
369
|
+
for (const c of o)
|
|
370
|
+
ln(c, l, u, a);
|
|
380
371
|
if ($.length > 0) {
|
|
381
|
-
|
|
382
|
-
for (const
|
|
383
|
-
|
|
384
|
-
|
|
372
|
+
T = r, r.apply();
|
|
373
|
+
for (const c of $)
|
|
374
|
+
lt(s = r, K, he).call(s, c, [], []);
|
|
375
|
+
r.deactivate();
|
|
385
376
|
}
|
|
386
|
-
$ =
|
|
377
|
+
$ = i;
|
|
387
378
|
}
|
|
388
379
|
}
|
|
389
|
-
|
|
380
|
+
T = null, R = e;
|
|
390
381
|
}
|
|
391
|
-
this.committed = !0,
|
|
382
|
+
this.committed = !0, Ht.delete(this);
|
|
392
383
|
};
|
|
393
|
-
let zt =
|
|
394
|
-
function
|
|
395
|
-
var
|
|
396
|
-
|
|
397
|
-
var
|
|
384
|
+
let zt = Qt;
|
|
385
|
+
function Ni() {
|
|
386
|
+
var t = ht;
|
|
387
|
+
fe = !0;
|
|
388
|
+
var e = null;
|
|
398
389
|
try {
|
|
399
390
|
var n = 0;
|
|
400
|
-
for (
|
|
391
|
+
for ($t(!0); $.length > 0; ) {
|
|
401
392
|
var i = zt.ensure();
|
|
402
393
|
if (n++ > 1e3) {
|
|
403
394
|
var s, r;
|
|
404
|
-
|
|
395
|
+
Di();
|
|
405
396
|
}
|
|
406
|
-
i.process($),
|
|
397
|
+
i.process($), nt.clear();
|
|
407
398
|
}
|
|
408
399
|
} finally {
|
|
409
|
-
|
|
400
|
+
fe = !1, $t(t), Ee = null;
|
|
410
401
|
}
|
|
411
402
|
}
|
|
412
|
-
function
|
|
403
|
+
function Di() {
|
|
413
404
|
try {
|
|
414
|
-
|
|
415
|
-
} catch (
|
|
416
|
-
Kt(
|
|
405
|
+
ci();
|
|
406
|
+
} catch (t) {
|
|
407
|
+
Kt(t, Ee);
|
|
417
408
|
}
|
|
418
409
|
}
|
|
419
410
|
let z = null;
|
|
420
|
-
function Re(
|
|
421
|
-
var
|
|
422
|
-
if (
|
|
423
|
-
for (var n = 0; n <
|
|
424
|
-
var i =
|
|
425
|
-
if ((i.f & (
|
|
426
|
-
|
|
411
|
+
function Re(t) {
|
|
412
|
+
var e = t.length;
|
|
413
|
+
if (e !== 0) {
|
|
414
|
+
for (var n = 0; n < e; ) {
|
|
415
|
+
var i = t[n++];
|
|
416
|
+
if ((i.f & (J | Et)) === 0 && Ut(i) && (z = /* @__PURE__ */ new Set(), Mt(i), i.deps === null && i.first === null && i.nodes === null && (i.teardown === null && i.ac === null ? bn(i) : i.fn = null), (z == null ? void 0 : z.size) > 0)) {
|
|
417
|
+
nt.clear();
|
|
427
418
|
for (const s of z) {
|
|
428
|
-
if ((s.f & (
|
|
419
|
+
if ((s.f & (J | Et)) !== 0) continue;
|
|
429
420
|
const r = [s];
|
|
430
421
|
let o = s.parent;
|
|
431
422
|
for (; o !== null; )
|
|
432
423
|
z.has(o) && (z.delete(o), r.push(o)), o = o.parent;
|
|
433
424
|
for (let l = r.length - 1; l >= 0; l--) {
|
|
434
|
-
const
|
|
435
|
-
(
|
|
425
|
+
const u = r[l];
|
|
426
|
+
(u.f & (J | Et)) === 0 && Mt(u);
|
|
436
427
|
}
|
|
437
428
|
}
|
|
438
429
|
z.clear();
|
|
@@ -441,33 +432,33 @@ function Re(e) {
|
|
|
441
432
|
z = null;
|
|
442
433
|
}
|
|
443
434
|
}
|
|
444
|
-
function ln(
|
|
445
|
-
if (!n.has(
|
|
446
|
-
for (const s of
|
|
435
|
+
function ln(t, e, n, i) {
|
|
436
|
+
if (!n.has(t) && (n.add(t), t.reactions !== null))
|
|
437
|
+
for (const s of t.reactions) {
|
|
447
438
|
const r = s.f;
|
|
448
|
-
(r &
|
|
439
|
+
(r & k) !== 0 ? ln(
|
|
449
440
|
/** @type {Derived} */
|
|
450
441
|
s,
|
|
451
|
-
|
|
442
|
+
e,
|
|
452
443
|
n,
|
|
453
444
|
i
|
|
454
|
-
) : (r & (
|
|
445
|
+
) : (r & (we | yt)) !== 0 && (r & W) === 0 && un(s, e, i) && (H(s, W), St(
|
|
455
446
|
/** @type {Effect} */
|
|
456
447
|
s
|
|
457
448
|
));
|
|
458
449
|
}
|
|
459
450
|
}
|
|
460
|
-
function un(
|
|
461
|
-
const i = n.get(
|
|
451
|
+
function un(t, e, n) {
|
|
452
|
+
const i = n.get(t);
|
|
462
453
|
if (i !== void 0) return i;
|
|
463
|
-
if (
|
|
464
|
-
for (const s of
|
|
465
|
-
if (
|
|
454
|
+
if (t.deps !== null)
|
|
455
|
+
for (const s of t.deps) {
|
|
456
|
+
if (e.includes(s))
|
|
466
457
|
return !0;
|
|
467
|
-
if ((s.f &
|
|
458
|
+
if ((s.f & k) !== 0 && un(
|
|
468
459
|
/** @type {Derived} */
|
|
469
460
|
s,
|
|
470
|
-
|
|
461
|
+
e,
|
|
471
462
|
n
|
|
472
463
|
))
|
|
473
464
|
return n.set(
|
|
@@ -476,333 +467,335 @@ function un(e, t, n) {
|
|
|
476
467
|
!0
|
|
477
468
|
), !0;
|
|
478
469
|
}
|
|
479
|
-
return n.set(
|
|
470
|
+
return n.set(t, !1), !1;
|
|
480
471
|
}
|
|
481
|
-
function
|
|
482
|
-
for (var
|
|
483
|
-
|
|
484
|
-
var n =
|
|
485
|
-
if (
|
|
472
|
+
function St(t) {
|
|
473
|
+
for (var e = Ee = t; e.parent !== null; ) {
|
|
474
|
+
e = e.parent;
|
|
475
|
+
var n = e.f;
|
|
476
|
+
if (fe && e === N && (n & yt) !== 0 && (n & tn) === 0)
|
|
486
477
|
return;
|
|
487
|
-
if ((n & (
|
|
488
|
-
if ((n &
|
|
489
|
-
|
|
478
|
+
if ((n & (Pt | vt)) !== 0) {
|
|
479
|
+
if ((n & x) === 0) return;
|
|
480
|
+
e.f ^= x;
|
|
490
481
|
}
|
|
491
482
|
}
|
|
492
|
-
$.push(
|
|
483
|
+
$.push(e);
|
|
493
484
|
}
|
|
494
|
-
function
|
|
485
|
+
function Li(t, e, n, i) {
|
|
495
486
|
const s = Ne;
|
|
496
|
-
if (n.length === 0 &&
|
|
497
|
-
i(
|
|
487
|
+
if (n.length === 0 && t.length === 0) {
|
|
488
|
+
i(e.map(s));
|
|
498
489
|
return;
|
|
499
490
|
}
|
|
500
|
-
var r =
|
|
491
|
+
var r = T, o = (
|
|
501
492
|
/** @type {Effect} */
|
|
502
|
-
|
|
503
|
-
), l =
|
|
504
|
-
function
|
|
505
|
-
Promise.all(n.map((
|
|
493
|
+
N
|
|
494
|
+
), l = Ai();
|
|
495
|
+
function u() {
|
|
496
|
+
Promise.all(n.map((a) => /* @__PURE__ */ Ti(a))).then((a) => {
|
|
506
497
|
l();
|
|
507
498
|
try {
|
|
508
|
-
i([...
|
|
499
|
+
i([...e.map(s), ...a]);
|
|
509
500
|
} catch (c) {
|
|
510
|
-
(o.f &
|
|
501
|
+
(o.f & J) === 0 && Kt(c, o);
|
|
511
502
|
}
|
|
512
503
|
r == null || r.deactivate(), qt();
|
|
513
|
-
}).catch((
|
|
514
|
-
Kt(
|
|
504
|
+
}).catch((a) => {
|
|
505
|
+
Kt(a, o);
|
|
515
506
|
});
|
|
516
507
|
}
|
|
517
|
-
|
|
508
|
+
t.length > 0 ? Promise.all(t).then(() => {
|
|
518
509
|
l();
|
|
519
510
|
try {
|
|
520
|
-
return
|
|
511
|
+
return u();
|
|
521
512
|
} finally {
|
|
522
513
|
r == null || r.deactivate(), qt();
|
|
523
514
|
}
|
|
524
|
-
}) :
|
|
515
|
+
}) : u();
|
|
525
516
|
}
|
|
526
|
-
function
|
|
527
|
-
var
|
|
517
|
+
function Ai() {
|
|
518
|
+
var t = N, e = w, n = X, i = T;
|
|
528
519
|
return function(r = !0) {
|
|
529
|
-
|
|
520
|
+
st(t), Q(e), Yt(n), r && (i == null || i.activate());
|
|
530
521
|
};
|
|
531
522
|
}
|
|
532
523
|
function qt() {
|
|
533
|
-
|
|
524
|
+
st(null), Q(null), Yt(null);
|
|
534
525
|
}
|
|
535
526
|
// @__NO_SIDE_EFFECTS__
|
|
536
|
-
function Ne(
|
|
537
|
-
var
|
|
527
|
+
function Ne(t) {
|
|
528
|
+
var e = k | W, n = w !== null && (w.f & k) !== 0 ? (
|
|
538
529
|
/** @type {Derived} */
|
|
539
530
|
w
|
|
540
531
|
) : null;
|
|
541
|
-
return
|
|
542
|
-
ctx:
|
|
532
|
+
return N !== null && (N.f |= Zt), {
|
|
533
|
+
ctx: X,
|
|
543
534
|
deps: null,
|
|
544
535
|
effects: null,
|
|
545
|
-
equals:
|
|
546
|
-
f:
|
|
547
|
-
fn:
|
|
536
|
+
equals: en,
|
|
537
|
+
f: e,
|
|
538
|
+
fn: t,
|
|
548
539
|
reactions: null,
|
|
549
540
|
rv: 0,
|
|
550
541
|
v: (
|
|
551
542
|
/** @type {V} */
|
|
552
|
-
|
|
543
|
+
P
|
|
553
544
|
),
|
|
554
545
|
wv: 0,
|
|
555
|
-
parent: n ??
|
|
546
|
+
parent: n ?? N,
|
|
556
547
|
ac: null
|
|
557
548
|
};
|
|
558
549
|
}
|
|
559
550
|
// @__NO_SIDE_EFFECTS__
|
|
560
|
-
function
|
|
561
|
-
let
|
|
551
|
+
function Ti(t, e, n) {
|
|
552
|
+
let i = (
|
|
562
553
|
/** @type {Effect | null} */
|
|
563
|
-
|
|
554
|
+
N
|
|
564
555
|
);
|
|
565
|
-
|
|
566
|
-
var
|
|
556
|
+
i === null && oi();
|
|
557
|
+
var s = (
|
|
567
558
|
/** @type {Boundary} */
|
|
568
|
-
|
|
569
|
-
),
|
|
559
|
+
i.b
|
|
560
|
+
), r = (
|
|
570
561
|
/** @type {Promise<V>} */
|
|
571
562
|
/** @type {unknown} */
|
|
572
563
|
void 0
|
|
573
|
-
),
|
|
564
|
+
), o = fn(
|
|
574
565
|
/** @type {V} */
|
|
575
|
-
|
|
576
|
-
),
|
|
577
|
-
return
|
|
578
|
-
var
|
|
566
|
+
P
|
|
567
|
+
), l = !w, u = /* @__PURE__ */ new Map();
|
|
568
|
+
return ji(() => {
|
|
569
|
+
var p;
|
|
579
570
|
var a = Ze();
|
|
580
|
-
|
|
571
|
+
r = a.promise;
|
|
581
572
|
try {
|
|
582
|
-
Promise.resolve(
|
|
583
|
-
|
|
573
|
+
Promise.resolve(t()).then(a.resolve, a.reject).then(() => {
|
|
574
|
+
c === T && c.committed && c.deactivate(), qt();
|
|
584
575
|
});
|
|
585
|
-
} catch (
|
|
586
|
-
a.reject(
|
|
576
|
+
} catch (_) {
|
|
577
|
+
a.reject(_), qt();
|
|
587
578
|
}
|
|
588
|
-
var
|
|
579
|
+
var c = (
|
|
589
580
|
/** @type {Batch} */
|
|
590
|
-
|
|
581
|
+
T
|
|
591
582
|
);
|
|
592
|
-
if (
|
|
593
|
-
var
|
|
594
|
-
|
|
583
|
+
if (l) {
|
|
584
|
+
var d = s.is_rendered();
|
|
585
|
+
s.update_pending_count(1), c.increment(d), (p = u.get(c)) == null || p.reject(bt), u.delete(c), u.set(c, a);
|
|
595
586
|
}
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
598
|
-
|
|
587
|
+
const f = (_, g = void 0) => {
|
|
588
|
+
if (c.activate(), g)
|
|
589
|
+
g !== bt && (o.f |= et, Ce(o, g));
|
|
599
590
|
else {
|
|
600
|
-
(
|
|
601
|
-
for (const [b,
|
|
602
|
-
if (
|
|
603
|
-
|
|
591
|
+
(o.f & et) !== 0 && (o.f ^= et), Ce(o, _);
|
|
592
|
+
for (const [b, y] of u) {
|
|
593
|
+
if (u.delete(b), b === c) break;
|
|
594
|
+
y.reject(bt);
|
|
604
595
|
}
|
|
605
596
|
}
|
|
606
|
-
|
|
597
|
+
l && (s.update_pending_count(-1), c.decrement(d));
|
|
607
598
|
};
|
|
608
|
-
a.promise.then(
|
|
609
|
-
}),
|
|
610
|
-
for (const a of
|
|
611
|
-
a.reject(
|
|
599
|
+
a.promise.then(f, (_) => f(null, _ || "unknown"));
|
|
600
|
+
}), _n(() => {
|
|
601
|
+
for (const a of u.values())
|
|
602
|
+
a.reject(bt);
|
|
612
603
|
}), new Promise((a) => {
|
|
613
|
-
function
|
|
614
|
-
function
|
|
615
|
-
|
|
604
|
+
function c(d) {
|
|
605
|
+
function f() {
|
|
606
|
+
d === r ? a(o) : c(r);
|
|
616
607
|
}
|
|
617
|
-
|
|
608
|
+
d.then(f, f);
|
|
618
609
|
}
|
|
619
|
-
|
|
610
|
+
c(r);
|
|
620
611
|
});
|
|
621
612
|
}
|
|
622
613
|
// @__NO_SIDE_EFFECTS__
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
return
|
|
626
|
-
}
|
|
627
|
-
function an(
|
|
628
|
-
var
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
for (var n = 0; n <
|
|
632
|
-
|
|
614
|
+
function Si(t) {
|
|
615
|
+
const e = /* @__PURE__ */ Ne(t);
|
|
616
|
+
return e.equals = yi, e;
|
|
617
|
+
}
|
|
618
|
+
function an(t) {
|
|
619
|
+
var e = t.effects;
|
|
620
|
+
if (e !== null) {
|
|
621
|
+
t.effects = null;
|
|
622
|
+
for (var n = 0; n < e.length; n += 1)
|
|
623
|
+
Ct(
|
|
633
624
|
/** @type {Effect} */
|
|
634
|
-
|
|
625
|
+
e[n]
|
|
635
626
|
);
|
|
636
627
|
}
|
|
637
628
|
}
|
|
638
|
-
function
|
|
639
|
-
for (var
|
|
640
|
-
if ((
|
|
641
|
-
return (
|
|
629
|
+
function Pi(t) {
|
|
630
|
+
for (var e = t.parent; e !== null; ) {
|
|
631
|
+
if ((e.f & k) === 0)
|
|
632
|
+
return (e.f & J) === 0 ? (
|
|
642
633
|
/** @type {Effect} */
|
|
643
|
-
|
|
634
|
+
e
|
|
644
635
|
) : null;
|
|
645
|
-
|
|
636
|
+
e = e.parent;
|
|
646
637
|
}
|
|
647
638
|
return null;
|
|
648
639
|
}
|
|
649
|
-
function De(
|
|
650
|
-
var
|
|
651
|
-
|
|
640
|
+
function De(t) {
|
|
641
|
+
var e, n = N;
|
|
642
|
+
st(Pi(t));
|
|
652
643
|
try {
|
|
653
|
-
|
|
644
|
+
t.f &= ~_t, an(t), e = Nn(t);
|
|
654
645
|
} finally {
|
|
655
|
-
|
|
646
|
+
st(n);
|
|
656
647
|
}
|
|
657
|
-
return
|
|
648
|
+
return e;
|
|
658
649
|
}
|
|
659
|
-
function cn(
|
|
660
|
-
var
|
|
661
|
-
if (
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
B(e, n);
|
|
667
|
-
}
|
|
650
|
+
function cn(t) {
|
|
651
|
+
var e = De(t);
|
|
652
|
+
if (!t.equals(e) && (t.wv = In(), (!(T != null && T.is_fork) || t.deps === null) && (t.v = e, t.deps === null))) {
|
|
653
|
+
H(t, x);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
it || (R !== null ? (pn() || T != null && T.is_fork) && R.set(t, e) : Ie(t));
|
|
668
657
|
}
|
|
669
|
-
let
|
|
670
|
-
const
|
|
658
|
+
let _e = /* @__PURE__ */ new Set();
|
|
659
|
+
const nt = /* @__PURE__ */ new Map();
|
|
671
660
|
let dn = !1;
|
|
672
|
-
function fn(
|
|
661
|
+
function fn(t, e) {
|
|
673
662
|
var n = {
|
|
674
663
|
f: 0,
|
|
675
664
|
// TODO ideally we could skip this altogether, but it causes type errors
|
|
676
|
-
v:
|
|
665
|
+
v: t,
|
|
677
666
|
reactions: null,
|
|
678
|
-
equals:
|
|
667
|
+
equals: en,
|
|
679
668
|
rv: 0,
|
|
680
669
|
wv: 0
|
|
681
670
|
};
|
|
682
671
|
return n;
|
|
683
672
|
}
|
|
684
673
|
// @__NO_SIDE_EFFECTS__
|
|
685
|
-
function
|
|
686
|
-
const n = fn(
|
|
687
|
-
return
|
|
674
|
+
function G(t, e) {
|
|
675
|
+
const n = fn(t);
|
|
676
|
+
return zi(n), n;
|
|
688
677
|
}
|
|
689
|
-
function
|
|
678
|
+
function V(t, e, n = !1) {
|
|
690
679
|
w !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
|
|
691
680
|
// to ensure we error if state is set inside an inspect effect
|
|
692
|
-
(!
|
|
693
|
-
let i = n ?
|
|
694
|
-
return
|
|
695
|
-
}
|
|
696
|
-
function
|
|
697
|
-
if (!
|
|
698
|
-
var n =
|
|
699
|
-
|
|
681
|
+
(!q || (w.f & Oe) !== 0) && nn() && (w.f & (k | yt | we | Oe)) !== 0 && !(U != null && U.includes(t)) && pi();
|
|
682
|
+
let i = n ? It(e) : e;
|
|
683
|
+
return Ce(t, i);
|
|
684
|
+
}
|
|
685
|
+
function Ce(t, e) {
|
|
686
|
+
if (!t.equals(e)) {
|
|
687
|
+
var n = t.v;
|
|
688
|
+
it ? nt.set(t, e) : nt.set(t, n), t.v = e;
|
|
700
689
|
var i = zt.ensure();
|
|
701
|
-
i.capture(
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
690
|
+
if (i.capture(t, n), (t.f & k) !== 0) {
|
|
691
|
+
const s = (
|
|
692
|
+
/** @type {Derived} */
|
|
693
|
+
t
|
|
694
|
+
);
|
|
695
|
+
(t.f & W) !== 0 && De(s), Ie(s);
|
|
696
|
+
}
|
|
697
|
+
t.wv = In(), hn(t, W), N !== null && (N.f & x) !== 0 && (N.f & (vt | Pt)) === 0 && (j === null ? qi([t]) : j.push(t)), !i.is_fork && _e.size > 0 && !dn && Oi();
|
|
705
698
|
}
|
|
706
|
-
return
|
|
699
|
+
return e;
|
|
707
700
|
}
|
|
708
|
-
function
|
|
701
|
+
function Oi() {
|
|
709
702
|
dn = !1;
|
|
710
|
-
var
|
|
711
|
-
|
|
712
|
-
const
|
|
703
|
+
var t = ht;
|
|
704
|
+
$t(!0);
|
|
705
|
+
const e = Array.from(_e);
|
|
713
706
|
try {
|
|
714
|
-
for (const n of
|
|
715
|
-
(n.f &
|
|
707
|
+
for (const n of e)
|
|
708
|
+
(n.f & x) !== 0 && H(n, rt), Ut(n) && Mt(n);
|
|
716
709
|
} finally {
|
|
717
|
-
|
|
710
|
+
$t(t);
|
|
718
711
|
}
|
|
719
|
-
|
|
712
|
+
_e.clear();
|
|
720
713
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
714
|
+
function ee(t) {
|
|
715
|
+
V(t, t.v + 1);
|
|
723
716
|
}
|
|
724
|
-
function hn(
|
|
725
|
-
var n =
|
|
717
|
+
function hn(t, e) {
|
|
718
|
+
var n = t.reactions;
|
|
726
719
|
if (n !== null)
|
|
727
720
|
for (var i = n.length, s = 0; s < i; s++) {
|
|
728
|
-
var r = n[s], o = r.f, l = (o &
|
|
729
|
-
if (l &&
|
|
730
|
-
var
|
|
721
|
+
var r = n[s], o = r.f, l = (o & W) === 0;
|
|
722
|
+
if (l && H(r, e), (o & k) !== 0) {
|
|
723
|
+
var u = (
|
|
731
724
|
/** @type {Derived} */
|
|
732
725
|
r
|
|
733
726
|
);
|
|
734
|
-
|
|
735
|
-
} else l && ((o &
|
|
727
|
+
R == null || R.delete(u), (o & _t) === 0 && (o & Y && (r.f |= _t), hn(u, rt));
|
|
728
|
+
} else l && ((o & yt) !== 0 && z !== null && z.add(
|
|
736
729
|
/** @type {Effect} */
|
|
737
730
|
r
|
|
738
|
-
),
|
|
731
|
+
), St(
|
|
739
732
|
/** @type {Effect} */
|
|
740
733
|
r
|
|
741
734
|
));
|
|
742
735
|
}
|
|
743
736
|
}
|
|
744
|
-
function
|
|
745
|
-
if (typeof
|
|
746
|
-
return
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
749
|
-
return
|
|
750
|
-
var n = /* @__PURE__ */ new Map(), i = Xe(
|
|
751
|
-
if (
|
|
737
|
+
function It(t) {
|
|
738
|
+
if (typeof t != "object" || t === null || ft in t)
|
|
739
|
+
return t;
|
|
740
|
+
const e = Qe(t);
|
|
741
|
+
if (e !== ti && e !== ei)
|
|
742
|
+
return t;
|
|
743
|
+
var n = /* @__PURE__ */ new Map(), i = Xe(t), s = /* @__PURE__ */ G(0), r = pt, o = (l) => {
|
|
744
|
+
if (pt === r)
|
|
752
745
|
return l();
|
|
753
|
-
var
|
|
754
|
-
|
|
746
|
+
var u = w, a = pt;
|
|
747
|
+
Q(null), xe(r);
|
|
755
748
|
var c = l();
|
|
756
|
-
return
|
|
749
|
+
return Q(u), xe(a), c;
|
|
757
750
|
};
|
|
758
|
-
return i && n.set("length", /* @__PURE__ */
|
|
751
|
+
return i && n.set("length", /* @__PURE__ */ G(
|
|
759
752
|
/** @type {any[]} */
|
|
760
|
-
|
|
753
|
+
t.length
|
|
761
754
|
)), new Proxy(
|
|
762
755
|
/** @type {any} */
|
|
763
|
-
|
|
756
|
+
t,
|
|
764
757
|
{
|
|
765
|
-
defineProperty(l,
|
|
766
|
-
(!("value" in
|
|
767
|
-
var c = n.get(
|
|
758
|
+
defineProperty(l, u, a) {
|
|
759
|
+
(!("value" in a) || a.configurable === !1 || a.enumerable === !1 || a.writable === !1) && fi();
|
|
760
|
+
var c = n.get(u);
|
|
768
761
|
return c === void 0 ? c = o(() => {
|
|
769
|
-
var d = /* @__PURE__ */
|
|
770
|
-
return n.set(
|
|
771
|
-
}) :
|
|
762
|
+
var d = /* @__PURE__ */ G(a.value);
|
|
763
|
+
return n.set(u, d), d;
|
|
764
|
+
}) : V(c, a.value, !0), !0;
|
|
772
765
|
},
|
|
773
|
-
deleteProperty(l,
|
|
774
|
-
var
|
|
775
|
-
if (
|
|
776
|
-
if (
|
|
777
|
-
const c = o(() => /* @__PURE__ */
|
|
778
|
-
n.set(
|
|
766
|
+
deleteProperty(l, u) {
|
|
767
|
+
var a = n.get(u);
|
|
768
|
+
if (a === void 0) {
|
|
769
|
+
if (u in l) {
|
|
770
|
+
const c = o(() => /* @__PURE__ */ G(P));
|
|
771
|
+
n.set(u, c), ee(s);
|
|
779
772
|
}
|
|
780
773
|
} else
|
|
781
|
-
|
|
774
|
+
V(a, P), ee(s);
|
|
782
775
|
return !0;
|
|
783
776
|
},
|
|
784
|
-
get(l,
|
|
785
|
-
var
|
|
786
|
-
if (
|
|
787
|
-
return
|
|
788
|
-
var c = n.get(
|
|
789
|
-
if (c === void 0 && (!d || (
|
|
790
|
-
var
|
|
791
|
-
return
|
|
792
|
-
}), n.set(
|
|
777
|
+
get(l, u, a) {
|
|
778
|
+
var p;
|
|
779
|
+
if (u === ft)
|
|
780
|
+
return t;
|
|
781
|
+
var c = n.get(u), d = u in l;
|
|
782
|
+
if (c === void 0 && (!d || (p = Wt(l, u)) != null && p.writable) && (c = o(() => {
|
|
783
|
+
var _ = It(d ? l[u] : P), g = /* @__PURE__ */ G(_);
|
|
784
|
+
return g;
|
|
785
|
+
}), n.set(u, c)), c !== void 0) {
|
|
793
786
|
var f = I(c);
|
|
794
|
-
return f ===
|
|
787
|
+
return f === P ? void 0 : f;
|
|
795
788
|
}
|
|
796
|
-
return Reflect.get(l,
|
|
789
|
+
return Reflect.get(l, u, a);
|
|
797
790
|
},
|
|
798
|
-
getOwnPropertyDescriptor(l,
|
|
799
|
-
var
|
|
800
|
-
if (
|
|
801
|
-
var c = n.get(
|
|
802
|
-
c && (
|
|
803
|
-
} else if (
|
|
804
|
-
var d = n.get(
|
|
805
|
-
if (d !== void 0 && f !==
|
|
791
|
+
getOwnPropertyDescriptor(l, u) {
|
|
792
|
+
var a = Reflect.getOwnPropertyDescriptor(l, u);
|
|
793
|
+
if (a && "value" in a) {
|
|
794
|
+
var c = n.get(u);
|
|
795
|
+
c && (a.value = I(c));
|
|
796
|
+
} else if (a === void 0) {
|
|
797
|
+
var d = n.get(u), f = d == null ? void 0 : d.v;
|
|
798
|
+
if (d !== void 0 && f !== P)
|
|
806
799
|
return {
|
|
807
800
|
enumerable: !0,
|
|
808
801
|
configurable: !0,
|
|
@@ -810,129 +803,129 @@ function wt(e) {
|
|
|
810
803
|
writable: !0
|
|
811
804
|
};
|
|
812
805
|
}
|
|
813
|
-
return
|
|
806
|
+
return a;
|
|
814
807
|
},
|
|
815
|
-
has(l,
|
|
808
|
+
has(l, u) {
|
|
816
809
|
var f;
|
|
817
|
-
if (
|
|
810
|
+
if (u === ft)
|
|
818
811
|
return !0;
|
|
819
|
-
var
|
|
820
|
-
if (
|
|
821
|
-
|
|
822
|
-
var
|
|
823
|
-
return
|
|
824
|
-
}), n.set(
|
|
825
|
-
var d = I(
|
|
826
|
-
if (d ===
|
|
812
|
+
var a = n.get(u), c = a !== void 0 && a.v !== P || Reflect.has(l, u);
|
|
813
|
+
if (a !== void 0 || N !== null && (!c || (f = Wt(l, u)) != null && f.writable)) {
|
|
814
|
+
a === void 0 && (a = o(() => {
|
|
815
|
+
var p = c ? It(l[u]) : P, _ = /* @__PURE__ */ G(p);
|
|
816
|
+
return _;
|
|
817
|
+
}), n.set(u, a));
|
|
818
|
+
var d = I(a);
|
|
819
|
+
if (d === P)
|
|
827
820
|
return !1;
|
|
828
821
|
}
|
|
829
822
|
return c;
|
|
830
823
|
},
|
|
831
|
-
set(l,
|
|
832
|
-
var
|
|
833
|
-
var d = n.get(
|
|
834
|
-
if (i &&
|
|
835
|
-
for (var
|
|
836
|
-
d.v;
|
|
837
|
-
var
|
|
838
|
-
|
|
824
|
+
set(l, u, a, c) {
|
|
825
|
+
var h;
|
|
826
|
+
var d = n.get(u), f = u in l;
|
|
827
|
+
if (i && u === "length")
|
|
828
|
+
for (var p = a; p < /** @type {Source<number>} */
|
|
829
|
+
d.v; p += 1) {
|
|
830
|
+
var _ = n.get(p + "");
|
|
831
|
+
_ !== void 0 ? V(_, P) : p in l && (_ = o(() => /* @__PURE__ */ G(P)), n.set(p + "", _));
|
|
839
832
|
}
|
|
840
833
|
if (d === void 0)
|
|
841
|
-
(!f || (
|
|
834
|
+
(!f || (h = Wt(l, u)) != null && h.writable) && (d = o(() => /* @__PURE__ */ G(void 0)), V(d, It(a)), n.set(u, d));
|
|
842
835
|
else {
|
|
843
|
-
f = d.v !==
|
|
844
|
-
var
|
|
845
|
-
|
|
836
|
+
f = d.v !== P;
|
|
837
|
+
var g = o(() => It(a));
|
|
838
|
+
V(d, g);
|
|
846
839
|
}
|
|
847
|
-
var
|
|
848
|
-
if (
|
|
849
|
-
if (i && typeof
|
|
840
|
+
var b = Reflect.getOwnPropertyDescriptor(l, u);
|
|
841
|
+
if (b != null && b.set && b.set.call(c, a), !f) {
|
|
842
|
+
if (i && typeof u == "string") {
|
|
850
843
|
var y = (
|
|
851
844
|
/** @type {Source<number>} */
|
|
852
845
|
n.get("length")
|
|
853
|
-
), v = Number(
|
|
854
|
-
Number.isInteger(v) && v >= y.v &&
|
|
846
|
+
), v = Number(u);
|
|
847
|
+
Number.isInteger(v) && v >= y.v && V(y, v + 1);
|
|
855
848
|
}
|
|
856
|
-
|
|
849
|
+
ee(s);
|
|
857
850
|
}
|
|
858
851
|
return !0;
|
|
859
852
|
},
|
|
860
853
|
ownKeys(l) {
|
|
861
854
|
I(s);
|
|
862
|
-
var
|
|
855
|
+
var u = Reflect.ownKeys(l).filter((d) => {
|
|
863
856
|
var f = n.get(d);
|
|
864
|
-
return f === void 0 || f.v !==
|
|
857
|
+
return f === void 0 || f.v !== P;
|
|
865
858
|
});
|
|
866
|
-
for (var [
|
|
867
|
-
c.v !==
|
|
868
|
-
return
|
|
859
|
+
for (var [a, c] of n)
|
|
860
|
+
c.v !== P && !(a in l) && u.push(a);
|
|
861
|
+
return u;
|
|
869
862
|
},
|
|
870
863
|
setPrototypeOf() {
|
|
871
|
-
|
|
864
|
+
hi();
|
|
872
865
|
}
|
|
873
866
|
}
|
|
874
867
|
);
|
|
875
868
|
}
|
|
876
|
-
function ke(
|
|
869
|
+
function ke(t) {
|
|
877
870
|
try {
|
|
878
|
-
if (
|
|
879
|
-
return
|
|
871
|
+
if (t !== null && typeof t == "object" && ft in t)
|
|
872
|
+
return t[ft];
|
|
880
873
|
} catch {
|
|
881
874
|
}
|
|
882
|
-
return
|
|
875
|
+
return t;
|
|
883
876
|
}
|
|
884
|
-
function
|
|
885
|
-
return Object.is(ke(
|
|
877
|
+
function Ri(t, e) {
|
|
878
|
+
return Object.is(ke(t), ke(e));
|
|
886
879
|
}
|
|
887
|
-
var
|
|
880
|
+
var ki, Mi, xi;
|
|
888
881
|
// @__NO_SIDE_EFFECTS__
|
|
889
|
-
function
|
|
882
|
+
function Ui(t) {
|
|
890
883
|
return (
|
|
891
884
|
/** @type {TemplateNode | null} */
|
|
892
|
-
|
|
885
|
+
Mi.call(t)
|
|
893
886
|
);
|
|
894
887
|
}
|
|
895
888
|
// @__NO_SIDE_EFFECTS__
|
|
896
|
-
function
|
|
889
|
+
function Hi(t) {
|
|
897
890
|
return (
|
|
898
891
|
/** @type {TemplateNode | null} */
|
|
899
|
-
|
|
892
|
+
xi.call(t)
|
|
900
893
|
);
|
|
901
894
|
}
|
|
902
|
-
function
|
|
903
|
-
if (
|
|
895
|
+
function Fi(t, e) {
|
|
896
|
+
if (e) {
|
|
904
897
|
const n = document.body;
|
|
905
|
-
|
|
906
|
-
document.activeElement === n &&
|
|
898
|
+
t.autofocus = !0, Jt(() => {
|
|
899
|
+
document.activeElement === n && t.focus();
|
|
907
900
|
});
|
|
908
901
|
}
|
|
909
902
|
}
|
|
910
|
-
function Le(
|
|
911
|
-
var
|
|
912
|
-
|
|
903
|
+
function Le(t) {
|
|
904
|
+
var e = w, n = N;
|
|
905
|
+
Q(null), st(null);
|
|
913
906
|
try {
|
|
914
|
-
return
|
|
907
|
+
return t();
|
|
915
908
|
} finally {
|
|
916
|
-
|
|
909
|
+
Q(e), st(n);
|
|
917
910
|
}
|
|
918
911
|
}
|
|
919
|
-
function
|
|
920
|
-
|
|
912
|
+
function Bi(t) {
|
|
913
|
+
N === null && (w === null && ai(), ui()), it && li();
|
|
921
914
|
}
|
|
922
|
-
function
|
|
923
|
-
var n =
|
|
924
|
-
n === null ?
|
|
915
|
+
function Vi(t, e) {
|
|
916
|
+
var n = e.last;
|
|
917
|
+
n === null ? e.last = e.first = t : (n.next = t, t.prev = n, e.last = t);
|
|
925
918
|
}
|
|
926
|
-
function
|
|
927
|
-
var i =
|
|
928
|
-
i !== null && (i.f &
|
|
919
|
+
function gt(t, e, n) {
|
|
920
|
+
var i = N;
|
|
921
|
+
i !== null && (i.f & Et) !== 0 && (t |= Et);
|
|
929
922
|
var s = {
|
|
930
|
-
ctx:
|
|
923
|
+
ctx: X,
|
|
931
924
|
deps: null,
|
|
932
925
|
nodes: null,
|
|
933
|
-
f:
|
|
926
|
+
f: t | W | Y,
|
|
934
927
|
first: null,
|
|
935
|
-
fn:
|
|
928
|
+
fn: e,
|
|
936
929
|
last: null,
|
|
937
930
|
next: null,
|
|
938
931
|
parent: i,
|
|
@@ -944,14 +937,14 @@ function yt(e, t, n) {
|
|
|
944
937
|
};
|
|
945
938
|
if (n)
|
|
946
939
|
try {
|
|
947
|
-
|
|
940
|
+
Mt(s), s.f |= be;
|
|
948
941
|
} catch (l) {
|
|
949
|
-
throw
|
|
942
|
+
throw Ct(s), l;
|
|
950
943
|
}
|
|
951
|
-
else
|
|
944
|
+
else e !== null && St(s);
|
|
952
945
|
var r = s;
|
|
953
946
|
if (n && r.deps === null && r.teardown === null && r.nodes === null && r.first === r.last && // either `null`, or a singular child
|
|
954
|
-
(r.f &
|
|
947
|
+
(r.f & Zt) === 0 && (r = r.first, (t & yt) !== 0 && (t & Pe) !== 0 && r !== null && (r.f |= Pe)), r !== null && (r.parent = i, i !== null && Vi(r, i), w !== null && (w.f & k) !== 0 && (t & Pt) === 0)) {
|
|
955
948
|
var o = (
|
|
956
949
|
/** @type {Derived} */
|
|
957
950
|
w
|
|
@@ -960,435 +953,442 @@ function yt(e, t, n) {
|
|
|
960
953
|
}
|
|
961
954
|
return s;
|
|
962
955
|
}
|
|
963
|
-
function
|
|
964
|
-
return w !== null && !
|
|
956
|
+
function pn() {
|
|
957
|
+
return w !== null && !q;
|
|
965
958
|
}
|
|
966
|
-
function
|
|
967
|
-
const
|
|
968
|
-
return
|
|
959
|
+
function _n(t) {
|
|
960
|
+
const e = gt(ge, null, !1);
|
|
961
|
+
return H(e, x), e.teardown = t, e;
|
|
969
962
|
}
|
|
970
|
-
function
|
|
971
|
-
|
|
972
|
-
var
|
|
963
|
+
function Wi(t) {
|
|
964
|
+
Bi();
|
|
965
|
+
var e = (
|
|
973
966
|
/** @type {Effect} */
|
|
974
|
-
|
|
975
|
-
), n = !w && (
|
|
967
|
+
N.f
|
|
968
|
+
), n = !w && (e & vt) !== 0 && (e & be) === 0;
|
|
976
969
|
if (n) {
|
|
977
970
|
var i = (
|
|
978
971
|
/** @type {ComponentContext} */
|
|
979
|
-
|
|
972
|
+
X
|
|
980
973
|
);
|
|
981
|
-
(i.e ?? (i.e = [])).push(
|
|
974
|
+
(i.e ?? (i.e = [])).push(t);
|
|
982
975
|
} else
|
|
983
|
-
return
|
|
976
|
+
return Cn(t);
|
|
984
977
|
}
|
|
985
|
-
function
|
|
986
|
-
return
|
|
978
|
+
function Cn(t) {
|
|
979
|
+
return gt(Gt | ii, t, !1);
|
|
987
980
|
}
|
|
988
|
-
function Ae(
|
|
989
|
-
return
|
|
981
|
+
function Ae(t) {
|
|
982
|
+
return gt(Gt, t, !1);
|
|
990
983
|
}
|
|
991
|
-
function
|
|
992
|
-
return
|
|
984
|
+
function ji(t) {
|
|
985
|
+
return gt(we | Zt, t, !0);
|
|
993
986
|
}
|
|
994
|
-
function
|
|
995
|
-
return
|
|
987
|
+
function Gi(t, e = 0) {
|
|
988
|
+
return gt(ge | e, t, !0);
|
|
996
989
|
}
|
|
997
|
-
function
|
|
998
|
-
var n =
|
|
990
|
+
function yn(t, e = 0) {
|
|
991
|
+
var n = gt(me | e, t, !0);
|
|
999
992
|
return n;
|
|
1000
993
|
}
|
|
1001
|
-
function
|
|
1002
|
-
return
|
|
994
|
+
function vn(t) {
|
|
995
|
+
return gt(vt | Zt, t, !0);
|
|
1003
996
|
}
|
|
1004
|
-
function
|
|
1005
|
-
var
|
|
1006
|
-
if (
|
|
1007
|
-
const n =
|
|
1008
|
-
Me(!0),
|
|
997
|
+
function gn(t) {
|
|
998
|
+
var e = t.teardown;
|
|
999
|
+
if (e !== null) {
|
|
1000
|
+
const n = it, i = w;
|
|
1001
|
+
Me(!0), Q(null);
|
|
1009
1002
|
try {
|
|
1010
|
-
|
|
1003
|
+
e.call(null);
|
|
1011
1004
|
} finally {
|
|
1012
|
-
Me(n),
|
|
1005
|
+
Me(n), Q(i);
|
|
1013
1006
|
}
|
|
1014
1007
|
}
|
|
1015
1008
|
}
|
|
1016
|
-
function mn(
|
|
1017
|
-
var n =
|
|
1018
|
-
for (
|
|
1009
|
+
function mn(t, e = !1) {
|
|
1010
|
+
var n = t.first;
|
|
1011
|
+
for (t.first = t.last = null; n !== null; ) {
|
|
1019
1012
|
const s = n.ac;
|
|
1020
1013
|
s !== null && Le(() => {
|
|
1021
|
-
s.abort(
|
|
1014
|
+
s.abort(bt);
|
|
1022
1015
|
});
|
|
1023
1016
|
var i = n.next;
|
|
1024
|
-
(n.f &
|
|
1017
|
+
(n.f & Pt) !== 0 ? n.parent = null : Ct(n, e), n = i;
|
|
1025
1018
|
}
|
|
1026
1019
|
}
|
|
1027
|
-
function
|
|
1028
|
-
for (var
|
|
1029
|
-
var n =
|
|
1030
|
-
(
|
|
1020
|
+
function Yi(t) {
|
|
1021
|
+
for (var e = t.first; e !== null; ) {
|
|
1022
|
+
var n = e.next;
|
|
1023
|
+
(e.f & vt) === 0 && Ct(e), e = n;
|
|
1031
1024
|
}
|
|
1032
1025
|
}
|
|
1033
|
-
function
|
|
1026
|
+
function Ct(t, e = !0) {
|
|
1034
1027
|
var n = !1;
|
|
1035
|
-
(
|
|
1036
|
-
|
|
1028
|
+
(e || (t.f & tn) !== 0) && t.nodes !== null && t.nodes.end !== null && (Ki(
|
|
1029
|
+
t.nodes.start,
|
|
1037
1030
|
/** @type {TemplateNode} */
|
|
1038
|
-
|
|
1039
|
-
), n = !0), mn(
|
|
1040
|
-
var i =
|
|
1031
|
+
t.nodes.end
|
|
1032
|
+
), n = !0), mn(t, e && !n), Xt(t, 0), H(t, J);
|
|
1033
|
+
var i = t.nodes && t.nodes.t;
|
|
1041
1034
|
if (i !== null)
|
|
1042
1035
|
for (const r of i)
|
|
1043
1036
|
r.stop();
|
|
1044
|
-
|
|
1045
|
-
var s =
|
|
1046
|
-
s !== null && s.first !== null &&
|
|
1037
|
+
gn(t);
|
|
1038
|
+
var s = t.parent;
|
|
1039
|
+
s !== null && s.first !== null && bn(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.fn = t.nodes = t.ac = null;
|
|
1047
1040
|
}
|
|
1048
|
-
function
|
|
1049
|
-
for (;
|
|
1050
|
-
var n =
|
|
1051
|
-
|
|
1041
|
+
function Ki(t, e) {
|
|
1042
|
+
for (; t !== null; ) {
|
|
1043
|
+
var n = t === e ? null : /* @__PURE__ */ Hi(t);
|
|
1044
|
+
t.remove(), t = n;
|
|
1052
1045
|
}
|
|
1053
1046
|
}
|
|
1054
|
-
function
|
|
1055
|
-
var
|
|
1056
|
-
n !== null && (n.next = i), i !== null && (i.prev = n),
|
|
1047
|
+
function bn(t) {
|
|
1048
|
+
var e = t.parent, n = t.prev, i = t.next;
|
|
1049
|
+
n !== null && (n.next = i), i !== null && (i.prev = n), e !== null && (e.first === t && (e.first = i), e.last === t && (e.last = n));
|
|
1057
1050
|
}
|
|
1058
|
-
let
|
|
1059
|
-
function
|
|
1060
|
-
|
|
1051
|
+
let ht = !1;
|
|
1052
|
+
function $t(t) {
|
|
1053
|
+
ht = t;
|
|
1061
1054
|
}
|
|
1062
|
-
let
|
|
1063
|
-
function Me(
|
|
1064
|
-
|
|
1055
|
+
let it = !1;
|
|
1056
|
+
function Me(t) {
|
|
1057
|
+
it = t;
|
|
1065
1058
|
}
|
|
1066
|
-
let w = null,
|
|
1067
|
-
function
|
|
1068
|
-
w =
|
|
1059
|
+
let w = null, q = !1;
|
|
1060
|
+
function Q(t) {
|
|
1061
|
+
w = t;
|
|
1069
1062
|
}
|
|
1070
|
-
let
|
|
1071
|
-
function
|
|
1072
|
-
|
|
1063
|
+
let N = null;
|
|
1064
|
+
function st(t) {
|
|
1065
|
+
N = t;
|
|
1073
1066
|
}
|
|
1074
|
-
let
|
|
1075
|
-
function
|
|
1076
|
-
w !== null && (
|
|
1067
|
+
let U = null;
|
|
1068
|
+
function zi(t) {
|
|
1069
|
+
w !== null && (U === null ? U = [t] : U.push(t));
|
|
1077
1070
|
}
|
|
1078
|
-
let
|
|
1079
|
-
function
|
|
1080
|
-
|
|
1071
|
+
let F = null, B = 0, j = null;
|
|
1072
|
+
function qi(t) {
|
|
1073
|
+
j = t;
|
|
1081
1074
|
}
|
|
1082
|
-
let
|
|
1083
|
-
function xe(
|
|
1084
|
-
|
|
1075
|
+
let wn = 1, at = 0, pt = at;
|
|
1076
|
+
function xe(t) {
|
|
1077
|
+
pt = t;
|
|
1085
1078
|
}
|
|
1086
|
-
function
|
|
1087
|
-
return ++
|
|
1079
|
+
function In() {
|
|
1080
|
+
return ++wn;
|
|
1088
1081
|
}
|
|
1089
|
-
function
|
|
1090
|
-
var
|
|
1091
|
-
if ((
|
|
1082
|
+
function Ut(t) {
|
|
1083
|
+
var e = t.f;
|
|
1084
|
+
if ((e & W) !== 0)
|
|
1092
1085
|
return !0;
|
|
1093
|
-
if (
|
|
1094
|
-
var n =
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1086
|
+
if (e & k && (t.f &= ~_t), (e & rt) !== 0) {
|
|
1087
|
+
for (var n = (
|
|
1088
|
+
/** @type {Value[]} */
|
|
1089
|
+
t.deps
|
|
1090
|
+
), i = n.length, s = 0; s < i; s++) {
|
|
1091
|
+
var r = n[s];
|
|
1092
|
+
if (Ut(
|
|
1093
|
+
/** @type {Derived} */
|
|
1094
|
+
r
|
|
1095
|
+
) && cn(
|
|
1096
|
+
/** @type {Derived} */
|
|
1097
|
+
r
|
|
1098
|
+
), r.wv > t.wv)
|
|
1099
|
+
return !0;
|
|
1100
|
+
}
|
|
1101
|
+
(e & Y) !== 0 && // During time traveling we don't want to reset the status so that
|
|
1108
1102
|
// traversal of the graph in the other batches still happens
|
|
1109
|
-
|
|
1103
|
+
R === null && H(t, x);
|
|
1110
1104
|
}
|
|
1111
1105
|
return !1;
|
|
1112
1106
|
}
|
|
1113
|
-
function
|
|
1114
|
-
var i =
|
|
1115
|
-
if (i !== null && !(
|
|
1107
|
+
function En(t, e, n = !0) {
|
|
1108
|
+
var i = t.reactions;
|
|
1109
|
+
if (i !== null && !(U != null && U.includes(t)))
|
|
1116
1110
|
for (var s = 0; s < i.length; s++) {
|
|
1117
1111
|
var r = i[s];
|
|
1118
|
-
(r.f &
|
|
1112
|
+
(r.f & k) !== 0 ? En(
|
|
1119
1113
|
/** @type {Derived} */
|
|
1120
1114
|
r,
|
|
1121
|
-
|
|
1115
|
+
e,
|
|
1122
1116
|
!1
|
|
1123
|
-
) :
|
|
1117
|
+
) : e === r && (n ? H(r, W) : (r.f & x) !== 0 && H(r, rt), St(
|
|
1124
1118
|
/** @type {Effect} */
|
|
1125
1119
|
r
|
|
1126
1120
|
));
|
|
1127
1121
|
}
|
|
1128
1122
|
}
|
|
1129
|
-
function
|
|
1130
|
-
var
|
|
1131
|
-
var
|
|
1132
|
-
|
|
1133
|
-
null,
|
|
1134
|
-
|
|
1135
|
-
}),
|
|
1123
|
+
function Nn(t) {
|
|
1124
|
+
var _;
|
|
1125
|
+
var e = F, n = B, i = j, s = w, r = U, o = X, l = q, u = pt, a = t.f;
|
|
1126
|
+
F = /** @type {null | Value[]} */
|
|
1127
|
+
null, B = 0, j = null, w = (a & (vt | Pt)) === 0 ? t : null, U = null, Yt(t.ctx), q = !1, pt = ++at, t.ac !== null && (Le(() => {
|
|
1128
|
+
t.ac.abort(bt);
|
|
1129
|
+
}), t.ac = null);
|
|
1136
1130
|
try {
|
|
1137
|
-
|
|
1131
|
+
t.f |= de;
|
|
1138
1132
|
var c = (
|
|
1139
1133
|
/** @type {Function} */
|
|
1140
|
-
|
|
1141
|
-
), d = c(), f =
|
|
1142
|
-
if (
|
|
1143
|
-
var
|
|
1144
|
-
if (
|
|
1145
|
-
for (f.length =
|
|
1146
|
-
f[
|
|
1134
|
+
t.fn
|
|
1135
|
+
), d = c(), f = t.deps;
|
|
1136
|
+
if (F !== null) {
|
|
1137
|
+
var p;
|
|
1138
|
+
if (Xt(t, B), f !== null && B > 0)
|
|
1139
|
+
for (f.length = B + F.length, p = 0; p < F.length; p++)
|
|
1140
|
+
f[B + p] = F[p];
|
|
1147
1141
|
else
|
|
1148
|
-
|
|
1149
|
-
if (
|
|
1150
|
-
for (
|
|
1151
|
-
((
|
|
1152
|
-
} else f !== null &&
|
|
1153
|
-
if (
|
|
1154
|
-
for (
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1142
|
+
t.deps = f = F;
|
|
1143
|
+
if (pn() && (t.f & Y) !== 0)
|
|
1144
|
+
for (p = B; p < f.length; p++)
|
|
1145
|
+
((_ = f[p]).reactions ?? (_.reactions = [])).push(t);
|
|
1146
|
+
} else f !== null && B < f.length && (Xt(t, B), f.length = B);
|
|
1147
|
+
if (nn() && j !== null && !q && f !== null && (t.f & (k | rt | W)) === 0)
|
|
1148
|
+
for (p = 0; p < /** @type {Source[]} */
|
|
1149
|
+
j.length; p++)
|
|
1150
|
+
En(
|
|
1151
|
+
j[p],
|
|
1158
1152
|
/** @type {Effect} */
|
|
1159
|
-
|
|
1153
|
+
t
|
|
1160
1154
|
);
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1155
|
+
if (s !== null && s !== t) {
|
|
1156
|
+
if (at++, s.deps !== null)
|
|
1157
|
+
for (let g = 0; g < n; g += 1)
|
|
1158
|
+
s.deps[g].rv = at;
|
|
1159
|
+
if (e !== null)
|
|
1160
|
+
for (const g of e)
|
|
1161
|
+
g.rv = at;
|
|
1162
|
+
j !== null && (i === null ? i = j : i.push(.../** @type {Source[]} */
|
|
1163
|
+
j));
|
|
1164
|
+
}
|
|
1165
|
+
return (t.f & et) !== 0 && (t.f ^= et), d;
|
|
1166
|
+
} catch (g) {
|
|
1167
|
+
return wi(g);
|
|
1165
1168
|
} finally {
|
|
1166
|
-
|
|
1169
|
+
t.f ^= de, F = e, B = n, j = i, w = s, U = r, Yt(o), q = l, pt = u;
|
|
1167
1170
|
}
|
|
1168
1171
|
}
|
|
1169
|
-
function
|
|
1170
|
-
let n =
|
|
1172
|
+
function $i(t, e) {
|
|
1173
|
+
let n = e.reactions;
|
|
1171
1174
|
if (n !== null) {
|
|
1172
|
-
var i =
|
|
1175
|
+
var i = Qn.call(n, t);
|
|
1173
1176
|
if (i !== -1) {
|
|
1174
1177
|
var s = n.length - 1;
|
|
1175
|
-
s === 0 ? n =
|
|
1178
|
+
s === 0 ? n = e.reactions = null : (n[i] = n[s], n.pop());
|
|
1176
1179
|
}
|
|
1177
1180
|
}
|
|
1178
|
-
n === null && (
|
|
1181
|
+
if (n === null && (e.f & k) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
|
|
1179
1182
|
// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
|
|
1180
1183
|
// allows us to skip the expensive work of disconnecting and immediately reconnecting it
|
|
1181
|
-
(
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
));
|
|
1184
|
+
(F === null || !F.includes(e))) {
|
|
1185
|
+
var r = (
|
|
1186
|
+
/** @type {Derived} */
|
|
1187
|
+
e
|
|
1188
|
+
);
|
|
1189
|
+
(r.f & Y) !== 0 && (r.f ^= Y, r.f &= ~_t), Ie(r), an(r), Xt(r, 0);
|
|
1190
|
+
}
|
|
1189
1191
|
}
|
|
1190
|
-
function
|
|
1191
|
-
var n =
|
|
1192
|
+
function Xt(t, e) {
|
|
1193
|
+
var n = t.deps;
|
|
1192
1194
|
if (n !== null)
|
|
1193
|
-
for (var i =
|
|
1194
|
-
|
|
1195
|
-
}
|
|
1196
|
-
function
|
|
1197
|
-
var
|
|
1198
|
-
if ((
|
|
1199
|
-
|
|
1200
|
-
var n =
|
|
1201
|
-
|
|
1195
|
+
for (var i = e; i < n.length; i++)
|
|
1196
|
+
$i(t, n[i]);
|
|
1197
|
+
}
|
|
1198
|
+
function Mt(t) {
|
|
1199
|
+
var e = t.f;
|
|
1200
|
+
if ((e & J) === 0) {
|
|
1201
|
+
H(t, x);
|
|
1202
|
+
var n = N, i = ht;
|
|
1203
|
+
N = t, ht = !0;
|
|
1202
1204
|
try {
|
|
1203
|
-
(
|
|
1204
|
-
var s =
|
|
1205
|
-
|
|
1205
|
+
(e & (yt | me)) !== 0 ? Yi(t) : mn(t), gn(t);
|
|
1206
|
+
var s = Nn(t);
|
|
1207
|
+
t.teardown = typeof s == "function" ? s : null, t.wv = wn;
|
|
1206
1208
|
var r;
|
|
1207
|
-
|
|
1209
|
+
ce && vi && (t.f & W) !== 0 && t.deps;
|
|
1208
1210
|
} finally {
|
|
1209
|
-
|
|
1211
|
+
ht = i, N = n;
|
|
1210
1212
|
}
|
|
1211
1213
|
}
|
|
1212
1214
|
}
|
|
1213
|
-
function I(
|
|
1214
|
-
var
|
|
1215
|
-
if (w !== null && !
|
|
1216
|
-
var i =
|
|
1217
|
-
if (!i && !(
|
|
1215
|
+
function I(t) {
|
|
1216
|
+
var e = t.f, n = (e & k) !== 0;
|
|
1217
|
+
if (w !== null && !q) {
|
|
1218
|
+
var i = N !== null && (N.f & J) !== 0;
|
|
1219
|
+
if (!i && !(U != null && U.includes(t))) {
|
|
1218
1220
|
var s = w.deps;
|
|
1219
|
-
if ((w.f &
|
|
1220
|
-
|
|
1221
|
+
if ((w.f & de) !== 0)
|
|
1222
|
+
t.rv < at && (t.rv = at, F === null && s !== null && s[B] === t ? B++ : F === null ? F = [t] : F.push(t));
|
|
1221
1223
|
else {
|
|
1222
|
-
(w.deps ?? (w.deps = [])).push(
|
|
1223
|
-
var r =
|
|
1224
|
-
r === null ?
|
|
1224
|
+
(w.deps ?? (w.deps = [])).push(t);
|
|
1225
|
+
var r = t.reactions;
|
|
1226
|
+
r === null ? t.reactions = [w] : r.includes(w) || r.push(w);
|
|
1225
1227
|
}
|
|
1226
1228
|
}
|
|
1227
1229
|
}
|
|
1228
|
-
if (
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1230
|
+
if (it && nt.has(t))
|
|
1231
|
+
return nt.get(t);
|
|
1232
|
+
if (n) {
|
|
1233
|
+
var o = (
|
|
1234
|
+
/** @type {Derived} */
|
|
1235
|
+
t
|
|
1236
|
+
);
|
|
1237
|
+
if (it) {
|
|
1238
|
+
var l = o.v;
|
|
1239
|
+
return ((o.f & x) === 0 && o.reactions !== null || Ln(o)) && (l = De(o)), nt.set(o, l), l;
|
|
1237
1240
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1241
|
+
var u = (o.f & Y) === 0 && !q && w !== null && (ht || (w.f & Y) !== 0), a = o.deps === null;
|
|
1242
|
+
Ut(o) && (u && (o.f |= Y), cn(o)), u && !a && Dn(o);
|
|
1243
|
+
}
|
|
1244
|
+
if (R != null && R.has(t))
|
|
1245
|
+
return R.get(t);
|
|
1246
|
+
if ((t.f & et) !== 0)
|
|
1247
|
+
throw t.v;
|
|
1248
|
+
return t.v;
|
|
1249
|
+
}
|
|
1250
|
+
function Dn(t) {
|
|
1251
|
+
if (t.deps !== null) {
|
|
1252
|
+
t.f |= Y;
|
|
1253
|
+
for (const e of t.deps)
|
|
1254
|
+
(e.reactions ?? (e.reactions = [])).push(t), (e.f & k) !== 0 && (e.f & Y) === 0 && Dn(
|
|
1251
1255
|
/** @type {Derived} */
|
|
1252
|
-
|
|
1256
|
+
e
|
|
1253
1257
|
);
|
|
1254
1258
|
}
|
|
1255
1259
|
}
|
|
1256
|
-
function
|
|
1257
|
-
if (
|
|
1258
|
-
if (
|
|
1259
|
-
for (const
|
|
1260
|
-
if (
|
|
1260
|
+
function Ln(t) {
|
|
1261
|
+
if (t.v === P) return !0;
|
|
1262
|
+
if (t.deps === null) return !1;
|
|
1263
|
+
for (const e of t.deps)
|
|
1264
|
+
if (nt.has(e) || (e.f & k) !== 0 && Ln(
|
|
1261
1265
|
/** @type {Derived} */
|
|
1262
|
-
|
|
1266
|
+
e
|
|
1263
1267
|
))
|
|
1264
1268
|
return !0;
|
|
1265
1269
|
return !1;
|
|
1266
1270
|
}
|
|
1267
|
-
function
|
|
1268
|
-
var
|
|
1271
|
+
function An(t) {
|
|
1272
|
+
var e = q;
|
|
1269
1273
|
try {
|
|
1270
|
-
return
|
|
1274
|
+
return q = !0, t();
|
|
1271
1275
|
} finally {
|
|
1272
|
-
|
|
1276
|
+
q = e;
|
|
1273
1277
|
}
|
|
1274
1278
|
}
|
|
1275
|
-
const
|
|
1276
|
-
function
|
|
1277
|
-
e.f = e.f & zi | t;
|
|
1278
|
-
}
|
|
1279
|
-
const qi = /* @__PURE__ */ new Set(), $i = /* @__PURE__ */ new Set();
|
|
1280
|
-
function Xi(e, t, n, i = {}) {
|
|
1279
|
+
const Xi = /* @__PURE__ */ new Set(), Qi = /* @__PURE__ */ new Set();
|
|
1280
|
+
function Zi(t, e, n, i = {}) {
|
|
1281
1281
|
function s(r) {
|
|
1282
|
-
if (i.capture ||
|
|
1282
|
+
if (i.capture || ts.call(e, r), !r.cancelBubble)
|
|
1283
1283
|
return Le(() => n == null ? void 0 : n.call(this, r));
|
|
1284
1284
|
}
|
|
1285
|
-
return
|
|
1286
|
-
|
|
1287
|
-
}) :
|
|
1285
|
+
return t.startsWith("pointer") || t.startsWith("touch") || t === "wheel" ? Jt(() => {
|
|
1286
|
+
e.addEventListener(t, s, i);
|
|
1287
|
+
}) : e.addEventListener(t, s, i), s;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1290
|
-
for (var
|
|
1291
|
-
|
|
1292
|
-
for (var n of
|
|
1293
|
-
n(
|
|
1289
|
+
function Ji(t) {
|
|
1290
|
+
for (var e = 0; e < t.length; e++)
|
|
1291
|
+
Xi.add(t[e]);
|
|
1292
|
+
for (var n of Qi)
|
|
1293
|
+
n(t);
|
|
1294
1294
|
}
|
|
1295
1295
|
let Ue = null;
|
|
1296
|
-
function
|
|
1297
|
-
var
|
|
1298
|
-
var
|
|
1296
|
+
function ts(t) {
|
|
1297
|
+
var b;
|
|
1298
|
+
var e = this, n = (
|
|
1299
1299
|
/** @type {Node} */
|
|
1300
|
-
|
|
1301
|
-
), i =
|
|
1300
|
+
e.ownerDocument
|
|
1301
|
+
), i = t.type, s = ((b = t.composedPath) == null ? void 0 : b.call(t)) || [], r = (
|
|
1302
1302
|
/** @type {null | Element} */
|
|
1303
|
-
s[0] ||
|
|
1303
|
+
s[0] || t.target
|
|
1304
1304
|
);
|
|
1305
|
-
Ue =
|
|
1306
|
-
var o = 0, l = Ue ===
|
|
1305
|
+
Ue = t;
|
|
1306
|
+
var o = 0, l = Ue === t && t.__root;
|
|
1307
1307
|
if (l) {
|
|
1308
|
-
var
|
|
1309
|
-
if (
|
|
1308
|
+
var u = s.indexOf(l);
|
|
1309
|
+
if (u !== -1 && (e === document || e === /** @type {any} */
|
|
1310
1310
|
window)) {
|
|
1311
|
-
|
|
1311
|
+
t.__root = e;
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
|
-
var
|
|
1315
|
-
if (
|
|
1314
|
+
var a = s.indexOf(e);
|
|
1315
|
+
if (a === -1)
|
|
1316
1316
|
return;
|
|
1317
|
-
|
|
1317
|
+
u <= a && (o = u);
|
|
1318
1318
|
}
|
|
1319
1319
|
if (r = /** @type {Element} */
|
|
1320
|
-
s[o] ||
|
|
1321
|
-
|
|
1320
|
+
s[o] || t.target, r !== e) {
|
|
1321
|
+
Zn(t, "currentTarget", {
|
|
1322
1322
|
configurable: !0,
|
|
1323
1323
|
get() {
|
|
1324
1324
|
return r || n;
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
|
-
var c = w, d =
|
|
1328
|
-
|
|
1327
|
+
var c = w, d = N;
|
|
1328
|
+
Q(null), st(null);
|
|
1329
1329
|
try {
|
|
1330
|
-
for (var f,
|
|
1331
|
-
var
|
|
1330
|
+
for (var f, p = []; r !== null; ) {
|
|
1331
|
+
var _ = r.assignedSlot || r.parentNode || /** @type {any} */
|
|
1332
1332
|
r.host || null;
|
|
1333
1333
|
try {
|
|
1334
|
-
var
|
|
1335
|
-
|
|
1334
|
+
var g = r["__" + i];
|
|
1335
|
+
g != null && (!/** @type {any} */
|
|
1336
1336
|
r.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
|
|
1337
1337
|
// -> the target could not have been disabled because it emits the event in the first place
|
|
1338
|
-
|
|
1338
|
+
t.target === r) && g.call(r, t);
|
|
1339
1339
|
} catch (y) {
|
|
1340
|
-
f ?
|
|
1340
|
+
f ? p.push(y) : f = y;
|
|
1341
1341
|
}
|
|
1342
|
-
if (
|
|
1342
|
+
if (t.cancelBubble || _ === e || _ === null)
|
|
1343
1343
|
break;
|
|
1344
|
-
r =
|
|
1344
|
+
r = _;
|
|
1345
1345
|
}
|
|
1346
1346
|
if (f) {
|
|
1347
|
-
for (let y of
|
|
1347
|
+
for (let y of p)
|
|
1348
1348
|
queueMicrotask(() => {
|
|
1349
1349
|
throw y;
|
|
1350
1350
|
});
|
|
1351
1351
|
throw f;
|
|
1352
1352
|
}
|
|
1353
1353
|
} finally {
|
|
1354
|
-
|
|
1354
|
+
t.__root = e, delete t.currentTarget, Q(c), st(d);
|
|
1355
1355
|
}
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
|
-
function
|
|
1359
|
-
var
|
|
1360
|
-
return
|
|
1358
|
+
function es(t) {
|
|
1359
|
+
var e = document.createElement("template");
|
|
1360
|
+
return e.innerHTML = t.replaceAll("<!>", "<!---->"), e.content;
|
|
1361
1361
|
}
|
|
1362
|
-
function
|
|
1362
|
+
function ns(t, e) {
|
|
1363
1363
|
var n = (
|
|
1364
1364
|
/** @type {Effect} */
|
|
1365
|
-
|
|
1365
|
+
N
|
|
1366
1366
|
);
|
|
1367
|
-
n.nodes === null && (n.nodes = { start:
|
|
1367
|
+
n.nodes === null && (n.nodes = { start: t, end: e, a: null, t: null });
|
|
1368
1368
|
}
|
|
1369
1369
|
// @__NO_SIDE_EFFECTS__
|
|
1370
|
-
function
|
|
1371
|
-
var n = (
|
|
1370
|
+
function is(t, e) {
|
|
1371
|
+
var n = (e & qn) !== 0, i, s = !t.startsWith("<!>");
|
|
1372
1372
|
return () => {
|
|
1373
|
-
i === void 0 && (i =
|
|
1374
|
-
/* @__PURE__ */
|
|
1373
|
+
i === void 0 && (i = es(s ? t : "<!>" + t), i = /** @type {TemplateNode} */
|
|
1374
|
+
/* @__PURE__ */ Ui(i));
|
|
1375
1375
|
var r = (
|
|
1376
1376
|
/** @type {TemplateNode} */
|
|
1377
|
-
n ||
|
|
1377
|
+
n || ki ? document.importNode(i, !0) : i.cloneNode(!0)
|
|
1378
1378
|
);
|
|
1379
|
-
return
|
|
1379
|
+
return ns(r, r), r;
|
|
1380
1380
|
};
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1383
|
-
|
|
1382
|
+
function ss(t, e) {
|
|
1383
|
+
t !== null && t.before(
|
|
1384
1384
|
/** @type {Node} */
|
|
1385
|
-
|
|
1385
|
+
e
|
|
1386
1386
|
);
|
|
1387
1387
|
}
|
|
1388
|
-
function
|
|
1389
|
-
return
|
|
1388
|
+
function rs(t) {
|
|
1389
|
+
return t.endsWith("capture") && t !== "gotpointercapture" && t !== "lostpointercapture";
|
|
1390
1390
|
}
|
|
1391
|
-
const
|
|
1391
|
+
const os = [
|
|
1392
1392
|
"beforeinput",
|
|
1393
1393
|
"click",
|
|
1394
1394
|
"change",
|
|
@@ -1413,10 +1413,10 @@ const ss = [
|
|
|
1413
1413
|
"touchmove",
|
|
1414
1414
|
"touchstart"
|
|
1415
1415
|
];
|
|
1416
|
-
function
|
|
1417
|
-
return
|
|
1416
|
+
function ls(t) {
|
|
1417
|
+
return os.includes(t);
|
|
1418
1418
|
}
|
|
1419
|
-
const
|
|
1419
|
+
const us = {
|
|
1420
1420
|
// no `class: 'className'` because we handle that separately
|
|
1421
1421
|
formnovalidate: "formNoValidate",
|
|
1422
1422
|
ismap: "isMap",
|
|
@@ -1431,40 +1431,40 @@ const os = {
|
|
|
1431
1431
|
disablepictureinpicture: "disablePictureInPicture",
|
|
1432
1432
|
disableremoteplayback: "disableRemotePlayback"
|
|
1433
1433
|
};
|
|
1434
|
-
function
|
|
1435
|
-
return
|
|
1434
|
+
function as(t) {
|
|
1435
|
+
return t = t.toLowerCase(), us[t] ?? t;
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function cs(t, e) {
|
|
1438
1438
|
var n = void 0, i;
|
|
1439
|
-
|
|
1440
|
-
n !== (n =
|
|
1439
|
+
yn(() => {
|
|
1440
|
+
n !== (n = e()) && (i && (Ct(i), i = null), n && (i = vn(() => {
|
|
1441
1441
|
Ae(() => (
|
|
1442
1442
|
/** @type {(node: Element) => void} */
|
|
1443
|
-
n(
|
|
1443
|
+
n(t)
|
|
1444
1444
|
));
|
|
1445
1445
|
})));
|
|
1446
1446
|
});
|
|
1447
1447
|
}
|
|
1448
|
-
function
|
|
1449
|
-
var
|
|
1450
|
-
if (typeof
|
|
1451
|
-
else if (typeof
|
|
1452
|
-
var s =
|
|
1453
|
-
for (
|
|
1454
|
-
} else for (n in
|
|
1448
|
+
function Tn(t) {
|
|
1449
|
+
var e, n, i = "";
|
|
1450
|
+
if (typeof t == "string" || typeof t == "number") i += t;
|
|
1451
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
1452
|
+
var s = t.length;
|
|
1453
|
+
for (e = 0; e < s; e++) t[e] && (n = Tn(t[e])) && (i && (i += " "), i += n);
|
|
1454
|
+
} else for (n in t) t[n] && (i && (i += " "), i += n);
|
|
1455
1455
|
return i;
|
|
1456
1456
|
}
|
|
1457
|
-
function
|
|
1458
|
-
for (var
|
|
1457
|
+
function ds() {
|
|
1458
|
+
for (var t, e, n = 0, i = "", s = arguments.length; n < s; n++) (t = arguments[n]) && (e = Tn(t)) && (i && (i += " "), i += e);
|
|
1459
1459
|
return i;
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1462
|
-
return typeof
|
|
1461
|
+
function fs(t) {
|
|
1462
|
+
return typeof t == "object" ? ds(t) : t ?? "";
|
|
1463
1463
|
}
|
|
1464
1464
|
const He = [...`
|
|
1465
1465
|
\r\f \v\uFEFF`];
|
|
1466
|
-
function
|
|
1467
|
-
var i =
|
|
1466
|
+
function hs(t, e, n) {
|
|
1467
|
+
var i = t == null ? "" : "" + t;
|
|
1468
1468
|
if (n) {
|
|
1469
1469
|
for (var s in n)
|
|
1470
1470
|
if (n[s])
|
|
@@ -1477,99 +1477,99 @@ function ds(e, t, n) {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
return i === "" ? null : i;
|
|
1479
1479
|
}
|
|
1480
|
-
function Fe(
|
|
1481
|
-
var n =
|
|
1482
|
-
for (var s in
|
|
1483
|
-
var r =
|
|
1480
|
+
function Fe(t, e = !1) {
|
|
1481
|
+
var n = e ? " !important;" : ";", i = "";
|
|
1482
|
+
for (var s in t) {
|
|
1483
|
+
var r = t[s];
|
|
1484
1484
|
r != null && r !== "" && (i += " " + s + ": " + r + n);
|
|
1485
1485
|
}
|
|
1486
1486
|
return i;
|
|
1487
1487
|
}
|
|
1488
|
-
function
|
|
1489
|
-
return
|
|
1488
|
+
function ne(t) {
|
|
1489
|
+
return t[0] !== "-" || t[1] !== "-" ? t.toLowerCase() : t;
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1492
|
-
if (
|
|
1491
|
+
function ps(t, e) {
|
|
1492
|
+
if (e) {
|
|
1493
1493
|
var n = "", i, s;
|
|
1494
|
-
if (Array.isArray(
|
|
1495
|
-
|
|
1496
|
-
var r = !1, o = 0, l = !1,
|
|
1497
|
-
i &&
|
|
1498
|
-
var
|
|
1499
|
-
const
|
|
1500
|
-
for (var d = 0; d <
|
|
1501
|
-
var f =
|
|
1502
|
-
if (l ? f === "/" &&
|
|
1494
|
+
if (Array.isArray(e) ? (i = e[0], s = e[1]) : i = e, t) {
|
|
1495
|
+
t = String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
|
|
1496
|
+
var r = !1, o = 0, l = !1, u = [];
|
|
1497
|
+
i && u.push(...Object.keys(i).map(ne)), s && u.push(...Object.keys(s).map(ne));
|
|
1498
|
+
var a = 0, c = -1;
|
|
1499
|
+
const g = t.length;
|
|
1500
|
+
for (var d = 0; d < g; d++) {
|
|
1501
|
+
var f = t[d];
|
|
1502
|
+
if (l ? f === "/" && t[d - 1] === "*" && (l = !1) : r ? r === f && (r = !1) : f === "/" && t[d + 1] === "*" ? l = !0 : f === '"' || f === "'" ? r = f : f === "(" ? o++ : f === ")" && o--, !l && r === !1 && o === 0) {
|
|
1503
1503
|
if (f === ":" && c === -1)
|
|
1504
1504
|
c = d;
|
|
1505
|
-
else if (f === ";" || d ===
|
|
1505
|
+
else if (f === ";" || d === g - 1) {
|
|
1506
1506
|
if (c !== -1) {
|
|
1507
|
-
var
|
|
1508
|
-
if (!
|
|
1507
|
+
var p = ne(t.substring(a, c).trim());
|
|
1508
|
+
if (!u.includes(p)) {
|
|
1509
1509
|
f !== ";" && d++;
|
|
1510
|
-
var
|
|
1511
|
-
n += " " +
|
|
1510
|
+
var _ = t.substring(a, d).trim();
|
|
1511
|
+
n += " " + _ + ";";
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
|
-
|
|
1514
|
+
a = d + 1, c = -1;
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
}
|
|
1519
1519
|
return i && (n += Fe(i)), s && (n += Fe(s, !0)), n = n.trim(), n === "" ? null : n;
|
|
1520
1520
|
}
|
|
1521
|
-
return
|
|
1521
|
+
return t == null ? null : String(t);
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1524
|
-
var o =
|
|
1523
|
+
function _s(t, e, n, i, s, r) {
|
|
1524
|
+
var o = t.__className;
|
|
1525
1525
|
if (o !== n || o === void 0) {
|
|
1526
|
-
var l =
|
|
1527
|
-
l == null ?
|
|
1526
|
+
var l = hs(n, i, r);
|
|
1527
|
+
l == null ? t.removeAttribute("class") : e ? t.className = l : t.setAttribute("class", l), t.__className = n;
|
|
1528
1528
|
} else if (r && s !== r)
|
|
1529
|
-
for (var
|
|
1530
|
-
var
|
|
1531
|
-
(s == null ||
|
|
1529
|
+
for (var u in r) {
|
|
1530
|
+
var a = !!r[u];
|
|
1531
|
+
(s == null || a !== !!s[u]) && t.classList.toggle(u, a);
|
|
1532
1532
|
}
|
|
1533
1533
|
return r;
|
|
1534
1534
|
}
|
|
1535
|
-
function
|
|
1535
|
+
function ie(t, e = {}, n, i) {
|
|
1536
1536
|
for (var s in n) {
|
|
1537
1537
|
var r = n[s];
|
|
1538
|
-
|
|
1538
|
+
e[s] !== r && (n[s] == null ? t.style.removeProperty(s) : t.style.setProperty(s, r, i));
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
|
-
function
|
|
1542
|
-
var s =
|
|
1543
|
-
if (s !==
|
|
1544
|
-
var r =
|
|
1545
|
-
r == null ?
|
|
1546
|
-
} else i && (Array.isArray(i) ? (
|
|
1541
|
+
function Cs(t, e, n, i) {
|
|
1542
|
+
var s = t.__style;
|
|
1543
|
+
if (s !== e) {
|
|
1544
|
+
var r = ps(e, i);
|
|
1545
|
+
r == null ? t.removeAttribute("style") : t.style.cssText = r, t.__style = e;
|
|
1546
|
+
} else i && (Array.isArray(i) ? (ie(t, n == null ? void 0 : n[0], i[0]), ie(t, n == null ? void 0 : n[1], i[1], "important")) : ie(t, n, i));
|
|
1547
1547
|
return i;
|
|
1548
1548
|
}
|
|
1549
|
-
function
|
|
1550
|
-
if (
|
|
1551
|
-
if (
|
|
1549
|
+
function ye(t, e, n = !1) {
|
|
1550
|
+
if (t.multiple) {
|
|
1551
|
+
if (e == null)
|
|
1552
1552
|
return;
|
|
1553
|
-
if (!Xe(
|
|
1554
|
-
return
|
|
1555
|
-
for (var i of
|
|
1556
|
-
i.selected =
|
|
1553
|
+
if (!Xe(e))
|
|
1554
|
+
return _i();
|
|
1555
|
+
for (var i of t.options)
|
|
1556
|
+
i.selected = e.includes(Be(i));
|
|
1557
1557
|
return;
|
|
1558
1558
|
}
|
|
1559
|
-
for (i of
|
|
1559
|
+
for (i of t.options) {
|
|
1560
1560
|
var s = Be(i);
|
|
1561
|
-
if (
|
|
1561
|
+
if (Ri(s, e)) {
|
|
1562
1562
|
i.selected = !0;
|
|
1563
1563
|
return;
|
|
1564
1564
|
}
|
|
1565
1565
|
}
|
|
1566
|
-
(!n ||
|
|
1566
|
+
(!n || e !== void 0) && (t.selectedIndex = -1);
|
|
1567
1567
|
}
|
|
1568
|
-
function
|
|
1569
|
-
var
|
|
1570
|
-
|
|
1568
|
+
function ys(t) {
|
|
1569
|
+
var e = new MutationObserver(() => {
|
|
1570
|
+
ye(t, t.__value);
|
|
1571
1571
|
});
|
|
1572
|
-
|
|
1572
|
+
e.observe(t, {
|
|
1573
1573
|
// Listen to option element changes
|
|
1574
1574
|
childList: !0,
|
|
1575
1575
|
subtree: !0,
|
|
@@ -1579,92 +1579,92 @@ function _s(e) {
|
|
|
1579
1579
|
// because that property is not reflected as an attribute)
|
|
1580
1580
|
attributes: !0,
|
|
1581
1581
|
attributeFilter: ["value"]
|
|
1582
|
-
}),
|
|
1583
|
-
|
|
1582
|
+
}), _n(() => {
|
|
1583
|
+
e.disconnect();
|
|
1584
1584
|
});
|
|
1585
1585
|
}
|
|
1586
|
-
function Be(
|
|
1587
|
-
return "__value" in
|
|
1586
|
+
function Be(t) {
|
|
1587
|
+
return "__value" in t ? t.__value : t.value;
|
|
1588
1588
|
}
|
|
1589
|
-
const
|
|
1590
|
-
function
|
|
1591
|
-
|
|
1589
|
+
const Ot = Symbol("class"), Rt = Symbol("style"), Sn = Symbol("is custom element"), Pn = Symbol("is html");
|
|
1590
|
+
function vs(t, e) {
|
|
1591
|
+
e ? t.hasAttribute("selected") || t.setAttribute("selected", "") : t.removeAttribute("selected");
|
|
1592
1592
|
}
|
|
1593
|
-
function Ve(
|
|
1594
|
-
var s =
|
|
1595
|
-
s[
|
|
1593
|
+
function Ve(t, e, n, i) {
|
|
1594
|
+
var s = On(t);
|
|
1595
|
+
s[e] !== (s[e] = n) && (e === "loading" && (t[ri] = n), n == null ? t.removeAttribute(e) : typeof n != "string" && Rn(t).includes(e) ? t[e] = n : t.setAttribute(e, n));
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1598
|
-
var o =
|
|
1599
|
-
for (var d in
|
|
1597
|
+
function gs(t, e, n, i, s = !1, r = !1) {
|
|
1598
|
+
var o = On(t), l = o[Sn], u = !o[Pn], a = e || {}, c = t.tagName === "OPTION";
|
|
1599
|
+
for (var d in e)
|
|
1600
1600
|
d in n || (n[d] = null);
|
|
1601
|
-
n.class ? n.class =
|
|
1602
|
-
var f =
|
|
1603
|
-
for (const
|
|
1604
|
-
let m = n[
|
|
1605
|
-
if (c &&
|
|
1606
|
-
|
|
1601
|
+
n.class ? n.class = fs(n.class) : n[Ot] && (n.class = null), n[Rt] && (n.style ?? (n.style = null));
|
|
1602
|
+
var f = Rn(t);
|
|
1603
|
+
for (const h in n) {
|
|
1604
|
+
let m = n[h];
|
|
1605
|
+
if (c && h === "value" && m == null) {
|
|
1606
|
+
t.value = t.__value = "", a[h] = m;
|
|
1607
1607
|
continue;
|
|
1608
1608
|
}
|
|
1609
|
-
if (
|
|
1610
|
-
var
|
|
1611
|
-
|
|
1609
|
+
if (h === "class") {
|
|
1610
|
+
var p = t.namespaceURI === "http://www.w3.org/1999/xhtml";
|
|
1611
|
+
_s(t, p, m, i, e == null ? void 0 : e[Ot], n[Ot]), a[h] = m, a[Ot] = n[Ot];
|
|
1612
1612
|
continue;
|
|
1613
1613
|
}
|
|
1614
|
-
if (
|
|
1615
|
-
|
|
1614
|
+
if (h === "style") {
|
|
1615
|
+
Cs(t, m, e == null ? void 0 : e[Rt], n[Rt]), a[h] = m, a[Rt] = n[Rt];
|
|
1616
1616
|
continue;
|
|
1617
1617
|
}
|
|
1618
|
-
var
|
|
1619
|
-
if (!(m ===
|
|
1620
|
-
|
|
1621
|
-
var
|
|
1622
|
-
if (
|
|
1623
|
-
if (
|
|
1624
|
-
const S = {}, ot = "$$" +
|
|
1625
|
-
let O =
|
|
1626
|
-
var
|
|
1627
|
-
if (
|
|
1618
|
+
var _ = a[h];
|
|
1619
|
+
if (!(m === _ && !(m === void 0 && t.hasAttribute(h)))) {
|
|
1620
|
+
a[h] = m;
|
|
1621
|
+
var g = h[0] + h[1];
|
|
1622
|
+
if (g !== "$$")
|
|
1623
|
+
if (g === "on") {
|
|
1624
|
+
const S = {}, ot = "$$" + h;
|
|
1625
|
+
let O = h.slice(2);
|
|
1626
|
+
var b = ls(O);
|
|
1627
|
+
if (rs(O) && (O = O.slice(0, -7), S.capture = !0), !b && _) {
|
|
1628
1628
|
if (m != null) continue;
|
|
1629
|
-
|
|
1629
|
+
t.removeEventListener(O, a[ot], S), a[ot] = null;
|
|
1630
1630
|
}
|
|
1631
1631
|
if (m != null)
|
|
1632
|
-
if (
|
|
1633
|
-
|
|
1632
|
+
if (b)
|
|
1633
|
+
t[`__${O}`] = m, Ji([O]);
|
|
1634
1634
|
else {
|
|
1635
|
-
let
|
|
1636
|
-
|
|
1635
|
+
let Un = function(Hn) {
|
|
1636
|
+
a[h].call(this, Hn);
|
|
1637
1637
|
};
|
|
1638
|
-
|
|
1638
|
+
a[ot] = Zi(O, t, Un, S);
|
|
1639
1639
|
}
|
|
1640
|
-
else
|
|
1641
|
-
} else if (
|
|
1642
|
-
Ve(
|
|
1643
|
-
else if (
|
|
1644
|
-
|
|
1640
|
+
else b && (t[`__${O}`] = void 0);
|
|
1641
|
+
} else if (h === "style")
|
|
1642
|
+
Ve(t, h, m);
|
|
1643
|
+
else if (h === "autofocus")
|
|
1644
|
+
Fi(
|
|
1645
1645
|
/** @type {HTMLElement} */
|
|
1646
|
-
|
|
1646
|
+
t,
|
|
1647
1647
|
!!m
|
|
1648
1648
|
);
|
|
1649
|
-
else if (!l && (
|
|
1650
|
-
|
|
1651
|
-
else if (
|
|
1652
|
-
|
|
1649
|
+
else if (!l && (h === "__value" || h === "value" && m != null))
|
|
1650
|
+
t.value = t.__value = m;
|
|
1651
|
+
else if (h === "selected" && c)
|
|
1652
|
+
vs(
|
|
1653
1653
|
/** @type {HTMLOptionElement} */
|
|
1654
|
-
|
|
1654
|
+
t,
|
|
1655
1655
|
m
|
|
1656
1656
|
);
|
|
1657
1657
|
else {
|
|
1658
|
-
var y =
|
|
1659
|
-
|
|
1658
|
+
var y = h;
|
|
1659
|
+
u || (y = as(y));
|
|
1660
1660
|
var v = y === "defaultValue" || y === "defaultChecked";
|
|
1661
1661
|
if (m == null && !l && !v)
|
|
1662
|
-
if (o[
|
|
1662
|
+
if (o[h] = null, y === "value" || y === "checked") {
|
|
1663
1663
|
let S = (
|
|
1664
1664
|
/** @type {HTMLInputElement} */
|
|
1665
|
-
|
|
1665
|
+
t
|
|
1666
1666
|
);
|
|
1667
|
-
const ot =
|
|
1667
|
+
const ot = e === void 0;
|
|
1668
1668
|
if (y === "value") {
|
|
1669
1669
|
let O = S.defaultValue;
|
|
1670
1670
|
S.removeAttribute(y), S.defaultValue = O, S.value = S.__value = ot ? O : null;
|
|
@@ -1673,161 +1673,161 @@ function ys(e, t, n, i, s = !1, r = !1) {
|
|
|
1673
1673
|
S.removeAttribute(y), S.defaultChecked = O, S.checked = ot ? O : !1;
|
|
1674
1674
|
}
|
|
1675
1675
|
} else
|
|
1676
|
-
|
|
1677
|
-
else v || f.includes(y) && (l || typeof m != "string") ? (
|
|
1676
|
+
t.removeAttribute(h);
|
|
1677
|
+
else v || f.includes(y) && (l || typeof m != "string") ? (t[y] = m, y in o && (o[y] = P)) : typeof m != "function" && Ve(t, y, m);
|
|
1678
1678
|
}
|
|
1679
1679
|
}
|
|
1680
1680
|
}
|
|
1681
|
-
return
|
|
1681
|
+
return a;
|
|
1682
1682
|
}
|
|
1683
|
-
function
|
|
1684
|
-
|
|
1685
|
-
var
|
|
1686
|
-
if (
|
|
1687
|
-
var
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1683
|
+
function ms(t, e, n = [], i = [], s = [], r, o = !1, l = !1) {
|
|
1684
|
+
Li(s, n, i, (u) => {
|
|
1685
|
+
var a = void 0, c = {}, d = t.nodeName === "SELECT", f = !1;
|
|
1686
|
+
if (yn(() => {
|
|
1687
|
+
var _ = e(...u.map(I)), g = gs(
|
|
1688
|
+
t,
|
|
1689
|
+
a,
|
|
1690
|
+
_,
|
|
1691
1691
|
r,
|
|
1692
1692
|
o,
|
|
1693
1693
|
l
|
|
1694
1694
|
);
|
|
1695
|
-
f && d && "value" in
|
|
1695
|
+
f && d && "value" in _ && ye(
|
|
1696
1696
|
/** @type {HTMLSelectElement} */
|
|
1697
|
-
|
|
1698
|
-
|
|
1697
|
+
t,
|
|
1698
|
+
_.value
|
|
1699
1699
|
);
|
|
1700
1700
|
for (let y of Object.getOwnPropertySymbols(c))
|
|
1701
|
-
|
|
1702
|
-
for (let y of Object.getOwnPropertySymbols(
|
|
1703
|
-
var
|
|
1704
|
-
y.description ===
|
|
1701
|
+
_[y] || Ct(c[y]);
|
|
1702
|
+
for (let y of Object.getOwnPropertySymbols(_)) {
|
|
1703
|
+
var b = _[y];
|
|
1704
|
+
y.description === Xn && (!a || b !== a[y]) && (c[y] && Ct(c[y]), c[y] = vn(() => cs(t, () => b))), g[y] = b;
|
|
1705
1705
|
}
|
|
1706
|
-
|
|
1706
|
+
a = g;
|
|
1707
1707
|
}), d) {
|
|
1708
|
-
var
|
|
1708
|
+
var p = (
|
|
1709
1709
|
/** @type {HTMLSelectElement} */
|
|
1710
|
-
|
|
1710
|
+
t
|
|
1711
1711
|
);
|
|
1712
1712
|
Ae(() => {
|
|
1713
|
-
|
|
1714
|
-
|
|
1713
|
+
ye(
|
|
1714
|
+
p,
|
|
1715
1715
|
/** @type {Record<string | symbol, any>} */
|
|
1716
|
-
|
|
1716
|
+
a.value,
|
|
1717
1717
|
!0
|
|
1718
|
-
),
|
|
1718
|
+
), ys(p);
|
|
1719
1719
|
});
|
|
1720
1720
|
}
|
|
1721
1721
|
f = !0;
|
|
1722
1722
|
});
|
|
1723
1723
|
}
|
|
1724
|
-
function
|
|
1724
|
+
function On(t) {
|
|
1725
1725
|
return (
|
|
1726
1726
|
/** @type {Record<string | symbol, unknown>} **/
|
|
1727
1727
|
// @ts-expect-error
|
|
1728
|
-
|
|
1729
|
-
[
|
|
1730
|
-
[
|
|
1728
|
+
t.__attributes ?? (t.__attributes = {
|
|
1729
|
+
[Sn]: t.nodeName.includes("-"),
|
|
1730
|
+
[Pn]: t.namespaceURI === $n
|
|
1731
1731
|
})
|
|
1732
1732
|
);
|
|
1733
1733
|
}
|
|
1734
1734
|
var We = /* @__PURE__ */ new Map();
|
|
1735
|
-
function
|
|
1736
|
-
var
|
|
1735
|
+
function Rn(t) {
|
|
1736
|
+
var e = t.getAttribute("is") || t.nodeName, n = We.get(e);
|
|
1737
1737
|
if (n) return n;
|
|
1738
|
-
We.set(
|
|
1739
|
-
for (var i, s =
|
|
1740
|
-
i =
|
|
1738
|
+
We.set(e, n = []);
|
|
1739
|
+
for (var i, s = t, r = Element.prototype; r !== s; ) {
|
|
1740
|
+
i = Jn(s);
|
|
1741
1741
|
for (var o in i)
|
|
1742
1742
|
i[o].set && n.push(o);
|
|
1743
1743
|
s = Qe(s);
|
|
1744
1744
|
}
|
|
1745
1745
|
return n;
|
|
1746
1746
|
}
|
|
1747
|
-
function je(
|
|
1748
|
-
return
|
|
1747
|
+
function je(t, e) {
|
|
1748
|
+
return t === e || (t == null ? void 0 : t[ft]) === e;
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1750
|
+
function bs(t = {}, e, n, i) {
|
|
1751
1751
|
return Ae(() => {
|
|
1752
1752
|
var s, r;
|
|
1753
|
-
return
|
|
1754
|
-
s = r, r = [],
|
|
1755
|
-
|
|
1753
|
+
return Gi(() => {
|
|
1754
|
+
s = r, r = [], An(() => {
|
|
1755
|
+
t !== n(...r) && (e(t, ...r), s && je(n(...s), t) && e(null, ...s));
|
|
1756
1756
|
});
|
|
1757
1757
|
}), () => {
|
|
1758
|
-
|
|
1759
|
-
r && je(n(...r),
|
|
1758
|
+
Jt(() => {
|
|
1759
|
+
r && je(n(...r), t) && e(null, ...r);
|
|
1760
1760
|
});
|
|
1761
1761
|
};
|
|
1762
|
-
}),
|
|
1762
|
+
}), t;
|
|
1763
1763
|
}
|
|
1764
|
-
let
|
|
1765
|
-
function
|
|
1766
|
-
var
|
|
1764
|
+
let Ft = !1;
|
|
1765
|
+
function ws(t) {
|
|
1766
|
+
var e = Ft;
|
|
1767
1767
|
try {
|
|
1768
|
-
return
|
|
1768
|
+
return Ft = !1, [t(), Ft];
|
|
1769
1769
|
} finally {
|
|
1770
|
-
|
|
1770
|
+
Ft = e;
|
|
1771
1771
|
}
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1773
|
+
function Bt(t, e, n, i) {
|
|
1774
1774
|
var v;
|
|
1775
|
-
var s = (n &
|
|
1775
|
+
var s = (n & Kn) !== 0, r = (n & zn) !== 0, o = (
|
|
1776
1776
|
/** @type {V} */
|
|
1777
1777
|
i
|
|
1778
|
-
), l = !0,
|
|
1778
|
+
), l = !0, u = () => (l && (l = !1, o = r ? An(
|
|
1779
1779
|
/** @type {() => V} */
|
|
1780
1780
|
i
|
|
1781
1781
|
) : (
|
|
1782
1782
|
/** @type {V} */
|
|
1783
1783
|
i
|
|
1784
|
-
)), o),
|
|
1784
|
+
)), o), a;
|
|
1785
1785
|
if (s) {
|
|
1786
|
-
var c =
|
|
1787
|
-
|
|
1786
|
+
var c = ft in t || si in t;
|
|
1787
|
+
a = ((v = Wt(t, e)) == null ? void 0 : v.set) ?? (c && e in t ? (h) => t[e] = h : void 0);
|
|
1788
1788
|
}
|
|
1789
1789
|
var d, f = !1;
|
|
1790
|
-
s ? [d, f] =
|
|
1790
|
+
s ? [d, f] = ws(() => (
|
|
1791
1791
|
/** @type {V} */
|
|
1792
|
-
e
|
|
1792
|
+
t[e]
|
|
1793
1793
|
)) : d = /** @type {V} */
|
|
1794
|
-
e
|
|
1795
|
-
var
|
|
1796
|
-
if (
|
|
1797
|
-
var
|
|
1794
|
+
t[e], d === void 0 && i !== void 0 && (d = u(), a && (di(), a(d)));
|
|
1795
|
+
var p;
|
|
1796
|
+
if (p = () => {
|
|
1797
|
+
var h = (
|
|
1798
1798
|
/** @type {V} */
|
|
1799
|
-
e
|
|
1799
|
+
t[e]
|
|
1800
1800
|
);
|
|
1801
|
-
return
|
|
1802
|
-
}, (n &
|
|
1803
|
-
return
|
|
1804
|
-
if (
|
|
1805
|
-
var
|
|
1801
|
+
return h === void 0 ? u() : (l = !0, h);
|
|
1802
|
+
}, (n & Yn) === 0)
|
|
1803
|
+
return p;
|
|
1804
|
+
if (a) {
|
|
1805
|
+
var _ = t.$$legacy;
|
|
1806
1806
|
return (
|
|
1807
1807
|
/** @type {() => V} */
|
|
1808
|
-
(function(
|
|
1809
|
-
return arguments.length > 0 ? ((!m ||
|
|
1808
|
+
(function(h, m) {
|
|
1809
|
+
return arguments.length > 0 ? ((!m || _ || f) && a(m ? p() : h), h) : p();
|
|
1810
1810
|
})
|
|
1811
1811
|
);
|
|
1812
1812
|
}
|
|
1813
|
-
var
|
|
1814
|
-
s && I(
|
|
1813
|
+
var g = !1, b = ((n & Gn) !== 0 ? Ne : Si)(() => (g = !1, p()));
|
|
1814
|
+
s && I(b);
|
|
1815
1815
|
var y = (
|
|
1816
1816
|
/** @type {Effect} */
|
|
1817
|
-
|
|
1817
|
+
N
|
|
1818
1818
|
);
|
|
1819
1819
|
return (
|
|
1820
1820
|
/** @type {() => V} */
|
|
1821
|
-
(function(
|
|
1821
|
+
(function(h, m) {
|
|
1822
1822
|
if (arguments.length > 0) {
|
|
1823
|
-
const S = m ? I(
|
|
1824
|
-
return
|
|
1823
|
+
const S = m ? I(b) : s ? It(h) : h;
|
|
1824
|
+
return V(b, S), g = !0, o !== void 0 && (o = S), h;
|
|
1825
1825
|
}
|
|
1826
|
-
return
|
|
1826
|
+
return it && g || (y.f & J) !== 0 ? b.v : I(b);
|
|
1827
1827
|
})
|
|
1828
1828
|
);
|
|
1829
1829
|
}
|
|
1830
|
-
const
|
|
1830
|
+
const Is = [
|
|
1831
1831
|
[
|
|
1832
1832
|
"af",
|
|
1833
1833
|
// Afghanistan
|
|
@@ -3504,18 +3504,18 @@ const bs = [
|
|
|
3504
3504
|
null,
|
|
3505
3505
|
"0"
|
|
3506
3506
|
]
|
|
3507
|
-
],
|
|
3508
|
-
for (const
|
|
3509
|
-
|
|
3507
|
+
], Nt = [];
|
|
3508
|
+
for (const t of Is)
|
|
3509
|
+
Nt.push({
|
|
3510
3510
|
name: "",
|
|
3511
3511
|
// populated in the plugin
|
|
3512
|
-
iso2:
|
|
3513
|
-
dialCode:
|
|
3514
|
-
priority:
|
|
3515
|
-
areaCodes:
|
|
3512
|
+
iso2: t[0],
|
|
3513
|
+
dialCode: t[1],
|
|
3514
|
+
priority: t[2] || 0,
|
|
3515
|
+
areaCodes: t[3] || null,
|
|
3516
3516
|
nodeById: {},
|
|
3517
3517
|
// populated by the plugin
|
|
3518
|
-
nationalPrefix:
|
|
3518
|
+
nationalPrefix: t[4] || null,
|
|
3519
3519
|
normalisedName: "",
|
|
3520
3520
|
// populated in the plugin
|
|
3521
3521
|
initials: "",
|
|
@@ -3523,7 +3523,7 @@ for (const e of bs)
|
|
|
3523
3523
|
dialCodePlus: ""
|
|
3524
3524
|
// populated in the plugin
|
|
3525
3525
|
});
|
|
3526
|
-
const
|
|
3526
|
+
const Vt = {
|
|
3527
3527
|
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
3528
3528
|
CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
|
|
3529
3529
|
COUNTRY_CHANGE: "countrychange",
|
|
@@ -3537,7 +3537,7 @@ const Wt = {
|
|
|
3537
3537
|
FLAG: "iti__flag",
|
|
3538
3538
|
COUNTRY_ITEM: "iti__country",
|
|
3539
3539
|
HIGHLIGHT: "iti__highlight"
|
|
3540
|
-
},
|
|
3540
|
+
}, M = {
|
|
3541
3541
|
ARROW_UP: "ArrowUp",
|
|
3542
3542
|
ARROW_DOWN: "ArrowDown",
|
|
3543
3543
|
SPACE: " ",
|
|
@@ -3547,7 +3547,7 @@ const Wt = {
|
|
|
3547
3547
|
}, Ge = {
|
|
3548
3548
|
PASTE: "insertFromPaste",
|
|
3549
3549
|
DELETE_FWD: "deleteContentForward"
|
|
3550
|
-
},
|
|
3550
|
+
}, ut = {
|
|
3551
3551
|
ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
|
|
3552
3552
|
// any kind of letter from any language
|
|
3553
3553
|
NON_PLUS_NUMERIC: /[^+0-9]/,
|
|
@@ -3556,39 +3556,39 @@ const Wt = {
|
|
|
3556
3556
|
// chars that are NOT + or digit (global)
|
|
3557
3557
|
HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
|
|
3558
3558
|
// single acceptable hidden-search char
|
|
3559
|
-
},
|
|
3559
|
+
}, Es = {
|
|
3560
3560
|
HIDDEN_SEARCH_RESET_MS: 1e3
|
|
3561
3561
|
}, Ye = {
|
|
3562
3562
|
UNKNOWN_NUMBER_TYPE: -99,
|
|
3563
3563
|
UNKNOWN_VALIDATION_ERROR: -99
|
|
3564
|
-
},
|
|
3564
|
+
}, se = {
|
|
3565
3565
|
SANE_SELECTED_WITH_DIAL_WIDTH: 78,
|
|
3566
3566
|
// px width fallback when separateDialCode enabled
|
|
3567
3567
|
SANE_SELECTED_NO_DIAL_WIDTH: 42,
|
|
3568
3568
|
// px width fallback when no separate dial code
|
|
3569
3569
|
INPUT_PADDING_EXTRA_LEFT: 6
|
|
3570
3570
|
// px gap between selected country container and input text
|
|
3571
|
-
},
|
|
3571
|
+
}, kn = {
|
|
3572
3572
|
NANP: "1"
|
|
3573
3573
|
// North American Numbering Plan
|
|
3574
|
-
},
|
|
3574
|
+
}, re = {
|
|
3575
3575
|
DIAL_CODE: "44",
|
|
3576
3576
|
// +44 United Kingdom
|
|
3577
3577
|
MOBILE_PREFIX: "7",
|
|
3578
3578
|
// UK mobile numbers start with 7 after national trunk (0) or core section
|
|
3579
3579
|
MOBILE_CORE_LENGTH: 10
|
|
3580
3580
|
// core number length (excluding dial code / national prefix) for mobiles
|
|
3581
|
-
},
|
|
3581
|
+
}, Ns = {
|
|
3582
3582
|
ISO2: "us"
|
|
3583
|
-
},
|
|
3583
|
+
}, ve = {
|
|
3584
3584
|
AGGRESSIVE: "aggressive",
|
|
3585
3585
|
POLITE: "polite"
|
|
3586
|
-
},
|
|
3586
|
+
}, oe = {
|
|
3587
3587
|
AUTO: "auto"
|
|
3588
3588
|
}, Ke = {
|
|
3589
3589
|
COUNTRY_CODE: "countryCode",
|
|
3590
3590
|
DIAL_CODE: "dialCode"
|
|
3591
|
-
},
|
|
3591
|
+
}, D = {
|
|
3592
3592
|
EXPANDED: "aria-expanded",
|
|
3593
3593
|
LABEL: "aria-label",
|
|
3594
3594
|
SELECTED: "aria-selected",
|
|
@@ -3598,23 +3598,23 @@ const Wt = {
|
|
|
3598
3598
|
HIDDEN: "aria-hidden",
|
|
3599
3599
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
3600
3600
|
MODAL: "aria-modal"
|
|
3601
|
-
},
|
|
3601
|
+
}, Ds = {
|
|
3602
3602
|
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
3603
3603
|
noCountrySelected: "Select country",
|
|
3604
3604
|
countryListAriaLabel: "List of countries",
|
|
3605
3605
|
searchPlaceholder: "Search",
|
|
3606
3606
|
clearSearchAriaLabel: "Clear search",
|
|
3607
3607
|
searchEmptyState: "No results found",
|
|
3608
|
-
searchSummaryAria(
|
|
3609
|
-
return
|
|
3608
|
+
searchSummaryAria(t) {
|
|
3609
|
+
return t === 0 ? "No results found" : t === 1 ? "1 result found" : `${t} results found`;
|
|
3610
3610
|
}
|
|
3611
|
-
},
|
|
3611
|
+
}, le = (t) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(t).matches, Ls = () => {
|
|
3612
3612
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
3613
|
-
const
|
|
3614
|
-
return
|
|
3613
|
+
const t = le("(max-width: 500px)"), e = le("(max-height: 600px)"), n = le("(pointer: coarse)");
|
|
3614
|
+
return t || n && e;
|
|
3615
3615
|
}
|
|
3616
3616
|
return !1;
|
|
3617
|
-
},
|
|
3617
|
+
}, Mn = {
|
|
3618
3618
|
//* Whether or not to allow the dropdown.
|
|
3619
3619
|
allowDropdown: !0,
|
|
3620
3620
|
//* Whether or not to allow extensions after the main number.
|
|
@@ -3622,7 +3622,7 @@ const Wt = {
|
|
|
3622
3622
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
3623
3623
|
allowPhonewords: !1,
|
|
3624
3624
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
3625
|
-
autoPlaceholder:
|
|
3625
|
+
autoPlaceholder: ve.POLITE,
|
|
3626
3626
|
//* Modify the parentClass.
|
|
3627
3627
|
containerClass: "",
|
|
3628
3628
|
//* Locale for localising country names via Intl.DisplayNames.
|
|
@@ -3666,112 +3666,112 @@ const Wt = {
|
|
|
3666
3666
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
3667
3667
|
strictMode: !1,
|
|
3668
3668
|
//* Use full screen popup instead of dropdown for country list.
|
|
3669
|
-
useFullscreenPopup:
|
|
3669
|
+
useFullscreenPopup: Ls(),
|
|
3670
3670
|
//* The number type to enforce during validation.
|
|
3671
3671
|
allowedNumberTypes: ["MOBILE", "FIXED_LINE"]
|
|
3672
|
-
},
|
|
3673
|
-
|
|
3674
|
-
},
|
|
3675
|
-
const n =
|
|
3676
|
-
for (const c of
|
|
3677
|
-
c.iso2 === n ? i.push(c) : c.normalisedName.startsWith(n) ? s.push(c) : c.normalisedName.includes(n) ? r.push(c) : n === c.dialCode || n === c.dialCodePlus ? o.push(c) : c.dialCodePlus.includes(n) ? l.push(c) : c.initials.includes(n) &&
|
|
3678
|
-
const
|
|
3672
|
+
}, As = (t) => {
|
|
3673
|
+
t.useFullscreenPopup && (t.fixDropdownWidth = !1), t.onlyCountries.length === 1 && (t.initialCountry = t.onlyCountries[0]), t.separateDialCode && (t.nationalMode = !1), t.allowDropdown && !t.showFlags && !t.separateDialCode && (t.nationalMode = !1), t.useFullscreenPopup && !t.dropdownContainer && (t.dropdownContainer = document.body), t.i18n = { ...Ds, ...t.i18n };
|
|
3674
|
+
}, jt = (t) => t.replace(/\D/g, ""), xn = (t = "") => t.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), Ts = (t, e) => {
|
|
3675
|
+
const n = xn(e), i = [], s = [], r = [], o = [], l = [], u = [];
|
|
3676
|
+
for (const c of t)
|
|
3677
|
+
c.iso2 === n ? i.push(c) : c.normalisedName.startsWith(n) ? s.push(c) : c.normalisedName.includes(n) ? r.push(c) : n === c.dialCode || n === c.dialCodePlus ? o.push(c) : c.dialCodePlus.includes(n) ? l.push(c) : c.initials.includes(n) && u.push(c);
|
|
3678
|
+
const a = (c, d) => c.priority - d.priority;
|
|
3679
3679
|
return [
|
|
3680
|
-
...i.sort(
|
|
3681
|
-
...s.sort(
|
|
3682
|
-
...r.sort(
|
|
3683
|
-
...o.sort(
|
|
3684
|
-
...l.sort(
|
|
3685
|
-
...
|
|
3680
|
+
...i.sort(a),
|
|
3681
|
+
...s.sort(a),
|
|
3682
|
+
...r.sort(a),
|
|
3683
|
+
...o.sort(a),
|
|
3684
|
+
...l.sort(a),
|
|
3685
|
+
...u.sort(a)
|
|
3686
3686
|
];
|
|
3687
|
-
},
|
|
3688
|
-
const n =
|
|
3689
|
-
for (const i of
|
|
3687
|
+
}, Ss = (t, e) => {
|
|
3688
|
+
const n = e.toLowerCase();
|
|
3689
|
+
for (const i of t)
|
|
3690
3690
|
if (i.name.toLowerCase().startsWith(n))
|
|
3691
3691
|
return i;
|
|
3692
3692
|
return null;
|
|
3693
|
-
},
|
|
3694
|
-
const i = document.createElement(
|
|
3695
|
-
return
|
|
3693
|
+
}, ue = (t) => Object.keys(t).filter((e) => !!t[e]).join(" "), A = (t, e, n) => {
|
|
3694
|
+
const i = document.createElement(t);
|
|
3695
|
+
return e && Object.entries(e).forEach(
|
|
3696
3696
|
([s, r]) => i.setAttribute(s, r)
|
|
3697
3697
|
), n && n.appendChild(i), i;
|
|
3698
|
-
},
|
|
3699
|
-
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${
|
|
3698
|
+
}, Ps = () => `
|
|
3699
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${D.HIDDEN}="true">
|
|
3700
3700
|
<circle cx="11" cy="11" r="7" />
|
|
3701
3701
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
3702
|
-
</svg>`,
|
|
3703
|
-
const
|
|
3702
|
+
</svg>`, Os = (t) => {
|
|
3703
|
+
const e = `iti-${t}-clear-mask`;
|
|
3704
3704
|
return `
|
|
3705
|
-
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${
|
|
3706
|
-
<mask id="${
|
|
3705
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${D.HIDDEN}="true" focusable="false">
|
|
3706
|
+
<mask id="${e}" maskUnits="userSpaceOnUse">
|
|
3707
3707
|
<rect width="16" height="16" fill="white" />
|
|
3708
3708
|
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
|
3709
3709
|
</mask>
|
|
3710
|
-
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${
|
|
3710
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${e})" />
|
|
3711
3711
|
</svg>`;
|
|
3712
|
-
},
|
|
3712
|
+
}, Rs = () => `
|
|
3713
3713
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
3714
3714
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
3715
3715
|
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
3716
3716
|
</svg>`;
|
|
3717
|
-
class
|
|
3718
|
-
constructor(
|
|
3719
|
-
this.highlightedItem = null, this.selectedItem = null,
|
|
3717
|
+
class ks {
|
|
3718
|
+
constructor(e, n, i) {
|
|
3719
|
+
this.highlightedItem = null, this.selectedItem = null, e.dataset.intlTelInputId = i.toString(), this.telInput = e, this.options = n, this.id = i, this.hadInitialPlaceholder = !!e.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
|
|
3720
3720
|
}
|
|
3721
3721
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
3722
|
-
generateMarkup(
|
|
3723
|
-
this.countries =
|
|
3722
|
+
generateMarkup(e) {
|
|
3723
|
+
this.countries = e, this.telInput.classList.add("iti__tel-input");
|
|
3724
3724
|
const n = this._createWrapperAndInsert();
|
|
3725
3725
|
this._maybeBuildCountryContainer(n), n.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(n);
|
|
3726
3726
|
}
|
|
3727
3727
|
_createWrapperAndInsert() {
|
|
3728
|
-
const { allowDropdown:
|
|
3728
|
+
const { allowDropdown: e, showFlags: n, containerClass: i, useFullscreenPopup: s } = this.options, r = ue({
|
|
3729
3729
|
iti: !0,
|
|
3730
|
-
"iti--allow-dropdown":
|
|
3730
|
+
"iti--allow-dropdown": e,
|
|
3731
3731
|
"iti--show-flags": n,
|
|
3732
3732
|
"iti--inline-dropdown": !s,
|
|
3733
3733
|
[i]: !!i
|
|
3734
|
-
}), o =
|
|
3734
|
+
}), o = A("div", { class: r });
|
|
3735
3735
|
return this.isRTL && o.setAttribute("dir", "ltr"), this.telInput.before(o), o;
|
|
3736
3736
|
}
|
|
3737
|
-
_maybeBuildCountryContainer(
|
|
3737
|
+
_maybeBuildCountryContainer(e) {
|
|
3738
3738
|
const { allowDropdown: n, separateDialCode: i, showFlags: s } = this.options;
|
|
3739
3739
|
if (n || s || i) {
|
|
3740
|
-
this.countryContainer =
|
|
3740
|
+
this.countryContainer = A(
|
|
3741
3741
|
"div",
|
|
3742
3742
|
// visibly hidden until we measure it's width to set the input padding correctly
|
|
3743
3743
|
{ class: `iti__country-container ${E.V_HIDE}` },
|
|
3744
|
-
|
|
3745
|
-
), n ? (this.selectedCountry =
|
|
3744
|
+
e
|
|
3745
|
+
), n ? (this.selectedCountry = A(
|
|
3746
3746
|
"button",
|
|
3747
3747
|
{
|
|
3748
3748
|
type: "button",
|
|
3749
3749
|
class: "iti__selected-country",
|
|
3750
|
-
[
|
|
3751
|
-
[
|
|
3752
|
-
[
|
|
3753
|
-
[
|
|
3750
|
+
[D.EXPANDED]: "false",
|
|
3751
|
+
[D.LABEL]: this.options.i18n.noCountrySelected,
|
|
3752
|
+
[D.HASPOPUP]: "dialog",
|
|
3753
|
+
[D.CONTROLS]: `iti-${this.id}__dropdown-content`
|
|
3754
3754
|
},
|
|
3755
3755
|
this.countryContainer
|
|
3756
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
3756
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = A(
|
|
3757
3757
|
"div",
|
|
3758
3758
|
{ class: "iti__selected-country" },
|
|
3759
3759
|
this.countryContainer
|
|
3760
3760
|
);
|
|
3761
|
-
const r =
|
|
3761
|
+
const r = A(
|
|
3762
3762
|
"div",
|
|
3763
3763
|
{ class: "iti__selected-country-primary" },
|
|
3764
3764
|
this.selectedCountry
|
|
3765
3765
|
);
|
|
3766
|
-
this.selectedCountryInner =
|
|
3766
|
+
this.selectedCountryInner = A(
|
|
3767
3767
|
"div",
|
|
3768
3768
|
{ class: E.FLAG },
|
|
3769
3769
|
r
|
|
3770
|
-
), n && (this.dropdownArrow =
|
|
3770
|
+
), n && (this.dropdownArrow = A(
|
|
3771
3771
|
"div",
|
|
3772
|
-
{ class: "iti__arrow", [
|
|
3772
|
+
{ class: "iti__arrow", [D.HIDDEN]: "true" },
|
|
3773
3773
|
r
|
|
3774
|
-
)), i && (this.selectedDialCode =
|
|
3774
|
+
)), i && (this.selectedDialCode = A(
|
|
3775
3775
|
"div",
|
|
3776
3776
|
{ class: "iti__selected-dial-code" },
|
|
3777
3777
|
this.selectedCountry
|
|
@@ -3780,96 +3780,96 @@ class Os {
|
|
|
3780
3780
|
}
|
|
3781
3781
|
_buildDropdownContent() {
|
|
3782
3782
|
const {
|
|
3783
|
-
fixDropdownWidth:
|
|
3783
|
+
fixDropdownWidth: e,
|
|
3784
3784
|
useFullscreenPopup: n,
|
|
3785
3785
|
countrySearch: i,
|
|
3786
3786
|
i18n: s,
|
|
3787
3787
|
dropdownContainer: r,
|
|
3788
3788
|
containerClass: o
|
|
3789
|
-
} = this.options, l =
|
|
3790
|
-
if (this.dropdownContent =
|
|
3789
|
+
} = this.options, l = e ? "" : "iti--flexible-dropdown-width";
|
|
3790
|
+
if (this.dropdownContent = A("div", {
|
|
3791
3791
|
id: `iti-${this.id}__dropdown-content`,
|
|
3792
3792
|
class: `iti__dropdown-content ${E.HIDE} ${l}`,
|
|
3793
3793
|
role: "dialog",
|
|
3794
|
-
[
|
|
3795
|
-
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList =
|
|
3794
|
+
[D.MODAL]: "true"
|
|
3795
|
+
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = A(
|
|
3796
3796
|
"ul",
|
|
3797
3797
|
{
|
|
3798
3798
|
class: "iti__country-list",
|
|
3799
3799
|
id: `iti-${this.id}__country-listbox`,
|
|
3800
3800
|
role: "listbox",
|
|
3801
|
-
[
|
|
3801
|
+
[D.LABEL]: s.countryListAriaLabel
|
|
3802
3802
|
},
|
|
3803
3803
|
this.dropdownContent
|
|
3804
3804
|
), this._appendListItems(), i && this.updateSearchResultsA11yText(), r) {
|
|
3805
|
-
const
|
|
3805
|
+
const u = ue({
|
|
3806
3806
|
iti: !0,
|
|
3807
3807
|
"iti--container": !0,
|
|
3808
3808
|
"iti--fullscreen-popup": n,
|
|
3809
3809
|
"iti--inline-dropdown": !n,
|
|
3810
3810
|
[o]: !!o
|
|
3811
3811
|
});
|
|
3812
|
-
this.dropdown =
|
|
3812
|
+
this.dropdown = A("div", { class: u }), this.dropdown.appendChild(this.dropdownContent);
|
|
3813
3813
|
} else
|
|
3814
3814
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
3815
3815
|
}
|
|
3816
3816
|
_buildSearchUI() {
|
|
3817
|
-
const { i18n:
|
|
3817
|
+
const { i18n: e } = this.options, n = A(
|
|
3818
3818
|
"div",
|
|
3819
3819
|
{ class: "iti__search-input-wrapper" },
|
|
3820
3820
|
this.dropdownContent
|
|
3821
3821
|
);
|
|
3822
|
-
this.searchIcon =
|
|
3822
|
+
this.searchIcon = A(
|
|
3823
3823
|
"span",
|
|
3824
3824
|
{
|
|
3825
3825
|
class: "iti__search-icon",
|
|
3826
|
-
[
|
|
3826
|
+
[D.HIDDEN]: "true"
|
|
3827
3827
|
},
|
|
3828
3828
|
n
|
|
3829
|
-
), this.searchIcon.innerHTML =
|
|
3829
|
+
), this.searchIcon.innerHTML = Ps(), this.searchInput = A(
|
|
3830
3830
|
"input",
|
|
3831
3831
|
{
|
|
3832
3832
|
id: `iti-${this.id}__search-input`,
|
|
3833
3833
|
// Chrome says inputs need either a name or an id
|
|
3834
3834
|
type: "search",
|
|
3835
3835
|
class: "iti__search-input",
|
|
3836
|
-
placeholder:
|
|
3836
|
+
placeholder: e.searchPlaceholder,
|
|
3837
3837
|
// role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
|
|
3838
3838
|
role: "combobox",
|
|
3839
|
-
[
|
|
3840
|
-
[
|
|
3841
|
-
[
|
|
3842
|
-
[
|
|
3839
|
+
[D.EXPANDED]: "true",
|
|
3840
|
+
[D.LABEL]: e.searchPlaceholder,
|
|
3841
|
+
[D.CONTROLS]: `iti-${this.id}__country-listbox`,
|
|
3842
|
+
[D.AUTOCOMPLETE]: "list",
|
|
3843
3843
|
autocomplete: "off"
|
|
3844
3844
|
},
|
|
3845
3845
|
n
|
|
3846
|
-
), this.searchClearButton =
|
|
3846
|
+
), this.searchClearButton = A(
|
|
3847
3847
|
"button",
|
|
3848
3848
|
{
|
|
3849
3849
|
type: "button",
|
|
3850
3850
|
class: `iti__search-clear ${E.HIDE}`,
|
|
3851
|
-
[
|
|
3851
|
+
[D.LABEL]: e.clearSearchAriaLabel,
|
|
3852
3852
|
tabindex: "-1"
|
|
3853
3853
|
},
|
|
3854
3854
|
n
|
|
3855
|
-
), this.searchClearButton.innerHTML =
|
|
3855
|
+
), this.searchClearButton.innerHTML = Os(this.id), this.searchResultsA11yText = A(
|
|
3856
3856
|
"span",
|
|
3857
3857
|
{ class: "iti__a11y-text" },
|
|
3858
3858
|
this.dropdownContent
|
|
3859
|
-
), this.searchNoResults =
|
|
3859
|
+
), this.searchNoResults = A(
|
|
3860
3860
|
"div",
|
|
3861
3861
|
{
|
|
3862
3862
|
class: `iti__no-results ${E.HIDE}`,
|
|
3863
|
-
[
|
|
3863
|
+
[D.HIDDEN]: "true"
|
|
3864
3864
|
// all a11y messaging happens in this.searchResultsA11yText
|
|
3865
3865
|
},
|
|
3866
3866
|
this.dropdownContent
|
|
3867
|
-
), this.searchNoResults.textContent =
|
|
3867
|
+
), this.searchNoResults.textContent = e.searchEmptyState;
|
|
3868
3868
|
}
|
|
3869
3869
|
_maybeUpdateInputPaddingAndReveal() {
|
|
3870
3870
|
this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(E.V_HIDE));
|
|
3871
3871
|
}
|
|
3872
|
-
_maybeBuildHiddenInputs(
|
|
3872
|
+
_maybeBuildHiddenInputs(e) {
|
|
3873
3873
|
var i, s;
|
|
3874
3874
|
const { hiddenInput: n } = this.options;
|
|
3875
3875
|
if (n) {
|
|
@@ -3878,47 +3878,47 @@ class Os {
|
|
|
3878
3878
|
const l = (i = this.telInput.form) == null ? void 0 : i.querySelector(
|
|
3879
3879
|
`input[name="${o.phone}"]`
|
|
3880
3880
|
);
|
|
3881
|
-
l ? this.hiddenInput = l : (this.hiddenInput =
|
|
3881
|
+
l ? this.hiddenInput = l : (this.hiddenInput = A("input", {
|
|
3882
3882
|
type: "hidden",
|
|
3883
3883
|
name: o.phone
|
|
3884
|
-
}),
|
|
3884
|
+
}), e.appendChild(this.hiddenInput));
|
|
3885
3885
|
}
|
|
3886
3886
|
if (o.country) {
|
|
3887
3887
|
const l = (s = this.telInput.form) == null ? void 0 : s.querySelector(
|
|
3888
3888
|
`input[name="${o.country}"]`
|
|
3889
3889
|
);
|
|
3890
|
-
l ? this.hiddenInputCountry = l : (this.hiddenInputCountry =
|
|
3890
|
+
l ? this.hiddenInputCountry = l : (this.hiddenInputCountry = A("input", {
|
|
3891
3891
|
type: "hidden",
|
|
3892
3892
|
name: o.country
|
|
3893
|
-
}),
|
|
3893
|
+
}), e.appendChild(this.hiddenInputCountry));
|
|
3894
3894
|
}
|
|
3895
3895
|
}
|
|
3896
3896
|
}
|
|
3897
3897
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
3898
3898
|
_appendListItems() {
|
|
3899
|
-
const
|
|
3899
|
+
const e = document.createDocumentFragment();
|
|
3900
3900
|
for (let n = 0; n < this.countries.length; n++) {
|
|
3901
|
-
const i = this.countries[n], s =
|
|
3901
|
+
const i = this.countries[n], s = ue({
|
|
3902
3902
|
[E.COUNTRY_ITEM]: !0
|
|
3903
|
-
}), r =
|
|
3903
|
+
}), r = A("li", {
|
|
3904
3904
|
id: `iti-${this.id}__item-${i.iso2}`,
|
|
3905
3905
|
class: s,
|
|
3906
3906
|
tabindex: "-1",
|
|
3907
3907
|
role: "option",
|
|
3908
|
-
[
|
|
3908
|
+
[D.SELECTED]: "false"
|
|
3909
3909
|
});
|
|
3910
|
-
r.dataset.dialCode = i.dialCode, r.dataset.countryCode = i.iso2, i.nodeById[this.id] = r, this.options.showFlags &&
|
|
3911
|
-
const o =
|
|
3910
|
+
r.dataset.dialCode = i.dialCode, r.dataset.countryCode = i.iso2, i.nodeById[this.id] = r, this.options.showFlags && A("div", { class: `${E.FLAG} iti__${i.iso2}` }, r);
|
|
3911
|
+
const o = A("span", { class: "iti__country-name" }, r);
|
|
3912
3912
|
o.textContent = i.name;
|
|
3913
|
-
const l =
|
|
3914
|
-
this.isRTL && l.setAttribute("dir", "ltr"), l.textContent = `+${i.dialCode}`,
|
|
3913
|
+
const l = A("span", { class: "iti__dial-code" }, r);
|
|
3914
|
+
this.isRTL && l.setAttribute("dir", "ltr"), l.textContent = `+${i.dialCode}`, e.appendChild(r);
|
|
3915
3915
|
}
|
|
3916
|
-
this.countryList.appendChild(
|
|
3916
|
+
this.countryList.appendChild(e);
|
|
3917
3917
|
}
|
|
3918
3918
|
//* Update the input padding to make space for the selected country/dial code.
|
|
3919
3919
|
updateInputPadding() {
|
|
3920
3920
|
if (this.selectedCountry) {
|
|
3921
|
-
const
|
|
3921
|
+
const e = this.options.separateDialCode ? se.SANE_SELECTED_WITH_DIAL_WIDTH : se.SANE_SELECTED_NO_DIAL_WIDTH, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + se.INPUT_PADDING_EXTRA_LEFT;
|
|
3922
3922
|
this.telInput.style.paddingLeft = `${i}px`;
|
|
3923
3923
|
}
|
|
3924
3924
|
}
|
|
@@ -3928,16 +3928,16 @@ class Os {
|
|
|
3928
3928
|
//* and then to inject a deep clone of the selectedCountry element.
|
|
3929
3929
|
_getHiddenSelectedCountryWidth() {
|
|
3930
3930
|
if (this.telInput.parentNode) {
|
|
3931
|
-
let
|
|
3931
|
+
let e;
|
|
3932
3932
|
try {
|
|
3933
|
-
|
|
3933
|
+
e = window.top.document.body;
|
|
3934
3934
|
} catch {
|
|
3935
|
-
|
|
3935
|
+
e = document.body;
|
|
3936
3936
|
}
|
|
3937
3937
|
const n = this.telInput.parentNode.cloneNode(
|
|
3938
3938
|
!1
|
|
3939
3939
|
);
|
|
3940
|
-
n.style.visibility = "hidden",
|
|
3940
|
+
n.style.visibility = "hidden", e.appendChild(n);
|
|
3941
3941
|
const i = this.countryContainer.cloneNode();
|
|
3942
3942
|
n.appendChild(i);
|
|
3943
3943
|
const s = this.selectedCountry.cloneNode(
|
|
@@ -3945,47 +3945,47 @@ class Os {
|
|
|
3945
3945
|
);
|
|
3946
3946
|
i.appendChild(s);
|
|
3947
3947
|
const r = s.offsetWidth;
|
|
3948
|
-
return
|
|
3948
|
+
return e.removeChild(n), r;
|
|
3949
3949
|
}
|
|
3950
3950
|
return 0;
|
|
3951
3951
|
}
|
|
3952
3952
|
//* Update search results text (for a11y).
|
|
3953
3953
|
updateSearchResultsA11yText() {
|
|
3954
|
-
const { i18n:
|
|
3955
|
-
this.searchResultsA11yText.textContent =
|
|
3954
|
+
const { i18n: e } = this.options, n = this.countryList.childElementCount;
|
|
3955
|
+
this.searchResultsA11yText.textContent = e.searchSummaryAria(n);
|
|
3956
3956
|
}
|
|
3957
3957
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
3958
|
-
scrollTo(
|
|
3959
|
-
const n = this.countryList, i = document.documentElement.scrollTop, s = n.offsetHeight, r = n.getBoundingClientRect().top + i, o = r + s, l =
|
|
3960
|
-
if (
|
|
3958
|
+
scrollTo(e) {
|
|
3959
|
+
const n = this.countryList, i = document.documentElement.scrollTop, s = n.offsetHeight, r = n.getBoundingClientRect().top + i, o = r + s, l = e.offsetHeight, u = e.getBoundingClientRect().top + i, a = u + l, c = u - r + n.scrollTop;
|
|
3960
|
+
if (u < r)
|
|
3961
3961
|
n.scrollTop = c;
|
|
3962
|
-
else if (
|
|
3962
|
+
else if (a > o) {
|
|
3963
3963
|
const d = s - l;
|
|
3964
3964
|
n.scrollTop = c - d;
|
|
3965
3965
|
}
|
|
3966
3966
|
}
|
|
3967
3967
|
//* Remove highlighting from the previous list item and highlight the new one.
|
|
3968
|
-
highlightListItem(
|
|
3968
|
+
highlightListItem(e, n) {
|
|
3969
3969
|
const i = this.highlightedItem;
|
|
3970
|
-
if (i && i.classList.remove(E.HIGHLIGHT), this.highlightedItem =
|
|
3970
|
+
if (i && i.classList.remove(E.HIGHLIGHT), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add(E.HIGHLIGHT), this.options.countrySearch)) {
|
|
3971
3971
|
const s = this.highlightedItem.getAttribute("id") || "";
|
|
3972
|
-
this.searchInput.setAttribute(
|
|
3972
|
+
this.searchInput.setAttribute(D.ACTIVE_DESCENDANT, s);
|
|
3973
3973
|
}
|
|
3974
3974
|
n && this.highlightedItem.focus();
|
|
3975
3975
|
}
|
|
3976
|
-
updateSelectedItem(
|
|
3977
|
-
if (this.selectedItem && this.selectedItem.dataset.countryCode !==
|
|
3976
|
+
updateSelectedItem(e) {
|
|
3977
|
+
if (this.selectedItem && this.selectedItem.dataset.countryCode !== e && (this.selectedItem.setAttribute(D.SELECTED, "false"), this.selectedItem = null), e && !this.selectedItem) {
|
|
3978
3978
|
const n = this.countryList.querySelector(
|
|
3979
|
-
`[data-country-code="${
|
|
3979
|
+
`[data-country-code="${e}"]`
|
|
3980
3980
|
);
|
|
3981
|
-
n && (n.setAttribute(
|
|
3981
|
+
n && (n.setAttribute(D.SELECTED, "true"), this.selectedItem = n);
|
|
3982
3982
|
}
|
|
3983
3983
|
}
|
|
3984
3984
|
//* Country search: Filter the country list to the given array of countries.
|
|
3985
|
-
filterCountries(
|
|
3985
|
+
filterCountries(e) {
|
|
3986
3986
|
this.countryList.innerHTML = "";
|
|
3987
3987
|
let n = !0;
|
|
3988
|
-
for (const i of
|
|
3988
|
+
for (const i of e) {
|
|
3989
3989
|
const s = i.nodeById[this.id];
|
|
3990
3990
|
s && (this.countryList.appendChild(s), n && (this.highlightListItem(s, !1), n = !1));
|
|
3991
3991
|
}
|
|
@@ -3993,102 +3993,108 @@ class Os {
|
|
|
3993
3993
|
}
|
|
3994
3994
|
destroy() {
|
|
3995
3995
|
this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
3996
|
-
const
|
|
3997
|
-
|
|
3996
|
+
const e = this.telInput.parentNode;
|
|
3997
|
+
e.before(this.telInput), e.remove(), this.telInput = null, this.countryContainer = null, this.selectedCountry = null, this.selectedCountryInner = null, this.selectedDialCode = null, this.dropdownArrow = null, this.dropdownContent = null, this.searchInput = null, this.searchIcon = null, this.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null, this.selectedItem = null;
|
|
3998
3998
|
for (const n of this.countries)
|
|
3999
3999
|
delete n.nodeById[this.id];
|
|
4000
4000
|
this.countries = null;
|
|
4001
4001
|
}
|
|
4002
4002
|
}
|
|
4003
|
-
const
|
|
4004
|
-
const { onlyCountries:
|
|
4005
|
-
if (
|
|
4006
|
-
const i =
|
|
4003
|
+
const Ms = (t) => {
|
|
4004
|
+
const { onlyCountries: e, excludeCountries: n } = t;
|
|
4005
|
+
if (e.length) {
|
|
4006
|
+
const i = e.map(
|
|
4007
4007
|
(s) => s.toLowerCase()
|
|
4008
4008
|
);
|
|
4009
|
-
return
|
|
4009
|
+
return Nt.filter(
|
|
4010
4010
|
(s) => i.includes(s.iso2)
|
|
4011
4011
|
);
|
|
4012
4012
|
} else if (n.length) {
|
|
4013
4013
|
const i = n.map(
|
|
4014
4014
|
(s) => s.toLowerCase()
|
|
4015
4015
|
);
|
|
4016
|
-
return
|
|
4016
|
+
return Nt.filter(
|
|
4017
4017
|
(s) => !i.includes(s.iso2)
|
|
4018
4018
|
);
|
|
4019
4019
|
}
|
|
4020
|
-
return
|
|
4021
|
-
},
|
|
4022
|
-
const { countryNameLocale: n, i18n: i } =
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
}
|
|
4028
|
-
|
|
4020
|
+
return Nt;
|
|
4021
|
+
}, xs = (t, e) => {
|
|
4022
|
+
const { countryNameLocale: n, i18n: i } = e;
|
|
4023
|
+
let s;
|
|
4024
|
+
try {
|
|
4025
|
+
typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? s = new Intl.DisplayNames(n, {
|
|
4026
|
+
type: "region"
|
|
4027
|
+
}) : s = null;
|
|
4028
|
+
} catch (r) {
|
|
4029
|
+
console.error(r), s = null;
|
|
4030
|
+
}
|
|
4031
|
+
for (const r of t)
|
|
4032
|
+
r.name = i[r.iso2] || (s == null ? void 0 : s.of(r.iso2.toUpperCase())) || "";
|
|
4033
|
+
}, Us = (t) => {
|
|
4034
|
+
const e = /* @__PURE__ */ new Set();
|
|
4029
4035
|
let n = 0;
|
|
4030
4036
|
const i = {}, s = (o, l) => {
|
|
4031
4037
|
if (!o || !l)
|
|
4032
4038
|
return;
|
|
4033
4039
|
l.length > n && (n = l.length), i.hasOwnProperty(l) || (i[l] = []);
|
|
4034
|
-
const
|
|
4035
|
-
|
|
4036
|
-
}, r = [...
|
|
4040
|
+
const u = i[l];
|
|
4041
|
+
u.includes(o) || u.push(o);
|
|
4042
|
+
}, r = [...t].sort((o, l) => o.priority - l.priority);
|
|
4037
4043
|
for (const o of r) {
|
|
4038
|
-
|
|
4044
|
+
e.has(o.dialCode) || e.add(o.dialCode);
|
|
4039
4045
|
for (let l = 1; l < o.dialCode.length; l++) {
|
|
4040
|
-
const
|
|
4041
|
-
s(o.iso2,
|
|
4046
|
+
const u = o.dialCode.substring(0, l);
|
|
4047
|
+
s(o.iso2, u);
|
|
4042
4048
|
}
|
|
4043
4049
|
if (s(o.iso2, o.dialCode), o.areaCodes) {
|
|
4044
4050
|
const l = i[o.dialCode][0];
|
|
4045
|
-
for (const
|
|
4046
|
-
for (let
|
|
4047
|
-
const c =
|
|
4051
|
+
for (const u of o.areaCodes) {
|
|
4052
|
+
for (let a = 1; a < u.length; a++) {
|
|
4053
|
+
const c = u.substring(0, a), d = o.dialCode + c;
|
|
4048
4054
|
s(l, d), s(o.iso2, d);
|
|
4049
4055
|
}
|
|
4050
|
-
s(o.iso2, o.dialCode +
|
|
4056
|
+
s(o.iso2, o.dialCode + u);
|
|
4051
4057
|
}
|
|
4052
4058
|
}
|
|
4053
4059
|
}
|
|
4054
|
-
return { dialCodes:
|
|
4055
|
-
},
|
|
4056
|
-
|
|
4060
|
+
return { dialCodes: e, dialCodeMaxLen: n, dialCodeToIso2Map: i };
|
|
4061
|
+
}, Hs = (t, e) => {
|
|
4062
|
+
e.countryOrder && (e.countryOrder = e.countryOrder.map(
|
|
4057
4063
|
(n) => n.toLowerCase()
|
|
4058
|
-
)),
|
|
4059
|
-
const { countryOrder: s } =
|
|
4064
|
+
)), t.sort((n, i) => {
|
|
4065
|
+
const { countryOrder: s } = e;
|
|
4060
4066
|
if (s) {
|
|
4061
|
-
const r = s.indexOf(n.iso2), o = s.indexOf(i.iso2), l = r > -1,
|
|
4062
|
-
if (l ||
|
|
4063
|
-
return l &&
|
|
4067
|
+
const r = s.indexOf(n.iso2), o = s.indexOf(i.iso2), l = r > -1, u = o > -1;
|
|
4068
|
+
if (l || u)
|
|
4069
|
+
return l && u ? r - o : l ? -1 : 1;
|
|
4064
4070
|
}
|
|
4065
4071
|
return n.name.localeCompare(i.name);
|
|
4066
4072
|
});
|
|
4067
|
-
},
|
|
4068
|
-
for (const
|
|
4069
|
-
|
|
4070
|
-
}, ze = (
|
|
4071
|
-
let s =
|
|
4072
|
-
if (n &&
|
|
4073
|
+
}, Fs = (t) => {
|
|
4074
|
+
for (const e of t)
|
|
4075
|
+
e.normalisedName = xn(e.name), e.initials = e.normalisedName.split(/[^a-z]/).map((n) => n[0]).join(""), e.dialCodePlus = `+${e.dialCode}`;
|
|
4076
|
+
}, ze = (t, e, n, i) => {
|
|
4077
|
+
let s = t;
|
|
4078
|
+
if (n && e) {
|
|
4073
4079
|
const r = `+${i.dialCode}`, o = s[r.length] === " " || s[r.length] === "-" ? r.length + 1 : r.length;
|
|
4074
4080
|
s = s.substring(o);
|
|
4075
4081
|
}
|
|
4076
4082
|
return s;
|
|
4077
|
-
},
|
|
4078
|
-
const r = n ? n.formatNumberAsYouType(
|
|
4079
|
-
return s &&
|
|
4080
|
-
},
|
|
4083
|
+
}, Bs = (t, e, n, i, s) => {
|
|
4084
|
+
const r = n ? n.formatNumberAsYouType(t, i.iso2) : t, { dialCode: o } = i;
|
|
4085
|
+
return s && e.charAt(0) !== "+" && r.includes(`+${o}`) ? (r.split(`+${o}`)[1] || "").trim() : r;
|
|
4086
|
+
}, Vs = (t, e, n, i) => {
|
|
4081
4087
|
if (n === 0 && !i)
|
|
4082
4088
|
return 0;
|
|
4083
4089
|
let s = 0;
|
|
4084
|
-
for (let r = 0; r <
|
|
4085
|
-
if (/[+0-9]/.test(
|
|
4090
|
+
for (let r = 0; r < e.length; r++) {
|
|
4091
|
+
if (/[+0-9]/.test(e[r]) && s++, s === t && !i)
|
|
4086
4092
|
return r + 1;
|
|
4087
|
-
if (i && s ===
|
|
4093
|
+
if (i && s === t + 1)
|
|
4088
4094
|
return r;
|
|
4089
4095
|
}
|
|
4090
|
-
return
|
|
4091
|
-
},
|
|
4096
|
+
return e.length;
|
|
4097
|
+
}, Ws = [
|
|
4092
4098
|
"800",
|
|
4093
4099
|
"822",
|
|
4094
4100
|
"833",
|
|
@@ -4106,20 +4112,20 @@ const Rs = (e) => {
|
|
|
4106
4112
|
"887",
|
|
4107
4113
|
"888",
|
|
4108
4114
|
"889"
|
|
4109
|
-
], qe = (
|
|
4110
|
-
const
|
|
4111
|
-
if (
|
|
4112
|
-
const n =
|
|
4113
|
-
return
|
|
4115
|
+
], qe = (t) => {
|
|
4116
|
+
const e = jt(t);
|
|
4117
|
+
if (e.startsWith(kn.NANP) && e.length >= 4) {
|
|
4118
|
+
const n = e.substring(1, 4);
|
|
4119
|
+
return Ws.includes(n);
|
|
4114
4120
|
}
|
|
4115
4121
|
return !1;
|
|
4116
4122
|
};
|
|
4117
|
-
let
|
|
4118
|
-
const
|
|
4123
|
+
let js = 0;
|
|
4124
|
+
const Gs = new Set(Nt.map((t) => t.iso2)), ae = (t) => Gs.has(t);
|
|
4119
4125
|
class Te {
|
|
4120
|
-
constructor(
|
|
4121
|
-
this.id =
|
|
4122
|
-
const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: r } =
|
|
4126
|
+
constructor(e, n = {}) {
|
|
4127
|
+
this.id = js++, this.options = { ...Mn, ...n }, As(this.options), this.ui = new ks(e, this.options, this.id), this.isAndroid = Te._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = Ms(this.options);
|
|
4128
|
+
const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: r } = Us(
|
|
4123
4129
|
this.countries
|
|
4124
4130
|
);
|
|
4125
4131
|
this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = r, this.countryByIso2 = new Map(this.countries.map((o) => [o.iso2, o])), this._init();
|
|
@@ -4127,38 +4133,38 @@ class Te {
|
|
|
4127
4133
|
static _getIsAndroid() {
|
|
4128
4134
|
return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
|
|
4129
4135
|
}
|
|
4130
|
-
_updateNumeralSet(
|
|
4131
|
-
/[\u0660-\u0669]/.test(
|
|
4136
|
+
_updateNumeralSet(e) {
|
|
4137
|
+
/[\u0660-\u0669]/.test(e) ? this.userNumeralSet = "arabic-indic" : /[\u06F0-\u06F9]/.test(e) ? this.userNumeralSet = "persian" : this.userNumeralSet = "ascii";
|
|
4132
4138
|
}
|
|
4133
|
-
_mapAsciiToUserNumerals(
|
|
4139
|
+
_mapAsciiToUserNumerals(e) {
|
|
4134
4140
|
if (this.userNumeralSet || this._updateNumeralSet(this.ui.telInput.value), this.userNumeralSet === "ascii")
|
|
4135
|
-
return
|
|
4141
|
+
return e;
|
|
4136
4142
|
const n = this.userNumeralSet === "arabic-indic" ? 1632 : 1776;
|
|
4137
|
-
return
|
|
4143
|
+
return e.replace(/[0-9]/g, (i) => String.fromCharCode(n + Number(i)));
|
|
4138
4144
|
}
|
|
4139
4145
|
// Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
|
|
4140
|
-
_normaliseNumerals(
|
|
4141
|
-
if (!
|
|
4146
|
+
_normaliseNumerals(e) {
|
|
4147
|
+
if (!e)
|
|
4142
4148
|
return "";
|
|
4143
|
-
if (this._updateNumeralSet(
|
|
4144
|
-
return
|
|
4149
|
+
if (this._updateNumeralSet(e), this.userNumeralSet === "ascii")
|
|
4150
|
+
return e;
|
|
4145
4151
|
const n = this.userNumeralSet === "arabic-indic" ? 1632 : 1776, i = this.userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
|
|
4146
|
-
return
|
|
4152
|
+
return e.replace(i, (s) => String.fromCharCode(48 + (s.charCodeAt(0) - n)));
|
|
4147
4153
|
}
|
|
4148
4154
|
_getTelInputValue() {
|
|
4149
|
-
const
|
|
4150
|
-
return this._normaliseNumerals(
|
|
4155
|
+
const e = this.ui.telInput.value.trim();
|
|
4156
|
+
return this._normaliseNumerals(e);
|
|
4151
4157
|
}
|
|
4152
|
-
_setTelInputValue(
|
|
4153
|
-
this.ui.telInput.value = this._mapAsciiToUserNumerals(
|
|
4158
|
+
_setTelInputValue(e) {
|
|
4159
|
+
this.ui.telInput.value = this._mapAsciiToUserNumerals(e);
|
|
4154
4160
|
}
|
|
4155
4161
|
_createInitPromises() {
|
|
4156
|
-
const
|
|
4162
|
+
const e = new Promise((i, s) => {
|
|
4157
4163
|
this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
|
|
4158
4164
|
}), n = new Promise((i, s) => {
|
|
4159
4165
|
this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
|
|
4160
4166
|
});
|
|
4161
|
-
return Promise.all([
|
|
4167
|
+
return Promise.all([e, n]);
|
|
4162
4168
|
}
|
|
4163
4169
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
4164
4170
|
_init() {
|
|
@@ -4169,18 +4175,18 @@ class Te {
|
|
|
4169
4175
|
//********************
|
|
4170
4176
|
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
4171
4177
|
_processCountryData() {
|
|
4172
|
-
|
|
4178
|
+
xs(this.countries, this.options), Hs(this.countries, this.options), Fs(this.countries);
|
|
4173
4179
|
}
|
|
4174
4180
|
//* Set the initial state of the input value and the selected country by:
|
|
4175
4181
|
//* 1. Extracting a dial code from the given number
|
|
4176
4182
|
//* 2. Using explicit initialCountry
|
|
4177
|
-
_setInitialState(
|
|
4178
|
-
const n = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(n), s = this._getTelInputValue(), o = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, l = this._getDialCode(o),
|
|
4179
|
-
if (l && !
|
|
4183
|
+
_setInitialState(e = !1) {
|
|
4184
|
+
const n = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(n), s = this._getTelInputValue(), o = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, l = this._getDialCode(o), u = qe(o), { initialCountry: a, geoIpLookup: c } = this.options, d = a === oe.AUTO && c;
|
|
4185
|
+
if (l && !u)
|
|
4180
4186
|
this._updateCountryFromNumber(o);
|
|
4181
|
-
else if (!d ||
|
|
4182
|
-
const f =
|
|
4183
|
-
|
|
4187
|
+
else if (!d || e) {
|
|
4188
|
+
const f = a ? a.toLowerCase() : "";
|
|
4189
|
+
ae(f) ? this._setCountry(f) : l && u ? this._setCountry(Ns.ISO2) : this._setCountry("");
|
|
4184
4190
|
}
|
|
4185
4191
|
o && this._updateValFromNumber(o);
|
|
4186
4192
|
}
|
|
@@ -4191,19 +4197,19 @@ class Te {
|
|
|
4191
4197
|
//* Update hidden input on form submit.
|
|
4192
4198
|
_initHiddenInputListener() {
|
|
4193
4199
|
var n;
|
|
4194
|
-
const
|
|
4200
|
+
const e = () => {
|
|
4195
4201
|
this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
|
|
4196
4202
|
};
|
|
4197
|
-
(n = this.ui.telInput.form) == null || n.addEventListener("submit",
|
|
4203
|
+
(n = this.ui.telInput.form) == null || n.addEventListener("submit", e, {
|
|
4198
4204
|
signal: this.abortController.signal
|
|
4199
4205
|
});
|
|
4200
4206
|
}
|
|
4201
4207
|
//* initialise the dropdown listeners.
|
|
4202
4208
|
_initDropdownListeners() {
|
|
4203
|
-
const
|
|
4209
|
+
const e = this.abortController.signal, n = (o) => {
|
|
4204
4210
|
this.ui.dropdownContent.classList.contains(E.HIDE) ? this.ui.telInput.focus() : o.preventDefault();
|
|
4205
4211
|
}, i = this.ui.telInput.closest("label");
|
|
4206
|
-
i && i.addEventListener("click", n, { signal:
|
|
4212
|
+
i && i.addEventListener("click", n, { signal: e });
|
|
4207
4213
|
const s = () => {
|
|
4208
4214
|
this.ui.dropdownContent.classList.contains(
|
|
4209
4215
|
E.HIDE
|
|
@@ -4213,30 +4219,30 @@ class Te {
|
|
|
4213
4219
|
"click",
|
|
4214
4220
|
s,
|
|
4215
4221
|
{
|
|
4216
|
-
signal:
|
|
4222
|
+
signal: e
|
|
4217
4223
|
}
|
|
4218
4224
|
);
|
|
4219
4225
|
const r = (o) => {
|
|
4220
4226
|
this.ui.dropdownContent.classList.contains(
|
|
4221
4227
|
E.HIDE
|
|
4222
|
-
) && [
|
|
4228
|
+
) && [M.ARROW_UP, M.ARROW_DOWN, M.SPACE, M.ENTER].includes(o.key) && (o.preventDefault(), o.stopPropagation(), this._openDropdown()), o.key === M.TAB && this._closeDropdown();
|
|
4223
4229
|
};
|
|
4224
4230
|
this.ui.countryContainer.addEventListener(
|
|
4225
4231
|
"keydown",
|
|
4226
4232
|
r,
|
|
4227
|
-
{ signal:
|
|
4233
|
+
{ signal: e }
|
|
4228
4234
|
);
|
|
4229
4235
|
}
|
|
4230
4236
|
//* Init many requests: utils script / geo ip lookup.
|
|
4231
4237
|
_initRequests() {
|
|
4232
|
-
const { loadUtils:
|
|
4233
|
-
if (
|
|
4238
|
+
const { loadUtils: e, initialCountry: n, geoIpLookup: i } = this.options;
|
|
4239
|
+
if (e && !C.utils) {
|
|
4234
4240
|
const r = () => {
|
|
4235
4241
|
var o;
|
|
4236
|
-
(o =
|
|
4242
|
+
(o = C.attachUtils(e)) == null || o.catch(() => {
|
|
4237
4243
|
});
|
|
4238
4244
|
};
|
|
4239
|
-
if (
|
|
4245
|
+
if (C.documentReady())
|
|
4240
4246
|
r();
|
|
4241
4247
|
else {
|
|
4242
4248
|
const o = () => {
|
|
@@ -4248,14 +4254,14 @@ class Te {
|
|
|
4248
4254
|
}
|
|
4249
4255
|
} else
|
|
4250
4256
|
this.resolveUtilsScriptPromise();
|
|
4251
|
-
n ===
|
|
4257
|
+
n === oe.AUTO && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
4252
4258
|
}
|
|
4253
4259
|
//* Perform the geo ip lookup.
|
|
4254
4260
|
_loadAutoCountry() {
|
|
4255
|
-
|
|
4256
|
-
(
|
|
4257
|
-
const n =
|
|
4258
|
-
|
|
4261
|
+
C.autoCountry ? this.handleAutoCountry() : C.startedLoadingAutoCountry || (C.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
4262
|
+
(e = "") => {
|
|
4263
|
+
const n = e.toLowerCase();
|
|
4264
|
+
ae(n) ? (C.autoCountry = n, setTimeout(() => kt("handleAutoCountry"))) : (this._setInitialState(!0), kt("rejectAutoCountryPromise"));
|
|
4259
4265
|
},
|
|
4260
4266
|
() => {
|
|
4261
4267
|
this._setInitialState(!0), kt("rejectAutoCountryPromise");
|
|
@@ -4271,49 +4277,49 @@ class Te {
|
|
|
4271
4277
|
}
|
|
4272
4278
|
_bindInputListener() {
|
|
4273
4279
|
const {
|
|
4274
|
-
strictMode:
|
|
4280
|
+
strictMode: e,
|
|
4275
4281
|
formatAsYouType: n,
|
|
4276
4282
|
separateDialCode: i,
|
|
4277
4283
|
allowDropdown: s,
|
|
4278
4284
|
countrySearch: r
|
|
4279
4285
|
} = this.options;
|
|
4280
4286
|
let o = !1;
|
|
4281
|
-
|
|
4282
|
-
const l = (
|
|
4283
|
-
const
|
|
4284
|
-
if (this.isAndroid && (
|
|
4285
|
-
const
|
|
4286
|
-
this._setTelInputValue(
|
|
4287
|
+
ut.ALPHA_UNICODE.test(this._getTelInputValue()) && (o = !0);
|
|
4288
|
+
const l = (u) => {
|
|
4289
|
+
const a = this._getTelInputValue();
|
|
4290
|
+
if (this.isAndroid && (u == null ? void 0 : u.data) === "+" && i && s && r) {
|
|
4291
|
+
const _ = this.ui.telInput.selectionStart || 0, g = a.substring(0, _ - 1), b = a.substring(_);
|
|
4292
|
+
this._setTelInputValue(g + b), this._openDropdownWithPlus();
|
|
4287
4293
|
return;
|
|
4288
4294
|
}
|
|
4289
|
-
this._updateCountryFromNumber(
|
|
4290
|
-
const c = (
|
|
4291
|
-
c || d && !
|
|
4292
|
-
const f = (
|
|
4293
|
-
if (n && !o && !f &&
|
|
4294
|
-
const
|
|
4295
|
+
this._updateCountryFromNumber(a) && this._triggerCountryChange();
|
|
4296
|
+
const c = (u == null ? void 0 : u.data) && ut.NON_PLUS_NUMERIC.test(u.data), d = (u == null ? void 0 : u.inputType) === Ge.PASTE && a;
|
|
4297
|
+
c || d && !e ? o = !0 : ut.NON_PLUS_NUMERIC.test(a) || (o = !1);
|
|
4298
|
+
const f = (u == null ? void 0 : u.detail) && u.detail.isSetNumber, p = this.userNumeralSet === "ascii";
|
|
4299
|
+
if (n && !o && !f && p) {
|
|
4300
|
+
const _ = this.ui.telInput.selectionStart || 0, b = a.substring(
|
|
4295
4301
|
0,
|
|
4296
|
-
|
|
4302
|
+
_
|
|
4297
4303
|
).replace(
|
|
4298
|
-
|
|
4304
|
+
ut.NON_PLUS_NUMERIC_GLOBAL,
|
|
4299
4305
|
""
|
|
4300
|
-
).length, y = (
|
|
4306
|
+
).length, y = (u == null ? void 0 : u.inputType) === Ge.DELETE_FWD, v = this._getFullNumber(), h = Bs(
|
|
4301
4307
|
v,
|
|
4302
|
-
|
|
4303
|
-
|
|
4308
|
+
a,
|
|
4309
|
+
C.utils,
|
|
4304
4310
|
this.selectedCountryData,
|
|
4305
4311
|
i
|
|
4306
|
-
), m =
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4312
|
+
), m = Vs(
|
|
4313
|
+
b,
|
|
4314
|
+
h,
|
|
4315
|
+
_,
|
|
4310
4316
|
y
|
|
4311
4317
|
);
|
|
4312
|
-
this._setTelInputValue(
|
|
4318
|
+
this._setTelInputValue(h), this.ui.telInput.setSelectionRange(m, m);
|
|
4313
4319
|
}
|
|
4314
|
-
if (i &&
|
|
4315
|
-
const
|
|
4316
|
-
this._setTelInputValue(
|
|
4320
|
+
if (i && a.startsWith("+") && this.selectedCountryData.dialCode) {
|
|
4321
|
+
const _ = ze(a, !0, i, this.selectedCountryData);
|
|
4322
|
+
this._setTelInputValue(_);
|
|
4317
4323
|
}
|
|
4318
4324
|
};
|
|
4319
4325
|
this.ui.telInput.addEventListener(
|
|
@@ -4325,20 +4331,20 @@ class Te {
|
|
|
4325
4331
|
);
|
|
4326
4332
|
}
|
|
4327
4333
|
_maybeBindKeydownListener() {
|
|
4328
|
-
const { strictMode:
|
|
4329
|
-
if (
|
|
4334
|
+
const { strictMode: e, separateDialCode: n, allowDropdown: i, countrySearch: s } = this.options;
|
|
4335
|
+
if (e || n) {
|
|
4330
4336
|
const r = (o) => {
|
|
4331
4337
|
if (o.key && o.key.length === 1 && !o.altKey && !o.ctrlKey && !o.metaKey) {
|
|
4332
4338
|
if (n && i && s && o.key === "+") {
|
|
4333
4339
|
o.preventDefault(), this._openDropdownWithPlus();
|
|
4334
4340
|
return;
|
|
4335
4341
|
}
|
|
4336
|
-
if (
|
|
4337
|
-
const l = this._getTelInputValue(),
|
|
4338
|
-
|
|
4342
|
+
if (e) {
|
|
4343
|
+
const l = this._getTelInputValue(), a = !l.startsWith("+") && this.ui.telInput.selectionStart === 0 && o.key === "+", c = this._normaliseNumerals(o.key), d = /^[0-9]$/.test(c), f = n ? d : a || d, p = this.ui.telInput, _ = p.selectionStart, g = p.selectionEnd, b = l.slice(0, _), y = l.slice(g), v = b + o.key + y, h = this._getFullNumber(v), m = C.utils.getCoreNumber(
|
|
4344
|
+
h,
|
|
4339
4345
|
this.selectedCountryData.iso2
|
|
4340
|
-
), S = this.maxCoreNumberLength && m.length > this.maxCoreNumberLength, O = this._getNewCountryFromNumber(
|
|
4341
|
-
(!f || S && !O && !
|
|
4346
|
+
), S = this.maxCoreNumberLength && m.length > this.maxCoreNumberLength, O = this._getNewCountryFromNumber(h) !== null;
|
|
4347
|
+
(!f || S && !O && !a) && o.preventDefault();
|
|
4342
4348
|
}
|
|
4343
4349
|
}
|
|
4344
4350
|
};
|
|
@@ -4349,14 +4355,14 @@ class Te {
|
|
|
4349
4355
|
}
|
|
4350
4356
|
_maybeBindPasteListener() {
|
|
4351
4357
|
if (this.options.strictMode) {
|
|
4352
|
-
const
|
|
4358
|
+
const e = (n) => {
|
|
4353
4359
|
n.preventDefault();
|
|
4354
|
-
const i = this.ui.telInput, s = i.selectionStart, r = i.selectionEnd, o = this._getTelInputValue(), l = o.slice(0, s),
|
|
4355
|
-
let v = l + y +
|
|
4360
|
+
const i = this.ui.telInput, s = i.selectionStart, r = i.selectionEnd, o = this._getTelInputValue(), l = o.slice(0, s), u = o.slice(r), a = this.selectedCountryData.iso2, c = n.clipboardData.getData("text"), d = this._normaliseNumerals(c), f = s === 0 && r > 0, p = !o.startsWith("+") || f, _ = d.replace(ut.NON_PLUS_NUMERIC_GLOBAL, ""), g = _.startsWith("+"), b = _.replace(/\+/g, ""), y = g && p ? `+${b}` : b;
|
|
4361
|
+
let v = l + y + u;
|
|
4356
4362
|
if (v.length > 5) {
|
|
4357
|
-
let m =
|
|
4363
|
+
let m = C.utils.getCoreNumber(v, a);
|
|
4358
4364
|
for (; m.length === 0 && v.length > 0; )
|
|
4359
|
-
v = v.slice(0, -1), m =
|
|
4365
|
+
v = v.slice(0, -1), m = C.utils.getCoreNumber(v, a);
|
|
4360
4366
|
if (!m)
|
|
4361
4367
|
return;
|
|
4362
4368
|
if (this.maxCoreNumberLength && m.length > this.maxCoreNumberLength)
|
|
@@ -4367,22 +4373,22 @@ class Te {
|
|
|
4367
4373
|
return;
|
|
4368
4374
|
}
|
|
4369
4375
|
this._setTelInputValue(v);
|
|
4370
|
-
const
|
|
4371
|
-
i.setSelectionRange(
|
|
4376
|
+
const h = s + y.length;
|
|
4377
|
+
i.setSelectionRange(h, h), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
|
|
4372
4378
|
};
|
|
4373
|
-
this.ui.telInput.addEventListener("paste",
|
|
4379
|
+
this.ui.telInput.addEventListener("paste", e, {
|
|
4374
4380
|
signal: this.abortController.signal
|
|
4375
4381
|
});
|
|
4376
4382
|
}
|
|
4377
4383
|
}
|
|
4378
4384
|
//* Adhere to the input's maxlength attr.
|
|
4379
|
-
_cap(
|
|
4385
|
+
_cap(e) {
|
|
4380
4386
|
const n = Number(this.ui.telInput.getAttribute("maxlength"));
|
|
4381
|
-
return n &&
|
|
4387
|
+
return n && e.length > n ? e.substring(0, n) : e;
|
|
4382
4388
|
}
|
|
4383
4389
|
//* Trigger a custom event on the input (typed via ItiEventMap).
|
|
4384
|
-
_trigger(
|
|
4385
|
-
const i = new CustomEvent(
|
|
4390
|
+
_trigger(e, n = {}) {
|
|
4391
|
+
const i = new CustomEvent(e, {
|
|
4386
4392
|
bubbles: !0,
|
|
4387
4393
|
cancelable: !0,
|
|
4388
4394
|
detail: n
|
|
@@ -4391,19 +4397,19 @@ class Te {
|
|
|
4391
4397
|
}
|
|
4392
4398
|
//* Open the dropdown.
|
|
4393
4399
|
_openDropdown() {
|
|
4394
|
-
const { fixDropdownWidth:
|
|
4395
|
-
if (this.dropdownAbortController = new AbortController(),
|
|
4400
|
+
const { fixDropdownWidth: e, countrySearch: n } = this.options;
|
|
4401
|
+
if (this.dropdownAbortController = new AbortController(), e && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(E.HIDE), this.ui.selectedCountry.setAttribute(D.EXPANDED, "true"), this._setDropdownPosition(), n) {
|
|
4396
4402
|
const i = this.ui.countryList.firstElementChild;
|
|
4397
4403
|
i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
|
|
4398
4404
|
}
|
|
4399
|
-
this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(E.ARROW_UP), this._trigger(
|
|
4405
|
+
this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(E.ARROW_UP), this._trigger(Vt.OPEN_COUNTRY_DROPDOWN);
|
|
4400
4406
|
}
|
|
4401
4407
|
//* Set the dropdown position
|
|
4402
4408
|
_setDropdownPosition() {
|
|
4403
4409
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
|
|
4404
|
-
const
|
|
4410
|
+
const e = this.ui.telInput.getBoundingClientRect(), n = this.ui.telInput.offsetHeight;
|
|
4405
4411
|
if (this.options.dropdownContainer) {
|
|
4406
|
-
this.ui.dropdown.style.top = `${
|
|
4412
|
+
this.ui.dropdown.style.top = `${e.top + n}px`, this.ui.dropdown.style.left = `${e.left}px`;
|
|
4407
4413
|
const i = () => this._closeDropdown();
|
|
4408
4414
|
window.addEventListener("scroll", i, {
|
|
4409
4415
|
signal: this.dropdownAbortController.signal
|
|
@@ -4413,12 +4419,12 @@ class Te {
|
|
|
4413
4419
|
}
|
|
4414
4420
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
4415
4421
|
_bindDropdownListeners() {
|
|
4416
|
-
const
|
|
4417
|
-
this._bindDropdownMouseoverListener(
|
|
4422
|
+
const e = this.dropdownAbortController.signal;
|
|
4423
|
+
this._bindDropdownMouseoverListener(e), this._bindDropdownCountryClickListener(e), this._bindDropdownClickOffListener(e), this._bindDropdownKeydownListener(e), this.options.countrySearch && this._bindDropdownSearchListeners(e);
|
|
4418
4424
|
}
|
|
4419
4425
|
//* When mouse over a list item, just highlight that one
|
|
4420
4426
|
//* we add the class "highlight", so if they hit "enter" we know which one to select.
|
|
4421
|
-
_bindDropdownMouseoverListener(
|
|
4427
|
+
_bindDropdownMouseoverListener(e) {
|
|
4422
4428
|
const n = (i) => {
|
|
4423
4429
|
var r;
|
|
4424
4430
|
const s = (r = i.target) == null ? void 0 : r.closest(
|
|
@@ -4430,12 +4436,12 @@ class Te {
|
|
|
4430
4436
|
"mouseover",
|
|
4431
4437
|
n,
|
|
4432
4438
|
{
|
|
4433
|
-
signal:
|
|
4439
|
+
signal: e
|
|
4434
4440
|
}
|
|
4435
4441
|
);
|
|
4436
4442
|
}
|
|
4437
4443
|
//* Listen for country selection.
|
|
4438
|
-
_bindDropdownCountryClickListener(
|
|
4444
|
+
_bindDropdownCountryClickListener(e) {
|
|
4439
4445
|
const n = (i) => {
|
|
4440
4446
|
var r;
|
|
4441
4447
|
const s = (r = i.target) == null ? void 0 : r.closest(
|
|
@@ -4444,12 +4450,12 @@ class Te {
|
|
|
4444
4450
|
s && this._selectListItem(s);
|
|
4445
4451
|
};
|
|
4446
4452
|
this.ui.countryList.addEventListener("click", n, {
|
|
4447
|
-
signal:
|
|
4453
|
+
signal: e
|
|
4448
4454
|
});
|
|
4449
4455
|
}
|
|
4450
4456
|
//* Click off to close (except when this initial opening click is bubbling up).
|
|
4451
4457
|
//* We cannot just stopPropagation as it may be needed to close another instance.
|
|
4452
|
-
_bindDropdownClickOffListener(
|
|
4458
|
+
_bindDropdownClickOffListener(e) {
|
|
4453
4459
|
const n = (i) => {
|
|
4454
4460
|
!!i.target.closest(
|
|
4455
4461
|
`#iti-${this.id}__dropdown-content`
|
|
@@ -4459,7 +4465,7 @@ class Te {
|
|
|
4459
4465
|
document.documentElement.addEventListener(
|
|
4460
4466
|
"click",
|
|
4461
4467
|
n,
|
|
4462
|
-
{ signal:
|
|
4468
|
+
{ signal: e }
|
|
4463
4469
|
);
|
|
4464
4470
|
}, 0);
|
|
4465
4471
|
}
|
|
@@ -4467,22 +4473,22 @@ class Te {
|
|
|
4467
4473
|
//* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
|
|
4468
4474
|
//* just hit down and hold it to scroll down (no keyup event).
|
|
4469
4475
|
//* Listen on the document because that's where key events are triggered if no input has focus.
|
|
4470
|
-
_bindDropdownKeydownListener(
|
|
4476
|
+
_bindDropdownKeydownListener(e) {
|
|
4471
4477
|
let n = "", i = null;
|
|
4472
4478
|
const s = (r) => {
|
|
4473
4479
|
[
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
].includes(r.key) && (r.preventDefault(), r.stopPropagation(), r.key ===
|
|
4480
|
+
M.ARROW_UP,
|
|
4481
|
+
M.ARROW_DOWN,
|
|
4482
|
+
M.ENTER,
|
|
4483
|
+
M.ESC
|
|
4484
|
+
].includes(r.key) && (r.preventDefault(), r.stopPropagation(), r.key === M.ARROW_UP || r.key === M.ARROW_DOWN ? this._handleUpDownKey(r.key) : r.key === M.ENTER ? this._handleEnterKey() : r.key === M.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && ut.HIDDEN_SEARCH_CHAR.test(r.key) && (r.stopPropagation(), i && clearTimeout(i), n += r.key.toLowerCase(), this._searchForCountry(n), i = setTimeout(() => {
|
|
4479
4485
|
n = "";
|
|
4480
|
-
},
|
|
4486
|
+
}, Es.HIDDEN_SEARCH_RESET_MS));
|
|
4481
4487
|
};
|
|
4482
|
-
document.addEventListener("keydown", s, { signal:
|
|
4488
|
+
document.addEventListener("keydown", s, { signal: e });
|
|
4483
4489
|
}
|
|
4484
4490
|
//* Search input listeners when countrySearch enabled.
|
|
4485
|
-
_bindDropdownSearchListeners(
|
|
4491
|
+
_bindDropdownSearchListeners(e) {
|
|
4486
4492
|
const n = () => {
|
|
4487
4493
|
const o = this.ui.searchInput.value.trim();
|
|
4488
4494
|
this._filterCountriesByQuery(o), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove(E.HIDE) : this.ui.searchClearButton.classList.add(E.HIDE);
|
|
@@ -4494,33 +4500,33 @@ class Te {
|
|
|
4494
4500
|
}, 100);
|
|
4495
4501
|
};
|
|
4496
4502
|
this.ui.searchInput.addEventListener("input", s, {
|
|
4497
|
-
signal:
|
|
4503
|
+
signal: e
|
|
4498
4504
|
});
|
|
4499
4505
|
const r = () => {
|
|
4500
4506
|
this.ui.searchInput.value = "", this.ui.searchInput.focus(), n();
|
|
4501
4507
|
};
|
|
4502
4508
|
this.ui.searchClearButton.addEventListener("click", r, {
|
|
4503
|
-
signal:
|
|
4509
|
+
signal: e
|
|
4504
4510
|
});
|
|
4505
4511
|
}
|
|
4506
4512
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
4507
|
-
_searchForCountry(
|
|
4508
|
-
const n =
|
|
4513
|
+
_searchForCountry(e) {
|
|
4514
|
+
const n = Ss(this.countries, e);
|
|
4509
4515
|
if (n) {
|
|
4510
4516
|
const i = n.nodeById[this.id];
|
|
4511
4517
|
this.ui.highlightListItem(i, !1), this.ui.scrollTo(i);
|
|
4512
4518
|
}
|
|
4513
4519
|
}
|
|
4514
4520
|
//* Country search: Filter the countries according to the search query.
|
|
4515
|
-
_filterCountriesByQuery(
|
|
4521
|
+
_filterCountriesByQuery(e) {
|
|
4516
4522
|
let n;
|
|
4517
|
-
|
|
4523
|
+
e === "" ? n = this.countries : n = Ts(this.countries, e), this.ui.filterCountries(n);
|
|
4518
4524
|
}
|
|
4519
4525
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
4520
|
-
_handleUpDownKey(
|
|
4526
|
+
_handleUpDownKey(e) {
|
|
4521
4527
|
var i, s;
|
|
4522
|
-
let n =
|
|
4523
|
-
!n && this.ui.countryList.childElementCount > 1 && (n =
|
|
4528
|
+
let n = e === M.ARROW_UP ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
|
|
4529
|
+
!n && this.ui.countryList.childElementCount > 1 && (n = e === M.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), n && (this.ui.scrollTo(n), this.ui.highlightListItem(n, !1));
|
|
4524
4530
|
}
|
|
4525
4531
|
//* Select the currently highlighted item.
|
|
4526
4532
|
_handleEnterKey() {
|
|
@@ -4528,11 +4534,11 @@ class Te {
|
|
|
4528
4534
|
}
|
|
4529
4535
|
//* Update the input's value to the given val (format first if possible)
|
|
4530
4536
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
4531
|
-
_updateValFromNumber(
|
|
4532
|
-
let n =
|
|
4533
|
-
if (this.options.formatOnDisplay &&
|
|
4534
|
-
const i = this.options.nationalMode || !n.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: r } =
|
|
4535
|
-
n =
|
|
4537
|
+
_updateValFromNumber(e) {
|
|
4538
|
+
let n = e;
|
|
4539
|
+
if (this.options.formatOnDisplay && C.utils && this.selectedCountryData) {
|
|
4540
|
+
const i = this.options.nationalMode || !n.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: r } = C.utils.numberFormat, o = i ? s : r;
|
|
4541
|
+
n = C.utils.formatNumber(
|
|
4536
4542
|
n,
|
|
4537
4543
|
this.selectedCountryData.iso2,
|
|
4538
4544
|
o
|
|
@@ -4542,34 +4548,34 @@ class Te {
|
|
|
4542
4548
|
}
|
|
4543
4549
|
//* Check if need to select a new country based on the given number
|
|
4544
4550
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
4545
|
-
_updateCountryFromNumber(
|
|
4546
|
-
const n = this._getNewCountryFromNumber(
|
|
4551
|
+
_updateCountryFromNumber(e) {
|
|
4552
|
+
const n = this._getNewCountryFromNumber(e);
|
|
4547
4553
|
return n !== null ? this._setCountry(n) : !1;
|
|
4548
4554
|
}
|
|
4549
4555
|
// if there is a selected country, and the number doesn't start with a dial code, then add it
|
|
4550
|
-
_ensureHasDialCode(
|
|
4556
|
+
_ensureHasDialCode(e) {
|
|
4551
4557
|
const { dialCode: n, nationalPrefix: i } = this.selectedCountryData;
|
|
4552
|
-
if (
|
|
4553
|
-
return
|
|
4554
|
-
const o = i &&
|
|
4558
|
+
if (e.startsWith("+") || !n)
|
|
4559
|
+
return e;
|
|
4560
|
+
const o = i && e.startsWith(i) && !this.options.separateDialCode ? e.substring(1) : e;
|
|
4555
4561
|
return `+${n}${o}`;
|
|
4556
4562
|
}
|
|
4557
4563
|
// Get the country ISO2 code from the given number
|
|
4558
4564
|
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
4559
4565
|
// NOTE: consider refactoring this to be more clear
|
|
4560
|
-
_getNewCountryFromNumber(
|
|
4561
|
-
const n =
|
|
4562
|
-
let i = n ?
|
|
4566
|
+
_getNewCountryFromNumber(e) {
|
|
4567
|
+
const n = e.indexOf("+");
|
|
4568
|
+
let i = n ? e.substring(n) : e;
|
|
4563
4569
|
const s = this.selectedCountryData.iso2, r = this.selectedCountryData.dialCode;
|
|
4564
4570
|
i = this._ensureHasDialCode(i);
|
|
4565
|
-
const o = this._getDialCode(i, !0), l =
|
|
4571
|
+
const o = this._getDialCode(i, !0), l = jt(i);
|
|
4566
4572
|
if (o) {
|
|
4567
|
-
const
|
|
4568
|
-
if (
|
|
4569
|
-
return
|
|
4570
|
-
if (!s && this.defaultCountry &&
|
|
4573
|
+
const u = jt(o), a = this.dialCodeToIso2Map[u];
|
|
4574
|
+
if (a.length === 1)
|
|
4575
|
+
return a[0] === s ? null : a[0];
|
|
4576
|
+
if (!s && this.defaultCountry && a.includes(this.defaultCountry))
|
|
4571
4577
|
return this.defaultCountry;
|
|
4572
|
-
if (r ===
|
|
4578
|
+
if (r === kn.NANP && qe(l))
|
|
4573
4579
|
return null;
|
|
4574
4580
|
const { areaCodes: d, priority: f } = this.selectedCountryData;
|
|
4575
4581
|
if (d) {
|
|
@@ -4580,70 +4586,70 @@ class Te {
|
|
|
4580
4586
|
if (l.startsWith(v))
|
|
4581
4587
|
return null;
|
|
4582
4588
|
}
|
|
4583
|
-
const
|
|
4584
|
-
if (!
|
|
4585
|
-
return
|
|
4589
|
+
const _ = d && !(f === 0) && l.length > u.length, g = s && a.includes(s) && !_, b = s === a[0];
|
|
4590
|
+
if (!g && !b)
|
|
4591
|
+
return a[0];
|
|
4586
4592
|
} else if (i.startsWith("+") && l.length) {
|
|
4587
|
-
const
|
|
4588
|
-
return
|
|
4593
|
+
const u = this.selectedCountryData.dialCode || "";
|
|
4594
|
+
return u && u.startsWith(l) ? null : "";
|
|
4589
4595
|
} else if ((!i || i === "+") && !s)
|
|
4590
4596
|
return this.defaultCountry;
|
|
4591
4597
|
return null;
|
|
4592
4598
|
}
|
|
4593
4599
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
|
|
4594
4600
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
4595
|
-
_setCountry(
|
|
4601
|
+
_setCountry(e) {
|
|
4596
4602
|
const { separateDialCode: n, showFlags: i, i18n: s, allowDropdown: r } = this.options, o = this.selectedCountryData.iso2 || "";
|
|
4597
|
-
if (r && this.ui.updateSelectedItem(
|
|
4598
|
-
const l =
|
|
4599
|
-
let
|
|
4600
|
-
if (
|
|
4603
|
+
if (r && this.ui.updateSelectedItem(e), this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
|
|
4604
|
+
const l = e && i ? `${E.FLAG} iti__${e}` : `${E.FLAG} ${E.GLOBE}`;
|
|
4605
|
+
let u, a, c;
|
|
4606
|
+
if (e) {
|
|
4601
4607
|
const { name: d, dialCode: f } = this.selectedCountryData;
|
|
4602
|
-
|
|
4608
|
+
a = d, u = s.selectedCountryAriaLabel.replace("${countryName}", d).replace("${dialCode}", `+${f}`), c = "";
|
|
4603
4609
|
} else
|
|
4604
|
-
|
|
4605
|
-
this.ui.selectedCountryInner.className = l, this.ui.selectedCountry.setAttribute("title",
|
|
4610
|
+
a = s.noCountrySelected, u = s.noCountrySelected, c = Rs();
|
|
4611
|
+
this.ui.selectedCountryInner.className = l, this.ui.selectedCountry.setAttribute("title", a), this.ui.selectedCountry.setAttribute(D.LABEL, u), this.ui.selectedCountryInner.innerHTML = c;
|
|
4606
4612
|
}
|
|
4607
4613
|
if (n) {
|
|
4608
4614
|
const l = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
4609
4615
|
this.ui.selectedDialCode.textContent = l, this.ui.updateInputPadding();
|
|
4610
4616
|
}
|
|
4611
|
-
return this._updatePlaceholder(), this._updateMaxLength(), o !==
|
|
4617
|
+
return this._updatePlaceholder(), this._updateMaxLength(), o !== e;
|
|
4612
4618
|
}
|
|
4613
4619
|
//* Update the maximum valid number length for the currently selected country.
|
|
4614
4620
|
_updateMaxLength() {
|
|
4615
|
-
const { strictMode:
|
|
4616
|
-
if (
|
|
4621
|
+
const { strictMode: e, placeholderNumberType: n, allowedNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
|
|
4622
|
+
if (e && C.utils)
|
|
4617
4623
|
if (s) {
|
|
4618
|
-
const r =
|
|
4619
|
-
let o =
|
|
4624
|
+
const r = C.utils.numberType[n];
|
|
4625
|
+
let o = C.utils.getExampleNumber(
|
|
4620
4626
|
s,
|
|
4621
4627
|
!1,
|
|
4622
4628
|
r,
|
|
4623
4629
|
!0
|
|
4624
4630
|
), l = o;
|
|
4625
|
-
for (;
|
|
4631
|
+
for (; C.utils.isPossibleNumber(
|
|
4626
4632
|
o,
|
|
4627
4633
|
s,
|
|
4628
4634
|
i
|
|
4629
4635
|
); )
|
|
4630
4636
|
l = o, o += "0";
|
|
4631
|
-
const
|
|
4632
|
-
this.maxCoreNumberLength =
|
|
4637
|
+
const u = C.utils.getCoreNumber(l, s);
|
|
4638
|
+
this.maxCoreNumberLength = u.length, s === "by" && (this.maxCoreNumberLength = u.length + 1);
|
|
4633
4639
|
} else
|
|
4634
4640
|
this.maxCoreNumberLength = null;
|
|
4635
4641
|
}
|
|
4636
4642
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
4637
4643
|
_updatePlaceholder() {
|
|
4638
4644
|
const {
|
|
4639
|
-
autoPlaceholder:
|
|
4645
|
+
autoPlaceholder: e,
|
|
4640
4646
|
placeholderNumberType: n,
|
|
4641
4647
|
nationalMode: i,
|
|
4642
4648
|
customPlaceholder: s
|
|
4643
|
-
} = this.options, r =
|
|
4644
|
-
if (
|
|
4645
|
-
const o =
|
|
4646
|
-
let l = this.selectedCountryData.iso2 ?
|
|
4649
|
+
} = this.options, r = e === ve.AGGRESSIVE || !this.ui.hadInitialPlaceholder && e === ve.POLITE;
|
|
4650
|
+
if (C.utils && r) {
|
|
4651
|
+
const o = C.utils.numberType[n];
|
|
4652
|
+
let l = this.selectedCountryData.iso2 ? C.utils.getExampleNumber(
|
|
4647
4653
|
this.selectedCountryData.iso2,
|
|
4648
4654
|
i,
|
|
4649
4655
|
o
|
|
@@ -4652,10 +4658,10 @@ class Te {
|
|
|
4652
4658
|
}
|
|
4653
4659
|
}
|
|
4654
4660
|
//* Called when the user selects a list item from the dropdown.
|
|
4655
|
-
_selectListItem(
|
|
4656
|
-
const n =
|
|
4661
|
+
_selectListItem(e) {
|
|
4662
|
+
const n = e.dataset[Ke.COUNTRY_CODE], i = this._setCountry(n);
|
|
4657
4663
|
this._closeDropdown();
|
|
4658
|
-
const s =
|
|
4664
|
+
const s = e.dataset[Ke.DIAL_CODE];
|
|
4659
4665
|
if (this._updateDialCode(s), this.options.formatOnDisplay) {
|
|
4660
4666
|
const r = this._getTelInputValue();
|
|
4661
4667
|
this._updateValFromNumber(r);
|
|
@@ -4664,12 +4670,12 @@ class Te {
|
|
|
4664
4670
|
}
|
|
4665
4671
|
//* Close the dropdown and unbind any listeners.
|
|
4666
4672
|
_closeDropdown() {
|
|
4667
|
-
this.ui.dropdownContent.classList.contains(E.HIDE) || (this.ui.dropdownContent.classList.add(E.HIDE), this.ui.selectedCountry.setAttribute(
|
|
4673
|
+
this.ui.dropdownContent.classList.contains(E.HIDE) || (this.ui.dropdownContent.classList.add(E.HIDE), this.ui.selectedCountry.setAttribute(D.EXPANDED, "false"), this.options.countrySearch && (this.ui.searchInput.removeAttribute(D.ACTIVE_DESCENDANT), this.ui.highlightedItem && (this.ui.highlightedItem.classList.remove(E.HIGHLIGHT), this.ui.highlightedItem = null)), this.ui.dropdownArrow.classList.remove(E.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(Vt.CLOSE_COUNTRY_DROPDOWN));
|
|
4668
4674
|
}
|
|
4669
4675
|
//* Replace any existing dial code with the new one
|
|
4670
4676
|
//* Note: called from _selectListItem and setCountry
|
|
4671
|
-
_updateDialCode(
|
|
4672
|
-
const n = this._getTelInputValue(), i = `+${
|
|
4677
|
+
_updateDialCode(e) {
|
|
4678
|
+
const n = this._getTelInputValue(), i = `+${e}`;
|
|
4673
4679
|
let s;
|
|
4674
4680
|
if (n.startsWith("+")) {
|
|
4675
4681
|
const r = this._getDialCode(n);
|
|
@@ -4678,19 +4684,19 @@ class Te {
|
|
|
4678
4684
|
}
|
|
4679
4685
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
4680
4686
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
4681
|
-
_getDialCode(
|
|
4687
|
+
_getDialCode(e, n) {
|
|
4682
4688
|
let i = "";
|
|
4683
|
-
if (
|
|
4689
|
+
if (e.startsWith("+")) {
|
|
4684
4690
|
let s = "", r = !1;
|
|
4685
|
-
for (let o = 0; o <
|
|
4686
|
-
const l =
|
|
4691
|
+
for (let o = 0; o < e.length; o++) {
|
|
4692
|
+
const l = e.charAt(o);
|
|
4687
4693
|
if (/[0-9]/.test(l)) {
|
|
4688
4694
|
if (s += l, !!!this.dialCodeToIso2Map[s])
|
|
4689
4695
|
break;
|
|
4690
4696
|
if (this.dialCodes.has(s)) {
|
|
4691
|
-
if (i =
|
|
4697
|
+
if (i = e.substring(0, o + 1), r = !0, !n)
|
|
4692
4698
|
break;
|
|
4693
|
-
} else n && r && (i =
|
|
4699
|
+
} else n && r && (i = e.substring(0, o + 1));
|
|
4694
4700
|
if (s.length === this.dialCodeMaxLen)
|
|
4695
4701
|
break;
|
|
4696
4702
|
}
|
|
@@ -4699,16 +4705,16 @@ class Te {
|
|
|
4699
4705
|
return i;
|
|
4700
4706
|
}
|
|
4701
4707
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
4702
|
-
_getFullNumber(
|
|
4703
|
-
const n =
|
|
4708
|
+
_getFullNumber(e) {
|
|
4709
|
+
const n = e ? this._normaliseNumerals(e) : this._getTelInputValue(), { dialCode: i } = this.selectedCountryData;
|
|
4704
4710
|
let s;
|
|
4705
|
-
const r =
|
|
4711
|
+
const r = jt(n);
|
|
4706
4712
|
return this.options.separateDialCode && !n.startsWith("+") && i && r ? s = `+${i}` : s = "", s + n;
|
|
4707
4713
|
}
|
|
4708
4714
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
4709
|
-
_beforeSetNumber(
|
|
4710
|
-
const n = !!this._getDialCode(
|
|
4711
|
-
|
|
4715
|
+
_beforeSetNumber(e) {
|
|
4716
|
+
const n = !!this._getDialCode(e), i = ze(
|
|
4717
|
+
e,
|
|
4712
4718
|
n,
|
|
4713
4719
|
this.options.separateDialCode,
|
|
4714
4720
|
this.selectedCountryData
|
|
@@ -4717,20 +4723,20 @@ class Te {
|
|
|
4717
4723
|
}
|
|
4718
4724
|
//* Trigger the 'countrychange' event.
|
|
4719
4725
|
_triggerCountryChange() {
|
|
4720
|
-
this._trigger(
|
|
4726
|
+
this._trigger(Vt.COUNTRY_CHANGE);
|
|
4721
4727
|
}
|
|
4722
4728
|
//**************************
|
|
4723
4729
|
//* SECRET PUBLIC METHODS
|
|
4724
4730
|
//**************************
|
|
4725
4731
|
//* This is called when the geoip call returns.
|
|
4726
4732
|
handleAutoCountry() {
|
|
4727
|
-
this.options.initialCountry ===
|
|
4733
|
+
this.options.initialCountry === oe.AUTO && C.autoCountry && (this.defaultCountry = C.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(E.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
4728
4734
|
}
|
|
4729
4735
|
//* This is called when the utils request completes.
|
|
4730
4736
|
handleUtils() {
|
|
4731
|
-
if (
|
|
4732
|
-
const
|
|
4733
|
-
|
|
4737
|
+
if (C.utils) {
|
|
4738
|
+
const e = this._getTelInputValue();
|
|
4739
|
+
e && this._updateValFromNumber(e), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength());
|
|
4734
4740
|
}
|
|
4735
4741
|
this.resolveUtilsScriptPromise();
|
|
4736
4742
|
}
|
|
@@ -4739,22 +4745,22 @@ class Te {
|
|
|
4739
4745
|
//********************
|
|
4740
4746
|
//* Remove plugin.
|
|
4741
4747
|
destroy() {
|
|
4742
|
-
this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(),
|
|
4748
|
+
this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), C.instances instanceof Map ? C.instances.delete(this.id) : delete C.instances[this.id]);
|
|
4743
4749
|
}
|
|
4744
4750
|
//* Get the extension from the current number.
|
|
4745
4751
|
getExtension() {
|
|
4746
|
-
return
|
|
4752
|
+
return C.utils ? C.utils.getExtension(
|
|
4747
4753
|
this._getFullNumber(),
|
|
4748
4754
|
this.selectedCountryData.iso2
|
|
4749
4755
|
) : "";
|
|
4750
4756
|
}
|
|
4751
4757
|
//* Format the number to the given format.
|
|
4752
|
-
getNumber(
|
|
4753
|
-
if (
|
|
4754
|
-
const { iso2: n } = this.selectedCountryData, i = this._getFullNumber(), s =
|
|
4758
|
+
getNumber(e) {
|
|
4759
|
+
if (C.utils) {
|
|
4760
|
+
const { iso2: n } = this.selectedCountryData, i = this._getFullNumber(), s = C.utils.formatNumber(
|
|
4755
4761
|
i,
|
|
4756
4762
|
n,
|
|
4757
|
-
|
|
4763
|
+
e
|
|
4758
4764
|
);
|
|
4759
4765
|
return this._mapAsciiToUserNumerals(s);
|
|
4760
4766
|
}
|
|
@@ -4762,7 +4768,7 @@ class Te {
|
|
|
4762
4768
|
}
|
|
4763
4769
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
4764
4770
|
getNumberType() {
|
|
4765
|
-
return
|
|
4771
|
+
return C.utils ? C.utils.getNumberType(
|
|
4766
4772
|
this._getFullNumber(),
|
|
4767
4773
|
this.selectedCountryData.iso2
|
|
4768
4774
|
) : Ye.UNKNOWN_NUMBER_TYPE;
|
|
@@ -4773,18 +4779,18 @@ class Te {
|
|
|
4773
4779
|
}
|
|
4774
4780
|
//* Get the validation error.
|
|
4775
4781
|
getValidationError() {
|
|
4776
|
-
if (
|
|
4777
|
-
const { iso2:
|
|
4778
|
-
return
|
|
4782
|
+
if (C.utils) {
|
|
4783
|
+
const { iso2: e } = this.selectedCountryData;
|
|
4784
|
+
return C.utils.getValidationError(this._getFullNumber(), e);
|
|
4779
4785
|
}
|
|
4780
4786
|
return Ye.UNKNOWN_VALIDATION_ERROR;
|
|
4781
4787
|
}
|
|
4782
4788
|
//* Validate the input val using number length only
|
|
4783
4789
|
isValidNumber() {
|
|
4784
|
-
const { dialCode:
|
|
4785
|
-
if (
|
|
4786
|
-
const i = this._getFullNumber(), s =
|
|
4787
|
-
if (s[0] ===
|
|
4790
|
+
const { dialCode: e, iso2: n } = this.selectedCountryData;
|
|
4791
|
+
if (e === re.DIAL_CODE && C.utils) {
|
|
4792
|
+
const i = this._getFullNumber(), s = C.utils.getCoreNumber(i, n);
|
|
4793
|
+
if (s[0] === re.MOBILE_PREFIX && s.length !== re.MOBILE_CORE_LENGTH)
|
|
4788
4794
|
return !1;
|
|
4789
4795
|
}
|
|
4790
4796
|
return this._validateNumber(!1);
|
|
@@ -4793,42 +4799,42 @@ class Te {
|
|
|
4793
4799
|
isValidNumberPrecise() {
|
|
4794
4800
|
return this._validateNumber(!0);
|
|
4795
4801
|
}
|
|
4796
|
-
_utilsIsPossibleNumber(
|
|
4797
|
-
return
|
|
4798
|
-
|
|
4802
|
+
_utilsIsPossibleNumber(e) {
|
|
4803
|
+
return C.utils ? C.utils.isPossibleNumber(
|
|
4804
|
+
e,
|
|
4799
4805
|
this.selectedCountryData.iso2,
|
|
4800
4806
|
this.options.allowedNumberTypes
|
|
4801
4807
|
) : null;
|
|
4802
4808
|
}
|
|
4803
4809
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
4804
|
-
_validateNumber(
|
|
4805
|
-
if (!
|
|
4810
|
+
_validateNumber(e) {
|
|
4811
|
+
if (!C.utils)
|
|
4806
4812
|
return null;
|
|
4807
4813
|
if (!this.selectedCountryData.iso2)
|
|
4808
4814
|
return !1;
|
|
4809
|
-
const { allowNumberExtensions: n, allowPhonewords: i } = this.options, s = (
|
|
4815
|
+
const { allowNumberExtensions: n, allowPhonewords: i } = this.options, s = (u) => e ? this._utilsIsValidNumber(u) : this._utilsIsPossibleNumber(u), r = this._getFullNumber();
|
|
4810
4816
|
if (!s(r))
|
|
4811
4817
|
return !1;
|
|
4812
|
-
if (r.search(
|
|
4813
|
-
const
|
|
4814
|
-
return
|
|
4818
|
+
if (r.search(ut.ALPHA_UNICODE) > -1) {
|
|
4819
|
+
const u = this.selectedCountryData.iso2;
|
|
4820
|
+
return C.utils.getExtension(r, u) ? n : i;
|
|
4815
4821
|
}
|
|
4816
4822
|
return !0;
|
|
4817
4823
|
}
|
|
4818
|
-
_utilsIsValidNumber(
|
|
4819
|
-
return
|
|
4820
|
-
|
|
4824
|
+
_utilsIsValidNumber(e) {
|
|
4825
|
+
return C.utils ? C.utils.isValidNumber(
|
|
4826
|
+
e,
|
|
4821
4827
|
this.selectedCountryData.iso2,
|
|
4822
4828
|
this.options.allowedNumberTypes
|
|
4823
4829
|
) : null;
|
|
4824
4830
|
}
|
|
4825
4831
|
//* Update the selected country, and update the input val accordingly.
|
|
4826
|
-
setCountry(
|
|
4827
|
-
const n =
|
|
4828
|
-
if (!
|
|
4832
|
+
setCountry(e) {
|
|
4833
|
+
const n = e == null ? void 0 : e.toLowerCase();
|
|
4834
|
+
if (!ae(n))
|
|
4829
4835
|
throw new Error(`Invalid country code: '${n}'`);
|
|
4830
4836
|
const i = this.selectedCountryData.iso2;
|
|
4831
|
-
if (
|
|
4837
|
+
if (e && n !== i || !e && i) {
|
|
4832
4838
|
if (this._setCountry(n), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay) {
|
|
4833
4839
|
const r = this._getTelInputValue();
|
|
4834
4840
|
this._updateValFromNumber(r);
|
|
@@ -4837,106 +4843,106 @@ class Te {
|
|
|
4837
4843
|
}
|
|
4838
4844
|
}
|
|
4839
4845
|
//* Set the input value and update the country.
|
|
4840
|
-
setNumber(
|
|
4841
|
-
const n = this._normaliseNumerals(
|
|
4842
|
-
this._updateValFromNumber(n), i && this._triggerCountryChange(), this._trigger(
|
|
4846
|
+
setNumber(e) {
|
|
4847
|
+
const n = this._normaliseNumerals(e), i = this._updateCountryFromNumber(n);
|
|
4848
|
+
this._updateValFromNumber(n), i && this._triggerCountryChange(), this._trigger(Vt.INPUT, { isSetNumber: !0 });
|
|
4843
4849
|
}
|
|
4844
4850
|
//* Set the placeholder number typ
|
|
4845
|
-
setPlaceholderNumberType(
|
|
4846
|
-
this.options.placeholderNumberType =
|
|
4851
|
+
setPlaceholderNumberType(e) {
|
|
4852
|
+
this.options.placeholderNumberType = e, this._updatePlaceholder();
|
|
4847
4853
|
}
|
|
4848
|
-
setDisabled(
|
|
4849
|
-
this.ui.telInput.disabled =
|
|
4854
|
+
setDisabled(e) {
|
|
4855
|
+
this.ui.telInput.disabled = e, e ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
|
|
4850
4856
|
}
|
|
4851
4857
|
}
|
|
4852
|
-
const
|
|
4853
|
-
if (!
|
|
4854
|
-
let
|
|
4855
|
-
if (typeof
|
|
4858
|
+
const Ys = (t) => {
|
|
4859
|
+
if (!C.utils && !C.startedLoadingUtilsScript) {
|
|
4860
|
+
let e;
|
|
4861
|
+
if (typeof t == "function")
|
|
4856
4862
|
try {
|
|
4857
|
-
|
|
4863
|
+
e = Promise.resolve(t());
|
|
4858
4864
|
} catch (n) {
|
|
4859
4865
|
return Promise.reject(n);
|
|
4860
4866
|
}
|
|
4861
4867
|
else
|
|
4862
4868
|
return Promise.reject(
|
|
4863
4869
|
new TypeError(
|
|
4864
|
-
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof
|
|
4870
|
+
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof t}`
|
|
4865
4871
|
)
|
|
4866
4872
|
);
|
|
4867
|
-
return
|
|
4873
|
+
return C.startedLoadingUtilsScript = !0, e.then((n) => {
|
|
4868
4874
|
const i = n == null ? void 0 : n.default;
|
|
4869
4875
|
if (!i || typeof i != "object")
|
|
4870
4876
|
throw new TypeError(
|
|
4871
4877
|
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
4872
4878
|
);
|
|
4873
|
-
return
|
|
4879
|
+
return C.utils = i, kt("handleUtils"), !0;
|
|
4874
4880
|
}).catch((n) => {
|
|
4875
4881
|
throw kt("rejectUtilsScriptPromise", n), n;
|
|
4876
4882
|
});
|
|
4877
4883
|
}
|
|
4878
4884
|
return null;
|
|
4879
|
-
}, kt = (
|
|
4880
|
-
Object.values(
|
|
4881
|
-
const i = n[
|
|
4882
|
-
typeof i == "function" && i.apply(n,
|
|
4885
|
+
}, kt = (t, ...e) => {
|
|
4886
|
+
Object.values(C.instances).forEach((n) => {
|
|
4887
|
+
const i = n[t];
|
|
4888
|
+
typeof i == "function" && i.apply(n, e);
|
|
4883
4889
|
});
|
|
4884
|
-
},
|
|
4885
|
-
(
|
|
4886
|
-
const n = new Te(
|
|
4887
|
-
return
|
|
4890
|
+
}, C = Object.assign(
|
|
4891
|
+
(t, e) => {
|
|
4892
|
+
const n = new Te(t, e);
|
|
4893
|
+
return C.instances[n.id] = n, t.iti = n, n;
|
|
4888
4894
|
},
|
|
4889
4895
|
{
|
|
4890
|
-
defaults:
|
|
4896
|
+
defaults: Mn,
|
|
4891
4897
|
//* Using a static var like this allows us to mock it in the tests.
|
|
4892
4898
|
documentReady: () => document.readyState === "complete",
|
|
4893
4899
|
//* Get the country data object.
|
|
4894
|
-
getCountryData: () =>
|
|
4900
|
+
getCountryData: () => Nt,
|
|
4895
4901
|
//* A getter for the plugin instance.
|
|
4896
|
-
getInstance: (
|
|
4897
|
-
const
|
|
4898
|
-
return
|
|
4902
|
+
getInstance: (t) => {
|
|
4903
|
+
const e = t.dataset.intlTelInputId;
|
|
4904
|
+
return e ? C.instances[e] : null;
|
|
4899
4905
|
},
|
|
4900
4906
|
//* A map from instance ID to instance object.
|
|
4901
4907
|
instances: {},
|
|
4902
|
-
attachUtils:
|
|
4908
|
+
attachUtils: Ys,
|
|
4903
4909
|
startedLoadingUtilsScript: !1,
|
|
4904
4910
|
startedLoadingAutoCountry: !1,
|
|
4905
|
-
version: "26.0.
|
|
4911
|
+
version: "26.0.2"
|
|
4906
4912
|
}
|
|
4907
4913
|
);
|
|
4908
|
-
var
|
|
4909
|
-
function
|
|
4910
|
-
|
|
4911
|
-
let n =
|
|
4914
|
+
var Ks = /* @__PURE__ */ is("<input/>");
|
|
4915
|
+
function Xs(t, e) {
|
|
4916
|
+
gi(e, !0);
|
|
4917
|
+
let n = Bt(e, "disabled", 3, !1), i = Bt(e, "inputProps", 19, () => ({})), s = Bt(e, "options", 19, () => ({})), r = Bt(e, "value", 3, ""), o = /* @__PURE__ */ G(void 0), l = /* @__PURE__ */ G(void 0), u = /* @__PURE__ */ G(null), a = /* @__PURE__ */ G(!1);
|
|
4912
4918
|
const c = () => I(l) ? s().strictMode ? I(l).isValidNumberPrecise() : I(l).isValidNumber() : null, d = () => {
|
|
4913
|
-
var
|
|
4919
|
+
var h, m;
|
|
4914
4920
|
const v = c();
|
|
4915
|
-
I(
|
|
4921
|
+
I(u) !== v && (V(u, v, !0), (h = e.onChangeValidity) == null || h.call(e, !!v), (m = e.onChangeErrorCode) == null || m.call(e, v ? null : I(l).getValidationError()));
|
|
4916
4922
|
}, f = () => {
|
|
4917
|
-
var v,
|
|
4918
|
-
(
|
|
4919
|
-
},
|
|
4920
|
-
var v,
|
|
4921
|
-
(
|
|
4923
|
+
var v, h;
|
|
4924
|
+
(h = e.onChangeNumber) == null || h.call(e, ((v = I(l)) == null ? void 0 : v.getNumber()) ?? ""), d();
|
|
4925
|
+
}, p = () => {
|
|
4926
|
+
var v, h;
|
|
4927
|
+
(h = e.onChangeCountry) == null || h.call(e, ((v = I(l)) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), f();
|
|
4922
4928
|
};
|
|
4923
|
-
|
|
4924
|
-
I(o) && (
|
|
4925
|
-
}),
|
|
4929
|
+
Vn(() => {
|
|
4930
|
+
I(o) && (V(l, C(I(o), s()), !0), I(o).addEventListener("countrychange", p), r() && I(l).setNumber(r()), n() && I(l).setDisabled(n()), V(u, c(), !0), V(a, !0));
|
|
4931
|
+
}), Wn(() => {
|
|
4926
4932
|
var v;
|
|
4927
|
-
I(o) && I(o).removeEventListener("countrychange",
|
|
4928
|
-
}),
|
|
4929
|
-
I(
|
|
4933
|
+
I(o) && I(o).removeEventListener("countrychange", p), (v = I(l)) == null || v.destroy();
|
|
4934
|
+
}), Wi(() => {
|
|
4935
|
+
I(a) && I(l) && I(l).setDisabled(n());
|
|
4930
4936
|
});
|
|
4931
|
-
function
|
|
4937
|
+
function _() {
|
|
4932
4938
|
return I(l);
|
|
4933
4939
|
}
|
|
4934
|
-
function
|
|
4940
|
+
function g() {
|
|
4935
4941
|
return I(o);
|
|
4936
4942
|
}
|
|
4937
|
-
var
|
|
4938
|
-
return
|
|
4943
|
+
var b = { getInstance: _, getInput: g }, y = Ks();
|
|
4944
|
+
return ms(y, () => ({ type: "tel", oninput: f, ...i() }), void 0, void 0, void 0, void 0, !0), bs(y, (v) => V(o, v), () => I(o)), ss(t, y), mi(b);
|
|
4939
4945
|
}
|
|
4940
4946
|
export {
|
|
4941
|
-
|
|
4947
|
+
Xs as default
|
|
4942
4948
|
};
|