@feedlog-ai/webcomponents 0.0.28 → 0.0.29

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/feedlog-badge.cjs.entry.js +1 -1
  2. package/dist/cjs/feedlog-button_3.cjs.entry.js +2 -2
  3. package/dist/cjs/feedlog-card.cjs.entry.js +1 -1
  4. package/dist/cjs/feedlog-issues-client.cjs.entry.js +1 -1
  5. package/dist/cjs/feedlog-issues.cjs.entry.js +1 -1
  6. package/dist/cjs/feedlog-toolkit.cjs.js +1 -1
  7. package/dist/cjs/{index-Bk1-M_w_.js → index-CXKBwRlh.js} +663 -7
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/feedlog-issue/feedlog-issue.css +1 -1
  10. package/dist/components/feedlog-issue.js +1 -1
  11. package/dist/components/feedlog-issues-client.js +1 -1
  12. package/dist/components/feedlog-issues-list.js +1 -1
  13. package/dist/components/feedlog-issues.js +1 -1
  14. package/dist/components/index.js +1 -1
  15. package/dist/components/{p-DrIHp7WA.js → p-BBbiSGNf.js} +1 -1
  16. package/dist/components/{p-B85wbrJg.js → p-BRjVS8bz.js} +1 -1
  17. package/dist/components/{p-w376pIno.js → p-CuFKEckF.js} +1 -1
  18. package/dist/esm/feedlog-badge.entry.js +1 -1
  19. package/dist/esm/feedlog-button_3.entry.js +2 -2
  20. package/dist/esm/feedlog-card.entry.js +1 -1
  21. package/dist/esm/feedlog-issues-client.entry.js +1 -1
  22. package/dist/esm/feedlog-issues.entry.js +1 -1
  23. package/dist/esm/feedlog-toolkit.js +2 -2
  24. package/dist/esm/{index-CHawAwGP.js → index-CgNWSmzU.js} +663 -7
  25. package/dist/esm/loader.js +2 -2
  26. package/dist/feedlog-toolkit/feedlog-toolkit.esm.js +1 -1
  27. package/dist/feedlog-toolkit/{p-bc48ec0d.entry.js → p-32663f65.entry.js} +1 -1
  28. package/dist/feedlog-toolkit/{p-def7865f.entry.js → p-891c349f.entry.js} +2 -2
  29. package/dist/feedlog-toolkit/p-CgNWSmzU.js +2 -0
  30. package/dist/feedlog-toolkit/{p-c974a35e.entry.js → p-c3e9b94b.entry.js} +1 -1
  31. package/dist/feedlog-toolkit/{p-bf8244fc.entry.js → p-da0268a8.entry.js} +1 -1
  32. package/dist/feedlog-toolkit/{p-08a0ec85.entry.js → p-f22117ae.entry.js} +1 -1
  33. package/hydrate/index.d.ts +287 -0
  34. package/hydrate/index.js +25334 -0
  35. package/hydrate/index.mjs +25324 -0
  36. package/hydrate/package.json +12 -0
  37. package/package.json +10 -3
  38. package/dist/feedlog-toolkit/p-CHawAwGP.js +0 -2
