@rindo/core 4.23.2 → 4.25.3

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Rindo Hydrate Platform v4.23.2 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Hydrate Platform v4.25.3 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -8,7 +8,38 @@ var __export = (target, all) => {
8
8
  };
9
9
 
10
10
  // src/hydrate/platform/index.ts
11
- import { BUILD as BUILD23 } from "@rindo/core/internal/app-data";
11
+ import { BUILD as BUILD24 } from "@rindo/core/internal/app-data";
12
+
13
+ // src/utils/es2022-rewire-class-members.ts
14
+ import { BUILD } from "@rindo/core/internal/app-data";
15
+
16
+ // src/utils/constants.ts
17
+ var SVG_NS = "http://www.w3.org/2000/svg";
18
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
19
+
20
+ // src/utils/es2022-rewire-class-members.ts
21
+ var reWireGetterSetter = (instance, hostRef) => {
22
+ var _a;
23
+ const cmpMeta = hostRef.$cmpMeta$;
24
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
25
+ members.map(([memberName, [memberFlags]]) => {
26
+ if ((BUILD.state || BUILD.prop) && (memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
27
+ const ogValue = instance[memberName];
28
+ const ogDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(instance), memberName);
29
+ Object.defineProperty(instance, memberName, {
30
+ get() {
31
+ return ogDescriptor.get.call(this);
32
+ },
33
+ set(newValue) {
34
+ ogDescriptor.set.call(this, newValue);
35
+ },
36
+ configurable: true,
37
+ enumerable: true
38
+ });
39
+ instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
40
+ }
41
+ });
42
+ };
12
43
 
13
44
  // src/runtime/asset-path.ts
