lido-player 0.0.2-alpha-72 → 0.0.2-alpha-74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/cjs/index-BNAtcxNG.js +2061 -0
  2. package/dist/cjs/{utils-648c493a.js → index-BcKX8GV7.js} +13402 -10337
  3. package/dist/cjs/index.cjs.js +3 -5
  4. package/dist/cjs/lido-avatar_22.cjs.entry.js +12402 -9525
  5. package/dist/cjs/lido-player.cjs.js +7 -8
  6. package/dist/cjs/loader.cjs.js +3 -6
  7. package/dist/collection/collection-manifest.json +2 -2
  8. package/dist/collection/components/avatar/lido-avatar.js +137 -37
  9. package/dist/collection/components/calculator/lido-calculator.js +42 -10
  10. package/dist/collection/components/canvas/lido-canvas.js +26 -10
  11. package/dist/collection/components/cell/lido-cell.js +226 -34
  12. package/dist/collection/components/column/lido-col.js +124 -76
  13. package/dist/collection/components/container/lido-container.js +239 -48
  14. package/dist/collection/components/flashCard/lido-flash-card.js +166 -53
  15. package/dist/collection/components/float/lido-float.js +65 -21
  16. package/dist/collection/components/home/lido-home.js +95 -40
  17. package/dist/collection/components/image/lido-image.js +152 -72
  18. package/dist/collection/components/keyboard/lido-keyboard.js +92 -49
  19. package/dist/collection/components/mathMatrix/lido-math-matrix.js +118 -57
  20. package/dist/collection/components/position/lido-pos.js +127 -22
  21. package/dist/collection/components/random/lido-random.js +133 -22
  22. package/dist/collection/components/root/lido-root.js +51 -19
  23. package/dist/collection/components/row/lido-row.js +122 -71
  24. package/dist/collection/components/scale/lido-balance.js +143 -19
  25. package/dist/collection/components/shape/lido-shape.js +149 -24
  26. package/dist/collection/components/slideFill/lido-slide-fill.js +122 -50
  27. package/dist/collection/components/text/lido-text.js +205 -33
  28. package/dist/collection/components/trace/lido-trace.js +147 -25
  29. package/dist/collection/components/wrap/lido-wrap.js +119 -72
  30. package/dist/collection/utils/utils.js +2 -0
  31. package/dist/collection/utils/utilsHandlers/slideHandler.js +3 -0
  32. package/dist/collection/utils/utilsHandlers/sortHandler.js +8 -0
  33. package/dist/components/index.d.ts +2 -0
  34. package/dist/components/index.js +1 -1
  35. package/dist/components/lido-avatar.js +1 -6
  36. package/dist/components/lido-balance.js +1 -6
  37. package/dist/components/lido-calculator.js +1 -6
  38. package/dist/components/lido-canvas.js +1 -6
  39. package/dist/components/lido-cell.js +1 -6
  40. package/dist/components/lido-col.js +1 -6
  41. package/dist/components/lido-container.js +1 -6
  42. package/dist/components/lido-flash-card.js +1 -6
  43. package/dist/components/lido-float.js +1 -6
  44. package/dist/components/lido-home.js +1 -6
  45. package/dist/components/lido-image.js +1 -6
  46. package/dist/components/lido-keyboard.js +1 -6
  47. package/dist/components/lido-math-matrix.js +1 -6
  48. package/dist/components/lido-pos.js +1 -6
  49. package/dist/components/lido-random.js +1 -6
  50. package/dist/components/lido-root.js +1 -237
  51. package/dist/components/lido-row.js +1 -6
  52. package/dist/components/lido-shape.js +1 -6
  53. package/dist/components/lido-slide-fill.js +1 -6
  54. package/dist/components/lido-text.js +1 -6
  55. package/dist/components/lido-trace.js +1 -6
  56. package/dist/components/lido-wrap.js +1 -6
  57. package/dist/components/p-B5eWaJMV.js +1 -0
  58. package/dist/components/p-BEteaaKf.js +1 -0
  59. package/dist/components/p-BHL7G-y0.js +1 -0
  60. package/dist/components/p-BMLH8kUS.js +1 -0
  61. package/dist/components/p-BpyuUL_l.js +1 -0
  62. package/dist/components/p-C1t5EKXt.js +1 -0
  63. package/dist/components/p-C4JlwGnv.js +1 -0
  64. package/dist/components/p-C4rRkRc8.js +1 -0
  65. package/dist/components/p-CeRGpl37.js +1 -0
  66. package/dist/components/p-Czy5pBTg.js +1 -0
  67. package/dist/components/p-D3gyPMJP.js +1 -0
  68. package/dist/components/p-DBZ3cqpl.js +1 -0
  69. package/dist/components/p-DI3YQ1ap.js +1 -0
  70. package/dist/components/p-DSsslp38.js +1 -0
  71. package/dist/components/p-DY8oDVo1.js +1 -0
  72. package/dist/components/p-DgB4pFUj.js +1 -0
  73. package/dist/components/p-DgaDcUWF.js +1 -0
  74. package/dist/components/p-DwMDPYdp.js +1 -0
  75. package/dist/components/p-dOiNR1s-.js +1 -0
  76. package/dist/components/p-o7zhsGY5.js +1 -0
  77. package/dist/components/p-vBXlSGWi.js +1 -0
  78. package/dist/{components/p-7e46549c.js → esm/index-DOv-IceV.js} +13402 -11777
  79. package/dist/esm/index-Dr6Jw5p1.js +2032 -0
  80. package/dist/esm/index.js +2 -2
  81. package/dist/esm/lido-avatar_22.entry.js +12130 -9251
  82. package/dist/esm/lido-player.js +5 -5
  83. package/dist/esm/loader.js +3 -4
  84. package/dist/lido-player/index.esm.js +1 -1
  85. package/dist/lido-player/lido-player.esm.js +1 -1
  86. package/dist/lido-player/p-24cfd3d1.entry.js +1 -0
  87. package/dist/lido-player/p-3Ez9RNAg.js +1 -0
  88. package/dist/lido-player/p-Dr6Jw5p1.js +2 -0
  89. package/dist/types/components.d.ts +1301 -44
  90. package/dist/types/stencil-public-runtime.d.ts +192 -8
  91. package/package.json +1 -1
  92. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  93. package/dist/cjs/index-baff5c15.js +0 -1584
  94. package/dist/components/p-1726d6f6.js +0 -181
  95. package/dist/components/p-22d39087.js +0 -6630
  96. package/dist/components/p-2fc491ed.js +0 -129
  97. package/dist/components/p-3aca9848.js +0 -3029
  98. package/dist/components/p-3bfa11a4.js +0 -325
  99. package/dist/components/p-48e0097d.js +0 -262
  100. package/dist/components/p-6268ef05.js +0 -122
  101. package/dist/components/p-715a8bf6.js +0 -129
  102. package/dist/components/p-8dbe420f.js +0 -97
  103. package/dist/components/p-a41d80a5.js +0 -133
  104. package/dist/components/p-aaac7d0a.js +0 -186
  105. package/dist/components/p-b3bcdf31.js +0 -192
  106. package/dist/components/p-b44a5f34.js +0 -2858
  107. package/dist/components/p-c19283ce.js +0 -130
  108. package/dist/components/p-ca8f0593.js +0 -140
  109. package/dist/components/p-d2bf80bf.js +0 -128
  110. package/dist/components/p-d6545e4f.js +0 -188
  111. package/dist/components/p-d8484fa1.js +0 -917
  112. package/dist/components/p-ee538ee5.js +0 -650
  113. package/dist/components/p-f3fba3fc.js +0 -260
  114. package/dist/components/p-ff304bfa.js +0 -110
  115. package/dist/esm/app-globals-0f993ce5.js +0 -3
  116. package/dist/esm/index-37c2ad2d.js +0 -1554
  117. package/dist/esm/utils-0c9b564c.js +0 -70338
  118. package/dist/lido-player/p-87420a60.js +0 -9
  119. package/dist/lido-player/p-9a9d5339.js +0 -2
  120. package/dist/lido-player/p-cccdeff1.entry.js +0 -1
  121. package/dist/lido-player/p-e1255160.js +0 -1
  122. package/loader/package.json +0 -11
