@mantou/gem 1.7.9 → 1.7.11

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.
Files changed (55) hide show
  1. package/dist/gem.es.js +1790 -2575
  2. package/dist/gem.umd.js +24 -24
  3. package/elements/base/gesture.d.ts +1 -3
  4. package/elements/base/gesture.d.ts.map +1 -1
  5. package/elements/base/gesture.js +9 -4
  6. package/elements/base/gesture.js.map +1 -1
  7. package/elements/base/link.d.ts +2 -0
  8. package/elements/base/link.d.ts.map +1 -1
  9. package/elements/base/link.js +2 -0
  10. package/elements/base/link.js.map +1 -1
  11. package/elements/base/modal-factory.d.ts +20 -20
  12. package/elements/base/reflect.d.ts +5 -0
  13. package/elements/base/reflect.d.ts.map +1 -1
  14. package/elements/base/reflect.js +26 -7
  15. package/elements/base/reflect.js.map +1 -1
  16. package/elements/base/route.d.ts +22 -7
  17. package/elements/base/route.d.ts.map +1 -1
  18. package/elements/base/route.js +53 -25
  19. package/elements/base/route.js.map +1 -1
  20. package/elements/base/title.d.ts +1 -1
  21. package/elements/base/title.js +1 -1
  22. package/elements/base/unsafe.d.ts +1 -2
  23. package/elements/base/unsafe.d.ts.map +1 -1
  24. package/elements/base/unsafe.js +1 -2
  25. package/elements/base/unsafe.js.map +1 -1
  26. package/elements/base/use.d.ts +1 -1
  27. package/elements/base/use.js +1 -1
  28. package/helper/i18n.d.ts +1 -1
  29. package/helper/i18n.d.ts.map +1 -1
  30. package/helper/i18n.js +3 -4
  31. package/helper/i18n.js.map +1 -1
  32. package/lib/store.d.ts +1 -1
  33. package/lib/store.d.ts.map +1 -1
  34. package/lib/store.js +3 -1
  35. package/lib/store.js.map +1 -1
  36. package/lib/utils.d.ts +2 -2
  37. package/lib/utils.d.ts.map +1 -1
  38. package/lib/utils.js +1 -1
  39. package/lib/utils.js.map +1 -1
  40. package/lib/version.d.ts +1 -1
  41. package/lib/version.d.ts.map +1 -1
  42. package/lib/version.js +1 -1
  43. package/lib/version.js.map +1 -1
  44. package/package.json +5 -4
  45. package/src/elements/base/gesture.ts +9 -4
  46. package/src/elements/base/link.ts +2 -0
  47. package/src/elements/base/reflect.ts +18 -6
  48. package/src/elements/base/route.ts +61 -34
  49. package/src/elements/base/title.ts +1 -1
  50. package/src/elements/base/unsafe.ts +1 -2
  51. package/src/elements/base/use.ts +1 -1
  52. package/src/helper/i18n.ts +3 -5
  53. package/src/lib/store.ts +3 -1
  54. package/src/lib/utils.ts +3 -3
  55. package/src/lib/version.ts +1 -1