14
45
  var getAssetPath = (path) => {
@@ -18,11 +49,7 @@ var getAssetPath = (path) => {
18
49
  var setAssetPath = (path) => plt.$resourcesUrl$ = path;
19
50
 
20
51
  // src/runtime/bootstrap-custom-element.ts
21
- import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
22
-
23
- // src/utils/constants.ts
24
- var SVG_NS = "http://www.w3.org/2000/svg";
25
- var HTML_NS = "http://www.w3.org/1999/xhtml";
52
+ import { BUILD as BUILD20 } from "@rindo/core/internal/app-data";
26
53
 
27
54
  // src/utils/helpers.ts
28
55
  var isDef = (v) => v != null && v !== void 0;
@@ -87,13 +114,16 @@ var unwrapErr = (result) => {
87
114
  };
88
115
 
89
116
  // src/runtime/connected-callback.ts
90
- import { BUILD as BUILD17 } from "@rindo/core/internal/app-data";
117
+ import { BUILD as BUILD18 } from "@rindo/core/internal/app-data";
91
118
 
92
119
  // src/runtime/client-hydrate.ts
93
- import { BUILD as BUILD8 } from "@rindo/core/internal/app-data";
120
+ import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
94
121
 
95
122
  // src/runtime/dom-extras.ts
96
- import { BUILD as BUILD6 } from "@rindo/core/internal/app-data";
123
+ import { BUILD as BUILD3 } from "@rindo/core/internal/app-data";
124
+
125
+ // src/runtime/slot-polyfill-utils.ts
126
+ import { BUILD as BUILD2 } from "@rindo/core/internal/app-data";
97
127
 
98
128
  // src/runtime/runtime-constants.ts
99
129
  var CONTENT_REF_ID = "r";
@@ -121,7 +151,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
121
151
  ];
122
152
 
123
153
  // src/runtime/slot-polyfill-utils.ts
124
- import { BUILD } from "@rindo/core/internal/app-data";
125
154
  var updateFallbackSlotVisibility = (elm) => {
126
155
  const childNodes = elm.__childNodes || elm.childNodes;
127
156
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
@@ -145,27 +174,27 @@ var updateFallbackSlotVisibility = (elm) => {
145
174
  var getSlottedChildNodes = (childNodes) => {
146
175
  const result = [];
147
176
  for (let i2 = 0; i2 < childNodes.length; i2++) {
148
- const slottedNode = childNodes[i2]["s-nr"];
177
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
149
178
  if (slottedNode && slottedNode.isConnected) {
150
179
  result.push(slottedNode);
151
180
  }
152
181
  }
153
182
  return result;
154
183
  };
155
- var getHostSlotNodes = (childNodes, hostName, slotName) => {
184
+ function getHostSlotNodes(childNodes, hostName, slotName) {
156
185
  let i2 = 0;
157
186
  let slottedNodes = [];
158
187
  let childNode;
159
188
  for (; i2 < childNodes.length; i2++) {
160
189
  childNode = childNodes[i2];
161
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (!slotName || childNode["s-sn"] === slotName)) {
190
+ if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
162
191
  slottedNodes.push(childNode);
163
192
  if (typeof slotName !== "undefined") return slottedNodes;
164
193
  }
165
194
  slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
166
195
  }
167
196
  return slottedNodes;
168
- };
197
+ }
169
198
  var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
170
199
  const childNodes = [];
171
200
  if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
@@ -201,7 +230,7 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
201
230
  const parent = slotNode["s-cr"].parentNode;
202
231
  const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
203
232
  if (typeof position !== "undefined") {
204
- if (BUILD.hydrateClientSide) {
233
+ if (BUILD2.hydrateClientSide) {
205
234
  slottedNodeLocation["s-oo"] = position;
206
235
  const childNodes = parent.__childNodes || parent.childNodes;
207
236
  const slotRelocateNodes = [slottedNodeLocation];
@@ -223,1819 +252,1913 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
223
252
  };
224
253
  var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
225
254
 
226
- // src/runtime/vdom/vdom-render.ts
227
- import { BUILD as BUILD5 } from "@rindo/core/internal/app-data";
228
-
229
- // src/runtime/vdom/h.ts
230
- import { BUILD as BUILD2 } from "@rindo/core/internal/app-data";
231
- var h = (nodeName, vnodeData, ...children) => {
232
- let child = null;
233
- let key = null;
234
- let slotName = null;
235
- let simple = false;
236
- let lastSimple = false;
237
- const vNodeChildren = [];
238
- const walk = (c) => {
239
- for (let i2 = 0; i2 < c.length; i2++) {
240
- child = c[i2];
241
- if (Array.isArray(child)) {
242
- walk(child);
243
- } else if (child != null && typeof child !== "boolean") {
244
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
245
- child = String(child);
246
- } else if (BUILD2.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
247
- consoleDevError(`vNode passed as children has unexpected type.
248
- Make sure it's using the correct h() function.
249
- Empty objects can also be the cause, look for JSX comments that became objects.`);
255
+ // src/runtime/dom-extras.ts
256
+ var patchPseudoShadowDom = (hostElementPrototype) => {
257
+ patchCloneNode(hostElementPrototype);
258
+ patchSlotAppendChild(hostElementPrototype);
259
+ patchSlotAppend(hostElementPrototype);
260
+ patchSlotPrepend(hostElementPrototype);
261
+ patchSlotInsertAdjacentElement(hostElementPrototype);
262
+ patchSlotInsertAdjacentHTML(hostElementPrototype);
263
+ patchSlotInsertAdjacentText(hostElementPrototype);
264
+ patchInsertBefore(hostElementPrototype);
265
+ patchTextContent(hostElementPrototype);
266
+ patchChildSlotNodes(hostElementPrototype);
267
+ patchSlotRemoveChild(hostElementPrototype);
268
+ };
269
+ var patchCloneNode = (HostElementPrototype) => {
270
+ const orgCloneNode = HostElementPrototype.cloneNode;
271
+ HostElementPrototype.cloneNode = function(deep) {
272
+ const srcNode = this;
273
+ const isShadowDom = BUILD3.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
274
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
275
+ if (BUILD3.slot && !isShadowDom && deep) {
276
+ let i2 = 0;
277
+ let slotted, nonRindoNode;
278
+ const rindoPrivates = [
279
+ "s-id",
280
+ "s-cr",
281
+ "s-lr",
282
+ "s-rc",
283
+ "s-sc",
284
+ "s-p",
285
+ "s-cn",
286
+ "s-sr",
287
+ "s-sn",
288
+ "s-hn",
289
+ "s-ol",
290
+ "s-nr",
291
+ "s-si",
292
+ "s-rf",
293
+ "s-scs"
294
+ ];
295
+ const childNodes = this.__childNodes || this.childNodes;
296
+ for (; i2 < childNodes.length; i2++) {
297
+ slotted = childNodes[i2]["s-nr"];
298
+ nonRindoNode = rindoPrivates.every((privateField) => !childNodes[i2][privateField]);
299
+ if (slotted) {
300
+ if (BUILD3.appendChildSlotFix && clonedNode.__appendChild) {
301
+ clonedNode.__appendChild(slotted.cloneNode(true));
302
+ } else {
303
+ clonedNode.appendChild(slotted.cloneNode(true));
304
+ }
250
305
  }
251
- if (simple && lastSimple) {
252
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
253
- } else {
254
- vNodeChildren.push(simple ? newVNode(null, child) : child);
306
+ if (nonRindoNode) {
307
+ clonedNode.appendChild(childNodes[i2].cloneNode(true));
255
308
  }
256
- lastSimple = simple;
257
309
  }
258
310
  }
311
+ return clonedNode;
259
312
  };
260
- walk(children);
261
- if (vnodeData) {
262
- if (BUILD2.isDev && nodeName === "input") {
263
- validateInputProperties(vnodeData);
264
- }
265
- if (BUILD2.vdomKey && vnodeData.key) {
266
- key = vnodeData.key;
267
- }
268
- if (BUILD2.slotRelocation && vnodeData.name) {
269
- slotName = vnodeData.name;
313
+ };
314
+ var patchSlotAppendChild = (HostElementPrototype) => {
315
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
316
+ HostElementPrototype.appendChild = function(newChild) {
317
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
318
+ const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
319
+ if (slotNode) {
320
+ addSlotRelocateNode(newChild, slotNode);
321
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
322
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
323
+ const parent = intrnlCall(appendAfter, "parentNode");
324
+ let insertedNode;
325
+ if (parent.__insertBefore) {
326
+ insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
327
+ } else {
328
+ insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
329
+ }
330
+ updateFallbackSlotVisibility(this);
331
+ return insertedNode;
270
332
  }
271
- if (BUILD2.vdomClass) {
272
- const classData = vnodeData.className || vnodeData.class;
273
- if (classData) {
274
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
333
+ return this.__appendChild(newChild);
334
+ };
335
+ };
336
+ var patchSlotRemoveChild = (ElementPrototype) => {
337
+ ElementPrototype.__removeChild = ElementPrototype.removeChild;
338
+ ElementPrototype.removeChild = function(toRemove) {
339
+ if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
340
+ const childNodes = this.__childNodes || this.childNodes;
341
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
342
+ if (slotNode && toRemove.isConnected) {
343
+ toRemove.remove();
344
+ updateFallbackSlotVisibility(this);
345
+ return;
275
346
  }
276
347
  }
277
- }
278
- if (BUILD2.isDev && vNodeChildren.some(isHost)) {
279
- consoleDevError(`The <Host> must be the single root component. Make sure:
280
- - You are NOT using hostData() and <Host> in the same component.
281
- - <Host> is used once, and it's the single root component of the render() function.`);
282
- }
283
- if (BUILD2.vdomFunctional && typeof nodeName === "function") {
284
- return nodeName(
285
- vnodeData === null ? {} : vnodeData,
286
- vNodeChildren,
287
- vdomFnUtils
288
- );
289
- }
290
- const vnode = newVNode(nodeName, null);
291
- vnode.$attrs$ = vnodeData;
292
- if (vNodeChildren.length > 0) {
293
- vnode.$children$ = vNodeChildren;
294
- }
295
- if (BUILD2.vdomKey) {
296
- vnode.$key$ = key;
297
- }
298
- if (BUILD2.slotRelocation) {
299
- vnode.$name$ = slotName;
300
- }
301
- return vnode;
348
+ return this.__removeChild(toRemove);
349
+ };
302
350
  };
303
- var newVNode = (tag, text) => {
304
- const vnode = {
305
- $flags$: 0,
306
- $tag$: tag,
307
- $text$: text,
308
- $elm$: null,
309
- $children$: null
351
+ var patchSlotPrepend = (HostElementPrototype) => {
352
+ HostElementPrototype.__prepend = HostElementPrototype.prepend;
353
+ HostElementPrototype.prepend = function(...newChildren) {
354
+ newChildren.forEach((newChild) => {
355
+ if (typeof newChild === "string") {
356
+ newChild = this.ownerDocument.createTextNode(newChild);
357
+ }
358
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
359
+ const childNodes = this.__childNodes || this.childNodes;
360
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
361
+ if (slotNode) {
362
+ addSlotRelocateNode(newChild, slotNode, true);
363
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
364
+ const appendAfter = slotChildNodes[0];
365
+ const parent = intrnlCall(appendAfter, "parentNode");
366
+ if (parent.__insertBefore) {
367
+ return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
368
+ } else {
369
+ return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
370
+ }
371
+ }
372
+ if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
373
+ newChild.hidden = true;
374
+ }
375
+ return HostElementPrototype.__prepend(newChild);
376
+ });
310
377
  };
311
- if (BUILD2.vdomAttribute) {
312
- vnode.$attrs$ = null;
313
- }
314
- if (BUILD2.vdomKey) {
315
- vnode.$key$ = null;
316
- }
317
- if (BUILD2.slotRelocation) {
318
- vnode.$name$ = null;
319
- }
320
- return vnode;
321
378
  };
322
- var Host = {};
323
- var isHost = (node) => node && node.$tag$ === Host;
324
- var vdomFnUtils = {
325
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
326
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
379
+ var patchSlotAppend = (HostElementPrototype) => {
380
+ HostElementPrototype.__append = HostElementPrototype.append;
381
+ HostElementPrototype.append = function(...newChildren) {
382
+ newChildren.forEach((newChild) => {
383
+ if (typeof newChild === "string") {
384
+ newChild = this.ownerDocument.createTextNode(newChild);
385
+ }
386
+ this.appendChild(newChild);
387
+ });
388
+ };
327
389
  };
328
- var convertToPublic = (node) => ({
329
- vattrs: node.$attrs$,
330
- vchildren: node.$children$,
331
- vkey: node.$key$,
332
- vname: node.$name$,
333
- vtag: node.$tag$,
334
- vtext: node.$text$
335
- });
336
- var convertToPrivate = (node) => {
337
- if (typeof node.vtag === "function") {
338
- const vnodeData = { ...node.vattrs };
339
- if (node.vkey) {
340
- vnodeData.key = node.vkey;
390
+ var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
391
+ const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
392
+ HostElementPrototype.insertAdjacentHTML = function(position, text) {
393
+ if (position !== "afterbegin" && position !== "beforeend") {
394
+ return originalInsertAdjacentHtml.call(this, position, text);
341
395
  }
342
- if (node.vname) {
343
- vnodeData.name = node.vname;
396
+ const container = this.ownerDocument.createElement("_");
397
+ let node;
398
+ container.innerHTML = text;
399
+ if (position === "afterbegin") {
400
+ while (node = container.firstChild) {
401
+ this.prepend(node);
402
+ }
403
+ } else if (position === "beforeend") {
404
+ while (node = container.firstChild) {
405
+ this.append(node);
406
+ }
344
407
  }
345
- return h(node.vtag, vnodeData, ...node.vchildren || []);
346
- }
347
- const vnode = newVNode(node.vtag, node.vtext);
348
- vnode.$attrs$ = node.vattrs;
349
- vnode.$children$ = node.vchildren;
350
- vnode.$key$ = node.vkey;
351
- vnode.$name$ = node.vname;
352
- return vnode;
408
+ };
353
409
  };
354
- var validateInputProperties = (inputElm) => {
355
- const props = Object.keys(inputElm);
356
- const value = props.indexOf("value");
357
- if (value === -1) {
358
- return;
359
- }
360
- const typeIndex = props.indexOf("type");
361
- const minIndex = props.indexOf("min");
362
- const maxIndex = props.indexOf("max");
363
- const stepIndex = props.indexOf("step");
364
- if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
365
- consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
366
- }
410
+ var patchSlotInsertAdjacentText = (HostElementPrototype) => {
411
+ HostElementPrototype.insertAdjacentText = function(position, text) {
412
+ this.insertAdjacentHTML(position, text);
413
+ };
367
414
  };
368
-
369
- // src/runtime/vdom/update-element.ts
370
- import { BUILD as BUILD4 } from "@rindo/core/internal/app-data";
371
-
372
- // src/runtime/vdom/set-accessor.ts
373
- import { BUILD as BUILD3 } from "@rindo/core/internal/app-data";
374
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
375
- if (oldValue !== newValue) {
376
- let isProp = isMemberInElement(elm, memberName);
377
- let ln = memberName.toLowerCase();
378
- if (BUILD3.vdomClass && memberName === "class") {
379
- const classList = elm.classList;
380
- const oldClasses = parseClassList(oldValue);
381
- let newClasses = parseClassList(newValue);
382
- if (elm["s-si"]) {
383
- newClasses.push(elm["s-si"]);
384
- oldClasses.forEach((c) => {
385
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
386
- });
387
- newClasses = [...new Set(newClasses)];
388
- classList.add(...newClasses);
389
- delete elm["s-si"];
390
- } else {
391
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
392
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
393
- }
394
- } else if (BUILD3.vdomStyle && memberName === "style") {
395
- if (BUILD3.updatable) {
396
- for (const prop in oldValue) {
397
- if (!newValue || newValue[prop] == null) {
398
- if (!BUILD3.hydrateServerSide && prop.includes("-")) {
399
- elm.style.removeProperty(prop);
400
- } else {
401
- elm.style[prop] = "";
402
- }
403
- }
404
- }
405
- }
406
- for (const prop in newValue) {
407
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
408
- if (!BUILD3.hydrateServerSide && prop.includes("-")) {
409
- elm.style.setProperty(prop, newValue[prop]);
410
- } else {
411
- elm.style[prop] = newValue[prop];
415
+ var patchInsertBefore = (HostElementPrototype) => {
416
+ const eleProto = HostElementPrototype;
417
+ if (eleProto.__insertBefore) return;
418
+ eleProto.__insertBefore = HostElementPrototype.insertBefore;
419
+ HostElementPrototype.insertBefore = function(newChild, currentChild) {
420
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
421
+ const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
422
+ const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
423
+ if (slotNode) {
424
+ let found = false;
425
+ slottedNodes.forEach((childNode) => {
426
+ if (childNode === currentChild || currentChild === null) {
427
+ found = true;
428
+ if (currentChild === null || slotName !== currentChild["s-sn"]) {
429
+ this.appendChild(newChild);
430
+ return;
412
431
  }
413
- }
414
- }
415
- } else if (BUILD3.vdomKey && memberName === "key") {
416
- } else if (BUILD3.vdomRef && memberName === "ref") {
417
- if (newValue) {
418
- newValue(elm);
419
- }
420
- } else if (BUILD3.vdomListener && (BUILD3.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
421
- if (memberName[2] === "-") {
422
- memberName = memberName.slice(3);
423
- } else if (isMemberInElement(win, ln)) {
424
- memberName = ln.slice(2);
425
- } else {
426
- memberName = ln[2] + memberName.slice(3);
427
- }
428
- if (oldValue || newValue) {
429
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
430
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
431
- if (oldValue) {
432
- plt.rel(elm, memberName, oldValue, capture);
433
- }
434
- if (newValue) {
435
- plt.ael(elm, memberName, newValue, capture);
436
- }
437
- }
438
- } else if (BUILD3.vdomPropOrAttr) {
439
- const isComplex = isComplexType(newValue);
440
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
441
- try {
442
- if (!elm.tagName.includes("-")) {
443
- const n = newValue == null ? "" : newValue;
444
- if (memberName === "list") {
445
- isProp = false;
446
- } else if (oldValue == null || elm[memberName] != n) {
447
- if (typeof elm.__lookupSetter__(memberName) === "function") {
448
- elm[memberName] = n;
449
- } else {
450
- elm.setAttribute(memberName, n);
451
- }
432
+ if (slotName === currentChild["s-sn"]) {
433
+ addSlotRelocateNode(newChild, slotNode);
434
+ const parent = intrnlCall(currentChild, "parentNode");
435
+ if (parent.__insertBefore) {
436
+ parent.__insertBefore(newChild, currentChild);
437
+ } else {
438
+ parent.insertBefore(newChild, currentChild);
452
439
  }
453
- } else {
454
- elm[memberName] = newValue;
455
- }
456
- } catch (e) {
457
- }
458
- }
459
- let xlink = false;
460
- if (BUILD3.vdomXlink) {
461
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
462
- memberName = ln;
463
- xlink = true;
464
- }
465
- }
466
- if (newValue == null || newValue === false) {
467
- if (newValue !== false || elm.getAttribute(memberName) === "") {
468
- if (BUILD3.vdomXlink && xlink) {
469
- elm.removeAttributeNS(XLINK_NS, memberName);
470
- } else {
471
- elm.removeAttribute(memberName);
472
440
  }
441
+ return;
473
442
  }
474
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
475
- newValue = newValue === true ? "" : newValue;
476
- if (BUILD3.vdomXlink && xlink) {
477
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
478
- } else {
479
- elm.setAttribute(memberName, newValue);
480
- }
481
- }
443
+ });
444
+ if (found) return newChild;
482
445
  }
483
- }
446
+ return this.__insertBefore(newChild, currentChild);
447
+ };
484
448
  };
485
- var parseClassListRegex = /\s/;
486
- var parseClassList = (value) => {
487
- if (typeof value === "object" && "baseVal" in value) {
488
- value = value.baseVal;
489
- }
490
- if (!value) {
491
- return [];
492
- }
493
- return value.split(parseClassListRegex);
449
+ var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
450
+ const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
451
+ HostElementPrototype.insertAdjacentElement = function(position, element) {
452
+ if (position !== "afterbegin" && position !== "beforeend") {
453
+ return originalInsertAdjacentElement.call(this, position, element);
454
+ }
455
+ if (position === "afterbegin") {
456
+ this.prepend(element);
457
+ return element;
458
+ } else if (position === "beforeend") {
459
+ this.append(element);
460
+ return element;
461
+ }
462
+ return element;
463
+ };
494
464
  };
495
- var CAPTURE_EVENT_SUFFIX = "Capture";
496
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
497
-
498
- // src/runtime/vdom/update-element.ts
499
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
500
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
501
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
502
- const newVnodeAttrs = newVnode.$attrs$ || {};
503
- if (BUILD4.updatable) {
504
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
505
- if (!(memberName in newVnodeAttrs)) {
506
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
507
- }
465
+ var patchTextContent = (hostElementPrototype) => {
466
+ patchHostOriginalAccessor("textContent", hostElementPrototype);
467
+ Object.defineProperty(hostElementPrototype, "textContent", {
468
+ get: function() {
469
+ let text = "";
470
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
471
+ childNodes.forEach((node) => text += node.textContent || "");
472
+ return text;
473
+ },
474
+ set: function(value) {
475
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
476
+ childNodes.forEach((node) => {
477
+ if (node["s-ol"]) node["s-ol"].remove();
478
+ node.remove();
479
+ });
480
+ this.insertAdjacentHTML("beforeend", value);
508
481
  }
509
- }
510
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
511
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
512
- }
482
+ });
513
483
  };
514
- function sortedAttrNames(attrNames) {
515
- return attrNames.includes("ref") ? (
516
- // we need to sort these to ensure that `'ref'` is the last attr
517
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
518
- ) : (
519
- // no need to sort, return the original array
520
- attrNames
521
- );
522
- }
523
-
524
- // src/runtime/vdom/vdom-render.ts
525
- var scopeId;
526
- var contentRef;
527
- var hostTagName;
528
- var useNativeShadowDom = false;
529
- var checkSlotFallbackVisibility = false;
530
- var checkSlotRelocate = false;
531
- var isSvgMode = false;
532
- var createElm = (oldParentVNode, newParentVNode, childIndex) => {
533
- var _a;
534
- const newVNode2 = newParentVNode.$children$[childIndex];
535
- let i2 = 0;
536
- let elm;
537
- let childNode;
538
- let oldVNode;
539
- if (BUILD5.slotRelocation && !useNativeShadowDom) {
540
- checkSlotRelocate = true;
541
- if (newVNode2.$tag$ === "slot") {
542
- newVNode2.$flags$ |= newVNode2.$children$ ? (
543
- // slot element has fallback content
544
- // still create an element that "mocks" the slot element
545
- 2 /* isSlotFallback */
546
- ) : (
547
- // slot element does not have fallback content
548
- // create an html comment we'll use to always reference
549
- // where actual slot content should sit next to
550
- 1 /* isSlotReference */
551
- );
484
+ var patchChildSlotNodes = (elm) => {
485
+ class FakeNodeList extends Array {
486
+ item(n) {
487
+ return this[n];
552
488
  }
553
489
  }
554
- if (BUILD5.isDev && newVNode2.$elm$) {
555
- consoleDevError(
556
- `The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`
557
- );
558
- }
559
- if (BUILD5.vdomText && newVNode2.$text$ !== null) {
560
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
561
- } else if (BUILD5.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
562
- elm = newVNode2.$elm$ = BUILD5.isDebug || BUILD5.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
563
- } else {
564
- if (BUILD5.svg && !isSvgMode) {
565
- isSvgMode = newVNode2.$tag$ === "svg";
490
+ patchHostOriginalAccessor("children", elm);
491
+ Object.defineProperty(elm, "children", {
492
+ get() {
493
+ return this.childNodes.filter((n) => n.nodeType === 1);
566
494
  }
567
- elm = newVNode2.$elm$ = BUILD5.svg ? doc.createElementNS(
568
- isSvgMode ? SVG_NS : HTML_NS,
569
- !useNativeShadowDom && BUILD5.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
570
- ) : doc.createElement(
571
- !useNativeShadowDom && BUILD5.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
572
- );
573
- if (BUILD5.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
574
- isSvgMode = false;
495
+ });
496
+ Object.defineProperty(elm, "childElementCount", {
497
+ get() {
498
+ return this.children.length;
575
499
  }
576
- if (BUILD5.vdomAttribute) {
577
- updateElement(null, newVNode2, isSvgMode);
500
+ });
501
+ patchHostOriginalAccessor("firstChild", elm);
502
+ Object.defineProperty(elm, "firstChild", {
503
+ get() {
504
+ return this.childNodes[0];
578
505
  }
579
- if (BUILD5.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
580
- elm.classList.add(elm["s-si"] = scopeId);
506
+ });
507
+ patchHostOriginalAccessor("lastChild", elm);
508
+ Object.defineProperty(elm, "lastChild", {
509
+ get() {
510
+ return this.childNodes[this.childNodes.length - 1];
581
511
  }
582
- if (newVNode2.$children$) {
583
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
584
- childNode = createElm(oldParentVNode, newVNode2, i2);
585
- if (childNode) {
586
- elm.appendChild(childNode);
587
- }
588
- }
589
- }
590
- if (BUILD5.svg) {
591
- if (newVNode2.$tag$ === "svg") {
592
- isSvgMode = false;
593
- } else if (elm.tagName === "foreignObject") {
594
- isSvgMode = true;
595
- }
512
+ });
513
+ patchHostOriginalAccessor("childNodes", elm);
514
+ Object.defineProperty(elm, "childNodes", {
515
+ get() {
516
+ const result = new FakeNodeList();
517
+ result.push(...getSlottedChildNodes(this.__childNodes));
518
+ return result;
596
519
  }
520
+ });
521
+ };
522
+ var patchSlottedNode = (node) => {
523
+ if (!node || node.__nextSibling || !globalThis.Node) return;
524
+ patchNextSibling(node);
525
+ patchPreviousSibling(node);
526
+ patchParentNode(node);
527
+ if (node.nodeType === Node.ELEMENT_NODE) {
528
+ patchNextElementSibling(node);
529
+ patchPreviousElementSibling(node);
597
530
  }
598
- elm["s-hn"] = hostTagName;
599
- if (BUILD5.slotRelocation) {
600
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
601
- elm["s-sr"] = true;
602
- elm["s-cr"] = contentRef;
603
- elm["s-sn"] = newVNode2.$name$ || "";
604
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
605
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
606
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
607
- if (BUILD5.experimentalSlotFixes) {
608
- relocateToHostRoot(oldParentVNode.$elm$);
609
- } else {
610
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
611
- }
612
- }
613
- if (BUILD5.scoped) {
614
- addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
531
+ };
532
+ var patchNextSibling = (node) => {
533
+ if (!node || node.__nextSibling) return;
534
+ patchHostOriginalAccessor("nextSibling", node);
535
+ Object.defineProperty(node, "nextSibling", {
536
+ get: function() {
537
+ var _a;
538
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
539
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
540
+ if (parentNodes && index > -1) {
541
+ return parentNodes[index + 1];
615
542
  }
543
+ return this.__nextSibling;
616
544
  }
617
- }
618
- return elm;
545
+ });
619
546
  };
620
- var relocateToHostRoot = (parentElm) => {
621
- plt.$flags$ |= 1 /* isTmpDisconnected */;
622
- const host = parentElm.closest(hostTagName.toLowerCase());
623
- if (host != null) {
624
- const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
625
- (ref) => ref["s-cr"]
626
- );
627
- const childNodeArray = Array.from(
628
- parentElm.__childNodes || parentElm.childNodes
629
- );
630
- for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
631
- if (childNode["s-sh"] != null) {
632
- insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
633
- childNode["s-sh"] = void 0;
634
- checkSlotRelocate = true;
547
+ var patchNextElementSibling = (element) => {
548
+ if (!element || element.__nextElementSibling) return;
549
+ patchHostOriginalAccessor("nextElementSibling", element);
550
+ Object.defineProperty(element, "nextElementSibling", {
551
+ get: function() {
552
+ var _a;
553
+ const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
554
+ const index = parentEles == null ? void 0 : parentEles.indexOf(this);
555
+ if (parentEles && index > -1) {
556
+ return parentEles[index + 1];
635
557
  }
558
+ return this.__nextElementSibling;
636
559
  }
637
- }
638
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
560
+ });
639
561
  };
640
- var putBackInOriginalLocation = (parentElm, recursive) => {
641
- plt.$flags$ |= 1 /* isTmpDisconnected */;
642
- const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
643
- if (parentElm["s-sr"] && BUILD5.experimentalSlotFixes) {
644
- let node = parentElm;
645
- while (node = node.nextSibling) {
646
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
647
- oldSlotChildNodes.push(node);
562
+ var patchPreviousSibling = (node) => {
563
+ if (!node || node.__previousSibling) return;
564
+ patchHostOriginalAccessor("previousSibling", node);
565
+ Object.defineProperty(node, "previousSibling", {
566
+ get: function() {
567
+ var _a;
568
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
569
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
570
+ if (parentNodes && index > -1) {
571
+ return parentNodes[index - 1];
648
572
  }
573
+ return this.__previousSibling;
649
574
  }
650
- }
651
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
652
- const childNode = oldSlotChildNodes[i2];
653
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
654
- insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
655
- childNode["s-ol"].remove();
656
- childNode["s-ol"] = void 0;
657
- childNode["s-sh"] = void 0;
658
- checkSlotRelocate = true;
575
+ });
576
+ };
577
+ var patchPreviousElementSibling = (element) => {
578
+ if (!element || element.__previousElementSibling) return;
579
+ patchHostOriginalAccessor("previousElementSibling", element);
580
+ Object.defineProperty(element, "previousElementSibling", {
581
+ get: function() {
582
+ var _a;
583
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
584
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
585
+ if (parentNodes && index > -1) {
586
+ return parentNodes[index - 1];
587
+ }
588
+ return this.__previousElementSibling;
659
589
  }
660
- if (recursive) {
661
- putBackInOriginalLocation(childNode, recursive);
590
+ });
591
+ };
592
+ var patchParentNode = (node) => {
593
+ if (!node || node.__parentNode) return;
594
+ patchHostOriginalAccessor("parentNode", node);
595
+ Object.defineProperty(node, "parentNode", {
596
+ get: function() {
597
+ var _a;
598
+ return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
599
+ },
600
+ set: function(value) {
601
+ this.__parentNode = value;
662
602
  }
663
- }
664
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
603
+ });
665
604
  };
666
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
667
- let containerElm = BUILD5.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
668
- let childNode;
669
- if (BUILD5.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
670
- containerElm = containerElm.shadowRoot;
605
+ var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
606
+ var validNodesPatches = [
607
+ "childNodes",
608
+ "firstChild",
609
+ "lastChild",
610
+ "nextSibling",
611
+ "previousSibling",
612
+ "textContent",
613
+ "parentNode"
614
+ ];
615
+ function patchHostOriginalAccessor(accessorName, node) {
616
+ let accessor;
617
+ if (validElementPatches.includes(accessorName)) {
618
+ accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
619
+ } else if (validNodesPatches.includes(accessorName)) {
620
+ accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
671
621
  }
672
- for (; startIdx <= endIdx; ++startIdx) {
673
- if (vnodes[startIdx]) {
674
- childNode = createElm(null, parentVNode, startIdx);
675
- if (childNode) {
676
- vnodes[startIdx].$elm$ = childNode;
677
- insertBefore(containerElm, childNode, BUILD5.slotRelocation ? referenceNode(before) : before);
678
- }
622
+ if (!accessor) {
623
+ accessor = Object.getOwnPropertyDescriptor(node, accessorName);
624
+ }
625
+ if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
626
+ }
627
+ function intrnlCall(node, method) {
628
+ if ("__" + method in node) {
629
+ return node["__" + method];
630
+ } else {
631
+ return node[method];
632
+ }
633
+ }
634
+
635
+ // src/runtime/profile.ts
636
+ import { BUILD as BUILD4 } from "@rindo/core/internal/app-data";
637
+ var i = 0;
638
+ var createTime = (fnName, tagName = "") => {
639
+ if (BUILD4.profile && performance.mark) {
640
+ const key = `st:${fnName}:${tagName}:${i++}`;
641
+ performance.mark(key);
642
+ return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
643
+ } else {
644
+ return () => {
645
+ return;
646
+ };
647
+ }
648
+ };
649
+ var uniqueTime = (key, measureText) => {
650
+ if (BUILD4.profile && performance.mark) {
651
+ if (performance.getEntriesByName(key, "mark").length === 0) {
652
+ performance.mark(key);
679
653
  }
654
+ return () => {
655
+ if (performance.getEntriesByName(measureText, "measure").length === 0) {
656
+ performance.measure(measureText, key);
657
+ }
658
+ };
659
+ } else {
660
+ return () => {
661
+ return;
662
+ };
680
663
  }
681
664
  };
682
- var removeVnodes = (vnodes, startIdx, endIdx) => {
683
- for (let index = startIdx; index <= endIdx; ++index) {
684
- const vnode = vnodes[index];
685
- if (vnode) {
686
- const elm = vnode.$elm$;
687
- nullifyVNodeRefs(vnode);
688
- if (elm) {
689
- if (BUILD5.slotRelocation) {
690
- checkSlotFallbackVisibility = true;
691
- if (elm["s-ol"]) {
692
- elm["s-ol"].remove();
693
- } else {
694
- putBackInOriginalLocation(elm, true);
695
- }
696
- }
697
- elm.remove();
665
+ var inspect = (ref) => {
666
+ const hostRef = getHostRef(ref);
667
+ if (!hostRef) {
668
+ return void 0;
669
+ }
670
+ const flags = hostRef.$flags$;
671
+ const hostElement = hostRef.$hostElement$;
672
+ return {
673
+ renderCount: hostRef.$renderCount$,
674
+ flags: {
675
+ hasRendered: !!(flags & 2 /* hasRendered */),
676
+ hasConnected: !!(flags & 1 /* hasConnected */),
677
+ isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
678
+ isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
679
+ isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
680
+ hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
681
+ hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
682
+ isWatchReady: !!(flags & 128 /* isWatchReady */),
683
+ isListenReady: !!(flags & 256 /* isListenReady */),
684
+ needsRerender: !!(flags & 512 /* needsRerender */)
685
+ },
686
+ instanceValues: hostRef.$instanceValues$,
687
+ ancestorComponent: hostRef.$ancestorComponent$,
688
+ hostElement,
689
+ lazyInstance: hostRef.$lazyInstance$,
690
+ vnode: hostRef.$vnode$,
691
+ modeName: hostRef.$modeName$,
692
+ onReadyPromise: hostRef.$onReadyPromise$,
693
+ onReadyResolve: hostRef.$onReadyResolve$,
694
+ onInstancePromise: hostRef.$onInstancePromise$,
695
+ onInstanceResolve: hostRef.$onInstanceResolve$,
696
+ onRenderResolve: hostRef.$onRenderResolve$,
697
+ queuedListeners: hostRef.$queuedListeners$,
698
+ rmListeners: hostRef.$rmListeners$,
699
+ ["s-id"]: hostElement["s-id"],
700
+ ["s-cr"]: hostElement["s-cr"],
701
+ ["s-lr"]: hostElement["s-lr"],
702
+ ["s-p"]: hostElement["s-p"],
703
+ ["s-rc"]: hostElement["s-rc"],
704
+ ["s-sc"]: hostElement["s-sc"]
705
+ };
706
+ };
707
+ var installDevTools = () => {
708
+ if (BUILD4.devTools) {
709
+ const rindo = win.rindo = win.rindo || {};
710
+ const originalInspect = rindo.inspect;
711
+ rindo.inspect = (ref) => {
712
+ let result = inspect(ref);
713
+ if (!result && typeof originalInspect === "function") {
714
+ result = originalInspect(ref);
698
715
  }
699
- }
716
+ return result;
717
+ };
700
718
  }
701
719
  };
702
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
703
- let oldStartIdx = 0;
704
- let newStartIdx = 0;
705
- let idxInOld = 0;
706
- let i2 = 0;
707
- let oldEndIdx = oldCh.length - 1;
708
- let oldStartVnode = oldCh[0];
709
- let oldEndVnode = oldCh[oldEndIdx];
710
- let newEndIdx = newCh.length - 1;
711
- let newStartVnode = newCh[0];
712
- let newEndVnode = newCh[newEndIdx];
713
- let node;
714
- let elmToMove;
715
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
716
- if (oldStartVnode == null) {
717
- oldStartVnode = oldCh[++oldStartIdx];
718
- } else if (oldEndVnode == null) {
719
- oldEndVnode = oldCh[--oldEndIdx];
720
- } else if (newStartVnode == null) {
721
- newStartVnode = newCh[++newStartIdx];
722
- } else if (newEndVnode == null) {
723
- newEndVnode = newCh[--newEndIdx];
724
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
725
- patch(oldStartVnode, newStartVnode, isInitialRender);
726
- oldStartVnode = oldCh[++oldStartIdx];
727
- newStartVnode = newCh[++newStartIdx];
728
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
729
- patch(oldEndVnode, newEndVnode, isInitialRender);
730
- oldEndVnode = oldCh[--oldEndIdx];
731
- newEndVnode = newCh[--newEndIdx];
732
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
733
- if (BUILD5.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
734
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
735
- }
736
- patch(oldStartVnode, newEndVnode, isInitialRender);
737
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
738
- oldStartVnode = oldCh[++oldStartIdx];
739
- newEndVnode = newCh[--newEndIdx];
740
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
741
- if (BUILD5.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
742
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
743
- }
744
- patch(oldEndVnode, newStartVnode, isInitialRender);
745
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
746
- oldEndVnode = oldCh[--oldEndIdx];
747
- newStartVnode = newCh[++newStartIdx];
748
- } else {
749
- idxInOld = -1;
750
- if (BUILD5.vdomKey) {
751
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
752
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
753
- idxInOld = i2;
754
- break;
755
- }
756
- }
757
- }
758
- if (BUILD5.vdomKey && idxInOld >= 0) {
759
- elmToMove = oldCh[idxInOld];
760
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
761
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
762
- } else {
763
- patch(elmToMove, newStartVnode, isInitialRender);
764
- oldCh[idxInOld] = void 0;
765
- node = elmToMove.$elm$;
720
+
721
+ // src/runtime/vdom/h.ts
722
+ import { BUILD as BUILD5 } from "@rindo/core/internal/app-data";
723
+ var h = (nodeName, vnodeData, ...children) => {
724
+ let child = null;
725
+ let key = null;
726
+ let slotName = null;
727
+ let simple = false;
728
+ let lastSimple = false;
729
+ const vNodeChildren = [];
730
+ const walk = (c) => {
731
+ for (let i2 = 0; i2 < c.length; i2++) {
732
+ child = c[i2];
733
+ if (Array.isArray(child)) {
734
+ walk(child);
735
+ } else if (child != null && typeof child !== "boolean") {
736
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
737
+ child = String(child);
738
+ } else if (BUILD5.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
739
+ consoleDevError(`vNode passed as children has unexpected type.
740
+ Make sure it's using the correct h() function.
741
+ Empty objects can also be the cause, look for JSX comments that became objects.`);
766
742
  }
767
- newStartVnode = newCh[++newStartIdx];
768
- } else {
769
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
770
- newStartVnode = newCh[++newStartIdx];
771
- }
772
- if (node) {
773
- if (BUILD5.slotRelocation) {
774
- insertBefore(
775
- referenceNode(oldStartVnode.$elm$).parentNode,
776
- node,
777
- referenceNode(oldStartVnode.$elm$)
778
- );
743
+ if (simple && lastSimple) {
744
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
779
745
  } else {
780
- insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
746
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
781
747
  }
748
+ lastSimple = simple;
782
749
  }
783
750
  }
784
- }
785
- if (oldStartIdx > oldEndIdx) {
786
- addVnodes(
787
- parentElm,
788
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
789
- newVNode2,
790
- newCh,
791
- newStartIdx,
792
- newEndIdx
793
- );
794
- } else if (BUILD5.updatable && newStartIdx > newEndIdx) {
795
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
796
- }
797
- };
798
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
799
- if (leftVNode.$tag$ === rightVNode.$tag$) {
800
- if (BUILD5.slotRelocation && leftVNode.$tag$ === "slot") {
801
- return leftVNode.$name$ === rightVNode.$name$;
802
- }
803
- if (BUILD5.vdomKey && !isInitialRender) {
804
- return leftVNode.$key$ === rightVNode.$key$;
805
- }
806
- if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
807
- leftVNode.$key$ = rightVNode.$key$;
751
+ };
752
+ walk(children);
753
+ if (vnodeData) {
754
+ if (BUILD5.isDev && nodeName === "input") {
755
+ validateInputProperties(vnodeData);
808
756
  }
809
- return true;
810
- }
811
- return false;
812
- };
813
- var referenceNode = (node) => node && node["s-ol"] || node;
814
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
815
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
816
- const oldChildren = oldVNode.$children$;
817
- const newChildren = newVNode2.$children$;
818
- const tag = newVNode2.$tag$;
819
- const text = newVNode2.$text$;
820
- let defaultHolder;
821
- if (!BUILD5.vdomText || text === null) {
822
- if (BUILD5.svg) {
823
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
757
+ if (BUILD5.vdomKey && vnodeData.key) {
758
+ key = vnodeData.key;
824
759
  }
825
- if (BUILD5.vdomAttribute || BUILD5.reflect) {
826
- if (BUILD5.slot && tag === "slot" && !useNativeShadowDom) {
827
- if (BUILD5.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
828
- newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
829
- relocateToHostRoot(newVNode2.$elm$.parentElement);
830
- }
831
- } else {
832
- updateElement(oldVNode, newVNode2, isSvgMode);
833
- }
760
+ if (BUILD5.slotRelocation && vnodeData.name) {
761
+ slotName = vnodeData.name;
834
762
  }
835
- if (BUILD5.updatable && oldChildren !== null && newChildren !== null) {
836
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
837
- } else if (newChildren !== null) {
838
- if (BUILD5.updatable && BUILD5.vdomText && oldVNode.$text$ !== null) {
839
- elm.textContent = "";
763
+ if (BUILD5.vdomClass) {
764
+ const classData = vnodeData.className || vnodeData.class;
765
+ if (classData) {
766
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
840
767
  }
841
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
842
- } else if (
843
- // don't do this on initial render as it can cause non-hydrated content to be removed
844
- !isInitialRender && BUILD5.updatable && oldChildren !== null
845
- ) {
846
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
847
- }
848
- if (BUILD5.svg && isSvgMode && tag === "svg") {
849
- isSvgMode = false;
850
768
  }
851
- } else if (BUILD5.vdomText && BUILD5.slotRelocation && (defaultHolder = elm["s-cr"])) {
852
- defaultHolder.parentNode.textContent = text;
853
- } else if (BUILD5.vdomText && oldVNode.$text$ !== text) {
854
- elm.data = text;
855
769
  }
856
- };
857
- var relocateNodes = [];
858
- var markSlotContentForRelocation = (elm) => {
859
- let node;
860
- let hostContentNodes;
861
- let j;
862
- const children = elm.__childNodes || elm.childNodes;
863
- for (const childNode of children) {
864
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
865
- hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
866
- const slotName = childNode["s-sn"];
867
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
868
- node = hostContentNodes[j];
869
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD5.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
870
- if (isNodeLocatedInSlot(node, slotName)) {
871
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
872
- checkSlotFallbackVisibility = true;
873
- node["s-sn"] = node["s-sn"] || slotName;
874
- if (relocateNodeData) {
875
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
876
- relocateNodeData.$slotRefNode$ = childNode;
877
- } else {
878
- node["s-sh"] = childNode["s-hn"];
879
- relocateNodes.push({
880
- $slotRefNode$: childNode,
881
- $nodeToRelocate$: node
882
- });
883
- }
884
- if (node["s-sr"]) {
885
- relocateNodes.map((relocateNode) => {
886
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
887
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
888
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
889
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
890
- }
891
- }
892
- });
893
- }
894
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
895
- relocateNodes.push({
896
- $nodeToRelocate$: node
897
- });
898
- }
899
- }
900
- }
901
- }
902
- if (childNode.nodeType === 1 /* ElementNode */) {
903
- markSlotContentForRelocation(childNode);
904
- }
770
+ if (BUILD5.isDev && vNodeChildren.some(isHost)) {
771
+ consoleDevError(`The <Host> must be the single root component. Make sure:
772
+ - You are NOT using hostData() and <Host> in the same component.
773
+ - <Host> is used once, and it's the single root component of the render() function.`);
905
774
  }
906
- };
907
- var nullifyVNodeRefs = (vNode) => {
908
- if (BUILD5.vdomRef) {
909
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
910
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
775
+ if (BUILD5.vdomFunctional && typeof nodeName === "function") {
776
+ return nodeName(
777
+ vnodeData === null ? {} : vnodeData,
778
+ vNodeChildren,
779
+ vdomFnUtils
780
+ );
911
781
  }
912
- };
913
- var insertBefore = (parent, newNode, reference) => {
914
- if (BUILD5.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
915
- addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
782
+ const vnode = newVNode(nodeName, null);
783
+ vnode.$attrs$ = vnodeData;
784
+ if (vNodeChildren.length > 0) {
785
+ vnode.$children$ = vNodeChildren;
786
+ }
787
+ if (BUILD5.vdomKey) {
788
+ vnode.$key$ = key;
916
789
  }
917
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
918
- return inserted;
790
+ if (BUILD5.slotRelocation) {
791
+ vnode.$name$ = slotName;
792
+ }
793
+ return vnode;
919
794
  };
920
- function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
921
- var _a;
922
- let scopeId2;
923
- if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) {
924
- const scopeName = slotNode["s-sn"];
925
- const hostName = slotNode["s-hn"];
926
- (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s");
927
- if (oldParent && oldParent.classList.contains(scopeId2 + "-s")) {
928
- let child = (oldParent.__childNodes || oldParent.childNodes)[0];
929
- let found = false;
930
- while (child) {
931
- if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
932
- found = true;
933
- break;
934
- }
935
- child = child.nextSibling;
936
- }
937
- if (!found) oldParent.classList.remove(scopeId2 + "-s");
938
- }
795
+ var newVNode = (tag, text) => {
796
+ const vnode = {
797
+ $flags$: 0,
798
+ $tag$: tag,
799
+ $text$: text,
800
+ $elm$: null,
801
+ $children$: null
802
+ };
803
+ if (BUILD5.vdomAttribute) {
804
+ vnode.$attrs$ = null;
939
805
  }
940
- }
941
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
942
- var _a, _b, _c, _d, _e;
943
- const hostElm = hostRef.$hostElement$;
944
- const cmpMeta = hostRef.$cmpMeta$;
945
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
946
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
947
- hostTagName = hostElm.tagName;
948
- if (BUILD5.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
949
- throw new Error(`The <Host> must be the single root component.
950
- Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
951
-
952
- The render() function should look like this instead:
953
-
954
- render() {
955
- // Do not return an array
956
- return (
957
- <Host>{content}</Host>
958
- );
959
- }
960
- `);
806
+ if (BUILD5.vdomKey) {
807
+ vnode.$key$ = null;
961
808
  }
962
- if (BUILD5.reflect && cmpMeta.$attrsToReflect$) {
963
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
964
- cmpMeta.$attrsToReflect$.map(
965
- ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
966
- );
809
+ if (BUILD5.slotRelocation) {
810
+ vnode.$name$ = null;
967
811
  }
968
- if (isInitialLoad && rootVnode.$attrs$) {
969
- for (const key of Object.keys(rootVnode.$attrs$)) {
970
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
971
- rootVnode.$attrs$[key] = hostElm[key];
972
- }
812
+ return vnode;
813
+ };
814
+ var Host = {};
815
+ var isHost = (node) => node && node.$tag$ === Host;
816
+ var vdomFnUtils = {
817
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
818
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
819
+ };
820
+ var convertToPublic = (node) => ({
821
+ vattrs: node.$attrs$,
822
+ vchildren: node.$children$,
823
+ vkey: node.$key$,
824
+ vname: node.$name$,
825
+ vtag: node.$tag$,
826
+ vtext: node.$text$
827
+ });
828
+ var convertToPrivate = (node) => {
829
+ if (typeof node.vtag === "function") {
830
+ const vnodeData = { ...node.vattrs };
831
+ if (node.vkey) {
832
+ vnodeData.key = node.vkey;
973
833
  }
834
+ if (node.vname) {
835
+ vnodeData.name = node.vname;
836
+ }
837
+ return h(node.vtag, vnodeData, ...node.vchildren || []);
974
838
  }
975
- rootVnode.$tag$ = null;
976
- rootVnode.$flags$ |= 4 /* isHost */;
977
- hostRef.$vnode$ = rootVnode;
978
- rootVnode.$elm$ = oldVNode.$elm$ = BUILD5.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
979
- if (BUILD5.scoped || BUILD5.shadowDom) {
980
- scopeId = hostElm["s-sc"];
839
+ const vnode = newVNode(node.vtag, node.vtext);
840
+ vnode.$attrs$ = node.vattrs;
841
+ vnode.$children$ = node.vchildren;
842
+ vnode.$key$ = node.vkey;
843
+ vnode.$name$ = node.vname;
844
+ return vnode;
845
+ };
846
+ var validateInputProperties = (inputElm) => {
847
+ const props = Object.keys(inputElm);
848
+ const value = props.indexOf("value");
849
+ if (value === -1) {
850
+ return;
981
851
  }
982
- useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
983
- if (BUILD5.slotRelocation) {
984
- contentRef = hostElm["s-cr"];
985
- checkSlotFallbackVisibility = false;
852
+ const typeIndex = props.indexOf("type");
853
+ const minIndex = props.indexOf("min");
854
+ const maxIndex = props.indexOf("max");
855
+ const stepIndex = props.indexOf("step");
856
+ if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
857
+ consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
986
858
  }
987
- patch(oldVNode, rootVnode, isInitialLoad);
988
- if (BUILD5.slotRelocation) {
989
- plt.$flags$ |= 1 /* isTmpDisconnected */;
990
- if (checkSlotRelocate) {
991
- markSlotContentForRelocation(rootVnode.$elm$);
992
- for (const relocateData of relocateNodes) {
993
- const nodeToRelocate = relocateData.$nodeToRelocate$;
994
- if (!nodeToRelocate["s-ol"]) {
995
- const orgLocationNode = BUILD5.isDebug || BUILD5.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
996
- orgLocationNode["s-nr"] = nodeToRelocate;
997
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
998
- }
859
+ };
860
+
861
+ // src/runtime/client-hydrate.ts
862
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
863
+ const endHydrate = createTime("hydrateClient", tagName);
864
+ const shadowRoot = hostElm.shadowRoot;
865
+ const childRenderNodes = [];
866
+ const slotNodes = [];
867
+ const slottedNodes = [];
868
+ const shadowRootNodes = BUILD6.shadowDom && shadowRoot ? [] : null;
869
+ const vnode = newVNode(tagName, null);
870
+ vnode.$elm$ = hostElm;
871
+ let scopeId2;
872
+ if (BUILD6.scoped) {
873
+ const cmpMeta = hostRef.$cmpMeta$;
874
+ if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
875
+ scopeId2 = hostElm["s-sc"];
876
+ hostElm.classList.add(scopeId2 + "-h");
877
+ } else if (hostElm["s-sc"]) {
878
+ delete hostElm["s-sc"];
879
+ }
880
+ }
881
+ if (!plt.$orgLocNodes$) {
882
+ initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
883
+ }
884
+ hostElm[HYDRATE_ID] = hostId;
885
+ hostElm.removeAttribute(HYDRATE_ID);
886
+ hostRef.$vnode$ = clientHydrate(
887
+ vnode,
888
+ childRenderNodes,
889
+ slotNodes,
890
+ shadowRootNodes,
891
+ hostElm,
892
+ hostElm,
893
+ hostId,
894
+ slottedNodes
895
+ );
896
+ let crIndex = 0;
897
+ const crLength = childRenderNodes.length;
898
+ let childRenderNode;
899
+ for (crIndex; crIndex < crLength; crIndex++) {
900
+ childRenderNode = childRenderNodes[crIndex];
901
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
902
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
903
+ const node = childRenderNode.$elm$;
904
+ if (!shadowRoot) {
905
+ node["s-hn"] = tagName.toUpperCase();
906
+ if (childRenderNode.$tag$ === "slot") {
907
+ node["s-cr"] = hostElm["s-cr"];
999
908
  }
1000
- for (const relocateData of relocateNodes) {
1001
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1002
- const slotRefNode = relocateData.$slotRefNode$;
1003
- if (slotRefNode) {
1004
- const parentNodeRef = slotRefNode.parentNode;
1005
- let insertBeforeNode = slotRefNode.nextSibling;
1006
- if (!BUILD5.hydrateServerSide && (!BUILD5.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
1007
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1008
- while (orgLocationNode) {
1009
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
1010
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
1011
- refNode = refNode.nextSibling;
1012
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
1013
- refNode = refNode == null ? void 0 : refNode.nextSibling;
1014
- }
1015
- if (!refNode || !refNode["s-nr"]) {
1016
- insertBeforeNode = refNode;
1017
- break;
1018
- }
1019
- }
1020
- orgLocationNode = orgLocationNode.previousSibling;
1021
- }
1022
- }
1023
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
1024
- if (nodeToRelocate !== insertBeforeNode) {
1025
- if (!BUILD5.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1026
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1027
- }
1028
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1029
- if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1030
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1031
- }
1032
- }
1033
- }
1034
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1035
- } else {
1036
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1037
- if (isInitialLoad) {
1038
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
1039
- }
1040
- nodeToRelocate.hidden = true;
1041
- }
909
+ }
910
+ if (childRenderNode.$tag$ === "slot") {
911
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
912
+ if (childRenderNode.$children$) {
913
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
914
+ if (!childRenderNode.$elm$.childNodes.length) {
915
+ childRenderNode.$children$.forEach((c) => {
916
+ childRenderNode.$elm$.appendChild(c.$elm$);
917
+ });
1042
918
  }
919
+ } else {
920
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
1043
921
  }
1044
922
  }
1045
- if (checkSlotFallbackVisibility) {
1046
- updateFallbackSlotVisibility(rootVnode.$elm$);
923
+ if (orgLocationNode && orgLocationNode.isConnected) {
924
+ if (shadowRoot && orgLocationNode["s-en"] === "") {
925
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
926
+ }
927
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
928
+ if (!shadowRoot) {
929
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
930
+ }
1047
931
  }
1048
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1049
- relocateNodes.length = 0;
932
+ plt.$orgLocNodes$.delete(orgLocationId);
1050
933
  }
1051
- if (BUILD5.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1052
- const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1053
- for (const childNode of children) {
1054
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1055
- if (isInitialLoad && childNode["s-ih"] == null) {
1056
- childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
934
+ const hosts = [];
935
+ const snLen = slottedNodes.length;
936
+ let snIndex = 0;
937
+ let slotGroup;
938
+ let snGroupIdx;
939
+ let snGroupLen;
940
+ let slottedItem;
941
+ for (snIndex; snIndex < snLen; snIndex++) {
942
+ slotGroup = slottedNodes[snIndex];
943
+ if (!slotGroup || !slotGroup.length) continue;
944
+ snGroupLen = slotGroup.length;
945
+ snGroupIdx = 0;
946
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
947
+ slottedItem = slotGroup[snGroupIdx];
948
+ if (!hosts[slottedItem.hostId]) {
949
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
950
+ }
951
+ if (!hosts[slottedItem.hostId]) continue;
952
+ const hostEle = hosts[slottedItem.hostId];
953
+ if (!hostEle.shadowRoot || !shadowRoot) {
954
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
955
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
956
+ slottedItem.slot["s-cr"] = hostEle;
957
+ } else {
958
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1057
959
  }
1058
- childNode.hidden = true;
960
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
961
+ if (BUILD6.experimentalSlotFixes) {
962
+ patchSlottedNode(slottedItem.node);
963
+ }
964
+ }
965
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
966
+ hostEle.appendChild(slottedItem.node);
1059
967
  }
1060
968
  }
1061
969
  }
1062
- contentRef = void 0;
970
+ if (BUILD6.scoped && scopeId2 && slotNodes.length) {
971
+ slotNodes.forEach((slot) => {
972
+ slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
973
+ });
974
+ }
975
+ if (BUILD6.shadowDom && shadowRoot) {
976
+ let rnIdex = 0;
977
+ const rnLen = shadowRootNodes.length;
978
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
979
+ shadowRoot.appendChild(shadowRootNodes[rnIdex]);
980
+ }
981
+ }
982
+ hostRef.$hostElement$ = hostElm;
983
+ endHydrate();
1063
984
  };
1064
- var slotReferenceDebugNode = (slotVNode) => doc.createComment(
1065
- `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
1066
- );
1067
- var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
1068
- `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
1069
- );
1070
-
1071
- // src/runtime/dom-extras.ts
1072
- var patchPseudoShadowDom = (hostElementPrototype) => {
1073
- patchCloneNode(hostElementPrototype);
1074
- patchSlotAppendChild(hostElementPrototype);
1075
- patchSlotAppend(hostElementPrototype);
1076
- patchSlotPrepend(hostElementPrototype);
1077
- patchSlotInsertAdjacentElement(hostElementPrototype);
1078
- patchSlotInsertAdjacentHTML(hostElementPrototype);
1079
- patchSlotInsertAdjacentText(hostElementPrototype);
1080
- patchTextContent(hostElementPrototype);
1081
- patchChildSlotNodes(hostElementPrototype);
1082
- patchSlotRemoveChild(hostElementPrototype);
1083
- };
1084
- var patchCloneNode = (HostElementPrototype) => {
1085
- const orgCloneNode = HostElementPrototype.cloneNode;
1086
- HostElementPrototype.cloneNode = function(deep) {
1087
- const srcNode = this;
1088
- const isShadowDom = BUILD6.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
1089
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1090
- if (BUILD6.slot && !isShadowDom && deep) {
1091
- let i2 = 0;
1092
- let slotted, nonRindoNode;
1093
- const rindoPrivates = [
1094
- "s-id",
1095
- "s-cr",
1096
- "s-lr",
1097
- "s-rc",
1098
- "s-sc",
1099
- "s-p",
1100
- "s-cn",
1101
- "s-sr",
1102
- "s-sn",
1103
- "s-hn",
1104
- "s-ol",
1105
- "s-nr",
1106
- "s-si",
1107
- "s-rf",
1108
- "s-scs"
1109
- ];
1110
- const childNodes = this.__childNodes || this.childNodes;
1111
- for (; i2 < childNodes.length; i2++) {
1112
- slotted = childNodes[i2]["s-nr"];
1113
- nonRindoNode = rindoPrivates.every((privateField) => !childNodes[i2][privateField]);
1114
- if (slotted) {
1115
- if (BUILD6.appendChildSlotFix && clonedNode.__appendChild) {
1116
- clonedNode.__appendChild(slotted.cloneNode(true));
1117
- } else {
1118
- clonedNode.appendChild(slotted.cloneNode(true));
985
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
986
+ let childNodeType;
987
+ let childIdSplt;
988
+ let childVNode;
989
+ let i2;
990
+ const scopeId2 = hostElm["s-sc"];
991
+ if (node.nodeType === 1 /* ElementNode */) {
992
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
993
+ if (childNodeType) {
994
+ childIdSplt = childNodeType.split(".");
995
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
996
+ childVNode = createSimpleVNode({
997
+ $flags$: 0,
998
+ $hostId$: childIdSplt[0],
999
+ $nodeId$: childIdSplt[1],
1000
+ $depth$: childIdSplt[2],
1001
+ $index$: childIdSplt[3],
1002
+ $tag$: node.tagName.toLowerCase(),
1003
+ $elm$: node,
1004
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
1005
+ // won't try to reconcile them. Classes set on the node will be blown away.
1006
+ $attrs$: { class: node.className || "" }
1007
+ });
1008
+ childRenderNodes.push(childVNode);
1009
+ node.removeAttribute(HYDRATE_CHILD_ID);
1010
+ if (!parentVNode.$children$) {
1011
+ parentVNode.$children$ = [];
1012
+ }
1013
+ if (BUILD6.scoped && scopeId2) {
1014
+ node["s-si"] = scopeId2;
1015
+ childVNode.$attrs$.class += " " + scopeId2;
1016
+ }
1017
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
1018
+ if (typeof slotName === "string") {
1019
+ if (childVNode.$tag$ === "slot-fb") {
1020
+ addSlot(
1021
+ slotName,
1022
+ childIdSplt[2],
1023
+ childVNode,
1024
+ node,
1025
+ parentVNode,
1026
+ childRenderNodes,
1027
+ slotNodes,
1028
+ shadowRootNodes,
1029
+ slottedNodes
1030
+ );
1031
+ if (BUILD6.scoped && scopeId2) {
1032
+ node.classList.add(scopeId2);
1033
+ }
1119
1034
  }
1035
+ childVNode.$elm$["s-sn"] = slotName;
1036
+ childVNode.$elm$.removeAttribute("s-sn");
1120
1037
  }
1121
- if (nonRindoNode) {
1122
- clonedNode.appendChild(childNodes[i2].cloneNode(true));
1038
+ if (childVNode.$index$ !== void 0) {
1039
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1040
+ }
1041
+ parentVNode = childVNode;
1042
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
1043
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1123
1044
  }
1124
1045
  }
1125
1046
  }
1126
- return clonedNode;
1127
- };
1128
- };
1129
- var patchSlotAppendChild = (HostElementPrototype) => {
1130
- HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
1131
- HostElementPrototype.appendChild = function(newChild) {
1132
- const slotName = newChild["s-sn"] = getSlotName(newChild);
1133
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
1134
- if (slotNode) {
1135
- addSlotRelocateNode(newChild, slotNode);
1136
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1137
- const appendAfter = slotChildNodes[slotChildNodes.length - 1];
1138
- const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
1139
- updateFallbackSlotVisibility(this);
1140
- return insertedNode;
1047
+ if (node.shadowRoot) {
1048
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
1049
+ clientHydrate(
1050
+ parentVNode,
1051
+ childRenderNodes,
1052
+ slotNodes,
1053
+ shadowRootNodes,
1054
+ hostElm,
1055
+ node.shadowRoot.childNodes[i2],
1056
+ hostId,
1057
+ slottedNodes
1058
+ );
1059
+ }
1141
1060
  }
1142
- return this.__appendChild(newChild);
1143
- };
1144
- };
1145
- var patchSlotRemoveChild = (ElementPrototype) => {
1146
- ElementPrototype.__removeChild = ElementPrototype.removeChild;
1147
- ElementPrototype.removeChild = function(toRemove) {
1148
- if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
1149
- const childNodes = this.__childNodes || this.childNodes;
1150
- const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
1151
- if (slotNode && toRemove.isConnected) {
1152
- toRemove.remove();
1153
- updateFallbackSlotVisibility(this);
1154
- return;
1061
+ const nonShadowNodes = node.__childNodes || node.childNodes;
1062
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
1063
+ clientHydrate(
1064
+ parentVNode,
1065
+ childRenderNodes,
1066
+ slotNodes,
1067
+ shadowRootNodes,
1068
+ hostElm,
1069
+ nonShadowNodes[i2],
1070
+ hostId,
1071
+ slottedNodes
1072
+ );
1073
+ }
1074
+ } else if (node.nodeType === 8 /* CommentNode */) {
1075
+ childIdSplt = node.nodeValue.split(".");
1076
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
1077
+ childNodeType = childIdSplt[0];
1078
+ childVNode = createSimpleVNode({
1079
+ $hostId$: childIdSplt[1],
1080
+ $nodeId$: childIdSplt[2],
1081
+ $depth$: childIdSplt[3],
1082
+ $index$: childIdSplt[4] || "0",
1083
+ $elm$: node,
1084
+ $attrs$: null,
1085
+ $children$: null,
1086
+ $key$: null,
1087
+ $name$: null,
1088
+ $tag$: null,
1089
+ $text$: null
1090
+ });
1091
+ if (childNodeType === TEXT_NODE_ID) {
1092
+ childVNode.$elm$ = node.nextSibling;
1093
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1094
+ childVNode.$text$ = childVNode.$elm$.textContent;
1095
+ childRenderNodes.push(childVNode);
1096
+ node.remove();
1097
+ if (hostId === childVNode.$hostId$) {
1098
+ if (!parentVNode.$children$) {
1099
+ parentVNode.$children$ = [];
1100
+ }
1101
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1102
+ }
1103
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
1104
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1105
+ }
1106
+ }
1107
+ } else if (childNodeType === COMMENT_NODE_ID) {
1108
+ childVNode.$elm$ = node.nextSibling;
1109
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1110
+ childRenderNodes.push(childVNode);
1111
+ node.remove();
1112
+ }
1113
+ } else if (childVNode.$hostId$ === hostId) {
1114
+ if (childNodeType === SLOT_NODE_ID) {
1115
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
1116
+ addSlot(
1117
+ slotName,
1118
+ childIdSplt[2],
1119
+ childVNode,
1120
+ node,
1121
+ parentVNode,
1122
+ childRenderNodes,
1123
+ slotNodes,
1124
+ shadowRootNodes,
1125
+ slottedNodes
1126
+ );
1127
+ } else if (childNodeType === CONTENT_REF_ID) {
1128
+ if (BUILD6.shadowDom && shadowRootNodes) {
1129
+ node.remove();
1130
+ } else if (BUILD6.slotRelocation) {
1131
+ hostElm["s-cr"] = node;
1132
+ node["s-cn"] = true;
1133
+ }
1134
+ }
1155
1135
  }
1156
1136
  }
1157
- return this.__removeChild(toRemove);
1158
- };
1137
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
1138
+ const vnode = newVNode(null, node.textContent);
1139
+ vnode.$elm$ = node;
1140
+ vnode.$index$ = "0";
1141
+ parentVNode.$children$ = [vnode];
1142
+ }
1143
+ return parentVNode;
1159
1144
  };
1160
- var patchSlotPrepend = (HostElementPrototype) => {
1161
- HostElementPrototype.__prepend = HostElementPrototype.prepend;
1162
- HostElementPrototype.prepend = function(...newChildren) {
1163
- newChildren.forEach((newChild) => {
1164
- if (typeof newChild === "string") {
1165
- newChild = this.ownerDocument.createTextNode(newChild);
1166
- }
1167
- const slotName = newChild["s-sn"] = getSlotName(newChild);
1168
- const childNodes = this.__childNodes || this.childNodes;
1169
- const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
1170
- if (slotNode) {
1171
- addSlotRelocateNode(newChild, slotNode, true);
1172
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1173
- const appendAfter = slotChildNodes[0];
1174
- return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
1175
- }
1176
- if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
1177
- newChild.hidden = true;
1145
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
1146
+ if (node.nodeType === 1 /* ElementNode */) {
1147
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1148
+ if (componentId) {
1149
+ orgLocNodes.set(componentId, node);
1150
+ }
1151
+ let i2 = 0;
1152
+ if (node.shadowRoot) {
1153
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
1154
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
1178
1155
  }
1179
- return HostElementPrototype.__prepend(newChild);
1180
- });
1181
- };
1182
- };
1183
- var patchSlotAppend = (HostElementPrototype) => {
1184
- HostElementPrototype.__append = HostElementPrototype.append;
1185
- HostElementPrototype.append = function(...newChildren) {
1186
- newChildren.forEach((newChild) => {
1187
- if (typeof newChild === "string") {
1188
- newChild = this.ownerDocument.createTextNode(newChild);
1189
- }
1190
- this.appendChild(newChild);
1191
- });
1192
- };
1193
- };
1194
- var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
1195
- const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
1196
- HostElementPrototype.insertAdjacentHTML = function(position, text) {
1197
- if (position !== "afterbegin" && position !== "beforeend") {
1198
- return originalInsertAdjacentHtml.call(this, position, text);
1199
1156
  }
1200
- const container = this.ownerDocument.createElement("_");
1201
- let node;
1202
- container.innerHTML = text;
1203
- if (position === "afterbegin") {
1204
- while (node = container.firstChild) {
1205
- this.prepend(node);
1206
- }
1207
- } else if (position === "beforeend") {
1208
- while (node = container.firstChild) {
1209
- this.append(node);
1210
- }
1157
+ const nonShadowNodes = node.__childNodes || node.childNodes;
1158
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
1159
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
1211
1160
  }
1212
- };
1161
+ } else if (node.nodeType === 8 /* CommentNode */) {
1162
+ const childIdSplt = node.nodeValue.split(".");
1163
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
1164
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
1165
+ node.nodeValue = "";
1166
+ node["s-en"] = childIdSplt[3];
1167
+ }
1168
+ }
1213
1169
  };
1214
- var patchSlotInsertAdjacentText = (HostElementPrototype) => {
1215
- HostElementPrototype.insertAdjacentText = function(position, text) {
1216
- this.insertAdjacentHTML(position, text);
1170
+ var createSimpleVNode = (vnode) => {
1171
+ const defaultVNode = {
1172
+ $flags$: 0,
1173
+ $hostId$: null,
1174
+ $nodeId$: null,
1175
+ $depth$: null,
1176
+ $index$: "0",
1177
+ $elm$: null,
1178
+ $attrs$: null,
1179
+ $children$: null,
1180
+ $key$: null,
1181
+ $name$: null,
1182
+ $tag$: null,
1183
+ $text$: null
1217
1184
  };
1185
+ return { ...defaultVNode, ...vnode };
1218
1186
  };
1219
- var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
1220
- const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
1221
- HostElementPrototype.insertAdjacentElement = function(position, element) {
1222
- if (position !== "afterbegin" && position !== "beforeend") {
1223
- return originalInsertAdjacentElement.call(this, position, element);
1187
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
1188
+ node["s-sr"] = true;
1189
+ childVNode.$name$ = slotName || null;
1190
+ childVNode.$tag$ = "slot";
1191
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1192
+ if (BUILD6.shadowDom && shadowRootNodes) {
1193
+ const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1194
+ if (childVNode.$name$) {
1195
+ childVNode.$elm$.setAttribute("name", slotName);
1224
1196
  }
1225
- if (position === "afterbegin") {
1226
- this.prepend(element);
1227
- return element;
1228
- } else if (position === "beforeend") {
1229
- this.append(element);
1230
- return element;
1197
+ if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1198
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1199
+ } else {
1200
+ node.parentNode.insertBefore(childVNode.$elm$, node);
1231
1201
  }
1232
- return element;
1233
- };
1234
- };
1235
- var patchTextContent = (hostElementPrototype) => {
1236
- patchHostOriginalAccessor("textContent", hostElementPrototype);
1237
- Object.defineProperty(hostElementPrototype, "textContent", {
1238
- get: function() {
1239
- let text = "";
1240
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
1241
- childNodes.forEach((node) => text += node.textContent || "");
1242
- return text;
1243
- },
1244
- set: function(value) {
1245
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
1246
- childNodes.forEach((node) => {
1247
- if (node["s-ol"]) node["s-ol"].remove();
1248
- node.remove();
1249
- });
1250
- this.insertAdjacentHTML("beforeend", value);
1202
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1203
+ node.remove();
1204
+ if (childVNode.$depth$ === "0") {
1205
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1251
1206
  }
1252
- });
1253
- };
1254
- var patchChildSlotNodes = (elm) => {
1255
- class FakeNodeList extends Array {
1256
- item(n) {
1257
- return this[n];
1207
+ } else {
1208
+ const slot = childVNode.$elm$;
1209
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1210
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1211
+ if (shouldMove) {
1212
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1258
1213
  }
1214
+ childRenderNodes.push(childVNode);
1259
1215
  }
1260
- patchHostOriginalAccessor("children", elm);
1261
- Object.defineProperty(elm, "children", {
1262
- get() {
1263
- return this.childNodes.filter((n) => n.nodeType === 1);
1264
- }
1265
- });
1266
- Object.defineProperty(elm, "childElementCount", {
1267
- get() {
1268
- return this.children.length;
1269
- }
1270
- });
1271
- patchHostOriginalAccessor("firstChild", elm);
1272
- Object.defineProperty(elm, "firstChild", {
1273
- get() {
1274
- return this.childNodes[0];
1216
+ slotNodes.push(childVNode);
1217
+ if (!parentVNode.$children$) {
1218
+ parentVNode.$children$ = [];
1219
+ }
1220
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1221
+ }
1222
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1223
+ let slottedNode = slotNode.nextSibling;
1224
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1225
+ while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
1226
+ slottedNode["s-sn"] = slotName;
1227
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1228
+ slottedNode = slottedNode.nextSibling;
1229
+ }
1230
+ };
1231
+
1232
+ // src/runtime/initialize-component.ts
1233
+ import { BUILD as BUILD17 } from "@rindo/core/internal/app-data";
1234
+
1235
+ // src/runtime/mode.ts
1236
+ var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
1237
+ var setMode = (handler) => modeResolutionChain.push(handler);
1238
+ var getMode = (ref) => getHostRef(ref).$modeName$;
1239
+
1240
+ // src/runtime/proxy-component.ts
1241
+ import { BUILD as BUILD16 } from "@rindo/core/internal/app-data";
1242
+
1243
+ // src/runtime/set-value.ts
1244
+ import { BUILD as BUILD15 } from "@rindo/core/internal/app-data";
1245
+
1246
+ // src/runtime/parse-property-value.ts
1247
+ import { BUILD as BUILD7 } from "@rindo/core/internal/app-data";
1248
+ var parsePropertyValue = (propValue, propType) => {
1249
+ if (propValue != null && !isComplexType(propValue)) {
1250
+ if (BUILD7.propBoolean && propType & 4 /* Boolean */) {
1251
+ return propValue === "false" ? false : propValue === "" || !!propValue;
1275
1252
  }
1276
- });
1277
- patchHostOriginalAccessor("lastChild", elm);
1278
- Object.defineProperty(elm, "lastChild", {
1279
- get() {
1280
- return this.childNodes[this.childNodes.length - 1];
1253
+ if (BUILD7.propNumber && propType & 2 /* Number */) {
1254
+ return parseFloat(propValue);
1281
1255
  }
1282
- });
1283
- patchHostOriginalAccessor("childNodes", elm);
1284
- Object.defineProperty(elm, "childNodes", {
1285
- get() {
1286
- var _a, _b;
1287
- if (!plt.$flags$ || !((_a = getHostRef(this)) == null ? void 0 : _a.$flags$) || (plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && ((_b = getHostRef(this)) == null ? void 0 : _b.$flags$) & 2 /* hasRendered */) {
1288
- const result = new FakeNodeList();
1289
- const nodes = getSlottedChildNodes(this.__childNodes);
1290
- result.push(...nodes);
1291
- return result;
1292
- }
1293
- return FakeNodeList.from(this.__childNodes);
1256
+ if (BUILD7.propString && propType & 1 /* String */) {
1257
+ return String(propValue);
1294
1258
  }
1295
- });
1296
- };
1297
- var patchNextPrev = (node) => {
1298
- if (!node || node.__nextSibling || !globalThis.Node) return;
1299
- patchNextSibling(node);
1300
- patchPreviousSibling(node);
1301
- if (node.nodeType === Node.ELEMENT_NODE) {
1302
- patchNextElementSibling(node);
1303
- patchPreviousElementSibling(node);
1259
+ return propValue;
1304
1260
  }
1261
+ return propValue;
1305
1262
  };
1306
- var patchNextSibling = (node) => {
1307
- if (!node || node.__nextSibling) return;
1308
- patchHostOriginalAccessor("nextSibling", node);
1309
- Object.defineProperty(node, "nextSibling", {
1310
- get: function() {
1311
- var _a;
1312
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
1313
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1314
- if (parentNodes && index > -1) {
1315
- return parentNodes[index + 1];
1263
+
1264
+ // src/runtime/update-component.ts
1265
+ import { BUILD as BUILD14, NAMESPACE } from "@rindo/core/internal/app-data";
1266
+
1267
+ // src/runtime/event-emitter.ts
1268
+ import { BUILD as BUILD9 } from "@rindo/core/internal/app-data";
1269
+
1270
+ // src/runtime/element.ts
1271
+ import { BUILD as BUILD8 } from "@rindo/core/internal/app-data";
1272
+ var getElement = (ref) => BUILD8.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
1273
+
1274
+ // src/runtime/event-emitter.ts
1275
+ var createEvent = (ref, name, flags) => {
1276
+ const elm = getElement(ref);
1277
+ return {
1278
+ emit: (detail) => {
1279
+ if (BUILD9.isDev && !elm.isConnected) {
1280
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1316
1281
  }
1317
- return this.__nextSibling;
1282
+ return emitEvent(elm, name, {
1283
+ bubbles: !!(flags & 4 /* Bubbles */),
1284
+ composed: !!(flags & 2 /* Composed */),
1285
+ cancelable: !!(flags & 1 /* Cancellable */),
1286
+ detail
1287
+ });
1318
1288
  }
1319
- });
1289
+ };
1320
1290
  };
1321
- var patchNextElementSibling = (element) => {
1322
- if (!element || element.__nextElementSibling) return;
1323
- patchHostOriginalAccessor("nextElementSibling", element);
1324
- Object.defineProperty(element, "nextElementSibling", {
1325
- get: function() {
1326
- var _a;
1327
- const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
1328
- const index = parentEles == null ? void 0 : parentEles.indexOf(this);
1329
- if (parentEles && index > -1) {
1330
- return parentEles[index + 1];
1331
- }
1332
- return this.__nextElementSibling;
1333
- }
1334
- });
1291
+ var emitEvent = (elm, name, opts) => {
1292
+ const ev = plt.ce(name, opts);
1293
+ elm.dispatchEvent(ev);
1294
+ return ev;
1335
1295
  };
1336
- var patchPreviousSibling = (node) => {
1337
- if (!node || node.__previousSibling) return;
1338
- patchHostOriginalAccessor("previousSibling", node);
1339
- Object.defineProperty(node, "previousSibling", {
1340
- get: function() {
1341
- var _a;
1342
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
1343
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1344
- if (parentNodes && index > -1) {
1345
- return parentNodes[index - 1];
1346
- }
1347
- return this.__previousSibling;
1296
+
1297
+ // src/runtime/styles.ts
1298
+ import { BUILD as BUILD10 } from "@rindo/core/internal/app-data";
1299
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1300
+ var registerStyle = (scopeId2, cssText, allowCS) => {
1301
+ let style = styles.get(scopeId2);
1302
+ if (supportsConstructableStylesheets && allowCS) {
1303
+ style = style || new CSSStyleSheet();
1304
+ if (typeof style === "string") {
1305
+ style = cssText;
1306
+ } else {
1307
+ style.replaceSync(cssText);
1348
1308
  }
1349
- });
1309
+ } else {
1310
+ style = cssText;
1311
+ }
1312
+ styles.set(scopeId2, style);
1350
1313
  };
1351
- var patchPreviousElementSibling = (element) => {
1352
- if (!element || element.__previousElementSibling) return;
1353
- patchHostOriginalAccessor("previousElementSibling", element);
1354
- Object.defineProperty(element, "previousElementSibling", {
1355
- get: function() {
1356
- var _a;
1357
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
1358
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1359
- if (parentNodes && index > -1) {
1360
- return parentNodes[index - 1];
1314
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1315
+ var _a;
1316
+ const scopeId2 = getScopeId(cmpMeta, mode);
1317
+ const style = styles.get(scopeId2);
1318
+ if (!BUILD10.attachStyles) {
1319
+ return scopeId2;
1320
+ }
1321
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
1322
+ if (style) {
1323
+ if (typeof style === "string") {
1324
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1325
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1326
+ let styleElm;
1327
+ if (!appliedStyles) {
1328
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1361
1329
  }
1362
- return this.__previousElementSibling;
1330
+ if (!appliedStyles.has(scopeId2)) {
1331
+ if (BUILD10.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1332
+ styleElm.innerHTML = style;
1333
+ } else {
1334
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
1335
+ styleElm.innerHTML = style;
1336
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1337
+ if (nonce != null) {
1338
+ styleElm.setAttribute("nonce", nonce);
1339
+ }
1340
+ if ((BUILD10.hydrateServerSide || BUILD10.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1341
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1342
+ }
1343
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1344
+ if (styleContainerNode.nodeName === "HEAD") {
1345
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1346
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1347
+ styleContainerNode.insertBefore(
1348
+ styleElm,
1349
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1350
+ );
1351
+ } else if ("host" in styleContainerNode) {
1352
+ if (supportsConstructableStylesheets) {
1353
+ const stylesheet = new CSSStyleSheet();
1354
+ stylesheet.replaceSync(style);
1355
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1356
+ } else {
1357
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1358
+ if (existingStyleContainer) {
1359
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1360
+ } else {
1361
+ styleContainerNode.prepend(styleElm);
1362
+ }
1363
+ }
1364
+ } else {
1365
+ styleContainerNode.append(styleElm);
1366
+ }
1367
+ }
1368
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
1369
+ styleContainerNode.insertBefore(styleElm, null);
1370
+ }
1371
+ }
1372
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1373
+ styleElm.innerHTML += SLOT_FB_CSS;
1374
+ }
1375
+ if (appliedStyles) {
1376
+ appliedStyles.add(scopeId2);
1377
+ }
1378
+ }
1379
+ } else if (BUILD10.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1380
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1363
1381
  }
1364
- });
1365
- };
1366
- var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
1367
- var validNodesPatches = [
1368
- "childNodes",
1369
- "firstChild",
1370
- "lastChild",
1371
- "nextSibling",
1372
- "previousSibling",
1373
- "textContent"
1374
- ];
1375
- function patchHostOriginalAccessor(accessorName, node) {
1376
- let accessor;
1377
- if (validElementPatches.includes(accessorName)) {
1378
- accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
1379
- } else if (validNodesPatches.includes(accessorName)) {
1380
- accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
1381
- }
1382
- if (!accessor) {
1383
- accessor = Object.getOwnPropertyDescriptor(node, accessorName);
1384
1382
  }
1385
- if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
1386
- }
1387
-
1388
- // src/runtime/profile.ts
1389
- import { BUILD as BUILD7 } from "@rindo/core/internal/app-data";
1390
- var i = 0;
1391
- var createTime = (fnName, tagName = "") => {
1392
- if (BUILD7.profile && performance.mark) {
1393
- const key = `st:${fnName}:${tagName}:${i++}`;
1394
- performance.mark(key);
1395
- return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
1396
- } else {
1397
- return () => {
1398
- return;
1399
- };
1383
+ return scopeId2;
1384
+ };
1385
+ var attachStyles = (hostRef) => {
1386
+ const cmpMeta = hostRef.$cmpMeta$;
1387
+ const elm = hostRef.$hostElement$;
1388
+ const flags = cmpMeta.$flags$;
1389
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1390
+ const scopeId2 = addStyle(
1391
+ BUILD10.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1392
+ cmpMeta,
1393
+ hostRef.$modeName$
1394
+ );
1395
+ if ((BUILD10.shadowDom || BUILD10.scoped) && BUILD10.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
1396
+ elm["s-sc"] = scopeId2;
1397
+ elm.classList.add(scopeId2 + "-h");
1400
1398
  }
1399
+ endAttachStyles();
1401
1400
  };
1402
- var uniqueTime = (key, measureText) => {
1403
- if (BUILD7.profile && performance.mark) {
1404
- if (performance.getEntriesByName(key, "mark").length === 0) {
1405
- performance.mark(key);
1406
- }
1407
- return () => {
1408
- if (performance.getEntriesByName(measureText, "measure").length === 0) {
1409
- performance.measure(measureText, key);
1401
+ var getScopeId = (cmp, mode) => "sc-" + (BUILD10.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1402
+
1403
+ // src/runtime/vdom/vdom-render.ts
1404
+ import { BUILD as BUILD13 } from "@rindo/core/internal/app-data";
1405
+
1406
+ // src/runtime/vdom/update-element.ts
1407
+ import { BUILD as BUILD12 } from "@rindo/core/internal/app-data";
1408
+
1409
+ // src/runtime/vdom/set-accessor.ts
1410
+ import { BUILD as BUILD11 } from "@rindo/core/internal/app-data";
1411
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
1412
+ if (oldValue !== newValue) {
1413
+ let isProp = isMemberInElement(elm, memberName);
1414
+ let ln = memberName.toLowerCase();
1415
+ if (BUILD11.vdomClass && memberName === "class") {
1416
+ const classList = elm.classList;
1417
+ const oldClasses = parseClassList(oldValue);
1418
+ let newClasses = parseClassList(newValue);
1419
+ if (BUILD11.hydrateClientSide && elm["s-si"] && initialRender) {
1420
+ newClasses.push(elm["s-si"]);
1421
+ oldClasses.forEach((c) => {
1422
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
1423
+ });
1424
+ newClasses = [...new Set(newClasses)];
1425
+ classList.add(...newClasses);
1426
+ } else {
1427
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1428
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
1429
+ }
1430
+ } else if (BUILD11.vdomStyle && memberName === "style") {
1431
+ if (BUILD11.updatable) {
1432
+ for (const prop in oldValue) {
1433
+ if (!newValue || newValue[prop] == null) {
1434
+ if (!BUILD11.hydrateServerSide && prop.includes("-")) {
1435
+ elm.style.removeProperty(prop);
1436
+ } else {
1437
+ elm.style[prop] = "";
1438
+ }
1439
+ }
1440
+ }
1441
+ }
1442
+ for (const prop in newValue) {
1443
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
1444
+ if (!BUILD11.hydrateServerSide && prop.includes("-")) {
1445
+ elm.style.setProperty(prop, newValue[prop]);
1446
+ } else {
1447
+ elm.style[prop] = newValue[prop];
1448
+ }
1449
+ }
1450
+ }
1451
+ } else if (BUILD11.vdomKey && memberName === "key") {
1452
+ } else if (BUILD11.vdomRef && memberName === "ref") {
1453
+ if (newValue) {
1454
+ newValue(elm);
1455
+ }
1456
+ } else if (BUILD11.vdomListener && (BUILD11.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
1457
+ if (memberName[2] === "-") {
1458
+ memberName = memberName.slice(3);
1459
+ } else if (isMemberInElement(win, ln)) {
1460
+ memberName = ln.slice(2);
1461
+ } else {
1462
+ memberName = ln[2] + memberName.slice(3);
1463
+ }
1464
+ if (oldValue || newValue) {
1465
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1466
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
1467
+ if (oldValue) {
1468
+ plt.rel(elm, memberName, oldValue, capture);
1469
+ }
1470
+ if (newValue) {
1471
+ plt.ael(elm, memberName, newValue, capture);
1472
+ }
1473
+ }
1474
+ } else if (BUILD11.vdomPropOrAttr) {
1475
+ const isComplex = isComplexType(newValue);
1476
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
1477
+ try {
1478
+ if (!elm.tagName.includes("-")) {
1479
+ const n = newValue == null ? "" : newValue;
1480
+ if (memberName === "list") {
1481
+ isProp = false;
1482
+ } else if (oldValue == null || elm[memberName] != n) {
1483
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
1484
+ elm[memberName] = n;
1485
+ } else {
1486
+ elm.setAttribute(memberName, n);
1487
+ }
1488
+ }
1489
+ } else if (elm[memberName] !== newValue) {
1490
+ elm[memberName] = newValue;
1491
+ }
1492
+ } catch (e) {
1493
+ }
1494
+ }
1495
+ let xlink = false;
1496
+ if (BUILD11.vdomXlink) {
1497
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1498
+ memberName = ln;
1499
+ xlink = true;
1500
+ }
1501
+ }
1502
+ if (newValue == null || newValue === false) {
1503
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
1504
+ if (BUILD11.vdomXlink && xlink) {
1505
+ elm.removeAttributeNS(XLINK_NS, memberName);
1506
+ } else {
1507
+ elm.removeAttribute(memberName);
1508
+ }
1509
+ }
1510
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1511
+ newValue = newValue === true ? "" : newValue;
1512
+ if (BUILD11.vdomXlink && xlink) {
1513
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
1514
+ } else {
1515
+ elm.setAttribute(memberName, newValue);
1516
+ }
1410
1517
  }
1411
- };
1412
- } else {
1413
- return () => {
1414
- return;
1415
- };
1518
+ }
1416
1519
  }
1417
1520
  };
1418
- var inspect = (ref) => {
1419
- const hostRef = getHostRef(ref);
1420
- if (!hostRef) {
1421
- return void 0;
1521
+ var parseClassListRegex = /\s/;
1522
+ var parseClassList = (value) => {
1523
+ if (typeof value === "object" && value && "baseVal" in value) {
1524
+ value = value.baseVal;
1422
1525
  }
1423
- const flags = hostRef.$flags$;
1424
- const hostElement = hostRef.$hostElement$;
1425
- return {
1426
- renderCount: hostRef.$renderCount$,
1427
- flags: {
1428
- hasRendered: !!(flags & 2 /* hasRendered */),
1429
- hasConnected: !!(flags & 1 /* hasConnected */),
1430
- isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
1431
- isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
1432
- isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
1433
- hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
1434
- hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
1435
- isWatchReady: !!(flags & 128 /* isWatchReady */),
1436
- isListenReady: !!(flags & 256 /* isListenReady */),
1437
- needsRerender: !!(flags & 512 /* needsRerender */)
1438
- },
1439
- instanceValues: hostRef.$instanceValues$,
1440
- ancestorComponent: hostRef.$ancestorComponent$,
1441
- hostElement,
1442
- lazyInstance: hostRef.$lazyInstance$,
1443
- vnode: hostRef.$vnode$,
1444
- modeName: hostRef.$modeName$,
1445
- onReadyPromise: hostRef.$onReadyPromise$,
1446
- onReadyResolve: hostRef.$onReadyResolve$,
1447
- onInstancePromise: hostRef.$onInstancePromise$,
1448
- onInstanceResolve: hostRef.$onInstanceResolve$,
1449
- onRenderResolve: hostRef.$onRenderResolve$,
1450
- queuedListeners: hostRef.$queuedListeners$,
1451
- rmListeners: hostRef.$rmListeners$,
1452
- ["s-id"]: hostElement["s-id"],
1453
- ["s-cr"]: hostElement["s-cr"],
1454
- ["s-lr"]: hostElement["s-lr"],
1455
- ["s-p"]: hostElement["s-p"],
1456
- ["s-rc"]: hostElement["s-rc"],
1457
- ["s-sc"]: hostElement["s-sc"]
1458
- };
1526
+ if (!value || typeof value !== "string") {
1527
+ return [];
1528
+ }
1529
+ return value.split(parseClassListRegex);
1459
1530
  };
1460
- var installDevTools = () => {
1461
- if (BUILD7.devTools) {
1462
- const rindo = win.rindo = win.rindo || {};
1463
- const originalInspect = rindo.inspect;
1464
- rindo.inspect = (ref) => {
1465
- let result = inspect(ref);
1466
- if (!result && typeof originalInspect === "function") {
1467
- result = originalInspect(ref);
1531
+ var CAPTURE_EVENT_SUFFIX = "Capture";
1532
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
1533
+
1534
+ // src/runtime/vdom/update-element.ts
1535
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
1536
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
1537
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
1538
+ const newVnodeAttrs = newVnode.$attrs$ || {};
1539
+ if (BUILD12.updatable) {
1540
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
1541
+ if (!(memberName in newVnodeAttrs)) {
1542
+ setAccessor(
1543
+ elm,
1544
+ memberName,
1545
+ oldVnodeAttrs[memberName],
1546
+ void 0,
1547
+ isSvgMode2,
1548
+ newVnode.$flags$,
1549
+ isInitialRender
1550
+ );
1468
1551
  }
1469
- return result;
1470
- };
1552
+ }
1553
+ }
1554
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
1555
+ setAccessor(
1556
+ elm,
1557
+ memberName,
1558
+ oldVnodeAttrs[memberName],
1559
+ newVnodeAttrs[memberName],
1560
+ isSvgMode2,
1561
+ newVnode.$flags$,
1562
+ isInitialRender
1563
+ );
1471
1564
  }
1472
1565
  };
1566
+ function sortedAttrNames(attrNames) {
1567
+ return attrNames.includes("ref") ? (
1568
+ // we need to sort these to ensure that `'ref'` is the last attr
1569
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
1570
+ ) : (
1571
+ // no need to sort, return the original array
1572
+ attrNames
1573
+ );
1574
+ }
1473
1575
 
1474
- // src/runtime/client-hydrate.ts
1475
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1476
- const endHydrate = createTime("hydrateClient", tagName);
1477
- const shadowRoot = hostElm.shadowRoot;
1478
- const childRenderNodes = [];
1479
- const slotNodes = [];
1480
- const slottedNodes = [];
1481
- const shadowRootNodes = BUILD8.shadowDom && shadowRoot ? [] : null;
1482
- const vnode = newVNode(tagName, null);
1483
- vnode.$elm$ = hostElm;
1484
- let scopeId2;
1485
- if (BUILD8.scoped) {
1486
- const cmpMeta = hostRef.$cmpMeta$;
1487
- if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1488
- scopeId2 = hostElm["s-sc"];
1489
- hostElm.classList.add(scopeId2 + "-h");
1490
- } else if (hostElm["s-sc"]) {
1491
- delete hostElm["s-sc"];
1576
+ // src/runtime/vdom/vdom-render.ts
1577
+ var scopeId;
1578
+ var contentRef;
1579
+ var hostTagName;
1580
+ var useNativeShadowDom = false;
1581
+ var checkSlotFallbackVisibility = false;
1582
+ var checkSlotRelocate = false;
1583
+ var isSvgMode = false;
1584
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1585
+ var _a;
1586
+ const newVNode2 = newParentVNode.$children$[childIndex];
1587
+ let i2 = 0;
1588
+ let elm;
1589
+ let childNode;
1590
+ let oldVNode;
1591
+ if (BUILD13.slotRelocation && !useNativeShadowDom) {
1592
+ checkSlotRelocate = true;
1593
+ if (newVNode2.$tag$ === "slot") {
1594
+ newVNode2.$flags$ |= newVNode2.$children$ ? (
1595
+ // slot element has fallback content
1596
+ // still create an element that "mocks" the slot element
1597
+ 2 /* isSlotFallback */
1598
+ ) : (
1599
+ // slot element does not have fallback content
1600
+ // create an html comment we'll use to always reference
1601
+ // where actual slot content should sit next to
1602
+ 1 /* isSlotReference */
1603
+ );
1492
1604
  }
1493
1605
  }
1494
- if (!plt.$orgLocNodes$) {
1495
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1606
+ if (BUILD13.isDev && newVNode2.$elm$) {
1607
+ consoleDevError(
1608
+ `The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`
1609
+ );
1496
1610
  }
1497
- hostElm[HYDRATE_ID] = hostId;
1498
- hostElm.removeAttribute(HYDRATE_ID);
1499
- hostRef.$vnode$ = clientHydrate(
1500
- vnode,
1501
- childRenderNodes,
1502
- slotNodes,
1503
- shadowRootNodes,
1504
- hostElm,
1505
- hostElm,
1506
- hostId,
1507
- slottedNodes
1508
- );
1509
- let crIndex = 0;
1510
- const crLength = childRenderNodes.length;
1511
- let childRenderNode;
1512
- for (crIndex; crIndex < crLength; crIndex++) {
1513
- childRenderNode = childRenderNodes[crIndex];
1514
- const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
1515
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1516
- const node = childRenderNode.$elm$;
1517
- if (!shadowRoot) {
1518
- node["s-hn"] = tagName.toUpperCase();
1519
- if (childRenderNode.$tag$ === "slot") {
1520
- node["s-cr"] = hostElm["s-cr"];
1521
- }
1611
+ if (BUILD13.vdomText && newVNode2.$text$ !== null) {
1612
+ elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1613
+ } else if (BUILD13.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
1614
+ elm = newVNode2.$elm$ = BUILD13.isDebug || BUILD13.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
1615
+ } else {
1616
+ if (BUILD13.svg && !isSvgMode) {
1617
+ isSvgMode = newVNode2.$tag$ === "svg";
1522
1618
  }
1523
- if (childRenderNode.$tag$ === "slot") {
1524
- if (childRenderNode.$children$) {
1525
- childRenderNode.$flags$ |= 2 /* isSlotFallback */;
1526
- if (!childRenderNode.$elm$.childNodes.length) {
1527
- childRenderNode.$children$.forEach((c) => {
1528
- childRenderNode.$elm$.appendChild(c.$elm$);
1529
- });
1619
+ elm = newVNode2.$elm$ = BUILD13.svg ? doc.createElementNS(
1620
+ isSvgMode ? SVG_NS : HTML_NS,
1621
+ !useNativeShadowDom && BUILD13.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1622
+ ) : doc.createElement(
1623
+ !useNativeShadowDom && BUILD13.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1624
+ );
1625
+ if (BUILD13.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
1626
+ isSvgMode = false;
1627
+ }
1628
+ if (BUILD13.vdomAttribute) {
1629
+ updateElement(null, newVNode2, isSvgMode);
1630
+ }
1631
+ if (BUILD13.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
1632
+ elm.classList.add(elm["s-si"] = scopeId);
1633
+ }
1634
+ if (newVNode2.$children$) {
1635
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
1636
+ childNode = createElm(oldParentVNode, newVNode2, i2);
1637
+ if (childNode) {
1638
+ elm.appendChild(childNode);
1530
1639
  }
1531
- } else {
1532
- childRenderNode.$flags$ |= 1 /* isSlotReference */;
1533
1640
  }
1534
1641
  }
1535
- if (orgLocationNode && orgLocationNode.isConnected) {
1536
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1537
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1538
- }
1539
- orgLocationNode.parentNode.removeChild(orgLocationNode);
1540
- if (!shadowRoot) {
1541
- node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1642
+ if (BUILD13.svg) {
1643
+ if (newVNode2.$tag$ === "svg") {
1644
+ isSvgMode = false;
1645
+ } else if (elm.tagName === "foreignObject") {
1646
+ isSvgMode = true;
1542
1647
  }
1543
1648
  }
1544
- plt.$orgLocNodes$.delete(orgLocationId);
1545
1649
  }
1546
- const hosts = [];
1547
- const snLen = slottedNodes.length;
1548
- let snIndex = 0;
1549
- let slotGroup;
1550
- let snGroupIdx;
1551
- let snGroupLen;
1552
- let slottedItem;
1553
- for (snIndex; snIndex < snLen; snIndex++) {
1554
- slotGroup = slottedNodes[snIndex];
1555
- if (!slotGroup || !slotGroup.length) continue;
1556
- snGroupLen = slotGroup.length;
1557
- snGroupIdx = 0;
1558
- for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1559
- slottedItem = slotGroup[snGroupIdx];
1560
- if (!hosts[slottedItem.hostId]) {
1561
- hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1562
- }
1563
- if (!hosts[slottedItem.hostId]) continue;
1564
- const hostEle = hosts[slottedItem.hostId];
1565
- if (!hostEle.shadowRoot || !shadowRoot) {
1566
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1567
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1568
- slottedItem.slot["s-cr"] = hostEle;
1650
+ elm["s-hn"] = hostTagName;
1651
+ if (BUILD13.slotRelocation) {
1652
+ if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
1653
+ elm["s-sr"] = true;
1654
+ elm["s-cr"] = contentRef;
1655
+ elm["s-sn"] = newVNode2.$name$ || "";
1656
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
1657
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1658
+ if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
1659
+ if (BUILD13.experimentalSlotFixes) {
1660
+ relocateToHostRoot(oldParentVNode.$elm$);
1569
1661
  } else {
1570
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1571
- }
1572
- addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1573
- if (BUILD8.experimentalSlotFixes) {
1574
- patchNextPrev(slottedItem.node);
1662
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
1575
1663
  }
1576
1664
  }
1577
- if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1578
- hostEle.appendChild(slottedItem.node);
1665
+ if (BUILD13.scoped) {
1666
+ addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
1667
+ }
1668
+ }
1669
+ }
1670
+ return elm;
1671
+ };
1672
+ var relocateToHostRoot = (parentElm) => {
1673
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1674
+ const host = parentElm.closest(hostTagName.toLowerCase());
1675
+ if (host != null) {
1676
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
1677
+ (ref) => ref["s-cr"]
1678
+ );
1679
+ const childNodeArray = Array.from(
1680
+ parentElm.__childNodes || parentElm.childNodes
1681
+ );
1682
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
1683
+ if (childNode["s-sh"] != null) {
1684
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
1685
+ childNode["s-sh"] = void 0;
1686
+ checkSlotRelocate = true;
1579
1687
  }
1580
1688
  }
1581
1689
  }
1582
- if (BUILD8.scoped && scopeId2 && slotNodes.length) {
1583
- slotNodes.forEach((slot) => {
1584
- slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1585
- });
1690
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1691
+ };
1692
+ var putBackInOriginalLocation = (parentElm, recursive) => {
1693
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1694
+ const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
1695
+ if (parentElm["s-sr"] && BUILD13.experimentalSlotFixes) {
1696
+ let node = parentElm;
1697
+ while (node = node.nextSibling) {
1698
+ if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
1699
+ oldSlotChildNodes.push(node);
1700
+ }
1701
+ }
1586
1702
  }
1587
- if (BUILD8.shadowDom && shadowRoot) {
1588
- let rnIdex = 0;
1589
- const rnLen = shadowRootNodes.length;
1590
- for (rnIdex; rnIdex < rnLen; rnIdex++) {
1591
- shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1703
+ for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
1704
+ const childNode = oldSlotChildNodes[i2];
1705
+ if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
1706
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
1707
+ childNode["s-ol"].remove();
1708
+ childNode["s-ol"] = void 0;
1709
+ childNode["s-sh"] = void 0;
1710
+ checkSlotRelocate = true;
1711
+ }
1712
+ if (recursive) {
1713
+ putBackInOriginalLocation(childNode, recursive);
1592
1714
  }
1593
- Array.from(hostElm.childNodes).forEach((node) => {
1594
- if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
1595
- node.parentNode.removeChild(node);
1715
+ }
1716
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1717
+ };
1718
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1719
+ let containerElm = BUILD13.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
1720
+ let childNode;
1721
+ if (BUILD13.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1722
+ containerElm = containerElm.shadowRoot;
1723
+ }
1724
+ for (; startIdx <= endIdx; ++startIdx) {
1725
+ if (vnodes[startIdx]) {
1726
+ childNode = createElm(null, parentVNode, startIdx);
1727
+ if (childNode) {
1728
+ vnodes[startIdx].$elm$ = childNode;
1729
+ insertBefore(containerElm, childNode, BUILD13.slotRelocation ? referenceNode(before) : before);
1596
1730
  }
1597
- });
1731
+ }
1598
1732
  }
1599
- hostRef.$hostElement$ = hostElm;
1600
- endHydrate();
1601
1733
  };
1602
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1603
- let childNodeType;
1604
- let childIdSplt;
1605
- let childVNode;
1606
- let i2;
1607
- const scopeId2 = hostElm["s-sc"];
1608
- if (node.nodeType === 1 /* ElementNode */) {
1609
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1610
- if (childNodeType) {
1611
- childIdSplt = childNodeType.split(".");
1612
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
1613
- childVNode = createSimpleVNode({
1614
- $flags$: 0,
1615
- $hostId$: childIdSplt[0],
1616
- $nodeId$: childIdSplt[1],
1617
- $depth$: childIdSplt[2],
1618
- $index$: childIdSplt[3],
1619
- $tag$: node.tagName.toLowerCase(),
1620
- $elm$: node,
1621
- // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
1622
- // won't try to reconcile them. Classes set on the node will be blown away.
1623
- $attrs$: { class: node.className || "" }
1624
- });
1625
- childRenderNodes.push(childVNode);
1626
- node.removeAttribute(HYDRATE_CHILD_ID);
1627
- if (!parentVNode.$children$) {
1628
- parentVNode.$children$ = [];
1629
- }
1630
- if (BUILD8.scoped && scopeId2) {
1631
- node["s-si"] = scopeId2;
1632
- childVNode.$attrs$.class += " " + scopeId2;
1633
- }
1634
- const slotName = childVNode.$elm$.getAttribute("s-sn");
1635
- if (typeof slotName === "string") {
1636
- if (childVNode.$tag$ === "slot-fb") {
1637
- addSlot(
1638
- slotName,
1639
- childIdSplt[2],
1640
- childVNode,
1641
- node,
1642
- parentVNode,
1643
- childRenderNodes,
1644
- slotNodes,
1645
- shadowRootNodes,
1646
- slottedNodes
1647
- );
1648
- if (BUILD8.scoped && scopeId2) {
1649
- node.classList.add(scopeId2);
1650
- }
1734
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
1735
+ for (let index = startIdx; index <= endIdx; ++index) {
1736
+ const vnode = vnodes[index];
1737
+ if (vnode) {
1738
+ const elm = vnode.$elm$;
1739
+ nullifyVNodeRefs(vnode);
1740
+ if (elm) {
1741
+ if (BUILD13.slotRelocation) {
1742
+ checkSlotFallbackVisibility = true;
1743
+ if (elm["s-ol"]) {
1744
+ elm["s-ol"].remove();
1745
+ } else {
1746
+ putBackInOriginalLocation(elm, true);
1651
1747
  }
1652
- childVNode.$elm$["s-sn"] = slotName;
1653
- childVNode.$elm$.removeAttribute("s-sn");
1654
- }
1655
- if (childVNode.$index$ !== void 0) {
1656
- parentVNode.$children$[childVNode.$index$] = childVNode;
1657
- }
1658
- parentVNode = childVNode;
1659
- if (shadowRootNodes && childVNode.$depth$ === "0") {
1660
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1661
1748
  }
1749
+ elm.remove();
1662
1750
  }
1663
1751
  }
1664
- if (node.shadowRoot) {
1665
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
1666
- clientHydrate(
1667
- parentVNode,
1668
- childRenderNodes,
1669
- slotNodes,
1670
- shadowRootNodes,
1671
- hostElm,
1672
- node.shadowRoot.childNodes[i2],
1673
- hostId,
1674
- slottedNodes
1675
- );
1752
+ }
1753
+ };
1754
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
1755
+ let oldStartIdx = 0;
1756
+ let newStartIdx = 0;
1757
+ let idxInOld = 0;
1758
+ let i2 = 0;
1759
+ let oldEndIdx = oldCh.length - 1;
1760
+ let oldStartVnode = oldCh[0];
1761
+ let oldEndVnode = oldCh[oldEndIdx];
1762
+ let newEndIdx = newCh.length - 1;
1763
+ let newStartVnode = newCh[0];
1764
+ let newEndVnode = newCh[newEndIdx];
1765
+ let node;
1766
+ let elmToMove;
1767
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1768
+ if (oldStartVnode == null) {
1769
+ oldStartVnode = oldCh[++oldStartIdx];
1770
+ } else if (oldEndVnode == null) {
1771
+ oldEndVnode = oldCh[--oldEndIdx];
1772
+ } else if (newStartVnode == null) {
1773
+ newStartVnode = newCh[++newStartIdx];
1774
+ } else if (newEndVnode == null) {
1775
+ newEndVnode = newCh[--newEndIdx];
1776
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1777
+ patch(oldStartVnode, newStartVnode, isInitialRender);
1778
+ oldStartVnode = oldCh[++oldStartIdx];
1779
+ newStartVnode = newCh[++newStartIdx];
1780
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1781
+ patch(oldEndVnode, newEndVnode, isInitialRender);
1782
+ oldEndVnode = oldCh[--oldEndIdx];
1783
+ newEndVnode = newCh[--newEndIdx];
1784
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1785
+ if (BUILD13.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1786
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1676
1787
  }
1677
- }
1678
- const nonShadowNodes = node.__childNodes || node.childNodes;
1679
- for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
1680
- clientHydrate(
1681
- parentVNode,
1682
- childRenderNodes,
1683
- slotNodes,
1684
- shadowRootNodes,
1685
- hostElm,
1686
- nonShadowNodes[i2],
1687
- hostId,
1688
- slottedNodes
1689
- );
1690
- }
1691
- } else if (node.nodeType === 8 /* CommentNode */) {
1692
- childIdSplt = node.nodeValue.split(".");
1693
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
1694
- childNodeType = childIdSplt[0];
1695
- childVNode = createSimpleVNode({
1696
- $hostId$: childIdSplt[1],
1697
- $nodeId$: childIdSplt[2],
1698
- $depth$: childIdSplt[3],
1699
- $index$: childIdSplt[4] || "0",
1700
- $elm$: node,
1701
- $attrs$: null,
1702
- $children$: null,
1703
- $key$: null,
1704
- $name$: null,
1705
- $tag$: null,
1706
- $text$: null
1707
- });
1708
- if (childNodeType === TEXT_NODE_ID) {
1709
- childVNode.$elm$ = node.nextSibling;
1710
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1711
- childVNode.$text$ = childVNode.$elm$.textContent;
1712
- childRenderNodes.push(childVNode);
1713
- node.remove();
1714
- if (hostId === childVNode.$hostId$) {
1715
- if (!parentVNode.$children$) {
1716
- parentVNode.$children$ = [];
1717
- }
1718
- parentVNode.$children$[childVNode.$index$] = childVNode;
1719
- }
1720
- if (shadowRootNodes && childVNode.$depth$ === "0") {
1721
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1788
+ patch(oldStartVnode, newEndVnode, isInitialRender);
1789
+ insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1790
+ oldStartVnode = oldCh[++oldStartIdx];
1791
+ newEndVnode = newCh[--newEndIdx];
1792
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1793
+ if (BUILD13.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1794
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1795
+ }
1796
+ patch(oldEndVnode, newStartVnode, isInitialRender);
1797
+ insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1798
+ oldEndVnode = oldCh[--oldEndIdx];
1799
+ newStartVnode = newCh[++newStartIdx];
1800
+ } else {
1801
+ idxInOld = -1;
1802
+ if (BUILD13.vdomKey) {
1803
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1804
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1805
+ idxInOld = i2;
1806
+ break;
1722
1807
  }
1723
1808
  }
1724
- } else if (childNodeType === COMMENT_NODE_ID) {
1725
- childVNode.$elm$ = node.nextSibling;
1726
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1727
- childRenderNodes.push(childVNode);
1728
- node.remove();
1809
+ }
1810
+ if (BUILD13.vdomKey && idxInOld >= 0) {
1811
+ elmToMove = oldCh[idxInOld];
1812
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1813
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1814
+ } else {
1815
+ patch(elmToMove, newStartVnode, isInitialRender);
1816
+ oldCh[idxInOld] = void 0;
1817
+ node = elmToMove.$elm$;
1729
1818
  }
1730
- } else if (childVNode.$hostId$ === hostId) {
1731
- if (childNodeType === SLOT_NODE_ID) {
1732
- const slotName = node["s-sn"] = childIdSplt[5] || "";
1733
- addSlot(
1734
- slotName,
1735
- childIdSplt[2],
1736
- childVNode,
1819
+ newStartVnode = newCh[++newStartIdx];
1820
+ } else {
1821
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1822
+ newStartVnode = newCh[++newStartIdx];
1823
+ }
1824
+ if (node) {
1825
+ if (BUILD13.slotRelocation) {
1826
+ insertBefore(
1827
+ referenceNode(oldStartVnode.$elm$).parentNode,
1737
1828
  node,
1738
- parentVNode,
1739
- childRenderNodes,
1740
- slotNodes,
1741
- shadowRootNodes,
1742
- slottedNodes
1829
+ referenceNode(oldStartVnode.$elm$)
1743
1830
  );
1744
- } else if (childNodeType === CONTENT_REF_ID) {
1745
- if (BUILD8.shadowDom && shadowRootNodes) {
1746
- node.remove();
1747
- } else if (BUILD8.slotRelocation) {
1748
- hostElm["s-cr"] = node;
1749
- node["s-cn"] = true;
1750
- }
1831
+ } else {
1832
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1751
1833
  }
1752
1834
  }
1753
1835
  }
1754
- } else if (parentVNode && parentVNode.$tag$ === "style") {
1755
- const vnode = newVNode(null, node.textContent);
1756
- vnode.$elm$ = node;
1757
- vnode.$index$ = "0";
1758
- parentVNode.$children$ = [vnode];
1759
1836
  }
1760
- return parentVNode;
1837
+ if (oldStartIdx > oldEndIdx) {
1838
+ addVnodes(
1839
+ parentElm,
1840
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
1841
+ newVNode2,
1842
+ newCh,
1843
+ newStartIdx,
1844
+ newEndIdx
1845
+ );
1846
+ } else if (BUILD13.updatable && newStartIdx > newEndIdx) {
1847
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1848
+ }
1761
1849
  };
1762
- var initializeDocumentHydrate = (node, orgLocNodes) => {
1763
- if (node.nodeType === 1 /* ElementNode */) {
1764
- const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1765
- if (componentId) {
1766
- orgLocNodes.set(componentId, node);
1767
- }
1768
- let i2 = 0;
1769
- if (node.shadowRoot) {
1770
- for (; i2 < node.shadowRoot.childNodes.length; i2++) {
1771
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
1772
- }
1850
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1851
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1852
+ if (BUILD13.slotRelocation && leftVNode.$tag$ === "slot") {
1853
+ return leftVNode.$name$ === rightVNode.$name$;
1773
1854
  }
1774
- const nonShadowNodes = node.__childNodes || node.childNodes;
1775
- for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
1776
- initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
1855
+ if (BUILD13.vdomKey && !isInitialRender) {
1856
+ return leftVNode.$key$ === rightVNode.$key$;
1777
1857
  }
1778
- } else if (node.nodeType === 8 /* CommentNode */) {
1779
- const childIdSplt = node.nodeValue.split(".");
1780
- if (childIdSplt[0] === ORG_LOCATION_ID) {
1781
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
1782
- node.nodeValue = "";
1783
- node["s-en"] = childIdSplt[3];
1858
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1859
+ leftVNode.$key$ = rightVNode.$key$;
1784
1860
  }
1861
+ return true;
1785
1862
  }
1863
+ return false;
1786
1864
  };
1787
- var createSimpleVNode = (vnode) => {
1788
- const defaultVNode = {
1789
- $flags$: 0,
1790
- $hostId$: null,
1791
- $nodeId$: null,
1792
- $depth$: null,
1793
- $index$: "0",
1794
- $elm$: null,
1795
- $attrs$: null,
1796
- $children$: null,
1797
- $key$: null,
1798
- $name$: null,
1799
- $tag$: null,
1800
- $text$: null
1801
- };
1802
- return { ...defaultVNode, ...vnode };
1803
- };
1804
- function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
1805
- node["s-sr"] = true;
1806
- childVNode.$name$ = slotName || null;
1807
- childVNode.$tag$ = "slot";
1808
- const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1809
- if (BUILD8.shadowDom && shadowRootNodes) {
1810
- const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1811
- if (childVNode.$name$) {
1812
- childVNode.$elm$.setAttribute("name", slotName);
1865
+ var referenceNode = (node) => node && node["s-ol"] || node;
1866
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1867
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
1868
+ const oldChildren = oldVNode.$children$;
1869
+ const newChildren = newVNode2.$children$;
1870
+ const tag = newVNode2.$tag$;
1871
+ const text = newVNode2.$text$;
1872
+ let defaultHolder;
1873
+ if (!BUILD13.vdomText || text === null) {
1874
+ if (BUILD13.svg) {
1875
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1813
1876
  }
1814
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1815
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1816
- } else {
1817
- node.parentNode.insertBefore(childVNode.$elm$, node);
1877
+ if (BUILD13.vdomAttribute || BUILD13.reflect) {
1878
+ if (BUILD13.slot && tag === "slot" && !useNativeShadowDom) {
1879
+ if (BUILD13.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
1880
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1881
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
1882
+ }
1883
+ } else {
1884
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
1885
+ }
1818
1886
  }
1819
- addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1820
- node.remove();
1821
- if (childVNode.$depth$ === "0") {
1822
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1887
+ if (BUILD13.updatable && oldChildren !== null && newChildren !== null) {
1888
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1889
+ } else if (newChildren !== null) {
1890
+ if (BUILD13.updatable && BUILD13.vdomText && oldVNode.$text$ !== null) {
1891
+ elm.textContent = "";
1892
+ }
1893
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1894
+ } else if (
1895
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1896
+ !isInitialRender && BUILD13.updatable && oldChildren !== null
1897
+ ) {
1898
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1823
1899
  }
1824
- } else {
1825
- const slot = childVNode.$elm$;
1826
- const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1827
- addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1828
- if (shouldMove) {
1829
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1900
+ if (BUILD13.svg && isSvgMode && tag === "svg") {
1901
+ isSvgMode = false;
1830
1902
  }
1831
- childRenderNodes.push(childVNode);
1832
- }
1833
- slotNodes.push(childVNode);
1834
- if (!parentVNode.$children$) {
1835
- parentVNode.$children$ = [];
1836
- }
1837
- parentVNode.$children$[childVNode.$index$] = childVNode;
1838
- }
1839
- var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1840
- let slottedNode = slotNode.nextSibling;
1841
- slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1842
- while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
1843
- slottedNode["s-sn"] = slotName;
1844
- slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1845
- slottedNode = slottedNode.nextSibling;
1903
+ } else if (BUILD13.vdomText && BUILD13.slotRelocation && (defaultHolder = elm["s-cr"])) {
1904
+ defaultHolder.parentNode.textContent = text;
1905
+ } else if (BUILD13.vdomText && oldVNode.$text$ !== text) {
1906
+ elm.data = text;
1846
1907
  }
1847
1908
  };
1848
-
1849
- // src/runtime/initialize-component.ts
1850
- import { BUILD as BUILD16 } from "@rindo/core/internal/app-data";
1851
-
1852
- // src/runtime/mode.ts
1853
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
1854
- var setMode = (handler) => modeResolutionChain.push(handler);
1855
- var getMode = (ref) => getHostRef(ref).$modeName$;
1856
-
1857
- // src/runtime/proxy-component.ts
1858
- import { BUILD as BUILD15 } from "@rindo/core/internal/app-data";
1859
-
1860
- // src/runtime/set-value.ts
1861
- import { BUILD as BUILD14 } from "@rindo/core/internal/app-data";
1862
-
1863
- // src/runtime/parse-property-value.ts
1864
- import { BUILD as BUILD9 } from "@rindo/core/internal/app-data";
1865
- var parsePropertyValue = (propValue, propType) => {
1866
- if (propValue != null && !isComplexType(propValue)) {
1867
- if (BUILD9.propBoolean && propType & 4 /* Boolean */) {
1868
- return propValue === "false" ? false : propValue === "" || !!propValue;
1869
- }
1870
- if (BUILD9.propNumber && propType & 2 /* Number */) {
1871
- return parseFloat(propValue);
1909
+ var relocateNodes = [];
1910
+ var markSlotContentForRelocation = (elm) => {
1911
+ let node;
1912
+ let hostContentNodes;
1913
+ let j;
1914
+ const children = elm.__childNodes || elm.childNodes;
1915
+ for (const childNode of children) {
1916
+ if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
1917
+ hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
1918
+ const slotName = childNode["s-sn"];
1919
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1920
+ node = hostContentNodes[j];
1921
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD13.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1922
+ if (isNodeLocatedInSlot(node, slotName)) {
1923
+ let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1924
+ checkSlotFallbackVisibility = true;
1925
+ node["s-sn"] = node["s-sn"] || slotName;
1926
+ if (relocateNodeData) {
1927
+ relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
1928
+ relocateNodeData.$slotRefNode$ = childNode;
1929
+ } else {
1930
+ node["s-sh"] = childNode["s-hn"];
1931
+ relocateNodes.push({
1932
+ $slotRefNode$: childNode,
1933
+ $nodeToRelocate$: node
1934
+ });
1935
+ }
1936
+ if (node["s-sr"]) {
1937
+ relocateNodes.map((relocateNode) => {
1938
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
1939
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1940
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1941
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1942
+ }
1943
+ }
1944
+ });
1945
+ }
1946
+ } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1947
+ relocateNodes.push({
1948
+ $nodeToRelocate$: node
1949
+ });
1950
+ }
1951
+ }
1952
+ }
1872
1953
  }
1873
- if (BUILD9.propString && propType & 1 /* String */) {
1874
- return String(propValue);
1954
+ if (childNode.nodeType === 1 /* ElementNode */) {
1955
+ markSlotContentForRelocation(childNode);
1875
1956
  }
1876
- return propValue;
1877
1957
  }
1878
- return propValue;
1879
1958
  };
1880
-
1881
- // src/runtime/update-component.ts
1882
- import { BUILD as BUILD13, NAMESPACE } from "@rindo/core/internal/app-data";
1883
-
1884
- // src/runtime/event-emitter.ts
1885
- import { BUILD as BUILD11 } from "@rindo/core/internal/app-data";
1886
-
1887
- // src/runtime/element.ts
1888
- import { BUILD as BUILD10 } from "@rindo/core/internal/app-data";
1889
- var getElement = (ref) => BUILD10.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
1890
-
1891
- // src/runtime/event-emitter.ts
1892
- var createEvent = (ref, name, flags) => {
1893
- const elm = getElement(ref);
1894
- return {
1895
- emit: (detail) => {
1896
- if (BUILD11.isDev && !elm.isConnected) {
1897
- consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1898
- }
1899
- return emitEvent(elm, name, {
1900
- bubbles: !!(flags & 4 /* Bubbles */),
1901
- composed: !!(flags & 2 /* Composed */),
1902
- cancelable: !!(flags & 1 /* Cancellable */),
1903
- detail
1904
- });
1905
- }
1906
- };
1959
+ var nullifyVNodeRefs = (vNode) => {
1960
+ if (BUILD13.vdomRef) {
1961
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1962
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1963
+ }
1907
1964
  };
1908
- var emitEvent = (elm, name, opts) => {
1909
- const ev = plt.ce(name, opts);
1910
- elm.dispatchEvent(ev);
1911
- return ev;
1965
+ var insertBefore = (parent, newNode, reference) => {
1966
+ if (BUILD13.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
1967
+ addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
1968
+ } else if (BUILD13.experimentalSlotFixes && typeof newNode["s-sn"] === "string") {
1969
+ if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
1970
+ patchParentNode(newNode);
1971
+ }
1972
+ return parent.insertBefore(newNode, reference);
1973
+ }
1974
+ if (BUILD13.experimentalSlotFixes && parent.__insertBefore) {
1975
+ return parent.__insertBefore(newNode, reference);
1976
+ } else {
1977
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1978
+ }
1912
1979
  };
1980
+ function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
1981
+ var _a, _b;
1982
+ let scopeId2;
1983
+ if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) {
1984
+ const scopeName = slotNode["s-sn"];
1985
+ const hostName = slotNode["s-hn"];
1986
+ (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s");
1987
+ if (oldParent && ((_b = oldParent.classList) == null ? void 0 : _b.contains(scopeId2 + "-s"))) {
1988
+ let child = (oldParent.__childNodes || oldParent.childNodes)[0];
1989
+ let found = false;
1990
+ while (child) {
1991
+ if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
1992
+ found = true;
1993
+ break;
1994
+ }
1995
+ child = child.nextSibling;
1996
+ }
1997
+ if (!found) oldParent.classList.remove(scopeId2 + "-s");
1998
+ }
1999
+ }
2000
+ }
2001
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
2002
+ var _a, _b, _c, _d, _e;
2003
+ const hostElm = hostRef.$hostElement$;
2004
+ const cmpMeta = hostRef.$cmpMeta$;
2005
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
2006
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
2007
+ hostTagName = hostElm.tagName;
2008
+ if (BUILD13.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
2009
+ throw new Error(`The <Host> must be the single root component.
2010
+ Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1913
2011
 
1914
- // src/runtime/styles.ts
1915
- import { BUILD as BUILD12 } from "@rindo/core/internal/app-data";
1916
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1917
- var registerStyle = (scopeId2, cssText, allowCS) => {
1918
- let style = styles.get(scopeId2);
1919
- if (supportsConstructableStylesheets && allowCS) {
1920
- style = style || new CSSStyleSheet();
1921
- if (typeof style === "string") {
1922
- style = cssText;
1923
- } else {
1924
- style.replaceSync(cssText);
2012
+ The render() function should look like this instead:
2013
+
2014
+ render() {
2015
+ // Do not return an array
2016
+ return (
2017
+ <Host>{content}</Host>
2018
+ );
2019
+ }
2020
+ `);
2021
+ }
2022
+ if (BUILD13.reflect && cmpMeta.$attrsToReflect$) {
2023
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
2024
+ cmpMeta.$attrsToReflect$.map(
2025
+ ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
2026
+ );
2027
+ }
2028
+ if (isInitialLoad && rootVnode.$attrs$) {
2029
+ for (const key of Object.keys(rootVnode.$attrs$)) {
2030
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
2031
+ rootVnode.$attrs$[key] = hostElm[key];
2032
+ }
1925
2033
  }
1926
- } else {
1927
- style = cssText;
1928
2034
  }
1929
- styles.set(scopeId2, style);
1930
- };
1931
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
1932
- var _a;
1933
- const scopeId2 = getScopeId(cmpMeta, mode);
1934
- const style = styles.get(scopeId2);
1935
- if (!BUILD12.attachStyles) {
1936
- return scopeId2;
2035
+ rootVnode.$tag$ = null;
2036
+ rootVnode.$flags$ |= 4 /* isHost */;
2037
+ hostRef.$vnode$ = rootVnode;
2038
+ rootVnode.$elm$ = oldVNode.$elm$ = BUILD13.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
2039
+ if (BUILD13.scoped || BUILD13.shadowDom) {
2040
+ scopeId = hostElm["s-sc"];
1937
2041
  }
1938
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
1939
- if (style) {
1940
- if (typeof style === "string") {
1941
- styleContainerNode = styleContainerNode.head || styleContainerNode;
1942
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1943
- let styleElm;
1944
- if (!appliedStyles) {
1945
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2042
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
2043
+ if (BUILD13.slotRelocation) {
2044
+ contentRef = hostElm["s-cr"];
2045
+ checkSlotFallbackVisibility = false;
2046
+ }
2047
+ patch(oldVNode, rootVnode, isInitialLoad);
2048
+ if (BUILD13.slotRelocation) {
2049
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
2050
+ if (checkSlotRelocate) {
2051
+ markSlotContentForRelocation(rootVnode.$elm$);
2052
+ for (const relocateData of relocateNodes) {
2053
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
2054
+ if (!nodeToRelocate["s-ol"]) {
2055
+ const orgLocationNode = BUILD13.isDebug || BUILD13.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
2056
+ orgLocationNode["s-nr"] = nodeToRelocate;
2057
+ insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
2058
+ }
1946
2059
  }
1947
- if (!appliedStyles.has(scopeId2)) {
1948
- if (BUILD12.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1949
- styleElm.innerHTML = style;
1950
- } else {
1951
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
1952
- styleElm.innerHTML = style;
1953
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1954
- if (nonce != null) {
1955
- styleElm.setAttribute("nonce", nonce);
1956
- }
1957
- if ((BUILD12.hydrateServerSide || BUILD12.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1958
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1959
- }
1960
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1961
- if (styleContainerNode.nodeName === "HEAD") {
1962
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1963
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1964
- styleContainerNode.insertBefore(styleElm, referenceNode2);
1965
- } else if ("host" in styleContainerNode) {
1966
- if (supportsConstructableStylesheets) {
1967
- const stylesheet = new CSSStyleSheet();
1968
- stylesheet.replaceSync(style);
1969
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1970
- } else {
1971
- const existingStyleContainer = styleContainerNode.querySelector("style");
1972
- if (existingStyleContainer) {
1973
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1974
- } else {
1975
- styleContainerNode.prepend(styleElm);
2060
+ for (const relocateData of relocateNodes) {
2061
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
2062
+ const slotRefNode = relocateData.$slotRefNode$;
2063
+ if (slotRefNode) {
2064
+ const parentNodeRef = slotRefNode.parentNode;
2065
+ let insertBeforeNode = slotRefNode.nextSibling;
2066
+ if (!BUILD13.hydrateServerSide && (!BUILD13.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
2067
+ let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
2068
+ while (orgLocationNode) {
2069
+ let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
2070
+ if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
2071
+ refNode = refNode.nextSibling;
2072
+ while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
2073
+ refNode = refNode == null ? void 0 : refNode.nextSibling;
2074
+ }
2075
+ if (!refNode || !refNode["s-nr"]) {
2076
+ insertBeforeNode = refNode;
2077
+ break;
1976
2078
  }
1977
2079
  }
1978
- } else {
1979
- styleContainerNode.append(styleElm);
2080
+ orgLocationNode = orgLocationNode.previousSibling;
1980
2081
  }
1981
2082
  }
1982
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
1983
- styleContainerNode.insertBefore(styleElm, null);
2083
+ const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
2084
+ const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
2085
+ if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
2086
+ if (nodeToRelocate !== insertBeforeNode) {
2087
+ if (!BUILD13.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
2088
+ nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
2089
+ }
2090
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
2091
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
2092
+ nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
2093
+ }
2094
+ }
2095
+ }
2096
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2097
+ } else {
2098
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2099
+ if (isInitialLoad) {
2100
+ nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
2101
+ }
2102
+ nodeToRelocate.hidden = true;
1984
2103
  }
1985
- }
1986
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1987
- styleElm.innerHTML += SLOT_FB_CSS;
1988
- }
1989
- if (appliedStyles) {
1990
- appliedStyles.add(scopeId2);
1991
2104
  }
1992
2105
  }
1993
- } else if (BUILD12.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1994
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1995
2106
  }
2107
+ if (checkSlotFallbackVisibility) {
2108
+ updateFallbackSlotVisibility(rootVnode.$elm$);
2109
+ }
2110
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
2111
+ relocateNodes.length = 0;
1996
2112
  }
1997
- return scopeId2;
1998
- };
1999
- var attachStyles = (hostRef) => {
2000
- const cmpMeta = hostRef.$cmpMeta$;
2001
- const elm = hostRef.$hostElement$;
2002
- const flags = cmpMeta.$flags$;
2003
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2004
- const scopeId2 = addStyle(
2005
- BUILD12.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2006
- cmpMeta,
2007
- hostRef.$modeName$
2008
- );
2009
- if ((BUILD12.shadowDom || BUILD12.scoped) && BUILD12.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
2010
- elm["s-sc"] = scopeId2;
2011
- elm.classList.add(scopeId2 + "-h");
2113
+ if (BUILD13.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2114
+ const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
2115
+ for (const childNode of children) {
2116
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
2117
+ if (isInitialLoad && childNode["s-ih"] == null) {
2118
+ childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
2119
+ }
2120
+ childNode.hidden = true;
2121
+ }
2122
+ }
2012
2123
  }
2013
- endAttachStyles();
2124
+ contentRef = void 0;
2014
2125
  };
2015
- var getScopeId = (cmp, mode) => "sc-" + (BUILD12.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2126
+ var slotReferenceDebugNode = (slotVNode) => doc.createComment(
2127
+ `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
2128
+ );
2129
+ var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
2130
+ `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
2131
+ );
2016
2132
 
2017
2133
  // src/runtime/update-component.ts
2018
2134
  var attachToAncestor = (hostRef, ancestorComponent) => {
2019
- if (BUILD13.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2020
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
2135
+ if (BUILD14.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2136
+ const index = ancestorComponent["s-p"].push(
2137
+ new Promise(
2138
+ (r) => hostRef.$onRenderResolve$ = () => {
2139
+ ancestorComponent["s-p"].splice(index - 1, 1);
2140
+ r();
2141
+ }
2142
+ )
2143
+ );
2021
2144
  }
2022
2145
  };
2023
2146
  var scheduleUpdate = (hostRef, isInitialLoad) => {
2024
- if (BUILD13.taskQueue && BUILD13.updatable) {
2147
+ if (BUILD14.taskQueue && BUILD14.updatable) {
2025
2148
  hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
2026
2149
  }
2027
- if (BUILD13.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
2150
+ if (BUILD14.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
2028
2151
  hostRef.$flags$ |= 512 /* needsRerender */;
2029
2152
  return;
2030
2153
  }
2031
2154
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2032
2155
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2033
- return BUILD13.taskQueue ? writeTask(dispatch) : dispatch();
2156
+ return BUILD14.taskQueue ? writeTask(dispatch) : dispatch();
2034
2157
  };
2035
2158
  var dispatchHooks = (hostRef, isInitialLoad) => {
2036
2159
  const elm = hostRef.$hostElement$;
2037
2160
  const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
2038
- const instance = BUILD13.lazyLoad ? hostRef.$lazyInstance$ : elm;
2161
+ const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
2039
2162
  if (!instance) {
2040
2163
  throw new Error(
2041
2164
  `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Rindo runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://rindojs.web.app/docs/custom-elements#externalruntime`
@@ -2043,26 +2166,26 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2043
2166
  }
2044
2167
  let maybePromise;
2045
2168
  if (isInitialLoad) {
2046
- if (BUILD13.lazyLoad && BUILD13.hostListener) {
2169
+ if (BUILD14.lazyLoad && BUILD14.hostListener) {
2047
2170
  hostRef.$flags$ |= 256 /* isListenReady */;
2048
2171
  if (hostRef.$queuedListeners$) {
2049
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
2172
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
2050
2173
  hostRef.$queuedListeners$ = void 0;
2051
2174
  }
2052
2175
  }
2053
2176
  emitLifecycleEvent(elm, "componentWillLoad");
2054
- if (BUILD13.cmpWillLoad) {
2055
- maybePromise = safeCall(instance, "componentWillLoad");
2177
+ if (BUILD14.cmpWillLoad) {
2178
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2056
2179
  }
2057
2180
  } else {
2058
2181
  emitLifecycleEvent(elm, "componentWillUpdate");
2059
- if (BUILD13.cmpWillUpdate) {
2060
- maybePromise = safeCall(instance, "componentWillUpdate");
2182
+ if (BUILD14.cmpWillUpdate) {
2183
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2061
2184
  }
2062
2185
  }
2063
2186
  emitLifecycleEvent(elm, "componentWillRender");
2064
- if (BUILD13.cmpWillRender) {
2065
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender"));
2187
+ if (BUILD14.cmpWillRender) {
2188
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
2066
2189
  }
2067
2190
  endSchedule();
2068
2191
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
@@ -2077,23 +2200,23 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
2077
2200
  const elm = hostRef.$hostElement$;
2078
2201
  const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
2079
2202
  const rc = elm["s-rc"];
2080
- if (BUILD13.style && isInitialLoad) {
2203
+ if (BUILD14.style && isInitialLoad) {
2081
2204
  attachStyles(hostRef);
2082
2205
  }
2083
2206
  const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
2084
- if (BUILD13.isDev) {
2207
+ if (BUILD14.isDev) {
2085
2208
  hostRef.$flags$ |= 1024 /* devOnRender */;
2086
2209
  }
2087
- if (BUILD13.hydrateServerSide) {
2210
+ if (BUILD14.hydrateServerSide) {
2088
2211
  await callRender(hostRef, instance, elm, isInitialLoad);
2089
2212
  } else {
2090
2213
  callRender(hostRef, instance, elm, isInitialLoad);
2091
2214
  }
2092
- if (BUILD13.isDev) {
2215
+ if (BUILD14.isDev) {
2093
2216
  hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
2094
2217
  hostRef.$flags$ &= ~1024 /* devOnRender */;
2095
2218
  }
2096
- if (BUILD13.hydrateServerSide) {
2219
+ if (BUILD14.hydrateServerSide) {
2097
2220
  try {
2098
2221
  serverSideConnected(elm);
2099
2222
  if (isInitialLoad) {
@@ -2107,13 +2230,13 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
2107
2230
  consoleError(e, elm);
2108
2231
  }
2109
2232
  }
2110
- if (BUILD13.asyncLoading && rc) {
2233
+ if (BUILD14.asyncLoading && rc) {
2111
2234
  rc.map((cb) => cb());
2112
2235
  elm["s-rc"] = void 0;
2113
2236
  }
2114
2237
  endRender();
2115
2238
  endUpdate();
2116
- if (BUILD13.asyncLoading) {
2239
+ if (BUILD14.asyncLoading) {
2117
2240
  const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
2118
2241
  const postUpdate = () => postUpdateComponent(hostRef);
2119
2242
  if (childrenPromises.length === 0) {
@@ -2129,10 +2252,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
2129
2252
  };
2130
2253
  var renderingRef = null;
2131
2254
  var callRender = (hostRef, instance, elm, isInitialLoad) => {
2132
- const allRenderFn = BUILD13.allRenderFn ? true : false;
2133
- const lazyLoad = BUILD13.lazyLoad ? true : false;
2134
- const taskQueue = BUILD13.taskQueue ? true : false;
2135
- const updatable = BUILD13.updatable ? true : false;
2255
+ const allRenderFn = BUILD14.allRenderFn ? true : false;
2256
+ const lazyLoad = BUILD14.lazyLoad ? true : false;
2257
+ const taskQueue = BUILD14.taskQueue ? true : false;
2258
+ const updatable = BUILD14.updatable ? true : false;
2136
2259
  try {
2137
2260
  renderingRef = instance;
2138
2261
  instance = allRenderFn ? instance.render() : instance.render && instance.render();
@@ -2142,9 +2265,9 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
2142
2265
  if (updatable || lazyLoad) {
2143
2266
  hostRef.$flags$ |= 2 /* hasRendered */;
2144
2267
  }
2145
- if (BUILD13.hasRenderFn || BUILD13.reflect) {
2146
- if (BUILD13.vdomRender || BUILD13.reflect) {
2147
- if (BUILD13.hydrateServerSide) {
2268
+ if (BUILD14.hasRenderFn || BUILD14.reflect) {
2269
+ if (BUILD14.vdomRender || BUILD14.reflect) {
2270
+ if (BUILD14.hydrateServerSide) {
2148
2271
  return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
2149
2272
  } else {
2150
2273
  renderVdom(hostRef, instance, isInitialLoad);
@@ -2169,57 +2292,57 @@ var postUpdateComponent = (hostRef) => {
2169
2292
  const tagName = hostRef.$cmpMeta$.$tagName$;
2170
2293
  const elm = hostRef.$hostElement$;
2171
2294
  const endPostUpdate = createTime("postUpdate", tagName);
2172
- const instance = BUILD13.lazyLoad ? hostRef.$lazyInstance$ : elm;
2295
+ const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
2173
2296
  const ancestorComponent = hostRef.$ancestorComponent$;
2174
- if (BUILD13.cmpDidRender) {
2175
- if (BUILD13.isDev) {
2297
+ if (BUILD14.cmpDidRender) {
2298
+ if (BUILD14.isDev) {
2176
2299
  hostRef.$flags$ |= 1024 /* devOnRender */;
2177
2300
  }
2178
- safeCall(instance, "componentDidRender");
2179
- if (BUILD13.isDev) {
2301
+ safeCall(instance, "componentDidRender", void 0, elm);
2302
+ if (BUILD14.isDev) {
2180
2303
  hostRef.$flags$ &= ~1024 /* devOnRender */;
2181
2304
  }
2182
2305
  }
2183
2306
  emitLifecycleEvent(elm, "componentDidRender");
2184
2307
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
2185
2308
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
2186
- if (BUILD13.asyncLoading && BUILD13.cssAnnotations) {
2309
+ if (BUILD14.asyncLoading && BUILD14.cssAnnotations) {
2187
2310
  addHydratedFlag(elm);
2188
2311
  }
2189
- if (BUILD13.cmpDidLoad) {
2190
- if (BUILD13.isDev) {
2312
+ if (BUILD14.cmpDidLoad) {
2313
+ if (BUILD14.isDev) {
2191
2314
  hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2192
2315
  }
2193
- safeCall(instance, "componentDidLoad");
2194
- if (BUILD13.isDev) {
2316
+ safeCall(instance, "componentDidLoad", void 0, elm);
2317
+ if (BUILD14.isDev) {
2195
2318
  hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2196
2319
  }
2197
2320
  }
2198
2321
  emitLifecycleEvent(elm, "componentDidLoad");
2199
2322
  endPostUpdate();
2200
- if (BUILD13.asyncLoading) {
2323
+ if (BUILD14.asyncLoading) {
2201
2324
  hostRef.$onReadyResolve$(elm);
2202
2325
  if (!ancestorComponent) {
2203
2326
  appDidLoad(tagName);
2204
2327
  }
2205
2328
  }
2206
2329
  } else {
2207
- if (BUILD13.cmpDidUpdate) {
2208
- if (BUILD13.isDev) {
2330
+ if (BUILD14.cmpDidUpdate) {
2331
+ if (BUILD14.isDev) {
2209
2332
  hostRef.$flags$ |= 1024 /* devOnRender */;
2210
2333
  }
2211
- safeCall(instance, "componentDidUpdate");
2212
- if (BUILD13.isDev) {
2334
+ safeCall(instance, "componentDidUpdate", void 0, elm);
2335
+ if (BUILD14.isDev) {
2213
2336
  hostRef.$flags$ &= ~1024 /* devOnRender */;
2214
2337
  }
2215
2338
  }
2216
2339
  emitLifecycleEvent(elm, "componentDidUpdate");
2217
2340
  endPostUpdate();
2218
2341
  }
2219
- if (BUILD13.method && BUILD13.lazyLoad) {
2342
+ if (BUILD14.method && BUILD14.lazyLoad) {
2220
2343
  hostRef.$onInstanceResolve$(elm);
2221
2344
  }
2222
- if (BUILD13.asyncLoading) {
2345
+ if (BUILD14.asyncLoading) {
2223
2346
  if (hostRef.$onRenderResolve$) {
2224
2347
  hostRef.$onRenderResolve$();
2225
2348
  hostRef.$onRenderResolve$ = void 0;
@@ -2231,7 +2354,7 @@ var postUpdateComponent = (hostRef) => {
2231
2354
  }
2232
2355
  };
2233
2356
  var forceUpdate = (ref) => {
2234
- if (BUILD13.updatable && (Build.isBrowser || Build.isTesting)) {
2357
+ if (BUILD14.updatable && (Build.isBrowser || Build.isTesting)) {
2235
2358
  const hostRef = getHostRef(ref);
2236
2359
  const isConnected = hostRef.$hostElement$.isConnected;
2237
2360
  if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
@@ -2242,29 +2365,26 @@ var forceUpdate = (ref) => {
2242
2365
  return false;
2243
2366
  };
2244
2367
  var appDidLoad = (who) => {
2245
- if (BUILD13.cssAnnotations) {
2246
- addHydratedFlag(doc.documentElement);
2247
- }
2248
- if (BUILD13.asyncQueue) {
2368
+ if (BUILD14.asyncQueue) {
2249
2369
  plt.$flags$ |= 2 /* appLoaded */;
2250
2370
  }
2251
2371
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
2252
- if (BUILD13.profile && performance.measure) {
2372
+ if (BUILD14.profile && performance.measure) {
2253
2373
  performance.measure(`[Rindo] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
2254
2374
  }
2255
2375
  };
2256
- var safeCall = (instance, method, arg) => {
2376
+ var safeCall = (instance, method, arg, elm) => {
2257
2377
  if (instance && instance[method]) {
2258
2378
  try {
2259
2379
  return instance[method](arg);
2260
2380
  } catch (e) {
2261
- consoleError(e);
2381
+ consoleError(e, elm);
2262
2382
  }
2263
2383
  }
2264
2384
  return void 0;
2265
2385
  };
2266
2386
  var emitLifecycleEvent = (elm, lifecycleName) => {
2267
- if (BUILD13.lifecycleDOMEvents) {
2387
+ if (BUILD14.lifecycleDOMEvents) {
2268
2388
  emitEvent(elm, "rindo_" + lifecycleName, {
2269
2389
  bubbles: true,
2270
2390
  composed: true,
@@ -2276,7 +2396,7 @@ var emitLifecycleEvent = (elm, lifecycleName) => {
2276
2396
  };
2277
2397
  var addHydratedFlag = (elm) => {
2278
2398
  var _a, _b;
2279
- return BUILD13.hydratedClass ? elm.classList.add((_a = BUILD13.hydratedSelectorName) != null ? _a : "hydrated") : BUILD13.hydratedAttribute ? elm.setAttribute((_b = BUILD13.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
2399
+ return BUILD14.hydratedClass ? elm.classList.add((_a = BUILD14.hydratedSelectorName) != null ? _a : "hydrated") : BUILD14.hydratedAttribute ? elm.setAttribute((_b = BUILD14.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
2280
2400
  };
2281
2401
  var serverSideConnected = (elm) => {
2282
2402
  const children = elm.children;
@@ -2295,21 +2415,21 @@ var serverSideConnected = (elm) => {
2295
2415
  var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
2296
2416
  var setValue = (ref, propName, newVal, cmpMeta) => {
2297
2417
  const hostRef = getHostRef(ref);
2298
- if (BUILD14.lazyLoad && !hostRef) {
2418
+ if (BUILD15.lazyLoad && !hostRef) {
2299
2419
  throw new Error(
2300
2420
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Rindo runtime. This usually happens when integrating a 3rd party Rindo component with another Rindo component or application.`
2301
2421
  );
2302
2422
  }
2303
- const elm = BUILD14.lazyLoad ? hostRef.$hostElement$ : ref;
2423
+ const elm = BUILD15.lazyLoad ? hostRef.$hostElement$ : ref;
2304
2424
  const oldVal = hostRef.$instanceValues$.get(propName);
2305
2425
  const flags = hostRef.$flags$;
2306
- const instance = BUILD14.lazyLoad ? hostRef.$lazyInstance$ : elm;
2426
+ const instance = BUILD15.lazyLoad ? hostRef.$lazyInstance$ : elm;
2307
2427
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2308
2428
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
2309
2429
  const didValueChange = newVal !== oldVal && !areBothNaN;
2310
- if ((!BUILD14.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
2430
+ if ((!BUILD15.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
2311
2431
  hostRef.$instanceValues$.set(propName, newVal);
2312
- if (BUILD14.isDev) {
2432
+ if (BUILD15.isDev) {
2313
2433
  if (hostRef.$flags$ & 1024 /* devOnRender */) {
2314
2434
  consoleDevWarn(
2315
2435
  `The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
@@ -2332,8 +2452,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2332
2452
  );
2333
2453
  }
2334
2454
  }
2335
- if (!BUILD14.lazyLoad || instance) {
2336
- if (BUILD14.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
2455
+ if (!BUILD15.lazyLoad || instance) {
2456
+ if (BUILD15.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
2337
2457
  const watchMethods = cmpMeta.$watchers$[propName];
2338
2458
  if (watchMethods) {
2339
2459
  watchMethods.map((watchMethodName) => {
@@ -2345,8 +2465,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2345
2465
  });
2346
2466
  }
2347
2467
  }
2348
- if (BUILD14.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2349
- if (BUILD14.cmpShouldUpdate && instance.componentShouldUpdate) {
2468
+ if (BUILD15.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2469
+ if (BUILD15.cmpShouldUpdate && instance.componentShouldUpdate) {
2350
2470
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2351
2471
  return;
2352
2472
  }
@@ -2361,105 +2481,125 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2361
2481
  var proxyComponent = (Cstr, cmpMeta, flags) => {
2362
2482
  var _a, _b;
2363
2483
  const prototype = Cstr.prototype;
2364
- if (BUILD15.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
2484
+ if (BUILD16.isTesting) {
2485
+ if (prototype.__rindoAugmented) {
2486
+ return;
2487
+ }
2488
+ prototype.__rindoAugmented = true;
2489
+ }
2490
+ if (BUILD16.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
2365
2491
  FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
2366
2492
  const originalFormAssociatedCallback = prototype[cbName];
2367
2493
  Object.defineProperty(prototype, cbName, {
2368
2494
  value(...args) {
2369
2495
  const hostRef = getHostRef(this);
2370
- const instance = BUILD15.lazyLoad ? hostRef.$lazyInstance$ : this;
2496
+ const instance = BUILD16.lazyLoad ? hostRef.$lazyInstance$ : this;
2371
2497
  if (!instance) {
2372
2498
  hostRef.$onReadyPromise$.then((asyncInstance) => {
2373
2499
  const cb = asyncInstance[cbName];
2374
2500
  typeof cb === "function" && cb.call(asyncInstance, ...args);
2375
2501
  });
2376
2502
  } else {
2377
- const cb = BUILD15.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
2503
+ const cb = BUILD16.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
2378
2504
  typeof cb === "function" && cb.call(instance, ...args);
2379
2505
  }
2380
2506
  }
2381
2507
  });
2382
2508
  });
2383
2509
  }
2384
- if (BUILD15.member && cmpMeta.$members$ || BUILD15.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
2385
- if (BUILD15.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
2510
+ if (BUILD16.member && cmpMeta.$members$ || BUILD16.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
2511
+ if (BUILD16.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
2386
2512
  cmpMeta.$watchers$ = Cstr.watchers;
2387
2513
  }
2388
2514
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
2389
2515
  members.map(([memberName, [memberFlags]]) => {
2390
- if ((BUILD15.prop || BUILD15.state) && (memberFlags & 31 /* Prop */ || (!BUILD15.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
2391
- if ((memberFlags & 2048 /* Getter */) === 0) {
2516
+ if ((BUILD16.prop || BUILD16.state) && (memberFlags & 31 /* Prop */ || (!BUILD16.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
2517
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
2518
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
2519
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
2520
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
2392
2521
  Object.defineProperty(prototype, memberName, {
2393
2522
  get() {
2394
- return getValue(this, memberName);
2395
- },
2396
- set(newValue) {
2397
- if (BUILD15.isDev) {
2398
- const ref = getHostRef(this);
2399
- if (
2400
- // we are proxying the instance (not element)
2401
- (flags & 1 /* isElementConstructor */) === 0 && // the element is not constructing
2402
- (ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
2403
- (memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
2404
- (memberFlags & 1024 /* Mutable */) === 0
2405
- ) {
2406
- consoleDevWarn(
2407
- `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
2408
- More information: https://rindojs.web.app/docs/properties#prop-mutability`
2409
- );
2523
+ if (BUILD16.lazyLoad) {
2524
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
2525
+ return getValue(this, memberName);
2410
2526
  }
2527
+ const ref = getHostRef(this);
2528
+ const instance = ref ? ref.$lazyInstance$ : prototype;
2529
+ if (!instance) return;
2530
+ return instance[memberName];
2531
+ }
2532
+ if (!BUILD16.lazyLoad) {
2533
+ return origGetter ? origGetter.apply(this) : getValue(this, memberName);
2411
2534
  }
2412
- setValue(this, memberName, newValue, cmpMeta);
2413
2535
  },
2414
2536
  configurable: true,
2415
2537
  enumerable: true
2416
2538
  });
2417
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
2418
- if (BUILD15.lazyLoad) {
2419
- Object.defineProperty(prototype, memberName, {
2420
- get() {
2421
- const ref = getHostRef(this);
2422
- const instance = BUILD15.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
2423
- if (!instance) return;
2424
- return instance[memberName];
2425
- },
2426
- configurable: true,
2427
- enumerable: true
2428
- });
2429
- }
2430
- if (memberFlags & 4096 /* Setter */) {
2431
- const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
2432
- Object.defineProperty(prototype, memberName, {
2433
- set(newValue) {
2434
- const ref = getHostRef(this);
2435
- if (origSetter) {
2436
- const currentValue = ref.$hostElement$[memberName];
2437
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
2438
- ref.$instanceValues$.set(memberName, currentValue);
2439
- }
2440
- origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
2441
- setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
2442
- return;
2539
+ }
2540
+ Object.defineProperty(prototype, memberName, {
2541
+ set(newValue) {
2542
+ const ref = getHostRef(this);
2543
+ if (BUILD16.isDev) {
2544
+ if (
2545
+ // we are proxying the instance (not element)
2546
+ (flags & 1 /* isElementConstructor */) === 0 && // if the class has a setter, then the Element can update instance values, so ignore
2547
+ (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0 && // the element is not constructing
2548
+ (ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
2549
+ (memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
2550
+ (memberFlags & 1024 /* Mutable */) === 0
2551
+ ) {
2552
+ consoleDevWarn(
2553
+ `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
2554
+ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2555
+ );
2556
+ }
2557
+ }
2558
+ if (origSetter) {
2559
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
2560
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
2561
+ newValue = ref.$instanceValues$.get(memberName);
2562
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
2563
+ ref.$instanceValues$.set(memberName, currentValue);
2564
+ }
2565
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
2566
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
2567
+ setValue(this, memberName, newValue, cmpMeta);
2568
+ return;
2569
+ }
2570
+ if (!BUILD16.lazyLoad) {
2571
+ setValue(this, memberName, newValue, cmpMeta);
2572
+ return;
2573
+ }
2574
+ if (BUILD16.lazyLoad) {
2575
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
2576
+ setValue(this, memberName, newValue, cmpMeta);
2577
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
2578
+ ref.$onReadyPromise$.then(() => {
2579
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
2580
+ ref.$lazyInstance$[memberName] = newValue;
2581
+ }
2582
+ });
2443
2583
  }
2444
- if (!ref) return;
2445
- const setterSetVal = () => {
2446
- const currentValue = ref.$lazyInstance$[memberName];
2447
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
2448
- ref.$instanceValues$.set(memberName, currentValue);
2449
- }
2450
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
2451
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
2452
- };
2453
- if (ref.$lazyInstance$) {
2454
- setterSetVal();
2455
- } else {
2456
- ref.$onReadyPromise$.then(() => setterSetVal());
2584
+ return;
2585
+ }
2586
+ const setterSetVal = () => {
2587
+ const currentValue = ref.$lazyInstance$[memberName];
2588
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
2589
+ ref.$instanceValues$.set(memberName, currentValue);
2457
2590
  }
2591
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
2592
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
2593
+ };
2594
+ if (ref.$lazyInstance$) {
2595
+ setterSetVal();
2596
+ } else {
2597
+ ref.$onReadyPromise$.then(() => setterSetVal());
2458
2598
  }
2459
- });
2599
+ }
2460
2600
  }
2461
- }
2462
- } else if (BUILD15.lazyLoad && BUILD15.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2601
+ });
2602
+ } else if (BUILD16.lazyLoad && BUILD16.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2463
2603
  Object.defineProperty(prototype, memberName, {
2464
2604
  value(...args) {
2465
2605
  var _a2;
@@ -2472,13 +2612,13 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2472
2612
  });
2473
2613
  }
2474
2614
  });
2475
- if (BUILD15.observeAttribute && (!BUILD15.lazyLoad || flags & 1 /* isElementConstructor */)) {
2615
+ if (BUILD16.observeAttribute && (!BUILD16.lazyLoad || flags & 1 /* isElementConstructor */)) {
2476
2616
  const attrNameToPropName = /* @__PURE__ */ new Map();
2477
2617
  prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
2478
2618
  plt.jmp(() => {
2479
2619
  var _a2;
2480
2620
  const propName = attrNameToPropName.get(attrName);
2481
- if (this.hasOwnProperty(propName) && BUILD15.lazyLoad) {
2621
+ if (this.hasOwnProperty(propName) && BUILD16.lazyLoad) {
2482
2622
  newValue = this[propName];
2483
2623
  delete this[propName];
2484
2624
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -2488,8 +2628,8 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2488
2628
  const hostRef = getHostRef(this);
2489
2629
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
2490
2630
  if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
2491
- const elm = BUILD15.lazyLoad ? hostRef.$hostElement$ : this;
2492
- const instance = BUILD15.lazyLoad ? hostRef.$lazyInstance$ : elm;
2631
+ const elm = BUILD16.lazyLoad ? hostRef.$hostElement$ : this;
2632
+ const instance = BUILD16.lazyLoad ? hostRef.$lazyInstance$ : elm;
2493
2633
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
2494
2634
  entry == null ? void 0 : entry.forEach((callbackName) => {
2495
2635
  if (instance[callbackName] != null) {
@@ -2500,8 +2640,9 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2500
2640
  return;
2501
2641
  }
2502
2642
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
2503
- if (!propDesc.get || !!propDesc.set) {
2504
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
2643
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
2644
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
2645
+ this[propName] = newValue;
2505
2646
  }
2506
2647
  });
2507
2648
  };
@@ -2512,7 +2653,7 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2512
2653
  var _a2;
2513
2654
  const attrName = m[1] || propName;
2514
2655
  attrNameToPropName.set(attrName, propName);
2515
- if (BUILD15.reflect && m[0] & 512 /* ReflectAttr */) {
2656
+ if (BUILD16.reflect && m[0] & 512 /* ReflectAttr */) {
2516
2657
  (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
2517
2658
  }
2518
2659
  return attrName;
@@ -2530,7 +2671,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2530
2671
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2531
2672
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2532
2673
  const bundleId = cmpMeta.$lazyBundleId$;
2533
- if ((BUILD16.lazyLoad || BUILD16.hydrateClientSide) && bundleId) {
2674
+ if (BUILD17.lazyLoad && bundleId) {
2534
2675
  const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
2535
2676
  if (CstrImport && "then" in CstrImport) {
2536
2677
  const endLoad = uniqueTime(
@@ -2545,53 +2686,53 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2545
2686
  if (!Cstr) {
2546
2687
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2547
2688
  }
2548
- if (BUILD16.member && !Cstr.isProxied) {
2549
- if (BUILD16.watchCallback) {
2689
+ if (BUILD17.member && !Cstr.isProxied) {
2690
+ if (BUILD17.watchCallback) {
2550
2691
  cmpMeta.$watchers$ = Cstr.watchers;
2551
2692
  }
2552
2693
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
2553
2694
  Cstr.isProxied = true;
2554
2695
  }
2555
2696
  const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
2556
- if (BUILD16.member) {
2697
+ if (BUILD17.member) {
2557
2698
  hostRef.$flags$ |= 8 /* isConstructingInstance */;
2558
2699
  }
2559
2700
  try {
2560
2701
  new Cstr(hostRef);
2561
2702
  } catch (e) {
2562
- consoleError(e);
2703
+ consoleError(e, elm);
2563
2704
  }
2564
- if (BUILD16.member) {
2705
+ if (BUILD17.member) {
2565
2706
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
2566
2707
  }
2567
- if (BUILD16.watchCallback) {
2708
+ if (BUILD17.watchCallback) {
2568
2709
  hostRef.$flags$ |= 128 /* isWatchReady */;
2569
2710
  }
2570
2711
  endNewInstance();
2571
- fireConnectedCallback(hostRef.$lazyInstance$);
2712
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
2572
2713
  } else {
2573
2714
  Cstr = elm.constructor;
2574
2715
  const cmpTag = elm.localName;
2575
2716
  customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
2576
2717
  }
2577
- if (BUILD16.style && Cstr && Cstr.style) {
2718
+ if (BUILD17.style && Cstr && Cstr.style) {
2578
2719
  let style;
2579
2720
  if (typeof Cstr.style === "string") {
2580
2721
  style = Cstr.style;
2581
- } else if (BUILD16.mode && typeof Cstr.style !== "string") {
2722
+ } else if (BUILD17.mode && typeof Cstr.style !== "string") {
2582
2723
  hostRef.$modeName$ = computeMode(elm);
2583
2724
  if (hostRef.$modeName$) {
2584
2725
  style = Cstr.style[hostRef.$modeName$];
2585
2726
  }
2586
- if (BUILD16.hydrateServerSide && hostRef.$modeName$) {
2727
+ if (BUILD17.hydrateServerSide && hostRef.$modeName$) {
2587
2728
  elm.setAttribute("s-mode", hostRef.$modeName$);
2588
2729
  }
2589
2730
  }
2590
2731
  const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
2591
2732
  if (!styles.has(scopeId2)) {
2592
2733
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2593
- if (!BUILD16.hydrateServerSide && BUILD16.shadowDom && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2594
- BUILD16.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2734
+ if (!BUILD17.hydrateServerSide && BUILD17.shadowDom && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2735
+ BUILD17.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2595
2736
  style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
2596
2737
  }
2597
2738
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
@@ -2601,15 +2742,15 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2601
2742
  }
2602
2743
  const ancestorComponent = hostRef.$ancestorComponent$;
2603
2744
  const schedule = () => scheduleUpdate(hostRef, true);
2604
- if (BUILD16.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
2745
+ if (BUILD17.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
2605
2746
  ancestorComponent["s-rc"].push(schedule);
2606
2747
  } else {
2607
2748
  schedule();
2608
2749
  }
2609
2750
  };
2610
- var fireConnectedCallback = (instance) => {
2611
- if (BUILD16.lazyLoad && BUILD16.connectedCallback) {
2612
- safeCall(instance, "connectedCallback");
2751
+ var fireConnectedCallback = (instance, elm) => {
2752
+ if (BUILD17.lazyLoad && BUILD17.connectedCallback) {
2753
+ safeCall(instance, "connectedCallback", void 0, elm);
2613
2754
  }
2614
2755
  };
2615
2756
 
@@ -2619,41 +2760,41 @@ var connectedCallback = (elm) => {
2619
2760
  const hostRef = getHostRef(elm);
2620
2761
  const cmpMeta = hostRef.$cmpMeta$;
2621
2762
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
2622
- if (BUILD17.hostListenerTargetParent) {
2763
+ if (BUILD18.hostListenerTargetParent) {
2623
2764
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2624
2765
  }
2625
2766
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2626
2767
  hostRef.$flags$ |= 1 /* hasConnected */;
2627
2768
  let hostId;
2628
- if (BUILD17.hydrateClientSide) {
2769
+ if (BUILD18.hydrateClientSide) {
2629
2770
  hostId = elm.getAttribute(HYDRATE_ID);
2630
2771
  if (hostId) {
2631
- if (BUILD17.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2632
- const scopeId2 = BUILD17.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
2772
+ if (BUILD18.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2773
+ const scopeId2 = BUILD18.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
2633
2774
  elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
2634
- } else if (BUILD17.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2635
- const scopeId2 = getScopeId(cmpMeta, BUILD17.mode ? elm.getAttribute("s-mode") : void 0);
2775
+ } else if (BUILD18.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2776
+ const scopeId2 = getScopeId(cmpMeta, BUILD18.mode ? elm.getAttribute("s-mode") : void 0);
2636
2777
  elm["s-sc"] = scopeId2;
2637
2778
  }
2638
2779
  initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2639
2780
  }
2640
2781
  }
2641
- if (BUILD17.slotRelocation && !hostId) {
2642
- if (BUILD17.hydrateServerSide || (BUILD17.slot || BUILD17.shadowDom) && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2782
+ if (BUILD18.slotRelocation && !hostId) {
2783
+ if (BUILD18.hydrateServerSide || (BUILD18.slot || BUILD18.shadowDom) && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2643
2784
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
2644
2785
  setContentReference(elm);
2645
2786
  }
2646
2787
  }
2647
- if (BUILD17.asyncLoading) {
2788
+ if (BUILD18.asyncLoading) {
2648
2789
  let ancestorComponent = elm;
2649
2790
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
2650
- if (BUILD17.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
2791
+ if (BUILD18.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
2651
2792
  attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
2652
2793
  break;
2653
2794
  }
2654
2795
  }
2655
2796
  }
2656
- if (BUILD17.prop && !BUILD17.hydrateServerSide && cmpMeta.$members$) {
2797
+ if (BUILD18.prop && !BUILD18.hydrateServerSide && cmpMeta.$members$) {
2657
2798
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2658
2799
  if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2659
2800
  const value = elm[memberName];
@@ -2662,7 +2803,7 @@ var connectedCallback = (elm) => {
2662
2803
  }
2663
2804
  });
2664
2805
  }
2665
- if (BUILD17.initializeNextTick) {
2806
+ if (BUILD18.initializeNextTick) {
2666
2807
  nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2667
2808
  } else {
2668
2809
  initializeComponent(elm, hostRef, cmpMeta);
@@ -2670,9 +2811,9 @@ var connectedCallback = (elm) => {
2670
2811
  } else {
2671
2812
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2672
2813
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2673
- fireConnectedCallback(hostRef.$lazyInstance$);
2814
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
2674
2815
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2675
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
2816
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
2676
2817
  }
2677
2818
  }
2678
2819
  endConnected();
@@ -2680,37 +2821,37 @@ var connectedCallback = (elm) => {
2680
2821
  };
2681
2822
  var setContentReference = (elm) => {
2682
2823
  const contentRefElm = elm["s-cr"] = doc.createComment(
2683
- BUILD17.isDebug ? `content-ref (host=${elm.localName})` : ""
2824
+ BUILD18.isDebug ? `content-ref (host=${elm.localName})` : ""
2684
2825
  );
2685
2826
  contentRefElm["s-cn"] = true;
2686
2827
  insertBefore(elm, contentRefElm, elm.firstChild);
2687
2828
  };
2688
2829
 
2689
2830
  // src/runtime/disconnected-callback.ts
2690
- import { BUILD as BUILD18 } from "@rindo/core/internal/app-data";
2691
- var disconnectInstance = (instance) => {
2692
- if (BUILD18.lazyLoad && BUILD18.disconnectedCallback) {
2693
- safeCall(instance, "disconnectedCallback");
2831
+ import { BUILD as BUILD19 } from "@rindo/core/internal/app-data";
2832
+ var disconnectInstance = (instance, elm) => {
2833
+ if (BUILD19.lazyLoad && BUILD19.disconnectedCallback) {
2834
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
2694
2835
  }
2695
- if (BUILD18.cmpDidUnload) {
2696
- safeCall(instance, "componentDidUnload");
2836
+ if (BUILD19.cmpDidUnload) {
2837
+ safeCall(instance, "componentDidUnload", void 0, elm || instance);
2697
2838
  }
2698
2839
  };
2699
2840
  var disconnectedCallback = async (elm) => {
2700
2841
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2701
2842
  const hostRef = getHostRef(elm);
2702
- if (BUILD18.hostListener) {
2843
+ if (BUILD19.hostListener) {
2703
2844
  if (hostRef.$rmListeners$) {
2704
2845
  hostRef.$rmListeners$.map((rmListener) => rmListener());
2705
2846
  hostRef.$rmListeners$ = void 0;
2706
2847
  }
2707
2848
  }
2708
- if (!BUILD18.lazyLoad) {
2849
+ if (!BUILD19.lazyLoad) {
2709
2850
  disconnectInstance(elm);
2710
2851
  } else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2711
- disconnectInstance(hostRef.$lazyInstance$);
2852
+ disconnectInstance(hostRef.$lazyInstance$, elm);
2712
2853
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2713
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2854
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
2714
2855
  }
2715
2856
  }
2716
2857
  if (rootAppliedStyles.has(elm)) {
@@ -2730,36 +2871,36 @@ var proxyCustomElement = (Cstr, compactMeta) => {
2730
2871
  $flags$: compactMeta[0],
2731
2872
  $tagName$: compactMeta[1]
2732
2873
  };
2733
- if (BUILD19.member) {
2874
+ if (BUILD20.member) {
2734
2875
  cmpMeta.$members$ = compactMeta[2];
2735
2876
  }
2736
- if (BUILD19.hostListener) {
2877
+ if (BUILD20.hostListener) {
2737
2878
  cmpMeta.$listeners$ = compactMeta[3];
2738
2879
  }
2739
- if (BUILD19.watchCallback) {
2880
+ if (BUILD20.watchCallback) {
2740
2881
  cmpMeta.$watchers$ = Cstr.$watchers$;
2741
2882
  }
2742
- if (BUILD19.reflect) {
2883
+ if (BUILD20.reflect) {
2743
2884
  cmpMeta.$attrsToReflect$ = [];
2744
2885
  }
2745
- if (BUILD19.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2886
+ if (BUILD20.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2746
2887
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2747
2888
  }
2748
- if (BUILD19.experimentalSlotFixes) {
2749
- if (BUILD19.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2889
+ if (BUILD20.experimentalSlotFixes) {
2890
+ if (BUILD20.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2750
2891
  patchPseudoShadowDom(Cstr.prototype);
2751
2892
  }
2752
2893
  } else {
2753
- if (BUILD19.slotChildNodesFix) {
2894
+ if (BUILD20.slotChildNodesFix) {
2754
2895
  patchChildSlotNodes(Cstr.prototype);
2755
2896
  }
2756
- if (BUILD19.cloneNodeFix) {
2897
+ if (BUILD20.cloneNodeFix) {
2757
2898
  patchCloneNode(Cstr.prototype);
2758
2899
  }
2759
- if (BUILD19.appendChildSlotFix) {
2900
+ if (BUILD20.appendChildSlotFix) {
2760
2901
  patchSlotAppendChild(Cstr.prototype);
2761
2902
  }
2762
- if (BUILD19.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2903
+ if (BUILD20.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2763
2904
  patchTextContent(Cstr.prototype);
2764
2905
  }
2765
2906
  }
@@ -2777,13 +2918,13 @@ var proxyCustomElement = (Cstr, compactMeta) => {
2777
2918
  this.__hasHostListenerAttached = true;
2778
2919
  }
2779
2920
  connectedCallback(this);
2780
- if (BUILD19.connectedCallback && originalConnectedCallback) {
2921
+ if (BUILD20.connectedCallback && originalConnectedCallback) {
2781
2922
  originalConnectedCallback.call(this);
2782
2923
  }
2783
2924
  },
2784
2925
  disconnectedCallback() {
2785
2926
  disconnectedCallback(this);
2786
- if (BUILD19.disconnectedCallback && originalDisconnectedCallback) {
2927
+ if (BUILD20.disconnectedCallback && originalDisconnectedCallback) {
2787
2928
  originalDisconnectedCallback.call(this);
2788
2929
  }
2789
2930
  plt.raf(() => {
@@ -2800,7 +2941,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
2800
2941
  __attachShadow() {
2801
2942
  if (supportsShadow) {
2802
2943
  if (!this.shadowRoot) {
2803
- if (BUILD19.shadowDelegatesFocus) {
2944
+ if (BUILD20.shadowDelegatesFocus) {
2804
2945
  this.attachShadow({
2805
2946
  mode: "open",
2806
2947
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
@@ -2824,7 +2965,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
2824
2965
  return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2825
2966
  };
2826
2967
  var forceModeUpdate = (elm) => {
2827
- if (BUILD19.style && BUILD19.mode && !BUILD19.lazyLoad) {
2968
+ if (BUILD20.style && BUILD20.mode && !BUILD20.lazyLoad) {
2828
2969
  const mode = computeMode(elm);
2829
2970
  const hostRef = getHostRef(elm);
2830
2971
  if (hostRef.$modeName$ !== mode) {
@@ -2847,7 +2988,7 @@ var forceModeUpdate = (elm) => {
2847
2988
  };
2848
2989
 
2849
2990
  // src/runtime/bootstrap-lazy.ts
2850
- import { BUILD as BUILD20 } from "@rindo/core/internal/app-data";
2991
+ import { BUILD as BUILD21 } from "@rindo/core/internal/app-data";
2851
2992
 
2852
2993
  // src/runtime/hmr-component.ts
2853
2994
  var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
@@ -2859,7 +3000,7 @@ var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
2859
3000
  // src/runtime/bootstrap-lazy.ts
2860
3001
  var bootstrapLazy = (lazyBundles, options = {}) => {
2861
3002
  var _a;
2862
- if (BUILD20.profile && performance.mark) {
3003
+ if (BUILD21.profile && performance.mark) {
2863
3004
  performance.mark("st:app:start");
2864
3005
  }
2865
3006
  installDevTools();
@@ -2875,12 +3016,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2875
3016
  let isBootstrapping = true;
2876
3017
  Object.assign(plt, options);
2877
3018
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
2878
- if (BUILD20.asyncQueue) {
3019
+ if (BUILD21.asyncQueue) {
2879
3020
  if (options.syncQueue) {
2880
3021
  plt.$flags$ |= 4 /* queueSync */;
2881
3022
  }
2882
3023
  }
2883
- if (BUILD20.hydrateClientSide) {
3024
+ if (BUILD21.hydrateClientSide) {
2884
3025
  plt.$flags$ |= 2 /* appLoaded */;
2885
3026
  }
2886
3027
  let hasSlotRelocation = false;
@@ -2896,22 +3037,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2896
3037
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2897
3038
  hasSlotRelocation = true;
2898
3039
  }
2899
- if (BUILD20.member) {
3040
+ if (BUILD21.member) {
2900
3041
  cmpMeta.$members$ = compactMeta[2];
2901
3042
  }
2902
- if (BUILD20.hostListener) {
3043
+ if (BUILD21.hostListener) {
2903
3044
  cmpMeta.$listeners$ = compactMeta[3];
2904
3045
  }
2905
- if (BUILD20.reflect) {
3046
+ if (BUILD21.reflect) {
2906
3047
  cmpMeta.$attrsToReflect$ = [];
2907
3048
  }
2908
- if (BUILD20.watchCallback) {
3049
+ if (BUILD21.watchCallback) {
2909
3050
  cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
2910
3051
  }
2911
- if (BUILD20.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3052
+ if (BUILD21.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2912
3053
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2913
3054
  }
2914
- const tagName = BUILD20.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
3055
+ const tagName = BUILD21.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
2915
3056
  const HostElement = class extends HTMLElement {
2916
3057
  // RindoLazyHost
2917
3058
  constructor(self) {
@@ -2919,10 +3060,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2919
3060
  this.hasRegisteredEventListeners = false;
2920
3061
  self = this;
2921
3062
  registerHost(self, cmpMeta);
2922
- if (BUILD20.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3063
+ if (BUILD21.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2923
3064
  if (supportsShadow) {
2924
3065
  if (!self.shadowRoot) {
2925
- if (BUILD20.shadowDelegatesFocus) {
3066
+ if (BUILD21.shadowDelegatesFocus) {
2926
3067
  self.attachShadow({
2927
3068
  mode: "open",
2928
3069
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
@@ -2937,7 +3078,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2937
3078
  );
2938
3079
  }
2939
3080
  }
2940
- } else if (!BUILD20.hydrateServerSide && !("shadowRoot" in self)) {
3081
+ } else if (!BUILD21.hydrateServerSide && !("shadowRoot" in self)) {
2941
3082
  self.shadowRoot = self;
2942
3083
  }
2943
3084
  }
@@ -2963,6 +3104,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2963
3104
  plt.raf(() => {
2964
3105
  var _a3;
2965
3106
  const hostRef = getHostRef(this);
3107
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
3108
+ if (i2 > -1) {
3109
+ deferredConnectedCallbacks.splice(i2, 1);
3110
+ }
2966
3111
  if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
2967
3112
  delete hostRef.$vnode$.$elm$;
2968
3113
  }
@@ -2972,28 +3117,28 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2972
3117
  return getHostRef(this).$onReadyPromise$;
2973
3118
  }
2974
3119
  };
2975
- if (BUILD20.experimentalSlotFixes) {
2976
- if (BUILD20.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3120
+ if (BUILD21.experimentalSlotFixes) {
3121
+ if (BUILD21.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2977
3122
  patchPseudoShadowDom(HostElement.prototype);
2978
3123
  }
2979
3124
  } else {
2980
- if (BUILD20.slotChildNodesFix) {
3125
+ if (BUILD21.slotChildNodesFix) {
2981
3126
  patchChildSlotNodes(HostElement.prototype);
2982
3127
  }
2983
- if (BUILD20.cloneNodeFix) {
3128
+ if (BUILD21.cloneNodeFix) {
2984
3129
  patchCloneNode(HostElement.prototype);
2985
3130
  }
2986
- if (BUILD20.appendChildSlotFix) {
3131
+ if (BUILD21.appendChildSlotFix) {
2987
3132
  patchSlotAppendChild(HostElement.prototype);
2988
3133
  }
2989
- if (BUILD20.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3134
+ if (BUILD21.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2990
3135
  patchTextContent(HostElement.prototype);
2991
3136
  }
2992
3137
  }
2993
- if (BUILD20.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
3138
+ if (BUILD21.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
2994
3139
  HostElement.formAssociated = true;
2995
3140
  }
2996
- if (BUILD20.hotModuleReplacement) {
3141
+ if (BUILD21.hotModuleReplacement) {
2997
3142
  HostElement.prototype["s-hmr"] = function(hmrVersionId) {
2998
3143
  hmrStart(this, cmpMeta, hmrVersionId);
2999
3144
  };
@@ -3012,7 +3157,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3012
3157
  if (hasSlotRelocation) {
3013
3158
  dataStyles.textContent += SLOT_FB_CSS;
3014
3159
  }
3015
- if (BUILD20.invisiblePrehydration && (BUILD20.hydratedClass || BUILD20.hydratedAttribute)) {
3160
+ if (BUILD21.invisiblePrehydration && (BUILD21.hydratedClass || BUILD21.hydratedAttribute)) {
3016
3161
  dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
3017
3162
  }
3018
3163
  if (dataStyles.innerHTML.length) {
@@ -3028,7 +3173,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3028
3173
  if (deferredConnectedCallbacks.length) {
3029
3174
  deferredConnectedCallbacks.map((host) => host.connectedCallback());
3030
3175
  } else {
3031
- if (BUILD20.profile) {
3176
+ if (BUILD21.profile) {
3032
3177
  plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, "timeout"));
3033
3178
  } else {
3034
3179
  plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
@@ -3041,10 +3186,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3041
3186
  var Fragment = (_, children) => children;
3042
3187
 
3043
3188
  // src/runtime/host-listener.ts
3044
- import { BUILD as BUILD21 } from "@rindo/core/internal/app-data";
3189
+ import { BUILD as BUILD22 } from "@rindo/core/internal/app-data";
3045
3190
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3046
- if (BUILD21.hostListener && listeners) {
3047
- if (BUILD21.hostListenerTargetParent) {
3191
+ if (BUILD22.hostListener && listeners) {
3192
+ if (BUILD22.hostListenerTargetParent) {
3048
3193
  if (attachParentListeners) {
3049
3194
  listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
3050
3195
  } else {
@@ -3052,7 +3197,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
3052
3197
  }
3053
3198
  }
3054
3199
  listeners.map(([flags, name, method]) => {
3055
- const target = BUILD21.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3200
+ const target = BUILD22.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3056
3201
  const handler = hostListenerProxy(hostRef, method);
3057
3202
  const opts = hostListenerOpts(flags);
3058
3203
  plt.ael(target, name, handler, opts);
@@ -3063,7 +3208,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
3063
3208
  var hostListenerProxy = (hostRef, methodName) => (ev) => {
3064
3209
  var _a;
3065
3210
  try {
3066
- if (BUILD21.lazyLoad) {
3211
+ if (BUILD22.lazyLoad) {
3067
3212
  if (hostRef.$flags$ & 256 /* isListenReady */) {
3068
3213
  (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
3069
3214
  } else {
@@ -3073,14 +3218,14 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
3073
3218
  hostRef.$hostElement$[methodName](ev);
3074
3219
  }
3075
3220
  } catch (e) {
3076
- consoleError(e);
3221
+ consoleError(e, hostRef.$hostElement$);
3077
3222
  }
3078
3223
  };
3079
3224
  var getHostListenerTarget = (elm, flags) => {
3080
- if (BUILD21.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
3081
- if (BUILD21.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
3082
- if (BUILD21.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
3083
- if (BUILD21.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
3225
+ if (BUILD22.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
3226
+ if (BUILD22.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
3227
+ if (BUILD22.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
3228
+ if (BUILD22.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
3084
3229
  return elm.parentElement;
3085
3230
  return elm;
3086
3231
  };
@@ -3258,8 +3403,9 @@ var hAsync = (nodeName, vnodeData, ...children) => {
3258
3403
  import { globalScripts } from "@rindo/core/internal/app-globals";
3259
3404
 
3260
3405
  // src/hydrate/platform/proxy-host-element.ts
3261
- import { BUILD as BUILD22 } from "@rindo/core/internal/app-data";
3262
- function proxyHostElement(elm, cmpMeta) {
3406
+ import { BUILD as BUILD23 } from "@rindo/core/internal/app-data";
3407
+ function proxyHostElement(elm, cstr) {
3408
+ const cmpMeta = cstr.cmpMeta;
3263
3409
  if (typeof elm.componentOnReady !== "function") {
3264
3410
  elm.componentOnReady = componentOnReady;
3265
3411
  }
@@ -3267,7 +3413,7 @@ function proxyHostElement(elm, cmpMeta) {
3267
3413
  elm.forceUpdate = forceUpdate2;
3268
3414
  }
3269
3415
  if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
3270
- if (BUILD22.shadowDelegatesFocus) {
3416
+ if (BUILD23.shadowDelegatesFocus) {
3271
3417
  elm.attachShadow({
3272
3418
  mode: "open",
3273
3419
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
@@ -3279,11 +3425,10 @@ function proxyHostElement(elm, cmpMeta) {
3279
3425
  if (cmpMeta.$members$ != null) {
3280
3426
  const hostRef = getHostRef(elm);
3281
3427
  const members = Object.entries(cmpMeta.$members$);
3282
- members.forEach(([memberName, m]) => {
3283
- var _a, _b;
3284
- const memberFlags = m[0];
3428
+ members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
3429
+ var _a;
3285
3430
  if (memberFlags & 31 /* Prop */) {
3286
- const attributeName = m[1] || memberName;
3431
+ const attributeName = metaAttributeName || memberName;
3287
3432
  let attrValue = elm.getAttribute(attributeName);
3288
3433
  if ((attrValue == null ? void 0 : attrValue.startsWith("{")) && attrValue.endsWith("}") || (attrValue == null ? void 0 : attrValue.startsWith("[")) && attrValue.endsWith("]")) {
3289
3434
  try {
@@ -3291,17 +3436,25 @@ function proxyHostElement(elm, cmpMeta) {
3291
3436
  } catch (e) {
3292
3437
  }
3293
3438
  }
3439
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(cstr.prototype, memberName) || {};
3440
+ let attrPropVal;
3294
3441
  if (attrValue != null) {
3295
- const parsedAttrValue = parsePropertyValue(attrValue, memberFlags);
3296
- (_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, parsedAttrValue);
3442
+ attrPropVal = parsePropertyValue(attrValue, memberFlags);
3297
3443
  }
3298
3444
  const ownValue = elm[memberName];
3299
3445
  if (ownValue !== void 0) {
3300
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, ownValue);
3446
+ attrPropVal = ownValue;
3301
3447
  delete elm[memberName];
3302
3448
  }
3449
+ if (attrPropVal !== void 0) {
3450
+ if (origSetter) {
3451
+ origSetter.apply(elm, [attrPropVal]);
3452
+ attrPropVal = origGetter ? origGetter.apply(elm) : attrPropVal;
3453
+ }
3454
+ (_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, attrPropVal);
3455
+ }
3303
3456
  Object.defineProperty(elm, memberName, {
3304
- get() {
3457
+ get: function() {
3305
3458
  return getValue(this, memberName);
3306
3459
  },
3307
3460
  set(newValue) {
@@ -3310,6 +3463,21 @@ function proxyHostElement(elm, cmpMeta) {
3310
3463
  configurable: true,
3311
3464
  enumerable: true
3312
3465
  });
3466
+ if (!cstr.prototype.__rindoAugmented) {
3467
+ Object.defineProperty(cstr.prototype, memberName, {
3468
+ get: function() {
3469
+ var _a2;
3470
+ const ref = getHostRef(this);
3471
+ const attrPropVal2 = (_a2 = ref.$instanceValues$) == null ? void 0 : _a2.get(memberName);
3472
+ if (origGetter && attrPropVal2 === void 0 && !getValue(this, memberName)) {
3473
+ setValue(this, memberName, origGetter.apply(this), cmpMeta);
3474
+ }
3475
+ return attrPropVal2 !== void 0 ? attrPropVal2 : origGetter ? origGetter.apply(this) : getValue(this, memberName);
3476
+ },
3477
+ configurable: true,
3478
+ enumerable: true
3479
+ });
3480
+ }
3313
3481
  } else if (memberFlags & 64 /* Method */) {
3314
3482
  Object.defineProperty(elm, memberName, {
3315
3483
  value(...args) {
@@ -3318,11 +3486,14 @@ function proxyHostElement(elm, cmpMeta) {
3318
3486
  return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
3319
3487
  var _a3;
3320
3488
  return (_a3 = ref == null ? void 0 : ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
3321
- }).catch(consoleError);
3489
+ }).catch((e) => {
3490
+ consoleError(e, this);
3491
+ });
3322
3492
  }
3323
3493
  });
3324
3494
  }
3325
3495
  });
3496
+ cstr.prototype.__rindoAugmented = true;
3326
3497
  }
3327
3498
  }
3328
3499
  function componentOnReady() {
@@ -3386,7 +3557,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
3386
3557
  createdElements.add(elm);
3387
3558
  elm.connectedCallback = patchedConnectedCallback2;
3388
3559
  registerHost(elm, Cstr.cmpMeta);
3389
- proxyHostElement(elm, Cstr.cmpMeta);
3560
+ proxyHostElement(elm, Cstr);
3390
3561
  }
3391
3562
  }
3392
3563
  }
@@ -3581,7 +3752,7 @@ function waitingOnElementsMsg(waitingElements) {
3581
3752
  }
3582
3753
 
3583
3754
  // src/hydrate/platform/index.ts
3584
- import { BUILD as BUILD24, Env, NAMESPACE as NAMESPACE2 } from "@rindo/core/internal/app-data";
3755
+ import { BUILD as BUILD25, Env, NAMESPACE as NAMESPACE2 } from "@rindo/core/internal/app-data";
3585
3756
  var customError;
3586
3757
  var cmpModules = /* @__PURE__ */ new Map();
3587
3758
  var getModule = (tagName) => {
@@ -3667,13 +3838,19 @@ var plt = {
3667
3838
  var setPlatformHelpers = (helpers) => {
3668
3839
  Object.assign(plt, helpers);
3669
3840
  };
3670
- var supportsShadow = BUILD23.shadowDom;
3841
+ var supportsShadow = BUILD24.shadowDom;
3671
3842
  var supportsListenerOptions = false;
3672
3843
  var supportsConstructableStylesheets = false;
3673
3844
  var hostRefs = /* @__PURE__ */ new WeakMap();
3674
3845
  var getHostRef = (ref) => hostRefs.get(ref);
3675
3846
  var deleteHostRef = (ref) => hostRefs.delete(ref);
3676
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
3847
+ var registerInstance = (lazyInstance, hostRef) => {
3848
+ const ref = hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
3849
+ if (BUILD24.modernPropertyDecls && (BUILD24.state || BUILD24.prop)) {
3850
+ reWireGetterSetter(lazyInstance, hostRef);
3851
+ }
3852
+ return ref;
3853
+ };
3677
3854
  var registerHost = (elm, cmpMeta) => {
3678
3855
  const hostRef = {
3679
3856
  $flags$: 0,
@@ -3697,7 +3874,7 @@ var Build = {
3697
3874
  var styles = /* @__PURE__ */ new Map();
3698
3875
  var modeResolutionChain = [];
3699
3876
  export {
3700
- BUILD24 as BUILD,
3877
+ BUILD25 as BUILD,
3701
3878
  Build,
3702
3879
  Env,
3703
3880
  Fragment,