@@ -257,6 +257,30 @@ var require_brace_expansion = __commonJS({
257
257
  // src/utils/constants.ts
258
258
  var SVG_NS = "http://www.w3.org/2000/svg";
259
259
  var HTML_NS = "http://www.w3.org/1999/xhtml";
260
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
261
+ PrimitiveType2["Undefined"] = "undefined";
262
+ PrimitiveType2["Null"] = "null";
263
+ PrimitiveType2["String"] = "string";
264
+ PrimitiveType2["Number"] = "number";
265
+ PrimitiveType2["SpecialNumber"] = "number";
266
+ PrimitiveType2["Boolean"] = "boolean";
267
+ PrimitiveType2["BigInt"] = "bigint";
268
+ return PrimitiveType2;
269
+ })(PrimitiveType || {});
270
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
271
+ NonPrimitiveType2["Array"] = "array";
272
+ NonPrimitiveType2["Date"] = "date";
273
+ NonPrimitiveType2["Map"] = "map";
274
+ NonPrimitiveType2["Object"] = "object";
275
+ NonPrimitiveType2["RegularExpression"] = "regexp";
276
+ NonPrimitiveType2["Set"] = "set";
277
+ NonPrimitiveType2["Channel"] = "channel";
278
+ NonPrimitiveType2["Symbol"] = "symbol";
279
+ return NonPrimitiveType2;
280
+ })(NonPrimitiveType || {});
281
+ var TYPE_CONSTANT = "type";
282
+ var VALUE_CONSTANT = "value";
283
+ var SERIALIZED_PREFIX = "serialized:";
260
284
  var reWireGetterSetter = (instance, hostRef) => {
261
285
  var _a;
262
286
  const cmpMeta = hostRef.$cmpMeta$;
@@ -362,6 +386,16 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
362
386
 
363
387
  // src/client/client-style.ts
364
388
  var styles = /* @__PURE__ */ new Map();
389
+
390
+ // src/runtime/runtime-constants.ts
391
+ var CONTENT_REF_ID = "r";
392
+ var ORG_LOCATION_ID = "o";
393
+ var SLOT_NODE_ID = "s";
394
+ var TEXT_NODE_ID = "t";
395
+ var COMMENT_NODE_ID = "c";
396
+ var HYDRATE_ID = "s-id";
397
+ var HYDRATED_STYLE_ID = "sty-id";
398
+ var HYDRATE_CHILD_ID = "c-id";
365
399
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
366
400
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
367
401
  var win = typeof window !== "undefined" ? window : {};
@@ -1791,6 +1825,101 @@ var escapeRegExpSpecialCharacters = (text) => {
1791
1825
  return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1792
1826
  };
1793
1827
 
1828
+ // src/utils/remote-value.ts
1829
+ var RemoteValue = class _RemoteValue {
1830
+ /**
1831
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
1832
+ *
1833
+ * @param serialized The serialized LocalValue object
1834
+ * @returns The original JavaScript value/object
1835
+ */
1836
+ static fromLocalValue(serialized) {
1837
+ const type = serialized[TYPE_CONSTANT];
1838
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
1839
+ switch (type) {
1840
+ case "string" /* String */:
1841
+ return value;
1842
+ case "boolean" /* Boolean */:
1843
+ return value;
1844
+ case "bigint" /* BigInt */:
1845
+ return BigInt(value);
1846
+ case "undefined" /* Undefined */:
1847
+ return void 0;
1848
+ case "null" /* Null */:
1849
+ return null;
1850
+ case "number" /* Number */:
1851
+ if (value === "NaN") return NaN;
1852
+ if (value === "-0") return -0;
1853
+ if (value === "Infinity") return Infinity;
1854
+ if (value === "-Infinity") return -Infinity;
1855
+ return value;
1856
+ case "array" /* Array */:
1857
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
1858
+ case "date" /* Date */:
1859
+ return new Date(value);
1860
+ case "map" /* Map */:
1861
+ const map2 = /* @__PURE__ */ new Map();
1862
+ for (const [key, val] of value) {
1863
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
1864
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
1865
+ map2.set(deserializedKey, deserializedValue);
1866
+ }
1867
+ return map2;
1868
+ case "object" /* Object */:
1869
+ const obj = {};
1870
+ for (const [key, val] of value) {
1871
+ obj[key] = _RemoteValue.fromLocalValue(val);
1872
+ }
1873
+ return obj;
1874
+ case "regexp" /* RegularExpression */:
1875
+ const { pattern, flags } = value;
1876
+ return new RegExp(pattern, flags);
1877
+ case "set" /* Set */:
1878
+ const set = /* @__PURE__ */ new Set();
1879
+ for (const item of value) {
1880
+ set.add(_RemoteValue.fromLocalValue(item));
1881
+ }
1882
+ return set;
1883
+ case "symbol" /* Symbol */:
1884
+ return Symbol(value);
1885
+ default:
1886
+ throw new Error(`Unsupported type: ${type}`);
1887
+ }
1888
+ }
1889
+ /**
1890
+ * Utility method to deserialize multiple LocalValues at once
1891
+ *
1892
+ * @param serializedValues Array of serialized LocalValue objects
1893
+ * @returns Array of deserialized JavaScript values
1894
+ */
1895
+ static fromLocalValueArray(serializedValues) {
1896
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1897
+ }
1898
+ /**
1899
+ * Verifies if the given object matches the structure of a serialized LocalValue
1900
+ *
1901
+ * @param obj Object to verify
1902
+ * @returns boolean indicating if the object has LocalValue structure
1903
+ */
1904
+ static isLocalValueObject(obj) {
1905
+ if (typeof obj !== "object" || obj === null) {
1906
+ return false;
1907
+ }
1908
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1909
+ return false;
1910
+ }
1911
+ const type = obj[TYPE_CONSTANT];
1912
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1913
+ if (!hasTypeProperty) {
1914
+ return false;
1915
+ }
1916
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1917
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1918
+ }
1919
+ return true;
1920
+ }
1921
+ };
1922
+
1794
1923
  // src/utils/result.ts
