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