essor 0.0.14-beta.19 → 0.0.14-beta.21

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.
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * essor v0.0.14-beta.19
4
+ * essor v0.0.14-beta.21
5
5
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
6
6
  * @license MIT
7
7
  **/
8
8
 
9
9
  // src/version.ts
10
- var essor_version = "0.0.14-beta.19";
10
+ var essor_version = "0.0.14-beta.21";
11
11
 
12
12
  // ../shared/dist/shared.js
13
13
  var isObject = (val) => val !== null && typeof val === "object";
@@ -722,7 +722,7 @@ function runBatch() {
722
722
  function ref() {
723
723
  return shallowSignal(null);
724
724
  }
725
- function useWatch(source, cb, options) {
725
+ function watch(source, cb, options) {
726
726
  return doWatch(source, cb, options);
727
727
  }
728
728
  var INITIAL_WATCHER_VALUE = void 0;
@@ -1245,12 +1245,15 @@ var ComponentNode = class extends LifecycleContext {
1245
1245
  this.emitter = /* @__PURE__ */ new Set();
1246
1246
  this.rootNode = null;
1247
1247
  this.trackMap = /* @__PURE__ */ new Map();
1248
+ this.nodes = [];
1249
+ this.parent = null;
1250
+ this.before = null;
1248
1251
  this.key || (this.key = props && props.key);
1249
- this.proxyProps = this.createProxyProps(props);
1252
+ this.proxyProps || (this.proxyProps = this.createProxyProps(props));
1250
1253
  }
1251
1254
  createProxyProps(props) {
1252
1255
  if (!props) return {};
1253
- return signalObject(
1256
+ return shallowReactive(
1254
1257
  props,
1255
1258
  (key) => startsWith(key, EVENT_PREFIX) || startsWith(key, UPDATE_PREFIX) || key === CHILDREN_PROP
1256
1259
  );
@@ -1265,6 +1268,7 @@ var ComponentNode = class extends LifecycleContext {
1265
1268
  }
1266
1269
  mount(parent, before) {
1267
1270
  var _a, _b, _c, _d;
1271
+ this.parent = parent;
1268
1272
  if (!isFunction(this.template)) {
1269
1273
  throw new Error("Template must be a function");
1270
1274
  }
@@ -1273,20 +1277,30 @@ var ComponentNode = class extends LifecycleContext {
1273
1277
  }
1274
1278
  this.initRef();
1275
1279
  this.rootNode = this.template(reactive(this.proxyProps, [CHILDREN_PROP]));
1276
- const mountedNode = (_d = (_c = this.rootNode) == null ? void 0 : _c.mount(parent, before)) != null ? _d : [];
1280
+ this.nodes = (_d = (_c = this.rootNode) == null ? void 0 : _c.mount(parent, before)) != null ? _d : [];
1277
1281
  this.callMountHooks();
1278
1282
  this.patchProps(this.props);
1279
1283
  this.removeRef();
1280
- return mountedNode;
1284
+ return this.nodes;
1281
1285
  }
1282
1286
  unmount() {
1283
1287
  var _a;
1284
- this.callDestroyHooks();
1285
- this.clearHooks();
1288
+ this.callLifecycleHooks("destroy");
1289
+ this.cleanup();
1286
1290
  (_a = this.rootNode) == null ? void 0 : _a.unmount();
1291
+ this.resetState();
1292
+ if (this.key) {
1293
+ componentCache.delete(this.key);
1294
+ }
1295
+ }
1296
+ resetState() {
1287
1297
  this.rootNode = null;
1288
1298
  this.proxyProps = {};
1289
- this.clearEmitter();
1299
+ this.nodes = [];
1300
+ this.parent = null;
1301
+ }
1302
+ callLifecycleHooks(type) {
1303
+ this.hooks[type].forEach((handler) => handler());
1290
1304
  }
1291
1305
  callMountHooks() {
1292
1306
  this.hooks.mounted.forEach((handler) => handler());
@@ -1305,9 +1319,11 @@ var ComponentNode = class extends LifecycleContext {
1305
1319
  this.rootNode = node.rootNode;
1306
1320
  this.trackMap = node.trackMap;
1307
1321
  this.hooks = node.hooks;
1308
- const props = this.props;
1309
- this.props = node.props;
1310
- this.patchProps(props);
1322
+ if (hasChanged(node.props, this.props)) {
1323
+ const props = this.props;
1324
+ this.props = node.props;
1325
+ this.patchProps(props);
1326
+ }
1311
1327
  }
1312
1328
  getNodeTrack(trackKey) {
1313
1329
  let track2 = this.trackMap.get(trackKey);
@@ -1347,15 +1363,22 @@ var ComponentNode = class extends LifecycleContext {
1347
1363
  prop.value = (_b = (_a = this.rootNode) == null ? void 0 : _a.firstChild) != null ? _b : null;
1348
1364
  }
1349
1365
  patchUpdateHandler(key, prop) {
1350
- this.props[key] = extractSignal(prop);
1366
+ this.proxyProps[key] = extractSignal(prop);
1351
1367
  }
1352
1368
  patchNormalProp(key, prop) {
1353
- var _a, _b;
1354
- const newValue = (_b = (_a = this.proxyProps)[key]) != null ? _b : _a[key] = signal(prop);
1355
1369
  const track2 = this.getNodeTrack(key);
1356
1370
  track2.cleanup = effect(() => {
1357
- newValue.value = isFunction(prop) ? prop() : prop;
1371
+ this.proxyProps[key] = isFunction(prop) ? prop() : prop;
1372
+ });
1373
+ }
1374
+ cleanup() {
1375
+ this.trackMap.forEach((track2) => {
1376
+ var _a;
1377
+ return (_a = track2.cleanup) == null ? void 0 : _a.call(track2);
1358
1378
  });
1379
+ this.trackMap.clear();
1380
+ this.emitter.forEach((cleanup) => cleanup());
1381
+ this.emitter.clear();
1359
1382
  }
1360
1383
  };
1361
1384
  function patchChildren(parent, childrenMap, nextChildren, before) {
@@ -1527,6 +1550,9 @@ var TemplateNode = class {
1527
1550
  this.nodes.forEach((node) => removeChild(node));
1528
1551
  this.nodes = [];
1529
1552
  this.mounted = false;
1553
+ if (this.key) {
1554
+ componentCache.delete(this.key);
1555
+ }
1530
1556
  }
1531
1557
  inheritNode(node) {
1532
1558
  this.mounted = node.mounted;
@@ -1716,38 +1742,36 @@ var TemplateNode = class {
1716
1742
  return result;
1717
1743
  }
1718
1744
  };
1719
- var FragmentNode = class extends TemplateNode {
1720
- unmount() {
1721
- this.trackMap.forEach((track2) => {
1722
- if (track2.lastNodes) {
1723
- track2.lastNodes.forEach((node) => {
1724
- removeChild(node);
1725
- });
1726
- }
1727
- track2.cleanup && track2.cleanup();
1728
- });
1729
- this.trackMap.clear();
1730
- this.treeMap.clear();
1731
- this.nodes.forEach((node) => {
1732
- removeChild(node);
1733
- });
1734
- this.nodes = [];
1735
- this.mounted = false;
1745
+ var componentCache = /* @__PURE__ */ new Map();
1746
+ function createNodeCache(NodeConstructor, template, props = {}, key) {
1747
+ if (key) {
1748
+ const cached = componentCache.get(key);
1749
+ if (cached) {
1750
+ return cached;
1751
+ }
1736
1752
  }
1737
- };
1738
- function h(template, props, key) {
1753
+ if (typeof template === "string") {
1754
+ template = createTemplate(template);
1755
+ }
1756
+ const newNode = new NodeConstructor(template, props, key);
1757
+ if (key && newNode instanceof ComponentNode) {
1758
+ componentCache.set(key, newNode);
1759
+ }
1760
+ return newNode;
1761
+ }
1762
+ function h(template, props = {}, key) {
1739
1763
  if (template === EMPTY_TEMPLATE) {
1740
1764
  return Fragment(template, props);
1741
1765
  }
1742
1766
  if (isString(template)) {
1743
1767
  const htmlTemplate = convertToHtmlTag(template);
1744
- props = { [SINGLE_PROP_KEY]: props };
1745
- return new TemplateNode(createTemplate(htmlTemplate), props, key);
1768
+ const wrappedProps = { [SINGLE_PROP_KEY]: props };
1769
+ return createNodeCache(TemplateNode, htmlTemplate, wrappedProps, key);
1746
1770
  }
1747
1771
  if (isFunction(template)) {
1748
- return new ComponentNode(template, props, key);
1772
+ return createNodeCache(ComponentNode, template, props, key);
1749
1773
  }
1750
- return new TemplateNode(template, props, key);
1774
+ return createNodeCache(TemplateNode, template, props, key);
1751
1775
  }
1752
1776
  function isComponent(node) {
1753
1777
  return node instanceof ComponentNode;
@@ -1761,17 +1785,13 @@ function createTemplate(html) {
1761
1785
  return template;
1762
1786
  }
1763
1787
  function Fragment(template, props) {
1764
- if (props.children) {
1765
- props = {
1766
- [FRAGMENT_PROP_KEY]: {
1767
- children: isArray(props.children) ? props.children.filter(Boolean) : [props.children]
1768
- }
1769
- };
1770
- }
1771
- if (template === EMPTY_TEMPLATE) {
1772
- template = createTemplate(EMPTY_TEMPLATE);
1773
- }
1774
- return new FragmentNode(template, props);
1788
+ const processedProps = props.children ? {
1789
+ [FRAGMENT_PROP_KEY]: {
1790
+ children: Array.isArray(props.children) ? props.children.filter(Boolean) : [props.children]
1791
+ }
1792
+ } : props;
1793
+ const templateElement = template === EMPTY_TEMPLATE ? createTemplate(EMPTY_TEMPLATE) : template;
1794
+ return createNodeCache(TemplateNode, templateElement, processedProps);
1775
1795
  }
1776
1796
  function onMount(cb) {
1777
1797
  assertInsideComponent("onMounted");
@@ -1826,12 +1846,12 @@ if (globalThis) {
1826
1846
  globalThis.__essor_version__ = essor_version;
1827
1847
  }
1828
1848
  /**
1829
- * @estjs/signal v0.0.14-beta.19
1849
+ * @estjs/signal v0.0.14-beta.21
1830
1850
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
1831
1851
  * @license MIT
1832
1852
  **/
1833
1853
  /**
1834
- * @estjs/template v0.0.14-beta.19
1854
+ * @estjs/template v0.0.14-beta.21
1835
1855
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
1836
1856
  * @license MIT
1837
1857
  **/
@@ -1865,4 +1885,4 @@ exports.ssg = ssg;
1865
1885
  exports.template = createTemplate;
1866
1886
  exports.toRaw = toRaw;
1867
1887
  exports.useBatch = useBatch;
1868
- exports.useWatch = useWatch;
1888
+ exports.watch = watch;
@@ -1,11 +1,11 @@
1
1
  /**
2
- * essor v0.0.14-beta.19
2
+ * essor v0.0.14-beta.21
3
3
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
4
4
  * @license MIT
5
5
  **/
6
6
 
7
7
  // src/version.ts
8
- var essor_version = "0.0.14-beta.19";
8
+ var essor_version = "0.0.14-beta.21";
9
9
 
10
10
  // ../shared/dist/shared.js
11
11
  var isObject = (val) => val !== null && typeof val === "object";
@@ -720,7 +720,7 @@ function runBatch() {
720
720
  function ref() {
721
721
  return shallowSignal(null);
722
722
  }
723
- function useWatch(source, cb, options) {
723
+ function watch(source, cb, options) {
724
724
  return doWatch(source, cb, options);
725
725
  }
726
726
  var INITIAL_WATCHER_VALUE = void 0;
@@ -1243,12 +1243,15 @@ var ComponentNode = class extends LifecycleContext {
1243
1243
  this.emitter = /* @__PURE__ */ new Set();
1244
1244
  this.rootNode = null;
1245
1245
  this.trackMap = /* @__PURE__ */ new Map();
1246
+ this.nodes = [];
1247
+ this.parent = null;
1248
+ this.before = null;
1246
1249
  this.key || (this.key = props && props.key);
1247
- this.proxyProps = this.createProxyProps(props);
1250
+ this.proxyProps || (this.proxyProps = this.createProxyProps(props));
1248
1251
  }
1249
1252
  createProxyProps(props) {
1250
1253
  if (!props) return {};
1251
- return signalObject(
1254
+ return shallowReactive(
1252
1255
  props,
1253
1256
  (key) => startsWith(key, EVENT_PREFIX) || startsWith(key, UPDATE_PREFIX) || key === CHILDREN_PROP
1254
1257
  );
@@ -1263,6 +1266,7 @@ var ComponentNode = class extends LifecycleContext {
1263
1266
  }
1264
1267
  mount(parent, before) {
1265
1268
  var _a, _b, _c, _d;
1269
+ this.parent = parent;
1266
1270
  if (!isFunction(this.template)) {
1267
1271
  throw new Error("Template must be a function");
1268
1272
  }
@@ -1271,20 +1275,30 @@ var ComponentNode = class extends LifecycleContext {
1271
1275
  }
1272
1276
  this.initRef();
1273
1277
  this.rootNode = this.template(reactive(this.proxyProps, [CHILDREN_PROP]));
1274
- const mountedNode = (_d = (_c = this.rootNode) == null ? void 0 : _c.mount(parent, before)) != null ? _d : [];
1278
+ this.nodes = (_d = (_c = this.rootNode) == null ? void 0 : _c.mount(parent, before)) != null ? _d : [];
1275
1279
  this.callMountHooks();
1276
1280
  this.patchProps(this.props);
1277
1281
  this.removeRef();
1278
- return mountedNode;
1282
+ return this.nodes;
1279
1283
  }
1280
1284
  unmount() {
1281
1285
  var _a;
1282
- this.callDestroyHooks();
1283
- this.clearHooks();
1286
+ this.callLifecycleHooks("destroy");
1287
+ this.cleanup();
1284
1288
  (_a = this.rootNode) == null ? void 0 : _a.unmount();
1289
+ this.resetState();
1290
+ if (this.key) {
1291
+ componentCache.delete(this.key);
1292
+ }
1293
+ }
1294
+ resetState() {
1285
1295
  this.rootNode = null;
1286
1296
  this.proxyProps = {};
1287
- this.clearEmitter();
1297
+ this.nodes = [];
1298
+ this.parent = null;
1299
+ }
1300
+ callLifecycleHooks(type) {
1301
+ this.hooks[type].forEach((handler) => handler());
1288
1302
  }
1289
1303
  callMountHooks() {
1290
1304
  this.hooks.mounted.forEach((handler) => handler());
@@ -1303,9 +1317,11 @@ var ComponentNode = class extends LifecycleContext {
1303
1317
  this.rootNode = node.rootNode;
1304
1318
  this.trackMap = node.trackMap;
1305
1319
  this.hooks = node.hooks;
1306
- const props = this.props;
1307
- this.props = node.props;
1308
- this.patchProps(props);
1320
+ if (hasChanged(node.props, this.props)) {
1321
+ const props = this.props;
1322
+ this.props = node.props;
1323
+ this.patchProps(props);
1324
+ }
1309
1325
  }
1310
1326
  getNodeTrack(trackKey) {
1311
1327
  let track2 = this.trackMap.get(trackKey);
@@ -1345,15 +1361,22 @@ var ComponentNode = class extends LifecycleContext {
1345
1361
  prop.value = (_b = (_a = this.rootNode) == null ? void 0 : _a.firstChild) != null ? _b : null;
1346
1362
  }
1347
1363
  patchUpdateHandler(key, prop) {
1348
- this.props[key] = extractSignal(prop);
1364
+ this.proxyProps[key] = extractSignal(prop);
1349
1365
  }
1350
1366
  patchNormalProp(key, prop) {
1351
- var _a, _b;
1352
- const newValue = (_b = (_a = this.proxyProps)[key]) != null ? _b : _a[key] = signal(prop);
1353
1367
  const track2 = this.getNodeTrack(key);
1354
1368
  track2.cleanup = effect(() => {
1355
- newValue.value = isFunction(prop) ? prop() : prop;
1369
+ this.proxyProps[key] = isFunction(prop) ? prop() : prop;
1370
+ });
1371
+ }
1372
+ cleanup() {
1373
+ this.trackMap.forEach((track2) => {
1374
+ var _a;
1375
+ return (_a = track2.cleanup) == null ? void 0 : _a.call(track2);
1356
1376
  });
1377
+ this.trackMap.clear();
1378
+ this.emitter.forEach((cleanup) => cleanup());
1379
+ this.emitter.clear();
1357
1380
  }
1358
1381
  };
1359
1382
  function patchChildren(parent, childrenMap, nextChildren, before) {
@@ -1525,6 +1548,9 @@ var TemplateNode = class {
1525
1548
  this.nodes.forEach((node) => removeChild(node));
1526
1549
  this.nodes = [];
1527
1550
  this.mounted = false;
1551
+ if (this.key) {
1552
+ componentCache.delete(this.key);
1553
+ }
1528
1554
  }
1529
1555
  inheritNode(node) {
1530
1556
  this.mounted = node.mounted;
@@ -1714,38 +1740,36 @@ var TemplateNode = class {
1714
1740
  return result;
1715
1741
  }
1716
1742
  };
1717
- var FragmentNode = class extends TemplateNode {
1718
- unmount() {
1719
- this.trackMap.forEach((track2) => {
1720
- if (track2.lastNodes) {
1721
- track2.lastNodes.forEach((node) => {
1722
- removeChild(node);
1723
- });
1724
- }
1725
- track2.cleanup && track2.cleanup();
1726
- });
1727
- this.trackMap.clear();
1728
- this.treeMap.clear();
1729
- this.nodes.forEach((node) => {
1730
- removeChild(node);
1731
- });
1732
- this.nodes = [];
1733
- this.mounted = false;
1743
+ var componentCache = /* @__PURE__ */ new Map();
1744
+ function createNodeCache(NodeConstructor, template, props = {}, key) {
1745
+ if (key) {
1746
+ const cached = componentCache.get(key);
1747
+ if (cached) {
1748
+ return cached;
1749
+ }
1734
1750
  }
1735
- };
1736
- function h(template, props, key) {
1751
+ if (typeof template === "string") {
1752
+ template = createTemplate(template);
1753
+ }
1754
+ const newNode = new NodeConstructor(template, props, key);
1755
+ if (key && newNode instanceof ComponentNode) {
1756
+ componentCache.set(key, newNode);
1757
+ }
1758
+ return newNode;
1759
+ }
1760
+ function h(template, props = {}, key) {
1737
1761
  if (template === EMPTY_TEMPLATE) {
1738
1762
  return Fragment(template, props);
1739
1763
  }
1740
1764
  if (isString(template)) {
1741
1765
  const htmlTemplate = convertToHtmlTag(template);
1742
- props = { [SINGLE_PROP_KEY]: props };
1743
- return new TemplateNode(createTemplate(htmlTemplate), props, key);
1766
+ const wrappedProps = { [SINGLE_PROP_KEY]: props };
1767
+ return createNodeCache(TemplateNode, htmlTemplate, wrappedProps, key);
1744
1768
  }
1745
1769
  if (isFunction(template)) {
1746
- return new ComponentNode(template, props, key);
1770
+ return createNodeCache(ComponentNode, template, props, key);
1747
1771
  }
1748
- return new TemplateNode(template, props, key);
1772
+ return createNodeCache(TemplateNode, template, props, key);
1749
1773
  }
1750
1774
  function isComponent(node) {
1751
1775
  return node instanceof ComponentNode;
@@ -1759,17 +1783,13 @@ function createTemplate(html) {
1759
1783
  return template;
1760
1784
  }
1761
1785
  function Fragment(template, props) {
1762
- if (props.children) {
1763
- props = {
1764
- [FRAGMENT_PROP_KEY]: {
1765
- children: isArray(props.children) ? props.children.filter(Boolean) : [props.children]
1766
- }
1767
- };
1768
- }
1769
- if (template === EMPTY_TEMPLATE) {
1770
- template = createTemplate(EMPTY_TEMPLATE);
1771
- }
1772
- return new FragmentNode(template, props);
1786
+ const processedProps = props.children ? {
1787
+ [FRAGMENT_PROP_KEY]: {
1788
+ children: Array.isArray(props.children) ? props.children.filter(Boolean) : [props.children]
1789
+ }
1790
+ } : props;
1791
+ const templateElement = template === EMPTY_TEMPLATE ? createTemplate(EMPTY_TEMPLATE) : template;
1792
+ return createNodeCache(TemplateNode, templateElement, processedProps);
1773
1793
  }
1774
1794
  function onMount(cb) {
1775
1795
  assertInsideComponent("onMounted");
@@ -1824,14 +1844,14 @@ if (globalThis) {
1824
1844
  globalThis.__essor_version__ = essor_version;
1825
1845
  }
1826
1846
  /**
1827
- * @estjs/signal v0.0.14-beta.19
1847
+ * @estjs/signal v0.0.14-beta.21
1828
1848
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
1829
1849
  * @license MIT
1830
1850
  **/
1831
1851
  /**
1832
- * @estjs/template v0.0.14-beta.19
1852
+ * @estjs/template v0.0.14-beta.21
1833
1853
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
1834
1854
  * @license MIT
1835
1855
  **/
1836
1856
 
1837
- export { Fragment, clearReactive, computed, createStore, effect, essor_version, h, hydrate, inject, isComponent, isComputed, isJsxElement, isReactive, isSignal, nextTick, onDestroy, onMount, provide, reactive, ref, renderToString, shallowReactive, shallowSignal, signal, signalObject, ssg, createTemplate as template, toRaw, useBatch, useWatch };
1857
+ export { Fragment, clearReactive, computed, createStore, effect, essor_version, h, hydrate, inject, isComponent, isComputed, isJsxElement, isReactive, isSignal, nextTick, onDestroy, onMount, provide, reactive, ref, renderToString, shallowReactive, shallowSignal, signal, signalObject, ssg, createTemplate as template, toRaw, useBatch, watch };
package/dist/essor.esm.js CHANGED
@@ -1,17 +1,17 @@
1
1
  /**
2
- * essor v0.0.14-beta.19
2
+ * essor v0.0.14-beta.21
3
3
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
4
4
  * @license MIT
5
5
  **/
6
- var At="0.0.14-beta.19";var C=t=>t!==null&&typeof t=="object";var m=Array.isArray;function Y(t){return typeof t=="string"}function jt(t){return typeof t=="symbol"}function Z(t){return k.call(t)==="[object Set]"}function st(t){return k.call(t)==="[object WeakMap]"}function it(t){return k.call(t)==="[object WeakSet]"}function Q(t){return k.call(t)==="[object Map]"}function Lt(t){return t==null}var d=t=>typeof t=="function";function ot(t){return t===!1||t===null||t===void 0}function It(t){return t?t&&typeof t=="object"&&t.nodeType===1&&typeof t.nodeName=="string":!1}var T=t=>k.call(t)==="[object Object]";function ct(t){return Y(t)?!Number.isNaN(Number(t)):!1}var k=Object.prototype.toString;var ie=Object.prototype.hasOwnProperty,V=(t,e)=>ie.call(t,e);function at(t){return m(t)?t.flat():[t]}var O=(t,e)=>t!==e&&(t===t||e===e),ut=Function.prototype;function P(t,e){return Y(t)?t.indexOf(e)===0:!1}function kt(t){return t.replaceAll(/["&'<>]/g,e=>{switch(e){case"&":return "&amp;";case"<":return "&lt;";case">":return "&gt;";case'"':return "&quot;";case"'":return "&#039;";default:return e}})}function H(t,e){return m(e)?e.includes(t):d(e)?e(t):!1}var lt=t=>{let e=Object.create(null);return r=>e[r]||(e[r]=t(r))},oe=/\B([A-Z])/g,Ht=lt(t=>t.replaceAll(oe,"-$1").toLowerCase()),Ft=lt(t=>t.charAt(0).toUpperCase()+t.slice(1));function x(t,...e){console.warn.apply(console,[`[Essor warn]: ${t}`].concat(e));}var ae=Object.defineProperty,ue=Object.defineProperties,le=Object.getOwnPropertyDescriptors,Kt=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,Wt=(t,e,r)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,K=(t,e)=>{for(var r in e||(e={}))fe.call(e,r)&&Wt(t,r,e[r]);if(Kt)for(var r of Kt(e))he.call(e,r)&&Wt(t,r,e[r]);return t},pe=(t,e)=>ue(t,le(e)),ht=[],pt=[],Dt=Promise.resolve(),dt=!1;function Et(t){return t?Dt.then(t):Dt}function de(t){ht.includes(t)||(ht.push(t),Xt());}function Xt(){dt||(dt=!0,Et(ve));}function me(t){ge(t,pt);}function ge(t,e){e.includes(t)||(e.push(t),Xt());}function ve(){dt=!1,be();let t;for(;t=ht.shift();)t&&t();}function be(){for(;pt.length>0;){let t=pt.shift();t&&t();}}function Ee(t,e){return e==="sync"?()=>t():e==="pre"?()=>me(t):()=>{Et(()=>de(t));}}var S=null,mt=new WeakMap,ft=new WeakMap,W=Symbol("ReactiveSymbol"),D=Symbol("__raw"),Gt=Symbol("SignalValueKey"),Bt=Symbol("ComputedValueKey"),gt=Symbol("ReactiveArrayKey"),v=Symbol("ReactiveCollectionKey"),R=Symbol("ReactiveWeakCollectionKey"),vt=!1,tt=new Set;function h(t,e){if(!S)return;let r=mt.get(t);r||(r=new Map,mt.set(t,r));let n=r.get(e);n||(n=new Set,r.set(e,n)),n.add(S);}function b(t,e){let r=mt.get(t);if(!r)return;let n=r.get(e);n&&n.forEach(s=>{if(V(s,"active")&&!s.active){n.delete(s);return}vt?tt.add(s):s();});}var Ne=class extends Function{constructor(t){return super(),Object.setPrototypeOf(t,new.target.prototype)}},Yt=class extends Ne{constructor(t,e=!1){super(()=>this.value),this.__signal=!0,this.__shallow=e,this.__value=t;}get value(){return h(this,Gt),C(this.__value)?z(this.__value,this.__shallow):this.__value}set value(t){g(t)&&(t=t.peek()),O(t,this.__value)&&(this.__value=t,b(this,Gt));}peek(){return this.__value}set(t){this.value=t;}update(t){this.set(t(this.peek()));}};function Nt(t){return g(t)?t:new Yt(t)}function _t(t){return new Yt(t,!0)}function g(t){return !!(t&&(t!=null&&t.__signal))}var _e=class{constructor(t){this.fn=t,this.__computed=!0;let e=S;S=this.run.bind(this),this.__value=this.fn(),S=e;}peek(){return this.__value}run(){let t=this.fn();O(t,this.__value)&&(this.__value=t,b(this,Bt));}get value(){return h(this,Bt),this.__value}};function Se(t){return new _e(t)}function Zt(t){return !!(t&&t.__computed)}function G(t,e={}){let{flush:r="pre",onTrack:n,onTrigger:s}=e;function i(){let a=S;S=i.init?i:i.scheduler,t(),s&&s(),S=a;}let o=Ee(i,r);return i.scheduler=o,i.init=!0,i.active=!0,n&&n(),i(),()=>{i.active=!1,S=null;}}function Qt(t,e){return !t||!C(t)?(x("initialValues must be an object,will return initial value!",t),t):Object.entries(t).reduce((n,[s,i])=>(n[s]=H(s,e)||g(i)?i:Nt(i),n),{})}function f(t){return t&&(B(t)?t[D]:g(t)?t.peek():m(t)?t.map(e=>f(e)):T(t)?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,f(r)])):t)}function B(t){return !!(t&&typeof t=="object"&&t[W])}function St(t,e){return z(t,!1,e)}function or(t,e){return z(t,!0,e)}var ye=(t,e)=>({get(r,n,s){if(n===W)return !0;if(n===D)return r;let i=Reflect.get(r,n,s),o=g(i)?i.value:i;return H(n,e)?o:(h(r,n),C(o)&&!t?z(o):o)},set(r,n,s,i){if(H(n,e))return Reflect.set(r,n,s,i),!0;let o=Reflect.get(r,n,i);g(o)&&(o=o.value),g(s)&&(s=s.value);let a=Reflect.set(r,n,s,i);return O(s,o)&&b(r,n),a},deleteProperty(r,n){let s=Reflect.get(r,n),i=Reflect.deleteProperty(r,n);return s!==void 0&&b(r,n),i}}),zt=Ce();function Ce(){let t={};return ["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...r){let n=f(this);for(let i=0,o=this.length;i<o;i++)h(n,`${i}`);let s=n[e](...r);return s===-1||s===!1?n[e](...r):s};}),["push","pop","shift","unshift","splice","sort","reverse"].forEach(e=>{t[e]=function(...r){let n=f(this),s=n[e].apply(this,r);return b(n,gt),s};}),["forEach","map","filter","reduce","reduceRight","some","every","find","findIndex","findLast","findLastIndex","entries","keys","values"].forEach(e=>{t[e]=function(...r){let n=f(this);return h(n,gt),n[e].apply(this,r)};}),t}var we=(t,e)=>({get(r,n,s){if(n===W)return !0;if(n===D)return r;if(zt.hasOwnProperty(n))return Reflect.get(zt,n,s);let i=Reflect.get(r,n,s);return H(n,e)?i:(ct(n)&&h(r,n),h(r,"length"),C(i)&&!t?z(i):i)},set(r,n,s,i){let o=Reflect.get(r,n,i),a=Reflect.set(r,n,s,i);return O(s,o)&&(ct(n)&&b(r,n),(n==="length"||!o)&&b(r,"length")),a}}),Me={get(t,e){return e===W?!0:e===D?t:((e===Symbol.iterator||e==="size")&&h(t,v),Reflect.get(V(Ut,e)&&e in t?Ut:t,e,t))}},Te={get(t,e){return e===W?!0:e===D?t:Reflect.get(V(qt,e)&&e in t?qt:t,e,t)}},Ut={get(t){let e=f(this);return h(e,v),e.get(t)},set(t,e){let r=f(this),n=r.set(t,e);return b(r,v),n},add(t){let e=f(this),r=e.add(t);return b(e,v),r},has(t){let e=f(this);return h(e,v),e.has(t)},delete(t){let e=f(this),r=e.has(t),n=e.delete(t);return r&&b(e,v),n},clear(){let t=f(this),e=t.size>0,r=t.clear();return e&&b(t,v),r},forEach(t,e){let r=f(this);h(r,v),r.forEach((n,s)=>{t.call(e,n,s,r);});},get size(){let t=f(this);return h(t,v),t.size},keys(){let t=f(this);return h(t,v),t.keys()},values(){let t=f(this);return h(t,v),t.values()},entries(){let t=f(this);return h(t,v),t.entries()},[Symbol.iterator](){let t=f(this);return h(t,v),t[Symbol.iterator]()}},qt={get(t){let e=f(this);return h(e,R),e.get(t)},set(t,e){let r=f(this),n=r.set(t,e);return b(r,R),n},add(t){let e=f(this),r=e.add(t);return b(e,R),r},has(t){let e=f(this);return h(e,R),e.has(t)},delete(t){let e=f(this),r=e.delete(t);return b(e,R),r}};function z(t,e=!1,r){if(!C(t)||B(t))return t;if(ft.has(t))return ft.get(t);let n;m(t)?(h(t,gt),n=we(e,r)):Z(t)||Q(t)?(h(t,v),n=Me):it(t)||st(t)?(h(t,R),n=Te):n=ye(e,r);let s=new Proxy(t,n);return ft.set(t,s),s}function cr(t){if(!B(t)){x("clearReactive: argument must be a reactive object");return}if(st(t)||it(t)){x("clearReactive: WeakMap and WeakSet are not clearable");return}Oe(()=>{m(t)?t.length=0:Z(t)||Q(t)?t.clear():C(t)&&Object.keys(t).forEach(e=>{delete t[e];});});}function Oe(t){try{vt=!0,t();}finally{vt=!1,Pe();}}function Pe(){tt.size>0&&(tt.forEach(t=>t()),tt.clear());}function ar(){return _t(null)}function ur(t,e,r){return $e(t,e,r)}var Jt=void 0,et,bt=!1;function xe(t){et=t,bt||(bt=!0,Et(Re));}function Re(){et&&et(),et=null,bt=!1;}function $e(t,e,{deep:r,immediate:n}={}){let s,i=m(t);if(g(t)||Zt(t))s=()=>t.value;else if(B(t))s=()=>K({},t);else if(i)s=()=>t.map(c=>Ae(c));else if(d(t))s=t;else return x("Invalid source type",t),ut;if(e&&r){let c=s,l=r===!0?1/0:r;s=()=>F(c(),l);}let o=i?Array.from({length:t.length}).fill(Jt):Jt,a=!1,p=()=>{let c=s();O(c,o)&&(n&&e&&(e(c,o),o=c),a&&e&&xe(()=>{e(c,o),o=c;}),!a&&(o=c));},u=G(p,{flush:"sync"});return a=!0,n&&p(),u}function Ae(t){return g(t)||Zt(t)?t.value:B(t)?K({},t):d(t)?t():(x("Invalid source",t),ut)}function F(t,e=1/0,r){if(e<=0||!C(t)||(r=r||new Set,r.has(t)))return t;if(r.add(t),e--,g(t))F(t.value,e,r);else if(m(t))for(let n of t)F(n,e,r);else if(Z(t)||Q(t))t.forEach(n=>{F(n,e,r);});else if(T(t))for(let n in t)F(t[n],e,r);return t}function je(t){let{state:e,getters:r,actions:n}=t,s=K({},e),i=St(e),o=[],a=[],p={patch$(c){Object.assign(i,c),o.forEach(l=>l(i)),a.forEach(l=>l(i));},subscribe$(c){o.push(c);},unsubscribe$(c){let l=o.indexOf(c);l!==-1&&o.splice(l,1);},onAction$(c){a.push(c);},reset$(){Object.assign(i,s);}},u=K(pe(K({},i),{state:i}),p);if(r)for(let c in r){let l=r[c];l&&Object.defineProperty(u,c,{get(){return Se(()=>l.call(u,i)).value},enumerable:!0,configurable:!0});}if(n)for(let c in n){let l=n[c];l&&(u[c]=function(...L){let q=l.apply(i,L);return a.forEach(I=>I(i)),q});}return u}function lr(t){return function(){let e;typeof t=="function"?e=Le(t):e=t;let r=je(e);return typeof t=="function"&&Object.keys(e.actions||{}).forEach(n=>{r[n]=e.actions[n].bind(r);}),r}}function Le(t){let e=new t,r=Object.create(null),n={},s={};return Object.getOwnPropertyNames(e).forEach(i=>{r[i]=e[i];}),Object.getOwnPropertyNames(t.prototype).forEach(i=>{let o=Object.getOwnPropertyDescriptor(t.prototype,i);o&&(typeof o.get=="function"?n[i]=function(){return o.get.call(this)}:typeof o.value=="function"&&i!=="constructor"&&(s[i]=function(...a){return o.value.apply(this,a)}));}),{state:r,getters:n,actions:s}}var Ct="on",wt="update",M="children",Mt="",Ie="0",ke="1",te="ref",yt=" __PLACEHOLDER__ ",He=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},_=new He,ee=new Map;function Fe(t,e){ee.set(t,{index:e});}function Ke(t){var e;return (e=ee.get(t))==null?void 0:e.index}var Ot=class U{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(e,r){var n;(n=this.hooks[e])==null||n.add(r);}getContext(e){return U.context[e]}setContext(e,r){U.context[e]=r;}initRef(){U.ref=this;}removeRef(){U.ref=null;}clearHooks(){Object.values(this.hooks).forEach(e=>e.clear());}};Ot.ref=null;Ot.context={};var E=Ot;function Tt(t){return t instanceof Pt}var $=1,Pt=class extends E{constructor(t,e={},r){super(),this.template=t,this.props=e,this.key=r,Fe(t,$),this.templates=this.processTemplate();}processTemplate(){if(m(this.template)){let t=this.template.join(yt);return this.processHtmlString(t).split(yt)}return []}processHtmlString(t){return t.replaceAll(/(<[^>]+>)|([^<]+)/g,(e,r,n)=>r?r.includes("data-ci")?e:r.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(s,i,o)=>`<${i} data-ci="${$}"${o||""}>`):n&&n.replace(yt,"").trim()?`<!--0-${$}-->${n}<!$>`:e)}mount(){this.initRef();let t=this.render();return this.removeRef(),t}render(){if(d(this.template)){let t=this.template(this.props);return Tt(t)?t.mount():String(t)}return this.renderTemplate()}renderTemplate(){return Object.entries(this.props).forEach(([t,e])=>{let r=e.children;this.normalizeProps(e);let n=this.templates.findIndex(s=>s.includes(`data-hk="${t}"`));r&&this.renderChildren(r,n),this.templates[n]=this.templates[n].replace(`data-hk="${t}"`,`data-hk="${t}" ${this.generateAttributes(e)}`);}),this.templates.join("")}normalizeProps(t){Object.entries(t).forEach(([e,r])=>{e===M||d(r)?delete t[e]:g(r)&&(t[e]=r.value);});}generateAttributes(t){return Object.entries(t).filter(([e,r])=>e!==M&&!d(r)).map(([e,r])=>`${e}="${kt(String(r))}"`).join(" ")}renderChildren(t,e){t.forEach(([r])=>{$++;let n=this.renderChild(r);this.templates[e]+=n;});}renderChild(t){if(g(t))return `<!--1-${$}-->${t.value}<!$>`;if(d(t))return this.renderChild(t(this.props));if(Tt(t)){let e=t.mount();return d(e)?e(this.props):ne(e)}else return `<!--1-${$}-->${t}<!$>`}},We="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(",");function Vt(t){if(y(t)||t instanceof Node||Tt(t))return t;let e=ot(t)?"":String(t);return document.createTextNode(e)}function w(t,e,r=null){let n=y(r)?r.firstChild:r,s=_.isSSR;y(e)?e.mount(t,n):n&&!s?n.before(e):s||t.append(e);}function j(t){y(t)?t.unmount():t.parentNode&&t.remove();}function re(t,e,r){w(t,e,r),j(r);}function De(t,e,r){e==="class"?Ge(t,r):e==="style"?Be(t,r):ze(t,e,r);}function Ge(t,e){typeof e=="string"?t.className=e:m(e)?t.className=e.join(" "):e&&typeof e=="object"&&(t.className=Object.entries(e).reduce((r,[n,s])=>r+(s?` ${n}`:""),"").trim());}function Be(t,e){typeof e=="string"?t.style.cssText=e:e&&typeof e=="object"&&Object.entries(e).forEach(([n,s])=>{t.style.setProperty(Ht(n),String(s));});}function ze(t,e,r){ot(r)?t.removeAttribute(e):r===!0?t.setAttribute(e,""):t instanceof HTMLInputElement&&e==="value"?t.value=String(r):t.setAttribute(e,String(r));}function Ue(t,e){if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return N(t,"change",()=>{e(!!t.checked);});case"date":return N(t,"change",()=>{e(t.value?t.value:"");});case"file":return N(t,"change",()=>{t.files&&e(t.files);});case"number":return N(t,"input",()=>{let r=Number.parseFloat(t.value);e(Number.isNaN(r)?"":String(r));});case"radio":return N(t,"change",()=>{e(t.checked?t.value:"");});case"text":return N(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return N(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return N(t,"input",()=>{e(t.value);})}function N(t,e,r){return t.addEventListener(e,r),()=>t.removeEventListener(e,r)}function qe(t){return We.includes(t)?`<${t}/>`:`<${t}></${t}>`}function ne(t){return g(t)?t.value:t}var xt=class extends E{constructor(t,e,r){super(),this.template=t,this.props=e,this.key=r,this.emitter=new Set,this.rootNode=null,this.trackMap=new Map,this.key||(this.key=e&&e.key),this.proxyProps=this.createProxyProps(e);}createProxyProps(t){return t?Qt(t,e=>P(e,Ct)||P(e,wt)||e===M):{}}get firstChild(){var t,e;return (e=(t=this.rootNode)==null?void 0:t.firstChild)!=null?e:null}get isConnected(){var t,e;return (e=(t=this.rootNode)==null?void 0:t.isConnected)!=null?e:!1}mount(t,e){var r,n,s,i;if(!d(this.template))throw new Error("Template must be a function");if(this.isConnected)return (n=(r=this.rootNode)==null?void 0:r.mount(t,e))!=null?n:[];this.initRef(),this.rootNode=this.template(St(this.proxyProps,[M]));let o=(i=(s=this.rootNode)==null?void 0:s.mount(t,e))!=null?i:[];return this.callMountHooks(),this.patchProps(this.props),this.removeRef(),o}unmount(){var t;this.callDestroyHooks(),this.clearHooks(),(t=this.rootNode)==null||t.unmount(),this.rootNode=null,this.proxyProps={},this.clearEmitter();}callMountHooks(){this.hooks.mounted.forEach(t=>t());}callDestroyHooks(){this.hooks.destroy.forEach(t=>t());}clearEmitter(){for(let t of this.emitter)t();this.emitter.clear();}inheritNode(t){Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap,this.hooks=t.hooks;let e=this.props;this.props=t.props,this.patchProps(e);}getNodeTrack(t){let e=this.trackMap.get(t);return e||(e={cleanup:()=>{}},this.trackMap.set(t,e)),e.cleanup(),e}patchProps(t){var e;if(t){for(let[r,n]of Object.entries(t))P(r,Ct)&&((e=this.rootNode)!=null&&e.firstChild)?this.patchEventListener(r,n):r===te?this.patchRef(n):P(r,wt)?this.patchUpdateHandler(r,n):r!==M&&this.patchNormalProp(r,n);this.props=t;}}patchEventListener(t,e){let r=t.slice(2).toLowerCase(),n=N(this.rootNode.nodes[0],r,e);this.emitter.add(n);}patchRef(t){var e,r;t.value=(r=(e=this.rootNode)==null?void 0:e.firstChild)!=null?r:null;}patchUpdateHandler(t,e){this.props[t]=ne(e);}patchNormalProp(t,e){var r,n;let s=(n=(r=this.proxyProps)[t])!=null?n:r[t]=Nt(e),i=this.getNodeTrack(t);i.cleanup=G(()=>{s.value=d(e)?e():e;});}};function Je(t,e,r,n){let s=new Map,i=Array.from(e.values());if(i.length&&r.length===0)return Xe(t,i,n),s;let o=[],a=Ze(r),p=0;for(let[u,c]of r.entries()){let l=i[p],L=A(l,u);for(;l&&!a.has(L);)j(l),e.delete(L),l=i[++p],L=A(l,u);let q=A(c,u),I=e.get(q);if(I&&(c=Ye(t,I,c)),l)if(l===I)p++;else {let $t=document.createComment("");w(t,$t,l),o.push([$t,c]);}else w(t,c,n);s.set(q,c);}return o.forEach(([u,c])=>{re(t,c,u);}),e.forEach((u,c)=>{u.isConnected&&!s.has(c)&&j(u);}),s}function Xe(t,e,r){if(t.childNodes.length===e.length+(r?1:0))t.innerHTML="",r&&w(t,r);else {let n=document.createRange(),s=e[0],i=y(s)?s.firstChild:s;n.setStartBefore(i),r?n.setEndBefore(r):n.setEndAfter(t),n.deleteContents();}e.forEach(n=>{y(n)&&n.unmount();});}function Ye(t,e,r){return e===r?e:y(e)&&y(r)&&e.template===r.template?(r.inheritNode(e),r):e instanceof Text&&r instanceof Text?(e.textContent!==r.textContent&&(e.textContent=r.textContent),e):(re(t,r,e),r)}function Ze(t){let e=new Map;for(let[r,n]of t.entries()){let s=A(n,r);e.set(s,n);}return e}function A(t,e){if(y(t)){let r=t.key;if(r!=null)return String(r)}return `_$${e}$`}var rt=class{constructor(t,e,r){this.template=t,this.props=e,this.key=r,this.treeMap=new Map,this.mounted=!1,this.nodes=[],this.trackMap=new Map,this.bindValueKeys=[],this.parent=null,_.isSSR&&(this.componentIndex=Ke(this.template));}get firstChild(){var t;return (t=this.nodes[0])!=null?t:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}mount(t,e){var r;if(this.parent=t,this.isConnected)return this.nodes.forEach(i=>w(t,i,e)),this.nodes;m(this.template)&&(this.template=Rt(this.template.join("")));let n=this.template.content.cloneNode(!0),s=n.firstChild;return (r=s==null?void 0:s.hasAttribute)!=null&&r.call(s,"_svg_")&&(s.remove(),s.childNodes.forEach(i=>{n.append(i);})),this.nodes=Array.from(n.childNodes),_.isSSR?this.mapSSGNodeTree(t):this.mapNodeTree(t,n),w(t,n,e),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(t=>{t.cleanup&&t.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(t=>j(t)),this.nodes=[],this.mounted=!1;}inheritNode(t){this.mounted=t.mounted,this.nodes=t.nodes,this.trackMap=t.trackMap,this.treeMap=t.treeMap;let e=this.props;this.props=t.props,this.patchProps(e);}mapSSGNodeTree(t){this.treeMap.set(0,t),this.walkNodeTree(t,this.handleSSGNode.bind(this));}mapNodeTree(t,e){let r=1;this.treeMap.set(0,t);let n=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(r++,s);};this.walkNodeTree(e,n);}walkNodeTree(t,e){t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&e(t);let r=t.firstChild;for(;r;)this.walkNodeTree(r,e),r=r.nextSibling;}handleSSGNode(t){var e;if(t.nodeType===Node.COMMENT_NODE){let[r,n]=((e=t.textContent)==null?void 0:e.split("-"))||[];if(+r==0&&+n===this.componentIndex){let s=t.nextSibling;this.treeMap.set(+n,s);}}else if(t.nodeType!==Node.TEXT_NODE){let{ci:r="-1",hk:n}=(t==null?void 0:t.dataset)||{};n&&+r===this.componentIndex&&this.treeMap.set(+n,t);}}patchProps(t){t&&(Object.entries(t).forEach(([e,r])=>{let n=Number(e),s=this.treeMap.get(n);s&&this.patchProp(e,s,r,n===0);}),this.props=t);}patchProp(t,e,r,n){r&&Object.entries(r).forEach(([s,i])=>{if(s===M&&i)this.patchChildren(t,e,i,n);else if(s===te)r[s].value=e;else if(P(s,Ct))this.patchEventListener(t,e,s,i);else {if(this.bindValueKeys.includes(s))return;let o=this.getBindUpdateValue(r,t,s);this.patchAttribute(t,e,s,i,o);}});}getBindUpdateValue(t,e,r){let n=`${wt}${Ft(r)}`;if(n&&t[n]&&d(t[n]))return this.bindValueKeys.push(n),t[n]}patchChildren(t,e,r,n){if(m(r))r.filter(Boolean).forEach((s,i)=>{var o;let[a,p]=m(s)?s:[s,null],u=Lt(p)?null:(o=this.treeMap.get(p))!=null?o:null,c=`${t}:${M}:${i}`,l=this.getNodeTrack(c,!0,n);this.patchChild(l,e,a,u);});else {let s=`${t}:${M}:0`,i=this.getNodeTrack(s,!0,n);this.patchChild(i,e,r,null);}}patchEventListener(t,e,r,n){let s=r.slice(2).toLowerCase(),i=this.getNodeTrack(`${t}:${r}`);i.cleanup=N(e,s,n);}patchAttribute(t,e,r,n,s){let i=this.getNodeTrack(`${t}:${r}`),o=_t(),a=G(()=>{let u=d(n)?n():n;T(u)&&T(o.peek())&&JSON.stringify(o.value)===JSON.stringify(u)||(o.value=g(u)?u.value:u,De(e,r,o.value));}),p;s&&It(e)&&(p=Ue(e,u=>{s(u);})),i.cleanup=()=>{a&&a(),p&&p();};}getNodeTrack(t,e,r){let n=this.trackMap.get(t);return n||(n={cleanup:()=>{}},e&&(n.lastNodes=new Map),r&&(n.isRoot=!0),this.trackMap.set(t,n)),n.cleanup&&n.cleanup(),n}patchChild(t,e,r,n){d(r)?t.cleanup=G(()=>{let s=at(r()).map(Vt);_.isSSR?t.lastNodes=this.reconcileChildren(e,s,n):t.lastNodes=Je(e,t.lastNodes,s,n);}):at(r).forEach((s,i)=>{let o=Vt(s),a=A(o,i);_.isSSR?t.lastNodes=this.reconcileChildren(e,[o],n):(t.lastNodes.set(a,o),w(e,o,n));});}reconcileChildren(t,e,r){let n=new Map,s=Array.from(t.childNodes).filter(i=>{var o,a;return i.nodeType===Node.TEXT_NODE&&((o=i.previousSibling)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&((a=i.nextSibling)==null?void 0:a.nodeType)===Node.COMMENT_NODE});return e.forEach((i,o)=>{let a=A(i,o);i.nodeType===Node.TEXT_NODE?s.forEach(p=>{i.textContent===p.textContent&&t.replaceChild(i,p);}):w(t,i,r),n.set(a,i);}),n}},Qe=class extends rt{unmount(){this.trackMap.forEach(t=>{t.lastNodes&&t.lastNodes.forEach(e=>{j(e);}),t.cleanup&&t.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(t=>{j(t);}),this.nodes=[],this.mounted=!1;}};function se(t,e,r){if(t===Mt)return Ve(t,e);if(Y(t)){let n=qe(t);return e={[ke]:e},new rt(Rt(n),e,r)}return d(t)?new xt(t,e,r):new rt(t,e,r)}function br(t){return t instanceof xt}function y(t){return t instanceof xt||t instanceof rt}function Rt(t){let e=document.createElement("template");return e.innerHTML=t,e}function Ve(t,e){return e.children&&(e={[Ie]:{children:m(e.children)?e.children.filter(Boolean):[e.children]}}),t===Mt&&(t=Rt(Mt)),new Qe(t,e)}function Er(t){nt("onMounted"),E.ref&&E.ref.addHook("mounted",t);}function Nr(t){nt("onDestroy"),E.ref&&E.ref.addHook("destroy",t);}function nt(t,e){E.ref||console.error(`"${t}"(key: ${jt(e)?e.toString():e}) can only be called within the component function body
7
- and cannot be used in asynchronous or deferred calls.`);}function _r(t,e){nt("provide",t),E.ref&&E.ref.setContext(t,e);}function Sr(t,e){var r;return nt("inject",t),(r=E.ref&&E.ref.getContext(t))!=null?r:e}function yr(t,e){_.setSSG();let n=new Pt(t,e||{}).mount();return _.setClient(),n}function Cr(t,e){let r=typeof e=="string"?document.querySelector(e):e;if(!r)throw new Error(`Could not find container: ${e}`);_.setSSR(),se(t).mount(r),_.setClient();}function wr(t,e){return _.isSSG?new Pt(t,e):se(t,e)}globalThis&&(globalThis.__essor_version__=At);/**
8
- * @estjs/signal v0.0.14-beta.19
6
+ var jt="0.0.14-beta.21";var C=t=>t!==null&&typeof t=="object";var g=Array.isArray;function X(t){return typeof t=="string"}function Lt(t){return typeof t=="symbol"}function Y(t){return I.call(t)==="[object Set]"}function ct(t){return I.call(t)==="[object WeakMap]"}function at(t){return I.call(t)==="[object WeakSet]"}function Z(t){return I.call(t)==="[object Map]"}function It(t){return t==null}var d=t=>typeof t=="function";function ut(t){return t===!1||t===null||t===void 0}function kt(t){return t?t&&typeof t=="object"&&t.nodeType===1&&typeof t.nodeName=="string":!1}var T=t=>I.call(t)==="[object Object]";function lt(t){return X(t)?!Number.isNaN(Number(t)):!1}var I=Object.prototype.toString;var oe=Object.prototype.hasOwnProperty,Q=(t,e)=>oe.call(t,e);function ft(t){return g(t)?t.flat():[t]}var w=(t,e)=>t!==e&&(t===t||e===e),ht=Function.prototype;function O(t,e){return X(t)?t.indexOf(e)===0:!1}function Ht(t){return t.replaceAll(/["&'<>]/g,e=>{switch(e){case"&":return "&amp;";case"<":return "&lt;";case">":return "&gt;";case'"':return "&quot;";case"'":return "&#039;";default:return e}})}function k(t,e){return g(e)?e.includes(t):d(e)?e(t):!1}var pt=t=>{let e=Object.create(null);return r=>e[r]||(e[r]=t(r))},ce=/\B([A-Z])/g,Ft=pt(t=>t.replaceAll(ce,"-$1").toLowerCase()),Kt=pt(t=>t.charAt(0).toUpperCase()+t.slice(1));function x(t,...e){console.warn.apply(console,[`[Essor warn]: ${t}`].concat(e));}var ue=Object.defineProperty,le=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,Gt=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,Wt=(t,e,r)=>e in t?ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F=(t,e)=>{for(var r in e||(e={}))he.call(e,r)&&Wt(t,r,e[r]);if(Gt)for(var r of Gt(e))pe.call(e,r)&&Wt(t,r,e[r]);return t},de=(t,e)=>le(t,fe(e)),mt=[],gt=[],Dt=Promise.resolve(),vt=!1;function _t(t){return t?Dt.then(t):Dt}function me(t){mt.includes(t)||(mt.push(t),Yt());}function Yt(){vt||(vt=!0,_t(ye));}function ge(t){ve(t,gt);}function ve(t,e){e.includes(t)||(e.push(t),Yt());}function ye(){vt=!1,be();let t;for(;t=mt.shift();)t&&t();}function be(){for(;gt.length>0;){let t=gt.shift();t&&t();}}function Se(t,e){return e==="sync"?()=>t():e==="pre"?()=>ge(t):()=>{_t(()=>me(t));}}var _=null,yt=new WeakMap,dt=new WeakMap,K=Symbol("ReactiveSymbol"),G=Symbol("__raw"),Bt=Symbol("SignalValueKey"),zt=Symbol("ComputedValueKey"),bt=Symbol("ReactiveArrayKey"),v=Symbol("ReactiveCollectionKey"),R=Symbol("ReactiveWeakCollectionKey"),St=!1,V=new Set;function h(t,e){if(!_)return;let r=yt.get(t);r||(r=new Map,yt.set(t,r));let n=r.get(e);n||(n=new Set,r.set(e,n)),n.add(_);}function y(t,e){let r=yt.get(t);if(!r)return;let n=r.get(e);n&&n.forEach(s=>{if(Q(s,"active")&&!s.active){n.delete(s);return}St?V.add(s):s();});}var Ee=class extends Function{constructor(t){return super(),Object.setPrototypeOf(t,new.target.prototype)}},Zt=class extends Ee{constructor(t,e=!1){super(()=>this.value),this.__signal=!0,this.__shallow=e,this.__value=t;}get value(){return h(this,Bt),C(this.__value)?B(this.__value,this.__shallow):this.__value}set value(t){m(t)&&(t=t.peek()),w(t,this.__value)&&(this.__value=t,y(this,Bt));}peek(){return this.__value}set(t){this.value=t;}update(t){this.set(t(this.peek()));}};function _e(t){return m(t)?t:new Zt(t)}function Nt(t){return new Zt(t,!0)}function m(t){return !!(t&&(t!=null&&t.__signal))}var Ne=class{constructor(t){this.fn=t,this.__computed=!0;let e=_;_=this.run.bind(this),this.__value=this.fn(),_=e;}peek(){return this.__value}run(){let t=this.fn();w(t,this.__value)&&(this.__value=t,y(this,zt));}get value(){return h(this,zt),this.__value}};function Ce(t){return new Ne(t)}function Qt(t){return !!(t&&t.__computed)}function W(t,e={}){let{flush:r="pre",onTrack:n,onTrigger:s}=e;function i(){let a=_;_=i.init?i:i.scheduler,t(),s&&s(),_=a;}let o=Se(i,r);return i.scheduler=o,i.init=!0,i.active=!0,n&&n(),i(),()=>{i.active=!1,_=null;}}function cr(t,e){return !t||!C(t)?(x("initialValues must be an object,will return initial value!",t),t):Object.entries(t).reduce((n,[s,i])=>(n[s]=k(s,e)||m(i)?i:_e(i),n),{})}function f(t){return t&&(D(t)?t[G]:m(t)?t.peek():g(t)?t.map(e=>f(e)):T(t)?Object.fromEntries(Object.entries(t).map(([e,r])=>[e,f(r)])):t)}function D(t){return !!(t&&typeof t=="object"&&t[K])}function Ct(t,e){return B(t,!1,e)}function Vt(t,e){return B(t,!0,e)}var we=(t,e)=>({get(r,n,s){if(n===K)return !0;if(n===G)return r;let i=Reflect.get(r,n,s),o=m(i)?i.value:i;return k(n,e)?o:(h(r,n),C(o)&&!t?B(o):o)},set(r,n,s,i){if(k(n,e))return Reflect.set(r,n,s,i),!0;let o=Reflect.get(r,n,i);m(o)&&(o=o.value),m(s)&&(s=s.value);let a=Reflect.set(r,n,s,i);return w(s,o)&&y(r,n),a},deleteProperty(r,n){let s=Reflect.get(r,n),i=Reflect.deleteProperty(r,n);return s!==void 0&&y(r,n),i}}),Ut=Me();function Me(){let t={};return ["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...r){let n=f(this);for(let i=0,o=this.length;i<o;i++)h(n,`${i}`);let s=n[e](...r);return s===-1||s===!1?n[e](...r):s};}),["push","pop","shift","unshift","splice","sort","reverse"].forEach(e=>{t[e]=function(...r){let n=f(this),s=n[e].apply(this,r);return y(n,bt),s};}),["forEach","map","filter","reduce","reduceRight","some","every","find","findIndex","findLast","findLastIndex","entries","keys","values"].forEach(e=>{t[e]=function(...r){let n=f(this);return h(n,bt),n[e].apply(this,r)};}),t}var Pe=(t,e)=>({get(r,n,s){if(n===K)return !0;if(n===G)return r;if(Ut.hasOwnProperty(n))return Reflect.get(Ut,n,s);let i=Reflect.get(r,n,s);return k(n,e)?i:(lt(n)&&h(r,n),h(r,"length"),C(i)&&!t?B(i):i)},set(r,n,s,i){let o=Reflect.get(r,n,i),a=Reflect.set(r,n,s,i);return w(s,o)&&(lt(n)&&y(r,n),(n==="length"||!o)&&y(r,"length")),a}}),Te={get(t,e){return e===K?!0:e===G?t:((e===Symbol.iterator||e==="size")&&h(t,v),Reflect.get(Q(qt,e)&&e in t?qt:t,e,t))}},Oe={get(t,e){return e===K?!0:e===G?t:Reflect.get(Q(Jt,e)&&e in t?Jt:t,e,t)}},qt={get(t){let e=f(this);return h(e,v),e.get(t)},set(t,e){let r=f(this),n=r.set(t,e);return y(r,v),n},add(t){let e=f(this),r=e.add(t);return y(e,v),r},has(t){let e=f(this);return h(e,v),e.has(t)},delete(t){let e=f(this),r=e.has(t),n=e.delete(t);return r&&y(e,v),n},clear(){let t=f(this),e=t.size>0,r=t.clear();return e&&y(t,v),r},forEach(t,e){let r=f(this);h(r,v),r.forEach((n,s)=>{t.call(e,n,s,r);});},get size(){let t=f(this);return h(t,v),t.size},keys(){let t=f(this);return h(t,v),t.keys()},values(){let t=f(this);return h(t,v),t.values()},entries(){let t=f(this);return h(t,v),t.entries()},[Symbol.iterator](){let t=f(this);return h(t,v),t[Symbol.iterator]()}},Jt={get(t){let e=f(this);return h(e,R),e.get(t)},set(t,e){let r=f(this),n=r.set(t,e);return y(r,R),n},add(t){let e=f(this),r=e.add(t);return y(e,R),r},has(t){let e=f(this);return h(e,R),e.has(t)},delete(t){let e=f(this),r=e.delete(t);return y(e,R),r}};function B(t,e=!1,r){if(!C(t)||D(t))return t;if(dt.has(t))return dt.get(t);let n;g(t)?(h(t,bt),n=Pe(e,r)):Y(t)||Z(t)?(h(t,v),n=Te):at(t)||ct(t)?(h(t,R),n=Oe):n=we(e,r);let s=new Proxy(t,n);return dt.set(t,s),s}function ar(t){if(!D(t)){x("clearReactive: argument must be a reactive object");return}if(ct(t)||at(t)){x("clearReactive: WeakMap and WeakSet are not clearable");return}xe(()=>{g(t)?t.length=0:Y(t)||Z(t)?t.clear():C(t)&&Object.keys(t).forEach(e=>{delete t[e];});});}function xe(t){try{St=!0,t();}finally{St=!1,Re();}}function Re(){V.size>0&&(V.forEach(t=>t()),V.clear());}function ur(){return Nt(null)}function lr(t,e,r){return je(t,e,r)}var Xt=void 0,tt,Et=!1;function $e(t){tt=t,Et||(Et=!0,_t(Ae));}function Ae(){tt&&tt(),tt=null,Et=!1;}function je(t,e,{deep:r,immediate:n}={}){let s,i=g(t);if(m(t)||Qt(t))s=()=>t.value;else if(D(t))s=()=>F({},t);else if(i)s=()=>t.map(c=>Le(c));else if(d(t))s=t;else return x("Invalid source type",t),ht;if(e&&r){let c=s,l=r===!0?1/0:r;s=()=>H(c(),l);}let o=i?Array.from({length:t.length}).fill(Xt):Xt,a=!1,p=()=>{let c=s();w(c,o)&&(n&&e&&(e(c,o),o=c),a&&e&&$e(()=>{e(c,o),o=c;}),!a&&(o=c));},u=W(p,{flush:"sync"});return a=!0,n&&p(),u}function Le(t){return m(t)||Qt(t)?t.value:D(t)?F({},t):d(t)?t():(x("Invalid source",t),ht)}function H(t,e=1/0,r){if(e<=0||!C(t)||(r=r||new Set,r.has(t)))return t;if(r.add(t),e--,m(t))H(t.value,e,r);else if(g(t))for(let n of t)H(n,e,r);else if(Y(t)||Z(t))t.forEach(n=>{H(n,e,r);});else if(T(t))for(let n in t)H(t[n],e,r);return t}function Ie(t){let{state:e,getters:r,actions:n}=t,s=F({},e),i=Ct(e),o=[],a=[],p={patch$(c){Object.assign(i,c),o.forEach(l=>l(i)),a.forEach(l=>l(i));},subscribe$(c){o.push(c);},unsubscribe$(c){let l=o.indexOf(c);l!==-1&&o.splice(l,1);},onAction$(c){a.push(c);},reset$(){Object.assign(i,s);}},u=F(de(F({},i),{state:i}),p);if(r)for(let c in r){let l=r[c];l&&Object.defineProperty(u,c,{get(){return Ce(()=>l.call(u,i)).value},enumerable:!0,configurable:!0});}if(n)for(let c in n){let l=n[c];l&&(u[c]=function(...j){let U=l.apply(i,j);return a.forEach(L=>L(i)),U});}return u}function fr(t){return function(){let e;typeof t=="function"?e=ke(t):e=t;let r=Ie(e);return typeof t=="function"&&Object.keys(e.actions||{}).forEach(n=>{r[n]=e.actions[n].bind(r);}),r}}function ke(t){let e=new t,r=Object.create(null),n={},s={};return Object.getOwnPropertyNames(e).forEach(i=>{r[i]=e[i];}),Object.getOwnPropertyNames(t.prototype).forEach(i=>{let o=Object.getOwnPropertyDescriptor(t.prototype,i);o&&(typeof o.get=="function"?n[i]=function(){return o.get.call(this)}:typeof o.value=="function"&&i!=="constructor"&&(s[i]=function(...a){return o.value.apply(this,a)}));}),{state:r,getters:n,actions:s}}var Mt="on",Pt="update",P="children",Tt="",He="0",Fe="1",ee="ref",wt=" __PLACEHOLDER__ ",Ke=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},E=new Ke,re=new Map;function Ge(t,e){re.set(t,{index:e});}function We(t){var e;return (e=re.get(t))==null?void 0:e.index}var xt=class z{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(e,r){var n;(n=this.hooks[e])==null||n.add(r);}getContext(e){return z.context[e]}setContext(e,r){z.context[e]=r;}initRef(){z.ref=this;}removeRef(){z.ref=null;}clearHooks(){Object.values(this.hooks).forEach(e=>e.clear());}};xt.ref=null;xt.context={};var b=xt;function Ot(t){return t instanceof Rt}var $=1,Rt=class extends b{constructor(t,e={},r){super(),this.template=t,this.props=e,this.key=r,Ge(t,$),this.templates=this.processTemplate();}processTemplate(){if(g(this.template)){let t=this.template.join(wt);return this.processHtmlString(t).split(wt)}return []}processHtmlString(t){return t.replaceAll(/(<[^>]+>)|([^<]+)/g,(e,r,n)=>r?r.includes("data-ci")?e:r.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(s,i,o)=>`<${i} data-ci="${$}"${o||""}>`):n&&n.replace(wt,"").trim()?`<!--0-${$}-->${n}<!$>`:e)}mount(){this.initRef();let t=this.render();return this.removeRef(),t}render(){if(d(this.template)){let t=this.template(this.props);return Ot(t)?t.mount():String(t)}return this.renderTemplate()}renderTemplate(){return Object.entries(this.props).forEach(([t,e])=>{let r=e.children;this.normalizeProps(e);let n=this.templates.findIndex(s=>s.includes(`data-hk="${t}"`));r&&this.renderChildren(r,n),this.templates[n]=this.templates[n].replace(`data-hk="${t}"`,`data-hk="${t}" ${this.generateAttributes(e)}`);}),this.templates.join("")}normalizeProps(t){Object.entries(t).forEach(([e,r])=>{e===P||d(r)?delete t[e]:m(r)&&(t[e]=r.value);});}generateAttributes(t){return Object.entries(t).filter(([e,r])=>e!==P&&!d(r)).map(([e,r])=>`${e}="${Ht(String(r))}"`).join(" ")}renderChildren(t,e){t.forEach(([r])=>{$++;let n=this.renderChild(r);this.templates[e]+=n;});}renderChild(t){if(m(t))return `<!--1-${$}-->${t.value}<!$>`;if(d(t))return this.renderChild(t(this.props));if(Ot(t)){let e=t.mount();return d(e)?e(this.props):se(e)}else return `<!--1-${$}-->${t}<!$>`}},De="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(",");function te(t){if(N(t)||t instanceof Node||Ot(t))return t;let e=ut(t)?"":String(t);return document.createTextNode(e)}function M(t,e,r=null){let n=N(r)?r.firstChild:r,s=E.isSSR;N(e)?e.mount(t,n):n&&!s?n.before(e):s||t.append(e);}function rt(t){N(t)?t.unmount():t.parentNode&&t.remove();}function ne(t,e,r){M(t,e,r),rt(r);}function Be(t,e,r){e==="class"?ze(t,r):e==="style"?Ue(t,r):qe(t,e,r);}function ze(t,e){typeof e=="string"?t.className=e:g(e)?t.className=e.join(" "):e&&typeof e=="object"&&(t.className=Object.entries(e).reduce((r,[n,s])=>r+(s?` ${n}`:""),"").trim());}function Ue(t,e){typeof e=="string"?t.style.cssText=e:e&&typeof e=="object"&&Object.entries(e).forEach(([n,s])=>{t.style.setProperty(Ft(n),String(s));});}function qe(t,e,r){ut(r)?t.removeAttribute(e):r===!0?t.setAttribute(e,""):t instanceof HTMLInputElement&&e==="value"?t.value=String(r):t.setAttribute(e,String(r));}function Je(t,e){if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return S(t,"change",()=>{e(!!t.checked);});case"date":return S(t,"change",()=>{e(t.value?t.value:"");});case"file":return S(t,"change",()=>{t.files&&e(t.files);});case"number":return S(t,"input",()=>{let r=Number.parseFloat(t.value);e(Number.isNaN(r)?"":String(r));});case"radio":return S(t,"change",()=>{e(t.checked?t.value:"");});case"text":return S(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return S(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return S(t,"input",()=>{e(t.value);})}function S(t,e,r){return t.addEventListener(e,r),()=>t.removeEventListener(e,r)}function Xe(t){return De.includes(t)?`<${t}/>`:`<${t}></${t}>`}function se(t){return m(t)?t.value:t}var it=class extends b{constructor(t,e,r){super(),this.template=t,this.props=e,this.key=r,this.emitter=new Set,this.rootNode=null,this.trackMap=new Map,this.nodes=[],this.parent=null,this.before=null,this.key||(this.key=e&&e.key),this.proxyProps||(this.proxyProps=this.createProxyProps(e));}createProxyProps(t){return t?Vt(t,e=>O(e,Mt)||O(e,Pt)||e===P):{}}get firstChild(){var t,e;return (e=(t=this.rootNode)==null?void 0:t.firstChild)!=null?e:null}get isConnected(){var t,e;return (e=(t=this.rootNode)==null?void 0:t.isConnected)!=null?e:!1}mount(t,e){var r,n,s,i;if(this.parent=t,!d(this.template))throw new Error("Template must be a function");return this.isConnected?(n=(r=this.rootNode)==null?void 0:r.mount(t,e))!=null?n:[]:(this.initRef(),this.rootNode=this.template(Ct(this.proxyProps,[P])),this.nodes=(i=(s=this.rootNode)==null?void 0:s.mount(t,e))!=null?i:[],this.callMountHooks(),this.patchProps(this.props),this.removeRef(),this.nodes)}unmount(){var t;this.callLifecycleHooks("destroy"),this.cleanup(),(t=this.rootNode)==null||t.unmount(),this.resetState(),this.key&&st.delete(this.key);}resetState(){this.rootNode=null,this.proxyProps={},this.nodes=[],this.parent=null;}callLifecycleHooks(t){this.hooks[t].forEach(e=>e());}callMountHooks(){this.hooks.mounted.forEach(t=>t());}callDestroyHooks(){this.hooks.destroy.forEach(t=>t());}clearEmitter(){for(let t of this.emitter)t();this.emitter.clear();}inheritNode(t){if(Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap,this.hooks=t.hooks,w(t.props,this.props)){let e=this.props;this.props=t.props,this.patchProps(e);}}getNodeTrack(t){let e=this.trackMap.get(t);return e||(e={cleanup:()=>{}},this.trackMap.set(t,e)),e.cleanup(),e}patchProps(t){var e;if(t){for(let[r,n]of Object.entries(t))O(r,Mt)&&((e=this.rootNode)!=null&&e.firstChild)?this.patchEventListener(r,n):r===ee?this.patchRef(n):O(r,Pt)?this.patchUpdateHandler(r,n):r!==P&&this.patchNormalProp(r,n);this.props=t;}}patchEventListener(t,e){let r=t.slice(2).toLowerCase(),n=S(this.rootNode.nodes[0],r,e);this.emitter.add(n);}patchRef(t){var e,r;t.value=(r=(e=this.rootNode)==null?void 0:e.firstChild)!=null?r:null;}patchUpdateHandler(t,e){this.proxyProps[t]=se(e);}patchNormalProp(t,e){let r=this.getNodeTrack(t);r.cleanup=W(()=>{this.proxyProps[t]=d(e)?e():e;});}cleanup(){this.trackMap.forEach(t=>{var e;return (e=t.cleanup)==null?void 0:e.call(t)}),this.trackMap.clear(),this.emitter.forEach(t=>t()),this.emitter.clear();}};function Ye(t,e,r,n){let s=new Map,i=Array.from(e.values());if(i.length&&r.length===0)return Ze(t,i,n),s;let o=[],a=Ve(r),p=0;for(let[u,c]of r.entries()){let l=i[p],j=A(l,u);for(;l&&!a.has(j);)rt(l),e.delete(j),l=i[++p],j=A(l,u);let U=A(c,u),L=e.get(U);if(L&&(c=Qe(t,L,c)),l)if(l===L)p++;else {let At=document.createComment("");M(t,At,l),o.push([At,c]);}else M(t,c,n);s.set(U,c);}return o.forEach(([u,c])=>{ne(t,c,u);}),e.forEach((u,c)=>{u.isConnected&&!s.has(c)&&rt(u);}),s}function Ze(t,e,r){if(t.childNodes.length===e.length+(r?1:0))t.innerHTML="",r&&M(t,r);else {let n=document.createRange(),s=e[0],i=N(s)?s.firstChild:s;n.setStartBefore(i),r?n.setEndBefore(r):n.setEndAfter(t),n.deleteContents();}e.forEach(n=>{N(n)&&n.unmount();});}function Qe(t,e,r){return e===r?e:N(e)&&N(r)&&e.template===r.template?(r.inheritNode(e),r):e instanceof Text&&r instanceof Text?(e.textContent!==r.textContent&&(e.textContent=r.textContent),e):(ne(t,r,e),r)}function Ve(t){let e=new Map;for(let[r,n]of t.entries()){let s=A(n,r);e.set(s,n);}return e}function A(t,e){if(N(t)){let r=t.key;if(r!=null)return String(r)}return `_$${e}$`}var nt=class{constructor(t,e,r){this.template=t,this.props=e,this.key=r,this.treeMap=new Map,this.mounted=!1,this.nodes=[],this.trackMap=new Map,this.bindValueKeys=[],this.parent=null,E.isSSR&&(this.componentIndex=We(this.template));}get firstChild(){var t;return (t=this.nodes[0])!=null?t:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}mount(t,e){var r;if(this.parent=t,this.isConnected)return this.nodes.forEach(i=>M(t,i,e)),this.nodes;g(this.template)&&(this.template=$t(this.template.join("")));let n=this.template.content.cloneNode(!0),s=n.firstChild;return (r=s==null?void 0:s.hasAttribute)!=null&&r.call(s,"_svg_")&&(s.remove(),s.childNodes.forEach(i=>{n.append(i);})),this.nodes=Array.from(n.childNodes),E.isSSR?this.mapSSGNodeTree(t):this.mapNodeTree(t,n),M(t,n,e),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(t=>{t.cleanup&&t.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(t=>rt(t)),this.nodes=[],this.mounted=!1,this.key&&st.delete(this.key);}inheritNode(t){this.mounted=t.mounted,this.nodes=t.nodes,this.trackMap=t.trackMap,this.treeMap=t.treeMap;let e=this.props;this.props=t.props,this.patchProps(e);}mapSSGNodeTree(t){this.treeMap.set(0,t),this.walkNodeTree(t,this.handleSSGNode.bind(this));}mapNodeTree(t,e){let r=1;this.treeMap.set(0,t);let n=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(r++,s);};this.walkNodeTree(e,n);}walkNodeTree(t,e){t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&e(t);let r=t.firstChild;for(;r;)this.walkNodeTree(r,e),r=r.nextSibling;}handleSSGNode(t){var e;if(t.nodeType===Node.COMMENT_NODE){let[r,n]=((e=t.textContent)==null?void 0:e.split("-"))||[];if(+r==0&&+n===this.componentIndex){let s=t.nextSibling;this.treeMap.set(+n,s);}}else if(t.nodeType!==Node.TEXT_NODE){let{ci:r="-1",hk:n}=(t==null?void 0:t.dataset)||{};n&&+r===this.componentIndex&&this.treeMap.set(+n,t);}}patchProps(t){t&&(Object.entries(t).forEach(([e,r])=>{let n=Number(e),s=this.treeMap.get(n);s&&this.patchProp(e,s,r,n===0);}),this.props=t);}patchProp(t,e,r,n){r&&Object.entries(r).forEach(([s,i])=>{if(s===P&&i)this.patchChildren(t,e,i,n);else if(s===ee)r[s].value=e;else if(O(s,Mt))this.patchEventListener(t,e,s,i);else {if(this.bindValueKeys.includes(s))return;let o=this.getBindUpdateValue(r,t,s);this.patchAttribute(t,e,s,i,o);}});}getBindUpdateValue(t,e,r){let n=`${Pt}${Kt(r)}`;if(n&&t[n]&&d(t[n]))return this.bindValueKeys.push(n),t[n]}patchChildren(t,e,r,n){if(g(r))r.filter(Boolean).forEach((s,i)=>{var o;let[a,p]=g(s)?s:[s,null],u=It(p)?null:(o=this.treeMap.get(p))!=null?o:null,c=`${t}:${P}:${i}`,l=this.getNodeTrack(c,!0,n);this.patchChild(l,e,a,u);});else {let s=`${t}:${P}:0`,i=this.getNodeTrack(s,!0,n);this.patchChild(i,e,r,null);}}patchEventListener(t,e,r,n){let s=r.slice(2).toLowerCase(),i=this.getNodeTrack(`${t}:${r}`);i.cleanup=S(e,s,n);}patchAttribute(t,e,r,n,s){let i=this.getNodeTrack(`${t}:${r}`),o=Nt(),a=W(()=>{let u=d(n)?n():n;T(u)&&T(o.peek())&&JSON.stringify(o.value)===JSON.stringify(u)||(o.value=m(u)?u.value:u,Be(e,r,o.value));}),p;s&&kt(e)&&(p=Je(e,u=>{s(u);})),i.cleanup=()=>{a&&a(),p&&p();};}getNodeTrack(t,e,r){let n=this.trackMap.get(t);return n||(n={cleanup:()=>{}},e&&(n.lastNodes=new Map),r&&(n.isRoot=!0),this.trackMap.set(t,n)),n.cleanup&&n.cleanup(),n}patchChild(t,e,r,n){d(r)?t.cleanup=W(()=>{let s=ft(r()).map(te);E.isSSR?t.lastNodes=this.reconcileChildren(e,s,n):t.lastNodes=Ye(e,t.lastNodes,s,n);}):ft(r).forEach((s,i)=>{let o=te(s),a=A(o,i);E.isSSR?t.lastNodes=this.reconcileChildren(e,[o],n):(t.lastNodes.set(a,o),M(e,o,n));});}reconcileChildren(t,e,r){let n=new Map,s=Array.from(t.childNodes).filter(i=>{var o,a;return i.nodeType===Node.TEXT_NODE&&((o=i.previousSibling)==null?void 0:o.nodeType)===Node.COMMENT_NODE&&((a=i.nextSibling)==null?void 0:a.nodeType)===Node.COMMENT_NODE});return e.forEach((i,o)=>{let a=A(i,o);i.nodeType===Node.TEXT_NODE?s.forEach(p=>{i.textContent===p.textContent&&t.replaceChild(i,p);}):M(t,i,r),n.set(a,i);}),n}},st=new Map;function et(t,e,r={},n){if(n){let i=st.get(n);if(i)return i}typeof e=="string"&&(e=$t(e));let s=new t(e,r,n);return n&&s instanceof it&&st.set(n,s),s}function ie(t,e={},r){if(t===Tt)return tr(t,e);if(X(t)){let n=Xe(t),s={[Fe]:e};return et(nt,n,s,r)}return d(t)?et(it,t,e,r):et(nt,t,e,r)}function br(t){return t instanceof it}function N(t){return t instanceof it||t instanceof nt}function $t(t){let e=document.createElement("template");return e.innerHTML=t,e}function tr(t,e){let r=e.children?{[He]:{children:Array.isArray(e.children)?e.children.filter(Boolean):[e.children]}}:e,n=t===Tt?$t(Tt):t;return et(nt,n,r)}function Sr(t){ot("onMounted"),b.ref&&b.ref.addHook("mounted",t);}function Er(t){ot("onDestroy"),b.ref&&b.ref.addHook("destroy",t);}function ot(t,e){b.ref||console.error(`"${t}"(key: ${Lt(e)?e.toString():e}) can only be called within the component function body
7
+ and cannot be used in asynchronous or deferred calls.`);}function _r(t,e){ot("provide",t),b.ref&&b.ref.setContext(t,e);}function Nr(t,e){var r;return ot("inject",t),(r=b.ref&&b.ref.getContext(t))!=null?r:e}function Cr(t,e){E.setSSG();let n=new Rt(t,e||{}).mount();return E.setClient(),n}function wr(t,e){let r=typeof e=="string"?document.querySelector(e):e;if(!r)throw new Error(`Could not find container: ${e}`);E.setSSR(),ie(t).mount(r),E.setClient();}function Mr(t,e){return E.isSSG?new Rt(t,e):ie(t,e)}globalThis&&(globalThis.__essor_version__=jt);/**
8
+ * @estjs/signal v0.0.14-beta.21
9
9
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
10
10
  * @license MIT
11
11
  **/
12
12
  /**
13
- * @estjs/template v0.0.14-beta.19
13
+ * @estjs/template v0.0.14-beta.21
14
14
  * (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
15
15
  * @license MIT
16
- **/export{Ve as Fragment,cr as clearReactive,Se as computed,lr as createStore,G as effect,At as essor_version,se as h,Cr as hydrate,Sr as inject,br as isComponent,Zt as isComputed,y as isJsxElement,B as isReactive,g as isSignal,Et as nextTick,Nr as onDestroy,Er as onMount,_r as provide,St as reactive,ar as ref,yr as renderToString,or as shallowReactive,_t as shallowSignal,Nt as signal,Qt as signalObject,wr as ssg,Rt as template,f as toRaw,Oe as useBatch,ur as useWatch};//# sourceMappingURL=essor.esm.js.map
16
+ **/export{tr as Fragment,ar as clearReactive,Ce as computed,fr as createStore,W as effect,jt as essor_version,ie as h,wr as hydrate,Nr as inject,br as isComponent,Qt as isComputed,N as isJsxElement,D as isReactive,m as isSignal,_t as nextTick,Er as onDestroy,Sr as onMount,_r as provide,Ct as reactive,ur as ref,Cr as renderToString,Vt as shallowReactive,Nt as shallowSignal,_e as signal,cr as signalObject,Mr as ssg,$t as template,f as toRaw,xe as useBatch,lr as watch};//# sourceMappingURL=essor.esm.js.map
17
17
  //# sourceMappingURL=essor.esm.js.map