From f05bcdff70c4b24e455e4f4b8134622fc831edfd Mon Sep 17 00:00:00 2001
From: Tito Bouzout
Date: Sun, 20 Oct 2024 03:33:37 -0300
Subject: [PATCH] update docs
---
.gitattributes | 8 +
src/index.jsx | 2 +-
src/pages/@playground/default-example.js | 23 +--
src/pages/@playground/index.jsx | 77 ++------
.../@props/attributes-properties/index.jsx | 12 +-
src/pages/benchmark/dev/index.jsx | 7 +-
src/pages/benchmark/dev/main.js | 186 ++++++++++++++----
src/pages/benchmark/dev/main.js.map | 2 +-
src/pages/benchmark/html/main.js | 184 +++++++++++++----
src/pages/benchmark/html/main.js.map | 2 +-
src/pages/benchmark/regular/main.js | 177 +++++++++++++----
src/pages/benchmark/regular/main.js.map | 2 +-
src/pages/home.jsx | 4 +-
13 files changed, 468 insertions(+), 218 deletions(-)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..96103c8
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+src/pages/benchmark/dev/main.js binary
+src/pages/benchmark/dev/main.js.map binary
+
+src/pages/benchmark/html/main.js binary
+src/pages/benchmark/html/main.js.map
+
+src/pages/benchmark/regular/main.js binary
+src/pages/benchmark/regular/main.js.map binary
\ No newline at end of file
diff --git a/src/index.jsx b/src/index.jsx
index d2e1bd5..17d844f 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -19,7 +19,7 @@ import 'tm-textarea'
import './lib/components/code/tm-textarea.css'
// app
-import { render, setClass } from 'pota'
+import { render, setClass, signal } from 'pota'
import { onDocumentSize } from 'pota/plugin/useDocumentSize'
import { location } from 'pota/plugin/useLocation'
diff --git a/src/pages/@playground/default-example.js b/src/pages/@playground/default-example.js
index 8de6a06..289482e 100644
--- a/src/pages/@playground/default-example.js
+++ b/src/pages/@playground/default-example.js
@@ -1,7 +1,6 @@
export default `
-import { render, signal, memo, effect } from 'pota'
-import { html } from 'pota/html'
+import { render, signal, memo } from 'pota'
function Counter() {
const [count, setCount, updateCount] = signal(1)
@@ -9,27 +8,11 @@ function Counter() {
const double = memo(() => count() * 2)
const increment = () => updateCount(count => count + 1)
- // jsx
- const jsx = (
+ return (
- jsx {count} / {double}
+ {count} / {double}
)
-
- // vanilla
- const vanilla = document.createElement('button')
- effect(() => {
- vanilla.textContent = 'vanilla '
- vanilla.textContent += count() + ' / ' + double()
- })
- vanilla.onclick = increment
-
- // html
- const htm = html\`
- html \${count} / \${double}
- \`
-
- return [jsx, vanilla, htm]
}
render(Counter)
diff --git a/src/pages/@playground/index.jsx b/src/pages/@playground/index.jsx
index cdb6528..35d9a1e 100644
--- a/src/pages/@playground/index.jsx
+++ b/src/pages/@playground/index.jsx
@@ -5,7 +5,7 @@ import { Code } from '../../lib/components/code/code.jsx'
import { Header } from '../../lib/components/header.jsx'
import { effect, memo, signal } from 'pota'
-import { Collapse, For, Head, Show } from 'pota/web'
+import { Collapse, For, Show } from 'pota/web'
import { compress, uncompress } from '../../lib/compress.js'
import example from './default-example.js'
@@ -84,24 +84,16 @@ export default function () {
initialValue.code ? initialValue.code : initialValue,
)
- const codeDownload = memo(() =>
+ /*const codeDownload = memo(() =>
URL.createObjectURL(
new Blob([code()], {
type: 'application/tsx',
}),
),
- )
+ )*/
const codeURL = memo(() => compress(code()))
- // transformed code
-
- const [transformed, setTransformed] = signal('')
-
- effect(() => {
- transform(code()).then(setTransformed)
- })
-
effect(() => {
window.location.hash = '#' + codeURL()
})
@@ -152,34 +144,6 @@ export default function () {
Cheat Sheet
-
- (e.target.href = codeDownload())}
- >
- Download
-
-
-
- {
- e.preventDefault()
- const node = e.target
- node.href = '#' + codeURL()
-
- node.textContent = 'Link Copied!'
- setTimeout(() => {
- node.textContent = 'Link'
- }, 2000)
- return node.href
- }}
- >
- Link
-
-
setCode(e.target.value)}
grammar="tsx"
- theme={theme()}
- onMount={element => {
- effect(() => {
- element.theme = theme()
- })
- }}
+ theme={theme}
onKeyDown={e => {
if (e.ctrlKey && e.keyCode === 83) {
// CTRL + S
@@ -257,32 +216,20 @@ export default function () {
/>
tab() === 'pota-jsx'}>
- {code => (
- {
- effect(() => {
- element.theme = theme()
- })
- }}
- value={transformed}
- editable={false}
- />
- )}
+ transform(code())}
+ editable={false}
+ />
tab() === 'cheatsheet'}>
{
- effect(() => {
- element.theme = theme()
- })
- }}
+ theme={theme}
editable={false}
/>
diff --git a/src/pages/@props/attributes-properties/index.jsx b/src/pages/@props/attributes-properties/index.jsx
index ea749a2..efb2332 100644
--- a/src/pages/@props/attributes-properties/index.jsx
+++ b/src/pages/@props/attributes-properties/index.jsx
@@ -105,21 +105,11 @@ export default function () {
-
typeof value === 'string';
+
+ /**
+ * Returns `true` when `value` may be a promise
+ *
+ * @param {any} value
+ * @returns {boolean}
+ */
+ const isPromise = value => isObject(value) && 'then' in value;
const noop = () => {};
/**
@@ -207,9 +226,9 @@
class DataStore {
constructor(kind) {
const store = new kind();
- const get = store.get.bind(store);
- const set = store.set.bind(store);
- const has = store.has.bind(store);
+ const get = k => store.get(k);
+ const set = (k, v) => store.set(k, v);
+ const has = k => store.has(k);
this.get = (target, defaults = undefined) => {
const o = get(target);
if (o !== undefined) {
@@ -227,7 +246,7 @@
};
this.set = set;
this.has = has;
- this.delete = store.delete.bind(store);
+ this.delete = k => store.delete(k);
}
*[Symbol.iterator]() {
yield this.get;
@@ -477,11 +496,9 @@
this.prev = value;
}
}
- this.read = markReactive(this.read.bind(this));
- this.write = this.write.bind(this);
- this.update = this.update.bind(this);
+ this.read = markReactive(this.read);
}
- read() {
+ read = () => {
// checkReadForbidden()
if (Listener) {
@@ -502,8 +519,8 @@
}
}
return this.value;
- }
- write(value) {
+ };
+ write = value => {
if (this.equals === false || !this.equals(this.value, value)) {
if (this.save) {
this.prev = this.value;
@@ -530,13 +547,13 @@
return true;
}
return false;
- }
- update(value) {
+ };
+ update = value => {
if (isFunction(value)) {
value = value(this.value);
}
return this.write(value);
- }
+ };
equals(a, b) {
return a === b;
}
@@ -563,7 +580,7 @@
Owner = root;
Listener = undefined;
try {
- return runUpdates(() => fn(root.dispose.bind(root)), true);
+ return runUpdates(() => fn(() => root.dispose()), true);
} finally {
Owner = prevOwner;
Listener = prevListener;
@@ -868,12 +885,21 @@
}
/**
- * Runs a function inside an effect if value is a function
+ * Runs a function inside an effect if value is a function.
+ * Aditionally unwraps promises.
*
* @param {any} value
* @param {(value) => any} fn
*/
- const withValue = (value, fn) => isFunction(value) ? effect(() => fn(getValue(value))) : fn(value);
+ const withValue = (value, fn) => {
+ if (isFunction(value)) {
+ effect(() => withValue(getValue(value), fn));
+ } else if (isPromise(value)) {
+ value.then(owned(value => withValue(value, fn)));
+ } else {
+ fn(value);
+ }
+ };
/**
* Runs a function inside an effect if value is a function
@@ -1308,7 +1334,7 @@
* @param {string} localName
* @param {string} ns
*/
- const setEventNS = (node, name, value, props, localName, ns) => addEventListener(node, localName, value);
+ const setEventNS = (node, name, value, props, localName, ns) => addEventListener(node, localName, ownedEvent(value));
/**
* Returns an event name when the string could be mapped to an event
@@ -1318,11 +1344,6 @@
* case isnt found
*/
const eventName = withCache(name => name.startsWith('on') && name.toLowerCase() in window ? name.slice(2).toLowerCase() : null);
- /*
- const eventNames = new Set(
- keys(global).filter(prop => prop.startsWith('on')),
- )
- */
const plugins = cacheStore();
const pluginsNS = cacheStore();
@@ -1467,9 +1488,74 @@
* @param {string} [ns]
*/
const setUnknown = (node, name, value, ns) => {
- name in node && !(node instanceof SVGElement) ? setProperty(node, name, value) : setAttribute(node, name, value, ns);
+ withValue(value, value => _setUnknown(node, name, value, ns));
};
+ /**
+ * @param {Element} node
+ * @param {string} name
+ * @param {unknown} value
+ * @param {string} [ns]
+ */
+ const _setUnknown = (node, name, value, ns) => {
+ if (typeof value !== 'string' && setters(node).element.has(name)) {
+ /**
+ * 1. First check in element because a custom-element may overwrite
+ * builtIn setters
+ * 2. Only do this when it's different to a string to avoid coarcing
+ * on native elements (ex: (img.width = '16px') === 0)
+ */
+ setProperty(node, name, value);
+ } else if (setters(node).builtIn.has(name)) {
+ // ex: innerHTML, textContent, draggable={true}
+ setProperty(node, name, value);
+ } else {
+ setAttribute(node, name, value, ns);
+ }
+ };
+ const elements = new Map();
+
+ /** @param {Element} node */
+ function setters(node) {
+ /**
+ * Use `node.constructor` instead of `node.nodeName` because it
+ * handles the difference between `a` `HTMLAnchorElement` and `a`
+ * `SVGAElement`
+ */
+ let setters = elements.get(node.constructor);
+ if (setters) return setters;
+ setters = {
+ builtIn: new Set(builtInSetters),
+ element: new Set()
+ };
+ elements.set(node.constructor, setters);
+ let store = setters.element;
+ let proto = getPrototypeOf(node);
+
+ /**
+ * Stop at `Element` instead of `HTMLElement` because it handles the
+ * difference between `HTMLElement`, `SVGElement`, `FutureElement`
+ * etc
+ */
+ while (proto.constructor !== Element) {
+ const nextProto = getPrototypeOf(proto);
+
+ /**
+ * The previous prototype to `Element` is a `builtIn`
+ * (`HTMLElement`, `SVGElement`,`FutureElement`, etc)
+ */
+ if (nextProto.constructor === Element) {
+ store = setters.builtIn;
+ }
+ getSetterNamesFromPrototype(proto, store);
+ proto = nextProto;
+ }
+ return setters;
+ }
+
+ /** Setters shared by all kind of elements */
+ const builtInSetters = getSetterNamesFromPrototype(Element.prototype, getSetterNamesFromPrototype(Node.prototype));
+
// BOOL ATTRIBUTES
@@ -1498,7 +1584,7 @@
*/
const _setBool = (node, name, value) =>
// if the value is falsy gets removed
- !value ? node.removeAttribute(name) : node.setAttribute(name, '');
+ value ? node.setAttribute(name, '') : node.removeAttribute(name);
// node style
@@ -1644,6 +1730,35 @@
// null, undefined or false, the class is removed
!value ? classListRemove(node, name) : classListAdd(node, ...name.trim().split(/\s+/));
+ /**
+ * `value` as a prop is special cased so the button `reset` in forms
+ * works as expected. The first time a value is set, its done as an
+ * attribute.
+ */
+ const setValue = (node, name, value) => withValue(value, value => _setValue(node, name, value));
+ const defaults = new Set();
+ function _setValue(node, name, value) {
+ if (!defaults.has(node)) {
+ defaults.add(node);
+ cleanup(() => defaults.delete(node));
+ if (!isNullUndefined(value)) {
+ switch (node.localName) {
+ case 'input':
+ {
+ node.setAttribute('value', value);
+ return;
+ }
+ case 'textarea':
+ {
+ node.textContent = value;
+ return;
+ }
+ }
+ }
+ }
+ _setProperty(node, name, value);
+ }
+
/** Returns true or false with a `chance` of getting `true` */
const randomId = () => crypto.getRandomValues(new BigUint64Array(1))[0].toString(36);
@@ -1696,11 +1811,9 @@
propsPluginNS('bool', setBoolNS, false);
propsPluginNS('on', setEventNS, false);
propsPluginNS('var', setVarNS, false);
- for (const item of ['value', 'textContent', 'innerText', 'innerHTML']) {
- propsPlugin(item, setProperty, false);
- }
propsPlugin('__dev', noop, false);
propsPlugin('xmlns', noop, false);
+ propsPlugin('value', setValue, false);
propsPluginBoth('css', setCSS, false);
propsPluginBoth('onMount', setOnMount, false);
propsPluginBoth('onUnmount', setUnmount, false);
@@ -1733,12 +1846,6 @@
* @param {object} props
*/
function assignProp(node, name, value, props) {
- // unwrap promises
- if (isObject(value) && 'then' in value) {
- value.then(owned(value => assignProp(node, name, getValue(value), props)));
- return;
- }
-
// run plugins
let plugin = plugins.get(name);
if (plugin) {
@@ -1888,7 +1995,7 @@
// PARTIALS
- function cloneNode(content, xmlns) {
+ function parseHTML(content, xmlns) {
const template = xmlns ? createElementNS(xmlns, 'template') : createElement('template');
template.innerHTML = content;
@@ -1904,7 +2011,7 @@
}
function createPartial(content, propsData = nothing) {
let clone = () => {
- const node = withXMLNS(propsData.x, xmlns => cloneNode(content, xmlns));
+ const node = withXMLNS(propsData.x, xmlns => parseHTML(content, xmlns));
clone = propsData.i ? importNode.bind(null, node, true) : node.cloneNode.bind(node, true);
return clone();
};
@@ -2407,7 +2514,10 @@
const App = () => {
const [data, setData, updateData] = signal([]),
[selected, setSelected] = signal(null),
- run = () => setData(buildData(10)),
+ run = () => {
+ // debugger
+ setData(buildData(10));
+ },
runLots = () => {
setData(buildData(10000));
},
@@ -2506,7 +2616,9 @@
label
} = row;
return _tr([{
- "class:danger": isSelected(id)
+ class: {
+ danger: isSelected(id)
+ }
}, {
textContent: id
}, {
diff --git a/src/pages/benchmark/dev/main.js.map b/src/pages/benchmark/dev/main.js.map
index b8cca91..f4d36ad 100644
--- a/src/pages/benchmark/dev/main.js.map
+++ b/src/pages/benchmark/dev/main.js.map
@@ -1 +1 @@
-{"version":3,"file":"main.js","sources":["../../../../../pota/src/lib/std.js","../../../../../pota/src/constants.js","../../../../../pota/src/lib/reactive.js","../../../../../pota/src/scheduler.js","../../../../../pota/src/props/event.js","../../../../../pota/src/props/plugin.js","../../../../../pota/src/props/attribute.js","../../../../../pota/src/props/property.js","../../../../../pota/src/props/unknown.js","../../../../../pota/src/props/bool.js","../../../../../pota/src/props/style.js","../../../../../pota/src/props/class.js","../../../../../pota/src/plugin/useRandom.js","../../../../../pota/src/props/css.js","../../../../../pota/src/props/lifecycle.js","../../../../../pota/src/props/@main.js","../../../../../pota/src/renderer.js","../../../../../pota/src/plugin/useSelector.js","../../../../../pota/src/plugin/useTime.js","../../../../../pota/src/web/For.js","index.jsx"],"sourcesContent":["export const global = globalThis\nexport const window = global\n\nexport const CSSStyleSheet = global.CSSStyleSheet\nexport const document = global.document\nexport const DocumentFragment = global.DocumentFragment\nexport const Object = global.Object\nexport const Promise = global.Promise\nexport const requestAnimationFrame = global.requestAnimationFrame\nexport const Symbol = global.Symbol\nexport const queueMicrotask = global.queueMicrotask\n\nexport const assign = Object.assign\nexport const create = Object.create\nexport const defineProperties = Object.defineProperties\nexport const defineProperty = Object.defineProperty\nexport const entries = Object.entries\nexport const freeze = Object.freeze\nexport const fromEntries = Object.fromEntries\nexport const getOwnPropertyDescriptor =\n\tObject.getOwnPropertyDescriptor\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors\nexport const getOwnPropertyNames = Object.getOwnPropertyNames\nexport const getOwnPropertySymbols = Object.getOwnPropertySymbols\nexport const getPrototypeOf = Object.getPrototypeOf\nexport const groupBy = Object.groupBy\nexport const hasOwnProperty = Object.hasOwn\nexport const is = Object.is\nexport const isExtensible = Object.isExtensible\nexport const keys = Object.keys\nexport const values = Object.values\nexport const setPrototypeOf = Object.setPrototypeOf\n\nexport const isArray = Array.isArray\nexport const toArray = Array.from\n\nexport const isNaN = Number.isNaN\n\nexport const iterator = Symbol.iterator\n\nexport const stringify = JSON.stringify\nexport const stringifyReadable = o => stringify(o, null, 2)\n\nexport const stringifySorted = o => {\n\tfunction sort(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\t\tconst tmp = isArray(o) ? [] : {}\n\t\tkeys(o)\n\t\t\t.sort()\n\t\t\t.map(k => (tmp[k] = sort(o[k])))\n\n\t\tif (isArray(tmp)) {\n\t\t\ttmp.sort((a, b) => stringify(a).localeCompare(stringify(b)))\n\t\t}\n\t\treturn tmp\n\t}\n\treturn stringifyReadable(sort(o))\n}\n\nexport const PrototypeArray = Array.prototype\nexport const PrototypeMap = Map.prototype\n\nexport const history = global.history\nexport const location = global.location\nexport const navigator = global.navigator\n\nexport const origin = location.origin\n\nexport const promise = fn => new Promise(fn)\n\nexport const withResolvers = () => Promise.withResolvers()\n\n/**\n * Given a promise it adds `onDone` to `then` and `catch`\n *\n * ```js\n * resolved(promise, onDone)\n * // is same as\n * promise.then(onDone).catch(onDone)\n * ```\n */\nexport const resolved = (promise, onDone) =>\n\tpromise.then(onDone).catch(onDone)\n\nexport const setAttribute = (node, name, value) =>\n\tnode.setAttribute(name, value)\n\nexport const hasAttribute = (node, name) => node.hasAttribute(name)\n\nexport const removeAttribute = (node, name) =>\n\tnode.removeAttribute(name)\n\nexport const setAttributeNS = (node, name, value) =>\n\tnode.setAttributeNS(name, value)\n\nexport const hasAttributeNS = (node, name) =>\n\tnode.hasAttributeNS(name)\n\nexport const removeAttributeNS = (node, name) =>\n\tnode.removeAttributeNS(name)\n\nexport const isConnected = node => node.isConnected\n\nexport const activeElement = () => document.activeElement\n\nexport const documentElement = document.documentElement\n\n/**\n * Runs an array of functions\n *\n * @param {Iterable} fns\n */\nexport const call = fns => {\n\tfor (const fn of fns) fn()\n}\n\nexport function copy(o) {\n\tconst seen = new Map()\n\tfunction copy(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (\n\t\t\to instanceof Node ||\n\t\t\to instanceof Date ||\n\t\t\to instanceof Set ||\n\t\t\to instanceof Map ||\n\t\t\to instanceof WeakSet ||\n\t\t\to instanceof WeakMap ||\n\t\t\to instanceof Promise ||\n\t\t\to instanceof RegExp\n\t\t) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (seen.has(o)) {\n\t\t\treturn seen.get(o)\n\t\t}\n\n\t\tconst c = isArray(o) ? [] : {}\n\n\t\tseen.set(o, c)\n\n\t\tfor (const k in o) {\n\t\t\tc[k] = copy(o[k])\n\t\t}\n\t\treturn c\n\t}\n\treturn copy(o)\n}\n\n/**\n * Object.defineProperty with `enumerable` and `configurable` set to\n * `true` unless overwriten by `descriptor` argument\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n */\nexport const redefineProperty = (target, key, descriptor) =>\n\tdefineProperty(target, key, assign(create(defaults), descriptor))\n\nconst defaults = {\n\t__proto__: null,\n\tconfigurable: true,\n\tenumerable: true,\n}\n\n/**\n * Object.defineProperty with `configurable`, `writable` and\n * `enumerable` as `false`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {any} value\n */\nexport const definePropertyReadOnly = (target, key, value) => {\n\tconst descriptor = create(defaultsReadOnly)\n\tdescriptor.value = value\n\tdefineProperty(target, key, descriptor)\n}\n\nconst defaultsReadOnly = {\n\t__proto__: null,\n\tconfigurable: false,\n\tenumerable: false,\n\twritable: false,\n\tvalue: undefined,\n}\n\nconst bind = fn => document[fn].bind(document)\n\nexport const createElement = bind('createElement')\n\nexport const createElementNS = bind('createElementNS')\n\nexport const createTextNode = bind('createTextNode')\n\nexport const importNode = bind('importNode')\n\nexport const createTreeWalker = bind('createTreeWalker')\n\n/**\n * Returns an object without a prototype\n *\n * @type {Function}\n * @returns {Props} Empty object\n */\nexport const empty = Object.create.bind(null, null)\n\nexport function* entriesIncludingSymbols(target) {\n\tfor (const item of entries(target)) {\n\t\tyield item\n\t}\n\n\tfor (const item of getOwnPropertySymbols(target)) {\n\t\t// todo: causes access!\n\t\tyield [item, target[item]]\n\t}\n}\n\n// modified version of https://github.com/epoberezkin/fast-deep-equal\n\nexport function equals(a, b) {\n\tif (a === b) {\n\t\treturn true\n\t}\n\n\tif (a && b && typeof a == 'object' && typeof b == 'object') {\n\t\tif (a.constructor !== b.constructor) {\n\t\t\treturn false\n\t\t}\n\n\t\tlet length, i, k\n\t\tif (isArray(a)) {\n\t\t\tlength = a.length\n\t\t\tif (length != b.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor (i = length; i-- !== 0; ) {\n\t\t\t\tif (!equals(a[i], b[i])) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif (a.constructor === RegExp)\n\t\t\treturn a.source === b.source && a.flags === b.flags\n\t\tif (a.valueOf !== Object.prototype.valueOf)\n\t\t\treturn a.valueOf() === b.valueOf()\n\t\tif (a.toString !== Object.prototype.toString)\n\t\t\treturn a.toString() === b.toString()\n\n\t\tk = keys(a)\n\t\tlength = k.length\n\t\tif (length !== keys(b).length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(b, k[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tvar key = k[i]\n\n\t\t\tif (!equals(a[key], b[key])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// true if both NaN, false otherwise\n\treturn a !== a && b !== b\n}\n\n/**\n * Flats an array/childNodes to the first children if the length is 1\n *\n * @param {any[] | NodeListOf} arr\n * @returns {any}\n */\nexport const flat = arr => (arr.length === 1 ? arr[0] : arr)\n\n/**\n * Keeps state in the function as the first param\n *\n * @template T\n * @param {T} fn - Function to which add state to it\n * @param {DataStore | DataStore} [state] - Passed to\n * `fn` as first param\n * @returns {T} A copy of the function with the state\n */\nexport const withState = /* #__NO_SIDE_EFFECTS__ */ (\n\tfn,\n\tstate = cacheStore,\n) => fn.bind(null, state())\n\n/** Memoize functions with a map cache */\nexport const withCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tcacheStore,\n\t)\n/** Memoize functions with a weak cache */\nexport const withWeakCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tweakStore,\n\t)\n\nexport const walkElements = withState(\n\t(walk, node, fn) => {\n\t\twalk.currentNode = node\n\n\t\t/**\n\t\t * The first node is not walked by the walker.\n\t\t *\n\t\t * Also the first node could be a DocumentFragment\n\t\t */\n\t\tif (node.nodeType === 1) {\n\t\t\tif (fn(node)) return\n\t\t}\n\n\t\twhile ((node = walk.nextNode())) {\n\t\t\tif (fn(node)) break\n\t\t}\n\t},\n\t() => createTreeWalker(document, 1 /*NodeFilter.SHOW_ELEMENT*/),\n)\n\n/**\n * Returns `document` for element. That could be a `shadowRoot`\n *\n * @param {Element} node\n * @returns {Document | ShadowRoot}\n */\n\nexport const getDocumentForElement = node => {\n\tconst document = node.getRootNode()\n\tconst { nodeType } = document\n\t// getRootNode returns:\n\t// 1. Node for isConnected = false\n\t// 2. Document for isConnected = true\n\t// 3. shadowRoot for custom elements\n\n\t// always return a Document-like\n\treturn nodeType === 11 || nodeType === 9\n\t\t? document\n\t\t: node.ownerDocument\n}\n\nexport const getOwnValues = o =>\n\tgetOwnPropertyNames(o).map(key => {\n\t\ttry {\n\t\t\treturn o[key]\n\t\t} catch (e) {}\n\t})\n\n/**\n * Unwraps values. If the argument is a function then it runs it\n * recursively and returns the value\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValue(value) {\n\twhile (typeof value === 'function') value = value()\n\treturn value\n}\n\n/**\n * Unwraps `value` and returns `element` if result is a `Node`, else\n * `undefined` in the case isn't a `Node`\n *\n * @param {Function | any} value - Maybe function\n * @param {...any} args? - Arguments\n * @returns {Node | undefined}\n */\nexport function getValueElement(value, ...args) {\n\tconst element = getValueWithArguments(value, ...args)\n\treturn element instanceof Node ? element : undefined\n}\n\nexport const getValueWithArguments = (value, ...args) =>\n\ttypeof value === 'function'\n\t\t? args.length\n\t\t\t? getValue(value(...args))\n\t\t\t: getValue(value())\n\t\t: value\n\n/**\n * Identity function, given `x` returns `x`\n *\n * @template T\n * @param {T} x\n * @returns {T}\n */\nexport const identity = x => x\n\n/**\n * When `value` is an object, it will check if the `key` on `target`\n * is `configurable`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {boolean | undefined} value\n */\nexport const isConfigurable = (target, key, value) => {\n\tif (isObject(value)) {\n\t\tconst descriptor = getOwnPropertyDescriptor(target, key)\n\t\tif (descriptor) {\n\t\t\treturn descriptor.configurable\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Returns `true` when `typeof` of `value` is `function`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isFunction = value => typeof value === 'function'\n\n/**\n * Returns `true` when value is Iterable\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isIterable = value =>\n\tisObject(value) && 'values' in value\n\n/**\n * Returns `true` if the value is `null` or `undefined`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNullUndefined = value =>\n\tvalue === undefined || value === null\n\n/**\n * Returns `true` when typeof of value is object and not null\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isObject = value =>\n\tvalue !== null && typeof value === 'object'\n\n/**\n * Returns `true` when object morphed between array/object\n *\n * @param {any} a\n * @param {any} b\n * @returns {boolean}\n */\nexport const morphedBetweenArrayAndObject = (a, b) =>\n\t(isObject(a) && !isObject(b)) ||\n\t(isObject(b) && !isObject(a)) ||\n\t(isArray(a) && !isArray(b)) ||\n\t(isArray(b) && !isArray(a))\n\n/**\n * Returns `true` if the property is defined in the `prototype` and\n * absent in the `object`\n *\n * @param {object} target\n * @param {PropertyKey} key\n */\nexport const isPrototypeProperty = (target, key) =>\n\t// must do `key in target` to check that it DOES have it somewhere\n\t// must do !hasOwnProperty to check that isnt an own property\n\tkey in target && !hasOwnProperty(target, key)\n\n/**\n * Returns `true` when `typeof` of `value` is `string`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isString = value => typeof value === 'string'\n\n/**\n * Returns `true` when `typeof` of `value` is `number`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNumber = value => typeof value === 'number'\n\n/**\n * Returns `true` when `typeof` of `value` is `symbol`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isSymbol = value => typeof value === 'symbol'\n\n/**\n * Returns `true` when `typeof` of `value` is `boolean`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isBoolean = value => typeof value === 'boolean'\n\nexport const noop = () => {}\n\n/**\n * An empty frozen object\n *\n * @type object\n */\nexport const nothing = freeze(empty())\n\n// an optional value is `true` by default, so most of the time is undefined which means is `true`\n// to avoid having conditions like `if(something.bla === undefined || something.bla)`\n// this function will short it to `if(optional(something.bla))`\n// additionally the value is resolved, for cases like `when={() => show() && optional(props.when)}`\n\n/**\n * Returns `true` when value is true or undefined\n *\n * @param {Function | boolean | undefined} value\n * @returns {boolean} True when value is true or undefined\n */\nexport const optional = value =>\n\tvalue === undefined || getValue(value)\n\nexport const partAdd = (node, className) => node.part.add(className)\n\nexport const partRemove = (node, className) =>\n\tnode.part.remove(className)\n\nexport const querySelector = (node, query) =>\n\tnode.querySelector(query)\n\nexport const querySelectorAll = (node, query) =>\n\tnode.querySelectorAll(query)\n\nexport function* range(start, stop, step = 1) {\n\tyield start\n\twhile (start < stop) {\n\t\tyield (start += step)\n\t}\n}\n\nexport const {\n\townKeys: reflectOwnKeys,\n\thas: reflectHas,\n\tdeleteProperty: reflectDeleteProperty,\n\tgetOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor,\n\tget: reflectGet,\n\tapply: reflectApply,\n\tset: reflectSet,\n} = Reflect\n\n/**\n * Removes a value from an array\n *\n * @template T\n * @param {T[]} array\n * @param {T} value To remove from the array\n * @returns {T[]}\n */\nexport function removeFromArray(array, value) {\n\tconst index = array.indexOf(value)\n\tif (index !== -1) array.splice(index, 1)\n\treturn array\n}\n/**\n * Removes values from an array based on a condition\n *\n * @template T\n * @param {T[]} array\n * @param {(value: T, index: number) => boolean} cb Function with\n * condition\n */\nexport function removeFromArrayConditionally(array, cb) {\n\tlet i = array.length\n\twhile (i--) {\n\t\tif (cb(array[i], i)) {\n\t\t\tarray.splice(i, 1)\n\t\t}\n\t}\n}\n/**\n * Removes values from an array based on a condition\n *\n * @param {Iterable} iterable\n * @param {PropertyKey} key Function with condition\n */\nexport function indexByKey(iterable, key) {\n\tconst byKey = empty()\n\tfor (const item of iterable) {\n\t\tbyKey[item[key]] = item\n\t}\n\treturn byKey\n}\n\n/**\n * Replace a prototype in the prototype chain with another prototype\n *\n * @param {object} target - Target object\n * @param {object} search - The prototype to replace\n * @param {object} replacement - The replacement prototype\n */\nexport function replacePrototypeWith(target, search, replacement) {\n\tlet prototype = target\n\twhile (getPrototypeOf(prototype) !== search) {\n\t\tprototype = getPrototypeOf(prototype)\n\t}\n\n\tsetPrototypeOf(prototype, replacement)\n}\n\nexport const typeString = obj =>\n\tObject.prototype.toString.call(obj).slice(8, -1)\n\nexport function walkParents(context, propertyName, cb) {\n\twhile (context) {\n\t\tif (cb(context)) return true\n\t\tcontext = context[propertyName]\n\t}\n}\n\n/**\n * Store template\n *\n * @typedef {(\n * \treference: any,\n * \tcreateIfNotExistsAs?: ((target: any) => any) | Function,\n * ) => any} DataStoreGet\n *\n *\n * @typedef {(key: any, value: any) => void} DataStoreSet\n *\n * @typedef {(key: any) => boolean} DataStoreHas\n *\n * @typedef {(key: any) => boolean} DataStoreDelete\n */\n\nclass DataStore {\n\tconstructor(kind) {\n\t\tconst store = new kind()\n\n\t\tconst get = store.get.bind(store)\n\t\tconst set = store.set.bind(store)\n\t\tconst has = store.has.bind(store)\n\n\t\tthis.get = (target, defaults = undefined) => {\n\t\t\tconst o = get(target)\n\n\t\t\tif (o !== undefined) {\n\t\t\t\treturn o\n\t\t\t}\n\n\t\t\tif (defaults !== undefined) {\n\t\t\t\t/**\n\t\t\t\t * Default values should be passed as a function, so we dont\n\t\t\t\t * constantly initialize values when giving them\n\t\t\t\t */\n\t\t\t\tdefaults = defaults(target)\n\t\t\t\tset(target, defaults)\n\t\t\t\treturn defaults\n\t\t\t}\n\t\t}\n\n\t\tthis.set = set\n\t\tthis.has = has\n\t\tthis.delete = store.delete.bind(store)\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.get\n\t\tyield this.set\n\t\tyield this.has\n\t\tyield this.delete\n\t}\n}\n\n/**\n * Creates a WeakMap to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdelete: DataStoreDelete\n * }}\n */\nexport const weakStore = () => new DataStore(WeakMap)\n\n/**\n * Creates a Map to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdel: DataStoreDelete\n * }}\n */\nexport const cacheStore = () => new DataStore(Map)\n\nexport const classListAdd = (node, className) =>\n\tnode.classList.add(className)\n\nexport const classListRemove = (node, className) =>\n\tnode.classList.remove(className)\n\n/**\n * - Returns `adoptedStyleSheets` for a document\n *\n * @param {Document | ShadowRoot} document\n */\nexport const adoptedStyleSheetsGet = document =>\n\tdocument.adoptedStyleSheets\n\nexport const adoptedStyleSheets =\n\t/* #__PURE__*/ adoptedStyleSheetsGet(document)\n\n/**\n * Adds a style sheet to the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsAdd = (document, styleSheet) =>\n\tadoptedStyleSheetsGet(document).push(styleSheet)\n\n/**\n * Removes a style sheet from the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsRemove = (document, styleSheet) =>\n\tremoveFromArray(adoptedStyleSheetsGet(document), styleSheet)\n\n/**\n * Adds a style sheet to the custom element\n *\n * @param {Document | ShadowRoot} document\n * @param {(CSSStyleSheet | string)[]} styleSheets\n */\nexport function addStyleSheets(document, styleSheets = []) {\n\tfor (const sheet of styleSheets) {\n\t\tif (sheet) {\n\t\t\tsheet instanceof CSSStyleSheet\n\t\t\t\t? adoptedStyleSheetsAdd(document, sheet)\n\t\t\t\t: addStyleSheetExternal(document, sheet)\n\t\t}\n\t}\n}\n\n/**\n * Adds the stylesheet from urls. It uses a cache, to avoid having to\n * fire a request for each external sheet when used in more than one\n * custom element. Also, all reference the same object.\n *\n * @param {Document | ShadowRoot} document\n * @param {string} text\n */\nexport const addStyleSheetExternal = withState(\n\t(state, document, text) => {\n\t\tstate\n\t\t\t.get(text, text =>\n\t\t\t\ttext.startsWith('http')\n\t\t\t\t\t? fetch(text)\n\t\t\t\t\t\t\t.then(r => r.text())\n\t\t\t\t\t\t\t.then(css => sheet(css))\n\t\t\t\t\t: promise(resolve => resolve(sheet(text))),\n\t\t\t)\n\t\t\t.then(styleSheet => adoptedStyleSheetsAdd(document, styleSheet))\n\t},\n)\n\n/**\n * Swaps classNames and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldClass - `class` with the old animation\n * @param {string} newClass - `class` with the new animation\n */\nexport const animateClassTo = (element, oldClass, newClass) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tclassListRemove(element, oldClass)\n\t\t\tclassListAdd(element, newClass)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Swaps parts and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldPart - `part` with the old animation\n * @param {string} newPart - `part` with the new animation\n */\nexport const animatePartTo = (element, oldPart, newPart) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tpartRemove(element, oldPart)\n\t\t\tpartAdd(element, newPart)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Creates tagged css and returns a CSSStyleSheet. Mostly for css\n * highlighting in js\n *\n * @param {TemplateStringsArray} template\n * @param {...any} values\n * @returns {CSSStyleSheet}\n */\nexport const css = (template, ...values) =>\n\tsheet(String.raw({ raw: template }, ...values))\n\n/**\n * Creates a stylesheet from a css string\n *\n * @param {string} css\n * @returns {CSSStyleSheet}\n */\nexport const sheet = withCache(css => {\n\tconst sheet = new CSSStyleSheet()\n\t/**\n\t * Replace is asynchronous and can accept @import statements\n\t * referencing external resources.\n\t */\n\tsheet.replace(css)\n\n\treturn sheet\n})\n\n/**\n * @param {Element} node\n * @param {string} eventName\n * @param {any} [data]\n */\n\nexport const emit = (\n\tnode,\n\teventName,\n\tdata = { bubbles: true, cancelable: true, composed: true },\n) => node.dispatchEvent(new CustomEvent(eventName, data))\n\nexport function stopEvent(e) {\n\tpreventDefault(e)\n\tstopPropagation(e)\n\tstopImmediatePropagation(e)\n}\n\nexport const preventDefault = e => e.preventDefault()\nexport const stopPropagation = e => e.stopPropagation()\nexport const stopImmediatePropagation = e =>\n\te.stopImmediatePropagation()\n\n/**\n * Waits for an event to be dispatched and runs a callback\n *\n * @param {Element} element\n * @param {string} eventName\n */\nexport const waitEvent = withState(\n\t(state, element, eventName) =>\n\t\tpromise((resolve, reject) => {\n\t\t\t/**\n\t\t\t * To prevent firing `transitionend` twice it needs to stop\n\t\t\t * listening the old one because maybe wasn't dispatched and\n\t\t\t * running a new transition will make it dispatch twice\n\t\t\t */\n\t\t\tconst previous = state.get(element, empty)\n\t\t\tprevious.reject && previous.reject()\n\t\t\telement.removeEventListener(eventName, previous.resolve)\n\t\t\tstate.set(element, { resolve, reject })\n\t\t\telement.addEventListener(eventName, resolve, {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t}),\n\tweakStore,\n)\n\nexport const addEventListenerObject = (where, type, handler) =>\n\twhere.addEventListener(type, handler, handler)\n\nexport const removeEventListenerObject = (where, type, handler) =>\n\twhere.removeEventListener(type, handler, handler)\n\n/** @param {EventListener} fn */\nexport const passiveEvent = fn => ({ handleEvent: fn, passive: true })\n","// symbols\n\nimport { Symbol } from './lib/std.js'\n\nexport const $isComponent = Symbol()\nexport const $isClass = Symbol()\nexport const $isReactive = Symbol()\nexport const $isMap = Symbol()\n\n// supported namespaces\n\nconst prefix = 'http://www.w3.org/'\n\n// when a tag/attribute is missing the namespace this puts it back in\n\nexport const NS = {\n\t__proto__: null,\n\tsvg: prefix + '2000/svg',\n\tmath: prefix + '1998/Math/MathML',\n\thtml: prefix + '1999/xhtml',\n\txlink: prefix + '1999/xlink',\n}\n","/**\n * This is so far the core of Solid JS Reactivity, this may change.\n *\n * Adaptation for potas needs have been made:\n *\n * - Ported to Classes what does fit\n * - Signal has more options: `label` and `save` previous value\n * - Writing to a signal returns `true` when the value changes\n * - Signal is an object that could be used as signal.read/write or\n * destructured as an array.\n * - Signals can save and wont run functions\n * - `update` function on Signal that could be used to use the old value\n */\n\nimport {\n\t$isClass,\n\t$isComponent,\n\t$isMap,\n\t$isReactive,\n} from '../constants.js'\n\nimport {\n\tassign,\n\tentries,\n\tflat,\n\tgetValue,\n\tgroupBy,\n\tisArray,\n\tisFunction,\n\tisIterable,\n\tisObject,\n\tkeys,\n\tnothing,\n\tqueueMicrotask,\n\tremoveFromArray,\n\tresolved,\n\tSymbol,\n\tweakStore,\n\twithResolvers,\n\twithState,\n\twithWeakCache,\n} from './std.js'\n\nconst CLEAN = 0\nconst STALE = 1\nconst CHECK = 2\n\nlet Owner\nlet Listener\n\nlet Updates = null\nlet Effects = null\n\nlet Time = 0\n\n// ROOT\n\nclass Root {\n\towner\n\towned\n\n\tcleanups\n\n\tcontext\n\n\tconstructor(owner, options) {\n\t\tthis.owner = owner\n\t\tthis.context = owner?.context\n\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t}\n\t}\n\n\tdispose() {\n\t\tlet i\n\n\t\tconst { owned, cleanups } = this\n\n\t\tif (owned) {\n\t\t\tfor (i = owned.length - 1; i >= 0; i--) {\n\t\t\t\towned[i].dispose()\n\t\t\t}\n\t\t\towned.length = 0\n\t\t}\n\t\tif (cleanups) {\n\t\t\tfor (i = cleanups.length - 1; i >= 0; i--) {\n\t\t\t\tcleanups[i]()\n\t\t\t}\n\t\t\tcleanups.length = 0\n\t\t}\n\t}\n}\n\n// COMPUTATION\n\nclass Computation extends Root {\n\tstate = STALE\n\n\tupdatedAt = 0\n\n\tfn\n\n\tsources\n\tsourceSlots\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, options)\n\n\t\tthis.fn = fn\n\n\t\tif (owner) {\n\t\t\tif (owner.owned) {\n\t\t\t\towner.owned.push(this)\n\t\t\t} else {\n\t\t\t\towner.owned = [this]\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tthis.fn()\n\t\t} catch (err) {\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\n\t\tif (this.updatedAt <= time) {\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n\n\tdispose() {\n\t\tconst { sources, sourceSlots } = this\n\n\t\tif (sources) {\n\t\t\tlet source\n\t\t\tlet observers\n\t\t\tlet index\n\n\t\t\tlet observer\n\t\t\tlet slot\n\t\t\twhile (sources.length) {\n\t\t\t\tsource = sources.pop()\n\t\t\t\tobservers = source.observers\n\n\t\t\t\tindex = sourceSlots.pop()\n\n\t\t\t\tif (observers && observers.length) {\n\t\t\t\t\tobserver = observers.pop()\n\t\t\t\t\tslot = source.observerSlots.pop()\n\n\t\t\t\t\tif (index < observers.length) {\n\t\t\t\t\t\tobserver.sourceSlots[slot] = index\n\t\t\t\t\t\tobservers[index] = observer\n\t\t\t\t\t\tsource.observerSlots[index] = slot\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.dispose()\n\n\t\tthis.state = CLEAN\n\t}\n}\n\nclass Effect extends Computation {\n\tuser = true\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tEffects ? Effects.push(this) : batch(() => this.update())\n\t}\n}\n\nclass SyncEffect extends Computation {\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tbatch(() => this.update())\n\t}\n}\n\n// SIGNALS\n\nclass Memo extends Computation {\n\tstate = STALE\n\n\tpure = true\n\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\treturn markReactive(this.read.bind(this))\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (this.state) {\n\t\t\tif (this.state === STALE) {\n\t\t\t\tthis.update()\n\t\t\t} else {\n\t\t\t\tconst updates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(this))\n\t\t\t\tUpdates = updates\n\t\t\t}\n\t\t}\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tlet nextValue\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tnextValue = this.fn()\n\t\t} catch (err) {\n\t\t\tthis.state = STALE\n\t\t\tif (this.owned) {\n\t\t\t\tthis.owned.forEach(node => node.dispose())\n\t\t\t\tthis.owned.length = 0\n\t\t\t}\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\t\tif (this.updatedAt <= time) {\n\t\t\tif (this.updatedAt !== 0) {\n\t\t\t\tthis.write(nextValue)\n\t\t\t} else {\n\t\t\t\tthis.value = nextValue\n\t\t\t}\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n}\n\n// SIGNAL\n\nclass Signal {\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\t// save\n\n\t// `prev` if option save was given\n\n\tconstructor(value, options) {\n\t\tthis.value = value\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = value\n\t\t\t}\n\t\t}\n\n\t\tthis.read = markReactive(this.read.bind(this))\n\n\t\tthis.write = this.write.bind(this)\n\t\tthis.update = this.update.bind(this)\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = this.value\n\t\t\t}\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tupdate(value) {\n\t\tif (isFunction(value)) {\n\t\t\tvalue = value(this.value)\n\t\t}\n\t\treturn this.write(value)\n\t}\n\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.read\n\t\tyield this.write\n\t\tyield this.update\n\t}\n}\n\n// API\n\n/**\n * Creates a new root\n *\n * @param {(dispose: Function) => any} fn\n * @param {object} [options]\n * @returns {any}\n */\nexport function root(fn, options = undefined) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tconst root = new Root(Owner, options)\n\n\tOwner = root\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(() => fn(root.dispose.bind(root)), true)\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Creates a signal\n *\n * @template const T\n * @param {T} [initialValue] - Initial value of the signal\n * @param {SignalOptions} [options] - Signal options\n * @returns {SignalObject}\n */\n/* #__NO_SIDE_EFFECTS__ */\nexport function signal(initialValue, options = undefined) {\n\treturn new Signal(initialValue, options)\n}\n\n/**\n * Creates an effect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function effect(fn, options = undefined) {\n\tnew Effect(Owner, fn, options)\n}\n\n/**\n * Creates an effect with explicit dependencies\n *\n * @param {Function} depend - Function that causes tracking\n * @param {Function} fn - Function that wont cause tracking\n * @param {object} [options]\n */\nexport function on(depend, fn, options = undefined) {\n\teffect(() => {\n\t\tdepend()\n\t\tuntrack(fn)\n\t}, options)\n}\n\n/**\n * Creates a syncEffect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function syncEffect(fn, options = undefined) {\n\treturn new SyncEffect(Owner, fn, options)\n}\n\n/**\n * Creates a read-only signal from the return value of a function that\n * automatically updates\n *\n * @template T\n * @param {() => T} fn - Function to re-run when dependencies change\n * @param {SignalOptions} [options]\n * @returns {SignalAccessor} - Read only signal\n */\n\n/* #__NO_SIDE_EFFECTS__ */ export function memo(\n\tfn,\n\toptions = undefined,\n) {\n\treturn new Memo(Owner, fn, options)\n}\n\n/**\n * Batches changes to signals\n *\n * @param {Function} fn\n * @returns {any}\n */\nexport const batch = runUpdates\n\n/**\n * Returns current owner\n *\n * @returns {typeof Owner}\n */\nexport function owner() {\n\treturn Owner\n}\n\nfunction runWithOwner(owner, fn) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tOwner = owner\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(fn, true)\n\t} catch (err) {\n\t\tthrow err\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Disables tracking for a function\n *\n * @param {Function} fn - Function to run with tracking disabled\n * @returns {any}\n */\nexport function untrack(fn) {\n\tif (Listener === undefined) {\n\t\treturn fn()\n\t}\n\n\tconst prevListener = Listener\n\tListener = undefined\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Runs a callback on cleanup, returns callback\n *\n * @template T\n * @param {T} fn\n * @returns {T}\n */\nexport function cleanup(fn) {\n\tif (Owner) {\n\t\tif (Owner.cleanups) {\n\t\t\tOwner.cleanups.push(fn)\n\t\t} else {\n\t\t\tOwner.cleanups = [fn]\n\t\t}\n\t}\n\treturn fn\n}\n\n// UPDATES\n\nfunction runTop(node) {\n\tswitch (node.state) {\n\t\tcase CLEAN: {\n\t\t\treturn\n\t\t}\n\t\tcase CHECK: {\n\t\t\treturn upstream(node)\n\t\t}\n\t}\n\n\tconst ancestors = []\n\n\tdo {\n\t\tif (node.state) {\n\t\t\tancestors.push(node)\n\t\t}\n\t\tnode = node.owner\n\t} while (node && node.updatedAt < Time)\n\n\tfor (let i = ancestors.length - 1, updates; i >= 0; i--) {\n\t\tnode = ancestors[i]\n\n\t\tswitch (node.state) {\n\t\t\tcase STALE: {\n\t\t\t\tnode.update()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase CHECK: {\n\t\t\t\tupdates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(node, ancestors[0]))\n\t\t\t\tUpdates = updates\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction runUpdates(fn, init = false) {\n\tif (Updates) {\n\t\treturn fn()\n\t}\n\n\tlet wait = false\n\n\tif (!init) {\n\t\tUpdates = []\n\t}\n\n\tif (Effects) {\n\t\twait = true\n\t} else {\n\t\tEffects = []\n\t}\n\n\tTime++\n\n\ttry {\n\t\tconst res = fn()\n\n\t\tif (Updates) {\n\t\t\trunQueue(Updates)\n\t\t\tUpdates = null\n\t\t}\n\t\tif (!wait) {\n\t\t\tconst effects = Effects\n\t\t\tEffects = null\n\t\t\tif (effects.length) {\n\t\t\t\trunUpdates(() => runEffects(effects))\n\t\t\t}\n\t\t}\n\n\t\treturn res\n\t} catch (err) {\n\t\tif (!wait) {\n\t\t\tEffects = null\n\t\t}\n\t\tUpdates = null\n\n\t\tthrow err\n\t}\n}\n\nfunction runQueue(queue) {\n\tfor (let i = 0; i < queue.length; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction runEffects(queue) {\n\tlet i\n\n\tlet effect\n\tlet userLength = 0\n\tfor (i = 0; i < queue.length; i++) {\n\t\teffect = queue[i]\n\n\t\tif (!effect.user) {\n\t\t\trunTop(effect)\n\t\t} else {\n\t\t\tqueue[userLength++] = effect\n\t\t}\n\t}\n\n\tfor (i = 0; i < userLength; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction upstream(node, ignore) {\n\tnode.state = CLEAN\n\n\tfor (let i = 0, source; i < node.sources.length; i++) {\n\t\tsource = node.sources[i]\n\n\t\tif (source.sources) {\n\t\t\tswitch (source.state) {\n\t\t\t\tcase STALE: {\n\t\t\t\t\tif (source !== ignore && source.updatedAt < Time) {\n\t\t\t\t\t\trunTop(source)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase CHECK: {\n\t\t\t\t\tupstream(source, ignore)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction downstream(node) {\n\tfor (let i = 0, observer; i < node.observers.length; i++) {\n\t\tobserver = node.observers[i]\n\n\t\tif (observer.state === CLEAN) {\n\t\t\tobserver.state = CHECK\n\t\t\tif (observer.pure) {\n\t\t\t\tUpdates.push(observer)\n\t\t\t} else {\n\t\t\t\tEffects.push(observer)\n\t\t\t}\n\t\t\tobserver.observers && downstream(observer)\n\t\t}\n\t}\n}\n\nlet readForbid = false\n\nfunction checkReadForbidden() {\n\tif (readForbid) {\n\t\tconsole.trace('Signal Read!')\n\t}\n}\nexport function readForbidden(fn, value) {\n\tconst prev = readForbid\n\ttry {\n\t\treadForbid = value\n\t\treturn fn()\n\t} finally {\n\t\treadForbid = prev\n\t}\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {typeof Context} Context\n */\nexport function Context(defaultValue = undefined) {\n\tconst id = Symbol()\n\n\treturn useContext.bind(null, id, defaultValue)\n}\n\n/**\n * @overload Gets the context value\n * @returns {any} Context value\n */\n/**\n * @overload Runs `fn` with a new value as context\n * @param {any} newValue - New value for the context\n * @param {Function} fn - Callback to run with the new context value\n * @returns {Children} Children\n */\n/**\n * @param {any} newValue\n * @param {Function} fn\n */\nfunction useContext(id, defaultValue, newValue, fn) {\n\tif (newValue === undefined) {\n\t\treturn Owner?.context && Owner.context[id] !== undefined\n\t\t\t? Owner.context[id]\n\t\t\t: defaultValue\n\t} else {\n\t\tlet res\n\n\t\tsyncEffect(() => {\n\t\t\tOwner.context = {\n\t\t\t\t...Owner.context,\n\t\t\t\t[id]: newValue,\n\t\t\t}\n\t\t\tres = untrack(fn)\n\t\t})\n\n\t\treturn res\n\t}\n}\n\n/**\n * Returns an owned function\n *\n * @param {function | undefined} cb\n * @returns {() => any}\n */\nexport const owned = cb => {\n\tconst o = Owner\n\treturn (...args) => cb && runWithOwner(o, () => cb(...args))\n}\n\n/**\n * Returns true when value is reactive (a signal)\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isReactive = value =>\n\tisFunction(value) && $isReactive in value\n\n/**\n * Marks a function as reactive. Reactive functions are ran inside\n * effects.\n *\n * @param {Function} fn - Function to mark as reactive\n * @returns {Function}\n */\nexport function markReactive(fn) {\n\tfn[$isReactive] = undefined\n\treturn fn\n}\n\n/**\n * Proxies a signals property access so you dont have to call the\n * function\n *\n * @param {Signal} snigal - Signal to proxy\n * @param {object} [target] - Target object for the proxy\n * @returns {object} An object that will read the properties from the\n * signal\n */\nexport const proxy = (snigal, target = nothing) =>\n\tnew Proxy(target, {\n\t\tget(target, key) {\n\t\t\treturn snigal()[key]\n\t\t},\n\t\thas(target, key) {\n\t\t\treturn key in snigal()\n\t\t},\n\t\townKeys(target) {\n\t\t\treturn keys(snigal())\n\t\t},\n\t})\n\n/**\n * A self contained signal function, when an argument is present it\n * writes to the signal, when theres no argument it reads the signal.\n *\n * @template T\n * @param {T} [value] - Optional initial value\n * @returns {SignalFunction}\n */\nexport function signalFunction(value) {\n\tconst [read, write] = signal(value)\n\treturn markReactive((...args) =>\n\t\targs.length ? write(args[0]) : read(),\n\t)\n}\n\n/**\n * To set and read refs. To use in ref attribute.\n *\n * @template T\n * @returns {SignalFunction}\n */\nexport const ref = () => signalFunction()\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport const withValue = (value, fn) =>\n\tisFunction(value) ? effect(() => fn(getValue(value))) : fn(value)\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport function withPrevValue(value, fn) {\n\tif (isFunction(value)) {\n\t\tlet prev = undefined\n\t\teffect(() => {\n\t\t\tconst val = getValue(value)\n\t\t\tfn(val, prev)\n\t\t\tprev = val\n\t\t})\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Lazy and writable version of `memo`, its writable and will run the\n * function only when used\n *\n * @author ryansolid\n * @param {Function} fn - Function to re-run when dependencies change\n * @returns {((...args) => any) | (() => any)}\n */\nexport function writable(fn) {\n\tconst result = memo(() => signal(fn()))\n\n\treturn markReactive((...args) => {\n\t\treturn args.length ? result().write(args[0]) : result().read()\n\t})\n}\n\n/**\n * Creates an asynchronously effect\n *\n * @param {(currentRunningEffect: Promise) => any} fn - A\n * function that receives a `currentRunningEffect` that should be\n * awaited for when wanting to run effects synchronously, that's it\n * one effect after another.\n */\nexport function asyncEffect(fn) {\n\tconst queue = []\n\teffect(() => {\n\t\tconst { promise, resolve } = withResolvers()\n\n\t\tqueue.push(promise)\n\n\t\tfunction onDone() {\n\t\t\tremoveFromArray(queue, promise)\n\t\t\tresolve()\n\t\t}\n\n\t\tresolved(\n\t\t\tfn(queue.length === 1 ? undefined : queue[queue.length - 2]),\n\t\t\tonDone,\n\t\t)\n\t})\n}\n\n/**\n * A Promise loader handler. Allows to display/run something or\n * nothing while a promise is resolving. Allows to run a callback when\n * the promise resolves. Allows to get notified of errors, and\n * display/run something or nothing, if wanted a `retry` function is\n * given for retrying the promise. All functions run with the original\n * owner, so it's `Context` friendly.\n *\n * @param {(() => Promise) | Promise} fn - Function that\n * returns a promise\n * @param {{\n * \tonLoading?: any\n * \tonLoaded?: Function\n * \tonError?: ((e: Error, retry: Function) => any) | any\n * }} [options]\n *\n * @returns {Component}\n * @url https://pota.quack.uy/lazy\n */\nexport const lazy = (fn, options = nothing) =>\n\tmarkComponent(props => {\n\t\tconst { onLoading, onLoaded, onError } = options\n\n\t\tconst [value, setValue] = signal(onLoading)\n\n\t\tconst _onLoaded = owned(onLoaded)\n\n\t\tconst retry = () =>\n\t\t\tPromise.resolve(isFunction(fn) ? fn() : fn)\n\t\t\t\t.then(r => {\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tmarkComponent(() => {\n\t\t\t\t\t\t\tr = isObject(r) && r.default ? r.default : r\n\t\t\t\t\t\t\treturn isFunction(r) ? r(props) : r\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\tmicrotask(_onLoaded)\n\t\t\t\t})\n\t\t\t\t.catch(e =>\n\t\t\t\t\tonError\n\t\t\t\t\t\t? setValue(\n\t\t\t\t\t\t\t\tmarkComponent(() =>\n\t\t\t\t\t\t\t\t\tisFunction(onError) ? onError(e, retry) : onError,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: console.error(e),\n\t\t\t\t)\n\t\tretry()\n\n\t\treturn value\n\t})\n\nexport const Lazy = props => lazy(props.children, props)\n\nexport const microtask = fn => queueMicrotask(owned(fn))\n\n// MAP\n\n/**\n * Reactive Map\n *\n * @template T\n * @param {Each} list\n * @param {Function} callback\n * @param {boolean} [sort]\n */\nexport function map(list, callback, sort) {\n\tconst cache = new Map()\n\tconst duplicates = new Map() // for when caching by value is not possible [1, 2, 1, 1, 1]\n\n\tlet runId = 0\n\n\tlet rows = []\n\t/** @type any[] */\n\tlet prev = []\n\n\tfunction clear() {\n\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\tprev[i].dispose(true)\n\t\t}\n\t\tcache.clear()\n\t\tduplicates.clear()\n\n\t\trows.length = 0\n\t\tprev.length = 0\n\t}\n\n\t// to get rid of all nodes when parent disposes\n\tcleanup(clear)\n\n\tclass Row {\n\t\tconstructor(item, index, fn, isDupe) {\n\t\t\tthis.runId = -1\n\t\t\tthis.item = item\n\t\t\tthis.index = index\n\t\t\tthis.isDupe = isDupe\n\t\t\tthis.disposer = undefined\n\t\t\tthis.nodes = root(disposer => {\n\t\t\t\tthis.disposer = disposer\n\t\t\t\t/** @type Children[] */\n\t\t\t\treturn fn(item, index)\n\t\t\t})\n\t\t}\n\t\tget begin() {\n\t\t\treturn this.nodes[0]\n\t\t}\n\t\tget end() {\n\t\t\treturn this.nodes[this.nodes.length - 1]\n\t\t}\n\t\tdispose(all) {\n\t\t\t// skip cache deletion as we are going to clear the full map\n\t\t\tif (all === undefined) {\n\t\t\t\t// delete from cache\n\t\t\t\tif (!this.isDupe) {\n\t\t\t\t\tcache.delete(this.item)\n\t\t\t\t} else {\n\t\t\t\t\tconst arr = duplicates.get(this.item)\n\t\t\t\t\tarr.length === 1\n\t\t\t\t\t\t? duplicates.delete(this.item)\n\t\t\t\t\t\t: removeFromArray(arr, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.disposer()\n\t\t}\n\t}\n\n\t/**\n\t * @param {Function} fn\n\t * @returns {Children}\n\t */\n\tfunction mapper(fn) {\n\t\tconst cb = fn\n\t\t\t? (item, index) => fn(callback(item, index), index)\n\t\t\t: callback\n\n\t\tconst value = getValue(list) || []\n\n\t\t/** To allow iterate objects as if were an array with indexes */\n\t\tconst items = isIterable(value) ? value.entries() : entries(value)\n\n\t\trunId++\n\t\trows = []\n\t\tconst hasPrev = prev.length\n\n\t\tfor (const [index, item] of items) {\n\t\t\tlet row = hasPrev ? cache.get(item) : undefined\n\n\t\t\t// if the item doesnt exists, create it\n\t\t\tif (row === undefined) {\n\t\t\t\trow = new Row(item, index, cb, false)\n\t\t\t\tcache.set(item, row)\n\t\t\t} else if (row.runId === runId) {\n\t\t\t\t// a map will save only 1 of any primitive duplicates, say: [1, 1, 1, 1]\n\t\t\t\t// if the saved value was already used on this run, create a new one\n\t\t\t\tlet dupes = duplicates.get(item)\n\t\t\t\tif (!dupes) {\n\t\t\t\t\tdupes = []\n\t\t\t\t\tduplicates.set(item, dupes)\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < dupes.length; i++) {\n\t\t\t\t\tif (dupes[i].runId !== runId) {\n\t\t\t\t\t\trow = dupes[i]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (row.runId === runId) {\n\t\t\t\t\trow = new Row(item, index, cb, true)\n\t\t\t\t\tdupes.push(row)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trow.runId = runId // mark used on this run\n\t\t\trow.index = index // save sort order\n\t\t\trows.push(row)\n\t\t}\n\n\t\t// remove rows that arent present on the current run\n\t\tif (rows.length === 0) {\n\t\t\tclear()\n\t\t} else {\n\t\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\t\tif (prev[i].runId !== runId) {\n\t\t\t\t\tprev[i].dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// reorder elements\n\t\t// `rows.length > 1` because no need for sorting when there are no items\n\t\t// prev.length > 0 to skip sorting on creation as its already sorted\n\t\tif (sort && rows.length > 1 && prev.length) {\n\t\t\t// if the planets align it handles swapping\n\t\t\t// a = sorted\n\t\t\t// b = unsorted\n\t\t\tconst { a, b } = groupBy(rows, (value, index) =>\n\t\t\t\trows[index] === prev[index] ? 'a' : 'b',\n\t\t\t)\n\n\t\t\tlet unsorted = b?.length\n\t\t\tif (\n\t\t\t\ta &&\n\t\t\t\tb &&\n\t\t\t\ta.length &&\n\t\t\t\tb.length &&\n\t\t\t\tb.length < a.length &&\n\t\t\t\tb.every(item => prev.includes(item))\n\t\t\t) {\n\t\t\t\tfor (const usort of b) {\n\t\t\t\t\tfor (const sort of a) {\n\t\t\t\t\t\tif (usort.index === sort.index - 1) {\n\t\t\t\t\t\t\tsort.begin.before(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if (usort.index === sort.index + 1) {\n\t\t\t\t\t\t\tsort.end.after(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unsorted) {\n\t\t\t\t// handles all other cases\n\t\t\t\t// best for any combination of: push/pop/shift/unshift/insertion/deletion\n\t\t\t\t// must check in reverse as on creation stuff is added to the end\n\n\t\t\t\tlet current = rows[rows.length - 1]\n\t\t\t\tfor (let i = rows.length - 1; i > 0; i--) {\n\t\t\t\t\tconst previous = rows[i - 1]\n\t\t\t\t\tif (current.begin.previousSibling !== previous.end) {\n\t\t\t\t\t\tcurrent.begin.before(...nodesFromRow(previous))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = previous\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// save sorted list\n\t\tprev = rows\n\n\t\t// return external representation\n\t\treturn rows.map(item => item.nodes)\n\t}\n\tmapper[$isMap] = undefined\n\treturn mapper\n}\n\nfunction nodesFromRow(row) {\n\tconst { begin, end } = row\n\tconst nodes = [begin]\n\n\tlet nextSibling = begin\n\twhile (nextSibling !== end) {\n\t\tnextSibling = nextSibling.nextSibling\n\t\tnodes.push(nextSibling)\n\t}\n\n\treturn nodes\n}\n\n/**\n * Resolves and returns `children` in a memo\n *\n * @param {Function | Children} fn\n * @returns {Function} Memo\n * @url https://pota.quack.uy/resolve\n */\nexport function resolve(fn) {\n\tconst children = isFunction(fn) ? memo(fn) : () => fn\n\treturn memo(() => unwrap(children()))\n}\n\n/**\n * Recursively unwrap children functions\n *\n * @param {Children} children\n * @returns {Children}\n */\nfunction unwrap(children) {\n\tif (isFunction(children)) {\n\t\treturn unwrap(children())\n\t}\n\n\tif (isArray(children)) {\n\t\tconst childrens = []\n\t\tfor (let child of children) {\n\t\t\tchild = unwrap(child)\n\t\t\tisArray(child)\n\t\t\t\t? childrens.push(...child)\n\t\t\t\t: childrens.push(child)\n\t\t}\n\t\treturn childrens\n\t}\n\n\treturn children\n}\n\n/**\n * Extend `Pota` and define a `render(props){}` method to create a\n * class component. `ready(cb)` and `cleanup(cb)` methods will be\n * registered automatically\n *\n * @url https://pota.quack.uy/Classes\n */\nexport class Pota {}\n\nPota[$isClass] = undefined\n\n/**\n * Returns true if the `value` is a `Component`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponent = value =>\n\tisFunction(value) && $isComponent in value\n\n/**\n * Returns true if the value can be made a Component\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponentable = value =>\n\t!isReactive(value) &&\n\t(isFunction(value) ||\n\t\t// avoid [1,2] and support { toString(){ return \"something\"} }\n\t\t(!isArray(value) && isObject(value) && !value.then))\n\n/**\n * Makes of `children` a function. Reactive children will run as is,\n * non-reactive children will run untracked, regular children will\n * just return.\n *\n * @param {Children} children\n * @returns {Function}\n */\nexport function makeCallback(children) {\n\t/**\n\t * When children is an array, as in >${[0, 1, 2]}< then children\n\t * will end as `[[0, 1, 2]]`, so flat it\n\t */\n\n\tchildren = isArray(children) ? flat(children) : children\n\n\tconst callbacks = !isArray(children)\n\t\t? callback(children)\n\t\t: children.map(callback)\n\n\treturn !isArray(children)\n\t\t? markComponent((...args) => callbacks(args))\n\t\t: markComponent((...args) =>\n\t\t\t\tcallbacks.map(callback => callback(args)),\n\t\t\t)\n}\n\nconst callback = child =>\n\tisFunction(child)\n\t\t? isReactive(child)\n\t\t\t? args => {\n\t\t\t\t\t/**\n\t\t\t\t\t * The function inside the `for` is saved in a signal. The\n\t\t\t\t\t * result of the signal is our callback\n\t\t\t\t\t *\n\t\t\t\t\t * ```js\n\t\t\t\t\t * htmlEffect(\n\t\t\t\t\t * \thtml =>\n\t\t\t\t\t * \t\thtml`\n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\tname \n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\t${item =>\n\t\t\t\t\t * \t\t\t\t\thtml`\n\t\t\t\t\t * \t\t\t\t\t\t${item.name} \n\t\t\t\t\t * \t\t\t\t\t `}\n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t
`,\n\t\t\t\t\t * )\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\tconst r = child()\n\t\t\t\t\treturn isFunction(r)\n\t\t\t\t\t\t? isReactive(r)\n\t\t\t\t\t\t\t? r()\n\t\t\t\t\t\t\t: untrack(() => r(...args))\n\t\t\t\t\t\t: r\n\t\t\t\t}\n\t\t\t: args => untrack(() => child(...args))\n\t\t: () => child\n\n// allows to tell a `signal function` from a `component function`\n// signals and user functions go in effects, for reactivity\n// components and callbacks are untracked and wont go in effects to avoid re-rendering\n\n/**\n * Marks a function as a `Component`.\n *\n * @param {Function} fn - Function to mark as a `Component`\n * @returns {Component}\n */\nexport function markComponent(fn) {\n\tfn[$isComponent] = undefined\n\treturn fn\n}\n\n/**\n * Unwraps components till it gets a value. To keep context relevant\n * to the component\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValueComponent(value) {\n\twhile ($isComponent in value) value = value()\n\treturn value\n}\n\n/**\n * Adds an event listener to a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `off` function for removing the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function addEventListener(node, type, handler) {\n\tnode.addEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\t/**\n\t * Removes event on tracking scope disposal.\n\t *\n\t * Situation: the event was added to the `document` manually using\n\t * `addEventListener`, say to listen for clicks as a \"click\n\t * outside\". The event needs to be removed when the component that\n\t * added it is disposed.\n\t */\n\n\treturn cleanup(() => removeEventListener(node, type, handler))\n}\n\n/**\n * Removes an event listener from a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `on` function for adding back the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function removeEventListener(node, type, handler) {\n\tnode.removeEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\treturn () => addEventListener(node, type, handler)\n}\n\n/**\n * It gives a handler an owner, so stuff runs batched on it, and\n * things like context and cleanup work\n */\nexport const ownedEvent = handler =>\n\t'handleEvent' in handler\n\t\t? {\n\t\t\t\t...handler,\n\t\t\t\thandleEvent: owned(e => handler.handleEvent(e)),\n\t\t\t}\n\t\t: owned(handler)\n","import { owned } from './lib/reactive.js'\nimport { call, queueMicrotask } from './lib/std.js'\n\n/**\n * The purpose of this file is to guarantee the timing of some\n * callbacks. It queues a microtask, then the callbacks are added to a\n * position in the array. These are run with a priority.\n */\n\n/** @type boolean */\nlet added\n\n/** @type [][] */\nlet queue\n\nfunction reset() {\n\tqueue = [[], [], [], [], [], []]\n\tadded = false\n}\n\n// initialization\nreset()\n\n/**\n * Queues a callback at a priority\n *\n * @param {PropertyKey} priority - Priority\n * @param {Function} fn - Function to run once the callbacks at this\n * priority run\n */\nfunction add(priority, fn) {\n\tif (!added) {\n\t\tadded = true\n\t\tqueueMicrotask(run)\n\t}\n\tqueue[priority].push(owned(fn))\n}\n\n/** Runs all queued callbacks */\nfunction run() {\n\tconst q = queue\n\treset()\n\n\tfor (const fns of q) {\n\t\tfns.length && call(fns)\n\t}\n}\n\n/**\n * Queue a function to run before everything else (onProps, onRef,\n * onMount, ready) ex focus restoration\n *\n * @param {Function} fn\n */\nexport const onFixes = fn => add(0, fn)\n\n/**\n * Queue a function to run before (onRef, onMount, ready) ex running\n * user functions on elements via plugins\n *\n * @param {Function} fn\n */\nexport const onProps = fn => add(1, fn)\n\n/**\n * Queue a function to run onRef (before onMount, after onProps)\n *\n * @param {Function} fn\n */\nexport const onRef = fn => add(2, fn)\n\n/**\n * Queue a function to run onMount (before ready, after onRef)\n *\n * @param {Function} fn\n */\nexport const onMount = fn => add(3, fn)\n\n/**\n * Queue a function to run on ready (after onMount)\n *\n * @param {Function} fn\n * @url https://pota.quack.uy/ready\n */\nexport const ready = fn => add(4, fn)\n\n/**\n * Queue a function to run after all user defined processes\n *\n * @param {Function} fn\n */\nexport const onDone = fn => add(5, fn)\n","import { addEventListener } from '../lib/reactive.js'\nimport { window, withCache } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {EventListenerOrEventListenerObject} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setEventNS = (node, name, value, props, localName, ns) =>\n\taddEventListener(node, localName, value)\n\n/**\n * Returns an event name when the string could be mapped to an event\n *\n * @param {string} name - String to check for a mapped event\n * @returns {string | undefined} Returns the event name or null in\n * case isnt found\n */\nexport const eventName = withCache(name =>\n\tname.startsWith('on') && name.toLowerCase() in window\n\t\t? name.slice(2).toLowerCase()\n\t\t: null,\n)\n/*\nconst eventNames = new Set(\n\tkeys(global).filter(prop => prop.startsWith('on')),\n)\n*/\n","import { cacheStore } from '../lib/std.js'\nimport { onProps } from '../scheduler.js'\n\nexport const plugins = cacheStore()\nexport const pluginsNS = cacheStore()\n\n/**\n * Defines a prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - To avoid the problem of\n * needed props not being set, or children elements not created yet.\n * Default is `true`\n * @url https://pota.quack.uy/props/propsPlugin\n */\nexport const propsPlugin = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n}\n\n/**\n * Defines a namespaced prop that can be used on any Element\n *\n * @param {string} NSName - Name of the namespace\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * \tlocalName: string,\n * \tns: string,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginNS = (NSName, fn, onMicrotask) => {\n\tplugin(pluginsNS, NSName, fn, onMicrotask)\n}\n\n/**\n * Defines prop and namespaced prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop/namespace\n * @param {Function} fn - Function to run when this prop is found on\n * any Element\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginBoth = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n\tplugin(pluginsNS, propName, fn, onMicrotask)\n}\n\nconst plugin = (plugins, name, fn, onMicrotask = true) => {\n\tplugins.set(\n\t\tname,\n\t\t!onMicrotask ? fn : (...args) => onProps(() => fn(...args)),\n\t)\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\nimport { NS } from '../constants.js'\n\n// NODE ATTRIBUTES\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setAttributeNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setAttribute(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n * @url https://pota.quack.uy/props/setAttribute\n */\nexport const setAttribute = (node, name, value, ns) =>\n\twithValue(value, value => _setAttribute(node, name, value, ns))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {string} [ns]\n */\nfunction _setAttribute(node, name, value, ns) {\n\t// if the value is null or undefined it will be removed\n\tif (isNullUndefined(value)) {\n\t\tns && NS[ns]\n\t\t\t? node.removeAttributeNS(NS[ns], name)\n\t\t\t: node.removeAttribute(name)\n\t} else {\n\t\tns && NS[ns]\n\t\t\t? node.setAttributeNS(NS[ns], name, value)\n\t\t\t: node.setAttribute(name, value)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setPropertyNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setProperty(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setProperty\n */\nexport const setProperty = (node, name, value) =>\n\twithValue(value, value => _setProperty(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nfunction _setProperty(node, name, value) {\n\t// if the value is null or undefined it will be set to null\n\tif (isNullUndefined(value)) {\n\t\t// defaulting to undefined breaks `progress` tag and the whole page\n\t\tnode[name] = null\n\t} else {\n\t\tnode[name] = value\n\t}\n}\n","// NODE UNKNOWN PROPERTIES / ATTRIBUTES\n\nimport { setAttribute } from './attribute.js'\nimport { setProperty } from './property.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const setUnknown = (node, name, value, ns) => {\n\tname in node && !(node instanceof SVGElement)\n\t\t? setProperty(node, name, value)\n\t\t: setAttribute(node, name, value, ns)\n}\n","// BOOL ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setBoolNS = (node, name, value, props, localName, ns) =>\n\tsetBool(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setBool\n */\nexport const setBool = (node, name, value) =>\n\twithValue(value, value => _setBool(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const _setBool = (node, name, value) =>\n\t// if the value is falsy gets removed\n\t!value ? node.removeAttribute(name) : node.setAttribute(name, '')\n","// node style\n\nimport { withValue } from '../lib/reactive.js'\nimport { getValue, isNullUndefined, isObject } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @url https://pota.quack.uy/props/setStyle\n */\nexport const setStyle = (node, name, value, props) =>\n\tsetNodeStyle(node.style, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setStyleNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(\n\t\tnode.style,\n\t\tisObject(value) ? value : { [localName]: value },\n\t)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setVarNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(node.style, { ['--' + localName]: value })\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {unknown} value\n */\nfunction setNodeStyle(style, value) {\n\tif (isObject(value)) {\n\t\tlet name\n\t\tfor (name in value) {\n\t\t\tsetStyleValue(style, name, value[name])\n\t\t}\n\t\treturn\n\t}\n\tconst type = typeof value\n\tif (type === 'string') {\n\t\tstyle.cssText = value\n\t\treturn\n\t}\n\tif (type === 'function') {\n\t\twithValue(value, value => setNodeStyle(style, getValue(value)))\n\t\treturn\n\t}\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementStyle = (node, name, value) =>\n\tsetStyleValue(node.style, name, value)\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {unknown} value\n */\nconst setStyleValue = (style, name, value) =>\n\twithValue(value, value => _setStyleValue(style, name, value))\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {string | null} value\n */\nconst _setStyleValue = (style, name, value) =>\n\t// if the value is null or undefined it will be removed\n\tisNullUndefined(value)\n\t\t? style.removeProperty(name)\n\t\t: style.setProperty(name, value)\n","// node class / classList\n\nimport { withPrevValue, withValue } from '../lib/reactive.js'\nimport {\n\tclassListAdd,\n\tclassListRemove,\n\tisFunction,\n\tisString,\n} from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n */\nexport const setClass = (node, name, value, props) =>\n\tisString(value)\n\t\t? node.setAttribute('class', value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setClassNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) =>\n\tisFunction(value)\n\t\t? setElementClass(node, localName, value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {object | string | ArrayLike} value\n */\nfunction setClassList(node, value) {\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t_setClassListValue(node, value, true)\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'object': {\n\t\t\tlet name\n\t\t\tfor (name in value) {\n\t\t\t\tsetElementClass(node, name, value[name])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'function': {\n\t\t\twithValue(value, value => setClassList(node, value))\n\t\t\tbreak\n\t\t}\n\t}\n}\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementClass = (node, name, value) =>\n\twithPrevValue(value, (value, prev) => {\n\t\t// on initialization do not remove whats not there\n\t\tif (!value && !prev) {\n\t\t} else {\n\t\t\t_setClassListValue(node, name, value)\n\t\t}\n\t})\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\n\nconst _setClassListValue = (node, name, value) =>\n\t// null, undefined or false, the class is removed\n\t!value\n\t\t? classListRemove(node, name)\n\t\t: classListAdd(node, ...name.trim().split(/\\s+/))\n","/** Returns true or false with a `chance` of getting `true` */\nexport const chance = (chance = 50, generator = random) => {\n\treturn generator() < chance / 100\n}\n\n/** Returns random number between 0 and 1 */\nexport const random = () =>\n\tcrypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)\n\nexport const randomBetween = (min, max, generator = random) =>\n\tMath.floor(generator() * (max - min + 1)) + min\n\nexport const randomColor = (min = 0, max = 255) =>\n\t'rgb(' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t')'\n\nexport const randomId = () =>\n\tcrypto.getRandomValues(new BigUint64Array(1))[0].toString(36)\n\n/**\n * Returns a random number generator based no a seed that generates\n * numbers between 0 and 1\n */\nexport function randomSeeded(seed) {\n\tconst m = 2 ** 35 - 31\n\tlet s = seed % m\n\treturn () => (s = (s * 185852) % m) / m\n}\n","import {\n\tadoptedStyleSheetsAdd,\n\tclassListAdd,\n\tgetDocumentForElement,\n\tsheet,\n\twithState,\n} from '../lib/std.js'\n\nimport { randomId } from '../plugin/useRandom.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {object} props\n */\nexport const setCSS = (node, name, value, props) =>\n\tsetNodeCSS(node, value)\n\n/**\n * @param {Element} node\n * @param {string} value\n */\nconst setNodeCSS = withState((state, node, value) => {\n\tclassListAdd(\n\t\tnode,\n\t\tstate.get(value, value => {\n\t\t\tconst id = 'c' + randomId()\n\t\t\tadoptedStyleSheetsAdd(\n\t\t\t\tgetDocumentForElement(node),\n\t\t\t\tsheet(value.replace(/class/g, '.' + id)),\n\t\t\t)\n\t\t\treturn id\n\t\t}),\n\t)\n})\n","import { cleanup } from '../lib/reactive.js'\n\nimport { onMount, onRef } from '../scheduler.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setRef = (node, name, value, props) =>\n\tonRef(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setOnMount = (node, name, value, props) =>\n\tonMount(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setUnmount = (node, name, value, props) =>\n\tcleanup(() => value(node))\n","import {\n\taddEventListener,\n\towned,\n\townedEvent,\n} from '../lib/reactive.js'\nimport { getValue, isObject } from '../lib/std.js'\n\nimport { eventName } from './event.js'\n\nimport {\n\tplugins,\n\tpluginsNS,\n\tpropsPlugin,\n\tpropsPluginBoth,\n\tpropsPluginNS,\n} from './plugin.js'\nimport { setUnknown } from './unknown.js'\n\n// exports\n\nexport { setAttribute } from './attribute.js'\nexport { setBool } from './bool.js'\nexport { setProperty } from './property.js'\nexport { setElementStyle as setStyle } from './style.js'\nexport { setElementClass as setClass } from './class.js'\n\n// PLUGINS NS\n\n// namespaced attributes/properties\n\nimport { setPropertyNS } from './property.js'\npropsPluginNS('prop', setPropertyNS, false)\n\nimport { setAttributeNS } from './attribute.js'\npropsPluginNS('attr', setAttributeNS, false)\n\nimport { setBoolNS } from './bool.js'\npropsPluginNS('bool', setBoolNS, false)\n\n// events\n\nimport { setEventNS } from './event.js'\npropsPluginNS('on', setEventNS, false)\n\n// var\n\nimport { setVarNS } from './style.js'\npropsPluginNS('var', setVarNS, false)\n\n// PLUGINS REGULAR\n\n// forced as properties\n\nimport { setProperty } from './property.js'\nfor (const item of [\n\t'value',\n\t'textContent',\n\t'innerText',\n\t'innerHTML',\n]) {\n\tpropsPlugin(item, setProperty, false)\n}\n\n// noop\n\nimport { noop } from '../lib/std.js'\npropsPlugin('__dev', noop, false)\npropsPlugin('xmlns', noop, false)\n\n// PLUGIN BOTH\n\n// css\n\nimport { setCSS } from './css.js'\npropsPluginBoth('css', setCSS, false)\n\n// mount\n\nimport { setOnMount } from './lifecycle.js'\npropsPluginBoth('onMount', setOnMount, false)\n\n// unmount\n\nimport { setUnmount } from './lifecycle.js'\npropsPluginBoth('onUnmount', setUnmount, false)\n\n// ref\n\nimport { setRef } from './lifecycle.js'\npropsPluginBoth('ref', setRef, false)\n\n// PLUGIN BOTH DIFFERENT\n\n// styles\n\nimport { setStyle, setStyleNS } from './style.js'\npropsPlugin('style', setStyle, false)\npropsPluginNS('style', setStyleNS, false)\n\n// class\n\nimport { setClass, setClassNS } from './class.js'\npropsPlugin('class', setClass, false)\npropsPluginNS('class', setClassNS, false)\n\n// catch all\n\n/**\n * Assigns props to an Element\n *\n * @param {Element} node - Element to which assign props\n * @param {object} props - Props to assign\n */\nexport function assignProps(node, props) {\n\tfor (const name in props) {\n\t\tassignProp(node, name, props[name], props)\n\t}\n}\n\n/**\n * Assigns a prop to an Element\n *\n * @param {Element} node\n * @param {string} name\n * @param {any} value\n * @param {object} props\n */\nexport function assignProp(node, name, value, props) {\n\t// unwrap promises\n\tif (isObject(value) && 'then' in value) {\n\t\tvalue.then(\n\t\t\towned(value => assignProp(node, name, getValue(value), props)),\n\t\t)\n\t\treturn\n\t}\n\n\t// run plugins\n\tlet plugin = plugins.get(name)\n\tif (plugin) {\n\t\tplugin(node, name, value, props)\n\t\treturn\n\t}\n\n\t// onClick={handler}\n\tlet event = eventName(name)\n\tif (event) {\n\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\treturn\n\t}\n\n\tif (name.includes(':')) {\n\t\t// with ns\n\t\tconst [ns, localName] = name.split(':')\n\n\t\t// run plugins NS\n\t\tplugin = pluginsNS.get(ns)\n\t\tif (plugin) {\n\t\t\tplugin(node, name, value, props, localName, ns)\n\t\t\treturn\n\t\t}\n\n\t\t// onClick:my-ns={handler}\n\t\tevent = eventName(ns)\n\t\tif (event) {\n\t\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\t\treturn\n\t\t}\n\n\t\tsetUnknown(node, name, value, ns)\n\t\treturn\n\t}\n\n\t// catch all\n\tsetUnknown(node, name, value)\n}\n","// CONSTANTS\n\nimport { $isClass, $isMap, NS } from './constants.js'\n\n// LIB\n\nimport {\n\tcleanup,\n\tContext,\n\teffect,\n\tisReactive,\n\troot,\n\tsignal,\n\tuntrack,\n} from './lib/reactive.js'\n\nimport {\n\tadoptedStyleSheetsAdd,\n\tadoptedStyleSheetsRemove,\n\tcreateElement,\n\tcreateElementNS,\n\tcreateTextNode,\n\tCSSStyleSheet,\n\tdocument,\n\tDocumentFragment,\n\tflat,\n\tfreeze,\n\tgetDocumentForElement,\n\timportNode,\n\tisArray,\n\tisConnected,\n\titerator,\n\tnothing,\n\tquerySelector,\n\tresolved,\n\tstringify,\n\ttoArray,\n\twalkElements,\n} from './lib/std.js'\n\nimport {\n\tisComponent,\n\tisComponentable,\n\tmarkComponent,\n} from './lib/reactive.js'\n\nimport { onFixes, ready } from './scheduler.js'\n\n// PROPERTIES / ATTRIBUTES\n\nimport { assignProps } from './props/@main.js'\nimport { propsPlugin } from './props/plugin.js'\n\n// STATE\n\nconst useXMLNS = context()\n\n// COMPONENTS\n\n/**\n * Used by the regular JSX transform, as `<>...>` or\n * `... `.\n */\nexport const Fragment = props => props.children\n\n/**\n * Creates components for things. When props argument is given, the\n * props become fixed. When props argument is ommited, it allows you\n * to keep calling the returned function with new props. Returns a\n * function because we need to render from parent to children instead\n * of from children to parent. This allows to properly set the\n * reactivity tree (think of nested effects that clear inner effects,\n * context, etc).\n *\n * @param {string | Function | Element | object | symbol} value -\n * Component\n * @param {any} [props] Object\n * @url https://pota.quack.uy/Component\n */\n\nexport function Component(value, props) {\n\tif (value === Fragment) {\n\t\treturn props.children\n\t}\n\n\t/** Freeze props so isnt directly writable */\n\tfreeze(props)\n\n\t/** Create a callable function to pass `props` */\n\tconst component = Factory(value)\n\n\treturn props === undefined\n\t\t? component\n\t\t: markComponent(propsOverride =>\n\t\t\t\tcomponent(\n\t\t\t\t\tpropsOverride\n\t\t\t\t\t\t? freeze({ ...props, ...propsOverride })\n\t\t\t\t\t\t: props,\n\t\t\t\t),\n\t\t\t)\n}\n\n/**\n * Creates a component that could be called with a props object\n *\n * @template T\n * @param {any} value\n * @returns {Component}\n */\n\nfunction Factory(value) {\n\tif (isComponent(value)) {\n\t\treturn value\n\t}\n\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t// string component, 'div' becomes \n\t\t\treturn markComponent(props => createTag(value, props))\n\t\t}\n\t\tcase 'function': {\n\t\t\tif ($isClass in value) {\n\t\t\t\t// class component
\n\t\t\t\treturn markComponent(props => createClass(value, props))\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * ```js\n\t\t\t * const [Count, setCount] = signal(1)\n\t\t\t * return
\n\t\t\t * ```\n\t\t\t */\n\t\t\tif (isReactive(value)) {\n\t\t\t\treturn markComponent(() => createAnything(value))\n\t\t\t}\n\n\t\t\t// function component
\n\t\t\t// value = value\n\t\t\treturn markComponent(value)\n\t\t}\n\t\tdefault: {\n\t\t\tif (value instanceof Node) {\n\t\t\t\t// node component
\n\t\t\t\treturn markComponent(props => createNode(value, props))\n\t\t\t}\n\n\t\t\treturn markComponent(() => createAnything(value))\n\t\t}\n\t}\n}\n\nexport function createComponent(value) {\n\tconst component = Factory(value)\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() => component(props))\n\t}\n}\n\nfunction createClass(value, props) {\n\tconst i = new value()\n\ti.ready && ready(() => i.ready())\n\ti.cleanup && cleanup(() => i.cleanup())\n\n\treturn i.render(props)\n}\n\nfunction createAnything(value) {\n\treturn value\n}\n\n/**\n * Creates a x/html element from a tagName\n *\n * @template P\n * @param {TagNames} tagName\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createTag(tagName, props) {\n\t/**\n\t * Namespace, use props xmlns or special case svg, math, etc in case\n\t * of missing xmlns attribute\n\t */\n\tconst xmlns = props?.xmlns || NS[tagName]\n\n\treturn withXMLNS(\n\t\txmlns,\n\t\txmlns =>\n\t\t\tcreateNode(\n\t\t\t\txmlns\n\t\t\t\t\t? createElementNS(xmlns, tagName)\n\t\t\t\t\t: createElement(tagName),\n\t\t\t\tprops,\n\t\t\t),\n\t\ttagName,\n\t)\n}\n\nfunction withXMLNS(xmlns, fn, tagName) {\n\tconst nsContext = useXMLNS()\n\n\tif (xmlns && xmlns !== nsContext) {\n\t\t// the xmlns changed, use the new xmlns\n\t\treturn useXMLNS(xmlns, () => fn(xmlns))\n\t}\n\n\t/**\n\t * `foreignObject` children are created with html xmlns (default\n\t * browser behaviour)\n\t */\n\tif (nsContext && tagName === 'foreignObject') {\n\t\treturn useXMLNS(NS.html, () => fn(nsContext))\n\t}\n\n\treturn fn(nsContext)\n}\n\n// PARTIALS\n\nfunction cloneNode(content, xmlns) {\n\tconst template = xmlns\n\t\t? createElementNS(xmlns, 'template')\n\t\t: createElement('template')\n\n\ttemplate.innerHTML = content\n\n\t// xml\n\tif (!template.content) {\n\t\tif (template.childNodes.length === 1) {\n\t\t\treturn template.firstChild\n\t\t}\n\n\t\ttemplate.content = new DocumentFragment()\n\t\ttemplate.content.append(...template.childNodes)\n\t}\n\n\treturn template.content.childNodes.length === 1\n\t\t? template.content.firstChild\n\t\t: template.content\n}\n\nexport function createPartial(content, propsData = nothing) {\n\tlet clone = () => {\n\t\tconst node = withXMLNS(propsData.x, xmlns =>\n\t\t\tcloneNode(content, xmlns),\n\t\t)\n\n\t\tclone = propsData.i\n\t\t\t? importNode.bind(null, node, true)\n\t\t\t: node.cloneNode.bind(node, true)\n\t\treturn clone()\n\t}\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() =>\n\t\t\tassignPartialProps(clone(), props, propsData),\n\t\t)\n\t}\n}\n\nfunction assignPartialProps(node, props, propsData) {\n\tif (props) {\n\t\tconst nodes = []\n\t\twalkElements(node, node => {\n\t\t\tnodes.push(node)\n\n\t\t\tif (nodes.length === propsData.m) return true\n\t\t})\n\n\t\twithXMLNS(propsData.x, xmlns => {\n\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\tassignProps(nodes[propsData[i] || i], props[i])\n\t\t\t}\n\t\t})\n\t}\n\n\treturn node instanceof DocumentFragment\n\t\t? toArray(node.childNodes)\n\t\t: node\n}\n\n/**\n * Assigns props to an element and creates its children\n *\n * @template P\n * @param {Element} node\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createNode(node, props) {\n\tif (props) {\n\t\tassignProps(node, props)\n\t}\n\treturn node\n}\n\n/**\n * Creates the children for a parent\n *\n * @param {Element} parent\n * @param {Children} child\n * @param {boolean} [relative]\n * @param {Text | undefined} [prev]\n * @returns {Children}\n */\nfunction createChildren(parent, child, relative, prev = undefined) {\n\tswitch (typeof child) {\n\t\t// string/number\n\t\tcase 'string':\n\t\tcase 'number': {\n\t\t\tif (prev instanceof Text) {\n\t\t\t\tprev.nodeValue = child\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn insertNode(parent, createTextNode(child), relative)\n\t\t}\n\n\t\tcase 'function': {\n\t\t\t// component\n\t\t\tif (isComponent(child)) {\n\t\t\t\treturn createChildren(parent, untrack(child), relative)\n\t\t\t}\n\t\t\tlet node = []\n\n\t\t\t// signal/memo/external/user provided function\n\t\t\t// needs placeholder to stay in position\n\t\t\tparent = createPlaceholder(\n\t\t\t\tparent,\n\t\t\t\tundefined /*child.name*/,\n\t\t\t\trelative,\n\t\t\t)\n\n\t\t\t// For\n\t\t\tif ($isMap in child) {\n\t\t\t\teffect(() => {\n\t\t\t\t\tnode = toDiff(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tchild(child => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Wrap the item with placeholders, for when stuff in\n\t\t\t\t\t\t\t * between moves. If a `Show` adds and removes nodes, we\n\t\t\t\t\t\t\t * dont have a reference to these nodes. By delimiting\n\t\t\t\t\t\t\t * with a shore, we can just handle anything in between\n\t\t\t\t\t\t\t * as a group.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst begin = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*begin*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst end = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*end*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn [begin, createChildren(end, child, true), end]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\tcleanup(() => {\n\t\t\t\t\ttoDiff(node)\n\t\t\t\t\tparent.remove()\n\t\t\t\t})\n\t\t\t\treturn [node, parent]\n\t\t\t}\n\n\t\t\t// maybe a signal so needs an effect\n\n\t\t\teffect(() => {\n\t\t\t\tnode = toDiff(node, [\n\t\t\t\t\tcreateChildren(parent, child(), true, node[0]),\n\t\t\t\t])\n\t\t\t})\n\n\t\t\tcleanup(() => {\n\t\t\t\ttoDiff(node)\n\t\t\t\tparent.remove()\n\t\t\t})\n\t\t\t/**\n\t\t\t * A placeholder is created and added to the document but doesnt\n\t\t\t * form part of the children. The placeholder needs to be\n\t\t\t * returned so it forms part of the group of children. If\n\t\t\t * children are moved and the placeholder is not moved with\n\t\t\t * them, then, whenever children update these will be at the\n\t\t\t * wrong place. wrong place: where the placeholder is and not\n\t\t\t * where the children were moved to\n\t\t\t */\n\t\t\treturn [node, parent]\n\t\t}\n\n\t\tcase 'object': {\n\t\t\t// HTMLElement/Text\n\t\t\tif (child instanceof HTMLElement || child instanceof Text) {\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// children/fragments\n\t\t\tif (isArray(child)) {\n\t\t\t\treturn child.length === 1\n\t\t\t\t\t? createChildren(parent, child[0], relative)\n\t\t\t\t\t: child.map(child =>\n\t\t\t\t\t\t\tcreateChildren(parent, child, relative),\n\t\t\t\t\t\t)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The value is `null`, as in {null} or like a show returning\n\t\t\t * `null` on the falsy case\n\t\t\t */\n\t\t\tif (child === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Node/DocumentFragment\n\t\t\tif (child instanceof Node) {\n\t\t\t\t/**\n\t\t\t\t * DocumentFragment are special as only the children get added\n\t\t\t\t * to the document and the document becomes empty. If we dont\n\t\t\t\t * insert them 1 by 1 then we wont have a reference to them\n\t\t\t\t * for deletion on cleanup with node.remove()\n\t\t\t\t */\n\t\t\t\tif (child instanceof DocumentFragment) {\n\t\t\t\t\treturn createChildren(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\ttoArray(child.childNodes),\n\t\t\t\t\t\trelative,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// async components\n\t\t\tif ('then' in child) {\n\t\t\t\tconst [value, setValue] = signal(undefined)\n\n\t\t\t\tconst onResult = result =>\n\t\t\t\t\tisConnected(parent) && setValue(result)\n\n\t\t\t\tresolved(child, onResult)\n\n\t\t\t\treturn createChildren(parent, value, relative)\n\t\t\t}\n\n\t\t\t// iterable/Map/Set/NodeList\n\t\t\tif (iterator in child) {\n\t\t\t\treturn createChildren(\n\t\t\t\t\tparent,\n\t\t\t\t\ttoArray(child.values()),\n\t\t\t\t\trelative,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// CSSStyleSheet\n\t\t\tif (child instanceof CSSStyleSheet) {\n\t\t\t\t/**\n\t\t\t\t * Custom elements wont report a document unless is already\n\t\t\t\t * connected. So our stylesheet would end on the main document\n\t\t\t\t * intead of the shadodRoot\n\t\t\t\t */\n\t\t\t\tonFixes(() => {\n\t\t\t\t\tif (isConnected(parent)) {\n\t\t\t\t\t\tconst doc = getDocumentForElement(parent)\n\t\t\t\t\t\tadoptedStyleSheetsAdd(doc, child)\n\n\t\t\t\t\t\tcleanup(() => adoptedStyleSheetsRemove(doc, child))\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// object.toString fancy objects\n\t\t\treturn createChildren(\n\t\t\t\tparent,\n\t\t\t\t// Object.create(null) would fail to convert to string\n\t\t\t\t'toString' in child ? child.toString() : stringify(child),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t\tcase 'undefined': {\n\t\t\treturn undefined\n\t\t}\n\t\tdefault: {\n\t\t\t// boolean/bigint/symbol/catch all\n\t\t\t// toString() is needed for `Symbol`\n\t\t\treturn insertNode(\n\t\t\t\tparent,\n\t\t\t\tcreateTextNode(child.toString()),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t}\n}\n\npropsPlugin(\n\t'children',\n\t(node, propName, propValue) => createChildren(node, propValue),\n\tfalse,\n)\n\n/**\n * Creates placeholder to keep nodes in position\n *\n * @param {Element} parent\n * @param {unknown} text\n * @param {boolean} [relative]\n * @returns {Element}\n */\nconst createPlaceholder = (parent, text, relative) => {\n\treturn insertNode(parent, createTextNode(''), relative)\n\n\t/* dev\n\treturn insertNode(\n\t\tparent,\n\t\tdocument.createComment(\n\t\t\t(text || '') + (relative ? ' relative' : ''),\n\t\t),\n\t\trelative,\n\t) */\n}\n\nconst head = document.head\n\n/**\n * Adds the element to the document\n *\n * @param {Element} parent\n * @param {Element &\n * \tHTMLTitleElement &\n * \tHTMLMetaElement &\n * \tHTMLLinkElement} node\n * @param {boolean} [relative]\n * @returns {Element}\n */\n\nfunction insertNode(parent, node, relative) {\n\t// special case `head`\n\tif (parent === head) {\n\t\tconst name = node.localName\n\n\t\t// search for tags that should be unique\n\t\tlet prev\n\t\tif (name === 'title') {\n\t\t\tprev = querySelector(head, 'title')\n\t\t} else if (name === 'meta') {\n\t\t\tprev =\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[name=\"' + node.getAttribute('name') + '\"]',\n\t\t\t\t) ||\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[property=\"' + node.getAttribute('property') + '\"]',\n\t\t\t\t)\n\t\t} else if (name === 'link' && node.rel === 'canonical') {\n\t\t\tprev = querySelector(head, 'link[rel=\"canonical\"]')\n\t\t}\n\n\t\t// replace old node if there's any\n\t\tprev ? prev.replaceWith(node) : parent.appendChild(node)\n\t} else {\n\t\trelative ? parent.before(node) : parent.appendChild(node)\n\t}\n\n\treturn node\n}\n\n// RENDERING\n\n/**\n * WARNINGS Removal of the element on where you render/insert into,\n * wont cause disposal of what you render/insert.\n */\n\n/**\n * Inserts children into a parent\n *\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * document.body\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n * @returns {Function} Disposer\n * @url https://pota.quack.uy/render\n */\nexport function render(children, parent, options = nothing) {\n\tconst dispose = root(dispose => {\n\t\tinsert(children, parent, options)\n\t\treturn dispose\n\t})\n\n\t// run dispose when the parent scope disposes\n\tcleanup(dispose)\n\n\treturn dispose\n}\n\n/**\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * `document.body`\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n */\nexport function insert(\n\tchildren,\n\tparent = document.body,\n\toptions = nothing,\n) {\n\tif (options.clear && parent) parent.textContent = ''\n\n\tconst node = createChildren(\n\t\tparent,\n\t\tisComponentable(children) ? Factory(children) : children,\n\t\toptions.relative,\n\t)\n\n\tcleanup(() => toDiff([node].flat(Infinity)))\n\n\treturn node\n}\n\n/**\n * Creates and returns HTML Elements for `children`\n *\n * @param {Children} children\n * @returns {Children}\n * @url https://pota.quack.uy/toHTML\n */\nexport const toHTML = children =>\n\t/**\n\t * DocumentFragment is transformed to an `Array` of `Node/Element`,\n\t * that way we can keep a reference to the nodes. Because when the\n\t * DocumentFragment is used, it removes the nodes from the\n\t * DocumentFragment and then we will lose the reference.\n\t */\n\n\tflat(toHTMLFragment(children).childNodes)\n\n/**\n * Creates and returns a DocumentFragment for `children`\n *\n * @param {Children} children\n * @returns {DocumentFragment}\n * @url https://pota.quack.uy/toHTML\n */\nexport function toHTMLFragment(children) {\n\tconst fragment = new DocumentFragment()\n\tcreateChildren(fragment, children)\n\n\treturn fragment\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {Function & { Provider: ({ value }) => Children }}\n * Context\n * @url https://pota.quack.uy/Reactivity/Context\n */\n/* #__NO_SIDE_EFFECTS__ */ export function context(\n\tdefaultValue = undefined,\n) {\n\t/** @type {Function & { Provider: ({ value }) => Children }} */\n\tconst ctx = Context(defaultValue)\n\n\t/**\n\t * Sets the `value` for the context\n\t *\n\t * @param {object} props\n\t * @param {any} props.value\n\t * @param {Children} [props.children]\n\t * @returns {Children} Children\n\t * @url https://pota.quack.uy/Reactivity/Context\n\t */\n\tctx.Provider = props =>\n\t\tctx(props.value, () => toHTML(props.children))\n\n\treturn ctx\n}\n\n/**\n * Removes from the DOM `prev` elements not found on `next`\n *\n * @param {Element[]} prev - Array with previous elements\n * @param {Element[]} next - Array with next elements\n * @returns {Element[]}\n */\nfunction toDiff(prev = [], next = []) {\n\tnext = next.flat(Infinity)\n\tfor (let i = 0, item; i < prev.length; i++) {\n\t\titem = prev[i]\n\t\titem &&\n\t\t\t(next.length === 0 || !next.includes(item)) &&\n\t\t\titem.remove()\n\t}\n\treturn next\n}\n","import { signal, cleanup, syncEffect } from '../lib/reactive.js'\nimport { isIterable, toArray } from '../lib/std.js'\n\n/**\n * Returns a `isSelected` function that will return `true` when the\n * argument for it matches the original signal `value`.\n *\n * @param {Signal} value - Signal with the current value\n * @returns {(item: any) => Signal} Signal that you can run with a\n * value to know if matches the original signal\n */\nexport function useSelector(value) {\n\tconst map = new Map()\n\n\tlet prev = []\n\n\tsyncEffect(() => {\n\t\tconst val = value()\n\n\t\tconst selected = isIterable(val) ? toArray(val.values()) : [val]\n\n\t\t// unselect\n\t\tfor (const value of prev) {\n\t\t\tif (!selected.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(false)\n\t\t\t}\n\t\t}\n\n\t\t// select\n\t\tfor (const value of selected) {\n\t\t\tif (!prev.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(true)\n\t\t\t}\n\t\t}\n\n\t\tprev = selected\n\t})\n\n\t/**\n\t * Is selected function, it will return `true` when the value\n\t * matches the current signal.\n\t *\n\t * @param {any} item - Values to compare with current\n\t * @returns {Signal} A signal with a boolean value\n\t */\n\treturn function isSelected(item) {\n\t\tlet selected = map.get(item)\n\t\tif (!selected) {\n\t\t\tselected = signal(prev.includes(item))\n\t\t\tselected.counter = 0\n\t\t\tmap.set(item, selected)\n\t\t}\n\n\t\tselected.counter++\n\n\t\tcleanup(() => {\n\t\t\tif (--selected.counter === 0) {\n\t\t\t\tmap.delete(item)\n\t\t\t}\n\t\t})\n\n\t\treturn selected.read\n\t}\n}\n","export const now = () => Date.now()\n\nexport function date(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\to.getFullYear() +\n\t\t'-' +\n\t\t(o.getMonth() + 1 < 10 ? '0' : '') +\n\t\t(o.getMonth() + 1) +\n\t\t'-' +\n\t\t(o.getDate() < 10 ? '0' : '') +\n\t\to.getDate()\n\t)\n}\n\nexport function datetime(timestamp = now()) {\n\treturn date(timestamp) + ' ' + time(timestamp)\n}\n\nexport function time(timestamp = now()) {\n\treturn timeWithSeconds(timestamp).slice(0, -3)\n}\n\nexport function timeWithSeconds(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\t(o.getHours() < 10 ? '0' : '') +\n\t\to.getHours() +\n\t\t':' +\n\t\t(o.getMinutes() < 10 ? '0' : '') +\n\t\to.getMinutes() +\n\t\t':' +\n\t\t(o.getSeconds() < 10 ? '0' : '') +\n\t\to.getSeconds()\n\t)\n}\n\nexport function day(timestamp = now(), lang = 'en') {\n\tconst o = new Date(timestamp)\n\n\t// saturday, September 17, 2016\n\treturn o.toLocaleDateString(lang, {\n\t\tweekday: 'long',\n\t\tyear: 'numeric',\n\t\tmonth: 'long',\n\t\tday: 'numeric',\n\t})\n}\n\nexport function measure(name, cb) {\n\tconsole.time(name)\n\tconst r = cb()\n\tconsole.timeEnd(name)\n\treturn r\n}\n\nexport function timing(fn) {\n\tconst start = performance.now()\n\tfn()\n\treturn performance.now() - start\n}\n","import { makeCallback, map } from '../lib/reactive.js'\nimport {\n\tactiveElement,\n\tdocumentElement,\n\tisConnected,\n} from '../lib/std.js'\n\nimport { onFixes } from '../scheduler.js'\n\n/**\n * Renders reactive values from an signal that returns an Iterable\n * object\n *\n * @template T\n * @param {object} props\n * @param {Each
} props.each\n * @param {boolean} [props.restoreFocus] - If the focused element\n * moves it may lose focus\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/For\n */\n\nexport const For = props =>\n\tmap(\n\t\t() => {\n\t\t\tprops.restoreFocus && queue()\n\t\t\treturn props.each\n\t\t},\n\t\tmakeCallback(props.children),\n\t\ttrue,\n\t)\n\nlet queued\n\n// because re-ordering the elements trashes focus\nfunction queue() {\n\tif (!queued) {\n\t\tqueued = true\n\n\t\tconst active = activeElement()\n\t\tconst scroll = documentElement.scrollTop\n\n\t\tonFixes(() => {\n\t\t\tqueued = false\n\t\t\t// re-ordering the elements trashes focus\n\t\t\tactive &&\n\t\t\t\tactive !== activeElement() &&\n\t\t\t\tisConnected(active) &&\n\t\t\t\tactive.focus()\n\n\t\t\tdocumentElement.scrollTop = scroll\n\t\t})\n\t}\n}\n","import { batch, render, signal } from 'pota'\nimport { useSelector } from 'pota/plugin/useSelector'\nimport { timing } from 'pota/plugin/useTime'\nimport { For } from 'pota/web'\n\nlet idCounter = 1\nconst adjectives = [\n 'pretty',\n 'large',\n 'big',\n 'small',\n 'tall',\n 'short',\n 'long',\n 'handsome',\n 'plain',\n 'quaint',\n 'clean',\n 'elegant',\n 'easy',\n 'angry',\n 'crazy',\n 'helpful',\n 'mushy',\n 'odd',\n 'unsightly',\n 'adorable',\n 'important',\n 'inexpensive',\n 'cheap',\n 'expensive',\n 'fancy',\n ],\n colours = [\n 'red',\n 'yellow',\n 'blue',\n 'green',\n 'pink',\n 'brown',\n 'purple',\n 'brown',\n 'white',\n 'black',\n 'orange',\n ],\n nouns = [\n 'table',\n 'chair',\n 'house',\n 'bbq',\n 'desk',\n 'car',\n 'pony',\n 'cookie',\n 'sandwich',\n 'burger',\n 'pizza',\n 'mouse',\n 'keyboard',\n ]\n\nfunction _random(max) {\n return Math.round(Math.random() * 1000) % max\n}\n\nfunction buildData(count) {\n let data = new Array(count)\n for (let i = 0; i < count; i++) {\n const [label, setLabel, updateLabel] = signal(\n `elegant green keyboard ${idCounter++}`,\n /* `${adjectives[_random(adjectives.length)]} ${\n colours[_random(colours.length)]\n } ${nouns[_random(nouns.length)]} ${idCounter++}`,*/\n )\n data[i] = {\n id: idCounter,\n label,\n updateLabel,\n }\n }\n return data\n}\n\nconst Button = ({ id, text, fn }) => (\n \n \n {text}\n \n
\n)\n\nconst App = () => {\n const [data, setData, updateData] = signal([]),\n [selected, setSelected] = signal(null),\n run = () => setData(buildData(10)),\n runLots = () => {\n setData(buildData(10000))\n },\n bench = () => {\n // console.clear()\n // warm\n for (let k = 0; k < 5; k++) {\n setData(buildData(10000))\n setData([])\n }\n\n let createLarge = 0\n let clearLarge = 0\n let createSmall = 0\n let clearSmall = 0\n for (let k = 0; k < 10; k++) {\n createLarge += timing(() => setData(buildData(10000)))\n clearLarge += timing(() => setData([]))\n console.log(\n k + ' createLarge',\n createLarge / (k + 1),\n k + ' clearLarge',\n clearLarge / (k + 1),\n )\n }\n console.log('------------')\n for (let k = 0; k < 10; k++) {\n createSmall += timing(() => setData(buildData(1000)))\n clearSmall += timing(() => setData([]))\n console.log(\n k + ' createSmall',\n createSmall / (k + 1),\n k + ' clearSmall',\n clearSmall / (k + 1),\n )\n }\n },\n add = () => updateData(d => [...d, ...buildData(1000)]),\n update = () =>\n batch(() => {\n for (let i = 0, d = data(), len = d.length; i < len; i += 10)\n d[i].updateLabel(l => l + ' !!!')\n }),\n swapRows = () => {\n const d = data().slice()\n if (d.length > 998) {\n let tmp = d[1]\n d[1] = d[998]\n d[998] = tmp\n setData(d)\n }\n },\n clear = () => setData([]),\n remove = id =>\n updateData(d => {\n const idx = d.findIndex(datum => datum.id === id)\n d.splice(idx, 1)\n return [...d]\n }),\n isSelected = useSelector(selected)\n\n return (\n \n
\n
\n
\n
pota Keyed \n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n
{\n const element = e.target\n const { selectRow, removeRow } = element\n if (selectRow !== undefined) {\n setSelected(selectRow)\n } else if (removeRow !== undefined) {\n remove(removeRow)\n }\n }}\n >\n \n \n {row => {\n const { id, label } = row\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n )\n }}\n \n \n
\n
\n
\n )\n}\n\nrender(App, document.getElementById('main'))\n"],"names":["global","globalThis","window","CSSStyleSheet","document","DocumentFragment","Object","Symbol","queueMicrotask","assign","entries","freeze","groupBy","isArray","Array","toArray","from","iterator","stringify","JSON","resolved","promise","onDone","then","catch","isConnected","node","activeElement","documentElement","call","fns","fn","bind","createElement","createElementNS","createTextNode","importNode","createTreeWalker","empty","create","flat","arr","length","withState","state","cacheStore","withCache","cache","thing","get","walkElements","walk","currentNode","nodeType","nextNode","getDocumentForElement","getRootNode","ownerDocument","getValue","value","isFunction","isIterable","isObject","isNullUndefined","undefined","isString","noop","nothing","querySelector","query","removeFromArray","array","index","indexOf","splice","DataStore","constructor","kind","store","set","has","target","defaults","o","delete","Map","classListAdd","className","classList","add","classListRemove","remove","adoptedStyleSheetsGet","adoptedStyleSheets","adoptedStyleSheetsAdd","styleSheet","push","adoptedStyleSheetsRemove","sheet","css","replace","$isComponent","$isClass","$isReactive","$isMap","prefix","NS","__proto__","svg","math","html","xlink","CLEAN","STALE","CHECK","Owner","Listener","Updates","Effects","Time","Root","owner","owned","cleanups","context","options","dispose","i","Computation","updatedAt","sources","sourceSlots","update","time","prevOwner","prevListener","err","source","observers","observer","slot","pop","observerSlots","Effect","user","batch","SyncEffect","Signal","save","prev","read","markReactive","write","sourceSlot","equals","runUpdates","pure","downstream","a","b","root","signal","initialValue","effect","syncEffect","runWithOwner","untrack","cleanup","runTop","upstream","ancestors","updates","init","wait","res","runQueue","effects","runEffects","queue","userLength","ignore","Context","defaultValue","id","useContext","newValue","cb","args","isReactive","withValue","withPrevValue","val","map","list","callback","sort","duplicates","runId","rows","clear","Row","item","isDupe","disposer","nodes","begin","end","all","mapper","items","hasPrev","row","dupes","unsorted","every","includes","usort","before","nodesFromRow","after","current","previous","previousSibling","nextSibling","isComponent","isComponentable","makeCallback","children","callbacks","markComponent","child","r","addEventListener","type","handler","removeEventListener","ownedEvent","handleEvent","e","added","reset","priority","run","q","onFixes","onProps","onRef","onMount","ready","setEventNS","name","props","localName","ns","eventName","startsWith","toLowerCase","slice","plugins","pluginsNS","propsPlugin","propName","onMicrotask","plugin","propsPluginNS","NSName","propsPluginBoth","setAttributeNS","setAttribute","_setAttribute","removeAttributeNS","removeAttribute","setPropertyNS","setProperty","_setProperty","setUnknown","SVGElement","setBoolNS","setBool","_setBool","setStyle","setNodeStyle","style","setStyleNS","setVarNS","setStyleValue","cssText","_setStyleValue","removeProperty","setClass","setClassList","setClassNS","setElementClass","_setClassListValue","trim","split","randomId","crypto","getRandomValues","BigUint64Array","toString","setCSS","setNodeCSS","setRef","setOnMount","setUnmount","assignProps","assignProp","event","useXMLNS","Factory","createTag","createClass","createAnything","Node","createNode","createComponent","component","render","tagName","xmlns","withXMLNS","nsContext","cloneNode","content","template","innerHTML","childNodes","firstChild","append","createPartial","propsData","clone","x","assignPartialProps","m","createChildren","parent","relative","Text","nodeValue","insertNode","createPlaceholder","toDiff","HTMLElement","setValue","onResult","result","values","doc","propValue","text","head","getAttribute","rel","replaceWith","appendChild","insert","body","textContent","Infinity","toHTML","toHTMLFragment","fragment","ctx","Provider","next","useSelector","selected","isSelected","counter","timing","start","performance","now","For","restoreFocus","each","queued","active","scroll","scrollTop","focus","_For","_createComponent","idCounter","buildData","count","data","label","setLabel","updateLabel","Button","_div","onClick","_Button","App","setData","updateData","setSelected","runLots","bench","k","createLarge","clearLarge","createSmall","clearSmall","console","log","d","len","l","swapRows","tmp","idx","findIndex","datum","_div2","element","selectRow","removeRow","_tr","getElementById"],"mappings":";;;CAAO,MAAMA,MAAM,GAAGC,UAAU,CAAA;CACzB,MAAMC,MAAM,GAAGF,MAAM,CAAA;CAErB,MAAMG,aAAa,GAAGH,MAAM,CAACG,aAAa,CAAA;CAC1C,MAAMC,UAAQ,GAAGJ,MAAM,CAACI,QAAQ,CAAA;CAChC,MAAMC,gBAAgB,GAAGL,MAAM,CAACK,gBAAgB,CAAA;CAChD,MAAMC,QAAM,GAAGN,MAAM,CAACM,MAAM,CAAA;CAG5B,MAAMC,MAAM,GAAGP,MAAM,CAACO,MAAM,CAAA;CAC5B,MAAMC,cAAc,GAAGR,MAAM,CAACQ,cAAc,CAAA;CAE5C,MAAMC,MAAM,GAAGH,QAAM,CAACG,MAAM,CAAA;CAI5B,MAAMC,OAAO,GAAGJ,QAAM,CAACI,OAAO,CAAA;CAC9B,MAAMC,MAAM,GAAGL,QAAM,CAACK,MAAM,CAAA;CAS5B,MAAMC,OAAO,GAAGN,QAAM,CAACM,OAAO,CAAA;CAQ9B,MAAMC,OAAO,GAAGC,KAAK,CAACD,OAAO,CAAA;CAC7B,MAAME,OAAO,GAAGD,KAAK,CAACE,IAAI,CAAA;CAI1B,MAAMC,QAAQ,GAAGV,MAAM,CAACU,QAAQ,CAAA;CAEhC,MAAMC,SAAS,GAAGC,IAAI,CAACD,SAAS,CAAA;;CAkCvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACO,MAAME,QAAQ,GAAGA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A;CAAAjM,IAAAA,QAAA,EAGA4J,IAAA,CAAA;CAAKN,MAAAA,IAAI,EAAEW,IAAK;OAAAjK,QAAA,EACbhB,GAAG,IAAI;SACN,MAAM;WAAE5B,EAAE;CAAE8M,UAAAA,KAAAA;CAAM,SAAC,GAAGlL,GAAG,CAAA;CAEzB,QAAA,OACEkN,GAAA,CAAA,CAAA;WAAI,cAAcpD,EAAAA,UAAU,CAAC1L,EAAE,CAAA;CAAE,SAAA,EAAA;CAG7BgL,UAAAA,WAAW,EAAEhL,EAAAA;CAAG,SAAA,EAAA;CAIdgL,UAAAA,WAAW,EAAE8B,KAAM;WACnB,gBAAgB9M,EAAAA,EAAAA;CAAG,SAAA,EAAA;WAQjB,gBAAgBA,EAAAA,EAAAA;CAAG,SAAA,CAKvB,CAAC,CAAA;CAET,OAAA;MACG,CAAA;CAAC,GAAA,CAOP,CAAC,CAAA;CAEV,CAAC,CAAA;CAEDuI,MAAM,CAAC8E,GAAG,EAAExY,QAAQ,CAACka,cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"main.js","sources":["../../../../../pota/src/lib/std.js","../../../../../pota/src/constants.js","../../../../../pota/src/lib/reactive.js","../../../../../pota/src/scheduler.js","../../../../../pota/src/props/event.js","../../../../../pota/src/props/plugin.js","../../../../../pota/src/props/attribute.js","../../../../../pota/src/props/property.js","../../../../../pota/src/props/unknown.js","../../../../../pota/src/props/bool.js","../../../../../pota/src/props/style.js","../../../../../pota/src/props/class.js","../../../../../pota/src/props/value.js","../../../../../pota/src/plugin/useRandom.js","../../../../../pota/src/props/css.js","../../../../../pota/src/props/lifecycle.js","../../../../../pota/src/props/@main.js","../../../../../pota/src/renderer.js","../../../../../pota/src/plugin/useSelector.js","../../../../../pota/src/plugin/useTime.js","../../../../../pota/src/web/For.js","index.jsx"],"sourcesContent":["export const global = globalThis\nexport const window = global\n\nexport const CSSStyleSheet = global.CSSStyleSheet\nexport const document = global.document\nexport const DocumentFragment = global.DocumentFragment\nexport const Object = global.Object\nexport const Promise = global.Promise\nexport const requestAnimationFrame = global.requestAnimationFrame\nexport const Symbol = global.Symbol\nexport const queueMicrotask = global.queueMicrotask\n\nexport const assign = Object.assign\nexport const create = Object.create\nexport const defineProperties = Object.defineProperties\nexport const defineProperty = Object.defineProperty\nexport const entries = Object.entries\nexport const freeze = Object.freeze\nexport const fromEntries = Object.fromEntries\nexport const getOwnPropertyDescriptor =\n\tObject.getOwnPropertyDescriptor\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors\nexport const getOwnPropertyNames = Object.getOwnPropertyNames\nexport const getOwnPropertySymbols = Object.getOwnPropertySymbols\nexport const getPrototypeOf = Object.getPrototypeOf\nexport const groupBy = Object.groupBy\nexport const hasOwnProperty = Object.hasOwn\nexport const is = Object.is\nexport const isExtensible = Object.isExtensible\nexport const keys = Object.keys\nexport const values = Object.values\nexport const setPrototypeOf = Object.setPrototypeOf\n\nexport const isArray = Array.isArray\nexport const toArray = Array.from\n\nexport const isNaN = Number.isNaN\n\nexport const iterator = Symbol.iterator\n\nexport const stringify = JSON.stringify\nexport const stringifyReadable = o => stringify(o, null, 2)\n\nexport const stringifySorted = o => {\n\tfunction sort(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\t\tconst tmp = isArray(o) ? [] : {}\n\t\tkeys(o)\n\t\t\t.sort()\n\t\t\t.map(k => (tmp[k] = sort(o[k])))\n\n\t\tif (isArray(tmp)) {\n\t\t\ttmp.sort((a, b) => stringify(a).localeCompare(stringify(b)))\n\t\t}\n\t\treturn tmp\n\t}\n\treturn stringifyReadable(sort(o))\n}\n\nexport const PrototypeArray = Array.prototype\nexport const PrototypeMap = Map.prototype\n\nexport const history = global.history\nexport const location = global.location\nexport const navigator = global.navigator\n\nexport const origin = location.origin\n\nexport const promise = fn => new Promise(fn)\n\nexport const withResolvers = () => Promise.withResolvers()\n\n/**\n * Given a promise it adds `onDone` to `then` and `catch`\n *\n * ```js\n * resolved(promise, onDone)\n * // is same as\n * promise.then(onDone).catch(onDone)\n * ```\n */\nexport const resolved = (promise, onDone) =>\n\tpromise.then(onDone).catch(onDone)\n\nexport const setAttribute = (node, name, value) =>\n\tnode.setAttribute(name, value)\n\nexport const hasAttribute = (node, name) => node.hasAttribute(name)\n\nexport const removeAttribute = (node, name) =>\n\tnode.removeAttribute(name)\n\nexport const setAttributeNS = (node, name, value) =>\n\tnode.setAttributeNS(name, value)\n\nexport const hasAttributeNS = (node, name) =>\n\tnode.hasAttributeNS(name)\n\nexport const removeAttributeNS = (node, name) =>\n\tnode.removeAttributeNS(name)\n\nexport const isConnected = node => node.isConnected\n\nexport const activeElement = () => document.activeElement\n\nexport const documentElement = document.documentElement\n\n/**\n * Runs an array of functions\n *\n * @param {Iterable} fns\n */\nexport const call = fns => {\n\tfor (const fn of fns) fn()\n}\n\nexport function copy(o) {\n\tconst seen = new Map()\n\tfunction copy(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (\n\t\t\to instanceof Node ||\n\t\t\to instanceof Date ||\n\t\t\to instanceof Set ||\n\t\t\to instanceof Map ||\n\t\t\to instanceof WeakSet ||\n\t\t\to instanceof WeakMap ||\n\t\t\to instanceof Promise ||\n\t\t\to instanceof RegExp\n\t\t) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (seen.has(o)) {\n\t\t\treturn seen.get(o)\n\t\t}\n\n\t\tconst c = isArray(o) ? [] : {}\n\n\t\tseen.set(o, c)\n\n\t\tfor (const k in o) {\n\t\t\tc[k] = copy(o[k])\n\t\t}\n\t\treturn c\n\t}\n\treturn copy(o)\n}\n\n/**\n * Object.defineProperty with `enumerable` and `configurable` set to\n * `true` unless overwriten by `descriptor` argument\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n */\nexport const redefineProperty = (target, key, descriptor) =>\n\tdefineProperty(target, key, assign(create(defaults), descriptor))\n\nconst defaults = {\n\t__proto__: null,\n\tconfigurable: true,\n\tenumerable: true,\n}\n\n/**\n * Object.defineProperty with `configurable`, `writable` and\n * `enumerable` as `false`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {any} value\n */\nexport const definePropertyReadOnly = (target, key, value) => {\n\tconst descriptor = create(defaultsReadOnly)\n\tdescriptor.value = value\n\tdefineProperty(target, key, descriptor)\n}\n\nconst defaultsReadOnly = {\n\t__proto__: null,\n\tconfigurable: false,\n\tenumerable: false,\n\twritable: false,\n\tvalue: undefined,\n}\n\nconst bind = fn => document[fn].bind(document)\n\nexport const createElement = bind('createElement')\n\nexport const createElementNS = bind('createElementNS')\n\nexport const createTextNode = bind('createTextNode')\n\nexport const importNode = bind('importNode')\n\nexport const createTreeWalker = bind('createTreeWalker')\n\n/**\n * Returns an object without a prototype\n *\n * @type {Function}\n * @returns {Props} Empty object\n */\nexport const empty = Object.create.bind(null, null)\n\nexport function* entriesIncludingSymbols(target) {\n\tfor (const item of entries(target)) {\n\t\tyield item\n\t}\n\n\tfor (const item of getOwnPropertySymbols(target)) {\n\t\t// todo: causes access!\n\t\tyield [item, target[item]]\n\t}\n}\n\n// modified version of https://github.com/epoberezkin/fast-deep-equal\n\nexport function equals(a, b) {\n\tif (a === b) {\n\t\treturn true\n\t}\n\n\tif (a && b && typeof a == 'object' && typeof b == 'object') {\n\t\tif (a.constructor !== b.constructor) {\n\t\t\treturn false\n\t\t}\n\n\t\tlet length, i, k\n\t\tif (isArray(a)) {\n\t\t\tlength = a.length\n\t\t\tif (length != b.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor (i = length; i-- !== 0; ) {\n\t\t\t\tif (!equals(a[i], b[i])) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif (a.constructor === RegExp)\n\t\t\treturn a.source === b.source && a.flags === b.flags\n\t\tif (a.valueOf !== Object.prototype.valueOf)\n\t\t\treturn a.valueOf() === b.valueOf()\n\t\tif (a.toString !== Object.prototype.toString)\n\t\t\treturn a.toString() === b.toString()\n\n\t\tk = keys(a)\n\t\tlength = k.length\n\t\tif (length !== keys(b).length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(b, k[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tvar key = k[i]\n\n\t\t\tif (!equals(a[key], b[key])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// true if both NaN, false otherwise\n\treturn a !== a && b !== b\n}\n\n/**\n * Flats an array/childNodes to the first children if the length is 1\n *\n * @param {any[] | NodeListOf} arr\n * @returns {any}\n */\nexport const flat = arr => (arr.length === 1 ? arr[0] : arr)\n\n/**\n * Keeps state in the function as the first param\n *\n * @template T\n * @param {T} fn - Function to which add state to it\n * @param {DataStore | DataStore} [state] - Passed to\n * `fn` as first param\n * @returns {T} A copy of the function with the state\n */\nexport const withState = /* #__NO_SIDE_EFFECTS__ */ (\n\tfn,\n\tstate = cacheStore,\n) => fn.bind(null, state())\n\n/** Memoize functions with a map cache */\nexport const withCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tcacheStore,\n\t)\n/** Memoize functions with a weak cache */\nexport const withWeakCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tweakStore,\n\t)\n\nexport const walkElements = withState(\n\t(walk, node, fn) => {\n\t\twalk.currentNode = node\n\n\t\t/**\n\t\t * The first node is not walked by the walker.\n\t\t *\n\t\t * Also the first node could be a DocumentFragment\n\t\t */\n\t\tif (node.nodeType === 1) {\n\t\t\tif (fn(node)) return\n\t\t}\n\n\t\twhile ((node = walk.nextNode())) {\n\t\t\tif (fn(node)) break\n\t\t}\n\t},\n\t() => createTreeWalker(document, 1 /*NodeFilter.SHOW_ELEMENT*/),\n)\n\n/**\n * Returns `document` for element. That could be a `shadowRoot`\n *\n * @param {Element} node\n * @returns {Document | ShadowRoot}\n */\n\nexport const getDocumentForElement = node => {\n\tconst document = node.getRootNode()\n\tconst { nodeType } = document\n\t// getRootNode returns:\n\t// 1. Node for isConnected = false\n\t// 2. Document for isConnected = true\n\t// 3. shadowRoot for custom elements\n\n\t// always return a Document-like\n\treturn nodeType === 11 || nodeType === 9\n\t\t? document\n\t\t: node.ownerDocument\n}\n\nexport const getOwnValues = o =>\n\tgetOwnPropertyNames(o).map(key => {\n\t\ttry {\n\t\t\treturn o[key]\n\t\t} catch (e) {}\n\t})\n\nexport function getSetterNamesFromPrototype(object, set = new Set()) {\n\tconst descriptors = getOwnPropertyDescriptors(object)\n\n\tfor (const key in descriptors) {\n\t\tif (descriptors[key].set) {\n\t\t\tset.add(key)\n\t\t}\n\t}\n\n\treturn set\n}\n\n/**\n * Unwraps values. If the argument is a function then it runs it\n * recursively and returns the value\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValue(value) {\n\twhile (typeof value === 'function') value = value()\n\treturn value\n}\n\n/**\n * Unwraps `value` and returns `element` if result is a `Node`, else\n * `undefined` in the case isn't a `Node`\n *\n * @param {Function | any} value - Maybe function\n * @param {...any} args? - Arguments\n * @returns {Node | undefined}\n */\nexport function getValueElement(value, ...args) {\n\tconst element = getValueWithArguments(value, ...args)\n\treturn element instanceof Node ? element : undefined\n}\n\nexport const getValueWithArguments = (value, ...args) =>\n\ttypeof value === 'function'\n\t\t? args.length\n\t\t\t? getValue(value(...args))\n\t\t\t: getValue(value())\n\t\t: value\n\n/**\n * Identity function, given `x` returns `x`\n *\n * @template T\n * @param {T} x\n * @returns {T}\n */\nexport const identity = x => x\n\n/**\n * When `value` is an object, it will check if the `key` on `target`\n * is `configurable`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {boolean | undefined} value\n */\nexport const isConfigurable = (target, key, value) => {\n\tif (isObject(value)) {\n\t\tconst descriptor = getOwnPropertyDescriptor(target, key)\n\t\tif (descriptor) {\n\t\t\treturn descriptor.configurable\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Returns `true` when `typeof` of `value` is `function`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isFunction = value => typeof value === 'function'\n\n/**\n * Returns `true` when value is Iterable\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isIterable = value =>\n\tisObject(value) && 'values' in value\n\n/**\n * Returns `true` if the value is `null` or `undefined`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNullUndefined = value =>\n\tvalue === undefined || value === null\n\n/**\n * Returns `true` when typeof of value is object and not null\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isObject = value =>\n\tvalue !== null && typeof value === 'object'\n\n/**\n * Returns `true` when object morphed between array/object\n *\n * @param {any} a\n * @param {any} b\n * @returns {boolean}\n */\nexport const morphedBetweenArrayAndObject = (a, b) =>\n\t(isObject(a) && !isObject(b)) ||\n\t(isObject(b) && !isObject(a)) ||\n\t(isArray(a) && !isArray(b)) ||\n\t(isArray(b) && !isArray(a))\n\n/**\n * Returns `true` if the property is defined in the `prototype` and\n * absent in the `object`\n *\n * @param {object} target\n * @param {PropertyKey} key\n */\nexport const isPrototypeProperty = (target, key) =>\n\t// must do `key in target` to check that it DOES have it somewhere\n\t// must do !hasOwnProperty to check that isnt an own property\n\tkey in target && !hasOwnProperty(target, key)\n\n/**\n * Returns `true` when `typeof` of `value` is `string`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isString = value => typeof value === 'string'\n\n/**\n * Returns `true` when `typeof` of `value` is `number`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNumber = value => typeof value === 'number'\n\n/**\n * Returns `true` when `typeof` of `value` is `symbol`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isSymbol = value => typeof value === 'symbol'\n\n/**\n * Returns `true` when `typeof` of `value` is `boolean`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isBoolean = value => typeof value === 'boolean'\n\n/**\n * Returns `true` when `value` may be a promise\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isPromise = value => isObject(value) && 'then' in value\n\nexport const noop = () => {}\n\n/**\n * An empty frozen object\n *\n * @type object\n */\nexport const nothing = freeze(empty())\n\n// an optional value is `true` by default, so most of the time is undefined which means is `true`\n// to avoid having conditions like `if(something.bla === undefined || something.bla)`\n// this function will short it to `if(optional(something.bla))`\n// additionally the value is resolved, for cases like `when={() => show() && optional(props.when)}`\n\n/**\n * Returns `true` when value is true or undefined\n *\n * @param {Function | boolean | undefined} value\n * @returns {boolean} True when value is true or undefined\n */\nexport const optional = value =>\n\tvalue === undefined || getValue(value)\n\nexport const partAdd = (node, className) => node.part.add(className)\n\nexport const partRemove = (node, className) =>\n\tnode.part.remove(className)\n\nexport const querySelector = (node, query) =>\n\tnode.querySelector(query)\n\nexport const querySelectorAll = (node, query) =>\n\tnode.querySelectorAll(query)\n\nexport function* range(start, stop, step = 1) {\n\tyield start\n\twhile (start < stop) {\n\t\tyield (start += step)\n\t}\n}\n\nexport const {\n\townKeys: reflectOwnKeys,\n\thas: reflectHas,\n\tdeleteProperty: reflectDeleteProperty,\n\tgetOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor,\n\tget: reflectGet,\n\tapply: reflectApply,\n\tset: reflectSet,\n} = Reflect\n\n/**\n * Removes a value from an array\n *\n * @template T\n * @param {T[]} array\n * @param {T} value To remove from the array\n * @returns {T[]}\n */\nexport function removeFromArray(array, value) {\n\tconst index = array.indexOf(value)\n\tif (index !== -1) array.splice(index, 1)\n\treturn array\n}\n/**\n * Removes values from an array based on a condition\n *\n * @template T\n * @param {T[]} array\n * @param {(value: T, index: number) => boolean} cb Function with\n * condition\n */\nexport function removeFromArrayConditionally(array, cb) {\n\tlet i = array.length\n\twhile (i--) {\n\t\tif (cb(array[i], i)) {\n\t\t\tarray.splice(i, 1)\n\t\t}\n\t}\n}\n/**\n * Removes values from an array based on a condition\n *\n * @param {Iterable} iterable\n * @param {PropertyKey} key Function with condition\n */\nexport function indexByKey(iterable, key) {\n\tconst byKey = empty()\n\tfor (const item of iterable) {\n\t\tbyKey[item[key]] = item\n\t}\n\treturn byKey\n}\n\n/**\n * Replace a prototype in the prototype chain with another prototype\n *\n * @param {object} target - Target object\n * @param {object} search - The prototype to replace\n * @param {object} replacement - The replacement prototype\n */\nexport function replacePrototypeWith(target, search, replacement) {\n\tlet prototype = target\n\twhile (getPrototypeOf(prototype) !== search) {\n\t\tprototype = getPrototypeOf(prototype)\n\t}\n\n\tsetPrototypeOf(prototype, replacement)\n}\n\nexport const typeString = obj =>\n\tObject.prototype.toString.call(obj).slice(8, -1)\n\nexport function walkParents(context, propertyName, cb) {\n\twhile (context) {\n\t\tif (cb(context)) return true\n\t\tcontext = context[propertyName]\n\t}\n}\n\n/**\n * Store template\n *\n * @typedef {(\n * \treference: any,\n * \tcreateIfNotExistsAs?: ((target: any) => any) | Function,\n * ) => any} DataStoreGet\n *\n *\n * @typedef {(key: any, value: any) => void} DataStoreSet\n *\n * @typedef {(key: any) => boolean} DataStoreHas\n *\n * @typedef {(key: any) => boolean} DataStoreDelete\n */\n\nclass DataStore {\n\tconstructor(kind) {\n\t\tconst store = new kind()\n\n\t\tconst get = k => store.get(k)\n\t\tconst set = (k, v) => store.set(k, v)\n\t\tconst has = k => store.has(k)\n\n\t\tthis.get = (target, defaults = undefined) => {\n\t\t\tconst o = get(target)\n\n\t\t\tif (o !== undefined) {\n\t\t\t\treturn o\n\t\t\t}\n\n\t\t\tif (defaults !== undefined) {\n\t\t\t\t/**\n\t\t\t\t * Default values should be passed as a function, so we dont\n\t\t\t\t * constantly initialize values when giving them\n\t\t\t\t */\n\t\t\t\tdefaults = defaults(target)\n\t\t\t\tset(target, defaults)\n\t\t\t\treturn defaults\n\t\t\t}\n\t\t}\n\n\t\tthis.set = set\n\t\tthis.has = has\n\t\tthis.delete = k => store.delete(k)\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.get\n\t\tyield this.set\n\t\tyield this.has\n\t\tyield this.delete\n\t}\n}\n\n/**\n * Creates a WeakMap to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdelete: DataStoreDelete\n * }}\n */\nexport const weakStore = () => new DataStore(WeakMap)\n\n/**\n * Creates a Map to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdel: DataStoreDelete\n * }}\n */\nexport const cacheStore = () => new DataStore(Map)\n\nexport const classListAdd = (node, className) =>\n\tnode.classList.add(className)\n\nexport const classListRemove = (node, className) =>\n\tnode.classList.remove(className)\n\n/**\n * - Returns `adoptedStyleSheets` for a document\n *\n * @param {Document | ShadowRoot} document\n */\nexport const adoptedStyleSheetsGet = document =>\n\tdocument.adoptedStyleSheets\n\nexport const adoptedStyleSheets =\n\t/* #__PURE__*/ adoptedStyleSheetsGet(document)\n\n/**\n * Adds a style sheet to the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsAdd = (document, styleSheet) =>\n\tadoptedStyleSheetsGet(document).push(styleSheet)\n\n/**\n * Removes a style sheet from the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsRemove = (document, styleSheet) =>\n\tremoveFromArray(adoptedStyleSheetsGet(document), styleSheet)\n\n/**\n * Adds a style sheet to the custom element\n *\n * @param {Document | ShadowRoot} document\n * @param {(CSSStyleSheet | string)[]} styleSheets\n */\nexport function addStyleSheets(document, styleSheets = []) {\n\tfor (const sheet of styleSheets) {\n\t\tif (sheet) {\n\t\t\tsheet instanceof CSSStyleSheet\n\t\t\t\t? adoptedStyleSheetsAdd(document, sheet)\n\t\t\t\t: addStyleSheetExternal(document, sheet)\n\t\t}\n\t}\n}\n\n/**\n * Adds the stylesheet from urls. It uses a cache, to avoid having to\n * fire a request for each external sheet when used in more than one\n * custom element. Also, all reference the same object.\n *\n * @param {Document | ShadowRoot} document\n * @param {string} text\n */\nexport const addStyleSheetExternal = withState(\n\t(state, document, text) => {\n\t\tstate\n\t\t\t.get(text, text =>\n\t\t\t\ttext.startsWith('http')\n\t\t\t\t\t? fetch(text)\n\t\t\t\t\t\t\t.then(r => r.text())\n\t\t\t\t\t\t\t.then(css => sheet(css))\n\t\t\t\t\t: promise(resolve => resolve(sheet(text))),\n\t\t\t)\n\t\t\t.then(styleSheet => adoptedStyleSheetsAdd(document, styleSheet))\n\t},\n)\n\n/**\n * Swaps classNames and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldClass - `class` with the old animation\n * @param {string} newClass - `class` with the new animation\n */\nexport const animateClassTo = (element, oldClass, newClass) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tclassListRemove(element, oldClass)\n\t\t\tclassListAdd(element, newClass)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Swaps parts and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldPart - `part` with the old animation\n * @param {string} newPart - `part` with the new animation\n */\nexport const animatePartTo = (element, oldPart, newPart) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tpartRemove(element, oldPart)\n\t\t\tpartAdd(element, newPart)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Creates tagged css and returns a CSSStyleSheet. Mostly for css\n * highlighting in js\n *\n * @param {TemplateStringsArray} template\n * @param {...any} values\n * @returns {CSSStyleSheet}\n */\nexport const css = (template, ...values) =>\n\tsheet(String.raw({ raw: template }, ...values))\n\n/**\n * Creates a stylesheet from a css string\n *\n * @param {string} css\n * @returns {CSSStyleSheet}\n */\nexport const sheet = withCache(css => {\n\tconst sheet = new CSSStyleSheet()\n\t/**\n\t * Replace is asynchronous and can accept @import statements\n\t * referencing external resources.\n\t */\n\tsheet.replace(css)\n\n\treturn sheet\n})\n\n/**\n * @param {Element} node\n * @param {string} eventName\n * @param {any} [data]\n */\n\nexport const emit = (\n\tnode,\n\teventName,\n\tdata = { bubbles: true, cancelable: true, composed: true },\n) => node.dispatchEvent(new CustomEvent(eventName, data))\n\nexport function stopEvent(e) {\n\tpreventDefault(e)\n\tstopPropagation(e)\n\tstopImmediatePropagation(e)\n}\n\nexport const preventDefault = e => e.preventDefault()\nexport const stopPropagation = e => e.stopPropagation()\nexport const stopImmediatePropagation = e =>\n\te.stopImmediatePropagation()\n\n/**\n * Waits for an event to be dispatched and runs a callback\n *\n * @param {Element} element\n * @param {string} eventName\n */\nexport const waitEvent = withState(\n\t(state, element, eventName) =>\n\t\tpromise((resolve, reject) => {\n\t\t\t/**\n\t\t\t * To prevent firing `transitionend` twice it needs to stop\n\t\t\t * listening the old one because maybe wasn't dispatched and\n\t\t\t * running a new transition will make it dispatch twice\n\t\t\t */\n\t\t\tconst previous = state.get(element, empty)\n\t\t\tprevious.reject && previous.reject()\n\t\t\telement.removeEventListener(eventName, previous.resolve)\n\t\t\tstate.set(element, { resolve, reject })\n\t\t\telement.addEventListener(eventName, resolve, {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t}),\n\tweakStore,\n)\n\nexport const addEventListenerObject = (where, type, handler) =>\n\twhere.addEventListener(type, handler, handler)\n\nexport const removeEventListenerObject = (where, type, handler) =>\n\twhere.removeEventListener(type, handler, handler)\n\n/** @param {EventListener} fn */\nexport const passiveEvent = fn => ({ handleEvent: fn, passive: true })\n","// symbols\n\nimport { Symbol } from './lib/std.js'\n\nexport const $isComponent = Symbol()\nexport const $isClass = Symbol()\nexport const $isReactive = Symbol()\nexport const $isMap = Symbol()\n\n// supported namespaces\n\nconst prefix = 'http://www.w3.org/'\n\n// when a tag/attribute is missing the namespace this puts it back in\n\nexport const NS = {\n\t__proto__: null,\n\tsvg: prefix + '2000/svg',\n\tmath: prefix + '1998/Math/MathML',\n\thtml: prefix + '1999/xhtml',\n\txlink: prefix + '1999/xlink',\n}\n","/**\n * This is so far the core of Solid JS Reactivity, this may change.\n *\n * Adaptation for potas needs have been made:\n *\n * - Ported to Classes what does fit\n * - Signal has more options: `label` and `save` previous value\n * - Writing to a signal returns `true` when the value changes\n * - Signal is an object that could be used as signal.read/write or\n * destructured as an array.\n * - Signals can save and wont run functions\n * - `update` function on Signal that could be used to use the old value\n */\n\nimport {\n\t$isClass,\n\t$isComponent,\n\t$isMap,\n\t$isReactive,\n} from '../constants.js'\n\nimport {\n\tassign,\n\tentries,\n\tflat,\n\tgetValue,\n\tgroupBy,\n\tisArray,\n\tisFunction,\n\tisIterable,\n\tisObject,\n\tisPromise,\n\tkeys,\n\tnothing,\n\tqueueMicrotask,\n\tremoveFromArray,\n\tresolved,\n\tSymbol,\n\tweakStore,\n\twithResolvers,\n\twithState,\n\twithWeakCache,\n} from './std.js'\n\nconst CLEAN = 0\nconst STALE = 1\nconst CHECK = 2\n\nlet Owner\nlet Listener\n\nlet Updates = null\nlet Effects = null\n\nlet Time = 0\n\n// ROOT\n\nclass Root {\n\towner\n\towned\n\n\tcleanups\n\n\tcontext\n\n\tconstructor(owner, options) {\n\t\tthis.owner = owner\n\t\tthis.context = owner?.context\n\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t}\n\t}\n\n\tdispose() {\n\t\tlet i\n\n\t\tconst { owned, cleanups } = this\n\n\t\tif (owned) {\n\t\t\tfor (i = owned.length - 1; i >= 0; i--) {\n\t\t\t\towned[i].dispose()\n\t\t\t}\n\t\t\towned.length = 0\n\t\t}\n\t\tif (cleanups) {\n\t\t\tfor (i = cleanups.length - 1; i >= 0; i--) {\n\t\t\t\tcleanups[i]()\n\t\t\t}\n\t\t\tcleanups.length = 0\n\t\t}\n\t}\n}\n\n// COMPUTATION\n\nclass Computation extends Root {\n\tstate = STALE\n\n\tupdatedAt = 0\n\n\tfn\n\n\tsources\n\tsourceSlots\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, options)\n\n\t\tthis.fn = fn\n\n\t\tif (owner) {\n\t\t\tif (owner.owned) {\n\t\t\t\towner.owned.push(this)\n\t\t\t} else {\n\t\t\t\towner.owned = [this]\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tthis.fn()\n\t\t} catch (err) {\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\n\t\tif (this.updatedAt <= time) {\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n\n\tdispose() {\n\t\tconst { sources, sourceSlots } = this\n\n\t\tif (sources) {\n\t\t\tlet source\n\t\t\tlet observers\n\t\t\tlet index\n\n\t\t\tlet observer\n\t\t\tlet slot\n\t\t\twhile (sources.length) {\n\t\t\t\tsource = sources.pop()\n\t\t\t\tobservers = source.observers\n\n\t\t\t\tindex = sourceSlots.pop()\n\n\t\t\t\tif (observers && observers.length) {\n\t\t\t\t\tobserver = observers.pop()\n\t\t\t\t\tslot = source.observerSlots.pop()\n\n\t\t\t\t\tif (index < observers.length) {\n\t\t\t\t\t\tobserver.sourceSlots[slot] = index\n\t\t\t\t\t\tobservers[index] = observer\n\t\t\t\t\t\tsource.observerSlots[index] = slot\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.dispose()\n\n\t\tthis.state = CLEAN\n\t}\n}\n\nclass Effect extends Computation {\n\tuser = true\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tEffects ? Effects.push(this) : batch(() => this.update())\n\t}\n}\n\nclass SyncEffect extends Computation {\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tbatch(() => this.update())\n\t}\n}\n\n// SIGNALS\n\nclass Memo extends Computation {\n\tstate = STALE\n\n\tpure = true\n\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\treturn markReactive(this.read.bind(this))\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (this.state) {\n\t\t\tif (this.state === STALE) {\n\t\t\t\tthis.update()\n\t\t\t} else {\n\t\t\t\tconst updates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(this))\n\t\t\t\tUpdates = updates\n\t\t\t}\n\t\t}\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tlet nextValue\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tnextValue = this.fn()\n\t\t} catch (err) {\n\t\t\tthis.state = STALE\n\t\t\tif (this.owned) {\n\t\t\t\tthis.owned.forEach(node => node.dispose())\n\t\t\t\tthis.owned.length = 0\n\t\t\t}\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\t\tif (this.updatedAt <= time) {\n\t\t\tif (this.updatedAt !== 0) {\n\t\t\t\tthis.write(nextValue)\n\t\t\t} else {\n\t\t\t\tthis.value = nextValue\n\t\t\t}\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n}\n\n// SIGNAL\n\nclass Signal {\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\t// save\n\n\t// `prev` if option save was given\n\n\tconstructor(value, options) {\n\t\tthis.value = value\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = value\n\t\t\t}\n\t\t}\n\n\t\tthis.read = markReactive(this.read)\n\t}\n\n\tread = () => {\n\t\t// checkReadForbidden()\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite = value => {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = this.value\n\t\t\t}\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tupdate = value => {\n\t\tif (isFunction(value)) {\n\t\t\tvalue = value(this.value)\n\t\t}\n\t\treturn this.write(value)\n\t}\n\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.read\n\t\tyield this.write\n\t\tyield this.update\n\t}\n}\n\n// API\n\n/**\n * Creates a new root\n *\n * @param {(dispose: Function) => any} fn\n * @param {object} [options]\n * @returns {any}\n */\nexport function root(fn, options = undefined) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tconst root = new Root(Owner, options)\n\n\tOwner = root\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(() => fn(() => root.dispose()), true)\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Creates a signal\n *\n * @template const T\n * @param {T} [initialValue] - Initial value of the signal\n * @param {SignalOptions} [options] - Signal options\n * @returns {SignalObject}\n */\n/* #__NO_SIDE_EFFECTS__ */\nexport function signal(initialValue, options = undefined) {\n\treturn new Signal(initialValue, options)\n}\n\n/**\n * Creates an effect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function effect(fn, options = undefined) {\n\tnew Effect(Owner, fn, options)\n}\n\n/**\n * Creates an effect with explicit dependencies\n *\n * @param {Function} depend - Function that causes tracking\n * @param {Function} fn - Function that wont cause tracking\n * @param {object} [options]\n */\nexport function on(depend, fn, options = undefined) {\n\teffect(() => {\n\t\tdepend()\n\t\tuntrack(fn)\n\t}, options)\n}\n\n/**\n * Creates a syncEffect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function syncEffect(fn, options = undefined) {\n\treturn new SyncEffect(Owner, fn, options)\n}\n\n/**\n * Creates a read-only signal from the return value of a function that\n * automatically updates\n *\n * @template T\n * @param {() => T} fn - Function to re-run when dependencies change\n * @param {SignalOptions} [options]\n * @returns {SignalAccessor} - Read only signal\n */\n\n/* #__NO_SIDE_EFFECTS__ */ export function memo(\n\tfn,\n\toptions = undefined,\n) {\n\treturn new Memo(Owner, fn, options)\n}\n\n/**\n * Batches changes to signals\n *\n * @param {Function} fn\n * @returns {any}\n */\nexport const batch = runUpdates\n\n/**\n * Returns current owner\n *\n * @returns {typeof Owner}\n */\nexport function owner() {\n\treturn Owner\n}\n\nfunction runWithOwner(owner, fn) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tOwner = owner\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(fn, true)\n\t} catch (err) {\n\t\tthrow err\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Disables tracking for a function\n *\n * @param {Function} fn - Function to run with tracking disabled\n * @returns {any}\n */\nexport function untrack(fn) {\n\tif (Listener === undefined) {\n\t\treturn fn()\n\t}\n\n\tconst prevListener = Listener\n\tListener = undefined\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Runs a callback on cleanup, returns callback\n *\n * @template T\n * @param {T} fn\n * @returns {T}\n */\nexport function cleanup(fn) {\n\tif (Owner) {\n\t\tif (Owner.cleanups) {\n\t\t\tOwner.cleanups.push(fn)\n\t\t} else {\n\t\t\tOwner.cleanups = [fn]\n\t\t}\n\t}\n\treturn fn\n}\n\n// UPDATES\n\nfunction runTop(node) {\n\tswitch (node.state) {\n\t\tcase CLEAN: {\n\t\t\treturn\n\t\t}\n\t\tcase CHECK: {\n\t\t\treturn upstream(node)\n\t\t}\n\t}\n\n\tconst ancestors = []\n\n\tdo {\n\t\tif (node.state) {\n\t\t\tancestors.push(node)\n\t\t}\n\t\tnode = node.owner\n\t} while (node && node.updatedAt < Time)\n\n\tfor (let i = ancestors.length - 1, updates; i >= 0; i--) {\n\t\tnode = ancestors[i]\n\n\t\tswitch (node.state) {\n\t\t\tcase STALE: {\n\t\t\t\tnode.update()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase CHECK: {\n\t\t\t\tupdates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(node, ancestors[0]))\n\t\t\t\tUpdates = updates\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction runUpdates(fn, init = false) {\n\tif (Updates) {\n\t\treturn fn()\n\t}\n\n\tlet wait = false\n\n\tif (!init) {\n\t\tUpdates = []\n\t}\n\n\tif (Effects) {\n\t\twait = true\n\t} else {\n\t\tEffects = []\n\t}\n\n\tTime++\n\n\ttry {\n\t\tconst res = fn()\n\n\t\tif (Updates) {\n\t\t\trunQueue(Updates)\n\t\t\tUpdates = null\n\t\t}\n\t\tif (!wait) {\n\t\t\tconst effects = Effects\n\t\t\tEffects = null\n\t\t\tif (effects.length) {\n\t\t\t\trunUpdates(() => runEffects(effects))\n\t\t\t}\n\t\t}\n\n\t\treturn res\n\t} catch (err) {\n\t\tif (!wait) {\n\t\t\tEffects = null\n\t\t}\n\t\tUpdates = null\n\n\t\tthrow err\n\t}\n}\n\nfunction runQueue(queue) {\n\tfor (let i = 0; i < queue.length; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction runEffects(queue) {\n\tlet i\n\n\tlet effect\n\tlet userLength = 0\n\tfor (i = 0; i < queue.length; i++) {\n\t\teffect = queue[i]\n\n\t\tif (!effect.user) {\n\t\t\trunTop(effect)\n\t\t} else {\n\t\t\tqueue[userLength++] = effect\n\t\t}\n\t}\n\n\tfor (i = 0; i < userLength; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction upstream(node, ignore) {\n\tnode.state = CLEAN\n\n\tfor (let i = 0, source; i < node.sources.length; i++) {\n\t\tsource = node.sources[i]\n\n\t\tif (source.sources) {\n\t\t\tswitch (source.state) {\n\t\t\t\tcase STALE: {\n\t\t\t\t\tif (source !== ignore && source.updatedAt < Time) {\n\t\t\t\t\t\trunTop(source)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase CHECK: {\n\t\t\t\t\tupstream(source, ignore)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction downstream(node) {\n\tfor (let i = 0, observer; i < node.observers.length; i++) {\n\t\tobserver = node.observers[i]\n\n\t\tif (observer.state === CLEAN) {\n\t\t\tobserver.state = CHECK\n\t\t\tif (observer.pure) {\n\t\t\t\tUpdates.push(observer)\n\t\t\t} else {\n\t\t\t\tEffects.push(observer)\n\t\t\t}\n\t\t\tobserver.observers && downstream(observer)\n\t\t}\n\t}\n}\n\nlet readForbid = false\n\nfunction checkReadForbidden() {\n\tif (readForbid) {\n\t\tconsole.trace('Signal Read!')\n\t}\n}\nexport function readForbidden(fn, value) {\n\tconst prev = readForbid\n\ttry {\n\t\treadForbid = value\n\t\treturn fn()\n\t} finally {\n\t\treadForbid = prev\n\t}\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {typeof Context} Context\n */\nexport function Context(defaultValue = undefined) {\n\tconst id = Symbol()\n\n\treturn useContext.bind(null, id, defaultValue)\n}\n\n/**\n * @overload Gets the context value\n * @returns {any} Context value\n */\n/**\n * @overload Runs `fn` with a new value as context\n * @param {any} newValue - New value for the context\n * @param {Function} fn - Callback to run with the new context value\n * @returns {Children} Children\n */\n/**\n * @param {any} newValue\n * @param {Function} fn\n */\nfunction useContext(id, defaultValue, newValue, fn) {\n\tif (newValue === undefined) {\n\t\treturn Owner?.context && Owner.context[id] !== undefined\n\t\t\t? Owner.context[id]\n\t\t\t: defaultValue\n\t} else {\n\t\tlet res\n\n\t\tsyncEffect(() => {\n\t\t\tOwner.context = {\n\t\t\t\t...Owner.context,\n\t\t\t\t[id]: newValue,\n\t\t\t}\n\t\t\tres = untrack(fn)\n\t\t})\n\n\t\treturn res\n\t}\n}\n\n/**\n * Returns an owned function\n *\n * @param {function | undefined} cb\n * @returns {() => any}\n */\nexport const owned = cb => {\n\tconst o = Owner\n\treturn (...args) => cb && runWithOwner(o, () => cb(...args))\n}\n\n/**\n * Returns true when value is reactive (a signal)\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isReactive = value =>\n\tisFunction(value) && $isReactive in value\n\n/**\n * Marks a function as reactive. Reactive functions are ran inside\n * effects.\n *\n * @param {Function} fn - Function to mark as reactive\n * @returns {Function}\n */\nexport function markReactive(fn) {\n\tfn[$isReactive] = undefined\n\treturn fn\n}\n\n/**\n * Proxies a signals property access so you dont have to call the\n * function\n *\n * @param {Signal} snigal - Signal to proxy\n * @param {object} [target] - Target object for the proxy\n * @returns {object} An object that will read the properties from the\n * signal\n */\nexport const proxy = (snigal, target = nothing) =>\n\tnew Proxy(target, {\n\t\tget(target, key) {\n\t\t\treturn snigal()[key]\n\t\t},\n\t\thas(target, key) {\n\t\t\treturn key in snigal()\n\t\t},\n\t\townKeys(target) {\n\t\t\treturn keys(snigal())\n\t\t},\n\t})\n\n/**\n * A self contained signal function, when an argument is present it\n * writes to the signal, when theres no argument it reads the signal.\n *\n * @template T\n * @param {T} [value] - Optional initial value\n * @returns {SignalFunction}\n */\nexport function signalFunction(value) {\n\tconst [read, write] = signal(value)\n\treturn markReactive((...args) =>\n\t\targs.length ? write(args[0]) : read(),\n\t)\n}\n\n/**\n * To set and read refs. To use in ref attribute.\n *\n * @template T\n * @returns {SignalFunction}\n */\nexport const ref = () => signalFunction()\n\n/**\n * Runs a function inside an effect if value is a function.\n * Aditionally unwraps promises.\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport const withValue = (value, fn) => {\n\tif (isFunction(value)) {\n\t\teffect(() => withValue(getValue(value), fn))\n\t} else if (isPromise(value)) {\n\t\tvalue.then(owned(value => withValue(value, fn)))\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport function withPrevValue(value, fn) {\n\tif (isFunction(value)) {\n\t\tlet prev = undefined\n\t\teffect(() => {\n\t\t\tconst val = getValue(value)\n\t\t\tfn(val, prev)\n\t\t\tprev = val\n\t\t})\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Lazy and writable version of `memo`, its writable and will run the\n * function only when used\n *\n * @author ryansolid\n * @param {Function} fn - Function to re-run when dependencies change\n * @returns {((...args) => any) | (() => any)}\n */\nexport function writable(fn) {\n\tconst result = memo(() => signal(fn()))\n\n\treturn markReactive((...args) => {\n\t\treturn args.length ? result().write(args[0]) : result().read()\n\t})\n}\n\n/**\n * Creates an asynchronously effect\n *\n * @param {(currentRunningEffect: Promise) => any} fn - A\n * function that receives a `currentRunningEffect` that should be\n * awaited for when wanting to run effects synchronously, that's it\n * one effect after another.\n */\nexport function asyncEffect(fn) {\n\tconst queue = []\n\teffect(() => {\n\t\tconst { promise, resolve } = withResolvers()\n\n\t\tqueue.push(promise)\n\n\t\tfunction onDone() {\n\t\t\tremoveFromArray(queue, promise)\n\t\t\tresolve()\n\t\t}\n\n\t\tresolved(\n\t\t\tfn(queue.length === 1 ? undefined : queue[queue.length - 2]),\n\t\t\tonDone,\n\t\t)\n\t})\n}\n\n/**\n * A Promise loader handler. Allows to display/run something or\n * nothing while a promise is resolving. Allows to run a callback when\n * the promise resolves. Allows to get notified of errors, and\n * display/run something or nothing, if wanted a `retry` function is\n * given for retrying the promise. All functions run with the original\n * owner, so it's `Context` friendly.\n *\n * @param {(() => Promise) | Promise} fn - Function that\n * returns a promise\n * @param {{\n * \tonLoading?: any\n * \tonLoaded?: Function\n * \tonError?: ((e: Error, retry: Function) => any) | any\n * }} [options]\n *\n * @returns {Component}\n * @url https://pota.quack.uy/lazy\n */\nexport const lazy = (fn, options = nothing) =>\n\tmarkComponent(props => {\n\t\tconst { onLoading, onLoaded, onError } = options\n\n\t\tconst [value, setValue] = signal(onLoading)\n\n\t\tconst _onLoaded = owned(onLoaded)\n\n\t\tconst retry = () =>\n\t\t\tPromise.resolve(isFunction(fn) ? fn() : fn)\n\t\t\t\t.then(r => {\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tmarkComponent(() => {\n\t\t\t\t\t\t\tr = isObject(r) && r.default ? r.default : r\n\t\t\t\t\t\t\treturn isFunction(r) ? r(props) : r\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\tmicrotask(_onLoaded)\n\t\t\t\t})\n\t\t\t\t.catch(e =>\n\t\t\t\t\tonError\n\t\t\t\t\t\t? setValue(\n\t\t\t\t\t\t\t\tmarkComponent(() =>\n\t\t\t\t\t\t\t\t\tisFunction(onError) ? onError(e, retry) : onError,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: console.error(e),\n\t\t\t\t)\n\t\tretry()\n\n\t\treturn value\n\t})\n\nexport const Lazy = props => lazy(props.children, props)\n\nexport const microtask = fn => queueMicrotask(owned(fn))\n\n// MAP\n\n/**\n * Reactive Map\n *\n * @template T\n * @param {Each} list\n * @param {Function} callback\n * @param {boolean} [sort]\n */\nexport function map(list, callback, sort) {\n\tconst cache = new Map()\n\tconst duplicates = new Map() // for when caching by value is not possible [1, 2, 1, 1, 1]\n\n\tlet runId = 0\n\n\tlet rows = []\n\t/** @type any[] */\n\tlet prev = []\n\n\tfunction clear() {\n\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\tprev[i].dispose(true)\n\t\t}\n\t\tcache.clear()\n\t\tduplicates.clear()\n\n\t\trows.length = 0\n\t\tprev.length = 0\n\t}\n\n\t// to get rid of all nodes when parent disposes\n\tcleanup(clear)\n\n\tclass Row {\n\t\tconstructor(item, index, fn, isDupe) {\n\t\t\tthis.runId = -1\n\t\t\tthis.item = item\n\t\t\tthis.index = index\n\t\t\tthis.isDupe = isDupe\n\t\t\tthis.disposer = undefined\n\t\t\tthis.nodes = root(disposer => {\n\t\t\t\tthis.disposer = disposer\n\t\t\t\t/** @type Children[] */\n\t\t\t\treturn fn(item, index)\n\t\t\t})\n\t\t}\n\t\tget begin() {\n\t\t\treturn this.nodes[0]\n\t\t}\n\t\tget end() {\n\t\t\treturn this.nodes[this.nodes.length - 1]\n\t\t}\n\t\tdispose(all) {\n\t\t\t// skip cache deletion as we are going to clear the full map\n\t\t\tif (all === undefined) {\n\t\t\t\t// delete from cache\n\t\t\t\tif (!this.isDupe) {\n\t\t\t\t\tcache.delete(this.item)\n\t\t\t\t} else {\n\t\t\t\t\tconst arr = duplicates.get(this.item)\n\t\t\t\t\tarr.length === 1\n\t\t\t\t\t\t? duplicates.delete(this.item)\n\t\t\t\t\t\t: removeFromArray(arr, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.disposer()\n\t\t}\n\t}\n\n\t/**\n\t * @param {Function} fn\n\t * @returns {Children}\n\t */\n\tfunction mapper(fn) {\n\t\tconst cb = fn\n\t\t\t? (item, index) => fn(callback(item, index), index)\n\t\t\t: callback\n\n\t\tconst value = getValue(list) || []\n\n\t\t/** To allow iterate objects as if were an array with indexes */\n\t\tconst items = isIterable(value) ? value.entries() : entries(value)\n\n\t\trunId++\n\t\trows = []\n\t\tconst hasPrev = prev.length\n\n\t\tfor (const [index, item] of items) {\n\t\t\tlet row = hasPrev ? cache.get(item) : undefined\n\n\t\t\t// if the item doesnt exists, create it\n\t\t\tif (row === undefined) {\n\t\t\t\trow = new Row(item, index, cb, false)\n\t\t\t\tcache.set(item, row)\n\t\t\t} else if (row.runId === runId) {\n\t\t\t\t// a map will save only 1 of any primitive duplicates, say: [1, 1, 1, 1]\n\t\t\t\t// if the saved value was already used on this run, create a new one\n\t\t\t\tlet dupes = duplicates.get(item)\n\t\t\t\tif (!dupes) {\n\t\t\t\t\tdupes = []\n\t\t\t\t\tduplicates.set(item, dupes)\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < dupes.length; i++) {\n\t\t\t\t\tif (dupes[i].runId !== runId) {\n\t\t\t\t\t\trow = dupes[i]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (row.runId === runId) {\n\t\t\t\t\trow = new Row(item, index, cb, true)\n\t\t\t\t\tdupes.push(row)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trow.runId = runId // mark used on this run\n\t\t\trow.index = index // save sort order\n\t\t\trows.push(row)\n\t\t}\n\n\t\t// remove rows that arent present on the current run\n\t\tif (rows.length === 0) {\n\t\t\tclear()\n\t\t} else {\n\t\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\t\tif (prev[i].runId !== runId) {\n\t\t\t\t\tprev[i].dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// reorder elements\n\t\t// `rows.length > 1` because no need for sorting when there are no items\n\t\t// prev.length > 0 to skip sorting on creation as its already sorted\n\t\tif (sort && rows.length > 1 && prev.length) {\n\t\t\t// if the planets align it handles swapping\n\t\t\t// a = sorted\n\t\t\t// b = unsorted\n\t\t\tconst { a, b } = groupBy(rows, (value, index) =>\n\t\t\t\trows[index] === prev[index] ? 'a' : 'b',\n\t\t\t)\n\n\t\t\tlet unsorted = b?.length\n\t\t\tif (\n\t\t\t\ta &&\n\t\t\t\tb &&\n\t\t\t\ta.length &&\n\t\t\t\tb.length &&\n\t\t\t\tb.length < a.length &&\n\t\t\t\tb.every(item => prev.includes(item))\n\t\t\t) {\n\t\t\t\tfor (const usort of b) {\n\t\t\t\t\tfor (const sort of a) {\n\t\t\t\t\t\tif (usort.index === sort.index - 1) {\n\t\t\t\t\t\t\tsort.begin.before(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if (usort.index === sort.index + 1) {\n\t\t\t\t\t\t\tsort.end.after(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unsorted) {\n\t\t\t\t// handles all other cases\n\t\t\t\t// best for any combination of: push/pop/shift/unshift/insertion/deletion\n\t\t\t\t// must check in reverse as on creation stuff is added to the end\n\n\t\t\t\tlet current = rows[rows.length - 1]\n\t\t\t\tfor (let i = rows.length - 1; i > 0; i--) {\n\t\t\t\t\tconst previous = rows[i - 1]\n\t\t\t\t\tif (current.begin.previousSibling !== previous.end) {\n\t\t\t\t\t\tcurrent.begin.before(...nodesFromRow(previous))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = previous\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// save sorted list\n\t\tprev = rows\n\n\t\t// return external representation\n\t\treturn rows.map(item => item.nodes)\n\t}\n\tmapper[$isMap] = undefined\n\treturn mapper\n}\n\nfunction nodesFromRow(row) {\n\tconst { begin, end } = row\n\tconst nodes = [begin]\n\n\tlet nextSibling = begin\n\twhile (nextSibling !== end) {\n\t\tnextSibling = nextSibling.nextSibling\n\t\tnodes.push(nextSibling)\n\t}\n\n\treturn nodes\n}\n\n/**\n * Resolves and returns `children` in a memo\n *\n * @param {Function | Children} fn\n * @returns {Function} Memo\n * @url https://pota.quack.uy/resolve\n */\nexport function resolve(fn) {\n\tconst children = isFunction(fn) ? memo(fn) : () => fn\n\treturn memo(() => unwrap(children()))\n}\n\n/**\n * Recursively unwrap children functions\n *\n * @param {Children} children\n * @returns {Children}\n */\nfunction unwrap(children) {\n\tif (isFunction(children)) {\n\t\treturn unwrap(children())\n\t}\n\n\tif (isArray(children)) {\n\t\tconst childrens = []\n\t\tfor (let child of children) {\n\t\t\tchild = unwrap(child)\n\t\t\tisArray(child)\n\t\t\t\t? childrens.push(...child)\n\t\t\t\t: childrens.push(child)\n\t\t}\n\t\treturn childrens\n\t}\n\n\treturn children\n}\n\n/**\n * Extend `Pota` and define a `render(props){}` method to create a\n * class component. `ready(cb)` and `cleanup(cb)` methods will be\n * registered automatically\n *\n * @url https://pota.quack.uy/Classes\n */\nexport class Pota {}\n\nPota[$isClass] = undefined\n\n/**\n * Returns true if the `value` is a `Component`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponent = value =>\n\tisFunction(value) && $isComponent in value\n\n/**\n * Returns true if the value can be made a Component\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponentable = value =>\n\t!isReactive(value) &&\n\t(isFunction(value) ||\n\t\t// avoid [1,2] and support { toString(){ return \"something\"} }\n\t\t(!isArray(value) && isObject(value) && !value.then))\n\n/**\n * Makes of `children` a function. Reactive children will run as is,\n * non-reactive children will run untracked, regular children will\n * just return.\n *\n * @param {Children} children\n * @returns {Function}\n */\nexport function makeCallback(children) {\n\t/**\n\t * When children is an array, as in >${[0, 1, 2]}< then children\n\t * will end as `[[0, 1, 2]]`, so flat it\n\t */\n\n\tchildren = isArray(children) ? flat(children) : children\n\n\tconst callbacks = !isArray(children)\n\t\t? callback(children)\n\t\t: children.map(callback)\n\n\treturn !isArray(children)\n\t\t? markComponent((...args) => callbacks(args))\n\t\t: markComponent((...args) =>\n\t\t\t\tcallbacks.map(callback => callback(args)),\n\t\t\t)\n}\n\nconst callback = child =>\n\tisFunction(child)\n\t\t? isReactive(child)\n\t\t\t? args => {\n\t\t\t\t\t/**\n\t\t\t\t\t * The function inside the `for` is saved in a signal. The\n\t\t\t\t\t * result of the signal is our callback\n\t\t\t\t\t *\n\t\t\t\t\t * ```js\n\t\t\t\t\t * htmlEffect(\n\t\t\t\t\t * \thtml =>\n\t\t\t\t\t * \t\thtml`\n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\tname \n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\t${item =>\n\t\t\t\t\t * \t\t\t\t\thtml`\n\t\t\t\t\t * \t\t\t\t\t\t${item.name} \n\t\t\t\t\t * \t\t\t\t\t `}\n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t
`,\n\t\t\t\t\t * )\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\tconst r = child()\n\t\t\t\t\treturn isFunction(r)\n\t\t\t\t\t\t? isReactive(r)\n\t\t\t\t\t\t\t? r()\n\t\t\t\t\t\t\t: untrack(() => r(...args))\n\t\t\t\t\t\t: r\n\t\t\t\t}\n\t\t\t: args => untrack(() => child(...args))\n\t\t: () => child\n\n// allows to tell a `signal function` from a `component function`\n// signals and user functions go in effects, for reactivity\n// components and callbacks are untracked and wont go in effects to avoid re-rendering\n\n/**\n * Marks a function as a `Component`.\n *\n * @param {Function} fn - Function to mark as a `Component`\n * @returns {Component}\n */\nexport function markComponent(fn) {\n\tfn[$isComponent] = undefined\n\treturn fn\n}\n\n/**\n * Unwraps components till it gets a value. To keep context relevant\n * to the component\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValueComponent(value) {\n\twhile ($isComponent in value) value = value()\n\treturn value\n}\n\n/**\n * Adds an event listener to a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `off` function for removing the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function addEventListener(node, type, handler) {\n\tnode.addEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\t/**\n\t * Removes event on tracking scope disposal.\n\t *\n\t * Situation: the event was added to the `document` manually using\n\t * `addEventListener`, say to listen for clicks as a \"click\n\t * outside\". The event needs to be removed when the component that\n\t * added it is disposed.\n\t */\n\n\treturn cleanup(() => removeEventListener(node, type, handler))\n}\n\n/**\n * Removes an event listener from a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `on` function for adding back the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function removeEventListener(node, type, handler) {\n\tnode.removeEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\treturn () => addEventListener(node, type, handler)\n}\n\n/**\n * It gives a handler an owner, so stuff runs batched on it, and\n * things like context and cleanup work\n */\nexport const ownedEvent = handler =>\n\t'handleEvent' in handler\n\t\t? {\n\t\t\t\t...handler,\n\t\t\t\thandleEvent: owned(e => handler.handleEvent(e)),\n\t\t\t}\n\t\t: owned(handler)\n","import { owned } from './lib/reactive.js'\nimport { call, queueMicrotask } from './lib/std.js'\n\n/**\n * The purpose of this file is to guarantee the timing of some\n * callbacks. It queues a microtask, then the callbacks are added to a\n * position in the array. These are run with a priority.\n */\n\n/** @type boolean */\nlet added\n\n/** @type [][] */\nlet queue\n\nfunction reset() {\n\tqueue = [[], [], [], [], [], []]\n\tadded = false\n}\n\n// initialization\nreset()\n\n/**\n * Queues a callback at a priority\n *\n * @param {PropertyKey} priority - Priority\n * @param {Function} fn - Function to run once the callbacks at this\n * priority run\n */\nfunction add(priority, fn) {\n\tif (!added) {\n\t\tadded = true\n\t\tqueueMicrotask(run)\n\t}\n\tqueue[priority].push(owned(fn))\n}\n\n/** Runs all queued callbacks */\nfunction run() {\n\tconst q = queue\n\treset()\n\n\tfor (const fns of q) {\n\t\tfns.length && call(fns)\n\t}\n}\n\n/**\n * Queue a function to run before everything else (onProps, onRef,\n * onMount, ready) ex focus restoration\n *\n * @param {Function} fn\n */\nexport const onFixes = fn => add(0, fn)\n\n/**\n * Queue a function to run before (onRef, onMount, ready) ex running\n * user functions on elements via plugins\n *\n * @param {Function} fn\n */\nexport const onProps = fn => add(1, fn)\n\n/**\n * Queue a function to run onRef (before onMount, after onProps)\n *\n * @param {Function} fn\n */\nexport const onRef = fn => add(2, fn)\n\n/**\n * Queue a function to run onMount (before ready, after onRef)\n *\n * @param {Function} fn\n */\nexport const onMount = fn => add(3, fn)\n\n/**\n * Queue a function to run on ready (after onMount)\n *\n * @param {Function} fn\n * @url https://pota.quack.uy/ready\n */\nexport const ready = fn => add(4, fn)\n\n/**\n * Queue a function to run after all user defined processes\n *\n * @param {Function} fn\n */\nexport const onDone = fn => add(5, fn)\n","import { addEventListener, ownedEvent } from '../lib/reactive.js'\nimport { window, withCache } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {EventListenerOrEventListenerObject} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setEventNS = (node, name, value, props, localName, ns) =>\n\taddEventListener(node, localName, ownedEvent(value))\n\n/**\n * Returns an event name when the string could be mapped to an event\n *\n * @param {string} name - String to check for a mapped event\n * @returns {string | undefined} Returns the event name or null in\n * case isnt found\n */\nexport const eventName = withCache(name =>\n\tname.startsWith('on') && name.toLowerCase() in window\n\t\t? name.slice(2).toLowerCase()\n\t\t: null,\n)\n","import { cacheStore } from '../lib/std.js'\nimport { onProps } from '../scheduler.js'\n\nexport const plugins = cacheStore()\nexport const pluginsNS = cacheStore()\n\n/**\n * Defines a prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - To avoid the problem of\n * needed props not being set, or children elements not created yet.\n * Default is `true`\n * @url https://pota.quack.uy/props/propsPlugin\n */\nexport const propsPlugin = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n}\n\n/**\n * Defines a namespaced prop that can be used on any Element\n *\n * @param {string} NSName - Name of the namespace\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * \tlocalName: string,\n * \tns: string,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginNS = (NSName, fn, onMicrotask) => {\n\tplugin(pluginsNS, NSName, fn, onMicrotask)\n}\n\n/**\n * Defines prop and namespaced prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop/namespace\n * @param {Function} fn - Function to run when this prop is found on\n * any Element\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginBoth = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n\tplugin(pluginsNS, propName, fn, onMicrotask)\n}\n\nconst plugin = (plugins, name, fn, onMicrotask = true) => {\n\tplugins.set(\n\t\tname,\n\t\t!onMicrotask ? fn : (...args) => onProps(() => fn(...args)),\n\t)\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\nimport { NS } from '../constants.js'\n\n// NODE ATTRIBUTES\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setAttributeNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setAttribute(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n * @url https://pota.quack.uy/props/setAttribute\n */\nexport const setAttribute = (node, name, value, ns) =>\n\twithValue(value, value => _setAttribute(node, name, value, ns))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {string} [ns]\n */\nfunction _setAttribute(node, name, value, ns) {\n\t// if the value is null or undefined it will be removed\n\tif (isNullUndefined(value)) {\n\t\tns && NS[ns]\n\t\t\t? node.removeAttributeNS(NS[ns], name)\n\t\t\t: node.removeAttribute(name)\n\t} else {\n\t\tns && NS[ns]\n\t\t\t? node.setAttributeNS(NS[ns], name, value)\n\t\t\t: node.setAttribute(name, value)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setPropertyNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setProperty(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setProperty\n */\nexport const setProperty = (node, name, value) =>\n\twithValue(value, value => _setProperty(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport function _setProperty(node, name, value) {\n\t// if the value is null or undefined it will be set to null\n\tif (isNullUndefined(value)) {\n\t\t// defaulting to undefined breaks `progress` tag and the whole page\n\t\tnode[name] = null\n\t} else {\n\t\tnode[name] = value\n\t}\n}\n","// NODE UNKNOWN PROPERTIES / ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\nimport {\n\tgetPrototypeOf,\n\tgetSetterNamesFromPrototype,\n} from '../lib/std.js'\nimport { setAttribute } from './attribute.js'\nimport { setProperty } from './property.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const setUnknown = (node, name, value, ns) => {\n\twithValue(value, value => _setUnknown(node, name, value, ns))\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const _setUnknown = (node, name, value, ns) => {\n\tif (typeof value !== 'string' && setters(node).element.has(name)) {\n\t\t/**\n\t\t * 1. First check in element because a custom-element may overwrite\n\t\t * builtIn setters\n\t\t * 2. Only do this when it's different to a string to avoid coarcing\n\t\t * on native elements (ex: (img.width = '16px') === 0)\n\t\t */\n\t\tsetProperty(node, name, value)\n\t} else if (setters(node).builtIn.has(name)) {\n\t\t// ex: innerHTML, textContent, draggable={true}\n\t\tsetProperty(node, name, value)\n\t} else {\n\t\tsetAttribute(node, name, value, ns)\n\t}\n}\n\nconst elements = new Map()\n\n/** @param {Element} node */\nfunction setters(node) {\n\t/**\n\t * Use `node.constructor` instead of `node.nodeName` because it\n\t * handles the difference between `a` `HTMLAnchorElement` and `a`\n\t * `SVGAElement`\n\t */\n\tlet setters = elements.get(node.constructor)\n\tif (setters) return setters\n\tsetters = { builtIn: new Set(builtInSetters), element: new Set() }\n\telements.set(node.constructor, setters)\n\n\tlet store = setters.element\n\tlet proto = getPrototypeOf(node)\n\n\t/**\n\t * Stop at `Element` instead of `HTMLElement` because it handles the\n\t * difference between `HTMLElement`, `SVGElement`, `FutureElement`\n\t * etc\n\t */\n\twhile (proto.constructor !== Element) {\n\t\tconst nextProto = getPrototypeOf(proto)\n\n\t\t/**\n\t\t * The previous prototype to `Element` is a `builtIn`\n\t\t * (`HTMLElement`, `SVGElement`,`FutureElement`, etc)\n\t\t */\n\t\tif (nextProto.constructor === Element) {\n\t\t\tstore = setters.builtIn\n\t\t}\n\t\tgetSetterNamesFromPrototype(proto, store)\n\t\tproto = nextProto\n\t}\n\n\treturn setters\n}\n\n/** Setters shared by all kind of elements */\nconst builtInSetters = getSetterNamesFromPrototype(\n\tElement.prototype,\n\tgetSetterNamesFromPrototype(Node.prototype),\n)\n","// BOOL ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setBoolNS = (node, name, value, props, localName, ns) =>\n\tsetBool(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setBool\n */\nexport const setBool = (node, name, value) =>\n\twithValue(value, value => _setBool(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const _setBool = (node, name, value) =>\n\t// if the value is falsy gets removed\n\tvalue ? node.setAttribute(name, '') : node.removeAttribute(name)\n","// node style\n\nimport { withValue } from '../lib/reactive.js'\nimport { getValue, isNullUndefined, isObject } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @url https://pota.quack.uy/props/setStyle\n */\nexport const setStyle = (node, name, value, props) =>\n\tsetNodeStyle(node.style, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setStyleNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(\n\t\tnode.style,\n\t\tisObject(value) ? value : { [localName]: value },\n\t)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setVarNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(node.style, { ['--' + localName]: value })\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {unknown} value\n */\nfunction setNodeStyle(style, value) {\n\tif (isObject(value)) {\n\t\tlet name\n\t\tfor (name in value) {\n\t\t\tsetStyleValue(style, name, value[name])\n\t\t}\n\t\treturn\n\t}\n\tconst type = typeof value\n\tif (type === 'string') {\n\t\tstyle.cssText = value\n\t\treturn\n\t}\n\tif (type === 'function') {\n\t\twithValue(value, value => setNodeStyle(style, getValue(value)))\n\t\treturn\n\t}\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementStyle = (node, name, value) =>\n\tsetStyleValue(node.style, name, value)\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {unknown} value\n */\nconst setStyleValue = (style, name, value) =>\n\twithValue(value, value => _setStyleValue(style, name, value))\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {string | null} value\n */\nconst _setStyleValue = (style, name, value) =>\n\t// if the value is null or undefined it will be removed\n\tisNullUndefined(value)\n\t\t? style.removeProperty(name)\n\t\t: style.setProperty(name, value)\n","// node class / classList\n\nimport { withPrevValue, withValue } from '../lib/reactive.js'\nimport {\n\tclassListAdd,\n\tclassListRemove,\n\tisFunction,\n\tisString,\n} from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n */\nexport const setClass = (node, name, value, props) =>\n\tisString(value)\n\t\t? node.setAttribute('class', value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setClassNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) =>\n\tisFunction(value)\n\t\t? setElementClass(node, localName, value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {object | string | ArrayLike} value\n */\nfunction setClassList(node, value) {\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t_setClassListValue(node, value, true)\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'object': {\n\t\t\tlet name\n\t\t\tfor (name in value) {\n\t\t\t\tsetElementClass(node, name, value[name])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'function': {\n\t\t\twithValue(value, value => setClassList(node, value))\n\t\t\tbreak\n\t\t}\n\t}\n}\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementClass = (node, name, value) =>\n\twithPrevValue(value, (value, prev) => {\n\t\t// on initialization do not remove whats not there\n\t\tif (!value && !prev) {\n\t\t} else {\n\t\t\t_setClassListValue(node, name, value)\n\t\t}\n\t})\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\n\nconst _setClassListValue = (node, name, value) =>\n\t// null, undefined or false, the class is removed\n\t!value\n\t\t? classListRemove(node, name)\n\t\t: classListAdd(node, ...name.trim().split(/\\s+/))\n","import { cleanup, withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\nimport { _setProperty } from './property.js'\n\n/**\n * `value` as a prop is special cased so the button `reset` in forms\n * works as expected. The first time a value is set, its done as an\n * attribute.\n */\nexport const setValue = (node, name, value) =>\n\twithValue(value, value => _setValue(node, name, value))\n\nconst defaults = new Set()\n\nfunction _setValue(node, name, value) {\n\tif (!defaults.has(node)) {\n\t\tdefaults.add(node)\n\t\tcleanup(() => defaults.delete(node))\n\n\t\tif (!isNullUndefined(value)) {\n\t\t\tswitch (node.localName) {\n\t\t\t\tcase 'input': {\n\t\t\t\t\tnode.setAttribute('value', value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcase 'textarea': {\n\t\t\t\t\tnode.textContent = value\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t_setProperty(node, name, value)\n}\n","/** Returns true or false with a `chance` of getting `true` */\nexport const chance = (chance = 50, generator = random) => {\n\treturn generator() < chance / 100\n}\n\n/** Returns random number between 0 and 1 */\nexport const random = () =>\n\tcrypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)\n\nexport const randomBetween = (min, max, generator = random) =>\n\tMath.floor(generator() * (max - min + 1)) + min\n\nexport const randomColor = (min = 0, max = 255) =>\n\t'rgb(' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t')'\n\nexport const randomId = () =>\n\tcrypto.getRandomValues(new BigUint64Array(1))[0].toString(36)\n\n/**\n * Returns a random number generator based no a seed that generates\n * numbers between 0 and 1\n */\nexport function randomSeeded(seed) {\n\tconst m = 2 ** 35 - 31\n\tlet s = seed % m\n\treturn () => (s = (s * 185852) % m) / m\n}\n","import {\n\tadoptedStyleSheetsAdd,\n\tclassListAdd,\n\tgetDocumentForElement,\n\tsheet,\n\twithState,\n} from '../lib/std.js'\n\nimport { randomId } from '../plugin/useRandom.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {object} props\n */\nexport const setCSS = (node, name, value, props) =>\n\tsetNodeCSS(node, value)\n\n/**\n * @param {Element} node\n * @param {string} value\n */\nconst setNodeCSS = withState((state, node, value) => {\n\tclassListAdd(\n\t\tnode,\n\t\tstate.get(value, value => {\n\t\t\tconst id = 'c' + randomId()\n\t\t\tadoptedStyleSheetsAdd(\n\t\t\t\tgetDocumentForElement(node),\n\t\t\t\tsheet(value.replace(/class/g, '.' + id)),\n\t\t\t)\n\t\t\treturn id\n\t\t}),\n\t)\n})\n","import { cleanup } from '../lib/reactive.js'\n\nimport { onMount, onRef } from '../scheduler.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setRef = (node, name, value, props) =>\n\tonRef(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setOnMount = (node, name, value, props) =>\n\tonMount(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setUnmount = (node, name, value, props) =>\n\tcleanup(() => value(node))\n","import {\n\taddEventListener,\n\towned,\n\townedEvent,\n} from '../lib/reactive.js'\nimport { getValue, isObject } from '../lib/std.js'\n\nimport { eventName } from './event.js'\n\nimport {\n\tplugins,\n\tpluginsNS,\n\tpropsPlugin,\n\tpropsPluginBoth,\n\tpropsPluginNS,\n} from './plugin.js'\nimport { setUnknown } from './unknown.js'\n\n// exports\n\nexport { setAttribute } from './attribute.js'\nexport { setBool } from './bool.js'\nexport { setProperty } from './property.js'\nexport { setUnknown } from './unknown.js'\nexport { setElementStyle as setStyle } from './style.js'\nexport { setElementClass as setClass } from './class.js'\n\n// PLUGINS NS\n\n// namespaced attributes/properties\n\nimport { setPropertyNS } from './property.js'\npropsPluginNS('prop', setPropertyNS, false)\n\nimport { setAttributeNS } from './attribute.js'\npropsPluginNS('attr', setAttributeNS, false)\n\nimport { setBoolNS } from './bool.js'\npropsPluginNS('bool', setBoolNS, false)\n\n// events\n\nimport { setEventNS } from './event.js'\npropsPluginNS('on', setEventNS, false)\n\n// var\n\nimport { setVarNS } from './style.js'\npropsPluginNS('var', setVarNS, false)\n\n// PLUGINS REGULAR\n\n// noop\n\nimport { noop } from '../lib/std.js'\npropsPlugin('__dev', noop, false)\npropsPlugin('xmlns', noop, false)\n\n// value\n\nimport { setValue } from './value.js'\npropsPlugin('value', setValue, false)\n\n// PLUGIN BOTH\n\n// css\n\nimport { setCSS } from './css.js'\npropsPluginBoth('css', setCSS, false)\n\n// mount\n\nimport { setOnMount } from './lifecycle.js'\npropsPluginBoth('onMount', setOnMount, false)\n\n// unmount\n\nimport { setUnmount } from './lifecycle.js'\npropsPluginBoth('onUnmount', setUnmount, false)\n\n// ref\n\nimport { setRef } from './lifecycle.js'\npropsPluginBoth('ref', setRef, false)\n\n// PLUGIN BOTH DIFFERENT\n\n// styles\n\nimport { setStyle, setStyleNS } from './style.js'\npropsPlugin('style', setStyle, false)\npropsPluginNS('style', setStyleNS, false)\n\n// class\n\nimport { setClass, setClassNS } from './class.js'\npropsPlugin('class', setClass, false)\npropsPluginNS('class', setClassNS, false)\n\n// catch all\n\n/**\n * Assigns props to an Element\n *\n * @param {Element} node - Element to which assign props\n * @param {object} props - Props to assign\n */\nexport function assignProps(node, props) {\n\tfor (const name in props) {\n\t\tassignProp(node, name, props[name], props)\n\t}\n}\n\n/**\n * Assigns a prop to an Element\n *\n * @param {Element} node\n * @param {string} name\n * @param {any} value\n * @param {object} props\n */\nexport function assignProp(node, name, value, props) {\n\t// run plugins\n\tlet plugin = plugins.get(name)\n\tif (plugin) {\n\t\tplugin(node, name, value, props)\n\t\treturn\n\t}\n\n\t// onClick={handler}\n\tlet event = eventName(name)\n\tif (event) {\n\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\treturn\n\t}\n\n\tif (name.includes(':')) {\n\t\t// with ns\n\t\tconst [ns, localName] = name.split(':')\n\n\t\t// run plugins NS\n\t\tplugin = pluginsNS.get(ns)\n\t\tif (plugin) {\n\t\t\tplugin(node, name, value, props, localName, ns)\n\t\t\treturn\n\t\t}\n\n\t\t// onClick:my-ns={handler}\n\t\tevent = eventName(ns)\n\t\tif (event) {\n\t\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\t\treturn\n\t\t}\n\n\t\tsetUnknown(node, name, value, ns)\n\t\treturn\n\t}\n\n\t// catch all\n\tsetUnknown(node, name, value)\n}\n","// CONSTANTS\n\nimport { $isClass, $isMap, NS } from './constants.js'\n\n// LIB\n\nimport {\n\tcleanup,\n\tContext,\n\teffect,\n\tisReactive,\n\troot,\n\tsignal,\n\tuntrack,\n} from './lib/reactive.js'\n\nimport {\n\tadoptedStyleSheetsAdd,\n\tadoptedStyleSheetsRemove,\n\tcreateElement,\n\tcreateElementNS,\n\tcreateTextNode,\n\tCSSStyleSheet,\n\tdocument,\n\tDocumentFragment,\n\tflat,\n\tfreeze,\n\tgetDocumentForElement,\n\timportNode,\n\tisArray,\n\tisConnected,\n\titerator,\n\tnothing,\n\tquerySelector,\n\tresolved,\n\tstringify,\n\ttoArray,\n\twalkElements,\n} from './lib/std.js'\n\nimport {\n\tisComponent,\n\tisComponentable,\n\tmarkComponent,\n} from './lib/reactive.js'\n\nimport { onFixes, ready } from './scheduler.js'\n\n// PROPERTIES / ATTRIBUTES\n\nimport { assignProps } from './props/@main.js'\nimport { propsPlugin } from './props/plugin.js'\n\n// STATE\n\nconst useXMLNS = context()\n\n// COMPONENTS\n\n/**\n * Used by the regular JSX transform, as `<>...>` or\n * `... `.\n */\nexport const Fragment = props => props.children\n\n/**\n * Creates components for things. When props argument is given, the\n * props become fixed. When props argument is ommited, it allows you\n * to keep calling the returned function with new props. Returns a\n * function because we need to render from parent to children instead\n * of from children to parent. This allows to properly set the\n * reactivity tree (think of nested effects that clear inner effects,\n * context, etc).\n *\n * @param {string | Function | Element | object | symbol} value -\n * Component\n * @param {any} [props] Object\n * @url https://pota.quack.uy/Component\n */\n\nexport function Component(value, props) {\n\tif (value === Fragment) {\n\t\treturn props.children\n\t}\n\n\t/** Freeze props so isnt directly writable */\n\tfreeze(props)\n\n\t/** Create a callable function to pass `props` */\n\tconst component = Factory(value)\n\n\treturn props === undefined\n\t\t? component\n\t\t: markComponent(propsOverride =>\n\t\t\t\tcomponent(\n\t\t\t\t\tpropsOverride\n\t\t\t\t\t\t? freeze({ ...props, ...propsOverride })\n\t\t\t\t\t\t: props,\n\t\t\t\t),\n\t\t\t)\n}\n\n/**\n * Creates a component that could be called with a props object\n *\n * @template T\n * @param {any} value\n * @returns {Component}\n */\n\nfunction Factory(value) {\n\tif (isComponent(value)) {\n\t\treturn value\n\t}\n\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t// string component, 'div' becomes \n\t\t\treturn markComponent(props => createTag(value, props))\n\t\t}\n\t\tcase 'function': {\n\t\t\tif ($isClass in value) {\n\t\t\t\t// class component
\n\t\t\t\treturn markComponent(props => createClass(value, props))\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * ```js\n\t\t\t * const [Count, setCount] = signal(1)\n\t\t\t * return
\n\t\t\t * ```\n\t\t\t */\n\t\t\tif (isReactive(value)) {\n\t\t\t\treturn markComponent(() => createAnything(value))\n\t\t\t}\n\n\t\t\t// function component
\n\t\t\t// value = value\n\t\t\treturn markComponent(value)\n\t\t}\n\t\tdefault: {\n\t\t\tif (value instanceof Node) {\n\t\t\t\t// node component
\n\t\t\t\treturn markComponent(props => createNode(value, props))\n\t\t\t}\n\n\t\t\treturn markComponent(() => createAnything(value))\n\t\t}\n\t}\n}\n\nexport function createComponent(value) {\n\tconst component = Factory(value)\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() => component(props))\n\t}\n}\n\nfunction createClass(value, props) {\n\tconst i = new value()\n\ti.ready && ready(() => i.ready())\n\ti.cleanup && cleanup(() => i.cleanup())\n\n\treturn i.render(props)\n}\n\nfunction createAnything(value) {\n\treturn value\n}\n\n/**\n * Creates a x/html element from a tagName\n *\n * @template P\n * @param {TagNames} tagName\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createTag(tagName, props) {\n\t/**\n\t * Namespace, use props xmlns or special case svg, math, etc in case\n\t * of missing xmlns attribute\n\t */\n\tconst xmlns = props?.xmlns || NS[tagName]\n\n\treturn withXMLNS(\n\t\txmlns,\n\t\txmlns =>\n\t\t\tcreateNode(\n\t\t\t\txmlns\n\t\t\t\t\t? createElementNS(xmlns, tagName)\n\t\t\t\t\t: createElement(tagName),\n\t\t\t\tprops,\n\t\t\t),\n\t\ttagName,\n\t)\n}\n\nfunction withXMLNS(xmlns, fn, tagName) {\n\tconst nsContext = useXMLNS()\n\n\tif (xmlns && xmlns !== nsContext) {\n\t\t// the xmlns changed, use the new xmlns\n\t\treturn useXMLNS(xmlns, () => fn(xmlns))\n\t}\n\n\t/**\n\t * `foreignObject` children are created with html xmlns (default\n\t * browser behaviour)\n\t */\n\tif (nsContext && tagName === 'foreignObject') {\n\t\treturn useXMLNS(NS.html, () => fn(nsContext))\n\t}\n\n\treturn fn(nsContext)\n}\n\n// PARTIALS\n\nfunction parseHTML(content, xmlns) {\n\tconst template = xmlns\n\t\t? createElementNS(xmlns, 'template')\n\t\t: createElement('template')\n\n\ttemplate.innerHTML = content\n\n\t// xml\n\tif (!template.content) {\n\t\tif (template.childNodes.length === 1) {\n\t\t\treturn template.firstChild\n\t\t}\n\n\t\ttemplate.content = new DocumentFragment()\n\t\ttemplate.content.append(...template.childNodes)\n\t}\n\n\treturn template.content.childNodes.length === 1\n\t\t? template.content.firstChild\n\t\t: template.content\n}\n\nexport function createPartial(content, propsData = nothing) {\n\tlet clone = () => {\n\t\tconst node = withXMLNS(propsData.x, xmlns =>\n\t\t\tparseHTML(content, xmlns),\n\t\t)\n\n\t\tclone = propsData.i\n\t\t\t? importNode.bind(null, node, true)\n\t\t\t: node.cloneNode.bind(node, true)\n\t\treturn clone()\n\t}\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() =>\n\t\t\tassignPartialProps(clone(), props, propsData),\n\t\t)\n\t}\n}\n\nfunction assignPartialProps(node, props, propsData) {\n\tif (props) {\n\t\tconst nodes = []\n\t\twalkElements(node, node => {\n\t\t\tnodes.push(node)\n\n\t\t\tif (nodes.length === propsData.m) return true\n\t\t})\n\n\t\twithXMLNS(propsData.x, xmlns => {\n\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\tassignProps(nodes[propsData[i] || i], props[i])\n\t\t\t}\n\t\t})\n\t}\n\n\treturn node instanceof DocumentFragment\n\t\t? toArray(node.childNodes)\n\t\t: node\n}\n\n/**\n * Assigns props to an element and creates its children\n *\n * @template P\n * @param {Element} node\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createNode(node, props) {\n\tif (props) {\n\t\tassignProps(node, props)\n\t}\n\treturn node\n}\n\n/**\n * Creates the children for a parent\n *\n * @param {Element} parent\n * @param {Children} child\n * @param {boolean} [relative]\n * @param {Text | undefined} [prev]\n * @returns {Children}\n */\nfunction createChildren(parent, child, relative, prev = undefined) {\n\tswitch (typeof child) {\n\t\t// string/number\n\t\tcase 'string':\n\t\tcase 'number': {\n\t\t\tif (prev instanceof Text) {\n\t\t\t\tprev.nodeValue = child\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn insertNode(parent, createTextNode(child), relative)\n\t\t}\n\n\t\tcase 'function': {\n\t\t\t// component\n\t\t\tif (isComponent(child)) {\n\t\t\t\treturn createChildren(parent, untrack(child), relative)\n\t\t\t}\n\n\t\t\tlet node = []\n\n\t\t\t// signal/memo/external/user provided function\n\t\t\t// needs placeholder to stay in position\n\t\t\tparent = createPlaceholder(\n\t\t\t\tparent,\n\t\t\t\tundefined /*child.name*/,\n\t\t\t\trelative,\n\t\t\t)\n\n\t\t\t// For\n\t\t\tif ($isMap in child) {\n\t\t\t\teffect(() => {\n\t\t\t\t\tnode = toDiff(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tchild(child => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Wrap the item with placeholders, for when stuff in\n\t\t\t\t\t\t\t * between moves. If a `Show` adds and removes nodes, we\n\t\t\t\t\t\t\t * dont have a reference to these nodes. By delimiting\n\t\t\t\t\t\t\t * with a shore, we can just handle anything in between\n\t\t\t\t\t\t\t * as a group.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst begin = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*begin*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst end = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*end*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn [begin, createChildren(end, child, true), end]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\tcleanup(() => {\n\t\t\t\t\ttoDiff(node)\n\t\t\t\t\tparent.remove()\n\t\t\t\t})\n\t\t\t\treturn [node, parent]\n\t\t\t}\n\n\t\t\t// maybe a signal so needs an effect\n\n\t\t\teffect(() => {\n\t\t\t\tnode = toDiff(node, [\n\t\t\t\t\tcreateChildren(parent, child(), true, node[0]),\n\t\t\t\t])\n\t\t\t})\n\n\t\t\tcleanup(() => {\n\t\t\t\ttoDiff(node)\n\t\t\t\tparent.remove()\n\t\t\t})\n\t\t\t/**\n\t\t\t * A placeholder is created and added to the document but doesnt\n\t\t\t * form part of the children. The placeholder needs to be\n\t\t\t * returned so it forms part of the group of children. If\n\t\t\t * children are moved and the placeholder is not moved with\n\t\t\t * them, then, whenever children update these will be at the\n\t\t\t * wrong place. wrong place: where the placeholder is and not\n\t\t\t * where the children were moved to\n\t\t\t */\n\t\t\treturn [node, parent]\n\t\t}\n\n\t\tcase 'object': {\n\t\t\t// HTMLElement/Text\n\t\t\tif (child instanceof HTMLElement || child instanceof Text) {\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// children/fragments\n\t\t\tif (isArray(child)) {\n\t\t\t\treturn child.length === 1\n\t\t\t\t\t? createChildren(parent, child[0], relative)\n\t\t\t\t\t: child.map(child =>\n\t\t\t\t\t\t\tcreateChildren(parent, child, relative),\n\t\t\t\t\t\t)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The value is `null`, as in {null} or like a show returning\n\t\t\t * `null` on the falsy case\n\t\t\t */\n\t\t\tif (child === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Node/DocumentFragment\n\t\t\tif (child instanceof Node) {\n\t\t\t\t/**\n\t\t\t\t * DocumentFragment are special as only the children get added\n\t\t\t\t * to the document and the document becomes empty. If we dont\n\t\t\t\t * insert them 1 by 1 then we wont have a reference to them\n\t\t\t\t * for deletion on cleanup with node.remove()\n\t\t\t\t */\n\t\t\t\tif (child instanceof DocumentFragment) {\n\t\t\t\t\treturn createChildren(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\ttoArray(child.childNodes),\n\t\t\t\t\t\trelative,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// async components\n\t\t\tif ('then' in child) {\n\t\t\t\tconst [value, setValue] = signal(undefined)\n\n\t\t\t\tconst onResult = result =>\n\t\t\t\t\tisConnected(parent) && setValue(result)\n\n\t\t\t\tresolved(child, onResult)\n\n\t\t\t\treturn createChildren(parent, value, relative)\n\t\t\t}\n\n\t\t\t// iterable/Map/Set/NodeList\n\t\t\tif (iterator in child) {\n\t\t\t\treturn createChildren(\n\t\t\t\t\tparent,\n\t\t\t\t\ttoArray(child.values()),\n\t\t\t\t\trelative,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// CSSStyleSheet\n\t\t\tif (child instanceof CSSStyleSheet) {\n\t\t\t\t/**\n\t\t\t\t * Custom elements wont report a document unless is already\n\t\t\t\t * connected. So our stylesheet would end on the main document\n\t\t\t\t * intead of the shadodRoot\n\t\t\t\t */\n\t\t\t\tonFixes(() => {\n\t\t\t\t\tif (isConnected(parent)) {\n\t\t\t\t\t\tconst doc = getDocumentForElement(parent)\n\t\t\t\t\t\tadoptedStyleSheetsAdd(doc, child)\n\n\t\t\t\t\t\tcleanup(() => adoptedStyleSheetsRemove(doc, child))\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// object.toString fancy objects\n\t\t\treturn createChildren(\n\t\t\t\tparent,\n\t\t\t\t// Object.create(null) would fail to convert to string\n\t\t\t\t'toString' in child ? child.toString() : stringify(child),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t\tcase 'undefined': {\n\t\t\treturn undefined\n\t\t}\n\t\tdefault: {\n\t\t\t// boolean/bigint/symbol/catch all\n\t\t\t// toString() is needed for `Symbol`\n\t\t\treturn insertNode(\n\t\t\t\tparent,\n\t\t\t\tcreateTextNode(child.toString()),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t}\n}\n\npropsPlugin(\n\t'children',\n\t(node, propName, propValue) => createChildren(node, propValue),\n\tfalse,\n)\n\n/**\n * Creates placeholder to keep nodes in position\n *\n * @param {Element} parent\n * @param {unknown} text\n * @param {boolean} [relative]\n * @returns {Element}\n */\nconst createPlaceholder = (parent, text, relative) => {\n\treturn insertNode(parent, createTextNode(''), relative)\n\n\t/* dev\n\treturn insertNode(\n\t\tparent,\n\t\tdocument.createComment(\n\t\t\t(text || '') + (relative ? ' relative' : ''),\n\t\t),\n\t\trelative,\n\t) */\n}\n\nconst head = document.head\n\n/**\n * Adds the element to the document\n *\n * @param {Element} parent\n * @param {Element &\n * \tHTMLTitleElement &\n * \tHTMLMetaElement &\n * \tHTMLLinkElement} node\n * @param {boolean} [relative]\n * @returns {Element}\n */\n\nfunction insertNode(parent, node, relative) {\n\t// special case `head`\n\tif (parent === head) {\n\t\tconst name = node.localName\n\n\t\t// search for tags that should be unique\n\t\tlet prev\n\t\tif (name === 'title') {\n\t\t\tprev = querySelector(head, 'title')\n\t\t} else if (name === 'meta') {\n\t\t\tprev =\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[name=\"' + node.getAttribute('name') + '\"]',\n\t\t\t\t) ||\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[property=\"' + node.getAttribute('property') + '\"]',\n\t\t\t\t)\n\t\t} else if (name === 'link' && node.rel === 'canonical') {\n\t\t\tprev = querySelector(head, 'link[rel=\"canonical\"]')\n\t\t}\n\n\t\t// replace old node if there's any\n\t\tprev ? prev.replaceWith(node) : parent.appendChild(node)\n\t} else {\n\t\trelative ? parent.before(node) : parent.appendChild(node)\n\t}\n\n\treturn node\n}\n\n// RENDERING\n\n/**\n * WARNINGS Removal of the element on where you render/insert into,\n * wont cause disposal of what you render/insert.\n */\n\n/**\n * Inserts children into a parent\n *\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * document.body\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n * @returns {Function} Disposer\n * @url https://pota.quack.uy/render\n */\nexport function render(children, parent, options = nothing) {\n\tconst dispose = root(dispose => {\n\t\tinsert(children, parent, options)\n\t\treturn dispose\n\t})\n\n\t// run dispose when the parent scope disposes\n\tcleanup(dispose)\n\n\treturn dispose\n}\n\n/**\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * `document.body`\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n */\nexport function insert(\n\tchildren,\n\tparent = document.body,\n\toptions = nothing,\n) {\n\tif (options.clear && parent) parent.textContent = ''\n\n\tconst node = createChildren(\n\t\tparent,\n\t\tisComponentable(children) ? Factory(children) : children,\n\t\toptions.relative,\n\t)\n\n\tcleanup(() => toDiff([node].flat(Infinity)))\n\n\treturn node\n}\n\n/**\n * Creates and returns HTML Elements for `children`\n *\n * @param {Children} children\n * @returns {Children}\n * @url https://pota.quack.uy/toHTML\n */\nexport const toHTML = children =>\n\t/**\n\t * DocumentFragment is transformed to an `Array` of `Node/Element`,\n\t * that way we can keep a reference to the nodes. Because when the\n\t * DocumentFragment is used, it removes the nodes from the\n\t * DocumentFragment and then we will lose the reference.\n\t */\n\n\tflat(toHTMLFragment(children).childNodes)\n\n/**\n * Creates and returns a DocumentFragment for `children`\n *\n * @param {Children} children\n * @returns {DocumentFragment}\n * @url https://pota.quack.uy/toHTML\n */\nexport function toHTMLFragment(children) {\n\tconst fragment = new DocumentFragment()\n\tcreateChildren(fragment, children)\n\n\treturn fragment\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {Function & { Provider: ({ value }) => Children }}\n * Context\n * @url https://pota.quack.uy/Reactivity/Context\n */\n/* #__NO_SIDE_EFFECTS__ */ export function context(\n\tdefaultValue = undefined,\n) {\n\t/** @type {Function & { Provider: ({ value }) => Children }} */\n\tconst ctx = Context(defaultValue)\n\n\t/**\n\t * Sets the `value` for the context\n\t *\n\t * @param {object} props\n\t * @param {any} props.value\n\t * @param {Children} [props.children]\n\t * @returns {Children} Children\n\t * @url https://pota.quack.uy/Reactivity/Context\n\t */\n\tctx.Provider = props =>\n\t\tctx(props.value, () => toHTML(props.children))\n\n\treturn ctx\n}\n\n/**\n * Removes from the DOM `prev` elements not found on `next`\n *\n * @param {Element[]} prev - Array with previous elements\n * @param {Element[]} next - Array with next elements\n * @returns {Element[]}\n */\nfunction toDiff(prev = [], next = []) {\n\tnext = next.flat(Infinity)\n\tfor (let i = 0, item; i < prev.length; i++) {\n\t\titem = prev[i]\n\t\titem &&\n\t\t\t(next.length === 0 || !next.includes(item)) &&\n\t\t\titem.remove()\n\t}\n\treturn next\n}\n","import { signal, cleanup, syncEffect } from '../lib/reactive.js'\nimport { isIterable, toArray } from '../lib/std.js'\n\n/**\n * Returns a `isSelected` function that will return `true` when the\n * argument for it matches the original signal `value`.\n *\n * @param {Signal} value - Signal with the current value\n * @returns {(item: any) => Signal} Signal that you can run with a\n * value to know if matches the original signal\n */\nexport function useSelector(value) {\n\tconst map = new Map()\n\n\tlet prev = []\n\n\tsyncEffect(() => {\n\t\tconst val = value()\n\n\t\tconst selected = isIterable(val) ? toArray(val.values()) : [val]\n\n\t\t// unselect\n\t\tfor (const value of prev) {\n\t\t\tif (!selected.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(false)\n\t\t\t}\n\t\t}\n\n\t\t// select\n\t\tfor (const value of selected) {\n\t\t\tif (!prev.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(true)\n\t\t\t}\n\t\t}\n\n\t\tprev = selected\n\t})\n\n\t/**\n\t * Is selected function, it will return `true` when the value\n\t * matches the current signal.\n\t *\n\t * @param {any} item - Values to compare with current\n\t * @returns {Signal} A signal with a boolean value\n\t */\n\treturn function isSelected(item) {\n\t\tlet selected = map.get(item)\n\t\tif (!selected) {\n\t\t\tselected = signal(prev.includes(item))\n\t\t\tselected.counter = 0\n\t\t\tmap.set(item, selected)\n\t\t}\n\n\t\tselected.counter++\n\n\t\tcleanup(() => {\n\t\t\tif (--selected.counter === 0) {\n\t\t\t\tmap.delete(item)\n\t\t\t}\n\t\t})\n\n\t\treturn selected.read\n\t}\n}\n","export const now = () => Date.now()\n\nexport function date(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\to.getFullYear() +\n\t\t'-' +\n\t\t(o.getMonth() + 1 < 10 ? '0' : '') +\n\t\t(o.getMonth() + 1) +\n\t\t'-' +\n\t\t(o.getDate() < 10 ? '0' : '') +\n\t\to.getDate()\n\t)\n}\n\nexport function datetime(timestamp = now()) {\n\treturn date(timestamp) + ' ' + time(timestamp)\n}\n\nexport function time(timestamp = now()) {\n\treturn timeWithSeconds(timestamp).slice(0, -3)\n}\n\nexport function timeWithSeconds(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\t(o.getHours() < 10 ? '0' : '') +\n\t\to.getHours() +\n\t\t':' +\n\t\t(o.getMinutes() < 10 ? '0' : '') +\n\t\to.getMinutes() +\n\t\t':' +\n\t\t(o.getSeconds() < 10 ? '0' : '') +\n\t\to.getSeconds()\n\t)\n}\n\nexport function day(timestamp = now(), lang = 'en') {\n\tconst o = new Date(timestamp)\n\n\t// saturday, September 17, 2016\n\treturn o.toLocaleDateString(lang, {\n\t\tweekday: 'long',\n\t\tyear: 'numeric',\n\t\tmonth: 'long',\n\t\tday: 'numeric',\n\t})\n}\n\nexport function measure(name, cb) {\n\tconsole.time(name)\n\tconst r = cb()\n\tconsole.timeEnd(name)\n\treturn r\n}\n\nexport function timing(fn) {\n\tconst start = performance.now()\n\tfn()\n\treturn performance.now() - start\n}\n","import { makeCallback, map } from '../lib/reactive.js'\nimport {\n\tactiveElement,\n\tdocumentElement,\n\tisConnected,\n} from '../lib/std.js'\n\nimport { onFixes } from '../scheduler.js'\n\n/**\n * Renders reactive values from an signal that returns an Iterable\n * object\n *\n * @template T\n * @param {object} props\n * @param {Each
} props.each\n * @param {boolean} [props.restoreFocus] - If the focused element\n * moves it may lose focus\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/For\n */\n\nexport const For = props =>\n\tmap(\n\t\t() => {\n\t\t\tprops.restoreFocus && queue()\n\t\t\treturn props.each\n\t\t},\n\t\tmakeCallback(props.children),\n\t\ttrue,\n\t)\n\nlet queued\n\n// because re-ordering the elements trashes focus\nfunction queue() {\n\tif (!queued) {\n\t\tqueued = true\n\n\t\tconst active = activeElement()\n\t\tconst scroll = documentElement.scrollTop\n\n\t\tonFixes(() => {\n\t\t\tqueued = false\n\t\t\t// re-ordering the elements trashes focus\n\t\t\tactive &&\n\t\t\t\tactive !== activeElement() &&\n\t\t\t\tisConnected(active) &&\n\t\t\t\tactive.focus()\n\n\t\t\tdocumentElement.scrollTop = scroll\n\t\t})\n\t}\n}\n","import { batch, render, signal } from 'pota'\nimport { useSelector } from 'pota/plugin/useSelector'\nimport { timing } from 'pota/plugin/useTime'\nimport { For } from 'pota/web'\n\nlet idCounter = 1\nconst adjectives = [\n 'pretty',\n 'large',\n 'big',\n 'small',\n 'tall',\n 'short',\n 'long',\n 'handsome',\n 'plain',\n 'quaint',\n 'clean',\n 'elegant',\n 'easy',\n 'angry',\n 'crazy',\n 'helpful',\n 'mushy',\n 'odd',\n 'unsightly',\n 'adorable',\n 'important',\n 'inexpensive',\n 'cheap',\n 'expensive',\n 'fancy',\n ],\n colours = [\n 'red',\n 'yellow',\n 'blue',\n 'green',\n 'pink',\n 'brown',\n 'purple',\n 'brown',\n 'white',\n 'black',\n 'orange',\n ],\n nouns = [\n 'table',\n 'chair',\n 'house',\n 'bbq',\n 'desk',\n 'car',\n 'pony',\n 'cookie',\n 'sandwich',\n 'burger',\n 'pizza',\n 'mouse',\n 'keyboard',\n ]\n\nfunction _random(max) {\n return Math.round(Math.random() * 1000) % max\n}\n\nfunction buildData(count) {\n let data = new Array(count)\n for (let i = 0; i < count; i++) {\n const [label, setLabel, updateLabel] = signal(\n `elegant green keyboard ${idCounter++}`,\n /* `${adjectives[_random(adjectives.length)]} ${\n colours[_random(colours.length)]\n } ${nouns[_random(nouns.length)]} ${idCounter++}`,*/\n )\n data[i] = {\n id: idCounter,\n label,\n updateLabel,\n }\n }\n return data\n}\n\nconst Button = ({ id, text, fn }) => (\n \n \n {text}\n \n
\n)\n\nconst App = () => {\n const [data, setData, updateData] = signal([]),\n [selected, setSelected] = signal(null),\n run = () => {\n // debugger\n setData(buildData(10))\n },\n runLots = () => {\n setData(buildData(10000))\n },\n bench = () => {\n // console.clear()\n // warm\n for (let k = 0; k < 5; k++) {\n setData(buildData(10000))\n setData([])\n }\n\n let createLarge = 0\n let clearLarge = 0\n let createSmall = 0\n let clearSmall = 0\n for (let k = 0; k < 10; k++) {\n createLarge += timing(() => setData(buildData(10000)))\n clearLarge += timing(() => setData([]))\n console.log(\n k + ' createLarge',\n createLarge / (k + 1),\n k + ' clearLarge',\n clearLarge / (k + 1),\n )\n }\n console.log('------------')\n for (let k = 0; k < 10; k++) {\n createSmall += timing(() => setData(buildData(1000)))\n clearSmall += timing(() => setData([]))\n console.log(\n k + ' createSmall',\n createSmall / (k + 1),\n k + ' clearSmall',\n clearSmall / (k + 1),\n )\n }\n },\n add = () => updateData(d => [...d, ...buildData(1000)]),\n update = () =>\n batch(() => {\n for (let i = 0, d = data(), len = d.length; i < len; i += 10)\n d[i].updateLabel(l => l + ' !!!')\n }),\n swapRows = () => {\n const d = data().slice()\n if (d.length > 998) {\n let tmp = d[1]\n d[1] = d[998]\n d[998] = tmp\n setData(d)\n }\n },\n clear = () => setData([]),\n remove = id =>\n updateData(d => {\n const idx = d.findIndex(datum => datum.id === id)\n d.splice(idx, 1)\n return [...d]\n }),\n isSelected = useSelector(selected)\n\n return (\n \n
\n
\n
\n
pota Keyed \n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n
{\n const element = e.target\n const { selectRow, removeRow } = element\n if (selectRow !== undefined) {\n setSelected(selectRow)\n } else if (removeRow !== undefined) {\n remove(removeRow)\n }\n }}\n >\n \n \n {row => {\n const { id, label } = row\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n )\n }}\n \n \n
\n
\n
\n )\n}\n\nrender(App, document.getElementById('main'))\n"],"names":["global","globalThis","window","CSSStyleSheet","document","DocumentFragment","Object","Symbol","queueMicrotask","assign","entries","freeze","getOwnPropertyDescriptors","getPrototypeOf","groupBy","isArray","Array","toArray","from","iterator","stringify","JSON","resolved","promise","onDone","then","catch","isConnected","node","activeElement","documentElement","call","fns","fn","bind","createElement","createElementNS","createTextNode","importNode","createTreeWalker","empty","create","flat","arr","length","withState","state","cacheStore","withCache","cache","thing","get","walkElements","walk","currentNode","nodeType","nextNode","getDocumentForElement","getRootNode","ownerDocument","getSetterNamesFromPrototype","object","set","Set","descriptors","key","add","getValue","value","isFunction","isIterable","isObject","isNullUndefined","undefined","isString","isPromise","noop","nothing","querySelector","query","removeFromArray","array","index","indexOf","splice","DataStore","constructor","kind","store","k","v","has","target","defaults","o","delete","Map","classListAdd","className","classList","classListRemove","remove","adoptedStyleSheetsGet","adoptedStyleSheets","adoptedStyleSheetsAdd","styleSheet","push","adoptedStyleSheetsRemove","sheet","css","replace","$isComponent","$isClass","$isReactive","$isMap","prefix","NS","__proto__","svg","math","html","xlink","CLEAN","STALE","CHECK","Owner","Listener","Updates","Effects","Time","Root","owner","owned","cleanups","context","options","dispose","i","Computation","updatedAt","sources","sourceSlots","update","time","prevOwner","prevListener","err","source","observers","observer","slot","pop","observerSlots","Effect","user","batch","SyncEffect","Signal","save","prev","read","markReactive","sourceSlot","write","equals","runUpdates","pure","downstream","a","b","root","signal","initialValue","effect","syncEffect","runWithOwner","untrack","cleanup","runTop","upstream","ancestors","updates","init","wait","res","runQueue","effects","runEffects","queue","userLength","ignore","Context","defaultValue","id","useContext","newValue","cb","args","isReactive","withValue","withPrevValue","val","map","list","callback","sort","duplicates","runId","rows","clear","Row","item","isDupe","disposer","nodes","begin","end","all","mapper","items","hasPrev","row","dupes","unsorted","every","includes","usort","before","nodesFromRow","after","current","previous","previousSibling","nextSibling","isComponent","isComponentable","makeCallback","children","callbacks","markComponent","child","r","addEventListener","type","handler","removeEventListener","ownedEvent","handleEvent","e","added","reset","priority","run","q","onFixes","onProps","onRef","onMount","ready","setEventNS","name","props","localName","ns","eventName","startsWith","toLowerCase","slice","plugins","pluginsNS","propsPlugin","propName","onMicrotask","plugin","propsPluginNS","NSName","propsPluginBoth","setAttributeNS","setAttribute","_setAttribute","removeAttributeNS","removeAttribute","setPropertyNS","setProperty","_setProperty","setUnknown","_setUnknown","setters","element","builtIn","elements","builtInSetters","proto","Element","nextProto","prototype","Node","setBoolNS","setBool","_setBool","setStyle","setNodeStyle","style","setStyleNS","setVarNS","setStyleValue","cssText","_setStyleValue","removeProperty","setClass","setClassList","setClassNS","setElementClass","_setClassListValue","trim","split","setValue","_setValue","textContent","randomId","crypto","getRandomValues","BigUint64Array","toString","setCSS","setNodeCSS","setRef","setOnMount","setUnmount","assignProps","assignProp","event","useXMLNS","Factory","createTag","createClass","createAnything","createNode","createComponent","component","render","tagName","xmlns","withXMLNS","nsContext","parseHTML","content","template","innerHTML","childNodes","firstChild","append","createPartial","propsData","clone","x","cloneNode","assignPartialProps","m","createChildren","parent","relative","Text","nodeValue","insertNode","createPlaceholder","toDiff","HTMLElement","onResult","result","values","doc","propValue","text","head","getAttribute","rel","replaceWith","appendChild","insert","body","Infinity","toHTML","toHTMLFragment","fragment","ctx","Provider","next","useSelector","selected","isSelected","counter","timing","start","performance","now","For","restoreFocus","each","queued","active","scroll","scrollTop","focus","_For","_createComponent","idCounter","buildData","count","data","label","setLabel","updateLabel","Button","_div","onClick","_Button","App","setData","updateData","setSelected","runLots","bench","createLarge","clearLarge","createSmall","clearSmall","console","log","d","len","l","swapRows","tmp","idx","findIndex","datum","_div2","selectRow","removeRow","_tr","class","danger","getElementById"],"mappings":";;;CAAO,MAAMA,MAAM,GAAGC,UAAU,CAAA;CACzB,MAAMC,MAAM,GAAGF,MAAM,CAAA;CAErB,MAAMG,aAAa,GAAGH,MAAM,CAACG,aAAa,CAAA;CAC1C,MAAMC,UAAQ,GAAGJ,MAAM,CAACI,QAAQ,CAAA;CAChC,MAAMC,gBAAgB,GAAGL,MAAM,CAACK,gBAAgB,CAAA;CAChD,MAAMC,QAAM,GAAGN,MAAM,CAACM,MAAM,CAAA;CAG5B,MAAMC,MAAM,GAAGP,MAAM,CAACO,MAAM,CAAA;CAC5B,MAAMC,cAAc,GAAGR,MAAM,CAACQ,cAAc,CAAA;CAE5C,MAAMC,MAAM,GAAGH,QAAM,CAACG,MAAM,CAAA;CAI5B,MAAMC,OAAO,GAAGJ,QAAM,CAACI,OAAO,CAAA;CAC9B,MAAMC,MAAM,GAAGL,QAAM,CAACK,MAAM,CAAA;CAI5B,MAAMC,yBAAyB,GACrCN,QAAM,CAACM,yBAAyB,CAAA;CAG1B,MAAMC,cAAc,GAAGP,QAAM,CAACO,cAAc,CAAA;CAC5C,MAAMC,OAAO,GAAGR,QAAM,CAACQ,OAAO,CAAA;CAQ9B,MAAMC,OAAO,GAAGC,KAAK,CAACD,OAAO,CAAA;CAC7B,MAAME,OAAO,GAAGD,KAAK,CAACE,IAAI,CAAA;C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;WAQjB,gBAAgBA,EAAAA,EAAAA;CAAG,SAAA,CAKvB,CAAC,CAAA;CAET,OAAA;MACG,CAAA;CAAC,GAAA,CAOP,CAAC,CAAA;CAEV,CAAC,CAAA;CAEDmJ,MAAM,CAAC6E,GAAG,EAAE7Z,QAAQ,CAACub,cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;"}
\ No newline at end of file
diff --git a/src/pages/benchmark/html/main.js b/src/pages/benchmark/html/main.js
index b938ad0..b74c72a 100644
--- a/src/pages/benchmark/html/main.js
+++ b/src/pages/benchmark/html/main.js
@@ -13,6 +13,8 @@
const assign = Object$1.assign;
const entries = Object$1.entries;
const freeze = Object$1.freeze;
+ const getOwnPropertyDescriptors = Object$1.getOwnPropertyDescriptors;
+ const getPrototypeOf = Object$1.getPrototypeOf;
const groupBy = Object$1.groupBy;
const isArray = Array.isArray;
const toArray = Array.from;
@@ -106,6 +108,15 @@
// always return a Document-like
return nodeType === 11 || nodeType === 9 ? document : node.ownerDocument;
};
+ function getSetterNamesFromPrototype(object, set = new Set()) {
+ const descriptors = getOwnPropertyDescriptors(object);
+ for (const key in descriptors) {
+ if (descriptors[key].set) {
+ set.add(key);
+ }
+ }
+ return set;
+ }
/**
* Unwraps values. If the argument is a function then it runs it
@@ -167,6 +178,14 @@
* @returns {boolean}
*/
const isString = value => typeof value === 'string';
+
+ /**
+ * Returns `true` when `value` may be a promise
+ *
+ * @param {any} value
+ * @returns {boolean}
+ */
+ const isPromise = value => isObject(value) && 'then' in value;
const noop = () => {};
/**
@@ -229,9 +248,9 @@
class DataStore {
constructor(kind) {
const store = new kind();
- const get = store.get.bind(store);
- const set = store.set.bind(store);
- const has = store.has.bind(store);
+ const get = k => store.get(k);
+ const set = (k, v) => store.set(k, v);
+ const has = k => store.has(k);
this.get = (target, defaults = undefined) => {
const o = get(target);
if (o !== undefined) {
@@ -249,7 +268,7 @@
};
this.set = set;
this.has = has;
- this.delete = store.delete.bind(store);
+ this.delete = k => store.delete(k);
}
*[Symbol.iterator]() {
yield this.get;
@@ -673,11 +692,9 @@
this.prev = value;
}
}
- this.read = markReactive(this.read.bind(this));
- this.write = this.write.bind(this);
- this.update = this.update.bind(this);
+ this.read = markReactive(this.read);
}
- read() {
+ read = () => {
// checkReadForbidden()
if (Listener) {
@@ -698,8 +715,8 @@
}
}
return this.value;
- }
- write(value) {
+ };
+ write = value => {
if (this.equals === false || !this.equals(this.value, value)) {
if (this.save) {
this.prev = this.value;
@@ -726,13 +743,13 @@
return true;
}
return false;
- }
- update(value) {
+ };
+ update = value => {
if (isFunction(value)) {
value = value(this.value);
}
return this.write(value);
- }
+ };
equals(a, b) {
return a === b;
}
@@ -759,7 +776,7 @@
Owner = root;
Listener = undefined;
try {
- return runUpdates(() => fn(root.dispose.bind(root)), true);
+ return runUpdates(() => fn(() => root.dispose()), true);
} finally {
Owner = prevOwner;
Listener = prevListener;
@@ -1079,12 +1096,21 @@
}
/**
- * Runs a function inside an effect if value is a function
+ * Runs a function inside an effect if value is a function.
+ * Aditionally unwraps promises.
*
* @param {any} value
* @param {(value) => any} fn
*/
- const withValue = (value, fn) => isFunction(value) ? effect(() => fn(getValue(value))) : fn(value);
+ const withValue = (value, fn) => {
+ if (isFunction(value)) {
+ effect(() => withValue(getValue(value), fn));
+ } else if (isPromise(value)) {
+ value.then(owned(value => withValue(value, fn)));
+ } else {
+ fn(value);
+ }
+ };
/**
* Runs a function inside an effect if value is a function
@@ -1559,7 +1585,7 @@
* @param {string} localName
* @param {string} ns
*/
- const setEventNS = (node, name, value, props, localName, ns) => addEventListener$1(node, localName, value);
+ const setEventNS = (node, name, value, props, localName, ns) => addEventListener$1(node, localName, ownedEvent(value));
/**
* Returns an event name when the string could be mapped to an event
@@ -1569,11 +1595,6 @@
* case isnt found
*/
const eventName = withCache(name => name.startsWith('on') && name.toLowerCase() in window ? name.slice(2).toLowerCase() : null);
- /*
- const eventNames = new Set(
- keys(global).filter(prop => prop.startsWith('on')),
- )
- */
const plugins = cacheStore();
const pluginsNS = cacheStore();
@@ -1718,8 +1739,73 @@
* @param {string} [ns]
*/
const setUnknown = (node, name, value, ns) => {
- name in node && !(node instanceof SVGElement) ? setProperty(node, name, value) : setAttribute(node, name, value, ns);
+ withValue(value, value => _setUnknown(node, name, value, ns));
+ };
+
+ /**
+ * @param {Element} node
+ * @param {string} name
+ * @param {unknown} value
+ * @param {string} [ns]
+ */
+ const _setUnknown = (node, name, value, ns) => {
+ if (typeof value !== 'string' && setters(node).element.has(name)) {
+ /**
+ * 1. First check in element because a custom-element may overwrite
+ * builtIn setters
+ * 2. Only do this when it's different to a string to avoid coarcing
+ * on native elements (ex: (img.width = '16px') === 0)
+ */
+ setProperty(node, name, value);
+ } else if (setters(node).builtIn.has(name)) {
+ // ex: innerHTML, textContent, draggable={true}
+ setProperty(node, name, value);
+ } else {
+ setAttribute(node, name, value, ns);
+ }
};
+ const elements = new Map();
+
+ /** @param {Element} node */
+ function setters(node) {
+ /**
+ * Use `node.constructor` instead of `node.nodeName` because it
+ * handles the difference between `a` `HTMLAnchorElement` and `a`
+ * `SVGAElement`
+ */
+ let setters = elements.get(node.constructor);
+ if (setters) return setters;
+ setters = {
+ builtIn: new Set(builtInSetters),
+ element: new Set()
+ };
+ elements.set(node.constructor, setters);
+ let store = setters.element;
+ let proto = getPrototypeOf(node);
+
+ /**
+ * Stop at `Element` instead of `HTMLElement` because it handles the
+ * difference between `HTMLElement`, `SVGElement`, `FutureElement`
+ * etc
+ */
+ while (proto.constructor !== Element) {
+ const nextProto = getPrototypeOf(proto);
+
+ /**
+ * The previous prototype to `Element` is a `builtIn`
+ * (`HTMLElement`, `SVGElement`,`FutureElement`, etc)
+ */
+ if (nextProto.constructor === Element) {
+ store = setters.builtIn;
+ }
+ getSetterNamesFromPrototype(proto, store);
+ proto = nextProto;
+ }
+ return setters;
+ }
+
+ /** Setters shared by all kind of elements */
+ const builtInSetters = getSetterNamesFromPrototype(Element.prototype, getSetterNamesFromPrototype(Node.prototype));
// BOOL ATTRIBUTES
@@ -1749,7 +1835,7 @@
*/
const _setBool = (node, name, value) =>
// if the value is falsy gets removed
- !value ? node.removeAttribute(name) : node.setAttribute(name, '');
+ value ? node.setAttribute(name, '') : node.removeAttribute(name);
// node style
@@ -1895,6 +1981,35 @@
// null, undefined or false, the class is removed
!value ? classListRemove(node, name) : classListAdd(node, ...name.trim().split(/\s+/));
+ /**
+ * `value` as a prop is special cased so the button `reset` in forms
+ * works as expected. The first time a value is set, its done as an
+ * attribute.
+ */
+ const setValue = (node, name, value) => withValue(value, value => _setValue(node, name, value));
+ const defaults = new Set();
+ function _setValue(node, name, value) {
+ if (!defaults.has(node)) {
+ defaults.add(node);
+ cleanup(() => defaults.delete(node));
+ if (!isNullUndefined(value)) {
+ switch (node.localName) {
+ case 'input':
+ {
+ node.setAttribute('value', value);
+ return;
+ }
+ case 'textarea':
+ {
+ node.textContent = value;
+ return;
+ }
+ }
+ }
+ }
+ _setProperty(node, name, value);
+ }
+
/** Returns true or false with a `chance` of getting `true` */
const randomId = () => crypto.getRandomValues(new BigUint64Array(1))[0].toString(36);
@@ -1947,11 +2062,9 @@
propsPluginNS('bool', setBoolNS, false);
propsPluginNS('on', setEventNS, false);
propsPluginNS('var', setVarNS, false);
- for (const item of ['value', 'textContent', 'innerText', 'innerHTML']) {
- propsPlugin(item, setProperty, false);
- }
propsPlugin('__dev', noop, false);
propsPlugin('xmlns', noop, false);
+ propsPlugin('value', setValue, false);
propsPluginBoth('css', setCSS, false);
propsPluginBoth('onMount', setOnMount, false);
propsPluginBoth('onUnmount', setUnmount, false);
@@ -1984,12 +2097,6 @@
* @param {object} props
*/
function assignProp(node, name, value, props) {
- // unwrap promises
- if (isObject(value) && 'then' in value) {
- value.then(owned(value => assignProp(node, name, getValue(value), props)));
- return;
- }
-
// run plugins
let plugin = plugins.get(name);
if (plugin) {
@@ -2570,9 +2677,7 @@
* @param {boolean} value
*/
set hidden(value) {
- withValue(value, value => {
- value ? setAttribute$1(this, 'hidden', '') : removeAttribute(this, 'hidden');
- });
+ value ? setAttribute$1(this, 'hidden', '') : removeAttribute(this, 'hidden');
}
/* EVENTS API */
@@ -2615,12 +2720,9 @@
}
`];
- /**
- * @template T
- * @param {When} value - To toggle children
- */
+ /** @param {any} value - To toggle children */
set when(value) {
- withValue(value, value => this.html = value ? ' ' : '');
+ this.html = value ? ' ' : '';
}
}
const name = 'pota-collapse';
diff --git a/src/pages/benchmark/html/main.js.map b/src/pages/benchmark/html/main.js.map
index 058a45b..886d883 100644
--- a/src/pages/benchmark/html/main.js.map
+++ b/src/pages/benchmark/html/main.js.map
@@ -1 +1 @@
-{"version":3,"file":"main.js","sources":["../../../../../pota/src/lib/std.js","../../../../../pota/src/constants.js","../../../../../pota/src/lib/reactive.js","../../../../../pota/src/scheduler.js","../../../../../pota/src/props/event.js","../../../../../pota/src/props/plugin.js","../../../../../pota/src/props/attribute.js","../../../../../pota/src/props/property.js","../../../../../pota/src/props/unknown.js","../../../../../pota/src/props/bool.js","../../../../../pota/src/props/style.js","../../../../../pota/src/props/class.js","../../../../../pota/src/plugin/useRandom.js","../../../../../pota/src/props/css.js","../../../../../pota/src/props/lifecycle.js","../../../../../pota/src/props/@main.js","../../../../../pota/src/renderer.js","../../../../../pota/src/web/CustomElement.js","../../../../../pota/src/web/Collapse.js","../../../../../pota/src/web/Dynamic.js","../../../../../pota/src/web/For.js","../../../../../pota/src/web/Portal.js","../../../../../pota/src/web/Head.js","../../../../../pota/src/plugin/useScroll.js","../../../../../pota/src/plugin/useURL.js","../../../../../pota/src/web/router/context.js","../../../../../pota/src/plugin/useLocation.js","../../../../../pota/src/web/Show.js","../../../../../pota/src/web/router/scroll.js","../../../../../pota/src/web/router/router.js","../../../../../pota/src/web/router/link.js","../../../../../pota/src/web/Switch.js","../../../../../pota/src/html.js","../../../../../pota/src/plugin/useSelector.js","../../../../../pota/src/plugin/useTime.js","index.jsx"],"sourcesContent":["export const global = globalThis\nexport const window = global\n\nexport const CSSStyleSheet = global.CSSStyleSheet\nexport const document = global.document\nexport const DocumentFragment = global.DocumentFragment\nexport const Object = global.Object\nexport const Promise = global.Promise\nexport const requestAnimationFrame = global.requestAnimationFrame\nexport const Symbol = global.Symbol\nexport const queueMicrotask = global.queueMicrotask\n\nexport const assign = Object.assign\nexport const create = Object.create\nexport const defineProperties = Object.defineProperties\nexport const defineProperty = Object.defineProperty\nexport const entries = Object.entries\nexport const freeze = Object.freeze\nexport const fromEntries = Object.fromEntries\nexport const getOwnPropertyDescriptor =\n\tObject.getOwnPropertyDescriptor\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors\nexport const getOwnPropertyNames = Object.getOwnPropertyNames\nexport const getOwnPropertySymbols = Object.getOwnPropertySymbols\nexport const getPrototypeOf = Object.getPrototypeOf\nexport const groupBy = Object.groupBy\nexport const hasOwnProperty = Object.hasOwn\nexport const is = Object.is\nexport const isExtensible = Object.isExtensible\nexport const keys = Object.keys\nexport const values = Object.values\nexport const setPrototypeOf = Object.setPrototypeOf\n\nexport const isArray = Array.isArray\nexport const toArray = Array.from\n\nexport const isNaN = Number.isNaN\n\nexport const iterator = Symbol.iterator\n\nexport const stringify = JSON.stringify\nexport const stringifyReadable = o => stringify(o, null, 2)\n\nexport const stringifySorted = o => {\n\tfunction sort(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\t\tconst tmp = isArray(o) ? [] : {}\n\t\tkeys(o)\n\t\t\t.sort()\n\t\t\t.map(k => (tmp[k] = sort(o[k])))\n\n\t\tif (isArray(tmp)) {\n\t\t\ttmp.sort((a, b) => stringify(a).localeCompare(stringify(b)))\n\t\t}\n\t\treturn tmp\n\t}\n\treturn stringifyReadable(sort(o))\n}\n\nexport const PrototypeArray = Array.prototype\nexport const PrototypeMap = Map.prototype\n\nexport const history = global.history\nexport const location = global.location\nexport const navigator = global.navigator\n\nexport const origin = location.origin\n\nexport const promise = fn => new Promise(fn)\n\nexport const withResolvers = () => Promise.withResolvers()\n\n/**\n * Given a promise it adds `onDone` to `then` and `catch`\n *\n * ```js\n * resolved(promise, onDone)\n * // is same as\n * promise.then(onDone).catch(onDone)\n * ```\n */\nexport const resolved = (promise, onDone) =>\n\tpromise.then(onDone).catch(onDone)\n\nexport const setAttribute = (node, name, value) =>\n\tnode.setAttribute(name, value)\n\nexport const hasAttribute = (node, name) => node.hasAttribute(name)\n\nexport const removeAttribute = (node, name) =>\n\tnode.removeAttribute(name)\n\nexport const setAttributeNS = (node, name, value) =>\n\tnode.setAttributeNS(name, value)\n\nexport const hasAttributeNS = (node, name) =>\n\tnode.hasAttributeNS(name)\n\nexport const removeAttributeNS = (node, name) =>\n\tnode.removeAttributeNS(name)\n\nexport const isConnected = node => node.isConnected\n\nexport const activeElement = () => document.activeElement\n\nexport const documentElement = document.documentElement\n\n/**\n * Runs an array of functions\n *\n * @param {Iterable} fns\n */\nexport const call = fns => {\n\tfor (const fn of fns) fn()\n}\n\nexport function copy(o) {\n\tconst seen = new Map()\n\tfunction copy(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (\n\t\t\to instanceof Node ||\n\t\t\to instanceof Date ||\n\t\t\to instanceof Set ||\n\t\t\to instanceof Map ||\n\t\t\to instanceof WeakSet ||\n\t\t\to instanceof WeakMap ||\n\t\t\to instanceof Promise ||\n\t\t\to instanceof RegExp\n\t\t) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (seen.has(o)) {\n\t\t\treturn seen.get(o)\n\t\t}\n\n\t\tconst c = isArray(o) ? [] : {}\n\n\t\tseen.set(o, c)\n\n\t\tfor (const k in o) {\n\t\t\tc[k] = copy(o[k])\n\t\t}\n\t\treturn c\n\t}\n\treturn copy(o)\n}\n\n/**\n * Object.defineProperty with `enumerable` and `configurable` set to\n * `true` unless overwriten by `descriptor` argument\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n */\nexport const redefineProperty = (target, key, descriptor) =>\n\tdefineProperty(target, key, assign(create(defaults), descriptor))\n\nconst defaults = {\n\t__proto__: null,\n\tconfigurable: true,\n\tenumerable: true,\n}\n\n/**\n * Object.defineProperty with `configurable`, `writable` and\n * `enumerable` as `false`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {any} value\n */\nexport const definePropertyReadOnly = (target, key, value) => {\n\tconst descriptor = create(defaultsReadOnly)\n\tdescriptor.value = value\n\tdefineProperty(target, key, descriptor)\n}\n\nconst defaultsReadOnly = {\n\t__proto__: null,\n\tconfigurable: false,\n\tenumerable: false,\n\twritable: false,\n\tvalue: undefined,\n}\n\nconst bind = fn => document[fn].bind(document)\n\nexport const createElement = bind('createElement')\n\nexport const createElementNS = bind('createElementNS')\n\nexport const createTextNode = bind('createTextNode')\n\nexport const importNode = bind('importNode')\n\nexport const createTreeWalker = bind('createTreeWalker')\n\n/**\n * Returns an object without a prototype\n *\n * @type {Function}\n * @returns {Props} Empty object\n */\nexport const empty = Object.create.bind(null, null)\n\nexport function* entriesIncludingSymbols(target) {\n\tfor (const item of entries(target)) {\n\t\tyield item\n\t}\n\n\tfor (const item of getOwnPropertySymbols(target)) {\n\t\t// todo: causes access!\n\t\tyield [item, target[item]]\n\t}\n}\n\n// modified version of https://github.com/epoberezkin/fast-deep-equal\n\nexport function equals(a, b) {\n\tif (a === b) {\n\t\treturn true\n\t}\n\n\tif (a && b && typeof a == 'object' && typeof b == 'object') {\n\t\tif (a.constructor !== b.constructor) {\n\t\t\treturn false\n\t\t}\n\n\t\tlet length, i, k\n\t\tif (isArray(a)) {\n\t\t\tlength = a.length\n\t\t\tif (length != b.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor (i = length; i-- !== 0; ) {\n\t\t\t\tif (!equals(a[i], b[i])) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif (a.constructor === RegExp)\n\t\t\treturn a.source === b.source && a.flags === b.flags\n\t\tif (a.valueOf !== Object.prototype.valueOf)\n\t\t\treturn a.valueOf() === b.valueOf()\n\t\tif (a.toString !== Object.prototype.toString)\n\t\t\treturn a.toString() === b.toString()\n\n\t\tk = keys(a)\n\t\tlength = k.length\n\t\tif (length !== keys(b).length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(b, k[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tvar key = k[i]\n\n\t\t\tif (!equals(a[key], b[key])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// true if both NaN, false otherwise\n\treturn a !== a && b !== b\n}\n\n/**\n * Flats an array/childNodes to the first children if the length is 1\n *\n * @param {any[] | NodeListOf} arr\n * @returns {any}\n */\nexport const flat = arr => (arr.length === 1 ? arr[0] : arr)\n\n/**\n * Keeps state in the function as the first param\n *\n * @template T\n * @param {T} fn - Function to which add state to it\n * @param {DataStore | DataStore} [state] - Passed to\n * `fn` as first param\n * @returns {T} A copy of the function with the state\n */\nexport const withState = /* #__NO_SIDE_EFFECTS__ */ (\n\tfn,\n\tstate = cacheStore,\n) => fn.bind(null, state())\n\n/** Memoize functions with a map cache */\nexport const withCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tcacheStore,\n\t)\n/** Memoize functions with a weak cache */\nexport const withWeakCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tweakStore,\n\t)\n\nexport const walkElements = withState(\n\t(walk, node, fn) => {\n\t\twalk.currentNode = node\n\n\t\t/**\n\t\t * The first node is not walked by the walker.\n\t\t *\n\t\t * Also the first node could be a DocumentFragment\n\t\t */\n\t\tif (node.nodeType === 1) {\n\t\t\tif (fn(node)) return\n\t\t}\n\n\t\twhile ((node = walk.nextNode())) {\n\t\t\tif (fn(node)) break\n\t\t}\n\t},\n\t() => createTreeWalker(document, 1 /*NodeFilter.SHOW_ELEMENT*/),\n)\n\n/**\n * Returns `document` for element. That could be a `shadowRoot`\n *\n * @param {Element} node\n * @returns {Document | ShadowRoot}\n */\n\nexport const getDocumentForElement = node => {\n\tconst document = node.getRootNode()\n\tconst { nodeType } = document\n\t// getRootNode returns:\n\t// 1. Node for isConnected = false\n\t// 2. Document for isConnected = true\n\t// 3. shadowRoot for custom elements\n\n\t// always return a Document-like\n\treturn nodeType === 11 || nodeType === 9\n\t\t? document\n\t\t: node.ownerDocument\n}\n\nexport const getOwnValues = o =>\n\tgetOwnPropertyNames(o).map(key => {\n\t\ttry {\n\t\t\treturn o[key]\n\t\t} catch (e) {}\n\t})\n\n/**\n * Unwraps values. If the argument is a function then it runs it\n * recursively and returns the value\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValue(value) {\n\twhile (typeof value === 'function') value = value()\n\treturn value\n}\n\n/**\n * Unwraps `value` and returns `element` if result is a `Node`, else\n * `undefined` in the case isn't a `Node`\n *\n * @param {Function | any} value - Maybe function\n * @param {...any} args? - Arguments\n * @returns {Node | undefined}\n */\nexport function getValueElement(value, ...args) {\n\tconst element = getValueWithArguments(value, ...args)\n\treturn element instanceof Node ? element : undefined\n}\n\nexport const getValueWithArguments = (value, ...args) =>\n\ttypeof value === 'function'\n\t\t? args.length\n\t\t\t? getValue(value(...args))\n\t\t\t: getValue(value())\n\t\t: value\n\n/**\n * Identity function, given `x` returns `x`\n *\n * @template T\n * @param {T} x\n * @returns {T}\n */\nexport const identity = x => x\n\n/**\n * When `value` is an object, it will check if the `key` on `target`\n * is `configurable`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {boolean | undefined} value\n */\nexport const isConfigurable = (target, key, value) => {\n\tif (isObject(value)) {\n\t\tconst descriptor = getOwnPropertyDescriptor(target, key)\n\t\tif (descriptor) {\n\t\t\treturn descriptor.configurable\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Returns `true` when `typeof` of `value` is `function`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isFunction = value => typeof value === 'function'\n\n/**\n * Returns `true` when value is Iterable\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isIterable = value =>\n\tisObject(value) && 'values' in value\n\n/**\n * Returns `true` if the value is `null` or `undefined`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNullUndefined = value =>\n\tvalue === undefined || value === null\n\n/**\n * Returns `true` when typeof of value is object and not null\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isObject = value =>\n\tvalue !== null && typeof value === 'object'\n\n/**\n * Returns `true` when object morphed between array/object\n *\n * @param {any} a\n * @param {any} b\n * @returns {boolean}\n */\nexport const morphedBetweenArrayAndObject = (a, b) =>\n\t(isObject(a) && !isObject(b)) ||\n\t(isObject(b) && !isObject(a)) ||\n\t(isArray(a) && !isArray(b)) ||\n\t(isArray(b) && !isArray(a))\n\n/**\n * Returns `true` if the property is defined in the `prototype` and\n * absent in the `object`\n *\n * @param {object} target\n * @param {PropertyKey} key\n */\nexport const isPrototypeProperty = (target, key) =>\n\t// must do `key in target` to check that it DOES have it somewhere\n\t// must do !hasOwnProperty to check that isnt an own property\n\tkey in target && !hasOwnProperty(target, key)\n\n/**\n * Returns `true` when `typeof` of `value` is `string`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isString = value => typeof value === 'string'\n\n/**\n * Returns `true` when `typeof` of `value` is `number`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNumber = value => typeof value === 'number'\n\n/**\n * Returns `true` when `typeof` of `value` is `symbol`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isSymbol = value => typeof value === 'symbol'\n\n/**\n * Returns `true` when `typeof` of `value` is `boolean`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isBoolean = value => typeof value === 'boolean'\n\nexport const noop = () => {}\n\n/**\n * An empty frozen object\n *\n * @type object\n */\nexport const nothing = freeze(empty())\n\n// an optional value is `true` by default, so most of the time is undefined which means is `true`\n// to avoid having conditions like `if(something.bla === undefined || something.bla)`\n// this function will short it to `if(optional(something.bla))`\n// additionally the value is resolved, for cases like `when={() => show() && optional(props.when)}`\n\n/**\n * Returns `true` when value is true or undefined\n *\n * @param {Function | boolean | undefined} value\n * @returns {boolean} True when value is true or undefined\n */\nexport const optional = value =>\n\tvalue === undefined || getValue(value)\n\nexport const partAdd = (node, className) => node.part.add(className)\n\nexport const partRemove = (node, className) =>\n\tnode.part.remove(className)\n\nexport const querySelector = (node, query) =>\n\tnode.querySelector(query)\n\nexport const querySelectorAll = (node, query) =>\n\tnode.querySelectorAll(query)\n\nexport function* range(start, stop, step = 1) {\n\tyield start\n\twhile (start < stop) {\n\t\tyield (start += step)\n\t}\n}\n\nexport const {\n\townKeys: reflectOwnKeys,\n\thas: reflectHas,\n\tdeleteProperty: reflectDeleteProperty,\n\tgetOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor,\n\tget: reflectGet,\n\tapply: reflectApply,\n\tset: reflectSet,\n} = Reflect\n\n/**\n * Removes a value from an array\n *\n * @template T\n * @param {T[]} array\n * @param {T} value To remove from the array\n * @returns {T[]}\n */\nexport function removeFromArray(array, value) {\n\tconst index = array.indexOf(value)\n\tif (index !== -1) array.splice(index, 1)\n\treturn array\n}\n/**\n * Removes values from an array based on a condition\n *\n * @template T\n * @param {T[]} array\n * @param {(value: T, index: number) => boolean} cb Function with\n * condition\n */\nexport function removeFromArrayConditionally(array, cb) {\n\tlet i = array.length\n\twhile (i--) {\n\t\tif (cb(array[i], i)) {\n\t\t\tarray.splice(i, 1)\n\t\t}\n\t}\n}\n/**\n * Removes values from an array based on a condition\n *\n * @param {Iterable} iterable\n * @param {PropertyKey} key Function with condition\n */\nexport function indexByKey(iterable, key) {\n\tconst byKey = empty()\n\tfor (const item of iterable) {\n\t\tbyKey[item[key]] = item\n\t}\n\treturn byKey\n}\n\n/**\n * Replace a prototype in the prototype chain with another prototype\n *\n * @param {object} target - Target object\n * @param {object} search - The prototype to replace\n * @param {object} replacement - The replacement prototype\n */\nexport function replacePrototypeWith(target, search, replacement) {\n\tlet prototype = target\n\twhile (getPrototypeOf(prototype) !== search) {\n\t\tprototype = getPrototypeOf(prototype)\n\t}\n\n\tsetPrototypeOf(prototype, replacement)\n}\n\nexport const typeString = obj =>\n\tObject.prototype.toString.call(obj).slice(8, -1)\n\nexport function walkParents(context, propertyName, cb) {\n\twhile (context) {\n\t\tif (cb(context)) return true\n\t\tcontext = context[propertyName]\n\t}\n}\n\n/**\n * Store template\n *\n * @typedef {(\n * \treference: any,\n * \tcreateIfNotExistsAs?: ((target: any) => any) | Function,\n * ) => any} DataStoreGet\n *\n *\n * @typedef {(key: any, value: any) => void} DataStoreSet\n *\n * @typedef {(key: any) => boolean} DataStoreHas\n *\n * @typedef {(key: any) => boolean} DataStoreDelete\n */\n\nclass DataStore {\n\tconstructor(kind) {\n\t\tconst store = new kind()\n\n\t\tconst get = store.get.bind(store)\n\t\tconst set = store.set.bind(store)\n\t\tconst has = store.has.bind(store)\n\n\t\tthis.get = (target, defaults = undefined) => {\n\t\t\tconst o = get(target)\n\n\t\t\tif (o !== undefined) {\n\t\t\t\treturn o\n\t\t\t}\n\n\t\t\tif (defaults !== undefined) {\n\t\t\t\t/**\n\t\t\t\t * Default values should be passed as a function, so we dont\n\t\t\t\t * constantly initialize values when giving them\n\t\t\t\t */\n\t\t\t\tdefaults = defaults(target)\n\t\t\t\tset(target, defaults)\n\t\t\t\treturn defaults\n\t\t\t}\n\t\t}\n\n\t\tthis.set = set\n\t\tthis.has = has\n\t\tthis.delete = store.delete.bind(store)\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.get\n\t\tyield this.set\n\t\tyield this.has\n\t\tyield this.delete\n\t}\n}\n\n/**\n * Creates a WeakMap to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdelete: DataStoreDelete\n * }}\n */\nexport const weakStore = () => new DataStore(WeakMap)\n\n/**\n * Creates a Map to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdel: DataStoreDelete\n * }}\n */\nexport const cacheStore = () => new DataStore(Map)\n\nexport const classListAdd = (node, className) =>\n\tnode.classList.add(className)\n\nexport const classListRemove = (node, className) =>\n\tnode.classList.remove(className)\n\n/**\n * - Returns `adoptedStyleSheets` for a document\n *\n * @param {Document | ShadowRoot} document\n */\nexport const adoptedStyleSheetsGet = document =>\n\tdocument.adoptedStyleSheets\n\nexport const adoptedStyleSheets =\n\t/* #__PURE__*/ adoptedStyleSheetsGet(document)\n\n/**\n * Adds a style sheet to the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsAdd = (document, styleSheet) =>\n\tadoptedStyleSheetsGet(document).push(styleSheet)\n\n/**\n * Removes a style sheet from the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsRemove = (document, styleSheet) =>\n\tremoveFromArray(adoptedStyleSheetsGet(document), styleSheet)\n\n/**\n * Adds a style sheet to the custom element\n *\n * @param {Document | ShadowRoot} document\n * @param {(CSSStyleSheet | string)[]} styleSheets\n */\nexport function addStyleSheets(document, styleSheets = []) {\n\tfor (const sheet of styleSheets) {\n\t\tif (sheet) {\n\t\t\tsheet instanceof CSSStyleSheet\n\t\t\t\t? adoptedStyleSheetsAdd(document, sheet)\n\t\t\t\t: addStyleSheetExternal(document, sheet)\n\t\t}\n\t}\n}\n\n/**\n * Adds the stylesheet from urls. It uses a cache, to avoid having to\n * fire a request for each external sheet when used in more than one\n * custom element. Also, all reference the same object.\n *\n * @param {Document | ShadowRoot} document\n * @param {string} text\n */\nexport const addStyleSheetExternal = withState(\n\t(state, document, text) => {\n\t\tstate\n\t\t\t.get(text, text =>\n\t\t\t\ttext.startsWith('http')\n\t\t\t\t\t? fetch(text)\n\t\t\t\t\t\t\t.then(r => r.text())\n\t\t\t\t\t\t\t.then(css => sheet(css))\n\t\t\t\t\t: promise(resolve => resolve(sheet(text))),\n\t\t\t)\n\t\t\t.then(styleSheet => adoptedStyleSheetsAdd(document, styleSheet))\n\t},\n)\n\n/**\n * Swaps classNames and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldClass - `class` with the old animation\n * @param {string} newClass - `class` with the new animation\n */\nexport const animateClassTo = (element, oldClass, newClass) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tclassListRemove(element, oldClass)\n\t\t\tclassListAdd(element, newClass)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Swaps parts and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldPart - `part` with the old animation\n * @param {string} newPart - `part` with the new animation\n */\nexport const animatePartTo = (element, oldPart, newPart) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tpartRemove(element, oldPart)\n\t\t\tpartAdd(element, newPart)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Creates tagged css and returns a CSSStyleSheet. Mostly for css\n * highlighting in js\n *\n * @param {TemplateStringsArray} template\n * @param {...any} values\n * @returns {CSSStyleSheet}\n */\nexport const css = (template, ...values) =>\n\tsheet(String.raw({ raw: template }, ...values))\n\n/**\n * Creates a stylesheet from a css string\n *\n * @param {string} css\n * @returns {CSSStyleSheet}\n */\nexport const sheet = withCache(css => {\n\tconst sheet = new CSSStyleSheet()\n\t/**\n\t * Replace is asynchronous and can accept @import statements\n\t * referencing external resources.\n\t */\n\tsheet.replace(css)\n\n\treturn sheet\n})\n\n/**\n * @param {Element} node\n * @param {string} eventName\n * @param {any} [data]\n */\n\nexport const emit = (\n\tnode,\n\teventName,\n\tdata = { bubbles: true, cancelable: true, composed: true },\n) => node.dispatchEvent(new CustomEvent(eventName, data))\n\nexport function stopEvent(e) {\n\tpreventDefault(e)\n\tstopPropagation(e)\n\tstopImmediatePropagation(e)\n}\n\nexport const preventDefault = e => e.preventDefault()\nexport const stopPropagation = e => e.stopPropagation()\nexport const stopImmediatePropagation = e =>\n\te.stopImmediatePropagation()\n\n/**\n * Waits for an event to be dispatched and runs a callback\n *\n * @param {Element} element\n * @param {string} eventName\n */\nexport const waitEvent = withState(\n\t(state, element, eventName) =>\n\t\tpromise((resolve, reject) => {\n\t\t\t/**\n\t\t\t * To prevent firing `transitionend` twice it needs to stop\n\t\t\t * listening the old one because maybe wasn't dispatched and\n\t\t\t * running a new transition will make it dispatch twice\n\t\t\t */\n\t\t\tconst previous = state.get(element, empty)\n\t\t\tprevious.reject && previous.reject()\n\t\t\telement.removeEventListener(eventName, previous.resolve)\n\t\t\tstate.set(element, { resolve, reject })\n\t\t\telement.addEventListener(eventName, resolve, {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t}),\n\tweakStore,\n)\n\nexport const addEventListenerObject = (where, type, handler) =>\n\twhere.addEventListener(type, handler, handler)\n\nexport const removeEventListenerObject = (where, type, handler) =>\n\twhere.removeEventListener(type, handler, handler)\n\n/** @param {EventListener} fn */\nexport const passiveEvent = fn => ({ handleEvent: fn, passive: true })\n","// symbols\n\nimport { Symbol } from './lib/std.js'\n\nexport const $isComponent = Symbol()\nexport const $isClass = Symbol()\nexport const $isReactive = Symbol()\nexport const $isMap = Symbol()\n\n// supported namespaces\n\nconst prefix = 'http://www.w3.org/'\n\n// when a tag/attribute is missing the namespace this puts it back in\n\nexport const NS = {\n\t__proto__: null,\n\tsvg: prefix + '2000/svg',\n\tmath: prefix + '1998/Math/MathML',\n\thtml: prefix + '1999/xhtml',\n\txlink: prefix + '1999/xlink',\n}\n","/**\n * This is so far the core of Solid JS Reactivity, this may change.\n *\n * Adaptation for potas needs have been made:\n *\n * - Ported to Classes what does fit\n * - Signal has more options: `label` and `save` previous value\n * - Writing to a signal returns `true` when the value changes\n * - Signal is an object that could be used as signal.read/write or\n * destructured as an array.\n * - Signals can save and wont run functions\n * - `update` function on Signal that could be used to use the old value\n */\n\nimport {\n\t$isClass,\n\t$isComponent,\n\t$isMap,\n\t$isReactive,\n} from '../constants.js'\n\nimport {\n\tassign,\n\tentries,\n\tflat,\n\tgetValue,\n\tgroupBy,\n\tisArray,\n\tisFunction,\n\tisIterable,\n\tisObject,\n\tkeys,\n\tnothing,\n\tqueueMicrotask,\n\tremoveFromArray,\n\tresolved,\n\tSymbol,\n\tweakStore,\n\twithResolvers,\n\twithState,\n\twithWeakCache,\n} from './std.js'\n\nconst CLEAN = 0\nconst STALE = 1\nconst CHECK = 2\n\nlet Owner\nlet Listener\n\nlet Updates = null\nlet Effects = null\n\nlet Time = 0\n\n// ROOT\n\nclass Root {\n\towner\n\towned\n\n\tcleanups\n\n\tcontext\n\n\tconstructor(owner, options) {\n\t\tthis.owner = owner\n\t\tthis.context = owner?.context\n\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t}\n\t}\n\n\tdispose() {\n\t\tlet i\n\n\t\tconst { owned, cleanups } = this\n\n\t\tif (owned) {\n\t\t\tfor (i = owned.length - 1; i >= 0; i--) {\n\t\t\t\towned[i].dispose()\n\t\t\t}\n\t\t\towned.length = 0\n\t\t}\n\t\tif (cleanups) {\n\t\t\tfor (i = cleanups.length - 1; i >= 0; i--) {\n\t\t\t\tcleanups[i]()\n\t\t\t}\n\t\t\tcleanups.length = 0\n\t\t}\n\t}\n}\n\n// COMPUTATION\n\nclass Computation extends Root {\n\tstate = STALE\n\n\tupdatedAt = 0\n\n\tfn\n\n\tsources\n\tsourceSlots\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, options)\n\n\t\tthis.fn = fn\n\n\t\tif (owner) {\n\t\t\tif (owner.owned) {\n\t\t\t\towner.owned.push(this)\n\t\t\t} else {\n\t\t\t\towner.owned = [this]\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tthis.fn()\n\t\t} catch (err) {\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\n\t\tif (this.updatedAt <= time) {\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n\n\tdispose() {\n\t\tconst { sources, sourceSlots } = this\n\n\t\tif (sources) {\n\t\t\tlet source\n\t\t\tlet observers\n\t\t\tlet index\n\n\t\t\tlet observer\n\t\t\tlet slot\n\t\t\twhile (sources.length) {\n\t\t\t\tsource = sources.pop()\n\t\t\t\tobservers = source.observers\n\n\t\t\t\tindex = sourceSlots.pop()\n\n\t\t\t\tif (observers && observers.length) {\n\t\t\t\t\tobserver = observers.pop()\n\t\t\t\t\tslot = source.observerSlots.pop()\n\n\t\t\t\t\tif (index < observers.length) {\n\t\t\t\t\t\tobserver.sourceSlots[slot] = index\n\t\t\t\t\t\tobservers[index] = observer\n\t\t\t\t\t\tsource.observerSlots[index] = slot\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.dispose()\n\n\t\tthis.state = CLEAN\n\t}\n}\n\nclass Effect extends Computation {\n\tuser = true\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tEffects ? Effects.push(this) : batch(() => this.update())\n\t}\n}\n\nclass SyncEffect extends Computation {\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tbatch(() => this.update())\n\t}\n}\n\n// SIGNALS\n\nclass Memo extends Computation {\n\tstate = STALE\n\n\tpure = true\n\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\treturn markReactive(this.read.bind(this))\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (this.state) {\n\t\t\tif (this.state === STALE) {\n\t\t\t\tthis.update()\n\t\t\t} else {\n\t\t\t\tconst updates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(this))\n\t\t\t\tUpdates = updates\n\t\t\t}\n\t\t}\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tlet nextValue\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tnextValue = this.fn()\n\t\t} catch (err) {\n\t\t\tthis.state = STALE\n\t\t\tif (this.owned) {\n\t\t\t\tthis.owned.forEach(node => node.dispose())\n\t\t\t\tthis.owned.length = 0\n\t\t\t}\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\t\tif (this.updatedAt <= time) {\n\t\t\tif (this.updatedAt !== 0) {\n\t\t\t\tthis.write(nextValue)\n\t\t\t} else {\n\t\t\t\tthis.value = nextValue\n\t\t\t}\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n}\n\n// SIGNAL\n\nclass Signal {\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\t// save\n\n\t// `prev` if option save was given\n\n\tconstructor(value, options) {\n\t\tthis.value = value\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = value\n\t\t\t}\n\t\t}\n\n\t\tthis.read = markReactive(this.read.bind(this))\n\n\t\tthis.write = this.write.bind(this)\n\t\tthis.update = this.update.bind(this)\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = this.value\n\t\t\t}\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tupdate(value) {\n\t\tif (isFunction(value)) {\n\t\t\tvalue = value(this.value)\n\t\t}\n\t\treturn this.write(value)\n\t}\n\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.read\n\t\tyield this.write\n\t\tyield this.update\n\t}\n}\n\n// API\n\n/**\n * Creates a new root\n *\n * @param {(dispose: Function) => any} fn\n * @param {object} [options]\n * @returns {any}\n */\nexport function root(fn, options = undefined) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tconst root = new Root(Owner, options)\n\n\tOwner = root\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(() => fn(root.dispose.bind(root)), true)\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Creates a signal\n *\n * @template const T\n * @param {T} [initialValue] - Initial value of the signal\n * @param {SignalOptions} [options] - Signal options\n * @returns {SignalObject}\n */\n/* #__NO_SIDE_EFFECTS__ */\nexport function signal(initialValue, options = undefined) {\n\treturn new Signal(initialValue, options)\n}\n\n/**\n * Creates an effect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function effect(fn, options = undefined) {\n\tnew Effect(Owner, fn, options)\n}\n\n/**\n * Creates an effect with explicit dependencies\n *\n * @param {Function} depend - Function that causes tracking\n * @param {Function} fn - Function that wont cause tracking\n * @param {object} [options]\n */\nexport function on(depend, fn, options = undefined) {\n\teffect(() => {\n\t\tdepend()\n\t\tuntrack(fn)\n\t}, options)\n}\n\n/**\n * Creates a syncEffect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function syncEffect(fn, options = undefined) {\n\treturn new SyncEffect(Owner, fn, options)\n}\n\n/**\n * Creates a read-only signal from the return value of a function that\n * automatically updates\n *\n * @template T\n * @param {() => T} fn - Function to re-run when dependencies change\n * @param {SignalOptions} [options]\n * @returns {SignalAccessor} - Read only signal\n */\n\n/* #__NO_SIDE_EFFECTS__ */ export function memo(\n\tfn,\n\toptions = undefined,\n) {\n\treturn new Memo(Owner, fn, options)\n}\n\n/**\n * Batches changes to signals\n *\n * @param {Function} fn\n * @returns {any}\n */\nexport const batch = runUpdates\n\n/**\n * Returns current owner\n *\n * @returns {typeof Owner}\n */\nexport function owner() {\n\treturn Owner\n}\n\nfunction runWithOwner(owner, fn) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tOwner = owner\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(fn, true)\n\t} catch (err) {\n\t\tthrow err\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Disables tracking for a function\n *\n * @param {Function} fn - Function to run with tracking disabled\n * @returns {any}\n */\nexport function untrack(fn) {\n\tif (Listener === undefined) {\n\t\treturn fn()\n\t}\n\n\tconst prevListener = Listener\n\tListener = undefined\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Runs a callback on cleanup, returns callback\n *\n * @template T\n * @param {T} fn\n * @returns {T}\n */\nexport function cleanup(fn) {\n\tif (Owner) {\n\t\tif (Owner.cleanups) {\n\t\t\tOwner.cleanups.push(fn)\n\t\t} else {\n\t\t\tOwner.cleanups = [fn]\n\t\t}\n\t}\n\treturn fn\n}\n\n// UPDATES\n\nfunction runTop(node) {\n\tswitch (node.state) {\n\t\tcase CLEAN: {\n\t\t\treturn\n\t\t}\n\t\tcase CHECK: {\n\t\t\treturn upstream(node)\n\t\t}\n\t}\n\n\tconst ancestors = []\n\n\tdo {\n\t\tif (node.state) {\n\t\t\tancestors.push(node)\n\t\t}\n\t\tnode = node.owner\n\t} while (node && node.updatedAt < Time)\n\n\tfor (let i = ancestors.length - 1, updates; i >= 0; i--) {\n\t\tnode = ancestors[i]\n\n\t\tswitch (node.state) {\n\t\t\tcase STALE: {\n\t\t\t\tnode.update()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase CHECK: {\n\t\t\t\tupdates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(node, ancestors[0]))\n\t\t\t\tUpdates = updates\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction runUpdates(fn, init = false) {\n\tif (Updates) {\n\t\treturn fn()\n\t}\n\n\tlet wait = false\n\n\tif (!init) {\n\t\tUpdates = []\n\t}\n\n\tif (Effects) {\n\t\twait = true\n\t} else {\n\t\tEffects = []\n\t}\n\n\tTime++\n\n\ttry {\n\t\tconst res = fn()\n\n\t\tif (Updates) {\n\t\t\trunQueue(Updates)\n\t\t\tUpdates = null\n\t\t}\n\t\tif (!wait) {\n\t\t\tconst effects = Effects\n\t\t\tEffects = null\n\t\t\tif (effects.length) {\n\t\t\t\trunUpdates(() => runEffects(effects))\n\t\t\t}\n\t\t}\n\n\t\treturn res\n\t} catch (err) {\n\t\tif (!wait) {\n\t\t\tEffects = null\n\t\t}\n\t\tUpdates = null\n\n\t\tthrow err\n\t}\n}\n\nfunction runQueue(queue) {\n\tfor (let i = 0; i < queue.length; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction runEffects(queue) {\n\tlet i\n\n\tlet effect\n\tlet userLength = 0\n\tfor (i = 0; i < queue.length; i++) {\n\t\teffect = queue[i]\n\n\t\tif (!effect.user) {\n\t\t\trunTop(effect)\n\t\t} else {\n\t\t\tqueue[userLength++] = effect\n\t\t}\n\t}\n\n\tfor (i = 0; i < userLength; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction upstream(node, ignore) {\n\tnode.state = CLEAN\n\n\tfor (let i = 0, source; i < node.sources.length; i++) {\n\t\tsource = node.sources[i]\n\n\t\tif (source.sources) {\n\t\t\tswitch (source.state) {\n\t\t\t\tcase STALE: {\n\t\t\t\t\tif (source !== ignore && source.updatedAt < Time) {\n\t\t\t\t\t\trunTop(source)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase CHECK: {\n\t\t\t\t\tupstream(source, ignore)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction downstream(node) {\n\tfor (let i = 0, observer; i < node.observers.length; i++) {\n\t\tobserver = node.observers[i]\n\n\t\tif (observer.state === CLEAN) {\n\t\t\tobserver.state = CHECK\n\t\t\tif (observer.pure) {\n\t\t\t\tUpdates.push(observer)\n\t\t\t} else {\n\t\t\t\tEffects.push(observer)\n\t\t\t}\n\t\t\tobserver.observers && downstream(observer)\n\t\t}\n\t}\n}\n\nlet readForbid = false\n\nfunction checkReadForbidden() {\n\tif (readForbid) {\n\t\tconsole.trace('Signal Read!')\n\t}\n}\nexport function readForbidden(fn, value) {\n\tconst prev = readForbid\n\ttry {\n\t\treadForbid = value\n\t\treturn fn()\n\t} finally {\n\t\treadForbid = prev\n\t}\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {typeof Context} Context\n */\nexport function Context(defaultValue = undefined) {\n\tconst id = Symbol()\n\n\treturn useContext.bind(null, id, defaultValue)\n}\n\n/**\n * @overload Gets the context value\n * @returns {any} Context value\n */\n/**\n * @overload Runs `fn` with a new value as context\n * @param {any} newValue - New value for the context\n * @param {Function} fn - Callback to run with the new context value\n * @returns {Children} Children\n */\n/**\n * @param {any} newValue\n * @param {Function} fn\n */\nfunction useContext(id, defaultValue, newValue, fn) {\n\tif (newValue === undefined) {\n\t\treturn Owner?.context && Owner.context[id] !== undefined\n\t\t\t? Owner.context[id]\n\t\t\t: defaultValue\n\t} else {\n\t\tlet res\n\n\t\tsyncEffect(() => {\n\t\t\tOwner.context = {\n\t\t\t\t...Owner.context,\n\t\t\t\t[id]: newValue,\n\t\t\t}\n\t\t\tres = untrack(fn)\n\t\t})\n\n\t\treturn res\n\t}\n}\n\n/**\n * Returns an owned function\n *\n * @param {function | undefined} cb\n * @returns {() => any}\n */\nexport const owned = cb => {\n\tconst o = Owner\n\treturn (...args) => cb && runWithOwner(o, () => cb(...args))\n}\n\n/**\n * Returns true when value is reactive (a signal)\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isReactive = value =>\n\tisFunction(value) && $isReactive in value\n\n/**\n * Marks a function as reactive. Reactive functions are ran inside\n * effects.\n *\n * @param {Function} fn - Function to mark as reactive\n * @returns {Function}\n */\nexport function markReactive(fn) {\n\tfn[$isReactive] = undefined\n\treturn fn\n}\n\n/**\n * Proxies a signals property access so you dont have to call the\n * function\n *\n * @param {Signal} snigal - Signal to proxy\n * @param {object} [target] - Target object for the proxy\n * @returns {object} An object that will read the properties from the\n * signal\n */\nexport const proxy = (snigal, target = nothing) =>\n\tnew Proxy(target, {\n\t\tget(target, key) {\n\t\t\treturn snigal()[key]\n\t\t},\n\t\thas(target, key) {\n\t\t\treturn key in snigal()\n\t\t},\n\t\townKeys(target) {\n\t\t\treturn keys(snigal())\n\t\t},\n\t})\n\n/**\n * A self contained signal function, when an argument is present it\n * writes to the signal, when theres no argument it reads the signal.\n *\n * @template T\n * @param {T} [value] - Optional initial value\n * @returns {SignalFunction}\n */\nexport function signalFunction(value) {\n\tconst [read, write] = signal(value)\n\treturn markReactive((...args) =>\n\t\targs.length ? write(args[0]) : read(),\n\t)\n}\n\n/**\n * To set and read refs. To use in ref attribute.\n *\n * @template T\n * @returns {SignalFunction}\n */\nexport const ref = () => signalFunction()\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport const withValue = (value, fn) =>\n\tisFunction(value) ? effect(() => fn(getValue(value))) : fn(value)\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport function withPrevValue(value, fn) {\n\tif (isFunction(value)) {\n\t\tlet prev = undefined\n\t\teffect(() => {\n\t\t\tconst val = getValue(value)\n\t\t\tfn(val, prev)\n\t\t\tprev = val\n\t\t})\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Lazy and writable version of `memo`, its writable and will run the\n * function only when used\n *\n * @author ryansolid\n * @param {Function} fn - Function to re-run when dependencies change\n * @returns {((...args) => any) | (() => any)}\n */\nexport function writable(fn) {\n\tconst result = memo(() => signal(fn()))\n\n\treturn markReactive((...args) => {\n\t\treturn args.length ? result().write(args[0]) : result().read()\n\t})\n}\n\n/**\n * Creates an asynchronously effect\n *\n * @param {(currentRunningEffect: Promise) => any} fn - A\n * function that receives a `currentRunningEffect` that should be\n * awaited for when wanting to run effects synchronously, that's it\n * one effect after another.\n */\nexport function asyncEffect(fn) {\n\tconst queue = []\n\teffect(() => {\n\t\tconst { promise, resolve } = withResolvers()\n\n\t\tqueue.push(promise)\n\n\t\tfunction onDone() {\n\t\t\tremoveFromArray(queue, promise)\n\t\t\tresolve()\n\t\t}\n\n\t\tresolved(\n\t\t\tfn(queue.length === 1 ? undefined : queue[queue.length - 2]),\n\t\t\tonDone,\n\t\t)\n\t})\n}\n\n/**\n * A Promise loader handler. Allows to display/run something or\n * nothing while a promise is resolving. Allows to run a callback when\n * the promise resolves. Allows to get notified of errors, and\n * display/run something or nothing, if wanted a `retry` function is\n * given for retrying the promise. All functions run with the original\n * owner, so it's `Context` friendly.\n *\n * @param {(() => Promise) | Promise} fn - Function that\n * returns a promise\n * @param {{\n * \tonLoading?: any\n * \tonLoaded?: Function\n * \tonError?: ((e: Error, retry: Function) => any) | any\n * }} [options]\n *\n * @returns {Component}\n * @url https://pota.quack.uy/lazy\n */\nexport const lazy = (fn, options = nothing) =>\n\tmarkComponent(props => {\n\t\tconst { onLoading, onLoaded, onError } = options\n\n\t\tconst [value, setValue] = signal(onLoading)\n\n\t\tconst _onLoaded = owned(onLoaded)\n\n\t\tconst retry = () =>\n\t\t\tPromise.resolve(isFunction(fn) ? fn() : fn)\n\t\t\t\t.then(r => {\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tmarkComponent(() => {\n\t\t\t\t\t\t\tr = isObject(r) && r.default ? r.default : r\n\t\t\t\t\t\t\treturn isFunction(r) ? r(props) : r\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\tmicrotask(_onLoaded)\n\t\t\t\t})\n\t\t\t\t.catch(e =>\n\t\t\t\t\tonError\n\t\t\t\t\t\t? setValue(\n\t\t\t\t\t\t\t\tmarkComponent(() =>\n\t\t\t\t\t\t\t\t\tisFunction(onError) ? onError(e, retry) : onError,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: console.error(e),\n\t\t\t\t)\n\t\tretry()\n\n\t\treturn value\n\t})\n\nexport const Lazy = props => lazy(props.children, props)\n\nexport const microtask = fn => queueMicrotask(owned(fn))\n\n// MAP\n\n/**\n * Reactive Map\n *\n * @template T\n * @param {Each} list\n * @param {Function} callback\n * @param {boolean} [sort]\n */\nexport function map(list, callback, sort) {\n\tconst cache = new Map()\n\tconst duplicates = new Map() // for when caching by value is not possible [1, 2, 1, 1, 1]\n\n\tlet runId = 0\n\n\tlet rows = []\n\t/** @type any[] */\n\tlet prev = []\n\n\tfunction clear() {\n\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\tprev[i].dispose(true)\n\t\t}\n\t\tcache.clear()\n\t\tduplicates.clear()\n\n\t\trows.length = 0\n\t\tprev.length = 0\n\t}\n\n\t// to get rid of all nodes when parent disposes\n\tcleanup(clear)\n\n\tclass Row {\n\t\tconstructor(item, index, fn, isDupe) {\n\t\t\tthis.runId = -1\n\t\t\tthis.item = item\n\t\t\tthis.index = index\n\t\t\tthis.isDupe = isDupe\n\t\t\tthis.disposer = undefined\n\t\t\tthis.nodes = root(disposer => {\n\t\t\t\tthis.disposer = disposer\n\t\t\t\t/** @type Children[] */\n\t\t\t\treturn fn(item, index)\n\t\t\t})\n\t\t}\n\t\tget begin() {\n\t\t\treturn this.nodes[0]\n\t\t}\n\t\tget end() {\n\t\t\treturn this.nodes[this.nodes.length - 1]\n\t\t}\n\t\tdispose(all) {\n\t\t\t// skip cache deletion as we are going to clear the full map\n\t\t\tif (all === undefined) {\n\t\t\t\t// delete from cache\n\t\t\t\tif (!this.isDupe) {\n\t\t\t\t\tcache.delete(this.item)\n\t\t\t\t} else {\n\t\t\t\t\tconst arr = duplicates.get(this.item)\n\t\t\t\t\tarr.length === 1\n\t\t\t\t\t\t? duplicates.delete(this.item)\n\t\t\t\t\t\t: removeFromArray(arr, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.disposer()\n\t\t}\n\t}\n\n\t/**\n\t * @param {Function} fn\n\t * @returns {Children}\n\t */\n\tfunction mapper(fn) {\n\t\tconst cb = fn\n\t\t\t? (item, index) => fn(callback(item, index), index)\n\t\t\t: callback\n\n\t\tconst value = getValue(list) || []\n\n\t\t/** To allow iterate objects as if were an array with indexes */\n\t\tconst items = isIterable(value) ? value.entries() : entries(value)\n\n\t\trunId++\n\t\trows = []\n\t\tconst hasPrev = prev.length\n\n\t\tfor (const [index, item] of items) {\n\t\t\tlet row = hasPrev ? cache.get(item) : undefined\n\n\t\t\t// if the item doesnt exists, create it\n\t\t\tif (row === undefined) {\n\t\t\t\trow = new Row(item, index, cb, false)\n\t\t\t\tcache.set(item, row)\n\t\t\t} else if (row.runId === runId) {\n\t\t\t\t// a map will save only 1 of any primitive duplicates, say: [1, 1, 1, 1]\n\t\t\t\t// if the saved value was already used on this run, create a new one\n\t\t\t\tlet dupes = duplicates.get(item)\n\t\t\t\tif (!dupes) {\n\t\t\t\t\tdupes = []\n\t\t\t\t\tduplicates.set(item, dupes)\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < dupes.length; i++) {\n\t\t\t\t\tif (dupes[i].runId !== runId) {\n\t\t\t\t\t\trow = dupes[i]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (row.runId === runId) {\n\t\t\t\t\trow = new Row(item, index, cb, true)\n\t\t\t\t\tdupes.push(row)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trow.runId = runId // mark used on this run\n\t\t\trow.index = index // save sort order\n\t\t\trows.push(row)\n\t\t}\n\n\t\t// remove rows that arent present on the current run\n\t\tif (rows.length === 0) {\n\t\t\tclear()\n\t\t} else {\n\t\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\t\tif (prev[i].runId !== runId) {\n\t\t\t\t\tprev[i].dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// reorder elements\n\t\t// `rows.length > 1` because no need for sorting when there are no items\n\t\t// prev.length > 0 to skip sorting on creation as its already sorted\n\t\tif (sort && rows.length > 1 && prev.length) {\n\t\t\t// if the planets align it handles swapping\n\t\t\t// a = sorted\n\t\t\t// b = unsorted\n\t\t\tconst { a, b } = groupBy(rows, (value, index) =>\n\t\t\t\trows[index] === prev[index] ? 'a' : 'b',\n\t\t\t)\n\n\t\t\tlet unsorted = b?.length\n\t\t\tif (\n\t\t\t\ta &&\n\t\t\t\tb &&\n\t\t\t\ta.length &&\n\t\t\t\tb.length &&\n\t\t\t\tb.length < a.length &&\n\t\t\t\tb.every(item => prev.includes(item))\n\t\t\t) {\n\t\t\t\tfor (const usort of b) {\n\t\t\t\t\tfor (const sort of a) {\n\t\t\t\t\t\tif (usort.index === sort.index - 1) {\n\t\t\t\t\t\t\tsort.begin.before(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if (usort.index === sort.index + 1) {\n\t\t\t\t\t\t\tsort.end.after(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unsorted) {\n\t\t\t\t// handles all other cases\n\t\t\t\t// best for any combination of: push/pop/shift/unshift/insertion/deletion\n\t\t\t\t// must check in reverse as on creation stuff is added to the end\n\n\t\t\t\tlet current = rows[rows.length - 1]\n\t\t\t\tfor (let i = rows.length - 1; i > 0; i--) {\n\t\t\t\t\tconst previous = rows[i - 1]\n\t\t\t\t\tif (current.begin.previousSibling !== previous.end) {\n\t\t\t\t\t\tcurrent.begin.before(...nodesFromRow(previous))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = previous\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// save sorted list\n\t\tprev = rows\n\n\t\t// return external representation\n\t\treturn rows.map(item => item.nodes)\n\t}\n\tmapper[$isMap] = undefined\n\treturn mapper\n}\n\nfunction nodesFromRow(row) {\n\tconst { begin, end } = row\n\tconst nodes = [begin]\n\n\tlet nextSibling = begin\n\twhile (nextSibling !== end) {\n\t\tnextSibling = nextSibling.nextSibling\n\t\tnodes.push(nextSibling)\n\t}\n\n\treturn nodes\n}\n\n/**\n * Resolves and returns `children` in a memo\n *\n * @param {Function | Children} fn\n * @returns {Function} Memo\n * @url https://pota.quack.uy/resolve\n */\nexport function resolve(fn) {\n\tconst children = isFunction(fn) ? memo(fn) : () => fn\n\treturn memo(() => unwrap(children()))\n}\n\n/**\n * Recursively unwrap children functions\n *\n * @param {Children} children\n * @returns {Children}\n */\nfunction unwrap(children) {\n\tif (isFunction(children)) {\n\t\treturn unwrap(children())\n\t}\n\n\tif (isArray(children)) {\n\t\tconst childrens = []\n\t\tfor (let child of children) {\n\t\t\tchild = unwrap(child)\n\t\t\tisArray(child)\n\t\t\t\t? childrens.push(...child)\n\t\t\t\t: childrens.push(child)\n\t\t}\n\t\treturn childrens\n\t}\n\n\treturn children\n}\n\n/**\n * Extend `Pota` and define a `render(props){}` method to create a\n * class component. `ready(cb)` and `cleanup(cb)` methods will be\n * registered automatically\n *\n * @url https://pota.quack.uy/Classes\n */\nexport class Pota {}\n\nPota[$isClass] = undefined\n\n/**\n * Returns true if the `value` is a `Component`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponent = value =>\n\tisFunction(value) && $isComponent in value\n\n/**\n * Returns true if the value can be made a Component\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponentable = value =>\n\t!isReactive(value) &&\n\t(isFunction(value) ||\n\t\t// avoid [1,2] and support { toString(){ return \"something\"} }\n\t\t(!isArray(value) && isObject(value) && !value.then))\n\n/**\n * Makes of `children` a function. Reactive children will run as is,\n * non-reactive children will run untracked, regular children will\n * just return.\n *\n * @param {Children} children\n * @returns {Function}\n */\nexport function makeCallback(children) {\n\t/**\n\t * When children is an array, as in >${[0, 1, 2]}< then children\n\t * will end as `[[0, 1, 2]]`, so flat it\n\t */\n\n\tchildren = isArray(children) ? flat(children) : children\n\n\tconst callbacks = !isArray(children)\n\t\t? callback(children)\n\t\t: children.map(callback)\n\n\treturn !isArray(children)\n\t\t? markComponent((...args) => callbacks(args))\n\t\t: markComponent((...args) =>\n\t\t\t\tcallbacks.map(callback => callback(args)),\n\t\t\t)\n}\n\nconst callback = child =>\n\tisFunction(child)\n\t\t? isReactive(child)\n\t\t\t? args => {\n\t\t\t\t\t/**\n\t\t\t\t\t * The function inside the `for` is saved in a signal. The\n\t\t\t\t\t * result of the signal is our callback\n\t\t\t\t\t *\n\t\t\t\t\t * ```js\n\t\t\t\t\t * htmlEffect(\n\t\t\t\t\t * \thtml =>\n\t\t\t\t\t * \t\thtml`\n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\tname \n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\t${item =>\n\t\t\t\t\t * \t\t\t\t\thtml`\n\t\t\t\t\t * \t\t\t\t\t\t${item.name} \n\t\t\t\t\t * \t\t\t\t\t `}\n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t
`,\n\t\t\t\t\t * )\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\tconst r = child()\n\t\t\t\t\treturn isFunction(r)\n\t\t\t\t\t\t? isReactive(r)\n\t\t\t\t\t\t\t? r()\n\t\t\t\t\t\t\t: untrack(() => r(...args))\n\t\t\t\t\t\t: r\n\t\t\t\t}\n\t\t\t: args => untrack(() => child(...args))\n\t\t: () => child\n\n// allows to tell a `signal function` from a `component function`\n// signals and user functions go in effects, for reactivity\n// components and callbacks are untracked and wont go in effects to avoid re-rendering\n\n/**\n * Marks a function as a `Component`.\n *\n * @param {Function} fn - Function to mark as a `Component`\n * @returns {Component}\n */\nexport function markComponent(fn) {\n\tfn[$isComponent] = undefined\n\treturn fn\n}\n\n/**\n * Unwraps components till it gets a value. To keep context relevant\n * to the component\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValueComponent(value) {\n\twhile ($isComponent in value) value = value()\n\treturn value\n}\n\n/**\n * Adds an event listener to a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `off` function for removing the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function addEventListener(node, type, handler) {\n\tnode.addEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\t/**\n\t * Removes event on tracking scope disposal.\n\t *\n\t * Situation: the event was added to the `document` manually using\n\t * `addEventListener`, say to listen for clicks as a \"click\n\t * outside\". The event needs to be removed when the component that\n\t * added it is disposed.\n\t */\n\n\treturn cleanup(() => removeEventListener(node, type, handler))\n}\n\n/**\n * Removes an event listener from a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `on` function for adding back the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function removeEventListener(node, type, handler) {\n\tnode.removeEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\treturn () => addEventListener(node, type, handler)\n}\n\n/**\n * It gives a handler an owner, so stuff runs batched on it, and\n * things like context and cleanup work\n */\nexport const ownedEvent = handler =>\n\t'handleEvent' in handler\n\t\t? {\n\t\t\t\t...handler,\n\t\t\t\thandleEvent: owned(e => handler.handleEvent(e)),\n\t\t\t}\n\t\t: owned(handler)\n","import { owned } from './lib/reactive.js'\nimport { call, queueMicrotask } from './lib/std.js'\n\n/**\n * The purpose of this file is to guarantee the timing of some\n * callbacks. It queues a microtask, then the callbacks are added to a\n * position in the array. These are run with a priority.\n */\n\n/** @type boolean */\nlet added\n\n/** @type [][] */\nlet queue\n\nfunction reset() {\n\tqueue = [[], [], [], [], [], []]\n\tadded = false\n}\n\n// initialization\nreset()\n\n/**\n * Queues a callback at a priority\n *\n * @param {PropertyKey} priority - Priority\n * @param {Function} fn - Function to run once the callbacks at this\n * priority run\n */\nfunction add(priority, fn) {\n\tif (!added) {\n\t\tadded = true\n\t\tqueueMicrotask(run)\n\t}\n\tqueue[priority].push(owned(fn))\n}\n\n/** Runs all queued callbacks */\nfunction run() {\n\tconst q = queue\n\treset()\n\n\tfor (const fns of q) {\n\t\tfns.length && call(fns)\n\t}\n}\n\n/**\n * Queue a function to run before everything else (onProps, onRef,\n * onMount, ready) ex focus restoration\n *\n * @param {Function} fn\n */\nexport const onFixes = fn => add(0, fn)\n\n/**\n * Queue a function to run before (onRef, onMount, ready) ex running\n * user functions on elements via plugins\n *\n * @param {Function} fn\n */\nexport const onProps = fn => add(1, fn)\n\n/**\n * Queue a function to run onRef (before onMount, after onProps)\n *\n * @param {Function} fn\n */\nexport const onRef = fn => add(2, fn)\n\n/**\n * Queue a function to run onMount (before ready, after onRef)\n *\n * @param {Function} fn\n */\nexport const onMount = fn => add(3, fn)\n\n/**\n * Queue a function to run on ready (after onMount)\n *\n * @param {Function} fn\n * @url https://pota.quack.uy/ready\n */\nexport const ready = fn => add(4, fn)\n\n/**\n * Queue a function to run after all user defined processes\n *\n * @param {Function} fn\n */\nexport const onDone = fn => add(5, fn)\n","import { addEventListener } from '../lib/reactive.js'\nimport { window, withCache } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {EventListenerOrEventListenerObject} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setEventNS = (node, name, value, props, localName, ns) =>\n\taddEventListener(node, localName, value)\n\n/**\n * Returns an event name when the string could be mapped to an event\n *\n * @param {string} name - String to check for a mapped event\n * @returns {string | undefined} Returns the event name or null in\n * case isnt found\n */\nexport const eventName = withCache(name =>\n\tname.startsWith('on') && name.toLowerCase() in window\n\t\t? name.slice(2).toLowerCase()\n\t\t: null,\n)\n/*\nconst eventNames = new Set(\n\tkeys(global).filter(prop => prop.startsWith('on')),\n)\n*/\n","import { cacheStore } from '../lib/std.js'\nimport { onProps } from '../scheduler.js'\n\nexport const plugins = cacheStore()\nexport const pluginsNS = cacheStore()\n\n/**\n * Defines a prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - To avoid the problem of\n * needed props not being set, or children elements not created yet.\n * Default is `true`\n * @url https://pota.quack.uy/props/propsPlugin\n */\nexport const propsPlugin = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n}\n\n/**\n * Defines a namespaced prop that can be used on any Element\n *\n * @param {string} NSName - Name of the namespace\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * \tlocalName: string,\n * \tns: string,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginNS = (NSName, fn, onMicrotask) => {\n\tplugin(pluginsNS, NSName, fn, onMicrotask)\n}\n\n/**\n * Defines prop and namespaced prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop/namespace\n * @param {Function} fn - Function to run when this prop is found on\n * any Element\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginBoth = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n\tplugin(pluginsNS, propName, fn, onMicrotask)\n}\n\nconst plugin = (plugins, name, fn, onMicrotask = true) => {\n\tplugins.set(\n\t\tname,\n\t\t!onMicrotask ? fn : (...args) => onProps(() => fn(...args)),\n\t)\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\nimport { NS } from '../constants.js'\n\n// NODE ATTRIBUTES\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setAttributeNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setAttribute(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n * @url https://pota.quack.uy/props/setAttribute\n */\nexport const setAttribute = (node, name, value, ns) =>\n\twithValue(value, value => _setAttribute(node, name, value, ns))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {string} [ns]\n */\nfunction _setAttribute(node, name, value, ns) {\n\t// if the value is null or undefined it will be removed\n\tif (isNullUndefined(value)) {\n\t\tns && NS[ns]\n\t\t\t? node.removeAttributeNS(NS[ns], name)\n\t\t\t: node.removeAttribute(name)\n\t} else {\n\t\tns && NS[ns]\n\t\t\t? node.setAttributeNS(NS[ns], name, value)\n\t\t\t: node.setAttribute(name, value)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setPropertyNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setProperty(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setProperty\n */\nexport const setProperty = (node, name, value) =>\n\twithValue(value, value => _setProperty(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nfunction _setProperty(node, name, value) {\n\t// if the value is null or undefined it will be set to null\n\tif (isNullUndefined(value)) {\n\t\t// defaulting to undefined breaks `progress` tag and the whole page\n\t\tnode[name] = null\n\t} else {\n\t\tnode[name] = value\n\t}\n}\n","// NODE UNKNOWN PROPERTIES / ATTRIBUTES\n\nimport { setAttribute } from './attribute.js'\nimport { setProperty } from './property.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const setUnknown = (node, name, value, ns) => {\n\tname in node && !(node instanceof SVGElement)\n\t\t? setProperty(node, name, value)\n\t\t: setAttribute(node, name, value, ns)\n}\n","// BOOL ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setBoolNS = (node, name, value, props, localName, ns) =>\n\tsetBool(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setBool\n */\nexport const setBool = (node, name, value) =>\n\twithValue(value, value => _setBool(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const _setBool = (node, name, value) =>\n\t// if the value is falsy gets removed\n\t!value ? node.removeAttribute(name) : node.setAttribute(name, '')\n","// node style\n\nimport { withValue } from '../lib/reactive.js'\nimport { getValue, isNullUndefined, isObject } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @url https://pota.quack.uy/props/setStyle\n */\nexport const setStyle = (node, name, value, props) =>\n\tsetNodeStyle(node.style, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setStyleNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(\n\t\tnode.style,\n\t\tisObject(value) ? value : { [localName]: value },\n\t)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setVarNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(node.style, { ['--' + localName]: value })\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {unknown} value\n */\nfunction setNodeStyle(style, value) {\n\tif (isObject(value)) {\n\t\tlet name\n\t\tfor (name in value) {\n\t\t\tsetStyleValue(style, name, value[name])\n\t\t}\n\t\treturn\n\t}\n\tconst type = typeof value\n\tif (type === 'string') {\n\t\tstyle.cssText = value\n\t\treturn\n\t}\n\tif (type === 'function') {\n\t\twithValue(value, value => setNodeStyle(style, getValue(value)))\n\t\treturn\n\t}\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementStyle = (node, name, value) =>\n\tsetStyleValue(node.style, name, value)\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {unknown} value\n */\nconst setStyleValue = (style, name, value) =>\n\twithValue(value, value => _setStyleValue(style, name, value))\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {string | null} value\n */\nconst _setStyleValue = (style, name, value) =>\n\t// if the value is null or undefined it will be removed\n\tisNullUndefined(value)\n\t\t? style.removeProperty(name)\n\t\t: style.setProperty(name, value)\n","// node class / classList\n\nimport { withPrevValue, withValue } from '../lib/reactive.js'\nimport {\n\tclassListAdd,\n\tclassListRemove,\n\tisFunction,\n\tisString,\n} from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n */\nexport const setClass = (node, name, value, props) =>\n\tisString(value)\n\t\t? node.setAttribute('class', value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setClassNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) =>\n\tisFunction(value)\n\t\t? setElementClass(node, localName, value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {object | string | ArrayLike} value\n */\nfunction setClassList(node, value) {\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t_setClassListValue(node, value, true)\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'object': {\n\t\t\tlet name\n\t\t\tfor (name in value) {\n\t\t\t\tsetElementClass(node, name, value[name])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'function': {\n\t\t\twithValue(value, value => setClassList(node, value))\n\t\t\tbreak\n\t\t}\n\t}\n}\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementClass = (node, name, value) =>\n\twithPrevValue(value, (value, prev) => {\n\t\t// on initialization do not remove whats not there\n\t\tif (!value && !prev) {\n\t\t} else {\n\t\t\t_setClassListValue(node, name, value)\n\t\t}\n\t})\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\n\nconst _setClassListValue = (node, name, value) =>\n\t// null, undefined or false, the class is removed\n\t!value\n\t\t? classListRemove(node, name)\n\t\t: classListAdd(node, ...name.trim().split(/\\s+/))\n","/** Returns true or false with a `chance` of getting `true` */\nexport const chance = (chance = 50, generator = random) => {\n\treturn generator() < chance / 100\n}\n\n/** Returns random number between 0 and 1 */\nexport const random = () =>\n\tcrypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)\n\nexport const randomBetween = (min, max, generator = random) =>\n\tMath.floor(generator() * (max - min + 1)) + min\n\nexport const randomColor = (min = 0, max = 255) =>\n\t'rgb(' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t')'\n\nexport const randomId = () =>\n\tcrypto.getRandomValues(new BigUint64Array(1))[0].toString(36)\n\n/**\n * Returns a random number generator based no a seed that generates\n * numbers between 0 and 1\n */\nexport function randomSeeded(seed) {\n\tconst m = 2 ** 35 - 31\n\tlet s = seed % m\n\treturn () => (s = (s * 185852) % m) / m\n}\n","import {\n\tadoptedStyleSheetsAdd,\n\tclassListAdd,\n\tgetDocumentForElement,\n\tsheet,\n\twithState,\n} from '../lib/std.js'\n\nimport { randomId } from '../plugin/useRandom.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {object} props\n */\nexport const setCSS = (node, name, value, props) =>\n\tsetNodeCSS(node, value)\n\n/**\n * @param {Element} node\n * @param {string} value\n */\nconst setNodeCSS = withState((state, node, value) => {\n\tclassListAdd(\n\t\tnode,\n\t\tstate.get(value, value => {\n\t\t\tconst id = 'c' + randomId()\n\t\t\tadoptedStyleSheetsAdd(\n\t\t\t\tgetDocumentForElement(node),\n\t\t\t\tsheet(value.replace(/class/g, '.' + id)),\n\t\t\t)\n\t\t\treturn id\n\t\t}),\n\t)\n})\n","import { cleanup } from '../lib/reactive.js'\n\nimport { onMount, onRef } from '../scheduler.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setRef = (node, name, value, props) =>\n\tonRef(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setOnMount = (node, name, value, props) =>\n\tonMount(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setUnmount = (node, name, value, props) =>\n\tcleanup(() => value(node))\n","import {\n\taddEventListener,\n\towned,\n\townedEvent,\n} from '../lib/reactive.js'\nimport { getValue, isObject } from '../lib/std.js'\n\nimport { eventName } from './event.js'\n\nimport {\n\tplugins,\n\tpluginsNS,\n\tpropsPlugin,\n\tpropsPluginBoth,\n\tpropsPluginNS,\n} from './plugin.js'\nimport { setUnknown } from './unknown.js'\n\n// exports\n\nexport { setAttribute } from './attribute.js'\nexport { setBool } from './bool.js'\nexport { setProperty } from './property.js'\nexport { setElementStyle as setStyle } from './style.js'\nexport { setElementClass as setClass } from './class.js'\n\n// PLUGINS NS\n\n// namespaced attributes/properties\n\nimport { setPropertyNS } from './property.js'\npropsPluginNS('prop', setPropertyNS, false)\n\nimport { setAttributeNS } from './attribute.js'\npropsPluginNS('attr', setAttributeNS, false)\n\nimport { setBoolNS } from './bool.js'\npropsPluginNS('bool', setBoolNS, false)\n\n// events\n\nimport { setEventNS } from './event.js'\npropsPluginNS('on', setEventNS, false)\n\n// var\n\nimport { setVarNS } from './style.js'\npropsPluginNS('var', setVarNS, false)\n\n// PLUGINS REGULAR\n\n// forced as properties\n\nimport { setProperty } from './property.js'\nfor (const item of [\n\t'value',\n\t'textContent',\n\t'innerText',\n\t'innerHTML',\n]) {\n\tpropsPlugin(item, setProperty, false)\n}\n\n// noop\n\nimport { noop } from '../lib/std.js'\npropsPlugin('__dev', noop, false)\npropsPlugin('xmlns', noop, false)\n\n// PLUGIN BOTH\n\n// css\n\nimport { setCSS } from './css.js'\npropsPluginBoth('css', setCSS, false)\n\n// mount\n\nimport { setOnMount } from './lifecycle.js'\npropsPluginBoth('onMount', setOnMount, false)\n\n// unmount\n\nimport { setUnmount } from './lifecycle.js'\npropsPluginBoth('onUnmount', setUnmount, false)\n\n// ref\n\nimport { setRef } from './lifecycle.js'\npropsPluginBoth('ref', setRef, false)\n\n// PLUGIN BOTH DIFFERENT\n\n// styles\n\nimport { setStyle, setStyleNS } from './style.js'\npropsPlugin('style', setStyle, false)\npropsPluginNS('style', setStyleNS, false)\n\n// class\n\nimport { setClass, setClassNS } from './class.js'\npropsPlugin('class', setClass, false)\npropsPluginNS('class', setClassNS, false)\n\n// catch all\n\n/**\n * Assigns props to an Element\n *\n * @param {Element} node - Element to which assign props\n * @param {object} props - Props to assign\n */\nexport function assignProps(node, props) {\n\tfor (const name in props) {\n\t\tassignProp(node, name, props[name], props)\n\t}\n}\n\n/**\n * Assigns a prop to an Element\n *\n * @param {Element} node\n * @param {string} name\n * @param {any} value\n * @param {object} props\n */\nexport function assignProp(node, name, value, props) {\n\t// unwrap promises\n\tif (isObject(value) && 'then' in value) {\n\t\tvalue.then(\n\t\t\towned(value => assignProp(node, name, getValue(value), props)),\n\t\t)\n\t\treturn\n\t}\n\n\t// run plugins\n\tlet plugin = plugins.get(name)\n\tif (plugin) {\n\t\tplugin(node, name, value, props)\n\t\treturn\n\t}\n\n\t// onClick={handler}\n\tlet event = eventName(name)\n\tif (event) {\n\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\treturn\n\t}\n\n\tif (name.includes(':')) {\n\t\t// with ns\n\t\tconst [ns, localName] = name.split(':')\n\n\t\t// run plugins NS\n\t\tplugin = pluginsNS.get(ns)\n\t\tif (plugin) {\n\t\t\tplugin(node, name, value, props, localName, ns)\n\t\t\treturn\n\t\t}\n\n\t\t// onClick:my-ns={handler}\n\t\tevent = eventName(ns)\n\t\tif (event) {\n\t\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\t\treturn\n\t\t}\n\n\t\tsetUnknown(node, name, value, ns)\n\t\treturn\n\t}\n\n\t// catch all\n\tsetUnknown(node, name, value)\n}\n","// CONSTANTS\n\nimport { $isClass, $isMap, NS } from './constants.js'\n\n// LIB\n\nimport {\n\tcleanup,\n\tContext,\n\teffect,\n\tisReactive,\n\troot,\n\tsignal,\n\tuntrack,\n} from './lib/reactive.js'\n\nimport {\n\tadoptedStyleSheetsAdd,\n\tadoptedStyleSheetsRemove,\n\tcreateElement,\n\tcreateElementNS,\n\tcreateTextNode,\n\tCSSStyleSheet,\n\tdocument,\n\tDocumentFragment,\n\tflat,\n\tfreeze,\n\tgetDocumentForElement,\n\timportNode,\n\tisArray,\n\tisConnected,\n\titerator,\n\tnothing,\n\tquerySelector,\n\tresolved,\n\tstringify,\n\ttoArray,\n\twalkElements,\n} from './lib/std.js'\n\nimport {\n\tisComponent,\n\tisComponentable,\n\tmarkComponent,\n} from './lib/reactive.js'\n\nimport { onFixes, ready } from './scheduler.js'\n\n// PROPERTIES / ATTRIBUTES\n\nimport { assignProps } from './props/@main.js'\nimport { propsPlugin } from './props/plugin.js'\n\n// STATE\n\nconst useXMLNS = context()\n\n// COMPONENTS\n\n/**\n * Used by the regular JSX transform, as `<>...>` or\n * `... `.\n */\nexport const Fragment = props => props.children\n\n/**\n * Creates components for things. When props argument is given, the\n * props become fixed. When props argument is ommited, it allows you\n * to keep calling the returned function with new props. Returns a\n * function because we need to render from parent to children instead\n * of from children to parent. This allows to properly set the\n * reactivity tree (think of nested effects that clear inner effects,\n * context, etc).\n *\n * @param {string | Function | Element | object | symbol} value -\n * Component\n * @param {any} [props] Object\n * @url https://pota.quack.uy/Component\n */\n\nexport function Component(value, props) {\n\tif (value === Fragment) {\n\t\treturn props.children\n\t}\n\n\t/** Freeze props so isnt directly writable */\n\tfreeze(props)\n\n\t/** Create a callable function to pass `props` */\n\tconst component = Factory(value)\n\n\treturn props === undefined\n\t\t? component\n\t\t: markComponent(propsOverride =>\n\t\t\t\tcomponent(\n\t\t\t\t\tpropsOverride\n\t\t\t\t\t\t? freeze({ ...props, ...propsOverride })\n\t\t\t\t\t\t: props,\n\t\t\t\t),\n\t\t\t)\n}\n\n/**\n * Creates a component that could be called with a props object\n *\n * @template T\n * @param {any} value\n * @returns {Component}\n */\n\nfunction Factory(value) {\n\tif (isComponent(value)) {\n\t\treturn value\n\t}\n\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t// string component, 'div' becomes \n\t\t\treturn markComponent(props => createTag(value, props))\n\t\t}\n\t\tcase 'function': {\n\t\t\tif ($isClass in value) {\n\t\t\t\t// class component
\n\t\t\t\treturn markComponent(props => createClass(value, props))\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * ```js\n\t\t\t * const [Count, setCount] = signal(1)\n\t\t\t * return
\n\t\t\t * ```\n\t\t\t */\n\t\t\tif (isReactive(value)) {\n\t\t\t\treturn markComponent(() => createAnything(value))\n\t\t\t}\n\n\t\t\t// function component
\n\t\t\t// value = value\n\t\t\treturn markComponent(value)\n\t\t}\n\t\tdefault: {\n\t\t\tif (value instanceof Node) {\n\t\t\t\t// node component
\n\t\t\t\treturn markComponent(props => createNode(value, props))\n\t\t\t}\n\n\t\t\treturn markComponent(() => createAnything(value))\n\t\t}\n\t}\n}\n\nexport function createComponent(value) {\n\tconst component = Factory(value)\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() => component(props))\n\t}\n}\n\nfunction createClass(value, props) {\n\tconst i = new value()\n\ti.ready && ready(() => i.ready())\n\ti.cleanup && cleanup(() => i.cleanup())\n\n\treturn i.render(props)\n}\n\nfunction createAnything(value) {\n\treturn value\n}\n\n/**\n * Creates a x/html element from a tagName\n *\n * @template P\n * @param {TagNames} tagName\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createTag(tagName, props) {\n\t/**\n\t * Namespace, use props xmlns or special case svg, math, etc in case\n\t * of missing xmlns attribute\n\t */\n\tconst xmlns = props?.xmlns || NS[tagName]\n\n\treturn withXMLNS(\n\t\txmlns,\n\t\txmlns =>\n\t\t\tcreateNode(\n\t\t\t\txmlns\n\t\t\t\t\t? createElementNS(xmlns, tagName)\n\t\t\t\t\t: createElement(tagName),\n\t\t\t\tprops,\n\t\t\t),\n\t\ttagName,\n\t)\n}\n\nfunction withXMLNS(xmlns, fn, tagName) {\n\tconst nsContext = useXMLNS()\n\n\tif (xmlns && xmlns !== nsContext) {\n\t\t// the xmlns changed, use the new xmlns\n\t\treturn useXMLNS(xmlns, () => fn(xmlns))\n\t}\n\n\t/**\n\t * `foreignObject` children are created with html xmlns (default\n\t * browser behaviour)\n\t */\n\tif (nsContext && tagName === 'foreignObject') {\n\t\treturn useXMLNS(NS.html, () => fn(nsContext))\n\t}\n\n\treturn fn(nsContext)\n}\n\n// PARTIALS\n\nfunction cloneNode(content, xmlns) {\n\tconst template = xmlns\n\t\t? createElementNS(xmlns, 'template')\n\t\t: createElement('template')\n\n\ttemplate.innerHTML = content\n\n\t// xml\n\tif (!template.content) {\n\t\tif (template.childNodes.length === 1) {\n\t\t\treturn template.firstChild\n\t\t}\n\n\t\ttemplate.content = new DocumentFragment()\n\t\ttemplate.content.append(...template.childNodes)\n\t}\n\n\treturn template.content.childNodes.length === 1\n\t\t? template.content.firstChild\n\t\t: template.content\n}\n\nexport function createPartial(content, propsData = nothing) {\n\tlet clone = () => {\n\t\tconst node = withXMLNS(propsData.x, xmlns =>\n\t\t\tcloneNode(content, xmlns),\n\t\t)\n\n\t\tclone = propsData.i\n\t\t\t? importNode.bind(null, node, true)\n\t\t\t: node.cloneNode.bind(node, true)\n\t\treturn clone()\n\t}\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() =>\n\t\t\tassignPartialProps(clone(), props, propsData),\n\t\t)\n\t}\n}\n\nfunction assignPartialProps(node, props, propsData) {\n\tif (props) {\n\t\tconst nodes = []\n\t\twalkElements(node, node => {\n\t\t\tnodes.push(node)\n\n\t\t\tif (nodes.length === propsData.m) return true\n\t\t})\n\n\t\twithXMLNS(propsData.x, xmlns => {\n\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\tassignProps(nodes[propsData[i] || i], props[i])\n\t\t\t}\n\t\t})\n\t}\n\n\treturn node instanceof DocumentFragment\n\t\t? toArray(node.childNodes)\n\t\t: node\n}\n\n/**\n * Assigns props to an element and creates its children\n *\n * @template P\n * @param {Element} node\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createNode(node, props) {\n\tif (props) {\n\t\tassignProps(node, props)\n\t}\n\treturn node\n}\n\n/**\n * Creates the children for a parent\n *\n * @param {Element} parent\n * @param {Children} child\n * @param {boolean} [relative]\n * @param {Text | undefined} [prev]\n * @returns {Children}\n */\nfunction createChildren(parent, child, relative, prev = undefined) {\n\tswitch (typeof child) {\n\t\t// string/number\n\t\tcase 'string':\n\t\tcase 'number': {\n\t\t\tif (prev instanceof Text) {\n\t\t\t\tprev.nodeValue = child\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn insertNode(parent, createTextNode(child), relative)\n\t\t}\n\n\t\tcase 'function': {\n\t\t\t// component\n\t\t\tif (isComponent(child)) {\n\t\t\t\treturn createChildren(parent, untrack(child), relative)\n\t\t\t}\n\t\t\tlet node = []\n\n\t\t\t// signal/memo/external/user provided function\n\t\t\t// needs placeholder to stay in position\n\t\t\tparent = createPlaceholder(\n\t\t\t\tparent,\n\t\t\t\tundefined /*child.name*/,\n\t\t\t\trelative,\n\t\t\t)\n\n\t\t\t// For\n\t\t\tif ($isMap in child) {\n\t\t\t\teffect(() => {\n\t\t\t\t\tnode = toDiff(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tchild(child => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Wrap the item with placeholders, for when stuff in\n\t\t\t\t\t\t\t * between moves. If a `Show` adds and removes nodes, we\n\t\t\t\t\t\t\t * dont have a reference to these nodes. By delimiting\n\t\t\t\t\t\t\t * with a shore, we can just handle anything in between\n\t\t\t\t\t\t\t * as a group.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst begin = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*begin*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst end = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*end*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn [begin, createChildren(end, child, true), end]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\tcleanup(() => {\n\t\t\t\t\ttoDiff(node)\n\t\t\t\t\tparent.remove()\n\t\t\t\t})\n\t\t\t\treturn [node, parent]\n\t\t\t}\n\n\t\t\t// maybe a signal so needs an effect\n\n\t\t\teffect(() => {\n\t\t\t\tnode = toDiff(node, [\n\t\t\t\t\tcreateChildren(parent, child(), true, node[0]),\n\t\t\t\t])\n\t\t\t})\n\n\t\t\tcleanup(() => {\n\t\t\t\ttoDiff(node)\n\t\t\t\tparent.remove()\n\t\t\t})\n\t\t\t/**\n\t\t\t * A placeholder is created and added to the document but doesnt\n\t\t\t * form part of the children. The placeholder needs to be\n\t\t\t * returned so it forms part of the group of children. If\n\t\t\t * children are moved and the placeholder is not moved with\n\t\t\t * them, then, whenever children update these will be at the\n\t\t\t * wrong place. wrong place: where the placeholder is and not\n\t\t\t * where the children were moved to\n\t\t\t */\n\t\t\treturn [node, parent]\n\t\t}\n\n\t\tcase 'object': {\n\t\t\t// HTMLElement/Text\n\t\t\tif (child instanceof HTMLElement || child instanceof Text) {\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// children/fragments\n\t\t\tif (isArray(child)) {\n\t\t\t\treturn child.length === 1\n\t\t\t\t\t? createChildren(parent, child[0], relative)\n\t\t\t\t\t: child.map(child =>\n\t\t\t\t\t\t\tcreateChildren(parent, child, relative),\n\t\t\t\t\t\t)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The value is `null`, as in {null} or like a show returning\n\t\t\t * `null` on the falsy case\n\t\t\t */\n\t\t\tif (child === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Node/DocumentFragment\n\t\t\tif (child instanceof Node) {\n\t\t\t\t/**\n\t\t\t\t * DocumentFragment are special as only the children get added\n\t\t\t\t * to the document and the document becomes empty. If we dont\n\t\t\t\t * insert them 1 by 1 then we wont have a reference to them\n\t\t\t\t * for deletion on cleanup with node.remove()\n\t\t\t\t */\n\t\t\t\tif (child instanceof DocumentFragment) {\n\t\t\t\t\treturn createChildren(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\ttoArray(child.childNodes),\n\t\t\t\t\t\trelative,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// async components\n\t\t\tif ('then' in child) {\n\t\t\t\tconst [value, setValue] = signal(undefined)\n\n\t\t\t\tconst onResult = result =>\n\t\t\t\t\tisConnected(parent) && setValue(result)\n\n\t\t\t\tresolved(child, onResult)\n\n\t\t\t\treturn createChildren(parent, value, relative)\n\t\t\t}\n\n\t\t\t// iterable/Map/Set/NodeList\n\t\t\tif (iterator in child) {\n\t\t\t\treturn createChildren(\n\t\t\t\t\tparent,\n\t\t\t\t\ttoArray(child.values()),\n\t\t\t\t\trelative,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// CSSStyleSheet\n\t\t\tif (child instanceof CSSStyleSheet) {\n\t\t\t\t/**\n\t\t\t\t * Custom elements wont report a document unless is already\n\t\t\t\t * connected. So our stylesheet would end on the main document\n\t\t\t\t * intead of the shadodRoot\n\t\t\t\t */\n\t\t\t\tonFixes(() => {\n\t\t\t\t\tif (isConnected(parent)) {\n\t\t\t\t\t\tconst doc = getDocumentForElement(parent)\n\t\t\t\t\t\tadoptedStyleSheetsAdd(doc, child)\n\n\t\t\t\t\t\tcleanup(() => adoptedStyleSheetsRemove(doc, child))\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// object.toString fancy objects\n\t\t\treturn createChildren(\n\t\t\t\tparent,\n\t\t\t\t// Object.create(null) would fail to convert to string\n\t\t\t\t'toString' in child ? child.toString() : stringify(child),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t\tcase 'undefined': {\n\t\t\treturn undefined\n\t\t}\n\t\tdefault: {\n\t\t\t// boolean/bigint/symbol/catch all\n\t\t\t// toString() is needed for `Symbol`\n\t\t\treturn insertNode(\n\t\t\t\tparent,\n\t\t\t\tcreateTextNode(child.toString()),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t}\n}\n\npropsPlugin(\n\t'children',\n\t(node, propName, propValue) => createChildren(node, propValue),\n\tfalse,\n)\n\n/**\n * Creates placeholder to keep nodes in position\n *\n * @param {Element} parent\n * @param {unknown} text\n * @param {boolean} [relative]\n * @returns {Element}\n */\nconst createPlaceholder = (parent, text, relative) => {\n\treturn insertNode(parent, createTextNode(''), relative)\n\n\t/* dev\n\treturn insertNode(\n\t\tparent,\n\t\tdocument.createComment(\n\t\t\t(text || '') + (relative ? ' relative' : ''),\n\t\t),\n\t\trelative,\n\t) */\n}\n\nconst head = document.head\n\n/**\n * Adds the element to the document\n *\n * @param {Element} parent\n * @param {Element &\n * \tHTMLTitleElement &\n * \tHTMLMetaElement &\n * \tHTMLLinkElement} node\n * @param {boolean} [relative]\n * @returns {Element}\n */\n\nfunction insertNode(parent, node, relative) {\n\t// special case `head`\n\tif (parent === head) {\n\t\tconst name = node.localName\n\n\t\t// search for tags that should be unique\n\t\tlet prev\n\t\tif (name === 'title') {\n\t\t\tprev = querySelector(head, 'title')\n\t\t} else if (name === 'meta') {\n\t\t\tprev =\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[name=\"' + node.getAttribute('name') + '\"]',\n\t\t\t\t) ||\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[property=\"' + node.getAttribute('property') + '\"]',\n\t\t\t\t)\n\t\t} else if (name === 'link' && node.rel === 'canonical') {\n\t\t\tprev = querySelector(head, 'link[rel=\"canonical\"]')\n\t\t}\n\n\t\t// replace old node if there's any\n\t\tprev ? prev.replaceWith(node) : parent.appendChild(node)\n\t} else {\n\t\trelative ? parent.before(node) : parent.appendChild(node)\n\t}\n\n\treturn node\n}\n\n// RENDERING\n\n/**\n * WARNINGS Removal of the element on where you render/insert into,\n * wont cause disposal of what you render/insert.\n */\n\n/**\n * Inserts children into a parent\n *\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * document.body\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n * @returns {Function} Disposer\n * @url https://pota.quack.uy/render\n */\nexport function render(children, parent, options = nothing) {\n\tconst dispose = root(dispose => {\n\t\tinsert(children, parent, options)\n\t\treturn dispose\n\t})\n\n\t// run dispose when the parent scope disposes\n\tcleanup(dispose)\n\n\treturn dispose\n}\n\n/**\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * `document.body`\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n */\nexport function insert(\n\tchildren,\n\tparent = document.body,\n\toptions = nothing,\n) {\n\tif (options.clear && parent) parent.textContent = ''\n\n\tconst node = createChildren(\n\t\tparent,\n\t\tisComponentable(children) ? Factory(children) : children,\n\t\toptions.relative,\n\t)\n\n\tcleanup(() => toDiff([node].flat(Infinity)))\n\n\treturn node\n}\n\n/**\n * Creates and returns HTML Elements for `children`\n *\n * @param {Children} children\n * @returns {Children}\n * @url https://pota.quack.uy/toHTML\n */\nexport const toHTML = children =>\n\t/**\n\t * DocumentFragment is transformed to an `Array` of `Node/Element`,\n\t * that way we can keep a reference to the nodes. Because when the\n\t * DocumentFragment is used, it removes the nodes from the\n\t * DocumentFragment and then we will lose the reference.\n\t */\n\n\tflat(toHTMLFragment(children).childNodes)\n\n/**\n * Creates and returns a DocumentFragment for `children`\n *\n * @param {Children} children\n * @returns {DocumentFragment}\n * @url https://pota.quack.uy/toHTML\n */\nexport function toHTMLFragment(children) {\n\tconst fragment = new DocumentFragment()\n\tcreateChildren(fragment, children)\n\n\treturn fragment\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {Function & { Provider: ({ value }) => Children }}\n * Context\n * @url https://pota.quack.uy/Reactivity/Context\n */\n/* #__NO_SIDE_EFFECTS__ */ export function context(\n\tdefaultValue = undefined,\n) {\n\t/** @type {Function & { Provider: ({ value }) => Children }} */\n\tconst ctx = Context(defaultValue)\n\n\t/**\n\t * Sets the `value` for the context\n\t *\n\t * @param {object} props\n\t * @param {any} props.value\n\t * @param {Children} [props.children]\n\t * @returns {Children} Children\n\t * @url https://pota.quack.uy/Reactivity/Context\n\t */\n\tctx.Provider = props =>\n\t\tctx(props.value, () => toHTML(props.children))\n\n\treturn ctx\n}\n\n/**\n * Removes from the DOM `prev` elements not found on `next`\n *\n * @param {Element[]} prev - Array with previous elements\n * @param {Element[]} next - Array with next elements\n * @returns {Element[]}\n */\nfunction toDiff(prev = [], next = []) {\n\tnext = next.flat(Infinity)\n\tfor (let i = 0, item; i < prev.length; i++) {\n\t\titem = prev[i]\n\t\titem &&\n\t\t\t(next.length === 0 || !next.includes(item)) &&\n\t\t\titem.remove()\n\t}\n\treturn next\n}\n","import { withValue } from '../lib/reactive.js'\nimport {\n\taddStyleSheets,\n\temit,\n\tisString,\n\tquerySelector,\n\tremoveAttribute,\n\tsetAttribute,\n} from '../lib/std.js'\n\nimport { Component, toHTMLFragment } from '../renderer.js'\n\n/**\n * Defines a custom Element (if isnt defined already)\n *\n * @param {string} name - Name for the custom element\n * @param {CustomElementConstructor} constructor - Class for the\n * custom element\n * @param {ElementDefinitionOptions} [options] - Options passed to\n * `customElements.define`\n */\nexport function customElement(name, constructor, options) {\n\tif (customElements.get(name) === undefined) {\n\t\tcustomElements.define(name, constructor, options)\n\t}\n}\n\nexport class CustomElement extends HTMLElement {\n\tconstructor() {\n\t\tsuper()\n\n\t\tconst shadowRoot = this.attachShadow({\n\t\t\tmode: 'open',\n\t\t})\n\n\t\t// this is needed because `baseStyleSheets/styleSheets` are `static`\n\t\tconst constructor = this.constructor\n\n\t\taddStyleSheets(shadowRoot, constructor.baseStyleSheets)\n\t\taddStyleSheets(shadowRoot, constructor.styleSheets)\n\t}\n\n\t/* DOM API */\n\n\t/**\n\t * Shortcut for querySelector\n\t *\n\t * @param {string} query\n\t */\n\tquery(query) {\n\t\treturn querySelector(this, query)\n\t}\n\t/**\n\t * Shortcut for this.shadowRoot.innerHTML\n\t *\n\t * @param {string} value\n\t */\n\tset html(value) {\n\t\tif (isString(value)) {\n\t\t\tthis.shadowRoot.innerHTML = value\n\t\t} else {\n\t\t\tthis.shadowRoot.replaceChildren(\n\t\t\t\ttoHTMLFragment(Component(value || 'slot')),\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Toggles attribute `hidden`\n\t *\n\t * @param {boolean} value\n\t */\n\tset hidden(value) {\n\t\twithValue(value, value => {\n\t\t\tvalue\n\t\t\t\t? setAttribute(this, 'hidden', '')\n\t\t\t\t: removeAttribute(this, 'hidden')\n\t\t})\n\t}\n\n\t/* EVENTS API */\n\n\t/**\n\t * Emits an event\n\t *\n\t * @param {string} eventName\n\t * @param {any} [data]\n\t */\n\temit(eventName, data) {\n\t\temit(this, eventName, data)\n\t}\n\n\t/* SLOTS API */\n\n\thasSlot(name) {\n\t\treturn this.query(`:scope [slot=\"${name}\"]`)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { css } from '../lib/std.js'\n\nimport { Component } from '../renderer.js'\nimport { CustomElement, customElement } from './CustomElement.js'\n\n/**\n * Similar to `Show`, but doesn't remove its children from the\n * document\n *\n * @template T\n * @param {{\n * \twhen: When
\n * \tchildren?: Children\n * }} props\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Collapse\n */\nexport function Collapse(props) {\n\t// need to include the class here because else its not treeshaked\n\tclass CollapseElement extends CustomElement {\n\t\tstatic styleSheets = [\n\t\t\tcss`\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: contents;\n\t\t\t\t}\n\t\t\t`,\n\t\t]\n\n\t\t/**\n\t\t * @template T\n\t\t * @param {When} value - To toggle children\n\t\t */\n\t\tset when(value) {\n\t\t\twithValue(value, value => (this.html = value ? ' ' : ''))\n\t\t}\n\t}\n\n\tconst name = 'pota-collapse'\n\n\tcustomElement(name, CollapseElement)\n\n\treturn Component(name, {\n\t\twhen: props.when,\n\t\tchildren: props.children,\n\t})\n}\n","import { Component } from '../renderer.js'\n\n/**\n * Creates components dynamically\n *\n * @template props\n * @param {{\n * \tcomponent: Component\n * } & props} props\n * @returns {Component}\n * @url https://pota.quack.uy/Components/Dynamic\n */\n\nexport const Dynamic = props =>\n\t// `component` needs to be deleted else it will end in the tag as an attribute\n\tComponent(props.component, { ...props, component: undefined })\n","import { makeCallback, map } from '../lib/reactive.js'\nimport {\n\tactiveElement,\n\tdocumentElement,\n\tisConnected,\n} from '../lib/std.js'\n\nimport { onFixes } from '../scheduler.js'\n\n/**\n * Renders reactive values from an signal that returns an Iterable\n * object\n *\n * @template T\n * @param {object} props\n * @param {Each} props.each\n * @param {boolean} [props.restoreFocus] - If the focused element\n * moves it may lose focus\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/For\n */\n\nexport const For = props =>\n\tmap(\n\t\t() => {\n\t\t\tprops.restoreFocus && queue()\n\t\t\treturn props.each\n\t\t},\n\t\tmakeCallback(props.children),\n\t\ttrue,\n\t)\n\nlet queued\n\n// because re-ordering the elements trashes focus\nfunction queue() {\n\tif (!queued) {\n\t\tqueued = true\n\n\t\tconst active = activeElement()\n\t\tconst scroll = documentElement.scrollTop\n\n\t\tonFixes(() => {\n\t\t\tqueued = false\n\t\t\t// re-ordering the elements trashes focus\n\t\t\tactive &&\n\t\t\t\tactive !== activeElement() &&\n\t\t\t\tisConnected(active) &&\n\t\t\t\tactive.focus()\n\n\t\t\tdocumentElement.scrollTop = scroll\n\t\t})\n\t}\n}\n","import { insert } from '../renderer.js'\n\n/**\n * Portals children to a different element while keeping the original\n * scope\n *\n * @param {object} props\n * @param {Element} props.mount\n * @param {Children} [props.children]\n * @url https://pota.quack.uy/Components/Portal\n */\nexport function Portal(props) {\n\tinsert(props.children, props.mount)\n}\n","import { document } from '../lib/std.js'\nimport { Component } from '../renderer.js'\nimport { Portal } from './Portal.js'\n\n/**\n * Mounts children on `document.head`\n *\n * @param {{\n * \tchildren?: Children\n * }} props\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Head\n */\nexport const Head = props =>\n\tComponent(Portal, {\n\t\tmount: document.head,\n\t\tchildren: props.children,\n\t})\n","import {\n\tdocument,\n\tlocation,\n\tquerySelector,\n\twindow,\n} from '../lib/std.js'\n\n/**\n * Scrolls to an element\n *\n * @param {Element} item - Element to scroll to\n */\nexport function scrollToElement(item) {\n\t/** Scroll children of element to the top */\n\titem.scrollTop = 0\n\n\t/** Scroll to element */\n\titem.scrollIntoView(true)\n}\n\n/** Scrolls to `window.location.hash` */\nexport const scrollToLocationHash = () =>\n\tscrollToSelector(location.hash)\n\n/**\n * Scrolls to element that matches the hash\n *\n * @param {string} selector - Hash to scroll to\n * @returns {boolean} True on success\n */\nexport function scrollToSelector(selector) {\n\tif (selector) {\n\t\ttry {\n\t\t\t// selector could be invalid\n\t\t\tconst item = querySelector(document, selector)\n\t\t\tif (item) {\n\t\t\t\tscrollToElement(item)\n\t\t\t\treturn true\n\t\t\t}\n\t\t} catch (e) {}\n\t}\n\treturn false\n}\n\n/**\n * Scrolls to hash and in case isnt found it scrolls to the top\n *\n * @param {string} selector - Hash to scroll to\n */\nexport function scrollToSelectorWithFallback(selector) {\n\tif (!scrollToSelector(selector)) scrollToTop()\n}\n\n/** Scrolls to the top of the window */\nexport const scrollToTop = () =>\n\twindow.scrollTo({ top: 0, behavior: 'auto' })\n","import { global } from '../lib/std.js'\n\nexport const cleanLink = v => v.replace(/[\\.,\"]$/, '')\n\nexport const encodeURIComponent = global.encodeURIComponent\n\n/**\n * Safe guard. `decodeURIComponent` will fail with malformed strings:\n * links are copied, pasted, manipulated by people, software etc\n *\n * @param {string} string - String to decode\n * @returns {string} Returns decoded string or original string on\n * error\n */\nfunction _decodeURIComponent(string) {\n\ttry {\n\t\treturn decodeURIComponent(string)\n\t} catch (e) {\n\t\treturn string\n\t}\n}\nexport { _decodeURIComponent as decodeURIComponent }\n\n/**\n * Returns true if the link is absolute: starts with '/', '#' or\n * 'http'\n *\n * @param {string} href - Url\n * @returns {boolean} Returns true if the link is absolute\n */\nexport const isAbsolute = href =>\n\thref[0] === '/' || href[0] === '#' || /^http/.test(href)\n\n/**\n * Returns true if the link is external. It does so by checking that\n * window.location.origin is present at the beginning of the url\n *\n * @param {string} url - Url\n * @returns {boolean} Returns true if the link is external\n */\nexport const isExternal = url =>\n\t// origin could be http://example.net and link could be http://example.net.ha.com, so add \"/\"\n\t/^http/.test(url) && !(url + '/').startsWith(origin + '/')\n\n/**\n * Returns true if the link is relative\n *\n * @param {string} url - Url\n * @returns {boolean} Returns true if the link relative\n */\nexport const isRelative = url => !isAbsolute(url)\n\n/**\n * Replace params in an url for the encoded equivalent\n *\n * @param {string | undefined} url - Url\n * @param {object} [params] - Key-value pair to replace\n * @returns {string} Url with the params replaced\n */\nexport const replaceParams = (url, params) =>\n\tparams\n\t\t? url.replace(/\\:([a-z0-9_\\-]+)/gi, (a, b) =>\n\t\t\t\t// only replace the ones defined on params\n\t\t\t\tparams[b] !== undefined ? encodeURIComponent(params[b]) : a,\n\t\t\t)\n\t\t: url\n","import { memo, signal } from '../../lib/reactive.js'\nimport { nothing, removeFromArray } from '../../lib/std.js'\n\nimport { context } from '../../renderer.js'\n\n/* #__NO_SIDE_EFFECTS__ */ export function create(props = nothing) {\n\tconst [children, setChildren, updateChildren] = signal([])\n\n\treturn {\n\t\tbase: '', // the composed base route\n\t\thref: () => '', // the url of the route\n\t\tparent: undefined, // parent context\n\t\tshow: () => false, // if the route is shown\n\t\tparams: () => () => nothing, // params of the route\n\t\tscroll: [], // elements to scroll\n\t\t// the children routes\n\t\taddChildren: child => {\n\t\t\tupdateChildren(children => {\n\t\t\t\tchildren.push(child)\n\t\t\t\treturn [...children]\n\t\t\t})\n\t\t},\n\t\tremoveChildren: child => {\n\t\t\tupdateChildren(children => {\n\t\t\t\tremoveFromArray(children, child)\n\t\t\t\treturn [...children]\n\t\t\t})\n\t\t},\n\t\tnoneMatch: memo(() => {\n\t\t\treturn (\n\t\t\t\t/**\n\t\t\t\t * If doesnt have siblings then is not a 404\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t * \t\n\t\t\t\t * \t <-- Router.Default should never render\n\t\t\t\t * \t \n\t\t\t\t */\n\t\t\t\tchildren().length &&\n\t\t\t\t// when it has sibling, check if at least 1 rendered\n\t\t\t\tchildren().every(children => !children.show())\n\t\t\t)\n\t\t}),\n\t\t// override\n\t\t...props,\n\t}\n}\n\nexport const Context = context(create())\n","import { memo, signal } from '../lib/reactive.js'\nimport {\n\tdocument,\n\tempty,\n\tentries,\n\thistory,\n\tnothing,\n\toptional,\n\torigin,\n\tpreventDefault,\n\twalkParents,\n\tlocation as wLocation,\n} from '../lib/std.js'\n\nimport { scrollToSelectorWithFallback } from './useScroll.js'\n\nimport {\n\tdecodeURIComponent,\n\tisExternal,\n\treplaceParams,\n} from './useURL.js'\n\nimport { Context } from '../web/router/context.js'\n\n// window.location signal\n\nconst [getLocation, setLocation] = signal(wLocation, {\n\tequals: false,\n})\n\n// only trigger on what changed\n\nconst pathname = memo(() => getLocation().pathname)\nconst search = memo(() => getLocation().search)\nconst href = memo(() => getLocation().href)\n\n// http://location/# reports hash to be empty\n// http://location/ reports hash to be empty\n// handle this difference by checking if \"#\" is at the end of `href`\nconst hash = memo(() =>\n\thref().endsWith('#') ? '#' : getLocation().hash,\n)\n\n/**\n * @typedef {object} location\n * @property {Signal} href - The full url\n * @property {Signal} pathname - Mirror of window.location.pathname\n * @property {Signal} hash - Everything after #\n * @property {Signal} path - Pathname + hash\n * @property {Signal} query - Key value pairs with search params\n * @property {Function} params - Key value pairs with route params\n */\n\n/** @type location */\nexport const location = {\n\thref,\n\tpathname,\n\thash,\n\tpath: memo(() => pathname() + hash()),\n\tquery: memo(() => {\n\t\tconst value = search()\n\t\tconst searchParams = empty()\n\t\tconst params = new URL(origin + '/' + value).searchParams\n\t\tfor (const [key, value] of params.entries()) {\n\t\t\tsearchParams[key] = value\n\t\t}\n\t\treturn searchParams\n\t}),\n\tparams: () => {\n\t\tconst routes = []\n\t\twalkParents(Context(), 'parent', context => {\n\t\t\troutes.push(context.params)\n\t\t})\n\t\tconst params = empty()\n\n\t\tfor (const param of routes) {\n\t\t\t// `|| params` because when nothing is found the result is undefined\n\t\t\tfor (const [key, value] of entries(param()() || nothing)) {\n\t\t\t\tparams[key] =\n\t\t\t\t\tvalue !== undefined ? decodeURIComponent(value) : value\n\t\t\t}\n\t\t}\n\t\treturn params\n\t},\n}\n\nlet BeforeLeave = []\n\n/**\n * Run code before leaving the route, return or resolve to false to\n * reject, return true to continue\n *\n * @param {Function | Promise} callback - Run before leaving\n * the route\n * @url https://pota.quack.uy/Components/Router/useBeforeLeave\n */\nexport const useBeforeLeave = callback => {\n\taddListeners()\n\n\tBeforeLeave.push({\n\t\thref: Context().href() || wLocation.href,\n\t\tcallback,\n\t})\n}\n\n/**\n * Returns a boolean telling if navigation is allowed\n *\n * @param {string} href\n * @returns {Promise}\n */\nasync function canNavigate(href) {\n\tconst newBeforeLeave = []\n\tfor (const beforeLeave of BeforeLeave) {\n\t\tif (href.indexOf(beforeLeave.href) !== 0) {\n\t\t\tif (!(await beforeLeave.callback().catch(() => false)))\n\t\t\t\treturn false\n\t\t} else {\n\t\t\tnewBeforeLeave.push(beforeLeave)\n\t\t}\n\t}\n\tBeforeLeave = newBeforeLeave\n\treturn true\n}\n\n/**\n * Navigates to a new location\n *\n * @param {string} href\n * @param {{ scroll?: boolean; replace?: boolean }} options\n * @url https://pota.quack.uy/Components/Router/Navigate\n */\nasync function navigate(href, options = nothing) {\n\tif (wLocation.href !== href) {\n\t\tif (await canNavigate(href)) {\n\t\t\tconst fn = () => navigateInternal(href, options)\n\t\t\t// navigate with transition if available\n\t\t\tdocument.startViewTransition &&\n\t\t\twLocation.href.replace(/#.*/, '') !== href.replace(/#.*/, '')\n\t\t\t\t? document.startViewTransition(fn)\n\t\t\t\t: fn()\n\t\t}\n\t}\n}\n\nfunction navigateInternal(href, options) {\n\tif (options.replace) {\n\t\thistory.replaceState(null, '', href)\n\t} else {\n\t\thistory.pushState(null, '', href)\n\t}\n\tsetLocation(wLocation)\n\n\tif (optional(options.scroll)) {\n\t\tscrollToSelectorWithFallback(wLocation.hash)\n\t}\n}\n\n/**\n * Navigates to a new location programmatically\n *\n * @param {string} href\n * @param {{\n * \tparams?: object\n * \tscroll?: boolean\n * \treplace?: boolean\n * }} options\n * @url https://pota.quack.uy/Components/Router/Navigate\n */\nfunction navigateUser(href, options = nothing) {\n\taddListeners()\n\n\thref = replaceParams(href, options.params)\n\n\t// when the user sets the url it may pass a relative path\n\t// this makes it absolute\n\tnavigate(\n\t\thref.startsWith('http')\n\t\t\t? href\n\t\t\t: new URL(href, wLocation.href).href,\n\t\toptions,\n\t)\n}\nexport { navigateUser as navigate }\n\n/**\n * Navigates to a new location from JSX\n *\n * @param {{\n * \thref: string\n * \tscroll?: boolean\n * \treplace?: boolean\n * \tparams?: object\n * }} props\n * @url https://pota.quack.uy/Components/Router/Navigate\n */\nexport function Navigate(props) {\n\taddListeners()\n\tnavigateUser(props.href, props)\n}\n\n// listeners\n\nlet addListenersAdded = false\n\nexport function addListeners() {\n\tif (!addListenersAdded) {\n\t\taddListenersAdded = true\n\n\t\tdocument.addEventListener('click', onLinkClick)\n\n\t\taddEventListener('hashchange', onLocationChange)\n\t\taddEventListener('popstate', onLocationChange)\n\t}\n}\n\n// listen when using browser buttons\n// safe to use async as its on a listener\nasync function onLocationChange() {\n\t// chrome has a bug on which if you use the back/forward button\n\t// it will change the title of the tab to whatever it was before\n\t// if the navigation is prevented (therefore the title/page wont change)\n\t// it will still use the old title even if the title tag didn't change at all\n\tconst title = document.title\n\tdocument.title = title + ' '\n\tdocument.title = title\n\n\tif (await canNavigate(wLocation.href)) {\n\t\tsetLocation(wLocation)\n\t} else {\n\t\thistory.pushState(null, '', location.href())\n\t}\n}\n\nfunction onLinkClick(e) {\n\tif (\n\t\te.defaultPrevented ||\n\t\te.button !== 0 ||\n\t\te.metaKey ||\n\t\te.altKey ||\n\t\te.ctrlKey ||\n\t\te.shiftKey\n\t)\n\t\treturn\n\n\t// find link\n\tconst node = e\n\t\t.composedPath()\n\t\t.find(item => item instanceof HTMLAnchorElement)\n\n\t// validate\n\tif (\n\t\t!node ||\n\t\t!node.href ||\n\t\tnode.download ||\n\t\tnode.target ||\n\t\t!node.href.startsWith('http') || // when using other protocol than \"http\"\n\t\tisExternal(node.href) ||\n\t\t(node.rel && node.rel.split(/\\s/).includes('external'))\n\t)\n\t\treturn\n\n\tpreventDefault(e)\n\n\tnavigate(node.href, {\n\t\treplace: node.replace,\n\t})\n}\n","import { makeCallback, memo, resolve } from '../lib/reactive.js'\n\nimport { getValue, isNullUndefined } from '../lib/std.js'\n\n/**\n * Renders its children based on a condition\n *\n * @template T\n * @param {object} props\n * @param {When} props.when\n * @param {Children} [props.fallback]\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Show\n */\nexport function Show(props) {\n\tconst callback = makeCallback(props.children)\n\tconst value = memo(() => getValue(props.when))\n\tconst condition = memo(() => !!value())\n\n\t// needs resolve to avoid re-rendering\n\tconst fallback = isNullUndefined(props.fallback)\n\t\t? undefined\n\t\t: memo(() => resolve(props.fallback))\n\n\treturn memo(() => (condition() ? callback(value) : fallback))\n}\n","import {\n\tscrollToLocationHash,\n\tscrollToSelector,\n\tscrollToTop,\n} from '../../plugin/useScroll.js'\n\nimport { walkParents } from '../../lib/std.js'\n\nexport function scroll(context) {\n\t/**\n\t * Scroll to hash first, if doesnt, scroll to positions defined by\n\t * the Routes.\n\t */\n\tif (!scrollToLocationHash()) {\n\t\tif (\n\t\t\t!walkParents(context, 'parent', context => {\n\t\t\t\tif (context.scroll) {\n\t\t\t\t\tfor (const item of context.scroll) {\n\t\t\t\t\t\tif (scrollToSelector(item)) {\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t) {\n\t\t\tscrollToTop()\n\t\t}\n\t}\n}\n","import { cleanup, memo, signal } from '../../lib/reactive.js'\nimport { nothing, optional, origin } from '../../lib/std.js'\n\nimport { addListeners, location } from '../../plugin/useLocation.js'\nimport { replaceParams } from '../../plugin/useURL.js'\n\nimport { Collapse } from '../Collapse.js'\nimport { Dynamic } from '../Dynamic.js'\nimport { Show } from '../Show.js'\n\nimport { Component } from '../../renderer.js'\nimport { onDone } from '../../scheduler.js'\n\nimport { Context, create } from './context.js'\nimport { scroll } from './scroll.js'\n\n/**\n * Renders children if the path matches the current location\n *\n * @template T\n * @param {object} props\n * @param {string} [props.path] - Path to match relative to the parent\n * Route. When `path` is missing, it will render only when the\n * parent's route path is matched exactly.\n * @param {string[]} [props.scroll] - Elements to scroll when the\n * route matches\n * @param {object} [props.params] - Key-value pairs params to encode\n * and replace on the path\n * @param {When} [props.collapse] - To hide the route instead of\n * removing it from the document\n * @param {When} [props.when] - To stop rendering the route even if\n * the path matches.\n * @param {Children} [props.fallback] - Fallback for when a `when`\n * condition is set. If the `when` condition is not set, this wont\n * be used.\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Router/Router\n */\nexport function Router(props) {\n\taddListeners()\n\n\tconst parent = Context()\n\n\tconst base =\n\t\tparent.base +\n\t\treplaceParams(\n\t\t\t// when [^/#]+)'),\n\t)\n\n\tlet href = ''\n\tconst [params, setParams] = signal(() => nothing)\n\n\t// derived\n\tconst show = memo(() => {\n\t\tconst path = location.path()\n\t\tif (route.test(path)) {\n\t\t\tsetParams(() => route.exec(path).groups)\n\n\t\t\tif (href === '') {\n\t\t\t\thref = path.replace(path.replace(route, ''), '')\n\t\t\t\t// create full link\n\t\t\t\thref =\n\t\t\t\t\t// add origin\n\t\t\t\t\torigin +\n\t\t\t\t\t// add slash after origin if isnt present in the href\n\t\t\t\t\t(href[0] !== '/' ? '/' : '') +\n\t\t\t\t\t// add the path\n\t\t\t\t\thref\n\t\t\t}\n\n\t\t\tonDone(() => scroll(context))\n\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t})\n\n\tconst context = create({\n\t\tbase, // the prefix for the children path\n\t\thref: () => href, // the full url of the route\n\t\tparams,\n\t\tscroll: props.scroll,\n\t\tparent,\n\t\tshow,\n\t})\n\n\tparent.addChildren(context)\n\n\tcleanup(() => parent.removeChildren(context))\n\n\treturn Component(Context.Provider, {\n\t\tvalue: context,\n\t\tchildren: Component(Dynamic, {\n\t\t\tcomponent: props.collapse ? Collapse : Show,\n\t\t\twhen: () => show() && optional(props.when),\n\t\t\tfallback: props.fallback,\n\t\t\tchildren: props.children,\n\t\t}),\n\t})\n}\n\n/**\n * Renders children when no sibling `Router` matches\n *\n * @param {object} props\n * @param {Children} [props.children]\n * @returns {Children}\n */\nRouter.Default = props => {\n\tconst context = Context()\n\treturn Component(Show, {\n\t\twhen: context.noneMatch,\n\t\tchildren: props.children,\n\t})\n}\n","import { addListeners } from '../../plugin/useLocation.js'\nimport { isRelative, replaceParams } from '../../plugin/useURL.js'\n\nimport { Component } from '../../renderer.js'\n\nimport { Context } from './context.js'\n\n/*\n * // props\n * // props.href Url relative to the parent \n * // props.params Key-value pair object params to replace in the url\n * not scroll on location change\n * // props.replace Replace the history entry from the browser} props\n */\n\n/**\n * Creates a link with Router features\n *\n * @param {{\n * \thref: string\n * \tparams?: object\n * \treplace?: boolean\n * } & Props} props\n *\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Router/A\n */\n\nexport function A(props) {\n\taddListeners()\n\n\tlet href = replaceParams(props.href, props.params)\n\n\t// make it absolute\n\t// link is relative to the props.children)\n\n const fallback = isNullUndefined(props.fallback)\n ? memo(() => {\n const r = matches().find(match => !('when' in match))\n return r && r.children\n })\n : memo(() => resolve(props.fallback))\n\n const match = memo(() =>\n matches().find(match => !!getValue(match.when)),\n )\n\n const value = memo(() => match() && getValue(match().when))\n\n const callback = memo(\n () => match() && makeCallback(match().children),\n )\n return memo(() => (match() ? callback()(value) : fallback))\n}\n\n/**\n * Renders the content if the `when` condition is true\n *\n * @template T\n * @param {object} props\n * @param {When} props.when\n * @param {Children} [props.children]\n * @returns {Children}\n */\nexport const Match = identity\n","import {\n\tbatch,\n\tcleanup,\n\troot,\n\tsignal,\n\tsyncEffect,\n} from './lib/reactive.js'\n\nimport {\n\tcall,\n\tcreateElement,\n\tcreateTextNode,\n\tempty,\n\tflat,\n\tfreeze,\n\ttoArray,\n\tweakStore,\n\twithWeakCache,\n} from './lib/std.js'\n\nimport { Component, toHTML, toHTMLFragment } from './renderer.js'\nimport { assignProps } from './props/@main.js'\n\nimport {\n\tA,\n\tCollapse,\n\tDynamic,\n\tFor,\n\tHead,\n\tMatch,\n\tPortal,\n\tRouter,\n\tShow,\n\tSwitch,\n} from './web/@main.js'\n\nconst defaultRegistry = {\n\tA,\n\tCollapse,\n\tDynamic,\n\tFor,\n\tHead,\n\tMatch,\n\tPortal,\n\tRouter,\n\tShow,\n\tSwitch,\n}\n\n// parseHTML\n\nconst id = 'pota19611227'\n\nconst xmlns = [\n\t'class',\n\t'on',\n\t'prop',\n\t'attr',\n\t'bool',\n\t'style',\n\t'var',\n\t'onMount',\n\t'onUnmount',\n\t'ref',\n]\n\t.map(ns => `xmlns:${ns}=\"/\"`)\n\t.join(' ')\n\n/**\n * Makes Nodes from TemplateStringsArray\n *\n * @param {TemplateStringsArray} content\n * @returns {Element}\n */\nconst parseHTML = withWeakCache(content =>\n\tnew DOMParser().parseFromString(\n\t\t`${content.join(id)} `,\n\t\t'text/xml',\n\t),\n)\n\n/**\n * Recursively walks a template and transforms it to `h` calls\n *\n * @param {{ components: {} }} html\n * @param {HTMLElement} cached\n * @param {...any} values\n * @returns {Children}\n */\nfunction toH(html, cached, values) {\n\tlet index = 0\n\tfunction nodes(node) {\n\t\t// Node.ELEMENT_NODE\n\t\tif (node.nodeType === 1) {\n\t\t\tconst localName = node.localName\n\n\t\t\t// gather props\n\t\t\tconst props = empty()\n\t\t\tfor (let { name, value } of node.attributes) {\n\t\t\t\tif (value === id) {\n\t\t\t\t\tvalue = values[index++]\n\t\t\t\t}\n\t\t\t\tprops[name] = value\n\t\t\t}\n\n\t\t\t// gather children\n\t\t\tif (node.childNodes.length) {\n\t\t\t\tprops.children = flat(toArray(node.childNodes).map(nodes))\n\t\t\t}\n\n\t\t\treturn Component(html.components[localName] || localName, props)\n\t\t} else {\n\t\t\tif (node.data.includes(id)) {\n\t\t\t\tconst textNodes = node.data.split(id)\n\t\t\t\tconst nodes = []\n\t\t\t\tfor (let i = 0; i < textNodes.length; i++) {\n\t\t\t\t\tconst text = textNodes[i]\n\t\t\t\t\tif (text) {\n\t\t\t\t\t\tnodes.push(createTextNode(text))\n\t\t\t\t\t}\n\t\t\t\t\tif (i < textNodes.length - 1) {\n\t\t\t\t\t\tnodes.push(values[index++])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nodes\n\t\t\t}\n\t\t\treturn createTextNode(node.data)\n\t\t}\n\t}\n\n\treturn flat(toArray(cached.childNodes).map(nodes))\n}\n\nfunction toPartial(html, cached, values) {\n\tif (!cached.partial) {\n\t\tconst walker = document.createTreeWalker(cached)\n\n\t\tconst actions = []\n\t\twhile (walker.nextNode()) {\n\t\t\tconst node = walker.currentNode\n\t\t\tswitch (node.nodeType) {\n\t\t\t\tcase 1: {\n\t\t\t\t\tconst localName = node.localName\n\t\t\t\t\t// its a component\n\t\t\t\t\tif (html.components[localName]) {\n\t\t\t\t\t\tconst props = empty()\n\t\t\t\t\t\tconst propsReplace = []\n\t\t\t\t\t\tfor (let { name, value } of node.attributes) {\n\t\t\t\t\t\t\tif (name === id) {\n\t\t\t\t\t\t\t\tpropsReplace.push(name)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprops[name] = value\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// gather children\n\t\t\t\t\t\tif (node.childNodes.length) {\n\t\t\t\t\t\t\tprops.children = createTextNode('the children') //flat(toArray(node.childNodes).map(nodes))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst pota = createElement('pota')\n\t\t\t\t\t\tnode.replaceWith(pota)\n\t\t\t\t\t\twalker.currentNode = pota\n\n\t\t\t\t\t\tfreeze(props)\n\t\t\t\t\t\tactions.push((node, values, walker) => {\n\t\t\t\t\t\t\tconst p = { ...props }\n\t\t\t\t\t\t\tfor (const name of propsReplace) {\n\t\t\t\t\t\t\t\tp[name] = values()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst replacement = toHTMLFragment(\n\t\t\t\t\t\t\t\tComponent(html.components[localName], p),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tnode.replaceWith(replacement)\n\n\t\t\t\t\t\t\twalker.currentNode = replacement\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst props = empty()\n\t\t\t\t\t\tconst propsReplace = []\n\t\t\t\t\t\tconst toRemove = []\n\t\t\t\t\t\tfor (let { name, value } of node.attributes) {\n\t\t\t\t\t\t\tif (value === id) {\n\t\t\t\t\t\t\t\tpropsReplace.push(name)\n\t\t\t\t\t\t\t\ttoRemove.push(name)\n\t\t\t\t\t\t\t} else if (/^[a-z]+:/.test(name)) {\n\t\t\t\t\t\t\t\tprops[name] = value\n\t\t\t\t\t\t\t\ttoRemove.push(name)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (toRemove.length) {\n\t\t\t\t\t\t\tnode.setAttribute('pota', '')\n\t\t\t\t\t\t\tfor (const attribute of toRemove) {\n\t\t\t\t\t\t\t\tnode.removeAttribute(attribute)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfreeze(props)\n\t\t\t\t\t\t\tactions.push((node, values) => {\n\t\t\t\t\t\t\t\tconst p = { ...props }\n\t\t\t\t\t\t\t\tfor (const name of propsReplace) {\n\t\t\t\t\t\t\t\t\tp[name] = values()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tassignProps(node, p)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 3: {\n\t\t\t\t\t// text\n\t\t\t\t\tif (node.data.includes(id)) {\n\t\t\t\t\t\tconst textNodes = node.data.split(id)\n\t\t\t\t\t\tconst nodes = []\n\t\t\t\t\t\tfor (let i = 0; i < textNodes.length; i++) {\n\t\t\t\t\t\t\tconst text = textNodes[i]\n\t\t\t\t\t\t\tif (text) {\n\t\t\t\t\t\t\t\tnodes.push(createTextNode(text))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (i < textNodes.length - 1) {\n\t\t\t\t\t\t\t\tactions.push((node, values, walker) => {\n\t\t\t\t\t\t\t\t\tconst replacement = toHTML(values())\n\t\t\t\t\t\t\t\t\tconsole.log(replacement)\n\t\t\t\t\t\t\t\t\tnode.replaceWith(replacement)\n\t\t\t\t\t\t\t\t\t// walker gps\n\t\t\t\t\t\t\t\t\twalker.currentNode = replacement\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tnodes.push(createElement('pota'))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnode.replaceWith(...nodes)\n\t\t\t\t\t\t// walker gps\n\t\t\t\t\t\twalker.currentNode = nodes[nodes.length - 1]\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconsole.log('unknown', node, node.nodeType)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst template = createElement('template')\n\t\ttemplate.innerHTML = cached.firstChild.innerHTML.replace(\n\t\t\t/pota xmlns=\"[^\"]+\"/g,\n\t\t\t'pota',\n\t\t)\n\t\tcached.partial = function (values) {\n\t\t\tconsole.log('clonning', template.content)\n\t\t\tconst clone = template.cloneNode(true)\n\t\t\tconsole.log('clone', clone.content)\n\t\t\tconst walker = document.createTreeWalker(clone.content, 1)\n\t\t\tlet index = 0\n\t\t\tlet valueIndex = 0\n\t\t\tconst value = () => values[valueIndex++]\n\t\t\twhile (walker.nextNode()) {\n\t\t\t\tconst node = walker.currentNode\n\t\t\t\tif (node.hasAttribute('pota')) {\n\t\t\t\t\tactions[index++](node, value, walker)\n\t\t\t\t} else if (node.localName === 'pota') {\n\t\t\t\t\tactions[index++](node, value, walker)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn clone.content\n\t\t}\n\t}\n\treturn cached.partial(values)\n}\n\n/**\n * Function to create cached tagged template components\n *\n * @returns {Function & {\n * \tdefine: ({ components }) => void\n * \tcomponents: {}\n * }}\n * @url https://pota.quack.uy/HTML\n */\n\nexport function HTML() {\n\t/**\n\t * Creates tagged template components\n\t *\n\t * @param {TemplateStringsArray} template\n\t * @param {...any} values\n\t * @returns {Children}\n\t * @url https://pota.quack.uy/HTML\n\t */\n\n\tfunction html(template, ...values) {\n\t\tconst cached = parseHTML(template)\n\n\t\treturn toH(html, cached.firstChild, values) // toPartial(html, cached, values) //\n\t}\n\n\thtml.components = { ...defaultRegistry }\n\thtml.define = userComponents => {\n\t\tfor (const name in userComponents) {\n\t\t\thtml.components[name] = userComponents[name]\n\t\t}\n\t}\n\n\treturn html\n}\n\n/**\n * Runs an `effect` on an `html` template. Reacts to reactive\n * interpolated values, or to the reactivity used in the body of the\n * function you pass.\n *\n * @param {(html: Function) => Children} fn - Function to run as an\n * effect. It receives `html` argument for template creation.\n * @returns {Children}\n * @url https://pota.quack.uy/HTML\n */\nexport const htmlEffect = fn => {\n\t/** Copy the components from the global registry */\n\tconst html_ = HTML()\n\thtml_.components = { ...html.components }\n\n\tconst [get, set] = weakStore()\n\n\tconst disposeHTMLEffect = []\n\n\tfunction _html(template, ...values) {\n\t\t// when template is cached just update the signals\n\t\tlet cached = get(template)\n\t\tif (cached) {\n\t\t\t/**\n\t\t\t * Purpose:\n\t\t\t *\n\t\t\t * 1. Track the `values` by reading, so we track the interpolated\n\t\t\t * values.\n\t\t\t * 2. Aditionally, this will also rerun when reactive values used\n\t\t\t * on the body of the function you pass to the effect\n\t\t\t * update.\n\t\t\t * 3. Update the `signals` when `values` change.\n\t\t\t *\n\t\t\t * It batches changes so it updates the template in one shot\n\t\t\t */\n\t\t\tbatch(() => {\n\t\t\t\tfor (let key = 0; key < values.length; key++) {\n\t\t\t\t\t// getValue(value) causes tracking\n\t\t\t\t\tcached[0][key].write(values[key])\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t/**\n\t\t\t * It needs to return the result because when nesting (ex\n\t\t\t * calling html twice inside the htmlEffect), the second call\n\t\t\t * will use the value of the first call. The result is a\n\t\t\t * reference to the nodes created before, so it always use the\n\t\t\t * same nodes, and reactivity on these nodes is live.\n\t\t\t *\n\t\t\t * ```js\n\t\t\t * htmlEffect(html => {\n\t\t\t * \tconst ELEMENTS = html`\n\t\t\t * \t\tdouble ${data.test * 2}\n\t\t\t * \t
`\n\t\t\t * \t// ^ these elements are needed in the next line\n\t\t\t * \treturn html`${data.test} ${ELEMENTS}
`\n\t\t\t * })\n\t\t\t * ```\n\t\t\t */\n\t\t\treturn cached[1]\n\t\t}\n\n\t\t/**\n\t\t * Creates the html with `signals` in place of the interpolated\n\t\t * `values`. This is to avoid having to create the template more\n\t\t * than once. Once the template is created, then the only thing\n\t\t * that will update is the `signals`.\n\t\t *\n\t\t * It creates a root because when any of the `values` changes\n\t\t * inside the body of the function that you pass to `htmlEffect`,\n\t\t * or when the interpolated `values` change, it causes disposal\n\t\t * (aka removing the elements), and htmlEffect re-runs. To avoid\n\t\t * having the elements removed by the disposal of the body of your\n\t\t * own function we create a root.\n\t\t */\n\t\tconst signals = []\n\t\tlet result\n\t\troot(dispose => {\n\t\t\tdisposeHTMLEffect.push(dispose)\n\n\t\t\t/**\n\t\t\t * HTML is created with the `signals` in place of the `values`.\n\t\t\t * Pota will add one effect for each signal. So this wont\n\t\t\t * re-run.\n\t\t\t */\n\t\t\tresult = html_(\n\t\t\t\ttemplate,\n\t\t\t\t...values.map((value, key) => {\n\t\t\t\t\tsignals[key] = signal(value)\n\t\t\t\t\t// give accesors to template instead of the `values`\n\t\t\t\t\treturn signals[key].read\n\t\t\t\t}),\n\t\t\t)\n\t\t})\n\n\t\t// save the `signals` in the cached template\n\t\tset(template, [signals, result])\n\t\treturn result\n\t}\n\n\t/**\n\t * This effect will re-run when the `values` interpolated change, or\n\t * when any signal that you use on the `htmlEffect` function body\n\t * change. It cause re-runs of what we are batching above.\n\t */\n\n\tlet result\n\n\tsyncEffect(() => {\n\t\tresult = fn(_html)\n\t})\n\n\t/** Dispose the effect when whatever started it is disposed. */\n\tcleanup(() => call(disposeHTMLEffect))\n\n\treturn result\n}\n\nexport const html = HTML()\n","import { signal, cleanup, syncEffect } from '../lib/reactive.js'\nimport { isIterable, toArray } from '../lib/std.js'\n\n/**\n * Returns a `isSelected` function that will return `true` when the\n * argument for it matches the original signal `value`.\n *\n * @param {Signal} value - Signal with the current value\n * @returns {(item: any) => Signal} Signal that you can run with a\n * value to know if matches the original signal\n */\nexport function useSelector(value) {\n\tconst map = new Map()\n\n\tlet prev = []\n\n\tsyncEffect(() => {\n\t\tconst val = value()\n\n\t\tconst selected = isIterable(val) ? toArray(val.values()) : [val]\n\n\t\t// unselect\n\t\tfor (const value of prev) {\n\t\t\tif (!selected.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(false)\n\t\t\t}\n\t\t}\n\n\t\t// select\n\t\tfor (const value of selected) {\n\t\t\tif (!prev.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(true)\n\t\t\t}\n\t\t}\n\n\t\tprev = selected\n\t})\n\n\t/**\n\t * Is selected function, it will return `true` when the value\n\t * matches the current signal.\n\t *\n\t * @param {any} item - Values to compare with current\n\t * @returns {Signal} A signal with a boolean value\n\t */\n\treturn function isSelected(item) {\n\t\tlet selected = map.get(item)\n\t\tif (!selected) {\n\t\t\tselected = signal(prev.includes(item))\n\t\t\tselected.counter = 0\n\t\t\tmap.set(item, selected)\n\t\t}\n\n\t\tselected.counter++\n\n\t\tcleanup(() => {\n\t\t\tif (--selected.counter === 0) {\n\t\t\t\tmap.delete(item)\n\t\t\t}\n\t\t})\n\n\t\treturn selected.read\n\t}\n}\n","export const now = () => Date.now()\n\nexport function date(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\to.getFullYear() +\n\t\t'-' +\n\t\t(o.getMonth() + 1 < 10 ? '0' : '') +\n\t\t(o.getMonth() + 1) +\n\t\t'-' +\n\t\t(o.getDate() < 10 ? '0' : '') +\n\t\to.getDate()\n\t)\n}\n\nexport function datetime(timestamp = now()) {\n\treturn date(timestamp) + ' ' + time(timestamp)\n}\n\nexport function time(timestamp = now()) {\n\treturn timeWithSeconds(timestamp).slice(0, -3)\n}\n\nexport function timeWithSeconds(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\t(o.getHours() < 10 ? '0' : '') +\n\t\to.getHours() +\n\t\t':' +\n\t\t(o.getMinutes() < 10 ? '0' : '') +\n\t\to.getMinutes() +\n\t\t':' +\n\t\t(o.getSeconds() < 10 ? '0' : '') +\n\t\to.getSeconds()\n\t)\n}\n\nexport function day(timestamp = now(), lang = 'en') {\n\tconst o = new Date(timestamp)\n\n\t// saturday, September 17, 2016\n\treturn o.toLocaleDateString(lang, {\n\t\tweekday: 'long',\n\t\tyear: 'numeric',\n\t\tmonth: 'long',\n\t\tday: 'numeric',\n\t})\n}\n\nexport function measure(name, cb) {\n\tconsole.time(name)\n\tconst r = cb()\n\tconsole.timeEnd(name)\n\treturn r\n}\n\nexport function timing(fn) {\n\tconst start = performance.now()\n\tfn()\n\treturn performance.now() - start\n}\n","import { batch, render, signal } from 'pota'\nimport { html } from 'pota/html'\nimport { useSelector } from 'pota/plugin/useSelector'\nimport { timing } from 'pota/plugin/useTime'\n\nlet idCounter = 1\nconst adjectives = [\n 'pretty',\n 'large',\n 'big',\n 'small',\n 'tall',\n 'short',\n 'long',\n 'handsome',\n 'plain',\n 'quaint',\n 'clean',\n 'elegant',\n 'easy',\n 'angry',\n 'crazy',\n 'helpful',\n 'mushy',\n 'odd',\n 'unsightly',\n 'adorable',\n 'important',\n 'inexpensive',\n 'cheap',\n 'expensive',\n 'fancy',\n ],\n colours = [\n 'red',\n 'yellow',\n 'blue',\n 'green',\n 'pink',\n 'brown',\n 'purple',\n 'brown',\n 'white',\n 'black',\n 'orange',\n ],\n nouns = [\n 'table',\n 'chair',\n 'house',\n 'bbq',\n 'desk',\n 'car',\n 'pony',\n 'cookie',\n 'sandwich',\n 'burger',\n 'pizza',\n 'mouse',\n 'keyboard',\n ]\n\nfunction _random(max) {\n return Math.round(Math.random() * 1000) % max\n}\n\nfunction buildData(count) {\n let data = new Array(count)\n for (let i = 0; i < count; i++) {\n const [label, setLabel] = signal(\n `${adjectives[_random(adjectives.length)]} ${\n colours[_random(colours.length)]\n } ${nouns[_random(nouns.length)]}`,\n )\n data[i] = {\n id: idCounter++,\n label,\n setLabel,\n }\n }\n return data\n}\n\nconst bbutton = ({ id, text, fn }) =>\n html`\n \n ${text}\n \n
`\n\nconst App = () => {\n const [data, setData, updateData] = signal([])\n const [selected, setSelected] = signal([])\n const run = () => setData(buildData(1000))\n const runLots = () => {\n setData(buildData(10000))\n }\n const bench = () => {\n // console.clear()\n // warm\n for (let k = 0; k < 5; k++) {\n setData(buildData(10000))\n setData([])\n }\n\n let createLarge = 0\n let clearLarge = 0\n let createSmall = 0\n let clearSmall = 0\n for (let k = 0; k < 10; k++) {\n createLarge += timing(() => setData(buildData(10000)))\n clearLarge += timing(() => setData([]))\n console.log(\n k + ' createLarge',\n createLarge / (k + 1),\n k + ' clearLarge',\n clearLarge / (k + 1),\n )\n }\n console.log('------------')\n for (let k = 0; k < 10; k++) {\n createSmall += timing(() => setData(buildData(1000)))\n clearSmall += timing(() => setData([]))\n console.log(\n k + ' createSmall',\n createSmall / (k + 1),\n k + ' clearSmall',\n clearSmall / (k + 1),\n )\n }\n }\n const add = () => updateData(d => [...d, ...buildData(1000)])\n const update = () =>\n batch(() => {\n for (let i = 0, d = data(), len = d.length; i < len; i += 10)\n d[i].setLabel(l => l + ' !!!')\n })\n const swapRows = () => {\n const d = data().slice()\n if (d.length > 998) {\n let tmp = d[1]\n d[1] = d[998]\n d[998] = tmp\n setData(d)\n }\n }\n const clear = () => setData([])\n const remove = id =>\n updateData(d => {\n const idx = d.findIndex(datum => datum.id === id)\n d.splice(idx, 1)\n return [...d]\n })\n const isSelected = useSelector(selected)\n\n html.define({ bbutton })\n\n return html`\n
\n
\n
\n
pota Keyed \n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n
{\n const element = e.target\n if (element.setSelected !== undefined) {\n setSelected(element.setSelected)\n } else if (element.removeRow !== undefined) {\n remove(element.removeRow)\n }\n }}\"\n >\n \n \n ${row => {\n const { id, label } = row\n\n return html`\n ${id} \n \n ${label} \n \n \n \n \n \n \n \n `\n }}\n \n \n
\n
\n
`\n}\n\nrender(App, document.getElementById('main'))\n"],"names":["global","globalThis","window","CSSStyleSheet","document","DocumentFragment","Object","Promise","Symbol","queueMicrotask","assign","entries","freeze","groupBy","isArray","Array","toArray","from","iterator","stringify","JSON","history","location","origin","promise","fn","resolved","onDone","then","catch","setAttribute","node","name","value","removeAttribute","isConnected","activeElement","documentElement","call","fns","bind","createElement","createElementNS","createTextNode","empty","create","flat","arr","length","withState","state","cacheStore","withCache","cache","thing","get","withWeakCache","weakStore","getDocumentForElement","getRootNode","nodeType","ownerDocument","getValue","identity","x","isFunction","isIterable","isObject","isNullUndefined","undefined","isString","noop","nothing","optional","querySelector","query","removeFromArray","array","index","indexOf","splice","walkParents","context","propertyName","cb","DataStore","constructor","kind","store","set","has","target","defaults","o","delete","WeakMap","Map","classListAdd","className","classList","add","classListRemove","remove","adoptedStyleSheetsGet","adoptedStyleSheets","adoptedStyleSheetsAdd","styleSheet","push","adoptedStyleSheetsRemove","addStyleSheets","styleSheets","sheet","addStyleSheetExternal","text","startsWith","fetch","r","css","resolve","template","values","String","raw","replace","emit","eventName","data","bubbles","cancelable","composed","dispatchEvent","CustomEvent","preventDefault","e","$isComponent","$isClass","$isReactive","$isMap","prefix","NS","__proto__","svg","math","html","xlink","CLEAN","STALE","CHECK","Owner","Listener","Updates","Effects","Time","Root","owner","owned","cleanups","options","dispose","i","Computation","updatedAt","sources","sourceSlots","update","time","prevOwner","prevListener","err","source","observers","observer","slot","pop","observerSlots","Effect","user","batch","SyncEffect","Memo","pure","markReactive","read","updates","runUpdates","upstream","sourceSlot","write","equals","downstream","a","b","nextValue","forEach","Signal","save","prev","root","signal","initialValue","effect","syncEffect","memo","runWithOwner","untrack","cleanup","runTop","ancestors","init","wait","res","runQueue","effects","runEffects","queue","userLength","ignore","Context","defaultValue","id","useContext","newValue","args","isReactive","withValue","withPrevValue","val","map","list","callback","sort","duplicates","runId","rows","clear","Row","item","isDupe","disposer","nodes","begin","end","all","mapper","items","hasPrev","row","dupes","unsorted","every","includes","usort","before","nodesFromRow","after","current","previous","previousSibling","nextSibling","children","unwrap","childrens","child","isComponent","isComponentable","makeCallback","callbacks","markComponent","addEventListener","type","handler","removeEventListener","ownedEvent","handleEvent","added","reset","priority","run","q","onFixes","onProps","onRef","onMount","ready","setEventNS","props","localName","ns","toLowerCase","slice","plugins","pluginsNS","propsPlugin","propName","onMicrotask","plugin","propsPluginNS","NSName","propsPluginBoth","setAttributeNS","_setAttribute","removeAttributeNS","setPropertyNS","setProperty","_setProperty","setUnknown","SVGElement","setBoolNS","setBool","_setBool","setStyle","setNodeStyle","style","setStyleNS","setVarNS","setStyleValue","cssText","_setStyleValue","removeProperty","setClass","setClassList","setClassNS","setElementClass","_setClassListValue","trim","split","randomId","crypto","getRandomValues","BigUint64Array","toString","setCSS","setNodeCSS","setRef","setOnMount","setUnmount","assignProps","assignProp","event","useXMLNS","Fragment","Component","component","Factory","propsOverride","createTag","createClass","createAnything","Node","createNode","render","tagName","xmlns","withXMLNS","nsContext","createChildren","parent","relative","Text","nodeValue","insertNode","createPlaceholder","toDiff","HTMLElement","childNodes","setValue","onResult","result","doc","propValue","head","getAttribute","rel","replaceWith","appendChild","insert","body","textContent","Infinity","toHTML","toHTMLFragment","fragment","ctx","Provider","next","customElement","customElements","define","CustomElement","shadowRoot","attachShadow","mode","baseStyleSheets","innerHTML","replaceChildren","hidden","hasSlot","Collapse","CollapseElement","when","Dynamic","For","restoreFocus","each","queued","active","scroll","scrollTop","focus","Portal","mount","Head","scrollToElement","scrollIntoView","scrollToLocationHash","scrollToSelector","hash","selector","scrollToSelectorWithFallback","scrollToTop","scrollTo","top","behavior","encodeURIComponent","_decodeURIComponent","string","decodeURIComponent","isAbsolute","href","test","isExternal","url","isRelative","replaceParams","params","setChildren","updateChildren","base","show","addChildren","removeChildren","noneMatch","getLocation","setLocation","wLocation","pathname","search","endsWith","path","searchParams","URL","key","routes","param","BeforeLeave","canNavigate","newBeforeLeave","beforeLeave","navigate","navigateInternal","startViewTransition","replaceState","pushState","addListenersAdded","addListeners","onLinkClick","onLocationChange","title","defaultPrevented","button","metaKey","altKey","ctrlKey","shiftKey","composedPath","find","HTMLAnchorElement","download","Show","condition","fallback","Router","route","RegExp","setParams","exec","groups","collapse","Default","A","Switch","matches","match","Match","defaultRegistry","join","parseHTML","content","DOMParser","parseFromString","toH","cached","attributes","components","textNodes","HTML","firstChild","userComponents","useSelector","selected","isSelected","counter","timing","start","performance","now","idCounter","adjectives","colours","nouns","_random","max","Math","round","random","buildData","count","label","setLabel","bbutton","App","setData","updateData","setSelected","runLots","bench","k","createLarge","clearLarge","createSmall","clearSmall","console","log","d","len","l","swapRows","tmp","idx","findIndex","datum","element","removeRow","getElementById"],"mappings":";;;CAAO,MAAMA,MAAM,GAAGC,UAAU,CAAA;CACzB,MAAMC,MAAM,GAAGF,MAAM,CAAA;CAErB,MAAMG,aAAa,GAAGH,MAAM,CAACG,aAAa,CAAA;CAC1C,MAAMC,UAAQ,GAAGJ,MAAM,CAACI,QAAQ,CAAA;CAChC,MAAMC,gBAAgB,GAAGL,MAAM,CAACK,gBAAgB,CAAA;CAChD,MAAMC,QAAM,GAAGN,MAAM,CAACM,MAAM,CAAA;CAC5B,MAAMC,SAAO,GAAGP,MAAM,CAACO,OAAO,CAAA;CAE9B,MAAMC,MAAM,GAAGR,MAAM,CAACQ,MAAM,CAAA;CAC5B,MAAMC,cAAc,GAAGT,MAAM,CAACS,cAAc,CAAA;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cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"main.js","sources":["../../../../../pota/src/lib/std.js","../../../../../pota/src/constants.js","../../../../../pota/src/lib/reactive.js","../../../../../pota/src/scheduler.js","../../../../../pota/src/props/event.js","../../../../../pota/src/props/plugin.js","../../../../../pota/src/props/attribute.js","../../../../../pota/src/props/property.js","../../../../../pota/src/props/unknown.js","../../../../../pota/src/props/bool.js","../../../../../pota/src/props/style.js","../../../../../pota/src/props/class.js","../../../../../pota/src/props/value.js","../../../../../pota/src/plugin/useRandom.js","../../../../../pota/src/props/css.js","../../../../../pota/src/props/lifecycle.js","../../../../../pota/src/props/@main.js","../../../../../pota/src/renderer.js","../../../../../pota/src/web/CustomElement.js","../../../../../pota/src/web/Collapse.js","../../../../../pota/src/web/Dynamic.js","../../../../../pota/src/web/For.js","../../../../../pota/src/web/Portal.js","../../../../../pota/src/web/Head.js","../../../../../pota/src/plugin/useScroll.js","../../../../../pota/src/plugin/useURL.js","../../../../../pota/src/web/router/context.js","../../../../../pota/src/plugin/useLocation.js","../../../../../pota/src/web/Show.js","../../../../../pota/src/web/router/scroll.js","../../../../../pota/src/web/router/router.js","../../../../../pota/src/web/router/link.js","../../../../../pota/src/web/Switch.js","../../../../../pota/src/html.js","../../../../../pota/src/plugin/useSelector.js","../../../../../pota/src/plugin/useTime.js","index.jsx"],"sourcesContent":["export const global = globalThis\nexport const window = global\n\nexport const CSSStyleSheet = global.CSSStyleSheet\nexport const document = global.document\nexport const DocumentFragment = global.DocumentFragment\nexport const Object = global.Object\nexport const Promise = global.Promise\nexport const requestAnimationFrame = global.requestAnimationFrame\nexport const Symbol = global.Symbol\nexport const queueMicrotask = global.queueMicrotask\n\nexport const assign = Object.assign\nexport const create = Object.create\nexport const defineProperties = Object.defineProperties\nexport const defineProperty = Object.defineProperty\nexport const entries = Object.entries\nexport const freeze = Object.freeze\nexport const fromEntries = Object.fromEntries\nexport const getOwnPropertyDescriptor =\n\tObject.getOwnPropertyDescriptor\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors\nexport const getOwnPropertyNames = Object.getOwnPropertyNames\nexport const getOwnPropertySymbols = Object.getOwnPropertySymbols\nexport const getPrototypeOf = Object.getPrototypeOf\nexport const groupBy = Object.groupBy\nexport const hasOwnProperty = Object.hasOwn\nexport const is = Object.is\nexport const isExtensible = Object.isExtensible\nexport const keys = Object.keys\nexport const values = Object.values\nexport const setPrototypeOf = Object.setPrototypeOf\n\nexport const isArray = Array.isArray\nexport const toArray = Array.from\n\nexport const isNaN = Number.isNaN\n\nexport const iterator = Symbol.iterator\n\nexport const stringify = JSON.stringify\nexport const stringifyReadable = o => stringify(o, null, 2)\n\nexport const stringifySorted = o => {\n\tfunction sort(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\t\tconst tmp = isArray(o) ? [] : {}\n\t\tkeys(o)\n\t\t\t.sort()\n\t\t\t.map(k => (tmp[k] = sort(o[k])))\n\n\t\tif (isArray(tmp)) {\n\t\t\ttmp.sort((a, b) => stringify(a).localeCompare(stringify(b)))\n\t\t}\n\t\treturn tmp\n\t}\n\treturn stringifyReadable(sort(o))\n}\n\nexport const PrototypeArray = Array.prototype\nexport const PrototypeMap = Map.prototype\n\nexport const history = global.history\nexport const location = global.location\nexport const navigator = global.navigator\n\nexport const origin = location.origin\n\nexport const promise = fn => new Promise(fn)\n\nexport const withResolvers = () => Promise.withResolvers()\n\n/**\n * Given a promise it adds `onDone` to `then` and `catch`\n *\n * ```js\n * resolved(promise, onDone)\n * // is same as\n * promise.then(onDone).catch(onDone)\n * ```\n */\nexport const resolved = (promise, onDone) =>\n\tpromise.then(onDone).catch(onDone)\n\nexport const setAttribute = (node, name, value) =>\n\tnode.setAttribute(name, value)\n\nexport const hasAttribute = (node, name) => node.hasAttribute(name)\n\nexport const removeAttribute = (node, name) =>\n\tnode.removeAttribute(name)\n\nexport const setAttributeNS = (node, name, value) =>\n\tnode.setAttributeNS(name, value)\n\nexport const hasAttributeNS = (node, name) =>\n\tnode.hasAttributeNS(name)\n\nexport const removeAttributeNS = (node, name) =>\n\tnode.removeAttributeNS(name)\n\nexport const isConnected = node => node.isConnected\n\nexport const activeElement = () => document.activeElement\n\nexport const documentElement = document.documentElement\n\n/**\n * Runs an array of functions\n *\n * @param {Iterable} fns\n */\nexport const call = fns => {\n\tfor (const fn of fns) fn()\n}\n\nexport function copy(o) {\n\tconst seen = new Map()\n\tfunction copy(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (\n\t\t\to instanceof Node ||\n\t\t\to instanceof Date ||\n\t\t\to instanceof Set ||\n\t\t\to instanceof Map ||\n\t\t\to instanceof WeakSet ||\n\t\t\to instanceof WeakMap ||\n\t\t\to instanceof Promise ||\n\t\t\to instanceof RegExp\n\t\t) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (seen.has(o)) {\n\t\t\treturn seen.get(o)\n\t\t}\n\n\t\tconst c = isArray(o) ? [] : {}\n\n\t\tseen.set(o, c)\n\n\t\tfor (const k in o) {\n\t\t\tc[k] = copy(o[k])\n\t\t}\n\t\treturn c\n\t}\n\treturn copy(o)\n}\n\n/**\n * Object.defineProperty with `enumerable` and `configurable` set to\n * `true` unless overwriten by `descriptor` argument\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n */\nexport const redefineProperty = (target, key, descriptor) =>\n\tdefineProperty(target, key, assign(create(defaults), descriptor))\n\nconst defaults = {\n\t__proto__: null,\n\tconfigurable: true,\n\tenumerable: true,\n}\n\n/**\n * Object.defineProperty with `configurable`, `writable` and\n * `enumerable` as `false`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {any} value\n */\nexport const definePropertyReadOnly = (target, key, value) => {\n\tconst descriptor = create(defaultsReadOnly)\n\tdescriptor.value = value\n\tdefineProperty(target, key, descriptor)\n}\n\nconst defaultsReadOnly = {\n\t__proto__: null,\n\tconfigurable: false,\n\tenumerable: false,\n\twritable: false,\n\tvalue: undefined,\n}\n\nconst bind = fn => document[fn].bind(document)\n\nexport const createElement = bind('createElement')\n\nexport const createElementNS = bind('createElementNS')\n\nexport const createTextNode = bind('createTextNode')\n\nexport const importNode = bind('importNode')\n\nexport const createTreeWalker = bind('createTreeWalker')\n\n/**\n * Returns an object without a prototype\n *\n * @type {Function}\n * @returns {Props} Empty object\n */\nexport const empty = Object.create.bind(null, null)\n\nexport function* entriesIncludingSymbols(target) {\n\tfor (const item of entries(target)) {\n\t\tyield item\n\t}\n\n\tfor (const item of getOwnPropertySymbols(target)) {\n\t\t// todo: causes access!\n\t\tyield [item, target[item]]\n\t}\n}\n\n// modified version of https://github.com/epoberezkin/fast-deep-equal\n\nexport function equals(a, b) {\n\tif (a === b) {\n\t\treturn true\n\t}\n\n\tif (a && b && typeof a == 'object' && typeof b == 'object') {\n\t\tif (a.constructor !== b.constructor) {\n\t\t\treturn false\n\t\t}\n\n\t\tlet length, i, k\n\t\tif (isArray(a)) {\n\t\t\tlength = a.length\n\t\t\tif (length != b.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor (i = length; i-- !== 0; ) {\n\t\t\t\tif (!equals(a[i], b[i])) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif (a.constructor === RegExp)\n\t\t\treturn a.source === b.source && a.flags === b.flags\n\t\tif (a.valueOf !== Object.prototype.valueOf)\n\t\t\treturn a.valueOf() === b.valueOf()\n\t\tif (a.toString !== Object.prototype.toString)\n\t\t\treturn a.toString() === b.toString()\n\n\t\tk = keys(a)\n\t\tlength = k.length\n\t\tif (length !== keys(b).length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(b, k[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tvar key = k[i]\n\n\t\t\tif (!equals(a[key], b[key])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// true if both NaN, false otherwise\n\treturn a !== a && b !== b\n}\n\n/**\n * Flats an array/childNodes to the first children if the length is 1\n *\n * @param {any[] | NodeListOf} arr\n * @returns {any}\n */\nexport const flat = arr => (arr.length === 1 ? arr[0] : arr)\n\n/**\n * Keeps state in the function as the first param\n *\n * @template T\n * @param {T} fn - Function to which add state to it\n * @param {DataStore | DataStore} [state] - Passed to\n * `fn` as first param\n * @returns {T} A copy of the function with the state\n */\nexport const withState = /* #__NO_SIDE_EFFECTS__ */ (\n\tfn,\n\tstate = cacheStore,\n) => fn.bind(null, state())\n\n/** Memoize functions with a map cache */\nexport const withCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tcacheStore,\n\t)\n/** Memoize functions with a weak cache */\nexport const withWeakCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tweakStore,\n\t)\n\nexport const walkElements = withState(\n\t(walk, node, fn) => {\n\t\twalk.currentNode = node\n\n\t\t/**\n\t\t * The first node is not walked by the walker.\n\t\t *\n\t\t * Also the first node could be a DocumentFragment\n\t\t */\n\t\tif (node.nodeType === 1) {\n\t\t\tif (fn(node)) return\n\t\t}\n\n\t\twhile ((node = walk.nextNode())) {\n\t\t\tif (fn(node)) break\n\t\t}\n\t},\n\t() => createTreeWalker(document, 1 /*NodeFilter.SHOW_ELEMENT*/),\n)\n\n/**\n * Returns `document` for element. That could be a `shadowRoot`\n *\n * @param {Element} node\n * @returns {Document | ShadowRoot}\n */\n\nexport const getDocumentForElement = node => {\n\tconst document = node.getRootNode()\n\tconst { nodeType } = document\n\t// getRootNode returns:\n\t// 1. Node for isConnected = false\n\t// 2. Document for isConnected = true\n\t// 3. shadowRoot for custom elements\n\n\t// always return a Document-like\n\treturn nodeType === 11 || nodeType === 9\n\t\t? document\n\t\t: node.ownerDocument\n}\n\nexport const getOwnValues = o =>\n\tgetOwnPropertyNames(o).map(key => {\n\t\ttry {\n\t\t\treturn o[key]\n\t\t} catch (e) {}\n\t})\n\nexport function getSetterNamesFromPrototype(object, set = new Set()) {\n\tconst descriptors = getOwnPropertyDescriptors(object)\n\n\tfor (const key in descriptors) {\n\t\tif (descriptors[key].set) {\n\t\t\tset.add(key)\n\t\t}\n\t}\n\n\treturn set\n}\n\n/**\n * Unwraps values. If the argument is a function then it runs it\n * recursively and returns the value\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValue(value) {\n\twhile (typeof value === 'function') value = value()\n\treturn value\n}\n\n/**\n * Unwraps `value` and returns `element` if result is a `Node`, else\n * `undefined` in the case isn't a `Node`\n *\n * @param {Function | any} value - Maybe function\n * @param {...any} args? - Arguments\n * @returns {Node | undefined}\n */\nexport function getValueElement(value, ...args) {\n\tconst element = getValueWithArguments(value, ...args)\n\treturn element instanceof Node ? element : undefined\n}\n\nexport const getValueWithArguments = (value, ...args) =>\n\ttypeof value === 'function'\n\t\t? args.length\n\t\t\t? getValue(value(...args))\n\t\t\t: getValue(value())\n\t\t: value\n\n/**\n * Identity function, given `x` returns `x`\n *\n * @template T\n * @param {T} x\n * @returns {T}\n */\nexport const identity = x => x\n\n/**\n * When `value` is an object, it will check if the `key` on `target`\n * is `configurable`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {boolean | undefined} value\n */\nexport const isConfigurable = (target, key, value) => {\n\tif (isObject(value)) {\n\t\tconst descriptor = getOwnPropertyDescriptor(target, key)\n\t\tif (descriptor) {\n\t\t\treturn descriptor.configurable\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Returns `true` when `typeof` of `value` is `function`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isFunction = value => typeof value === 'function'\n\n/**\n * Returns `true` when value is Iterable\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isIterable = value =>\n\tisObject(value) && 'values' in value\n\n/**\n * Returns `true` if the value is `null` or `undefined`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNullUndefined = value =>\n\tvalue === undefined || value === null\n\n/**\n * Returns `true` when typeof of value is object and not null\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isObject = value =>\n\tvalue !== null && typeof value === 'object'\n\n/**\n * Returns `true` when object morphed between array/object\n *\n * @param {any} a\n * @param {any} b\n * @returns {boolean}\n */\nexport const morphedBetweenArrayAndObject = (a, b) =>\n\t(isObject(a) && !isObject(b)) ||\n\t(isObject(b) && !isObject(a)) ||\n\t(isArray(a) && !isArray(b)) ||\n\t(isArray(b) && !isArray(a))\n\n/**\n * Returns `true` if the property is defined in the `prototype` and\n * absent in the `object`\n *\n * @param {object} target\n * @param {PropertyKey} key\n */\nexport const isPrototypeProperty = (target, key) =>\n\t// must do `key in target` to check that it DOES have it somewhere\n\t// must do !hasOwnProperty to check that isnt an own property\n\tkey in target && !hasOwnProperty(target, key)\n\n/**\n * Returns `true` when `typeof` of `value` is `string`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isString = value => typeof value === 'string'\n\n/**\n * Returns `true` when `typeof` of `value` is `number`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNumber = value => typeof value === 'number'\n\n/**\n * Returns `true` when `typeof` of `value` is `symbol`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isSymbol = value => typeof value === 'symbol'\n\n/**\n * Returns `true` when `typeof` of `value` is `boolean`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isBoolean = value => typeof value === 'boolean'\n\n/**\n * Returns `true` when `value` may be a promise\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isPromise = value => isObject(value) && 'then' in value\n\nexport const noop = () => {}\n\n/**\n * An empty frozen object\n *\n * @type object\n */\nexport const nothing = freeze(empty())\n\n// an optional value is `true` by default, so most of the time is undefined which means is `true`\n// to avoid having conditions like `if(something.bla === undefined || something.bla)`\n// this function will short it to `if(optional(something.bla))`\n// additionally the value is resolved, for cases like `when={() => show() && optional(props.when)}`\n\n/**\n * Returns `true` when value is true or undefined\n *\n * @param {Function | boolean | undefined} value\n * @returns {boolean} True when value is true or undefined\n */\nexport const optional = value =>\n\tvalue === undefined || getValue(value)\n\nexport const partAdd = (node, className) => node.part.add(className)\n\nexport const partRemove = (node, className) =>\n\tnode.part.remove(className)\n\nexport const querySelector = (node, query) =>\n\tnode.querySelector(query)\n\nexport const querySelectorAll = (node, query) =>\n\tnode.querySelectorAll(query)\n\nexport function* range(start, stop, step = 1) {\n\tyield start\n\twhile (start < stop) {\n\t\tyield (start += step)\n\t}\n}\n\nexport const {\n\townKeys: reflectOwnKeys,\n\thas: reflectHas,\n\tdeleteProperty: reflectDeleteProperty,\n\tgetOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor,\n\tget: reflectGet,\n\tapply: reflectApply,\n\tset: reflectSet,\n} = Reflect\n\n/**\n * Removes a value from an array\n *\n * @template T\n * @param {T[]} array\n * @param {T} value To remove from the array\n * @returns {T[]}\n */\nexport function removeFromArray(array, value) {\n\tconst index = array.indexOf(value)\n\tif (index !== -1) array.splice(index, 1)\n\treturn array\n}\n/**\n * Removes values from an array based on a condition\n *\n * @template T\n * @param {T[]} array\n * @param {(value: T, index: number) => boolean} cb Function with\n * condition\n */\nexport function removeFromArrayConditionally(array, cb) {\n\tlet i = array.length\n\twhile (i--) {\n\t\tif (cb(array[i], i)) {\n\t\t\tarray.splice(i, 1)\n\t\t}\n\t}\n}\n/**\n * Removes values from an array based on a condition\n *\n * @param {Iterable} iterable\n * @param {PropertyKey} key Function with condition\n */\nexport function indexByKey(iterable, key) {\n\tconst byKey = empty()\n\tfor (const item of iterable) {\n\t\tbyKey[item[key]] = item\n\t}\n\treturn byKey\n}\n\n/**\n * Replace a prototype in the prototype chain with another prototype\n *\n * @param {object} target - Target object\n * @param {object} search - The prototype to replace\n * @param {object} replacement - The replacement prototype\n */\nexport function replacePrototypeWith(target, search, replacement) {\n\tlet prototype = target\n\twhile (getPrototypeOf(prototype) !== search) {\n\t\tprototype = getPrototypeOf(prototype)\n\t}\n\n\tsetPrototypeOf(prototype, replacement)\n}\n\nexport const typeString = obj =>\n\tObject.prototype.toString.call(obj).slice(8, -1)\n\nexport function walkParents(context, propertyName, cb) {\n\twhile (context) {\n\t\tif (cb(context)) return true\n\t\tcontext = context[propertyName]\n\t}\n}\n\n/**\n * Store template\n *\n * @typedef {(\n * \treference: any,\n * \tcreateIfNotExistsAs?: ((target: any) => any) | Function,\n * ) => any} DataStoreGet\n *\n *\n * @typedef {(key: any, value: any) => void} DataStoreSet\n *\n * @typedef {(key: any) => boolean} DataStoreHas\n *\n * @typedef {(key: any) => boolean} DataStoreDelete\n */\n\nclass DataStore {\n\tconstructor(kind) {\n\t\tconst store = new kind()\n\n\t\tconst get = k => store.get(k)\n\t\tconst set = (k, v) => store.set(k, v)\n\t\tconst has = k => store.has(k)\n\n\t\tthis.get = (target, defaults = undefined) => {\n\t\t\tconst o = get(target)\n\n\t\t\tif (o !== undefined) {\n\t\t\t\treturn o\n\t\t\t}\n\n\t\t\tif (defaults !== undefined) {\n\t\t\t\t/**\n\t\t\t\t * Default values should be passed as a function, so we dont\n\t\t\t\t * constantly initialize values when giving them\n\t\t\t\t */\n\t\t\t\tdefaults = defaults(target)\n\t\t\t\tset(target, defaults)\n\t\t\t\treturn defaults\n\t\t\t}\n\t\t}\n\n\t\tthis.set = set\n\t\tthis.has = has\n\t\tthis.delete = k => store.delete(k)\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.get\n\t\tyield this.set\n\t\tyield this.has\n\t\tyield this.delete\n\t}\n}\n\n/**\n * Creates a WeakMap to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdelete: DataStoreDelete\n * }}\n */\nexport const weakStore = () => new DataStore(WeakMap)\n\n/**\n * Creates a Map to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdel: DataStoreDelete\n * }}\n */\nexport const cacheStore = () => new DataStore(Map)\n\nexport const classListAdd = (node, className) =>\n\tnode.classList.add(className)\n\nexport const classListRemove = (node, className) =>\n\tnode.classList.remove(className)\n\n/**\n * - Returns `adoptedStyleSheets` for a document\n *\n * @param {Document | ShadowRoot} document\n */\nexport const adoptedStyleSheetsGet = document =>\n\tdocument.adoptedStyleSheets\n\nexport const adoptedStyleSheets =\n\t/* #__PURE__*/ adoptedStyleSheetsGet(document)\n\n/**\n * Adds a style sheet to the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsAdd = (document, styleSheet) =>\n\tadoptedStyleSheetsGet(document).push(styleSheet)\n\n/**\n * Removes a style sheet from the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsRemove = (document, styleSheet) =>\n\tremoveFromArray(adoptedStyleSheetsGet(document), styleSheet)\n\n/**\n * Adds a style sheet to the custom element\n *\n * @param {Document | ShadowRoot} document\n * @param {(CSSStyleSheet | string)[]} styleSheets\n */\nexport function addStyleSheets(document, styleSheets = []) {\n\tfor (const sheet of styleSheets) {\n\t\tif (sheet) {\n\t\t\tsheet instanceof CSSStyleSheet\n\t\t\t\t? adoptedStyleSheetsAdd(document, sheet)\n\t\t\t\t: addStyleSheetExternal(document, sheet)\n\t\t}\n\t}\n}\n\n/**\n * Adds the stylesheet from urls. It uses a cache, to avoid having to\n * fire a request for each external sheet when used in more than one\n * custom element. Also, all reference the same object.\n *\n * @param {Document | ShadowRoot} document\n * @param {string} text\n */\nexport const addStyleSheetExternal = withState(\n\t(state, document, text) => {\n\t\tstate\n\t\t\t.get(text, text =>\n\t\t\t\ttext.startsWith('http')\n\t\t\t\t\t? fetch(text)\n\t\t\t\t\t\t\t.then(r => r.text())\n\t\t\t\t\t\t\t.then(css => sheet(css))\n\t\t\t\t\t: promise(resolve => resolve(sheet(text))),\n\t\t\t)\n\t\t\t.then(styleSheet => adoptedStyleSheetsAdd(document, styleSheet))\n\t},\n)\n\n/**\n * Swaps classNames and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldClass - `class` with the old animation\n * @param {string} newClass - `class` with the new animation\n */\nexport const animateClassTo = (element, oldClass, newClass) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tclassListRemove(element, oldClass)\n\t\t\tclassListAdd(element, newClass)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Swaps parts and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldPart - `part` with the old animation\n * @param {string} newPart - `part` with the new animation\n */\nexport const animatePartTo = (element, oldPart, newPart) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tpartRemove(element, oldPart)\n\t\t\tpartAdd(element, newPart)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Creates tagged css and returns a CSSStyleSheet. Mostly for css\n * highlighting in js\n *\n * @param {TemplateStringsArray} template\n * @param {...any} values\n * @returns {CSSStyleSheet}\n */\nexport const css = (template, ...values) =>\n\tsheet(String.raw({ raw: template }, ...values))\n\n/**\n * Creates a stylesheet from a css string\n *\n * @param {string} css\n * @returns {CSSStyleSheet}\n */\nexport const sheet = withCache(css => {\n\tconst sheet = new CSSStyleSheet()\n\t/**\n\t * Replace is asynchronous and can accept @import statements\n\t * referencing external resources.\n\t */\n\tsheet.replace(css)\n\n\treturn sheet\n})\n\n/**\n * @param {Element} node\n * @param {string} eventName\n * @param {any} [data]\n */\n\nexport const emit = (\n\tnode,\n\teventName,\n\tdata = { bubbles: true, cancelable: true, composed: true },\n) => node.dispatchEvent(new CustomEvent(eventName, data))\n\nexport function stopEvent(e) {\n\tpreventDefault(e)\n\tstopPropagation(e)\n\tstopImmediatePropagation(e)\n}\n\nexport const preventDefault = e => e.preventDefault()\nexport const stopPropagation = e => e.stopPropagation()\nexport const stopImmediatePropagation = e =>\n\te.stopImmediatePropagation()\n\n/**\n * Waits for an event to be dispatched and runs a callback\n *\n * @param {Element} element\n * @param {string} eventName\n */\nexport const waitEvent = withState(\n\t(state, element, eventName) =>\n\t\tpromise((resolve, reject) => {\n\t\t\t/**\n\t\t\t * To prevent firing `transitionend` twice it needs to stop\n\t\t\t * listening the old one because maybe wasn't dispatched and\n\t\t\t * running a new transition will make it dispatch twice\n\t\t\t */\n\t\t\tconst previous = state.get(element, empty)\n\t\t\tprevious.reject && previous.reject()\n\t\t\telement.removeEventListener(eventName, previous.resolve)\n\t\t\tstate.set(element, { resolve, reject })\n\t\t\telement.addEventListener(eventName, resolve, {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t}),\n\tweakStore,\n)\n\nexport const addEventListenerObject = (where, type, handler) =>\n\twhere.addEventListener(type, handler, handler)\n\nexport const removeEventListenerObject = (where, type, handler) =>\n\twhere.removeEventListener(type, handler, handler)\n\n/** @param {EventListener} fn */\nexport const passiveEvent = fn => ({ handleEvent: fn, passive: true })\n","// symbols\n\nimport { Symbol } from './lib/std.js'\n\nexport const $isComponent = Symbol()\nexport const $isClass = Symbol()\nexport const $isReactive = Symbol()\nexport const $isMap = Symbol()\n\n// supported namespaces\n\nconst prefix = 'http://www.w3.org/'\n\n// when a tag/attribute is missing the namespace this puts it back in\n\nexport const NS = {\n\t__proto__: null,\n\tsvg: prefix + '2000/svg',\n\tmath: prefix + '1998/Math/MathML',\n\thtml: prefix + '1999/xhtml',\n\txlink: prefix + '1999/xlink',\n}\n","/**\n * This is so far the core of Solid JS Reactivity, this may change.\n *\n * Adaptation for potas needs have been made:\n *\n * - Ported to Classes what does fit\n * - Signal has more options: `label` and `save` previous value\n * - Writing to a signal returns `true` when the value changes\n * - Signal is an object that could be used as signal.read/write or\n * destructured as an array.\n * - Signals can save and wont run functions\n * - `update` function on Signal that could be used to use the old value\n */\n\nimport {\n\t$isClass,\n\t$isComponent,\n\t$isMap,\n\t$isReactive,\n} from '../constants.js'\n\nimport {\n\tassign,\n\tentries,\n\tflat,\n\tgetValue,\n\tgroupBy,\n\tisArray,\n\tisFunction,\n\tisIterable,\n\tisObject,\n\tisPromise,\n\tkeys,\n\tnothing,\n\tqueueMicrotask,\n\tremoveFromArray,\n\tresolved,\n\tSymbol,\n\tweakStore,\n\twithResolvers,\n\twithState,\n\twithWeakCache,\n} from './std.js'\n\nconst CLEAN = 0\nconst STALE = 1\nconst CHECK = 2\n\nlet Owner\nlet Listener\n\nlet Updates = null\nlet Effects = null\n\nlet Time = 0\n\n// ROOT\n\nclass Root {\n\towner\n\towned\n\n\tcleanups\n\n\tcontext\n\n\tconstructor(owner, options) {\n\t\tthis.owner = owner\n\t\tthis.context = owner?.context\n\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t}\n\t}\n\n\tdispose() {\n\t\tlet i\n\n\t\tconst { owned, cleanups } = this\n\n\t\tif (owned) {\n\t\t\tfor (i = owned.length - 1; i >= 0; i--) {\n\t\t\t\towned[i].dispose()\n\t\t\t}\n\t\t\towned.length = 0\n\t\t}\n\t\tif (cleanups) {\n\t\t\tfor (i = cleanups.length - 1; i >= 0; i--) {\n\t\t\t\tcleanups[i]()\n\t\t\t}\n\t\t\tcleanups.length = 0\n\t\t}\n\t}\n}\n\n// COMPUTATION\n\nclass Computation extends Root {\n\tstate = STALE\n\n\tupdatedAt = 0\n\n\tfn\n\n\tsources\n\tsourceSlots\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, options)\n\n\t\tthis.fn = fn\n\n\t\tif (owner) {\n\t\t\tif (owner.owned) {\n\t\t\t\towner.owned.push(this)\n\t\t\t} else {\n\t\t\t\towner.owned = [this]\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tthis.fn()\n\t\t} catch (err) {\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\n\t\tif (this.updatedAt <= time) {\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n\n\tdispose() {\n\t\tconst { sources, sourceSlots } = this\n\n\t\tif (sources) {\n\t\t\tlet source\n\t\t\tlet observers\n\t\t\tlet index\n\n\t\t\tlet observer\n\t\t\tlet slot\n\t\t\twhile (sources.length) {\n\t\t\t\tsource = sources.pop()\n\t\t\t\tobservers = source.observers\n\n\t\t\t\tindex = sourceSlots.pop()\n\n\t\t\t\tif (observers && observers.length) {\n\t\t\t\t\tobserver = observers.pop()\n\t\t\t\t\tslot = source.observerSlots.pop()\n\n\t\t\t\t\tif (index < observers.length) {\n\t\t\t\t\t\tobserver.sourceSlots[slot] = index\n\t\t\t\t\t\tobservers[index] = observer\n\t\t\t\t\t\tsource.observerSlots[index] = slot\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.dispose()\n\n\t\tthis.state = CLEAN\n\t}\n}\n\nclass Effect extends Computation {\n\tuser = true\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tEffects ? Effects.push(this) : batch(() => this.update())\n\t}\n}\n\nclass SyncEffect extends Computation {\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tbatch(() => this.update())\n\t}\n}\n\n// SIGNALS\n\nclass Memo extends Computation {\n\tstate = STALE\n\n\tpure = true\n\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\treturn markReactive(this.read.bind(this))\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (this.state) {\n\t\t\tif (this.state === STALE) {\n\t\t\t\tthis.update()\n\t\t\t} else {\n\t\t\t\tconst updates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(this))\n\t\t\t\tUpdates = updates\n\t\t\t}\n\t\t}\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tlet nextValue\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tnextValue = this.fn()\n\t\t} catch (err) {\n\t\t\tthis.state = STALE\n\t\t\tif (this.owned) {\n\t\t\t\tthis.owned.forEach(node => node.dispose())\n\t\t\t\tthis.owned.length = 0\n\t\t\t}\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\t\tif (this.updatedAt <= time) {\n\t\t\tif (this.updatedAt !== 0) {\n\t\t\t\tthis.write(nextValue)\n\t\t\t} else {\n\t\t\t\tthis.value = nextValue\n\t\t\t}\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n}\n\n// SIGNAL\n\nclass Signal {\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\t// save\n\n\t// `prev` if option save was given\n\n\tconstructor(value, options) {\n\t\tthis.value = value\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = value\n\t\t\t}\n\t\t}\n\n\t\tthis.read = markReactive(this.read)\n\t}\n\n\tread = () => {\n\t\t// checkReadForbidden()\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite = value => {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = this.value\n\t\t\t}\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tupdate = value => {\n\t\tif (isFunction(value)) {\n\t\t\tvalue = value(this.value)\n\t\t}\n\t\treturn this.write(value)\n\t}\n\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.read\n\t\tyield this.write\n\t\tyield this.update\n\t}\n}\n\n// API\n\n/**\n * Creates a new root\n *\n * @param {(dispose: Function) => any} fn\n * @param {object} [options]\n * @returns {any}\n */\nexport function root(fn, options = undefined) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tconst root = new Root(Owner, options)\n\n\tOwner = root\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(() => fn(() => root.dispose()), true)\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Creates a signal\n *\n * @template const T\n * @param {T} [initialValue] - Initial value of the signal\n * @param {SignalOptions} [options] - Signal options\n * @returns {SignalObject}\n */\n/* #__NO_SIDE_EFFECTS__ */\nexport function signal(initialValue, options = undefined) {\n\treturn new Signal(initialValue, options)\n}\n\n/**\n * Creates an effect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function effect(fn, options = undefined) {\n\tnew Effect(Owner, fn, options)\n}\n\n/**\n * Creates an effect with explicit dependencies\n *\n * @param {Function} depend - Function that causes tracking\n * @param {Function} fn - Function that wont cause tracking\n * @param {object} [options]\n */\nexport function on(depend, fn, options = undefined) {\n\teffect(() => {\n\t\tdepend()\n\t\tuntrack(fn)\n\t}, options)\n}\n\n/**\n * Creates a syncEffect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function syncEffect(fn, options = undefined) {\n\treturn new SyncEffect(Owner, fn, options)\n}\n\n/**\n * Creates a read-only signal from the return value of a function that\n * automatically updates\n *\n * @template T\n * @param {() => T} fn - Function to re-run when dependencies change\n * @param {SignalOptions} [options]\n * @returns {SignalAccessor} - Read only signal\n */\n\n/* #__NO_SIDE_EFFECTS__ */ export function memo(\n\tfn,\n\toptions = undefined,\n) {\n\treturn new Memo(Owner, fn, options)\n}\n\n/**\n * Batches changes to signals\n *\n * @param {Function} fn\n * @returns {any}\n */\nexport const batch = runUpdates\n\n/**\n * Returns current owner\n *\n * @returns {typeof Owner}\n */\nexport function owner() {\n\treturn Owner\n}\n\nfunction runWithOwner(owner, fn) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tOwner = owner\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(fn, true)\n\t} catch (err) {\n\t\tthrow err\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Disables tracking for a function\n *\n * @param {Function} fn - Function to run with tracking disabled\n * @returns {any}\n */\nexport function untrack(fn) {\n\tif (Listener === undefined) {\n\t\treturn fn()\n\t}\n\n\tconst prevListener = Listener\n\tListener = undefined\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Runs a callback on cleanup, returns callback\n *\n * @template T\n * @param {T} fn\n * @returns {T}\n */\nexport function cleanup(fn) {\n\tif (Owner) {\n\t\tif (Owner.cleanups) {\n\t\t\tOwner.cleanups.push(fn)\n\t\t} else {\n\t\t\tOwner.cleanups = [fn]\n\t\t}\n\t}\n\treturn fn\n}\n\n// UPDATES\n\nfunction runTop(node) {\n\tswitch (node.state) {\n\t\tcase CLEAN: {\n\t\t\treturn\n\t\t}\n\t\tcase CHECK: {\n\t\t\treturn upstream(node)\n\t\t}\n\t}\n\n\tconst ancestors = []\n\n\tdo {\n\t\tif (node.state) {\n\t\t\tancestors.push(node)\n\t\t}\n\t\tnode = node.owner\n\t} while (node && node.updatedAt < Time)\n\n\tfor (let i = ancestors.length - 1, updates; i >= 0; i--) {\n\t\tnode = ancestors[i]\n\n\t\tswitch (node.state) {\n\t\t\tcase STALE: {\n\t\t\t\tnode.update()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase CHECK: {\n\t\t\t\tupdates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(node, ancestors[0]))\n\t\t\t\tUpdates = updates\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction runUpdates(fn, init = false) {\n\tif (Updates) {\n\t\treturn fn()\n\t}\n\n\tlet wait = false\n\n\tif (!init) {\n\t\tUpdates = []\n\t}\n\n\tif (Effects) {\n\t\twait = true\n\t} else {\n\t\tEffects = []\n\t}\n\n\tTime++\n\n\ttry {\n\t\tconst res = fn()\n\n\t\tif (Updates) {\n\t\t\trunQueue(Updates)\n\t\t\tUpdates = null\n\t\t}\n\t\tif (!wait) {\n\t\t\tconst effects = Effects\n\t\t\tEffects = null\n\t\t\tif (effects.length) {\n\t\t\t\trunUpdates(() => runEffects(effects))\n\t\t\t}\n\t\t}\n\n\t\treturn res\n\t} catch (err) {\n\t\tif (!wait) {\n\t\t\tEffects = null\n\t\t}\n\t\tUpdates = null\n\n\t\tthrow err\n\t}\n}\n\nfunction runQueue(queue) {\n\tfor (let i = 0; i < queue.length; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction runEffects(queue) {\n\tlet i\n\n\tlet effect\n\tlet userLength = 0\n\tfor (i = 0; i < queue.length; i++) {\n\t\teffect = queue[i]\n\n\t\tif (!effect.user) {\n\t\t\trunTop(effect)\n\t\t} else {\n\t\t\tqueue[userLength++] = effect\n\t\t}\n\t}\n\n\tfor (i = 0; i < userLength; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction upstream(node, ignore) {\n\tnode.state = CLEAN\n\n\tfor (let i = 0, source; i < node.sources.length; i++) {\n\t\tsource = node.sources[i]\n\n\t\tif (source.sources) {\n\t\t\tswitch (source.state) {\n\t\t\t\tcase STALE: {\n\t\t\t\t\tif (source !== ignore && source.updatedAt < Time) {\n\t\t\t\t\t\trunTop(source)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase CHECK: {\n\t\t\t\t\tupstream(source, ignore)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction downstream(node) {\n\tfor (let i = 0, observer; i < node.observers.length; i++) {\n\t\tobserver = node.observers[i]\n\n\t\tif (observer.state === CLEAN) {\n\t\t\tobserver.state = CHECK\n\t\t\tif (observer.pure) {\n\t\t\t\tUpdates.push(observer)\n\t\t\t} else {\n\t\t\t\tEffects.push(observer)\n\t\t\t}\n\t\t\tobserver.observers && downstream(observer)\n\t\t}\n\t}\n}\n\nlet readForbid = false\n\nfunction checkReadForbidden() {\n\tif (readForbid) {\n\t\tconsole.trace('Signal Read!')\n\t}\n}\nexport function readForbidden(fn, value) {\n\tconst prev = readForbid\n\ttry {\n\t\treadForbid = value\n\t\treturn fn()\n\t} finally {\n\t\treadForbid = prev\n\t}\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {typeof Context} Context\n */\nexport function Context(defaultValue = undefined) {\n\tconst id = Symbol()\n\n\treturn useContext.bind(null, id, defaultValue)\n}\n\n/**\n * @overload Gets the context value\n * @returns {any} Context value\n */\n/**\n * @overload Runs `fn` with a new value as context\n * @param {any} newValue - New value for the context\n * @param {Function} fn - Callback to run with the new context value\n * @returns {Children} Children\n */\n/**\n * @param {any} newValue\n * @param {Function} fn\n */\nfunction useContext(id, defaultValue, newValue, fn) {\n\tif (newValue === undefined) {\n\t\treturn Owner?.context && Owner.context[id] !== undefined\n\t\t\t? Owner.context[id]\n\t\t\t: defaultValue\n\t} else {\n\t\tlet res\n\n\t\tsyncEffect(() => {\n\t\t\tOwner.context = {\n\t\t\t\t...Owner.context,\n\t\t\t\t[id]: newValue,\n\t\t\t}\n\t\t\tres = untrack(fn)\n\t\t})\n\n\t\treturn res\n\t}\n}\n\n/**\n * Returns an owned function\n *\n * @param {function | undefined} cb\n * @returns {() => any}\n */\nexport const owned = cb => {\n\tconst o = Owner\n\treturn (...args) => cb && runWithOwner(o, () => cb(...args))\n}\n\n/**\n * Returns true when value is reactive (a signal)\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isReactive = value =>\n\tisFunction(value) && $isReactive in value\n\n/**\n * Marks a function as reactive. Reactive functions are ran inside\n * effects.\n *\n * @param {Function} fn - Function to mark as reactive\n * @returns {Function}\n */\nexport function markReactive(fn) {\n\tfn[$isReactive] = undefined\n\treturn fn\n}\n\n/**\n * Proxies a signals property access so you dont have to call the\n * function\n *\n * @param {Signal} snigal - Signal to proxy\n * @param {object} [target] - Target object for the proxy\n * @returns {object} An object that will read the properties from the\n * signal\n */\nexport const proxy = (snigal, target = nothing) =>\n\tnew Proxy(target, {\n\t\tget(target, key) {\n\t\t\treturn snigal()[key]\n\t\t},\n\t\thas(target, key) {\n\t\t\treturn key in snigal()\n\t\t},\n\t\townKeys(target) {\n\t\t\treturn keys(snigal())\n\t\t},\n\t})\n\n/**\n * A self contained signal function, when an argument is present it\n * writes to the signal, when theres no argument it reads the signal.\n *\n * @template T\n * @param {T} [value] - Optional initial value\n * @returns {SignalFunction}\n */\nexport function signalFunction(value) {\n\tconst [read, write] = signal(value)\n\treturn markReactive((...args) =>\n\t\targs.length ? write(args[0]) : read(),\n\t)\n}\n\n/**\n * To set and read refs. To use in ref attribute.\n *\n * @template T\n * @returns {SignalFunction}\n */\nexport const ref = () => signalFunction()\n\n/**\n * Runs a function inside an effect if value is a function.\n * Aditionally unwraps promises.\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport const withValue = (value, fn) => {\n\tif (isFunction(value)) {\n\t\teffect(() => withValue(getValue(value), fn))\n\t} else if (isPromise(value)) {\n\t\tvalue.then(owned(value => withValue(value, fn)))\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport function withPrevValue(value, fn) {\n\tif (isFunction(value)) {\n\t\tlet prev = undefined\n\t\teffect(() => {\n\t\t\tconst val = getValue(value)\n\t\t\tfn(val, prev)\n\t\t\tprev = val\n\t\t})\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Lazy and writable version of `memo`, its writable and will run the\n * function only when used\n *\n * @author ryansolid\n * @param {Function} fn - Function to re-run when dependencies change\n * @returns {((...args) => any) | (() => any)}\n */\nexport function writable(fn) {\n\tconst result = memo(() => signal(fn()))\n\n\treturn markReactive((...args) => {\n\t\treturn args.length ? result().write(args[0]) : result().read()\n\t})\n}\n\n/**\n * Creates an asynchronously effect\n *\n * @param {(currentRunningEffect: Promise) => any} fn - A\n * function that receives a `currentRunningEffect` that should be\n * awaited for when wanting to run effects synchronously, that's it\n * one effect after another.\n */\nexport function asyncEffect(fn) {\n\tconst queue = []\n\teffect(() => {\n\t\tconst { promise, resolve } = withResolvers()\n\n\t\tqueue.push(promise)\n\n\t\tfunction onDone() {\n\t\t\tremoveFromArray(queue, promise)\n\t\t\tresolve()\n\t\t}\n\n\t\tresolved(\n\t\t\tfn(queue.length === 1 ? undefined : queue[queue.length - 2]),\n\t\t\tonDone,\n\t\t)\n\t})\n}\n\n/**\n * A Promise loader handler. Allows to display/run something or\n * nothing while a promise is resolving. Allows to run a callback when\n * the promise resolves. Allows to get notified of errors, and\n * display/run something or nothing, if wanted a `retry` function is\n * given for retrying the promise. All functions run with the original\n * owner, so it's `Context` friendly.\n *\n * @param {(() => Promise) | Promise} fn - Function that\n * returns a promise\n * @param {{\n * \tonLoading?: any\n * \tonLoaded?: Function\n * \tonError?: ((e: Error, retry: Function) => any) | any\n * }} [options]\n *\n * @returns {Component}\n * @url https://pota.quack.uy/lazy\n */\nexport const lazy = (fn, options = nothing) =>\n\tmarkComponent(props => {\n\t\tconst { onLoading, onLoaded, onError } = options\n\n\t\tconst [value, setValue] = signal(onLoading)\n\n\t\tconst _onLoaded = owned(onLoaded)\n\n\t\tconst retry = () =>\n\t\t\tPromise.resolve(isFunction(fn) ? fn() : fn)\n\t\t\t\t.then(r => {\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tmarkComponent(() => {\n\t\t\t\t\t\t\tr = isObject(r) && r.default ? r.default : r\n\t\t\t\t\t\t\treturn isFunction(r) ? r(props) : r\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\tmicrotask(_onLoaded)\n\t\t\t\t})\n\t\t\t\t.catch(e =>\n\t\t\t\t\tonError\n\t\t\t\t\t\t? setValue(\n\t\t\t\t\t\t\t\tmarkComponent(() =>\n\t\t\t\t\t\t\t\t\tisFunction(onError) ? onError(e, retry) : onError,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: console.error(e),\n\t\t\t\t)\n\t\tretry()\n\n\t\treturn value\n\t})\n\nexport const Lazy = props => lazy(props.children, props)\n\nexport const microtask = fn => queueMicrotask(owned(fn))\n\n// MAP\n\n/**\n * Reactive Map\n *\n * @template T\n * @param {Each} list\n * @param {Function} callback\n * @param {boolean} [sort]\n */\nexport function map(list, callback, sort) {\n\tconst cache = new Map()\n\tconst duplicates = new Map() // for when caching by value is not possible [1, 2, 1, 1, 1]\n\n\tlet runId = 0\n\n\tlet rows = []\n\t/** @type any[] */\n\tlet prev = []\n\n\tfunction clear() {\n\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\tprev[i].dispose(true)\n\t\t}\n\t\tcache.clear()\n\t\tduplicates.clear()\n\n\t\trows.length = 0\n\t\tprev.length = 0\n\t}\n\n\t// to get rid of all nodes when parent disposes\n\tcleanup(clear)\n\n\tclass Row {\n\t\tconstructor(item, index, fn, isDupe) {\n\t\t\tthis.runId = -1\n\t\t\tthis.item = item\n\t\t\tthis.index = index\n\t\t\tthis.isDupe = isDupe\n\t\t\tthis.disposer = undefined\n\t\t\tthis.nodes = root(disposer => {\n\t\t\t\tthis.disposer = disposer\n\t\t\t\t/** @type Children[] */\n\t\t\t\treturn fn(item, index)\n\t\t\t})\n\t\t}\n\t\tget begin() {\n\t\t\treturn this.nodes[0]\n\t\t}\n\t\tget end() {\n\t\t\treturn this.nodes[this.nodes.length - 1]\n\t\t}\n\t\tdispose(all) {\n\t\t\t// skip cache deletion as we are going to clear the full map\n\t\t\tif (all === undefined) {\n\t\t\t\t// delete from cache\n\t\t\t\tif (!this.isDupe) {\n\t\t\t\t\tcache.delete(this.item)\n\t\t\t\t} else {\n\t\t\t\t\tconst arr = duplicates.get(this.item)\n\t\t\t\t\tarr.length === 1\n\t\t\t\t\t\t? duplicates.delete(this.item)\n\t\t\t\t\t\t: removeFromArray(arr, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.disposer()\n\t\t}\n\t}\n\n\t/**\n\t * @param {Function} fn\n\t * @returns {Children}\n\t */\n\tfunction mapper(fn) {\n\t\tconst cb = fn\n\t\t\t? (item, index) => fn(callback(item, index), index)\n\t\t\t: callback\n\n\t\tconst value = getValue(list) || []\n\n\t\t/** To allow iterate objects as if were an array with indexes */\n\t\tconst items = isIterable(value) ? value.entries() : entries(value)\n\n\t\trunId++\n\t\trows = []\n\t\tconst hasPrev = prev.length\n\n\t\tfor (const [index, item] of items) {\n\t\t\tlet row = hasPrev ? cache.get(item) : undefined\n\n\t\t\t// if the item doesnt exists, create it\n\t\t\tif (row === undefined) {\n\t\t\t\trow = new Row(item, index, cb, false)\n\t\t\t\tcache.set(item, row)\n\t\t\t} else if (row.runId === runId) {\n\t\t\t\t// a map will save only 1 of any primitive duplicates, say: [1, 1, 1, 1]\n\t\t\t\t// if the saved value was already used on this run, create a new one\n\t\t\t\tlet dupes = duplicates.get(item)\n\t\t\t\tif (!dupes) {\n\t\t\t\t\tdupes = []\n\t\t\t\t\tduplicates.set(item, dupes)\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < dupes.length; i++) {\n\t\t\t\t\tif (dupes[i].runId !== runId) {\n\t\t\t\t\t\trow = dupes[i]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (row.runId === runId) {\n\t\t\t\t\trow = new Row(item, index, cb, true)\n\t\t\t\t\tdupes.push(row)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trow.runId = runId // mark used on this run\n\t\t\trow.index = index // save sort order\n\t\t\trows.push(row)\n\t\t}\n\n\t\t// remove rows that arent present on the current run\n\t\tif (rows.length === 0) {\n\t\t\tclear()\n\t\t} else {\n\t\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\t\tif (prev[i].runId !== runId) {\n\t\t\t\t\tprev[i].dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// reorder elements\n\t\t// `rows.length > 1` because no need for sorting when there are no items\n\t\t// prev.length > 0 to skip sorting on creation as its already sorted\n\t\tif (sort && rows.length > 1 && prev.length) {\n\t\t\t// if the planets align it handles swapping\n\t\t\t// a = sorted\n\t\t\t// b = unsorted\n\t\t\tconst { a, b } = groupBy(rows, (value, index) =>\n\t\t\t\trows[index] === prev[index] ? 'a' : 'b',\n\t\t\t)\n\n\t\t\tlet unsorted = b?.length\n\t\t\tif (\n\t\t\t\ta &&\n\t\t\t\tb &&\n\t\t\t\ta.length &&\n\t\t\t\tb.length &&\n\t\t\t\tb.length < a.length &&\n\t\t\t\tb.every(item => prev.includes(item))\n\t\t\t) {\n\t\t\t\tfor (const usort of b) {\n\t\t\t\t\tfor (const sort of a) {\n\t\t\t\t\t\tif (usort.index === sort.index - 1) {\n\t\t\t\t\t\t\tsort.begin.before(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if (usort.index === sort.index + 1) {\n\t\t\t\t\t\t\tsort.end.after(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unsorted) {\n\t\t\t\t// handles all other cases\n\t\t\t\t// best for any combination of: push/pop/shift/unshift/insertion/deletion\n\t\t\t\t// must check in reverse as on creation stuff is added to the end\n\n\t\t\t\tlet current = rows[rows.length - 1]\n\t\t\t\tfor (let i = rows.length - 1; i > 0; i--) {\n\t\t\t\t\tconst previous = rows[i - 1]\n\t\t\t\t\tif (current.begin.previousSibling !== previous.end) {\n\t\t\t\t\t\tcurrent.begin.before(...nodesFromRow(previous))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = previous\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// save sorted list\n\t\tprev = rows\n\n\t\t// return external representation\n\t\treturn rows.map(item => item.nodes)\n\t}\n\tmapper[$isMap] = undefined\n\treturn mapper\n}\n\nfunction nodesFromRow(row) {\n\tconst { begin, end } = row\n\tconst nodes = [begin]\n\n\tlet nextSibling = begin\n\twhile (nextSibling !== end) {\n\t\tnextSibling = nextSibling.nextSibling\n\t\tnodes.push(nextSibling)\n\t}\n\n\treturn nodes\n}\n\n/**\n * Resolves and returns `children` in a memo\n *\n * @param {Function | Children} fn\n * @returns {Function} Memo\n * @url https://pota.quack.uy/resolve\n */\nexport function resolve(fn) {\n\tconst children = isFunction(fn) ? memo(fn) : () => fn\n\treturn memo(() => unwrap(children()))\n}\n\n/**\n * Recursively unwrap children functions\n *\n * @param {Children} children\n * @returns {Children}\n */\nfunction unwrap(children) {\n\tif (isFunction(children)) {\n\t\treturn unwrap(children())\n\t}\n\n\tif (isArray(children)) {\n\t\tconst childrens = []\n\t\tfor (let child of children) {\n\t\t\tchild = unwrap(child)\n\t\t\tisArray(child)\n\t\t\t\t? childrens.push(...child)\n\t\t\t\t: childrens.push(child)\n\t\t}\n\t\treturn childrens\n\t}\n\n\treturn children\n}\n\n/**\n * Extend `Pota` and define a `render(props){}` method to create a\n * class component. `ready(cb)` and `cleanup(cb)` methods will be\n * registered automatically\n *\n * @url https://pota.quack.uy/Classes\n */\nexport class Pota {}\n\nPota[$isClass] = undefined\n\n/**\n * Returns true if the `value` is a `Component`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponent = value =>\n\tisFunction(value) && $isComponent in value\n\n/**\n * Returns true if the value can be made a Component\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponentable = value =>\n\t!isReactive(value) &&\n\t(isFunction(value) ||\n\t\t// avoid [1,2] and support { toString(){ return \"something\"} }\n\t\t(!isArray(value) && isObject(value) && !value.then))\n\n/**\n * Makes of `children` a function. Reactive children will run as is,\n * non-reactive children will run untracked, regular children will\n * just return.\n *\n * @param {Children} children\n * @returns {Function}\n */\nexport function makeCallback(children) {\n\t/**\n\t * When children is an array, as in >${[0, 1, 2]}< then children\n\t * will end as `[[0, 1, 2]]`, so flat it\n\t */\n\n\tchildren = isArray(children) ? flat(children) : children\n\n\tconst callbacks = !isArray(children)\n\t\t? callback(children)\n\t\t: children.map(callback)\n\n\treturn !isArray(children)\n\t\t? markComponent((...args) => callbacks(args))\n\t\t: markComponent((...args) =>\n\t\t\t\tcallbacks.map(callback => callback(args)),\n\t\t\t)\n}\n\nconst callback = child =>\n\tisFunction(child)\n\t\t? isReactive(child)\n\t\t\t? args => {\n\t\t\t\t\t/**\n\t\t\t\t\t * The function inside the `for` is saved in a signal. The\n\t\t\t\t\t * result of the signal is our callback\n\t\t\t\t\t *\n\t\t\t\t\t * ```js\n\t\t\t\t\t * htmlEffect(\n\t\t\t\t\t * \thtml =>\n\t\t\t\t\t * \t\thtml`\n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\tname \n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\t${item =>\n\t\t\t\t\t * \t\t\t\t\thtml`\n\t\t\t\t\t * \t\t\t\t\t\t${item.name} \n\t\t\t\t\t * \t\t\t\t\t `}\n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t
`,\n\t\t\t\t\t * )\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\tconst r = child()\n\t\t\t\t\treturn isFunction(r)\n\t\t\t\t\t\t? isReactive(r)\n\t\t\t\t\t\t\t? r()\n\t\t\t\t\t\t\t: untrack(() => r(...args))\n\t\t\t\t\t\t: r\n\t\t\t\t}\n\t\t\t: args => untrack(() => child(...args))\n\t\t: () => child\n\n// allows to tell a `signal function` from a `component function`\n// signals and user functions go in effects, for reactivity\n// components and callbacks are untracked and wont go in effects to avoid re-rendering\n\n/**\n * Marks a function as a `Component`.\n *\n * @param {Function} fn - Function to mark as a `Component`\n * @returns {Component}\n */\nexport function markComponent(fn) {\n\tfn[$isComponent] = undefined\n\treturn fn\n}\n\n/**\n * Unwraps components till it gets a value. To keep context relevant\n * to the component\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValueComponent(value) {\n\twhile ($isComponent in value) value = value()\n\treturn value\n}\n\n/**\n * Adds an event listener to a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `off` function for removing the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function addEventListener(node, type, handler) {\n\tnode.addEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\t/**\n\t * Removes event on tracking scope disposal.\n\t *\n\t * Situation: the event was added to the `document` manually using\n\t * `addEventListener`, say to listen for clicks as a \"click\n\t * outside\". The event needs to be removed when the component that\n\t * added it is disposed.\n\t */\n\n\treturn cleanup(() => removeEventListener(node, type, handler))\n}\n\n/**\n * Removes an event listener from a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `on` function for adding back the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function removeEventListener(node, type, handler) {\n\tnode.removeEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\treturn () => addEventListener(node, type, handler)\n}\n\n/**\n * It gives a handler an owner, so stuff runs batched on it, and\n * things like context and cleanup work\n */\nexport const ownedEvent = handler =>\n\t'handleEvent' in handler\n\t\t? {\n\t\t\t\t...handler,\n\t\t\t\thandleEvent: owned(e => handler.handleEvent(e)),\n\t\t\t}\n\t\t: owned(handler)\n","import { owned } from './lib/reactive.js'\nimport { call, queueMicrotask } from './lib/std.js'\n\n/**\n * The purpose of this file is to guarantee the timing of some\n * callbacks. It queues a microtask, then the callbacks are added to a\n * position in the array. These are run with a priority.\n */\n\n/** @type boolean */\nlet added\n\n/** @type [][] */\nlet queue\n\nfunction reset() {\n\tqueue = [[], [], [], [], [], []]\n\tadded = false\n}\n\n// initialization\nreset()\n\n/**\n * Queues a callback at a priority\n *\n * @param {PropertyKey} priority - Priority\n * @param {Function} fn - Function to run once the callbacks at this\n * priority run\n */\nfunction add(priority, fn) {\n\tif (!added) {\n\t\tadded = true\n\t\tqueueMicrotask(run)\n\t}\n\tqueue[priority].push(owned(fn))\n}\n\n/** Runs all queued callbacks */\nfunction run() {\n\tconst q = queue\n\treset()\n\n\tfor (const fns of q) {\n\t\tfns.length && call(fns)\n\t}\n}\n\n/**\n * Queue a function to run before everything else (onProps, onRef,\n * onMount, ready) ex focus restoration\n *\n * @param {Function} fn\n */\nexport const onFixes = fn => add(0, fn)\n\n/**\n * Queue a function to run before (onRef, onMount, ready) ex running\n * user functions on elements via plugins\n *\n * @param {Function} fn\n */\nexport const onProps = fn => add(1, fn)\n\n/**\n * Queue a function to run onRef (before onMount, after onProps)\n *\n * @param {Function} fn\n */\nexport const onRef = fn => add(2, fn)\n\n/**\n * Queue a function to run onMount (before ready, after onRef)\n *\n * @param {Function} fn\n */\nexport const onMount = fn => add(3, fn)\n\n/**\n * Queue a function to run on ready (after onMount)\n *\n * @param {Function} fn\n * @url https://pota.quack.uy/ready\n */\nexport const ready = fn => add(4, fn)\n\n/**\n * Queue a function to run after all user defined processes\n *\n * @param {Function} fn\n */\nexport const onDone = fn => add(5, fn)\n","import { addEventListener, ownedEvent } from '../lib/reactive.js'\nimport { window, withCache } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {EventListenerOrEventListenerObject} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setEventNS = (node, name, value, props, localName, ns) =>\n\taddEventListener(node, localName, ownedEvent(value))\n\n/**\n * Returns an event name when the string could be mapped to an event\n *\n * @param {string} name - String to check for a mapped event\n * @returns {string | undefined} Returns the event name or null in\n * case isnt found\n */\nexport const eventName = withCache(name =>\n\tname.startsWith('on') && name.toLowerCase() in window\n\t\t? name.slice(2).toLowerCase()\n\t\t: null,\n)\n","import { cacheStore } from '../lib/std.js'\nimport { onProps } from '../scheduler.js'\n\nexport const plugins = cacheStore()\nexport const pluginsNS = cacheStore()\n\n/**\n * Defines a prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - To avoid the problem of\n * needed props not being set, or children elements not created yet.\n * Default is `true`\n * @url https://pota.quack.uy/props/propsPlugin\n */\nexport const propsPlugin = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n}\n\n/**\n * Defines a namespaced prop that can be used on any Element\n *\n * @param {string} NSName - Name of the namespace\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * \tlocalName: string,\n * \tns: string,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginNS = (NSName, fn, onMicrotask) => {\n\tplugin(pluginsNS, NSName, fn, onMicrotask)\n}\n\n/**\n * Defines prop and namespaced prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop/namespace\n * @param {Function} fn - Function to run when this prop is found on\n * any Element\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginBoth = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n\tplugin(pluginsNS, propName, fn, onMicrotask)\n}\n\nconst plugin = (plugins, name, fn, onMicrotask = true) => {\n\tplugins.set(\n\t\tname,\n\t\t!onMicrotask ? fn : (...args) => onProps(() => fn(...args)),\n\t)\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\nimport { NS } from '../constants.js'\n\n// NODE ATTRIBUTES\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setAttributeNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setAttribute(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n * @url https://pota.quack.uy/props/setAttribute\n */\nexport const setAttribute = (node, name, value, ns) =>\n\twithValue(value, value => _setAttribute(node, name, value, ns))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {string} [ns]\n */\nfunction _setAttribute(node, name, value, ns) {\n\t// if the value is null or undefined it will be removed\n\tif (isNullUndefined(value)) {\n\t\tns && NS[ns]\n\t\t\t? node.removeAttributeNS(NS[ns], name)\n\t\t\t: node.removeAttribute(name)\n\t} else {\n\t\tns && NS[ns]\n\t\t\t? node.setAttributeNS(NS[ns], name, value)\n\t\t\t: node.setAttribute(name, value)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setPropertyNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setProperty(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setProperty\n */\nexport const setProperty = (node, name, value) =>\n\twithValue(value, value => _setProperty(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport function _setProperty(node, name, value) {\n\t// if the value is null or undefined it will be set to null\n\tif (isNullUndefined(value)) {\n\t\t// defaulting to undefined breaks `progress` tag and the whole page\n\t\tnode[name] = null\n\t} else {\n\t\tnode[name] = value\n\t}\n}\n","// NODE UNKNOWN PROPERTIES / ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\nimport {\n\tgetPrototypeOf,\n\tgetSetterNamesFromPrototype,\n} from '../lib/std.js'\nimport { setAttribute } from './attribute.js'\nimport { setProperty } from './property.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const setUnknown = (node, name, value, ns) => {\n\twithValue(value, value => _setUnknown(node, name, value, ns))\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const _setUnknown = (node, name, value, ns) => {\n\tif (typeof value !== 'string' && setters(node).element.has(name)) {\n\t\t/**\n\t\t * 1. First check in element because a custom-element may overwrite\n\t\t * builtIn setters\n\t\t * 2. Only do this when it's different to a string to avoid coarcing\n\t\t * on native elements (ex: (img.width = '16px') === 0)\n\t\t */\n\t\tsetProperty(node, name, value)\n\t} else if (setters(node).builtIn.has(name)) {\n\t\t// ex: innerHTML, textContent, draggable={true}\n\t\tsetProperty(node, name, value)\n\t} else {\n\t\tsetAttribute(node, name, value, ns)\n\t}\n}\n\nconst elements = new Map()\n\n/** @param {Element} node */\nfunction setters(node) {\n\t/**\n\t * Use `node.constructor` instead of `node.nodeName` because it\n\t * handles the difference between `a` `HTMLAnchorElement` and `a`\n\t * `SVGAElement`\n\t */\n\tlet setters = elements.get(node.constructor)\n\tif (setters) return setters\n\tsetters = { builtIn: new Set(builtInSetters), element: new Set() }\n\telements.set(node.constructor, setters)\n\n\tlet store = setters.element\n\tlet proto = getPrototypeOf(node)\n\n\t/**\n\t * Stop at `Element` instead of `HTMLElement` because it handles the\n\t * difference between `HTMLElement`, `SVGElement`, `FutureElement`\n\t * etc\n\t */\n\twhile (proto.constructor !== Element) {\n\t\tconst nextProto = getPrototypeOf(proto)\n\n\t\t/**\n\t\t * The previous prototype to `Element` is a `builtIn`\n\t\t * (`HTMLElement`, `SVGElement`,`FutureElement`, etc)\n\t\t */\n\t\tif (nextProto.constructor === Element) {\n\t\t\tstore = setters.builtIn\n\t\t}\n\t\tgetSetterNamesFromPrototype(proto, store)\n\t\tproto = nextProto\n\t}\n\n\treturn setters\n}\n\n/** Setters shared by all kind of elements */\nconst builtInSetters = getSetterNamesFromPrototype(\n\tElement.prototype,\n\tgetSetterNamesFromPrototype(Node.prototype),\n)\n","// BOOL ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setBoolNS = (node, name, value, props, localName, ns) =>\n\tsetBool(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setBool\n */\nexport const setBool = (node, name, value) =>\n\twithValue(value, value => _setBool(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const _setBool = (node, name, value) =>\n\t// if the value is falsy gets removed\n\tvalue ? node.setAttribute(name, '') : node.removeAttribute(name)\n","// node style\n\nimport { withValue } from '../lib/reactive.js'\nimport { getValue, isNullUndefined, isObject } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @url https://pota.quack.uy/props/setStyle\n */\nexport const setStyle = (node, name, value, props) =>\n\tsetNodeStyle(node.style, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setStyleNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(\n\t\tnode.style,\n\t\tisObject(value) ? value : { [localName]: value },\n\t)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setVarNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(node.style, { ['--' + localName]: value })\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {unknown} value\n */\nfunction setNodeStyle(style, value) {\n\tif (isObject(value)) {\n\t\tlet name\n\t\tfor (name in value) {\n\t\t\tsetStyleValue(style, name, value[name])\n\t\t}\n\t\treturn\n\t}\n\tconst type = typeof value\n\tif (type === 'string') {\n\t\tstyle.cssText = value\n\t\treturn\n\t}\n\tif (type === 'function') {\n\t\twithValue(value, value => setNodeStyle(style, getValue(value)))\n\t\treturn\n\t}\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementStyle = (node, name, value) =>\n\tsetStyleValue(node.style, name, value)\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {unknown} value\n */\nconst setStyleValue = (style, name, value) =>\n\twithValue(value, value => _setStyleValue(style, name, value))\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {string | null} value\n */\nconst _setStyleValue = (style, name, value) =>\n\t// if the value is null or undefined it will be removed\n\tisNullUndefined(value)\n\t\t? style.removeProperty(name)\n\t\t: style.setProperty(name, value)\n","// node class / classList\n\nimport { withPrevValue, withValue } from '../lib/reactive.js'\nimport {\n\tclassListAdd,\n\tclassListRemove,\n\tisFunction,\n\tisString,\n} from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n */\nexport const setClass = (node, name, value, props) =>\n\tisString(value)\n\t\t? node.setAttribute('class', value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setClassNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) =>\n\tisFunction(value)\n\t\t? setElementClass(node, localName, value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {object | string | ArrayLike} value\n */\nfunction setClassList(node, value) {\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t_setClassListValue(node, value, true)\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'object': {\n\t\t\tlet name\n\t\t\tfor (name in value) {\n\t\t\t\tsetElementClass(node, name, value[name])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'function': {\n\t\t\twithValue(value, value => setClassList(node, value))\n\t\t\tbreak\n\t\t}\n\t}\n}\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementClass = (node, name, value) =>\n\twithPrevValue(value, (value, prev) => {\n\t\t// on initialization do not remove whats not there\n\t\tif (!value && !prev) {\n\t\t} else {\n\t\t\t_setClassListValue(node, name, value)\n\t\t}\n\t})\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\n\nconst _setClassListValue = (node, name, value) =>\n\t// null, undefined or false, the class is removed\n\t!value\n\t\t? classListRemove(node, name)\n\t\t: classListAdd(node, ...name.trim().split(/\\s+/))\n","import { cleanup, withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\nimport { _setProperty } from './property.js'\n\n/**\n * `value` as a prop is special cased so the button `reset` in forms\n * works as expected. The first time a value is set, its done as an\n * attribute.\n */\nexport const setValue = (node, name, value) =>\n\twithValue(value, value => _setValue(node, name, value))\n\nconst defaults = new Set()\n\nfunction _setValue(node, name, value) {\n\tif (!defaults.has(node)) {\n\t\tdefaults.add(node)\n\t\tcleanup(() => defaults.delete(node))\n\n\t\tif (!isNullUndefined(value)) {\n\t\t\tswitch (node.localName) {\n\t\t\t\tcase 'input': {\n\t\t\t\t\tnode.setAttribute('value', value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcase 'textarea': {\n\t\t\t\t\tnode.textContent = value\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t_setProperty(node, name, value)\n}\n","/** Returns true or false with a `chance` of getting `true` */\nexport const chance = (chance = 50, generator = random) => {\n\treturn generator() < chance / 100\n}\n\n/** Returns random number between 0 and 1 */\nexport const random = () =>\n\tcrypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)\n\nexport const randomBetween = (min, max, generator = random) =>\n\tMath.floor(generator() * (max - min + 1)) + min\n\nexport const randomColor = (min = 0, max = 255) =>\n\t'rgb(' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t')'\n\nexport const randomId = () =>\n\tcrypto.getRandomValues(new BigUint64Array(1))[0].toString(36)\n\n/**\n * Returns a random number generator based no a seed that generates\n * numbers between 0 and 1\n */\nexport function randomSeeded(seed) {\n\tconst m = 2 ** 35 - 31\n\tlet s = seed % m\n\treturn () => (s = (s * 185852) % m) / m\n}\n","import {\n\tadoptedStyleSheetsAdd,\n\tclassListAdd,\n\tgetDocumentForElement,\n\tsheet,\n\twithState,\n} from '../lib/std.js'\n\nimport { randomId } from '../plugin/useRandom.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {object} props\n */\nexport const setCSS = (node, name, value, props) =>\n\tsetNodeCSS(node, value)\n\n/**\n * @param {Element} node\n * @param {string} value\n */\nconst setNodeCSS = withState((state, node, value) => {\n\tclassListAdd(\n\t\tnode,\n\t\tstate.get(value, value => {\n\t\t\tconst id = 'c' + randomId()\n\t\t\tadoptedStyleSheetsAdd(\n\t\t\t\tgetDocumentForElement(node),\n\t\t\t\tsheet(value.replace(/class/g, '.' + id)),\n\t\t\t)\n\t\t\treturn id\n\t\t}),\n\t)\n})\n","import { cleanup } from '../lib/reactive.js'\n\nimport { onMount, onRef } from '../scheduler.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setRef = (node, name, value, props) =>\n\tonRef(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setOnMount = (node, name, value, props) =>\n\tonMount(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setUnmount = (node, name, value, props) =>\n\tcleanup(() => value(node))\n","import {\n\taddEventListener,\n\towned,\n\townedEvent,\n} from '../lib/reactive.js'\nimport { getValue, isObject } from '../lib/std.js'\n\nimport { eventName } from './event.js'\n\nimport {\n\tplugins,\n\tpluginsNS,\n\tpropsPlugin,\n\tpropsPluginBoth,\n\tpropsPluginNS,\n} from './plugin.js'\nimport { setUnknown } from './unknown.js'\n\n// exports\n\nexport { setAttribute } from './attribute.js'\nexport { setBool } from './bool.js'\nexport { setProperty } from './property.js'\nexport { setUnknown } from './unknown.js'\nexport { setElementStyle as setStyle } from './style.js'\nexport { setElementClass as setClass } from './class.js'\n\n// PLUGINS NS\n\n// namespaced attributes/properties\n\nimport { setPropertyNS } from './property.js'\npropsPluginNS('prop', setPropertyNS, false)\n\nimport { setAttributeNS } from './attribute.js'\npropsPluginNS('attr', setAttributeNS, false)\n\nimport { setBoolNS } from './bool.js'\npropsPluginNS('bool', setBoolNS, false)\n\n// events\n\nimport { setEventNS } from './event.js'\npropsPluginNS('on', setEventNS, false)\n\n// var\n\nimport { setVarNS } from './style.js'\npropsPluginNS('var', setVarNS, false)\n\n// PLUGINS REGULAR\n\n// noop\n\nimport { noop } from '../lib/std.js'\npropsPlugin('__dev', noop, false)\npropsPlugin('xmlns', noop, false)\n\n// value\n\nimport { setValue } from './value.js'\npropsPlugin('value', setValue, false)\n\n// PLUGIN BOTH\n\n// css\n\nimport { setCSS } from './css.js'\npropsPluginBoth('css', setCSS, false)\n\n// mount\n\nimport { setOnMount } from './lifecycle.js'\npropsPluginBoth('onMount', setOnMount, false)\n\n// unmount\n\nimport { setUnmount } from './lifecycle.js'\npropsPluginBoth('onUnmount', setUnmount, false)\n\n// ref\n\nimport { setRef } from './lifecycle.js'\npropsPluginBoth('ref', setRef, false)\n\n// PLUGIN BOTH DIFFERENT\n\n// styles\n\nimport { setStyle, setStyleNS } from './style.js'\npropsPlugin('style', setStyle, false)\npropsPluginNS('style', setStyleNS, false)\n\n// class\n\nimport { setClass, setClassNS } from './class.js'\npropsPlugin('class', setClass, false)\npropsPluginNS('class', setClassNS, false)\n\n// catch all\n\n/**\n * Assigns props to an Element\n *\n * @param {Element} node - Element to which assign props\n * @param {object} props - Props to assign\n */\nexport function assignProps(node, props) {\n\tfor (const name in props) {\n\t\tassignProp(node, name, props[name], props)\n\t}\n}\n\n/**\n * Assigns a prop to an Element\n *\n * @param {Element} node\n * @param {string} name\n * @param {any} value\n * @param {object} props\n */\nexport function assignProp(node, name, value, props) {\n\t// run plugins\n\tlet plugin = plugins.get(name)\n\tif (plugin) {\n\t\tplugin(node, name, value, props)\n\t\treturn\n\t}\n\n\t// onClick={handler}\n\tlet event = eventName(name)\n\tif (event) {\n\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\treturn\n\t}\n\n\tif (name.includes(':')) {\n\t\t// with ns\n\t\tconst [ns, localName] = name.split(':')\n\n\t\t// run plugins NS\n\t\tplugin = pluginsNS.get(ns)\n\t\tif (plugin) {\n\t\t\tplugin(node, name, value, props, localName, ns)\n\t\t\treturn\n\t\t}\n\n\t\t// onClick:my-ns={handler}\n\t\tevent = eventName(ns)\n\t\tif (event) {\n\t\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\t\treturn\n\t\t}\n\n\t\tsetUnknown(node, name, value, ns)\n\t\treturn\n\t}\n\n\t// catch all\n\tsetUnknown(node, name, value)\n}\n","// CONSTANTS\n\nimport { $isClass, $isMap, NS } from './constants.js'\n\n// LIB\n\nimport {\n\tcleanup,\n\tContext,\n\teffect,\n\tisReactive,\n\troot,\n\tsignal,\n\tuntrack,\n} from './lib/reactive.js'\n\nimport {\n\tadoptedStyleSheetsAdd,\n\tadoptedStyleSheetsRemove,\n\tcreateElement,\n\tcreateElementNS,\n\tcreateTextNode,\n\tCSSStyleSheet,\n\tdocument,\n\tDocumentFragment,\n\tflat,\n\tfreeze,\n\tgetDocumentForElement,\n\timportNode,\n\tisArray,\n\tisConnected,\n\titerator,\n\tnothing,\n\tquerySelector,\n\tresolved,\n\tstringify,\n\ttoArray,\n\twalkElements,\n} from './lib/std.js'\n\nimport {\n\tisComponent,\n\tisComponentable,\n\tmarkComponent,\n} from './lib/reactive.js'\n\nimport { onFixes, ready } from './scheduler.js'\n\n// PROPERTIES / ATTRIBUTES\n\nimport { assignProps } from './props/@main.js'\nimport { propsPlugin } from './props/plugin.js'\n\n// STATE\n\nconst useXMLNS = context()\n\n// COMPONENTS\n\n/**\n * Used by the regular JSX transform, as `<>...>` or\n * `... `.\n */\nexport const Fragment = props => props.children\n\n/**\n * Creates components for things. When props argument is given, the\n * props become fixed. When props argument is ommited, it allows you\n * to keep calling the returned function with new props. Returns a\n * function because we need to render from parent to children instead\n * of from children to parent. This allows to properly set the\n * reactivity tree (think of nested effects that clear inner effects,\n * context, etc).\n *\n * @param {string | Function | Element | object | symbol} value -\n * Component\n * @param {any} [props] Object\n * @url https://pota.quack.uy/Component\n */\n\nexport function Component(value, props) {\n\tif (value === Fragment) {\n\t\treturn props.children\n\t}\n\n\t/** Freeze props so isnt directly writable */\n\tfreeze(props)\n\n\t/** Create a callable function to pass `props` */\n\tconst component = Factory(value)\n\n\treturn props === undefined\n\t\t? component\n\t\t: markComponent(propsOverride =>\n\t\t\t\tcomponent(\n\t\t\t\t\tpropsOverride\n\t\t\t\t\t\t? freeze({ ...props, ...propsOverride })\n\t\t\t\t\t\t: props,\n\t\t\t\t),\n\t\t\t)\n}\n\n/**\n * Creates a component that could be called with a props object\n *\n * @template T\n * @param {any} value\n * @returns {Component}\n */\n\nfunction Factory(value) {\n\tif (isComponent(value)) {\n\t\treturn value\n\t}\n\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t// string component, 'div' becomes \n\t\t\treturn markComponent(props => createTag(value, props))\n\t\t}\n\t\tcase 'function': {\n\t\t\tif ($isClass in value) {\n\t\t\t\t// class component
\n\t\t\t\treturn markComponent(props => createClass(value, props))\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * ```js\n\t\t\t * const [Count, setCount] = signal(1)\n\t\t\t * return
\n\t\t\t * ```\n\t\t\t */\n\t\t\tif (isReactive(value)) {\n\t\t\t\treturn markComponent(() => createAnything(value))\n\t\t\t}\n\n\t\t\t// function component
\n\t\t\t// value = value\n\t\t\treturn markComponent(value)\n\t\t}\n\t\tdefault: {\n\t\t\tif (value instanceof Node) {\n\t\t\t\t// node component
\n\t\t\t\treturn markComponent(props => createNode(value, props))\n\t\t\t}\n\n\t\t\treturn markComponent(() => createAnything(value))\n\t\t}\n\t}\n}\n\nexport function createComponent(value) {\n\tconst component = Factory(value)\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() => component(props))\n\t}\n}\n\nfunction createClass(value, props) {\n\tconst i = new value()\n\ti.ready && ready(() => i.ready())\n\ti.cleanup && cleanup(() => i.cleanup())\n\n\treturn i.render(props)\n}\n\nfunction createAnything(value) {\n\treturn value\n}\n\n/**\n * Creates a x/html element from a tagName\n *\n * @template P\n * @param {TagNames} tagName\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createTag(tagName, props) {\n\t/**\n\t * Namespace, use props xmlns or special case svg, math, etc in case\n\t * of missing xmlns attribute\n\t */\n\tconst xmlns = props?.xmlns || NS[tagName]\n\n\treturn withXMLNS(\n\t\txmlns,\n\t\txmlns =>\n\t\t\tcreateNode(\n\t\t\t\txmlns\n\t\t\t\t\t? createElementNS(xmlns, tagName)\n\t\t\t\t\t: createElement(tagName),\n\t\t\t\tprops,\n\t\t\t),\n\t\ttagName,\n\t)\n}\n\nfunction withXMLNS(xmlns, fn, tagName) {\n\tconst nsContext = useXMLNS()\n\n\tif (xmlns && xmlns !== nsContext) {\n\t\t// the xmlns changed, use the new xmlns\n\t\treturn useXMLNS(xmlns, () => fn(xmlns))\n\t}\n\n\t/**\n\t * `foreignObject` children are created with html xmlns (default\n\t * browser behaviour)\n\t */\n\tif (nsContext && tagName === 'foreignObject') {\n\t\treturn useXMLNS(NS.html, () => fn(nsContext))\n\t}\n\n\treturn fn(nsContext)\n}\n\n// PARTIALS\n\nfunction parseHTML(content, xmlns) {\n\tconst template = xmlns\n\t\t? createElementNS(xmlns, 'template')\n\t\t: createElement('template')\n\n\ttemplate.innerHTML = content\n\n\t// xml\n\tif (!template.content) {\n\t\tif (template.childNodes.length === 1) {\n\t\t\treturn template.firstChild\n\t\t}\n\n\t\ttemplate.content = new DocumentFragment()\n\t\ttemplate.content.append(...template.childNodes)\n\t}\n\n\treturn template.content.childNodes.length === 1\n\t\t? template.content.firstChild\n\t\t: template.content\n}\n\nexport function createPartial(content, propsData = nothing) {\n\tlet clone = () => {\n\t\tconst node = withXMLNS(propsData.x, xmlns =>\n\t\t\tparseHTML(content, xmlns),\n\t\t)\n\n\t\tclone = propsData.i\n\t\t\t? importNode.bind(null, node, true)\n\t\t\t: node.cloneNode.bind(node, true)\n\t\treturn clone()\n\t}\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() =>\n\t\t\tassignPartialProps(clone(), props, propsData),\n\t\t)\n\t}\n}\n\nfunction assignPartialProps(node, props, propsData) {\n\tif (props) {\n\t\tconst nodes = []\n\t\twalkElements(node, node => {\n\t\t\tnodes.push(node)\n\n\t\t\tif (nodes.length === propsData.m) return true\n\t\t})\n\n\t\twithXMLNS(propsData.x, xmlns => {\n\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\tassignProps(nodes[propsData[i] || i], props[i])\n\t\t\t}\n\t\t})\n\t}\n\n\treturn node instanceof DocumentFragment\n\t\t? toArray(node.childNodes)\n\t\t: node\n}\n\n/**\n * Assigns props to an element and creates its children\n *\n * @template P\n * @param {Element} node\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createNode(node, props) {\n\tif (props) {\n\t\tassignProps(node, props)\n\t}\n\treturn node\n}\n\n/**\n * Creates the children for a parent\n *\n * @param {Element} parent\n * @param {Children} child\n * @param {boolean} [relative]\n * @param {Text | undefined} [prev]\n * @returns {Children}\n */\nfunction createChildren(parent, child, relative, prev = undefined) {\n\tswitch (typeof child) {\n\t\t// string/number\n\t\tcase 'string':\n\t\tcase 'number': {\n\t\t\tif (prev instanceof Text) {\n\t\t\t\tprev.nodeValue = child\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn insertNode(parent, createTextNode(child), relative)\n\t\t}\n\n\t\tcase 'function': {\n\t\t\t// component\n\t\t\tif (isComponent(child)) {\n\t\t\t\treturn createChildren(parent, untrack(child), relative)\n\t\t\t}\n\n\t\t\tlet node = []\n\n\t\t\t// signal/memo/external/user provided function\n\t\t\t// needs placeholder to stay in position\n\t\t\tparent = createPlaceholder(\n\t\t\t\tparent,\n\t\t\t\tundefined /*child.name*/,\n\t\t\t\trelative,\n\t\t\t)\n\n\t\t\t// For\n\t\t\tif ($isMap in child) {\n\t\t\t\teffect(() => {\n\t\t\t\t\tnode = toDiff(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tchild(child => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Wrap the item with placeholders, for when stuff in\n\t\t\t\t\t\t\t * between moves. If a `Show` adds and removes nodes, we\n\t\t\t\t\t\t\t * dont have a reference to these nodes. By delimiting\n\t\t\t\t\t\t\t * with a shore, we can just handle anything in between\n\t\t\t\t\t\t\t * as a group.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst begin = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*begin*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst end = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*end*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn [begin, createChildren(end, child, true), end]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\tcleanup(() => {\n\t\t\t\t\ttoDiff(node)\n\t\t\t\t\tparent.remove()\n\t\t\t\t})\n\t\t\t\treturn [node, parent]\n\t\t\t}\n\n\t\t\t// maybe a signal so needs an effect\n\n\t\t\teffect(() => {\n\t\t\t\tnode = toDiff(node, [\n\t\t\t\t\tcreateChildren(parent, child(), true, node[0]),\n\t\t\t\t])\n\t\t\t})\n\n\t\t\tcleanup(() => {\n\t\t\t\ttoDiff(node)\n\t\t\t\tparent.remove()\n\t\t\t})\n\t\t\t/**\n\t\t\t * A placeholder is created and added to the document but doesnt\n\t\t\t * form part of the children. The placeholder needs to be\n\t\t\t * returned so it forms part of the group of children. If\n\t\t\t * children are moved and the placeholder is not moved with\n\t\t\t * them, then, whenever children update these will be at the\n\t\t\t * wrong place. wrong place: where the placeholder is and not\n\t\t\t * where the children were moved to\n\t\t\t */\n\t\t\treturn [node, parent]\n\t\t}\n\n\t\tcase 'object': {\n\t\t\t// HTMLElement/Text\n\t\t\tif (child instanceof HTMLElement || child instanceof Text) {\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// children/fragments\n\t\t\tif (isArray(child)) {\n\t\t\t\treturn child.length === 1\n\t\t\t\t\t? createChildren(parent, child[0], relative)\n\t\t\t\t\t: child.map(child =>\n\t\t\t\t\t\t\tcreateChildren(parent, child, relative),\n\t\t\t\t\t\t)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The value is `null`, as in {null} or like a show returning\n\t\t\t * `null` on the falsy case\n\t\t\t */\n\t\t\tif (child === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Node/DocumentFragment\n\t\t\tif (child instanceof Node) {\n\t\t\t\t/**\n\t\t\t\t * DocumentFragment are special as only the children get added\n\t\t\t\t * to the document and the document becomes empty. If we dont\n\t\t\t\t * insert them 1 by 1 then we wont have a reference to them\n\t\t\t\t * for deletion on cleanup with node.remove()\n\t\t\t\t */\n\t\t\t\tif (child instanceof DocumentFragment) {\n\t\t\t\t\treturn createChildren(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\ttoArray(child.childNodes),\n\t\t\t\t\t\trelative,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// async components\n\t\t\tif ('then' in child) {\n\t\t\t\tconst [value, setValue] = signal(undefined)\n\n\t\t\t\tconst onResult = result =>\n\t\t\t\t\tisConnected(parent) && setValue(result)\n\n\t\t\t\tresolved(child, onResult)\n\n\t\t\t\treturn createChildren(parent, value, relative)\n\t\t\t}\n\n\t\t\t// iterable/Map/Set/NodeList\n\t\t\tif (iterator in child) {\n\t\t\t\treturn createChildren(\n\t\t\t\t\tparent,\n\t\t\t\t\ttoArray(child.values()),\n\t\t\t\t\trelative,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// CSSStyleSheet\n\t\t\tif (child instanceof CSSStyleSheet) {\n\t\t\t\t/**\n\t\t\t\t * Custom elements wont report a document unless is already\n\t\t\t\t * connected. So our stylesheet would end on the main document\n\t\t\t\t * intead of the shadodRoot\n\t\t\t\t */\n\t\t\t\tonFixes(() => {\n\t\t\t\t\tif (isConnected(parent)) {\n\t\t\t\t\t\tconst doc = getDocumentForElement(parent)\n\t\t\t\t\t\tadoptedStyleSheetsAdd(doc, child)\n\n\t\t\t\t\t\tcleanup(() => adoptedStyleSheetsRemove(doc, child))\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// object.toString fancy objects\n\t\t\treturn createChildren(\n\t\t\t\tparent,\n\t\t\t\t// Object.create(null) would fail to convert to string\n\t\t\t\t'toString' in child ? child.toString() : stringify(child),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t\tcase 'undefined': {\n\t\t\treturn undefined\n\t\t}\n\t\tdefault: {\n\t\t\t// boolean/bigint/symbol/catch all\n\t\t\t// toString() is needed for `Symbol`\n\t\t\treturn insertNode(\n\t\t\t\tparent,\n\t\t\t\tcreateTextNode(child.toString()),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t}\n}\n\npropsPlugin(\n\t'children',\n\t(node, propName, propValue) => createChildren(node, propValue),\n\tfalse,\n)\n\n/**\n * Creates placeholder to keep nodes in position\n *\n * @param {Element} parent\n * @param {unknown} text\n * @param {boolean} [relative]\n * @returns {Element}\n */\nconst createPlaceholder = (parent, text, relative) => {\n\treturn insertNode(parent, createTextNode(''), relative)\n\n\t/* dev\n\treturn insertNode(\n\t\tparent,\n\t\tdocument.createComment(\n\t\t\t(text || '') + (relative ? ' relative' : ''),\n\t\t),\n\t\trelative,\n\t) */\n}\n\nconst head = document.head\n\n/**\n * Adds the element to the document\n *\n * @param {Element} parent\n * @param {Element &\n * \tHTMLTitleElement &\n * \tHTMLMetaElement &\n * \tHTMLLinkElement} node\n * @param {boolean} [relative]\n * @returns {Element}\n */\n\nfunction insertNode(parent, node, relative) {\n\t// special case `head`\n\tif (parent === head) {\n\t\tconst name = node.localName\n\n\t\t// search for tags that should be unique\n\t\tlet prev\n\t\tif (name === 'title') {\n\t\t\tprev = querySelector(head, 'title')\n\t\t} else if (name === 'meta') {\n\t\t\tprev =\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[name=\"' + node.getAttribute('name') + '\"]',\n\t\t\t\t) ||\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[property=\"' + node.getAttribute('property') + '\"]',\n\t\t\t\t)\n\t\t} else if (name === 'link' && node.rel === 'canonical') {\n\t\t\tprev = querySelector(head, 'link[rel=\"canonical\"]')\n\t\t}\n\n\t\t// replace old node if there's any\n\t\tprev ? prev.replaceWith(node) : parent.appendChild(node)\n\t} else {\n\t\trelative ? parent.before(node) : parent.appendChild(node)\n\t}\n\n\treturn node\n}\n\n// RENDERING\n\n/**\n * WARNINGS Removal of the element on where you render/insert into,\n * wont cause disposal of what you render/insert.\n */\n\n/**\n * Inserts children into a parent\n *\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * document.body\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n * @returns {Function} Disposer\n * @url https://pota.quack.uy/render\n */\nexport function render(children, parent, options = nothing) {\n\tconst dispose = root(dispose => {\n\t\tinsert(children, parent, options)\n\t\treturn dispose\n\t})\n\n\t// run dispose when the parent scope disposes\n\tcleanup(dispose)\n\n\treturn dispose\n}\n\n/**\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * `document.body`\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n */\nexport function insert(\n\tchildren,\n\tparent = document.body,\n\toptions = nothing,\n) {\n\tif (options.clear && parent) parent.textContent = ''\n\n\tconst node = createChildren(\n\t\tparent,\n\t\tisComponentable(children) ? Factory(children) : children,\n\t\toptions.relative,\n\t)\n\n\tcleanup(() => toDiff([node].flat(Infinity)))\n\n\treturn node\n}\n\n/**\n * Creates and returns HTML Elements for `children`\n *\n * @param {Children} children\n * @returns {Children}\n * @url https://pota.quack.uy/toHTML\n */\nexport const toHTML = children =>\n\t/**\n\t * DocumentFragment is transformed to an `Array` of `Node/Element`,\n\t * that way we can keep a reference to the nodes. Because when the\n\t * DocumentFragment is used, it removes the nodes from the\n\t * DocumentFragment and then we will lose the reference.\n\t */\n\n\tflat(toHTMLFragment(children).childNodes)\n\n/**\n * Creates and returns a DocumentFragment for `children`\n *\n * @param {Children} children\n * @returns {DocumentFragment}\n * @url https://pota.quack.uy/toHTML\n */\nexport function toHTMLFragment(children) {\n\tconst fragment = new DocumentFragment()\n\tcreateChildren(fragment, children)\n\n\treturn fragment\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {Function & { Provider: ({ value }) => Children }}\n * Context\n * @url https://pota.quack.uy/Reactivity/Context\n */\n/* #__NO_SIDE_EFFECTS__ */ export function context(\n\tdefaultValue = undefined,\n) {\n\t/** @type {Function & { Provider: ({ value }) => Children }} */\n\tconst ctx = Context(defaultValue)\n\n\t/**\n\t * Sets the `value` for the context\n\t *\n\t * @param {object} props\n\t * @param {any} props.value\n\t * @param {Children} [props.children]\n\t * @returns {Children} Children\n\t * @url https://pota.quack.uy/Reactivity/Context\n\t */\n\tctx.Provider = props =>\n\t\tctx(props.value, () => toHTML(props.children))\n\n\treturn ctx\n}\n\n/**\n * Removes from the DOM `prev` elements not found on `next`\n *\n * @param {Element[]} prev - Array with previous elements\n * @param {Element[]} next - Array with next elements\n * @returns {Element[]}\n */\nfunction toDiff(prev = [], next = []) {\n\tnext = next.flat(Infinity)\n\tfor (let i = 0, item; i < prev.length; i++) {\n\t\titem = prev[i]\n\t\titem &&\n\t\t\t(next.length === 0 || !next.includes(item)) &&\n\t\t\titem.remove()\n\t}\n\treturn next\n}\n","import {\n\taddStyleSheets,\n\temit,\n\tisString,\n\tquerySelector,\n\tremoveAttribute,\n\tsetAttribute,\n} from '../lib/std.js'\n\nimport { Component, toHTMLFragment } from '../renderer.js'\n\n/**\n * Defines a custom Element (if isnt defined already)\n *\n * @param {string} name - Name for the custom element\n * @param {CustomElementConstructor} constructor - Class for the\n * custom element\n * @param {ElementDefinitionOptions} [options] - Options passed to\n * `customElements.define`\n */\nexport function customElement(name, constructor, options) {\n\tif (customElements.get(name) === undefined) {\n\t\tcustomElements.define(name, constructor, options)\n\t}\n}\n\nexport class CustomElement extends HTMLElement {\n\tconstructor() {\n\t\tsuper()\n\n\t\tconst shadowRoot = this.attachShadow({\n\t\t\tmode: 'open',\n\t\t})\n\n\t\t// this is needed because `baseStyleSheets/styleSheets` are `static`\n\t\tconst constructor = this.constructor\n\n\t\taddStyleSheets(shadowRoot, constructor.baseStyleSheets)\n\t\taddStyleSheets(shadowRoot, constructor.styleSheets)\n\t}\n\n\t/* DOM API */\n\n\t/**\n\t * Shortcut for querySelector\n\t *\n\t * @param {string} query\n\t */\n\tquery(query) {\n\t\treturn querySelector(this, query)\n\t}\n\t/**\n\t * Shortcut for this.shadowRoot.innerHTML\n\t *\n\t * @param {string} value\n\t */\n\tset html(value) {\n\t\tif (isString(value)) {\n\t\t\tthis.shadowRoot.innerHTML = value\n\t\t} else {\n\t\t\tthis.shadowRoot.replaceChildren(\n\t\t\t\ttoHTMLFragment(Component(value || 'slot')),\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Toggles attribute `hidden`\n\t *\n\t * @param {boolean} value\n\t */\n\tset hidden(value) {\n\t\tvalue\n\t\t\t? setAttribute(this, 'hidden', '')\n\t\t\t: removeAttribute(this, 'hidden')\n\t}\n\n\t/* EVENTS API */\n\n\t/**\n\t * Emits an event\n\t *\n\t * @param {string} eventName\n\t * @param {any} [data]\n\t */\n\temit(eventName, data) {\n\t\temit(this, eventName, data)\n\t}\n\n\t/* SLOTS API */\n\n\thasSlot(name) {\n\t\treturn this.query(`:scope [slot=\"${name}\"]`)\n\t}\n}\n","import { css } from '../lib/std.js'\n\nimport { Component } from '../renderer.js'\nimport { CustomElement, customElement } from './CustomElement.js'\n\n/**\n * Similar to `Show`, but doesn't remove its children from the\n * document\n *\n * @template T\n * @param {{\n * \twhen: When
\n * \tchildren?: Children\n * }} props\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Collapse\n */\nexport function Collapse(props) {\n\t// need to include the class here because else its not treeshaked\n\tclass CollapseElement extends CustomElement {\n\t\tstatic styleSheets = [\n\t\t\tcss`\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: contents;\n\t\t\t\t}\n\t\t\t`,\n\t\t]\n\n\t\t/** @param {any} value - To toggle children */\n\t\tset when(value) {\n\t\t\tthis.html = value ? ' ' : ''\n\t\t}\n\t}\n\n\tconst name = 'pota-collapse'\n\n\tcustomElement(name, CollapseElement)\n\n\treturn Component(name, {\n\t\twhen: props.when,\n\t\tchildren: props.children,\n\t})\n}\n","import { Component } from '../renderer.js'\n\n/**\n * Creates components dynamically\n *\n * @template props\n * @param {{\n * \tcomponent: Component\n * } & props} props\n * @returns {Component}\n * @url https://pota.quack.uy/Components/Dynamic\n */\n\nexport const Dynamic = props =>\n\t// `component` needs to be deleted else it will end in the tag as an attribute\n\tComponent(props.component, { ...props, component: undefined })\n","import { makeCallback, map } from '../lib/reactive.js'\nimport {\n\tactiveElement,\n\tdocumentElement,\n\tisConnected,\n} from '../lib/std.js'\n\nimport { onFixes } from '../scheduler.js'\n\n/**\n * Renders reactive values from an signal that returns an Iterable\n * object\n *\n * @template T\n * @param {object} props\n * @param {Each} props.each\n * @param {boolean} [props.restoreFocus] - If the focused element\n * moves it may lose focus\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/For\n */\n\nexport const For = props =>\n\tmap(\n\t\t() => {\n\t\t\tprops.restoreFocus && queue()\n\t\t\treturn props.each\n\t\t},\n\t\tmakeCallback(props.children),\n\t\ttrue,\n\t)\n\nlet queued\n\n// because re-ordering the elements trashes focus\nfunction queue() {\n\tif (!queued) {\n\t\tqueued = true\n\n\t\tconst active = activeElement()\n\t\tconst scroll = documentElement.scrollTop\n\n\t\tonFixes(() => {\n\t\t\tqueued = false\n\t\t\t// re-ordering the elements trashes focus\n\t\t\tactive &&\n\t\t\t\tactive !== activeElement() &&\n\t\t\t\tisConnected(active) &&\n\t\t\t\tactive.focus()\n\n\t\t\tdocumentElement.scrollTop = scroll\n\t\t})\n\t}\n}\n","import { insert } from '../renderer.js'\n\n/**\n * Portals children to a different element while keeping the original\n * scope\n *\n * @param {object} props\n * @param {Element} props.mount\n * @param {Children} [props.children]\n * @url https://pota.quack.uy/Components/Portal\n */\nexport function Portal(props) {\n\tinsert(props.children, props.mount)\n}\n","import { document } from '../lib/std.js'\nimport { Component } from '../renderer.js'\nimport { Portal } from './Portal.js'\n\n/**\n * Mounts children on `document.head`\n *\n * @param {{\n * \tchildren?: Children\n * }} props\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Head\n */\nexport const Head = props =>\n\tComponent(Portal, {\n\t\tmount: document.head,\n\t\tchildren: props.children,\n\t})\n","import {\n\tdocument,\n\tlocation,\n\tquerySelector,\n\twindow,\n} from '../lib/std.js'\n\n/**\n * Scrolls to an element\n *\n * @param {Element} item - Element to scroll to\n */\nexport function scrollToElement(item) {\n\t/** Scroll children of element to the top */\n\titem.scrollTop = 0\n\n\t/** Scroll to element */\n\titem.scrollIntoView(true)\n}\n\n/** Scrolls to `window.location.hash` */\nexport const scrollToLocationHash = () =>\n\tscrollToSelector(location.hash)\n\n/**\n * Scrolls to element that matches the hash\n *\n * @param {string} selector - Hash to scroll to\n * @returns {boolean} True on success\n */\nexport function scrollToSelector(selector) {\n\tif (selector) {\n\t\ttry {\n\t\t\t// selector could be invalid\n\t\t\tconst item = querySelector(document, selector)\n\t\t\tif (item) {\n\t\t\t\tscrollToElement(item)\n\t\t\t\treturn true\n\t\t\t}\n\t\t} catch (e) {}\n\t}\n\treturn false\n}\n\n/**\n * Scrolls to hash and in case isnt found it scrolls to the top\n *\n * @param {string} selector - Hash to scroll to\n */\nexport function scrollToSelectorWithFallback(selector) {\n\tif (!scrollToSelector(selector)) scrollToTop()\n}\n\n/** Scrolls to the top of the window */\nexport const scrollToTop = () =>\n\twindow.scrollTo({ top: 0, behavior: 'auto' })\n","import { global } from '../lib/std.js'\n\nexport const cleanLink = v => v.replace(/[\\.,\"]$/, '')\n\nexport const encodeURIComponent = global.encodeURIComponent\n\n/**\n * Safe guard. `decodeURIComponent` will fail with malformed strings:\n * links are copied, pasted, manipulated by people, software etc\n *\n * @param {string} string - String to decode\n * @returns {string} Returns decoded string or original string on\n * error\n */\nfunction _decodeURIComponent(string) {\n\ttry {\n\t\treturn decodeURIComponent(string)\n\t} catch (e) {\n\t\treturn string\n\t}\n}\nexport { _decodeURIComponent as decodeURIComponent }\n\n/**\n * Returns true if the link is absolute: starts with '/', '#' or\n * 'http'\n *\n * @param {string} href - Url\n * @returns {boolean} Returns true if the link is absolute\n */\nexport const isAbsolute = href =>\n\thref[0] === '/' || href[0] === '#' || /^http/.test(href)\n\n/**\n * Returns true if the link is external. It does so by checking that\n * window.location.origin is present at the beginning of the url\n *\n * @param {string} url - Url\n * @returns {boolean} Returns true if the link is external\n */\nexport const isExternal = url =>\n\t// origin could be http://example.net and link could be http://example.net.ha.com, so add \"/\"\n\t/^http/.test(url) && !(url + '/').startsWith(origin + '/')\n\n/**\n * Returns true if the link is relative\n *\n * @param {string} url - Url\n * @returns {boolean} Returns true if the link relative\n */\nexport const isRelative = url => !isAbsolute(url)\n\n/**\n * Replace params in an url for the encoded equivalent\n *\n * @param {string | undefined} url - Url\n * @param {object} [params] - Key-value pair to replace\n * @returns {string} Url with the params replaced\n */\nexport const replaceParams = (url, params) =>\n\tparams\n\t\t? url.replace(/\\:([a-z0-9_\\-]+)/gi, (a, b) =>\n\t\t\t\t// only replace the ones defined on params\n\t\t\t\tparams[b] !== undefined ? encodeURIComponent(params[b]) : a,\n\t\t\t)\n\t\t: url\n","import { memo, signal } from '../../lib/reactive.js'\nimport { nothing, removeFromArray } from '../../lib/std.js'\n\nimport { context } from '../../renderer.js'\n\n/* #__NO_SIDE_EFFECTS__ */ export function create(props = nothing) {\n\tconst [children, setChildren, updateChildren] = signal([])\n\n\treturn {\n\t\tbase: '', // the composed base route\n\t\thref: () => '', // the url of the route\n\t\tparent: undefined, // parent context\n\t\tshow: () => false, // if the route is shown\n\t\tparams: () => () => nothing, // params of the route\n\t\tscroll: [], // elements to scroll\n\t\t// the children routes\n\t\taddChildren: child => {\n\t\t\tupdateChildren(children => {\n\t\t\t\tchildren.push(child)\n\t\t\t\treturn [...children]\n\t\t\t})\n\t\t},\n\t\tremoveChildren: child => {\n\t\t\tupdateChildren(children => {\n\t\t\t\tremoveFromArray(children, child)\n\t\t\t\treturn [...children]\n\t\t\t})\n\t\t},\n\t\tnoneMatch: memo(() => {\n\t\t\treturn (\n\t\t\t\t/**\n\t\t\t\t * If doesnt have siblings then is not a 404\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t * \t\n\t\t\t\t * \t <-- Router.Default should never render\n\t\t\t\t * \t \n\t\t\t\t */\n\t\t\t\tchildren().length &&\n\t\t\t\t// when it has sibling, check if at least 1 rendered\n\t\t\t\tchildren().every(children => !children.show())\n\t\t\t)\n\t\t}),\n\t\t// override\n\t\t...props,\n\t}\n}\n\nexport const Context = context(create())\n","import { memo, signal } from '../lib/reactive.js'\nimport {\n\tdocument,\n\tempty,\n\tentries,\n\thistory,\n\tnothing,\n\toptional,\n\torigin,\n\tpreventDefault,\n\twalkParents,\n\tlocation as wLocation,\n} from '../lib/std.js'\n\nimport { scrollToSelectorWithFallback } from './useScroll.js'\n\nimport {\n\tdecodeURIComponent,\n\tisExternal,\n\treplaceParams,\n} from './useURL.js'\n\nimport { Context } from '../web/router/context.js'\n\n// window.location signal\n\nconst [getLocation, setLocation] = signal(wLocation, {\n\tequals: false,\n})\n\n// only trigger on what changed\n\nconst pathname = memo(() => getLocation().pathname)\nconst search = memo(() => getLocation().search)\nconst href = memo(() => getLocation().href)\n\n// http://location/# reports hash to be empty\n// http://location/ reports hash to be empty\n// handle this difference by checking if \"#\" is at the end of `href`\nconst hash = memo(() =>\n\thref().endsWith('#') ? '#' : getLocation().hash,\n)\n\n/**\n * @typedef {object} location\n * @property {Signal} href - The full url\n * @property {Signal} pathname - Mirror of window.location.pathname\n * @property {Signal} hash - Everything after #\n * @property {Signal} path - Pathname + hash\n * @property {Signal} query - Key value pairs with search params\n * @property {Function} params - Key value pairs with route params\n */\n\n/** @type location */\nexport const location = {\n\thref,\n\tpathname,\n\thash,\n\tpath: memo(() => pathname() + hash()),\n\tquery: memo(() => {\n\t\tconst value = search()\n\t\tconst searchParams = empty()\n\t\tconst params = new URL(origin + '/' + value).searchParams\n\t\tfor (const [key, value] of params.entries()) {\n\t\t\tsearchParams[key] = value\n\t\t}\n\t\treturn searchParams\n\t}),\n\tparams: () => {\n\t\tconst routes = []\n\t\twalkParents(Context(), 'parent', context => {\n\t\t\troutes.push(context.params)\n\t\t})\n\t\tconst params = empty()\n\n\t\tfor (const param of routes) {\n\t\t\t// `|| params` because when nothing is found the result is undefined\n\t\t\tfor (const [key, value] of entries(param()() || nothing)) {\n\t\t\t\tparams[key] =\n\t\t\t\t\tvalue !== undefined ? decodeURIComponent(value) : value\n\t\t\t}\n\t\t}\n\t\treturn params\n\t},\n}\n\nlet BeforeLeave = []\n\n/**\n * Run code before leaving the route, return or resolve to false to\n * reject, return true to continue\n *\n * @param {Function | Promise} callback - Run before leaving\n * the route\n * @url https://pota.quack.uy/Components/Router/useBeforeLeave\n */\nexport const useBeforeLeave = callback => {\n\taddListeners()\n\n\tBeforeLeave.push({\n\t\thref: Context().href() || wLocation.href,\n\t\tcallback,\n\t})\n}\n\n/**\n * Returns a boolean telling if navigation is allowed\n *\n * @param {string} href\n * @returns {Promise}\n */\nasync function canNavigate(href) {\n\tconst newBeforeLeave = []\n\tfor (const beforeLeave of BeforeLeave) {\n\t\tif (href.indexOf(beforeLeave.href) !== 0) {\n\t\t\tif (!(await beforeLeave.callback().catch(() => false)))\n\t\t\t\treturn false\n\t\t} else {\n\t\t\tnewBeforeLeave.push(beforeLeave)\n\t\t}\n\t}\n\tBeforeLeave = newBeforeLeave\n\treturn true\n}\n\n/**\n * Navigates to a new location\n *\n * @param {string} href\n * @param {{ scroll?: boolean; replace?: boolean }} options\n * @url https://pota.quack.uy/Components/Router/Navigate\n */\nasync function navigate(href, options = nothing) {\n\tif (wLocation.href !== href) {\n\t\tif (await canNavigate(href)) {\n\t\t\tconst fn = () => navigateInternal(href, options)\n\t\t\t// navigate with transition if available\n\t\t\tdocument.startViewTransition &&\n\t\t\twLocation.href.replace(/#.*/, '') !== href.replace(/#.*/, '')\n\t\t\t\t? document.startViewTransition(fn)\n\t\t\t\t: fn()\n\t\t}\n\t}\n}\n\nfunction navigateInternal(href, options) {\n\tif (options.replace) {\n\t\thistory.replaceState(null, '', href)\n\t} else {\n\t\thistory.pushState(null, '', href)\n\t}\n\tsetLocation(wLocation)\n\n\tif (optional(options.scroll)) {\n\t\tscrollToSelectorWithFallback(wLocation.hash)\n\t}\n}\n\n/**\n * Navigates to a new location programmatically\n *\n * @param {string} href\n * @param {{\n * \tparams?: object\n * \tscroll?: boolean\n * \treplace?: boolean\n * }} options\n * @url https://pota.quack.uy/Components/Router/Navigate\n */\nfunction navigateUser(href, options = nothing) {\n\taddListeners()\n\n\thref = replaceParams(href, options.params)\n\n\t// when the user sets the url it may pass a relative path\n\t// this makes it absolute\n\tnavigate(\n\t\thref.startsWith('http')\n\t\t\t? href\n\t\t\t: new URL(href, wLocation.href).href,\n\t\toptions,\n\t)\n}\nexport { navigateUser as navigate }\n\n/**\n * Navigates to a new location from JSX\n *\n * @param {{\n * \thref: string\n * \tscroll?: boolean\n * \treplace?: boolean\n * \tparams?: object\n * }} props\n * @url https://pota.quack.uy/Components/Router/Navigate\n */\nexport function Navigate(props) {\n\taddListeners()\n\tnavigateUser(props.href, props)\n}\n\n// listeners\n\nlet addListenersAdded = false\n\nexport function addListeners() {\n\tif (!addListenersAdded) {\n\t\taddListenersAdded = true\n\n\t\tdocument.addEventListener('click', onLinkClick)\n\n\t\taddEventListener('hashchange', onLocationChange)\n\t\taddEventListener('popstate', onLocationChange)\n\t}\n}\n\n// listen when using browser buttons\n// safe to use async as its on a listener\nasync function onLocationChange() {\n\t// chrome has a bug on which if you use the back/forward button\n\t// it will change the title of the tab to whatever it was before\n\t// if the navigation is prevented (therefore the title/page wont change)\n\t// it will still use the old title even if the title tag didn't change at all\n\tconst title = document.title\n\tdocument.title = title + ' '\n\tdocument.title = title\n\n\tif (await canNavigate(wLocation.href)) {\n\t\tsetLocation(wLocation)\n\t} else {\n\t\thistory.pushState(null, '', location.href())\n\t}\n}\n\nfunction onLinkClick(e) {\n\tif (\n\t\te.defaultPrevented ||\n\t\te.button !== 0 ||\n\t\te.metaKey ||\n\t\te.altKey ||\n\t\te.ctrlKey ||\n\t\te.shiftKey\n\t)\n\t\treturn\n\n\t// find link\n\tconst node = e\n\t\t.composedPath()\n\t\t.find(item => item instanceof HTMLAnchorElement)\n\n\t// validate\n\tif (\n\t\t!node ||\n\t\t!node.href ||\n\t\tnode.download ||\n\t\tnode.target ||\n\t\t!node.href.startsWith('http') || // when using other protocol than \"http\"\n\t\tisExternal(node.href) ||\n\t\t(node.rel && node.rel.split(/\\s/).includes('external'))\n\t)\n\t\treturn\n\n\tpreventDefault(e)\n\n\tnavigate(node.href, {\n\t\treplace: node.replace,\n\t})\n}\n","import { makeCallback, memo, resolve } from '../lib/reactive.js'\n\nimport { getValue, isNullUndefined } from '../lib/std.js'\n\n/**\n * Renders its children based on a condition\n *\n * @template T\n * @param {object} props\n * @param {When} props.when\n * @param {Children} [props.fallback]\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Show\n */\nexport function Show(props) {\n\tconst callback = makeCallback(props.children)\n\tconst value = memo(() => getValue(props.when))\n\tconst condition = memo(() => !!value())\n\n\t// needs resolve to avoid re-rendering\n\tconst fallback = isNullUndefined(props.fallback)\n\t\t? undefined\n\t\t: memo(() => resolve(props.fallback))\n\n\treturn memo(() => (condition() ? callback(value) : fallback))\n}\n","import {\n\tscrollToLocationHash,\n\tscrollToSelector,\n\tscrollToTop,\n} from '../../plugin/useScroll.js'\n\nimport { walkParents } from '../../lib/std.js'\n\nexport function scroll(context) {\n\t/**\n\t * Scroll to hash first, if doesnt, scroll to positions defined by\n\t * the Routes.\n\t */\n\tif (!scrollToLocationHash()) {\n\t\tif (\n\t\t\t!walkParents(context, 'parent', context => {\n\t\t\t\tif (context.scroll) {\n\t\t\t\t\tfor (const item of context.scroll) {\n\t\t\t\t\t\tif (scrollToSelector(item)) {\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t) {\n\t\t\tscrollToTop()\n\t\t}\n\t}\n}\n","import { cleanup, memo, signal } from '../../lib/reactive.js'\nimport { nothing, optional, origin } from '../../lib/std.js'\n\nimport { addListeners, location } from '../../plugin/useLocation.js'\nimport { replaceParams } from '../../plugin/useURL.js'\n\nimport { Collapse } from '../Collapse.js'\nimport { Dynamic } from '../Dynamic.js'\nimport { Show } from '../Show.js'\n\nimport { Component } from '../../renderer.js'\nimport { onDone } from '../../scheduler.js'\n\nimport { Context, create } from './context.js'\nimport { scroll } from './scroll.js'\n\n/**\n * Renders children if the path matches the current location\n *\n * @template T\n * @param {object} props\n * @param {string} [props.path] - Path to match relative to the parent\n * Route. When `path` is missing, it will render only when the\n * parent's route path is matched exactly.\n * @param {string[]} [props.scroll] - Elements to scroll when the\n * route matches\n * @param {object} [props.params] - Key-value pairs params to encode\n * and replace on the path\n * @param {When} [props.collapse] - To hide the route instead of\n * removing it from the document\n * @param {When} [props.when] - To stop rendering the route even if\n * the path matches.\n * @param {Children} [props.fallback] - Fallback for when a `when`\n * condition is set. If the `when` condition is not set, this wont\n * be used.\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Router/Router\n */\nexport function Router(props) {\n\taddListeners()\n\n\tconst parent = Context()\n\n\tconst base =\n\t\tparent.base +\n\t\treplaceParams(\n\t\t\t// when [^/#]+)'),\n\t)\n\n\tlet href = ''\n\tconst [params, setParams] = signal(() => nothing)\n\n\t// derived\n\tconst show = memo(() => {\n\t\tconst path = location.path()\n\t\tif (route.test(path)) {\n\t\t\tsetParams(() => route.exec(path).groups)\n\n\t\t\tif (href === '') {\n\t\t\t\thref = path.replace(path.replace(route, ''), '')\n\t\t\t\t// create full link\n\t\t\t\thref =\n\t\t\t\t\t// add origin\n\t\t\t\t\torigin +\n\t\t\t\t\t// add slash after origin if isnt present in the href\n\t\t\t\t\t(href[0] !== '/' ? '/' : '') +\n\t\t\t\t\t// add the path\n\t\t\t\t\thref\n\t\t\t}\n\n\t\t\tonDone(() => scroll(context))\n\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t})\n\n\tconst context = create({\n\t\tbase, // the prefix for the children path\n\t\thref: () => href, // the full url of the route\n\t\tparams,\n\t\tscroll: props.scroll,\n\t\tparent,\n\t\tshow,\n\t})\n\n\tparent.addChildren(context)\n\n\tcleanup(() => parent.removeChildren(context))\n\n\treturn Component(Context.Provider, {\n\t\tvalue: context,\n\t\tchildren: Component(Dynamic, {\n\t\t\tcomponent: props.collapse ? Collapse : Show,\n\t\t\twhen: () => show() && optional(props.when),\n\t\t\tfallback: props.fallback,\n\t\t\tchildren: props.children,\n\t\t}),\n\t})\n}\n\n/**\n * Renders children when no sibling `Router` matches\n *\n * @param {object} props\n * @param {Children} [props.children]\n * @returns {Children}\n */\nRouter.Default = props => {\n\tconst context = Context()\n\treturn Component(Show, {\n\t\twhen: context.noneMatch,\n\t\tchildren: props.children,\n\t})\n}\n","import { addListeners } from '../../plugin/useLocation.js'\nimport { isRelative, replaceParams } from '../../plugin/useURL.js'\n\nimport { Component } from '../../renderer.js'\n\nimport { Context } from './context.js'\n\n/*\n * // props\n * // props.href Url relative to the parent \n * // props.params Key-value pair object params to replace in the url\n * not scroll on location change\n * // props.replace Replace the history entry from the browser} props\n */\n\n/**\n * Creates a link with Router features\n *\n * @param {{\n * \thref: string\n * \tparams?: object\n * \treplace?: boolean\n * } & Props} props\n *\n * @returns {Children}\n * @url https://pota.quack.uy/Components/Router/A\n */\n\nexport function A(props) {\n\taddListeners()\n\n\tlet href = replaceParams(props.href, props.params)\n\n\t// make it absolute\n\t// link is relative to the props.children)\n\n const fallback = isNullUndefined(props.fallback)\n ? memo(() => {\n const r = matches().find(match => !('when' in match))\n return r && r.children\n })\n : memo(() => resolve(props.fallback))\n\n const match = memo(() =>\n matches().find(match => !!getValue(match.when)),\n )\n\n const value = memo(() => match() && getValue(match().when))\n\n const callback = memo(\n () => match() && makeCallback(match().children),\n )\n return memo(() => (match() ? callback()(value) : fallback))\n}\n\n/**\n * Renders the content if the `when` condition is true\n *\n * @template T\n * @param {object} props\n * @param {When} props.when\n * @param {Children} [props.children]\n * @returns {Children}\n */\nexport const Match = identity\n","import {\n\tbatch,\n\tcleanup,\n\troot,\n\tsignal,\n\tsyncEffect,\n} from './lib/reactive.js'\n\nimport {\n\tcall,\n\tcreateElement,\n\tcreateTextNode,\n\tempty,\n\tflat,\n\tfreeze,\n\ttoArray,\n\tweakStore,\n\twithWeakCache,\n} from './lib/std.js'\n\nimport { Component, toHTML, toHTMLFragment } from './renderer.js'\nimport { assignProps } from './props/@main.js'\n\nimport {\n\tA,\n\tCollapse,\n\tDynamic,\n\tFor,\n\tHead,\n\tMatch,\n\tPortal,\n\tRouter,\n\tShow,\n\tSwitch,\n} from './web/@main.js'\n\nconst defaultRegistry = {\n\tA,\n\tCollapse,\n\tDynamic,\n\tFor,\n\tHead,\n\tMatch,\n\tPortal,\n\tRouter,\n\tShow,\n\tSwitch,\n}\n\n// parseHTML\n\nconst id = 'pota19611227'\n\nconst xmlns = [\n\t'class',\n\t'on',\n\t'prop',\n\t'attr',\n\t'bool',\n\t'style',\n\t'var',\n\t'onMount',\n\t'onUnmount',\n\t'ref',\n]\n\t.map(ns => `xmlns:${ns}=\"/\"`)\n\t.join(' ')\n\n/**\n * Makes Nodes from TemplateStringsArray\n *\n * @param {TemplateStringsArray} content\n * @returns {Element}\n */\nconst parseHTML = withWeakCache(content =>\n\tnew DOMParser().parseFromString(\n\t\t`${content.join(id)} `,\n\t\t'text/xml',\n\t),\n)\n\n/**\n * Recursively walks a template and transforms it to `h` calls\n *\n * @param {{ components: {} }} html\n * @param {HTMLElement} cached\n * @param {...any} values\n * @returns {Children}\n */\nfunction toH(html, cached, values) {\n\tlet index = 0\n\tfunction nodes(node) {\n\t\t// Node.ELEMENT_NODE\n\t\tif (node.nodeType === 1) {\n\t\t\tconst localName = node.localName\n\n\t\t\t// gather props\n\t\t\tconst props = empty()\n\t\t\tfor (let { name, value } of node.attributes) {\n\t\t\t\tif (value === id) {\n\t\t\t\t\tvalue = values[index++]\n\t\t\t\t}\n\t\t\t\tprops[name] = value\n\t\t\t}\n\n\t\t\t// gather children\n\t\t\tif (node.childNodes.length) {\n\t\t\t\tprops.children = flat(toArray(node.childNodes).map(nodes))\n\t\t\t}\n\n\t\t\treturn Component(html.components[localName] || localName, props)\n\t\t} else {\n\t\t\tif (node.data.includes(id)) {\n\t\t\t\tconst textNodes = node.data.split(id)\n\t\t\t\tconst nodes = []\n\t\t\t\tfor (let i = 0; i < textNodes.length; i++) {\n\t\t\t\t\tconst text = textNodes[i]\n\t\t\t\t\tif (text) {\n\t\t\t\t\t\tnodes.push(createTextNode(text))\n\t\t\t\t\t}\n\t\t\t\t\tif (i < textNodes.length - 1) {\n\t\t\t\t\t\tnodes.push(values[index++])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nodes\n\t\t\t}\n\t\t\treturn createTextNode(node.data)\n\t\t}\n\t}\n\n\treturn flat(toArray(cached.childNodes).map(nodes))\n}\n\nfunction toPartial(html, cached, values) {\n\tif (!cached.partial) {\n\t\tconst walker = document.createTreeWalker(cached)\n\n\t\tconst actions = []\n\t\twhile (walker.nextNode()) {\n\t\t\tconst node = walker.currentNode\n\t\t\tswitch (node.nodeType) {\n\t\t\t\tcase 1: {\n\t\t\t\t\tconst localName = node.localName\n\t\t\t\t\t// its a component\n\t\t\t\t\tif (html.components[localName]) {\n\t\t\t\t\t\tconst props = empty()\n\t\t\t\t\t\tconst propsReplace = []\n\t\t\t\t\t\tfor (let { name, value } of node.attributes) {\n\t\t\t\t\t\t\tif (name === id) {\n\t\t\t\t\t\t\t\tpropsReplace.push(name)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprops[name] = value\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// gather children\n\t\t\t\t\t\tif (node.childNodes.length) {\n\t\t\t\t\t\t\tprops.children = createTextNode('the children') //flat(toArray(node.childNodes).map(nodes))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst pota = createElement('pota')\n\t\t\t\t\t\tnode.replaceWith(pota)\n\t\t\t\t\t\twalker.currentNode = pota\n\n\t\t\t\t\t\tfreeze(props)\n\t\t\t\t\t\tactions.push((node, values, walker) => {\n\t\t\t\t\t\t\tconst p = { ...props }\n\t\t\t\t\t\t\tfor (const name of propsReplace) {\n\t\t\t\t\t\t\t\tp[name] = values()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst replacement = toHTMLFragment(\n\t\t\t\t\t\t\t\tComponent(html.components[localName], p),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tnode.replaceWith(replacement)\n\n\t\t\t\t\t\t\twalker.currentNode = replacement\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst props = empty()\n\t\t\t\t\t\tconst propsReplace = []\n\t\t\t\t\t\tconst toRemove = []\n\t\t\t\t\t\tfor (let { name, value } of node.attributes) {\n\t\t\t\t\t\t\tif (value === id) {\n\t\t\t\t\t\t\t\tpropsReplace.push(name)\n\t\t\t\t\t\t\t\ttoRemove.push(name)\n\t\t\t\t\t\t\t} else if (/^[a-z]+:/.test(name)) {\n\t\t\t\t\t\t\t\tprops[name] = value\n\t\t\t\t\t\t\t\ttoRemove.push(name)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (toRemove.length) {\n\t\t\t\t\t\t\tnode.setAttribute('pota', '')\n\t\t\t\t\t\t\tfor (const attribute of toRemove) {\n\t\t\t\t\t\t\t\tnode.removeAttribute(attribute)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfreeze(props)\n\t\t\t\t\t\t\tactions.push((node, values) => {\n\t\t\t\t\t\t\t\tconst p = { ...props }\n\t\t\t\t\t\t\t\tfor (const name of propsReplace) {\n\t\t\t\t\t\t\t\t\tp[name] = values()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tassignProps(node, p)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 3: {\n\t\t\t\t\t// text\n\t\t\t\t\tif (node.data.includes(id)) {\n\t\t\t\t\t\tconst textNodes = node.data.split(id)\n\t\t\t\t\t\tconst nodes = []\n\t\t\t\t\t\tfor (let i = 0; i < textNodes.length; i++) {\n\t\t\t\t\t\t\tconst text = textNodes[i]\n\t\t\t\t\t\t\tif (text) {\n\t\t\t\t\t\t\t\tnodes.push(createTextNode(text))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (i < textNodes.length - 1) {\n\t\t\t\t\t\t\t\tactions.push((node, values, walker) => {\n\t\t\t\t\t\t\t\t\tconst replacement = toHTML(values())\n\t\t\t\t\t\t\t\t\tconsole.log(replacement)\n\t\t\t\t\t\t\t\t\tnode.replaceWith(replacement)\n\t\t\t\t\t\t\t\t\t// walker gps\n\t\t\t\t\t\t\t\t\twalker.currentNode = replacement\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tnodes.push(createElement('pota'))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnode.replaceWith(...nodes)\n\t\t\t\t\t\t// walker gps\n\t\t\t\t\t\twalker.currentNode = nodes[nodes.length - 1]\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tconsole.log('unknown', node, node.nodeType)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst template = createElement('template')\n\t\ttemplate.innerHTML = cached.firstChild.innerHTML.replace(\n\t\t\t/pota xmlns=\"[^\"]+\"/g,\n\t\t\t'pota',\n\t\t)\n\t\tcached.partial = function (values) {\n\t\t\tconsole.log('clonning', template.content)\n\t\t\tconst clone = template.cloneNode(true)\n\t\t\tconsole.log('clone', clone.content)\n\t\t\tconst walker = document.createTreeWalker(clone.content, 1)\n\t\t\tlet index = 0\n\t\t\tlet valueIndex = 0\n\t\t\tconst value = () => values[valueIndex++]\n\t\t\twhile (walker.nextNode()) {\n\t\t\t\tconst node = walker.currentNode\n\t\t\t\tif (node.hasAttribute('pota')) {\n\t\t\t\t\tactions[index++](node, value, walker)\n\t\t\t\t} else if (node.localName === 'pota') {\n\t\t\t\t\tactions[index++](node, value, walker)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn clone.content\n\t\t}\n\t}\n\treturn cached.partial(values)\n}\n\n/**\n * Function to create cached tagged template components\n *\n * @returns {Function & {\n * \tdefine: ({ components }) => void\n * \tcomponents: {}\n * }}\n * @url https://pota.quack.uy/HTML\n */\n\nexport function HTML() {\n\t/**\n\t * Creates tagged template components\n\t *\n\t * @param {TemplateStringsArray} template\n\t * @param {...any} values\n\t * @returns {Children}\n\t * @url https://pota.quack.uy/HTML\n\t */\n\n\tfunction html(template, ...values) {\n\t\tconst cached = parseHTML(template)\n\n\t\treturn toH(html, cached.firstChild, values) // toPartial(html, cached, values) //\n\t}\n\n\thtml.components = { ...defaultRegistry }\n\thtml.define = userComponents => {\n\t\tfor (const name in userComponents) {\n\t\t\thtml.components[name] = userComponents[name]\n\t\t}\n\t}\n\n\treturn html\n}\n\n/**\n * Runs an `effect` on an `html` template. Reacts to reactive\n * interpolated values, or to the reactivity used in the body of the\n * function you pass.\n *\n * @param {(html: Function) => Children} fn - Function to run as an\n * effect. It receives `html` argument for template creation.\n * @returns {Children}\n * @url https://pota.quack.uy/HTML\n */\nexport const htmlEffect = fn => {\n\t/** Copy the components from the global registry */\n\tconst html_ = HTML()\n\thtml_.components = { ...html.components }\n\n\tconst [get, set] = weakStore()\n\n\tconst disposeHTMLEffect = []\n\n\tfunction _html(template, ...values) {\n\t\t// when template is cached just update the signals\n\t\tlet cached = get(template)\n\t\tif (cached) {\n\t\t\t/**\n\t\t\t * Purpose:\n\t\t\t *\n\t\t\t * 1. Track the `values` by reading, so we track the interpolated\n\t\t\t * values.\n\t\t\t * 2. Aditionally, this will also rerun when reactive values used\n\t\t\t * on the body of the function you pass to the effect\n\t\t\t * update.\n\t\t\t * 3. Update the `signals` when `values` change.\n\t\t\t *\n\t\t\t * It batches changes so it updates the template in one shot\n\t\t\t */\n\t\t\tbatch(() => {\n\t\t\t\tfor (let key = 0; key < values.length; key++) {\n\t\t\t\t\t// getValue(value) causes tracking\n\t\t\t\t\tcached[0][key].write(values[key])\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t/**\n\t\t\t * It needs to return the result because when nesting (ex\n\t\t\t * calling html twice inside the htmlEffect), the second call\n\t\t\t * will use the value of the first call. The result is a\n\t\t\t * reference to the nodes created before, so it always use the\n\t\t\t * same nodes, and reactivity on these nodes is live.\n\t\t\t *\n\t\t\t * ```js\n\t\t\t * htmlEffect(html => {\n\t\t\t * \tconst ELEMENTS = html`\n\t\t\t * \t\tdouble ${data.test * 2}\n\t\t\t * \t
`\n\t\t\t * \t// ^ these elements are needed in the next line\n\t\t\t * \treturn html`${data.test} ${ELEMENTS}
`\n\t\t\t * })\n\t\t\t * ```\n\t\t\t */\n\t\t\treturn cached[1]\n\t\t}\n\n\t\t/**\n\t\t * Creates the html with `signals` in place of the interpolated\n\t\t * `values`. This is to avoid having to create the template more\n\t\t * than once. Once the template is created, then the only thing\n\t\t * that will update is the `signals`.\n\t\t *\n\t\t * It creates a root because when any of the `values` changes\n\t\t * inside the body of the function that you pass to `htmlEffect`,\n\t\t * or when the interpolated `values` change, it causes disposal\n\t\t * (aka removing the elements), and htmlEffect re-runs. To avoid\n\t\t * having the elements removed by the disposal of the body of your\n\t\t * own function we create a root.\n\t\t */\n\t\tconst signals = []\n\t\tlet result\n\t\troot(dispose => {\n\t\t\tdisposeHTMLEffect.push(dispose)\n\n\t\t\t/**\n\t\t\t * HTML is created with the `signals` in place of the `values`.\n\t\t\t * Pota will add one effect for each signal. So this wont\n\t\t\t * re-run.\n\t\t\t */\n\t\t\tresult = html_(\n\t\t\t\ttemplate,\n\t\t\t\t...values.map((value, key) => {\n\t\t\t\t\tsignals[key] = signal(value)\n\t\t\t\t\t// give accesors to template instead of the `values`\n\t\t\t\t\treturn signals[key].read\n\t\t\t\t}),\n\t\t\t)\n\t\t})\n\n\t\t// save the `signals` in the cached template\n\t\tset(template, [signals, result])\n\t\treturn result\n\t}\n\n\t/**\n\t * This effect will re-run when the `values` interpolated change, or\n\t * when any signal that you use on the `htmlEffect` function body\n\t * change. It cause re-runs of what we are batching above.\n\t */\n\n\tlet result\n\n\tsyncEffect(() => {\n\t\tresult = fn(_html)\n\t})\n\n\t/** Dispose the effect when whatever started it is disposed. */\n\tcleanup(() => call(disposeHTMLEffect))\n\n\treturn result\n}\n\nexport const html = HTML()\n","import { signal, cleanup, syncEffect } from '../lib/reactive.js'\nimport { isIterable, toArray } from '../lib/std.js'\n\n/**\n * Returns a `isSelected` function that will return `true` when the\n * argument for it matches the original signal `value`.\n *\n * @param {Signal} value - Signal with the current value\n * @returns {(item: any) => Signal} Signal that you can run with a\n * value to know if matches the original signal\n */\nexport function useSelector(value) {\n\tconst map = new Map()\n\n\tlet prev = []\n\n\tsyncEffect(() => {\n\t\tconst val = value()\n\n\t\tconst selected = isIterable(val) ? toArray(val.values()) : [val]\n\n\t\t// unselect\n\t\tfor (const value of prev) {\n\t\t\tif (!selected.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(false)\n\t\t\t}\n\t\t}\n\n\t\t// select\n\t\tfor (const value of selected) {\n\t\t\tif (!prev.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(true)\n\t\t\t}\n\t\t}\n\n\t\tprev = selected\n\t})\n\n\t/**\n\t * Is selected function, it will return `true` when the value\n\t * matches the current signal.\n\t *\n\t * @param {any} item - Values to compare with current\n\t * @returns {Signal} A signal with a boolean value\n\t */\n\treturn function isSelected(item) {\n\t\tlet selected = map.get(item)\n\t\tif (!selected) {\n\t\t\tselected = signal(prev.includes(item))\n\t\t\tselected.counter = 0\n\t\t\tmap.set(item, selected)\n\t\t}\n\n\t\tselected.counter++\n\n\t\tcleanup(() => {\n\t\t\tif (--selected.counter === 0) {\n\t\t\t\tmap.delete(item)\n\t\t\t}\n\t\t})\n\n\t\treturn selected.read\n\t}\n}\n","export const now = () => Date.now()\n\nexport function date(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\to.getFullYear() +\n\t\t'-' +\n\t\t(o.getMonth() + 1 < 10 ? '0' : '') +\n\t\t(o.getMonth() + 1) +\n\t\t'-' +\n\t\t(o.getDate() < 10 ? '0' : '') +\n\t\to.getDate()\n\t)\n}\n\nexport function datetime(timestamp = now()) {\n\treturn date(timestamp) + ' ' + time(timestamp)\n}\n\nexport function time(timestamp = now()) {\n\treturn timeWithSeconds(timestamp).slice(0, -3)\n}\n\nexport function timeWithSeconds(timestamp = now()) {\n\tconst o = new Date(timestamp)\n\n\treturn (\n\t\t(o.getHours() < 10 ? '0' : '') +\n\t\to.getHours() +\n\t\t':' +\n\t\t(o.getMinutes() < 10 ? '0' : '') +\n\t\to.getMinutes() +\n\t\t':' +\n\t\t(o.getSeconds() < 10 ? '0' : '') +\n\t\to.getSeconds()\n\t)\n}\n\nexport function day(timestamp = now(), lang = 'en') {\n\tconst o = new Date(timestamp)\n\n\t// saturday, September 17, 2016\n\treturn o.toLocaleDateString(lang, {\n\t\tweekday: 'long',\n\t\tyear: 'numeric',\n\t\tmonth: 'long',\n\t\tday: 'numeric',\n\t})\n}\n\nexport function measure(name, cb) {\n\tconsole.time(name)\n\tconst r = cb()\n\tconsole.timeEnd(name)\n\treturn r\n}\n\nexport function timing(fn) {\n\tconst start = performance.now()\n\tfn()\n\treturn performance.now() - start\n}\n","import { batch, render, signal } from 'pota'\nimport { html } from 'pota/html'\nimport { useSelector } from 'pota/plugin/useSelector'\nimport { timing } from 'pota/plugin/useTime'\n\nlet idCounter = 1\nconst adjectives = [\n 'pretty',\n 'large',\n 'big',\n 'small',\n 'tall',\n 'short',\n 'long',\n 'handsome',\n 'plain',\n 'quaint',\n 'clean',\n 'elegant',\n 'easy',\n 'angry',\n 'crazy',\n 'helpful',\n 'mushy',\n 'odd',\n 'unsightly',\n 'adorable',\n 'important',\n 'inexpensive',\n 'cheap',\n 'expensive',\n 'fancy',\n ],\n colours = [\n 'red',\n 'yellow',\n 'blue',\n 'green',\n 'pink',\n 'brown',\n 'purple',\n 'brown',\n 'white',\n 'black',\n 'orange',\n ],\n nouns = [\n 'table',\n 'chair',\n 'house',\n 'bbq',\n 'desk',\n 'car',\n 'pony',\n 'cookie',\n 'sandwich',\n 'burger',\n 'pizza',\n 'mouse',\n 'keyboard',\n ]\n\nfunction _random(max) {\n return Math.round(Math.random() * 1000) % max\n}\n\nfunction buildData(count) {\n let data = new Array(count)\n for (let i = 0; i < count; i++) {\n const [label, setLabel] = signal(\n `${adjectives[_random(adjectives.length)]} ${\n colours[_random(colours.length)]\n } ${nouns[_random(nouns.length)]}`,\n )\n data[i] = {\n id: idCounter++,\n label,\n setLabel,\n }\n }\n return data\n}\n\nconst bbutton = ({ id, text, fn }) =>\n html`\n \n ${text}\n \n
`\n\nconst App = () => {\n const [data, setData, updateData] = signal([])\n const [selected, setSelected] = signal([])\n const run = () => setData(buildData(1000))\n const runLots = () => {\n setData(buildData(10000))\n }\n const bench = () => {\n // console.clear()\n // warm\n for (let k = 0; k < 5; k++) {\n setData(buildData(10000))\n setData([])\n }\n\n let createLarge = 0\n let clearLarge = 0\n let createSmall = 0\n let clearSmall = 0\n for (let k = 0; k < 10; k++) {\n createLarge += timing(() => setData(buildData(10000)))\n clearLarge += timing(() => setData([]))\n console.log(\n k + ' createLarge',\n createLarge / (k + 1),\n k + ' clearLarge',\n clearLarge / (k + 1),\n )\n }\n console.log('------------')\n for (let k = 0; k < 10; k++) {\n createSmall += timing(() => setData(buildData(1000)))\n clearSmall += timing(() => setData([]))\n console.log(\n k + ' createSmall',\n createSmall / (k + 1),\n k + ' clearSmall',\n clearSmall / (k + 1),\n )\n }\n }\n const add = () => updateData(d => [...d, ...buildData(1000)])\n const update = () =>\n batch(() => {\n for (let i = 0, d = data(), len = d.length; i < len; i += 10)\n d[i].setLabel(l => l + ' !!!')\n })\n const swapRows = () => {\n const d = data().slice()\n if (d.length > 998) {\n let tmp = d[1]\n d[1] = d[998]\n d[998] = tmp\n setData(d)\n }\n }\n const clear = () => setData([])\n const remove = id =>\n updateData(d => {\n const idx = d.findIndex(datum => datum.id === id)\n d.splice(idx, 1)\n return [...d]\n })\n const isSelected = useSelector(selected)\n\n html.define({ bbutton })\n\n return html`\n
\n
\n
\n
pota Keyed \n \n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n
{\n const element = e.target\n if (element.setSelected !== undefined) {\n setSelected(element.setSelected)\n } else if (element.removeRow !== undefined) {\n remove(element.removeRow)\n }\n }}\"\n >\n \n \n ${row => {\n const { id, label } = row\n\n return html`\n ${id} \n \n ${label} \n \n \n \n \n \n \n \n `\n }}\n \n \n
\n
\n
`\n}\n\nrender(App, document.getElementById('main'))\n"],"names":["global","globalThis","window","CSSStyleSheet","document","DocumentFragment","Object","Promise","Symbol","queueMicrotask","assign","entries","freeze","getOwnPropertyDescriptors","getPrototypeOf","groupBy","isArray","Array","toArray","from","iterator","stringify","JSON","history","location","origin","promise","fn","resolved","onDone","then","catch","setAttribute","node","name","value","removeAttribute","isConnected","activeElement","documentElement","call","fns","bind","createElement","createElementNS","createTextNode","empty","create","flat","arr","length","withState","state","cacheStore","withCache","cache","thing","get","withWeakCache","weakStore","getDocumentForElement","getRootNode","nodeType","ownerDocument","getSetterNamesFromPrototype","object","set","Set","descriptors","key","add","getValue","identity","x","isFunction","isIterable","isObject","isNullUndefined","undefined","isString","isPromise","noop","nothing","optional","querySelector","query","removeFromArray","array","index","indexOf","splice","walkParents","context","propertyName","cb","DataStore","constructor","kind","store","k","v","has","target","defaults","o","delete","WeakMap","Map","classListAdd","className","classList","classListRemove","remove","adoptedStyleSheetsGet","adoptedStyleSheets","adoptedStyleSheetsAdd","styleSheet","push","adoptedStyleSheetsRemove","addStyleSheets","styleSheets","sheet","addStyleSheetExternal","text","startsWith","fetch","r","css","resolve","template","values","String","raw","replace","emit","eventName","data","bubbles","cancelable","composed","dispatchEvent","CustomEvent","preventDefault","e","$isComponent","$isClass","$isReactive","$isMap","prefix","NS","__proto__","svg","math","html","xlink","CLEAN","STALE","CHECK","Owner","Listener","Updates","Effects","Time","Root","owner","owned","cleanups","options","dispose","i","Computation","updatedAt","sources","sourceSlots","update","time","prevOwner","prevListener","err","source","observers","observer","slot","pop","observerSlots","Effect","user","batch","SyncEffect","Memo","pure","markReactive","read","updates","runUpdates","upstream","sourceSlot","write","equals","downstream","a","b","nextValue","forEach","Signal","save","prev","root","signal","initialValue","effect","syncEffect","memo","runWithOwner","untrack","cleanup","runTop","ancestors","init","wait","res","runQueue","effects","runEffects","queue","userLength","ignore","Context","defaultValue","id","useContext","newValue","args","isReactive","withValue","withPrevValue","val","map","list","callback","sort","duplicates","runId","rows","clear","Row","item","isDupe","disposer","nodes","begin","end","all","mapper","items","hasPrev","row","dupes","unsorted","every","includes","usort","before","nodesFromRow","after","current","previous","previousSibling","nextSibling","children","unwrap","childrens","child","isComponent","isComponentable","makeCallback","callbacks","markComponent","addEventListener","type","handler","removeEventListener","ownedEvent","handleEvent","added","reset","priority","run","q","onFixes","onProps","onRef","onMount","ready","setEventNS","props","localName","ns","toLowerCase","slice","plugins","pluginsNS","propsPlugin","propName","onMicrotask","plugin","propsPluginNS","NSName","propsPluginBoth","setAttributeNS","_setAttribute","removeAttributeNS","setPropertyNS","setProperty","_setProperty","setUnknown","_setUnknown","setters","element","builtIn","elements","builtInSetters","proto","Element","nextProto","prototype","Node","setBoolNS","setBool","_setBool","setStyle","setNodeStyle","style","setStyleNS","setVarNS","setStyleValue","cssText","_setStyleValue","removeProperty","setClass","setClassList","setClassNS","setElementClass","_setClassListValue","trim","split","setValue","_setValue","textContent","randomId","crypto","getRandomValues","BigUint64Array","toString","setCSS","setNodeCSS","setRef","setOnMount","setUnmount","assignProps","assignProp","event","useXMLNS","Fragment","Component","component","Factory","propsOverride","createTag","createClass","createAnything","createNode","render","tagName","xmlns","withXMLNS","nsContext","createChildren","parent","relative","Text","nodeValue","insertNode","createPlaceholder","toDiff","HTMLElement","childNodes","onResult","result","doc","propValue","head","getAttribute","rel","replaceWith","appendChild","insert","body","Infinity","toHTML","toHTMLFragment","fragment","ctx","Provider","next","customElement","customElements","define","CustomElement","shadowRoot","attachShadow","mode","baseStyleSheets","innerHTML","replaceChildren","hidden","hasSlot","Collapse","CollapseElement","when","Dynamic","For","restoreFocus","each","queued","active","scroll","scrollTop","focus","Portal","mount","Head","scrollToElement","scrollIntoView","scrollToLocationHash","scrollToSelector","hash","selector","scrollToSelectorWithFallback","scrollToTop","scrollTo","top","behavior","encodeURIComponent","_decodeURIComponent","string","decodeURIComponent","isAbsolute","href","test","isExternal","url","isRelative","replaceParams","params","setChildren","updateChildren","base","show","addChildren","removeChildren","noneMatch","getLocation","setLocation","wLocation","pathname","search","endsWith","path","searchParams","URL","routes","param","BeforeLeave","canNavigate","newBeforeLeave","beforeLeave","navigate","navigateInternal","startViewTransition","replaceState","pushState","addListenersAdded","addListeners","onLinkClick","onLocationChange","title","defaultPrevented","button","metaKey","altKey","ctrlKey","shiftKey","composedPath","find","HTMLAnchorElement","download","Show","condition","fallback","Router","route","RegExp","setParams","exec","groups","collapse","Default","A","Switch","matches","match","Match","defaultRegistry","join","parseHTML","content","DOMParser","parseFromString","toH","cached","attributes","components","textNodes","HTML","firstChild","userComponents","useSelector","selected","isSelected","counter","timing","start","performance","now","idCounter","adjectives","colours","nouns","_random","max","Math","round","random","buildData","count","label","setLabel","bbutton","App","setData","updateData","setSelected","runLots","bench","createLarge","clearLarge","createSmall","clearSmall","console","log","d","len","l","swapRows","tmp","idx","findIndex","datum","removeRow","getElementById"],"mappings":";;;CAAO,MAAMA,MAAM,GAAGC,UAAU,CAAA;CACzB,MAAMC,MAAM,GAAGF,MAAM,CAAA;CAErB,MAAMG,aAAa,GAAGH,MAAM,CAACG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,eAAA,EAAiB3Z,CAAC,IAAI;AACd,IAAA,MAAM+K,OAAO,GAAG/K,CAAC,CAACzC,MAAM,CAAA;AACxB,IAAA,IAAIwN,OAAO,CAAC0O,WAAW,KAAK1d,SAAS,EAAE;AACrC0d,MAAAA,WAAW,CAAC1O,OAAO,CAAC0O,WAAW,CAAC,CAAA;AAClC,KAAC,MAAM,IAAI1O,OAAO,CAAC2P,SAAS,KAAK3e,SAAS,EAAE;AAC1CkC,MAAAA,MAAM,CAAC8M,OAAO,CAAC2P,SAAS,CAAC,CAAA;AAC3B,KAAA;GACD,CAAA;AACP;AACA;AACA,mBAAA,EAAqBjb,IAAI,CAAA;AACzB,UAAA,EAAYwH,GAAG,IAAI;IACP,MAAM;MAAE3B,EAAE;AAAE6T,MAAAA,KAAAA;AAAM,KAAC,GAAGlS,GAAG,CAAA;AAEzB,IAAA,OAAOvG,IAAI,CAAA,kBAAA,EAAqBwX,UAAU,CAAC5S,EAAE,CAAC,CAAA;AAC1D,mCAAA,EAAqCA,EAAE,CAAA;AACvC;AACA,qCAAuCA,EAAAA,EAAE,KAAK6T,KAAK,CAAA;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,oCAAA,EAAsC7T,EAAE,CAAA;AACxC;AACA;AACA;AACA;AACA,iBAAkB,CAAA,CAAA;GACP,CAAA;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAS,CAAA,CAAA;CACT,CAAC,CAAA;CAED+I,MAAM,CAACiL,GAAG,EAAEjiB,QAAQ,CAACsjB,cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;"}
\ No newline at end of file
diff --git a/src/pages/benchmark/regular/main.js b/src/pages/benchmark/regular/main.js
index 9bb698b..271d47d 100644
--- a/src/pages/benchmark/regular/main.js
+++ b/src/pages/benchmark/regular/main.js
@@ -12,6 +12,8 @@
const assign = Object$1.assign;
const entries = Object$1.entries;
const freeze = Object$1.freeze;
+ const getOwnPropertyDescriptors = Object$1.getOwnPropertyDescriptors;
+ const getPrototypeOf = Object$1.getPrototypeOf;
const groupBy = Object$1.groupBy;
const isArray = Array.isArray;
const toArray = Array.from;
@@ -112,6 +114,15 @@
// always return a Document-like
return nodeType === 11 || nodeType === 9 ? document : node.ownerDocument;
};
+ function getSetterNamesFromPrototype(object, set = new Set()) {
+ const descriptors = getOwnPropertyDescriptors(object);
+ for (const key in descriptors) {
+ if (descriptors[key].set) {
+ set.add(key);
+ }
+ }
+ return set;
+ }
/**
* Unwraps values. If the argument is a function then it runs it
@@ -164,6 +175,14 @@
* @returns {boolean}
*/
const isString = value => typeof value === 'string';
+
+ /**
+ * Returns `true` when `value` may be a promise
+ *
+ * @param {any} value
+ * @returns {boolean}
+ */
+ const isPromise = value => isObject(value) && 'then' in value;
const noop = () => {};
/**
@@ -207,9 +226,9 @@
class DataStore {
constructor(kind) {
const store = new kind();
- const get = store.get.bind(store);
- const set = store.set.bind(store);
- const has = store.has.bind(store);
+ const get = k => store.get(k);
+ const set = (k, v) => store.set(k, v);
+ const has = k => store.has(k);
this.get = (target, defaults = undefined) => {
const o = get(target);
if (o !== undefined) {
@@ -227,7 +246,7 @@
};
this.set = set;
this.has = has;
- this.delete = store.delete.bind(store);
+ this.delete = k => store.delete(k);
}
*[Symbol.iterator]() {
yield this.get;
@@ -477,11 +496,9 @@
this.prev = value;
}
}
- this.read = markReactive(this.read.bind(this));
- this.write = this.write.bind(this);
- this.update = this.update.bind(this);
+ this.read = markReactive(this.read);
}
- read() {
+ read = () => {
// checkReadForbidden()
if (Listener) {
@@ -502,8 +519,8 @@
}
}
return this.value;
- }
- write(value) {
+ };
+ write = value => {
if (this.equals === false || !this.equals(this.value, value)) {
if (this.save) {
this.prev = this.value;
@@ -530,13 +547,13 @@
return true;
}
return false;
- }
- update(value) {
+ };
+ update = value => {
if (isFunction(value)) {
value = value(this.value);
}
return this.write(value);
- }
+ };
equals(a, b) {
return a === b;
}
@@ -563,7 +580,7 @@
Owner = root;
Listener = undefined;
try {
- return runUpdates(() => fn(root.dispose.bind(root)), true);
+ return runUpdates(() => fn(() => root.dispose()), true);
} finally {
Owner = prevOwner;
Listener = prevListener;
@@ -868,12 +885,21 @@
}
/**
- * Runs a function inside an effect if value is a function
+ * Runs a function inside an effect if value is a function.
+ * Aditionally unwraps promises.
*
* @param {any} value
* @param {(value) => any} fn
*/
- const withValue = (value, fn) => isFunction(value) ? effect(() => fn(getValue(value))) : fn(value);
+ const withValue = (value, fn) => {
+ if (isFunction(value)) {
+ effect(() => withValue(getValue(value), fn));
+ } else if (isPromise(value)) {
+ value.then(owned(value => withValue(value, fn)));
+ } else {
+ fn(value);
+ }
+ };
/**
* Runs a function inside an effect if value is a function
@@ -1308,7 +1334,7 @@
* @param {string} localName
* @param {string} ns
*/
- const setEventNS = (node, name, value, props, localName, ns) => addEventListener(node, localName, value);
+ const setEventNS = (node, name, value, props, localName, ns) => addEventListener(node, localName, ownedEvent(value));
/**
* Returns an event name when the string could be mapped to an event
@@ -1318,11 +1344,6 @@
* case isnt found
*/
const eventName = withCache(name => name.startsWith('on') && name.toLowerCase() in window ? name.slice(2).toLowerCase() : null);
- /*
- const eventNames = new Set(
- keys(global).filter(prop => prop.startsWith('on')),
- )
- */
const plugins = cacheStore();
const pluginsNS = cacheStore();
@@ -1467,9 +1488,74 @@
* @param {string} [ns]
*/
const setUnknown = (node, name, value, ns) => {
- name in node && !(node instanceof SVGElement) ? setProperty(node, name, value) : setAttribute(node, name, value, ns);
+ withValue(value, value => _setUnknown(node, name, value, ns));
};
+ /**
+ * @param {Element} node
+ * @param {string} name
+ * @param {unknown} value
+ * @param {string} [ns]
+ */
+ const _setUnknown = (node, name, value, ns) => {
+ if (typeof value !== 'string' && setters(node).element.has(name)) {
+ /**
+ * 1. First check in element because a custom-element may overwrite
+ * builtIn setters
+ * 2. Only do this when it's different to a string to avoid coarcing
+ * on native elements (ex: (img.width = '16px') === 0)
+ */
+ setProperty(node, name, value);
+ } else if (setters(node).builtIn.has(name)) {
+ // ex: innerHTML, textContent, draggable={true}
+ setProperty(node, name, value);
+ } else {
+ setAttribute(node, name, value, ns);
+ }
+ };
+ const elements = new Map();
+
+ /** @param {Element} node */
+ function setters(node) {
+ /**
+ * Use `node.constructor` instead of `node.nodeName` because it
+ * handles the difference between `a` `HTMLAnchorElement` and `a`
+ * `SVGAElement`
+ */
+ let setters = elements.get(node.constructor);
+ if (setters) return setters;
+ setters = {
+ builtIn: new Set(builtInSetters),
+ element: new Set()
+ };
+ elements.set(node.constructor, setters);
+ let store = setters.element;
+ let proto = getPrototypeOf(node);
+
+ /**
+ * Stop at `Element` instead of `HTMLElement` because it handles the
+ * difference between `HTMLElement`, `SVGElement`, `FutureElement`
+ * etc
+ */
+ while (proto.constructor !== Element) {
+ const nextProto = getPrototypeOf(proto);
+
+ /**
+ * The previous prototype to `Element` is a `builtIn`
+ * (`HTMLElement`, `SVGElement`,`FutureElement`, etc)
+ */
+ if (nextProto.constructor === Element) {
+ store = setters.builtIn;
+ }
+ getSetterNamesFromPrototype(proto, store);
+ proto = nextProto;
+ }
+ return setters;
+ }
+
+ /** Setters shared by all kind of elements */
+ const builtInSetters = getSetterNamesFromPrototype(Element.prototype, getSetterNamesFromPrototype(Node.prototype));
+
// BOOL ATTRIBUTES
@@ -1498,7 +1584,7 @@
*/
const _setBool = (node, name, value) =>
// if the value is falsy gets removed
- !value ? node.removeAttribute(name) : node.setAttribute(name, '');
+ value ? node.setAttribute(name, '') : node.removeAttribute(name);
// node style
@@ -1644,6 +1730,35 @@
// null, undefined or false, the class is removed
!value ? classListRemove(node, name) : classListAdd(node, ...name.trim().split(/\s+/));
+ /**
+ * `value` as a prop is special cased so the button `reset` in forms
+ * works as expected. The first time a value is set, its done as an
+ * attribute.
+ */
+ const setValue = (node, name, value) => withValue(value, value => _setValue(node, name, value));
+ const defaults = new Set();
+ function _setValue(node, name, value) {
+ if (!defaults.has(node)) {
+ defaults.add(node);
+ cleanup(() => defaults.delete(node));
+ if (!isNullUndefined(value)) {
+ switch (node.localName) {
+ case 'input':
+ {
+ node.setAttribute('value', value);
+ return;
+ }
+ case 'textarea':
+ {
+ node.textContent = value;
+ return;
+ }
+ }
+ }
+ }
+ _setProperty(node, name, value);
+ }
+
/** Returns true or false with a `chance` of getting `true` */
const randomId = () => crypto.getRandomValues(new BigUint64Array(1))[0].toString(36);
@@ -1696,11 +1811,9 @@
propsPluginNS('bool', setBoolNS, false);
propsPluginNS('on', setEventNS, false);
propsPluginNS('var', setVarNS, false);
- for (const item of ['value', 'textContent', 'innerText', 'innerHTML']) {
- propsPlugin(item, setProperty, false);
- }
propsPlugin('__dev', noop, false);
propsPlugin('xmlns', noop, false);
+ propsPlugin('value', setValue, false);
propsPluginBoth('css', setCSS, false);
propsPluginBoth('onMount', setOnMount, false);
propsPluginBoth('onUnmount', setUnmount, false);
@@ -1733,12 +1846,6 @@
* @param {object} props
*/
function assignProp(node, name, value, props) {
- // unwrap promises
- if (isObject(value) && 'then' in value) {
- value.then(owned(value => assignProp(node, name, getValue(value), props)));
- return;
- }
-
// run plugins
let plugin = plugins.get(name);
if (plugin) {
@@ -1888,7 +1995,7 @@
// PARTIALS
- function cloneNode(content, xmlns) {
+ function parseHTML(content, xmlns) {
const template = xmlns ? createElementNS(xmlns, 'template') : createElement('template');
template.innerHTML = content;
@@ -1904,7 +2011,7 @@
}
function createPartial(content, propsData = nothing) {
let clone = () => {
- const node = withXMLNS(propsData.x, xmlns => cloneNode(content, xmlns));
+ const node = withXMLNS(propsData.x, xmlns => parseHTML(content, xmlns));
clone = propsData.i ? importNode.bind(null, node, true) : node.cloneNode.bind(node, true);
return clone();
};
diff --git a/src/pages/benchmark/regular/main.js.map b/src/pages/benchmark/regular/main.js.map
index 8326983..beca1ae 100644
--- a/src/pages/benchmark/regular/main.js.map
+++ b/src/pages/benchmark/regular/main.js.map
@@ -1 +1 @@
-{"version":3,"file":"main.js","sources":["../../../../../pota/src/lib/std.js","../../../../../pota/src/constants.js","../../../../../pota/src/lib/reactive.js","../../../../../pota/src/scheduler.js","../../../../../pota/src/props/event.js","../../../../../pota/src/props/plugin.js","../../../../../pota/src/props/attribute.js","../../../../../pota/src/props/property.js","../../../../../pota/src/props/unknown.js","../../../../../pota/src/props/bool.js","../../../../../pota/src/props/style.js","../../../../../pota/src/props/class.js","../../../../../pota/src/plugin/useRandom.js","../../../../../pota/src/props/css.js","../../../../../pota/src/props/lifecycle.js","../../../../../pota/src/props/@main.js","../../../../../pota/src/renderer.js","../../../../../pota/src/web/For.js","../../../../../pota/src/plugin/useSelector.js","index.jsx"],"sourcesContent":["export const global = globalThis\nexport const window = global\n\nexport const CSSStyleSheet = global.CSSStyleSheet\nexport const document = global.document\nexport const DocumentFragment = global.DocumentFragment\nexport const Object = global.Object\nexport const Promise = global.Promise\nexport const requestAnimationFrame = global.requestAnimationFrame\nexport const Symbol = global.Symbol\nexport const queueMicrotask = global.queueMicrotask\n\nexport const assign = Object.assign\nexport const create = Object.create\nexport const defineProperties = Object.defineProperties\nexport const defineProperty = Object.defineProperty\nexport const entries = Object.entries\nexport const freeze = Object.freeze\nexport const fromEntries = Object.fromEntries\nexport const getOwnPropertyDescriptor =\n\tObject.getOwnPropertyDescriptor\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors\nexport const getOwnPropertyNames = Object.getOwnPropertyNames\nexport const getOwnPropertySymbols = Object.getOwnPropertySymbols\nexport const getPrototypeOf = Object.getPrototypeOf\nexport const groupBy = Object.groupBy\nexport const hasOwnProperty = Object.hasOwn\nexport const is = Object.is\nexport const isExtensible = Object.isExtensible\nexport const keys = Object.keys\nexport const values = Object.values\nexport const setPrototypeOf = Object.setPrototypeOf\n\nexport const isArray = Array.isArray\nexport const toArray = Array.from\n\nexport const isNaN = Number.isNaN\n\nexport const iterator = Symbol.iterator\n\nexport const stringify = JSON.stringify\nexport const stringifyReadable = o => stringify(o, null, 2)\n\nexport const stringifySorted = o => {\n\tfunction sort(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\t\tconst tmp = isArray(o) ? [] : {}\n\t\tkeys(o)\n\t\t\t.sort()\n\t\t\t.map(k => (tmp[k] = sort(o[k])))\n\n\t\tif (isArray(tmp)) {\n\t\t\ttmp.sort((a, b) => stringify(a).localeCompare(stringify(b)))\n\t\t}\n\t\treturn tmp\n\t}\n\treturn stringifyReadable(sort(o))\n}\n\nexport const PrototypeArray = Array.prototype\nexport const PrototypeMap = Map.prototype\n\nexport const history = global.history\nexport const location = global.location\nexport const navigator = global.navigator\n\nexport const origin = location.origin\n\nexport const promise = fn => new Promise(fn)\n\nexport const withResolvers = () => Promise.withResolvers()\n\n/**\n * Given a promise it adds `onDone` to `then` and `catch`\n *\n * ```js\n * resolved(promise, onDone)\n * // is same as\n * promise.then(onDone).catch(onDone)\n * ```\n */\nexport const resolved = (promise, onDone) =>\n\tpromise.then(onDone).catch(onDone)\n\nexport const setAttribute = (node, name, value) =>\n\tnode.setAttribute(name, value)\n\nexport const hasAttribute = (node, name) => node.hasAttribute(name)\n\nexport const removeAttribute = (node, name) =>\n\tnode.removeAttribute(name)\n\nexport const setAttributeNS = (node, name, value) =>\n\tnode.setAttributeNS(name, value)\n\nexport const hasAttributeNS = (node, name) =>\n\tnode.hasAttributeNS(name)\n\nexport const removeAttributeNS = (node, name) =>\n\tnode.removeAttributeNS(name)\n\nexport const isConnected = node => node.isConnected\n\nexport const activeElement = () => document.activeElement\n\nexport const documentElement = document.documentElement\n\n/**\n * Runs an array of functions\n *\n * @param {Iterable} fns\n */\nexport const call = fns => {\n\tfor (const fn of fns) fn()\n}\n\nexport function copy(o) {\n\tconst seen = new Map()\n\tfunction copy(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (\n\t\t\to instanceof Node ||\n\t\t\to instanceof Date ||\n\t\t\to instanceof Set ||\n\t\t\to instanceof Map ||\n\t\t\to instanceof WeakSet ||\n\t\t\to instanceof WeakMap ||\n\t\t\to instanceof Promise ||\n\t\t\to instanceof RegExp\n\t\t) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (seen.has(o)) {\n\t\t\treturn seen.get(o)\n\t\t}\n\n\t\tconst c = isArray(o) ? [] : {}\n\n\t\tseen.set(o, c)\n\n\t\tfor (const k in o) {\n\t\t\tc[k] = copy(o[k])\n\t\t}\n\t\treturn c\n\t}\n\treturn copy(o)\n}\n\n/**\n * Object.defineProperty with `enumerable` and `configurable` set to\n * `true` unless overwriten by `descriptor` argument\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n */\nexport const redefineProperty = (target, key, descriptor) =>\n\tdefineProperty(target, key, assign(create(defaults), descriptor))\n\nconst defaults = {\n\t__proto__: null,\n\tconfigurable: true,\n\tenumerable: true,\n}\n\n/**\n * Object.defineProperty with `configurable`, `writable` and\n * `enumerable` as `false`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {any} value\n */\nexport const definePropertyReadOnly = (target, key, value) => {\n\tconst descriptor = create(defaultsReadOnly)\n\tdescriptor.value = value\n\tdefineProperty(target, key, descriptor)\n}\n\nconst defaultsReadOnly = {\n\t__proto__: null,\n\tconfigurable: false,\n\tenumerable: false,\n\twritable: false,\n\tvalue: undefined,\n}\n\nconst bind = fn => document[fn].bind(document)\n\nexport const createElement = bind('createElement')\n\nexport const createElementNS = bind('createElementNS')\n\nexport const createTextNode = bind('createTextNode')\n\nexport const importNode = bind('importNode')\n\nexport const createTreeWalker = bind('createTreeWalker')\n\n/**\n * Returns an object without a prototype\n *\n * @type {Function}\n * @returns {Props} Empty object\n */\nexport const empty = Object.create.bind(null, null)\n\nexport function* entriesIncludingSymbols(target) {\n\tfor (const item of entries(target)) {\n\t\tyield item\n\t}\n\n\tfor (const item of getOwnPropertySymbols(target)) {\n\t\t// todo: causes access!\n\t\tyield [item, target[item]]\n\t}\n}\n\n// modified version of https://github.com/epoberezkin/fast-deep-equal\n\nexport function equals(a, b) {\n\tif (a === b) {\n\t\treturn true\n\t}\n\n\tif (a && b && typeof a == 'object' && typeof b == 'object') {\n\t\tif (a.constructor !== b.constructor) {\n\t\t\treturn false\n\t\t}\n\n\t\tlet length, i, k\n\t\tif (isArray(a)) {\n\t\t\tlength = a.length\n\t\t\tif (length != b.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor (i = length; i-- !== 0; ) {\n\t\t\t\tif (!equals(a[i], b[i])) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif (a.constructor === RegExp)\n\t\t\treturn a.source === b.source && a.flags === b.flags\n\t\tif (a.valueOf !== Object.prototype.valueOf)\n\t\t\treturn a.valueOf() === b.valueOf()\n\t\tif (a.toString !== Object.prototype.toString)\n\t\t\treturn a.toString() === b.toString()\n\n\t\tk = keys(a)\n\t\tlength = k.length\n\t\tif (length !== keys(b).length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(b, k[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tvar key = k[i]\n\n\t\t\tif (!equals(a[key], b[key])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// true if both NaN, false otherwise\n\treturn a !== a && b !== b\n}\n\n/**\n * Flats an array/childNodes to the first children if the length is 1\n *\n * @param {any[] | NodeListOf} arr\n * @returns {any}\n */\nexport const flat = arr => (arr.length === 1 ? arr[0] : arr)\n\n/**\n * Keeps state in the function as the first param\n *\n * @template T\n * @param {T} fn - Function to which add state to it\n * @param {DataStore | DataStore} [state] - Passed to\n * `fn` as first param\n * @returns {T} A copy of the function with the state\n */\nexport const withState = /* #__NO_SIDE_EFFECTS__ */ (\n\tfn,\n\tstate = cacheStore,\n) => fn.bind(null, state())\n\n/** Memoize functions with a map cache */\nexport const withCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tcacheStore,\n\t)\n/** Memoize functions with a weak cache */\nexport const withWeakCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tweakStore,\n\t)\n\nexport const walkElements = withState(\n\t(walk, node, fn) => {\n\t\twalk.currentNode = node\n\n\t\t/**\n\t\t * The first node is not walked by the walker.\n\t\t *\n\t\t * Also the first node could be a DocumentFragment\n\t\t */\n\t\tif (node.nodeType === 1) {\n\t\t\tif (fn(node)) return\n\t\t}\n\n\t\twhile ((node = walk.nextNode())) {\n\t\t\tif (fn(node)) break\n\t\t}\n\t},\n\t() => createTreeWalker(document, 1 /*NodeFilter.SHOW_ELEMENT*/),\n)\n\n/**\n * Returns `document` for element. That could be a `shadowRoot`\n *\n * @param {Element} node\n * @returns {Document | ShadowRoot}\n */\n\nexport const getDocumentForElement = node => {\n\tconst document = node.getRootNode()\n\tconst { nodeType } = document\n\t// getRootNode returns:\n\t// 1. Node for isConnected = false\n\t// 2. Document for isConnected = true\n\t// 3. shadowRoot for custom elements\n\n\t// always return a Document-like\n\treturn nodeType === 11 || nodeType === 9\n\t\t? document\n\t\t: node.ownerDocument\n}\n\nexport const getOwnValues = o =>\n\tgetOwnPropertyNames(o).map(key => {\n\t\ttry {\n\t\t\treturn o[key]\n\t\t} catch (e) {}\n\t})\n\n/**\n * Unwraps values. If the argument is a function then it runs it\n * recursively and returns the value\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValue(value) {\n\twhile (typeof value === 'function') value = value()\n\treturn value\n}\n\n/**\n * Unwraps `value` and returns `element` if result is a `Node`, else\n * `undefined` in the case isn't a `Node`\n *\n * @param {Function | any} value - Maybe function\n * @param {...any} args? - Arguments\n * @returns {Node | undefined}\n */\nexport function getValueElement(value, ...args) {\n\tconst element = getValueWithArguments(value, ...args)\n\treturn element instanceof Node ? element : undefined\n}\n\nexport const getValueWithArguments = (value, ...args) =>\n\ttypeof value === 'function'\n\t\t? args.length\n\t\t\t? getValue(value(...args))\n\t\t\t: getValue(value())\n\t\t: value\n\n/**\n * Identity function, given `x` returns `x`\n *\n * @template T\n * @param {T} x\n * @returns {T}\n */\nexport const identity = x => x\n\n/**\n * When `value` is an object, it will check if the `key` on `target`\n * is `configurable`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {boolean | undefined} value\n */\nexport const isConfigurable = (target, key, value) => {\n\tif (isObject(value)) {\n\t\tconst descriptor = getOwnPropertyDescriptor(target, key)\n\t\tif (descriptor) {\n\t\t\treturn descriptor.configurable\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Returns `true` when `typeof` of `value` is `function`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isFunction = value => typeof value === 'function'\n\n/**\n * Returns `true` when value is Iterable\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isIterable = value =>\n\tisObject(value) && 'values' in value\n\n/**\n * Returns `true` if the value is `null` or `undefined`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNullUndefined = value =>\n\tvalue === undefined || value === null\n\n/**\n * Returns `true` when typeof of value is object and not null\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isObject = value =>\n\tvalue !== null && typeof value === 'object'\n\n/**\n * Returns `true` when object morphed between array/object\n *\n * @param {any} a\n * @param {any} b\n * @returns {boolean}\n */\nexport const morphedBetweenArrayAndObject = (a, b) =>\n\t(isObject(a) && !isObject(b)) ||\n\t(isObject(b) && !isObject(a)) ||\n\t(isArray(a) && !isArray(b)) ||\n\t(isArray(b) && !isArray(a))\n\n/**\n * Returns `true` if the property is defined in the `prototype` and\n * absent in the `object`\n *\n * @param {object} target\n * @param {PropertyKey} key\n */\nexport const isPrototypeProperty = (target, key) =>\n\t// must do `key in target` to check that it DOES have it somewhere\n\t// must do !hasOwnProperty to check that isnt an own property\n\tkey in target && !hasOwnProperty(target, key)\n\n/**\n * Returns `true` when `typeof` of `value` is `string`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isString = value => typeof value === 'string'\n\n/**\n * Returns `true` when `typeof` of `value` is `number`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNumber = value => typeof value === 'number'\n\n/**\n * Returns `true` when `typeof` of `value` is `symbol`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isSymbol = value => typeof value === 'symbol'\n\n/**\n * Returns `true` when `typeof` of `value` is `boolean`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isBoolean = value => typeof value === 'boolean'\n\nexport const noop = () => {}\n\n/**\n * An empty frozen object\n *\n * @type object\n */\nexport const nothing = freeze(empty())\n\n// an optional value is `true` by default, so most of the time is undefined which means is `true`\n// to avoid having conditions like `if(something.bla === undefined || something.bla)`\n// this function will short it to `if(optional(something.bla))`\n// additionally the value is resolved, for cases like `when={() => show() && optional(props.when)}`\n\n/**\n * Returns `true` when value is true or undefined\n *\n * @param {Function | boolean | undefined} value\n * @returns {boolean} True when value is true or undefined\n */\nexport const optional = value =>\n\tvalue === undefined || getValue(value)\n\nexport const partAdd = (node, className) => node.part.add(className)\n\nexport const partRemove = (node, className) =>\n\tnode.part.remove(className)\n\nexport const querySelector = (node, query) =>\n\tnode.querySelector(query)\n\nexport const querySelectorAll = (node, query) =>\n\tnode.querySelectorAll(query)\n\nexport function* range(start, stop, step = 1) {\n\tyield start\n\twhile (start < stop) {\n\t\tyield (start += step)\n\t}\n}\n\nexport const {\n\townKeys: reflectOwnKeys,\n\thas: reflectHas,\n\tdeleteProperty: reflectDeleteProperty,\n\tgetOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor,\n\tget: reflectGet,\n\tapply: reflectApply,\n\tset: reflectSet,\n} = Reflect\n\n/**\n * Removes a value from an array\n *\n * @template T\n * @param {T[]} array\n * @param {T} value To remove from the array\n * @returns {T[]}\n */\nexport function removeFromArray(array, value) {\n\tconst index = array.indexOf(value)\n\tif (index !== -1) array.splice(index, 1)\n\treturn array\n}\n/**\n * Removes values from an array based on a condition\n *\n * @template T\n * @param {T[]} array\n * @param {(value: T, index: number) => boolean} cb Function with\n * condition\n */\nexport function removeFromArrayConditionally(array, cb) {\n\tlet i = array.length\n\twhile (i--) {\n\t\tif (cb(array[i], i)) {\n\t\t\tarray.splice(i, 1)\n\t\t}\n\t}\n}\n/**\n * Removes values from an array based on a condition\n *\n * @param {Iterable} iterable\n * @param {PropertyKey} key Function with condition\n */\nexport function indexByKey(iterable, key) {\n\tconst byKey = empty()\n\tfor (const item of iterable) {\n\t\tbyKey[item[key]] = item\n\t}\n\treturn byKey\n}\n\n/**\n * Replace a prototype in the prototype chain with another prototype\n *\n * @param {object} target - Target object\n * @param {object} search - The prototype to replace\n * @param {object} replacement - The replacement prototype\n */\nexport function replacePrototypeWith(target, search, replacement) {\n\tlet prototype = target\n\twhile (getPrototypeOf(prototype) !== search) {\n\t\tprototype = getPrototypeOf(prototype)\n\t}\n\n\tsetPrototypeOf(prototype, replacement)\n}\n\nexport const typeString = obj =>\n\tObject.prototype.toString.call(obj).slice(8, -1)\n\nexport function walkParents(context, propertyName, cb) {\n\twhile (context) {\n\t\tif (cb(context)) return true\n\t\tcontext = context[propertyName]\n\t}\n}\n\n/**\n * Store template\n *\n * @typedef {(\n * \treference: any,\n * \tcreateIfNotExistsAs?: ((target: any) => any) | Function,\n * ) => any} DataStoreGet\n *\n *\n * @typedef {(key: any, value: any) => void} DataStoreSet\n *\n * @typedef {(key: any) => boolean} DataStoreHas\n *\n * @typedef {(key: any) => boolean} DataStoreDelete\n */\n\nclass DataStore {\n\tconstructor(kind) {\n\t\tconst store = new kind()\n\n\t\tconst get = store.get.bind(store)\n\t\tconst set = store.set.bind(store)\n\t\tconst has = store.has.bind(store)\n\n\t\tthis.get = (target, defaults = undefined) => {\n\t\t\tconst o = get(target)\n\n\t\t\tif (o !== undefined) {\n\t\t\t\treturn o\n\t\t\t}\n\n\t\t\tif (defaults !== undefined) {\n\t\t\t\t/**\n\t\t\t\t * Default values should be passed as a function, so we dont\n\t\t\t\t * constantly initialize values when giving them\n\t\t\t\t */\n\t\t\t\tdefaults = defaults(target)\n\t\t\t\tset(target, defaults)\n\t\t\t\treturn defaults\n\t\t\t}\n\t\t}\n\n\t\tthis.set = set\n\t\tthis.has = has\n\t\tthis.delete = store.delete.bind(store)\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.get\n\t\tyield this.set\n\t\tyield this.has\n\t\tyield this.delete\n\t}\n}\n\n/**\n * Creates a WeakMap to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdelete: DataStoreDelete\n * }}\n */\nexport const weakStore = () => new DataStore(WeakMap)\n\n/**\n * Creates a Map to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdel: DataStoreDelete\n * }}\n */\nexport const cacheStore = () => new DataStore(Map)\n\nexport const classListAdd = (node, className) =>\n\tnode.classList.add(className)\n\nexport const classListRemove = (node, className) =>\n\tnode.classList.remove(className)\n\n/**\n * - Returns `adoptedStyleSheets` for a document\n *\n * @param {Document | ShadowRoot} document\n */\nexport const adoptedStyleSheetsGet = document =>\n\tdocument.adoptedStyleSheets\n\nexport const adoptedStyleSheets =\n\t/* #__PURE__*/ adoptedStyleSheetsGet(document)\n\n/**\n * Adds a style sheet to the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsAdd = (document, styleSheet) =>\n\tadoptedStyleSheetsGet(document).push(styleSheet)\n\n/**\n * Removes a style sheet from the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsRemove = (document, styleSheet) =>\n\tremoveFromArray(adoptedStyleSheetsGet(document), styleSheet)\n\n/**\n * Adds a style sheet to the custom element\n *\n * @param {Document | ShadowRoot} document\n * @param {(CSSStyleSheet | string)[]} styleSheets\n */\nexport function addStyleSheets(document, styleSheets = []) {\n\tfor (const sheet of styleSheets) {\n\t\tif (sheet) {\n\t\t\tsheet instanceof CSSStyleSheet\n\t\t\t\t? adoptedStyleSheetsAdd(document, sheet)\n\t\t\t\t: addStyleSheetExternal(document, sheet)\n\t\t}\n\t}\n}\n\n/**\n * Adds the stylesheet from urls. It uses a cache, to avoid having to\n * fire a request for each external sheet when used in more than one\n * custom element. Also, all reference the same object.\n *\n * @param {Document | ShadowRoot} document\n * @param {string} text\n */\nexport const addStyleSheetExternal = withState(\n\t(state, document, text) => {\n\t\tstate\n\t\t\t.get(text, text =>\n\t\t\t\ttext.startsWith('http')\n\t\t\t\t\t? fetch(text)\n\t\t\t\t\t\t\t.then(r => r.text())\n\t\t\t\t\t\t\t.then(css => sheet(css))\n\t\t\t\t\t: promise(resolve => resolve(sheet(text))),\n\t\t\t)\n\t\t\t.then(styleSheet => adoptedStyleSheetsAdd(document, styleSheet))\n\t},\n)\n\n/**\n * Swaps classNames and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldClass - `class` with the old animation\n * @param {string} newClass - `class` with the new animation\n */\nexport const animateClassTo = (element, oldClass, newClass) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tclassListRemove(element, oldClass)\n\t\t\tclassListAdd(element, newClass)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Swaps parts and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldPart - `part` with the old animation\n * @param {string} newPart - `part` with the new animation\n */\nexport const animatePartTo = (element, oldPart, newPart) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tpartRemove(element, oldPart)\n\t\t\tpartAdd(element, newPart)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Creates tagged css and returns a CSSStyleSheet. Mostly for css\n * highlighting in js\n *\n * @param {TemplateStringsArray} template\n * @param {...any} values\n * @returns {CSSStyleSheet}\n */\nexport const css = (template, ...values) =>\n\tsheet(String.raw({ raw: template }, ...values))\n\n/**\n * Creates a stylesheet from a css string\n *\n * @param {string} css\n * @returns {CSSStyleSheet}\n */\nexport const sheet = withCache(css => {\n\tconst sheet = new CSSStyleSheet()\n\t/**\n\t * Replace is asynchronous and can accept @import statements\n\t * referencing external resources.\n\t */\n\tsheet.replace(css)\n\n\treturn sheet\n})\n\n/**\n * @param {Element} node\n * @param {string} eventName\n * @param {any} [data]\n */\n\nexport const emit = (\n\tnode,\n\teventName,\n\tdata = { bubbles: true, cancelable: true, composed: true },\n) => node.dispatchEvent(new CustomEvent(eventName, data))\n\nexport function stopEvent(e) {\n\tpreventDefault(e)\n\tstopPropagation(e)\n\tstopImmediatePropagation(e)\n}\n\nexport const preventDefault = e => e.preventDefault()\nexport const stopPropagation = e => e.stopPropagation()\nexport const stopImmediatePropagation = e =>\n\te.stopImmediatePropagation()\n\n/**\n * Waits for an event to be dispatched and runs a callback\n *\n * @param {Element} element\n * @param {string} eventName\n */\nexport const waitEvent = withState(\n\t(state, element, eventName) =>\n\t\tpromise((resolve, reject) => {\n\t\t\t/**\n\t\t\t * To prevent firing `transitionend` twice it needs to stop\n\t\t\t * listening the old one because maybe wasn't dispatched and\n\t\t\t * running a new transition will make it dispatch twice\n\t\t\t */\n\t\t\tconst previous = state.get(element, empty)\n\t\t\tprevious.reject && previous.reject()\n\t\t\telement.removeEventListener(eventName, previous.resolve)\n\t\t\tstate.set(element, { resolve, reject })\n\t\t\telement.addEventListener(eventName, resolve, {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t}),\n\tweakStore,\n)\n\nexport const addEventListenerObject = (where, type, handler) =>\n\twhere.addEventListener(type, handler, handler)\n\nexport const removeEventListenerObject = (where, type, handler) =>\n\twhere.removeEventListener(type, handler, handler)\n\n/** @param {EventListener} fn */\nexport const passiveEvent = fn => ({ handleEvent: fn, passive: true })\n","// symbols\n\nimport { Symbol } from './lib/std.js'\n\nexport const $isComponent = Symbol()\nexport const $isClass = Symbol()\nexport const $isReactive = Symbol()\nexport const $isMap = Symbol()\n\n// supported namespaces\n\nconst prefix = 'http://www.w3.org/'\n\n// when a tag/attribute is missing the namespace this puts it back in\n\nexport const NS = {\n\t__proto__: null,\n\tsvg: prefix + '2000/svg',\n\tmath: prefix + '1998/Math/MathML',\n\thtml: prefix + '1999/xhtml',\n\txlink: prefix + '1999/xlink',\n}\n","/**\n * This is so far the core of Solid JS Reactivity, this may change.\n *\n * Adaptation for potas needs have been made:\n *\n * - Ported to Classes what does fit\n * - Signal has more options: `label` and `save` previous value\n * - Writing to a signal returns `true` when the value changes\n * - Signal is an object that could be used as signal.read/write or\n * destructured as an array.\n * - Signals can save and wont run functions\n * - `update` function on Signal that could be used to use the old value\n */\n\nimport {\n\t$isClass,\n\t$isComponent,\n\t$isMap,\n\t$isReactive,\n} from '../constants.js'\n\nimport {\n\tassign,\n\tentries,\n\tflat,\n\tgetValue,\n\tgroupBy,\n\tisArray,\n\tisFunction,\n\tisIterable,\n\tisObject,\n\tkeys,\n\tnothing,\n\tqueueMicrotask,\n\tremoveFromArray,\n\tresolved,\n\tSymbol,\n\tweakStore,\n\twithResolvers,\n\twithState,\n\twithWeakCache,\n} from './std.js'\n\nconst CLEAN = 0\nconst STALE = 1\nconst CHECK = 2\n\nlet Owner\nlet Listener\n\nlet Updates = null\nlet Effects = null\n\nlet Time = 0\n\n// ROOT\n\nclass Root {\n\towner\n\towned\n\n\tcleanups\n\n\tcontext\n\n\tconstructor(owner, options) {\n\t\tthis.owner = owner\n\t\tthis.context = owner?.context\n\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t}\n\t}\n\n\tdispose() {\n\t\tlet i\n\n\t\tconst { owned, cleanups } = this\n\n\t\tif (owned) {\n\t\t\tfor (i = owned.length - 1; i >= 0; i--) {\n\t\t\t\towned[i].dispose()\n\t\t\t}\n\t\t\towned.length = 0\n\t\t}\n\t\tif (cleanups) {\n\t\t\tfor (i = cleanups.length - 1; i >= 0; i--) {\n\t\t\t\tcleanups[i]()\n\t\t\t}\n\t\t\tcleanups.length = 0\n\t\t}\n\t}\n}\n\n// COMPUTATION\n\nclass Computation extends Root {\n\tstate = STALE\n\n\tupdatedAt = 0\n\n\tfn\n\n\tsources\n\tsourceSlots\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, options)\n\n\t\tthis.fn = fn\n\n\t\tif (owner) {\n\t\t\tif (owner.owned) {\n\t\t\t\towner.owned.push(this)\n\t\t\t} else {\n\t\t\t\towner.owned = [this]\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tthis.fn()\n\t\t} catch (err) {\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\n\t\tif (this.updatedAt <= time) {\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n\n\tdispose() {\n\t\tconst { sources, sourceSlots } = this\n\n\t\tif (sources) {\n\t\t\tlet source\n\t\t\tlet observers\n\t\t\tlet index\n\n\t\t\tlet observer\n\t\t\tlet slot\n\t\t\twhile (sources.length) {\n\t\t\t\tsource = sources.pop()\n\t\t\t\tobservers = source.observers\n\n\t\t\t\tindex = sourceSlots.pop()\n\n\t\t\t\tif (observers && observers.length) {\n\t\t\t\t\tobserver = observers.pop()\n\t\t\t\t\tslot = source.observerSlots.pop()\n\n\t\t\t\t\tif (index < observers.length) {\n\t\t\t\t\t\tobserver.sourceSlots[slot] = index\n\t\t\t\t\t\tobservers[index] = observer\n\t\t\t\t\t\tsource.observerSlots[index] = slot\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.dispose()\n\n\t\tthis.state = CLEAN\n\t}\n}\n\nclass Effect extends Computation {\n\tuser = true\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tEffects ? Effects.push(this) : batch(() => this.update())\n\t}\n}\n\nclass SyncEffect extends Computation {\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tbatch(() => this.update())\n\t}\n}\n\n// SIGNALS\n\nclass Memo extends Computation {\n\tstate = STALE\n\n\tpure = true\n\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\treturn markReactive(this.read.bind(this))\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (this.state) {\n\t\t\tif (this.state === STALE) {\n\t\t\t\tthis.update()\n\t\t\t} else {\n\t\t\t\tconst updates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(this))\n\t\t\t\tUpdates = updates\n\t\t\t}\n\t\t}\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tlet nextValue\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tnextValue = this.fn()\n\t\t} catch (err) {\n\t\t\tthis.state = STALE\n\t\t\tif (this.owned) {\n\t\t\t\tthis.owned.forEach(node => node.dispose())\n\t\t\t\tthis.owned.length = 0\n\t\t\t}\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\t\tif (this.updatedAt <= time) {\n\t\t\tif (this.updatedAt !== 0) {\n\t\t\t\tthis.write(nextValue)\n\t\t\t} else {\n\t\t\t\tthis.value = nextValue\n\t\t\t}\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n}\n\n// SIGNAL\n\nclass Signal {\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\t// save\n\n\t// `prev` if option save was given\n\n\tconstructor(value, options) {\n\t\tthis.value = value\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = value\n\t\t\t}\n\t\t}\n\n\t\tthis.read = markReactive(this.read.bind(this))\n\n\t\tthis.write = this.write.bind(this)\n\t\tthis.update = this.update.bind(this)\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = this.value\n\t\t\t}\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tupdate(value) {\n\t\tif (isFunction(value)) {\n\t\t\tvalue = value(this.value)\n\t\t}\n\t\treturn this.write(value)\n\t}\n\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.read\n\t\tyield this.write\n\t\tyield this.update\n\t}\n}\n\n// API\n\n/**\n * Creates a new root\n *\n * @param {(dispose: Function) => any} fn\n * @param {object} [options]\n * @returns {any}\n */\nexport function root(fn, options = undefined) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tconst root = new Root(Owner, options)\n\n\tOwner = root\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(() => fn(root.dispose.bind(root)), true)\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Creates a signal\n *\n * @template const T\n * @param {T} [initialValue] - Initial value of the signal\n * @param {SignalOptions} [options] - Signal options\n * @returns {SignalObject}\n */\n/* #__NO_SIDE_EFFECTS__ */\nexport function signal(initialValue, options = undefined) {\n\treturn new Signal(initialValue, options)\n}\n\n/**\n * Creates an effect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function effect(fn, options = undefined) {\n\tnew Effect(Owner, fn, options)\n}\n\n/**\n * Creates an effect with explicit dependencies\n *\n * @param {Function} depend - Function that causes tracking\n * @param {Function} fn - Function that wont cause tracking\n * @param {object} [options]\n */\nexport function on(depend, fn, options = undefined) {\n\teffect(() => {\n\t\tdepend()\n\t\tuntrack(fn)\n\t}, options)\n}\n\n/**\n * Creates a syncEffect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function syncEffect(fn, options = undefined) {\n\treturn new SyncEffect(Owner, fn, options)\n}\n\n/**\n * Creates a read-only signal from the return value of a function that\n * automatically updates\n *\n * @template T\n * @param {() => T} fn - Function to re-run when dependencies change\n * @param {SignalOptions} [options]\n * @returns {SignalAccessor} - Read only signal\n */\n\n/* #__NO_SIDE_EFFECTS__ */ export function memo(\n\tfn,\n\toptions = undefined,\n) {\n\treturn new Memo(Owner, fn, options)\n}\n\n/**\n * Batches changes to signals\n *\n * @param {Function} fn\n * @returns {any}\n */\nexport const batch = runUpdates\n\n/**\n * Returns current owner\n *\n * @returns {typeof Owner}\n */\nexport function owner() {\n\treturn Owner\n}\n\nfunction runWithOwner(owner, fn) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tOwner = owner\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(fn, true)\n\t} catch (err) {\n\t\tthrow err\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Disables tracking for a function\n *\n * @param {Function} fn - Function to run with tracking disabled\n * @returns {any}\n */\nexport function untrack(fn) {\n\tif (Listener === undefined) {\n\t\treturn fn()\n\t}\n\n\tconst prevListener = Listener\n\tListener = undefined\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Runs a callback on cleanup, returns callback\n *\n * @template T\n * @param {T} fn\n * @returns {T}\n */\nexport function cleanup(fn) {\n\tif (Owner) {\n\t\tif (Owner.cleanups) {\n\t\t\tOwner.cleanups.push(fn)\n\t\t} else {\n\t\t\tOwner.cleanups = [fn]\n\t\t}\n\t}\n\treturn fn\n}\n\n// UPDATES\n\nfunction runTop(node) {\n\tswitch (node.state) {\n\t\tcase CLEAN: {\n\t\t\treturn\n\t\t}\n\t\tcase CHECK: {\n\t\t\treturn upstream(node)\n\t\t}\n\t}\n\n\tconst ancestors = []\n\n\tdo {\n\t\tif (node.state) {\n\t\t\tancestors.push(node)\n\t\t}\n\t\tnode = node.owner\n\t} while (node && node.updatedAt < Time)\n\n\tfor (let i = ancestors.length - 1, updates; i >= 0; i--) {\n\t\tnode = ancestors[i]\n\n\t\tswitch (node.state) {\n\t\t\tcase STALE: {\n\t\t\t\tnode.update()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase CHECK: {\n\t\t\t\tupdates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(node, ancestors[0]))\n\t\t\t\tUpdates = updates\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction runUpdates(fn, init = false) {\n\tif (Updates) {\n\t\treturn fn()\n\t}\n\n\tlet wait = false\n\n\tif (!init) {\n\t\tUpdates = []\n\t}\n\n\tif (Effects) {\n\t\twait = true\n\t} else {\n\t\tEffects = []\n\t}\n\n\tTime++\n\n\ttry {\n\t\tconst res = fn()\n\n\t\tif (Updates) {\n\t\t\trunQueue(Updates)\n\t\t\tUpdates = null\n\t\t}\n\t\tif (!wait) {\n\t\t\tconst effects = Effects\n\t\t\tEffects = null\n\t\t\tif (effects.length) {\n\t\t\t\trunUpdates(() => runEffects(effects))\n\t\t\t}\n\t\t}\n\n\t\treturn res\n\t} catch (err) {\n\t\tif (!wait) {\n\t\t\tEffects = null\n\t\t}\n\t\tUpdates = null\n\n\t\tthrow err\n\t}\n}\n\nfunction runQueue(queue) {\n\tfor (let i = 0; i < queue.length; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction runEffects(queue) {\n\tlet i\n\n\tlet effect\n\tlet userLength = 0\n\tfor (i = 0; i < queue.length; i++) {\n\t\teffect = queue[i]\n\n\t\tif (!effect.user) {\n\t\t\trunTop(effect)\n\t\t} else {\n\t\t\tqueue[userLength++] = effect\n\t\t}\n\t}\n\n\tfor (i = 0; i < userLength; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction upstream(node, ignore) {\n\tnode.state = CLEAN\n\n\tfor (let i = 0, source; i < node.sources.length; i++) {\n\t\tsource = node.sources[i]\n\n\t\tif (source.sources) {\n\t\t\tswitch (source.state) {\n\t\t\t\tcase STALE: {\n\t\t\t\t\tif (source !== ignore && source.updatedAt < Time) {\n\t\t\t\t\t\trunTop(source)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase CHECK: {\n\t\t\t\t\tupstream(source, ignore)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction downstream(node) {\n\tfor (let i = 0, observer; i < node.observers.length; i++) {\n\t\tobserver = node.observers[i]\n\n\t\tif (observer.state === CLEAN) {\n\t\t\tobserver.state = CHECK\n\t\t\tif (observer.pure) {\n\t\t\t\tUpdates.push(observer)\n\t\t\t} else {\n\t\t\t\tEffects.push(observer)\n\t\t\t}\n\t\t\tobserver.observers && downstream(observer)\n\t\t}\n\t}\n}\n\nlet readForbid = false\n\nfunction checkReadForbidden() {\n\tif (readForbid) {\n\t\tconsole.trace('Signal Read!')\n\t}\n}\nexport function readForbidden(fn, value) {\n\tconst prev = readForbid\n\ttry {\n\t\treadForbid = value\n\t\treturn fn()\n\t} finally {\n\t\treadForbid = prev\n\t}\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {typeof Context} Context\n */\nexport function Context(defaultValue = undefined) {\n\tconst id = Symbol()\n\n\treturn useContext.bind(null, id, defaultValue)\n}\n\n/**\n * @overload Gets the context value\n * @returns {any} Context value\n */\n/**\n * @overload Runs `fn` with a new value as context\n * @param {any} newValue - New value for the context\n * @param {Function} fn - Callback to run with the new context value\n * @returns {Children} Children\n */\n/**\n * @param {any} newValue\n * @param {Function} fn\n */\nfunction useContext(id, defaultValue, newValue, fn) {\n\tif (newValue === undefined) {\n\t\treturn Owner?.context && Owner.context[id] !== undefined\n\t\t\t? Owner.context[id]\n\t\t\t: defaultValue\n\t} else {\n\t\tlet res\n\n\t\tsyncEffect(() => {\n\t\t\tOwner.context = {\n\t\t\t\t...Owner.context,\n\t\t\t\t[id]: newValue,\n\t\t\t}\n\t\t\tres = untrack(fn)\n\t\t})\n\n\t\treturn res\n\t}\n}\n\n/**\n * Returns an owned function\n *\n * @param {function | undefined} cb\n * @returns {() => any}\n */\nexport const owned = cb => {\n\tconst o = Owner\n\treturn (...args) => cb && runWithOwner(o, () => cb(...args))\n}\n\n/**\n * Returns true when value is reactive (a signal)\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isReactive = value =>\n\tisFunction(value) && $isReactive in value\n\n/**\n * Marks a function as reactive. Reactive functions are ran inside\n * effects.\n *\n * @param {Function} fn - Function to mark as reactive\n * @returns {Function}\n */\nexport function markReactive(fn) {\n\tfn[$isReactive] = undefined\n\treturn fn\n}\n\n/**\n * Proxies a signals property access so you dont have to call the\n * function\n *\n * @param {Signal} snigal - Signal to proxy\n * @param {object} [target] - Target object for the proxy\n * @returns {object} An object that will read the properties from the\n * signal\n */\nexport const proxy = (snigal, target = nothing) =>\n\tnew Proxy(target, {\n\t\tget(target, key) {\n\t\t\treturn snigal()[key]\n\t\t},\n\t\thas(target, key) {\n\t\t\treturn key in snigal()\n\t\t},\n\t\townKeys(target) {\n\t\t\treturn keys(snigal())\n\t\t},\n\t})\n\n/**\n * A self contained signal function, when an argument is present it\n * writes to the signal, when theres no argument it reads the signal.\n *\n * @template T\n * @param {T} [value] - Optional initial value\n * @returns {SignalFunction}\n */\nexport function signalFunction(value) {\n\tconst [read, write] = signal(value)\n\treturn markReactive((...args) =>\n\t\targs.length ? write(args[0]) : read(),\n\t)\n}\n\n/**\n * To set and read refs. To use in ref attribute.\n *\n * @template T\n * @returns {SignalFunction}\n */\nexport const ref = () => signalFunction()\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport const withValue = (value, fn) =>\n\tisFunction(value) ? effect(() => fn(getValue(value))) : fn(value)\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport function withPrevValue(value, fn) {\n\tif (isFunction(value)) {\n\t\tlet prev = undefined\n\t\teffect(() => {\n\t\t\tconst val = getValue(value)\n\t\t\tfn(val, prev)\n\t\t\tprev = val\n\t\t})\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Lazy and writable version of `memo`, its writable and will run the\n * function only when used\n *\n * @author ryansolid\n * @param {Function} fn - Function to re-run when dependencies change\n * @returns {((...args) => any) | (() => any)}\n */\nexport function writable(fn) {\n\tconst result = memo(() => signal(fn()))\n\n\treturn markReactive((...args) => {\n\t\treturn args.length ? result().write(args[0]) : result().read()\n\t})\n}\n\n/**\n * Creates an asynchronously effect\n *\n * @param {(currentRunningEffect: Promise) => any} fn - A\n * function that receives a `currentRunningEffect` that should be\n * awaited for when wanting to run effects synchronously, that's it\n * one effect after another.\n */\nexport function asyncEffect(fn) {\n\tconst queue = []\n\teffect(() => {\n\t\tconst { promise, resolve } = withResolvers()\n\n\t\tqueue.push(promise)\n\n\t\tfunction onDone() {\n\t\t\tremoveFromArray(queue, promise)\n\t\t\tresolve()\n\t\t}\n\n\t\tresolved(\n\t\t\tfn(queue.length === 1 ? undefined : queue[queue.length - 2]),\n\t\t\tonDone,\n\t\t)\n\t})\n}\n\n/**\n * A Promise loader handler. Allows to display/run something or\n * nothing while a promise is resolving. Allows to run a callback when\n * the promise resolves. Allows to get notified of errors, and\n * display/run something or nothing, if wanted a `retry` function is\n * given for retrying the promise. All functions run with the original\n * owner, so it's `Context` friendly.\n *\n * @param {(() => Promise) | Promise} fn - Function that\n * returns a promise\n * @param {{\n * \tonLoading?: any\n * \tonLoaded?: Function\n * \tonError?: ((e: Error, retry: Function) => any) | any\n * }} [options]\n *\n * @returns {Component}\n * @url https://pota.quack.uy/lazy\n */\nexport const lazy = (fn, options = nothing) =>\n\tmarkComponent(props => {\n\t\tconst { onLoading, onLoaded, onError } = options\n\n\t\tconst [value, setValue] = signal(onLoading)\n\n\t\tconst _onLoaded = owned(onLoaded)\n\n\t\tconst retry = () =>\n\t\t\tPromise.resolve(isFunction(fn) ? fn() : fn)\n\t\t\t\t.then(r => {\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tmarkComponent(() => {\n\t\t\t\t\t\t\tr = isObject(r) && r.default ? r.default : r\n\t\t\t\t\t\t\treturn isFunction(r) ? r(props) : r\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\tmicrotask(_onLoaded)\n\t\t\t\t})\n\t\t\t\t.catch(e =>\n\t\t\t\t\tonError\n\t\t\t\t\t\t? setValue(\n\t\t\t\t\t\t\t\tmarkComponent(() =>\n\t\t\t\t\t\t\t\t\tisFunction(onError) ? onError(e, retry) : onError,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: console.error(e),\n\t\t\t\t)\n\t\tretry()\n\n\t\treturn value\n\t})\n\nexport const Lazy = props => lazy(props.children, props)\n\nexport const microtask = fn => queueMicrotask(owned(fn))\n\n// MAP\n\n/**\n * Reactive Map\n *\n * @template T\n * @param {Each} list\n * @param {Function} callback\n * @param {boolean} [sort]\n */\nexport function map(list, callback, sort) {\n\tconst cache = new Map()\n\tconst duplicates = new Map() // for when caching by value is not possible [1, 2, 1, 1, 1]\n\n\tlet runId = 0\n\n\tlet rows = []\n\t/** @type any[] */\n\tlet prev = []\n\n\tfunction clear() {\n\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\tprev[i].dispose(true)\n\t\t}\n\t\tcache.clear()\n\t\tduplicates.clear()\n\n\t\trows.length = 0\n\t\tprev.length = 0\n\t}\n\n\t// to get rid of all nodes when parent disposes\n\tcleanup(clear)\n\n\tclass Row {\n\t\tconstructor(item, index, fn, isDupe) {\n\t\t\tthis.runId = -1\n\t\t\tthis.item = item\n\t\t\tthis.index = index\n\t\t\tthis.isDupe = isDupe\n\t\t\tthis.disposer = undefined\n\t\t\tthis.nodes = root(disposer => {\n\t\t\t\tthis.disposer = disposer\n\t\t\t\t/** @type Children[] */\n\t\t\t\treturn fn(item, index)\n\t\t\t})\n\t\t}\n\t\tget begin() {\n\t\t\treturn this.nodes[0]\n\t\t}\n\t\tget end() {\n\t\t\treturn this.nodes[this.nodes.length - 1]\n\t\t}\n\t\tdispose(all) {\n\t\t\t// skip cache deletion as we are going to clear the full map\n\t\t\tif (all === undefined) {\n\t\t\t\t// delete from cache\n\t\t\t\tif (!this.isDupe) {\n\t\t\t\t\tcache.delete(this.item)\n\t\t\t\t} else {\n\t\t\t\t\tconst arr = duplicates.get(this.item)\n\t\t\t\t\tarr.length === 1\n\t\t\t\t\t\t? duplicates.delete(this.item)\n\t\t\t\t\t\t: removeFromArray(arr, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.disposer()\n\t\t}\n\t}\n\n\t/**\n\t * @param {Function} fn\n\t * @returns {Children}\n\t */\n\tfunction mapper(fn) {\n\t\tconst cb = fn\n\t\t\t? (item, index) => fn(callback(item, index), index)\n\t\t\t: callback\n\n\t\tconst value = getValue(list) || []\n\n\t\t/** To allow iterate objects as if were an array with indexes */\n\t\tconst items = isIterable(value) ? value.entries() : entries(value)\n\n\t\trunId++\n\t\trows = []\n\t\tconst hasPrev = prev.length\n\n\t\tfor (const [index, item] of items) {\n\t\t\tlet row = hasPrev ? cache.get(item) : undefined\n\n\t\t\t// if the item doesnt exists, create it\n\t\t\tif (row === undefined) {\n\t\t\t\trow = new Row(item, index, cb, false)\n\t\t\t\tcache.set(item, row)\n\t\t\t} else if (row.runId === runId) {\n\t\t\t\t// a map will save only 1 of any primitive duplicates, say: [1, 1, 1, 1]\n\t\t\t\t// if the saved value was already used on this run, create a new one\n\t\t\t\tlet dupes = duplicates.get(item)\n\t\t\t\tif (!dupes) {\n\t\t\t\t\tdupes = []\n\t\t\t\t\tduplicates.set(item, dupes)\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < dupes.length; i++) {\n\t\t\t\t\tif (dupes[i].runId !== runId) {\n\t\t\t\t\t\trow = dupes[i]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (row.runId === runId) {\n\t\t\t\t\trow = new Row(item, index, cb, true)\n\t\t\t\t\tdupes.push(row)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trow.runId = runId // mark used on this run\n\t\t\trow.index = index // save sort order\n\t\t\trows.push(row)\n\t\t}\n\n\t\t// remove rows that arent present on the current run\n\t\tif (rows.length === 0) {\n\t\t\tclear()\n\t\t} else {\n\t\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\t\tif (prev[i].runId !== runId) {\n\t\t\t\t\tprev[i].dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// reorder elements\n\t\t// `rows.length > 1` because no need for sorting when there are no items\n\t\t// prev.length > 0 to skip sorting on creation as its already sorted\n\t\tif (sort && rows.length > 1 && prev.length) {\n\t\t\t// if the planets align it handles swapping\n\t\t\t// a = sorted\n\t\t\t// b = unsorted\n\t\t\tconst { a, b } = groupBy(rows, (value, index) =>\n\t\t\t\trows[index] === prev[index] ? 'a' : 'b',\n\t\t\t)\n\n\t\t\tlet unsorted = b?.length\n\t\t\tif (\n\t\t\t\ta &&\n\t\t\t\tb &&\n\t\t\t\ta.length &&\n\t\t\t\tb.length &&\n\t\t\t\tb.length < a.length &&\n\t\t\t\tb.every(item => prev.includes(item))\n\t\t\t) {\n\t\t\t\tfor (const usort of b) {\n\t\t\t\t\tfor (const sort of a) {\n\t\t\t\t\t\tif (usort.index === sort.index - 1) {\n\t\t\t\t\t\t\tsort.begin.before(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if (usort.index === sort.index + 1) {\n\t\t\t\t\t\t\tsort.end.after(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unsorted) {\n\t\t\t\t// handles all other cases\n\t\t\t\t// best for any combination of: push/pop/shift/unshift/insertion/deletion\n\t\t\t\t// must check in reverse as on creation stuff is added to the end\n\n\t\t\t\tlet current = rows[rows.length - 1]\n\t\t\t\tfor (let i = rows.length - 1; i > 0; i--) {\n\t\t\t\t\tconst previous = rows[i - 1]\n\t\t\t\t\tif (current.begin.previousSibling !== previous.end) {\n\t\t\t\t\t\tcurrent.begin.before(...nodesFromRow(previous))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = previous\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// save sorted list\n\t\tprev = rows\n\n\t\t// return external representation\n\t\treturn rows.map(item => item.nodes)\n\t}\n\tmapper[$isMap] = undefined\n\treturn mapper\n}\n\nfunction nodesFromRow(row) {\n\tconst { begin, end } = row\n\tconst nodes = [begin]\n\n\tlet nextSibling = begin\n\twhile (nextSibling !== end) {\n\t\tnextSibling = nextSibling.nextSibling\n\t\tnodes.push(nextSibling)\n\t}\n\n\treturn nodes\n}\n\n/**\n * Resolves and returns `children` in a memo\n *\n * @param {Function | Children} fn\n * @returns {Function} Memo\n * @url https://pota.quack.uy/resolve\n */\nexport function resolve(fn) {\n\tconst children = isFunction(fn) ? memo(fn) : () => fn\n\treturn memo(() => unwrap(children()))\n}\n\n/**\n * Recursively unwrap children functions\n *\n * @param {Children} children\n * @returns {Children}\n */\nfunction unwrap(children) {\n\tif (isFunction(children)) {\n\t\treturn unwrap(children())\n\t}\n\n\tif (isArray(children)) {\n\t\tconst childrens = []\n\t\tfor (let child of children) {\n\t\t\tchild = unwrap(child)\n\t\t\tisArray(child)\n\t\t\t\t? childrens.push(...child)\n\t\t\t\t: childrens.push(child)\n\t\t}\n\t\treturn childrens\n\t}\n\n\treturn children\n}\n\n/**\n * Extend `Pota` and define a `render(props){}` method to create a\n * class component. `ready(cb)` and `cleanup(cb)` methods will be\n * registered automatically\n *\n * @url https://pota.quack.uy/Classes\n */\nexport class Pota {}\n\nPota[$isClass] = undefined\n\n/**\n * Returns true if the `value` is a `Component`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponent = value =>\n\tisFunction(value) && $isComponent in value\n\n/**\n * Returns true if the value can be made a Component\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponentable = value =>\n\t!isReactive(value) &&\n\t(isFunction(value) ||\n\t\t// avoid [1,2] and support { toString(){ return \"something\"} }\n\t\t(!isArray(value) && isObject(value) && !value.then))\n\n/**\n * Makes of `children` a function. Reactive children will run as is,\n * non-reactive children will run untracked, regular children will\n * just return.\n *\n * @param {Children} children\n * @returns {Function}\n */\nexport function makeCallback(children) {\n\t/**\n\t * When children is an array, as in >${[0, 1, 2]}< then children\n\t * will end as `[[0, 1, 2]]`, so flat it\n\t */\n\n\tchildren = isArray(children) ? flat(children) : children\n\n\tconst callbacks = !isArray(children)\n\t\t? callback(children)\n\t\t: children.map(callback)\n\n\treturn !isArray(children)\n\t\t? markComponent((...args) => callbacks(args))\n\t\t: markComponent((...args) =>\n\t\t\t\tcallbacks.map(callback => callback(args)),\n\t\t\t)\n}\n\nconst callback = child =>\n\tisFunction(child)\n\t\t? isReactive(child)\n\t\t\t? args => {\n\t\t\t\t\t/**\n\t\t\t\t\t * The function inside the `for` is saved in a signal. The\n\t\t\t\t\t * result of the signal is our callback\n\t\t\t\t\t *\n\t\t\t\t\t * ```js\n\t\t\t\t\t * htmlEffect(\n\t\t\t\t\t * \thtml =>\n\t\t\t\t\t * \t\thtml`\n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\tname \n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\t${item =>\n\t\t\t\t\t * \t\t\t\t\thtml`\n\t\t\t\t\t * \t\t\t\t\t\t${item.name} \n\t\t\t\t\t * \t\t\t\t\t `}\n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t
`,\n\t\t\t\t\t * )\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\tconst r = child()\n\t\t\t\t\treturn isFunction(r)\n\t\t\t\t\t\t? isReactive(r)\n\t\t\t\t\t\t\t? r()\n\t\t\t\t\t\t\t: untrack(() => r(...args))\n\t\t\t\t\t\t: r\n\t\t\t\t}\n\t\t\t: args => untrack(() => child(...args))\n\t\t: () => child\n\n// allows to tell a `signal function` from a `component function`\n// signals and user functions go in effects, for reactivity\n// components and callbacks are untracked and wont go in effects to avoid re-rendering\n\n/**\n * Marks a function as a `Component`.\n *\n * @param {Function} fn - Function to mark as a `Component`\n * @returns {Component}\n */\nexport function markComponent(fn) {\n\tfn[$isComponent] = undefined\n\treturn fn\n}\n\n/**\n * Unwraps components till it gets a value. To keep context relevant\n * to the component\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValueComponent(value) {\n\twhile ($isComponent in value) value = value()\n\treturn value\n}\n\n/**\n * Adds an event listener to a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `off` function for removing the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function addEventListener(node, type, handler) {\n\tnode.addEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\t/**\n\t * Removes event on tracking scope disposal.\n\t *\n\t * Situation: the event was added to the `document` manually using\n\t * `addEventListener`, say to listen for clicks as a \"click\n\t * outside\". The event needs to be removed when the component that\n\t * added it is disposed.\n\t */\n\n\treturn cleanup(() => removeEventListener(node, type, handler))\n}\n\n/**\n * Removes an event listener from a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `on` function for adding back the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function removeEventListener(node, type, handler) {\n\tnode.removeEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\treturn () => addEventListener(node, type, handler)\n}\n\n/**\n * It gives a handler an owner, so stuff runs batched on it, and\n * things like context and cleanup work\n */\nexport const ownedEvent = handler =>\n\t'handleEvent' in handler\n\t\t? {\n\t\t\t\t...handler,\n\t\t\t\thandleEvent: owned(e => handler.handleEvent(e)),\n\t\t\t}\n\t\t: owned(handler)\n","import { owned } from './lib/reactive.js'\nimport { call, queueMicrotask } from './lib/std.js'\n\n/**\n * The purpose of this file is to guarantee the timing of some\n * callbacks. It queues a microtask, then the callbacks are added to a\n * position in the array. These are run with a priority.\n */\n\n/** @type boolean */\nlet added\n\n/** @type [][] */\nlet queue\n\nfunction reset() {\n\tqueue = [[], [], [], [], [], []]\n\tadded = false\n}\n\n// initialization\nreset()\n\n/**\n * Queues a callback at a priority\n *\n * @param {PropertyKey} priority - Priority\n * @param {Function} fn - Function to run once the callbacks at this\n * priority run\n */\nfunction add(priority, fn) {\n\tif (!added) {\n\t\tadded = true\n\t\tqueueMicrotask(run)\n\t}\n\tqueue[priority].push(owned(fn))\n}\n\n/** Runs all queued callbacks */\nfunction run() {\n\tconst q = queue\n\treset()\n\n\tfor (const fns of q) {\n\t\tfns.length && call(fns)\n\t}\n}\n\n/**\n * Queue a function to run before everything else (onProps, onRef,\n * onMount, ready) ex focus restoration\n *\n * @param {Function} fn\n */\nexport const onFixes = fn => add(0, fn)\n\n/**\n * Queue a function to run before (onRef, onMount, ready) ex running\n * user functions on elements via plugins\n *\n * @param {Function} fn\n */\nexport const onProps = fn => add(1, fn)\n\n/**\n * Queue a function to run onRef (before onMount, after onProps)\n *\n * @param {Function} fn\n */\nexport const onRef = fn => add(2, fn)\n\n/**\n * Queue a function to run onMount (before ready, after onRef)\n *\n * @param {Function} fn\n */\nexport const onMount = fn => add(3, fn)\n\n/**\n * Queue a function to run on ready (after onMount)\n *\n * @param {Function} fn\n * @url https://pota.quack.uy/ready\n */\nexport const ready = fn => add(4, fn)\n\n/**\n * Queue a function to run after all user defined processes\n *\n * @param {Function} fn\n */\nexport const onDone = fn => add(5, fn)\n","import { addEventListener } from '../lib/reactive.js'\nimport { window, withCache } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {EventListenerOrEventListenerObject} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setEventNS = (node, name, value, props, localName, ns) =>\n\taddEventListener(node, localName, value)\n\n/**\n * Returns an event name when the string could be mapped to an event\n *\n * @param {string} name - String to check for a mapped event\n * @returns {string | undefined} Returns the event name or null in\n * case isnt found\n */\nexport const eventName = withCache(name =>\n\tname.startsWith('on') && name.toLowerCase() in window\n\t\t? name.slice(2).toLowerCase()\n\t\t: null,\n)\n/*\nconst eventNames = new Set(\n\tkeys(global).filter(prop => prop.startsWith('on')),\n)\n*/\n","import { cacheStore } from '../lib/std.js'\nimport { onProps } from '../scheduler.js'\n\nexport const plugins = cacheStore()\nexport const pluginsNS = cacheStore()\n\n/**\n * Defines a prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - To avoid the problem of\n * needed props not being set, or children elements not created yet.\n * Default is `true`\n * @url https://pota.quack.uy/props/propsPlugin\n */\nexport const propsPlugin = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n}\n\n/**\n * Defines a namespaced prop that can be used on any Element\n *\n * @param {string} NSName - Name of the namespace\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * \tlocalName: string,\n * \tns: string,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginNS = (NSName, fn, onMicrotask) => {\n\tplugin(pluginsNS, NSName, fn, onMicrotask)\n}\n\n/**\n * Defines prop and namespaced prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop/namespace\n * @param {Function} fn - Function to run when this prop is found on\n * any Element\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginBoth = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n\tplugin(pluginsNS, propName, fn, onMicrotask)\n}\n\nconst plugin = (plugins, name, fn, onMicrotask = true) => {\n\tplugins.set(\n\t\tname,\n\t\t!onMicrotask ? fn : (...args) => onProps(() => fn(...args)),\n\t)\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\nimport { NS } from '../constants.js'\n\n// NODE ATTRIBUTES\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setAttributeNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setAttribute(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n * @url https://pota.quack.uy/props/setAttribute\n */\nexport const setAttribute = (node, name, value, ns) =>\n\twithValue(value, value => _setAttribute(node, name, value, ns))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {string} [ns]\n */\nfunction _setAttribute(node, name, value, ns) {\n\t// if the value is null or undefined it will be removed\n\tif (isNullUndefined(value)) {\n\t\tns && NS[ns]\n\t\t\t? node.removeAttributeNS(NS[ns], name)\n\t\t\t: node.removeAttribute(name)\n\t} else {\n\t\tns && NS[ns]\n\t\t\t? node.setAttributeNS(NS[ns], name, value)\n\t\t\t: node.setAttribute(name, value)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setPropertyNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setProperty(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setProperty\n */\nexport const setProperty = (node, name, value) =>\n\twithValue(value, value => _setProperty(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nfunction _setProperty(node, name, value) {\n\t// if the value is null or undefined it will be set to null\n\tif (isNullUndefined(value)) {\n\t\t// defaulting to undefined breaks `progress` tag and the whole page\n\t\tnode[name] = null\n\t} else {\n\t\tnode[name] = value\n\t}\n}\n","// NODE UNKNOWN PROPERTIES / ATTRIBUTES\n\nimport { setAttribute } from './attribute.js'\nimport { setProperty } from './property.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const setUnknown = (node, name, value, ns) => {\n\tname in node && !(node instanceof SVGElement)\n\t\t? setProperty(node, name, value)\n\t\t: setAttribute(node, name, value, ns)\n}\n","// BOOL ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setBoolNS = (node, name, value, props, localName, ns) =>\n\tsetBool(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setBool\n */\nexport const setBool = (node, name, value) =>\n\twithValue(value, value => _setBool(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const _setBool = (node, name, value) =>\n\t// if the value is falsy gets removed\n\t!value ? node.removeAttribute(name) : node.setAttribute(name, '')\n","// node style\n\nimport { withValue } from '../lib/reactive.js'\nimport { getValue, isNullUndefined, isObject } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @url https://pota.quack.uy/props/setStyle\n */\nexport const setStyle = (node, name, value, props) =>\n\tsetNodeStyle(node.style, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setStyleNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(\n\t\tnode.style,\n\t\tisObject(value) ? value : { [localName]: value },\n\t)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setVarNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(node.style, { ['--' + localName]: value })\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {unknown} value\n */\nfunction setNodeStyle(style, value) {\n\tif (isObject(value)) {\n\t\tlet name\n\t\tfor (name in value) {\n\t\t\tsetStyleValue(style, name, value[name])\n\t\t}\n\t\treturn\n\t}\n\tconst type = typeof value\n\tif (type === 'string') {\n\t\tstyle.cssText = value\n\t\treturn\n\t}\n\tif (type === 'function') {\n\t\twithValue(value, value => setNodeStyle(style, getValue(value)))\n\t\treturn\n\t}\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementStyle = (node, name, value) =>\n\tsetStyleValue(node.style, name, value)\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {unknown} value\n */\nconst setStyleValue = (style, name, value) =>\n\twithValue(value, value => _setStyleValue(style, name, value))\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {string | null} value\n */\nconst _setStyleValue = (style, name, value) =>\n\t// if the value is null or undefined it will be removed\n\tisNullUndefined(value)\n\t\t? style.removeProperty(name)\n\t\t: style.setProperty(name, value)\n","// node class / classList\n\nimport { withPrevValue, withValue } from '../lib/reactive.js'\nimport {\n\tclassListAdd,\n\tclassListRemove,\n\tisFunction,\n\tisString,\n} from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n */\nexport const setClass = (node, name, value, props) =>\n\tisString(value)\n\t\t? node.setAttribute('class', value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setClassNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) =>\n\tisFunction(value)\n\t\t? setElementClass(node, localName, value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {object | string | ArrayLike} value\n */\nfunction setClassList(node, value) {\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t_setClassListValue(node, value, true)\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'object': {\n\t\t\tlet name\n\t\t\tfor (name in value) {\n\t\t\t\tsetElementClass(node, name, value[name])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'function': {\n\t\t\twithValue(value, value => setClassList(node, value))\n\t\t\tbreak\n\t\t}\n\t}\n}\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementClass = (node, name, value) =>\n\twithPrevValue(value, (value, prev) => {\n\t\t// on initialization do not remove whats not there\n\t\tif (!value && !prev) {\n\t\t} else {\n\t\t\t_setClassListValue(node, name, value)\n\t\t}\n\t})\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\n\nconst _setClassListValue = (node, name, value) =>\n\t// null, undefined or false, the class is removed\n\t!value\n\t\t? classListRemove(node, name)\n\t\t: classListAdd(node, ...name.trim().split(/\\s+/))\n","/** Returns true or false with a `chance` of getting `true` */\nexport const chance = (chance = 50, generator = random) => {\n\treturn generator() < chance / 100\n}\n\n/** Returns random number between 0 and 1 */\nexport const random = () =>\n\tcrypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)\n\nexport const randomBetween = (min, max, generator = random) =>\n\tMath.floor(generator() * (max - min + 1)) + min\n\nexport const randomColor = (min = 0, max = 255) =>\n\t'rgb(' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t')'\n\nexport const randomId = () =>\n\tcrypto.getRandomValues(new BigUint64Array(1))[0].toString(36)\n\n/**\n * Returns a random number generator based no a seed that generates\n * numbers between 0 and 1\n */\nexport function randomSeeded(seed) {\n\tconst m = 2 ** 35 - 31\n\tlet s = seed % m\n\treturn () => (s = (s * 185852) % m) / m\n}\n","import {\n\tadoptedStyleSheetsAdd,\n\tclassListAdd,\n\tgetDocumentForElement,\n\tsheet,\n\twithState,\n} from '../lib/std.js'\n\nimport { randomId } from '../plugin/useRandom.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {object} props\n */\nexport const setCSS = (node, name, value, props) =>\n\tsetNodeCSS(node, value)\n\n/**\n * @param {Element} node\n * @param {string} value\n */\nconst setNodeCSS = withState((state, node, value) => {\n\tclassListAdd(\n\t\tnode,\n\t\tstate.get(value, value => {\n\t\t\tconst id = 'c' + randomId()\n\t\t\tadoptedStyleSheetsAdd(\n\t\t\t\tgetDocumentForElement(node),\n\t\t\t\tsheet(value.replace(/class/g, '.' + id)),\n\t\t\t)\n\t\t\treturn id\n\t\t}),\n\t)\n})\n","import { cleanup } from '../lib/reactive.js'\n\nimport { onMount, onRef } from '../scheduler.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setRef = (node, name, value, props) =>\n\tonRef(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setOnMount = (node, name, value, props) =>\n\tonMount(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setUnmount = (node, name, value, props) =>\n\tcleanup(() => value(node))\n","import {\n\taddEventListener,\n\towned,\n\townedEvent,\n} from '../lib/reactive.js'\nimport { getValue, isObject } from '../lib/std.js'\n\nimport { eventName } from './event.js'\n\nimport {\n\tplugins,\n\tpluginsNS,\n\tpropsPlugin,\n\tpropsPluginBoth,\n\tpropsPluginNS,\n} from './plugin.js'\nimport { setUnknown } from './unknown.js'\n\n// exports\n\nexport { setAttribute } from './attribute.js'\nexport { setBool } from './bool.js'\nexport { setProperty } from './property.js'\nexport { setElementStyle as setStyle } from './style.js'\nexport { setElementClass as setClass } from './class.js'\n\n// PLUGINS NS\n\n// namespaced attributes/properties\n\nimport { setPropertyNS } from './property.js'\npropsPluginNS('prop', setPropertyNS, false)\n\nimport { setAttributeNS } from './attribute.js'\npropsPluginNS('attr', setAttributeNS, false)\n\nimport { setBoolNS } from './bool.js'\npropsPluginNS('bool', setBoolNS, false)\n\n// events\n\nimport { setEventNS } from './event.js'\npropsPluginNS('on', setEventNS, false)\n\n// var\n\nimport { setVarNS } from './style.js'\npropsPluginNS('var', setVarNS, false)\n\n// PLUGINS REGULAR\n\n// forced as properties\n\nimport { setProperty } from './property.js'\nfor (const item of [\n\t'value',\n\t'textContent',\n\t'innerText',\n\t'innerHTML',\n]) {\n\tpropsPlugin(item, setProperty, false)\n}\n\n// noop\n\nimport { noop } from '../lib/std.js'\npropsPlugin('__dev', noop, false)\npropsPlugin('xmlns', noop, false)\n\n// PLUGIN BOTH\n\n// css\n\nimport { setCSS } from './css.js'\npropsPluginBoth('css', setCSS, false)\n\n// mount\n\nimport { setOnMount } from './lifecycle.js'\npropsPluginBoth('onMount', setOnMount, false)\n\n// unmount\n\nimport { setUnmount } from './lifecycle.js'\npropsPluginBoth('onUnmount', setUnmount, false)\n\n// ref\n\nimport { setRef } from './lifecycle.js'\npropsPluginBoth('ref', setRef, false)\n\n// PLUGIN BOTH DIFFERENT\n\n// styles\n\nimport { setStyle, setStyleNS } from './style.js'\npropsPlugin('style', setStyle, false)\npropsPluginNS('style', setStyleNS, false)\n\n// class\n\nimport { setClass, setClassNS } from './class.js'\npropsPlugin('class', setClass, false)\npropsPluginNS('class', setClassNS, false)\n\n// catch all\n\n/**\n * Assigns props to an Element\n *\n * @param {Element} node - Element to which assign props\n * @param {object} props - Props to assign\n */\nexport function assignProps(node, props) {\n\tfor (const name in props) {\n\t\tassignProp(node, name, props[name], props)\n\t}\n}\n\n/**\n * Assigns a prop to an Element\n *\n * @param {Element} node\n * @param {string} name\n * @param {any} value\n * @param {object} props\n */\nexport function assignProp(node, name, value, props) {\n\t// unwrap promises\n\tif (isObject(value) && 'then' in value) {\n\t\tvalue.then(\n\t\t\towned(value => assignProp(node, name, getValue(value), props)),\n\t\t)\n\t\treturn\n\t}\n\n\t// run plugins\n\tlet plugin = plugins.get(name)\n\tif (plugin) {\n\t\tplugin(node, name, value, props)\n\t\treturn\n\t}\n\n\t// onClick={handler}\n\tlet event = eventName(name)\n\tif (event) {\n\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\treturn\n\t}\n\n\tif (name.includes(':')) {\n\t\t// with ns\n\t\tconst [ns, localName] = name.split(':')\n\n\t\t// run plugins NS\n\t\tplugin = pluginsNS.get(ns)\n\t\tif (plugin) {\n\t\t\tplugin(node, name, value, props, localName, ns)\n\t\t\treturn\n\t\t}\n\n\t\t// onClick:my-ns={handler}\n\t\tevent = eventName(ns)\n\t\tif (event) {\n\t\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\t\treturn\n\t\t}\n\n\t\tsetUnknown(node, name, value, ns)\n\t\treturn\n\t}\n\n\t// catch all\n\tsetUnknown(node, name, value)\n}\n","// CONSTANTS\n\nimport { $isClass, $isMap, NS } from './constants.js'\n\n// LIB\n\nimport {\n\tcleanup,\n\tContext,\n\teffect,\n\tisReactive,\n\troot,\n\tsignal,\n\tuntrack,\n} from './lib/reactive.js'\n\nimport {\n\tadoptedStyleSheetsAdd,\n\tadoptedStyleSheetsRemove,\n\tcreateElement,\n\tcreateElementNS,\n\tcreateTextNode,\n\tCSSStyleSheet,\n\tdocument,\n\tDocumentFragment,\n\tflat,\n\tfreeze,\n\tgetDocumentForElement,\n\timportNode,\n\tisArray,\n\tisConnected,\n\titerator,\n\tnothing,\n\tquerySelector,\n\tresolved,\n\tstringify,\n\ttoArray,\n\twalkElements,\n} from './lib/std.js'\n\nimport {\n\tisComponent,\n\tisComponentable,\n\tmarkComponent,\n} from './lib/reactive.js'\n\nimport { onFixes, ready } from './scheduler.js'\n\n// PROPERTIES / ATTRIBUTES\n\nimport { assignProps } from './props/@main.js'\nimport { propsPlugin } from './props/plugin.js'\n\n// STATE\n\nconst useXMLNS = context()\n\n// COMPONENTS\n\n/**\n * Used by the regular JSX transform, as `<>...>` or\n * `... `.\n */\nexport const Fragment = props => props.children\n\n/**\n * Creates components for things. When props argument is given, the\n * props become fixed. When props argument is ommited, it allows you\n * to keep calling the returned function with new props. Returns a\n * function because we need to render from parent to children instead\n * of from children to parent. This allows to properly set the\n * reactivity tree (think of nested effects that clear inner effects,\n * context, etc).\n *\n * @param {string | Function | Element | object | symbol} value -\n * Component\n * @param {any} [props] Object\n * @url https://pota.quack.uy/Component\n */\n\nexport function Component(value, props) {\n\tif (value === Fragment) {\n\t\treturn props.children\n\t}\n\n\t/** Freeze props so isnt directly writable */\n\tfreeze(props)\n\n\t/** Create a callable function to pass `props` */\n\tconst component = Factory(value)\n\n\treturn props === undefined\n\t\t? component\n\t\t: markComponent(propsOverride =>\n\t\t\t\tcomponent(\n\t\t\t\t\tpropsOverride\n\t\t\t\t\t\t? freeze({ ...props, ...propsOverride })\n\t\t\t\t\t\t: props,\n\t\t\t\t),\n\t\t\t)\n}\n\n/**\n * Creates a component that could be called with a props object\n *\n * @template T\n * @param {any} value\n * @returns {Component}\n */\n\nfunction Factory(value) {\n\tif (isComponent(value)) {\n\t\treturn value\n\t}\n\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t// string component, 'div' becomes \n\t\t\treturn markComponent(props => createTag(value, props))\n\t\t}\n\t\tcase 'function': {\n\t\t\tif ($isClass in value) {\n\t\t\t\t// class component
\n\t\t\t\treturn markComponent(props => createClass(value, props))\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * ```js\n\t\t\t * const [Count, setCount] = signal(1)\n\t\t\t * return
\n\t\t\t * ```\n\t\t\t */\n\t\t\tif (isReactive(value)) {\n\t\t\t\treturn markComponent(() => createAnything(value))\n\t\t\t}\n\n\t\t\t// function component
\n\t\t\t// value = value\n\t\t\treturn markComponent(value)\n\t\t}\n\t\tdefault: {\n\t\t\tif (value instanceof Node) {\n\t\t\t\t// node component
\n\t\t\t\treturn markComponent(props => createNode(value, props))\n\t\t\t}\n\n\t\t\treturn markComponent(() => createAnything(value))\n\t\t}\n\t}\n}\n\nexport function createComponent(value) {\n\tconst component = Factory(value)\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() => component(props))\n\t}\n}\n\nfunction createClass(value, props) {\n\tconst i = new value()\n\ti.ready && ready(() => i.ready())\n\ti.cleanup && cleanup(() => i.cleanup())\n\n\treturn i.render(props)\n}\n\nfunction createAnything(value) {\n\treturn value\n}\n\n/**\n * Creates a x/html element from a tagName\n *\n * @template P\n * @param {TagNames} tagName\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createTag(tagName, props) {\n\t/**\n\t * Namespace, use props xmlns or special case svg, math, etc in case\n\t * of missing xmlns attribute\n\t */\n\tconst xmlns = props?.xmlns || NS[tagName]\n\n\treturn withXMLNS(\n\t\txmlns,\n\t\txmlns =>\n\t\t\tcreateNode(\n\t\t\t\txmlns\n\t\t\t\t\t? createElementNS(xmlns, tagName)\n\t\t\t\t\t: createElement(tagName),\n\t\t\t\tprops,\n\t\t\t),\n\t\ttagName,\n\t)\n}\n\nfunction withXMLNS(xmlns, fn, tagName) {\n\tconst nsContext = useXMLNS()\n\n\tif (xmlns && xmlns !== nsContext) {\n\t\t// the xmlns changed, use the new xmlns\n\t\treturn useXMLNS(xmlns, () => fn(xmlns))\n\t}\n\n\t/**\n\t * `foreignObject` children are created with html xmlns (default\n\t * browser behaviour)\n\t */\n\tif (nsContext && tagName === 'foreignObject') {\n\t\treturn useXMLNS(NS.html, () => fn(nsContext))\n\t}\n\n\treturn fn(nsContext)\n}\n\n// PARTIALS\n\nfunction cloneNode(content, xmlns) {\n\tconst template = xmlns\n\t\t? createElementNS(xmlns, 'template')\n\t\t: createElement('template')\n\n\ttemplate.innerHTML = content\n\n\t// xml\n\tif (!template.content) {\n\t\tif (template.childNodes.length === 1) {\n\t\t\treturn template.firstChild\n\t\t}\n\n\t\ttemplate.content = new DocumentFragment()\n\t\ttemplate.content.append(...template.childNodes)\n\t}\n\n\treturn template.content.childNodes.length === 1\n\t\t? template.content.firstChild\n\t\t: template.content\n}\n\nexport function createPartial(content, propsData = nothing) {\n\tlet clone = () => {\n\t\tconst node = withXMLNS(propsData.x, xmlns =>\n\t\t\tcloneNode(content, xmlns),\n\t\t)\n\n\t\tclone = propsData.i\n\t\t\t? importNode.bind(null, node, true)\n\t\t\t: node.cloneNode.bind(node, true)\n\t\treturn clone()\n\t}\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() =>\n\t\t\tassignPartialProps(clone(), props, propsData),\n\t\t)\n\t}\n}\n\nfunction assignPartialProps(node, props, propsData) {\n\tif (props) {\n\t\tconst nodes = []\n\t\twalkElements(node, node => {\n\t\t\tnodes.push(node)\n\n\t\t\tif (nodes.length === propsData.m) return true\n\t\t})\n\n\t\twithXMLNS(propsData.x, xmlns => {\n\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\tassignProps(nodes[propsData[i] || i], props[i])\n\t\t\t}\n\t\t})\n\t}\n\n\treturn node instanceof DocumentFragment\n\t\t? toArray(node.childNodes)\n\t\t: node\n}\n\n/**\n * Assigns props to an element and creates its children\n *\n * @template P\n * @param {Element} node\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createNode(node, props) {\n\tif (props) {\n\t\tassignProps(node, props)\n\t}\n\treturn node\n}\n\n/**\n * Creates the children for a parent\n *\n * @param {Element} parent\n * @param {Children} child\n * @param {boolean} [relative]\n * @param {Text | undefined} [prev]\n * @returns {Children}\n */\nfunction createChildren(parent, child, relative, prev = undefined) {\n\tswitch (typeof child) {\n\t\t// string/number\n\t\tcase 'string':\n\t\tcase 'number': {\n\t\t\tif (prev instanceof Text) {\n\t\t\t\tprev.nodeValue = child\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn insertNode(parent, createTextNode(child), relative)\n\t\t}\n\n\t\tcase 'function': {\n\t\t\t// component\n\t\t\tif (isComponent(child)) {\n\t\t\t\treturn createChildren(parent, untrack(child), relative)\n\t\t\t}\n\t\t\tlet node = []\n\n\t\t\t// signal/memo/external/user provided function\n\t\t\t// needs placeholder to stay in position\n\t\t\tparent = createPlaceholder(\n\t\t\t\tparent,\n\t\t\t\tundefined /*child.name*/,\n\t\t\t\trelative,\n\t\t\t)\n\n\t\t\t// For\n\t\t\tif ($isMap in child) {\n\t\t\t\teffect(() => {\n\t\t\t\t\tnode = toDiff(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tchild(child => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Wrap the item with placeholders, for when stuff in\n\t\t\t\t\t\t\t * between moves. If a `Show` adds and removes nodes, we\n\t\t\t\t\t\t\t * dont have a reference to these nodes. By delimiting\n\t\t\t\t\t\t\t * with a shore, we can just handle anything in between\n\t\t\t\t\t\t\t * as a group.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst begin = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*begin*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst end = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*end*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn [begin, createChildren(end, child, true), end]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\tcleanup(() => {\n\t\t\t\t\ttoDiff(node)\n\t\t\t\t\tparent.remove()\n\t\t\t\t})\n\t\t\t\treturn [node, parent]\n\t\t\t}\n\n\t\t\t// maybe a signal so needs an effect\n\n\t\t\teffect(() => {\n\t\t\t\tnode = toDiff(node, [\n\t\t\t\t\tcreateChildren(parent, child(), true, node[0]),\n\t\t\t\t])\n\t\t\t})\n\n\t\t\tcleanup(() => {\n\t\t\t\ttoDiff(node)\n\t\t\t\tparent.remove()\n\t\t\t})\n\t\t\t/**\n\t\t\t * A placeholder is created and added to the document but doesnt\n\t\t\t * form part of the children. The placeholder needs to be\n\t\t\t * returned so it forms part of the group of children. If\n\t\t\t * children are moved and the placeholder is not moved with\n\t\t\t * them, then, whenever children update these will be at the\n\t\t\t * wrong place. wrong place: where the placeholder is and not\n\t\t\t * where the children were moved to\n\t\t\t */\n\t\t\treturn [node, parent]\n\t\t}\n\n\t\tcase 'object': {\n\t\t\t// HTMLElement/Text\n\t\t\tif (child instanceof HTMLElement || child instanceof Text) {\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// children/fragments\n\t\t\tif (isArray(child)) {\n\t\t\t\treturn child.length === 1\n\t\t\t\t\t? createChildren(parent, child[0], relative)\n\t\t\t\t\t: child.map(child =>\n\t\t\t\t\t\t\tcreateChildren(parent, child, relative),\n\t\t\t\t\t\t)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The value is `null`, as in {null} or like a show returning\n\t\t\t * `null` on the falsy case\n\t\t\t */\n\t\t\tif (child === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Node/DocumentFragment\n\t\t\tif (child instanceof Node) {\n\t\t\t\t/**\n\t\t\t\t * DocumentFragment are special as only the children get added\n\t\t\t\t * to the document and the document becomes empty. If we dont\n\t\t\t\t * insert them 1 by 1 then we wont have a reference to them\n\t\t\t\t * for deletion on cleanup with node.remove()\n\t\t\t\t */\n\t\t\t\tif (child instanceof DocumentFragment) {\n\t\t\t\t\treturn createChildren(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\ttoArray(child.childNodes),\n\t\t\t\t\t\trelative,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// async components\n\t\t\tif ('then' in child) {\n\t\t\t\tconst [value, setValue] = signal(undefined)\n\n\t\t\t\tconst onResult = result =>\n\t\t\t\t\tisConnected(parent) && setValue(result)\n\n\t\t\t\tresolved(child, onResult)\n\n\t\t\t\treturn createChildren(parent, value, relative)\n\t\t\t}\n\n\t\t\t// iterable/Map/Set/NodeList\n\t\t\tif (iterator in child) {\n\t\t\t\treturn createChildren(\n\t\t\t\t\tparent,\n\t\t\t\t\ttoArray(child.values()),\n\t\t\t\t\trelative,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// CSSStyleSheet\n\t\t\tif (child instanceof CSSStyleSheet) {\n\t\t\t\t/**\n\t\t\t\t * Custom elements wont report a document unless is already\n\t\t\t\t * connected. So our stylesheet would end on the main document\n\t\t\t\t * intead of the shadodRoot\n\t\t\t\t */\n\t\t\t\tonFixes(() => {\n\t\t\t\t\tif (isConnected(parent)) {\n\t\t\t\t\t\tconst doc = getDocumentForElement(parent)\n\t\t\t\t\t\tadoptedStyleSheetsAdd(doc, child)\n\n\t\t\t\t\t\tcleanup(() => adoptedStyleSheetsRemove(doc, child))\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// object.toString fancy objects\n\t\t\treturn createChildren(\n\t\t\t\tparent,\n\t\t\t\t// Object.create(null) would fail to convert to string\n\t\t\t\t'toString' in child ? child.toString() : stringify(child),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t\tcase 'undefined': {\n\t\t\treturn undefined\n\t\t}\n\t\tdefault: {\n\t\t\t// boolean/bigint/symbol/catch all\n\t\t\t// toString() is needed for `Symbol`\n\t\t\treturn insertNode(\n\t\t\t\tparent,\n\t\t\t\tcreateTextNode(child.toString()),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t}\n}\n\npropsPlugin(\n\t'children',\n\t(node, propName, propValue) => createChildren(node, propValue),\n\tfalse,\n)\n\n/**\n * Creates placeholder to keep nodes in position\n *\n * @param {Element} parent\n * @param {unknown} text\n * @param {boolean} [relative]\n * @returns {Element}\n */\nconst createPlaceholder = (parent, text, relative) => {\n\treturn insertNode(parent, createTextNode(''), relative)\n\n\t/* dev\n\treturn insertNode(\n\t\tparent,\n\t\tdocument.createComment(\n\t\t\t(text || '') + (relative ? ' relative' : ''),\n\t\t),\n\t\trelative,\n\t) */\n}\n\nconst head = document.head\n\n/**\n * Adds the element to the document\n *\n * @param {Element} parent\n * @param {Element &\n * \tHTMLTitleElement &\n * \tHTMLMetaElement &\n * \tHTMLLinkElement} node\n * @param {boolean} [relative]\n * @returns {Element}\n */\n\nfunction insertNode(parent, node, relative) {\n\t// special case `head`\n\tif (parent === head) {\n\t\tconst name = node.localName\n\n\t\t// search for tags that should be unique\n\t\tlet prev\n\t\tif (name === 'title') {\n\t\t\tprev = querySelector(head, 'title')\n\t\t} else if (name === 'meta') {\n\t\t\tprev =\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[name=\"' + node.getAttribute('name') + '\"]',\n\t\t\t\t) ||\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[property=\"' + node.getAttribute('property') + '\"]',\n\t\t\t\t)\n\t\t} else if (name === 'link' && node.rel === 'canonical') {\n\t\t\tprev = querySelector(head, 'link[rel=\"canonical\"]')\n\t\t}\n\n\t\t// replace old node if there's any\n\t\tprev ? prev.replaceWith(node) : parent.appendChild(node)\n\t} else {\n\t\trelative ? parent.before(node) : parent.appendChild(node)\n\t}\n\n\treturn node\n}\n\n// RENDERING\n\n/**\n * WARNINGS Removal of the element on where you render/insert into,\n * wont cause disposal of what you render/insert.\n */\n\n/**\n * Inserts children into a parent\n *\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * document.body\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n * @returns {Function} Disposer\n * @url https://pota.quack.uy/render\n */\nexport function render(children, parent, options = nothing) {\n\tconst dispose = root(dispose => {\n\t\tinsert(children, parent, options)\n\t\treturn dispose\n\t})\n\n\t// run dispose when the parent scope disposes\n\tcleanup(dispose)\n\n\treturn dispose\n}\n\n/**\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * `document.body`\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n */\nexport function insert(\n\tchildren,\n\tparent = document.body,\n\toptions = nothing,\n) {\n\tif (options.clear && parent) parent.textContent = ''\n\n\tconst node = createChildren(\n\t\tparent,\n\t\tisComponentable(children) ? Factory(children) : children,\n\t\toptions.relative,\n\t)\n\n\tcleanup(() => toDiff([node].flat(Infinity)))\n\n\treturn node\n}\n\n/**\n * Creates and returns HTML Elements for `children`\n *\n * @param {Children} children\n * @returns {Children}\n * @url https://pota.quack.uy/toHTML\n */\nexport const toHTML = children =>\n\t/**\n\t * DocumentFragment is transformed to an `Array` of `Node/Element`,\n\t * that way we can keep a reference to the nodes. Because when the\n\t * DocumentFragment is used, it removes the nodes from the\n\t * DocumentFragment and then we will lose the reference.\n\t */\n\n\tflat(toHTMLFragment(children).childNodes)\n\n/**\n * Creates and returns a DocumentFragment for `children`\n *\n * @param {Children} children\n * @returns {DocumentFragment}\n * @url https://pota.quack.uy/toHTML\n */\nexport function toHTMLFragment(children) {\n\tconst fragment = new DocumentFragment()\n\tcreateChildren(fragment, children)\n\n\treturn fragment\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {Function & { Provider: ({ value }) => Children }}\n * Context\n * @url https://pota.quack.uy/Reactivity/Context\n */\n/* #__NO_SIDE_EFFECTS__ */ export function context(\n\tdefaultValue = undefined,\n) {\n\t/** @type {Function & { Provider: ({ value }) => Children }} */\n\tconst ctx = Context(defaultValue)\n\n\t/**\n\t * Sets the `value` for the context\n\t *\n\t * @param {object} props\n\t * @param {any} props.value\n\t * @param {Children} [props.children]\n\t * @returns {Children} Children\n\t * @url https://pota.quack.uy/Reactivity/Context\n\t */\n\tctx.Provider = props =>\n\t\tctx(props.value, () => toHTML(props.children))\n\n\treturn ctx\n}\n\n/**\n * Removes from the DOM `prev` elements not found on `next`\n *\n * @param {Element[]} prev - Array with previous elements\n * @param {Element[]} next - Array with next elements\n * @returns {Element[]}\n */\nfunction toDiff(prev = [], next = []) {\n\tnext = next.flat(Infinity)\n\tfor (let i = 0, item; i < prev.length; i++) {\n\t\titem = prev[i]\n\t\titem &&\n\t\t\t(next.length === 0 || !next.includes(item)) &&\n\t\t\titem.remove()\n\t}\n\treturn next\n}\n","import { makeCallback, map } from '../lib/reactive.js'\nimport {\n\tactiveElement,\n\tdocumentElement,\n\tisConnected,\n} from '../lib/std.js'\n\nimport { onFixes } from '../scheduler.js'\n\n/**\n * Renders reactive values from an signal that returns an Iterable\n * object\n *\n * @template T\n * @param {object} props\n * @param {Each
} props.each\n * @param {boolean} [props.restoreFocus] - If the focused element\n * moves it may lose focus\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/For\n */\n\nexport const For = props =>\n\tmap(\n\t\t() => {\n\t\t\tprops.restoreFocus && queue()\n\t\t\treturn props.each\n\t\t},\n\t\tmakeCallback(props.children),\n\t\ttrue,\n\t)\n\nlet queued\n\n// because re-ordering the elements trashes focus\nfunction queue() {\n\tif (!queued) {\n\t\tqueued = true\n\n\t\tconst active = activeElement()\n\t\tconst scroll = documentElement.scrollTop\n\n\t\tonFixes(() => {\n\t\t\tqueued = false\n\t\t\t// re-ordering the elements trashes focus\n\t\t\tactive &&\n\t\t\t\tactive !== activeElement() &&\n\t\t\t\tisConnected(active) &&\n\t\t\t\tactive.focus()\n\n\t\t\tdocumentElement.scrollTop = scroll\n\t\t})\n\t}\n}\n","import { signal, cleanup, syncEffect } from '../lib/reactive.js'\nimport { isIterable, toArray } from '../lib/std.js'\n\n/**\n * Returns a `isSelected` function that will return `true` when the\n * argument for it matches the original signal `value`.\n *\n * @param {Signal} value - Signal with the current value\n * @returns {(item: any) => Signal} Signal that you can run with a\n * value to know if matches the original signal\n */\nexport function useSelector(value) {\n\tconst map = new Map()\n\n\tlet prev = []\n\n\tsyncEffect(() => {\n\t\tconst val = value()\n\n\t\tconst selected = isIterable(val) ? toArray(val.values()) : [val]\n\n\t\t// unselect\n\t\tfor (const value of prev) {\n\t\t\tif (!selected.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(false)\n\t\t\t}\n\t\t}\n\n\t\t// select\n\t\tfor (const value of selected) {\n\t\t\tif (!prev.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(true)\n\t\t\t}\n\t\t}\n\n\t\tprev = selected\n\t})\n\n\t/**\n\t * Is selected function, it will return `true` when the value\n\t * matches the current signal.\n\t *\n\t * @param {any} item - Values to compare with current\n\t * @returns {Signal} A signal with a boolean value\n\t */\n\treturn function isSelected(item) {\n\t\tlet selected = map.get(item)\n\t\tif (!selected) {\n\t\t\tselected = signal(prev.includes(item))\n\t\t\tselected.counter = 0\n\t\t\tmap.set(item, selected)\n\t\t}\n\n\t\tselected.counter++\n\n\t\tcleanup(() => {\n\t\t\tif (--selected.counter === 0) {\n\t\t\t\tmap.delete(item)\n\t\t\t}\n\t\t})\n\n\t\treturn selected.read\n\t}\n}\n","import { render, signal, batch } from 'pota'\nimport { For } from 'pota/web'\n\nimport { useSelector } from 'pota/plugin/useSelector'\n\nlet idCounter = 1\nconst adjectives = [\n 'pretty',\n 'large',\n 'big',\n 'small',\n 'tall',\n 'short',\n 'long',\n 'handsome',\n 'plain',\n 'quaint',\n 'clean',\n 'elegant',\n 'easy',\n 'angry',\n 'crazy',\n 'helpful',\n 'mushy',\n 'odd',\n 'unsightly',\n 'adorable',\n 'important',\n 'inexpensive',\n 'cheap',\n 'expensive',\n 'fancy',\n ],\n colours = [\n 'red',\n 'yellow',\n 'blue',\n 'green',\n 'pink',\n 'brown',\n 'purple',\n 'brown',\n 'white',\n 'black',\n 'orange',\n ],\n nouns = [\n 'table',\n 'chair',\n 'house',\n 'bbq',\n 'desk',\n 'car',\n 'pony',\n 'cookie',\n 'sandwich',\n 'burger',\n 'pizza',\n 'mouse',\n 'keyboard',\n ]\n\nfunction _random(max) {\n return Math.round(Math.random() * 1000) % max\n}\n\nfunction buildData(count) {\n let data = new Array(count)\n for (let i = 0; i < count; i++) {\n const [label, setLabel, updateLabel] = signal(\n `${adjectives[_random(adjectives.length)]} ${\n colours[_random(colours.length)]\n } ${nouns[_random(nouns.length)]}`,\n )\n data[i] = {\n id: idCounter++,\n label,\n updateLabel,\n }\n }\n return data\n}\n\nconst Button = ({ id, text, fn }) => (\n \n \n {text}\n \n
\n)\n\nconst App = () => {\n const [data, setData, updateData] = signal([]),\n [selected, setSelected] = signal(null),\n run = () => setData(buildData(1000)),\n runLots = () => {\n setData(buildData(10000))\n },\n add = () => updateData(d => [...d, ...buildData(1000)]),\n update = () =>\n batch(() => {\n for (let i = 0, d = data(), len = d.length; i < len; i += 10)\n d[i].updateLabel(l => l + ' !!!')\n }),\n swapRows = () => {\n const d = data().slice()\n if (d.length > 998) {\n let tmp = d[1]\n d[1] = d[998]\n d[998] = tmp\n setData(d)\n }\n },\n clear = () => setData([]),\n remove = id =>\n updateData(d => {\n const idx = d.findIndex(datum => datum.id === id)\n d.splice(idx, 1)\n return [...d]\n }),\n isSelected = useSelector(selected)\n\n return (\n \n
\n
\n
\n
pota Keyed \n \n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
{\n const element = e.target\n const { selectRow, removeRow } = element\n if (selectRow !== undefined) {\n setSelected(selectRow)\n } else if (removeRow !== undefined) {\n remove(removeRow)\n }\n }}\n >\n \n \n {row => {\n const { id, label } = row\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n )\n }}\n \n \n
\n
\n
\n )\n}\n\nrender(App, document.getElementById('main'))\n"],"names":["global","globalThis","window","CSSStyleSheet","document","DocumentFragment","Object","Symbol","queueMicrotask","assign","entries","freeze","groupBy","isArray","Array","toArray","from","iterator","stringify","JSON","resolved","promise","onDone","then","catch","isConnected","node","activeElement","documentElement","call","fns","fn","bind","createElement","createElementNS","createTextNode","importNode","createTreeWalker","empty","create","flat","arr","length","withState","state","cacheStore","withCache","cache","thing","get","walkElements","walk","currentNode","nodeType","nextNode","getDocumentForElement","getRootNode","ownerDocument","getValue","value","isFunction","isIterable","isObject","isNullUndefined","undefined","isString","noop","nothing","querySelector","query","removeFromArray","array","index","indexOf","splice","DataStore","constructor","kind","store","set","has","target","defaults","o","delete","Map","classListAdd","className","classList","add","classListRemove","remove","adoptedStyleSheetsGet","adoptedStyleSheets","adoptedStyleSheetsAdd","styleSheet","push","adoptedStyleSheetsRemove","sheet","css","replace","$isComponent","$isClass","$isReactive","$isMap","prefix","NS","__proto__","svg","math","html","xlink","CLEAN","STALE","CHECK","Owner","Listener","Updates","Effects","Time","Root","owner","owned","cleanups","context","options","dispose","i","Computation","updatedAt","sources","sourceSlots","update","time","prevOwner","prevListener","err","source","observers","observer","slot","pop","observerSlots","Effect","user","batch","SyncEffect","Signal","save","prev","read","markReactive","write","sourceSlot","equals","runUpdates","pure","downstream","a","b","root","signal","initialValue","effect","syncEffect","runWithOwner","untrack","cleanup","runTop","upstream","ancestors","updates","init","wait","res","runQueue","effects","runEffects","queue","userLength","ignore","Context","defaultValue","id","useContext","newValue","cb","args","isReactive","withValue","withPrevValue","val","map","list","callback","sort","duplicates","runId","rows","clear","Row","item","isDupe","disposer","nodes","begin","end","all","mapper","items","hasPrev","row","dupes","unsorted","every","includes","usort","before","nodesFromRow","after","current","previous","previousSibling","nextSibling","isComponent","isComponentable","makeCallback","children","callbacks","markComponent","child","r","addEventListener","type","handler","removeEventListener","ownedEvent","handleEvent","e","added","reset","priority","run","q","onFixes","onProps","onRef","onMount","ready","setEventNS","name","props","localName","ns","eventName","startsWith","toLowerCase","slice","plugins","pluginsNS","propsPlugin","propName","onMicrotask","plugin","propsPluginNS","NSName","propsPluginBoth","setAttributeNS","setAttribute","_setAttribute","removeAttributeNS","removeAttribute","setPropertyNS","setProperty","_setProperty","setUnknown","SVGElement","setBoolNS","setBool","_setBool","setStyle","setNodeStyle","style","setStyleNS","setVarNS","setStyleValue","cssText","_setStyleValue","removeProperty","setClass","setClassList","setClassNS","setElementClass","_setClassListValue","trim","split","randomId","crypto","getRandomValues","BigUint64Array","toString","setCSS","setNodeCSS","setRef","setOnMount","setUnmount","assignProps","assignProp","event","useXMLNS","Factory","createTag","createClass","createAnything","Node","createNode","createComponent","component","render","tagName","xmlns","withXMLNS","nsContext","cloneNode","content","template","innerHTML","childNodes","firstChild","append","createPartial","propsData","clone","x","assignPartialProps","m","createChildren","parent","relative","Text","nodeValue","insertNode","createPlaceholder","toDiff","HTMLElement","setValue","onResult","result","values","doc","propValue","text","head","getAttribute","rel","replaceWith","appendChild","insert","body","textContent","Infinity","toHTML","toHTMLFragment","fragment","ctx","Provider","next","For","restoreFocus","each","queued","active","scroll","scrollTop","focus","useSelector","selected","isSelected","counter","_For","_createComponent","idCounter","adjectives","colours","nouns","_random","max","Math","round","random","buildData","count","data","label","setLabel","updateLabel","Button","_div","onClick","_Button","App","setData","updateData","setSelected","runLots","d","len","l","swapRows","tmp","idx","findIndex","datum","_div2","element","selectRow","removeRow","_tr","getElementById"],"mappings":";;;CAAO,MAAMA,MAAM,GAAGC,UAAU,CAAA;CACzB,MAAMC,MAAM,GAAGF,MAAM,CAAA;CAErB,MAAMG,aAAa,GAAGH,MAAM,CAACG,aAAa,CAAA;CAC1C,MAAMC,UA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,EAGAwJ,IAAA,CAAA;CAAKV,MAAAA,IAAI,EAAEuB,IAAK;OAAArK,QAAA,EACbhB,GAAG,IAAI;SACN,MAAM;WAAE5B,EAAE;CAAEkN,UAAAA,KAAAA;CAAM,SAAC,GAAGtL,GAAG,CAAA;CAEzB,QAAA,OACE8M,GAAA,CAAA,CAAA;WAAI,cAAcxC,EAAAA,UAAU,CAAClM,EAAE,CAAA;CAAE,SAAA,EAAA;CAG7BgL,UAAAA,WAAW,EAAEhL,EAAAA;CAAG,SAAA,EAAA;CAIdgL,UAAAA,WAAW,EAAEkC,KAAM;WACnB,gBAAgBlN,EAAAA,EAAAA;CAAG,SAAA,EAAA;WAQjB,gBAAgBA,EAAAA,EAAAA;CAAG,SAAA,CAKvB,CAAC,CAAA;CAET,OAAA;MACG,CAAA;CAAC,GAAA,CAOP,CAAC,CAAA;CAEV,CAAC,CAAA;CAEDuI,MAAM,CAACkF,GAAG,EAAE5Y,QAAQ,CAAC8Z,cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"main.js","sources":["../../../../../pota/src/lib/std.js","../../../../../pota/src/constants.js","../../../../../pota/src/lib/reactive.js","../../../../../pota/src/scheduler.js","../../../../../pota/src/props/event.js","../../../../../pota/src/props/plugin.js","../../../../../pota/src/props/attribute.js","../../../../../pota/src/props/property.js","../../../../../pota/src/props/unknown.js","../../../../../pota/src/props/bool.js","../../../../../pota/src/props/style.js","../../../../../pota/src/props/class.js","../../../../../pota/src/props/value.js","../../../../../pota/src/plugin/useRandom.js","../../../../../pota/src/props/css.js","../../../../../pota/src/props/lifecycle.js","../../../../../pota/src/props/@main.js","../../../../../pota/src/renderer.js","../../../../../pota/src/web/For.js","../../../../../pota/src/plugin/useSelector.js","index.jsx"],"sourcesContent":["export const global = globalThis\nexport const window = global\n\nexport const CSSStyleSheet = global.CSSStyleSheet\nexport const document = global.document\nexport const DocumentFragment = global.DocumentFragment\nexport const Object = global.Object\nexport const Promise = global.Promise\nexport const requestAnimationFrame = global.requestAnimationFrame\nexport const Symbol = global.Symbol\nexport const queueMicrotask = global.queueMicrotask\n\nexport const assign = Object.assign\nexport const create = Object.create\nexport const defineProperties = Object.defineProperties\nexport const defineProperty = Object.defineProperty\nexport const entries = Object.entries\nexport const freeze = Object.freeze\nexport const fromEntries = Object.fromEntries\nexport const getOwnPropertyDescriptor =\n\tObject.getOwnPropertyDescriptor\nexport const getOwnPropertyDescriptors =\n\tObject.getOwnPropertyDescriptors\nexport const getOwnPropertyNames = Object.getOwnPropertyNames\nexport const getOwnPropertySymbols = Object.getOwnPropertySymbols\nexport const getPrototypeOf = Object.getPrototypeOf\nexport const groupBy = Object.groupBy\nexport const hasOwnProperty = Object.hasOwn\nexport const is = Object.is\nexport const isExtensible = Object.isExtensible\nexport const keys = Object.keys\nexport const values = Object.values\nexport const setPrototypeOf = Object.setPrototypeOf\n\nexport const isArray = Array.isArray\nexport const toArray = Array.from\n\nexport const isNaN = Number.isNaN\n\nexport const iterator = Symbol.iterator\n\nexport const stringify = JSON.stringify\nexport const stringifyReadable = o => stringify(o, null, 2)\n\nexport const stringifySorted = o => {\n\tfunction sort(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\t\tconst tmp = isArray(o) ? [] : {}\n\t\tkeys(o)\n\t\t\t.sort()\n\t\t\t.map(k => (tmp[k] = sort(o[k])))\n\n\t\tif (isArray(tmp)) {\n\t\t\ttmp.sort((a, b) => stringify(a).localeCompare(stringify(b)))\n\t\t}\n\t\treturn tmp\n\t}\n\treturn stringifyReadable(sort(o))\n}\n\nexport const PrototypeArray = Array.prototype\nexport const PrototypeMap = Map.prototype\n\nexport const history = global.history\nexport const location = global.location\nexport const navigator = global.navigator\n\nexport const origin = location.origin\n\nexport const promise = fn => new Promise(fn)\n\nexport const withResolvers = () => Promise.withResolvers()\n\n/**\n * Given a promise it adds `onDone` to `then` and `catch`\n *\n * ```js\n * resolved(promise, onDone)\n * // is same as\n * promise.then(onDone).catch(onDone)\n * ```\n */\nexport const resolved = (promise, onDone) =>\n\tpromise.then(onDone).catch(onDone)\n\nexport const setAttribute = (node, name, value) =>\n\tnode.setAttribute(name, value)\n\nexport const hasAttribute = (node, name) => node.hasAttribute(name)\n\nexport const removeAttribute = (node, name) =>\n\tnode.removeAttribute(name)\n\nexport const setAttributeNS = (node, name, value) =>\n\tnode.setAttributeNS(name, value)\n\nexport const hasAttributeNS = (node, name) =>\n\tnode.hasAttributeNS(name)\n\nexport const removeAttributeNS = (node, name) =>\n\tnode.removeAttributeNS(name)\n\nexport const isConnected = node => node.isConnected\n\nexport const activeElement = () => document.activeElement\n\nexport const documentElement = document.documentElement\n\n/**\n * Runs an array of functions\n *\n * @param {Iterable} fns\n */\nexport const call = fns => {\n\tfor (const fn of fns) fn()\n}\n\nexport function copy(o) {\n\tconst seen = new Map()\n\tfunction copy(o) {\n\t\tif (!isObject(o)) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (\n\t\t\to instanceof Node ||\n\t\t\to instanceof Date ||\n\t\t\to instanceof Set ||\n\t\t\to instanceof Map ||\n\t\t\to instanceof WeakSet ||\n\t\t\to instanceof WeakMap ||\n\t\t\to instanceof Promise ||\n\t\t\to instanceof RegExp\n\t\t) {\n\t\t\treturn o\n\t\t}\n\n\t\tif (seen.has(o)) {\n\t\t\treturn seen.get(o)\n\t\t}\n\n\t\tconst c = isArray(o) ? [] : {}\n\n\t\tseen.set(o, c)\n\n\t\tfor (const k in o) {\n\t\t\tc[k] = copy(o[k])\n\t\t}\n\t\treturn c\n\t}\n\treturn copy(o)\n}\n\n/**\n * Object.defineProperty with `enumerable` and `configurable` set to\n * `true` unless overwriten by `descriptor` argument\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {PropertyDescriptor} descriptor\n */\nexport const redefineProperty = (target, key, descriptor) =>\n\tdefineProperty(target, key, assign(create(defaults), descriptor))\n\nconst defaults = {\n\t__proto__: null,\n\tconfigurable: true,\n\tenumerable: true,\n}\n\n/**\n * Object.defineProperty with `configurable`, `writable` and\n * `enumerable` as `false`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {any} value\n */\nexport const definePropertyReadOnly = (target, key, value) => {\n\tconst descriptor = create(defaultsReadOnly)\n\tdescriptor.value = value\n\tdefineProperty(target, key, descriptor)\n}\n\nconst defaultsReadOnly = {\n\t__proto__: null,\n\tconfigurable: false,\n\tenumerable: false,\n\twritable: false,\n\tvalue: undefined,\n}\n\nconst bind = fn => document[fn].bind(document)\n\nexport const createElement = bind('createElement')\n\nexport const createElementNS = bind('createElementNS')\n\nexport const createTextNode = bind('createTextNode')\n\nexport const importNode = bind('importNode')\n\nexport const createTreeWalker = bind('createTreeWalker')\n\n/**\n * Returns an object without a prototype\n *\n * @type {Function}\n * @returns {Props} Empty object\n */\nexport const empty = Object.create.bind(null, null)\n\nexport function* entriesIncludingSymbols(target) {\n\tfor (const item of entries(target)) {\n\t\tyield item\n\t}\n\n\tfor (const item of getOwnPropertySymbols(target)) {\n\t\t// todo: causes access!\n\t\tyield [item, target[item]]\n\t}\n}\n\n// modified version of https://github.com/epoberezkin/fast-deep-equal\n\nexport function equals(a, b) {\n\tif (a === b) {\n\t\treturn true\n\t}\n\n\tif (a && b && typeof a == 'object' && typeof b == 'object') {\n\t\tif (a.constructor !== b.constructor) {\n\t\t\treturn false\n\t\t}\n\n\t\tlet length, i, k\n\t\tif (isArray(a)) {\n\t\t\tlength = a.length\n\t\t\tif (length != b.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tfor (i = length; i-- !== 0; ) {\n\t\t\t\tif (!equals(a[i], b[i])) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\n\t\tif (a.constructor === RegExp)\n\t\t\treturn a.source === b.source && a.flags === b.flags\n\t\tif (a.valueOf !== Object.prototype.valueOf)\n\t\t\treturn a.valueOf() === b.valueOf()\n\t\tif (a.toString !== Object.prototype.toString)\n\t\t\treturn a.toString() === b.toString()\n\n\t\tk = keys(a)\n\t\tlength = k.length\n\t\tif (length !== keys(b).length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(b, k[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tfor (i = length; i-- !== 0; ) {\n\t\t\tvar key = k[i]\n\n\t\t\tif (!equals(a[key], b[key])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// true if both NaN, false otherwise\n\treturn a !== a && b !== b\n}\n\n/**\n * Flats an array/childNodes to the first children if the length is 1\n *\n * @param {any[] | NodeListOf} arr\n * @returns {any}\n */\nexport const flat = arr => (arr.length === 1 ? arr[0] : arr)\n\n/**\n * Keeps state in the function as the first param\n *\n * @template T\n * @param {T} fn - Function to which add state to it\n * @param {DataStore | DataStore} [state] - Passed to\n * `fn` as first param\n * @returns {T} A copy of the function with the state\n */\nexport const withState = /* #__NO_SIDE_EFFECTS__ */ (\n\tfn,\n\tstate = cacheStore,\n) => fn.bind(null, state())\n\n/** Memoize functions with a map cache */\nexport const withCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tcacheStore,\n\t)\n/** Memoize functions with a weak cache */\nexport const withWeakCache = fn =>\n\twithState(\n\t\t(cache, thing) => cache.get(thing, thing => fn(thing)),\n\t\tweakStore,\n\t)\n\nexport const walkElements = withState(\n\t(walk, node, fn) => {\n\t\twalk.currentNode = node\n\n\t\t/**\n\t\t * The first node is not walked by the walker.\n\t\t *\n\t\t * Also the first node could be a DocumentFragment\n\t\t */\n\t\tif (node.nodeType === 1) {\n\t\t\tif (fn(node)) return\n\t\t}\n\n\t\twhile ((node = walk.nextNode())) {\n\t\t\tif (fn(node)) break\n\t\t}\n\t},\n\t() => createTreeWalker(document, 1 /*NodeFilter.SHOW_ELEMENT*/),\n)\n\n/**\n * Returns `document` for element. That could be a `shadowRoot`\n *\n * @param {Element} node\n * @returns {Document | ShadowRoot}\n */\n\nexport const getDocumentForElement = node => {\n\tconst document = node.getRootNode()\n\tconst { nodeType } = document\n\t// getRootNode returns:\n\t// 1. Node for isConnected = false\n\t// 2. Document for isConnected = true\n\t// 3. shadowRoot for custom elements\n\n\t// always return a Document-like\n\treturn nodeType === 11 || nodeType === 9\n\t\t? document\n\t\t: node.ownerDocument\n}\n\nexport const getOwnValues = o =>\n\tgetOwnPropertyNames(o).map(key => {\n\t\ttry {\n\t\t\treturn o[key]\n\t\t} catch (e) {}\n\t})\n\nexport function getSetterNamesFromPrototype(object, set = new Set()) {\n\tconst descriptors = getOwnPropertyDescriptors(object)\n\n\tfor (const key in descriptors) {\n\t\tif (descriptors[key].set) {\n\t\t\tset.add(key)\n\t\t}\n\t}\n\n\treturn set\n}\n\n/**\n * Unwraps values. If the argument is a function then it runs it\n * recursively and returns the value\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValue(value) {\n\twhile (typeof value === 'function') value = value()\n\treturn value\n}\n\n/**\n * Unwraps `value` and returns `element` if result is a `Node`, else\n * `undefined` in the case isn't a `Node`\n *\n * @param {Function | any} value - Maybe function\n * @param {...any} args? - Arguments\n * @returns {Node | undefined}\n */\nexport function getValueElement(value, ...args) {\n\tconst element = getValueWithArguments(value, ...args)\n\treturn element instanceof Node ? element : undefined\n}\n\nexport const getValueWithArguments = (value, ...args) =>\n\ttypeof value === 'function'\n\t\t? args.length\n\t\t\t? getValue(value(...args))\n\t\t\t: getValue(value())\n\t\t: value\n\n/**\n * Identity function, given `x` returns `x`\n *\n * @template T\n * @param {T} x\n * @returns {T}\n */\nexport const identity = x => x\n\n/**\n * When `value` is an object, it will check if the `key` on `target`\n * is `configurable`\n *\n * @param {object} target\n * @param {PropertyKey} key\n * @param {boolean | undefined} value\n */\nexport const isConfigurable = (target, key, value) => {\n\tif (isObject(value)) {\n\t\tconst descriptor = getOwnPropertyDescriptor(target, key)\n\t\tif (descriptor) {\n\t\t\treturn descriptor.configurable\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Returns `true` when `typeof` of `value` is `function`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isFunction = value => typeof value === 'function'\n\n/**\n * Returns `true` when value is Iterable\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isIterable = value =>\n\tisObject(value) && 'values' in value\n\n/**\n * Returns `true` if the value is `null` or `undefined`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNullUndefined = value =>\n\tvalue === undefined || value === null\n\n/**\n * Returns `true` when typeof of value is object and not null\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isObject = value =>\n\tvalue !== null && typeof value === 'object'\n\n/**\n * Returns `true` when object morphed between array/object\n *\n * @param {any} a\n * @param {any} b\n * @returns {boolean}\n */\nexport const morphedBetweenArrayAndObject = (a, b) =>\n\t(isObject(a) && !isObject(b)) ||\n\t(isObject(b) && !isObject(a)) ||\n\t(isArray(a) && !isArray(b)) ||\n\t(isArray(b) && !isArray(a))\n\n/**\n * Returns `true` if the property is defined in the `prototype` and\n * absent in the `object`\n *\n * @param {object} target\n * @param {PropertyKey} key\n */\nexport const isPrototypeProperty = (target, key) =>\n\t// must do `key in target` to check that it DOES have it somewhere\n\t// must do !hasOwnProperty to check that isnt an own property\n\tkey in target && !hasOwnProperty(target, key)\n\n/**\n * Returns `true` when `typeof` of `value` is `string`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isString = value => typeof value === 'string'\n\n/**\n * Returns `true` when `typeof` of `value` is `number`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isNumber = value => typeof value === 'number'\n\n/**\n * Returns `true` when `typeof` of `value` is `symbol`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isSymbol = value => typeof value === 'symbol'\n\n/**\n * Returns `true` when `typeof` of `value` is `boolean`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isBoolean = value => typeof value === 'boolean'\n\n/**\n * Returns `true` when `value` may be a promise\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isPromise = value => isObject(value) && 'then' in value\n\nexport const noop = () => {}\n\n/**\n * An empty frozen object\n *\n * @type object\n */\nexport const nothing = freeze(empty())\n\n// an optional value is `true` by default, so most of the time is undefined which means is `true`\n// to avoid having conditions like `if(something.bla === undefined || something.bla)`\n// this function will short it to `if(optional(something.bla))`\n// additionally the value is resolved, for cases like `when={() => show() && optional(props.when)}`\n\n/**\n * Returns `true` when value is true or undefined\n *\n * @param {Function | boolean | undefined} value\n * @returns {boolean} True when value is true or undefined\n */\nexport const optional = value =>\n\tvalue === undefined || getValue(value)\n\nexport const partAdd = (node, className) => node.part.add(className)\n\nexport const partRemove = (node, className) =>\n\tnode.part.remove(className)\n\nexport const querySelector = (node, query) =>\n\tnode.querySelector(query)\n\nexport const querySelectorAll = (node, query) =>\n\tnode.querySelectorAll(query)\n\nexport function* range(start, stop, step = 1) {\n\tyield start\n\twhile (start < stop) {\n\t\tyield (start += step)\n\t}\n}\n\nexport const {\n\townKeys: reflectOwnKeys,\n\thas: reflectHas,\n\tdeleteProperty: reflectDeleteProperty,\n\tgetOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor,\n\tget: reflectGet,\n\tapply: reflectApply,\n\tset: reflectSet,\n} = Reflect\n\n/**\n * Removes a value from an array\n *\n * @template T\n * @param {T[]} array\n * @param {T} value To remove from the array\n * @returns {T[]}\n */\nexport function removeFromArray(array, value) {\n\tconst index = array.indexOf(value)\n\tif (index !== -1) array.splice(index, 1)\n\treturn array\n}\n/**\n * Removes values from an array based on a condition\n *\n * @template T\n * @param {T[]} array\n * @param {(value: T, index: number) => boolean} cb Function with\n * condition\n */\nexport function removeFromArrayConditionally(array, cb) {\n\tlet i = array.length\n\twhile (i--) {\n\t\tif (cb(array[i], i)) {\n\t\t\tarray.splice(i, 1)\n\t\t}\n\t}\n}\n/**\n * Removes values from an array based on a condition\n *\n * @param {Iterable} iterable\n * @param {PropertyKey} key Function with condition\n */\nexport function indexByKey(iterable, key) {\n\tconst byKey = empty()\n\tfor (const item of iterable) {\n\t\tbyKey[item[key]] = item\n\t}\n\treturn byKey\n}\n\n/**\n * Replace a prototype in the prototype chain with another prototype\n *\n * @param {object} target - Target object\n * @param {object} search - The prototype to replace\n * @param {object} replacement - The replacement prototype\n */\nexport function replacePrototypeWith(target, search, replacement) {\n\tlet prototype = target\n\twhile (getPrototypeOf(prototype) !== search) {\n\t\tprototype = getPrototypeOf(prototype)\n\t}\n\n\tsetPrototypeOf(prototype, replacement)\n}\n\nexport const typeString = obj =>\n\tObject.prototype.toString.call(obj).slice(8, -1)\n\nexport function walkParents(context, propertyName, cb) {\n\twhile (context) {\n\t\tif (cb(context)) return true\n\t\tcontext = context[propertyName]\n\t}\n}\n\n/**\n * Store template\n *\n * @typedef {(\n * \treference: any,\n * \tcreateIfNotExistsAs?: ((target: any) => any) | Function,\n * ) => any} DataStoreGet\n *\n *\n * @typedef {(key: any, value: any) => void} DataStoreSet\n *\n * @typedef {(key: any) => boolean} DataStoreHas\n *\n * @typedef {(key: any) => boolean} DataStoreDelete\n */\n\nclass DataStore {\n\tconstructor(kind) {\n\t\tconst store = new kind()\n\n\t\tconst get = k => store.get(k)\n\t\tconst set = (k, v) => store.set(k, v)\n\t\tconst has = k => store.has(k)\n\n\t\tthis.get = (target, defaults = undefined) => {\n\t\t\tconst o = get(target)\n\n\t\t\tif (o !== undefined) {\n\t\t\t\treturn o\n\t\t\t}\n\n\t\t\tif (defaults !== undefined) {\n\t\t\t\t/**\n\t\t\t\t * Default values should be passed as a function, so we dont\n\t\t\t\t * constantly initialize values when giving them\n\t\t\t\t */\n\t\t\t\tdefaults = defaults(target)\n\t\t\t\tset(target, defaults)\n\t\t\t\treturn defaults\n\t\t\t}\n\t\t}\n\n\t\tthis.set = set\n\t\tthis.has = has\n\t\tthis.delete = k => store.delete(k)\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.get\n\t\tyield this.set\n\t\tyield this.has\n\t\tyield this.delete\n\t}\n}\n\n/**\n * Creates a WeakMap to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdelete: DataStoreDelete\n * }}\n */\nexport const weakStore = () => new DataStore(WeakMap)\n\n/**\n * Creates a Map to store data\n *\n * @returns {[\n * \tDataStoreGet,\n * \tDataStoreSet,\n * \tDataStoreHas,\n * \tDataStoreDelete,\n * ] & {\n * \tget: DataStoreGet\n * \tset: DataStoreSet\n * \thas: DataStoreHas\n * \tdel: DataStoreDelete\n * }}\n */\nexport const cacheStore = () => new DataStore(Map)\n\nexport const classListAdd = (node, className) =>\n\tnode.classList.add(className)\n\nexport const classListRemove = (node, className) =>\n\tnode.classList.remove(className)\n\n/**\n * - Returns `adoptedStyleSheets` for a document\n *\n * @param {Document | ShadowRoot} document\n */\nexport const adoptedStyleSheetsGet = document =>\n\tdocument.adoptedStyleSheets\n\nexport const adoptedStyleSheets =\n\t/* #__PURE__*/ adoptedStyleSheetsGet(document)\n\n/**\n * Adds a style sheet to the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsAdd = (document, styleSheet) =>\n\tadoptedStyleSheetsGet(document).push(styleSheet)\n\n/**\n * Removes a style sheet from the document\n *\n * @param {Document | ShadowRoot} document\n * @param {CSSStyleSheet} styleSheet\n */\nexport const adoptedStyleSheetsRemove = (document, styleSheet) =>\n\tremoveFromArray(adoptedStyleSheetsGet(document), styleSheet)\n\n/**\n * Adds a style sheet to the custom element\n *\n * @param {Document | ShadowRoot} document\n * @param {(CSSStyleSheet | string)[]} styleSheets\n */\nexport function addStyleSheets(document, styleSheets = []) {\n\tfor (const sheet of styleSheets) {\n\t\tif (sheet) {\n\t\t\tsheet instanceof CSSStyleSheet\n\t\t\t\t? adoptedStyleSheetsAdd(document, sheet)\n\t\t\t\t: addStyleSheetExternal(document, sheet)\n\t\t}\n\t}\n}\n\n/**\n * Adds the stylesheet from urls. It uses a cache, to avoid having to\n * fire a request for each external sheet when used in more than one\n * custom element. Also, all reference the same object.\n *\n * @param {Document | ShadowRoot} document\n * @param {string} text\n */\nexport const addStyleSheetExternal = withState(\n\t(state, document, text) => {\n\t\tstate\n\t\t\t.get(text, text =>\n\t\t\t\ttext.startsWith('http')\n\t\t\t\t\t? fetch(text)\n\t\t\t\t\t\t\t.then(r => r.text())\n\t\t\t\t\t\t\t.then(css => sheet(css))\n\t\t\t\t\t: promise(resolve => resolve(sheet(text))),\n\t\t\t)\n\t\t\t.then(styleSheet => adoptedStyleSheetsAdd(document, styleSheet))\n\t},\n)\n\n/**\n * Swaps classNames and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldClass - `class` with the old animation\n * @param {string} newClass - `class` with the new animation\n */\nexport const animateClassTo = (element, oldClass, newClass) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tclassListRemove(element, oldClass)\n\t\t\tclassListAdd(element, newClass)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Swaps parts and waits for the animation to end\n *\n * @param {Element} element\n * @param {string} oldPart - `part` with the old animation\n * @param {string} newPart - `part` with the new animation\n */\nexport const animatePartTo = (element, oldPart, newPart) =>\n\tpromise(resolve =>\n\t\trequestAnimationFrame(() => {\n\t\t\tpartRemove(element, oldPart)\n\t\t\tpartAdd(element, newPart)\n\t\t\telement.getAnimations().length\n\t\t\t\t? resolved(waitEvent(element, 'animationend'), resolve)\n\t\t\t\t: resolve()\n\t\t}),\n\t)\n\n/**\n * Creates tagged css and returns a CSSStyleSheet. Mostly for css\n * highlighting in js\n *\n * @param {TemplateStringsArray} template\n * @param {...any} values\n * @returns {CSSStyleSheet}\n */\nexport const css = (template, ...values) =>\n\tsheet(String.raw({ raw: template }, ...values))\n\n/**\n * Creates a stylesheet from a css string\n *\n * @param {string} css\n * @returns {CSSStyleSheet}\n */\nexport const sheet = withCache(css => {\n\tconst sheet = new CSSStyleSheet()\n\t/**\n\t * Replace is asynchronous and can accept @import statements\n\t * referencing external resources.\n\t */\n\tsheet.replace(css)\n\n\treturn sheet\n})\n\n/**\n * @param {Element} node\n * @param {string} eventName\n * @param {any} [data]\n */\n\nexport const emit = (\n\tnode,\n\teventName,\n\tdata = { bubbles: true, cancelable: true, composed: true },\n) => node.dispatchEvent(new CustomEvent(eventName, data))\n\nexport function stopEvent(e) {\n\tpreventDefault(e)\n\tstopPropagation(e)\n\tstopImmediatePropagation(e)\n}\n\nexport const preventDefault = e => e.preventDefault()\nexport const stopPropagation = e => e.stopPropagation()\nexport const stopImmediatePropagation = e =>\n\te.stopImmediatePropagation()\n\n/**\n * Waits for an event to be dispatched and runs a callback\n *\n * @param {Element} element\n * @param {string} eventName\n */\nexport const waitEvent = withState(\n\t(state, element, eventName) =>\n\t\tpromise((resolve, reject) => {\n\t\t\t/**\n\t\t\t * To prevent firing `transitionend` twice it needs to stop\n\t\t\t * listening the old one because maybe wasn't dispatched and\n\t\t\t * running a new transition will make it dispatch twice\n\t\t\t */\n\t\t\tconst previous = state.get(element, empty)\n\t\t\tprevious.reject && previous.reject()\n\t\t\telement.removeEventListener(eventName, previous.resolve)\n\t\t\tstate.set(element, { resolve, reject })\n\t\t\telement.addEventListener(eventName, resolve, {\n\t\t\t\tonce: true,\n\t\t\t})\n\t\t}),\n\tweakStore,\n)\n\nexport const addEventListenerObject = (where, type, handler) =>\n\twhere.addEventListener(type, handler, handler)\n\nexport const removeEventListenerObject = (where, type, handler) =>\n\twhere.removeEventListener(type, handler, handler)\n\n/** @param {EventListener} fn */\nexport const passiveEvent = fn => ({ handleEvent: fn, passive: true })\n","// symbols\n\nimport { Symbol } from './lib/std.js'\n\nexport const $isComponent = Symbol()\nexport const $isClass = Symbol()\nexport const $isReactive = Symbol()\nexport const $isMap = Symbol()\n\n// supported namespaces\n\nconst prefix = 'http://www.w3.org/'\n\n// when a tag/attribute is missing the namespace this puts it back in\n\nexport const NS = {\n\t__proto__: null,\n\tsvg: prefix + '2000/svg',\n\tmath: prefix + '1998/Math/MathML',\n\thtml: prefix + '1999/xhtml',\n\txlink: prefix + '1999/xlink',\n}\n","/**\n * This is so far the core of Solid JS Reactivity, this may change.\n *\n * Adaptation for potas needs have been made:\n *\n * - Ported to Classes what does fit\n * - Signal has more options: `label` and `save` previous value\n * - Writing to a signal returns `true` when the value changes\n * - Signal is an object that could be used as signal.read/write or\n * destructured as an array.\n * - Signals can save and wont run functions\n * - `update` function on Signal that could be used to use the old value\n */\n\nimport {\n\t$isClass,\n\t$isComponent,\n\t$isMap,\n\t$isReactive,\n} from '../constants.js'\n\nimport {\n\tassign,\n\tentries,\n\tflat,\n\tgetValue,\n\tgroupBy,\n\tisArray,\n\tisFunction,\n\tisIterable,\n\tisObject,\n\tisPromise,\n\tkeys,\n\tnothing,\n\tqueueMicrotask,\n\tremoveFromArray,\n\tresolved,\n\tSymbol,\n\tweakStore,\n\twithResolvers,\n\twithState,\n\twithWeakCache,\n} from './std.js'\n\nconst CLEAN = 0\nconst STALE = 1\nconst CHECK = 2\n\nlet Owner\nlet Listener\n\nlet Updates = null\nlet Effects = null\n\nlet Time = 0\n\n// ROOT\n\nclass Root {\n\towner\n\towned\n\n\tcleanups\n\n\tcontext\n\n\tconstructor(owner, options) {\n\t\tthis.owner = owner\n\t\tthis.context = owner?.context\n\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t}\n\t}\n\n\tdispose() {\n\t\tlet i\n\n\t\tconst { owned, cleanups } = this\n\n\t\tif (owned) {\n\t\t\tfor (i = owned.length - 1; i >= 0; i--) {\n\t\t\t\towned[i].dispose()\n\t\t\t}\n\t\t\towned.length = 0\n\t\t}\n\t\tif (cleanups) {\n\t\t\tfor (i = cleanups.length - 1; i >= 0; i--) {\n\t\t\t\tcleanups[i]()\n\t\t\t}\n\t\t\tcleanups.length = 0\n\t\t}\n\t}\n}\n\n// COMPUTATION\n\nclass Computation extends Root {\n\tstate = STALE\n\n\tupdatedAt = 0\n\n\tfn\n\n\tsources\n\tsourceSlots\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, options)\n\n\t\tthis.fn = fn\n\n\t\tif (owner) {\n\t\t\tif (owner.owned) {\n\t\t\t\towner.owned.push(this)\n\t\t\t} else {\n\t\t\t\towner.owned = [this]\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tthis.fn()\n\t\t} catch (err) {\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\n\t\tif (this.updatedAt <= time) {\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n\n\tdispose() {\n\t\tconst { sources, sourceSlots } = this\n\n\t\tif (sources) {\n\t\t\tlet source\n\t\t\tlet observers\n\t\t\tlet index\n\n\t\t\tlet observer\n\t\t\tlet slot\n\t\t\twhile (sources.length) {\n\t\t\t\tsource = sources.pop()\n\t\t\t\tobservers = source.observers\n\n\t\t\t\tindex = sourceSlots.pop()\n\n\t\t\t\tif (observers && observers.length) {\n\t\t\t\t\tobserver = observers.pop()\n\t\t\t\t\tslot = source.observerSlots.pop()\n\n\t\t\t\t\tif (index < observers.length) {\n\t\t\t\t\t\tobserver.sourceSlots[slot] = index\n\t\t\t\t\t\tobservers[index] = observer\n\t\t\t\t\t\tsource.observerSlots[index] = slot\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuper.dispose()\n\n\t\tthis.state = CLEAN\n\t}\n}\n\nclass Effect extends Computation {\n\tuser = true\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tEffects ? Effects.push(this) : batch(() => this.update())\n\t}\n}\n\nclass SyncEffect extends Computation {\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\tbatch(() => this.update())\n\t}\n}\n\n// SIGNALS\n\nclass Memo extends Computation {\n\tstate = STALE\n\n\tpure = true\n\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\n\tconstructor(owner, fn, options) {\n\t\tsuper(owner, fn, options)\n\n\t\treturn markReactive(this.read.bind(this))\n\t}\n\n\tread() {\n\t\t// checkReadForbidden()\n\n\t\tif (this.state) {\n\t\t\tif (this.state === STALE) {\n\t\t\t\tthis.update()\n\t\t\t} else {\n\t\t\t\tconst updates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(this))\n\t\t\t\tUpdates = updates\n\t\t\t}\n\t\t}\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite(value) {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\tupdate() {\n\t\tthis.dispose()\n\n\t\tlet nextValue\n\n\t\tconst time = Time\n\n\t\tconst prevOwner = Owner\n\t\tconst prevListener = Listener\n\n\t\tListener = Owner = this\n\t\ttry {\n\t\t\tnextValue = this.fn()\n\t\t} catch (err) {\n\t\t\tthis.state = STALE\n\t\t\tif (this.owned) {\n\t\t\t\tthis.owned.forEach(node => node.dispose())\n\t\t\t\tthis.owned.length = 0\n\t\t\t}\n\t\t\tthis.updatedAt = time + 1\n\n\t\t\tthrow err\n\t\t} finally {\n\t\t\tOwner = prevOwner\n\t\t\tListener = prevListener\n\t\t}\n\t\tif (this.updatedAt <= time) {\n\t\t\tif (this.updatedAt !== 0) {\n\t\t\t\tthis.write(nextValue)\n\t\t\t} else {\n\t\t\t\tthis.value = nextValue\n\t\t\t}\n\t\t\tthis.updatedAt = time\n\t\t}\n\t}\n}\n\n// SIGNAL\n\nclass Signal {\n\tvalue\n\n\tobservers\n\tobserverSlots\n\n\t// options:\n\t// equals\n\t// save\n\n\t// `prev` if option save was given\n\n\tconstructor(value, options) {\n\t\tthis.value = value\n\t\tif (options) {\n\t\t\tassign(this, options)\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = value\n\t\t\t}\n\t\t}\n\n\t\tthis.read = markReactive(this.read)\n\t}\n\n\tread = () => {\n\t\t// checkReadForbidden()\n\n\t\tif (Listener) {\n\t\t\tconst sourceSlot = this.observers ? this.observers.length : 0\n\n\t\t\tif (Listener.sources) {\n\t\t\t\tListener.sources.push(this)\n\t\t\t\tListener.sourceSlots.push(sourceSlot)\n\t\t\t} else {\n\t\t\t\tListener.sources = [this]\n\t\t\t\tListener.sourceSlots = [sourceSlot]\n\t\t\t}\n\n\t\t\tif (this.observers) {\n\t\t\t\tthis.observers.push(Listener)\n\t\t\t\tthis.observerSlots.push(Listener.sources.length - 1)\n\t\t\t} else {\n\t\t\t\tthis.observers = [Listener]\n\t\t\t\tthis.observerSlots = [Listener.sources.length - 1]\n\t\t\t}\n\t\t}\n\n\t\treturn this.value\n\t}\n\n\twrite = value => {\n\t\tif (this.equals === false || !this.equals(this.value, value)) {\n\t\t\tif (this.save) {\n\t\t\t\tthis.prev = this.value\n\t\t\t}\n\t\t\tthis.value = value\n\t\t\tif (this.observers && this.observers.length) {\n\t\t\t\trunUpdates(() => {\n\t\t\t\t\tfor (let i = 0, observer; i < this.observers.length; i++) {\n\t\t\t\t\t\tobserver = this.observers[i]\n\n\t\t\t\t\t\tif (observer.state === CLEAN) {\n\t\t\t\t\t\t\tif (observer.pure) {\n\t\t\t\t\t\t\t\tUpdates.push(observer)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tEffects.push(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (observer.observers) {\n\t\t\t\t\t\t\t\tdownstream(observer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tobserver.state = STALE\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tupdate = value => {\n\t\tif (isFunction(value)) {\n\t\t\tvalue = value(this.value)\n\t\t}\n\t\treturn this.write(value)\n\t}\n\n\tequals(a, b) {\n\t\treturn a === b\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tyield this.read\n\t\tyield this.write\n\t\tyield this.update\n\t}\n}\n\n// API\n\n/**\n * Creates a new root\n *\n * @param {(dispose: Function) => any} fn\n * @param {object} [options]\n * @returns {any}\n */\nexport function root(fn, options = undefined) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tconst root = new Root(Owner, options)\n\n\tOwner = root\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(() => fn(() => root.dispose()), true)\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Creates a signal\n *\n * @template const T\n * @param {T} [initialValue] - Initial value of the signal\n * @param {SignalOptions} [options] - Signal options\n * @returns {SignalObject}\n */\n/* #__NO_SIDE_EFFECTS__ */\nexport function signal(initialValue, options = undefined) {\n\treturn new Signal(initialValue, options)\n}\n\n/**\n * Creates an effect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function effect(fn, options = undefined) {\n\tnew Effect(Owner, fn, options)\n}\n\n/**\n * Creates an effect with explicit dependencies\n *\n * @param {Function} depend - Function that causes tracking\n * @param {Function} fn - Function that wont cause tracking\n * @param {object} [options]\n */\nexport function on(depend, fn, options = undefined) {\n\teffect(() => {\n\t\tdepend()\n\t\tuntrack(fn)\n\t}, options)\n}\n\n/**\n * Creates a syncEffect\n *\n * @param {Function} fn\n * @param {object} [options]\n */\nexport function syncEffect(fn, options = undefined) {\n\treturn new SyncEffect(Owner, fn, options)\n}\n\n/**\n * Creates a read-only signal from the return value of a function that\n * automatically updates\n *\n * @template T\n * @param {() => T} fn - Function to re-run when dependencies change\n * @param {SignalOptions} [options]\n * @returns {SignalAccessor} - Read only signal\n */\n\n/* #__NO_SIDE_EFFECTS__ */ export function memo(\n\tfn,\n\toptions = undefined,\n) {\n\treturn new Memo(Owner, fn, options)\n}\n\n/**\n * Batches changes to signals\n *\n * @param {Function} fn\n * @returns {any}\n */\nexport const batch = runUpdates\n\n/**\n * Returns current owner\n *\n * @returns {typeof Owner}\n */\nexport function owner() {\n\treturn Owner\n}\n\nfunction runWithOwner(owner, fn) {\n\tconst prevOwner = Owner\n\tconst prevListener = Listener\n\n\tOwner = owner\n\tListener = undefined\n\n\ttry {\n\t\treturn runUpdates(fn, true)\n\t} catch (err) {\n\t\tthrow err\n\t} finally {\n\t\tOwner = prevOwner\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Disables tracking for a function\n *\n * @param {Function} fn - Function to run with tracking disabled\n * @returns {any}\n */\nexport function untrack(fn) {\n\tif (Listener === undefined) {\n\t\treturn fn()\n\t}\n\n\tconst prevListener = Listener\n\tListener = undefined\n\ttry {\n\t\treturn fn()\n\t} finally {\n\t\tListener = prevListener\n\t}\n}\n\n/**\n * Runs a callback on cleanup, returns callback\n *\n * @template T\n * @param {T} fn\n * @returns {T}\n */\nexport function cleanup(fn) {\n\tif (Owner) {\n\t\tif (Owner.cleanups) {\n\t\t\tOwner.cleanups.push(fn)\n\t\t} else {\n\t\t\tOwner.cleanups = [fn]\n\t\t}\n\t}\n\treturn fn\n}\n\n// UPDATES\n\nfunction runTop(node) {\n\tswitch (node.state) {\n\t\tcase CLEAN: {\n\t\t\treturn\n\t\t}\n\t\tcase CHECK: {\n\t\t\treturn upstream(node)\n\t\t}\n\t}\n\n\tconst ancestors = []\n\n\tdo {\n\t\tif (node.state) {\n\t\t\tancestors.push(node)\n\t\t}\n\t\tnode = node.owner\n\t} while (node && node.updatedAt < Time)\n\n\tfor (let i = ancestors.length - 1, updates; i >= 0; i--) {\n\t\tnode = ancestors[i]\n\n\t\tswitch (node.state) {\n\t\t\tcase STALE: {\n\t\t\t\tnode.update()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase CHECK: {\n\t\t\t\tupdates = Updates\n\t\t\t\tUpdates = null\n\t\t\t\trunUpdates(() => upstream(node, ancestors[0]))\n\t\t\t\tUpdates = updates\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction runUpdates(fn, init = false) {\n\tif (Updates) {\n\t\treturn fn()\n\t}\n\n\tlet wait = false\n\n\tif (!init) {\n\t\tUpdates = []\n\t}\n\n\tif (Effects) {\n\t\twait = true\n\t} else {\n\t\tEffects = []\n\t}\n\n\tTime++\n\n\ttry {\n\t\tconst res = fn()\n\n\t\tif (Updates) {\n\t\t\trunQueue(Updates)\n\t\t\tUpdates = null\n\t\t}\n\t\tif (!wait) {\n\t\t\tconst effects = Effects\n\t\t\tEffects = null\n\t\t\tif (effects.length) {\n\t\t\t\trunUpdates(() => runEffects(effects))\n\t\t\t}\n\t\t}\n\n\t\treturn res\n\t} catch (err) {\n\t\tif (!wait) {\n\t\t\tEffects = null\n\t\t}\n\t\tUpdates = null\n\n\t\tthrow err\n\t}\n}\n\nfunction runQueue(queue) {\n\tfor (let i = 0; i < queue.length; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction runEffects(queue) {\n\tlet i\n\n\tlet effect\n\tlet userLength = 0\n\tfor (i = 0; i < queue.length; i++) {\n\t\teffect = queue[i]\n\n\t\tif (!effect.user) {\n\t\t\trunTop(effect)\n\t\t} else {\n\t\t\tqueue[userLength++] = effect\n\t\t}\n\t}\n\n\tfor (i = 0; i < userLength; i++) {\n\t\trunTop(queue[i])\n\t}\n}\n\nfunction upstream(node, ignore) {\n\tnode.state = CLEAN\n\n\tfor (let i = 0, source; i < node.sources.length; i++) {\n\t\tsource = node.sources[i]\n\n\t\tif (source.sources) {\n\t\t\tswitch (source.state) {\n\t\t\t\tcase STALE: {\n\t\t\t\t\tif (source !== ignore && source.updatedAt < Time) {\n\t\t\t\t\t\trunTop(source)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase CHECK: {\n\t\t\t\t\tupstream(source, ignore)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction downstream(node) {\n\tfor (let i = 0, observer; i < node.observers.length; i++) {\n\t\tobserver = node.observers[i]\n\n\t\tif (observer.state === CLEAN) {\n\t\t\tobserver.state = CHECK\n\t\t\tif (observer.pure) {\n\t\t\t\tUpdates.push(observer)\n\t\t\t} else {\n\t\t\t\tEffects.push(observer)\n\t\t\t}\n\t\t\tobserver.observers && downstream(observer)\n\t\t}\n\t}\n}\n\nlet readForbid = false\n\nfunction checkReadForbidden() {\n\tif (readForbid) {\n\t\tconsole.trace('Signal Read!')\n\t}\n}\nexport function readForbidden(fn, value) {\n\tconst prev = readForbid\n\ttry {\n\t\treadForbid = value\n\t\treturn fn()\n\t} finally {\n\t\treadForbid = prev\n\t}\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {typeof Context} Context\n */\nexport function Context(defaultValue = undefined) {\n\tconst id = Symbol()\n\n\treturn useContext.bind(null, id, defaultValue)\n}\n\n/**\n * @overload Gets the context value\n * @returns {any} Context value\n */\n/**\n * @overload Runs `fn` with a new value as context\n * @param {any} newValue - New value for the context\n * @param {Function} fn - Callback to run with the new context value\n * @returns {Children} Children\n */\n/**\n * @param {any} newValue\n * @param {Function} fn\n */\nfunction useContext(id, defaultValue, newValue, fn) {\n\tif (newValue === undefined) {\n\t\treturn Owner?.context && Owner.context[id] !== undefined\n\t\t\t? Owner.context[id]\n\t\t\t: defaultValue\n\t} else {\n\t\tlet res\n\n\t\tsyncEffect(() => {\n\t\t\tOwner.context = {\n\t\t\t\t...Owner.context,\n\t\t\t\t[id]: newValue,\n\t\t\t}\n\t\t\tres = untrack(fn)\n\t\t})\n\n\t\treturn res\n\t}\n}\n\n/**\n * Returns an owned function\n *\n * @param {function | undefined} cb\n * @returns {() => any}\n */\nexport const owned = cb => {\n\tconst o = Owner\n\treturn (...args) => cb && runWithOwner(o, () => cb(...args))\n}\n\n/**\n * Returns true when value is reactive (a signal)\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isReactive = value =>\n\tisFunction(value) && $isReactive in value\n\n/**\n * Marks a function as reactive. Reactive functions are ran inside\n * effects.\n *\n * @param {Function} fn - Function to mark as reactive\n * @returns {Function}\n */\nexport function markReactive(fn) {\n\tfn[$isReactive] = undefined\n\treturn fn\n}\n\n/**\n * Proxies a signals property access so you dont have to call the\n * function\n *\n * @param {Signal} snigal - Signal to proxy\n * @param {object} [target] - Target object for the proxy\n * @returns {object} An object that will read the properties from the\n * signal\n */\nexport const proxy = (snigal, target = nothing) =>\n\tnew Proxy(target, {\n\t\tget(target, key) {\n\t\t\treturn snigal()[key]\n\t\t},\n\t\thas(target, key) {\n\t\t\treturn key in snigal()\n\t\t},\n\t\townKeys(target) {\n\t\t\treturn keys(snigal())\n\t\t},\n\t})\n\n/**\n * A self contained signal function, when an argument is present it\n * writes to the signal, when theres no argument it reads the signal.\n *\n * @template T\n * @param {T} [value] - Optional initial value\n * @returns {SignalFunction}\n */\nexport function signalFunction(value) {\n\tconst [read, write] = signal(value)\n\treturn markReactive((...args) =>\n\t\targs.length ? write(args[0]) : read(),\n\t)\n}\n\n/**\n * To set and read refs. To use in ref attribute.\n *\n * @template T\n * @returns {SignalFunction}\n */\nexport const ref = () => signalFunction()\n\n/**\n * Runs a function inside an effect if value is a function.\n * Aditionally unwraps promises.\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport const withValue = (value, fn) => {\n\tif (isFunction(value)) {\n\t\teffect(() => withValue(getValue(value), fn))\n\t} else if (isPromise(value)) {\n\t\tvalue.then(owned(value => withValue(value, fn)))\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Runs a function inside an effect if value is a function\n *\n * @param {any} value\n * @param {(value) => any} fn\n */\nexport function withPrevValue(value, fn) {\n\tif (isFunction(value)) {\n\t\tlet prev = undefined\n\t\teffect(() => {\n\t\t\tconst val = getValue(value)\n\t\t\tfn(val, prev)\n\t\t\tprev = val\n\t\t})\n\t} else {\n\t\tfn(value)\n\t}\n}\n\n/**\n * Lazy and writable version of `memo`, its writable and will run the\n * function only when used\n *\n * @author ryansolid\n * @param {Function} fn - Function to re-run when dependencies change\n * @returns {((...args) => any) | (() => any)}\n */\nexport function writable(fn) {\n\tconst result = memo(() => signal(fn()))\n\n\treturn markReactive((...args) => {\n\t\treturn args.length ? result().write(args[0]) : result().read()\n\t})\n}\n\n/**\n * Creates an asynchronously effect\n *\n * @param {(currentRunningEffect: Promise) => any} fn - A\n * function that receives a `currentRunningEffect` that should be\n * awaited for when wanting to run effects synchronously, that's it\n * one effect after another.\n */\nexport function asyncEffect(fn) {\n\tconst queue = []\n\teffect(() => {\n\t\tconst { promise, resolve } = withResolvers()\n\n\t\tqueue.push(promise)\n\n\t\tfunction onDone() {\n\t\t\tremoveFromArray(queue, promise)\n\t\t\tresolve()\n\t\t}\n\n\t\tresolved(\n\t\t\tfn(queue.length === 1 ? undefined : queue[queue.length - 2]),\n\t\t\tonDone,\n\t\t)\n\t})\n}\n\n/**\n * A Promise loader handler. Allows to display/run something or\n * nothing while a promise is resolving. Allows to run a callback when\n * the promise resolves. Allows to get notified of errors, and\n * display/run something or nothing, if wanted a `retry` function is\n * given for retrying the promise. All functions run with the original\n * owner, so it's `Context` friendly.\n *\n * @param {(() => Promise) | Promise} fn - Function that\n * returns a promise\n * @param {{\n * \tonLoading?: any\n * \tonLoaded?: Function\n * \tonError?: ((e: Error, retry: Function) => any) | any\n * }} [options]\n *\n * @returns {Component}\n * @url https://pota.quack.uy/lazy\n */\nexport const lazy = (fn, options = nothing) =>\n\tmarkComponent(props => {\n\t\tconst { onLoading, onLoaded, onError } = options\n\n\t\tconst [value, setValue] = signal(onLoading)\n\n\t\tconst _onLoaded = owned(onLoaded)\n\n\t\tconst retry = () =>\n\t\t\tPromise.resolve(isFunction(fn) ? fn() : fn)\n\t\t\t\t.then(r => {\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tmarkComponent(() => {\n\t\t\t\t\t\t\tr = isObject(r) && r.default ? r.default : r\n\t\t\t\t\t\t\treturn isFunction(r) ? r(props) : r\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t\tmicrotask(_onLoaded)\n\t\t\t\t})\n\t\t\t\t.catch(e =>\n\t\t\t\t\tonError\n\t\t\t\t\t\t? setValue(\n\t\t\t\t\t\t\t\tmarkComponent(() =>\n\t\t\t\t\t\t\t\t\tisFunction(onError) ? onError(e, retry) : onError,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: console.error(e),\n\t\t\t\t)\n\t\tretry()\n\n\t\treturn value\n\t})\n\nexport const Lazy = props => lazy(props.children, props)\n\nexport const microtask = fn => queueMicrotask(owned(fn))\n\n// MAP\n\n/**\n * Reactive Map\n *\n * @template T\n * @param {Each} list\n * @param {Function} callback\n * @param {boolean} [sort]\n */\nexport function map(list, callback, sort) {\n\tconst cache = new Map()\n\tconst duplicates = new Map() // for when caching by value is not possible [1, 2, 1, 1, 1]\n\n\tlet runId = 0\n\n\tlet rows = []\n\t/** @type any[] */\n\tlet prev = []\n\n\tfunction clear() {\n\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\tprev[i].dispose(true)\n\t\t}\n\t\tcache.clear()\n\t\tduplicates.clear()\n\n\t\trows.length = 0\n\t\tprev.length = 0\n\t}\n\n\t// to get rid of all nodes when parent disposes\n\tcleanup(clear)\n\n\tclass Row {\n\t\tconstructor(item, index, fn, isDupe) {\n\t\t\tthis.runId = -1\n\t\t\tthis.item = item\n\t\t\tthis.index = index\n\t\t\tthis.isDupe = isDupe\n\t\t\tthis.disposer = undefined\n\t\t\tthis.nodes = root(disposer => {\n\t\t\t\tthis.disposer = disposer\n\t\t\t\t/** @type Children[] */\n\t\t\t\treturn fn(item, index)\n\t\t\t})\n\t\t}\n\t\tget begin() {\n\t\t\treturn this.nodes[0]\n\t\t}\n\t\tget end() {\n\t\t\treturn this.nodes[this.nodes.length - 1]\n\t\t}\n\t\tdispose(all) {\n\t\t\t// skip cache deletion as we are going to clear the full map\n\t\t\tif (all === undefined) {\n\t\t\t\t// delete from cache\n\t\t\t\tif (!this.isDupe) {\n\t\t\t\t\tcache.delete(this.item)\n\t\t\t\t} else {\n\t\t\t\t\tconst arr = duplicates.get(this.item)\n\t\t\t\t\tarr.length === 1\n\t\t\t\t\t\t? duplicates.delete(this.item)\n\t\t\t\t\t\t: removeFromArray(arr, this)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.disposer()\n\t\t}\n\t}\n\n\t/**\n\t * @param {Function} fn\n\t * @returns {Children}\n\t */\n\tfunction mapper(fn) {\n\t\tconst cb = fn\n\t\t\t? (item, index) => fn(callback(item, index), index)\n\t\t\t: callback\n\n\t\tconst value = getValue(list) || []\n\n\t\t/** To allow iterate objects as if were an array with indexes */\n\t\tconst items = isIterable(value) ? value.entries() : entries(value)\n\n\t\trunId++\n\t\trows = []\n\t\tconst hasPrev = prev.length\n\n\t\tfor (const [index, item] of items) {\n\t\t\tlet row = hasPrev ? cache.get(item) : undefined\n\n\t\t\t// if the item doesnt exists, create it\n\t\t\tif (row === undefined) {\n\t\t\t\trow = new Row(item, index, cb, false)\n\t\t\t\tcache.set(item, row)\n\t\t\t} else if (row.runId === runId) {\n\t\t\t\t// a map will save only 1 of any primitive duplicates, say: [1, 1, 1, 1]\n\t\t\t\t// if the saved value was already used on this run, create a new one\n\t\t\t\tlet dupes = duplicates.get(item)\n\t\t\t\tif (!dupes) {\n\t\t\t\t\tdupes = []\n\t\t\t\t\tduplicates.set(item, dupes)\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < dupes.length; i++) {\n\t\t\t\t\tif (dupes[i].runId !== runId) {\n\t\t\t\t\t\trow = dupes[i]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (row.runId === runId) {\n\t\t\t\t\trow = new Row(item, index, cb, true)\n\t\t\t\t\tdupes.push(row)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trow.runId = runId // mark used on this run\n\t\t\trow.index = index // save sort order\n\t\t\trows.push(row)\n\t\t}\n\n\t\t// remove rows that arent present on the current run\n\t\tif (rows.length === 0) {\n\t\t\tclear()\n\t\t} else {\n\t\t\tfor (let i = 0; i < prev.length; i++) {\n\t\t\t\tif (prev[i].runId !== runId) {\n\t\t\t\t\tprev[i].dispose()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// reorder elements\n\t\t// `rows.length > 1` because no need for sorting when there are no items\n\t\t// prev.length > 0 to skip sorting on creation as its already sorted\n\t\tif (sort && rows.length > 1 && prev.length) {\n\t\t\t// if the planets align it handles swapping\n\t\t\t// a = sorted\n\t\t\t// b = unsorted\n\t\t\tconst { a, b } = groupBy(rows, (value, index) =>\n\t\t\t\trows[index] === prev[index] ? 'a' : 'b',\n\t\t\t)\n\n\t\t\tlet unsorted = b?.length\n\t\t\tif (\n\t\t\t\ta &&\n\t\t\t\tb &&\n\t\t\t\ta.length &&\n\t\t\t\tb.length &&\n\t\t\t\tb.length < a.length &&\n\t\t\t\tb.every(item => prev.includes(item))\n\t\t\t) {\n\t\t\t\tfor (const usort of b) {\n\t\t\t\t\tfor (const sort of a) {\n\t\t\t\t\t\tif (usort.index === sort.index - 1) {\n\t\t\t\t\t\t\tsort.begin.before(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t} else if (usort.index === sort.index + 1) {\n\t\t\t\t\t\t\tsort.end.after(...nodesFromRow(usort))\n\t\t\t\t\t\t\tunsorted--\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unsorted) {\n\t\t\t\t// handles all other cases\n\t\t\t\t// best for any combination of: push/pop/shift/unshift/insertion/deletion\n\t\t\t\t// must check in reverse as on creation stuff is added to the end\n\n\t\t\t\tlet current = rows[rows.length - 1]\n\t\t\t\tfor (let i = rows.length - 1; i > 0; i--) {\n\t\t\t\t\tconst previous = rows[i - 1]\n\t\t\t\t\tif (current.begin.previousSibling !== previous.end) {\n\t\t\t\t\t\tcurrent.begin.before(...nodesFromRow(previous))\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = previous\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// save sorted list\n\t\tprev = rows\n\n\t\t// return external representation\n\t\treturn rows.map(item => item.nodes)\n\t}\n\tmapper[$isMap] = undefined\n\treturn mapper\n}\n\nfunction nodesFromRow(row) {\n\tconst { begin, end } = row\n\tconst nodes = [begin]\n\n\tlet nextSibling = begin\n\twhile (nextSibling !== end) {\n\t\tnextSibling = nextSibling.nextSibling\n\t\tnodes.push(nextSibling)\n\t}\n\n\treturn nodes\n}\n\n/**\n * Resolves and returns `children` in a memo\n *\n * @param {Function | Children} fn\n * @returns {Function} Memo\n * @url https://pota.quack.uy/resolve\n */\nexport function resolve(fn) {\n\tconst children = isFunction(fn) ? memo(fn) : () => fn\n\treturn memo(() => unwrap(children()))\n}\n\n/**\n * Recursively unwrap children functions\n *\n * @param {Children} children\n * @returns {Children}\n */\nfunction unwrap(children) {\n\tif (isFunction(children)) {\n\t\treturn unwrap(children())\n\t}\n\n\tif (isArray(children)) {\n\t\tconst childrens = []\n\t\tfor (let child of children) {\n\t\t\tchild = unwrap(child)\n\t\t\tisArray(child)\n\t\t\t\t? childrens.push(...child)\n\t\t\t\t: childrens.push(child)\n\t\t}\n\t\treturn childrens\n\t}\n\n\treturn children\n}\n\n/**\n * Extend `Pota` and define a `render(props){}` method to create a\n * class component. `ready(cb)` and `cleanup(cb)` methods will be\n * registered automatically\n *\n * @url https://pota.quack.uy/Classes\n */\nexport class Pota {}\n\nPota[$isClass] = undefined\n\n/**\n * Returns true if the `value` is a `Component`\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponent = value =>\n\tisFunction(value) && $isComponent in value\n\n/**\n * Returns true if the value can be made a Component\n *\n * @param {any} value\n * @returns {boolean}\n */\nexport const isComponentable = value =>\n\t!isReactive(value) &&\n\t(isFunction(value) ||\n\t\t// avoid [1,2] and support { toString(){ return \"something\"} }\n\t\t(!isArray(value) && isObject(value) && !value.then))\n\n/**\n * Makes of `children` a function. Reactive children will run as is,\n * non-reactive children will run untracked, regular children will\n * just return.\n *\n * @param {Children} children\n * @returns {Function}\n */\nexport function makeCallback(children) {\n\t/**\n\t * When children is an array, as in >${[0, 1, 2]}< then children\n\t * will end as `[[0, 1, 2]]`, so flat it\n\t */\n\n\tchildren = isArray(children) ? flat(children) : children\n\n\tconst callbacks = !isArray(children)\n\t\t? callback(children)\n\t\t: children.map(callback)\n\n\treturn !isArray(children)\n\t\t? markComponent((...args) => callbacks(args))\n\t\t: markComponent((...args) =>\n\t\t\t\tcallbacks.map(callback => callback(args)),\n\t\t\t)\n}\n\nconst callback = child =>\n\tisFunction(child)\n\t\t? isReactive(child)\n\t\t\t? args => {\n\t\t\t\t\t/**\n\t\t\t\t\t * The function inside the `for` is saved in a signal. The\n\t\t\t\t\t * result of the signal is our callback\n\t\t\t\t\t *\n\t\t\t\t\t * ```js\n\t\t\t\t\t * htmlEffect(\n\t\t\t\t\t * \thtml =>\n\t\t\t\t\t * \t\thtml`\n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\tname \n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t\t\n\t\t\t\t\t * \t\t\t\t${item =>\n\t\t\t\t\t * \t\t\t\t\thtml`\n\t\t\t\t\t * \t\t\t\t\t\t${item.name} \n\t\t\t\t\t * \t\t\t\t\t `}\n\t\t\t\t\t * \t\t\t \n\t\t\t\t\t * \t\t
`,\n\t\t\t\t\t * )\n\t\t\t\t\t * ```\n\t\t\t\t\t */\n\t\t\t\t\tconst r = child()\n\t\t\t\t\treturn isFunction(r)\n\t\t\t\t\t\t? isReactive(r)\n\t\t\t\t\t\t\t? r()\n\t\t\t\t\t\t\t: untrack(() => r(...args))\n\t\t\t\t\t\t: r\n\t\t\t\t}\n\t\t\t: args => untrack(() => child(...args))\n\t\t: () => child\n\n// allows to tell a `signal function` from a `component function`\n// signals and user functions go in effects, for reactivity\n// components and callbacks are untracked and wont go in effects to avoid re-rendering\n\n/**\n * Marks a function as a `Component`.\n *\n * @param {Function} fn - Function to mark as a `Component`\n * @returns {Component}\n */\nexport function markComponent(fn) {\n\tfn[$isComponent] = undefined\n\treturn fn\n}\n\n/**\n * Unwraps components till it gets a value. To keep context relevant\n * to the component\n *\n * @param {Function | any} value - Maybe function\n * @returns {any}\n */\nexport function getValueComponent(value) {\n\twhile ($isComponent in value) value = value()\n\treturn value\n}\n\n/**\n * Adds an event listener to a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `off` function for removing the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function addEventListener(node, type, handler) {\n\tnode.addEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\t/**\n\t * Removes event on tracking scope disposal.\n\t *\n\t * Situation: the event was added to the `document` manually using\n\t * `addEventListener`, say to listen for clicks as a \"click\n\t * outside\". The event needs to be removed when the component that\n\t * added it is disposed.\n\t */\n\n\treturn cleanup(() => removeEventListener(node, type, handler))\n}\n\n/**\n * Removes an event listener from a node\n *\n * @param {Element} node - Element to add the event listener\n * @param {(keyof WindowEventMap & keyof GlobalEventHandlersEventMap)\n * \t| string} type\n * - The name of the event listener\n *\n * @param {EventListener\n * \t| EventListenerObject\n * \t| (EventListenerObject & AddEventListenerOptions)} handler\n * - Function to handle the event\n *\n * @returns {Function} - An `on` function for adding back the event\n * listener\n * @url https://pota.quack.uy/props/EventListener\n */\nexport function removeEventListener(node, type, handler) {\n\tnode.removeEventListener(\n\t\ttype,\n\t\thandler,\n\t\t!isFunction(handler) && handler,\n\t)\n\n\treturn () => addEventListener(node, type, handler)\n}\n\n/**\n * It gives a handler an owner, so stuff runs batched on it, and\n * things like context and cleanup work\n */\nexport const ownedEvent = handler =>\n\t'handleEvent' in handler\n\t\t? {\n\t\t\t\t...handler,\n\t\t\t\thandleEvent: owned(e => handler.handleEvent(e)),\n\t\t\t}\n\t\t: owned(handler)\n","import { owned } from './lib/reactive.js'\nimport { call, queueMicrotask } from './lib/std.js'\n\n/**\n * The purpose of this file is to guarantee the timing of some\n * callbacks. It queues a microtask, then the callbacks are added to a\n * position in the array. These are run with a priority.\n */\n\n/** @type boolean */\nlet added\n\n/** @type [][] */\nlet queue\n\nfunction reset() {\n\tqueue = [[], [], [], [], [], []]\n\tadded = false\n}\n\n// initialization\nreset()\n\n/**\n * Queues a callback at a priority\n *\n * @param {PropertyKey} priority - Priority\n * @param {Function} fn - Function to run once the callbacks at this\n * priority run\n */\nfunction add(priority, fn) {\n\tif (!added) {\n\t\tadded = true\n\t\tqueueMicrotask(run)\n\t}\n\tqueue[priority].push(owned(fn))\n}\n\n/** Runs all queued callbacks */\nfunction run() {\n\tconst q = queue\n\treset()\n\n\tfor (const fns of q) {\n\t\tfns.length && call(fns)\n\t}\n}\n\n/**\n * Queue a function to run before everything else (onProps, onRef,\n * onMount, ready) ex focus restoration\n *\n * @param {Function} fn\n */\nexport const onFixes = fn => add(0, fn)\n\n/**\n * Queue a function to run before (onRef, onMount, ready) ex running\n * user functions on elements via plugins\n *\n * @param {Function} fn\n */\nexport const onProps = fn => add(1, fn)\n\n/**\n * Queue a function to run onRef (before onMount, after onProps)\n *\n * @param {Function} fn\n */\nexport const onRef = fn => add(2, fn)\n\n/**\n * Queue a function to run onMount (before ready, after onRef)\n *\n * @param {Function} fn\n */\nexport const onMount = fn => add(3, fn)\n\n/**\n * Queue a function to run on ready (after onMount)\n *\n * @param {Function} fn\n * @url https://pota.quack.uy/ready\n */\nexport const ready = fn => add(4, fn)\n\n/**\n * Queue a function to run after all user defined processes\n *\n * @param {Function} fn\n */\nexport const onDone = fn => add(5, fn)\n","import { addEventListener, ownedEvent } from '../lib/reactive.js'\nimport { window, withCache } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {EventListenerOrEventListenerObject} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setEventNS = (node, name, value, props, localName, ns) =>\n\taddEventListener(node, localName, ownedEvent(value))\n\n/**\n * Returns an event name when the string could be mapped to an event\n *\n * @param {string} name - String to check for a mapped event\n * @returns {string | undefined} Returns the event name or null in\n * case isnt found\n */\nexport const eventName = withCache(name =>\n\tname.startsWith('on') && name.toLowerCase() in window\n\t\t? name.slice(2).toLowerCase()\n\t\t: null,\n)\n","import { cacheStore } from '../lib/std.js'\nimport { onProps } from '../scheduler.js'\n\nexport const plugins = cacheStore()\nexport const pluginsNS = cacheStore()\n\n/**\n * Defines a prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - To avoid the problem of\n * needed props not being set, or children elements not created yet.\n * Default is `true`\n * @url https://pota.quack.uy/props/propsPlugin\n */\nexport const propsPlugin = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n}\n\n/**\n * Defines a namespaced prop that can be used on any Element\n *\n * @param {string} NSName - Name of the namespace\n * @param {(\n * \tnode: Elements,\n * \tpropName: string,\n * \tpropValue: Function | any,\n * \tprops: object,\n * \tlocalName: string,\n * \tns: string,\n * ) => void} fn\n * - Function to run when this prop is found on any Element\n *\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginNS = (NSName, fn, onMicrotask) => {\n\tplugin(pluginsNS, NSName, fn, onMicrotask)\n}\n\n/**\n * Defines prop and namespaced prop that can be used on any Element\n *\n * @param {string} propName - Name of the prop/namespace\n * @param {Function} fn - Function to run when this prop is found on\n * any Element\n * @param {boolean} [onMicrotask=true] - Set to run on a microtask to\n * avoid the problem of needed props not being set, or children\n * elements not being created yet. Default is `true`\n */\nexport const propsPluginBoth = (propName, fn, onMicrotask) => {\n\tplugin(plugins, propName, fn, onMicrotask)\n\tplugin(pluginsNS, propName, fn, onMicrotask)\n}\n\nconst plugin = (plugins, name, fn, onMicrotask = true) => {\n\tplugins.set(\n\t\tname,\n\t\t!onMicrotask ? fn : (...args) => onProps(() => fn(...args)),\n\t)\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\nimport { NS } from '../constants.js'\n\n// NODE ATTRIBUTES\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setAttributeNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setAttribute(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n * @url https://pota.quack.uy/props/setAttribute\n */\nexport const setAttribute = (node, name, value, ns) =>\n\twithValue(value, value => _setAttribute(node, name, value, ns))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {string} [ns]\n */\nfunction _setAttribute(node, name, value, ns) {\n\t// if the value is null or undefined it will be removed\n\tif (isNullUndefined(value)) {\n\t\tns && NS[ns]\n\t\t\t? node.removeAttributeNS(NS[ns], name)\n\t\t\t: node.removeAttribute(name)\n\t} else {\n\t\tns && NS[ns]\n\t\t\t? node.setAttributeNS(NS[ns], name, value)\n\t\t\t: node.setAttribute(name, value)\n\t}\n}\n","import { withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setPropertyNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) => setProperty(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setProperty\n */\nexport const setProperty = (node, name, value) =>\n\twithValue(value, value => _setProperty(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport function _setProperty(node, name, value) {\n\t// if the value is null or undefined it will be set to null\n\tif (isNullUndefined(value)) {\n\t\t// defaulting to undefined breaks `progress` tag and the whole page\n\t\tnode[name] = null\n\t} else {\n\t\tnode[name] = value\n\t}\n}\n","// NODE UNKNOWN PROPERTIES / ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\nimport {\n\tgetPrototypeOf,\n\tgetSetterNamesFromPrototype,\n} from '../lib/std.js'\nimport { setAttribute } from './attribute.js'\nimport { setProperty } from './property.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const setUnknown = (node, name, value, ns) => {\n\twithValue(value, value => _setUnknown(node, name, value, ns))\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {string} [ns]\n */\nexport const _setUnknown = (node, name, value, ns) => {\n\tif (typeof value !== 'string' && setters(node).element.has(name)) {\n\t\t/**\n\t\t * 1. First check in element because a custom-element may overwrite\n\t\t * builtIn setters\n\t\t * 2. Only do this when it's different to a string to avoid coarcing\n\t\t * on native elements (ex: (img.width = '16px') === 0)\n\t\t */\n\t\tsetProperty(node, name, value)\n\t} else if (setters(node).builtIn.has(name)) {\n\t\t// ex: innerHTML, textContent, draggable={true}\n\t\tsetProperty(node, name, value)\n\t} else {\n\t\tsetAttribute(node, name, value, ns)\n\t}\n}\n\nconst elements = new Map()\n\n/** @param {Element} node */\nfunction setters(node) {\n\t/**\n\t * Use `node.constructor` instead of `node.nodeName` because it\n\t * handles the difference between `a` `HTMLAnchorElement` and `a`\n\t * `SVGAElement`\n\t */\n\tlet setters = elements.get(node.constructor)\n\tif (setters) return setters\n\tsetters = { builtIn: new Set(builtInSetters), element: new Set() }\n\telements.set(node.constructor, setters)\n\n\tlet store = setters.element\n\tlet proto = getPrototypeOf(node)\n\n\t/**\n\t * Stop at `Element` instead of `HTMLElement` because it handles the\n\t * difference between `HTMLElement`, `SVGElement`, `FutureElement`\n\t * etc\n\t */\n\twhile (proto.constructor !== Element) {\n\t\tconst nextProto = getPrototypeOf(proto)\n\n\t\t/**\n\t\t * The previous prototype to `Element` is a `builtIn`\n\t\t * (`HTMLElement`, `SVGElement`,`FutureElement`, etc)\n\t\t */\n\t\tif (nextProto.constructor === Element) {\n\t\t\tstore = setters.builtIn\n\t\t}\n\t\tgetSetterNamesFromPrototype(proto, store)\n\t\tproto = nextProto\n\t}\n\n\treturn setters\n}\n\n/** Setters shared by all kind of elements */\nconst builtInSetters = getSetterNamesFromPrototype(\n\tElement.prototype,\n\tgetSetterNamesFromPrototype(Node.prototype),\n)\n","// BOOL ATTRIBUTES\n\nimport { withValue } from '../lib/reactive.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setBoolNS = (node, name, value, props, localName, ns) =>\n\tsetBool(node, localName, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @url https://pota.quack.uy/props/setBool\n */\nexport const setBool = (node, name, value) =>\n\twithValue(value, value => _setBool(node, name, value))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const _setBool = (node, name, value) =>\n\t// if the value is falsy gets removed\n\tvalue ? node.setAttribute(name, '') : node.removeAttribute(name)\n","// node style\n\nimport { withValue } from '../lib/reactive.js'\nimport { getValue, isNullUndefined, isObject } from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @url https://pota.quack.uy/props/setStyle\n */\nexport const setStyle = (node, name, value, props) =>\n\tsetNodeStyle(node.style, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setStyleNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(\n\t\tnode.style,\n\t\tisObject(value) ? value : { [localName]: value },\n\t)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setVarNS = (node, name, value, props, localName, ns) =>\n\tsetNodeStyle(node.style, { ['--' + localName]: value })\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {unknown} value\n */\nfunction setNodeStyle(style, value) {\n\tif (isObject(value)) {\n\t\tlet name\n\t\tfor (name in value) {\n\t\t\tsetStyleValue(style, name, value[name])\n\t\t}\n\t\treturn\n\t}\n\tconst type = typeof value\n\tif (type === 'string') {\n\t\tstyle.cssText = value\n\t\treturn\n\t}\n\tif (type === 'function') {\n\t\twithValue(value, value => setNodeStyle(style, getValue(value)))\n\t\treturn\n\t}\n}\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementStyle = (node, name, value) =>\n\tsetStyleValue(node.style, name, value)\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {unknown} value\n */\nconst setStyleValue = (style, name, value) =>\n\twithValue(value, value => _setStyleValue(style, name, value))\n\n/**\n * @param {CSSStyleDeclaration} style\n * @param {string} name\n * @param {string | null} value\n */\nconst _setStyleValue = (style, name, value) =>\n\t// if the value is null or undefined it will be removed\n\tisNullUndefined(value)\n\t\t? style.removeProperty(name)\n\t\t: style.setProperty(name, value)\n","// node class / classList\n\nimport { withPrevValue, withValue } from '../lib/reactive.js'\nimport {\n\tclassListAdd,\n\tclassListRemove,\n\tisFunction,\n\tisString,\n} from '../lib/std.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n */\nexport const setClass = (node, name, value, props) =>\n\tisString(value)\n\t\t? node.setAttribute('class', value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {object | string | ArrayLike} value\n * @param {object} props\n * @param {string} localName\n * @param {string} ns\n */\nexport const setClassNS = (\n\tnode,\n\tname,\n\tvalue,\n\tprops,\n\tlocalName,\n\tns,\n) =>\n\tisFunction(value)\n\t\t? setElementClass(node, localName, value)\n\t\t: setClassList(node, value)\n\n/**\n * @param {Element} node\n * @param {object | string | ArrayLike} value\n */\nfunction setClassList(node, value) {\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t_setClassListValue(node, value, true)\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'object': {\n\t\t\tlet name\n\t\t\tfor (name in value) {\n\t\t\t\tsetElementClass(node, name, value[name])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase 'function': {\n\t\t\twithValue(value, value => setClassList(node, value))\n\t\t\tbreak\n\t\t}\n\t}\n}\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\nexport const setElementClass = (node, name, value) =>\n\twithPrevValue(value, (value, prev) => {\n\t\t// on initialization do not remove whats not there\n\t\tif (!value && !prev) {\n\t\t} else {\n\t\t\t_setClassListValue(node, name, value)\n\t\t}\n\t})\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {unknown} value\n */\n\nconst _setClassListValue = (node, name, value) =>\n\t// null, undefined or false, the class is removed\n\t!value\n\t\t? classListRemove(node, name)\n\t\t: classListAdd(node, ...name.trim().split(/\\s+/))\n","import { cleanup, withValue } from '../lib/reactive.js'\nimport { isNullUndefined } from '../lib/std.js'\nimport { _setProperty } from './property.js'\n\n/**\n * `value` as a prop is special cased so the button `reset` in forms\n * works as expected. The first time a value is set, its done as an\n * attribute.\n */\nexport const setValue = (node, name, value) =>\n\twithValue(value, value => _setValue(node, name, value))\n\nconst defaults = new Set()\n\nfunction _setValue(node, name, value) {\n\tif (!defaults.has(node)) {\n\t\tdefaults.add(node)\n\t\tcleanup(() => defaults.delete(node))\n\n\t\tif (!isNullUndefined(value)) {\n\t\t\tswitch (node.localName) {\n\t\t\t\tcase 'input': {\n\t\t\t\t\tnode.setAttribute('value', value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tcase 'textarea': {\n\t\t\t\t\tnode.textContent = value\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t_setProperty(node, name, value)\n}\n","/** Returns true or false with a `chance` of getting `true` */\nexport const chance = (chance = 50, generator = random) => {\n\treturn generator() < chance / 100\n}\n\n/** Returns random number between 0 and 1 */\nexport const random = () =>\n\tcrypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1)\n\nexport const randomBetween = (min, max, generator = random) =>\n\tMath.floor(generator() * (max - min + 1)) + min\n\nexport const randomColor = (min = 0, max = 255) =>\n\t'rgb(' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t',' +\n\trandomBetween(min, max) +\n\t')'\n\nexport const randomId = () =>\n\tcrypto.getRandomValues(new BigUint64Array(1))[0].toString(36)\n\n/**\n * Returns a random number generator based no a seed that generates\n * numbers between 0 and 1\n */\nexport function randomSeeded(seed) {\n\tconst m = 2 ** 35 - 31\n\tlet s = seed % m\n\treturn () => (s = (s * 185852) % m) / m\n}\n","import {\n\tadoptedStyleSheetsAdd,\n\tclassListAdd,\n\tgetDocumentForElement,\n\tsheet,\n\twithState,\n} from '../lib/std.js'\n\nimport { randomId } from '../plugin/useRandom.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {string} value\n * @param {object} props\n */\nexport const setCSS = (node, name, value, props) =>\n\tsetNodeCSS(node, value)\n\n/**\n * @param {Element} node\n * @param {string} value\n */\nconst setNodeCSS = withState((state, node, value) => {\n\tclassListAdd(\n\t\tnode,\n\t\tstate.get(value, value => {\n\t\t\tconst id = 'c' + randomId()\n\t\t\tadoptedStyleSheetsAdd(\n\t\t\t\tgetDocumentForElement(node),\n\t\t\t\tsheet(value.replace(/class/g, '.' + id)),\n\t\t\t)\n\t\t\treturn id\n\t\t}),\n\t)\n})\n","import { cleanup } from '../lib/reactive.js'\n\nimport { onMount, onRef } from '../scheduler.js'\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setRef = (node, name, value, props) =>\n\tonRef(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setOnMount = (node, name, value, props) =>\n\tonMount(() => value(node))\n\n/**\n * @param {Element} node\n * @param {string} name\n * @param {Function} value\n * @param {object} props\n */\nexport const setUnmount = (node, name, value, props) =>\n\tcleanup(() => value(node))\n","import {\n\taddEventListener,\n\towned,\n\townedEvent,\n} from '../lib/reactive.js'\nimport { getValue, isObject } from '../lib/std.js'\n\nimport { eventName } from './event.js'\n\nimport {\n\tplugins,\n\tpluginsNS,\n\tpropsPlugin,\n\tpropsPluginBoth,\n\tpropsPluginNS,\n} from './plugin.js'\nimport { setUnknown } from './unknown.js'\n\n// exports\n\nexport { setAttribute } from './attribute.js'\nexport { setBool } from './bool.js'\nexport { setProperty } from './property.js'\nexport { setUnknown } from './unknown.js'\nexport { setElementStyle as setStyle } from './style.js'\nexport { setElementClass as setClass } from './class.js'\n\n// PLUGINS NS\n\n// namespaced attributes/properties\n\nimport { setPropertyNS } from './property.js'\npropsPluginNS('prop', setPropertyNS, false)\n\nimport { setAttributeNS } from './attribute.js'\npropsPluginNS('attr', setAttributeNS, false)\n\nimport { setBoolNS } from './bool.js'\npropsPluginNS('bool', setBoolNS, false)\n\n// events\n\nimport { setEventNS } from './event.js'\npropsPluginNS('on', setEventNS, false)\n\n// var\n\nimport { setVarNS } from './style.js'\npropsPluginNS('var', setVarNS, false)\n\n// PLUGINS REGULAR\n\n// noop\n\nimport { noop } from '../lib/std.js'\npropsPlugin('__dev', noop, false)\npropsPlugin('xmlns', noop, false)\n\n// value\n\nimport { setValue } from './value.js'\npropsPlugin('value', setValue, false)\n\n// PLUGIN BOTH\n\n// css\n\nimport { setCSS } from './css.js'\npropsPluginBoth('css', setCSS, false)\n\n// mount\n\nimport { setOnMount } from './lifecycle.js'\npropsPluginBoth('onMount', setOnMount, false)\n\n// unmount\n\nimport { setUnmount } from './lifecycle.js'\npropsPluginBoth('onUnmount', setUnmount, false)\n\n// ref\n\nimport { setRef } from './lifecycle.js'\npropsPluginBoth('ref', setRef, false)\n\n// PLUGIN BOTH DIFFERENT\n\n// styles\n\nimport { setStyle, setStyleNS } from './style.js'\npropsPlugin('style', setStyle, false)\npropsPluginNS('style', setStyleNS, false)\n\n// class\n\nimport { setClass, setClassNS } from './class.js'\npropsPlugin('class', setClass, false)\npropsPluginNS('class', setClassNS, false)\n\n// catch all\n\n/**\n * Assigns props to an Element\n *\n * @param {Element} node - Element to which assign props\n * @param {object} props - Props to assign\n */\nexport function assignProps(node, props) {\n\tfor (const name in props) {\n\t\tassignProp(node, name, props[name], props)\n\t}\n}\n\n/**\n * Assigns a prop to an Element\n *\n * @param {Element} node\n * @param {string} name\n * @param {any} value\n * @param {object} props\n */\nexport function assignProp(node, name, value, props) {\n\t// run plugins\n\tlet plugin = plugins.get(name)\n\tif (plugin) {\n\t\tplugin(node, name, value, props)\n\t\treturn\n\t}\n\n\t// onClick={handler}\n\tlet event = eventName(name)\n\tif (event) {\n\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\treturn\n\t}\n\n\tif (name.includes(':')) {\n\t\t// with ns\n\t\tconst [ns, localName] = name.split(':')\n\n\t\t// run plugins NS\n\t\tplugin = pluginsNS.get(ns)\n\t\tif (plugin) {\n\t\t\tplugin(node, name, value, props, localName, ns)\n\t\t\treturn\n\t\t}\n\n\t\t// onClick:my-ns={handler}\n\t\tevent = eventName(ns)\n\t\tif (event) {\n\t\t\t// `value &&` for when `onClick={handler}` and `handler` is undefined\n\t\t\tvalue && addEventListener(node, event, ownedEvent(value))\n\t\t\treturn\n\t\t}\n\n\t\tsetUnknown(node, name, value, ns)\n\t\treturn\n\t}\n\n\t// catch all\n\tsetUnknown(node, name, value)\n}\n","// CONSTANTS\n\nimport { $isClass, $isMap, NS } from './constants.js'\n\n// LIB\n\nimport {\n\tcleanup,\n\tContext,\n\teffect,\n\tisReactive,\n\troot,\n\tsignal,\n\tuntrack,\n} from './lib/reactive.js'\n\nimport {\n\tadoptedStyleSheetsAdd,\n\tadoptedStyleSheetsRemove,\n\tcreateElement,\n\tcreateElementNS,\n\tcreateTextNode,\n\tCSSStyleSheet,\n\tdocument,\n\tDocumentFragment,\n\tflat,\n\tfreeze,\n\tgetDocumentForElement,\n\timportNode,\n\tisArray,\n\tisConnected,\n\titerator,\n\tnothing,\n\tquerySelector,\n\tresolved,\n\tstringify,\n\ttoArray,\n\twalkElements,\n} from './lib/std.js'\n\nimport {\n\tisComponent,\n\tisComponentable,\n\tmarkComponent,\n} from './lib/reactive.js'\n\nimport { onFixes, ready } from './scheduler.js'\n\n// PROPERTIES / ATTRIBUTES\n\nimport { assignProps } from './props/@main.js'\nimport { propsPlugin } from './props/plugin.js'\n\n// STATE\n\nconst useXMLNS = context()\n\n// COMPONENTS\n\n/**\n * Used by the regular JSX transform, as `<>...>` or\n * `... `.\n */\nexport const Fragment = props => props.children\n\n/**\n * Creates components for things. When props argument is given, the\n * props become fixed. When props argument is ommited, it allows you\n * to keep calling the returned function with new props. Returns a\n * function because we need to render from parent to children instead\n * of from children to parent. This allows to properly set the\n * reactivity tree (think of nested effects that clear inner effects,\n * context, etc).\n *\n * @param {string | Function | Element | object | symbol} value -\n * Component\n * @param {any} [props] Object\n * @url https://pota.quack.uy/Component\n */\n\nexport function Component(value, props) {\n\tif (value === Fragment) {\n\t\treturn props.children\n\t}\n\n\t/** Freeze props so isnt directly writable */\n\tfreeze(props)\n\n\t/** Create a callable function to pass `props` */\n\tconst component = Factory(value)\n\n\treturn props === undefined\n\t\t? component\n\t\t: markComponent(propsOverride =>\n\t\t\t\tcomponent(\n\t\t\t\t\tpropsOverride\n\t\t\t\t\t\t? freeze({ ...props, ...propsOverride })\n\t\t\t\t\t\t: props,\n\t\t\t\t),\n\t\t\t)\n}\n\n/**\n * Creates a component that could be called with a props object\n *\n * @template T\n * @param {any} value\n * @returns {Component}\n */\n\nfunction Factory(value) {\n\tif (isComponent(value)) {\n\t\treturn value\n\t}\n\n\tswitch (typeof value) {\n\t\tcase 'string': {\n\t\t\t// string component, 'div' becomes \n\t\t\treturn markComponent(props => createTag(value, props))\n\t\t}\n\t\tcase 'function': {\n\t\t\tif ($isClass in value) {\n\t\t\t\t// class component
\n\t\t\t\treturn markComponent(props => createClass(value, props))\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * ```js\n\t\t\t * const [Count, setCount] = signal(1)\n\t\t\t * return
\n\t\t\t * ```\n\t\t\t */\n\t\t\tif (isReactive(value)) {\n\t\t\t\treturn markComponent(() => createAnything(value))\n\t\t\t}\n\n\t\t\t// function component
\n\t\t\t// value = value\n\t\t\treturn markComponent(value)\n\t\t}\n\t\tdefault: {\n\t\t\tif (value instanceof Node) {\n\t\t\t\t// node component
\n\t\t\t\treturn markComponent(props => createNode(value, props))\n\t\t\t}\n\n\t\t\treturn markComponent(() => createAnything(value))\n\t\t}\n\t}\n}\n\nexport function createComponent(value) {\n\tconst component = Factory(value)\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() => component(props))\n\t}\n}\n\nfunction createClass(value, props) {\n\tconst i = new value()\n\ti.ready && ready(() => i.ready())\n\ti.cleanup && cleanup(() => i.cleanup())\n\n\treturn i.render(props)\n}\n\nfunction createAnything(value) {\n\treturn value\n}\n\n/**\n * Creates a x/html element from a tagName\n *\n * @template P\n * @param {TagNames} tagName\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createTag(tagName, props) {\n\t/**\n\t * Namespace, use props xmlns or special case svg, math, etc in case\n\t * of missing xmlns attribute\n\t */\n\tconst xmlns = props?.xmlns || NS[tagName]\n\n\treturn withXMLNS(\n\t\txmlns,\n\t\txmlns =>\n\t\t\tcreateNode(\n\t\t\t\txmlns\n\t\t\t\t\t? createElementNS(xmlns, tagName)\n\t\t\t\t\t: createElement(tagName),\n\t\t\t\tprops,\n\t\t\t),\n\t\ttagName,\n\t)\n}\n\nfunction withXMLNS(xmlns, fn, tagName) {\n\tconst nsContext = useXMLNS()\n\n\tif (xmlns && xmlns !== nsContext) {\n\t\t// the xmlns changed, use the new xmlns\n\t\treturn useXMLNS(xmlns, () => fn(xmlns))\n\t}\n\n\t/**\n\t * `foreignObject` children are created with html xmlns (default\n\t * browser behaviour)\n\t */\n\tif (nsContext && tagName === 'foreignObject') {\n\t\treturn useXMLNS(NS.html, () => fn(nsContext))\n\t}\n\n\treturn fn(nsContext)\n}\n\n// PARTIALS\n\nfunction parseHTML(content, xmlns) {\n\tconst template = xmlns\n\t\t? createElementNS(xmlns, 'template')\n\t\t: createElement('template')\n\n\ttemplate.innerHTML = content\n\n\t// xml\n\tif (!template.content) {\n\t\tif (template.childNodes.length === 1) {\n\t\t\treturn template.firstChild\n\t\t}\n\n\t\ttemplate.content = new DocumentFragment()\n\t\ttemplate.content.append(...template.childNodes)\n\t}\n\n\treturn template.content.childNodes.length === 1\n\t\t? template.content.firstChild\n\t\t: template.content\n}\n\nexport function createPartial(content, propsData = nothing) {\n\tlet clone = () => {\n\t\tconst node = withXMLNS(propsData.x, xmlns =>\n\t\t\tparseHTML(content, xmlns),\n\t\t)\n\n\t\tclone = propsData.i\n\t\t\t? importNode.bind(null, node, true)\n\t\t\t: node.cloneNode.bind(node, true)\n\t\treturn clone()\n\t}\n\n\treturn props => {\n\t\t/** Freeze props so isnt directly writable */\n\t\tfreeze(props)\n\t\treturn markComponent(() =>\n\t\t\tassignPartialProps(clone(), props, propsData),\n\t\t)\n\t}\n}\n\nfunction assignPartialProps(node, props, propsData) {\n\tif (props) {\n\t\tconst nodes = []\n\t\twalkElements(node, node => {\n\t\t\tnodes.push(node)\n\n\t\t\tif (nodes.length === propsData.m) return true\n\t\t})\n\n\t\twithXMLNS(propsData.x, xmlns => {\n\t\t\tfor (let i = 0; i < props.length; i++) {\n\t\t\t\tassignProps(nodes[propsData[i] || i], props[i])\n\t\t\t}\n\t\t})\n\t}\n\n\treturn node instanceof DocumentFragment\n\t\t? toArray(node.childNodes)\n\t\t: node\n}\n\n/**\n * Assigns props to an element and creates its children\n *\n * @template P\n * @param {Element} node\n * @param {P} props\n * @returns {Element} Element\n */\nfunction createNode(node, props) {\n\tif (props) {\n\t\tassignProps(node, props)\n\t}\n\treturn node\n}\n\n/**\n * Creates the children for a parent\n *\n * @param {Element} parent\n * @param {Children} child\n * @param {boolean} [relative]\n * @param {Text | undefined} [prev]\n * @returns {Children}\n */\nfunction createChildren(parent, child, relative, prev = undefined) {\n\tswitch (typeof child) {\n\t\t// string/number\n\t\tcase 'string':\n\t\tcase 'number': {\n\t\t\tif (prev instanceof Text) {\n\t\t\t\tprev.nodeValue = child\n\t\t\t\treturn prev\n\t\t\t}\n\t\t\treturn insertNode(parent, createTextNode(child), relative)\n\t\t}\n\n\t\tcase 'function': {\n\t\t\t// component\n\t\t\tif (isComponent(child)) {\n\t\t\t\treturn createChildren(parent, untrack(child), relative)\n\t\t\t}\n\n\t\t\tlet node = []\n\n\t\t\t// signal/memo/external/user provided function\n\t\t\t// needs placeholder to stay in position\n\t\t\tparent = createPlaceholder(\n\t\t\t\tparent,\n\t\t\t\tundefined /*child.name*/,\n\t\t\t\trelative,\n\t\t\t)\n\n\t\t\t// For\n\t\t\tif ($isMap in child) {\n\t\t\t\teffect(() => {\n\t\t\t\t\tnode = toDiff(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tchild(child => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Wrap the item with placeholders, for when stuff in\n\t\t\t\t\t\t\t * between moves. If a `Show` adds and removes nodes, we\n\t\t\t\t\t\t\t * dont have a reference to these nodes. By delimiting\n\t\t\t\t\t\t\t * with a shore, we can just handle anything in between\n\t\t\t\t\t\t\t * as a group.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst begin = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*begin*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tconst end = createPlaceholder(\n\t\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\t\tundefined /*end*/,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn [begin, createChildren(end, child, true), end]\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\tcleanup(() => {\n\t\t\t\t\ttoDiff(node)\n\t\t\t\t\tparent.remove()\n\t\t\t\t})\n\t\t\t\treturn [node, parent]\n\t\t\t}\n\n\t\t\t// maybe a signal so needs an effect\n\n\t\t\teffect(() => {\n\t\t\t\tnode = toDiff(node, [\n\t\t\t\t\tcreateChildren(parent, child(), true, node[0]),\n\t\t\t\t])\n\t\t\t})\n\n\t\t\tcleanup(() => {\n\t\t\t\ttoDiff(node)\n\t\t\t\tparent.remove()\n\t\t\t})\n\t\t\t/**\n\t\t\t * A placeholder is created and added to the document but doesnt\n\t\t\t * form part of the children. The placeholder needs to be\n\t\t\t * returned so it forms part of the group of children. If\n\t\t\t * children are moved and the placeholder is not moved with\n\t\t\t * them, then, whenever children update these will be at the\n\t\t\t * wrong place. wrong place: where the placeholder is and not\n\t\t\t * where the children were moved to\n\t\t\t */\n\t\t\treturn [node, parent]\n\t\t}\n\n\t\tcase 'object': {\n\t\t\t// HTMLElement/Text\n\t\t\tif (child instanceof HTMLElement || child instanceof Text) {\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// children/fragments\n\t\t\tif (isArray(child)) {\n\t\t\t\treturn child.length === 1\n\t\t\t\t\t? createChildren(parent, child[0], relative)\n\t\t\t\t\t: child.map(child =>\n\t\t\t\t\t\t\tcreateChildren(parent, child, relative),\n\t\t\t\t\t\t)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * The value is `null`, as in {null} or like a show returning\n\t\t\t * `null` on the falsy case\n\t\t\t */\n\t\t\tif (child === null) {\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// Node/DocumentFragment\n\t\t\tif (child instanceof Node) {\n\t\t\t\t/**\n\t\t\t\t * DocumentFragment are special as only the children get added\n\t\t\t\t * to the document and the document becomes empty. If we dont\n\t\t\t\t * insert them 1 by 1 then we wont have a reference to them\n\t\t\t\t * for deletion on cleanup with node.remove()\n\t\t\t\t */\n\t\t\t\tif (child instanceof DocumentFragment) {\n\t\t\t\t\treturn createChildren(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\ttoArray(child.childNodes),\n\t\t\t\t\t\trelative,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn insertNode(parent, child, relative)\n\t\t\t}\n\n\t\t\t// async components\n\t\t\tif ('then' in child) {\n\t\t\t\tconst [value, setValue] = signal(undefined)\n\n\t\t\t\tconst onResult = result =>\n\t\t\t\t\tisConnected(parent) && setValue(result)\n\n\t\t\t\tresolved(child, onResult)\n\n\t\t\t\treturn createChildren(parent, value, relative)\n\t\t\t}\n\n\t\t\t// iterable/Map/Set/NodeList\n\t\t\tif (iterator in child) {\n\t\t\t\treturn createChildren(\n\t\t\t\t\tparent,\n\t\t\t\t\ttoArray(child.values()),\n\t\t\t\t\trelative,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// CSSStyleSheet\n\t\t\tif (child instanceof CSSStyleSheet) {\n\t\t\t\t/**\n\t\t\t\t * Custom elements wont report a document unless is already\n\t\t\t\t * connected. So our stylesheet would end on the main document\n\t\t\t\t * intead of the shadodRoot\n\t\t\t\t */\n\t\t\t\tonFixes(() => {\n\t\t\t\t\tif (isConnected(parent)) {\n\t\t\t\t\t\tconst doc = getDocumentForElement(parent)\n\t\t\t\t\t\tadoptedStyleSheetsAdd(doc, child)\n\n\t\t\t\t\t\tcleanup(() => adoptedStyleSheetsRemove(doc, child))\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\t// object.toString fancy objects\n\t\t\treturn createChildren(\n\t\t\t\tparent,\n\t\t\t\t// Object.create(null) would fail to convert to string\n\t\t\t\t'toString' in child ? child.toString() : stringify(child),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t\tcase 'undefined': {\n\t\t\treturn undefined\n\t\t}\n\t\tdefault: {\n\t\t\t// boolean/bigint/symbol/catch all\n\t\t\t// toString() is needed for `Symbol`\n\t\t\treturn insertNode(\n\t\t\t\tparent,\n\t\t\t\tcreateTextNode(child.toString()),\n\t\t\t\trelative,\n\t\t\t)\n\t\t}\n\t}\n}\n\npropsPlugin(\n\t'children',\n\t(node, propName, propValue) => createChildren(node, propValue),\n\tfalse,\n)\n\n/**\n * Creates placeholder to keep nodes in position\n *\n * @param {Element} parent\n * @param {unknown} text\n * @param {boolean} [relative]\n * @returns {Element}\n */\nconst createPlaceholder = (parent, text, relative) => {\n\treturn insertNode(parent, createTextNode(''), relative)\n\n\t/* dev\n\treturn insertNode(\n\t\tparent,\n\t\tdocument.createComment(\n\t\t\t(text || '') + (relative ? ' relative' : ''),\n\t\t),\n\t\trelative,\n\t) */\n}\n\nconst head = document.head\n\n/**\n * Adds the element to the document\n *\n * @param {Element} parent\n * @param {Element &\n * \tHTMLTitleElement &\n * \tHTMLMetaElement &\n * \tHTMLLinkElement} node\n * @param {boolean} [relative]\n * @returns {Element}\n */\n\nfunction insertNode(parent, node, relative) {\n\t// special case `head`\n\tif (parent === head) {\n\t\tconst name = node.localName\n\n\t\t// search for tags that should be unique\n\t\tlet prev\n\t\tif (name === 'title') {\n\t\t\tprev = querySelector(head, 'title')\n\t\t} else if (name === 'meta') {\n\t\t\tprev =\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[name=\"' + node.getAttribute('name') + '\"]',\n\t\t\t\t) ||\n\t\t\t\tquerySelector(\n\t\t\t\t\thead,\n\t\t\t\t\t'meta[property=\"' + node.getAttribute('property') + '\"]',\n\t\t\t\t)\n\t\t} else if (name === 'link' && node.rel === 'canonical') {\n\t\t\tprev = querySelector(head, 'link[rel=\"canonical\"]')\n\t\t}\n\n\t\t// replace old node if there's any\n\t\tprev ? prev.replaceWith(node) : parent.appendChild(node)\n\t} else {\n\t\trelative ? parent.before(node) : parent.appendChild(node)\n\t}\n\n\treturn node\n}\n\n// RENDERING\n\n/**\n * WARNINGS Removal of the element on where you render/insert into,\n * wont cause disposal of what you render/insert.\n */\n\n/**\n * Inserts children into a parent\n *\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * document.body\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n * @returns {Function} Disposer\n * @url https://pota.quack.uy/render\n */\nexport function render(children, parent, options = nothing) {\n\tconst dispose = root(dispose => {\n\t\tinsert(children, parent, options)\n\t\treturn dispose\n\t})\n\n\t// run dispose when the parent scope disposes\n\tcleanup(dispose)\n\n\treturn dispose\n}\n\n/**\n * @param {any} children - Thing to render\n * @param {Element | null} [parent] - Mount point, defaults to\n * `document.body`\n * @param {{ clear?: boolean; relative?: boolean }} [options] -\n * Mounting options\n */\nexport function insert(\n\tchildren,\n\tparent = document.body,\n\toptions = nothing,\n) {\n\tif (options.clear && parent) parent.textContent = ''\n\n\tconst node = createChildren(\n\t\tparent,\n\t\tisComponentable(children) ? Factory(children) : children,\n\t\toptions.relative,\n\t)\n\n\tcleanup(() => toDiff([node].flat(Infinity)))\n\n\treturn node\n}\n\n/**\n * Creates and returns HTML Elements for `children`\n *\n * @param {Children} children\n * @returns {Children}\n * @url https://pota.quack.uy/toHTML\n */\nexport const toHTML = children =>\n\t/**\n\t * DocumentFragment is transformed to an `Array` of `Node/Element`,\n\t * that way we can keep a reference to the nodes. Because when the\n\t * DocumentFragment is used, it removes the nodes from the\n\t * DocumentFragment and then we will lose the reference.\n\t */\n\n\tflat(toHTMLFragment(children).childNodes)\n\n/**\n * Creates and returns a DocumentFragment for `children`\n *\n * @param {Children} children\n * @returns {DocumentFragment}\n * @url https://pota.quack.uy/toHTML\n */\nexport function toHTMLFragment(children) {\n\tconst fragment = new DocumentFragment()\n\tcreateChildren(fragment, children)\n\n\treturn fragment\n}\n\n/**\n * Creates a context and returns a function to get or set the value\n *\n * @param {any} [defaultValue] - Default value for the context\n * @returns {Function & { Provider: ({ value }) => Children }}\n * Context\n * @url https://pota.quack.uy/Reactivity/Context\n */\n/* #__NO_SIDE_EFFECTS__ */ export function context(\n\tdefaultValue = undefined,\n) {\n\t/** @type {Function & { Provider: ({ value }) => Children }} */\n\tconst ctx = Context(defaultValue)\n\n\t/**\n\t * Sets the `value` for the context\n\t *\n\t * @param {object} props\n\t * @param {any} props.value\n\t * @param {Children} [props.children]\n\t * @returns {Children} Children\n\t * @url https://pota.quack.uy/Reactivity/Context\n\t */\n\tctx.Provider = props =>\n\t\tctx(props.value, () => toHTML(props.children))\n\n\treturn ctx\n}\n\n/**\n * Removes from the DOM `prev` elements not found on `next`\n *\n * @param {Element[]} prev - Array with previous elements\n * @param {Element[]} next - Array with next elements\n * @returns {Element[]}\n */\nfunction toDiff(prev = [], next = []) {\n\tnext = next.flat(Infinity)\n\tfor (let i = 0, item; i < prev.length; i++) {\n\t\titem = prev[i]\n\t\titem &&\n\t\t\t(next.length === 0 || !next.includes(item)) &&\n\t\t\titem.remove()\n\t}\n\treturn next\n}\n","import { makeCallback, map } from '../lib/reactive.js'\nimport {\n\tactiveElement,\n\tdocumentElement,\n\tisConnected,\n} from '../lib/std.js'\n\nimport { onFixes } from '../scheduler.js'\n\n/**\n * Renders reactive values from an signal that returns an Iterable\n * object\n *\n * @template T\n * @param {object} props\n * @param {Each
} props.each\n * @param {boolean} [props.restoreFocus] - If the focused element\n * moves it may lose focus\n * @param {Children} [props.children]\n * @returns {Children}\n * @url https://pota.quack.uy/Components/For\n */\n\nexport const For = props =>\n\tmap(\n\t\t() => {\n\t\t\tprops.restoreFocus && queue()\n\t\t\treturn props.each\n\t\t},\n\t\tmakeCallback(props.children),\n\t\ttrue,\n\t)\n\nlet queued\n\n// because re-ordering the elements trashes focus\nfunction queue() {\n\tif (!queued) {\n\t\tqueued = true\n\n\t\tconst active = activeElement()\n\t\tconst scroll = documentElement.scrollTop\n\n\t\tonFixes(() => {\n\t\t\tqueued = false\n\t\t\t// re-ordering the elements trashes focus\n\t\t\tactive &&\n\t\t\t\tactive !== activeElement() &&\n\t\t\t\tisConnected(active) &&\n\t\t\t\tactive.focus()\n\n\t\t\tdocumentElement.scrollTop = scroll\n\t\t})\n\t}\n}\n","import { signal, cleanup, syncEffect } from '../lib/reactive.js'\nimport { isIterable, toArray } from '../lib/std.js'\n\n/**\n * Returns a `isSelected` function that will return `true` when the\n * argument for it matches the original signal `value`.\n *\n * @param {Signal} value - Signal with the current value\n * @returns {(item: any) => Signal} Signal that you can run with a\n * value to know if matches the original signal\n */\nexport function useSelector(value) {\n\tconst map = new Map()\n\n\tlet prev = []\n\n\tsyncEffect(() => {\n\t\tconst val = value()\n\n\t\tconst selected = isIterable(val) ? toArray(val.values()) : [val]\n\n\t\t// unselect\n\t\tfor (const value of prev) {\n\t\t\tif (!selected.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(false)\n\t\t\t}\n\t\t}\n\n\t\t// select\n\t\tfor (const value of selected) {\n\t\t\tif (!prev.includes(value)) {\n\t\t\t\tconst current = map.get(value)\n\t\t\t\tcurrent && current.write(true)\n\t\t\t}\n\t\t}\n\n\t\tprev = selected\n\t})\n\n\t/**\n\t * Is selected function, it will return `true` when the value\n\t * matches the current signal.\n\t *\n\t * @param {any} item - Values to compare with current\n\t * @returns {Signal} A signal with a boolean value\n\t */\n\treturn function isSelected(item) {\n\t\tlet selected = map.get(item)\n\t\tif (!selected) {\n\t\t\tselected = signal(prev.includes(item))\n\t\t\tselected.counter = 0\n\t\t\tmap.set(item, selected)\n\t\t}\n\n\t\tselected.counter++\n\n\t\tcleanup(() => {\n\t\t\tif (--selected.counter === 0) {\n\t\t\t\tmap.delete(item)\n\t\t\t}\n\t\t})\n\n\t\treturn selected.read\n\t}\n}\n","import { render, signal, batch } from 'pota'\nimport { For } from 'pota/web'\n\nimport { useSelector } from 'pota/plugin/useSelector'\n\nlet idCounter = 1\nconst adjectives = [\n 'pretty',\n 'large',\n 'big',\n 'small',\n 'tall',\n 'short',\n 'long',\n 'handsome',\n 'plain',\n 'quaint',\n 'clean',\n 'elegant',\n 'easy',\n 'angry',\n 'crazy',\n 'helpful',\n 'mushy',\n 'odd',\n 'unsightly',\n 'adorable',\n 'important',\n 'inexpensive',\n 'cheap',\n 'expensive',\n 'fancy',\n ],\n colours = [\n 'red',\n 'yellow',\n 'blue',\n 'green',\n 'pink',\n 'brown',\n 'purple',\n 'brown',\n 'white',\n 'black',\n 'orange',\n ],\n nouns = [\n 'table',\n 'chair',\n 'house',\n 'bbq',\n 'desk',\n 'car',\n 'pony',\n 'cookie',\n 'sandwich',\n 'burger',\n 'pizza',\n 'mouse',\n 'keyboard',\n ]\n\nfunction _random(max) {\n return Math.round(Math.random() * 1000) % max\n}\n\nfunction buildData(count) {\n let data = new Array(count)\n for (let i = 0; i < count; i++) {\n const [label, setLabel, updateLabel] = signal(\n `${adjectives[_random(adjectives.length)]} ${\n colours[_random(colours.length)]\n } ${nouns[_random(nouns.length)]}`,\n )\n data[i] = {\n id: idCounter++,\n label,\n updateLabel,\n }\n }\n return data\n}\n\nconst Button = ({ id, text, fn }) => (\n \n \n {text}\n \n
\n)\n\nconst App = () => {\n const [data, setData, updateData] = signal([]),\n [selected, setSelected] = signal(null),\n run = () => setData(buildData(1000)),\n runLots = () => {\n setData(buildData(10000))\n },\n add = () => updateData(d => [...d, ...buildData(1000)]),\n update = () =>\n batch(() => {\n for (let i = 0, d = data(), len = d.length; i < len; i += 10)\n d[i].updateLabel(l => l + ' !!!')\n }),\n swapRows = () => {\n const d = data().slice()\n if (d.length > 998) {\n let tmp = d[1]\n d[1] = d[998]\n d[998] = tmp\n setData(d)\n }\n },\n clear = () => setData([]),\n remove = id =>\n updateData(d => {\n const idx = d.findIndex(datum => datum.id === id)\n d.splice(idx, 1)\n return [...d]\n }),\n isSelected = useSelector(selected)\n\n return (\n \n
\n
\n
\n
pota Keyed \n \n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n
{\n const element = e.target\n const { selectRow, removeRow } = element\n if (selectRow !== undefined) {\n setSelected(selectRow)\n } else if (removeRow !== undefined) {\n remove(removeRow)\n }\n }}\n >\n \n \n {row => {\n const { id, label } = row\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n )\n }}\n \n \n
\n
\n
\n )\n}\n\nrender(App, document.getElementById('main'))\n"],"names":["global","globalThis","window","CSSStyleSheet","document","DocumentFragment","Object","Symbol","queueMicrotask","assign","entries","freeze","getOwnPropertyDescriptors","getPrototypeOf","groupBy","isArray","Array","toArray","from","iterator","stringify","JSON","resolved","promise","onDone","then","catch","isConnected","node","activeElement","documentElement","call","fns","fn","bind","createElement","createElementNS","createTextNode","importNode","createTreeWalker","empty","create","flat","arr","length","withState","state","cacheStore","withCache","cache","thing","get","walkElements","walk","currentNode","nodeType","nextNode","getDocumentForElement","getRootNode","ownerDocument","getSetterNamesFromPrototype","object","set","Set","descriptors","key","add","getValue","value","isFunction","isIterable","isObject","isNullUndefined","undefined","isString","isPromise","noop","nothing","querySelector","query","removeFromArray","array","index","indexOf","splice","DataStore","constructor","kind","store","k","v","has","target","defaults","o","delete","Map","classListAdd","className","classList","classListRemove","remove","adoptedStyleSheetsGet","adoptedStyleSheets","adoptedStyleSheetsAdd","styleSheet","push","adoptedStyleSheetsRemove","sheet","css","replace","$isComponent","$isClass","$isReactive","$isMap","prefix","NS","__proto__","svg","math","html","xlink","CLEAN","STALE","CHECK","Owner","Listener","Updates","Effects","Time","Root","owner","owned","cleanups","context","options","dispose","i","Computation","updatedAt","sources","sourceSlots","update","time","prevOwner","prevListener","err","source","observers","observer","slot","pop","observerSlots","Effect","user","batch","SyncEffect","Signal","save","prev","read","markReactive","sourceSlot","write","equals","runUpdates","pure","downstream","a","b","root","signal","initialValue","effect","syncEffect","runWithOwner","untrack","cleanup","runTop","upstream","ancestors","updates","init","wait","res","runQueue","effects","runEffects","queue","userLength","ignore","Context","defaultValue","id","useContext","newValue","cb","args","isReactive","withValue","withPrevValue","val","map","list","callback","sort","duplicates","runId","rows","clear","Row","item","isDupe","disposer","nodes","begin","end","all","mapper","items","hasPrev","row","dupes","unsorted","every","includes","usort","before","nodesFromRow","after","current","previous","previousSibling","nextSibling","isComponent","isComponentable","makeCallback","children","callbacks","markComponent","child","r","addEventListener","type","handler","removeEventListener","ownedEvent","handleEvent","e","added","reset","priority","run","q","onFixes","onProps","onRef","onMount","ready","setEventNS","name","props","localName","ns","eventName","startsWith","toLowerCase","slice","plugins","pluginsNS","propsPlugin","propName","onMicrotask","plugin","propsPluginNS","NSName","propsPluginBoth","setAttributeNS","setAttribute","_setAttribute","removeAttributeNS","removeAttribute","setPropertyNS","setProperty","_setProperty","setUnknown","_setUnknown","setters","element","builtIn","elements","builtInSetters","proto","Element","nextProto","prototype","Node","setBoolNS","setBool","_setBool","setStyle","setNodeStyle","style","setStyleNS","setVarNS","setStyleValue","cssText","_setStyleValue","removeProperty","setClass","setClassList","setClassNS","setElementClass","_setClassListValue","trim","split","setValue","_setValue","textContent","randomId","crypto","getRandomValues","BigUint64Array","toString","setCSS","setNodeCSS","setRef","setOnMount","setUnmount","assignProps","assignProp","event","useXMLNS","Factory","createTag","createClass","createAnything","createNode","createComponent","component","render","tagName","xmlns","withXMLNS","nsContext","parseHTML","content","template","innerHTML","childNodes","firstChild","append","createPartial","propsData","clone","x","cloneNode","assignPartialProps","m","createChildren","parent","relative","Text","nodeValue","insertNode","createPlaceholder","toDiff","HTMLElement","onResult","result","values","doc","propValue","text","head","getAttribute","rel","replaceWith","appendChild","insert","body","Infinity","toHTML","toHTMLFragment","fragment","ctx","Provider","next","For","restoreFocus","each","queued","active","scroll","scrollTop","focus","useSelector","selected","isSelected","counter","_For","_createComponent","idCounter","adjectives","colours","nouns","_random","max","Math","round","random","buildData","count","data","label","setLabel","updateLabel","Button","_div","onClick","_Button","App","setData","updateData","setSelected","runLots","d","len","l","swapRows","tmp","idx","findIndex","datum","_div2","selectRow","removeRow","_tr","getElementById"],"mappings":";;;CAAO,MAAMA,MAAM,GAAGC,UAAU,CAAA;CACzB,MAAMC,MAAM,GAAGF,MAAM,CAAA;CAErB,MAAMG,aAAa,GAAGH,MAAM,CAACG,aAAa,CAAA;CAC1C,MAAMC,UAAQ,GAAGJ,MAAM,CAACI,QAAQ,CAAA;CAChC,MAAMC,gBAAgB,GAAGL,MAAM,CAACK,gBAAgB,CAAA;CAChD,MAAMC,QAAM,GAAGN,MAAM,CAACM,MAAM,CAAA;CAG5B,MAAMC,MAAM,GAAGP,MAAM,CAACO,MAAM,CAAA;CAC5B,MAAMC,cAAc,GAAGR,MAAM,CAACQ,cAAc,CAAA;CAE5C,MAAMC,MAAM,GAAGH,QAAM,CAACG,MAAM,CAAA;CAI5B,MAAMC,OAAO,GAAGJ,QAAM,CAACI,OAAO,CAAA;CAC9B,MAAMC,MAAM,GAAGL,QAAM,CAACK,MAAM,CAAA;CAI5B,MAAMC,yBAAyB,GACrCN,QAAM,CAACM,yBAAyB,CAAA;CAG1B,MAAMC,cAAc,GAAGP,QAAM,CAACO,cAAc,CAAA;CAC5C,MAAMC,OAAO,GAAGR,QAAM,CAACQ,OAAO,CAAA;CAQ9B,MAAMC,OAAO,GAAGC,KAAK,CAACD,OAAO,CAAA;CAC7B,MAAME,OAAO,GAAGD,KAAK,CAACE,IAAI,CAAA;CAI1B,MAAMC,QAAQ,GAAGZ,MAAM,CAACY,QAAQ,CAAA;CAEhC,MAAMC,SAAS,GAAGC,IAAI,CAACD,SAAS,CAAA;;CAkCvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACO,MAAME,QAAQ,GAAGA,CAACC,OAAO,EAAEC,MAAM,KACvCD,OAAO,CAACE,IAAI,CAACD,MAAM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A;CAAE,SAAA,EAAA;CAG7B6H,UAAAA,WAAW,EAAE7H,EAAAA;CAAG,SAAA,EAAA;CAId6H,UAAAA,WAAW,EAAEgG,KAAM;WACnB,gBAAgB7N,EAAAA,EAAAA;CAAG,SAAA,EAAA;WAQjB,gBAAgBA,EAAAA,EAAAA;CAAG,SAAA,CAKvB,CAAC,CAAA;CAET,OAAA;MACG,CAAA;CAAC,GAAA,CAOP,CAAC,CAAA;CAEV,CAAC,CAAA;CAEDmJ,MAAM,CAACiF,GAAG,EAAEja,QAAQ,CAACkb,cAAc,CAAC,MAAM,CAAC,CAAC;;;;;;"}
\ No newline at end of file
diff --git a/src/pages/home.jsx b/src/pages/home.jsx
index 51ab03e..3861320 100644
--- a/src/pages/home.jsx
+++ b/src/pages/home.jsx
@@ -54,9 +54,7 @@ export default function Home() {
rather than as a value {'{count()}'} .
-
+