marko 6.0.164 → 6.0.166

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.
package/dist/dom.js CHANGED
@@ -1,1683 +1,1114 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: !0 });
9
- }, __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from == "object" || typeof from == "function")
11
- for (let key of __getOwnPropNames(from))
12
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- return to;
1
+ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
2
+ let str = "", sep = "", part;
3
+ if (val) if (typeof val != "object") str += val;
4
+ else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
5
+ else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
6
+ return str;
7
+ }, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), defaultDelegator = /* @__PURE__ */ createDelegator(), R = /[^\p{L}\p{N}]/gu, parsers = {}, nextScopeId = 1e6, destroyNestedScopes = function destroyNestedScopes(scope) {
8
+ scope.I = 1, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(resetControllers);
9
+ }, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), walker = /* @__PURE__ */ document.createTreeWalker(document), walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
10
+ let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
11
+ for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) {
12
+ let node = walker.currentNode;
13
+ scope[decodeAccessor(currentScopeIndex++)] = node;
14
+ } else if (value === 37 || value === 49) walker.currentNode.replaceWith(walker.currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
15
+ else if (value === 38) return currentWalkIndex;
16
+ else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
17
+ else if (value < 92) for (value = 20 * currentMultiplier + value - 67; value--;) walker.nextNode();
18
+ else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walker.nextSibling();
19
+ else if (value < 117) {
20
+ for (value = 10 * currentMultiplier + value - 107; value--;) walker.parentNode();
21
+ walker.nextSibling();
22
+ } else storedMultiplier = currentMultiplier * 10 + value - 117;
23
+ }, cloneCache = {}, registeredValues = {}, curRuntimeId, readyLookup, branchesEnabled, embedEnabled, ready = /* @__PURE__ */ ((_) => (id) => {
24
+ readyLookup[id]?.(), readyLookup[id] = 1;
25
+ })(readyLookup = {}), isResuming, inputType = "", controllableDelegate = /* @__PURE__ */ createDelegator(), _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
26
+ nodeAccessor = decodeAccessor(nodeAccessor);
27
+ let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
28
+ return enableBranches(), (scope, newRenderer, getInput) => {
29
+ let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
30
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.a || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
31
+ if (getContent) {
32
+ let content = getContent(scope);
33
+ setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
34
+ }
35
+ } else normalizedRenderer?.f && subscribeToScopeSet(normalizedRenderer.e, normalizedRenderer.f, scope[childScopeAccessor]);
36
+ if (normalizedRenderer) {
37
+ let childScope = scope[childScopeAccessor], args = getInput?.();
38
+ if (typeof normalizedRenderer == "string") (getContent ? _attrs : _attrs_content)(childScope, "a", (inputIsArgs ? args[0] : args) || {}), (childScope.Ia || childScope.Ea) && queueEffect(childScope, dynamicTagScript);
39
+ else {
40
+ for (let accessor in normalizedRenderer.g) normalizedRenderer.g[accessor](childScope, normalizedRenderer.h[accessor]);
41
+ if (normalizedRenderer.d) if (inputIsArgs) normalizedRenderer.d(childScope, normalizedRenderer._ ? args[0] : args);
42
+ else {
43
+ let inputWithContent = getContent ? {
44
+ ...args,
45
+ content: getContent(scope)
46
+ } : args || {};
47
+ normalizedRenderer.d(childScope, normalizedRenderer._ ? inputWithContent : [inputWithContent]);
48
+ }
49
+ }
50
+ }
51
+ };
52
+ }, _for_of = /* @__PURE__ */ loop(([all, by = bySecondArg], cb) => {
53
+ typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
54
+ }), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), asyncRendersLookup, caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, runEffects = ((effects) => {
55
+ for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
56
+ }), runRender = (render) => render.c(render.b, render.d), catchEnabled, classIdToBranch = /* @__PURE__ */ new Map(), compat = {
57
+ patchDynamicTag,
58
+ queueEffect,
59
+ init(warp10Noop) {
60
+ _resume("$C_s", (branch) => {
61
+ classIdToBranch.set(branch.m5c, branch);
62
+ }), _resume("$C_b", warp10Noop);
63
+ },
64
+ registerRenderer(fn) {
65
+ _resume("$C_r", fn);
66
+ },
67
+ isRenderer(renderer) {
68
+ return renderer.b;
69
+ },
70
+ getStartNode(branch) {
71
+ return branch.S;
72
+ },
73
+ setScopeNodes(branch, startNode, endNode) {
74
+ branch.S = startNode, branch.K = endNode;
75
+ },
76
+ runComponentEffects() {
77
+ this.effects && runEffects(this.effects);
78
+ },
79
+ runComponentDestroy() {
80
+ this.scope && destroyBranch(this.scope);
81
+ },
82
+ resolveRegistered(value, $global) {
83
+ return Array.isArray(value) && typeof value[0] == "string" ? getRegisteredWithScope(value[0], value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]) : value;
84
+ },
85
+ createRenderer(params, clone) {
86
+ let renderer = _content("", 0, 0, 0, params)();
87
+ return renderer.b = (branch) => {
88
+ let cloned = clone();
89
+ branch.S = cloned.startNode, branch.K = cloned.endNode;
90
+ }, renderer;
91
+ },
92
+ render(out, component, renderer, args) {
93
+ let branch = component.scope, created = 0;
94
+ if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), typeof args[0] == "object" && "renderBody" in args[0]) {
95
+ let input = args[0], normalizedInput = args[0] = {};
96
+ for (let key in input) normalizedInput[key === "renderBody" ? "content" : key] = input[key];
97
+ }
98
+ if (component.effects = prepareEffects(() => {
99
+ branch ||= (created = 1, component.scope = createAndSetupBranch(out.global, renderer, renderer.e, document.body)), renderer.d?.(branch, renderer._ ? args[0] : args);
100
+ }), created) return toInsertNode(branch.S, branch.K);
101
+ }
102
+ }, _template = (id, template, walks, setup, inputSignal) => {
103
+ let renderer = _content(id, template, walks, setup, inputSignal)();
104
+ return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
14
105
  };
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
-
17
- // src/dom.ts
18
- var dom_exports = {};
19
- __export(dom_exports, {
20
- $signal: () => $signal,
21
- $signalReset: () => $signalReset,
22
- _assert_hoist: () => _assert_hoist,
23
- _assert_init: () => _assert_init,
24
- _attr: () => _attr,
25
- _attr_class: () => _attr_class,
26
- _attr_class_item: () => _attr_class_item,
27
- _attr_class_items: () => _attr_class_items,
28
- _attr_content: () => _attr_content,
29
- _attr_details_open: () => _attr_details_or_dialog_open,
30
- _attr_details_open_default: () => _attr_details_or_dialog_open_default,
31
- _attr_details_open_script: () => _attr_details_or_dialog_open_script,
32
- _attr_dialog_open: () => _attr_details_or_dialog_open,
33
- _attr_dialog_open_default: () => _attr_details_or_dialog_open_default,
34
- _attr_dialog_open_script: () => _attr_details_or_dialog_open_script,
35
- _attr_input_checked: () => _attr_input_checked,
36
- _attr_input_checkedValue: () => _attr_input_checkedValue,
37
- _attr_input_checkedValue_default: () => _attr_input_checkedValue_default,
38
- _attr_input_checkedValue_script: () => _attr_input_checkedValue_script,
39
- _attr_input_checked_default: () => _attr_input_checked_default,
40
- _attr_input_checked_script: () => _attr_input_checked_script,
41
- _attr_input_value: () => _attr_input_value,
42
- _attr_input_value_default: () => _attr_input_value_default,
43
- _attr_input_value_script: () => _attr_input_value_script,
44
- _attr_nonce: () => _attr_nonce,
45
- _attr_select_value: () => _attr_select_value,
46
- _attr_select_value_default: () => _attr_select_value_default,
47
- _attr_select_value_script: () => _attr_select_value_script,
48
- _attr_style: () => _attr_style,
49
- _attr_style_item: () => _attr_style_item,
50
- _attr_style_items: () => _attr_style_items,
51
- _attr_textarea_value: () => _attr_input_value,
52
- _attr_textarea_value_default: () => _attr_input_value_default,
53
- _attr_textarea_value_script: () => _attr_input_value_script,
54
- _attrs: () => _attrs,
55
- _attrs_content: () => _attrs_content,
56
- _attrs_partial: () => _attrs_partial,
57
- _attrs_partial_content: () => _attrs_partial_content,
58
- _attrs_script: () => _attrs_script,
59
- _await_content: () => _await_content,
60
- _await_promise: () => _await_promise,
61
- _call: () => _call,
62
- _child_setup: () => _child_setup,
63
- _closure: () => _closure,
64
- _closure_get: () => _closure_get,
65
- _const: () => _const,
66
- _content: () => _content,
67
- _content_closures: () => _content_closures,
68
- _content_resume: () => _content_resume,
69
- _dynamic_tag: () => _dynamic_tag,
70
- _el: () => _el,
71
- _el_read: () => _el_read,
72
- _enable_catch: () => _enable_catch,
73
- _for_closure: () => _for_closure,
74
- _for_in: () => _for_in,
75
- _for_of: () => _for_of,
76
- _for_to: () => _for_to,
77
- _for_until: () => _for_until,
78
- _hoist: () => _hoist,
79
- _hoist_resume: () => _hoist_resume,
80
- _html: () => _html,
81
- _id: () => _id,
82
- _if: () => _if,
83
- _if_closure: () => _if_closure,
84
- _let: () => _let,
85
- _lifecycle: () => _lifecycle,
86
- _on: () => _on,
87
- _or: () => _or,
88
- _resume: () => _resume,
89
- _resume_dynamic_tag: () => _resume_dynamic_tag,
90
- _return: () => _return,
91
- _return_change: () => _return_change,
92
- _script: () => _script,
93
- _template: () => _template,
94
- _text: () => _text,
95
- _text_content: () => _text_content,
96
- _to_text: () => _to_text,
97
- _try: () => _try,
98
- _var: () => _var,
99
- _var_change: () => _var_change,
100
- _var_resume: () => _var_resume,
101
- attrTag: () => attrTag,
102
- attrTags: () => attrTags,
103
- compat: () => compat,
104
- forIn: () => forIn,
105
- forOf: () => forOf,
106
- forTo: () => forTo,
107
- forUntil: () => forUntil,
108
- init: () => init,
109
- initEmbedded: () => initEmbedded,
110
- run: () => run
111
- });
112
- module.exports = __toCommonJS(dom_exports);
113
-
114
- // src/common/attr-tag.ts
115
- var empty = [], rest = /* @__PURE__ */ Symbol();
106
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
107
+ //#region src/common/attr-tag.ts
116
108
  function attrTag(attrs) {
117
- return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
109
+ return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
118
110
  }
119
111
  function attrTags(first, attrs) {
120
- return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
112
+ return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
121
113
  }
122
114
  function* attrTagIterator() {
123
- yield this, yield* this[rest];
124
- }
125
-
126
- // src/common/errors.ts
127
- function _assert_hoist(value) {
115
+ yield this, yield* this[rest];
128
116
  }
117
+ function _assert_hoist(value) {}
129
118
  function _assert_init(scope, accessor) {
130
- return scope[accessor];
119
+ return scope[accessor];
131
120
  }
132
-
133
- // src/common/for.ts
121
+ //#endregion
122
+ //#region src/common/for.ts
134
123
  function forIn(obj, cb) {
135
- for (let key in obj)
136
- cb(key, obj[key]);
124
+ for (let key in obj) cb(key, obj[key]);
137
125
  }
138
126
  function forOf(list, cb) {
139
- if (list) {
140
- let i = 0;
141
- for (let item of list)
142
- cb(item, i++);
143
- }
127
+ if (list) {
128
+ let i = 0;
129
+ for (let item of list) cb(item, i++);
130
+ }
144
131
  }
145
132
  function forTo(to, from, step, cb) {
146
- let start = from || 0, delta = step || 1;
147
- for (let steps = (to - start) / delta, i = 0; i <= steps; i++)
148
- cb(start + i * delta);
133
+ let start = from || 0, delta = step || 1;
134
+ for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
149
135
  }
150
136
  function forUntil(until, from, step, cb) {
151
- let start = from || 0, delta = step || 1;
152
- for (let steps = (until - start) / delta, i = 0; i < steps; i++)
153
- cb(start + i * delta);
137
+ let start = from || 0, delta = step || 1;
138
+ for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
154
139
  }
155
-
156
- // src/common/helpers.ts
140
+ //#endregion
141
+ //#region src/common/helpers.ts
157
142
  function _call(fn, v) {
158
- return fn(v), v;
159
- }
160
- function classValue(classValue2) {
161
- return toDelimitedString(classValue2, " ", stringifyClassObject);
143
+ return fn(v), v;
162
144
  }
163
145
  function stringifyClassObject(name, value) {
164
- return value ? name : "";
165
- }
166
- function styleValue(styleValue2) {
167
- return toDelimitedString(styleValue2, ";", stringifyStyleObject);
146
+ return value ? name : "";
168
147
  }
169
148
  function stringifyStyleObject(name, value) {
170
- return value || value === 0 ? name + ":" + value : "";
171
- }
172
- function toDelimitedString(val, delimiter, stringify) {
173
- let str = "", sep = "", part;
174
- if (val)
175
- if (typeof val != "object")
176
- str += val;
177
- else if (Array.isArray(val))
178
- for (let v of val)
179
- part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
180
- else
181
- for (let name in val)
182
- part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
183
- return str;
149
+ return value || value === 0 ? name + ":" + value : "";
184
150
  }
185
151
  function isEventHandler(name) {
186
- return /^on[A-Z-]/.test(name);
152
+ return /^on[A-Z-]/.test(name);
187
153
  }
188
154
  function getEventHandlerName(name) {
189
- return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
155
+ return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
190
156
  }
191
157
  function normalizeDynamicRenderer(value) {
192
- if (value) {
193
- if (typeof value == "string") return value;
194
- let normalized = value.content || value.default || value;
195
- if (/* @__KEY__ */ "g" in normalized)
196
- return normalized;
197
- }
198
- }
199
- var decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36);
200
-
201
- // src/common/opt.ts
158
+ if (value) {
159
+ if (typeof value == "string") return value;
160
+ let normalized = value.content || value.default || value;
161
+ if ("a" in normalized) return normalized;
162
+ }
163
+ }
164
+ //#endregion
165
+ //#region src/common/opt.ts
202
166
  function toArray(opt) {
203
- return opt ? Array.isArray(opt) ? opt : [opt] : [];
167
+ return opt ? Array.isArray(opt) ? opt : [opt] : [];
204
168
  }
