@sensefolks/fastpoll 0.1.0

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 (107) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -0
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  4. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  5. package/dist/cjs/index-CC5IS5t8.js +1437 -0
  6. package/dist/cjs/index-CC5IS5t8.js.map +1 -0
  7. package/dist/cjs/index-D8TNlmQq.js +201 -0
  8. package/dist/cjs/index-D8TNlmQq.js.map +1 -0
  9. package/dist/cjs/index.cjs.js +11 -0
  10. package/dist/cjs/index.cjs.js.map +1 -0
  11. package/dist/cjs/loader.cjs.js +16 -0
  12. package/dist/cjs/loader.cjs.js.map +1 -0
  13. package/dist/cjs/sf-fastpoll.cjs.entry.js +395 -0
  14. package/dist/cjs/sf-fastpoll.cjs.entry.js.map +1 -0
  15. package/dist/cjs/sf-fastpoll.cjs.js +28 -0
  16. package/dist/cjs/sf-fastpoll.cjs.js.map +1 -0
  17. package/dist/cjs/sf-fastpoll.entry.cjs.js.map +1 -0
  18. package/dist/collection/collection-manifest.json +12 -0
  19. package/dist/collection/components/sf-fastpoll/sf-fastpoll.css +76 -0
  20. package/dist/collection/components/sf-fastpoll/sf-fastpoll.js +454 -0
  21. package/dist/collection/components/sf-fastpoll/sf-fastpoll.js.map +1 -0
  22. package/dist/collection/index.js +11 -0
  23. package/dist/collection/index.js.map +1 -0
  24. package/dist/collection/utils/utils.js +189 -0
  25. package/dist/collection/utils/utils.js.map +1 -0
  26. package/dist/components/index.d.ts +33 -0
  27. package/dist/components/index.js +1427 -0
  28. package/dist/components/index.js.map +1 -0
  29. package/dist/components/sf-fastpoll.d.ts +11 -0
  30. package/dist/components/sf-fastpoll.js +425 -0
  31. package/dist/components/sf-fastpoll.js.map +1 -0
  32. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  33. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  34. package/dist/esm/index-CfdIRf0W.js +193 -0
  35. package/dist/esm/index-CfdIRf0W.js.map +1 -0
  36. package/dist/esm/index-XYfqntZe.js +1428 -0
  37. package/dist/esm/index-XYfqntZe.js.map +1 -0
  38. package/dist/esm/index.js +4 -0
  39. package/dist/esm/index.js.map +1 -0
  40. package/dist/esm/loader.js +14 -0
  41. package/dist/esm/loader.js.map +1 -0
  42. package/dist/esm/polyfills/core-js.js +11 -0
  43. package/dist/esm/polyfills/dom.js +79 -0
  44. package/dist/esm/polyfills/es5-html-element.js +1 -0
  45. package/dist/esm/polyfills/index.js +34 -0
  46. package/dist/esm/polyfills/system.js +6 -0
  47. package/dist/esm/sf-fastpoll.entry.js +393 -0
  48. package/dist/esm/sf-fastpoll.entry.js.map +1 -0
  49. package/dist/esm/sf-fastpoll.js +24 -0
  50. package/dist/esm/sf-fastpoll.js.map +1 -0
  51. package/dist/esm-es5/app-globals-DQuL1Twl.js +2 -0
  52. package/dist/esm-es5/app-globals-DQuL1Twl.js.map +1 -0
  53. package/dist/esm-es5/index-CfdIRf0W.js +2 -0
  54. package/dist/esm-es5/index-CfdIRf0W.js.map +1 -0
  55. package/dist/esm-es5/index-XYfqntZe.js +3 -0
  56. package/dist/esm-es5/index-XYfqntZe.js.map +1 -0
  57. package/dist/esm-es5/index.js +2 -0
  58. package/dist/esm-es5/index.js.map +1 -0
  59. package/dist/esm-es5/loader.js +2 -0
  60. package/dist/esm-es5/loader.js.map +1 -0
  61. package/dist/esm-es5/sf-fastpoll.entry.js +2 -0
  62. package/dist/esm-es5/sf-fastpoll.entry.js.map +1 -0
  63. package/dist/esm-es5/sf-fastpoll.js +2 -0
  64. package/dist/esm-es5/sf-fastpoll.js.map +1 -0
  65. package/dist/index.cjs.js +1 -0
  66. package/dist/index.js +1 -0
  67. package/dist/sf-fastpoll/index.esm.js +2 -0
  68. package/dist/sf-fastpoll/index.esm.js.map +1 -0
  69. package/dist/sf-fastpoll/loader.esm.js.map +1 -0
  70. package/dist/sf-fastpoll/p-1f6dca2a.system.entry.js +2 -0
  71. package/dist/sf-fastpoll/p-1f6dca2a.system.entry.js.map +1 -0
  72. package/dist/sf-fastpoll/p-4648bca3.entry.js +2 -0
  73. package/dist/sf-fastpoll/p-4648bca3.entry.js.map +1 -0
  74. package/dist/sf-fastpoll/p-BbPAtVJG.system.js +2 -0
  75. package/dist/sf-fastpoll/p-BbPAtVJG.system.js.map +1 -0
  76. package/dist/sf-fastpoll/p-C7EMppj8.system.js.map +1 -0
  77. package/dist/sf-fastpoll/p-C9ESvisV.system.js +3 -0
  78. package/dist/sf-fastpoll/p-C9ESvisV.system.js.map +1 -0
  79. package/dist/sf-fastpoll/p-CfdIRf0W.js +2 -0
  80. package/dist/sf-fastpoll/p-CfdIRf0W.js.map +1 -0
  81. package/dist/sf-fastpoll/p-CpmSDeqe.system.js +2 -0
  82. package/dist/sf-fastpoll/p-CpmSDeqe.system.js.map +1 -0
  83. package/dist/sf-fastpoll/p-DQuL1Twl.js +2 -0
  84. package/dist/sf-fastpoll/p-DQuL1Twl.js.map +1 -0
  85. package/dist/sf-fastpoll/p-JC66e5NR.system.js.map +1 -0
  86. package/dist/sf-fastpoll/p-S-cJYJS7.system.js +2 -0
  87. package/dist/sf-fastpoll/p-S-cJYJS7.system.js.map +1 -0
  88. package/dist/sf-fastpoll/p-XYfqntZe.js +3 -0
  89. package/dist/sf-fastpoll/p-XYfqntZe.js.map +1 -0
  90. package/dist/sf-fastpoll/p-zRZYYxiz.system.js +2 -0
  91. package/dist/sf-fastpoll/p-zRZYYxiz.system.js.map +1 -0
  92. package/dist/sf-fastpoll/sf-fastpoll.entry.esm.js.map +1 -0
  93. package/dist/sf-fastpoll/sf-fastpoll.esm.js +2 -0
  94. package/dist/sf-fastpoll/sf-fastpoll.esm.js.map +1 -0
  95. package/dist/sf-fastpoll/sf-fastpoll.js +127 -0
  96. package/dist/types/components/sf-fastpoll/sf-fastpoll.d.ts +77 -0
  97. package/dist/types/components.d.ts +47 -0
  98. package/dist/types/index.d.ts +11 -0
  99. package/dist/types/stencil-public-runtime.d.ts +1709 -0
  100. package/dist/types/utils/utils.d.ts +86 -0
  101. package/loader/cdn.js +2 -0
  102. package/loader/index.cjs.js +2 -0
  103. package/loader/index.d.ts +24 -0
  104. package/loader/index.es2017.js +2 -0
  105. package/loader/index.js +3 -0
  106. package/package.json +86 -0
  107. package/readme.md +239 -0
