@mmlogic/components 0.3.5 → 0.3.6

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 (169) hide show
  1. package/dist/{collection/utils/cell-renderer.js → mosterdcomponents/cell-renderer-CbRwLOo8.js} +9 -3
  2. package/dist/mosterdcomponents/cell-renderer-CbRwLOo8.js.map +1 -0
  3. package/dist/{esm/index.js → mosterdcomponents/client-layout-D88nn5zf.js} +4 -1
  4. package/dist/mosterdcomponents/client-layout-D88nn5zf.js.map +1 -0
  5. package/dist/{collection/utils/format.js → mosterdcomponents/format-BAfsQfy1.js} +12 -7
  6. package/dist/mosterdcomponents/format-BAfsQfy1.js.map +1 -0
  7. package/dist/{collection/utils/i18n.js → mosterdcomponents/i18n-hoGGKbKU.js} +6 -1
  8. package/dist/mosterdcomponents/i18n-hoGGKbKU.js.map +1 -0
  9. package/dist/mosterdcomponents/index-B_tPFIvS.js +4585 -0
  10. package/dist/mosterdcomponents/index-B_tPFIvS.js.map +1 -0
  11. package/dist/mosterdcomponents/index-I5SuYv7a.js +4 -0
  12. package/dist/mosterdcomponents/index-I5SuYv7a.js.map +1 -0
  13. package/dist/mosterdcomponents/index.esm.js +5 -1
  14. package/dist/mosterdcomponents/index.esm.js.map +1 -0
  15. package/dist/mosterdcomponents/mosterdcomponents.css +180 -1
  16. package/dist/mosterdcomponents/mosterdcomponents.esm.js +50 -1
  17. package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +1 -0
  18. package/dist/mosterdcomponents/mrd-boolean-field.entry.js +37 -0
  19. package/dist/mosterdcomponents/mrd-boolean-field.entry.js.map +1 -0
  20. package/dist/mosterdcomponents/mrd-currency-field.entry.js +67 -0
  21. package/dist/mosterdcomponents/mrd-currency-field.entry.js.map +1 -0
  22. package/dist/mosterdcomponents/mrd-date-field.entry.js +46 -0
  23. package/dist/mosterdcomponents/mrd-date-field.entry.js.map +1 -0
  24. package/dist/mosterdcomponents/mrd-datetime-field.entry.js +78 -0
  25. package/dist/mosterdcomponents/mrd-datetime-field.entry.js.map +1 -0
  26. package/dist/mosterdcomponents/mrd-email-field.entry.js +50 -0
  27. package/dist/mosterdcomponents/mrd-email-field.entry.js.map +1 -0
  28. package/dist/{collection/components/mrd-field/mrd-field.js → mosterdcomponents/mrd-field.entry.js} +28 -179
  29. package/dist/mosterdcomponents/mrd-field.entry.js.map +1 -0
  30. package/dist/mosterdcomponents/mrd-file-field.entry.js +108 -0
  31. package/dist/mosterdcomponents/mrd-file-field.entry.js.map +1 -0
  32. package/dist/{collection/components/mrd-form/mrd-form.js → mosterdcomponents/mrd-form.entry.js} +31 -308
  33. package/dist/mosterdcomponents/mrd-form.entry.js.map +1 -0
  34. package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js +87 -0
  35. package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js.map +1 -0
  36. package/dist/mosterdcomponents/mrd-image-field.entry.js +122 -0
  37. package/dist/mosterdcomponents/mrd-image-field.entry.js.map +1 -0
  38. package/dist/{collection/components/mrd-layout-section/mrd-layout-section.js → mosterdcomponents/mrd-layout-section.entry.js} +31 -418
  39. package/dist/mosterdcomponents/mrd-layout-section.entry.js.map +1 -0
  40. package/dist/mosterdcomponents/mrd-list-field.entry.js +107 -0
  41. package/dist/mosterdcomponents/mrd-list-field.entry.js.map +1 -0
  42. package/dist/mosterdcomponents/mrd-longtext-field.entry.js +47 -0
  43. package/dist/mosterdcomponents/mrd-longtext-field.entry.js.map +1 -0
  44. package/dist/mosterdcomponents/mrd-number-field.entry.js +87 -0
  45. package/dist/mosterdcomponents/mrd-number-field.entry.js.map +1 -0
  46. package/dist/mosterdcomponents/mrd-relation-field.entry.js +267 -0
  47. package/dist/mosterdcomponents/mrd-relation-field.entry.js.map +1 -0
  48. package/dist/mosterdcomponents/mrd-secret-field.entry.js +49 -0
  49. package/dist/mosterdcomponents/mrd-secret-field.entry.js.map +1 -0
  50. package/dist/{collection/components/mrd-table/mrd-table.js → mosterdcomponents/mrd-table.entry.js} +32 -394
  51. package/dist/mosterdcomponents/mrd-table.entry.js.map +1 -0
  52. package/dist/mosterdcomponents/mrd-text-field.entry.js +47 -0
  53. package/dist/mosterdcomponents/mrd-text-field.entry.js.map +1 -0
  54. package/dist/mosterdcomponents/mrd-textarea-field.entry.js +86 -0
  55. package/dist/mosterdcomponents/mrd-textarea-field.entry.js.map +1 -0
  56. package/dist/mosterdcomponents/mrd-time-field.entry.js +46 -0
  57. package/dist/mosterdcomponents/mrd-time-field.entry.js.map +1 -0
  58. package/dist/{esm/quill-CiuCgGz_.js → mosterdcomponents/quill-C9pgw_k-.js} +16282 -1397
  59. package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
  60. package/dist/{collection/utils/validation.js → mosterdcomponents/validation-ixb43cqU.js} +12 -5
  61. package/dist/mosterdcomponents/validation-ixb43cqU.js.map +1 -0
  62. package/package.json +1 -1
  63. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
  64. package/dist/cjs/index-BPj2cBXs.js +0 -1570
  65. package/dist/cjs/index.cjs.js +0 -66
  66. package/dist/cjs/loader.cjs.js +0 -13
  67. package/dist/cjs/mosterdcomponents.cjs.js +0 -25
  68. package/dist/cjs/mrd-boolean-field_20.cjs.entry.js +0 -3961
  69. package/dist/cjs/quill-DmFfnC1f.js +0 -16272
  70. package/dist/collection/collection-manifest.json +0 -32
  71. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +0 -199
  72. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.scss +0 -77
  73. package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +0 -248
  74. package/dist/collection/components/mrd-currency-field/mrd-currency-field.scss +0 -100
  75. package/dist/collection/components/mrd-date-field/mrd-date-field.js +0 -206
  76. package/dist/collection/components/mrd-date-field/mrd-date-field.scss +0 -66
  77. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +0 -240
  78. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.scss +0 -66
  79. package/dist/collection/components/mrd-email-field/mrd-email-field.js +0 -230
  80. package/dist/collection/components/mrd-email-field/mrd-email-field.scss +0 -69
  81. package/dist/collection/components/mrd-field/mrd-field.scss +0 -118
  82. package/dist/collection/components/mrd-file-field/mrd-file-field.js +0 -341
  83. package/dist/collection/components/mrd-file-field/mrd-file-field.scss +0 -153
  84. package/dist/collection/components/mrd-form/mrd-form.scss +0 -148
  85. package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.js +0 -291
  86. package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.scss +0 -91
  87. package/dist/collection/components/mrd-image-field/mrd-image-field.js +0 -356
  88. package/dist/collection/components/mrd-image-field/mrd-image-field.scss +0 -190
  89. package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +0 -445
  90. package/dist/collection/components/mrd-list-field/mrd-list-field.js +0 -313
  91. package/dist/collection/components/mrd-list-field/mrd-list-field.scss +0 -109
  92. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +0 -227
  93. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.scss +0 -78
  94. package/dist/collection/components/mrd-number-field/mrd-number-field.js +0 -316
  95. package/dist/collection/components/mrd-number-field/mrd-number-field.scss +0 -77
  96. package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +0 -707
  97. package/dist/collection/components/mrd-relation-field/mrd-relation-field.scss +0 -266
  98. package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +0 -229
  99. package/dist/collection/components/mrd-secret-field/mrd-secret-field.scss +0 -73
  100. package/dist/collection/components/mrd-table/mrd-table.scss +0 -809
  101. package/dist/collection/components/mrd-text-field/mrd-text-field.js +0 -227
  102. package/dist/collection/components/mrd-text-field/mrd-text-field.scss +0 -69
  103. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +0 -267
  104. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +0 -135
  105. package/dist/collection/components/mrd-time-field/mrd-time-field.js +0 -206
  106. package/dist/collection/components/mrd-time-field/mrd-time-field.scss +0 -66
  107. package/dist/collection/dev/api.js +0 -145
  108. package/dist/collection/dev/app.js +0 -890
  109. package/dist/collection/dev/auth.js +0 -156
  110. package/dist/collection/dev/example-data.js +0 -403
  111. package/dist/collection/dev/sprites.svg +0 -55
  112. package/dist/collection/index.js +0 -1
  113. package/dist/collection/types/client-layout.js +0 -64
  114. package/dist/collection/types/index.js +0 -1
  115. package/dist/components/client-layout.js +0 -1
  116. package/dist/components/format.js +0 -1
  117. package/dist/components/i18n.js +0 -1
  118. package/dist/components/index.js +0 -1
  119. package/dist/components/mrd-boolean-field.js +0 -1
  120. package/dist/components/mrd-boolean-field2.js +0 -1
  121. package/dist/components/mrd-currency-field.js +0 -1
  122. package/dist/components/mrd-currency-field2.js +0 -1
  123. package/dist/components/mrd-date-field.js +0 -1
  124. package/dist/components/mrd-date-field2.js +0 -1
  125. package/dist/components/mrd-datetime-field.js +0 -1
  126. package/dist/components/mrd-datetime-field2.js +0 -1
  127. package/dist/components/mrd-email-field.js +0 -1
  128. package/dist/components/mrd-email-field2.js +0 -1
  129. package/dist/components/mrd-field.js +0 -1
  130. package/dist/components/mrd-field2.js +0 -1
  131. package/dist/components/mrd-file-field.js +0 -1
  132. package/dist/components/mrd-file-field2.js +0 -1
  133. package/dist/components/mrd-form.js +0 -1
  134. package/dist/components/mrd-hyperlink-field.js +0 -1
  135. package/dist/components/mrd-hyperlink-field2.js +0 -1
  136. package/dist/components/mrd-image-field.js +0 -1
  137. package/dist/components/mrd-image-field2.js +0 -1
  138. package/dist/components/mrd-layout-section.js +0 -1
  139. package/dist/components/mrd-list-field.js +0 -1
  140. package/dist/components/mrd-list-field2.js +0 -1
  141. package/dist/components/mrd-longtext-field.js +0 -1
  142. package/dist/components/mrd-longtext-field2.js +0 -1
  143. package/dist/components/mrd-number-field.js +0 -1
  144. package/dist/components/mrd-number-field2.js +0 -1
  145. package/dist/components/mrd-relation-field.js +0 -1
  146. package/dist/components/mrd-relation-field2.js +0 -1
  147. package/dist/components/mrd-secret-field.js +0 -1
  148. package/dist/components/mrd-secret-field2.js +0 -1
  149. package/dist/components/mrd-table.js +0 -1
  150. package/dist/components/mrd-table2.js +0 -1
  151. package/dist/components/mrd-text-field.js +0 -1
  152. package/dist/components/mrd-text-field2.js +0 -1
  153. package/dist/components/mrd-textarea-field.js +0 -1
  154. package/dist/components/mrd-textarea-field2.js +0 -1
  155. package/dist/components/mrd-time-field.js +0 -1
  156. package/dist/components/mrd-time-field2.js +0 -1
  157. package/dist/components/quill.js +0 -1
  158. package/dist/components/validation.js +0 -1
  159. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  160. package/dist/esm/index-_tsCCkAi.js +0 -1561
  161. package/dist/esm/loader.js +0 -11
  162. package/dist/esm/mosterdcomponents.js +0 -21
  163. package/dist/esm/mrd-boolean-field_20.entry.js +0 -3940
  164. package/dist/index.cjs.js +0 -1
  165. package/dist/index.js +0 -1
  166. package/dist/mosterdcomponents/p-CiuCgGz_.js +0 -1
  167. package/dist/mosterdcomponents/p-DQuL1Twl.js +0 -1
  168. package/dist/mosterdcomponents/p-_tsCCkAi.js +0 -2
  169. package/dist/mosterdcomponents/p-e477187c.entry.js +0 -1