@@ -0,0 +1,2061 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () { return e[k]; }
13
+ });
14
+ }
15
+ });
16
+ }
17
+ n.default = e;
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ const NAMESPACE = 'lido-player';
22
+ const BUILD = /* lido-player */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
23
+
24
+ const globalScripts = () => {};
25
+ const globalStyles = "@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400..800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Baloo+Bhai+2:wght@400..800&display=swap'); body{overflow:hidden;background-position:center;background-size:cover;background-repeat:no-repeat;height:100vh}*{user-select:none}.lido-disable-check-button{pointer-events:none;background-color:#9393935c !important;color:white}.lido-element-selected{border:2px solid;background-color:#ffdf7d !important}.diagonal-target,.diagonal-drop *{transform:scale(0.8) !important;opacity:1 !important}.cloned-element{display:flex !important;position:absolute !important;filter:grayscale(100%);pointer-events:none}.removeShadow{box-shadow:0px 0px 0px 0px #ff8900 !important}.highlight-element{border:2px solid white;box-shadow:rgb(243, 77, 8) 0px 0px 40px !important}.drop-element.empty{border:4px dashed #f34d08 !important}.drop-element.filled{border:'none' !important}.drag-element{box-shadow:0px 15px 11px rgba(43, 0, 0, 0.3) !important}.drag-element.dropped{box-shadow:none !important}.click-element{background-color:var(--btn-bg-color, rgba(255, 172, 76, 1)) !important;box-shadow:var(--btn-shadow-px) var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;cursor:pointer;transition:box-shadow 0.1s ease-out, transform 0.2s ease-out;}.click-element:active{box-shadow:0px 0px 0px var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;transform:translateY(var(--btn-active));}.click-element:focus{outline:2px solid dodgerblue;outline-offset:3px}.after-drop-popup-container{width:200%;height:200%;background-color:rgba(0, 0, 0, 0.8);position:absolute;display:flex;flex-direction:row-reverse;align-items:center;justify-content:center !important;gap:80px}.after-drop-popup-drag-element{scale:1.5;border-radius:8px;transform:none !important;position:unset !important}.after-drop-popup-drop-element{scale:1.5;border:unset;border-radius:8px;transform:none !important;position:unset !important}@keyframes zoomFadeIn{0%{transform:scale(0.6);opacity:0}100%{transform:scale(1);opacity:1}}.zoom-fade-in{animation:zoomFadeIn 0.8s ease-out forwards}@keyframes zoomFadeOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0.6);opacity:0}}.zoom-fade-out{animation:zoomFadeOut 0.8s ease-in forwards}.slide-numbers{width:70px;height:70px;border:1px solid #f57139;background-color:white;font-weight:500;color:#f57139;font-size:44px;border-radius:40px;display:flex;align-items:center;justify-content:center;font-family:'Baloo Bhai 2', serif}.slide-numbers-bottom{position:absolute;display:flex;justify-content:space-around;align-items:center;bottom:-25px;width:100%;height:50px}.slide-numbers-left{position:absolute;display:flex;flex-direction:column;justify-content:space-around;height:100%;width:50px;left:-25px;bottom:0px}.lido-speak-icon{width:56px;height:56px;position:absolute;top:-25px;right:-25px;z-index:10;background-image:url(\"https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/template/audioIcon.png\");background-color:white;border:4px solid #F34D08;border-radius:16px;box-shadow:0px 4px 0px 0px #F34D08;background-size:contain;background-repeat:no-repeat;cursor:pointer}.lido-speak-icon:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px !important}.lido-strong-shake{animation:strongShake 0.3s ease}.lido-scaled-shake{animation:scaledShake 0.6s ease-in-out}.lido-horizontal-shake{animation:horizontalShake 0.6s ease-in-out;border-radius:20px}.lido-vertical-shake{animation:verticalShake 0.6s ease-in-out;border-radius:20px}.lido-diagonal-shake{animation:diagonalShake 0.5s ease-in-out;border-radius:20px;will-change:transform}.lido-glow{animation:glowPulse 1s infinite alternate;transition:opacity 0.5s ease-in-out}.lido-box-highlight{animation:topToPlace 0.3s linear}.lido-display-hiddenvalue{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:80px;font-weight:1000;color:brown;-webkit-text-stroke:2px white;font-family:'Baloo Bhai 2', sans-serif;pointer-events:none}.lido-image-colorize{position:relative;display:inline-block}.lido-image-colorize::after{content:'';position:absolute;inset:0;background:var(--tint-color);mix-blend-mode:multiply;opacity:0.8;pointer-events:none;mask-image:var(--mask-url);mask-size:cover;mask-repeat:no-repeat;mask-position:center}.lido-tts-highlight-overlay{position:fixed;pointer-events:none;z-index:9999;background:linear-gradient(\r\n 180deg,\r\n rgba(255, 235, 59, 0.95),\r\n rgba(255, 214, 0, 0.95)\r\n );border-radius:6px;box-shadow:0 2px 6px rgba(0, 0, 0, 0.18),\r\n inset 0 -1px 0 rgba(255, 255, 255, 0.25);transition:left 55ms linear,\r\n top 55ms linear,\r\n width 55ms ease-out,\r\n height 55ms ease-out,\r\n opacity 80ms ease-out;opacity:0.95;will-change:transform, width, height}";
26
+
27
+ /*
28
+ Stencil Client Platform v4.42.1 | MIT Licensed | https://stenciljs.com
29
+ */
30
+
31
+ var reWireGetterSetter = (instance, hostRef) => {
32
+ var _a;
33
+ const cmpMeta = hostRef.$cmpMeta$;
34
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
35
+ members.map(([memberName, [memberFlags]]) => {
36
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
37
+ const ogValue = instance[memberName];
38
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
39
+ if (ogDescriptor) {
40
+ Object.defineProperty(instance, memberName, {
41
+ get() {
42
+ return ogDescriptor.get.call(this);
43
+ },
44
+ set(newValue) {
45
+ ogDescriptor.set.call(this, newValue);
46
+ },
47
+ configurable: true,
48
+ enumerable: true
49
+ });
50
+ }
51
+ instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
52
+ }
53
+ });
54
+ };
55
+ function getPropertyDescriptor(obj, memberName) {
56
+ while (obj) {
57
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
58
+ if (desc == null ? void 0 : desc.get) return desc;
59
+ obj = Object.getPrototypeOf(obj);
60
+ }
61
+ return void 0;
62
+ }
63
+
64
+ // src/client/client-host-ref.ts
65
+ var getHostRef = (ref) => {
66
+ if (ref.__stencil__getHostRef) {
67
+ return ref.__stencil__getHostRef();
68
+ }
69
+ return void 0;
70
+ };
71
+ var registerInstance = (lazyInstance, hostRef) => {
72
+ if (!hostRef) return;
73
+ lazyInstance.__stencil__getHostRef = () => hostRef;
74
+ hostRef.$lazyInstance$ = lazyInstance;
75
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
76
+ reWireGetterSetter(lazyInstance, hostRef);
77
+ }
78
+ };
79
+ var registerHost = (hostElement, cmpMeta) => {
80
+ const hostRef = {
81
+ $flags$: 0,
82
+ $hostElement$: hostElement,
83
+ $cmpMeta$: cmpMeta,
84
+ $instanceValues$: /* @__PURE__ */ new Map(),
85
+ $serializerValues$: /* @__PURE__ */ new Map()
86
+ };
87
+ {
88
+ hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
89
+ }
90
+ {
91
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
92
+ hostElement["s-p"] = [];
93
+ hostElement["s-rc"] = [];
94
+ }
95
+ {
96
+ hostRef.$fetchedCbList$ = [];
97
+ }
98
+ const ref = hostRef;
99
+ hostElement.__stencil__getHostRef = () => ref;
100
+ return ref;
101
+ };
102
+ var isMemberInElement = (elm, memberName) => memberName in elm;
103
+ var consoleError = (e, el) => (0, console.error)(e, el);
104
+
105
+ // src/client/client-load-module.ts
106
+ var cmpModules = /* @__PURE__ */ new Map();
107
+ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
108
+ const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
109
+ const bundleId = cmpMeta.$lazyBundleId$;
110
+ if (!bundleId) {
111
+ return void 0;
112
+ }
113
+ const module = cmpModules.get(bundleId) ;
114
+ if (module) {
115
+ return module[exportName];
116
+ }
117
+
118
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
119
+ const processMod = importedModule => {
120
+ cmpModules.set(bundleId, importedModule);
121
+ return importedModule[exportName];
122
+ }
123
+ switch(bundleId) {
124
+
125
+ case 'lido-avatar_22.cjs':
126
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
127
+ /* webpackMode: "lazy" */
128
+ './lido-avatar_22.cjs.entry.js')); }).then(processMod, consoleError);
129
+ }
130
+ }
131
+ return (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(
132
+ /* @vite-ignore */
133
+ /* webpackInclude: /\.entry\.js$/ */
134
+ /* webpackExclude: /\.system\.entry\.js$/ */
135
+ /* webpackMode: "lazy" */
136
+ `./${bundleId}.entry.js${""}`
137
+ ).then(
138
+ (importedModule) => {
139
+ {
140
+ cmpModules.set(bundleId, importedModule);
141
+ }
142
+ return importedModule[exportName];
143
+ },
144
+ (e) => {
145
+ consoleError(e, hostRef.$hostElement$);
146
+ }
147
+ );
148
+ };
149
+
150
+ // src/client/client-style.ts
151
+ var styles = /* @__PURE__ */ new Map();
152
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
153
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
154
+ var XLINK_NS = "http://www.w3.org/1999/xlink";
155
+ var win = typeof window !== "undefined" ? window : {};
156
+ var plt = {
157
+ $flags$: 0,
158
+ $resourcesUrl$: "",
159
+ jmp: (h2) => h2(),
160
+ raf: (h2) => requestAnimationFrame(h2),
161
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
162
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
163
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
164
+ };
165
+ var promiseResolve = (v) => Promise.resolve(v);
166
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
167
+ try {
168
+ if (!win.document.adoptedStyleSheets) {
169
+ return false;
170
+ }
171
+ new CSSStyleSheet();
172
+ return typeof new CSSStyleSheet().replaceSync === "function";
173
+ } catch (e) {
174
+ }
175
+ return false;
176
+ })() ;
177
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
178
+ var queuePending = false;
179
+ var queueDomReads = [];
180
+ var queueDomWrites = [];
181
+ var queueTask = (queue, write) => (cb) => {
182
+ queue.push(cb);
183
+ if (!queuePending) {
184
+ queuePending = true;
185
+ if (write && plt.$flags$ & 4 /* queueSync */) {
186
+ nextTick(flush);
187
+ } else {
188
+ plt.raf(flush);
189
+ }
190
+ }
191
+ };
192
+ var consume = (queue) => {
193
+ for (let i2 = 0; i2 < queue.length; i2++) {
194
+ try {
195
+ queue[i2](performance.now());
196
+ } catch (e) {
197
+ consoleError(e);
198
+ }
199
+ }
200
+ queue.length = 0;
201
+ };
202
+ var flush = () => {
203
+ consume(queueDomReads);
204
+ {
205
+ consume(queueDomWrites);
206
+ if (queuePending = queueDomReads.length > 0) {
207
+ plt.raf(flush);
208
+ }
209
+ }
210
+ };
211
+ var nextTick = (cb) => promiseResolve().then(cb);
212
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
213
+
214
+ // src/runtime/asset-path.ts
215
+ var getAssetPath = (path) => {
216
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
217
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
218
+ };
219
+
220
+ // src/utils/style.ts
221
+ function createStyleSheetIfNeededAndSupported(styles2) {
222
+ if (!supportsConstructableStylesheets) return void 0;
223
+ const sheet = new CSSStyleSheet();
224
+ sheet.replaceSync(styles2);
225
+ return sheet;
226
+ }
227
+
228
+ // src/utils/shadow-root.ts
229
+ var globalStyleSheet;
230
+ function createShadowRoot(cmpMeta) {
231
+ var _a;
232
+ const opts = { mode: "open" };
233
+ const shadowRoot = this.attachShadow(opts);
234
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
235
+ if (globalStyleSheet) {
236
+ if (supportsMutableAdoptedStyleSheets) {
237
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
238
+ } else {
239
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
240
+ }
241
+ } else if (!supportsConstructableStylesheets) {
242
+ const styleElm = document.createElement("style");
243
+ styleElm.innerHTML = globalStyles;
244
+ shadowRoot.prepend(styleElm);
245
+ }
246
+ }
247
+ var updateFallbackSlotVisibility = (elm) => {
248
+ const childNodes = internalCall(elm, "childNodes");
249
+ if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
250
+ getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
251
+ if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
252
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
253
+ slotNode.hidden = true;
254
+ } else {
255
+ slotNode.hidden = false;
256
+ }
257
+ }
258
+ });
259
+ }
260
+ let i2 = 0;
261
+ for (i2 = 0; i2 < childNodes.length; i2++) {
262
+ const childNode = childNodes[i2];
263
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
264
+ updateFallbackSlotVisibility(childNode);
265
+ }
266
+ }
267
+ };
268
+ var getSlottedChildNodes = (childNodes) => {
269
+ const result = [];
270
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
271
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
272
+ if (slottedNode && slottedNode.isConnected) {
273
+ result.push(slottedNode);
274
+ }
275
+ }
276
+ return result;
277
+ };
278
+ function getHostSlotNodes(childNodes, hostName, slotName) {
279
+ let i2 = 0;
280
+ let slottedNodes = [];
281
+ let childNode;
282
+ for (; i2 < childNodes.length; i2++) {
283
+ childNode = childNodes[i2];
284
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
285
+ slottedNodes.push(childNode);
286
+ if (typeof slotName !== "undefined") return slottedNodes;
287
+ }
288
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
289
+ }
290
+ return slottedNodes;
291
+ }
292
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
293
+ const childNodes = [];
294
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
295
+ let node = slot;
296
+ while (node = node.nextSibling) {
297
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
298
+ }
299
+ return childNodes;
300
+ };
301
+ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
302
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
303
+ if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
304
+ return true;
305
+ }
306
+ if (nodeToRelocate.getAttribute("slot") === slotName) {
307
+ return true;
308
+ }
309
+ return false;
310
+ }
311
+ if (nodeToRelocate["s-sn"] === slotName) {
312
+ return true;
313
+ }
314
+ return slotName === "";
315
+ };
316
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
317
+ function patchSlotNode(node) {
318
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
319
+ const assignedFactory = (elementsOnly) => (function(opts) {
320
+ const toReturn = [];
321
+ const slotName = this["s-sn"];
322
+ if (opts == null ? void 0 : opts.flatten) {
323
+ console.error(`
324
+ Flattening is not supported for Stencil non-shadow slots.
325
+ You can use \`.childNodes\` to nested slot fallback content.
326
+ If you have a particular use case, please open an issue on the Stencil repo.
327
+ `);
328
+ }
329
+ const parent = this["s-cr"].parentElement;
330
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
331
+ slottedNodes.forEach((n) => {
332
+ if (slotName === getSlotName(n)) {
333
+ toReturn.push(n);
334
+ }
335
+ });
336
+ if (elementsOnly) {
337
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
338
+ }
339
+ return toReturn;
340
+ }).bind(node);
341
+ node.assignedElements = assignedFactory(true);
342
+ node.assignedNodes = assignedFactory(false);
343
+ }
344
+ function dispatchSlotChangeEvent(elm) {
345
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
346
+ }
347
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
348
+ var _a;
349
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
350
+ if (!parentHost) return { slotNode: null, slotName: "" };
351
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
352
+ const childNodes = internalCall(parentHost, "childNodes");
353
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
354
+ return { slotNode, slotName };
355
+ }
356
+ function internalCall(node, method) {
357
+ if ("__" + method in node) {
358
+ const toReturn = node["__" + method];
359
+ if (typeof toReturn !== "function") return toReturn;
360
+ return toReturn.bind(node);
361
+ } else {
362
+ if (typeof node[method] !== "function") return node[method];
363
+ return node[method].bind(node);
364
+ }
365
+ }
366
+ var createTime = (fnName, tagName = "") => {
367
+ {
368
+ return () => {
369
+ return;
370
+ };
371
+ }
372
+ };
373
+ var uniqueTime = (key, measureText) => {
374
+ {
375
+ return () => {
376
+ return;
377
+ };
378
+ }
379
+ };
380
+
381
+ // src/utils/query-nonce-meta-tag-content.ts
382
+ function queryNonceMetaTagContent(doc) {
383
+ var _a, _b, _c;
384
+ 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;
385
+ }
386
+
387
+ // src/runtime/styles.ts
388
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
389
+ var registerStyle = (scopeId2, cssText, allowCS) => {
390
+ let style = styles.get(scopeId2);
391
+ if (supportsConstructableStylesheets && allowCS) {
392
+ style = style || new CSSStyleSheet();
393
+ if (typeof style === "string") {
394
+ style = cssText;
395
+ } else {
396
+ style.replaceSync(cssText);
397
+ }
398
+ } else {
399
+ style = cssText;
400
+ }
401
+ styles.set(scopeId2, style);
402
+ };
403
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
404
+ var _a, _b, _c;
405
+ const scopeId2 = getScopeId(cmpMeta);
406
+ const style = styles.get(scopeId2);
407
+ if (!win.document) {
408
+ return scopeId2;
409
+ }
410
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
411
+ if (style) {
412
+ if (typeof style === "string") {
413
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
414
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
415
+ let styleElm;
416
+ if (!appliedStyles) {
417
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
418
+ }
419
+ if (!appliedStyles.has(scopeId2)) {
420
+ styleElm = win.document.createElement("style");
421
+ styleElm.textContent = style;
422
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
423
+ if (nonce != null) {
424
+ styleElm.setAttribute("nonce", nonce);
425
+ }
426
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
427
+ if (styleContainerNode.nodeName === "HEAD") {
428
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
429
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
430
+ styleContainerNode.insertBefore(
431
+ styleElm,
432
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
433
+ );
434
+ } else if ("host" in styleContainerNode) {
435
+ if (supportsConstructableStylesheets) {
436
+ const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
437
+ const stylesheet = new currentWindow.CSSStyleSheet();
438
+ stylesheet.replaceSync(style);
439
+ if (supportsMutableAdoptedStyleSheets) {
440
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
441
+ } else {
442
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
443
+ }
444
+ } else {
445
+ const existingStyleContainer = styleContainerNode.querySelector("style");
446
+ if (existingStyleContainer) {
447
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
448
+ } else {
449
+ styleContainerNode.prepend(styleElm);
450
+ }
451
+ }
452
+ } else {
453
+ styleContainerNode.append(styleElm);
454
+ }
455
+ }
456
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
457
+ styleContainerNode.insertBefore(styleElm, null);
458
+ }
459
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
460
+ styleElm.textContent += SLOT_FB_CSS;
461
+ }
462
+ if (appliedStyles) {
463
+ appliedStyles.add(scopeId2);
464
+ }
465
+ }
466
+ } else {
467
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
468
+ if (!appliedStyles) {
469
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
470
+ }
471
+ if (!appliedStyles.has(scopeId2)) {
472
+ const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
473
+ let stylesheet;
474
+ if (style.constructor === currentWindow.CSSStyleSheet) {
475
+ stylesheet = style;
476
+ } else {
477
+ stylesheet = new currentWindow.CSSStyleSheet();
478
+ for (let i2 = 0; i2 < style.cssRules.length; i2++) {
479
+ stylesheet.insertRule(style.cssRules[i2].cssText, i2);
480
+ }
481
+ }
482
+ if (supportsMutableAdoptedStyleSheets) {
483
+ styleContainerNode.adoptedStyleSheets.push(stylesheet);
484
+ } else {
485
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
486
+ }
487
+ appliedStyles.add(scopeId2);
488
+ }
489
+ }
490
+ }
491
+ return scopeId2;
492
+ };
493
+ var attachStyles = (hostRef) => {
494
+ const cmpMeta = hostRef.$cmpMeta$;
495
+ const elm = hostRef.$hostElement$;
496
+ const flags = cmpMeta.$flags$;
497
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
498
+ const scopeId2 = addStyle(
499
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
500
+ cmpMeta);
501
+ if (flags & 10 /* needsScopedEncapsulation */) {
502
+ elm["s-sc"] = scopeId2;
503
+ elm.classList.add(scopeId2 + "-h");
504
+ }
505
+ endAttachStyles();
506
+ };
507
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
508
+ var isComplexType = (o) => {
509
+ o = typeof o;
510
+ return o === "object" || o === "function";
511
+ };
512
+
513
+ // src/runtime/vdom/h.ts
514
+ var h = (nodeName, vnodeData, ...children) => {
515
+ if (typeof nodeName === "string") {
516
+ nodeName = transformTag(nodeName);
517
+ }
518
+ let child = null;
519
+ let key = null;
520
+ let slotName = null;
521
+ let simple = false;
522
+ let lastSimple = false;
523
+ const vNodeChildren = [];
524
+ const walk = (c) => {
525
+ for (let i2 = 0; i2 < c.length; i2++) {
526
+ child = c[i2];
527
+ if (Array.isArray(child)) {
528
+ walk(child);
529
+ } else if (child != null && typeof child !== "boolean") {
530
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
531
+ child = String(child);
532
+ }
533
+ if (simple && lastSimple) {
534
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
535
+ } else {
536
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
537
+ }
538
+ lastSimple = simple;
539
+ }
540
+ }
541
+ };
542
+ walk(children);
543
+ if (vnodeData) {
544
+ if (vnodeData.key) {
545
+ key = vnodeData.key;
546
+ }
547
+ if (vnodeData.name) {
548
+ slotName = vnodeData.name;
549
+ }
550
+ {
551
+ const classData = vnodeData.className || vnodeData.class;
552
+ if (classData) {
553
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
554
+ }
555
+ }
556
+ }
557
+ const vnode = newVNode(nodeName, null);
558
+ vnode.$attrs$ = vnodeData;
559
+ if (vNodeChildren.length > 0) {
560
+ vnode.$children$ = vNodeChildren;
561
+ }
562
+ {
563
+ vnode.$key$ = key;
564
+ }
565
+ {
566
+ vnode.$name$ = slotName;
567
+ }
568
+ return vnode;
569
+ };
570
+ var newVNode = (tag, text) => {
571
+ const vnode = {
572
+ $flags$: 0,
573
+ $tag$: tag,
574
+ // Normalize undefined to null to prevent rendering "undefined" as text
575
+ $text$: text != null ? text : null,
576
+ $elm$: null,
577
+ $children$: null
578
+ };
579
+ {
580
+ vnode.$attrs$ = null;
581
+ }
582
+ {
583
+ vnode.$key$ = null;
584
+ }
585
+ {
586
+ vnode.$name$ = null;
587
+ }
588
+ return vnode;
589
+ };
590
+ var Host = {};
591
+ var isHost = (node) => node && node.$tag$ === Host;
592
+
593
+ // src/runtime/parse-property-value.ts
594
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
595
+ if (propValue != null && !isComplexType(propValue)) {
596
+ if (propType & 4 /* Boolean */) {
597
+ {
598
+ return propValue === "false" ? false : propValue === "" || !!propValue;
599
+ }
600
+ }
601
+ if (propType & 2 /* Number */) {
602
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
603
+ }
604
+ if (propType & 1 /* String */) {
605
+ return String(propValue);
606
+ }
607
+ return propValue;
608
+ }
609
+ return propValue;
610
+ };
611
+ var getElement = (ref) => {
612
+ var _a;
613
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
614
+ };
615
+
616
+ // src/runtime/event-emitter.ts
617
+ var createEvent = (ref, name, flags) => {
618
+ const elm = getElement(ref);
619
+ return {
620
+ emit: (detail) => {
621
+ return emitEvent(elm, name, {
622
+ bubbles: true,
623
+ composed: true,
624
+ cancelable: true,
625
+ detail
626
+ });
627
+ }
628
+ };
629
+ };
630
+ var emitEvent = (elm, name, opts) => {
631
+ const ev = plt.ce(name, opts);
632
+ elm.dispatchEvent(ev);
633
+ return ev;
634
+ };
635
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
636
+ if (oldValue === newValue) {
637
+ return;
638
+ }
639
+ let isProp = isMemberInElement(elm, memberName);
640
+ let ln = memberName.toLowerCase();
641
+ if (memberName === "class") {
642
+ const classList = elm.classList;
643
+ const oldClasses = parseClassList(oldValue);
644
+ let newClasses = parseClassList(newValue);
645
+ {
646
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
647
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
648
+ }
649
+ } else if (memberName === "style") {
650
+ {
651
+ for (const prop in oldValue) {
652
+ if (!newValue || newValue[prop] == null) {
653
+ if (prop.includes("-")) {
654
+ elm.style.removeProperty(prop);
655
+ } else {
656
+ elm.style[prop] = "";
657
+ }
658
+ }
659
+ }
660
+ }
661
+ for (const prop in newValue) {
662
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
663
+ if (prop.includes("-")) {
664
+ elm.style.setProperty(prop, newValue[prop]);
665
+ } else {
666
+ elm.style[prop] = newValue[prop];
667
+ }
668
+ }
669
+ }
670
+ } else if (memberName === "key") ; else if (memberName === "ref") {
671
+ if (newValue) {
672
+ queueRefAttachment(newValue, elm);
673
+ }
674
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
675
+ if (memberName[2] === "-") {
676
+ memberName = memberName.slice(3);
677
+ } else if (isMemberInElement(win, ln)) {
678
+ memberName = ln.slice(2);
679
+ } else {
680
+ memberName = ln[2] + memberName.slice(3);
681
+ }
682
+ if (oldValue || newValue) {
683
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
684
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
685
+ if (oldValue) {
686
+ plt.rel(elm, memberName, oldValue, capture);
687
+ }
688
+ if (newValue) {
689
+ plt.ael(elm, memberName, newValue, capture);
690
+ }
691
+ }
692
+ } else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
693
+ const propName = memberName.slice(5);
694
+ let attrName;
695
+ {
696
+ const hostRef = getHostRef(elm);
697
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
698
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
699
+ if (memberMeta && memberMeta[1]) {
700
+ attrName = memberMeta[1];
701
+ }
702
+ }
703
+ }
704
+ if (!attrName) {
705
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
706
+ }
707
+ if (newValue == null || newValue === false) {
708
+ if (newValue !== false || elm.getAttribute(attrName) === "") {
709
+ elm.removeAttribute(attrName);
710
+ }
711
+ } else {
712
+ elm.setAttribute(attrName, newValue === true ? "" : newValue);
713
+ }
714
+ return;
715
+ } else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
716
+ const propName = memberName.slice(5);
717
+ try {
718
+ elm[propName] = newValue;
719
+ } catch (e) {
720
+ }
721
+ return;
722
+ } else {
723
+ const isComplex = isComplexType(newValue);
724
+ if ((isProp || isComplex && newValue !== null) && true) {
725
+ try {
726
+ if (!elm.tagName.includes("-")) {
727
+ const n = newValue == null ? "" : newValue;
728
+ if (memberName === "list") {
729
+ isProp = false;
730
+ } else if (oldValue == null || elm[memberName] !== n) {
731
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
732
+ elm[memberName] = n;
733
+ } else {
734
+ elm.setAttribute(memberName, n);
735
+ }
736
+ }
737
+ } else if (elm[memberName] !== newValue) {
738
+ elm[memberName] = newValue;
739
+ }
740
+ } catch (e) {
741
+ }
742
+ }
743
+ let xlink = false;
744
+ {
745
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
746
+ memberName = ln;
747
+ xlink = true;
748
+ }
749
+ }
750
+ if (newValue == null || newValue === false) {
751
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
752
+ if (xlink) {
753
+ elm.removeAttributeNS(XLINK_NS, memberName);
754
+ } else {
755
+ elm.removeAttribute(memberName);
756
+ }
757
+ }
758
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
759
+ newValue = newValue === true ? "" : newValue;
760
+ if (xlink) {
761
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
762
+ } else {
763
+ elm.setAttribute(memberName, newValue);
764
+ }
765
+ }
766
+ }
767
+ };
768
+ var parseClassListRegex = /\s/;
769
+ var parseClassList = (value) => {
770
+ if (typeof value === "object" && value && "baseVal" in value) {
771
+ value = value.baseVal;
772
+ }
773
+ if (!value || typeof value !== "string") {
774
+ return [];
775
+ }
776
+ return value.split(parseClassListRegex);
777
+ };
778
+ var CAPTURE_EVENT_SUFFIX = "Capture";
779
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
780
+
781
+ // src/runtime/vdom/update-element.ts
782
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
783
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
784
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
785
+ const newVnodeAttrs = newVnode.$attrs$ || {};
786
+ {
787
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
788
+ if (!(memberName in newVnodeAttrs)) {
789
+ setAccessor(
790
+ elm,
791
+ memberName,
792
+ oldVnodeAttrs[memberName],
793
+ void 0,
794
+ isSvgMode2,
795
+ newVnode.$flags$);
796
+ }
797
+ }
798
+ }
799
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
800
+ setAccessor(
801
+ elm,
802
+ memberName,
803
+ oldVnodeAttrs[memberName],
804
+ newVnodeAttrs[memberName],
805
+ isSvgMode2,
806
+ newVnode.$flags$);
807
+ }
808
+ };
809
+ function sortedAttrNames(attrNames) {
810
+ return attrNames.includes("ref") ? (
811
+ // we need to sort these to ensure that `'ref'` is the last attr
812
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
813
+ ) : (
814
+ // no need to sort, return the original array
815
+ attrNames
816
+ );
817
+ }
818
+ var contentRef;
819
+ var hostTagName;
820
+ var useNativeShadowDom = false;
821
+ var checkSlotFallbackVisibility = false;
822
+ var checkSlotRelocate = false;
823
+ var isSvgMode = false;
824
+ var refCallbacksToRemove = [];
825
+ var refCallbacksToAttach = [];
826
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
827
+ var _a;
828
+ const newVNode2 = newParentVNode.$children$[childIndex];
829
+ let i2 = 0;
830
+ let elm;
831
+ let childNode;
832
+ let oldVNode;
833
+ if (!useNativeShadowDom) {
834
+ checkSlotRelocate = true;
835
+ if (newVNode2.$tag$ === "slot") {
836
+ newVNode2.$flags$ |= newVNode2.$children$ ? (
837
+ // slot element has fallback content
838
+ // still create an element that "mocks" the slot element
839
+ 2 /* isSlotFallback */
840
+ ) : (
841
+ // slot element does not have fallback content
842
+ // create an html comment we'll use to always reference
843
+ // where actual slot content should sit next to
844
+ 1 /* isSlotReference */
845
+ );
846
+ }
847
+ }
848
+ if (newVNode2.$text$ != null) {
849
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
850
+ } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
851
+ elm = newVNode2.$elm$ = win.document.createTextNode("");
852
+ {
853
+ updateElement(null, newVNode2, isSvgMode);
854
+ }
855
+ } else {
856
+ if (!win.document) {
857
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
858
+ }
859
+ elm = newVNode2.$elm$ = win.document.createElement(
860
+ !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
861
+ );
862
+ {
863
+ updateElement(null, newVNode2, isSvgMode);
864
+ }
865
+ if (newVNode2.$children$) {
866
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
867
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
868
+ childNode = createElm(oldParentVNode, newVNode2, i2);
869
+ if (childNode) {
870
+ appendTarget.appendChild(childNode);
871
+ }
872
+ }
873
+ }
874
+ }
875
+ elm["s-hn"] = hostTagName;
876
+ {
877
+ if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
878
+ elm["s-sr"] = true;
879
+ elm["s-cr"] = contentRef;
880
+ elm["s-sn"] = newVNode2.$name$ || "";
881
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
882
+ patchSlotNode(elm);
883
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
884
+ if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
885
+ relocateToHostRoot(oldParentVNode.$elm$);
886
+ }
887
+ }
888
+ }
889
+ return elm;
890
+ };
891
+ var relocateToHostRoot = (parentElm) => {
892
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
893
+ const host = parentElm.closest(hostTagName.toLowerCase());
894
+ if (host != null) {
895
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
896
+ (ref) => ref["s-cr"]
897
+ );
898
+ const childNodeArray = Array.from(
899
+ parentElm.__childNodes || parentElm.childNodes
900
+ );
901
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
902
+ if (childNode["s-sh"] != null) {
903
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
904
+ childNode["s-sh"] = void 0;
905
+ checkSlotRelocate = true;
906
+ }
907
+ }
908
+ }
909
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
910
+ };
911
+ var putBackInOriginalLocation = (parentElm, recursive) => {
912
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
913
+ const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
914
+ if (parentElm["s-sr"]) {
915
+ let node = parentElm;
916
+ while (node = node.nextSibling) {
917
+ if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
918
+ oldSlotChildNodes.push(node);
919
+ }
920
+ }
921
+ }
922
+ for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
923
+ const childNode = oldSlotChildNodes[i2];
924
+ if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
925
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
926
+ childNode["s-ol"].remove();
927
+ childNode["s-ol"] = void 0;
928
+ childNode["s-sh"] = void 0;
929
+ checkSlotRelocate = true;
930
+ }
931
+ if (recursive) {
932
+ putBackInOriginalLocation(childNode, recursive);
933
+ }
934
+ }
935
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
936
+ };
937
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
938
+ let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
939
+ let childNode;
940
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
941
+ containerElm = containerElm.shadowRoot;
942
+ }
943
+ if (parentVNode.$tag$ === "template") {
944
+ containerElm = containerElm.content;
945
+ }
946
+ for (; startIdx <= endIdx; ++startIdx) {
947
+ if (vnodes[startIdx]) {
948
+ childNode = createElm(null, parentVNode, startIdx);
949
+ if (childNode) {
950
+ vnodes[startIdx].$elm$ = childNode;
951
+ insertBefore(containerElm, childNode, referenceNode(before) );
952
+ }
953
+ }
954
+ }
955
+ };
956
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
957
+ for (let index = startIdx; index <= endIdx; ++index) {
958
+ const vnode = vnodes[index];
959
+ if (vnode) {
960
+ const elm = vnode.$elm$;
961
+ nullifyVNodeRefs(vnode);
962
+ if (elm) {
963
+ {
964
+ checkSlotFallbackVisibility = true;
965
+ if (elm["s-ol"]) {
966
+ elm["s-ol"].remove();
967
+ } else {
968
+ putBackInOriginalLocation(elm, true);
969
+ }
970
+ }
971
+ elm.remove();
972
+ }
973
+ }
974
+ }
975
+ };
976
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
977
+ let oldStartIdx = 0;
978
+ let newStartIdx = 0;
979
+ let idxInOld = 0;
980
+ let i2 = 0;
981
+ let oldEndIdx = oldCh.length - 1;
982
+ let oldStartVnode = oldCh[0];
983
+ let oldEndVnode = oldCh[oldEndIdx];
984
+ let newEndIdx = newCh.length - 1;
985
+ let newStartVnode = newCh[0];
986
+ let newEndVnode = newCh[newEndIdx];
987
+ let node;
988
+ let elmToMove;
989
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
990
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
991
+ if (oldStartVnode == null) {
992
+ oldStartVnode = oldCh[++oldStartIdx];
993
+ } else if (oldEndVnode == null) {
994
+ oldEndVnode = oldCh[--oldEndIdx];
995
+ } else if (newStartVnode == null) {
996
+ newStartVnode = newCh[++newStartIdx];
997
+ } else if (newEndVnode == null) {
998
+ newEndVnode = newCh[--newEndIdx];
999
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1000
+ patch(oldStartVnode, newStartVnode, isInitialRender);
1001
+ oldStartVnode = oldCh[++oldStartIdx];
1002
+ newStartVnode = newCh[++newStartIdx];
1003
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1004
+ patch(oldEndVnode, newEndVnode, isInitialRender);
1005
+ oldEndVnode = oldCh[--oldEndIdx];
1006
+ newEndVnode = newCh[--newEndIdx];
1007
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1008
+ if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1009
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1010
+ }
1011
+ patch(oldStartVnode, newEndVnode, isInitialRender);
1012
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1013
+ oldStartVnode = oldCh[++oldStartIdx];
1014
+ newEndVnode = newCh[--newEndIdx];
1015
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1016
+ if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1017
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1018
+ }
1019
+ patch(oldEndVnode, newStartVnode, isInitialRender);
1020
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1021
+ oldEndVnode = oldCh[--oldEndIdx];
1022
+ newStartVnode = newCh[++newStartIdx];
1023
+ } else {
1024
+ idxInOld = -1;
1025
+ {
1026
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1027
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1028
+ idxInOld = i2;
1029
+ break;
1030
+ }
1031
+ }
1032
+ }
1033
+ if (idxInOld >= 0) {
1034
+ elmToMove = oldCh[idxInOld];
1035
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1036
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1037
+ } else {
1038
+ patch(elmToMove, newStartVnode, isInitialRender);
1039
+ oldCh[idxInOld] = void 0;
1040
+ node = elmToMove.$elm$;
1041
+ }
1042
+ newStartVnode = newCh[++newStartIdx];
1043
+ } else {
1044
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1045
+ newStartVnode = newCh[++newStartIdx];
1046
+ }
1047
+ if (node) {
1048
+ {
1049
+ insertBefore(
1050
+ referenceNode(oldStartVnode.$elm$).parentNode,
1051
+ node,
1052
+ referenceNode(oldStartVnode.$elm$)
1053
+ );
1054
+ }
1055
+ }
1056
+ }
1057
+ }
1058
+ if (oldStartIdx > oldEndIdx) {
1059
+ addVnodes(
1060
+ parentElm,
1061
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
1062
+ newVNode2,
1063
+ newCh,
1064
+ newStartIdx,
1065
+ newEndIdx
1066
+ );
1067
+ } else if (newStartIdx > newEndIdx) {
1068
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1069
+ }
1070
+ };
1071
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1072
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1073
+ if (leftVNode.$tag$ === "slot") {
1074
+ return leftVNode.$name$ === rightVNode.$name$;
1075
+ }
1076
+ if (!isInitialRender) {
1077
+ return leftVNode.$key$ === rightVNode.$key$;
1078
+ }
1079
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1080
+ leftVNode.$key$ = rightVNode.$key$;
1081
+ }
1082
+ return true;
1083
+ }
1084
+ return false;
1085
+ };
1086
+ var referenceNode = (node) => node && node["s-ol"] || node;
1087
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1088
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
1089
+ const oldChildren = oldVNode.$children$;
1090
+ const newChildren = newVNode2.$children$;
1091
+ const tag = newVNode2.$tag$;
1092
+ const text = newVNode2.$text$;
1093
+ let defaultHolder;
1094
+ if (text == null) {
1095
+ {
1096
+ if (tag === "slot" && !useNativeShadowDom) {
1097
+ if (oldVNode.$name$ !== newVNode2.$name$) {
1098
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1099
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
1100
+ }
1101
+ }
1102
+ updateElement(oldVNode, newVNode2, isSvgMode);
1103
+ }
1104
+ if (oldChildren !== null && newChildren !== null) {
1105
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1106
+ } else if (newChildren !== null) {
1107
+ if (oldVNode.$text$ !== null) {
1108
+ elm.textContent = "";
1109
+ }
1110
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1111
+ } else if (
1112
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1113
+ !isInitialRender && BUILD.updatable && oldChildren !== null
1114
+ ) {
1115
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1116
+ } else ;
1117
+ } else if ((defaultHolder = elm["s-cr"])) {
1118
+ defaultHolder.parentNode.textContent = text;
1119
+ } else if (oldVNode.$text$ !== text) {
1120
+ elm.data = text;
1121
+ }
1122
+ };
1123
+ var relocateNodes = [];
1124
+ var markSlotContentForRelocation = (elm) => {
1125
+ let node;
1126
+ let hostContentNodes;
1127
+ let j;
1128
+ const children = elm.__childNodes || elm.childNodes;
1129
+ for (const childNode of children) {
1130
+ if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
1131
+ hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
1132
+ const slotName = childNode["s-sn"];
1133
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1134
+ node = hostContentNodes[j];
1135
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1136
+ if (isNodeLocatedInSlot(node, slotName)) {
1137
+ let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1138
+ checkSlotFallbackVisibility = true;
1139
+ node["s-sn"] = node["s-sn"] || slotName;
1140
+ if (relocateNodeData) {
1141
+ relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
1142
+ relocateNodeData.$slotRefNode$ = childNode;
1143
+ } else {
1144
+ node["s-sh"] = childNode["s-hn"];
1145
+ relocateNodes.push({
1146
+ $slotRefNode$: childNode,
1147
+ $nodeToRelocate$: node
1148
+ });
1149
+ }
1150
+ if (node["s-sr"]) {
1151
+ relocateNodes.map((relocateNode) => {
1152
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
1153
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1154
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1155
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1156
+ }
1157
+ }
1158
+ });
1159
+ }
1160
+ } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1161
+ relocateNodes.push({
1162
+ $nodeToRelocate$: node
1163
+ });
1164
+ }
1165
+ }
1166
+ }
1167
+ }
1168
+ if (childNode.nodeType === 1 /* ElementNode */) {
1169
+ markSlotContentForRelocation(childNode);
1170
+ }
1171
+ }
1172
+ };
1173
+ var nullifyVNodeRefs = (vNode) => {
1174
+ {
1175
+ if (vNode.$attrs$ && vNode.$attrs$.ref) {
1176
+ refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
1177
+ }
1178
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1179
+ }
1180
+ };
1181
+ var queueRefAttachment = (refCallback, elm) => {
1182
+ {
1183
+ refCallbacksToAttach.push(() => refCallback(elm));
1184
+ }
1185
+ };
1186
+ var flushQueuedRefCallbacks = () => {
1187
+ {
1188
+ refCallbacksToRemove.forEach((cb) => cb());
1189
+ refCallbacksToRemove.length = 0;
1190
+ refCallbacksToAttach.forEach((cb) => cb());
1191
+ refCallbacksToAttach.length = 0;
1192
+ }
1193
+ };
1194
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
1195
+ {
1196
+ if (typeof newNode["s-sn"] === "string") {
1197
+ parent.insertBefore(newNode, reference);
1198
+ const { slotNode } = findSlotFromSlottedNode(newNode);
1199
+ if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
1200
+ return newNode;
1201
+ }
1202
+ }
1203
+ if (parent.__insertBefore) {
1204
+ return parent.__insertBefore(newNode, reference);
1205
+ } else {
1206
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1207
+ }
1208
+ };
1209
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1210
+ var _a, _b, _c, _d, _e;
1211
+ const hostElm = hostRef.$hostElement$;
1212
+ const cmpMeta = hostRef.$cmpMeta$;
1213
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1214
+ const isHostElement = isHost(renderFnResults);
1215
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
1216
+ hostTagName = hostElm.tagName;
1217
+ if (cmpMeta.$attrsToReflect$) {
1218
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1219
+ cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {
1220
+ {
1221
+ rootVnode.$attrs$[attribute] = hostElm[propName];
1222
+ }
1223
+ });
1224
+ }
1225
+ if (isInitialLoad && rootVnode.$attrs$) {
1226
+ for (const key of Object.keys(rootVnode.$attrs$)) {
1227
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
1228
+ rootVnode.$attrs$[key] = hostElm[key];
1229
+ }
1230
+ }
1231
+ }
1232
+ rootVnode.$tag$ = null;
1233
+ rootVnode.$flags$ |= 4 /* isHost */;
1234
+ hostRef.$vnode$ = rootVnode;
1235
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
1236
+ useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
1237
+ {
1238
+ contentRef = hostElm["s-cr"];
1239
+ checkSlotFallbackVisibility = false;
1240
+ }
1241
+ patch(oldVNode, rootVnode, isInitialLoad);
1242
+ {
1243
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1244
+ if (checkSlotRelocate) {
1245
+ markSlotContentForRelocation(rootVnode.$elm$);
1246
+ for (const relocateData of relocateNodes) {
1247
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
1248
+ if (!nodeToRelocate["s-ol"] && win.document) {
1249
+ const orgLocationNode = win.document.createTextNode("");
1250
+ orgLocationNode["s-nr"] = nodeToRelocate;
1251
+ insertBefore(
1252
+ nodeToRelocate.parentNode,
1253
+ nodeToRelocate["s-ol"] = orgLocationNode,
1254
+ nodeToRelocate,
1255
+ isInitialLoad
1256
+ );
1257
+ }
1258
+ }
1259
+ for (const relocateData of relocateNodes) {
1260
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
1261
+ const slotRefNode = relocateData.$slotRefNode$;
1262
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
1263
+ nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
1264
+ }
1265
+ if (slotRefNode) {
1266
+ const parentNodeRef = slotRefNode.parentNode;
1267
+ let insertBeforeNode = slotRefNode.nextSibling;
1268
+ if (insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
1269
+ let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
1270
+ while (orgLocationNode) {
1271
+ let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
1272
+ if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
1273
+ refNode = refNode.nextSibling;
1274
+ while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
1275
+ refNode = refNode == null ? void 0 : refNode.nextSibling;
1276
+ }
1277
+ if (!refNode || !refNode["s-nr"]) {
1278
+ insertBeforeNode = refNode;
1279
+ break;
1280
+ }
1281
+ }
1282
+ orgLocationNode = orgLocationNode.previousSibling;
1283
+ }
1284
+ }
1285
+ const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
1286
+ const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
1287
+ if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
1288
+ if (nodeToRelocate !== insertBeforeNode) {
1289
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);
1290
+ if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith("s-nt-")) {
1291
+ const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, ""));
1292
+ textNode["s-hn"] = nodeToRelocate["s-hn"];
1293
+ textNode["s-sn"] = nodeToRelocate["s-sn"];
1294
+ textNode["s-sh"] = nodeToRelocate["s-sh"];
1295
+ textNode["s-sr"] = nodeToRelocate["s-sr"];
1296
+ textNode["s-ol"] = nodeToRelocate["s-ol"];
1297
+ textNode["s-ol"]["s-nr"] = textNode;
1298
+ insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);
1299
+ nodeToRelocate.parentNode.removeChild(nodeToRelocate);
1300
+ }
1301
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1302
+ nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
1303
+ }
1304
+ }
1305
+ }
1306
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
1307
+ } else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1308
+ nodeToRelocate.hidden = true;
1309
+ }
1310
+ }
1311
+ }
1312
+ if (checkSlotFallbackVisibility) {
1313
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1314
+ }
1315
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
1316
+ relocateNodes.length = 0;
1317
+ }
1318
+ if (!useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm["s-cr"]) {
1319
+ const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1320
+ for (const childNode of children) {
1321
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1322
+ if (isInitialLoad && childNode["s-ih"] == null) {
1323
+ childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
1324
+ }
1325
+ if (childNode.nodeType === 1 /* ElementNode */) {
1326
+ childNode.hidden = true;
1327
+ } else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {
1328
+ const textCommentNode = win.document.createComment("s-nt-" + childNode.nodeValue);
1329
+ textCommentNode["s-sn"] = childNode["s-sn"];
1330
+ insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);
1331
+ childNode.parentNode.removeChild(childNode);
1332
+ }
1333
+ }
1334
+ }
1335
+ }
1336
+ contentRef = void 0;
1337
+ flushQueuedRefCallbacks();
1338
+ };
1339
+
1340
+ // src/runtime/update-component.ts
1341
+ var attachToAncestor = (hostRef, ancestorComponent) => {
1342
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
1343
+ const index = ancestorComponent["s-p"].push(
1344
+ new Promise(
1345
+ (r) => hostRef.$onRenderResolve$ = () => {
1346
+ ancestorComponent["s-p"].splice(index - 1, 1);
1347
+ r();
1348
+ }
1349
+ )
1350
+ );
1351
+ }
1352
+ };
1353
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
1354
+ {
1355
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1356
+ }
1357
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1358
+ hostRef.$flags$ |= 512 /* needsRerender */;
1359
+ return;
1360
+ }
1361
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1362
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1363
+ if (isInitialLoad) {
1364
+ queueMicrotask(() => {
1365
+ dispatch();
1366
+ });
1367
+ return;
1368
+ }
1369
+ return writeTask(dispatch) ;
1370
+ };
1371
+ var dispatchHooks = (hostRef, isInitialLoad) => {
1372
+ const elm = hostRef.$hostElement$;
1373
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
1374
+ const instance = hostRef.$lazyInstance$ ;
1375
+ if (!instance) {
1376
+ throw new Error(
1377
+ `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`
1378
+ );
1379
+ }
1380
+ let maybePromise;
1381
+ if (isInitialLoad) {
1382
+ {
1383
+ if (hostRef.$deferredConnectedCallback$) {
1384
+ hostRef.$deferredConnectedCallback$ = false;
1385
+ safeCall(instance, "connectedCallback", void 0, elm);
1386
+ }
1387
+ if (hostRef.$fetchedCbList$.length) {
1388
+ hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
1389
+ }
1390
+ }
1391
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1392
+ } else {
1393
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1394
+ }
1395
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1396
+ endSchedule();
1397
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1398
+ };
1399
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1400
+ console.error(err);
1401
+ fn();
1402
+ }) : fn();
1403
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
1404
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1405
+ var _a;
1406
+ const elm = hostRef.$hostElement$;
1407
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
1408
+ const rc = elm["s-rc"];
1409
+ if (isInitialLoad) {
1410
+ attachStyles(hostRef);
1411
+ }
1412
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
1413
+ {
1414
+ callRender(hostRef, instance, elm, isInitialLoad);
1415
+ }
1416
+ if (rc) {
1417
+ rc.map((cb) => cb());
1418
+ elm["s-rc"] = void 0;
1419
+ }
1420
+ endRender();
1421
+ endUpdate();
1422
+ {
1423
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
1424
+ const postUpdate = () => postUpdateComponent(hostRef);
1425
+ if (childrenPromises.length === 0) {
1426
+ postUpdate();
1427
+ } else {
1428
+ Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
1429
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1430
+ childrenPromises.length = 0;
1431
+ }
1432
+ }
1433
+ };
1434
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1435
+ try {
1436
+ instance = instance.render() ;
1437
+ {
1438
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
1439
+ }
1440
+ {
1441
+ hostRef.$flags$ |= 2 /* hasRendered */;
1442
+ }
1443
+ {
1444
+ {
1445
+ {
1446
+ renderVdom(hostRef, instance, isInitialLoad);
1447
+ }
1448
+ }
1449
+ }
1450
+ } catch (e) {
1451
+ consoleError(e, hostRef.$hostElement$);
1452
+ }
1453
+ return null;
1454
+ };
1455
+ var postUpdateComponent = (hostRef) => {
1456
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1457
+ const elm = hostRef.$hostElement$;
1458
+ const endPostUpdate = createTime("postUpdate", tagName);
1459
+ const instance = hostRef.$lazyInstance$ ;
1460
+ const ancestorComponent = hostRef.$ancestorComponent$;
1461
+ safeCall(instance, "componentDidRender", void 0, elm);
1462
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1463
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1464
+ {
1465
+ addHydratedFlag(elm);
1466
+ }
1467
+ safeCall(instance, "componentDidLoad", void 0, elm);
1468
+ endPostUpdate();
1469
+ {
1470
+ hostRef.$onReadyResolve$(elm);
1471
+ if (!ancestorComponent) {
1472
+ appDidLoad();
1473
+ }
1474
+ }
1475
+ } else {
1476
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1477
+ endPostUpdate();
1478
+ }
1479
+ {
1480
+ hostRef.$onInstanceResolve$(elm);
1481
+ }
1482
+ {
1483
+ if (hostRef.$onRenderResolve$) {
1484
+ hostRef.$onRenderResolve$();
1485
+ hostRef.$onRenderResolve$ = void 0;
1486
+ }
1487
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1488
+ nextTick(() => scheduleUpdate(hostRef, false));
1489
+ }
1490
+ hostRef.$flags$ &= -517;
1491
+ }
1492
+ };
1493
+ var appDidLoad = (who) => {
1494
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1495
+ };
1496
+ var safeCall = (instance, method, arg, elm) => {
1497
+ if (instance && instance[method]) {
1498
+ try {
1499
+ return instance[method](arg);
1500
+ } catch (e) {
1501
+ consoleError(e, elm);
1502
+ }
1503
+ }
1504
+ return void 0;
1505
+ };
1506
+ var addHydratedFlag = (elm) => {
1507
+ var _a;
1508
+ return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
1509
+ };
1510
+
1511
+ // src/runtime/set-value.ts
1512
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1513
+ var setValue = (ref, propName, newVal, cmpMeta) => {
1514
+ const hostRef = getHostRef(ref);
1515
+ if (!hostRef) {
1516
+ return;
1517
+ }
1518
+ if (!hostRef) {
1519
+ throw new Error(
1520
+ `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).`
1521
+ );
1522
+ }
1523
+ const elm = hostRef.$hostElement$ ;
1524
+ const oldVal = hostRef.$instanceValues$.get(propName);
1525
+ const flags = hostRef.$flags$;
1526
+ const instance = hostRef.$lazyInstance$ ;
1527
+ newVal = parsePropertyValue(
1528
+ newVal,
1529
+ cmpMeta.$members$[propName][0]);
1530
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1531
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1532
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1533
+ hostRef.$instanceValues$.set(propName, newVal);
1534
+ if (cmpMeta.$watchers$) {
1535
+ const watchMethods = cmpMeta.$watchers$[propName];
1536
+ if (watchMethods) {
1537
+ watchMethods.map((watcher) => {
1538
+ try {
1539
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1540
+ if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
1541
+ if (!instance) {
1542
+ hostRef.$fetchedCbList$.push(() => {
1543
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
1544
+ });
1545
+ } else {
1546
+ instance[watchMethodName](newVal, oldVal, propName);
1547
+ }
1548
+ }
1549
+ } catch (e) {
1550
+ consoleError(e, elm);
1551
+ }
1552
+ });
1553
+ }
1554
+ }
1555
+ if (flags & 2 /* hasRendered */) {
1556
+ if (instance.componentShouldUpdate) {
1557
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
1558
+ if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
1559
+ return;
1560
+ }
1561
+ }
1562
+ if (!(flags & 16 /* isQueuedForUpdate */)) {
1563
+ scheduleUpdate(hostRef, false);
1564
+ }
1565
+ }
1566
+ }
1567
+ };
1568
+
1569
+ // src/runtime/proxy-component.ts
1570
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
1571
+ var _a, _b;
1572
+ const prototype = Cstr.prototype;
1573
+ if (cmpMeta.$members$ || BUILD.propChangeCallback) {
1574
+ {
1575
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
1576
+ cmpMeta.$watchers$ = Cstr.watchers;
1577
+ }
1578
+ if (Cstr.deserializers && !cmpMeta.$deserializers$) {
1579
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1580
+ }
1581
+ if (Cstr.serializers && !cmpMeta.$serializers$) {
1582
+ cmpMeta.$serializers$ = Cstr.serializers;
1583
+ }
1584
+ }
1585
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1586
+ members.map(([memberName, [memberFlags]]) => {
1587
+ if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1588
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
1589
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1590
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1591
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1592
+ Object.defineProperty(prototype, memberName, {
1593
+ get() {
1594
+ {
1595
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1596
+ return getValue(this, memberName);
1597
+ }
1598
+ const ref = getHostRef(this);
1599
+ const instance = ref ? ref.$lazyInstance$ : prototype;
1600
+ if (!instance) return;
1601
+ return instance[memberName];
1602
+ }
1603
+ },
1604
+ configurable: true,
1605
+ enumerable: true
1606
+ });
1607
+ }
1608
+ Object.defineProperty(prototype, memberName, {
1609
+ set(newValue) {
1610
+ const ref = getHostRef(this);
1611
+ if (!ref) {
1612
+ return;
1613
+ }
1614
+ if (origSetter) {
1615
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1616
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1617
+ newValue = ref.$instanceValues$.get(memberName);
1618
+ }
1619
+ origSetter.apply(this, [
1620
+ parsePropertyValue(
1621
+ newValue,
1622
+ memberFlags)
1623
+ ]);
1624
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1625
+ setValue(this, memberName, newValue, cmpMeta);
1626
+ return;
1627
+ }
1628
+ {
1629
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1630
+ setValue(this, memberName, newValue, cmpMeta);
1631
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1632
+ ref.$fetchedCbList$.push(() => {
1633
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1634
+ ref.$lazyInstance$[memberName] = newValue;
1635
+ }
1636
+ });
1637
+ }
1638
+ return;
1639
+ }
1640
+ const setterSetVal = () => {
1641
+ const currentValue = ref.$lazyInstance$[memberName];
1642
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
1643
+ ref.$instanceValues$.set(memberName, currentValue);
1644
+ }
1645
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
1646
+ newValue,
1647
+ memberFlags);
1648
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1649
+ };
1650
+ if (ref.$lazyInstance$) {
1651
+ setterSetVal();
1652
+ } else {
1653
+ ref.$fetchedCbList$.push(() => {
1654
+ setterSetVal();
1655
+ });
1656
+ }
1657
+ }
1658
+ }
1659
+ });
1660
+ } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1661
+ Object.defineProperty(prototype, memberName, {
1662
+ value(...args) {
1663
+ var _a2;
1664
+ const ref = getHostRef(this);
1665
+ return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
1666
+ var _a3;
1667
+ return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
1668
+ });
1669
+ }
1670
+ });
1671
+ }
1672
+ });
1673
+ if ((flags & 1 /* isElementConstructor */)) {
1674
+ const attrNameToPropName = /* @__PURE__ */ new Map();
1675
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
1676
+ plt.jmp(() => {
1677
+ var _a2;
1678
+ const propName = attrNameToPropName.get(attrName);
1679
+ const hostRef = getHostRef(this);
1680
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1681
+ newValue = this[propName];
1682
+ delete this[propName];
1683
+ }
1684
+ if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1685
+ this[propName] == newValue) {
1686
+ return;
1687
+ } else if (propName == null) {
1688
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1689
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
1690
+ const instance = hostRef.$lazyInstance$ ;
1691
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1692
+ entry == null ? void 0 : entry.forEach((watcher) => {
1693
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1694
+ if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
1695
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
1696
+ }
1697
+ });
1698
+ }
1699
+ return;
1700
+ }
1701
+ const propFlags = members.find(([m]) => m === propName);
1702
+ if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
1703
+ newValue = newValue === null || newValue === "false" ? false : true;
1704
+ }
1705
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1706
+ if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1707
+ this[propName] = newValue;
1708
+ }
1709
+ });
1710
+ };
1711
+ Cstr.observedAttributes = Array.from(
1712
+ /* @__PURE__ */ new Set([
1713
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1714
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1715
+ var _a2;
1716
+ const attrName = m[1] || propName;
1717
+ attrNameToPropName.set(attrName, propName);
1718
+ if (m[0] & 512 /* ReflectAttr */) {
1719
+ (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
1720
+ }
1721
+ return attrName;
1722
+ })
1723
+ ])
1724
+ );
1725
+ }
1726
+ }
1727
+ return Cstr;
1728
+ };
1729
+
1730
+ // src/runtime/initialize-component.ts
1731
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1732
+ let Cstr;
1733
+ try {
1734
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1735
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1736
+ const bundleId = cmpMeta.$lazyBundleId$;
1737
+ if (bundleId) {
1738
+ const CstrImport = loadModule(cmpMeta, hostRef);
1739
+ if (CstrImport && "then" in CstrImport) {
1740
+ const endLoad = uniqueTime();
1741
+ Cstr = await CstrImport;
1742
+ endLoad();
1743
+ } else {
1744
+ Cstr = CstrImport;
1745
+ }
1746
+ if (!Cstr) {
1747
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1748
+ }
1749
+ if (!Cstr.isProxied) {
1750
+ {
1751
+ cmpMeta.$watchers$ = Cstr.watchers;
1752
+ cmpMeta.$serializers$ = Cstr.serializers;
1753
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1754
+ }
1755
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1756
+ Cstr.isProxied = true;
1757
+ }
1758
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
1759
+ {
1760
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1761
+ }
1762
+ try {
1763
+ new Cstr(hostRef);
1764
+ } catch (e) {
1765
+ consoleError(e, elm);
1766
+ }
1767
+ {
1768
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
1769
+ }
1770
+ {
1771
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1772
+ }
1773
+ endNewInstance();
1774
+ const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
1775
+ if (!needsDeferredCallback) {
1776
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1777
+ } else {
1778
+ hostRef.$deferredConnectedCallback$ = true;
1779
+ }
1780
+ } else {
1781
+ Cstr = elm.constructor;
1782
+ const cmpTag = elm.localName;
1783
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1784
+ }
1785
+ if (Cstr && Cstr.style) {
1786
+ let style;
1787
+ if (typeof Cstr.style === "string") {
1788
+ style = Cstr.style;
1789
+ }
1790
+ const scopeId2 = getScopeId(cmpMeta);
1791
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
1792
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1793
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1794
+ endRegisterStyles();
1795
+ }
1796
+ }
1797
+ }
1798
+ const ancestorComponent = hostRef.$ancestorComponent$;
1799
+ const schedule = () => scheduleUpdate(hostRef, true);
1800
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
1801
+ ancestorComponent["s-rc"].push(schedule);
1802
+ } else {
1803
+ schedule();
1804
+ }
1805
+ } catch (e) {
1806
+ consoleError(e, elm);
1807
+ if (hostRef.$onRenderResolve$) {
1808
+ hostRef.$onRenderResolve$();
1809
+ hostRef.$onRenderResolve$ = void 0;
1810
+ }
1811
+ if (hostRef.$onReadyResolve$) {
1812
+ hostRef.$onReadyResolve$(elm);
1813
+ }
1814
+ }
1815
+ };
1816
+ var fireConnectedCallback = (instance, elm) => {
1817
+ {
1818
+ safeCall(instance, "connectedCallback", void 0, elm);
1819
+ }
1820
+ };
1821
+
1822
+ // src/runtime/connected-callback.ts
1823
+ var connectedCallback = (elm) => {
1824
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1825
+ const hostRef = getHostRef(elm);
1826
+ if (!hostRef) {
1827
+ return;
1828
+ }
1829
+ const cmpMeta = hostRef.$cmpMeta$;
1830
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1831
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1832
+ hostRef.$flags$ |= 1 /* hasConnected */;
1833
+ {
1834
+ if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1835
+ cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
1836
+ setContentReference(elm);
1837
+ }
1838
+ }
1839
+ {
1840
+ let ancestorComponent = elm;
1841
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1842
+ if (ancestorComponent["s-p"]) {
1843
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1844
+ break;
1845
+ }
1846
+ }
1847
+ }
1848
+ if (cmpMeta.$members$) {
1849
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1850
+ if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
1851
+ const value = elm[memberName];
1852
+ delete elm[memberName];
1853
+ elm[memberName] = value;
1854
+ }
1855
+ });
1856
+ }
1857
+ {
1858
+ initializeComponent(elm, hostRef, cmpMeta);
1859
+ }
1860
+ } else {
1861
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1862
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
1863
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1864
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1865
+ }
1866
+ }
1867
+ endConnected();
1868
+ }
1869
+ };
1870
+ var setContentReference = (elm) => {
1871
+ if (!win.document) {
1872
+ return;
1873
+ }
1874
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
1875
+ ""
1876
+ );
1877
+ contentRefElm["s-cn"] = true;
1878
+ insertBefore(elm, contentRefElm, elm.firstChild);
1879
+ };
1880
+ var disconnectInstance = (instance, elm) => {
1881
+ {
1882
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1883
+ }
1884
+ };
1885
+ var disconnectedCallback = async (elm) => {
1886
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1887
+ const hostRef = getHostRef(elm);
1888
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1889
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1890
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1891
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1892
+ }
1893
+ }
1894
+ if (rootAppliedStyles.has(elm)) {
1895
+ rootAppliedStyles.delete(elm);
1896
+ }
1897
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1898
+ rootAppliedStyles.delete(elm.shadowRoot);
1899
+ }
1900
+ };
1901
+
1902
+ // src/runtime/bootstrap-lazy.ts
1903
+ var bootstrapLazy = (lazyBundles, options = {}) => {
1904
+ var _a;
1905
+ if (!win.document) {
1906
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1907
+ return;
1908
+ }
1909
+ const endBootstrap = createTime();
1910
+ const cmpTags = [];
1911
+ const exclude = options.exclude || [];
1912
+ const customElements2 = win.customElements;
1913
+ const head = win.document.head;
1914
+ const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1915
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1916
+ const deferredConnectedCallbacks = [];
1917
+ let appLoadFallback;
1918
+ let isBootstrapping = true;
1919
+ Object.assign(plt, options);
1920
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1921
+ let hasSlotRelocation = false;
1922
+ lazyBundles.map((lazyBundle) => {
1923
+ lazyBundle[1].map((compactMeta) => {
1924
+ var _a2, _b, _c;
1925
+ const cmpMeta = {
1926
+ $flags$: compactMeta[0],
1927
+ $tagName$: compactMeta[1],
1928
+ $members$: compactMeta[2],
1929
+ $listeners$: compactMeta[3]
1930
+ };
1931
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1932
+ hasSlotRelocation = true;
1933
+ }
1934
+ {
1935
+ cmpMeta.$members$ = compactMeta[2];
1936
+ }
1937
+ {
1938
+ cmpMeta.$attrsToReflect$ = [];
1939
+ }
1940
+ {
1941
+ cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1942
+ cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
1943
+ cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
1944
+ }
1945
+ const tagName = transformTag(cmpMeta.$tagName$);
1946
+ const HostElement = class extends HTMLElement {
1947
+ ["s-p"];
1948
+ ["s-rc"];
1949
+ hasRegisteredEventListeners = false;
1950
+ // StencilLazyHost
1951
+ constructor(self) {
1952
+ super(self);
1953
+ self = this;
1954
+ registerHost(self, cmpMeta);
1955
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1956
+ {
1957
+ if (!self.shadowRoot) {
1958
+ createShadowRoot.call(self, cmpMeta);
1959
+ } else {
1960
+ if (self.shadowRoot.mode !== "open") {
1961
+ throw new Error(
1962
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
1963
+ );
1964
+ }
1965
+ }
1966
+ }
1967
+ }
1968
+ }
1969
+ connectedCallback() {
1970
+ const hostRef = getHostRef(this);
1971
+ if (!hostRef) {
1972
+ return;
1973
+ }
1974
+ if (!this.hasRegisteredEventListeners) {
1975
+ this.hasRegisteredEventListeners = true;
1976
+ }
1977
+ if (appLoadFallback) {
1978
+ clearTimeout(appLoadFallback);
1979
+ appLoadFallback = null;
1980
+ }
1981
+ if (isBootstrapping) {
1982
+ deferredConnectedCallbacks.push(this);
1983
+ } else {
1984
+ plt.jmp(() => connectedCallback(this));
1985
+ }
1986
+ }
1987
+ disconnectedCallback() {
1988
+ plt.jmp(() => disconnectedCallback(this));
1989
+ plt.raf(() => {
1990
+ var _a3;
1991
+ const hostRef = getHostRef(this);
1992
+ if (!hostRef) {
1993
+ return;
1994
+ }
1995
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1996
+ if (i2 > -1) {
1997
+ deferredConnectedCallbacks.splice(i2, 1);
1998
+ }
1999
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
2000
+ delete hostRef.$vnode$.$elm$;
2001
+ }
2002
+ });
2003
+ }
2004
+ componentOnReady() {
2005
+ var _a3;
2006
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
2007
+ }
2008
+ };
2009
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2010
+ if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
2011
+ cmpTags.push(tagName);
2012
+ customElements2.define(
2013
+ tagName,
2014
+ proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
2015
+ );
2016
+ }
2017
+ });
2018
+ });
2019
+ if (cmpTags.length > 0) {
2020
+ if (hasSlotRelocation) {
2021
+ dataStyles.textContent += SLOT_FB_CSS;
2022
+ }
2023
+ {
2024
+ dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
2025
+ }
2026
+ if (dataStyles.innerHTML.length) {
2027
+ dataStyles.setAttribute("data-styles", "");
2028
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2029
+ if (nonce != null) {
2030
+ dataStyles.setAttribute("nonce", nonce);
2031
+ }
2032
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
2033
+ }
2034
+ }
2035
+ isBootstrapping = false;
2036
+ if (deferredConnectedCallbacks.length) {
2037
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
2038
+ } else {
2039
+ {
2040
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
2041
+ }
2042
+ }
2043
+ endBootstrap();
2044
+ };
2045
+
2046
+ // src/runtime/nonce.ts
2047
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
2048
+ function transformTag(tag) {
2049
+ return tag;
2050
+ }
2051
+
2052
+ exports.Host = Host;
2053
+ exports.bootstrapLazy = bootstrapLazy;
2054
+ exports.createEvent = createEvent;
2055
+ exports.getAssetPath = getAssetPath;
2056
+ exports.getElement = getElement;
2057
+ exports.globalScripts = globalScripts;
2058
+ exports.h = h;
2059
+ exports.promiseResolve = promiseResolve;
2060
+ exports.registerInstance = registerInstance;
2061
+ exports.setNonce = setNonce;