@devschile/chucao 1.5.3 → 1.6.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 (70) hide show
  1. package/dist/chucao/chucao.esm.js +1 -1
  2. package/dist/chucao/{p-061ffcf3.entry.js → p-175aee94.entry.js} +2 -2
  3. package/dist/chucao/{p-c0c5522f.entry.js → p-85a49fd7.entry.js} +2 -2
  4. package/dist/chucao/p-ImsAHlk9.js +3 -0
  5. package/dist/chucao/p-ImsAHlk9.js.map +1 -0
  6. package/dist/chucao/{p-117c93d3.entry.js → p-af2c57b5.entry.js} +2 -2
  7. package/dist/chucao/{p-fa56821f.entry.js → p-b4520f1c.entry.js} +2 -2
  8. package/dist/chucao/{p-14d8a79c.entry.js → p-d75eeeea.entry.js} +2 -2
  9. package/dist/chucao/{p-b07c23e1.entry.js → p-dde82d7d.entry.js} +2 -2
  10. package/dist/chucao/{p-bb82aaf8.entry.js → p-fcc70c8d.entry.js} +2 -2
  11. package/dist/chucao/{p-c1edf460.entry.js → p-fe0c9320.entry.js} +2 -2
  12. package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
  13. package/dist/cjs/ch-badge_6.cjs.entry.js +1 -1
  14. package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
  15. package/dist/cjs/ch-divider.cjs.entry.js +1 -1
  16. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  17. package/dist/cjs/ch-radio.cjs.entry.js +1 -1
  18. package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
  19. package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
  20. package/dist/cjs/chucao.cjs.js +1 -1
  21. package/dist/cjs/{index-D7ZSLrHc.js → index-CiYvuUBV.js} +679 -9
  22. package/dist/cjs/index-CiYvuUBV.js.map +1 -0
  23. package/dist/cjs/loader.cjs.js +1 -1
  24. package/dist/components/ch-accordion.js +1 -1
  25. package/dist/components/ch-badge.js +1 -1
  26. package/dist/components/ch-button.js +1 -1
  27. package/dist/components/ch-card.js +1 -1
  28. package/dist/components/ch-checkbox.js +1 -1
  29. package/dist/components/ch-divider.js +1 -1
  30. package/dist/components/ch-input.js +1 -1
  31. package/dist/components/ch-link.js +1 -1
  32. package/dist/components/ch-radio.js +1 -1
  33. package/dist/components/ch-select.js +1 -1
  34. package/dist/components/ch-switch.js +1 -1
  35. package/dist/components/ch-tabs.js +1 -1
  36. package/dist/components/ch-textarea.js +1 -1
  37. package/dist/components/index.js +1 -1
  38. package/dist/components/p-x4aZoujY.js +2 -0
  39. package/dist/components/p-x4aZoujY.js.map +1 -0
  40. package/dist/esm/ch-accordion.entry.js +1 -1
  41. package/dist/esm/ch-badge_6.entry.js +1 -1
  42. package/dist/esm/ch-checkbox.entry.js +1 -1
  43. package/dist/esm/ch-divider.entry.js +1 -1
  44. package/dist/esm/ch-link.entry.js +1 -1
  45. package/dist/esm/ch-radio.entry.js +1 -1
  46. package/dist/esm/ch-tabs.entry.js +1 -1
  47. package/dist/esm/ch-textarea.entry.js +1 -1
  48. package/dist/esm/chucao.js +2 -2
  49. package/dist/esm/{index-B0AkgfgP.js → index-ImsAHlk9.js} +679 -9
  50. package/dist/esm/index-ImsAHlk9.js.map +1 -0
  51. package/dist/esm/loader.js +2 -2
  52. package/hydrate/index.d.ts +287 -0
  53. package/hydrate/index.js +24283 -0
  54. package/hydrate/index.mjs +24273 -0
  55. package/hydrate/package.json +12 -0
  56. package/package.json +7 -1
  57. package/dist/chucao/p-B0AkgfgP.js +0 -3
  58. package/dist/chucao/p-B0AkgfgP.js.map +0 -1
  59. package/dist/cjs/index-D7ZSLrHc.js.map +0 -1
  60. package/dist/components/p-W-iJXblk.js +0 -2
  61. package/dist/components/p-W-iJXblk.js.map +0 -1
  62. package/dist/esm/index-B0AkgfgP.js.map +0 -1
  63. /package/dist/chucao/{p-061ffcf3.entry.js.map → p-175aee94.entry.js.map} +0 -0
  64. /package/dist/chucao/{p-c0c5522f.entry.js.map → p-85a49fd7.entry.js.map} +0 -0
  65. /package/dist/chucao/{p-117c93d3.entry.js.map → p-af2c57b5.entry.js.map} +0 -0
  66. /package/dist/chucao/{p-fa56821f.entry.js.map → p-b4520f1c.entry.js.map} +0 -0
  67. /package/dist/chucao/{p-14d8a79c.entry.js.map → p-d75eeeea.entry.js.map} +0 -0
  68. /package/dist/chucao/{p-b07c23e1.entry.js.map → p-dde82d7d.entry.js.map} +0 -0
  69. /package/dist/chucao/{p-bb82aaf8.entry.js.map → p-fcc70c8d.entry.js.map} +0 -0
  70. /package/dist/chucao/{p-c1edf460.entry.js.map → p-fe0c9320.entry.js.map} +0 -0