@@ -0,0 +1,1427 @@
1
+ const NAMESPACE = 'sf-fastpoll';
2
+ const BUILD = /* sf-fastpoll */ { hydratedSelectorName: "hydrated", lazyLoad: false, updatable: true, watchCallback: false };
3
+ const Env = /* sf-fastpoll */ {"SURVEY_API_ENDPOINT":"https://api.sensefolks.com/v1/public-surveys/fastPoll","RESPONSE_API_ENDPOINT":"https://api.sensefolks.com/v1/responses"};
4
+
5
+ /*
6
+ Stencil Client Platform v4.36.0 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ var __defProp = Object.defineProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+
14
+ // src/client/client-host-ref.ts
15
+ var getHostRef = (ref) => {
16
+ if (ref.__stencil__getHostRef) {
17
+ return ref.__stencil__getHostRef();
18
+ }
19
+ return void 0;
20
+ };
21
+ var registerHost = (hostElement, cmpMeta) => {
22
+ const hostRef = {
23
+ $flags$: 0,
24
+ $hostElement$: hostElement,
25
+ $cmpMeta$: cmpMeta,
26
+ $instanceValues$: /* @__PURE__ */ new Map()
27
+ };
28
+ {
29
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
30
+ hostElement["s-p"] = [];
31
+ hostElement["s-rc"] = [];
32
+ }
33
+ const ref = hostRef;
34
+ hostElement.__stencil__getHostRef = () => ref;
35
+ return ref;
36
+ };
37
+ var isMemberInElement = (elm, memberName) => memberName in elm;
38
+ var consoleError = (e, el) => (0, console.error)(e, el);
39
+
40
+ // src/client/client-style.ts
41
+ var styles = /* @__PURE__ */ new Map();
42
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
43
+ var win = typeof window !== "undefined" ? window : {};
44
+ var H = win.HTMLElement || class {
45
+ };
46
+ var plt = {
47
+ $flags$: 0,
48
+ $resourcesUrl$: "",
49
+ jmp: (h2) => h2(),
50
+ raf: (h2) => requestAnimationFrame(h2),
51
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
52
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
53
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
54
+ };
55
+ var promiseResolve = (v) => Promise.resolve(v);
56
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
57
+ try {
58
+ new CSSStyleSheet();
59
+ return typeof new CSSStyleSheet().replaceSync === "function";
60
+ } catch (e) {
61
+ }
62
+ return false;
63
+ })() ;
64
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
65
+ var queuePending = false;
66
+ var queueDomReads = [];
67
+ var queueDomWrites = [];
68
+ var queueTask = (queue, write) => (cb) => {
69
+ queue.push(cb);
70
+ if (!queuePending) {
71
+ queuePending = true;
72
+ if (write && plt.$flags$ & 4 /* queueSync */) {
73
+ nextTick(flush);
74
+ } else {
75
+ plt.raf(flush);
76
+ }
77
+ }
78
+ };
79
+ var consume = (queue) => {
80
+ for (let i2 = 0; i2 < queue.length; i2++) {
81
+ try {
82
+ queue[i2](performance.now());
83
+ } catch (e) {
84
+ consoleError(e);
85
+ }
86
+ }
87
+ queue.length = 0;
88
+ };
89
+ var flush = () => {
90
+ consume(queueDomReads);
91
+ {
92
+ consume(queueDomWrites);
93
+ if (queuePending = queueDomReads.length > 0) {
94
+ plt.raf(flush);
95
+ }
96
+ }
97
+ };
98
+ var nextTick = (cb) => promiseResolve().then(cb);
99
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
100
+
101
+ // src/runtime/asset-path.ts
102
+ var getAssetPath = (path) => {
103
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
104
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
105
+ };
106
+ var setAssetPath = (path) => plt.$resourcesUrl$ = path;
107
+ var isComplexType = (o) => {
108
+ o = typeof o;
109
+ return o === "object" || o === "function";
110
+ };
111
+
112
+ // src/utils/query-nonce-meta-tag-content.ts
113
+ function queryNonceMetaTagContent(doc) {
114
+ var _a, _b, _c;
115
+ 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;
116
+ }
117
+
118
+ // src/utils/regular-expression.ts
119
+ var escapeRegExpSpecialCharacters = (text) => {
120
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
121
+ };
122
+
123
+ // src/utils/result.ts
124
+ var result_exports = {};
125
+ __export(result_exports, {
126
+ err: () => err,
127
+ map: () => map,
128
+ ok: () => ok,
129
+ unwrap: () => unwrap,
130
+ unwrapErr: () => unwrapErr
131
+ });
132
+ var ok = (value) => ({
133
+ isOk: true,
134
+ isErr: false,
135
+ value
136
+ });
137
+ var err = (value) => ({
138
+ isOk: false,
139
+ isErr: true,
140
+ value
141
+ });
142
+ function map(result, fn) {
143
+ if (result.isOk) {
144
+ const val = fn(result.value);
145
+ if (val instanceof Promise) {
146
+ return val.then((newVal) => ok(newVal));
147
+ } else {
148
+ return ok(val);
149
+ }
150
+ }
151
+ if (result.isErr) {
152
+ const value = result.value;
153
+ return err(value);
154
+ }
155
+ throw "should never get here";
156
+ }
157
+ var unwrap = (result) => {
158
+ if (result.isOk) {
159
+ return result.value;
160
+ } else {
161
+ throw result.value;
162
+ }
163
+ };
164
+ var unwrapErr = (result) => {
165
+ if (result.isErr) {
166
+ return result.value;
167
+ } else {
168
+ throw result.value;
169
+ }
170
+ };
171
+
172
+ // src/utils/style.ts
173
+ function createStyleSheetIfNeededAndSupported(styles2) {
174
+ return void 0;
175
+ }
176
+
177
+ // src/utils/shadow-root.ts
178
+ var globalStyleSheet;
179
+ function createShadowRoot(cmpMeta) {
180
+ var _a;
181
+ const shadowRoot = this.attachShadow({ mode: "open" });
182
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
183
+ if (globalStyleSheet) {
184
+ if (supportsMutableAdoptedStyleSheets) {
185
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
186
+ } else {
187
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
188
+ }
189
+ }
190
+ }
191
+ var getSlottedChildNodes = (childNodes) => {
192
+ const result = [];
193
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
194
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
195
+ if (slottedNode && slottedNode.isConnected) {
196
+ result.push(slottedNode);
197
+ }
198
+ }
199
+ return result;
200
+ };
201
+ var patchChildSlotNodes = (elm) => {
202
+ class FakeNodeList extends Array {
203
+ item(n) {
204
+ return this[n];
205
+ }
206
+ }
207
+ patchHostOriginalAccessor("children", elm);
208
+ Object.defineProperty(elm, "children", {
209
+ get() {
210
+ return this.childNodes.filter((n) => n.nodeType === 1);
211
+ }
212
+ });
213
+ Object.defineProperty(elm, "childElementCount", {
214
+ get() {
215
+ return this.children.length;
216
+ }
217
+ });
218
+ patchHostOriginalAccessor("firstChild", elm);
219
+ Object.defineProperty(elm, "firstChild", {
220
+ get() {
221
+ return this.childNodes[0];
222
+ }
223
+ });
224
+ patchHostOriginalAccessor("lastChild", elm);
225
+ Object.defineProperty(elm, "lastChild", {
226
+ get() {
227
+ return this.childNodes[this.childNodes.length - 1];
228
+ }
229
+ });
230
+ patchHostOriginalAccessor("childNodes", elm);
231
+ Object.defineProperty(elm, "childNodes", {
232
+ get() {
233
+ const result = new FakeNodeList();
234
+ result.push(...getSlottedChildNodes(this.__childNodes));
235
+ return result;
236
+ }
237
+ });
238
+ };
239
+ var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
240
+ var validNodesPatches = [
241
+ "childNodes",
242
+ "firstChild",
243
+ "lastChild",
244
+ "nextSibling",
245
+ "previousSibling",
246
+ "textContent",
247
+ "parentNode"
248
+ ];
249
+ function patchHostOriginalAccessor(accessorName, node) {
250
+ if (!globalThis.Node || !globalThis.Element) {
251
+ return;
252
+ }
253
+ let accessor;
254
+ if (validElementPatches.includes(accessorName)) {
255
+ accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
256
+ } else if (validNodesPatches.includes(accessorName)) {
257
+ accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
258
+ }
259
+ if (!accessor) {
260
+ accessor = Object.getOwnPropertyDescriptor(node, accessorName);
261
+ }
262
+ if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
263
+ }
264
+ var createTime = (fnName, tagName = "") => {
265
+ {
266
+ return () => {
267
+ return;
268
+ };
269
+ }
270
+ };
271
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
272
+ var registerStyle = (scopeId2, cssText, allowCS) => {
273
+ let style = styles.get(scopeId2);
274
+ if (supportsConstructableStylesheets && allowCS) {
275
+ style = style || new CSSStyleSheet();
276
+ if (typeof style === "string") {
277
+ style = cssText;
278
+ } else {
279
+ style.replaceSync(cssText);
280
+ }
281
+ } else {
282
+ style = cssText;
283
+ }
284
+ styles.set(scopeId2, style);
285
+ };
286
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
287
+ var _a;
288
+ const scopeId2 = getScopeId(cmpMeta);
289
+ const style = styles.get(scopeId2);
290
+ if (!win.document) {
291
+ return scopeId2;
292
+ }
293
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
294
+ if (style) {
295
+ if (typeof style === "string") {
296
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
297
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
298
+ let styleElm;
299
+ if (!appliedStyles) {
300
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
301
+ }
302
+ if (!appliedStyles.has(scopeId2)) {
303
+ {
304
+ styleElm = win.document.createElement("style");
305
+ styleElm.innerHTML = style;
306
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
307
+ if (nonce != null) {
308
+ styleElm.setAttribute("nonce", nonce);
309
+ }
310
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
311
+ if (styleContainerNode.nodeName === "HEAD") {
312
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
313
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
314
+ styleContainerNode.insertBefore(
315
+ styleElm,
316
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
317
+ );
318
+ } else if ("host" in styleContainerNode) {
319
+ if (supportsConstructableStylesheets) {
320
+ const stylesheet = new CSSStyleSheet();
321
+ stylesheet.replaceSync(style);
322
+ if (supportsMutableAdoptedStyleSheets) {
323
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
324
+ } else {
325
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
326
+ }
327
+ } else {
328
+ const existingStyleContainer = styleContainerNode.querySelector("style");
329
+ if (existingStyleContainer) {
330
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
331
+ } else {
332
+ styleContainerNode.prepend(styleElm);
333
+ }
334
+ }
335
+ } else {
336
+ styleContainerNode.append(styleElm);
337
+ }
338
+ }
339
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
340
+ styleContainerNode.insertBefore(styleElm, null);
341
+ }
342
+ }
343
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
344
+ styleElm.innerHTML += SLOT_FB_CSS;
345
+ }
346
+ if (appliedStyles) {
347
+ appliedStyles.add(scopeId2);
348
+ }
349
+ }
350
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
351
+ if (supportsMutableAdoptedStyleSheets) {
352
+ styleContainerNode.adoptedStyleSheets.push(style);
353
+ } else {
354
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
355
+ }
356
+ }
357
+ }
358
+ return scopeId2;
359
+ };
360
+ var attachStyles = (hostRef) => {
361
+ const cmpMeta = hostRef.$cmpMeta$;
362
+ const elm = hostRef.$hostElement$;
363
+ const flags = cmpMeta.$flags$;
364
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
365
+ const scopeId2 = addStyle(
366
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
367
+ cmpMeta);
368
+ if (flags & 10 /* needsScopedEncapsulation */) {
369
+ elm["s-sc"] = scopeId2;
370
+ elm.classList.add(scopeId2 + "-h");
371
+ }
372
+ endAttachStyles();
373
+ };
374
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
375
+ var h = (nodeName, vnodeData, ...children) => {
376
+ let child = null;
377
+ let key = null;
378
+ let simple = false;
379
+ let lastSimple = false;
380
+ const vNodeChildren = [];
381
+ const walk = (c) => {
382
+ for (let i2 = 0; i2 < c.length; i2++) {
383
+ child = c[i2];
384
+ if (Array.isArray(child)) {
385
+ walk(child);
386
+ } else if (child != null && typeof child !== "boolean") {
387
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
388
+ child = String(child);
389
+ }
390
+ if (simple && lastSimple) {
391
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
392
+ } else {
393
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
394
+ }
395
+ lastSimple = simple;
396
+ }
397
+ }
398
+ };
399
+ walk(children);
400
+ if (vnodeData) {
401
+ if (vnodeData.key) {
402
+ key = vnodeData.key;
403
+ }
404
+ {
405
+ const classData = vnodeData.className || vnodeData.class;
406
+ if (classData) {
407
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
408
+ }
409
+ }
410
+ }
411
+ const vnode = newVNode(nodeName, null);
412
+ vnode.$attrs$ = vnodeData;
413
+ if (vNodeChildren.length > 0) {
414
+ vnode.$children$ = vNodeChildren;
415
+ }
416
+ {
417
+ vnode.$key$ = key;
418
+ }
419
+ return vnode;
420
+ };
421
+ var newVNode = (tag, text) => {
422
+ const vnode = {
423
+ $flags$: 0,
424
+ $tag$: tag,
425
+ $text$: text,
426
+ $elm$: null,
427
+ $children$: null
428
+ };
429
+ {
430
+ vnode.$attrs$ = null;
431
+ }
432
+ {
433
+ vnode.$key$ = null;
434
+ }
435
+ return vnode;
436
+ };
437
+ var Host = {};
438
+ var isHost = (node) => node && node.$tag$ === Host;
439
+ var createSupportsRuleRe = (selector) => {
440
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
441
+ return new RegExp(
442
+ // First capture group: match any context before the selector that's not inside @supports selector()
443
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
444
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
445
+ "g"
446
+ );
447
+ };
448
+ createSupportsRuleRe("::slotted");
449
+ createSupportsRuleRe(":host");
450
+ createSupportsRuleRe(":host-context");
451
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
452
+ if (propValue != null && !isComplexType(propValue)) {
453
+ if (propType & 1 /* String */) {
454
+ return String(propValue);
455
+ }
456
+ return propValue;
457
+ }
458
+ return propValue;
459
+ };
460
+ var emitEvent = (elm, name, opts) => {
461
+ const ev = plt.ce(name, opts);
462
+ elm.dispatchEvent(ev);
463
+ return ev;
464
+ };
465
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
466
+ if (oldValue === newValue) {
467
+ return;
468
+ }
469
+ let isProp = isMemberInElement(elm, memberName);
470
+ let ln = memberName.toLowerCase();
471
+ if (memberName === "class") {
472
+ const classList = elm.classList;
473
+ const oldClasses = parseClassList(oldValue);
474
+ let newClasses = parseClassList(newValue);
475
+ {
476
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
477
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
478
+ }
479
+ } else if (memberName === "key") ; else if ((!elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
480
+ if (memberName[2] === "-") {
481
+ memberName = memberName.slice(3);
482
+ } else if (isMemberInElement(win, ln)) {
483
+ memberName = ln.slice(2);
484
+ } else {
485
+ memberName = ln[2] + memberName.slice(3);
486
+ }
487
+ if (oldValue || newValue) {
488
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
489
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
490
+ if (oldValue) {
491
+ plt.rel(elm, memberName, oldValue, capture);
492
+ }
493
+ if (newValue) {
494
+ plt.ael(elm, memberName, newValue, capture);
495
+ }
496
+ }
497
+ } else {
498
+ const isComplex = isComplexType(newValue);
499
+ if ((isProp || isComplex && newValue !== null) && true) {
500
+ try {
501
+ if (!elm.tagName.includes("-")) {
502
+ const n = newValue == null ? "" : newValue;
503
+ if (memberName === "list") {
504
+ isProp = false;
505
+ } else if (oldValue == null || elm[memberName] != n) {
506
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
507
+ elm[memberName] = n;
508
+ } else {
509
+ elm.setAttribute(memberName, n);
510
+ }
511
+ }
512
+ } else if (elm[memberName] !== newValue) {
513
+ elm[memberName] = newValue;
514
+ }
515
+ } catch (e) {
516
+ }
517
+ }
518
+ if (newValue == null || newValue === false) {
519
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
520
+ {
521
+ elm.removeAttribute(memberName);
522
+ }
523
+ }
524
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
525
+ newValue = newValue === true ? "" : newValue;
526
+ {
527
+ elm.setAttribute(memberName, newValue);
528
+ }
529
+ }
530
+ }
531
+ };
532
+ var parseClassListRegex = /\s/;
533
+ var parseClassList = (value) => {
534
+ if (typeof value === "object" && value && "baseVal" in value) {
535
+ value = value.baseVal;
536
+ }
537
+ if (!value || typeof value !== "string") {
538
+ return [];
539
+ }
540
+ return value.split(parseClassListRegex);
541
+ };
542
+ var CAPTURE_EVENT_SUFFIX = "Capture";
543
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
544
+
545
+ // src/runtime/vdom/update-element.ts
546
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
547
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
548
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
549
+ const newVnodeAttrs = newVnode.$attrs$ || {};
550
+ {
551
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
552
+ if (!(memberName in newVnodeAttrs)) {
553
+ setAccessor(
554
+ elm,
555
+ memberName,
556
+ oldVnodeAttrs[memberName],
557
+ void 0,
558
+ isSvgMode2,
559
+ newVnode.$flags$);
560
+ }
561
+ }
562
+ }
563
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
564
+ setAccessor(
565
+ elm,
566
+ memberName,
567
+ oldVnodeAttrs[memberName],
568
+ newVnodeAttrs[memberName],
569
+ isSvgMode2,
570
+ newVnode.$flags$);
571
+ }
572
+ };
573
+ function sortedAttrNames(attrNames) {
574
+ return attrNames.includes("ref") ? (
575
+ // we need to sort these to ensure that `'ref'` is the last attr
576
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
577
+ ) : (
578
+ // no need to sort, return the original array
579
+ attrNames
580
+ );
581
+ }
582
+ var hostTagName;
583
+ var isSvgMode = false;
584
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
585
+ const newVNode2 = newParentVNode.$children$[childIndex];
586
+ let i2 = 0;
587
+ let elm;
588
+ let childNode;
589
+ if (newVNode2.$text$ !== null) {
590
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
591
+ } else {
592
+ if (!win.document) {
593
+ throw new Error(
594
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
595
+ );
596
+ }
597
+ elm = newVNode2.$elm$ = win.document.createElement(
598
+ newVNode2.$tag$
599
+ );
600
+ {
601
+ updateElement(null, newVNode2, isSvgMode);
602
+ }
603
+ if (newVNode2.$children$) {
604
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
605
+ childNode = createElm(oldParentVNode, newVNode2, i2);
606
+ if (childNode) {
607
+ elm.appendChild(childNode);
608
+ }
609
+ }
610
+ }
611
+ }
612
+ elm["s-hn"] = hostTagName;
613
+ return elm;
614
+ };
615
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
616
+ let containerElm = parentElm;
617
+ let childNode;
618
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
619
+ containerElm = containerElm.shadowRoot;
620
+ }
621
+ for (; startIdx <= endIdx; ++startIdx) {
622
+ if (vnodes[startIdx]) {
623
+ childNode = createElm(null, parentVNode, startIdx);
624
+ if (childNode) {
625
+ vnodes[startIdx].$elm$ = childNode;
626
+ insertBefore(containerElm, childNode, before);
627
+ }
628
+ }
629
+ }
630
+ };
631
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
632
+ for (let index = startIdx; index <= endIdx; ++index) {
633
+ const vnode = vnodes[index];
634
+ if (vnode) {
635
+ const elm = vnode.$elm$;
636
+ if (elm) {
637
+ elm.remove();
638
+ }
639
+ }
640
+ }
641
+ };
642
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
643
+ let oldStartIdx = 0;
644
+ let newStartIdx = 0;
645
+ let idxInOld = 0;
646
+ let i2 = 0;
647
+ let oldEndIdx = oldCh.length - 1;
648
+ let oldStartVnode = oldCh[0];
649
+ let oldEndVnode = oldCh[oldEndIdx];
650
+ let newEndIdx = newCh.length - 1;
651
+ let newStartVnode = newCh[0];
652
+ let newEndVnode = newCh[newEndIdx];
653
+ let node;
654
+ let elmToMove;
655
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
656
+ if (oldStartVnode == null) {
657
+ oldStartVnode = oldCh[++oldStartIdx];
658
+ } else if (oldEndVnode == null) {
659
+ oldEndVnode = oldCh[--oldEndIdx];
660
+ } else if (newStartVnode == null) {
661
+ newStartVnode = newCh[++newStartIdx];
662
+ } else if (newEndVnode == null) {
663
+ newEndVnode = newCh[--newEndIdx];
664
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
665
+ patch(oldStartVnode, newStartVnode, isInitialRender);
666
+ oldStartVnode = oldCh[++oldStartIdx];
667
+ newStartVnode = newCh[++newStartIdx];
668
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
669
+ patch(oldEndVnode, newEndVnode, isInitialRender);
670
+ oldEndVnode = oldCh[--oldEndIdx];
671
+ newEndVnode = newCh[--newEndIdx];
672
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
673
+ patch(oldStartVnode, newEndVnode, isInitialRender);
674
+ insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
675
+ oldStartVnode = oldCh[++oldStartIdx];
676
+ newEndVnode = newCh[--newEndIdx];
677
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
678
+ patch(oldEndVnode, newStartVnode, isInitialRender);
679
+ insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
680
+ oldEndVnode = oldCh[--oldEndIdx];
681
+ newStartVnode = newCh[++newStartIdx];
682
+ } else {
683
+ idxInOld = -1;
684
+ {
685
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
686
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
687
+ idxInOld = i2;
688
+ break;
689
+ }
690
+ }
691
+ }
692
+ if (idxInOld >= 0) {
693
+ elmToMove = oldCh[idxInOld];
694
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
695
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
696
+ } else {
697
+ patch(elmToMove, newStartVnode, isInitialRender);
698
+ oldCh[idxInOld] = void 0;
699
+ node = elmToMove.$elm$;
700
+ }
701
+ newStartVnode = newCh[++newStartIdx];
702
+ } else {
703
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
704
+ newStartVnode = newCh[++newStartIdx];
705
+ }
706
+ if (node) {
707
+ {
708
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
709
+ }
710
+ }
711
+ }
712
+ }
713
+ if (oldStartIdx > oldEndIdx) {
714
+ addVnodes(
715
+ parentElm,
716
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
717
+ newVNode2,
718
+ newCh,
719
+ newStartIdx,
720
+ newEndIdx
721
+ );
722
+ } else if (newStartIdx > newEndIdx) {
723
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
724
+ }
725
+ };
726
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
727
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
728
+ if (!isInitialRender) {
729
+ return leftVNode.$key$ === rightVNode.$key$;
730
+ }
731
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
732
+ leftVNode.$key$ = rightVNode.$key$;
733
+ }
734
+ return true;
735
+ }
736
+ return false;
737
+ };
738
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
739
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
740
+ const oldChildren = oldVNode.$children$;
741
+ const newChildren = newVNode2.$children$;
742
+ const text = newVNode2.$text$;
743
+ if (text === null) {
744
+ {
745
+ updateElement(oldVNode, newVNode2, isSvgMode);
746
+ }
747
+ if (oldChildren !== null && newChildren !== null) {
748
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
749
+ } else if (newChildren !== null) {
750
+ if (oldVNode.$text$ !== null) {
751
+ elm.textContent = "";
752
+ }
753
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
754
+ } else if (
755
+ // don't do this on initial render as it can cause non-hydrated content to be removed
756
+ !isInitialRender && BUILD.updatable && oldChildren !== null
757
+ ) {
758
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
759
+ } else ;
760
+ } else if (oldVNode.$text$ !== text) {
761
+ elm.data = text;
762
+ }
763
+ };
764
+ var insertBefore = (parent, newNode, reference) => {
765
+ {
766
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
767
+ }
768
+ };
769
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
770
+ const hostElm = hostRef.$hostElement$;
771
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
772
+ const isHostElement = isHost(renderFnResults);
773
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
774
+ hostTagName = hostElm.tagName;
775
+ if (isInitialLoad && rootVnode.$attrs$) {
776
+ for (const key of Object.keys(rootVnode.$attrs$)) {
777
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
778
+ rootVnode.$attrs$[key] = hostElm[key];
779
+ }
780
+ }
781
+ }
782
+ rootVnode.$tag$ = null;
783
+ rootVnode.$flags$ |= 4 /* isHost */;
784
+ hostRef.$vnode$ = rootVnode;
785
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
786
+ patch(oldVNode, rootVnode, isInitialLoad);
787
+ };
788
+
789
+ // src/runtime/update-component.ts
790
+ var attachToAncestor = (hostRef, ancestorComponent) => {
791
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
792
+ const index = ancestorComponent["s-p"].push(
793
+ new Promise(
794
+ (r) => hostRef.$onRenderResolve$ = () => {
795
+ ancestorComponent["s-p"].splice(index - 1, 1);
796
+ r();
797
+ }
798
+ )
799
+ );
800
+ }
801
+ };
802
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
803
+ {
804
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
805
+ }
806
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
807
+ hostRef.$flags$ |= 512 /* needsRerender */;
808
+ return;
809
+ }
810
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
811
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
812
+ if (isInitialLoad) {
813
+ queueMicrotask(() => {
814
+ dispatch();
815
+ });
816
+ return;
817
+ }
818
+ return writeTask(dispatch) ;
819
+ };
820
+ var dispatchHooks = (hostRef, isInitialLoad) => {
821
+ const elm = hostRef.$hostElement$;
822
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
823
+ const instance = elm;
824
+ if (!instance) {
825
+ throw new Error(
826
+ `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`
827
+ );
828
+ }
829
+ let maybePromise;
830
+ if (isInitialLoad) {
831
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
832
+ } else {
833
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
834
+ }
835
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
836
+ endSchedule();
837
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
838
+ };
839
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
840
+ console.error(err2);
841
+ fn();
842
+ }) : fn();
843
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
844
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
845
+ var _a;
846
+ const elm = hostRef.$hostElement$;
847
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
848
+ const rc = elm["s-rc"];
849
+ if (isInitialLoad) {
850
+ attachStyles(hostRef);
851
+ }
852
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
853
+ {
854
+ callRender(hostRef, instance, elm, isInitialLoad);
855
+ }
856
+ if (rc) {
857
+ rc.map((cb) => cb());
858
+ elm["s-rc"] = void 0;
859
+ }
860
+ endRender();
861
+ endUpdate();
862
+ {
863
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
864
+ const postUpdate = () => postUpdateComponent(hostRef);
865
+ if (childrenPromises.length === 0) {
866
+ postUpdate();
867
+ } else {
868
+ Promise.all(childrenPromises).then(postUpdate);
869
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
870
+ childrenPromises.length = 0;
871
+ }
872
+ }
873
+ };
874
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
875
+ try {
876
+ instance = instance.render() ;
877
+ {
878
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
879
+ }
880
+ {
881
+ hostRef.$flags$ |= 2 /* hasRendered */;
882
+ }
883
+ {
884
+ {
885
+ {
886
+ renderVdom(hostRef, instance, isInitialLoad);
887
+ }
888
+ }
889
+ }
890
+ } catch (e) {
891
+ consoleError(e, hostRef.$hostElement$);
892
+ }
893
+ return null;
894
+ };
895
+ var postUpdateComponent = (hostRef) => {
896
+ const tagName = hostRef.$cmpMeta$.$tagName$;
897
+ const elm = hostRef.$hostElement$;
898
+ const endPostUpdate = createTime("postUpdate", tagName);
899
+ const instance = elm;
900
+ const ancestorComponent = hostRef.$ancestorComponent$;
901
+ safeCall(instance, "componentDidRender", void 0, elm);
902
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
903
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
904
+ {
905
+ addHydratedFlag(elm);
906
+ }
907
+ safeCall(instance, "componentDidLoad", void 0, elm);
908
+ endPostUpdate();
909
+ {
910
+ hostRef.$onReadyResolve$(elm);
911
+ if (!ancestorComponent) {
912
+ appDidLoad();
913
+ }
914
+ }
915
+ } else {
916
+ safeCall(instance, "componentDidUpdate", void 0, elm);
917
+ endPostUpdate();
918
+ }
919
+ {
920
+ if (hostRef.$onRenderResolve$) {
921
+ hostRef.$onRenderResolve$();
922
+ hostRef.$onRenderResolve$ = void 0;
923
+ }
924
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
925
+ nextTick(() => scheduleUpdate(hostRef, false));
926
+ }
927
+ hostRef.$flags$ &= -517;
928
+ }
929
+ };
930
+ var appDidLoad = (who) => {
931
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
932
+ };
933
+ var safeCall = (instance, method, arg, elm) => {
934
+ if (instance && instance[method]) {
935
+ try {
936
+ return instance[method](arg);
937
+ } catch (e) {
938
+ consoleError(e, elm);
939
+ }
940
+ }
941
+ return void 0;
942
+ };
943
+ var addHydratedFlag = (elm) => {
944
+ var _a;
945
+ return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
946
+ };
947
+
948
+ // src/runtime/set-value.ts
949
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
950
+ var setValue = (ref, propName, newVal, cmpMeta) => {
951
+ const hostRef = getHostRef(ref);
952
+ if (!hostRef) {
953
+ return;
954
+ }
955
+ const elm = ref;
956
+ const oldVal = hostRef.$instanceValues$.get(propName);
957
+ const flags = hostRef.$flags$;
958
+ const instance = elm;
959
+ newVal = parsePropertyValue(
960
+ newVal,
961
+ cmpMeta.$members$[propName][0]);
962
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
963
+ const didValueChange = newVal !== oldVal && !areBothNaN;
964
+ if (didValueChange) {
965
+ hostRef.$instanceValues$.set(propName, newVal);
966
+ {
967
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
968
+ if (instance.componentShouldUpdate) {
969
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
970
+ return;
971
+ }
972
+ }
973
+ scheduleUpdate(hostRef, false);
974
+ }
975
+ }
976
+ }
977
+ };
978
+
979
+ // src/runtime/proxy-component.ts
980
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
981
+ var _a, _b;
982
+ const prototype = Cstr.prototype;
983
+ if (cmpMeta.$members$ || BUILD.watchCallback) {
984
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
985
+ members.map(([memberName, [memberFlags]]) => {
986
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
987
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
988
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
989
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
990
+ {
991
+ Object.defineProperty(prototype, memberName, {
992
+ get() {
993
+ {
994
+ return origGetter ? origGetter.apply(this) : getValue(this, memberName);
995
+ }
996
+ },
997
+ configurable: true,
998
+ enumerable: true
999
+ });
1000
+ }
1001
+ Object.defineProperty(prototype, memberName, {
1002
+ set(newValue) {
1003
+ const ref = getHostRef(this);
1004
+ if (!ref) {
1005
+ return;
1006
+ }
1007
+ if (origSetter) {
1008
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1009
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1010
+ newValue = ref.$instanceValues$.get(memberName);
1011
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
1012
+ ref.$instanceValues$.set(memberName, currentValue);
1013
+ }
1014
+ origSetter.apply(this, [
1015
+ parsePropertyValue(
1016
+ newValue,
1017
+ memberFlags)
1018
+ ]);
1019
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1020
+ setValue(this, memberName, newValue, cmpMeta);
1021
+ return;
1022
+ }
1023
+ {
1024
+ setValue(this, memberName, newValue, cmpMeta);
1025
+ return;
1026
+ }
1027
+ }
1028
+ });
1029
+ }
1030
+ });
1031
+ {
1032
+ const attrNameToPropName = /* @__PURE__ */ new Map();
1033
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
1034
+ plt.jmp(() => {
1035
+ var _a2;
1036
+ const propName = attrNameToPropName.get(attrName);
1037
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) ; else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1038
+ this[propName] == newValue) {
1039
+ return;
1040
+ } else if (propName == null) {
1041
+ const hostRef = getHostRef(this);
1042
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1043
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
1044
+ const elm = this;
1045
+ const instance = elm;
1046
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1047
+ entry == null ? void 0 : entry.forEach((callbackName) => {
1048
+ if (instance[callbackName] != null) {
1049
+ instance[callbackName].call(instance, newValue, oldValue, attrName);
1050
+ }
1051
+ });
1052
+ }
1053
+ return;
1054
+ }
1055
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1056
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1057
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
1058
+ this[propName] = newValue;
1059
+ }
1060
+ });
1061
+ };
1062
+ Cstr.observedAttributes = Array.from(
1063
+ /* @__PURE__ */ new Set([
1064
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1065
+ ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
1066
+ const attrName = m[1] || propName;
1067
+ attrNameToPropName.set(attrName, propName);
1068
+ return attrName;
1069
+ })
1070
+ ])
1071
+ );
1072
+ }
1073
+ }
1074
+ return Cstr;
1075
+ };
1076
+
1077
+ // src/runtime/initialize-component.ts
1078
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1079
+ let Cstr;
1080
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1081
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1082
+ {
1083
+ Cstr = elm.constructor;
1084
+ const cmpTag = elm.localName;
1085
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1086
+ }
1087
+ if (Cstr && Cstr.style) {
1088
+ let style;
1089
+ if (typeof Cstr.style === "string") {
1090
+ style = Cstr.style;
1091
+ }
1092
+ const scopeId2 = getScopeId(cmpMeta);
1093
+ if (!styles.has(scopeId2)) {
1094
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1095
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1096
+ endRegisterStyles();
1097
+ }
1098
+ }
1099
+ }
1100
+ const ancestorComponent = hostRef.$ancestorComponent$;
1101
+ const schedule = () => scheduleUpdate(hostRef, true);
1102
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
1103
+ ancestorComponent["s-rc"].push(schedule);
1104
+ } else {
1105
+ schedule();
1106
+ }
1107
+ };
1108
+ var fireConnectedCallback = (instance, elm) => {
1109
+ };
1110
+
1111
+ // src/runtime/connected-callback.ts
1112
+ var connectedCallback = (elm) => {
1113
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1114
+ const hostRef = getHostRef(elm);
1115
+ if (!hostRef) {
1116
+ return;
1117
+ }
1118
+ const cmpMeta = hostRef.$cmpMeta$;
1119
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1120
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1121
+ hostRef.$flags$ |= 1 /* hasConnected */;
1122
+ {
1123
+ let ancestorComponent = elm;
1124
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1125
+ if (ancestorComponent["s-p"]) {
1126
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1127
+ break;
1128
+ }
1129
+ }
1130
+ }
1131
+ if (cmpMeta.$members$) {
1132
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1133
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1134
+ const value = elm[memberName];
1135
+ delete elm[memberName];
1136
+ elm[memberName] = value;
1137
+ }
1138
+ });
1139
+ }
1140
+ if (BUILD.initializeNextTick) {
1141
+ nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
1142
+ } else {
1143
+ initializeComponent(elm, hostRef, cmpMeta);
1144
+ }
1145
+ } else {
1146
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1147
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1148
+ }
1149
+ }
1150
+ endConnected();
1151
+ }
1152
+ };
1153
+ var disconnectedCallback = async (elm) => {
1154
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1155
+ getHostRef(elm);
1156
+ }
1157
+ if (rootAppliedStyles.has(elm)) {
1158
+ rootAppliedStyles.delete(elm);
1159
+ }
1160
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
1161
+ rootAppliedStyles.delete(elm.shadowRoot);
1162
+ }
1163
+ };
1164
+ var proxyCustomElement = (Cstr, compactMeta) => {
1165
+ const cmpMeta = {
1166
+ $flags$: compactMeta[0],
1167
+ $tagName$: compactMeta[1]
1168
+ };
1169
+ {
1170
+ cmpMeta.$members$ = compactMeta[2];
1171
+ }
1172
+ {
1173
+ {
1174
+ patchChildSlotNodes(Cstr.prototype);
1175
+ }
1176
+ }
1177
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
1178
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
1179
+ Object.assign(Cstr.prototype, {
1180
+ __hasHostListenerAttached: false,
1181
+ __registerHost() {
1182
+ registerHost(this, cmpMeta);
1183
+ },
1184
+ connectedCallback() {
1185
+ if (!this.__hasHostListenerAttached) {
1186
+ const hostRef = getHostRef(this);
1187
+ if (!hostRef) {
1188
+ return;
1189
+ }
1190
+ this.__hasHostListenerAttached = true;
1191
+ }
1192
+ connectedCallback(this);
1193
+ if (originalConnectedCallback) {
1194
+ originalConnectedCallback.call(this);
1195
+ }
1196
+ },
1197
+ disconnectedCallback() {
1198
+ disconnectedCallback(this);
1199
+ if (originalDisconnectedCallback) {
1200
+ originalDisconnectedCallback.call(this);
1201
+ }
1202
+ },
1203
+ __attachShadow() {
1204
+ {
1205
+ if (!this.shadowRoot) {
1206
+ createShadowRoot.call(this, cmpMeta);
1207
+ } else {
1208
+ if (this.shadowRoot.mode !== "open") {
1209
+ throw new Error(
1210
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
1211
+ );
1212
+ }
1213
+ }
1214
+ }
1215
+ }
1216
+ });
1217
+ Cstr.is = cmpMeta.$tagName$;
1218
+ return proxyComponent(Cstr, cmpMeta);
1219
+ };
1220
+
1221
+ // src/runtime/nonce.ts
1222
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
1223
+
1224
+ // src/runtime/platform-options.ts
1225
+ var setPlatformOptions = (opts) => Object.assign(plt, opts);
1226
+
1227
+ // src/runtime/render.ts
1228
+ function render(vnode, container) {
1229
+ const ref = {
1230
+ $hostElement$: container
1231
+ };
1232
+ renderVdom(ref, vnode);
1233
+ }
1234
+
1235
+ /**
1236
+ * Utility functions for sf-fastpoll
1237
+ */
1238
+ /**
1239
+ * Maximum allowed length for text inputs
1240
+ */
1241
+ const MAX_TEXT_LENGTH = 500;
1242
+ const MAX_EMAIL_LENGTH = 254;
1243
+ /**
1244
+ * Sanitize user input to prevent XSS and limit length
1245
+ * @param input The raw user input
1246
+ * @param maxLength Maximum allowed length (default: 500)
1247
+ * @returns Sanitized string
1248
+ */
1249
+ function sanitizeInput(input, maxLength = MAX_TEXT_LENGTH) {
1250
+ if (typeof input !== 'string') {
1251
+ return '';
1252
+ }
1253
+ // Trim whitespace
1254
+ let sanitized = input.replace(/^\s+|\s+$/g, '');
1255
+ // Remove null bytes
1256
+ sanitized = sanitized.replace(/\0/g, '');
1257
+ // Encode HTML entities to prevent XSS
1258
+ sanitized = sanitized.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;');
1259
+ // Truncate to max length
1260
+ if (sanitized.length > maxLength) {
1261
+ sanitized = sanitized.substring(0, maxLength);
1262
+ }
1263
+ return sanitized;
1264
+ }
1265
+ /**
1266
+ * Sanitize email input with email-specific rules
1267
+ * @param email The raw email input
1268
+ * @returns Sanitized email string
1269
+ */
1270
+ function sanitizeEmail(email) {
1271
+ if (typeof email !== 'string') {
1272
+ return '';
1273
+ }
1274
+ // Trim and lowercase
1275
+ let sanitized = email.replace(/^\s+|\s+$/g, '').toLowerCase();
1276
+ // Remove null bytes and control characters
1277
+ sanitized = sanitized.replace(/[\0\x00-\x1F\x7F]/g, '');
1278
+ // Truncate to max email length (RFC 5321)
1279
+ if (sanitized.length > MAX_EMAIL_LENGTH) {
1280
+ sanitized = sanitized.substring(0, MAX_EMAIL_LENGTH);
1281
+ }
1282
+ return sanitized;
1283
+ }
1284
+ /**
1285
+ * Sanitize a value based on field type
1286
+ * @param value The raw value
1287
+ * @param inputType The type of input field
1288
+ * @returns Sanitized value
1289
+ */
1290
+ function sanitizeByType(value, inputType) {
1291
+ switch (inputType) {
1292
+ case 'email':
1293
+ return sanitizeEmail(value);
1294
+ case 'number':
1295
+ // Only allow digits, decimal point, and minus sign
1296
+ const numStr = String(value).replace(/[^0-9.\-]/g, '');
1297
+ return numStr.substring(0, 20); // Reasonable max for numbers
1298
+ case 'dropdown':
1299
+ case 'radio':
1300
+ // For select/radio, sanitize but be more permissive (values come from config)
1301
+ return sanitizeInput(value, 100);
1302
+ case 'checkbox':
1303
+ // Checkbox values are comma-separated, sanitize each
1304
+ return value
1305
+ .split(',')
1306
+ .map(v => sanitizeInput(v.replace(/^\s+|\s+$/g, ''), 100))
1307
+ .join(', ');
1308
+ default:
1309
+ return sanitizeInput(value);
1310
+ }
1311
+ }
1312
+ /**
1313
+ * Check if a survey key is valid UUID
1314
+ * @param key The survey key to validate
1315
+ * @returns True if the key is a valid UUID, false otherwise
1316
+ */
1317
+ function isValidKey(key) {
1318
+ if (typeof key !== 'string' || key.trim().length === 0) {
1319
+ return false;
1320
+ }
1321
+ // UUID v4 regex pattern
1322
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
1323
+ return uuidRegex.test(key.trim());
1324
+ }
1325
+ /**
1326
+ * Format error messages for display
1327
+ * @param error The error object or message
1328
+ * @returns A formatted error message string
1329
+ */
1330
+ function formatErrorMessage(error) {
1331
+ if (typeof error === 'string') {
1332
+ return error;
1333
+ }
1334
+ if (error instanceof Error) {
1335
+ return error.message;
1336
+ }
1337
+ return 'An unknown error occurred';
1338
+ }
1339
+ /**
1340
+ * Browser-compatible helper to check if array contains a value
1341
+ * @param array The array to search
1342
+ * @param value The value to find
1343
+ * @returns true if value is found in array
1344
+ */
1345
+ function arrayContains(array, value) {
1346
+ for (let i = 0; i < array.length; i++) {
1347
+ if (array[i] === value) {
1348
+ return true;
1349
+ }
1350
+ }
1351
+ return false;
1352
+ }
1353
+ /**
1354
+ * Browser-compatible helper to trim and split comma-separated values
1355
+ * @param value The comma-separated string
1356
+ * @returns Array of trimmed values
1357
+ */
1358
+ function parseCommaSeparatedValues(value) {
1359
+ if (!value) {
1360
+ return [];
1361
+ }
1362
+ const parts = value.split(',');
1363
+ const result = [];
1364
+ for (let i = 0; i < parts.length; i++) {
1365
+ const trimmed = parts[i].replace(/^\s+|\s+$/g, ''); // Manual trim for IE compatibility
1366
+ if (trimmed) {
1367
+ result.push(trimmed);
1368
+ }
1369
+ }
1370
+ return result;
1371
+ }
1372
+ /**
1373
+ * Get field configuration for rendering
1374
+ * @param detail The respondent detail configuration
1375
+ * @param value The current value of the field
1376
+ * @returns Field configuration object
1377
+ */
1378
+ function getFieldConfig(detail, value) {
1379
+ const inputType = detail.inputType || 'text';
1380
+ const placeholder = detail.placeholder || 'Enter your ' + detail.label.toLowerCase();
1381
+ const required = detail.required !== false;
1382
+ return {
1383
+ inputType: inputType,
1384
+ placeholder: placeholder,
1385
+ required: required,
1386
+ options: detail.options || [],
1387
+ defaultValue: detail.defaultValue,
1388
+ hasOptions: detail.options && detail.options.length > 0,
1389
+ selectedValues: parseCommaSeparatedValues(value),
1390
+ fieldValue: detail.value,
1391
+ currentValue: value || '',
1392
+ };
1393
+ }
1394
+ /**
1395
+ * Browser-compatible helper to add value to comma-separated list
1396
+ * @param currentValue The current comma-separated string
1397
+ * @param valueToAdd The value to add
1398
+ * @returns Updated comma-separated string
1399
+ */
1400
+ function addToCommaSeparatedList(currentValue, valueToAdd) {
1401
+ const values = parseCommaSeparatedValues(currentValue);
1402
+ if (!arrayContains(values, valueToAdd)) {
1403
+ values.push(valueToAdd);
1404
+ }
1405
+ return values.join(', ');
1406
+ }
1407
+ /**
1408
+ * Browser-compatible helper to remove value from comma-separated list
1409
+ * @param currentValue The current comma-separated string
1410
+ * @param valueToRemove The value to remove
1411
+ * @returns Updated comma-separated string
1412
+ */
1413
+ function removeFromCommaSeparatedList(currentValue, valueToRemove) {
1414
+ const values = parseCommaSeparatedValues(currentValue);
1415
+ const result = [];
1416
+ for (let i = 0; i < values.length; i++) {
1417
+ if (values[i] !== valueToRemove) {
1418
+ result.push(values[i]);
1419
+ }
1420
+ }
1421
+ return result.join(', ');
1422
+ }
1423
+
1424
+ export { Env as E, H, addToCommaSeparatedList as a, sanitizeByType as b, Host as c, formatErrorMessage, getFieldConfig as g, getAssetPath, h, isValidKey, proxyCustomElement as p, removeFromCommaSeparatedList as r, render, sanitizeInput as s, setAssetPath, setNonce, setPlatformOptions };
1425
+ //# sourceMappingURL=index.js.map
1426
+
1427
+ //# sourceMappingURL=index.js.map