@ionic/core
Version:
Base components for Ionic
1,487 lines (1,466 loc) • 117 kB
JavaScript
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/
'use strict';
const NAMESPACE = 'ionic';
const BUILD = /* ionic */ { experimentalSlotFixes: true, hydratedSelectorName: "hydrated", lazyLoad: true, shadowDom: true, slotRelocation: true, updatable: true};
// TODO(FW-2832): types
class Config {
constructor() {
this.m = new Map();
}
reset(configObj) {
this.m = new Map(Object.entries(configObj));
}
get(key, fallback) {
const value = this.m.get(key);
return value !== undefined ? value : fallback;
}
getBoolean(key, fallback = false) {
const val = this.m.get(key);
if (val === undefined) {
return fallback;
}
if (typeof val === 'string') {
return val === 'true';
}
return !!val;
}
getNumber(key, fallback) {
const val = parseFloat(this.m.get(key));
return isNaN(val) ? (fallback !== undefined ? fallback : NaN) : val;
}
set(key, value) {
this.m.set(key, value);
}
}
const config = /*@__PURE__*/ new Config();
const configFromSession = (win) => {
try {
const configStr = win.sessionStorage.getItem(IONIC_SESSION_KEY);
return configStr !== null ? JSON.parse(configStr) : {};
}
catch (e) {
return {};
}
};
const saveConfig = (win, c) => {
try {
win.sessionStorage.setItem(IONIC_SESSION_KEY, JSON.stringify(c));
}
catch (e) {
return;
}
};
const configFromURL = (win) => {
const configObj = {};
win.location.search
.slice(1)
.split('&')
.map((entry) => entry.split('='))
.map(([key, value]) => {
try {
return [decodeURIComponent(key), decodeURIComponent(value)];
}
catch (e) {
return ['', ''];
}
})
.filter(([key]) => startsWith(key, IONIC_PREFIX))
.map(([key, value]) => [key.slice(IONIC_PREFIX.length), value])
.forEach(([key, value]) => {
configObj[key] = value;
});
return configObj;
};
const startsWith = (input, search) => {
return input.substr(0, search.length) === search;
};
const IONIC_PREFIX = 'ionic:';
const IONIC_SESSION_KEY = 'ionic-persist-config';
exports.LogLevel = void 0;
(function (LogLevel) {
LogLevel["OFF"] = "OFF";
LogLevel["ERROR"] = "ERROR";
LogLevel["WARN"] = "WARN";
})(exports.LogLevel || (exports.LogLevel = {}));
/**
* Logs a warning to the console with an Ionic prefix
* to indicate the library that is warning the developer.
*
* @param message - The string message to be logged to the console.
*/
const printIonWarning = (message, ...params) => {
const logLevel = config.get('logLevel', exports.LogLevel.WARN);
if ([exports.LogLevel.WARN].includes(logLevel)) {
return console.warn(`[Ionic Warning]: ${message}`, ...params);
}
};
/**
* Logs an error to the console with an Ionic prefix
* to indicate the library that is warning the developer.
*
* @param message - The string message to be logged to the console.
* @param params - Additional arguments to supply to the console.error.
*/
const printIonError = (message, ...params) => {
const logLevel = config.get('logLevel', exports.LogLevel.ERROR);
if ([exports.LogLevel.ERROR, exports.LogLevel.WARN].includes(logLevel)) {
return console.error(`[Ionic Error]: ${message}`, ...params);
}
};
/**
* Prints an error informing developers that an implementation requires an element to be used
* within a specific selector.
*
* @param el The web component element this is requiring the element.
* @param targetSelectors The selector or selectors that were not found.
*/
const printRequiredElementError = (el, ...targetSelectors) => {
return console.error(`<${el.tagName.toLowerCase()}> must be used inside ${targetSelectors.join(' or ')}.`);
};
const getPlatforms = (win) => setupPlatforms(win);
const isPlatform = (winOrPlatform, platform) => {
if (typeof winOrPlatform === 'string') {
platform = winOrPlatform;
winOrPlatform = undefined;
}
return getPlatforms(winOrPlatform).includes(platform);
};
const setupPlatforms = (win = window) => {
if (typeof win === 'undefined') {
return [];
}
win.Ionic = win.Ionic || {};
let platforms = win.Ionic.platforms;
if (platforms == null) {
platforms = win.Ionic.platforms = detectPlatforms(win);
platforms.forEach((p) => win.document.documentElement.classList.add(`plt-${p}`));
}
return platforms;
};
const detectPlatforms = (win) => {
const customPlatformMethods = config.get('platform');
return Object.keys(PLATFORMS_MAP).filter((p) => {
const customMethod = customPlatformMethods === null || customPlatformMethods === void 0 ? void 0 : customPlatformMethods[p];
return typeof customMethod === 'function' ? customMethod(win) : PLATFORMS_MAP[p](win);
});
};
const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
const isIpad = (win) => {
// iOS 12 and below
if (testUserAgent(win, /iPad/i)) {
return true;
}
// iOS 13+
if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
return true;
}
return false;
};
const isIphone = (win) => testUserAgent(win, /iPhone/i);
const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
const isAndroid = (win) => testUserAgent(win, /android|sink/i);
const isAndroidTablet = (win) => {
return isAndroid(win) && !testUserAgent(win, /mobile/i);
};
const isPhablet = (win) => {
const width = win.innerWidth;
const height = win.innerHeight;
const smallest = Math.min(width, height);
const largest = Math.max(width, height);
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
};
const isTablet = (win) => {
const width = win.innerWidth;
const height = win.innerHeight;
const smallest = Math.min(width, height);
const largest = Math.max(width, height);
return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);
};
const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');
const isDesktop = (win) => !isMobile(win);
const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
const isCapacitorNative = (win) => {
const capacitor = win['Capacitor'];
// TODO(ROU-11693): Remove when we no longer support Capacitor 2, which does not have isNativePlatform
return !!((capacitor === null || capacitor === void 0 ? void 0 : capacitor.isNative) || ((capacitor === null || capacitor === void 0 ? void 0 : capacitor.isNativePlatform) && !!capacitor.isNativePlatform()));
};
const isElectron = (win) => testUserAgent(win, /electron/i);
const isPWA = (win) => { var _a; return !!(((_a = win.matchMedia) === null || _a === void 0 ? void 0 : _a.call(win, '(display-mode: standalone)').matches) || win.navigator.standalone); };
const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
const matchMedia = (win, query) => { var _a; return (_a = win.matchMedia) === null || _a === void 0 ? void 0 : _a.call(win, query).matches; };
const PLATFORMS_MAP = {
ipad: isIpad,
iphone: isIphone,
ios: isIOS,
android: isAndroid,
phablet: isPhablet,
tablet: isTablet,
cordova: isCordova,
capacitor: isCapacitorNative,
electron: isElectron,
pwa: isPWA,
mobile: isMobile,
mobileweb: isMobileWeb,
desktop: isDesktop,
hybrid: isHybrid,
};
// TODO(FW-2832): types
let defaultMode;
const getIonMode = (ref) => {
return (ref && getMode(ref)) || defaultMode;
};
const initialize = (userConfig = {}) => {
if (typeof window === 'undefined') {
return;
}
const doc = window.document;
const win = window;
const Ionic = (win.Ionic = win.Ionic || {});
// create the Ionic.config from raw config object (if it exists)
// and convert Ionic.config into a ConfigApi that has a get() fn
const configObj = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, configFromSession(win)), { persistConfig: false }), Ionic.config), configFromURL(win)), userConfig);
config.reset(configObj);
if (config.getBoolean('persistConfig')) {
saveConfig(win, configObj);
}
// Setup platforms
setupPlatforms(win);
// first see if the mode was set as an attribute on <html>
// which could have been set by the user, or by pre-rendering
// otherwise get the mode via config settings, and fallback to md
Ionic.config = config;
Ionic.mode = defaultMode = config.get('mode', doc.documentElement.getAttribute('mode') || (isPlatform(win, 'ios') ? 'ios' : 'md'));
config.set('mode', defaultMode);
doc.documentElement.setAttribute('mode', defaultMode);
doc.documentElement.classList.add(defaultMode);
if (config.getBoolean('_testing')) {
config.set('animated', false);
}
const isIonicElement = (elm) => { var _a; return (_a = elm.tagName) === null || _a === void 0 ? void 0 : _a.startsWith('ION-'); };
const isAllowedIonicModeValue = (elmMode) => ['ios', 'md'].includes(elmMode);
setMode((elm) => {
while (elm) {
const elmMode = elm.mode || elm.getAttribute('mode');
if (elmMode) {
if (isAllowedIonicModeValue(elmMode)) {
return elmMode;
}
else if (isIonicElement(elm)) {
printIonWarning('Invalid ionic mode: "' + elmMode + '", expected: "ios" or "md"');
}
}
elm = elm.parentElement;
}
return defaultMode;
});
};
const globalScripts = initialize;
const globalStyles = "";
/*
Stencil Client Platform v4.33.1 | MIT Licensed | https://stenciljs.com
*/
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var Build = {
isBrowser: true};
// src/utils/constants.ts
var SVG_NS = "http://www.w3.org/2000/svg";
var HTML_NS = "http://www.w3.org/1999/xhtml";
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
PrimitiveType2["Undefined"] = "undefined";
PrimitiveType2["Null"] = "null";
PrimitiveType2["String"] = "string";
PrimitiveType2["Number"] = "number";
PrimitiveType2["SpecialNumber"] = "number";
PrimitiveType2["Boolean"] = "boolean";
PrimitiveType2["BigInt"] = "bigint";
return PrimitiveType2;
})(PrimitiveType || {});
var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
NonPrimitiveType2["Array"] = "array";
NonPrimitiveType2["Date"] = "date";
NonPrimitiveType2["Map"] = "map";
NonPrimitiveType2["Object"] = "object";
NonPrimitiveType2["RegularExpression"] = "regexp";
NonPrimitiveType2["Set"] = "set";
NonPrimitiveType2["Channel"] = "channel";
NonPrimitiveType2["Symbol"] = "symbol";
return NonPrimitiveType2;
})(NonPrimitiveType || {});
var TYPE_CONSTANT = "type";
var VALUE_CONSTANT = "value";
var SERIALIZED_PREFIX = "serialized:";
// src/client/client-host-ref.ts
var getHostRef = (ref) => {
if (ref.__stencil__getHostRef) {
return ref.__stencil__getHostRef();
}
return void 0;
};
var registerInstance = (lazyInstance, hostRef) => {
lazyInstance.__stencil__getHostRef = () => hostRef;
hostRef.$lazyInstance$ = lazyInstance;
};
var registerHost = (hostElement, cmpMeta) => {
const hostRef = {
$flags$: 0,
$hostElement$: hostElement,
$cmpMeta$: cmpMeta,
$instanceValues$: /* @__PURE__ */ new Map()
};
{
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
}
{
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
hostElement["s-p"] = [];
hostElement["s-rc"] = [];
}
const ref = hostRef;
hostElement.__stencil__getHostRef = () => ref;
return ref;
};
var isMemberInElement = (elm, memberName) => memberName in elm;
var consoleError = (e, el) => (0, console.error)(e, el);
// src/client/client-load-module.ts
var cmpModules = /* @__PURE__ */ new Map();
var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
const bundleId = cmpMeta.$lazyBundleId$;
if (!bundleId) {
return void 0;
}
const module = cmpModules.get(bundleId) ;
if (module) {
return module[exportName];
}
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
return import(
/* @vite-ignore */
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${""}`
).then(
(importedModule) => {
{
cmpModules.set(bundleId, importedModule);
}
return importedModule[exportName];
},
(e) => {
consoleError(e, hostRef.$hostElement$);
}
);
};
// src/client/client-style.ts
var styles = /* @__PURE__ */ new Map();
var modeResolutionChain = [];
// src/runtime/runtime-constants.ts
var CONTENT_REF_ID = "r";
var ORG_LOCATION_ID = "o";
var SLOT_NODE_ID = "s";
var TEXT_NODE_ID = "t";
var COMMENT_NODE_ID = "c";
var HYDRATE_ID = "s-id";
var HYDRATED_STYLE_ID = "sty-id";
var HYDRATE_CHILD_ID = "c-id";
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
var XLINK_NS = "http://www.w3.org/1999/xlink";
var win = typeof window !== "undefined" ? window : {};
var H = win.HTMLElement || class {
};
var plt = {
$flags$: 0,
$resourcesUrl$: "",
jmp: (h2) => h2(),
raf: (h2) => requestAnimationFrame(h2),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
ce: (eventName, opts) => new CustomEvent(eventName, opts)
};
var supportsShadow = BUILD.shadowDom;
var supportsListenerOptions = /* @__PURE__ */ (() => {
var _a;
let supportsListenerOptions2 = false;
try {
(_a = win.document) == null ? void 0 : _a.addEventListener(
"e",
null,
Object.defineProperty({}, "passive", {
get() {
supportsListenerOptions2 = true;
}
})
);
} catch (e) {
}
return supportsListenerOptions2;
})();
var promiseResolve = (v) => Promise.resolve(v);
var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
try {
new CSSStyleSheet();
return typeof new CSSStyleSheet().replaceSync === "function";
} catch (e) {
}
return false;
})() ;
var queuePending = false;
var queueDomReads = [];
var queueDomWrites = [];
var queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
} else {
plt.raf(flush);
}
}
};
var consume = (queue) => {
for (let i2 = 0; i2 < queue.length; i2++) {
try {
queue[i2](performance.now());
} catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
var flush = () => {
consume(queueDomReads);
{
consume(queueDomWrites);
if (queuePending = queueDomReads.length > 0) {
plt.raf(flush);
}
}
};
var nextTick = (cb) => promiseResolve().then(cb);
var readTask = /* @__PURE__ */ queueTask(queueDomReads, false);
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
// src/runtime/asset-path.ts
var getAssetPath = (path) => {
const assetUrl = new URL(path, plt.$resourcesUrl$);
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
};
// src/utils/helpers.ts
var isDef = (v) => v != null && v !== void 0;
var isComplexType = (o) => {
o = typeof o;
return o === "object" || o === "function";
};
// src/utils/query-nonce-meta-tag-content.ts
function queryNonceMetaTagContent(doc) {
var _a, _b, _c;
return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
}
// src/utils/regular-expression.ts
var escapeRegExpSpecialCharacters = (text) => {
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
};
// src/utils/remote-value.ts
var RemoteValue = class _RemoteValue {
/**
* Deserializes a LocalValue serialized object back to its original JavaScript representation
*
* @param serialized The serialized LocalValue object
* @returns The original JavaScript value/object
*/
static fromLocalValue(serialized) {
const type = serialized[TYPE_CONSTANT];
const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
switch (type) {
case "string" /* String */:
return value;
case "boolean" /* Boolean */:
return value;
case "bigint" /* BigInt */:
return BigInt(value);
case "undefined" /* Undefined */:
return void 0;
case "null" /* Null */:
return null;
case "number" /* Number */:
if (value === "NaN") return NaN;
if (value === "-0") return -0;
if (value === "Infinity") return Infinity;
if (value === "-Infinity") return -Infinity;
return value;
case "array" /* Array */:
return value.map((item) => _RemoteValue.fromLocalValue(item));
case "date" /* Date */:
return new Date(value);
case "map" /* Map */:
const map2 = /* @__PURE__ */ new Map();
for (const [key, val] of value) {
const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
const deserializedValue = _RemoteValue.fromLocalValue(val);
map2.set(deserializedKey, deserializedValue);
}
return map2;
case "object" /* Object */:
const obj = {};
for (const [key, val] of value) {
obj[key] = _RemoteValue.fromLocalValue(val);
}
return obj;
case "regexp" /* RegularExpression */:
const { pattern, flags } = value;
return new RegExp(pattern, flags);
case "set" /* Set */:
const set = /* @__PURE__ */ new Set();
for (const item of value) {
set.add(_RemoteValue.fromLocalValue(item));
}
return set;
case "symbol" /* Symbol */:
return Symbol(value);
default:
throw new Error(`Unsupported type: ${type}`);
}
}
/**
* Utility method to deserialize multiple LocalValues at once
*
* @param serializedValues Array of serialized LocalValue objects
* @returns Array of deserialized JavaScript values
*/
static fromLocalValueArray(serializedValues) {
return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
}
/**
* Verifies if the given object matches the structure of a serialized LocalValue
*
* @param obj Object to verify
* @returns boolean indicating if the object has LocalValue structure
*/
static isLocalValueObject(obj) {
if (typeof obj !== "object" || obj === null) {
return false;
}
if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
return false;
}
const type = obj[TYPE_CONSTANT];
const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
if (!hasTypeProperty) {
return false;
}
if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
return obj.hasOwnProperty(VALUE_CONSTANT);
}
return true;
}
};
// src/utils/result.ts
var result_exports = {};
__export(result_exports, {
err: () => err,
map: () => map,
ok: () => ok,
unwrap: () => unwrap,
unwrapErr: () => unwrapErr
});
var ok = (value) => ({
isOk: true,
isErr: false,
value
});
var err = (value) => ({
isOk: false,
isErr: true,
value
});
function map(result, fn) {
if (result.isOk) {
const val = fn(result.value);
if (val instanceof Promise) {
return val.then((newVal) => ok(newVal));
} else {
return ok(val);
}
}
if (result.isErr) {
const value = result.value;
return err(value);
}
throw "should never get here";
}
var unwrap = (result) => {
if (result.isOk) {
return result.value;
} else {
throw result.value;
}
};
var unwrapErr = (result) => {
if (result.isErr) {
return result.value;
} else {
throw result.value;
}
};
// src/utils/serialize.ts
function deserializeProperty(value) {
if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
return value;
}
return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
}
function createShadowRoot(cmpMeta) {
const shadowRoot = this.attachShadow({
mode: "open",
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
}) ;
if (supportsConstructableStylesheets) {
const sheet = new CSSStyleSheet();
sheet.replaceSync(globalStyles);
shadowRoot.adoptedStyleSheets.push(sheet);
}
}
var updateFallbackSlotVisibility = (elm) => {
const childNodes = internalCall(elm, "childNodes");
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
slotNode.hidden = true;
} else {
slotNode.hidden = false;
}
}
});
}
let i2 = 0;
for (i2 = 0; i2 < childNodes.length; i2++) {
const childNode = childNodes[i2];
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
updateFallbackSlotVisibility(childNode);
}
}
};
var getSlottedChildNodes = (childNodes) => {
const result = [];
for (let i2 = 0; i2 < childNodes.length; i2++) {
const slottedNode = childNodes[i2]["s-nr"] || void 0;
if (slottedNode && slottedNode.isConnected) {
result.push(slottedNode);
}
}
return result;
};
function getHostSlotNodes(childNodes, hostName, slotName) {
let i2 = 0;
let slottedNodes = [];
let childNode;
for (; i2 < childNodes.length; i2++) {
childNode = childNodes[i2];
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
slottedNodes.push(childNode);
if (typeof slotName !== "undefined") return slottedNodes;
}
slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
}
return slottedNodes;
}
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
const childNodes = [];
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
let node = slot;
while (node = node.nextSibling) {
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
}
return childNodes;
};
var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
return true;
}
if (nodeToRelocate.getAttribute("slot") === slotName) {
return true;
}
return false;
}
if (nodeToRelocate["s-sn"] === slotName) {
return true;
}
return slotName === "";
};
var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
return;
}
const slottedNodeLocation = document.createTextNode("");
slottedNodeLocation["s-nr"] = newChild;
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
const parent = slotNode["s-cr"].parentNode;
const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
if (typeof position !== "undefined") {
slottedNodeLocation["s-oo"] = position;
const childNodes = internalCall(parent, "childNodes");
const slotRelocateNodes = [slottedNodeLocation];
childNodes.forEach((n) => {
if (n["s-nr"]) slotRelocateNodes.push(n);
});
slotRelocateNodes.sort((a, b) => {
if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
return 0;
});
slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
} else {
appendMethod.call(parent, slottedNodeLocation);
}
newChild["s-ol"] = slottedNodeLocation;
newChild["s-sh"] = slotNode["s-hn"];
};
var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
function patchSlotNode(node) {
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
const assignedFactory = (elementsOnly) => (function(opts) {
const toReturn = [];
const slotName = this["s-sn"];
if (opts == null ? void 0 : opts.flatten) {
console.error(`
Flattening is not supported for Stencil non-shadow slots.
You can use \`.childNodes\` to nested slot fallback content.
If you have a particular use case, please open an issue on the Stencil repo.
`);
}
const parent = this["s-cr"].parentElement;
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
slottedNodes.forEach((n) => {
if (slotName === getSlotName(n)) {
toReturn.push(n);
}
});
if (elementsOnly) {
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
}
return toReturn;
}).bind(node);
node.assignedElements = assignedFactory(true);
node.assignedNodes = assignedFactory(false);
}
function dispatchSlotChangeEvent(elm) {
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
}
function findSlotFromSlottedNode(slottedNode, parentHost) {
var _a;
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
if (!parentHost) return { slotNode: null, slotName: "" };
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
const childNodes = internalCall(parentHost, "childNodes");
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
return { slotNode, slotName };
}
// src/runtime/dom-extras.ts
var patchPseudoShadowDom = (hostElementPrototype) => {
patchCloneNode(hostElementPrototype);
patchSlotAppendChild(hostElementPrototype);
patchSlotAppend(hostElementPrototype);
patchSlotPrepend(hostElementPrototype);
patchSlotInsertAdjacentElement(hostElementPrototype);
patchSlotInsertAdjacentHTML(hostElementPrototype);
patchSlotInsertAdjacentText(hostElementPrototype);
patchInsertBefore(hostElementPrototype);
patchTextContent(hostElementPrototype);
patchChildSlotNodes(hostElementPrototype);
patchSlotRemoveChild(hostElementPrototype);
};
var patchCloneNode = (HostElementPrototype) => {
const orgCloneNode = HostElementPrototype.cloneNode;
HostElementPrototype.cloneNode = function(deep) {
const srcNode = this;
const isShadowDom = srcNode.shadowRoot && supportsShadow ;
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
if (!isShadowDom && deep) {
let i2 = 0;
let slotted, nonStencilNode;
const stencilPrivates = [
"s-id",
"s-cr",
"s-lr",
"s-rc",
"s-sc",
"s-p",
"s-cn",
"s-sr",
"s-sn",
"s-hn",
"s-ol",
"s-nr",
"s-si",
"s-rf",
"s-scs"
];
const childNodes = this.__childNodes || this.childNodes;
for (; i2 < childNodes.length; i2++) {
slotted = childNodes[i2]["s-nr"];
nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
if (slotted) {
if (clonedNode.__appendChild) {
clonedNode.__appendChild(slotted.cloneNode(true));
} else {
clonedNode.appendChild(slotted.cloneNode(true));
}
}
if (nonStencilNode) {
clonedNode.appendChild(childNodes[i2].cloneNode(true));
}
}
}
return clonedNode;
};
};
var patchSlotAppendChild = (HostElementPrototype) => {
HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
HostElementPrototype.appendChild = function(newChild) {
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
if (slotNode) {
addSlotRelocateNode(newChild, slotNode);
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
const parent = internalCall(appendAfter, "parentNode");
const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
dispatchSlotChangeEvent(slotNode);
updateFallbackSlotVisibility(this);
return insertedNode;
}
return this.__appendChild(newChild);
};
};
var patchSlotRemoveChild = (ElementPrototype) => {
ElementPrototype.__removeChild = ElementPrototype.removeChild;
ElementPrototype.removeChild = function(toRemove) {
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
const childNodes = this.__childNodes || this.childNodes;
const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
if (slotNode && toRemove.isConnected) {
toRemove.remove();
updateFallbackSlotVisibility(this);
return;
}
}
return this.__removeChild(toRemove);
};
};
var patchSlotPrepend = (HostElementPrototype) => {
HostElementPrototype.__prepend = HostElementPrototype.prepend;
HostElementPrototype.prepend = function(...newChildren) {
newChildren.forEach((newChild) => {
if (typeof newChild === "string") {
newChild = this.ownerDocument.createTextNode(newChild);
}
const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
const childNodes = internalCall(this, "childNodes");
const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
if (slotNode) {
addSlotRelocateNode(newChild, slotNode, true);
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
const appendAfter = slotChildNodes[0];
const parent = internalCall(appendAfter, "parentNode");
const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
dispatchSlotChangeEvent(slotNode);
return toReturn;
}
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
newChild.hidden = true;
}
return HostElementPrototype.__prepend(newChild);
});
};
};
var patchSlotAppend = (HostElementPrototype) => {
HostElementPrototype.__append = HostElementPrototype.append;
HostElementPrototype.append = function(...newChildren) {
newChildren.forEach((newChild) => {
if (typeof newChild === "string") {
newChild = this.ownerDocument.createTextNode(newChild);
}
this.appendChild(newChild);
});
};
};
var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
HostElementPrototype.insertAdjacentHTML = function(position, text) {
if (position !== "afterbegin" && position !== "beforeend") {
return originalInsertAdjacentHtml.call(this, position, text);
}
const container = this.ownerDocument.createElement("_");
let node;
container.innerHTML = text;
if (position === "afterbegin") {
while (node = container.firstChild) {
this.prepend(node);
}
} else if (position === "beforeend") {
while (node = container.firstChild) {
this.append(node);
}
}
};
};
var patchSlotInsertAdjacentText = (HostElementPrototype) => {
HostElementPrototype.insertAdjacentText = function(position, text) {
this.insertAdjacentHTML(position, text);
};
};
var patchInsertBefore = (HostElementPrototype) => {
const eleProto = HostElementPrototype;
if (eleProto.__insertBefore) return;
eleProto.__insertBefore = HostElementPrototype.insertBefore;
HostElementPrototype.insertBefore = function(newChild, currentChild) {
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
if (slotNode) {
let found = false;
slottedNodes.forEach((childNode) => {
if (childNode === currentChild || currentChild === null) {
found = true;
if (currentChild === null || slotName !== currentChild["s-sn"]) {
this.appendChild(newChild);
return;
}
if (slotName === currentChild["s-sn"]) {
addSlotRelocateNode(newChild, slotNode);
const parent = internalCall(currentChild, "parentNode");
internalCall(parent, "insertBefore")(newChild, currentChild);
dispatchSlotChangeEvent(slotNode);
}
return;
}
});
if (found) return newChild;
}
const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
if (parentNode && !this.isSameNode(parentNode)) {
return this.appendChild(newChild);
}
return this.__insertBefore(newChild, currentChild);
};
};
var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
HostElementPrototype.insertAdjacentElement = function(position, element) {
if (position !== "afterbegin" && position !== "beforeend") {
return originalInsertAdjacentElement.call(this, position, element);
}
if (position === "afterbegin") {
this.prepend(element);
return element;
} else if (position === "beforeend") {
this.append(element);
return element;
}
return element;
};
};
var patchTextContent = (hostElementPrototype) => {
patchHostOriginalAccessor("textContent", hostElementPrototype);
Object.defineProperty(hostElementPrototype, "textContent", {
get: function() {
let text = "";
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
childNodes.forEach((node) => text += node.textContent || "");
return text;
},
set: function(value) {
const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
childNodes.forEach((node) => {
if (node["s-ol"]) node["s-ol"].remove();
node.remove();
});
this.insertAdjacentHTML("beforeend", value);
}
});
};
var patchChildSlotNodes = (elm) => {
class FakeNodeList extends Array {
item(n) {
return this[n];
}
}
patchHostOriginalAccessor("children", elm);
Object.defineProperty(elm, "children", {
get() {
return this.childNodes.filter((n) => n.nodeType === 1);
}
});
Object.defineProperty(elm, "childElementCount", {
get() {
return this.children.length;
}
});
patchHostOriginalAccessor("firstChild", elm);
Object.defineProperty(elm, "firstChild", {
get() {
return this.childNodes[0];
}
});
patchHostOriginalAccessor("lastChild", elm);
Object.defineProperty(elm, "lastChild", {
get() {
return this.childNodes[this.childNodes.length - 1];
}
});
patchHostOriginalAccessor("childNodes", elm);
Object.defineProperty(elm, "childNodes", {
get() {
const result = new FakeNodeList();
result.push(...getSlottedChildNodes(this.__childNodes));
return result;
}
});
};
var patchSlottedNode = (node) => {
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
patchNextSibling(node);
patchPreviousSibling(node);
patchParentNode(node);
if (node.nodeType === Node.ELEMENT_NODE) {
patchNextElementSibling(node);
patchPreviousElementSibling(node);
}
};
var patchNextSibling = (node) => {
if (!node || node.__nextSibling) return;
patchHostOriginalAccessor("nextSibling", node);
Object.defineProperty(node, "nextSibling", {
get: function() {
var _a;
const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
if (parentNodes && index > -1) {
return parentNodes[index + 1];
}
return this.__nextSibling;
}
});
};
var patchNextElementSibling = (element) => {
if (!element || element.__nextElementSibling) return;
patchHostOriginalAccessor("nextElementSibling", element);
Object.defineProperty(element, "nextElementSibling", {
get: function() {
var _a;
const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
const index = parentEles == null ? void 0 : parentEles.indexOf(this);
if (parentEles && index > -1) {
return parentEles[index + 1];
}
return this.__nextElementSibling;
}
});
};
var patchPreviousSibling = (node) => {
if (!node || node.__previousSibling) return;
patchHostOriginalAccessor("previousSibling", node);
Object.defineProperty(node, "previousSibling", {
get: function() {
var _a;
const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
if (parentNodes && index > -1) {
return parentNodes[index - 1];
}
return this.__previousSibling;
}
});
};
var patchPreviousElementSibling = (element) => {
if (!element || element.__previousElementSibling) return;
patchHostOriginalAccessor("previousElementSibling", element);
Object.defineProperty(element, "previousElementSibling", {
get: function() {
var _a;
const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
if (parentNodes && index > -1) {
return parentNodes[index - 1];
}
return this.__previousElementSibling;
}
});
};
var patchParentNode = (node) => {
if (!node || node.__parentNode) return;
patchHostOriginalAccessor("parentNode", node);
Object.defineProperty(node, "parentNode", {
get: function() {
var _a;
return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
},
set: function(value) {
this.__parentNode = value;
}
});
};
var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
var validNodesPatches = [
"childNodes",
"firstChild",
"lastChild",
"nextSibling",
"previousSibling",
"textContent",
"parentNode"
];
function patchHostOriginalAccessor(accessorName, node) {
let accessor;
if (validElementPatches.includes(accessorName)) {
accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
} else if (validNodesPatches.includes(accessorName)) {
accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
}
if (!accessor) {
accessor = Object.getOwnPropertyDescriptor(node, accessorName);
}
if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
}
function internalCall(node, method) {
if ("__" + method in node) {
const toReturn = node["__" + method];
if (typeof toReturn !== "function") return toReturn;
return toReturn.bind(node);
} else {
if (typeof node[method] !== "function") return node[method];
return node[method].bind(node);
}
}
var createTime = (fnName, tagName = "") => {
{
return () => {
return;
};
}
};
var uniqueTime = (key, measureText) => {
{
return () => {
return;
};
}
};
var h = (nodeName, vnodeData, ...children) => {
let child = null;
let key = null;
let slotName = null;
let simple = false;
let lastSimple = false;
const vNodeChildren = [];
const walk = (c) => {
for (let i2 = 0; i2 < c.length; i2++) {
child = c[i2];
if (Array.isArray(child)) {
walk(child);
} else if (child != null && typeof child !== "boolean") {
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
child = String(child);
}
if (simple && lastSimple) {
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
} else {
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
if (vnodeData.key) {
key = vnodeData.key;
}
if (vnodeData.name) {
slotName = vnodeData.name;
}
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
}
}
}
if (typeof nodeName === "function") {
return nodeName(
vnodeData === null ? {} : vnodeData,
vNodeChildren,
vdomFnUtils
);
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
{
vnode.$key$ = key;
}
{
vnode.$name$ = slotName;
}
return vnode;
};
var newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
{
vnode.$key$ = null;
}
{
vnode.$name$ = null;
}
return vnode;
};
var Host = {};
var isHost = (node) => node && node.$tag$ === Host;
var vdomFnUtils = {
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
};
var convertToPublic = (node) => ({
vattrs: node.$attrs$,
vchildren: node.$children$,
vkey: node.$key$,
vname: node.$name$,
vtag: node.$tag$,
vtext: node.$text$
});
var convertToPrivate = (node) => {
if (typeof node.vtag === "function") {
const vnodeData = { ...node.vattrs };
if (node.vkey) {
vnodeData.key = node.vkey;
}
if (node.vname) {
vnodeData.name = node.vname;
}
return h(node.vtag, vnodeData, ...node.vchildren || []);
}
const vnode = newVNode(node.vtag, node.vtext);
vnode.$attrs$ = node.vattrs;
vnode.$children$ = node.vchildren;
vnode.$key$ = node.vkey;
vnode.$name$ = node.vname;
return vnode;
};
// src/runtime/client-hydrate.ts
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
var _a;
const endHydrate = createTime("hydrateClient", tagName);
const shadowRoot = hostElm.shadowRoot;
const childRenderNodes = [];
const slotNodes = [];
const slottedNodes = [];
const shadowRootNodes = shadowRoot ? [] : null;
const vnode = newVNode(tagName, null);
vnode.$elm$ = hostElm;
const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
var _a2;
if (!(memberFlags & 31 /* Prop */)) {
return;
}
const attributeName = metaAttributeName || memberName;
const attrVal = hostElm.getAttribute(attributeName);
if (attrVal !== null) {
const attrPropVal = parsePropertyValue(attrVal, memberFlags);
(_a2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a2.set(memberName, attrPropVal);
}
});
let scopeId2;
{
const cmpMeta = hostRef.$cmpMeta$;
if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
scopeId2 = hostElm["s-sc"];
hostElm.classList.add(scopeId2 + "-h");
} else if (hostElm["s-sc"]) {
delete hostElm["s-sc"];
}
}
if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
}
hostElm[HYDRATE_ID] = hostId;
hostElm.removeAttribute(HYDRATE_ID);
hostRef.$vnode$ = clientHydrate(
vnode,
childRenderNodes,
slotNodes,
shadowRootNodes,
hostElm,
hostElm,
hostId,
slottedNodes
);
let crIndex = 0;
const crLength = childRenderNodes.length;
let childRenderNode;
for (crIndex; crIndex < crLength; crIndex++) {
childRenderNode = childRenderNodes[crIndex];
const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
const node = childRenderNode.$elm$;
if (!shadowRoot) {
node["s-hn"] = tagName.toUpperCase();
if (childRenderNode.$tag$ === "slot") {
node["s-cr"] = hostElm["s-cr"];
}
}
if (childRenderNode.$tag$ === "slot") {
childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
if (childRenderNode.$children$) {
childRenderNode.$flags$ |= 2 /* isSlotFallback */;
if (!childRenderNode.$elm$.childNodes.length) {
childRenderNode.$children$.forEach((c) => {
childRenderNode.$elm$.appendChild(c.$elm$);
});
}
} else {
childRenderNode.$flags$ |= 1 /* isSlotReference */;
}
}
if (orgLocationNode && orgLocationNode.isConnected) {
if (shadowRoot && orgLocationNode["s-en"] === "") {
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
}
orgLocationNode.parentNode.removeChild(orgLocationNode);
if (!shadowRoot) {
node["s-oo"] = parseInt(childRenderNode.$nodeId$);
}
}
plt.$orgLocNodes$.delete(orgLocationId);
}
const hosts = [];
const snLen = slottedNodes.length;
let snIndex = 0;
let slotGroup;
let snGroupIdx;
let snGroupLen;
let slottedItem;
for (snIndex; snIndex < snLen; snIndex++) {
slotGroup = slottedNodes[snIndex];
if (!slotGroup || !slotGroup.length) continue;
snGroupLen = slotGroup.length;
snGroupIdx = 0;
for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
slottedItem = slotGroup[snGroupIdx];
if (!hosts[slottedItem.hostId]) {
hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
}
if (!hosts[slottedItem.hostId]) continue;
const hostEle = hosts[slottedItem.hostId];
if (!hostEle.shadowRoot || !shadowRoot) {
slottedItem.slot["s-cr"] = hostEle["s-cr"];
if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
slottedItem.slot["s-cr"] = hostEle;
} else {
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
}
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
{
patchSlottedNode(slottedItem.node);
}
}
if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
hostEle.appendChild(slottedItem.node);
}
}
}
if (scopeId2 && slotNodes.length) {
slotNodes.forEach((slot) => {
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
});
}
if (shadowRoot && !shadowRoot.childNodes.length) {
let rnIdex = 0;
const rnLen = shadowRootNodes.length;
if (rnLen) {
for (rnIdex; rnIdex < rnLen; rnIdex++) {
shadowRoot.appendChild(shadowRootNodes[rnIdex]);
}
Array.from(hostElm.childNodes).forEach((node) => {
if (typeof node["s-sn"] !== "string") {
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
node.removeAttribute("hidden");
} else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
node.parentNode.removeChild(node);
}
}
});
}
}
plt.$orgLocNodes$.delete(hostElm["s-id"]);
hostRef.$hostElement$ = hostElm;
endHydrate();
};
var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
let childNodeType;
let childIdSplt;
let childVNode;
let i2;
const scopeId2 = hostElm["s-sc"];
if (node.nodeType === 1 /* ElementNode */) {
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
if (childNodeType) {
childIdSplt = childNodeType.split(".");
if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
childVNode = createSimpleVNode({
$flags$: 0,
$hostId$: childIdSplt[0],
$nodeId$: childIdSplt[1],
$depth$: childIdSplt[2],
$index$: childIdSplt[3],
$tag$: node.tagName.toLowerCase(),
$elm$: node,
// If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
// won't try to reconcile them. Classes set on the node will be blown away.
$attrs$: { class: node.className || "" }
});
childRenderNodes.push(childVNode);
node.removeAttribute(HYDRATE_CHILD_ID);
if (!parentVNode.$children$) {
parentVNode.$children$ = [];
}
if (scopeId2) {
node["s-si"] = scopeId2;
childVNode.$attrs$.class += " " + scopeId2;
}
const slotName = childVNode.$elm$.getAttribute("s-sn");
if (typeof slotName === "string") {
if (childVNode.$tag$ === "slot-fb") {
addSlot(
slotName,
childIdSplt[2],
childVNode,
node,
parentVNode,
childRenderNodes,
slotNodes,
shadowRootNodes,
slottedNodes
);
if (scopeId2) {
node.classList.add(scope