@@ -8,6 +8,30 @@ const globalStyles = ":root{--color-background-base:#100a1c;--color-background-t
8
8
  Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
 
11
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
12
+ PrimitiveType2["Undefined"] = "undefined";
13
+ PrimitiveType2["Null"] = "null";
14
+ PrimitiveType2["String"] = "string";
15
+ PrimitiveType2["Number"] = "number";
16
+ PrimitiveType2["SpecialNumber"] = "number";
17
+ PrimitiveType2["Boolean"] = "boolean";
18
+ PrimitiveType2["BigInt"] = "bigint";
19
+ return PrimitiveType2;
20
+ })(PrimitiveType || {});
21
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
22
+ NonPrimitiveType2["Array"] = "array";
23
+ NonPrimitiveType2["Date"] = "date";
24
+ NonPrimitiveType2["Map"] = "map";
25
+ NonPrimitiveType2["Object"] = "object";
26
+ NonPrimitiveType2["RegularExpression"] = "regexp";
27
+ NonPrimitiveType2["Set"] = "set";
28
+ NonPrimitiveType2["Channel"] = "channel";
29
+ NonPrimitiveType2["Symbol"] = "symbol";
30
+ return NonPrimitiveType2;
31
+ })(NonPrimitiveType || {});
32
+ var TYPE_CONSTANT = "type";
33
+ var VALUE_CONSTANT = "value";
34
+ var SERIALIZED_PREFIX = "serialized:";
11
35
 
12
36
  // src/utils/get-prop-descriptor.ts
