joe-stencil-library 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/index-Bz7jpGsd.js +1942 -0
  4. package/dist/cjs/index.cjs.js +7 -0
  5. package/dist/cjs/loader.cjs.js +13 -0
  6. package/dist/cjs/my-component.cjs.entry.js +33 -0
  7. package/dist/cjs/stencil-library.cjs.js +25 -0
  8. package/dist/collection/collection-manifest.json +12 -0
  9. package/dist/collection/components/my-component/my-component.css +3 -0
  10. package/dist/collection/components/my-component/my-component.js +95 -0
  11. package/dist/collection/index.js +10 -0
  12. package/dist/collection/utils/utils.js +3 -0
  13. package/dist/components/index.d.ts +35 -0
  14. package/dist/components/index.js +1 -0
  15. package/dist/components/my-component.d.ts +11 -0
  16. package/dist/components/my-component.js +1 -0
  17. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  18. package/dist/esm/index-CmKZewjN.js +1936 -0
  19. package/dist/esm/index.js +5 -0
  20. package/dist/esm/loader.js +11 -0
  21. package/dist/esm/my-component.entry.js +31 -0
  22. package/dist/esm/stencil-library.js +21 -0
  23. package/dist/index.cjs.js +1 -0
  24. package/dist/index.js +1 -0
  25. package/dist/stencil-library/index.esm.js +1 -0
  26. package/dist/stencil-library/p-5dacfe00.entry.js +1 -0
  27. package/dist/stencil-library/p-CmKZewjN.js +2 -0
  28. package/dist/stencil-library/p-DQuL1Twl.js +1 -0
  29. package/dist/stencil-library/stencil-library.esm.js +1 -0
  30. package/dist/types/components/my-component/my-component.d.ts +16 -0
  31. package/dist/types/components.d.ts +61 -0
  32. package/dist/types/index.d.ts +11 -0
  33. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  34. package/dist/types/utils/utils.d.ts +1 -0
  35. package/hydrate/index.d.ts +287 -0
  36. package/hydrate/index.js +22761 -0
  37. package/hydrate/index.mjs +22751 -0
  38. package/hydrate/package.json +12 -0
  39. package/loader/cdn.js +1 -0
  40. package/loader/index.cjs.js +1 -0
  41. package/loader/index.d.ts +24 -0
  42. package/loader/index.es2017.js +1 -0
  43. package/loader/index.js +2 -0
  44. package/package.json +67 -0
  45. package/readme.md +111 -0