205
169
  function push(opt, item) {
206
- return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
170
+ return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
207
171
  }
208
-
209
- // src/dom/event.ts
210
- var defaultDelegator = createDelegator();
172
+ //#endregion
173
+ //#region src/dom/event.ts
211
174
  function _on(element, type, handler) {
212
- element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
175
+ element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
213
176
  }
177
+ /* @__NO_SIDE_EFFECTS__ */
214
178
  function createDelegator() {
215
- let kEvents = /* @__PURE__ */ Symbol();
216
- return function(node, type, handler) {
217
- ((node = node.getRootNode())[kEvents] ||= {})[type] ||= (node.addEventListener(type, handler, !0), 1);
218
- };
179
+ let kEvents = Symbol();
180
+ return function(node, type, handler) {
181
+ ((node = node.getRootNode())[kEvents] ||= {})[type] ||= (node.addEventListener(type, handler, !0), 1);
182
+ };
219
183
  }
220
184
  function handleDelegated(ev) {
221
- let target = !rendering && ev.target;
222
- for (; target; )
223
- target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
224
- }
225
-
226
- // src/dom/resolve-cursor-position.ts
227
- var R = /[^\p{L}\p{N}]/gu;
228
- function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
229
- if (
230
- // If initial position is null or false then
231
- // either this node is not the active element
232
- // or does not support selection ranges.
233
- (initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
234
- /kw/.test(inputType2))
235
- ) {
236
- let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
237
- if (updatedValue.startsWith(before)) return initialPosition;
238
- if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
239
- let count = before.replace(R, "").length, pos = 0;
240
- for (; count && updatedValue[pos]; )
241
- updatedValue[pos++].replace(R, "") && count--;
242
- return pos;
243
- }
244
- return -1;
245
- }
246
-
247
- // src/dom/parse-html.ts
248
- var parsers = {};
185
+ let target = !rendering && ev.target;
186
+ for (; target;) target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
187
+ }
188
+ //#endregion
189
+ //#region src/dom/resolve-cursor-position.ts
190
+ function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
191
+ if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
192
+ let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
193
+ if (updatedValue.startsWith(before)) return initialPosition;
194
+ if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
195
+ let count = before.replace(R, "").length, pos = 0;
196
+ for (; count && updatedValue[pos];) updatedValue[pos++].replace(R, "") && count--;
197
+ return pos;
198
+ }
199
+ return -1;
200
+ }
201
+ //#endregion
202
+ //#region src/dom/parse-html.ts
249
203
  function parseHTML(html, ns) {
250
- let parser = parsers[ns] ||= document.createElementNS(ns, "template");
251
- return parser.innerHTML = html, parser.content || parser;
204
+ let parser = parsers[ns] ||= document.createElementNS(ns, "template");
205
+ return parser.innerHTML = html, parser.content || parser;
252
206
  }
253
-
254
- // src/dom/scope.ts
255
- var nextScopeId = 1e6;
207
+ //#endregion
208
+ //#region src/dom/scope.ts
256
209
  function createScope($global, closestBranch) {
257
- let scope = {
258
- L: nextScopeId++,
259
- H: 1,
260
- F: closestBranch,
261
- $: $global
262
- };
263
- return pendingScopes.push(scope), scope;
210
+ let scope = {
211
+ L: nextScopeId++,
212
+ H: 1,
213
+ F: closestBranch,
214
+ $: $global
215
+ };
216
+ return pendingScopes.push(scope), scope;
264
217
  }
265
218
  function skipScope() {
266
- return nextScopeId++;
219
+ return nextScopeId++;
267
220
  }
268
221
  function findBranchWithKey(scope, key) {
269
- let branch = scope.F;
270
- for (; branch && !branch[key]; )
271
- branch = branch.N;
272
- return branch;
222
+ let branch = scope.F;
223
+ for (; branch && branch[key] == null;) branch = branch.N;
224
+ return branch;
273
225
  }
274
226
  function destroyBranch(branch) {
275
- branch.N?.D?.delete(
276
- branch
277
- ), destroyNestedScopes(branch);
227
+ branch.N?.D?.delete(branch), destroyNestedScopes(branch);
278
228
  }
279
229
  function destroyScope(scope) {
280
- scope.I || (destroyNestedScopes(scope), resetControllers(scope));
281
- }
282
- function destroyNestedScopes(scope) {
283
- scope.I = 1, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(resetControllers);
230
+ scope.I || (destroyNestedScopes(scope), resetControllers(scope));
284
231
  }
285
232
  function resetControllers(scope) {
286
- for (let id in scope.A)
287
- $signalReset(scope, id);
233
+ for (let id in scope.A) $signalReset(scope, id);
288
234
  }
289
235
  function removeAndDestroyBranch(branch) {
290
- destroyBranch(branch), removeChildNodes(
291
- branch.S,
292
- branch.K
293
- );
236
+ destroyBranch(branch), removeChildNodes(branch.S, branch.K);
294
237
  }
295
238
  function insertBranchBefore(branch, parentNode, nextSibling) {
296
- insertChildNodes(
297
- parentNode,
298
- nextSibling,
299
- branch.S,
300
- branch.K
301
- );
239
+ insertChildNodes(parentNode, nextSibling, branch.S, branch.K);
302
240
  }
303
241
  function tempDetachBranch(branch) {
304
- let fragment = new DocumentFragment();
305
- fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(
306
- fragment,
307
- null,
308
- branch.S,
309
- branch.K
310
- );
311
- }
312
-
313
- // src/dom/schedule.ts
314
- var isScheduled, channel;
242
+ let fragment = new DocumentFragment();
243
+ fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.S, branch.K);
244
+ }
245
+ //#endregion
246
+ //#region src/dom/schedule.ts
315
247
  function schedule() {
316
- isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
248
+ isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
317
249
  }
318
250
  function flushAndWaitFrame() {
319
- run(), requestAnimationFrame(triggerMacroTask);
251
+ run(), requestAnimationFrame(triggerMacroTask);
320
252
  }
321
253
  function triggerMacroTask() {
322
- channel || (channel = new MessageChannel(), channel.port1.onmessage = () => {
323
- isScheduled = 0, run();
324
- }), channel.port2.postMessage(0);
254
+ channel || (channel = new MessageChannel(), channel.port1.onmessage = () => {
255
+ isScheduled = 0, run();
256
+ }), channel.port2.postMessage(0);
325
257
  }
326
-
327
- // src/dom/signals.ts
258
+ //#endregion
259
+ //#region src/dom/signals.ts
328
260
  function _let(id, fn) {
329
- let valueAccessor = decodeAccessor(id), valueChangeAccessor = "M" /* TagVariableChange */ + valueAccessor;
330
- return (scope, value, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope.H) && (scope[valueAccessor] = value, fn?.(scope)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value) : scope[valueAccessor] !== (scope[valueAccessor] = value) && fn && (schedule(), queueRender(scope, fn, id)), value);
261
+ let valueAccessor = decodeAccessor(id), valueChangeAccessor = "M" + valueAccessor;
262
+ return (scope, value, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope.H) && (scope[valueAccessor] = value, fn?.(scope)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value) : scope[valueAccessor] !== (scope[valueAccessor] = value) && fn && (schedule(), queueRender(scope, fn, id)), value);
331
263
  }
332
264
  function _const(valueAccessor, fn) {
333
- return valueAccessor = decodeAccessor(valueAccessor), (scope, value) => {
334
- (!(valueAccessor in scope) || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn?.(scope));
335
- };
265
+ return valueAccessor = decodeAccessor(valueAccessor), (scope, value) => {
266
+ (!(valueAccessor in scope) || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn?.(scope));
267
+ };
336
268
  }
337
- function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L" /* Id */) {
338
- return scopeIdAccessor !== "L" /* Id */ && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
339
- scope.H ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
340
- };
269
+ function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
270
+ return scopeIdAccessor !== "L" && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
271
+ scope.H ? id in scope ? --scope[id] || fn(scope) : scope[id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
272
+ };
341
273
  }
342
274
  function _for_closure(ownerLoopNodeAccessor, fn) {
343
- ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor);
344
- let scopeAccessor = "A" /* BranchScopes */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
345
- let scopes = toArray(ownerScope[scopeAccessor]);
346
- scopes.length && queueRender(
347
- ownerScope,
348
- () => {
349
- for (let scope of scopes)
350
- !scope.H && !scope.I && fn(scope);
351
- },
352
- -1,
353
- 0,
354
- scopes[0].L
355
- );
356
- };
357
- return ownerSignal._ = fn, ownerSignal;
275
+ ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor);
276
+ let scopeAccessor = "A" + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
277
+ let scopes = toArray(ownerScope[scopeAccessor]);
278
+ scopes.length && queueRender(ownerScope, () => {
279
+ for (let scope of scopes) !scope.H && !scope.I && fn(scope);
280
+ }, -1, 0, scopes[0].L);
281
+ };
282
+ return ownerSignal._ = fn, ownerSignal;
358
283
  }
359
284
  function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
360
- ownerConditionalNodeAccessor = decodeAccessor(
361
- ownerConditionalNodeAccessor
362
- );
363
- let scopeAccessor = "A" /* BranchScopes */ + ownerConditionalNodeAccessor, branchAccessor = "D" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
364
- let ifScope = scope[scopeAccessor];
365
- ifScope && !ifScope.H && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, fn, -1);
366
- };
367
- return ownerSignal._ = fn, ownerSignal;
285
+ ownerConditionalNodeAccessor = decodeAccessor(ownerConditionalNodeAccessor);
286
+ let scopeAccessor = "A" + ownerConditionalNodeAccessor, branchAccessor = "D" + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
287
+ let ifScope = scope[scopeAccessor];
288
+ ifScope && !ifScope.H && (scope[branchAccessor] || 0) === branch && queueRender(ifScope, fn, -1);
289
+ };
290
+ return ownerSignal._ = fn, ownerSignal;
368
291
  }
369
292
  function subscribeToScopeSet(ownerScope, accessor, scope) {
370
- let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
371
- subscribers.has(scope) || (subscribers.add(scope), $signal(scope, -1).addEventListener(
372
- "abort",
373
- () => ownerScope[accessor].delete(scope)
374
- ));
293
+ let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
294
+ subscribers.has(scope) || (subscribers.add(scope), $signal(scope, -1).addEventListener("abort", () => ownerScope[accessor].delete(scope)));
375
295
  }
376
296
  function _closure(...closureSignals) {
377
- let [{ o: ___scopeInstancesAccessor, q: ___signalIndexAccessor }] = closureSignals;
378
- for (let i = closureSignals.length; i--; )
379
- closureSignals[i].x = i;
380
- return (scope) => {
381
- if (scope[___scopeInstancesAccessor])
382
- for (let childScope of scope[___scopeInstancesAccessor])
383
- childScope.H || queueRender(
384
- childScope,
385
- closureSignals[childScope[___signalIndexAccessor] || 0],
386
- -1
387
- );
388
- };
297
+ let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
298
+ for (let i = closureSignals.length; i--;) closureSignals[i].c = i;
299
+ return (scope) => {
300
+ if (scope[scopeInstances]) for (let childScope of scope[scopeInstances]) childScope.H || queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
301
+ };
389
302
  }
390
303
  function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
391
- valueAccessor = decodeAccessor(valueAccessor);
392
- let closureSignal = ((scope) => {
393
- scope[closureSignal.q] = closureSignal.x, fn(scope), subscribeToScopeSet(
394
- getOwnerScope ? getOwnerScope(scope) : scope._,
395
- closureSignal.o,
396
- scope
397
- );
398
- });
399
- return closureSignal.o = "B" /* ClosureScopes */ + valueAccessor, closureSignal.q = "C" /* ClosureSignalIndex */ + valueAccessor, resumeId && _resume(resumeId, closureSignal), closureSignal;
304
+ valueAccessor = decodeAccessor(valueAccessor);
305
+ let closureSignal = ((scope) => {
306
+ scope[closureSignal.b] = closureSignal.c, fn(scope), subscribeToScopeSet(getOwnerScope ? getOwnerScope(scope) : scope._, closureSignal.a, scope);
307
+ });
308
+ return closureSignal.a = "B" + valueAccessor, closureSignal.b = "C" + valueAccessor, resumeId && _resume(resumeId, closureSignal), closureSignal;
400
309
  }
401
310
  function _child_setup(setup) {
402
- return setup._ = (scope, owner) => {
403
- scope._ = owner, queueRender(scope, setup, -1);
404
- }, setup;
311
+ return setup._ = (scope, owner) => {
312
+ scope._ = owner, queueRender(scope, setup, -1);
313
+ }, setup;
405
314
  }
406
315
  function _var(scope, childAccessor, signal) {
407
- scope[decodeAccessor(childAccessor)].T = (value) => signal(scope, value);
316
+ scope[decodeAccessor(childAccessor)].T = (value) => signal(scope, value);
408
317
  }
409
- var _return = (scope, value) => scope.T?.(value);
410
318
  function _return_change(scope, changeHandler) {
411
- changeHandler && (scope.U = changeHandler);
319
+ changeHandler && (scope.U = changeHandler);
412
320
  }
413
- var _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
414
- function _id({ ["$" /* Global */]: $global }) {
415
- let id = tagIdsByGlobal.get($global) || 0;
416
- return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
321
+ function _id({ $: $global }) {
322
+ let id = tagIdsByGlobal.get($global) || 0;
323
+ return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
417
324
  }
418
325
  function _script(id, fn) {
419
- return _resume(id, fn), (scope) => {
420
- queueEffect(scope, fn);
421
- };
326
+ return _resume(id, fn), (scope) => {
327
+ queueEffect(scope, fn);
328
+ };
422
329
  }
423
330
  function _el_read(value) {
424
- return rendering && void 0, value;
331
+ return value;
425
332
  }
426
333
  function* traverse(scope, path, i = path.length - 1) {
427
- if (scope)
428
- if (Symbol.iterator in scope)
429
- for (let childScope of scope.values())
430
- yield* traverse(childScope, path, i);
431
- else {
432
- let item = scope[path[i]];
433
- i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
434
- }
334
+ if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, i);
335
+ else {
336
+ let item = scope[path[i]];
337
+ i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
338
+ }
435
339
  }
436
340
  function _hoist(...path) {
437
- return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
438
- let fn = () => traverse(scope, path).next().value;
439
- return fn[Symbol.iterator] = () => traverse(scope, path), fn;
440
- };
341
+ return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
342
+ let fn = () => traverse(scope, path).next().value;
343
+ return fn[Symbol.iterator] = () => traverse(scope, path), fn;
344
+ };
441
345
  }
