/*! * (C) Ionic http://ionicframework.com - MIT License */ 'use strict'; var stream = require('stream'); const modeResolutionChain = []; function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) { var globalThis = $stencilWindow; var self = $stencilWindow; var top = $stencilWindow; var parent = $stencilWindow; var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow); var alert = $stencilWindow.alert.bind($stencilWindow); var blur = $stencilWindow.blur.bind($stencilWindow); var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow); var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow); var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow); var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow); var close = () => {}; var confirm = $stencilWindow.confirm.bind($stencilWindow); var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow); var focus = $stencilWindow.focus.bind($stencilWindow); var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow); var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow); var open = $stencilWindow.open.bind($stencilWindow); var prompt = $stencilWindow.prompt.bind($stencilWindow); var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow); var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow); var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow); var setInterval = $stencilWindow.setInterval.bind($stencilWindow); var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow); var CharacterData = $stencilWindow.CharacterData; var CSS = $stencilWindow.CSS; var CustomEvent = $stencilWindow.CustomEvent; var CSSStyleSheet = $stencilWindow.CSSStyleSheet; var Document = $stencilWindow.Document; var ShadowRoot = $stencilWindow.ShadowRoot; var DocumentFragment = $stencilWindow.DocumentFragment; var DocumentType = $stencilWindow.DocumentType; var DOMTokenList = $stencilWindow.DOMTokenList; var Element = $stencilWindow.Element; var Event = $stencilWindow.Event; var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement; var HTMLBaseElement = $stencilWindow.HTMLBaseElement; var HTMLButtonElement = $stencilWindow.HTMLButtonElement; var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement; var HTMLElement = $stencilWindow.HTMLElement; var HTMLFormElement = $stencilWindow.HTMLFormElement; var HTMLImageElement = $stencilWindow.HTMLImageElement; var HTMLInputElement = $stencilWindow.HTMLInputElement; var HTMLLinkElement = $stencilWindow.HTMLLinkElement; var HTMLMetaElement = $stencilWindow.HTMLMetaElement; var HTMLScriptElement = $stencilWindow.HTMLScriptElement; var HTMLStyleElement = $stencilWindow.HTMLStyleElement; var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement; var HTMLTitleElement = $stencilWindow.HTMLTitleElement; var IntersectionObserver = $stencilWindow.IntersectionObserver; var ResizeObserver = $stencilWindow.ResizeObserver; var KeyboardEvent = $stencilWindow.KeyboardEvent; var MouseEvent = $stencilWindow.MouseEvent; var Node = $stencilWindow.Node; var NodeList = $stencilWindow.NodeList; var URL = $stencilWindow.URL; var console = $stencilWindow.console; var customElements = $stencilWindow.customElements; var history = $stencilWindow.history; var localStorage = $stencilWindow.localStorage; var location = $stencilWindow.location; var navigator = $stencilWindow.navigator; var performance = $stencilWindow.performance; var sessionStorage = $stencilWindow.sessionStorage; var devicePixelRatio = $stencilWindow.devicePixelRatio; var innerHeight = $stencilWindow.innerHeight; var innerWidth = $stencilWindow.innerWidth; var origin = $stencilWindow.origin; var pageXOffset = $stencilWindow.pageXOffset; var pageYOffset = $stencilWindow.pageYOffset; var screen = $stencilWindow.screen; var screenLeft = $stencilWindow.screenLeft; var screenTop = $stencilWindow.screenTop; var screenX = $stencilWindow.screenX; var screenY = $stencilWindow.screenY; var scrollX = $stencilWindow.scrollX; var scrollY = $stencilWindow.scrollY; var exports = {}; var fetch, FetchError, Headers, Request, Response; if (typeof $stencilWindow.fetch === 'function') { fetch = $stencilWindow.fetch; } else { fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); }; } if (typeof $stencilWindow.FetchError === 'function') { FetchError = $stencilWindow.FetchError; } else { FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } }; } if (typeof $stencilWindow.Headers === 'function') { Headers = $stencilWindow.Headers; } else { Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } }; } if (typeof $stencilWindow.Request === 'function') { Request = $stencilWindow.Request; } else { Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } }; } if (typeof $stencilWindow.Response === 'function') { Response = $stencilWindow.Response; } else { Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } }; } function hydrateAppClosure($stencilWindow) { const window = $stencilWindow; const document = $stencilWindow.document; /*hydrateAppClosure start*/ const NAMESPACE = 'ionic'; const BUILD = /* ionic */ { hydratedSelectorName: "hydrated", 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'; var LogLevel; (function (LogLevel) { LogLevel["OFF"] = "OFF"; LogLevel["ERROR"] = "ERROR"; LogLevel["WARN"] = "WARN"; })(LogLevel || (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', LogLevel.WARN); if ([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', LogLevel.ERROR); if ([LogLevel.ERROR, 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$1(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$1 = (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$1 = (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 // 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; /* Stencil Hydrate Platform v4.38.0 | 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 }); }; // 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/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)))); } // src/utils/style.ts function createStyleSheetIfNeededAndSupported(styles2) { return void 0; } // src/utils/shadow-root.ts var globalStyleSheet; function createShadowRoot(cmpMeta) { var _a; const shadowRoot = this.attachShadow({ mode: "open", delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */) }) ; if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null; if (globalStyleSheet) { { shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet]; } } } // 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 STENCIL_DOC_DATA = "_stencilDocData"; var DEFAULT_DOC_DATA = { hostIds: 0, rootLevelIds: 0, staticComponents: /* @__PURE__ */ new Set() }; var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}"; var XLINK_NS = "http://www.w3.org/1999/xlink"; // src/runtime/slot-polyfill-utils.ts 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)) { slottedNodes.push(childNode); } 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 = 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 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 rootAppliedStyles = /* @__PURE__ */ new WeakMap(); var registerStyle = (scopeId2, cssText, allowCS) => { let style = styles.get(scopeId2); { style = cssText; } styles.set(scopeId2, style); }; var addStyle = (styleContainerNode, cmpMeta, mode) => { var _a; const scopeId2 = getScopeId(cmpMeta, mode); const style = styles.get(scopeId2); if (!win$2.document) { return scopeId2; } styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win$2.document; if (style) { if (typeof style === "string") { styleContainerNode = styleContainerNode.head || styleContainerNode; let appliedStyles = rootAppliedStyles.get(styleContainerNode); let styleElm; if (!appliedStyles) { rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set()); } if (!appliedStyles.has(scopeId2)) { if (styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) { styleElm.innerHTML = style; } else { styleElm = win$2.document.createElement("style"); styleElm.innerHTML = style; const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win$2.document); if (nonce != null) { styleElm.setAttribute("nonce", nonce); } if ((cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) { styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2); } if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) { if (styleContainerNode.nodeName === "HEAD") { const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]"); const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style"); styleContainerNode.insertBefore( styleElm, (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null ); } else if ("host" in styleContainerNode) { { const existingStyleContainer = styleContainerNode.querySelector("style"); if (existingStyleContainer) { existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML; } else { styleContainerNode.prepend(styleElm); } } } else { styleContainerNode.append(styleElm); } } if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) { styleContainerNode.insertBefore(styleElm, null); } } if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) { styleElm.innerHTML += SLOT_FB_CSS; } if (appliedStyles) { appliedStyles.add(scopeId2); } } } } return scopeId2; }; var attachStyles = (hostRef) => { const cmpMeta = hostRef.$cmpMeta$; const elm = hostRef.$hostElement$; const flags = cmpMeta.$flags$; const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$); const scopeId2 = addStyle( elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$ ); if (flags & 10 /* needsScopedEncapsulation */) { elm["s-sc"] = scopeId2; elm.classList.add(scopeId2 + "-h"); } endAttachStyles(); }; var getScopeId = (cmp, mode) => "sc-" + (mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$); 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, _b; 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; 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$2.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) { initializeDocumentHydrate(win$2.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"]; } } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) { const cmpMeta = getHostRef(childRenderNode.$elm$); if (cmpMeta) { const scopeId3 = getScopeId( cmpMeta.$cmpMeta$, childRenderNode.$elm$.getAttribute("s-mode") ); const styleSheet = win$2.document.querySelector(`style[sty-id="${scopeId3}"]`); if (styleSheet) { hostElm.shadowRoot.append(styleSheet.cloneNode(true)); } } } 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 (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") { orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling); } orgLocationNode.parentNode.removeChild(orgLocationNode); if (!shadowRoot) { node["s-oo"] = parseInt(childRenderNode.$nodeId$); } } if (orgLocationNode && !orgLocationNode["s-id"]) { 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 && slottedItem.node.parentElement !== hostEle) { hostEle.appendChild(slottedItem.node); } if (!hostEle.shadowRoot || !shadowRoot) { if (!slottedItem.slot["s-cr"]) { 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"]); if (((_b = slottedItem.node.parentElement) == null ? void 0 : _b.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) { slottedItem.node.removeAttribute("slot"); } } } } if (scopeId2 && slotNodes.length) { slotNodes.forEach((slot) => { slot.$elm$.parentElement.classList.add(scopeId2 + "-s"); }); } if (shadowRoot) { let rnIdex = 0; const rnLen = shadowRootNodes.length; if (rnLen) { for (rnIdex; rnIdex < rnLen; rnIdex++) { const node = shadowRootNodes[rnIdex]; if (node) { shadowRoot.appendChild(node); } } Array.from(hostElm.childNodes).forEach((node) => { if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") { if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) { node.removeAttribute("hidden"); } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) { node.parentNode.removeChild(node); } } }); } } 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 && childIdSplt[0] === hostId) { 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(scopeId2); } } childVNode.$elm$["s-sn"] = slotName; childVNode.$elm$.removeAttribute("s-sn"); } if (childVNode.$index$ !== void 0) { parentVNode.$children$[childVNode.$index$] = childVNode; } parentVNode = childVNode; if (shadowRootNodes && childVNode.$depth$ === "0") { shadowRootNodes[childVNode.$index$] = childVNode.$elm$; } } } if (node.shadowRoot) { for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) { clientHydrate( parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i2], hostId, slottedNodes ); } } const nonShadowNodes = node.__childNodes || node.childNodes; for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) { clientHydrate( parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, nonShadowNodes[i2], hostId, slottedNodes ); } } else if (node.nodeType === 8 /* CommentNode */) { childIdSplt = node.nodeValue.split("."); if (childIdSplt[1] === hostId || childIdSplt[1] === "0") { childNodeType = childIdSplt[0]; childVNode = createSimpleVNode({ $hostId$: childIdSplt[1], $nodeId$: childIdSplt[2], $depth$: childIdSplt[3], $index$: childIdSplt[4] || "0", $elm$: node, $attrs$: null, $children$: null, $key$: null, $name$: null, $tag$: null, $text$: null }); if (childNodeType === TEXT_NODE_ID) { childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */); if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) { childVNode.$text$ = childVNode.$elm$.textContent; childRenderNodes.push(childVNode); node.remove(); if (hostId === childVNode.$hostId$) { if (!parentVNode.$children$) { parentVNode.$children$ = []; } parentVNode.$children$[childVNode.$index$] = childVNode; } if (shadowRootNodes && childVNode.$depth$ === "0") { shadowRootNodes[childVNode.$index$] = childVNode.$elm$; } } } else if (childNodeType === COMMENT_NODE_ID) { childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */); if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) { childRenderNodes.push(childVNode); node.remove(); } } else if (childVNode.$hostId$ === hostId) { if (childNodeType === SLOT_NODE_ID) { const slotName = node["s-sn"] = childIdSplt[5] || ""; addSlot( slotName, childIdSplt[2], childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes ); } else if (childNodeType === CONTENT_REF_ID) { if (shadowRootNodes) { node.remove(); } else { hostElm["s-cr"] = node; node["s-cn"] = true; } } } } } else if (parentVNode && parentVNode.$tag$ === "style") { const vnode = newVNode(null, node.textContent); vnode.$elm$ = node; vnode.$index$ = "0"; parentVNode.$children$ = [vnode]; } else { if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) { node.remove(); } } return parentVNode; }; var initializeDocumentHydrate = (node, orgLocNodes) => { if (node.nodeType === 1 /* ElementNode */) { const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID); if (componentId) { orgLocNodes.set(componentId, node); } let i2 = 0; if (node.shadowRoot) { for (; i2 < node.shadowRoot.childNodes.length; i2++) { initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes); } } const nonShadowNodes = node.__childNodes || node.childNodes; for (i2 = 0; i2 < nonShadowNodes.length; i2++) { initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes); } } else if (node.nodeType === 8 /* CommentNode */) { const childIdSplt = node.nodeValue.split("."); if (childIdSplt[0] === ORG_LOCATION_ID) { orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node); node.nodeValue = ""; node["s-en"] = childIdSplt[3]; } } }; var createSimpleVNode = (vnode) => { const defaultVNode = { $flags$: 0, $hostId$: null, $nodeId$: null, $depth$: null, $index$: "0", $elm$: null, $attrs$: null, $children$: null, $key$: null, $name$: null, $tag$: null, $text$: null }; return { ...defaultVNode, ...vnode }; }; function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) { node["s-sr"] = true; childVNode.$name$ = slotName || null; childVNode.$tag$ = "slot"; const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : ""; if (shadowRootNodes && win$2.document) { const slot = childVNode.$elm$ = win$2.document.createElement(childVNode.$tag$); if (childVNode.$name$) { childVNode.$elm$.setAttribute("name", slotName); } if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) { internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]); } else { internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node); } addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$); node.remove(); if (childVNode.$depth$ === "0") { shadowRootNodes[childVNode.$index$] = childVNode.$elm$; } } else { const slot = childVNode.$elm$; const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot; addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$); patchSlotNode(node); if (shouldMove) { parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]); } } childRenderNodes.push(childVNode); slotNodes.push(childVNode); if (!parentVNode.$children$) { parentVNode.$children$ = []; } parentVNode.$children$[childVNode.$index$] = childVNode; } var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => { var _a, _b; let slottedNode = slotNode.nextSibling; slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || []; if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return; do { if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) { slottedNode["s-sn"] = slotName; slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId }); } slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling; } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + "."))); }; var findCorrespondingNode = (node, type) => { let sibling = node; do { sibling = sibling.nextSibling; } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue)); return sibling; }; // src/utils/shadow-css.ts /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license * * This file is a port of shadowCSS from `webcomponents.js` to TypeScript. * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts */ var safeSelector = (selector) => { const placeholders = []; let index = 0; selector = selector.replace(/(\[\s*part~=\s*("[^"]*"|'[^']*')\s*\])/g, (_, keep) => { const replaceBy = `__part-${index}__`; placeholders.push(keep); index++; return replaceBy; }); selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => { const replaceBy = `__ph-${index}__`; placeholders.push(keep); index++; return replaceBy; }); const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => { const replaceBy = `__ph-${index}__`; placeholders.push(exp); index++; return pseudo + replaceBy; }); const ss = { content, placeholders }; return ss; }; var restoreSafeSelector = (placeholders, content) => { content = content.replace(/__part-(\d+)__/g, (_, index) => placeholders[+index]); return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]); }; var _polyfillHost = "-shadowcsshost"; var _polyfillSlotted = "-shadowcssslotted"; var _polyfillHostContext = "-shadowcsscontext"; var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)"; var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim"); var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim"); var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim"); var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator"; var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g]; var _safePartRe = /__part-(\d+)__/g; var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$"; var _polyfillHostRe = /-shadowcsshost/gim; var createSupportsRuleRe = (selector) => { const safeSelector2 = escapeRegExpSpecialCharacters(selector); return new RegExp( // First capture group: match any context before the selector that's not inside @supports selector() // Using negative lookahead to avoid matching inside @supports selector(...) condition `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`, "g" ); }; var _colonSlottedRe = createSupportsRuleRe("::slotted"); var _colonHostRe = createSupportsRuleRe(":host"); var _colonHostContextRe = createSupportsRuleRe(":host-context"); var _commentRe = /\/\*\s*[\s\S]*?\*\//g; var stripComments = (input) => { return input.replace(_commentRe, ""); }; var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; var extractCommentsWithHash = (input) => { return input.match(_commentWithHashRe) || []; }; var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; var _curlyRe = /([{}])/g; var _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/; var OPEN_CURLY = "{"; var CLOSE_CURLY = "}"; var BLOCK_PLACEHOLDER = "%BLOCK%"; var processRules = (input, ruleCallback) => { const inputWithEscapedBlocks = escapeBlocks(input); let nextBlockIndex = 0; return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => { const selector = m[2]; let content = ""; let suffix = m[4]; let contentPrefix = ""; if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) { content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); contentPrefix = "{"; } const cssRule = { selector, content }; const rule = ruleCallback(cssRule); return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`; }); }; var escapeBlocks = (input) => { const inputParts = input.split(_curlyRe); const resultParts = []; const escapedBlocks = []; let bracketCount = 0; let currentBlockParts = []; for (let partIndex = 0; partIndex < inputParts.length; partIndex++) { const part = inputParts[partIndex]; if (part === CLOSE_CURLY) { bracketCount--; } if (bracketCount > 0) { currentBlockParts.push(part); } else { if (currentBlockParts.length > 0) { escapedBlocks.push(currentBlockParts.join("")); resultParts.push(BLOCK_PLACEHOLDER); currentBlockParts = []; } resultParts.push(part); } if (part === OPEN_CURLY) { bracketCount++; } } if (currentBlockParts.length > 0) { escapedBlocks.push(currentBlockParts.join("")); resultParts.push(BLOCK_PLACEHOLDER); } const strEscapedBlocks = { escapedString: resultParts.join(""), blocks: escapedBlocks }; return strEscapedBlocks; }; var insertPolyfillHostInCssText = (cssText) => { const supportsBlocks = []; cssText = cssText.replace(/@supports\s+selector\s*\(\s*([^)]*)\s*\)/g, (_, selectorContent) => { const placeholder = `__supports_${supportsBlocks.length}__`; supportsBlocks.push(selectorContent); return `@supports selector(${placeholder})`; }); cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`); supportsBlocks.forEach((originalSelector, index) => { cssText = cssText.replace(`__supports_${index}__`, originalSelector); }); return cssText; }; var convertColonRule = (cssText, regExp, partReplacer) => { return cssText.replace(regExp, (...m) => { if (m[2]) { const parts = m[2].split(","); const r = []; for (let i2 = 0; i2 < parts.length; i2++) { const p = parts[i2].trim(); if (!p) break; r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); } return r.join(","); } else { return _polyfillHostNoCombinator + m[3]; } }); }; var colonHostPartReplacer = (host, part, suffix) => { return host + part.replace(_polyfillHost, "") + suffix; }; var convertColonHost = (cssText) => { return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer); }; var colonHostContextPartReplacer = (host, part, suffix) => { if (part.indexOf(_polyfillHost) > -1) { return colonHostPartReplacer(host, part, suffix); } else { return host + part + suffix + ", " + part + " " + host + suffix; } }; var convertColonSlotted = (cssText, slotScopeId) => { const slotClass = "." + slotScopeId + " > "; const selectors = []; cssText = cssText.replace(_cssColonSlottedRe, (...m) => { if (m[2]) { const compound = m[2].trim(); const suffix = m[3]; const slottedSelector = slotClass + compound + suffix; let prefixSelector = ""; for (let i2 = m[4] - 1; i2 >= 0; i2--) { const char = m[5][i2]; if (char === "}" || char === ",") { break; } prefixSelector = char + prefixSelector; } const orgSelector = (prefixSelector + slottedSelector).trim(); const addedSelector = `${prefixSelector.trimEnd()}${slottedSelector.trim()}`.trim(); if (orgSelector !== addedSelector) { const updatedSelector = `${addedSelector}, ${orgSelector}`; selectors.push({ orgSelector, updatedSelector }); } return slottedSelector; } else { return _polyfillHostNoCombinator + m[3]; } }); return { selectors, cssText }; }; var convertColonHostContext = (cssText) => { return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer); }; var convertShadowDOMSelectors = (cssText) => { return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText); }; var makeScopeMatcher = (scopeSelector2) => { const lre = /\[/g; const rre = /\]/g; scopeSelector2 = scopeSelector2.replace(lre, "\\[").replace(rre, "\\]"); return new RegExp("^(" + scopeSelector2 + ")" + _selectorReSuffix, "m"); }; var selectorNeedsScoping = (selector, scopeSelector2) => { const re = makeScopeMatcher(scopeSelector2); return !re.test(selector); }; var injectScopingSelector = (selector, scopingSelector) => { return selector.replace(_selectorPartsRe, (_, before = "", _colonGroup, colon = "", after = "") => { return before + scopingSelector + colon + after; }); }; var applySimpleSelectorScope = (selector, scopeSelector2, hostSelector) => { _polyfillHostRe.lastIndex = 0; if (_polyfillHostRe.test(selector)) { const replaceBy = `.${hostSelector}`; return selector.replace(_polyfillHostNoCombinatorRe, (_, selector2) => injectScopingSelector(selector2, replaceBy)).replace(_polyfillHostRe, replaceBy + " "); } return scopeSelector2 + " " + selector; }; var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => { const isRe = /\[is=([^\]]*)\]/g; scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]); const className = "." + scopeSelector2; const _scopeSelectorPart = (p) => { let scopedP = p.trim(); if (!scopedP) { return ""; } if (p.indexOf(_polyfillHostNoCombinator) > -1) { scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector); } else { const t = p.replace(_polyfillHostRe, ""); if (t.length > 0) { scopedP = injectScopingSelector(t, className); } } return scopedP; }; const safeContent = safeSelector(selector); selector = safeContent.content; let scopedSelector = ""; let startIndex = 0; let res; const sep = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g; const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; let shouldScope = !hasHost; while ((res = sep.exec(selector)) !== null) { const separator = res[1]; const part2 = selector.slice(startIndex, res.index).trim(); shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1; const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2; scopedSelector += `${scopedPart} ${separator} `; startIndex = sep.lastIndex; } const part = selector.substring(startIndex); shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1); scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; return restoreSafeSelector(safeContent.placeholders, scopedSelector); }; var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => { return selector.split(",").map((shallowPart) => { if (slotSelector && shallowPart.indexOf("." + slotSelector) > -1) { return shallowPart.trim(); } if (selectorNeedsScoping(shallowPart, scopeSelectorText)) { return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim(); } else { return shallowPart.trim(); } }).join(", "); }; var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => { return processRules(cssText, (rule) => { let selector = rule.selector; let content = rule.content; if (rule.selector[0] !== "@") { selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector); } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) { content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector); } const cssRule = { selector: selector.replace(/\s{2,}/g, " ").trim(), content }; return cssRule; }); }; var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector) => { cssText = insertPolyfillHostInCssText(cssText); cssText = convertColonHost(cssText); cssText = convertColonHostContext(cssText); const slotted = convertColonSlotted(cssText, slotScopeId); cssText = slotted.cssText; cssText = convertShadowDOMSelectors(cssText); if (scopeId2) { cssText = scopeSelectors(cssText, scopeId2, hostScopeId, slotScopeId); } cssText = replaceShadowCssHost(cssText, hostScopeId); cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 "); return { cssText: cssText.trim(), // We need to replace the shadow CSS host string in each of these selectors since we created // them prior to the replacement happening in the components CSS text. slottedSelectors: slotted.selectors.map((ref) => ({ orgSelector: replaceShadowCssHost(ref.orgSelector, hostScopeId), updatedSelector: replaceShadowCssHost(ref.updatedSelector, hostScopeId) })) }; }; var replaceShadowCssHost = (cssText, hostScopeId) => { return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`); }; var expandPartSelectors = (cssText) => { const partSelectorRe = /([^\s,{][^,{]*?)::part\(\s*([^)]+?)\s*\)((?:[:.][^,{]*)*)/g; return processRules(cssText, (rule) => { if (rule.selector[0] === "@") { return rule; } const selectors = rule.selector.split(",").map((sel) => { const out = [sel.trim()]; let m; while ((m = partSelectorRe.exec(sel)) !== null) { const before = m[1].trimEnd(); const partNames = m[2].trim().split(/\s+/); const after = m[3] || ""; const partAttr = partNames.flatMap((p) => { if (!rule.selector.includes(`[part~="${p}"]`)) { return [`[part~="${p}"]`]; } return []; }).join(""); const expanded = `${before} ${partAttr}${after}`; if (!!partAttr && expanded !== sel.trim()) { out.push(expanded); } } return out.join(", "); }); rule.selector = selectors.join(", "); return rule; }); }; var scopeCss = (cssText, scopeId2, commentOriginalSelector) => { const hostScopeId = scopeId2 + "-h"; const slotScopeId = scopeId2 + "-s"; const commentsWithHash = extractCommentsWithHash(cssText); cssText = stripComments(cssText); const orgSelectors = []; { const processCommentedSelector = (rule) => { const placeholder = `/*!@___${orgSelectors.length}___*/`; const comment = `/*!@${rule.selector}*/`; orgSelectors.push({ placeholder, comment }); rule.selector = placeholder + rule.selector; return rule; }; cssText = processRules(cssText, (rule) => { if (rule.selector[0] !== "@") { return processCommentedSelector(rule); } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) { rule.content = processRules(rule.content, processCommentedSelector); return rule; } return rule; }); } const scoped = scopeCssText(cssText, scopeId2, hostScopeId, slotScopeId); cssText = [scoped.cssText, ...commentsWithHash].join("\n"); { orgSelectors.forEach(({ placeholder, comment }) => { cssText = cssText.replace(placeholder, comment); }); } scoped.slottedSelectors.forEach((slottedSelector) => { const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g"); cssText = cssText.replace(regex, slottedSelector.updatedSelector); }); cssText = expandPartSelectors(cssText); return cssText; }; // src/runtime/mode.ts var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m); var setMode = (handler) => modeResolutionChain.push(handler); var getMode = (ref) => { var _a; return (_a = getHostRef(ref)) == null ? void 0 : _a.$modeName$; }; var parsePropertyValue = (propValue, propType, isFormAssociated) => { if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) { propValue = deserializeProperty(propValue); return propValue; } if (propValue != null && !isComplexType(propValue)) { if (propType & 4 /* Boolean */) { { return propValue === "false" ? false : propValue === "" || !!propValue; } } if (propType & 2 /* Number */) { return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN; } if (propType & 1 /* String */) { return String(propValue); } return propValue; } return propValue; }; var getElement = (ref) => { var _a; return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ; }; // src/runtime/event-emitter.ts var createEvent = (ref, name, flags) => { const elm = getElement(ref); return { emit: (detail) => { return emitEvent(elm, name, { bubbles: !!(flags & 4 /* Bubbles */), composed: !!(flags & 2 /* Composed */), cancelable: !!(flags & 1 /* Cancellable */), detail }); } }; }; var emitEvent = (elm, name, opts) => { const ev = plt.ce(name, opts); elm.dispatchEvent(ev); return ev; }; var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => { if (oldValue === newValue) { return; } let isProp = isMemberInElement(elm, memberName); let ln = memberName.toLowerCase(); if (memberName === "class") { const classList = elm.classList; const oldClasses = parseClassList(oldValue); let newClasses = parseClassList(newValue); if ((elm["s-si"] || elm["s-sc"]) && initialRender) { const scopeId2 = elm["s-sc"] || elm["s-si"]; newClasses.push(scopeId2); oldClasses.forEach((c) => { if (c.startsWith(scopeId2)) newClasses.push(c); }); newClasses = [...new Set(newClasses)].filter((c) => c); classList.add(...newClasses); } else { classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c))); classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c))); } } else if (memberName === "style") { { for (const prop in oldValue) { if (!newValue || newValue[prop] == null) { { elm.style[prop] = ""; } } } } for (const prop in newValue) { if (!oldValue || newValue[prop] !== oldValue[prop]) { { elm.style[prop] = newValue[prop]; } } } } else if (memberName === "key") ; else if (memberName === "ref") { if (newValue) { newValue(elm); } } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") { if (memberName[2] === "-") { memberName = memberName.slice(3); } else if (isMemberInElement(win$2, ln)) { memberName = ln.slice(2); } else { memberName = ln[2] + memberName.slice(3); } if (oldValue || newValue) { const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX); memberName = memberName.replace(CAPTURE_EVENT_REGEX, ""); if (oldValue) { plt.rel(elm, memberName, oldValue, capture); } if (newValue) { plt.ael(elm, memberName, newValue, capture); } } } else { const isComplex = isComplexType(newValue); if ((isProp || isComplex && newValue !== null) && !isSvg) { try { if (!elm.tagName.includes("-")) { const n = newValue == null ? "" : newValue; if (memberName === "list") { isProp = false; } else if (oldValue == null || elm[memberName] != n) { if (typeof elm.__lookupSetter__(memberName) === "function") { elm[memberName] = n; } else { elm.setAttribute(memberName, n); } } } else if (elm[memberName] !== newValue) { elm[memberName] = newValue; } } catch (e) { } } let xlink = false; { if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) { memberName = ln; xlink = true; } } if (newValue == null || newValue === false) { if (newValue !== false || elm.getAttribute(memberName) === "") { if (xlink) { elm.removeAttributeNS(XLINK_NS, memberName); } else { elm.removeAttribute(memberName); } } } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) { newValue = newValue === true ? "" : newValue; if (xlink) { elm.setAttributeNS(XLINK_NS, memberName, newValue); } else { elm.setAttribute(memberName, newValue); } } } }; var parseClassListRegex = /\s/; var parseClassList = (value) => { if (typeof value === "object" && value && "baseVal" in value) { value = value.baseVal; } if (!value || typeof value !== "string") { return []; } return value.split(parseClassListRegex); }; var CAPTURE_EVENT_SUFFIX = "Capture"; var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$"); // src/runtime/vdom/update-element.ts var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => { const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$; const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {}; const newVnodeAttrs = newVnode.$attrs$ || {}; { for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) { if (!(memberName in newVnodeAttrs)) { setAccessor( elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$, isInitialRender ); } } } for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) { setAccessor( elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$, isInitialRender ); } }; function sortedAttrNames(attrNames) { return attrNames.includes("ref") ? ( // we need to sort these to ensure that `'ref'` is the last attr [...attrNames.filter((attr) => attr !== "ref"), "ref"] ) : ( // no need to sort, return the original array attrNames ); } // src/runtime/vdom/vdom-render.ts var scopeId; var contentRef; var hostTagName; var useNativeShadowDom = false; var checkSlotFallbackVisibility = false; var checkSlotRelocate = false; var isSvgMode = false; var createElm = (oldParentVNode, newParentVNode, childIndex) => { var _a; const newVNode2 = newParentVNode.$children$[childIndex]; let i2 = 0; let elm; let childNode; let oldVNode; if (!useNativeShadowDom) { checkSlotRelocate = true; if (newVNode2.$tag$ === "slot") { newVNode2.$flags$ |= newVNode2.$children$ ? ( // slot element has fallback content // still create an element that "mocks" the slot element 2 /* isSlotFallback */ ) : ( // slot element does not have fallback content // create an html comment we'll use to always reference // where actual slot content should sit next to 1 /* isSlotReference */ ); } } if (newVNode2.$text$ !== null) { elm = newVNode2.$elm$ = win$2.document.createTextNode(newVNode2.$text$); } else if (newVNode2.$flags$ & 1 /* isSlotReference */) { elm = newVNode2.$elm$ = slotReferenceDebugNode(newVNode2) ; { updateElement(null, newVNode2, isSvgMode); } } else { if (!isSvgMode) { isSvgMode = newVNode2.$tag$ === "svg"; } if (!win$2.document) { throw new Error( "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component." ); } elm = newVNode2.$elm$ = win$2.document.createElementNS( isSvgMode ? SVG_NS : HTML_NS, !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$ ) ; if (isSvgMode && newVNode2.$tag$ === "foreignObject") { isSvgMode = false; } { updateElement(null, newVNode2, isSvgMode); } if (isDef(scopeId) && elm["s-si"] !== scopeId) { elm.classList.add(elm["s-si"] = scopeId); } if (newVNode2.$children$) { for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) { childNode = createElm(oldParentVNode, newVNode2, i2); if (childNode) { elm.appendChild(childNode); } } } { if (newVNode2.$tag$ === "svg") { isSvgMode = false; } else if (elm.tagName === "foreignObject") { isSvgMode = true; } } } elm["s-hn"] = hostTagName; { if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) { elm["s-sr"] = true; elm["s-cr"] = contentRef; elm["s-sn"] = newVNode2.$name$ || ""; elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref; patchSlotNode(elm); oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex]; if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) { { putBackInOriginalLocation(oldParentVNode.$elm$, false); } } { addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$); } } } return elm; }; var putBackInOriginalLocation = (parentElm, recursive) => { plt.$flags$ |= 1 /* isTmpDisconnected */; const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes); for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) { const childNode = oldSlotChildNodes[i2]; if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) { insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode)); childNode["s-ol"].remove(); childNode["s-ol"] = void 0; childNode["s-sh"] = void 0; checkSlotRelocate = true; } if (recursive) { putBackInOriginalLocation(childNode, recursive); } } plt.$flags$ &= -2 /* isTmpDisconnected */; }; var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => { let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm; let childNode; if (containerElm.shadowRoot && containerElm.tagName === hostTagName) { containerElm = containerElm.shadowRoot; } for (; startIdx <= endIdx; ++startIdx) { if (vnodes[startIdx]) { childNode = createElm(null, parentVNode, startIdx); if (childNode) { vnodes[startIdx].$elm$ = childNode; insertBefore(containerElm, childNode, referenceNode(before) ); } } } }; var removeVnodes = (vnodes, startIdx, endIdx) => { for (let index = startIdx; index <= endIdx; ++index) { const vnode = vnodes[index]; if (vnode) { const elm = vnode.$elm$; nullifyVNodeRefs(vnode); if (elm) { { checkSlotFallbackVisibility = true; if (elm["s-ol"]) { elm["s-ol"].remove(); } else { putBackInOriginalLocation(elm, true); } } elm.remove(); } } } }; var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => { let oldStartIdx = 0; let newStartIdx = 0; let idxInOld = 0; let i2 = 0; let oldEndIdx = oldCh.length - 1; let oldStartVnode = oldCh[0]; let oldEndVnode = oldCh[oldEndIdx]; let newEndIdx = newCh.length - 1; let newStartVnode = newCh[0]; let newEndVnode = newCh[newEndIdx]; let node; let elmToMove; while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { if (oldStartVnode == null) { oldStartVnode = oldCh[++oldStartIdx]; } else if (oldEndVnode == null) { oldEndVnode = oldCh[--oldEndIdx]; } else if (newStartVnode == null) { newStartVnode = newCh[++newStartIdx]; } else if (newEndVnode == null) { newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) { patch(oldStartVnode, newStartVnode, isInitialRender); oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) { patch(oldEndVnode, newEndVnode, isInitialRender); oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) { if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) { putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false); } patch(oldStartVnode, newEndVnode, isInitialRender); insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) { if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) { putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false); } patch(oldEndVnode, newStartVnode, isInitialRender); insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$); oldEndVnode = oldCh[--oldEndIdx]; newStartVnode = newCh[++newStartIdx]; } else { idxInOld = -1; { for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) { if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) { idxInOld = i2; break; } } } if (idxInOld >= 0) { elmToMove = oldCh[idxInOld]; if (elmToMove.$tag$ !== newStartVnode.$tag$) { node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld); } else { patch(elmToMove, newStartVnode, isInitialRender); oldCh[idxInOld] = void 0; node = elmToMove.$elm$; } newStartVnode = newCh[++newStartIdx]; } else { node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx); newStartVnode = newCh[++newStartIdx]; } if (node) { { insertBefore( referenceNode(oldStartVnode.$elm$).parentNode, node, referenceNode(oldStartVnode.$elm$) ); } } } } if (oldStartIdx > oldEndIdx) { addVnodes( parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode2, newCh, newStartIdx, newEndIdx ); } else if (newStartIdx > newEndIdx) { removeVnodes(oldCh, oldStartIdx, oldEndIdx); } }; var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => { if (leftVNode.$tag$ === rightVNode.$tag$) { if (leftVNode.$tag$ === "slot") { return leftVNode.$name$ === rightVNode.$name$; } if (!isInitialRender) { return leftVNode.$key$ === rightVNode.$key$; } if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) { leftVNode.$key$ = rightVNode.$key$; } return true; } return false; }; var referenceNode = (node) => node && node["s-ol"] || node; var patch = (oldVNode, newVNode2, isInitialRender = false) => { const elm = newVNode2.$elm$ = oldVNode.$elm$; const oldChildren = oldVNode.$children$; const newChildren = newVNode2.$children$; const tag = newVNode2.$tag$; const text = newVNode2.$text$; let defaultHolder; if (text === null) { { isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode; } { updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender); } if (oldChildren !== null && newChildren !== null) { updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender); } else if (newChildren !== null) { if (oldVNode.$text$ !== null) { elm.textContent = ""; } addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1); } else if ( // don't do this on initial render as it can cause non-hydrated content to be removed !isInitialRender && BUILD.updatable && oldChildren !== null ) { removeVnodes(oldChildren, 0, oldChildren.length - 1); } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) { newVNode2.$children$ = oldChildren; } if (isSvgMode && tag === "svg") { isSvgMode = false; } } else if ((defaultHolder = elm["s-cr"])) { defaultHolder.parentNode.textContent = text; } else if (oldVNode.$text$ !== text) { elm.data = text; } }; var relocateNodes = []; var markSlotContentForRelocation = (elm) => { let node; let hostContentNodes; let j; const children = elm.__childNodes || elm.childNodes; for (const childNode of children) { if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) { hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes; const slotName = childNode["s-sn"]; for (j = hostContentNodes.length - 1; j >= 0; j--) { node = hostContentNodes[j]; if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (true)) { if (isNodeLocatedInSlot(node, slotName)) { let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node); checkSlotFallbackVisibility = true; node["s-sn"] = node["s-sn"] || slotName; if (relocateNodeData) { relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"]; relocateNodeData.$slotRefNode$ = childNode; } else { node["s-sh"] = childNode["s-hn"]; relocateNodes.push({ $slotRefNode$: childNode, $nodeToRelocate$: node }); } if (node["s-sr"]) { relocateNodes.map((relocateNode) => { if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) { relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node); if (relocateNodeData && !relocateNode.$slotRefNode$) { relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$; } } }); } } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) { relocateNodes.push({ $nodeToRelocate$: node }); } } } } if (childNode.nodeType === 1 /* ElementNode */) { markSlotContentForRelocation(childNode); } } }; var nullifyVNodeRefs = (vNode) => { { vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null); vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs); } }; var insertBefore = (parent, newNode, reference) => { if (typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) { addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement); } { return parent == null ? void 0 : parent.insertBefore(newNode, reference); } }; function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) { var _a, _b; let scopeId2; if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) { const scopeName = slotNode["s-sn"]; const hostName = slotNode["s-hn"]; (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s"); if (oldParent && ((_b = oldParent.classList) == null ? void 0 : _b.contains(scopeId2 + "-s"))) { let child = (oldParent.__childNodes || oldParent.childNodes)[0]; let found = false; while (child) { if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) { found = true; break; } child = child.nextSibling; } if (!found) oldParent.classList.remove(scopeId2 + "-s"); } } } var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => { var _c, _d; const hostElm = hostRef.$hostElement$; const cmpMeta = hostRef.$cmpMeta$; const oldVNode = hostRef.$vnode$ || newVNode(null, null); const isHostElement = isHost(renderFnResults); const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults); hostTagName = hostElm.tagName; if (cmpMeta.$attrsToReflect$) { rootVnode.$attrs$ = rootVnode.$attrs$ || {}; cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => { { rootVnode.$attrs$[attribute] = hostElm[propName]; } }); } if (isInitialLoad && rootVnode.$attrs$) { for (const key of Object.keys(rootVnode.$attrs$)) { if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) { rootVnode.$attrs$[key] = hostElm[key]; } } } rootVnode.$tag$ = null; rootVnode.$flags$ |= 4 /* isHost */; hostRef.$vnode$ = rootVnode; rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ; { scopeId = hostElm["s-sc"]; } useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */); { contentRef = hostElm["s-cr"]; checkSlotFallbackVisibility = false; } patch(oldVNode, rootVnode, isInitialLoad); { plt.$flags$ |= 1 /* isTmpDisconnected */; if (checkSlotRelocate) { markSlotContentForRelocation(rootVnode.$elm$); for (const relocateData of relocateNodes) { const nodeToRelocate = relocateData.$nodeToRelocate$; if (!nodeToRelocate["s-ol"] && win$2.document) { const orgLocationNode = originalLocationDebugNode(nodeToRelocate) ; orgLocationNode["s-nr"] = nodeToRelocate; insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate); } } for (const relocateData of relocateNodes) { const nodeToRelocate = relocateData.$nodeToRelocate$; const slotRefNode = relocateData.$slotRefNode$; if (slotRefNode) { const parentNodeRef = slotRefNode.parentNode; let insertBeforeNode = slotRefNode.nextSibling; const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode; const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling; if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) { if (nodeToRelocate !== insertBeforeNode) { if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) { nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName; } insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode); if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") { nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false; } } } nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode); } else { if (nodeToRelocate.nodeType === 1 /* ElementNode */) { if (isInitialLoad) { nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false; } nodeToRelocate.hidden = true; } } } } if (checkSlotFallbackVisibility) { updateFallbackSlotVisibility(rootVnode.$elm$); } plt.$flags$ &= -2 /* isTmpDisconnected */; relocateNodes.length = 0; } contentRef = void 0; }; var slotReferenceDebugNode = (slotVNode) => { var _a; return (_a = win$2.document) == null ? void 0 : _a.createComment( ` (host=${hostTagName.toLowerCase()})` ); }; var originalLocationDebugNode = (nodeToRelocate) => { var _a; return (_a = win$2.document) == null ? void 0 : _a.createComment( `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`) ); }; // src/runtime/update-component.ts var attachToAncestor = (hostRef, ancestorComponent) => { if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) { const index = ancestorComponent["s-p"].push( new Promise( (r) => hostRef.$onRenderResolve$ = () => { ancestorComponent["s-p"].splice(index - 1, 1); r(); } ) ); } }; var scheduleUpdate = (hostRef, isInitialLoad) => { { hostRef.$flags$ |= 16 /* isQueuedForUpdate */; } if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { hostRef.$flags$ |= 512 /* needsRerender */; return; } attachToAncestor(hostRef, hostRef.$ancestorComponent$); const dispatch = () => dispatchHooks(hostRef, isInitialLoad); if (isInitialLoad) { queueMicrotask(() => { dispatch(); }); return; } return writeTask(dispatch) ; }; var dispatchHooks = (hostRef, isInitialLoad) => { const elm = hostRef.$hostElement$; const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$); const instance = hostRef.$lazyInstance$ ; if (!instance) { throw new Error( `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime` ); } let maybePromise; if (isInitialLoad) { { { hostRef.$flags$ |= 256 /* isListenReady */; if (hostRef.$queuedListeners$) { hostRef.$queuedListeners$.map(([methodName, event]) => safeCall$1(instance, methodName, event, elm)); hostRef.$queuedListeners$ = void 0; } } if (hostRef.$fetchedCbList$.length) { hostRef.$fetchedCbList$.forEach((cb) => cb(elm)); } } maybePromise = safeCall$1(instance, "componentWillLoad", void 0, elm); } else { maybePromise = safeCall$1(instance, "componentWillUpdate", void 0, elm); } maybePromise = enqueue(maybePromise, () => safeCall$1(instance, "componentWillRender", void 0, elm)); endSchedule(); return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad)); }; var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => { console.error(err2); fn(); }) : fn(); var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function"; var updateComponent = async (hostRef, instance, isInitialLoad) => { var _a; const elm = hostRef.$hostElement$; const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$); const rc = elm["s-rc"]; if (isInitialLoad) { attachStyles(hostRef); } const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$); { await callRender(hostRef, instance, elm, isInitialLoad); } { try { serverSideConnected(elm); if (isInitialLoad) { if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) { elm["s-en"] = ""; } else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) { elm["s-en"] = "c"; } } } catch (e) { consoleError(e, elm); } } if (rc) { rc.map((cb) => cb()); elm["s-rc"] = void 0; } endRender(); endUpdate(); { const childrenPromises = (_a = elm["s-p"]) != null ? _a : []; const postUpdate = () => postUpdateComponent(hostRef); if (childrenPromises.length === 0) { postUpdate(); } else { Promise.all(childrenPromises).then(postUpdate); hostRef.$flags$ |= 4 /* isWaitingForChildren */; childrenPromises.length = 0; } } }; var callRender = (hostRef, instance, elm, isInitialLoad) => { try { instance = instance.render && instance.render(); { hostRef.$flags$ &= -17 /* isQueuedForUpdate */; } { hostRef.$flags$ |= 2 /* hasRendered */; } { { { return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad)); } } } } catch (e) { consoleError(e, hostRef.$hostElement$); } return null; }; var postUpdateComponent = (hostRef) => { const tagName = hostRef.$cmpMeta$.$tagName$; const elm = hostRef.$hostElement$; const endPostUpdate = createTime("postUpdate", tagName); const instance = hostRef.$lazyInstance$ ; const ancestorComponent = hostRef.$ancestorComponent$; safeCall$1(instance, "componentDidRender", void 0, elm); if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { hostRef.$flags$ |= 64 /* hasLoadedComponent */; { addHydratedFlag(elm); } safeCall$1(instance, "componentDidLoad", void 0, elm); endPostUpdate(); { hostRef.$onReadyResolve$(elm); if (!ancestorComponent) { appDidLoad(); } } } else { safeCall$1(instance, "componentDidUpdate", void 0, elm); endPostUpdate(); } { hostRef.$onInstanceResolve$(elm); } { if (hostRef.$onRenderResolve$) { hostRef.$onRenderResolve$(); hostRef.$onRenderResolve$ = void 0; } if (hostRef.$flags$ & 512 /* needsRerender */) { nextTick(() => scheduleUpdate(hostRef, false)); } hostRef.$flags$ &= -517; } }; var forceUpdate = (ref) => { return false; }; var appDidLoad = (who) => { var _a; if (BUILD.asyncQueue) { plt.$flags$ |= 2 /* appLoaded */; } nextTick(() => emitEvent(win$2, "appload", { detail: { namespace: NAMESPACE } })); { if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) { plt.$orgLocNodes$.clear(); } } }; var safeCall$1 = (instance, method, arg, elm) => { if (instance && instance[method]) { try { return instance[method](arg); } catch (e) { consoleError(e, elm); } } return void 0; }; var addHydratedFlag = (elm) => { var _a; return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ; }; var serverSideConnected = (elm) => { const children = elm.children; if (children != null) { for (let i2 = 0, ii = children.length; i2 < ii; i2++) { const childElm = children[i2]; if (typeof childElm.connectedCallback === "function") { childElm.connectedCallback(); } serverSideConnected(childElm); } } }; // src/runtime/set-value.ts var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName); var setValue = (ref, propName, newVal, cmpMeta) => { const hostRef = getHostRef(ref); if (!hostRef) { return; } if (!hostRef) { throw new Error( `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).` ); } const elm = hostRef.$hostElement$ ; const oldVal = hostRef.$instanceValues$.get(propName); const flags = hostRef.$flags$; const instance = hostRef.$lazyInstance$ ; newVal = parsePropertyValue( newVal, cmpMeta.$members$[propName][0]); const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal); const didValueChange = newVal !== oldVal && !areBothNaN; if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) { hostRef.$instanceValues$.set(propName, newVal); if (instance) { if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) { const watchMethods = cmpMeta.$watchers$[propName]; if (watchMethods) { watchMethods.map((watchMethodName) => { try { instance[watchMethodName](newVal, oldVal, propName); } catch (e) { consoleError(e, elm); } }); } } if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { if (instance.componentShouldUpdate) { if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) { return; } } scheduleUpdate(hostRef, false); } } } }; // src/runtime/proxy-component.ts var proxyComponent = (Cstr, cmpMeta, flags) => { var _a; const prototype = Cstr.prototype; { { if (Cstr.watchers && !cmpMeta.$watchers$) { cmpMeta.$watchers$ = Cstr.watchers; } if (Cstr.deserializers && !cmpMeta.$deserializers$) { cmpMeta.$deserializers$ = Cstr.deserializers; } if (Cstr.serializers && !cmpMeta.$serializers$) { cmpMeta.$serializers$ = Cstr.serializers; } } const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {}); members.map(([memberName, [memberFlags]]) => { if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) { const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {}; if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */; if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */; if (!origGetter) { Object.defineProperty(prototype, memberName, { get() { { if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) { return getValue(this, memberName); } const ref = getHostRef(this); const instance = ref ? ref.$lazyInstance$ : prototype; if (!instance) return; return instance[memberName]; } }, configurable: true, enumerable: true }); } Object.defineProperty(prototype, memberName, { set(newValue) { const ref = getHostRef(this); if (!ref) { return; } if (origSetter) { const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName]; if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) { newValue = ref.$instanceValues$.get(memberName); } origSetter.apply(this, [ parsePropertyValue( newValue, memberFlags) ]); newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName]; setValue(this, memberName, newValue, cmpMeta); return; } { { setValue(this, memberName, newValue, cmpMeta); return; } } } }); } }); } return Cstr; }; // src/runtime/initialize-component.ts var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => { let Cstr; if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) { hostRef.$flags$ |= 32 /* hasInitializedComponent */; const bundleId = cmpMeta.$lazyBundleId$; if (bundleId) { const CstrImport = loadModule(cmpMeta); if (CstrImport && "then" in CstrImport) { const endLoad = uniqueTime(); Cstr = await CstrImport; endLoad(); } else { Cstr = CstrImport; } if (!Cstr) { throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`); } if (!Cstr.isProxied) { { cmpMeta.$watchers$ = Cstr.watchers; cmpMeta.$serializers$ = Cstr.serializers; cmpMeta.$deserializers$ = Cstr.deserializers; } proxyComponent(Cstr, cmpMeta); Cstr.isProxied = true; } const endNewInstance = createTime("createInstance", cmpMeta.$tagName$); { hostRef.$flags$ |= 8 /* isConstructingInstance */; } try { new Cstr(hostRef); } catch (e) { consoleError(e, elm); } { hostRef.$flags$ &= -9 /* isConstructingInstance */; } { hostRef.$flags$ |= 128 /* isWatchReady */; } endNewInstance(); fireConnectedCallback(hostRef.$lazyInstance$, elm); } else { Cstr = elm.constructor; const cmpTag = elm.localName; customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */); } if (Cstr && Cstr.style) { let style; if (typeof Cstr.style === "string") { style = Cstr.style; } else if (typeof Cstr.style !== "string") { hostRef.$modeName$ = computeMode(elm); if (hostRef.$modeName$) { style = Cstr.style[hostRef.$modeName$]; } if (hostRef.$modeName$) { elm.setAttribute("s-mode", hostRef.$modeName$); } } const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$); if (!styles.has(scopeId2)) { const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$); { if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) { style = scopeCss(style, scopeId2); } else if (needsScopedSSR()) { style = expandPartSelectors(style); } } registerStyle(scopeId2, style); endRegisterStyles(); } } } const ancestorComponent = hostRef.$ancestorComponent$; const schedule = () => scheduleUpdate(hostRef, true); if (ancestorComponent && ancestorComponent["s-rc"]) { ancestorComponent["s-rc"].push(schedule); } else { schedule(); } }; var fireConnectedCallback = (instance, elm) => { { safeCall$1(instance, "connectedCallback", void 0, elm); } }; // src/runtime/connected-callback.ts var connectedCallback = (elm) => { if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { const hostRef = getHostRef(elm); if (!hostRef) { return; } const cmpMeta = hostRef.$cmpMeta$; const endConnected = createTime("connectedCallback", cmpMeta.$tagName$); if (!(hostRef.$flags$ & 1 /* hasConnected */)) { hostRef.$flags$ |= 1 /* hasConnected */; let hostId; { hostId = elm.getAttribute(HYDRATE_ID); if (hostId) { if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) { const scopeId2 = addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) ; elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s"); } else if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) { const scopeId2 = getScopeId(cmpMeta, elm.getAttribute("s-mode") ); elm["s-sc"] = scopeId2; } initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef); } } if (!hostId) { { setContentReference(elm); } } { let ancestorComponent = elm; while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) { if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) { attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent); break; } } } if (BUILD.initializeNextTick) { nextTick(() => initializeComponent(elm, hostRef, cmpMeta)); } else { initializeComponent(elm, hostRef, cmpMeta); } } else { addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); if (hostRef == null ? void 0 : hostRef.$lazyInstance$) { fireConnectedCallback(hostRef.$lazyInstance$, elm); } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) { hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm)); } } endConnected(); } }; var setContentReference = (elm) => { if (!win$2.document) { return; } const contentRefElm = elm["s-cr"] = win$2.document.createComment( "" ); contentRefElm["s-cn"] = true; insertBefore(elm, contentRefElm, elm.firstChild); }; // src/runtime/fragment.ts var Fragment = (_, children) => children; var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => { if (listeners && win$2.document) { listeners.map(([flags, name, method]) => { const target = getHostListenerTarget(win$2.document, elm, flags) ; const handler = hostListenerProxy(hostRef, method); const opts = hostListenerOpts(flags); plt.ael(target, name, handler, opts); (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts)); }); } }; var hostListenerProxy = (hostRef, methodName) => (ev) => { var _a; try { { if (hostRef.$flags$ & 256 /* isListenReady */) { (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev); } else { (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); } } } catch (e) { consoleError(e, hostRef.$hostElement$); } }; var getHostListenerTarget = (doc, elm, flags) => { if (flags & 4 /* TargetDocument */) { return doc; } if (flags & 8 /* TargetWindow */) { return win$2; } if (flags & 16 /* TargetBody */) { return doc.body; } return elm; }; var hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0; // src/runtime/vdom/vdom-annotations.ts var insertVdomAnnotations = (doc, staticComponents) => { if (doc != null) { const docData = STENCIL_DOC_DATA in doc ? doc[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA }; docData.staticComponents = new Set(staticComponents); const orgLocationNodes = []; parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes); orgLocationNodes.forEach((orgLocationNode) => { var _a; if (orgLocationNode != null && orgLocationNode["s-nr"]) { const nodeRef = orgLocationNode["s-nr"]; let hostId = nodeRef["s-host-id"]; let nodeId = nodeRef["s-node-id"]; let childId = `${hostId}.${nodeId}`; if (hostId == null) { hostId = 0; docData.rootLevelIds++; nodeId = docData.rootLevelIds; childId = `${hostId}.${nodeId}`; if (nodeRef.nodeType === 1 /* ElementNode */) { nodeRef.setAttribute(HYDRATE_CHILD_ID, childId); if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) { nodeRef.setAttribute("s-sn", nodeRef["s-sn"]); } } else if (nodeRef.nodeType === 3 /* TextNode */) { if (hostId === 0) { const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim(); if (textContent === "") { orgLocationNode.remove(); return; } } const commentBeforeTextNode = doc.createComment(childId); commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`; insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef); } else if (nodeRef.nodeType === 8 /* CommentNode */) { const commentBeforeTextNode = doc.createComment(childId); commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`; nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef); } } let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`; const orgLocationParentNode = orgLocationNode.parentElement; if (orgLocationParentNode) { if (orgLocationParentNode["s-en"] === "") { orgLocationNodeId += `.`; } else if (orgLocationParentNode["s-en"] === "c") { orgLocationNodeId += `.c`; } } orgLocationNode.nodeValue = orgLocationNodeId; } }); } }; var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => { var _a; if (node == null) { return; } if (node["s-nr"] != null) { orgLocationNodes.push(node); } if (node.nodeType === 1 /* ElementNode */) { const childNodes = [...Array.from(node.childNodes), ...Array.from(((_a = node.shadowRoot) == null ? void 0 : _a.childNodes) || [])]; childNodes.forEach((childNode) => { const hostRef = getHostRef(childNode); if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) { const cmpData = { nodeIds: 0 }; insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData); } parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes); }); } }; var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => { if (vnode != null) { const hostId = ++docData.hostIds; hostElm.setAttribute(HYDRATE_ID, hostId); if (hostElm["s-cr"] != null) { hostElm["s-cr"].nodeValue = `${CONTENT_REF_ID}.${hostId}`; } if (vnode.$children$ != null) { const depth = 0; vnode.$children$.forEach((vnodeChild, index) => { insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index); }); } if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) { const parent = hostElm.parentElement; if (parent && parent.childNodes) { const parentChildNodes = Array.from(parent.childNodes); const comment = parentChildNodes.find( (node) => node.nodeType === 8 /* CommentNode */ && node["s-sr"] ); if (comment) { const index = parentChildNodes.indexOf(hostElm) - 1; vnode.$elm$.setAttribute( HYDRATE_CHILD_ID, `${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}` ); } } } } }; var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => { const childElm = vnodeChild.$elm$; if (childElm == null) { return; } const nodeId = cmpData.nodeIds++; const childId = `${hostId}.${nodeId}.${depth}.${index}`; childElm["s-host-id"] = hostId; childElm["s-node-id"] = nodeId; if (childElm.nodeType === 1 /* ElementNode */) { childElm.setAttribute(HYDRATE_CHILD_ID, childId); if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) { childElm.setAttribute("s-sn", childElm["s-sn"]); } } else if (childElm.nodeType === 3 /* TextNode */) { const parentNode = childElm.parentNode; const nodeName = parentNode == null ? void 0 : parentNode.nodeName; if (nodeName !== "STYLE" && nodeName !== "SCRIPT") { const textNodeId = `${TEXT_NODE_ID}.${childId}`; const commentBeforeTextNode = doc.createComment(textNodeId); insertBefore(parentNode, commentBeforeTextNode, childElm); } } else if (childElm.nodeType === 8 /* CommentNode */) { if (childElm["s-sr"]) { const slotName = childElm["s-sn"] || ""; const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`; childElm.nodeValue = slotNodeId; } } if (vnodeChild.$children$ != null) { const childDepth = depth + 1; vnodeChild.$children$.forEach((vnode, index2) => { insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2); }); } }; // src/hydrate/platform/h-async.ts var hAsync = (nodeName, vnodeData, ...children) => { if (Array.isArray(children) && children.length > 0) { const flatChildren = children.flat(Infinity); if (flatChildren.some((child) => child instanceof Promise)) { return Promise.all(flatChildren).then((resolvedChildren) => { return h(nodeName, vnodeData, ...resolvedChildren); }).catch((err2) => { return h(nodeName, vnodeData); }); } return h(nodeName, vnodeData, ...flatChildren); } return h(nodeName, vnodeData); }; // src/hydrate/platform/proxy-host-element.ts function proxyHostElement(elm, cstr) { const cmpMeta = cstr.cmpMeta; cmpMeta.$watchers$ = cmpMeta.$watchers$ || cstr.watchers; cmpMeta.$deserializers$ = cmpMeta.$deserializers$ || cstr.deserializers; cmpMeta.$serializers$ = cmpMeta.$serializers$ || cstr.serializers; if (typeof elm.componentOnReady !== "function") { elm.componentOnReady = componentOnReady$1; } if (typeof elm.forceUpdate !== "function") { elm.forceUpdate = forceUpdate2; } if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) { createShadowRoot.call(elm, cmpMeta); } if (cmpMeta.$members$ != null) { const hostRef = getHostRef(elm); const members = Object.entries(cmpMeta.$members$); members.forEach(([memberName, [memberFlags, metaAttributeName]]) => { var _a, _b; if (memberFlags & 31 /* Prop */) { const attributeName = metaAttributeName || memberName; const attrValue = elm.getAttribute(attributeName); const propValue = elm[memberName]; let attrPropVal; const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(cstr.prototype, memberName) || {}; if (attrValue != null) { if ((_a = cmpMeta.$deserializers$) == null ? void 0 : _a[memberName]) { for (const methodName of cmpMeta.$deserializers$[memberName]) { attrPropVal = cstr.prototype[methodName](attrValue, memberName); } } else { attrPropVal = parsePropertyValue(attrValue, memberFlags); } } if (propValue !== void 0) { attrPropVal = propValue; delete elm[memberName]; } if (attrPropVal !== void 0) { if (origSetter) { origSetter.apply(elm, [attrPropVal]); attrPropVal = origGetter ? origGetter.apply(elm) : attrPropVal; } (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal); } const getterSetterDescriptor = { get: function() { return getValue(this, memberName); }, set: function(newValue) { setValue(this, memberName, newValue, cmpMeta); }, configurable: true, enumerable: true }; Object.defineProperty(elm, memberName, getterSetterDescriptor); Object.defineProperty(elm, metaAttributeName, getterSetterDescriptor); hostRef.$fetchedCbList$.push(() => { var _a2; if (!((_a2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a2.has(memberName))) { setValue( elm, memberName, attrPropVal !== void 0 ? attrPropVal : hostRef.$lazyInstance$[memberName], cmpMeta ); } Object.defineProperty(hostRef.$lazyInstance$, memberName, getterSetterDescriptor); }); } else if (memberFlags & 64 /* Method */) { Object.defineProperty(elm, memberName, { value(...args) { var _a2; const ref = getHostRef(this); return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => { var _a3; return (_a3 = ref == null ? void 0 : ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args); }).catch((e) => { consoleError(e, this); }); } }); } }); } } function componentOnReady$1() { var _a; return (_a = getHostRef(this)) == null ? void 0 : _a.$onReadyPromise$; } function forceUpdate2() { } // src/hydrate/platform/hydrate-app.ts function hydrateApp(win2, opts, results, afterHydrate, resolve) { const connectedElements = /* @__PURE__ */ new Set(); const createdElements = /* @__PURE__ */ new Set(); const waitingElements = /* @__PURE__ */ new Set(); const orgDocumentCreateElement = win2.document.createElement; const orgDocumentCreateElementNS = win2.document.createElementNS; const resolved2 = Promise.resolve(); setScopedSSR(opts); let tmrId; let ranCompleted = false; function hydratedComplete() { globalThis.clearTimeout(tmrId); createdElements.clear(); connectedElements.clear(); if (!ranCompleted) { ranCompleted = true; try { if (opts.clientHydrateAnnotations) { insertVdomAnnotations(win2.document, opts.staticComponents); } win2.dispatchEvent(new win2.Event("DOMContentLoaded")); win2.document.createElement = orgDocumentCreateElement; win2.document.createElementNS = orgDocumentCreateElementNS; } catch (e) { renderCatchError(opts, results, e); } } afterHydrate(win2, opts, results, resolve); } function hydratedError(err2) { renderCatchError(opts, results, err2); hydratedComplete(); } function timeoutExceeded() { hydratedError(`Hydrate exceeded timeout${waitingOnElementsMsg(waitingElements)}`); } try { let patchedConnectedCallback2 = function() { return connectElement2(this); }, patchElement2 = function(elm) { if (isValidComponent(elm, opts)) { const hostRef = getHostRef(elm); if (!hostRef) { const Cstr = loadModule( { $tagName$: elm.nodeName.toLowerCase()}); if (Cstr != null && Cstr.cmpMeta != null) { if (opts.serializeShadowRoot !== false && !!(Cstr.cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && tagRequiresScoped(elm.tagName, opts.serializeShadowRoot)) { const cmpMeta = Cstr.cmpMeta; cmpMeta.$flags$ |= 128 /* shadowNeedsScopedCss */; Object.defineProperty(Cstr, "cmpMeta", { get: function() { return cmpMeta; } }); } createdElements.add(elm); elm.connectedCallback = patchedConnectedCallback2; registerHost(elm, Cstr.cmpMeta); proxyHostElement(elm, Cstr); } } } }, patchChild2 = function(elm) { if (elm != null && elm.nodeType === 1) { patchElement2(elm); const children = elm.children; for (let i2 = 0, ii = children.length; i2 < ii; i2++) { patchChild2(children[i2]); } } }, connectElement2 = function(elm) { createdElements.delete(elm); if (isValidComponent(elm, opts) && results.hydratedCount < opts.maxHydrateCount) { if (!connectedElements.has(elm) && shouldHydrate(elm)) { connectedElements.add(elm); return hydrateComponent.call(elm, win2, results, elm.nodeName, elm, waitingElements); } } return resolved2; }, waitLoop2 = function() { const toConnect = Array.from(createdElements).filter((elm) => elm.parentElement); if (toConnect.length > 0) { return Promise.all(toConnect.map(connectElement2)).then(waitLoop2); } return resolved2; }; win2.document.createElement = function patchedCreateElement(tagName) { const elm = orgDocumentCreateElement.call(win2.document, tagName); patchElement2(elm); return elm; }; win2.document.createElementNS = function patchedCreateElement(namespaceURI, tagName) { const elm = orgDocumentCreateElementNS.call(win2.document, namespaceURI, tagName); patchElement2(elm); return elm; }; tmrId = globalThis.setTimeout(timeoutExceeded, opts.timeout); plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./", win2.document.baseURI).href; globalScripts(); patchChild2(win2.document.body); waitLoop2().then(hydratedComplete).catch(hydratedError); } catch (e) { hydratedError(e); } } async function hydrateComponent(win2, results, tagName, elm, waitingElements) { tagName = tagName.toLowerCase(); const Cstr = loadModule( { $tagName$: tagName}); if (Cstr != null) { const cmpMeta = Cstr.cmpMeta; if (cmpMeta != null) { waitingElements.add(elm); const hostRef = getHostRef(this); if (!hostRef) { return; } addHostEventListeners(this, hostRef, cmpMeta.$listeners$); try { connectedCallback(elm); await elm.componentOnReady(); results.hydratedCount++; const ref = getHostRef(elm); const modeName = !(ref == null ? void 0 : ref.$modeName$) ? "$" : ref == null ? void 0 : ref.$modeName$; if (!results.components.some((c) => c.tag === tagName && c.mode === modeName)) { results.components.push({ tag: tagName, mode: modeName, count: 0, depth: -1 }); } } catch (e) { win2.console.error(e); } waitingElements.delete(elm); } } } function isValidComponent(elm, opts) { if (elm != null && elm.nodeType === 1) { const tagName = elm.nodeName; if (typeof tagName === "string" && tagName.includes("-")) { if (opts.excludeComponents.includes(tagName.toLowerCase())) { return false; } return true; } } return false; } function shouldHydrate(elm) { if (elm.nodeType === 9) { return true; } if (NO_HYDRATE_TAGS.has(elm.nodeName)) { return false; } if (elm.hasAttribute("no-prerender")) { return false; } const parentNode = elm.parentNode; if (parentNode == null) { return true; } return shouldHydrate(parentNode); } var NO_HYDRATE_TAGS = /* @__PURE__ */ new Set([ "CODE", "HEAD", "IFRAME", "INPUT", "OBJECT", "OUTPUT", "NOSCRIPT", "PRE", "SCRIPT", "SELECT", "STYLE", "TEMPLATE", "TEXTAREA" ]); function renderCatchError(opts, results, err2) { const diagnostic = { level: "error", type: "build", header: "Hydrate Error", messageText: "", relFilePath: void 0, absFilePath: void 0, lines: [] }; if (opts.url) { try { const u = new URL(opts.url); if (u.pathname !== "/") { diagnostic.header += ": " + u.pathname; } } catch (e) { } } if (err2 != null) { if (err2.stack != null) { diagnostic.messageText = err2.stack.toString(); } else if (err2.message != null) { diagnostic.messageText = err2.message.toString(); } else { diagnostic.messageText = err2.toString(); } } results.diagnostics.push(diagnostic); } function printTag(elm) { let tag = `<${elm.nodeName.toLowerCase()}`; if (Array.isArray(elm.attributes)) { for (let i2 = 0; i2 < elm.attributes.length; i2++) { const attr = elm.attributes[i2]; tag += ` ${attr.name}`; if (attr.value !== "") { tag += `="${attr.value}"`; } } } tag += `>`; return tag; } function waitingOnElementMsg(waitingElement) { let msg = ""; if (waitingElement) { const lines = []; msg = " - waiting on:"; let elm = waitingElement; while (elm && elm.nodeType !== 9 && elm.nodeName !== "BODY") { lines.unshift(printTag(elm)); elm = elm.parentElement; } let indent = ""; for (const ln of lines) { indent += " "; msg += ` ${indent}${ln}`; } } return msg; } function waitingOnElementsMsg(waitingElements) { return Array.from(waitingElements).map(waitingOnElementMsg); } function tagRequiresScoped(tagName, opts) { if (typeof opts === "string") { return opts === "scoped"; } if (typeof opts === "boolean") { return opts === true ? false : true; } if (typeof opts === "object") { tagName = tagName.toLowerCase(); if (Array.isArray(opts["declarative-shadow-dom"]) && opts["declarative-shadow-dom"].includes(tagName)) { return false; } else if ((!Array.isArray(opts.scoped) || !opts.scoped.includes(tagName)) && opts.default === "declarative-shadow-dom") { return false; } else { return true; } } return false; } var cmpModules = /* @__PURE__ */ new Map(); var getModule = (tagName) => { if (typeof tagName === "string") { tagName = tagName.toLowerCase(); const cmpModule = cmpModules.get(tagName); if (cmpModule != null) { return cmpModule[tagName]; } } return null; }; var loadModule = (cmpMeta, _hostRef, _hmrVersionId) => { return getModule(cmpMeta.$tagName$); }; var isMemberInElement = (elm, memberName) => { if (elm != null) { if (memberName in elm) { return true; } const cstr = getModule(elm.nodeName); if (cstr != null) { const hostRef = cstr; if (hostRef != null && hostRef.cmpMeta != null && hostRef.cmpMeta.$members$ != null) { return memberName in hostRef.cmpMeta.$members$; } } } return false; }; var registerComponents = (Cstrs) => { for (const Cstr of Cstrs) { const exportName = Cstr.cmpMeta.$tagName$; cmpModules.set(exportName, { [exportName]: Cstr }); } }; var win$2 = window; var readTask = (cb) => { nextTick(() => { try { cb(); } catch (e) { consoleError(e); } }); }; var writeTask = (cb) => { nextTick(() => { try { cb(); } catch (e) { consoleError(e); } }); }; var resolved = /* @__PURE__ */ Promise.resolve(); var nextTick = (cb) => resolved.then(cb); var defaultConsoleError = (e) => { if (e != null) { console.error(e.stack || e.message || e); } }; var consoleError = (e, el) => (defaultConsoleError)(e, el); 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 win$2.CustomEvent(eventName, opts) }; var getHostRef = (ref) => { if (ref.__stencil__getHostRef) { return ref.__stencil__getHostRef(); } return void 0; }; var registerInstance = (lazyInstance, hostRef) => { if (!hostRef) return void 0; lazyInstance.__stencil__getHostRef = () => hostRef; hostRef.$lazyInstance$ = lazyInstance; return hostRef; }; var registerHost = (elm, cmpMeta) => { const hostRef = { $flags$: 0, $cmpMeta$: cmpMeta, $hostElement$: elm, $instanceValues$: /* @__PURE__ */ new Map(), $serializerValues$: /* @__PURE__ */ new Map(), $renderCount$: 0 }; hostRef.$fetchedCbList$ = []; hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r); hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r); elm["s-p"] = []; elm["s-rc"] = []; elm.__stencil__getHostRef = () => hostRef; return hostRef; }; var Build = { isBrowser: false}; var styles = /* @__PURE__ */ new Map(); var setScopedSSR = (opts) => { scopedSSR = opts.serializeShadowRoot !== false && opts.serializeShadowRoot !== "declarative-shadow-dom"; }; var needsScopedSSR = () => scopedSSR; var scopedSSR = false; const transitionEndAsync = (el, expectedDuration = 0) => { return new Promise((resolve) => { transitionEnd(el, expectedDuration, resolve); }); }; /** * Allows developer to wait for a transition * to finish and fallback to a timer if the * transition is cancelled or otherwise * never finishes. Also see transitionEndAsync * which is an await-able version of this. */ const transitionEnd = (el, expectedDuration = 0, callback) => { let unRegTrans; let animationTimeout; const opts = { passive: true }; const ANIMATION_FALLBACK_TIMEOUT = 500; const unregister = () => { if (unRegTrans) { unRegTrans(); } }; const onTransitionEnd = (ev) => { if (ev === undefined || el === ev.target) { unregister(); callback(ev); } }; if (el) { el.addEventListener('webkitTransitionEnd', onTransitionEnd, opts); el.addEventListener('transitionend', onTransitionEnd, opts); animationTimeout = setTimeout(onTransitionEnd, expectedDuration + ANIMATION_FALLBACK_TIMEOUT); unRegTrans = () => { if (animationTimeout !== undefined) { clearTimeout(animationTimeout); animationTimeout = undefined; } el.removeEventListener('webkitTransitionEnd', onTransitionEnd, opts); el.removeEventListener('transitionend', onTransitionEnd, opts); }; } return unregister; }; /** * Waits for a component to be ready for * both custom element and non-custom element builds. * If non-custom element build, el.componentOnReady * will be used. * For custom element builds, we wait a frame * so that the inner contents of the component * have a chance to render. * * Use this utility rather than calling * el.componentOnReady yourself. */ const componentOnReady = (el, callback) => { if (el.componentOnReady) { // eslint-disable-next-line custom-rules/no-component-on-ready-method el.componentOnReady().then((resolvedEl) => callback(resolvedEl)); } else { raf(() => callback(el)); } }; /** * This functions checks if a Stencil component is using * the lazy loaded build of Stencil. Returns `true` if * the component is lazy loaded. Returns `false` otherwise. */ const hasLazyBuild = (stencilEl) => { return stencilEl.componentOnReady !== undefined; }; /** * Elements inside of web components sometimes need to inherit global attributes * set on the host. For example, the inner input in `ion-input` should inherit * the `title` attribute that developers set directly on `ion-input`. This * helper function should be called in componentWillLoad and assigned to a variable * that is later used in the render function. * * This does not need to be reactive as changing attributes on the host element * does not trigger a re-render. */ const inheritAttributes$1 = (el, attributes = []) => { const attributeObject = {}; attributes.forEach((attr) => { if (el.hasAttribute(attr)) { const value = el.getAttribute(attr); if (value !== null) { attributeObject[attr] = el.getAttribute(attr); } el.removeAttribute(attr); } }); return attributeObject; }; /** * List of available ARIA attributes + `role`. * Removed deprecated attributes. * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes */ const ariaAttributes = [ 'role', 'aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-braillelabel', 'aria-brailleroledescription', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colindextext', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-description', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowindextext', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', ]; /** * Returns an array of aria attributes that should be copied from * the shadow host element to a target within the light DOM. * @param el The element that the attributes should be copied from. * @param ignoreList The list of aria-attributes to ignore reflecting and removing from the host. * Use this in instances where we manually specify aria attributes on the `` element. */ const inheritAriaAttributes = (el, ignoreList) => { let attributesToInherit = ariaAttributes; return inheritAttributes$1(el, attributesToInherit); }; const addEventListener$1 = (el, eventName, callback, opts) => { return el.addEventListener(eventName, callback, opts); }; const removeEventListener = (el, eventName, callback, opts) => { return el.removeEventListener(eventName, callback, opts); }; /** * Gets the root context of a shadow dom element * On newer browsers this will be the shadowRoot, * but for older browser this may just be the * element itself. * * Useful for whenever you need to explicitly * do "myElement.shadowRoot!.querySelector(...)". */ const getElementRoot = (el, fallback = el) => { return el.shadowRoot || fallback; }; /** * Patched version of requestAnimationFrame that avoids ngzone * Use only when you know ngzone should not run */ const raf = (h) => { if (typeof __zone_symbol__requestAnimationFrame === 'function') { return __zone_symbol__requestAnimationFrame(h); } if (typeof requestAnimationFrame === 'function') { return requestAnimationFrame(h); } return setTimeout(h); }; const hasShadowDom = (el) => { return !!el.shadowRoot && !!el.attachShadow; }; const focusVisibleElement = (el) => { el.focus(); /** * When programmatically focusing an element, * the focus-visible utility will not run because * it is expecting a keyboard event to have triggered this; * however, there are times when we need to manually control * this behavior so we call the `setFocus` method on ion-app * which will let us explicitly set the elements to focus. */ if (el.classList.contains('ion-focusable')) { const app = el.closest('ion-app'); if (app) { app.setFocus([el]); } } }; /** * This method is used to add a hidden input to a host element that contains * a Shadow DOM. It does not add the input inside of the Shadow root which * allows it to be picked up inside of forms. It should contain the same * values as the host element. * * @param always Add a hidden input even if the container does not use Shadow * @param container The element where the input will be added * @param name The name of the input * @param value The value of the input * @param disabled If true, the input is disabled */ const renderHiddenInput = (always, container, name, value, disabled) => { { let input = container.querySelector('input.aux-input'); if (!input) { input = container.ownerDocument.createElement('input'); input.type = 'hidden'; input.classList.add('aux-input'); container.appendChild(input); } input.disabled = disabled; input.name = name; input.value = value || ''; } }; const clamp = (min, n, max) => { return Math.max(min, Math.min(n, max)); }; const assert = (actual, reason) => { if (!actual) { const message = 'ASSERT: ' + reason; printIonError(message); debugger; // eslint-disable-line throw new Error(message); } }; /** * @hidden * Given a side, return if it should be on the end * based on the value of dir * @param side the side * @param isRTL whether the application dir is rtl */ const isEndSide = (side) => { const isRTL = document.dir === 'rtl'; switch (side) { case 'start': return isRTL; case 'end': return !isRTL; default: throw new Error(`"${side}" is not a valid value for [side]. Use "start" or "end" instead.`); } }; const debounceEvent = (event, wait) => { const original = event._original || event; return { _original: event, emit: debounce(original.emit.bind(original), wait), }; }; const debounce = (func, wait = 0) => { let timer; return (...args) => { clearTimeout(timer); timer = setTimeout(func, wait, ...args); }; }; /** * Check whether the two string maps are shallow equal. * * undefined is treated as an empty map. * * @returns whether the keys are the same and the values are shallow equal. */ const shallowEqualStringMap = (map1, map2) => { map1 !== null && map1 !== void 0 ? map1 : (map1 = {}); map2 !== null && map2 !== void 0 ? map2 : (map2 = {}); if (map1 === map2) { return true; } const keys1 = Object.keys(map1); if (keys1.length !== Object.keys(map2).length) { return false; } for (const k1 of keys1) { if (!(k1 in map2)) { return false; } if (map1[k1] !== map2[k1]) { return false; } } return true; }; /** * Checks input for usable number. Not NaN and not Infinite. */ const isSafeNumber = (input) => { return typeof input === 'number' && !isNaN(input) && isFinite(input); }; /* Ionicons v8.0.13, ES Modules */ const arrowBackSharp = "data:image/svg+xml;utf8,"; const arrowDown = "data:image/svg+xml;utf8,"; const caretBackSharp = "data:image/svg+xml;utf8,"; const caretDownSharp = "data:image/svg+xml;utf8,"; const caretUpSharp = "data:image/svg+xml;utf8,"; const checkmarkOutline = "data:image/svg+xml;utf8,"; const chevronBack = "data:image/svg+xml;utf8,"; const chevronDown = "data:image/svg+xml;utf8,"; const chevronExpand = "data:image/svg+xml;utf8,"; const chevronForward = "data:image/svg+xml;utf8,"; const chevronForwardOutline = "data:image/svg+xml;utf8,"; const close = "data:image/svg+xml;utf8,"; const closeCircle = "data:image/svg+xml;utf8,"; const closeSharp = "data:image/svg+xml;utf8,"; const ellipseOutline = "data:image/svg+xml;utf8,"; const ellipsisHorizontal = "data:image/svg+xml;utf8,"; const eye = "data:image/svg+xml;utf8,"; const eyeOff = "data:image/svg+xml;utf8,"; const menuOutline = "data:image/svg+xml;utf8,"; const menuSharp = "data:image/svg+xml;utf8,"; const removeOutline = "data:image/svg+xml;utf8,"; const reorderThreeOutline = "data:image/svg+xml;utf8,"; const reorderTwoSharp = "data:image/svg+xml;utf8,"; const searchOutline = "data:image/svg+xml;utf8,"; const searchSharp = "data:image/svg+xml;utf8,"; const accordionIosCss = ":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}"; const accordionMdCss = ":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}"; /** * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * * @slot header - Content is placed at the top and is used to * expand or collapse the accordion item. * @slot content - Content is placed below the header and is * shown or hidden based on expanded state. * * @part header - The wrapper element for the header slot. * @part content - The wrapper element for the content slot. * @part expanded - The expanded element. Can be used in combination * with the `header` and `content` parts (i.e. `::part(header expanded)`). */ class Accordion { constructor(hostRef) { registerInstance(this, hostRef); this.updateListener = () => this.updateState(false); this.state = 1 /* AccordionState.Collapsed */; this.isNext = false; this.isPrevious = false; /** * The value of the accordion. Defaults to an autogenerated * value. */ this.value = `ion-accordion-${accordionIds++}`; /** * If `true`, the accordion cannot be interacted with. */ this.disabled = false; /** * If `true`, the accordion cannot be interacted with, * but does not alter the opacity. */ this.readonly = false; /** * The toggle icon to use. This icon will be * rotated when the accordion is expanded * or collapsed. */ this.toggleIcon = chevronDown; /** * The slot inside of `ion-item` to * place the toggle icon. Defaults to `"end"`. */ this.toggleIconSlot = 'end'; this.setItemDefaults = () => { const ionItem = this.getSlottedHeaderIonItem(); if (!ionItem) { return; } /** * For a11y purposes, we make * the ion-item a button so users * can tab to it and use keyboard * navigation to get around. */ ionItem.button = true; ionItem.detail = false; /** * By default, the lines in an * item should be full here, but * only do that if a user has * not explicitly overridden them */ if (ionItem.lines === undefined) { ionItem.lines = 'full'; } }; this.getSlottedHeaderIonItem = () => { const { headerEl } = this; if (!headerEl) { return; } /** * Get the first ion-item * slotted in the header slot */ const slot = headerEl.querySelector('slot'); if (!slot) { return; } // This is not defined in unit tests if (slot.assignedElements === undefined) return; return slot.assignedElements().find((el) => el.tagName === 'ION-ITEM'); }; this.setAria = (expanded = false) => { const ionItem = this.getSlottedHeaderIonItem(); if (!ionItem) { return; } /** * Get the native