13
37
  function getPropertyDescriptor(obj, memberName, getOnly) {
@@ -122,6 +146,16 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
122
146
 
123
147
  // src/client/client-style.ts
124
148
  var styles = /* @__PURE__ */ new Map();
149
+
150
+ // src/runtime/runtime-constants.ts
151
+ var CONTENT_REF_ID = "r";
152
+ var ORG_LOCATION_ID = "o";
153
+ var SLOT_NODE_ID = "s";
154
+ var TEXT_NODE_ID = "t";
155
+ var COMMENT_NODE_ID = "c";
156
+ var HYDRATE_ID = "s-id";
157
+ var HYDRATED_STYLE_ID = "sty-id";
158
+ var HYDRATE_CHILD_ID = "c-id";
125
159
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
126
160
  var win = typeof window !== "undefined" ? window : {};
127
161
  var plt = {
@@ -209,6 +243,82 @@ function createShadowRoot(cmpMeta) {
209
243
  shadowRoot.prepend(styleElm);
210
244
  }
211
245
  }
246
+ var getSlottedChildNodes = (childNodes) => {
247
+ const result = [];
248
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
249
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
250
+ if (slottedNode && slottedNode.isConnected) {
251
+ result.push(slottedNode);
252
+ }
253
+ }
254
+ return result;
255
+ };
256
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
257
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
258
+ return;
259
+ }
260
+ const slottedNodeLocation = document.createTextNode("");
261
+ slottedNodeLocation["s-nr"] = newChild;
262
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
263
+ const parent = slotNode["s-cr"].parentNode;
264
+ const appendMethod = internalCall(parent, "appendChild");
265
+ if (typeof position !== "undefined") {
266
+ slottedNodeLocation["s-oo"] = position;
267
+ const childNodes = internalCall(parent, "childNodes");
268
+ const slotRelocateNodes = [slottedNodeLocation];
269
+ childNodes.forEach((n) => {
270
+ if (n["s-nr"]) slotRelocateNodes.push(n);
271
+ });
272
+ slotRelocateNodes.sort((a, b) => {
273
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
274
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
275
+ return 0;
276
+ });
277
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
278
+ } else {
279
+ appendMethod.call(parent, slottedNodeLocation);
280
+ }
281
+ newChild["s-ol"] = slottedNodeLocation;
282
+ newChild["s-sh"] = slotNode["s-hn"];
283
+ };
284
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
285
+ function patchSlotNode(node) {
286
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
287
+ const assignedFactory = (elementsOnly) => (function(opts) {
288
+ const toReturn = [];
289
+ const slotName = this["s-sn"];
290
+ if (opts == null ? void 0 : opts.flatten) {
291
+ console.error(`
292
+ Flattening is not supported for Stencil non-shadow slots.
293
+ You can use \`.childNodes\` to nested slot fallback content.
294
+ If you have a particular use case, please open an issue on the Stencil repo.
295
+ `);
296
+ }
297
+ const parent = this["s-cr"].parentElement;
298
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
299
+ slottedNodes.forEach((n) => {
300
+ if (slotName === getSlotName(n)) {
301
+ toReturn.push(n);
302
+ }
303
+ });
304
+ if (elementsOnly) {
305
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
306
+ }
307
+ return toReturn;
308
+ }).bind(node);
309
+ node.assignedElements = assignedFactory(true);
310
+ node.assignedNodes = assignedFactory(false);
311
+ }
312
+ function internalCall(node, method) {
313
+ if ("__" + method in node) {
314
+ const toReturn = node["__" + method];
315
+ if (typeof toReturn !== "function") return toReturn;
316
+ return toReturn.bind(node);
317
+ } else {
318
+ if (typeof node[method] !== "function") return node[method];
319
+ return node[method].bind(node);
320
+ }
321
+ }
212
322
  var createTime = (fnName, tagName = "") => {
213
323
  {
214
324
  return () => {
@@ -262,7 +372,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
262
372
  if (!appliedStyles) {
263
373
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
264
374
  }
265
- if (!appliedStyles.has(scopeId2)) {
375
+ const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
376
+ if (existingStyleElm) {
377
+ existingStyleElm.textContent = style;
378
+ } else if (!appliedStyles.has(scopeId2)) {
266
379
  styleElm = win.document.createElement("style");
267
380
  styleElm.textContent = style;
268
381
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
@@ -331,6 +444,12 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
331
444
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
332
445
  }
333
446
  appliedStyles.add(scopeId2);
447
+ if ("host" in styleContainerNode) {
448
+ const ssrStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
449
+ if (ssrStyleElm) {
450
+ writeTask(() => ssrStyleElm.remove());
451
+ }
452
+ }
334
453
  }
335
454
  }
336
455
  }
@@ -351,6 +470,17 @@ var attachStyles = (hostRef) => {
351
470
  endAttachStyles();
352
471
  };
353
472
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
473
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
474
+ var hydrateScopedToShadow = () => {
475
+ if (!win.document) {
476
+ return;
477
+ }
478
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
479
+ let i2 = 0;
480
+ for (; i2 < styles2.length; i2++) {
481
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
482
+ }
483
+ };
354
484
  var isComplexType = (o) => {
355
485
  o = typeof o;
356
486
  return o === "object" || o === "function";
@@ -426,8 +556,511 @@ var newVNode = (tag, text) => {
426
556
  var Host = {};
427
557
  var isHost = (node) => node && node.$tag$ === Host;
428
558
 
559
+ // src/runtime/client-hydrate.ts
560
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
561
+ var _a, _b, _c, _d;
562
+ const endHydrate = createTime("hydrateClient", tagName);
563
+ const shadowRoot = hostElm.shadowRoot;
564
+ const childRenderNodes = [];
565
+ const slotNodes = [];
566
+ const slottedNodes = [];
567
+ const shadowRootNodes = shadowRoot ? [] : null;
568
+ const vnode = newVNode(tagName, null);
569
+ vnode.$elm$ = hostElm;
570
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
571
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
572
+ }
573
+ hostElm[HYDRATE_ID] = hostId;
574
+ hostElm.removeAttribute(HYDRATE_ID);
575
+ hostRef.$vnode$ = clientHydrate(
576
+ vnode,
577
+ childRenderNodes,
578
+ slotNodes,
579
+ shadowRootNodes,
580
+ hostElm,
581
+ hostElm,
582
+ hostId,
583
+ slottedNodes
584
+ );
585
+ let crIndex = 0;
586
+ const crLength = childRenderNodes.length;
587
+ let childRenderNode;
588
+ for (crIndex; crIndex < crLength; crIndex++) {
589
+ childRenderNode = childRenderNodes[crIndex];
590
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
591
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
592
+ const node = childRenderNode.$elm$;
593
+ if (!shadowRoot) {
594
+ node["s-hn"] = transformTag(tagName).toUpperCase();
595
+ if (childRenderNode.$tag$ === "slot") {
596
+ node["s-cr"] = hostElm["s-cr"];
597
+ }
598
+ } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
599
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
600
+ if (cmpMeta) {
601
+ const scopeId3 = getScopeId(
602
+ cmpMeta.$cmpMeta$);
603
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
604
+ if (styleSheet) {
605
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
606
+ }
607
+ }
608
+ }
609
+ if (childRenderNode.$tag$ === "slot") {
610
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
611
+ if (childRenderNode.$children$) {
612
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
613
+ if (!childRenderNode.$elm$.childNodes.length) {
614
+ childRenderNode.$children$.forEach((c) => {
615
+ childRenderNode.$elm$.appendChild(c.$elm$);
616
+ });
617
+ }
618
+ } else {
619
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
620
+ }
621
+ }
622
+ if (orgLocationNode && orgLocationNode.isConnected) {
623
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
624
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
625
+ }
626
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
627
+ if (!shadowRoot) {
628
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
629
+ }
630
+ }
631
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
632
+ plt.$orgLocNodes$.delete(orgLocationId);
633
+ }
634
+ }
635
+ const hosts = [];
636
+ const snLen = slottedNodes.length;
637
+ let snIndex = 0;
638
+ let slotGroup;
639
+ let snGroupIdx;
640
+ let snGroupLen;
641
+ let slottedItem;
642
+ let currentPos = 0;
643
+ for (snIndex; snIndex < snLen; snIndex++) {
644
+ slotGroup = slottedNodes[snIndex];
645
+ if (!slotGroup || !slotGroup.length) continue;
646
+ snGroupLen = slotGroup.length;
647
+ snGroupIdx = 0;
648
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
649
+ slottedItem = slotGroup[snGroupIdx];
650
+ if (!hosts[slottedItem.hostId]) {
651
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
652
+ }
653
+ if (!hosts[slottedItem.hostId]) continue;
654
+ const hostEle = hosts[slottedItem.hostId];
655
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
656
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
657
+ }
658
+ if (!hostEle.shadowRoot || !shadowRoot) {
659
+ if (!slottedItem.slot["s-cr"]) {
660
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
661
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
662
+ slottedItem.slot["s-cr"] = hostEle;
663
+ } else {
664
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
665
+ }
666
+ }
667
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
668
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
669
+ slottedItem.node.removeAttribute("slot");
670
+ }
671
+ }
672
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
673
+ }
674
+ }
675
+ if (shadowRoot && !shadowRoot.childNodes.length) {
676
+ let rnIdex = 0;
677
+ const rnLen = shadowRootNodes.length;
678
+ if (rnLen) {
679
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
680
+ const node = shadowRootNodes[rnIdex];
681
+ if (node) {
682
+ shadowRoot.appendChild(node);
683
+ }
684
+ }
685
+ Array.from(hostElm.childNodes).forEach((node) => {
686
+ if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
687
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
688
+ node.removeAttribute("hidden");
689
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
690
+ node.parentNode.removeChild(node);
691
+ }
692
+ }
693
+ });
694
+ }
695
+ }
696
+ hostRef.$hostElement$ = hostElm;
697
+ endHydrate();
698
+ };
699
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
700
+ let childNodeType;
701
+ let childIdSplt;
702
+ let childVNode;
703
+ let i2;
704
+ if (node.nodeType === 1 /* ElementNode */) {
705
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
706
+ if (childNodeType) {
707
+ childIdSplt = childNodeType.split(".");
708
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
709
+ childVNode = createSimpleVNode({
710
+ $flags$: 0,
711
+ $hostId$: childIdSplt[0],
712
+ $nodeId$: childIdSplt[1],
713
+ $depth$: childIdSplt[2],
714
+ $index$: childIdSplt[3],
715
+ $tag$: node.tagName.toLowerCase(),
716
+ $elm$: node,
717
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
718
+ // won't try to reconcile them. Classes set on the node will be blown away.
719
+ $attrs$: { class: node.className || "" }
720
+ });
721
+ childRenderNodes.push(childVNode);
722
+ node.removeAttribute(HYDRATE_CHILD_ID);
723
+ if (!parentVNode.$children$) {
724
+ parentVNode.$children$ = [];
725
+ }
726
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
727
+ if (typeof slotName === "string") {
728
+ if (childVNode.$tag$ === "slot-fb") {
729
+ addSlot(
730
+ slotName,
731
+ childIdSplt[2],
732
+ childVNode,
733
+ node,
734
+ parentVNode,
735
+ childRenderNodes,
736
+ slotNodes,
737
+ shadowRootNodes,
738
+ slottedNodes
739
+ );
740
+ }
741
+ childVNode.$elm$["s-sn"] = slotName;
742
+ childVNode.$elm$.removeAttribute("s-sn");
743
+ }
744
+ if (childVNode.$index$ !== void 0) {
745
+ parentVNode.$children$[childVNode.$index$] = childVNode;
746
+ }
747
+ parentVNode = childVNode;
748
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
749
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
750
+ }
751
+ }
752
+ }
753
+ if (node.shadowRoot) {
754
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
755
+ clientHydrate(
756
+ parentVNode,
757
+ childRenderNodes,
758
+ slotNodes,
759
+ shadowRootNodes,
760
+ hostElm,
761
+ node.shadowRoot.childNodes[i2],
762
+ hostId,
763
+ slottedNodes
764
+ );
765
+ }
766
+ }
767
+ const nonShadowNodes = node.__childNodes || node.childNodes;
768
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
769
+ clientHydrate(
770
+ parentVNode,
771
+ childRenderNodes,
772
+ slotNodes,
773
+ shadowRootNodes,
774
+ hostElm,
775
+ nonShadowNodes[i2],
776
+ hostId,
777
+ slottedNodes
778
+ );
779
+ }
780
+ } else if (node.nodeType === 8 /* CommentNode */) {
781
+ childIdSplt = node.nodeValue.split(".");
782
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
783
+ childNodeType = childIdSplt[0];
784
+ childVNode = createSimpleVNode({
785
+ $hostId$: childIdSplt[1],
786
+ $nodeId$: childIdSplt[2],
787
+ $depth$: childIdSplt[3],
788
+ $index$: childIdSplt[4] || "0",
789
+ $elm$: node,
790
+ $attrs$: null,
791
+ $children$: null,
792
+ $key$: null,
793
+ $name$: null,
794
+ $tag$: null,
795
+ $text$: null
796
+ });
797
+ if (childNodeType === TEXT_NODE_ID) {
798
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
799
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
800
+ childVNode.$text$ = childVNode.$elm$.textContent;
801
+ childRenderNodes.push(childVNode);
802
+ node.remove();
803
+ if (hostId === childVNode.$hostId$) {
804
+ if (!parentVNode.$children$) {
805
+ parentVNode.$children$ = [];
806
+ }
807
+ parentVNode.$children$[childVNode.$index$] = childVNode;
808
+ }
809
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
810
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
811
+ }
812
+ }
813
+ } else if (childNodeType === COMMENT_NODE_ID) {
814
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
815
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
816
+ childRenderNodes.push(childVNode);
817
+ node.remove();
818
+ }
819
+ } else if (childVNode.$hostId$ === hostId) {
820
+ if (childNodeType === SLOT_NODE_ID) {
821
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
822
+ addSlot(
823
+ slotName,
824
+ childIdSplt[2],
825
+ childVNode,
826
+ node,
827
+ parentVNode,
828
+ childRenderNodes,
829
+ slotNodes,
830
+ shadowRootNodes,
831
+ slottedNodes
832
+ );
833
+ } else if (childNodeType === CONTENT_REF_ID) {
834
+ if (shadowRootNodes) {
835
+ node.remove();
836
+ }
837
+ }
838
+ }
839
+ }
840
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
841
+ const vnode = newVNode(null, node.textContent);
842
+ vnode.$elm$ = node;
843
+ vnode.$index$ = "0";
844
+ parentVNode.$children$ = [vnode];
845
+ }
846
+ return parentVNode;
847
+ };
848
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
849
+ if (node.nodeType === 1 /* ElementNode */) {
850
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
851
+ if (componentId) {
852
+ orgLocNodes.set(componentId, node);
853
+ }
854
+ let i2 = 0;
855
+ if (node.shadowRoot) {
856
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
857
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
858
+ }
859
+ }
860
+ const nonShadowNodes = node.__childNodes || node.childNodes;
861
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
862
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
863
+ }
864
+ } else if (node.nodeType === 8 /* CommentNode */) {
865
+ const childIdSplt = node.nodeValue.split(".");
866
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
867
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
868
+ node.nodeValue = "";
869
+ node["s-en"] = childIdSplt[3];
870
+ }
871
+ }
872
+ };
873
+ var createSimpleVNode = (vnode) => {
874
+ const defaultVNode = {
875
+ $flags$: 0,
876
+ $hostId$: null,
877
+ $nodeId$: null,
878
+ $depth$: null,
879
+ $index$: "0",
880
+ $elm$: null,
881
+ $attrs$: null,
882
+ $children$: null,
883
+ $key$: null,
884
+ $name$: null,
885
+ $tag$: null,
886
+ $text$: null
887
+ };
888
+ return { ...defaultVNode, ...vnode };
889
+ };
890
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
891
+ node["s-sr"] = true;
892
+ childVNode.$name$ = slotName || null;
893
+ childVNode.$tag$ = "slot";
894
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
895
+ if (shadowRootNodes && win.document) {
896
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
897
+ if (childVNode.$name$) {
898
+ childVNode.$elm$.setAttribute("name", slotName);
899
+ }
900
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
901
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
902
+ } else {
903
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
904
+ }
905
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
906
+ node.remove();
907
+ if (childVNode.$depth$ === "0") {
908
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
909
+ }
910
+ } else {
911
+ const slot = childVNode.$elm$;
912
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
913
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
914
+ patchSlotNode(node);
915
+ if (shouldMove) {
916
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
917
+ }
918
+ }
919
+ childRenderNodes.push(childVNode);
920
+ slotNodes.push(childVNode);
921
+ if (!parentVNode.$children$) {
922
+ parentVNode.$children$ = [];
923
+ }
924
+ parentVNode.$children$[childVNode.$index$] = childVNode;
925
+ }
926
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
927
+ var _a, _b;
928
+ let slottedNode = slotNode.nextSibling;
929
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
930
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
931
+ do {
932
+ 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 */))) {
933
+ slottedNode["s-sn"] = slotName;
934
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
935
+ }
936
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
937
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
938
+ };
939
+ var findCorrespondingNode = (node, type) => {
940
+ let sibling = node;
941
+ do {
942
+ sibling = sibling.nextSibling;
943
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
944
+ return sibling;
945
+ };
946
+
947
+ // src/utils/remote-value.ts
948
+ var RemoteValue = class _RemoteValue {
949
+ /**
950
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
951
+ *
952
+ * @param serialized The serialized LocalValue object
953
+ * @returns The original JavaScript value/object
954
+ */
955
+ static fromLocalValue(serialized) {
956
+ const type = serialized[TYPE_CONSTANT];
957
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
958
+ switch (type) {
959
+ case "string" /* String */:
960
+ return value;
961
+ case "boolean" /* Boolean */:
962
+ return value;
963
+ case "bigint" /* BigInt */:
964
+ return BigInt(value);
965
+ case "undefined" /* Undefined */:
966
+ return void 0;
967
+ case "null" /* Null */:
968
+ return null;
969
+ case "number" /* Number */:
970
+ if (value === "NaN") return NaN;
971
+ if (value === "-0") return -0;
972
+ if (value === "Infinity") return Infinity;
973
+ if (value === "-Infinity") return -Infinity;
974
+ return value;
975
+ case "array" /* Array */:
976
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
977
+ case "date" /* Date */:
978
+ return new Date(value);
979
+ case "map" /* Map */:
980
+ const map = /* @__PURE__ */ new Map();
981
+ for (const [key, val] of value) {
982
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
983
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
984
+ map.set(deserializedKey, deserializedValue);
985
+ }
986
+ return map;
987
+ case "object" /* Object */:
988
+ const obj = {};
989
+ for (const [key, val] of value) {
990
+ obj[key] = _RemoteValue.fromLocalValue(val);
991
+ }
992
+ return obj;
993
+ case "regexp" /* RegularExpression */:
994
+ const { pattern, flags } = value;
995
+ return new RegExp(pattern, flags);
996
+ case "set" /* Set */:
997
+ const set = /* @__PURE__ */ new Set();
998
+ for (const item of value) {
999
+ set.add(_RemoteValue.fromLocalValue(item));
1000
+ }
1001
+ return set;
1002
+ case "symbol" /* Symbol */:
1003
+ return Symbol(value);
1004
+ default:
1005
+ throw new Error(`Unsupported type: ${type}`);
1006
+ }
1007
+ }
1008
+ /**
1009
+ * Utility method to deserialize multiple LocalValues at once
1010
+ *
1011
+ * @param serializedValues Array of serialized LocalValue objects
1012
+ * @returns Array of deserialized JavaScript values
1013
+ */
1014
+ static fromLocalValueArray(serializedValues) {
1015
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1016
+ }
1017
+ /**
1018
+ * Verifies if the given object matches the structure of a serialized LocalValue
1019
+ *
1020
+ * @param obj Object to verify
1021
+ * @returns boolean indicating if the object has LocalValue structure
1022
+ */
1023
+ static isLocalValueObject(obj) {
1024
+ if (typeof obj !== "object" || obj === null) {
1025
+ return false;
1026
+ }
1027
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1028
+ return false;
1029
+ }
1030
+ const type = obj[TYPE_CONSTANT];
1031
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1032
+ if (!hasTypeProperty) {
1033
+ return false;
1034
+ }
1035
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1036
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1037
+ }
1038
+ return true;
1039
+ }
1040
+ };
1041
+
1042
+ // src/utils/serialize.ts
1043
+ function decodeBase64Unicode(base64) {
1044
+ const binary = atob(base64);
1045
+ const bytes = new Uint8Array(binary.length);
1046
+ for (let i2 = 0; i2 < binary.length; i2++) {
1047
+ bytes[i2] = binary.charCodeAt(i2);
1048
+ }
1049
+ return new TextDecoder().decode(bytes);
1050
+ }
1051
+ function deserializeProperty(value) {
1052
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1053
+ return value;
1054
+ }
1055
+ return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(SERIALIZED_PREFIX.length))));
1056
+ }
1057
+
429
1058
  // src/runtime/parse-property-value.ts
