@prolibu-suite/cobalt-form 0.1.0

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