sproutjs-core 2.5.0 → 2.7.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.
@@ -0,0 +1,3864 @@
1
+ (() => {
2
+ "use strict";
3
+ function _typeof(o) {
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5
+ return typeof o;
6
+ } : function(o) {
7
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
8
+ }, _typeof(o);
9
+ }
10
+ function _defineProperties(e, r) {
11
+ for (var t = 0; t < r.length; t++) {
12
+ var o = r[t];
13
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
14
+ Object.defineProperty(e, _toPropertyKey(o.key), o);
15
+ }
16
+ }
17
+ function _toPropertyKey(t) {
18
+ var i = function _toPrimitive(t, r) {
19
+ if ("object" != _typeof(t) || !t) return t;
20
+ var e = t[Symbol.toPrimitive];
21
+ if (void 0 !== e) {
22
+ var i = e.call(t, r || "default");
23
+ if ("object" != _typeof(i)) return i;
24
+ throw new TypeError("@@toPrimitive must return a primitive value.");
25
+ }
26
+ return ("string" === r ? String : Number)(t);
27
+ }(t, "string");
28
+ return "symbol" == _typeof(i) ? i : i + "";
29
+ }
30
+ function _wrapNativeSuper(t) {
31
+ var r = "function" == typeof Map ? new Map : void 0;
32
+ return _wrapNativeSuper = function _wrapNativeSuper(t) {
33
+ if (null === t || !function _isNativeFunction(t) {
34
+ try {
35
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
36
+ } catch (n) {
37
+ return "function" == typeof t;
38
+ }
39
+ }(t)) return t;
40
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
41
+ if (void 0 !== r) {
42
+ if (r.has(t)) return r.get(t);
43
+ r.set(t, Wrapper);
44
+ }
45
+ function Wrapper() {
46
+ return function _construct(t, e, r) {
47
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
48
+ var o = [ null ];
49
+ o.push.apply(o, e);
50
+ var p = new (t.bind.apply(t, o));
51
+ return r && _setPrototypeOf(p, r.prototype), p;
52
+ }(t, arguments, _getPrototypeOf(this).constructor);
53
+ }
54
+ return Wrapper.prototype = Object.create(t.prototype, {
55
+ constructor: {
56
+ value: Wrapper,
57
+ enumerable: !1,
58
+ writable: !0,
59
+ configurable: !0
60
+ }
61
+ }), _setPrototypeOf(Wrapper, t);
62
+ }, _wrapNativeSuper(t);
63
+ }
64
+ function _isNativeReflectConstruct() {
65
+ try {
66
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
67
+ } catch (t) {}
68
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
69
+ return !!t;
70
+ })();
71
+ }
72
+ function _setPrototypeOf(t, e) {
73
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
74
+ return t.__proto__ = e, t;
75
+ }, _setPrototypeOf(t, e);
76
+ }
77
+ function _getPrototypeOf(t) {
78
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
79
+ return t.__proto__ || Object.getPrototypeOf(t);
80
+ }, _getPrototypeOf(t);
81
+ }
82
+ var ReadonlySet = function(_Set) {
83
+ function ReadonlySet(iterable) {
84
+ var _this;
85
+ return function _classCallCheck(a, n) {
86
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
87
+ }(this, ReadonlySet), (_this = function _callSuper(t, o, e) {
88
+ return o = _getPrototypeOf(o), function _possibleConstructorReturn(t, e) {
89
+ if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
90
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
91
+ return function _assertThisInitialized(e) {
92
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
93
+ return e;
94
+ }(t);
95
+ }(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
96
+ }(this, ReadonlySet, [ iterable ])).add = function() {
97
+ return ReadonlySet.unavailableMethod("add");
98
+ }, _this;
99
+ }
100
+ return function _inherits(t, e) {
101
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
102
+ t.prototype = Object.create(e && e.prototype, {
103
+ constructor: {
104
+ value: t,
105
+ writable: !0,
106
+ configurable: !0
107
+ }
108
+ }), Object.defineProperty(t, "prototype", {
109
+ writable: !1
110
+ }), e && _setPrototypeOf(t, e);
111
+ }(ReadonlySet, _Set), function _createClass(e, r, t) {
112
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
113
+ writable: !1
114
+ }), e;
115
+ }(ReadonlySet, [ {
116
+ key: "delete",
117
+ value: function _delete() {
118
+ ReadonlySet.unavailableMethod("delete");
119
+ }
120
+ }, {
121
+ key: "clear",
122
+ value: function clear() {
123
+ ReadonlySet.unavailableMethod("clear");
124
+ }
125
+ } ], [ {
126
+ key: "unavailableMethod",
127
+ value: function unavailableMethod(methodName) {
128
+ throw Error("Can't use ".concat(methodName, " in ReadonlySet"));
129
+ }
130
+ } ]);
131
+ }(_wrapNativeSuper(Set)), OBSERVED_ATTRIBUTES = [ "ref", "hidden" ], BOOLEAN_ATTRIBUTES = new ReadonlySet([ "hidden", "checked", "disabled", "required", "selected" ]), AUTO_ATTRIBUTES_TO_PROPS = new ReadonlySet([ "checked", "disabled", "selected", "src" ]), SUPPORTED_ATTRIBUTES_FOR_BINDING = new ReadonlySet([ "value", "checked" ]), BUILT_IN_STATE_PROPS = new ReadonlySet([ "_global", "_gettingDependenciesFor", "_localStateManager", "_stateManager", "_binding", "_populate", "_isActive", "_isStateManager", "_isStatefulArray", "hasOwnProperty" ]), GLOBAL_STATE_NOT_SET_YET = "Global State Not Set Yet", HTML_ELEMENT_CLASSES_MAP = (Object.freeze({
132
+ NO_DEPENDENCIES_ARRAY_IN_SET_HOOK: function NO_DEPENDENCIES_ARRAY_IN_SET_HOOK(stateProp) {
133
+ return "State set hook, must include a dependencies array! None was found for ".concat(stateProp);
134
+ }
135
+ }), Object.freeze([ {
136
+ class: HTMLAnchorElement,
137
+ element: "a"
138
+ }, {
139
+ class: HTMLAreaElement,
140
+ element: "area"
141
+ }, {
142
+ class: HTMLAudioElement,
143
+ element: "audio"
144
+ }, {
145
+ class: HTMLBodyElement,
146
+ element: "body"
147
+ }, {
148
+ class: HTMLBRElement,
149
+ element: "br"
150
+ }, {
151
+ class: HTMLButtonElement,
152
+ element: "button"
153
+ }, {
154
+ class: HTMLCanvasElement,
155
+ element: "canvas"
156
+ }, {
157
+ class: HTMLDataElement,
158
+ element: "data"
159
+ }, {
160
+ class: HTMLDataListElement,
161
+ element: "datalist"
162
+ }, {
163
+ class: HTMLDetailsElement,
164
+ element: "details"
165
+ }, {
166
+ class: HTMLDialogElement,
167
+ element: "dialog"
168
+ }, {
169
+ class: HTMLDivElement,
170
+ element: "div"
171
+ }, {
172
+ class: HTMLDListElement,
173
+ element: "dl"
174
+ }, {
175
+ class: HTMLEmbedElement,
176
+ element: "embed"
177
+ }, {
178
+ class: HTMLFieldSetElement,
179
+ element: "fieldset"
180
+ }, {
181
+ class: HTMLFormElement,
182
+ element: "form"
183
+ }, {
184
+ class: HTMLHRElement,
185
+ element: "hr"
186
+ }, {
187
+ class: HTMLHtmlElement,
188
+ element: "html"
189
+ }, {
190
+ class: HTMLIFrameElement,
191
+ element: "iframe"
192
+ }, {
193
+ class: HTMLImageElement,
194
+ element: "img"
195
+ }, {
196
+ class: HTMLLabelElement,
197
+ element: "label"
198
+ }, {
199
+ class: HTMLLegendElement,
200
+ element: "legend"
201
+ }, {
202
+ class: HTMLLIElement,
203
+ element: "li"
204
+ }, {
205
+ class: HTMLLinkElement,
206
+ element: "link"
207
+ }, {
208
+ class: HTMLMapElement,
209
+ element: "map"
210
+ }, {
211
+ class: HTMLMetaElement,
212
+ element: "meta"
213
+ }, {
214
+ class: HTMLMeterElement,
215
+ element: "meter"
216
+ }, {
217
+ class: HTMLObjectElement,
218
+ element: "object"
219
+ }, {
220
+ class: HTMLOListElement,
221
+ element: "ol"
222
+ }, {
223
+ class: HTMLOptGroupElement,
224
+ element: "optgroup"
225
+ }, {
226
+ class: HTMLOptionElement,
227
+ element: "option"
228
+ }, {
229
+ class: HTMLParagraphElement,
230
+ element: "p"
231
+ }, {
232
+ class: HTMLPictureElement,
233
+ element: "picture"
234
+ }, {
235
+ class: HTMLPreElement,
236
+ element: "pre"
237
+ }, {
238
+ class: HTMLProgressElement,
239
+ element: "progress"
240
+ }, {
241
+ class: HTMLQuoteElement,
242
+ element: "blockquote"
243
+ }, {
244
+ class: HTMLQuoteElement,
245
+ element: "q"
246
+ }, {
247
+ class: HTMLSelectElement,
248
+ element: "select"
249
+ }, {
250
+ class: HTMLSourceElement,
251
+ element: "source"
252
+ }, {
253
+ class: HTMLSpanElement,
254
+ element: "span"
255
+ }, {
256
+ class: HTMLTableElement,
257
+ element: "table"
258
+ }, {
259
+ class: HTMLTableCellElement,
260
+ element: "td"
261
+ }, {
262
+ class: HTMLTableCellElement,
263
+ element: "th"
264
+ }, {
265
+ class: HTMLTableRowElement,
266
+ element: "tr"
267
+ }, {
268
+ class: HTMLTableSectionElement,
269
+ element: "thead"
270
+ }, {
271
+ class: HTMLTableSectionElement,
272
+ element: "tbody"
273
+ }, {
274
+ class: HTMLTableSectionElement,
275
+ element: "tfoot"
276
+ }, {
277
+ class: HTMLTextAreaElement,
278
+ element: "textarea"
279
+ }, {
280
+ class: HTMLTimeElement,
281
+ element: "time"
282
+ }, {
283
+ class: HTMLTitleElement,
284
+ element: "title"
285
+ }, {
286
+ class: HTMLTrackElement,
287
+ element: "track"
288
+ }, {
289
+ class: HTMLUListElement,
290
+ element: "ul"
291
+ }, {
292
+ class: HTMLVideoElement,
293
+ element: "video"
294
+ }, {
295
+ class: HTMLSlotElement,
296
+ element: "slot"
297
+ } ])), DEFAULT_TEMPLATE_DOM = document.createElement("div"), NODES_STATE = {
298
+ nodeActionsMap: new Map,
299
+ pendingPaintNodeManagers: new Set,
300
+ eventBindingFunctions: new Map,
301
+ conditionalRenders: new Map,
302
+ stateChangeHandlers: new Map,
303
+ paintRafId: null
304
+ }, ARRAY_MUTATE_METHODS = (new ReadonlySet([ "==", "===", "!=", "!==", "<", "<=", ">", ">=" ]),
305
+ new ReadonlySet([ "shift", "unshift", "pop", "push", "reverse", "sort", "splice", "copyWithin", "fill" ])), ARRAY_MUTATE_NO_LENGTH_CHANGE_METHODS = new ReadonlySet([ "reverse", "sort", "copyWithin", "fill" ]), ARRAY_DERIVE_METHODS = new ReadonlySet([ "slice", "map", "filter", "reduce", "reduceRight", "some", "every", "forEach", "find", "findIndex", "findLast", "findLastIndex", "indexOf", "lastIndexOf", "includes", "entries", "keys", "values", "at", "join", "toString", "toLocaleString" ]), ARRAY_CACHE_METHODS = new ReadonlySet([ "every", "some", "filter", "forEach", "map", "reduce", "reduceRight", "slice" ]), SYMBOL_NAMES_STATE_NOT_FOUND = "SPROUT_STATE_NOT_FOUND", BINDABLE_ATTRIBUTES_TO_STATE_NODES = new ReadonlySet([ "checked", "value" ]), SPROUT_FROZEN_CLASS_CSS = "\n .".concat("sprout-frozen", " {\n clip-path: inset(100%);\n pointer-events: none;\n opacity: 0;\n }\n"), DETACH_METHOD = Object.freeze({
306
+ HIDE_UNHIDE: 1,
307
+ CLONE: 2
308
+ }), MAX_OPERATIONS_PER_ANIMATION_FRAME = 100, MAX_DOM_ACTIONS_PER_FRAME = {
309
+ ATTRIBUTE_ACTIONS: 600,
310
+ TEXT_ACTIONS: 300,
311
+ ELEMENT_ACTIONS: 100,
312
+ PROPERTY_ACTIONS: 50,
313
+ REATTACH_ACTIONS: 10
314
+ }, FRAME_BUDGET = 8;
315
+ function isElementAList(element) {
316
+ return "OL" === element.tagName || "UL" === element.tagName;
317
+ }
318
+ function _unsupportedIterableToArray(r, a) {
319
+ if (r) {
320
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
321
+ var t = {}.toString.call(r).slice(8, -1);
322
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
323
+ }
324
+ }
325
+ function _arrayLikeToArray(r, a) {
326
+ (null == a || a > r.length) && (a = r.length);
327
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
328
+ return n;
329
+ }
330
+ var pendingPaintNodeManagers = NODES_STATE.pendingPaintNodeManagers, rafIds = new Map;
331
+ function queueAnimationFrame(functionsToRun, type, afterRunFn) {
332
+ var rafId;
333
+ if (rafIds.has(type) && (rafId = rafIds.get(type), cancelAnimationFrame(rafId)),
334
+ functionsToRun.length < MAX_OPERATIONS_PER_ANIMATION_FRAME) rafId = requestAnimationFrame((function() {
335
+ rafIds.delete(type), functionsToRun.forEach((function(fn) {
336
+ return fn();
337
+ })), afterRunFn && afterRunFn();
338
+ })), rafIds.set(type, rafId); else {
339
+ rafIds.delete(type);
340
+ var functions = function _toConsumableArray(r) {
341
+ return function _arrayWithoutHoles(r) {
342
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
343
+ }(r) || function _iterableToArray(r) {
344
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
345
+ }(r) || _unsupportedIterableToArray(r) || function _nonIterableSpread() {
346
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
347
+ }();
348
+ }(functionsToRun), functionsIndex = 0;
349
+ requestAnimationFrame((function runNextBatch() {
350
+ functions.slice(functionsIndex, functionsIndex + MAX_OPERATIONS_PER_ANIMATION_FRAME).forEach((function(fn) {
351
+ return fn();
352
+ })), (functionsIndex += MAX_OPERATIONS_PER_ANIMATION_FRAME) < functions.length && requestAnimationFrame(runNextBatch);
353
+ }));
354
+ }
355
+ }
356
+ var paintRafId = NODES_STATE.paintRafId, conditionalRenders = NODES_STATE.conditionalRenders;
357
+ function queueConditionalRender(element, renderFunction) {
358
+ conditionalRenders.set(element, renderFunction), queueAnimationFrame(Array.from(conditionalRenders.values()), "CONDITIONAL_RENDER", (function() {
359
+ return conditionalRenders.clear();
360
+ }));
361
+ }
362
+ function paint_utils_queuePaint() {
363
+ paintRafId && cancelAnimationFrame(paintRafId), paintRafId = requestAnimationFrame((function() {
364
+ paintRafId = null, doUpdateDOM();
365
+ }));
366
+ }
367
+ function runDOMActions(actions) {
368
+ actions.forEach((function(action) {
369
+ return action();
370
+ }));
371
+ }
372
+ function doUpdateDOM(pendingNodeManagers) {
373
+ var _step, r, e, start = performance.now(), frameElapsed = 0, _iterator = function _createForOfIteratorHelper(r, e) {
374
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
375
+ if (!t) {
376
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
377
+ t && (r = t);
378
+ var _n = 0, F = function F() {};
379
+ return {
380
+ s: F,
381
+ n: function n() {
382
+ return _n >= r.length ? {
383
+ done: !0
384
+ } : {
385
+ done: !1,
386
+ value: r[_n++]
387
+ };
388
+ },
389
+ e: function e(r) {
390
+ throw r;
391
+ },
392
+ f: F
393
+ };
394
+ }
395
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
396
+ }
397
+ var o, a = !0, u = !1;
398
+ return {
399
+ s: function s() {
400
+ t = t.call(r);
401
+ },
402
+ n: function n() {
403
+ var r = t.next();
404
+ return a = r.done, r;
405
+ },
406
+ e: function e(r) {
407
+ u = !0, o = r;
408
+ },
409
+ f: function f() {
410
+ try {
411
+ a || null == t.return || t.return();
412
+ } finally {
413
+ if (u) throw o;
414
+ }
415
+ }
416
+ };
417
+ }(pendingPaintNodeManagers);
418
+ try {
419
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
420
+ var nodeManager = _step.value, _nodeManager$resolveT2 = (r = nodeManager.resolveToDOMActions(),
421
+ e = 5, function _arrayWithHoles(r) {
422
+ if (Array.isArray(r)) return r;
423
+ }(r) || function _iterableToArrayLimit(r, l) {
424
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
425
+ if (null != t) {
426
+ var e, n, i, u, a = [], f = !0, o = !1;
427
+ try {
428
+ if (i = (t = t.call(r)).next, 0 === l) {
429
+ if (Object(t) !== t) return;
430
+ f = !1;
431
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
432
+ } catch (r) {
433
+ o = !0, n = r;
434
+ } finally {
435
+ try {
436
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
437
+ } finally {
438
+ if (o) throw n;
439
+ }
440
+ }
441
+ return a;
442
+ }
443
+ }(r, e) || _unsupportedIterableToArray(r, e) || function _nonIterableRest() {
444
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
445
+ }()), attributeActions = _nodeManager$resolveT2[0], textActions = _nodeManager$resolveT2[1], propertySetActions = _nodeManager$resolveT2[2], elementActions = _nodeManager$resolveT2[3], reattachActions = _nodeManager$resolveT2[4];
446
+ if (runDOMActions(reattachActions.slice(0, MAX_DOM_ACTIONS_PER_FRAME.REATTACH_ACTIONS)),
447
+ (frameElapsed = performance.now() - start) > FRAME_BUDGET) return requestAnimationFrame((function() {
448
+ return doUpdateDOM();
449
+ }));
450
+ if (runDOMActions(elementActions.slice(0, MAX_DOM_ACTIONS_PER_FRAME.ELEMENT_ACTIONS)),
451
+ (frameElapsed = performance.now() - start) > FRAME_BUDGET) return requestAnimationFrame((function() {
452
+ return doUpdateDOM();
453
+ }));
454
+ if (runDOMActions(attributeActions.slice(0, MAX_DOM_ACTIONS_PER_FRAME.ATTRIBUTE_ACTIONS)),
455
+ (frameElapsed = performance.now() - start) > FRAME_BUDGET) return requestAnimationFrame((function() {
456
+ return doUpdateDOM();
457
+ }));
458
+ if (runDOMActions(textActions.slice(0, MAX_DOM_ACTIONS_PER_FRAME.TEXT_ACTIONS)),
459
+ (frameElapsed = performance.now() - start) > FRAME_BUDGET) return requestAnimationFrame((function() {
460
+ return doUpdateDOM();
461
+ }));
462
+ if (runDOMActions(propertySetActions.slice(0, MAX_DOM_ACTIONS_PER_FRAME.PROPERTY_ACTIONS)),
463
+ (frameElapsed = performance.now() - start) > FRAME_BUDGET) return requestAnimationFrame((function() {
464
+ return doUpdateDOM();
465
+ }));
466
+ if (attributeActions.length || textActions.length || propertySetActions.length || elementActions.length || reattachActions.length) return requestAnimationFrame((function() {
467
+ return doUpdateDOM();
468
+ }));
469
+ nodeManager.paintStatus = null, pendingPaintNodeManagers.delete(nodeManager);
470
+ }
471
+ } catch (err) {
472
+ _iterator.e(err);
473
+ } finally {
474
+ _iterator.f();
475
+ }
476
+ if (frameElapsed > FRAME_BUDGET) return requestAnimationFrame((function() {
477
+ return doUpdateDOM();
478
+ }));
479
+ }
480
+ function node_actions_unsupportedIterableToArray(r, a) {
481
+ if (r) {
482
+ if ("string" == typeof r) return node_actions_arrayLikeToArray(r, a);
483
+ var t = {}.toString.call(r).slice(8, -1);
484
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? node_actions_arrayLikeToArray(r, a) : void 0;
485
+ }
486
+ }
487
+ function node_actions_arrayLikeToArray(r, a) {
488
+ (null == a || a > r.length) && (a = r.length);
489
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
490
+ return n;
491
+ }
492
+ function generateStateNodeActions(stateManager, stateProp, newValue) {
493
+ var _this = this, value = newValue;
494
+ "todosFiltered" === stateProp && performance.mark("todo-generate-node-actions");
495
+ var stateNodes = stateManager.nodeManager.stateNodes[stateProp], stateMapElements = stateManager.stateArrayMaps[stateProp], conditionallyRenderingElements = stateManager.nodeManager.conditionallyRenderingElements[stateProp];
496
+ if (stateNodes && stateNodes.forEach((function(node) {
497
+ !function setStateNodeValueAction(nodeManager, node, value) {
498
+ node.nodeType === Node.ATTRIBUTE_NODE ? nodeManager.addNodeAction(node, {
499
+ actionType: "setAttribute",
500
+ actionValue: value
501
+ }) : node.nodeType === Node.TEXT_NODE && nodeManager.addNodeAction(node, {
502
+ actionType: "textContent",
503
+ actionValue: value
504
+ });
505
+ }(stateManager.nodeManager, node, value);
506
+ })), stateMapElements) {
507
+ var stateMapArray = value;
508
+ stateMapElements.forEach((function(customElementName, parentElement) {
509
+ !function reconcileStateMapElement(stateMapArray, customElementName, parentElement, stateManager) {
510
+ var detachedParentElement = null, mappedElementChange = !1, isParentList = isElementAList(parentElement), replacedChildren = new Map, expectedItems = (parentElement.getAttribute && parentElement.getAttribute("ref") || parentElement.refName || parentElement.tagName,
511
+ stateMapArray.map((function asState(it) {
512
+ return Object.hasOwn(it, "state") ? it.state : it;
513
+ })));
514
+ if (stateMapArray.isNewArray) {
515
+ if (stateMapArray.length) {
516
+ var _detachedParentElemen;
517
+ mappedElementChange = !0;
518
+ var elements = mapStateArrayToElements(stateMapArray, customElementName, isParentList ? "li" : void 0, detachedParentElement = parentElement.detach());
519
+ detachedParentElement.innerHTML = "", (_detachedParentElemen = detachedParentElement).append.apply(_detachedParentElemen, function node_actions_toConsumableArray(r) {
520
+ return function node_actions_arrayWithoutHoles(r) {
521
+ if (Array.isArray(r)) return node_actions_arrayLikeToArray(r);
522
+ }(r) || function node_actions_iterableToArray(r) {
523
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
524
+ }(r) || node_actions_unsupportedIterableToArray(r) || function node_actions_nonIterableSpread() {
525
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
526
+ }();
527
+ }(elements));
528
+ }
529
+ } else if (stateMapArray.lastOperation) {
530
+ mappedElementChange = !0, detachedParentElement || (detachedParentElement = parentElement.detach());
531
+ var children = detachedParentElement.children, _stateMapArray$lastOp = function node_actions_slicedToArray(r, e) {
532
+ return function node_actions_arrayWithHoles(r) {
533
+ if (Array.isArray(r)) return r;
534
+ }(r) || function node_actions_iterableToArrayLimit(r, l) {
535
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
536
+ if (null != t) {
537
+ var e, n, i, u, a = [], f = !0, o = !1;
538
+ try {
539
+ if (i = (t = t.call(r)).next, 0 === l) {
540
+ if (Object(t) !== t) return;
541
+ f = !1;
542
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
543
+ } catch (r) {
544
+ o = !0, n = r;
545
+ } finally {
546
+ try {
547
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
548
+ } finally {
549
+ if (o) throw n;
550
+ }
551
+ }
552
+ return a;
553
+ }
554
+ }(r, e) || node_actions_unsupportedIterableToArray(r, e) || function node_actions_nonIterableRest() {
555
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
556
+ }();
557
+ }(stateMapArray.lastOperation, 2), operation = _stateMapArray$lastOp[0], args = _stateMapArray$lastOp[1];
558
+ switch (operation) {
559
+ case "shift":
560
+ detachedParentElement.removeChild(detachedParentElement.firstElementChild);
561
+ break;
562
+
563
+ case "unshift":
564
+ for (var i = args[0] - 1; i >= 0; i--) {
565
+ var _detachedParentElemen2, stateItem = stateMapArray[i], existing = null === (_detachedParentElemen2 = detachedParentElement.keyMap) || void 0 === _detachedParentElemen2 ? void 0 : _detachedParentElemen2.get(stateItem.key);
566
+ if (existing) {
567
+ var first = detachedParentElement.firstElementChild;
568
+ existing !== first && detachedParentElement.insertBefore(existing, first);
569
+ } else {
570
+ var newChild = stateToElement(stateItem, customElementName, isParentList ? "li" : void 0, detachedParentElement);
571
+ newChild.stateKey = stateItem.key, detachedParentElement.prepend(newChild);
572
+ }
573
+ }
574
+ break;
575
+
576
+ case "pop":
577
+ detachedParentElement.removeChild(detachedParentElement.lastElementChild);
578
+ break;
579
+
580
+ case "push":
581
+ for (var _i = children.length, len = stateMapArray.length; _i < len; _i++) {
582
+ var _stateItem = stateMapArray[_i], _newChild = stateToElement(_stateItem, customElementName, isParentList ? "li" : void 0, detachedParentElement);
583
+ _newChild.stateKey = _stateItem.key, detachedParentElement.appendChild(_newChild);
584
+ }
585
+ break;
586
+
587
+ case "splice":
588
+ var _args$, deleteCount, currentLen = children.length, rawStart = null !== (_args$ = args[0]) && void 0 !== _args$ ? _args$ : 0, rawDelete = args[1], _startIndex = rawStart < 0 ? Math.max(currentLen + rawStart, 0) : Math.min(rawStart, currentLen);
589
+ deleteCount = void 0 === rawDelete || rawDelete === 1 / 0 ? currentLen - _startIndex : rawDelete < 0 ? 0 : Math.min(rawDelete, currentLen - _startIndex);
590
+ var itemsToInsert = args[2] || [], expectedLen = stateMapArray.length;
591
+ if (0 === itemsToInsert.length && currentLen === expectedLen) break;
592
+ if (0 === _startIndex && deleteCount >= currentLen && itemsToInsert.length === expectedLen && currentLen === expectedLen) break;
593
+ for (var k = 0; k < deleteCount; k++) detachedParentElement.removeChild(children[_startIndex]);
594
+ var _step, _iterator = function node_actions_createForOfIteratorHelper(r, e) {
595
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
596
+ if (!t) {
597
+ if (Array.isArray(r) || (t = node_actions_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
598
+ t && (r = t);
599
+ var _n = 0, F = function F() {};
600
+ return {
601
+ s: F,
602
+ n: function n() {
603
+ return _n >= r.length ? {
604
+ done: !0
605
+ } : {
606
+ done: !1,
607
+ value: r[_n++]
608
+ };
609
+ },
610
+ e: function e(r) {
611
+ throw r;
612
+ },
613
+ f: F
614
+ };
615
+ }
616
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
617
+ }
618
+ var o, a = !0, u = !1;
619
+ return {
620
+ s: function s() {
621
+ t = t.call(r);
622
+ },
623
+ n: function n() {
624
+ var r = t.next();
625
+ return a = r.done, r;
626
+ },
627
+ e: function e(r) {
628
+ u = !0, o = r;
629
+ },
630
+ f: function f() {
631
+ try {
632
+ a || null == t.return || t.return();
633
+ } finally {
634
+ if (u) throw o;
635
+ }
636
+ }
637
+ };
638
+ }(itemsToInsert);
639
+ try {
640
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
641
+ var _children$_startIndex, _newChild2 = stateToElement(_step.value, customElementName, isParentList ? "li" : void 0, detachedParentElement), refNode = null !== (_children$_startIndex = children[_startIndex]) && void 0 !== _children$_startIndex ? _children$_startIndex : null;
642
+ detachedParentElement.insertBefore(_newChild2, refNode), _startIndex++;
643
+ }
644
+ } catch (err) {
645
+ _iterator.e(err);
646
+ } finally {
647
+ _iterator.f();
648
+ }
649
+ }
650
+ } else {
651
+ for (var _detachedParentElemen3, parentKeyMap = null == parentElement ? void 0 : parentElement.keyMap, _container = null !== (_detachedParentElemen3 = detachedParentElement) && void 0 !== _detachedParentElemen3 ? _detachedParentElemen3 : parentElement, _i2 = 0; _i2 < expectedItems.length; _i2++) {
652
+ var _currentChild$firstEl, _replacedChildren$get, expected = expectedItems[_i2], expectedKey = null == expected ? void 0 : expected.key, currentChild = _container.children[_i2];
653
+ if (!currentChild) break;
654
+ var currentState = isParentList ? null === (_currentChild$firstEl = currentChild.firstElementChild) || void 0 === _currentChild$firstEl ? void 0 : _currentChild$firstEl.state : currentChild.state, currentKey = currentState ? currentState.key : currentChild.stateKey;
655
+ if (currentKey !== expectedKey) {
656
+ mappedElementChange = !0, detachedParentElement || (detachedParentElement = parentElement.detach());
657
+ var elementToPut = null !== (_replacedChildren$get = replacedChildren.get(expectedKey)) && void 0 !== _replacedChildren$get ? _replacedChildren$get : parentKeyMap.get(expectedKey);
658
+ if (elementToPut) {
659
+ var _elementToPut$firstEl, replacedChild = detachedParentElement.replaceChildWith(currentChild, elementToPut);
660
+ if (replacedChildren.set(currentKey, replacedChild), (isParentList ? null === (_elementToPut$firstEl = elementToPut.firstElementChild) || void 0 === _elementToPut$firstEl ? void 0 : _elementToPut$firstEl.state : elementToPut.state) !== expected) {
661
+ var refreshed = stateToElement(expected, customElementName, isParentList ? "li" : void 0, detachedParentElement);
662
+ refreshed.stateKey = expectedKey, detachedParentElement.replaceChildWith(elementToPut, refreshed);
663
+ }
664
+ } else {
665
+ var _newChild4 = stateToElement(expected, customElementName, isParentList ? "li" : void 0, detachedParentElement);
666
+ _newChild4.stateKey = expectedKey, detachedParentElement.replaceChildWith(currentChild, _newChild4);
667
+ }
668
+ } else if (currentState !== expected) {
669
+ mappedElementChange = !0, detachedParentElement || (detachedParentElement = parentElement.detach());
670
+ var _newChild3 = stateToElement(expected, customElementName, isParentList ? "li" : void 0, detachedParentElement);
671
+ _newChild3.stateKey = expectedKey, detachedParentElement.replaceChildWith(currentChild, _newChild3);
672
+ }
673
+ }
674
+ for (;(null !== (_detachedParentElemen4 = detachedParentElement) && void 0 !== _detachedParentElemen4 ? _detachedParentElemen4 : parentElement).children.length > expectedItems.length; ) {
675
+ var _detachedParentElemen4, _detachedParentElemen5;
676
+ mappedElementChange = !0, detachedParentElement || (detachedParentElement = parentElement.detach()),
677
+ detachedParentElement.removeChild((null !== (_detachedParentElemen5 = detachedParentElement) && void 0 !== _detachedParentElemen5 ? _detachedParentElemen5 : parentElement).lastElementChild);
678
+ }
679
+ }
680
+ var numChildren = detachedParentElement ? detachedParentElement.children.length : parentElement.children.length;
681
+ if (stateMapArray.length > numChildren) {
682
+ mappedElementChange = !0, detachedParentElement || (detachedParentElement = parentElement.detach());
683
+ for (var index = detachedParentElement.children.length; index < stateMapArray.length; index++) {
684
+ var _detachedParentElemen6, state_Item = stateMapArray[index];
685
+ if (null === (_detachedParentElemen6 = detachedParentElement.keyMap) || void 0 === _detachedParentElemen6 || !_detachedParentElemen6.has(state_Item.key)) {
686
+ var _newChild5 = void 0;
687
+ (_newChild5 = replacedChildren.has(state_Item.key) ? replacedChildren.get(state_Item.key) : stateToElement(state_Item, customElementName, isParentList ? "li" : void 0, detachedParentElement)).stateKey = state_Item.key,
688
+ detachedParentElement.appendChild(_newChild5);
689
+ }
690
+ }
691
+ }
692
+ mappedElementChange && stateManager.nodeManager.addNodeAction(detachedParentElement, {
693
+ actionType: "reattach",
694
+ actionValue: !0
695
+ });
696
+ }(stateMapArray, customElementName, parentElement, stateManager);
697
+ }));
698
+ }
699
+ conditionallyRenderingElements && conditionallyRenderingElements.forEach((function(element) {
700
+ queueConditionalRender(_this, element.render.bind(_this));
701
+ })), "pending" === stateManager.nodeManager.paintStatus && stateManager.nodeManager.queuePaint();
702
+ }
703
+ function setHiddenProperty(obj, propName, propValue) {
704
+ var enumerable = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
705
+ Object.defineProperty(obj, propName, {
706
+ value: propValue,
707
+ configurable: !1,
708
+ writable: !0,
709
+ enumerable
710
+ });
711
+ }
712
+ function bindPropAttribute(attributeName, attributeValue, host) {
713
+ var propName = attributeValue.substring(1), attrNode = this.getAttributeNode(attributeName);
714
+ attrNode.nodeValue = host.getAttribute(propName), attrNode.isPropAttribute = !0,
715
+ host.propAttributes.has(propName) || host.propAttributes.set(propName, new Set),
716
+ host.propAttributes.get(propName).add(attrNode);
717
+ }
718
+ function parseStateExpression(expression) {
719
+ if (0 === expression.indexOf("@")) return [ "property", [ expression.substring(1) ] ];
720
+ if (0 === expression.indexOf("!")) return [ "negation", [ expression.substring(1) ] ];
721
+ for (var _char, charIndex = 0, parsed = expression[charIndex]; charIndex++ < expression.length; ) {
722
+ if (_char = expression[charIndex], 3 == charIndex && "is_" == parsed) return [ "equality", expression.substring(3).split(":") ];
723
+ if ("?" === _char) return [ "ternary", parsed, expression.substring(charIndex + 1).split(":") ];
724
+ parsed += _char;
725
+ }
726
+ return [ "literal", [ expression ] ];
727
+ }
728
+ function fromAttributeValue(value) {
729
+ return "" === value || null !== value && value;
730
+ }
731
+ function state_utils_slicedToArray(r, e) {
732
+ return state_utils_arrayWithHoles(r) || function state_utils_iterableToArrayLimit(r, l) {
733
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
734
+ if (null != t) {
735
+ var e, n, i, u, a = [], f = !0, o = !1;
736
+ try {
737
+ if (i = (t = t.call(r)).next, 0 === l) {
738
+ if (Object(t) !== t) return;
739
+ f = !1;
740
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
741
+ } catch (r) {
742
+ o = !0, n = r;
743
+ } finally {
744
+ try {
745
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
746
+ } finally {
747
+ if (o) throw n;
748
+ }
749
+ }
750
+ return a;
751
+ }
752
+ }(r, e) || state_utils_unsupportedIterableToArray(r, e) || state_utils_nonIterableRest();
753
+ }
754
+ function _toArray(r) {
755
+ return state_utils_arrayWithHoles(r) || function state_utils_iterableToArray(r) {
756
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
757
+ }(r) || state_utils_unsupportedIterableToArray(r) || state_utils_nonIterableRest();
758
+ }
759
+ function state_utils_nonIterableRest() {
760
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
761
+ }
762
+ function state_utils_unsupportedIterableToArray(r, a) {
763
+ if (r) {
764
+ if ("string" == typeof r) return state_utils_arrayLikeToArray(r, a);
765
+ var t = {}.toString.call(r).slice(8, -1);
766
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? state_utils_arrayLikeToArray(r, a) : void 0;
767
+ }
768
+ }
769
+ function state_utils_arrayLikeToArray(r, a) {
770
+ (null == a || a > r.length) && (a = r.length);
771
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
772
+ return n;
773
+ }
774
+ function state_utils_arrayWithHoles(r) {
775
+ if (Array.isArray(r)) return r;
776
+ }
777
+ "undefined" != typeof window && (window.SproutWaitIdle = function waitForIdle() {
778
+ return new Promise((function(resolve) {
779
+ requestAnimationFrame((function check() {
780
+ if (!NODES_STATE.pendingPaintNodeManagers.size) return resolve();
781
+ requestAnimationFrame(check);
782
+ }));
783
+ }));
784
+ }), "undefined" == typeof HTMLElement || Object.defineProperty(globalThis, "elementSetAttribute", {
785
+ value: HTMLElement.prototype.setAttribute,
786
+ writable: !1,
787
+ configurable: !1
788
+ });
789
+ var setAttribute = function setAttribute(attrName, attrValue) {
790
+ !function isBooleanAttribute(attributeName) {
791
+ return BOOLEAN_ATTRIBUTES.has(attributeName);
792
+ }(attrName) ? elementSetAttribute.call(this, attrName, attrValue) : "false" === attrValue ? this.removeAttribute(attrName) : elementSetAttribute.call(this, attrName, "");
793
+ }, setStateAttribute = function setStateAttribute(attrName, statePropExpression) {
794
+ var _parseStateExpression2 = _toArray(parseStateExpression(statePropExpression)), type = _parseStateExpression2[0], args = _parseStateExpression2.slice(1), stateProp = args[0], _this$getState2 = state_utils_slicedToArray(this.getState(stateProp, !0), 2), stateVal = _this$getState2[0], theState = _this$getState2[1], stateManager = theState._stateManager, valueToSet = "literal" === type ? stateVal : stateManager.bindStatePropExpression(statePropExpression, type, args);
795
+ this.removeAttribute(attrName);
796
+ var stateAttrNode = document.createAttribute(attrName);
797
+ stateAttrNode.nodeValue = valueToSet, setHiddenProperty(stateAttrNode, "isStateAttribute", !0),
798
+ setHiddenProperty(stateAttrNode, "originalOwnerElement", this), "boolean" == typeof valueToSet && (stateAttrNode.nodeValue = ""),
799
+ stateManager.addStateNode(statePropExpression, stateAttrNode), !1 !== valueToSet && this.setAttributeNode(stateAttrNode),
800
+ this.addEventListener("disconnected", (function() {
801
+ theState._stateManager.removeStateNode(statePropExpression, stateAttrNode);
802
+ }), {
803
+ once: !0
804
+ });
805
+ }, setStateText = function setStateText(statePropExpression) {
806
+ var _parseStateExpression4 = _toArray(parseStateExpression(statePropExpression)), type = _parseStateExpression4[0], args = _parseStateExpression4.slice(1), stateProp = args[0], _this$getState4 = state_utils_slicedToArray(this.getState(stateProp, !0), 2), stateVal = _this$getState4[0], theState = _this$getState4[1], stateManager = theState._stateManager, valueToSet = "literal" === type ? stateVal : stateManager.bindStatePropExpression(statePropExpression, type, args), textNode = document.createTextNode(valueToSet);
807
+ setHiddenProperty(textNode, "isStateAttribute", !0), theState._stateManager.addStateNode(statePropExpression, textNode),
808
+ this.appendChild(textNode), this.addEventListener("disconnected", (function() {
809
+ theState._stateManager.removeStateNode(statePropExpression, textNode);
810
+ }), {
811
+ once: !0
812
+ });
813
+ };
814
+ function stateToElement(stateObject, elemName, wrapInElement, ownerMapElement) {
815
+ var returnElement, customElementInstance = document.createElement(elemName);
816
+ return customElementInstance.setInitialState(stateObject), customElementInstance.ownerMapElement = ownerMapElement,
817
+ wrapInElement ? (returnElement = document.createElement(wrapInElement)).appendChild(customElementInstance) : returnElement = customElementInstance,
818
+ stateObject.hasOwnProperty("key") && !returnElement.hasOwnProperty("stateKey") && (returnElement.stateKey = stateObject.key),
819
+ returnElement;
820
+ }
821
+ function mapStateArrayToElements(stateItems, elemName, wrapInElement, parentElement) {
822
+ return stateItems.map((function(stateItem, index) {
823
+ Object.hasOwn(stateItem, "state") && (stateItem = stateItem.state);
824
+ var element = stateToElement(stateItem, elemName, wrapInElement, parentElement);
825
+ return element.stateKey = stateItem.key, element;
826
+ }));
827
+ }
828
+ function handleStateChange(stateManager, stateProp, changedValue) {
829
+ var _descrp$get;
830
+ if (!isBuiltInStateProp(stateProp)) {
831
+ var newValue = null != changedValue ? changedValue : stateManager.state[stateProp], descrp = Object.getOwnPropertyDescriptor(stateManager.state, stateProp);
832
+ null == descrp || null === (_descrp$get = descrp.get) || void 0 === _descrp$get || _descrp$get.isStateGetter,
833
+ !function dispatchStateChangEvent(state, property, newValue) {
834
+ var stateChangeEvent = new CustomEvent("stateChange", {
835
+ bubbles: !1,
836
+ composed: !1,
837
+ detail: {
838
+ property,
839
+ newValue
840
+ }
841
+ });
842
+ state.dispatchEvent(stateChangeEvent);
843
+ }(stateManager.state, stateProp, newValue), generateStateNodeActions(stateManager, stateProp, newValue),
844
+ stateProp.startsWith("!") || generateStateNodeActions(stateManager, "!".concat(stateProp), !newValue);
845
+ }
846
+ }
847
+ function isBuiltInStateProp(stateProp) {
848
+ return BUILT_IN_STATE_PROPS.has(stateProp);
849
+ }
850
+ function isSetterHook(stateProp) {
851
+ return 0 === stateProp.indexOf("set_");
852
+ }
853
+ function StatefulArray_slicedToArray(r, e) {
854
+ return function StatefulArray_arrayWithHoles(r) {
855
+ if (Array.isArray(r)) return r;
856
+ }(r) || function StatefulArray_iterableToArrayLimit(r, l) {
857
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
858
+ if (null != t) {
859
+ var e, n, i, u, a = [], f = !0, o = !1;
860
+ try {
861
+ if (i = (t = t.call(r)).next, 0 === l) {
862
+ if (Object(t) !== t) return;
863
+ f = !1;
864
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
865
+ } catch (r) {
866
+ o = !0, n = r;
867
+ } finally {
868
+ try {
869
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
870
+ } finally {
871
+ if (o) throw n;
872
+ }
873
+ }
874
+ return a;
875
+ }
876
+ }(r, e) || StatefulArray_unsupportedIterableToArray(r, e) || function StatefulArray_nonIterableRest() {
877
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
878
+ }();
879
+ }
880
+ function StatefulArray_unsupportedIterableToArray(r, a) {
881
+ if (r) {
882
+ if ("string" == typeof r) return StatefulArray_arrayLikeToArray(r, a);
883
+ var t = {}.toString.call(r).slice(8, -1);
884
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? StatefulArray_arrayLikeToArray(r, a) : void 0;
885
+ }
886
+ }
887
+ function StatefulArray_arrayLikeToArray(r, a) {
888
+ (null == a || a > r.length) && (a = r.length);
889
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
890
+ return n;
891
+ }
892
+ function StatefulArray_typeof(o) {
893
+ return StatefulArray_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
894
+ return typeof o;
895
+ } : function(o) {
896
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
897
+ }, StatefulArray_typeof(o);
898
+ }
899
+ function StatefulArray_defineProperties(e, r) {
900
+ for (var t = 0; t < r.length; t++) {
901
+ var o = r[t];
902
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
903
+ Object.defineProperty(e, StatefulArray_toPropertyKey(o.key), o);
904
+ }
905
+ }
906
+ function StatefulArray_possibleConstructorReturn(t, e) {
907
+ if (e && ("object" == StatefulArray_typeof(e) || "function" == typeof e)) return e;
908
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
909
+ return function StatefulArray_assertThisInitialized(e) {
910
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
911
+ return e;
912
+ }(t);
913
+ }
914
+ function _get() {
915
+ return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, r) {
916
+ var p = function _superPropBase(t, o) {
917
+ for (;!{}.hasOwnProperty.call(t, o) && null !== (t = StatefulArray_getPrototypeOf(t)); ) ;
918
+ return t;
919
+ }(e, t);
920
+ if (p) {
921
+ var n = Object.getOwnPropertyDescriptor(p, t);
922
+ return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
923
+ }
924
+ }, _get.apply(null, arguments);
925
+ }
926
+ function StatefulArray_wrapNativeSuper(t) {
927
+ var r = "function" == typeof Map ? new Map : void 0;
928
+ return StatefulArray_wrapNativeSuper = function _wrapNativeSuper(t) {
929
+ if (null === t || !function StatefulArray_isNativeFunction(t) {
930
+ try {
931
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
932
+ } catch (n) {
933
+ return "function" == typeof t;
934
+ }
935
+ }(t)) return t;
936
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
937
+ if (void 0 !== r) {
938
+ if (r.has(t)) return r.get(t);
939
+ r.set(t, Wrapper);
940
+ }
941
+ function Wrapper() {
942
+ return function StatefulArray_construct(t, e, r) {
943
+ if (StatefulArray_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
944
+ var o = [ null ];
945
+ o.push.apply(o, e);
946
+ var p = new (t.bind.apply(t, o));
947
+ return r && StatefulArray_setPrototypeOf(p, r.prototype), p;
948
+ }(t, arguments, StatefulArray_getPrototypeOf(this).constructor);
949
+ }
950
+ return Wrapper.prototype = Object.create(t.prototype, {
951
+ constructor: {
952
+ value: Wrapper,
953
+ enumerable: !1,
954
+ writable: !0,
955
+ configurable: !0
956
+ }
957
+ }), StatefulArray_setPrototypeOf(Wrapper, t);
958
+ }, StatefulArray_wrapNativeSuper(t);
959
+ }
960
+ function StatefulArray_isNativeReflectConstruct() {
961
+ try {
962
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
963
+ } catch (t) {}
964
+ return (StatefulArray_isNativeReflectConstruct = function _isNativeReflectConstruct() {
965
+ return !!t;
966
+ })();
967
+ }
968
+ function StatefulArray_setPrototypeOf(t, e) {
969
+ return StatefulArray_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
970
+ return t.__proto__ = e, t;
971
+ }, StatefulArray_setPrototypeOf(t, e);
972
+ }
973
+ function StatefulArray_getPrototypeOf(t) {
974
+ return StatefulArray_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
975
+ return t.__proto__ || Object.getPrototypeOf(t);
976
+ }, StatefulArray_getPrototypeOf(t);
977
+ }
978
+ function _defineProperty(e, r, t) {
979
+ return (r = StatefulArray_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
980
+ value: t,
981
+ enumerable: !0,
982
+ configurable: !0,
983
+ writable: !0
984
+ }) : e[r] = t, e;
985
+ }
986
+ function StatefulArray_toPropertyKey(t) {
987
+ var i = function StatefulArray_toPrimitive(t, r) {
988
+ if ("object" != StatefulArray_typeof(t) || !t) return t;
989
+ var e = t[Symbol.toPrimitive];
990
+ if (void 0 !== e) {
991
+ var i = e.call(t, r || "default");
992
+ if ("object" != StatefulArray_typeof(i)) return i;
993
+ throw new TypeError("@@toPrimitive must return a primitive value.");
994
+ }
995
+ return ("string" === r ? String : Number)(t);
996
+ }(t, "string");
997
+ return "symbol" == StatefulArray_typeof(i) ? i : i + "";
998
+ }
999
+ var StatefulArray = function(_Array) {
1000
+ function StatefulArray(initialArray, parentStateObject, arrayStateProp) {
1001
+ var _this, appScope = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : window, isStateMap = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
1002
+ if (function StatefulArray_classCallCheck(a, n) {
1003
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
1004
+ }(this, StatefulArray), appScope.SPROUT_CONFIG.stateManagerClass, !Array.isArray(initialArray)) throw Error("Argument for StateFulArray constructor must be an array!");
1005
+ var rawArray = initialArray, statefulArray = rawArray.map((function(item, index) {
1006
+ var stateItem = item;
1007
+ return Object.hasOwn(item, "state") || Object.hasOwn(item, "_stateManager") || Array.isArray(item) || "object" === StatefulArray_typeof(item) && (stateItem = newStateManager(item, arrayStateProp, parentStateObject._stateManager, handleStateChange, !1, appScope)),
1008
+ stateItem;
1009
+ }));
1010
+ return _defineProperty(_this = function StatefulArray_callSuper(t, o, e) {
1011
+ return o = StatefulArray_getPrototypeOf(o), StatefulArray_possibleConstructorReturn(t, StatefulArray_isNativeReflectConstruct() ? Reflect.construct(o, e || [], StatefulArray_getPrototypeOf(t).constructor) : o.apply(t, e));
1012
+ }(this, StatefulArray, function StatefulArray_toConsumableArray(r) {
1013
+ return function StatefulArray_arrayWithoutHoles(r) {
1014
+ if (Array.isArray(r)) return StatefulArray_arrayLikeToArray(r);
1015
+ }(r) || function StatefulArray_iterableToArray(r) {
1016
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
1017
+ }(r) || StatefulArray_unsupportedIterableToArray(r) || function StatefulArray_nonIterableSpread() {
1018
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1019
+ }();
1020
+ }(statefulArray)), "arrayMaps", {}), _this.parentStateObject = parentStateObject,
1021
+ _this.arrayStateProp = arrayStateProp, _this.appScope = appScope, _this.rawArray = rawArray,
1022
+ isStateMap && _this.makeStateMap(), setHiddenProperty(statefulArray = new Proxy(_this, StatefulArrayHandler(null == parentStateObject ? void 0 : parentStateObject._stateManager, arrayStateProp, appScope)), "_isStatefulArray", !0),
1023
+ _this.statefulArray = statefulArray, StatefulArray_possibleConstructorReturn(_this, statefulArray);
1024
+ }
1025
+ return function StatefulArray_inherits(t, e) {
1026
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
1027
+ t.prototype = Object.create(e && e.prototype, {
1028
+ constructor: {
1029
+ value: t,
1030
+ writable: !0,
1031
+ configurable: !0
1032
+ }
1033
+ }), Object.defineProperty(t, "prototype", {
1034
+ writable: !1
1035
+ }), e && StatefulArray_setPrototypeOf(t, e);
1036
+ }(StatefulArray, _Array), function StatefulArray_createClass(e, r, t) {
1037
+ return r && StatefulArray_defineProperties(e.prototype, r), t && StatefulArray_defineProperties(e, t),
1038
+ Object.defineProperty(e, "prototype", {
1039
+ writable: !1
1040
+ }), e;
1041
+ }(StatefulArray, [ {
1042
+ key: Symbol.iterator,
1043
+ value: function value() {
1044
+ return _get(StatefulArray_getPrototypeOf(StatefulArray.prototype), Symbol.iterator, this).call(this);
1045
+ }
1046
+ }, {
1047
+ key: "runArrayOperation",
1048
+ value: function runArrayOperation(operationName, method, args) {
1049
+ switch (operationName) {
1050
+ case "shift":
1051
+ return this.lastOperation = [ "shift" ], [ method.apply(this, args), !1 ];
1052
+
1053
+ case "unshift":
1054
+ return this.lastOperation = [ "unshift", [ args.length ] ], [ method.apply(this, args), !1 ];
1055
+
1056
+ case "pop":
1057
+ return this.lastOperation = [ "pop" ], [ method.apply(this), !1 ];
1058
+
1059
+ case "push":
1060
+ return this.lastOperation = [ "push", [ args.length ] ], [ method.apply(this, args), !1 ];
1061
+
1062
+ case "splice":
1063
+ var _args = StatefulArray_slicedToArray(args, 2), startIndex = _args[0], deleteCount = _args[1], itemsToAdd = args.slice(2);
1064
+ return this.lastOperation = [ "splice", [ startIndex, deleteCount, itemsToAdd ] ],
1065
+ [ method.apply(this, args), !1 ];
1066
+
1067
+ default:
1068
+ this.lastOperation = void 0;
1069
+ var _res5 = method.apply(this, args);
1070
+ return [ _res5, Array.isArray(_res5) ];
1071
+ }
1072
+ }
1073
+ }, {
1074
+ key: "doArrayOperation",
1075
+ value: function doArrayOperation(operationName, args) {
1076
+ var setDirtyProp = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
1077
+ this.$$operation = operationName;
1078
+ var result, prevLen = this.length, isNewArray = !1;
1079
+ if (ARRAY_CACHE_METHODS.has(operationName)) {
1080
+ var callbackFn = args[0];
1081
+ if (this.length && Object.hasOwn(this.arrayMaps, operationName) && this.arrayMaps[operationName].has(callbackFn)) {
1082
+ var cachedArrayMapMetadata = this.arrayMaps[operationName].get(callbackFn);
1083
+ if (this.lastDirtyTimestamp > cachedArrayMapMetadata.timestamp) {
1084
+ var _this$runArrayOperati2 = StatefulArray_slicedToArray(this.runArrayOperation(operationName, _get(StatefulArray_getPrototypeOf(StatefulArray.prototype), operationName, this), args), 2);
1085
+ result = _this$runArrayOperati2[0], isNewArray = _this$runArrayOperati2[1], this.arrayMaps[operationName].set(callbackFn, {
1086
+ lastResult: result,
1087
+ timestamp: (new Date).getTime()
1088
+ });
1089
+ } else result = cachedArrayMapMetadata.lastResult;
1090
+ } else {
1091
+ var _this$runArrayOperati4 = StatefulArray_slicedToArray(this.runArrayOperation(operationName, _get(StatefulArray_getPrototypeOf(StatefulArray.prototype), operationName, this), args), 2);
1092
+ result = _this$runArrayOperati4[0], isNewArray = _this$runArrayOperati4[1], Object.hasOwn(this.arrayMaps, operationName) || (this.arrayMaps[operationName] = new Map,
1093
+ this.arrayMaps[operationName].set(callbackFn, {
1094
+ lastResult: result,
1095
+ timestamp: (new Date).getTime()
1096
+ }));
1097
+ }
1098
+ } else {
1099
+ var _this$runArrayOperati6 = StatefulArray_slicedToArray(this.runArrayOperation(operationName, _get(StatefulArray_getPrototypeOf(StatefulArray.prototype), operationName, this), args), 2);
1100
+ result = _this$runArrayOperati6[0], isNewArray = _this$runArrayOperati6[1];
1101
+ }
1102
+ var postLen = this.length, isOrderOnly = ARRAY_MUTATE_NO_LENGTH_CHANGE_METHODS.has(operationName) || "splice" === operationName && postLen === prevLen;
1103
+ return setDirtyProp && isOrderOnly && this.parentStateObject._stateManager.setDirtyProp("".concat(this.arrayStateProp, ".length"), !0),
1104
+ delete this.$$operation, setDirtyProp && this.parentStateObject._stateManager.setDirtyProp(this.arrayStateProp),
1105
+ [ result, isNewArray ];
1106
+ }
1107
+ }, {
1108
+ key: "mapStateKeys",
1109
+ value: function mapStateKeys() {
1110
+ var _this2 = this;
1111
+ this.forEach((function(item) {
1112
+ var state = Object.hasOwn(item, "state") ? item.state : item;
1113
+ _this2.keyMap.set(state.key, state);
1114
+ }));
1115
+ }
1116
+ }, {
1117
+ key: "makeStateMap",
1118
+ value: function makeStateMap() {
1119
+ this._isStateMap = !0, this.keyMap = new Map, this.mapStateKeys();
1120
+ }
1121
+ } ], [ {
1122
+ key: Symbol.species,
1123
+ get: function get() {
1124
+ return Array;
1125
+ }
1126
+ } ]);
1127
+ }(StatefulArray_wrapNativeSuper(Array));
1128
+ function proxy_handlers_typeof(o) {
1129
+ return proxy_handlers_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1130
+ return typeof o;
1131
+ } : function(o) {
1132
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1133
+ }, proxy_handlers_typeof(o);
1134
+ }
1135
+ function proxy_handlers_slicedToArray(r, e) {
1136
+ return function proxy_handlers_arrayWithHoles(r) {
1137
+ if (Array.isArray(r)) return r;
1138
+ }(r) || function proxy_handlers_iterableToArrayLimit(r, l) {
1139
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1140
+ if (null != t) {
1141
+ var e, n, i, u, a = [], f = !0, o = !1;
1142
+ try {
1143
+ if (i = (t = t.call(r)).next, 0 === l) {
1144
+ if (Object(t) !== t) return;
1145
+ f = !1;
1146
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
1147
+ } catch (r) {
1148
+ o = !0, n = r;
1149
+ } finally {
1150
+ try {
1151
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1152
+ } finally {
1153
+ if (o) throw n;
1154
+ }
1155
+ }
1156
+ return a;
1157
+ }
1158
+ }(r, e) || function proxy_handlers_unsupportedIterableToArray(r, a) {
1159
+ if (r) {
1160
+ if ("string" == typeof r) return proxy_handlers_arrayLikeToArray(r, a);
1161
+ var t = {}.toString.call(r).slice(8, -1);
1162
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? proxy_handlers_arrayLikeToArray(r, a) : void 0;
1163
+ }
1164
+ }(r, e) || function proxy_handlers_nonIterableRest() {
1165
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1166
+ }();
1167
+ }
1168
+ function proxy_handlers_arrayLikeToArray(r, a) {
1169
+ (null == a || a > r.length) && (a = r.length);
1170
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1171
+ return n;
1172
+ }
1173
+ _defineProperty(StatefulArray, "functions", new ReadonlySet([ "constructor", "statifyArray", "addDirtyIndex", "doArrayOperation", "runArrayOperation", "makeStateMap", "mapStateKeys", "toArray" ]));
1174
+ var depsProxyHandler = function depsProxyHandler() {
1175
+ return {
1176
+ get: function get(target, property, receiver) {
1177
+ var _descrp$get;
1178
+ if (isBuiltInStateProp(property) || 0 === property.indexOf("$$")) return Reflect.get.apply(Reflect, arguments);
1179
+ var descrp = Object.getOwnPropertyDescriptor(target, property);
1180
+ return null != descrp && null !== (_descrp$get = descrp.get) && void 0 !== _descrp$get && _descrp$get.isStateGetter || (Object.hasOwn(target.$$accessCount, property) ? target.$$accessCount[property]++ : target.$$accessCount[property] = 1),
1181
+ Reflect.get.apply(Reflect, arguments);
1182
+ }
1183
+ };
1184
+ }, StateFunctionDependencyHandler = function StateFunctionDependencyHandler(stateManager, stateProp) {
1185
+ return arguments.length > 2 && void 0 !== arguments[2] || window, stateManager.state,
1186
+ {
1187
+ apply: function apply(thisFunction, thisStateObject, argumentsList) {
1188
+ stateManager.clearStateDependencies(stateProp);
1189
+ var originalGlobalState = thisStateObject._global, _getDeps2 = proxy_handlers_slicedToArray(getDeps(thisFunction, thisStateObject), 3), deps = _getDeps2[0], globalDeps = _getDeps2[1], result = _getDeps2[2];
1190
+ return deps.forEach((function(depProp) {
1191
+ stateManager.addStateDependency(depProp, stateProp);
1192
+ })), null == globalDeps || globalDeps.forEach((function(depProp) {
1193
+ originalGlobalState._stateManager.addGlobalStateDependency(depProp, stateProp, stateManager);
1194
+ })), result;
1195
+ }
1196
+ };
1197
+ }, StatefulArrayHandler = function StatefulArrayHandler(parentStateManager, arrayStateProp) {
1198
+ var setResult, appScope = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : window, triggerStateChange = function triggerStateChange() {
1199
+ var triggerLength = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
1200
+ (!(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]) && parentStateManager.setDirtyProp(arrayStateProp, !0),
1201
+ triggerLength && parentStateManager.setDirtyProp("".concat(arrayStateProp, ".length"), !0);
1202
+ }, keyOf = function keyOf(item) {
1203
+ var _item$state;
1204
+ if (item) return Object.hasOwn(item, "state") ? null === (_item$state = item.state) || void 0 === _item$state ? void 0 : _item$state.key : item.key;
1205
+ };
1206
+ return {
1207
+ set: function set(targetArray, property, value) {
1208
+ if (0 === property.indexOf("$$")) return Reflect.set(targetArray, property, value);
1209
+ if ("length" === property) return setResult = Reflect.set(targetArray, property, value),
1210
+ targetArray.hasDirtyItems = !0, targetArray.hasOwnProperty("$$operation") ? triggerStateChange(!0, !1) : triggerStateChange(!0, !0),
1211
+ setResult;
1212
+ if (targetArray[property] === value) return !0;
1213
+ if (Number(property), !isNaN(property)) {
1214
+ var _index = Number(property), prev = targetArray[_index], prevKey = keyOf(prev);
1215
+ if (value = statifyValue(value, arrayStateProp, parentStateManager, appScope), Object.hasOwn(value, "_stateManager") && (value = value._stateManager),
1216
+ !targetArray.hasOwnProperty("$$operation")) {
1217
+ var doStateChangeHandle = !1;
1218
+ if (_index < targetArray.length && (doStateChangeHandle = !0), (setResult = Reflect.set(targetArray, property, value)) && targetArray._isStateMap) {
1219
+ void 0 !== prevKey && targetArray.keyMap.delete(prevKey);
1220
+ var newKey = keyOf(value);
1221
+ void 0 !== newKey && targetArray.keyMap.set(newKey, function stateOf(item) {
1222
+ return Object.hasOwn(item, "state") ? item.state : item;
1223
+ }(value));
1224
+ }
1225
+ return doStateChangeHandle && triggerStateChange(), setResult;
1226
+ }
1227
+ }
1228
+ return Reflect.set(targetArray, property, value);
1229
+ },
1230
+ get: function get(targetArray, property, receiver) {
1231
+ if ("symbol" === proxy_handlers_typeof(property)) return Reflect.get.apply(Reflect, arguments);
1232
+ if ("length" === property && Object.hasOwn(targetArray.parentStateObject, "$$accessCount") && !Object.hasOwn(targetArray, "$$operation")) {
1233
+ var arrStateProp = targetArray.arrayStateProp;
1234
+ Object.hasOwn(targetArray.parentStateObject.$$accessCount, "".concat(arrStateProp, ".length")) ? targetArray.parentStateObject.$$accessCount["".concat(arrStateProp, ".length")]++ : targetArray.parentStateObject.$$accessCount["".concat(arrStateProp, ".length")] = 1;
1235
+ }
1236
+ if (property.indexOf && 0 === property.indexOf("__")) {
1237
+ var nativeFunctionName = property.substring(2);
1238
+ return Reflect.get(targetArray, nativeFunctionName, receiver);
1239
+ }
1240
+ if ("function" == typeof targetArray[property] && !StatefulArray.functions.has(property)) {
1241
+ var pso = targetArray.parentStateObject;
1242
+ if (pso && Object.hasOwn(pso, "$$accessCount")) {
1243
+ var methodName = String(property);
1244
+ if (ARRAY_DERIVE_METHODS.has(methodName)) {
1245
+ var arrayProp = targetArray.arrayStateProp;
1246
+ pso.$$accessCount[arrayProp] = (pso.$$accessCount[arrayProp] || 0) + 1;
1247
+ }
1248
+ }
1249
+ }
1250
+ if (!parentStateManager.isInitializing && "function" == typeof targetArray[property] && !StatefulArray.functions.has(property)) return function() {
1251
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
1252
+ var _targetArray$doArrayO2 = proxy_handlers_slicedToArray(targetArray.doArrayOperation.call(targetArray.statefulArray, property, args, ARRAY_MUTATE_METHODS.has(property)), 2), result = _targetArray$doArrayO2[0];
1253
+ return _targetArray$doArrayO2[1], result;
1254
+ };
1255
+ var index = Number(property);
1256
+ if (!isNaN(index)) {
1257
+ var item = targetArray[index];
1258
+ if (void 0 === item) return;
1259
+ return item && Object.hasOwn(item, "state") ? item.state : item;
1260
+ }
1261
+ return Reflect.get.apply(Reflect, arguments);
1262
+ },
1263
+ deleteProperty: function deleteProperty(targetArray, property) {
1264
+ if (isNaN(Number(property))) return Reflect.deleteProperty(targetArray, property);
1265
+ var prev = targetArray[Number(property)], prevKey = keyOf(prev), deleteOkay = Reflect.deleteProperty(targetArray, property);
1266
+ return deleteOkay && targetArray._isStateMap && void 0 !== prevKey && targetArray.keyMap.delete(prevKey),
1267
+ deleteOkay;
1268
+ }
1269
+ };
1270
+ };
1271
+ function conditionalElements() {
1272
+ this.conditionallyRenderingElements = {}, this.addConditionallyRenderingElements = function(stateProp, element) {
1273
+ this.nodeManager.addConditionallyRenderingElements(stateProp, element);
1274
+ };
1275
+ }
1276
+ function stateMaps() {
1277
+ this.stateArrayMaps = {}, this.addStateMap = function(stateProp, customElementName, parentElement) {
1278
+ this.stateArrayMaps.hasOwnProperty(stateProp) || (this.stateArrayMaps[stateProp] = new Map),
1279
+ this.stateArrayMaps[stateProp].set(parentElement, customElementName);
1280
+ }, this.clearStateMapsLastOperation = function() {
1281
+ for (var _i = 0, _Object$keys = Object.keys(this.stateArrayMaps); _i < _Object$keys.length; _i++) {
1282
+ var stateMapProp = _Object$keys[_i];
1283
+ delete this.state[stateMapProp].lastOperation;
1284
+ }
1285
+ };
1286
+ }
1287
+ function Cougar_state_utils_slicedToArray(r, e) {
1288
+ return function Cougar_state_utils_arrayWithHoles(r) {
1289
+ if (Array.isArray(r)) return r;
1290
+ }(r) || function Cougar_state_utils_iterableToArrayLimit(r, l) {
1291
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1292
+ if (null != t) {
1293
+ var e, n, i, u, a = [], f = !0, o = !1;
1294
+ try {
1295
+ if (i = (t = t.call(r)).next, 0 === l) {
1296
+ if (Object(t) !== t) return;
1297
+ f = !1;
1298
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
1299
+ } catch (r) {
1300
+ o = !0, n = r;
1301
+ } finally {
1302
+ try {
1303
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1304
+ } finally {
1305
+ if (o) throw n;
1306
+ }
1307
+ }
1308
+ return a;
1309
+ }
1310
+ }(r, e) || function Cougar_state_utils_unsupportedIterableToArray(r, a) {
1311
+ if (r) {
1312
+ if ("string" == typeof r) return Cougar_state_utils_arrayLikeToArray(r, a);
1313
+ var t = {}.toString.call(r).slice(8, -1);
1314
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Cougar_state_utils_arrayLikeToArray(r, a) : void 0;
1315
+ }
1316
+ }(r, e) || function Cougar_state_utils_nonIterableRest() {
1317
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1318
+ }();
1319
+ }
1320
+ function Cougar_state_utils_arrayLikeToArray(r, a) {
1321
+ (null == a || a > r.length) && (a = r.length);
1322
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1323
+ return n;
1324
+ }
1325
+ function Cougar_state_utils_typeof(o) {
1326
+ return Cougar_state_utils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1327
+ return typeof o;
1328
+ } : function(o) {
1329
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1330
+ }, Cougar_state_utils_typeof(o);
1331
+ }
1332
+ function state_utils_setPrototypeOf(t, e) {
1333
+ return state_utils_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
1334
+ return t.__proto__ = e, t;
1335
+ }, state_utils_setPrototypeOf(t, e);
1336
+ }
1337
+ function state_utils_isNativeReflectConstruct() {
1338
+ try {
1339
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1340
+ } catch (t) {}
1341
+ return (state_utils_isNativeReflectConstruct = function _isNativeReflectConstruct() {
1342
+ return !!t;
1343
+ })();
1344
+ }
1345
+ function newStateManager(initialState, parentStateProp, parentStateManager) {
1346
+ var appScope = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : window, stateManager = new Cougar_StateManager(initialState, parentStateProp, parentStateManager, arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : handleStateChange, arguments.length > 4 && void 0 !== arguments[4] && arguments[4], appScope);
1347
+ return stateManager.use(conditionalElements, "conditional-element"), stateManager.use(stateMaps, "map"),
1348
+ stateManager;
1349
+ }
1350
+ function statifyValue(value, stateProp, stateManager) {
1351
+ var appScope = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : window, isStateMap = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
1352
+ return isBuiltInStateProp(stateProp) || (Array.isArray(value) ? value = function statifyArray(array, stateProp, state) {
1353
+ var appScope = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : window, isStateMap = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
1354
+ if (Object.hasOwn(array, "_isStatefulArray")) return array;
1355
+ var statefulArray = function state_utils_construct(t, e, r) {
1356
+ if (state_utils_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
1357
+ var o = [ null ];
1358
+ o.push.apply(o, e);
1359
+ var p = new (t.bind.apply(t, o));
1360
+ return r && state_utils_setPrototypeOf(p, r.prototype), p;
1361
+ }(StatefulArray, [ array, state, stateProp, appScope, isStateMap ]);
1362
+ return state.hasOwnProperty("".concat(stateProp, ".length")) || Object.defineProperty(state, "".concat(stateProp, ".length"), {
1363
+ get: function get() {
1364
+ return this[stateProp].length;
1365
+ }
1366
+ }), statefulArray;
1367
+ }(value, stateProp, stateManager.state, appScope, isStateMap) : "object" !== Cougar_state_utils_typeof(value) || null === value || value.hasOwnProperty("_stateManager") || (value = newStateManager(value, stateProp, stateManager, handleStateChange, !1, appScope).state)),
1368
+ value;
1369
+ }
1370
+ function initSetterHook(setterArray, stateProp, stateManager) {
1371
+ var _setterOptions$deps, appScope = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : window, setterHookName = "set_".concat(stateProp), _setterArray = Cougar_state_utils_slicedToArray(setterArray, 2), setterFunc = _setterArray[0], setterOptions = _setterArray[1];
1372
+ if ("function" != typeof setterFunc) throw Error("Setter hooks must define a function as the first item!");
1373
+ var result, state = stateManager.state;
1374
+ if (setterOptions.deps = null !== (_setterOptions$deps = setterOptions.deps) && void 0 !== _setterOptions$deps ? _setterOptions$deps : "auto",
1375
+ !setterOptions.init || !setterOptions.once) if ("auto" === setterOptions.deps) if (setterOptions.reevaluate) {
1376
+ var stateDependencyHandler = StateFunctionDependencyHandler(stateManager, setterHookName, appScope);
1377
+ setterFunc = new Proxy(setterFunc, stateDependencyHandler), setterArray[0] = setterFunc;
1378
+ } else {
1379
+ var _globalDeps, deps, globalDeps, _getDeps2 = Cougar_state_utils_slicedToArray(getDeps(setterFunc, state), 3);
1380
+ deps = _getDeps2[0], globalDeps = _getDeps2[1], result = _getDeps2[2], deps.forEach((function(dep) {
1381
+ stateManager.addStateDependency(dep, setterHookName);
1382
+ })), null === (_globalDeps = globalDeps) || void 0 === _globalDeps || _globalDeps.forEach((function(dep) {
1383
+ stateManager.addStateDependency(dep, setterHookName), state._global._stateManager.addGlobalStateDependency(dep, setterHookName, stateManager);
1384
+ }));
1385
+ } else setterOptions.deps.forEach((function(dep) {
1386
+ if (0 === dep.indexOf("global")) {
1387
+ var globalDep = dep.substring(dep.indexOf("global.") + 7);
1388
+ state._global.addGlobalStateDependency(setterHookName, globalDep, stateManager);
1389
+ } else stateManager.addStateDependency(dep, setterHookName);
1390
+ }));
1391
+ Object.defineProperty(state, stateProp, {
1392
+ get: function get() {
1393
+ return Object.hasOwn(state, "$$accessCount") && (Object.hasOwn(state.$$accessCount, stateProp) ? state.$$accessCount[stateProp]++ : state.$$accessCount[stateProp] = 1),
1394
+ stateManager.privateState[stateProp];
1395
+ },
1396
+ set: function set() {
1397
+ throw Error("Cannot directly set the state value of a result of a setter hook function!");
1398
+ }
1399
+ }), setterOptions.init && (result || (result = setterFunc.call(state)), (setterOptions.statify || setterOptions.stateMap) && (result = statifyValue(result, stateProp, stateManager, appScope, setterOptions.stateMap)),
1400
+ stateManager.privateState[stateProp] = result, stateManager.setDirtyProp(stateProp));
1401
+ }
1402
+ function callSetterHook(setterArray, stateProp, stateManager) {
1403
+ var appScope = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : window, state = stateManager.state, originalValue = stateManager.privateState[stateProp];
1404
+ void 0 === originalValue && initSetterHook(setterArray, stateProp, stateManager, appScope);
1405
+ var _setterArray2 = Cougar_state_utils_slicedToArray(setterArray, 2), setterFunc = _setterArray2[0], setterOptions = _setterArray2[1];
1406
+ if ("function" != typeof setterFunc) throw Error("Setter hooks must define a function as the first item!");
1407
+ var result = setterFunc.call(state), hasNewValue = !1;
1408
+ if (void 0 === result) throw Error("State Set Hook functions MUST return a value");
1409
+ return (setterOptions.statify || setterOptions.stateMap) && (result = statifyValue(result, stateProp, stateManager, appScope, setterOptions.stateMap)),
1410
+ result !== originalValue && (stateManager.privateState[stateProp] = result, hasNewValue = !0),
1411
+ setterOptions.once && delete state["set_".concat(stateProp)], hasNewValue;
1412
+ }
1413
+ function resolveAccessCountToDepsSet(depsCount) {
1414
+ var lengthIndex;
1415
+ for (var prop in depsCount) -1 !== (lengthIndex = prop.indexOf(".length")) && depsCount[prop.substring(0, lengthIndex)]--;
1416
+ return new Set(Object.keys(depsCount).filter((function(dep) {
1417
+ return depsCount[dep] > 0;
1418
+ })));
1419
+ }
1420
+ function getDeps(ofFunction, fromStateObject) {
1421
+ var hasGlobal = !1, depsProxy = new Proxy(fromStateObject, depsProxyHandler());
1422
+ depsProxy.$$accessCount = {}, Object.hasOwn(depsProxy, "_global") && depsProxy._global !== GLOBAL_STATE_NOT_SET_YET && (hasGlobal = !0,
1423
+ depsProxy._global = new Proxy(depsProxy._global, depsProxyHandler), depsProxy._global.$$accessCount = {});
1424
+ var result = ofFunction.call(depsProxy), deps = resolveAccessCountToDepsSet(depsProxy.$$accessCount);
1425
+ delete depsProxy.$$accessCount;
1426
+ var globalDeps = null;
1427
+ return hasGlobal && (globalDeps = resolveAccessCountToDepsSet(depsProxy._global.$$accessCount),
1428
+ delete depsProxy._global.$$accessCount), [ deps, globalDeps, result ];
1429
+ }
1430
+ function defineStateExpressionResolver(statePropExpression, stateObj, getter, contextStateProp) {
1431
+ Object.defineProperty(stateObj, statePropExpression, {
1432
+ get: getter,
1433
+ set: function set() {
1434
+ throw Error("Cannot directly set a State property expression");
1435
+ },
1436
+ enumerable: !0
1437
+ }), stateObj._stateManager.addStateDependency(contextStateProp, statePropExpression);
1438
+ }
1439
+ function sortDeps(depsSet) {
1440
+ var deps = new Set, setterDeps = new Set;
1441
+ return depsSet.forEach((function(dep) {
1442
+ isSetterHook(dep) ? setterDeps.add(dep) : deps.add(dep);
1443
+ })), [ deps, setterDeps ];
1444
+ }
1445
+ function NodeManager_createForOfIteratorHelper(r, e) {
1446
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1447
+ if (!t) {
1448
+ if (Array.isArray(r) || (t = NodeManager_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
1449
+ t && (r = t);
1450
+ var _n = 0, F = function F() {};
1451
+ return {
1452
+ s: F,
1453
+ n: function n() {
1454
+ return _n >= r.length ? {
1455
+ done: !0
1456
+ } : {
1457
+ done: !1,
1458
+ value: r[_n++]
1459
+ };
1460
+ },
1461
+ e: function e(r) {
1462
+ throw r;
1463
+ },
1464
+ f: F
1465
+ };
1466
+ }
1467
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1468
+ }
1469
+ var o, a = !0, u = !1;
1470
+ return {
1471
+ s: function s() {
1472
+ t = t.call(r);
1473
+ },
1474
+ n: function n() {
1475
+ var r = t.next();
1476
+ return a = r.done, r;
1477
+ },
1478
+ e: function e(r) {
1479
+ u = !0, o = r;
1480
+ },
1481
+ f: function f() {
1482
+ try {
1483
+ a || null == t.return || t.return();
1484
+ } finally {
1485
+ if (u) throw o;
1486
+ }
1487
+ }
1488
+ };
1489
+ }
1490
+ function NodeManager_typeof(o) {
1491
+ return NodeManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1492
+ return typeof o;
1493
+ } : function(o) {
1494
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1495
+ }, NodeManager_typeof(o);
1496
+ }
1497
+ function NodeManager_unsupportedIterableToArray(r, a) {
1498
+ if (r) {
1499
+ if ("string" == typeof r) return NodeManager_arrayLikeToArray(r, a);
1500
+ var t = {}.toString.call(r).slice(8, -1);
1501
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? NodeManager_arrayLikeToArray(r, a) : void 0;
1502
+ }
1503
+ }
1504
+ function NodeManager_arrayLikeToArray(r, a) {
1505
+ (null == a || a > r.length) && (a = r.length);
1506
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1507
+ return n;
1508
+ }
1509
+ function NodeManager_defineProperties(e, r) {
1510
+ for (var t = 0; t < r.length; t++) {
1511
+ var o = r[t];
1512
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
1513
+ Object.defineProperty(e, NodeManager_toPropertyKey(o.key), o);
1514
+ }
1515
+ }
1516
+ function NodeManager_defineProperty(e, r, t) {
1517
+ return (r = NodeManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1518
+ value: t,
1519
+ enumerable: !0,
1520
+ configurable: !0,
1521
+ writable: !0
1522
+ }) : e[r] = t, e;
1523
+ }
1524
+ function NodeManager_toPropertyKey(t) {
1525
+ var i = function NodeManager_toPrimitive(t, r) {
1526
+ if ("object" != NodeManager_typeof(t) || !t) return t;
1527
+ var e = t[Symbol.toPrimitive];
1528
+ if (void 0 !== e) {
1529
+ var i = e.call(t, r || "default");
1530
+ if ("object" != NodeManager_typeof(i)) return i;
1531
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1532
+ }
1533
+ return ("string" === r ? String : Number)(t);
1534
+ }(t, "string");
1535
+ return "symbol" == NodeManager_typeof(i) ? i : i + "";
1536
+ }
1537
+ function _classPrivateFieldGet(s, a) {
1538
+ return s.get(function _assertClassBrand(e, t, n) {
1539
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
1540
+ throw new TypeError("Private element is not present on this object");
1541
+ }(s, a));
1542
+ }
1543
+ var NodeManager_pendingPaintNodeManagers = NODES_STATE.pendingPaintNodeManagers, _nodeActions = new WeakMap, NodeManager = function() {
1544
+ return function NodeManager_createClass(e, r, t) {
1545
+ return r && NodeManager_defineProperties(e.prototype, r), t && NodeManager_defineProperties(e, t),
1546
+ Object.defineProperty(e, "prototype", {
1547
+ writable: !1
1548
+ }), e;
1549
+ }((function NodeManager() {
1550
+ !function NodeManager_classCallCheck(a, n) {
1551
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
1552
+ }(this, NodeManager), NodeManager_defineProperty(this, "stateNodes", {}), NodeManager_defineProperty(this, "conditionallyRenderingElements", {}),
1553
+ NodeManager_defineProperty(this, "bindableAttributesStateNodes", new Map(function NodeManager_toConsumableArray(r) {
1554
+ return function NodeManager_arrayWithoutHoles(r) {
1555
+ if (Array.isArray(r)) return NodeManager_arrayLikeToArray(r);
1556
+ }(r) || function NodeManager_iterableToArray(r) {
1557
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
1558
+ }(r) || NodeManager_unsupportedIterableToArray(r) || function NodeManager_nonIterableSpread() {
1559
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1560
+ }();
1561
+ }(BINDABLE_ATTRIBUTES_TO_STATE_NODES).map((function(attributeName) {
1562
+ return [ attributeName, new Map ];
1563
+ })))), function _classPrivateFieldInitSpec(e, t, a) {
1564
+ (function _checkPrivateRedeclaration(e, t) {
1565
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1566
+ })(e, t), t.set(e, a);
1567
+ }(this, _nodeActions, new Map), NodeManager_defineProperty(this, "paintStatus", null);
1568
+ }), [ {
1569
+ key: "addStateNode",
1570
+ value: function addStateNode(stateProp, stateNode) {
1571
+ this.stateNodes.hasOwnProperty(stateProp) || (this.stateNodes[stateProp] = new Set),
1572
+ this.stateNodes[stateProp].add(stateNode), SUPPORTED_ATTRIBUTES_FOR_BINDING.has(stateNode.nodeName) && this.bindableAttributesStateNodes.get(stateNode.nodeName).set(stateNode.originalOwnerElement, stateNode);
1573
+ }
1574
+ }, {
1575
+ key: "removeStateNode",
1576
+ value: function removeStateNode(stateProp, stateNode) {
1577
+ var _this$stateNodes;
1578
+ null === (_this$stateNodes = this.stateNodes) || void 0 === _this$stateNodes || _this$stateNodes[stateProp].delete(stateNode);
1579
+ }
1580
+ }, {
1581
+ key: "addConditionallyRenderingElements",
1582
+ value: function addConditionallyRenderingElements(stateProp, element) {
1583
+ var _element$host;
1584
+ this.conditionallyRenderingElements.hasOwnProperty(stateProp) || (this.conditionallyRenderingElements[stateProp] = new Set),
1585
+ element.originalParentElement = element.parentElement || (null === (_element$host = element.host) || void 0 === _element$host ? void 0 : _element$host.shadowRoot),
1586
+ this.conditionallyRenderingElements[stateProp].add(element);
1587
+ }
1588
+ }, {
1589
+ key: "addNodeAction",
1590
+ value: function addNodeAction(node, action) {
1591
+ _classPrivateFieldGet(_nodeActions, this).has(node) || _classPrivateFieldGet(_nodeActions, this).set(node, function getNewNodeActionsObject(nodeType) {
1592
+ switch (nodeType) {
1593
+ case Node.ATTRIBUTE_NODE:
1594
+ return {
1595
+ setAttribute: void 0
1596
+ };
1597
+
1598
+ case Node.TEXT_NODE:
1599
+ return {
1600
+ textContent: void 0
1601
+ };
1602
+
1603
+ case Node.ELEMENT_NODE:
1604
+ return {
1605
+ append: new Set,
1606
+ reattach: !1,
1607
+ setProperty: new Map,
1608
+ get hasPendingActions() {
1609
+ return this.append.size || this.reattach || this.setProperty.size;
1610
+ }
1611
+ };
1612
+ }
1613
+ }(node.nodeType));
1614
+ var nodeActions = _classPrivateFieldGet(_nodeActions, this).get(node), actionType = action.actionType, actionValue = action.actionValue;
1615
+ if (node.nodeType === Node.ELEMENT_NODE) switch (actionType) {
1616
+ case "append":
1617
+ nodeActions.append.add(actionValue);
1618
+ break;
1619
+
1620
+ case "setProperty":
1621
+ nodeActions.setProperty(actionValue.property, actionValue.value);
1622
+ break;
1623
+
1624
+ case "reattach":
1625
+ nodeActions.reattach = !0;
1626
+ } else nodeActions[actionType] = actionValue;
1627
+ this.paintStatus || (this.paintStatus = "pending");
1628
+ }
1629
+ }, {
1630
+ key: "queuePaint",
1631
+ value: function queuePaint() {
1632
+ "pending" === this.paintStatus && (NodeManager_pendingPaintNodeManagers.add(this),
1633
+ paint_utils_queuePaint(), this.paintStatus = "queued");
1634
+ }
1635
+ }, {
1636
+ key: "resolveToDOMActions",
1637
+ value: function resolveToDOMActions() {
1638
+ var attributeActions = [], textActions = [], elementActions = [], reattachActions = [], propertySetActions = [];
1639
+ return _classPrivateFieldGet(_nodeActions, this).forEach((function(nodeActions, node) {
1640
+ switch (node.nodeType) {
1641
+ case Node.ATTRIBUTE_NODE:
1642
+ var value = nodeActions.setAttribute, typeOfValue = NodeManager_typeof(value);
1643
+ if ("undefined" !== typeOfValue) if ("boolean" === typeOfValue) {
1644
+ if (!node.hasOwnProperty("originalOwnerElement")) throw Error("originalOwnerElement not found on boolean attribute node! Should never happen!");
1645
+ !1 === value ? node.originalOwnerElement.hasAttribute(node.name) && attributeActions.push((function() {
1646
+ node.originalOwnerElement.removeAttributeNode(node);
1647
+ })) : node.originalOwnerElement.hasAttribute(node.name) || attributeActions.push((function() {
1648
+ node.originalOwnerElement.setAttributeNode(node);
1649
+ }));
1650
+ } else "string" === typeOfValue && node.nodeValue !== value && attributeActions.push((function() {
1651
+ return node.nodeValue = value;
1652
+ }));
1653
+ break;
1654
+
1655
+ case Node.TEXT_NODE:
1656
+ if (void 0 !== nodeActions.textContent) {
1657
+ var _value = String(nodeActions.textContent);
1658
+ node.nodeValue !== _value && textActions.push((function() {
1659
+ return node.nodeValue = _value;
1660
+ }));
1661
+ }
1662
+ break;
1663
+
1664
+ case Node.ELEMENT_NODE:
1665
+ var _step, _iterator = NodeManager_createForOfIteratorHelper(nodeActions.append.values());
1666
+ try {
1667
+ var _loop = function _loop() {
1668
+ var newChildElement = _step.value;
1669
+ elementActions.push((function() {
1670
+ return node.appendChild(newChildElement);
1671
+ }));
1672
+ };
1673
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) _loop();
1674
+ } catch (err) {
1675
+ _iterator.e(err);
1676
+ } finally {
1677
+ _iterator.f();
1678
+ }
1679
+ var _step2, _node$pendingKeyMapAc, _iterator2 = NodeManager_createForOfIteratorHelper(nodeActions.setProperty);
1680
+ try {
1681
+ var _loop2 = function _loop2() {
1682
+ var _step2$value = function NodeManager_slicedToArray(r, e) {
1683
+ return function NodeManager_arrayWithHoles(r) {
1684
+ if (Array.isArray(r)) return r;
1685
+ }(r) || function NodeManager_iterableToArrayLimit(r, l) {
1686
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1687
+ if (null != t) {
1688
+ var e, n, i, u, a = [], f = !0, o = !1;
1689
+ try {
1690
+ if (i = (t = t.call(r)).next, 0 === l) {
1691
+ if (Object(t) !== t) return;
1692
+ f = !1;
1693
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
1694
+ } catch (r) {
1695
+ o = !0, n = r;
1696
+ } finally {
1697
+ try {
1698
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1699
+ } finally {
1700
+ if (o) throw n;
1701
+ }
1702
+ }
1703
+ return a;
1704
+ }
1705
+ }(r, e) || NodeManager_unsupportedIterableToArray(r, e) || function NodeManager_nonIterableRest() {
1706
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1707
+ }();
1708
+ }(_step2.value, 2), key = _step2$value[0], value = _step2$value[1];
1709
+ node[key] !== value && propertySetActions.push((function() {
1710
+ return node[key] = value;
1711
+ }));
1712
+ };
1713
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) _loop2();
1714
+ } catch (err) {
1715
+ _iterator2.e(err);
1716
+ } finally {
1717
+ _iterator2.f();
1718
+ }
1719
+ nodeActions.reattach && (reattachActions.push((function() {
1720
+ return node.reattach();
1721
+ })), null != node && null !== (_node$pendingKeyMapAc = node.pendingKeyMapActions) && void 0 !== _node$pendingKeyMapAc && _node$pendingKeyMapAc.size && reattachActions.push((function() {
1722
+ var _step3, _iterator3 = NodeManager_createForOfIteratorHelper(node.pendingKeyMapActions);
1723
+ try {
1724
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) (0, _step3.value)();
1725
+ } catch (err) {
1726
+ _iterator3.e(err);
1727
+ } finally {
1728
+ _iterator3.f();
1729
+ }
1730
+ node.pendingKeyMapActions.clear();
1731
+ })), nodeActions.reattach = !1);
1732
+ }
1733
+ })), _classPrivateFieldGet(_nodeActions, this).clear(), [ attributeActions, textActions, propertySetActions, elementActions, reattachActions ];
1734
+ }
1735
+ } ]);
1736
+ }();
1737
+ function StateManager_typeof(o) {
1738
+ return StateManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1739
+ return typeof o;
1740
+ } : function(o) {
1741
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1742
+ }, StateManager_typeof(o);
1743
+ }
1744
+ function StateManager_iterableToArray(r) {
1745
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
1746
+ }
1747
+ function StateManager_slicedToArray(r, e) {
1748
+ return StateManager_arrayWithHoles(r) || function StateManager_iterableToArrayLimit(r, l) {
1749
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1750
+ if (null != t) {
1751
+ var e, n, i, u, a = [], f = !0, o = !1;
1752
+ try {
1753
+ if (i = (t = t.call(r)).next, 0 === l) {
1754
+ if (Object(t) !== t) return;
1755
+ f = !1;
1756
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
1757
+ } catch (r) {
1758
+ o = !0, n = r;
1759
+ } finally {
1760
+ try {
1761
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1762
+ } finally {
1763
+ if (o) throw n;
1764
+ }
1765
+ }
1766
+ return a;
1767
+ }
1768
+ }(r, e) || StateManager_unsupportedIterableToArray(r, e) || StateManager_nonIterableRest();
1769
+ }
1770
+ function StateManager_nonIterableRest() {
1771
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1772
+ }
1773
+ function StateManager_unsupportedIterableToArray(r, a) {
1774
+ if (r) {
1775
+ if ("string" == typeof r) return StateManager_arrayLikeToArray(r, a);
1776
+ var t = {}.toString.call(r).slice(8, -1);
1777
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? StateManager_arrayLikeToArray(r, a) : void 0;
1778
+ }
1779
+ }
1780
+ function StateManager_arrayLikeToArray(r, a) {
1781
+ (null == a || a > r.length) && (a = r.length);
1782
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1783
+ return n;
1784
+ }
1785
+ function StateManager_arrayWithHoles(r) {
1786
+ if (Array.isArray(r)) return r;
1787
+ }
1788
+ function StateManager_defineProperties(e, r) {
1789
+ for (var t = 0; t < r.length; t++) {
1790
+ var o = r[t];
1791
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
1792
+ Object.defineProperty(e, StateManager_toPropertyKey(o.key), o);
1793
+ }
1794
+ }
1795
+ function StateManager_defineProperty(e, r, t) {
1796
+ return (r = StateManager_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1797
+ value: t,
1798
+ enumerable: !0,
1799
+ configurable: !0,
1800
+ writable: !0
1801
+ }) : e[r] = t, e;
1802
+ }
1803
+ function StateManager_toPropertyKey(t) {
1804
+ var i = function StateManager_toPrimitive(t, r) {
1805
+ if ("object" != StateManager_typeof(t) || !t) return t;
1806
+ var e = t[Symbol.toPrimitive];
1807
+ if (void 0 !== e) {
1808
+ var i = e.call(t, r || "default");
1809
+ if ("object" != StateManager_typeof(i)) return i;
1810
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1811
+ }
1812
+ return ("string" === r ? String : Number)(t);
1813
+ }(t, "string");
1814
+ return "symbol" == StateManager_typeof(i) ? i : i + "";
1815
+ }
1816
+ function StateManager_classPrivateFieldGet(s, a) {
1817
+ return s.get(function StateManager_assertClassBrand(e, t, n) {
1818
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
1819
+ throw new TypeError("Private element is not present on this object");
1820
+ }(s, a));
1821
+ }
1822
+ var stateChangeHandlers = new Map, _plugins = new WeakMap, StateManager = function() {
1823
+ return function StateManager_createClass(e, r, t) {
1824
+ return r && StateManager_defineProperties(e.prototype, r), t && StateManager_defineProperties(e, t),
1825
+ Object.defineProperty(e, "prototype", {
1826
+ writable: !1
1827
+ }), e;
1828
+ }((function StateManager(initialState, parentStateProp, parentStateManager) {
1829
+ var _this = this, handleStateFunction = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : handleStateChange, isGlobal = arguments.length > 4 && void 0 !== arguments[4] && arguments[4], appScope = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : window;
1830
+ if (function StateManager_classCallCheck(a, n) {
1831
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
1832
+ }(this, StateManager), StateManager_defineProperty(this, "isInitializing", !1),
1833
+ StateManager_defineProperty(this, "privateState", {}), StateManager_defineProperty(this, "state", new EventTarget),
1834
+ StateManager_defineProperty(this, "stateDependencies", new Map), StateManager_defineProperty(this, "parentStateProp", void 0),
1835
+ StateManager_defineProperty(this, "parentStateManager", void 0), StateManager_defineProperty(this, "dirtyProps", new Set),
1836
+ StateManager_defineProperty(this, "nodeManager", new NodeManager), function StateManager_classPrivateFieldInitSpec(e, t, a) {
1837
+ (function StateManager_checkPrivateRedeclaration(e, t) {
1838
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1839
+ })(e, t), t.set(e, a);
1840
+ }(this, _plugins, new Set), this.isInitializing = !0, this.parentStateProp = parentStateProp,
1841
+ this.parentStateManager = parentStateManager, this.handleStateChange = handleStateFunction,
1842
+ this.appScope = appScope, setHiddenProperty(this.state, "_stateManager", this, !0),
1843
+ this.state.$$isInitializing = !0, this.state.populate = function(populateObject) {
1844
+ for (var property in populateObject) this.hasOwnProperty(property) && (this[property] = populateObject[property]);
1845
+ }, parentStateProp && parentStateManager && (this.state = function makeReactive(stateObject) {
1846
+ var appScope = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : window;
1847
+ return new Proxy(stateObject, function StateObjectValueHandler(rootStateObj, objPropertyName) {
1848
+ var appScope = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : window;
1849
+ return {
1850
+ set: function set(targetObj, property, value) {
1851
+ if (isBuiltInStateProp(property)) return Reflect.set.apply(Reflect, arguments);
1852
+ var _stateManager$parentS, setResult = Reflect.set.apply(Reflect, arguments), stateManager = rootStateObj._stateManager;
1853
+ return stateManager.parentStateManager && (performance.mark("todo-array-set-dirty-prop"),
1854
+ null === (_stateManager$parentS = stateManager.parentStateManager) || void 0 === _stateManager$parentS || _stateManager$parentS.setDirtyProp(objPropertyName)),
1855
+ setResult;
1856
+ },
1857
+ defineProperty: function defineProperty(targetObj, property, descriptor) {
1858
+ return isBuiltInStateProp(property) ? Reflect.defineProperty.apply(Reflect, arguments) : (void 0 !== (null == descriptor ? void 0 : descriptor.value) && (descriptor.value = statifyValue(descriptor.value, property, rootStateObj._stateManager, appScope)),
1859
+ Reflect.defineProperty(targetObj, property, descriptor));
1860
+ },
1861
+ get: function get(targetObj, property, receiver) {
1862
+ var getResult = Reflect.get.apply(Reflect, arguments);
1863
+ return "function" == typeof getResult ? getResult.bind(targetObj) : getResult;
1864
+ }
1865
+ };
1866
+ }(stateObject, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, appScope));
1867
+ }(this.state, parentStateProp, appScope)), isGlobal) this.globalStateDependencies = new Map,
1868
+ this.addGlobalStateDependency = function(stateProp, depStateProp, localStateManager) {
1869
+ _this.globalStateDependencies.has(stateProp) || _this.globalStateDependencies.set(stateProp, new Map);
1870
+ var globalDeps = _this.globalStateDependencies.get(stateProp);
1871
+ globalDeps.has(localStateManager) || globalDeps.set(localStateManager, new Set),
1872
+ globalDeps.get(localStateManager).add(depStateProp);
1873
+ }; else {
1874
+ var globalState = appScope.getGlobalState();
1875
+ setHiddenProperty(this.state, "_global", globalState, !0);
1876
+ }
1877
+ !function populateInitialState(stateManager, initialState) {
1878
+ (function populateStateFromInitialState(stateManager, initialState) {
1879
+ var appScope = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : window, state = stateManager.state, descriptors = Object.getOwnPropertyDescriptors(initialState), _loop = function _loop(key) {
1880
+ var descrp = descriptors[key];
1881
+ if (isBuiltInStateProp(key)) return Object.defineProperty(state, key, descrp), 1;
1882
+ var stateHook = function getStateHookData(descriptor, property) {
1883
+ if (descriptor.get && "function" == typeof descriptor.get) return {
1884
+ nativeGetter: !0,
1885
+ func: descriptor.get,
1886
+ deps: "auto",
1887
+ reevaluate: !1,
1888
+ init: !1,
1889
+ isSetter: !1
1890
+ };
1891
+ if (descriptor.value) {
1892
+ var value = descriptor.value;
1893
+ if (0 === property.indexOf("set_")) {
1894
+ if (!Array.isArray(value)) throw Error("State setter hooks must be arrays!");
1895
+ var hookOptions = value[1] || {};
1896
+ return {
1897
+ nativeGetter: !1,
1898
+ func: value[0],
1899
+ deps: hookOptions.deps && Array.isArray(hookOptions.deps) ? hookOptions.deps : "auto",
1900
+ reevaluate: !!hookOptions.reevaluate,
1901
+ init: !!hookOptions.init,
1902
+ once: !!hookOptions.once,
1903
+ stateMap: !!hookOptions.stateMap,
1904
+ statify: !!hookOptions.statify,
1905
+ isSetter: 0 === property.indexOf("set_")
1906
+ };
1907
+ }
1908
+ }
1909
+ }(descrp, key);
1910
+ if (stateHook) {
1911
+ var statePropName = stateHook.isSetter ? key.substring(4) : key;
1912
+ if (stateHook.func.bind(state), stateHook.isSetter && !stateHook.nativeGetter) initSetterHook(descrp.value, statePropName, stateManager, appScope),
1913
+ stateHook.once && (descrp.configurable = !0), Object.defineProperty(state, key, descrp); else if (stateHook.nativeGetter) {
1914
+ descrp.get.isStateGetter = !0;
1915
+ var _getDeps4 = Cougar_state_utils_slicedToArray(getDeps(descrp.get, state), 2), deps = _getDeps4[0], globalDeps = _getDeps4[1];
1916
+ deps.forEach((function(dep) {
1917
+ stateManager.addStateDependency(dep, key);
1918
+ })), null == globalDeps || globalDeps.forEach((function(dep) {
1919
+ stateManager.addStateDependency(dep, key), state._global._stateManager.addGlobalStateDependency(dep, key, stateManager);
1920
+ })), descrp.get.bind(state), Object.defineProperty(state, statePropName, descrp);
1921
+ }
1922
+ } else if (descrp.hasOwnProperty("value")) {
1923
+ var stateProp = key, value = statifyValue(descrp.value, stateProp, stateManager, appScope);
1924
+ stateManager.privateState.hasOwnProperty(stateProp) || (stateManager.privateState[stateProp] = value),
1925
+ Object.defineProperty(state, stateProp, {
1926
+ set: function set(value) {
1927
+ value !== stateManager.privateState[stateProp] && (value = statifyValue(value, stateProp, stateManager, appScope),
1928
+ stateManager.privateState[stateProp] = value, stateManager.setDirtyProp(stateProp),
1929
+ stateManager.setDirtyProp("".concat(stateProp, ".length")));
1930
+ },
1931
+ get: function get() {
1932
+ return stateManager.privateState[stateProp];
1933
+ }
1934
+ });
1935
+ }
1936
+ };
1937
+ for (var key in descriptors) _loop(key);
1938
+ })(stateManager, initialState, arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : window);
1939
+ }(this, initialState, appScope), delete this.state.$$isInitializing, setHiddenProperty(this.state, "_isStateManager", !0),
1940
+ setHiddenProperty(this.state, "_isActive", !0, !1), this.isInitializing = !1;
1941
+ }), [ {
1942
+ key: "setDirtyProp",
1943
+ value: function setDirtyProp(prop) {
1944
+ var queueHandleState = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
1945
+ if (!this.state.$$isInitializing) {
1946
+ var lengthIndex = prop.indexOf(".length"), checkProp = lengthIndex > 0 ? prop.substring(0, lengthIndex) : prop;
1947
+ if (!Object.hasOwn(this.state, checkProp)) throw Error("Error in setDirtyProp. State has no property: '".concat(prop, "'. This should never happen"));
1948
+ this.dirtyProps.add(prop), Array.isArray(this.state[checkProp]) && (this.state[checkProp].lastDirtyTimestamp = (new Date).getTime()),
1949
+ queueHandleState && function queueStateChange(element, stateChangeHandler) {
1950
+ stateChangeHandlers.set(element, stateChangeHandler), queueAnimationFrame(Array.from(stateChangeHandlers.values()), "STATE_CHANGE", (function() {
1951
+ return stateChangeHandlers.clear();
1952
+ }));
1953
+ }(this, this.handleStateChanges.bind(this));
1954
+ }
1955
+ }
1956
+ }, {
1957
+ key: "handleStatePropDependencies",
1958
+ value: function handleStatePropDependencies(depStateProps) {
1959
+ var _this2 = this, dependenciesMap = this.stateDependencies, globalDependenciesMap = null == this ? void 0 : this.globalStateDependencies;
1960
+ depStateProps.forEach((function(depStateProp) {
1961
+ !function handleStateDependency(stateManager, depStateProp) {
1962
+ var appScope = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : window, state = stateManager.state;
1963
+ if (isSetterHook(depStateProp)) {
1964
+ var setterHook = state[depStateProp], setterStateProp = depStateProp.substring(4);
1965
+ callSetterHook(setterHook, setterStateProp, stateManager, appScope) && handleStateChange(stateManager, setterStateProp, null, appScope.offscreenContainer);
1966
+ } else if (depStateProp.indexOf(".length") > 0) {
1967
+ var realProp = depStateProp.split(".")[0];
1968
+ handleStateChange(stateManager, depStateProp, stateManager.state[realProp].length, appScope.offscreenContainer);
1969
+ } else handleStateChange(stateManager, depStateProp, null, appScope.offscreenContainer);
1970
+ }(_this2, depStateProp, _this2.appScope);
1971
+ var changedStateProp = isSetterHook(depStateProp) ? depStateProp.substring(4) : depStateProp;
1972
+ if (null != dependenciesMap && dependenciesMap.has(changedStateProp)) {
1973
+ var _sortDeps2 = StateManager_slicedToArray(sortDeps(dependenciesMap.get(changedStateProp)), 2), deps = _sortDeps2[0], setterDeps = _sortDeps2[1];
1974
+ setterDeps.size && _this2.handleStatePropDependencies(setterDeps), deps.size && _this2.handleStatePropDependencies(deps);
1975
+ }
1976
+ null != globalDependenciesMap && globalDependenciesMap.has(changedStateProp) && globalDependenciesMap.get(changedStateProp).forEach((function(depsSet, localStateManager) {
1977
+ var _sortDeps4 = StateManager_slicedToArray(sortDeps(depsSet), 2), deps = _sortDeps4[0], setterDeps = _sortDeps4[1];
1978
+ setterDeps.size && localStateManager.handleStatePropDependencies(setterDeps), deps.size && localStateManager.handleStatePropDependencies(deps);
1979
+ }));
1980
+ }));
1981
+ }
1982
+ }, {
1983
+ key: "isGlobalState",
1984
+ value: function isGlobalState() {
1985
+ return !this.state.hasOwnProperty("_global");
1986
+ }
1987
+ }, {
1988
+ key: "topologicalSortStateProps",
1989
+ value: function topologicalSortStateProps(stateProps) {
1990
+ var _this3 = this;
1991
+ return function StateManager_toConsumableArray(r) {
1992
+ return function StateManager_arrayWithoutHoles(r) {
1993
+ if (Array.isArray(r)) return StateManager_arrayLikeToArray(r);
1994
+ }(r) || StateManager_iterableToArray(r) || StateManager_unsupportedIterableToArray(r) || function StateManager_nonIterableSpread() {
1995
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1996
+ }();
1997
+ }(stateProps).toSorted((function(a, b) {
1998
+ var _this3$stateDependenc, _this3$stateDependenc2;
1999
+ return a.startsWith(b + ".") ? 1 : b.startsWith(a + ".") ? -1 : ((null === (_this3$stateDependenc = _this3.stateDependencies[a]) || void 0 === _this3$stateDependenc ? void 0 : _this3$stateDependenc.size) || 0) - (null === (_this3$stateDependenc2 = _this3.stateDependencies[b]) || void 0 === _this3$stateDependenc2 ? void 0 : _this3$stateDependenc2.size) || 0;
2000
+ }));
2001
+ }
2002
+ }, {
2003
+ key: "handleStateChanges",
2004
+ value: function handleStateChanges() {
2005
+ var _this4 = this;
2006
+ if (this.dirtyProps.size) {
2007
+ performance.mark("todo-topological-sort");
2008
+ var stateProps = this.topologicalSortStateProps(this.dirtyProps);
2009
+ this.dirtyProps.clear(), this.isGlobalState();
2010
+ var deps = new Set, setterDeps = new Set, globalDeps = new Set, thisStateManager = this, thisState = thisStateManager.state;
2011
+ stateProps.forEach((function(stateProp) {
2012
+ var _thisStateManager$sta;
2013
+ if (isSetterHook(stateProp)) {
2014
+ stateProp = stateProp.substring(4);
2015
+ var setterHook = thisState[stateProp];
2016
+ performance.mark("todo-call-setter-hook"), callSetterHook(setterHook, stateProp, thisStateManager, _this4.appScope) && _this4.handleStateChange(thisStateManager, stateProp, null);
2017
+ } else _this4.handleStateChange(thisStateManager, stateProp, null);
2018
+ thisStateManager.stateDependencies.has(stateProp) && thisStateManager.stateDependencies.get(stateProp).forEach((function(dep) {
2019
+ isSetterHook(dep) ? setterDeps.add(dep) : deps.add(dep);
2020
+ }));
2021
+ var globalState = null === (_thisStateManager$sta = thisStateManager.state) || void 0 === _thisStateManager$sta ? void 0 : _thisStateManager$sta._global;
2022
+ if (globalState === GLOBAL_STATE_NOT_SET_YET && (globalState = _this4.appScope.getGlobalState()),
2023
+ globalState !== GLOBAL_STATE_NOT_SET_YET) {
2024
+ var _globalState, globalStateManager = (null === (_globalState = globalState) || void 0 === _globalState ? void 0 : _globalState._stateManager) || thisStateManager;
2025
+ globalStateManager.globalStateDependencies.has(stateProp) && globalDeps.add(globalStateManager.globalStateDependencies.get(stateProp));
2026
+ }
2027
+ })), setterDeps.size && this.handleStatePropDependencies(setterDeps), deps.size && this.handleStatePropDependencies(deps),
2028
+ globalDeps.size && globalDeps.forEach((function(deps, localStateManager) {
2029
+ localStateManager.handleStatePropDependencies(deps);
2030
+ })), thisStateManager.clearStateMapsLastOperation(), this.parentStateManager && this.parentStateManager.setDirtyProp(this.parentStateProp);
2031
+ }
2032
+ }
2033
+ }, {
2034
+ key: "addStateDependency",
2035
+ value: function addStateDependency(stateProp, depStateProp) {
2036
+ this.stateDependencies.has(stateProp) || this.stateDependencies.set(stateProp, new Set),
2037
+ this.stateDependencies.get(stateProp).add(depStateProp), Array.isArray(this.state[stateProp]) && this.addStateDependency("".concat(stateProp, ".length"), depStateProp);
2038
+ }
2039
+ }, {
2040
+ key: "clearStateDependencies",
2041
+ value: function clearStateDependencies(stateProp) {
2042
+ this.stateDependencies.has(stateProp) && this.stateDependencies.set(stateProp, new Set);
2043
+ }
2044
+ }, {
2045
+ key: "addStateNode",
2046
+ value: function addStateNode(stateProp, stateNode) {
2047
+ this.nodeManager.addStateNode(stateProp, stateNode);
2048
+ }
2049
+ }, {
2050
+ key: "removeStateNode",
2051
+ value: function removeStateNode(stateProp, stateNode) {
2052
+ this.nodeManager.removeStateNode(stateProp, stateNode);
2053
+ }
2054
+ }, {
2055
+ key: "bindStatePropExpression",
2056
+ value: function bindStatePropExpression(statePropExpression, type, args) {
2057
+ if (!type || !args) {
2058
+ var _parseStateExpression2 = function StateManager_toArray(r) {
2059
+ return StateManager_arrayWithHoles(r) || StateManager_iterableToArray(r) || StateManager_unsupportedIterableToArray(r) || StateManager_nonIterableRest();
2060
+ }(parseStateExpression(statePropExpression));
2061
+ type = _parseStateExpression2[0], args = _parseStateExpression2.slice(1);
2062
+ }
2063
+ var contextStateProp = args[0];
2064
+ if (!contextStateProp) throw Error("Must specify state property name for State expression: ".concat(statePropExpression));
2065
+ var stateObj = this.state, descriptor = Object.getOwnPropertyDescriptor(stateObj, contextStateProp);
2066
+ if (descriptor || (stateObj = stateObj._global, descriptor = Object.getOwnPropertyDescriptor(stateObj, contextStateProp)),
2067
+ !descriptor) throw Error("Could not bind state property ".concat(contextStateProp, ". State property ").concat(contextStateProp, " not defined!"));
2068
+ if (Object.hasOwn(stateObj, statePropExpression)) return stateObj[statePropExpression];
2069
+ var isValueProp = descriptor.hasOwnProperty("value");
2070
+ switch (type) {
2071
+ case "negation":
2072
+ var relevantState = isValueProp ? this.privateState : this.state;
2073
+ defineStateExpressionResolver(statePropExpression, stateObj, (function getter() {
2074
+ return !relevantState[contextStateProp];
2075
+ }), contextStateProp);
2076
+ break;
2077
+
2078
+ case "equality":
2079
+ var equalityValue = args[1];
2080
+ if (!equalityValue) throw Error("Must specify equality value for equality expression (is_something:equalToThis)");
2081
+ var _relevantState = isValueProp ? this.privateState : this.state;
2082
+ defineStateExpressionResolver(statePropExpression, stateObj, (function getter() {
2083
+ return _relevantState[contextStateProp] === equalityValue;
2084
+ }), contextStateProp);
2085
+ break;
2086
+
2087
+ case "ternary":
2088
+ var truthyValue = args[1];
2089
+ if (!truthyValue) throw Error("Ternary state expression (prop?truthy:falsy) must include at least a truthy value!");
2090
+ var falsyValue = args[2], _relevantState2 = isValueProp ? this.privateState : this.state;
2091
+ defineStateExpressionResolver(statePropExpression, stateObj, falsyValue ? function() {
2092
+ return _relevantState2[contextStateProp] ? truthyValue : falsyValue;
2093
+ } : function() {
2094
+ return _relevantState2[contextStateProp] ? truthyValue : void 0;
2095
+ }, contextStateProp);
2096
+ }
2097
+ return stateObj[statePropExpression];
2098
+ }
2099
+ }, {
2100
+ key: "getStateDependencies",
2101
+ value: function getStateDependencies() {
2102
+ return this.stateDependencies;
2103
+ }
2104
+ }, {
2105
+ key: "use",
2106
+ value: function use(factoryFunction, pluginName) {
2107
+ factoryFunction.call(this), StateManager_classPrivateFieldGet(_plugins, this).add(pluginName);
2108
+ }
2109
+ }, {
2110
+ key: "isUsing",
2111
+ value: function isUsing(pluginName) {
2112
+ return StateManager_classPrivateFieldGet(_plugins, this).has(pluginName);
2113
+ }
2114
+ } ]);
2115
+ }();
2116
+ const Cougar_StateManager = StateManager;
2117
+ function getStatefulChild(child) {
2118
+ return Object.hasOwn(child, "state") ? child : child.firstElementChild;
2119
+ }
2120
+ var HTMLElementMapParent = {
2121
+ replaceChildWith: function replaceChildWith(oldChild, newChild) {
2122
+ var _statefulOldChild$sta, _statefulOldChild$sta2, _newChild$stateKey, statefulOldChild = getStatefulChild(oldChild), oldKey = null !== (_statefulOldChild$sta = null == statefulOldChild || null === (_statefulOldChild$sta2 = statefulOldChild.state) || void 0 === _statefulOldChild$sta2 ? void 0 : _statefulOldChild$sta2.key) && void 0 !== _statefulOldChild$sta ? _statefulOldChild$sta : oldChild.stateKey, statefulNewChild = getStatefulChild(newChild), newKey = null !== (_newChild$stateKey = newChild.stateKey) && void 0 !== _newChild$stateKey ? _newChild$stateKey : statefulNewChild.stateKey, replacedChild = this.replaceChild(newChild, oldChild);
2123
+ return this.keyMap.delete(oldKey), this.keyMap.set(newKey, newChild), replacedChild;
2124
+ },
2125
+ swapChildWith: function swapChildWith(oldChild, newChild) {
2126
+ if (oldChild !== newChild) {
2127
+ var oldNext = oldChild.nextSiblingElement, newNext = newChild.nextSiblingElement;
2128
+ this.insertBefore(oldChild, newNext), this.insertBefore(newChild, oldNext);
2129
+ }
2130
+ },
2131
+ removeChild: function removeChild(child) {
2132
+ var _child$stateKey, statefulChild = getStatefulChild(child), key = null !== (_child$stateKey = child.stateKey) && void 0 !== _child$stateKey ? _child$stateKey : statefulChild.stateKey;
2133
+ HTMLElement.prototype.removeChild.call(this, child), this.keyMap.delete(key);
2134
+ },
2135
+ insertBefore: function insertBefore(newChild, beforeChild) {
2136
+ var _newChild$stateKey2;
2137
+ HTMLElement.prototype.insertBefore.call(this, newChild, beforeChild);
2138
+ var statefulNewChild = getStatefulChild(newChild), key = null !== (_newChild$stateKey2 = newChild.stateKey) && void 0 !== _newChild$stateKey2 ? _newChild$stateKey2 : statefulNewChild.stateKey;
2139
+ this.keyMap.set(key, newChild);
2140
+ },
2141
+ append: function append() {
2142
+ for (var _HTMLElement$prototyp, _len = arguments.length, elements = new Array(_len), _key = 0; _key < _len; _key++) elements[_key] = arguments[_key];
2143
+ (_HTMLElement$prototyp = HTMLElement.prototype.append).call.apply(_HTMLElement$prototyp, [ this ].concat(elements));
2144
+ for (var _i = 0, _elements = elements; _i < _elements.length; _i++) {
2145
+ var _element$stateKey, element = _elements[_i], statefulChild = getStatefulChild(element), key = null !== (_element$stateKey = element.stateKey) && void 0 !== _element$stateKey ? _element$stateKey : statefulChild.stateKey;
2146
+ this.keyMap.set(key, element);
2147
+ }
2148
+ },
2149
+ appendChild: function appendChild(newChild) {
2150
+ var _newChild$stateKey3;
2151
+ HTMLElement.prototype.appendChild.call(this, newChild);
2152
+ var statefulChild = getStatefulChild(newChild), key = null !== (_newChild$stateKey3 = newChild.stateKey) && void 0 !== _newChild$stateKey3 ? _newChild$stateKey3 : statefulChild.stateKey;
2153
+ this.keyMap.set(key, newChild);
2154
+ },
2155
+ prepend: function prepend(newChild) {
2156
+ var _newChild$stateKey4;
2157
+ HTMLElement.prototype.prepend.call(this, newChild);
2158
+ var statefulChild = getStatefulChild(newChild), key = null !== (_newChild$stateKey4 = newChild.stateKey) && void 0 !== _newChild$stateKey4 ? _newChild$stateKey4 : statefulChild.stateKey;
2159
+ this.keyMap.set(key, newChild);
2160
+ },
2161
+ detach: function detach() {
2162
+ var returnElement;
2163
+ if (arguments.length > 0 && void 0 !== arguments[0] && arguments[0]) {
2164
+ var cloned = this.cloneNode(!0);
2165
+ cloned.$$originalElement = this, cloned.$$detached = DETACH_METHOD.CLONE, returnElement = cloned;
2166
+ } else this.setAttribute("inert", ""), this.classList.add("sprout-frozen"), this.$$detached = DETACH_METHOD.HIDE_UNHIDE,
2167
+ returnElement = this;
2168
+ return returnElement;
2169
+ },
2170
+ reattach: function reattach() {
2171
+ this.$$detached === DETACH_METHOD.HIDE_UNHIDE ? (this.removeAttribute("inert", ""),
2172
+ this.classList.remove("sprout-frozen")) : this.$$detached === DETACH_METHOD.CLONE && this.$$originalElement.replaceWith(this),
2173
+ this.$$detached = void 0;
2174
+ },
2175
+ initialAppend: function initialAppend() {
2176
+ for (var _HTMLElement$prototyp2, _this = this, _len2 = arguments.length, elements = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) elements[_key2] = arguments[_key2];
2177
+ (_HTMLElement$prototyp2 = HTMLElement.prototype.append).call.apply(_HTMLElement$prototyp2, [ this ].concat(elements));
2178
+ for (var _loop = function _loop() {
2179
+ var element = _elements2[_i2];
2180
+ _this.pendingKeyMapActions.add((function() {
2181
+ var statefulChild = getStatefulChild(element);
2182
+ if (statefulChild.isActive) {
2183
+ var _statefulChild$state$, _statefulChild$state, key = null !== (_statefulChild$state$ = null == statefulChild || null === (_statefulChild$state = statefulChild.state) || void 0 === _statefulChild$state ? void 0 : _statefulChild$state.key) && void 0 !== _statefulChild$state$ ? _statefulChild$state$ : element.stateKey;
2184
+ _this.keyMap.set(key, element);
2185
+ } else statefulChild.addEventListener("active", (function() {
2186
+ var _statefulChild$state$2, _statefulChild$state2, key = null !== (_statefulChild$state$2 = null == statefulChild || null === (_statefulChild$state2 = statefulChild.state) || void 0 === _statefulChild$state2 ? void 0 : _statefulChild$state2.key) && void 0 !== _statefulChild$state$2 ? _statefulChild$state$2 : element.stateKey;
2187
+ _this.keyMap.set(key, element);
2188
+ }), {
2189
+ once: !0
2190
+ });
2191
+ }));
2192
+ }, _i2 = 0, _elements2 = elements; _i2 < _elements2.length; _i2++) _loop();
2193
+ }
2194
+ };
2195
+ function commands_slicedToArray(r, e) {
2196
+ return function commands_arrayWithHoles(r) {
2197
+ if (Array.isArray(r)) return r;
2198
+ }(r) || function commands_iterableToArrayLimit(r, l) {
2199
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2200
+ if (null != t) {
2201
+ var e, n, i, u, a = [], f = !0, o = !1;
2202
+ try {
2203
+ if (i = (t = t.call(r)).next, 0 === l) {
2204
+ if (Object(t) !== t) return;
2205
+ f = !1;
2206
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
2207
+ } catch (r) {
2208
+ o = !0, n = r;
2209
+ } finally {
2210
+ try {
2211
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2212
+ } finally {
2213
+ if (o) throw n;
2214
+ }
2215
+ }
2216
+ return a;
2217
+ }
2218
+ }(r, e) || commands_unsupportedIterableToArray(r, e) || function commands_nonIterableRest() {
2219
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2220
+ }();
2221
+ }
2222
+ function commands_unsupportedIterableToArray(r, a) {
2223
+ if (r) {
2224
+ if ("string" == typeof r) return commands_arrayLikeToArray(r, a);
2225
+ var t = {}.toString.call(r).slice(8, -1);
2226
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? commands_arrayLikeToArray(r, a) : void 0;
2227
+ }
2228
+ }
2229
+ function commands_arrayLikeToArray(r, a) {
2230
+ (null == a || a > r.length) && (a = r.length);
2231
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2232
+ return n;
2233
+ }
2234
+ var COMMANDS = {
2235
+ map: function map(commandValue) {
2236
+ var _commandValue$split2 = commands_slicedToArray(commandValue.split(":"), 2), stateItemsPropertyName = _commandValue$split2[0], customElementName = _commandValue$split2[1], thiselement = this;
2237
+ !function makeElementMapParent(parentElement) {
2238
+ Object.assign(parentElement, HTMLElementMapParent), parentElement.keyMap = new Map,
2239
+ parentElement.pendingKeyMapActions = new Set, parentElement.style.willChange = "opacity";
2240
+ }(thiselement), this.onAfterPaint((function() {
2241
+ var theState = function mapStateToElements(stateItemsPropertyName, customElementName, parentElement) {
2242
+ var _parentElement$getSta2 = commands_slicedToArray(parentElement.getState(stateItemsPropertyName, !0), 2), stateItemsArray = _parentElement$getSta2[0], theState = _parentElement$getSta2[1];
2243
+ stateItemsArray.makeStateMap();
2244
+ var elements = mapStateArrayToElements(stateItemsArray, customElementName, isElementAList(parentElement) ? "li" : void 0, parentElement);
2245
+ return parentElement.innerHTML = "", elements.length && parentElement.append.apply(parentElement, function commands_toConsumableArray(r) {
2246
+ return function commands_arrayWithoutHoles(r) {
2247
+ if (Array.isArray(r)) return commands_arrayLikeToArray(r);
2248
+ }(r) || function commands_iterableToArray(r) {
2249
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2250
+ }(r) || commands_unsupportedIterableToArray(r) || function commands_nonIterableSpread() {
2251
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2252
+ }();
2253
+ }(elements)), theState;
2254
+ }(stateItemsPropertyName, customElementName, thiselement);
2255
+ if (!theState) throw new Error("Mapping ".concat(stateItemsPropertyName, " to ").concat(customElementName, " failed!"));
2256
+ var stateArray = theState[stateItemsPropertyName];
2257
+ if (!stateArray || !stateArray.hasOwnProperty("_isStatefulArray")) throw new Error("State array ".concat(stateItemsPropertyName, " for State Map must be stateful!"));
2258
+ theState._stateManager.addStateMap(stateItemsPropertyName, customElementName, thiselement);
2259
+ }));
2260
+ },
2261
+ bind: function bind(commandValue) {
2262
+ var _commandValue$split4 = commands_slicedToArray(commandValue.split(":"), 2), attributeName = _commandValue$split4[0], statePropName = _commandValue$split4[1];
2263
+ this.bindAttributeToState(attributeName, statePropName);
2264
+ },
2265
+ bindprop: function bindprop(commandValue) {
2266
+ var _commandValue$split6 = commands_slicedToArray(commandValue.split(":"), 2), statePropName = _commandValue$split6[0], elementPropName = _commandValue$split6[1], _this$getState2 = commands_slicedToArray(this.getState(statePropName, !0), 2), stateObject = (_this$getState2[0],
2267
+ _this$getState2[1]);
2268
+ this[elementPropName] = stateObject[statePropName];
2269
+ }
2270
+ };
2271
+ function ReactiveElement_typeof(o) {
2272
+ return ReactiveElement_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
2273
+ return typeof o;
2274
+ } : function(o) {
2275
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
2276
+ }, ReactiveElement_typeof(o);
2277
+ }
2278
+ function ReactiveElement_get() {
2279
+ return ReactiveElement_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, r) {
2280
+ var p = function ReactiveElement_superPropBase(t, o) {
2281
+ for (;!{}.hasOwnProperty.call(t, o) && null !== (t = ReactiveElement_getPrototypeOf(t)); ) ;
2282
+ return t;
2283
+ }(e, t);
2284
+ if (p) {
2285
+ var n = Object.getOwnPropertyDescriptor(p, t);
2286
+ return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
2287
+ }
2288
+ }, ReactiveElement_get.apply(null, arguments);
2289
+ }
2290
+ function ReactiveElement_unsupportedIterableToArray(r, a) {
2291
+ if (r) {
2292
+ if ("string" == typeof r) return ReactiveElement_arrayLikeToArray(r, a);
2293
+ var t = {}.toString.call(r).slice(8, -1);
2294
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? ReactiveElement_arrayLikeToArray(r, a) : void 0;
2295
+ }
2296
+ }
2297
+ function ReactiveElement_arrayLikeToArray(r, a) {
2298
+ (null == a || a > r.length) && (a = r.length);
2299
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2300
+ return n;
2301
+ }
2302
+ function ReactiveElement_classCallCheck(a, n) {
2303
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
2304
+ }
2305
+ function ReactiveElement_defineProperties(e, r) {
2306
+ for (var t = 0; t < r.length; t++) {
2307
+ var o = r[t];
2308
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
2309
+ Object.defineProperty(e, ReactiveElement_toPropertyKey(o.key), o);
2310
+ }
2311
+ }
2312
+ function ReactiveElement_createClass(e, r, t) {
2313
+ return r && ReactiveElement_defineProperties(e.prototype, r), t && ReactiveElement_defineProperties(e, t),
2314
+ Object.defineProperty(e, "prototype", {
2315
+ writable: !1
2316
+ }), e;
2317
+ }
2318
+ function ReactiveElement_callSuper(t, o, e) {
2319
+ return o = ReactiveElement_getPrototypeOf(o), function ReactiveElement_possibleConstructorReturn(t, e) {
2320
+ if (e && ("object" == ReactiveElement_typeof(e) || "function" == typeof e)) return e;
2321
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
2322
+ return function ReactiveElement_assertThisInitialized(e) {
2323
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2324
+ return e;
2325
+ }(t);
2326
+ }(t, ReactiveElement_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ReactiveElement_getPrototypeOf(t).constructor) : o.apply(t, e));
2327
+ }
2328
+ function ReactiveElement_isNativeReflectConstruct() {
2329
+ try {
2330
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
2331
+ } catch (t) {}
2332
+ return (ReactiveElement_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2333
+ return !!t;
2334
+ })();
2335
+ }
2336
+ function ReactiveElement_getPrototypeOf(t) {
2337
+ return ReactiveElement_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
2338
+ return t.__proto__ || Object.getPrototypeOf(t);
2339
+ }, ReactiveElement_getPrototypeOf(t);
2340
+ }
2341
+ function ReactiveElement_inherits(t, e) {
2342
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
2343
+ t.prototype = Object.create(e && e.prototype, {
2344
+ constructor: {
2345
+ value: t,
2346
+ writable: !0,
2347
+ configurable: !0
2348
+ }
2349
+ }), Object.defineProperty(t, "prototype", {
2350
+ writable: !1
2351
+ }), e && ReactiveElement_setPrototypeOf(t, e);
2352
+ }
2353
+ function ReactiveElement_setPrototypeOf(t, e) {
2354
+ return ReactiveElement_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
2355
+ return t.__proto__ = e, t;
2356
+ }, ReactiveElement_setPrototypeOf(t, e);
2357
+ }
2358
+ function ReactiveElement_classPrivateFieldInitSpec(e, t, a) {
2359
+ ReactiveElement_checkPrivateRedeclaration(e, t), t.set(e, a);
2360
+ }
2361
+ function ReactiveElement_checkPrivateRedeclaration(e, t) {
2362
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2363
+ }
2364
+ function ReactiveElement_defineProperty(e, r, t) {
2365
+ return (r = ReactiveElement_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
2366
+ value: t,
2367
+ enumerable: !0,
2368
+ configurable: !0,
2369
+ writable: !0
2370
+ }) : e[r] = t, e;
2371
+ }
2372
+ function ReactiveElement_toPropertyKey(t) {
2373
+ var i = function ReactiveElement_toPrimitive(t, r) {
2374
+ if ("object" != ReactiveElement_typeof(t) || !t) return t;
2375
+ var e = t[Symbol.toPrimitive];
2376
+ if (void 0 !== e) {
2377
+ var i = e.call(t, r || "default");
2378
+ if ("object" != ReactiveElement_typeof(i)) return i;
2379
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2380
+ }
2381
+ return ("string" === r ? String : Number)(t);
2382
+ }(t, "string");
2383
+ return "symbol" == ReactiveElement_typeof(i) ? i : i + "";
2384
+ }
2385
+ function _classPrivateFieldSet(s, a, r) {
2386
+ return s.set(ReactiveElement_assertClassBrand(s, a), r), r;
2387
+ }
2388
+ function ReactiveElement_classPrivateFieldGet(s, a) {
2389
+ return s.get(ReactiveElement_assertClassBrand(s, a));
2390
+ }
2391
+ function ReactiveElement_assertClassBrand(e, t, n) {
2392
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2393
+ throw new TypeError("Private element is not present on this object");
2394
+ }
2395
+ function extendElementClassWithReactiveElementClass(elementClass) {
2396
+ var appScope = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : window, isInputElement = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], _wasMounted = new WeakMap, _ReactiveElement_brand = new WeakSet, _pendingAttributeChanges = new WeakMap, ReactiveElement = function(_elementClass) {
2397
+ function ReactiveElement() {
2398
+ var _this;
2399
+ return ReactiveElement_classCallCheck(this, ReactiveElement), function _classPrivateMethodInitSpec(e, a) {
2400
+ ReactiveElement_checkPrivateRedeclaration(e, a), a.add(e);
2401
+ }(_this = ReactiveElement_callSuper(this, ReactiveElement), _ReactiveElement_brand),
2402
+ ReactiveElement_defineProperty(_this, "host", null), ReactiveElement_classPrivateFieldInitSpec(_this, _wasMounted, !1),
2403
+ ReactiveElement_defineProperty(_this, "refName", void 0), ReactiveElement_classPrivateFieldInitSpec(_this, _pendingAttributeChanges, []),
2404
+ _this.isReactiveElement = !0, _this.isNativeElement = !0, _this;
2405
+ }
2406
+ return ReactiveElement_inherits(ReactiveElement, _elementClass), ReactiveElement_createClass(ReactiveElement, [ {
2407
+ key: "activate",
2408
+ value: function activate() {
2409
+ var _step, _this2 = this, commands = [], _iterator = function ReactiveElement_createForOfIteratorHelper(r, e) {
2410
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2411
+ if (!t) {
2412
+ if (Array.isArray(r) || (t = ReactiveElement_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
2413
+ t && (r = t);
2414
+ var _n = 0, F = function F() {};
2415
+ return {
2416
+ s: F,
2417
+ n: function n() {
2418
+ return _n >= r.length ? {
2419
+ done: !0
2420
+ } : {
2421
+ done: !1,
2422
+ value: r[_n++]
2423
+ };
2424
+ },
2425
+ e: function e(r) {
2426
+ throw r;
2427
+ },
2428
+ f: F
2429
+ };
2430
+ }
2431
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2432
+ }
2433
+ var o, a = !0, u = !1;
2434
+ return {
2435
+ s: function s() {
2436
+ t = t.call(r);
2437
+ },
2438
+ n: function n() {
2439
+ var r = t.next();
2440
+ return a = r.done, r;
2441
+ },
2442
+ e: function e(r) {
2443
+ u = !0, o = r;
2444
+ },
2445
+ f: function f() {
2446
+ try {
2447
+ a || null == t.return || t.return();
2448
+ } finally {
2449
+ if (u) throw o;
2450
+ }
2451
+ }
2452
+ };
2453
+ }(this.getAttributeNames());
2454
+ try {
2455
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
2456
+ var _attrName = _step.value, attrValue = this.getAttribute(_attrName);
2457
+ if (this.initialSetAttribute(_attrName, attrValue), 0 === _attrName.indexOf("_")) {
2458
+ var command = _attrName.substring(1);
2459
+ commands.push({
2460
+ command,
2461
+ args: attrValue
2462
+ });
2463
+ }
2464
+ }
2465
+ } catch (err) {
2466
+ _iterator.e(err);
2467
+ } finally {
2468
+ _iterator.f();
2469
+ }
2470
+ commands.forEach((function(_ref) {
2471
+ var _COMMAND_ATTRIBUTES$c, _appScope$appCommands, _this2$host, _componentCommands$co, command = _ref.command, args = _ref.args;
2472
+ null === (_COMMAND_ATTRIBUTES$c = COMMANDS[command]) || void 0 === _COMMAND_ATTRIBUTES$c || _COMMAND_ATTRIBUTES$c.call(_this2, args),
2473
+ null === (_appScope$appCommands = appScope.appCommands) || void 0 === _appScope$appCommands || null === (_appScope$appCommands = _appScope$appCommands[command]) || void 0 === _appScope$appCommands || _appScope$appCommands.call(_this2, args);
2474
+ var componentCommands = (null === (_this2$host = _this2.host) || void 0 === _this2$host ? void 0 : _this2$host.commands) || _this2.commands;
2475
+ null == componentCommands || null === (_componentCommands$co = componentCommands[command]) || void 0 === _componentCommands$co || _componentCommands$co.call(_this2, args);
2476
+ })), ReactiveElement_classPrivateFieldGet(_pendingAttributeChanges, this).forEach((function(attributeChangeHandler) {
2477
+ return attributeChangeHandler.call(_this2);
2478
+ })), ReactiveElement_classPrivateFieldGet(_pendingAttributeChanges, this).length = 0,
2479
+ this.isActive = !0;
2480
+ }
2481
+ }, {
2482
+ key: "getHost",
2483
+ value: function getHost() {
2484
+ var _this$getRootNode;
2485
+ return this.host || this.parentNode || (null == this || null === (_this$getRootNode = this.getRootNode()) || void 0 === _this$getRootNode ? void 0 : _this$getRootNode.host);
2486
+ }
2487
+ }, {
2488
+ key: "connectedCallback",
2489
+ value: function connectedCallback() {
2490
+ var _this3 = this;
2491
+ if (!ReactiveElement_classPrivateFieldGet(_wasMounted, this)) {
2492
+ var rootNode = this.getRootNode();
2493
+ rootNode !== document ? this.host = rootNode.host : function ReactiveElement_isReactiveCustomElement(element) {
2494
+ return element && element.isReactiveElement && !element.isNativeElement;
2495
+ }(this.parentElement) ? this.host = this.parentElement : roost.host = null, this.host ? this.host.isActive ? this.activate() : this.host.addEventListener("active", (function() {
2496
+ return _this3.activate();
2497
+ }), {
2498
+ once: !0
2499
+ }) : this.activate(), _classPrivateFieldSet(_wasMounted, this, !0);
2500
+ }
2501
+ }
2502
+ }, {
2503
+ key: "disconnectedCallback",
2504
+ value: function disconnectedCallback() {
2505
+ var _this$host, host = null !== (_this$host = this.host) && void 0 !== _this$host ? _this$host : this;
2506
+ host.ref && delete host.ref[this.refName];
2507
+ }
2508
+ }, {
2509
+ key: "attributeChangedCallback",
2510
+ value: function attributeChangedCallback(attributeName, oldValue, newValue) {
2511
+ var _this4 = this;
2512
+ oldValue !== newValue && (this.isConnected ? ReactiveElement_assertClassBrand(_ReactiveElement_brand, this, _handleAttributeChange).call(this, attributeName, oldValue, newValue) : ReactiveElement_classPrivateFieldGet(_pendingAttributeChanges, this).push((function() {
2513
+ return ReactiveElement_assertClassBrand(_ReactiveElement_brand, _this4, _handleAttributeChange).call(_this4, attributeName, oldValue, newValue);
2514
+ })));
2515
+ }
2516
+ }, {
2517
+ key: "getState",
2518
+ value: function getState(stateProp) {
2519
+ var theState, stateVal, returnStateObject = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], elementInstance = this.isNativeElement && this.host ? this.host : this, stateFound = !1;
2520
+ if (elementInstance && elementInstance.state && Object.hasOwn(elementInstance.state, stateProp) && (stateFound = !0,
2521
+ stateVal = (theState = elementInstance.state)[stateProp]), !stateFound) for (;!stateFound && elementInstance.host; ) (elementInstance = elementInstance.host) && elementInstance.state && Object.hasOwn(elementInstance.state, stateProp) && (stateFound = !0,
2522
+ stateVal = (theState = elementInstance.state)[stateProp]);
2523
+ if (!stateFound) {
2524
+ var globalState = appScope.getGlobalState();
2525
+ globalState && Object.hasOwn(globalState, stateProp) && (stateFound = !0, stateVal = (theState = globalState)[stateProp]);
2526
+ }
2527
+ return stateFound || (stateVal = void 0), returnStateObject ? [ stateVal, theState ] : stateVal;
2528
+ }
2529
+ }, {
2530
+ key: "findElement",
2531
+ value: function findElement(refName) {
2532
+ var host = this.host || this, root = host;
2533
+ return appScope.SPROUT_CONFIG.useShadow && (root = host.shadowRoot), Object.hasOwn(host.ref, refName) ? host.ref[refName] : root.querySelector('[ref="'.concat(refName, '"]'));
2534
+ }
2535
+ }, {
2536
+ key: "initialSetText",
2537
+ value: function initialSetText(stateProp) {
2538
+ setStateText.call(this, stateProp);
2539
+ }
2540
+ }, {
2541
+ key: "initialSetAttribute",
2542
+ value: function initialSetAttribute(attributeName, attributeValue) {
2543
+ var isPropAttr = function isPropAttribute(attrValue) {
2544
+ return 0 === attrValue.indexOf("@");
2545
+ }(attributeValue = String(attributeValue)), valueToSet = attributeValue;
2546
+ if (function isStateAttribute(attrName) {
2547
+ return 0 === attrName.indexOf(":");
2548
+ }(attributeName)) {
2549
+ var stateProp = attributeValue, _attrName2 = attributeName.substring(1);
2550
+ "textContent" === _attrName2 ? this.initialSetText(stateProp) : setStateAttribute.call(this, _attrName2, stateProp);
2551
+ } else {
2552
+ if (isPropAttr) {
2553
+ var host = this.getHost(), propName = attributeValue.substring(1);
2554
+ valueToSet = host.getAttribute(propName);
2555
+ }
2556
+ "textContent" === attrName ? this.initialSetText(valueToSet) : setAttribute.call(this, attributeName, valueToSet);
2557
+ }
2558
+ }
2559
+ }, {
2560
+ key: "onAfterPaint",
2561
+ value: function onAfterPaint(callback) {
2562
+ requestAnimationFrame((function() {
2563
+ return requestAnimationFrame(callback);
2564
+ }));
2565
+ }
2566
+ } ]);
2567
+ }(elementClass);
2568
+ function _handleAttributeChange(attributeName, oldValue, newValue) {
2569
+ var host = this.isNativeElement ? this.host || this.getRootNode().host : this;
2570
+ if ("ref" === attributeName) {
2571
+ var refValue = newValue;
2572
+ host.ref[refValue] = this, this.refName = refValue;
2573
+ }
2574
+ }
2575
+ if (ReactiveElement_defineProperty(ReactiveElement, "observedAttributes", OBSERVED_ATTRIBUTES),
2576
+ isInputElement) {
2577
+ var _changeEventHandler = new WeakMap, ReactiveInputElement = function(_ReactiveElement2) {
2578
+ function ReactiveInputElement() {
2579
+ var _this5;
2580
+ ReactiveElement_classCallCheck(this, ReactiveInputElement);
2581
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
2582
+ return ReactiveElement_defineProperty(_this5 = ReactiveElement_callSuper(this, ReactiveInputElement, [].concat(args)), "boundAttributesToState", new Map),
2583
+ ReactiveElement_classPrivateFieldInitSpec(_this5, _changeEventHandler, void 0),
2584
+ _this5;
2585
+ }
2586
+ return ReactiveElement_inherits(ReactiveInputElement, _ReactiveElement2), ReactiveElement_createClass(ReactiveInputElement, [ {
2587
+ key: "bindAttributeToState",
2588
+ value: function bindAttributeToState(attributeName, statePropName) {
2589
+ this.boundAttributesToState.set(attributeName, statePropName);
2590
+ }
2591
+ }, {
2592
+ key: "updateStateFromAttribute",
2593
+ value: function updateStateFromAttribute(attributeName) {
2594
+ var newValue = fromAttributeValue(this.getAttribute(attributeName)), stateProp = this.boundAttributesToState.get(attributeName), _this$getState2 = function ReactiveElement_slicedToArray(r, e) {
2595
+ return function ReactiveElement_arrayWithHoles(r) {
2596
+ if (Array.isArray(r)) return r;
2597
+ }(r) || function ReactiveElement_iterableToArrayLimit(r, l) {
2598
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2599
+ if (null != t) {
2600
+ var e, n, i, u, a = [], f = !0, o = !1;
2601
+ try {
2602
+ if (i = (t = t.call(r)).next, 0 === l) {
2603
+ if (Object(t) !== t) return;
2604
+ f = !1;
2605
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
2606
+ } catch (r) {
2607
+ o = !0, n = r;
2608
+ } finally {
2609
+ try {
2610
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2611
+ } finally {
2612
+ if (o) throw n;
2613
+ }
2614
+ }
2615
+ return a;
2616
+ }
2617
+ }(r, e) || ReactiveElement_unsupportedIterableToArray(r, e) || function ReactiveElement_nonIterableRest() {
2618
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2619
+ }();
2620
+ }(this.getState(stateProp, !0), 2), stateValue = _this$getState2[0], theState = _this$getState2[1];
2621
+ if (stateValue === Symbol.for(SYMBOL_NAMES_STATE_NOT_FOUND)) throw Error("updateStateFromAttribute: State property ".concat(stateProp, " not found"));
2622
+ stateValue !== newValue && (theState[stateProp] = newValue);
2623
+ }
2624
+ }, {
2625
+ key: "activate",
2626
+ value: function activate() {
2627
+ ReactiveElement_get(ReactiveElement_getPrototypeOf(ReactiveInputElement.prototype), "activate", this).call(this),
2628
+ _classPrivateFieldSet(_changeEventHandler, this, (function() {
2629
+ var changeEvent = new Event("inputChange", {
2630
+ bubbles: !0,
2631
+ composed: !0
2632
+ });
2633
+ if ("checkbox" === this.type) {
2634
+ var checkedStateAttributeNodesMap = this.host.state._stateManager.nodeManager.bindableAttributesStateNodes.get("checked"), checkedAttributeNode = null;
2635
+ checkedStateAttributeNodesMap.has(this) && (checkedAttributeNode = checkedStateAttributeNodesMap.get(this)),
2636
+ this.checked ? (checkedAttributeNode || (checkedAttributeNode = document.createAttribute("checked")),
2637
+ this.setAttributeNode(checkedAttributeNode)) : (checkedAttributeNode || (checkedAttributeNode = this.getAttributeNode("checked")),
2638
+ checkedAttributeNode && this.removeAttributeNode(checkedAttributeNode));
2639
+ }
2640
+ this.dispatchEvent(changeEvent);
2641
+ })), this.addEventListener("change", ReactiveElement_classPrivateFieldGet(_changeEventHandler, this), !1);
2642
+ }
2643
+ }, {
2644
+ key: "disconnectedCallback",
2645
+ value: function disconnectedCallback() {
2646
+ ReactiveElement_get(ReactiveElement_getPrototypeOf(ReactiveInputElement.prototype), "disconnectedCallback", this).call(this),
2647
+ ReactiveElement_classPrivateFieldGet(_changeEventHandler, this) && this.removeEventListener("change", ReactiveElement_classPrivateFieldGet(_changeEventHandler, this)),
2648
+ this.boundAttributesToState.clear();
2649
+ }
2650
+ }, {
2651
+ key: "attributeChangedCallback",
2652
+ value: function attributeChangedCallback(attributeName, oldValue, newValue) {
2653
+ if (ReactiveElement_get(ReactiveElement_getPrototypeOf(ReactiveInputElement.prototype), "attributeChangedCallback", this).apply(this, arguments),
2654
+ AUTO_ATTRIBUTES_TO_PROPS.has(attributeName)) {
2655
+ var newPropValue = fromAttributeValue(newValue);
2656
+ this[attributeName] !== newPropValue && (this[attributeName] = newPropValue);
2657
+ }
2658
+ this.boundAttributesToState.has(attributeName) && this.updateStateFromAttribute(attributeName);
2659
+ }
2660
+ } ]);
2661
+ }(ReactiveElement);
2662
+ return ReactiveElement_defineProperty(ReactiveInputElement, "observedAttributes", ReactiveElement.observedAttributes.concat(function ReactiveElement_toConsumableArray(r) {
2663
+ return function ReactiveElement_arrayWithoutHoles(r) {
2664
+ if (Array.isArray(r)) return ReactiveElement_arrayLikeToArray(r);
2665
+ }(r) || function ReactiveElement_iterableToArray(r) {
2666
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2667
+ }(r) || ReactiveElement_unsupportedIterableToArray(r) || function ReactiveElement_nonIterableSpread() {
2668
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2669
+ }();
2670
+ }(SUPPORTED_ATTRIBUTES_FOR_BINDING))), ReactiveInputElement;
2671
+ }
2672
+ return ReactiveElement;
2673
+ }
2674
+ function ReactiveCustomElement_createForOfIteratorHelper(r, e) {
2675
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2676
+ if (!t) {
2677
+ if (Array.isArray(r) || (t = function ReactiveCustomElement_unsupportedIterableToArray(r, a) {
2678
+ if (r) {
2679
+ if ("string" == typeof r) return ReactiveCustomElement_arrayLikeToArray(r, a);
2680
+ var t = {}.toString.call(r).slice(8, -1);
2681
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? ReactiveCustomElement_arrayLikeToArray(r, a) : void 0;
2682
+ }
2683
+ }(r)) || e && r && "number" == typeof r.length) {
2684
+ t && (r = t);
2685
+ var _n = 0, F = function F() {};
2686
+ return {
2687
+ s: F,
2688
+ n: function n() {
2689
+ return _n >= r.length ? {
2690
+ done: !0
2691
+ } : {
2692
+ done: !1,
2693
+ value: r[_n++]
2694
+ };
2695
+ },
2696
+ e: function e(r) {
2697
+ throw r;
2698
+ },
2699
+ f: F
2700
+ };
2701
+ }
2702
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2703
+ }
2704
+ var o, a = !0, u = !1;
2705
+ return {
2706
+ s: function s() {
2707
+ t = t.call(r);
2708
+ },
2709
+ n: function n() {
2710
+ var r = t.next();
2711
+ return a = r.done, r;
2712
+ },
2713
+ e: function e(r) {
2714
+ u = !0, o = r;
2715
+ },
2716
+ f: function f() {
2717
+ try {
2718
+ a || null == t.return || t.return();
2719
+ } finally {
2720
+ if (u) throw o;
2721
+ }
2722
+ }
2723
+ };
2724
+ }
2725
+ function ReactiveCustomElement_arrayLikeToArray(r, a) {
2726
+ (null == a || a > r.length) && (a = r.length);
2727
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2728
+ return n;
2729
+ }
2730
+ function ReactiveCustomElement_typeof(o) {
2731
+ return ReactiveCustomElement_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
2732
+ return typeof o;
2733
+ } : function(o) {
2734
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
2735
+ }, ReactiveCustomElement_typeof(o);
2736
+ }
2737
+ function ReactiveCustomElement_defineProperties(e, r) {
2738
+ for (var t = 0; t < r.length; t++) {
2739
+ var o = r[t];
2740
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
2741
+ Object.defineProperty(e, ReactiveCustomElement_toPropertyKey(o.key), o);
2742
+ }
2743
+ }
2744
+ function ReactiveCustomElement_possibleConstructorReturn(t, e) {
2745
+ if (e && ("object" == ReactiveCustomElement_typeof(e) || "function" == typeof e)) return e;
2746
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
2747
+ return function ReactiveCustomElement_assertThisInitialized(e) {
2748
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2749
+ return e;
2750
+ }(t);
2751
+ }
2752
+ function ReactiveCustomElement_isNativeReflectConstruct() {
2753
+ try {
2754
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
2755
+ } catch (t) {}
2756
+ return (ReactiveCustomElement_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2757
+ return !!t;
2758
+ })();
2759
+ }
2760
+ function ReactiveCustomElement_get() {
2761
+ return ReactiveCustomElement_get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e, t, r) {
2762
+ var p = function ReactiveCustomElement_superPropBase(t, o) {
2763
+ for (;!{}.hasOwnProperty.call(t, o) && null !== (t = ReactiveCustomElement_getPrototypeOf(t)); ) ;
2764
+ return t;
2765
+ }(e, t);
2766
+ if (p) {
2767
+ var n = Object.getOwnPropertyDescriptor(p, t);
2768
+ return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
2769
+ }
2770
+ }, ReactiveCustomElement_get.apply(null, arguments);
2771
+ }
2772
+ function ReactiveCustomElement_getPrototypeOf(t) {
2773
+ return ReactiveCustomElement_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
2774
+ return t.__proto__ || Object.getPrototypeOf(t);
2775
+ }, ReactiveCustomElement_getPrototypeOf(t);
2776
+ }
2777
+ function ReactiveCustomElement_setPrototypeOf(t, e) {
2778
+ return ReactiveCustomElement_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
2779
+ return t.__proto__ = e, t;
2780
+ }, ReactiveCustomElement_setPrototypeOf(t, e);
2781
+ }
2782
+ function ReactiveCustomElement_classPrivateFieldInitSpec(e, t, a) {
2783
+ ReactiveCustomElement_checkPrivateRedeclaration(e, t), t.set(e, a);
2784
+ }
2785
+ function ReactiveCustomElement_checkPrivateRedeclaration(e, t) {
2786
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2787
+ }
2788
+ function ReactiveCustomElement_defineProperty(e, r, t) {
2789
+ return (r = ReactiveCustomElement_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
2790
+ value: t,
2791
+ enumerable: !0,
2792
+ configurable: !0,
2793
+ writable: !0
2794
+ }) : e[r] = t, e;
2795
+ }
2796
+ function ReactiveCustomElement_toPropertyKey(t) {
2797
+ var i = function ReactiveCustomElement_toPrimitive(t, r) {
2798
+ if ("object" != ReactiveCustomElement_typeof(t) || !t) return t;
2799
+ var e = t[Symbol.toPrimitive];
2800
+ if (void 0 !== e) {
2801
+ var i = e.call(t, r || "default");
2802
+ if ("object" != ReactiveCustomElement_typeof(i)) return i;
2803
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2804
+ }
2805
+ return ("string" === r ? String : Number)(t);
2806
+ }(t, "string");
2807
+ return "symbol" == ReactiveCustomElement_typeof(i) ? i : i + "";
2808
+ }
2809
+ function ReactiveCustomElement_classPrivateFieldGet(s, a) {
2810
+ return s.get(ReactiveCustomElement_assertClassBrand(s, a));
2811
+ }
2812
+ function ReactiveCustomElement_classPrivateFieldSet(s, a, r) {
2813
+ return s.set(ReactiveCustomElement_assertClassBrand(s, a), r), r;
2814
+ }
2815
+ function ReactiveCustomElement_assertClassBrand(e, t, n) {
2816
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2817
+ throw new TypeError("Private element is not present on this object");
2818
+ }
2819
+ var SHADOW_CSS = new CSSStyleSheet;
2820
+ function ConditionalElement_typeof(o) {
2821
+ return ConditionalElement_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
2822
+ return typeof o;
2823
+ } : function(o) {
2824
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
2825
+ }, ConditionalElement_typeof(o);
2826
+ }
2827
+ function ConditionalElement_slicedToArray(r, e) {
2828
+ return function ConditionalElement_arrayWithHoles(r) {
2829
+ if (Array.isArray(r)) return r;
2830
+ }(r) || function ConditionalElement_iterableToArrayLimit(r, l) {
2831
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2832
+ if (null != t) {
2833
+ var e, n, i, u, a = [], f = !0, o = !1;
2834
+ try {
2835
+ if (i = (t = t.call(r)).next, 0 === l) {
2836
+ if (Object(t) !== t) return;
2837
+ f = !1;
2838
+ } else for (;!(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) ;
2839
+ } catch (r) {
2840
+ o = !0, n = r;
2841
+ } finally {
2842
+ try {
2843
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
2844
+ } finally {
2845
+ if (o) throw n;
2846
+ }
2847
+ }
2848
+ return a;
2849
+ }
2850
+ }(r, e) || ConditionalElement_unsupportedIterableToArray(r, e) || function ConditionalElement_nonIterableRest() {
2851
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2852
+ }();
2853
+ }
2854
+ function ConditionalElement_toConsumableArray(r) {
2855
+ return function ConditionalElement_arrayWithoutHoles(r) {
2856
+ if (Array.isArray(r)) return ConditionalElement_arrayLikeToArray(r);
2857
+ }(r) || function ConditionalElement_iterableToArray(r) {
2858
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
2859
+ }(r) || ConditionalElement_unsupportedIterableToArray(r) || function ConditionalElement_nonIterableSpread() {
2860
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2861
+ }();
2862
+ }
2863
+ function ConditionalElement_unsupportedIterableToArray(r, a) {
2864
+ if (r) {
2865
+ if ("string" == typeof r) return ConditionalElement_arrayLikeToArray(r, a);
2866
+ var t = {}.toString.call(r).slice(8, -1);
2867
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? ConditionalElement_arrayLikeToArray(r, a) : void 0;
2868
+ }
2869
+ }
2870
+ function ConditionalElement_arrayLikeToArray(r, a) {
2871
+ (null == a || a > r.length) && (a = r.length);
2872
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
2873
+ return n;
2874
+ }
2875
+ function ConditionalElement_defineProperties(e, r) {
2876
+ for (var t = 0; t < r.length; t++) {
2877
+ var o = r[t];
2878
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
2879
+ Object.defineProperty(e, ConditionalElement_toPropertyKey(o.key), o);
2880
+ }
2881
+ }
2882
+ function ConditionalElement_callSuper(t, o, e) {
2883
+ return o = ConditionalElement_getPrototypeOf(o), function ConditionalElement_possibleConstructorReturn(t, e) {
2884
+ if (e && ("object" == ConditionalElement_typeof(e) || "function" == typeof e)) return e;
2885
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
2886
+ return function ConditionalElement_assertThisInitialized(e) {
2887
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2888
+ return e;
2889
+ }(t);
2890
+ }(t, ConditionalElement_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ConditionalElement_getPrototypeOf(t).constructor) : o.apply(t, e));
2891
+ }
2892
+ function ConditionalElement_isNativeReflectConstruct() {
2893
+ try {
2894
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
2895
+ } catch (t) {}
2896
+ return (ConditionalElement_isNativeReflectConstruct = function _isNativeReflectConstruct() {
2897
+ return !!t;
2898
+ })();
2899
+ }
2900
+ function ConditionalElement_getPrototypeOf(t) {
2901
+ return ConditionalElement_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
2902
+ return t.__proto__ || Object.getPrototypeOf(t);
2903
+ }, ConditionalElement_getPrototypeOf(t);
2904
+ }
2905
+ function ConditionalElement_setPrototypeOf(t, e) {
2906
+ return ConditionalElement_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
2907
+ return t.__proto__ = e, t;
2908
+ }, ConditionalElement_setPrototypeOf(t, e);
2909
+ }
2910
+ function ConditionalElement_toPropertyKey(t) {
2911
+ var i = function ConditionalElement_toPrimitive(t, r) {
2912
+ if ("object" != ConditionalElement_typeof(t) || !t) return t;
2913
+ var e = t[Symbol.toPrimitive];
2914
+ if (void 0 !== e) {
2915
+ var i = e.call(t, r || "default");
2916
+ if ("object" != ConditionalElement_typeof(i)) return i;
2917
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2918
+ }
2919
+ return ("string" === r ? String : Number)(t);
2920
+ }(t, "string");
2921
+ return "symbol" == ConditionalElement_typeof(i) ? i : i + "";
2922
+ }
2923
+ function ConditionalElement_classPrivateFieldInitSpec(e, t, a) {
2924
+ (function ConditionalElement_checkPrivateRedeclaration(e, t) {
2925
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2926
+ })(e, t), t.set(e, a);
2927
+ }
2928
+ function ConditionalElement_classPrivateFieldSet(s, a, r) {
2929
+ return s.set(ConditionalElement_assertClassBrand(s, a), r), r;
2930
+ }
2931
+ function ConditionalElement_classPrivateFieldGet(s, a) {
2932
+ return s.get(ConditionalElement_assertClassBrand(s, a));
2933
+ }
2934
+ function ConditionalElement_assertClassBrand(e, t, n) {
2935
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2936
+ throw new TypeError("Private element is not present on this object");
2937
+ }
2938
+ function build_typeof(o) {
2939
+ return build_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
2940
+ return typeof o;
2941
+ } : function(o) {
2942
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
2943
+ }, build_typeof(o);
2944
+ }
2945
+ function _regeneratorRuntime() {
2946
+ _regeneratorRuntime = function _regeneratorRuntime() {
2947
+ return e;
2948
+ };
2949
+ var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t, e, r) {
2950
+ t[e] = r.value;
2951
+ }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag";
2952
+ function define(t, e, r) {
2953
+ return Object.defineProperty(t, e, {
2954
+ value: r,
2955
+ enumerable: !0,
2956
+ configurable: !0,
2957
+ writable: !0
2958
+ }), t[e];
2959
+ }
2960
+ try {
2961
+ define({}, "");
2962
+ } catch (t) {
2963
+ define = function define(t, e, r) {
2964
+ return t[e] = r;
2965
+ };
2966
+ }
2967
+ function wrap(t, e, r, n) {
2968
+ var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []);
2969
+ return o(a, "_invoke", {
2970
+ value: makeInvokeMethod(t, r, c)
2971
+ }), a;
2972
+ }
2973
+ function tryCatch(t, e, r) {
2974
+ try {
2975
+ return {
2976
+ type: "normal",
2977
+ arg: t.call(e, r)
2978
+ };
2979
+ } catch (t) {
2980
+ return {
2981
+ type: "throw",
2982
+ arg: t
2983
+ };
2984
+ }
2985
+ }
2986
+ e.wrap = wrap;
2987
+ var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
2988
+ function Generator() {}
2989
+ function GeneratorFunction() {}
2990
+ function GeneratorFunctionPrototype() {}
2991
+ var p = {};
2992
+ define(p, a, (function() {
2993
+ return this;
2994
+ }));
2995
+ var d = Object.getPrototypeOf, v = d && d(d(values([])));
2996
+ v && v !== r && n.call(v, a) && (p = v);
2997
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
2998
+ function defineIteratorMethods(t) {
2999
+ [ "next", "throw", "return" ].forEach((function(e) {
3000
+ define(t, e, (function(t) {
3001
+ return this._invoke(e, t);
3002
+ }));
3003
+ }));
3004
+ }
3005
+ function AsyncIterator(t, e) {
3006
+ function invoke(r, o, i, a) {
3007
+ var c = tryCatch(t[r], t, o);
3008
+ if ("throw" !== c.type) {
3009
+ var u = c.arg, h = u.value;
3010
+ return h && "object" == build_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then((function(t) {
3011
+ invoke("next", t, i, a);
3012
+ }), (function(t) {
3013
+ invoke("throw", t, i, a);
3014
+ })) : e.resolve(h).then((function(t) {
3015
+ u.value = t, i(u);
3016
+ }), (function(t) {
3017
+ return invoke("throw", t, i, a);
3018
+ }));
3019
+ }
3020
+ a(c.arg);
3021
+ }
3022
+ var r;
3023
+ o(this, "_invoke", {
3024
+ value: function value(t, n) {
3025
+ function callInvokeWithMethodAndArg() {
3026
+ return new e((function(e, r) {
3027
+ invoke(t, n, e, r);
3028
+ }));
3029
+ }
3030
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
3031
+ }
3032
+ });
3033
+ }
3034
+ function makeInvokeMethod(e, r, n) {
3035
+ var o = h;
3036
+ return function(i, a) {
3037
+ if (o === f) throw Error("Generator is already running");
3038
+ if (o === s) {
3039
+ if ("throw" === i) throw a;
3040
+ return {
3041
+ value: t,
3042
+ done: !0
3043
+ };
3044
+ }
3045
+ for (n.method = i, n.arg = a; ;) {
3046
+ var c = n.delegate;
3047
+ if (c) {
3048
+ var u = maybeInvokeDelegate(c, n);
3049
+ if (u) {
3050
+ if (u === y) continue;
3051
+ return u;
3052
+ }
3053
+ }
3054
+ if ("next" === n.method) n.sent = n._sent = n.arg; else if ("throw" === n.method) {
3055
+ if (o === h) throw o = s, n.arg;
3056
+ n.dispatchException(n.arg);
3057
+ } else "return" === n.method && n.abrupt("return", n.arg);
3058
+ o = f;
3059
+ var p = tryCatch(e, r, n);
3060
+ if ("normal" === p.type) {
3061
+ if (o = n.done ? s : l, p.arg === y) continue;
3062
+ return {
3063
+ value: p.arg,
3064
+ done: n.done
3065
+ };
3066
+ }
3067
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
3068
+ }
3069
+ };
3070
+ }
3071
+ function maybeInvokeDelegate(e, r) {
3072
+ var n = r.method, o = e.iterator[n];
3073
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return",
3074
+ r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw",
3075
+ r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
3076
+ var i = tryCatch(o, e.iterator, r.arg);
3077
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null,
3078
+ y;
3079
+ var a = i.arg;
3080
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next",
3081
+ r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"),
3082
+ r.delegate = null, y);
3083
+ }
3084
+ function pushTryEntry(t) {
3085
+ var e = {
3086
+ tryLoc: t[0]
3087
+ };
3088
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]),
3089
+ this.tryEntries.push(e);
3090
+ }
3091
+ function resetTryEntry(t) {
3092
+ var e = t.completion || {};
3093
+ e.type = "normal", delete e.arg, t.completion = e;
3094
+ }
3095
+ function Context(t) {
3096
+ this.tryEntries = [ {
3097
+ tryLoc: "root"
3098
+ } ], t.forEach(pushTryEntry, this), this.reset(!0);
3099
+ }
3100
+ function values(e) {
3101
+ if (e || "" === e) {
3102
+ var r = e[a];
3103
+ if (r) return r.call(e);
3104
+ if ("function" == typeof e.next) return e;
3105
+ if (!isNaN(e.length)) {
3106
+ var o = -1, i = function next() {
3107
+ for (;++o < e.length; ) if (n.call(e, o)) return next.value = e[o], next.done = !1,
3108
+ next;
3109
+ return next.value = t, next.done = !0, next;
3110
+ };
3111
+ return i.next = i;
3112
+ }
3113
+ }
3114
+ throw new TypeError(build_typeof(e) + " is not iterable");
3115
+ }
3116
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
3117
+ value: GeneratorFunctionPrototype,
3118
+ configurable: !0
3119
+ }), o(GeneratorFunctionPrototype, "constructor", {
3120
+ value: GeneratorFunction,
3121
+ configurable: !0
3122
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"),
3123
+ e.isGeneratorFunction = function(t) {
3124
+ var e = "function" == typeof t && t.constructor;
3125
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
3126
+ }, e.mark = function(t) {
3127
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype,
3128
+ define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
3129
+ }, e.awrap = function(t) {
3130
+ return {
3131
+ __await: t
3132
+ };
3133
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, (function() {
3134
+ return this;
3135
+ })), e.AsyncIterator = AsyncIterator, e.async = function(t, r, n, o, i) {
3136
+ void 0 === i && (i = Promise);
3137
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
3138
+ return e.isGeneratorFunction(r) ? a : a.next().then((function(t) {
3139
+ return t.done ? t.value : a.next();
3140
+ }));
3141
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, (function() {
3142
+ return this;
3143
+ })), define(g, "toString", (function() {
3144
+ return "[object Generator]";
3145
+ })), e.keys = function(t) {
3146
+ var e = Object(t), r = [];
3147
+ for (var n in e) r.push(n);
3148
+ return r.reverse(), function next() {
3149
+ for (;r.length; ) {
3150
+ var t = r.pop();
3151
+ if (t in e) return next.value = t, next.done = !1, next;
3152
+ }
3153
+ return next.done = !0, next;
3154
+ };
3155
+ }, e.values = values, Context.prototype = {
3156
+ constructor: Context,
3157
+ reset: function reset(e) {
3158
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null,
3159
+ this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
3160
+ },
3161
+ stop: function stop() {
3162
+ this.done = !0;
3163
+ var t = this.tryEntries[0].completion;
3164
+ if ("throw" === t.type) throw t.arg;
3165
+ return this.rval;
3166
+ },
3167
+ dispatchException: function dispatchException(e) {
3168
+ if (this.done) throw e;
3169
+ var r = this;
3170
+ function handle(n, o) {
3171
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t),
3172
+ !!o;
3173
+ }
3174
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
3175
+ var i = this.tryEntries[o], a = i.completion;
3176
+ if ("root" === i.tryLoc) return handle("end");
3177
+ if (i.tryLoc <= this.prev) {
3178
+ var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc");
3179
+ if (c && u) {
3180
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
3181
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
3182
+ } else if (c) {
3183
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
3184
+ } else {
3185
+ if (!u) throw Error("try statement without catch or finally");
3186
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
3187
+ }
3188
+ }
3189
+ }
3190
+ },
3191
+ abrupt: function abrupt(t, e) {
3192
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
3193
+ var o = this.tryEntries[r];
3194
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
3195
+ var i = o;
3196
+ break;
3197
+ }
3198
+ }
3199
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
3200
+ var a = i ? i.completion : {};
3201
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc,
3202
+ y) : this.complete(a);
3203
+ },
3204
+ complete: function complete(t, e) {
3205
+ if ("throw" === t.type) throw t.arg;
3206
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg,
3207
+ this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e),
3208
+ y;
3209
+ },
3210
+ finish: function finish(t) {
3211
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
3212
+ var r = this.tryEntries[e];
3213
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r),
3214
+ y;
3215
+ }
3216
+ },
3217
+ catch: function _catch(t) {
3218
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
3219
+ var r = this.tryEntries[e];
3220
+ if (r.tryLoc === t) {
3221
+ var n = r.completion;
3222
+ if ("throw" === n.type) {
3223
+ var o = n.arg;
3224
+ resetTryEntry(r);
3225
+ }
3226
+ return o;
3227
+ }
3228
+ }
3229
+ throw Error("illegal catch attempt");
3230
+ },
3231
+ delegateYield: function delegateYield(e, r, n) {
3232
+ return this.delegate = {
3233
+ iterator: values(e),
3234
+ resultName: r,
3235
+ nextLoc: n
3236
+ }, "next" === this.method && (this.arg = t), y;
3237
+ }
3238
+ }, e;
3239
+ }
3240
+ function build_defineProperties(e, r) {
3241
+ for (var t = 0; t < r.length; t++) {
3242
+ var o = r[t];
3243
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
3244
+ Object.defineProperty(e, build_toPropertyKey(o.key), o);
3245
+ }
3246
+ }
3247
+ function build_createClass(e, r, t) {
3248
+ return r && build_defineProperties(e.prototype, r), t && build_defineProperties(e, t),
3249
+ Object.defineProperty(e, "prototype", {
3250
+ writable: !1
3251
+ }), e;
3252
+ }
3253
+ function build_toPropertyKey(t) {
3254
+ var i = function build_toPrimitive(t, r) {
3255
+ if ("object" != build_typeof(t) || !t) return t;
3256
+ var e = t[Symbol.toPrimitive];
3257
+ if (void 0 !== e) {
3258
+ var i = e.call(t, r || "default");
3259
+ if ("object" != build_typeof(i)) return i;
3260
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3261
+ }
3262
+ return ("string" === r ? String : Number)(t);
3263
+ }(t, "string");
3264
+ return "symbol" == build_typeof(i) ? i : i + "";
3265
+ }
3266
+ function build_classCallCheck(a, n) {
3267
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
3268
+ }
3269
+ function build_callSuper(t, o, e) {
3270
+ return o = build_getPrototypeOf(o), function build_possibleConstructorReturn(t, e) {
3271
+ if (e && ("object" == build_typeof(e) || "function" == typeof e)) return e;
3272
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
3273
+ return function build_assertThisInitialized(e) {
3274
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3275
+ return e;
3276
+ }(t);
3277
+ }(t, build_isNativeReflectConstruct() ? Reflect.construct(o, e || [], build_getPrototypeOf(t).constructor) : o.apply(t, e));
3278
+ }
3279
+ function build_isNativeReflectConstruct() {
3280
+ try {
3281
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
3282
+ } catch (t) {}
3283
+ return (build_isNativeReflectConstruct = function _isNativeReflectConstruct() {
3284
+ return !!t;
3285
+ })();
3286
+ }
3287
+ function build_getPrototypeOf(t) {
3288
+ return build_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
3289
+ return t.__proto__ || Object.getPrototypeOf(t);
3290
+ }, build_getPrototypeOf(t);
3291
+ }
3292
+ function build_inherits(t, e) {
3293
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
3294
+ t.prototype = Object.create(e && e.prototype, {
3295
+ constructor: {
3296
+ value: t,
3297
+ writable: !0,
3298
+ configurable: !0
3299
+ }
3300
+ }), Object.defineProperty(t, "prototype", {
3301
+ writable: !1
3302
+ }), e && build_setPrototypeOf(t, e);
3303
+ }
3304
+ function build_setPrototypeOf(t, e) {
3305
+ return build_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
3306
+ return t.__proto__ = e, t;
3307
+ }, build_setPrototypeOf(t, e);
3308
+ }
3309
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
3310
+ try {
3311
+ var i = n[a](c), u = i.value;
3312
+ } catch (n) {
3313
+ return void e(n);
3314
+ }
3315
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
3316
+ }
3317
+ function core_typeof(o) {
3318
+ return core_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
3319
+ return typeof o;
3320
+ } : function(o) {
3321
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
3322
+ }, core_typeof(o);
3323
+ }
3324
+ function core_defineProperties(e, r) {
3325
+ for (var t = 0; t < r.length; t++) {
3326
+ var o = r[t];
3327
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
3328
+ Object.defineProperty(e, core_toPropertyKey(o.key), o);
3329
+ }
3330
+ }
3331
+ function core_toPropertyKey(t) {
3332
+ var i = function core_toPrimitive(t, r) {
3333
+ if ("object" != core_typeof(t) || !t) return t;
3334
+ var e = t[Symbol.toPrimitive];
3335
+ if (void 0 !== e) {
3336
+ var i = e.call(t, r || "default");
3337
+ if ("object" != core_typeof(i)) return i;
3338
+ throw new TypeError("@@toPrimitive must return a primitive value.");
3339
+ }
3340
+ return ("string" === r ? String : Number)(t);
3341
+ }(t, "string");
3342
+ return "symbol" == core_typeof(i) ? i : i + "";
3343
+ }
3344
+ function core_callSuper(t, o, e) {
3345
+ return o = core_getPrototypeOf(o), function core_possibleConstructorReturn(t, e) {
3346
+ if (e && ("object" == core_typeof(e) || "function" == typeof e)) return e;
3347
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
3348
+ return function core_assertThisInitialized(e) {
3349
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3350
+ return e;
3351
+ }(t);
3352
+ }(t, core_isNativeReflectConstruct() ? Reflect.construct(o, e || [], core_getPrototypeOf(t).constructor) : o.apply(t, e));
3353
+ }
3354
+ function core_isNativeReflectConstruct() {
3355
+ try {
3356
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
3357
+ } catch (t) {}
3358
+ return (core_isNativeReflectConstruct = function _isNativeReflectConstruct() {
3359
+ return !!t;
3360
+ })();
3361
+ }
3362
+ function core_getPrototypeOf(t) {
3363
+ return core_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
3364
+ return t.__proto__ || Object.getPrototypeOf(t);
3365
+ }, core_getPrototypeOf(t);
3366
+ }
3367
+ function core_setPrototypeOf(t, e) {
3368
+ return core_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
3369
+ return t.__proto__ = e, t;
3370
+ }, core_setPrototypeOf(t, e);
3371
+ }
3372
+ function core_arrayLikeToArray(r, a) {
3373
+ (null == a || a > r.length) && (a = r.length);
3374
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
3375
+ return n;
3376
+ }
3377
+ SHADOW_CSS.replaceSync(":host { contain: layout paint; }");
3378
+ var script = document.currentScript, strict = (null == script ? void 0 : script.hasAttribute("strict")) || !1, stateManagerClass = Cougar_StateManager, config = {
3379
+ useShadow: !0,
3380
+ allowAppScopeAccess: !0,
3381
+ useDSD: !1,
3382
+ strict,
3383
+ appName: (null == script ? void 0 : script.getAttribute("app")) || "sprout-app",
3384
+ stateManagerClass
3385
+ };
3386
+ config.allowAppScopeAccess && Object.defineProperty(globalThis, "sproutApps", {
3387
+ value: {},
3388
+ writable: !1
3389
+ });
3390
+ var SproutStylesheet = new CSSStyleSheet;
3391
+ SproutStylesheet.replaceSync(SPROUT_FROZEN_CLASS_CSS), document.adoptedStyleSheets = [].concat(function core_toConsumableArray(r) {
3392
+ return function core_arrayWithoutHoles(r) {
3393
+ if (Array.isArray(r)) return core_arrayLikeToArray(r);
3394
+ }(r) || function core_iterableToArray(r) {
3395
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
3396
+ }(r) || function core_unsupportedIterableToArray(r, a) {
3397
+ if (r) {
3398
+ if ("string" == typeof r) return core_arrayLikeToArray(r, a);
3399
+ var t = {}.toString.call(r).slice(8, -1);
3400
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? core_arrayLikeToArray(r, a) : void 0;
3401
+ }
3402
+ }(r) || function core_nonIterableSpread() {
3403
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3404
+ }();
3405
+ }(document.adoptedStyleSheets), [ SproutStylesheet ]);
3406
+ var _window, appScope = (window, {
3407
+ window,
3408
+ document: null === (_window = window) || void 0 === _window ? void 0 : _window.document
3409
+ });
3410
+ config.allowAppScopeAccess && Object.defineProperty(globalThis.sproutApps, config.appName, {
3411
+ value: appScope,
3412
+ writable: !1
3413
+ }), appScope.SPROUT_CONFIG = Object.seal(config);
3414
+ var core_hasOwnProperty = Object.prototype.hasOwnProperty;
3415
+ setHiddenProperty(Object.prototype, "hasOwnProperty", core_hasOwnProperty), appScope.getGlobalState = function() {
3416
+ return GLOBAL_STATE_NOT_SET_YET;
3417
+ }, appScope.setGlobalState = function() {
3418
+ var globalState = newStateManager(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, void 0, void 0, handleStateChange, !0, appScope).state;
3419
+ return Object.defineProperty(appScope, "SproutGlobalState", {
3420
+ value: globalState,
3421
+ writable: !1,
3422
+ configurable: !1
3423
+ }), Object.defineProperty(appScope, "getGlobalState", {
3424
+ value: function value() {
3425
+ return appScope.SproutGlobalState;
3426
+ }
3427
+ }), appScope.SproutGlobalState;
3428
+ }, appScope.setCommands = function() {
3429
+ var commands = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
3430
+ Object.defineProperty(appScope, "appCommands", {
3431
+ value: commands,
3432
+ writable: !1,
3433
+ configurable: !1
3434
+ });
3435
+ };
3436
+ var HTML_REACTIVE_ELEMENT_CLASSES = {};
3437
+ HTML_ELEMENT_CLASSES_MAP.forEach((function(elementDefinition) {
3438
+ return HTML_REACTIVE_ELEMENT_CLASSES[elementDefinition.element] = extendElementClassWithReactiveElementClass(elementDefinition.class, appScope, !0);
3439
+ })), appScope.ReactiveCustomElement = function getReactiveCustomElementClass() {
3440
+ var appScope = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : window, ReactiveHTMLElement = extendElementClassWithReactiveElementClass(HTMLElement, appScope), _wasMounted = (appScope.SPROUT_CONFIG.stateManagerClass,
3441
+ new WeakMap), _lifecycle = new WeakMap, _templateContent = new WeakMap, _stylesheet = new WeakMap, _globalStylesheet = new WeakMap, _eventHandler = new WeakMap, _usesDSD = new WeakMap, _settings = new WeakMap, _ReactiveCustomElement_brand = new WeakSet, ReactiveCustomElement = function(_ReactiveHTMLElement) {
3442
+ function ReactiveCustomElement() {
3443
+ var _this, template = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, _runtime = arguments.length > 1 ? arguments[1] : void 0, style = arguments.length > 2 ? arguments[2] : void 0, globalStylesheet = arguments.length > 3 ? arguments[3] : void 0, usesDSD = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
3444
+ if (function ReactiveCustomElement_classCallCheck(a, n) {
3445
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
3446
+ }(this, ReactiveCustomElement), function ReactiveCustomElement_classPrivateMethodInitSpec(e, a) {
3447
+ ReactiveCustomElement_checkPrivateRedeclaration(e, a), a.add(e);
3448
+ }(_this = function ReactiveCustomElement_callSuper(t, o, e) {
3449
+ return o = ReactiveCustomElement_getPrototypeOf(o), ReactiveCustomElement_possibleConstructorReturn(t, ReactiveCustomElement_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ReactiveCustomElement_getPrototypeOf(t).constructor) : o.apply(t, e));
3450
+ }(this, ReactiveCustomElement), _ReactiveCustomElement_brand), ReactiveCustomElement_defineProperty(_this, "ownerMapElement", void 0),
3451
+ ReactiveCustomElement_defineProperty(_this, "state", void 0), ReactiveCustomElement_defineProperty(_this, "stateKey", void 0),
3452
+ ReactiveCustomElement_classPrivateFieldInitSpec(_this, _wasMounted, !1), ReactiveCustomElement_classPrivateFieldInitSpec(_this, _lifecycle, {
3453
+ init: null,
3454
+ mount: null,
3455
+ stateful: null,
3456
+ active: null,
3457
+ unmount: null
3458
+ }), ReactiveCustomElement_classPrivateFieldInitSpec(_this, _templateContent, void 0),
3459
+ ReactiveCustomElement_classPrivateFieldInitSpec(_this, _stylesheet, void 0), ReactiveCustomElement_classPrivateFieldInitSpec(_this, _globalStylesheet, void 0),
3460
+ ReactiveCustomElement_defineProperty(_this, "events", void 0), ReactiveCustomElement_defineProperty(_this, "eventsMap", new Map),
3461
+ ReactiveCustomElement_classPrivateFieldInitSpec(_this, _eventHandler, void 0), ReactiveCustomElement_defineProperty(_this, "propAttributes", new Map),
3462
+ ReactiveCustomElement_classPrivateFieldInitSpec(_this, _usesDSD, !1), ReactiveCustomElement_classPrivateFieldInitSpec(_this, _settings, void 0),
3463
+ ReactiveCustomElement_defineProperty(_this, "commands", void 0), ReactiveCustomElement_defineProperty(_this, "ref", {}),
3464
+ ReactiveCustomElement_defineProperty(_this, "canonicalTagName", void 0), "CONDITIONAL-ELEMENT" === _this.tagName) return ReactiveCustomElement_possibleConstructorReturn(_this);
3465
+ if (_this.isNativeElement = !1, ReactiveCustomElement_classPrivateFieldSet(_usesDSD, _this, usesDSD),
3466
+ globalStylesheet && ReactiveCustomElement_classPrivateFieldSet(_globalStylesheet, _this, globalStylesheet),
3467
+ _this.canonicalTagName = _this.localName, ReactiveCustomElement_classPrivateFieldGet(_usesDSD, _this)) _this.canonicalTagName = _this.localName.substring(0, _this.localName.indexOf("-dsd")); else {
3468
+ if (style) {
3469
+ var stylesheet = new CSSStyleSheet;
3470
+ stylesheet.replaceSync(style), ReactiveCustomElement_classPrivateFieldSet(_stylesheet, _this, stylesheet);
3471
+ }
3472
+ ReactiveCustomElement_classPrivateFieldSet(_templateContent, _this, template ? document.importNode(template, !0) : document.importNode(DEFAULT_TEMPLATE_DOM, !0)),
3473
+ ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, _this, _renderTemplate).call(_this);
3474
+ }
3475
+ return _runtime && ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, _this, _setRuntime).call(_this, _runtime),
3476
+ ReactiveCustomElement_classPrivateFieldGet(_lifecycle, _this).init && ReactiveCustomElement_classPrivateFieldGet(_lifecycle, _this).init.call(_this),
3477
+ _this;
3478
+ }
3479
+ return function ReactiveCustomElement_inherits(t, e) {
3480
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
3481
+ t.prototype = Object.create(e && e.prototype, {
3482
+ constructor: {
3483
+ value: t,
3484
+ writable: !0,
3485
+ configurable: !0
3486
+ }
3487
+ }), Object.defineProperty(t, "prototype", {
3488
+ writable: !1
3489
+ }), e && ReactiveCustomElement_setPrototypeOf(t, e);
3490
+ }(ReactiveCustomElement, _ReactiveHTMLElement), function ReactiveCustomElement_createClass(e, r, t) {
3491
+ return r && ReactiveCustomElement_defineProperties(e.prototype, r), t && ReactiveCustomElement_defineProperties(e, t),
3492
+ Object.defineProperty(e, "prototype", {
3493
+ writable: !1
3494
+ }), e;
3495
+ }(ReactiveCustomElement, [ {
3496
+ key: "setInitialState",
3497
+ value: function setInitialState(initState) {
3498
+ this.initialState ? Object.assign(this.initialState, initState) : this.initialState = initState,
3499
+ initState.hasOwnProperty("key") && (this.stateKey = initState.key);
3500
+ }
3501
+ }, {
3502
+ key: "disconnectedCallback",
3503
+ value: function disconnectedCallback() {
3504
+ ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, this, _unbindEvents).call(this),
3505
+ this.state = void 0, this.isActive = !1, ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this).unmount && ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this).unmount.call(this);
3506
+ }
3507
+ }, {
3508
+ key: "activate",
3509
+ value: function activate() {
3510
+ ReactiveCustomElement_get(ReactiveCustomElement_getPrototypeOf(ReactiveCustomElement.prototype), "activate", this).call(this),
3511
+ ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, this, _bindEvents).call(this),
3512
+ ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this).active && ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this).active.call(this);
3513
+ }
3514
+ }, {
3515
+ key: "findElement",
3516
+ value: function findElement(refName) {
3517
+ var _root, _root$querySelector, root = this;
3518
+ return appScope.SPROUT_CONFIG.useShadow && (root = this.shadowRoot), Object.hasOwn(this.ref, refName) ? this.ref[refName] : (null === (_root = root) || void 0 === _root || null === (_root$querySelector = _root.querySelector) || void 0 === _root$querySelector ? void 0 : _root$querySelector.call(_root, '[ref="'.concat(refName, '"]'))) || null;
3519
+ }
3520
+ }, {
3521
+ key: "connectedCallback",
3522
+ value: function connectedCallback() {
3523
+ var _this2 = this;
3524
+ if (this.setAttribute("tagName", this.canonicalTagName), !ReactiveCustomElement_classPrivateFieldGet(_wasMounted, this)) {
3525
+ var host = this.getRootNode().host;
3526
+ ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this).mount && ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this).mount.call(this);
3527
+ var doActivate = function doActivate() {
3528
+ ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, _this2, _setActiveStateFromInitialState).call(_this2),
3529
+ _this2.isActive = !0, _this2.dispatchEvent(new CustomEvent("active")), ReactiveCustomElement_classPrivateFieldGet(_lifecycle, _this2).stateful && ReactiveCustomElement_classPrivateFieldGet(_lifecycle, _this2).stateful.call(_this2),
3530
+ _this2.activate();
3531
+ };
3532
+ host ? host.isActive ? doActivate() : host.addEventListener("active", doActivate, {
3533
+ once: !0
3534
+ }) : setTimeout(doActivate, 0), ReactiveCustomElement_classPrivateFieldSet(_wasMounted, this, !0);
3535
+ }
3536
+ }
3537
+ }, {
3538
+ key: "attributeChangedCallback",
3539
+ value: function attributeChangedCallback(attributeName, oldValue, newValue) {
3540
+ oldValue !== newValue && ("hidden" === attributeName && (null === newValue ? this.dispatchEvent(new CustomEvent("unhide", {
3541
+ bubbles: !0
3542
+ })) : this.dispatchEvent(new CustomEvent("hide", {
3543
+ bubbles: !0
3544
+ }))), this.propAttributes.has(attributeName) && this.propAttributes.get(attributeName).forEach((function(attrNode) {
3545
+ attrNode.nodeValue = newValue, "CONDITIONAL-RENDER" === attrNode.ownerElement.tagName && attrNode.ownerElement.render();
3546
+ })));
3547
+ }
3548
+ } ]);
3549
+ }(ReactiveHTMLElement);
3550
+ function _setRuntime(runtime) {
3551
+ var _this3 = this;
3552
+ if (ReactiveCustomElement_classPrivateFieldSet(_settings, this, runtime.settings),
3553
+ this.commands = runtime.commands, runtime.events) {
3554
+ var eventsObjectValue, typeOfValue, setRefEvent = function setRefEvent(eventName, refName, eventHandler) {
3555
+ _this3.eventsMap.has(eventName) || _this3.eventsMap.set(eventName, new Map), _this3.eventsMap.get(eventName).set(refName, eventHandler);
3556
+ };
3557
+ for (var refName in runtime.events) if ("function" === (typeOfValue = ReactiveCustomElement_typeof(eventsObjectValue = runtime.events[refName]))) setRefEvent("click", refName, eventsObjectValue); else if ("object" === typeOfValue) for (var eventName in eventsObjectValue) setRefEvent(eventName, refName, eventsObjectValue[eventName]);
3558
+ this.isConnected && ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, this, _bindEvents).call(this);
3559
+ }
3560
+ for (var lifecycleEvent in runtime.state && (this.setInitialState(runtime.state),
3561
+ this.isConnected && ReactiveCustomElement_classPrivateFieldGet(_wasMounted, this) && !this.state && ReactiveCustomElement_assertClassBrand(_ReactiveCustomElement_brand, this, _setActiveStateFromInitialState).call(this)),
3562
+ ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this)) runtime.hasOwnProperty(lifecycleEvent) && (ReactiveCustomElement_classPrivateFieldGet(_lifecycle, this)[lifecycleEvent] = runtime[lifecycleEvent]);
3563
+ }
3564
+ function _setActiveStateFromInitialState() {
3565
+ var _this$state;
3566
+ if (this.initialState && (null === (_this$state = this.state) || void 0 === _this$state || !_this$state._isActive)) {
3567
+ var initialState = this.initialState;
3568
+ if (initialState._stateManager) this.state = initialState._stateManager.state; else {
3569
+ var stateManager = newStateManager(initialState, void 0, void 0, handleStateChange, !1, appScope);
3570
+ this.state = stateManager.state, this.state.$host = this;
3571
+ }
3572
+ this.state._isActive = !0;
3573
+ }
3574
+ }
3575
+ function _renderTemplate() {
3576
+ if (appScope.SPROUT_CONFIG.useShadow) this.attachShadow({
3577
+ mode: "open",
3578
+ delegatesFocus: !0
3579
+ }), this.shadowRoot.adoptedStyleSheets = [ SHADOW_CSS ], ReactiveCustomElement_classPrivateFieldGet(_globalStylesheet, this) && this.shadowRoot.adoptedStyleSheets.push(ReactiveCustomElement_classPrivateFieldGet(_globalStylesheet, this)),
3580
+ ReactiveCustomElement_classPrivateFieldGet(_stylesheet, this) && this.shadowRoot.adoptedStyleSheets.push(ReactiveCustomElement_classPrivateFieldGet(_stylesheet, this)),
3581
+ this.shadowRoot.appendChild(ReactiveCustomElement_classPrivateFieldGet(_templateContent, this)); else {
3582
+ var fragment = new DocumentFragment;
3583
+ fragment.appendChild(ReactiveCustomElement_classPrivateFieldGet(_templateContent, this)),
3584
+ this.appendChild(fragment);
3585
+ }
3586
+ }
3587
+ function _unbindEvents() {
3588
+ if (this.eventsMap.size) {
3589
+ var _step, _iterator = ReactiveCustomElement_createForOfIteratorHelper(this.eventsMap.keys());
3590
+ try {
3591
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
3592
+ var eventName = _step.value;
3593
+ this.shadowRoot.removeEventListener(eventName, ReactiveCustomElement_classPrivateFieldGet(_eventHandler, this), !1);
3594
+ }
3595
+ } catch (err) {
3596
+ _iterator.e(err);
3597
+ } finally {
3598
+ _iterator.f();
3599
+ }
3600
+ }
3601
+ }
3602
+ function _bindEvents() {
3603
+ if (!ReactiveCustomElement_classPrivateFieldGet(_eventHandler, this) && this.eventsMap.size) {
3604
+ var globalState = appScope.getGlobalState();
3605
+ ReactiveCustomElement_classPrivateFieldSet(_eventHandler, this, (function(event) {
3606
+ var host = this.host, eventsMapItem = host.eventsMap.get(event.type);
3607
+ if (!eventsMapItem) return !1;
3608
+ var _step2, _iterator2 = ReactiveCustomElement_createForOfIteratorHelper(event.composedPath());
3609
+ try {
3610
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
3611
+ var element = _step2.value;
3612
+ if (element && element.refName && eventsMapItem.has(element.refName)) {
3613
+ var targetElement = element, targetRefName = targetElement.refName;
3614
+ eventsMapItem.get(targetRefName).call(targetElement, event, host, globalState);
3615
+ }
3616
+ }
3617
+ } catch (err) {
3618
+ _iterator2.e(err);
3619
+ } finally {
3620
+ _iterator2.f();
3621
+ }
3622
+ event.stopPropagation();
3623
+ }));
3624
+ var _step3, _iterator3 = ReactiveCustomElement_createForOfIteratorHelper(this.eventsMap.keys());
3625
+ try {
3626
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
3627
+ var eventName = _step3.value;
3628
+ this.shadowRoot.addEventListener(eventName, ReactiveCustomElement_classPrivateFieldGet(_eventHandler, this), {
3629
+ capture: !0
3630
+ });
3631
+ }
3632
+ } catch (err) {
3633
+ _iterator3.e(err);
3634
+ } finally {
3635
+ _iterator3.f();
3636
+ }
3637
+ }
3638
+ }
3639
+ return ReactiveCustomElement;
3640
+ }(appScope), function build(appScope, appName) {
3641
+ function defineCustomElementFromTemplate(_x3, _x4, _x5) {
3642
+ return _defineCustomElementFromTemplate.apply(this, arguments);
3643
+ }
3644
+ function _defineCustomElementFromTemplate() {
3645
+ return (_defineCustomElementFromTemplate = function _asyncToGenerator(n) {
3646
+ return function() {
3647
+ var t = this, e = arguments;
3648
+ return new Promise((function(r, o) {
3649
+ var a = n.apply(t, e);
3650
+ function _next(n) {
3651
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
3652
+ }
3653
+ function _throw(n) {
3654
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
3655
+ }
3656
+ _next(void 0);
3657
+ }));
3658
+ };
3659
+ }(_regeneratorRuntime().mark((function _callee2(template, elemName, globalStylesheet) {
3660
+ var templateContent, style, runtime, runtimeScript, runtimeCode;
3661
+ return _regeneratorRuntime().wrap((function _callee2$(_context2) {
3662
+ for (;;) switch (_context2.prev = _context2.next) {
3663
+ case 0:
3664
+ if (templateContent = template.content, (style = templateContent.querySelector("style")) && templateContent.removeChild(style),
3665
+ (runtimeScript = templateContent.querySelector("script")) && (runtimeCode = runtimeScript.textContent,
3666
+ templateContent.removeChild(runtimeScript), runtimeCode && 0 !== runtimeCode.trim().length)) try {
3667
+ runtime = Function(runtimeCode)();
3668
+ } catch (e) {}
3669
+ customElements.define(elemName, function(_appScope$ReactiveCus3) {
3670
+ function _class3() {
3671
+ var _style;
3672
+ return build_classCallCheck(this, _class3), build_callSuper(this, _class3, [ templateContent, runtime, null === (_style = style) || void 0 === _style ? void 0 : _style.textContent, globalStylesheet ]);
3673
+ }
3674
+ return build_inherits(_class3, _appScope$ReactiveCus3), build_createClass(_class3);
3675
+ }(appScope.ReactiveCustomElement)), customElements.define("".concat(elemName, "-dsd"), function(_appScope$ReactiveCus4) {
3676
+ function _class4() {
3677
+ return build_classCallCheck(this, _class4), build_callSuper(this, _class4, [ templateContent, runtime, null, globalStylesheet, !0 ]);
3678
+ }
3679
+ return build_inherits(_class4, _appScope$ReactiveCus4), build_createClass(_class4);
3680
+ }(appScope.ReactiveCustomElement));
3681
+
3682
+ case 7:
3683
+ case "end":
3684
+ return _context2.stop();
3685
+ }
3686
+ }), _callee2);
3687
+ })))).apply(this, arguments);
3688
+ }
3689
+ !function build() {
3690
+ var _globalThis$SPROUT_CO2, globalStylesheet = new CSSStyleSheet, globalStyle = document.querySelector('head > style[app="'.concat(appName, '"]'));
3691
+ if (globalStyle) globalStylesheet.replaceSync(globalStyle.textContent); else {
3692
+ var _globalThis$SPROUT_CO, compiledStyle = null === (_globalThis$SPROUT_CO = globalThis.SPROUT_COMPILED_STYLES) || void 0 === _globalThis$SPROUT_CO ? void 0 : _globalThis$SPROUT_CO[appName];
3693
+ globalStylesheet.replaceSync(compiledStyle || "");
3694
+ }
3695
+ globalStylesheet.insertRule(SPROUT_FROZEN_CLASS_CSS), "function" == typeof globalThis["".concat(appName, "_runtime")] && globalThis["".concat(appName, "_runtime")].call(appScope);
3696
+ var compiledTemplates = null === (_globalThis$SPROUT_CO2 = globalThis.SPROUT_COMPILED_TEMPLATES) || void 0 === _globalThis$SPROUT_CO2 ? void 0 : _globalThis$SPROUT_CO2[appName];
3697
+ compiledTemplates && "function" == typeof compiledTemplates.forEach ? compiledTemplates.forEach((function(templateEl, componentName) {
3698
+ componentName && templateEl && defineCustomElementFromTemplate(templateEl, componentName, globalStylesheet);
3699
+ })) : Array.prototype.forEach.call(document.querySelectorAll('template[app="'.concat(appName, '"]')), (function(template) {
3700
+ var componentName = template.getAttribute("for");
3701
+ componentName && defineCustomElementFromTemplate(template, componentName, globalStylesheet);
3702
+ }));
3703
+ }();
3704
+ }(appScope, config.appName), HTML_ELEMENT_CLASSES_MAP.forEach((function(itemDefinition) {
3705
+ customElements.define("reactive-".concat(itemDefinition.element), HTML_REACTIVE_ELEMENT_CLASSES[itemDefinition.element], {
3706
+ extends: itemDefinition.element
3707
+ });
3708
+ }));
3709
+ var ReactiveHeadingClass = extendElementClassWithReactiveElementClass(HTMLHeadingElement, appScope);
3710
+ [ "h1", "h2", "h3", "h4", "h5", "h6" ].forEach((function(hTag) {
3711
+ customElements.define("reactive-".concat(hTag), function(_ReactiveHeadingClass) {
3712
+ function _class() {
3713
+ return function core_classCallCheck(a, n) {
3714
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
3715
+ }(this, _class), core_callSuper(this, _class, arguments);
3716
+ }
3717
+ return function core_inherits(t, e) {
3718
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
3719
+ t.prototype = Object.create(e && e.prototype, {
3720
+ constructor: {
3721
+ value: t,
3722
+ writable: !0,
3723
+ configurable: !0
3724
+ }
3725
+ }), Object.defineProperty(t, "prototype", {
3726
+ writable: !1
3727
+ }), e && core_setPrototypeOf(t, e);
3728
+ }(_class, _ReactiveHeadingClass), function core_createClass(e, r, t) {
3729
+ return r && core_defineProperties(e.prototype, r), t && core_defineProperties(e, t),
3730
+ Object.defineProperty(e, "prototype", {
3731
+ writable: !1
3732
+ }), e;
3733
+ }(_class);
3734
+ }(ReactiveHeadingClass), {
3735
+ extends: hTag
3736
+ });
3737
+ }));
3738
+ var ReactiveInputClass = extendElementClassWithReactiveElementClass(HTMLInputElement, appScope, !0);
3739
+ customElements.define("reactive-input", ReactiveInputClass, {
3740
+ extends: "input"
3741
+ });
3742
+ var ConditionalElementClass = function getConditionalElementClass(ReactiveElementClass) {
3743
+ var _isConditionStateProp = new WeakMap, _conditionProp = new WeakMap, _renderMap = new WeakMap, ConditionalElement = function(_ReactiveElementClass) {
3744
+ function ConditionalElement() {
3745
+ var _this;
3746
+ !function ConditionalElement_classCallCheck(a, n) {
3747
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
3748
+ }(this, ConditionalElement);
3749
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
3750
+ return ConditionalElement_classPrivateFieldInitSpec(_this = ConditionalElement_callSuper(this, ConditionalElement, [].concat(args)), _isConditionStateProp, void 0),
3751
+ ConditionalElement_classPrivateFieldInitSpec(_this, _conditionProp, void 0), ConditionalElement_classPrivateFieldInitSpec(_this, _renderMap, void 0),
3752
+ _this;
3753
+ }
3754
+ return function ConditionalElement_inherits(t, e) {
3755
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
3756
+ t.prototype = Object.create(e && e.prototype, {
3757
+ constructor: {
3758
+ value: t,
3759
+ writable: !0,
3760
+ configurable: !0
3761
+ }
3762
+ }), Object.defineProperty(t, "prototype", {
3763
+ writable: !1
3764
+ }), e && ConditionalElement_setPrototypeOf(t, e);
3765
+ }(ConditionalElement, _ReactiveElementClass), function ConditionalElement_createClass(e, r, t) {
3766
+ return r && ConditionalElement_defineProperties(e.prototype, r), t && ConditionalElement_defineProperties(e, t),
3767
+ Object.defineProperty(e, "prototype", {
3768
+ writable: !1
3769
+ }), e;
3770
+ }(ConditionalElement, [ {
3771
+ key: "render",
3772
+ value: function render() {
3773
+ var conditionValue, _this2 = this, isFirstRender = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
3774
+ if (ConditionalElement_classPrivateFieldGet(_isConditionStateProp, this)) {
3775
+ if (void 0 === (conditionValue = this.getState(ConditionalElement_classPrivateFieldGet(_conditionProp, this)))) throw Error("State value for ".concat(ConditionalElement_classPrivateFieldGet(_conditionProp, this), " not found while rendering conditional-render element:"), this);
3776
+ } else if (void 0 === (conditionValue = this.getAttribute("_condition"))) throw Error("_condition value not found while rendering conditional-render element:", this);
3777
+ var elementsToRender = [];
3778
+ ConditionalElement_classPrivateFieldGet(_renderMap, this).forEach((function(_ref) {
3779
+ var condition = _ref.condition, elements = _ref.elements;
3780
+ (function resolveCondition(operator, value, conditionStateValue) {
3781
+ if ("always" === operator) return !0;
3782
+ switch (operator) {
3783
+ case "==":
3784
+ default:
3785
+ return conditionStateValue == value;
3786
+
3787
+ case "===":
3788
+ return conditionStateValue === value;
3789
+
3790
+ case "!=":
3791
+ return conditionStateValue != value;
3792
+
3793
+ case "!==":
3794
+ return conditionStateValue !== value;
3795
+
3796
+ case "<":
3797
+ return conditionStateValue < value;
3798
+
3799
+ case "<=":
3800
+ return conditionStateValue <= value;
3801
+
3802
+ case ">":
3803
+ return conditionStateValue > value;
3804
+
3805
+ case ">=":
3806
+ return conditionStateValue >= value;
3807
+ }
3808
+ })(condition.operator, condition.value, conditionValue) && elementsToRender.push.apply(elementsToRender, ConditionalElement_toConsumableArray(elements));
3809
+ })), isFirstRender ? (this.innerHTML = "", this.append.apply(this, elementsToRender)) : elementsToRender.length && queueConditionalRender(this, (function() {
3810
+ _this2.innerHTML = "", _this2.append.apply(_this2, elementsToRender);
3811
+ }));
3812
+ }
3813
+ }, {
3814
+ key: "generateRenderMap",
3815
+ value: function generateRenderMap() {
3816
+ var renderMap = new Map;
3817
+ renderMap.set("always", []), ConditionalElement_toConsumableArray(this.children).forEach((function(conditionalChild) {
3818
+ var _if = conditionalChild.getAttribute("_if").replaceAll(" ", "");
3819
+ if (_if) if (renderMap.has(_if)) renderMap.get(_if).elements.push(conditionalChild); else {
3820
+ var _cond$trim$split2 = ConditionalElement_slicedToArray(cond.trim().split(CONDITIONAL_OPERATORS_REGEX), 3), conditionObj = {
3821
+ operator: _cond$trim$split2[1],
3822
+ value: function attributeValueToTypedValue(attrValue) {
3823
+ var typedValue = attrValue;
3824
+ return "true" === attrValue ? typedValue = !0 : "false" === attrValue ? typedValue = !1 : isNaN(Number(attrValue)) || (typedValue = Number(attrValue)),
3825
+ typedValue;
3826
+ }(_cond$trim$split2[2])
3827
+ };
3828
+ renderMap.set(_if, {
3829
+ condition: conditionObj,
3830
+ elements: [ conditionalChild ]
3831
+ });
3832
+ } else renderMap.get("always").elements.push(conditionalChild);
3833
+ })), ConditionalElement_classPrivateFieldSet(_renderMap, this, renderMap);
3834
+ }
3835
+ }, {
3836
+ key: "activate",
3837
+ value: function activate() {
3838
+ var condition = this.getAttribute("_condition");
3839
+ if (!condition) throw Error("conditional-render elements must have a _condition attribute!");
3840
+ if (0 === condition.indexOf("@") ? (bindPropAttribute.call(this, "_condition", condition),
3841
+ ConditionalElement_classPrivateFieldSet(_isConditionStateProp, this, !1), ConditionalElement_classPrivateFieldSet(_conditionProp, this, condition.substring(1))) : (ConditionalElement_classPrivateFieldSet(_isConditionStateProp, this, !0),
3842
+ ConditionalElement_classPrivateFieldSet(_conditionProp, this, condition)), ConditionalElement_classPrivateFieldGet(_isConditionStateProp, this)) {
3843
+ var statePropName = ConditionalElement_classPrivateFieldGet(_conditionProp, this), _this$getState2 = ConditionalElement_slicedToArray(this.getState(statePropName, !0), 2), stateValue = _this$getState2[0], stateObject = _this$getState2[1];
3844
+ if (void 0 === ConditionalElement_typeof(stateValue)) throw Error("State property ".concat(statePropName, " not defined for _condition command!"));
3845
+ var stateManager = stateObject._stateManager;
3846
+ stateManager.has("conditional-element") || stateManager.use(conditionalElements, "conditional-element"),
3847
+ stateManager.addConditionallyRenderingElements(statePropName, this), this.generateRenderMap(),
3848
+ this.render(!0);
3849
+ } else this.render(!0);
3850
+ }
3851
+ } ]);
3852
+ }(ReactiveElementClass);
3853
+ return function ConditionalElement_defineProperty(e, r, t) {
3854
+ (r = ConditionalElement_toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
3855
+ value: t,
3856
+ enumerable: !0,
3857
+ configurable: !0,
3858
+ writable: !0
3859
+ }) : e[r] = t;
3860
+ }(ConditionalElement, "observedAttributes", [ "_condition" ]), ConditionalElement;
3861
+ }(extendElementClassWithReactiveElementClass(HTMLElement, appScope));
3862
+ customElements.define("conditional-render", ConditionalElementClass);
3863
+ })();
3864
+ //# sourceMappingURL=sprout-core.strict.js.map