UNPKG

@govbr-ds/webcomponents

Version:

Biblioteca de Web Components baseado no GovBR-DS

1,449 lines (1,436 loc) 84.8 kB
/*! * Construído por SERPRO * © https://serpro.gov.br/ - MIT License. */ const NAMESPACE = 'webcomponents'; const BUILD = /* webcomponents */ { hydratedSelectorName: "hydrated", lazyLoad: true, updatable: true}; /* Stencil Client Platform v4.28.2 | 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/es2022-rewire-class-members.ts var reWireGetterSetter = (instance, hostRef) => { var _a; const cmpMeta = hostRef.$cmpMeta$; const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {}); members.map(([memberName, [memberFlags]]) => { if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) { const ogValue = instance[memberName]; const ogDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(instance), memberName); Object.defineProperty(instance, memberName, { get() { return ogDescriptor.get.call(this); }, set(newValue) { ogDescriptor.set.call(this, newValue); }, configurable: true, enumerable: true }); instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue; } }); }; // src/client/client-host-ref.ts var getHostRef = (ref) => { if (ref.__stencil__getHostRef) { return ref.__stencil__getHostRef(); } return void 0; }; var registerInstance = (lazyInstance, hostRef) => { lazyInstance.__stencil__getHostRef = () => hostRef; hostRef.$lazyInstance$ = lazyInstance; { reWireGetterSetter(lazyInstance, hostRef); } }; var registerHost = (hostElement, cmpMeta) => { const hostRef = { $flags$: 0, $hostElement$: hostElement, $cmpMeta$: cmpMeta, $instanceValues$: /* @__PURE__ */ new Map() }; { hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r); } { hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r); hostElement["s-p"] = []; hostElement["s-rc"] = []; } const ref = hostRef; hostElement.__stencil__getHostRef = () => ref; return ref; }; var isMemberInElement = (elm, memberName) => memberName in elm; var consoleError = (e, el) => (0, console.error)(e, el); // src/client/client-load-module.ts var cmpModules = /* @__PURE__ */ new Map(); var loadModule = (cmpMeta, hostRef, hmrVersionId) => { const exportName = cmpMeta.$tagName$.replace(/-/g, "_"); const bundleId = cmpMeta.$lazyBundleId$; if (!bundleId) { return void 0; } const module = cmpModules.get(bundleId) ; if (module) { return module[exportName]; } if (!hmrVersionId || !BUILD.hotModuleReplacement) { const processMod = importedModule => { cmpModules.set(bundleId, importedModule); return importedModule[exportName]; } switch(bundleId) { case 'br-avatar': return import( /* webpackMode: "lazy" */ './br-avatar.entry.js').then(processMod, consoleError); case 'br-breadcrumb': return import( /* webpackMode: "lazy" */ './br-breadcrumb.entry.js').then(processMod, consoleError); case 'br-checkgroup': return import( /* webpackMode: "lazy" */ './br-checkgroup.entry.js').then(processMod, consoleError); case 'br-dropdown': return import( /* webpackMode: "lazy" */ './br-dropdown.entry.js').then(processMod, consoleError); case 'br-footer': return import( /* webpackMode: "lazy" */ './br-footer.entry.js').then(processMod, consoleError); case 'br-footer-category': return import( /* webpackMode: "lazy" */ './br-footer-category.entry.js').then(processMod, consoleError); case 'br-footer-item': return import( /* webpackMode: "lazy" */ './br-footer-item.entry.js').then(processMod, consoleError); case 'br-footer-legal': return import( /* webpackMode: "lazy" */ './br-footer-legal.entry.js').then(processMod, consoleError); case 'br-footer-logo': return import( /* webpackMode: "lazy" */ './br-footer-logo.entry.js').then(processMod, consoleError); case 'br-footer-social': return import( /* webpackMode: "lazy" */ './br-footer-social.entry.js').then(processMod, consoleError); case 'br-loading': return import( /* webpackMode: "lazy" */ './br-loading.entry.js').then(processMod, consoleError); case 'br-message': return import( /* webpackMode: "lazy" */ './br-message.entry.js').then(processMod, consoleError); case 'br-scrim': return import( /* webpackMode: "lazy" */ './br-scrim.entry.js').then(processMod, consoleError); case 'br-select': return import( /* webpackMode: "lazy" */ './br-select.entry.js').then(processMod, consoleError); case 'br-step': return import( /* webpackMode: "lazy" */ './br-step.entry.js').then(processMod, consoleError); case 'br-step-item': return import( /* webpackMode: "lazy" */ './br-step-item.entry.js').then(processMod, consoleError); case 'br-switch': return import( /* webpackMode: "lazy" */ './br-switch.entry.js').then(processMod, consoleError); case 'br-tab': return import( /* webpackMode: "lazy" */ './br-tab.entry.js').then(processMod, consoleError); case 'br-tab-item': return import( /* webpackMode: "lazy" */ './br-tab-item.entry.js').then(processMod, consoleError); case 'br-table': return import( /* webpackMode: "lazy" */ './br-table.entry.js').then(processMod, consoleError); case 'br-table-cell': return import( /* webpackMode: "lazy" */ './br-table-cell.entry.js').then(processMod, consoleError); case 'br-table-header-row': return import( /* webpackMode: "lazy" */ './br-table-header-row.entry.js').then(processMod, consoleError); case 'br-table-row': return import( /* webpackMode: "lazy" */ './br-table-row.entry.js').then(processMod, consoleError); case 'br-tag': return import( /* webpackMode: "lazy" */ './br-tag.entry.js').then(processMod, consoleError); case 'br-textarea': return import( /* webpackMode: "lazy" */ './br-textarea.entry.js').then(processMod, consoleError); case 'br-upload': return import( /* webpackMode: "lazy" */ './br-upload.entry.js').then(processMod, consoleError); case 'br-divider': return import( /* webpackMode: "lazy" */ './br-divider.entry.js').then(processMod, consoleError); case 'br-checkbox': return import( /* webpackMode: "lazy" */ './br-checkbox.entry.js').then(processMod, consoleError); case 'br-item': return import( /* webpackMode: "lazy" */ './br-item.entry.js').then(processMod, consoleError); case 'br-table-header-cell': return import( /* webpackMode: "lazy" */ './br-table-header-cell.entry.js').then(processMod, consoleError); case 'br-input_2': return import( /* webpackMode: "lazy" */ './br-input_2.entry.js').then(processMod, consoleError); case 'br-collapse_2': return import( /* webpackMode: "lazy" */ './br-collapse_2.entry.js').then(processMod, consoleError); case 'br-tooltip': return import( /* webpackMode: "lazy" */ './br-tooltip.entry.js').then(processMod, consoleError); case 'br-button_2': return import( /* webpackMode: "lazy" */ './br-button_2.entry.js').then(processMod, consoleError); } } return import( /* @vite-ignore */ /* webpackInclude: /\.entry\.js$/ */ /* webpackExclude: /\.system\.entry\.js$/ */ /* webpackMode: "lazy" */ `./${bundleId}.entry.js${""}` ).then( (importedModule) => { { cmpModules.set(bundleId, importedModule); } return importedModule[exportName]; }, (e) => { consoleError(e, hostRef.$hostElement$); } ); }; // src/client/client-style.ts var styles = /* @__PURE__ */ new Map(); // src/runtime/runtime-constants.ts var CONTENT_REF_ID = "r"; var ORG_LOCATION_ID = "o"; var SLOT_NODE_ID = "s"; var TEXT_NODE_ID = "t"; var COMMENT_NODE_ID = "c"; var HYDRATE_ID = "s-id"; var HYDRATED_STYLE_ID = "sty-id"; var HYDRATE_CHILD_ID = "c-id"; var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}"; var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}"; var XLINK_NS = "http://www.w3.org/1999/xlink"; var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [ "formAssociatedCallback", "formResetCallback", "formDisabledCallback", "formStateRestoreCallback" ]; var win = typeof window !== "undefined" ? window : {}; var H = win.HTMLElement || class { }; var plt = { $flags$: 0, $resourcesUrl$: "", jmp: (h2) => h2(), raf: (h2) => requestAnimationFrame(h2), ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts), rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts), ce: (eventName, opts) => new CustomEvent(eventName, opts) }; var supportsListenerOptions = /* @__PURE__ */ (() => { var _a; let supportsListenerOptions2 = false; try { (_a = win.document) == null ? void 0 : _a.addEventListener( "e", null, Object.defineProperty({}, "passive", { get() { supportsListenerOptions2 = true; } }) ); } catch (e) { } return supportsListenerOptions2; })(); var promiseResolve = (v) => Promise.resolve(v); var supportsConstructableStylesheets = /* @__PURE__ */ (() => { try { new CSSStyleSheet(); return typeof new CSSStyleSheet().replaceSync === "function"; } catch (e) { } return false; })() ; var queuePending = false; var queueDomReads = []; var queueDomWrites = []; var queueTask = (queue, write) => (cb) => { queue.push(cb); if (!queuePending) { queuePending = true; if (write && plt.$flags$ & 4 /* queueSync */) { nextTick(flush); } else { plt.raf(flush); } } }; var consume = (queue) => { for (let i2 = 0; i2 < queue.length; i2++) { try { queue[i2](performance.now()); } catch (e) { consoleError(e); } } queue.length = 0; }; var flush = () => { consume(queueDomReads); { consume(queueDomWrites); if (queuePending = queueDomReads.length > 0) { plt.raf(flush); } } }; var nextTick = (cb) => promiseResolve().then(cb); var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true); 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/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; } }; var getSlottedChildNodes = (childNodes) => { const result = []; for (let i2 = 0; i2 < childNodes.length; i2++) { const slottedNode = childNodes[i2]["s-nr"] || void 0; if (slottedNode && slottedNode.isConnected) { result.push(slottedNode); } } return result; }; function getHostSlotNodes(childNodes, hostName, slotName) { let i2 = 0; let slottedNodes = []; let childNode; for (; i2 < childNodes.length; i2++) { childNode = childNodes[i2]; if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) { slottedNodes.push(childNode); if (typeof slotName !== "undefined") return slottedNodes; } slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)]; } return slottedNodes; } var 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 dispatchSlotChangeEvent(elm) { elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false })); } function findSlotFromSlottedNode(slottedNode, parentHost) { var _a; parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement); if (!parentHost) return { slotNode: null, slotName: "" }; const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || ""; const childNodes = internalCall(parentHost, "childNodes"); const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0]; return { slotNode, slotName }; } var patchSlottedNode = (node) => { if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return; patchNextSibling(node); patchPreviousSibling(node); patchParentNode(node); if (node.nodeType === Node.ELEMENT_NODE) { patchNextElementSibling(node); patchPreviousElementSibling(node); } }; var patchNextSibling = (node) => { if (!node || node.__nextSibling) return; patchHostOriginalAccessor("nextSibling", node); Object.defineProperty(node, "nextSibling", { get: function() { var _a; const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes; const index = parentNodes == null ? void 0 : parentNodes.indexOf(this); if (parentNodes && index > -1) { return parentNodes[index + 1]; } return this.__nextSibling; } }); }; var patchNextElementSibling = (element) => { if (!element || element.__nextElementSibling) return; patchHostOriginalAccessor("nextElementSibling", element); Object.defineProperty(element, "nextElementSibling", { get: function() { var _a; const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children; const index = parentEles == null ? void 0 : parentEles.indexOf(this); if (parentEles && index > -1) { return parentEles[index + 1]; } return this.__nextElementSibling; } }); }; var patchPreviousSibling = (node) => { if (!node || node.__previousSibling) return; patchHostOriginalAccessor("previousSibling", node); Object.defineProperty(node, "previousSibling", { get: function() { var _a; const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes; const index = parentNodes == null ? void 0 : parentNodes.indexOf(this); if (parentNodes && index > -1) { return parentNodes[index - 1]; } return this.__previousSibling; } }); }; var patchPreviousElementSibling = (element) => { if (!element || element.__previousElementSibling) return; patchHostOriginalAccessor("previousElementSibling", element); Object.defineProperty(element, "previousElementSibling", { get: function() { var _a; const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children; const index = parentNodes == null ? void 0 : parentNodes.indexOf(this); if (parentNodes && index > -1) { return parentNodes[index - 1]; } return this.__previousElementSibling; } }); }; var patchParentNode = (node) => { if (!node || node.__parentNode) return; patchHostOriginalAccessor("parentNode", node); Object.defineProperty(node, "parentNode", { get: function() { var _a; return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode; }, set: function(value) { this.__parentNode = value; } }); }; var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"]; var validNodesPatches = [ "childNodes", "firstChild", "lastChild", "nextSibling", "previousSibling", "textContent", "parentNode" ]; function patchHostOriginalAccessor(accessorName, node) { let accessor; if (validElementPatches.includes(accessorName)) { accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName); } else if (validNodesPatches.includes(accessorName)) { accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName); } if (!accessor) { accessor = Object.getOwnPropertyDescriptor(node, accessorName); } if (accessor) Object.defineProperty(node, "__" + accessorName, accessor); } function internalCall(node, method) { if ("__" + method in node) { const toReturn = node["__" + method]; if (typeof toReturn !== "function") return toReturn; return toReturn.bind(node); } else { if (typeof node[method] !== "function") return node[method]; return node[method].bind(node); } } var createTime = (fnName, tagName = "") => { { return () => { return; }; } }; var uniqueTime = (key, measureText) => { { return () => { return; }; } }; var h = (nodeName, vnodeData, ...children) => { let child = null; let key = null; let 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; } { 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; } return vnode; }; var newVNode = (tag, text) => { const vnode = { $flags$: 0, $tag$: tag, $text$: text, $elm$: null, $children$: null }; { vnode.$attrs$ = null; } { vnode.$key$ = 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) => { 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; if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) { initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map()); } hostElm[HYDRATE_ID] = hostId; hostElm.removeAttribute(HYDRATE_ID); hostRef.$vnode$ = clientHydrate( vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId, slottedNodes ); let crIndex = 0; const crLength = childRenderNodes.length; let childRenderNode; for (crIndex; crIndex < crLength; crIndex++) { childRenderNode = childRenderNodes[crIndex]; const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$; const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId); const node = childRenderNode.$elm$; if (!shadowRoot) { node["s-hn"] = tagName.toUpperCase(); if (childRenderNode.$tag$ === "slot") { node["s-cr"] = hostElm["s-cr"]; } } if (childRenderNode.$tag$ === "slot") { childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null; if (childRenderNode.$children$) { childRenderNode.$flags$ |= 2 /* isSlotFallback */; if (!childRenderNode.$elm$.childNodes.length) { childRenderNode.$children$.forEach((c) => { childRenderNode.$elm$.appendChild(c.$elm$); }); } } else { childRenderNode.$flags$ |= 1 /* isSlotReference */; } } if (orgLocationNode && orgLocationNode.isConnected) { if (shadowRoot && orgLocationNode["s-en"] === "") { orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling); } orgLocationNode.parentNode.removeChild(orgLocationNode); if (!shadowRoot) { node["s-oo"] = parseInt(childRenderNode.$nodeId$); } } plt.$orgLocNodes$.delete(orgLocationId); } const hosts = []; const snLen = slottedNodes.length; let snIndex = 0; let slotGroup; let snGroupIdx; let snGroupLen; let slottedItem; for (snIndex; snIndex < snLen; snIndex++) { slotGroup = slottedNodes[snIndex]; if (!slotGroup || !slotGroup.length) continue; snGroupLen = slotGroup.length; snGroupIdx = 0; for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) { slottedItem = slotGroup[snGroupIdx]; if (!hosts[slottedItem.hostId]) { hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId); } if (!hosts[slottedItem.hostId]) continue; const hostEle = hosts[slottedItem.hostId]; if (!hostEle.shadowRoot || !shadowRoot) { slottedItem.slot["s-cr"] = hostEle["s-cr"]; if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) { slottedItem.slot["s-cr"] = hostEle; } else { slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0]; } addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]); { patchSlottedNode(slottedItem.node); } } if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) { hostEle.appendChild(slottedItem.node); } } } if (shadowRoot && !shadowRoot.childNodes.length) { let rnIdex = 0; const rnLen = shadowRootNodes.length; if (rnLen) { for (rnIdex; rnIdex < rnLen; rnIdex++) { shadowRoot.appendChild(shadowRootNodes[rnIdex]); } Array.from(hostElm.childNodes).forEach((node) => { if (typeof node["s-sn"] !== "string") { if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) { node.removeAttribute("hidden"); } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) { node.parentNode.removeChild(node); } } }); } } plt.$orgLocNodes$.delete(hostElm["s-id"]); hostRef.$hostElement$ = hostElm; endHydrate(); }; var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => { let childNodeType; let childIdSplt; let childVNode; let i2; 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$ = []; } 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 ); } 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 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.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.document) { const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$); if (childVNode.$name$) { childVNode.$elm$.setAttribute("name", slotName); } if (parentNodeId && parentNodeId !== childVNode.$hostId$) { parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]); } else { node.parentNode.insertBefore(childVNode.$elm$, 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) => { let slottedNode = slotNode.nextSibling; slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || []; while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) { slottedNode["s-sn"] = slotName; slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId }); slottedNode = slottedNode.nextSibling; } }; var findCorrespondingNode = (node, type) => { let sibling = node; do { sibling = sibling.nextSibling; } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue)); return sibling; }; var parsePropertyValue = (propValue, propType) => { if (propValue != null && !isComplexType(propValue)) { if (propType & 4 /* Boolean */) { return propValue === "false" ? false : propValue === "" || !!propValue; } if (propType & 2 /* Number */) { return parseFloat(propValue); } if (propType & 1 /* String */) { return String(propValue); } return propValue; } return propValue; }; var getElement = (ref) => getHostRef(ref).$hostElement$ ; // src/runtime/event-emitter.ts var createEvent = (ref, name, flags) => { const elm = getElement(ref); return { emit: (detail) => { return emitEvent(elm, name, { bubbles: true, composed: true, cancelable: true, detail }); } }; }; var emitEvent = (elm, name, opts) => { const ev = plt.ce(name, opts); elm.dispatchEvent(ev); return ev; }; var rootAppliedStyles = /* @__PURE__ */ new WeakMap(); var registerStyle = (scopeId2, cssText, allowCS) => { let style = styles.get(scopeId2); if (supportsConstructableStylesheets && allowCS) { style = style || new CSSStyleSheet(); if (typeof style === "string") { style = cssText; } else { style.replaceSync(cssText); } } else { style = cssText; } styles.set(scopeId2, style); }; var addStyle = (styleContainerNode, cmpMeta, mode) => { var _a; const scopeId2 = getScopeId(cmpMeta); const style = styles.get(scopeId2); if (!win.document) { return scopeId2; } styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.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 = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style"); styleElm.innerHTML = style; const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document); if (nonce != null) { styleElm.setAttribute("nonce", nonce); } 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) { if (supportsConstructableStylesheets) { const stylesheet = new CSSStyleSheet(); stylesheet.replaceSync(style); styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets]; } else { 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); } } } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) { styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style]; } } 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); if ((flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */ || flags & 128 /* shadowNeedsScopedCss */)) { elm["s-sc"] = scopeId2; elm.classList.add(scopeId2 + "-h"); } endAttachStyles(); }; var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$); var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{"); var hydrateScopedToShadow = () => { if (!win.document) { return; } const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`); let i2 = 0; for (; i2 < styles2.length; i2++) { registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true); } }; 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"] && initialRender) { newClasses.push(elm["s-si"]); oldClasses.forEach((c) => { if (c.startsWith(elm["s-si"])) newClasses.push(c); }); newClasses = [...new Set(newClasses)]; 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) { if (prop.includes("-")) { elm.style.removeProperty(prop); } else { elm.style[prop] = ""; } } } } for (const prop in newValue) { if (!oldValue || newValue[prop] !== oldValue[prop]) { if (prop.includes("-")) { elm.style.setProperty(prop, newValue[prop]); } else { 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, 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) && true) { 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 ); } var hostTagName; var useNativeShadowDom = false; var isSvgMode = false; var createElm = (oldParentVNode, newParentVNode, childIndex) => { const newVNode2 = newParentVNode.$children$[childIndex]; let i2 = 0; let elm; let childNode; if (newVNode2.$text$ !== null) { elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$); } else { if (!win.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.document.createElement( newVNode2.$tag$ ); { updateElement(null, newVNode2, isSvgMode); } if (newVNode2.$children$) { for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) { childNode = createElm(oldParentVNode, newVNode2, i2); if (childNode) { elm.appendChild(childNode); } } } } elm["s-hn"] = hostTagName; return elm; }; var relocateToHostRoot = (parentElm) => { plt.$flags$ |= 1 /* isTmpDisconnected */; const host = parentElm.closest(hostTagName.toLowerCase()); if (host != null) { const contentRefNode = Array.from(host.__childNodes || host.childNodes).find( (ref) => ref["s-cr"] ); const childNodeArray = Array.from( parentElm.__childNodes || paren