what-core 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -38
- package/a11y.d.ts +128 -0
- package/data.d.ts +294 -0
- package/dist/a11y.js +510 -0
- package/dist/a11y.min.js +413 -0
- package/dist/actions.js +158 -0
- package/dist/actions.min.js +112 -0
- package/dist/animation.js +481 -0
- package/dist/animation.min.js +295 -0
- package/dist/async.js +180 -0
- package/dist/async.min.js +134 -0
- package/dist/components.js +577 -0
- package/dist/components.min.js +413 -0
- package/dist/data.js +1212 -0
- package/dist/data.min.js +918 -0
- package/dist/diagnostics.js +187 -0
- package/dist/diagnostics.min.js +134 -0
- package/dist/dom.js +796 -0
- package/dist/dom.min.js +603 -0
- package/dist/entries/a11y.js +43 -0
- package/dist/entries/a11y.min.js +43 -0
- package/dist/entries/data.js +29 -0
- package/dist/entries/data.min.js +29 -0
- package/dist/entries/dom.js +45 -0
- package/dist/entries/dom.min.js +45 -0
- package/dist/entries/form.js +31 -0
- package/dist/entries/form.min.js +31 -0
- package/dist/entries/internal.js +123 -0
- package/dist/entries/internal.min.js +123 -0
- package/dist/entries/motion.js +23 -0
- package/dist/entries/motion.min.js +23 -0
- package/dist/entries/ui.js +25 -0
- package/dist/entries/ui.min.js +25 -0
- package/dist/env.js +5 -0
- package/dist/env.min.js +5 -0
- package/dist/errors.js +1518 -0
- package/dist/errors.min.js +548 -0
- package/dist/form.js +936 -0
- package/dist/form.min.js +703 -0
- package/dist/guardrails.js +84 -0
- package/dist/guardrails.min.js +55 -0
- package/dist/h.js +232 -0
- package/dist/h.min.js +171 -0
- package/dist/head.js +241 -0
- package/dist/head.min.js +207 -0
- package/dist/helpers.js +126 -0
- package/dist/helpers.min.js +98 -0
- package/dist/hooks.js +255 -0
- package/dist/hooks.min.js +153 -0
- package/dist/hot.js +215 -0
- package/dist/hot.min.js +24 -0
- package/dist/hydration-data.js +495 -0
- package/dist/hydration-data.min.js +371 -0
- package/dist/import-changes.js +273 -0
- package/dist/import-changes.min.js +272 -0
- package/dist/index.js +95 -0
- package/dist/index.min.js +95 -227
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.min.js +10 -1
- package/dist/jsx-runtime.js +27 -0
- package/dist/jsx-runtime.min.js +15 -1
- package/dist/live.js +54 -0
- package/dist/live.min.js +49 -0
- package/dist/markup-rules.js +250 -0
- package/dist/markup-rules.min.js +213 -0
- package/dist/reactive.js +3334 -0
- package/dist/reactive.min.js +2033 -0
- package/dist/render.js +4746 -0
- package/dist/render.min.js +2797 -1
- package/dist/scheduler.js +225 -0
- package/dist/scheduler.min.js +162 -0
- package/dist/selector.js +11 -0
- package/dist/selector.min.js +10 -0
- package/dist/server-context.js +148 -0
- package/dist/server-context.min.js +121 -0
- package/dist/skeleton.js +342 -0
- package/dist/skeleton.min.js +310 -0
- package/dist/store.js +72 -0
- package/dist/store.min.js +50 -0
- package/dist/testing.js +720 -0
- package/dist/testing.min.js +458 -1
- package/dist/vnode-adoption.js +19 -0
- package/dist/vnode-adoption.min.js +19 -0
- package/dist/vnode-renderer.js +61 -0
- package/dist/vnode-renderer.min.js +47 -0
- package/dom.d.ts +44 -0
- package/form.d.ts +218 -0
- package/hot.d.ts +35 -0
- package/index.d.ts +421 -736
- package/internal.d.ts +284 -0
- package/jsx-runtime.d.ts +160 -137
- package/markup-rules.d.ts +83 -0
- package/motion.d.ts +156 -0
- package/package.json +117 -3
- package/render.d.ts +278 -29
- package/src/a11y.js +64 -59
- package/src/actions.js +226 -0
- package/src/animation.js +105 -57
- package/src/async.js +259 -0
- package/src/components.js +495 -144
- package/src/data.js +1410 -1159
- package/src/diagnostics.js +263 -0
- package/src/dom.js +1159 -872
- package/src/entries/a11y.js +24 -0
- package/src/entries/data.js +17 -0
- package/src/entries/dom.js +29 -0
- package/src/entries/form.js +16 -0
- package/src/entries/internal.js +63 -0
- package/src/entries/motion.js +13 -0
- package/src/entries/ui.js +13 -0
- package/src/env-development.js +12 -0
- package/src/env.js +33 -0
- package/src/errors.js +1144 -168
- package/src/form.js +723 -225
- package/src/guardrails.js +38 -126
- package/src/h.js +227 -152
- package/src/head.js +189 -19
- package/src/helpers.js +47 -75
- package/src/hooks.js +233 -248
- package/src/hot.js +316 -0
- package/src/hydration-data.js +859 -16
- package/src/import-changes.js +156 -0
- package/src/index.js +38 -188
- package/src/jsx-dev-runtime.js +7 -14
- package/src/jsx-runtime.js +25 -9
- package/src/live.js +80 -0
- package/src/markup-rules.js +387 -0
- package/src/reactive.js +4400 -862
- package/src/render.js +6502 -2570
- package/src/scheduler.js +56 -21
- package/src/selector.js +31 -0
- package/src/server-context.js +252 -22
- package/src/skeleton.js +22 -12
- package/src/store.js +17 -31
- package/src/testing.js +389 -63
- package/src/vnode-adoption.js +48 -0
- package/src/vnode-renderer.js +114 -0
- package/testing.d.ts +81 -1
- package/ui.d.ts +20 -0
- package/dist/chunk-6YOUZ6T4.min.js +0 -1
- package/dist/chunk-FN6HXME3.min.js +0 -11
- package/dist/chunk-VKZY7JPN.min.js +0 -1
- package/src/agent-context.js +0 -127
- package/src/warnings.js +0 -193
package/dist/render.js
ADDED
|
@@ -0,0 +1,4746 @@
|
|
|
1
|
+
// src/render.js
|
|
2
|
+
import { _symbolChild, signal, effect, untrack, batch, createRoot, _provide, _contextOf, _itemScope, _runScope, _rowItem, _readRowItem, _propField, _setRowItem, _livesWithRow, _readAlone, _effectWhenNeeded, _tracking, _ownerRecord, _componentOwner, _holdUser, _releaseUser, _runOwned, _disposeOwner, _handleError, _handlePending, _isNotReady, _adoptOwner, _currentComponent, _isDisposed, HANDLED, _devAnchor, _devError, _devMounted, _devNewContent, _devHot, __ownerPath, memo, onCleanup, getOwner, runWithOwner, __devtools } from "./reactive.js";
|
|
3
|
+
import { isServerRender } from "./server-context.js";
|
|
4
|
+
import { __resetIdCounter } from "./a11y.js";
|
|
5
|
+
import { _trackRoot, _liveRegionNodes, _setFieldProp, _showControlled, _selectionKeeper, _changedFields, _restoreFields, _writableProp, _isUnsafeAttr, _isEventProp, _installLazyChildren, _place, _placeFlat, _takeFlat, _copyProps, _copyProp, _setOwnProp, _isLiveProp, _isOwnProps, _markProps, _ownProps, PROPS, _setOutsideRead, _mountTarget, _handleNavigationSignal, _controlFields, _selectsFor, _installVNodeLazyProps } from "./dom.js";
|
|
6
|
+
import { isEnumeratedAttr, markupName, FIELD_PROPS, FIELD_TAGS, ATTRIBUTE_VALUE_TYPES } from "./markup-rules.js";
|
|
7
|
+
import { _onChange } from "./dom.js";
|
|
8
|
+
import { report, setNextBinding, recordObservation, _thrownMessage } from "./diagnostics.js";
|
|
9
|
+
import { VNode, isVNode, vnodeRenderer, vnodeRows, vnodeProp, vnodeRefuses, SVG_TAG } from "./vnode-renderer.js";
|
|
10
|
+
import { adoptVNodeKinds, adoptVNodeRows, fieldCarry } from "./vnode-adoption.js";
|
|
11
|
+
import { installVNodeRuntime } from "./vnode-adoption.js";
|
|
12
|
+
import { _installForeignRows } from "./vnode-renderer.js";
|
|
13
|
+
import { installFieldCarry } from "./vnode-adoption.js";
|
|
14
|
+
import { _assignHydrationOwnerPath, _hydrationRoot, _ownerCounter, _installSeeding, _swapArrived, _caughtError } from "./hydration-data.js";
|
|
15
|
+
import { computed } from "./reactive.js";
|
|
16
|
+
import { _$Island } from "./components.js";
|
|
17
|
+
import { createSelector } from "./selector.js";
|
|
18
|
+
import { _installSelects } from "./dom.js";
|
|
19
|
+
function _$buildDiagnostics(records) {
|
|
20
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
21
|
+
for (const { code, data, loc } of records) report(code, { data, loc, owner: [], subject: { kind: "component", name: data.component, id: loc } });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var _onTextInsert = null;
|
|
25
|
+
function _setTextInsertHook(fn) {
|
|
26
|
+
_onTextInsert = typeof fn === "function" ? fn : null;
|
|
27
|
+
}
|
|
28
|
+
function textWritten(parent, text, options = inOptions(parent)) {
|
|
29
|
+
if (_onTextInsert !== null) _onTextInsert(parent, text);
|
|
30
|
+
if (options) optionsChanged(parent, 1);
|
|
31
|
+
}
|
|
32
|
+
function inOptions(parent) {
|
|
33
|
+
const tag = parent.localName;
|
|
34
|
+
return tag === "option" || tag === "optgroup" || tag === "select";
|
|
35
|
+
}
|
|
36
|
+
function vnodeRuntimeMissing(what) {
|
|
37
|
+
return Object.assign(new Error((process.env.NODE_ENV !== "production") ? _thrownMessage("ERR_NO_VNODE_RENDERER", `${what} reached the compiled-JSX runtime, but no vnode renderer is installed. Compiled JSX builds DOM directly; the renderer for vnodes is installed by importing h, Fragment or html from what-framework, by the automatic JSX runtime, or by a component that returns vnodes (ErrorBoundary, Suspense, Portal, lazy, Island).`) : "[what] no vnode renderer installed"), { code: "ERR_NO_VNODE_RENDERER" });
|
|
38
|
+
}
|
|
39
|
+
function lazyChildren(factory) {
|
|
40
|
+
const lazy = () => {
|
|
41
|
+
const kids = factory();
|
|
42
|
+
return kids.length === 1 ? kids[0] : kids;
|
|
43
|
+
};
|
|
44
|
+
lazy._lazyChildren = true;
|
|
45
|
+
return lazy;
|
|
46
|
+
}
|
|
47
|
+
function lazyProps(Component, merged, props, children) {
|
|
48
|
+
const slots = props != null ? props._$slots : void 0;
|
|
49
|
+
if (typeof children === "function") return _installLazyChildren(Component, merged, lazyChildren(children), slots);
|
|
50
|
+
if (children != null && children.length > 0) _setOwnProp(merged, "children", children.length === 1 ? children[0] : children);
|
|
51
|
+
return slots !== void 0 ? _installLazyChildren(Component, merged, null, slots) : null;
|
|
52
|
+
}
|
|
53
|
+
function _$componentVNode(Component, props, children, devLoc) {
|
|
54
|
+
const vnode = componentVNode(Component, props, children);
|
|
55
|
+
if ((process.env.NODE_ENV !== "production") && devLoc) vnode._loc = devLoc;
|
|
56
|
+
return vnode;
|
|
57
|
+
}
|
|
58
|
+
function _$hcomponentVNode(Component, props, children, devLoc) {
|
|
59
|
+
return _$componentVNode(typeof Component === "string" ? claimedTag(Component) : Component, props, children, devLoc);
|
|
60
|
+
}
|
|
61
|
+
function componentVNode(Component, props, children) {
|
|
62
|
+
const slots = props != null ? props._$slots : void 0;
|
|
63
|
+
const lazy = typeof children === "function";
|
|
64
|
+
if (lazy || slots !== void 0) {
|
|
65
|
+
_installVNodeLazyProps();
|
|
66
|
+
props = _copyProps(props);
|
|
67
|
+
if (lazy) Object.defineProperty(props, "_$lazyChildren", { value: lazyChildren(children), configurable: true });
|
|
68
|
+
else if (children && children.length > 0) _setOwnProp(props, "children", children.length === 1 ? children[0] : children);
|
|
69
|
+
if (slots !== void 0) Object.defineProperty(props, "_$slots", { value: slots, configurable: true });
|
|
70
|
+
return new VNode(Component, props, lazy ? [] : children || [], null);
|
|
71
|
+
}
|
|
72
|
+
if (children && children.length > 0) {
|
|
73
|
+
const mergedChildren = children.length === 1 ? children[0] : children;
|
|
74
|
+
props = _copyProps(props);
|
|
75
|
+
_setOwnProp(props, "children", mergedChildren);
|
|
76
|
+
}
|
|
77
|
+
return new VNode(Component, props || {}, children || [], null);
|
|
78
|
+
}
|
|
79
|
+
function _$keyed(key, build) {
|
|
80
|
+
const k = memo(key);
|
|
81
|
+
return () => {
|
|
82
|
+
k();
|
|
83
|
+
if ((process.env.NODE_ENV !== "production")) _devNewContent();
|
|
84
|
+
return untrack(build);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function _signalKeyed(vnode) {
|
|
88
|
+
return () => {
|
|
89
|
+
const keyed = new VNode(vnode.tag, vnode.props, vnode.children, vnode.key());
|
|
90
|
+
if ((process.env.NODE_ENV !== "production") && vnode._loc !== void 0) keyed._loc = vnode._loc;
|
|
91
|
+
return keyed;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function _$slots(props, slots) {
|
|
95
|
+
Object.defineProperty(props, "_$slots", { value: slots });
|
|
96
|
+
return props;
|
|
97
|
+
}
|
|
98
|
+
function _$createComponent(Component, props, children, devLoc) {
|
|
99
|
+
return _$createLazyFn(asComponent(Component), props, children, devLoc);
|
|
100
|
+
}
|
|
101
|
+
function _$createLazyFn(Component, props, children, devLoc) {
|
|
102
|
+
const merged = ownProps(props);
|
|
103
|
+
return _renderComponent(Component, merged, lazyProps(Component, merged, props, children), false, devLoc);
|
|
104
|
+
}
|
|
105
|
+
function _$createLeaf(Component, props, _children, devLoc) {
|
|
106
|
+
return _$createFn(asComponent(Component), props, _children, devLoc);
|
|
107
|
+
}
|
|
108
|
+
function _$createFn(Component, props, _children, devLoc) {
|
|
109
|
+
return _renderComponent(Component, ownProps(props), null, false, devLoc);
|
|
110
|
+
}
|
|
111
|
+
function asComponent(Component) {
|
|
112
|
+
return typeof Component === "string" ? tagComponent(Component) : _toFunctionComponent(Component);
|
|
113
|
+
}
|
|
114
|
+
function tagComponent(tag) {
|
|
115
|
+
return (props) => {
|
|
116
|
+
const el = tagElement(tag);
|
|
117
|
+
_selectsFor(el);
|
|
118
|
+
spread(FIELD_TAGS.has(el.localName) ? _$controlled(el) : el, props);
|
|
119
|
+
const children = props.children;
|
|
120
|
+
if (children != null) insert(el, children);
|
|
121
|
+
return el;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
var NAMESPACES = ["http://www.w3.org/1999/xhtml", "http://www.w3.org/2000/svg", "http://www.w3.org/1998/Math/MathML"];
|
|
125
|
+
var MATH_TAG = /^(?:math|m(?:action|enclose|error|fenced|frac|i|multiscripts|n|o|over|padded|phantom|prescripts|root|row|s|space|sqrt|style|sub|subsup|sup|table|td|text|tr|under|underover)|annotation(?:-xml)?|semantics)$/i;
|
|
126
|
+
var PLACED_NS = {};
|
|
127
|
+
var placedNs = false;
|
|
128
|
+
function tagElement(tag) {
|
|
129
|
+
const placed = placedNs && /^(?:a|script|style|title)$/i.test(tag) ? _contextOf(PLACED_NS) : null;
|
|
130
|
+
const ns = placed !== null ? placed.get(PLACED_NS) : SVG_TAG.test(tag) ? NAMESPACES[1] : MATH_TAG.test(tag) ? NAMESPACES[2] : null;
|
|
131
|
+
return ns == null ? document.createElement(tag) : document.createElementNS(ns, tag);
|
|
132
|
+
}
|
|
133
|
+
function _$inNs(ns, build) {
|
|
134
|
+
placedNs = true;
|
|
135
|
+
return createRoot(() => {
|
|
136
|
+
_provide(PLACED_NS, NAMESPACES[ns]);
|
|
137
|
+
return build();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function _placedNamespace() {
|
|
141
|
+
const placed = placedNs ? _contextOf(PLACED_NS) : null;
|
|
142
|
+
return placed !== null ? placed.get(PLACED_NS) ?? null : null;
|
|
143
|
+
}
|
|
144
|
+
function ownProps(props) {
|
|
145
|
+
if (props == null) return {};
|
|
146
|
+
if (!_isOwnProps(props)) return { ...props };
|
|
147
|
+
return Object.isExtensible(props) ? _ownProps(props) : props;
|
|
148
|
+
}
|
|
149
|
+
function _$merge() {
|
|
150
|
+
const out = {};
|
|
151
|
+
let live = false;
|
|
152
|
+
for (let i = 0; i < arguments.length; i++) {
|
|
153
|
+
const src = Object(arguments[i]);
|
|
154
|
+
const own = _isOwnProps(src);
|
|
155
|
+
for (const key of Reflect.ownKeys(src)) if (Object.prototype.propertyIsEnumerable.call(src, key) && _copyProp(out, src, key, own)) live = true;
|
|
156
|
+
}
|
|
157
|
+
return live ? _markProps(out) : out;
|
|
158
|
+
}
|
|
159
|
+
var _toFunctionComponent = classComponent;
|
|
160
|
+
function _setForeignComponent(wrap) {
|
|
161
|
+
_toFunctionComponent = wrap(classComponent);
|
|
162
|
+
}
|
|
163
|
+
function classComponent(ClassComp) {
|
|
164
|
+
const proto = ClassComp.prototype;
|
|
165
|
+
if (proto == null || !(proto.isReactComponent || proto.render)) return ClassComp;
|
|
166
|
+
const Bridge = function ClassComponentBridge(props) {
|
|
167
|
+
const instance = new ClassComp(props);
|
|
168
|
+
return instance.render();
|
|
169
|
+
};
|
|
170
|
+
Bridge.displayName = ClassComp.displayName || ClassComp.name || "ClassComponent";
|
|
171
|
+
return Bridge;
|
|
172
|
+
}
|
|
173
|
+
function _renderComponent(Component, props, endChildrenPass, isSvg, devLoc) {
|
|
174
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) {
|
|
175
|
+
const record = hotOf(Component);
|
|
176
|
+
if (record !== void 0) return hotInstance(record, props, endChildrenPass, isSvg, devLoc);
|
|
177
|
+
}
|
|
178
|
+
if ((process.env.NODE_ENV !== "production") && props[PROPS] !== 2) Object.freeze(props);
|
|
179
|
+
const owner = _componentOwner(Component, props);
|
|
180
|
+
if ((process.env.NODE_ENV !== "production")) devComponent(owner, devLoc);
|
|
181
|
+
let out;
|
|
182
|
+
let first;
|
|
183
|
+
const held = _holdUser();
|
|
184
|
+
try {
|
|
185
|
+
const result = _runOwned(owner, Component, props);
|
|
186
|
+
if ((process.env.NODE_ENV !== "production") && result != null && typeof result.then === "function") devAsyncComponent(Component);
|
|
187
|
+
if (endChildrenPass !== null) endChildrenPass(owner);
|
|
188
|
+
if (result != null && result.nodeType === 1 && result._owner === void 0) out = first = result;
|
|
189
|
+
else first = (out = _runOwned(owner, bracketOutput, result, isSvg)).firstChild;
|
|
190
|
+
} catch (error) {
|
|
191
|
+
_disposeOwner(owner);
|
|
192
|
+
const container = bracketOutput(null, isSvg);
|
|
193
|
+
const left = failComponent(
|
|
194
|
+
error,
|
|
195
|
+
owner.owner,
|
|
196
|
+
/** @type {Comment} */
|
|
197
|
+
container.firstChild,
|
|
198
|
+
/** @type {Comment} */
|
|
199
|
+
container.lastChild,
|
|
200
|
+
Component,
|
|
201
|
+
props,
|
|
202
|
+
isSvg,
|
|
203
|
+
devLoc
|
|
204
|
+
);
|
|
205
|
+
if (left !== HANDLED) {
|
|
206
|
+
console.error("[what] Uncaught error in component:", Component.name || "Anonymous", left);
|
|
207
|
+
throw left;
|
|
208
|
+
}
|
|
209
|
+
return container;
|
|
210
|
+
} finally {
|
|
211
|
+
_releaseUser(held);
|
|
212
|
+
}
|
|
213
|
+
if ((process.env.NODE_ENV !== "production")) devOutput(owner, first);
|
|
214
|
+
if (owner.owner === null) {
|
|
215
|
+
first._owner = owner;
|
|
216
|
+
detached++;
|
|
217
|
+
}
|
|
218
|
+
return out;
|
|
219
|
+
}
|
|
220
|
+
var detached = 0;
|
|
221
|
+
var failures = 0;
|
|
222
|
+
function _adoptDetached(nodes) {
|
|
223
|
+
for (let i = 0; i < nodes.length && detached > 0; i++) adoptIn(nodes[i]);
|
|
224
|
+
}
|
|
225
|
+
function adoptIn(node) {
|
|
226
|
+
const owner = node._owner;
|
|
227
|
+
if (owner !== void 0) {
|
|
228
|
+
node._owner = void 0;
|
|
229
|
+
detached--;
|
|
230
|
+
_adoptOwner(owner);
|
|
231
|
+
}
|
|
232
|
+
for (let c = node.firstChild; c !== null && detached > 0; c = c.nextSibling) adoptIn(c);
|
|
233
|
+
}
|
|
234
|
+
function bracketOutput(result, isSvg) {
|
|
235
|
+
const container = document.createDocumentFragment();
|
|
236
|
+
container.appendChild(document.createComment("c:start"));
|
|
237
|
+
let nodes = valuesToNodes(result, container, [], isSvg);
|
|
238
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) nodes = hotHeld(nodes);
|
|
239
|
+
for (let i = 0; i < nodes.length; i++) container.appendChild(nodes[i]);
|
|
240
|
+
container.appendChild(document.createComment("c:end"));
|
|
241
|
+
return container;
|
|
242
|
+
}
|
|
243
|
+
var failComponent = componentFailed;
|
|
244
|
+
function _enableSuspense() {
|
|
245
|
+
failComponent = renderWhenSettled;
|
|
246
|
+
}
|
|
247
|
+
var settledPromises = null;
|
|
248
|
+
function renderWhenSettled(thenable, parentOwner, start, end, Component, props, isSvg, devLoc) {
|
|
249
|
+
if (thenable == null || typeof thenable.then !== "function") return componentFailed(thenable, parentOwner);
|
|
250
|
+
const settled = (settledPromises || (settledPromises = /* @__PURE__ */ new WeakMap())).get(thenable);
|
|
251
|
+
if (settled !== void 0) {
|
|
252
|
+
const error = settled.failed ? settled.reason : new Error((process.env.NODE_ENV !== "production") ? "[what] A component suspended on a promise that had already settled, so rendering it again would suspend again forever. Read a settled promise with use(promise), which returns its value." : "[what] suspended on a settled promise");
|
|
253
|
+
if (error != null && typeof error.then === "function" && _handlePending(parentOwner, error)) return HANDLED;
|
|
254
|
+
return componentFailed(error, parentOwner);
|
|
255
|
+
}
|
|
256
|
+
const job = { retry: retryIn(parentOwner, start, end, Component, props, isSvg, devLoc) };
|
|
257
|
+
let release = null;
|
|
258
|
+
const retried = new Promise((resolve) => {
|
|
259
|
+
release = resolve;
|
|
260
|
+
});
|
|
261
|
+
const record = (
|
|
262
|
+
/** @type {WeakMap<object, any>} */
|
|
263
|
+
settledPromises
|
|
264
|
+
);
|
|
265
|
+
const run = (outcome) => {
|
|
266
|
+
record.set(thenable, outcome);
|
|
267
|
+
const retry = job.retry;
|
|
268
|
+
job.retry = null;
|
|
269
|
+
if (retry !== null) retry();
|
|
270
|
+
release();
|
|
271
|
+
};
|
|
272
|
+
Promise.resolve(thenable).then((value) => run({ failed: false, reason: value }), (reason) => run({ failed: true, reason }));
|
|
273
|
+
if (parentOwner !== null) {
|
|
274
|
+
runWithOwner(parentOwner, () => onCleanup(() => {
|
|
275
|
+
job.retry = null;
|
|
276
|
+
release();
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
failures++;
|
|
280
|
+
retried.showsFallback = !_isNotReady(thenable);
|
|
281
|
+
if ((process.env.NODE_ENV !== "production")) retried.component = Component.displayName || Component.name || "Anonymous";
|
|
282
|
+
if (!_handlePending(parentOwner, retried) && (process.env.NODE_ENV !== "production")) {
|
|
283
|
+
report("ERR_ASYNC_WITHOUT_SUSPENSE", { data: { component: retried.component } });
|
|
284
|
+
}
|
|
285
|
+
return HANDLED;
|
|
286
|
+
}
|
|
287
|
+
function retryIn(parentOwner, start, end, Component, props, isSvg, devLoc) {
|
|
288
|
+
return () => {
|
|
289
|
+
if (parentOwner !== null && _isDisposed(parentOwner) || end.parentNode === null) return;
|
|
290
|
+
const host = end.parentNode;
|
|
291
|
+
while (start.nextSibling !== end) host.removeChild(
|
|
292
|
+
/** @type {ChildNode} */
|
|
293
|
+
start.nextSibling
|
|
294
|
+
);
|
|
295
|
+
try {
|
|
296
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) hotSelf = Component;
|
|
297
|
+
host.insertBefore(runWithOwner(parentOwner, () => _renderComponent(Component, props, null, isSvg, devLoc)), end);
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function componentFailed(error, owner) {
|
|
303
|
+
if (_handleNavigationSignal(error)) return HANDLED;
|
|
304
|
+
if ((process.env.NODE_ENV !== "production") && __devtools) _devError(error, { type: "component", owner });
|
|
305
|
+
return _handleError(owner, error);
|
|
306
|
+
}
|
|
307
|
+
function devComponent(owner, devLoc) {
|
|
308
|
+
if (devLoc) owner.devLoc = devLoc;
|
|
309
|
+
owner._parentCtx = parentComponent(owner);
|
|
310
|
+
_devMounted(owner);
|
|
311
|
+
}
|
|
312
|
+
function devOutput(owner, first) {
|
|
313
|
+
owner._wrapper = first;
|
|
314
|
+
_devAnchor(first, owner, first.nodeType === 1);
|
|
315
|
+
}
|
|
316
|
+
function devAsyncComponent(Component) {
|
|
317
|
+
report("ERR_ASYNC_COMPONENT", { data: { component: Component.displayName || Component.name || "Anonymous" } });
|
|
318
|
+
}
|
|
319
|
+
function parentComponent(owner) {
|
|
320
|
+
for (let o = owner.owner; o != null; o = o.owner) {
|
|
321
|
+
if (o.Component !== void 0) return o;
|
|
322
|
+
}
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
var hotRecordOf = null;
|
|
326
|
+
var hotSelf = null;
|
|
327
|
+
var hotSlots = 0;
|
|
328
|
+
var hotBoundaries;
|
|
329
|
+
function _installHot(recordOf) {
|
|
330
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
331
|
+
hotRecordOf = recordOf;
|
|
332
|
+
hotBoundaries = /* @__PURE__ */ new Set();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function hotOf(Component) {
|
|
336
|
+
if (hotSelf === Component) {
|
|
337
|
+
hotSelf = null;
|
|
338
|
+
return void 0;
|
|
339
|
+
}
|
|
340
|
+
return (
|
|
341
|
+
/** @type {Function} */
|
|
342
|
+
hotRecordOf(Component)
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
function hotSlot(record, props, endChildrenPass, isSvg, devLoc) {
|
|
346
|
+
const slot = {
|
|
347
|
+
record,
|
|
348
|
+
props,
|
|
349
|
+
endChildrenPass,
|
|
350
|
+
isSvg,
|
|
351
|
+
devLoc,
|
|
352
|
+
// Its element, while its output is one element held by nothing that
|
|
353
|
+
// keeps nodes; else its markers, and the nodes its version put between
|
|
354
|
+
// them.
|
|
355
|
+
top: (
|
|
356
|
+
/** @type {any} */
|
|
357
|
+
null
|
|
358
|
+
),
|
|
359
|
+
start: (
|
|
360
|
+
/** @type {any} */
|
|
361
|
+
null
|
|
362
|
+
),
|
|
363
|
+
end: (
|
|
364
|
+
/** @type {any} */
|
|
365
|
+
null
|
|
366
|
+
),
|
|
367
|
+
tops: (
|
|
368
|
+
/** @type {any[]} */
|
|
369
|
+
[]
|
|
370
|
+
),
|
|
371
|
+
frag: (
|
|
372
|
+
/** @type {any} */
|
|
373
|
+
null
|
|
374
|
+
),
|
|
375
|
+
wrapper: (
|
|
376
|
+
/** @type {any} */
|
|
377
|
+
null
|
|
378
|
+
),
|
|
379
|
+
root: (
|
|
380
|
+
/** @type {any} */
|
|
381
|
+
null
|
|
382
|
+
),
|
|
383
|
+
next: (
|
|
384
|
+
/** @type {any} */
|
|
385
|
+
null
|
|
386
|
+
),
|
|
387
|
+
// The state signature of the version that built `root`.
|
|
388
|
+
state: record.state,
|
|
389
|
+
building: false,
|
|
390
|
+
error: (
|
|
391
|
+
/** @type {any} */
|
|
392
|
+
null
|
|
393
|
+
),
|
|
394
|
+
made: ++hotSlots
|
|
395
|
+
};
|
|
396
|
+
createRoot(() => {
|
|
397
|
+
const wrapper = slot.wrapper = getOwner();
|
|
398
|
+
wrapper._onError = (error) => {
|
|
399
|
+
if (slot.building) {
|
|
400
|
+
if (slot.error === null) slot.error = { error };
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
for (let o = wrapper.owner; o != null; o = o.owner) {
|
|
404
|
+
if (!_isDisposed(o) && typeof o._onError === "function" && o._onError._reset !== void 0) {
|
|
405
|
+
hotBoundaries.add(o._onError);
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
throw error;
|
|
410
|
+
};
|
|
411
|
+
onCleanup(() => record.slots.delete(slot));
|
|
412
|
+
});
|
|
413
|
+
record.slots.add(slot);
|
|
414
|
+
return slot;
|
|
415
|
+
}
|
|
416
|
+
function hotBuild(slot, kept, build, a, b, c, d, e) {
|
|
417
|
+
return runWithOwner(slot.wrapper, () => createRoot(() => {
|
|
418
|
+
const version = slot.next = getOwner();
|
|
419
|
+
version._hot = { slot, kept, run: null };
|
|
420
|
+
hotSelf = a;
|
|
421
|
+
return build(a, b, c, d, e);
|
|
422
|
+
}));
|
|
423
|
+
}
|
|
424
|
+
function _hotState(site, init, reducer) {
|
|
425
|
+
return (process.env.NODE_ENV !== "production") ? hotState(site, init, reducer) : init();
|
|
426
|
+
}
|
|
427
|
+
function hotState(site, init, reducer) {
|
|
428
|
+
const owner = getOwner();
|
|
429
|
+
const version = owner !== null && owner.Component !== void 0 && owner.owner !== null ? owner.owner._hot : void 0;
|
|
430
|
+
if (version === void 0) return init();
|
|
431
|
+
let run = version.run;
|
|
432
|
+
if (run === null || run.owner !== owner) run = version.run = { owner, sites: [], values: [], kept: version.kept };
|
|
433
|
+
const at = run.sites.length;
|
|
434
|
+
const kept = run.kept;
|
|
435
|
+
let value;
|
|
436
|
+
if (kept !== null && at < kept.sites.length && kept.sites[at] === site) {
|
|
437
|
+
value = kept.values[at];
|
|
438
|
+
if (reducer === 1) {
|
|
439
|
+
const was = value[0];
|
|
440
|
+
value = init();
|
|
441
|
+
value[0].set(() => was.peek());
|
|
442
|
+
} else {
|
|
443
|
+
_devHot.adopt(Array.isArray(value) ? value[0] : value);
|
|
444
|
+
}
|
|
445
|
+
} else {
|
|
446
|
+
run.kept = null;
|
|
447
|
+
value = init();
|
|
448
|
+
}
|
|
449
|
+
run.sites.push(site);
|
|
450
|
+
run.values.push(value);
|
|
451
|
+
return value;
|
|
452
|
+
}
|
|
453
|
+
function hotInstance(record, props, endChildrenPass, isSvg, devLoc) {
|
|
454
|
+
const slot = hotSlot(record, props, endChildrenPass, isSvg, devLoc);
|
|
455
|
+
let out;
|
|
456
|
+
try {
|
|
457
|
+
out = hotBuild(slot, null, _renderComponent, record.impl, props, endChildrenPass, isSvg, devLoc);
|
|
458
|
+
} catch (error) {
|
|
459
|
+
_disposeOwner(slot.wrapper);
|
|
460
|
+
throw error;
|
|
461
|
+
}
|
|
462
|
+
slot.root = slot.next;
|
|
463
|
+
let value = out;
|
|
464
|
+
if (out.nodeType === 1) {
|
|
465
|
+
slot.top = out;
|
|
466
|
+
out._hotSlot = slot;
|
|
467
|
+
} else {
|
|
468
|
+
hotMarkers(slot);
|
|
469
|
+
slot.tops = topsOf(out);
|
|
470
|
+
value = slot.frag = document.createDocumentFragment();
|
|
471
|
+
value._hotSlot = slot;
|
|
472
|
+
value.appendChild(slot.start);
|
|
473
|
+
value.appendChild(out);
|
|
474
|
+
value.appendChild(slot.end);
|
|
475
|
+
}
|
|
476
|
+
if (slot.wrapper.owner === null) {
|
|
477
|
+
(slot.start ?? out)._owner = slot.wrapper;
|
|
478
|
+
detached++;
|
|
479
|
+
}
|
|
480
|
+
return value;
|
|
481
|
+
}
|
|
482
|
+
function hotMarkers(slot) {
|
|
483
|
+
const end = document.createComment("/hot");
|
|
484
|
+
const start = document.createComment("hot");
|
|
485
|
+
start._rangeEnd = end;
|
|
486
|
+
slot.start = start;
|
|
487
|
+
slot.end = end;
|
|
488
|
+
slot.top = null;
|
|
489
|
+
if (slot.frag === null) slot.frag = document.createDocumentFragment();
|
|
490
|
+
}
|
|
491
|
+
function topsOf(out) {
|
|
492
|
+
return out.nodeType === 11 ? [...out.childNodes] : [out];
|
|
493
|
+
}
|
|
494
|
+
function hotPlacement(slot, out) {
|
|
495
|
+
if (slot.start === null) {
|
|
496
|
+
out.push(slot.top);
|
|
497
|
+
return out;
|
|
498
|
+
}
|
|
499
|
+
const { start, end } = slot;
|
|
500
|
+
if (start.parentNode !== null && start.parentNode === end.parentNode) {
|
|
501
|
+
for (let n = start; n !== null; n = n.nextSibling) {
|
|
502
|
+
out.push(n);
|
|
503
|
+
if (n === end) break;
|
|
504
|
+
}
|
|
505
|
+
return out;
|
|
506
|
+
}
|
|
507
|
+
out.push(start, ...slot.tops, end);
|
|
508
|
+
return out;
|
|
509
|
+
}
|
|
510
|
+
function hotHeld(nodes) {
|
|
511
|
+
let out = null;
|
|
512
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
513
|
+
const node = nodes[i];
|
|
514
|
+
const slot = node.nodeType === 1 ? node._hotSlot : void 0;
|
|
515
|
+
if (slot === void 0 || _isDisposed(slot.wrapper)) {
|
|
516
|
+
if (out !== null) out.push(node);
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
if (out === null) out = nodes.slice(0, i);
|
|
520
|
+
if (slot.start === null) {
|
|
521
|
+
const top = slot.top;
|
|
522
|
+
hotMarkers(slot);
|
|
523
|
+
slot.tops = [top];
|
|
524
|
+
}
|
|
525
|
+
hotPlacement(slot, out);
|
|
526
|
+
}
|
|
527
|
+
return out === null ? nodes : out;
|
|
528
|
+
}
|
|
529
|
+
function hotPlaced(node) {
|
|
530
|
+
const slot = node._hotSlot;
|
|
531
|
+
return _isDisposed(slot.wrapper) ? [node] : hotPlacement(slot, []);
|
|
532
|
+
}
|
|
533
|
+
function hotReplaced(slot, old, nodes) {
|
|
534
|
+
let outermost = slot;
|
|
535
|
+
for (let inner = slot; ; ) {
|
|
536
|
+
const outer2 = enclosing(inner);
|
|
537
|
+
if (outer2 === null) break;
|
|
538
|
+
if (outer2.start !== null) {
|
|
539
|
+
const at = outer2.tops.indexOf(old);
|
|
540
|
+
if (at !== -1) outer2.tops.splice(at, 1, ...nodes);
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
if (outer2.top !== old) break;
|
|
544
|
+
if (nodes.length === 1 && nodes[0].nodeType === 1) {
|
|
545
|
+
outer2.top = nodes[0];
|
|
546
|
+
} else {
|
|
547
|
+
hotMarkers(outer2);
|
|
548
|
+
outer2.tops = nodes;
|
|
549
|
+
const first = nodes[0];
|
|
550
|
+
const last = nodes[nodes.length - 1];
|
|
551
|
+
if (first.parentNode !== null) first.parentNode.insertBefore(outer2.start, first);
|
|
552
|
+
if (last.parentNode !== null) last.parentNode.insertBefore(outer2.end, last.nextSibling);
|
|
553
|
+
nodes = [outer2.start, ...nodes, outer2.end];
|
|
554
|
+
}
|
|
555
|
+
outermost = outer2;
|
|
556
|
+
inner = outer2;
|
|
557
|
+
}
|
|
558
|
+
if (nodes.length === 1 && nodes[0].nodeType === 1) nodes[0]._hotSlot = outermost;
|
|
559
|
+
}
|
|
560
|
+
function enclosing(slot) {
|
|
561
|
+
for (let o = slot.wrapper.owner; o != null; o = o.owner) {
|
|
562
|
+
const hot = o._hot;
|
|
563
|
+
if (hot !== void 0) return hot.slot.root === o ? hot.slot : null;
|
|
564
|
+
}
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
var hotRebuilding = null;
|
|
568
|
+
function _hotKeep(holder, key, render) {
|
|
569
|
+
return (process.env.NODE_ENV !== "production") && hotRecordOf !== null ? hotKeep(holder, key, render) : render();
|
|
570
|
+
}
|
|
571
|
+
function hotKeep(holder, key, render) {
|
|
572
|
+
const kept = holder.kept;
|
|
573
|
+
const to = getOwner();
|
|
574
|
+
if (kept != null && kept.key === key && hotRebuilding !== null && to !== null && !kept.claimed && keepsIn(kept.root, to)) {
|
|
575
|
+
const nodes = keptNodes(kept.nodes);
|
|
576
|
+
kept.claimed = true;
|
|
577
|
+
hotRebuilding.claims.push({
|
|
578
|
+
kept,
|
|
579
|
+
to,
|
|
580
|
+
nodes,
|
|
581
|
+
host: nodes.length > 0 ? nodes[0].parentNode : null,
|
|
582
|
+
before: nodes.length > 0 ? nodes[nodes.length - 1].nextSibling : null
|
|
583
|
+
});
|
|
584
|
+
return nodes;
|
|
585
|
+
}
|
|
586
|
+
const entry = { key, root: (
|
|
587
|
+
/** @type {any} */
|
|
588
|
+
null
|
|
589
|
+
), nodes: (
|
|
590
|
+
/** @type {Node[]} */
|
|
591
|
+
[]
|
|
592
|
+
), claimed: false };
|
|
593
|
+
entry.nodes = createRoot(() => {
|
|
594
|
+
entry.root = getOwner();
|
|
595
|
+
onCleanup(() => {
|
|
596
|
+
if (holder.kept === entry) holder.kept = null;
|
|
597
|
+
});
|
|
598
|
+
return isHydrating() ? adoptKept(render()) : hotHeld(valuesToNodes(render(), null, [], false));
|
|
599
|
+
});
|
|
600
|
+
holder.kept = entry;
|
|
601
|
+
return entry.nodes;
|
|
602
|
+
}
|
|
603
|
+
function adoptKept(value) {
|
|
604
|
+
const c = cur;
|
|
605
|
+
splitHere(c);
|
|
606
|
+
const anchor = anchorOf(c);
|
|
607
|
+
adopt(value);
|
|
608
|
+
const nodes = [];
|
|
609
|
+
for (let n = afterAnchor(c, anchor); n !== null && n !== c.n; n = n.nextSibling) nodes.push(n);
|
|
610
|
+
session.built.add(nodes);
|
|
611
|
+
return nodes;
|
|
612
|
+
}
|
|
613
|
+
function keepsIn(root, to) {
|
|
614
|
+
if (_isDisposed(root)) return false;
|
|
615
|
+
const { slot } = (
|
|
616
|
+
/** @type {any} */
|
|
617
|
+
hotRebuilding
|
|
618
|
+
);
|
|
619
|
+
const was = [];
|
|
620
|
+
for (let o = root.owner; o !== slot.root; o = o.owner) {
|
|
621
|
+
if (o == null) return false;
|
|
622
|
+
was.push(o);
|
|
623
|
+
}
|
|
624
|
+
was.push(slot.root);
|
|
625
|
+
const now = [];
|
|
626
|
+
for (let o = to; o !== slot.next; o = o.owner) {
|
|
627
|
+
if (o == null) return false;
|
|
628
|
+
now.push(o);
|
|
629
|
+
}
|
|
630
|
+
now.push(slot.next);
|
|
631
|
+
for (const chain of [was, now]) {
|
|
632
|
+
for (const o of chain) {
|
|
633
|
+
if (o.context == null) continue;
|
|
634
|
+
for (const key of o.context.keys()) {
|
|
635
|
+
if (!Object.is(contextIn(was, key, slot.wrapper), contextIn(now, key, slot.wrapper))) return false;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
function contextIn(chain, key, above) {
|
|
642
|
+
for (const o of chain) if (o.context != null && o.context.has(key)) return contextValue(o.context.get(key));
|
|
643
|
+
for (let o = above; o != null; o = o.owner) if (o.context != null && o.context.has(key)) return contextValue(o.context.get(key));
|
|
644
|
+
return void 0;
|
|
645
|
+
}
|
|
646
|
+
function contextValue(value) {
|
|
647
|
+
return value != null && value._signal ? value.peek() : value;
|
|
648
|
+
}
|
|
649
|
+
function keptNodes(nodes) {
|
|
650
|
+
if (nodes.length === 0) return nodes;
|
|
651
|
+
const first = nodes[0];
|
|
652
|
+
const last = (
|
|
653
|
+
/** @type {any} */
|
|
654
|
+
nodes[nodes.length - 1]
|
|
655
|
+
);
|
|
656
|
+
const end = last._rangeEnd && last._rangeEnd.parentNode === last.parentNode ? last._rangeEnd : last;
|
|
657
|
+
if (first.parentNode === null || first.parentNode !== end.parentNode) return nodes;
|
|
658
|
+
const out = [];
|
|
659
|
+
for (let n = first; n !== null; n = n.nextSibling) {
|
|
660
|
+
out.push(n);
|
|
661
|
+
if (n === end) break;
|
|
662
|
+
}
|
|
663
|
+
return out;
|
|
664
|
+
}
|
|
665
|
+
function takeClaims(claims) {
|
|
666
|
+
for (const { kept, to } of claims) {
|
|
667
|
+
kept.claimed = false;
|
|
668
|
+
_devHot.move(kept.root, to);
|
|
669
|
+
topComponents(kept.root, parentComponent(kept.root));
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function returnClaims(claims) {
|
|
673
|
+
for (const { kept, nodes, host, before } of claims) {
|
|
674
|
+
kept.claimed = false;
|
|
675
|
+
if (host !== null) for (const n of nodes) host.insertBefore(n, before);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
function topComponents(o, parent) {
|
|
679
|
+
for (let c = o.firstChild; c !== null; c = c.nextSibling) {
|
|
680
|
+
if (c.Component !== void 0) c._parentCtx = parent;
|
|
681
|
+
else topComponents(c, parent);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function _hotSwap(records) {
|
|
685
|
+
return (process.env.NODE_ENV !== "production") ? hotSwap(records) : { swapped: 0, kept: 0, failed: [] };
|
|
686
|
+
}
|
|
687
|
+
function hotSwap(records) {
|
|
688
|
+
const before = hotSlots;
|
|
689
|
+
const focus = focusNow();
|
|
690
|
+
let swapped = 0;
|
|
691
|
+
let kept = 0;
|
|
692
|
+
const failed = [];
|
|
693
|
+
for (const record of records) {
|
|
694
|
+
const done = batch(() => swapRecord(record, before));
|
|
695
|
+
if (done.error !== null) {
|
|
696
|
+
failed.push({ record, error: done.error.error });
|
|
697
|
+
continue;
|
|
698
|
+
}
|
|
699
|
+
swapped += done.swapped;
|
|
700
|
+
kept += done.kept;
|
|
701
|
+
}
|
|
702
|
+
const boundaries = [...hotBoundaries];
|
|
703
|
+
hotBoundaries.clear();
|
|
704
|
+
batch(() => {
|
|
705
|
+
for (const handler of boundaries) handler._reset();
|
|
706
|
+
});
|
|
707
|
+
refocus(focus);
|
|
708
|
+
return { swapped, kept, failed };
|
|
709
|
+
}
|
|
710
|
+
function focusNow() {
|
|
711
|
+
const el = document.activeElement;
|
|
712
|
+
if (el === null || el === document.body || el === document.documentElement) return null;
|
|
713
|
+
const at = { el, start: null, end: null, direction: null, range: null };
|
|
714
|
+
if (typeof el.selectionStart === "number") {
|
|
715
|
+
at.start = el.selectionStart;
|
|
716
|
+
at.end = el.selectionEnd;
|
|
717
|
+
at.direction = el.selectionDirection;
|
|
718
|
+
} else if (el.isContentEditable) {
|
|
719
|
+
const selection = document.getSelection();
|
|
720
|
+
if (selection !== null && selection.rangeCount > 0) at.range = selection.getRangeAt(0).cloneRange();
|
|
721
|
+
}
|
|
722
|
+
return at;
|
|
723
|
+
}
|
|
724
|
+
function refocus(at) {
|
|
725
|
+
if (at === null || !at.el.isConnected || document.activeElement === at.el) return;
|
|
726
|
+
at.el.focus({ preventScroll: true });
|
|
727
|
+
if (at.start !== null) at.el.setSelectionRange(at.start, at.end, at.direction);
|
|
728
|
+
else if (at.range !== null) {
|
|
729
|
+
const selection = (
|
|
730
|
+
/** @type {Selection} */
|
|
731
|
+
document.getSelection()
|
|
732
|
+
);
|
|
733
|
+
selection.removeAllRanges();
|
|
734
|
+
selection.addRange(at.range);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function swapRecord(record, before) {
|
|
738
|
+
const built = [];
|
|
739
|
+
for (const slot of [...record.slots]) {
|
|
740
|
+
if (slot.made > before || _isDisposed(slot.wrapper)) continue;
|
|
741
|
+
const version = buildVersion(slot);
|
|
742
|
+
built.push(version);
|
|
743
|
+
if (slot.error !== null) {
|
|
744
|
+
for (const each of built) dropVersion(each);
|
|
745
|
+
return { error: slot.error, swapped: 0, kept: 0 };
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
let swapped = 0;
|
|
749
|
+
let kept = 0;
|
|
750
|
+
for (const version of built) {
|
|
751
|
+
const slot = version.slot;
|
|
752
|
+
if (_isDisposed(slot.wrapper)) continue;
|
|
753
|
+
placeVersion(version);
|
|
754
|
+
swapped++;
|
|
755
|
+
const run = slot.root._hot.run;
|
|
756
|
+
if (run !== null && run.kept !== null) kept++;
|
|
757
|
+
}
|
|
758
|
+
return { error: null, swapped, kept };
|
|
759
|
+
}
|
|
760
|
+
function buildVersion(slot) {
|
|
761
|
+
const record = slot.record;
|
|
762
|
+
const kept = slot.state !== null && slot.state === record.state ? slot.root._hot.run : null;
|
|
763
|
+
slot.error = null;
|
|
764
|
+
slot.next = null;
|
|
765
|
+
slot.building = true;
|
|
766
|
+
const claims = [];
|
|
767
|
+
hotRebuilding = { slot, claims };
|
|
768
|
+
let out = null;
|
|
769
|
+
try {
|
|
770
|
+
if (slot.endChildrenPass !== null) slot.endChildrenPass(null);
|
|
771
|
+
out = hotBuild(slot, kept, _renderComponent, record.impl, slot.props, slot.endChildrenPass, slot.isSvg, slot.devLoc);
|
|
772
|
+
} catch (error) {
|
|
773
|
+
slot.error ??= { error };
|
|
774
|
+
} finally {
|
|
775
|
+
slot.building = false;
|
|
776
|
+
hotRebuilding = null;
|
|
777
|
+
}
|
|
778
|
+
return { slot, out, claims };
|
|
779
|
+
}
|
|
780
|
+
function dropVersion({ slot, claims }) {
|
|
781
|
+
returnClaims(claims);
|
|
782
|
+
if (slot.next !== null) _disposeOwner(slot.next);
|
|
783
|
+
slot.next = null;
|
|
784
|
+
const run = slot.root._hot.run;
|
|
785
|
+
if (run !== null) runWithOwner(run.owner, () => {
|
|
786
|
+
for (const value of run.values) _devHot.adopt(Array.isArray(value) ? value[0] : value);
|
|
787
|
+
});
|
|
788
|
+
if (slot.endChildrenPass !== null && slot.root.firstChild !== null) slot.endChildrenPass(slot.root.firstChild);
|
|
789
|
+
}
|
|
790
|
+
function placeVersion({ slot, out, claims }) {
|
|
791
|
+
const record = slot.record;
|
|
792
|
+
takeClaims(claims);
|
|
793
|
+
_disposeOwner(slot.root);
|
|
794
|
+
slot.root = slot.next;
|
|
795
|
+
slot.state = record.state;
|
|
796
|
+
if (slot.start === null) {
|
|
797
|
+
const old = slot.top;
|
|
798
|
+
const host2 = old.parentNode;
|
|
799
|
+
if (out.nodeType === 1) {
|
|
800
|
+
slot.top = out;
|
|
801
|
+
if (host2 !== null) host2.replaceChild(out, old);
|
|
802
|
+
hotReplaced(slot, old, [out]);
|
|
803
|
+
} else {
|
|
804
|
+
hotMarkers(slot);
|
|
805
|
+
slot.tops = topsOf(out);
|
|
806
|
+
const frag = document.createDocumentFragment();
|
|
807
|
+
frag.appendChild(slot.start);
|
|
808
|
+
frag.appendChild(out);
|
|
809
|
+
frag.appendChild(slot.end);
|
|
810
|
+
if (host2 !== null) host2.replaceChild(frag, old);
|
|
811
|
+
else slot.frag.appendChild(frag);
|
|
812
|
+
hotReplaced(slot, old, [slot.start, ...slot.tops, slot.end]);
|
|
813
|
+
}
|
|
814
|
+
if (host2 !== null) optionsChanged(host2);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
const { start, end } = slot;
|
|
818
|
+
const host = end.parentNode;
|
|
819
|
+
slot.tops = topsOf(out);
|
|
820
|
+
if (host !== null && start.parentNode === host) {
|
|
821
|
+
for (let n = start.nextSibling; n !== null && n !== end; n = start.nextSibling) host.removeChild(n);
|
|
822
|
+
host.insertBefore(out, end);
|
|
823
|
+
optionsChanged(host);
|
|
824
|
+
} else {
|
|
825
|
+
slot.frag.appendChild(start);
|
|
826
|
+
slot.frag.appendChild(out);
|
|
827
|
+
slot.frag.appendChild(end);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
function adoptHot(record, props, endChildrenPass, site, devLoc) {
|
|
831
|
+
const c = cur;
|
|
832
|
+
const slot = hotSlot(record, props, endChildrenPass, _isSvgParent(c.p), devLoc);
|
|
833
|
+
hotMarkers(slot);
|
|
834
|
+
splitHere(c);
|
|
835
|
+
c.p.insertBefore(slot.start, c.n);
|
|
836
|
+
let nodes;
|
|
837
|
+
try {
|
|
838
|
+
nodes = hotBuild(slot, null, adoptComponent, record.impl, props, endChildrenPass, site, devLoc);
|
|
839
|
+
} catch (error) {
|
|
840
|
+
_disposeOwner(slot.wrapper);
|
|
841
|
+
throw error;
|
|
842
|
+
}
|
|
843
|
+
slot.root = slot.next;
|
|
844
|
+
splitHere(c);
|
|
845
|
+
c.p.insertBefore(slot.end, c.n);
|
|
846
|
+
const tops = Array.isArray(nodes) ? nodes : [nodes];
|
|
847
|
+
slot.tops = tops;
|
|
848
|
+
return [slot.start, ...tops, slot.end];
|
|
849
|
+
}
|
|
850
|
+
function invalidNesting(root) {
|
|
851
|
+
const nodes = [...root.childNodes];
|
|
852
|
+
const name = (node) => node ? node.nodeName.toLowerCase() : "that element";
|
|
853
|
+
const inner = nodes.find((node, i) => i > 0 && node.nodeType === 1);
|
|
854
|
+
return Object.assign(
|
|
855
|
+
new Error(_thrownMessage(
|
|
856
|
+
"ERR_INVALID_HTML_NESTING",
|
|
857
|
+
`<${name(nodes[0])}> cannot contain <${name(inner)}>: the HTML parser closed the outer tag early, so the rendered tree does not match your JSX.`
|
|
858
|
+
)),
|
|
859
|
+
{ code: "ERR_INVALID_HTML_NESTING" }
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
function parseTemplate(html, unwrap) {
|
|
863
|
+
const t = document.createElement("template");
|
|
864
|
+
t.innerHTML = html;
|
|
865
|
+
const root = unwrap ? (
|
|
866
|
+
/** @type {Node} */
|
|
867
|
+
t.content.firstChild
|
|
868
|
+
) : t.content;
|
|
869
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
870
|
+
if (root.childNodes.length !== 1) throw invalidNesting(root);
|
|
871
|
+
if (!unwrap) checkTemplateRoot(
|
|
872
|
+
/** @type {Node} */
|
|
873
|
+
root.firstChild
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
return (
|
|
877
|
+
/** @type {Node} */
|
|
878
|
+
root.firstChild
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
function _$template(html, flag) {
|
|
882
|
+
let node = null;
|
|
883
|
+
return () => (node === null ? node = parseTemplate(html, flag === 2) : node).cloneNode(true);
|
|
884
|
+
}
|
|
885
|
+
function checkTemplateRoot(node) {
|
|
886
|
+
if (node.nodeType !== 1 || node.namespaceURI !== NAMESPACES[0] || !(SVG_TAG.test(node.localName) || MATH_TAG.test(node.localName))) return;
|
|
887
|
+
throw Object.assign(new Error(_thrownMessage(
|
|
888
|
+
"ERR_TEMPLATE_NAMESPACE",
|
|
889
|
+
`The template for <${node.localName}> has no namespace flag, so its root would render as an unknown HTML element instead of SVG or MathML. Compiled output like this comes from a what-compiler older than this runtime: compiler and runtime versions move together, so recompile it with the what-compiler release that matches what-framework.`
|
|
890
|
+
)), { code: "ERR_TEMPLATE_NAMESPACE" });
|
|
891
|
+
}
|
|
892
|
+
var _templateWarned = false;
|
|
893
|
+
function template(html) {
|
|
894
|
+
if ((process.env.NODE_ENV !== "production") && !_templateWarned) {
|
|
895
|
+
_templateWarned = true;
|
|
896
|
+
console.warn(
|
|
897
|
+
"[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities."
|
|
898
|
+
);
|
|
899
|
+
}
|
|
900
|
+
const node = parseTemplate(html.trim(), false);
|
|
901
|
+
return () => node.cloneNode(true);
|
|
902
|
+
}
|
|
903
|
+
function svgTemplate(html) {
|
|
904
|
+
const trimmed = html.trim();
|
|
905
|
+
const node = /^<svg[\s/>]/i.test(trimmed) ? parseTemplate(trimmed, false) : parseTemplate(`<svg>${trimmed}</svg>`, true);
|
|
906
|
+
return () => node.cloneNode(true);
|
|
907
|
+
}
|
|
908
|
+
var optionsChanged = (parent) => {
|
|
909
|
+
if (!parent._$select) parent = parent.parentNode;
|
|
910
|
+
parent?._$select?.(parent, parent._$value);
|
|
911
|
+
};
|
|
912
|
+
function _installOptionsChanged(fn) {
|
|
913
|
+
optionsChanged = fn;
|
|
914
|
+
}
|
|
915
|
+
function insert(parent, child, marker, devName) {
|
|
916
|
+
const type = typeof child;
|
|
917
|
+
if (type === "string" || type === "number") {
|
|
918
|
+
if (marker === void 0 && child !== "" && parent.firstChild === null) {
|
|
919
|
+
parent.textContent = child;
|
|
920
|
+
return parent.firstChild;
|
|
921
|
+
}
|
|
922
|
+
return parent.insertBefore(document.createTextNode(String(child)), marker || null);
|
|
923
|
+
}
|
|
924
|
+
if (type === "function") {
|
|
925
|
+
if (child._mapArray) return child(parent, marker || null);
|
|
926
|
+
if (child._lazyChildren) return insert(parent, child(), marker);
|
|
927
|
+
effect(region(parent, child, marker, vnodeRows !== null ? getOwner() : null), (process.env.NODE_ENV !== "production") ? { name: devName || "children", binding: parent } : void 0);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
if (child != null && type === "object" && child.nodeType > 0) {
|
|
931
|
+
if ((process.env.NODE_ENV !== "production") && child._hotSlot !== void 0) {
|
|
932
|
+
for (const node of hotPlaced(child)) parent.insertBefore(node, marker || null);
|
|
933
|
+
return child;
|
|
934
|
+
}
|
|
935
|
+
return parent.insertBefore(child, marker || null);
|
|
936
|
+
}
|
|
937
|
+
return reconcileInsert(parent, child, null, marker || null);
|
|
938
|
+
}
|
|
939
|
+
function insertReactive(parent, child, marker, devName) {
|
|
940
|
+
effect(region(parent, child, marker, vnodeRows !== null ? getOwner() : null), (process.env.NODE_ENV !== "production") ? { name: devName || "children", binding: parent } : void 0);
|
|
941
|
+
}
|
|
942
|
+
function region(parent, child, marker, scope) {
|
|
943
|
+
const m = marker || null;
|
|
944
|
+
let current = null;
|
|
945
|
+
let textNode = null;
|
|
946
|
+
let text = "";
|
|
947
|
+
let options = false;
|
|
948
|
+
let mounted = false;
|
|
949
|
+
let rows = null;
|
|
950
|
+
return () => {
|
|
951
|
+
const val = child();
|
|
952
|
+
const vt = typeof val;
|
|
953
|
+
if (!mounted) {
|
|
954
|
+
mounted = true;
|
|
955
|
+
if (vt === "string" || vt === "number") {
|
|
956
|
+
const str = String(val);
|
|
957
|
+
if (marker === void 0 && str !== "" && parent.firstChild === null) {
|
|
958
|
+
parent.textContent = str;
|
|
959
|
+
textNode = /** @type {Text} */
|
|
960
|
+
parent.firstChild;
|
|
961
|
+
} else {
|
|
962
|
+
textNode = parent.insertBefore(document.createTextNode(str), m);
|
|
963
|
+
}
|
|
964
|
+
text = str;
|
|
965
|
+
textWritten(parent, str, options = inOptions(parent));
|
|
966
|
+
current = textNode;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
} else if (textNode !== null && (vt === "string" || vt === "number")) {
|
|
970
|
+
const str = String(val);
|
|
971
|
+
if (str !== text) textNode.data = text = str;
|
|
972
|
+
textWritten(parent, str, options);
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
textNode = null;
|
|
976
|
+
if (vnodeRows !== null) {
|
|
977
|
+
const keyed = vnodeRows(val, rows, false, scope);
|
|
978
|
+
if (keyed !== null) {
|
|
979
|
+
if (current !== null) current = reconcileInsert(parent, null, current, m);
|
|
980
|
+
rows = keyed;
|
|
981
|
+
rows.update(parent, m, val);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
if (rows !== null) {
|
|
985
|
+
rows.remove();
|
|
986
|
+
optionsChanged(parent);
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
current = reconcileInsert(parent, val, current, m);
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
function textAt(parent, str, marker) {
|
|
993
|
+
if (marker === void 0 && str !== "" && parent.firstChild === null) {
|
|
994
|
+
parent.textContent = str;
|
|
995
|
+
return parent;
|
|
996
|
+
}
|
|
997
|
+
return parent.insertBefore(document.createTextNode(str), marker || null);
|
|
998
|
+
}
|
|
999
|
+
function fieldNode(fields, i) {
|
|
1000
|
+
const node = fields[i];
|
|
1001
|
+
if (node.nodeType !== 1) return node;
|
|
1002
|
+
const text = node.firstChild;
|
|
1003
|
+
return fields[i] = text !== null && text.nodeType === 3 ? text : node.insertBefore(document.createTextNode(""), text);
|
|
1004
|
+
}
|
|
1005
|
+
function _$plain(parent, read, marker, devName) {
|
|
1006
|
+
_effectWhenNeeded(read, bindPlain, parent, marker, (process.env.NODE_ENV !== "production") ? { name: devName || "children", binding: parent } : void 0);
|
|
1007
|
+
}
|
|
1008
|
+
function bindPlain(value, source, read, parent, marker, owner) {
|
|
1009
|
+
if (source === null) {
|
|
1010
|
+
const type = typeof value;
|
|
1011
|
+
if (value == null || type === "boolean" || type === "symbol") {
|
|
1012
|
+
if ((process.env.NODE_ENV !== "production") && type === "symbol") symbolChild(value);
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
if (type === "string" || type === "number") {
|
|
1016
|
+
const str = String(value);
|
|
1017
|
+
textAt(parent, str, marker);
|
|
1018
|
+
textWritten(parent, str);
|
|
1019
|
+
return null;
|
|
1020
|
+
}
|
|
1021
|
+
} else if (rowField !== null && rowField(value, source, read, parent, marker, owner)) return null;
|
|
1022
|
+
return plainRegion(value, read, parent, marker, owner);
|
|
1023
|
+
}
|
|
1024
|
+
var rowField = null;
|
|
1025
|
+
var sweepFields = null;
|
|
1026
|
+
var fieldLives = (cell, owner) => owner === cell.building;
|
|
1027
|
+
function _$rowFields() {
|
|
1028
|
+
rowField = bindRowField;
|
|
1029
|
+
sweepFields = dropFailedFields;
|
|
1030
|
+
fieldLives = _livesWithRow;
|
|
1031
|
+
return true;
|
|
1032
|
+
}
|
|
1033
|
+
function bindRowField(value, source, read, parent, marker, owner) {
|
|
1034
|
+
const text = fieldText(value);
|
|
1035
|
+
if (text === null || !_livesWithRow(source, owner)) return false;
|
|
1036
|
+
bindField(source, textAt(parent, text, marker), read, writePlain, _ownerRecord(owner), text);
|
|
1037
|
+
textWritten(parent, text);
|
|
1038
|
+
return true;
|
|
1039
|
+
}
|
|
1040
|
+
function dropFailedFields(cell) {
|
|
1041
|
+
const fields = cell.fields;
|
|
1042
|
+
if (failures === 0 || fields === null) return;
|
|
1043
|
+
for (let i = 0; i < fields.length; i += 5) {
|
|
1044
|
+
const owner = fields[i + 3];
|
|
1045
|
+
if (owner !== null && _isDisposed(owner)) dropField(fields, i);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
function plainRegion(value, read, parent, marker, owner) {
|
|
1049
|
+
let first = true;
|
|
1050
|
+
const run = region(parent, () => {
|
|
1051
|
+
if (!first) return read();
|
|
1052
|
+
first = false;
|
|
1053
|
+
const v = value;
|
|
1054
|
+
value = void 0;
|
|
1055
|
+
return v;
|
|
1056
|
+
}, marker, vnodeRows !== null ? _ownerRecord(owner) : null);
|
|
1057
|
+
run();
|
|
1058
|
+
return run;
|
|
1059
|
+
}
|
|
1060
|
+
function writePlain(fields, i, item, cell) {
|
|
1061
|
+
const read = fields[i + 1];
|
|
1062
|
+
const owner = fields[i + 3];
|
|
1063
|
+
try {
|
|
1064
|
+
const text = fieldText(_readAlone(read, cell));
|
|
1065
|
+
if (text !== null) {
|
|
1066
|
+
writeText(fields, i, text);
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
} catch {
|
|
1070
|
+
}
|
|
1071
|
+
try {
|
|
1072
|
+
runWithOwner(owner, () => _effectWhenNeeded(read, rebindPlain, fields, i));
|
|
1073
|
+
} catch (err) {
|
|
1074
|
+
const left = _handleError(owner, err);
|
|
1075
|
+
if (left !== HANDLED) {
|
|
1076
|
+
try {
|
|
1077
|
+
console.error("[what] Uncaught error in effect during update:", left);
|
|
1078
|
+
} catch {
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return true;
|
|
1083
|
+
}
|
|
1084
|
+
function rebindPlain(value, source, read, fields, i, owner) {
|
|
1085
|
+
if (fields[i] === null) return null;
|
|
1086
|
+
if (source === null || source.fields === fields) {
|
|
1087
|
+
const text = fieldText(value);
|
|
1088
|
+
if (text !== null) {
|
|
1089
|
+
writeText(fields, i, text);
|
|
1090
|
+
return null;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
const node = fieldNode(fields, i);
|
|
1094
|
+
dropField(fields, i);
|
|
1095
|
+
const parent = node.parentNode;
|
|
1096
|
+
if (parent === null) return null;
|
|
1097
|
+
const marker = node.nextSibling;
|
|
1098
|
+
parent.removeChild(node);
|
|
1099
|
+
return plainRegion(value, read, parent, marker, owner);
|
|
1100
|
+
}
|
|
1101
|
+
function dropField(fields, i) {
|
|
1102
|
+
fields[i] = fields[i + 1] = fields[i + 3] = fields[i + 4] = null;
|
|
1103
|
+
fields[i + 2] = fieldGone;
|
|
1104
|
+
}
|
|
1105
|
+
function fieldGone() {
|
|
1106
|
+
return true;
|
|
1107
|
+
}
|
|
1108
|
+
function _isDomNode(value) {
|
|
1109
|
+
if (!value || typeof value !== "object") return false;
|
|
1110
|
+
if (typeof Node !== "undefined" && value instanceof Node) return true;
|
|
1111
|
+
return typeof value.nodeType === "number" && typeof value.nodeName === "string";
|
|
1112
|
+
}
|
|
1113
|
+
var _hasSVGElement = typeof SVGElement !== "undefined";
|
|
1114
|
+
function _isSvgParent(parent) {
|
|
1115
|
+
return _hasSVGElement && parent instanceof SVGElement && parent.tagName !== "foreignObject";
|
|
1116
|
+
}
|
|
1117
|
+
function _region(fn, isSvg) {
|
|
1118
|
+
const startMarker = document.createComment("fn");
|
|
1119
|
+
const endMarker = document.createComment("/fn");
|
|
1120
|
+
const frag = document.createDocumentFragment();
|
|
1121
|
+
frag.appendChild(startMarker);
|
|
1122
|
+
frag.appendChild(endMarker);
|
|
1123
|
+
const scope = vnodeRows !== null ? getOwner() : null;
|
|
1124
|
+
let current = [];
|
|
1125
|
+
let rows = null;
|
|
1126
|
+
if ((process.env.NODE_ENV !== "production")) setNextBinding(endMarker, fn.name || "region");
|
|
1127
|
+
effect(() => {
|
|
1128
|
+
const val = fn();
|
|
1129
|
+
const host = endMarker.parentNode;
|
|
1130
|
+
if (host === null) return;
|
|
1131
|
+
if (vnodeRows !== null) {
|
|
1132
|
+
const keyed = vnodeRows(val, rows, isSvg, scope);
|
|
1133
|
+
if (keyed !== null) {
|
|
1134
|
+
removeRegionNodes(host, current);
|
|
1135
|
+
current = [];
|
|
1136
|
+
rows = keyed;
|
|
1137
|
+
rows.update(host, endMarker, val);
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
if (rows !== null) rows.remove();
|
|
1141
|
+
}
|
|
1142
|
+
removeRegionNodes(host, current);
|
|
1143
|
+
current = valuesToNodes(val, host, [], isSvg);
|
|
1144
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) current = hotHeld(current);
|
|
1145
|
+
for (let i = 0; i < current.length; i++) host.insertBefore(current[i], endMarker);
|
|
1146
|
+
optionsChanged(host);
|
|
1147
|
+
});
|
|
1148
|
+
startMarker._rangeEnd = endMarker;
|
|
1149
|
+
return frag;
|
|
1150
|
+
}
|
|
1151
|
+
function removeRegionNodes(host, current) {
|
|
1152
|
+
for (const old of _liveRegionNodes(current)) {
|
|
1153
|
+
if (old.parentNode === host) host.removeChild(old);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
function _listFragment(inserter) {
|
|
1157
|
+
const frag = document.createDocumentFragment();
|
|
1158
|
+
const startMarker = document.createComment("list");
|
|
1159
|
+
frag.appendChild(startMarker);
|
|
1160
|
+
startMarker._rangeEnd = inserter(frag, null);
|
|
1161
|
+
return frag;
|
|
1162
|
+
}
|
|
1163
|
+
function _vnodeRows(value, rows, isSvg, scope, end, adopted) {
|
|
1164
|
+
if (end !== void 0) return createVNodeRows(isSvg, scope, end, adopted);
|
|
1165
|
+
if (isVNode(value) ? value.key == null : !keyedVNodes(value)) return null;
|
|
1166
|
+
if (value.length === 0 && (rows === null || !rows.live())) return null;
|
|
1167
|
+
return rows || createVNodeRows(isSvg, scope);
|
|
1168
|
+
}
|
|
1169
|
+
function keyedVNodes(value) {
|
|
1170
|
+
if (!Array.isArray(value)) return false;
|
|
1171
|
+
for (const v of value) {
|
|
1172
|
+
if (!isVNode(v) || v.key == null) return false;
|
|
1173
|
+
}
|
|
1174
|
+
return true;
|
|
1175
|
+
}
|
|
1176
|
+
function vnodeCheckedKey(vnode) {
|
|
1177
|
+
return vnode._itemKey === true ? vnode : vnode.key;
|
|
1178
|
+
}
|
|
1179
|
+
var VNODE_LIST = {};
|
|
1180
|
+
function sameVNode(x, y) {
|
|
1181
|
+
if (Object.is(x, y)) return true;
|
|
1182
|
+
if (typeof x === "function") return typeof y === "function" && String(x) === String(y);
|
|
1183
|
+
if (x === null || y === null || typeof x !== "object" || typeof y !== "object") return false;
|
|
1184
|
+
const proto = Object.getPrototypeOf(x);
|
|
1185
|
+
if (proto !== Object.getPrototypeOf(y)) return false;
|
|
1186
|
+
if (isVNode(x)) return x.tag === y.tag && x.key === y.key && sameVNode(x.props || {}, y.props || {}) && sameVNode(x.children, y.children);
|
|
1187
|
+
if (proto !== Object.prototype && proto !== Array.prototype && proto !== null) return false;
|
|
1188
|
+
const keys = Object.keys(x);
|
|
1189
|
+
if (keys.length !== Object.keys(y).length) return false;
|
|
1190
|
+
for (const k of keys) if (!Object.hasOwn(y, k) || !sameVNode(x[k], y[k])) return false;
|
|
1191
|
+
return true;
|
|
1192
|
+
}
|
|
1193
|
+
function createVNodeRows(isSvg, scope, end = document.createComment("/list"), rows = []) {
|
|
1194
|
+
const build = (vnode) => runWithOwner(scope, () => createRoot((dispose) => {
|
|
1195
|
+
const host = end.parentNode;
|
|
1196
|
+
const frag = document.createDocumentFragment();
|
|
1197
|
+
for (const n of (process.env.NODE_ENV !== "production") && hotRecordOf !== null ? hotHeld(valuesToNodes(vnode, host, [], isSvg || _isSvgParent(host))) : valuesToNodes(vnode, host, [], isSvg || _isSvgParent(host))) frag.appendChild(n);
|
|
1198
|
+
if (frag.firstChild === null) frag.appendChild(document.createComment(""));
|
|
1199
|
+
return { key: vnode.key, vnode, dispose, first: frag.firstChild, last: frag.lastChild };
|
|
1200
|
+
}));
|
|
1201
|
+
const drop = (row) => {
|
|
1202
|
+
row.dispose();
|
|
1203
|
+
for (let n = row.first; ; ) {
|
|
1204
|
+
const next2 = n.nextSibling;
|
|
1205
|
+
n.remove();
|
|
1206
|
+
if (n === row.last) return;
|
|
1207
|
+
n = next2;
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
return {
|
|
1211
|
+
live: () => rows.length > 0,
|
|
1212
|
+
update(host, marker, value) {
|
|
1213
|
+
const vnodes = Array.isArray(value) ? value : [value];
|
|
1214
|
+
if (end.parentNode !== host) host.insertBefore(end, marker);
|
|
1215
|
+
if ((process.env.NODE_ENV !== "production")) reportDuplicateKey(vnodes, vnodeCheckedKey, VNODE_LIST);
|
|
1216
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
1217
|
+
for (const row of rows) {
|
|
1218
|
+
const same = byKey.get(row.key);
|
|
1219
|
+
if (same === void 0) byKey.set(row.key, [row]);
|
|
1220
|
+
else same.push(row);
|
|
1221
|
+
}
|
|
1222
|
+
const stale = [];
|
|
1223
|
+
const next2 = vnodes.map((vnode) => {
|
|
1224
|
+
const same = byKey.get(vnode.key);
|
|
1225
|
+
if (same === void 0 || same.length === 0) return build(vnode);
|
|
1226
|
+
const row = same.shift();
|
|
1227
|
+
if (sameVNode(row.vnode, vnode)) return row;
|
|
1228
|
+
stale.push(row);
|
|
1229
|
+
return build(vnode);
|
|
1230
|
+
});
|
|
1231
|
+
for (const same of byKey.values()) same.forEach(drop);
|
|
1232
|
+
stale.forEach(drop);
|
|
1233
|
+
if (rows.length === 0) {
|
|
1234
|
+
for (const row of next2) moveRow(host, row.first, null, end);
|
|
1235
|
+
} else {
|
|
1236
|
+
let ref = end;
|
|
1237
|
+
for (let i = next2.length - 1; i >= 0; i--) {
|
|
1238
|
+
const row = next2[i];
|
|
1239
|
+
if (row.last.nextSibling !== ref) moveRow(host, row.first, row.last.nextSibling, ref);
|
|
1240
|
+
ref = row.first;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
rows = next2;
|
|
1244
|
+
optionsChanged(host);
|
|
1245
|
+
},
|
|
1246
|
+
// The region's value is no longer a keyed list: drop the rows and their end.
|
|
1247
|
+
remove() {
|
|
1248
|
+
if (end.parentNode === null) return;
|
|
1249
|
+
rows.forEach(drop);
|
|
1250
|
+
rows = [];
|
|
1251
|
+
end.remove();
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function asNodeArray(value) {
|
|
1256
|
+
if (value == null) return [];
|
|
1257
|
+
return Array.isArray(value) ? value : [value];
|
|
1258
|
+
}
|
|
1259
|
+
function valuesToNodes(value, parent, out, isSvg) {
|
|
1260
|
+
if (value == null || typeof value === "boolean" || typeof value === "symbol") {
|
|
1261
|
+
if ((process.env.NODE_ENV !== "production") && typeof value === "symbol") symbolChild(value);
|
|
1262
|
+
return out;
|
|
1263
|
+
}
|
|
1264
|
+
if (Array.isArray(value)) {
|
|
1265
|
+
for (let i = 0; i < value.length; i++) {
|
|
1266
|
+
valuesToNodes(value[i], parent, out, isSvg);
|
|
1267
|
+
}
|
|
1268
|
+
return out;
|
|
1269
|
+
}
|
|
1270
|
+
if (typeof value === "function") {
|
|
1271
|
+
if (value._lazyChildren) return valuesToNodes(value(), parent, out, isSvg);
|
|
1272
|
+
const frag = value._mapArray ? value._mapArray(value) : _region(value, isSvg);
|
|
1273
|
+
for (let node = frag.firstChild; node !== null; node = node.nextSibling) out.push(node);
|
|
1274
|
+
return out;
|
|
1275
|
+
}
|
|
1276
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
1277
|
+
out.push(document.createTextNode(String(value)));
|
|
1278
|
+
return out;
|
|
1279
|
+
}
|
|
1280
|
+
if (_isDomNode(value)) {
|
|
1281
|
+
if (value.nodeType === 11 && value.childNodes.length > 0) {
|
|
1282
|
+
for (let node = value.firstChild; node !== null; node = node.nextSibling) out.push(node);
|
|
1283
|
+
} else if ((process.env.NODE_ENV !== "production") && value.nodeType === 11 && value._hotSlot !== void 0) {
|
|
1284
|
+
hotPlacement(value._hotSlot, out);
|
|
1285
|
+
} else {
|
|
1286
|
+
out.push(value);
|
|
1287
|
+
}
|
|
1288
|
+
return out;
|
|
1289
|
+
}
|
|
1290
|
+
const render = vnodeRenderer !== null ? vnodeRenderer : value._$r;
|
|
1291
|
+
if (typeof render === "function") return valuesToNodes(render(value, parent, isSvg, 1), parent, out, isSvg);
|
|
1292
|
+
if ((process.env.NODE_ENV !== "production") && isVNode(value)) throw vnodeRuntimeMissing("A vnode");
|
|
1293
|
+
out.push(document.createTextNode(String(value)));
|
|
1294
|
+
return out;
|
|
1295
|
+
}
|
|
1296
|
+
function sameNodeArray(a, b) {
|
|
1297
|
+
if (a.length !== b.length) return false;
|
|
1298
|
+
for (let i = 0; i < a.length; i++) {
|
|
1299
|
+
if (a[i] !== b[i]) return false;
|
|
1300
|
+
}
|
|
1301
|
+
return true;
|
|
1302
|
+
}
|
|
1303
|
+
function reconcileInsert(parent, value, current, marker) {
|
|
1304
|
+
const nodes = reconcileNodes(parent, value, current, marker);
|
|
1305
|
+
if (nodes !== current) optionsChanged(parent);
|
|
1306
|
+
return nodes;
|
|
1307
|
+
}
|
|
1308
|
+
function reconcileNodes(parent, value, current, marker) {
|
|
1309
|
+
if (!parent || typeof parent.insertBefore !== "function") {
|
|
1310
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
1311
|
+
console.warn("[what] reconcileInsert called with invalid parent:", parent);
|
|
1312
|
+
}
|
|
1313
|
+
return current;
|
|
1314
|
+
}
|
|
1315
|
+
const targetMarker = marker || null;
|
|
1316
|
+
if ((typeof value === "string" || typeof value === "number") && current && !Array.isArray(current) && current.nodeType === 3) {
|
|
1317
|
+
const text = String(value);
|
|
1318
|
+
if (current.data !== text) current.data = text;
|
|
1319
|
+
optionsChanged(parent);
|
|
1320
|
+
return current;
|
|
1321
|
+
}
|
|
1322
|
+
if (typeof value === "object" && value !== null && value.nodeType > 0 && value.nodeType !== 11 && !Array.isArray(value) && !((process.env.NODE_ENV !== "production") && value._hotSlot !== void 0)) {
|
|
1323
|
+
if (value === current) return current;
|
|
1324
|
+
if (current && !Array.isArray(current) && current.nodeType > 0 && current.nodeType !== 11) {
|
|
1325
|
+
if (current.parentNode === parent) {
|
|
1326
|
+
parent.replaceChild(value, current);
|
|
1327
|
+
} else {
|
|
1328
|
+
if (targetMarker) parent.insertBefore(value, targetMarker);
|
|
1329
|
+
else parent.appendChild(value);
|
|
1330
|
+
}
|
|
1331
|
+
return value;
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
let newNodes = valuesToNodes(value, parent, []);
|
|
1335
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) newNodes = hotHeld(newNodes);
|
|
1336
|
+
const oldNodes = asNodeArray(current);
|
|
1337
|
+
if (sameNodeArray(oldNodes, newNodes)) {
|
|
1338
|
+
return current;
|
|
1339
|
+
}
|
|
1340
|
+
const staleNodes = _liveRegionNodes(oldNodes);
|
|
1341
|
+
const newLen = newNodes.length;
|
|
1342
|
+
for (let i = 0; i < staleNodes.length; i++) {
|
|
1343
|
+
const oldNode = staleNodes[i];
|
|
1344
|
+
if (oldNode.parentNode !== parent) continue;
|
|
1345
|
+
let found = false;
|
|
1346
|
+
for (let j = 0; j < newLen; j++) {
|
|
1347
|
+
if (newNodes[j] === oldNode) {
|
|
1348
|
+
found = true;
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
if (!found) parent.removeChild(oldNode);
|
|
1353
|
+
}
|
|
1354
|
+
let fresh = true;
|
|
1355
|
+
for (let i = 0; i < newLen && fresh; i++) fresh = newNodes[i].parentNode !== parent;
|
|
1356
|
+
if (fresh) {
|
|
1357
|
+
const at = targetMarker !== null && targetMarker.parentNode === parent ? targetMarker : null;
|
|
1358
|
+
for (let i = 0; i < newLen; i++) parent.insertBefore(newNodes[i], at);
|
|
1359
|
+
} else {
|
|
1360
|
+
let ref = targetMarker;
|
|
1361
|
+
for (let i = newNodes.length - 1; i >= 0; i--) {
|
|
1362
|
+
const node = newNodes[i];
|
|
1363
|
+
if (node.parentNode !== parent || node.nextSibling !== ref) {
|
|
1364
|
+
if (ref && ref.parentNode !== parent) ref = null;
|
|
1365
|
+
if (ref) parent.insertBefore(node, ref);
|
|
1366
|
+
else parent.appendChild(node);
|
|
1367
|
+
}
|
|
1368
|
+
ref = node;
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
if (newNodes.length === 0) return null;
|
|
1372
|
+
return newNodes.length === 1 ? newNodes[0] : newNodes;
|
|
1373
|
+
}
|
|
1374
|
+
function mapArray(source, mapFn, options) {
|
|
1375
|
+
if (typeof source !== "function") {
|
|
1376
|
+
const items = source;
|
|
1377
|
+
source = () => items;
|
|
1378
|
+
}
|
|
1379
|
+
const keyFn = options?.key;
|
|
1380
|
+
return keyFn ? listInserter(source, mapFn, keyFn, options.raw ? RAW : options.follow ? FOLLOW : ACCESSOR, options) : listInserter(source, mapFn, itemKey, RAW, null);
|
|
1381
|
+
}
|
|
1382
|
+
var RAW = 0;
|
|
1383
|
+
var ACCESSOR = 1;
|
|
1384
|
+
var FOLLOW = 2;
|
|
1385
|
+
function itemKey(item) {
|
|
1386
|
+
return item;
|
|
1387
|
+
}
|
|
1388
|
+
function _$mapKeyed(source, mapFn, options) {
|
|
1389
|
+
return listInserter(source, mapFn, options.key, options.follow ? FOLLOW : RAW, options);
|
|
1390
|
+
}
|
|
1391
|
+
function listInserter(source, mapFn, keyFn, keyedSignals, keyed) {
|
|
1392
|
+
if ((process.env.NODE_ENV !== "production")) source = checkedSource(source, keyFn, keyed);
|
|
1393
|
+
const inserter = (parent, marker) => {
|
|
1394
|
+
let items = [];
|
|
1395
|
+
const mappedNodes = [];
|
|
1396
|
+
const disposeFns = [];
|
|
1397
|
+
const endMarker = document.createComment("/list");
|
|
1398
|
+
parent.insertBefore(endMarker, marker || null);
|
|
1399
|
+
if ((process.env.NODE_ENV !== "production")) setNextBinding(endMarker, keyed?.loc ? `list@${keyed.loc}` : "list");
|
|
1400
|
+
effect(() => {
|
|
1401
|
+
const newItems = source() || [];
|
|
1402
|
+
const host = endMarker.parentNode || parent;
|
|
1403
|
+
reconcileKeyed(host, endMarker, items, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedSignals);
|
|
1404
|
+
optionsChanged(host);
|
|
1405
|
+
items = newItems.length > 0 ? newItems.slice() : newItems;
|
|
1406
|
+
});
|
|
1407
|
+
onCleanup(() => {
|
|
1408
|
+
disposeRows(disposeFns, disposeFns.length);
|
|
1409
|
+
mappedNodes.length = 0;
|
|
1410
|
+
disposeFns.length = 0;
|
|
1411
|
+
});
|
|
1412
|
+
return endMarker;
|
|
1413
|
+
};
|
|
1414
|
+
inserter._mapArray = _listFragment;
|
|
1415
|
+
inserter._list = [source, mapFn, keyFn, keyedSignals, inserter, keyed?.slot];
|
|
1416
|
+
return inserter;
|
|
1417
|
+
}
|
|
1418
|
+
function checkedSource(source, keyFn, keyed) {
|
|
1419
|
+
if (keyed === null) return source;
|
|
1420
|
+
const read = () => {
|
|
1421
|
+
const items = source();
|
|
1422
|
+
if (items) reportDuplicateKey(items, keyFn, keyed);
|
|
1423
|
+
return items;
|
|
1424
|
+
};
|
|
1425
|
+
read._listLoc = keyed.loc;
|
|
1426
|
+
return read;
|
|
1427
|
+
}
|
|
1428
|
+
function reportDuplicateKey(items, keyFn, keyed) {
|
|
1429
|
+
if (items.length < 2) return;
|
|
1430
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1431
|
+
for (let i = 0; i < items.length; i++) {
|
|
1432
|
+
const key = keyFn(items[i], i);
|
|
1433
|
+
if (seen.size === seen.add(key).size) {
|
|
1434
|
+
report("ERR_DUPLICATE_KEY", {
|
|
1435
|
+
data: { key: describeKey(key) },
|
|
1436
|
+
loc: keyed.loc || null
|
|
1437
|
+
});
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
function describeKey(key) {
|
|
1443
|
+
const value = typeof key === "function" && key._signal ? untrack(key) : key;
|
|
1444
|
+
return typeof value === "string" ? JSON.stringify(value) : String(value);
|
|
1445
|
+
}
|
|
1446
|
+
function _mapArrayToArray(inserter) {
|
|
1447
|
+
const [source, mapFn, keyFn, keyed, , slot] = inserter._list;
|
|
1448
|
+
const items = source() || [];
|
|
1449
|
+
const rows = items.map((item, index) => {
|
|
1450
|
+
if (keyed === RAW) return mapFn(item, index, item);
|
|
1451
|
+
const cell = _rowItem(item);
|
|
1452
|
+
cell.building = false;
|
|
1453
|
+
return mapFn(keyed === FOLLOW ? cell : () => _readRowItem(cell), index, item);
|
|
1454
|
+
});
|
|
1455
|
+
if (keyFn !== itemKey) {
|
|
1456
|
+
rows._keys = items.map(keyFn);
|
|
1457
|
+
rows._slot = slot;
|
|
1458
|
+
}
|
|
1459
|
+
return rows;
|
|
1460
|
+
}
|
|
1461
|
+
function rowBuilt(cell) {
|
|
1462
|
+
cell.building = false;
|
|
1463
|
+
if (sweepFields !== null) sweepFields(cell);
|
|
1464
|
+
}
|
|
1465
|
+
function rowNode(value) {
|
|
1466
|
+
if (value != null && value.nodeType > 0 && !((process.env.NODE_ENV !== "production") && value._hotSlot !== void 0)) return value;
|
|
1467
|
+
let nodes = valuesToNodes(value, null, []);
|
|
1468
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) nodes = hotHeld(nodes);
|
|
1469
|
+
if (nodes.length === 1) return nodes[0];
|
|
1470
|
+
const frag = document.createDocumentFragment();
|
|
1471
|
+
for (let i = 0; i < nodes.length; i++) frag.appendChild(nodes[i]);
|
|
1472
|
+
return frag;
|
|
1473
|
+
}
|
|
1474
|
+
function buildKeyedRow(endMarker, item, idx, keyedSignals, mapFn, mappedArr, disposeArr) {
|
|
1475
|
+
if (keyedSignals === RAW) return markRow(_runScope(_itemScope(void 0, disposeArr, idx), mapFn, item, idx, item, rowNode), endMarker, idx, mappedArr);
|
|
1476
|
+
const cell = _rowItem(item);
|
|
1477
|
+
const node = _runScope(_itemScope(cell, disposeArr, idx), mapFn, keyedSignals === FOLLOW ? cell : () => _readRowItem(cell), idx, item, rowNode);
|
|
1478
|
+
rowBuilt(cell);
|
|
1479
|
+
disposeArr[idx]._item = cell;
|
|
1480
|
+
return markRow(node, endMarker, idx, mappedArr);
|
|
1481
|
+
}
|
|
1482
|
+
function markRow(node, endMarker, idx, mappedArr) {
|
|
1483
|
+
if (node.nodeType === 1 || node.nodeType === 3) {
|
|
1484
|
+
node._$row = endMarker;
|
|
1485
|
+
mappedArr[idx] = node;
|
|
1486
|
+
return node;
|
|
1487
|
+
}
|
|
1488
|
+
const start = document.createComment("i");
|
|
1489
|
+
start._$row = endMarker;
|
|
1490
|
+
const frag = document.createDocumentFragment();
|
|
1491
|
+
frag.appendChild(start);
|
|
1492
|
+
frag.appendChild(node);
|
|
1493
|
+
mappedArr[idx] = start;
|
|
1494
|
+
return frag;
|
|
1495
|
+
}
|
|
1496
|
+
function rowEnd(start, endMarker) {
|
|
1497
|
+
if (start.nodeType !== 8) return start.nextSibling;
|
|
1498
|
+
let n = start.nextSibling;
|
|
1499
|
+
while (n !== null && n !== endMarker && n._$row !== endMarker) n = n.nextSibling;
|
|
1500
|
+
return n;
|
|
1501
|
+
}
|
|
1502
|
+
function moveRow(parent, start, end, ref) {
|
|
1503
|
+
const move = start.isConnected && parent.moveBefore || parent.insertBefore;
|
|
1504
|
+
let n = start;
|
|
1505
|
+
while (n !== null && n !== end) {
|
|
1506
|
+
const next2 = n.nextSibling;
|
|
1507
|
+
move.call(parent, n, ref);
|
|
1508
|
+
n = next2;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
function removeRow(parent, start, end) {
|
|
1512
|
+
let n = start;
|
|
1513
|
+
while (n !== null && n !== end) {
|
|
1514
|
+
const next2 = n.nextSibling;
|
|
1515
|
+
parent.removeChild(n);
|
|
1516
|
+
n = next2;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
function disposeRows(disposeFns, len) {
|
|
1520
|
+
for (let i = 0; i < len; i++) {
|
|
1521
|
+
const dispose = disposeFns[i];
|
|
1522
|
+
if (dispose !== void 0) dispose();
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
function clearRows(parent, endMarker, mappedNodes, disposeFns, len) {
|
|
1526
|
+
disposeRows(disposeFns, len);
|
|
1527
|
+
const first = mappedNodes[0];
|
|
1528
|
+
if (parent.firstChild === first && parent.lastChild === endMarker) {
|
|
1529
|
+
parent.textContent = "";
|
|
1530
|
+
parent.appendChild(endMarker);
|
|
1531
|
+
} else {
|
|
1532
|
+
const range = document.createRange();
|
|
1533
|
+
range.setStartBefore(first);
|
|
1534
|
+
range.setEndBefore(endMarker);
|
|
1535
|
+
range.deleteContents();
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
function _lis(arr, len) {
|
|
1539
|
+
if (len === 0) return [];
|
|
1540
|
+
if (len === 1) return [0];
|
|
1541
|
+
const tails = new Int32Array(len);
|
|
1542
|
+
const predecessors = new Int32Array(len);
|
|
1543
|
+
let tailLen = 1;
|
|
1544
|
+
tails[0] = 0;
|
|
1545
|
+
predecessors[0] = -1;
|
|
1546
|
+
for (let i = 1; i < len; i++) {
|
|
1547
|
+
if (arr[i] > arr[tails[tailLen - 1]]) {
|
|
1548
|
+
predecessors[i] = tails[tailLen - 1];
|
|
1549
|
+
tails[tailLen++] = i;
|
|
1550
|
+
} else {
|
|
1551
|
+
let lo = 0, hi = tailLen - 1;
|
|
1552
|
+
while (lo < hi) {
|
|
1553
|
+
const mid = lo + hi >> 1;
|
|
1554
|
+
if (arr[tails[mid]] < arr[i]) lo = mid + 1;
|
|
1555
|
+
else hi = mid;
|
|
1556
|
+
}
|
|
1557
|
+
tails[lo] = i;
|
|
1558
|
+
predecessors[i] = lo > 0 ? tails[lo - 1] : -1;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
const result = new Array(tailLen);
|
|
1562
|
+
let k = tails[tailLen - 1];
|
|
1563
|
+
for (let i = tailLen - 1; i >= 0; i--) {
|
|
1564
|
+
result[i] = k;
|
|
1565
|
+
k = predecessors[k];
|
|
1566
|
+
}
|
|
1567
|
+
return result;
|
|
1568
|
+
}
|
|
1569
|
+
function renewItem(parent, endMarker, slot, index, item, mapFn, mappedNodes, disposeFns, follow) {
|
|
1570
|
+
if (!_setRowItem(disposeFns[slot]._item, item, follow)) return;
|
|
1571
|
+
const old = mappedNodes[slot];
|
|
1572
|
+
const oldDispose = disposeFns[slot];
|
|
1573
|
+
const cell = _rowItem(item);
|
|
1574
|
+
const node = _runScope(_itemScope(cell, disposeFns, slot), mapFn, cell, index, item, rowNode);
|
|
1575
|
+
rowBuilt(cell);
|
|
1576
|
+
disposeFns[slot]._item = cell;
|
|
1577
|
+
parent.insertBefore(markRow(node, endMarker, slot, mappedNodes), old);
|
|
1578
|
+
removeKeyedRow(parent, endMarker, old, oldDispose);
|
|
1579
|
+
}
|
|
1580
|
+
function reconcileKeyed(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedSignals) {
|
|
1581
|
+
const newLen = newItems.length;
|
|
1582
|
+
const oldLen = oldItems.length;
|
|
1583
|
+
if (newLen === 0) {
|
|
1584
|
+
if (oldLen > 0) {
|
|
1585
|
+
clearRows(parent, endMarker, mappedNodes, disposeFns, oldLen);
|
|
1586
|
+
mappedNodes.length = 0;
|
|
1587
|
+
disposeFns.length = 0;
|
|
1588
|
+
}
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
if (oldLen === 0) {
|
|
1592
|
+
for (let i = 0; i < newLen; i++) {
|
|
1593
|
+
parent.insertBefore(buildKeyedRow(endMarker, newItems[i], i, keyedSignals, mapFn, mappedNodes, disposeFns), endMarker);
|
|
1594
|
+
}
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
reconcileRows(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedSignals);
|
|
1598
|
+
}
|
|
1599
|
+
function reconcileRows(parent, endMarker, oldItems, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedSignals) {
|
|
1600
|
+
const newLen = newItems.length;
|
|
1601
|
+
const oldLen = oldItems.length;
|
|
1602
|
+
const oldKey = (i) => keyFn(oldItems[i], i);
|
|
1603
|
+
const newKey = (i) => keyFn(newItems[i], i);
|
|
1604
|
+
let start = 0;
|
|
1605
|
+
const minLen = Math.min(oldLen, newLen);
|
|
1606
|
+
while (start < minLen) {
|
|
1607
|
+
if (oldItems[start] !== newItems[start]) {
|
|
1608
|
+
if (oldKey(start) !== newKey(start)) break;
|
|
1609
|
+
if (keyedSignals) renewItem(parent, endMarker, start, start, newItems[start], mapFn, mappedNodes, disposeFns, keyedSignals === FOLLOW);
|
|
1610
|
+
}
|
|
1611
|
+
start++;
|
|
1612
|
+
}
|
|
1613
|
+
let oldEnd = oldLen - 1;
|
|
1614
|
+
let newEnd = newLen - 1;
|
|
1615
|
+
const moved = keyFn.length > 1 && oldEnd !== newEnd;
|
|
1616
|
+
while (oldEnd >= start && newEnd >= start) {
|
|
1617
|
+
if (moved || oldItems[oldEnd] !== newItems[newEnd]) {
|
|
1618
|
+
if (oldKey(oldEnd) !== newKey(newEnd)) break;
|
|
1619
|
+
if (keyedSignals) renewItem(parent, endMarker, oldEnd, newEnd, newItems[newEnd], mapFn, mappedNodes, disposeFns, keyedSignals === FOLLOW);
|
|
1620
|
+
}
|
|
1621
|
+
oldEnd--;
|
|
1622
|
+
newEnd--;
|
|
1623
|
+
}
|
|
1624
|
+
if (start > oldEnd && start > newEnd) return;
|
|
1625
|
+
const midNewLen = newEnd - start + 1;
|
|
1626
|
+
const midOldLen = oldEnd - start + 1;
|
|
1627
|
+
let drop = midNewLen ? 0 : midOldLen;
|
|
1628
|
+
if (!drop && newEnd === newLen - 1 && keyFn.length < 2) {
|
|
1629
|
+
let p = start;
|
|
1630
|
+
while (++p <= oldEnd && oldItems[p] !== newItems[start]) ;
|
|
1631
|
+
const added = start + oldEnd - p + 1;
|
|
1632
|
+
let i = p;
|
|
1633
|
+
while (i <= oldEnd && oldItems[i] === newItems[start + i - p]) i++;
|
|
1634
|
+
if (p <= oldEnd && i > oldEnd && added <= newEnd) {
|
|
1635
|
+
for (i = start; i < p && oldItems[i] !== newItems[added]; i++) ;
|
|
1636
|
+
if (i === p) {
|
|
1637
|
+
const dropped = /* @__PURE__ */ new Set();
|
|
1638
|
+
for (i = start; i < p; i++) dropped.add(oldKey(i));
|
|
1639
|
+
for (i = start; i <= newEnd && !dropped.has(newKey(i)); i++) ;
|
|
1640
|
+
if (i > newEnd) drop = p - start;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (drop) {
|
|
1645
|
+
for (let i = start; i < start + drop; i++) {
|
|
1646
|
+
removeKeyedRow(parent, endMarker, mappedNodes[i], disposeFns[i]);
|
|
1647
|
+
}
|
|
1648
|
+
mappedNodes.splice(start, drop);
|
|
1649
|
+
disposeFns.splice(start, drop);
|
|
1650
|
+
for (let i = start + midOldLen - drop; i <= newEnd; i++) {
|
|
1651
|
+
parent.insertBefore(buildKeyedRow(endMarker, newItems[i], i, keyedSignals, mapFn, mappedNodes, disposeFns), endMarker);
|
|
1652
|
+
}
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
const small = midNewLen === midOldLen && midNewLen >= 2;
|
|
1656
|
+
let mismatchCount = 0;
|
|
1657
|
+
let mm1 = -1, mm2 = -1;
|
|
1658
|
+
let replaced = false;
|
|
1659
|
+
if (small) {
|
|
1660
|
+
for (let i = 0; i < midNewLen && mismatchCount <= 4; i++) {
|
|
1661
|
+
const oldItem = oldItems[start + i];
|
|
1662
|
+
const newItem = newItems[start + i];
|
|
1663
|
+
if (oldItem === newItem) continue;
|
|
1664
|
+
if (oldKey(start + i) !== newKey(start + i)) {
|
|
1665
|
+
if (mismatchCount === 0) mm1 = i;
|
|
1666
|
+
else if (mismatchCount === 1) mm2 = i;
|
|
1667
|
+
mismatchCount++;
|
|
1668
|
+
} else {
|
|
1669
|
+
replaced = true;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
if (mismatchCount === 2) {
|
|
1674
|
+
const i1 = start + mm1, i2 = start + mm2;
|
|
1675
|
+
if (oldKey(i1) === newKey(i2) && oldKey(i2) === newKey(i1)) {
|
|
1676
|
+
const lo = Math.min(i1, i2), hi = Math.max(i1, i2);
|
|
1677
|
+
if (hi === lo + 1) {
|
|
1678
|
+
moveRow(parent, mappedNodes[hi], rowEnd(mappedNodes[hi], endMarker), mappedNodes[lo]);
|
|
1679
|
+
} else {
|
|
1680
|
+
const end2 = rowEnd(mappedNodes[i2], endMarker);
|
|
1681
|
+
const placeholder = document.createComment("tmp");
|
|
1682
|
+
parent.insertBefore(placeholder, mappedNodes[i2]);
|
|
1683
|
+
moveRow(parent, mappedNodes[i2], end2, mappedNodes[i1]);
|
|
1684
|
+
moveRow(parent, mappedNodes[i1], rowEnd(mappedNodes[i1], endMarker), placeholder);
|
|
1685
|
+
parent.removeChild(placeholder);
|
|
1686
|
+
}
|
|
1687
|
+
const tmpM = mappedNodes[i1];
|
|
1688
|
+
mappedNodes[i1] = mappedNodes[i2];
|
|
1689
|
+
mappedNodes[i2] = tmpM;
|
|
1690
|
+
const tmpD = disposeFns[i1];
|
|
1691
|
+
disposeFns[i1] = disposeFns[i2];
|
|
1692
|
+
disposeFns[i2] = tmpD;
|
|
1693
|
+
if (keyedSignals && (replaced || newItems[i1] !== oldItems[i2] || newItems[i2] !== oldItems[i1])) {
|
|
1694
|
+
for (let i = start; i <= newEnd; i++) {
|
|
1695
|
+
if (newItems[i] !== oldItems[i === i1 ? i2 : i === i2 ? i1 : i]) {
|
|
1696
|
+
renewItem(parent, endMarker, i, i, newItems[i], mapFn, mappedNodes, disposeFns, keyedSignals === FOLLOW);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
const newMapped = new Array(newLen);
|
|
1704
|
+
const newDispose = new Array(newLen);
|
|
1705
|
+
for (let i = 0; i < start; i++) {
|
|
1706
|
+
newMapped[i] = mappedNodes[i];
|
|
1707
|
+
newDispose[i] = disposeFns[i];
|
|
1708
|
+
}
|
|
1709
|
+
for (let i = newEnd + 1; i < newLen; i++) {
|
|
1710
|
+
const oldI = oldEnd + 1 + (i - newEnd - 1);
|
|
1711
|
+
newMapped[i] = mappedNodes[oldI];
|
|
1712
|
+
newDispose[i] = disposeFns[oldI];
|
|
1713
|
+
}
|
|
1714
|
+
if (midOldLen === 0) {
|
|
1715
|
+
const ref2 = newEnd + 1 < newLen && newMapped[newEnd + 1] ? newMapped[newEnd + 1] : endMarker;
|
|
1716
|
+
for (let i = start; i <= newEnd; i++) {
|
|
1717
|
+
parent.insertBefore(buildKeyedRow(endMarker, newItems[i], i, keyedSignals, mapFn, newMapped, newDispose), ref2);
|
|
1718
|
+
}
|
|
1719
|
+
_copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
if (small) {
|
|
1723
|
+
if (mismatchCount >= 2 && mismatchCount <= midNewLen) {
|
|
1724
|
+
const fromRel = mm1;
|
|
1725
|
+
let fromAbs = -1, toAbs = -1;
|
|
1726
|
+
let isMove = false;
|
|
1727
|
+
const candidateKey = oldKey(start + fromRel);
|
|
1728
|
+
let destRel = -1;
|
|
1729
|
+
for (let i = fromRel; i < midNewLen; i++) {
|
|
1730
|
+
if (newKey(start + i) === candidateKey) {
|
|
1731
|
+
destRel = i;
|
|
1732
|
+
break;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
if (destRel > fromRel) {
|
|
1736
|
+
let match = true;
|
|
1737
|
+
for (let i = fromRel; i < destRel; i++) {
|
|
1738
|
+
if (oldKey(start + i + 1) !== newKey(start + i)) {
|
|
1739
|
+
match = false;
|
|
1740
|
+
break;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
if (match) {
|
|
1744
|
+
let afterMatch = true;
|
|
1745
|
+
for (let i = destRel + 1; i < midNewLen; i++) {
|
|
1746
|
+
if (oldKey(start + i) !== newKey(start + i)) {
|
|
1747
|
+
afterMatch = false;
|
|
1748
|
+
break;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
if (afterMatch) {
|
|
1752
|
+
isMove = true;
|
|
1753
|
+
fromAbs = start + fromRel;
|
|
1754
|
+
toAbs = start + destRel;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
if (!isMove) {
|
|
1759
|
+
const candidateKey2 = newKey(start + fromRel);
|
|
1760
|
+
let srcRel = -1;
|
|
1761
|
+
for (let i = fromRel; i < midOldLen; i++) {
|
|
1762
|
+
if (oldKey(start + i) === candidateKey2) {
|
|
1763
|
+
srcRel = i;
|
|
1764
|
+
break;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (srcRel > fromRel) {
|
|
1768
|
+
let match = true;
|
|
1769
|
+
for (let i = fromRel; i < srcRel; i++) {
|
|
1770
|
+
if (oldKey(start + i) !== newKey(start + i + 1)) {
|
|
1771
|
+
match = false;
|
|
1772
|
+
break;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
if (match) {
|
|
1776
|
+
let afterMatch = true;
|
|
1777
|
+
for (let i = srcRel + 1; i < midNewLen; i++) {
|
|
1778
|
+
if (oldKey(start + i) !== newKey(start + i)) {
|
|
1779
|
+
afterMatch = false;
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
if (afterMatch) {
|
|
1784
|
+
isMove = true;
|
|
1785
|
+
fromAbs = start + srcRel;
|
|
1786
|
+
toAbs = start + fromRel;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
if (isMove) {
|
|
1792
|
+
for (let i = start; i <= oldEnd; i++) {
|
|
1793
|
+
newMapped[i] = mappedNodes[i];
|
|
1794
|
+
newDispose[i] = disposeFns[i];
|
|
1795
|
+
}
|
|
1796
|
+
const movedStart = newMapped[fromAbs];
|
|
1797
|
+
const movedDispose = newDispose[fromAbs];
|
|
1798
|
+
if (fromAbs < toAbs) {
|
|
1799
|
+
for (let i = fromAbs; i < toAbs; i++) {
|
|
1800
|
+
newMapped[i] = newMapped[i + 1];
|
|
1801
|
+
newDispose[i] = newDispose[i + 1];
|
|
1802
|
+
}
|
|
1803
|
+
} else {
|
|
1804
|
+
for (let i = fromAbs; i > toAbs; i--) {
|
|
1805
|
+
newMapped[i] = newMapped[i - 1];
|
|
1806
|
+
newDispose[i] = newDispose[i - 1];
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
newMapped[toAbs] = movedStart;
|
|
1810
|
+
newDispose[toAbs] = movedDispose;
|
|
1811
|
+
const movedEnd = rowEnd(movedStart, endMarker);
|
|
1812
|
+
let ref2 = toAbs + 1 < newLen ? newMapped[toAbs + 1] : endMarker;
|
|
1813
|
+
if (toAbs >= newEnd + 1 || ref2 && ref2.parentNode !== parent) ref2 = endMarker;
|
|
1814
|
+
moveRow(parent, movedStart, movedEnd, ref2);
|
|
1815
|
+
_copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);
|
|
1816
|
+
if (keyedSignals) {
|
|
1817
|
+
const lo = Math.min(fromAbs, toAbs), hi = Math.max(fromAbs, toAbs), shift = fromAbs < toAbs ? 1 : -1;
|
|
1818
|
+
for (let i = start; i <= newEnd; i++) {
|
|
1819
|
+
const was = i === toAbs ? fromAbs : i >= lo && i <= hi ? i + shift : i;
|
|
1820
|
+
if (newItems[i] !== oldItems[was]) {
|
|
1821
|
+
renewItem(parent, endMarker, i, i, newItems[i], mapFn, mappedNodes, disposeFns, keyedSignals === FOLLOW);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
const oldKeyMap = /* @__PURE__ */ new Map();
|
|
1830
|
+
for (let i = start; i <= oldEnd; i++) oldKeyMap.set(oldKey(i), i);
|
|
1831
|
+
let nextSameKey = null;
|
|
1832
|
+
if (oldKeyMap.size !== midOldLen) {
|
|
1833
|
+
nextSameKey = new Int32Array(midOldLen).fill(-1);
|
|
1834
|
+
oldKeyMap.clear();
|
|
1835
|
+
for (let i = oldEnd; i >= start; i--) {
|
|
1836
|
+
const key = oldKey(i);
|
|
1837
|
+
const later = oldKeyMap.get(key);
|
|
1838
|
+
if (later !== void 0) nextSameKey[i - start] = later;
|
|
1839
|
+
oldKeyMap.set(key, i);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
const oldIndices = new Int32Array(midNewLen);
|
|
1843
|
+
oldIndices.fill(-1);
|
|
1844
|
+
let reusedCount = 0;
|
|
1845
|
+
for (let i = start; i <= newEnd; i++) {
|
|
1846
|
+
const key = newKey(i);
|
|
1847
|
+
const oldIdx = oldKeyMap.get(key);
|
|
1848
|
+
if (oldIdx === void 0) continue;
|
|
1849
|
+
const next2 = nextSameKey === null ? -1 : nextSameKey[oldIdx - start];
|
|
1850
|
+
if (next2 === -1) oldKeyMap.delete(key);
|
|
1851
|
+
else oldKeyMap.set(key, next2);
|
|
1852
|
+
newMapped[i] = mappedNodes[oldIdx];
|
|
1853
|
+
newDispose[i] = disposeFns[oldIdx];
|
|
1854
|
+
oldIndices[i - start] = oldIdx;
|
|
1855
|
+
reusedCount++;
|
|
1856
|
+
if (keyedSignals && newItems[i] !== oldItems[oldIdx]) renewItem(parent, endMarker, i, i, newItems[i], mapFn, newMapped, newDispose, keyedSignals === FOLLOW);
|
|
1857
|
+
}
|
|
1858
|
+
if (reusedCount === 0 && start === 0 && oldEnd === oldLen - 1 && newEnd === newLen - 1) {
|
|
1859
|
+
clearRows(parent, endMarker, mappedNodes, disposeFns, oldLen);
|
|
1860
|
+
mappedNodes.length = 0;
|
|
1861
|
+
disposeFns.length = 0;
|
|
1862
|
+
for (let i = 0; i < newLen; i++) {
|
|
1863
|
+
parent.insertBefore(buildKeyedRow(endMarker, newItems[i], i, keyedSignals, mapFn, mappedNodes, disposeFns), endMarker);
|
|
1864
|
+
}
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
for (const oldIdx of oldKeyMap.values()) {
|
|
1868
|
+
for (let i = oldIdx; i !== -1; i = nextSameKey === null ? -1 : nextSameKey[i - start]) {
|
|
1869
|
+
removeKeyedRow(parent, endMarker, mappedNodes[i], disposeFns[i]);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
const created = new Array(midNewLen);
|
|
1873
|
+
for (let i = start; i <= newEnd; i++) {
|
|
1874
|
+
if (!newMapped[i]) {
|
|
1875
|
+
created[i - start] = buildKeyedRow(endMarker, newItems[i], i, keyedSignals, mapFn, newMapped, newDispose);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
let alreadySorted = true;
|
|
1879
|
+
let lastOldIdx = -1;
|
|
1880
|
+
for (let i = 0; i < midNewLen; i++) {
|
|
1881
|
+
if (oldIndices[i] !== -1) {
|
|
1882
|
+
if (oldIndices[i] <= lastOldIdx) alreadySorted = false;
|
|
1883
|
+
lastOldIdx = oldIndices[i];
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
const inLIS = new Uint8Array(midNewLen);
|
|
1887
|
+
if (alreadySorted) {
|
|
1888
|
+
for (let i = 0; i < midNewLen; i++) {
|
|
1889
|
+
if (oldIndices[i] !== -1) inLIS[i] = 1;
|
|
1890
|
+
}
|
|
1891
|
+
} else if (reusedCount > 1) {
|
|
1892
|
+
const seq = new Int32Array(reusedCount);
|
|
1893
|
+
const seqToMid = new Int32Array(reusedCount);
|
|
1894
|
+
let k = 0;
|
|
1895
|
+
for (let i = 0; i < midNewLen; i++) {
|
|
1896
|
+
if (oldIndices[i] !== -1) {
|
|
1897
|
+
seq[k] = oldIndices[i];
|
|
1898
|
+
seqToMid[k] = i;
|
|
1899
|
+
k++;
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
const lisResult = _lis(seq, reusedCount);
|
|
1903
|
+
for (let i = 0; i < lisResult.length; i++) {
|
|
1904
|
+
inLIS[seqToMid[lisResult[i]]] = 1;
|
|
1905
|
+
}
|
|
1906
|
+
} else if (reusedCount === 1) {
|
|
1907
|
+
for (let i = 0; i < midNewLen; i++) {
|
|
1908
|
+
if (oldIndices[i] !== -1) {
|
|
1909
|
+
inLIS[i] = 1;
|
|
1910
|
+
break;
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
_copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen);
|
|
1915
|
+
let ref = newEnd + 1 < newLen && mappedNodes[newEnd + 1] ? mappedNodes[newEnd + 1] : endMarker;
|
|
1916
|
+
for (let i = newEnd; i >= start; i--) {
|
|
1917
|
+
const mi = i - start;
|
|
1918
|
+
const rowStart2 = mappedNodes[i];
|
|
1919
|
+
if (oldIndices[mi] === -1) {
|
|
1920
|
+
parent.insertBefore(created[mi], ref);
|
|
1921
|
+
} else if (!inLIS[mi]) {
|
|
1922
|
+
moveRow(parent, rowStart2, rowEnd(rowStart2, endMarker), ref);
|
|
1923
|
+
}
|
|
1924
|
+
ref = rowStart2;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
function removeKeyedRow(parent, endMarker, start, dispose) {
|
|
1928
|
+
if (dispose !== void 0) dispose();
|
|
1929
|
+
removeRow(parent, start, rowEnd(start, endMarker));
|
|
1930
|
+
}
|
|
1931
|
+
function _copyBack(mappedNodes, disposeFns, newMapped, newDispose, newLen) {
|
|
1932
|
+
mappedNodes.length = newLen;
|
|
1933
|
+
disposeFns.length = newLen;
|
|
1934
|
+
for (let i = 0; i < newLen; i++) {
|
|
1935
|
+
mappedNodes[i] = newMapped[i];
|
|
1936
|
+
disposeFns[i] = newDispose[i];
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
function spread(el, props, after, options) {
|
|
1940
|
+
const live = props != null && _isOwnProps(props);
|
|
1941
|
+
const keys = Object.keys(Object(props));
|
|
1942
|
+
const last = {};
|
|
1943
|
+
for (const key of keys) last[_isEventProp(key) ? key.toLowerCase() : key] = key;
|
|
1944
|
+
for (const key of keys) {
|
|
1945
|
+
const event = _isEventProp(key);
|
|
1946
|
+
const name = event ? key.toLowerCase() : key;
|
|
1947
|
+
if (key === "children" || after?.includes(name) || last[name] !== key) continue;
|
|
1948
|
+
const get = live && key !== "ref" && /** @type {PropertyDescriptor} */
|
|
1949
|
+
Object.getOwnPropertyDescriptor(props, key).get;
|
|
1950
|
+
const value = get ? () => props[key] : props[key];
|
|
1951
|
+
if (fieldSpread && typeof value === "function" && (key === "value" || key === "checked")) fieldSpread(el, key, value);
|
|
1952
|
+
else if (event) {
|
|
1953
|
+
if (get) effect(() => listen(el, name, value(), options));
|
|
1954
|
+
else listen(el, name, value, options);
|
|
1955
|
+
} else retype(el, key, value);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
function retype(el, key, value) {
|
|
1959
|
+
if (typeof value === "function" && key !== "ref" && key !== "key" && key !== "classList") {
|
|
1960
|
+
if ((process.env.NODE_ENV !== "production")) setNextBinding(el, `${el.localName}.${key}`);
|
|
1961
|
+
return effect(() => retype(el, key, value()));
|
|
1962
|
+
}
|
|
1963
|
+
const was = el.type;
|
|
1964
|
+
setProp(el, key, value);
|
|
1965
|
+
if (el.type !== was) _showControlled(el);
|
|
1966
|
+
}
|
|
1967
|
+
function _$spreads(el, sources, after) {
|
|
1968
|
+
if (typeof sources !== "function") return spread(el, winners(sources, el), after);
|
|
1969
|
+
const owner = getOwner();
|
|
1970
|
+
const shown = /* @__PURE__ */ new Map();
|
|
1971
|
+
after = after?.map((key) => writerName(key, el));
|
|
1972
|
+
const bind = (name, src, key) => {
|
|
1973
|
+
const get = _isOwnProps(src) ? (
|
|
1974
|
+
/** @type {PropertyDescriptor} */
|
|
1975
|
+
Object.getOwnPropertyDescriptor(src, key).get
|
|
1976
|
+
) : void 0;
|
|
1977
|
+
const value = get ? void 0 : src[key];
|
|
1978
|
+
const was = shown.get(name);
|
|
1979
|
+
if (was !== void 0) {
|
|
1980
|
+
if (get ? was.get === get && was.src === src : !was.get && was.key === key && Object.is(was.value, value)) return;
|
|
1981
|
+
if (was.field !== null && !get && was.key === key && typeof value !== "function") {
|
|
1982
|
+
was.field(was.value = value);
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
was.dispose();
|
|
1986
|
+
}
|
|
1987
|
+
const field = !get && (key === "value" || key === "checked") && typeof value !== "function" ? signal(value) : null;
|
|
1988
|
+
const dispose = untrack(() => runWithOwner(owner, () => createRoot((dispose2) => {
|
|
1989
|
+
const one = /* @__PURE__ */ Object.create(null);
|
|
1990
|
+
if (get) Object.defineProperty(one, key, { get: () => get.call(src), enumerable: true });
|
|
1991
|
+
else if (field !== null) Object.defineProperty(one, key, { get: field, enumerable: true });
|
|
1992
|
+
else one[key] = value;
|
|
1993
|
+
spread(el, one);
|
|
1994
|
+
if (key === "ref") {
|
|
1995
|
+
const ref = get ? one.ref : value;
|
|
1996
|
+
onCleanup(() => applyRef(ref, null));
|
|
1997
|
+
}
|
|
1998
|
+
return dispose2;
|
|
1999
|
+
})));
|
|
2000
|
+
shown.set(name, { key, src, get, value, field, dispose });
|
|
2001
|
+
};
|
|
2002
|
+
effect(() => {
|
|
2003
|
+
const next2 = writers(sources(), el);
|
|
2004
|
+
for (const [name, was] of shown) {
|
|
2005
|
+
if (next2.has(name)) continue;
|
|
2006
|
+
was.dispose();
|
|
2007
|
+
shown.delete(name);
|
|
2008
|
+
if (!_isEventProp(name)) retype(el, name === "innerhtml" ? "dangerouslySetInnerHTML" : was.key, void 0);
|
|
2009
|
+
}
|
|
2010
|
+
for (const [name, [src, key]] of next2) {
|
|
2011
|
+
if (name !== "children" && name !== "value" && name !== "checked" && !after?.includes(name)) bind(name, src, key);
|
|
2012
|
+
}
|
|
2013
|
+
for (const name of ["value", "checked"]) {
|
|
2014
|
+
const w = next2.get(name);
|
|
2015
|
+
if (w !== void 0 && !after?.includes(name)) bind(name, w[0], w[1]);
|
|
2016
|
+
}
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
function winners(sources, el) {
|
|
2020
|
+
const out = /* @__PURE__ */ Object.create(null);
|
|
2021
|
+
for (const [src, key] of writers(sources, el).values()) _copyProp(out, src, key, _isOwnProps(src));
|
|
2022
|
+
return out;
|
|
2023
|
+
}
|
|
2024
|
+
function writers(sources, el) {
|
|
2025
|
+
const names = /* @__PURE__ */ new Map();
|
|
2026
|
+
for (let src of sources) {
|
|
2027
|
+
src = Object(src);
|
|
2028
|
+
for (const key of Object.keys(src)) names.set(writerName(key, el), [src, key]);
|
|
2029
|
+
}
|
|
2030
|
+
return names;
|
|
2031
|
+
}
|
|
2032
|
+
function writerName(key, el) {
|
|
2033
|
+
const name = key.toLowerCase();
|
|
2034
|
+
const html = el.namespaceURI === NAMESPACES[0];
|
|
2035
|
+
const xml = XML_NAME.exec(html ? name : key);
|
|
2036
|
+
return xml ? xml[1] + ":" + xml[2].toLowerCase() : name === "classname" ? "class" : name === "htmlfor" ? "for" : name === "dangerouslysetinnerhtml" ? "innerhtml" : html || _isEventProp(key) ? name : key;
|
|
2037
|
+
}
|
|
2038
|
+
var XML_NAME = /^(xlink|xml(?!ns)):?(.+)/;
|
|
2039
|
+
function listen(el, name, handler, options) {
|
|
2040
|
+
if (typeof handler !== "function") return;
|
|
2041
|
+
name = name.slice(2);
|
|
2042
|
+
if (name === "doubleclick") name = "dblclick";
|
|
2043
|
+
if (name === "change") {
|
|
2044
|
+
const change = handler;
|
|
2045
|
+
on(el, "input", handler = (e) => _onChange(e, change), options);
|
|
2046
|
+
}
|
|
2047
|
+
on(el, name, handler, options);
|
|
2048
|
+
}
|
|
2049
|
+
var xlink = null;
|
|
2050
|
+
function _$xlink() {
|
|
2051
|
+
xlink = (el, key, value) => {
|
|
2052
|
+
const name = XML_NAME.exec(key);
|
|
2053
|
+
if (name === null) return false;
|
|
2054
|
+
const [, prefix, local] = name;
|
|
2055
|
+
const ns = prefix === "xml" ? "http://www.w3.org/XML/1998/namespace" : "http://www.w3.org/1999/xlink";
|
|
2056
|
+
if (value == null || value === false) el.removeAttributeNS(ns, local.toLowerCase());
|
|
2057
|
+
else el.setAttributeNS(ns, prefix + ":" + local.toLowerCase(), value);
|
|
2058
|
+
return true;
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
function setProp(el, key, value) {
|
|
2062
|
+
if (key === "ref") {
|
|
2063
|
+
applyRef(value, el);
|
|
2064
|
+
return;
|
|
2065
|
+
}
|
|
2066
|
+
if (key === "key" || key === "__proto__" || _isEventProp(key)) return;
|
|
2067
|
+
if (key === "classList") {
|
|
2068
|
+
setClassList(el, value);
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
if (typeof value === "function") {
|
|
2072
|
+
if ((process.env.NODE_ENV !== "production")) setNextBinding(el, `${el.localName}.${key}`);
|
|
2073
|
+
effect(() => setProp(el, key, value()));
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
if (_isUnsafeAttr(key, value)) {
|
|
2077
|
+
el.removeAttribute(key);
|
|
2078
|
+
if (typeof console !== "undefined") {
|
|
2079
|
+
console.warn(`[what] Blocked unsafe URL in "${key}" attribute:`, value);
|
|
2080
|
+
}
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
const isSvg = _hasSVGElement && el instanceof SVGElement;
|
|
2084
|
+
if (isSvg && xlink?.(el, key, value)) return;
|
|
2085
|
+
if (key === "class" || key === "className") {
|
|
2086
|
+
_writeClass(el, value, isSvg);
|
|
2087
|
+
} else if (key === "dangerouslySetInnerHTML" || key === "innerHTML") {
|
|
2088
|
+
if (key === "dangerouslySetInnerHTML" || value && typeof value === "object" && "__html" in value) {
|
|
2089
|
+
const html = value?.__html ?? "";
|
|
2090
|
+
if (typeof (process.env.NODE_ENV !== "production") !== "undefined" && (process.env.NODE_ENV !== "production") && typeof html === "string" && /(<script|onerror\s*=|onload\s*=|javascript:)/i.test(html)) {
|
|
2091
|
+
console.warn("[what] dangerouslySetInnerHTML contains potential XSS vectors. Ensure content is sanitized.");
|
|
2092
|
+
}
|
|
2093
|
+
el.innerHTML = html;
|
|
2094
|
+
} else if ((process.env.NODE_ENV !== "production") && value != null && value !== "") {
|
|
2095
|
+
report("ERR_UNSAFE_INNERHTML", { subject: { kind: "element", name: el.localName } });
|
|
2096
|
+
}
|
|
2097
|
+
} else if (key === "style") {
|
|
2098
|
+
setStyle(el, value);
|
|
2099
|
+
} else if (_setFieldProp(el, key, value)) {
|
|
2100
|
+
} else if (value == null) {
|
|
2101
|
+
if (_writableProp(el, key)) {
|
|
2102
|
+
try {
|
|
2103
|
+
el[key] = "";
|
|
2104
|
+
} catch {
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
el.removeAttribute(key);
|
|
2108
|
+
} else if (isEnumeratedAttr(key)) {
|
|
2109
|
+
el.setAttribute(key, value);
|
|
2110
|
+
} else if (typeof value === "boolean") {
|
|
2111
|
+
if (value) el.setAttribute(key, "");
|
|
2112
|
+
else el.removeAttribute(key);
|
|
2113
|
+
} else if (isSvg) {
|
|
2114
|
+
el.setAttribute(key, value);
|
|
2115
|
+
} else if (_writableProp(el, key)) {
|
|
2116
|
+
el[key] = value;
|
|
2117
|
+
} else {
|
|
2118
|
+
el.setAttribute(key, value);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
function _wrapPropAccessor(el, accessor, apply) {
|
|
2122
|
+
if ((process.env.NODE_ENV !== "production")) setNextBinding(el, `${el.localName}.${apply.name}`);
|
|
2123
|
+
effect(() => apply(el, accessor(), 1));
|
|
2124
|
+
}
|
|
2125
|
+
function className(el, value) {
|
|
2126
|
+
if (typeof value === "function") return _wrapPropAccessor(el, value, className);
|
|
2127
|
+
_writeClass(el, value, false);
|
|
2128
|
+
}
|
|
2129
|
+
function setClass(el, value) {
|
|
2130
|
+
if (typeof value === "function") return _wrapPropAccessor(el, value, setClass);
|
|
2131
|
+
_writeClass(el, value, _hasSVGElement && el instanceof SVGElement);
|
|
2132
|
+
}
|
|
2133
|
+
function _writeClass(el, value, svg) {
|
|
2134
|
+
const cl = el._cl;
|
|
2135
|
+
if (value == null || value === false) {
|
|
2136
|
+
if (cl == null) {
|
|
2137
|
+
el.removeAttribute("class");
|
|
2138
|
+
el._cl = null;
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
value = "";
|
|
2142
|
+
}
|
|
2143
|
+
const cls = String(value);
|
|
2144
|
+
if (svg) el.setAttribute("class", cls);
|
|
2145
|
+
else el.className = cls;
|
|
2146
|
+
if (cl == null) return;
|
|
2147
|
+
cl.base = cls;
|
|
2148
|
+
if (!cl.overClass) {
|
|
2149
|
+
cl.replaced = true;
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
const list = el.classList;
|
|
2153
|
+
for (const key in cl.on) toggleClasses(list, key, cl.on[key]);
|
|
2154
|
+
}
|
|
2155
|
+
function setClassList(el, value) {
|
|
2156
|
+
if (typeof value === "function") return _wrapPropAccessor(el, value, applyClassList);
|
|
2157
|
+
if (value == null) {
|
|
2158
|
+
if (el._cl != null) applyClassList(el, value);
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
if (hasAccessorEntry(value)) return _wrapPropAccessor(el, () => value, applyClassList);
|
|
2162
|
+
applyClassList(el, value);
|
|
2163
|
+
}
|
|
2164
|
+
function hasAccessorEntry(value) {
|
|
2165
|
+
for (const key in value) {
|
|
2166
|
+
if (typeof value[key] === "function") return true;
|
|
2167
|
+
}
|
|
2168
|
+
return false;
|
|
2169
|
+
}
|
|
2170
|
+
function applyClassList(el, value) {
|
|
2171
|
+
let cl = el._cl;
|
|
2172
|
+
if (cl == null) {
|
|
2173
|
+
if (cl === null) el.setAttribute("class", "");
|
|
2174
|
+
const base = el.getAttribute("class");
|
|
2175
|
+
el._cl = cl = { on: null, base, overClass: base !== null, replaced: false };
|
|
2176
|
+
}
|
|
2177
|
+
const prev = cl.on;
|
|
2178
|
+
const next2 = {};
|
|
2179
|
+
if (value != null) {
|
|
2180
|
+
for (const key in value) {
|
|
2181
|
+
const on2 = value[key];
|
|
2182
|
+
next2[key] = !!(typeof on2 === "function" ? on2() : on2);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
cl.on = next2;
|
|
2186
|
+
if (cl.replaced) return;
|
|
2187
|
+
const list = el.classList;
|
|
2188
|
+
if (prev !== null) {
|
|
2189
|
+
for (const key in prev) {
|
|
2190
|
+
if (!(key in next2)) restoreClasses(list, key, cl.base);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
for (const key in next2) toggleClasses(list, key, next2[key]);
|
|
2194
|
+
}
|
|
2195
|
+
function toggleClasses(list, key, on2) {
|
|
2196
|
+
if (!/\s/.test(key)) {
|
|
2197
|
+
if (key) list.toggle(key, on2);
|
|
2198
|
+
return;
|
|
2199
|
+
}
|
|
2200
|
+
for (const name of key.split(/\s+/)) {
|
|
2201
|
+
if (name) list.toggle(name, on2);
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
function restoreClasses(list, key, base) {
|
|
2205
|
+
const tokens = base ? base.split(/[\t\n\f\r ]+/) : [];
|
|
2206
|
+
for (const name of key.split(/\s+/)) {
|
|
2207
|
+
if (name) list.toggle(name, tokens.includes(name));
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
function applyRef(ref, el) {
|
|
2211
|
+
if (typeof ref === "function") ref(el);
|
|
2212
|
+
else if (ref !== null && typeof ref === "object" && ref.nodeType === void 0) ref.current = el;
|
|
2213
|
+
else return el;
|
|
2214
|
+
return ref;
|
|
2215
|
+
}
|
|
2216
|
+
function setStyle(el, value) {
|
|
2217
|
+
if (typeof value === "function") return _wrapPropAccessor(el, value, setStyle);
|
|
2218
|
+
const prev = el._lastStyleObj;
|
|
2219
|
+
if (value !== null && typeof value === "object") {
|
|
2220
|
+
const style = el.style;
|
|
2221
|
+
if (prev != null) {
|
|
2222
|
+
for (const prop in prev) if (!(prop in value)) writeStyle(style, prop, "");
|
|
2223
|
+
} else if (el.hasAttribute("style")) {
|
|
2224
|
+
el.removeAttribute("style");
|
|
2225
|
+
}
|
|
2226
|
+
for (const prop in value) writeStyle(style, prop, value[prop] ?? "");
|
|
2227
|
+
el._lastStyleObj = { ...value };
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
el._lastStyleObj = null;
|
|
2231
|
+
if (typeof value === "string") el.style.cssText = value;
|
|
2232
|
+
else if (el.hasAttribute("style")) el.removeAttribute("style");
|
|
2233
|
+
}
|
|
2234
|
+
function writeStyle(style, prop, value) {
|
|
2235
|
+
if (prop[0] === "-") style.setProperty(prop, value);
|
|
2236
|
+
else style[prop] = value;
|
|
2237
|
+
}
|
|
2238
|
+
function setAttr(el, name, value) {
|
|
2239
|
+
if (typeof value === "function") {
|
|
2240
|
+
return _wrapPropAccessor(el, value, (e2, v) => setAttr(e2, name, v));
|
|
2241
|
+
}
|
|
2242
|
+
if (value == null) el.removeAttribute(name);
|
|
2243
|
+
else el.setAttribute(name, value);
|
|
2244
|
+
}
|
|
2245
|
+
function setValue(el, value, bound) {
|
|
2246
|
+
if (typeof value === "function") return _wrapPropAccessor(el, value, setValue);
|
|
2247
|
+
if (bound === 1) _controlFields(el);
|
|
2248
|
+
if (!_setFieldProp(el, "value", value)) setProp(el, "value", value);
|
|
2249
|
+
}
|
|
2250
|
+
function setChecked(el, value, bound) {
|
|
2251
|
+
if (typeof value === "function") return _wrapPropAccessor(el, value, setChecked);
|
|
2252
|
+
if (bound === 1) _controlFields(el);
|
|
2253
|
+
if (!_setFieldProp(el, "checked", value)) setProp(el, "checked", value);
|
|
2254
|
+
}
|
|
2255
|
+
function handSpread(el, props) {
|
|
2256
|
+
_selectsFor(el);
|
|
2257
|
+
spread(el, props);
|
|
2258
|
+
}
|
|
2259
|
+
function handSetProp(el, key, value) {
|
|
2260
|
+
_selectsFor(el);
|
|
2261
|
+
setProp(el, key, value);
|
|
2262
|
+
}
|
|
2263
|
+
function handSetValue(el, value, bound) {
|
|
2264
|
+
_selectsFor(el);
|
|
2265
|
+
setValue(el, value, bound);
|
|
2266
|
+
}
|
|
2267
|
+
var fieldSpread = null;
|
|
2268
|
+
function _$controlled(el) {
|
|
2269
|
+
fieldSpread = (field, key, accessor) => (key === "value" ? setValue : setChecked)(field, accessor);
|
|
2270
|
+
return el;
|
|
2271
|
+
}
|
|
2272
|
+
var DELEGATION = /* @__PURE__ */ Symbol.for("what-core.delegation.v1");
|
|
2273
|
+
var delegatedRoots = null;
|
|
2274
|
+
function delegateEvents(eventNames, root = document) {
|
|
2275
|
+
const global = globalThis;
|
|
2276
|
+
const roots = delegatedRoots ??= (process.env.NODE_ENV !== "production") ? devSharedRoots(global) : global[DELEGATION] ??= /* @__PURE__ */ new WeakMap();
|
|
2277
|
+
let names = roots.get(root);
|
|
2278
|
+
if (names === void 0) roots.set(root, names = /* @__PURE__ */ new Map());
|
|
2279
|
+
for (const name of eventNames) {
|
|
2280
|
+
if (names.has(name)) continue;
|
|
2281
|
+
names.set(name, dispatchDelegated);
|
|
2282
|
+
root.addEventListener(name, dispatchDelegated);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
function devSharedRoots(global) {
|
|
2286
|
+
const shared = Object.getOwnPropertyDescriptor(global, DELEGATION);
|
|
2287
|
+
if (shared !== void 0) report("ERR_SECOND_CORE_COPY");
|
|
2288
|
+
if (shared !== void 0 && shared.get !== void 0) return (
|
|
2289
|
+
/** @type {any} */
|
|
2290
|
+
shared.get.roots
|
|
2291
|
+
);
|
|
2292
|
+
const roots = shared === void 0 ? /* @__PURE__ */ new WeakMap() : shared.value;
|
|
2293
|
+
const get = () => {
|
|
2294
|
+
report("ERR_SECOND_CORE_COPY");
|
|
2295
|
+
return roots;
|
|
2296
|
+
};
|
|
2297
|
+
get.roots = roots;
|
|
2298
|
+
Object.defineProperty(global, DELEGATION, { configurable: true, get });
|
|
2299
|
+
return roots;
|
|
2300
|
+
}
|
|
2301
|
+
function _$changes(root = document) {
|
|
2302
|
+
delegateEvents(["input"], root);
|
|
2303
|
+
const names = (
|
|
2304
|
+
/** @type {any} */
|
|
2305
|
+
delegatedRoots.get(root)
|
|
2306
|
+
);
|
|
2307
|
+
if (names.has("onchange")) return;
|
|
2308
|
+
root.removeEventListener("change", names.get("change"));
|
|
2309
|
+
names.set("onchange").set("change", dispatchChange);
|
|
2310
|
+
root.addEventListener("input", dispatchChange);
|
|
2311
|
+
root.addEventListener("change", dispatchChange);
|
|
2312
|
+
}
|
|
2313
|
+
function dispatchChange(e) {
|
|
2314
|
+
dispatchDelegated.call(this, e, "$$change", _onChange);
|
|
2315
|
+
}
|
|
2316
|
+
function dispatchDelegated(e, key = "$$" + e.type, call) {
|
|
2317
|
+
const root = this;
|
|
2318
|
+
const name = key.slice(2);
|
|
2319
|
+
const path = e.composedPath();
|
|
2320
|
+
const roots = (
|
|
2321
|
+
/** @type {NonNullable<typeof delegatedRoots>} */
|
|
2322
|
+
delegatedRoots
|
|
2323
|
+
);
|
|
2324
|
+
let first = 0;
|
|
2325
|
+
let last = 0;
|
|
2326
|
+
for (; last < path.length && path[last] !== root; last++) {
|
|
2327
|
+
const names = roots.get(path[last]);
|
|
2328
|
+
if (names !== void 0 && names.has(name)) first = last + 1;
|
|
2329
|
+
}
|
|
2330
|
+
let node = null;
|
|
2331
|
+
Object.defineProperty(e, "currentTarget", {
|
|
2332
|
+
configurable: true,
|
|
2333
|
+
get() {
|
|
2334
|
+
return node || root;
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
let target = path[0];
|
|
2338
|
+
let retargeted = false;
|
|
2339
|
+
const stopped = e.cancelBubble;
|
|
2340
|
+
try {
|
|
2341
|
+
for (let i = 0; i <= last && i < path.length; i++) {
|
|
2342
|
+
const n = path[i];
|
|
2343
|
+
if (n.nodeType === 11 && n.host) {
|
|
2344
|
+
if (target.getRootNode() === n) target = n.host;
|
|
2345
|
+
continue;
|
|
2346
|
+
}
|
|
2347
|
+
if (i < first) continue;
|
|
2348
|
+
const handler = n[key];
|
|
2349
|
+
if (typeof handler !== "function" || n.disabled === true) continue;
|
|
2350
|
+
const owner = n.$$owner;
|
|
2351
|
+
if (owner != null && _isDisposed(owner)) {
|
|
2352
|
+
n[key] = void 0;
|
|
2353
|
+
continue;
|
|
2354
|
+
}
|
|
2355
|
+
node = n;
|
|
2356
|
+
if (target !== e.target) {
|
|
2357
|
+
Object.defineProperty(e, "target", { configurable: true, value: target });
|
|
2358
|
+
retargeted = true;
|
|
2359
|
+
}
|
|
2360
|
+
if (call) call(e, handler);
|
|
2361
|
+
else handler(e);
|
|
2362
|
+
if (e.cancelBubble && !stopped) break;
|
|
2363
|
+
}
|
|
2364
|
+
} finally {
|
|
2365
|
+
delete e.currentTarget;
|
|
2366
|
+
if (retargeted) delete e.target;
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
function _delegatedWalk(e, container, change) {
|
|
2370
|
+
const roots = delegatedRoots;
|
|
2371
|
+
if (roots === null) return null;
|
|
2372
|
+
const name = change ? "change" : e.type;
|
|
2373
|
+
const path = e.composedPath();
|
|
2374
|
+
const at = path.indexOf(container);
|
|
2375
|
+
let listener = null;
|
|
2376
|
+
for (let i = at + 1; at >= 0 && i < path.length && listener === null; i++) {
|
|
2377
|
+
const names = roots.get(path[i]);
|
|
2378
|
+
if (names === void 0) continue;
|
|
2379
|
+
const onchange = names.has("onchange");
|
|
2380
|
+
if (change ? onchange && (e.type === "input" || e.type === "change") : !(name === "change" && onchange)) listener = names.get(name) ?? null;
|
|
2381
|
+
}
|
|
2382
|
+
if (listener === null || roots.get(container)?.get(name)) return null;
|
|
2383
|
+
const delegates = (node) => {
|
|
2384
|
+
let names = roots.get(node);
|
|
2385
|
+
if (names === void 0) roots.set(node, names = /* @__PURE__ */ new Map());
|
|
2386
|
+
if (names.has(name)) return false;
|
|
2387
|
+
names.set(name, null);
|
|
2388
|
+
return true;
|
|
2389
|
+
};
|
|
2390
|
+
delegates(container);
|
|
2391
|
+
const begun = e.cancelBubble;
|
|
2392
|
+
let next2 = 0;
|
|
2393
|
+
return (node) => {
|
|
2394
|
+
const end = node === null ? at : path.indexOf(node, next2);
|
|
2395
|
+
if (end < next2 || !begun && e.cancelBubble) return false;
|
|
2396
|
+
const last = node === null ? end : end - 1;
|
|
2397
|
+
const stopped = e.cancelBubble;
|
|
2398
|
+
if (last >= next2 && (node === null || !roots.get(path[last])?.has(name))) {
|
|
2399
|
+
const before = next2 > 0 ? path[next2 - 1] : null;
|
|
2400
|
+
const marked = before !== null && delegates(before);
|
|
2401
|
+
try {
|
|
2402
|
+
listener.call(path[last], e);
|
|
2403
|
+
} finally {
|
|
2404
|
+
if (marked) roots.get(
|
|
2405
|
+
/** @type {EventTarget} */
|
|
2406
|
+
before
|
|
2407
|
+
).delete(name);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
next2 = end + 1;
|
|
2411
|
+
return !stopped && e.cancelBubble;
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
function _$own(el) {
|
|
2415
|
+
el.$$owner = getOwner();
|
|
2416
|
+
}
|
|
2417
|
+
function on(el, event, handler, options) {
|
|
2418
|
+
el.addEventListener(event, handler, options);
|
|
2419
|
+
const off = () => el.removeEventListener(event, handler, options);
|
|
2420
|
+
onCleanup(off);
|
|
2421
|
+
return off;
|
|
2422
|
+
}
|
|
2423
|
+
function classList(el, classes) {
|
|
2424
|
+
setClassList(el, classes);
|
|
2425
|
+
}
|
|
2426
|
+
var REGION_OPEN = "$";
|
|
2427
|
+
var REGION_CLOSE = "/$";
|
|
2428
|
+
var ARRAY_OPEN = "[]";
|
|
2429
|
+
var ARRAY_CLOSE = "/[]";
|
|
2430
|
+
var BOUNDARY_OPEN = "b";
|
|
2431
|
+
var BOUNDARY_FALLBACK = "b!";
|
|
2432
|
+
var BOUNDARY_CLOSE = "/b";
|
|
2433
|
+
var TRANSPARENT = /* @__PURE__ */ new Set([REGION_OPEN, REGION_CLOSE, ARRAY_OPEN, ARRAY_CLOSE]);
|
|
2434
|
+
function transparent(data) {
|
|
2435
|
+
return TRANSPARENT.has(data) || isRowKeys(data);
|
|
2436
|
+
}
|
|
2437
|
+
function isRowKeys(data) {
|
|
2438
|
+
return data.startsWith("k:") || data === "k!";
|
|
2439
|
+
}
|
|
2440
|
+
var DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_.";
|
|
2441
|
+
var DIGEST_LENGTH = 11;
|
|
2442
|
+
function _rowKeyDigest(key, salt) {
|
|
2443
|
+
if (typeof key !== "string" && !(typeof key === "number" && Number.isFinite(key))) return null;
|
|
2444
|
+
SIP.set(SIP_START);
|
|
2445
|
+
sipWords(salt + (typeof key === "string" ? "s" : "n") + key, 0, true);
|
|
2446
|
+
return digits(sipHi, sipLo);
|
|
2447
|
+
}
|
|
2448
|
+
var SIP_START = /* @__PURE__ */ new Int32Array([0, 238, 1819895653, 1952801890]);
|
|
2449
|
+
var SIP = /* @__PURE__ */ new Int32Array(4);
|
|
2450
|
+
var sipHi = 0;
|
|
2451
|
+
var sipLo = 0;
|
|
2452
|
+
function sipRounds(n) {
|
|
2453
|
+
let v0 = SIP[0], v1 = SIP[1], v2 = SIP[2], v3 = SIP[3];
|
|
2454
|
+
for (let r = 0; r < n; r++) {
|
|
2455
|
+
v0 = v0 + v1 | 0;
|
|
2456
|
+
v1 = v1 << 5 | v1 >>> 27;
|
|
2457
|
+
v1 ^= v0;
|
|
2458
|
+
v0 = v0 << 16 | v0 >>> 16;
|
|
2459
|
+
v2 = v2 + v3 | 0;
|
|
2460
|
+
v3 = v3 << 8 | v3 >>> 24;
|
|
2461
|
+
v3 ^= v2;
|
|
2462
|
+
v0 = v0 + v3 | 0;
|
|
2463
|
+
v3 = v3 << 7 | v3 >>> 25;
|
|
2464
|
+
v3 ^= v0;
|
|
2465
|
+
v2 = v2 + v1 | 0;
|
|
2466
|
+
v1 = v1 << 13 | v1 >>> 19;
|
|
2467
|
+
v1 ^= v2;
|
|
2468
|
+
v2 = v2 << 16 | v2 >>> 16;
|
|
2469
|
+
}
|
|
2470
|
+
SIP[0] = v0;
|
|
2471
|
+
SIP[1] = v1;
|
|
2472
|
+
SIP[2] = v2;
|
|
2473
|
+
SIP[3] = v3;
|
|
2474
|
+
}
|
|
2475
|
+
function sipWord(m) {
|
|
2476
|
+
SIP[3] ^= m;
|
|
2477
|
+
sipRounds(2);
|
|
2478
|
+
SIP[0] ^= m;
|
|
2479
|
+
}
|
|
2480
|
+
function sipWords(text, lead, finish2) {
|
|
2481
|
+
const length = text.length;
|
|
2482
|
+
const end = length & ~1;
|
|
2483
|
+
for (let i = 0; i < end; i += 2) sipWord(text.charCodeAt(i) | text.charCodeAt(i + 1) << 16);
|
|
2484
|
+
if (!finish2) return;
|
|
2485
|
+
sipWord(lead + length << 16 | (end < length ? text.charCodeAt(end) : 0));
|
|
2486
|
+
SIP[2] ^= 238;
|
|
2487
|
+
sipRounds(4);
|
|
2488
|
+
sipHi = SIP[1] ^ SIP[3];
|
|
2489
|
+
SIP[1] ^= 221;
|
|
2490
|
+
sipRounds(4);
|
|
2491
|
+
sipLo = SIP[1] ^ SIP[3];
|
|
2492
|
+
}
|
|
2493
|
+
function sipPrefix(text) {
|
|
2494
|
+
SIP.set(SIP_START);
|
|
2495
|
+
sipWords(text, 0, false);
|
|
2496
|
+
return SIP.slice();
|
|
2497
|
+
}
|
|
2498
|
+
function _rowKeysInOrder(keys, salt, written) {
|
|
2499
|
+
const count = keys.length;
|
|
2500
|
+
if (salt.length !== DIGEST_LENGTH || written.length !== count * DIGEST_LENGTH) return false;
|
|
2501
|
+
const lead = DIGEST_LENGTH + 1;
|
|
2502
|
+
let strings = null;
|
|
2503
|
+
let numbers = null;
|
|
2504
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2505
|
+
for (let i = 0; i < count; i++) {
|
|
2506
|
+
const key = keys[i];
|
|
2507
|
+
let state;
|
|
2508
|
+
if (typeof key === "string") state = strings ??= sipPrefix(salt + "s");
|
|
2509
|
+
else if (typeof key === "number" && Number.isFinite(key)) state = numbers ??= sipPrefix(salt + "n");
|
|
2510
|
+
else return false;
|
|
2511
|
+
SIP.set(state);
|
|
2512
|
+
sipWords("" + key, lead, true);
|
|
2513
|
+
const at = i * DIGEST_LENGTH;
|
|
2514
|
+
if (!digitsOf(written, at, sipHi >>> 8, 4) || !digitsOf(written, at + 4, (sipHi & 255) << 16 | sipLo >>> 16, 4) || !digitsOf(written, at + 8, sipLo & 65535, 3) || seen.has(sipHi)) return false;
|
|
2515
|
+
seen.add(sipHi);
|
|
2516
|
+
}
|
|
2517
|
+
return true;
|
|
2518
|
+
}
|
|
2519
|
+
function digitsOf(text, at, n, count) {
|
|
2520
|
+
for (let i = count - 1; i >= 0; i--, n >>>= 6) if (text.charCodeAt(at + i) !== DIGITS.charCodeAt(n & 63)) return false;
|
|
2521
|
+
return true;
|
|
2522
|
+
}
|
|
2523
|
+
function _rowKeySalt() {
|
|
2524
|
+
return digits(randomWord(), randomWord());
|
|
2525
|
+
}
|
|
2526
|
+
var randomWords = null;
|
|
2527
|
+
var randomAt = 0;
|
|
2528
|
+
function randomWord() {
|
|
2529
|
+
const words = randomWords ??= new Uint32Array(64);
|
|
2530
|
+
if (randomAt === 0) crypto.getRandomValues(words);
|
|
2531
|
+
const word = words[randomAt];
|
|
2532
|
+
randomAt = (randomAt + 1) % words.length;
|
|
2533
|
+
return word;
|
|
2534
|
+
}
|
|
2535
|
+
function digits(hi, lo) {
|
|
2536
|
+
const put = (n, count) => {
|
|
2537
|
+
let out = "";
|
|
2538
|
+
for (let i = 0; i < count; i++, n >>>= 6) out = DIGITS[n & 63] + out;
|
|
2539
|
+
return out;
|
|
2540
|
+
};
|
|
2541
|
+
return put(hi >>> 8, 4) + put((hi & 255) << 16 | lo >>> 16, 4) + put(lo & 65535, 3);
|
|
2542
|
+
}
|
|
2543
|
+
var cur = null;
|
|
2544
|
+
var outer = [];
|
|
2545
|
+
var session = null;
|
|
2546
|
+
function newSession(container, onError, ownerRoot) {
|
|
2547
|
+
_setOutsideRead(_$outside);
|
|
2548
|
+
return {
|
|
2549
|
+
root: container,
|
|
2550
|
+
onError,
|
|
2551
|
+
reported: /* @__PURE__ */ new WeakSet(),
|
|
2552
|
+
prebuilt: /* @__PURE__ */ new WeakSet(),
|
|
2553
|
+
built: /* @__PURE__ */ new WeakSet(),
|
|
2554
|
+
warned: false,
|
|
2555
|
+
lenient: false,
|
|
2556
|
+
dropping: [],
|
|
2557
|
+
ownerRoot,
|
|
2558
|
+
ordered: true,
|
|
2559
|
+
// The fields the user changed before the walk claimed them, and what
|
|
2560
|
+
// runs once it is done (dom.js: What the user changed before hydration).
|
|
2561
|
+
fields: [],
|
|
2562
|
+
radios: /* @__PURE__ */ new WeakSet(),
|
|
2563
|
+
after: []
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
function walkDone(walk) {
|
|
2567
|
+
for (const fn of walk.after) fn();
|
|
2568
|
+
if (walk.fields.length > 0) restoreFields(walk.fields);
|
|
2569
|
+
}
|
|
2570
|
+
var restoreFields = null;
|
|
2571
|
+
function _keepControl(el) {
|
|
2572
|
+
restoreFields = _restoreFields;
|
|
2573
|
+
_changedFields(el, session.fields, session.radios);
|
|
2574
|
+
}
|
|
2575
|
+
function keepControlAt(c) {
|
|
2576
|
+
const n = next(c);
|
|
2577
|
+
if (n !== null && n.nodeType === 1) _keepControl(n);
|
|
2578
|
+
}
|
|
2579
|
+
function _$control(k, flags) {
|
|
2580
|
+
const c = cur;
|
|
2581
|
+
if (c !== null && c.h) {
|
|
2582
|
+
while (k-- > 0) stepStatic(c);
|
|
2583
|
+
k = 0;
|
|
2584
|
+
keepControlAt(c);
|
|
2585
|
+
}
|
|
2586
|
+
return _$next(k, flags);
|
|
2587
|
+
}
|
|
2588
|
+
function _$claimControl(tmpl, flags) {
|
|
2589
|
+
if (cur !== null && cur.h) keepControlAt(cur);
|
|
2590
|
+
return _$claim(tmpl, flags);
|
|
2591
|
+
}
|
|
2592
|
+
var pendingKey = null;
|
|
2593
|
+
var CLIENT = { h: false };
|
|
2594
|
+
function isHydrating() {
|
|
2595
|
+
return cur !== null && cur.h;
|
|
2596
|
+
}
|
|
2597
|
+
function _afterWalk(fn) {
|
|
2598
|
+
if (cur === null || session === null) return false;
|
|
2599
|
+
session.after.push(fn);
|
|
2600
|
+
return true;
|
|
2601
|
+
}
|
|
2602
|
+
function _claimRegion() {
|
|
2603
|
+
const c = cur;
|
|
2604
|
+
if (c === null || !c.h) return null;
|
|
2605
|
+
pendingKey = null;
|
|
2606
|
+
let open = nextOwn(c);
|
|
2607
|
+
if (!isBracket(open)) {
|
|
2608
|
+
const before = c.o > 0 || c.x ? null : anchorOf(c);
|
|
2609
|
+
open = isBracket(before) ? before : null;
|
|
2610
|
+
}
|
|
2611
|
+
if (open === null) return null;
|
|
2612
|
+
const close = closeOf(open, open.data === ARRAY_OPEN ? ARRAY_CLOSE : REGION_CLOSE);
|
|
2613
|
+
if (close === null || close === c.e) return null;
|
|
2614
|
+
c.n = close.nextSibling;
|
|
2615
|
+
c.o = 0;
|
|
2616
|
+
c.x = false;
|
|
2617
|
+
return [open, close];
|
|
2618
|
+
}
|
|
2619
|
+
function isBracket(node) {
|
|
2620
|
+
return node !== null && node !== void 0 && (isMarker(node, ARRAY_OPEN) || isMarker(node, REGION_OPEN));
|
|
2621
|
+
}
|
|
2622
|
+
function _takeOwnerStep() {
|
|
2623
|
+
const ctx = { owner: getOwner() };
|
|
2624
|
+
_assignHydrationOwnerPath(ctx, session.ownerRoot, "", session.ordered);
|
|
2625
|
+
return ctx._ownerPath;
|
|
2626
|
+
}
|
|
2627
|
+
function _hydrateRange(open, close, fn, onError) {
|
|
2628
|
+
const parent = close.parentNode;
|
|
2629
|
+
const saved = { cur, depth: outer.length, session, pendingKey };
|
|
2630
|
+
const walk = session = newSession(parent, onError || null, _hydrationRoot(parent));
|
|
2631
|
+
let value;
|
|
2632
|
+
batch(() => {
|
|
2633
|
+
cur = { p: parent, n: open.nextSibling, o: 0, x: false, e: close, h: true, t: null };
|
|
2634
|
+
pendingKey = null;
|
|
2635
|
+
try {
|
|
2636
|
+
value = fn();
|
|
2637
|
+
adopt(value);
|
|
2638
|
+
finish(cur);
|
|
2639
|
+
} finally {
|
|
2640
|
+
cur = saved.cur;
|
|
2641
|
+
outer.length = saved.depth;
|
|
2642
|
+
session = saved.session;
|
|
2643
|
+
pendingKey = saved.pendingKey;
|
|
2644
|
+
if (saved.depth === 0) releaseCursors();
|
|
2645
|
+
}
|
|
2646
|
+
walkDone(walk);
|
|
2647
|
+
});
|
|
2648
|
+
return value;
|
|
2649
|
+
}
|
|
2650
|
+
function _hydrationErrorHook() {
|
|
2651
|
+
return cur !== null && cur.h && session !== null ? session.onError : null;
|
|
2652
|
+
}
|
|
2653
|
+
function _withCursor(fn, a, b, c, d) {
|
|
2654
|
+
return keepCursor === null ? fn(a, b, c, d) : keepCursor(fn, a, b, c, d);
|
|
2655
|
+
}
|
|
2656
|
+
var keepCursor = null;
|
|
2657
|
+
function keepingCursor(fn, a, b, c, d) {
|
|
2658
|
+
const at = cur;
|
|
2659
|
+
const depth = outer.length;
|
|
2660
|
+
try {
|
|
2661
|
+
return fn(a, b, c, d);
|
|
2662
|
+
} catch (error) {
|
|
2663
|
+
cur = at;
|
|
2664
|
+
outer.length = depth;
|
|
2665
|
+
throw error;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
function clientBuild(fn, a, b, c) {
|
|
2669
|
+
const saved = cur;
|
|
2670
|
+
cur = CLIENT;
|
|
2671
|
+
try {
|
|
2672
|
+
return fn(a, b, c);
|
|
2673
|
+
} finally {
|
|
2674
|
+
cur = saved;
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
function hydrate(tree, container, options) {
|
|
2678
|
+
container = _mountTarget(container, "hydrate");
|
|
2679
|
+
return createRoot((dispose) => {
|
|
2680
|
+
const unmount = _trackRoot(container, dispose);
|
|
2681
|
+
const saved = { cur, depth: outer.length, session, pendingKey };
|
|
2682
|
+
if ((process.env.NODE_ENV !== "production") && __devtools?.onRecord) saved.devNodes = devHydrationNodes(container);
|
|
2683
|
+
const walk = session = newSession(container, options && options.onHydrationError || null, _hydrationRoot(container));
|
|
2684
|
+
__resetIdCounter();
|
|
2685
|
+
_installSeeding();
|
|
2686
|
+
batch(() => {
|
|
2687
|
+
cur = { p: container, n: container.firstChild, o: 0, x: false, e: null, h: true, t: null };
|
|
2688
|
+
pendingKey = null;
|
|
2689
|
+
try {
|
|
2690
|
+
adopt(tree);
|
|
2691
|
+
if (container !== document.body && container !== document.documentElement) finish(cur);
|
|
2692
|
+
} finally {
|
|
2693
|
+
cur = saved.cur;
|
|
2694
|
+
outer.length = saved.depth;
|
|
2695
|
+
session = saved.session;
|
|
2696
|
+
pendingKey = saved.pendingKey;
|
|
2697
|
+
if (saved.depth === 0) releaseCursors();
|
|
2698
|
+
}
|
|
2699
|
+
walkDone(walk);
|
|
2700
|
+
});
|
|
2701
|
+
_adoptDetached(container.childNodes);
|
|
2702
|
+
if ((process.env.NODE_ENV !== "production") && /** @type {any} */
|
|
2703
|
+
saved.devNodes) devHydrationComplete(
|
|
2704
|
+
container,
|
|
2705
|
+
/** @type {any} */
|
|
2706
|
+
saved.devNodes
|
|
2707
|
+
);
|
|
2708
|
+
return unmount;
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
function devHydrationNodes(container) {
|
|
2712
|
+
const nodes = /* @__PURE__ */ new Set();
|
|
2713
|
+
const walk = container.ownerDocument.createTreeWalker(container, 5);
|
|
2714
|
+
for (let node = walk.nextNode(); node !== null; node = walk.nextNode()) nodes.add(node);
|
|
2715
|
+
return nodes;
|
|
2716
|
+
}
|
|
2717
|
+
function devHydrationComplete(container, before) {
|
|
2718
|
+
const after = devHydrationNodes(container);
|
|
2719
|
+
let adopted = 0;
|
|
2720
|
+
for (const node of after) if (before.has(node)) adopted++;
|
|
2721
|
+
recordObservation(__devtools, "hydration:complete", container, { adopted, created: after.size - adopted });
|
|
2722
|
+
}
|
|
2723
|
+
function isMarker(node, data) {
|
|
2724
|
+
return node !== null && node.nodeType === 8 && /** @type {Comment} */
|
|
2725
|
+
node.data === data;
|
|
2726
|
+
}
|
|
2727
|
+
function next(c) {
|
|
2728
|
+
if (c.x) dropDiffering(c, "");
|
|
2729
|
+
if (c.o > 0) return c.n;
|
|
2730
|
+
let n = c.n;
|
|
2731
|
+
while (n !== null && n !== c.e) {
|
|
2732
|
+
const type = n.nodeType;
|
|
2733
|
+
if (type === 8 ? !transparent(n.data) : type !== 3 || n.data !== "") return n;
|
|
2734
|
+
c.n = n = n.nextSibling;
|
|
2735
|
+
}
|
|
2736
|
+
return null;
|
|
2737
|
+
}
|
|
2738
|
+
function rowStart(c) {
|
|
2739
|
+
if (c.o > 0 || c.x) return;
|
|
2740
|
+
let n = c.n;
|
|
2741
|
+
while (n !== null && n !== c.e && (n.nodeType === 8 ? n.data !== REGION_OPEN && transparent(n.data) : n.nodeType === 3 && n.data === "")) n = n.nextSibling;
|
|
2742
|
+
c.n = n;
|
|
2743
|
+
}
|
|
2744
|
+
function past(c) {
|
|
2745
|
+
let n = c.n;
|
|
2746
|
+
while (n !== null && n !== c.e && (n.nodeType === 8 && transparent(n.data) || n.nodeType === 3 && n.data === "")) n = n.nextSibling;
|
|
2747
|
+
return n;
|
|
2748
|
+
}
|
|
2749
|
+
function serverKeyAt(c) {
|
|
2750
|
+
if (c.o > 0 || c.x) return "";
|
|
2751
|
+
const n = past(c);
|
|
2752
|
+
if (n === c.e || n === null) return null;
|
|
2753
|
+
return n.nodeType === 1 ? (
|
|
2754
|
+
/** @type {Element} */
|
|
2755
|
+
n.getAttribute("data-hk") || ""
|
|
2756
|
+
) : "";
|
|
2757
|
+
}
|
|
2758
|
+
function nextOwn(c) {
|
|
2759
|
+
if (c.x === true) dropDiffering(c, "");
|
|
2760
|
+
if (c.o > 0) return null;
|
|
2761
|
+
let n = c.n;
|
|
2762
|
+
while (n !== null && n !== c.e && n.nodeType === 3 && n.data === "") n = n.nextSibling;
|
|
2763
|
+
c.n = n;
|
|
2764
|
+
return n === c.e ? null : n;
|
|
2765
|
+
}
|
|
2766
|
+
function closeOf(open, close) {
|
|
2767
|
+
const data = open.data;
|
|
2768
|
+
let depth = 0;
|
|
2769
|
+
for (let n = open.nextSibling; n !== null; n = n.nextSibling) {
|
|
2770
|
+
if (n.nodeType !== 8) continue;
|
|
2771
|
+
const d = n.data;
|
|
2772
|
+
if (d === data || close === BOUNDARY_CLOSE && (d === BOUNDARY_OPEN || d === BOUNDARY_FALLBACK)) depth++;
|
|
2773
|
+
else if (d === close) {
|
|
2774
|
+
if (depth === 0) return n;
|
|
2775
|
+
depth--;
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
return null;
|
|
2779
|
+
}
|
|
2780
|
+
function within(open, close, fn, a) {
|
|
2781
|
+
const c = cur;
|
|
2782
|
+
outer.push(c);
|
|
2783
|
+
cur = { p: c.p, n: open.nextSibling, o: 0, x: false, e: close, h: true, t: null };
|
|
2784
|
+
try {
|
|
2785
|
+
fn(a);
|
|
2786
|
+
finish(cur);
|
|
2787
|
+
} finally {
|
|
2788
|
+
cur = outer.pop();
|
|
2789
|
+
}
|
|
2790
|
+
c.n = close.nextSibling;
|
|
2791
|
+
c.o = 0;
|
|
2792
|
+
c.x = false;
|
|
2793
|
+
}
|
|
2794
|
+
function splitHere(c) {
|
|
2795
|
+
if (c.o > 0) {
|
|
2796
|
+
c.n = /** @type {Text} */
|
|
2797
|
+
c.n.splitText(c.o);
|
|
2798
|
+
c.o = 0;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
function anchorOf(c) {
|
|
2802
|
+
return c.n === null ? c.p.lastChild : c.n.previousSibling;
|
|
2803
|
+
}
|
|
2804
|
+
function afterAnchor(c, anchor) {
|
|
2805
|
+
return anchor === null ? c.p.firstChild : anchor.nextSibling;
|
|
2806
|
+
}
|
|
2807
|
+
function finish(c) {
|
|
2808
|
+
splitHere(c);
|
|
2809
|
+
const top = c.p === session.root && c.e === null;
|
|
2810
|
+
for (let x = next(c); x !== null && x !== c.e; ) {
|
|
2811
|
+
const following = x.nextSibling;
|
|
2812
|
+
if (frozen()) break;
|
|
2813
|
+
if (!top || !streamElement(x)) {
|
|
2814
|
+
mismatch("extra-nodes", "nothing", describe(x), x);
|
|
2815
|
+
x.remove();
|
|
2816
|
+
}
|
|
2817
|
+
x = following;
|
|
2818
|
+
}
|
|
2819
|
+
c.n = c.e;
|
|
2820
|
+
}
|
|
2821
|
+
function streamElement(x) {
|
|
2822
|
+
if (x.nodeType !== 1) return false;
|
|
2823
|
+
if (x.localName === "template") return x.id !== "";
|
|
2824
|
+
if (x.localName !== "script") return false;
|
|
2825
|
+
if (x.getAttribute("type") === "application/json") return x.id === "__what_data" || x.hasAttribute("data-what-data");
|
|
2826
|
+
const code = x.textContent;
|
|
2827
|
+
return code.startsWith("_$W.") || code.startsWith("(self._$W=");
|
|
2828
|
+
}
|
|
2829
|
+
function describe(node) {
|
|
2830
|
+
if (node == null) return "nothing";
|
|
2831
|
+
if (node.nodeType === 3) return JSON.stringify(short(node.data));
|
|
2832
|
+
if (node.nodeType === 8) return `<!--${short(node.data)}-->`;
|
|
2833
|
+
if (node.nodeType !== 1) return node.nodeName;
|
|
2834
|
+
let open = "<" + node.localName;
|
|
2835
|
+
const id = node.getAttribute("id");
|
|
2836
|
+
const cls = node.getAttribute("class");
|
|
2837
|
+
if (id) open += ` id="${short(id)}"`;
|
|
2838
|
+
if (cls) open += ` class="${short(cls)}"`;
|
|
2839
|
+
return open + ">";
|
|
2840
|
+
}
|
|
2841
|
+
function short(text) {
|
|
2842
|
+
return text.length > 40 ? text.slice(0, 37) + "..." : text;
|
|
2843
|
+
}
|
|
2844
|
+
function domPath(node) {
|
|
2845
|
+
const parts = [];
|
|
2846
|
+
for (let n = node; n != null && n !== session.root && n.nodeType !== 9; n = n.parentNode) {
|
|
2847
|
+
if (n.nodeType !== 1) {
|
|
2848
|
+
parts.push(n.nodeType === 3 ? "#text" : "#comment");
|
|
2849
|
+
continue;
|
|
2850
|
+
}
|
|
2851
|
+
let index = 0;
|
|
2852
|
+
for (let s = n.previousElementSibling; s !== null; s = s.previousElementSibling) {
|
|
2853
|
+
if (s.localName === n.localName) index++;
|
|
2854
|
+
}
|
|
2855
|
+
parts.push(index ? `${n.localName}[${index}]` : n.localName);
|
|
2856
|
+
}
|
|
2857
|
+
return parts.reverse().join(">");
|
|
2858
|
+
}
|
|
2859
|
+
function regionOf(c) {
|
|
2860
|
+
return c.e !== null ? c.e : c.p;
|
|
2861
|
+
}
|
|
2862
|
+
function frozen() {
|
|
2863
|
+
return session.dropping.some((b) => b.thenables > 0);
|
|
2864
|
+
}
|
|
2865
|
+
function mismatch(kind, expected, found, at, recovery = "client-render") {
|
|
2866
|
+
const s = session;
|
|
2867
|
+
const region2 = regionOf(cur);
|
|
2868
|
+
if (frozen()) return;
|
|
2869
|
+
if (kind !== "text" && kind !== "prebuilt") s.ordered = false;
|
|
2870
|
+
if (s.reported.has(region2)) return;
|
|
2871
|
+
s.reported.add(region2);
|
|
2872
|
+
if (!(process.env.NODE_ENV !== "production") && s.onError === null) return;
|
|
2873
|
+
const owner = _currentComponent();
|
|
2874
|
+
const info = {
|
|
2875
|
+
kind,
|
|
2876
|
+
component: owner ? owner.Component.displayName || owner.Component.name || "Anonymous" : "root",
|
|
2877
|
+
ownerPath: owner && owner._ownerPath !== void 0 ? owner._ownerPath : null,
|
|
2878
|
+
path: domPath(at),
|
|
2879
|
+
expected,
|
|
2880
|
+
found,
|
|
2881
|
+
recovery
|
|
2882
|
+
};
|
|
2883
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
2884
|
+
const where = __ownerPath(owner || getOwner());
|
|
2885
|
+
report("ERR_HYDRATION_MISMATCH", {
|
|
2886
|
+
data: info,
|
|
2887
|
+
owner: where,
|
|
2888
|
+
loc: where.loc,
|
|
2889
|
+
subject: { kind: "hydration", id: `${info.ownerPath ?? "root"}|${info.path}|${kind}`, name: info.component }
|
|
2890
|
+
});
|
|
2891
|
+
}
|
|
2892
|
+
if (s.onError !== null) s.onError(info);
|
|
2893
|
+
}
|
|
2894
|
+
function recover(c, node, expected, kind) {
|
|
2895
|
+
splitHere(c);
|
|
2896
|
+
const found = next(c);
|
|
2897
|
+
if (frozen()) return node;
|
|
2898
|
+
mismatch(kind || (found === null ? "missing" : found.nodeType === 8 ? "marker" : found.nodeType === 3 ? "text" : (
|
|
2899
|
+
/** @type {Element} */
|
|
2900
|
+
found.shadowRoot != null ? "shadow-root" : "tag"
|
|
2901
|
+
)), expected, describe(found), found || c.p);
|
|
2902
|
+
if (found !== null && (found.nodeType === 1 || found.nodeType === 3)) {
|
|
2903
|
+
c.p.replaceChild(node, found);
|
|
2904
|
+
c.n = node.nextSibling;
|
|
2905
|
+
} else {
|
|
2906
|
+
c.p.insertBefore(node, c.n);
|
|
2907
|
+
}
|
|
2908
|
+
return node;
|
|
2909
|
+
}
|
|
2910
|
+
function takeElement(c, tag) {
|
|
2911
|
+
let n = c.n;
|
|
2912
|
+
if (c.x || c.o > 0 || n === null || n.nodeType !== 1) {
|
|
2913
|
+
n = next(c);
|
|
2914
|
+
if (n === null || n.nodeType !== 1) return null;
|
|
2915
|
+
}
|
|
2916
|
+
const name = n.localName;
|
|
2917
|
+
if (name !== tag && name !== tag.toLowerCase() || /** @type {Element} */
|
|
2918
|
+
n.shadowRoot != null) return null;
|
|
2919
|
+
c.n = n.nextSibling;
|
|
2920
|
+
if (pendingKey !== null) settleKey(n);
|
|
2921
|
+
return n;
|
|
2922
|
+
}
|
|
2923
|
+
function settleKey(el) {
|
|
2924
|
+
const expected = pendingKey;
|
|
2925
|
+
pendingKey = null;
|
|
2926
|
+
const key = el.getAttribute("data-hk");
|
|
2927
|
+
if (key !== null && key !== expected && !session.lenient) {
|
|
2928
|
+
mismatch("key", `data-hk="${expected}"`, `data-hk="${key}"`, el, "none");
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
function claimText(text) {
|
|
2932
|
+
pendingKey = null;
|
|
2933
|
+
if (text === "") return;
|
|
2934
|
+
if (text.indexOf("\r") >= 0) text = text.replace(/\r\n?/g, "\n");
|
|
2935
|
+
const c = cur;
|
|
2936
|
+
if (c.x) dropDiffering(c, text);
|
|
2937
|
+
for (let i = 0; i < text.length; ) {
|
|
2938
|
+
const n = next(c);
|
|
2939
|
+
if (n === null || n.nodeType !== 3) {
|
|
2940
|
+
recover(c, document.createTextNode(text.slice(i)), JSON.stringify(short(text.slice(i))), n === null ? "missing" : "text");
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
const data = n.data;
|
|
2944
|
+
if (i === 0 && c.o === 0 && data === text) {
|
|
2945
|
+
c.n = n.nextSibling;
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
const take = Math.min(data.length - c.o, text.length - i);
|
|
2949
|
+
if (!data.startsWith(i === 0 && take === text.length ? text : text.slice(i, i + take), c.o)) {
|
|
2950
|
+
replaceText(c, text.slice(i));
|
|
2951
|
+
return;
|
|
2952
|
+
}
|
|
2953
|
+
i += take;
|
|
2954
|
+
c.o += take;
|
|
2955
|
+
if (c.o === data.length) {
|
|
2956
|
+
c.n = n.nextSibling;
|
|
2957
|
+
c.o = 0;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
function replaceText(c, text) {
|
|
2962
|
+
splitHere(c);
|
|
2963
|
+
const node = (
|
|
2964
|
+
/** @type {Text} */
|
|
2965
|
+
c.n
|
|
2966
|
+
);
|
|
2967
|
+
if (frozen()) {
|
|
2968
|
+
c.n = node.nextSibling;
|
|
2969
|
+
return null;
|
|
2970
|
+
}
|
|
2971
|
+
mismatch("text", JSON.stringify(short(text)), describe(node), node);
|
|
2972
|
+
c.x = true;
|
|
2973
|
+
const rest = c.p.insertBefore(node.cloneNode(), node.nextSibling);
|
|
2974
|
+
node.data = text;
|
|
2975
|
+
c.n = rest;
|
|
2976
|
+
return node;
|
|
2977
|
+
}
|
|
2978
|
+
function dropDiffering(c, text) {
|
|
2979
|
+
const empty = c.x === 1;
|
|
2980
|
+
c.x = false;
|
|
2981
|
+
const node = c.n;
|
|
2982
|
+
if (node === null || node.nodeType !== 3) return;
|
|
2983
|
+
const data = (
|
|
2984
|
+
/** @type {Text} */
|
|
2985
|
+
node.data
|
|
2986
|
+
);
|
|
2987
|
+
let end = text === "" ? data.length : data.indexOf(text);
|
|
2988
|
+
if (end < 0) {
|
|
2989
|
+
if (empty) return;
|
|
2990
|
+
end = data.length;
|
|
2991
|
+
for (let b = Math.max(1, data.length - text.length + 1); b < data.length; b++) {
|
|
2992
|
+
if (text.startsWith(data.slice(b))) {
|
|
2993
|
+
end = b;
|
|
2994
|
+
break;
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
if (end === 0) return;
|
|
2999
|
+
if (end < data.length) node.splitText(end);
|
|
3000
|
+
if (empty) mismatch("text", '""', describe(node), node);
|
|
3001
|
+
c.n = node.nextSibling;
|
|
3002
|
+
node.remove();
|
|
3003
|
+
}
|
|
3004
|
+
function keepTemplateAttrs(el, t, owned) {
|
|
3005
|
+
const want = templateAttrs(t);
|
|
3006
|
+
const names = el.hasAttributes() ? el.getAttributeNames() : null;
|
|
3007
|
+
let left = names === null ? 0 : names.length;
|
|
3008
|
+
let key = false;
|
|
3009
|
+
if (names !== null) {
|
|
3010
|
+
for (let i = 0; i < names.length; i++) {
|
|
3011
|
+
const name = names[i];
|
|
3012
|
+
if (owned !== void 0 && owns(owned, name)) left--;
|
|
3013
|
+
else if (name === "data-hk" && !t.hasAttribute(name)) {
|
|
3014
|
+
key = true;
|
|
3015
|
+
left--;
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
let same = left * 3 === want.length;
|
|
3020
|
+
for (let i = 0; same && i < want.length; i += 3) same = el.getAttribute(want[i]) === want[i + 1];
|
|
3021
|
+
if (same) {
|
|
3022
|
+
if (!key) return;
|
|
3023
|
+
el.removeAttribute("data-hk");
|
|
3024
|
+
if (_selectionKeeper !== null && el.localName === "option") _selectionKeeper(el);
|
|
3025
|
+
return;
|
|
3026
|
+
}
|
|
3027
|
+
if (names !== null) {
|
|
3028
|
+
for (let i = 0; i < names.length; i++) {
|
|
3029
|
+
if (!t.hasAttribute(names[i]) && (owned === void 0 || !owns(owned, names[i]))) el.removeAttribute(names[i]);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
for (let i = 0; i < want.length; i += 3) {
|
|
3033
|
+
if (el.getAttribute(want[i]) !== want[i + 1]) el.setAttributeNS(want[i + 2], want[i], want[i + 1]);
|
|
3034
|
+
}
|
|
3035
|
+
if (_selectionKeeper !== null && el.localName === "option") _selectionKeeper(el);
|
|
3036
|
+
}
|
|
3037
|
+
function owns(owned, name) {
|
|
3038
|
+
return owned === name || owned.length > name.length && (" " + owned + " ").includes(" " + name + " ");
|
|
3039
|
+
}
|
|
3040
|
+
function watchAttrs(el, want) {
|
|
3041
|
+
const s = session;
|
|
3042
|
+
if (frozen()) return;
|
|
3043
|
+
let list = s.attrs;
|
|
3044
|
+
if (list === void 0) {
|
|
3045
|
+
list = s.attrs = [];
|
|
3046
|
+
s.after.push(() => checkAttrs(list, s));
|
|
3047
|
+
}
|
|
3048
|
+
const server = /* @__PURE__ */ new Map();
|
|
3049
|
+
for (const name of el.getAttributeNames()) server.set(name, el.getAttribute(name));
|
|
3050
|
+
if (el.namespaceURI === NAMESPACES[0]) want = new Set([...want].map((name) => name.toLowerCase()));
|
|
3051
|
+
list.push({ el, server, want, owner: _currentComponent(), at: getOwner() });
|
|
3052
|
+
}
|
|
3053
|
+
function templateWants(t, owned) {
|
|
3054
|
+
const want = /* @__PURE__ */ new Set();
|
|
3055
|
+
const attrs = templateAttrs(t);
|
|
3056
|
+
for (let i = 0; i < attrs.length; i += 3) want.add(attrs[i]);
|
|
3057
|
+
if (owned !== void 0) for (const name of owned.split(" ")) want.add(name);
|
|
3058
|
+
return want;
|
|
3059
|
+
}
|
|
3060
|
+
function checkAttrs(list, s) {
|
|
3061
|
+
const saved = session;
|
|
3062
|
+
session = s;
|
|
3063
|
+
try {
|
|
3064
|
+
checkEach(list);
|
|
3065
|
+
} finally {
|
|
3066
|
+
session = saved;
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
function checkEach(list) {
|
|
3070
|
+
for (const { el, server, want, owner, at } of list) {
|
|
3071
|
+
const custom = el.localName.includes("-");
|
|
3072
|
+
for (const name of /* @__PURE__ */ new Set([...want, ...server.keys()])) {
|
|
3073
|
+
const now = el.getAttribute(name);
|
|
3074
|
+
const was = server.has(name) ? server.get(name) : null;
|
|
3075
|
+
if (!want.has(name) && (now === null || custom)) continue;
|
|
3076
|
+
if (sameAttr(el, name, was, now)) continue;
|
|
3077
|
+
const component = owner ? owner.Component.displayName || owner.Component.name || "Anonymous" : "root";
|
|
3078
|
+
const info = {
|
|
3079
|
+
kind: "attribute",
|
|
3080
|
+
component,
|
|
3081
|
+
ownerPath: owner && owner._ownerPath !== void 0 ? owner._ownerPath : null,
|
|
3082
|
+
path: domPath(el),
|
|
3083
|
+
attribute: name,
|
|
3084
|
+
expected: now === null ? `no ${name}` : `${name}="${short(now)}"`,
|
|
3085
|
+
found: was === null ? `no ${name}` : `${name}="${short(was)}"`,
|
|
3086
|
+
recovery: "client-value"
|
|
3087
|
+
};
|
|
3088
|
+
const where = __ownerPath(owner || at);
|
|
3089
|
+
report("ERR_HYDRATION_MISMATCH", {
|
|
3090
|
+
data: info,
|
|
3091
|
+
owner: where,
|
|
3092
|
+
loc: where.loc,
|
|
3093
|
+
subject: { kind: "hydration", id: `${info.ownerPath ?? "root"}|${info.path}|attribute|${name}`, name: component }
|
|
3094
|
+
});
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
var booleanAttrs = null;
|
|
3099
|
+
var booleanAttributes = () => booleanAttrs ??= /* @__PURE__ */ new Set(["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "defer", "disabled", "formnovalidate", "inert", "ismap", "itemscope", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "selected"]);
|
|
3100
|
+
function sameAttr(el, name, was, now) {
|
|
3101
|
+
if (was === now) return true;
|
|
3102
|
+
if (el.namespaceURI !== NAMESPACES[0]) return false;
|
|
3103
|
+
if (name === "value" && el.localName === "input" && !ATTRIBUTE_VALUE_TYPES.has(
|
|
3104
|
+
/** @type {HTMLInputElement} */
|
|
3105
|
+
el.type
|
|
3106
|
+
)) return (was ?? "") === (now ?? "");
|
|
3107
|
+
if (was === null || now === null) return false;
|
|
3108
|
+
if (booleanAttributes().has(name)) return true;
|
|
3109
|
+
if (name !== "style") return false;
|
|
3110
|
+
const probe = el.ownerDocument.createElement("div");
|
|
3111
|
+
probe.setAttribute("style", was);
|
|
3112
|
+
const before = probe.style.cssText;
|
|
3113
|
+
probe.setAttribute("style", now);
|
|
3114
|
+
return probe.style.cssText === before;
|
|
3115
|
+
}
|
|
3116
|
+
function templateAttrs(t) {
|
|
3117
|
+
const node = (
|
|
3118
|
+
/** @type {any} */
|
|
3119
|
+
t
|
|
3120
|
+
);
|
|
3121
|
+
if (node._attrs === void 0) {
|
|
3122
|
+
node._attrs = [];
|
|
3123
|
+
for (const attr of t.attributes) node._attrs.push(attr.name, attr.value, attr.namespaceURI);
|
|
3124
|
+
}
|
|
3125
|
+
return node._attrs;
|
|
3126
|
+
}
|
|
3127
|
+
function keepsAttr(el, key, value, current) {
|
|
3128
|
+
if (typeof value !== "string" && typeof value !== "number" || current !== String(value)) return false;
|
|
3129
|
+
if (key === "value" || /** @type {Function} */
|
|
3130
|
+
vnodeRefuses(key, value)) return false;
|
|
3131
|
+
if (el.localName.includes("-") && _writableProp(el, key)) return false;
|
|
3132
|
+
return current !== "" || !(key in el && typeof el[key] === "boolean");
|
|
3133
|
+
}
|
|
3134
|
+
function attrOf(el, key) {
|
|
3135
|
+
if (key === "children" || key === "key" || key === "ref" || key.startsWith("$$") || key === "innerHTML" || key === "dangerouslySetInnerHTML" || key === "classList" || _isEventProp(key)) return null;
|
|
3136
|
+
if (FIELD_PROPS.has(key) && FIELD_TAGS.has(el.localName)) {
|
|
3137
|
+
if (el.localName !== "input") return null;
|
|
3138
|
+
if (key === "checked") return null;
|
|
3139
|
+
if (key === "value" && !ATTRIBUTE_VALUE_TYPES.has(el.type)) return null;
|
|
3140
|
+
}
|
|
3141
|
+
return markupName(key);
|
|
3142
|
+
}
|
|
3143
|
+
function dropUnrendered(el, props, fold, names) {
|
|
3144
|
+
for (let i = 0; i < names.length; i++) {
|
|
3145
|
+
const name = names[i];
|
|
3146
|
+
let rendered = name === "class" && fold;
|
|
3147
|
+
for (const k in props) {
|
|
3148
|
+
if (rendered) break;
|
|
3149
|
+
const a = attrOf(el, k);
|
|
3150
|
+
rendered = a !== null && (a === name || a.toLowerCase() === name);
|
|
3151
|
+
}
|
|
3152
|
+
if (!rendered) el.removeAttribute(name);
|
|
3153
|
+
}
|
|
3154
|
+
if (_selectionKeeper !== null && el.localName === "option") _selectionKeeper(el);
|
|
3155
|
+
}
|
|
3156
|
+
function hydrateReactiveProp(el, key, value, svg, name) {
|
|
3157
|
+
let ran = false;
|
|
3158
|
+
vnodeProp(el, key, () => {
|
|
3159
|
+
const v = value();
|
|
3160
|
+
ran = true;
|
|
3161
|
+
return v;
|
|
3162
|
+
}, svg);
|
|
3163
|
+
if (!ran) el.removeAttribute(name);
|
|
3164
|
+
}
|
|
3165
|
+
function adopt(value) {
|
|
3166
|
+
if (value == null || typeof value === "boolean" || typeof value === "symbol") {
|
|
3167
|
+
if ((process.env.NODE_ENV !== "production") && typeof value === "symbol") symbolChild(value);
|
|
3168
|
+
return;
|
|
3169
|
+
}
|
|
3170
|
+
const type = typeof value;
|
|
3171
|
+
if (type === "string" || type === "number") {
|
|
3172
|
+
claimText(String(value));
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
if (type === "function") {
|
|
3176
|
+
if (value._lazyChildren) adopt(_placeFlat(value));
|
|
3177
|
+
else if (value._mapArray) adoptList(value);
|
|
3178
|
+
else adoptRegion(value);
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
if (Array.isArray(value)) {
|
|
3182
|
+
if (session.built.has(value)) return;
|
|
3183
|
+
const at = nextOwn(cur);
|
|
3184
|
+
let first = value[0];
|
|
3185
|
+
while (Array.isArray(first)) first = first[0];
|
|
3186
|
+
const claimed = _isDomNode(first) && first.parentNode === cur.p;
|
|
3187
|
+
const close = at !== null && isMarker(at, ARRAY_OPEN) && !claimed ? closeOf(at, ARRAY_CLOSE) : null;
|
|
3188
|
+
if (close !== null) within(at, close, adoptEach, value);
|
|
3189
|
+
else {
|
|
3190
|
+
adoptEach(value);
|
|
3191
|
+
const open = !claimed ? null : isMarker(first, ARRAY_OPEN) ? first : first.previousSibling;
|
|
3192
|
+
if (open !== null && isMarker(open, ARRAY_OPEN) && nextOwn(cur) === closeOf(open, ARRAY_CLOSE)) cur.n = cur.n.nextSibling;
|
|
3193
|
+
}
|
|
3194
|
+
return;
|
|
3195
|
+
}
|
|
3196
|
+
if (isVNode(value)) {
|
|
3197
|
+
adoptVNode(value);
|
|
3198
|
+
return;
|
|
3199
|
+
}
|
|
3200
|
+
if (_isDomNode(value)) {
|
|
3201
|
+
adoptNode(value);
|
|
3202
|
+
return;
|
|
3203
|
+
}
|
|
3204
|
+
claimText(String(value));
|
|
3205
|
+
}
|
|
3206
|
+
function adoptEach(values) {
|
|
3207
|
+
let list = null;
|
|
3208
|
+
for (let i = 0; i < values.length; i++) {
|
|
3209
|
+
const value = values[i];
|
|
3210
|
+
const key = isVNode(value) ? value.key : null;
|
|
3211
|
+
if (key != null) adoptRow(list ??= {}, key, adopt, value);
|
|
3212
|
+
else if (takesSlot(value)) adoptRow(null, i, adopt, value);
|
|
3213
|
+
else adopt(value);
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
function takesSlot(value) {
|
|
3217
|
+
if (typeof value === "function") return !value._lazyChildren;
|
|
3218
|
+
if (Array.isArray(value)) return true;
|
|
3219
|
+
if (!isVNode(value)) return false;
|
|
3220
|
+
if (typeof value.tag === "function") return true;
|
|
3221
|
+
const kids = value.children;
|
|
3222
|
+
if (kids) {
|
|
3223
|
+
for (let i = 0; i < kids.length; i++) {
|
|
3224
|
+
const kid = kids[i];
|
|
3225
|
+
if (typeof kid === "function" || typeof kid === "object" && kid !== null) return true;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
return false;
|
|
3229
|
+
}
|
|
3230
|
+
var rowEntry = null;
|
|
3231
|
+
var rowExit = null;
|
|
3232
|
+
function _installRowEntry(enter, exit) {
|
|
3233
|
+
rowEntry = enter;
|
|
3234
|
+
rowExit = exit;
|
|
3235
|
+
}
|
|
3236
|
+
function adoptRow(list, key, fn, a) {
|
|
3237
|
+
if (rowEntry === null) return fn(a);
|
|
3238
|
+
const root = session.ownerRoot;
|
|
3239
|
+
const saved = rowEntry(void 0, root, list, key);
|
|
3240
|
+
try {
|
|
3241
|
+
return fn(a);
|
|
3242
|
+
} finally {
|
|
3243
|
+
rowExit(void 0, root, saved);
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
function adoptNode(node) {
|
|
3247
|
+
const c = cur;
|
|
3248
|
+
if (node.parentNode === c.p && node !== c.n) return;
|
|
3249
|
+
if (!session.prebuilt.has(node)) notHydratable();
|
|
3250
|
+
placeBuilt(c, node);
|
|
3251
|
+
}
|
|
3252
|
+
function placeBuilt(c, value) {
|
|
3253
|
+
if (frozen()) return;
|
|
3254
|
+
const nodes = value.nodeType === 11 ? Array.from(value.childNodes) : [value];
|
|
3255
|
+
splitHere(c);
|
|
3256
|
+
let same = true;
|
|
3257
|
+
let report2 = session.prebuilt.has(value);
|
|
3258
|
+
for (let i = 0; i < nodes.length && same; i++) {
|
|
3259
|
+
const b = nodes[i];
|
|
3260
|
+
if (b.nodeType === 1) {
|
|
3261
|
+
const s = next(c);
|
|
3262
|
+
if (s !== null && s.nodeType === 1 && s.localName === b.localName) {
|
|
3263
|
+
if (report2) mismatch("prebuilt", describe(b), describe(s), s);
|
|
3264
|
+
report2 = false;
|
|
3265
|
+
fieldCarry?.(s, b);
|
|
3266
|
+
c.n = s.nextSibling;
|
|
3267
|
+
s.remove();
|
|
3268
|
+
} else {
|
|
3269
|
+
same = false;
|
|
3270
|
+
}
|
|
3271
|
+
} else if (b.nodeType === 3) {
|
|
3272
|
+
const s = next(c);
|
|
3273
|
+
if (report2 && b.data !== "" && s !== null && s.nodeType === 3) mismatch("prebuilt", describe(b), describe(s), s);
|
|
3274
|
+
report2 = false;
|
|
3275
|
+
same = dropText(c, b.data);
|
|
3276
|
+
} else if (b.nodeType === 8 && (b.data === "fn" || b.data === "list")) {
|
|
3277
|
+
const s = nextOwn(c);
|
|
3278
|
+
const close = s !== null && s.nodeType === 8 && (s.data === REGION_OPEN || s.data === ARRAY_OPEN) ? closeOf(s, s.data === REGION_OPEN ? REGION_CLOSE : ARRAY_CLOSE) : null;
|
|
3279
|
+
if (close !== null) {
|
|
3280
|
+
c.n = close.nextSibling;
|
|
3281
|
+
for (let x = s; x !== c.n; ) {
|
|
3282
|
+
const following = x.nextSibling;
|
|
3283
|
+
x.remove();
|
|
3284
|
+
x = following;
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
if (!same) mismatch("tag", describe(nodes[0]), describe(next(c)), next(c) || c.p);
|
|
3290
|
+
c.p.insertBefore(value, c.n);
|
|
3291
|
+
}
|
|
3292
|
+
function _carryFields(server, built) {
|
|
3293
|
+
const from = controlsIn(server);
|
|
3294
|
+
if (from.size === 0) return;
|
|
3295
|
+
const to = controlsIn(built);
|
|
3296
|
+
restoreFields = _restoreFields;
|
|
3297
|
+
for (const [key, list] of from) {
|
|
3298
|
+
const into = to.get(key);
|
|
3299
|
+
if (into !== void 0 && into.length === list.length) list.forEach((f, i) => carryField(f, into[i]));
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
function carryField(f, t) {
|
|
3303
|
+
if (f.type === "file") {
|
|
3304
|
+
if (f.files !== null && f.files.length > 0) t.files = f.files;
|
|
3305
|
+
} else if (f.type === "radio") {
|
|
3306
|
+
if (f.checked !== f.defaultChecked) session.fields.push([t, f.checked]);
|
|
3307
|
+
} else {
|
|
3308
|
+
const changed = [];
|
|
3309
|
+
_changedFields(f, changed, session.radios);
|
|
3310
|
+
for (const [, shown, live] of changed) {
|
|
3311
|
+
if (live === void 0) session.fields.push([t, shown]);
|
|
3312
|
+
else if (t.options.length === shown.length) {
|
|
3313
|
+
t._$chosen = true;
|
|
3314
|
+
session.fields.push([t, [...t.options], live]);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
function controlsIn(el) {
|
|
3320
|
+
const found = /* @__PURE__ */ new Map();
|
|
3321
|
+
for (const d of FIELD_TAGS.has(el.localName) ? [el] : el.getElementsByTagName("*")) {
|
|
3322
|
+
if (!FIELD_TAGS.has(d.localName) || d.closest("noscript") !== null) continue;
|
|
3323
|
+
const key = [d.localName, d.type, d.name, d.getAttribute("form"), d.type === "checkbox" || d.type === "radio" ? d.value : ""].join("\0");
|
|
3324
|
+
const list = found.get(key);
|
|
3325
|
+
if (list === void 0) found.set(key, [d]);
|
|
3326
|
+
else list.push(d);
|
|
3327
|
+
}
|
|
3328
|
+
return found;
|
|
3329
|
+
}
|
|
3330
|
+
function dropText(c, text) {
|
|
3331
|
+
if (c.x) dropDiffering(c, text);
|
|
3332
|
+
const n = next(c);
|
|
3333
|
+
if (n === null || n.nodeType !== 3 || !n.data.startsWith(text, c.o)) return text === "";
|
|
3334
|
+
splitHere(c);
|
|
3335
|
+
const node = (
|
|
3336
|
+
/** @type {Text} */
|
|
3337
|
+
c.n
|
|
3338
|
+
);
|
|
3339
|
+
if (node.data.length > text.length) node.splitText(text.length);
|
|
3340
|
+
c.n = node.nextSibling;
|
|
3341
|
+
node.remove();
|
|
3342
|
+
return true;
|
|
3343
|
+
}
|
|
3344
|
+
function notHydratable() {
|
|
3345
|
+
const region2 = regionOf(cur);
|
|
3346
|
+
if (session.warned) {
|
|
3347
|
+
session.reported.add(region2);
|
|
3348
|
+
return;
|
|
3349
|
+
}
|
|
3350
|
+
session.warned = true;
|
|
3351
|
+
splitHere(cur);
|
|
3352
|
+
const at = nextOwn(cur);
|
|
3353
|
+
mismatch("not-hydratable", "DOM built before hydrate() could claim it", describe(at), at || cur.p);
|
|
3354
|
+
session.reported.add(region2);
|
|
3355
|
+
}
|
|
3356
|
+
function adoptVNode(vnode) {
|
|
3357
|
+
if (typeof vnode.key === "function") adoptRegion(_signalKeyed(vnode));
|
|
3358
|
+
else if (typeof vnode.tag === "function") adoptComponent(...componentArgs(vnode), void 0, vnode._loc);
|
|
3359
|
+
else adoptVNodeKinds(vnode);
|
|
3360
|
+
}
|
|
3361
|
+
function _adoptVNodeKinds(vnode) {
|
|
3362
|
+
const tag = vnode.tag;
|
|
3363
|
+
if (tag === "__errorBoundary") {
|
|
3364
|
+
hydrateErrorBoundary(vnode);
|
|
3365
|
+
return;
|
|
3366
|
+
}
|
|
3367
|
+
if (tag === "__suspense") {
|
|
3368
|
+
hydrateSuspense(vnode);
|
|
3369
|
+
return;
|
|
3370
|
+
}
|
|
3371
|
+
const c = cur;
|
|
3372
|
+
if (tag.startsWith("__")) {
|
|
3373
|
+
const placeholder = clientBuild(vnodeRenderer, vnode, c.p);
|
|
3374
|
+
if (placeholder) c.p.insertBefore(placeholder, c.n);
|
|
3375
|
+
return;
|
|
3376
|
+
}
|
|
3377
|
+
const el = takeElement(c, tag);
|
|
3378
|
+
if (el === null) {
|
|
3379
|
+
recover(c, clientBuild(vnodeRenderer, vnode, c.p, _isSvgParent(c.p)), `<${tag}>`);
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3382
|
+
if (tag === "input" || tag === "select" || tag === "textarea") _keepControl(el);
|
|
3383
|
+
const props = vnode.props || {};
|
|
3384
|
+
hydrateElementProps(el, props);
|
|
3385
|
+
const html = props.dangerouslySetInnerHTML ?? props.innerHTML;
|
|
3386
|
+
if (html != null || tag === "noscript") return;
|
|
3387
|
+
const children = vnode.children;
|
|
3388
|
+
const empty = !children || children.length === 0;
|
|
3389
|
+
if (empty && tag === "textarea") {
|
|
3390
|
+
if (props.defaultValue === void 0) el.defaultValue = "";
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
if (empty && (el.firstChild === null || props["data-island"] != null)) return;
|
|
3394
|
+
enterNode(el, null);
|
|
3395
|
+
try {
|
|
3396
|
+
if (!empty) adoptEach(children);
|
|
3397
|
+
finish(cur);
|
|
3398
|
+
} finally {
|
|
3399
|
+
cur = outer.pop();
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
function hydrateElementProps(el, props) {
|
|
3403
|
+
const fold = props.classList != null;
|
|
3404
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
3405
|
+
const want = new Set(fold ? ["class"] : []);
|
|
3406
|
+
for (const key in props) {
|
|
3407
|
+
const name = attrOf(el, key);
|
|
3408
|
+
if (name !== null) want.add(name);
|
|
3409
|
+
}
|
|
3410
|
+
watchAttrs(el, want);
|
|
3411
|
+
}
|
|
3412
|
+
if (fold) el.removeAttribute("class");
|
|
3413
|
+
let svg = null;
|
|
3414
|
+
const raw = props.dangerouslySetInnerHTML ?? props.innerHTML;
|
|
3415
|
+
const keepHtml = raw != null && typeof raw === "object" && el.innerHTML === (raw.__html ?? "");
|
|
3416
|
+
const names = el.hasAttributes() ? el.getAttributeNames() : null;
|
|
3417
|
+
let named = 0;
|
|
3418
|
+
let twice = false;
|
|
3419
|
+
for (const key in props) {
|
|
3420
|
+
const value = props[key];
|
|
3421
|
+
const name = attrOf(el, key);
|
|
3422
|
+
if (name === null) {
|
|
3423
|
+
if (key === "ref") applyRef(value, el);
|
|
3424
|
+
else if (key.startsWith("$$")) {
|
|
3425
|
+
el[key] = value;
|
|
3426
|
+
el.$$owner = getOwner();
|
|
3427
|
+
} else if (key !== "children" && key !== "key" && !(keepHtml && (key === "innerHTML" || key === "dangerouslySetInnerHTML"))) {
|
|
3428
|
+
vnodeProp(el, key, value, svg ??= _hasSVGElement && el instanceof SVGElement);
|
|
3429
|
+
}
|
|
3430
|
+
continue;
|
|
3431
|
+
}
|
|
3432
|
+
const current = names === null ? null : el.getAttribute(name);
|
|
3433
|
+
if (current !== null) {
|
|
3434
|
+
named++;
|
|
3435
|
+
if (!twice && (name !== key || key !== key.toLowerCase())) {
|
|
3436
|
+
twice = name !== key && Object.hasOwn(props, name) || name.toLowerCase() !== key && Object.hasOwn(props, name.toLowerCase());
|
|
3437
|
+
}
|
|
3438
|
+
if (!(fold && name === "class")) {
|
|
3439
|
+
if (keepsAttr(el, key, value, current)) continue;
|
|
3440
|
+
if (typeof value === "function" && key !== "value") {
|
|
3441
|
+
hydrateReactiveProp(el, key, value, svg ??= _hasSVGElement && el instanceof SVGElement, name);
|
|
3442
|
+
continue;
|
|
3443
|
+
}
|
|
3444
|
+
if (key === "value") el.removeAttribute(name);
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
vnodeProp(el, key, value, svg ??= _hasSVGElement && el instanceof SVGElement);
|
|
3448
|
+
}
|
|
3449
|
+
if (names !== null && (named !== names.length || twice)) dropUnrendered(el, props, fold, names);
|
|
3450
|
+
}
|
|
3451
|
+
function componentArgs(vnode) {
|
|
3452
|
+
const Component = _toFunctionComponent(vnode.tag);
|
|
3453
|
+
const props = vnode.props;
|
|
3454
|
+
const children = vnode.children || [];
|
|
3455
|
+
const merged = _copyProps(props);
|
|
3456
|
+
if (children.length > 0) _setOwnProp(merged, "children", children.length === 1 ? children[0] : children);
|
|
3457
|
+
const lazy = props && props._$lazyChildren;
|
|
3458
|
+
const slots = props && props._$slots;
|
|
3459
|
+
return [Component, merged, lazy || slots ? _installLazyChildren(Component, merged, lazy, slots) : null];
|
|
3460
|
+
}
|
|
3461
|
+
function adoptComponent(Component, props, endChildrenPass, site, devLoc) {
|
|
3462
|
+
if ((process.env.NODE_ENV !== "production") && hotRecordOf !== null) {
|
|
3463
|
+
const record = hotOf(Component);
|
|
3464
|
+
if (record !== void 0) return adoptHot(record, props, endChildrenPass, site, devLoc);
|
|
3465
|
+
}
|
|
3466
|
+
if ((process.env.NODE_ENV !== "production") && props[PROPS] !== 2) Object.freeze(props);
|
|
3467
|
+
_takeFlat();
|
|
3468
|
+
const owner = _componentOwner(Component);
|
|
3469
|
+
if ((process.env.NODE_ENV !== "production")) {
|
|
3470
|
+
if (devLoc) owner.devLoc = devLoc;
|
|
3471
|
+
owner._parentCtx = parentComponent(owner);
|
|
3472
|
+
_devMounted(owner);
|
|
3473
|
+
}
|
|
3474
|
+
const c = cur;
|
|
3475
|
+
const outerKey = pendingKey;
|
|
3476
|
+
const serverKey = serverKeyAt(c);
|
|
3477
|
+
const stepped = _assignHydrationOwnerPath(owner, session.ownerRoot, serverKey, session.ordered, site);
|
|
3478
|
+
const key = owner._ownerPath;
|
|
3479
|
+
if (stepped !== 0) pendingKey = key !== void 0 && key[0] !== "~" ? key : null;
|
|
3480
|
+
if (stepped === 2 && !session.lenient) {
|
|
3481
|
+
_runOwned(owner, () => mismatch("key", `data-hk="${key.slice(1)}"`, `data-hk="${serverKey}"`, past(c), "none"));
|
|
3482
|
+
}
|
|
3483
|
+
splitHere(c);
|
|
3484
|
+
const anchor = anchorOf(c);
|
|
3485
|
+
const held = _holdUser();
|
|
3486
|
+
const depth = outer.length;
|
|
3487
|
+
let result;
|
|
3488
|
+
try {
|
|
3489
|
+
result = _runOwned(owner, Component, props);
|
|
3490
|
+
if (endChildrenPass !== null) endChildrenPass(owner);
|
|
3491
|
+
_runOwned(owner, adoptOutput, result);
|
|
3492
|
+
} catch (error) {
|
|
3493
|
+
cur = c;
|
|
3494
|
+
outer.length = depth;
|
|
3495
|
+
pendingKey = outerKey;
|
|
3496
|
+
_disposeOwner(owner);
|
|
3497
|
+
const left = error != null && typeof error.then === "function" && _handlePending(owner.owner, error) ? HANDLED : componentFailed(error, owner.owner);
|
|
3498
|
+
if (left !== HANDLED) console.error("[what] Error in component during hydration:", Component.name || "Anonymous", left);
|
|
3499
|
+
return [];
|
|
3500
|
+
} finally {
|
|
3501
|
+
_releaseUser(held);
|
|
3502
|
+
}
|
|
3503
|
+
if (stepped !== 0 && pendingKey === key) pendingKey = outerKey;
|
|
3504
|
+
const start = afterAnchor(c, anchor);
|
|
3505
|
+
if ((process.env.NODE_ENV !== "production") && start !== null && start !== c.n) {
|
|
3506
|
+
owner._wrapper = start;
|
|
3507
|
+
_devAnchor(start, owner);
|
|
3508
|
+
}
|
|
3509
|
+
if (result != null && start === result && start.nextSibling === c.n && start.nodeType === 1) return start;
|
|
3510
|
+
const nodes = [];
|
|
3511
|
+
for (let n = start; n !== null && n !== c.n; n = n.nextSibling) nodes.push(n);
|
|
3512
|
+
return nodes;
|
|
3513
|
+
}
|
|
3514
|
+
function adoptOutput(result) {
|
|
3515
|
+
adopt(typeof result === "function" && result._lazyChildren ? result() : result);
|
|
3516
|
+
}
|
|
3517
|
+
function adoptRegion(fn, devName) {
|
|
3518
|
+
const c = cur;
|
|
3519
|
+
const parent = c.p;
|
|
3520
|
+
pendingKey = null;
|
|
3521
|
+
const at = nextOwn(c);
|
|
3522
|
+
const close = at !== null && !fn._forward && isMarker(at, REGION_OPEN) ? closeOf(at, REGION_CLOSE) : null;
|
|
3523
|
+
let start = null;
|
|
3524
|
+
let end = close;
|
|
3525
|
+
const startNode = c.n;
|
|
3526
|
+
const startAt = c.o;
|
|
3527
|
+
let anchor = null;
|
|
3528
|
+
if (close !== null) {
|
|
3529
|
+
start = /** @type {Node} */
|
|
3530
|
+
at;
|
|
3531
|
+
outer.push(c);
|
|
3532
|
+
cur = { p: parent, n: start.nextSibling, o: 0, x: false, e: close, h: true, t: null };
|
|
3533
|
+
} else {
|
|
3534
|
+
anchor = startAt > 0 ? startNode : anchorOf(c);
|
|
3535
|
+
}
|
|
3536
|
+
const scope = vnodeRows !== null ? getOwner() : null;
|
|
3537
|
+
let current = null;
|
|
3538
|
+
let rows = null;
|
|
3539
|
+
let first = true;
|
|
3540
|
+
let keep = true;
|
|
3541
|
+
let text = false;
|
|
3542
|
+
let textNode = null;
|
|
3543
|
+
let written = "";
|
|
3544
|
+
try {
|
|
3545
|
+
effect(() => {
|
|
3546
|
+
if (first) {
|
|
3547
|
+
first = false;
|
|
3548
|
+
let value2;
|
|
3549
|
+
try {
|
|
3550
|
+
value2 = fn();
|
|
3551
|
+
} catch (error) {
|
|
3552
|
+
if (close !== null) {
|
|
3553
|
+
cur.n = close;
|
|
3554
|
+
cur.o = 0;
|
|
3555
|
+
cur.x = false;
|
|
3556
|
+
}
|
|
3557
|
+
throw error;
|
|
3558
|
+
}
|
|
3559
|
+
keep = _tracking();
|
|
3560
|
+
const w = cur;
|
|
3561
|
+
text = typeof value2 === "string" && value2 !== "" || typeof value2 === "number";
|
|
3562
|
+
if (keep && text && close === null && w.n === startNode && w.o === startAt && (textNode = claimOwnText(w, written = String(value2))) !== null) return;
|
|
3563
|
+
if (close !== null && (rows = vnodeRows?.adopt?.(value2, scope, start, close) ?? null) !== null) w.n = close;
|
|
3564
|
+
else if (vnodeRows !== null && (isVNode(value2) ? value2.key != null : keyedVNodes(value2) && value2.length > 0)) {
|
|
3565
|
+
const open = nextOwn(w);
|
|
3566
|
+
rows = adoptVNodeRows(Array.isArray(value2) ? value2 : [value2], scope);
|
|
3567
|
+
if (isMarker(open, ARRAY_OPEN)) current = open;
|
|
3568
|
+
} else if (close === null && (value2 == null || value2 === false || value2 === "") && nextOwn(w) !== null && w.n.nodeType === 3) {
|
|
3569
|
+
if (!frozen()) w.x = 1;
|
|
3570
|
+
} else {
|
|
3571
|
+
adopt(value2);
|
|
3572
|
+
}
|
|
3573
|
+
return;
|
|
3574
|
+
}
|
|
3575
|
+
const value = fn();
|
|
3576
|
+
if (textNode !== null) {
|
|
3577
|
+
if (textNode.nodeType === 1) textNode = partNode(textNode);
|
|
3578
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
3579
|
+
const data = String(value);
|
|
3580
|
+
if (data !== written) textNode.data = written = data;
|
|
3581
|
+
if (textNode.parentNode !== null) textWritten(textNode.parentNode, data);
|
|
3582
|
+
return;
|
|
3583
|
+
}
|
|
3584
|
+
const host2 = textNode.parentNode;
|
|
3585
|
+
if (host2 === null) return;
|
|
3586
|
+
start = host2.insertBefore(document.createComment(REGION_OPEN), textNode);
|
|
3587
|
+
end = host2.insertBefore(document.createComment(REGION_CLOSE), textNode.nextSibling);
|
|
3588
|
+
start._rangeEnd = end;
|
|
3589
|
+
current = textNode;
|
|
3590
|
+
textNode = null;
|
|
3591
|
+
}
|
|
3592
|
+
const host = end.parentNode;
|
|
3593
|
+
if (host === null) return;
|
|
3594
|
+
if (current === void 0) {
|
|
3595
|
+
const owned = [];
|
|
3596
|
+
for (let n = start.nextSibling; n !== null && n !== end; n = n.nextSibling) owned.push(n);
|
|
3597
|
+
current = owned.length === 0 ? null : owned.length === 1 ? owned[0] : owned;
|
|
3598
|
+
}
|
|
3599
|
+
if (vnodeRows !== null) {
|
|
3600
|
+
const keyed = vnodeRows(value, rows, false, scope);
|
|
3601
|
+
if (keyed !== null) {
|
|
3602
|
+
if (current !== null) current = reconcileInsert(host, null, current, end);
|
|
3603
|
+
rows = keyed;
|
|
3604
|
+
rows.update(host, end, value);
|
|
3605
|
+
return;
|
|
3606
|
+
}
|
|
3607
|
+
if (rows !== null) {
|
|
3608
|
+
rows.remove();
|
|
3609
|
+
optionsChanged(host);
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
current = reconcileInsert(host, value, current, end);
|
|
3613
|
+
}, (process.env.NODE_ENV !== "production") ? { name: devName || fn.name || "region", binding: parent } : void 0);
|
|
3614
|
+
if (close !== null) finish(cur);
|
|
3615
|
+
} finally {
|
|
3616
|
+
if (close !== null) cur = outer.pop();
|
|
3617
|
+
}
|
|
3618
|
+
if (close !== null) {
|
|
3619
|
+
c.n = close.nextSibling;
|
|
3620
|
+
c.o = 0;
|
|
3621
|
+
c.x = false;
|
|
3622
|
+
if (!keep) return;
|
|
3623
|
+
} else {
|
|
3624
|
+
if (!keep || textNode !== null) return;
|
|
3625
|
+
if (startAt > 0 && startNode.data.length > startAt) {
|
|
3626
|
+
const rest = startNode.splitText(startAt);
|
|
3627
|
+
for (const p of (rest.$p = startNode.$p) || []) {
|
|
3628
|
+
if (p.a >= startAt) {
|
|
3629
|
+
p.n = rest;
|
|
3630
|
+
p.a -= startAt;
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
if (c.n === startNode) {
|
|
3634
|
+
c.n = rest;
|
|
3635
|
+
c.o -= startAt;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
splitHere(c);
|
|
3639
|
+
const node = afterAnchor(c, anchor);
|
|
3640
|
+
if (text && rows === null && node !== c.n && node.nodeType === 3 && node.nextSibling === c.n) {
|
|
3641
|
+
textNode = /** @type {Text} */
|
|
3642
|
+
node;
|
|
3643
|
+
written = textNode.data;
|
|
3644
|
+
return;
|
|
3645
|
+
}
|
|
3646
|
+
start = parent.insertBefore(document.createComment(REGION_OPEN), node);
|
|
3647
|
+
end = parent.insertBefore(document.createComment(REGION_CLOSE), c.n);
|
|
3648
|
+
}
|
|
3649
|
+
if (rows === null) current = void 0;
|
|
3650
|
+
start._rangeEnd = end;
|
|
3651
|
+
}
|
|
3652
|
+
function _adoptVNodeRows(value, scope) {
|
|
3653
|
+
const c = cur;
|
|
3654
|
+
const at = nextOwn(c);
|
|
3655
|
+
const close = at !== null && isMarker(at, ARRAY_OPEN) ? closeOf(at, ARRAY_CLOSE) : null;
|
|
3656
|
+
const order = close !== null ? inServerOrder(at, close, value, vnodeKey) : null;
|
|
3657
|
+
const vnodes = order === null ? value : order.map((i) => value[i]);
|
|
3658
|
+
const rows = [];
|
|
3659
|
+
const list = {};
|
|
3660
|
+
const adoptRows = () => {
|
|
3661
|
+
const rc = cur;
|
|
3662
|
+
for (let i = 0; i < vnodes.length; i++) {
|
|
3663
|
+
const vnode = vnodes[i];
|
|
3664
|
+
rows.push(runWithOwner(scope, () => createRoot((dispose) => {
|
|
3665
|
+
rowStart(rc);
|
|
3666
|
+
splitHere(rc);
|
|
3667
|
+
const anchor = anchorOf(rc);
|
|
3668
|
+
adoptRow(list, vnode.key, adopt, vnode);
|
|
3669
|
+
splitHere(rc);
|
|
3670
|
+
let first = afterAnchor(rc, anchor);
|
|
3671
|
+
let last = anchorOf(rc);
|
|
3672
|
+
if (first === rc.n) first = last = rc.p.insertBefore(document.createComment(""), rc.n);
|
|
3673
|
+
else {
|
|
3674
|
+
if (first.nodeType === 3) first = rc.p.insertBefore(document.createComment(""), first);
|
|
3675
|
+
if (last.nodeType === 3) last = rc.p.insertBefore(document.createComment(""), rc.n);
|
|
3676
|
+
}
|
|
3677
|
+
return { key: vnode.key, vnode, dispose, first, last };
|
|
3678
|
+
})));
|
|
3679
|
+
}
|
|
3680
|
+
};
|
|
3681
|
+
let end;
|
|
3682
|
+
if (close !== null) {
|
|
3683
|
+
within(at, close, adoptRows);
|
|
3684
|
+
end = close;
|
|
3685
|
+
} else {
|
|
3686
|
+
adoptRows();
|
|
3687
|
+
splitHere(c);
|
|
3688
|
+
end = c.p.insertBefore(document.createComment("/list"), c.n);
|
|
3689
|
+
}
|
|
3690
|
+
const kept = (
|
|
3691
|
+
/** @type {Function} */
|
|
3692
|
+
vnodeRows(null, null, false, scope, end, rows)
|
|
3693
|
+
);
|
|
3694
|
+
if (vnodes !== value) kept.update(end.parentNode, end, value);
|
|
3695
|
+
return kept;
|
|
3696
|
+
}
|
|
3697
|
+
function vnodeKey(vnode) {
|
|
3698
|
+
return vnode.key;
|
|
3699
|
+
}
|
|
3700
|
+
function inServerOrder(open, close, items, keyFn) {
|
|
3701
|
+
const n = open.nextSibling;
|
|
3702
|
+
if (n === close || n.nodeType !== 8 || !isRowKeys(n.data)) return null;
|
|
3703
|
+
n.remove();
|
|
3704
|
+
const keys = items.map(keyFn);
|
|
3705
|
+
const salt = n.data.slice(2, 2 + DIGEST_LENGTH);
|
|
3706
|
+
const written = n.data.slice(3 + DIGEST_LENGTH);
|
|
3707
|
+
if (n.data[2 + DIGEST_LENGTH] === ":" && _rowKeysInOrder(keys, salt, written)) return null;
|
|
3708
|
+
return compareRowKeys(open, close, n.data, keys, salt, written);
|
|
3709
|
+
}
|
|
3710
|
+
function compareRowKeys(open, close, data, keys, salt, written) {
|
|
3711
|
+
const mine = keys.map((key) => _rowKeyDigest(key, salt));
|
|
3712
|
+
const theirs = data === "k!" || data[2 + DIGEST_LENGTH] !== ":" || written.length % DIGEST_LENGTH !== 0 ? null : Array.from({ length: written.length / DIGEST_LENGTH }, (_, i) => written.slice(i * DIGEST_LENGTH, (i + 1) * DIGEST_LENGTH));
|
|
3713
|
+
const byDigest = /* @__PURE__ */ new Map();
|
|
3714
|
+
mine.forEach((digest, i) => {
|
|
3715
|
+
const list = byDigest.get(digest);
|
|
3716
|
+
if (list === void 0) byDigest.set(digest, [i]);
|
|
3717
|
+
else if (list.length > 0 && keys[list[0]] === keys[i]) list.push(i);
|
|
3718
|
+
else list.length = 0;
|
|
3719
|
+
});
|
|
3720
|
+
if (theirs !== null && theirs.length === mine.length && theirs.every((digest, i) => digest === mine[i] && byDigest.get(digest).length > 0)) return null;
|
|
3721
|
+
const order = [];
|
|
3722
|
+
for (const digest of theirs || []) {
|
|
3723
|
+
const list = byDigest.get(digest);
|
|
3724
|
+
if (list === void 0 || list.length === 0) {
|
|
3725
|
+
order.length = 0;
|
|
3726
|
+
break;
|
|
3727
|
+
}
|
|
3728
|
+
order.push(list.shift());
|
|
3729
|
+
}
|
|
3730
|
+
if (order.length === 0) {
|
|
3731
|
+
while (open.nextSibling !== close) open.nextSibling.remove();
|
|
3732
|
+
}
|
|
3733
|
+
const describeKeys = (list) => short(list.slice(0, 40).map(String).join());
|
|
3734
|
+
mismatch("key", describeKeys(keys), order.length > 0 ? describeKeys(order.map((i) => keys[i])) : theirs === null ? "keys it cannot compare" : "rows of other keys", open, order.length > 0 ? "move" : "client-render");
|
|
3735
|
+
return order;
|
|
3736
|
+
}
|
|
3737
|
+
function adoptList(inserter) {
|
|
3738
|
+
const [source, mapFn, keyFn, keyedSignals, list, slot] = inserter._list;
|
|
3739
|
+
const c = cur;
|
|
3740
|
+
const parent = c.p;
|
|
3741
|
+
pendingKey = null;
|
|
3742
|
+
const fallback = inserter._fallback;
|
|
3743
|
+
if (list !== inserter && fallback === void 0) {
|
|
3744
|
+
placeInserter(c, inserter);
|
|
3745
|
+
return;
|
|
3746
|
+
}
|
|
3747
|
+
const args = [source, mapFn, keyFn, keyedSignals, parent, slot];
|
|
3748
|
+
const adoptAll = fallback === void 0 ? adoptListRows : () => {
|
|
3749
|
+
adoptListRows(args);
|
|
3750
|
+
adoptRegion(fallback);
|
|
3751
|
+
};
|
|
3752
|
+
const at = nextOwn(c);
|
|
3753
|
+
const regionClose = at !== null && isMarker(at, REGION_OPEN) ? closeOf(at, REGION_CLOSE) : null;
|
|
3754
|
+
if (regionClose !== null) within(at, regionClose, adoptAll, args);
|
|
3755
|
+
else adoptAll(args);
|
|
3756
|
+
}
|
|
3757
|
+
function adoptListRows([source, mapFn, keyFn, keyedSignals, parent, slot]) {
|
|
3758
|
+
const c = cur;
|
|
3759
|
+
const at = nextOwn(c);
|
|
3760
|
+
const close = at !== null && isMarker(at, ARRAY_OPEN) ? closeOf(at, ARRAY_CLOSE) : null;
|
|
3761
|
+
let start = at;
|
|
3762
|
+
if (close === null) {
|
|
3763
|
+
splitHere(c);
|
|
3764
|
+
start = c.p.insertBefore(document.createComment("list"), c.n);
|
|
3765
|
+
}
|
|
3766
|
+
let items = [];
|
|
3767
|
+
const mappedNodes = [];
|
|
3768
|
+
const disposeFns = [];
|
|
3769
|
+
let endMarker = close;
|
|
3770
|
+
let first = true;
|
|
3771
|
+
let order = null;
|
|
3772
|
+
const list = keyFn !== itemKey ? { slot } : null;
|
|
3773
|
+
const adoptRows = (newItems) => {
|
|
3774
|
+
const rc = cur;
|
|
3775
|
+
for (let i = 0; i < newItems.length; i++) {
|
|
3776
|
+
const item = newItems[i];
|
|
3777
|
+
const cell = keyedSignals === RAW ? null : _rowItem(item);
|
|
3778
|
+
rowStart(rc);
|
|
3779
|
+
splitHere(rc);
|
|
3780
|
+
const anchor = anchorOf(rc);
|
|
3781
|
+
const build = () => _runScope(_itemScope(void 0, disposeFns, i), mapFn, cell === null ? item : keyedSignals === FOLLOW ? cell : () => _readRowItem(cell), order === null ? i : order[i], item, adopt);
|
|
3782
|
+
if (list === null) build();
|
|
3783
|
+
else adoptRow(list, keyFn(item, i), build);
|
|
3784
|
+
if (cell !== null) {
|
|
3785
|
+
cell.building = false;
|
|
3786
|
+
disposeFns[i]._item = cell;
|
|
3787
|
+
}
|
|
3788
|
+
splitHere(rc);
|
|
3789
|
+
const first2 = afterAnchor(rc, anchor);
|
|
3790
|
+
const single = first2 !== rc.n && first2.nextSibling === rc.n && first2.nodeType === 1;
|
|
3791
|
+
mappedNodes[i] = single ? first2 : anchor !== start && isMarker(anchor, ARRAY_OPEN) ? anchor : rc.p.insertBefore(document.createComment("i"), first2);
|
|
3792
|
+
}
|
|
3793
|
+
};
|
|
3794
|
+
let held = false;
|
|
3795
|
+
if ((process.env.NODE_ENV !== "production")) setNextBinding(endMarker || parent, source._listLoc ? `list@${source._listLoc}` : "list");
|
|
3796
|
+
effect(() => {
|
|
3797
|
+
let newItems;
|
|
3798
|
+
if (first) {
|
|
3799
|
+
first = false;
|
|
3800
|
+
try {
|
|
3801
|
+
newItems = source() || [];
|
|
3802
|
+
} catch (error) {
|
|
3803
|
+
held = true;
|
|
3804
|
+
if (close !== null) {
|
|
3805
|
+
c.n = close.nextSibling;
|
|
3806
|
+
c.o = 0;
|
|
3807
|
+
c.x = false;
|
|
3808
|
+
}
|
|
3809
|
+
throw error;
|
|
3810
|
+
}
|
|
3811
|
+
order = close !== null ? inServerOrder(at, close, newItems, keyFn) : null;
|
|
3812
|
+
if (list !== null && rowEntry !== null) rowEntry(void 0, session.ownerRoot, list, void 0);
|
|
3813
|
+
const adopted = order === null ? newItems : order.map((i) => newItems[i]);
|
|
3814
|
+
if (close !== null) within(at, close, adoptRows, adopted);
|
|
3815
|
+
else adoptRows(adopted);
|
|
3816
|
+
if (adopted !== newItems) {
|
|
3817
|
+
for (let i = 0; i < mappedNodes.length; i++) mappedNodes[i]._$row = endMarker;
|
|
3818
|
+
clientBuild(() => reconcileKeyed(endMarker.parentNode || parent, endMarker, adopted, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedSignals));
|
|
3819
|
+
}
|
|
3820
|
+
} else {
|
|
3821
|
+
newItems = source() || [];
|
|
3822
|
+
if (held) {
|
|
3823
|
+
held = false;
|
|
3824
|
+
while (start.nextSibling !== null && start.nextSibling !== endMarker) start.nextSibling.remove();
|
|
3825
|
+
}
|
|
3826
|
+
const host = endMarker.parentNode || parent;
|
|
3827
|
+
reconcileKeyed(host, endMarker, items, newItems, mappedNodes, disposeFns, mapFn, keyFn, keyedSignals);
|
|
3828
|
+
optionsChanged(host);
|
|
3829
|
+
}
|
|
3830
|
+
items = newItems.length > 0 ? newItems.slice() : newItems;
|
|
3831
|
+
});
|
|
3832
|
+
onCleanup(() => {
|
|
3833
|
+
disposeRows(disposeFns, disposeFns.length);
|
|
3834
|
+
mappedNodes.length = 0;
|
|
3835
|
+
disposeFns.length = 0;
|
|
3836
|
+
});
|
|
3837
|
+
if (endMarker === null) {
|
|
3838
|
+
splitHere(c);
|
|
3839
|
+
endMarker = c.p.insertBefore(document.createComment("/list"), c.n);
|
|
3840
|
+
}
|
|
3841
|
+
start._rangeEnd = endMarker;
|
|
3842
|
+
for (let i = 0; i < mappedNodes.length; i++) mappedNodes[i]._$row = endMarker;
|
|
3843
|
+
}
|
|
3844
|
+
function placeInserter(c, inserter) {
|
|
3845
|
+
const at = nextOwn(c);
|
|
3846
|
+
const close = at !== null && isMarker(at, REGION_OPEN) ? closeOf(at, REGION_CLOSE) : null;
|
|
3847
|
+
if (close !== null) {
|
|
3848
|
+
for (let n = at.nextSibling; n !== close; ) {
|
|
3849
|
+
const following = n.nextSibling;
|
|
3850
|
+
n.remove();
|
|
3851
|
+
n = following;
|
|
3852
|
+
}
|
|
3853
|
+
c.n = close;
|
|
3854
|
+
}
|
|
3855
|
+
clientBuild(inserter, c.p, c.n);
|
|
3856
|
+
if (close !== null) c.n = close.nextSibling;
|
|
3857
|
+
}
|
|
3858
|
+
function boundaryAt(c) {
|
|
3859
|
+
let at = nextOwn(c);
|
|
3860
|
+
while (at !== null && isMarker(at, ARRAY_OPEN)) {
|
|
3861
|
+
c.n = at.nextSibling;
|
|
3862
|
+
at = nextOwn(c);
|
|
3863
|
+
}
|
|
3864
|
+
return at;
|
|
3865
|
+
}
|
|
3866
|
+
function boundaryClose(at) {
|
|
3867
|
+
return at !== null && (isMarker(at, BOUNDARY_OPEN) || isMarker(at, BOUNDARY_FALLBACK)) ? closeOf(at, BOUNDARY_CLOSE) : null;
|
|
3868
|
+
}
|
|
3869
|
+
function awaitStream(at, close, adoptFallback, resume) {
|
|
3870
|
+
const placeholder = at.nextSibling;
|
|
3871
|
+
if (at.data !== BOUNDARY_OPEN || placeholder === null || placeholder.nodeType !== 1 || placeholder.localName !== "template" || !placeholder.id.startsWith("pl-") || _swapArrived(placeholder)) return false;
|
|
3872
|
+
const id = placeholder.id.slice(3);
|
|
3873
|
+
const fallbackEnd = commentAfter(placeholder, "pl-" + id);
|
|
3874
|
+
const owner = getOwner();
|
|
3875
|
+
const holder = _ownerCounter(_currentComponent(), session.ownerRoot);
|
|
3876
|
+
const counter = holder._ownerChildren;
|
|
3877
|
+
const { root, onError, ownerRoot } = session;
|
|
3878
|
+
within(at, close, () => {
|
|
3879
|
+
const pc = cur;
|
|
3880
|
+
pc.n = placeholder.nextSibling;
|
|
3881
|
+
if (fallbackEnd !== null) pc.e = fallbackEnd;
|
|
3882
|
+
adoptFallback();
|
|
3883
|
+
if (fallbackEnd !== null) {
|
|
3884
|
+
finish(pc);
|
|
3885
|
+
pc.e = close;
|
|
3886
|
+
pc.n = fallbackEnd.nextSibling;
|
|
3887
|
+
}
|
|
3888
|
+
});
|
|
3889
|
+
const entry = () => {
|
|
3890
|
+
if (waiting.get(id) === entry) waiting.delete(id);
|
|
3891
|
+
if (at.parentNode === null || owner !== null && _isDisposed(owner)) return;
|
|
3892
|
+
runWithOwner(owner, () => resume((fn) => resumeIn(newSession(root, onError, ownerRoot), at, close, () => {
|
|
3893
|
+
holder._ownerChildren = counter;
|
|
3894
|
+
fn();
|
|
3895
|
+
})));
|
|
3896
|
+
};
|
|
3897
|
+
waiting.set(id, entry);
|
|
3898
|
+
onCleanup(() => {
|
|
3899
|
+
if (waiting.get(id) === entry) waiting.delete(id);
|
|
3900
|
+
});
|
|
3901
|
+
installResumeHook();
|
|
3902
|
+
return true;
|
|
3903
|
+
}
|
|
3904
|
+
function adoptLeniently(content) {
|
|
3905
|
+
session.lenient = true;
|
|
3906
|
+
try {
|
|
3907
|
+
return createRoot((dispose) => {
|
|
3908
|
+
adopt(content);
|
|
3909
|
+
return dispose;
|
|
3910
|
+
});
|
|
3911
|
+
} finally {
|
|
3912
|
+
session.lenient = false;
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
function hydrateErrorBoundary(vnode) {
|
|
3916
|
+
const { errorState, reset, handleError } = vnode.props;
|
|
3917
|
+
const children = vnode.children || [];
|
|
3918
|
+
const contentFor = (error) => {
|
|
3919
|
+
if (!error) return children;
|
|
3920
|
+
const fallback = vnode.props.fallback;
|
|
3921
|
+
return typeof fallback === "function" ? _toFunctionComponent(fallback)({ error, reset }) : fallback;
|
|
3922
|
+
};
|
|
3923
|
+
const c = cur;
|
|
3924
|
+
const parent = c.p;
|
|
3925
|
+
const owner = getOwner();
|
|
3926
|
+
pendingKey = null;
|
|
3927
|
+
const at = boundaryAt(c);
|
|
3928
|
+
const close = boundaryClose(at);
|
|
3929
|
+
let startComment = at;
|
|
3930
|
+
let endComment = close;
|
|
3931
|
+
let arm = null;
|
|
3932
|
+
let armAfterWalk = untrack(errorState);
|
|
3933
|
+
let regionHoldsArm = true;
|
|
3934
|
+
const buildChildren = () => clientBuild(() => createRoot((dispose) => {
|
|
3935
|
+
getOwner()._onError = handleError;
|
|
3936
|
+
const nodes = [];
|
|
3937
|
+
const at2 = cur;
|
|
3938
|
+
const depth = outer.length;
|
|
3939
|
+
try {
|
|
3940
|
+
for (const child of children) {
|
|
3941
|
+
const node = (
|
|
3942
|
+
/** @type {Function} */
|
|
3943
|
+
vnodeRenderer(child, parent)
|
|
3944
|
+
);
|
|
3945
|
+
if (node) nodes.push(node);
|
|
3946
|
+
}
|
|
3947
|
+
} catch (error) {
|
|
3948
|
+
cur = at2;
|
|
3949
|
+
outer.length = depth;
|
|
3950
|
+
handleError(error);
|
|
3951
|
+
}
|
|
3952
|
+
return { dispose, nodes };
|
|
3953
|
+
}));
|
|
3954
|
+
const adoptFallback = () => {
|
|
3955
|
+
arm = adoptLeniently(contentFor(armAfterWalk || true));
|
|
3956
|
+
};
|
|
3957
|
+
const adoptChildren = (bracketed) => {
|
|
3958
|
+
const dispose = createRoot((dispose2) => {
|
|
3959
|
+
getOwner()._onError = handleError;
|
|
3960
|
+
const at2 = cur;
|
|
3961
|
+
const depth = outer.length;
|
|
3962
|
+
try {
|
|
3963
|
+
adoptEach(children);
|
|
3964
|
+
} catch (error) {
|
|
3965
|
+
cur = at2;
|
|
3966
|
+
outer.length = depth;
|
|
3967
|
+
handleError(error);
|
|
3968
|
+
}
|
|
3969
|
+
return dispose2;
|
|
3970
|
+
});
|
|
3971
|
+
armAfterWalk = untrack(errorState);
|
|
3972
|
+
if (armAfterWalk) {
|
|
3973
|
+
dispose();
|
|
3974
|
+
regionHoldsArm = false;
|
|
3975
|
+
if (bracketed) {
|
|
3976
|
+
cur.n = cur.e;
|
|
3977
|
+
cur.o = 0;
|
|
3978
|
+
cur.x = false;
|
|
3979
|
+
}
|
|
3980
|
+
} else {
|
|
3981
|
+
arm = dispose;
|
|
3982
|
+
}
|
|
3983
|
+
};
|
|
3984
|
+
const childrenOrFallback = () => {
|
|
3985
|
+
const built = buildChildren();
|
|
3986
|
+
armAfterWalk = untrack(errorState);
|
|
3987
|
+
if (armAfterWalk) {
|
|
3988
|
+
built.dispose();
|
|
3989
|
+
adoptFallback();
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
for (let n = cur.n; n !== null && n !== cur.e; ) {
|
|
3993
|
+
const following = n.nextSibling;
|
|
3994
|
+
n.remove();
|
|
3995
|
+
n = following;
|
|
3996
|
+
}
|
|
3997
|
+
cur.n = cur.e;
|
|
3998
|
+
cur.o = 0;
|
|
3999
|
+
cur.x = false;
|
|
4000
|
+
for (const node of built.nodes) parent.insertBefore(node, cur.e);
|
|
4001
|
+
arm = built.dispose;
|
|
4002
|
+
};
|
|
4003
|
+
if (close === null) {
|
|
4004
|
+
splitHere(c);
|
|
4005
|
+
startComment = parent.insertBefore(document.createComment(BOUNDARY_OPEN), c.n);
|
|
4006
|
+
adoptChildren(false);
|
|
4007
|
+
splitHere(c);
|
|
4008
|
+
endComment = parent.insertBefore(document.createComment(BOUNDARY_CLOSE), c.n);
|
|
4009
|
+
watch();
|
|
4010
|
+
return;
|
|
4011
|
+
}
|
|
4012
|
+
if (awaitStream(at, close, adoptFallback, (walk) => {
|
|
4013
|
+
if (arm !== null) arm();
|
|
4014
|
+
arm = null;
|
|
4015
|
+
armAfterWalk = untrack(errorState);
|
|
4016
|
+
walk(() => {
|
|
4017
|
+
if (startComment.data === BOUNDARY_FALLBACK) childrenOrFallback();
|
|
4018
|
+
else adoptChildren(true);
|
|
4019
|
+
});
|
|
4020
|
+
watch();
|
|
4021
|
+
})) return;
|
|
4022
|
+
const caught = _caughtError(owner);
|
|
4023
|
+
if (caught !== void 0) {
|
|
4024
|
+
handleError(caught);
|
|
4025
|
+
armAfterWalk = untrack(errorState);
|
|
4026
|
+
within(at, close, at.data === BOUNDARY_FALLBACK ? adoptFallback : () => {
|
|
4027
|
+
regionHoldsArm = false;
|
|
4028
|
+
cur.n = cur.e;
|
|
4029
|
+
cur.o = 0;
|
|
4030
|
+
cur.x = false;
|
|
4031
|
+
});
|
|
4032
|
+
watch();
|
|
4033
|
+
return;
|
|
4034
|
+
}
|
|
4035
|
+
within(at, close, at.data === BOUNDARY_FALLBACK ? childrenOrFallback : () => adoptChildren(true));
|
|
4036
|
+
watch();
|
|
4037
|
+
function watch() {
|
|
4038
|
+
let claimedFromServer = true;
|
|
4039
|
+
effect(() => {
|
|
4040
|
+
const current = errorState();
|
|
4041
|
+
if (claimedFromServer) {
|
|
4042
|
+
claimedFromServer = false;
|
|
4043
|
+
if (regionHoldsArm && current === armAfterWalk) return;
|
|
4044
|
+
}
|
|
4045
|
+
const host = startComment.parentNode;
|
|
4046
|
+
if (!host) return;
|
|
4047
|
+
untrack(() => {
|
|
4048
|
+
if (arm !== null) arm();
|
|
4049
|
+
while (startComment.nextSibling && startComment.nextSibling !== endComment) host.removeChild(startComment.nextSibling);
|
|
4050
|
+
arm = runWithOwner(owner, () => createRoot((dispose) => {
|
|
4051
|
+
if (!current) getOwner()._onError = handleError;
|
|
4052
|
+
const content = clientBuild(contentFor, current);
|
|
4053
|
+
const vnodes = Array.isArray(content) ? content : [content];
|
|
4054
|
+
const depth = outer.length;
|
|
4055
|
+
try {
|
|
4056
|
+
for (const v of vnodes) {
|
|
4057
|
+
const node = clientBuild(
|
|
4058
|
+
/** @type {Function} */
|
|
4059
|
+
vnodeRenderer,
|
|
4060
|
+
v,
|
|
4061
|
+
host
|
|
4062
|
+
);
|
|
4063
|
+
if (node && endComment.parentNode) endComment.parentNode.insertBefore(node, endComment);
|
|
4064
|
+
}
|
|
4065
|
+
} catch (error) {
|
|
4066
|
+
outer.length = depth;
|
|
4067
|
+
if (current) throw error;
|
|
4068
|
+
handleError(error);
|
|
4069
|
+
}
|
|
4070
|
+
return dispose;
|
|
4071
|
+
}));
|
|
4072
|
+
});
|
|
4073
|
+
});
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
function hydrateSuspense(vnode) {
|
|
4077
|
+
const b = vnode.props.boundary;
|
|
4078
|
+
const children = vnode.children || [];
|
|
4079
|
+
const c = cur;
|
|
4080
|
+
const parent = c.p;
|
|
4081
|
+
const owner = getOwner();
|
|
4082
|
+
const { root, onError, ownerRoot } = session;
|
|
4083
|
+
pendingKey = null;
|
|
4084
|
+
const at = boundaryAt(c);
|
|
4085
|
+
const close = boundaryClose(at);
|
|
4086
|
+
let start = at;
|
|
4087
|
+
let end = close;
|
|
4088
|
+
const holder = document.createDocumentFragment();
|
|
4089
|
+
let fallbackShown = false;
|
|
4090
|
+
let fallbackArm = null;
|
|
4091
|
+
let childrenArm = null;
|
|
4092
|
+
const clear = () => {
|
|
4093
|
+
for (let n = start.nextSibling; n !== null && n !== end; n = start.nextSibling) n.remove();
|
|
4094
|
+
};
|
|
4095
|
+
const buildFallback = () => {
|
|
4096
|
+
fallbackShown = true;
|
|
4097
|
+
const content = clientBuild(() => b.fallback);
|
|
4098
|
+
fallbackArm = runWithOwner(owner, () => createRoot((dispose) => {
|
|
4099
|
+
for (const v of Array.isArray(content) ? content : [content]) {
|
|
4100
|
+
const node = clientBuild(
|
|
4101
|
+
/** @type {Function} */
|
|
4102
|
+
vnodeRenderer,
|
|
4103
|
+
v,
|
|
4104
|
+
end.parentNode
|
|
4105
|
+
);
|
|
4106
|
+
if (node) end.parentNode.insertBefore(node, end);
|
|
4107
|
+
}
|
|
4108
|
+
return dispose;
|
|
4109
|
+
}));
|
|
4110
|
+
};
|
|
4111
|
+
b.show = () => {
|
|
4112
|
+
if (fallbackShown) {
|
|
4113
|
+
fallbackShown = false;
|
|
4114
|
+
if (fallbackArm !== null) fallbackArm();
|
|
4115
|
+
fallbackArm = null;
|
|
4116
|
+
clear();
|
|
4117
|
+
}
|
|
4118
|
+
end.parentNode.insertBefore(holder, end);
|
|
4119
|
+
};
|
|
4120
|
+
b.conceal = () => {
|
|
4121
|
+
for (let n = start.nextSibling; n !== null && n !== end; n = start.nextSibling) holder.appendChild(n);
|
|
4122
|
+
buildFallback();
|
|
4123
|
+
};
|
|
4124
|
+
const build = () => {
|
|
4125
|
+
childrenArm = runWithOwner(owner, () => clientBuild(() => createRoot((dispose) => {
|
|
4126
|
+
b.attach(getOwner(), false);
|
|
4127
|
+
for (const child of children) {
|
|
4128
|
+
const node = (
|
|
4129
|
+
/** @type {Function} */
|
|
4130
|
+
vnodeRenderer(child, parent)
|
|
4131
|
+
);
|
|
4132
|
+
if (node) holder.appendChild(node);
|
|
4133
|
+
}
|
|
4134
|
+
return dispose;
|
|
4135
|
+
})));
|
|
4136
|
+
b.check();
|
|
4137
|
+
};
|
|
4138
|
+
const adoptFallback = () => {
|
|
4139
|
+
fallbackShown = true;
|
|
4140
|
+
fallbackArm = adoptLeniently(b.fallback);
|
|
4141
|
+
};
|
|
4142
|
+
const adoptChildren = (bracketed) => {
|
|
4143
|
+
session.dropping.push(b);
|
|
4144
|
+
try {
|
|
4145
|
+
childrenArm = createRoot((dispose) => {
|
|
4146
|
+
b.attach(getOwner(), true);
|
|
4147
|
+
adoptEach(children);
|
|
4148
|
+
return dispose;
|
|
4149
|
+
});
|
|
4150
|
+
} finally {
|
|
4151
|
+
session.dropping.pop();
|
|
4152
|
+
}
|
|
4153
|
+
b.walked();
|
|
4154
|
+
if (!b.revealed && bracketed) {
|
|
4155
|
+
cur.n = cur.e;
|
|
4156
|
+
cur.o = 0;
|
|
4157
|
+
cur.x = false;
|
|
4158
|
+
}
|
|
4159
|
+
};
|
|
4160
|
+
const childrenOrFallback = () => {
|
|
4161
|
+
fallbackShown = true;
|
|
4162
|
+
build();
|
|
4163
|
+
if (b.revealed) {
|
|
4164
|
+
cur.n = cur.e;
|
|
4165
|
+
cur.o = 0;
|
|
4166
|
+
cur.x = false;
|
|
4167
|
+
} else {
|
|
4168
|
+
adoptFallback();
|
|
4169
|
+
}
|
|
4170
|
+
};
|
|
4171
|
+
const settle = () => {
|
|
4172
|
+
if (b.revealed || fallbackShown) return;
|
|
4173
|
+
if (childrenArm !== null) childrenArm();
|
|
4174
|
+
childrenArm = null;
|
|
4175
|
+
const show = b.show;
|
|
4176
|
+
const walk = newSession(root, onError, ownerRoot);
|
|
4177
|
+
b.show = () => {
|
|
4178
|
+
b.show = show;
|
|
4179
|
+
if (start.parentNode === null || owner !== null && _isDisposed(owner)) return;
|
|
4180
|
+
runWithOwner(owner, () => resumeIn(walk, start, end, () => adoptChildren(true)));
|
|
4181
|
+
};
|
|
4182
|
+
};
|
|
4183
|
+
if (close === null) {
|
|
4184
|
+
splitHere(c);
|
|
4185
|
+
start = parent.insertBefore(document.createComment(BOUNDARY_OPEN), c.n);
|
|
4186
|
+
if (showsFallback(c, b)) {
|
|
4187
|
+
end = parent.insertBefore(
|
|
4188
|
+
document.createComment(BOUNDARY_CLOSE),
|
|
4189
|
+
/** @type {Node} */
|
|
4190
|
+
next(c).nextSibling
|
|
4191
|
+
);
|
|
4192
|
+
within(start, end, childrenOrFallback);
|
|
4193
|
+
} else {
|
|
4194
|
+
const { show, conceal } = b;
|
|
4195
|
+
let held = (
|
|
4196
|
+
/** @type {(() => void) | null} */
|
|
4197
|
+
null
|
|
4198
|
+
);
|
|
4199
|
+
b.show = () => {
|
|
4200
|
+
held = show;
|
|
4201
|
+
};
|
|
4202
|
+
b.conceal = () => {
|
|
4203
|
+
held = conceal;
|
|
4204
|
+
};
|
|
4205
|
+
adoptChildren(false);
|
|
4206
|
+
splitHere(c);
|
|
4207
|
+
end = parent.insertBefore(document.createComment(BOUNDARY_CLOSE), c.n);
|
|
4208
|
+
b.show = show;
|
|
4209
|
+
b.conceal = conceal;
|
|
4210
|
+
if (held !== null) held();
|
|
4211
|
+
settle();
|
|
4212
|
+
}
|
|
4213
|
+
return;
|
|
4214
|
+
}
|
|
4215
|
+
if (awaitStream(at, close, adoptFallback, (walk) => {
|
|
4216
|
+
if (start.data === BOUNDARY_FALLBACK) {
|
|
4217
|
+
build();
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
if (fallbackArm !== null) fallbackArm();
|
|
4221
|
+
fallbackArm = null;
|
|
4222
|
+
fallbackShown = false;
|
|
4223
|
+
walk(() => adoptChildren(true));
|
|
4224
|
+
settle();
|
|
4225
|
+
})) return;
|
|
4226
|
+
within(at, close, at.data === BOUNDARY_FALLBACK ? childrenOrFallback : () => adoptChildren(true));
|
|
4227
|
+
settle();
|
|
4228
|
+
}
|
|
4229
|
+
function showsFallback(c, b) {
|
|
4230
|
+
const s = next(c);
|
|
4231
|
+
if (s === null || s.nodeType !== 1) return false;
|
|
4232
|
+
const built = clientBuild(() => createRoot((dispose) => {
|
|
4233
|
+
const fallback = b.fallback;
|
|
4234
|
+
if (fallback == null) return null;
|
|
4235
|
+
const node = typeof fallback === "function" ? fallback() : fallback;
|
|
4236
|
+
const out = _isDomNode(node) ? node : (
|
|
4237
|
+
/** @type {Function} */
|
|
4238
|
+
vnodeRenderer(node, c.p)
|
|
4239
|
+
);
|
|
4240
|
+
dispose();
|
|
4241
|
+
return out;
|
|
4242
|
+
}));
|
|
4243
|
+
return built != null && built.nodeType === 1 && built.isEqualNode(s);
|
|
4244
|
+
}
|
|
4245
|
+
function commentAfter(placeholder, data) {
|
|
4246
|
+
for (let n = placeholder.nextSibling; n !== null; n = n.nextSibling) {
|
|
4247
|
+
if (n.nodeType === 8 && n.data === data) return n;
|
|
4248
|
+
}
|
|
4249
|
+
return null;
|
|
4250
|
+
}
|
|
4251
|
+
var waiting = /* @__PURE__ */ new Map();
|
|
4252
|
+
function resumeIn(walk, start, end, fn) {
|
|
4253
|
+
const saved = { cur, depth: outer.length, session, pendingKey };
|
|
4254
|
+
session = walk;
|
|
4255
|
+
batch(() => {
|
|
4256
|
+
cur = { p: start.parentNode, n: start.nextSibling, o: 0, x: false, e: end, h: true, t: null };
|
|
4257
|
+
pendingKey = null;
|
|
4258
|
+
try {
|
|
4259
|
+
fn();
|
|
4260
|
+
finish(cur);
|
|
4261
|
+
} finally {
|
|
4262
|
+
cur = saved.cur;
|
|
4263
|
+
outer.length = saved.depth;
|
|
4264
|
+
session = saved.session;
|
|
4265
|
+
pendingKey = saved.pendingKey;
|
|
4266
|
+
if (saved.depth === 0) releaseCursors();
|
|
4267
|
+
}
|
|
4268
|
+
walkDone(walk);
|
|
4269
|
+
});
|
|
4270
|
+
}
|
|
4271
|
+
function _resumeBoundary(id) {
|
|
4272
|
+
const resume = waiting.get(id);
|
|
4273
|
+
if (resume !== void 0) resume();
|
|
4274
|
+
}
|
|
4275
|
+
function installResumeHook() {
|
|
4276
|
+
const W = (
|
|
4277
|
+
/** @type {any} */
|
|
4278
|
+
globalThis._$W || /** @type {any} */
|
|
4279
|
+
(globalThis._$W = {})
|
|
4280
|
+
);
|
|
4281
|
+
if (W.hs === void 0) {
|
|
4282
|
+
W.hs = /* @__PURE__ */ new Set();
|
|
4283
|
+
W.h = (id) => {
|
|
4284
|
+
for (const resume of W.hs) resume(id);
|
|
4285
|
+
};
|
|
4286
|
+
}
|
|
4287
|
+
W.hs.add(_resumeBoundary);
|
|
4288
|
+
}
|
|
4289
|
+
function _$htemplate(html, flag) {
|
|
4290
|
+
keepCursor = keepingCursor;
|
|
4291
|
+
let node = null;
|
|
4292
|
+
const root = () => node === null ? node = parseTemplate(html, flag === 2) : node;
|
|
4293
|
+
const clone = () => root().cloneNode(true);
|
|
4294
|
+
clone.root = root;
|
|
4295
|
+
return clone;
|
|
4296
|
+
}
|
|
4297
|
+
var entered = [];
|
|
4298
|
+
function releaseCursors() {
|
|
4299
|
+
for (let i = 0; i < entered.length; i++) {
|
|
4300
|
+
const c = entered[i];
|
|
4301
|
+
if (c !== void 0) {
|
|
4302
|
+
c.p = null;
|
|
4303
|
+
c.n = null;
|
|
4304
|
+
c.e = null;
|
|
4305
|
+
c.t = null;
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
function enterNode(el, t) {
|
|
4310
|
+
outer.push(cur);
|
|
4311
|
+
const depth = outer.length;
|
|
4312
|
+
let c = entered[depth];
|
|
4313
|
+
if (c === void 0) entered[depth] = c = { p: null, n: null, o: 0, x: false, e: null, h: false, t: null };
|
|
4314
|
+
c.p = el;
|
|
4315
|
+
c.n = el.firstChild;
|
|
4316
|
+
c.o = 0;
|
|
4317
|
+
c.x = false;
|
|
4318
|
+
c.e = null;
|
|
4319
|
+
c.h = t !== void 0;
|
|
4320
|
+
c.t = t === void 0 ? null : t;
|
|
4321
|
+
cur = c;
|
|
4322
|
+
}
|
|
4323
|
+
function _$claim(tmpl, flags, owned) {
|
|
4324
|
+
const c = cur;
|
|
4325
|
+
const t = c === null || !c.h ? null : tmpl.root();
|
|
4326
|
+
if (t === null || headDepth > 0 && HEAD_TAGS.has(t.localName) && next(c)?.localName !== t.localName) {
|
|
4327
|
+
const el2 = tmpl();
|
|
4328
|
+
if (flags & 1) enterNode(el2, void 0);
|
|
4329
|
+
return el2;
|
|
4330
|
+
}
|
|
4331
|
+
const el = takeElement(c, t.localName);
|
|
4332
|
+
if (el === null) {
|
|
4333
|
+
const built = recover(c, tmpl(), describe(t));
|
|
4334
|
+
if (flags & 1) enterNode(built, void 0);
|
|
4335
|
+
return built;
|
|
4336
|
+
}
|
|
4337
|
+
claimNode(el, t, flags, owned);
|
|
4338
|
+
return el;
|
|
4339
|
+
}
|
|
4340
|
+
function stepStatic(c) {
|
|
4341
|
+
const t = c.t;
|
|
4342
|
+
c.t = t.nextSibling;
|
|
4343
|
+
if (t.nodeType === 3) claimText(t.data);
|
|
4344
|
+
else if (t.nodeType === 1) claimStatic(c, t);
|
|
4345
|
+
}
|
|
4346
|
+
function claimStatic(c, t) {
|
|
4347
|
+
const el = takeElement(c, t.localName);
|
|
4348
|
+
if (el === null) return recover(c, t.cloneNode(true), describe(t));
|
|
4349
|
+
claimNode(el, t, 0);
|
|
4350
|
+
return el;
|
|
4351
|
+
}
|
|
4352
|
+
function claimNode(el, t, flags, owned) {
|
|
4353
|
+
if ((process.env.NODE_ENV !== "production")) watchAttrs(el, templateWants(t, owned));
|
|
4354
|
+
if (flags & 1) {
|
|
4355
|
+
keepTemplateAttrs(el, t, owned);
|
|
4356
|
+
enterNode(el, t.firstChild);
|
|
4357
|
+
} else if (!el.isEqualNode(t) || hasShadowRoot(el)) {
|
|
4358
|
+
keepTemplateAttrs(el, t, owned);
|
|
4359
|
+
if (t.localName === "noscript") return;
|
|
4360
|
+
if (t.firstChild === null && t.localName === "textarea") {
|
|
4361
|
+
el.defaultValue = "";
|
|
4362
|
+
} else if (t.firstChild !== null || el.firstChild !== null && (flags & 2) === 0) {
|
|
4363
|
+
enterNode(el, t.firstChild);
|
|
4364
|
+
_$exit();
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
}
|
|
4368
|
+
function hasShadowRoot(el) {
|
|
4369
|
+
for (let child = el.firstElementChild; child !== null; child = child.nextElementSibling) {
|
|
4370
|
+
if (child.shadowRoot != null || hasShadowRoot(child)) return true;
|
|
4371
|
+
}
|
|
4372
|
+
return false;
|
|
4373
|
+
}
|
|
4374
|
+
function _$skip(k) {
|
|
4375
|
+
const c = cur;
|
|
4376
|
+
if (c.h) {
|
|
4377
|
+
while (k-- > 0) stepStatic(c);
|
|
4378
|
+
return;
|
|
4379
|
+
}
|
|
4380
|
+
let n = c.n;
|
|
4381
|
+
while (k-- > 0) n = n.nextSibling;
|
|
4382
|
+
c.n = n;
|
|
4383
|
+
}
|
|
4384
|
+
function _$next(k, flags, owned) {
|
|
4385
|
+
const c = cur;
|
|
4386
|
+
if (c.h) {
|
|
4387
|
+
while (k-- > 0) stepStatic(c);
|
|
4388
|
+
const t = c.t;
|
|
4389
|
+
c.t = t.nextSibling;
|
|
4390
|
+
const el = takeElement(c, t.localName);
|
|
4391
|
+
if (el === null) {
|
|
4392
|
+
const built = recover(c, t.cloneNode(true), describe(t));
|
|
4393
|
+
if (flags & 1) enterNode(built, void 0);
|
|
4394
|
+
return built;
|
|
4395
|
+
}
|
|
4396
|
+
claimNode(el, t, flags, owned);
|
|
4397
|
+
return el;
|
|
4398
|
+
}
|
|
4399
|
+
let n = c.n;
|
|
4400
|
+
while (k-- > 0) n = n.nextSibling;
|
|
4401
|
+
c.n = n.nextSibling;
|
|
4402
|
+
if (flags & 1) enterNode(n, void 0);
|
|
4403
|
+
return n;
|
|
4404
|
+
}
|
|
4405
|
+
function _$hole(parent, value, flag, devName) {
|
|
4406
|
+
const c = cur;
|
|
4407
|
+
if (c.h) {
|
|
4408
|
+
if (typeof value === "function" && !value._lazyChildren && !value._mapArray) adoptRegion(value, devName);
|
|
4409
|
+
else adopt(value);
|
|
4410
|
+
if (flag === 1) c.t = c.t.nextSibling;
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
let marker;
|
|
4414
|
+
if (flag === 2) marker = null;
|
|
4415
|
+
else if (flag !== 3) {
|
|
4416
|
+
marker = c.n;
|
|
4417
|
+
if (flag === 1) c.n = marker.nextSibling;
|
|
4418
|
+
}
|
|
4419
|
+
insert(parent, value, marker, devName);
|
|
4420
|
+
}
|
|
4421
|
+
function fieldText(value) {
|
|
4422
|
+
const type = typeof value;
|
|
4423
|
+
if (type === "string") return value;
|
|
4424
|
+
if (type === "number") return String(value);
|
|
4425
|
+
if ((process.env.NODE_ENV !== "production") && type === "symbol") symbolChild(value);
|
|
4426
|
+
return value == null || type === "boolean" || type === "symbol" ? "" : null;
|
|
4427
|
+
}
|
|
4428
|
+
function symbolChild(value) {
|
|
4429
|
+
_symbolChild(value, cur !== null && cur.h ? "hydration" : isServerRender() ? "server" : "client");
|
|
4430
|
+
}
|
|
4431
|
+
function writeField(fields, i, item) {
|
|
4432
|
+
const text = fieldText(fields[i + 1](item));
|
|
4433
|
+
if (text === null) return false;
|
|
4434
|
+
writeText(fields, i, text);
|
|
4435
|
+
return true;
|
|
4436
|
+
}
|
|
4437
|
+
function writeText(fields, i, text) {
|
|
4438
|
+
if (fields[i + 4] === text) return;
|
|
4439
|
+
fields[i + 4] = text;
|
|
4440
|
+
const node = fieldNode(fields, i);
|
|
4441
|
+
node.data = text;
|
|
4442
|
+
if (node.parentNode !== null) textWritten(node.parentNode, text);
|
|
4443
|
+
}
|
|
4444
|
+
function bindField(cell, node, read, write, owner, text) {
|
|
4445
|
+
const fields = cell.fields;
|
|
4446
|
+
if (fields === null) cell.fields = [node, read, write, owner, text];
|
|
4447
|
+
else fields.push(node, read, write, owner, text);
|
|
4448
|
+
}
|
|
4449
|
+
function _$field(parent, cell, value, marker, read, elsewhere) {
|
|
4450
|
+
const text = fieldText(value);
|
|
4451
|
+
if (text === null || elsewhere === 1 && !fieldLives(cell, getOwner())) {
|
|
4452
|
+
insert(parent, () => read(_readRowItem(cell)), marker);
|
|
4453
|
+
return;
|
|
4454
|
+
}
|
|
4455
|
+
bindField(cell, textAt(parent, text, marker), read, writeField, null, text);
|
|
4456
|
+
textWritten(parent, text);
|
|
4457
|
+
}
|
|
4458
|
+
function _$hfield(parent, cell, value, flag, read, elsewhere) {
|
|
4459
|
+
const c = cur;
|
|
4460
|
+
const text = fieldText(value);
|
|
4461
|
+
if (text === null || !c.h) {
|
|
4462
|
+
if (c.h) {
|
|
4463
|
+
_$hole(parent, () => read(_readRowItem(cell)), flag);
|
|
4464
|
+
return;
|
|
4465
|
+
}
|
|
4466
|
+
let marker;
|
|
4467
|
+
if (flag === 2) marker = null;
|
|
4468
|
+
else if (flag !== 3) {
|
|
4469
|
+
marker = c.n;
|
|
4470
|
+
if (flag === 1) c.n = marker.nextSibling;
|
|
4471
|
+
}
|
|
4472
|
+
_$field(parent, cell, value, marker, read, elsewhere);
|
|
4473
|
+
return;
|
|
4474
|
+
}
|
|
4475
|
+
bindField(cell, claimField(c, text), read, writeField, null, text);
|
|
4476
|
+
if (flag === 1) c.t = c.t.nextSibling;
|
|
4477
|
+
}
|
|
4478
|
+
function _$hplain(parent, read, flag, devName) {
|
|
4479
|
+
const c = cur;
|
|
4480
|
+
if (c.h) {
|
|
4481
|
+
_$hole(parent, read, flag, devName);
|
|
4482
|
+
return;
|
|
4483
|
+
}
|
|
4484
|
+
let marker;
|
|
4485
|
+
if (flag === 2) marker = null;
|
|
4486
|
+
else if (flag !== 3) {
|
|
4487
|
+
marker = c.n;
|
|
4488
|
+
if (flag === 1) c.n = marker.nextSibling;
|
|
4489
|
+
}
|
|
4490
|
+
_$plain(parent, read, marker, devName);
|
|
4491
|
+
}
|
|
4492
|
+
function claimField(c, text) {
|
|
4493
|
+
pendingKey = null;
|
|
4494
|
+
const want = text.indexOf("\r") >= 0 ? text.replace(/\r\n?/g, "\n") : text;
|
|
4495
|
+
const own = want === "" ? null : claimOwnText(c, want);
|
|
4496
|
+
if (own !== null) return own;
|
|
4497
|
+
splitHere(c);
|
|
4498
|
+
const n = c.x ? c.n : next(c);
|
|
4499
|
+
if (want !== "" && n !== null && n.nodeType === 3 && !frozen()) return (
|
|
4500
|
+
/** @type {Text} */
|
|
4501
|
+
replaceText(c, text)
|
|
4502
|
+
);
|
|
4503
|
+
const node = document.createTextNode(text);
|
|
4504
|
+
if (want === "") c.p.insertBefore(node, c.n);
|
|
4505
|
+
else recover(c, node, JSON.stringify(short(text)), n === null ? "missing" : "text");
|
|
4506
|
+
return node;
|
|
4507
|
+
}
|
|
4508
|
+
function claimOwnText(c, text) {
|
|
4509
|
+
if (c.x) dropDiffering(c, text);
|
|
4510
|
+
const n = next(c);
|
|
4511
|
+
const at = c.o;
|
|
4512
|
+
if (n === null || n.nodeType !== 3) return null;
|
|
4513
|
+
const data = n.data;
|
|
4514
|
+
if (at === 0 && data === text) {
|
|
4515
|
+
c.n = n.nextSibling;
|
|
4516
|
+
return n;
|
|
4517
|
+
}
|
|
4518
|
+
if (!data.startsWith(text, at)) return null;
|
|
4519
|
+
const part = { n, a: at, t: text, r: null, nodeType: 1, get firstChild() {
|
|
4520
|
+
return partNode(this);
|
|
4521
|
+
} };
|
|
4522
|
+
(n.$p ??= []).push(part);
|
|
4523
|
+
if ((c.o = at + text.length) === data.length) {
|
|
4524
|
+
c.n = n.nextSibling;
|
|
4525
|
+
c.o = 0;
|
|
4526
|
+
}
|
|
4527
|
+
return part;
|
|
4528
|
+
}
|
|
4529
|
+
function partNode(part) {
|
|
4530
|
+
if (part.r === null) {
|
|
4531
|
+
const node = part.n;
|
|
4532
|
+
const parts = node.$p;
|
|
4533
|
+
node.$p = void 0;
|
|
4534
|
+
for (let k = parts.length - 1; k >= 0; k--) {
|
|
4535
|
+
const p = parts[k];
|
|
4536
|
+
if (p.n !== node) continue;
|
|
4537
|
+
const end = p.a + p.t.length;
|
|
4538
|
+
if (!node.data.startsWith(p.t, p.a)) p.r = document.createTextNode(p.t);
|
|
4539
|
+
else {
|
|
4540
|
+
if (end < node.data.length) node.splitText(end);
|
|
4541
|
+
p.r = p.a > 0 ? node.splitText(p.a) : node;
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
return part.r;
|
|
4546
|
+
}
|
|
4547
|
+
function _$exit() {
|
|
4548
|
+
const c = cur;
|
|
4549
|
+
if (c.h) {
|
|
4550
|
+
while (c.t !== null) stepStatic(c);
|
|
4551
|
+
if (c.n !== c.e || c.o > 0 || c.x) finish(c);
|
|
4552
|
+
}
|
|
4553
|
+
cur = outer.pop();
|
|
4554
|
+
}
|
|
4555
|
+
function _$hcreateComponent(Component, props, children, site, devLoc) {
|
|
4556
|
+
return _$hcreateFn(typeof Component === "string" ? claimedTag(Component) : asComponent(Component), props, children, site, devLoc);
|
|
4557
|
+
}
|
|
4558
|
+
function claimedTag(tag) {
|
|
4559
|
+
const build = tagComponent(tag);
|
|
4560
|
+
return (props) => {
|
|
4561
|
+
const c = cur;
|
|
4562
|
+
if (c === null || !c.h) return build(props);
|
|
4563
|
+
const fresh = tagElement(tag);
|
|
4564
|
+
let el = takeElement(c, tag);
|
|
4565
|
+
if (el === null) enterNode(el = recover(c, fresh, `<${tag}>`), void 0);
|
|
4566
|
+
else {
|
|
4567
|
+
keepTemplateAttrs(el, fresh);
|
|
4568
|
+
enterNode(el, null);
|
|
4569
|
+
}
|
|
4570
|
+
_selectsFor(el);
|
|
4571
|
+
spread(FIELD_TAGS.has(el.localName) ? _$controlled(el) : el, props);
|
|
4572
|
+
_$hole(el, _place(props, "children", 1), 3);
|
|
4573
|
+
_$exit();
|
|
4574
|
+
return el;
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4577
|
+
function _$hcreateFn(Component, props, children, site, devLoc) {
|
|
4578
|
+
const c = cur;
|
|
4579
|
+
if (c === null || !c.h) {
|
|
4580
|
+
const depth = outer.length;
|
|
4581
|
+
try {
|
|
4582
|
+
return _$createLazyFn(Component, props, children, devLoc);
|
|
4583
|
+
} finally {
|
|
4584
|
+
cur = c;
|
|
4585
|
+
outer.length = depth;
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
const merged = ownProps(props);
|
|
4589
|
+
return adoptComponent(Component, merged, lazyProps(Component, merged, props, children), site, devLoc);
|
|
4590
|
+
}
|
|
4591
|
+
function _$members(build, nested) {
|
|
4592
|
+
const c = cur;
|
|
4593
|
+
if (c === null || !c.h) return build();
|
|
4594
|
+
const at = nested === 2 ? _takeFlat() ? null : nextOwn(c) : nested === 1 ? null : nextOwn(c);
|
|
4595
|
+
const close = at !== null && isMarker(at, ARRAY_OPEN) ? closeOf(at, ARRAY_CLOSE) : null;
|
|
4596
|
+
let value;
|
|
4597
|
+
if (close !== null) within(at, close, (fn) => {
|
|
4598
|
+
value = fn();
|
|
4599
|
+
}, build);
|
|
4600
|
+
else value = build();
|
|
4601
|
+
session.built.add(value);
|
|
4602
|
+
return value;
|
|
4603
|
+
}
|
|
4604
|
+
function _$member(value, index) {
|
|
4605
|
+
const c = cur;
|
|
4606
|
+
if (c !== null && c.h) adoptRow(null, index, adopt, value);
|
|
4607
|
+
return value;
|
|
4608
|
+
}
|
|
4609
|
+
var headDepth = 0;
|
|
4610
|
+
var HEAD_TAGS = /* @__PURE__ */ new Set(["title", "meta", "link"]);
|
|
4611
|
+
function _headChildren(children) {
|
|
4612
|
+
headDepth++;
|
|
4613
|
+
try {
|
|
4614
|
+
return children();
|
|
4615
|
+
} finally {
|
|
4616
|
+
headDepth--;
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4619
|
+
function _$outside(build) {
|
|
4620
|
+
const c = cur;
|
|
4621
|
+
if (c === null || !c.h) return build();
|
|
4622
|
+
const value = clientBuild(build);
|
|
4623
|
+
builtOutside(value);
|
|
4624
|
+
return value;
|
|
4625
|
+
}
|
|
4626
|
+
function builtOutside(value) {
|
|
4627
|
+
if (value === null || typeof value !== "object") return;
|
|
4628
|
+
session.prebuilt.add(value);
|
|
4629
|
+
if (Array.isArray(value)) for (const v of value) builtOutside(v);
|
|
4630
|
+
}
|
|
4631
|
+
export {
|
|
4632
|
+
_$Island,
|
|
4633
|
+
_$buildDiagnostics,
|
|
4634
|
+
installFieldCarry as _$carryFields,
|
|
4635
|
+
_$changes,
|
|
4636
|
+
optionsChanged as _$childrenChanged,
|
|
4637
|
+
_$claim,
|
|
4638
|
+
_$claimControl,
|
|
4639
|
+
_$componentVNode,
|
|
4640
|
+
_$control,
|
|
4641
|
+
_$controlled,
|
|
4642
|
+
_$createComponent,
|
|
4643
|
+
_$createFn,
|
|
4644
|
+
_$createLazyFn,
|
|
4645
|
+
_$createLeaf,
|
|
4646
|
+
_$exit,
|
|
4647
|
+
_$field,
|
|
4648
|
+
_$hcomponentVNode,
|
|
4649
|
+
_$hcreateComponent,
|
|
4650
|
+
_$hcreateFn,
|
|
4651
|
+
_$hfield,
|
|
4652
|
+
_$hole,
|
|
4653
|
+
_$hplain,
|
|
4654
|
+
_$htemplate,
|
|
4655
|
+
_$inNs,
|
|
4656
|
+
_readRowItem as _$item,
|
|
4657
|
+
_$keyed,
|
|
4658
|
+
computed as _$lazyMemo,
|
|
4659
|
+
_$mapKeyed,
|
|
4660
|
+
_markProps as _$marked,
|
|
4661
|
+
_$member,
|
|
4662
|
+
_$members,
|
|
4663
|
+
memo as _$memo,
|
|
4664
|
+
_$merge,
|
|
4665
|
+
_$next,
|
|
4666
|
+
_copyProps as _$omit,
|
|
4667
|
+
_$outside,
|
|
4668
|
+
_$own,
|
|
4669
|
+
_place as _$place,
|
|
4670
|
+
_$plain,
|
|
4671
|
+
_propField as _$propField,
|
|
4672
|
+
PROPS as _$props,
|
|
4673
|
+
insertReactive as _$reactive,
|
|
4674
|
+
retype as _$retype,
|
|
4675
|
+
_$rowFields,
|
|
4676
|
+
_installSelects as _$selects,
|
|
4677
|
+
setProp as _$setProp,
|
|
4678
|
+
setValue as _$setValue,
|
|
4679
|
+
_$skip,
|
|
4680
|
+
_$slots,
|
|
4681
|
+
spread as _$spread,
|
|
4682
|
+
_$spreads,
|
|
4683
|
+
_$template,
|
|
4684
|
+
_$xlink,
|
|
4685
|
+
_adoptDetached,
|
|
4686
|
+
_adoptVNodeKinds,
|
|
4687
|
+
_adoptVNodeRows,
|
|
4688
|
+
_afterWalk,
|
|
4689
|
+
_carryFields,
|
|
4690
|
+
_claimRegion,
|
|
4691
|
+
_delegatedWalk,
|
|
4692
|
+
_enableSuspense,
|
|
4693
|
+
_headChildren,
|
|
4694
|
+
_hotKeep,
|
|
4695
|
+
_hotState,
|
|
4696
|
+
_hotSwap,
|
|
4697
|
+
_hydrateRange,
|
|
4698
|
+
_hydrationErrorHook,
|
|
4699
|
+
_installForeignRows,
|
|
4700
|
+
_installHot,
|
|
4701
|
+
_installOptionsChanged,
|
|
4702
|
+
_installRowEntry,
|
|
4703
|
+
installVNodeRuntime as _installVNodeRuntime,
|
|
4704
|
+
_isDomNode,
|
|
4705
|
+
_isSvgParent,
|
|
4706
|
+
_listFragment,
|
|
4707
|
+
_mapArrayToArray,
|
|
4708
|
+
_placedNamespace,
|
|
4709
|
+
_region,
|
|
4710
|
+
_renderComponent,
|
|
4711
|
+
_resumeBoundary,
|
|
4712
|
+
_rowKeyDigest,
|
|
4713
|
+
_rowKeySalt,
|
|
4714
|
+
_rowKeysInOrder,
|
|
4715
|
+
_setForeignComponent,
|
|
4716
|
+
_setTextInsertHook,
|
|
4717
|
+
_signalKeyed,
|
|
4718
|
+
_takeOwnerStep,
|
|
4719
|
+
_toFunctionComponent,
|
|
4720
|
+
valuesToNodes as _valuesToNodes,
|
|
4721
|
+
_vnodeRows,
|
|
4722
|
+
_withCursor,
|
|
4723
|
+
_writeClass,
|
|
4724
|
+
applyRef,
|
|
4725
|
+
classList,
|
|
4726
|
+
className,
|
|
4727
|
+
createSelector,
|
|
4728
|
+
delegateEvents,
|
|
4729
|
+
effect,
|
|
4730
|
+
hydrate,
|
|
4731
|
+
insert,
|
|
4732
|
+
isHydrating,
|
|
4733
|
+
mapArray,
|
|
4734
|
+
on,
|
|
4735
|
+
setAttr,
|
|
4736
|
+
setChecked,
|
|
4737
|
+
setClass,
|
|
4738
|
+
setClassList,
|
|
4739
|
+
handSetProp as setProp,
|
|
4740
|
+
setStyle,
|
|
4741
|
+
handSetValue as setValue,
|
|
4742
|
+
handSpread as spread,
|
|
4743
|
+
svgTemplate,
|
|
4744
|
+
template,
|
|
4745
|
+
untrack
|
|
4746
|
+
};
|