430
1059
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1060
+ if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
1061
+ propValue = deserializeProperty(propValue);
1062
+ return propValue;
1063
+ }
431
1064
  if (propValue != null && !isComplexType(propValue)) {
432
1065
  if (propType & 4 /* Boolean */) {
433
1066
  {
@@ -478,7 +1111,15 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
478
1111
  const classList = elm.classList;
479
1112
  const oldClasses = parseClassList(oldValue);
480
1113
  let newClasses = parseClassList(newValue);
481
- {
1114
+ if ((elm["s-si"] || elm["s-sc"]) && initialRender) {
1115
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
1116
+ newClasses.push(scopeId2);
1117
+ oldClasses.forEach((c) => {
1118
+ if (c.startsWith(scopeId2)) newClasses.push(c);
1119
+ });
1120
+ newClasses = [...new Set(newClasses)].filter((c) => c);
1121
+ classList.add(...newClasses);
1122
+ } else {
482
1123
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
483
1124
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
484
1125
  }
@@ -596,7 +1237,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
596
1237
  oldVnodeAttrs[memberName],
597
1238
  void 0,
598
1239
  isSvgMode2,
599
- newVnode.$flags$);
1240
+ newVnode.$flags$,
1241
+ isInitialRender
1242
+ );
600
1243
  }
601
1244
  }