442
346
  function _hoist_resume(id, ...path) {
443
- return _resume(id, _hoist(...path));
347
+ return _resume(id, _hoist(...path));
444
348
  }
445
-
446
- // src/dom/walker.ts
447
- var walker = /* @__PURE__ */ document.createTreeWalker(document);
349
+ //#endregion
350
+ //#region src/dom/walker.ts
448
351
  function walk(startNode, walkCodes, branch) {
449
- walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
450
- }
451
- function walkInternal(currentWalkIndex, walkCodes, scope) {
452
- let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
453
- for (; currentWalkIndex < walkCodes.length; )
454
- if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
455
- let node = walker.currentNode;
456
- scope[decodeAccessor(currentScopeIndex++)] = node;
457
- } else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */)
458
- walker.currentNode.replaceWith(
459
- walker.currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()
460
- ), value === 49 /* DynamicTagWithVar */ && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
461
- else {
462
- if (value === 38 /* EndChild */)
463
- return currentWalkIndex;
464
- if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */)
465
- currentWalkIndex = walkInternal(
466
- currentWalkIndex,
467
- walkCodes,
468
- scope[decodeAccessor(currentScopeIndex++)] = createScope(
469
- scope.$,
470
- scope.F
471
- )
472
- ), value === 48 /* BeginChildWithVar */ && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
473
- else if (value < 92)
474
- for (value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */; value--; )
475
- walker.nextNode();
476
- else if (value < 107)
477
- for (value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */; value--; )
478
- walker.nextSibling();
479
- else if (value < 117) {
480
- for (value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */; value--; )
481
- walker.parentNode();
482
- walker.nextSibling();
483
- } else
484
- storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
485
- }
486
- }
487
-
488
- // src/dom/renderer.ts
352
+ walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
353
+ }
354
+ //#endregion
355
+ //#region src/dom/renderer.ts
489
356
  function createBranch($global, renderer, parentScope, parentNode) {
490
- let branch = createScope($global);
491
- return branch._ = renderer.f || parentScope, setParentBranch(branch, parentScope?.F), renderer.k?.(
492
- branch,
493
- parentNode.namespaceURI
494
- ), branch;
357
+ let branch = createScope($global);
358
+ return branch._ = renderer.e || parentScope, setParentBranch(branch, parentScope?.F), renderer.b?.(branch, parentNode.namespaceURI), branch;
495
359
  }
496
360
  function setParentBranch(branch, parentBranch) {
497
- parentBranch && (branch.N = parentBranch, (parentBranch.D ||= /* @__PURE__ */ new Set()).add(branch)), branch.F = branch;
361
+ parentBranch && (branch.N = parentBranch, (parentBranch.D ||= /* @__PURE__ */ new Set()).add(branch)), branch.F = branch;
498
362
  }
499
363
  function createAndSetupBranch($global, renderer, parentScope, parentNode) {
500
- return setupBranch(
501
- renderer,
502
- createBranch($global, renderer, parentScope, parentNode)
503
- );
364
+ return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
504
365
  }
505
366
  function setupBranch(renderer, branch) {
506
- return renderer.l && queueRender(branch, renderer.l, -1), branch;
367
+ return renderer.c && queueRender(branch, renderer.c, -1), branch;
507
368
  }
508
369
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
509
- walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
510
- let clone = template ? (branch, ns) => {
511
- ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
512
- template,
513
- ns
514
- ))(branch, walks);
515
- } : (branch) => {
516
- walk(
517
- branch.S = branch.K = new Text(),
518
- walks,
519
- branch
520
- );
521
- };
522
- return (owner) => ({
523
- g: id,
524
- k: clone,
525
- f: owner,
526
- l: setup,
527
- d: params,
528
- e: dynamicScopesAccessor
529
- });
370
+ walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
371
+ let clone = template ? (branch, ns) => {
372
+ ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
373
+ } : (branch) => {
374
+ walk(branch.S = branch.K = new Text(), walks, branch);
375
+ };
376
+ return (owner) => ({
377
+ a: id,
378
+ b: clone,
379
+ e: owner,
380
+ c: setup,
381
+ d: params,
382
+ f: dynamicScopesAccessor
383
+ });
530
384
  }
531
385
  function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
532
- return _resume(
533
- id,
534
- _content(id, template, walks, setup, params, dynamicScopesAccessor)
535
- );
386
+ return _resume(id, _content(id, template, walks, setup, params, dynamicScopesAccessor));
536
387
  }
537
388
  function _content_closures(renderer, closureFns) {
538
- let closureSignals = {};
539
- for (let key in closureFns)
540
- closureSignals[key] = _const(+key, closureFns[key]);
541
- return (owner, closureValues) => {
542
- let instance = renderer(owner);
543
- return instance.h = closureSignals, instance.t = closureValues, instance;
544
- };
545
- }
546
- var cloneCache = {};
389
+ let closureSignals = {};
390
+ for (let key in closureFns) closureSignals[key] = _const(+key, closureFns[key]);
391
+ return (owner, closureValues) => {
392
+ let instance = renderer(owner);
393
+ return instance.g = closureSignals, instance.h = closureValues, instance;
394
+ };
395
+ }
547
396
  function createCloneableHTML(html, ns) {
548
- let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
549
- return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
550
- walk(
551
- branch.S = branch.K = firstChild.cloneNode(!0),
552
- walks,
553
- branch
554
- );
555
- } : (branch, walks) => {
556
- let clone = parent.cloneNode(!0);
557
- walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
558
- };
559
- }
560
-
561
- // src/dom/resume.ts
562
- var registeredValues = {}, curRuntimeId, readyLookup, branchesEnabled, embedEnabled;
397
+ let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
398
+ return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
399
+ walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch);
400
+ } : (branch, walks) => {
401
+ let clone = parent.cloneNode(!0);
402
+ walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
403
+ };
404
+ }
405
+ //#endregion
406
+ //#region src/dom/resume.ts
563
407
  function enableBranches() {
564
- branchesEnabled = 1;
408
+ branchesEnabled = 1;
565
409
  }
566
- var ready = /* @__PURE__ */ ((_) => (id) => {
567
- readyLookup[id]?.(), readyLookup[id] = 1;
568
- })(readyLookup = {});
569
410
  function initEmbedded(readyId, runtimeId) {
570
- embedEnabled = 1, ready(readyId), init(runtimeId), new MutationObserver(() => {
571
- let renders = self[curRuntimeId];
572
- for (let renderId in renders) {
573
- let { s, n } = renders[renderId];
574
- if (n && !n.isConnected) {
575
- delete renders[renderId];
576
- for (let id in s)
577
- destroyScope(s[id]);
578
- }
579
- }
580
- }).observe(document.body, { childList: !0, subtree: !0 });
411
+ embedEnabled = 1, ready(readyId), init(runtimeId), new MutationObserver(() => {
412
+ let renders = self[curRuntimeId];
413
+ for (let renderId in renders) {
414
+ let { s, n } = renders[renderId];
415
+ if (n && !n.isConnected) {
416
+ delete renders[renderId];
417
+ for (let id in s) destroyScope(s[id]);
418
+ }
419
+ }
420
+ }).observe(document.body, {
421
+ childList: !0,
422
+ subtree: !0
423
+ });
581
424
  }
582
425
  function init(runtimeId = "M") {
583
- if (curRuntimeId)
584
- return;
585
- curRuntimeId = runtimeId;
586
- let resumeRender, renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders2) => {
587
- defineRuntime({
588
- value: resumeRender = ((renderId) => {
589
- let render = resumeRender[renderId] = renders2[renderId] || renders2(renderId), walk2 = render.w, scopeLookup = render.s = {}, getScope = (id) => scopeLookup[id] ||= { L: +id }, serializeContext = {
590
- _: registeredValues
591
- }, visitBranches = branchesEnabled && /* @__PURE__ */ ((branchScopesStack = [], branchStarts = [], orphanBranches = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length) => {
592
- for (visitType !== "[" /* BranchStart */ && (visitScope[nextToken(
593
- /* read accessor */
594
- )] = visitType === ")" /* BranchEndOnlyChildInParent */ || visitType === "}" /* BranchEndSingleNodeOnlyChildInParent */ ? parent : visit, accessor = "A" /* BranchScopes */ + lastToken, singleNode = visitType !== "]" /* BranchEnd */ && visitType !== ")" /* BranchEndOnlyChildInParent */, nextToken(
595
- /* read optional first branchId */
596
- )); branchId = +lastToken; ) {
597
- if ((endedBranches ||= []).push(
598
- branch = getScope(branchId)
599
- ), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
600
- for (; startVisit.previousSibling && ~visits.indexOf(
601
- startVisit = startVisit.previousSibling
602
- ); ) ;
603
- branch.K = branch.S = startVisit, visitType === "'" /* BranchEndNativeTag */ && (branch.a = startVisit);
604
- } else
605
- curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
606
- for (; i && orphanBranches[--i].L > branchId; )
607
- setParentBranch(orphanBranches.pop(), branch);
608
- nextToken(
609
- /* read optional next branchId */
610
- );
611
- }
612
- endedBranches && (orphanBranches.push(...endedBranches), singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0])), visitType === "[" /* BranchStart */ && (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit));
613
- })(), nextToken = () => lastToken = visitText.slice(
614
- lastTokenIndex,
615
- (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1
616
- ), $global, lastEffect, visits, resumes, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, lastScopeId = 0;
617
- return render.m = (effects = []) => {
618
- if (readyLookup) {
619
- for (let readyId in render.b)
620
- if (readyLookup[readyId] !== 1)
621
- return readyLookup[readyId] = /* @__PURE__ */ ((prev) => () => {
622
- render.m(), prev?.();
623
- })(readyLookup[readyId]), effects;
624
- render.b = 0;
625
- }
626
- for (let serialized of resumes = render.r || [])
627
- if (typeof serialized == "string")
628
- for (lastTokenIndex = 0, visitText = serialized; nextToken(); )
629
- /\D/.test(lastToken) ? lastEffect = registeredValues[lastToken] : effects.push(lastEffect, getScope(lastToken));
630
- else
631
- for (let scope of serialized(serializeContext))
632
- $global ? typeof scope == "number" ? lastScopeId += scope : (scopeLookup[scope.L = ++lastScopeId] = scope, scope.$ = $global, branchesEnabled && (scope.F = getScope(
633
- scope.G
634
- ))) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId);
635
- for (visit of visits = render.v)
636
- if (lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken(
637
- /* read scope id */
638
- )), visitType === "*" /* Node */) {
639
- let prev = visit.previousSibling;
640
- visitScope[nextToken(
641
- /* read accessor */
642
- )] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
643
- } else branchesEnabled && visitBranches();
644
- return embedEnabled && (render.n ||= visit?.parentNode.insertBefore(
645
- new Text(),
646
- visit.nextSibling
647
- )), visits.length = resumes.length = 0, effects;
648
- }, render.w = () => {
649
- walk2(), runResumeEffects(render);
650
- }, render;
651
- })
652
- });
653
- };
654
- if (renders) {
655
- initRuntime(renders);
656
- for (let renderId in renders)
657
- runResumeEffects(resumeRender(renderId));
658
- } else
659
- defineRuntime({
660
- configurable: !0,
661
- set: initRuntime
662
- });
663
- }
664
- var isResuming;
426
+ if (curRuntimeId) return;
427
+ curRuntimeId = runtimeId;
428
+ let resumeRender, renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
429
+ defineRuntime({ value: resumeRender = ((renderId) => {
430
+ let render = resumeRender[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = render.s = {}, getScope = (id) => scopeLookup[id] ||= { L: +id }, serializeContext = { _: registeredValues }, visitBranches = branchesEnabled && ((branchScopesStack = [], branchStarts = [], orphanBranches = [], curBranchScopes) => (branchId, branch, endedBranches, accessor, singleNode, parent = visit.parentNode, startVisit = visit, i = orphanBranches.length) => {
431
+ for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + lastToken, singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
432
+ if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
433
+ for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
434
+ branch.K = branch.S = startVisit, visitType === "'" && (branch.a = startVisit);
435
+ } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
436
+ for (; i && orphanBranches[--i].L > branchId;) setParentBranch(orphanBranches.pop(), branch);
437
+ nextToken();
438
+ }
439
+ endedBranches && (orphanBranches.push(...endedBranches), singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0])), visitType === "[" && (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit));
440
+ })(), nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), $global, lastEffect, visits, resumes, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, lastScopeId = 0;
441
+ return render.m = (effects = []) => {
442
+ if (readyLookup) {
443
+ for (let readyId in render.b) if (readyLookup[readyId] !== 1) return readyLookup[readyId] = ((prev) => () => {
444
+ render.m(), prev?.();
445
+ })(readyLookup[readyId]), effects;
446
+ render.b = 0;
447
+ }
448
+ for (let serialized of resumes = render.r || []) if (typeof serialized == "string") for (lastTokenIndex = 0, visitText = serialized; nextToken();) /\D/.test(lastToken) ? lastEffect = registeredValues[lastToken] : effects.push(lastEffect, getScope(lastToken));
449
+ else for (let scope of serialized(serializeContext)) $global ? typeof scope == "number" ? lastScopeId += scope : (scopeLookup[scope.L = ++lastScopeId] = scope, scope.$ = $global, branchesEnabled && (scope.F = getScope(scope.G))) : ($global = scope || {}, $global.runtimeId = runtimeId, $global.renderId = renderId);
450
+ for (visit of visits = render.v) if (lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), visitType === "*") {
451
+ let prev = visit.previousSibling;
452
+ visitScope[nextToken()] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
453
+ } else branchesEnabled && visitBranches();
454
+ return embedEnabled && (render.n ||= visit?.parentNode.insertBefore(new Text(), visit.nextSibling)), visits.length = resumes.length = 0, effects;
455
+ }, render.w = () => {
456
+ walk(), runResumeEffects(render);
457
+ }, render;
458
+ }) });
459
+ };
460
+ if (renders) {
461
+ initRuntime(renders);
462
+ for (let renderId in renders) runResumeEffects(resumeRender(renderId));
463
+ } else defineRuntime({
464
+ configurable: !0,
465
+ set: initRuntime
466
+ });
467
+ }
665
468
  function runResumeEffects(render) {
666
- try {
667
- isResuming = 1, runEffects(render.m(), 1);
668
- } finally {
669
- isResuming = 0;
670
- }
469
+ try {
470
+ isResuming = 1, runEffects(render.m(), 1);
471
+ } finally {
472
+ isResuming = 0;
473
+ }
671
474
  }