1795
1924
  var result_exports = {};
1796
1925
  __export(result_exports, {
@@ -1840,6 +1969,14 @@ var unwrapErr = (result) => {
1840
1969
  }
1841
1970
  };
1842
1971
 
1972
+ // src/utils/serialize.ts
1973
+ function deserializeProperty(value) {
1974
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1975
+ return value;
1976
+ }
1977
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1978
+ }
1979
+
1843
1980
  // src/utils/style.ts
1844
1981
  function createStyleSheetIfNeededAndSupported(styles2) {
1845
1982
  if (!supportsConstructableStylesheets) return void 0;
@@ -1867,6 +2004,82 @@ function createShadowRoot(cmpMeta) {
1867
2004
  shadowRoot.prepend(styleElm);
1868
2005
  }
1869
2006
  }
2007
+ var getSlottedChildNodes = (childNodes) => {
2008
+ const result = [];
2009
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
2010
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
2011
+ if (slottedNode && slottedNode.isConnected) {
2012
+ result.push(slottedNode);
2013
+ }
2014
+ }
2015
+ return result;
2016
+ };
2017
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
2018
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
2019
+ return;
2020
+ }
2021
+ const slottedNodeLocation = document.createTextNode("");
2022
+ slottedNodeLocation["s-nr"] = newChild;
2023
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
2024
+ const parent = slotNode["s-cr"].parentNode;
2025
+ const appendMethod = internalCall(parent, "appendChild");
2026
+ if (typeof position !== "undefined") {
2027
+ slottedNodeLocation["s-oo"] = position;
2028
+ const childNodes = internalCall(parent, "childNodes");
2029
+ const slotRelocateNodes = [slottedNodeLocation];
2030
+ childNodes.forEach((n) => {
2031
+ if (n["s-nr"]) slotRelocateNodes.push(n);
2032
+ });
2033
+ slotRelocateNodes.sort((a, b) => {
2034
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
2035
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
2036
+ return 0;
2037
+ });
2038
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
2039
+ } else {
2040
+ appendMethod.call(parent, slottedNodeLocation);
2041
+ }
2042
+ newChild["s-ol"] = slottedNodeLocation;
2043
+ newChild["s-sh"] = slotNode["s-hn"];
2044
+ };
2045
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
2046
+ function patchSlotNode(node) {
2047
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
2048
+ const assignedFactory = (elementsOnly) => (function(opts) {
2049
+ const toReturn = [];
2050
+ const slotName = this["s-sn"];
2051
+ if (opts == null ? void 0 : opts.flatten) {
2052
+ console.error(`
2053
+ Flattening is not supported for Stencil non-shadow slots.
2054
+ You can use \`.childNodes\` to nested slot fallback content.
2055
+ If you have a particular use case, please open an issue on the Stencil repo.
2056
+ `);
2057
+ }
2058
+ const parent = this["s-cr"].parentElement;
2059
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
2060
+ slottedNodes.forEach((n) => {
2061
+ if (slotName === getSlotName(n)) {
2062
+ toReturn.push(n);
2063
+ }
2064
+ });
2065
+ if (elementsOnly) {
2066
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
2067
+ }
2068
+ return toReturn;
2069
+ }).bind(node);
2070
+ node.assignedElements = assignedFactory(true);
2071
+ node.assignedNodes = assignedFactory(false);
2072
+ }
2073
+ function internalCall(node, method) {
2074
+ if ("__" + method in node) {
2075
+ const toReturn = node["__" + method];
2076
+ if (typeof toReturn !== "function") return toReturn;
2077
+ return toReturn.bind(node);
2078
+ } else {
2079
+ if (typeof node[method] !== "function") return node[method];
2080
+ return node[method].bind(node);
2081
+ }
2082
+ }
1870
2083
  var createTime = (fnName, tagName = "") => {
1871
2084
  {
1872
2085
  return () => {
@@ -1912,7 +2125,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1912
2125
  if (!appliedStyles) {
1913
2126
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1914
2127
  }
1915
- if (!appliedStyles.has(scopeId2)) {
2128
+ const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
2129
+ if (existingStyleElm) {
2130
+ existingStyleElm.innerHTML = style;
2131
+ } else if (!appliedStyles.has(scopeId2)) {
1916
2132
  styleElm = win.document.createElement("style");
1917
2133
  styleElm.innerHTML = style;
1918
2134
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
@@ -2001,6 +2217,17 @@ var attachStyles = (hostRef) => {
2001
2217
  endAttachStyles();
2002
2218
  };
2003
2219
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
2220
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2221
+ var hydrateScopedToShadow = () => {
2222
+ if (!win.document) {
2223
+ return;
2224
+ }
2225
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2226
+ let i2 = 0;
2227
+ for (; i2 < styles2.length; i2++) {
2228
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2229
+ }
2230
+ };
2004
2231
  var h = (nodeName, vnodeData, ...children) => {
2005
2232
  if (typeof nodeName === "string") {
2006
2233
  nodeName = transformTag(nodeName);
@@ -2068,6 +2295,394 @@ var newVNode = (tag, text) => {
2068
2295
  };
2069
2296
  var Host = {};
2070
2297
  var isHost = (node) => node && node.$tag$ === Host;
2298
+
2299
+ // src/runtime/client-hydrate.ts
2300
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2301
+ var _a, _b, _c, _d;
2302
+ const endHydrate = createTime("hydrateClient", tagName);
2303
+ const shadowRoot = hostElm.shadowRoot;
2304
+ const childRenderNodes = [];
2305
+ const slotNodes = [];
2306
+ const slottedNodes = [];
2307
+ const shadowRootNodes = shadowRoot ? [] : null;
2308
+ const vnode = newVNode(tagName, null);
2309
+ vnode.$elm$ = hostElm;
2310
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
2311
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
2312
+ }
2313
+ hostElm[HYDRATE_ID] = hostId;
2314
+ hostElm.removeAttribute(HYDRATE_ID);
2315
+ hostRef.$vnode$ = clientHydrate(
2316
+ vnode,
2317
+ childRenderNodes,
2318
+ slotNodes,
2319
+ shadowRootNodes,
2320
+ hostElm,
2321
+ hostElm,
2322
+ hostId,
2323
+ slottedNodes
2324
+ );
2325
+ let crIndex = 0;
2326
+ const crLength = childRenderNodes.length;
2327
+ let childRenderNode;
2328
+ for (crIndex; crIndex < crLength; crIndex++) {
2329
+ childRenderNode = childRenderNodes[crIndex];
2330
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
2331
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
2332
+ const node = childRenderNode.$elm$;
2333
+ if (!shadowRoot) {
2334
+ node["s-hn"] = transformTag(tagName).toUpperCase();
2335
+ if (childRenderNode.$tag$ === "slot") {
2336
+ node["s-cr"] = hostElm["s-cr"];
2337
+ }
2338
+ } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
2339
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
2340
+ if (cmpMeta) {
2341
+ const scopeId3 = getScopeId(
2342
+ cmpMeta.$cmpMeta$);
2343
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
2344
+ if (styleSheet) {
2345
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
2346
+ }
2347
+ }
2348
+ }
2349
+ if (childRenderNode.$tag$ === "slot") {
2350
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
2351
+ if (childRenderNode.$children$) {
2352
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
2353
+ if (!childRenderNode.$elm$.childNodes.length) {
2354
+ childRenderNode.$children$.forEach((c) => {
2355
+ childRenderNode.$elm$.appendChild(c.$elm$);
2356
+ });
2357
+ }
2358
+ } else {
2359
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
2360
+ }
2361
+ }
2362
+ if (orgLocationNode && orgLocationNode.isConnected) {
2363
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
2364
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
2365
+ }
2366
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
2367
+ if (!shadowRoot) {
2368
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
2369
+ }
2370
+ }
2371
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
2372
+ plt.$orgLocNodes$.delete(orgLocationId);
2373
+ }
2374
+ }
2375
+ const hosts = [];
2376
+ const snLen = slottedNodes.length;
2377
+ let snIndex = 0;
2378
+ let slotGroup;
2379
+ let snGroupIdx;
2380
+ let snGroupLen;
2381
+ let slottedItem;
2382
+ let currentPos = 0;
2383
+ for (snIndex; snIndex < snLen; snIndex++) {
2384
+ slotGroup = slottedNodes[snIndex];
2385
+ if (!slotGroup || !slotGroup.length) continue;
2386
+ snGroupLen = slotGroup.length;
2387
+ snGroupIdx = 0;
2388
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
2389
+ slottedItem = slotGroup[snGroupIdx];
2390
+ if (!hosts[slottedItem.hostId]) {
2391
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
2392
+ }
2393
+ if (!hosts[slottedItem.hostId]) continue;
2394
+ const hostEle = hosts[slottedItem.hostId];
2395
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
2396
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
2397
+ }
2398
+ if (!hostEle.shadowRoot || !shadowRoot) {
2399
+ if (!slottedItem.slot["s-cr"]) {
2400
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
2401
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
2402
+ slottedItem.slot["s-cr"] = hostEle;
2403
+ } else {
2404
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
2405
+ }
2406
+ }
2407
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
2408
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
2409
+ slottedItem.node.removeAttribute("slot");
2410
+ }
2411
+ }
2412
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
2413
+ }
2414
+ }
2415
+ if (shadowRoot) {
2416
+ let rnIdex = 0;
2417
+ const rnLen = shadowRootNodes.length;
2418
+ if (rnLen) {
2419
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
2420
+ const node = shadowRootNodes[rnIdex];
2421
+ if (node) {
2422
+ shadowRoot.appendChild(node);
2423
+ }
2424
+ }
2425
+ Array.from(hostElm.childNodes).forEach((node) => {
2426
+ if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
2427
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
2428
+ node.removeAttribute("hidden");
2429
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
2430
+ node.parentNode.removeChild(node);
2431
+ }
2432
+ }
2433
+ });
2434
+ }
2435
+ }
2436
+ hostRef.$hostElement$ = hostElm;
2437
+ endHydrate();
2438
+ };
2439
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
2440
+ let childNodeType;
2441
+ let childIdSplt;
2442
+ let childVNode;
2443
+ let i2;
2444
+ if (node.nodeType === 1 /* ElementNode */) {
2445
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
2446
+ if (childNodeType) {
2447
+ childIdSplt = childNodeType.split(".");
2448
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
2449
+ childVNode = createSimpleVNode({
2450
+ $flags$: 0,
2451
+ $hostId$: childIdSplt[0],
2452
+ $nodeId$: childIdSplt[1],
2453
+ $depth$: childIdSplt[2],
2454
+ $index$: childIdSplt[3],
2455
+ $tag$: node.tagName.toLowerCase(),
2456
+ $elm$: node,
2457
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
2458
+ // won't try to reconcile them. Classes set on the node will be blown away.
2459
+ $attrs$: { class: node.className || "" }
2460
+ });
2461
+ childRenderNodes.push(childVNode);
2462
+ node.removeAttribute(HYDRATE_CHILD_ID);
2463
+ if (!parentVNode.$children$) {
2464
+ parentVNode.$children$ = [];
2465
+ }
2466
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
2467
+ if (typeof slotName === "string") {
2468
+ if (childVNode.$tag$ === "slot-fb") {
2469
+ addSlot(
2470
+ slotName,
2471
+ childIdSplt[2],
2472
+ childVNode,
2473
+ node,
2474
+ parentVNode,
2475
+ childRenderNodes,
2476
+ slotNodes,
2477
+ shadowRootNodes,
2478
+ slottedNodes
2479
+ );
2480
+ }
2481
+ childVNode.$elm$["s-sn"] = slotName;
2482
+ childVNode.$elm$.removeAttribute("s-sn");
2483
+ }
2484
+ if (childVNode.$index$ !== void 0) {
2485
+ parentVNode.$children$[childVNode.$index$] = childVNode;
2486
+ }
2487
+ parentVNode = childVNode;
2488
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
2489
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2490
+ }
2491
+ }
2492
+ }
2493
+ if (node.shadowRoot) {
2494
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
2495
+ clientHydrate(
2496
+ parentVNode,
2497
+ childRenderNodes,
2498
+ slotNodes,
2499
+ shadowRootNodes,
2500
+ hostElm,
2501
+ node.shadowRoot.childNodes[i2],
2502
+ hostId,
2503
+ slottedNodes
2504
+ );
2505
+ }
2506
+ }
2507
+ const nonShadowNodes = node.__childNodes || node.childNodes;
2508
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
2509
+ clientHydrate(
2510
+ parentVNode,
2511
+ childRenderNodes,
2512
+ slotNodes,
2513
+ shadowRootNodes,
2514
+ hostElm,
2515
+ nonShadowNodes[i2],
2516
+ hostId,
2517
+ slottedNodes
2518
+ );
2519
+ }
2520
+ } else if (node.nodeType === 8 /* CommentNode */) {
2521
+ childIdSplt = node.nodeValue.split(".");
2522
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
2523
+ childNodeType = childIdSplt[0];
2524
+ childVNode = createSimpleVNode({
2525
+ $hostId$: childIdSplt[1],
2526
+ $nodeId$: childIdSplt[2],
2527
+ $depth$: childIdSplt[3],
2528
+ $index$: childIdSplt[4] || "0",
2529
+ $elm$: node,
2530
+ $attrs$: null,
2531
+ $children$: null,
2532
+ $key$: null,
2533
+ $name$: null,
2534
+ $tag$: null,
2535
+ $text$: null
2536
+ });
2537
+ if (childNodeType === TEXT_NODE_ID) {
2538
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
2539
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
2540
+ childVNode.$text$ = childVNode.$elm$.textContent;
2541
+ childRenderNodes.push(childVNode);
2542
+ node.remove();
2543
+ if (hostId === childVNode.$hostId$) {
2544
+ if (!parentVNode.$children$) {
2545
+ parentVNode.$children$ = [];
2546
+ }
2547
+ parentVNode.$children$[childVNode.$index$] = childVNode;
2548
+ }
2549
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
2550
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2551
+ }
2552
+ }
2553
+ } else if (childNodeType === COMMENT_NODE_ID) {
2554
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
2555
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
2556
+ childRenderNodes.push(childVNode);
2557
+ node.remove();
2558
+ }
2559
+ } else if (childVNode.$hostId$ === hostId) {
2560
+ if (childNodeType === SLOT_NODE_ID) {
2561
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
2562
+ addSlot(
2563
+ slotName,
2564
+ childIdSplt[2],
2565
+ childVNode,
2566
+ node,
2567
+ parentVNode,
2568
+ childRenderNodes,
2569
+ slotNodes,
2570
+ shadowRootNodes,
2571
+ slottedNodes
2572
+ );
2573
+ } else if (childNodeType === CONTENT_REF_ID) {
2574
+ if (shadowRootNodes) {
2575
+ node.remove();
2576
+ }
2577
+ }
2578
+ }
2579
+ }
2580
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
2581
+ const vnode = newVNode(null, node.textContent);
2582
+ vnode.$elm$ = node;
2583
+ vnode.$index$ = "0";
2584
+ parentVNode.$children$ = [vnode];
2585
+ }
2586
+ return parentVNode;
2587
+ };
2588
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
2589
+ if (node.nodeType === 1 /* ElementNode */) {
2590
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
2591
+ if (componentId) {
2592
+ orgLocNodes.set(componentId, node);
2593
+ }
2594
+ let i2 = 0;
2595
+ if (node.shadowRoot) {
2596
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
2597
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
2598
+ }
2599
+ }
2600
+ const nonShadowNodes = node.__childNodes || node.childNodes;
2601
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
2602
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
2603
+ }
2604
+ } else if (node.nodeType === 8 /* CommentNode */) {
2605
+ const childIdSplt = node.nodeValue.split(".");
2606
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
2607
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
2608
+ node.nodeValue = "";
2609
+ node["s-en"] = childIdSplt[3];
2610
+ }
2611
+ }
2612
+ };
2613
+ var createSimpleVNode = (vnode) => {
2614
+ const defaultVNode = {
2615
+ $flags$: 0,
2616
+ $hostId$: null,
2617
+ $nodeId$: null,
2618
+ $depth$: null,
2619
+ $index$: "0",
2620
+ $elm$: null,
2621
+ $attrs$: null,
2622
+ $children$: null,
2623
+ $key$: null,
2624
+ $name$: null,
2625
+ $tag$: null,
2626
+ $text$: null
2627
+ };
2628
+ return { ...defaultVNode, ...vnode };
2629
+ };
2630
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
2631
+ node["s-sr"] = true;
2632
+ childVNode.$name$ = slotName || null;
2633
+ childVNode.$tag$ = "slot";
2634
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
2635
+ if (shadowRootNodes && win.document) {
2636
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
2637
+ if (childVNode.$name$) {
2638
+ childVNode.$elm$.setAttribute("name", slotName);
2639
+ }
2640
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
2641
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
2642
+ } else {
2643
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
2644
+ }
2645
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
2646
+ node.remove();
2647
+ if (childVNode.$depth$ === "0") {
2648
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2649
+ }
2650
+ } else {
2651
+ const slot = childVNode.$elm$;
2652
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
2653
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
2654
+ patchSlotNode(node);
2655
+ if (shouldMove) {
2656
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
2657
+ }
2658
+ }
2659
+ childRenderNodes.push(childVNode);
2660
+ slotNodes.push(childVNode);
2661
+ if (!parentVNode.$children$) {
2662
+ parentVNode.$children$ = [];
2663
+ }
2664
+ parentVNode.$children$[childVNode.$index$] = childVNode;
2665
+ }
2666
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
2667
+ var _a, _b;
2668
+ let slottedNode = slotNode.nextSibling;
2669
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
2670
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
2671
+ do {
2672
+ 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 */))) {
2673
+ slottedNode["s-sn"] = slotName;
2674
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
2675
+ }
2676
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
2677
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
2678
+ };
2679
+ var findCorrespondingNode = (node, type) => {
2680
+ let sibling = node;
2681
+ do {
2682
+ sibling = sibling.nextSibling;
2683
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
2684
+ return sibling;
2685
+ };
2071
2686
  var createSupportsRuleRe = (selector) => {
2072
2687
  const safeSelector2 = escapeRegExpSpecialCharacters(selector);
2073
2688
  return new RegExp(
@@ -2081,6 +2696,10 @@ createSupportsRuleRe("::slotted");
2081
2696
  createSupportsRuleRe(":host");
2082
2697
  createSupportsRuleRe(":host-context");
2083
2698
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2699
+ if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2700
+ propValue = deserializeProperty(propValue);
2701
+ return propValue;
2702
+ }
2084
2703
  if (propValue != null && !isComplexType(propValue)) {
2085
2704
  if (propType & 4 /* Boolean */) {
2086
2705
  {
@@ -2131,7 +2750,15 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2131
2750
  const classList = elm.classList;
2132
2751
  const oldClasses = parseClassList(oldValue);
2133
2752
  let newClasses = parseClassList(newValue);
2134
- {
2753
+ if ((elm["s-si"] || elm["s-sc"]) && initialRender) {
2754
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2755
+ newClasses.push(scopeId2);
2756
+ oldClasses.forEach((c) => {
2757
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2758
+ });
2759
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2760
+ classList.add(...newClasses);
2761
+ } else {
2135
2762
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2136
2763
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2137
2764
  }
@@ -2236,7 +2863,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
2236
2863
  oldVnodeAttrs[memberName],
2237
2864
  void 0,
2238
2865
  isSvgMode2,
2239
- newVnode.$flags$);
2866
+ newVnode.$flags$,
2867
+ isInitialRender
2868
+ );
2240
2869
  }
2241
2870
  }
2242
2871
  }
@@ -2247,7 +2876,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
2247
2876
  oldVnodeAttrs[memberName],
2248
2877
  newVnodeAttrs[memberName],
2249
2878
  isSvgMode2,
2250
- newVnode.$flags$);
2879
+ newVnode.$flags$,
2880
+ isInitialRender
2881
+ );
2251
2882
  }