602
1245
  }
@@ -607,7 +1250,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
607
1250
  oldVnodeAttrs[memberName],
608
1251
  newVnodeAttrs[memberName],
609
1252
  isSvgMode2,
610
- newVnode.$flags$);
1253
+ newVnode.$flags$,
1254
+ isInitialRender
1255
+ );
611
1256
  }
612
1257
  };
613
1258
  function sortedAttrNames(attrNames) {
@@ -815,7 +1460,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
815
1460
  relocateToHostRoot(newVNode2.$elm$.parentElement);
816
1461
  }
817
1462
  }
818
- updateElement(oldVNode, newVNode2, isSvgMode);
1463
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
819
1464
  }
820
1465
  if (oldChildren !== null && newChildren !== null) {
821
1466
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -829,7 +1474,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
829
1474
  !isInitialRender && BUILD.updatable && oldChildren !== null
830
1475
  ) {
831
1476
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
832
- } else ;
1477
+ } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
1478
+ newVNode2.$children$ = oldChildren;
1479
+ }
833
1480
  } else if (oldVNode.$text$ !== text) {
834
1481
  elm.data = text;
835
1482
  }
@@ -1029,7 +1676,13 @@ var postUpdateComponent = (hostRef) => {
1029
1676
  }
1030
1677
  };