672
475
  function getRegisteredWithScope(id, scope) {
673
- let val = registeredValues[id];
674
- return scope ? val(scope) : val;
476
+ let val = registeredValues[id];
477
+ return scope ? val(scope) : val;
675
478
  }
676
479
  function _resume(id, obj) {
677
- return registeredValues[id] = obj;
480
+ return registeredValues[id] = obj;
678
481
  }
679
482
  function _var_resume(id, signal) {
680
- return _resume(id, (scope) => (value) => signal(scope, value)), signal;
483
+ return _resume(id, (scope) => (value) => signal(scope, value)), signal;
681
484
  }
682
485
  function _el(id, accessor) {
683
- return accessor = decodeAccessor(accessor), _resume(id, (scope) => () => scope[accessor]);
486
+ return accessor = decodeAccessor(accessor), _resume(id, (scope) => () => scope[accessor]);
684
487
  }
685
-
686
- // src/dom/controllable.ts
687
- var inputType = "", controllableDelegate = createDelegator();
488
+ //#endregion
489
+ //#region src/dom/controllable.ts
688
490
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
689
- let el = scope[nodeAccessor], normalizedChecked = normalizeBoolProp(checked);
690
- if (el.defaultChecked !== normalizedChecked) {
691
- let restoreValue = scope.H ? normalizedChecked : el.checked;
692
- el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
693
- }
491
+ let el = scope[nodeAccessor], normalizedChecked = normalizeBoolProp(checked);
492
+ if (el.defaultChecked !== normalizedChecked) {
493
+ let restoreValue = scope.H ? normalizedChecked : el.checked;
494
+ el.defaultChecked = normalizedChecked, restoreValue !== normalizedChecked && (el.checked = restoreValue);
495
+ }
694
496
  }
695
497
  function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
696
- let el = scope[nodeAccessor], normalizedChecked = normalizeBoolProp(checked);
697
- scope["E" /* ControlledHandler */ + nodeAccessor] = checkedChange, scope["F" /* ControlledType */ + nodeAccessor] = checkedChange ? 0 /* InputChecked */ : 5 /* None */, checkedChange && !scope.H ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
498
+ let el = scope[nodeAccessor], normalizedChecked = normalizeBoolProp(checked);
499
+ scope["E" + nodeAccessor] = checkedChange, scope["F" + nodeAccessor] = checkedChange ? 0 : 5, checkedChange && !scope.H ? el.checked = normalizedChecked : _attr_input_checked_default(scope, nodeAccessor, normalizedChecked);
698
500
  }
699
501
  function _attr_input_checked_script(scope, nodeAccessor) {
700
- let el = scope[nodeAccessor];
701
- syncControllableFormInput(el, hasCheckboxChanged, () => {
702
- let checkedChange = scope["E" /* ControlledHandler */ + nodeAccessor];
703
- if (checkedChange) {
704
- let newValue = el.checked;
705
- el.checked = !newValue, checkedChange(newValue), run();
706
- }
707
- });
502
+ let el = scope[nodeAccessor];
503
+ syncControllableFormInput(el, hasCheckboxChanged, () => {
504
+ let checkedChange = scope["E" + nodeAccessor];
505
+ if (checkedChange) {
506
+ let newValue = el.checked;
507
+ el.checked = !newValue, checkedChange(newValue), run();
508
+ }
509
+ });
708
510
  }
709
511
  function _attr_input_checkedValue_default(scope, nodeAccessor, checkedValue, value) {
710
- let multiple = Array.isArray(checkedValue), normalizedValue = normalizeStrProp(value), normalizedCheckedValue = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
711
- _attr(scope[nodeAccessor], "value", normalizedValue), _attr_input_checked_default(
712
- scope,
713
- nodeAccessor,
714
- multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue
715
- );
512
+ let multiple = Array.isArray(checkedValue), normalizedValue = normalizeStrProp(value), normalizedCheckedValue = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
513
+ _attr(scope[nodeAccessor], "value", normalizedValue), _attr_input_checked_default(scope, nodeAccessor, multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue);
716
514
  }
717
515
  function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
718
- let el = scope[nodeAccessor], multiple = Array.isArray(checkedValue), normalizedValue = normalizeStrProp(value), normalizedCheckedValue = scope["G" /* ControlledValue */ + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
719
- _attr(el, "value", normalizedValue), scope["E" /* ControlledHandler */ + nodeAccessor] = checkedValueChange, scope["F" /* ControlledType */ + nodeAccessor] = checkedValueChange ? 1 /* InputCheckedValue */ : 5 /* None */, checkedValueChange && !scope.H ? el.checked = multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue : _attr_input_checkedValue_default(
720
- scope,
721
- nodeAccessor,
722
- normalizedCheckedValue,
723
- normalizedValue
724
- );
516
+ let el = scope[nodeAccessor], multiple = Array.isArray(checkedValue), normalizedValue = normalizeStrProp(value), normalizedCheckedValue = scope["G" + nodeAccessor] = multiple ? checkedValue.map(normalizeStrProp) : normalizeStrProp(checkedValue);
517
+ _attr(el, "value", normalizedValue), scope["E" + nodeAccessor] = checkedValueChange, scope["F" + nodeAccessor] = checkedValueChange ? 1 : 5, checkedValueChange && !scope.H ? el.checked = multiple ? normalizedCheckedValue.includes(normalizedValue) : normalizedValue === normalizedCheckedValue : _attr_input_checkedValue_default(scope, nodeAccessor, normalizedCheckedValue, normalizedValue);
725
518
  }
726
519
  function _attr_input_checkedValue_script(scope, nodeAccessor) {
727
- let el = scope[nodeAccessor];
728
- isResuming && el.defaultChecked && (scope["G" /* ControlledValue */ + nodeAccessor] ? scope["G" /* ControlledValue */ + nodeAccessor].push(
729
- el.value
730
- ) : scope["G" /* ControlledValue */ + nodeAccessor] = el.value), syncControllableFormInput(el, hasCheckboxChanged, () => {
731
- let checkedValueChange = scope["E" /* ControlledHandler */ + nodeAccessor];
732
- if (checkedValueChange) {
733
- let oldValue = scope["G" /* ControlledValue */ + nodeAccessor], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
734
- if (el.name && el.type[0] === "r")
735
- for (let radio of el.getRootNode().querySelectorAll(
736
- `[type=radio][name=${CSS.escape(el.name)}]`
737
- ))
738
- radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
739
- else
740
- el.checked = !el.checked;
741
- checkedValueChange(newValue), run();
742
- }
743
- });
520
+ let el = scope[nodeAccessor];
521
+ isResuming && el.defaultChecked && (scope["G" + nodeAccessor] ? scope["G" + nodeAccessor].push(el.value) : scope["G" + nodeAccessor] = el.value), syncControllableFormInput(el, hasCheckboxChanged, () => {
522
+ let checkedValueChange = scope["E" + nodeAccessor];
523
+ if (checkedValueChange) {
524
+ let oldValue = scope["G" + nodeAccessor], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
525
+ if (el.name && el.type[0] === "r") for (let radio of el.getRootNode().querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
526
+ else el.checked = !el.checked;
527
+ checkedValueChange(newValue), run();
528
+ }
529
+ });
744
530
  }
745
531
  function _attr_input_value_default(scope, nodeAccessor, value) {
746
- let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
747
- if (el.defaultValue !== normalizedValue) {
748
- let restoreValue = scope.H ? normalizedValue : el.value;
749
- el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
750
- }
532
+ let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
533
+ if (el.defaultValue !== normalizedValue) {
534
+ let restoreValue = scope.H ? normalizedValue : el.value;
535
+ el.defaultValue = normalizedValue, setInputValue(el, restoreValue);
536
+ }
751
537
  }
752
538
  function _attr_input_value(scope, nodeAccessor, value, valueChange) {
753
- let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
754
- scope["E" /* ControlledHandler */ + nodeAccessor] = valueChange, scope["G" /* ControlledValue */ + nodeAccessor] = normalizedValue, scope["F" /* ControlledType */ + nodeAccessor] = valueChange ? 2 /* InputValue */ : 5 /* None */, valueChange && !scope.H ? setInputValue(el, normalizedValue) : _attr_input_value_default(scope, nodeAccessor, normalizedValue);
539
+ let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
540
+ scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && !scope.H ? setInputValue(el, normalizedValue) : _attr_input_value_default(scope, nodeAccessor, normalizedValue);
755
541
  }
756
542
  function _attr_input_value_script(scope, nodeAccessor) {
757
- let el = scope[nodeAccessor];
758
- isResuming && (scope["G" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllableFormInput(el, hasValueChanged, (ev) => {
759
- let valueChange = scope["E" /* ControlledHandler */ + nodeAccessor];
760
- valueChange && (inputType = ev?.inputType, valueChange(el.value), run(), setInputValue(el, scope["G" /* ControlledValue */ + nodeAccessor]), inputType = "");
761
- });
543
+ let el = scope[nodeAccessor];
544
+ isResuming && (scope["G" + nodeAccessor] = el.defaultValue), syncControllableFormInput(el, hasValueChanged, (ev) => {
545
+ let valueChange = scope["E" + nodeAccessor];
546
+ valueChange && (inputType = ev?.inputType, valueChange(el.value), run(), setInputValue(el, scope["G" + nodeAccessor]), inputType = "");
547
+ });
762
548
  }
763
549
  function setInputValue(el, value) {
764
- if (el.value !== value) {
765
- let updatedPosition = resolveCursorPosition(
766
- inputType,
767
- el.getRootNode().activeElement === el && el.selectionStart,
768
- el.value,
769
- el.value = value
770
- );
771
- ~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
772
- }
550
+ if (el.value !== value) {
551
+ let updatedPosition = resolveCursorPosition(inputType, el.getRootNode().activeElement === el && el.selectionStart, el.value, el.value = value);
552
+ ~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
553
+ }
773
554
  }
774
555
  function _attr_select_value_default(scope, nodeAccessor, value) {
775
- let restoreValue, el = scope[nodeAccessor], existing = !scope.H, multiple = Array.isArray(value), normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
776
- pendingEffects.unshift(() => {
777
- for (let opt of el.options) {
778
- let selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
779
- opt.defaultSelected !== selected && (existing && (restoreValue ??= getSelectValue(el, multiple)), opt.defaultSelected = selected);
780
- }
781
- restoreValue !== void 0 && setSelectValue(el, restoreValue, multiple);
782
- }, scope);
556
+ let restoreValue, el = scope[nodeAccessor], existing = !scope.H, multiple = Array.isArray(value), normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
557
+ pendingEffects.unshift(() => {
558
+ for (let opt of el.options) {
559
+ let selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
560
+ opt.defaultSelected !== selected && (existing && (restoreValue ??= getSelectValue(el, multiple)), opt.defaultSelected = selected);
561
+ }
562
+ restoreValue !== void 0 && setSelectValue(el, restoreValue, multiple);
563
+ }, scope);
783
564
  }
784
565
  function _attr_select_value(scope, nodeAccessor, value, valueChange) {
785
- let el = scope[nodeAccessor], existing = !scope.H, multiple = Array.isArray(value), normalizedValue = scope["G" /* ControlledValue */ + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
786
- scope["E" /* ControlledHandler */ + nodeAccessor] = valueChange, scope["F" /* ControlledType */ + nodeAccessor] = valueChange ? 3 /* SelectValue */ : 5 /* None */, valueChange && existing ? pendingEffects.unshift(
787
- () => setSelectValue(el, normalizedValue, multiple),
788
- scope
789
- ) : _attr_select_value_default(scope, nodeAccessor, normalizedValue);
566
+ let el = scope[nodeAccessor], existing = !scope.H, multiple = Array.isArray(value), normalizedValue = scope["G" + nodeAccessor] = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
567
+ scope["E" + nodeAccessor] = valueChange, scope["F" + nodeAccessor] = valueChange ? 3 : 5, valueChange && existing ? pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope) : _attr_select_value_default(scope, nodeAccessor, normalizedValue);
790
568
  }
791
569
  function _attr_select_value_script(scope, nodeAccessor) {
792
- let el = scope[nodeAccessor], onChange = () => {
793
- let valueChange = scope["E" /* ControlledHandler */ + nodeAccessor];
794
- if (valueChange) {
795
- let oldValue = scope["G" /* ControlledValue */ + nodeAccessor], multiple = Array.isArray(oldValue), newValue = getSelectValue(el, multiple);
796
- setSelectValue(el, oldValue, multiple), valueChange(newValue), run();
797
- }
798
- };
799
- if (isResuming)
800
- if (el.multiple) {
801
- scope["G" /* ControlledValue */ + nodeAccessor] = [];
802
- for (let opt of el.options)
803
- opt.defaultSelected && scope["G" /* ControlledValue */ + nodeAccessor].push(opt.value);
804
- } else {
805
- scope["G" /* ControlledValue */ + nodeAccessor] = "";
806
- for (let opt of el.options)
807
- if (opt.defaultSelected) {
808
- scope["G" /* ControlledValue */ + nodeAccessor] = opt.value;
809
- break;
810
- }
811
- }
812
- syncControllableFormInput(el, hasSelectChanged, onChange), new MutationObserver(() => {
813
- let value = scope["G" /* ControlledValue */ + nodeAccessor];
814
- (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value !== value) && onChange();
815
- }).observe(el, { childList: !0, subtree: !0 });
570
+ let el = scope[nodeAccessor], onChange = () => {
571
+ let valueChange = scope["E" + nodeAccessor];
572
+ if (valueChange) {
573
+ let oldValue = scope["G" + nodeAccessor], multiple = Array.isArray(oldValue), newValue = getSelectValue(el, multiple);
574
+ setSelectValue(el, oldValue, multiple), valueChange(newValue), run();
575
+ }
576
+ };
577
+ if (isResuming) if (el.multiple) {
578
+ scope["G" + nodeAccessor] = [];
579
+ for (let opt of el.options) opt.defaultSelected && scope["G" + nodeAccessor].push(opt.value);
580
+ } else {
581
+ scope["G" + nodeAccessor] = "";
582
+ for (let opt of el.options) if (opt.defaultSelected) {
583
+ scope["G" + nodeAccessor] = opt.value;
584
+ break;
585
+ }
586
+ }
587
+ syncControllableFormInput(el, hasSelectChanged, onChange), new MutationObserver(() => {
588
+ let value = scope["G" + nodeAccessor];
589
+ (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value, i) => value != el.selectedOptions[i].value) : el.value !== value) && onChange();
590
+ }).observe(el, {
591
+ childList: !0,
592
+ subtree: !0
593
+ });
816
594
  }
817
595
  function setSelectValue(el, value, multiple) {
818
- if (multiple)
819
- for (let opt of el.options)
820
- opt.selected = value.includes(opt.value);
821
- else
822
- el.value = value;
596
+ if (multiple) for (let opt of el.options) opt.selected = value.includes(opt.value);
597
+ else el.value = value;
823
598
  }
824
599
  function getSelectValue(el, multiple) {
825
- return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
600
+ return multiple ? Array.from(el.selectedOptions, (opt) => opt.value) : el.value;
826
601
  }
827
602
  function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
828
- scope.H && (scope[nodeAccessor].open = normalizeBoolProp(open));
603
+ scope.H && (scope[nodeAccessor].open = normalizeBoolProp(open));
829
604
  }
