UNPKG

preact

Version:

Fast 4kb React-compatible Virtual DOM library.

1 lines • 94.7 kB
{"version":3,"file":"preact.mjs","sources":["../src/constants.js","../src/options.js","../src/create-element.js","../src/component.js","../src/diff/props.js","../src/create-context.js","../src/util.js","../src/diff/children.js","../src/diff/index.js","../src/render.js","../src/create-portal.js","../src/diff/catch-error.js"],"sourcesContent":["// Vnode._flags\n/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 << 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 << 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 << 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 << 1;\n/** Indicates that this vnode has been unmounted before indicating the loss of event listeners */\nexport const FORCE_PROPS_REVALIDATE = 1 << 0;\n/** The vnode's ref was detached while its subtree was parked by Suspense */\nexport const REF_DETACHED = 1 << 3;\n\n// component._bits\n/** Component is processing an exception */\nexport const COMPONENT_PROCESSING_EXCEPTION = 1 << 0;\n/** Component has a pending error */\nexport const COMPONENT_PENDING_ERROR = 1 << 1;\n/** Component should force update (skip shouldComponentUpdate) */\nexport const COMPONENT_FORCE = 1 << 2;\n/** Component is queued for update */\nexport const COMPONENT_DIRTY = 1 << 3;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\n\nexport const MATHML_TOKEN_ELEMENTS = /^m(i|n|o|s|text|space)$/;\n","import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n","import { assign, slice } from './util';\nimport options from './options';\nimport { NULL, UNDEFINED } from './constants';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor for this\n * virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array<import('.').ComponentChildren>} [children] The children of the\n * virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti,\n\t\tlength = arguments.length;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref' && typeof type != 'function') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (length > 2) {\n\t\tnormalizedProps.children = length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, NULL);\n}\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./internal').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} children Any additional arguments will be used\n * as replacement children.\n * @returns {import('./internal').VNode}\n */\nexport function cloneElement(vnode, props, children) {\n\tlet normalizedProps = assign({}, vnode.props),\n\t\tkey,\n\t\tref,\n\t\ti,\n\t\tlength = arguments.length;\n\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref' && typeof vnode.type != 'function') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (length > 2) {\n\t\tnormalizedProps.children = length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(\n\t\tvnode.type,\n\t\tnormalizedProps,\n\t\tkey !== UNDEFINED ? key : vnode.key,\n\t\tref !== UNDEFINED ? ref : vnode.ref,\n\t\tNULL\n\t);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\t/** @type {import('./internal').VNode} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: NULL,\n\t\t_parent: NULL,\n\t\t_depth: 0,\n\t\t_dom: NULL,\n\t\t_component: NULL,\n\t\tconstructor: UNDEFINED,\n\t\t_original: original || ++vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (!original && options.vnode) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: NULL };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is VNode}\n */\nexport const isValidElement = vnode =>\n\tvnode != NULL && vnode.constructor === UNDEFINED;\n","import {\n\tCOMPONENT_DIRTY,\n\tCOMPONENT_FORCE,\n\tMODE_HYDRATE,\n\tNULL,\n\tUNDEFINED\n} from './constants';\nimport { Fragment } from './create-element';\nimport { commitRoot, diff } from './diff/index';\nimport options from './options';\nimport { assign } from './util';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function BaseComponent(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n\tthis._bits = 0;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) => object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() => void} [callback] A function to be called once component state is\n * updated\n */\nBaseComponent.prototype.setState = function (update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s = this._nextState;\n\tif (!s || s == this.state) {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t} else {\n\t\treturn;\n\t}\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() => void} [callback] A function to be called after component is\n * re-rendered\n */\nBaseComponent.prototype.forceUpdate = function (callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._bits |= COMPONENT_FORCE;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](https://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {ComponentChildren | void}\n */\nBaseComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == NULL) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._index + 1)\n\t\t\t: NULL;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex < vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling && sibling._dom) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search). New roots (_parentDom) are a DOM boundary too.\n\treturn typeof vnode.type == 'function' && !vnode.props._parentDom\n\t\t? getDomSibling(vnode)\n\t\t: NULL;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tconst oldVNode = component._vnode,\n\t\toldDom = oldVNode._dom,\n\t\tcommitQueue = [],\n\t\trefQueue = [];\n\n\tconst parentDom = component._parentDom;\n\tif (parentDom) {\n\t\tconst newVNode = assign({ constructor: UNDEFINED }, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tparentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tparentDom.namespaceURI,\n\t\t\toldVNode._flags & MODE_HYDRATE ? [oldDom] : NULL,\n\t\t\tcommitQueue,\n\t\t\toldDom || getDomSibling(oldVNode),\n\t\t\toldVNode._flags & MODE_HYDRATE,\n\t\t\trefQueue\n\t\t);\n\n\t\tnewVNode._original = oldVNode._original;\n\t\tnewVNode._parent._children[newVNode._index] = newVNode;\n\t\tcommitRoot(commitQueue, newVNode, refQueue);\n\t\toldVNode._parent = oldVNode._dom = NULL;\n\n\t\tif (newVNode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(newVNode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\t// Stop at root boundaries (_parentDom)\n\tif ((vnode = vnode._parent) && vnode._component && !vnode.props._parentDom) {\n\t\t// _dom starts nulled, so re-assigning a null child._dom is a no-op and\n\t\t// the first truthy _dom stops the walk.\n\t\tvnode._dom = NULL;\n\t\tvnode._children.some(child => child && (vnode._dom = child._dom));\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nconst rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce,\n\trerenderCount = 0;\n\nexport function resetRenderCount() {\n\trerenderCount = 0;\n}\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!(c._bits & COMPONENT_DIRTY) &&\n\t\t\t(c._bits |= COMPONENT_DIRTY) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!rerenderCount++) ||\n\t\tprevDebounce != options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || queueMicrotask)(process);\n\t}\n}\n\n/**\n * @param {import('./internal').Component} a\n * @param {import('./internal').Component} b\n */\nconst depthSort = (a, b) => a._vnode._depth - b._vnode._depth;\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\ttry {\n\t\tlet c,\n\t\t\tl = 1;\n\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\twhile (rerenderQueue.length) {\n\t\t\t// Keep the rerender queue sorted by (depth, insertion order). The queue\n\t\t\t// will initially be sorted on the first iteration only if it has more than 1 item.\n\t\t\t//\n\t\t\t// New items can be added to the queue e.g. when rerendering a provider, so we want to\n\t\t\t// keep the order from top to bottom with those new items so we can handle them in a\n\t\t\t// single pass\n\t\t\tif (rerenderQueue.length > l) {\n\t\t\t\trerenderQueue.sort(depthSort);\n\t\t\t}\n\n\t\t\tc = rerenderQueue.shift();\n\t\t\tl = rerenderQueue.length;\n\n\t\t\tif (c._bits & COMPONENT_DIRTY) {\n\t\t\t\trenderComponent(c);\n\t\t\t}\n\t\t}\n\t} finally {\n\t\trerenderQueue.length = rerenderCount = 0;\n\t}\n}\n","import { NULL, SVG_NAMESPACE } from '../constants';\nimport options from '../options';\n\n// Per-instance unique keys for event clock stamps. Each Preact copy on the\n// page gets its own Symbols so that `_dispatched` / `_attached` stamps on\n// shared event objects and handler functions can never collide across\n// instances.\nlet EVENT_DISPATCHED = Symbol(),\n\tEVENT_ATTACHED = Symbol();\n\nfunction setStyle(style, key, value) {\n\tif (value == NULL) value = '';\n\tif (key[0] == '-') {\n\t\tstyle.setProperty(key, value);\n\t} else {\n\t\tstyle[key] = value;\n\t}\n}\n\nconst CAPTURE_REGEX = /(PointerCapture)$|Capture$/i;\n\n// A logical clock to solve issues like https://github.com/preactjs/preact/issues/3927.\n// When the DOM performs an event it leaves micro-ticks in between bubbling up which means that\n// an event can trigger on a newly reated DOM-node while the event bubbles up.\n//\n// Originally inspired by Vue\n// (https://github.com/vuejs/core/blob/caeb8a68811a1b0f79/packages/runtime-dom/src/modules/events.ts#L90-L101),\n// but modified to use a logical clock instead of Date.now() in case event handlers get attached\n// and events get dispatched during the same millisecond.\n//\n// The clock is incremented after each new event dispatch. This allows 1 000 000 new events\n// per second for over 280 years before the value reaches Number.MAX_SAFE_INTEGER (2**53 - 1).\nlet eventClock = 0;\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {string} namespace Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, namespace) {\n\tlet useCapture;\n\n\to: if (name == 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value && name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] != oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] == 'o' && name[1] == 'n') {\n\t\tuseCapture = name != (name = name.replace(CAPTURE_REGEX, '$1'));\n\n\t\t// Infer correct casing for DOM built-in events: `onClick` -> `click`.\n\t\t// Only names starting with an uppercase letter are lowercased, so\n\t\t// camelCase custom events keep their casing: `onionChange` -> `ionChange`.\n\t\tname = name.slice(2);\n\t\tif (name[0] < 'a') name = name.toLowerCase();\n\n\t\t(dom._listeners || (dom._listeners = {}))[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tvalue[EVENT_ATTACHED] = eventClock;\n\t\t\t\tdom.addEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\t\tuseCapture\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tvalue[EVENT_ATTACHED] = oldValue[EVENT_ATTACHED];\n\t\t\t}\n\t\t} else {\n\t\t\tdom.removeEventListener(\n\t\t\t\tname,\n\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\tuseCapture\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (namespace == SVG_NAMESPACE) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --> class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname != 'width' &&\n\t\t\tname != 'height' &&\n\t\t\tname != 'href' &&\n\t\t\tname != 'list' &&\n\t\t\tname != 'form' &&\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname != 'tabIndex' &&\n\t\t\tname != 'download' &&\n\t\t\tname != 'rowSpan' &&\n\t\t\tname != 'colSpan' &&\n\t\t\tname != 'role' &&\n\t\t\tname != 'popover' &&\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == NULL ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// aria- and data- attributes have no boolean representation.\n\t\t// A `false` value is different from the attribute not being\n\t\t// present, so we can't remove it. For non-boolean aria\n\t\t// attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost too many bytes. On top of\n\t\t// that other frameworks generally stringify `false`.\n\n\t\tif (typeof value == 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != NULL && (value !== false || name[4] == '-')) {\n\t\t\tdom.setAttribute(name, name == 'popover' && value == true ? '' : value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Create an event proxy function.\n * @param {boolean} useCapture Is the event handler for the capture phase.\n * @private\n */\nfunction createEventProxy(useCapture) {\n\t/**\n\t * Proxy an event to hooked event handlers\n\t * @param {import('../internal').PreactEvent} e The event object from the browser\n\t * @private\n\t */\n\treturn function (e) {\n\t\tif (this._listeners) {\n\t\t\tconst eventHandler = this._listeners[e.type + useCapture];\n\t\t\tif (e[EVENT_DISPATCHED] == NULL) {\n\t\t\t\te[EVENT_DISPATCHED] = eventClock++;\n\n\t\t\t\t// When `e[EVENT_DISPATCHED]` is smaller than the time when the targeted event\n\t\t\t\t// handler was attached we know we have bubbled up to an element that was added\n\t\t\t\t// during patching the DOM.\n\t\t\t} else if (e[EVENT_DISPATCHED] < eventHandler[EVENT_ATTACHED]) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn eventHandler(options.event ? options.event(e) : e);\n\t\t}\n\t};\n}\n\nconst eventProxy = createEventProxy(false);\nconst eventProxyCapture = createEventProxy(true);\n","import { enqueueRender } from './component';\nimport { COMPONENT_FORCE } from './constants';\n\nexport let i = 0;\n\nexport function createContext(defaultValue) {\n\tfunction Context(props) {\n\t\tif (!this.getChildContext) {\n\t\t\t/** @type {Set<import('./internal').Component> | null} */\n\t\t\tlet subs = new Set();\n\t\t\tlet ctx = {};\n\t\t\tctx[Context._id] = this;\n\n\t\t\tthis.getChildContext = () => ctx;\n\n\t\t\tthis.shouldComponentUpdate = function (_props) {\n\t\t\t\t// @ts-expect-error even\n\t\t\t\tif (this.props.value != _props.value) {\n\t\t\t\t\tsubs.forEach(c => {\n\t\t\t\t\t\tc._bits |= COMPONENT_FORCE;\n\t\t\t\t\t\tenqueueRender(c);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.sub = c => {\n\t\t\t\tsubs.add(c);\n\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\tc.componentWillUnmount = () => {\n\t\t\t\t\tsubs.delete(c);\n\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\treturn props.children;\n\t}\n\n\tContext._id = '__cC' + i++;\n\tContext._defaultValue = defaultValue;\n\n\t/** @type {import('./internal').FunctionComponent} */\n\tContext.Consumer = (props, contextValue) => {\n\t\treturn props.children(contextValue);\n\t};\n\n\tContext.Provider = Context.Consumer.contextType = Context;\n\n\treturn Context;\n}\n","import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\nexport const slice = EMPTY_ARR.slice;\nexport const assign = Object.assign;\n\n/**\n * Remove a child node from its parent if attached.\n * @param {import('./internal').PreactElement | null} node The node to remove\n */\nexport function removeNode(node) {\n\tif (node && node.parentNode) node.remove();\n}\n","import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport {\n\tEMPTY_OBJ,\n\tEMPTY_ARR,\n\tINSERT_VNODE,\n\tMATCHED,\n\tREF_DETACHED,\n\tUNDEFINED,\n\tNULL\n} from '../constants';\nimport { isArray } from '../util';\nimport { getDomSibling } from '../component';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * Diff the children of a virtual node\n * @param {PreactElement} parentDom The DOM element whose children are being\n * diffed\n * @param {ComponentChildren[]} renderResult\n * @param {VNode} newParentVNode The new virtual node whose children should be\n * diff'ed against oldParentVNode\n * @param {VNode} oldParentVNode The old virtual node whose children should be\n * diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n * @returns {PreactElement} The next sibling DOM element to insert new elements\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\tlet i,\n\t\t/** @type {VNode} */\n\t\toldVNode,\n\t\t/** @type {VNode} */\n\t\tchildVNode,\n\t\t/** @type {PreactElement} */\n\t\tnewDom,\n\t\t/** @type {PreactElement} */\n\t\tfirstChildDom;\n\n\t// This is a compression of oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`. Callers always pass at\n\t// least EMPTY_OBJ, so a null check isn't needed.\n\t/** @type {VNode[]} */\n\tlet oldChildren = oldParentVNode._children || EMPTY_ARR;\n\n\tlet newChildrenLength = renderResult.length;\n\n\toldDom = constructNewChildrenArray(\n\t\tnewParentVNode,\n\t\trenderResult,\n\t\toldChildren,\n\t\toldDom,\n\t\tnewChildrenLength\n\t);\n\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\tchildVNode = newParentVNode._children[i];\n\t\tif (childVNode == NULL) continue;\n\n\t\t// At this point, constructNewChildrenArray has assigned _index to be the\n\t\t// matchingIndex for this VNode's oldVNode (or -1 if there is no oldVNode).\n\t\t// ~_index guards the -1 case: a negative array index is a named property\n\t\t// access which V8 can't serve from the fast elements path.\n\t\toldVNode =\n\t\t\t(~childVNode._index && oldChildren[childVNode._index]) || EMPTY_OBJ;\n\n\t\t// Update childVNode._index to its final index\n\t\tchildVNode._index = i;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tlet result = diff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\n\t\t// Adjust DOM nodes\n\t\tnewDom = childVNode._dom;\n\t\t// A ref detached while its subtree was parked by Suspense is attached\n\t\t// again on reveal.\n\t\tif (\n\t\t\tchildVNode.ref &&\n\t\t\t(oldVNode.ref != childVNode.ref || oldVNode._flags & REF_DETACHED)\n\t\t) {\n\t\t\tif (oldVNode.ref != childVNode.ref && oldVNode.ref) {\n\t\t\t\tapplyRef(oldVNode.ref, NULL, childVNode);\n\t\t\t}\n\t\t\trefQueue.push(\n\t\t\t\tchildVNode.ref,\n\t\t\t\tchildVNode._component || newDom,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t}\n\n\t\tfirstChildDom = firstChildDom || newDom;\n\n\t\tif (childVNode._flags & INSERT_VNODE) {\n\t\t\toldDom = insert(childVNode, oldDom, parentDom, !oldVNode._original);\n\n\t\t\t// When a matched VNode is physically moved via INSERT_VNODE, its old\n\t\t\t// _dom pointer becomes a stale positional reference. Clear it so that\n\t\t\t// getDomSibling (called from nested diffs) won't return this stale\n\t\t\t// reference and mis-place subsequent DOM nodes. See #5065.\n\t\t\tif (oldVNode._dom) {\n\t\t\t\toldVNode._dom = NULL;\n\t\t\t}\n\t\t} else if (typeof childVNode.type == 'function' && result !== UNDEFINED) {\n\t\t\toldDom = result;\n\t\t} else if (newDom) {\n\t\t\toldDom = newDom.nextSibling;\n\t\t}\n\n\t\t// Unset diffing flags\n\t\tchildVNode._flags &= ~(INSERT_VNODE | MATCHED);\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} newParentVNode\n * @param {ComponentChildren[]} renderResult\n * @param {VNode[]} oldChildren\n */\nfunction constructNewChildrenArray(\n\tnewParentVNode,\n\trenderResult,\n\toldChildren,\n\toldDom,\n\tnewChildrenLength\n) {\n\t/** @type {number} */\n\tlet i;\n\t/** @type {VNode} */\n\tlet childVNode;\n\t/** @type {VNode} */\n\tlet oldVNode;\n\n\tlet oldChildrenLength = oldChildren.length,\n\t\tremainingOldChildren = oldChildrenLength;\n\n\tlet skew = 0;\n\n\t/** Whether any matched child was found far from its skewed index, i.e. a\n\t * real reorder happened and we need to compute the minimal set of moves. */\n\tlet moved = false;\n\n\t// Hoisted: every normalization branch below writes through this array, so\n\t// reading `_children` off the vnode each time is a wasted property load.\n\t/** @type {VNode[]} */\n\tlet newChildren = (newParentVNode._children = Array(newChildrenLength));\n\tfor (i = 0; i < newChildrenLength; i++) {\n\t\t// @ts-expect-error We are reusing the childVNode variable to hold both the\n\t\t// pre and post normalized childVNode\n\t\tchildVNode = renderResult[i];\n\n\t\tif (\n\t\t\tchildVNode == NULL ||\n\t\t\ttypeof childVNode == 'boolean' ||\n\t\t\ttypeof childVNode == 'function'\n\t\t) {\n\t\t\tnewChildren[i] = NULL;\n\t\t\tcontinue;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM & etc. pointers\n\t\t// Anything that isn't an object at this point is a string, number or\n\t\t// bigint (null, booleans and functions are handled above), String\n\t\t// objects are the lone object type rendered as text.\n\t\telse if (\n\t\t\ttypeof childVNode != 'object' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newChildren[i] = createVNode(NULL, childVNode);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newChildren[i] = createVNode(Fragment, {\n\t\t\t\tchildren: childVNode\n\t\t\t});\n\t\t} else if (childVNode.constructor === UNDEFINED && childVNode._depth) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t//   const reuse = <div />\n\t\t\t//   <div>{reuse}<span />{reuse}</div>\n\t\t\tchildVNode = newChildren[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tnewChildren[i] = childVNode;\n\t\t}\n\n\t\tconst skewedIndex = i + skew;\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Temporarily store the matchingIndex on the _index property so we can pull\n\t\t// out the oldVNode in diffChildren. We'll override this to the VNode's\n\t\t// final index after using this property to get the oldVNode\n\t\tconst matchingIndex = (childVNode._index = findMatchingIndex(\n\t\t\tchildVNode,\n\t\t\toldChildren,\n\t\t\tskewedIndex,\n\t\t\tremainingOldChildren\n\t\t));\n\n\t\toldVNode = NULL;\n\t\t// ~matchingIndex is only falsy for -1, i.e. when no match was found\n\t\tif (~matchingIndex) {\n\t\t\toldVNode = oldChildren[matchingIndex];\n\t\t\tremainingOldChildren--;\n\t\t\tif (oldVNode) {\n\t\t\t\toldVNode._flags |= MATCHED;\n\t\t\t}\n\t\t}\n\n\t\t// Here, we define isMounting for the purposes of the skew diffing\n\t\t// algorithm. Nodes that are unsuspending are considered mounting and we detect\n\t\t// this by checking if oldVNode._original == null\n\t\tif (!oldVNode || !oldVNode._original) {\n\t\t\tif (!~matchingIndex) {\n\t\t\t\t// When the array of children is growing we need to decrease the skew\n\t\t\t\t// as we are adding a new element to the array.\n\t\t\t\t// Example:\n\t\t\t\t// [1, 2, 3] --> [0, 1, 2, 3]\n\t\t\t\t// oldChildren   newChildren\n\t\t\t\t//\n\t\t\t\t// The new element is at index 0, so our skew is 0,\n\t\t\t\t// we need to decrease the skew as we are adding a new element.\n\t\t\t\t// The decrease will cause us to compare the element at position 1\n\t\t\t\t// with value 1 with the element at position 0 with value 0.\n\t\t\t\t//\n\t\t\t\t// A linear concept is applied when the array is shrinking,\n\t\t\t\t// if the length is unchanged we can assume that no skew\n\t\t\t\t// changes are needed.\n\t\t\t\tif (newChildrenLength > oldChildrenLength) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else if (newChildrenLength < oldChildrenLength) {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we are mounting a DOM VNode, mark it for insertion\n\t\t\tif (typeof childVNode.type != 'function') {\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t} else {\n\t\t\t// Matched children are candidates for the minimal-move pass below;\n\t\t\t// MATCHED on a _new_ vnode is cleared in diffChildren's placement loop.\n\t\t\tchildVNode._flags |= MATCHED;\n\n\t\t\t// The skew adjustments keep findMatchingIndex's search centered for\n\t\t\t// shift patterns (insertions/removals at the front). A match further\n\t\t\t// than one position away means children were genuinely reordered:\n\t\t\t// flag it so the minimal set of moves is computed below. Off-by-one\n\t\t\t// matches provably keep matched old indices in increasing order, so\n\t\t\t// no moves are needed for them.\n\t\t\tif (matchingIndex == skewedIndex - 1) {\n\t\t\t\tskew--;\n\t\t\t} else if (matchingIndex == skewedIndex + 1) {\n\t\t\t\tskew++;\n\t\t\t} else if (matchingIndex != skewedIndex) {\n\t\t\t\tif (matchingIndex > skewedIndex) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\n\t\t\t\tmoved = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (moved) {\n\t\t// Children were reordered: mark the minimal set of matched (MATCHED flag)\n\t\t// children for insertion by finding the longest increasing subsequence of\n\t\t// old indices (patience sorting). Children on the subsequence stay in\n\t\t// place, all others get INSERT_VNODE. `_index` still holds the\n\t\t// matchingIndex here.\n\t\t/** @type {number[]} tails[x] is the smallest old index ending an increasing subsequence of length x+1 */\n\t\tlet tails = [];\n\t\t/** @type {number[]} length of the longest increasing subsequence ending at child i */\n\t\tlet lisLengths = [];\n\t\tfor (i = 0; i < newChildrenLength; i++) {\n\t\t\tchildVNode = newChildren[i];\n\t\t\tif (childVNode && childVNode._flags & MATCHED) {\n\t\t\t\t// Binary search for the insertion point, keeping the pass at\n\t\t\t\t// O(n log n) even for pathological reorders.\n\t\t\t\tlet lo = 0,\n\t\t\t\t\thi = tails.length;\n\t\t\t\twhile (lo < hi) {\n\t\t\t\t\tconst mid = (lo + hi) >> 1;\n\t\t\t\t\tif (tails[mid] < childVNode._index) {\n\t\t\t\t\t\tlo = mid + 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\thi = mid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttails[lo] = childVNode._index;\n\t\t\t\tlisLengths[i] = lo + 1;\n\t\t\t}\n\t\t}\n\n\t\t// `skew` is dead after the main loop; reuse it as the remaining\n\t\t// subsequence length while walking backwards. Likewise `i` is left at\n\t\t// newChildrenLength by the loop above.\n\t\tskew = tails.length;\n\t\twhile (i--) {\n\t\t\tif (lisLengths[i]) {\n\t\t\t\tif (lisLengths[i] == skew) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else {\n\t\t\t\t\tnewChildren[i]._flags |= INSERT_VNODE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove remaining oldChildren if there are any. Loop forwards so that as we\n\t// unmount DOM from the beginning of the oldChildren, we can adjust oldDom to\n\t// point to the next child, which needs to be the first DOM node that won't be\n\t// unmounted. Keep this a plain loop: an arrow function here would capture\n\t// `oldDom`, forcing V8 to context-allocate it on every call to this function.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i < oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode && !(oldVNode._flags & MATCHED)) {\n\t\t\t\tif (oldVNode._dom == oldDom) {\n\t\t\t\t\toldDom = getDomSibling(oldVNode);\n\t\t\t\t}\n\n\t\t\t\tunmount(oldVNode, oldVNode);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} parentVNode\n * @param {PreactElement} oldDom\n * @param {PreactElement} parentDom\n * @param {boolean} isMounting\n * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom, isMounting) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\tif (typeof parentVNode.type == 'function') {\n\t\t// Root children live in another container, they never move with the\n\t\t// host tree and contribute nothing to the host insertion cursor.\n\t\tif (parentVNode.props._parentDom) return oldDom;\n\t\tlet children = parentVNode._children;\n\t\tif (children) {\n\t\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\t\tif (children[i]) {\n\t\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t\t// here).\n\t\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\t\toldDom = insert(children[i], oldDom, parentDom, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else {\n\t\t// A cursor a parked Suspense subtree detached can't be a reference node:\n\t\t// retry from the vnode tree, then give up and append.\n\t\tif (oldDom && !oldDom.parentNode) {\n\t\t\toldDom = getDomSibling(parentVNode);\n\t\t\tif (oldDom && !oldDom.parentNode) oldDom = NULL;\n\t\t}\n\n\t\tif (parentVNode._dom != oldDom) {\n\t\t\t// Containers that aren't DOM nodes may not implement moveBefore()\n\t\t\tif (!isMounting && parentDom.moveBefore && parentVNode._dom.parentNode) {\n\t\t\t\t// @ts-expect-error This isn't added to TypeScript lib.d.ts yet\n\t\t\t\tparentDom.moveBefore(parentVNode._dom, oldDom);\n\t\t\t} else {\n\t\t\t\tparentDom.insertBefore(parentVNode._dom, oldDom || NULL);\n\t\t\t}\n\t\t}\n\t\toldDom = parentVNode._dom;\n\t}\n\n\twhile ((oldDom = oldDom && oldDom.nextSibling) && oldDom.nodeType == 8);\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {ComponentChildren} children The unflattened children of a virtual\n * node\n * @returns {VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children != NULL && typeof children != 'boolean') {\n\t\tif (isArray(children)) {\n\t\t\tchildren.some(child => {\n\t\t\t\ttoChildArray(child, out);\n\t\t\t});\n\t\t} else {\n\t\t\tout.push(children);\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n * @param {VNode} childVNode\n * @param {VNode[]} oldChildren\n * @param {number} skewedIndex\n * @param {number} remainingOldChildren\n * @returns {number}\n */\nfunction findMatchingIndex(\n\tchildVNode,\n\toldChildren,\n\tskewedIndex,\n\tremainingOldChildren\n) {\n\tconst key = childVNode.key;\n\tconst type = childVNode.type;\n\tlet oldVNode = oldChildren[skewedIndex];\n\tconst matched = oldVNode && !(oldVNode._flags & MATCHED);\n\n\t// We only need to perform a search if there are more children\n\t// (remainingOldChildren) to search. However, if the oldVNode we just looked\n\t// at skewedIndex was not already used in this diff, then there must be at\n\t// least 1 other (so greater than 1) remainingOldChildren to attempt to match\n\t// against. So the following condition checks that ensuring\n\t// remainingOldChildren > 1 if the oldVNode is not already used/matched. Else\n\t// if the oldVNode was null or matched, then there could needs to be at least\n\t// 1 (aka `remainingOldChildren > 0`) children to find and compare against.\n\t//\n\t// If there is an unkeyed functional VNode, that isn't a built-in like our Fragment,\n\t// we should not search as we risk re-using state of an unrelated VNode. (reverted for now)\n\tlet shouldSearch =\n\t\t// (typeof type != 'function' || type === Fragment || key) &&\n\t\t// The ternary keeps this a Smi comparison; `> matched` would compare\n\t\t// number to boolean which V8 can't serve from the fast path.\n\t\tremainingOldChildren > (matched ? 1 : 0);\n\n\tif (\n\t\t(oldVNode === NULL && key == NULL) ||\n\t\t(matched && key == oldVNode.key && type == oldVNode.type)\n\t) {\n\t\treturn skewedIndex;\n\t} else if (shouldSearch) {\n\t\tlet x = skewedIndex - 1;\n\t\tlet y = skewedIndex + 1;\n\t\twhile (x >= 0 || y < oldChildren.length) {\n\t\t\tconst childIndex = x >= 0 ? x-- : y++;\n\t\t\toldVNode = oldChildren[childIndex];\n\t\t\tif (\n\t\t\t\toldVNode &&\n\t\t\t\t!(oldVNode._flags & MATCHED) &&\n\t\t\t\tkey == oldVNode.key &&\n\t\t\t\ttype == oldVNode.type\n\t\t\t) {\n\t\t\t\treturn childIndex;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1;\n}\n","import { BaseComponent, getDomSibling } from '../component';\nimport {\n\tCOMPONENT_DIRTY,\n\tCOMPONENT_FORCE,\n\tCOMPONENT_PENDING_ERROR,\n\tCOMPONENT_PROCESSING_EXCEPTION,\n\tEMPTY_ARR,\n\tEMPTY_OBJ,\n\tFORCE_PROPS_REVALIDATE,\n\tMATHML_TOKEN_ELEMENTS,\n\tMATH_NAMESPACE,\n\tMODE_HYDRATE,\n\tMODE_SUSPENDED,\n\tNULL,\n\tRESET_MODE,\n\tSVG_NAMESPACE,\n\tUNDEFINED,\n\tXHTML_NAMESPACE\n} from '../constants';\nimport { Fragment } from '../create-element';\nimport options from '../options';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\n\n/**\n * @typedef {import('../internal').ComponentType} ComponentType\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * @template {any} T\n * @typedef {import('../internal').Ref<T>} Ref<T>\n */\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {PreactElement} parentDom The parent of the DOM element\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\t/** @type {any} */\n\tlet tmp,\n\t\tresumed,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== UNDEFINED) return NULL;\n\n\t// If the previous diff bailed out, resume creating/hydrating into the DOM\n\t// that was kept while suspended (server-rendered, or already in the\n\t// container we rendered into). `tmp` holds the stored excess node until the\n\t// options._diff call below.\n\tif (\n\t\toldVNode._flags & MODE_SUSPENDED &&\n\t\t// @ts-expect-error This is MODE_HYDRATE or 0\n\t\t((isHydrating = oldVNode._flags & MODE_HYDRATE),\n\t\t(tmp = oldVNode._component._excess))\n\t) {\n\t\tnewVNode._flags |= isHydrating;\n\t\tresumed = excessDomChildren = [];\n\t\tif (tmp.nodeType == 8) {\n\t\t\t// Re-scan DOM from stored start marker for streamed hydration.\n\t\t\t// `depth` only ever reaches 0 through the `break` below, so it\n\t\t\t// doesn't need to be re-tested in the loop condition.\n\t\t\tfor (\n\t\t\t\tlet depth = 1, node = tmp.nextSibling;\n\t\t\t\tnode;\n\t\t\t\tnode = node.nextSibling\n\t\t\t) {\n\t\t\t\tif (node.nodeType == 8) {\n\t\t\t\t\tif (node.data.startsWith('$s')) depth++;\n\t\t\t\t\telse if (node.data.startsWith('/$s') && !--depth) break;\n\t\t\t\t}\n\t\t\t\texcessDomChildren.push(node);\n\t\t\t}\n\t\t} else {\n\t\t\texcessDomChildren.push(tmp);\n\t\t}\n\t\toldDom = excessDomChildren[0];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\touter: if (typeof newType == 'function') {\n\t\tlet oldCommitQueueLength = commitQueue.length;\n\t\ttry {\n\t\t\tlet c,\n\t\t\t\toldProps,\n\t\t\t\toldState,\n\t\t\t\tsnapshot,\n\t\t\t\tnewProps = newVNode.props;\n\t\t\tconst isClassComponent = (tmp = newType.prototype) && tmp.render;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tconst provider = tmp && globalContext[tmp._id];\n\t\t\tconst componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tif (c._bits & COMPONENT_PENDING_ERROR) {\n\t\t\t\t\tc._bits |= COMPONENT_PROCESSING_EXCEPTION;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif (isClassComponent) {\n\t\t\t\t\t// @ts-expect-error Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-expect-error Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new BaseComponent(\n\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t);\n\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tc._bits |= COMPONENT_DIRTY;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\tif (isClassComponent) {\n\t\t\t\tif (!c._nextState) c._nextState = c.state;\n\n\t\t\t\t// Invoke getDerivedStateFromProps\n\t\t\t\tif (newType.getDerivedStateFromProps) {\n\t\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t\t}\n\n\t\t\t\t\tassign(\n\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\t\t\tc._vnode = newVNode;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (!oldVNode._component) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\t!newType.getDerivedStateFromProps &&\n\t\t\t\t\tc.componentWillMount\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidMount) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\t!newType.getDerivedStateFromProps &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(newVNode._original == oldVNode._original &&\n\t\t\t\t\t\t!(c._bits & COMPONENT_DIRTY)) ||\n\t\t\t\t\t(!(c._bits & COMPONENT_FORCE) &&\n\t\t\t\t\t\tc.shouldComponentUpdate &&\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false)\n\t\t\t\t) {\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original != oldVNode._original) {\n\t\t\t\t\t\t// When we are dealing with a bail because of sCU we have to update\n\t\t\t\t\t\t// the props, state and dirty-state.\n\t\t\t\t\t\t// when we are dealing with strict-equality we don't as the child could still\n\t\t\t\t\t\t// be dirtied see #3883\n\t\t\t\t\t\tc.props = newProps;\n\t\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t\tc._bits &= ~COMPONENT_DIRTY;\n\t\t\t\t\t}\n\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.some(vnode => {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tEMPTY_ARR.push.apply(c._renderCallbacks, c._stateCallbacks);\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Skip over the retained subtree without traversing it; the\n\t\t\t\t\t// `result` branch in diffChildren picks this up as the next\n\t\t\t\t\t// oldDom.\n\t\t\t\t\toldDom = getDomSibling(oldVNode);\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent && c.componentDidUpdate) {\n\t\t\t\t\tc._renderCallbacks.push(() => {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._parentDom = parentDom;\n\t\t\tc._bits &= ~COMPONENT_FORCE;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif (isClassComponent) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._bits &= ~COMPONENT_DIRTY;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tEMPTY_ARR.push.apply(c._renderCallbacks, c._stateCallbacks);\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._bits &= ~COMPONENT_DIRTY;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._bits & COMPONENT_DIRTY && ++count < 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tglobalContext = assign({}, globalContext, c.getChildContext());\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tisClassComponent &&\n\t\t\t\toldVNode._component &&\n\t\t\t\tc.getSnapshotBeforeUpdate\n\t\t\t) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tconst renderResult =\n\t\t\t\ttmp && tmp.type === Fragment && tmp.key == NULL\n\t\t\t\t\t? tmp.props.children\n\t\t\t\t\t: tmp;\n\n\t\t\t// A vnode carrying a `_parentDom` prop, considered a new root,\n\t\t\t// continues rendering into that container. The subtree must stay\n\t\t\t// invisible to the host tree's DOM bookkeeping: the portal vnode\n\t\t\t// keeps a `null` `_dom` and the host insertion cursor (`oldDom`)\n\t\t\t// passes through unchanged.\n\t\t\t// `tmp` (the raw render result, already unwrapped into renderResult)\n\t\t\t// doubles as the saved host insertion cursor while we render into\n\t\t\t// the portal's container.\n\t\t\tif (newProps._parentDom) {\n\t\t\t\ttmp = oldDom;\n\t\t\t\tparentDom = newProps._parentDom;\n\t\t\t\t// If we portal into a math or svg element we need\n\t\t\t\t// to swap the namespace (chart libraries often do this).\n\t\t\t\t// The document follows the container too (e.g. iframes) as\n\t\t\t\t// diffElementNodes derives it from its parentDom.\n\t\t\t\tnamespace = parentDom.namespaceURI;\n\t\t\t\t// Portals are never server-rendered: hydration must not claim the\n\t\t\t\t// host parent's excess nodes for the container's children.\n\t\t\t\tisHydrating = excessDomChildren = NULL;\n\n\t\t\t\t// Changing the container remounts the children into the new one\n\t\t\t\tif (oldVNode.props && oldVNode.props._parentDom != parentDom) {\n\t\t\t\t\t/** @type {VNode[]} */ (oldVNode._children).some(child => {\n\t\t\t\t\t\tif (child) unmount(child, child);\n\t\t\t\t\t});\n\t\t\t\t\toldVNode._children = NULL;\n\t\t\t\t}\n\n\t\t\t\toldDom = oldVNode._children ? getDomSibling(oldVNode, 0) : NULL;\n\t\t\t}\n\n\t\t\toldDom = diffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tisArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnamespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\t// When we exit a portal we\n\t\t\t// change up the oldDom\n\t\t\tif (newProps._parentDom) {\n\t\t\t\tnewVNode._dom = NULL;\n\t\t\t\toldDom = tmp;\n\t\t\t}\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags &= RESET_MODE;\n\t\t\tif (oldVNode._flags & MODE_SUSPENDED) c._excess = NULL;\n\n\t\t\t// Remove the kept DOM this resumed render didn't claim\n\t\t\tif (resumed) resumed.some(removeNode);\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\t// Only clear when this render was the retry; PENDING_ERROR set by a\n\t\t\t// descendant during this render must survive until then.\n\t\t\tif (c._bits & COMPONENT_PROCESSING_EXCEPTION) {\n\t\t\t\tc._bits &= ~(COMPONENT_PROCESSING_EXCEPTION | COMPONENT_PENDING_ERROR);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t// We remove any componentDidMount, ...\n\t\t\t// that have been invalidated by us\n\t\t\t// intercepting the error.\n\t\t\tcommitQueue.length = oldCommitQueueLength;\n\t\t\tnewVNode._original = NULL;\n\t\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\t\tif (isHydrating || excessDomChildren) {\n\t\t\t\tif (e.then) {\n\t\t\t\t\tlet commentMarkersToFind = 0,\n\t\t\t\t\t\tstartMarker;\n\n\t\t\t\t\tnewVNode._flags |= isHydrating\n\t\t\t\t\t\t? MODE_HYDRATE | MODE_SUSPENDED\n\t\t\t\t\t\t: MODE_SUSPENDED;\n\n\t\t\t\t\tif (excessDomChildren) {\n\t\t\t\t\t\tfor (let i = 0; i < excessDomChildren.length; i++) {\n\t\t\t\t\t\t\tlet child = excessDomChildren[i];\n\t\t\t\t\t\t\tif (!child) continue;\n\n\t\t\t\t\t\t\tif (child.nodeType == 8) {\n\t\t\t\t\t\t\t\texcessDomChildren[i] = NULL;\n\t\t\t\t\t\t\t\tif (child.data.startsWith('$s')) {\n\t\t\t\t\t\t\t\t\tif (!commentMarkersToFind++) startMarker = child;\n\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\tchild.data.startsWith('/$s') &&\n\t\t\t\t\t\t\t\t\t!--commentMarkersToFind\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\toldDom = child;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (commentMarkersToFind) {\n\t\t\t\t\t\t\t\texcessDomChildren[i] = NULL;\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\tif (!startMarker) {\n\t\t\t\t\t\twhile (oldDom && oldDom.nodeType == 8 && oldDom.nextSibling) {\n\t\t\t\t\t\t\toldDom = oldDom.nextSibling;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (excessDomChildren) {\n\t\t\t\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = NULL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstartMarker = oldDom;\n\t\t\t\t\t}\n\t\t\t\t\t// Store the start marker directly; children re-scanned on resume.\n\t\t\t\t\t// A re-suspension keeps the marker it originally started from.\n\t\t\t\t\tif (!newVNode._component._excess) {\n\t\t\t\t\t\tnewVNode._component._excess = startMarker;\n\t\t\t\t\t}\n\t\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\t} else if (excessDomChildren) {\n\t\t\t\t\texcessDomChildren.some(removeNode);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t}\n\n\t\t\tif (!newVNode._children) {\n\t\t\t\tnewVNode._children = oldVNode._children || [];\n\t\t\t}\n\n\t\t\tif (!e.then) markAsForce(newVNode);\n\t\t\toptions._catchError(e, newVNode, oldVNode);\n\t\t}\n\t} else {\n\t\toldDom = newVNode._dom = diffElementNodes(\n\t\t\toldVNode._dom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\tisHydrating,\n\t\t\trefQueue,\n\t\t\tparentDom\n\t\t);\n\t}\n\n\tif ((tmp = options.diffed)) tmp(newVNode);\n\n\treturn newVNode._flags & MODE_SUSPENDED ? UNDEFINED : oldDom;\n}\n\nfunction markAsForce(vnode) {\n\tif (vnode) {\n\t\tif (vnode._component) vnode._component._bits |= COMPONENT_FORCE;\n\t\tif (vnode._children) vnode._children.some(markAsForce);\n\t}\n}\n\n/**\n * @param {Array<Component>} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {VNode} root\n */\nexport function commitRoot(commitQueue, root, refQueue) {\n\tfor (let i = 0; i < refQueue.length; ) {\n\t\tapplyRef(refQueue[i++], refQueue[i++], refQueue[i++]);\n\t}\n\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c => {\n\t\ttry {\n\t\t\t// @ts-expect-error Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb => {\n\t\t\t\t// @ts-expect-error See above comment on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {PreactElement} dom The DOM element representing the virtual nodes\n * being diffed\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array<PreactElement>} excessDomChildren\n * @param {Array<Component>} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n * @param {PreactElement} parentDom The parent this element will be inserted\n * into; new nodes are created from its ownerDocument (e.g. iframes), or from\n * the global document for containers that don't have one\n * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue,\n\tparentDom\n) {\n\tlet oldProps = oldVNode.props || EMPTY_OBJ;\n\tconst newProps = newVNode.props;\n\tconst nodeType = /** @type {string} */ (newVNode.type);\n\t/** @type {any} */\n\tlet i;\n\t/** @type {{ __html?: string }} */\n\tlet newHtml;\n\t/** @type {{ __html?: string }} */\n\tlet oldHtml;\n\t/** @type {ComponentChildren} */\n\tlet newChildren;\n\tlet value;\n\tlet inputValue;\n\tlet checked;\n\n\t// Tracks entering and exiting namespaces when descending through the tree.\n\tif (nodeType == 'svg') namespace = SVG_NAMESPACE;\n\telse if (nodeType == 'math') namespace = MATH_NAMESPACE;\n\telse if (!namespace) namespace = XHTML_NAMESPACE;\n\n\tif (excessDomChildren) {\n\t\tfor (i = 0; i < excessDomChildren.length; i++) {\n\t\t\tvalue = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren.\n\t\t\t// `localName` is only present on elements, so it doubles as the\n\t\t\t// element check for the non-text branch.\n\t\t\tif (\n\t\t\t\tvalue &&\n\t\t\t\t(nodeType ? value.localName == nodeType : value.nodeType == 3)\n\t\t\t) {\n\t\t\t\tdom = value;\n\t\t\t\texcessDomChildren[i] = NULL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!dom) {\n\t\tconst doc = parentDom.ownerDocument || document;\n\t\tif (!nodeType) {\n\t\t\treturn doc.createTextNode(newProps);\n\t\t}\n\n\t\tdom = doc.createElementNS(namespace, nodeType, newProps.is && newProps);\n\n\t\t// we are creating a new node, so we can assume this is a new subtree (in\n\t\t// case we are hydrating), this deopts the hydrate\n\t\tif (isHydrating) {\n\t\t\tif (options._hydrationMismatch)\n\t\t\t\toptions._hydrationMismatch(newVNode, excessDomChildren);\n\t\t\tisHydrating = false;\n\t\t}\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = NULL;\n\t}\n\n\tif (!nodeType) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps && (!isHydrating || dom.data != newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// A <template> holds its children in a separate document-fragment, both\n\t\t// when reading existing DOM and when inserting new nodes. `parentDom` is\n\t\t// unused from here on, so we reuse it as the container for our children.\n\t\t// @ts-expect-error\n\t\tparentDom = nodeType == 'template' ? dom.content : dom;\n\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren =\n\t\t\tnodeType == 'textarea' && newProps.defaultValue != NULL\n\t\t\t\t? NULL\n\t\t\t\t: excessDomChildren && slice.call(parentDom.childNodes);\n\n\t\t// If we are in a situation where we are not hydrating but are using\n\t\t// existing DOM (e.g. replaceNode) we should read the existing DOM\n\t\t// attributes to diff them\n\t\tif (!isHydrating && excessDomChildren) {\n\t\t\t// Keep this a plain loop: an arrow function here would capture\n\t\t\t// `oldProps`, forcing V8 to context-allocate it and slowing down the\n\t\t\t// hot `for (i in oldProps)` loop below for every element we diff.\n\t\t\toldProps = {};\n\t\t\tfor (i = 0; i < dom.attributes.length; i++) {\n\t\t\t\tvalue = dom.attributes[i];\n\t\t\t\toldProps[value.name] = value.value;\n\t\t\t}\n\t\t}\n\n\t\tfor (i in oldProps) {\n\t\t\tvalue = oldProps[i];\n\t\t\tif (i == 'dangerouslySetInnerHTML') {\n\t\t\t\toldHtml = value;\n\t\t\t} else if (\n\t\t\t\ti != 'children' &&\n\t\t\t\t!(i in newProps) &&\n\t\t\t\t!(i == 'value' && 'defaultValue' in newProps) &&\n\t\t\t\t!(i == 'checked' && 'defaultChecked' in newProps)\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, NULL, value, namespace);\n\t\t\t}\n\t\t}\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tconst shouldRevalidateProps = oldVNode._flags & FORCE_PROPS_REVALIDATE;\n\t\tfor (i in newProps) {\n\t\t\tvalue = newProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t\tnewChildren = value;\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\tnewHtml = value;\n\t\t\t} else if (i == 'value') {\n\t\t\t\tinputValue = value;\n\t\t\t} else if (i == 'checked') {\n\t\t\t\tchecked = value;\n\t\t\t} else if (\n\t\t\t\t(!isHydrating || typeof value == 'function') &&\n\t\t\t\t(oldProps[i] !== value || (shouldRevalidateProps && value != NULL))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, value, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\tif (\n\t\t\t\t!isHydrating &&\n\t\t\t\t(!oldHtml ||\n\t\t\t\t\t(newHtml.__html != oldHtml.__html && newHtml.__html != dom.innerHTML))\n\t\t\t) {\n\t\t\t\tdom.innerHTML = newHtml.__html;\n\t\t\t}\n\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\tif (oldHtml) dom.textContent = '';\n\n\t\t\tif (\n\t\t\t\tnodeType == 'foreignObject' ||\n\t\t\t\t(namespace == MATH_NAMESPACE && MATHML_TOKEN_ELEMENTS.test(nodeType))\n\t\t\t) {\n\t\t\t\tnamespace = XHTML_NAMESPACE;\n\t\t\t}\n\n\t\t\tdiffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tisArray(newChildren) ? newChildren : [newChildren],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnamespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children && getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren) excessDomChildren.some(removeNode);\n\t\t}\n\n\t\t// As above, don't diff props during hydration\n\t\tif (!isHydrating || nodeType == 'textarea') {\n\t\t\ti = 'value';\n\t\t\tif (nodeType == 'progress' && inputValue == NULL) {\n\t\t\t\tdom.removeAttribute(i);\n\t\t\t} else if (\n\t\t\t\tinputValue != UNDEFINED &&\n\t\t\t\t// #2756 For the <progress>-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(inputValue !== dom[i] || (nodeType == 'progress' && !inputValue))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, inputValue, oldProps[i], namespace);\n\t\t\t}\n\n\t\t\ti = 'checked';\n\t\t\tif (checked != UNDEFINED && checked != dom[i]) {\n\t\t\t\tsetProperty(dom, i, checked, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {Ref<any> & { _unmount?: unknown }} ref\n * @param {any} value\n * @param {VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') {\n\t\t\tif (typeof ref._unmount == 'function') {\n\t\t\t\tref._unmount();\n\t\t\t}\n\n\t\t\tif (typeof ref._unmount != 'function' || value) {\n\t\t\t\t// Store the cleanup function on the function\n\t\t\t\t// instance object itself to avoid shape\n\t\t\t\t// transitioning vnode\n\t\t\t\tref._unmount = ref(value);\n\t\t\t}\n\t\t} else ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {VNode} vnode The virtual node to unmount\n * @param {VNode} parentVNode The parent of the VNode that initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref) && (!r.current || r.current == vnode._dom)) {\n\t\tapplyRef(r, NULL, parentVNode);\n\t}\n\n\tif ((r = vnode._component)) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr._parentDom = r._globalContext = NULL;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i < r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(\n\t\t\t\t\tr[i],\n\t\t\t\t\tparentVNode,\n\t\t\t\t\t// A portal's children live in another container, so a removed\n\t\t\t\t\t// host ancestor doesn't detach them; always remove them.\n\t\t\t\t\ttypeof vnode.type == 'function'\n\t\t\t\t\t\t? skipRemove && !vnode.props._parentDom\n\t\t\t\t\t\t: true\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ((r = vnode._dom)) {\n\t\tif (!skipRemove) removeNode(r);\n\t\tif (r._listeners) r._listeners = NULL;\n\t}\n\n\tvnode._dom = vnode._component = vnode._parent = NULL;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { EMPTY_OBJ, MODE_HYDRATE, NULL } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createVNode, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to render into\n */\nexport function render(vnode, parentDom) {\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// https://github.com/preactjs/preact/issues/3794\n\t// https://github.com/preactjs/preact/issues/5118\n\tif (parentDom.nodeType == 9) {\n\t\tparentDom = parentDom.documentElement;\n\t}\n\n\t// @ts-expect-error\n\tlet isHydrating = vnode && vnode._flags & MODE_HYDRATE;\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating ? NULL : parentDom._children;\n\n\tparentDom._children = createVNode(Fragment, { children: [vnode] });\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [],\n\t\trefQueue = [];\n\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tparentDom._children,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.namespaceURI,\n\t\toldVNode\n\t\t\t? NULL\n\t\t\t: parentDom.firstChild\n\t\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t\t: NULL,\n\t\tcommitQueue,\n\t\toldVNode ? oldVNode._dom : parentDom.firstChild,\n\t\t// @ts-expect-error we are doing a bit-wise operation so it's either 0 or true\n\t\tisHydrating,\n\t\trefQueue\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, parentDom._children, refQueue);\n\n\t// The live children are tracked on _children after diffing.\n\tparentDom._children.props.children = NULL;\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to update\n */\nexport function hydrate(vnode, parentDom) {\n\t// Only objects can carry the flag. Primitives (null, strings, numbers,\n\t// booleans) render into the existing DOM the same way hydrating would.\n\tif (vnode && typeof vnode == 'object') {\n\t\t// @ts-expect-error\n\t\tvnode._flags |= MODE_HYDRATE;\n\t}\n\trender(vnode, parentDom);\n}\n","import { createVNode } from './create-element';\n\n/**\n * Portal component. A unique type is used instead of Fragment so that a\n * portal returned directly from a component isn't collapsed into the\n * component's children array by the Fragment unwrapping in `diff()`.\n * @param {object} props\n */\nfunction Portal(props) {\n\treturn props.children;\n}\n\n/**\n * Create a `Portal` to continue rendering the vnode tree at a different DOM node\n * @param {import('./internal').ComponentChildren} vnode The vnode to render\n * @param {import('./internal').PreactElement} container The DOM node to continue rendering in to\n */\nexport function createPortal(vnode, container) {\n\treturn createVNode(Portal, { _parentDom: container, children: vnode });\n}\n","import { resetRenderCount } from '../component';\nimport {\n\tCOMPONENT_DIRTY,\n\tCOMPONENT_PENDING_ERROR,\n\tCOMPONENT_PROCESSING_EXCEPTION,\n\tCOMPONENT_FORCE\n} from '../constants';\n\n/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw the error that was caught (except\n * for unmounting when this parameter is the highest parent that was being\n * unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component,\n\t\t/** @type {import('../internal').ComponentType} */\n\t\tctor,\n\t\t/** @type {number} */\n\t\thandled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif (\n\t\t\t(component = vnode._component) &&\n\t\t\t!(component._bits & COMPONENT_PROCESSING_EXCEPTION)\n\t\t) {\n\t\t\tcomponent._bits |= COMPONENT_FORCE;\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._bits & COMPONENT_DIRTY;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._bits & COMPONENT_DIRTY;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\tcomponent._bits |= COMPONENT_PENDING_ERROR;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t\t// This component failed to handle the error, so what its\n\t\t\t\t// getDerivedStateFromError did must not make the next ancestor a\n\t\t\t\t// boundary.\n\t\t\t\thandled = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Reset rerender count to 0, so that the next render will not be skipped\n\t// when we leverage prefresh\n\tresetRenderCount();\n\tthrow error;\n}\n"],"names":["options","vnodeId","isValidElement","rerenderQueue","prevDebounce","rerenderCount","depthSort","EVENT_DISPATCHED","EVENT_ATTACHED","CAPTURE_REGEX","eventClock","eventProxy","eventProxyCapture","i","EMPTY_OBJ","EMPTY_ARR","MATHML_TOKEN_ELEMENTS","isArray","Array","slice","assign","Object","removeNode","node","parentNode","remove","createElement","type","props","children","key","ref","normalizedProps","length","arguments","call","createVNode","cloneElement","vnode","undefined","original","__k","__","__b","__e","__c","constructor","__v","__i","__u","createRef","current","Fragment","BaseComponent","context","this","__g","getDomSibling","childIndex","sibling","__P","updateParentDomPointers","some","child","enqueueRender","c","push","debounceRendering","queueMicrotask","process","l","component","newVNode","oldVNode","oldDom","commitQueue","refQueue","parentDom","sort","shift","diff","__n","namespaceURI","commitRoot","diffChildren","renderResult","newParentVNode","oldParentVNode","globalContext","namespace","excessDomChildren","isHydrating","childVNode","newDom","firstChildDom","result","oldChildren","newChildrenLength","constructNewChildrenArray","applyRef","insert","nextSibling","skewedIndex","matchingIndex","tails","lisLengths","lo","hi","mid","oldChildrenLength","remainingOldChildren","skew","moved","newChildren","String","findMatchingIndex","unmount","parentVNode","isMounting","moveBefore","insertBefore","nodeType","toChildArray","out","x","y","matched","setStyle","style","value","setProperty","dom","name","oldValue","useCapture","o","cssText","replace","toLowerCase","addEventListener","removeEventListener","e","removeAttribute","setAttribute","createEventProxy","eventHandler","event","tmp","resumed","depth","oldCommitQueueLength","oldProps","oldState","snapshot","newProps","isClassComponent","provider","componentContext","renderHook","count","commentMarkersToFind","startMarker","newType","__z","data","startsWith","outer","prototype","render","contextType","doRender","sub","state","__h","__s","getDerivedStateFromProps","componentWillReceiveProps","shouldComponentUpdate","apply","componentWillUpdate","componentDidUpdate","componentWillMount","componentDidMount","__r","getChildContext","getSnapshotBeforeUpdate","then","MODE_HYDRATE","indexOf","markAsForce","diffElementNodes","diffed","root","cb","newHtml","oldHtml","inputValue","checked","doc","shouldRevalidateProps","localName","ownerDocument","document","createTextNode","createElementNS","is","__m","content","defaultValue","childNodes","attributes","__html","innerHTML","textContent","test","skipRemove","r","componentWillUnmount","documentElement","firstChild","hydrate","createContext","Context","subs","ctx","Set","_props","forEach","add","old","delete","Provider","Consumer","contextValue","Portal","createPortal","container","error","errorInfo","ctor","handled","getDerivedStateFromError","setState","componentDidCatch","update","callback","s","forceUpdate","a","b","Symbol"],"mappings":"AAEO,ICSDA,ECPFC,EAoHSC,EC+DPC,EAWFC,EACHC,EA2BKC,ECvNFC,EACHC,EAWKC,EAaFC,EA8IEC,EACAC,EC5KKC,EL8BEC,EAAgC,CAAA,EAChCC,EAAY,GAEZC,EAAwB,0BMlCxBC,EAAUC,MAAMD,QAChBE,EAAQJ,EAAUI,MAClBC,EAASC,OAAOD,OAMtB,SAASE,EAAWC,GACtBA,GAAQA,EAAKC,YAAYD,EAAKE,QACnC,CJGO,SAASC,EAAcC,EAAMC,EAAOC,GAC1C,IACCC,EACAC,EACAlB,EAHGmB,EAAkB,CAAA,EAIrBC,EAASC,UAAUD,OACpB,IAAKpB,KAAKe,EACA,OAALf,EAAYiB,EAAMF,EAAMf,GACd,OAALA,GAA6B,mBAARc,EAAoBI,EAAMH,EAAMf,GACzDmB,EAAgBnB,GAAKe,EAAMf,GAOjC,OAJIoB,EAAS,IACZD,EAAgBH,SAAWI,EAAS,EAAId,EAAMgB,KAAKD,UAAW,GAAKL,GAG7DO,EAAYT,EAAMK,EAAiBF,EAAKC,EFA5B,KECpB,CAWO,SAASM,EAAaC,EAAOV,EAAOC,GAC1C,IACCC,EACAC,EACAlB,EAHGmB,EAAkBZ,EAAO,GAAIkB,EAAMV,OAItCK,EAASC,UAAUD,OAEpB,IAAKpB,KAAKe,EACA,OAALf,EAAYiB,EAAMF,EAAMf,GACd,OAALA,GAAmC,mBAAdyB,EAAMX,KAAoBI,EAAMH,EAAMf,GAC/DmB,EAAgBnB,GAAKe,EAAMf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