1031
1678
  var appDidLoad = (who) => {
1679
+ var _a;
1032
1680
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1681
+ {
1682
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
1683
+ plt.$orgLocNodes$.clear();
1684
+ }
1685
+ }
1033
1686
  };
1034
1687
  var safeCall = (instance, method, arg, elm) => {
1035
1688
  if (instance && instance[method]) {
@@ -1307,10 +1960,21 @@ var connectedCallback = (elm) => {
1307
1960
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1308
1961
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1309
1962
  hostRef.$flags$ |= 1 /* hasConnected */;
1963
+ let hostId;
1964
+ {
1965
+ hostId = elm.getAttribute(HYDRATE_ID);
1966
+ if (hostId) {
1967
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1968
+ const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
1969
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
1970
+ }
1971
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
1972
+ }
1973
+ }
1310
1974
  {
1311
1975
  let ancestorComponent = elm;
1312
1976
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1313
- if (ancestorComponent["s-p"]) {
1977
+ if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
1314
1978
  attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1315
1979
  break;
1316
1980
  }
@@ -1379,6 +2043,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1379
2043
  let isBootstrapping = true;
1380
2044
  Object.assign(plt, options);
1381
2045
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
2046
+ {
2047
+ plt.$flags$ |= 2 /* appLoaded */;
2048
+ }
2049
+ {
2050
+ hydrateScopedToShadow();
2051
+ }
1382
2052
  lazyBundles.map((lazyBundle) => {
1383
2053
  lazyBundle[1].map((compactMeta) => {
1384
2054
  const cmpMeta = {
@@ -1492,6 +2162,6 @@ function transformTag(tag) {
1492
2162
  }
1493
2163
 
1494
2164
  export { Host as H, bootstrapLazy as b, createEvent as c, globalScripts as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1495
- //# sourceMappingURL=index-B0AkgfgP.js.map
2165
+ //# sourceMappingURL=index-ImsAHlk9.js.map
1496
2166
 
1497
- //# sourceMappingURL=index-B0AkgfgP.js.map
2167
+ //# sourceMappingURL=index-ImsAHlk9.js.map