2252
2883
  };
2253
2884
  function sortedAttrNames(attrNames) {
@@ -2445,7 +3076,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2445
3076
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
2446
3077
  }
2447
3078
  {
2448
- updateElement(oldVNode, newVNode2, isSvgMode);
3079
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2449
3080
  }
2450
3081
  if (oldChildren !== null && newChildren !== null) {
2451
3082
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -2459,7 +3090,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2459
3090
  !isInitialRender && BUILD.updatable && oldChildren !== null
2460
3091
  ) {
2461
3092
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
2462
- } else ;
3093
+ } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
3094
+ newVNode2.$children$ = oldChildren;
3095
+ }
2463
3096
  if (isSvgMode && tag === "svg") {
2464
3097
  isSvgMode = false;
2465
3098
  }
@@ -2639,7 +3272,13 @@ var postUpdateComponent = (hostRef) => {
2639
3272
  }
2640
3273
  };
2641
3274
  var appDidLoad = (who) => {
3275
+ var _a;
2642
3276
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
3277
+ {
3278
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3279
+ plt.$orgLocNodes$.clear();
3280
+ }
3281
+ }
2643
3282
  };
2644
3283
  var safeCall = (instance, method, arg, elm) => {
2645
3284
  if (instance && instance[method]) {
@@ -2944,10 +3583,21 @@ var connectedCallback = (elm) => {
2944
3583
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
2945
3584
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2946
3585
  hostRef.$flags$ |= 1 /* hasConnected */;
3586
+ let hostId;
3587
+ {
3588
+ hostId = elm.getAttribute(HYDRATE_ID);
3589
+ if (hostId) {
3590
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3591
+ const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
3592
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
3593
+ }
3594
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
3595
+ }
3596
+ }
2947
3597
  {
2948
3598
  let ancestorComponent = elm;
2949
3599
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
2950
- if (ancestorComponent["s-p"]) {
3600
+ if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
2951
3601
  attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
2952
3602
  break;
2953
3603
  }
@@ -3016,6 +3666,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3016
3666
  let isBootstrapping = true;
3017
3667
  Object.assign(plt, options);
3018
3668
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
3669
+ {
3670
+ plt.$flags$ |= 2 /* appLoaded */;
3671
+ }
3672
+ {
3673
+ hydrateScopedToShadow();
3674
+ }
3019
3675
  let hasSlotRelocation = false;
3020
3676
  lazyBundles.map((lazyBundle) => {
3021
3677
  lazyBundle[1].map((compactMeta) => {