830
605
  function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
831
- let normalizedOpen = scope["G" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
832
- scope["E" /* ControlledHandler */ + nodeAccessor] = openChange, scope["F" /* ControlledType */ + nodeAccessor] = openChange ? 4 /* DetailsOrDialogOpen */ : 5 /* None */, openChange && !scope.H ? scope[nodeAccessor].open = normalizedOpen : _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
606
+ let normalizedOpen = scope["G" + nodeAccessor] = normalizeBoolProp(open);
607
+ scope["E" + nodeAccessor] = openChange, scope["F" + nodeAccessor] = openChange ? 4 : 5, openChange && !scope.H ? scope[nodeAccessor].open = normalizedOpen : _attr_details_or_dialog_open_default(scope, nodeAccessor, normalizedOpen);
833
608
  }
834
609
  function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
835
- let el = scope[nodeAccessor];
836
- new MutationObserver(() => {
837
- let openChange = scope["E" /* ControlledHandler */ + nodeAccessor];
838
- if (openChange && el.open === !scope["G" /* ControlledValue */ + nodeAccessor]) {
839
- let newValue = el.open;
840
- el.open = !newValue, openChange(newValue), run();
841
- }
842
- }).observe(el, { attributes: !0, attributeFilter: ["open"] });
610
+ let el = scope[nodeAccessor];
611
+ new MutationObserver(() => {
612
+ let openChange = scope["E" + nodeAccessor];
613
+ if (openChange && el.open === !scope["G" + nodeAccessor]) {
614
+ let newValue = el.open;
615
+ el.open = !newValue, openChange(newValue), run();
616
+ }
617
+ }).observe(el, {
618
+ attributes: !0,
619
+ attributeFilter: ["open"]
620
+ });
843
621
  }
844
622
  function syncControllableFormInput(el, hasChanged, onChange) {
845
- el._ = onChange, controllableDelegate(el, "input", handleChange), el.form && controllableDelegate(el.form, "reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
623
+ el._ = onChange, controllableDelegate(el, "input", handleChange), el.form && controllableDelegate(el.form, "reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
846
624
  }
847
625
  function handleChange(ev) {
848
- ev.target._?.(ev);
626
+ ev.target._?.(ev);
849
627
  }
850
628
  function handleFormReset(ev) {
851
- let handlers = [];
852
- for (let el of ev.target.elements)
853
- el._ && hasFormElementChanged(el) && handlers.push(el._);
854
- requestAnimationFrame(() => {
855
- if (!ev.defaultPrevented)
856
- for (let change of handlers)
857
- change();
858
- });
629
+ let handlers = [];
630
+ for (let el of ev.target.elements) el._ && hasFormElementChanged(el) && handlers.push(el._);
631
+ requestAnimationFrame(() => {
632
+ if (!ev.defaultPrevented) for (let change of handlers) change();
633
+ });
859
634
  }
860
635
  function hasValueChanged(el) {
861
- return el.value !== el.defaultValue;
636
+ return el.value !== el.defaultValue;
862
637
  }
863
638
  function hasCheckboxChanged(el) {
864
- return el.checked !== el.defaultChecked;
639
+ return el.checked !== el.defaultChecked;
865
640
  }
866
641
  function hasSelectChanged(el) {
867
- for (let opt of el.options)
868
- if (opt.selected !== opt.defaultSelected)
869
- return !0;
642
+ for (let opt of el.options) if (opt.selected !== opt.defaultSelected) return !0;
870
643
  }
871
644
  function hasFormElementChanged(el) {
872
- return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
645
+ return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
873
646
  }
874
647
  function normalizeStrProp(value) {
875
- return normalizeAttrValue(value) || "";
648
+ return normalizeAttrValue(value) || "";
876
649
  }
877
650
  function normalizeBoolProp(value) {
878
- return value != null && value !== !1;
651
+ return value != null && value !== !1;
879
652
  }
880
- function updateList(arr, val, push2) {
881
- let index = arr.indexOf(val);
882
- return (push2 ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
653
+ function updateList(arr, val, push) {
654
+ let index = arr.indexOf(val);
655
+ return (push ? !~index && [...arr, val] : ~index && arr.slice(0, index).concat(arr.slice(index + 1))) || arr;
883
656
  }
884
-
885
- // src/dom/dom.ts
657
+ //#endregion
658
+ //#region src/dom/dom.ts
886
659
  function _to_text(value) {
887
- return value || value === 0 ? value + "" : "";
660
+ return value || value === 0 ? value + "" : "";
888
661
  }
889
662
  function _attr(element, name, value) {
890
- setAttribute(element, name, normalizeAttrValue(value));
663
+ setAttribute(element, name, normalizeAttrValue(value));
891
664
  }
892
665
  function setAttribute(element, name, value) {
893
- element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
666
+ element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
894
667
  }
895
668
  function _attr_class(element, value) {
896
- setAttribute(element, "class", classValue(value) || void 0);
669
+ setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
897
670
  }
898
671
  function _attr_class_items(element, items) {
899
- for (let key in items)
900
- _attr_class_item(element, key, items[key]);
672
+ for (let key in items) _attr_class_item(element, key, items[key]);
901
673
  }
902
674
  function _attr_class_item(element, name, value) {
903
- element.classList.toggle(name, !!value);
675
+ element.classList.toggle(name, !!value);
904
676
  }
905
677
  function _attr_style(element, value) {
906
- setAttribute(element, "style", styleValue(value) || void 0);
678
+ setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
907
679
  }
908
680
  function _attr_style_items(element, items) {
909
- for (let key in items)
910
- _attr_style_item(element, key, items[key]);
681
+ for (let key in items) _attr_style_item(element, key, items[key]);
911
682
  }
912
683
  function _attr_style_item(element, name, value) {
913
- element.style.setProperty(name, _to_text(value));
684
+ element.style.setProperty(name, _to_text(value));
914
685
  }
915
686
  function _attr_nonce(scope, nodeAccessor) {
916
- _attr(scope[nodeAccessor], "nonce", scope.$.cspNonce);
687
+ _attr(scope[nodeAccessor], "nonce", scope.$.cspNonce);
917
688
  }
918
689
  function _text(node, value) {
919
- let normalizedValue = _to_text(value);
920
- node.data !== normalizedValue && (node.data = normalizedValue);
690
+ let normalizedValue = _to_text(value);
691
+ node.data !== normalizedValue && (node.data = normalizedValue);
921
692
  }
922
693
  function _text_content(node, value) {
923
- let normalizedValue = _to_text(value);
924
- node.textContent !== normalizedValue && (node.textContent = normalizedValue);
694
+ let normalizedValue = _to_text(value);
695
+ node.textContent !== normalizedValue && (node.textContent = normalizedValue);
925
696
  }
926
697
  function _attrs(scope, nodeAccessor, nextAttrs) {
927
- let el = scope[nodeAccessor];
928
- for (let i = el.attributes.length; i--; ) {
929
- let { name } = el.attributes.item(i);
930
- nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)) || el.removeAttribute(name);
931
- }
932
- attrsInternal(scope, nodeAccessor, nextAttrs);
698
+ let el = scope[nodeAccessor];
699
+ for (let i = el.attributes.length; i--;) {
700
+ let { name } = el.attributes.item(i);
701
+ nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)) || el.removeAttribute(name);
702
+ }
703
+ attrsInternal(scope, nodeAccessor, nextAttrs);
933
704
  }
934
705
  function _attrs_content(scope, nodeAccessor, nextAttrs) {
935
- _attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
706
+ _attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
936
707
  }
937
708
  function hasAttrAlias(element, attr, nextAttrs) {
938
- return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
709
+ return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
939
710
  }
940
711
  function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
941
- let el = scope[nodeAccessor], partial = {};
942
- for (let i = el.attributes.length; i--; ) {
943
- let { name } = el.attributes.item(i);
944
- !skip[name] && !(nextAttrs && name in nextAttrs) && el.removeAttribute(name);
945
- }
946
- for (let name in nextAttrs) {
947
- let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
948
- skip[key] || (partial[key] = nextAttrs[name]);
949
- }
950
- attrsInternal(scope, nodeAccessor, partial);
712
+ let el = scope[nodeAccessor], partial = {};
713
+ for (let i = el.attributes.length; i--;) {
714
+ let { name } = el.attributes.item(i);
715
+ !skip[name] && !(nextAttrs && name in nextAttrs) && el.removeAttribute(name);
716
+ }
717
+ for (let name in nextAttrs) {
718
+ let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
719
+ skip[key] || (partial[key] = nextAttrs[name]);
720
+ }
721
+ attrsInternal(scope, nodeAccessor, partial);
951
722
  }
952
723
  function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
953
- _attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
724
+ _attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
954
725
  }
955
726
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
956
- let el = scope[nodeAccessor], events, skip;
957
- switch (el.tagName) {
958
- case "INPUT":
959
- if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
960
- _attr_input_checked(
961
- scope,
962
- nodeAccessor,
963
- nextAttrs.checked,
964
- nextAttrs.checkedChange
965
- );
966
- else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
967
- _attr_input_checkedValue(
968
- scope,
969
- nodeAccessor,
970
- nextAttrs.checkedValue,
971
- nextAttrs.checkedValueChange,
972
- nextAttrs.value
973
- );
974
- else if ("value" in nextAttrs || "valueChange" in nextAttrs)
975
- _attr_input_value(
976
- scope,
977
- nodeAccessor,
978
- nextAttrs.value,
979
- nextAttrs.valueChange
980
- );
981
- else
982
- break;
983
- skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
984
- break;
985
- case "SELECT":
986
- ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(
987
- scope,
988
- nodeAccessor,
989
- nextAttrs.value,
990
- nextAttrs.valueChange
991
- ), skip = /^value(?:Change)?$/);
992
- break;
993
- case "TEXTAREA":
994
- ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(
995
- scope,
996
- nodeAccessor,
997
- nextAttrs.value,
998
- nextAttrs.valueChange
999
- ), skip = /^value(?:Change)?$/);
1000
- break;
1001
- case "DETAILS":
1002
- case "DIALOG":
1003
- ("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(
1004
- scope,
1005
- nodeAccessor,
1006
- nextAttrs.open,
1007
- nextAttrs.openChange
1008
- ), skip = /^open(?:Change)?$/);
1009
- break;
1010
- }
1011
- for (let name in nextAttrs) {
1012
- let value = nextAttrs[name];
1013
- switch (name) {
1014
- case "class":
1015
- _attr_class(el, value);
1016
- break;
1017
- case "style":
1018
- _attr_style(el, value);
1019
- break;
1020
- default: {
1021
- isEventHandler(name) ? (events ||= scope["I" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
1022
- break;
1023
- }
1024
- }
1025
- }
727
+ let el = scope[nodeAccessor], events, skip;
728
+ switch (el.tagName) {
729
+ case "INPUT":
730
+ if ("checked" in nextAttrs || "checkedChange" in nextAttrs) _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
731
+ else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value);
732
+ else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
733
+ else break;
734
+ skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
735
+ break;
736
+ case "SELECT":
737
+ ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
738
+ break;
739
+ case "TEXTAREA":
740
+ ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
741
+ break;
742
+ case "DETAILS":
743
+ case "DIALOG":
744
+ ("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), skip = /^open(?:Change)?$/);
745
+ break;
746
+ }
747
+ for (let name in nextAttrs) {
748
+ let value = nextAttrs[name];
749
+ switch (name) {
750
+ case "class":
751
+ _attr_class(el, value);
752
+ break;
753
+ case "style":
754
+ _attr_style(el, value);
755
+ break;
756
+ default:
757
+ isEventHandler(name) ? (events ||= scope["I" + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
758
+ break;
759
+ }
760
+ }
1026
761
  }
1027
762
  function _attr_content(scope, nodeAccessor, value) {
1028
- let content = normalizeClientRender(value);
1029
- scope["D" /* ConditionalRenderer */ + nodeAccessor] !== (scope["D" /* ConditionalRenderer */ + nodeAccessor] = content?.g) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.e && subscribeToScopeSet(
1030
- content.f,
1031
- content.e,
1032
- scope["A" /* BranchScopes */ + nodeAccessor]
1033
- ));
1034
- for (let accessor in content?.h)
1035
- content.h[accessor](
1036
- scope["A" /* BranchScopes */ + nodeAccessor],
1037
- content.t[accessor]
1038
- );
763
+ let content = normalizeClientRender(value);
764
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = content?.a) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
765
+ for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
1039
766
  }
1040
767
  function _attrs_script(scope, nodeAccessor) {
1041
- let el = scope[nodeAccessor], events = scope["I" /* EventAttributes */ + nodeAccessor];
1042
- switch (scope["F" /* ControlledType */ + nodeAccessor]) {
1043
- case 0 /* InputChecked */:
1044
- _attr_input_checked_script(scope, nodeAccessor);
1045
- break;
1046
- case 1 /* InputCheckedValue */:
1047
- _attr_input_checkedValue_script(scope, nodeAccessor);
1048
- break;
1049
- case 2 /* InputValue */:
1050
- _attr_input_value_script(scope, nodeAccessor);
1051
- break;
1052
- case 3 /* SelectValue */:
1053
- _attr_select_value_script(scope, nodeAccessor);
1054
- break;
1055
- case 4 /* DetailsOrDialogOpen */:
1056
- _attr_details_or_dialog_open_script(scope, nodeAccessor);
1057
- break;
1058
- }
1059
- for (let name in events)
1060
- _on(el, name, events[name]);
768
+ let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
769
+ switch (scope["F" + nodeAccessor]) {
770
+ case 0:
771
+ _attr_input_checked_script(scope, nodeAccessor);
772
+ break;
773
+ case 1:
774
+ _attr_input_checkedValue_script(scope, nodeAccessor);
775
+ break;
776
+ case 2:
777
+ _attr_input_value_script(scope, nodeAccessor);
778
+ break;
779
+ case 3:
780
+ _attr_select_value_script(scope, nodeAccessor);
781
+ break;
782
+ case 4:
783
+ _attr_details_or_dialog_open_script(scope, nodeAccessor);
784
+ break;
785
+ }
786
+ for (let name in events) _on(el, name, events[name]);
1061
787
  }
1062
788
  function _html(scope, value, accessor) {
1063
- let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" /* DynamicHTMLLastChild */ + accessor] || firstChild, newContent = parseHTML(
1064
- _to_text(value),
1065
- parentNode.namespaceURI
1066
- );
1067
- insertChildNodes(
1068
- parentNode,
1069
- firstChild,
1070
- scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()),
1071
- scope["H" /* DynamicHTMLLastChild */ + accessor] = newContent.lastChild
1072
- ), removeChildNodes(firstChild, lastChild);
789
+ let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
790
+ insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope["H" + accessor] = newContent.lastChild), removeChildNodes(firstChild, lastChild);
1073
791
  }
