@salla.sa/ui-address-autocomplete-widget 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +511 -434
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
constructor(e,
|
|
4
|
-
if (this._$cssResult$ = !0,
|
|
5
|
-
this.cssText = e, this.t =
|
|
1
|
+
const O = globalThis, H = O.ShadowRoot && (O.ShadyCSS === void 0 || O.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, j = /* @__PURE__ */ Symbol(), Z = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
let de = class {
|
|
3
|
+
constructor(e, i, r) {
|
|
4
|
+
if (this._$cssResult$ = !0, r !== j) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
5
|
+
this.cssText = e, this.t = i;
|
|
6
6
|
}
|
|
7
7
|
get styleSheet() {
|
|
8
8
|
let e = this.o;
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
const
|
|
12
|
-
|
|
9
|
+
const i = this.t;
|
|
10
|
+
if (H && e === void 0) {
|
|
11
|
+
const r = i !== void 0 && i.length === 1;
|
|
12
|
+
r && (e = Z.get(i)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), r && Z.set(i, e));
|
|
13
13
|
}
|
|
14
14
|
return e;
|
|
15
15
|
}
|
|
@@ -17,115 +17,115 @@ let le = class {
|
|
|
17
17
|
return this.cssText;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const ge = (t) => new de(typeof t == "string" ? t : t + "", void 0, j), ve = (t, ...e) => {
|
|
21
|
+
const i = t.length === 1 ? t[0] : e.reduce((r, s, o) => r + ((a) => {
|
|
22
22
|
if (a._$cssResult$ === !0) return a.cssText;
|
|
23
23
|
if (typeof a == "number") return a;
|
|
24
24
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + a + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
25
|
-
})(
|
|
26
|
-
return new
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
29
|
-
else for (const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
let
|
|
35
|
-
for (const
|
|
36
|
-
return
|
|
37
|
-
})(
|
|
38
|
-
const { is:
|
|
25
|
+
})(s) + t[o + 1], t[0]);
|
|
26
|
+
return new de(i, t, j);
|
|
27
|
+
}, be = (t, e) => {
|
|
28
|
+
if (H) t.adoptedStyleSheets = e.map((i) => i instanceof CSSStyleSheet ? i : i.styleSheet);
|
|
29
|
+
else for (const i of e) {
|
|
30
|
+
const r = document.createElement("style"), s = O.litNonce;
|
|
31
|
+
s !== void 0 && r.setAttribute("nonce", s), r.textContent = i.cssText, t.appendChild(r);
|
|
32
|
+
}
|
|
33
|
+
}, J = H ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((e) => {
|
|
34
|
+
let i = "";
|
|
35
|
+
for (const r of e.cssRules) i += r.cssText;
|
|
36
|
+
return ge(i);
|
|
37
|
+
})(t) : t;
|
|
38
|
+
const { is: ye, defineProperty: $e, getOwnPropertyDescriptor: Ae, getOwnPropertyNames: we, getOwnPropertySymbols: _e, getPrototypeOf: xe } = Object, M = globalThis, X = M.trustedTypes, Se = X ? X.emptyScript : "", Ee = M.reactiveElementPolyfillSupport, T = (t, e) => t, V = { toAttribute(t, e) {
|
|
39
39
|
switch (e) {
|
|
40
40
|
case Boolean:
|
|
41
|
-
|
|
41
|
+
t = t ? Se : null;
|
|
42
42
|
break;
|
|
43
43
|
case Object:
|
|
44
44
|
case Array:
|
|
45
|
-
|
|
45
|
+
t = t == null ? t : JSON.stringify(t);
|
|
46
46
|
}
|
|
47
|
-
return
|
|
48
|
-
}, fromAttribute(
|
|
49
|
-
let
|
|
47
|
+
return t;
|
|
48
|
+
}, fromAttribute(t, e) {
|
|
49
|
+
let i = t;
|
|
50
50
|
switch (e) {
|
|
51
51
|
case Boolean:
|
|
52
|
-
|
|
52
|
+
i = t !== null;
|
|
53
53
|
break;
|
|
54
54
|
case Number:
|
|
55
|
-
|
|
55
|
+
i = t === null ? null : Number(t);
|
|
56
56
|
break;
|
|
57
57
|
case Object:
|
|
58
58
|
case Array:
|
|
59
59
|
try {
|
|
60
|
-
|
|
60
|
+
i = JSON.parse(t);
|
|
61
61
|
} catch {
|
|
62
|
-
|
|
62
|
+
i = null;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
return
|
|
66
|
-
} },
|
|
67
|
-
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"),
|
|
68
|
-
let
|
|
65
|
+
return i;
|
|
66
|
+
} }, W = (t, e) => !ye(t, e), Q = { attribute: !0, type: String, converter: V, reflect: !1, useDefault: !1, hasChanged: W };
|
|
67
|
+
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), M.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
68
|
+
let E = class extends HTMLElement {
|
|
69
69
|
static addInitializer(e) {
|
|
70
70
|
this._$Ei(), (this.l ??= []).push(e);
|
|
71
71
|
}
|
|
72
72
|
static get observedAttributes() {
|
|
73
73
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
74
74
|
}
|
|
75
|
-
static createProperty(e,
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
|
|
75
|
+
static createProperty(e, i = Q) {
|
|
76
|
+
if (i.state && (i.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((i = Object.create(i)).wrapped = !0), this.elementProperties.set(e, i), !i.noAccessor) {
|
|
77
|
+
const r = /* @__PURE__ */ Symbol(), s = this.getPropertyDescriptor(e, r, i);
|
|
78
|
+
s !== void 0 && $e(this.prototype, e, s);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
static getPropertyDescriptor(e,
|
|
82
|
-
const { get:
|
|
83
|
-
return this[
|
|
81
|
+
static getPropertyDescriptor(e, i, r) {
|
|
82
|
+
const { get: s, set: o } = Ae(this.prototype, e) ?? { get() {
|
|
83
|
+
return this[i];
|
|
84
84
|
}, set(a) {
|
|
85
|
-
this[
|
|
85
|
+
this[i] = a;
|
|
86
86
|
} };
|
|
87
|
-
return { get:
|
|
88
|
-
const n =
|
|
89
|
-
o?.call(this, a), this.requestUpdate(e, n,
|
|
87
|
+
return { get: s, set(a) {
|
|
88
|
+
const n = s?.call(this);
|
|
89
|
+
o?.call(this, a), this.requestUpdate(e, n, r);
|
|
90
90
|
}, configurable: !0, enumerable: !0 };
|
|
91
91
|
}
|
|
92
92
|
static getPropertyOptions(e) {
|
|
93
|
-
return this.elementProperties.get(e) ??
|
|
93
|
+
return this.elementProperties.get(e) ?? Q;
|
|
94
94
|
}
|
|
95
95
|
static _$Ei() {
|
|
96
|
-
if (this.hasOwnProperty(
|
|
97
|
-
const e =
|
|
96
|
+
if (this.hasOwnProperty(T("elementProperties"))) return;
|
|
97
|
+
const e = xe(this);
|
|
98
98
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
99
99
|
}
|
|
100
100
|
static finalize() {
|
|
101
|
-
if (this.hasOwnProperty(
|
|
102
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
103
|
-
const
|
|
104
|
-
for (const
|
|
101
|
+
if (this.hasOwnProperty(T("finalized"))) return;
|
|
102
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(T("properties"))) {
|
|
103
|
+
const i = this.properties, r = [...we(i), ..._e(i)];
|
|
104
|
+
for (const s of r) this.createProperty(s, i[s]);
|
|
105
105
|
}
|
|
106
106
|
const e = this[Symbol.metadata];
|
|
107
107
|
if (e !== null) {
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
108
|
+
const i = litPropertyMetadata.get(e);
|
|
109
|
+
if (i !== void 0) for (const [r, s] of i) this.elementProperties.set(r, s);
|
|
110
110
|
}
|
|
111
111
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
112
|
-
for (const [
|
|
113
|
-
const
|
|
114
|
-
|
|
112
|
+
for (const [i, r] of this.elementProperties) {
|
|
113
|
+
const s = this._$Eu(i, r);
|
|
114
|
+
s !== void 0 && this._$Eh.set(s, i);
|
|
115
115
|
}
|
|
116
116
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
117
117
|
}
|
|
118
118
|
static finalizeStyles(e) {
|
|
119
|
-
const
|
|
119
|
+
const i = [];
|
|
120
120
|
if (Array.isArray(e)) {
|
|
121
|
-
const
|
|
122
|
-
for (const
|
|
123
|
-
} else e !== void 0 &&
|
|
124
|
-
return
|
|
121
|
+
const r = new Set(e.flat(1 / 0).reverse());
|
|
122
|
+
for (const s of r) i.unshift(J(s));
|
|
123
|
+
} else e !== void 0 && i.push(J(e));
|
|
124
|
+
return i;
|
|
125
125
|
}
|
|
126
|
-
static _$Eu(e,
|
|
127
|
-
const
|
|
128
|
-
return
|
|
126
|
+
static _$Eu(e, i) {
|
|
127
|
+
const r = i.attribute;
|
|
128
|
+
return r === !1 ? void 0 : typeof r == "string" ? r : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
129
129
|
}
|
|
130
130
|
constructor() {
|
|
131
131
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
@@ -140,13 +140,13 @@ let S = class extends HTMLElement {
|
|
|
140
140
|
this._$EO?.delete(e);
|
|
141
141
|
}
|
|
142
142
|
_$E_() {
|
|
143
|
-
const e = /* @__PURE__ */ new Map(),
|
|
144
|
-
for (const
|
|
143
|
+
const e = /* @__PURE__ */ new Map(), i = this.constructor.elementProperties;
|
|
144
|
+
for (const r of i.keys()) this.hasOwnProperty(r) && (e.set(r, this[r]), delete this[r]);
|
|
145
145
|
e.size > 0 && (this._$Ep = e);
|
|
146
146
|
}
|
|
147
147
|
createRenderRoot() {
|
|
148
148
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
149
|
-
return
|
|
149
|
+
return be(e, this.constructor.elementStyles), e;
|
|
150
150
|
}
|
|
151
151
|
connectedCallback() {
|
|
152
152
|
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
@@ -156,42 +156,42 @@ let S = class extends HTMLElement {
|
|
|
156
156
|
disconnectedCallback() {
|
|
157
157
|
this._$EO?.forEach((e) => e.hostDisconnected?.());
|
|
158
158
|
}
|
|
159
|
-
attributeChangedCallback(e,
|
|
160
|
-
this._$AK(e,
|
|
159
|
+
attributeChangedCallback(e, i, r) {
|
|
160
|
+
this._$AK(e, r);
|
|
161
161
|
}
|
|
162
|
-
_$ET(e,
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
const o = (
|
|
166
|
-
this._$Em = e, o == null ? this.removeAttribute(
|
|
162
|
+
_$ET(e, i) {
|
|
163
|
+
const r = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, r);
|
|
164
|
+
if (s !== void 0 && r.reflect === !0) {
|
|
165
|
+
const o = (r.converter?.toAttribute !== void 0 ? r.converter : V).toAttribute(i, r.type);
|
|
166
|
+
this._$Em = e, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
_$AK(e,
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
172
|
-
const o =
|
|
173
|
-
this._$Em =
|
|
174
|
-
const n = a.fromAttribute(
|
|
175
|
-
this[
|
|
169
|
+
_$AK(e, i) {
|
|
170
|
+
const r = this.constructor, s = r._$Eh.get(e);
|
|
171
|
+
if (s !== void 0 && this._$Em !== s) {
|
|
172
|
+
const o = r.getPropertyOptions(s), a = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : V;
|
|
173
|
+
this._$Em = s;
|
|
174
|
+
const n = a.fromAttribute(i, o.type);
|
|
175
|
+
this[s] = n ?? this._$Ej?.get(s) ?? n, this._$Em = null;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
requestUpdate(e,
|
|
178
|
+
requestUpdate(e, i, r, s = !1, o) {
|
|
179
179
|
if (e !== void 0) {
|
|
180
180
|
const a = this.constructor;
|
|
181
|
-
if (
|
|
182
|
-
this.C(e,
|
|
181
|
+
if (s === !1 && (o = this[e]), r ??= a.getPropertyOptions(e), !((r.hasChanged ?? W)(o, i) || r.useDefault && r.reflect && o === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, r)))) return;
|
|
182
|
+
this.C(e, i, r);
|
|
183
183
|
}
|
|
184
184
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
185
185
|
}
|
|
186
|
-
C(e,
|
|
187
|
-
|
|
186
|
+
C(e, i, { useDefault: r, reflect: s, wrapped: o }, a) {
|
|
187
|
+
r && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? i ?? this[e]), o !== !0 || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || r || (i = void 0), this._$AL.set(e, i)), s === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
188
188
|
}
|
|
189
189
|
async _$EP() {
|
|
190
190
|
this.isUpdatePending = !0;
|
|
191
191
|
try {
|
|
192
192
|
await this._$ES;
|
|
193
|
-
} catch (
|
|
194
|
-
Promise.reject(
|
|
193
|
+
} catch (i) {
|
|
194
|
+
Promise.reject(i);
|
|
195
195
|
}
|
|
196
196
|
const e = this.scheduleUpdate();
|
|
197
197
|
return e != null && await e, !this.isUpdatePending;
|
|
@@ -203,28 +203,28 @@ let S = class extends HTMLElement {
|
|
|
203
203
|
if (!this.isUpdatePending) return;
|
|
204
204
|
if (!this.hasUpdated) {
|
|
205
205
|
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
206
|
-
for (const [
|
|
206
|
+
for (const [s, o] of this._$Ep) this[s] = o;
|
|
207
207
|
this._$Ep = void 0;
|
|
208
208
|
}
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
const { wrapped: a } = o, n = this[
|
|
212
|
-
a !== !0 || this._$AL.has(
|
|
209
|
+
const r = this.constructor.elementProperties;
|
|
210
|
+
if (r.size > 0) for (const [s, o] of r) {
|
|
211
|
+
const { wrapped: a } = o, n = this[s];
|
|
212
|
+
a !== !0 || this._$AL.has(s) || n === void 0 || this.C(s, void 0, o, n);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
let e = !1;
|
|
216
|
-
const
|
|
216
|
+
const i = this._$AL;
|
|
217
217
|
try {
|
|
218
|
-
e = this.shouldUpdate(
|
|
219
|
-
} catch (
|
|
220
|
-
throw e = !1, this._$EM(),
|
|
218
|
+
e = this.shouldUpdate(i), e ? (this.willUpdate(i), this._$EO?.forEach((r) => r.hostUpdate?.()), this.update(i)) : this._$EM();
|
|
219
|
+
} catch (r) {
|
|
220
|
+
throw e = !1, this._$EM(), r;
|
|
221
221
|
}
|
|
222
|
-
e && this._$AE(
|
|
222
|
+
e && this._$AE(i);
|
|
223
223
|
}
|
|
224
224
|
willUpdate(e) {
|
|
225
225
|
}
|
|
226
226
|
_$AE(e) {
|
|
227
|
-
this._$EO?.forEach((
|
|
227
|
+
this._$EO?.forEach((i) => i.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
228
228
|
}
|
|
229
229
|
_$EM() {
|
|
230
230
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
@@ -239,79 +239,79 @@ let S = class extends HTMLElement {
|
|
|
239
239
|
return !0;
|
|
240
240
|
}
|
|
241
241
|
update(e) {
|
|
242
|
-
this._$Eq &&= this._$Eq.forEach((
|
|
242
|
+
this._$Eq &&= this._$Eq.forEach((i) => this._$ET(i, this[i])), this._$EM();
|
|
243
243
|
}
|
|
244
244
|
updated(e) {
|
|
245
245
|
}
|
|
246
246
|
firstUpdated(e) {
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
\f\r]`,
|
|
252
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g,
|
|
253
|
-
function
|
|
254
|
-
if (!
|
|
255
|
-
return
|
|
249
|
+
E.elementStyles = [], E.shadowRootOptions = { mode: "open" }, E[T("elementProperties")] = /* @__PURE__ */ new Map(), E[T("finalized")] = /* @__PURE__ */ new Map(), Ee?.({ ReactiveElement: E }), (M.reactiveElementVersions ??= []).push("2.1.2");
|
|
250
|
+
const K = globalThis, ee = (t) => t, D = K.trustedTypes, te = D ? D.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, he = "$lit$", A = `lit$${Math.random().toFixed(9).slice(2)}$`, ce = "?" + A, ke = `<${ce}>`, S = document, R = () => S.createComment(""), I = (t) => t === null || typeof t != "object" && typeof t != "function", Y = Array.isArray, Pe = (t) => Y(t) || typeof t?.[Symbol.iterator] == "function", L = `[
|
|
251
|
+
\f\r]`, P = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, re = />/g, w = RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^
|
|
252
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), se = /'/g, oe = /"/g, pe = /^(?:script|style|textarea|title)$/i, Te = (t) => (e, ...i) => ({ _$litType$: t, strings: e, values: i }), g = Te(1), v = /* @__PURE__ */ Symbol.for("lit-noChange"), f = /* @__PURE__ */ Symbol.for("lit-nothing"), ae = /* @__PURE__ */ new WeakMap(), x = S.createTreeWalker(S, 129);
|
|
253
|
+
function ue(t, e) {
|
|
254
|
+
if (!Y(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
255
|
+
return te !== void 0 ? te.createHTML(e) : e;
|
|
256
256
|
}
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
let
|
|
260
|
-
for (let n = 0; n <
|
|
261
|
-
const l =
|
|
262
|
-
let m, c, u = -1,
|
|
263
|
-
for (;
|
|
264
|
-
const
|
|
265
|
-
o += a ===
|
|
266
|
-
}
|
|
267
|
-
return [
|
|
257
|
+
const Ce = (t, e) => {
|
|
258
|
+
const i = t.length - 1, r = [];
|
|
259
|
+
let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", a = P;
|
|
260
|
+
for (let n = 0; n < i; n++) {
|
|
261
|
+
const l = t[n];
|
|
262
|
+
let m, c, u = -1, y = 0;
|
|
263
|
+
for (; y < l.length && (a.lastIndex = y, c = a.exec(l), c !== null); ) y = a.lastIndex, a === P ? c[1] === "!--" ? a = ie : c[1] !== void 0 ? a = re : c[2] !== void 0 ? (pe.test(c[2]) && (s = RegExp("</" + c[2], "g")), a = w) : c[3] !== void 0 && (a = w) : a === w ? c[0] === ">" ? (a = s ?? P, u = -1) : c[1] === void 0 ? u = -2 : (u = a.lastIndex - c[2].length, m = c[1], a = c[3] === void 0 ? w : c[3] === '"' ? oe : se) : a === oe || a === se ? a = w : a === ie || a === re ? a = P : (a = w, s = void 0);
|
|
264
|
+
const $ = a === w && t[n + 1].startsWith("/>") ? " " : "";
|
|
265
|
+
o += a === P ? l + ke : u >= 0 ? (r.push(m), l.slice(0, u) + he + l.slice(u) + A + $) : l + A + (u === -2 ? n : $);
|
|
266
|
+
}
|
|
267
|
+
return [ue(t, o + (t[i] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), r];
|
|
268
268
|
};
|
|
269
|
-
class
|
|
270
|
-
constructor({ strings: e, _$litType$:
|
|
271
|
-
let
|
|
269
|
+
class N {
|
|
270
|
+
constructor({ strings: e, _$litType$: i }, r) {
|
|
271
|
+
let s;
|
|
272
272
|
this.parts = [];
|
|
273
273
|
let o = 0, a = 0;
|
|
274
|
-
const n = e.length - 1, l = this.parts, [m, c] =
|
|
275
|
-
if (this.el =
|
|
274
|
+
const n = e.length - 1, l = this.parts, [m, c] = Ce(e, i);
|
|
275
|
+
if (this.el = N.createElement(m, r), x.currentNode = this.el.content, i === 2 || i === 3) {
|
|
276
276
|
const u = this.el.content.firstChild;
|
|
277
277
|
u.replaceWith(...u.childNodes);
|
|
278
278
|
}
|
|
279
|
-
for (; (
|
|
280
|
-
if (
|
|
281
|
-
if (
|
|
282
|
-
const
|
|
283
|
-
l.push({ type: 1, index: o, name:
|
|
284
|
-
} else u.startsWith(
|
|
285
|
-
if (
|
|
286
|
-
const u =
|
|
287
|
-
if (
|
|
288
|
-
|
|
289
|
-
for (let
|
|
290
|
-
|
|
279
|
+
for (; (s = x.nextNode()) !== null && l.length < n; ) {
|
|
280
|
+
if (s.nodeType === 1) {
|
|
281
|
+
if (s.hasAttributes()) for (const u of s.getAttributeNames()) if (u.endsWith(he)) {
|
|
282
|
+
const y = c[a++], $ = s.getAttribute(u).split(A), F = /([.?@])?(.*)/.exec(y);
|
|
283
|
+
l.push({ type: 1, index: o, name: F[2], strings: $, ctor: F[1] === "." ? Ie : F[1] === "?" ? Ne : F[1] === "@" ? ze : B }), s.removeAttribute(u);
|
|
284
|
+
} else u.startsWith(A) && (l.push({ type: 6, index: o }), s.removeAttribute(u));
|
|
285
|
+
if (pe.test(s.tagName)) {
|
|
286
|
+
const u = s.textContent.split(A), y = u.length - 1;
|
|
287
|
+
if (y > 0) {
|
|
288
|
+
s.textContent = D ? D.emptyScript : "";
|
|
289
|
+
for (let $ = 0; $ < y; $++) s.append(u[$], R()), x.nextNode(), l.push({ type: 2, index: ++o });
|
|
290
|
+
s.append(u[y], R());
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
} else if (
|
|
293
|
+
} else if (s.nodeType === 8) if (s.data === ce) l.push({ type: 2, index: o });
|
|
294
294
|
else {
|
|
295
295
|
let u = -1;
|
|
296
|
-
for (; (u =
|
|
296
|
+
for (; (u = s.data.indexOf(A, u + 1)) !== -1; ) l.push({ type: 7, index: o }), u += A.length - 1;
|
|
297
297
|
}
|
|
298
298
|
o++;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
static createElement(e,
|
|
302
|
-
const
|
|
303
|
-
return
|
|
301
|
+
static createElement(e, i) {
|
|
302
|
+
const r = S.createElement("template");
|
|
303
|
+
return r.innerHTML = e, r;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
if (e ===
|
|
308
|
-
let
|
|
309
|
-
const o =
|
|
310
|
-
return
|
|
306
|
+
function k(t, e, i = t, r) {
|
|
307
|
+
if (e === v) return e;
|
|
308
|
+
let s = r !== void 0 ? i._$Co?.[r] : i._$Cl;
|
|
309
|
+
const o = I(e) ? void 0 : e._$litDirective$;
|
|
310
|
+
return s?.constructor !== o && (s?._$AO?.(!1), o === void 0 ? s = void 0 : (s = new o(t), s._$AT(t, i, r)), r !== void 0 ? (i._$Co ??= [])[r] = s : i._$Cl = s), s !== void 0 && (e = k(t, s._$AS(t, e.values), s, r)), e;
|
|
311
311
|
}
|
|
312
|
-
class
|
|
313
|
-
constructor(e,
|
|
314
|
-
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM =
|
|
312
|
+
class Re {
|
|
313
|
+
constructor(e, i) {
|
|
314
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = i;
|
|
315
315
|
}
|
|
316
316
|
get parentNode() {
|
|
317
317
|
return this._$AM.parentNode;
|
|
@@ -320,34 +320,34 @@ class Pe {
|
|
|
320
320
|
return this._$AM._$AU;
|
|
321
321
|
}
|
|
322
322
|
u(e) {
|
|
323
|
-
const { el: { content:
|
|
324
|
-
|
|
325
|
-
let o =
|
|
323
|
+
const { el: { content: i }, parts: r } = this._$AD, s = (e?.creationScope ?? S).importNode(i, !0);
|
|
324
|
+
x.currentNode = s;
|
|
325
|
+
let o = x.nextNode(), a = 0, n = 0, l = r[0];
|
|
326
326
|
for (; l !== void 0; ) {
|
|
327
327
|
if (a === l.index) {
|
|
328
328
|
let m;
|
|
329
|
-
l.type === 2 ? m = new
|
|
329
|
+
l.type === 2 ? m = new z(o, o.nextSibling, this, e) : l.type === 1 ? m = new l.ctor(o, l.name, l.strings, this, e) : l.type === 6 && (m = new Fe(o, this, e)), this._$AV.push(m), l = r[++n];
|
|
330
330
|
}
|
|
331
|
-
a !== l?.index && (o =
|
|
331
|
+
a !== l?.index && (o = x.nextNode(), a++);
|
|
332
332
|
}
|
|
333
|
-
return
|
|
333
|
+
return x.currentNode = S, s;
|
|
334
334
|
}
|
|
335
335
|
p(e) {
|
|
336
|
-
let
|
|
337
|
-
for (const
|
|
336
|
+
let i = 0;
|
|
337
|
+
for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(e, r, i), i += r.strings.length - 2) : r._$AI(e[i])), i++;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
class
|
|
340
|
+
class z {
|
|
341
341
|
get _$AU() {
|
|
342
342
|
return this._$AM?._$AU ?? this._$Cv;
|
|
343
343
|
}
|
|
344
|
-
constructor(e,
|
|
345
|
-
this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = e, this._$AB =
|
|
344
|
+
constructor(e, i, r, s) {
|
|
345
|
+
this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = e, this._$AB = i, this._$AM = r, this.options = s, this._$Cv = s?.isConnected ?? !0;
|
|
346
346
|
}
|
|
347
347
|
get parentNode() {
|
|
348
348
|
let e = this._$AA.parentNode;
|
|
349
|
-
const
|
|
350
|
-
return
|
|
349
|
+
const i = this._$AM;
|
|
350
|
+
return i !== void 0 && e?.nodeType === 11 && (e = i.parentNode), e;
|
|
351
351
|
}
|
|
352
352
|
get startNode() {
|
|
353
353
|
return this._$AA;
|
|
@@ -355,8 +355,8 @@ class N {
|
|
|
355
355
|
get endNode() {
|
|
356
356
|
return this._$AB;
|
|
357
357
|
}
|
|
358
|
-
_$AI(e,
|
|
359
|
-
e =
|
|
358
|
+
_$AI(e, i = this) {
|
|
359
|
+
e = k(this, e, i), I(e) ? e === f || e == null || e === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : e !== this._$AH && e !== v && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Pe(e) ? this.k(e) : this._(e);
|
|
360
360
|
}
|
|
361
361
|
O(e) {
|
|
362
362
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -365,63 +365,63 @@ class N {
|
|
|
365
365
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
366
366
|
}
|
|
367
367
|
_(e) {
|
|
368
|
-
this._$AH !== f &&
|
|
368
|
+
this._$AH !== f && I(this._$AH) ? this._$AA.nextSibling.data = e : this.T(S.createTextNode(e)), this._$AH = e;
|
|
369
369
|
}
|
|
370
370
|
$(e) {
|
|
371
|
-
const { values:
|
|
372
|
-
if (this._$AH?._$AD ===
|
|
371
|
+
const { values: i, _$litType$: r } = e, s = typeof r == "number" ? this._$AC(e) : (r.el === void 0 && (r.el = N.createElement(ue(r.h, r.h[0]), this.options)), r);
|
|
372
|
+
if (this._$AH?._$AD === s) this._$AH.p(i);
|
|
373
373
|
else {
|
|
374
|
-
const o = new
|
|
375
|
-
o.p(
|
|
374
|
+
const o = new Re(s, this), a = o.u(this.options);
|
|
375
|
+
o.p(i), this.T(a), this._$AH = o;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
_$AC(e) {
|
|
379
|
-
let
|
|
380
|
-
return
|
|
379
|
+
let i = ae.get(e.strings);
|
|
380
|
+
return i === void 0 && ae.set(e.strings, i = new N(e)), i;
|
|
381
381
|
}
|
|
382
382
|
k(e) {
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
let
|
|
386
|
-
for (const o of e)
|
|
387
|
-
|
|
383
|
+
Y(this._$AH) || (this._$AH = [], this._$AR());
|
|
384
|
+
const i = this._$AH;
|
|
385
|
+
let r, s = 0;
|
|
386
|
+
for (const o of e) s === i.length ? i.push(r = new z(this.O(R()), this.O(R()), this, this.options)) : r = i[s], r._$AI(o), s++;
|
|
387
|
+
s < i.length && (this._$AR(r && r._$AB.nextSibling, s), i.length = s);
|
|
388
388
|
}
|
|
389
|
-
_$AR(e = this._$AA.nextSibling,
|
|
390
|
-
for (this._$AP?.(!1, !0,
|
|
391
|
-
const
|
|
392
|
-
|
|
389
|
+
_$AR(e = this._$AA.nextSibling, i) {
|
|
390
|
+
for (this._$AP?.(!1, !0, i); e !== this._$AB; ) {
|
|
391
|
+
const r = ee(e).nextSibling;
|
|
392
|
+
ee(e).remove(), e = r;
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
setConnected(e) {
|
|
396
396
|
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
class
|
|
399
|
+
class B {
|
|
400
400
|
get tagName() {
|
|
401
401
|
return this.element.tagName;
|
|
402
402
|
}
|
|
403
403
|
get _$AU() {
|
|
404
404
|
return this._$AM._$AU;
|
|
405
405
|
}
|
|
406
|
-
constructor(e,
|
|
407
|
-
this.type = 1, this._$AH = f, this._$AN = void 0, this.element = e, this.name =
|
|
406
|
+
constructor(e, i, r, s, o) {
|
|
407
|
+
this.type = 1, this._$AH = f, this._$AN = void 0, this.element = e, this.name = i, this._$AM = s, this.options = o, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = f;
|
|
408
408
|
}
|
|
409
|
-
_$AI(e,
|
|
409
|
+
_$AI(e, i = this, r, s) {
|
|
410
410
|
const o = this.strings;
|
|
411
411
|
let a = !1;
|
|
412
|
-
if (o === void 0) e =
|
|
412
|
+
if (o === void 0) e = k(this, e, i, 0), a = !I(e) || e !== this._$AH && e !== v, a && (this._$AH = e);
|
|
413
413
|
else {
|
|
414
414
|
const n = e;
|
|
415
415
|
let l, m;
|
|
416
|
-
for (e = o[0], l = 0; l < o.length - 1; l++) m =
|
|
416
|
+
for (e = o[0], l = 0; l < o.length - 1; l++) m = k(this, n[r + l], i, l), m === v && (m = this._$AH[l]), a ||= !I(m) || m !== this._$AH[l], m === f ? e = f : e !== f && (e += (m ?? "") + o[l + 1]), this._$AH[l] = m;
|
|
417
417
|
}
|
|
418
|
-
a && !
|
|
418
|
+
a && !s && this.j(e);
|
|
419
419
|
}
|
|
420
420
|
j(e) {
|
|
421
421
|
e === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
class
|
|
424
|
+
class Ie extends B {
|
|
425
425
|
constructor() {
|
|
426
426
|
super(...arguments), this.type = 3;
|
|
427
427
|
}
|
|
@@ -429,7 +429,7 @@ class Te extends M {
|
|
|
429
429
|
this.element[this.name] = e === f ? void 0 : e;
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
class
|
|
432
|
+
class Ne extends B {
|
|
433
433
|
constructor() {
|
|
434
434
|
super(...arguments), this.type = 4;
|
|
435
435
|
}
|
|
@@ -437,43 +437,43 @@ class Ce extends M {
|
|
|
437
437
|
this.element.toggleAttribute(this.name, !!e && e !== f);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
class
|
|
441
|
-
constructor(e,
|
|
442
|
-
super(e,
|
|
440
|
+
class ze extends B {
|
|
441
|
+
constructor(e, i, r, s, o) {
|
|
442
|
+
super(e, i, r, s, o), this.type = 5;
|
|
443
443
|
}
|
|
444
|
-
_$AI(e,
|
|
445
|
-
if ((e =
|
|
446
|
-
const
|
|
447
|
-
|
|
444
|
+
_$AI(e, i = this) {
|
|
445
|
+
if ((e = k(this, e, i, 0) ?? f) === v) return;
|
|
446
|
+
const r = this._$AH, s = e === f && r !== f || e.capture !== r.capture || e.once !== r.once || e.passive !== r.passive, o = e !== f && (r === f || s);
|
|
447
|
+
s && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
448
448
|
}
|
|
449
449
|
handleEvent(e) {
|
|
450
450
|
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
454
|
-
constructor(e,
|
|
455
|
-
this.element = e, this.type = 6, this._$AN = void 0, this._$AM =
|
|
453
|
+
class Fe {
|
|
454
|
+
constructor(e, i, r) {
|
|
455
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = r;
|
|
456
456
|
}
|
|
457
457
|
get _$AU() {
|
|
458
458
|
return this._$AM._$AU;
|
|
459
459
|
}
|
|
460
460
|
_$AI(e) {
|
|
461
|
-
|
|
461
|
+
k(this, e);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
const
|
|
468
|
-
let
|
|
469
|
-
if (
|
|
470
|
-
const o =
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
return
|
|
464
|
+
const Ue = K.litHtmlPolyfillSupport;
|
|
465
|
+
Ue?.(N, z), (K.litHtmlVersions ??= []).push("3.3.2");
|
|
466
|
+
const Oe = (t, e, i) => {
|
|
467
|
+
const r = i?.renderBefore ?? e;
|
|
468
|
+
let s = r._$litPart$;
|
|
469
|
+
if (s === void 0) {
|
|
470
|
+
const o = i?.renderBefore ?? null;
|
|
471
|
+
r._$litPart$ = s = new z(e.insertBefore(R(), o), o, void 0, i ?? {});
|
|
472
|
+
}
|
|
473
|
+
return s._$AI(t), s;
|
|
474
474
|
};
|
|
475
475
|
const G = globalThis;
|
|
476
|
-
let
|
|
476
|
+
let C = class extends E {
|
|
477
477
|
constructor() {
|
|
478
478
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
479
479
|
}
|
|
@@ -482,8 +482,8 @@ let T = class extends S {
|
|
|
482
482
|
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
483
483
|
}
|
|
484
484
|
update(e) {
|
|
485
|
-
const
|
|
486
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do =
|
|
485
|
+
const i = this.render();
|
|
486
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Oe(i, this.renderRoot, this.renderOptions);
|
|
487
487
|
}
|
|
488
488
|
connectedCallback() {
|
|
489
489
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -492,96 +492,116 @@ let T = class extends S {
|
|
|
492
492
|
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
493
493
|
}
|
|
494
494
|
render() {
|
|
495
|
-
return
|
|
495
|
+
return v;
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
498
|
+
C._$litElement$ = !0, C.finalized = !0, G.litElementHydrateSupport?.({ LitElement: C });
|
|
499
|
+
const Ve = G.litElementPolyfillSupport;
|
|
500
|
+
Ve?.({ LitElement: C });
|
|
501
501
|
(G.litElementVersions ??= []).push("4.2.2");
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
customElements.define(
|
|
505
|
-
}) : customElements.define(
|
|
502
|
+
const De = (t) => (e, i) => {
|
|
503
|
+
i !== void 0 ? i.addInitializer(() => {
|
|
504
|
+
customElements.define(t, e);
|
|
505
|
+
}) : customElements.define(t, e);
|
|
506
506
|
};
|
|
507
|
-
const
|
|
508
|
-
const { kind:
|
|
509
|
-
let o = globalThis.litPropertyMetadata.get(
|
|
510
|
-
if (o === void 0 && globalThis.litPropertyMetadata.set(
|
|
511
|
-
const { name: a } =
|
|
507
|
+
const Me = { attribute: !0, type: String, converter: V, reflect: !1, hasChanged: W }, Be = (t = Me, e, i) => {
|
|
508
|
+
const { kind: r, metadata: s } = i;
|
|
509
|
+
let o = globalThis.litPropertyMetadata.get(s);
|
|
510
|
+
if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), r === "setter" && ((t = Object.create(t)).wrapped = !0), o.set(i.name, t), r === "accessor") {
|
|
511
|
+
const { name: a } = i;
|
|
512
512
|
return { set(n) {
|
|
513
513
|
const l = e.get.call(this);
|
|
514
|
-
e.set.call(this, n), this.requestUpdate(a, l,
|
|
514
|
+
e.set.call(this, n), this.requestUpdate(a, l, t, !0, n);
|
|
515
515
|
}, init(n) {
|
|
516
|
-
return n !== void 0 && this.C(a, void 0,
|
|
516
|
+
return n !== void 0 && this.C(a, void 0, t, n), n;
|
|
517
517
|
} };
|
|
518
518
|
}
|
|
519
|
-
if (
|
|
520
|
-
const { name: a } =
|
|
519
|
+
if (r === "setter") {
|
|
520
|
+
const { name: a } = i;
|
|
521
521
|
return function(n) {
|
|
522
522
|
const l = this[a];
|
|
523
|
-
e.call(this, n), this.requestUpdate(a, l,
|
|
523
|
+
e.call(this, n), this.requestUpdate(a, l, t, !0, n);
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
throw Error("Unsupported decorator location: " +
|
|
526
|
+
throw Error("Unsupported decorator location: " + r);
|
|
527
527
|
};
|
|
528
|
-
function p(
|
|
529
|
-
return (e,
|
|
530
|
-
const a =
|
|
531
|
-
return
|
|
532
|
-
})(
|
|
528
|
+
function p(t) {
|
|
529
|
+
return (e, i) => typeof i == "object" ? Be(t, e, i) : ((r, s, o) => {
|
|
530
|
+
const a = s.hasOwnProperty(o);
|
|
531
|
+
return s.constructor.createProperty(o, r), a ? Object.getOwnPropertyDescriptor(s, o) : void 0;
|
|
532
|
+
})(t, e, i);
|
|
533
533
|
}
|
|
534
|
-
function
|
|
535
|
-
return p({ ...
|
|
534
|
+
function b(t) {
|
|
535
|
+
return p({ ...t, state: !0, attribute: !1 });
|
|
536
536
|
}
|
|
537
|
-
const
|
|
538
|
-
function
|
|
539
|
-
return (
|
|
540
|
-
const o = (a) => a.renderRoot?.querySelector(
|
|
541
|
-
return
|
|
537
|
+
const Le = (t, e, i) => (i.configurable = !0, i.enumerable = !0, Reflect.decorate && typeof e != "object" && Object.defineProperty(t, e, i), i);
|
|
538
|
+
function qe(t, e) {
|
|
539
|
+
return (i, r, s) => {
|
|
540
|
+
const o = (a) => a.renderRoot?.querySelector(t) ?? null;
|
|
541
|
+
return Le(i, r, { get() {
|
|
542
542
|
return o(this);
|
|
543
543
|
} });
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
|
-
const
|
|
547
|
-
class
|
|
546
|
+
const _ = { ATTRIBUTE: 1, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4 }, me = (t) => (...e) => ({ _$litDirective$: t, values: e });
|
|
547
|
+
class fe {
|
|
548
548
|
constructor(e) {
|
|
549
549
|
}
|
|
550
550
|
get _$AU() {
|
|
551
551
|
return this._$AM._$AU;
|
|
552
552
|
}
|
|
553
|
-
_$AT(e,
|
|
554
|
-
this._$Ct = e, this._$AM =
|
|
553
|
+
_$AT(e, i, r) {
|
|
554
|
+
this._$Ct = e, this._$AM = i, this._$Ci = r;
|
|
555
555
|
}
|
|
556
|
-
_$AS(e,
|
|
557
|
-
return this.update(e,
|
|
556
|
+
_$AS(e, i) {
|
|
557
|
+
return this.update(e, i);
|
|
558
558
|
}
|
|
559
|
-
update(e,
|
|
560
|
-
return this.render(...
|
|
559
|
+
update(e, i) {
|
|
560
|
+
return this.render(...i);
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
const
|
|
564
|
-
constructor(
|
|
565
|
-
if (super(
|
|
563
|
+
const U = me(class extends fe {
|
|
564
|
+
constructor(t) {
|
|
565
|
+
if (super(t), t.type !== _.ATTRIBUTE || t.name !== "class" || t.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
|
|
566
566
|
}
|
|
567
|
-
render(
|
|
568
|
-
return " " + Object.keys(
|
|
567
|
+
render(t) {
|
|
568
|
+
return " " + Object.keys(t).filter((e) => t[e]).join(" ") + " ";
|
|
569
569
|
}
|
|
570
|
-
update(
|
|
570
|
+
update(t, [e]) {
|
|
571
571
|
if (this.st === void 0) {
|
|
572
|
-
this.st = /* @__PURE__ */ new Set(),
|
|
573
|
-
for (const
|
|
572
|
+
this.st = /* @__PURE__ */ new Set(), t.strings !== void 0 && (this.nt = new Set(t.strings.join(" ").split(/\s/).filter((r) => r !== "")));
|
|
573
|
+
for (const r in e) e[r] && !this.nt?.has(r) && this.st.add(r);
|
|
574
574
|
return this.render(e);
|
|
575
575
|
}
|
|
576
|
-
const
|
|
577
|
-
for (const
|
|
578
|
-
for (const
|
|
579
|
-
const
|
|
580
|
-
|
|
576
|
+
const i = t.element.classList;
|
|
577
|
+
for (const r of this.st) r in e || (i.remove(r), this.st.delete(r));
|
|
578
|
+
for (const r in e) {
|
|
579
|
+
const s = !!e[r];
|
|
580
|
+
s === this.st.has(r) || this.nt?.has(r) || (s ? (i.add(r), this.st.add(r)) : (i.remove(r), this.st.delete(r)));
|
|
581
581
|
}
|
|
582
|
-
return
|
|
582
|
+
return v;
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
const He = (t) => t.strings === void 0, je = {}, We = (t, e = je) => t._$AH = e;
|
|
586
|
+
const Ke = me(class extends fe {
|
|
587
|
+
constructor(t) {
|
|
588
|
+
if (super(t), t.type !== _.PROPERTY && t.type !== _.ATTRIBUTE && t.type !== _.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
589
|
+
if (!He(t)) throw Error("`live` bindings can only contain a single expression");
|
|
590
|
+
}
|
|
591
|
+
render(t) {
|
|
592
|
+
return t;
|
|
583
593
|
}
|
|
584
|
-
|
|
594
|
+
update(t, [e]) {
|
|
595
|
+
if (e === v || e === f) return e;
|
|
596
|
+
const i = t.element, r = t.name;
|
|
597
|
+
if (t.type === _.PROPERTY) {
|
|
598
|
+
if (e === i[r]) return v;
|
|
599
|
+
} else if (t.type === _.BOOLEAN_ATTRIBUTE) {
|
|
600
|
+
if (!!e === i.hasAttribute(r)) return v;
|
|
601
|
+
} else if (t.type === _.ATTRIBUTE && i.getAttribute(r) === e + "") return v;
|
|
602
|
+
return We(t), e;
|
|
603
|
+
}
|
|
604
|
+
}), Ye = [
|
|
585
605
|
"AE",
|
|
586
606
|
"AR",
|
|
587
607
|
"AT",
|
|
@@ -636,63 +656,63 @@ const F = Be(class extends qe {
|
|
|
636
656
|
"VN",
|
|
637
657
|
"ZA"
|
|
638
658
|
];
|
|
639
|
-
function
|
|
640
|
-
let
|
|
641
|
-
return function(...
|
|
642
|
-
const o = Date.now(), a = e - (o -
|
|
643
|
-
a <= 0 || a > e ? (
|
|
644
|
-
|
|
659
|
+
function st(t, e) {
|
|
660
|
+
let i = null, r = 0;
|
|
661
|
+
return function(...s) {
|
|
662
|
+
const o = Date.now(), a = e - (o - r);
|
|
663
|
+
a <= 0 || a > e ? (i && (clearTimeout(i), i = null), r = o, t.apply(this, s)) : i || (i = setTimeout(() => {
|
|
664
|
+
r = Date.now(), i = null, t.apply(this, s);
|
|
645
665
|
}, a));
|
|
646
666
|
};
|
|
647
667
|
}
|
|
648
|
-
function
|
|
649
|
-
let
|
|
650
|
-
return function(...
|
|
651
|
-
|
|
652
|
-
|
|
668
|
+
function Ge(t, e) {
|
|
669
|
+
let i = null;
|
|
670
|
+
return function(...r) {
|
|
671
|
+
i && clearTimeout(i), i = setTimeout(() => {
|
|
672
|
+
t.apply(this, r);
|
|
653
673
|
}, e);
|
|
654
674
|
};
|
|
655
675
|
}
|
|
656
|
-
function
|
|
657
|
-
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
|
676
|
+
function Ze() {
|
|
677
|
+
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
|
658
678
|
const e = Math.random() * 16 | 0;
|
|
659
|
-
return (
|
|
679
|
+
return (t === "x" ? e : e & 3 | 8).toString(16);
|
|
660
680
|
});
|
|
661
681
|
}
|
|
662
|
-
function
|
|
663
|
-
if (!
|
|
664
|
-
const e =
|
|
665
|
-
(
|
|
682
|
+
function Je(t) {
|
|
683
|
+
if (!t) return null;
|
|
684
|
+
const e = t.find(
|
|
685
|
+
(i) => i.types?.includes("country")
|
|
666
686
|
);
|
|
667
687
|
return e ? e.short_name : null;
|
|
668
688
|
}
|
|
669
|
-
function
|
|
670
|
-
let
|
|
671
|
-
return
|
|
672
|
-
isSupported:
|
|
673
|
-
countryCode:
|
|
689
|
+
function ne(t, e) {
|
|
690
|
+
let i = null;
|
|
691
|
+
return t.address_components ? i = Je(t.address_components) : e && e.length === 1 && (i = e[0].toUpperCase()), i ? {
|
|
692
|
+
isSupported: Ye.includes(i),
|
|
693
|
+
countryCode: i
|
|
674
694
|
} : {
|
|
675
695
|
isSupported: null,
|
|
676
696
|
countryCode: null
|
|
677
697
|
};
|
|
678
698
|
}
|
|
679
|
-
function
|
|
680
|
-
const
|
|
681
|
-
let
|
|
699
|
+
function ot(t, e) {
|
|
700
|
+
const i = [];
|
|
701
|
+
let r = 0;
|
|
682
702
|
return [...e].sort((o, a) => o.offset - a.offset).forEach((o) => {
|
|
683
|
-
o.offset >
|
|
684
|
-
text:
|
|
703
|
+
o.offset > r && i.push({
|
|
704
|
+
text: t.substring(r, o.offset),
|
|
685
705
|
highlight: !1
|
|
686
|
-
}),
|
|
687
|
-
text:
|
|
706
|
+
}), i.push({
|
|
707
|
+
text: t.substring(o.offset, o.offset + o.length),
|
|
688
708
|
highlight: !0
|
|
689
|
-
}),
|
|
690
|
-
}),
|
|
691
|
-
text:
|
|
709
|
+
}), r = o.offset + o.length;
|
|
710
|
+
}), r < t.length && i.push({
|
|
711
|
+
text: t.substring(r),
|
|
692
712
|
highlight: !1
|
|
693
|
-
}),
|
|
713
|
+
}), i;
|
|
694
714
|
}
|
|
695
|
-
const
|
|
715
|
+
const le = {
|
|
696
716
|
en: {
|
|
697
717
|
placeholder: "Search for an address...",
|
|
698
718
|
noResults: "No address found for this search. Try different keywords.",
|
|
@@ -824,42 +844,42 @@ const ne = {
|
|
|
824
844
|
validationSaudiFormat: "Lütfen geçerli bir Suudi ulusal adresi girin (format: AAAA1234)"
|
|
825
845
|
}
|
|
826
846
|
};
|
|
827
|
-
function
|
|
828
|
-
return
|
|
847
|
+
function q(t = "en") {
|
|
848
|
+
return le[t] || le.en;
|
|
829
849
|
}
|
|
830
|
-
function
|
|
831
|
-
return ["ar"].includes(
|
|
850
|
+
function Xe(t) {
|
|
851
|
+
return ["ar"].includes(t);
|
|
832
852
|
}
|
|
833
|
-
var
|
|
834
|
-
for (var
|
|
835
|
-
(a =
|
|
836
|
-
return
|
|
853
|
+
var Qe = Object.defineProperty, et = Object.getOwnPropertyDescriptor, h = (t, e, i, r) => {
|
|
854
|
+
for (var s = r > 1 ? void 0 : r ? et(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
855
|
+
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
856
|
+
return r && s && Qe(e, i, s), s;
|
|
837
857
|
};
|
|
838
|
-
let d = class extends
|
|
858
|
+
let d = class extends C {
|
|
839
859
|
constructor() {
|
|
840
860
|
super(), this.proxyUrl = "https://api.salla.dev", this.authToken = null, this.placeholder = "", this.defaultPlace = "", this.label = null, this.className = "", this.language = "en", this.dir = "auto", this.mode = "search", this.name = "", this.required = !1, this.pattern = null, this.tooltip = null, this.selectedId = null, this.errors = [], this.disabled = !1, this._value = "", this._country = null, this.locationBias = null, this.locationRestriction = null, this.types = null, this._fields = ["formatted_address", "geometry"], this.strictBounds = !1, this.useSessionToken = !0, this.resolve = !1, this.onValidateAddress = null, this.debounceDelay = 300, this.minChars = 3, this.predictions = [], this.isOpen = !1, this.isLoading = !1, this.error = null, this.activeIndex = -1, this.inputValue = "", this.sessionToken = null, this.validationError = null, this.touched = !1, this.showNationalAddressIcon = !1, this.abortController = null, this._internals = this.attachInternals();
|
|
841
861
|
}
|
|
842
|
-
set value(
|
|
862
|
+
set value(t) {
|
|
843
863
|
const e = this._value;
|
|
844
|
-
this._value =
|
|
864
|
+
this._value = t || "", this.requestUpdate("value", e);
|
|
845
865
|
}
|
|
846
866
|
get value() {
|
|
847
867
|
return this._value;
|
|
848
868
|
}
|
|
849
|
-
set country(
|
|
850
|
-
|
|
869
|
+
set country(t) {
|
|
870
|
+
t == null ? this._country = null : Array.isArray(t) ? this._country = t.filter((e) => e && e.trim()).map((e) => e.trim()) : this._country = t.split(",").map((e) => e.trim()).filter((e) => e);
|
|
851
871
|
}
|
|
852
872
|
get country() {
|
|
853
873
|
return this._country;
|
|
854
874
|
}
|
|
855
|
-
set fieldsStr(
|
|
856
|
-
this._fields =
|
|
875
|
+
set fieldsStr(t) {
|
|
876
|
+
this._fields = t ? t.split(",").map((e) => e.trim()).filter((e) => e) : ["formatted_address", "geometry"];
|
|
857
877
|
}
|
|
858
878
|
get fieldsStr() {
|
|
859
879
|
return this._fields.join(",");
|
|
860
880
|
}
|
|
861
|
-
set fields(
|
|
862
|
-
this._fields =
|
|
881
|
+
set fields(t) {
|
|
882
|
+
this._fields = t && t.length > 0 ? t : ["formatted_address", "geometry"];
|
|
863
883
|
}
|
|
864
884
|
get fields() {
|
|
865
885
|
return this._fields;
|
|
@@ -871,27 +891,27 @@ let d = class extends T {
|
|
|
871
891
|
super.disconnectedCallback(), this.terminateSession(), this.cancelPendingRequest();
|
|
872
892
|
}
|
|
873
893
|
initializeDebounce() {
|
|
874
|
-
this.debouncedFetch =
|
|
894
|
+
this.debouncedFetch = Ge(this.fetchPredictions.bind(this), this.debounceDelay);
|
|
875
895
|
}
|
|
876
896
|
firstUpdated() {
|
|
877
|
-
const
|
|
878
|
-
|
|
897
|
+
const t = this.value || this.defaultPlace || "";
|
|
898
|
+
t && (this.inputValue = t, this.isSaudiFormMode() && this.isShortAddressFormat(t) && (this.showNationalAddressIcon = !0));
|
|
879
899
|
}
|
|
880
|
-
$nextTick(
|
|
881
|
-
Promise.resolve().then(
|
|
900
|
+
$nextTick(t) {
|
|
901
|
+
Promise.resolve().then(t);
|
|
882
902
|
}
|
|
883
|
-
isShortAddressFormat(
|
|
884
|
-
return /^[a-zA-Z]{4}\d{4}$/.test(
|
|
903
|
+
isShortAddressFormat(t) {
|
|
904
|
+
return /^[a-zA-Z]{4}\d{4}$/.test(t?.trim());
|
|
885
905
|
}
|
|
886
|
-
updated(
|
|
887
|
-
if (
|
|
906
|
+
updated(t) {
|
|
907
|
+
if (t.has("value")) {
|
|
888
908
|
const e = this.value || "";
|
|
889
909
|
e !== this.inputValue && (this.inputValue = e, this.isSaudiFormMode() && e && this.isShortAddressFormat(e) ? this.showNationalAddressIcon = !0 : this.showNationalAddressIcon = !1);
|
|
890
910
|
}
|
|
891
|
-
|
|
911
|
+
t.has("defaultPlace") && !this.value && this.defaultPlace !== this.inputValue && (this.inputValue = this.defaultPlace || "", this.isSaudiFormMode() && this.defaultPlace && this.isShortAddressFormat(this.defaultPlace) ? this.showNationalAddressIcon = !0 : this.showNationalAddressIcon = !1), t.has("selectedId") && this.selectedId && this.selectedId !== this.inputValue && this.isSaudiFormMode() && this.isShortAddressFormat(this.selectedId) && (this.inputValue = this.selectedId || "", this.showNationalAddressIcon = !0, this._internals.setFormValue(this.selectedId || "")), t.has("debounceDelay") && this.initializeDebounce();
|
|
892
912
|
}
|
|
893
913
|
createNewSession() {
|
|
894
|
-
this.useSessionToken && (this.sessionToken =
|
|
914
|
+
this.useSessionToken && (this.sessionToken = Ze());
|
|
895
915
|
}
|
|
896
916
|
terminateSession() {
|
|
897
917
|
this.sessionToken = null;
|
|
@@ -899,12 +919,12 @@ let d = class extends T {
|
|
|
899
919
|
cancelPendingRequest() {
|
|
900
920
|
this.abortController && (this.abortController.abort(), this.abortController = null);
|
|
901
921
|
}
|
|
902
|
-
async fetchPredictions(
|
|
903
|
-
if (!
|
|
922
|
+
async fetchPredictions(t) {
|
|
923
|
+
if (!t.trim()) {
|
|
904
924
|
this.predictions = [], this.isOpen = !1, this.isLoading = !1;
|
|
905
925
|
return;
|
|
906
926
|
}
|
|
907
|
-
if (
|
|
927
|
+
if (t.trim().length < this.minChars) {
|
|
908
928
|
this.predictions = [], this.isOpen = !1, this.isLoading = !1;
|
|
909
929
|
return;
|
|
910
930
|
}
|
|
@@ -912,9 +932,9 @@ let d = class extends T {
|
|
|
912
932
|
const e = this.abortController.signal;
|
|
913
933
|
this.isLoading = !0, this.error = null;
|
|
914
934
|
try {
|
|
915
|
-
const
|
|
916
|
-
this.sessionToken && (
|
|
917
|
-
const
|
|
935
|
+
const i = { input: t };
|
|
936
|
+
this.sessionToken && (i.sessiontoken = this.sessionToken), this.country && this.country.length > 0 && (i.country = this.country.join(",")), this.types && this.types.length > 0 && (i.types = this.types.join("|")), this.locationBias && this.locationBias.radius && this.locationBias.center && (i.location = `${this.locationBias.center.lat},${this.locationBias.center.lng}`, i.radius = this.locationBias.radius.toString()), this.strictBounds && (i.strictbounds = "true");
|
|
937
|
+
const r = new URLSearchParams(i), o = `${this.proxyUrl || ""}/store/v1/checkout/address/autocomplete/query?${r.toString()}`, a = {};
|
|
918
938
|
this.authToken && (a.Authorization = `Bearer ${this.authToken}`);
|
|
919
939
|
const n = await fetch(o, { signal: e, headers: a });
|
|
920
940
|
if (!n.ok)
|
|
@@ -934,22 +954,22 @@ let d = class extends T {
|
|
|
934
954
|
geometry: c.geometry,
|
|
935
955
|
address_components: c.address_components
|
|
936
956
|
})), this.isOpen = !0, this.activeIndex = -1) : (this.predictions = [], this.isOpen = !0)) : (this.predictions = [], this.isOpen = !0);
|
|
937
|
-
} catch (
|
|
938
|
-
if (
|
|
957
|
+
} catch (i) {
|
|
958
|
+
if (i instanceof Error && i.name === "AbortError")
|
|
939
959
|
return;
|
|
940
960
|
this.predictions = [], this.isOpen = !0;
|
|
941
961
|
} finally {
|
|
942
962
|
this.isLoading = !1, this.abortController = null;
|
|
943
963
|
}
|
|
944
964
|
}
|
|
945
|
-
async fetchPlaceDetails(
|
|
965
|
+
async fetchPlaceDetails(t) {
|
|
946
966
|
this.isLoading = !0, this.error = null;
|
|
947
967
|
try {
|
|
948
|
-
const e = { place_id:
|
|
968
|
+
const e = { place_id: t };
|
|
949
969
|
this.fields && this.fields.length > 0 && (e.fields = this.fields.join(",")), this.sessionToken && (e.sessiontoken = this.sessionToken), this.country && this.country.length > 0 && (e.country = this.country.join(",")), this.resolve && (e.resolve = "true");
|
|
950
|
-
const
|
|
970
|
+
const i = new URLSearchParams(e), s = `${this.proxyUrl || ""}/store/v1/checkout/address/autocomplete/details?${i.toString()}`, o = {};
|
|
951
971
|
this.authToken && (o.Authorization = `Bearer ${this.authToken}`);
|
|
952
|
-
const a = await fetch(
|
|
972
|
+
const a = await fetch(s, { headers: o });
|
|
953
973
|
if (!a.ok)
|
|
954
974
|
throw new Error(`HTTP ${a.status}: ${a.statusText}`);
|
|
955
975
|
const n = await a.json();
|
|
@@ -965,37 +985,37 @@ let d = class extends T {
|
|
|
965
985
|
} : null;
|
|
966
986
|
} catch (e) {
|
|
967
987
|
console.error("Error fetching place details:", e);
|
|
968
|
-
const
|
|
969
|
-
return this.error = e instanceof Error ? e.message :
|
|
988
|
+
const i = q(this.language);
|
|
989
|
+
return this.error = e instanceof Error ? e.message : i.errorFetchDetails, null;
|
|
970
990
|
} finally {
|
|
971
991
|
this.isLoading = !1;
|
|
972
992
|
}
|
|
973
993
|
}
|
|
974
|
-
async validateAddress(
|
|
994
|
+
async validateAddress(t) {
|
|
975
995
|
try {
|
|
976
|
-
if (!
|
|
996
|
+
if (!t || !t.formatted_address)
|
|
977
997
|
return console.error("Cannot validate address - place or formatted_address is missing"), null;
|
|
978
998
|
if (!this.onValidateAddress || typeof this.onValidateAddress != "function")
|
|
979
999
|
return console.error("onValidateAddress callback is required for address validation"), null;
|
|
980
|
-
const e =
|
|
981
|
-
place:
|
|
1000
|
+
const e = ne(t, this.country), i = await this.onValidateAddress({
|
|
1001
|
+
place: t,
|
|
982
1002
|
sessionToken: this.sessionToken,
|
|
983
1003
|
validationSupport: e
|
|
984
1004
|
});
|
|
985
|
-
return this.terminateSession(),
|
|
1005
|
+
return this.terminateSession(), i;
|
|
986
1006
|
} catch (e) {
|
|
987
1007
|
return console.error("Error validating address:", e), this.terminateSession(), null;
|
|
988
1008
|
}
|
|
989
1009
|
}
|
|
990
|
-
getValidationSupport(
|
|
991
|
-
return
|
|
1010
|
+
getValidationSupport(t) {
|
|
1011
|
+
return ne(t, this.country);
|
|
992
1012
|
}
|
|
993
1013
|
isSaudiFormMode() {
|
|
994
1014
|
return this.mode === "form" && this.country !== null && this.country.length === 1 && this.country[0].toLowerCase() === "sa";
|
|
995
1015
|
}
|
|
996
1016
|
getWhatsAppLink() {
|
|
997
|
-
const
|
|
998
|
-
return `https://wa.me/${
|
|
1017
|
+
const t = "966112898888", e = encodeURIComponent("العنوان الوطني");
|
|
1018
|
+
return `https://wa.me/${t}?text=${e}`;
|
|
999
1019
|
}
|
|
1000
1020
|
renderWhatsAppIcon() {
|
|
1001
1021
|
return g`
|
|
@@ -1011,10 +1031,10 @@ let d = class extends T {
|
|
|
1011
1031
|
};
|
|
1012
1032
|
}
|
|
1013
1033
|
renderSaudiFriendlyError() {
|
|
1014
|
-
const
|
|
1015
|
-
let e,
|
|
1016
|
-
|
|
1017
|
-
const
|
|
1034
|
+
const t = this.inputValue && this.inputValue.trim().length > 0;
|
|
1035
|
+
let e, i;
|
|
1036
|
+
t ? (e = "العنوان الوطني المختصر غير صحيح (الصيغة: AAAA1234). يمكنك الحصول عليه بسهولة", i = "The short national address format is incorrect (format: AAAA1234). You can easily get it") : (e = "العنوان الوطني المختصر مطلوب. يمكنك الحصول عليه بسهولة", i = "The short national address is required. You can easily get it");
|
|
1037
|
+
const r = "عبر الواتساب (اضغط هنا)", s = "via WhatsApp (click here)", o = "أو ابحث أعلاه", a = "or search above", n = this.language === "ar" ? e : i, l = this.language === "ar" ? r : s, m = this.language === "ar" ? o : a;
|
|
1018
1038
|
return g`
|
|
1019
1039
|
<span>
|
|
1020
1040
|
${n}
|
|
@@ -1035,7 +1055,7 @@ let d = class extends T {
|
|
|
1035
1055
|
renderSaudiHelpText() {
|
|
1036
1056
|
if (!this.isSaudiFormMode() || this.validationError || this.errors && this.errors.length > 0)
|
|
1037
1057
|
return "";
|
|
1038
|
-
const
|
|
1058
|
+
const t = "لا تعرف العنوان الوطني؟ احصل عليه بسهولة", e = "Don't know your national address? Get it easily", i = "عبر الواتساب (اضغط هنا)", r = "via WhatsApp (click here)", s = "أو ابحث أعلاه", o = "or search above", a = this.language === "ar" ? t : e, n = this.language === "ar" ? i : r, l = this.language === "ar" ? s : o;
|
|
1039
1059
|
return g`
|
|
1040
1060
|
<div class="help-text" part="help-text">
|
|
1041
1061
|
<span>
|
|
@@ -1060,12 +1080,12 @@ let d = class extends T {
|
|
|
1060
1080
|
}
|
|
1061
1081
|
reportValidity() {
|
|
1062
1082
|
this.touched = !0;
|
|
1063
|
-
const
|
|
1064
|
-
return
|
|
1083
|
+
const t = this.validate();
|
|
1084
|
+
return t || this.dispatchEvent(new CustomEvent("invalid", {
|
|
1065
1085
|
detail: { error: this.validationError },
|
|
1066
1086
|
bubbles: !0,
|
|
1067
1087
|
composed: !0
|
|
1068
|
-
})),
|
|
1088
|
+
})), t;
|
|
1069
1089
|
}
|
|
1070
1090
|
reset() {
|
|
1071
1091
|
this.inputValue = "", this.selectedId = null, this.validationError = null, this.errors = [], this.touched = !1, this.predictions = [], this.isOpen = !1, this.error = null, this.showNationalAddressIcon = !1, this.mode === "form" && (this._internals.setFormValue(null), this._internals.setValidity({}));
|
|
@@ -1074,31 +1094,88 @@ let d = class extends T {
|
|
|
1074
1094
|
formResetCallback() {
|
|
1075
1095
|
this.reset();
|
|
1076
1096
|
}
|
|
1077
|
-
formStateRestoreCallback(
|
|
1078
|
-
|
|
1097
|
+
formStateRestoreCallback(t) {
|
|
1098
|
+
t && this.mode === "form" && (this.selectedId = t);
|
|
1079
1099
|
}
|
|
1080
1100
|
validate() {
|
|
1081
1101
|
if (this.mode !== "form")
|
|
1082
1102
|
return !0;
|
|
1083
|
-
const
|
|
1084
|
-
return this.required && !e.trim() ? (this.validationError =
|
|
1103
|
+
const t = q(this.language), e = this.inputValue || "";
|
|
1104
|
+
return this.required && !e.trim() ? (this.validationError = t.validationRequired, this._internals.setValidity(
|
|
1085
1105
|
{ valueMissing: !0 },
|
|
1086
1106
|
this.validationError,
|
|
1087
1107
|
this.inputElement
|
|
1088
|
-
), !1) : this.isSaudiFormMode() && e.trim() && !this.isShortAddressFormat(e) ? (this.validationError =
|
|
1108
|
+
), !1) : this.isSaudiFormMode() && e.trim() && !this.isShortAddressFormat(e) ? (this.validationError = t.validationSaudiFormat, this._internals.setValidity(
|
|
1089
1109
|
{ patternMismatch: !0 },
|
|
1090
1110
|
this.validationError,
|
|
1091
1111
|
this.inputElement
|
|
1092
|
-
), !1) : this.pattern && e.trim() && !new RegExp(this.pattern).test(e) ? (this.validationError =
|
|
1112
|
+
), !1) : this.pattern && e.trim() && !new RegExp(this.pattern).test(e) ? (this.validationError = t.validationPattern, this._internals.setValidity(
|
|
1093
1113
|
{ patternMismatch: !0 },
|
|
1094
1114
|
this.validationError,
|
|
1095
1115
|
this.inputElement
|
|
1096
1116
|
), !1) : (this.validationError = null, this._internals.setValidity({}), !0);
|
|
1097
1117
|
}
|
|
1098
|
-
|
|
1118
|
+
/**
|
|
1119
|
+
* Normalize numerals from various scripts to Arabic numerals (0-9).
|
|
1120
|
+
* Handles Arabic-Indic, Devanagari (Hindi), Persian, and Bengali numerals.
|
|
1121
|
+
* Works consistently across all browsers and operating systems.
|
|
1122
|
+
*/
|
|
1123
|
+
normalizeNumerals(t) {
|
|
1124
|
+
if (!t) return t;
|
|
1125
|
+
const e = {
|
|
1126
|
+
// Arabic-Indic numerals (used in Arab countries): ٠١٢٣٤٥٦٧٨٩
|
|
1127
|
+
"٠": "0",
|
|
1128
|
+
"١": "1",
|
|
1129
|
+
"٢": "2",
|
|
1130
|
+
"٣": "3",
|
|
1131
|
+
"٤": "4",
|
|
1132
|
+
"٥": "5",
|
|
1133
|
+
"٦": "6",
|
|
1134
|
+
"٧": "7",
|
|
1135
|
+
"٨": "8",
|
|
1136
|
+
"٩": "9",
|
|
1137
|
+
// Devanagari (Hindi) numerals (used in India, Nepal): ०१२३४५६७८९
|
|
1138
|
+
"०": "0",
|
|
1139
|
+
"१": "1",
|
|
1140
|
+
"२": "2",
|
|
1141
|
+
"३": "3",
|
|
1142
|
+
"४": "4",
|
|
1143
|
+
"५": "5",
|
|
1144
|
+
"६": "6",
|
|
1145
|
+
"७": "7",
|
|
1146
|
+
"८": "8",
|
|
1147
|
+
"९": "9",
|
|
1148
|
+
// Persian/Dari numerals (used in Iran, Afghanistan): ۰۱۲۳۴۵۶۷۸۹
|
|
1149
|
+
"۰": "0",
|
|
1150
|
+
"۱": "1",
|
|
1151
|
+
"۲": "2",
|
|
1152
|
+
"۳": "3",
|
|
1153
|
+
"۴": "4",
|
|
1154
|
+
"۵": "5",
|
|
1155
|
+
"۶": "6",
|
|
1156
|
+
"۷": "7",
|
|
1157
|
+
"۸": "8",
|
|
1158
|
+
"۹": "9",
|
|
1159
|
+
// Bengali numerals (used in Bangladesh, India): ০১২৩৪৫৬৭৮৯
|
|
1160
|
+
"০": "0",
|
|
1161
|
+
"১": "1",
|
|
1162
|
+
"২": "2",
|
|
1163
|
+
"৩": "3",
|
|
1164
|
+
"৪": "4",
|
|
1165
|
+
"৫": "5",
|
|
1166
|
+
"৬": "6",
|
|
1167
|
+
"৭": "7",
|
|
1168
|
+
"৮": "8",
|
|
1169
|
+
"৯": "9"
|
|
1170
|
+
};
|
|
1171
|
+
return t.split("").map((i) => e[i] ?? i).join("");
|
|
1172
|
+
}
|
|
1173
|
+
handleInput(t) {
|
|
1099
1174
|
if (this.disabled) return;
|
|
1100
|
-
const e =
|
|
1101
|
-
|
|
1175
|
+
const e = t.target, i = e.selectionStart ?? 0, r = this.inputValue, s = e.value, o = this.normalizeNumerals(s);
|
|
1176
|
+
o !== s && (e.value = o, requestAnimationFrame(() => {
|
|
1177
|
+
e.setSelectionRange(i, i);
|
|
1178
|
+
})), this.inputValue = o, this.touched = !0, this.showNationalAddressIcon && (this.showNationalAddressIcon = !1), this.mode === "form" && (this.validationError && (this.validationError = null), this.selectedId = null, this._internals.setFormValue(this.inputValue || null), this.validate()), this.errors && this.errors.length > 0 && (this.errors = []), this.inputValue.trim().length >= this.minChars && (this.isLoading = !0), this.debouncedFetch(this.inputValue), this._value = this.inputValue, this.requestUpdate("value", r), this.dispatchEvent(new CustomEvent("input", {
|
|
1102
1179
|
detail: { value: this.inputValue },
|
|
1103
1180
|
bubbles: !0,
|
|
1104
1181
|
composed: !0
|
|
@@ -1111,17 +1188,17 @@ let d = class extends T {
|
|
|
1111
1188
|
composed: !0
|
|
1112
1189
|
}));
|
|
1113
1190
|
}
|
|
1114
|
-
async handleSelect(
|
|
1191
|
+
async handleSelect(t) {
|
|
1115
1192
|
if (this.disabled) return;
|
|
1116
|
-
this.isSaudiFormMode() &&
|
|
1193
|
+
this.isSaudiFormMode() && t.place_id && this.isShortAddressFormat(t.place_id) ? (this.inputValue = t.place_id, this.showNationalAddressIcon = !0) : (this.inputValue = t.formatted_address, this.showNationalAddressIcon = !1), this.isOpen = !1, this.predictions = [], this.touched = !0;
|
|
1117
1194
|
let e = null;
|
|
1118
|
-
if (this.mode === "form" ? e = await this.fetchPlaceDetails(
|
|
1119
|
-
place_id:
|
|
1120
|
-
formatted_address:
|
|
1121
|
-
geometry:
|
|
1122
|
-
types:
|
|
1123
|
-
address_components:
|
|
1124
|
-
} : e = await this.fetchPlaceDetails(
|
|
1195
|
+
if (this.mode === "form" ? e = await this.fetchPlaceDetails(t.place_id) : t.geometry?.location ? e = {
|
|
1196
|
+
place_id: t.place_id,
|
|
1197
|
+
formatted_address: t.formatted_address || t.description,
|
|
1198
|
+
geometry: t.geometry,
|
|
1199
|
+
types: t.types,
|
|
1200
|
+
address_components: t.address_components
|
|
1201
|
+
} : e = await this.fetchPlaceDetails(t.place_id), e) {
|
|
1125
1202
|
this.isSaudiFormMode() && e.place_id && this.isShortAddressFormat(e.place_id) ? (this.inputValue = e.place_id, this.showNationalAddressIcon = !0) : (e.formatted_address && (this.inputValue = e.formatted_address), this.showNationalAddressIcon = !1), this.mode === "form" && (this.selectedId = e.place_id, this._internals.setFormValue(this.inputValue), this.validate()), this._value = this.inputValue, this.dispatchEvent(new CustomEvent("input", {
|
|
1126
1203
|
detail: { value: this.inputValue },
|
|
1127
1204
|
bubbles: !0,
|
|
@@ -1130,32 +1207,32 @@ let d = class extends T {
|
|
|
1130
1207
|
bubbles: !0,
|
|
1131
1208
|
composed: !0
|
|
1132
1209
|
}));
|
|
1133
|
-
const
|
|
1210
|
+
const i = this.getValidationSupport(e);
|
|
1134
1211
|
this.dispatchEvent(new CustomEvent("place-select", {
|
|
1135
|
-
detail: { place: e, validationSupport:
|
|
1212
|
+
detail: { place: e, validationSupport: i },
|
|
1136
1213
|
bubbles: !0,
|
|
1137
1214
|
composed: !0
|
|
1138
1215
|
})), this.dispatchEvent(new CustomEvent("place-changed", {
|
|
1139
|
-
detail: { place: e, validationSupport:
|
|
1216
|
+
detail: { place: e, validationSupport: i },
|
|
1140
1217
|
bubbles: !0,
|
|
1141
1218
|
composed: !0
|
|
1142
1219
|
}));
|
|
1143
1220
|
}
|
|
1144
1221
|
}
|
|
1145
|
-
handleKeyDown(
|
|
1222
|
+
handleKeyDown(t) {
|
|
1146
1223
|
if (!this.disabled && !(!this.isOpen || this.predictions.length === 0))
|
|
1147
|
-
switch (
|
|
1224
|
+
switch (t.key) {
|
|
1148
1225
|
case "ArrowDown":
|
|
1149
|
-
|
|
1226
|
+
t.preventDefault(), this.activeIndex = Math.min(this.activeIndex + 1, this.predictions.length - 1);
|
|
1150
1227
|
break;
|
|
1151
1228
|
case "ArrowUp":
|
|
1152
|
-
|
|
1229
|
+
t.preventDefault(), this.activeIndex = Math.max(this.activeIndex - 1, -1);
|
|
1153
1230
|
break;
|
|
1154
1231
|
case "Enter":
|
|
1155
|
-
|
|
1232
|
+
t.preventDefault(), this.activeIndex >= 0 && this.activeIndex < this.predictions.length && this.handleSelect(this.predictions[this.activeIndex]);
|
|
1156
1233
|
break;
|
|
1157
1234
|
case "Escape":
|
|
1158
|
-
|
|
1235
|
+
t.preventDefault(), this.isOpen = !1, this.activeIndex = -1;
|
|
1159
1236
|
break;
|
|
1160
1237
|
}
|
|
1161
1238
|
}
|
|
@@ -1187,39 +1264,39 @@ let d = class extends T {
|
|
|
1187
1264
|
</span>
|
|
1188
1265
|
` : "";
|
|
1189
1266
|
}
|
|
1190
|
-
renderPrediction(
|
|
1191
|
-
const
|
|
1267
|
+
renderPrediction(t, e) {
|
|
1268
|
+
const i = {
|
|
1192
1269
|
"dropdown-item": !0,
|
|
1193
1270
|
active: e === this.activeIndex
|
|
1194
1271
|
};
|
|
1195
|
-
let
|
|
1196
|
-
return
|
|
1272
|
+
let r = t.structured_formatting.main_text;
|
|
1273
|
+
return t.short_address && r.includes(t.short_address) && (r = r.replace(t.short_address, "").trim(), r = r.replace(/\s*,\s*,\s*/g, ", ").replace(/^\s*,\s*|\s*,\s*$/g, "").trim()), g`
|
|
1197
1274
|
<div
|
|
1198
|
-
class=${
|
|
1275
|
+
class=${U(i)}
|
|
1199
1276
|
part="dropdown-item ${e === this.activeIndex ? "dropdown-item-active" : ""}"
|
|
1200
|
-
@click=${() => this.handleSelect(
|
|
1277
|
+
@click=${() => this.handleSelect(t)}
|
|
1201
1278
|
role="option"
|
|
1202
1279
|
aria-selected=${e === this.activeIndex}
|
|
1203
1280
|
>
|
|
1204
1281
|
${this.renderLocationIcon()}
|
|
1205
1282
|
<div class="place-info" part="place-info">
|
|
1206
1283
|
<div class="main-text" part="main-text">
|
|
1207
|
-
${
|
|
1284
|
+
${t.short_address ? g`
|
|
1208
1285
|
<span class="national-address-badge" part="national-address-badge">
|
|
1209
1286
|
<img
|
|
1210
1287
|
src="https://cdn.salla.network/images/shipping/png/national-address-icon-small-min.png"
|
|
1211
1288
|
alt="national address icon"
|
|
1212
1289
|
class="national-address-icon"
|
|
1213
1290
|
/>
|
|
1214
|
-
<span class="national-address-text">${
|
|
1291
|
+
<span class="national-address-text">${t.short_address}</span>
|
|
1215
1292
|
<span class="national-address-separator">-</span>
|
|
1216
1293
|
</span>
|
|
1217
1294
|
` : ""}
|
|
1218
|
-
${
|
|
1295
|
+
${r}
|
|
1219
1296
|
</div>
|
|
1220
|
-
${
|
|
1297
|
+
${t.structured_formatting.secondary_text ? g`
|
|
1221
1298
|
<div class="secondary-text" part="secondary-text">
|
|
1222
|
-
${
|
|
1299
|
+
${t.structured_formatting.secondary_text}
|
|
1223
1300
|
</div>
|
|
1224
1301
|
` : ""}
|
|
1225
1302
|
</div>
|
|
@@ -1227,20 +1304,20 @@ let d = class extends T {
|
|
|
1227
1304
|
`;
|
|
1228
1305
|
}
|
|
1229
1306
|
render() {
|
|
1230
|
-
const
|
|
1307
|
+
const t = {
|
|
1231
1308
|
dropdown: !0,
|
|
1232
1309
|
open: this.isOpen
|
|
1233
1310
|
}, e = {
|
|
1234
1311
|
"is-invalid": !!(this.mode === "form" && this.validationError) || this.errors && this.errors.length > 0,
|
|
1235
1312
|
"with-national-icon": this.showNationalAddressIcon
|
|
1236
|
-
},
|
|
1313
|
+
}, i = {
|
|
1237
1314
|
required: this.mode === "form" && this.required
|
|
1238
|
-
},
|
|
1315
|
+
}, r = q(this.language), s = this.dir === "auto" ? Xe(this.language) ? "rtl" : "ltr" : this.dir, o = this.placeholder || r.placeholder, a = this.name || "salla-address-search";
|
|
1239
1316
|
return g`
|
|
1240
|
-
<div class="wrapper ${this.className}" part="wrapper" dir="${
|
|
1317
|
+
<div class="wrapper ${this.className}" part="wrapper" dir="${s}">
|
|
1241
1318
|
<div class="input-container" part="input-container">
|
|
1242
1319
|
${this.label ? g`
|
|
1243
|
-
<label part="label" class=${
|
|
1320
|
+
<label part="label" class=${U(i)}>
|
|
1244
1321
|
<span class="label-content">
|
|
1245
1322
|
<span>${this.label}</span>
|
|
1246
1323
|
${this.renderTooltip()}
|
|
@@ -1250,10 +1327,10 @@ let d = class extends T {
|
|
|
1250
1327
|
<div class="input-wrapper">
|
|
1251
1328
|
<input
|
|
1252
1329
|
part="input"
|
|
1253
|
-
class=${
|
|
1330
|
+
class=${U(e)}
|
|
1254
1331
|
type="text"
|
|
1255
1332
|
name="${a}"
|
|
1256
|
-
.value=${this.inputValue}
|
|
1333
|
+
.value=${Ke(this.inputValue)}
|
|
1257
1334
|
placeholder=${o}
|
|
1258
1335
|
?disabled=${this.disabled}
|
|
1259
1336
|
@input=${this.handleInput}
|
|
@@ -1275,11 +1352,11 @@ let d = class extends T {
|
|
|
1275
1352
|
|
|
1276
1353
|
<div
|
|
1277
1354
|
id="predictions-list"
|
|
1278
|
-
class=${
|
|
1355
|
+
class=${U(t)}
|
|
1279
1356
|
part="dropdown"
|
|
1280
1357
|
role="listbox"
|
|
1281
1358
|
>
|
|
1282
|
-
${this.predictions.length > 0 ? this.predictions.map((n, l) => this.renderPrediction(n, l)) : this.inputValue && !this.isLoading ? g`<div class="no-results" part="no-results">${
|
|
1359
|
+
${this.predictions.length > 0 ? this.predictions.map((n, l) => this.renderPrediction(n, l)) : this.inputValue && !this.isLoading ? g`<div class="no-results" part="no-results">${r.noResults}</div>` : ""}
|
|
1283
1360
|
</div>
|
|
1284
1361
|
</div>
|
|
1285
1362
|
${this.mode === "form" && this.validationError ? g`
|
|
@@ -1298,7 +1375,7 @@ let d = class extends T {
|
|
|
1298
1375
|
}
|
|
1299
1376
|
};
|
|
1300
1377
|
d.formAssociated = !0;
|
|
1301
|
-
d.styles =
|
|
1378
|
+
d.styles = ve`
|
|
1302
1379
|
:host {
|
|
1303
1380
|
display: block;
|
|
1304
1381
|
position: relative;
|
|
@@ -1863,50 +1940,50 @@ h([
|
|
|
1863
1940
|
p({ type: Number })
|
|
1864
1941
|
], d.prototype, "minChars", 2);
|
|
1865
1942
|
h([
|
|
1866
|
-
|
|
1943
|
+
b()
|
|
1867
1944
|
], d.prototype, "predictions", 2);
|
|
1868
1945
|
h([
|
|
1869
|
-
|
|
1946
|
+
b()
|
|
1870
1947
|
], d.prototype, "isOpen", 2);
|
|
1871
1948
|
h([
|
|
1872
|
-
|
|
1949
|
+
b()
|
|
1873
1950
|
], d.prototype, "isLoading", 2);
|
|
1874
1951
|
h([
|
|
1875
|
-
|
|
1952
|
+
b()
|
|
1876
1953
|
], d.prototype, "error", 2);
|
|
1877
1954
|
h([
|
|
1878
|
-
|
|
1955
|
+
b()
|
|
1879
1956
|
], d.prototype, "activeIndex", 2);
|
|
1880
1957
|
h([
|
|
1881
|
-
|
|
1958
|
+
b()
|
|
1882
1959
|
], d.prototype, "inputValue", 2);
|
|
1883
1960
|
h([
|
|
1884
|
-
|
|
1961
|
+
b()
|
|
1885
1962
|
], d.prototype, "sessionToken", 2);
|
|
1886
1963
|
h([
|
|
1887
|
-
|
|
1964
|
+
b()
|
|
1888
1965
|
], d.prototype, "validationError", 2);
|
|
1889
1966
|
h([
|
|
1890
|
-
|
|
1967
|
+
b()
|
|
1891
1968
|
], d.prototype, "touched", 2);
|
|
1892
1969
|
h([
|
|
1893
|
-
|
|
1970
|
+
b()
|
|
1894
1971
|
], d.prototype, "showNationalAddressIcon", 2);
|
|
1895
1972
|
h([
|
|
1896
|
-
|
|
1973
|
+
qe("input")
|
|
1897
1974
|
], d.prototype, "inputElement", 2);
|
|
1898
1975
|
d = h([
|
|
1899
|
-
|
|
1976
|
+
De("salla-address-autocomplete")
|
|
1900
1977
|
], d);
|
|
1901
1978
|
export {
|
|
1902
|
-
|
|
1979
|
+
Ye as ADDRESS_VALIDATION_SUPPORTED_COUNTRIES,
|
|
1903
1980
|
d as SallaAddressAutocomplete,
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1981
|
+
ne as checkValidationSupport,
|
|
1982
|
+
Ge as debounce,
|
|
1983
|
+
Ze as generateSessionToken,
|
|
1984
|
+
Je as getCountryCode,
|
|
1985
|
+
q as getTranslations,
|
|
1986
|
+
Xe as isRTL,
|
|
1987
|
+
ot as parseHighlight,
|
|
1988
|
+
st as throttle
|
|
1912
1989
|
};
|