package/dist/gem.es.js CHANGED
@@ -1,72 +1,59 @@
1
- var __accessCheck = (obj, member, msg) => {
2
- if (!member.has(obj))
3
- throw TypeError("Cannot " + msg);
1
+ var be = (n, t, e) => {
2
+ if (!t.has(n))
3
+ throw TypeError("Cannot " + e);
4
4
  };
5
- var __privateGet = (obj, member, getter) => {
6
- __accessCheck(obj, member, "read from private field");
7
- return getter ? getter.call(obj) : member.get(obj);
8
- };
9
- var __privateAdd = (obj, member, value) => {
10
- if (member.has(obj))
5
+ var g = (n, t, e) => (be(n, t, "read from private field"), e ? e.call(n) : t.get(n)), P = (n, t, e) => {
6
+ if (t.has(n))
11
7
  throw TypeError("Cannot add the same private member more than once");
12
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
- };
14
- var __privateSet = (obj, member, value, setter) => {
15
- __accessCheck(obj, member, "write to private field");
16
- setter ? setter.call(obj, value) : member.set(obj, value);
17
- return value;
18
- };
19
- var __privateMethod = (obj, member, method) => {
20
- __accessCheck(obj, member, "access private method");
21
- return method;
22
- };
23
- var _map, _firstItem, _lastItem, _delete, delete_fn, _stringify, _parse, _routeOptions, routeOptions_get, _hint, hint_get, _onClick, _preventDefault, _getHint, _a, _getContent, _nextSibling, _parentElement, _inertStore, _b, _cacheCurrentKey, cacheCurrentKey_get, _urlParamsLang, urlParamsLang_get, _cacheLang, cacheLang_get, _isMain, isMain_get, _lang, lang_set;
24
- var GemExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8
+ t instanceof WeakSet ? t.add(n) : t.set(n, e);
9
+ }, F = (n, t, e, s) => (be(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e);
10
+ var Ce = (n, t, e) => (be(n, t, "access private method"), e);
11
+ const Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
25
12
  __proto__: null,
26
13
  get GemElement() {
27
- return GemElement;
14
+ return A;
15
+ },
16
+ get SVGTemplateResult() {
17
+ return Gn;
18
+ },
19
+ get TemplateResult() {
20
+ return _e;
28
21
  },
29
22
  get defineAttribute() {
30
- return defineAttribute;
23
+ return nn;
24
+ },
25
+ get defineCSSState() {
26
+ return rn;
31
27
  },
32
28
  get defineProperty() {
33
- return defineProperty;
29
+ return Dt;
34
30
  },
35
31
  get defineRef() {
36
- return defineRef;
32
+ return sn;
37
33
  },
38
- get defineCSSState() {
39
- return defineCSSState;
34
+ get directive() {
35
+ return we;
40
36
  },
41
- get nativeDefineElement() {
42
- return nativeDefineElement;
37
+ get guard() {
38
+ return Ys;
43
39
  },
44
40
  get html() {
45
- return html;
46
- },
47
- get svg() {
48
- return svg;
49
- },
50
- get render() {
51
- return render;
41
+ return G;
52
42
  },
53
- get directive() {
54
- return directive;
43
+ get ifDefined() {
44
+ return Qn;
55
45
  },
56
- get TemplateResult() {
57
- return TemplateResult;
46
+ get nativeDefineElement() {
47
+ return on;
58
48
  },
59
- get SVGTemplateResult() {
60
- return SVGTemplateResult;
49
+ get render() {
50
+ return Kn;
61
51
  },
62
52
  get repeat() {
63
- return repeat;
64
- },
65
- get guard() {
66
- return guard;
53
+ return Js;
67
54
  },
68
- get ifDefined() {
69
- return ifDefined;
55
+ get svg() {
56
+ return Vs;
70
57
  }
71
58
  }, Symbol.toStringTag, { value: "Module" }));
72
59
  /**
@@ -82,15 +69,10 @@ var GemExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
82
69
  * subject to an additional IP rights grant found at
83
70
  * http://polymer.github.io/PATENTS.txt
84
71
  */
85
- const directives = /* @__PURE__ */ new WeakMap();
86
- const directive = (f) => (...args) => {
87
- const d = f(...args);
88
- directives.set(d, true);
89
- return d;
90
- };
91
- const isDirective = (o) => {
92
- return typeof o === "function" && directives.has(o);
93
- };
72
+ const Dn = /* @__PURE__ */ new WeakMap(), we = (n) => (...t) => {
73
+ const e = n(...t);
74
+ return Dn.set(e, !0), e;
75
+ }, Wt = (n) => typeof n == "function" && Dn.has(n);
94
76
  /**
95
77
  * @license
96
78
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -104,19 +86,15 @@ const isDirective = (o) => {
104
86
  * subject to an additional IP rights grant found at
105
87
  * http://polymer.github.io/PATENTS.txt
106
88
  */
107
- const isCEPolyfill = typeof window !== "undefined" && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== void 0;
108
- const reparentNodes = (container, start, end = null, before = null) => {
109
- while (start !== end) {
110
- const n = start.nextSibling;
111
- container.insertBefore(start, before);
112
- start = n;
89
+ const wn = typeof window < "u" && window.customElements != null && window.customElements.polyfillWrapFlushCallback !== void 0, qn = (n, t, e = null, s = null) => {
90
+ for (; t !== e; ) {
91
+ const i = t.nextSibling;
92
+ n.insertBefore(t, s), t = i;
113
93
  }
114
- };
115
- const removeNodes = (container, start, end = null) => {
116
- while (start !== end) {
117
- const n = start.nextSibling;
118
- container.removeChild(start);
119
- start = n;
94
+ }, Ye = (n, t, e = null) => {
95
+ for (; t !== e; ) {
96
+ const s = t.nextSibling;
97
+ n.removeChild(t), t = s;
120
98
  }
121
99
  };
122
100
  /**
@@ -132,8 +110,7 @@ const removeNodes = (container, start, end = null) => {
132
110
  * subject to an additional IP rights grant found at
133
111
  * http://polymer.github.io/PATENTS.txt
134
112
  */
135
- const noChange = {};
136
- const nothing = {};
113
+ const V = {}, _n = {};
137
114
  /**
138
115
  * @license
139
116
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -147,119 +124,70 @@ const nothing = {};
147
124
  * subject to an additional IP rights grant found at
148
125
  * http://polymer.github.io/PATENTS.txt
149
126
  */
150
- const marker = `{{lit-${String(Math.random()).slice(2)}}}`;
151
- const nodeMarker = `<!--${marker}-->`;
152
- const markerRegex = new RegExp(`${marker}|${nodeMarker}`);
153
- const boundAttributeSuffix = "$lit$";
154
- class Template {
155
- constructor(result, element) {
156
- this.parts = [];
157
- this.element = element;
158
- const nodesToRemove = [];
159
- const stack = [];
160
- const walker = document.createTreeWalker(element.content, 133, null, false);
161
- let lastPartIndex = 0;
162
- let index = -1;
163
- let partIndex = 0;
164
- const { strings, values: { length } } = result;
165
- while (partIndex < length) {
166
- const node = walker.nextNode();
167
- if (node === null) {
168
- walker.currentNode = stack.pop();
127
+ const et = `{{lit-${String(Math.random()).slice(2)}}}`, Un = `<!--${et}-->`, vn = new RegExp(`${et}|${Un}`), bt = "$lit$";
128
+ class ks {
129
+ constructor(t, e) {
130
+ this.parts = [], this.element = e;
131
+ const s = [], i = [], r = document.createTreeWalker(e.content, 133, null, !1);
132
+ let o = 0, a = -1, c = 0;
133
+ const { strings: h, values: { length: p } } = t;
134
+ for (; c < p; ) {
135
+ const u = r.nextNode();
136
+ if (u === null) {
137
+ r.currentNode = i.pop();
169
138
  continue;
170
139
  }
171
- index++;
172
- if (node.nodeType === 1) {
173
- if (node.hasAttributes()) {
174
- const attributes = node.attributes;
175
- const { length: length2 } = attributes;
176
- let count = 0;
177
- for (let i = 0; i < length2; i++) {
178
- if (endsWith(attributes[i].name, boundAttributeSuffix)) {
179
- count++;
180
- }
140
+ if (a++, u.nodeType === 1) {
141
+ if (u.hasAttributes()) {
142
+ const S = u.attributes, { length: d } = S;
143
+ let m = 0;
144
+ for (let f = 0; f < d; f++)
145
+ Sn(S[f].name, bt) && m++;
146
+ for (; m-- > 0; ) {
147
+ const f = h[c], _ = Re.exec(f)[2], v = _.toLowerCase() + bt, H = u.getAttribute(v);
148
+ u.removeAttribute(v);
149
+ const M = H.split(vn);
150
+ this.parts.push({ type: "attribute", index: a, name: _, strings: M }), c += M.length - 1;
181
151
  }
182
- while (count-- > 0) {
183
- const stringForPart = strings[partIndex];
184
- const name = lastAttributeNameRegex.exec(stringForPart)[2];
185
- const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;
186
- const attributeValue = node.getAttribute(attributeLookupName);
187
- node.removeAttribute(attributeLookupName);
188
- const statics = attributeValue.split(markerRegex);
189
- this.parts.push({ type: "attribute", index, name, strings: statics });
190
- partIndex += statics.length - 1;
191
- }
192
- }
193
- if (node.tagName === "TEMPLATE") {
194
- stack.push(node);
195
- walker.currentNode = node.content;
196
152
  }
197
- } else if (node.nodeType === 3) {
198
- const data = node.data;
199
- if (data.indexOf(marker) >= 0) {
200
- const parent = node.parentNode;
201
- const strings2 = data.split(markerRegex);
202
- const lastIndex = strings2.length - 1;
203
- for (let i = 0; i < lastIndex; i++) {
204
- let insert;
205
- let s = strings2[i];
206
- if (s === "") {
207
- insert = createMarker();
208
- } else {
209
- const match2 = lastAttributeNameRegex.exec(s);
210
- if (match2 !== null && endsWith(match2[2], boundAttributeSuffix)) {
211
- s = s.slice(0, match2.index) + match2[1] + match2[2].slice(0, -boundAttributeSuffix.length) + match2[3];
212
- }
213
- insert = document.createTextNode(s);
153
+ u.tagName === "TEMPLATE" && (i.push(u), r.currentNode = u.content);
154
+ } else if (u.nodeType === 3) {
155
+ const S = u.data;
156
+ if (S.indexOf(et) >= 0) {
157
+ const d = u.parentNode, m = S.split(vn), f = m.length - 1;
158
+ for (let _ = 0; _ < f; _++) {
159
+ let v, H = m[_];
160
+ if (H === "")
161
+ v = U();
162
+ else {
163
+ const M = Re.exec(H);
164
+ M !== null && Sn(M[2], bt) && (H = H.slice(0, M.index) + M[1] + M[2].slice(0, -bt.length) + M[3]), v = document.createTextNode(H);
214
165
  }
215
- parent.insertBefore(insert, node);
216
- this.parts.push({ type: "node", index: ++index });
166
+ d.insertBefore(v, u), this.parts.push({ type: "node", index: ++a });
217
167
  }
218
- if (strings2[lastIndex] === "") {
219
- parent.insertBefore(createMarker(), node);
220
- nodesToRemove.push(node);
221
- } else {
222
- node.data = strings2[lastIndex];
223
- }
224
- partIndex += lastIndex;
168
+ m[f] === "" ? (d.insertBefore(U(), u), s.push(u)) : u.data = m[f], c += f;
225
169
  }
226
- } else if (node.nodeType === 8) {
227
- if (node.data === marker) {
228
- const parent = node.parentNode;
229
- if (node.previousSibling === null || index === lastPartIndex) {
230
- index++;
231
- parent.insertBefore(createMarker(), node);
232
- }
233
- lastPartIndex = index;
234
- this.parts.push({ type: "node", index });
235
- if (node.nextSibling === null) {
236
- node.data = "";
237
- } else {
238
- nodesToRemove.push(node);
239
- index--;
240
- }
241
- partIndex++;
170
+ } else if (u.nodeType === 8)
171
+ if (u.data === et) {
172
+ const S = u.parentNode;
173
+ (u.previousSibling === null || a === o) && (a++, S.insertBefore(U(), u)), o = a, this.parts.push({ type: "node", index: a }), u.nextSibling === null ? u.data = "" : (s.push(u), a--), c++;
242
174
  } else {
243
- let i = -1;
244
- while ((i = node.data.indexOf(marker, i + 1)) !== -1) {
245
- this.parts.push({ type: "node", index: -1 });
246
- partIndex++;
247
- }
175
+ let S = -1;
176
+ for (; (S = u.data.indexOf(et, S + 1)) !== -1; )
177
+ this.parts.push({ type: "node", index: -1 }), c++;
248
178
  }
249
- }
250
- }
251
- for (const n of nodesToRemove) {
252
- n.parentNode.removeChild(n);
253
179
  }
180
+ for (const u of s)
181
+ u.parentNode.removeChild(u);
254
182
  }
255
183
  }
256
- const endsWith = (str, suffix) => {
257
- const index = str.length - suffix.length;
258
- return index >= 0 && str.slice(index) === suffix;
259
- };
260
- const isTemplatePartActive = (part2) => part2.index !== -1;
261
- const createMarker = () => document.createComment("");
262
- const lastAttributeNameRegex = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
184
+ const Sn = (n, t) => {
185
+ const e = n.length - t.length;
186
+ return e >= 0 && n.slice(e) === t;
187
+ }, Ls = (n) => n.index !== -1, U = () => document.createComment(""), Re = (
188
+ // eslint-disable-next-line no-control-regex
189
+ /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/
190
+ );
263
191
  /**
264
192
  * @license
265
193
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -273,68 +201,35 @@ const lastAttributeNameRegex = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+
273
201
  * subject to an additional IP rights grant found at
274
202
  * http://polymer.github.io/PATENTS.txt
275
203
  */
276
- class TemplateInstance {
277
- constructor(template, processor, options) {
278
- this.__parts = [];
279
- this.template = template;
280
- this.processor = processor;
281
- this.options = options;
282
- }
283
- update(values) {
284
- let i = 0;
285
- for (const part2 of this.__parts) {
286
- if (part2 !== void 0) {
287
- part2.setValue(values[i]);
288
- }
289
- i++;
290
- }
291
- for (const part2 of this.__parts) {
292
- if (part2 !== void 0) {
293
- part2.commit();
294
- }
295
- }
204
+ class En {
205
+ constructor(t, e, s) {
206
+ this.__parts = [], this.template = t, this.processor = e, this.options = s;
207
+ }
208
+ update(t) {
209
+ let e = 0;
210
+ for (const s of this.__parts)
211
+ s !== void 0 && s.setValue(t[e]), e++;
212
+ for (const s of this.__parts)
213
+ s !== void 0 && s.commit();
296
214
  }
297
215
  _clone() {
298
- const fragment = isCEPolyfill ? this.template.element.content.cloneNode(true) : document.importNode(this.template.element.content, true);
299
- const stack = [];
300
- const parts2 = this.template.parts;
301
- const walker = document.createTreeWalker(fragment, 133, null, false);
302
- let partIndex = 0;
303
- let nodeIndex = 0;
304
- let part2;
305
- let node = walker.nextNode();
306
- while (partIndex < parts2.length) {
307
- part2 = parts2[partIndex];
308
- if (!isTemplatePartActive(part2)) {
309
- this.__parts.push(void 0);
310
- partIndex++;
216
+ const t = wn ? this.template.element.content.cloneNode(!0) : document.importNode(this.template.element.content, !0), e = [], s = this.template.parts, i = document.createTreeWalker(t, 133, null, !1);
217
+ let r = 0, o = 0, a, c = i.nextNode();
218
+ for (; r < s.length; ) {
219
+ if (a = s[r], !Ls(a)) {
220
+ this.__parts.push(void 0), r++;
311
221
  continue;
312
222
  }
313
- while (nodeIndex < part2.index) {
314
- nodeIndex++;
315
- if (node.nodeName === "TEMPLATE") {
316
- stack.push(node);
317
- walker.currentNode = node.content;
318
- }
319
- if ((node = walker.nextNode()) === null) {
320
- walker.currentNode = stack.pop();
321
- node = walker.nextNode();
322
- }
323
- }
324
- if (part2.type === "node") {
325
- const part3 = this.processor.handleTextExpression(this.options);
326
- part3.insertAfterNode(node.previousSibling);
327
- this.__parts.push(part3);
328
- } else {
329
- this.__parts.push(...this.processor.handleAttributeExpressions(node, part2.name, part2.strings, this.options));
330
- }
331
- partIndex++;
332
- }
333
- if (isCEPolyfill) {
334
- document.adoptNode(fragment);
335
- customElements.upgrade(fragment);
223
+ for (; o < a.index; )
224
+ o++, c.nodeName === "TEMPLATE" && (e.push(c), i.currentNode = c.content), (c = i.nextNode()) === null && (i.currentNode = e.pop(), c = i.nextNode());
225
+ if (a.type === "node") {
226
+ const h = this.processor.handleTextExpression(this.options);
227
+ h.insertAfterNode(c.previousSibling), this.__parts.push(h);
228
+ } else
229
+ this.__parts.push(...this.processor.handleAttributeExpressions(c, a.name, a.strings, this.options));
230
+ r++;
336
231
  }
337
- return fragment;
232
+ return wn && (document.adoptNode(t), customElements.upgrade(t)), t;
338
233
  }
339
234
  }
340
235
  /**
@@ -350,54 +245,38 @@ class TemplateInstance {
350
245
  * subject to an additional IP rights grant found at
351
246
  * http://polymer.github.io/PATENTS.txt
352
247
  */
353
- const policy = window.trustedTypes && trustedTypes.createPolicy("lit-html", { createHTML: (s) => s });
354
- const commentMarker = ` ${marker} `;
355
- class TemplateResult {
356
- constructor(strings, values, type, processor) {
357
- this.strings = strings;
358
- this.values = values;
359
- this.type = type;
360
- this.processor = processor;
361
- }
248
+ const xn = window.trustedTypes && trustedTypes.createPolicy("lit-html", { createHTML: (n) => n }), Ns = ` ${et} `;
249
+ class _e {
250
+ constructor(t, e, s, i) {
251
+ this.strings = t, this.values = e, this.type = s, this.processor = i;
252
+ }
253
+ /**
254
+ * Returns a string of HTML used to create a `<template>` element.
255
+ */
362
256
  getHTML() {
363
- const l = this.strings.length - 1;
364
- let html2 = "";
365
- let isCommentBinding = false;
366
- for (let i = 0; i < l; i++) {
367
- const s = this.strings[i];
368
- const commentOpen = s.lastIndexOf("<!--");
369
- isCommentBinding = (commentOpen > -1 || isCommentBinding) && s.indexOf("-->", commentOpen + 1) === -1;
370
- const attributeMatch = lastAttributeNameRegex.exec(s);
371
- if (attributeMatch === null) {
372
- html2 += s + (isCommentBinding ? commentMarker : nodeMarker);
373
- } else {
374
- html2 += s.substr(0, attributeMatch.index) + attributeMatch[1] + attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] + marker;
375
- }
257
+ const t = this.strings.length - 1;
258
+ let e = "", s = !1;
259
+ for (let i = 0; i < t; i++) {
260
+ const r = this.strings[i], o = r.lastIndexOf("<!--");
261
+ s = (o > -1 || s) && r.indexOf("-->", o + 1) === -1;
262
+ const a = Re.exec(r);
263
+ a === null ? e += r + (s ? Ns : Un) : e += r.substr(0, a.index) + a[1] + a[2] + bt + a[3] + et;
376
264
  }
377
- html2 += this.strings[l];
378
- return html2;
265
+ return e += this.strings[t], e;
379
266
  }
380
267
  getTemplateElement() {
381
- const template = document.createElement("template");
382
- let value = this.getHTML();
383
- if (policy !== void 0) {
384
- value = policy.createHTML(value);
385
- }
386
- template.innerHTML = value;
387
- return template;
268
+ const t = document.createElement("template");
269
+ let e = this.getHTML();
270
+ return xn !== void 0 && (e = xn.createHTML(e)), t.innerHTML = e, t;
388
271
  }
389
272
  }
390
- class SVGTemplateResult extends TemplateResult {
273
+ class Gn extends _e {
391
274
  getHTML() {
392
275
  return `<svg>${super.getHTML()}</svg>`;
393
276
  }
394
277
  getTemplateElement() {
395
- const template = super.getTemplateElement();
396
- const content = template.content;
397
- const svgElement = content.firstChild;
398
- content.removeChild(svgElement);
399
- reparentNodes(content, svgElement.firstChild);
400
- return template;
278
+ const t = super.getTemplateElement(), e = t.content, s = e.firstChild;
279
+ return e.removeChild(s), qn(e, s.firstChild), t;
401
280
  }
402
281
  }
403
282
  /**
@@ -413,327 +292,217 @@ class SVGTemplateResult extends TemplateResult {
413
292
  * subject to an additional IP rights grant found at
414
293
  * http://polymer.github.io/PATENTS.txt
415
294
  */
416
- const isPrimitive = (value) => {
417
- return value === null || !(typeof value === "object" || typeof value === "function");
418
- };
419
- const isIterable = (value) => {
420
- return Array.isArray(value) || !!(value && value[Symbol.iterator]);
421
- };
422
- class AttributeCommitter {
423
- constructor(element, name, strings) {
424
- this.dirty = true;
425
- this.element = element;
426
- this.name = name;
427
- this.strings = strings;
428
- this.parts = [];
429
- for (let i = 0; i < strings.length - 1; i++) {
295
+ const Qe = (n) => n === null || !(typeof n == "object" || typeof n == "function"), Ae = (n) => Array.isArray(n) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
+ !!(n && n[Symbol.iterator]);
297
+ class jn {
298
+ constructor(t, e, s) {
299
+ this.dirty = !0, this.element = t, this.name = e, this.strings = s, this.parts = [];
300
+ for (let i = 0; i < s.length - 1; i++)
430
301
  this.parts[i] = this._createPart();
431
- }
432
302
  }
303
+ /**
304
+ * Creates a single part. Override this to create a differnt type of part.
305
+ */
433
306
  _createPart() {
434
- return new AttributePart(this);
307
+ return new Xe(this);
435
308
  }
436
309
  _getValue() {
437
- const strings = this.strings;
438
- const l = strings.length - 1;
439
- const parts2 = this.parts;
440
- if (l === 1 && strings[0] === "" && strings[1] === "") {
441
- const v = parts2[0].value;
442
- if (typeof v === "symbol") {
443
- return String(v);
444
- }
445
- if (typeof v === "string" || !isIterable(v)) {
446
- return v;
447
- }
448
- }
449
- let text = "";
450
- for (let i = 0; i < l; i++) {
451
- text += strings[i];
452
- const part2 = parts2[i];
453
- if (part2 !== void 0) {
454
- const v = part2.value;
455
- if (isPrimitive(v) || !isIterable(v)) {
456
- text += typeof v === "string" ? v : String(v);
457
- } else {
458
- for (const t of v) {
459
- text += typeof t === "string" ? t : String(t);
460
- }
461
- }
310
+ const t = this.strings, e = t.length - 1, s = this.parts;
311
+ if (e === 1 && t[0] === "" && t[1] === "") {
312
+ const r = s[0].value;
313
+ if (typeof r == "symbol")
314
+ return String(r);
315
+ if (typeof r == "string" || !Ae(r))
316
+ return r;
317
+ }
318
+ let i = "";
319
+ for (let r = 0; r < e; r++) {
320
+ i += t[r];
321
+ const o = s[r];
322
+ if (o !== void 0) {
323
+ const a = o.value;
324
+ if (Qe(a) || !Ae(a))
325
+ i += typeof a == "string" ? a : String(a);
326
+ else
327
+ for (const c of a)
328
+ i += typeof c == "string" ? c : String(c);
462
329
  }
463
330
  }
464
- text += strings[l];
465
- return text;
331
+ return i += t[e], i;
466
332
  }
467
333
  commit() {
468
- if (this.dirty) {
469
- this.dirty = false;
470
- this.element.setAttribute(this.name, this._getValue());
471
- }
334
+ this.dirty && (this.dirty = !1, this.element.setAttribute(this.name, this._getValue()));
472
335
  }
473
336
  }
474
- class AttributePart {
475
- constructor(committer) {
476
- this.value = void 0;
477
- this.committer = committer;
337
+ class Xe {
338
+ constructor(t) {
339
+ this.value = void 0, this.committer = t;
478
340
  }
479
- setValue(value) {
480
- if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {
481
- this.value = value;
482
- if (!isDirective(value)) {
483
- this.committer.dirty = true;
484
- }
485
- }
341
+ setValue(t) {
342
+ t !== V && (!Qe(t) || t !== this.value) && (this.value = t, Wt(t) || (this.committer.dirty = !0));
486
343
  }
487
344
  commit() {
488
- while (isDirective(this.value)) {
489
- const directive2 = this.value;
490
- this.value = noChange;
491
- directive2(this);
492
- }
493
- if (this.value === noChange) {
494
- return;
495
- }
496
- this.committer.commit();
497
- }
498
- }
499
- class NodePart {
500
- constructor(options) {
501
- this.value = void 0;
502
- this.__pendingValue = void 0;
503
- this.options = options;
504
- }
505
- appendInto(container) {
506
- this.startNode = container.appendChild(createMarker());
507
- this.endNode = container.appendChild(createMarker());
508
- }
509
- insertAfterNode(ref) {
510
- this.startNode = ref;
511
- this.endNode = ref.nextSibling;
512
- }
513
- appendIntoPart(part2) {
514
- part2.__insert(this.startNode = createMarker());
515
- part2.__insert(this.endNode = createMarker());
516
- }
517
- insertAfterPart(ref) {
518
- ref.__insert(this.startNode = createMarker());
519
- this.endNode = ref.endNode;
520
- ref.endNode = this.startNode;
521
- }
522
- setValue(value) {
523
- this.__pendingValue = value;
345
+ for (; Wt(this.value); ) {
346
+ const t = this.value;
347
+ this.value = V, t(this);
348
+ }
349
+ this.value !== V && this.committer.commit();
350
+ }
351
+ }
352
+ class wt {
353
+ constructor(t) {
354
+ this.value = void 0, this.__pendingValue = void 0, this.options = t;
355
+ }
356
+ /**
357
+ * Appends this part into a container.
358
+ *
359
+ * This part must be empty, as its contents are not automatically moved.
360
+ */
361
+ appendInto(t) {
362
+ this.startNode = t.appendChild(U()), this.endNode = t.appendChild(U());
363
+ }
364
+ /**
365
+ * Inserts this part after the `ref` node (between `ref` and `ref`'s next
366
+ * sibling). Both `ref` and its next sibling must be static, unchanging nodes
367
+ * such as those that appear in a literal section of a template.
368
+ *
369
+ * This part must be empty, as its contents are not automatically moved.
370
+ */
371
+ insertAfterNode(t) {
372
+ this.startNode = t, this.endNode = t.nextSibling;
373
+ }
374
+ /**
375
+ * Appends this part into a parent part.
376
+ *
377
+ * This part must be empty, as its contents are not automatically moved.
378
+ */
379
+ appendIntoPart(t) {
380
+ t.__insert(this.startNode = U()), t.__insert(this.endNode = U());
381
+ }
382
+ /**
383
+ * Inserts this part after the `ref` part.
384
+ *
385
+ * This part must be empty, as its contents are not automatically moved.
386
+ */
387
+ insertAfterPart(t) {
388
+ t.__insert(this.startNode = U()), this.endNode = t.endNode, t.endNode = this.startNode;
389
+ }
390
+ setValue(t) {
391
+ this.__pendingValue = t;
524
392
  }
525
393
  commit() {
526
- if (this.startNode.parentNode === null) {
527
- return;
528
- }
529
- while (isDirective(this.__pendingValue)) {
530
- const directive2 = this.__pendingValue;
531
- this.__pendingValue = noChange;
532
- directive2(this);
533
- }
534
- const value = this.__pendingValue;
535
- if (value === noChange) {
394
+ if (this.startNode.parentNode === null)
536
395
  return;
396
+ for (; Wt(this.__pendingValue); ) {
397
+ const e = this.__pendingValue;
398
+ this.__pendingValue = V, e(this);
537
399
  }
538
- if (isPrimitive(value)) {
539
- if (value !== this.value) {
540
- this.__commitText(value);
541
- }
542
- } else if (value instanceof TemplateResult) {
543
- this.__commitTemplateResult(value);
544
- } else if (value instanceof Node) {
545
- this.__commitNode(value);
546
- } else if (isIterable(value)) {
547
- this.__commitIterable(value);
548
- } else if (value === nothing) {
549
- this.value = nothing;
550
- this.clear();
551
- } else {
552
- this.__commitText(value);
553
- }
400
+ const t = this.__pendingValue;
401
+ t !== V && (Qe(t) ? t !== this.value && this.__commitText(t) : t instanceof _e ? this.__commitTemplateResult(t) : t instanceof Node ? this.__commitNode(t) : Ae(t) ? this.__commitIterable(t) : t === _n ? (this.value = _n, this.clear()) : this.__commitText(t));
554
402
  }
555
- __insert(node) {
556
- this.endNode.parentNode.insertBefore(node, this.endNode);
403
+ __insert(t) {
404
+ this.endNode.parentNode.insertBefore(t, this.endNode);
557
405
  }
558
- __commitNode(value) {
559
- if (this.value === value) {
560
- return;
561
- }
562
- this.clear();
563
- this.__insert(value);
564
- this.value = value;
565
- }
566
- __commitText(value) {
567
- const node = this.startNode.nextSibling;
568
- value = value == null ? "" : value;
569
- const valueAsString = typeof value === "string" ? value : String(value);
570
- if (node === this.endNode.previousSibling && node.nodeType === 3) {
571
- node.data = valueAsString;
572
- } else {
573
- this.__commitNode(document.createTextNode(valueAsString));
574
- }
575
- this.value = value;
406
+ __commitNode(t) {
407
+ this.value !== t && (this.clear(), this.__insert(t), this.value = t);
576
408
  }
577
- __commitTemplateResult(value) {
578
- const template = this.options.templateFactory(value);
579
- if (this.value instanceof TemplateInstance && this.value.template === template) {
580
- this.value.update(value.values);
581
- } else {
582
- const instance = new TemplateInstance(template, value.processor, this.options);
583
- const fragment = instance._clone();
584
- instance.update(value.values);
585
- this.__commitNode(fragment);
586
- this.value = instance;
587
- }
409
+ __commitText(t) {
410
+ const e = this.startNode.nextSibling;
411
+ t = t ?? "";
412
+ const s = typeof t == "string" ? t : String(t);
413
+ e === this.endNode.previousSibling && e.nodeType === 3 ? e.data = s : this.__commitNode(document.createTextNode(s)), this.value = t;
588
414
  }
589
- __commitIterable(value) {
590
- if (!Array.isArray(this.value)) {
591
- this.value = [];
592
- this.clear();
593
- }
594
- const itemParts = this.value;
595
- let partIndex = 0;
596
- let itemPart;
597
- for (const item of value) {
598
- itemPart = itemParts[partIndex];
599
- if (itemPart === void 0) {
600
- itemPart = new NodePart(this.options);
601
- itemParts.push(itemPart);
602
- if (partIndex === 0) {
603
- itemPart.appendIntoPart(this);
604
- } else {
605
- itemPart.insertAfterPart(itemParts[partIndex - 1]);
606
- }
607
- }
608
- itemPart.setValue(item);
609
- itemPart.commit();
610
- partIndex++;
611
- }
612
- if (partIndex < itemParts.length) {
613
- itemParts.length = partIndex;
614
- this.clear(itemPart && itemPart.endNode);
415
+ __commitTemplateResult(t) {
416
+ const e = this.options.templateFactory(t);
417
+ if (this.value instanceof En && this.value.template === e)
418
+ this.value.update(t.values);
419
+ else {
420
+ const s = new En(e, t.processor, this.options), i = s._clone();
421
+ s.update(t.values), this.__commitNode(i), this.value = s;
615
422
  }
616
423
  }
617
- clear(startNode = this.startNode) {
618
- removeNodes(this.startNode.parentNode, startNode.nextSibling, this.endNode);
424
+ __commitIterable(t) {
425
+ Array.isArray(this.value) || (this.value = [], this.clear());
426
+ const e = this.value;
427
+ let s = 0, i;
428
+ for (const r of t)
429
+ i = e[s], i === void 0 && (i = new wt(this.options), e.push(i), s === 0 ? i.appendIntoPart(this) : i.insertAfterPart(e[s - 1])), i.setValue(r), i.commit(), s++;
430
+ s < e.length && (e.length = s, this.clear(i && i.endNode));
431
+ }
432
+ clear(t = this.startNode) {
433
+ Ye(this.startNode.parentNode, t.nextSibling, this.endNode);
619
434
  }
620
435
  }
621
- class BooleanAttributePart {
622
- constructor(element, name, strings) {
623
- this.value = void 0;
624
- this.__pendingValue = void 0;
625
- if (strings.length !== 2 || strings[0] !== "" || strings[1] !== "") {
436
+ class Ms {
437
+ constructor(t, e, s) {
438
+ if (this.value = void 0, this.__pendingValue = void 0, s.length !== 2 || s[0] !== "" || s[1] !== "")
626
439
  throw new Error("Boolean attributes can only contain a single expression");
627
- }
628
- this.element = element;
629
- this.name = name;
630
- this.strings = strings;
440
+ this.element = t, this.name = e, this.strings = s;
631
441
  }
632
- setValue(value) {
633
- this.__pendingValue = value;
442
+ setValue(t) {
443
+ this.__pendingValue = t;
634
444
  }
635
445
  commit() {
636
- while (isDirective(this.__pendingValue)) {
637
- const directive2 = this.__pendingValue;
638
- this.__pendingValue = noChange;
639
- directive2(this);
446
+ for (; Wt(this.__pendingValue); ) {
447
+ const e = this.__pendingValue;
448
+ this.__pendingValue = V, e(this);
640
449
  }
641
- if (this.__pendingValue === noChange) {
450
+ if (this.__pendingValue === V)
642
451
  return;
643
- }
644
- const value = !!this.__pendingValue;
645
- if (this.value !== value) {
646
- if (value) {
647
- this.element.setAttribute(this.name, "");
648
- } else {
649
- this.element.removeAttribute(this.name);
650
- }
651
- this.value = value;
652
- }
653
- this.__pendingValue = noChange;
452
+ const t = !!this.__pendingValue;
453
+ this.value !== t && (t ? this.element.setAttribute(this.name, "") : this.element.removeAttribute(this.name), this.value = t), this.__pendingValue = V;
654
454
  }
655
455
  }
656
- class PropertyCommitter extends AttributeCommitter {
657
- constructor(element, name, strings) {
658
- super(element, name, strings);
659
- this.single = strings.length === 2 && strings[0] === "" && strings[1] === "";
456
+ class Os extends jn {
457
+ constructor(t, e, s) {
458
+ super(t, e, s), this.single = s.length === 2 && s[0] === "" && s[1] === "";
660
459
  }
661
460
  _createPart() {
662
- return new PropertyPart(this);
461
+ return new Rs(this);
663
462
  }
664
463
  _getValue() {
665
- if (this.single) {
666
- return this.parts[0].value;
667
- }
668
- return super._getValue();
464
+ return this.single ? this.parts[0].value : super._getValue();
669
465
  }
670
466
  commit() {
671
- if (this.dirty) {
672
- this.dirty = false;
673
- this.element[this.name] = this._getValue();
674
- }
467
+ this.dirty && (this.dirty = !1, this.element[this.name] = this._getValue());
675
468
  }
676
469
  }
677
- class PropertyPart extends AttributePart {
470
+ class Rs extends Xe {
678
471
  }
679
- let eventOptionsSupported = false;
472
+ let Fn = !1;
680
473
  (() => {
681
474
  try {
682
- const options = {
475
+ const n = {
683
476
  get capture() {
684
- eventOptionsSupported = true;
685
- return false;
477
+ return Fn = !0, !1;
686
478
  }
687
479
  };
688
- window.addEventListener("test", options, options);
689
- window.removeEventListener("test", options, options);
690
- } catch (_e) {
480
+ window.addEventListener("test", n, n), window.removeEventListener("test", n, n);
481
+ } catch {
691
482
  }
692
483
  })();
693
- class EventPart {
694
- constructor(element, eventName, eventContext) {
695
- this.value = void 0;
696
- this.__pendingValue = void 0;
697
- this.element = element;
698
- this.eventName = eventName;
699
- this.eventContext = eventContext;
700
- this.__boundHandleEvent = (e) => this.handleEvent(e);
701
- }
702
- setValue(value) {
703
- this.__pendingValue = value;
484
+ class As {
485
+ constructor(t, e, s) {
486
+ this.value = void 0, this.__pendingValue = void 0, this.element = t, this.eventName = e, this.eventContext = s, this.__boundHandleEvent = (i) => this.handleEvent(i);
487
+ }
488
+ setValue(t) {
489
+ this.__pendingValue = t;
704
490
  }
705
491
  commit() {
706
- while (isDirective(this.__pendingValue)) {
707
- const directive2 = this.__pendingValue;
708
- this.__pendingValue = noChange;
709
- directive2(this);
492
+ for (; Wt(this.__pendingValue); ) {
493
+ const r = this.__pendingValue;
494
+ this.__pendingValue = V, r(this);
710
495
  }
711
- if (this.__pendingValue === noChange) {
496
+ if (this.__pendingValue === V)
712
497
  return;
713
- }
714
- const newListener = this.__pendingValue;
715
- const oldListener = this.value;
716
- const shouldRemoveListener = newListener == null || oldListener != null && (newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive);
717
- const shouldAddListener = newListener != null && (oldListener == null || shouldRemoveListener);
718
- if (shouldRemoveListener) {
719
- this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options);
720
- }
721
- if (shouldAddListener) {
722
- this.__options = getOptions(newListener);
723
- this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options);
724
- }
725
- this.value = newListener;
726
- this.__pendingValue = noChange;
498
+ const t = this.__pendingValue, e = this.value, s = t == null || e != null && (t.capture !== e.capture || t.once !== e.once || t.passive !== e.passive), i = t != null && (e == null || s);
499
+ s && this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options), i && (this.__options = Hs(t), this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options)), this.value = t, this.__pendingValue = V;
727
500
  }
728
- handleEvent(event) {
729
- if (typeof this.value === "function") {
730
- this.value.call(this.eventContext || this.element, event);
731
- } else {
732
- this.value.handleEvent(event);
733
- }
501
+ handleEvent(t) {
502
+ typeof this.value == "function" ? this.value.call(this.eventContext || this.element, t) : this.value.handleEvent(t);
734
503
  }
735
504
  }
736
- const getOptions = (o) => o && (eventOptionsSupported ? { capture: o.capture, passive: o.passive, once: o.once } : o.capture);
505
+ const Hs = (n) => n && (Fn ? { capture: n.capture, passive: n.passive, once: n.once } : n.capture);
737
506
  /**
738
507
  * @license
739
508
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -747,27 +516,29 @@ const getOptions = (o) => o && (eventOptionsSupported ? { capture: o.capture, pa
747
516
  * subject to an additional IP rights grant found at
748
517
  * http://polymer.github.io/PATENTS.txt
749
518
  */
750
- class DefaultTemplateProcessor {
751
- handleAttributeExpressions(element, name, strings, options) {
752
- const prefix = name[0];
753
- if (prefix === ".") {
754
- const committer2 = new PropertyCommitter(element, name.slice(1), strings);
755
- return committer2.parts;
756
- }
757
- if (prefix === "@") {
758
- return [new EventPart(element, name.slice(1), options.eventContext)];
759
- }
760
- if (prefix === "?") {
761
- return [new BooleanAttributePart(element, name.slice(1), strings)];
762
- }
763
- const committer = new AttributeCommitter(element, name, strings);
764
- return committer.parts;
765
- }
766
- handleTextExpression(options) {
767
- return new NodePart(options);
768
- }
769
- }
770
- const defaultTemplateProcessor = new DefaultTemplateProcessor();
519
+ class Ws {
520
+ /**
521
+ * Create parts for an attribute-position binding, given the event, attribute
522
+ * name, and string literals.
523
+ *
524
+ * @param element The element containing the binding
525
+ * @param name The attribute name
526
+ * @param strings The string literals. There are always at least two strings,
527
+ * event for fully-controlled bindings with a single expression.
528
+ */
529
+ handleAttributeExpressions(t, e, s, i) {
530
+ const r = e[0];
531
+ return r === "." ? new Os(t, e.slice(1), s).parts : r === "@" ? [new As(t, e.slice(1), i.eventContext)] : r === "?" ? [new Ms(t, e.slice(1), s)] : new jn(t, e, s).parts;
532
+ }
533
+ /**
534
+ * Create parts for a text-position binding.
535
+ * @param templateFactory
536
+ */
537
+ handleTextExpression(t) {
538
+ return new wt(t);
539
+ }
540
+ }
541
+ const Bn = new Ws();
771
542
  /**
772
543
  * @license
773
544
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -781,29 +552,19 @@ const defaultTemplateProcessor = new DefaultTemplateProcessor();
781
552
  * subject to an additional IP rights grant found at
782
553
  * http://polymer.github.io/PATENTS.txt
783
554
  */
784
- function templateFactory(result) {
785
- let templateCache = templateCaches.get(result.type);
786
- if (templateCache === void 0) {
787
- templateCache = {
788
- stringsArray: /* @__PURE__ */ new WeakMap(),
789
- keyString: /* @__PURE__ */ new Map()
790
- };
791
- templateCaches.set(result.type, templateCache);
792
- }
793
- let template = templateCache.stringsArray.get(result.strings);
794
- if (template !== void 0) {
795
- return template;
796
- }
797
- const key2 = result.strings.join(marker);
798
- template = templateCache.keyString.get(key2);
799
- if (template === void 0) {
800
- template = new Template(result, result.getTemplateElement());
801
- templateCache.keyString.set(key2, template);
802
- }
803
- templateCache.stringsArray.set(result.strings, template);
804
- return template;
805
- }
806
- const templateCaches = /* @__PURE__ */ new Map();
555
+ function Is(n) {
556
+ let t = bn.get(n.type);
557
+ t === void 0 && (t = {
558
+ stringsArray: /* @__PURE__ */ new WeakMap(),
559
+ keyString: /* @__PURE__ */ new Map()
560
+ }, bn.set(n.type, t));
561
+ let e = t.stringsArray.get(n.strings);
562
+ if (e !== void 0)
563
+ return e;
564
+ const s = n.strings.join(et);
565
+ return e = t.keyString.get(s), e === void 0 && (e = new ks(n, n.getTemplateElement()), t.keyString.set(s, e)), t.stringsArray.set(n.strings, e), e;
566
+ }
567
+ const bn = /* @__PURE__ */ new Map();
807
568
  /**
808
569
  * @license
809
570
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -817,16 +578,9 @@ const templateCaches = /* @__PURE__ */ new Map();
817
578
  * subject to an additional IP rights grant found at
818
579
  * http://polymer.github.io/PATENTS.txt
819
580
  */
820
- const parts = /* @__PURE__ */ new WeakMap();
821
- const render = (result, container, options) => {
822
- let part2 = parts.get(container);
823
- if (part2 === void 0) {
824
- removeNodes(container, container.firstChild);
825
- parts.set(container, part2 = new NodePart(Object.assign({ templateFactory }, options)));
826
- part2.appendInto(container);
827
- }
828
- part2.setValue(result);
829
- part2.commit();
581
+ const Cn = /* @__PURE__ */ new WeakMap(), Kn = (n, t, e) => {
582
+ let s = Cn.get(t);
583
+ s === void 0 && (Ye(t, t.firstChild), Cn.set(t, s = new wt(Object.assign({ templateFactory: Is }, e))), s.appendInto(t)), s.setValue(n), s.commit();
830
584
  };
831
585
  /**
832
586
  * @license
@@ -841,346 +595,259 @@ const render = (result, container, options) => {
841
595
  * subject to an additional IP rights grant found at
842
596
  * http://polymer.github.io/PATENTS.txt
843
597
  */
844
- if (typeof window !== "undefined") {
845
- (window["litHtmlVersions"] || (window["litHtmlVersions"] = [])).push("1.4.1");
846
- }
847
- const html = (strings, ...values) => new TemplateResult(strings, values, "html", defaultTemplateProcessor);
848
- const svg = (strings, ...values) => new SVGTemplateResult(strings, values, "svg", defaultTemplateProcessor);
849
- const microtaskSet = /* @__PURE__ */ new Set();
850
- function addMicrotask(func) {
851
- if (typeof func !== "function")
852
- return;
853
- if (!microtaskSet.size) {
854
- globalThis.queueMicrotask(() => {
855
- microtaskSet.forEach((func2) => func2());
856
- microtaskSet.clear();
857
- });
858
- }
859
- microtaskSet.delete(func);
860
- microtaskSet.add(func);
861
- }
862
- const microtaskStack = [];
863
- function execMicrotaskStack() {
864
- for (let i = microtaskStack.length - 1; i >= 0; i--) {
865
- microtaskStack[i]();
866
- }
867
- microtaskStack.length = 0;
868
- }
869
- function addMicrotaskToStack(func) {
870
- if (!microtaskStack.length) {
871
- addMicrotask(execMicrotaskStack);
872
- }
873
- microtaskStack.push(func);
874
- }
875
- function absoluteLocation(currentPath = "", relativePath = "") {
876
- const { pathname, search, hash } = new URL(relativePath, location.origin + currentPath);
877
- return pathname + search + decodeURIComponent(hash);
878
- }
879
- function addListener(target, type, listener, options) {
880
- target.addEventListener(type, listener, options);
881
- return () => target.removeEventListener(type, listener, options);
882
- }
883
- class LinkedList extends EventTarget {
598
+ typeof window < "u" && (window.litHtmlVersions || (window.litHtmlVersions = [])).push("1.4.1");
599
+ const G = (n, ...t) => new _e(n, t, "html", Bn), Vs = (n, ...t) => new Gn(n, t, "svg", Bn), _t = /* @__PURE__ */ new Set();
600
+ function I(n) {
601
+ typeof n == "function" && (_t.size || globalThis.queueMicrotask(() => {
602
+ _t.forEach((t) => t()), _t.clear();
603
+ }), _t.delete(n), _t.add(n));
604
+ }
605
+ const Ht = [];
606
+ function Ds() {
607
+ for (let n = Ht.length - 1; n >= 0; n--)
608
+ Ht[n]();
609
+ Ht.length = 0;
610
+ }
611
+ function Di(n) {
612
+ Ht.length || I(Ds), Ht.push(n);
613
+ }
614
+ function zn(n = "", t = "") {
615
+ const { pathname: e, search: s, hash: i } = new URL(t, location.origin + n);
616
+ return e + s + decodeURIComponent(i);
617
+ }
618
+ function Jn(n, t, e, s) {
619
+ return n.addEventListener(t, e, s), () => n.removeEventListener(t, e, s);
620
+ }
621
+ var X, z, Z, Gt, He;
622
+ class qs extends EventTarget {
884
623
  constructor() {
885
624
  super(...arguments);
886
- __privateAdd(this, _delete);
887
- __privateAdd(this, _map, void 0);
888
- __privateAdd(this, _firstItem, void 0);
889
- __privateAdd(this, _lastItem, void 0);
890
- __privateSet(this, _map, /* @__PURE__ */ new Map());
625
+ P(this, Gt);
626
+ P(this, X, /* @__PURE__ */ new Map());
627
+ P(this, z, void 0);
628
+ P(this, Z, void 0);
891
629
  }
892
630
  get size() {
893
- return __privateGet(this, _map).size;
631
+ return g(this, X).size;
894
632
  }
895
633
  get first() {
896
- return __privateGet(this, _firstItem);
634
+ return g(this, z);
897
635
  }
898
636
  get last() {
899
- return __privateGet(this, _lastItem);
900
- }
901
- isSuperLinkOf(subLink) {
902
- let subItem = subLink.first;
903
- if (!subItem)
904
- return true;
905
- let item = this.find(subItem.value);
906
- while (item && item.value === subItem.value) {
907
- subItem = subItem.next;
908
- if (!subItem)
909
- return true;
910
- item = item.next;
911
- }
912
- return false;
913
- }
914
- find(value) {
915
- return __privateGet(this, _map).get(value);
916
- }
917
- add(value) {
918
- if (!__privateGet(this, _lastItem)) {
919
- this.dispatchEvent(new CustomEvent("start"));
920
- }
921
- const item = __privateMethod(this, _delete, delete_fn).call(this, value) || { value };
922
- item.prev = __privateGet(this, _lastItem);
923
- if (item.prev) {
924
- item.prev.next = item;
925
- }
926
- item.next = void 0;
927
- __privateSet(this, _lastItem, item);
928
- if (!__privateGet(this, _firstItem)) {
929
- __privateSet(this, _firstItem, item);
930
- }
931
- __privateGet(this, _map).set(value, item);
932
- }
933
- delete(value) {
934
- const deleteItem = __privateMethod(this, _delete, delete_fn).call(this, value);
935
- if (!__privateGet(this, _firstItem)) {
936
- this.dispatchEvent(new CustomEvent("end"));
937
- }
938
- return deleteItem;
939
- }
637
+ return g(this, Z);
638
+ }
639
+ isSuperLinkOf(e) {
640
+ let s = e.first;
641
+ if (!s)
642
+ return !0;
643
+ let i = this.find(s.value);
644
+ for (; i && i.value === s.value; ) {
645
+ if (s = s.next, !s)
646
+ return !0;
647
+ i = i.next;
648
+ }
649
+ return !1;
650
+ }
651
+ find(e) {
652
+ return g(this, X).get(e);
653
+ }
654
+ // 添加到尾部,已存在时会删除老的项目
655
+ // 如果是添加第一个,start 事件会在添加前触发,避免处理事件重复的逻辑
656
+ add(e) {
657
+ g(this, Z) || this.dispatchEvent(new CustomEvent("start"));
658
+ const s = Ce(this, Gt, He).call(this, e) || { value: e };
659
+ s.prev = g(this, Z), s.prev && (s.prev.next = s), s.next = void 0, F(this, Z, s), g(this, z) || F(this, z, s), g(this, X).set(e, s);
660
+ }
661
+ // 删除这个元素后没有其他元素时立即出发 end 事件
662
+ delete(e) {
663
+ const s = Ce(this, Gt, He).call(this, e);
664
+ return g(this, z) || this.dispatchEvent(new CustomEvent("end")), s;
665
+ }
666
+ // 获取头部元素
667
+ // 会从链表删除
940
668
  get() {
941
- const firstItem = __privateGet(this, _firstItem);
942
- if (!firstItem)
943
- return;
944
- this.delete(firstItem.value);
945
- return firstItem.value;
946
- }
947
- }
948
- _map = new WeakMap();
949
- _firstItem = new WeakMap();
950
- _lastItem = new WeakMap();
951
- _delete = new WeakSet();
952
- delete_fn = function(value) {
953
- const existItem = __privateGet(this, _map).get(value);
954
- if (existItem) {
955
- if (existItem.prev) {
956
- existItem.prev.next = existItem.next;
957
- } else {
958
- __privateSet(this, _firstItem, existItem.next);
959
- }
960
- if (existItem.next) {
961
- existItem.next.prev = existItem.prev;
962
- } else {
963
- __privateSet(this, _lastItem, existItem.prev);
964
- }
965
- __privateGet(this, _map).delete(value);
966
- }
967
- return existItem;
968
- };
969
- class PropProxyMap extends WeakMap {
970
- get(ele) {
971
- let proxy = super.get(ele);
972
- if (!proxy) {
973
- proxy = {};
974
- this.set(ele, proxy);
975
- }
976
- return proxy;
669
+ const e = g(this, z);
670
+ if (e)
671
+ return this.delete(e.value), e.value;
977
672
  }
978
673
  }
979
- class QueryString extends URLSearchParams {
980
- constructor(param) {
981
- super(param);
982
- __privateAdd(this, _stringify, (value) => typeof value === "string" ? value : JSON.stringify(value));
983
- __privateAdd(this, _parse, (value) => {
984
- if (!value)
674
+ X = new WeakMap(), z = new WeakMap(), Z = new WeakMap(), Gt = new WeakSet(), He = function(e) {
675
+ const s = g(this, X).get(e);
676
+ return s && (s.prev ? s.prev.next = s.next : F(this, z, s.next), s.next ? s.next.prev = s.prev : F(this, Z, s.prev), g(this, X).delete(e)), s;
677
+ };
678
+ class Us extends WeakMap {
679
+ get(t) {
680
+ let e = super.get(t);
681
+ return e || (e = {}, this.set(t, e)), e;
682
+ }
683
+ }
684
+ var gt, pe;
685
+ class It extends URLSearchParams {
686
+ constructor(e) {
687
+ super(e);
688
+ P(this, gt, (e) => typeof e == "string" ? e : JSON.stringify(e));
689
+ P(this, pe, (e) => {
690
+ if (!e)
985
691
  return null;
986
692
  try {
987
- return JSON.parse(value);
693
+ return JSON.parse(e);
988
694
  } catch {
989
695
  return null;
990
696
  }
991
697
  });
992
698
  }
993
- concat(param) {
994
- let query;
995
- if (typeof param === "string") {
996
- query = Object.fromEntries(new URLSearchParams(param).entries());
997
- } else {
998
- query = param;
999
- }
1000
- Object.entries(query).forEach(([key2, value]) => {
1001
- this.append(key2, __privateGet(this, _stringify).call(this, value));
699
+ // support `{ key: ObjectValue }`
700
+ concat(e) {
701
+ let s;
702
+ typeof e == "string" ? s = Object.fromEntries(new URLSearchParams(e).entries()) : s = e, Object.entries(s).forEach(([i, r]) => {
703
+ this.append(i, g(this, gt).call(this, r));
1002
704
  });
1003
705
  }
1004
- setAny(key2, value) {
1005
- if (Array.isArray(value)) {
1006
- this.delete(key2);
1007
- value.forEach((e) => this.append(key2, __privateGet(this, _stringify).call(this, e)));
1008
- } else {
1009
- const v = __privateGet(this, _stringify).call(this, value);
1010
- v ? this.set(key2, v) : this.delete(key2);
706
+ setAny(e, s) {
707
+ if (Array.isArray(s))
708
+ this.delete(e), s.forEach((i) => this.append(e, g(this, gt).call(this, i)));
709
+ else {
710
+ const i = g(this, gt).call(this, s);
711
+ i ? this.set(e, i) : this.delete(e);
1011
712
  }
1012
713
  }
1013
- getAny(key2) {
1014
- return this.getAnyAll(key2)[0];
714
+ getAny(e) {
715
+ return this.getAnyAll(e)[0];
1015
716
  }
1016
- getAnyAll(key2) {
1017
- return this.getAll(key2).filter((e) => e !== "").map((e) => __privateGet(this, _parse).call(this, e));
717
+ getAnyAll(e) {
718
+ return this.getAll(e).filter((s) => s !== "").map((s) => g(this, pe).call(this, s));
1018
719
  }
1019
720
  toString() {
1020
- const string = super.toString();
1021
- return string ? `?${string}` : "";
721
+ const e = super.toString();
722
+ return e ? `?${e}` : "";
1022
723
  }
1023
724
  toJSON() {
1024
725
  return this.toString();
1025
726
  }
1026
727
  }
1027
- _stringify = new WeakMap();
1028
- _parse = new WeakMap();
1029
- function raw(arr, ...args) {
1030
- return arr.reduce((prev, current, index) => {
1031
- var _a2;
1032
- return prev + ((_a2 = args[index - 1]) != null ? _a2 : "") + current;
1033
- });
1034
- }
1035
- function css(arr, ...args) {
1036
- return raw(arr, ...args);
1037
- }
1038
- const SheetToken = Symbol.for("gem@sheetToken");
1039
- function createCSSSheet(rules, mediaQuery2 = "") {
1040
- const styleSheet = new CSSStyleSheet();
1041
- const sheet = {};
1042
- styleSheet.media.mediaText = mediaQuery2;
1043
- let style = "";
1044
- if (typeof rules === "string") {
1045
- style = rules;
1046
- } else {
1047
- Object.keys(rules).forEach((key2) => {
1048
- sheet[key2] = `${key2}-${randomStr()}`;
1049
- style += rules[key2].styledContent.replace(/&/g, sheet[key2]);
1050
- });
1051
- }
1052
- styleSheet.replaceSync(style);
1053
- sheet[SheetToken] = styleSheet;
1054
- return sheet;
1055
- }
1056
- function randomStr(len = 5) {
1057
- const str = Math.random().toString(36).slice(2).slice(0, len);
1058
- if (str.length < len)
1059
- return str + randomStr(len - str.length);
1060
- return str;
1061
- }
1062
- const nestingRuleRegExp = new RegExp("&.*{((.|\n)*)}", "g");
1063
- function flatStyled(style, type) {
1064
- const nestingRules = [];
1065
- let styledContent = `& {${style.replace(nestingRuleRegExp, (substr) => {
1066
- nestingRules.push(substr);
1067
- return "";
1068
- })}}` + nestingRules.join("");
1069
- styledContent = styledContent.replace(/&/g, type === "class" ? ".&" : "#&");
1070
- return { styledContent, type };
1071
- }
1072
- const styled = {
1073
- class: (arr, ...args) => {
1074
- const style = raw(arr, ...args);
1075
- return flatStyled(style, "class");
728
+ gt = new WeakMap(), pe = new WeakMap();
729
+ function Jt(n, ...t) {
730
+ return n.reduce((e, s, i) => e + (t[i - 1] ?? "") + s);
731
+ }
732
+ function qi(n, ...t) {
733
+ return Jt(n, ...t);
734
+ }
735
+ const Yn = Symbol.for("gem@sheetToken");
736
+ function Ui(n, t = "") {
737
+ const e = new CSSStyleSheet(), s = {};
738
+ e.media.mediaText = t;
739
+ let i = "";
740
+ return typeof n == "string" ? i = n : Object.keys(n).forEach((r) => {
741
+ s[r] = `${r}-${ve()}`, i += n[r].styledContent.replace(/&/g, s[r]);
742
+ }), e.replaceSync(i), s[Yn] = e, s;
743
+ }
744
+ function ve(n = 5) {
745
+ const t = Math.random().toString(36).slice(2).slice(0, n);
746
+ return t.length < n ? t + ve(n - t.length) : t;
747
+ }
748
+ const Gs = new RegExp(`&.*{((.|
749
+ )*)}`, "g");
750
+ function Pn(n, t) {
751
+ const e = [];
752
+ let s = `& {${n.replace(Gs, (i) => (e.push(i), ""))}}` + e.join("");
753
+ return s = s.replace(/&/g, t === "class" ? ".&" : "#&"), { styledContent: s, type: t };
754
+ }
755
+ const Gi = {
756
+ class: (n, ...t) => {
757
+ const e = Jt(n, ...t);
758
+ return Pn(e, "class");
1076
759
  },
1077
- id: (arr, ...args) => {
1078
- const style = raw(arr, ...args);
1079
- return flatStyled(style, "id");
760
+ id: (n, ...t) => {
761
+ const e = Jt(n, ...t);
762
+ return Pn(e, "id");
1080
763
  },
1081
- keyframes: (arr, ...args) => {
1082
- const keyframesContent = raw(arr, ...args);
1083
- const styledContent = `@keyframes & {${keyframesContent}}`;
1084
- return { styledContent, type: "keyframes" };
1085
- }
764
+ keyframes: (n, ...t) => ({ styledContent: `@keyframes & {${Jt(n, ...t)}}`, type: "keyframes" })
1086
765
  };
1087
- function camelToKebabCase(str) {
1088
- return str.replace(/[A-Z]/g, ($1) => "-" + $1.toLowerCase());
1089
- }
1090
- function kebabToCamelCase(str) {
1091
- return str.replace(/-(.)/g, (_substr, $1) => $1.toUpperCase());
1092
- }
1093
- function cleanObject(o) {
1094
- Object.keys(o).forEach((key2) => {
1095
- const k = key2;
1096
- delete o[k];
1097
- });
1098
- return o;
1099
- }
1100
- class GemError extends Error {
1101
- constructor(msg) {
1102
- super(msg);
1103
- this.message = `gem: ${this.message}`;
1104
- }
1105
- }
1106
- function isArrayChange(newValues, oldValues) {
1107
- const length = newValues.length;
1108
- if (oldValues.length !== length)
1109
- return true;
1110
- for (let i = 0; i < length; i++) {
1111
- if (newValues[i] !== oldValues[i])
1112
- return true;
1113
- }
1114
- return false;
1115
- }
1116
- function removeItems(target, items) {
1117
- const set = new Set(items);
1118
- return target.filter((e) => {
1119
- if (set.has(e)) {
1120
- set.delete(e);
1121
- return false;
1122
- }
1123
- return true;
1124
- });
1125
- }
1126
- function objectMapToString(object, separate, toString) {
1127
- let result = separate;
1128
- for (const key2 in object) {
1129
- const s = toString(key2, object[key2]);
1130
- result += s ? s + separate : "";
1131
- }
1132
- return result;
1133
- }
1134
- function styleMap(object) {
1135
- return objectMapToString(
1136
- object,
766
+ function j(n) {
767
+ return n.replace(/[A-Z]/g, (t) => "-" + t.toLowerCase());
768
+ }
769
+ function ot(n) {
770
+ return n.replace(/-(.)/g, (t, e) => e.toUpperCase());
771
+ }
772
+ function Ze(n) {
773
+ return Object.keys(n).forEach((t) => {
774
+ const e = t;
775
+ delete n[e];
776
+ }), n;
777
+ }
778
+ class tt extends Error {
779
+ constructor(t) {
780
+ super(t), this.message = `gem: ${this.message}`;
781
+ }
782
+ }
783
+ function js(n, t) {
784
+ const e = n.length;
785
+ if (t.length !== e)
786
+ return !0;
787
+ for (let s = 0; s < e; s++)
788
+ if (n[s] !== t[s])
789
+ return !0;
790
+ return !1;
791
+ }
792
+ function Fs(n, t) {
793
+ const e = new Set(t);
794
+ return n.filter((s) => e.has(s) ? (e.delete(s), !1) : !0);
795
+ }
796
+ function tn(n, t, e) {
797
+ let s = t;
798
+ for (const i in n) {
799
+ const r = e(i, n[i]);
800
+ s += r ? r + t : "";
801
+ }
802
+ return s;
803
+ }
804
+ function ji(n) {
805
+ return tn(
806
+ n,
1137
807
  ";",
1138
- (key2, value) => value !== void 0 && value !== null ? `${camelToKebabCase(key2)}:${value}` : ""
808
+ (t, e) => e || e === 0 ? `${j(t)}:${e}` : ""
1139
809
  );
1140
810
  }
1141
- function classMap(object) {
1142
- return objectMapToString(object, " ", (key2, value) => value ? key2 : "");
811
+ function Bs(n) {
812
+ return tn(n, " ", (t, e) => e ? t : "");
1143
813
  }
1144
- const partMap = classMap;
1145
- function exportPartsMap(object) {
1146
- return objectMapToString(
1147
- object,
814
+ const Fi = Bs;
815
+ function Bi(n) {
816
+ return tn(
817
+ n,
1148
818
  ",",
1149
- (key2, value) => value === true || key2 === value ? key2 : value ? `${key2}:${value}` : ""
819
+ (t, e) => e === !0 || t === e ? t : e ? `${t}:${e}` : ""
1150
820
  );
1151
821
  }
1152
- const StoreListenerMap = /* @__PURE__ */ new WeakMap();
1153
- function createStore(originStore) {
1154
- if (StoreListenerMap.has(originStore)) {
1155
- throw new GemError("argument error");
1156
- }
1157
- StoreListenerMap.set(originStore, /* @__PURE__ */ new Set());
1158
- return originStore;
822
+ const Vt = /* @__PURE__ */ new WeakMap();
823
+ function Ft(n) {
824
+ if (Vt.has(n))
825
+ throw new tt("argument error");
826
+ return Vt.set(n, /* @__PURE__ */ new Set()), n;
1159
827
  }
1160
- function updateStore(store2, value) {
1161
- var _a2;
1162
- Object.assign(store2, value);
1163
- (_a2 = StoreListenerMap.get(store2)) == null ? void 0 : _a2.forEach((func) => {
1164
- addMicrotask(func);
828
+ function nt(n, t) {
829
+ var e;
830
+ Object.assign(n, t), (e = Vt.get(n)) == null || e.forEach((s) => {
831
+ I(s);
1165
832
  });
1166
833
  }
1167
- function useStore(originStore) {
1168
- const store2 = createStore(originStore);
1169
- return [store2, (value) => updateStore(store2, value)];
834
+ function en(n) {
835
+ const t = Ft(n);
836
+ return [t, (e) => nt(t, e)];
1170
837
  }
1171
- function connect(store2, func) {
1172
- const listeners = StoreListenerMap.get(store2);
1173
- listeners == null ? void 0 : listeners.add(func);
1174
- return () => listeners == null ? void 0 : listeners.delete(func);
838
+ function ct(n, t) {
839
+ const e = Vt.get(n);
840
+ return e == null || e.add(t), () => {
841
+ e == null || e.delete(t);
842
+ };
1175
843
  }
1176
- function disconnect(store2, func) {
1177
- const listeners = StoreListenerMap.get(store2);
1178
- listeners == null ? void 0 : listeners.delete(func);
844
+ function Ki(n, t) {
845
+ const e = Vt.get(n);
846
+ e == null || e.delete(t);
1179
847
  }
1180
- const version = "1.7.9";
1181
- var VersionExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
848
+ const Ks = "1.7.11", zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1182
849
  __proto__: null,
1183
- version
850
+ version: Ks
1184
851
  }, Symbol.toStringTag, { value: "Module" }));
1185
852
  /**
1186
853
  * @license
@@ -1195,131 +862,66 @@ var VersionExports = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
1195
862
  * subject to an additional IP rights grant found at
1196
863
  * http://polymer.github.io/PATENTS.txt
1197
864
  */
1198
- const createAndInsertPart = (containerPart, beforePart) => {
1199
- const container = containerPart.startNode.parentNode;
1200
- const beforeNode = beforePart === void 0 ? containerPart.endNode : beforePart.startNode;
1201
- const startNode = container.insertBefore(createMarker(), beforeNode);
1202
- container.insertBefore(createMarker(), beforeNode);
1203
- const newPart = new NodePart(containerPart.options);
1204
- newPart.insertAfterNode(startNode);
1205
- return newPart;
1206
- };
1207
- const updatePart = (part2, value) => {
1208
- part2.setValue(value);
1209
- part2.commit();
1210
- return part2;
1211
- };
1212
- const insertPartBefore = (containerPart, part2, ref) => {
1213
- const container = containerPart.startNode.parentNode;
1214
- const beforeNode = ref ? ref.startNode : containerPart.endNode;
1215
- const endNode = part2.endNode.nextSibling;
1216
- if (endNode !== beforeNode) {
1217
- reparentNodes(container, part2.startNode, endNode, beforeNode);
1218
- }
1219
- };
1220
- const removePart = (part2) => {
1221
- removeNodes(part2.startNode.parentNode, part2.startNode, part2.endNode.nextSibling);
1222
- };
1223
- const generateMap = (list, start, end) => {
1224
- const map = /* @__PURE__ */ new Map();
1225
- for (let i = start; i <= end; i++) {
1226
- map.set(list[i], i);
1227
- }
1228
- return map;
1229
- };
1230
- const partListCache = /* @__PURE__ */ new WeakMap();
1231
- const keyListCache = /* @__PURE__ */ new WeakMap();
1232
- const repeat = directive((items, keyFnOrTemplate, template) => {
1233
- let keyFn;
1234
- if (template === void 0) {
1235
- template = keyFnOrTemplate;
1236
- } else if (keyFnOrTemplate !== void 0) {
1237
- keyFn = keyFnOrTemplate;
1238
- }
1239
- return (containerPart) => {
1240
- if (!(containerPart instanceof NodePart)) {
865
+ const $n = (n, t) => {
866
+ const e = n.startNode.parentNode, s = t === void 0 ? n.endNode : t.startNode, i = e.insertBefore(U(), s);
867
+ e.insertBefore(U(), s);
868
+ const r = new wt(n.options);
869
+ return r.insertAfterNode(i), r;
870
+ }, st = (n, t) => (n.setValue(t), n.commit(), n), Pe = (n, t, e) => {
871
+ const s = n.startNode.parentNode, i = e ? e.startNode : n.endNode, r = t.endNode.nextSibling;
872
+ r !== i && qn(s, t.startNode, r, i);
873
+ }, $e = (n) => {
874
+ Ye(n.startNode.parentNode, n.startNode, n.endNode.nextSibling);
875
+ }, Tn = (n, t, e) => {
876
+ const s = /* @__PURE__ */ new Map();
877
+ for (let i = t; i <= e; i++)
878
+ s.set(n[i], i);
879
+ return s;
880
+ }, kn = /* @__PURE__ */ new WeakMap(), Ln = /* @__PURE__ */ new WeakMap(), Js = we((n, t, e) => {
881
+ let s;
882
+ return e === void 0 ? e = t : t !== void 0 && (s = t), (i) => {
883
+ if (!(i instanceof wt))
1241
884
  throw new Error("repeat can only be used in text bindings");
1242
- }
1243
- const oldParts = partListCache.get(containerPart) || [];
1244
- const oldKeys = keyListCache.get(containerPart) || [];
1245
- const newParts = [];
1246
- const newValues = [];
1247
- const newKeys = [];
1248
- let index = 0;
1249
- for (const item of items) {
1250
- newKeys[index] = keyFn ? keyFn(item, index) : index;
1251
- newValues[index] = template(item, index);
1252
- index++;
1253
- }
1254
- let newKeyToIndexMap;
1255
- let oldKeyToIndexMap;
1256
- let oldHead = 0;
1257
- let oldTail = oldParts.length - 1;
1258
- let newHead = 0;
1259
- let newTail = newValues.length - 1;
1260
- while (oldHead <= oldTail && newHead <= newTail) {
1261
- if (oldParts[oldHead] === null) {
1262
- oldHead++;
1263
- } else if (oldParts[oldTail] === null) {
1264
- oldTail--;
1265
- } else if (oldKeys[oldHead] === newKeys[newHead]) {
1266
- newParts[newHead] = updatePart(oldParts[oldHead], newValues[newHead]);
1267
- oldHead++;
1268
- newHead++;
1269
- } else if (oldKeys[oldTail] === newKeys[newTail]) {
1270
- newParts[newTail] = updatePart(oldParts[oldTail], newValues[newTail]);
1271
- oldTail--;
1272
- newTail--;
1273
- } else if (oldKeys[oldHead] === newKeys[newTail]) {
1274
- newParts[newTail] = updatePart(oldParts[oldHead], newValues[newTail]);
1275
- insertPartBefore(containerPart, oldParts[oldHead], newParts[newTail + 1]);
1276
- oldHead++;
1277
- newTail--;
1278
- } else if (oldKeys[oldTail] === newKeys[newHead]) {
1279
- newParts[newHead] = updatePart(oldParts[oldTail], newValues[newHead]);
1280
- insertPartBefore(containerPart, oldParts[oldTail], oldParts[oldHead]);
1281
- oldTail--;
1282
- newHead++;
1283
- } else {
1284
- if (newKeyToIndexMap === void 0) {
1285
- newKeyToIndexMap = generateMap(newKeys, newHead, newTail);
1286
- oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);
1287
- }
1288
- if (!newKeyToIndexMap.has(oldKeys[oldHead])) {
1289
- removePart(oldParts[oldHead]);
1290
- oldHead++;
1291
- } else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {
1292
- removePart(oldParts[oldTail]);
1293
- oldTail--;
1294
- } else {
1295
- const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);
1296
- const oldPart = oldIndex !== void 0 ? oldParts[oldIndex] : null;
1297
- if (oldPart === null) {
1298
- const newPart = createAndInsertPart(containerPart, oldParts[oldHead]);
1299
- updatePart(newPart, newValues[newHead]);
1300
- newParts[newHead] = newPart;
1301
- } else {
1302
- newParts[newHead] = updatePart(oldPart, newValues[newHead]);
1303
- insertPartBefore(containerPart, oldPart, oldParts[oldHead]);
1304
- oldParts[oldIndex] = null;
1305
- }
1306
- newHead++;
1307
- }
885
+ const r = kn.get(i) || [], o = Ln.get(i) || [], a = [], c = [], h = [];
886
+ let p = 0;
887
+ for (const v of n)
888
+ h[p] = s ? s(v, p) : p, c[p] = e(v, p), p++;
889
+ let u, S, d = 0, m = r.length - 1, f = 0, _ = c.length - 1;
890
+ for (; d <= m && f <= _; )
891
+ if (r[d] === null)
892
+ d++;
893
+ else if (r[m] === null)
894
+ m--;
895
+ else if (o[d] === h[f])
896
+ a[f] = st(r[d], c[f]), d++, f++;
897
+ else if (o[m] === h[_])
898
+ a[_] = st(r[m], c[_]), m--, _--;
899
+ else if (o[d] === h[_])
900
+ a[_] = st(r[d], c[_]), Pe(i, r[d], a[_ + 1]), d++, _--;
901
+ else if (o[m] === h[f])
902
+ a[f] = st(r[m], c[f]), Pe(i, r[m], r[d]), m--, f++;
903
+ else if (u === void 0 && (u = Tn(h, f, _), S = Tn(o, d, m)), !u.has(o[d]))
904
+ $e(r[d]), d++;
905
+ else if (!u.has(o[m]))
906
+ $e(r[m]), m--;
907
+ else {
908
+ const v = S.get(h[f]), H = v !== void 0 ? r[v] : null;
909
+ if (H === null) {
910
+ const M = $n(i, r[d]);
911
+ st(M, c[f]), a[f] = M;
912
+ } else
913
+ a[f] = st(H, c[f]), Pe(i, H, r[d]), r[v] = null;
914
+ f++;
1308
915
  }
916
+ for (; f <= _; ) {
917
+ const v = $n(i, a[_ + 1]);
918
+ st(v, c[f]), a[f++] = v;
1309
919
  }
1310
- while (newHead <= newTail) {
1311
- const newPart = createAndInsertPart(containerPart, newParts[newTail + 1]);
1312
- updatePart(newPart, newValues[newHead]);
1313
- newParts[newHead++] = newPart;
920
+ for (; d <= m; ) {
921
+ const v = r[d++];
922
+ v !== null && $e(v);
1314
923
  }
1315
- while (oldHead <= oldTail) {
1316
- const oldPart = oldParts[oldHead++];
1317
- if (oldPart !== null) {
1318
- removePart(oldPart);
1319
- }
1320
- }
1321
- partListCache.set(containerPart, newParts);
1322
- keyListCache.set(containerPart, newKeys);
924
+ kn.set(i, a), Ln.set(i, h);
1323
925
  };
1324
926
  });
1325
927
  /**
@@ -1335,18 +937,14 @@ const repeat = directive((items, keyFnOrTemplate, template) => {
1335
937
  * subject to an additional IP rights grant found at
1336
938
  * http://polymer.github.io/PATENTS.txt
1337
939
  */
1338
- const previousValues$1 = /* @__PURE__ */ new WeakMap();
1339
- const guard = directive((value, f) => (part2) => {
1340
- const previousValue = previousValues$1.get(part2);
1341
- if (Array.isArray(value)) {
1342
- if (Array.isArray(previousValue) && previousValue.length === value.length && value.every((v, i) => v === previousValue[i])) {
940
+ const Te = /* @__PURE__ */ new WeakMap(), Ys = we((n, t) => (e) => {
941
+ const s = Te.get(e);
942
+ if (Array.isArray(n)) {
943
+ if (Array.isArray(s) && s.length === n.length && n.every((i, r) => i === s[r]))
1343
944
  return;
1344
- }
1345
- } else if (previousValue === value && (value !== void 0 || previousValues$1.has(part2))) {
945
+ } else if (s === n && (n !== void 0 || Te.has(e)))
1346
946
  return;
1347
- }
1348
- part2.setValue(f());
1349
- previousValues$1.set(part2, Array.isArray(value) ? Array.from(value) : value);
947
+ e.setValue(t()), Te.set(e, Array.isArray(n) ? Array.from(n) : n);
1350
948
  });
1351
949
  /**
1352
950
  * @license
@@ -1361,1132 +959,815 @@ const guard = directive((value, f) => (part2) => {
1361
959
  * subject to an additional IP rights grant found at
1362
960
  * http://polymer.github.io/PATENTS.txt
1363
961
  */
1364
- const previousValues = /* @__PURE__ */ new WeakMap();
1365
- const ifDefined = directive((value) => (part2) => {
1366
- const previousValue = previousValues.get(part2);
1367
- if (value === void 0 && part2 instanceof AttributePart) {
1368
- if (previousValue !== void 0 || !previousValues.has(part2)) {
1369
- const name = part2.committer.name;
1370
- part2.committer.element.removeAttribute(name);
1371
- }
1372
- } else if (value !== previousValue) {
1373
- part2.setValue(value);
1374
- }
1375
- previousValues.set(part2, value);
962
+ const ke = /* @__PURE__ */ new WeakMap(), Qn = we((n) => (t) => {
963
+ const e = ke.get(t);
964
+ if (n === void 0 && t instanceof Xe) {
965
+ if (e !== void 0 || !ke.has(t)) {
966
+ const s = t.committer.name;
967
+ t.committer.element.removeAttribute(s);
968
+ }
969
+ } else
970
+ n !== e && t.setValue(n);
971
+ ke.set(t, n);
1376
972
  });
1377
- var __accessCheck$1 = (obj, member, msg) => {
1378
- if (!member.has(obj))
1379
- throw TypeError("Cannot " + msg);
1380
- };
1381
- var __privateGet$1 = (obj, member, getter) => {
1382
- __accessCheck$1(obj, member, "read from private field");
1383
- return getter ? getter.call(obj) : member.get(obj);
1384
- };
1385
- var __privateAdd$1 = (obj, member, value) => {
1386
- if (member.has(obj))
973
+ var Xn = (n, t, e) => {
974
+ if (!t.has(n))
975
+ throw TypeError("Cannot " + e);
976
+ }, l = (n, t, e) => (Xn(n, t, "read from private field"), e ? e.call(n) : t.get(n)), w = (n, t, e) => {
977
+ if (t.has(n))
1387
978
  throw TypeError("Cannot add the same private member more than once");
1388
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1389
- };
1390
- var __privateSet$1 = (obj, member, value, setter) => {
1391
- __accessCheck$1(obj, member, "write to private field");
1392
- setter ? setter.call(obj, value) : member.set(obj, value);
1393
- return value;
1394
- };
1395
- var _final, _renderRoot, _internals, _isAppendReason, _isMounted, _isAsync, _effectList, _memoList, _unmountCallback, _exec, _execEffect, _execMemo, _initEffect, _render, _shouldUpdate, _updateCallback, _update, _updated, _disconnectStore, _connectedCallback, _clearEffect;
1396
- function emptyFunction() {
1397
- }
1398
- function execCallback(fun) {
1399
- typeof fun === "function" && fun();
1400
- }
1401
- const asyncRenderTaskList = new LinkedList();
1402
- const tick = (timeStamp = performance.now()) => {
1403
- if (performance.now() > timeStamp + 16)
1404
- return requestAnimationFrame(tick);
1405
- const task = asyncRenderTaskList.get();
1406
- if (task) {
1407
- task();
1408
- tick(timeStamp);
1409
- }
979
+ t instanceof WeakSet ? t.add(n) : t.set(n, e);
980
+ }, k = (n, t, e, s) => (Xn(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), ft, Ct, Y, Pt, B, $t, K, Q, Yt, Qt, We, Ie, Ve, Xt, De, Zt, it, qe, te, ee, ne;
981
+ function Qs() {
982
+ }
983
+ function Le(n) {
984
+ typeof n == "function" && n();
985
+ }
986
+ const ce = new qs(), Ue = (n = performance.now()) => {
987
+ if (performance.now() > n + 16)
988
+ return requestAnimationFrame(Ue);
989
+ const t = ce.get();
990
+ t && (t(), Ue(n));
1410
991
  };
1411
- asyncRenderTaskList.addEventListener("start", () => addMicrotask(tick));
1412
- const constructorSymbol = Symbol("constructor");
1413
- const initSymbol = Symbol("init");
1414
- const updateSymbol = Symbol("update");
1415
- const _GemElement = class extends HTMLElement {
1416
- constructor(options = {}) {
1417
- super();
1418
- __privateAdd$1(this, _renderRoot, void 0);
1419
- __privateAdd$1(this, _internals, void 0);
1420
- __privateAdd$1(this, _isAppendReason, void 0);
1421
- __privateAdd$1(this, _isMounted, void 0);
1422
- __privateAdd$1(this, _isAsync, void 0);
1423
- __privateAdd$1(this, _effectList, void 0);
1424
- __privateAdd$1(this, _memoList, void 0);
1425
- __privateAdd$1(this, _unmountCallback, void 0);
1426
- this.setState = (payload) => {
992
+ ce.addEventListener("start", () => I(Ue));
993
+ const Kt = Symbol("constructor"), he = Symbol("init"), Zn = Symbol("update"), ts = class Tt extends HTMLElement {
994
+ constructor(t = {}) {
995
+ super(), w(this, Ct, void 0), w(this, Y, void 0), w(this, Pt, void 0), w(this, B, void 0), w(this, $t, void 0), w(this, K, void 0), w(this, Q, void 0), w(this, Yt, void 0), this.setState = (i) => {
1427
996
  if (!this.state)
1428
- throw new GemError("`state` not initialized");
1429
- Object.assign(this.state, payload);
1430
- addMicrotask(__privateGet$1(this, _update));
1431
- };
1432
- __privateAdd$1(this, _exec, (list) => {
1433
- list == null ? void 0 : list.forEach((effectItem) => {
1434
- const { callback, getDep, values, preCallback } = effectItem;
1435
- const newValues = getDep == null ? void 0 : getDep();
1436
- if (!getDep || !values || isArrayChange(values, newValues)) {
1437
- execCallback(preCallback);
1438
- effectItem.preCallback = callback(newValues, values);
1439
- effectItem.values = newValues;
1440
- }
997
+ throw new tt("`state` not initialized");
998
+ Object.assign(this.state, i), I(l(this, it));
999
+ }, w(this, Qt, (i) => {
1000
+ i == null || i.forEach((r) => {
1001
+ const { callback: o, getDep: a, values: c, preCallback: h } = r, p = a == null ? void 0 : a();
1002
+ (!a || !c || js(c, p)) && (Le(h), r.preCallback = o(p, c), r.values = p);
1441
1003
  });
1442
- });
1443
- __privateAdd$1(this, _execEffect, () => {
1444
- __privateGet$1(this, _exec).call(this, __privateGet$1(this, _effectList));
1445
- });
1446
- __privateAdd$1(this, _execMemo, () => {
1447
- __privateGet$1(this, _exec).call(this, __privateGet$1(this, _memoList));
1448
- });
1449
- this.effect = (callback, getDep) => {
1450
- if (!__privateGet$1(this, _effectList))
1451
- __privateSet$1(this, _effectList, []);
1452
- const effectItem = {
1453
- callback,
1454
- getDep,
1455
- initialized: __privateGet$1(this, _isMounted),
1456
- inConstructor: this[constructorSymbol]
1004
+ }), w(this, We, () => {
1005
+ l(this, Qt).call(this, l(this, K));
1006
+ }), w(this, Ie, () => {
1007
+ l(this, Qt).call(this, l(this, Q));
1008
+ }), this.effect = (i, r) => {
1009
+ l(this, K) || k(this, K, []);
1010
+ const o = {
1011
+ callback: i,
1012
+ getDep: r,
1013
+ initialized: l(this, B),
1014
+ inConstructor: this[Kt]
1457
1015
  };
1458
- if (__privateGet$1(this, _isMounted)) {
1459
- effectItem.values = getDep == null ? void 0 : getDep();
1460
- effectItem.preCallback = callback(effectItem.values);
1461
- }
1462
- __privateGet$1(this, _effectList).push(effectItem);
1463
- };
1464
- this.memo = (callback, getDep) => {
1465
- if (!__privateGet$1(this, _memoList))
1466
- __privateSet$1(this, _memoList, []);
1467
- __privateGet$1(this, _memoList).push({
1468
- callback,
1469
- getDep,
1470
- inConstructor: this[constructorSymbol]
1016
+ l(this, B) && (o.values = r == null ? void 0 : r(), o.preCallback = i(o.values)), l(this, K).push(o);
1017
+ }, this.memo = (i, r) => {
1018
+ l(this, Q) || k(this, Q, []), l(this, Q).push({
1019
+ callback: i,
1020
+ getDep: r,
1021
+ inConstructor: this[Kt]
1471
1022
  });
1472
- };
1473
- __privateAdd$1(this, _initEffect, () => {
1474
- var _a2;
1475
- (_a2 = __privateGet$1(this, _effectList)) == null ? void 0 : _a2.forEach((effectItem) => {
1476
- const { callback, getDep, initialized } = effectItem;
1477
- if (!initialized) {
1478
- effectItem.values = getDep == null ? void 0 : getDep();
1479
- effectItem.preCallback = callback(effectItem.values);
1480
- effectItem.initialized = true;
1481
- }
1023
+ }, w(this, Ve, () => {
1024
+ var i;
1025
+ (i = l(this, K)) == null || i.forEach((r) => {
1026
+ const { callback: o, getDep: a, initialized: c } = r;
1027
+ c || (r.values = a == null ? void 0 : a(), r.preCallback = o(r.values), r.initialized = !0);
1482
1028
  });
1483
- });
1484
- __privateAdd$1(this, _render, () => {
1485
- __privateGet$1(this, _execMemo).call(this);
1486
- const isLight = __privateGet$1(this, _renderRoot) === this;
1487
- const temp = this.render ? this.render() : isLight ? void 0 : html`<slot></slot>`;
1488
- if (temp === void 0)
1489
- return;
1490
- render(temp, __privateGet$1(this, _renderRoot));
1491
- });
1492
- __privateAdd$1(this, _shouldUpdate, () => {
1493
- return this.shouldUpdate ? this.shouldUpdate() : true;
1494
- });
1495
- __privateAdd$1(this, _updateCallback, () => {
1496
- if (__privateGet$1(this, _isMounted) && __privateGet$1(this, _shouldUpdate).call(this)) {
1497
- __privateGet$1(this, _render).call(this);
1498
- addMicrotask(__privateGet$1(this, _updated));
1499
- addMicrotask(__privateGet$1(this, _execEffect));
1500
- }
1501
- });
1502
- __privateAdd$1(this, _update, () => {
1503
- if (__privateGet$1(this, _isAsync)) {
1504
- asyncRenderTaskList.add(__privateGet$1(this, _updateCallback));
1505
- } else {
1506
- __privateGet$1(this, _updateCallback).call(this);
1507
- }
1508
- });
1509
- this.update = () => {
1510
- addMicrotask(__privateGet$1(this, _update));
1511
- };
1512
- __privateAdd$1(this, _updated, () => {
1513
- var _a2;
1514
- (_a2 = this.updated) == null ? void 0 : _a2.call(this);
1515
- });
1516
- __privateAdd$1(this, _disconnectStore, void 0);
1517
- __privateAdd$1(this, _connectedCallback, () => {
1518
- var _a2, _b2, _c;
1519
- if (__privateGet$1(this, _isAppendReason)) {
1520
- __privateSet$1(this, _isAppendReason, false);
1029
+ }), w(this, Xt, () => {
1030
+ l(this, Ie).call(this);
1031
+ const i = l(this, Ct) === this, r = this.render ? this.render() : i ? void 0 : G`<slot></slot>`;
1032
+ r !== void 0 && Kn(r, l(this, Ct));
1033
+ }), w(this, De, () => this.shouldUpdate ? this.shouldUpdate() : !0), w(this, Zt, () => {
1034
+ l(this, B) && l(this, De).call(this) && (l(this, Xt).call(this), I(l(this, qe)), I(l(this, We)));
1035
+ }), w(this, it, () => {
1036
+ l(this, $t) ? ce.add(l(this, Zt)) : l(this, Zt).call(this);
1037
+ }), this.update = () => {
1038
+ I(l(this, it));
1039
+ }, w(this, qe, () => {
1040
+ var i;
1041
+ (i = this.updated) == null || i.call(this);
1042
+ }), w(this, te, void 0), w(this, ee, () => {
1043
+ var o, a, c;
1044
+ if (l(this, Pt)) {
1045
+ k(this, Pt, !1);
1521
1046
  return;
1522
1047
  }
1523
- Reflect.set(this, constructorSymbol, false);
1524
- (_a2 = this.willMount) == null ? void 0 : _a2.call(this);
1525
- const { observedStores, rootElement: rootElement2 } = this.constructor;
1526
- __privateSet$1(this, _disconnectStore, observedStores == null ? void 0 : observedStores.map((store2) => connect(store2, __privateGet$1(this, _update))));
1527
- __privateGet$1(this, _render).call(this);
1528
- __privateSet$1(this, _isMounted, true);
1529
- __privateSet$1(this, _unmountCallback, (_b2 = this.mounted) == null ? void 0 : _b2.call(this));
1530
- __privateGet$1(this, _initEffect).call(this);
1531
- if (rootElement2 && this.isConnected && ((_c = this.getRootNode().host) == null ? void 0 : _c.tagName) !== rootElement2.toUpperCase()) {
1532
- throw new GemError(`not allow current root type`);
1533
- }
1534
- });
1535
- __privateAdd$1(this, _clearEffect, (list) => {
1536
- return list == null ? void 0 : list.filter((e) => {
1537
- execCallback(e.preCallback);
1538
- e.initialized = false;
1539
- return e.inConstructor;
1540
- });
1541
- });
1542
- addMicrotask(() => Reflect.set(this, initSymbol, false));
1543
- Reflect.set(this, constructorSymbol, true);
1544
- Reflect.set(this, initSymbol, true);
1545
- Reflect.set(this, updateSymbol, () => {
1546
- if (__privateGet$1(this, _isMounted)) {
1547
- addMicrotask(__privateGet$1(this, _update));
1548
- }
1549
- });
1550
- __privateSet$1(this, _isAsync, options.isAsync);
1551
- __privateSet$1(this, _renderRoot, options.isLight ? this : this.attachShadow({
1552
- mode: options.mode || "open",
1553
- delegatesFocus: options.delegatesFocus,
1554
- slotAssignment: options.slotAssignment
1048
+ Reflect.set(this, Kt, !1), (o = this.willMount) == null || o.call(this);
1049
+ const { observedStores: i, rootElement: r } = this.constructor;
1050
+ if (k(this, te, i == null ? void 0 : i.map((h) => ct(h, l(this, it)))), l(this, Xt).call(this), k(this, B, !0), k(this, Yt, (a = this.mounted) == null ? void 0 : a.call(this)), l(this, Ve).call(this), r && this.isConnected && ((c = this.getRootNode().host) == null ? void 0 : c.tagName) !== r.toUpperCase())
1051
+ throw new tt("not allow current root type");
1052
+ }), w(this, ne, (i) => i == null ? void 0 : i.filter((r) => (Le(r.preCallback), r.initialized = !1, r.inConstructor))), I(() => Reflect.set(this, he, !1)), Reflect.set(this, Kt, !0), Reflect.set(this, he, !0), Reflect.set(this, Zn, () => {
1053
+ l(this, B) && I(l(this, it));
1054
+ }), k(this, $t, t.isAsync), k(this, Ct, t.isLight ? this : this.attachShadow({
1055
+ mode: t.mode || "open",
1056
+ delegatesFocus: t.delegatesFocus,
1057
+ slotAssignment: t.slotAssignment
1555
1058
  }));
1556
- let hasInitTabIndex;
1059
+ let e;
1557
1060
  this.effect(
1558
- ([disabled = false]) => {
1559
- if (hasInitTabIndex === void 0)
1560
- hasInitTabIndex = this.hasAttribute("tabindex");
1561
- this.internals.ariaDisabled = String(disabled);
1562
- if (options.focusable && !hasInitTabIndex) {
1563
- this.tabIndex = -Number(disabled);
1564
- }
1565
- if ((options.focusable || options.delegatesFocus) && disabled) {
1566
- return addListener(this, "click", (e) => e.isTrusted && e.stopImmediatePropagation(), {
1567
- capture: true
1061
+ ([i = !1]) => {
1062
+ if (e === void 0 && (e = this.hasAttribute("tabindex")), this.internals.ariaDisabled = String(i), t.focusable && !e && (this.tabIndex = -Number(i)), (t.focusable || t.delegatesFocus) && i)
1063
+ return Jn(this, "click", (r) => r.isTrusted && r.stopImmediatePropagation(), {
1064
+ capture: !0
1568
1065
  });
1569
- }
1570
1066
  },
1571
1067
  () => [Reflect.get(this, "disabled")]
1572
1068
  );
1573
- const { adoptedStyleSheets } = new.target;
1574
- if (adoptedStyleSheets) {
1575
- const sheets = adoptedStyleSheets.map((item) => item[SheetToken] || item);
1576
- if (this.shadowRoot) {
1577
- this.shadowRoot.adoptedStyleSheets = sheets;
1578
- } else {
1579
- this.effect(
1580
- () => {
1581
- const root = this.getRootNode();
1582
- root.adoptedStyleSheets = [...root.adoptedStyleSheets, ...sheets];
1583
- return () => {
1584
- root.adoptedStyleSheets = removeItems(root.adoptedStyleSheets, sheets);
1585
- };
1586
- },
1587
- () => []
1588
- );
1589
- }
1069
+ const { adoptedStyleSheets: s } = new.target;
1070
+ if (s) {
1071
+ const i = s.map((r) => r[Yn] || r);
1072
+ this.shadowRoot ? this.shadowRoot.adoptedStyleSheets = i : this.effect(
1073
+ () => {
1074
+ const r = this.getRootNode();
1075
+ return r.adoptedStyleSheets = [...r.adoptedStyleSheets, ...i], () => {
1076
+ r.adoptedStyleSheets = Fs(r.adoptedStyleSheets, i);
1077
+ };
1078
+ },
1079
+ () => []
1080
+ );
1590
1081
  }
1591
1082
  }
1592
1083
  get internals() {
1593
- if (!__privateGet$1(this, _internals)) {
1594
- __privateSet$1(this, _internals, this.attachInternals());
1084
+ if (!l(this, Y)) {
1085
+ k(this, Y, this.attachInternals());
1595
1086
  try {
1596
- __privateGet$1(this, _internals).states.add("foo");
1597
- __privateGet$1(this, _internals).states.delete("foo");
1087
+ l(this, Y).states.add("foo"), l(this, Y).states.delete("foo");
1598
1088
  } catch {
1599
- Reflect.defineProperty(__privateGet$1(this, _internals), "states", {
1089
+ Reflect.defineProperty(l(this, Y), "states", {
1600
1090
  value: {
1601
- has: (v) => kebabToCamelCase(v) in this.dataset,
1602
- add: (v) => this.dataset[kebabToCamelCase(v)] = "",
1603
- delete: (v) => delete this.dataset[kebabToCamelCase(v)]
1091
+ has: (t) => ot(t) in this.dataset,
1092
+ add: (t) => this.dataset[ot(t)] = "",
1093
+ delete: (t) => delete this.dataset[ot(t)]
1604
1094
  }
1605
1095
  });
1606
1096
  }
1607
1097
  }
1608
- return __privateGet$1(this, _internals);
1098
+ return l(this, Y);
1609
1099
  }
1100
+ /**
1101
+ * @private
1102
+ * @final
1103
+ * use `effect`
1104
+ */
1610
1105
  attributeChangedCallback() {
1611
- if (__privateGet$1(this, _isMounted)) {
1612
- addMicrotask(__privateGet$1(this, _update));
1613
- }
1614
- return __privateGet$1(_GemElement, _final);
1615
- }
1616
- closestElement(constructorOrTag) {
1617
- const isConstructor = typeof constructorOrTag === "function";
1618
- const tagName = typeof constructorOrTag === "string" && constructorOrTag.toUpperCase();
1619
- const getRootElement = (ele) => {
1620
- const rootEle = ele.parentElement || ele.getRootNode().host;
1621
- if (!rootEle)
1106
+ return l(this, B) && I(l(this, it)), l(Tt, ft);
1107
+ }
1108
+ closestElement(t) {
1109
+ const e = typeof t == "function", s = typeof t == "string" && t.toUpperCase(), i = (r) => {
1110
+ const o = r.parentElement || r.getRootNode().host;
1111
+ if (!o)
1622
1112
  return null;
1623
- if (isConstructor) {
1624
- if (rootEle.constructor === constructorOrTag) {
1625
- return rootEle;
1626
- }
1627
- } else if (rootEle.tagName === tagName) {
1628
- return rootEle;
1629
- }
1630
- return getRootElement(rootEle);
1113
+ if (e) {
1114
+ if (o.constructor === t)
1115
+ return o;
1116
+ } else if (o.tagName === s)
1117
+ return o;
1118
+ return i(o);
1631
1119
  };
1632
- return getRootElement(this);
1120
+ return i(this);
1633
1121
  }
1122
+ /**
1123
+ * @private
1124
+ * @final
1125
+ * use `mounted`; 允许手动调用 `connectedCallback` 以清除装饰器定义的字段
1126
+ */
1634
1127
  connectedCallback() {
1635
- if (this.isConnected && __privateGet$1(this, _isAsync)) {
1636
- asyncRenderTaskList.add(__privateGet$1(this, _connectedCallback));
1637
- } else {
1638
- __privateGet$1(this, _connectedCallback).call(this);
1639
- }
1640
- return __privateGet$1(_GemElement, _final);
1128
+ return this.isConnected && l(this, $t) ? ce.add(l(this, ee)) : l(this, ee).call(this), l(Tt, ft);
1641
1129
  }
1130
+ /**
1131
+ * @private
1132
+ * @final
1133
+ */
1642
1134
  adoptedCallback() {
1643
- return __privateGet$1(_GemElement, _final);
1135
+ return l(Tt, ft);
1644
1136
  }
1137
+ /**
1138
+ * @private
1139
+ * @final
1140
+ * use `unmounted`
1141
+ */
1645
1142
  disconnectedCallback() {
1646
- var _a2, _b2;
1143
+ var t, e;
1647
1144
  if (this.isConnected) {
1648
- __privateSet$1(this, _isAppendReason, true);
1145
+ k(this, Pt, !0);
1649
1146
  return;
1650
1147
  }
1651
- __privateSet$1(this, _isMounted, false);
1652
- (_a2 = __privateGet$1(this, _disconnectStore)) == null ? void 0 : _a2.forEach((disconnect2) => disconnect2());
1653
- execCallback(__privateGet$1(this, _unmountCallback));
1654
- (_b2 = this.unmounted) == null ? void 0 : _b2.call(this);
1655
- __privateSet$1(this, _effectList, __privateGet$1(this, _clearEffect).call(this, __privateGet$1(this, _effectList)));
1656
- __privateSet$1(this, _memoList, __privateGet$1(this, _clearEffect).call(this, __privateGet$1(this, _memoList)));
1657
- return __privateGet$1(_GemElement, _final);
1148
+ return k(this, B, !1), (t = l(this, te)) == null || t.forEach((s) => s()), Le(l(this, Yt)), (e = this.unmounted) == null || e.call(this), k(this, K, l(this, ne).call(this, l(this, K))), k(this, Q, l(this, ne).call(this, l(this, Q))), l(Tt, ft);
1658
1149
  }
1659
1150
  };
1660
- let GemElement = _GemElement;
1661
- _final = /* @__PURE__ */ new WeakMap();
1662
- _renderRoot = /* @__PURE__ */ new WeakMap();
1663
- _internals = /* @__PURE__ */ new WeakMap();
1664
- _isAppendReason = /* @__PURE__ */ new WeakMap();
1665
- _isMounted = /* @__PURE__ */ new WeakMap();
1666
- _isAsync = /* @__PURE__ */ new WeakMap();
1667
- _effectList = /* @__PURE__ */ new WeakMap();
1668
- _memoList = /* @__PURE__ */ new WeakMap();
1669
- _unmountCallback = /* @__PURE__ */ new WeakMap();
1670
- _exec = /* @__PURE__ */ new WeakMap();
1671
- _execEffect = /* @__PURE__ */ new WeakMap();
1672
- _execMemo = /* @__PURE__ */ new WeakMap();
1673
- _initEffect = /* @__PURE__ */ new WeakMap();
1674
- _render = /* @__PURE__ */ new WeakMap();
1675
- _shouldUpdate = /* @__PURE__ */ new WeakMap();
1676
- _updateCallback = /* @__PURE__ */ new WeakMap();
1677
- _update = /* @__PURE__ */ new WeakMap();
1678
- _updated = /* @__PURE__ */ new WeakMap();
1679
- _disconnectStore = /* @__PURE__ */ new WeakMap();
1680
- _connectedCallback = /* @__PURE__ */ new WeakMap();
1681
- _clearEffect = /* @__PURE__ */ new WeakMap();
1682
- __privateAdd$1(GemElement, _final, Symbol());
1683
- const gemElementProxyMap = new PropProxyMap();
1684
- function defineAttribute(target, prop, attr) {
1685
- const { booleanAttributes, numberAttributes } = target.constructor;
1686
- Object.defineProperty(target, prop, {
1687
- configurable: true,
1151
+ ft = /* @__PURE__ */ new WeakMap();
1152
+ Ct = /* @__PURE__ */ new WeakMap();
1153
+ Y = /* @__PURE__ */ new WeakMap();
1154
+ Pt = /* @__PURE__ */ new WeakMap();
1155
+ B = /* @__PURE__ */ new WeakMap();
1156
+ $t = /* @__PURE__ */ new WeakMap();
1157
+ K = /* @__PURE__ */ new WeakMap();
1158
+ Q = /* @__PURE__ */ new WeakMap();
1159
+ Yt = /* @__PURE__ */ new WeakMap();
1160
+ Qt = /* @__PURE__ */ new WeakMap();
1161
+ We = /* @__PURE__ */ new WeakMap();
1162
+ Ie = /* @__PURE__ */ new WeakMap();
1163
+ Ve = /* @__PURE__ */ new WeakMap();
1164
+ Xt = /* @__PURE__ */ new WeakMap();
1165
+ De = /* @__PURE__ */ new WeakMap();
1166
+ Zt = /* @__PURE__ */ new WeakMap();
1167
+ it = /* @__PURE__ */ new WeakMap();
1168
+ qe = /* @__PURE__ */ new WeakMap();
1169
+ te = /* @__PURE__ */ new WeakMap();
1170
+ ee = /* @__PURE__ */ new WeakMap();
1171
+ ne = /* @__PURE__ */ new WeakMap();
1172
+ w(ts, ft, Symbol());
1173
+ let A = ts;
1174
+ const le = new Us();
1175
+ function nn(n, t, e) {
1176
+ const { booleanAttributes: s, numberAttributes: i } = n.constructor;
1177
+ Object.defineProperty(n, t, {
1178
+ configurable: !0,
1688
1179
  get() {
1689
- if (!(initSymbol in this))
1180
+ if (!(he in this))
1690
1181
  return;
1691
- const that = this;
1692
- const value = that.getAttribute(attr);
1693
- if (booleanAttributes == null ? void 0 : booleanAttributes.has(attr)) {
1694
- return value === null ? false : true;
1695
- }
1696
- if (numberAttributes == null ? void 0 : numberAttributes.has(attr)) {
1697
- return Number(value);
1698
- }
1699
- return value || "";
1182
+ const o = this.getAttribute(e);
1183
+ return s != null && s.has(e) ? o !== null : i != null && i.has(e) ? Number(o) : o || "";
1700
1184
  },
1701
- set(v) {
1702
- const that = this;
1703
- const proxy = gemElementProxyMap.get(this);
1704
- const hasSet = proxy[prop];
1705
- const value = that.getAttribute(attr);
1706
- if (this[initSymbol] && value !== null && !hasSet)
1185
+ set(r) {
1186
+ const o = this, a = le.get(this), c = a[t], h = o.getAttribute(e);
1187
+ if (this[he] && h !== null && !c)
1707
1188
  return;
1708
- proxy[prop] = true;
1709
- const isBool = booleanAttributes == null ? void 0 : booleanAttributes.has(attr);
1710
- if (v === null || v === void 0) {
1711
- that.removeAttribute(attr);
1712
- } else if (isBool) {
1713
- that.toggleAttribute(attr, !!v);
1714
- } else {
1715
- if (value !== String(v))
1716
- that.setAttribute(attr, String(v));
1717
- }
1189
+ a[t] = !0;
1190
+ const p = s == null ? void 0 : s.has(e);
1191
+ r == null ? o.removeAttribute(e) : p ? o.toggleAttribute(e, !!r) : h !== String(r) && o.setAttribute(e, String(r));
1718
1192
  }
1719
1193
  });
1720
1194
  }
1721
- const isEventHandleSymbol = Symbol("event handle");
1722
- function defineProperty(target, prop, event, eventOptions) {
1723
- Object.defineProperty(target, prop, {
1724
- configurable: true,
1195
+ const Nn = Symbol("event handle");
1196
+ function Dt(n, t, e, s) {
1197
+ Object.defineProperty(n, t, {
1198
+ configurable: !0,
1725
1199
  get() {
1726
- const value = gemElementProxyMap.get(this)[prop];
1727
- if (value || !event) {
1728
- return value;
1729
- } else {
1730
- this[prop] = emptyFunction;
1731
- return this[prop];
1732
- }
1200
+ const i = le.get(this)[t];
1201
+ return i || !e ? i : (this[t] = Qs, this[t]);
1733
1202
  },
1734
- set(v) {
1735
- const that = this;
1736
- const proxy = gemElementProxyMap.get(that);
1737
- if (v !== proxy[prop]) {
1738
- if (event) {
1739
- proxy[prop] = (v == null ? void 0 : v[isEventHandleSymbol]) ? v : (detail, options) => {
1740
- const evt = new CustomEvent(event, { ...options, ...eventOptions, detail });
1741
- that.dispatchEvent(evt);
1742
- v(detail, options);
1743
- };
1744
- Reflect.set(proxy[prop], isEventHandleSymbol, true);
1745
- } else {
1746
- proxy[prop] = v;
1747
- this[updateSymbol]();
1748
- }
1749
- }
1203
+ set(i) {
1204
+ const r = this, o = le.get(r);
1205
+ i !== o[t] && (e ? (o[t] = i != null && i[Nn] ? i : (a, c) => {
1206
+ const h = new CustomEvent(e, { ...c, ...s, detail: a });
1207
+ r.dispatchEvent(h), i(a, c);
1208
+ }, Reflect.set(o[t], Nn, !0)) : (o[t] = i, this[Zn]()));
1750
1209
  }
1751
1210
  });
1752
1211
  }
1753
- function defineRef(target, prop, ref) {
1754
- Object.defineProperty(target, prop, {
1755
- configurable: true,
1212
+ function sn(n, t, e) {
1213
+ Object.defineProperty(n, t, {
1214
+ configurable: !0,
1756
1215
  get() {
1757
- const proxy = gemElementProxyMap.get(this);
1758
- let refobject2 = proxy[prop];
1759
- if (!refobject2) {
1760
- const that = this;
1761
- const ele = that.shadowRoot || that;
1762
- refobject2 = {
1216
+ const s = le.get(this);
1217
+ let i = s[t];
1218
+ if (!i) {
1219
+ const r = this, o = r.shadowRoot || r;
1220
+ i = {
1763
1221
  get ref() {
1764
- return ref;
1222
+ return e;
1765
1223
  },
1766
1224
  get element() {
1767
- const gemReflects = [...ele.querySelectorAll("[data-gem-reflect]")].map((e) => e.target);
1768
- for (const e of [ele, ...gemReflects]) {
1769
- const result = e.querySelector(`[ref=${ref}]`);
1770
- if (result)
1771
- return result;
1225
+ const a = [...o.querySelectorAll("[data-gem-reflect]")].map((c) => c.target);
1226
+ for (const c of [o, ...a]) {
1227
+ const h = c.querySelector(`[ref=${e}]`);
1228
+ if (h)
1229
+ return h;
1772
1230
  }
1773
1231
  }
1774
- };
1775
- proxy[prop] = refobject2;
1232
+ }, s[t] = i;
1776
1233
  }
1777
- return refobject2;
1234
+ return i;
1778
1235
  }
1779
1236
  });
1780
1237
  }
1781
- function defineCSSState(target, prop, state2) {
1782
- Object.defineProperty(target, prop, {
1783
- configurable: true,
1238
+ function rn(n, t, e) {
1239
+ Object.defineProperty(n, t, {
1240
+ configurable: !0,
1784
1241
  get() {
1785
- const that = this;
1786
- const { states } = that.internals;
1787
- return states == null ? void 0 : states.has(state2);
1242
+ const s = this, { states: i } = s.internals;
1243
+ return i == null ? void 0 : i.has(e);
1788
1244
  },
1789
- set(v) {
1790
- const that = this;
1791
- const { states } = that.internals;
1792
- if (v) {
1793
- states == null ? void 0 : states.add(state2);
1794
- } else {
1795
- states == null ? void 0 : states.delete(state2);
1796
- }
1245
+ set(s) {
1246
+ const i = this, { states: r } = i.internals;
1247
+ s ? r == null || r.add(e) : r == null || r.delete(e);
1797
1248
  }
1798
1249
  });
1799
1250
  }
1800
- const nativeDefineElement = customElements.define.bind(customElements);
1801
- customElements.define = (name, cls, options) => {
1802
- if (cls.prototype instanceof GemElement) {
1803
- const { observedAttributes, observedProperties, defineEvents, defineCSSStates, defineRefs } = cls;
1804
- observedAttributes == null ? void 0 : observedAttributes.forEach((attr) => defineAttribute(cls.prototype, kebabToCamelCase(attr), attr));
1805
- observedProperties == null ? void 0 : observedProperties.forEach((prop) => defineProperty(cls.prototype, prop));
1806
- defineEvents == null ? void 0 : defineEvents.forEach((event) => defineProperty(cls.prototype, kebabToCamelCase(event), event));
1807
- defineCSSStates == null ? void 0 : defineCSSStates.forEach((state2) => defineCSSState(cls.prototype, kebabToCamelCase(state2), state2));
1808
- defineRefs == null ? void 0 : defineRefs.forEach((ref) => defineRef(cls.prototype, kebabToCamelCase(ref), ref));
1809
- }
1810
- nativeDefineElement(name, cls, options);
1811
- };
1812
- if (window.__GEM_DEVTOOLS__HOOK__) {
1813
- Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...GemExports, ...VersionExports });
1814
- }
1815
- function pushStaticField(target, field, member, isSet = false) {
1816
- const cls = target.constructor;
1817
- const current = cls[field];
1818
- if (!cls.hasOwnProperty(field)) {
1819
- Object.defineProperty(cls, field, {
1820
- value: isSet ? new Set(current) : current ? Array.from(current) : []
1821
- });
1251
+ const on = customElements.define.bind(customElements);
1252
+ customElements.define = (n, t, e) => {
1253
+ if (t.prototype instanceof A) {
1254
+ const { observedAttributes: s, observedProperties: i, defineEvents: r, defineCSSStates: o, defineRefs: a } = t;
1255
+ s == null || s.forEach((c) => nn(t.prototype, ot(c), c)), i == null || i.forEach((c) => Dt(t.prototype, c)), r == null || r.forEach((c) => Dt(t.prototype, ot(c), c)), o == null || o.forEach((c) => rn(t.prototype, ot(c), c)), a == null || a.forEach((c) => sn(t.prototype, ot(c), c));
1822
1256
  }
1823
- cls[field][isSet ? "add" : "push"](member);
1257
+ on(n, t, e);
1258
+ };
1259
+ window.__GEM_DEVTOOLS__HOOK__ && Object.assign(window.__GEM_DEVTOOLS__HOOK__, { ...Ts, ...zs });
1260
+ function D(n, t, e, s = !1) {
1261
+ const i = n.constructor, r = i[t];
1262
+ i.hasOwnProperty(t) || Object.defineProperty(i, t, {
1263
+ value: s ? new Set(r) : r ? Array.from(r) : []
1264
+ }), i[t][s ? "add" : "push"](e);
1824
1265
  }
1825
- function refobject(target, prop) {
1826
- const ref = `${camelToKebabCase(prop)}-${randomStr()}`;
1827
- pushStaticField(target, "defineRefs", ref);
1828
- defineRef(target, prop, ref);
1266
+ function zi(n, t) {
1267
+ const e = `${j(t)}-${ve()}`;
1268
+ D(n, "defineRefs", e), sn(n, t, e);
1829
1269
  }
1830
- function defineAttr(target, prop, attr) {
1831
- pushStaticField(target, "observedAttributes", attr);
1832
- defineAttribute(target, prop, attr);
1270
+ function an(n, t, e) {
1271
+ D(n, "observedAttributes", e), nn(n, t, e);
1833
1272
  }
1834
- function attribute(target, prop) {
1835
- defineAttr(target, prop, camelToKebabCase(prop));
1273
+ function C(n, t) {
1274
+ an(n, t, j(t));
1836
1275
  }
1837
- function boolattribute(target, prop) {
1838
- const attr = camelToKebabCase(prop);
1839
- pushStaticField(target, "booleanAttributes", attr, true);
1840
- defineAttr(target, prop, attr);
1276
+ function es(n, t) {
1277
+ const e = j(t);
1278
+ D(n, "booleanAttributes", e, !0), an(n, t, e);
1841
1279
  }
1842
- function numattribute(target, prop) {
1843
- const attr = camelToKebabCase(prop);
1844
- pushStaticField(target, "numberAttributes", attr, true);
1845
- defineAttr(target, prop, attr);
1280
+ function Ji(n, t) {
1281
+ const e = j(t);
1282
+ D(n, "numberAttributes", e, !0), an(n, t, e);
1846
1283
  }
1847
- function property(target, prop) {
1848
- pushStaticField(target, "observedProperties", prop);
1849
- defineProperty(target, prop);
1284
+ function N(n, t) {
1285
+ D(n, "observedProperties", t), Dt(n, t);
1850
1286
  }
1851
- function state(target, prop) {
1852
- const attr = camelToKebabCase(prop);
1853
- pushStaticField(target, "defineCSSStates", attr);
1854
- defineCSSState(target, prop, attr);
1287
+ function cn(n, t) {
1288
+ const e = j(t);
1289
+ D(n, "defineCSSStates", e), rn(n, t, e);
1855
1290
  }
1856
- function slot(target, prop) {
1857
- const attr = camelToKebabCase(target[prop] || prop);
1858
- target[prop] = attr;
1859
- pushStaticField(target instanceof GemElement ? target : target.prototype, "defineSlots", attr);
1291
+ function Yi(n, t) {
1292
+ const e = j(n[t] || t);
1293
+ n[t] = e, D(n instanceof A ? n : n.prototype, "defineSlots", e);
1860
1294
  }
1861
- function part(target, prop) {
1862
- const attr = camelToKebabCase(target[prop] || prop);
1863
- target[prop] = attr;
1864
- pushStaticField(target instanceof GemElement ? target : target.prototype, "defineParts", attr);
1295
+ function Xs(n, t) {
1296
+ const e = j(n[t] || t);
1297
+ n[t] = e, D(n instanceof A ? n : n.prototype, "defineParts", e);
1865
1298
  }
1866
- function emitter(target, prop) {
1867
- defineEmitter(target, prop);
1299
+ function Se(n, t) {
1300
+ ns(n, t);
1868
1301
  }
1869
- function globalemitter(target, prop) {
1870
- defineEmitter(target, prop, { bubbles: true, composed: true });
1302
+ function Qi(n, t) {
1303
+ ns(n, t, { bubbles: !0, composed: !0 });
1871
1304
  }
1872
- function defineEmitter(target, prop, options) {
1873
- const event = camelToKebabCase(prop);
1874
- pushStaticField(target, "defineEvents", event);
1875
- defineProperty(target, prop, event, options);
1305
+ function ns(n, t, e) {
1306
+ const s = j(t);
1307
+ D(n, "defineEvents", s), Dt(n, t, s, e);
1876
1308
  }
1877
- function adoptedStyle(style) {
1878
- return function(cls) {
1879
- const con = cls;
1880
- pushStaticField(con.prototype, "adoptedStyleSheets", style);
1309
+ function Xi(n) {
1310
+ return function(t) {
1311
+ D(t.prototype, "adoptedStyleSheets", n);
1881
1312
  };
1882
1313
  }
1883
- function connectStore(store2) {
1884
- return function(cls) {
1885
- const con = cls;
1886
- pushStaticField(con.prototype, "observedStores", store2);
1314
+ function hn(n) {
1315
+ return function(t) {
1316
+ D(t.prototype, "observedStores", n);
1887
1317
  };
1888
1318
  }
1889
- function rootElement(rootType) {
1890
- return function(cls) {
1891
- const con = cls;
1892
- con.rootElement = rootType;
1319
+ function Zi(n) {
1320
+ return function(t) {
1321
+ const e = t;
1322
+ e.rootElement = n;
1893
1323
  };
1894
1324
  }
1895
- function customElement(name) {
1896
- return function(cls) {
1897
- nativeDefineElement(name, cls);
1325
+ function tr(n) {
1326
+ return function(t) {
1327
+ on(n, t);
1898
1328
  };
1899
1329
  }
1900
- const nativeHistory = window.history;
1901
- const nativePushState = nativeHistory.pushState.bind(nativeHistory);
1902
- const nativeReplaceState = nativeHistory.replaceState.bind(nativeHistory);
1903
- let key = 0;
1904
- const getKey = () => `${performance.now()}-${++key}`;
1905
- const [store, updateHistoryStore] = useStore({
1906
- $hasCloseHandle: false,
1907
- $hasOpenHandle: false,
1908
- $hasShouldCloseHandle: false,
1330
+ const O = window.history, ss = O.pushState.bind(O), is = O.replaceState.bind(O);
1331
+ let Zs = 0;
1332
+ const ln = () => `${performance.now()}-${++Zs}`, [E, pt] = en({
1333
+ $hasCloseHandle: !1,
1334
+ $hasOpenHandle: !1,
1335
+ $hasShouldCloseHandle: !1,
1909
1336
  $key: ""
1910
- });
1911
- const paramsMap = /* @__PURE__ */ new Map();
1912
- function validData(data) {
1913
- const { $key, $hasCloseHandle, $hasOpenHandle, $hasShouldCloseHandle } = data || {};
1914
- if (store.$key === $key)
1915
- return;
1916
- if ($key)
1917
- throw new GemError("`$key` is not allowed");
1918
- if ($hasCloseHandle)
1919
- throw new GemError("`$hasCloseHandle` is not allowed");
1920
- if ($hasOpenHandle)
1921
- throw new GemError("`$hasOpenHandle` is not allowed");
1922
- if ($hasShouldCloseHandle)
1923
- throw new GemError("`$hasShouldCloseHandle` is not allowed");
1924
- }
1925
- function getUrlBarPath(internalPath) {
1926
- return gemHistory.basePath ? gemHistory.basePath + internalPath : internalPath;
1927
- }
1928
- function getInternalPath(urlBarPath) {
1929
- if (urlBarPath === gemHistory.basePath)
1930
- return "/";
1931
- return urlBarPath.replace(new RegExp(`^${gemHistory.basePath}/`), "/");
1932
- }
1933
- function dispatchBeforeChangeEvent() {
1934
- gemHistory.dispatchEvent(new CustomEvent("beforechange"));
1935
- }
1936
- function normalizeParams(params) {
1937
- var _a2, _b2;
1938
- const current = paramsMap.get(store.$key) || { path: getInternalPath(location.pathname), query: new QueryString() };
1939
- const path = params.path ? absoluteLocation(current.path, params.path) : getInternalPath(location.pathname);
1940
- const newQueryObject = new QueryString((_a2 = params.query) != null ? _a2 : params.path ? "" : location.search);
1941
- const queryChanged = String(newQueryObject) !== String(current.query);
1942
- const query = queryChanged ? newQueryObject : current.query;
1943
- const urlChanged = path !== current.path || queryChanged;
1944
- const title = params.title || (urlChanged ? "" : document.title);
1945
- const statusChanged = params.close || params.data || params.open || params.shouldClose;
1946
- const hash = decodeURIComponent((_b2 = params.hash) != null ? _b2 : !urlChanged && statusChanged ? location.hash : "");
1947
- return { ...params, title, path, query, hash };
1948
- }
1949
- function updateHistory(p, native) {
1950
- validData(p.data);
1951
- const params = normalizeParams(p);
1952
- const { title, path, query, hash, close, open: open2, shouldClose, data } = params;
1953
- const state2 = {
1954
- $hasCloseHandle: !!close,
1955
- $hasOpenHandle: !!open2,
1956
- $hasShouldCloseHandle: !!shouldClose,
1957
- $key: getKey(),
1958
- $title: title,
1959
- ...data
1960
- };
1961
- paramsMap.set(state2.$key, params);
1962
- dispatchBeforeChangeEvent();
1963
- cleanObject(store);
1964
- updateHistoryStore(state2);
1965
- const url = getUrlBarPath(path) + new QueryString(query) + hash;
1966
- const prevHash = decodeURIComponent(location.hash);
1967
- native(state2, title, url);
1968
- if (prevHash !== hash)
1969
- window.dispatchEvent(new CustomEvent("hashchange"));
1970
- }
1971
- function updateHistoryByNative(data, title, originUrl, native) {
1972
- validData(data);
1973
- const state2 = {
1974
- $key: getKey(),
1975
- $title: title,
1976
- ...data || {}
1337
+ }), $ = /* @__PURE__ */ new Map();
1338
+ function rs(n) {
1339
+ const { $key: t, $hasCloseHandle: e, $hasOpenHandle: s, $hasShouldCloseHandle: i } = n || {};
1340
+ if (E.$key !== t) {
1341
+ if (t)
1342
+ throw new tt("`$key` is not allowed");
1343
+ if (e)
1344
+ throw new tt("`$hasCloseHandle` is not allowed");
1345
+ if (s)
1346
+ throw new tt("`$hasOpenHandle` is not allowed");
1347
+ if (i)
1348
+ throw new tt("`$hasShouldCloseHandle` is not allowed");
1349
+ }
1350
+ }
1351
+ function os(n) {
1352
+ return R.basePath ? R.basePath + n : n;
1353
+ }
1354
+ function Ge(n) {
1355
+ return n === R.basePath ? "/" : n.replace(new RegExp(`^${R.basePath}/`), "/");
1356
+ }
1357
+ function un() {
1358
+ R.dispatchEvent(new CustomEvent("beforechange"));
1359
+ }
1360
+ function ue(n) {
1361
+ const t = $.get(E.$key) || { path: Ge(location.pathname), query: new It() }, e = n.path ? zn(t.path, n.path) : Ge(location.pathname), s = new It(n.query ?? (n.path ? "" : location.search)), i = String(s) !== String(t.query), r = i ? s : t.query, o = e !== t.path || i, a = n.title || (o ? "" : document.title), c = n.close || n.data || n.open || n.shouldClose, h = decodeURIComponent(n.hash ?? (!o && c ? location.hash : ""));
1362
+ return { ...n, title: a, path: e, query: r, hash: h };
1363
+ }
1364
+ function Mn(n, t) {
1365
+ rs(n.data);
1366
+ const e = ue(n), { title: s, path: i, query: r, hash: o, close: a, open: c, shouldClose: h, data: p } = e, u = {
1367
+ $hasCloseHandle: !!a,
1368
+ $hasOpenHandle: !!c,
1369
+ $hasShouldCloseHandle: !!h,
1370
+ $key: ln(),
1371
+ $title: s,
1372
+ ...p
1977
1373
  };
1978
- const { pathname, search, hash } = new URL(originUrl, location.origin + location.pathname);
1979
- const params = normalizeParams({ path: pathname, query: new QueryString(search), hash, title, data });
1980
- paramsMap.set(state2.$key, params);
1981
- dispatchBeforeChangeEvent();
1982
- cleanObject(store);
1983
- updateHistoryStore(state2);
1984
- const url = getUrlBarPath(pathname) + params.query + hash;
1985
- const prevHash = location.hash;
1986
- native(state2, title, url);
1987
- if (prevHash !== hash)
1988
- window.dispatchEvent(new CustomEvent("hashchange"));
1989
- }
1990
- const [gemBasePathStore, updateBasePathStore] = useStore({
1374
+ $.set(u.$key, e), un(), Ze(E), pt(u);
1375
+ const S = os(i) + new It(r) + o, d = decodeURIComponent(location.hash);
1376
+ t(u, s, S), d !== o && window.dispatchEvent(new CustomEvent("hashchange"));
1377
+ }
1378
+ function On(n, t, e, s) {
1379
+ rs(n);
1380
+ const i = {
1381
+ $key: ln(),
1382
+ $title: t,
1383
+ ...n || {}
1384
+ }, { pathname: r, search: o, hash: a } = new URL(e, location.origin + location.pathname), c = ue({ path: r, query: new It(o), hash: a, title: t, data: n });
1385
+ $.set(i.$key, c), un(), Ze(E), pt(i);
1386
+ const h = os(r) + c.query + a, p = location.hash;
1387
+ s(i, t, h), p !== a && window.dispatchEvent(new CustomEvent("hashchange"));
1388
+ }
1389
+ const [as, ti] = en({
1991
1390
  basePath: ""
1992
1391
  });
1993
- class GemHistory extends EventTarget {
1392
+ class ei extends EventTarget {
1994
1393
  get store() {
1995
- return store;
1394
+ return E;
1996
1395
  }
1997
1396
  get currentKey() {
1998
- return store.$key;
1397
+ return E.$key;
1999
1398
  }
2000
1399
  get basePath() {
2001
- return gemBasePathStore.basePath;
1400
+ return as.basePath;
2002
1401
  }
2003
- set basePath(basePath) {
2004
- updateBasePathStore({ basePath });
2005
- Object.assign(paramsMap.get(store.$key), { path: getInternalPath(location.pathname) });
1402
+ set basePath(t) {
1403
+ ti({ basePath: t }), Object.assign($.get(E.$key), { path: Ge(location.pathname) });
2006
1404
  }
2007
1405
  getParams() {
2008
- return paramsMap.get(store.$key);
1406
+ return $.get(E.$key);
2009
1407
  }
2010
- updateParams(params) {
2011
- Object.assign(paramsMap.get(store.$key), params);
2012
- updateHistoryStore();
1408
+ updateParams(t) {
1409
+ Object.assign($.get(E.$key), t), pt();
2013
1410
  }
2014
- push(params) {
2015
- updateHistory(params, nativePushState);
1411
+ push(t) {
1412
+ Mn(t, ss);
2016
1413
  }
2017
- replace(params) {
2018
- updateHistory(params, nativeReplaceState);
1414
+ replace(t) {
1415
+ Mn(t, is);
2019
1416
  }
2020
- pushIgnoreCloseHandle(params) {
2021
- var _a2, _b2;
2022
- if (store.$hasCloseHandle) {
2023
- (_b2 = (_a2 = paramsMap.get(store.$key)) == null ? void 0 : _a2.close) == null ? void 0 : _b2.call(_a2);
2024
- this.replace(params);
2025
- } else {
2026
- this.push(params);
2027
- }
1417
+ pushIgnoreCloseHandle(t) {
1418
+ var e, s;
1419
+ E.$hasCloseHandle ? ((s = (e = $.get(E.$key)) == null ? void 0 : e.close) == null || s.call(e), this.replace(t)) : this.push(t);
2028
1420
  }
2029
1421
  forward() {
2030
- nativeHistory.forward();
1422
+ O.forward();
2031
1423
  }
2032
1424
  back() {
2033
- nativeHistory.back();
1425
+ O.back();
2034
1426
  }
2035
1427
  }
2036
- const gemHistory = new GemHistory();
2037
- const [gemTitleStore, updateTitleStore] = useStore({ title: "" });
2038
- const _GEMHISTORY = { history: gemHistory, titleStore: gemTitleStore, basePathStore: gemBasePathStore };
1428
+ const R = new ei(), [se, ni] = en({ title: "" }), si = { history: R, titleStore: se, basePathStore: as };
2039
1429
  if (!window._GEMHISTORY) {
2040
- window._GEMHISTORY = _GEMHISTORY;
2041
- nativeHistory.pushState = function(state2, title, path) {
2042
- updateHistoryByNative(state2, title, path, nativePushState);
2043
- };
2044
- nativeHistory.replaceState = function(state2, title, path) {
2045
- updateHistoryByNative(state2, title, path, nativeReplaceState);
2046
- };
2047
- window.addEventListener("hashchange", ({ isTrusted }) => {
2048
- if (isTrusted) {
2049
- gemHistory.replace({ hash: location.hash });
2050
- }
2051
- });
2052
- if (!nativeHistory.state) {
2053
- const { pathname, search, hash } = location;
2054
- gemHistory.replace({ path: pathname, query: search, hash });
2055
- } else if (nativeHistory.state.$hasCloseHandle) {
2056
- updateHistoryStore(nativeHistory.state);
2057
- const params = normalizeParams({ title: document.title });
2058
- paramsMap.set(store.$key, params);
2059
- gemHistory.back();
2060
- } else {
2061
- const params = normalizeParams({ title: document.title, hash: location.hash });
2062
- updateHistoryStore({
2063
- $key: getKey(),
2064
- ...nativeHistory.state || {}
2065
- });
2066
- paramsMap.set(store.$key, params);
2067
- }
2068
- connect(gemTitleStore, () => {
2069
- const params = paramsMap.get(store.$key);
2070
- if (params) {
2071
- params.title = gemTitleStore.title;
2072
- }
2073
- });
2074
- connect(store, () => {
2075
- const { title } = gemHistory.getParams();
2076
- if (title !== gemTitleStore.title) {
2077
- updateTitleStore({ title });
2078
- }
1430
+ if (window._GEMHISTORY = si, O.pushState = function(t, e, s) {
1431
+ On(t, e, s, ss);
1432
+ }, O.replaceState = function(t, e, s) {
1433
+ On(t, e, s, is);
1434
+ }, window.addEventListener("hashchange", ({ isTrusted: t }) => {
1435
+ t && R.replace({ hash: location.hash });
1436
+ }), O.state)
1437
+ if (O.state.$hasCloseHandle) {
1438
+ pt(O.state);
1439
+ const t = ue({ title: document.title });
1440
+ $.set(E.$key, t), R.back();
1441
+ } else {
1442
+ const t = ue({ title: document.title, hash: location.hash });
1443
+ pt({
1444
+ $key: ln(),
1445
+ ...O.state || {}
1446
+ }), $.set(E.$key, t);
1447
+ }
1448
+ else {
1449
+ const { pathname: t, search: e, hash: s } = location;
1450
+ R.replace({ path: t, query: e, hash: s });
1451
+ }
1452
+ ct(se, () => {
1453
+ const t = $.get(E.$key);
1454
+ t && (t.title = se.title);
1455
+ }), ct(E, () => {
1456
+ const { title: t } = R.getParams();
1457
+ t !== se.title && ni({ title: t });
2079
1458
  });
2080
- let navigating = false;
2081
- window.addEventListener("popstate", (event) => {
2082
- var _a2, _b2;
2083
- const newState = event.state;
2084
- if (!(newState == null ? void 0 : newState.$key)) {
1459
+ let n = !1;
1460
+ window.addEventListener("popstate", (t) => {
1461
+ var r, o;
1462
+ const e = t.state;
1463
+ if (!(e != null && e.$key))
2085
1464
  return;
2086
- }
2087
- if (navigating) {
2088
- navigating = false;
1465
+ if (n) {
1466
+ n = !1;
2089
1467
  return;
2090
1468
  }
2091
- if (!paramsMap.has(newState.$key)) {
2092
- const { pathname, search, hash } = location;
2093
- paramsMap.set(newState.$key, {
2094
- path: pathname,
2095
- query: new QueryString(search),
2096
- hash: decodeURIComponent(hash),
2097
- title: newState.$title,
2098
- data: newState
1469
+ if (!$.has(e.$key)) {
1470
+ const { pathname: a, search: c, hash: h } = location;
1471
+ $.set(e.$key, {
1472
+ path: a,
1473
+ query: new It(c),
1474
+ hash: decodeURIComponent(h),
1475
+ title: e.$title,
1476
+ // document.title 是导航前的
1477
+ data: e
2099
1478
  });
2100
1479
  }
2101
- const prevState = store;
2102
- const isForward = parseFloat(newState.$key) > parseFloat(prevState.$key);
2103
- if (isForward && newState.$hasOpenHandle) {
2104
- (_b2 = (_a2 = paramsMap.get(newState.$key)) == null ? void 0 : _a2.open) == null ? void 0 : _b2.call(_a2);
2105
- } else if (prevState.$hasCloseHandle) {
2106
- const prevParams = paramsMap.get(prevState.$key);
2107
- const closeHandle = prevParams == null ? void 0 : prevParams.close;
2108
- const shouldCloseHandle = prevParams == null ? void 0 : prevParams.shouldClose;
2109
- const notAllowClose = shouldCloseHandle && !shouldCloseHandle();
2110
- if (notAllowClose) {
2111
- navigating = true;
2112
- gemHistory.forward();
1480
+ const s = E;
1481
+ if (parseFloat(e.$key) > parseFloat(s.$key) && e.$hasOpenHandle)
1482
+ (o = (r = $.get(e.$key)) == null ? void 0 : r.open) == null || o.call(r);
1483
+ else if (s.$hasCloseHandle) {
1484
+ const a = $.get(s.$key), c = a == null ? void 0 : a.close, h = a == null ? void 0 : a.shouldClose;
1485
+ if (h && !h()) {
1486
+ n = !0, R.forward();
2113
1487
  return;
2114
- } else {
2115
- if (closeHandle) {
2116
- closeHandle();
2117
- } else if (newState.$hasCloseHandle) {
2118
- navigating = true;
2119
- gemHistory.back();
2120
- }
2121
- }
1488
+ } else
1489
+ c ? c() : e.$hasCloseHandle && (n = !0, R.back());
2122
1490
  }
2123
- dispatchBeforeChangeEvent();
2124
- cleanObject(store);
2125
- updateHistoryStore(newState);
1491
+ un(), Ze(E), pt(e);
2126
1492
  });
2127
1493
  }
2128
- const { history, titleStore, basePathStore } = window._GEMHISTORY;
2129
- var __defProp$6 = Object.defineProperty;
2130
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
2131
- var __decorateClass$6 = (decorators, target, key2, kind) => {
2132
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key2) : target;
2133
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2134
- if (decorator = decorators[i])
2135
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2136
- if (kind && result)
2137
- __defProp$6(target, key2, result);
2138
- return result;
2139
- };
2140
- var __accessCheck2 = (obj, member, msg) => {
2141
- if (!member.has(obj))
2142
- throw TypeError("Cannot " + msg);
2143
- };
2144
- var __privateGet2 = (obj, member, getter) => {
2145
- __accessCheck2(obj, member, "read from private field");
2146
- return getter ? getter.call(obj) : member.get(obj);
2147
- };
2148
- var __privateAdd2 = (obj, member, value) => {
2149
- if (member.has(obj))
1494
+ const { history: y, titleStore: qt, basePathStore: ii } = window._GEMHISTORY;
1495
+ var ri = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, q = (n, t, e, s) => {
1496
+ for (var i = s > 1 ? void 0 : s ? oi(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1497
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1498
+ return s && i && ri(t, e, i), i;
1499
+ }, cs = (n, t, e) => {
1500
+ if (!t.has(n))
1501
+ throw TypeError("Cannot " + e);
1502
+ }, W = (n, t, e) => (cs(n, t, "read from private field"), e ? e.call(n) : t.get(n)), vt = (n, t, e) => {
1503
+ if (t.has(n))
2150
1504
  throw TypeError("Cannot add the same private member more than once");
2151
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2152
- };
2153
- var __privateSet2 = (obj, member, value, setter) => {
2154
- __accessCheck2(obj, member, "write to private field");
2155
- setter ? setter.call(obj, value) : member.set(obj, value);
2156
- return value;
2157
- };
2158
- var _lastLoader, _scrollContainer, scrollContainer_get, _updateLocationStore, _updateScrollContainerPosition, _setContent;
2159
- class ParamsRegExp extends RegExp {
2160
- constructor(pattern) {
2161
- const namePosition = {};
2162
- let i = 0;
1505
+ t instanceof WeakSet ? t.add(n) : t.set(n, e);
1506
+ }, Rn = (n, t, e, s) => (cs(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), kt, rt, ut, ie, je, re;
1507
+ const hs = "_";
1508
+ class ai extends RegExp {
1509
+ constructor(t) {
1510
+ let e = 0;
2163
1511
  super(
2164
- `^${pattern.replace(/:([^/$]+)/g, (_m, name) => {
2165
- namePosition[name] = i++;
2166
- return `([^/]+)`;
2167
- }).replace("*", ".*")}$`,
2168
- "i"
1512
+ `^${t.replace(/((:[^/$]+)|(\*))/g, (s, i) => i === "*" ? `(?<${hs}${e++}>.*)` : `(?<${i.slice(1)}>[^/]+)`)}$`
2169
1513
  );
2170
- this.namePosition = namePosition;
2171
1514
  }
2172
1515
  }
2173
- function matchPath(pattern, path) {
1516
+ function ls(n, t) {
2174
1517
  if (window.URLPattern) {
2175
- const urLPattern = new window.URLPattern({ pathname: pattern });
2176
- const matchResult2 = urLPattern.exec({ pathname: path }) || urLPattern.exec({ pathname: `${path}/` });
2177
- if (!matchResult2)
2178
- return null;
2179
- return matchResult2.pathname.groups;
2180
- }
2181
- const reg = new ParamsRegExp(pattern);
2182
- const matchResult = path.match(reg) || `${path}/`.match(reg);
2183
- if (!matchResult)
2184
- return null;
2185
- const params = {};
2186
- if (matchResult) {
2187
- Object.keys(reg.namePosition).forEach((name) => {
2188
- params[name] = matchResult[reg.namePosition[name] + 1];
2189
- });
2190
- }
2191
- return params;
2192
- }
2193
- function createPath(route, options) {
2194
- let path = route.pattern;
2195
- const params = options == null ? void 0 : options.params;
2196
- if (params) {
2197
- Object.keys(params).forEach((key2) => {
2198
- path = path.replace(new RegExp(`:${key2}`, "g"), params[key2]);
2199
- });
1518
+ const r = new window.URLPattern({ pathname: n }), o = r.exec({ pathname: t }) || r.exec({ pathname: `${t}/` });
1519
+ return o ? o.pathname.groups : null;
2200
1520
  }
2201
- return path;
2202
- }
2203
- function createHistoryParams(route, options) {
2204
- const path = createPath(route, options);
1521
+ const e = new ai(n), s = t.match(e) || `${t}/`.match(e);
1522
+ if (!s)
1523
+ return null;
1524
+ const i = {};
1525
+ return s.groups && Object.entries(s.groups).forEach(([r, o]) => {
1526
+ i[r.startsWith(hs) ? r.slice(1) : r] = o;
1527
+ }), i;
1528
+ }
1529
+ function dn(n, t) {
1530
+ let e = 0, s = n.pattern.replaceAll("*", () => `:${e++}`);
1531
+ const i = t == null ? void 0 : t.params;
1532
+ return i && Object.keys(i).forEach((r) => {
1533
+ s = s.replace(new RegExp(`:${r}`, "g"), i[r]);
1534
+ }), s;
1535
+ }
1536
+ function ci(n, t) {
2205
1537
  return {
2206
- path,
2207
- ...options
1538
+ path: dn(n, t),
1539
+ ...t
2208
1540
  };
2209
1541
  }
2210
- const scrollPositionMap = /* @__PURE__ */ new Map();
2211
- const _GemRouteElement = class extends GemElement {
2212
- constructor({ isLight, routes } = {}) {
2213
- super({ isLight });
2214
- __privateAdd2(this, _scrollContainer);
2215
- this.trigger = history;
2216
- this.currentParams = {};
2217
- __privateAdd2(this, _lastLoader, void 0);
2218
- this.state = {
2219
- content: void 0
2220
- };
2221
- __privateAdd2(this, _updateLocationStore, () => {
1542
+ const Ne = G``, An = /* @__PURE__ */ new Map(), T = class us extends A {
1543
+ constructor({ isLight: t, routes: e } = {}) {
1544
+ super({ isLight: t }), vt(this, rt), this.trigger = y, this.currentParams = {}, vt(this, kt, void 0), this.state = {
1545
+ content: Ne
1546
+ }, vt(this, ie, () => {
2222
1547
  if (!this.locationStore)
2223
1548
  return;
2224
- const { path, query, hash, data } = history.getParams();
2225
- updateStore(this.locationStore, {
2226
- path,
1549
+ const { path: s, query: i, hash: r, data: o } = y.getParams();
1550
+ nt(this.locationStore, {
1551
+ path: s,
2227
1552
  params: this.currentParams,
2228
- query,
2229
- hash,
2230
- data
1553
+ query: i,
1554
+ hash: r,
1555
+ data: o
2231
1556
  });
2232
- });
2233
- __privateAdd2(this, _updateScrollContainerPosition, () => {
2234
- if (!__privateGet2(this, _scrollContainer, scrollContainer_get))
1557
+ }), vt(this, je, () => {
1558
+ if (!W(this, rt, ut))
2235
1559
  return;
2236
- const scrollTop = scrollPositionMap.get(history.currentKey);
2237
- if (scrollTop) {
2238
- __privateGet2(this, _scrollContainer, scrollContainer_get).scroll(0, scrollTop);
2239
- } else if (this.scrollIgnoreHash || !history.getParams().hash) {
2240
- __privateGet2(this, _scrollContainer, scrollContainer_get).scroll(0, 0);
2241
- }
2242
- });
2243
- __privateAdd2(this, _setContent, (route, params, content) => {
2244
- this.beforeroutechange(route);
2245
- __privateSet2(this, _lastLoader, void 0);
2246
- this.currentRoute = route;
2247
- this.currentParams = params;
2248
- const changeContent = async () => {
2249
- this.setState({ content });
2250
- __privateGet2(this, _updateLocationStore).call(this);
2251
- await Promise.resolve();
2252
- __privateGet2(this, _updateScrollContainerPosition).call(this);
2253
- this.routechange(this.currentRoute);
1560
+ const s = An.get(y.currentKey);
1561
+ s ? W(this, rt, ut).scroll(0, s) : (this.scrollIgnoreHash || !y.getParams().hash) && W(this, rt, ut).scroll(0, 0);
1562
+ }), vt(this, re, (s, i, r) => {
1563
+ this.beforeroutechange(s), Rn(this, kt, void 0), this.currentRoute = s, this.currentParams = i;
1564
+ const o = async () => {
1565
+ this.setState({ content: r }), W(this, ie).call(this), await Promise.resolve(), W(this, je).call(this), this.routechange(this.currentRoute);
2254
1566
  };
2255
- if (this.transition && "startViewTransition" in document) {
2256
- document.startViewTransition(() => changeContent());
2257
- } else {
2258
- changeContent();
2259
- }
2260
- });
2261
- this.update = () => {
2262
- const { route, params = {} } = _GemRouteElement.findRoute(this.routes, this.trigger.getParams().path);
2263
- const { redirect, content, getContent } = route || {};
2264
- if (redirect) {
2265
- this.trigger.replace({ path: redirect });
1567
+ this.transition && "startViewTransition" in document ? document.startViewTransition(() => o()) : o();
1568
+ }), this.update = () => {
1569
+ const { path: s, hash: i, query: r } = this.trigger.getParams(), { route: o, params: a = {} } = us.findRoute(this.routes, s), { redirect: c, content: h, getContent: p } = o || {};
1570
+ if (c) {
1571
+ this.trigger.replace({
1572
+ path: dn({ pattern: c }, { params: a }),
1573
+ query: r,
1574
+ hash: i
1575
+ });
2266
1576
  return;
2267
1577
  }
2268
- if (this.trigger === history) {
2269
- updateStore(titleStore, { title: route == null ? void 0 : route.title });
2270
- }
2271
- const contentOrLoader = content || (getContent == null ? void 0 : getContent(params));
2272
- this.loading(route);
2273
- if (contentOrLoader instanceof Promise) {
2274
- __privateSet2(this, _lastLoader, contentOrLoader);
2275
- const isSomeLoader = () => __privateGet2(this, _lastLoader) === contentOrLoader;
2276
- contentOrLoader.then((content2) => {
2277
- if (isSomeLoader())
2278
- __privateGet2(this, _setContent).call(this, route, params, content2);
2279
- }).catch((err) => {
2280
- if (isSomeLoader())
2281
- this.error(err);
1578
+ this.trigger === y && nt(qt, { title: o == null ? void 0 : o.title });
1579
+ const u = h || (p == null ? void 0 : p(a, this.shadowRoot || this));
1580
+ if (this.loading(o), u instanceof Promise) {
1581
+ Rn(this, kt, u);
1582
+ const S = () => W(this, kt) === u;
1583
+ u.then((d) => {
1584
+ S() && W(this, re).call(this, o, a, d);
1585
+ }).catch((d) => {
1586
+ S() && this.error(d);
2282
1587
  });
2283
1588
  return;
2284
1589
  }
2285
- __privateGet2(this, _setContent).call(this, route, params, contentOrLoader);
2286
- };
2287
- this.routes = routes;
1590
+ W(this, re).call(this, o, a, u);
1591
+ }, this.routes = this.routes || e;
2288
1592
  }
2289
1593
  mounted() {
2290
1594
  this.effect(
2291
1595
  () => {
2292
- if (!__privateGet2(this, _scrollContainer, scrollContainer_get))
2293
- return;
2294
- return addListener(
2295
- history,
2296
- "beforechange",
2297
- () => scrollPositionMap.set(history.currentKey, __privateGet2(this, _scrollContainer, scrollContainer_get).scrollTop)
2298
- );
1596
+ if (W(this, rt, ut))
1597
+ return Jn(
1598
+ y,
1599
+ "beforechange",
1600
+ () => An.set(y.currentKey, W(this, rt, ut).scrollTop)
1601
+ );
2299
1602
  },
2300
1603
  () => [this.scrollContainer]
2301
- );
2302
- this.effect(
2303
- () => connect(this.trigger.store, () => this.setState({})),
1604
+ ), this.effect(
1605
+ // 触发 this.#update
1606
+ () => ct(this.trigger.store, () => this.setState({})),
2304
1607
  () => [this.trigger]
2305
- );
2306
- this.effect(
2307
- ([key2, path], old) => {
2308
- if (old && key2 === old[0] && path === old[1]) {
2309
- __privateGet2(this, _updateLocationStore).call(this);
1608
+ ), this.effect(
1609
+ ([t, e], s) => {
1610
+ if (s && t === s[0] && e === s[1]) {
1611
+ W(this, ie).call(this);
2310
1612
  return;
2311
1613
  }
2312
1614
  this.update();
2313
1615
  },
2314
1616
  () => {
2315
- const { path, query, hash } = this.trigger.getParams();
2316
- return [this.key, path, query, hash];
1617
+ const { path: t, query: e, hash: s } = this.trigger.getParams();
1618
+ return [this.key, t, e, s];
2317
1619
  }
2318
1620
  );
2319
1621
  }
2320
1622
  shouldUpdate() {
2321
- return this.inert ? false : true;
1623
+ return !this.inert;
2322
1624
  }
2323
1625
  render() {
2324
- const { content } = this.state;
2325
- if (!this.shadowRoot)
2326
- return html`${content}`;
2327
- return html`
1626
+ const { content: t } = this.state;
1627
+ if (t !== void 0)
1628
+ return this.shadowRoot ? G`
2328
1629
  <style>
2329
1630
  :host(:where(:not([hidden]))),
2330
1631
  :not(:defined) {
2331
1632
  display: contents;
2332
1633
  }
2333
1634
  </style>
2334
- ${content != null ? content : html`<slot></slot>`}
2335
- `;
1635
+ ${t === Ne ? G`<slot></slot>` : t}
1636
+ ` : t === Ne ? void 0 : G`${t}`;
2336
1637
  }
2337
1638
  };
2338
- let GemRouteElement = _GemRouteElement;
2339
- _lastLoader = /* @__PURE__ */ new WeakMap();
2340
- _scrollContainer = /* @__PURE__ */ new WeakSet();
2341
- scrollContainer_get = function() {
2342
- return typeof this.scrollContainer === "function" ? this.scrollContainer() : this.scrollContainer;
1639
+ kt = /* @__PURE__ */ new WeakMap();
1640
+ rt = /* @__PURE__ */ new WeakSet();
1641
+ ut = function() {
1642
+ return typeof this.scrollContainer == "function" ? this.scrollContainer() : this.scrollContainer;
2343
1643
  };
2344
- _updateLocationStore = /* @__PURE__ */ new WeakMap();
2345
- _updateScrollContainerPosition = /* @__PURE__ */ new WeakMap();
2346
- _setContent = /* @__PURE__ */ new WeakMap();
2347
- GemRouteElement.createLocationStore = () => {
2348
- const { path, query, hash, data } = history.getParams();
2349
- return createStore({ path, query, hash, data, params: {} });
1644
+ ie = /* @__PURE__ */ new WeakMap();
1645
+ je = /* @__PURE__ */ new WeakMap();
1646
+ re = /* @__PURE__ */ new WeakMap();
1647
+ T.createLocationStore = () => {
1648
+ const { path: n, query: t, hash: e, data: s } = y.getParams();
1649
+ return Ft({ path: n, query: t, hash: e, data: s, params: {} });
2350
1650
  };
2351
- GemRouteElement.findRoute = (target = [], path) => {
2352
- let defaultRoute = null;
2353
- let routes;
2354
- if (target instanceof Array) {
2355
- routes = target;
2356
- } else {
2357
- routes = Object.values(target);
2358
- }
2359
- for (const route of routes) {
2360
- if ("*" === route.pattern) {
2361
- defaultRoute = route;
2362
- } else {
2363
- const params = matchPath(route.pattern, path);
2364
- if (params) {
2365
- return { route, params };
2366
- }
2367
- }
2368
- }
2369
- return { route: defaultRoute };
2370
- };
2371
- __decorateClass$6([
2372
- boolattribute
2373
- ], GemRouteElement.prototype, "transition", 2);
2374
- __decorateClass$6([
2375
- property
2376
- ], GemRouteElement.prototype, "routes", 2);
2377
- __decorateClass$6([
2378
- property
2379
- ], GemRouteElement.prototype, "locationStore", 2);
2380
- __decorateClass$6([
2381
- property
2382
- ], GemRouteElement.prototype, "key", 2);
2383
- __decorateClass$6([
2384
- emitter
2385
- ], GemRouteElement.prototype, "loading", 2);
2386
- __decorateClass$6([
2387
- emitter
2388
- ], GemRouteElement.prototype, "beforeroutechange", 2);
2389
- __decorateClass$6([
2390
- emitter
2391
- ], GemRouteElement.prototype, "routechange", 2);
2392
- __decorateClass$6([
2393
- emitter
2394
- ], GemRouteElement.prototype, "error", 2);
2395
- __decorateClass$6([
2396
- property
2397
- ], GemRouteElement.prototype, "scrollContainer", 2);
2398
- __decorateClass$6([
2399
- property
2400
- ], GemRouteElement.prototype, "scrollIgnoreHash", 2);
2401
- __decorateClass$6([
2402
- property
2403
- ], GemRouteElement.prototype, "trigger", 2);
2404
- class GemLightRouteElement extends GemRouteElement {
2405
- constructor(options = {}) {
2406
- super({ ...options, isLight: true });
2407
- }
2408
- }
2409
- var __defProp$5 = Object.defineProperty;
2410
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
2411
- var __decorateClass$5 = (decorators, target, key2, kind) => {
2412
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key2) : target;
2413
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2414
- if (decorator = decorators[i])
2415
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2416
- if (kind && result)
2417
- __defProp$5(target, key2, result);
2418
- return result;
1651
+ T.findRoute = (n = [], t) => {
1652
+ let e = null, s;
1653
+ n instanceof Array ? s = n : s = Object.values(n);
1654
+ for (const i of s)
1655
+ if (i.pattern === "*")
1656
+ e = i;
1657
+ else {
1658
+ const r = ls(i.pattern, t);
1659
+ if (r)
1660
+ return { route: i, params: r };
1661
+ }
1662
+ return { route: e };
2419
1663
  };
2420
- function isExternal(path) {
2421
- return !path.startsWith("/");
1664
+ q([
1665
+ es
1666
+ ], T.prototype, "transition", 2);
1667
+ q([
1668
+ N
1669
+ ], T.prototype, "routes", 2);
1670
+ q([
1671
+ N
1672
+ ], T.prototype, "locationStore", 2);
1673
+ q([
1674
+ N
1675
+ ], T.prototype, "key", 2);
1676
+ q([
1677
+ Se
1678
+ ], T.prototype, "loading", 2);
1679
+ q([
1680
+ Se
1681
+ ], T.prototype, "beforeroutechange", 2);
1682
+ q([
1683
+ Se
1684
+ ], T.prototype, "routechange", 2);
1685
+ q([
1686
+ Se
1687
+ ], T.prototype, "error", 2);
1688
+ q([
1689
+ N
1690
+ ], T.prototype, "scrollContainer", 2);
1691
+ q([
1692
+ N
1693
+ ], T.prototype, "scrollIgnoreHash", 2);
1694
+ q([
1695
+ N
1696
+ ], T.prototype, "trigger", 2);
1697
+ let ds = T;
1698
+ class hi extends ds {
1699
+ constructor(t = {}) {
1700
+ super({ ...t, isLight: !0 });
1701
+ }
1702
+ }
1703
+ var li = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, b = (n, t, e, s) => {
1704
+ for (var i = s > 1 ? void 0 : s ? ui(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1705
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1706
+ return s && i && li(t, e, i), i;
1707
+ }, di = (n, t, e) => {
1708
+ if (!t.has(n))
1709
+ throw TypeError("Cannot " + e);
1710
+ }, J = (n, t, e) => (di(n, t, "read from private field"), e ? e.call(n) : t.get(n)), St = (n, t, e) => {
1711
+ if (t.has(n))
1712
+ throw TypeError("Cannot add the same private member more than once");
1713
+ t instanceof WeakSet ? t.add(n) : t.set(n, e);
1714
+ }, dt, Lt, Fe, fs, Be, Ke, ze;
1715
+ function Hn(n) {
1716
+ return !n.startsWith("/");
2422
1717
  }
2423
- let GemLinkElement = (_a = class extends GemElement {
1718
+ let x = class extends A {
2424
1719
  constructor() {
2425
- super({ focusable: true });
2426
- __privateAdd(this, _routeOptions);
2427
- __privateAdd(this, _hint);
2428
- __privateAdd(this, _onClick, void 0);
2429
- __privateAdd(this, _preventDefault, void 0);
2430
- __privateAdd(this, _getHint, void 0);
2431
- __privateSet(this, _onClick, async () => {
2432
- var _a2;
2433
- const locationString = this.getLocationString();
2434
- if (!locationString)
1720
+ super({ focusable: !0 }), St(this, dt), St(this, Fe), St(this, Be, async () => {
1721
+ var i;
1722
+ const n = this.getLocationString();
1723
+ if (!n)
2435
1724
  return;
2436
- if (isExternal(locationString)) {
1725
+ if (Hn(n))
2437
1726
  switch (this.target) {
2438
1727
  case "_self":
2439
- window.location.href = locationString;
1728
+ window.location.href = n;
2440
1729
  return;
2441
1730
  case "_parent":
2442
- window.parent.location.href = locationString;
1731
+ window.parent.location.href = n;
2443
1732
  return;
2444
1733
  case "_top":
2445
- window.top.location.href = locationString;
1734
+ window.top.location.href = n;
2446
1735
  return;
2447
1736
  default:
2448
- window.open(locationString);
1737
+ window.open(n);
2449
1738
  return;
2450
1739
  }
2451
- }
2452
- const { path, query, hash } = history.getParams();
2453
- if (path + query + hash === locationString) {
2454
- return;
2455
- }
2456
- await ((_a2 = this.prepare) == null ? void 0 : _a2.call(this));
2457
- if (this.route) {
2458
- history.pushIgnoreCloseHandle({
2459
- ...createHistoryParams(this.route, __privateGet(this, _routeOptions, routeOptions_get)),
2460
- title: this.route.title || this.docTitle
2461
- });
2462
- } else if (this.href) {
2463
- const { pathname, search, hash: hash2 } = new URL(locationString, location.origin);
2464
- history.pushIgnoreCloseHandle({
2465
- path: pathname,
2466
- query: search,
2467
- hash: hash2,
2468
- title: this.docTitle
2469
- });
2470
- } else {
2471
- history.pushIgnoreCloseHandle({
2472
- path: this.path,
2473
- query: this.query,
2474
- hash: this.hash,
2475
- title: this.docTitle
2476
- });
2477
- }
2478
- });
2479
- __privateSet(this, _preventDefault, (e) => {
2480
- e.preventDefault();
2481
- });
2482
- __privateSet(this, _getHint, () => {
2483
- const locationString = this.getLocationString();
2484
- return isExternal(locationString) ? locationString : new URL(history.basePath + locationString, location.origin).toString();
2485
- });
2486
- this.addEventListener("click", __privateGet(this, _onClick));
1740
+ const { path: t, query: e, hash: s } = y.getParams();
1741
+ if (t + e + s !== n)
1742
+ if (await ((i = this.prepare) == null ? void 0 : i.call(this)), this.route)
1743
+ y.pushIgnoreCloseHandle({
1744
+ ...ci(this.route, J(this, dt, Lt)),
1745
+ title: this.route.title || this.docTitle
1746
+ });
1747
+ else if (this.href) {
1748
+ const { pathname: r, search: o, hash: a } = new URL(n, location.origin);
1749
+ y.pushIgnoreCloseHandle({
1750
+ path: r,
1751
+ query: o,
1752
+ hash: a,
1753
+ title: this.docTitle
1754
+ });
1755
+ } else
1756
+ y.pushIgnoreCloseHandle({
1757
+ path: this.path,
1758
+ query: this.query,
1759
+ hash: this.hash,
1760
+ title: this.docTitle
1761
+ });
1762
+ }), St(this, Ke, (n) => {
1763
+ n.preventDefault();
1764
+ }), St(this, ze, () => {
1765
+ const n = this.getLocationString();
1766
+ return Hn(n) ? n : new URL(y.basePath + n, location.origin).toString();
1767
+ }), this.addEventListener("click", J(this, Be));
2487
1768
  }
2488
1769
  render() {
2489
- return html`
1770
+ return G`
2490
1771
  <style>
2491
1772
  :host {
2492
1773
  /* link default style */
@@ -2504,201 +1785,168 @@ let GemLinkElement = (_a = class extends GemElement {
2504
1785
  </style>
2505
1786
  <a
2506
1787
  part=${this.link}
2507
- @click=${__privateGet(this, _preventDefault)}
2508
- href=${ifDefined(__privateGet(this, _hint, hint_get) === "off" ? void 0 : __privateGet(this, _getHint).call(this))}
1788
+ @click=${J(this, Ke)}
1789
+ href=${Qn(J(this, Fe, fs) === "off" ? void 0 : J(this, ze).call(this))}
2509
1790
  >
2510
1791
  <slot></slot>
2511
1792
  </a>
2512
1793
  `;
2513
1794
  }
1795
+ /**
1796
+ * 如果该元素是外部链接返回 URL,否则返回路径(不包含 basePath)
1797
+ */
2514
1798
  getLocationString() {
2515
- var _a2, _b2;
1799
+ var n, t;
2516
1800
  if (this.route) {
2517
- const queryProp = ((_a2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _a2.query) || "";
2518
- const hashProp = ((_b2 = __privateGet(this, _routeOptions, routeOptions_get)) == null ? void 0 : _b2.hash) || "";
2519
- return createPath(this.route, __privateGet(this, _routeOptions, routeOptions_get)) + queryProp + hashProp;
1801
+ const e = ((n = J(this, dt, Lt)) == null ? void 0 : n.query) || "", s = ((t = J(this, dt, Lt)) == null ? void 0 : t.hash) || "";
1802
+ return dn(this.route, J(this, dt, Lt)) + e + s;
2520
1803
  } else {
2521
- const url = this.href || this.path + this.query + this.hash;
2522
- const { path, query } = history.getParams();
2523
- if (url.startsWith("#")) {
2524
- return `${path}${query}${url}`;
2525
- } else if (url.startsWith("?")) {
2526
- return `${path}${url}`;
2527
- } else if (url.startsWith(".")) {
2528
- return absoluteLocation(path, url);
2529
- } else {
2530
- return url;
2531
- }
1804
+ const e = this.href || this.path + this.query + this.hash, { path: s, query: i } = y.getParams();
1805
+ return e.startsWith("#") ? `${s}${i}${e}` : e.startsWith("?") ? `${s}${e}` : e.startsWith(".") ? zn(s, e) : e;
2532
1806
  }
2533
1807
  }
2534
- }, _routeOptions = new WeakSet(), routeOptions_get = function() {
1808
+ };
1809
+ dt = /* @__PURE__ */ new WeakSet();
1810
+ Lt = function() {
2535
1811
  return this.routeOptions || this.options;
2536
- }, _hint = new WeakSet(), hint_get = function() {
1812
+ };
1813
+ Fe = /* @__PURE__ */ new WeakSet();
1814
+ fs = function() {
2537
1815
  return this.hint || "on";
2538
- }, _onClick = new WeakMap(), _preventDefault = new WeakMap(), _getHint = new WeakMap(), _a);
2539
- __decorateClass$5([
2540
- attribute
2541
- ], GemLinkElement.prototype, "href", 2);
2542
- __decorateClass$5([
2543
- attribute
2544
- ], GemLinkElement.prototype, "target", 2);
2545
- __decorateClass$5([
2546
- attribute
2547
- ], GemLinkElement.prototype, "path", 2);
2548
- __decorateClass$5([
2549
- attribute
2550
- ], GemLinkElement.prototype, "query", 2);
2551
- __decorateClass$5([
2552
- attribute
2553
- ], GemLinkElement.prototype, "hash", 2);
2554
- __decorateClass$5([
2555
- attribute
2556
- ], GemLinkElement.prototype, "docTitle", 2);
2557
- __decorateClass$5([
2558
- attribute
2559
- ], GemLinkElement.prototype, "hint", 2);
2560
- __decorateClass$5([
2561
- property
2562
- ], GemLinkElement.prototype, "route", 2);
2563
- __decorateClass$5([
2564
- property
2565
- ], GemLinkElement.prototype, "options", 2);
2566
- __decorateClass$5([
2567
- property
2568
- ], GemLinkElement.prototype, "routeOptions", 2);
2569
- __decorateClass$5([
2570
- property
2571
- ], GemLinkElement.prototype, "prepare", 2);
2572
- __decorateClass$5([
2573
- part
2574
- ], GemLinkElement.prototype, "link", 2);
2575
- GemLinkElement = __decorateClass$5([
2576
- connectStore(basePathStore)
2577
- ], GemLinkElement);
2578
- let GemActiveLinkElement = class extends GemLinkElement {
1816
+ };
1817
+ Be = /* @__PURE__ */ new WeakMap();
1818
+ Ke = /* @__PURE__ */ new WeakMap();
1819
+ ze = /* @__PURE__ */ new WeakMap();
1820
+ b([
1821
+ C
1822
+ ], x.prototype, "href", 2);
1823
+ b([
1824
+ C
1825
+ ], x.prototype, "target", 2);
1826
+ b([
1827
+ C
1828
+ ], x.prototype, "path", 2);
1829
+ b([
1830
+ C
1831
+ ], x.prototype, "query", 2);
1832
+ b([
1833
+ C
1834
+ ], x.prototype, "hash", 2);
1835
+ b([
1836
+ C
1837
+ ], x.prototype, "docTitle", 2);
1838
+ b([
1839
+ C
1840
+ ], x.prototype, "hint", 2);
1841
+ b([
1842
+ N
1843
+ ], x.prototype, "route", 2);
1844
+ b([
1845
+ N
1846
+ ], x.prototype, "options", 2);
1847
+ b([
1848
+ N
1849
+ ], x.prototype, "routeOptions", 2);
1850
+ b([
1851
+ N
1852
+ ], x.prototype, "prepare", 2);
1853
+ b([
1854
+ Xs
1855
+ ], x.prototype, "link", 2);
1856
+ x = b([
1857
+ hn(ii)
1858
+ ], x);
1859
+ let Ut = class extends x {
2579
1860
  constructor() {
2580
- super();
2581
- this.effect(() => {
2582
- const { path, query, hash } = history.getParams();
2583
- const isMatchPattern = this.pattern && matchPath(this.pattern, path);
2584
- this.active = !!isMatchPattern || path + query + hash === this.getLocationString();
1861
+ super(), this.effect(() => {
1862
+ const { path: n, query: t, hash: e } = y.getParams(), s = this.pattern && ls(this.pattern, n);
1863
+ this.active = !!s || n + t + e === this.getLocationString();
2585
1864
  });
2586
1865
  }
2587
1866
  };
2588
- __decorateClass$5([
2589
- attribute
2590
- ], GemActiveLinkElement.prototype, "pattern", 2);
2591
- __decorateClass$5([
2592
- state
2593
- ], GemActiveLinkElement.prototype, "active", 2);
2594
- GemActiveLinkElement = __decorateClass$5([
2595
- connectStore(history.store)
2596
- ], GemActiveLinkElement);
2597
- customElements.define("gem-link", GemLinkElement);
2598
- customElements.define("gem-active-link", GemActiveLinkElement);
2599
- customElements.define("gem-route", GemRouteElement);
2600
- customElements.define("gem-light-route", GemLightRouteElement);
2601
- var __defProp$4 = Object.defineProperty;
2602
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
2603
- var __decorateClass$4 = (decorators, target, key2, kind) => {
2604
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key2) : target;
2605
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2606
- if (decorator = decorators[i])
2607
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2608
- if (kind && result)
2609
- __defProp$4(target, key2, result);
2610
- return result;
1867
+ b([
1868
+ C
1869
+ ], Ut.prototype, "pattern", 2);
1870
+ b([
1871
+ cn
1872
+ ], Ut.prototype, "active", 2);
1873
+ Ut = b([
1874
+ hn(y.store)
1875
+ ], Ut);
1876
+ customElements.define("gem-link", x);
1877
+ customElements.define("gem-active-link", Ut);
1878
+ customElements.define("gem-route", ds);
1879
+ customElements.define("gem-light-route", hi);
1880
+ var fi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fn = (n, t, e, s) => {
1881
+ for (var i = s > 1 ? void 0 : s ? pi(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1882
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1883
+ return s && i && fi(t, e, i), i;
2611
1884
  };
2612
- const defaultTitle = document.title;
2613
- let documentTitle = "";
2614
- const setTitle = () => document.title = documentTitle;
2615
- function setDocumentTitle(str, prefix = "", suffix = "") {
2616
- const title = titleStore.title || str;
2617
- if (title && title !== defaultTitle) {
2618
- GemTitleElement.title = title;
2619
- documentTitle = prefix + GemTitleElement.title + suffix;
2620
- } else {
2621
- GemTitleElement.title = defaultTitle;
2622
- documentTitle = GemTitleElement.title;
2623
- }
2624
- addMicrotask(setTitle);
2625
- }
2626
- connect(titleStore, setDocumentTitle);
2627
- const PREFIX = `${defaultTitle} | `;
2628
- const SUFFIX = ` - ${defaultTitle}`;
2629
- const _GemTitleElement = class extends GemElement {
1885
+ const de = document.title;
1886
+ let Je = "";
1887
+ const gi = () => document.title = Je;
1888
+ function ps(n, t = "", e = "") {
1889
+ const s = qt.title || n;
1890
+ s && s !== de ? (Nt.title = s, Je = t + Nt.title + e) : (Nt.title = de, Je = Nt.title), I(gi);
1891
+ }
1892
+ ct(qt, ps);
1893
+ const mi = `${de} | `, yi = ` - ${de}`, ht = class gs extends A {
2630
1894
  constructor() {
2631
- super();
2632
- this.mounted = () => {
1895
+ super(), this.mounted = () => {
2633
1896
  this.effect(
2634
- () => !this.inert && connect(titleStore, this.update),
1897
+ () => !this.inert && ct(qt, this.update),
2635
1898
  () => [this.inert]
2636
1899
  );
2637
- };
2638
- new MutationObserver(() => this.update()).observe(this, {
2639
- characterData: true,
2640
- childList: true,
2641
- subtree: true
1900
+ }, new MutationObserver(() => this.update()).observe(this, {
1901
+ characterData: !0,
1902
+ childList: !0,
1903
+ subtree: !0
2642
1904
  });
2643
1905
  }
2644
- static setTitle(title) {
2645
- updateStore(titleStore, { title });
1906
+ static setTitle(t) {
1907
+ nt(qt, { title: t });
2646
1908
  }
2647
1909
  render() {
2648
- var _a2;
2649
- setDocumentTitle((_a2 = this.textContent) == null ? void 0 : _a2.trim(), this.prefix, this.suffix);
2650
- return html`${_GemTitleElement.title}`;
1910
+ var t;
1911
+ return ps((t = this.textContent) == null ? void 0 : t.trim(), this.prefix, this.suffix), G`${gs.title}`;
2651
1912
  }
2652
1913
  };
2653
- let GemTitleElement = _GemTitleElement;
2654
- GemTitleElement.title = document.title;
2655
- GemTitleElement.defaultPrefix = PREFIX;
2656
- GemTitleElement.defaultSuffix = SUFFIX;
2657
- __decorateClass$4([
2658
- attribute
2659
- ], GemTitleElement.prototype, "prefix", 2);
2660
- __decorateClass$4([
2661
- attribute
2662
- ], GemTitleElement.prototype, "suffix", 2);
2663
- __decorateClass$4([
2664
- boolattribute
2665
- ], GemTitleElement.prototype, "inert", 2);
2666
- customElements.define("gem-title", GemTitleElement);
2667
- var __defProp$3 = Object.defineProperty;
2668
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
2669
- var __decorateClass$3 = (decorators, target, key2, kind) => {
2670
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key2) : target;
2671
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2672
- if (decorator = decorators[i])
2673
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2674
- if (kind && result)
2675
- __defProp$3(target, key2, result);
2676
- return result;
1914
+ ht.title = document.title;
1915
+ ht.defaultPrefix = mi;
1916
+ ht.defaultSuffix = yi;
1917
+ fn([
1918
+ C
1919
+ ], ht.prototype, "prefix", 2);
1920
+ fn([
1921
+ C
1922
+ ], ht.prototype, "suffix", 2);
1923
+ fn([
1924
+ es
1925
+ ], ht.prototype, "inert", 2);
1926
+ let Nt = ht;
1927
+ customElements.define("gem-title", Nt);
1928
+ var wi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, Ee = (n, t, e, s) => {
1929
+ for (var i = s > 1 ? void 0 : s ? _i(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1930
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1931
+ return s && i && wi(t, e, i), i;
2677
1932
  };
2678
- const eleCache = /* @__PURE__ */ new Map();
2679
- class GemUseElement extends GemElement {
1933
+ const Wn = /* @__PURE__ */ new Map();
1934
+ var jt;
1935
+ class Bt extends A {
2680
1936
  constructor() {
2681
1937
  super(...arguments);
2682
- __privateAdd(this, _getContent, void 0);
2683
- __privateSet(this, _getContent, () => {
2684
- const ele = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
2685
- if (typeof ele === "string") {
2686
- let temp = eleCache.get(ele);
2687
- if (!temp) {
2688
- temp = document.createElement("template");
2689
- temp.innerHTML = ele;
2690
- eleCache.set(ele, temp);
2691
- }
2692
- return temp.content.cloneNode(true);
2693
- } else if (ele instanceof HTMLTemplateElement) {
2694
- return ele.content.cloneNode(true);
2695
- } else {
2696
- return ele == null ? void 0 : ele.cloneNode(true);
2697
- }
1938
+ P(this, jt, void 0);
1939
+ F(this, jt, () => {
1940
+ const e = this.element || (this.selector ? (this.root || document).querySelector(this.selector) : null);
1941
+ if (typeof e == "string") {
1942
+ let s = Wn.get(e);
1943
+ return s || (s = document.createElement("template"), s.innerHTML = e, Wn.set(e, s)), s.content.cloneNode(!0);
1944
+ } else
1945
+ return e instanceof HTMLTemplateElement ? e.content.cloneNode(!0) : e == null ? void 0 : e.cloneNode(!0);
2698
1946
  });
2699
1947
  }
2700
1948
  render() {
2701
- return html`
1949
+ return G`
2702
1950
  <style>
2703
1951
  :host(:where(:not([hidden]))) {
2704
1952
  position: relative;
@@ -2710,43 +1958,35 @@ class GemUseElement extends GemElement {
2710
1958
  height: 100%;
2711
1959
  }
2712
1960
  </style>
2713
- ${__privateGet(this, _getContent).call(this)}
1961
+ ${g(this, jt).call(this)}
2714
1962
  <slot></slot>
2715
1963
  `;
2716
1964
  }
2717
1965
  }
2718
- _getContent = new WeakMap();
2719
- __decorateClass$3([
2720
- attribute
2721
- ], GemUseElement.prototype, "selector", 2);
2722
- __decorateClass$3([
2723
- property
2724
- ], GemUseElement.prototype, "root", 2);
2725
- __decorateClass$3([
2726
- property
2727
- ], GemUseElement.prototype, "element", 2);
2728
- __decorateClass$3([
2729
- state
2730
- ], GemUseElement.prototype, "active", 2);
2731
- customElements.define("gem-use", GemUseElement);
2732
- var __defProp$2 = Object.defineProperty;
2733
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
2734
- var __decorateClass$2 = (decorators, target, key2, kind) => {
2735
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key2) : target;
2736
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2737
- if (decorator = decorators[i])
2738
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2739
- if (kind && result)
2740
- __defProp$2(target, key2, result);
2741
- return result;
1966
+ jt = new WeakMap();
1967
+ Ee([
1968
+ C
1969
+ ], Bt.prototype, "selector", 2);
1970
+ Ee([
1971
+ N
1972
+ ], Bt.prototype, "root", 2);
1973
+ Ee([
1974
+ N
1975
+ ], Bt.prototype, "element", 2);
1976
+ Ee([
1977
+ cn
1978
+ ], Bt.prototype, "active", 2);
1979
+ customElements.define("gem-use", Bt);
1980
+ var vi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, ms = (n, t, e, s) => {
1981
+ for (var i = s > 1 ? void 0 : s ? Si(t, e) : t, r = n.length - 1, o; r >= 0; r--)
1982
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
1983
+ return s && i && vi(t, e, i), i;
2742
1984
  };
2743
- class GemUnsafeElement extends GemElement {
1985
+ class pn extends A {
2744
1986
  constructor() {
2745
- super();
2746
- this.effect(
1987
+ super(), this.effect(
2747
1988
  () => {
2748
- if (this.shadowRoot) {
2749
- this.shadowRoot.innerHTML = `
1989
+ this.shadowRoot && (this.shadowRoot.innerHTML = `
2750
1990
  <style>
2751
1991
  :host(:where(:not([hidden]))) {
2752
1992
  display: contents;
@@ -2754,421 +1994,318 @@ class GemUnsafeElement extends GemElement {
2754
1994
  ${this.contentcss}
2755
1995
  </style>
2756
1996
  ${this.content}
2757
- `;
2758
- }
1997
+ `);
2759
1998
  },
2760
1999
  () => [this.content, this.contentcss]
2761
2000
  );
2762
2001
  }
2763
2002
  render() {
2764
- return void 0;
2765
- }
2766
- }
2767
- __decorateClass$2([
2768
- attribute
2769
- ], GemUnsafeElement.prototype, "content", 2);
2770
- __decorateClass$2([
2771
- attribute
2772
- ], GemUnsafeElement.prototype, "contentcss", 2);
2773
- customElements.define("gem-unsafe", GemUnsafeElement);
2774
- var __defProp$1 = Object.defineProperty;
2775
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
2776
- var __decorateClass$1 = (decorators, target, key2, kind) => {
2777
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key2) : target;
2778
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2779
- if (decorator = decorators[i])
2780
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2781
- if (kind && result)
2782
- __defProp$1(target, key2, result);
2783
- return result;
2003
+ }
2004
+ }
2005
+ ms([
2006
+ C
2007
+ ], pn.prototype, "content", 2);
2008
+ ms([
2009
+ C
2010
+ ], pn.prototype, "contentcss", 2);
2011
+ customElements.define("gem-unsafe", pn);
2012
+ var Ei = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, ys = (n, t, e, s) => {
2013
+ for (var i = s > 1 ? void 0 : s ? xi(t, e) : t, r = n.length - 1, o; r >= 0; r--)
2014
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
2015
+ return s && i && Ei(t, e, i), i;
2784
2016
  };
2785
- const START = "gem-reflect-start";
2786
- const END = "gem-reflect-end";
2787
- const createReflectFragmentTag = (tag) => new Comment(tag);
2788
- const getReflectFragment = (startNode) => {
2789
- const result = [];
2790
- let node = startNode;
2791
- while (node) {
2792
- result.push(node);
2793
- if (node.nodeValue === END)
2794
- break;
2795
- node = node.nextSibling;
2796
- }
2797
- return result;
2017
+ const bi = "gem-reflect-start", ws = "gem-reflect-end", In = (n) => new Comment(n), Ci = (n) => {
2018
+ const t = [];
2019
+ let e = n;
2020
+ for (; e && (t.push(e), e.nodeValue !== ws); )
2021
+ e = e.nextSibling;
2022
+ return t;
2798
2023
  };
2799
- class GemReflectElement extends GemElement {
2024
+ var ge, _s;
2025
+ class gn extends A {
2800
2026
  constructor() {
2801
- super({ isLight: true });
2802
- this.target = document.head;
2803
- this.effect(
2027
+ super({ isLight: !0 });
2028
+ P(this, ge);
2029
+ this.target = document.head, this.effect(
2804
2030
  () => {
2805
- this.hidden = true;
2806
- this.dataset.gemReflect = "";
2031
+ this.hidden = !0, this.dataset.gemReflect = "";
2807
2032
  },
2808
2033
  () => []
2809
2034
  );
2810
- const startNode = createReflectFragmentTag(START);
2811
- const endNode = createReflectFragmentTag(END);
2812
- let childNodes;
2035
+ const e = In(bi), s = In(ws);
2036
+ let i;
2813
2037
  this.effect(
2814
- () => {
2815
- if (!childNodes) {
2816
- [startNode, ...this.childNodes, endNode].forEach((node) => this.target.append(node));
2817
- } else {
2818
- childNodes.forEach((node) => this.target.append(node));
2819
- }
2820
- return () => {
2821
- childNodes = getReflectFragment(startNode);
2822
- childNodes.forEach((node) => node.remove());
2823
- };
2824
- },
2038
+ () => ((i || [e, ...this.childNodes, s]).forEach((r, o, a) => {
2039
+ const c = a[o - 1];
2040
+ c ? c.after(r) : this.target[g(this, ge, _s)](r);
2041
+ }), () => {
2042
+ i = Ci(e), i.forEach((r) => r.remove());
2043
+ }),
2825
2044
  () => [this.target]
2826
2045
  );
2827
2046
  }
2828
2047
  }
2829
- __decorateClass$1([
2830
- property
2831
- ], GemReflectElement.prototype, "target", 2);
2832
- customElements.define("gem-reflect", GemReflectElement);
2833
- const open = Symbol("open mark");
2834
- function createModalClass(options) {
2835
- var _a2;
2836
- const final2 = Symbol();
2837
- return _a2 = class extends GemElement {
2048
+ ge = new WeakSet(), _s = function() {
2049
+ return this.method || "append";
2050
+ };
2051
+ ys([
2052
+ C
2053
+ ], gn.prototype, "method", 2);
2054
+ ys([
2055
+ N
2056
+ ], gn.prototype, "target", 2);
2057
+ customElements.define("gem-reflect", gn);
2058
+ const zt = Symbol("open mark");
2059
+ function er(n) {
2060
+ var t;
2061
+ const e = Symbol();
2062
+ return t = class extends A {
2838
2063
  constructor() {
2839
- super();
2840
- this.label = "";
2841
- this.internals.role = "alertdialog";
2842
- this.internals.ariaModal = "true";
2064
+ super(), this.label = "", this.internals.role = "alertdialog", this.internals.ariaModal = "true";
2843
2065
  }
2066
+ /**@final */
2844
2067
  static get isOpen() {
2845
- return this.store[open];
2068
+ return this.store[zt];
2846
2069
  }
2070
+ /**@final */
2847
2071
  static get observedStores() {
2848
- return [history.store, this.store];
2849
- }
2850
- static open(opts) {
2851
- const instance = new this();
2852
- this.instance = instance;
2853
- this.inertStore = [...document.body.children].filter((e) => !e.inert);
2854
- this.inertStore.forEach((e) => e.inert = true);
2855
- document.body.append(instance);
2856
- const changeStore = () => updateStore(this.store, { [open]: true, ...opts });
2857
- setTimeout(() => {
2858
- changeStore();
2859
- history.push({
2860
- title: instance.label,
2861
- open: changeStore,
2072
+ return [y.store, this.store];
2073
+ }
2074
+ /**
2075
+ * @final
2076
+ * 自带 100ms 延迟,以允许在其他 Dialog 的 `shouldClose` 中调用此方法;
2077
+ * 浏览器 history 为异步 API,需要设置较长延迟;
2078
+ */
2079
+ static open(s) {
2080
+ const i = new this();
2081
+ this.instance = i, this.inertStore = [...document.body.children].filter((o) => !o.inert), this.inertStore.forEach((o) => o.inert = !0), document.body.append(i);
2082
+ const r = () => nt(this.store, { [zt]: !0, ...s });
2083
+ return setTimeout(() => {
2084
+ r(), y.push({
2085
+ title: i.label,
2086
+ open: r,
2862
2087
  close: this.closeHandle.bind(this),
2863
2088
  shouldClose: this.shouldClose.bind(this)
2864
2089
  });
2865
- }, 100);
2866
- return final2;
2090
+ }, 100), e;
2867
2091
  }
2092
+ /**
2093
+ * @final
2094
+ * UI 中执行关闭
2095
+ */
2868
2096
  static close() {
2869
- history.back();
2870
- return final2;
2097
+ return y.back(), e;
2871
2098
  }
2099
+ /**
2100
+ * @final
2101
+ * history 中自动调用
2102
+ */
2872
2103
  static closeHandle() {
2873
- var _a3;
2874
- this.inertStore.forEach((e) => e.inert = false);
2875
- (_a3 = this.instance) == null ? void 0 : _a3.remove();
2876
- updateStore(this.store, { [open]: false, ...options });
2877
- return final2;
2104
+ var s;
2105
+ return this.inertStore.forEach((i) => i.inert = !1), (s = this.instance) == null || s.remove(), nt(this.store, { [zt]: !1, ...n }), e;
2878
2106
  }
2107
+ /**
2108
+ * 由于要操作浏览器历史记录,所以没有设计为 Promise;
2109
+ */
2879
2110
  static shouldClose() {
2880
- return true;
2881
- }
2882
- }, _a2.inertStore = [], _a2.instance = null, _a2.store = createStore({
2883
- [open]: false,
2884
- ...options
2885
- }), _a2;
2886
- }
2887
- var __defProp = Object.defineProperty;
2888
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2889
- var __decorateClass = (decorators, target, key2, kind) => {
2890
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key2) : target;
2891
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
2892
- if (decorator = decorators[i])
2893
- result = (kind ? decorator(target, key2, result) : decorator(result)) || result;
2894
- if (kind && result)
2895
- __defProp(target, key2, result);
2896
- return result;
2897
- };
2898
- const final = Symbol();
2899
- let GemDialogBaseElement = (_b = class extends GemElement {
2111
+ return !0;
2112
+ }
2113
+ }, t.inertStore = [], t.instance = null, /**
2114
+ * @final
2115
+ * modal 状态,包括内容,是否已经确认关闭等属性
2116
+ */
2117
+ t.store = Ft({
2118
+ [zt]: !1,
2119
+ ...n
2120
+ }), t;
2121
+ }
2122
+ var Pi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, mn = (n, t, e, s) => {
2123
+ for (var i = s > 1 ? void 0 : s ? $i(t, e) : t, r = n.length - 1, o; r >= 0; r--)
2124
+ (o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
2125
+ return s && i && Pi(t, e, i), i;
2126
+ }, vs = (n, t, e) => {
2127
+ if (!t.has(n))
2128
+ throw TypeError("Cannot " + e);
2129
+ }, lt = (n, t, e) => (vs(n, t, "read from private field"), e ? e.call(n) : t.get(n)), Me = (n, t, e) => {
2130
+ if (t.has(n))
2131
+ throw TypeError("Cannot add the same private member more than once");
2132
+ t instanceof WeakSet ? t.add(n) : t.set(n, e);
2133
+ }, Oe = (n, t, e, s) => (vs(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), Mt, Ot, Rt;
2134
+ const Et = Symbol();
2135
+ let fe = class extends A {
2900
2136
  constructor() {
2901
- super();
2902
- __privateAdd(this, _nextSibling, void 0);
2903
- __privateAdd(this, _parentElement, void 0);
2904
- __privateAdd(this, _inertStore, void 0);
2905
- __privateSet(this, _inertStore, []);
2906
- this.closeHandle = () => {
2907
- var _a2;
2908
- this.inert = true;
2909
- __privateGet(this, _inertStore).forEach((e) => e.inert = false);
2910
- if (__privateGet(this, _nextSibling)) {
2911
- __privateGet(this, _nextSibling).before(this);
2912
- } else if (__privateGet(this, _parentElement)) {
2913
- (_a2 = __privateGet(this, _parentElement)) == null ? void 0 : _a2.appendChild(this);
2914
- }
2915
- this.dispatchEvent(new CustomEvent("close"));
2916
- this.opened = false;
2917
- return final;
2918
- };
2919
- this.openHandle = () => {
2920
- this.hidden = false;
2921
- this.inert = false;
2922
- __privateSet(this, _nextSibling, this.nextSibling);
2923
- __privateSet(this, _parentElement, this.parentElement || this.getRootNode());
2924
- __privateSet(this, _inertStore, [...document.body.children].filter((e) => !e.inert));
2925
- __privateGet(this, _inertStore).forEach((e) => e.inert = true);
2926
- document.body.append(this);
2927
- this.dispatchEvent(new CustomEvent("open"));
2928
- this.opened = true;
2929
- return final;
2930
- };
2931
- this.open = () => {
2932
- if (this.opened)
2933
- return;
2934
- this.openHandle();
2935
- history.push({
2936
- title: this.label,
2937
- open: this.openHandle,
2938
- close: this.closeHandle,
2939
- shouldClose: this.shouldClose
2940
- });
2941
- return final;
2942
- };
2943
- this.close = () => {
2944
- history.back();
2945
- return final;
2946
- };
2947
- this.forceClose = () => {
2948
- this.opened = false;
2949
- setTimeout(this.close, 100);
2950
- return final;
2951
- };
2952
- this.effect(
2953
- () => this.inert = true,
2137
+ super(), Me(this, Mt, void 0), Me(this, Ot, void 0), Me(this, Rt, []), this.closeHandle = () => {
2138
+ var n;
2139
+ return this.inert = !0, lt(this, Rt).forEach((t) => t.inert = !1), lt(this, Mt) ? lt(this, Mt).before(this) : lt(this, Ot) && ((n = lt(this, Ot)) == null || n.appendChild(this)), this.dispatchEvent(new CustomEvent("close")), this.opened = !1, Et;
2140
+ }, this.openHandle = () => (this.hidden = !1, this.inert = !1, Oe(this, Mt, this.nextSibling), Oe(this, Ot, this.parentElement || this.getRootNode()), Oe(this, Rt, [...document.body.children].filter((n) => !n.inert)), lt(this, Rt).forEach((n) => n.inert = !0), document.body.append(this), this.dispatchEvent(new CustomEvent("open")), this.opened = !0, Et), this.open = () => {
2141
+ if (!this.opened)
2142
+ return this.openHandle(), y.push({
2143
+ title: this.label,
2144
+ open: this.openHandle,
2145
+ close: this.closeHandle,
2146
+ shouldClose: this.shouldClose
2147
+ }), Et;
2148
+ }, this.close = () => (y.back(), Et), this.forceClose = () => (this.opened = !1, setTimeout(this.close, 100), Et), this.effect(
2149
+ () => this.inert = !0,
2954
2150
  () => []
2955
- );
2956
- this.internals.role = "dialog";
2957
- this.internals.ariaModal = "true";
2151
+ ), this.internals.role = "dialog", this.internals.ariaModal = "true";
2958
2152
  }
2959
2153
  shouldClose() {
2960
- return true;
2961
- }
2962
- }, _nextSibling = new WeakMap(), _parentElement = new WeakMap(), _inertStore = new WeakMap(), _b);
2963
- __decorateClass([
2964
- attribute
2965
- ], GemDialogBaseElement.prototype, "label", 2);
2966
- __decorateClass([
2967
- state
2968
- ], GemDialogBaseElement.prototype, "opened", 2);
2969
- GemDialogBaseElement = __decorateClass([
2970
- connectStore(history.store)
2971
- ], GemDialogBaseElement);
2972
- const themeStoreMap = /* @__PURE__ */ new WeakMap();
2973
- function getThemeStore(theme) {
2974
- return themeStoreMap.get(theme);
2975
- }
2976
- const themePropsMap = /* @__PURE__ */ new WeakMap();
2977
- function getThemeProps(theme) {
2978
- return themePropsMap.get(theme);
2979
- }
2980
- const setThemeFnMap = /* @__PURE__ */ new WeakMap();
2981
- function createTheme(themeObj) {
2982
- const salt = randomStr();
2983
- const style = document.createElement("style");
2984
- const store2 = createStore(themeObj);
2985
- const theme = {};
2986
- const props = {};
2987
- themePropsMap.set(theme, props);
2988
- themeStoreMap.set(theme, store2);
2989
- const setTheme = () => Object.keys(store2).forEach((key2) => {
2990
- if (props[key2])
2991
- return;
2992
- props[key2] = `--${camelToKebabCase(key2)}-${salt}`;
2993
- theme[key2] = `var(${props[key2]})`;
2154
+ return !0;
2155
+ }
2156
+ };
2157
+ Mt = /* @__PURE__ */ new WeakMap();
2158
+ Ot = /* @__PURE__ */ new WeakMap();
2159
+ Rt = /* @__PURE__ */ new WeakMap();
2160
+ mn([
2161
+ C
2162
+ ], fe.prototype, "label", 2);
2163
+ mn([
2164
+ cn
2165
+ ], fe.prototype, "opened", 2);
2166
+ fe = mn([
2167
+ hn(y.store)
2168
+ ], fe);
2169
+ const Ss = /* @__PURE__ */ new WeakMap();
2170
+ function Ti(n) {
2171
+ return Ss.get(n);
2172
+ }
2173
+ const Es = /* @__PURE__ */ new WeakMap();
2174
+ function nr(n) {
2175
+ return Es.get(n);
2176
+ }
2177
+ const xs = /* @__PURE__ */ new WeakMap();
2178
+ function ki(n) {
2179
+ const t = ve(), e = document.createElement("style"), s = Ft(n), i = {}, r = {};
2180
+ Es.set(i, r), Ss.set(i, s);
2181
+ const o = () => Object.keys(s).forEach((h) => {
2182
+ r[h] || (r[h] = `--${j(h)}-${t}`, i[h] = `var(${r[h]})`);
2994
2183
  });
2995
- setThemeFnMap.set(theme, setTheme);
2996
- setTheme();
2997
- const getStyle = () => `:root, :host {${Object.keys(store2).reduce((prev, key2) => prev + `${props[key2]}:${store2[key2]};`, "")}}`;
2998
- const replace = () => style.textContent = getStyle();
2999
- connect(store2, replace);
3000
- replace();
3001
- (document.head || document.documentElement).append(style);
3002
- return theme;
3003
- }
3004
- function updateTheme(theme, newThemeObj) {
3005
- updateStore(getThemeStore(theme), newThemeObj);
3006
- setThemeFnMap.get(theme)();
3007
- }
3008
- function useTheme(themeObj) {
3009
- const theme = createTheme(themeObj);
3010
- return [theme, (newThemeObj) => updateTheme(theme, newThemeObj)];
3011
- }
3012
- class Logger {
3013
- constructor(type) {
3014
- this.info = (...args) => {
3015
- console.log(`[${this._type}]:`, ...args);
3016
- };
3017
- this.warn = (...args) => {
3018
- console.warn(`[${this._type}]:`, ...args);
3019
- };
3020
- this.error = (...args) => {
3021
- console.error(`[${this._type}]:`, ...args);
3022
- };
3023
- this._type = type;
3024
- }
3025
- }
3026
- const logger = new Logger("GEM");
3027
- const splitReg = /\$\d(?:<[^>]*>)?/;
3028
- const matchReg = /\$(\d)(<([^>]*)>)?/g;
3029
- const matchStrIndex = 3;
3030
- function splice(rawValue, ...rest) {
3031
- const templateArr = rawValue.split(splitReg);
3032
- const values = [];
3033
- let result;
3034
- while (result = matchReg.exec(rawValue)) {
3035
- const str = result[matchStrIndex];
3036
- const index = Number(result[1]) - 1;
3037
- const arg = rest[index];
3038
- values.push(typeof arg === "function" ? arg(str) : arg);
3039
- }
3040
- return html(templateArr, ...values);
3041
- }
3042
- const modules = /* @__PURE__ */ new Set();
3043
- const _I18n = class {
3044
- constructor(options) {
3045
- __privateAdd(this, _cacheCurrentKey);
3046
- __privateAdd(this, _urlParamsLang);
3047
- __privateAdd(this, _cacheLang);
3048
- __privateAdd(this, _isMain);
3049
- __privateAdd(this, _lang);
3050
- this.cachePrefix = "gem-i18n";
3051
- this.replace = ({ path }) => {
3052
- this.setLanguage(path);
3053
- };
3054
- this.getParams = () => ({ path: this.currentLanguage });
3055
- if (!options.resources[options.fallbackLanguage]) {
3056
- throw new GemError("i18n: fallbackLanguage invalid");
3057
- }
3058
- this.store = createStore(this);
3059
- Object.assign(this, options);
3060
- let currentLanguage = __privateGet(this, _urlParamsLang, urlParamsLang_get) || this.currentLanguage || __privateGet(this, _cacheLang, cacheLang_get);
3061
- const ele = document.querySelector(`[type*=${this.cachePrefix}]`);
3062
- if (ele) {
2184
+ xs.set(i, o), o();
2185
+ const a = () => `:root, :host {${Object.keys(s).reduce((h, p) => h + `${r[p]}:${s[p]};`, "")}}`, c = () => e.textContent = a();
2186
+ return ct(s, c), c(), (document.head || document.documentElement).append(e), i;
2187
+ }
2188
+ function Li(n, t) {
2189
+ nt(Ti(n), t), xs.get(n)();
2190
+ }
2191
+ function sr(n) {
2192
+ const t = ki(n);
2193
+ return [t, (e) => Li(t, e)];
2194
+ }
2195
+ class Ni {
2196
+ constructor(t) {
2197
+ this.info = (...e) => {
2198
+ console.log(`[${this._type}]:`, ...e);
2199
+ }, this.warn = (...e) => {
2200
+ console.warn(`[${this._type}]:`, ...e);
2201
+ }, this.error = (...e) => {
2202
+ console.error(`[${this._type}]:`, ...e);
2203
+ }, this._type = t;
2204
+ }
2205
+ }
2206
+ const Mi = new Ni("GEM"), Oi = /\$\d(?:<[^>]*>)?/, Ri = /\$(\d)(<([^>]*)>)?/g, Ai = 3;
2207
+ function Hi(n, ...t) {
2208
+ const e = n.split(Oi), s = [];
2209
+ let i;
2210
+ for (; i = Ri.exec(n); ) {
2211
+ const r = i[Ai], o = Number(i[1]) - 1, a = t[o];
2212
+ s.push(typeof a == "function" ? a(r) : a);
2213
+ }
2214
+ return G(e, ...s);
2215
+ }
2216
+ const xt = /* @__PURE__ */ new Set();
2217
+ var mt, oe, me, bs, ye, Cs, at, At, yt, ae;
2218
+ const yn = class yn {
2219
+ constructor(t) {
2220
+ P(this, mt);
2221
+ P(this, me);
2222
+ P(this, ye);
2223
+ P(this, at);
2224
+ P(this, yt);
2225
+ if (this.cachePrefix = "gem-i18n", this.replace = ({ path: i }) => this.setLanguage(i), this.getParams = () => ({ path: this.currentLanguage }), !t.resources[t.fallbackLanguage])
2226
+ throw new tt("i18n: fallbackLanguage invalid");
2227
+ this.store = Ft(this), Object.assign(this, t);
2228
+ let e = g(this, me, bs) || this.currentLanguage || g(this, ye, Cs);
2229
+ const s = document.querySelector(`[type*=${this.cachePrefix}]`);
2230
+ if (s)
3063
2231
  try {
3064
- const prerenderData = JSON.parse(ele.textContent || "");
3065
- currentLanguage = prerenderData.currentLanguage;
3066
- this.resources[prerenderData.currentLanguage] = prerenderData.currentLanguagePack;
2232
+ const i = JSON.parse(s.textContent || "");
2233
+ e = i.currentLanguage, this.resources[i.currentLanguage] = i.currentLanguagePack;
3067
2234
  } catch {
3068
2235
  }
3069
- }
3070
- if (currentLanguage) {
3071
- __privateSet(this, _lang, currentLanguage, lang_set);
3072
- this.setLanguage(currentLanguage);
3073
- } else {
3074
- this.resetLanguage();
3075
- }
2236
+ e ? (F(this, yt, e, ae), this.setLanguage(e)) : this.resetLanguage();
3076
2237
  }
3077
- get(s, ...rest) {
3078
- const currentLanguagePack = this.resources[this.currentLanguage];
3079
- const fallbackLanguagePack = this.resources[this.fallbackLanguage];
3080
- const msg = currentLanguagePack[s] || fallbackLanguagePack[s];
3081
- const rawValue = (msg == null ? void 0 : msg.message) || msg || `[${s}]`;
3082
- if (!rest.length)
3083
- return rawValue;
3084
- return splice(rawValue, ...rest);
2238
+ get(t, ...e) {
2239
+ const s = this.resources[this.currentLanguage], i = this.resources[this.fallbackLanguage], r = s[t] || i[t], o = (r == null ? void 0 : r.message) || r || `[${t}]`;
2240
+ return e.length ? Hi(o, ...e) : o;
3085
2241
  }
3086
2242
  detectLanguage() {
3087
- const availableLangs = Object.keys(this.resources);
3088
- const uiLangs = navigator.languages.map((lang) => lang.replace(/-(.*)/, ($1) => $1.toUpperCase()));
3089
- for (const lang of uiLangs) {
3090
- const matched = availableLangs.find((e) => e === lang || lang.startsWith(`${e}-`));
3091
- if (matched)
3092
- return matched;
2243
+ const t = Object.keys(this.resources), e = navigator.languages.map((s) => s.replace(/-(.*)/, (i) => i.toUpperCase()));
2244
+ for (const s of e) {
2245
+ const i = t.find((r) => r === s || s.startsWith(`${r}-`));
2246
+ if (i)
2247
+ return i;
3093
2248
  }
3094
2249
  return this.fallbackLanguage;
3095
2250
  }
3096
- async setLanguage(lang) {
3097
- if (__privateGet(this, _isMain, isMain_get)) {
3098
- modules.forEach(async (i18n) => await i18n.setLanguage(lang));
3099
- }
3100
- let pack;
3101
- const data = this.resources[lang];
3102
- if (!data) {
3103
- logger.warn(`${this.cachePrefix}: not found \`${lang}\``);
3104
- return this.resetLanguage();
3105
- }
3106
- if (typeof data === "string") {
3107
- const prefix = `${this.cachePrefix}:`;
3108
- const localKey = `${prefix}${data}`;
3109
- const localPackString = localStorage.getItem(localKey);
3110
- const fetchPack = async () => {
3111
- const pack2 = await (await fetch(data)).json();
2251
+ async setLanguage(t) {
2252
+ g(this, at, At) && xt.forEach(async (i) => await i.setLanguage(t));
2253
+ let e;
2254
+ const s = this.resources[t];
2255
+ if (!s)
2256
+ return Mi.warn(`${this.cachePrefix}: not found \`${t}\``), this.resetLanguage();
2257
+ if (typeof s == "string") {
2258
+ const i = `${this.cachePrefix}:`, r = `${i}${s}`, o = localStorage.getItem(r), a = async () => {
2259
+ const c = await (await fetch(s)).json();
3112
2260
  if (this.cache) {
3113
- for (let i = 0; i < localStorage.length; i++) {
3114
- const key2 = localStorage.key(i);
3115
- if (key2.startsWith(prefix)) {
3116
- localStorage.removeItem(key2);
3117
- }
2261
+ for (let h = 0; h < localStorage.length; h++) {
2262
+ const p = localStorage.key(h);
2263
+ p.startsWith(i) && localStorage.removeItem(p);
3118
2264
  }
3119
- localStorage.setItem(localKey, JSON.stringify(pack2));
2265
+ localStorage.setItem(r, JSON.stringify(c));
3120
2266
  }
3121
- return pack2;
2267
+ return c;
3122
2268
  };
3123
- if (localPackString) {
2269
+ if (o)
3124
2270
  try {
3125
- pack = JSON.parse(localPackString);
3126
- } catch (e) {
3127
- pack = await fetchPack();
2271
+ e = JSON.parse(o);
2272
+ } catch {
2273
+ e = await a();
3128
2274
  }
3129
- } else {
3130
- pack = await fetchPack();
3131
- }
3132
- } else {
3133
- pack = data;
3134
- }
3135
- this.resources[lang] = pack;
3136
- updateStore(this.store, {});
3137
- if (lang !== this.currentLanguage) {
3138
- __privateSet(this, _lang, lang, lang_set);
3139
- }
3140
- if (this.cache === true) {
3141
- this.setCache();
3142
- }
3143
- return lang;
2275
+ else
2276
+ e = await a();
2277
+ } else
2278
+ e = s;
2279
+ return this.resources[t] = e, nt(this.store), t !== this.currentLanguage && F(this, yt, t, ae), this.cache === !0 && this.setCache(), t;
3144
2280
  }
3145
2281
  resetLanguage() {
3146
- if (__privateGet(this, _isMain, isMain_get)) {
3147
- modules.forEach((i18n) => i18n.resetLanguage());
3148
- }
3149
- __privateSet(this, _lang, this.fallbackLanguage, lang_set);
3150
- if (this.cache) {
3151
- localStorage.removeItem(__privateGet(this, _cacheCurrentKey, cacheCurrentKey_get));
3152
- }
3153
- return this.setLanguage(this.detectLanguage());
2282
+ return g(this, at, At) && xt.forEach((t) => t.resetLanguage()), F(this, yt, this.fallbackLanguage, ae), this.cache && localStorage.removeItem(g(this, mt, oe)), this.setLanguage(this.detectLanguage());
3154
2283
  }
2284
+ // 一般用在 `onChange` 中
3155
2285
  setCache() {
3156
- if (__privateGet(this, _isMain, isMain_get)) {
3157
- modules.forEach((i18n) => i18n.setCache());
3158
- }
3159
- localStorage.setItem(__privateGet(this, _cacheCurrentKey, cacheCurrentKey_get), this.currentLanguage);
2286
+ g(this, at, At) && xt.forEach((t) => t.setCache()), localStorage.setItem(g(this, mt, oe), this.currentLanguage);
3160
2287
  }
3161
- createSubModule(name, resources) {
3162
- const module = new _I18n({
3163
- resources,
3164
- cachePrefix: `${this.cachePrefix}-${name}`,
2288
+ createSubModule(t, e) {
2289
+ const s = new yn({
2290
+ resources: e,
2291
+ cachePrefix: `${this.cachePrefix}-${t}`,
3165
2292
  currentLanguage: this.currentLanguage,
3166
2293
  fallbackLanguage: this.fallbackLanguage,
3167
2294
  cache: this.cache
3168
2295
  });
3169
- modules.add(module);
3170
- return module;
3171
- }
2296
+ return xt.add(s), s;
2297
+ }
2298
+ /**
2299
+ * prepare: @connectStore(i18n.store)
2300
+ *
2301
+ * @example
2302
+ *
2303
+ * html`
2304
+ * <gem-reflect>
2305
+ * <script type="${i18n.cachePrefix}">${JSON.stringify(i18n)}<\/script>
2306
+ * </gem-reflect>
2307
+ * `
2308
+ */
3172
2309
  toJSON() {
3173
2310
  return {
3174
2311
  currentLanguage: this.currentLanguage,
@@ -3176,147 +2313,225 @@ const _I18n = class {
3176
2313
  };
3177
2314
  }
3178
2315
  };
3179
- let I18n = _I18n;
3180
- _cacheCurrentKey = new WeakSet();
3181
- cacheCurrentKey_get = function() {
2316
+ mt = new WeakSet(), oe = function() {
3182
2317
  return `${this.cachePrefix}:current`;
3183
- };
3184
- _urlParamsLang = new WeakSet();
3185
- urlParamsLang_get = function() {
3186
- const { hostname, pathname, search } = location;
3187
- const parts2 = hostname.split(".");
2318
+ }, me = new WeakSet(), bs = function() {
2319
+ const { hostname: t, pathname: e, search: s } = location, i = t.split(".");
3188
2320
  switch (this.urlParamsType) {
3189
2321
  case "ccTLD":
3190
- return parts2.pop();
2322
+ return i.pop();
3191
2323
  case "gTLD":
3192
- return parts2.shift();
2324
+ return i.shift();
3193
2325
  case "path":
3194
- return pathname.split("/")[1];
2326
+ return e.split("/")[1];
3195
2327
  default:
3196
- const fragment = this.urlParamsName && new URLSearchParams(search).get(this.urlParamsName) || "";
3197
- return fragment in this.resources ? fragment : "";
3198
- }
3199
- };
3200
- _cacheLang = new WeakSet();
3201
- cacheLang_get = function() {
3202
- return this.cache && localStorage.getItem(__privateGet(this, _cacheCurrentKey, cacheCurrentKey_get)) || "";
2328
+ const r = this.urlParamsName && new URLSearchParams(s).get(this.urlParamsName) || "";
2329
+ return r in this.resources ? r : "";
2330
+ }
2331
+ }, ye = new WeakSet(), Cs = function() {
2332
+ return this.cache && localStorage.getItem(g(this, mt, oe)) || "";
2333
+ }, at = new WeakSet(), At = function() {
2334
+ return !xt.has(this);
2335
+ }, yt = new WeakSet(), ae = function(t) {
2336
+ var e;
2337
+ g(this, at, At) && (document.documentElement.lang = t), this.currentLanguage = t, (e = this.onChange) == null || e.call(this, t);
3203
2338
  };
3204
- _isMain = new WeakSet();
3205
- isMain_get = function() {
3206
- return !modules.has(this);
3207
- };
3208
- _lang = new WeakSet();
3209
- lang_set = function(lang) {
3210
- var _a2;
3211
- if (__privateGet(this, _isMain, isMain_get)) {
3212
- document.documentElement.lang = lang;
3213
- }
3214
- this.currentLanguage = lang;
3215
- (_a2 = this.onChange) == null ? void 0 : _a2.call(this, lang);
3216
- };
3217
- const defaultReqInit = {
2339
+ let Vn = yn;
2340
+ const Wi = {
3218
2341
  headers: {
3219
2342
  "Content-Type": "application/json"
3220
2343
  }
3221
2344
  };
3222
- async function request(uri, options = {}) {
3223
- const res = await fetch(uri, {
3224
- ...defaultReqInit,
3225
- ...options
2345
+ async function xe(n, t = {}) {
2346
+ const e = await fetch(n, {
2347
+ ...Wi,
2348
+ ...t
3226
2349
  });
3227
- if (res.status === 0)
2350
+ if (e.status === 0)
3228
2351
  throw new Error("Request fail");
3229
- if (res.status >= 500)
3230
- throw new Error(res.statusText);
2352
+ if (e.status >= 500)
2353
+ throw new Error(e.statusText);
3231
2354
  try {
3232
- const data = await res.json();
3233
- if (res.status >= 400)
3234
- throw new Error((data == null ? void 0 : data.message) || res.statusText, { cause: data });
3235
- return data;
2355
+ const s = await e.json();
2356
+ if (e.status >= 400)
2357
+ throw new Error((s == null ? void 0 : s.message) || e.statusText, { cause: s });
2358
+ return s;
3236
2359
  } catch {
3237
2360
  throw new Error("Server error");
3238
2361
  }
3239
2362
  }
3240
- const TypedArray = Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array())).constructor;
3241
- function serializationBody(body) {
3242
- if (body instanceof FormData || body instanceof Blob || body instanceof TypedArray || body instanceof URLSearchParams || body instanceof ReadableStream || body instanceof ArrayBuffer) {
3243
- return body;
3244
- }
3245
- if (typeof body === "object") {
3246
- return JSON.stringify(body);
3247
- }
3248
- return body;
2363
+ const Ii = Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array())).constructor;
2364
+ function Ps(n) {
2365
+ return n instanceof FormData || n instanceof Blob || n instanceof Ii || n instanceof URLSearchParams || n instanceof ReadableStream || n instanceof ArrayBuffer ? n : typeof n == "object" ? JSON.stringify(n) : n;
3249
2366
  }
3250
- function serializationUrl(url, params) {
3251
- const { origin, pathname, search } = new URL(url, location.origin);
3252
- const query = new URLSearchParams(params).toString();
3253
- return `${origin}${pathname}${search ? `${search}&` : query ? "?" : ""}${query}`;
2367
+ function $s(n, t) {
2368
+ const { origin: e, pathname: s, search: i } = new URL(n, location.origin), r = new URLSearchParams(t).toString();
2369
+ return `${e}${s}${i ? `${i}&` : r ? "?" : ""}${r}`;
3254
2370
  }
3255
- function get(url, params) {
3256
- return request(serializationUrl(url, params), { method: "GET" });
2371
+ function ir(n, t) {
2372
+ return xe($s(n, t), { method: "GET" });
3257
2373
  }
3258
- function del(url, params) {
3259
- return request(serializationUrl(url, params), { method: "DELETE" });
2374
+ function rr(n, t) {
2375
+ return xe($s(n, t), { method: "DELETE" });
3260
2376
  }
3261
- function put(url, body) {
3262
- return request(url, { method: "PUT", body: serializationBody(body) });
2377
+ function or(n, t) {
2378
+ return xe(n, { method: "PUT", body: Ps(t) });
3263
2379
  }
3264
- function post(url, body) {
3265
- return request(url, { method: "POST", body: serializationBody(body) });
2380
+ function ar(n, t) {
2381
+ return xe(n, { method: "POST", body: Ps(t) });
3266
2382
  }
3267
- const match = (query) => window.matchMedia(query).matches;
3268
- const mediaQuery = {
2383
+ const L = (n) => window.matchMedia(n).matches, cr = {
3269
2384
  PRINT: "print",
3270
2385
  get isPrint() {
3271
- return match(this.PRINT);
2386
+ return L(this.PRINT);
3272
2387
  },
3273
2388
  HOVER: "(hover: hover)",
3274
2389
  get isHover() {
3275
- return match(this.HOVER);
2390
+ return L(this.HOVER);
3276
2391
  },
3277
2392
  PWA: "(display-mode: standalone)",
2393
+ // PWA: '(display-mode: browser)', // debugging
3278
2394
  get isPWA() {
3279
- return match(this.PWA);
2395
+ return L(this.PWA);
3280
2396
  },
3281
2397
  MOTION_REDUCE: "(prefers-reduced-motion: reduce)",
3282
2398
  get isMotionReduce() {
3283
- return match(this.MOTION_REDUCE);
2399
+ return L(this.MOTION_REDUCE);
3284
2400
  },
3285
2401
  DATA_REDUCE: "(prefers-reduced-data: reduce)",
3286
2402
  get isDataReduce() {
3287
- return match(this.DATA_REDUCE);
2403
+ return L(this.DATA_REDUCE);
3288
2404
  },
3289
2405
  WATCH: "(width < 320px)",
3290
2406
  get isWatch() {
3291
- return match(this.WATCH);
2407
+ return L(this.WATCH);
3292
2408
  },
3293
2409
  SMALL_PHONE: "(320px <= width <= 480px) and (height <= 640px)",
3294
2410
  get isSmallPhone() {
3295
- return match(this.SMALL_PHONE);
2411
+ return L(this.SMALL_PHONE);
3296
2412
  },
3297
2413
  PHONE: "(320px <= width <= 480px)",
3298
2414
  get isPhone() {
3299
- return match(this.PHONE);
2415
+ return L(this.PHONE);
3300
2416
  },
3301
2417
  PHONE_LANDSCAPE: "(480px < width < 960px) and (orientation: landscape)",
2418
+ // PHONE_LANDSCAPE: '(480px < width < 960px)',
3302
2419
  get isPhoneLandscape() {
3303
- return match(this.PHONE_LANDSCAPE);
2420
+ return L(this.PHONE_LANDSCAPE);
3304
2421
  },
2422
+ // Widget
3305
2423
  SHORT: "(width >= 480px) and (height <= 320px)",
3306
2424
  get isShort() {
3307
- return match(this.SHORT);
2425
+ return L(this.SHORT);
3308
2426
  },
2427
+ // 1280 x 850
2428
+ // 1024 x 768
3309
2429
  TABLET: "(480px < width <= 1280px)",
3310
2430
  get isTablet() {
3311
- return match(this.TABLET);
2431
+ return L(this.TABLET);
3312
2432
  },
2433
+ // 1366x768
3313
2434
  DESKTOP: "(width > 1280px) and (orientation: landscape)",
3314
2435
  get isDesktop() {
3315
- return match(this.DESKTOP);
2436
+ return L(this.DESKTOP);
3316
2437
  },
2438
+ // 1920x1080
3317
2439
  WIDTHSCREEN: "(width >= 1920px) and (orientation: landscape)",
3318
2440
  get isWidthScreen() {
3319
- return match(this.WIDTHSCREEN);
2441
+ return L(this.WIDTHSCREEN);
3320
2442
  }
3321
2443
  };
3322
- export { GemActiveLinkElement, GemDialogBaseElement, GemElement, GemError, GemLightRouteElement, GemLinkElement, GemReflectElement, GemRouteElement, GemTitleElement, GemUnsafeElement, GemUseElement, I18n, LinkedList, PREFIX, PropProxyMap, QueryString, SUFFIX, SVGTemplateResult, SheetToken, StoreListenerMap, TemplateResult, absoluteLocation, addListener, addMicrotask, addMicrotaskToStack, adoptedStyle, attribute, basePathStore, boolattribute, camelToKebabCase, classMap, cleanObject, connect, connectStore, createCSSSheet, createHistoryParams, createModalClass, createPath, createStore, createTheme, css, customElement, defaultReqInit, defineAttribute, defineCSSState, defineProperty, defineRef, del, directive, disconnect, emitter, exportPartsMap, get, getThemeProps, getThemeStore, globalemitter, guard, history, html, ifDefined, isArrayChange, kebabToCamelCase, matchPath, mediaQuery, nativeDefineElement, numattribute, objectMapToString, part, partMap, post, property, put, randomStr, raw, refobject, removeItems, render, repeat, request, rootElement, slot, splice, state, styleMap, styled, svg, titleStore, updateStore, updateTheme, useStore, useTheme, version };
2444
+ export {
2445
+ Ut as GemActiveLinkElement,
2446
+ fe as GemDialogBaseElement,
2447
+ A as GemElement,
2448
+ tt as GemError,
2449
+ hi as GemLightRouteElement,
2450
+ x as GemLinkElement,
2451
+ gn as GemReflectElement,
2452
+ ds as GemRouteElement,
2453
+ Nt as GemTitleElement,
2454
+ pn as GemUnsafeElement,
2455
+ Bt as GemUseElement,
2456
+ Vn as I18n,
2457
+ qs as LinkedList,
2458
+ mi as PREFIX,
2459
+ Us as PropProxyMap,
2460
+ It as QueryString,
2461
+ yi as SUFFIX,
2462
+ Gn as SVGTemplateResult,
2463
+ Yn as SheetToken,
2464
+ Vt as StoreListenerMap,
2465
+ _e as TemplateResult,
2466
+ zn as absoluteLocation,
2467
+ Jn as addListener,
2468
+ I as addMicrotask,
2469
+ Di as addMicrotaskToStack,
2470
+ Xi as adoptedStyle,
2471
+ C as attribute,
2472
+ ii as basePathStore,
2473
+ es as boolattribute,
2474
+ j as camelToKebabCase,
2475
+ Bs as classMap,
2476
+ Ze as cleanObject,
2477
+ ct as connect,
2478
+ hn as connectStore,
2479
+ Ui as createCSSSheet,
2480
+ ci as createHistoryParams,
2481
+ er as createModalClass,
2482
+ dn as createPath,
2483
+ Ft as createStore,
2484
+ ki as createTheme,
2485
+ qi as css,
2486
+ tr as customElement,
2487
+ Wi as defaultReqInit,
2488
+ nn as defineAttribute,
2489
+ rn as defineCSSState,
2490
+ Dt as defineProperty,
2491
+ sn as defineRef,
2492
+ rr as del,
2493
+ we as directive,
2494
+ Ki as disconnect,
2495
+ Se as emitter,
2496
+ Bi as exportPartsMap,
2497
+ ir as get,
2498
+ nr as getThemeProps,
2499
+ Ti as getThemeStore,
2500
+ Qi as globalemitter,
2501
+ Ys as guard,
2502
+ y as history,
2503
+ G as html,
2504
+ Qn as ifDefined,
2505
+ js as isArrayChange,
2506
+ ot as kebabToCamelCase,
2507
+ ls as matchPath,
2508
+ cr as mediaQuery,
2509
+ on as nativeDefineElement,
2510
+ Ji as numattribute,
2511
+ tn as objectMapToString,
2512
+ Xs as part,
2513
+ Fi as partMap,
2514
+ ar as post,
2515
+ N as property,
2516
+ or as put,
2517
+ ve as randomStr,
2518
+ Jt as raw,
2519
+ zi as refobject,
2520
+ Fs as removeItems,
2521
+ Kn as render,
2522
+ Js as repeat,
2523
+ xe as request,
2524
+ Zi as rootElement,
2525
+ Yi as slot,
2526
+ Hi as splice,
2527
+ cn as state,
2528
+ ji as styleMap,
2529
+ Gi as styled,
2530
+ Vs as svg,
2531
+ qt as titleStore,
2532
+ nt as updateStore,
2533
+ Li as updateTheme,
2534
+ en as useStore,
2535
+ sr as useTheme,
2536
+ Ks as version
2537
+ };