1074
792
  function normalizeClientRender(value) {
1075
- let renderer = normalizeDynamicRenderer(value);
1076
- if (renderer && renderer.g)
1077
- return renderer;
793
+ let renderer = normalizeDynamicRenderer(value);
794
+ if (renderer && renderer.a) return renderer;
1078
795
  }
1079
796
  function normalizeAttrValue(value) {
1080
- if (value || value === 0)
1081
- return value === !0 ? "" : value + "";
797
+ if (value || value === 0) return value === !0 ? "" : value + "";
1082
798
  }
1083
799
  function _lifecycle(scope, thisObj, index = 0) {
1084
- let accessor = "K" /* Lifecycle */ + index, instance = scope[accessor];
1085
- instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, thisObj.onMount?.(), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
800
+ let accessor = "K" + index, instance = scope[accessor];
801
+ instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, thisObj.onMount?.(), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
1086
802
  }
1087
803
  function removeChildNodes(startNode, endNode) {
1088
- let stop = endNode.nextSibling, current = startNode;
1089
- for (; current !== stop; ) {
1090
- let next = current.nextSibling;
1091
- current.remove(), current = next;
1092
- }
804
+ let stop = endNode.nextSibling, current = startNode;
805
+ for (; current !== stop;) {
806
+ let next = current.nextSibling;
807
+ current.remove(), current = next;
808
+ }
1093
809
  }
1094
810
  function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
1095
- parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
811
+ parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
1096
812
  }
1097
813
  function toInsertNode(startNode, endNode) {
1098
- if (startNode === endNode) return startNode;
1099
- let parent = new DocumentFragment(), stop = endNode.nextSibling, current = startNode;
1100
- for (; current !== stop; ) {
1101
- let next = current.nextSibling;
1102
- parent.appendChild(current), current = next;
1103
- }
1104
- return parent;
1105
- }
1106
-
1107
- // src/dom/control-flow.ts
814
+ if (startNode === endNode) return startNode;
815
+ let parent = new DocumentFragment(), stop = endNode.nextSibling, current = startNode;
816
+ for (; current !== stop;) {
817
+ let next = current.nextSibling;
818
+ parent.appendChild(current), current = next;
819
+ }
820
+ return parent;
821
+ }
822
+ //#endregion
823
+ //#region src/dom/control-flow.ts
1108
824
  function _await_promise(nodeAccessor, params) {
1109
- nodeAccessor = decodeAccessor(nodeAccessor);
1110
- let promiseAccessor = "L" /* Promise */ + nodeAccessor, branchAccessor = "A" /* BranchScopes */ + nodeAccessor;
1111
- return _enable_catch(), (scope, promise) => {
1112
- let awaitBranch = scope[branchAccessor], tryBranch = findBranchWithKey(scope, "Q" /* PlaceholderContent */) || awaitBranch, awaitCounter = tryBranch.O;
1113
- awaitCounter?.i || (awaitCounter = tryBranch.O = {
1114
- i: 0,
1115
- c() {
1116
- if (--awaitCounter.i) return 1;
1117
- if (tryBranch === scope[branchAccessor])
1118
- scope[nodeAccessor].parentNode && scope[nodeAccessor].replaceWith(
1119
- scope[branchAccessor].S.parentNode
1120
- );
1121
- else {
1122
- let placeholderBranch = tryBranch.P;
1123
- placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(
1124
- tryBranch.S.parentNode,
1125
- placeholderBranch.S
1126
- ), removeAndDestroyBranch(placeholderBranch));
1127
- }
1128
- queueEffect(tryBranch, (scope2) => {
1129
- let pendingEffects2 = scope2.J;
1130
- pendingEffects2 && (scope2.J = [], runEffects(pendingEffects2, 1));
1131
- });
1132
- }
1133
- }), placeholderShown.add(pendingEffects), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter.i++ || requestAnimationFrame(
1134
- () => awaitCounter.i && runEffects(
1135
- prepareEffects(
1136
- () => queueRender(
1137
- tryBranch === awaitBranch ? scope : tryBranch,
1138
- () => {
1139
- tryBranch.Q ? (insertBranchBefore(
1140
- tryBranch.P = createAndSetupBranch(
1141
- scope.$,
1142
- tryBranch.Q,
1143
- tryBranch._,
1144
- tryBranch.S.parentNode
1145
- ),
1146
- tryBranch.S.parentNode,
1147
- tryBranch.S
1148
- ), tempDetachBranch(tryBranch)) : awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(
1149
- scope[nodeAccessor],
1150
- awaitBranch.S
1151
- ), tempDetachBranch(tryBranch));
1152
- },
1153
- -1
1154
- )
1155
- )
1156
- )
1157
- ));
1158
- let thisPromise = scope[promiseAccessor] = promise.then(
1159
- (data) => {
1160
- if (thisPromise === scope[promiseAccessor]) {
1161
- let referenceNode = scope[nodeAccessor];
1162
- scope[promiseAccessor] = 0, queueMicrotask(run), queueRender(
1163
- scope,
1164
- () => {
1165
- (awaitBranch = scope[branchAccessor]).V && (pendingScopes.push(awaitBranch), setupBranch(
1166
- awaitBranch.V,
1167
- awaitBranch
1168
- ), awaitBranch.V = 0, insertBranchBefore(
1169
- awaitBranch,
1170
- scope[nodeAccessor].parentNode,
1171
- scope[nodeAccessor]
1172
- ), referenceNode.remove()), params?.(awaitBranch, [data]);
1173
- let pendingRenders2 = awaitBranch.W;
1174
- if (awaitBranch.W = 0, pendingRenders2?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
1175
- let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m();
1176
- for (let i = 0; i < pendingEffects.length; ) {
1177
- let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
1178
- scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
1179
- }
1180
- for (let i = 0; i < effects.length; ) {
1181
- let fn = effects[i++], scope2 = effects[i++];
1182
- fnScopes.get(fn)?.has(scope2) || queueEffect(scope2, fn);
1183
- }
1184
- }
1185
- },
1186
- -1
1187
- );
1188
- }
1189
- },
1190
- (error) => {
1191
- thisPromise === scope[promiseAccessor] && (awaitCounter.i = scope[promiseAccessor] = 0, schedule(), queueRender(scope, renderCatch, -1, error));
1192
- }
1193
- );
1194
- };
825
+ nodeAccessor = decodeAccessor(nodeAccessor);
826
+ let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor;
827
+ return _enable_catch(), (scope, promise) => {
828
+ let awaitBranch = scope[branchAccessor], tryBranch = findBranchWithKey(scope, "Q") || awaitBranch, awaitCounter = tryBranch.O;
829
+ awaitCounter?.i || (awaitCounter = tryBranch.O = {
830
+ i: 0,
831
+ c() {
832
+ if (--awaitCounter.i) return 1;
833
+ if (tryBranch === scope[branchAccessor]) scope[nodeAccessor].parentNode && scope[nodeAccessor].replaceWith(scope[branchAccessor].S.parentNode);
834
+ else {
835
+ let placeholderBranch = tryBranch.P;
836
+ placeholderBranch && (tryBranch.P = 0, placeholderBranch.S.parentNode.insertBefore(tryBranch.S.parentNode, placeholderBranch.S), removeAndDestroyBranch(placeholderBranch));
837
+ }
838
+ queueEffect(tryBranch, (scope) => {
839
+ let pendingEffects = scope.J;
840
+ pendingEffects && (scope.J = [], runEffects(pendingEffects, 1));
841
+ });
842
+ }
843
+ }), placeholderShown.add(pendingEffects), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch === awaitBranch ? scope : tryBranch, () => {
844
+ tryBranch.Q ? (insertBranchBefore(tryBranch.P = createAndSetupBranch(scope.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch)) : awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
845
+ }, -1)))));
846
+ let thisPromise = scope[promiseAccessor] = promise.then((data) => {
847
+ if (thisPromise === scope[promiseAccessor]) {
848
+ let referenceNode = scope[nodeAccessor];
849
+ scope[promiseAccessor] = 0, queueMicrotask(run), queueRender(scope, () => {
850
+ (awaitBranch = scope[branchAccessor]).V && (pendingScopes.push(awaitBranch), setupBranch(awaitBranch.V, awaitBranch), awaitBranch.V = 0, insertBranchBefore(awaitBranch, scope[nodeAccessor].parentNode, scope[nodeAccessor]), referenceNode.remove()), params?.(awaitBranch, [data]);
851
+ let pendingRenders = awaitBranch.W;
852
+ if (awaitBranch.W = 0, pendingRenders?.forEach(queuePendingRender), placeholderShown.add(pendingEffects), awaitCounter.c(), awaitCounter.m) {
853
+ let fnScopes = /* @__PURE__ */ new Map(), effects = awaitCounter.m();
854
+ for (let i = 0; i < pendingEffects.length;) {
855
+ let fn = pendingEffects[i++], scopes = fnScopes.get(fn);
856
+ scopes || fnScopes.set(fn, scopes = /* @__PURE__ */ new Set()), scopes.add(pendingEffects[i++]);
857
+ }
858
+ for (let i = 0; i < effects.length;) {
859
+ let fn = effects[i++], scope = effects[i++];
860
+ fnScopes.get(fn)?.has(scope) || queueEffect(scope, fn);
861
+ }
862
+ }
863
+ }, -1);
864
+ }
865
+ }, (error) => {
866
+ thisPromise === scope[promiseAccessor] && (awaitCounter.i = scope[promiseAccessor] = 0, schedule(), queueRender(scope, renderCatch, -1, error));
867
+ });
868
+ };
1195
869
  }
1196
870
  function _await_content(nodeAccessor, template, walks, setup) {
1197
- nodeAccessor = decodeAccessor(nodeAccessor);
1198
- let branchAccessor = "A" /* BranchScopes */ + nodeAccessor, renderer = _content("", template, walks, setup)();
1199
- return (scope) => {
1200
- (scope[branchAccessor] = createBranch(
1201
- scope.$,
1202
- renderer,
1203
- scope,
1204
- scope[nodeAccessor].parentNode
1205
- )).V = renderer, pendingScopes.pop();
1206
- };
871
+ nodeAccessor = decodeAccessor(nodeAccessor);
872
+ let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
873
+ return (scope) => {
874
+ (scope[branchAccessor] = createBranch(scope.$, renderer, scope, scope[nodeAccessor].parentNode)).V = renderer, pendingScopes.pop();
875
+ };
1207
876
  }
1208
877
  function _try(nodeAccessor, template, walks, setup) {
1209
- nodeAccessor = decodeAccessor(nodeAccessor);
1210
- let branchAccessor = "A" /* BranchScopes */ + nodeAccessor, renderer = _content("", template, walks, setup)();
1211
- return (scope, input) => {
1212
- scope[branchAccessor] || setConditionalRenderer(
1213
- scope,
1214
- nodeAccessor,
1215
- renderer,
1216
- createAndSetupBranch
1217
- );
1218
- let branch = scope[branchAccessor];
1219
- branch && (branch.C = nodeAccessor, branch.E = normalizeDynamicRenderer(input.catch), branch.Q = normalizeDynamicRenderer(
1220
- input.placeholder
1221
- ));
1222
- };
878
+ nodeAccessor = decodeAccessor(nodeAccessor);
879
+ let branchAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
880
+ return (scope, input) => {
881
+ scope[branchAccessor] || setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
882
+ let branch = scope[branchAccessor];
883
+ branch && (branch.C = nodeAccessor, branch.E = input.catch && (normalizeDynamicRenderer(input.catch) || 0), branch.Q = normalizeDynamicRenderer(input.placeholder));
884
+ };
1223
885
  }
1224
886
  function renderCatch(scope, error) {
1225
- let tryWithCatch = findBranchWithKey(scope, "E" /* CatchContent */);
1226
- if (tryWithCatch) {
1227
- let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
1228
- placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" /* BranchScopes */ + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(
1229
- owner,
1230
- tryWithCatch.C,
1231
- tryWithCatch.E,
1232
- createAndSetupBranch
1233
- ), tryWithCatch.E.d?.(
1234
- owner["A" /* BranchScopes */ + tryWithCatch.C],
1235
- [error]
1236
- );
1237
- } else
1238
- throw error;
887
+ let tryWithCatch = findBranchWithKey(scope, "E");
888
+ if (tryWithCatch) {
889
+ let owner = tryWithCatch._, placeholderBranch = tryWithCatch.P;
890
+ placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(owner, tryWithCatch.C, tryWithCatch.E, createAndSetupBranch), tryWithCatch.E?.d?.(owner["A" + tryWithCatch.C], [error]);
891
+ } else throw error;
1239
892
  }
1240
893
  function _if(nodeAccessor, ...branchesArgs) {
1241
- nodeAccessor = decodeAccessor(nodeAccessor);
1242
- let branchAccessor = "D" /* ConditionalRenderer */ + nodeAccessor, branches = [], i = 0;
1243
- for (; i < branchesArgs.length; )
1244
- branches.push(
1245
- _content(
1246
- "",
1247
- branchesArgs[i++],
1248
- branchesArgs[i++],
1249
- branchesArgs[i++]
1250
- )()
1251
- );
1252
- return enableBranches(), (scope, newBranch) => {
1253
- newBranch !== scope[branchAccessor] && setConditionalRenderer(
1254
- scope,
1255
- nodeAccessor,
1256
- branches[scope[branchAccessor] = newBranch],
1257
- createAndSetupBranch
1258
- );
1259
- };
894
+ nodeAccessor = decodeAccessor(nodeAccessor);
895
+ let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
896
+ for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
897
+ return enableBranches(), (scope, newBranch) => {
898
+ newBranch !== scope[branchAccessor] && setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
899
+ };
1260
900
  }