@@ -1,1570 +0,0 @@
1
- 'use strict';
2
-
3
- const NAMESPACE = 'mosterdcomponents';
4
- const BUILD = /* mosterdcomponents */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
5
-
6
- /*
7
- Stencil Client Platform v4.43.2 | MIT Licensed | https://stenciljs.com
8
- */
9
-
10
-
11
- // src/utils/constants.ts
12
- var SVG_NS = "http://www.w3.org/2000/svg";
13
- var HTML_NS = "http://www.w3.org/1999/xhtml";
14
-
15
- // src/utils/get-prop-descriptor.ts
16
- function getPropertyDescriptor(obj, memberName, getOnly) {
17
- const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
18
- while (obj && obj !== stopAt) {
19
- const desc = Object.getOwnPropertyDescriptor(obj, memberName);
20
- if (desc && (!getOnly || desc.get)) return desc;
21
- obj = Object.getPrototypeOf(obj);
22
- }
23
- return void 0;
24
- }
25
-
26
- // src/utils/es2022-rewire-class-members.ts
27
- var reWireGetterSetter = (instance, hostRef) => {
28
- var _a;
29
- const cmpMeta = hostRef.$cmpMeta$;
30
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
31
- members.map(([memberName, [memberFlags]]) => {
32
- if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
33
- const ogValue = instance[memberName];
34
- const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
35
- if (ogDescriptor) {
36
- Object.defineProperty(instance, memberName, {
37
- get() {
38
- return ogDescriptor.get.call(this);
39
- },
40
- set(newValue) {
41
- ogDescriptor.set.call(this, newValue);
42
- },
43
- configurable: true,
44
- enumerable: true
45
- });
46
- }
47
- if (hostRef.$instanceValues$.has(memberName)) {
48
- instance[memberName] = hostRef.$instanceValues$.get(memberName);
49
- } else if (ogValue !== void 0) {
50
- instance[memberName] = ogValue;
51
- }
52
- }
53
- });
54
- };
55
-
56
- // src/client/client-host-ref.ts
57
- var getHostRef = (ref) => {
58
- if (ref.__stencil__getHostRef) {
59
- return ref.__stencil__getHostRef();
60
- }
61
- return void 0;
62
- };
63
- var registerInstance = (lazyInstance, hostRef) => {
64
- if (!hostRef) return;
65
- lazyInstance.__stencil__getHostRef = () => hostRef;
66
- hostRef.$lazyInstance$ = lazyInstance;
67
- if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
68
- reWireGetterSetter(lazyInstance, hostRef);
69
- }
70
- };
71
- var registerHost = (hostElement, cmpMeta) => {
72
- const hostRef = {
73
- $flags$: 0,
74
- $hostElement$: hostElement,
75
- $cmpMeta$: cmpMeta,
76
- $instanceValues$: /* @__PURE__ */ new Map(),
77
- $serializerValues$: /* @__PURE__ */ new Map()
78
- };
79
- {
80
- hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
81
- }
82
- {
83
- hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
84
- hostElement["s-p"] = [];
85
- hostElement["s-rc"] = [];
86
- }
87
- {
88
- hostRef.$fetchedCbList$ = [];
89
- }
90
- const ref = hostRef;
91
- hostElement.__stencil__getHostRef = () => ref;
92
- return ref;
93
- };
94
- var isMemberInElement = (elm, memberName) => memberName in elm;
95
- var consoleError = (e, el) => (0, console.error)(e, el);
96
-
97
- // src/client/client-load-module.ts
98
- var cmpModules = /* @__PURE__ */ new Map();
99
- var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
100
- const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
101
- const bundleId = cmpMeta.$lazyBundleId$;
102
- if (!bundleId) {
103
- return void 0;
104
- }
105
- const module = cmpModules.get(bundleId) ;
106
- if (module) {
107
- return module[exportName];
108
- }
109
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
110
- return import(
111
- /* @vite-ignore */
112
- /* webpackInclude: /\.entry\.js$/ */
113
- /* webpackExclude: /\.system\.entry\.js$/ */
114
- /* webpackMode: "lazy" */
115
- `./${bundleId}.entry.js${""}`
116
- ).then(
117
- (importedModule) => {
118
- {
119
- cmpModules.set(bundleId, importedModule);
120
- }
121
- return importedModule[exportName];
122
- },
123
- (e) => {
124
- consoleError(e, hostRef.$hostElement$);
125
- }
126
- );
127
- };
128
-
129
- // src/client/client-style.ts
130
- var styles = /* @__PURE__ */ new Map();
131
- var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
132
- var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
133
- var XLINK_NS = "http://www.w3.org/1999/xlink";
134
- var win = typeof window !== "undefined" ? window : {};
135
- var plt = {
136
- $flags$: 0,
137
- $resourcesUrl$: "",
138
- jmp: (h2) => h2(),
139
- raf: (h2) => requestAnimationFrame(h2),
140
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
141
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
142
- ce: (eventName, opts) => new CustomEvent(eventName, opts)
143
- };
144
- var promiseResolve = (v) => Promise.resolve(v);
145
- var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
146
- try {
147
- if (!win.document.adoptedStyleSheets) {
148
- return false;
149
- }
150
- new CSSStyleSheet();
151
- return typeof new CSSStyleSheet().replaceSync === "function";
152
- } catch (e) {
153
- }
154
- return false;
155
- })() ;
156
- var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
157
- var queuePending = false;
158
- var queueDomReads = [];
159
- var queueDomWrites = [];
160
- var queueTask = (queue, write) => (cb) => {
161
- queue.push(cb);
162
- if (!queuePending) {
163
- queuePending = true;
164
- if (write && plt.$flags$ & 4 /* queueSync */) {
165
- nextTick(flush);
166
- } else {
167
- plt.raf(flush);
168
- }
169
- }
170
- };
171
- var consume = (queue) => {
172
- for (let i2 = 0; i2 < queue.length; i2++) {
173
- try {
174
- queue[i2](performance.now());
175
- } catch (e) {
176
- consoleError(e);
177
- }
178
- }
179
- queue.length = 0;
180
- };
181
- var flush = () => {
182
- consume(queueDomReads);
183
- {
184
- consume(queueDomWrites);
185
- if (queuePending = queueDomReads.length > 0) {
186
- plt.raf(flush);
187
- }
188
- }
189
- };
190
- var nextTick = (cb) => promiseResolve().then(cb);
191
- var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
192
- var createTime = (fnName, tagName = "") => {
193
- {
194
- return () => {
195
- return;
196
- };
197
- }
198
- };
199
- var uniqueTime = (key, measureText) => {
200
- {
201
- return () => {
202
- return;
203
- };
204
- }
205
- };
206
-
207
- // src/utils/query-nonce-meta-tag-content.ts
208
- function queryNonceMetaTagContent(doc) {
209
- var _a, _b, _c;
210
- 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;
211
- }
212
-
213
- // src/runtime/styles.ts
214
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
215
- var registerStyle = (scopeId2, cssText, allowCS) => {
216
- let style = styles.get(scopeId2);
217
- if (supportsConstructableStylesheets && allowCS) {
218
- style = style || new CSSStyleSheet();
219
- if (typeof style === "string") {
220
- style = cssText;
221
- } else {
222
- style.replaceSync(cssText);
223
- }
224
- } else {
225
- style = cssText;
226
- }
227
- styles.set(scopeId2, style);
228
- };
229
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
230
- var _a, _b, _c;
231
- const scopeId2 = getScopeId(cmpMeta);
232
- const style = styles.get(scopeId2);
233
- if (!win.document) {
234
- return scopeId2;
235
- }
236
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
237
- if (style) {
238
- if (typeof style === "string") {
239
- styleContainerNode = styleContainerNode.head || styleContainerNode;
240
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
241
- let styleElm;
242
- if (!appliedStyles) {
243
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
244
- }
245
- if (!appliedStyles.has(scopeId2)) {
246
- styleElm = win.document.createElement("style");
247
- styleElm.textContent = style;
248
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
249
- if (nonce != null) {
250
- styleElm.setAttribute("nonce", nonce);
251
- }
252
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
253
- if (styleContainerNode.nodeName === "HEAD") {
254
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
255
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
256
- styleContainerNode.insertBefore(
257
- styleElm,
258
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
259
- );
260
- } else if ("host" in styleContainerNode) {
261
- if (supportsConstructableStylesheets) {
262
- const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
263
- const stylesheet = new currentWindow.CSSStyleSheet();
264
- stylesheet.replaceSync(style);
265
- if (supportsMutableAdoptedStyleSheets) {
266
- styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
267
- } else {
268
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
269
- }
270
- } else {
271
- const existingStyleContainer = styleContainerNode.querySelector("style");
272
- if (existingStyleContainer && true) {
273
- existingStyleContainer.textContent = style + existingStyleContainer.textContent;
274
- } else {
275
- styleContainerNode.prepend(styleElm);
276
- }
277
- }
278
- } else {
279
- styleContainerNode.append(styleElm);
280
- }
281
- }
282
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
283
- styleContainerNode.insertBefore(styleElm, null);
284
- }
285
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
286
- styleElm.textContent += SLOT_FB_CSS;
287
- }
288
- if (appliedStyles) {
289
- appliedStyles.add(scopeId2);
290
- }
291
- }
292
- } else {
293
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
294
- if (!appliedStyles) {
295
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
296
- }
297
- if (!appliedStyles.has(scopeId2)) {
298
- const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
299
- let stylesheet;
300
- if (style.constructor === currentWindow.CSSStyleSheet) {
301
- stylesheet = style;
302
- } else {
303
- stylesheet = new currentWindow.CSSStyleSheet();
304
- for (let i2 = 0; i2 < style.cssRules.length; i2++) {
305
- stylesheet.insertRule(style.cssRules[i2].cssText, i2);
306
- }
307
- }
308
- if (supportsMutableAdoptedStyleSheets) {
309
- styleContainerNode.adoptedStyleSheets.push(stylesheet);
310
- } else {
311
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
312
- }
313
- appliedStyles.add(scopeId2);
314
- }
315
- }
316
- }
317
- return scopeId2;
318
- };
319
- var attachStyles = (hostRef) => {
320
- const cmpMeta = hostRef.$cmpMeta$;
321
- const elm = hostRef.$hostElement$;
322
- const flags = cmpMeta.$flags$;
323
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
324
- const scopeId2 = addStyle(
325
- elm.getRootNode(),
326
- cmpMeta);
327
- if (flags & 10 /* needsScopedEncapsulation */) {
328
- elm["s-sc"] = scopeId2;
329
- elm.classList.add(scopeId2 + "-h");
330
- }
331
- endAttachStyles();
332
- };
333
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
334
-
335
- // src/utils/helpers.ts
336
- var isDef = (v) => v != null && v !== void 0;
337
- var isComplexType = (o) => {
338
- o = typeof o;
339
- return o === "object" || o === "function";
340
- };
341
-
342
- // src/runtime/vdom/h.ts
343
- var h = (nodeName, vnodeData, ...children) => {
344
- if (typeof nodeName === "string") {
345
- nodeName = transformTag(nodeName);
346
- }
347
- let child = null;
348
- let key = null;
349
- let simple = false;
350
- let lastSimple = false;
351
- const vNodeChildren = [];
352
- const walk = (c) => {
353
- for (let i2 = 0; i2 < c.length; i2++) {
354
- child = c[i2];
355
- if (Array.isArray(child)) {
356
- walk(child);
357
- } else if (child != null && typeof child !== "boolean") {
358
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
359
- child = String(child);
360
- }
361
- if (simple && lastSimple) {
362
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
363
- } else {
364
- vNodeChildren.push(simple ? newVNode(null, child) : child);
365
- }
366
- lastSimple = simple;
367
- }
368
- }
369
- };
370
- walk(children);
371
- if (vnodeData) {
372
- if (vnodeData.key) {
373
- key = vnodeData.key;
374
- }
375
- {
376
- const classData = vnodeData.className || vnodeData.class;
377
- if (classData) {
378
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
379
- }
380
- }
381
- }
382
- const vnode = newVNode(nodeName, null);
383
- vnode.$attrs$ = vnodeData;
384
- if (vNodeChildren.length > 0) {
385
- vnode.$children$ = vNodeChildren;
386
- }
387
- {
388
- vnode.$key$ = key;
389
- }
390
- return vnode;
391
- };
392
- var newVNode = (tag, text) => {
393
- const vnode = {
394
- $flags$: 0,
395
- $tag$: tag,
396
- // Normalize undefined to null to prevent rendering "undefined" as text
397
- $text$: text != null ? text : null,
398
- $elm$: null,
399
- $children$: null
400
- };
401
- {
402
- vnode.$attrs$ = null;
403
- }
404
- {
405
- vnode.$key$ = null;
406
- }
407
- return vnode;
408
- };
409
- var Host = {};
410
- var isHost = (node) => node && node.$tag$ === Host;
411
-
412
- // src/runtime/parse-property-value.ts
413
- var parsePropertyValue = (propValue, propType, isFormAssociated) => {
414
- if (propValue != null && !isComplexType(propValue)) {
415
- if (propType & 4 /* Boolean */) {
416
- {
417
- return propValue === "false" ? false : propValue === "" || !!propValue;
418
- }
419
- }
420
- if (propType & 2 /* Number */) {
421
- return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
422
- }
423
- if (propType & 1 /* String */) {
424
- return String(propValue);
425
- }
426
- return propValue;
427
- }
428
- return propValue;
429
- };
430
- var getElement = (ref) => {
431
- var _a;
432
- return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
433
- };
434
-
435
- // src/runtime/event-emitter.ts
436
- var createEvent = (ref, name, flags) => {
437
- const elm = getElement(ref);
438
- return {
439
- emit: (detail) => {
440
- return emitEvent(elm, name, {
441
- bubbles: true,
442
- composed: true,
443
- cancelable: true,
444
- detail
445
- });
446
- }
447
- };
448
- };
449
- var emitEvent = (elm, name, opts) => {
450
- const ev = plt.ce(name, opts);
451
- elm.dispatchEvent(ev);
452
- return ev;
453
- };
454
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
455
- if (oldValue === newValue) {
456
- return;
457
- }
458
- let isProp = isMemberInElement(elm, memberName);
459
- let ln = memberName.toLowerCase();
460
- if (memberName === "class") {
461
- const classList = elm.classList;
462
- const oldClasses = parseClassList(oldValue);
463
- let newClasses = parseClassList(newValue);
464
- {
465
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
466
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
467
- }
468
- } else if (memberName === "style") {
469
- {
470
- for (const prop in oldValue) {
471
- if (!newValue || newValue[prop] == null) {
472
- if (prop.includes("-")) {
473
- elm.style.removeProperty(prop);
474
- } else {
475
- elm.style[prop] = "";
476
- }
477
- }
478
- }
479
- }
480
- for (const prop in newValue) {
481
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
482
- if (prop.includes("-")) {
483
- elm.style.setProperty(prop, newValue[prop]);
484
- } else {
485
- elm.style[prop] = newValue[prop];
486
- }
487
- }
488
- }
489
- } else if (memberName === "key") ; else if (memberName === "ref") {
490
- if (newValue) {
491
- queueRefAttachment(newValue, elm);
492
- }
493
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
494
- if (memberName[2] === "-") {
495
- memberName = memberName.slice(3);
496
- } else if (isMemberInElement(win, ln)) {
497
- memberName = ln.slice(2);
498
- } else {
499
- memberName = ln[2] + memberName.slice(3);
500
- }
501
- if (oldValue || newValue) {
502
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
503
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
504
- if (oldValue) {
505
- plt.rel(elm, memberName, oldValue, capture);
506
- }
507
- if (newValue) {
508
- plt.ael(elm, memberName, newValue, capture);
509
- }
510
- }
511
- } else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
512
- const propName = memberName.slice(5);
513
- let attrName;
514
- {
515
- const hostRef = getHostRef(elm);
516
- if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
517
- const memberMeta = hostRef.$cmpMeta$.$members$[propName];
518
- if (memberMeta && memberMeta[1]) {
519
- attrName = memberMeta[1];
520
- }
521
- }
522
- }
523
- if (!attrName) {
524
- attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
525
- }
526
- if (newValue == null || newValue === false) {
527
- if (newValue !== false || elm.getAttribute(attrName) === "") {
528
- elm.removeAttribute(attrName);
529
- }
530
- } else {
531
- elm.setAttribute(attrName, newValue === true ? "" : newValue);
532
- }
533
- return;
534
- } else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
535
- const propName = memberName.slice(5);
536
- try {
537
- elm[propName] = newValue;
538
- } catch (e) {
539
- }
540
- return;
541
- } else {
542
- const isComplex = isComplexType(newValue);
543
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
544
- try {
545
- if (!elm.tagName.includes("-")) {
546
- const n = newValue == null ? "" : newValue;
547
- if (memberName === "list") {
548
- isProp = false;
549
- } else if (oldValue == null || elm[memberName] !== n) {
550
- if (typeof elm.__lookupSetter__(memberName) === "function") {
551
- elm[memberName] = n;
552
- } else {
553
- elm.setAttribute(memberName, n);
554
- }
555
- }
556
- } else if (elm[memberName] !== newValue) {
557
- elm[memberName] = newValue;
558
- }
559
- } catch (e) {
560
- }
561
- }
562
- let xlink = false;
563
- {
564
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
565
- memberName = ln;
566
- xlink = true;
567
- }
568
- }
569
- if (newValue == null || newValue === false) {
570
- if (newValue !== false || elm.getAttribute(memberName) === "") {
571
- if (xlink) {
572
- elm.removeAttributeNS(XLINK_NS, memberName);
573
- } else {
574
- elm.removeAttribute(memberName);
575
- }
576
- }
577
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
578
- newValue = newValue === true ? "" : newValue;
579
- if (xlink) {
580
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
581
- } else {
582
- elm.setAttribute(memberName, newValue);
583
- }
584
- }
585
- }
586
- };
587
- var parseClassListRegex = /\s/;
588
- var parseClassList = (value) => {
589
- if (typeof value === "object" && value && "baseVal" in value) {
590
- value = value.baseVal;
591
- }
592
- if (!value || typeof value !== "string") {
593
- return [];
594
- }
595
- return value.split(parseClassListRegex);
596
- };
597
- var CAPTURE_EVENT_SUFFIX = "Capture";
598
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
599
-
600
- // src/runtime/vdom/update-element.ts
601
- var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
602
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
603
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
604
- const newVnodeAttrs = newVnode.$attrs$ || {};
605
- {
606
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
607
- if (!(memberName in newVnodeAttrs)) {
608
- setAccessor(
609
- elm,
610
- memberName,
611
- oldVnodeAttrs[memberName],
612
- void 0,
613
- isSvgMode2,
614
- newVnode.$flags$);
615
- }
616
- }
617
- }
618
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
619
- setAccessor(
620
- elm,
621
- memberName,
622
- oldVnodeAttrs[memberName],
623
- newVnodeAttrs[memberName],
624
- isSvgMode2,
625
- newVnode.$flags$);
626
- }
627
- };
628
- function sortedAttrNames(attrNames) {
629
- return attrNames.includes("ref") ? (
630
- // we need to sort these to ensure that `'ref'` is the last attr
631
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
632
- ) : (
633
- // no need to sort, return the original array
634
- attrNames
635
- );
636
- }
637
-
638
- // src/runtime/vdom/vdom-render.ts
639
- var scopeId;
640
- var hostTagName;
641
- var isSvgMode = false;
642
- var refCallbacksToRemove = [];
643
- var refCallbacksToAttach = [];
644
- var createElm = (oldParentVNode, newParentVNode, childIndex) => {
645
- const newVNode2 = newParentVNode.$children$[childIndex];
646
- let i2 = 0;
647
- let elm;
648
- let childNode;
649
- if (newVNode2.$text$ != null) {
650
- elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
651
- } else {
652
- if (!isSvgMode) {
653
- isSvgMode = newVNode2.$tag$ === "svg";
654
- }
655
- if (!win.document) {
656
- throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
657
- }
658
- elm = newVNode2.$elm$ = win.document.createElementNS(
659
- isSvgMode ? SVG_NS : HTML_NS,
660
- newVNode2.$tag$
661
- ) ;
662
- if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
663
- isSvgMode = false;
664
- }
665
- {
666
- updateElement(null, newVNode2, isSvgMode);
667
- }
668
- if (isDef(scopeId) && elm["s-si"] !== scopeId) {
669
- elm.classList.add(elm["s-si"] = scopeId);
670
- }
671
- if (newVNode2.$children$) {
672
- const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
673
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
674
- childNode = createElm(oldParentVNode, newVNode2, i2);
675
- if (childNode) {
676
- appendTarget.appendChild(childNode);
677
- }
678
- }
679
- }
680
- {
681
- if (newVNode2.$tag$ === "svg") {
682
- isSvgMode = false;
683
- } else if (elm.tagName === "foreignObject") {
684
- isSvgMode = true;
685
- }
686
- }
687
- }
688
- elm["s-hn"] = hostTagName;
689
- return elm;
690
- };
691
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
692
- let containerElm = parentElm;
693
- let childNode;
694
- if (parentVNode.$tag$ === "template") {
695
- containerElm = containerElm.content;
696
- }
697
- for (; startIdx <= endIdx; ++startIdx) {
698
- if (vnodes[startIdx]) {
699
- childNode = createElm(null, parentVNode, startIdx);
700
- if (childNode) {
701
- vnodes[startIdx].$elm$ = childNode;
702
- insertBefore(containerElm, childNode, before);
703
- }
704
- }
705
- }
706
- };
707
- var removeVnodes = (vnodes, startIdx, endIdx) => {
708
- for (let index = startIdx; index <= endIdx; ++index) {
709
- const vnode = vnodes[index];
710
- if (vnode) {
711
- const elm = vnode.$elm$;
712
- nullifyVNodeRefs(vnode);
713
- if (elm) {
714
- elm.remove();
715
- }
716
- }
717
- }
718
- };
719
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
720
- let oldStartIdx = 0;
721
- let newStartIdx = 0;
722
- let idxInOld = 0;
723
- let i2 = 0;
724
- let oldEndIdx = oldCh.length - 1;
725
- let oldStartVnode = oldCh[0];
726
- let oldEndVnode = oldCh[oldEndIdx];
727
- let newEndIdx = newCh.length - 1;
728
- let newStartVnode = newCh[0];
729
- let newEndVnode = newCh[newEndIdx];
730
- let node;
731
- let elmToMove;
732
- const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
733
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
734
- if (oldStartVnode == null) {
735
- oldStartVnode = oldCh[++oldStartIdx];
736
- } else if (oldEndVnode == null) {
737
- oldEndVnode = oldCh[--oldEndIdx];
738
- } else if (newStartVnode == null) {
739
- newStartVnode = newCh[++newStartIdx];
740
- } else if (newEndVnode == null) {
741
- newEndVnode = newCh[--newEndIdx];
742
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
743
- patch(oldStartVnode, newStartVnode, isInitialRender);
744
- oldStartVnode = oldCh[++oldStartIdx];
745
- newStartVnode = newCh[++newStartIdx];
746
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
747
- patch(oldEndVnode, newEndVnode, isInitialRender);
748
- oldEndVnode = oldCh[--oldEndIdx];
749
- newEndVnode = newCh[--newEndIdx];
750
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
751
- patch(oldStartVnode, newEndVnode, isInitialRender);
752
- insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
753
- oldStartVnode = oldCh[++oldStartIdx];
754
- newEndVnode = newCh[--newEndIdx];
755
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
756
- patch(oldEndVnode, newStartVnode, isInitialRender);
757
- insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
758
- oldEndVnode = oldCh[--oldEndIdx];
759
- newStartVnode = newCh[++newStartIdx];
760
- } else {
761
- idxInOld = -1;
762
- {
763
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
764
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
765
- idxInOld = i2;
766
- break;
767
- }
768
- }
769
- }
770
- if (idxInOld >= 0) {
771
- elmToMove = oldCh[idxInOld];
772
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
773
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
774
- } else {
775
- patch(elmToMove, newStartVnode, isInitialRender);
776
- oldCh[idxInOld] = void 0;
777
- node = elmToMove.$elm$;
778
- }
779
- newStartVnode = newCh[++newStartIdx];
780
- } else {
781
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
782
- newStartVnode = newCh[++newStartIdx];
783
- }
784
- if (node) {
785
- {
786
- insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
787
- }
788
- }
789
- }
790
- }
791
- if (oldStartIdx > oldEndIdx) {
792
- addVnodes(
793
- parentElm,
794
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
795
- newVNode2,
796
- newCh,
797
- newStartIdx,
798
- newEndIdx
799
- );
800
- } else if (newStartIdx > newEndIdx) {
801
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
802
- }
803
- };
804
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
805
- if (leftVNode.$tag$ === rightVNode.$tag$) {
806
- if (!isInitialRender) {
807
- return leftVNode.$key$ === rightVNode.$key$;
808
- }
809
- if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
810
- leftVNode.$key$ = rightVNode.$key$;
811
- }
812
- return true;
813
- }
814
- return false;
815
- };
816
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
817
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
818
- const oldChildren = oldVNode.$children$;
819
- const newChildren = newVNode2.$children$;
820
- const tag = newVNode2.$tag$;
821
- const text = newVNode2.$text$;
822
- if (text == null) {
823
- {
824
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
825
- }
826
- {
827
- updateElement(oldVNode, newVNode2, isSvgMode);
828
- }
829
- if (oldChildren !== null && newChildren !== null) {
830
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
831
- } else if (newChildren !== null) {
832
- if (oldVNode.$text$ !== null) {
833
- elm.textContent = "";
834
- }
835
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
836
- } else if (
837
- // don't do this on initial render as it can cause non-hydrated content to be removed
838
- !isInitialRender && BUILD.updatable && oldChildren !== null
839
- ) {
840
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
841
- } else ;
842
- if (isSvgMode && tag === "svg") {
843
- isSvgMode = false;
844
- }
845
- } else if (oldVNode.$text$ !== text) {
846
- elm.data = text;
847
- }
848
- };
849
- var nullifyVNodeRefs = (vNode) => {
850
- {
851
- if (vNode.$attrs$ && vNode.$attrs$.ref) {
852
- refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
853
- }
854
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
855
- }
856
- };
857
- var queueRefAttachment = (refCallback, elm) => {
858
- {
859
- refCallbacksToAttach.push(() => refCallback(elm));
860
- }
861
- };
862
- var flushQueuedRefCallbacks = () => {
863
- {
864
- refCallbacksToRemove.forEach((cb) => cb());
865
- refCallbacksToRemove.length = 0;
866
- refCallbacksToAttach.forEach((cb) => cb());
867
- refCallbacksToAttach.length = 0;
868
- }
869
- };
870
- var insertBefore = (parent, newNode, reference, isInitialLoad) => {
871
- if (parent.__insertBefore) {
872
- return parent.__insertBefore(newNode, reference);
873
- } else {
874
- return parent == null ? void 0 : parent.insertBefore(newNode, reference);
875
- }
876
- };
877
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
878
- const hostElm = hostRef.$hostElement$;
879
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
880
- const isHostElement = isHost(renderFnResults);
881
- const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
882
- hostTagName = hostElm.tagName;
883
- if (isInitialLoad && rootVnode.$attrs$) {
884
- for (const key of Object.keys(rootVnode.$attrs$)) {
885
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
886
- rootVnode.$attrs$[key] = hostElm[key];
887
- }
888
- }
889
- }
890
- rootVnode.$tag$ = null;
891
- rootVnode.$flags$ |= 4 /* isHost */;
892
- hostRef.$vnode$ = rootVnode;
893
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm;
894
- {
895
- scopeId = hostElm["s-sc"];
896
- }
897
- patch(oldVNode, rootVnode, isInitialLoad);
898
- flushQueuedRefCallbacks();
899
- };
900
-
901
- // src/runtime/update-component.ts
902
- var attachToAncestor = (hostRef, ancestorComponent) => {
903
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
904
- const index = ancestorComponent["s-p"].push(
905
- new Promise(
906
- (r) => hostRef.$onRenderResolve$ = () => {
907
- ancestorComponent["s-p"].splice(index - 1, 1);
908
- r();
909
- }
910
- )
911
- );
912
- }
913
- };
914
- var scheduleUpdate = (hostRef, isInitialLoad) => {
915
- {
916
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
917
- }
918
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
919
- hostRef.$flags$ |= 512 /* needsRerender */;
920
- return;
921
- }
922
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
923
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
924
- if (isInitialLoad) {
925
- queueMicrotask(() => {
926
- dispatch();
927
- });
928
- return;
929
- }
930
- return writeTask(dispatch) ;
931
- };
932
- var dispatchHooks = (hostRef, isInitialLoad) => {
933
- const elm = hostRef.$hostElement$;
934
- const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
935
- const instance = hostRef.$lazyInstance$ ;
936
- if (!instance) {
937
- throw new Error(
938
- `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`
939
- );
940
- }
941
- let maybePromise;
942
- if (isInitialLoad) {
943
- {
944
- if (hostRef.$fetchedCbList$.length) {
945
- hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
946
- }
947
- }
948
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
949
- } else {
950
- maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
951
- }
952
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
953
- endSchedule();
954
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
955
- };
956
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
957
- console.error(err);
958
- fn();
959
- }) : fn();
960
- var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
961
- var updateComponent = async (hostRef, instance, isInitialLoad) => {
962
- var _a;
963
- const elm = hostRef.$hostElement$;
964
- const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
965
- const rc = elm["s-rc"];
966
- if (isInitialLoad) {
967
- attachStyles(hostRef);
968
- }
969
- const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
970
- {
971
- callRender(hostRef, instance, elm, isInitialLoad);
972
- }
973
- if (rc) {
974
- rc.map((cb) => cb());
975
- elm["s-rc"] = void 0;
976
- }
977
- endRender();
978
- endUpdate();
979
- {
980
- const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
981
- const postUpdate = () => postUpdateComponent(hostRef);
982
- if (childrenPromises.length === 0) {
983
- postUpdate();
984
- } else {
985
- Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
986
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
987
- childrenPromises.length = 0;
988
- }
989
- }
990
- };
991
- var callRender = (hostRef, instance, elm, isInitialLoad) => {
992
- try {
993
- instance = instance.render() ;
994
- {
995
- hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
996
- }
997
- {
998
- hostRef.$flags$ |= 2 /* hasRendered */;
999
- }
1000
- {
1001
- {
1002
- {
1003
- renderVdom(hostRef, instance, isInitialLoad);
1004
- }
1005
- }
1006
- }
1007
- } catch (e) {
1008
- consoleError(e, hostRef.$hostElement$);
1009
- }
1010
- return null;
1011
- };
1012
- var postUpdateComponent = (hostRef) => {
1013
- const tagName = hostRef.$cmpMeta$.$tagName$;
1014
- const elm = hostRef.$hostElement$;
1015
- const endPostUpdate = createTime("postUpdate", tagName);
1016
- const instance = hostRef.$lazyInstance$ ;
1017
- const ancestorComponent = hostRef.$ancestorComponent$;
1018
- safeCall(instance, "componentDidRender", void 0, elm);
1019
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1020
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1021
- {
1022
- addHydratedFlag(elm);
1023
- }
1024
- safeCall(instance, "componentDidLoad", void 0, elm);
1025
- endPostUpdate();
1026
- {
1027
- hostRef.$onReadyResolve$(elm);
1028
- if (!ancestorComponent) {
1029
- appDidLoad();
1030
- }
1031
- }
1032
- } else {
1033
- safeCall(instance, "componentDidUpdate", void 0, elm);
1034
- endPostUpdate();
1035
- }
1036
- {
1037
- hostRef.$onInstanceResolve$(elm);
1038
- }
1039
- {
1040
- if (hostRef.$onRenderResolve$) {
1041
- hostRef.$onRenderResolve$();
1042
- hostRef.$onRenderResolve$ = void 0;
1043
- }
1044
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1045
- nextTick(() => scheduleUpdate(hostRef, false));
1046
- }
1047
- hostRef.$flags$ &= -517;
1048
- }
1049
- };
1050
- var appDidLoad = (who) => {
1051
- nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1052
- };
1053
- var safeCall = (instance, method, arg, elm) => {
1054
- if (instance && instance[method]) {
1055
- try {
1056
- return instance[method](arg);
1057
- } catch (e) {
1058
- consoleError(e, elm);
1059
- }
1060
- }
1061
- return void 0;
1062
- };
1063
- var addHydratedFlag = (elm) => {
1064
- var _a;
1065
- return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
1066
- };
1067
-
1068
- // src/runtime/set-value.ts
1069
- var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1070
- var setValue = (ref, propName, newVal, cmpMeta) => {
1071
- const hostRef = getHostRef(ref);
1072
- if (!hostRef) {
1073
- return;
1074
- }
1075
- if (!hostRef) {
1076
- throw new Error(
1077
- `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).`
1078
- );
1079
- }
1080
- const elm = hostRef.$hostElement$ ;
1081
- const oldVal = hostRef.$instanceValues$.get(propName);
1082
- const flags = hostRef.$flags$;
1083
- const instance = hostRef.$lazyInstance$ ;
1084
- newVal = parsePropertyValue(
1085
- newVal,
1086
- cmpMeta.$members$[propName][0]);
1087
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1088
- const didValueChange = newVal !== oldVal && !areBothNaN;
1089
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1090
- hostRef.$instanceValues$.set(propName, newVal);
1091
- if (cmpMeta.$watchers$) {
1092
- const watchMethods = cmpMeta.$watchers$[propName];
1093
- if (watchMethods) {
1094
- watchMethods.map((watcher) => {
1095
- try {
1096
- const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1097
- if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
1098
- if (!instance) {
1099
- hostRef.$fetchedCbList$.push(() => {
1100
- hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
1101
- });
1102
- } else {
1103
- instance[watchMethodName](newVal, oldVal, propName);
1104
- }
1105
- }
1106
- } catch (e) {
1107
- consoleError(e, elm);
1108
- }
1109
- });
1110
- }
1111
- }
1112
- if (flags & 2 /* hasRendered */) {
1113
- if (instance.componentShouldUpdate) {
1114
- const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
1115
- if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
1116
- return;
1117
- }
1118
- }
1119
- if (!(flags & 16 /* isQueuedForUpdate */)) {
1120
- scheduleUpdate(hostRef, false);
1121
- }
1122
- }
1123
- }
1124
- };
1125
-
1126
- // src/runtime/proxy-component.ts
1127
- var proxyComponent = (Cstr, cmpMeta, flags) => {
1128
- var _a, _b;
1129
- const prototype = Cstr.prototype;
1130
- if (cmpMeta.$members$ || BUILD.propChangeCallback) {
1131
- {
1132
- if (Cstr.watchers && !cmpMeta.$watchers$) {
1133
- cmpMeta.$watchers$ = Cstr.watchers;
1134
- }
1135
- if (Cstr.deserializers && !cmpMeta.$deserializers$) {
1136
- cmpMeta.$deserializers$ = Cstr.deserializers;
1137
- }
1138
- if (Cstr.serializers && !cmpMeta.$serializers$) {
1139
- cmpMeta.$serializers$ = Cstr.serializers;
1140
- }
1141
- }
1142
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1143
- members.map(([memberName, [memberFlags]]) => {
1144
- if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1145
- const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
1146
- if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1147
- if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1148
- if (flags & 1 /* isElementConstructor */ || !origGetter) {
1149
- Object.defineProperty(prototype, memberName, {
1150
- get() {
1151
- {
1152
- if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1153
- return getValue(this, memberName);
1154
- }
1155
- const ref = getHostRef(this);
1156
- const instance = ref ? ref.$lazyInstance$ : prototype;
1157
- if (!instance) return;
1158
- return instance[memberName];
1159
- }
1160
- },
1161
- configurable: true,
1162
- enumerable: true
1163
- });
1164
- }
1165
- Object.defineProperty(prototype, memberName, {
1166
- set(newValue) {
1167
- const ref = getHostRef(this);
1168
- if (!ref) {
1169
- return;
1170
- }
1171
- if (origSetter) {
1172
- const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1173
- if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1174
- newValue = ref.$instanceValues$.get(memberName);
1175
- }
1176
- origSetter.apply(this, [
1177
- parsePropertyValue(
1178
- newValue,
1179
- memberFlags)
1180
- ]);
1181
- newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1182
- setValue(this, memberName, newValue, cmpMeta);
1183
- return;
1184
- }
1185
- {
1186
- if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1187
- setValue(this, memberName, newValue, cmpMeta);
1188
- if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1189
- ref.$fetchedCbList$.push(() => {
1190
- if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1191
- ref.$lazyInstance$[memberName] = newValue;
1192
- }
1193
- });
1194
- }
1195
- return;
1196
- }
1197
- const setterSetVal = () => {
1198
- const currentValue = ref.$lazyInstance$[memberName];
1199
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1200
- ref.$instanceValues$.set(memberName, currentValue);
1201
- }
1202
- ref.$lazyInstance$[memberName] = parsePropertyValue(
1203
- newValue,
1204
- memberFlags);
1205
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1206
- };
1207
- if (ref.$lazyInstance$) {
1208
- setterSetVal();
1209
- } else {
1210
- ref.$fetchedCbList$.push(() => {
1211
- setterSetVal();
1212
- });
1213
- }
1214
- }
1215
- }
1216
- });
1217
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1218
- Object.defineProperty(prototype, memberName, {
1219
- value(...args) {
1220
- var _a2;
1221
- const ref = getHostRef(this);
1222
- return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
1223
- var _a3;
1224
- return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
1225
- });
1226
- }
1227
- });
1228
- }
1229
- });
1230
- if ((flags & 1 /* isElementConstructor */)) {
1231
- const attrNameToPropName = /* @__PURE__ */ new Map();
1232
- prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
1233
- plt.jmp(() => {
1234
- var _a2;
1235
- const propName = attrNameToPropName.get(attrName);
1236
- const hostRef = getHostRef(this);
1237
- if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1238
- newValue = this[propName];
1239
- delete this[propName];
1240
- }
1241
- if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1242
- this[propName] == newValue) {
1243
- return;
1244
- } else if (propName == null) {
1245
- const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1246
- if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
1247
- const instance = hostRef.$lazyInstance$ ;
1248
- const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1249
- entry == null ? void 0 : entry.forEach((watcher) => {
1250
- const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1251
- if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
1252
- instance[watchMethodName].call(instance, newValue, oldValue, attrName);
1253
- }
1254
- });
1255
- }
1256
- return;
1257
- }
1258
- const propFlags = members.find(([m]) => m === propName);
1259
- if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
1260
- newValue = newValue === null || newValue === "false" ? false : true;
1261
- }
1262
- const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1263
- if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
1264
- this[propName] = newValue;
1265
- }
1266
- });
1267
- };
1268
- Cstr.observedAttributes = Array.from(
1269
- /* @__PURE__ */ new Set([
1270
- ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1271
- ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1272
- const attrName = m[1] || propName;
1273
- attrNameToPropName.set(attrName, propName);
1274
- return attrName;
1275
- })
1276
- ])
1277
- );
1278
- }
1279
- }
1280
- return Cstr;
1281
- };
1282
-
1283
- // src/runtime/initialize-component.ts
1284
- var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1285
- let Cstr;
1286
- try {
1287
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1288
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1289
- const bundleId = cmpMeta.$lazyBundleId$;
1290
- if (bundleId) {
1291
- const CstrImport = loadModule(cmpMeta, hostRef);
1292
- if (CstrImport && "then" in CstrImport) {
1293
- const endLoad = uniqueTime();
1294
- Cstr = await CstrImport;
1295
- endLoad();
1296
- } else {
1297
- Cstr = CstrImport;
1298
- }
1299
- if (!Cstr) {
1300
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1301
- }
1302
- if (!Cstr.isProxied) {
1303
- {
1304
- cmpMeta.$watchers$ = Cstr.watchers;
1305
- cmpMeta.$serializers$ = Cstr.serializers;
1306
- cmpMeta.$deserializers$ = Cstr.deserializers;
1307
- }
1308
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1309
- Cstr.isProxied = true;
1310
- }
1311
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
1312
- {
1313
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1314
- }
1315
- try {
1316
- new Cstr(hostRef);
1317
- } catch (e) {
1318
- consoleError(e, elm);
1319
- }
1320
- {
1321
- hostRef.$flags$ &= -9 /* isConstructingInstance */;
1322
- }
1323
- {
1324
- hostRef.$flags$ |= 128 /* isWatchReady */;
1325
- }
1326
- endNewInstance();
1327
- {
1328
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
1329
- }
1330
- } else {
1331
- Cstr = elm.constructor;
1332
- const cmpTag = elm.localName;
1333
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1334
- }
1335
- if (Cstr && Cstr.style) {
1336
- let style;
1337
- if (typeof Cstr.style === "string") {
1338
- style = Cstr.style;
1339
- }
1340
- const scopeId2 = getScopeId(cmpMeta);
1341
- if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
1342
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1343
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1344
- endRegisterStyles();
1345
- }
1346
- }
1347
- }
1348
- const ancestorComponent = hostRef.$ancestorComponent$;
1349
- const schedule = () => scheduleUpdate(hostRef, true);
1350
- if (ancestorComponent && ancestorComponent["s-rc"]) {
1351
- ancestorComponent["s-rc"].push(schedule);
1352
- } else {
1353
- schedule();
1354
- }
1355
- } catch (e) {
1356
- consoleError(e, elm);
1357
- if (hostRef.$onRenderResolve$) {
1358
- hostRef.$onRenderResolve$();
1359
- hostRef.$onRenderResolve$ = void 0;
1360
- }
1361
- if (hostRef.$onReadyResolve$) {
1362
- hostRef.$onReadyResolve$(elm);
1363
- }
1364
- }
1365
- };
1366
- var fireConnectedCallback = (instance, elm) => {
1367
- {
1368
- safeCall(instance, "connectedCallback", void 0, elm);
1369
- }
1370
- };
1371
-
1372
- // src/runtime/connected-callback.ts
1373
- var connectedCallback = (elm) => {
1374
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1375
- const hostRef = getHostRef(elm);
1376
- if (!hostRef) {
1377
- return;
1378
- }
1379
- const cmpMeta = hostRef.$cmpMeta$;
1380
- const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1381
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1382
- hostRef.$flags$ |= 1 /* hasConnected */;
1383
- {
1384
- let ancestorComponent = elm;
1385
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1386
- if (ancestorComponent["s-p"]) {
1387
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1388
- break;
1389
- }
1390
- }
1391
- }
1392
- if (cmpMeta.$members$) {
1393
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1394
- if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
1395
- const value = elm[memberName];
1396
- delete elm[memberName];
1397
- elm[memberName] = value;
1398
- }
1399
- });
1400
- }
1401
- {
1402
- initializeComponent(elm, hostRef, cmpMeta);
1403
- }
1404
- } else {
1405
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1406
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
1407
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1408
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1409
- }
1410
- }
1411
- endConnected();
1412
- }
1413
- };
1414
- var disconnectInstance = (instance, elm) => {
1415
- {
1416
- safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1417
- }
1418
- };
1419
- var disconnectedCallback = async (elm) => {
1420
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1421
- const hostRef = getHostRef(elm);
1422
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1423
- disconnectInstance(hostRef.$lazyInstance$, elm);
1424
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1425
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1426
- }
1427
- }
1428
- if (rootAppliedStyles.has(elm)) {
1429
- rootAppliedStyles.delete(elm);
1430
- }
1431
- if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1432
- rootAppliedStyles.delete(elm.shadowRoot);
1433
- }
1434
- };
1435
-
1436
- // src/runtime/bootstrap-lazy.ts
1437
- var bootstrapLazy = (lazyBundles, options = {}) => {
1438
- var _a;
1439
- if (!win.document) {
1440
- console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
1441
- return;
1442
- }
1443
- const endBootstrap = createTime();
1444
- const cmpTags = [];
1445
- const exclude = options.exclude || [];
1446
- const customElements2 = win.customElements;
1447
- const head = win.document.head;
1448
- const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1449
- const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1450
- const deferredConnectedCallbacks = [];
1451
- let appLoadFallback;
1452
- let isBootstrapping = true;
1453
- Object.assign(plt, options);
1454
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1455
- lazyBundles.map((lazyBundle) => {
1456
- lazyBundle[1].map((compactMeta) => {
1457
- var _a2, _b, _c;
1458
- const cmpMeta = {
1459
- $flags$: compactMeta[0],
1460
- $tagName$: compactMeta[1],
1461
- $members$: compactMeta[2],
1462
- $listeners$: compactMeta[3]
1463
- };
1464
- {
1465
- cmpMeta.$members$ = compactMeta[2];
1466
- }
1467
- {
1468
- cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1469
- cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
1470
- cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
1471
- }
1472
- const tagName = transformTag(cmpMeta.$tagName$);
1473
- const HostElement = class extends HTMLElement {
1474
- ["s-p"];
1475
- ["s-rc"];
1476
- hasRegisteredEventListeners = false;
1477
- // StencilLazyHost
1478
- constructor(self) {
1479
- super(self);
1480
- self = this;
1481
- registerHost(self, cmpMeta);
1482
- }
1483
- connectedCallback() {
1484
- const hostRef = getHostRef(this);
1485
- if (!hostRef) {
1486
- return;
1487
- }
1488
- if (!this.hasRegisteredEventListeners) {
1489
- this.hasRegisteredEventListeners = true;
1490
- }
1491
- if (appLoadFallback) {
1492
- clearTimeout(appLoadFallback);
1493
- appLoadFallback = null;
1494
- }
1495
- if (isBootstrapping) {
1496
- deferredConnectedCallbacks.push(this);
1497
- } else {
1498
- plt.jmp(() => connectedCallback(this));
1499
- }
1500
- }
1501
- disconnectedCallback() {
1502
- plt.jmp(() => disconnectedCallback(this));
1503
- plt.raf(() => {
1504
- var _a3;
1505
- const hostRef = getHostRef(this);
1506
- if (!hostRef) {
1507
- return;
1508
- }
1509
- const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
1510
- if (i2 > -1) {
1511
- deferredConnectedCallbacks.splice(i2, 1);
1512
- }
1513
- if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
1514
- delete hostRef.$vnode$.$elm$;
1515
- }
1516
- });
1517
- }
1518
- componentOnReady() {
1519
- var _a3;
1520
- return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1521
- }
1522
- };
1523
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1524
- if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
1525
- cmpTags.push(tagName);
1526
- customElements2.define(
1527
- tagName,
1528
- proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
1529
- );
1530
- }
1531
- });
1532
- });
1533
- if (cmpTags.length > 0) {
1534
- {
1535
- dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
1536
- }
1537
- if (dataStyles.innerHTML.length) {
1538
- dataStyles.setAttribute("data-styles", "");
1539
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1540
- if (nonce != null) {
1541
- dataStyles.setAttribute("nonce", nonce);
1542
- }
1543
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1544
- }
1545
- }
1546
- isBootstrapping = false;
1547
- if (deferredConnectedCallbacks.length) {
1548
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1549
- } else {
1550
- {
1551
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
1552
- }
1553
- }
1554
- endBootstrap();
1555
- };
1556
-
1557
- // src/runtime/nonce.ts
1558
- var setNonce = (nonce) => plt.$nonce$ = nonce;
1559
- function transformTag(tag) {
1560
- return tag;
1561
- }
1562
-
1563
- exports.Host = Host;
1564
- exports.bootstrapLazy = bootstrapLazy;
1565
- exports.createEvent = createEvent;
1566
- exports.getElement = getElement;
1567
- exports.h = h;
1568
- exports.promiseResolve = promiseResolve;
1569
- exports.registerInstance = registerInstance;
1570
- exports.setNonce = setNonce;