{"version":3,"file":"crank.cjs","sources":["../src/crank.ts"],"sourcesContent":["const NOOP = () => {};\nconst IDENTITY = <T>(value: T): T => value;\n\nfunction wrap<T>(value: Array<T> | T | undefined): Array<T> {\n\treturn value === undefined ? [] : Array.isArray(value) ? value : [value];\n}\n\nfunction unwrap<T>(arr: Array<T>): Array<T> | T | undefined {\n\treturn arr.length === 0 ? undefined : arr.length === 1 ? arr[0] : arr;\n}\n\ntype NonStringIterable<T> = Iterable<T> & object;\n\n/**\n * Ensures a value is an array.\n *\n * This function does the same thing as wrap() above except it handles nulls\n * and iterables, so it is appropriate for wrapping user-provided element\n * children.\n */\nfunction arrayify<T>(\n\tvalue: NonStringIterable<T> | T | null | undefined,\n): Array<T> {\n\treturn value == null\n\t\t? []\n\t\t: Array.isArray(value)\n\t\t\t? value\n\t\t\t: typeof value === \"string\" ||\n\t\t\t\t  typeof (value as any)[Symbol.iterator] !== \"function\"\n\t\t\t\t? [value]\n\t\t\t\t: // TODO: inference broke in TypeScript 3.9.\n\t\t\t\t\t[...(value as any)];\n}\n\nfunction isIteratorLike(\n\tvalue: any,\n): value is Iterator<unknown> | AsyncIterator<unknown> {\n\treturn value != null && typeof value.next === \"function\";\n}\n\nfunction isPromiseLike(value: any): value is PromiseLike<unknown> {\n\treturn value != null && typeof value.then === \"function\";\n}\n\n/**\n * A type which represents all valid values for an element tag.\n */\nexport type Tag = string | symbol | Component;\n\n/**\n * A helper type to map the tag of an element to its expected props.\n *\n * @template TTag - The tag associated with the props. Can be a string, symbol\n * or a component function.\n */\nexport type TagProps<TTag extends Tag> = TTag extends string\n\t? JSX.IntrinsicElements[TTag]\n\t: TTag extends Component<infer TProps>\n\t\t? TProps & JSX.IntrinsicAttributes\n\t\t: Record<string, unknown> & JSX.IntrinsicAttributes;\n\n/***\n * SPECIAL TAGS\n *\n * Crank provides a couple tags which have special meaning for the renderer.\n ***/\n\n/**\n * A special tag for grouping multiple children within the same parent.\n *\n * All non-string iterables which appear in the element tree are implicitly\n * wrapped in a fragment element.\n *\n * This tag is just the empty string, and you can use the empty string in\n * createElement calls or transpiler options directly to avoid having to\n * reference this export.\n */\nexport const Fragment = \"\";\nexport type Fragment = typeof Fragment;\n\n// TODO: We assert the following symbol tags as any because TypeScript support\n// for symbol tags in JSX doesn’t exist yet.\n// https://github.com/microsoft/TypeScript/issues/38367\n\n/**\n * A special tag for rendering into a new root node via a root prop.\n *\n * This tag is useful for creating element trees with multiple roots, for\n * things like modals or tooltips.\n *\n * Renderer.prototype.render() will implicitly wrap top-level element trees in\n * a Portal element.\n */\nexport const Portal = Symbol.for(\"crank.Portal\") as any;\nexport type Portal = typeof Portal;\n\n/**\n * A special tag which preserves whatever was previously rendered in the\n * element’s position.\n *\n * Copy elements are useful for when you want to prevent a subtree from\n * rerendering as a performance optimization. Copy elements can also be keyed,\n * in which case the previously rendered keyed element will be copied.\n */\nexport const Copy = Symbol.for(\"crank.Copy\") as any;\nexport type Copy = typeof Copy;\n\n/**\n * A special tag for injecting raw nodes or strings via a value prop.\n *\n * Renderer.prototype.raw() is called with the value prop.\n */\nexport const Raw = Symbol.for(\"crank.Raw\") as any;\nexport type Raw = typeof Raw;\n\n/**\n * Describes all valid values of an element tree, excluding iterables.\n *\n * Arbitrary objects can also be safely rendered, but will be converted to a\n * string using the toString() method. We exclude them from this type to catch\n * potential mistakes.\n */\nexport type Child = Element | string | number | boolean | null | undefined;\n\n/**\n * An arbitrarily nested iterable of Child values.\n *\n * We use a recursive interface here rather than making the Children type\n * directly recursive because recursive type aliases were added in TypeScript\n * 3.7.\n *\n * You should avoid referencing this type directly, as it is mainly exported to\n * prevent TypeScript errors.\n */\nexport interface ChildIterable extends Iterable<Child | ChildIterable> {}\n\n/**\n * Describes all valid values of an element tree, including arbitrarily nested\n * iterables of such values.\n */\nexport type Children = Child | ChildIterable;\n\n/**\n * Represents all functions which can be used as a component.\n *\n * @template [TProps=*] - The expected props for the component.\n */\nexport type Component<TProps extends Record<string, unknown> = any> = (\n\tthis: Context<TProps>,\n\tprops: TProps,\n\tctx: Context<TProps>,\n) =>\n\t| Children\n\t| PromiseLike<Children>\n\t// The return type of iterators must include void because TypeScript will\n\t// infer generators which return implicitly as having a void return type.\n\t| Iterator<Children, Children | void, any>\n\t| AsyncIterator<Children, Children | void, any>;\n\ntype ChildrenIteratorResult = IteratorResult<Children, Children | void>;\n\n/**\n * A type to keep track of keys. Any value can be a key, though null and\n * undefined are ignored.\n */\ntype Key = unknown;\n\nconst ElementSymbol = Symbol.for(\"crank.Element\");\n\n// To maximize compatibility between Crank versions, starting with 0.2.0, any\n// changes to the Element properties will be considered a breaking change.\nexport interface Element<TTag extends Tag = Tag> {\n\t/**\n\t * @internal\n\t * A unique symbol to identify elements as elements across versions and\n\t * realms, and to protect against basic injection attacks.\n\t * https://overreacted.io/why-do-react-elements-have-typeof-property/\n\t *\n\t * This property is defined on the element prototype rather than per\n\t * instance, because it is the same for every Element.\n\t */\n\t$$typeof: typeof ElementSymbol;\n\n\t/**\n\t * The tag of the element. Can be a string, symbol or function.\n\t */\n\ttag: TTag;\n\n\t/**\n\t * An object containing the \"properties\" of an element. These correspond to\n\t * the attribute syntax from JSX.\n\t */\n\tprops: TagProps<TTag>;\n}\n\n/**\n * Elements are the basic building blocks of Crank applications. They are\n * JavaScript objects which are interpreted by special classes called renderers\n * to produce and manage stateful nodes.\n *\n * @template {Tag} [TTag=Tag] - The type of the tag of the element.\n *\n * @example\n * // specific element types\n * let div: Element<\"div\">;\n * let portal: Element<Portal>;\n * let myEl: Element<MyComponent>;\n *\n * // general element types\n * let host: Element<string | symbol>;\n * let component: Element<Component>;\n *\n * Typically, you use a helper function like createElement to create elements\n * rather than instatiating this class directly.\n */\nexport class Element<TTag extends Tag = Tag> {\n\tconstructor(tag: TTag, props: TagProps<TTag>) {\n\t\tthis.tag = tag;\n\t\tthis.props = props;\n\t}\n\n\tget key(): Key {\n\t\treturn this.props.key;\n\t}\n\n\tget ref(): unknown {\n\t\treturn this.props.ref;\n\t}\n\n\tget copy(): boolean {\n\t\treturn !!this.props.copy;\n\t}\n}\n\n// See Element interface\nElement.prototype.$$typeof = ElementSymbol;\n\nexport function isElement(value: any): value is Element {\n\treturn value != null && value.$$typeof === ElementSymbol;\n}\n\nconst DEPRECATED_PROP_PREFIXES = [\"crank-\", \"c-\", \"$\"];\n\nconst DEPRECATED_SPECIAL_PROP_BASES = [\"key\", \"ref\", \"static\"];\n\nconst SPECIAL_PROPS = new Set([\"children\", \"key\", \"ref\", \"copy\"]);\nfor (const propPrefix of DEPRECATED_PROP_PREFIXES) {\n\tfor (const propBase of DEPRECATED_SPECIAL_PROP_BASES) {\n\t\tSPECIAL_PROPS.add(propPrefix + propBase);\n\t}\n}\n\n/**\n * Creates an element with the specified tag, props and children.\n *\n * This function is usually used as a transpilation target for JSX transpilers,\n * but it can also be called directly. It additionally extracts special props so\n * they aren’t accessible to renderer methods or components, and assigns the\n * children prop according to any additional arguments passed to the function.\n */\nexport function createElement<TTag extends Tag>(\n\ttag: TTag,\n\tprops?: TagProps<TTag> | null | undefined,\n\t...children: Array<unknown>\n): Element<TTag> {\n\tif (props == null) {\n\t\tprops = {} as TagProps<TTag>;\n\t}\n\n\tfor (let i = 0; i < DEPRECATED_PROP_PREFIXES.length; i++) {\n\t\tconst propPrefix = DEPRECATED_PROP_PREFIXES[i];\n\t\tfor (let j = 0; j < DEPRECATED_SPECIAL_PROP_BASES.length; j++) {\n\t\t\tconst propBase = DEPRECATED_SPECIAL_PROP_BASES[j];\n\t\t\tconst deprecatedPropName = propPrefix + propBase;\n\t\t\tconst targetPropBase = propBase === \"static\" ? \"copy\" : propBase;\n\t\t\tif (deprecatedPropName in (props as TagProps<TTag>)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`The \\`${deprecatedPropName}\\` prop is deprecated. Use \\`${targetPropBase}\\` instead.`,\n\t\t\t\t);\n\t\t\t\t(props as TagProps<TTag>)[targetPropBase] = (props as TagProps<TTag>)[\n\t\t\t\t\tdeprecatedPropName\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t}\n\n\tif (children.length > 1) {\n\t\t(props as TagProps<TTag>).children = children;\n\t} else if (children.length === 1) {\n\t\t(props as TagProps<TTag>).children = children[0];\n\t}\n\n\treturn new Element(tag, props as TagProps<TTag>);\n}\n\n/** Clones a given element, shallowly copying the props object. */\nexport function cloneElement<TTag extends Tag>(\n\tel: Element<TTag>,\n): Element<TTag> {\n\tif (!isElement(el)) {\n\t\tthrow new TypeError(\"Cannot clone non-element\");\n\t}\n\n\treturn new Element(el.tag, {...el.props});\n}\n\n/*** ELEMENT UTILITIES ***/\n\n// WHAT ARE WE DOING TO THE CHILDREN???\n/**\n * All values in the element tree are narrowed from the union in Child to\n * NarrowedChild during rendering, to simplify element diffing.\n */\ntype NarrowedChild = Element | string | undefined;\n\nfunction narrow(value: Children): NarrowedChild {\n\tif (typeof value === \"boolean\" || value == null) {\n\t\treturn undefined;\n\t} else if (typeof value === \"string\" || isElement(value)) {\n\t\treturn value;\n\t} else if (typeof (value as any)[Symbol.iterator] === \"function\") {\n\t\treturn createElement(Fragment, null, value);\n\t}\n\n\treturn value.toString();\n}\n\n/**\n * A helper type which repesents all possible rendered values of an element.\n *\n * @template TNode - The node type for the element provided by the renderer.\n *\n * When asking the question, what is the \"value\" of a specific element, the\n * answer varies depending on the tag:\n *\n * For host elements, the value is the nodes created for the element, e.g. the\n * DOM node in the case of the DOMRenderer.\n *\n * For fragments, the value is the value of the\n *\n * For portals, the value is undefined, because a Portal element’s root and\n * children are opaque to its parent.\n *\n * For components, the value can be any of the above, because the value of a\n * component is determined by its immediate children.\n *\n * Rendered values can also be strings or arrays of nodes and strings, in the\n * case of component or fragment elements with strings or multiple children.\n *\n * All of these possible values are reflected in this utility type.\n */\nexport type ElementValue<TNode> =\n\t| Array<TNode | string>\n\t| TNode\n\t| string\n\t| undefined;\n\n/**\n * Takes an array of element values and normalizes the output as an array of\n * nodes and strings.\n *\n * @returns Normalized array of nodes and/or strings.\n *\n * Normalize will flatten only one level of nested arrays, because it is\n * designed to be called once at each level of the tree. It will also\n * concatenate adjacent strings and remove all undefined values.\n */\nfunction normalize<TNode>(\n\tvalues: Array<ElementValue<TNode>>,\n): Array<TNode | string> {\n\tconst result: Array<TNode | string> = [];\n\tlet buffer: string | undefined;\n\tfor (let i = 0; i < values.length; i++) {\n\t\tconst value = values[i];\n\t\tif (!value) {\n\t\t\t// pass\n\t\t} else if (typeof value === \"string\") {\n\t\t\tbuffer = (buffer || \"\") + value;\n\t\t} else if (!Array.isArray(value)) {\n\t\t\tif (buffer) {\n\t\t\t\tresult.push(buffer);\n\t\t\t\tbuffer = undefined;\n\t\t\t}\n\n\t\t\tresult.push(value);\n\t\t} else {\n\t\t\t// We could use recursion here but it’s just easier to do it inline.\n\t\t\tfor (let j = 0; j < value.length; j++) {\n\t\t\t\tconst value1 = value[j];\n\t\t\t\tif (!value1) {\n\t\t\t\t\t// pass\n\t\t\t\t} else if (typeof value1 === \"string\") {\n\t\t\t\t\tbuffer = (buffer || \"\") + value1;\n\t\t\t\t} else {\n\t\t\t\t\tif (buffer) {\n\t\t\t\t\t\tresult.push(buffer);\n\t\t\t\t\t\tbuffer = undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tresult.push(value1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (buffer) {\n\t\tresult.push(buffer);\n\t}\n\n\treturn result;\n}\n\n/**\n * @internal\n * The internal nodes which are cached and diffed against new elements when\n * rendering element trees.\n */\nclass Retainer<TNode> {\n\t/**\n\t * The element associated with this retainer.\n\t */\n\tdeclare el: Element;\n\t/**\n\t * The context associated with this element. Will only be defined for\n\t * component elements.\n\t */\n\tdeclare ctx: ContextImpl<TNode> | undefined;\n\t/**\n\t * The retainer children of this element. Retainers form a tree which mirrors\n\t * elements. Can be a single child or undefined as a memory optimization.\n\t */\n\tdeclare children: Array<RetainerChild<TNode>> | RetainerChild<TNode>;\n\t/**\n\t * The value associated with this element.\n\t */\n\tdeclare value: ElementValue<TNode>;\n\t/**\n\t * The cached child values of this element. Only host and component elements\n\t * will use this property.\n\t */\n\tdeclare cachedChildValues: ElementValue<TNode>;\n\t/**\n\t * The child which this retainer replaces. This property is used when an\n\t * async retainer tree replaces previously rendered elements, so that the\n\t * previously rendered elements can remain visible until the async tree\n\t * fulfills. Will be set to undefined once this subtree fully renders.\n\t */\n\tdeclare fallbackValue: RetainerChild<TNode>;\n\n\tdeclare inflightValue: Promise<ElementValue<TNode>> | undefined;\n\tdeclare onNextValues: Function | undefined;\n\tconstructor(el: Element) {\n\t\tthis.el = el;\n\t\tthis.ctx = undefined;\n\t\tthis.children = undefined;\n\t\tthis.value = undefined;\n\t\tthis.cachedChildValues = undefined;\n\t\tthis.fallbackValue = undefined;\n\t\tthis.inflightValue = undefined;\n\t\tthis.onNextValues = undefined;\n\t}\n}\n\n/**\n * The retainer equivalent of ElementValue\n */\ntype RetainerChild<TNode> = Retainer<TNode> | string | undefined;\n\n/**\n * Finds the value of the element according to its type.\n *\n * @returns The value of the element.\n */\nfunction getValue<TNode>(ret: Retainer<TNode>): ElementValue<TNode> {\n\tif (typeof ret.fallbackValue !== \"undefined\") {\n\t\treturn typeof ret.fallbackValue === \"object\"\n\t\t\t? getValue(ret.fallbackValue)\n\t\t\t: ret.fallbackValue;\n\t} else if (ret.el.tag === Portal) {\n\t\treturn;\n\t} else if (typeof ret.el.tag !== \"function\" && ret.el.tag !== Fragment) {\n\t\treturn ret.value;\n\t}\n\n\treturn unwrap(getChildValues(ret));\n}\n\n/**\n * Walks an element’s children to find its child values.\n *\n * @returns A normalized array of nodes and strings.\n */\nfunction getChildValues<TNode>(ret: Retainer<TNode>): Array<TNode | string> {\n\tif (ret.cachedChildValues) {\n\t\treturn wrap(ret.cachedChildValues);\n\t}\n\n\tconst values: Array<ElementValue<TNode>> = [];\n\tconst children = wrap(ret.children);\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (child) {\n\t\t\tvalues.push(typeof child === \"string\" ? child : getValue(child));\n\t\t}\n\t}\n\n\tconst values1 = normalize(values);\n\tconst tag = ret.el.tag;\n\tif (typeof tag === \"function\" || (tag !== Fragment && tag !== Raw)) {\n\t\tret.cachedChildValues = unwrap(values1);\n\t}\n\treturn values1;\n}\n\nexport interface HydrationData<TNode> {\n\tprops: Record<string, unknown>;\n\tchildren: Array<TNode | string>;\n}\n\n// TODO: Document the interface and methods\nexport interface RendererImpl<\n\tTNode,\n\tTScope,\n\tTRoot extends TNode = TNode,\n\tTResult = ElementValue<TNode>,\n> {\n\tscope<TTag extends string | symbol>(\n\t\tscope: TScope | undefined,\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t): TScope | undefined;\n\n\tcreate<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tprops: TagProps<TTag>,\n\t\tscope: TScope | undefined,\n\t): TNode;\n\n\thydrate<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode | TRoot,\n\t\tprops: TagProps<TTag>,\n\t): HydrationData<TNode> | undefined;\n\n\t/**\n\t * Called when an element’s rendered value is exposed via render, schedule,\n\t * refresh, refs, or generator yield expressions.\n\t *\n\t * @param value - The value of the element being read. Can be a node, a\n\t * string, undefined, or an array of nodes and strings, depending on the\n\t * element.\n\t *\n\t * @returns Varies according to the specific renderer subclass. By default,\n\t * it exposes the element’s value.\n\t *\n\t * This is useful for renderers which don’t want to expose their internal\n\t * nodes. For instance, the HTML renderer will convert all internal nodes to\n\t * strings.\n\t */\n\tread(value: ElementValue<TNode>): TResult;\n\n\t/**\n\t * Called for each string in an element tree.\n\t *\n\t * @param text - The string child.\n\t * @param scope - The current scope.\n\t *\n\t * @returns A string to be passed to arrange.\n\t *\n\t * Rather than returning Text nodes as we would in the DOM case, for example,\n\t * we delay that step for Renderer.prototype.arrange. We do this so that\n\t * adjacent strings can be concatenated, and the actual element tree can be\n\t * rendered in normalized form.\n\t */\n\ttext(\n\t\ttext: string,\n\t\tscope: TScope | undefined,\n\t\thydration: HydrationData<TNode> | undefined,\n\t): string;\n\n\t/**\n\t * Called for each Raw element whose value prop is a string.\n\t *\n\t * @param text - The string child.\n\t * @param scope - The current scope.\n\t *\n\t * @returns The parsed node or string.\n\t */\n\traw(\n\t\tvalue: string | TNode,\n\t\tscope: TScope | undefined,\n\t\thydration: HydrationData<TNode> | undefined,\n\t): ElementValue<TNode>;\n\n\tpatch<TTag extends string | symbol, TName extends string>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tname: TName,\n\t\tvalue: unknown,\n\t\toldValue: unknown,\n\t\tscope: TScope,\n\t): unknown;\n\n\tarrange<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tprops: Record<string, unknown>,\n\t\tchildren: Array<TNode | string>,\n\t\toldProps: Record<string, unknown> | undefined,\n\t\toldChildren: Array<TNode | string> | undefined,\n\t): unknown;\n\n\tdispose<TTag extends string | symbol>(\n\t\ttag: TTag,\n\t\tnode: TNode,\n\t\tprops: Record<string, unknown>,\n\t): unknown;\n\n\tflush(root: TRoot): unknown;\n}\n\nconst defaultRendererImpl: RendererImpl<unknown, unknown, unknown, unknown> = {\n\tcreate() {\n\t\tthrow new Error(\"Not implemented\");\n\t},\n\thydrate() {\n\t\tthrow new Error(\"Not implemented\");\n\t},\n\tscope: IDENTITY,\n\tread: IDENTITY,\n\ttext: IDENTITY,\n\traw: IDENTITY,\n\tpatch: NOOP,\n\tarrange: NOOP,\n\tdispose: NOOP,\n\tflush: NOOP,\n};\n\nconst _RendererImpl = Symbol.for(\"crank.RendererImpl\");\n/**\n * An abstract class which is subclassed to render to different target\n * environments. Subclasses will typically call super() with a custom\n * RendererImpl. This class is responsible for kicking off the rendering\n * process and caching previous trees by root.\n *\n * @template TNode - The type of the node for a rendering environment.\n * @template TScope - Data which is passed down the tree.\n * @template TRoot - The type of the root for a rendering environment.\n * @template TResult - The type of exposed values.\n */\nexport class Renderer<\n\tTNode extends object = object,\n\tTScope = unknown,\n\tTRoot extends TNode = TNode,\n\tTResult = ElementValue<TNode>,\n> {\n\t/**\n\t * @internal\n\t * A weakmap which stores element trees by root.\n\t */\n\tdeclare cache: WeakMap<object, Retainer<TNode>>;\n\n\tdeclare [_RendererImpl]: RendererImpl<TNode, TScope, TRoot, TResult>;\n\tconstructor(impl: Partial<RendererImpl<TNode, TScope, TRoot, TResult>>) {\n\t\tthis.cache = new WeakMap();\n\t\tthis[_RendererImpl] = {\n\t\t\t...(defaultRendererImpl as RendererImpl<TNode, TScope, TRoot, TResult>),\n\t\t\t...impl,\n\t\t};\n\t}\n\n\t/**\n\t * Renders an element tree into a specific root.\n\t *\n\t * @param children - An element tree. You can render null with a previously\n\t * used root to delete the previously rendered element tree from the cache.\n\t * @param root - The node to be rendered into. The renderer will cache\n\t * element trees per root.\n\t * @param bridge - An optional context that will be the ancestor context of all\n\t * elements in the tree. Useful for connecting different renderers so that\n\t * events/provisions properly propagate. The context for a given root must be\n\t * the same or an error will be thrown.\n\t *\n\t * @returns The result of rendering the children, or a possible promise of\n\t * the result if the element tree renders asynchronously.\n\t */\n\trender(\n\t\tchildren: Children,\n\t\troot?: TRoot | undefined,\n\t\tbridge?: Context | undefined,\n\t): Promise<TResult> | TResult {\n\t\tlet ret: Retainer<TNode> | undefined;\n\t\tconst ctx = bridge && (bridge[_ContextImpl] as ContextImpl<TNode>);\n\t\tif (typeof root === \"object\" && root !== null) {\n\t\t\tret = this.cache.get(root);\n\t\t}\n\n\t\tlet oldProps: Record<string, any> | undefined;\n\t\tif (ret === undefined) {\n\t\t\tret = new Retainer(createElement(Portal, {children, root}));\n\t\t\tret.value = root;\n\t\t\tret.ctx = ctx;\n\t\t\tif (typeof root === \"object\" && root !== null && children != null) {\n\t\t\t\tthis.cache.set(root, ret);\n\t\t\t}\n\t\t} else if (ret.ctx !== ctx) {\n\t\t\tthrow new Error(\"Context mismatch\");\n\t\t} else {\n\t\t\toldProps = ret.el.props;\n\t\t\tret.el = createElement(Portal, {children, root});\n\t\t\tif (typeof root === \"object\" && root !== null && children == null) {\n\t\t\t\tthis.cache.delete(root);\n\t\t\t}\n\t\t}\n\n\t\tconst impl = this[_RendererImpl];\n\t\tconst childValues = diffChildren(\n\t\t\timpl,\n\t\t\troot,\n\t\t\tret,\n\t\t\tctx,\n\t\t\timpl.scope(undefined, Portal, ret.el.props),\n\t\t\tret,\n\t\t\tchildren,\n\t\t\tundefined, // hydration data\n\t\t);\n\n\t\t// We return the child values of the portal because portal elements\n\t\t// themselves have no readable value.\n\t\tif (isPromiseLike(childValues)) {\n\t\t\treturn childValues.then((childValues) =>\n\t\t\t\tcommitRootRender(impl, root, ctx, ret!, childValues, oldProps),\n\t\t\t);\n\t\t}\n\n\t\treturn commitRootRender(impl, root, ctx, ret, childValues, oldProps);\n\t}\n\n\thydrate(\n\t\tchildren: Children,\n\t\troot: TRoot,\n\t\tbridge?: Context | undefined,\n\t): Promise<TResult> | TResult {\n\t\tconst impl = this[_RendererImpl];\n\t\tconst ctx = bridge && (bridge[_ContextImpl] as ContextImpl<TNode>);\n\t\tlet ret: Retainer<TNode> | undefined;\n\t\tret = this.cache.get(root);\n\t\tif (ret !== undefined) {\n\t\t\t// If there is a retainer for the root, hydration is not necessary.\n\t\t\treturn this.render(children, root, bridge);\n\t\t}\n\n\t\tlet oldProps: Record<string, any> | undefined;\n\t\tret = new Retainer(createElement(Portal, {children, root}));\n\t\tret.value = root;\n\t\tif (typeof root === \"object\" && root !== null && children != null) {\n\t\t\tthis.cache.set(root, ret);\n\t\t}\n\n\t\tconst hydrationData = impl.hydrate(Portal, root, {});\n\t\tconst childValues = diffChildren(\n\t\t\timpl,\n\t\t\troot,\n\t\t\tret,\n\t\t\tctx,\n\t\t\timpl.scope(undefined, Portal, ret.el.props),\n\t\t\tret,\n\t\t\tchildren,\n\t\t\thydrationData,\n\t\t);\n\n\t\t// We return the child values of the portal because portal elements\n\t\t// themselves have no readable value.\n\t\tif (isPromiseLike(childValues)) {\n\t\t\treturn childValues.then((childValues) =>\n\t\t\t\tcommitRootRender(impl, root, ctx, ret!, childValues, oldProps),\n\t\t\t);\n\t\t}\n\n\t\treturn commitRootRender(impl, root, ctx, ret, childValues, oldProps);\n\t}\n}\n\n/*** PRIVATE RENDERER FUNCTIONS ***/\nfunction commitRootRender<TNode, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, unknown, TRoot, TResult>,\n\troot: TRoot | undefined,\n\tctx: ContextImpl<TNode> | undefined,\n\tret: Retainer<TNode>,\n\tchildValues: Array<TNode | string>,\n\toldProps: Record<string, any> | undefined,\n): TResult {\n\t// element is a host or portal element\n\tif (root != null) {\n\t\trenderer.arrange(\n\t\t\tPortal,\n\t\t\troot,\n\t\t\tret.el.props,\n\t\t\tchildValues,\n\t\t\toldProps,\n\t\t\twrap(ret.cachedChildValues),\n\t\t);\n\t\tflush(renderer, root);\n\t}\n\n\tret.cachedChildValues = unwrap(childValues);\n\tif (root == null) {\n\t\tunmount(renderer, ret, ctx, ret);\n\t}\n\n\treturn renderer.read(ret.cachedChildValues);\n}\n\nfunction diffChildren<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tscope: TScope | undefined,\n\tparent: Retainer<TNode>,\n\tchildren: Children,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<Array<TNode | string>> | Array<TNode | string> {\n\tconst oldRetained = wrap(parent.children);\n\tconst newRetained: typeof oldRetained = [];\n\tconst newChildren = arrayify(children);\n\tconst values: Array<Promise<ElementValue<TNode>> | ElementValue<TNode>> = [];\n\tlet graveyard: Array<Retainer<TNode>> | undefined;\n\tlet childrenByKey: Map<Key, Retainer<TNode>> | undefined;\n\tlet seenKeys: Set<Key> | undefined;\n\tlet isAsync = false;\n\t// When hydrating, sibling element trees must be rendered in order, because\n\t// we do not know how many DOM nodes an element will render.\n\tlet hydrationBlock: Promise<unknown> | undefined;\n\tlet oi = 0;\n\tlet oldLength = oldRetained.length;\n\tfor (let ni = 0, newLength = newChildren.length; ni < newLength; ni++) {\n\t\t// length checks to prevent index out of bounds deoptimizations.\n\t\tlet ret = oi >= oldLength ? undefined : oldRetained[oi];\n\t\tlet child = narrow(newChildren[ni]);\n\t\t{\n\t\t\t// aligning new children with old retainers\n\t\t\tlet oldKey = typeof ret === \"object\" ? ret.el.key : undefined;\n\t\t\tlet newKey = typeof child === \"object\" ? child.key : undefined;\n\t\t\tif (newKey !== undefined && seenKeys && seenKeys.has(newKey)) {\n\t\t\t\tconsole.error(\"Duplicate key\", newKey);\n\t\t\t\tnewKey = undefined;\n\t\t\t}\n\n\t\t\tif (oldKey === newKey) {\n\t\t\t\tif (childrenByKey !== undefined && newKey !== undefined) {\n\t\t\t\t\tchildrenByKey.delete(newKey);\n\t\t\t\t}\n\n\t\t\t\toi++;\n\t\t\t} else {\n\t\t\t\tchildrenByKey = childrenByKey || createChildrenByKey(oldRetained, oi);\n\t\t\t\tif (newKey === undefined) {\n\t\t\t\t\twhile (ret !== undefined && oldKey !== undefined) {\n\t\t\t\t\t\toi++;\n\t\t\t\t\t\tret = oldRetained[oi];\n\t\t\t\t\t\toldKey = typeof ret === \"object\" ? ret.el.key : undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\toi++;\n\t\t\t\t} else {\n\t\t\t\t\tret = childrenByKey.get(newKey);\n\t\t\t\t\tif (ret !== undefined) {\n\t\t\t\t\t\tchildrenByKey.delete(newKey);\n\t\t\t\t\t}\n\n\t\t\t\t\t(seenKeys = seenKeys || new Set()).add(newKey);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Updating\n\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\tif (typeof child === \"object\") {\n\t\t\tif (child.tag === Copy || (typeof ret === \"object\" && ret.el === child)) {\n\t\t\t\tvalue = getInflightValue(ret);\n\t\t\t} else {\n\t\t\t\tlet oldProps: Record<string, any> | undefined;\n\t\t\t\tlet copy = false;\n\t\t\t\tif (typeof ret === \"object\" && ret.el.tag === child.tag) {\n\t\t\t\t\toldProps = ret.el.props;\n\t\t\t\t\tret.el = child;\n\t\t\t\t\tif (child.copy) {\n\t\t\t\t\t\tvalue = getInflightValue(ret);\n\t\t\t\t\t\tcopy = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (typeof ret === \"object\") {\n\t\t\t\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst fallback = ret;\n\t\t\t\t\tret = new Retainer<TNode>(child);\n\t\t\t\t\tret.fallbackValue = fallback;\n\t\t\t\t}\n\n\t\t\t\tif (copy) {\n\t\t\t\t\t// pass\n\t\t\t\t} else if (child.tag === Raw) {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateRaw(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: updateRaw(renderer, ret, scope, oldProps, hydrationData);\n\t\t\t\t} else if (child.tag === Fragment) {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateFragment(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: updateFragment(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t);\n\t\t\t\t} else if (typeof child.tag === \"function\") {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateComponent(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: updateComponent(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\thost,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = hydrationBlock\n\t\t\t\t\t\t? hydrationBlock.then(() =>\n\t\t\t\t\t\t\t\tupdateHost(\n\t\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\t\tret as Retainer<TNode>,\n\t\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: updateHost(\n\t\t\t\t\t\t\t\trenderer,\n\t\t\t\t\t\t\t\troot,\n\t\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\t\tret,\n\t\t\t\t\t\t\t\toldProps,\n\t\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tisAsync = true;\n\t\t\t\tif (hydrationData !== undefined) {\n\t\t\t\t\thydrationBlock = value;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// child is a string or undefined\n\t\t\tif (typeof ret === \"object\") {\n\t\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t\t}\n\n\t\t\tif (typeof child === \"string\") {\n\t\t\t\tvalue = ret = renderer.text(child, scope, hydrationData);\n\t\t\t} else {\n\t\t\t\tret = undefined;\n\t\t\t}\n\t\t}\n\n\t\tvalues[ni] = value;\n\t\tnewRetained[ni] = ret;\n\t}\n\n\t// cleanup remaining retainers\n\tfor (; oi < oldLength; oi++) {\n\t\tconst ret = oldRetained[oi];\n\t\tif (\n\t\t\ttypeof ret === \"object\" &&\n\t\t\t(typeof ret.el.key === \"undefined\" ||\n\t\t\t\t!seenKeys ||\n\t\t\t\t!seenKeys.has(ret.el.key))\n\t\t) {\n\t\t\t(graveyard = graveyard || []).push(ret);\n\t\t}\n\t}\n\n\tif (childrenByKey !== undefined && childrenByKey.size > 0) {\n\t\t(graveyard = graveyard || []).push(...childrenByKey.values());\n\t}\n\n\tparent.children = unwrap(newRetained);\n\tif (isAsync) {\n\t\tlet childValues1 = Promise.all(values).finally(() => {\n\t\t\tif (graveyard) {\n\t\t\t\tfor (let i = 0; i < graveyard.length; i++) {\n\t\t\t\t\tunmount(renderer, host, ctx, graveyard[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tlet onChildValues!: Function;\n\t\tchildValues1 = Promise.race([\n\t\t\tchildValues1,\n\t\t\tnew Promise<any>((resolve) => (onChildValues = resolve)),\n\t\t]);\n\n\t\tif (parent.onNextValues) {\n\t\t\tparent.onNextValues(childValues1);\n\t\t}\n\n\t\tparent.onNextValues = onChildValues;\n\t\treturn childValues1.then((childValues) => {\n\t\t\tparent.inflightValue = parent.fallbackValue = undefined;\n\t\t\treturn normalize(childValues);\n\t\t});\n\t} else {\n\t\tif (graveyard) {\n\t\t\tfor (let i = 0; i < graveyard.length; i++) {\n\t\t\t\tunmount(renderer, host, ctx, graveyard[i]);\n\t\t\t}\n\t\t}\n\n\t\tif (parent.onNextValues) {\n\t\t\tparent.onNextValues(values);\n\t\t\tparent.onNextValues = undefined;\n\t\t}\n\n\t\tparent.inflightValue = parent.fallbackValue = undefined;\n\t\t// We can assert there are no promises in the array because isAsync is false\n\t\treturn normalize(values as Array<ElementValue<TNode>>);\n\t}\n}\n\nfunction createChildrenByKey<TNode>(\n\tchildren: Array<RetainerChild<TNode>>,\n\toffset: number,\n): Map<Key, Retainer<TNode>> {\n\tconst childrenByKey = new Map<Key, Retainer<TNode>>();\n\tfor (let i = offset; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (typeof child === \"object\" && typeof child.el.key !== \"undefined\") {\n\t\t\tchildrenByKey.set(child.el.key, child);\n\t\t}\n\t}\n\n\treturn childrenByKey;\n}\n\nfunction getInflightValue<TNode>(\n\tchild: RetainerChild<TNode>,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (typeof child !== \"object\") {\n\t\treturn child;\n\t}\n\n\tconst ctx: ContextImpl<TNode> | undefined =\n\t\ttypeof child.el.tag === \"function\" ? child.ctx : undefined;\n\tif (ctx && ctx.f & IsUpdating && ctx.inflightValue) {\n\t\treturn ctx.inflightValue;\n\t} else if (child.inflightValue) {\n\t\treturn child.inflightValue;\n\t}\n\n\treturn getValue(child);\n}\n\nfunction updateRaw<TNode, TScope>(\n\trenderer: RendererImpl<TNode, TScope, TNode, unknown>,\n\tret: Retainer<TNode>,\n\tscope: TScope | undefined,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): ElementValue<TNode> {\n\tconst props = ret.el.props;\n\tif (!oldProps || oldProps.value !== props.value) {\n\t\tret.value = renderer.raw(props.value as any, scope, hydrationData);\n\t\tif (typeof ret.el.ref === \"function\") {\n\t\t\tret.el.ref(ret.value);\n\t\t}\n\t}\n\n\treturn ret.value;\n}\n\nfunction updateFragment<TNode, TScope, TRoot extends TNode>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, unknown>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tconst childValues = diffChildren(\n\t\trenderer,\n\t\troot,\n\t\thost,\n\t\tctx,\n\t\tscope,\n\t\tret,\n\t\tret.el.props.children as any,\n\t\thydrationData,\n\t);\n\n\tif (isPromiseLike(childValues)) {\n\t\tret.inflightValue = childValues.then((childValues) => unwrap(childValues));\n\t\treturn ret.inflightValue;\n\t}\n\n\treturn unwrap(childValues);\n}\n\nfunction updateHost<TNode, TScope, TRoot extends TNode>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, unknown>,\n\troot: TRoot | undefined,\n\tctx: ContextImpl<TNode, TScope, TRoot> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tconst el = ret.el;\n\tconst tag = el.tag as string | symbol;\n\tlet hydrationValue: TNode | string | undefined;\n\tif (el.tag === Portal) {\n\t\troot = ret.value = el.props.root as any;\n\t} else {\n\t\tif (hydrationData !== undefined) {\n\t\t\tconst value = hydrationData.children.shift();\n\t\t\thydrationValue = value;\n\t\t}\n\t}\n\n\tscope = renderer.scope(scope, tag, el.props);\n\tlet childHydrationData: HydrationData<TNode> | undefined;\n\tif (hydrationValue != null && typeof hydrationValue !== \"string\") {\n\t\tchildHydrationData = renderer.hydrate(tag, hydrationValue, el.props);\n\n\t\tif (childHydrationData === undefined) {\n\t\t\thydrationValue = undefined;\n\t\t}\n\t}\n\tconst childValues = diffChildren(\n\t\trenderer,\n\t\troot,\n\t\tret,\n\t\tctx,\n\t\tscope,\n\t\tret,\n\t\tret.el.props.children as any,\n\t\tchildHydrationData,\n\t);\n\n\tif (isPromiseLike(childValues)) {\n\t\tret.inflightValue = childValues.then((childValues) =>\n\t\t\tcommitHost(renderer, scope, ret, childValues, oldProps, hydrationValue),\n\t\t);\n\n\t\treturn ret.inflightValue;\n\t}\n\n\treturn commitHost(\n\t\trenderer,\n\t\tscope,\n\t\tret,\n\t\tchildValues,\n\t\toldProps,\n\t\thydrationValue,\n\t);\n}\n\nfunction commitHost<TNode, TScope>(\n\trenderer: RendererImpl<TNode, TScope, TNode, unknown>,\n\tscope: TScope,\n\tret: Retainer<TNode>,\n\tchildValues: Array<TNode | string>,\n\toldProps: Record<string, any> | undefined,\n\thydrationValue: TNode | undefined,\n): ElementValue<TNode> {\n\tconst tag = ret.el.tag as string | symbol;\n\tlet value = ret.value as TNode;\n\tif (hydrationValue != null) {\n\t\tvalue = ret.value = hydrationValue;\n\t\tif (typeof ret.el.ref === \"function\") {\n\t\t\tret.el.ref(value);\n\t\t}\n\t}\n\n\tlet props = ret.el.props;\n\tlet copied: Set<string> | undefined;\n\tif (tag !== Portal) {\n\t\tif (value == null) {\n\t\t\t// This assumes that renderer.create does not return nullish values.\n\t\t\tvalue = ret.value = renderer.create(tag, props, scope);\n\t\t\tif (typeof ret.el.ref === \"function\") {\n\t\t\t\tret.el.ref(value);\n\t\t\t}\n\t\t}\n\n\t\tfor (const propName in {...oldProps, ...props}) {\n\t\t\tconst propValue = props[propName];\n\t\t\tif (propValue === Copy) {\n\t\t\t\t// TODO: The Copy tag doubles as a way to skip the patching of a prop.\n\t\t\t\t// Not sure about this feature. Should probably be removed.\n\t\t\t\t(copied = copied || new Set()).add(propName);\n\t\t\t} else if (!SPECIAL_PROPS.has(propName)) {\n\t\t\t\trenderer.patch(\n\t\t\t\t\ttag,\n\t\t\t\t\tvalue,\n\t\t\t\t\tpropName,\n\t\t\t\t\tpropValue,\n\t\t\t\t\toldProps && oldProps[propName],\n\t\t\t\t\tscope,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (copied) {\n\t\tprops = {...ret.el.props};\n\t\tfor (const name of copied) {\n\t\t\tprops[name] = oldProps && oldProps[name];\n\t\t}\n\n\t\tret.el = new Element(tag, props);\n\t}\n\n\trenderer.arrange(\n\t\ttag,\n\t\tvalue,\n\t\tprops,\n\t\tchildValues,\n\t\toldProps,\n\t\twrap(ret.cachedChildValues),\n\t);\n\tret.cachedChildValues = unwrap(childValues);\n\tif (tag === Portal) {\n\t\tflush(renderer, ret.value);\n\t\treturn;\n\t}\n\n\treturn value;\n}\n\nfunction flush<TRoot>(\n\trenderer: RendererImpl<unknown, unknown, TRoot>,\n\troot: TRoot,\n\tinitiator?: ContextImpl,\n) {\n\trenderer.flush(root);\n\tif (typeof root !== \"object\" || root === null) {\n\t\treturn;\n\t}\n\n\tconst flushMap = flushMaps.get(root as any);\n\tif (flushMap) {\n\t\tif (initiator) {\n\t\t\tconst flushMap1 = new Map<ContextImpl, Set<Function>>();\n\t\t\tfor (let [ctx, callbacks] of flushMap) {\n\t\t\t\tif (!ctxContains(initiator, ctx)) {\n\t\t\t\t\tflushMap.delete(ctx);\n\t\t\t\t\tflushMap1.set(ctx, callbacks);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (flushMap1.size) {\n\t\t\t\tflushMaps.set(root as any, flushMap1);\n\t\t\t} else {\n\t\t\t\tflushMaps.delete(root as any);\n\t\t\t}\n\t\t} else {\n\t\t\tflushMaps.delete(root as any);\n\t\t}\n\n\t\tfor (const [ctx, callbacks] of flushMap) {\n\t\t\tconst value = renderer.read(getValue(ctx.ret));\n\t\t\tfor (const callback of callbacks) {\n\t\t\t\tcallback(value);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction unmount<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\thost: Retainer<TNode>,\n\tctx: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tret: Retainer<TNode>,\n): void {\n\tif (typeof ret.el.tag === \"function\") {\n\t\tctx = ret.ctx as ContextImpl<TNode, TScope, TRoot, TResult>;\n\t\tunmountComponent(ctx);\n\t} else if (ret.el.tag === Portal) {\n\t\thost = ret;\n\t\trenderer.arrange(\n\t\t\tPortal,\n\t\t\thost.value as TNode,\n\t\t\thost.el.props,\n\t\t\t[],\n\t\t\thost.el.props,\n\t\t\twrap(host.cachedChildValues),\n\t\t);\n\t\tflush(renderer, host.value);\n\t} else if (ret.el.tag !== Fragment) {\n\t\tif (isEventTarget(ret.value)) {\n\t\t\tconst records = getListenerRecords(ctx, host);\n\t\t\tfor (let i = 0; i < records.length; i++) {\n\t\t\t\tconst record = records[i];\n\t\t\t\tret.value.removeEventListener(\n\t\t\t\t\trecord.type,\n\t\t\t\t\trecord.callback,\n\t\t\t\t\trecord.options,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\trenderer.dispose(ret.el.tag, ret.value as TNode, ret.el.props);\n\t\thost = ret;\n\t}\n\n\tconst children = wrap(ret.children);\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst child = children[i];\n\t\tif (typeof child === \"object\") {\n\t\t\tunmount(renderer, host, ctx, child);\n\t\t}\n\t}\n}\n\n/*** CONTEXT FLAGS ***/\n/**\n * A flag which is true when the component is initialized or updated by an\n * ancestor component or the root render call.\n *\n * Used to determine things like whether the nearest host ancestor needs to be\n * rearranged.\n */\nconst IsUpdating = 1 << 0;\n\n/**\n * A flag which is true when the component is synchronously executing.\n *\n * Used to guard against components triggering stack overflow or generator error.\n */\nconst IsSyncExecuting = 1 << 1;\n\n/**\n * A flag which is true when the component is in a for...of loop.\n */\nconst IsInForOfLoop = 1 << 2;\n\n/**\n * A flag which is true when the component is in a for await...of loop.\n */\nconst IsInForAwaitOfLoop = 1 << 3;\n\n/**\n * A flag which is true when the component starts the render loop but has not\n * yielded yet.\n *\n * Used to make sure that components yield at least once per loop.\n */\nconst NeedsToYield = 1 << 4;\n\n/**\n * A flag used by async generator components in conjunction with the\n * onAvailable callback to mark whether new props can be pulled via the context\n * async iterator. See the Symbol.asyncIterator method and the\n * resumeCtxIterator function.\n */\nconst PropsAvailable = 1 << 5;\n\n/**\n * A flag which is set when a component errors.\n *\n * This is mainly used to prevent some false positives in \"component yields or\n * returns undefined\" warnings. The reason we’re using this versus IsUnmounted\n * is a very troubling test (cascades sync generator parent and sync generator\n * child) where synchronous code causes a stack overflow error in a\n * non-deterministic way. Deeply disturbing stuff.\n */\nconst IsErrored = 1 << 6;\n\n/**\n * A flag which is set when the component is unmounted. Unmounted components\n * are no longer in the element tree and cannot refresh or rerender.\n */\nconst IsUnmounted = 1 << 7;\n\n/**\n * A flag which indicates that the component is a sync generator component.\n */\nconst IsSyncGen = 1 << 8;\n\n/**\n * A flag which indicates that the component is an async generator component.\n */\nconst IsAsyncGen = 1 << 9;\n\n/**\n * A flag which is set while schedule callbacks are called.\n */\nconst IsScheduling = 1 << 10;\n\n/**\n * A flag which is set when a schedule callback calls refresh.\n */\nconst IsSchedulingRefresh = 1 << 11;\n\nexport interface Context extends Crank.Context {}\n\n/**\n * An interface which can be extended to provide strongly typed provisions.\n * See Context.prototype.consume and Context.prototype.provide.\n */\nexport interface ProvisionMap extends Crank.ProvisionMap {}\n\nconst provisionMaps = new WeakMap<ContextImpl, Map<unknown, unknown>>();\n\nconst scheduleMap = new WeakMap<ContextImpl, Set<Function>>();\n\nconst cleanupMap = new WeakMap<ContextImpl, Set<Function>>();\n\n// keys are roots\nconst flushMaps = new WeakMap<object, Map<ContextImpl, Set<Function>>>();\n\n/**\n * @internal\n * The internal class which holds context data.\n */\nclass ContextImpl<\n\tTNode = unknown,\n\tTScope = unknown,\n\tTRoot extends TNode = TNode,\n\tTResult = unknown,\n> {\n\t/** A bitmask. See CONTEXT FLAGS above. */\n\tdeclare f: number;\n\n\t/** The actual context associated with this impl. */\n\tdeclare owner: Context<unknown, TResult>;\n\n\t/**\n\t * The renderer which created this context.\n\t */\n\tdeclare renderer: RendererImpl<TNode, TScope, TRoot, TResult>;\n\n\t/** The root node as set by the nearest ancestor portal. */\n\tdeclare root: TRoot | undefined;\n\n\t/**\n\t * The nearest ancestor host or portal retainer.\n\t *\n\t * When refresh is called, the host element will be arranged as the last step\n\t * of the commit, to make sure the parent’s children properly reflects the\n\t * components’s children.\n\t */\n\tdeclare host: Retainer<TNode>;\n\n\t/** The parent context impl. */\n\tdeclare parent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined;\n\n\t/** The value of the scope at the point of element’s creation. */\n\tdeclare scope: TScope | undefined;\n\n\t/** The internal node associated with this context. */\n\tdeclare ret: Retainer<TNode>;\n\n\t/**\n\t * The iterator returned by the component function.\n\t *\n\t * Existence of this property implies that the component is a generator\n\t * component. It is deleted when a component is returned.\n\t */\n\tdeclare iterator:\n\t\t| Iterator<Children, Children | void, unknown>\n\t\t| AsyncIterator<Children, Children | void, unknown>\n\t\t| undefined;\n\n\t// A \"block\" is a promise which represents the duration during which new\n\t// updates are queued, whereas \"value\" is a promise which represents the\n\t// actual pending result of rendering.\n\tdeclare inflightBlock: Promise<unknown> | undefined;\n\tdeclare inflightValue: Promise<ElementValue<TNode>> | undefined;\n\tdeclare enqueuedBlock: Promise<unknown> | undefined;\n\tdeclare enqueuedValue: Promise<ElementValue<TNode>> | undefined;\n\n\t// The following callbacks are used to implement the async generator render\n\t// loop behavior.\n\tdeclare onProps: ((props: Record<string, any>) => unknown) | undefined;\n\tdeclare onPropsRequested: Function | undefined;\n\tconstructor(\n\t\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\t\troot: TRoot | undefined,\n\t\thost: Retainer<TNode>,\n\t\tparent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\t\tscope: TScope | undefined,\n\t\tret: Retainer<TNode>,\n\t) {\n\t\tthis.f = 0;\n\t\tthis.owner = new Context(this);\n\t\tthis.renderer = renderer;\n\t\tthis.root = root;\n\t\tthis.host = host;\n\t\tthis.parent = parent;\n\t\tthis.scope = scope;\n\t\tthis.ret = ret;\n\n\t\tthis.iterator = undefined;\n\t\tthis.inflightBlock = undefined;\n\t\tthis.inflightValue = undefined;\n\t\tthis.enqueuedBlock = undefined;\n\t\tthis.enqueuedValue = undefined;\n\t\tthis.onProps = undefined;\n\t\tthis.onPropsRequested = undefined;\n\t}\n}\n\nconst _ContextImpl = Symbol.for(\"crank.ContextImpl\");\n\ntype ComponentProps<T> = T extends () => any\n\t? {}\n\t: T extends (props: infer U) => any\n\t\t? U\n\t\t: T;\n/**\n * A class which is instantiated and passed to every component as its this\n * value. Contexts form a tree just like elements and all components in the\n * element tree are connected via contexts. Components can use this tree to\n * communicate data upwards via events and downwards via provisions.\n *\n * @template [T=*] - The expected shape of the props passed to the component,\n * or a component function. Used to strongly type the Context iterator methods.\n * @template [TResult=*] - The readable element value type. It is used in\n * places such as the return value of refresh and the argument passed to\n * schedule and cleanup callbacks.\n */\nexport class Context<T = any, TResult = any> implements EventTarget {\n\t/**\n\t * @internal\n\t */\n\tdeclare [_ContextImpl]: ContextImpl<unknown, unknown, unknown, TResult>;\n\n\t// TODO: If we could make the constructor function take a nicer value, it\n\t// would be useful for testing purposes.\n\tconstructor(impl: ContextImpl<unknown, unknown, unknown, TResult>) {\n\t\tthis[_ContextImpl] = impl;\n\t}\n\n\t/**\n\t * The current props of the associated element.\n\t */\n\tget props(): ComponentProps<T> {\n\t\treturn this[_ContextImpl].ret.el.props as ComponentProps<T>;\n\t}\n\n\t/**\n\t * The current value of the associated element.\n\t *\n\t * @deprecated\n\t */\n\tget value(): TResult {\n\t\treturn this[_ContextImpl].renderer.read(getValue(this[_ContextImpl].ret));\n\t}\n\n\t*[Symbol.iterator](): Generator<ComponentProps<T>> {\n\t\tconst ctx = this[_ContextImpl];\n\t\ttry {\n\t\t\tctx.f |= IsInForOfLoop;\n\t\t\twhile (!(ctx.f & IsUnmounted)) {\n\t\t\t\tif (ctx.f & NeedsToYield) {\n\t\t\t\t\tthrow new Error(\"Context iterated twice without a yield\");\n\t\t\t\t} else {\n\t\t\t\t\tctx.f |= NeedsToYield;\n\t\t\t\t}\n\n\t\t\t\tyield ctx.ret.el.props as ComponentProps<T>;\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsInForOfLoop;\n\t\t}\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncGenerator<ComponentProps<T>> {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (ctx.f & IsSyncGen) {\n\t\t\tthrow new Error(\"Use for...of in sync generator components\");\n\t\t}\n\n\t\ttry {\n\t\t\tctx.f |= IsInForAwaitOfLoop;\n\t\t\twhile (!(ctx.f & IsUnmounted)) {\n\t\t\t\tif (ctx.f & NeedsToYield) {\n\t\t\t\t\tthrow new Error(\"Context iterated twice without a yield\");\n\t\t\t\t} else {\n\t\t\t\t\tctx.f |= NeedsToYield;\n\t\t\t\t}\n\n\t\t\t\tif (ctx.f & PropsAvailable) {\n\t\t\t\t\tctx.f &= ~PropsAvailable;\n\t\t\t\t\tyield ctx.ret.el.props as ComponentProps<T>;\n\t\t\t\t} else {\n\t\t\t\t\tconst props = await new Promise((resolve) => (ctx.onProps = resolve));\n\t\t\t\t\tif (ctx.f & IsUnmounted) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tyield props as ComponentProps<T>;\n\t\t\t\t}\n\n\t\t\t\tif (ctx.onPropsRequested) {\n\t\t\t\t\tctx.onPropsRequested();\n\t\t\t\t\tctx.onPropsRequested = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsInForAwaitOfLoop;\n\t\t\tif (ctx.onPropsRequested) {\n\t\t\t\tctx.onPropsRequested();\n\t\t\t\tctx.onPropsRequested = undefined;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Re-executes a component.\n\t *\n\t * @returns The rendered value of the component or a promise thereof if the\n\t * component or its children execute asynchronously.\n\t *\n\t * The refresh method works a little differently for async generator\n\t * components, in that it will resume the Context’s props async iterator\n\t * rather than resuming execution. This is because async generator components\n\t * are perpetually resumed independent of updates, and rely on the props\n\t * async iterator to suspend.\n\t */\n\trefresh(): Promise<TResult> | TResult {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (ctx.f & IsUnmounted) {\n\t\t\tconsole.error(\"Component is unmounted\");\n\t\t\treturn ctx.renderer.read(undefined);\n\t\t} else if (ctx.f & IsSyncExecuting) {\n\t\t\tconsole.error(\"Component is already executing\");\n\t\t\treturn ctx.renderer.read(getValue(ctx.ret));\n\t\t}\n\n\t\tconst value = enqueueComponentRun(ctx);\n\t\tif (isPromiseLike(value)) {\n\t\t\treturn (value as Promise<any>).then((value) => ctx.renderer.read(value));\n\t\t}\n\n\t\treturn ctx.renderer.read(value);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component commits. Will only\n\t * fire once per callback and update.\n\t */\n\tschedule(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet callbacks = scheduleMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tscheduleMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component’s children are\n\t * rendered into the root. Will only fire once per callback and render.\n\t */\n\tflush(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tif (typeof ctx.root !== \"object\" || ctx.root === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet flushMap = flushMaps.get(ctx.root);\n\t\tif (!flushMap) {\n\t\t\tflushMap = new Map<ContextImpl, Set<Function>>();\n\t\t\tflushMaps.set(ctx.root, flushMap);\n\t\t}\n\n\t\tlet callbacks = flushMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tflushMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\t/**\n\t * Registers a callback which fires when the component unmounts. Will only\n\t * fire once per callback.\n\t */\n\tcleanup(callback: (value: TResult) => unknown): void {\n\t\tconst ctx = this[_ContextImpl];\n\n\t\tif (ctx.f & IsUnmounted) {\n\t\t\tconst value = ctx.renderer.read(getValue(ctx.ret));\n\t\t\tcallback(value);\n\t\t\treturn;\n\t\t}\n\n\t\tlet callbacks = cleanupMap.get(ctx);\n\t\tif (!callbacks) {\n\t\t\tcallbacks = new Set<Function>();\n\t\t\tcleanupMap.set(ctx, callbacks);\n\t\t}\n\n\t\tcallbacks.add(callback);\n\t}\n\n\tconsume<TKey extends keyof ProvisionMap>(key: TKey): ProvisionMap[TKey];\n\tconsume(key: unknown): any;\n\tconsume(key: unknown): any {\n\t\tfor (\n\t\t\tlet ctx = this[_ContextImpl].parent;\n\t\t\tctx !== undefined;\n\t\t\tctx = ctx.parent\n\t\t) {\n\t\t\tconst provisions = provisionMaps.get(ctx);\n\t\t\tif (provisions && provisions.has(key)) {\n\t\t\t\treturn provisions.get(key)!;\n\t\t\t}\n\t\t}\n\t}\n\n\tprovide<TKey extends keyof ProvisionMap>(\n\t\tkey: TKey,\n\t\tvalue: ProvisionMap[TKey],\n\t): void;\n\tprovide(key: unknown, value: any): void;\n\tprovide(key: unknown, value: any): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet provisions = provisionMaps.get(ctx);\n\t\tif (!provisions) {\n\t\t\tprovisions = new Map();\n\t\t\tprovisionMaps.set(ctx, provisions);\n\t\t}\n\n\t\tprovisions.set(key, value);\n\t}\n\n\taddEventListener<T extends string>(\n\t\ttype: T,\n\t\tlistener: MappedEventListenerOrEventListenerObject<T> | null,\n\t\toptions?: boolean | AddEventListenerOptions,\n\t): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tlet listeners: Array<EventListenerRecord>;\n\t\tif (!isListenerOrListenerObject(listener)) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tconst listeners1 = listenersMap.get(ctx);\n\t\t\tif (listeners1) {\n\t\t\t\tlisteners = listeners1;\n\t\t\t} else {\n\t\t\t\tlisteners = [];\n\t\t\t\tlistenersMap.set(ctx, listeners);\n\t\t\t}\n\t\t}\n\n\t\toptions = normalizeListenerOptions(options);\n\t\tlet callback: MappedEventListener<T>;\n\t\tif (typeof listener === \"object\") {\n\t\t\tcallback = () => listener.handleEvent.apply(listener, arguments as any);\n\t\t} else {\n\t\t\tcallback = listener;\n\t\t}\n\n\t\tconst record: EventListenerRecord = {type, listener, callback, options};\n\t\tif (options.once) {\n\t\t\trecord.callback = function (this: any) {\n\t\t\t\tconst i = listeners.indexOf(record);\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tlisteners.splice(i, 1);\n\t\t\t\t}\n\n\t\t\t\treturn callback.apply(this, arguments as any);\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tlisteners.some(\n\t\t\t\t(record1) =>\n\t\t\t\t\trecord.type === record1.type &&\n\t\t\t\t\trecord.listener === record1.listener &&\n\t\t\t\t\t!record.options.capture === !record1.options.capture,\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tlisteners.push(record);\n\n\t\t// TODO: is it possible to separate out the EventTarget delegation logic\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tvalue.addEventListener(record.type, record.callback, record.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tremoveEventListener<T extends string>(\n\t\ttype: T,\n\t\tlistener: MappedEventListenerOrEventListenerObject<T> | null,\n\t\toptions?: EventListenerOptions | boolean,\n\t): void {\n\t\tconst ctx = this[_ContextImpl];\n\t\tconst listeners = listenersMap.get(ctx);\n\t\tif (listeners == null || !isListenerOrListenerObject(listener)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst options1 = normalizeListenerOptions(options);\n\t\tconst i = listeners.findIndex(\n\t\t\t(record) =>\n\t\t\t\trecord.type === type &&\n\t\t\t\trecord.listener === listener &&\n\t\t\t\t!record.options.capture === !options1.capture,\n\t\t);\n\n\t\tif (i === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst record = listeners[i];\n\t\tlisteners.splice(i, 1);\n\n\t\t// TODO: is it possible to separate out the EventTarget delegation logic\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tvalue.removeEventListener(record.type, record.callback, record.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tdispatchEvent(ev: Event): boolean {\n\t\tconst ctx = this[_ContextImpl];\n\t\tconst path: Array<ContextImpl> = [];\n\t\tfor (\n\t\t\tlet parent = ctx.parent;\n\t\t\tparent !== undefined;\n\t\t\tparent = parent.parent\n\t\t) {\n\t\t\tpath.push(parent);\n\t\t}\n\n\t\t// We patch the stopImmediatePropagation method because ev.cancelBubble\n\t\t// only informs us if stopPropagation was called and there are no\n\t\t// properties which inform us if stopImmediatePropagation was called.\n\t\tlet immediateCancelBubble = false;\n\t\tconst stopImmediatePropagation = ev.stopImmediatePropagation;\n\t\tsetEventProperty(ev, \"stopImmediatePropagation\", () => {\n\t\t\timmediateCancelBubble = true;\n\t\t\treturn stopImmediatePropagation.call(ev);\n\t\t});\n\t\tsetEventProperty(ev, \"target\", ctx.owner);\n\n\t\t// The only possible errors in this block are errors thrown by callbacks,\n\t\t// and dispatchEvent will only log these errors rather than throwing\n\t\t// them. Therefore, we place all code in a try block, log errors in the\n\t\t// catch block, and use an unsafe return statement in the finally block.\n\t\t//\n\t\t// Each early return within the try block returns true because while the\n\t\t// return value is overridden in the finally block, TypeScript\n\t\t// (justifiably) does not recognize the unsafe return statement.\n\t\ttry {\n\t\t\tsetEventProperty(ev, \"eventPhase\", CAPTURING_PHASE);\n\t\t\tfor (let i = path.length - 1; i >= 0; i--) {\n\t\t\t\tconst target = path[i];\n\t\t\t\tconst listeners = listenersMap.get(target);\n\t\t\t\tif (listeners) {\n\t\t\t\t\tsetEventProperty(ev, \"currentTarget\", target.owner);\n\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\tif (record.type === ev.type && record.options.capture) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecord.callback.call(target.owner, ev);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (ev.cancelBubble) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t{\n\t\t\t\tsetEventProperty(ev, \"eventPhase\", AT_TARGET);\n\t\t\t\tsetEventProperty(ev, \"currentTarget\", ctx.owner);\n\n\t\t\t\t// dispatchEvent calls the prop callback if it exists\n\t\t\t\tlet propCallback = ctx.ret.el.props[\"on\" + ev.type] as unknown;\n\t\t\t\tif (typeof propCallback === \"function\") {\n\t\t\t\t\tpropCallback(ev);\n\t\t\t\t\tif (immediateCancelBubble || ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Checks for camel-cased event props\n\t\t\t\t\tfor (const propName in ctx.ret.el.props) {\n\t\t\t\t\t\tif (propName.toLowerCase() === \"on\" + ev.type.toLowerCase()) {\n\t\t\t\t\t\t\tpropCallback = ctx.ret.el.props[propName] as unknown;\n\t\t\t\t\t\t\tif (typeof propCallback === \"function\") {\n\t\t\t\t\t\t\t\tpropCallback(ev);\n\t\t\t\t\t\t\t\tif (immediateCancelBubble || ev.cancelBubble) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst listeners = listenersMap.get(ctx);\n\t\t\t\tif (listeners) {\n\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\tif (record.type === ev.type) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\trecord.callback.call(ctx.owner, ev);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\treturn true;\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 (ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ev.bubbles) {\n\t\t\t\tsetEventProperty(ev, \"eventPhase\", BUBBLING_PHASE);\n\t\t\t\tfor (let i = 0; i < path.length; i++) {\n\t\t\t\t\tconst target = path[i];\n\t\t\t\t\tconst listeners = listenersMap.get(target);\n\t\t\t\t\tif (listeners) {\n\t\t\t\t\t\tsetEventProperty(ev, \"currentTarget\", target.owner);\n\t\t\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\t\t\tif (record.type === ev.type && !record.options.capture) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\trecord.callback.call(target.owner, ev);\n\t\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (immediateCancelBubble) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\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 (ev.cancelBubble) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tsetEventProperty(ev, \"eventPhase\", NONE);\n\t\t\tsetEventProperty(ev, \"currentTarget\", null);\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn !ev.defaultPrevented;\n\t\t}\n\t}\n}\n\n/*** PRIVATE CONTEXT FUNCTIONS ***/\nfunction ctxContains(parent: ContextImpl, child: ContextImpl): boolean {\n\tfor (\n\t\tlet current: ContextImpl | undefined = child;\n\t\tcurrent !== undefined;\n\t\tcurrent = current.parent\n\t) {\n\t\tif (current === parent) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nfunction updateComponent<TNode, TScope, TRoot extends TNode, TResult>(\n\trenderer: RendererImpl<TNode, TScope, TRoot, TResult>,\n\troot: TRoot | undefined,\n\thost: Retainer<TNode>,\n\tparent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined,\n\tscope: TScope | undefined,\n\tret: Retainer<TNode>,\n\toldProps: Record<string, any> | undefined,\n\thydrationData: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tlet ctx: ContextImpl<TNode, TScope, TRoot, TResult>;\n\tif (oldProps) {\n\t\tctx = ret.ctx as ContextImpl<TNode, TScope, TRoot, TResult>;\n\t\tif (ctx.f & IsSyncExecuting) {\n\t\t\tconsole.error(\"Component is already executing\");\n\t\t\treturn ret.cachedChildValues;\n\t\t}\n\t} else {\n\t\tctx = ret.ctx = new ContextImpl(renderer, root, host, parent, scope, ret);\n\t}\n\n\tctx.f |= IsUpdating;\n\treturn enqueueComponentRun(ctx, hydrationData);\n}\n\nfunction updateComponentChildren<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\tchildren: Children,\n\thydrationData?: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t} else if (ctx.f & IsErrored) {\n\t\t// This branch is necessary for some race conditions where this function is\n\t\t// called after iterator.throw() in async generator components.\n\t\treturn;\n\t} else if (children === undefined) {\n\t\tconsole.error(\n\t\t\t\"A component has returned or yielded undefined. If this was intentional, return or yield null instead.\",\n\t\t);\n\t}\n\n\tlet childValues: Promise<Array<string | TNode>> | Array<string | TNode>;\n\ttry {\n\t\t// TODO: WAT\n\t\t// We set the isExecuting flag in case a child component dispatches an event\n\t\t// which bubbles to this component and causes a synchronous refresh().\n\t\tctx.f |= IsSyncExecuting;\n\t\tchildValues = diffChildren(\n\t\t\tctx.renderer,\n\t\t\tctx.root,\n\t\t\tctx.host,\n\t\t\tctx,\n\t\t\tctx.scope,\n\t\t\tctx.ret,\n\t\t\tnarrow(children),\n\t\t\thydrationData,\n\t\t);\n\t} finally {\n\t\tctx.f &= ~IsSyncExecuting;\n\t}\n\n\tif (isPromiseLike(childValues)) {\n\t\tctx.ret.inflightValue = childValues.then((childValues) =>\n\t\t\tcommitComponent(ctx, childValues),\n\t\t);\n\n\t\treturn ctx.ret.inflightValue;\n\t}\n\n\treturn commitComponent(ctx, childValues);\n}\n\nfunction commitComponent<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\tvalues: Array<TNode | string>,\n): ElementValue<TNode> {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t}\n\n\tconst listeners = listenersMap.get(ctx);\n\tif (listeners && listeners.length) {\n\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\tconst value = values[i];\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tfor (let j = 0; j < listeners.length; j++) {\n\t\t\t\t\tconst record = listeners[j];\n\t\t\t\t\tvalue.addEventListener(record.type, record.callback, record.options);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst oldValues = wrap(ctx.ret.cachedChildValues);\n\tlet value = (ctx.ret.cachedChildValues = unwrap(values));\n\tif (ctx.f & IsScheduling) {\n\t\tctx.f |= IsSchedulingRefresh;\n\t} else if (!(ctx.f & IsUpdating)) {\n\t\t// If we’re not updating the component, which happens when components are\n\t\t// refreshed, or when async generator components iterate, we have to do a\n\t\t// little bit housekeeping when a component’s child values have changed.\n\t\tif (!arrayEqual(oldValues, values)) {\n\t\t\tconst records = getListenerRecords(ctx.parent, ctx.host);\n\t\t\tif (records.length) {\n\t\t\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\t\t\tconst value = values[i];\n\t\t\t\t\tif (isEventTarget(value)) {\n\t\t\t\t\t\tfor (let j = 0; j < records.length; j++) {\n\t\t\t\t\t\t\tconst record = records[j];\n\t\t\t\t\t\t\tvalue.addEventListener(\n\t\t\t\t\t\t\t\trecord.type,\n\t\t\t\t\t\t\t\trecord.callback,\n\t\t\t\t\t\t\t\trecord.options,\n\t\t\t\t\t\t\t);\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\t// rearranging the nearest ancestor host element\n\t\t\tconst host = ctx.host;\n\t\t\tconst oldHostValues = wrap(host.cachedChildValues);\n\t\t\tinvalidate(ctx, host);\n\t\t\tconst hostValues = getChildValues(host);\n\t\t\tctx.renderer.arrange(\n\t\t\t\thost.el.tag as string | symbol,\n\t\t\t\thost.value as TNode,\n\t\t\t\thost.el.props,\n\t\t\t\thostValues,\n\t\t\t\t// props and oldProps are the same because the host isn’t updated.\n\t\t\t\thost.el.props,\n\t\t\t\toldHostValues,\n\t\t\t);\n\t\t}\n\n\t\tflush(ctx.renderer, ctx.root, ctx);\n\t}\n\n\tconst callbacks = scheduleMap.get(ctx);\n\tif (callbacks) {\n\t\tscheduleMap.delete(ctx);\n\t\tctx.f |= IsScheduling;\n\t\tconst value1 = ctx.renderer.read(value);\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(value1);\n\t\t}\n\n\t\tctx.f &= ~IsScheduling;\n\t\t// Handles an edge case where refresh() is called during a schedule().\n\t\tif (ctx.f & IsSchedulingRefresh) {\n\t\t\tctx.f &= ~IsSchedulingRefresh;\n\t\t\tvalue = getValue(ctx.ret);\n\t\t}\n\t}\n\n\tctx.f &= ~IsUpdating;\n\treturn value;\n}\n\nfunction invalidate(ctx: ContextImpl, host: Retainer<unknown>): void {\n\tfor (\n\t\tlet parent = ctx.parent;\n\t\tparent !== undefined && parent.host === host;\n\t\tparent = parent.parent\n\t) {\n\t\tparent.ret.cachedChildValues = undefined;\n\t}\n\n\thost.cachedChildValues = undefined;\n}\n\nfunction arrayEqual<TValue>(arr1: Array<TValue>, arr2: Array<TValue>): boolean {\n\tif (arr1.length !== arr2.length) {\n\t\treturn false;\n\t}\n\n\tfor (let i = 0; i < arr1.length; i++) {\n\t\tconst value1 = arr1[i];\n\t\tconst value2 = arr2[i];\n\t\tif (value1 !== value2) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/** Enqueues and executes the component associated with the context. */\nfunction enqueueComponentRun<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\thydrationData?: HydrationData<TNode> | undefined,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (ctx.f & IsAsyncGen && !(ctx.f & IsInForOfLoop)) {\n\t\tif (hydrationData !== undefined) {\n\t\t\tthrow new Error(\"Hydration error\");\n\t\t}\n\n\t\t// This branch will run for non-initial renders of async generator\n\t\t// components when they are not in for...of loops. When in a for...of loop,\n\t\t// async generator components will behave normally.\n\t\t//\n\t\t// Async gen componennts can be in one of three states:\n\t\t//\n\t\t// 1. propsAvailable flag is true: \"available\"\n\t\t//\n\t\t//   The component is suspended somewhere in the loop. When the component\n\t\t//   reaches the bottom of the loop, it will run again with the next props.\n\t\t//\n\t\t// 2. onAvailable callback is defined: \"suspended\"\n\t\t//\n\t\t//   The component has suspended at the bottom of the loop and is waiting\n\t\t//   for new props.\n\t\t//\n\t\t// 3. neither 1 or 2: \"Running\"\n\t\t//\n\t\t//   The component is suspended somewhere in the loop. When the component\n\t\t//   reaches the bottom of the loop, it will suspend.\n\t\t//\n\t\t// Components will never be both available and suspended at\n\t\t// the same time.\n\t\t//\n\t\t// If the component is at the loop bottom, this means that the next value\n\t\t// produced by the component will have the most up to date props, so we can\n\t\t// simply return the current inflight value. Otherwise, we have to wait for\n\t\t// the bottom of the loop to be reached before returning the inflight\n\t\t// value.\n\t\tconst isAtLoopbottom = ctx.f & IsInForAwaitOfLoop && !ctx.onProps;\n\t\tresumePropsAsyncIterator(ctx);\n\t\tif (isAtLoopbottom) {\n\t\t\tif (ctx.inflightBlock == null) {\n\t\t\t\tctx.inflightBlock = new Promise(\n\t\t\t\t\t(resolve) => (ctx.onPropsRequested = resolve),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn ctx.inflightBlock.then(() => {\n\t\t\t\tctx.inflightBlock = undefined;\n\t\t\t\treturn ctx.inflightValue;\n\t\t\t});\n\t\t}\n\n\t\treturn ctx.inflightValue;\n\t} else if (!ctx.inflightBlock) {\n\t\ttry {\n\t\t\tconst [block, value] = runComponent<TNode, TResult>(ctx, hydrationData);\n\t\t\tif (block) {\n\t\t\t\tctx.inflightBlock = block\n\t\t\t\t\t// TODO: there is some fuckery going on here related to async\n\t\t\t\t\t// generator components resuming when they’re meant to be returned.\n\t\t\t\t\t.then((v) => v)\n\t\t\t\t\t.finally(() => advanceComponent(ctx));\n\t\t\t\t// stepComponent will only return a block if the value is asynchronous\n\t\t\t\tctx.inflightValue = value as Promise<ElementValue<TNode>>;\n\t\t\t}\n\n\t\t\treturn value;\n\t\t} catch (err) {\n\t\t\tif (!(ctx.f & IsUpdating)) {\n\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t\t}\n\n\t\t\tthrow err;\n\t\t}\n\t} else if (!ctx.enqueuedBlock) {\n\t\tif (hydrationData !== undefined) {\n\t\t\tthrow new Error(\"Hydration error\");\n\t\t}\n\t\t// We need to assign enqueuedBlock and enqueuedValue synchronously, hence\n\t\t// the Promise constructor call here.\n\t\tlet resolveEnqueuedBlock: Function;\n\t\tctx.enqueuedBlock = new Promise(\n\t\t\t(resolve) => (resolveEnqueuedBlock = resolve),\n\t\t);\n\n\t\tctx.enqueuedValue = ctx.inflightBlock.then(() => {\n\t\t\ttry {\n\t\t\t\tconst [block, value] = runComponent<TNode, TResult>(ctx);\n\t\t\t\tif (block) {\n\t\t\t\t\tresolveEnqueuedBlock(block.finally(() => advanceComponent(ctx)));\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t} catch (err) {\n\t\t\t\tif (!(ctx.f & IsUpdating)) {\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t\t\t}\n\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}\n\n\treturn ctx.enqueuedValue;\n}\n\n/** Called when the inflight block promise settles. */\nfunction advanceComponent(ctx: ContextImpl): void {\n\tif (ctx.f & IsAsyncGen && !(ctx.f & IsInForOfLoop)) {\n\t\treturn;\n\t}\n\n\tctx.inflightBlock = ctx.enqueuedBlock;\n\tctx.inflightValue = ctx.enqueuedValue;\n\tctx.enqueuedBlock = undefined;\n\tctx.enqueuedValue = undefined;\n}\n\n/**\n * This function is responsible for executing the component and handling all\n * the different component types. We cannot identify whether a component is a\n * generator or async without calling it and inspecting the return value.\n *\n * @returns {[block, value]} A tuple where\n * block - A possible promise which represents the duration during which the\n * component is blocked from updating.\n * value - A possible promise resolving to the rendered value of children.\n *\n * Each component type will block according to the type of the component.\n * - Sync function components never block and will transparently pass updates\n * to children.\n * - Async function components and async generator components block while\n * executing itself, but will not block for async children.\n * - Sync generator components block while any children are executing, because\n * they are expected to only resume when they’ve actually rendered.\n */\nfunction runComponent<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\thydrationData?: HydrationData<TNode> | undefined,\n): [\n\tPromise<unknown> | undefined,\n\tPromise<ElementValue<TNode>> | ElementValue<TNode>,\n] {\n\tconst ret = ctx.ret;\n\tconst initial = !ctx.iterator;\n\tif (initial) {\n\t\tresumePropsAsyncIterator(ctx);\n\t\tctx.f |= IsSyncExecuting;\n\t\tclearEventListeners(ctx);\n\t\tlet result: ReturnType<Component>;\n\t\ttry {\n\t\t\tresult = (ret.el.tag as Component).call(\n\t\t\t\tctx.owner,\n\t\t\t\tret.el.props,\n\t\t\t\tctx.owner,\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tctx.f |= IsErrored;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\n\t\tif (isIteratorLike(result)) {\n\t\t\tctx.iterator = result;\n\t\t} else if (isPromiseLike(result)) {\n\t\t\t// async function component\n\t\t\tconst result1 =\n\t\t\t\tresult instanceof Promise ? result : Promise.resolve(result);\n\t\t\tconst value = result1.then(\n\t\t\t\t(result) =>\n\t\t\t\t\tupdateComponentChildren<TNode, TResult>(ctx, result, hydrationData),\n\t\t\t\t(err) => {\n\t\t\t\t\tctx.f |= IsErrored;\n\t\t\t\t\tthrow err;\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn [result1.catch(NOOP), value];\n\t\t} else {\n\t\t\t// sync function component\n\t\t\treturn [\n\t\t\t\tundefined,\n\t\t\t\tupdateComponentChildren<TNode, TResult>(ctx, result, hydrationData),\n\t\t\t];\n\t\t}\n\t} else if (hydrationData !== undefined) {\n\t\t// hydration data should only be passed on the initial render\n\t\tthrow new Error(\"Hydration error\");\n\t}\n\n\tlet iteration!: Promise<ChildrenIteratorResult> | ChildrenIteratorResult;\n\tif (initial) {\n\t\ttry {\n\t\t\tctx.f |= IsSyncExecuting;\n\t\t\titeration = ctx.iterator!.next();\n\t\t} catch (err) {\n\t\t\tctx.f |= IsErrored;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\n\t\tif (isPromiseLike(iteration)) {\n\t\t\tctx.f |= IsAsyncGen;\n\t\t} else {\n\t\t\tctx.f |= IsSyncGen;\n\t\t}\n\t}\n\n\tif (ctx.f & IsSyncGen) {\n\t\t// sync generator component\n\t\tif (!initial) {\n\t\t\ttry {\n\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\titeration = ctx.iterator!.next(ctx.renderer.read(getValue(ret)));\n\t\t\t} catch (err) {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t} finally {\n\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t}\n\t\t}\n\n\t\tif (isPromiseLike(iteration)) {\n\t\t\tthrow new Error(\"Mixed generator component\");\n\t\t}\n\n\t\tif (\n\t\t\tctx.f & IsInForOfLoop &&\n\t\t\t!(ctx.f & NeedsToYield) &&\n\t\t\t!(ctx.f & IsUnmounted)\n\t\t) {\n\t\t\tconsole.error(\"Component yielded more than once in for...of loop\");\n\t\t}\n\n\t\tctx.f &= ~NeedsToYield;\n\t\tif (iteration.done) {\n\t\t\tctx.f &= ~IsSyncGen;\n\t\t\tctx.iterator = undefined;\n\t\t}\n\n\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\ttry {\n\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\tctx,\n\t\t\t\t// Children can be void so we eliminate that here\n\t\t\t\titeration.value as Children,\n\t\t\t\thydrationData,\n\t\t\t);\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tvalue = value.catch((err) => handleChildError(ctx, err));\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tvalue = handleChildError(ctx, err);\n\t\t}\n\n\t\tconst block = isPromiseLike(value) ? value.catch(NOOP) : undefined;\n\t\treturn [block, value];\n\t} else {\n\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t// Async generator component using for...of loops behave similar to sync\n\t\t\t// generator components. This allows for easier refactoring of sync to\n\t\t\t// async generator components.\n\t\t\tif (!initial) {\n\t\t\t\ttry {\n\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\titeration = ctx.iterator!.next(ctx.renderer.read(getValue(ret)));\n\t\t\t\t} catch (err) {\n\t\t\t\t\tctx.f |= IsErrored;\n\t\t\t\t\tthrow err;\n\t\t\t\t} finally {\n\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!isPromiseLike(iteration)) {\n\t\t\t\tthrow new Error(\"Mixed generator component\");\n\t\t\t}\n\n\t\t\tconst block = iteration.catch(NOOP);\n\t\t\tconst value = iteration.then(\n\t\t\t\t(iteration) => {\n\t\t\t\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\t\t\t\tif (!(ctx.f & IsInForOfLoop)) {\n\t\t\t\t\t\trunAsyncGenComponent(\n\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\tPromise.resolve(iteration),\n\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!(ctx.f & NeedsToYield) && !(ctx.f & IsUnmounted)) {\n\t\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t\t\"Component yielded more than once in for...of loop\",\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\tctx.f &= ~NeedsToYield;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\t// Children can be void so we eliminate that here\n\t\t\t\t\t\t\titeration.value as Children,\n\t\t\t\t\t\t\thydrationData,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (isPromiseLike(value)) {\n\t\t\t\t\t\t\tvalue = value.catch((err) => handleChildError(ctx, err));\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tvalue = handleChildError(ctx, err);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t},\n\t\t\t\t(err) => {\n\t\t\t\t\tctx.f |= IsErrored;\n\t\t\t\t\tthrow err;\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn [block, value];\n\t\t} else {\n\t\t\trunAsyncGenComponent(\n\t\t\t\tctx,\n\t\t\t\titeration as Promise<ChildrenIteratorResult>,\n\t\t\t\thydrationData,\n\t\t\t\tinitial,\n\t\t\t);\n\t\t\treturn [ctx.inflightBlock, ctx.inflightValue];\n\t\t}\n\t}\n}\n\nasync function runAsyncGenComponent<TNode, TResult>(\n\tctx: ContextImpl<TNode, unknown, TNode, TResult>,\n\titerationP: Promise<ChildrenIteratorResult>,\n\thydrationData: HydrationData<TNode> | undefined,\n\tinitial: boolean = false,\n): Promise<void> {\n\tlet done = false;\n\ttry {\n\t\twhile (!done) {\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// inflightValue must be set synchronously.\n\t\t\tlet onValue!: Function;\n\t\t\tctx.inflightValue = new Promise((resolve) => (onValue = resolve));\n\t\t\tif (ctx.f & IsUpdating) {\n\t\t\t\t// We should not swallow unhandled promise rejections if the component is\n\t\t\t\t// updating independently.\n\t\t\t\t// TODO: Does this handle this.refresh() calls?\n\t\t\t\tctx.inflightValue.catch(NOOP);\n\t\t\t}\n\n\t\t\tlet iteration: ChildrenIteratorResult;\n\t\t\ttry {\n\t\t\t\titeration = await iterationP;\n\t\t\t} catch (err) {\n\t\t\t\tdone = true;\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tonValue(Promise.reject(err));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (!(ctx.f & IsInForAwaitOfLoop)) {\n\t\t\t\tctx.f &= ~PropsAvailable;\n\t\t\t}\n\n\t\t\tdone = !!iteration.done;\n\t\t\tlet value: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\t\t\ttry {\n\t\t\t\tif (\n\t\t\t\t\t!(ctx.f & NeedsToYield) &&\n\t\t\t\t\tctx.f & PropsAvailable &&\n\t\t\t\t\tctx.f & IsInForAwaitOfLoop &&\n\t\t\t\t\t!initial &&\n\t\t\t\t\t!done\n\t\t\t\t) {\n\t\t\t\t\t// We skip stale iterations in for await...of loops.\n\t\t\t\t\tvalue = ctx.ret.inflightValue || getValue(ctx.ret);\n\t\t\t\t} else {\n\t\t\t\t\tvalue = updateComponentChildren<TNode, TResult>(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\titeration.value!,\n\t\t\t\t\t\thydrationData,\n\t\t\t\t\t);\n\t\t\t\t\thydrationData = undefined;\n\t\t\t\t\tif (isPromiseLike(value)) {\n\t\t\t\t\t\tvalue = value.catch((err: any) => handleChildError(ctx, err));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tctx.f &= ~NeedsToYield;\n\t\t\t} catch (err) {\n\t\t\t\t// Do we need to catch potential errors here in the case of unhandled\n\t\t\t\t// promise rejections?\n\t\t\t\tvalue = handleChildError(ctx, err);\n\t\t\t} finally {\n\t\t\t\tonValue(value);\n\t\t\t}\n\n\t\t\tlet oldResult: Promise<TResult> | TResult;\n\t\t\tif (ctx.ret.inflightValue) {\n\t\t\t\t// The value passed back into the generator as the argument to the next\n\t\t\t\t// method is a promise if an async generator component has async\n\t\t\t\t// children. Sync generator components only resume when their children\n\t\t\t\t// have fulfilled so the element’s inflight child values will never be\n\t\t\t\t// defined.\n\t\t\t\toldResult = ctx.ret.inflightValue.then((value) =>\n\t\t\t\t\tctx.renderer.read(value),\n\t\t\t\t);\n\n\t\t\t\toldResult.catch((err) => {\n\t\t\t\t\tif (ctx.f & IsUpdating) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError(ctx.parent, err);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\toldResult = ctx.renderer.read(getValue(ctx.ret));\n\t\t\t}\n\n\t\t\tif (ctx.f & IsUnmounted) {\n\t\t\t\tif (ctx.f & IsInForAwaitOfLoop) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\t\titerationP = ctx.iterator!.next(\n\t\t\t\t\t\t\toldResult,\n\t\t\t\t\t\t) as Promise<ChildrenIteratorResult>;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (!done && !(ctx.f & IsInForOfLoop)) {\n\t\t\t\ttry {\n\t\t\t\t\tctx.f |= IsSyncExecuting;\n\t\t\t\t\titerationP = ctx.iterator!.next(\n\t\t\t\t\t\toldResult,\n\t\t\t\t\t) as Promise<ChildrenIteratorResult>;\n\t\t\t\t} finally {\n\t\t\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinitial = false;\n\t\t}\n\t} finally {\n\t\tif (done) {\n\t\t\tctx.f &= ~IsAsyncGen;\n\t\t\tctx.iterator = undefined;\n\t\t}\n\t}\n}\n\n/**\n * Called to resume the props async iterator for async generator components.\n */\nfunction resumePropsAsyncIterator(ctx: ContextImpl): void {\n\tif (ctx.onProps) {\n\t\tctx.onProps(ctx.ret.el.props);\n\t\tctx.onProps = undefined;\n\t\tctx.f &= ~PropsAvailable;\n\t} else {\n\t\tctx.f |= PropsAvailable;\n\t}\n}\n\n// TODO: async unmounting\nfunction unmountComponent(ctx: ContextImpl): void {\n\tif (ctx.f & IsUnmounted) {\n\t\treturn;\n\t}\n\n\tclearEventListeners(ctx);\n\n\tconst callbacks = cleanupMap.get(ctx);\n\tif (callbacks) {\n\t\tcleanupMap.delete(ctx);\n\t\tconst value = ctx.renderer.read(getValue(ctx.ret));\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tctx.f |= IsUnmounted;\n\tif (ctx.iterator) {\n\t\tif (ctx.f & IsSyncGen) {\n\t\t\tlet value: unknown;\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tvalue = enqueueComponentRun(ctx);\n\t\t\t}\n\n\t\t\tif (isPromiseLike(value)) {\n\t\t\t\tvalue.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t} else {\n\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (ctx.f & IsAsyncGen) {\n\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\tconst value = enqueueComponentRun(ctx) as Promise<unknown>;\n\t\t\t\tvalue.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tif (ctx.f & IsInForOfLoop) {\n\t\t\t\t\t\t\tunmountComponent(ctx);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturnComponent(ctx);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t(err) => {\n\t\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// The logic for unmounting async generator components is in the\n\t\t\t\t// runAsyncGenComponent function.\n\t\t\t\tresumePropsAsyncIterator(ctx);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction returnComponent(ctx: ContextImpl): void {\n\tresumePropsAsyncIterator(ctx);\n\tif (ctx.iterator && typeof ctx.iterator!.return === \"function\") {\n\t\ttry {\n\t\t\tctx.f |= IsSyncExecuting;\n\t\t\tconst iteration = ctx.iterator!.return();\n\t\t\tif (isPromiseLike(iteration)) {\n\t\t\t\titeration.catch((err) => {\n\t\t\t\t\tif (!ctx.parent) {\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn propagateError<unknown>(ctx.parent, err);\n\t\t\t\t});\n\t\t\t}\n\t\t} finally {\n\t\t\tctx.f &= ~IsSyncExecuting;\n\t\t}\n\t}\n}\n\n/*** EVENT TARGET UTILITIES ***/\n// EVENT PHASE CONSTANTS\n// https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase\nconst NONE = 0;\nconst CAPTURING_PHASE = 1;\nconst AT_TARGET = 2;\nconst BUBBLING_PHASE = 3;\n\nconst listenersMap = new WeakMap<ContextImpl, Array<EventListenerRecord>>();\n/**\n * A map of event type strings to Event subclasses. Can be extended via\n * TypeScript module augmentation to have strongly typed event listeners.\n */\nexport interface EventMap extends Crank.EventMap {\n\t[type: string]: Event;\n}\n\ntype MappedEventListener<T extends string> = (ev: EventMap[T]) => unknown;\n\ntype MappedEventListenerOrEventListenerObject<T extends string> =\n\t| MappedEventListener<T>\n\t| {handleEvent: MappedEventListener<T>};\n\nfunction isListenerOrListenerObject(\n\tvalue: unknown,\n): value is MappedEventListenerOrEventListenerObject<string> {\n\treturn (\n\t\ttypeof value === \"function\" ||\n\t\t(value !== null &&\n\t\t\ttypeof value === \"object\" &&\n\t\t\ttypeof (value as any).handleEvent === \"function\")\n\t);\n}\n\ninterface EventListenerRecord {\n\ttype: string;\n\t// listener is the original value passed to addEventListener, callback is the\n\t// transformed function\n\tlistener: MappedEventListenerOrEventListenerObject<any>;\n\tcallback: MappedEventListener<any>;\n\toptions: AddEventListenerOptions;\n}\n\nfunction normalizeListenerOptions(\n\toptions: AddEventListenerOptions | boolean | null | undefined,\n): AddEventListenerOptions {\n\tif (typeof options === \"boolean\") {\n\t\treturn {capture: options};\n\t} else if (options == null) {\n\t\treturn {};\n\t}\n\n\treturn options;\n}\n\nfunction isEventTarget(value: any): value is EventTarget {\n\treturn (\n\t\tvalue != null &&\n\t\ttypeof value.addEventListener === \"function\" &&\n\t\ttypeof value.removeEventListener === \"function\" &&\n\t\ttypeof value.dispatchEvent === \"function\"\n\t);\n}\n\nfunction setEventProperty<T extends keyof Event>(\n\tev: Event,\n\tkey: T,\n\tvalue: Event[T],\n): void {\n\tObject.defineProperty(ev, key, {value, writable: false, configurable: true});\n}\n\n// TODO: Maybe we can pass in the current context directly, rather than\n// starting from the parent?\n/**\n * A function to reconstruct an array of every listener given a context and a\n * host element.\n *\n * This function exploits the fact that contexts retain their nearest ancestor\n * host element. We can determine all the contexts which are directly listening\n * to an element by traversing up the context tree and checking that the host\n * element passed in matches the parent context’s host element.\n */\nfunction getListenerRecords(\n\tctx: ContextImpl | undefined,\n\tret: Retainer<unknown>,\n): Array<EventListenerRecord> {\n\tlet listeners: Array<EventListenerRecord> = [];\n\twhile (ctx !== undefined && ctx.host === ret) {\n\t\tconst listeners1 = listenersMap.get(ctx);\n\t\tif (listeners1) {\n\t\t\tlisteners = listeners.concat(listeners1);\n\t\t}\n\n\t\tctx = ctx.parent;\n\t}\n\n\treturn listeners;\n}\n\nfunction clearEventListeners(ctx: ContextImpl): void {\n\tconst listeners = listenersMap.get(ctx);\n\tif (listeners && listeners.length) {\n\t\tfor (const value of getChildValues(ctx.ret)) {\n\t\t\tif (isEventTarget(value)) {\n\t\t\t\tfor (const record of listeners) {\n\t\t\t\t\tvalue.removeEventListener(\n\t\t\t\t\t\trecord.type,\n\t\t\t\t\t\trecord.callback,\n\t\t\t\t\t\trecord.options,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlisteners.length = 0;\n\t}\n}\n\n/*** ERROR HANDLING UTILITIES ***/\nfunction handleChildError<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\terr: unknown,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tif (!ctx.iterator || typeof ctx.iterator.throw !== \"function\") {\n\t\tthrow err;\n\t}\n\n\tresumePropsAsyncIterator(ctx);\n\tlet iteration: ChildrenIteratorResult | Promise<ChildrenIteratorResult>;\n\ttry {\n\t\tctx.f |= IsSyncExecuting;\n\t\titeration = ctx.iterator.throw(err);\n\t} catch (err) {\n\t\tctx.f |= IsErrored;\n\t\tthrow err;\n\t} finally {\n\t\tctx.f &= ~IsSyncExecuting;\n\t}\n\n\tif (isPromiseLike(iteration)) {\n\t\treturn iteration.then(\n\t\t\t(iteration) => {\n\t\t\t\tif (iteration.done) {\n\t\t\t\t\tctx.f &= ~IsAsyncGen;\n\t\t\t\t\tctx.iterator = undefined;\n\t\t\t\t}\n\n\t\t\t\treturn updateComponentChildren(ctx, iteration.value as Children);\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tctx.f |= IsErrored;\n\t\t\t\tthrow err;\n\t\t\t},\n\t\t);\n\t}\n\n\tif (iteration.done) {\n\t\tctx.f &= ~IsSyncGen;\n\t\tctx.f &= ~IsAsyncGen;\n\t\tctx.iterator = undefined;\n\t}\n\n\treturn updateComponentChildren(ctx, iteration.value as Children);\n}\n\nfunction propagateError<TNode>(\n\tctx: ContextImpl<TNode, unknown, TNode>,\n\terr: unknown,\n): Promise<ElementValue<TNode>> | ElementValue<TNode> {\n\tlet result: Promise<ElementValue<TNode>> | ElementValue<TNode>;\n\ttry {\n\t\tresult = handleChildError(ctx, err);\n\t} catch (err) {\n\t\tif (!ctx.parent) {\n\t\t\tthrow err;\n\t\t}\n\n\t\treturn propagateError<TNode>(ctx.parent, err);\n\t}\n\n\tif (isPromiseLike(result)) {\n\t\treturn result.catch((err) => {\n\t\t\tif (!ctx.parent) {\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\treturn propagateError<TNode>(ctx.parent, err);\n\t\t});\n\t}\n\n\treturn result;\n}\n\n// TODO: uncomment and use in the Element interface below\n// type CrankElement = Element;\ndeclare global {\n\tnamespace Crank {\n\t\texport interface EventMap {}\n\n\t\texport interface ProvisionMap {}\n\n\t\texport interface Context {}\n\t}\n\n\tnamespace JSX {\n\t\t// TODO: JSX Element type (the result of JSX expressions) don’t work\n\t\t// because TypeScript demands that all Components return JSX elements for\n\t\t// some reason.\n\t\t// interface Element extends CrankElement {}\n\n\t\texport interface IntrinsicElements {\n\t\t\t[tag: string]: any;\n\t\t}\n\n\t\texport interface IntrinsicAttributes {\n\t\t\tchildren?: unknown;\n\t\t\tkey?: unknown;\n\t\t\tref?: unknown;\n\t\t\t[\"static\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t[\"crank-key\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t[\"crank-ref\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t[\"crank-static\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t[\"c-key\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t[\"c-ref\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t[\"c-static\"]?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t$key?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t$ref?: unknown;\n\t\t\t/** @deprecated */\n\t\t\t$static?: unknown;\n\t\t}\n\n\t\texport interface ElementChildrenAttribute {\n\t\t\tchildren: {};\n\t\t}\n\t}\n}\n\n// Some JSX transpilation tools expect these functions to be defined on the\n// default export. Prefer named exports when importing directly.\nexport default {createElement, Fragment};\n"],"names":[],"mappings":";;;;AAAA,MAAM,IAAI,GAAG,MAAK,GAAG,CAAC;AACtB,M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