1261
901
  function patchDynamicTag(fn) {
1262
- _dynamic_tag = fn(_dynamic_tag);
1263
- }
1264
- var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1265
- nodeAccessor = decodeAccessor(nodeAccessor);
1266
- let childScopeAccessor = "A" /* BranchScopes */ + nodeAccessor, rendererAccessor = "D" /* ConditionalRenderer */ + nodeAccessor;
1267
- return enableBranches(), (scope, newRenderer, getInput) => {
1268
- let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1269
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.g || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1270
- if (setConditionalRenderer(
1271
- scope,
1272
- nodeAccessor,
1273
- normalizedRenderer || (getContent ? getContent(scope) : void 0),
1274
- createBranchWithTagNameOrRenderer
1275
- ), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
1276
- if (getContent) {
1277
- let content = getContent(scope);
1278
- setConditionalRenderer(
1279
- scope[childScopeAccessor],
1280
- "a",
1281
- content,
1282
- createAndSetupBranch
1283
- ), content.e && subscribeToScopeSet(
1284
- content.f,
1285
- content.e,
1286
- scope[childScopeAccessor]["Aa"]
1287
- );
1288
- }
1289
- } else normalizedRenderer?.e && subscribeToScopeSet(
1290
- normalizedRenderer.f,
1291
- normalizedRenderer.e,
1292
- scope[childScopeAccessor]
1293
- );
1294
- if (normalizedRenderer) {
1295
- let childScope = scope[childScopeAccessor], args = getInput?.();
1296
- if (typeof normalizedRenderer == "string")
1297
- (getContent ? _attrs : _attrs_content)(
1298
- childScope,
1299
- "a",
1300
- (inputIsArgs ? args[0] : args) || {}
1301
- ), (childScope["Ia"] || childScope["Ea"]) && queueEffect(childScope, dynamicTagScript);
1302
- else {
1303
- for (let accessor in normalizedRenderer.h)
1304
- normalizedRenderer.h[accessor](
1305
- childScope,
1306
- normalizedRenderer.t[accessor]
1307
- );
1308
- if (normalizedRenderer.d)
1309
- if (inputIsArgs)
1310
- normalizedRenderer.d(
1311
- childScope,
1312
- normalizedRenderer._ ? args[0] : args
1313
- );
1314
- else {
1315
- let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1316
- normalizedRenderer.d(
1317
- childScope,
1318
- normalizedRenderer._ ? inputWithContent : [inputWithContent]
1319
- );
1320
- }
1321
- }
1322
- }
1323
- };
1324
- };
902
+ _dynamic_tag = fn(_dynamic_tag);
903
+ }
1325
904
  function _resume_dynamic_tag() {
1326
- _resume("d", dynamicTagScript);
905
+ _resume("d", dynamicTagScript);
1327
906
  }
1328
907
  function dynamicTagScript(branch) {
1329
- _attrs_script(
1330
- branch,
1331
- "a"
1332
- );
1333
- }
1334
- function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1335
- let referenceNode = scope[nodeAccessor], prevBranch = scope["A" /* BranchScopes */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.S || referenceNode).parentNode : referenceNode, newBranch = scope["A" /* BranchScopes */ + nodeAccessor] = newRenderer && createBranch2(scope.$, newRenderer, scope, parentNode);
1336
- referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(
1337
- newBranch,
1338
- parentNode,
1339
- prevBranch.S
1340
- ) : parentNode.insertBefore(
1341
- referenceNode,
1342
- prevBranch.S
1343
- ), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
1344
- }
1345
- var _for_of = loop(([all, by = bySecondArg], cb) => {
1346
- typeof by == "string" ? forOf(
1347
- all,
1348
- (item, i) => cb(item[by], [item, i])
1349
- ) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
1350
- }), _for_in = loop(
1351
- ([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
1352
- ), _for_to = loop(
1353
- ([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))
1354
- ), _for_until = loop(
1355
- ([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))
1356
- );
908
+ _attrs_script(branch, "a");
909
+ }
910
+ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
911
+ let referenceNode = scope[nodeAccessor], prevBranch = scope["A" + nodeAccessor], parentNode = referenceNode.nodeType > 1 ? (prevBranch?.S || referenceNode).parentNode : referenceNode, newBranch = scope["A" + nodeAccessor] = newRenderer && createBranch(scope.$, newRenderer, scope, parentNode);
912
+ referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.S) : parentNode.insertBefore(referenceNode, prevBranch.S), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
913
+ }
914
+ /* @__NO_SIDE_EFFECTS__ */
1357
915
  function loop(forEach) {
1358
- return (nodeAccessor, template, walks, setup, params) => {
1359
- nodeAccessor = decodeAccessor(nodeAccessor);
1360
- let scopesAccessor = "A" /* BranchScopes */ + nodeAccessor, renderer = _content("", template, walks, setup)();
1361
- return enableBranches(), (scope, value) => {
1362
- let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes = scope[scopesAccessor] = [], oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves;
1363
- if (0)
1364
- var seenKeys;
1365
- forEach(value, (key, args) => {
1366
- let branch = oldLen && (oldScopesByKey ||= oldScopes.reduce(
1367
- (map, scope2, i) => map.set(scope2.M ?? i, scope2),
1368
- /* @__PURE__ */ new Map()
1369
- )).get(key);
1370
- branch ? hasPotentialMoves = oldScopesByKey.delete(key) : branch = createAndSetupBranch(
1371
- scope.$,
1372
- renderer,
1373
- scope,
1374
- parentNode
1375
- ), branch.M = key, newScopes.push(branch), params?.(branch, args);
1376
- });
1377
- let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1, start = 0;
1378
- if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
1379
- oldLen && (oldScopes.forEach(
1380
- hasSiblings ? removeAndDestroyBranch : destroyBranch
1381
- ), hasSiblings || (parentNode.textContent = ""));
1382
- for (let newScope of newScopes)
1383
- insertBranchBefore(newScope, parentNode, afterReference);
1384
- return;
1385
- }
1386
- for (let branch of oldScopesByKey.values())
1387
- removeAndDestroyBranch(branch);
1388
- for (; start < oldLen && start < newLen && oldScopes[start] === newScopes[start]; )
1389
- start++;
1390
- for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd]; )
1391
- oldEnd--, newEnd--;
1392
- if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd) {
1393
- if (start <= newEnd)
1394
- for (let i = start; i <= newEnd; i++)
1395
- insertBranchBefore(newScopes[i], parentNode, afterReference);
1396
- return;
1397
- } else if (start > newEnd)
1398
- return;
1399
- let diffLen = newEnd - start + 1, oldPos = /* @__PURE__ */ new Map(), sources = new Array(diffLen), pred = new Array(diffLen), tails = [], tail = -1, lo, hi, mid;
1400
- for (let i = start; i <= oldEnd; i++)
1401
- oldPos.set(oldScopes[i], i);
1402
- for (let i = diffLen; i--; )
1403
- sources[i] = oldPos.get(newScopes[start + i]) ?? -1;
1404
- for (let i = 0; i < diffLen; i++)
1405
- if (~sources[i])
1406
- if (tail < 0 || sources[tails[tail]] < sources[i])
1407
- ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
1408
- else {
1409
- for (lo = 0, hi = tail; lo < hi; )
1410
- mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
1411
- sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
1412
- }
1413
- for (hi = tails[tail], lo = tail + 1; lo-- > 0; )
1414
- tails[lo] = hi, hi = pred[hi];
1415
- for (let i = diffLen; i--; )
1416
- ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
1417
- };
1418
- };
916
+ return (nodeAccessor, template, walks, setup, params) => {
917
+ nodeAccessor = decodeAccessor(nodeAccessor);
918
+ let scopesAccessor = "A" + nodeAccessor, renderer = _content("", template, walks, setup)();
919
+ return enableBranches(), (scope, value) => {
920
+ let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes = scope[scopesAccessor] = [], oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves;
921
+ forEach(value, (key, args) => {
922
+ let branch = oldLen && (oldScopesByKey ||= oldScopes.reduce((map, scope, i) => map.set(scope.M ?? i, scope), /* @__PURE__ */ new Map())).get(key);
923
+ branch ? hasPotentialMoves = oldScopesByKey.delete(key) : branch = createAndSetupBranch(scope.$, renderer, scope, parentNode), branch.M = key, newScopes.push(branch), params?.(branch, args);
924
+ });
925
+ let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1, start = 0;
926
+ if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
927
+ oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
928
+ for (let newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
929
+ return;
930
+ }
931
+ for (let branch of oldScopesByKey.values()) removeAndDestroyBranch(branch);
932
+ for (; start < oldLen && start < newLen && oldScopes[start] === newScopes[start];) start++;
933
+ for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
934
+ if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd) {
935
+ if (start <= newEnd) for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
936
+ return;
937
+ } else if (start > newEnd) return;
938
+ let diffLen = newEnd - start + 1, oldPos = /* @__PURE__ */ new Map(), sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
939
+ for (let i = start; i <= oldEnd; i++) oldPos.set(oldScopes[i], i);
940
+ for (let i = diffLen; i--;) sources[i] = oldPos.get(newScopes[start + i]) ?? -1;
941
+ for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
942
+ else {
943
+ for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
944
+ sources[i] < sources[tails[lo]] && (lo > 0 && (pred[i] = tails[lo - 1]), tails[lo] = i);
945
+ }
946
+ for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
947
+ for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
948
+ };
949
+ };
1419
950
  }
1420
951
  function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1421
- let branch = createBranch(
1422
- $global,
1423
- tagNameOrRenderer,
1424
- parentScope,
1425
- parentNode
1426
- );
1427
- return typeof tagNameOrRenderer == "string" ? branch.a = branch.S = branch.K = document.createElementNS(
1428
- tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1429
- tagNameOrRenderer
1430
- ) : setupBranch(tagNameOrRenderer, branch), branch;
952
+ let branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
953
+ return typeof tagNameOrRenderer == "string" ? branch.a = branch.S = branch.K = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer) : setupBranch(tagNameOrRenderer, branch), branch;
1431
954
  }
1432
955
  function bySecondArg(_item, index) {
1433
- return index;
956
+ return index;
1434
957
  }
1435
958
  function byFirstArg(name) {
1436
- return name;
959
+ return name;
1437
960
  }
1438
-
1439
- // src/dom/queue.ts
1440
- var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), asyncRendersLookup, caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
961
+ //#endregion
962
+ //#region src/dom/queue.ts
1441
963
  function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
1442
- let key = scopeKey * scopeKeyOffset + signalKey, render = signalKey >= 0 && pendingRendersLookup.get(key);
1443
- render ? render.u = value : (queuePendingRender(
1444
- render = {
1445
- a: key,
1446
- j: scope,
1447
- y: signal,
1448
- u: value
1449
- }
1450
- ), signalKey >= 0 && pendingRendersLookup.set(key, render));
964
+ let key = scopeKey * 1e3 + signalKey, render = signalKey >= 0 && pendingRendersLookup.get(key);
965
+ render ? render.d = value : (queuePendingRender(render = {
966
+ a: key,
967
+ b: scope,
968
+ c: signal,
969
+ d: value
970
+ }), signalKey >= 0 && pendingRendersLookup.set(key, render));
1451
971
  }
1452
972
  function queuePendingRender(render) {
1453
- let i = pendingRenders.push(render) - 1;
1454
- for (; i; ) {
1455
- let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
1456
- if (render.a - parent.a >= 0) break;
1457
- pendingRenders[i] = parent, i = parentIndex;
1458
- }
1459
- pendingRenders[i] = render;
973
+ let i = pendingRenders.push(render) - 1;
974
+ for (; i;) {
975
+ let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
976
+ if (render.a - parent.a >= 0) break;
977
+ pendingRenders[i] = parent, i = parentIndex;
978
+ }
979
+ pendingRenders[i] = render;
1460
980
  }
1461
981
  function queueEffect(scope, fn) {
1462
- pendingEffects.push(fn, scope);
982
+ pendingEffects.push(fn, scope);
1463
983
  }
1464
984
  function run() {
1465
- let effects = pendingEffects;
1466
- asyncRendersLookup = /* @__PURE__ */ new Map();
1467
- try {
1468
- rendering = 1, runRenders();
1469
- } finally {
1470
- pendingRendersLookup = asyncRendersLookup, asyncRendersLookup = rendering = 0, pendingRenders = [], pendingEffects = [];
1471
- }
1472
- runEffects(effects);
985
+ let effects = pendingEffects;
986
+ asyncRendersLookup = /* @__PURE__ */ new Map();
987
+ try {
988
+ rendering = 1, runRenders();
989
+ } finally {
990
+ pendingRendersLookup = asyncRendersLookup, asyncRendersLookup = rendering = 0, pendingRenders = [], pendingEffects = [];
991
+ }
992
+ runEffects(effects);
1473
993
  }