@@ -0,0 +1,1936 @@
1
+ const NAMESPACE = 'stencil-library';
2
+ const BUILD = /* stencil-library */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, prop: true, propChangeCallback: false, updatable: true};
3
+
4
+ /*
5
+ Stencil Client Platform v4.41.2 | MIT Licensed | https://stenciljs.com
6
+ */
7
+
8
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
9
+ PrimitiveType2["Undefined"] = "undefined";
10
+ PrimitiveType2["Null"] = "null";
11
+ PrimitiveType2["String"] = "string";
12
+ PrimitiveType2["Number"] = "number";
13
+ PrimitiveType2["SpecialNumber"] = "number";
14
+ PrimitiveType2["Boolean"] = "boolean";
15
+ PrimitiveType2["BigInt"] = "bigint";
16
+ return PrimitiveType2;
17
+ })(PrimitiveType || {});
18
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
19
+ NonPrimitiveType2["Array"] = "array";
20
+ NonPrimitiveType2["Date"] = "date";
21
+ NonPrimitiveType2["Map"] = "map";
22
+ NonPrimitiveType2["Object"] = "object";
23
+ NonPrimitiveType2["RegularExpression"] = "regexp";
24
+ NonPrimitiveType2["Set"] = "set";
25
+ NonPrimitiveType2["Channel"] = "channel";
26
+ NonPrimitiveType2["Symbol"] = "symbol";
27
+ return NonPrimitiveType2;
28
+ })(NonPrimitiveType || {});
29
+ var TYPE_CONSTANT = "type";
30
+ var VALUE_CONSTANT = "value";
31
+ var SERIALIZED_PREFIX = "serialized:";
32
+ var reWireGetterSetter = (instance, hostRef) => {
33
+ var _a;
34
+ const cmpMeta = hostRef.$cmpMeta$;
35
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
36
+ members.map(([memberName, [memberFlags]]) => {
37
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
38
+ const ogValue = instance[memberName];
39
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
40
+ if (ogDescriptor) {
41
+ Object.defineProperty(instance, memberName, {
42
+ get() {
43
+ return ogDescriptor.get.call(this);
44
+ },
45
+ set(newValue) {
46
+ ogDescriptor.set.call(this, newValue);
47
+ },
48
+ configurable: true,
49
+ enumerable: true
50
+ });
51
+ }
52
+ instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
53
+ }
54
+ });
55
+ };
56
+ function getPropertyDescriptor(obj, memberName) {
57
+ while (obj) {
58
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
59
+ if (desc == null ? void 0 : desc.get) return desc;
60
+ obj = Object.getPrototypeOf(obj);
61
+ }
62
+ return void 0;
63
+ }
64
+
65
+ // src/client/client-host-ref.ts
66
+ var getHostRef = (ref) => {
67
+ if (ref.__stencil__getHostRef) {
68
+ return ref.__stencil__getHostRef();
69
+ }
70
+ return void 0;
71
+ };
72
+ var registerInstance = (lazyInstance, hostRef) => {
73
+ if (!hostRef) return;
74
+ lazyInstance.__stencil__getHostRef = () => hostRef;
75
+ hostRef.$lazyInstance$ = lazyInstance;
76
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.prop)) {
77
+ reWireGetterSetter(lazyInstance, hostRef);
78
+ }
79
+ };
80
+ var registerHost = (hostElement, cmpMeta) => {
81
+ const hostRef = {
82
+ $flags$: 0,
83
+ $hostElement$: hostElement,
84
+ $cmpMeta$: cmpMeta,
85
+ $instanceValues$: /* @__PURE__ */ new Map(),
86
+ $serializerValues$: /* @__PURE__ */ new Map()
87
+ };
88
+ {
89
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
90
+ hostElement["s-p"] = [];
91
+ hostElement["s-rc"] = [];
92
+ }
93
+ {
94
+ hostRef.$fetchedCbList$ = [];
95
+ }
96
+ const ref = hostRef;
97
+ hostElement.__stencil__getHostRef = () => ref;
98
+ return ref;
99
+ };
100
+ var consoleError = (e, el) => (0, console.error)(e, el);
101
+
102
+ // src/client/client-load-module.ts
103
+ var cmpModules = /* @__PURE__ */ new Map();
104
+ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
105
+ const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
106
+ const bundleId = cmpMeta.$lazyBundleId$;
107
+ if (!bundleId) {
108
+ return void 0;
109
+ }
110
+ const module = cmpModules.get(bundleId) ;
111
+ if (module) {
112
+ return module[exportName];
113
+ }
114
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
115
+ return import(
116
+ /* @vite-ignore */
117
+ /* webpackInclude: /\.entry\.js$/ */
118
+ /* webpackExclude: /\.system\.entry\.js$/ */
119
+ /* webpackMode: "lazy" */
120
+ `./${bundleId}.entry.js${""}`
121
+ ).then(
122
+ (importedModule) => {
123
+ {
124
+ cmpModules.set(bundleId, importedModule);
125
+ }
126
+ return importedModule[exportName];
127
+ },
128
+ (e) => {
129
+ consoleError(e, hostRef.$hostElement$);
130
+ }
131
+ );
132
+ };
133
+
134
+ // src/client/client-style.ts
135
+ var styles = /* @__PURE__ */ new Map();
136
+
137
+ // src/runtime/runtime-constants.ts
138
+ var CONTENT_REF_ID = "r";
139
+ var ORG_LOCATION_ID = "o";
140
+ var SLOT_NODE_ID = "s";
141
+ var TEXT_NODE_ID = "t";
142
+ var COMMENT_NODE_ID = "c";
143
+ var HYDRATE_ID = "s-id";
144
+ var HYDRATED_STYLE_ID = "sty-id";
145
+ var HYDRATE_CHILD_ID = "c-id";
146
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
147
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
148
+ var win = typeof window !== "undefined" ? window : {};
149
+ var plt = {
150
+ $flags$: 0,
151
+ $resourcesUrl$: "",
152
+ jmp: (h2) => h2(),
153
+ raf: (h2) => requestAnimationFrame(h2),
154
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
155
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
156
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
157
+ };
158
+ var promiseResolve = (v) => Promise.resolve(v);
159
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
160
+ try {
161
+ if (!win.document.adoptedStyleSheets) {
162
+ return false;
163
+ }
164
+ new CSSStyleSheet();
165
+ return typeof new CSSStyleSheet().replaceSync === "function";
166
+ } catch (e) {
167
+ }
168
+ return false;
169
+ })() ;
170
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
171
+ var queuePending = false;
172
+ var queueDomReads = [];
173
+ var queueDomWrites = [];
174
+ var queueTask = (queue, write) => (cb) => {
175
+ queue.push(cb);
176
+ if (!queuePending) {
177
+ queuePending = true;
178
+ if (write && plt.$flags$ & 4 /* queueSync */) {
179
+ nextTick(flush);
180
+ } else {
181
+ plt.raf(flush);
182
+ }
183
+ }
184
+ };
185
+ var consume = (queue) => {
186
+ for (let i2 = 0; i2 < queue.length; i2++) {
187
+ try {
188
+ queue[i2](performance.now());
189
+ } catch (e) {
190
+ consoleError(e);
191
+ }
192
+ }
193
+ queue.length = 0;
194
+ };
195
+ var flush = () => {
196
+ consume(queueDomReads);
197
+ {
198
+ consume(queueDomWrites);
199
+ if (queuePending = queueDomReads.length > 0) {
200
+ plt.raf(flush);
201
+ }
202
+ }
203
+ };
204
+ var nextTick = (cb) => promiseResolve().then(cb);
205
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
206
+
207
+ // src/utils/style.ts
208
+ function createStyleSheetIfNeededAndSupported(styles2) {
209
+ return void 0;
210
+ }
211
+
212
+ // src/utils/shadow-root.ts
213
+ var globalStyleSheet;
214
+ function createShadowRoot(cmpMeta) {
215
+ var _a;
216
+ const opts = { mode: "open" };
217
+ const shadowRoot = this.attachShadow(opts);
218
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
219
+ if (globalStyleSheet) {
220
+ if (supportsMutableAdoptedStyleSheets) {
221
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
222
+ } else {
223
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
224
+ }
225
+ }
226
+ }
227
+ var getSlottedChildNodes = (childNodes) => {
228
+ const result = [];
229
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
230
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
231
+ if (slottedNode && slottedNode.isConnected) {
232
+ result.push(slottedNode);
233
+ }
234
+ }
235
+ return result;
236
+ };
237
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
238
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
239
+ return;
240
+ }
241
+ const slottedNodeLocation = document.createTextNode("");
242
+ slottedNodeLocation["s-nr"] = newChild;
243
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
244
+ const parent = slotNode["s-cr"].parentNode;
245
+ const appendMethod = internalCall(parent, "appendChild");
246
+ if (typeof position !== "undefined") {
247
+ slottedNodeLocation["s-oo"] = position;
248
+ const childNodes = internalCall(parent, "childNodes");
249
+ const slotRelocateNodes = [slottedNodeLocation];
250
+ childNodes.forEach((n) => {
251
+ if (n["s-nr"]) slotRelocateNodes.push(n);
252
+ });
253
+ slotRelocateNodes.sort((a, b) => {
254
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
255
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
256
+ return 0;
257
+ });
258
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
259
+ } else {
260
+ appendMethod.call(parent, slottedNodeLocation);
261
+ }
262
+ newChild["s-ol"] = slottedNodeLocation;
263
+ newChild["s-sh"] = slotNode["s-hn"];
264
+ };
265
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
266
+ function patchSlotNode(node) {
267
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
268
+ const assignedFactory = (elementsOnly) => (function(opts) {
269
+ const toReturn = [];
270
+ const slotName = this["s-sn"];
271
+ if (opts == null ? void 0 : opts.flatten) {
272
+ console.error(`
273
+ Flattening is not supported for Stencil non-shadow slots.
274
+ You can use \`.childNodes\` to nested slot fallback content.
275
+ If you have a particular use case, please open an issue on the Stencil repo.
276
+ `);
277
+ }
278
+ const parent = this["s-cr"].parentElement;
279
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
280
+ slottedNodes.forEach((n) => {
281
+ if (slotName === getSlotName(n)) {
282
+ toReturn.push(n);
283
+ }
284
+ });
285
+ if (elementsOnly) {
286
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
287
+ }
288
+ return toReturn;
289
+ }).bind(node);
290
+ node.assignedElements = assignedFactory(true);
291
+ node.assignedNodes = assignedFactory(false);
292
+ }
293
+ function internalCall(node, method) {
294
+ if ("__" + method in node) {
295
+ const toReturn = node["__" + method];
296
+ if (typeof toReturn !== "function") return toReturn;
297
+ return toReturn.bind(node);
298
+ } else {
299
+ if (typeof node[method] !== "function") return node[method];
300
+ return node[method].bind(node);
301
+ }
302
+ }
303
+ var createTime = (fnName, tagName = "") => {
304
+ {
305
+ return () => {
306
+ return;
307
+ };
308
+ }
309
+ };
310
+ var uniqueTime = (key, measureText) => {
311
+ {
312
+ return () => {
313
+ return;
314
+ };
315
+ }
316
+ };
317
+
318
+ // src/utils/query-nonce-meta-tag-content.ts
319
+ function queryNonceMetaTagContent(doc) {
320
+ var _a, _b, _c;
321
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
322
+ }
323
+
324
+ // src/runtime/styles.ts
325
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
326
+ var registerStyle = (scopeId2, cssText, allowCS) => {
327
+ let style = styles.get(scopeId2);
328
+ if (supportsConstructableStylesheets && allowCS) {
329
+ style = style || new CSSStyleSheet();
330
+ if (typeof style === "string") {
331
+ style = cssText;
332
+ } else {
333
+ style.replaceSync(cssText);
334
+ }
335
+ } else {
336
+ style = cssText;
337
+ }
338
+ styles.set(scopeId2, style);
339
+ };
340
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
341
+ var _a, _b, _c;
342
+ const scopeId2 = getScopeId(cmpMeta);
343
+ const style = styles.get(scopeId2);
344
+ if (!win.document) {
345
+ return scopeId2;
346
+ }
347
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
348
+ if (style) {
349
+ if (typeof style === "string") {
350
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
351
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
352
+ let styleElm;
353
+ if (!appliedStyles) {
354
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
355
+ }
356
+ const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
357
+ if (existingStyleElm) {
358
+ existingStyleElm.textContent = style;
359
+ } else if (!appliedStyles.has(scopeId2)) {
360
+ styleElm = win.document.createElement("style");
361
+ styleElm.textContent = style;
362
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
363
+ if (nonce != null) {
364
+ styleElm.setAttribute("nonce", nonce);
365
+ }
366
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
367
+ if (styleContainerNode.nodeName === "HEAD") {
368
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
369
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
370
+ styleContainerNode.insertBefore(
371
+ styleElm,
372
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
373
+ );
374
+ } else if ("host" in styleContainerNode) {
375
+ if (supportsConstructableStylesheets) {
376
+ const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
377
+ const stylesheet = new currentWindow.CSSStyleSheet();
378
+ stylesheet.replaceSync(style);
379
+ if (supportsMutableAdoptedStyleSheets) {
380
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
381
+ } else {
382
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
383
+ }
384
+ } else {
385
+ const existingStyleContainer = styleContainerNode.querySelector("style");
386
+ if (existingStyleContainer) {
387
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
388
+ } else {
389
+ styleContainerNode.prepend(styleElm);
390
+ }
391
+ }
392
+ } else {
393
+ styleContainerNode.append(styleElm);
394
+ }
395
+ }
396
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
397
+ styleContainerNode.insertBefore(styleElm, null);
398
+ }
399
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
400
+ styleElm.textContent += SLOT_FB_CSS;
401
+ }
402
+ if (appliedStyles) {
403
+ appliedStyles.add(scopeId2);
404
+ }
405
+ }
406
+ } else {
407
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
408
+ if (!appliedStyles) {
409
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
410
+ }
411
+ if (!appliedStyles.has(scopeId2)) {
412
+ const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
413
+ let stylesheet;
414
+ if (style.constructor === currentWindow.CSSStyleSheet) {
415
+ stylesheet = style;
416
+ } else {
417
+ stylesheet = new currentWindow.CSSStyleSheet();
418
+ for (let i2 = 0; i2 < style.cssRules.length; i2++) {
419
+ stylesheet.insertRule(style.cssRules[i2].cssText, i2);
420
+ }
421
+ }
422
+ if (supportsMutableAdoptedStyleSheets) {
423
+ styleContainerNode.adoptedStyleSheets.push(stylesheet);
424
+ } else {
425
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
426
+ }
427
+ appliedStyles.add(scopeId2);
428
+ }
429
+ }
430
+ }
431
+ return scopeId2;
432
+ };
433
+ var attachStyles = (hostRef) => {
434
+ const cmpMeta = hostRef.$cmpMeta$;
435
+ const elm = hostRef.$hostElement$;
436
+ const flags = cmpMeta.$flags$;
437
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
438
+ const scopeId2 = addStyle(
439
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
440
+ cmpMeta);
441
+ if (flags & 10 /* needsScopedEncapsulation */) {
442
+ elm["s-sc"] = scopeId2;
443
+ elm.classList.add(scopeId2 + "-h");
444
+ }
445
+ endAttachStyles();
446
+ };
447
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
448
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
449
+ var hydrateScopedToShadow = () => {
450
+ if (!win.document) {
451
+ return;
452
+ }
453
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
454
+ let i2 = 0;
455
+ for (; i2 < styles2.length; i2++) {
456
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
457
+ }
458
+ };
459
+ var isComplexType = (o) => {
460
+ o = typeof o;
461
+ return o === "object" || o === "function";
462
+ };
463
+
464
+ // src/runtime/vdom/h.ts
465
+ var h = (nodeName, vnodeData, ...children) => {
466
+ if (typeof nodeName === "string") {
467
+ nodeName = transformTag(nodeName);
468
+ }
469
+ let child = null;
470
+ let key = null;
471
+ let simple = false;
472
+ let lastSimple = false;
473
+ const vNodeChildren = [];
474
+ const walk = (c) => {
475
+ for (let i2 = 0; i2 < c.length; i2++) {
476
+ child = c[i2];
477
+ if (Array.isArray(child)) {
478
+ walk(child);
479
+ } else if (child != null && typeof child !== "boolean") {
480
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
481
+ child = String(child);
482
+ }
483
+ if (simple && lastSimple) {
484
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
485
+ } else {
486
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
487
+ }
488
+ lastSimple = simple;
489
+ }
490
+ }
491
+ };
492
+ walk(children);
493
+ if (vnodeData) {
494
+ if (vnodeData.key) {
495
+ key = vnodeData.key;
496
+ }
497
+ }
498
+ const vnode = newVNode(nodeName, null);
499
+ vnode.$attrs$ = vnodeData;
500
+ if (vNodeChildren.length > 0) {
501
+ vnode.$children$ = vNodeChildren;
502
+ }
503
+ {
504
+ vnode.$key$ = key;
505
+ }
506
+ return vnode;
507
+ };
508
+ var newVNode = (tag, text) => {
509
+ const vnode = {
510
+ $flags$: 0,
511
+ $tag$: tag,
512
+ // Normalize undefined to null to prevent rendering "undefined" as text
513
+ $text$: text != null ? text : null,
514
+ $elm$: null,
515
+ $children$: null
516
+ };
517
+ {
518
+ vnode.$attrs$ = null;
519
+ }
520
+ {
521
+ vnode.$key$ = null;
522
+ }
523
+ return vnode;
524
+ };
525
+ var Host = {};
526
+ var isHost = (node) => node && node.$tag$ === Host;
527
+
528
+ // src/runtime/client-hydrate.ts
529
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
530
+ var _a, _b, _c, _d;
531
+ const endHydrate = createTime("hydrateClient", tagName);
532
+ const shadowRoot = hostElm.shadowRoot;
533
+ const childRenderNodes = [];
534
+ const slotNodes = [];
535
+ const slottedNodes = [];
536
+ const shadowRootNodes = shadowRoot ? [] : null;
537
+ const vnode = newVNode(tagName, null);
538
+ vnode.$elm$ = hostElm;
539
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
540
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
541
+ }
542
+ hostElm[HYDRATE_ID] = hostId;
543
+ hostElm.removeAttribute(HYDRATE_ID);
544
+ hostRef.$vnode$ = clientHydrate(
545
+ vnode,
546
+ childRenderNodes,
547
+ slotNodes,
548
+ shadowRootNodes,
549
+ hostElm,
550
+ hostElm,
551
+ hostId,
552
+ slottedNodes
553
+ );
554
+ let crIndex = 0;
555
+ const crLength = childRenderNodes.length;
556
+ let childRenderNode;
557
+ for (crIndex; crIndex < crLength; crIndex++) {
558
+ childRenderNode = childRenderNodes[crIndex];
559
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
560
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
561
+ const node = childRenderNode.$elm$;
562
+ if (!shadowRoot) {
563
+ node["s-hn"] = transformTag(tagName).toUpperCase();
564
+ if (childRenderNode.$tag$ === "slot") {
565
+ node["s-cr"] = hostElm["s-cr"];
566
+ }
567
+ } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
568
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
569
+ if (cmpMeta) {
570
+ const scopeId3 = getScopeId(
571
+ cmpMeta.$cmpMeta$);
572
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
573
+ if (styleSheet) {
574
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
575
+ }
576
+ }
577
+ }
578
+ if (childRenderNode.$tag$ === "slot") {
579
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
580
+ if (childRenderNode.$children$) {
581
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
582
+ if (!childRenderNode.$elm$.childNodes.length) {
583
+ childRenderNode.$children$.forEach((c) => {
584
+ childRenderNode.$elm$.appendChild(c.$elm$);
585
+ });
586
+ }
587
+ } else {
588
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
589
+ }
590
+ }
591
+ if (orgLocationNode && orgLocationNode.isConnected) {
592
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
593
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
594
+ }
595
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
596
+ if (!shadowRoot) {
597
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
598
+ }
599
+ }
600
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
601
+ plt.$orgLocNodes$.delete(orgLocationId);
602
+ }
603
+ }
604
+ const hosts = [];
605
+ const snLen = slottedNodes.length;
606
+ let snIndex = 0;
607
+ let slotGroup;
608
+ let snGroupIdx;
609
+ let snGroupLen;
610
+ let slottedItem;
611
+ let currentPos = 0;
612
+ for (snIndex; snIndex < snLen; snIndex++) {
613
+ slotGroup = slottedNodes[snIndex];
614
+ if (!slotGroup || !slotGroup.length) continue;
615
+ snGroupLen = slotGroup.length;
616
+ snGroupIdx = 0;
617
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
618
+ slottedItem = slotGroup[snGroupIdx];
619
+ if (!hosts[slottedItem.hostId]) {
620
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
621
+ }
622
+ if (!hosts[slottedItem.hostId]) continue;
623
+ const hostEle = hosts[slottedItem.hostId];
624
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
625
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
626
+ }
627
+ if (!hostEle.shadowRoot || !shadowRoot) {
628
+ if (!slottedItem.slot["s-cr"]) {
629
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
630
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
631
+ slottedItem.slot["s-cr"] = hostEle;
632
+ } else {
633
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
634
+ }
635
+ }
636
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
637
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
638
+ slottedItem.node.removeAttribute("slot");
639
+ }
640
+ }
641
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
642
+ }
643
+ }
644
+ if (shadowRoot && !shadowRoot.childNodes.length) {
645
+ let rnIdex = 0;
646
+ const rnLen = shadowRootNodes.length;
647
+ if (rnLen) {
648
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
649
+ const node = shadowRootNodes[rnIdex];
650
+ if (node) {
651
+ shadowRoot.appendChild(node);
652
+ }
653
+ }
654
+ Array.from(hostElm.childNodes).forEach((node) => {
655
+ if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
656
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
657
+ node.removeAttribute("hidden");
658
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
659
+ node.parentNode.removeChild(node);
660
+ }
661
+ }
662
+ });
663
+ }
664
+ }
665
+ hostRef.$hostElement$ = hostElm;
666
+ endHydrate();
667
+ };
668
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
669
+ let childNodeType;
670
+ let childIdSplt;
671
+ let childVNode;
672
+ let i2;
673
+ if (node.nodeType === 1 /* ElementNode */) {
674
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
675
+ if (childNodeType) {
676
+ childIdSplt = childNodeType.split(".");
677
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
678
+ childVNode = createSimpleVNode({
679
+ $flags$: 0,
680
+ $hostId$: childIdSplt[0],
681
+ $nodeId$: childIdSplt[1],
682
+ $depth$: childIdSplt[2],
683
+ $index$: childIdSplt[3],
684
+ $tag$: node.tagName.toLowerCase(),
685
+ $elm$: node,
686
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
687
+ // won't try to reconcile them. Classes set on the node will be blown away.
688
+ $attrs$: { class: node.className || "" }
689
+ });
690
+ childRenderNodes.push(childVNode);
691
+ node.removeAttribute(HYDRATE_CHILD_ID);
692
+ if (!parentVNode.$children$) {
693
+ parentVNode.$children$ = [];
694
+ }
695
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
696
+ if (typeof slotName === "string") {
697
+ if (childVNode.$tag$ === "slot-fb") {
698
+ addSlot(
699
+ slotName,
700
+ childIdSplt[2],
701
+ childVNode,
702
+ node,
703
+ parentVNode,
704
+ childRenderNodes,
705
+ slotNodes,
706
+ shadowRootNodes,
707
+ slottedNodes
708
+ );
709
+ }
710
+ childVNode.$elm$["s-sn"] = slotName;
711
+ childVNode.$elm$.removeAttribute("s-sn");
712
+ }
713
+ if (childVNode.$index$ !== void 0) {
714
+ parentVNode.$children$[childVNode.$index$] = childVNode;
715
+ }
716
+ parentVNode = childVNode;
717
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
718
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
719
+ }
720
+ }
721
+ }
722
+ if (node.shadowRoot) {
723
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
724
+ clientHydrate(
725
+ parentVNode,
726
+ childRenderNodes,
727
+ slotNodes,
728
+ shadowRootNodes,
729
+ hostElm,
730
+ node.shadowRoot.childNodes[i2],
731
+ hostId,
732
+ slottedNodes
733
+ );
734
+ }
735
+ }
736
+ const nonShadowNodes = node.__childNodes || node.childNodes;
737
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
738
+ clientHydrate(
739
+ parentVNode,
740
+ childRenderNodes,
741
+ slotNodes,
742
+ shadowRootNodes,
743
+ hostElm,
744
+ nonShadowNodes[i2],
745
+ hostId,
746
+ slottedNodes
747
+ );
748
+ }
749
+ } else if (node.nodeType === 8 /* CommentNode */) {
750
+ childIdSplt = node.nodeValue.split(".");
751
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
752
+ childNodeType = childIdSplt[0];
753
+ childVNode = createSimpleVNode({
754
+ $hostId$: childIdSplt[1],
755
+ $nodeId$: childIdSplt[2],
756
+ $depth$: childIdSplt[3],
757
+ $index$: childIdSplt[4] || "0",
758
+ $elm$: node,
759
+ $attrs$: null,
760
+ $children$: null,
761
+ $key$: null,
762
+ $name$: null,
763
+ $tag$: null,
764
+ $text$: null
765
+ });
766
+ if (childNodeType === TEXT_NODE_ID) {
767
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
768
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
769
+ childVNode.$text$ = childVNode.$elm$.textContent;
770
+ childRenderNodes.push(childVNode);
771
+ node.remove();
772
+ if (hostId === childVNode.$hostId$) {
773
+ if (!parentVNode.$children$) {
774
+ parentVNode.$children$ = [];
775
+ }
776
+ parentVNode.$children$[childVNode.$index$] = childVNode;
777
+ }
778
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
779
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
780
+ }
781
+ }
782
+ } else if (childNodeType === COMMENT_NODE_ID) {
783
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
784
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
785
+ childRenderNodes.push(childVNode);
786
+ node.remove();
787
+ }
788
+ } else if (childVNode.$hostId$ === hostId) {
789
+ if (childNodeType === SLOT_NODE_ID) {
790
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
791
+ addSlot(
792
+ slotName,
793
+ childIdSplt[2],
794
+ childVNode,
795
+ node,
796
+ parentVNode,
797
+ childRenderNodes,
798
+ slotNodes,
799
+ shadowRootNodes,
800
+ slottedNodes
801
+ );
802
+ } else if (childNodeType === CONTENT_REF_ID) {
803
+ if (shadowRootNodes) {
804
+ node.remove();
805
+ }
806
+ }
807
+ }
808
+ }
809
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
810
+ const vnode = newVNode(null, node.textContent);
811
+ vnode.$elm$ = node;
812
+ vnode.$index$ = "0";
813
+ parentVNode.$children$ = [vnode];
814
+ }
815
+ return parentVNode;
816
+ };
817
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
818
+ if (node.nodeType === 1 /* ElementNode */) {
819
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
820
+ if (componentId) {
821
+ orgLocNodes.set(componentId, node);
822
+ }
823
+ let i2 = 0;
824
+ if (node.shadowRoot) {
825
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
826
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
827
+ }
828
+ }
829
+ const nonShadowNodes = node.__childNodes || node.childNodes;
830
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
831
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
832
+ }
833
+ } else if (node.nodeType === 8 /* CommentNode */) {
834
+ const childIdSplt = node.nodeValue.split(".");
835
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
836
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
837
+ node.nodeValue = "";
838
+ node["s-en"] = childIdSplt[3];
839
+ }
840
+ }
841
+ };
842
+ var createSimpleVNode = (vnode) => {
843
+ const defaultVNode = {
844
+ $flags$: 0,
845
+ $hostId$: null,
846
+ $nodeId$: null,
847
+ $depth$: null,
848
+ $index$: "0",
849
+ $elm$: null,
850
+ $attrs$: null,
851
+ $children$: null,
852
+ $key$: null,
853
+ $name$: null,
854
+ $tag$: null,
855
+ $text$: null
856
+ };
857
+ return { ...defaultVNode, ...vnode };
858
+ };
859
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
860
+ node["s-sr"] = true;
861
+ childVNode.$name$ = slotName || null;
862
+ childVNode.$tag$ = "slot";
863
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
864
+ if (shadowRootNodes && win.document) {
865
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
866
+ if (childVNode.$name$) {
867
+ childVNode.$elm$.setAttribute("name", slotName);
868
+ }
869
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
870
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
871
+ } else {
872
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
873
+ }
874
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
875
+ node.remove();
876
+ if (childVNode.$depth$ === "0") {
877
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
878
+ }
879
+ } else {
880
+ const slot = childVNode.$elm$;
881
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
882
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
883
+ patchSlotNode(node);
884
+ if (shouldMove) {
885
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
886
+ }
887
+ }
888
+ childRenderNodes.push(childVNode);
889
+ slotNodes.push(childVNode);
890
+ if (!parentVNode.$children$) {
891
+ parentVNode.$children$ = [];
892
+ }
893
+ parentVNode.$children$[childVNode.$index$] = childVNode;
894
+ }
895
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
896
+ var _a, _b;
897
+ let slottedNode = slotNode.nextSibling;
898
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
899
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
900
+ do {
901
+ if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) {
902
+ slottedNode["s-sn"] = slotName;
903
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
904
+ }
905
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
906
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
907
+ };
908
+ var findCorrespondingNode = (node, type) => {
909
+ let sibling = node;
910
+ do {
911
+ sibling = sibling.nextSibling;
912
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
913
+ return sibling;
914
+ };
915
+
916
+ // src/utils/remote-value.ts
917
+ var RemoteValue = class _RemoteValue {
918
+ /**
919
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
920
+ *
921
+ * @param serialized The serialized LocalValue object
922
+ * @returns The original JavaScript value/object
923
+ */
924
+ static fromLocalValue(serialized) {
925
+ const type = serialized[TYPE_CONSTANT];
926
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
927
+ switch (type) {
928
+ case "string" /* String */:
929
+ return value;
930
+ case "boolean" /* Boolean */:
931
+ return value;
932
+ case "bigint" /* BigInt */:
933
+ return BigInt(value);
934
+ case "undefined" /* Undefined */:
935
+ return void 0;
936
+ case "null" /* Null */:
937
+ return null;
938
+ case "number" /* Number */:
939
+ if (value === "NaN") return NaN;
940
+ if (value === "-0") return -0;
941
+ if (value === "Infinity") return Infinity;
942
+ if (value === "-Infinity") return -Infinity;
943
+ return value;
944
+ case "array" /* Array */:
945
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
946
+ case "date" /* Date */:
947
+ return new Date(value);
948
+ case "map" /* Map */:
949
+ const map = /* @__PURE__ */ new Map();
950
+ for (const [key, val] of value) {
951
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
952
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
953
+ map.set(deserializedKey, deserializedValue);
954
+ }
955
+ return map;
956
+ case "object" /* Object */:
957
+ const obj = {};
958
+ for (const [key, val] of value) {
959
+ obj[key] = _RemoteValue.fromLocalValue(val);
960
+ }
961
+ return obj;
962
+ case "regexp" /* RegularExpression */:
963
+ const { pattern, flags } = value;
964
+ return new RegExp(pattern, flags);
965
+ case "set" /* Set */:
966
+ const set = /* @__PURE__ */ new Set();
967
+ for (const item of value) {
968
+ set.add(_RemoteValue.fromLocalValue(item));
969
+ }
970
+ return set;
971
+ case "symbol" /* Symbol */:
972
+ return Symbol(value);
973
+ default:
974
+ throw new Error(`Unsupported type: ${type}`);
975
+ }
976
+ }
977
+ /**
978
+ * Utility method to deserialize multiple LocalValues at once
979
+ *
980
+ * @param serializedValues Array of serialized LocalValue objects
981
+ * @returns Array of deserialized JavaScript values
982
+ */
983
+ static fromLocalValueArray(serializedValues) {
984
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
985
+ }
986
+ /**
987
+ * Verifies if the given object matches the structure of a serialized LocalValue
988
+ *
989
+ * @param obj Object to verify
990
+ * @returns boolean indicating if the object has LocalValue structure
991
+ */
992
+ static isLocalValueObject(obj) {
993
+ if (typeof obj !== "object" || obj === null) {
994
+ return false;
995
+ }
996
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
997
+ return false;
998
+ }
999
+ const type = obj[TYPE_CONSTANT];
1000
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1001
+ if (!hasTypeProperty) {
1002
+ return false;
1003
+ }
1004
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1005
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1006
+ }
1007
+ return true;
1008
+ }
1009
+ };
1010
+
1011
+ // src/utils/serialize.ts
1012
+ function deserializeProperty(value) {
1013
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1014
+ return value;
1015
+ }
1016
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1017
+ }
1018
+
1019
+ // src/runtime/parse-property-value.ts
1020
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1021
+ if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
1022
+ propValue = deserializeProperty(propValue);
1023
+ return propValue;
1024
+ }
1025
+ if (propValue != null && !isComplexType(propValue)) {
1026
+ if (propType & 1 /* String */) {
1027
+ return String(propValue);
1028
+ }
1029
+ return propValue;
1030
+ }
1031
+ return propValue;
1032
+ };
1033
+ var emitEvent = (elm, name, opts) => {
1034
+ const ev = plt.ce(name, opts);
1035
+ elm.dispatchEvent(ev);
1036
+ return ev;
1037
+ };
1038
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
1039
+ if (oldValue === newValue) {
1040
+ return;
1041
+ }
1042
+ memberName.toLowerCase();
1043
+ if (memberName === "style") {
1044
+ {
1045
+ for (const prop in oldValue) {
1046
+ if (!newValue || newValue[prop] == null) {
1047
+ if (prop.includes("-")) {
1048
+ elm.style.removeProperty(prop);
1049
+ } else {
1050
+ elm.style[prop] = "";
1051
+ }
1052
+ }
1053
+ }
1054
+ }
1055
+ for (const prop in newValue) {
1056
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
1057
+ if (prop.includes("-")) {
1058
+ elm.style.setProperty(prop, newValue[prop]);
1059
+ } else {
1060
+ elm.style[prop] = newValue[prop];
1061
+ }
1062
+ }
1063
+ }
1064
+ } else ;
1065
+ };
1066
+
1067
+ // src/runtime/vdom/update-element.ts
1068
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
1069
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
1070
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
1071
+ const newVnodeAttrs = newVnode.$attrs$ || {};
1072
+ {
1073
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
1074
+ if (!(memberName in newVnodeAttrs)) {
1075
+ setAccessor(
1076
+ elm,
1077
+ memberName,
1078
+ oldVnodeAttrs[memberName],
1079
+ void 0);
1080
+ }
1081
+ }
1082
+ }
1083
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
1084
+ setAccessor(
1085
+ elm,
1086
+ memberName,
1087
+ oldVnodeAttrs[memberName],
1088
+ newVnodeAttrs[memberName]);
1089
+ }
1090
+ };
1091
+ function sortedAttrNames(attrNames) {
1092
+ return attrNames.includes("ref") ? (
1093
+ // we need to sort these to ensure that `'ref'` is the last attr
1094
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
1095
+ ) : (
1096
+ // no need to sort, return the original array
1097
+ attrNames
1098
+ );
1099
+ }
1100
+ var hostTagName;
1101
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1102
+ const newVNode2 = newParentVNode.$children$[childIndex];
1103
+ let i2 = 0;
1104
+ let elm;
1105
+ let childNode;
1106
+ if (newVNode2.$text$ != null) {
1107
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
1108
+ } else {
1109
+ if (!win.document) {
1110
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
1111
+ }
1112
+ elm = newVNode2.$elm$ = win.document.createElement(
1113
+ newVNode2.$tag$
1114
+ );
1115
+ {
1116
+ updateElement(null, newVNode2);
1117
+ }
1118
+ if (newVNode2.$children$) {
1119
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
1120
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
1121
+ childNode = createElm(oldParentVNode, newVNode2, i2);
1122
+ if (childNode) {
1123
+ appendTarget.appendChild(childNode);
1124
+ }
1125
+ }
1126
+ }
1127
+ }
1128
+ elm["s-hn"] = hostTagName;
1129
+ return elm;
1130
+ };
1131
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1132
+ let containerElm = parentElm;
1133
+ let childNode;
1134
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1135
+ containerElm = containerElm.shadowRoot;
1136
+ }
1137
+ if (parentVNode.$tag$ === "template") {
1138
+ containerElm = containerElm.content;
1139
+ }
1140
+ for (; startIdx <= endIdx; ++startIdx) {
1141
+ if (vnodes[startIdx]) {
1142
+ childNode = createElm(null, parentVNode, startIdx);
1143
+ if (childNode) {
1144
+ vnodes[startIdx].$elm$ = childNode;
1145
+ insertBefore(containerElm, childNode, before);
1146
+ }
1147
+ }
1148
+ }
1149
+ };
1150
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
1151
+ for (let index = startIdx; index <= endIdx; ++index) {
1152
+ const vnode = vnodes[index];
1153
+ if (vnode) {
1154
+ const elm = vnode.$elm$;
1155
+ if (elm) {
1156
+ elm.remove();
1157
+ }
1158
+ }
1159
+ }
1160
+ };
1161
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
1162
+ let oldStartIdx = 0;
1163
+ let newStartIdx = 0;
1164
+ let idxInOld = 0;
1165
+ let i2 = 0;
1166
+ let oldEndIdx = oldCh.length - 1;
1167
+ let oldStartVnode = oldCh[0];
1168
+ let oldEndVnode = oldCh[oldEndIdx];
1169
+ let newEndIdx = newCh.length - 1;
1170
+ let newStartVnode = newCh[0];
1171
+ let newEndVnode = newCh[newEndIdx];
1172
+ let node;
1173
+ let elmToMove;
1174
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
1175
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1176
+ if (oldStartVnode == null) {
1177
+ oldStartVnode = oldCh[++oldStartIdx];
1178
+ } else if (oldEndVnode == null) {
1179
+ oldEndVnode = oldCh[--oldEndIdx];
1180
+ } else if (newStartVnode == null) {
1181
+ newStartVnode = newCh[++newStartIdx];
1182
+ } else if (newEndVnode == null) {
1183
+ newEndVnode = newCh[--newEndIdx];
1184
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1185
+ patch(oldStartVnode, newStartVnode, isInitialRender);
1186
+ oldStartVnode = oldCh[++oldStartIdx];
1187
+ newStartVnode = newCh[++newStartIdx];
1188
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1189
+ patch(oldEndVnode, newEndVnode, isInitialRender);
1190
+ oldEndVnode = oldCh[--oldEndIdx];
1191
+ newEndVnode = newCh[--newEndIdx];
1192
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1193
+ patch(oldStartVnode, newEndVnode, isInitialRender);
1194
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1195
+ oldStartVnode = oldCh[++oldStartIdx];
1196
+ newEndVnode = newCh[--newEndIdx];
1197
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1198
+ patch(oldEndVnode, newStartVnode, isInitialRender);
1199
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1200
+ oldEndVnode = oldCh[--oldEndIdx];
1201
+ newStartVnode = newCh[++newStartIdx];
1202
+ } else {
1203
+ idxInOld = -1;
1204
+ {
1205
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1206
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1207
+ idxInOld = i2;
1208
+ break;
1209
+ }
1210
+ }
1211
+ }
1212
+ if (idxInOld >= 0) {
1213
+ elmToMove = oldCh[idxInOld];
1214
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1215
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1216
+ } else {
1217
+ patch(elmToMove, newStartVnode, isInitialRender);
1218
+ oldCh[idxInOld] = void 0;
1219
+ node = elmToMove.$elm$;
1220
+ }
1221
+ newStartVnode = newCh[++newStartIdx];
1222
+ } else {
1223
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1224
+ newStartVnode = newCh[++newStartIdx];
1225
+ }
1226
+ if (node) {
1227
+ {
1228
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1229
+ }
1230
+ }
1231
+ }
1232
+ }
1233
+ if (oldStartIdx > oldEndIdx) {
1234
+ addVnodes(
1235
+ parentElm,
1236
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
1237
+ newVNode2,
1238
+ newCh,
1239
+ newStartIdx,
1240
+ newEndIdx
1241
+ );
1242
+ } else if (newStartIdx > newEndIdx) {
1243
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1244
+ }
1245
+ };
1246
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1247
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1248
+ if (!isInitialRender) {
1249
+ return leftVNode.$key$ === rightVNode.$key$;
1250
+ }
1251
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1252
+ leftVNode.$key$ = rightVNode.$key$;
1253
+ }
1254
+ return true;
1255
+ }
1256
+ return false;
1257
+ };
1258
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1259
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
1260
+ const oldChildren = oldVNode.$children$;
1261
+ const newChildren = newVNode2.$children$;
1262
+ const text = newVNode2.$text$;
1263
+ if (text == null) {
1264
+ {
1265
+ updateElement(oldVNode, newVNode2);
1266
+ }
1267
+ if (oldChildren !== null && newChildren !== null) {
1268
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1269
+ } else if (newChildren !== null) {
1270
+ if (oldVNode.$text$ !== null) {
1271
+ elm.textContent = "";
1272
+ }
1273
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1274
+ } else if (
1275
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1276
+ !isInitialRender && BUILD.updatable && oldChildren !== null
1277
+ ) {
1278
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1279
+ } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
1280
+ newVNode2.$children$ = oldChildren;
1281
+ }
1282
+ } else if (oldVNode.$text$ !== text) {
1283
+ elm.data = text;
1284
+ }
1285
+ };
1286
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
1287
+ if (parent.__insertBefore) {
1288
+ return parent.__insertBefore(newNode, reference);
1289
+ } else {
1290
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1291
+ }
1292
+ };
1293
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1294
+ const hostElm = hostRef.$hostElement$;
1295
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1296
+ const isHostElement = isHost(renderFnResults);
1297
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
1298
+ hostTagName = hostElm.tagName;
1299
+ if (isInitialLoad && rootVnode.$attrs$) {
1300
+ for (const key of Object.keys(rootVnode.$attrs$)) {
1301
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
1302
+ rootVnode.$attrs$[key] = hostElm[key];
1303
+ }
1304
+ }
1305
+ }
1306
+ rootVnode.$tag$ = null;
1307
+ rootVnode.$flags$ |= 4 /* isHost */;
1308
+ hostRef.$vnode$ = rootVnode;
1309
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
1310
+ patch(oldVNode, rootVnode, isInitialLoad);
1311
+ };
1312
+
1313
+ // src/runtime/update-component.ts
1314
+ var attachToAncestor = (hostRef, ancestorComponent) => {
1315
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
1316
+ const index = ancestorComponent["s-p"].push(
1317
+ new Promise(
1318
+ (r) => hostRef.$onRenderResolve$ = () => {
1319
+ ancestorComponent["s-p"].splice(index - 1, 1);
1320
+ r();
1321
+ }
1322
+ )
1323
+ );
1324
+ }
1325
+ };
1326
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
1327
+ {
1328
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1329
+ }
1330
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1331
+ hostRef.$flags$ |= 512 /* needsRerender */;
1332
+ return;
1333
+ }
1334
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1335
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1336
+ if (isInitialLoad) {
1337
+ queueMicrotask(() => {
1338
+ dispatch();
1339
+ });
1340
+ return;
1341
+ }
1342
+ return writeTask(dispatch) ;
1343
+ };
1344
+ var dispatchHooks = (hostRef, isInitialLoad) => {
1345
+ const elm = hostRef.$hostElement$;
1346
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
1347
+ const instance = hostRef.$lazyInstance$ ;
1348
+ if (!instance) {
1349
+ throw new Error(
1350
+ `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
1351
+ );
1352
+ }
1353
+ let maybePromise;
1354
+ if (isInitialLoad) {
1355
+ {
1356
+ if (hostRef.$fetchedCbList$.length) {
1357
+ hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
1358
+ }
1359
+ }
1360
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1361
+ } else {
1362
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1363
+ }
1364
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1365
+ endSchedule();
1366
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1367
+ };
1368
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1369
+ console.error(err);
1370
+ fn();
1371
+ }) : fn();
1372
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
1373
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1374
+ var _a;
1375
+ const elm = hostRef.$hostElement$;
1376
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
1377
+ const rc = elm["s-rc"];
1378
+ if (isInitialLoad) {
1379
+ attachStyles(hostRef);
1380
+ }
1381
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
1382
+ {
1383
+ callRender(hostRef, instance, elm, isInitialLoad);
1384
+ }
1385
+ if (rc) {
1386
+ rc.map((cb) => cb());
1387
+ elm["s-rc"] = void 0;
1388
+ }
1389
+ endRender();
1390
+ endUpdate();
1391
+ {
1392
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
1393
+ const postUpdate = () => postUpdateComponent(hostRef);
1394
+ if (childrenPromises.length === 0) {
1395
+ postUpdate();
1396
+ } else {
1397
+ Promise.all(childrenPromises).then(postUpdate);
1398
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1399
+ childrenPromises.length = 0;
1400
+ }
1401
+ }
1402
+ };
1403
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1404
+ try {
1405
+ instance = instance.render() ;
1406
+ {
1407
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
1408
+ }
1409
+ {
1410
+ hostRef.$flags$ |= 2 /* hasRendered */;
1411
+ }
1412
+ {
1413
+ {
1414
+ {
1415
+ renderVdom(hostRef, instance, isInitialLoad);
1416
+ }
1417
+ }
1418
+ }
1419
+ } catch (e) {
1420
+ consoleError(e, hostRef.$hostElement$);
1421
+ }
1422
+ return null;
1423
+ };
1424
+ var postUpdateComponent = (hostRef) => {
1425
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1426
+ const elm = hostRef.$hostElement$;
1427
+ const endPostUpdate = createTime("postUpdate", tagName);
1428
+ const instance = hostRef.$lazyInstance$ ;
1429
+ const ancestorComponent = hostRef.$ancestorComponent$;
1430
+ safeCall(instance, "componentDidRender", void 0, elm);
1431
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1432
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1433
+ {
1434
+ addHydratedFlag(elm);
1435
+ }
1436
+ safeCall(instance, "componentDidLoad", void 0, elm);
1437
+ endPostUpdate();
1438
+ {
1439
+ hostRef.$onReadyResolve$(elm);
1440
+ if (!ancestorComponent) {
1441
+ appDidLoad();
1442
+ }
1443
+ }
1444
+ } else {
1445
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1446
+ endPostUpdate();
1447
+ }
1448
+ {
1449
+ if (hostRef.$onRenderResolve$) {
1450
+ hostRef.$onRenderResolve$();
1451
+ hostRef.$onRenderResolve$ = void 0;
1452
+ }
1453
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1454
+ nextTick(() => scheduleUpdate(hostRef, false));
1455
+ }
1456
+ hostRef.$flags$ &= -517;
1457
+ }
1458
+ };
1459
+ var appDidLoad = (who) => {
1460
+ var _a;
1461
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1462
+ {
1463
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
1464
+ plt.$orgLocNodes$.clear();
1465
+ }
1466
+ }
1467
+ };
1468
+ var safeCall = (instance, method, arg, elm) => {
1469
+ if (instance && instance[method]) {
1470
+ try {
1471
+ return instance[method](arg);
1472
+ } catch (e) {
1473
+ consoleError(e, elm);
1474
+ }
1475
+ }
1476
+ return void 0;
1477
+ };
1478
+ var addHydratedFlag = (elm) => {
1479
+ var _a;
1480
+ return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
1481
+ };
1482
+
1483
+ // src/runtime/set-value.ts
1484
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1485
+ var setValue = (ref, propName, newVal, cmpMeta) => {
1486
+ const hostRef = getHostRef(ref);
1487
+ if (!hostRef) {
1488
+ return;
1489
+ }
1490
+ if (!hostRef) {
1491
+ throw new Error(
1492
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
1493
+ );
1494
+ }
1495
+ const oldVal = hostRef.$instanceValues$.get(propName);
1496
+ const flags = hostRef.$flags$;
1497
+ const instance = hostRef.$lazyInstance$ ;
1498
+ newVal = parsePropertyValue(
1499
+ newVal,
1500
+ cmpMeta.$members$[propName][0]);
1501
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1502
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1503
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1504
+ hostRef.$instanceValues$.set(propName, newVal);
1505
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1506
+ if (instance.componentShouldUpdate) {
1507
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1508
+ return;
1509
+ }
1510
+ }
1511
+ scheduleUpdate(hostRef, false);
1512
+ }
1513
+ }
1514
+ };
1515
+
1516
+ // src/runtime/proxy-component.ts
1517
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
1518
+ var _a, _b;
1519
+ const prototype = Cstr.prototype;
1520
+ if (cmpMeta.$members$ || BUILD.propChangeCallback) {
1521
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1522
+ members.map(([memberName, [memberFlags]]) => {
1523
+ if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1524
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
1525
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1526
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1527
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1528
+ Object.defineProperty(prototype, memberName, {
1529
+ get() {
1530
+ {
1531
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1532
+ return getValue(this, memberName);
1533
+ }
1534
+ const ref = getHostRef(this);
1535
+ const instance = ref ? ref.$lazyInstance$ : prototype;
1536
+ if (!instance) return;
1537
+ return instance[memberName];
1538
+ }
1539
+ },
1540
+ configurable: true,
1541
+ enumerable: true
1542
+ });
1543
+ }
1544
+ Object.defineProperty(prototype, memberName, {
1545
+ set(newValue) {
1546
+ const ref = getHostRef(this);
1547
+ if (!ref) {
1548
+ return;
1549
+ }
1550
+ if (origSetter) {
1551
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1552
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1553
+ newValue = ref.$instanceValues$.get(memberName);
1554
+ }
1555
+ origSetter.apply(this, [
1556
+ parsePropertyValue(
1557
+ newValue,
1558
+ memberFlags)
1559
+ ]);
1560
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1561
+ setValue(this, memberName, newValue, cmpMeta);
1562
+ return;
1563
+ }
1564
+ {
1565
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1566
+ setValue(this, memberName, newValue, cmpMeta);
1567
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1568
+ ref.$fetchedCbList$.push(() => {
1569
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1570
+ ref.$lazyInstance$[memberName] = newValue;
1571
+ }
1572
+ });
1573
+ }
1574
+ return;
1575
+ }
1576
+ const setterSetVal = () => {
1577
+ const currentValue = ref.$lazyInstance$[memberName];
1578
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
1579
+ ref.$instanceValues$.set(memberName, currentValue);
1580
+ }
1581
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
1582
+ newValue,
1583
+ memberFlags);
1584
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1585
+ };
1586
+ if (ref.$lazyInstance$) {
1587
+ setterSetVal();
1588
+ } else {
1589
+ ref.$fetchedCbList$.push(() => {
1590
+ setterSetVal();
1591
+ });
1592
+ }
1593
+ }
1594
+ }
1595
+ });
1596
+ }
1597
+ });
1598
+ if ((flags & 1 /* isElementConstructor */)) {
1599
+ const attrNameToPropName = /* @__PURE__ */ new Map();
1600
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
1601
+ plt.jmp(() => {
1602
+ var _a2;
1603
+ const propName = attrNameToPropName.get(attrName);
1604
+ const hostRef = getHostRef(this);
1605
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1606
+ newValue = this[propName];
1607
+ delete this[propName];
1608
+ }
1609
+ if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1610
+ this[propName] == newValue) {
1611
+ return;
1612
+ } else if (propName == null) {
1613
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1614
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
1615
+ const instance = hostRef.$lazyInstance$ ;
1616
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1617
+ entry == null ? void 0 : entry.forEach((watcher) => {
1618
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1619
+ if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
1620
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
1621
+ }
1622
+ });
1623
+ }
1624
+ return;
1625
+ }
1626
+ const propFlags = members.find(([m]) => m === propName);
1627
+ if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
1628
+ newValue = newValue === null || newValue === "false" ? false : true;
1629
+ }
1630
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1631
+ if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1632
+ this[propName] = newValue;
1633
+ }
1634
+ });
1635
+ };
1636
+ Cstr.observedAttributes = Array.from(
1637
+ /* @__PURE__ */ new Set([
1638
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1639
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1640
+ const attrName = m[1] || propName;
1641
+ attrNameToPropName.set(attrName, propName);
1642
+ return attrName;
1643
+ })
1644
+ ])
1645
+ );
1646
+ }
1647
+ }
1648
+ return Cstr;
1649
+ };
1650
+
1651
+ // src/runtime/initialize-component.ts
1652
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1653
+ let Cstr;
1654
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1655
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1656
+ const bundleId = cmpMeta.$lazyBundleId$;
1657
+ if (bundleId) {
1658
+ const CstrImport = loadModule(cmpMeta, hostRef);
1659
+ if (CstrImport && "then" in CstrImport) {
1660
+ const endLoad = uniqueTime();
1661
+ Cstr = await CstrImport;
1662
+ endLoad();
1663
+ } else {
1664
+ Cstr = CstrImport;
1665
+ }
1666
+ if (!Cstr) {
1667
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1668
+ }
1669
+ if (!Cstr.isProxied) {
1670
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1671
+ Cstr.isProxied = true;
1672
+ }
1673
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
1674
+ {
1675
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1676
+ }
1677
+ try {
1678
+ new Cstr(hostRef);
1679
+ } catch (e) {
1680
+ consoleError(e, elm);
1681
+ }
1682
+ {
1683
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1684
+ }
1685
+ endNewInstance();
1686
+ {
1687
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1688
+ }
1689
+ } else {
1690
+ Cstr = elm.constructor;
1691
+ const cmpTag = elm.localName;
1692
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1693
+ }
1694
+ if (Cstr && Cstr.style) {
1695
+ let style;
1696
+ if (typeof Cstr.style === "string") {
1697
+ style = Cstr.style;
1698
+ }
1699
+ const scopeId2 = getScopeId(cmpMeta);
1700
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
1701
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1702
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1703
+ endRegisterStyles();
1704
+ }
1705
+ }
1706
+ }
1707
+ const ancestorComponent = hostRef.$ancestorComponent$;
1708
+ const schedule = () => scheduleUpdate(hostRef, true);
1709
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
1710
+ ancestorComponent["s-rc"].push(schedule);
1711
+ } else {
1712
+ schedule();
1713
+ }
1714
+ };
1715
+ var fireConnectedCallback = (instance, elm) => {
1716
+ {
1717
+ safeCall(instance, "connectedCallback", void 0, elm);
1718
+ }
1719
+ };
1720
+
1721
+ // src/runtime/connected-callback.ts
1722
+ var connectedCallback = (elm) => {
1723
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1724
+ const hostRef = getHostRef(elm);
1725
+ if (!hostRef) {
1726
+ return;
1727
+ }
1728
+ const cmpMeta = hostRef.$cmpMeta$;
1729
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1730
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1731
+ hostRef.$flags$ |= 1 /* hasConnected */;
1732
+ let hostId;
1733
+ {
1734
+ hostId = elm.getAttribute(HYDRATE_ID);
1735
+ if (hostId) {
1736
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1737
+ const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
1738
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
1739
+ }
1740
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
1741
+ }
1742
+ }
1743
+ {
1744
+ let ancestorComponent = elm;
1745
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1746
+ if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
1747
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1748
+ break;
1749
+ }
1750
+ }
1751
+ }
1752
+ if (cmpMeta.$members$) {
1753
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1754
+ if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
1755
+ const value = elm[memberName];
1756
+ delete elm[memberName];
1757
+ elm[memberName] = value;
1758
+ }
1759
+ });
1760
+ }
1761
+ {
1762
+ initializeComponent(elm, hostRef, cmpMeta);
1763
+ }
1764
+ } else {
1765
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1766
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1767
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1768
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1769
+ }
1770
+ }
1771
+ endConnected();
1772
+ }
1773
+ };
1774
+ var disconnectInstance = (instance, elm) => {
1775
+ {
1776
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1777
+ }
1778
+ };
1779
+ var disconnectedCallback = async (elm) => {
1780
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1781
+ const hostRef = getHostRef(elm);
1782
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1783
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1784
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1785
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1786
+ }
1787
+ }
1788
+ if (rootAppliedStyles.has(elm)) {
1789
+ rootAppliedStyles.delete(elm);
1790
+ }
1791
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1792
+ rootAppliedStyles.delete(elm.shadowRoot);
1793
+ }
1794
+ };
1795
+
1796
+ // src/runtime/bootstrap-lazy.ts
1797
+ var bootstrapLazy = (lazyBundles, options = {}) => {
1798
+ var _a;
1799
+ if (!win.document) {
1800
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1801
+ return;
1802
+ }
1803
+ const endBootstrap = createTime();
1804
+ const cmpTags = [];
1805
+ const exclude = options.exclude || [];
1806
+ const customElements2 = win.customElements;
1807
+ const head = win.document.head;
1808
+ const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1809
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1810
+ const deferredConnectedCallbacks = [];
1811
+ let appLoadFallback;
1812
+ let isBootstrapping = true;
1813
+ Object.assign(plt, options);
1814
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1815
+ {
1816
+ plt.$flags$ |= 2 /* appLoaded */;
1817
+ }
1818
+ {
1819
+ hydrateScopedToShadow();
1820
+ }
1821
+ lazyBundles.map((lazyBundle) => {
1822
+ lazyBundle[1].map((compactMeta) => {
1823
+ const cmpMeta = {
1824
+ $flags$: compactMeta[0],
1825
+ $tagName$: compactMeta[1],
1826
+ $members$: compactMeta[2],
1827
+ $listeners$: compactMeta[3]
1828
+ };
1829
+ {
1830
+ cmpMeta.$members$ = compactMeta[2];
1831
+ }
1832
+ const tagName = transformTag(cmpMeta.$tagName$);
1833
+ const HostElement = class extends HTMLElement {
1834
+ ["s-p"];
1835
+ ["s-rc"];
1836
+ hasRegisteredEventListeners = false;
1837
+ // StencilLazyHost
1838
+ constructor(self) {
1839
+ super(self);
1840
+ self = this;
1841
+ registerHost(self, cmpMeta);
1842
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1843
+ {
1844
+ if (!self.shadowRoot) {
1845
+ createShadowRoot.call(self, cmpMeta);
1846
+ } else {
1847
+ if (self.shadowRoot.mode !== "open") {
1848
+ throw new Error(
1849
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
1850
+ );
1851
+ }
1852
+ }
1853
+ }
1854
+ }
1855
+ }
1856
+ connectedCallback() {
1857
+ const hostRef = getHostRef(this);
1858
+ if (!hostRef) {
1859
+ return;
1860
+ }
1861
+ if (!this.hasRegisteredEventListeners) {
1862
+ this.hasRegisteredEventListeners = true;
1863
+ }
1864
+ if (appLoadFallback) {
1865
+ clearTimeout(appLoadFallback);
1866
+ appLoadFallback = null;
1867
+ }
1868
+ if (isBootstrapping) {
1869
+ deferredConnectedCallbacks.push(this);
1870
+ } else {
1871
+ plt.jmp(() => connectedCallback(this));
1872
+ }
1873
+ }
1874
+ disconnectedCallback() {
1875
+ plt.jmp(() => disconnectedCallback(this));
1876
+ plt.raf(() => {
1877
+ var _a3;
1878
+ const hostRef = getHostRef(this);
1879
+ if (!hostRef) {
1880
+ return;
1881
+ }
1882
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1883
+ if (i2 > -1) {
1884
+ deferredConnectedCallbacks.splice(i2, 1);
1885
+ }
1886
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1887
+ delete hostRef.$vnode$.$elm$;
1888
+ }
1889
+ });
1890
+ }
1891
+ componentOnReady() {
1892
+ var _a3;
1893
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1894
+ }
1895
+ };
1896
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1897
+ if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
1898
+ cmpTags.push(tagName);
1899
+ customElements2.define(
1900
+ tagName,
1901
+ proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
1902
+ );
1903
+ }
1904
+ });
1905
+ });
1906
+ if (cmpTags.length > 0) {
1907
+ {
1908
+ dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
1909
+ }
1910
+ if (dataStyles.innerHTML.length) {
1911
+ dataStyles.setAttribute("data-styles", "");
1912
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1913
+ if (nonce != null) {
1914
+ dataStyles.setAttribute("nonce", nonce);
1915
+ }
1916
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1917
+ }
1918
+ }
1919
+ isBootstrapping = false;
1920
+ if (deferredConnectedCallbacks.length) {
1921
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1922
+ } else {
1923
+ {
1924
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
1925
+ }
1926
+ }
1927
+ endBootstrap();
1928
+ };
1929
+
1930
+ // src/runtime/nonce.ts
1931
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
1932
+ function transformTag(tag) {
1933
+ return tag;
1934
+ }
1935
+
1936
+ export { bootstrapLazy as b, h, promiseResolve as p, registerInstance as r, setNonce as s };