1474
994
  function prepareEffects(fn) {
1475
- let prevRenders = pendingRenders, prevEffects = pendingEffects, prevLookup = asyncRendersLookup, preparedEffects = pendingEffects = [];
1476
- pendingRenders = [], asyncRendersLookup = pendingRendersLookup, pendingRendersLookup = /* @__PURE__ */ new Map();
1477
- try {
1478
- rendering = 1, fn(), runRenders();
1479
- } finally {
1480
- rendering = 0, pendingRendersLookup = asyncRendersLookup, asyncRendersLookup = prevLookup, pendingRenders = prevRenders, pendingEffects = prevEffects;
1481
- }
1482
- return preparedEffects;
1483
- }
1484
- var runEffects = ((effects) => {
1485
- for (let i = 0; i < effects.length; )
1486
- effects[i++](effects[i++]);
1487
- });
995
+ let prevRenders = pendingRenders, prevEffects = pendingEffects, prevLookup = asyncRendersLookup, preparedEffects = pendingEffects = [];
996
+ pendingRenders = [], asyncRendersLookup = pendingRendersLookup, pendingRendersLookup = /* @__PURE__ */ new Map();
997
+ try {
998
+ rendering = 1, fn(), runRenders();
999
+ } finally {
1000
+ rendering = 0, pendingRendersLookup = asyncRendersLookup, asyncRendersLookup = prevLookup, pendingRenders = prevRenders, pendingEffects = prevEffects;
1001
+ }
1002
+ return preparedEffects;
1003
+ }
1488
1004
  function runRenders() {
1489
- for (; pendingRenders.length; ) {
1490
- let render = pendingRenders[0], item = pendingRenders.pop();
1491
- if (render !== item) {
1492
- let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).a;
1493
- for (; i < mid; ) {
1494
- let bestChild = (i << 1) + 1, right = bestChild + 1;
1495
- if (right < pendingRenders.length && pendingRenders[right].a - pendingRenders[bestChild].a < 0 && (bestChild = right), pendingRenders[bestChild].a - key >= 0)
1496
- break;
1497
- pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
1498
- }
1499
- pendingRenders[i] = item;
1500
- }
1501
- render.j.F?.I || runRender(render);
1502
- }
1503
- for (let scope of pendingScopes)
1504
- scope.H = 0;
1505
- pendingScopes = [];
1506
- }
1507
- var runRender = (render) => render.y(render.j, render.u), _enable_catch = () => {
1508
- _enable_catch = () => {
1509
- }, enableBranches();
1510
- let handlePendingTry = (fn, scope, branch) => {
1511
- for (; branch; ) {
1512
- if (branch.O?.i)
1513
- return (branch.J ||= []).push(fn, scope);
1514
- branch = branch.N;
1515
- }
1516
- };
1517
- runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
1518
- if (checkPending || caughtError.has(effects)) {
1519
- let i = 0, fn, scope, branch;
1520
- for (; i < effects.length; )
1521
- fn = effects[i++], scope = effects[i++], branch = scope.F, !branch?.I && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
1522
- } else
1523
- runEffects2(effects);
1524
- })(runEffects), runRender = /* @__PURE__ */ ((runRender2) => (render) => {
1525
- try {
1526
- let branch = render.j.F;
1527
- for (; branch; ) {
1528
- if (branch.W)
1529
- return asyncRendersLookup.set(
1530
- render.a,
1531
- render
1532
- ), branch.W.push(render);
1533
- branch = branch.N;
1534
- }
1535
- runRender2(render);
1536
- } catch (error) {
1537
- renderCatch(render.j, error);
1538
- }
1539
- })(runRender);
1540
- };
1541
-
1542
- // src/dom/abort-signal.ts
1005
+ for (; pendingRenders.length;) {
1006
+ let render = pendingRenders[0], item = pendingRenders.pop();
1007
+ if (render !== item) {
1008
+ let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).a;
1009
+ for (; i < mid;) {
1010
+ let bestChild = (i << 1) + 1, right = bestChild + 1;
1011
+ if (right < pendingRenders.length && pendingRenders[right].a - pendingRenders[bestChild].a < 0 && (bestChild = right), pendingRenders[bestChild].a - key >= 0) break;
1012
+ pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
1013
+ }
1014
+ pendingRenders[i] = item;
1015
+ }
1016
+ render.b.F?.I || runRender(render);
1017
+ }
1018
+ for (let scope of pendingScopes) scope.H = 0;
1019
+ pendingScopes = [];
1020
+ }
1021
+ function _enable_catch() {
1022
+ if (!catchEnabled) {
1023
+ catchEnabled = 1, enableBranches();
1024
+ let handlePendingTry = (fn, scope, branch) => {
1025
+ for (; branch;) {
1026
+ if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
1027
+ branch = branch.N;
1028
+ }
1029
+ };
1030
+ runEffects = ((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
1031
+ if (checkPending || caughtError.has(effects)) {
1032
+ let i = 0, fn, scope, branch;
1033
+ for (; i < effects.length;) fn = effects[i++], scope = effects[i++], branch = scope.F, !branch?.I && !(checkPending && handlePendingTry(fn, scope, branch)) && fn(scope);
1034
+ } else runEffects(effects);
1035
+ })(runEffects), runRender = ((runRender) => (render) => {
1036
+ try {
1037
+ let branch = render.b.F;
1038
+ for (; branch;) {
1039
+ if (branch.W) return asyncRendersLookup.set(render.a, render), branch.W.push(render);
1040
+ branch = branch.N;
1041
+ }
1042
+ runRender(render);
1043
+ } catch (error) {
1044
+ renderCatch(render.b, error);
1045
+ }
1046
+ })(runRender);
1047
+ }
1048
+ }
1049
+ //#endregion
1050
+ //#region src/dom/abort-signal.ts
1543
1051
  function $signalReset(scope, id) {
1544
- let ctrl = scope.A?.[id];
1545
- ctrl && (queueEffect(ctrl, abort), scope.A[id] = void 0);
1052
+ let ctrl = scope.A?.[id];
1053
+ ctrl && (queueEffect(ctrl, abort), scope.A[id] = void 0);
1546
1054
  }
1547
1055
  function $signal(scope, id) {
1548
- return scope.F && (scope.F.B ||= /* @__PURE__ */ new Set()).add(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
1056
+ return scope.F && (scope.F.B ||= /* @__PURE__ */ new Set()).add(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
1549
1057
  }
1550
1058
  function abort(ctrl) {
1551
- ctrl.abort();
1552
- }
1553
-
1554
- // src/common/compat-meta.ts
1555
- var RENDERER_REGISTER_ID = "$C_r", SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b";
1556
-
1557
- // src/dom/compat.ts
1558
- var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1559
- patchDynamicTag,
1560
- queueEffect,
1561
- init(warp10Noop) {
1562
- _resume(SET_SCOPE_REGISTER_ID, (branch) => {
1563
- classIdToBranch.set(branch.m5c, branch);
1564
- }), _resume(RENDER_BODY_ID, warp10Noop);
1565
- },
1566
- registerRenderer(fn) {
1567
- _resume(RENDERER_REGISTER_ID, fn);
1568
- },
1569
- isRenderer(renderer) {
1570
- return renderer.k;
1571
- },
1572
- getStartNode(branch) {
1573
- return branch.S;
1574
- },
1575
- setScopeNodes(branch, startNode, endNode) {
1576
- branch.S = startNode, branch.K = endNode;
1577
- },
1578
- runComponentEffects() {
1579
- this.effects && runEffects(this.effects);
1580
- },
1581
- runComponentDestroy() {
1582
- this.scope && destroyBranch(this.scope);
1583
- },
1584
- resolveRegistered(value, $global) {
1585
- return Array.isArray(value) && typeof value[0] == "string" ? getRegisteredWithScope(
1586
- value[0],
1587
- value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
1588
- ) : value;
1589
- },
1590
- createRenderer(params, clone) {
1591
- let renderer = _content("", 0, 0, 0, params)();
1592
- return renderer.k = (branch) => {
1593
- let cloned = clone();
1594
- branch.S = cloned.startNode, branch.K = cloned.endNode;
1595
- }, renderer;
1596
- },
1597
- render(out, component, renderer, args) {
1598
- let branch = component.scope, created = 0;
1599
- if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), typeof args[0] == "object" && "renderBody" in args[0]) {
1600
- let input = args[0], normalizedInput = args[0] = {};
1601
- for (let key in input)
1602
- normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1603
- }
1604
- if (component.effects = prepareEffects(() => {
1605
- branch || (created = 1, branch = component.scope = createAndSetupBranch(
1606
- out.global,
1607
- renderer,
1608
- renderer.f,
1609
- document.body
1610
- )), renderer.d?.(branch, renderer._ ? args[0] : args);
1611
- }), created)
1612
- return toInsertNode(
1613
- branch.S,
1614
- branch.K
1615
- );
1616
- }
1617
- };
1618
-
1619
- // src/dom/template.ts
1620
- var _template = (id, template, walks, setup, inputSignal) => {
1621
- let renderer = _content(
1622
- id,
1623
- template,
1624
- walks,
1625
- setup,
1626
- inputSignal
1627
- )();
1628
- return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
1629
- };
1059
+ ctrl.abort();
1060
+ }
1061
+ //#endregion
1062
+ //#region src/common/compat-meta.ts
1063
+ //#endregion
1064
+ //#region src/dom/compat.ts
1065
+ //#endregion
1066
+ //#region src/dom/template.ts
1630
1067
  function mount(input = {}, reference, position) {
1631
- let branch, parentNode = reference, nextSibling = null, { $global } = input;
1632
- switch ($global ? ({ $global, ...input } = input, $global = {
1633
- runtimeId: "M",
1634
- renderId: "_",
1635
- ...$global
1636
- }) : $global = {
1637
- runtimeId: "M",
1638
- renderId: "_"
1639
- }, position) {
1640
- case "beforebegin":
1641
- parentNode = reference.parentNode, nextSibling = reference;
1642
- break;
1643
- case "afterbegin":
1644
- nextSibling = reference.firstChild;
1645
- break;
1646
- case "afterend":
1647
- parentNode = reference.parentNode, nextSibling = reference.nextSibling;
1648
- break;
1649
- }
1650
- let curValue, args = this.d, effects = prepareEffects(() => {
1651
- branch = createBranch(
1652
- $global,
1653
- this,
1654
- void 0,
1655
- parentNode
1656
- ), branch.T = (newValue) => {
1657
- curValue = newValue;
1658
- }, this.l?.(branch), args?.(branch, input);
1659
- });
1660
- return insertChildNodes(
1661
- parentNode,
1662
- nextSibling,
1663
- branch.S,
1664
- branch.K
1665
- ), runEffects(effects), {
1666
- get value() {
1667
- return curValue;
1668
- },
1669
- set value(newValue) {
1670
- _var_change(branch, newValue);
1671
- },
1672
- update(newInput) {
1673
- args && runEffects(
1674
- prepareEffects(() => {
1675
- args(branch, newInput);
1676
- })
1677
- );
1678
- },
1679
- destroy() {
1680
- removeAndDestroyBranch(branch);
1681
- }
1682
- };
1683
- }
1068
+ let branch, parentNode = reference, nextSibling = null, { $global } = input;
1069
+ switch ($global ? ({$global, ...input} = input, $global = {
1070
+ runtimeId: "M",
1071
+ renderId: "_",
1072
+ ...$global
1073
+ }) : $global = {
1074
+ runtimeId: "M",
1075
+ renderId: "_"
1076
+ }, position) {
1077
+ case "beforebegin":
1078
+ parentNode = reference.parentNode, nextSibling = reference;
1079
+ break;
1080
+ case "afterbegin":
1081
+ nextSibling = reference.firstChild;
1082
+ break;
1083
+ case "afterend":
1084
+ parentNode = reference.parentNode, nextSibling = reference.nextSibling;
1085
+ break;
1086
+ }
1087
+ let curValue, args = this.d, effects = prepareEffects(() => {
1088
+ branch = createBranch($global, this, void 0, parentNode), branch.T = (newValue) => {
1089
+ curValue = newValue;
1090
+ }, this.c?.(branch), args?.(branch, input);
1091
+ });
1092
+ return insertChildNodes(parentNode, nextSibling, branch.S, branch.K), runEffects(effects), {
1093
+ get value() {
1094
+ return curValue;
1095
+ },
1096
+ set value(newValue) {
1097
+ _var_change(branch, newValue);
1098
+ },
1099
+ update(newInput) {
1100
+ args && runEffects(prepareEffects(() => {
1101
+ args(branch, newInput);
1102
+ }));
1103
+ },
1104
+ destroy() {
1105
+ removeAndDestroyBranch(branch);
1106
+ }
1107
+ };
1108
+ }
1109
+ exports.$signal = $signal, exports.$signalReset = $signalReset, exports._assert_hoist = _assert_hoist, exports._assert_init = _assert_init, exports._attr = _attr, exports._attr_class = _attr_class, exports._attr_class_item = _attr_class_item, exports._attr_class_items = _attr_class_items, exports._attr_content = _attr_content, exports._attr_details_open = _attr_details_or_dialog_open, exports._attr_dialog_open = _attr_details_or_dialog_open, exports._attr_details_open_default = _attr_details_or_dialog_open_default, exports._attr_dialog_open_default = _attr_details_or_dialog_open_default, exports._attr_details_open_script = _attr_details_or_dialog_open_script, exports._attr_dialog_open_script = _attr_details_or_dialog_open_script, exports._attr_input_checked = _attr_input_checked, exports._attr_input_checkedValue = _attr_input_checkedValue, exports._attr_input_checkedValue_default = _attr_input_checkedValue_default, exports._attr_input_checkedValue_script = _attr_input_checkedValue_script, exports._attr_input_checked_default = _attr_input_checked_default, exports._attr_input_checked_script = _attr_input_checked_script, exports._attr_input_value = _attr_input_value, exports._attr_textarea_value = _attr_input_value, exports._attr_input_value_default = _attr_input_value_default, exports._attr_textarea_value_default = _attr_input_value_default, exports._attr_input_value_script = _attr_input_value_script, exports._attr_textarea_value_script = _attr_input_value_script, exports._attr_nonce = _attr_nonce, exports._attr_select_value = _attr_select_value, exports._attr_select_value_default = _attr_select_value_default, exports._attr_select_value_script = _attr_select_value_script, exports._attr_style = _attr_style, exports._attr_style_item = _attr_style_item, exports._attr_style_items = _attr_style_items, exports._attrs = _attrs, exports._attrs_content = _attrs_content, exports._attrs_partial = _attrs_partial, exports._attrs_partial_content = _attrs_partial_content, exports._attrs_script = _attrs_script, exports._await_content = _await_content, exports._await_promise = _await_promise, exports._call = _call, exports._child_setup = _child_setup, exports._closure = _closure, exports._closure_get = _closure_get, exports._const = _const, exports._content = _content, exports._content_closures = _content_closures, exports._content_resume = _content_resume, Object.defineProperty(exports, "_dynamic_tag", {
1110
+ enumerable: !0,
1111
+ get: function() {
1112
+ return _dynamic_tag;
1113
+ }
1114
+ }), exports._el = _el, exports._el_read = _el_read, exports._enable_catch = _enable_catch, exports._for_closure = _for_closure, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_resume = _hoist_resume, exports._html = _html, exports._id = _id, exports._if = _if, exports._if_closure = _if_closure, exports._let = _let, exports._lifecycle = _lifecycle, exports._on = _on, exports._or = _or, exports._resume = _resume, exports._resume_dynamic_tag = _resume_dynamic_tag, exports._return = _return, exports._return_change = _return_change, exports._script = _script, exports._template = _template, exports._text = _text, exports._text_content = _text_content, exports._to_text = _to_text, exports._try = _try, exports._var = _var, exports._var_change = _var_change, exports._var_resume = _var_resume, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forOf = forOf, exports.forTo = forTo, exports.forUntil = forUntil, exports.init = init, exports.initEmbedded = initEmbedded, exports.run = run;