@aginies/embed 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aginies.js +126 -8
- package/dist/aginies.js.map +1 -1
- package/package.json +1 -1
package/dist/aginies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/constants.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/util.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/options.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/create-element.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/component.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/props.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/create-context.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/children.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/index.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/render.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/clone-element.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/catch-error.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/hooks/src/index.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/util.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/hooks.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/PureComponent.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/memo.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/forwardRef.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/Children.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/suspense.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/suspense-list.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/constants.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/portals.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/render.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/index.js","../../react/src/client.ts","../../react/src/approval/approval-client.ts","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/jsx-runtime/src/utils.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/constants.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/jsx-runtime/src/index.js","../../react/src/core/index.tsx","../../react/src/i18n.ts","../../react/src/provider.tsx","../../react/src/approval/approval-panel.tsx","../../react/src/chat/markdown.tsx","../../react/src/chat/structured-ui.tsx","../../react/src/chat/chat-widget.tsx","../../react/dist/styles.css","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/client.mjs"],"sourcesContent":["import { createElement } from 'react'\nimport {\n type AginiesClient,\n type AginiesConfig,\n AginiesProvider,\n ApprovalPanel,\n type ApprovalPanelProps,\n ChatWidget,\n type ChatWidgetProps,\n init as initClient,\n} from '@aginies/webuikit'\nimport styles from '@aginies/webuikit/styles.css'\nimport { createRoot, type Root } from 'react-dom/client'\n\nexport const version = '0.1.0'\n\nconst STYLE_ID = 'aginies-embed-styles'\nlet client: AginiesClient | null = null\n\nfunction ensureStyles(): void {\n if (typeof document === 'undefined' || document.getElementById(STYLE_ID)) return\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = styles\n document.head.appendChild(style)\n}\n\n/** Creates the shared client and starts the activation handshake. Call once per page. */\nexport function init(config: AginiesConfig): AginiesClient {\n ensureStyles()\n client = initClient(config)\n return client\n}\n\nexport interface ChatOptions extends ChatWidgetProps {\n /** Where to mount for `inline` / `full`: a selector or element. Bubble mode makes its own root. */\n container?: string | HTMLElement\n}\n\nexport interface ApprovalOptions extends ApprovalPanelProps {\n /** Where to mount: a selector or element. Defaults to a new element at the end of `<body>`. */\n container?: string | HTMLElement\n}\n\nexport interface MountHandle {\n unmount: () => void\n element: HTMLElement\n}\n\n/** Mounts a chat widget. Requires `init()` first. */\nexport function chat(options: ChatOptions): MountHandle {\n if (!client) {\n throw new Error('[aginies] call Aginies.init({ baseUrl, token }) before Aginies.chat()')\n }\n const { container, mode = 'bubble', ...props } = options\n const element = resolveContainer(container, mode)\n const root: Root = createRoot(element)\n root.render(\n createElement(AginiesProvider, {\n client,\n // biome-ignore lint/correctness/noChildrenProp: createElement outside JSX\n children: createElement(ChatWidget, { ...props, mode }),\n })\n )\n return {\n element,\n unmount: () => {\n root.unmount()\n if (element.dataset.aginiesOwned === 'true') element.remove()\n },\n }\n}\n\n/** Mounts an approval panel for a paused run. Requires `init()` first. */\nexport function approval(options: ApprovalOptions): MountHandle {\n if (!client) {\n throw new Error('[aginies] call Aginies.init({ baseUrl, token }) before Aginies.approval()')\n }\n const { container, ...props } = options\n const element = resolveContainer(container, 'approval')\n const root: Root = createRoot(element)\n root.render(\n createElement(AginiesProvider, {\n client,\n // biome-ignore lint/correctness/noChildrenProp: createElement outside JSX\n children: createElement(ApprovalPanel, props),\n })\n )\n return {\n element,\n unmount: () => {\n root.unmount()\n if (element.dataset.aginiesOwned === 'true') element.remove()\n },\n }\n}\n\nfunction resolveContainer(container: string | HTMLElement | undefined, mode: string): HTMLElement {\n if (container) {\n const el =\n typeof container === 'string' ? document.querySelector<HTMLElement>(container) : container\n if (!el) throw new Error(`[aginies] container not found: ${String(container)}`)\n return el\n }\n const el = document.createElement('div')\n el.dataset.aginiesOwned = 'true'\n el.dataset.aginiesMode = mode\n document.body.appendChild(el)\n return el\n}\n\n/**\n * Reads `data-*` attributes off the script tag and mounts without any code:\n * `data-base-url`, `data-token`, `data-chat`, `data-mode`, `data-position`, `data-locale`,\n * `data-theme`, `data-label`; or `data-approval=\"workflowId/executionId[/contextId]\"` for an\n * approval panel.\n */\nexport function autoload(script: HTMLScriptElement | null = currentScript()): MountHandle | null {\n if (!script) return null\n const d = script.dataset\n if (!d.baseUrl || !d.token) return null\n init({\n baseUrl: d.baseUrl,\n token: d.token,\n locale: d.locale === 'tr' || d.locale === 'en' ? d.locale : undefined,\n })\n if (d.approval) {\n const [workflowId, executionId, contextId] = d.approval.split('/')\n if (!workflowId || !executionId) return null\n const mountApproval = () =>\n approval({ workflowId, executionId, contextId, container: d.container })\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => mountApproval(), { once: true })\n return null\n }\n return mountApproval()\n }\n if (!d.chat) return null\n const mount = () =>\n chat({\n identifier: d.chat as string,\n mode: (d.mode as ChatWidgetProps['mode']) ?? 'bubble',\n position: (d.position as ChatWidgetProps['position']) ?? 'right',\n theme: (d.theme as ChatWidgetProps['theme']) ?? 'auto',\n launcherLabel: d.label,\n container: d.container,\n })\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => mount(), { once: true })\n return null\n }\n return mount()\n}\n\nfunction currentScript(): HTMLScriptElement | null {\n if (typeof document === 'undefined') return null\n return (document.currentScript as HTMLScriptElement | null) ?? null\n}\n\nif (typeof window !== 'undefined') {\n autoload()\n}\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\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 = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-expect-error We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {import('./index').ContainerNode} node The node to remove\n */\nexport function removeNode(node) {\n\tif (node && node.parentNode) node.parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\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 { 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\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != NULL) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === UNDEFINED) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, NULL);\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 == NULL ? ++vnodeId : original,\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 == NULL && options.vnode != NULL) 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 { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\nimport { MODE_HYDRATE, NULL } from './constants';\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}\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;\n\tif (this._nextState != NULL && this._nextState != this.state) {\n\t\ts = this._nextState;\n\t} else {\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}\n\n\t// Skip update if updater function returned null\n\tif (update == NULL) return;\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._force = true;\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 != NULL && sibling._dom != NULL) {\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)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : 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\tif (component._parentDom && component._dirty) {\n\t\tlet oldVNode = component._vnode,\n\t\t\toldDom = oldVNode._dom,\n\t\t\tcommitQueue = [],\n\t\t\trefQueue = [],\n\t\t\tnewVNode = assign({}, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tcomponent._parentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tcomponent._parentDom.namespaceURI,\n\t\t\toldVNode._flags & MODE_HYDRATE ? [oldDom] : NULL,\n\t\t\tcommitQueue,\n\t\t\toldDom == NULL ? getDomSibling(oldVNode) : oldDom,\n\t\t\t!!(oldVNode._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._dom = oldVNode._parent = 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\tif ((vnode = vnode._parent) != NULL && vnode._component != NULL) {\n\t\tvnode._dom = vnode._component.base = NULL;\n\t\tvnode._children.some(child => {\n\t\t\tif (child != NULL && child._dom != NULL) {\n\t\t\t\treturn (vnode._dom = vnode._component.base = child._dom);\n\t\t\t}\n\t\t});\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet 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\nconst defer =\n\ttypeof Promise == 'function'\n\t\t? Promise.prototype.then.bind(Promise.resolve())\n\t\t: setTimeout;\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._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce != options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || defer)(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\trenderComponent(c);\n\t\t}\n\t} finally {\n\t\trerenderQueue.length = process._rerenderCount = 0;\n\t}\n}\n\nprocess._rerenderCount = 0;\n","import { IS_NON_DIMENSIONAL, NULL, SVG_NAMESPACE } from '../constants';\nimport options from '../options';\n\n// Per-instance unique key for event clock stamps. Each Preact copy on the page\n// gets its own random suffix so that `_dispatched` / `_attached` properties on\n// shared event objects and handler functions cannot collide across instances.\n// ~1 in 60M collision odds - if you have that many praect versions on the page,\n// you deserve some weird bugs.\n// In 11 we can replace this with a\n// Symbol\nlet _id = Math.random().toString(8),\n\tEVENT_DISPATCHED = '__d' + _id,\n\tEVENT_ATTACHED = '__a' + _id;\n\nfunction setStyle(style, key, value) {\n\tif (key[0] == '-') {\n\t\tstyle.setProperty(key, value == NULL ? '' : value);\n\t} else if (value == NULL) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\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\t\tconst lowerCaseName = name.toLowerCase();\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (lowerCaseName in dom || name == 'onFocusOut' || name == 'onFocusIn')\n\t\t\tname = lowerCaseName.slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._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 { NULL } 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.componentWillUnmount = () => {\n\t\t\t\tsubs = NULL;\n\t\t\t};\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._force = true;\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\tif (subs) {\n\t\t\t\t\t\tsubs.delete(c);\n\t\t\t\t\t}\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\t// we could also get rid of _contextRef entirely\n\tContext.Provider =\n\t\tContext._contextRef =\n\t\tContext.Consumer.contextType =\n\t\t\tContext;\n\n\treturn Context;\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\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 */\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!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\t/** @type {VNode[]} */\n\tlet oldChildren = (oldParentVNode && 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\toldVNode =\n\t\t\t(childVNode._index != -1 && 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\tif (childVNode.ref && oldVNode.ref != childVNode.ref) {\n\t\t\tif (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\tif (firstChildDom == NULL && newDom != NULL) {\n\t\t\tfirstChildDom = newDom;\n\t\t}\n\n\t\tif (childVNode._flags & INSERT_VNODE) {\n\t\t\toldDom = insert(childVNode, oldDom, parentDom);\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\tnewParentVNode._children = new 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\tnewParentVNode._children[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\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tNULL,\n\t\t\t\tchildVNode,\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (childVNode.constructor === UNDEFINED && childVNode._depth > 0) {\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 = newParentVNode._children[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 ? childVNode.ref : NULL,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tnewParentVNode._children[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\tif (matchingIndex != -1) {\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\tconst isMounting = oldVNode == NULL || oldVNode._original == NULL;\n\n\t\tif (isMounting) {\n\t\t\tif (matchingIndex == -1) {\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 if (matchingIndex != skewedIndex) {\n\t\t\t// When we move elements around i.e. [0, 1, 2] --> [1, 0, 2]\n\t\t\t// --> we diff 1, we find it at position 1 while our skewed index is 0 and our skew is 0\n\t\t\t// we set the skew to 1 as we found an offset.\n\t\t\t// --> we diff 0, we find it at position 0 while our skewed index is at 2 and our skew is 1\n\t\t\t// this makes us increase the skew again.\n\t\t\t// --> we diff 2, we find it at position 2 while our skewed index is at 4 and our skew is 2\n\t\t\t//\n\t\t\t// this becomes an optimization question where currently we see a 1 element offset as an insertion\n\t\t\t// or deletion i.e. we optimize for [0, 1, 2] --> [9, 0, 1, 2]\n\t\t\t// while a more than 1 offset we see as a swap.\n\t\t\t// We could probably build heuristics for having an optimized course of action here as well, but\n\t\t\t// might go at the cost of some bytes.\n\t\t\t//\n\t\t\t// If we wanted to optimize for i.e. only swaps we'd just do the last two code-branches and have\n\t\t\t// only the first item be a re-scouting and all the others fall in their skewed counter-part.\n\t\t\t// We could also further optimize for swaps\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 {\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\t// Move this VNode's DOM if the original index (matchingIndex) doesn't\n\t\t\t\t// match the new skew index (i + new skew)\n\t\t\t\t// In the former two branches we know that it matches after skewing\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\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.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i < oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode != NULL && (oldVNode._flags & MATCHED) == 0) {\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 * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\n\tif (typeof parentVNode.type == 'function') {\n\t\tlet children = parentVNode._children;\n\t\tfor (let i = 0; children && i < children.length; i++) {\n\t\t\tif (children[i]) {\n\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t// here).\n\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\toldDom = insert(children[i], oldDom, parentDom);\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else if (parentVNode._dom != oldDom) {\n\t\tif (oldDom && parentVNode.type && !oldDom.parentNode) {\n\t\t\toldDom = getDomSibling(parentVNode);\n\t\t}\n\t\toldDom = parentDom.insertBefore(parentVNode._dom, oldDom || NULL);\n\t}\n\n\tdo {\n\t\toldDom = oldDom && oldDom.nextSibling;\n\t} while (oldDom != NULL && 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} else if (isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\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 != NULL && (oldVNode._flags & MATCHED) == 0;\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\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 != NULL &&\n\t\t\t\t(oldVNode._flags & MATCHED) == 0 &&\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 {\n\tEMPTY_ARR,\n\tEMPTY_OBJ,\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 { BaseComponent, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport options from '../options';\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 * @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\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.\n\tif (oldVNode._flags & MODE_SUSPENDED) {\n\t\tisHydrating = !!(oldVNode._flags & MODE_HYDRATE);\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\texcessDomChildren = [oldDom];\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, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\t\t\tconst isClassComponent = newType.prototype && newType.prototype.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\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet 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\tclearProcessingException = c._processingException = c._pendingError;\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 The check above verifies that newType is suppose to be constructed\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\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\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (isClassComponent && c._nextState == NULL) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (isClassComponent && newType.getDerivedStateFromProps != NULL) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\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 (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tc.componentWillMount != NULL\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 != NULL) {\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\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != NULL\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\tnewVNode._original == oldVNode._original ||\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != NULL &&\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._dirty = false;\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 != NULL) {\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 != NULL) {\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._force = false;\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._dirty = false;\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._dirty = false;\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._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 != NULL) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (isClassComponent && !isNew && c.getSnapshotBeforeUpdate != NULL) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet renderResult =\n\t\t\t\ttmp != NULL && tmp.type === Fragment && tmp.key == NULL\n\t\t\t\t\t? cloneNode(tmp.props.children)\n\t\t\t\t\t: tmp;\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\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags &= RESET_MODE;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = NULL;\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 != NULL) {\n\t\t\t\tif (e.then) {\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\twhile (oldDom && oldDom.nodeType == 8 && oldDom.nextSibling) {\n\t\t\t\t\t\toldDom = oldDom.nextSibling;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (excessDomChildren != NULL) {\n\t\t\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = NULL;\n\t\t\t\t\t}\n\t\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\t} else if (excessDomChildren != NULL) {\n\t\t\t\t\tfor (let i = excessDomChildren.length; i--; ) {\n\t\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t\t}\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 == NULL) {\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 if (\n\t\texcessDomChildren == NULL &&\n\t\tnewVNode._original == oldVNode._original\n\t) {\n\t\tnewVNode._children = oldVNode._children;\n\t\tnewVNode._dom = oldVNode._dom;\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);\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._force = true;\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; i++) {\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\nfunction cloneNode(node) {\n\tif (typeof node != 'object' || node == NULL || node._depth > 0) {\n\t\treturn node;\n\t}\n\n\tif (isArray(node)) {\n\t\treturn node.map(cloneNode);\n\t}\n\n\tif (node.constructor !== UNDEFINED) return null;\n\n\treturn assign({}, node);\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 * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue\n) {\n\tlet oldProps = oldVNode.props || EMPTY_OBJ;\n\tlet newProps = newVNode.props;\n\tlet 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 != NULL) {\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\tif (\n\t\t\t\tvalue &&\n\t\t\t\t'setAttribute' in value == !!nodeType &&\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 == NULL) {\n\t\tif (nodeType == NULL) {\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tdom = document.createElementNS(\n\t\t\tnamespace,\n\t\t\tnodeType,\n\t\t\tnewProps.is && newProps\n\t\t);\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 == NULL) {\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// 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(dom.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 != NULL) {\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\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\toldProps[i] !== value\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.innerHTML = '';\n\n\t\t\tdiffChildren(\n\t\t\t\t// @ts-expect-error\n\t\t\t\tnewVNode.type == 'template' ? dom.content : dom,\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\tnodeType == 'foreignObject' ? XHTML_NAMESPACE : namespace,\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 != NULL) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\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('value');\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] ||\n\t\t\t\t\t(nodeType == 'progress' && !inputValue) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType == 'option' && inputValue != oldProps[i]))\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\tlet hasRefUnmount = typeof ref._unmount == 'function';\n\t\t\tif (hasRefUnmount) {\n\t\t\t\t// @ts-ignore TS doesn't like moving narrowing checks into variables\n\t\t\t\tref._unmount();\n\t\t\t}\n\n\t\t\tif (!hasRefUnmount || value != NULL) {\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)) {\n\t\tif (!r.current || r.current == vnode._dom) {\n\t\t\tapplyRef(r, NULL, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != NULL) {\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.base = r._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\tskipRemove || typeof vnode.type != 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\tvnode._component = vnode._parent = vnode._dom = UNDEFINED;\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, NULL } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, 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 * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\t// https://github.com/preactjs/preact/issues/3794\n\tif (parentDom == document) {\n\t\tparentDom = document.documentElement;\n\t}\n\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode == 'function';\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\n\t\t? NULL\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = ((!isHydrating && replaceNode) || parentDom)._children =\n\t\tcreateElement(Fragment, NULL, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [],\n\t\trefQueue = [];\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\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.namespaceURI,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t\t? NULL\n\t\t\t\t: parentDom.firstChild\n\t\t\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t\t\t: NULL,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t\t? oldVNode._dom\n\t\t\t\t: parentDom.firstChild,\n\t\tisHydrating,\n\t\trefQueue\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode, refQueue);\n\n\t// The live children are tracked on _children after diffing.\n\tvnode.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\trender(vnode, parentDom, hydrate);\n}\n","import { assign, slice } from './util';\nimport { createVNode } from './create-element';\nimport { NULL, UNDEFINED } from './constants';\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>} rest 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\n\tlet defaultProps;\n\n\tif (vnode.type && vnode.type.defaultProps) {\n\t\tdefaultProps = vnode.type.defaultProps;\n\t}\n\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse if (props[i] === UNDEFINED && defaultProps != UNDEFINED) {\n\t\t\tnormalizedProps[i] = defaultProps[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(\n\t\tvnode.type,\n\t\tnormalizedProps,\n\t\tkey || vnode.key,\n\t\tref || vnode.ref,\n\t\tNULL\n\t);\n}\n","import { NULL } 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 {boolean} */\n\t\thandled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != NULL) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != NULL) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = 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\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n","import { options as _options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\n// Cast to use internal Options type\nconst options = /** @type {import('./internal').Options} */ (_options);\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\nlet oldRoot = options._root;\n\n// We take the minimum timeout for requestAnimationFrame to ensure that\n// the callback is invoked after the next frame. 35ms is based on a 30hz\n// refresh rate, which is the minimum rate for a smooth user experience.\nconst RAF_TIMEOUT = 35;\nlet prevRaf;\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._root = (vnode, parentDom) => {\n\tif (vnode && parentDom._children && parentDom._children._mask) {\n\t\tvnode._mask = parentDom._children._mask;\n\t}\n\n\tif (oldRoot) oldRoot(vnode, parentDom);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.some(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingArgs = hookItem._nextValue = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.some(invokeCleanup);\n\t\t\thooks._pendingEffects.some(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentIndex = 0;\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.some(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t\thookItem._pendingArgs = undefined;\n\t\t\t}\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\n// TODO: Improve typing of commitQueue parameter\n/** @type {(vnode: import('./internal').VNode, commitQueue: any) => void} */\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.some(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.some(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\n\treturn hooks._list[index];\n}\n\n/**\n * @template {unknown} S\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} [initialState]\n * @returns {[S, (state: S) => void]}\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @template {unknown} S\n * @template {unknown} A\n * @param {import('./index').Reducer<S, A>} reducer\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ S, (state: S) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tlet prevScu = currentComponent.shouldComponentUpdate;\n\t\t\tconst prevCWU = currentComponent.componentWillUpdate;\n\n\t\t\t// If we're dealing with a forced update `shouldComponentUpdate` will\n\t\t\t// not be called. But we use that to update the hook values, so we\n\t\t\t// need to call it.\n\t\t\tcurrentComponent.componentWillUpdate = function (p, s, c) {\n\t\t\t\tif (this._force) {\n\t\t\t\t\tlet tmp = prevScu;\n\t\t\t\t\t// Clear to avoid other sCU hooks from being called\n\t\t\t\t\tprevScu = undefined;\n\t\t\t\t\tupdateHookState(p, s, c);\n\t\t\t\t\tprevScu = tmp;\n\t\t\t\t}\n\n\t\t\t\tif (prevCWU) prevCWU.call(this, p, s, c);\n\t\t\t};\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\t/**\n\t\t\t *\n\t\t\t * @type {import('./internal').Component[\"shouldComponentUpdate\"]}\n\t\t\t */\n\t\t\t// @ts-ignore - We don't use TS to downtranspile\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction updateHookState(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet updatedHook = false;\n\t\t\t\tlet shouldUpdate = hookState._component.props !== p;\n\t\t\t\thookState._component.__hooks._list.some(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tupdatedHook = true;\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (prevScu) {\n\t\t\t\t\tconst result = prevScu.call(this, p, s, c);\n\t\t\t\t\treturn updatedHook ? result || shouldUpdate : result;\n\t\t\t\t}\n\n\t\t\t\treturn !updatedHook || shouldUpdate;\n\t\t\t}\n\n\t\t\tcurrentComponent.shouldComponentUpdate = updateHookState;\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\n/** @type {(initialValue: unknown) => unknown} */\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tconst result = ref(createHandle());\n\t\t\t\treturn () => {\n\t\t\t\t\tref(null);\n\t\t\t\t\tif (result && typeof result == 'function') result();\n\t\t\t\t};\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @template {unknown} T\n * @param {() => T} factory\n * @param {unknown[]} args\n * @returns {T}\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState<T>} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {unknown[]} args\n * @returns {() => void}\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(\n\t\t\tformatter ? formatter(value) : /** @type {any}*/ (value)\n\t\t);\n\t}\n}\n\n/**\n * @param {(error: unknown, errorInfo: import('preact').ErrorInfo) => void} cb\n * @returns {[unknown, () => void]}\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) => {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/** @type {() => string} */\nexport function useId() {\n\t/** @type {import('./internal').IdHookState} */\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\t// Grab either the root node or the nearest async boundary node.\n\t\t/** @type {import('./internal').VNode} */\n\t\tlet root = currentComponent._vnode;\n\t\twhile (root !== null && !root._mask && root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\tlet mask = root._mask || (root._mask = [0, 0]);\n\t\tstate._value = 'P' + mask[0] + '-' + mask[1]++;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tconst hooks = component.__hooks;\n\t\tif (!component._parentDom || !hooks) continue;\n\t\ttry {\n\t\t\thooks._pendingEffects.some(invokeCleanup);\n\t\t\thooks._pendingEffects.some(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\thooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n * @returns {void}\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').HookState} hook\n * @returns {void}\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n * @returns {void}\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {unknown[]} oldArgs\n * @param {unknown[]} newArgs\n * @returns {boolean}\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\n/**\n * @template Arg\n * @param {Arg} arg\n * @param {(arg: Arg) => any} f\n * @returns {any}\n */\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n","/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Check if two objects have a different shape\n * @param {object} a\n * @param {object} b\n * @returns {boolean}\n */\nexport function shallowDiffers(a, b) {\n\tfor (let i in a) if (i !== '__source' && !(i in b)) return true;\n\tfor (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;\n\treturn false;\n}\n\n/**\n * Check if two values are the same value\n * @param {*} x\n * @param {*} y\n * @returns {boolean}\n */\nexport function is(x, y) {\n\treturn (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\n","import { useState, useLayoutEffect, useEffect } from 'preact/hooks';\nimport { is } from './util';\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n * @typedef {{ _value: any; _getSnapshot: () => any }} Store\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\t/**\n\t * @typedef {{ _instance: Store }} StoreRef\n\t * @type {[StoreRef, (store: StoreRef) => void]}\n\t */\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (didSnapshotChange(_instance)) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (didSnapshotChange(_instance)) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (didSnapshotChange(_instance)) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\n/** @type {(inst: Store) => boolean} */\nfunction didSnapshotChange(inst) {\n\ttry {\n\t\treturn !is(inst._value, inst._getSnapshot());\n\t} catch (error) {\n\t\treturn true;\n\t}\n}\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n","import { Component } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Component class with a predefined `shouldComponentUpdate` implementation\n */\nexport function PureComponent(p, c) {\n\tthis.props = p;\n\tthis.context = c;\n}\nPureComponent.prototype = new Component();\n// Some third-party libraries check if this property is present\nPureComponent.prototype.isPureReactComponent = true;\nPureComponent.prototype.shouldComponentUpdate = function (props, state) {\n\treturn shallowDiffers(this.props, props) || shallowDiffers(this.state, state);\n};\n","import { createElement } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Memoize a component, so that it only updates when the props actually have\n * changed. This was previously known as `React.pure`.\n * @param {import('./internal').FunctionComponent} c functional component\n * @param {(prev: object, next: object) => boolean} [comparer] Custom equality function\n * @returns {import('./internal').FunctionComponent}\n */\nexport function memo(c, comparer) {\n\tfunction shouldUpdate(nextProps) {\n\t\tlet ref = this.props.ref;\n\t\tif (ref != nextProps.ref && ref) {\n\t\t\ttypeof ref == 'function' ? ref(null) : (ref.current = null);\n\t\t}\n\n\t\treturn comparer\n\t\t\t? !comparer(this.props, nextProps) || ref != nextProps.ref\n\t\t\t: shallowDiffers(this.props, nextProps);\n\t}\n\n\tfunction Memoed(props) {\n\t\tthis.shouldComponentUpdate = shouldUpdate;\n\t\treturn createElement(c, props);\n\t}\n\tMemoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';\n\tMemoed._forwarded = Memoed.prototype.isReactComponent = true;\n\tMemoed.type = c;\n\treturn Memoed;\n}\n","import { options } from 'preact';\nimport { assign } from './util';\n\nlet oldDiffHook = options._diff;\noptions._diff = vnode => {\n\tif (vnode.type && vnode.type._forwarded && vnode.ref) {\n\t\tvnode.props.ref = vnode.ref;\n\t\tvnode.ref = null;\n\t}\n\tif (oldDiffHook) oldDiffHook(vnode);\n};\n\nexport const REACT_FORWARD_SYMBOL =\n\t(typeof Symbol != 'undefined' &&\n\t\tSymbol.for &&\n\t\tSymbol.for('react.forward_ref')) ||\n\t0xf47;\n\n/**\n * Pass ref down to a child. This is mainly used in libraries with HOCs that\n * wrap components. Using `forwardRef` there is an easy way to get a reference\n * of the wrapped component instead of one of the wrapper itself.\n * @param {import('./index').ForwardFn} fn\n * @returns {import('./internal').FunctionComponent}\n */\nexport function forwardRef(fn) {\n\tfunction Forwarded(props) {\n\t\tlet clone = assign({}, props);\n\t\tdelete clone.ref;\n\t\treturn fn(clone, props.ref || null);\n\t}\n\n\t// mobx-react checks for this being present\n\tForwarded.$$typeof = REACT_FORWARD_SYMBOL;\n\t// mobx-react heavily relies on implementation details.\n\t// It expects an object here with a `render` property,\n\t// and prototype.render will fail. Without this\n\t// mobx-react throws.\n\tForwarded.render = fn;\n\n\tForwarded.prototype.isReactComponent = Forwarded._forwarded = true;\n\tForwarded.displayName = 'ForwardRef(' + (fn.displayName || fn.name) + ')';\n\treturn Forwarded;\n}\n","import { toChildArray } from 'preact';\n\nconst mapFn = (children, fn) => {\n\tif (children == null) return null;\n\treturn toChildArray(toChildArray(children).map(fn));\n};\n\n// This API is completely unnecessary for Preact, so it's basically passthrough.\nexport const Children = {\n\tmap: mapFn,\n\tforEach: mapFn,\n\tcount(children) {\n\t\treturn children ? toChildArray(children).length : 0;\n\t},\n\tonly(children) {\n\t\tconst normalized = toChildArray(children);\n\t\tif (normalized.length !== 1) throw 'Children.only';\n\t\treturn normalized[0];\n\t},\n\ttoArray: toChildArray\n};\n","import { Component, createElement, options, Fragment } from 'preact';\nimport { MODE_HYDRATE } from '../../src/constants';\nimport { assign } from './util';\n\nconst oldCatchError = options._catchError;\noptions._catchError = function (error, newVNode, oldVNode, errorInfo) {\n\tif (error.then) {\n\t\t/** @type {import('./internal').Component} */\n\t\tlet component;\n\t\tlet vnode = newVNode;\n\n\t\tfor (; (vnode = vnode._parent); ) {\n\t\t\tif ((component = vnode._component) && component._childDidSuspend) {\n\t\t\t\tif (newVNode._dom == null) {\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children || [];\n\t\t\t\t}\n\t\t\t\t// Don't call oldCatchError if we found a Suspense\n\t\t\t\treturn component._childDidSuspend(error, newVNode);\n\t\t\t}\n\t\t}\n\t}\n\toldCatchError(error, newVNode, oldVNode, errorInfo);\n};\n\nconst oldUnmount = options.unmount;\noptions.unmount = function (vnode) {\n\t/** @type {import('./internal').Component} */\n\tconst component = vnode._component;\n\tif (component) component._unmounted = true;\n\tif (component && component._onResolve) {\n\t\tcomponent._onResolve();\n\t}\n\n\t// if the component is still hydrating\n\t// most likely it is because the component is suspended\n\t// we set the vnode.type as `null` so that it is not a typeof function\n\t// so the unmount will remove the vnode._dom\n\tif (component && vnode._flags & MODE_HYDRATE) {\n\t\tvnode.type = null;\n\t}\n\n\tif (oldUnmount) oldUnmount(vnode);\n};\n\nfunction detachedClone(vnode, detachedParent, parentDom) {\n\tif (vnode) {\n\t\tif (vnode._component && vnode._component.__hooks) {\n\t\t\tvnode._component.__hooks._list.forEach(effect => {\n\t\t\t\tif (typeof effect._cleanup == 'function') effect._cleanup();\n\t\t\t});\n\n\t\t\tvnode._component.__hooks = null;\n\t\t}\n\n\t\tvnode = assign({}, vnode);\n\t\tif (vnode._component != null) {\n\t\t\tif (vnode._component._parentDom === parentDom) {\n\t\t\t\tvnode._component._parentDom = detachedParent;\n\t\t\t}\n\n\t\t\tvnode._component._force = true;\n\n\t\t\tvnode._component = null;\n\t\t}\n\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tdetachedClone(child, detachedParent, parentDom)\n\t\t\t);\n\t}\n\n\treturn vnode;\n}\n\nfunction removeOriginal(vnode, detachedParent, originalParent) {\n\tif (vnode && originalParent) {\n\t\tvnode._original = null;\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tremoveOriginal(child, detachedParent, originalParent)\n\t\t\t);\n\n\t\tif (vnode._component) {\n\t\t\tif (vnode._component._parentDom === detachedParent) {\n\t\t\t\tif (vnode._dom) {\n\t\t\t\t\toriginalParent.appendChild(vnode._dom);\n\t\t\t\t}\n\t\t\t\tvnode._component._force = true;\n\t\t\t\tvnode._component._parentDom = originalParent;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn vnode;\n}\n\n// having custom inheritance instead of a class here saves a lot of bytes\nexport function Suspense() {\n\t// we do not call super here to golf some bytes...\n\tthis._pendingSuspensionCount = 0;\n\tthis._suspenders = null;\n\tthis._detachOnNextRender = null;\n}\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspense.prototype = new Component();\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {Promise} promise The thrown promise\n * @param {import('./internal').VNode<any, any>} suspendingVNode The suspending component\n */\nSuspense.prototype._childDidSuspend = function (promise, suspendingVNode) {\n\tconst suspendingComponent = suspendingVNode._component;\n\n\t/** @type {import('./internal').SuspenseComponent} */\n\tconst c = this;\n\n\tif (c._suspenders == null) {\n\t\tc._suspenders = [];\n\t}\n\tc._suspenders.push(suspendingComponent);\n\n\tconst resolve = suspended(c._vnode);\n\n\tlet resolved = false;\n\tconst onResolved = () => {\n\t\tif (resolved || c._unmounted) return;\n\n\t\tresolved = true;\n\t\tsuspendingComponent._onResolve = null;\n\n\t\tif (resolve) {\n\t\t\tresolve(onSuspensionComplete);\n\t\t} else {\n\t\t\tonSuspensionComplete();\n\t\t}\n\t};\n\n\tsuspendingComponent._onResolve = onResolved;\n\n\t// Store and null _parentDom to prevent setState/forceUpdate from\n\t// scheduling renders while suspended. Render would be a no-op anyway\n\t// since renderComponent checks _parentDom, but this avoids queue churn.\n\tconst originalParentDom = suspendingComponent._parentDom;\n\tsuspendingComponent._parentDom = null;\n\n\tconst onSuspensionComplete = () => {\n\t\tif (!--c._pendingSuspensionCount) {\n\t\t\t// If the suspension was during hydration we don't need to restore the\n\t\t\t// suspended children into the _children array\n\t\t\tif (c.state._suspended) {\n\t\t\t\tconst suspendedVNode = c.state._suspended;\n\t\t\t\tc._vnode._children[0] = removeOriginal(\n\t\t\t\t\tsuspendedVNode,\n\t\t\t\t\tsuspendedVNode._component._parentDom,\n\t\t\t\t\tsuspendedVNode._component._originalParentDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tc.setState({ _suspended: (c._detachOnNextRender = null) });\n\n\t\t\tlet suspended;\n\t\t\twhile ((suspended = c._suspenders.pop())) {\n\t\t\t\t// Restore _parentDom before forceUpdate so render can proceed\n\t\t\t\tsuspended._parentDom = originalParentDom;\n\t\t\t\tsuspended.forceUpdate();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * We do not set `suspended: true` during hydration because we want the actual markup\n\t * to remain on screen and hydrate it when the suspense actually gets resolved.\n\t * While in non-hydration cases the usual fallback -> component flow would occour.\n\t */\n\tif (\n\t\t!c._pendingSuspensionCount++ &&\n\t\t!(suspendingVNode._flags & MODE_HYDRATE)\n\t) {\n\t\tc.setState({ _suspended: (c._detachOnNextRender = c._vnode._children[0]) });\n\t}\n\tpromise.then(onResolved, onResolved);\n};\n\nSuspense.prototype.componentWillUnmount = function () {\n\tthis._suspenders = [];\n};\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {import('./internal').SuspenseComponent[\"props\"]} props\n * @param {import('./internal').SuspenseState} state\n */\nSuspense.prototype.render = function (props, state) {\n\tif (this._detachOnNextRender) {\n\t\t// When the Suspense's _vnode was created by a call to createVNode\n\t\t// (i.e. due to a setState further up in the tree)\n\t\t// it's _children prop is null, in this case we \"forget\" about the parked vnodes to detach\n\t\tif (this._vnode._children) {\n\t\t\tconst detachedParent = document.createElement('div');\n\t\t\tconst detachedComponent = this._vnode._children[0]._component;\n\t\t\tthis._vnode._children[0] = detachedClone(\n\t\t\t\tthis._detachOnNextRender,\n\t\t\t\tdetachedParent,\n\t\t\t\t(detachedComponent._originalParentDom = detachedComponent._parentDom)\n\t\t\t);\n\t\t}\n\n\t\tthis._detachOnNextRender = null;\n\t}\n\n\t// Wrap fallback tree in a VNode that prevents itself from being marked as aborting mid-hydration:\n\t/** @type {import('./internal').VNode} */\n\tconst fallback =\n\t\tstate._suspended && createElement(Fragment, null, props.fallback);\n\tif (fallback) fallback._flags &= ~MODE_HYDRATE;\n\n\treturn [\n\t\tcreateElement(Fragment, null, state._suspended ? null : props.children),\n\t\tfallback\n\t];\n};\n\n/**\n * Checks and calls the parent component's _suspended method, passing in the\n * suspended vnode. This is a way for a parent (e.g. SuspenseList) to get notified\n * that one of its children/descendants suspended.\n *\n * The parent MAY return a callback. The callback will get called when the\n * suspension resolves, notifying the parent of the fact.\n * Moreover, the callback gets function `unsuspend` as a parameter. The resolved\n * child descendant will not actually get unsuspended until `unsuspend` gets called.\n * This is a way for the parent to delay unsuspending.\n *\n * If the parent does not return a callback then the resolved vnode\n * gets unsuspended immediately when it resolves.\n *\n * @param {import('./internal').VNode} vnode\n * @returns {((unsuspend: () => void) => void)?}\n */\nexport function suspended(vnode) {\n\tlet component = vnode._parent && vnode._parent._component;\n\treturn component && component._suspended && component._suspended(vnode);\n}\n\nexport function lazy(loader) {\n\tlet prom;\n\tlet component = null;\n\tlet error;\n\tlet resolved;\n\n\tfunction Lazy(props) {\n\t\tif (!prom) {\n\t\t\tprom = loader();\n\t\t\tprom.then(\n\t\t\t\texports => {\n\t\t\t\t\tif (exports) {\n\t\t\t\t\t\tcomponent = exports.default || exports;\n\t\t\t\t\t}\n\t\t\t\t\tresolved = true;\n\t\t\t\t},\n\t\t\t\te => {\n\t\t\t\t\terror = e;\n\t\t\t\t\tresolved = true;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!resolved) {\n\t\t\tthrow prom;\n\t\t}\n\n\t\treturn component ? createElement(component, props) : null;\n\t}\n\n\tLazy.displayName = 'Lazy';\n\tLazy._forwarded = true;\n\treturn Lazy;\n}\n","import { Component, toChildArray } from 'preact';\nimport { suspended } from './suspense.js';\n\n// Indexes to linked list nodes (nodes are stored as arrays to save bytes).\nconst SUSPENDED_COUNT = 0;\nconst RESOLVED_COUNT = 1;\nconst NEXT_NODE = 2;\n\n// Having custom inheritance instead of a class here saves a lot of bytes.\nexport function SuspenseList() {\n\tthis._next = null;\n\tthis._map = null;\n}\n\n// Mark one of child's earlier suspensions as resolved.\n// Some pending callbacks may become callable due to this\n// (e.g. the last suspended descendant gets resolved when\n// revealOrder === 'together'). Process those callbacks as well.\nconst resolve = (list, child, node) => {\n\tif (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {\n\t\t// The number a child (or any of its descendants) has been suspended\n\t\t// matches the number of times it's been resolved. Therefore we\n\t\t// mark the child as completely resolved by deleting it from ._map.\n\t\t// This is used to figure out when *all* children have been completely\n\t\t// resolved when revealOrder is 'together'.\n\t\tlist._map.delete(child);\n\t}\n\n\t// If revealOrder is falsy then we can do an early exit, as the\n\t// callbacks won't get queued in the node anyway.\n\t// If revealOrder is 'together' then also do an early exit\n\t// if all suspended descendants have not yet been resolved.\n\tif (\n\t\t!list.props.revealOrder ||\n\t\t(list.props.revealOrder[0] === 't' && list._map.size)\n\t) {\n\t\treturn;\n\t}\n\n\t// Walk the currently suspended children in order, calling their\n\t// stored callbacks on the way. Stop if we encounter a child that\n\t// has not been completely resolved yet.\n\tnode = list._next;\n\twhile (node) {\n\t\twhile (node.length > 3) {\n\t\t\tnode.pop()();\n\t\t}\n\t\tif (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {\n\t\t\tbreak;\n\t\t}\n\t\tlist._next = node = node[NEXT_NODE];\n\t}\n};\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspenseList.prototype = new Component();\n\nSuspenseList.prototype._suspended = function (child) {\n\tconst list = this;\n\tconst delegated = suspended(list._vnode);\n\n\tlet node = list._map.get(child);\n\tnode[SUSPENDED_COUNT]++;\n\n\treturn unsuspend => {\n\t\tconst wrappedUnsuspend = () => {\n\t\t\tif (!list.props.revealOrder) {\n\t\t\t\t// Special case the undefined (falsy) revealOrder, as there\n\t\t\t\t// is no need to coordinate a specific order or unsuspends.\n\t\t\t\tunsuspend();\n\t\t\t} else {\n\t\t\t\tnode.push(unsuspend);\n\t\t\t\tresolve(list, child, node);\n\t\t\t}\n\t\t};\n\t\tif (delegated) {\n\t\t\tdelegated(wrappedUnsuspend);\n\t\t} else {\n\t\t\twrappedUnsuspend();\n\t\t}\n\t};\n};\n\nSuspenseList.prototype.render = function (props) {\n\tthis._next = null;\n\tthis._map = new Map();\n\n\tconst children = toChildArray(props.children);\n\tif (props.revealOrder && props.revealOrder[0] === 'b') {\n\t\t// If order === 'backwards' (or, well, anything starting with a 'b')\n\t\t// then flip the child list around so that the last child will be\n\t\t// the first in the linked list.\n\t\tchildren.reverse();\n\t}\n\t// Build the linked list. Iterate through the children in reverse order\n\t// so that `_next` points to the first linked list node to be resolved.\n\tfor (let i = children.length; i--; ) {\n\t\t// Create a new linked list node as an array of form:\n\t\t// \t[suspended_count, resolved_count, next_node]\n\t\t// where suspended_count and resolved_count are numeric counters for\n\t\t// keeping track how many times a node has been suspended and resolved.\n\t\t//\n\t\t// Note that suspended_count starts from 1 instead of 0, so we can block\n\t\t// processing callbacks until componentDidMount has been called. In a sense\n\t\t// node is suspended at least until componentDidMount gets called!\n\t\t//\n\t\t// Pending callbacks are added to the end of the node:\n\t\t// \t[suspended_count, resolved_count, next_node, callback_0, callback_1, ...]\n\t\tthis._map.set(children[i], (this._next = [1, 0, this._next]));\n\t}\n\treturn props.children;\n};\n\nSuspenseList.prototype.componentDidUpdate =\n\tSuspenseList.prototype.componentDidMount = function () {\n\t\t// Iterate through all children after mounting for two reasons:\n\t\t// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases\n\t\t// each node[RELEASED_COUNT] by 1, therefore balancing the counters.\n\t\t// The nodes can now be completely consumed from the linked list.\n\t\t// 2. Handle nodes that might have gotten resolved between render and\n\t\t// componentDidMount.\n\t\tthis._map.forEach((node, child) => {\n\t\t\tresolve(this, child, node);\n\t\t});\n\t};\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\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 = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { createElement, render } from 'preact';\n\n/**\n * @param {import('../../src/index').RenderableProps<{ context: any }>} props\n */\nfunction ContextProvider(props) {\n\tthis.getChildContext = () => props.context;\n\treturn props.children;\n}\n\n/**\n * Portal component\n * @this {import('./internal').Component}\n * @param {object | null | undefined} props\n *\n * TODO: use createRoot() instead of fake root\n */\nfunction Portal(props) {\n\tconst _this = this;\n\tlet container = props._container;\n\n\t_this.componentWillUnmount = function () {\n\t\trender(null, _this._temp);\n\t\t_this._temp = null;\n\t\t_this._container = null;\n\t};\n\n\t// When we change container we should clear our old container and\n\t// indicate a new mount.\n\tif (_this._container && _this._container !== container) {\n\t\t_this.componentWillUnmount();\n\t}\n\n\tif (!_this._temp) {\n\t\t// Ensure the element has a mask for useId invocations\n\t\tlet root = _this._vnode;\n\t\twhile (root !== null && !root._mask && root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\t_this._container = container;\n\n\t\t// Create a fake DOM parent node that manages a subset of `container`'s children:\n\t\t_this._temp = {\n\t\t\tnodeType: 1,\n\t\t\tparentNode: container,\n\t\t\tchildNodes: [],\n\t\t\t_children: { _mask: root._mask },\n\t\t\tcontains: () => true,\n\t\t\tnamespaceURI: container.namespaceURI,\n\t\t\tinsertBefore(child, before) {\n\t\t\t\tthis.childNodes.push(child);\n\t\t\t\t_this._container.insertBefore(child, before);\n\t\t\t},\n\t\t\tremoveChild(child) {\n\t\t\t\tthis.childNodes.splice(this.childNodes.indexOf(child) >>> 1, 1);\n\t\t\t\t_this._container.removeChild(child);\n\t\t\t}\n\t\t};\n\t}\n\n\t// Render our wrapping element into temp.\n\trender(\n\t\tcreateElement(ContextProvider, { context: _this.context }, props._vnode),\n\t\t_this._temp\n\t);\n}\n\n/**\n * Create a `Portal` to continue rendering the vnode tree at a different DOM node\n * @param {import('./internal').VNode} 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\tconst el = createElement(Portal, { _vnode: vnode, _container: container });\n\tel.containerInfo = container;\n\treturn el;\n}\n","import {\n\trender as preactRender,\n\thydrate as preactHydrate,\n\toptions,\n\ttoChildArray,\n\tComponent\n} from 'preact';\nimport {\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tuseEffect,\n\tuseId,\n\tuseImperativeHandle,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n\tuseState\n} from 'preact/hooks';\nimport {\n\tuseDeferredValue,\n\tuseInsertionEffect,\n\tuseSyncExternalStore,\n\tuseTransition\n} from './index';\n\nexport const REACT_ELEMENT_TYPE =\n\t(typeof Symbol != 'undefined' && Symbol.for && Symbol.for('react.element')) ||\n\t0xeac7;\n\nconst CAMEL_PROPS =\n\t/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;\nconst ON_ANI = /^on(Ani|Tra|Tou|BeforeInp|Compo)/;\nconst CAMEL_REPLACE = /[A-Z0-9]/g;\nconst IS_DOM = typeof document !== 'undefined';\n\n// Input types for which onchange should not be converted to oninput.\n// type=\"file|checkbox|radio\", plus \"range\" in IE11.\n// (IE11 doesn't support Symbol, which we use here to turn `rad` into `ra` which matches \"range\")\nconst onChangeInputType = type =>\n\t(typeof Symbol != 'undefined' && typeof Symbol() == 'symbol'\n\t\t? /fil|che|rad/\n\t\t: /fil|che|ra/\n\t).test(type);\n\n// Some libraries like `react-virtualized` explicitly check for this.\nComponent.prototype.isReactComponent = true;\n\n// `UNSAFE_*` lifecycle hooks\n// Preact only ever invokes the unprefixed methods.\n// Here we provide a base \"fallback\" implementation that calls any defined UNSAFE_ prefixed method.\n// - If a component defines its own `componentDidMount()` (including via defineProperty), use that.\n// - If a component defines `UNSAFE_componentDidMount()`, `componentDidMount` is the alias getter/setter.\n// - If anything assigns to an `UNSAFE_*` property, the assignment is forwarded to the unprefixed property.\n// See https://github.com/preactjs/preact/issues/1941\n[\n\t'componentWillMount',\n\t'componentWillReceiveProps',\n\t'componentWillUpdate'\n].forEach(key => {\n\tObject.defineProperty(Component.prototype, key, {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn this['UNSAFE_' + key];\n\t\t},\n\t\tset(v) {\n\t\t\tObject.defineProperty(this, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: v\n\t\t\t});\n\t\t}\n\t});\n});\n\n/**\n * Proxy render() since React returns a Component reference.\n * @param {import('./internal').VNode} vnode VNode tree to render\n * @param {import('./internal').PreactElement} parent DOM node to render vnode tree into\n * @param {() => void} [callback] Optional callback that will be called after rendering\n * @returns {import('./internal').Component | null} The root component reference or null\n */\nexport function render(vnode, parent, callback) {\n\t// React destroys any existing DOM nodes, see #1727\n\t// ...but only on the first render, see #1828\n\tif (parent._children == null) {\n\t\tparent.textContent = '';\n\t}\n\n\tpreactRender(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nexport function hydrate(vnode, parent, callback) {\n\tpreactHydrate(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nlet oldEventHook = options.event;\noptions.event = e => {\n\tif (oldEventHook) e = oldEventHook(e);\n\n\te.persist = () => {};\n\te.isPropagationStopped = function isPropagationStopped() {\n\t\treturn this.cancelBubble;\n\t};\n\te.isDefaultPrevented = function isDefaultPrevented() {\n\t\treturn this.defaultPrevented;\n\t};\n\treturn (e.nativeEvent = e);\n};\n\nconst classNameDescriptorNonEnumberable = {\n\tconfigurable: true,\n\tget() {\n\t\treturn this.class;\n\t}\n};\n\nfunction handleDomVNode(vnode) {\n\tlet props = vnode.props,\n\t\ttype = vnode.type,\n\t\tnormalizedProps = {},\n\t\tisNonDashedType = type.indexOf('-') == -1;\n\n\tfor (let i in props) {\n\t\tlet value = props[i];\n\n\t\tif (\n\t\t\t(i === 'value' && 'defaultValue' in props && value == null) ||\n\t\t\t// Emulate React's behavior of not rendering the contents of noscript tags on the client.\n\t\t\t(IS_DOM && i === 'children' && type === 'noscript') ||\n\t\t\ti === 'class' ||\n\t\t\ti === 'className'\n\t\t) {\n\t\t\t// Skip applying value if it is null/undefined and we already set\n\t\t\t// a default value\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet lowerCased = i.toLowerCase();\n\t\tif (i === 'defaultValue' && 'value' in props && props.value == null) {\n\t\t\t// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.\n\t\t\t// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.\n\t\t\ti = 'value';\n\t\t} else if (i === 'download' && value === true) {\n\t\t\t// Calling `setAttribute` with a truthy value will lead to it being\n\t\t\t// passed as a stringified value, e.g. `download=\"true\"`. React\n\t\t\t// converts it to an empty string instead, otherwise the attribute\n\t\t\t// value will be used as the file name and the file will be called\n\t\t\t// \"true\" upon downloading it.\n\t\t\tvalue = '';\n\t\t} else if (lowerCased === 'translate' && value === 'no') {\n\t\t\tvalue = false;\n\t\t} else if (lowerCased[0] === 'o' && lowerCased[1] === 'n') {\n\t\t\tif (lowerCased === 'ondoubleclick') {\n\t\t\t\ti = 'ondblclick';\n\t\t\t} else if (\n\t\t\t\tlowerCased === 'onchange' &&\n\t\t\t\t(type === 'input' || type === 'textarea') &&\n\t\t\t\t!onChangeInputType(props.type)\n\t\t\t) {\n\t\t\t\tlowerCased = i = 'oninput';\n\t\t\t} else if (lowerCased === 'onfocus') {\n\t\t\t\ti = 'onfocusin';\n\t\t\t} else if (lowerCased === 'onblur') {\n\t\t\t\ti = 'onfocusout';\n\t\t\t} else if (ON_ANI.test(i)) {\n\t\t\t\ti = lowerCased;\n\t\t\t}\n\t\t} else if (isNonDashedType && CAMEL_PROPS.test(i)) {\n\t\t\ti = i.replace(CAMEL_REPLACE, '-$&').toLowerCase();\n\t\t} else if (value === null) {\n\t\t\tvalue = undefined;\n\t\t}\n\n\t\t// Add support for onInput and onChange, see #3561\n\t\t// if we have an oninput prop already change it to oninputCapture\n\t\tif (lowerCased === 'oninput') {\n\t\t\ti = lowerCased;\n\t\t\tif (normalizedProps[i]) {\n\t\t\t\ti = 'oninputCapture';\n\t\t\t}\n\t\t}\n\n\t\tnormalizedProps[i] = value;\n\t}\n\n\tif (type == 'select') {\n\t\t// Add support for array select values: <select multiple value={[]} />\n\t\tif (normalizedProps.multiple && Array.isArray(normalizedProps.value)) {\n\t\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t\t});\n\t\t}\n\n\t\t// Adding support for defaultValue in select tag\n\t\tif (normalizedProps.defaultValue != null) {\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tif (normalizedProps.multiple) {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t\t} else {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (props.class && !props.className) {\n\t\tnormalizedProps.class = props.class;\n\t\tObject.defineProperty(\n\t\t\tnormalizedProps,\n\t\t\t'className',\n\t\t\tclassNameDescriptorNonEnumberable\n\t\t);\n\t} else if (props.className) {\n\t\tnormalizedProps.class = normalizedProps.className = props.className;\n\t}\n\n\tvnode.props = normalizedProps;\n}\n\nlet oldVNodeHook = options.vnode;\noptions.vnode = vnode => {\n\t// only normalize props on Element nodes\n\tif (typeof vnode.type === 'string') {\n\t\thandleDomVNode(vnode);\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function (vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\nconst oldDiffed = options.diffed;\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = function (vnode) {\n\tif (oldDiffed) {\n\t\toldDiffed(vnode);\n\t}\n\n\tconst props = vnode.props;\n\tconst dom = vnode._dom;\n\n\tif (\n\t\tdom != null &&\n\t\tvnode.type === 'textarea' &&\n\t\t'value' in props &&\n\t\tprops.value !== dom.value\n\t) {\n\t\tdom.value = props.value == null ? '' : props.value;\n\t}\n\n\tcurrentComponent = null;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t},\n\t\t\tuseCallback,\n\t\t\tuseContext,\n\t\t\tuseDebugValue,\n\t\t\tuseDeferredValue,\n\t\t\tuseEffect,\n\t\t\tuseId,\n\t\t\tuseImperativeHandle,\n\t\t\tuseInsertionEffect,\n\t\t\tuseLayoutEffect,\n\t\t\tuseMemo,\n\t\t\t// useMutableSource, // experimental-only and replaced by uSES, likely not worth supporting\n\t\t\tuseReducer,\n\t\t\tuseRef,\n\t\t\tuseState,\n\t\t\tuseSyncExternalStore,\n\t\t\tuseTransition\n\t\t}\n\t}\n};\n","import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment,\n\toptions\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport {\n\tuseInsertionEffect,\n\tstartTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tuseTransition\n} from './hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '18.3.1'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Check if the passed element is a Fragment node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isFragment(element) {\n\treturn isValidElement(element) && element.type === Fragment;\n}\n\n/**\n * Check if the passed element is a Memo node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isMemo(element) {\n\treturn (\n\t\t!!element &&\n\t\ttypeof element.displayName == 'string' &&\n\t\telement.displayName.indexOf('Memo(') == 0\n\t);\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => {\n\tconst prevDebounce = options.debounceRendering;\n\tlet flush;\n\toptions.debounceRendering = cb => {\n\t\tflush = cb;\n\t};\n\ttry {\n\t\tconst res = callback(arg);\n\t\tif (flush) flush();\n\t\treturn res;\n\t} finally {\n\t\toptions.debounceRendering = prevDebounce;\n\t}\n};\n\n// compat to react-is\nexport const isElement = isValidElement;\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tisFragment,\n\tisMemo,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tuseInsertionEffect,\n\tstartTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tuseTransition,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tFragment as StrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tisElement,\n\tisFragment,\n\tisMemo,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode: Fragment,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n","/**\n * Thin browser client for the Aginies platform: activation handshake, hosted-chat\n * configuration and streaming chat turns. No framework dependency; the React layer\n * wraps it.\n */\n\nexport interface AginiesConfig {\n /** Platform origin, e.g. `https://app.example.com`. No trailing slash. */\n baseUrl: string\n /** Activation token issued for the deployment. Without it nothing renders. */\n token: string\n /** UI language. Defaults to the document language, then English. */\n locale?: 'tr' | 'en'\n /** Fetch implementation override (tests, SSR). */\n fetch?: typeof fetch\n}\n\nexport interface ActivationConfig {\n apiBase: string\n brand: { name: string; logoUrl: string | null }\n theme: Record<string, string | undefined> | null\n /** Widget modules the activation unlocks; empty means all. */\n modules?: string[]\n /** The tenant a tenant key belongs to. Absent for a static activation key. */\n tenant?: { id: string; name: string }\n}\n\n/**\n * The session a tenant key buys: a short-lived bearer the client sends on every\n * platform call and renews by re-activating when it is refused.\n */\nexport interface ActivationSession {\n token: string\n /** Unix seconds. */\n expiresAt: number\n}\n\nexport type ActivationState =\n | { status: 'idle' }\n | { status: 'activating' }\n | { status: 'active'; config: ActivationConfig }\n | { status: 'rejected'; reason: string }\n\nexport interface ChatConfig {\n id: string\n title: string\n description: string\n customizations: {\n primaryColor?: string\n welcomeMessage?: string\n imageUrl?: string\n logoUrl?: string\n headerText?: string\n }\n authType: 'public' | 'password' | 'email' | 'sso'\n outputConfigs?: Array<{ blockId: string; path?: string }>\n}\n\nexport interface ChatAuthRequired {\n authRequired: ChatConfig['authType']\n title?: string\n description?: string\n}\n\nexport interface ChatFilePayload {\n name: string\n type: string\n size: number\n data: string\n lastModified?: number\n}\n\nexport interface SendMessageInput {\n input?: string\n conversationId?: string\n password?: string\n email?: string\n files?: ChatFilePayload[]\n}\n\n/** One server-sent event from a chat turn, already decoded. */\nexport type ChatStreamEvent =\n | { type: 'chunk'; blockId?: string; text: string }\n | { type: 'final'; data: unknown }\n | { type: 'error'; message: string }\n | { type: 'done' }\n\nexport class AginiesError extends Error {\n readonly status: number\n readonly code?: string\n constructor(message: string, status: number, code?: string) {\n super(message)\n this.name = 'AginiesError'\n this.status = status\n this.code = code\n }\n}\n\nconst trimSlash = (s: string) => s.replace(/\\/+$/, '')\n\nexport class AginiesClient {\n readonly baseUrl: string\n readonly token: string\n readonly locale: 'tr' | 'en'\n private readonly fetchImpl: typeof fetch\n private state: ActivationState = { status: 'idle' }\n private listeners = new Set<(s: ActivationState) => void>()\n private activation: Promise<ActivationState> | null = null\n private session: ActivationSession | null = null\n\n constructor(config: AginiesConfig) {\n if (!config?.baseUrl) throw new AginiesError('baseUrl is required', 0, 'MISSING_BASE_URL')\n if (!config?.token) throw new AginiesError('token is required', 0, 'MISSING_TOKEN')\n this.baseUrl = trimSlash(config.baseUrl)\n this.token = config.token\n this.locale = config.locale ?? detectLocale()\n this.fetchImpl = config.fetch ?? ((...args) => fetch(...args))\n }\n\n getState(): ActivationState {\n return this.state\n }\n\n subscribe(listener: (s: ActivationState) => void): () => void {\n this.listeners.add(listener)\n return () => this.listeners.delete(listener)\n }\n\n private setState(next: ActivationState) {\n this.state = next\n for (const l of this.listeners) l(next)\n }\n\n /**\n * Runs the activation handshake once and caches the outcome. Components render only\n * while the state is `active`; a rejected activation is final for this client.\n */\n activate(): Promise<ActivationState> {\n if (this.activation) return this.activation\n this.setState({ status: 'activating' })\n this.activation = (async () => {\n try {\n const res = await this.fetchImpl(`${this.baseUrl}/api/ui/activate`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ token: this.token }),\n })\n if (!res.ok) {\n const body = await safeJson(res)\n const reason = (body && (body.error as string)) || `HTTP ${res.status}`\n this.setState({ status: 'rejected', reason })\n return this.state\n }\n const body = (await res.json()) as {\n activated?: boolean\n config?: ActivationConfig\n session?: ActivationSession\n }\n if (!body.activated || !body.config) {\n this.setState({ status: 'rejected', reason: 'Activation refused' })\n return this.state\n }\n this.session = body.session ?? null\n this.setState({ status: 'active', config: body.config })\n return this.state\n } catch (err) {\n this.setState({\n status: 'rejected',\n reason: err instanceof Error ? err.message : 'Activation failed',\n })\n return this.state\n }\n })()\n return this.activation\n }\n\n private assertActive() {\n if (this.state.status !== 'active') {\n throw new AginiesError('Client is not activated', 0, 'NOT_ACTIVATED')\n }\n }\n\n /** The current tenant session, if the activation issued one. */\n getSession(): ActivationSession | null {\n return this.session\n }\n\n /** Whether `module` may render under this activation. */\n hasModule(module: string): boolean {\n if (this.state.status !== 'active') return false\n const modules = this.state.config.modules ?? []\n return modules.length === 0 || modules.includes(module)\n }\n\n /**\n * Re-runs the handshake to obtain a fresh session. Used when a call is refused with\n * an expired bearer; the activation state stays `active` unless the platform now\n * rejects the key.\n */\n private async renewSession(): Promise<boolean> {\n this.activation = null\n const state = await this.activate()\n return state.status === 'active' && this.session !== null\n }\n\n private withSession(init: RequestInit): RequestInit {\n if (!this.session) return init\n const headers = new Headers(init.headers ?? {})\n if (!headers.has('Authorization')) headers.set('Authorization', `Bearer ${this.session.token}`)\n return { ...init, headers }\n }\n\n /**\n * A platform request carrying cookies and, when a tenant session exists, its bearer.\n * A 401/403 on a session that has expired triggers one renewal and one retry.\n */\n private async request(path: string, init: RequestInit = {}): Promise<Response> {\n const url = `${this.baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n const send = () => this.fetchImpl(url, this.withSession({ credentials: 'include', ...init }))\n let res = await send()\n if (\n this.session &&\n (res.status === 401 || res.status === 403) &&\n this.session.expiresAt * 1000 <= Date.now() + 5_000\n ) {\n if (await this.renewSession()) res = await send()\n }\n return res\n }\n\n /** A raw request against the platform for endpoints the client does not wrap. */\n fetchRaw(path: string, init: RequestInit = {}): Promise<Response> {\n this.assertActive()\n return this.request(path, init)\n }\n\n /** Hosted-chat configuration. Resolves to an auth requirement instead of throwing on 401. */\n async getChat(identifier: string): Promise<ChatConfig | ChatAuthRequired> {\n this.assertActive()\n const res = await this.request(`/api/chat/${encodeURIComponent(identifier)}`)\n const body = await safeJson(res)\n if (res.status === 401 && body && typeof body.authRequired === 'string') {\n return body as unknown as ChatAuthRequired\n }\n if (!res.ok) {\n throw new AginiesError((body?.error as string) || `HTTP ${res.status}`, res.status)\n }\n return body as unknown as ChatConfig\n }\n\n /**\n * Sends one turn and yields the streamed events. Authentication for password / e-mail\n * chats travels in the same body on the first call; the platform then sets a cookie.\n */\n async *sendMessage(\n identifier: string,\n input: SendMessageInput,\n signal?: AbortSignal\n ): AsyncGenerator<ChatStreamEvent> {\n this.assertActive()\n const res = await this.request(`/api/chat/${encodeURIComponent(identifier)}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(input),\n signal,\n })\n if (!res.ok) {\n const body = await safeJson(res)\n if (res.status === 401 && body && typeof body.authRequired === 'string') {\n throw new AginiesError('Authentication required', 401, 'AUTH_REQUIRED')\n }\n throw new AginiesError((body?.error as string) || `HTTP ${res.status}`, res.status)\n }\n const contentType = res.headers.get('content-type') ?? ''\n if (!contentType.includes('text/event-stream')) {\n const body = await safeJson(res)\n yield { type: 'final', data: body }\n yield { type: 'done' }\n return\n }\n yield* parseSSE(res.body as ReadableStream<Uint8Array>)\n }\n}\n\n/** Parses an SSE body into chat events. Exported for tests. */\nexport async function* parseSSE(\n stream: ReadableStream<Uint8Array>\n): AsyncGenerator<ChatStreamEvent> {\n const reader = stream.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n buffer += decoder.decode(value, { stream: true })\n let sep = buffer.indexOf('\\n\\n')\n while (sep !== -1) {\n const frame = buffer.slice(0, sep)\n buffer = buffer.slice(sep + 2)\n const event = decodeFrame(frame)\n if (event) yield event\n sep = buffer.indexOf('\\n\\n')\n }\n }\n const tail = decodeFrame(buffer)\n if (tail) yield tail\n } finally {\n reader.releaseLock()\n }\n yield { type: 'done' }\n}\n\nfunction decodeFrame(frame: string): ChatStreamEvent | null {\n const line = frame.split('\\n').find((l) => l.startsWith('data:'))\n if (!line) return null\n const data = line.slice(5).trim()\n if (!data || data === '[DONE]') return null\n let json: Record<string, unknown>\n try {\n json = JSON.parse(data)\n } catch {\n return { type: 'chunk', text: data }\n }\n if (json.event === 'error') {\n return { type: 'error', message: (json.error as string) || 'Stream error' }\n }\n if (json.event === 'final') {\n return { type: 'final', data: json.data }\n }\n if (typeof json.chunk === 'string') {\n return { type: 'chunk', blockId: json.blockId as string | undefined, text: json.chunk }\n }\n return null\n}\n\nasync function safeJson(res: Response): Promise<Record<string, unknown> | null> {\n try {\n return (await res.json()) as Record<string, unknown>\n } catch {\n return null\n }\n}\n\nfunction detectLocale(): 'tr' | 'en' {\n if (typeof document !== 'undefined') {\n const lang = document.documentElement.lang?.toLowerCase() ?? ''\n if (lang.startsWith('tr')) return 'tr'\n }\n if (typeof navigator !== 'undefined' && navigator.language?.toLowerCase().startsWith('tr')) {\n return 'tr'\n }\n return 'en'\n}\n","/**\n * Human-in-the-loop approvals. A run that reaches a \"Human in the Loop\" block pauses;\n * the platform stores its state and hands out a resume link. This module reads the\n * paused execution (`GET /api/resume/:workflowId/:executionId[/:contextId]`) and resumes\n * it with the approver's input (`POST …/:contextId`), through the activated client so a\n * tenant session travels along.\n */\nimport { type AginiesClient, AginiesError } from '../client'\n\nexport type ResumeStatus = 'paused' | 'resumed' | 'failed' | 'queued' | 'resuming'\n\nexport interface ResumeQueueEntry {\n id: string\n contextId: string\n status: string\n queuedAt: string | null\n claimedAt: string | null\n completedAt: string | null\n failureReason: string | null\n newExecutionId: string\n resumeInput: unknown\n}\n\nexport interface PausePoint {\n contextId: string\n triggerBlockId: string\n /** The block's paused output; `data.inputFormat` describes the approver's form. */\n response: { data?: Record<string, unknown> } | null\n registeredAt: string\n resumeStatus: ResumeStatus\n snapshotReady: boolean\n queuePosition?: number | null\n latestResumeEntry?: ResumeQueueEntry | null\n}\n\nexport interface PausedExecution {\n id: string\n workflowId: string\n executionId: string\n status: string\n totalPauseCount: number\n resumedCount: number\n pausedAt: string | null\n updatedAt: string | null\n expiresAt: string | null\n metadata: Record<string, unknown> | null\n pausePoints: PausePoint[]\n queue?: ResumeQueueEntry[]\n}\n\nexport interface PauseContext {\n execution: PausedExecution\n pausePoint: PausePoint\n queue: ResumeQueueEntry[]\n activeResumeEntry?: ResumeQueueEntry | null\n}\n\nexport interface ResumeOutcome {\n status: 'started' | 'queued'\n executionId: string\n queuePosition?: number | null\n message?: string\n}\n\n/** One field of the approver's form, as the block author configured it. */\nexport interface ResumeField {\n id: string\n name: string\n label: string\n type: string\n description?: string\n placeholder?: string\n value?: unknown\n required: boolean\n options?: unknown[]\n rows?: number\n}\n\nconst path = (workflowId: string, executionId: string, contextId?: string) =>\n `/api/resume/${encodeURIComponent(workflowId)}/${encodeURIComponent(executionId)}${\n contextId ? `/${encodeURIComponent(contextId)}` : ''\n }`\n\nasync function readJson<T>(res: Response): Promise<T> {\n let body: unknown = null\n try {\n body = await res.json()\n } catch {\n /* not JSON */\n }\n if (!res.ok) {\n const error = (body as { error?: string } | null)?.error\n throw new AginiesError(\n error || `HTTP ${res.status}`,\n res.status,\n res.status === 404 ? 'NOT_FOUND' : res.status === 403 ? 'FORBIDDEN' : undefined\n )\n }\n return body as T\n}\n\nexport function getPausedExecution(\n client: AginiesClient,\n workflowId: string,\n executionId: string\n): Promise<PausedExecution> {\n return client.fetchRaw(path(workflowId, executionId)).then((r) => readJson<PausedExecution>(r))\n}\n\nexport function getPauseContext(\n client: AginiesClient,\n workflowId: string,\n executionId: string,\n contextId: string\n): Promise<PauseContext> {\n return client\n .fetchRaw(path(workflowId, executionId, contextId))\n .then((r) => readJson<PauseContext>(r))\n}\n\nexport function listPausedExecutions(\n client: AginiesClient,\n workflowId: string,\n status?: string\n): Promise<PausedExecution[]> {\n const query = status ? `?status=${encodeURIComponent(status)}` : ''\n return client\n .fetchRaw(`/api/workflows/${encodeURIComponent(workflowId)}/paused${query}`)\n .then((r) => readJson<{ pausedExecutions: PausedExecution[] }>(r))\n .then((b) => b.pausedExecutions ?? [])\n}\n\n/** Resumes one pause point with the approver's submission, keyed by field name. */\nexport function resumeExecution(\n client: AginiesClient,\n workflowId: string,\n executionId: string,\n contextId: string,\n submission: Record<string, unknown> | null\n): Promise<ResumeOutcome> {\n return client\n .fetchRaw(path(workflowId, executionId, contextId), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(submission ? { input: { submission } } : {}),\n })\n .then((r) => readJson<ResumeOutcome>(r))\n}\n\n/* ───────────────────────────── form helpers ───────────────────────────── */\n\n/** Reads the approver's form out of a pause point, tolerating partial definitions. */\nexport function fieldsOf(point: PausePoint | null | undefined): ResumeField[] {\n const raw = point?.response?.data?.inputFormat\n if (!Array.isArray(raw)) return []\n return raw\n .map((f, index): ResumeField | null => {\n if (!f || typeof f !== 'object') return null\n const field = f as Record<string, unknown>\n const name = typeof field.name === 'string' ? field.name.trim() : ''\n if (!name) return null\n const str = (v: unknown) => (typeof v === 'string' && v.trim() ? v.trim() : undefined)\n return {\n id: str(field.id) ?? `field_${index}`,\n name,\n label: str(field.label) ?? name,\n type: str(field.type) ?? 'string',\n description: str(field.description),\n placeholder: str(field.placeholder),\n value: field.value,\n required: field.required === true,\n options: Array.isArray(field.options) ? field.options : undefined,\n rows: typeof field.rows === 'number' ? field.rows : undefined,\n }\n })\n .filter((f): f is ResumeField => f !== null)\n}\n\n/** The paused output shown to the approver: everything in `data` except form plumbing. */\nexport function outputOf(point: PausePoint | null | undefined): Record<string, unknown> {\n const data = point?.response?.data\n if (!data || typeof data !== 'object') return {}\n const { inputFormat: _f, resumeLinks: _l, ...rest } = data as Record<string, unknown>\n return rest\n}\n\n/** Formats a stored value for an input of this field's type. */\nexport function formatFieldValue(field: ResumeField, value: unknown): string {\n if (value === undefined || value === null) return ''\n switch (field.type) {\n case 'boolean':\n if (typeof value === 'boolean') return value ? 'true' : 'false'\n if (typeof value === 'string' && ['true', 'false'].includes(value.trim().toLowerCase()))\n return value.trim().toLowerCase()\n return ''\n case 'number':\n return typeof value === 'number'\n ? Number.isFinite(value)\n ? String(value)\n : ''\n : String(value)\n case 'array':\n case 'object':\n case 'files':\n if (typeof value === 'string') return value\n try {\n return JSON.stringify(value, null, 2)\n } catch {\n return ''\n }\n default:\n return typeof value === 'string' ? value : JSON.stringify(value)\n }\n}\n\n/** Parses an input's text back into the field's type; `error` names what went wrong. */\nexport function parseFieldValue(\n field: ResumeField,\n raw: string\n): { value?: unknown; error?: 'number' | 'json' } {\n const text = raw.trim()\n switch (field.type) {\n case 'boolean':\n return { value: text === 'true' }\n case 'number': {\n const n = Number(text)\n return Number.isFinite(n) ? { value: n } : { error: 'number' }\n }\n case 'array':\n case 'object':\n case 'files':\n try {\n return { value: JSON.parse(text) }\n } catch {\n return { error: 'json' }\n }\n default:\n return { value: raw }\n }\n}\n\n/** Initial input text per field, from the block's defaults. */\nexport function initialValues(fields: ResumeField[]): Record<string, string> {\n return Object.fromEntries(fields.map((f) => [f.name, formatFieldValue(f, f.value)]))\n}\n\n/**\n * Builds the submission from the inputs, or reports the fields that are missing or\n * malformed. Empty optional fields are left out of the submission.\n */\nexport function buildSubmission(\n fields: ResumeField[],\n values: Record<string, string>\n): { submission: Record<string, unknown>; errors: Record<string, 'required' | 'number' | 'json'> } {\n const submission: Record<string, unknown> = {}\n const errors: Record<string, 'required' | 'number' | 'json'> = {}\n for (const field of fields) {\n const raw = values[field.name] ?? ''\n const present = field.type === 'boolean' ? raw === 'true' || raw === 'false' : raw.trim() !== ''\n if (!present) {\n if (field.required) errors[field.name] = 'required'\n continue\n }\n const { value, error } = parseFieldValue(field, raw)\n if (error) errors[field.name] = error\n else if (value !== undefined) submission[field.name] = value\n }\n return { submission, errors }\n}\n","const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '"';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '<';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\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\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 = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\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: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n","import type {\n ButtonHTMLAttributes,\n HTMLAttributes,\n InputHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react'\nimport { forwardRef } from 'react'\n\n/** Joins class names, dropping falsy entries. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ')\n}\n\n/* ───────────────────────────── Button ───────────────────────────── */\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** `primary` is the text fill, `signal` the accent fill, `outline` the quiet default. */\n variant?: 'primary' | 'signal' | 'outline' | 'ghost' | 'destructive'\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { variant = 'outline', size = 'md', className, type = 'button', ...props },\n ref\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={cx('agi-btn', `agi-btn--${variant}`, `agi-btn--${size}`, className)}\n {...props}\n />\n )\n})\n\n/* ───────────────────────────── Tag / Chip ───────────────────────────── */\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n tone?: 'default' | 'signal' | 'ok' | 'warn' | 'bad'\n}\n\nexport function Tag({ tone = 'default', className, ...props }: TagProps) {\n return (\n <span\n className={cx('agi-tag', tone !== 'default' && `agi-tag--${tone}`, className)}\n {...props}\n />\n )\n}\n\nexport interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n pressed?: boolean\n}\n\nexport function Chip({ pressed = false, className, type = 'button', ...props }: ChipProps) {\n return (\n <button type={type} aria-pressed={pressed} className={cx('agi-chip', className)} {...props} />\n )\n}\n\n/* ───────────────────────────── Surfaces ───────────────────────────── */\n\nexport interface PanelProps extends HTMLAttributes<HTMLDivElement> {\n level?: 1 | 2\n}\n\nexport function Panel({ level = 1, className, ...props }: PanelProps) {\n return <div className={cx('agi-panel', level === 2 && 'agi-panel--2', className)} {...props} />\n}\n\n/* ───────────────────────────── Type ───────────────────────────── */\n\nexport function Eyebrow({\n className,\n quiet,\n ...props\n}: HTMLAttributes<HTMLParagraphElement> & { quiet?: boolean }) {\n return <p className={cx('agi-eyebrow', quiet && 'agi-eyebrow--quiet', className)} {...props} />\n}\n\nexport interface StatProps extends HTMLAttributes<HTMLDivElement> {\n value: string\n label: string\n}\n\nexport function Stat({ value, label, className, ...props }: StatProps) {\n return (\n <div className={cx('agi-stat', className)} {...props}>\n <div className='agi-stat__v'>{value}</div>\n <div className='agi-stat__k'>{label}</div>\n </div>\n )\n}\n\n/* ───────────────────────────── Fields ───────────────────────────── */\n\nexport interface FieldProps extends HTMLAttributes<HTMLLabelElement> {\n label: string\n htmlFor?: string\n /** Help text under the control; replaced by `error` when one is set. */\n hint?: string\n error?: string\n}\n\nexport function Field({ label, hint, error, className, children, ...props }: FieldProps) {\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: the control is passed as children\n <label className={cx('agi-field', className)} {...props}>\n <span className='agi-field__label'>{label}</span>\n {children}\n {error ? (\n <span className='agi-field__error'>{error}</span>\n ) : (\n hint && <span className='agi-field__hint'>{hint}</span>\n )}\n </label>\n )\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>>(\n function Input({ className, ...props }, ref) {\n return <input ref={ref} className={cx('agi-input', className)} {...props} />\n }\n)\n\nexport const Textarea = forwardRef<\n HTMLTextAreaElement,\n TextareaHTMLAttributes<HTMLTextAreaElement>\n>(function Textarea({ className, ...props }, ref) {\n return <textarea ref={ref} className={cx('agi-input', 'agi-textarea', className)} {...props} />\n})\n\n/* ───────────────────────────── Feedback ───────────────────────────── */\n\nexport function Spinner({ className, label }: { className?: string; label?: string }) {\n return (\n <output className={cx('agi-spinner', className)} aria-label={label}>\n <span />\n <span />\n <span />\n </output>\n )\n}\n","export type Locale = 'tr' | 'en'\n\nconst STRINGS = {\n chat: {\n open: { tr: 'Sohbeti aç', en: 'Open chat' },\n close: { tr: 'Kapat', en: 'Close' },\n placeholder: { tr: 'Mesajınızı yazın…', en: 'Type your message…' },\n send: { tr: 'Gönder', en: 'Send' },\n stop: { tr: 'Durdur', en: 'Stop' },\n attach: { tr: 'Dosya ekle', en: 'Attach file' },\n attachments: { tr: 'Ekler', en: 'Attachments' },\n removeFile: { tr: 'Dosyayı kaldır', en: 'Remove file' },\n tooManyFiles: { tr: 'En fazla 5 dosya ekleyebilirsiniz.', en: 'You can attach up to 5 files.' },\n fileTooLarge: {\n tr: \"Dosyalar 10 MB'tan küçük olmalı.\",\n en: 'Files must be smaller than 10 MB.',\n },\n welcome: {\n tr: 'Merhaba! Size nasıl yardımcı olabilirim?',\n en: 'Hi there! How can I help you today?',\n },\n thinking: { tr: 'Yanıt hazırlanıyor', en: 'Working on it' },\n stopped: { tr: 'Yanıt durduruldu.', en: 'Response stopped.' },\n error: {\n tr: 'Bir sorun oluştu. Lütfen tekrar deneyin.',\n en: 'Something went wrong. Please try again.',\n },\n unavailable: {\n tr: 'Bu sohbet şu anda kullanılamıyor.',\n en: 'This chat is currently unavailable.',\n },\n poweredBy: { tr: 'Aginies ile', en: 'Powered by Aginies' },\n you: { tr: 'Siz', en: 'You' },\n assistant: { tr: 'Ajan', en: 'Agent' },\n },\n auth: {\n passwordTitle: { tr: 'Bu sohbet parola korumalı', en: 'This chat is password protected' },\n passwordHint: { tr: 'Devam etmek için parolayı girin.', en: 'Enter the password to continue.' },\n password: { tr: 'Parola', en: 'Password' },\n emailTitle: { tr: 'E-posta ile doğrulama', en: 'Verify with your e-mail' },\n emailHint: {\n tr: 'İş e-postanızı girin; size bir kod göndereceğiz.',\n en: 'Enter your work e-mail; we will send you a code.',\n },\n email: { tr: 'E-posta', en: 'E-mail' },\n code: { tr: 'Doğrulama kodu', en: 'Verification code' },\n codeHint: {\n tr: 'E-postanıza gelen 6 haneli kodu girin.',\n en: 'Enter the 6-digit code from your e-mail.',\n },\n continue: { tr: 'Devam et', en: 'Continue' },\n sendCode: { tr: 'Kod gönder', en: 'Send code' },\n verify: { tr: 'Doğrula', en: 'Verify' },\n back: { tr: 'Geri', en: 'Back' },\n invalidPassword: { tr: 'Parola yanlış.', en: 'Wrong password.' },\n invalidEmail: {\n tr: 'Bu e-posta adresi yetkili değil.',\n en: 'This e-mail address is not allowed.',\n },\n invalidCode: {\n tr: 'Kod geçersiz veya süresi dolmuş.',\n en: 'The code is invalid or has expired.',\n },\n codeSent: { tr: 'Kod gönderildi.', en: 'Code sent.' },\n codeError: {\n tr: 'Kod gönderilemedi. Lütfen tekrar deneyin.',\n en: 'The code could not be sent. Please try again.',\n },\n resend: { tr: 'Kodu yeniden gönder', en: 'Resend code' },\n ssoTitle: { tr: 'Kurumsal giriş gerekli', en: 'Sign in with your organisation' },\n ssoHint: {\n tr: 'Bu sohbet kurumsal kimlikle açılır.',\n en: 'This chat opens with your organisation account.',\n },\n ssoButton: { tr: 'Kurumsal giriş', en: 'Sign in' },\n },\n run: {\n submit: { tr: 'Çalıştır', en: 'Run' },\n cancel: { tr: 'İptal', en: 'Cancel' },\n running: { tr: 'Çalışıyor', en: 'Running' },\n done: { tr: 'Tamamlandı', en: 'Completed' },\n error: { tr: 'Hata', en: 'Error' },\n failed: { tr: 'Çalıştırma başarısız oldu.', en: 'The run failed.' },\n unauthorized: { tr: 'API anahtarı reddedildi.', en: 'The API key was rejected.' },\n steps: { tr: 'Adımlar', en: 'Steps' },\n execution: { tr: 'çalıştırma', en: 'execution' },\n },\n approval: {\n eyebrow: { tr: 'İnsan onayı', en: 'Human approval' },\n title: { tr: 'Onay bekleyen adım', en: 'A step is waiting for approval' },\n execution: { tr: 'çalıştırma', en: 'execution' },\n pausedAt: { tr: 'duraklatıldı', en: 'paused' },\n points: { tr: 'Onay noktaları', en: 'Approval points' },\n point: { tr: 'Nokta', en: 'Point' },\n output: { tr: 'Ajanın önerisi', en: 'What the agent proposes' },\n queuePosition: { tr: 'Sıra', en: 'Queue position' },\n submit: { tr: 'Onayla ve devam et', en: 'Approve and continue' },\n submitting: { tr: 'Gönderiliyor', en: 'Submitting' },\n refresh: { tr: 'Yenile', en: 'Refresh' },\n required: { tr: 'Bu alan zorunlu.', en: 'This field is required.' },\n notANumber: { tr: 'Sayı girin.', en: 'Enter a number.' },\n notJson: { tr: 'Geçerli JSON girin.', en: 'Enter valid JSON.' },\n notFound: {\n tr: 'Bu onay bulunamadı; süresi dolmuş veya tamamlanmış olabilir.',\n en: 'This approval could not be found; it may have expired or been completed.',\n },\n loadError: { tr: 'Onay yüklenemedi.', en: 'The approval could not be loaded.' },\n resumeError: { tr: 'Devam ettirilemedi.', en: 'The run could not be resumed.' },\n resumedMessage: {\n tr: 'Ajan kaldığı yerden devam ediyor.',\n en: 'The agent is continuing from where it paused.',\n },\n queuedMessage: {\n tr: 'Onay sıraya alındı; önceki devam işlemleri bitince çalışacak.',\n en: 'The approval is queued; it runs after the earlier resumes finish.',\n },\n paused: { tr: 'Onay bekliyor', en: 'Awaiting approval' },\n queued: { tr: 'Sırada', en: 'Queued' },\n resuming: { tr: 'Devam ediyor', en: 'Resuming' },\n resumed: { tr: 'Devam etti', en: 'Resumed' },\n failed: { tr: 'Başarısız', en: 'Failed' },\n },\n common: {\n loading: { tr: 'Yükleniyor', en: 'Loading' },\n retry: { tr: 'Tekrar dene', en: 'Retry' },\n notActivated: {\n tr: 'Aginies UI paketi etkinleştirilmedi.',\n en: 'The Aginies UI package is not activated.',\n },\n },\n} as const\n\ntype Section = keyof typeof STRINGS\ntype Key<S extends Section> = keyof (typeof STRINGS)[S]\n\n/** Returns a translator bound to a locale: `t('chat', 'send')`. */\nexport function translator(locale: Locale) {\n return function t<S extends Section>(section: S, key: Key<S>): string {\n const entry = STRINGS[section][key] as { tr: string; en: string }\n return entry[locale] ?? entry.en\n }\n}\n\nexport type Translator = ReturnType<typeof translator>\n","import { createContext, type ReactNode, useContext, useEffect, useMemo, useState } from 'react'\nimport { type ActivationState, AginiesClient, type AginiesConfig } from './client'\nimport { type Locale, type Translator, translator } from './i18n'\n\nlet defaultClient: AginiesClient | null = null\n\n/**\n * Creates the shared client and starts the activation handshake. Call it once, before\n * rendering any widget; `AginiesProvider` picks the client up automatically.\n */\nexport function init(config: AginiesConfig): AginiesClient {\n defaultClient = new AginiesClient(config)\n void defaultClient.activate()\n return defaultClient\n}\n\n/** The client created by `init()`, if any. */\nexport function getClient(): AginiesClient | null {\n return defaultClient\n}\n\nexport interface AginiesContextValue {\n client: AginiesClient\n state: ActivationState\n locale: Locale\n t: Translator\n}\n\nconst AginiesContext = createContext<AginiesContextValue | null>(null)\n\n/**\n * Whether the activation unlocks `module` (`chat`, `run`, `observability`, `approval`).\n * A widget whose module is locked renders nothing and warns once.\n */\nexport function useModule(module: string): boolean {\n const { client } = useAginies()\n const allowed = client.hasModule(module)\n useEffect(() => {\n if (!allowed && typeof console !== 'undefined') {\n console.warn(`[aginies] the \"${module}\" module is not enabled for this activation key`)\n }\n }, [allowed, module])\n return allowed\n}\n\nexport interface AginiesProviderProps {\n /** A client from `init()` or `new AginiesClient()`. Defaults to the one `init()` made. */\n client?: AginiesClient\n /** Override the client's locale for this subtree. */\n locale?: Locale\n /** Rendered while the activation handshake runs. Defaults to nothing. */\n fallback?: ReactNode\n children: ReactNode\n}\n\n/**\n * Provides the activated client to every widget below it. Children render only once the\n * activation succeeds; a rejected activation renders nothing and logs one warning, so a\n * page with a wrong or missing token degrades to plain content.\n */\nexport function AginiesProvider({\n client,\n locale,\n fallback = null,\n children,\n}: AginiesProviderProps) {\n const resolved = client ?? defaultClient\n const [state, setState] = useState<ActivationState>(\n resolved?.getState() ?? { status: 'rejected', reason: 'init() was not called' }\n )\n\n useEffect(() => {\n if (!resolved) return\n setState(resolved.getState())\n const unsubscribe = resolved.subscribe(setState)\n void resolved.activate()\n return unsubscribe\n }, [resolved])\n\n useEffect(() => {\n if (state.status === 'rejected' && typeof console !== 'undefined') {\n console.warn(`[aginies] UI kit not activated: ${state.reason}`)\n }\n }, [state])\n\n const value = useMemo<AginiesContextValue | null>(() => {\n if (!resolved) return null\n const l = locale ?? resolved.locale\n return { client: resolved, state, locale: l, t: translator(l) }\n }, [resolved, state, locale])\n\n if (!value) return null\n if (state.status === 'idle' || state.status === 'activating') return <>{fallback}</>\n if (state.status === 'rejected') return null\n return <AginiesContext.Provider value={value}>{children}</AginiesContext.Provider>\n}\n\n/** Access to the activated client, its configuration and the translator. */\nexport function useAginies(): AginiesContextValue {\n const ctx = useContext(AginiesContext)\n if (!ctx) {\n throw new Error('[aginies] useAginies must be used inside <AginiesProvider> after init()')\n }\n return ctx\n}\n","import { type FormEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { AginiesError } from '../client'\nimport { Button, cx, Eyebrow, Field, Input, Panel, Spinner, Tag, Textarea } from '../core'\nimport { useAginies, useModule } from '../provider'\nimport {\n buildSubmission,\n fieldsOf,\n getPausedExecution,\n initialValues,\n outputOf,\n type PausedExecution,\n type PausePoint,\n type ResumeField,\n type ResumeOutcome,\n resumeExecution,\n} from './approval-client'\n\nexport type ApprovalStatus =\n | 'loading'\n | 'ready'\n | 'submitting'\n | 'resumed'\n | 'queued'\n | 'not-found'\n | 'error'\n\n/**\n * State for one paused run: which pause point is selected, the approver's form, the\n * outcome of resuming. `ApprovalPanel` renders it; use the hook for a custom UI.\n */\nexport function useApproval(workflowId: string, executionId: string, contextId?: string) {\n const { client, t } = useAginies()\n const [status, setStatus] = useState<ApprovalStatus>('loading')\n const [execution, setExecution] = useState<PausedExecution | null>(null)\n const [selected, setSelected] = useState<string | null>(contextId ?? null)\n const [values, setValues] = useState<Record<string, string>>({})\n const [errors, setErrors] = useState<Record<string, string>>({})\n const [error, setError] = useState<string | null>(null)\n const [outcome, setOutcome] = useState<ResumeOutcome | null>(null)\n const selectedRef = useRef<string | null>(contextId ?? null)\n\n const pausePoint: PausePoint | null = useMemo(() => {\n if (!execution) return null\n return (\n execution.pausePoints.find((p) => p.contextId === selected) ??\n execution.pausePoints.find((p) => p.resumeStatus === 'paused') ??\n execution.pausePoints[0] ??\n null\n )\n }, [execution, selected])\n\n const fields: ResumeField[] = useMemo(() => fieldsOf(pausePoint), [pausePoint])\n\n const load = useCallback(async () => {\n setStatus('loading')\n setError(null)\n try {\n const detail = await getPausedExecution(client, workflowId, executionId)\n setExecution(detail)\n const wanted = contextId ?? selectedRef.current\n const point =\n detail.pausePoints.find((p) => p.contextId === wanted) ??\n detail.pausePoints.find((p) => p.resumeStatus === 'paused') ??\n detail.pausePoints[0]\n if (point) {\n selectedRef.current = point.contextId\n setSelected(point.contextId)\n setValues(initialValues(fieldsOf(point)))\n }\n setErrors({})\n setStatus('ready')\n } catch (err) {\n if (err instanceof AginiesError && err.code === 'NOT_FOUND') setStatus('not-found')\n else {\n setError(err instanceof Error ? err.message : t('approval', 'loadError'))\n setStatus('error')\n }\n }\n }, [client, workflowId, executionId, contextId, t])\n\n useEffect(() => {\n void load()\n }, [load])\n\n const select = useCallback(\n (nextContextId: string) => {\n selectedRef.current = nextContextId\n setSelected(nextContextId)\n const point = execution?.pausePoints.find((p) => p.contextId === nextContextId)\n setValues(initialValues(fieldsOf(point)))\n setErrors({})\n },\n [execution]\n )\n\n const setValue = useCallback((name: string, value: string) => {\n setValues((v) => ({ ...v, [name]: value }))\n setErrors((e) => {\n if (!(name in e)) return e\n const { [name]: _drop, ...rest } = e\n return rest\n })\n }, [])\n\n const submit = useCallback(async () => {\n if (!pausePoint || status === 'submitting') return\n const { submission, errors: problems } = buildSubmission(fields, values)\n if (Object.keys(problems).length > 0) {\n setErrors(\n Object.fromEntries(\n Object.entries(problems).map(([k, v]) => [\n k,\n v === 'required'\n ? t('approval', 'required')\n : v === 'number'\n ? t('approval', 'notANumber')\n : t('approval', 'notJson'),\n ])\n )\n )\n return\n }\n setStatus('submitting')\n setError(null)\n try {\n const result = await resumeExecution(\n client,\n workflowId,\n executionId,\n pausePoint.contextId,\n fields.length > 0 ? submission : null\n )\n setOutcome(result)\n setStatus(result.status === 'queued' ? 'queued' : 'resumed')\n } catch (err) {\n setError(err instanceof Error ? err.message : t('approval', 'resumeError'))\n setStatus('ready')\n }\n }, [client, workflowId, executionId, pausePoint, fields, values, status, t])\n\n return {\n status,\n execution,\n pausePoint,\n fields,\n values,\n errors,\n error,\n outcome,\n select,\n setValue,\n submit,\n reload: load,\n }\n}\n\n/* ───────────────────────────── component ───────────────────────────── */\n\nexport interface ApprovalPanelProps {\n /** Id of the agent (workflow) whose run is paused. */\n workflowId: string\n /** The paused execution, from the resume link the approver received. */\n executionId: string\n /** A specific pause point; defaults to the first one still paused. */\n contextId?: string\n title?: string\n description?: string\n /** Label of the resume button; defaults to \"Approve and continue\". */\n submitLabel?: string\n /** Called after the platform accepted the resume. */\n onResumed?: (outcome: ResumeOutcome) => void\n /** Hide the paused output block. */\n hideOutput?: boolean\n className?: string\n}\n\nconst STATUS_TONE: Record<string, 'default' | 'ok' | 'warn' | 'bad' | 'signal'> = {\n paused: 'warn',\n queued: 'signal',\n resuming: 'signal',\n resumed: 'ok',\n failed: 'bad',\n}\n\nexport function ApprovalPanel({\n workflowId,\n executionId,\n contextId,\n title,\n description,\n submitLabel,\n onResumed,\n hideOutput = false,\n className,\n}: ApprovalPanelProps) {\n const { t, locale } = useAginies()\n const enabled = useModule('approval')\n const a = useApproval(workflowId, executionId, contextId)\n const onResumedRef = useRef(onResumed)\n onResumedRef.current = onResumed\n\n useEffect(() => {\n if ((a.status === 'resumed' || a.status === 'queued') && a.outcome) {\n onResumedRef.current?.(a.outcome)\n }\n }, [a.status, a.outcome])\n\n if (!enabled) return null\n\n const point = a.pausePoint\n const output = hideOutput ? {} : outputOf(point)\n const outputEntries = Object.entries(output)\n const canSubmit = point?.resumeStatus === 'paused' && a.status === 'ready'\n const fmt = (iso: string | null | undefined) =>\n iso ? new Date(iso).toLocaleString(locale === 'tr' ? 'tr-TR' : 'en-GB') : ''\n\n const onSubmit = (e: FormEvent) => {\n e.preventDefault()\n void a.submit()\n }\n\n return (\n <Panel className={cx('agi-approval', className)} aria-busy={a.status === 'loading'}>\n <header className='agi-approval__head'>\n <Eyebrow>{t('approval', 'eyebrow')}</Eyebrow>\n <h3 className='agi-approval__title'>{title ?? t('approval', 'title')}</h3>\n {description && <p className='agi-approval__desc'>{description}</p>}\n {a.execution && (\n <p className='agi-approval__meta'>\n {t('approval', 'execution')}{' '}\n <span className='agi-approval__meta-value'>{a.execution.executionId.slice(0, 8)}</span>\n {a.execution.pausedAt && (\n <>\n {' · '}\n {t('approval', 'pausedAt')} {fmt(a.execution.pausedAt)}\n </>\n )}\n </p>\n )}\n </header>\n\n {a.status === 'loading' && (\n <div className='agi-approval__state'>\n <Spinner label={t('common', 'loading')} /> {t('common', 'loading')}\n </div>\n )}\n\n {a.status === 'not-found' && (\n <div className='agi-approval__state'>\n <p>{t('approval', 'notFound')}</p>\n </div>\n )}\n\n {a.status === 'error' && (\n <div className='agi-approval__state'>\n <p className='agi-approval__error'>{a.error}</p>\n <Button variant='outline' size='sm' onClick={() => void a.reload()}>\n {t('common', 'retry')}\n </Button>\n </div>\n )}\n\n {a.execution && a.execution.pausePoints.length > 1 && (\n <nav className='agi-approval__points' aria-label={t('approval', 'points')}>\n {a.execution.pausePoints.map((p, i) => (\n <button\n type='button'\n key={p.contextId}\n className={cx(\n 'agi-approval__point',\n p.contextId === point?.contextId && 'is-selected'\n )}\n onClick={() => a.select(p.contextId)}\n >\n <span>\n {t('approval', 'point')} {i + 1}\n </span>\n <Tag tone={STATUS_TONE[p.resumeStatus] ?? 'default'}>\n {t('approval', p.resumeStatus)}\n </Tag>\n </button>\n ))}\n </nav>\n )}\n\n {point && a.status !== 'loading' && (\n <>\n <div className='agi-approval__status'>\n <Tag tone={STATUS_TONE[point.resumeStatus] ?? 'default'}>\n {t('approval', point.resumeStatus)}\n </Tag>\n {typeof point.queuePosition === 'number' && point.queuePosition > 0 && (\n <span className='agi-approval__queue'>\n {t('approval', 'queuePosition')} {point.queuePosition}\n </span>\n )}\n </div>\n\n {outputEntries.length > 0 && (\n <section className='agi-approval__output' aria-label={t('approval', 'output')}>\n <div className='agi-approval__output-label'>{t('approval', 'output')}</div>\n <dl className='agi-approval__kv'>\n {outputEntries.map(([k, v]) => (\n <div key={k} className='agi-approval__kv-row'>\n <dt>{k}</dt>\n <dd>{typeof v === 'string' ? v : JSON.stringify(v, null, 2)}</dd>\n </div>\n ))}\n </dl>\n </section>\n )}\n\n {(a.status === 'resumed' || a.status === 'queued') && a.outcome ? (\n <output className='agi-approval__done'>\n <Tag tone={a.status === 'queued' ? 'signal' : 'ok'}>\n {t('approval', a.status === 'queued' ? 'queued' : 'resumed')}\n </Tag>\n <p>\n {a.status === 'queued'\n ? t('approval', 'queuedMessage')\n : t('approval', 'resumedMessage')}\n </p>\n </output>\n ) : (\n <form className='agi-approval__form' onSubmit={onSubmit}>\n {a.fields.map((f) => (\n <Field key={f.id} label={f.label} hint={f.description} error={a.errors[f.name]}>\n {renderField(f, a.values[f.name] ?? '', (v) => a.setValue(f.name, v), !canSubmit)}\n </Field>\n ))}\n {a.error && <p className='agi-approval__error'>{a.error}</p>}\n <div className='agi-approval__actions'>\n <Button variant='signal' type='submit' disabled={!canSubmit}>\n {a.status === 'submitting' ? (\n <>\n <Spinner label={t('approval', 'submitting')} /> {t('approval', 'submitting')}\n </>\n ) : (\n (submitLabel ?? t('approval', 'submit'))\n )}\n </Button>\n <Button\n variant='outline'\n type='button'\n onClick={() => void a.reload()}\n disabled={a.status === 'submitting'}\n >\n {t('approval', 'refresh')}\n </Button>\n </div>\n </form>\n )}\n </>\n )}\n </Panel>\n )\n}\n\nfunction renderField(f: ResumeField, value: string, set: (v: string) => void, disabled: boolean) {\n switch (f.type) {\n case 'boolean':\n return (\n <select\n className='agi-input'\n value={value}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n >\n <option value=''>—</option>\n <option value='true'>true</option>\n <option value='false'>false</option>\n </select>\n )\n case 'number':\n return (\n <Input\n type='number'\n value={value}\n placeholder={f.placeholder}\n required={f.required}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n />\n )\n case 'array':\n case 'object':\n case 'files':\n return (\n <Textarea\n value={value}\n rows={f.rows ?? 4}\n placeholder={f.placeholder ?? '{ }'}\n required={f.required}\n disabled={disabled}\n className='agi-approval__json'\n onChange={(e) => set(e.target.value)}\n />\n )\n default:\n if (Array.isArray(f.options) && f.options.length > 0) {\n return (\n <select\n className='agi-input'\n value={value}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n >\n <option value=''>—</option>\n {f.options.map((o) => {\n const opt =\n typeof o === 'object' && o !== null\n ? (o as { value?: unknown; label?: unknown })\n : { value: o, label: o }\n const v = String(opt.value ?? '')\n return (\n <option key={v} value={v}>\n {String(opt.label ?? v)}\n </option>\n )\n })}\n </select>\n )\n }\n if ((f.rows ?? 1) > 1) {\n return (\n <Textarea\n value={value}\n rows={f.rows}\n placeholder={f.placeholder}\n required={f.required}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n />\n )\n }\n return (\n <Input\n value={value}\n placeholder={f.placeholder}\n required={f.required}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n />\n )\n }\n}\n","import { Fragment, type ReactNode } from 'react'\n\n/**\n * Small Markdown renderer for agent replies. It builds React elements directly, so nothing\n * from the model reaches the DOM as HTML. Covers what agents actually write: paragraphs,\n * headings, emphasis, inline and fenced code, links, lists, blockquotes, tables and rules.\n */\nexport function Markdown({ text, className }: { text: string; className?: string }) {\n return <div className={className}>{renderBlocks(parseBlocks(text))}</div>\n}\n\n/* ───────────────────────────── blocks ───────────────────────────── */\n\ntype Block =\n | { kind: 'paragraph'; lines: string[] }\n | { kind: 'heading'; level: number; text: string }\n | { kind: 'code'; lang: string; code: string }\n | { kind: 'quote'; blocks: Block[] }\n | { kind: 'list'; ordered: boolean; start: number; items: string[] }\n | {\n kind: 'table'\n header: string[]\n align: Array<'left' | 'center' | 'right' | null>\n rows: string[][]\n }\n | { kind: 'rule' }\n\nconst FENCE = /^\\s*(`{3,}|~{3,})\\s*([\\w+-]*)\\s*$/\nconst HEADING = /^(#{1,6})\\s+(.*?)\\s*#*\\s*$/\nconst RULE = /^\\s*([-*_])(?:\\s*\\1){2,}\\s*$/\nconst QUOTE = /^\\s*>\\s?(.*)$/\nconst LIST = /^\\s*(?:([-*+])|(\\d{1,9})[.)])\\s+(.*)$/\nconst TABLE_SEPARATOR = /^\\s*\\|?\\s*:?-+:?\\s*(\\|\\s*:?-+:?\\s*)*\\|?\\s*$/\n\nexport function parseBlocks(text: string): Block[] {\n const lines = text.replace(/\\r\\n?/g, '\\n').split('\\n')\n const blocks: Block[] = []\n let i = 0\n let paragraph: string[] = []\n\n const flush = () => {\n if (paragraph.length > 0) {\n blocks.push({ kind: 'paragraph', lines: paragraph })\n paragraph = []\n }\n }\n\n while (i < lines.length) {\n const line = lines[i] as string\n\n if (line.trim() === '') {\n flush()\n i += 1\n continue\n }\n\n const fence = FENCE.exec(line)\n if (fence) {\n flush()\n const marker = fence[1] as string\n const lang = fence[2] ?? ''\n const code: string[] = []\n i += 1\n while (i < lines.length && !(lines[i] as string).trim().startsWith(marker)) {\n code.push(lines[i] as string)\n i += 1\n }\n i += 1\n blocks.push({ kind: 'code', lang, code: code.join('\\n') })\n continue\n }\n\n const heading = HEADING.exec(line)\n if (heading) {\n flush()\n blocks.push({ kind: 'heading', level: (heading[1] as string).length, text: heading[2] ?? '' })\n i += 1\n continue\n }\n\n if (RULE.test(line)) {\n flush()\n blocks.push({ kind: 'rule' })\n i += 1\n continue\n }\n\n if (QUOTE.test(line)) {\n flush()\n const inner: string[] = []\n while (i < lines.length && QUOTE.test(lines[i] as string)) {\n inner.push((QUOTE.exec(lines[i] as string) as RegExpExecArray)[1] ?? '')\n i += 1\n }\n blocks.push({ kind: 'quote', blocks: parseBlocks(inner.join('\\n')) })\n continue\n }\n\n const list = LIST.exec(line)\n if (list) {\n flush()\n const ordered = list[2] !== undefined\n const start = ordered ? Number.parseInt(list[2] as string, 10) : 1\n const items: string[] = []\n while (i < lines.length) {\n const m = LIST.exec(lines[i] as string)\n if (m && (m[2] !== undefined) === ordered) {\n items.push(m[3] ?? '')\n i += 1\n } else if (\n items.length > 0 &&\n (lines[i] as string).trim() !== '' &&\n /^\\s{2,}/.test(lines[i] as string) &&\n !LIST.test(lines[i] as string)\n ) {\n // A continuation line indented under the previous item.\n items[items.length - 1] = `${items[items.length - 1]} ${(lines[i] as string).trim()}`\n i += 1\n } else {\n break\n }\n }\n blocks.push({ kind: 'list', ordered, start, items })\n continue\n }\n\n if (\n line.includes('|') &&\n i + 1 < lines.length &&\n TABLE_SEPARATOR.test(lines[i + 1] as string)\n ) {\n flush()\n const header = splitRow(line)\n const align = splitRow(lines[i + 1] as string).map((cell) => {\n const left = cell.startsWith(':')\n const right = cell.endsWith(':')\n if (left && right) return 'center'\n if (right) return 'right'\n if (left) return 'left'\n return null\n })\n const rows: string[][] = []\n i += 2\n while (i < lines.length && (lines[i] as string).includes('|')) {\n rows.push(splitRow(lines[i] as string))\n i += 1\n }\n blocks.push({ kind: 'table', header, align, rows })\n continue\n }\n\n paragraph.push(line)\n i += 1\n }\n flush()\n return blocks\n}\n\nfunction splitRow(line: string): string[] {\n const trimmed = line.trim().replace(/^\\|/, '').replace(/\\|$/, '')\n return trimmed.split(/(?<!\\\\)\\|/).map((cell) => cell.replace(/\\\\\\|/g, '|').trim())\n}\n\nfunction renderBlocks(blocks: Block[]): ReactNode[] {\n return blocks.map((block, index) => {\n switch (block.kind) {\n case 'paragraph':\n return (\n <p key={index}>\n {block.lines.map((line, n) => (\n <Fragment key={n}>\n {n > 0 && <br />}\n {renderInline(line)}\n </Fragment>\n ))}\n </p>\n )\n case 'heading': {\n const Tag = `h${Math.min(block.level + 2, 6)}` as 'h3' | 'h4' | 'h5' | 'h6'\n return <Tag key={index}>{renderInline(block.text)}</Tag>\n }\n case 'code':\n return (\n <pre key={index} data-lang={block.lang || undefined}>\n <code>{block.code}</code>\n </pre>\n )\n case 'quote':\n return <blockquote key={index}>{renderBlocks(block.blocks)}</blockquote>\n case 'list': {\n const items = block.items.map((item, n) => <li key={n}>{renderInline(item)}</li>)\n return block.ordered ? (\n <ol key={index} start={block.start === 1 ? undefined : block.start}>\n {items}\n </ol>\n ) : (\n <ul key={index}>{items}</ul>\n )\n }\n case 'table':\n return (\n <div key={index} className='agi-md__table'>\n <table>\n <thead>\n <tr>\n {block.header.map((cell, n) => (\n <th key={n} style={alignStyle(block.align[n])}>\n {renderInline(cell)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {block.rows.map((row, r) => (\n <tr key={r}>\n {block.header.map((_, n) => (\n <td key={n} style={alignStyle(block.align[n])}>\n {renderInline(row[n] ?? '')}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n case 'rule':\n return <hr key={index} />\n }\n })\n}\n\nfunction alignStyle(align: 'left' | 'center' | 'right' | null | undefined) {\n return align ? { textAlign: align } : undefined\n}\n\n/* ───────────────────────────── inline ───────────────────────────── */\n\nconst INLINE =\n /(`+)([\\s\\S]*?)\\1|\\*\\*([\\s\\S]+?)\\*\\*|(?<![\\w`])__([\\s\\S]+?)__(?![\\w])|~~([\\s\\S]+?)~~|\\*([^*\\n]+?)\\*|(?<![\\w`])_([^_\\n]+?)_(?![\\w])|\\[([^\\]]+)\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)|(https?:\\/\\/[^\\s<]*[^\\s<.,;:!?)\\]'\"])/g\n\nexport function renderInline(text: string): ReactNode[] {\n const nodes: ReactNode[] = []\n let last = 0\n let key = 0\n // A fresh instance per call: the function recurses for nested emphasis, and a shared\n // global regex would have its lastIndex reset by the inner call.\n const inline = new RegExp(INLINE.source, 'g')\n let match = inline.exec(text)\n while (match) {\n if (match.index > last) nodes.push(text.slice(last, match.index))\n const [, , code, bold, boldAlt, strike, italic, italicAlt, linkText, linkHref, autoHref] = match\n if (code !== undefined) {\n nodes.push(<code key={key++}>{code.trim()}</code>)\n } else if (bold !== undefined || boldAlt !== undefined) {\n nodes.push(<strong key={key++}>{renderInline((bold ?? boldAlt) as string)}</strong>)\n } else if (strike !== undefined) {\n nodes.push(<del key={key++}>{renderInline(strike)}</del>)\n } else if (italic !== undefined || italicAlt !== undefined) {\n nodes.push(<em key={key++}>{renderInline((italic ?? italicAlt) as string)}</em>)\n } else if (linkText !== undefined && linkHref !== undefined) {\n nodes.push(link(key++, linkHref, renderInline(linkText)))\n } else if (autoHref !== undefined) {\n nodes.push(link(key++, autoHref, autoHref))\n }\n last = match.index + match[0].length\n match = inline.exec(text)\n }\n if (last < text.length) nodes.push(text.slice(last))\n return nodes\n}\n\nconst SAFE_HREF = /^(https?:\\/\\/|mailto:)/i\n\nfunction link(key: number, href: string, children: ReactNode): ReactNode {\n if (!SAFE_HREF.test(href)) return <Fragment key={key}>{children}</Fragment>\n return (\n <a key={key} href={href} target='_blank' rel='noopener noreferrer'>\n {children}\n </a>\n )\n}\n","/**\n * Structured replies: an agent may answer with a JSON document of items (text, buttons,\n * table, cards, pie, image) instead of prose. This mirrors the contract the platform's\n * hosted chat renders, so a workflow tuned for one renders identically in the widget.\n */\n\nexport interface StructuredButton {\n label: string\n action: string\n}\nexport interface StructuredTable {\n headers: string[]\n rows: string[][]\n}\nexport interface StructuredCard {\n title: string\n subtitle: string\n body: string\n image: string\n}\nexport interface StructuredPie {\n labels: string[]\n data: number[]\n}\nexport interface StructuredImage {\n url: string\n caption: string\n}\nexport interface StructuredItem {\n text: { content: string }\n buttons: StructuredButton[]\n table: StructuredTable\n cards: StructuredCard[]\n pie: StructuredPie\n image: StructuredImage\n}\nexport interface StructuredResponse {\n items: StructuredItem[]\n}\n\nconst isObject = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\nconst isStringArray = (v: unknown): v is string[] =>\n Array.isArray(v) && v.every((x) => typeof x === 'string')\nconst isNumberArray = (v: unknown): v is number[] =>\n Array.isArray(v) && v.every((x) => typeof x === 'number')\n\nfunction isCard(v: unknown): v is StructuredCard {\n return (\n isObject(v) &&\n typeof v.title === 'string' &&\n typeof v.subtitle === 'string' &&\n typeof v.body === 'string' &&\n typeof v.image === 'string'\n )\n}\n\nfunction normaliseItem(raw: unknown): StructuredItem | null {\n if (!isObject(raw)) return null\n const text = raw.text\n const buttons = raw.buttons\n const table = raw.table\n const pie = raw.pie\n const image = raw.image\n const cards = Array.isArray(raw.cards) ? raw.cards : raw.card ? [raw.card] : []\n if (!isObject(text) || typeof text.content !== 'string') return null\n if (\n !Array.isArray(buttons) ||\n !buttons.every(\n (b) => isObject(b) && typeof b.label === 'string' && typeof b.action === 'string'\n )\n )\n return null\n if (\n !isObject(table) ||\n !isStringArray(table.headers) ||\n !Array.isArray(table.rows) ||\n !table.rows.every(isStringArray)\n )\n return null\n if (!cards.every(isCard)) return null\n if (!isObject(pie) || !isStringArray(pie.labels) || !isNumberArray(pie.data)) return null\n if (!isObject(image) || typeof image.url !== 'string' || typeof image.caption !== 'string')\n return null\n return {\n text: { content: text.content },\n buttons: buttons as StructuredButton[],\n table: table as unknown as StructuredTable,\n cards: cards as StructuredCard[],\n pie: pie as unknown as StructuredPie,\n image: image as unknown as StructuredImage,\n }\n}\n\n/** Parses a reply into a structured response, or null when it is ordinary prose. */\nexport function parseStructured(raw: string): StructuredResponse | null {\n let parsed: unknown\n try {\n parsed = JSON.parse(raw)\n } catch {\n return null\n }\n const list = Array.isArray(parsed)\n ? parsed\n : isObject(parsed) && Array.isArray(parsed.items)\n ? parsed.items\n : null\n if (!list) return null\n const items = list.map(normaliseItem)\n if (items.some((i) => i === null)) return null\n return { items: items as StructuredItem[] }\n}\n\n/* ───────────────────────────── renderer ───────────────────────────── */\n\nexport interface StructuredUIProps {\n response: StructuredResponse\n /** Called with the button's action text; the widget sends it as the next message. */\n onAction?: (action: string) => void\n}\n\nexport function StructuredUI({ response, onAction }: StructuredUIProps) {\n return (\n <div className='agi-sui'>\n {response.items.map((item, i) => (\n <div key={i} className='agi-sui__item'>\n {item.text.content && <p className='agi-sui__text'>{item.text.content}</p>}\n {item.image.url && (\n <figure className='agi-sui__figure'>\n <img src={item.image.url} alt={item.image.caption} />\n {item.image.caption && <figcaption>{item.image.caption}</figcaption>}\n </figure>\n )}\n {item.cards.length > 0 && (\n <div className='agi-sui__cards'>\n {item.cards.map((c, ci) => (\n <div key={ci} className='agi-panel agi-sui__card'>\n {c.image && <img src={c.image} alt='' />}\n <div>\n <div className='agi-sui__card-title'>{c.title}</div>\n {c.subtitle && <div className='agi-sui__card-sub'>{c.subtitle}</div>}\n {c.body && <p>{c.body}</p>}\n </div>\n </div>\n ))}\n </div>\n )}\n {item.table.headers.length > 0 && (\n <div className='agi-sui__scroll'>\n <table className='agi-table'>\n <thead>\n <tr>\n {item.table.headers.map((h, hi) => (\n <th key={hi}>{h}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {item.table.rows.map((r, ri) => (\n <tr key={ri}>\n {r.map((cell, ci) => (\n <td key={ci}>{cell}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n {item.pie.labels.length > 0 && <Pie labels={item.pie.labels} data={item.pie.data} />}\n {item.buttons.length > 0 && (\n <div className='agi-sui__actions'>\n {item.buttons.map((b, bi) => (\n <button\n key={bi}\n type='button'\n className='agi-chip'\n onClick={() => onAction?.(b.action)}\n >\n {b.label}\n </button>\n ))}\n </div>\n )}\n </div>\n ))}\n </div>\n )\n}\n\nfunction Pie({ labels, data }: StructuredPie) {\n const total = data.reduce((a, b) => a + Math.max(0, b), 0)\n if (total <= 0) return null\n let angle = 0\n const slices = labels.map((label, i) => {\n const value = Math.max(0, data[i] ?? 0)\n const start = angle\n angle += (value / total) * 360\n return { label, value, start, end: angle, color: `var(--data-${(i % 6) + 1})` }\n })\n const arc = (start: number, end: number) => {\n const r = 48\n const cx = 50\n const cy = 50\n const a0 = ((start - 90) * Math.PI) / 180\n const a1 = ((end - 90) * Math.PI) / 180\n const large = end - start > 180 ? 1 : 0\n const x0 = cx + r * Math.cos(a0)\n const y0 = cy + r * Math.sin(a0)\n const x1 = cx + r * Math.cos(a1)\n const y1 = cy + r * Math.sin(a1)\n if (end - start >= 360) return `M${cx} ${cy - r} A${r} ${r} 0 1 1 ${cx - 0.01} ${cy - r} Z`\n return `M${cx} ${cy} L${x0} ${y0} A${r} ${r} 0 ${large} 1 ${x1} ${y1} Z`\n }\n return (\n <div className='agi-sui__pie'>\n <svg viewBox='0 0 100 100' role='img' aria-label={labels.join(', ')}>\n <title>{labels.join(', ')}</title>\n {slices.map((s) => (\n <path key={s.label} d={arc(s.start, s.end)} fill={s.color} />\n ))}\n </svg>\n <ul>\n {slices.map((s) => (\n <li key={s.label}>\n <span style={{ background: s.color }} />\n {s.label}\n <b>{Math.round((s.value / total) * 100)}%</b>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n","import { type ChangeEvent, type FormEvent, useCallback, useEffect, useRef, useState } from 'react'\nimport { AginiesError, type ChatConfig, type ChatFilePayload } from '../client'\nimport { Button, cx, Field, Input, Spinner } from '../core'\nimport { useAginies, useModule } from '../provider'\nimport { Markdown } from './markdown'\nimport { parseStructured, type StructuredResponse, StructuredUI } from './structured-ui'\n\n/** A file the visitor attached to a message, as shown in the transcript. */\nexport interface ChatAttachment {\n name: string\n type: string\n size: number\n}\n\nexport interface ChatMessage {\n id: string\n role: 'user' | 'assistant'\n content: string\n attachments?: ChatAttachment[]\n structured?: StructuredResponse | null\n streaming?: boolean\n error?: boolean\n}\n\n/** Outcome of asking the platform to e-mail a verification code. */\nexport type CodeRequestResult = 'sent' | 'unauthorized' | 'error'\n\n/** Per-file and per-message limits for attachments; the platform rejects larger uploads. */\nexport const ATTACHMENT_LIMITS = { maxFiles: 5, maxBytes: 10 * 1024 * 1024 } as const\n\ntype AuthNeed = 'password' | 'email' | 'sso' | null\n\n/**\n * Chat state for one hosted-chat deployment: configuration, authentication, messages and\n * the streaming turn in flight. `ChatWidget` renders it; use the hook directly for a custom UI.\n */\nexport function useChat(identifier: string, enabled = true) {\n const { client, t } = useAginies()\n const [config, setConfig] = useState<ChatConfig | null>(null)\n const [authNeed, setAuthNeed] = useState<AuthNeed>(null)\n const [authTitle, setAuthTitle] = useState<string | undefined>()\n const [loadError, setLoadError] = useState<string | null>(null)\n const [messages, setMessages] = useState<ChatMessage[]>([])\n const [busy, setBusy] = useState(false)\n const [conversationId] = useState(() => randomId())\n const abortRef = useRef<AbortController | null>(null)\n\n const load = useCallback(async () => {\n setLoadError(null)\n try {\n const res = await client.getChat(identifier)\n if ('authRequired' in res) {\n setAuthNeed(res.authRequired === 'public' ? null : res.authRequired)\n setAuthTitle(res.title)\n return\n }\n setConfig(res)\n setAuthNeed(null)\n } catch (err) {\n setLoadError(\n err instanceof AginiesError && err.status === 403\n ? t('chat', 'unavailable')\n : t('chat', 'error')\n )\n }\n }, [client, identifier, t])\n\n useEffect(() => {\n if (enabled) void load()\n }, [load, enabled])\n\n const chatPath = `/api/chat/${encodeURIComponent(identifier)}`\n\n /** Sends the password as a first turn; the platform sets its cookie and returns the config. */\n const authenticate = useCallback(\n async ({ password }: { password: string }) => {\n const res = await client.fetchRaw(chatPath, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ password, conversationId }),\n })\n if (res.ok) {\n await load()\n return true\n }\n return false\n },\n [client, chatPath, conversationId, load]\n )\n\n /** Asks the platform to e-mail a one-time code to an address on the chat's allow-list. */\n const requestCode = useCallback(\n async (email: string): Promise<CodeRequestResult> => {\n const res = await client.fetchRaw(`${chatPath}/otp`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email }),\n })\n if (res.ok) return 'sent'\n return res.status === 403 ? 'unauthorized' : 'error'\n },\n [client, chatPath]\n )\n\n /** Verifies the e-mailed code; on success the platform sets its cookie and the chat loads. */\n const verifyCode = useCallback(\n async (email: string, otp: string) => {\n const res = await client.fetchRaw(`${chatPath}/otp`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email, otp }),\n })\n if (res.ok) {\n await load()\n return true\n }\n return false\n },\n [client, chatPath, load]\n )\n\n const stop = useCallback(() => {\n abortRef.current?.abort()\n abortRef.current = null\n setBusy(false)\n setMessages((prev) => {\n const last = prev[prev.length - 1]\n if (!last || last.role !== 'assistant' || !last.streaming) return prev\n return [\n ...prev.slice(0, -1),\n { ...last, streaming: false, content: last.content || t('chat', 'stopped') },\n ]\n })\n }, [t])\n\n const send = useCallback(\n async (text: string, files: ChatFilePayload[] = []) => {\n const input = text.trim()\n if ((!input && files.length === 0) || busy) return\n const userMessage: ChatMessage = {\n id: randomId(),\n role: 'user',\n content: input,\n attachments: files.map(({ name, type, size }) => ({ name, type, size })),\n }\n const assistantId = randomId()\n setMessages((prev) => [\n ...prev,\n userMessage,\n { id: assistantId, role: 'assistant', content: '', streaming: true },\n ])\n setBusy(true)\n const controller = new AbortController()\n abortRef.current = controller\n let content = ''\n const update = (patch: Partial<ChatMessage>) =>\n setMessages((prev) => prev.map((m) => (m.id === assistantId ? { ...m, ...patch } : m)))\n try {\n for await (const ev of client.sendMessage(\n identifier,\n { input, conversationId, files },\n controller.signal\n )) {\n if (ev.type === 'chunk') {\n content += ev.text\n update({ content })\n } else if (ev.type === 'final') {\n const text = extractFinalText(ev.data)\n if (text && !content) {\n content = text\n update({ content })\n }\n } else if (ev.type === 'error') {\n update({ content: ev.message, error: true, streaming: false })\n }\n }\n update({ streaming: false, structured: parseStructured(content) })\n } catch (err) {\n if (controller.signal.aborted) return\n const message =\n err instanceof AginiesError && err.code === 'AUTH_REQUIRED'\n ? t('chat', 'unavailable')\n : t('chat', 'error')\n update({ content: message, error: true, streaming: false })\n if (err instanceof AginiesError && err.code === 'AUTH_REQUIRED') void load()\n } finally {\n abortRef.current = null\n setBusy(false)\n }\n },\n [busy, client, identifier, conversationId, t, load]\n )\n\n return {\n config,\n authNeed,\n authTitle,\n loadError,\n messages,\n busy,\n send,\n stop,\n authenticate,\n requestCode,\n verifyCode,\n reload: load,\n }\n}\n\nfunction extractFinalText(data: unknown): string | null {\n if (!data || typeof data !== 'object') return null\n const d = data as { output?: Record<string, Record<string, unknown>> }\n if (!d.output) return null\n for (const block of Object.values(d.output)) {\n if (block && typeof block === 'object') {\n const b = block as Record<string, unknown>\n if (typeof b.content === 'string') return b.content\n if (typeof b.result === 'string') return b.result\n }\n }\n return null\n}\n\nfunction randomId(): string {\n if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) return crypto.randomUUID()\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`\n}\n\n/* ───────────────────────────── widget ───────────────────────────── */\n\nexport interface ChatWidgetProps {\n /** Identifier of the deployed chat, the last segment of its hosted URL. */\n identifier: string\n /** `bubble` floats a launcher in a corner; `inline` fills its container; `full` fills the viewport. */\n mode?: 'bubble' | 'inline' | 'full'\n /** Corner for `bubble` mode. */\n position?: 'right' | 'left'\n /** Text on the launcher; defaults to the chat title. */\n launcherLabel?: string\n /** Start open (bubble mode). */\n defaultOpen?: boolean\n /** Theme for the widget subtree; `auto` follows the host page. */\n theme?: 'dark' | 'light' | 'auto'\n className?: string\n}\n\nexport function ChatWidget({\n identifier,\n mode = 'inline',\n position = 'right',\n launcherLabel,\n defaultOpen = false,\n theme = 'auto',\n className,\n}: ChatWidgetProps) {\n const [open, setOpen] = useState(defaultOpen || mode !== 'bubble')\n const { t } = useAginies()\n const enabled = useModule('chat')\n const chat = useChat(identifier, enabled)\n const title = chat.config?.title ?? chat.authTitle ?? launcherLabel ?? 'Aginies'\n const themeClass = theme === 'auto' ? undefined : theme === 'dark' ? 'dark' : 'light'\n if (!enabled) return null\n\n const panel = (\n <section\n className={cx('agi-chat', `agi-chat--${mode}`, themeClass, className)}\n data-theme={themeClass}\n aria-label={title}\n >\n <header className='agi-chat__head'>\n <div className='agi-chat__title'>\n {chat.config?.customizations.imageUrl && (\n <img src={chat.config.customizations.imageUrl} alt='' />\n )}\n <div>\n <div className='agi-chat__name'>{title}</div>\n {chat.config?.description && (\n <div className='agi-chat__desc'>{chat.config.description}</div>\n )}\n </div>\n </div>\n {mode === 'bubble' && (\n <button\n type='button'\n className='agi-chat__close'\n onClick={() => setOpen(false)}\n aria-label={t('chat', 'close')}\n >\n ×\n </button>\n )}\n </header>\n\n {chat.loadError ? (\n <div className='agi-chat__state'>\n <p>{chat.loadError}</p>\n <Button variant='outline' size='sm' onClick={() => void chat.reload()}>\n {t('common', 'retry')}\n </Button>\n </div>\n ) : chat.authNeed ? (\n <ChatAuth\n need={chat.authNeed}\n onPassword={chat.authenticate}\n onRequestCode={chat.requestCode}\n onVerifyCode={chat.verifyCode}\n />\n ) : !chat.config ? (\n <div className='agi-chat__state'>\n <Spinner label={t('common', 'loading')} />\n </div>\n ) : (\n <>\n <MessageList\n messages={chat.messages}\n welcome={chat.config.customizations.welcomeMessage || t('chat', 'welcome')}\n onAction={(action) => void chat.send(action)}\n />\n <Composer busy={chat.busy} onSend={chat.send} onStop={chat.stop} />\n </>\n )}\n <footer className='agi-chat__foot'>\n <a href='https://www.aginies.com' target='_blank' rel='noreferrer'>\n {t('chat', 'poweredBy')}\n </a>\n </footer>\n </section>\n )\n\n if (mode !== 'bubble') return panel\n\n return (\n <div\n className={cx('agi-bubble', `agi-bubble--${position}`, themeClass)}\n data-theme={themeClass}\n >\n {open && panel}\n <button\n type='button'\n className={cx('agi-bubble__launcher', open && 'agi-bubble__launcher--open')}\n onClick={() => setOpen((o) => !o)}\n aria-expanded={open}\n aria-label={open ? t('chat', 'close') : t('chat', 'open')}\n >\n <svg\n width='22'\n height='22'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='1.7'\n strokeLinecap='round'\n strokeLinejoin='round'\n aria-hidden='true'\n >\n <path d='M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-5 4v-4H6.5A2.5 2.5 0 0 1 4 13.5v-8z' />\n <path d='M8 8h8M8 11.5h5' />\n </svg>\n {!open && <span>{launcherLabel ?? title}</span>}\n </button>\n </div>\n )\n}\n\n/* ───────────────────────────── parts ───────────────────────────── */\n\nfunction MessageList({\n messages,\n welcome,\n onAction,\n}: {\n messages: ChatMessage[]\n welcome: string\n onAction: (action: string) => void\n}) {\n const { t } = useAginies()\n const endRef = useRef<HTMLDivElement>(null)\n useEffect(() => {\n endRef.current?.scrollIntoView?.({ block: 'end' })\n }, [])\n return (\n // biome-ignore lint/a11y/useSemanticElements: no native element conveys a live log\n <div className='agi-chat__messages' role='log' aria-live='polite'>\n <div className='agi-msg agi-msg--assistant'>\n <span className='agi-msg__who'>{t('chat', 'assistant')}</span>\n <div className='agi-msg__body'>{welcome}</div>\n </div>\n {messages.map((m) => (\n <div\n key={m.id}\n className={cx('agi-msg', `agi-msg--${m.role}`, m.error && 'agi-msg--error')}\n >\n <span className='agi-msg__who'>\n {m.role === 'user' ? t('chat', 'you') : t('chat', 'assistant')}\n </span>\n <div className='agi-msg__body'>\n {m.structured ? (\n <StructuredUI response={m.structured} onAction={onAction} />\n ) : m.content ? (\n m.role === 'assistant' && !m.error ? (\n <Markdown className='agi-md' text={m.content} />\n ) : (\n <p>{m.content}</p>\n )\n ) : m.streaming ? (\n <span className='agi-msg__thinking'>\n <Spinner label={t('chat', 'thinking')} /> {t('chat', 'thinking')}\n </span>\n ) : null}\n {m.attachments && m.attachments.length > 0 && (\n <ul className='agi-msg__files' aria-label={t('chat', 'attachments')}>\n {m.attachments.map((file, n) => (\n <li key={n} className='agi-file'>\n <FileGlyph />\n <span className='agi-file__name'>{file.name}</span>\n <span className='agi-file__size'>{formatBytes(file.size)}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n ))}\n <div ref={endRef} />\n </div>\n )\n}\n\nfunction Composer({\n busy,\n onSend,\n onStop,\n}: {\n busy: boolean\n onSend: (text: string, files?: ChatFilePayload[]) => Promise<void>\n onStop: () => void\n}) {\n const { t } = useAginies()\n const [value, setValue] = useState('')\n const [files, setFiles] = useState<ChatFilePayload[]>([])\n const [fileError, setFileError] = useState<string | null>(null)\n const fileInput = useRef<HTMLInputElement>(null)\n\n const submit = (e: FormEvent) => {\n e.preventDefault()\n if (busy) return\n const text = value\n const attached = files\n setValue('')\n setFiles([])\n setFileError(null)\n void onSend(text, attached)\n }\n\n const pick = async (e: ChangeEvent<HTMLInputElement>) => {\n const chosen = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (chosen.length === 0) return\n if (files.length + chosen.length > ATTACHMENT_LIMITS.maxFiles) {\n setFileError(t('chat', 'tooManyFiles'))\n return\n }\n if (chosen.some((file) => file.size > ATTACHMENT_LIMITS.maxBytes)) {\n setFileError(t('chat', 'fileTooLarge'))\n return\n }\n setFileError(null)\n const payloads = await Promise.all(chosen.map(readFile))\n setFiles((prev) => [...prev, ...payloads])\n }\n\n const canSend = value.trim().length > 0 || files.length > 0\n\n return (\n <form className='agi-chat__composer' onSubmit={submit}>\n {(files.length > 0 || fileError) && (\n <div className='agi-chat__pending'>\n {files.map((file, n) => (\n <span key={n} className='agi-file agi-file--pending'>\n <FileGlyph />\n <span className='agi-file__name'>{file.name}</span>\n <button\n type='button'\n className='agi-file__remove'\n aria-label={`${t('chat', 'removeFile')}: ${file.name}`}\n onClick={() => setFiles((prev) => prev.filter((_, i) => i !== n))}\n >\n ×\n </button>\n </span>\n ))}\n {fileError && <span className='agi-chat__file-error'>{fileError}</span>}\n </div>\n )}\n <div className='agi-chat__row'>\n <input\n ref={fileInput}\n type='file'\n multiple\n hidden\n onChange={pick}\n data-testid='agi-file-input'\n />\n <Button\n variant='ghost'\n type='button'\n aria-label={t('chat', 'attach')}\n title={t('chat', 'attach')}\n disabled={busy}\n onClick={() => fileInput.current?.click()}\n >\n <svg width='16' height='16' viewBox='0 0 24 24' fill='none' aria-hidden='true'>\n <path\n d='M21 12.5 12.8 20.7a5.5 5.5 0 0 1-7.8-7.8l8.6-8.6a3.5 3.5 0 0 1 5 5l-8.6 8.6a1.5 1.5 0 0 1-2.1-2.1L15.5 8'\n stroke='currentColor'\n strokeWidth='1.6'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n </svg>\n </Button>\n <Input\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder={t('chat', 'placeholder')}\n aria-label={t('chat', 'placeholder')}\n autoComplete='off'\n />\n {busy ? (\n <Button variant='outline' onClick={onStop}>\n {t('chat', 'stop')}\n </Button>\n ) : (\n <Button variant='signal' type='submit' disabled={!canSend}>\n {t('chat', 'send')}\n </Button>\n )}\n </div>\n </form>\n )\n}\n\nfunction readFile(file: File): Promise<ChatFilePayload> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () =>\n resolve({\n name: file.name,\n type: file.type || 'application/octet-stream',\n size: file.size,\n data: String(reader.result),\n lastModified: file.lastModified,\n })\n reader.onerror = () => reject(reader.error)\n reader.readAsDataURL(file)\n })\n}\n\nfunction formatBytes(size: number): string {\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(0)} KB`\n return `${(size / (1024 * 1024)).toFixed(1)} MB`\n}\n\nfunction FileGlyph() {\n return (\n <svg width='12' height='12' viewBox='0 0 24 24' fill='none' aria-hidden='true'>\n <path\n d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5z'\n stroke='currentColor'\n strokeWidth='1.8'\n strokeLinejoin='round'\n />\n <path d='M14 3v5h5' stroke='currentColor' strokeWidth='1.8' strokeLinejoin='round' />\n </svg>\n )\n}\n\nfunction ChatAuth({\n need,\n onPassword,\n onRequestCode,\n onVerifyCode,\n}: {\n need: Exclude<AuthNeed, null>\n onPassword: (c: { password: string }) => Promise<boolean>\n onRequestCode: (email: string) => Promise<CodeRequestResult>\n onVerifyCode: (email: string, code: string) => Promise<boolean>\n}) {\n const { t, client } = useAginies()\n\n if (need === 'sso') {\n return (\n <div className='agi-chat__state'>\n <h3>{t('auth', 'ssoTitle')}</h3>\n <p>{t('auth', 'ssoHint')}</p>\n <Button\n variant='signal'\n onClick={() => window.open(`${client.baseUrl}/chat/`, '_blank', 'noopener')}\n >\n {t('auth', 'ssoButton')}\n </Button>\n </div>\n )\n }\n\n if (need === 'email') {\n return <EmailAuth onRequestCode={onRequestCode} onVerifyCode={onVerifyCode} />\n }\n\n return <PasswordAuth onPassword={onPassword} />\n}\n\nfunction PasswordAuth({\n onPassword,\n}: {\n onPassword: (c: { password: string }) => Promise<boolean>\n}) {\n const { t } = useAginies()\n const [value, setValue] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [pending, setPending] = useState(false)\n\n const submit = async (e: FormEvent) => {\n e.preventDefault()\n setPending(true)\n setError(null)\n const ok = await onPassword({ password: value })\n setPending(false)\n if (!ok) setError(t('auth', 'invalidPassword'))\n }\n\n return (\n <form className='agi-chat__state agi-chat__auth' onSubmit={submit}>\n <h3>{t('auth', 'passwordTitle')}</h3>\n <p>{t('auth', 'passwordHint')}</p>\n <Field label={t('auth', 'password')} error={error ?? undefined}>\n <Input\n type='password'\n value={value}\n onChange={(e) => setValue(e.target.value)}\n required\n autoComplete='current-password'\n />\n </Field>\n <Button variant='signal' type='submit' disabled={pending || !value}>\n {t('auth', 'continue')}\n </Button>\n </form>\n )\n}\n\n/**\n * Two steps, mirroring the platform's hosted page: the address goes to the allow-list check\n * and receives a six-digit code; the code is then verified and the platform sets its cookie.\n */\nfunction EmailAuth({\n onRequestCode,\n onVerifyCode,\n}: {\n onRequestCode: (email: string) => Promise<CodeRequestResult>\n onVerifyCode: (email: string, code: string) => Promise<boolean>\n}) {\n const { t } = useAginies()\n const [email, setEmail] = useState('')\n const [code, setCode] = useState('')\n const [step, setStep] = useState<'email' | 'code'>('email')\n const [error, setError] = useState<string | null>(null)\n const [notice, setNotice] = useState<string | null>(null)\n const [pending, setPending] = useState(false)\n\n const request = async () => {\n setPending(true)\n setError(null)\n setNotice(null)\n const result = await onRequestCode(email.trim())\n setPending(false)\n if (result === 'sent') {\n setStep('code')\n setNotice(t('auth', 'codeSent'))\n } else {\n setError(t('auth', result === 'unauthorized' ? 'invalidEmail' : 'codeError'))\n }\n }\n\n const verify = async () => {\n setPending(true)\n setError(null)\n setNotice(null)\n const ok = await onVerifyCode(email.trim(), code.trim())\n setPending(false)\n if (!ok) setError(t('auth', 'invalidCode'))\n }\n\n const submit = (e: FormEvent) => {\n e.preventDefault()\n void (step === 'email' ? request() : verify())\n }\n\n if (step === 'code') {\n return (\n <form className='agi-chat__state agi-chat__auth' onSubmit={submit}>\n <h3>{t('auth', 'emailTitle')}</h3>\n <p>\n {t('auth', 'codeHint')} <strong>{email}</strong>\n </p>\n <Field label={t('auth', 'code')} error={error ?? undefined} hint={notice ?? undefined}>\n <Input\n inputMode='numeric'\n autoComplete='one-time-code'\n pattern='[0-9]{6}'\n maxLength={6}\n value={code}\n onChange={(e) => setCode(e.target.value.replace(/\\D/g, ''))}\n required\n />\n </Field>\n <div className='agi-chat__auth-actions'>\n <Button variant='signal' type='submit' disabled={pending || code.length !== 6}>\n {t('auth', 'verify')}\n </Button>\n <Button variant='ghost' type='button' disabled={pending} onClick={() => void request()}>\n {t('auth', 'resend')}\n </Button>\n <Button\n variant='ghost'\n type='button'\n disabled={pending}\n onClick={() => {\n setStep('email')\n setCode('')\n setError(null)\n setNotice(null)\n }}\n >\n {t('auth', 'back')}\n </Button>\n </div>\n </form>\n )\n }\n\n return (\n <form className='agi-chat__state agi-chat__auth' onSubmit={submit}>\n <h3>{t('auth', 'emailTitle')}</h3>\n <p>{t('auth', 'emailHint')}</p>\n <Field label={t('auth', 'email')} error={error ?? undefined}>\n <Input\n type='email'\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n required\n autoComplete='email'\n />\n </Field>\n <Button variant='signal' type='submit' disabled={pending || !email.trim()}>\n {t('auth', 'sendCode')}\n </Button>\n </form>\n )\n}\n","/* @aginies/tokens v0.1.0 — generated from src/tokens.ts. Do not edit by hand. */\n\n/* Static tokens: type, shape, spacing, motion, layout. */\n:root {\n --font-display: 'Bricolage Grotesque Variable', 'Instrument Sans Variable', ui-sans-serif, system-ui, sans-serif;\n --font-body: 'Instrument Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;\n --font-mono: 'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n --radius-sm: 4px;\n --radius-md: 6px;\n --radius-lg: 10px;\n --radius-xl: 14px;\n --radius-2xl: 20px;\n --radius-full: 9999px;\n --radius: var(--radius-lg);\n --space-1: 4px;\n --space-2: 8px;\n --space-3: 12px;\n --space-4: 16px;\n --space-5: 24px;\n --space-6: 32px;\n --space-7: 48px;\n --space-8: 64px;\n --fs-display: clamp(40px, 6.4vw, 88px);\n --lh-display: 0.96;\n --ls-display: -0.04em;\n --fs-h1: clamp(36px, 5.2vw, 68px);\n --lh-h1: 1;\n --ls-h1: -0.035em;\n --fs-h2: clamp(28px, 3.8vw, 50px);\n --lh-h2: 1.04;\n --ls-h2: -0.03em;\n --fs-h3: clamp(20px, 2vw, 26px);\n --lh-h3: 1.2;\n --ls-h3: -0.02em;\n --fs-h4: 17px;\n --lh-h4: 1.3;\n --ls-h4: -0.01em;\n --fs-stat: clamp(30px, 3.4vw, 44px);\n --lh-stat: 1;\n --ls-stat: -0.03em;\n --fs-lede: clamp(17px, 1.4vw, 20px);\n --lh-lede: 1.5;\n --fs-body: 16px;\n --lh-body: 1.55;\n --fs-body-2: 15px;\n --lh-body-2: 1.5;\n --fs-small: 13.5px;\n --lh-small: 1.45;\n --fs-eyebrow: 11.5px;\n --lh-eyebrow: 1;\n --ls-eyebrow: 0.14em;\n --fs-label: 11px;\n --lh-label: 1;\n --ls-label: 0.1em;\n --fs-tag: 11.5px;\n --lh-tag: 1;\n --ls-tag: 0.04em;\n --fs-ui: 13px;\n --lh-ui: 1.4;\n --fs-ui-sm: 12px;\n --lh-ui-sm: 1.35;\n --fs-ui-xs: 11px;\n --lh-ui-xs: 1.3;\n --duration-fast: 150ms;\n --duration-base: 200ms;\n --duration-slow: 300ms;\n --duration-enter: 600ms;\n --ease-enter: cubic-bezier(0.2, 0.7, 0.2, 1);\n --max: 1200px;\n --gutter: clamp(20px, 4vw, 40px);\n --section-y: clamp(64px, 9vw, 128px);\n --section-y-tight: clamp(40px, 6vw, 80px);\n --bp-sm: 640px;\n --bp-md: 768px;\n --bp-lg: 1024px;\n --bp-xl: 1280px;\n --bp-2xl: 1536px;\n --bp-nav: 1180px;\n --bp-wide: 1340px;\n --z-base: 0;\n --z-raised: 10;\n --z-sticky: 50;\n --z-dropdown: 100;\n --z-modal: 200;\n --z-toast: 300;\n --focus-ring: 2px solid var(--signal);\n --focus-ring-offset: 3px;\n --focus-field-ring: 0 0 0 3px var(--signal-soft);\n --neutral-50: #F4F6FA;\n --neutral-50-rgb: 244 246 250;\n --neutral-100: #EEF1F7;\n --neutral-100-rgb: 238 241 247;\n --neutral-200: #DCE1EC;\n --neutral-200-rgb: 220 225 236;\n --neutral-300: #C5CCDB;\n --neutral-300-rgb: 197 204 219;\n --neutral-400: #A9B2CC;\n --neutral-400-rgb: 169 178 204;\n --neutral-500: #7F8AA8;\n --neutral-500-rgb: 127 138 168;\n --neutral-600: #6B7590;\n --neutral-600-rgb: 107 117 144;\n --neutral-700: #3C4560;\n --neutral-700-rgb: 60 69 96;\n --neutral-800: #2A3350;\n --neutral-800-rgb: 42 51 80;\n --neutral-900: #1B2238;\n --neutral-900-rgb: 27 34 56;\n --neutral-950: #0B1020;\n --neutral-950-rgb: 11 16 32;\n}\n\n\n/* Dark is the default theme. */\n:root {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n}\n\n.dark, [data-theme=\"dark\"] {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n}\n\n.light, [data-theme=\"light\"] {\n --bg: #F4F6FA;\n --bg-rgb: 244 246 250;\n --bg-2: #FFFFFF;\n --bg-2-rgb: 255 255 255;\n --panel: #FFFFFF;\n --panel-rgb: 255 255 255;\n --panel-2: #EEF1F7;\n --panel-2-rgb: 238 241 247;\n --panel-3: #E4E9F2;\n --panel-3-rgb: 228 233 242;\n --line: #DCE1EC;\n --line-rgb: 220 225 236;\n --line-2: #C5CCDB;\n --line-2-rgb: 197 204 219;\n --line-3: #A9B2CC;\n --line-3-rgb: 169 178 204;\n --text: #0B1220;\n --text-rgb: 11 18 32;\n --text-2: #3C4560;\n --text-2-rgb: 60 69 96;\n --mute: #6B7590;\n --mute-rgb: 107 117 144;\n --signal: #0077C2;\n --signal-rgb: 0 119 194;\n --signal-2: #005E9A;\n --signal-2-rgb: 0 94 154;\n --signal-ink: #FFFFFF;\n --signal-ink-rgb: 255 255 255;\n --signal-soft: rgba(0, 119, 194, 0.10);\n --ok: #0B7F57;\n --ok-rgb: 11 127 87;\n --ok-ink: #FFFFFF;\n --ok-ink-rgb: 255 255 255;\n --ok-soft: rgba(11, 127, 87, 0.12);\n --warn: #9C5A12;\n --warn-rgb: 156 90 18;\n --warn-ink: #FFFFFF;\n --warn-ink-rgb: 255 255 255;\n --warn-soft: rgba(156, 90, 18, 0.12);\n --bad: #B3261E;\n --bad-rgb: 179 38 30;\n --bad-ink: #FFFFFF;\n --bad-ink-rgb: 255 255 255;\n --bad-soft: rgba(179, 38, 30, 0.10);\n --shadow: 0 20px 50px rgba(11, 18, 32, 0.10);\n --shadow-sm: 0 8px 20px rgba(11, 18, 32, 0.08);\n --overlay: rgba(11, 18, 32, 0.45);\n --signal-50: 238 246 255;\n --signal-100: 217 236 255;\n --signal-200: 181 219 254;\n --signal-300: 130 195 253;\n --signal-400: 82 170 244;\n --signal-500: 46 144 221;\n --signal-600: 21 120 191;\n --signal-700: 3 96 157;\n --signal-800: 3 73 121;\n --signal-900: 3 52 87;\n --signal-950: 1 34 61;\n --ok-50: 234 250 241;\n --ok-100: 213 242 226;\n --ok-200: 180 227 202;\n --ok-300: 135 206 171;\n --ok-400: 94 184 143;\n --ok-500: 60 160 118;\n --ok-600: 38 134 96;\n --ok-700: 22 109 75;\n --ok-800: 16 83 57;\n --ok-900: 10 59 40;\n --ok-950: 2 40 25;\n --warn-50: 255 243 233;\n --warn-100: 253 228 209;\n --warn-200: 244 205 174;\n --warn-300: 231 175 127;\n --warn-400: 213 146 87;\n --warn-500: 189 120 56;\n --warn-600: 161 98 36;\n --warn-700: 132 77 22;\n --warn-800: 101 59 15;\n --warn-900: 73 41 9;\n --warn-950: 50 26 3;\n --bad-50: 255 242 240;\n --bad-100: 254 226 221;\n --bad-200: 255 198 189;\n --bad-300: 254 159 145;\n --bad-400: 251 115 99;\n --bad-500: 226 85 71;\n --bad-600: 194 63 52;\n --bad-700: 160 46 37;\n --bad-800: 124 34 27;\n --bad-900: 89 23 17;\n --bad-950: 63 11 8;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230077C2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: light;\n}\n\n@media (prefers-color-scheme: light) {\n :root:not(.dark):not([data-theme=\"dark\"]) {\n --bg: #F4F6FA;\n --bg-rgb: 244 246 250;\n --bg-2: #FFFFFF;\n --bg-2-rgb: 255 255 255;\n --panel: #FFFFFF;\n --panel-rgb: 255 255 255;\n --panel-2: #EEF1F7;\n --panel-2-rgb: 238 241 247;\n --panel-3: #E4E9F2;\n --panel-3-rgb: 228 233 242;\n --line: #DCE1EC;\n --line-rgb: 220 225 236;\n --line-2: #C5CCDB;\n --line-2-rgb: 197 204 219;\n --line-3: #A9B2CC;\n --line-3-rgb: 169 178 204;\n --text: #0B1220;\n --text-rgb: 11 18 32;\n --text-2: #3C4560;\n --text-2-rgb: 60 69 96;\n --mute: #6B7590;\n --mute-rgb: 107 117 144;\n --signal: #0077C2;\n --signal-rgb: 0 119 194;\n --signal-2: #005E9A;\n --signal-2-rgb: 0 94 154;\n --signal-ink: #FFFFFF;\n --signal-ink-rgb: 255 255 255;\n --signal-soft: rgba(0, 119, 194, 0.10);\n --ok: #0B7F57;\n --ok-rgb: 11 127 87;\n --ok-ink: #FFFFFF;\n --ok-ink-rgb: 255 255 255;\n --ok-soft: rgba(11, 127, 87, 0.12);\n --warn: #9C5A12;\n --warn-rgb: 156 90 18;\n --warn-ink: #FFFFFF;\n --warn-ink-rgb: 255 255 255;\n --warn-soft: rgba(156, 90, 18, 0.12);\n --bad: #B3261E;\n --bad-rgb: 179 38 30;\n --bad-ink: #FFFFFF;\n --bad-ink-rgb: 255 255 255;\n --bad-soft: rgba(179, 38, 30, 0.10);\n --shadow: 0 20px 50px rgba(11, 18, 32, 0.10);\n --shadow-sm: 0 8px 20px rgba(11, 18, 32, 0.08);\n --overlay: rgba(11, 18, 32, 0.45);\n --signal-50: 238 246 255;\n --signal-100: 217 236 255;\n --signal-200: 181 219 254;\n --signal-300: 130 195 253;\n --signal-400: 82 170 244;\n --signal-500: 46 144 221;\n --signal-600: 21 120 191;\n --signal-700: 3 96 157;\n --signal-800: 3 73 121;\n --signal-900: 3 52 87;\n --signal-950: 1 34 61;\n --ok-50: 234 250 241;\n --ok-100: 213 242 226;\n --ok-200: 180 227 202;\n --ok-300: 135 206 171;\n --ok-400: 94 184 143;\n --ok-500: 60 160 118;\n --ok-600: 38 134 96;\n --ok-700: 22 109 75;\n --ok-800: 16 83 57;\n --ok-900: 10 59 40;\n --ok-950: 2 40 25;\n --warn-50: 255 243 233;\n --warn-100: 253 228 209;\n --warn-200: 244 205 174;\n --warn-300: 231 175 127;\n --warn-400: 213 146 87;\n --warn-500: 189 120 56;\n --warn-600: 161 98 36;\n --warn-700: 132 77 22;\n --warn-800: 101 59 15;\n --warn-900: 73 41 9;\n --warn-950: 50 26 3;\n --bad-50: 255 242 240;\n --bad-100: 254 226 221;\n --bad-200: 255 198 189;\n --bad-300: 254 159 145;\n --bad-400: 251 115 99;\n --bad-500: 226 85 71;\n --bad-600: 194 63 52;\n --bad-700: 160 46 37;\n --bad-800: 124 34 27;\n --bad-900: 89 23 17;\n --bad-950: 63 11 8;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230077C2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: light;\n }\n\n}\n\n/* A .room section always carries the palette opposite to its ambient theme. */\n:root .room, .dark .room, [data-theme=\"dark\"] .room {\n --bg: #F4F6FA;\n --bg-rgb: 244 246 250;\n --bg-2: #FFFFFF;\n --bg-2-rgb: 255 255 255;\n --panel: #FFFFFF;\n --panel-rgb: 255 255 255;\n --panel-2: #EEF1F7;\n --panel-2-rgb: 238 241 247;\n --panel-3: #E4E9F2;\n --panel-3-rgb: 228 233 242;\n --line: #DCE1EC;\n --line-rgb: 220 225 236;\n --line-2: #C5CCDB;\n --line-2-rgb: 197 204 219;\n --line-3: #A9B2CC;\n --line-3-rgb: 169 178 204;\n --text: #0B1220;\n --text-rgb: 11 18 32;\n --text-2: #3C4560;\n --text-2-rgb: 60 69 96;\n --mute: #6B7590;\n --mute-rgb: 107 117 144;\n --signal: #0077C2;\n --signal-rgb: 0 119 194;\n --signal-2: #005E9A;\n --signal-2-rgb: 0 94 154;\n --signal-ink: #FFFFFF;\n --signal-ink-rgb: 255 255 255;\n --signal-soft: rgba(0, 119, 194, 0.10);\n --ok: #0B7F57;\n --ok-rgb: 11 127 87;\n --ok-ink: #FFFFFF;\n --ok-ink-rgb: 255 255 255;\n --ok-soft: rgba(11, 127, 87, 0.12);\n --warn: #9C5A12;\n --warn-rgb: 156 90 18;\n --warn-ink: #FFFFFF;\n --warn-ink-rgb: 255 255 255;\n --warn-soft: rgba(156, 90, 18, 0.12);\n --bad: #B3261E;\n --bad-rgb: 179 38 30;\n --bad-ink: #FFFFFF;\n --bad-ink-rgb: 255 255 255;\n --bad-soft: rgba(179, 38, 30, 0.10);\n --shadow: 0 20px 50px rgba(11, 18, 32, 0.10);\n --shadow-sm: 0 8px 20px rgba(11, 18, 32, 0.08);\n --overlay: rgba(11, 18, 32, 0.45);\n --signal-50: 238 246 255;\n --signal-100: 217 236 255;\n --signal-200: 181 219 254;\n --signal-300: 130 195 253;\n --signal-400: 82 170 244;\n --signal-500: 46 144 221;\n --signal-600: 21 120 191;\n --signal-700: 3 96 157;\n --signal-800: 3 73 121;\n --signal-900: 3 52 87;\n --signal-950: 1 34 61;\n --ok-50: 234 250 241;\n --ok-100: 213 242 226;\n --ok-200: 180 227 202;\n --ok-300: 135 206 171;\n --ok-400: 94 184 143;\n --ok-500: 60 160 118;\n --ok-600: 38 134 96;\n --ok-700: 22 109 75;\n --ok-800: 16 83 57;\n --ok-900: 10 59 40;\n --ok-950: 2 40 25;\n --warn-50: 255 243 233;\n --warn-100: 253 228 209;\n --warn-200: 244 205 174;\n --warn-300: 231 175 127;\n --warn-400: 213 146 87;\n --warn-500: 189 120 56;\n --warn-600: 161 98 36;\n --warn-700: 132 77 22;\n --warn-800: 101 59 15;\n --warn-900: 73 41 9;\n --warn-950: 50 26 3;\n --bad-50: 255 242 240;\n --bad-100: 254 226 221;\n --bad-200: 255 198 189;\n --bad-300: 254 159 145;\n --bad-400: 251 115 99;\n --bad-500: 226 85 71;\n --bad-600: 194 63 52;\n --bad-700: 160 46 37;\n --bad-800: 124 34 27;\n --bad-900: 89 23 17;\n --bad-950: 63 11 8;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230077C2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: light;\n}\n\n.light .room, [data-theme=\"light\"] .room {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n}\n\n@media (prefers-color-scheme: light) {\n :root:not(.dark):not([data-theme=\"dark\"]) .room {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n }\n\n :root:not(.dark):not([data-theme=\"dark\"]) .light .room {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n }\n\n}\n\n.room { background: var(--bg); color: var(--text); }\n\n/* @aginies/webuikit — component styles. Tokens come from @aginies/tokens (prepended at build). */\n\n/* ─── reset inside widgets ─── */\n.agi-chat,\n.agi-bubble,\n.agi-panel,\n.agi-btn,\n.agi-input,\n.agi-tag,\n.agi-chip {\n box-sizing: border-box;\n font-family: var(--font-body);\n color: var(--text);\n}\n.agi-chat *,\n.agi-bubble * {\n box-sizing: border-box;\n}\n\n/* ─── buttons ─── */\n.agi-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n height: 36px;\n padding: 0 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line-2);\n background: transparent;\n color: var(--text);\n font: inherit;\n font-size: 13.5px;\n font-weight: 600;\n letter-spacing: -0.005em;\n white-space: nowrap;\n cursor: pointer;\n transition:\n background var(--duration-fast) ease,\n border-color var(--duration-fast) ease,\n color var(--duration-fast) ease,\n transform var(--duration-fast) ease;\n}\n.agi-btn:hover {\n border-color: var(--text-2);\n background: var(--panel);\n}\n.agi-btn:active {\n transform: translateY(1px);\n}\n.agi-btn:focus-visible {\n outline: var(--focus-ring);\n outline-offset: var(--focus-ring-offset);\n}\n.agi-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n}\n.agi-btn--primary {\n background: var(--text);\n border-color: var(--text);\n color: var(--bg);\n}\n.agi-btn--primary:hover {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n}\n.agi-btn--signal {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n}\n.agi-btn--signal:hover {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n filter: brightness(1.08);\n}\n.agi-btn--destructive {\n background: var(--bad);\n border-color: var(--bad);\n color: var(--bad-ink);\n}\n.agi-btn--ghost {\n border-color: transparent;\n color: var(--text-2);\n}\n.agi-btn--ghost:hover {\n background: var(--panel-2);\n color: var(--text);\n}\n.agi-btn--sm {\n height: 30px;\n padding: 0 10px;\n font-size: 12.5px;\n}\n.agi-btn--lg {\n height: 44px;\n padding: 0 18px;\n font-size: 15px;\n}\n\n/* ─── tags / chips ─── */\n.agi-tag {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-family: var(--font-mono);\n font-size: var(--fs-tag);\n letter-spacing: var(--ls-tag);\n padding: 3px 8px;\n border-radius: var(--radius-sm);\n border: 1px solid var(--line-2);\n color: var(--text-2);\n white-space: nowrap;\n}\n.agi-tag--signal {\n color: var(--signal);\n border-color: color-mix(in srgb, var(--signal) 45%, transparent);\n background: var(--signal-soft);\n}\n.agi-tag--ok {\n color: var(--ok);\n border-color: color-mix(in srgb, var(--ok) 45%, transparent);\n background: var(--ok-soft);\n}\n.agi-tag--warn {\n color: var(--warn);\n border-color: color-mix(in srgb, var(--warn) 45%, transparent);\n background: var(--warn-soft);\n}\n.agi-tag--bad {\n color: var(--bad);\n border-color: color-mix(in srgb, var(--bad) 45%, transparent);\n background: var(--bad-soft);\n}\n.agi-chip {\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 0 12px;\n border-radius: var(--radius-full);\n border: 1px solid var(--line-2);\n background: transparent;\n font: inherit;\n font-size: 13px;\n color: var(--text-2);\n cursor: pointer;\n transition: all var(--duration-fast) ease;\n}\n.agi-chip:hover {\n border-color: var(--text-2);\n color: var(--text);\n}\n.agi-chip[aria-pressed=\"true\"] {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n font-weight: 600;\n}\n\n/* ─── surfaces / type ─── */\n.agi-panel {\n background: var(--panel);\n border: 1px solid var(--line);\n border-radius: var(--radius-lg);\n}\n.agi-panel--2 {\n background: var(--panel-2);\n}\n.agi-eyebrow {\n margin: 0;\n font-family: var(--font-mono);\n font-size: var(--fs-eyebrow);\n letter-spacing: var(--ls-eyebrow);\n text-transform: uppercase;\n color: var(--signal);\n font-weight: 500;\n}\n.agi-eyebrow--quiet {\n color: var(--mute);\n}\n.agi-stat {\n display: grid;\n gap: 4px;\n}\n.agi-stat__v {\n font-family: var(--font-display);\n font-size: var(--fs-stat);\n line-height: 1;\n letter-spacing: -0.03em;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n}\n.agi-stat__k {\n font-family: var(--font-mono);\n font-size: var(--fs-eyebrow);\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n}\n\n/* ─── fields ─── */\n.agi-field {\n display: grid;\n gap: 6px;\n}\n.agi-field__label {\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-field__error {\n color: var(--bad);\n font-size: 13px;\n}\n.agi-field__hint {\n font-size: 12px;\n color: var(--mute);\n}\n.agi-input {\n width: 100%;\n background: var(--bg-2);\n border: 1px solid var(--line-2);\n border-radius: var(--radius-md);\n padding: 9px 12px;\n color: var(--text);\n font: inherit;\n font-size: 14px;\n transition: border-color var(--duration-fast) ease;\n}\n.agi-input::placeholder {\n color: var(--mute);\n}\n.agi-input:focus {\n outline: none;\n border-color: var(--signal);\n box-shadow: var(--focus-field-ring);\n}\n.agi-textarea {\n resize: vertical;\n min-height: 90px;\n}\n\n/* ─── spinner ─── */\n.agi-spinner {\n display: inline-flex;\n gap: 4px;\n align-items: center;\n}\n.agi-spinner span {\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: var(--signal);\n animation: agi-pulse 1.2s ease-in-out infinite;\n}\n.agi-spinner span:nth-child(2) {\n animation-delay: 0.15s;\n}\n.agi-spinner span:nth-child(3) {\n animation-delay: 0.3s;\n}\n@keyframes agi-pulse {\n 0%,\n 80%,\n 100% {\n opacity: 0.25;\n transform: scale(0.8);\n }\n 40% {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n/* ─── table ─── */\n.agi-table {\n border-collapse: collapse;\n width: 100%;\n font-size: 13.5px;\n}\n.agi-table th,\n.agi-table td {\n text-align: left;\n padding: 8px 10px;\n border-bottom: 1px solid var(--line);\n vertical-align: top;\n}\n.agi-table th {\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n font-weight: 500;\n}\n.agi-table td {\n color: var(--text-2);\n}\n\n/* ─── chat ─── */\n.agi-chat {\n display: flex;\n flex-direction: column;\n min-height: 0;\n background: var(--panel);\n border: 1px solid var(--line);\n border-radius: var(--radius-lg);\n overflow: hidden;\n font-size: 14.5px;\n line-height: 1.5;\n}\n.agi-chat--inline {\n height: 100%;\n min-height: 420px;\n}\n.agi-chat--full {\n position: fixed;\n inset: 0;\n border-radius: 0;\n border: 0;\n z-index: var(--z-modal);\n}\n.agi-chat--bubble {\n width: min(400px, calc(100vw - 32px));\n height: min(600px, calc(100vh - 110px));\n box-shadow: var(--shadow);\n}\n.agi-chat__head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 12px 14px;\n border-bottom: 1px solid var(--line);\n background: var(--panel-2);\n}\n.agi-chat__title {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n}\n.agi-chat__title img {\n width: 28px;\n height: 28px;\n border-radius: 6px;\n object-fit: cover;\n flex: none;\n}\n.agi-chat__name {\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 15px;\n letter-spacing: -0.01em;\n}\n.agi-chat__desc {\n color: var(--mute);\n font-size: 12.5px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.agi-chat__close {\n width: 30px;\n height: 30px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line-2);\n background: transparent;\n color: var(--text-2);\n font-size: 18px;\n line-height: 1;\n cursor: pointer;\n}\n.agi-chat__close:hover {\n color: var(--text);\n border-color: var(--text-2);\n}\n.agi-chat__messages {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 14px;\n display: grid;\n gap: 12px;\n align-content: start;\n background-image: radial-gradient(var(--line) 1px, transparent 1px);\n background-size: 18px 18px;\n}\n.agi-msg {\n display: grid;\n gap: 4px;\n max-width: 88%;\n}\n.agi-msg--user {\n justify-self: end;\n text-align: right;\n}\n.agi-msg__who {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-msg__body {\n padding: 10px 12px;\n border-radius: var(--radius-lg);\n border: 1px solid var(--line);\n background: var(--bg-2);\n color: var(--text);\n text-align: left;\n}\n.agi-msg__body p {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n.agi-msg--user .agi-msg__body {\n background: var(--signal-soft);\n border-color: color-mix(in srgb, var(--signal) 35%, transparent);\n}\n.agi-msg--error .agi-msg__body {\n border-color: color-mix(in srgb, var(--bad) 45%, transparent);\n background: var(--bad-soft);\n color: var(--bad);\n}\n.agi-msg__thinking {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n color: var(--mute);\n font-size: 13px;\n}\n.agi-chat__composer {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border-top: 1px solid var(--line);\n background: var(--panel);\n}\n.agi-chat__row {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.agi-chat__row .agi-input {\n flex: 1;\n min-width: 0;\n}\n.agi-chat__pending {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n align-items: center;\n}\n.agi-chat__file-error {\n font-size: 12px;\n color: var(--bad);\n}\n.agi-file {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n max-width: 100%;\n padding: 3px 8px;\n border-radius: 999px;\n border: 1px solid var(--line);\n background: var(--panel-2);\n color: var(--text-2);\n font-family: var(--font-mono);\n font-size: 11px;\n}\n.agi-file__name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--text);\n}\n.agi-file__size {\n color: var(--mute);\n}\n.agi-file__remove {\n border: 0;\n background: none;\n padding: 0 2px;\n color: var(--mute);\n cursor: pointer;\n font-size: 14px;\n line-height: 1;\n}\n.agi-file__remove:hover {\n color: var(--bad);\n}\n.agi-msg__files {\n list-style: none;\n margin: 8px 0 0;\n padding: 0;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.agi-chat__auth-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n/* ─── markdown in replies ─── */\n.agi-md {\n display: grid;\n gap: 8px;\n word-break: break-word;\n}\n.agi-md p {\n margin: 0;\n white-space: normal;\n}\n.agi-md h3,\n.agi-md h4,\n.agi-md h5,\n.agi-md h6 {\n margin: 4px 0 0;\n font-family: var(--font-display);\n font-weight: 600;\n letter-spacing: -0.01em;\n line-height: 1.3;\n}\n.agi-md h3 {\n font-size: 15.5px;\n}\n.agi-md h4 {\n font-size: 14.5px;\n}\n.agi-md h5,\n.agi-md h6 {\n font-size: 13.5px;\n}\n.agi-md ul,\n.agi-md ol {\n margin: 0;\n padding-left: 20px;\n display: grid;\n gap: 3px;\n}\n.agi-md a {\n color: var(--signal);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.agi-md code {\n font-family: var(--font-mono);\n font-size: 12px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--panel-3);\n border: 1px solid var(--line);\n}\n.agi-md pre {\n margin: 0;\n padding: 10px 12px;\n overflow-x: auto;\n border-radius: var(--radius);\n background: var(--panel-3);\n border: 1px solid var(--line);\n}\n.agi-md pre code {\n padding: 0;\n border: 0;\n background: none;\n font-size: 12px;\n line-height: 1.55;\n}\n.agi-md blockquote {\n margin: 0;\n padding: 2px 0 2px 12px;\n border-left: 2px solid var(--line-2);\n color: var(--text-2);\n display: grid;\n gap: 6px;\n}\n.agi-md hr {\n border: 0;\n border-top: 1px solid var(--line);\n margin: 4px 0;\n}\n.agi-md__table {\n overflow-x: auto;\n}\n.agi-md table {\n border-collapse: collapse;\n width: 100%;\n font-size: 12.5px;\n}\n.agi-md th,\n.agi-md td {\n padding: 6px 8px;\n border: 1px solid var(--line);\n text-align: left;\n vertical-align: top;\n}\n.agi-md th {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n background: var(--panel-2);\n}\n.agi-chat__foot {\n padding: 6px 12px;\n border-top: 1px solid var(--line);\n text-align: right;\n}\n.agi-chat__foot a {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n text-decoration: none;\n}\n.agi-chat__foot a:hover {\n color: var(--signal);\n}\n.agi-chat__state {\n flex: 1;\n display: grid;\n align-content: center;\n justify-items: start;\n gap: 12px;\n padding: 24px;\n}\n.agi-chat__state h3 {\n margin: 0;\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 17px;\n letter-spacing: -0.01em;\n}\n.agi-chat__state p {\n margin: 0;\n color: var(--text-2);\n}\n.agi-chat__auth .agi-field {\n width: 100%;\n max-width: 360px;\n}\n\n/* ─── structured replies ─── */\n.agi-sui {\n display: grid;\n gap: 12px;\n}\n.agi-sui__item {\n display: grid;\n gap: 10px;\n}\n.agi-sui__text {\n margin: 0;\n white-space: pre-wrap;\n}\n.agi-sui__figure {\n margin: 0;\n}\n.agi-sui__figure img {\n max-width: 100%;\n border-radius: var(--radius-md);\n display: block;\n}\n.agi-sui__figure figcaption {\n font-size: 12.5px;\n color: var(--mute);\n margin-top: 4px;\n}\n.agi-sui__cards {\n display: grid;\n gap: 8px;\n}\n.agi-sui__card {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 10px;\n padding: 10px;\n background: var(--panel-2);\n}\n.agi-sui__card img {\n width: 56px;\n height: 56px;\n border-radius: var(--radius-md);\n object-fit: cover;\n}\n.agi-sui__card p {\n margin: 4px 0 0;\n color: var(--text-2);\n font-size: 13.5px;\n}\n.agi-sui__card-title {\n font-weight: 600;\n}\n.agi-sui__card-sub {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--mute);\n}\n.agi-sui__scroll {\n overflow-x: auto;\n}\n.agi-sui__actions {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.agi-sui__pie {\n display: grid;\n grid-template-columns: 96px 1fr;\n gap: 12px;\n align-items: center;\n}\n.agi-sui__pie svg {\n width: 96px;\n height: 96px;\n}\n.agi-sui__pie ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n font-size: 13px;\n}\n.agi-sui__pie li {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--text-2);\n}\n.agi-sui__pie li span {\n width: 10px;\n height: 10px;\n border-radius: 2px;\n flex: none;\n}\n.agi-sui__pie li b {\n margin-left: auto;\n font-family: var(--font-mono);\n font-weight: 500;\n color: var(--text);\n}\n\n/* ─── bubble launcher ─── */\n.agi-bubble {\n position: fixed;\n bottom: 20px;\n z-index: var(--z-toast);\n display: grid;\n gap: 10px;\n justify-items: end;\n}\n.agi-bubble--right {\n right: 20px;\n}\n.agi-bubble--left {\n left: 20px;\n justify-items: start;\n}\n.agi-bubble__launcher {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n height: 48px;\n padding: 0 18px 0 14px;\n border-radius: var(--radius-full);\n border: 1px solid var(--signal);\n background: var(--signal);\n color: var(--signal-ink);\n font: inherit;\n font-family: var(--font-body);\n font-weight: 600;\n font-size: 14px;\n cursor: pointer;\n box-shadow: var(--shadow-sm);\n transition: transform var(--duration-fast) ease;\n}\n.agi-bubble__launcher:hover {\n transform: translateY(-1px);\n}\n.agi-bubble__launcher--open {\n width: 48px;\n padding: 0;\n justify-content: center;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .agi-spinner span {\n animation: none;\n opacity: 0.7;\n }\n}\n\n/* ─── agent runner ─── */\n.agi-run {\n display: grid;\n gap: 14px;\n padding: 16px;\n font-size: 14.5px;\n}\n.agi-run__title {\n margin: 0;\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 17px;\n letter-spacing: -0.01em;\n}\n.agi-run__desc {\n margin: 4px 0 0;\n color: var(--text-2);\n}\n.agi-run__form {\n display: grid;\n gap: 12px;\n}\n.agi-run__actions {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.agi-run__status {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n color: var(--mute);\n font-size: 13px;\n}\n.agi-checkbox {\n width: 16px;\n height: 16px;\n accent-color: var(--signal);\n}\n.agi-run__steps {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n}\n.agi-run__step {\n display: grid;\n grid-template-columns: 10px 1fr auto;\n gap: 8px;\n align-items: center;\n font-size: 13px;\n color: var(--text-2);\n}\n.agi-run__step-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--line-2);\n}\n.agi-run__step.is-running .agi-run__step-dot {\n background: var(--signal);\n animation: agi-pulse 1.2s ease-in-out infinite;\n}\n.agi-run__step.is-done .agi-run__step-dot {\n background: var(--ok);\n}\n.agi-run__step.is-error .agi-run__step-dot {\n background: var(--bad);\n}\n.agi-run__step-meta {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--mute);\n}\n.agi-run__result {\n display: grid;\n gap: 8px;\n padding: 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: var(--bg-2);\n}\n.agi-run__text {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n.agi-run__output {\n margin: 0;\n font-family: var(--font-mono);\n font-size: 12.5px;\n white-space: pre-wrap;\n word-break: break-word;\n color: var(--text-2);\n}\n.agi-run__error {\n margin: 0;\n color: var(--bad);\n}\n.agi-run__meta {\n margin: 0;\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.04em;\n color: var(--mute);\n}\n.agi-run__meta b {\n font-weight: 500;\n color: var(--text-2);\n}\n\n/* ─── approval ─── */\n.agi-approval {\n display: grid;\n gap: 14px;\n padding: 16px;\n font-size: 14.5px;\n}\n.agi-approval__head {\n display: grid;\n gap: 4px;\n}\n.agi-approval__title {\n margin: 0;\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 17px;\n letter-spacing: -0.01em;\n}\n.agi-approval__desc {\n margin: 0;\n color: var(--text-2);\n}\n.agi-approval__meta {\n margin: 2px 0 0;\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.04em;\n color: var(--mute);\n}\n.agi-approval__meta-value {\n font-weight: 500;\n color: var(--text-2);\n}\n.agi-approval__state {\n display: grid;\n gap: 10px;\n justify-items: start;\n color: var(--text-2);\n}\n.agi-approval__state p {\n margin: 0;\n}\n.agi-approval__points {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.agi-approval__point {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 6px 10px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: transparent;\n color: var(--text-2);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.agi-approval__point.is-selected {\n border-color: var(--signal);\n color: var(--text);\n}\n.agi-approval__status {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.agi-approval__queue {\n font-size: 13px;\n color: var(--mute);\n}\n.agi-approval__output {\n display: grid;\n gap: 8px;\n padding: 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: var(--bg-2);\n}\n.agi-approval__output-label {\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-approval__kv {\n margin: 0;\n display: grid;\n gap: 6px;\n}\n.agi-approval__kv-row {\n display: grid;\n grid-template-columns: minmax(80px, 160px) 1fr;\n gap: 10px;\n align-items: start;\n}\n.agi-approval__kv dt {\n font-family: var(--font-mono);\n font-size: 12px;\n color: var(--text-2);\n word-break: break-word;\n}\n.agi-approval__kv dd {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n font-size: 13.5px;\n}\n.agi-approval__form {\n display: grid;\n gap: 12px;\n}\n.agi-approval__json {\n font-family: var(--font-mono);\n font-size: 12.5px;\n}\n.agi-approval__actions {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.agi-approval__error {\n margin: 0;\n color: var(--bad);\n}\n.agi-approval__done {\n display: grid;\n gap: 8px;\n justify-items: start;\n padding: 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: var(--bg-2);\n}\n.agi-approval__done p {\n margin: 0;\n color: var(--text-2);\n}\n\n/* ─── observability ─── */\n.agi-stats {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 12px;\n}\n.agi-stats__tile {\n display: grid;\n gap: 4px;\n padding: 16px;\n}\n.agi-stat__v.is-ok {\n color: var(--ok);\n}\n.agi-stat__v.is-warn {\n color: var(--warn);\n}\n.agi-stat__v.is-bad {\n color: var(--bad);\n}\n.agi-stats__delta {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--text-2);\n}\n\n.agi-heat {\n display: grid;\n gap: 6px;\n font-size: 12.5px;\n}\n.agi-heat__table {\n border-collapse: separate;\n border-spacing: 3px;\n width: 100%;\n table-layout: fixed;\n}\n.agi-heat__label {\n width: 140px;\n color: var(--text-2);\n font-weight: 400;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding-right: 8px;\n}\n.agi-heat__col {\n font-family: var(--font-mono);\n font-size: 9.5px;\n font-weight: 500;\n letter-spacing: 0.06em;\n color: var(--mute);\n text-align: center;\n}\n.agi-heat__td {\n padding: 0;\n}\n.agi-heat__cell {\n display: block;\n height: 18px;\n border-radius: 3px;\n background: var(--line);\n}\n.agi-heat__cell.is-ok {\n background: var(--ok);\n}\n.agi-heat__cell.is-warn {\n background: var(--warn);\n}\n.agi-heat__cell.is-bad {\n background: var(--bad);\n}\n.agi-heat__cell.is-none {\n background: var(--line);\n opacity: 0.6;\n}\n.agi-heat__legend {\n display: flex;\n gap: 6px;\n}\n\n.agi-timeline {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n}\n.agi-timeline__step {\n display: grid;\n grid-template-columns: 18px minmax(120px, 1fr) minmax(120px, 2fr) auto;\n gap: 10px;\n align-items: center;\n padding: 6px 8px;\n border-radius: var(--radius-md);\n border: 1px solid transparent;\n font-size: 13px;\n}\n.agi-timeline__step.is-running {\n background: var(--signal-soft);\n border-color: color-mix(in srgb, var(--signal) 40%, transparent);\n}\n.agi-timeline__step.is-waiting {\n background: var(--warn-soft);\n border-color: color-mix(in srgb, var(--warn) 45%, transparent);\n}\n.agi-timeline__step.is-error {\n background: var(--bad-soft);\n border-color: color-mix(in srgb, var(--bad) 45%, transparent);\n}\n.agi-timeline__glyph {\n color: var(--mute);\n text-align: center;\n}\n.agi-timeline__step.is-done .agi-timeline__glyph,\n.agi-timeline__step.k-verify .agi-timeline__glyph,\n.agi-timeline__step.k-write .agi-timeline__glyph {\n color: var(--ok);\n}\n.agi-timeline__step.is-running .agi-timeline__glyph {\n color: var(--signal);\n}\n.agi-timeline__step.is-waiting .agi-timeline__glyph,\n.agi-timeline__step.k-approval .agi-timeline__glyph {\n color: var(--warn);\n}\n.agi-timeline__name {\n color: var(--text);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.agi-timeline__detail {\n display: block;\n color: var(--mute);\n font-size: 11.5px;\n}\n.agi-timeline__bar {\n position: relative;\n height: 6px;\n border-radius: 3px;\n background: var(--line);\n}\n.agi-timeline__fill {\n position: absolute;\n top: 0;\n bottom: 0;\n border-radius: 3px;\n background: var(--signal);\n}\n.agi-timeline__step.is-done .agi-timeline__fill {\n background: var(--ok);\n}\n.agi-timeline__step.is-error .agi-timeline__fill {\n background: var(--bad);\n}\n.agi-timeline__step.is-waiting .agi-timeline__fill {\n background: var(--warn);\n}\n.agi-timeline__meta {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--mute);\n white-space: nowrap;\n}\n\n.agi-bars {\n display: grid;\n gap: 8px;\n font-size: 13px;\n}\n.agi-bars__row {\n display: grid;\n grid-template-columns: minmax(100px, 1fr) minmax(120px, 3fr) auto;\n gap: 10px;\n align-items: center;\n}\n.agi-bars__label {\n color: var(--text-2);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.agi-bars__track {\n height: 10px;\n border-radius: 5px;\n background: var(--line);\n overflow: hidden;\n}\n.agi-bars__fill {\n display: block;\n height: 100%;\n border-radius: 5px;\n}\n.agi-bars__value {\n font-family: var(--font-mono);\n font-size: 12px;\n color: var(--text);\n white-space: nowrap;\n display: grid;\n text-align: right;\n}\n.agi-bars__note {\n font-size: 10.5px;\n color: var(--mute);\n}\n","import { render, hydrate, unmountComponentAtNode } from 'preact/compat';\n\nexport function createRoot(container) {\n\treturn {\n\t\t// eslint-disable-next-line\n\t\trender: function (children) {\n\t\t\trender(children, container);\n\t\t},\n\t\t// eslint-disable-next-line\n\t\tunmount: function () {\n\t\t\tunmountComponentAtNode(container);\n\t\t}\n\t};\n}\n\nexport function hydrateRoot(container, children) {\n\thydrate(children, container);\n\treturn createRoot(container);\n}\n\nexport default {\n\tcreateRoot,\n\thydrateRoot\n};\n"],"mappings":"olBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,cAAAE,GAAA,aAAAC,GAAA,SAAAC,GAAA,SAAAC,GAAA,YAAAC,KCCO,IC0BMC,GChBPC,ECPFC,GA2FSC,GCiFTC,EAWAC,GAEEC,GA0BAC,GC7MFC,GACHC,GACAC,GAcKC,GAaFC,GA+IEC,GACAC,GCpLKC,GNeEC,GAAgC,CAAG,EACnCC,GAAY,CAAA,EACZC,GACZ,oECnBYC,GAAUC,MAAMD,QAStB,SAASE,EAAOC,EAAKC,EAAAA,CAE3B,QAASR,KAAKQ,EAAOD,EAAIP,CAAAA,EAAKQ,EAAMR,CAAAA,EACpC,OAA6BO,CAC9B,CAQgB,SAAAE,GAAWC,EAAAA,CACtBA,GAAQA,EAAKC,YAAYD,EAAKC,WAAWC,YAAYF,CAAAA,CAC1D,CEVgB,SAAAG,EAAcC,EAAMN,EAAOO,EAAAA,CAC1C,IACCC,EACAC,EACAjB,EAHGkB,EAAkB,CAAA,EAItB,IAAKlB,KAAKQ,EACLR,GAAK,MAAOgB,EAAMR,EAAMR,CAAAA,EACnBA,GAAK,MAAOiB,EAAMT,EAAMR,CAAAA,EAC5BkB,EAAgBlB,CAAAA,EAAKQ,EAAMR,CAAAA,EAUjC,GAPImB,UAAUC,OAAS,IACtBF,EAAgBH,SACfI,UAAUC,OAAS,EAAInC,GAAMoC,KAAKF,UAAW,CAAA,EAAK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ACGA,EAAE,SAAU,CACd,GAAM,CAACC,EAAYC,EAAaC,CAAS,EAAIH,EAAE,SAAS,MAAM,GAAG,EACjE,GAAI,CAACC,GAAc,CAACC,EAAa,OAAO,KACxC,IAAME,EAAgB,IACpBV,GAAS,CAAE,WAAAO,EAAY,YAAAC,EAAa,UAAAC,EAAW,UAAWH,EAAE,SAAU,CAAC,EACzE,OAAI,SAAS,aAAe,WAC1B,SAAS,iBAAiB,mBAAoB,IAAMI,EAAc,EAAG,CAAE,KAAM,EAAK,CAAC,EAC5E,MAEFA,EAAc,CACvB,CACA,GAAI,CAACJ,EAAE,KAAM,OAAO,KACpB,IAAMK,EAAQ,IACZvB,GAAK,CACH,WAAYkB,EAAE,KACd,KAAOA,EAAE,MAAoC,SAC7C,SAAWA,EAAE,UAA4C,QACzD,MAAQA,EAAE,OAAsC,OAChD,cAAeA,EAAE,MACjB,UAAWA,EAAE,SACf,CAAC,EACH,OAAI,SAAS,aAAe,WAC1B,SAAS,iBAAiB,mBAAoB,IAAMK,EAAM,EAAG,CAAE,KAAM,EAAK,CAAC,EACpE,MAEFA,EAAM,CACf,CAEA,SAASN,IAA0C,CACjD,OAAI,OAAO,SAAa,IAAoB,KACpC,SAAS,eAA8C,IACjE,CAEI,OAAO,OAAW,KACpBF,GAAS","names":["src_exports","__export","approval","autoload","chat","init","version","slice","options","vnodeId","isValidElement","rerenderQueue","prevDebounce","defer","depthSort","_id","EVENT_DISPATCHED","EVENT_ATTACHED","CAPTURE_REGEX","eventClock","eventProxy","eventProxyCapture","i","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","isArray","Array","assign","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","key","ref","normalizedProps","arguments","length","call","defaultProps","createVNode","original","vnode","__k","__","__b","__e","__c","constructor","__v","__i","__u","Fragment","props","children","BaseComponent","context","this","getDomSibling","vnode","childIndex","__","__i","sibling","__k","length","__e","type","renderComponent","component","__P","__d","oldVNode","__v","oldDom","commitQueue","refQueue","newVNode","assign","options","diff","__n","namespaceURI","__u","commitRoot","updateParentDomPointers","__c","base","some","child","enqueueRender","c","rerenderQueue","push","process","__r","prevDebounce","debounceRendering","defer","l","sort","depthSort","shift","diffChildren","parentDom","renderResult","newParentVNode","oldParentVNode","globalContext","namespace","excessDomChildren","isHydrating","i","childVNode","newDom","firstChildDom","result","oldChildren","EMPTY_ARR","newChildrenLength","constructNewChildrenArray","EMPTY_OBJ","ref","applyRef","insert","nextSibling","skewedIndex","matchingIndex","oldChildrenLength","remainingOldChildren","skew","Array","constructor","String","createVNode","isArray","__b","key","findMatchingIndex","unmount","parentVNode","parentNode","insertBefore","nodeType","toChildArray","out","x","y","matched","setStyle","style","value","setProperty","IS_NON_DIMENSIONAL","test","dom","name","oldValue","useCapture","lowerCaseName","o","cssText","replace","CAPTURE_REGEX","toLowerCase","slice","EVENT_ATTACHED","eventClock","addEventListener","eventProxyCapture","eventProxy","removeEventListener","e","removeAttribute","setAttribute","createEventProxy","eventHandler","EVENT_DISPATCHED","event","tmp","oldCommitQueueLength","isNew","oldProps","oldState","snapshot","clearProcessingException","newProps","isClassComponent","provider","componentContext","renderHook","count","newType","outer","prototype","render","contextType","__E","doRender","sub","state","__h","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","apply","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","cloneNode","then","MODE_HYDRATE","indexOf","removeNode","markAsForce","diffElementNodes","diffed","root","cb","call","node","map","newHtml","oldHtml","newChildren","inputValue","checked","localName","document","createTextNode","createElementNS","is","__m","data","defaultValue","childNodes","attributes","__html","innerHTML","content","undefined","hasRefUnmount","current","skipRemove","r","componentWillUnmount","replaceNode","documentElement","createElement","firstChild","createContext","defaultValue","Context","props","subs","ctx","this","getChildContext","Set","__c","componentWillUnmount","shouldComponentUpdate","_props","value","forEach","c","__e","enqueueRender","sub","add","old","delete","call","children","i","__","Provider","__l","Consumer","contextValue","contextType","slice","EMPTY_ARR","options","error","vnode","oldVNode","errorInfo","component","ctor","handled","constructor","getDerivedStateFromError","setState","__d","componentDidCatch","__E","e","vnodeId","isValidElement","BaseComponent","prototype","update","callback","s","__s","state","assign","__v","_sb","push","forceUpdate","__h","render","Fragment","rerenderQueue","defer","Promise","then","bind","resolve","setTimeout","depthSort","a","b","__b","process","__r","_id","Math","random","toString","EVENT_DISPATCHED","EVENT_ATTACHED","CAPTURE_REGEX","eventClock","eventProxy","createEventProxy","eventProxyCapture","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","options","_options","oldBeforeDiff","__b","oldBeforeRender","__r","oldAfterDiff","diffed","oldCommit","__c","oldBeforeUnmount","unmount","oldRoot","__","getHookState","index","type","__h","hooks","__H","length","push","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","action","currentValue","__N","nextValue","setState","__f","updateHookState","p","s","c","updatedHook","shouldUpdate","props","some","hookItem","prevScu","result","call","this","shouldComponentUpdate","prevCWU","componentWillUpdate","__e","tmp","useEffect","callback","args","state","__s","argsChanged","_pendingArgs","useRef","initialValue","currentHook","useMemo","current","useMemo","factory","args","state","getHookState","currentIndex","argsChanged","__H","__","__h","useCallback","callback","currentHook","useContext","context","provider","currentComponent","__c","c","sub","props","value","flushAfterPaintEffects","component","afterPaintEffects","shift","hooks","__H","__P","__h","some","invokeCleanup","invokeEffect","e","options","__e","__v","__b","vnode","currentComponent","oldBeforeDiff","__","parentDom","__k","__m","oldRoot","__r","oldBeforeRender","currentIndex","__c","previousComponent","hookItem","__N","_pendingArgs","diffed","oldAfterDiff","c","length","push","prevRaf","requestAnimationFrame","afterNextFrame","commitQueue","filter","cb","oldCommit","unmount","oldBeforeUnmount","hasErrored","s","HAS_RAF","callback","raf","done","clearTimeout","timeout","cancelAnimationFrame","setTimeout","hook","comp","cleanup","argsChanged","oldArgs","newArgs","arg","index","invokeOrReturn","f","assign","obj","props","i","shallowDiffers","a","b","useLayoutEffect","PureComponent","p","c","this","props","context","PureComponent","prototype","Component","isPureReactComponent","shouldComponentUpdate","props","state","shallowDiffers","this","oldDiffHook","options","__b","vnode","type","__f","ref","REACT_FORWARD_SYMBOL","Symbol","for","forwardRef","fn","Forwarded","clone","assign","$$typeof","render","isReactComponent","displayName","name","oldCatchError","options","__e","error","newVNode","oldVNode","errorInfo","then","component","vnode","__","__c","__k","oldUnmount","unmount","detachedClone","detachedParent","parentDom","__H","forEach","effect","assign","__P","map","child","removeOriginal","originalParent","__v","appendChild","Suspense","this","__u","_suspenders","__b","suspended","__a","SuspenseList","this","_next","_map","options","unmount","vnode","component","__c","__z","__R","__u","type","oldUnmount","Suspense","prototype","Component","promise","suspendingVNode","suspendingComponent","c","_suspenders","push","resolve","suspended","__v","resolved","onResolved","onSuspensionComplete","originalParentDom","__P","state","__a","suspendedVNode","__k","removeOriginal","__O","setState","__b","pop","forceUpdate","then","componentWillUnmount","render","props","detachedParent","document","createElement","detachedComponent","detachedClone","fallback","Fragment","children","list","child","node","delete","revealOrder","size","length","SuspenseList","prototype","Component","__a","child","list","this","delegated","suspended","__v","node","_map","get","unsuspend","wrappedUnsuspend","props","revealOrder","push","resolve","render","_next","Map","children","toChildArray","reverse","i","length","set","componentDidUpdate","componentDidMount","_this","forEach","REACT_ELEMENT_TYPE","Symbol","for","CAMEL_PROPS","ON_ANI","CAMEL_REPLACE","IS_DOM","document","onChangeInputType","type","test","vnode","parent","callback","__k","textContent","preactRender","__c","Component","prototype","isReactComponent","forEach","key","Object","defineProperty","configurable","get","this","set","v","writable","value","oldEventHook","options","event","e","persist","isPropagationStopped","cancelBubble","isDefaultPrevented","defaultPrevented","nativeEvent","currentComponent","classNameDescriptorNonEnumberable","class","oldVNodeHook","vnode","type","props","normalizedProps","isNonDashedType","indexOf","i","IS_DOM","lowerCased","toLowerCase","onChangeInputType","ON_ANI","test","CAMEL_PROPS","replace","CAMEL_REPLACE","multiple","Array","isArray","toChildArray","children","child","selected","defaultValue","className","$$typeof","REACT_ELEMENT_TYPE","oldBeforeRender","__r","__c","oldDiffed","diffed","dom","__e","unmountComponentAtNode","container","__k","preactRender","AginiesError","message","status","code","__publicField","trimSlash","s","AginiesClient","config","detectLocale","args","listener","next","l","res","body","safeJson","reason","err","module","modules","init","headers","path","url","send","identifier","input","signal","parseSSE","stream","reader","decoder","buffer","done","value","sep","frame","event","decodeFrame","tail","line","data","json","path","workflowId","executionId","contextId","readJson","res","body","error","AginiesError","getPausedExecution","client","r","resumeExecution","client","workflowId","executionId","contextId","submission","path","r","readJson","fieldsOf","point","raw","f","index","field","name","str","v","outputOf","data","_f","_l","rest","formatFieldValue","value","parseFieldValue","text","n","initialValues","fields","buildSubmission","values","errors","error","vnodeId","createVNode","type","props","key","isStaticChildren","__source","__self","ref","i","normalizedProps","vnode","__k","__","__b","__e","__c","constructor","__v","vnodeId","__i","__u","defaultProps","options","cx","parts","Button","D","variant","size","className","type","props","ref","u","Tag","tone","Panel","level","className","props","u","cx","Eyebrow","quiet","Field","label","hint","error","className","children","props","u","cx","Input","D","ref","Textarea","Spinner","STRINGS","translator","locale","section","key","entry","defaultClient","init","config","AginiesClient","AginiesContext","X","useModule","module","client","useAginies","allowed","h","AginiesProvider","locale","fallback","children","resolved","defaultClient","state","setState","d","unsubscribe","value","T","l","translator","u","S","ctx","x","useApproval","workflowId","executionId","contextId","client","t","useAginies","status","setStatus","d","execution","setExecution","selected","setSelected","values","setValues","errors","setErrors","error","setError","outcome","setOutcome","selectedRef","A","pausePoint","T","p","fields","fieldsOf","load","q","detail","getPausedExecution","wanted","point","initialValues","err","AginiesError","h","select","nextContextId","setValue","name","value","v","e","_drop","rest","submit","submission","problems","buildSubmission","k","result","resumeExecution","STATUS_TONE","ApprovalPanel","title","description","submitLabel","onResumed","hideOutput","className","locale","enabled","useModule","a","onResumedRef","output","outputOf","outputEntries","canSubmit","fmt","iso","onSubmit","u","Panel","cx","Eyebrow","S","Spinner","Button","i","Tag","f","Field","renderField","set","disabled","Input","Textarea","o","opt","Markdown","text","className","u","renderBlocks","parseBlocks","FENCE","HEADING","RULE","QUOTE","LIST","TABLE_SEPARATOR","lines","blocks","i","paragraph","flush","line","fence","marker","lang","code","heading","inner","list","ordered","start","items","m","header","splitRow","align","cell","left","right","rows","block","index","n","S","renderInline","Tag","item","alignStyle","row","_","INLINE","nodes","last","key","inline","match","bold","boldAlt","strike","italic","italicAlt","linkText","linkHref","autoHref","link","SAFE_HREF","href","children","isObject","v","isStringArray","x","isNumberArray","isCard","normaliseItem","raw","text","buttons","table","pie","image","cards","b","parseStructured","parsed","list","items","i","StructuredUI","response","onAction","u","item","c","ci","h","hi","ri","cell","Pie","bi","labels","data","total","a","angle","slices","label","value","start","arc","end","a0","a1","large","x0","y0","x1","y1","ATTACHMENT_LIMITS","useChat","identifier","enabled","client","t","useAginies","config","setConfig","d","authNeed","setAuthNeed","authTitle","setAuthTitle","loadError","setLoadError","messages","setMessages","busy","setBusy","conversationId","randomId","abortRef","A","load","q","res","err","AginiesError","h","chatPath","authenticate","password","requestCode","email","verifyCode","otp","stop","prev","last","send","text","files","input","userMessage","name","type","size","assistantId","controller","content","update","patch","m","ev","extractFinalText","parseStructured","message","data","block","b","ChatWidget","mode","position","launcherLabel","defaultOpen","theme","className","open","setOpen","useModule","chat","title","themeClass","panel","u","cx","Button","ChatAuth","S","MessageList","action","Composer","Spinner","o","welcome","onAction","endRef","StructuredUI","Markdown","file","n","FileGlyph","formatBytes","onSend","onStop","value","setValue","setFiles","fileError","setFileError","fileInput","submit","e","attached","pick","chosen","payloads","readFile","canSend","_","i","Input","resolve","reject","reader","need","onPassword","onRequestCode","onVerifyCode","EmailAuth","PasswordAuth","error","setError","pending","setPending","ok","Field","setEmail","code","setCode","step","setStep","notice","setNotice","request","result","verify","styles_default","createRoot","container","children","nn","pn","version","STYLE_ID","client","ensureStyles","style","styles_default","init","config","chat","options","container","mode","props","element","resolveContainer","root","createRoot","k","AginiesProvider","ChatWidget","approval","ApprovalPanel","el","autoload","script","currentScript","d","workflowId","executionId","contextId","mountApproval","mount"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/constants.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/util.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/options.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/create-element.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/component.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/props.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/create-context.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/children.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/index.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/render.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/clone-element.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/diff/catch-error.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/hooks/src/index.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/util.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/hooks.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/PureComponent.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/memo.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/forwardRef.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/Children.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/suspense.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/suspense-list.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/constants.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/portals.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/render.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/src/index.js","../../react/src/client.ts","../../react/src/approval/approval-client.ts","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/jsx-runtime/src/utils.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/src/constants.js","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/jsx-runtime/src/index.js","../../react/src/core/index.tsx","../../react/src/i18n.ts","../../react/src/provider.tsx","../../react/src/approval/approval-panel.tsx","../../react/src/chat/markdown.tsx","../../react/src/chat/structured-ui.tsx","../../react/src/chat/voice.ts","../../react/src/chat/chat-widget.tsx","../../react/dist/styles.css","../../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/client.mjs"],"sourcesContent":["import { createElement } from 'react'\nimport {\n type AginiesClient,\n type AginiesConfig,\n AginiesProvider,\n ApprovalPanel,\n type ApprovalPanelProps,\n ChatWidget,\n type ChatWidgetProps,\n init as initClient,\n} from '@aginies/webuikit'\nimport styles from '@aginies/webuikit/styles.css'\nimport { createRoot, type Root } from 'react-dom/client'\n\nexport const version = '0.1.0'\n\nconst STYLE_ID = 'aginies-embed-styles'\nlet client: AginiesClient | null = null\n\nfunction ensureStyles(): void {\n if (typeof document === 'undefined' || document.getElementById(STYLE_ID)) return\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = styles\n document.head.appendChild(style)\n}\n\n/** Creates the shared client and starts the activation handshake. Call once per page. */\nexport function init(config: AginiesConfig): AginiesClient {\n ensureStyles()\n client = initClient(config)\n return client\n}\n\nexport interface ChatOptions extends ChatWidgetProps {\n /** Where to mount for `inline` / `full`: a selector or element. Bubble mode makes its own root. */\n container?: string | HTMLElement\n}\n\nexport interface ApprovalOptions extends ApprovalPanelProps {\n /** Where to mount: a selector or element. Defaults to a new element at the end of `<body>`. */\n container?: string | HTMLElement\n}\n\nexport interface MountHandle {\n unmount: () => void\n element: HTMLElement\n}\n\n/** Mounts a chat widget. Requires `init()` first. */\nexport function chat(options: ChatOptions): MountHandle {\n if (!client) {\n throw new Error('[aginies] call Aginies.init({ baseUrl, token }) before Aginies.chat()')\n }\n const { container, mode = 'bubble', ...props } = options\n const element = resolveContainer(container, mode)\n const root: Root = createRoot(element)\n root.render(\n createElement(AginiesProvider, {\n client,\n // biome-ignore lint/correctness/noChildrenProp: createElement outside JSX\n children: createElement(ChatWidget, { ...props, mode }),\n })\n )\n return {\n element,\n unmount: () => {\n root.unmount()\n if (element.dataset.aginiesOwned === 'true') element.remove()\n },\n }\n}\n\n/** Mounts an approval panel for a paused run. Requires `init()` first. */\nexport function approval(options: ApprovalOptions): MountHandle {\n if (!client) {\n throw new Error('[aginies] call Aginies.init({ baseUrl, token }) before Aginies.approval()')\n }\n const { container, ...props } = options\n const element = resolveContainer(container, 'approval')\n const root: Root = createRoot(element)\n root.render(\n createElement(AginiesProvider, {\n client,\n // biome-ignore lint/correctness/noChildrenProp: createElement outside JSX\n children: createElement(ApprovalPanel, props),\n })\n )\n return {\n element,\n unmount: () => {\n root.unmount()\n if (element.dataset.aginiesOwned === 'true') element.remove()\n },\n }\n}\n\nfunction resolveContainer(container: string | HTMLElement | undefined, mode: string): HTMLElement {\n if (container) {\n const el =\n typeof container === 'string' ? document.querySelector<HTMLElement>(container) : container\n if (!el) throw new Error(`[aginies] container not found: ${String(container)}`)\n return el\n }\n const el = document.createElement('div')\n el.dataset.aginiesOwned = 'true'\n el.dataset.aginiesMode = mode\n document.body.appendChild(el)\n return el\n}\n\n/**\n * Reads `data-*` attributes off the script tag and mounts without any code:\n * `data-base-url`, `data-token`, `data-chat`, `data-mode`, `data-position`, `data-locale`,\n * `data-theme`, `data-label`; or `data-approval=\"workflowId/executionId[/contextId]\"` for an\n * approval panel.\n */\nexport function autoload(script: HTMLScriptElement | null = currentScript()): MountHandle | null {\n if (!script) return null\n const d = script.dataset\n if (!d.baseUrl || !d.token) return null\n init({\n baseUrl: d.baseUrl,\n token: d.token,\n locale: d.locale === 'tr' || d.locale === 'en' ? d.locale : undefined,\n })\n if (d.approval) {\n const [workflowId, executionId, contextId] = d.approval.split('/')\n if (!workflowId || !executionId) return null\n const mountApproval = () =>\n approval({ workflowId, executionId, contextId, container: d.container })\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => mountApproval(), { once: true })\n return null\n }\n return mountApproval()\n }\n if (!d.chat) return null\n const mount = () =>\n chat({\n identifier: d.chat as string,\n mode: (d.mode as ChatWidgetProps['mode']) ?? 'bubble',\n position: (d.position as ChatWidgetProps['position']) ?? 'right',\n theme: (d.theme as ChatWidgetProps['theme']) ?? 'auto',\n launcherLabel: d.label,\n container: d.container,\n })\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => mount(), { once: true })\n return null\n }\n return mount()\n}\n\nfunction currentScript(): HTMLScriptElement | null {\n if (typeof document === 'undefined') return null\n return (document.currentScript as HTMLScriptElement | null) ?? null\n}\n\nif (typeof window !== 'undefined') {\n autoload()\n}\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\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 = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\t// @ts-expect-error We change the type of `obj` to be `O & P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {import('./index').ContainerNode} node The node to remove\n */\nexport function removeNode(node) {\n\tif (node && node.parentNode) node.parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\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 { 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\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' && type.defaultProps != NULL) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === UNDEFINED) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, NULL);\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 == NULL ? ++vnodeId : original,\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 == NULL && options.vnode != NULL) 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 { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\nimport { MODE_HYDRATE, NULL } from './constants';\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}\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;\n\tif (this._nextState != NULL && this._nextState != this.state) {\n\t\ts = this._nextState;\n\t} else {\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}\n\n\t// Skip update if updater function returned null\n\tif (update == NULL) return;\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._force = true;\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 != NULL && sibling._dom != NULL) {\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)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : 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\tif (component._parentDom && component._dirty) {\n\t\tlet oldVNode = component._vnode,\n\t\t\toldDom = oldVNode._dom,\n\t\t\tcommitQueue = [],\n\t\t\trefQueue = [],\n\t\t\tnewVNode = assign({}, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tcomponent._parentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tcomponent._parentDom.namespaceURI,\n\t\t\toldVNode._flags & MODE_HYDRATE ? [oldDom] : NULL,\n\t\t\tcommitQueue,\n\t\t\toldDom == NULL ? getDomSibling(oldVNode) : oldDom,\n\t\t\t!!(oldVNode._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._dom = oldVNode._parent = 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\tif ((vnode = vnode._parent) != NULL && vnode._component != NULL) {\n\t\tvnode._dom = vnode._component.base = NULL;\n\t\tvnode._children.some(child => {\n\t\t\tif (child != NULL && child._dom != NULL) {\n\t\t\t\treturn (vnode._dom = vnode._component.base = child._dom);\n\t\t\t}\n\t\t});\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array<import('./internal').Component>}\n */\nlet 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\nconst defer =\n\ttypeof Promise == 'function'\n\t\t? Promise.prototype.then.bind(Promise.resolve())\n\t\t: setTimeout;\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._dirty &&\n\t\t\t(c._dirty = true) &&\n\t\t\trerenderQueue.push(c) &&\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce != options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || defer)(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\trenderComponent(c);\n\t\t}\n\t} finally {\n\t\trerenderQueue.length = process._rerenderCount = 0;\n\t}\n}\n\nprocess._rerenderCount = 0;\n","import { IS_NON_DIMENSIONAL, NULL, SVG_NAMESPACE } from '../constants';\nimport options from '../options';\n\n// Per-instance unique key for event clock stamps. Each Preact copy on the page\n// gets its own random suffix so that `_dispatched` / `_attached` properties on\n// shared event objects and handler functions cannot collide across instances.\n// ~1 in 60M collision odds - if you have that many praect versions on the page,\n// you deserve some weird bugs.\n// In 11 we can replace this with a\n// Symbol\nlet _id = Math.random().toString(8),\n\tEVENT_DISPATCHED = '__d' + _id,\n\tEVENT_ATTACHED = '__a' + _id;\n\nfunction setStyle(style, key, value) {\n\tif (key[0] == '-') {\n\t\tstyle.setProperty(key, value == NULL ? '' : value);\n\t} else if (value == NULL) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\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\t\tconst lowerCaseName = name.toLowerCase();\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (lowerCaseName in dom || name == 'onFocusOut' || name == 'onFocusIn')\n\t\t\tname = lowerCaseName.slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._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 { NULL } 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.componentWillUnmount = () => {\n\t\t\t\tsubs = NULL;\n\t\t\t};\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._force = true;\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\tif (subs) {\n\t\t\t\t\t\tsubs.delete(c);\n\t\t\t\t\t}\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\t// we could also get rid of _contextRef entirely\n\tContext.Provider =\n\t\tContext._contextRef =\n\t\tContext.Consumer.contextType =\n\t\t\tContext;\n\n\treturn Context;\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\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 */\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!=null && oldParentVNode != EMPTY_OBJ && oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\t/** @type {VNode[]} */\n\tlet oldChildren = (oldParentVNode && 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\toldVNode =\n\t\t\t(childVNode._index != -1 && 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\tif (childVNode.ref && oldVNode.ref != childVNode.ref) {\n\t\t\tif (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\tif (firstChildDom == NULL && newDom != NULL) {\n\t\t\tfirstChildDom = newDom;\n\t\t}\n\n\t\tif (childVNode._flags & INSERT_VNODE) {\n\t\t\toldDom = insert(childVNode, oldDom, parentDom);\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\tnewParentVNode._children = new 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\tnewParentVNode._children[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\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tNULL,\n\t\t\t\tchildVNode,\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (childVNode.constructor === UNDEFINED && childVNode._depth > 0) {\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 = newParentVNode._children[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 ? childVNode.ref : NULL,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tnewParentVNode._children[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\tif (matchingIndex != -1) {\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\tconst isMounting = oldVNode == NULL || oldVNode._original == NULL;\n\n\t\tif (isMounting) {\n\t\t\tif (matchingIndex == -1) {\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 if (matchingIndex != skewedIndex) {\n\t\t\t// When we move elements around i.e. [0, 1, 2] --> [1, 0, 2]\n\t\t\t// --> we diff 1, we find it at position 1 while our skewed index is 0 and our skew is 0\n\t\t\t// we set the skew to 1 as we found an offset.\n\t\t\t// --> we diff 0, we find it at position 0 while our skewed index is at 2 and our skew is 1\n\t\t\t// this makes us increase the skew again.\n\t\t\t// --> we diff 2, we find it at position 2 while our skewed index is at 4 and our skew is 2\n\t\t\t//\n\t\t\t// this becomes an optimization question where currently we see a 1 element offset as an insertion\n\t\t\t// or deletion i.e. we optimize for [0, 1, 2] --> [9, 0, 1, 2]\n\t\t\t// while a more than 1 offset we see as a swap.\n\t\t\t// We could probably build heuristics for having an optimized course of action here as well, but\n\t\t\t// might go at the cost of some bytes.\n\t\t\t//\n\t\t\t// If we wanted to optimize for i.e. only swaps we'd just do the last two code-branches and have\n\t\t\t// only the first item be a re-scouting and all the others fall in their skewed counter-part.\n\t\t\t// We could also further optimize for swaps\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 {\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\t// Move this VNode's DOM if the original index (matchingIndex) doesn't\n\t\t\t\t// match the new skew index (i + new skew)\n\t\t\t\t// In the former two branches we know that it matches after skewing\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\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.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i < oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode != NULL && (oldVNode._flags & MATCHED) == 0) {\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 * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\n\tif (typeof parentVNode.type == 'function') {\n\t\tlet children = parentVNode._children;\n\t\tfor (let i = 0; children && i < children.length; i++) {\n\t\t\tif (children[i]) {\n\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t// here).\n\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\toldDom = insert(children[i], oldDom, parentDom);\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else if (parentVNode._dom != oldDom) {\n\t\tif (oldDom && parentVNode.type && !oldDom.parentNode) {\n\t\t\toldDom = getDomSibling(parentVNode);\n\t\t}\n\t\toldDom = parentDom.insertBefore(parentVNode._dom, oldDom || NULL);\n\t}\n\n\tdo {\n\t\toldDom = oldDom && oldDom.nextSibling;\n\t} while (oldDom != NULL && 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} else if (isArray(children)) {\n\t\tchildren.some(child => {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\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 != NULL && (oldVNode._flags & MATCHED) == 0;\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\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 != NULL &&\n\t\t\t\t(oldVNode._flags & MATCHED) == 0 &&\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 {\n\tEMPTY_ARR,\n\tEMPTY_OBJ,\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 { BaseComponent, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport options from '../options';\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 * @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\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.\n\tif (oldVNode._flags & MODE_SUSPENDED) {\n\t\tisHydrating = !!(oldVNode._flags & MODE_HYDRATE);\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\texcessDomChildren = [oldDom];\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, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\t\t\tconst isClassComponent = newType.prototype && newType.prototype.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\tlet provider = tmp && globalContext[tmp._id];\n\t\t\tlet 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\tclearProcessingException = c._processingException = c._pendingError;\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 The check above verifies that newType is suppose to be constructed\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\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\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (isClassComponent && c._nextState == NULL) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (isClassComponent && newType.getDerivedStateFromProps != NULL) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\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 (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent &&\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tc.componentWillMount != NULL\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 != NULL) {\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\tnewType.getDerivedStateFromProps == NULL &&\n\t\t\t\t\tnewProps !== oldProps &&\n\t\t\t\t\tc.componentWillReceiveProps != NULL\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\tnewVNode._original == oldVNode._original ||\n\t\t\t\t\t(!c._force &&\n\t\t\t\t\t\tc.shouldComponentUpdate != NULL &&\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._dirty = false;\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 != NULL) {\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 != NULL) {\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._force = false;\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._dirty = false;\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._dirty = false;\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._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 != NULL) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (isClassComponent && !isNew && c.getSnapshotBeforeUpdate != NULL) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet renderResult =\n\t\t\t\ttmp != NULL && tmp.type === Fragment && tmp.key == NULL\n\t\t\t\t\t? cloneNode(tmp.props.children)\n\t\t\t\t\t: tmp;\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\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags &= RESET_MODE;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = NULL;\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 != NULL) {\n\t\t\t\tif (e.then) {\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\twhile (oldDom && oldDom.nodeType == 8 && oldDom.nextSibling) {\n\t\t\t\t\t\toldDom = oldDom.nextSibling;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (excessDomChildren != NULL) {\n\t\t\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = NULL;\n\t\t\t\t\t}\n\t\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\t} else if (excessDomChildren != NULL) {\n\t\t\t\t\tfor (let i = excessDomChildren.length; i--; ) {\n\t\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t\t}\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 == NULL) {\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 if (\n\t\texcessDomChildren == NULL &&\n\t\tnewVNode._original == oldVNode._original\n\t) {\n\t\tnewVNode._children = oldVNode._children;\n\t\tnewVNode._dom = oldVNode._dom;\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);\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._force = true;\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; i++) {\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\nfunction cloneNode(node) {\n\tif (typeof node != 'object' || node == NULL || node._depth > 0) {\n\t\treturn node;\n\t}\n\n\tif (isArray(node)) {\n\t\treturn node.map(cloneNode);\n\t}\n\n\tif (node.constructor !== UNDEFINED) return null;\n\n\treturn assign({}, node);\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 * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue\n) {\n\tlet oldProps = oldVNode.props || EMPTY_OBJ;\n\tlet newProps = newVNode.props;\n\tlet 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 != NULL) {\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\tif (\n\t\t\t\tvalue &&\n\t\t\t\t'setAttribute' in value == !!nodeType &&\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 == NULL) {\n\t\tif (nodeType == NULL) {\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tdom = document.createElementNS(\n\t\t\tnamespace,\n\t\t\tnodeType,\n\t\t\tnewProps.is && newProps\n\t\t);\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 == NULL) {\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// 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(dom.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 != NULL) {\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\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\toldProps[i] !== value\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.innerHTML = '';\n\n\t\t\tdiffChildren(\n\t\t\t\t// @ts-expect-error\n\t\t\t\tnewVNode.type == 'template' ? dom.content : dom,\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\tnodeType == 'foreignObject' ? XHTML_NAMESPACE : namespace,\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 != NULL) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\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('value');\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] ||\n\t\t\t\t\t(nodeType == 'progress' && !inputValue) ||\n\t\t\t\t\t// This is only for IE 11 to fix <select> value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType == 'option' && inputValue != oldProps[i]))\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\tlet hasRefUnmount = typeof ref._unmount == 'function';\n\t\t\tif (hasRefUnmount) {\n\t\t\t\t// @ts-ignore TS doesn't like moving narrowing checks into variables\n\t\t\t\tref._unmount();\n\t\t\t}\n\n\t\t\tif (!hasRefUnmount || value != NULL) {\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)) {\n\t\tif (!r.current || r.current == vnode._dom) {\n\t\t\tapplyRef(r, NULL, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != NULL) {\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.base = r._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\tskipRemove || typeof vnode.type != 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\tvnode._component = vnode._parent = vnode._dom = UNDEFINED;\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, NULL } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, 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 * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\t// https://github.com/preactjs/preact/issues/3794\n\tif (parentDom == document) {\n\t\tparentDom = document.documentElement;\n\t}\n\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode == 'function';\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\n\t\t? NULL\n\t\t: (replaceNode && replaceNode._children) || parentDom._children;\n\n\tvnode = ((!isHydrating && replaceNode) || parentDom)._children =\n\t\tcreateElement(Fragment, NULL, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [],\n\t\trefQueue = [];\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\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.namespaceURI,\n\t\t!isHydrating && replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t\t? NULL\n\t\t\t\t: parentDom.firstChild\n\t\t\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t\t\t: NULL,\n\t\tcommitQueue,\n\t\t!isHydrating && replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t\t? oldVNode._dom\n\t\t\t\t: parentDom.firstChild,\n\t\tisHydrating,\n\t\trefQueue\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode, refQueue);\n\n\t// The live children are tracked on _children after diffing.\n\tvnode.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\trender(vnode, parentDom, hydrate);\n}\n","import { assign, slice } from './util';\nimport { createVNode } from './create-element';\nimport { NULL, UNDEFINED } from './constants';\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>} rest 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\n\tlet defaultProps;\n\n\tif (vnode.type && vnode.type.defaultProps) {\n\t\tdefaultProps = vnode.type.defaultProps;\n\t}\n\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse if (props[i] === UNDEFINED && defaultProps != UNDEFINED) {\n\t\t\tnormalizedProps[i] = defaultProps[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tif (arguments.length > 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length > 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(\n\t\tvnode.type,\n\t\tnormalizedProps,\n\t\tkey || vnode.key,\n\t\tref || vnode.ref,\n\t\tNULL\n\t);\n}\n","import { NULL } 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 {boolean} */\n\t\thandled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) && !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor && ctor.getDerivedStateFromError != NULL) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != NULL) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = 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\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n","import { options as _options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\n// Cast to use internal Options type\nconst options = /** @type {import('./internal').Options} */ (_options);\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\nlet oldRoot = options._root;\n\n// We take the minimum timeout for requestAnimationFrame to ensure that\n// the callback is invoked after the next frame. 35ms is based on a 30hz\n// refresh rate, which is the minimum rate for a smooth user experience.\nconst RAF_TIMEOUT = 35;\nlet prevRaf;\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._root = (vnode, parentDom) => {\n\tif (vnode && parentDom._children && parentDom._children._mask) {\n\t\tvnode._mask = parentDom._children._mask;\n\t}\n\n\tif (oldRoot) oldRoot(vnode, parentDom);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.some(hookItem => {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingArgs = hookItem._nextValue = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.some(invokeCleanup);\n\t\t\thooks._pendingEffects.some(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentIndex = 0;\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.some(hookItem => {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t\thookItem._pendingArgs = undefined;\n\t\t\t}\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\n// TODO: Improve typing of commitQueue parameter\n/** @type {(vnode: import('./internal').VNode, commitQueue: any) => void} */\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.some(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.some(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\n\treturn hooks._list[index];\n}\n\n/**\n * @template {unknown} S\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} [initialState]\n * @returns {[S, (state: S) => void]}\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @template {unknown} S\n * @template {unknown} A\n * @param {import('./index').Reducer<S, A>} reducer\n * @param {import('./index').Dispatch<import('./index').StateUpdater<S>>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ S, (state: S) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tlet prevScu = currentComponent.shouldComponentUpdate;\n\t\t\tconst prevCWU = currentComponent.componentWillUpdate;\n\n\t\t\t// If we're dealing with a forced update `shouldComponentUpdate` will\n\t\t\t// not be called. But we use that to update the hook values, so we\n\t\t\t// need to call it.\n\t\t\tcurrentComponent.componentWillUpdate = function (p, s, c) {\n\t\t\t\tif (this._force) {\n\t\t\t\t\tlet tmp = prevScu;\n\t\t\t\t\t// Clear to avoid other sCU hooks from being called\n\t\t\t\t\tprevScu = undefined;\n\t\t\t\t\tupdateHookState(p, s, c);\n\t\t\t\t\tprevScu = tmp;\n\t\t\t\t}\n\n\t\t\t\tif (prevCWU) prevCWU.call(this, p, s, c);\n\t\t\t};\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\t/**\n\t\t\t *\n\t\t\t * @type {import('./internal').Component[\"shouldComponentUpdate\"]}\n\t\t\t */\n\t\t\t// @ts-ignore - We don't use TS to downtranspile\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction updateHookState(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet updatedHook = false;\n\t\t\t\tlet shouldUpdate = hookState._component.props !== p;\n\t\t\t\thookState._component.__hooks._list.some(hookItem => {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tupdatedHook = true;\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (prevScu) {\n\t\t\t\t\tconst result = prevScu.call(this, p, s, c);\n\t\t\t\t\treturn updatedHook ? result || shouldUpdate : result;\n\t\t\t\t}\n\n\t\t\t\treturn !updatedHook || shouldUpdate;\n\t\t\t}\n\n\t\t\tcurrentComponent.shouldComponentUpdate = updateHookState;\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\n/** @type {(initialValue: unknown) => unknown} */\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tconst result = ref(createHandle());\n\t\t\t\treturn () => {\n\t\t\t\t\tref(null);\n\t\t\t\t\tif (result && typeof result == 'function') result();\n\t\t\t\t};\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @template {unknown} T\n * @param {() => T} factory\n * @param {unknown[]} args\n * @returns {T}\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState<T>} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {unknown[]} args\n * @returns {() => void}\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(\n\t\t\tformatter ? formatter(value) : /** @type {any}*/ (value)\n\t\t);\n\t}\n}\n\n/**\n * @param {(error: unknown, errorInfo: import('preact').ErrorInfo) => void} cb\n * @returns {[unknown, () => void]}\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) => {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/** @type {() => string} */\nexport function useId() {\n\t/** @type {import('./internal').IdHookState} */\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\t// Grab either the root node or the nearest async boundary node.\n\t\t/** @type {import('./internal').VNode} */\n\t\tlet root = currentComponent._vnode;\n\t\twhile (root !== null && !root._mask && root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\tlet mask = root._mask || (root._mask = [0, 0]);\n\t\tstate._value = 'P' + mask[0] + '-' + mask[1]++;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tconst hooks = component.__hooks;\n\t\tif (!component._parentDom || !hooks) continue;\n\t\ttry {\n\t\t\thooks._pendingEffects.some(invokeCleanup);\n\t\t\thooks._pendingEffects.some(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\thooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n * @returns {void}\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').HookState} hook\n * @returns {void}\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n * @returns {void}\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {unknown[]} oldArgs\n * @param {unknown[]} newArgs\n * @returns {boolean}\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\n/**\n * @template Arg\n * @param {Arg} arg\n * @param {(arg: Arg) => any} f\n * @returns {any}\n */\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n","/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O & P}\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O & P} */ (obj);\n}\n\n/**\n * Check if two objects have a different shape\n * @param {object} a\n * @param {object} b\n * @returns {boolean}\n */\nexport function shallowDiffers(a, b) {\n\tfor (let i in a) if (i !== '__source' && !(i in b)) return true;\n\tfor (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;\n\treturn false;\n}\n\n/**\n * Check if two values are the same value\n * @param {*} x\n * @param {*} y\n * @returns {boolean}\n */\nexport function is(x, y) {\n\treturn (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\n","import { useState, useLayoutEffect, useEffect } from 'preact/hooks';\nimport { is } from './util';\n\n/**\n * This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84\n * on a high level this cuts out the warnings, ... and attempts a smaller implementation\n * @typedef {{ _value: any; _getSnapshot: () => any }} Store\n */\nexport function useSyncExternalStore(subscribe, getSnapshot) {\n\tconst value = getSnapshot();\n\n\t/**\n\t * @typedef {{ _instance: Store }} StoreRef\n\t * @type {[StoreRef, (store: StoreRef) => void]}\n\t */\n\tconst [{ _instance }, forceUpdate] = useState({\n\t\t_instance: { _value: value, _getSnapshot: getSnapshot }\n\t});\n\n\tuseLayoutEffect(() => {\n\t\t_instance._value = value;\n\t\t_instance._getSnapshot = getSnapshot;\n\n\t\tif (didSnapshotChange(_instance)) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\t}, [subscribe, value, getSnapshot]);\n\n\tuseEffect(() => {\n\t\tif (didSnapshotChange(_instance)) {\n\t\t\tforceUpdate({ _instance });\n\t\t}\n\n\t\treturn subscribe(() => {\n\t\t\tif (didSnapshotChange(_instance)) {\n\t\t\t\tforceUpdate({ _instance });\n\t\t\t}\n\t\t});\n\t}, [subscribe]);\n\n\treturn value;\n}\n\n/** @type {(inst: Store) => boolean} */\nfunction didSnapshotChange(inst) {\n\ttry {\n\t\treturn !is(inst._value, inst._getSnapshot());\n\t} catch (error) {\n\t\treturn true;\n\t}\n}\n\nexport function startTransition(cb) {\n\tcb();\n}\n\nexport function useDeferredValue(val) {\n\treturn val;\n}\n\nexport function useTransition() {\n\treturn [false, startTransition];\n}\n\n// TODO: in theory this should be done after a VNode is diffed as we want to insert\n// styles/... before it attaches\nexport const useInsertionEffect = useLayoutEffect;\n","import { Component } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Component class with a predefined `shouldComponentUpdate` implementation\n */\nexport function PureComponent(p, c) {\n\tthis.props = p;\n\tthis.context = c;\n}\nPureComponent.prototype = new Component();\n// Some third-party libraries check if this property is present\nPureComponent.prototype.isPureReactComponent = true;\nPureComponent.prototype.shouldComponentUpdate = function (props, state) {\n\treturn shallowDiffers(this.props, props) || shallowDiffers(this.state, state);\n};\n","import { createElement } from 'preact';\nimport { shallowDiffers } from './util';\n\n/**\n * Memoize a component, so that it only updates when the props actually have\n * changed. This was previously known as `React.pure`.\n * @param {import('./internal').FunctionComponent} c functional component\n * @param {(prev: object, next: object) => boolean} [comparer] Custom equality function\n * @returns {import('./internal').FunctionComponent}\n */\nexport function memo(c, comparer) {\n\tfunction shouldUpdate(nextProps) {\n\t\tlet ref = this.props.ref;\n\t\tif (ref != nextProps.ref && ref) {\n\t\t\ttypeof ref == 'function' ? ref(null) : (ref.current = null);\n\t\t}\n\n\t\treturn comparer\n\t\t\t? !comparer(this.props, nextProps) || ref != nextProps.ref\n\t\t\t: shallowDiffers(this.props, nextProps);\n\t}\n\n\tfunction Memoed(props) {\n\t\tthis.shouldComponentUpdate = shouldUpdate;\n\t\treturn createElement(c, props);\n\t}\n\tMemoed.displayName = 'Memo(' + (c.displayName || c.name) + ')';\n\tMemoed._forwarded = Memoed.prototype.isReactComponent = true;\n\tMemoed.type = c;\n\treturn Memoed;\n}\n","import { options } from 'preact';\nimport { assign } from './util';\n\nlet oldDiffHook = options._diff;\noptions._diff = vnode => {\n\tif (vnode.type && vnode.type._forwarded && vnode.ref) {\n\t\tvnode.props.ref = vnode.ref;\n\t\tvnode.ref = null;\n\t}\n\tif (oldDiffHook) oldDiffHook(vnode);\n};\n\nexport const REACT_FORWARD_SYMBOL =\n\t(typeof Symbol != 'undefined' &&\n\t\tSymbol.for &&\n\t\tSymbol.for('react.forward_ref')) ||\n\t0xf47;\n\n/**\n * Pass ref down to a child. This is mainly used in libraries with HOCs that\n * wrap components. Using `forwardRef` there is an easy way to get a reference\n * of the wrapped component instead of one of the wrapper itself.\n * @param {import('./index').ForwardFn} fn\n * @returns {import('./internal').FunctionComponent}\n */\nexport function forwardRef(fn) {\n\tfunction Forwarded(props) {\n\t\tlet clone = assign({}, props);\n\t\tdelete clone.ref;\n\t\treturn fn(clone, props.ref || null);\n\t}\n\n\t// mobx-react checks for this being present\n\tForwarded.$$typeof = REACT_FORWARD_SYMBOL;\n\t// mobx-react heavily relies on implementation details.\n\t// It expects an object here with a `render` property,\n\t// and prototype.render will fail. Without this\n\t// mobx-react throws.\n\tForwarded.render = fn;\n\n\tForwarded.prototype.isReactComponent = Forwarded._forwarded = true;\n\tForwarded.displayName = 'ForwardRef(' + (fn.displayName || fn.name) + ')';\n\treturn Forwarded;\n}\n","import { toChildArray } from 'preact';\n\nconst mapFn = (children, fn) => {\n\tif (children == null) return null;\n\treturn toChildArray(toChildArray(children).map(fn));\n};\n\n// This API is completely unnecessary for Preact, so it's basically passthrough.\nexport const Children = {\n\tmap: mapFn,\n\tforEach: mapFn,\n\tcount(children) {\n\t\treturn children ? toChildArray(children).length : 0;\n\t},\n\tonly(children) {\n\t\tconst normalized = toChildArray(children);\n\t\tif (normalized.length !== 1) throw 'Children.only';\n\t\treturn normalized[0];\n\t},\n\ttoArray: toChildArray\n};\n","import { Component, createElement, options, Fragment } from 'preact';\nimport { MODE_HYDRATE } from '../../src/constants';\nimport { assign } from './util';\n\nconst oldCatchError = options._catchError;\noptions._catchError = function (error, newVNode, oldVNode, errorInfo) {\n\tif (error.then) {\n\t\t/** @type {import('./internal').Component} */\n\t\tlet component;\n\t\tlet vnode = newVNode;\n\n\t\tfor (; (vnode = vnode._parent); ) {\n\t\t\tif ((component = vnode._component) && component._childDidSuspend) {\n\t\t\t\tif (newVNode._dom == null) {\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children || [];\n\t\t\t\t}\n\t\t\t\t// Don't call oldCatchError if we found a Suspense\n\t\t\t\treturn component._childDidSuspend(error, newVNode);\n\t\t\t}\n\t\t}\n\t}\n\toldCatchError(error, newVNode, oldVNode, errorInfo);\n};\n\nconst oldUnmount = options.unmount;\noptions.unmount = function (vnode) {\n\t/** @type {import('./internal').Component} */\n\tconst component = vnode._component;\n\tif (component) component._unmounted = true;\n\tif (component && component._onResolve) {\n\t\tcomponent._onResolve();\n\t}\n\n\t// if the component is still hydrating\n\t// most likely it is because the component is suspended\n\t// we set the vnode.type as `null` so that it is not a typeof function\n\t// so the unmount will remove the vnode._dom\n\tif (component && vnode._flags & MODE_HYDRATE) {\n\t\tvnode.type = null;\n\t}\n\n\tif (oldUnmount) oldUnmount(vnode);\n};\n\nfunction detachedClone(vnode, detachedParent, parentDom) {\n\tif (vnode) {\n\t\tif (vnode._component && vnode._component.__hooks) {\n\t\t\tvnode._component.__hooks._list.forEach(effect => {\n\t\t\t\tif (typeof effect._cleanup == 'function') effect._cleanup();\n\t\t\t});\n\n\t\t\tvnode._component.__hooks = null;\n\t\t}\n\n\t\tvnode = assign({}, vnode);\n\t\tif (vnode._component != null) {\n\t\t\tif (vnode._component._parentDom === parentDom) {\n\t\t\t\tvnode._component._parentDom = detachedParent;\n\t\t\t}\n\n\t\t\tvnode._component._force = true;\n\n\t\t\tvnode._component = null;\n\t\t}\n\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tdetachedClone(child, detachedParent, parentDom)\n\t\t\t);\n\t}\n\n\treturn vnode;\n}\n\nfunction removeOriginal(vnode, detachedParent, originalParent) {\n\tif (vnode && originalParent) {\n\t\tvnode._original = null;\n\t\tvnode._children =\n\t\t\tvnode._children &&\n\t\t\tvnode._children.map(child =>\n\t\t\t\tremoveOriginal(child, detachedParent, originalParent)\n\t\t\t);\n\n\t\tif (vnode._component) {\n\t\t\tif (vnode._component._parentDom === detachedParent) {\n\t\t\t\tif (vnode._dom) {\n\t\t\t\t\toriginalParent.appendChild(vnode._dom);\n\t\t\t\t}\n\t\t\t\tvnode._component._force = true;\n\t\t\t\tvnode._component._parentDom = originalParent;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn vnode;\n}\n\n// having custom inheritance instead of a class here saves a lot of bytes\nexport function Suspense() {\n\t// we do not call super here to golf some bytes...\n\tthis._pendingSuspensionCount = 0;\n\tthis._suspenders = null;\n\tthis._detachOnNextRender = null;\n}\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspense.prototype = new Component();\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {Promise} promise The thrown promise\n * @param {import('./internal').VNode<any, any>} suspendingVNode The suspending component\n */\nSuspense.prototype._childDidSuspend = function (promise, suspendingVNode) {\n\tconst suspendingComponent = suspendingVNode._component;\n\n\t/** @type {import('./internal').SuspenseComponent} */\n\tconst c = this;\n\n\tif (c._suspenders == null) {\n\t\tc._suspenders = [];\n\t}\n\tc._suspenders.push(suspendingComponent);\n\n\tconst resolve = suspended(c._vnode);\n\n\tlet resolved = false;\n\tconst onResolved = () => {\n\t\tif (resolved || c._unmounted) return;\n\n\t\tresolved = true;\n\t\tsuspendingComponent._onResolve = null;\n\n\t\tif (resolve) {\n\t\t\tresolve(onSuspensionComplete);\n\t\t} else {\n\t\t\tonSuspensionComplete();\n\t\t}\n\t};\n\n\tsuspendingComponent._onResolve = onResolved;\n\n\t// Store and null _parentDom to prevent setState/forceUpdate from\n\t// scheduling renders while suspended. Render would be a no-op anyway\n\t// since renderComponent checks _parentDom, but this avoids queue churn.\n\tconst originalParentDom = suspendingComponent._parentDom;\n\tsuspendingComponent._parentDom = null;\n\n\tconst onSuspensionComplete = () => {\n\t\tif (!--c._pendingSuspensionCount) {\n\t\t\t// If the suspension was during hydration we don't need to restore the\n\t\t\t// suspended children into the _children array\n\t\t\tif (c.state._suspended) {\n\t\t\t\tconst suspendedVNode = c.state._suspended;\n\t\t\t\tc._vnode._children[0] = removeOriginal(\n\t\t\t\t\tsuspendedVNode,\n\t\t\t\t\tsuspendedVNode._component._parentDom,\n\t\t\t\t\tsuspendedVNode._component._originalParentDom\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tc.setState({ _suspended: (c._detachOnNextRender = null) });\n\n\t\t\tlet suspended;\n\t\t\twhile ((suspended = c._suspenders.pop())) {\n\t\t\t\t// Restore _parentDom before forceUpdate so render can proceed\n\t\t\t\tsuspended._parentDom = originalParentDom;\n\t\t\t\tsuspended.forceUpdate();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * We do not set `suspended: true` during hydration because we want the actual markup\n\t * to remain on screen and hydrate it when the suspense actually gets resolved.\n\t * While in non-hydration cases the usual fallback -> component flow would occour.\n\t */\n\tif (\n\t\t!c._pendingSuspensionCount++ &&\n\t\t!(suspendingVNode._flags & MODE_HYDRATE)\n\t) {\n\t\tc.setState({ _suspended: (c._detachOnNextRender = c._vnode._children[0]) });\n\t}\n\tpromise.then(onResolved, onResolved);\n};\n\nSuspense.prototype.componentWillUnmount = function () {\n\tthis._suspenders = [];\n};\n\n/**\n * @this {import('./internal').SuspenseComponent}\n * @param {import('./internal').SuspenseComponent[\"props\"]} props\n * @param {import('./internal').SuspenseState} state\n */\nSuspense.prototype.render = function (props, state) {\n\tif (this._detachOnNextRender) {\n\t\t// When the Suspense's _vnode was created by a call to createVNode\n\t\t// (i.e. due to a setState further up in the tree)\n\t\t// it's _children prop is null, in this case we \"forget\" about the parked vnodes to detach\n\t\tif (this._vnode._children) {\n\t\t\tconst detachedParent = document.createElement('div');\n\t\t\tconst detachedComponent = this._vnode._children[0]._component;\n\t\t\tthis._vnode._children[0] = detachedClone(\n\t\t\t\tthis._detachOnNextRender,\n\t\t\t\tdetachedParent,\n\t\t\t\t(detachedComponent._originalParentDom = detachedComponent._parentDom)\n\t\t\t);\n\t\t}\n\n\t\tthis._detachOnNextRender = null;\n\t}\n\n\t// Wrap fallback tree in a VNode that prevents itself from being marked as aborting mid-hydration:\n\t/** @type {import('./internal').VNode} */\n\tconst fallback =\n\t\tstate._suspended && createElement(Fragment, null, props.fallback);\n\tif (fallback) fallback._flags &= ~MODE_HYDRATE;\n\n\treturn [\n\t\tcreateElement(Fragment, null, state._suspended ? null : props.children),\n\t\tfallback\n\t];\n};\n\n/**\n * Checks and calls the parent component's _suspended method, passing in the\n * suspended vnode. This is a way for a parent (e.g. SuspenseList) to get notified\n * that one of its children/descendants suspended.\n *\n * The parent MAY return a callback. The callback will get called when the\n * suspension resolves, notifying the parent of the fact.\n * Moreover, the callback gets function `unsuspend` as a parameter. The resolved\n * child descendant will not actually get unsuspended until `unsuspend` gets called.\n * This is a way for the parent to delay unsuspending.\n *\n * If the parent does not return a callback then the resolved vnode\n * gets unsuspended immediately when it resolves.\n *\n * @param {import('./internal').VNode} vnode\n * @returns {((unsuspend: () => void) => void)?}\n */\nexport function suspended(vnode) {\n\tlet component = vnode._parent && vnode._parent._component;\n\treturn component && component._suspended && component._suspended(vnode);\n}\n\nexport function lazy(loader) {\n\tlet prom;\n\tlet component = null;\n\tlet error;\n\tlet resolved;\n\n\tfunction Lazy(props) {\n\t\tif (!prom) {\n\t\t\tprom = loader();\n\t\t\tprom.then(\n\t\t\t\texports => {\n\t\t\t\t\tif (exports) {\n\t\t\t\t\t\tcomponent = exports.default || exports;\n\t\t\t\t\t}\n\t\t\t\t\tresolved = true;\n\t\t\t\t},\n\t\t\t\te => {\n\t\t\t\t\terror = e;\n\t\t\t\t\tresolved = true;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!resolved) {\n\t\t\tthrow prom;\n\t\t}\n\n\t\treturn component ? createElement(component, props) : null;\n\t}\n\n\tLazy.displayName = 'Lazy';\n\tLazy._forwarded = true;\n\treturn Lazy;\n}\n","import { Component, toChildArray } from 'preact';\nimport { suspended } from './suspense.js';\n\n// Indexes to linked list nodes (nodes are stored as arrays to save bytes).\nconst SUSPENDED_COUNT = 0;\nconst RESOLVED_COUNT = 1;\nconst NEXT_NODE = 2;\n\n// Having custom inheritance instead of a class here saves a lot of bytes.\nexport function SuspenseList() {\n\tthis._next = null;\n\tthis._map = null;\n}\n\n// Mark one of child's earlier suspensions as resolved.\n// Some pending callbacks may become callable due to this\n// (e.g. the last suspended descendant gets resolved when\n// revealOrder === 'together'). Process those callbacks as well.\nconst resolve = (list, child, node) => {\n\tif (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {\n\t\t// The number a child (or any of its descendants) has been suspended\n\t\t// matches the number of times it's been resolved. Therefore we\n\t\t// mark the child as completely resolved by deleting it from ._map.\n\t\t// This is used to figure out when *all* children have been completely\n\t\t// resolved when revealOrder is 'together'.\n\t\tlist._map.delete(child);\n\t}\n\n\t// If revealOrder is falsy then we can do an early exit, as the\n\t// callbacks won't get queued in the node anyway.\n\t// If revealOrder is 'together' then also do an early exit\n\t// if all suspended descendants have not yet been resolved.\n\tif (\n\t\t!list.props.revealOrder ||\n\t\t(list.props.revealOrder[0] === 't' && list._map.size)\n\t) {\n\t\treturn;\n\t}\n\n\t// Walk the currently suspended children in order, calling their\n\t// stored callbacks on the way. Stop if we encounter a child that\n\t// has not been completely resolved yet.\n\tnode = list._next;\n\twhile (node) {\n\t\twhile (node.length > 3) {\n\t\t\tnode.pop()();\n\t\t}\n\t\tif (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {\n\t\t\tbreak;\n\t\t}\n\t\tlist._next = node = node[NEXT_NODE];\n\t}\n};\n\n// Things we do here to save some bytes but are not proper JS inheritance:\n// - call `new Component()` as the prototype\n// - do not set `Suspense.prototype.constructor` to `Suspense`\nSuspenseList.prototype = new Component();\n\nSuspenseList.prototype._suspended = function (child) {\n\tconst list = this;\n\tconst delegated = suspended(list._vnode);\n\n\tlet node = list._map.get(child);\n\tnode[SUSPENDED_COUNT]++;\n\n\treturn unsuspend => {\n\t\tconst wrappedUnsuspend = () => {\n\t\t\tif (!list.props.revealOrder) {\n\t\t\t\t// Special case the undefined (falsy) revealOrder, as there\n\t\t\t\t// is no need to coordinate a specific order or unsuspends.\n\t\t\t\tunsuspend();\n\t\t\t} else {\n\t\t\t\tnode.push(unsuspend);\n\t\t\t\tresolve(list, child, node);\n\t\t\t}\n\t\t};\n\t\tif (delegated) {\n\t\t\tdelegated(wrappedUnsuspend);\n\t\t} else {\n\t\t\twrappedUnsuspend();\n\t\t}\n\t};\n};\n\nSuspenseList.prototype.render = function (props) {\n\tthis._next = null;\n\tthis._map = new Map();\n\n\tconst children = toChildArray(props.children);\n\tif (props.revealOrder && props.revealOrder[0] === 'b') {\n\t\t// If order === 'backwards' (or, well, anything starting with a 'b')\n\t\t// then flip the child list around so that the last child will be\n\t\t// the first in the linked list.\n\t\tchildren.reverse();\n\t}\n\t// Build the linked list. Iterate through the children in reverse order\n\t// so that `_next` points to the first linked list node to be resolved.\n\tfor (let i = children.length; i--; ) {\n\t\t// Create a new linked list node as an array of form:\n\t\t// \t[suspended_count, resolved_count, next_node]\n\t\t// where suspended_count and resolved_count are numeric counters for\n\t\t// keeping track how many times a node has been suspended and resolved.\n\t\t//\n\t\t// Note that suspended_count starts from 1 instead of 0, so we can block\n\t\t// processing callbacks until componentDidMount has been called. In a sense\n\t\t// node is suspended at least until componentDidMount gets called!\n\t\t//\n\t\t// Pending callbacks are added to the end of the node:\n\t\t// \t[suspended_count, resolved_count, next_node, callback_0, callback_1, ...]\n\t\tthis._map.set(children[i], (this._next = [1, 0, this._next]));\n\t}\n\treturn props.children;\n};\n\nSuspenseList.prototype.componentDidUpdate =\n\tSuspenseList.prototype.componentDidMount = function () {\n\t\t// Iterate through all children after mounting for two reasons:\n\t\t// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases\n\t\t// each node[RELEASED_COUNT] by 1, therefore balancing the counters.\n\t\t// The nodes can now be completely consumed from the linked list.\n\t\t// 2. Handle nodes that might have gotten resolved between render and\n\t\t// componentDidMount.\n\t\tthis._map.forEach((node, child) => {\n\t\t\tresolve(this, child, node);\n\t\t});\n\t};\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\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 = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { createElement, render } from 'preact';\n\n/**\n * @param {import('../../src/index').RenderableProps<{ context: any }>} props\n */\nfunction ContextProvider(props) {\n\tthis.getChildContext = () => props.context;\n\treturn props.children;\n}\n\n/**\n * Portal component\n * @this {import('./internal').Component}\n * @param {object | null | undefined} props\n *\n * TODO: use createRoot() instead of fake root\n */\nfunction Portal(props) {\n\tconst _this = this;\n\tlet container = props._container;\n\n\t_this.componentWillUnmount = function () {\n\t\trender(null, _this._temp);\n\t\t_this._temp = null;\n\t\t_this._container = null;\n\t};\n\n\t// When we change container we should clear our old container and\n\t// indicate a new mount.\n\tif (_this._container && _this._container !== container) {\n\t\t_this.componentWillUnmount();\n\t}\n\n\tif (!_this._temp) {\n\t\t// Ensure the element has a mask for useId invocations\n\t\tlet root = _this._vnode;\n\t\twhile (root !== null && !root._mask && root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\t_this._container = container;\n\n\t\t// Create a fake DOM parent node that manages a subset of `container`'s children:\n\t\t_this._temp = {\n\t\t\tnodeType: 1,\n\t\t\tparentNode: container,\n\t\t\tchildNodes: [],\n\t\t\t_children: { _mask: root._mask },\n\t\t\tcontains: () => true,\n\t\t\tnamespaceURI: container.namespaceURI,\n\t\t\tinsertBefore(child, before) {\n\t\t\t\tthis.childNodes.push(child);\n\t\t\t\t_this._container.insertBefore(child, before);\n\t\t\t},\n\t\t\tremoveChild(child) {\n\t\t\t\tthis.childNodes.splice(this.childNodes.indexOf(child) >>> 1, 1);\n\t\t\t\t_this._container.removeChild(child);\n\t\t\t}\n\t\t};\n\t}\n\n\t// Render our wrapping element into temp.\n\trender(\n\t\tcreateElement(ContextProvider, { context: _this.context }, props._vnode),\n\t\t_this._temp\n\t);\n}\n\n/**\n * Create a `Portal` to continue rendering the vnode tree at a different DOM node\n * @param {import('./internal').VNode} 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\tconst el = createElement(Portal, { _vnode: vnode, _container: container });\n\tel.containerInfo = container;\n\treturn el;\n}\n","import {\n\trender as preactRender,\n\thydrate as preactHydrate,\n\toptions,\n\ttoChildArray,\n\tComponent\n} from 'preact';\nimport {\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tuseEffect,\n\tuseId,\n\tuseImperativeHandle,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseReducer,\n\tuseRef,\n\tuseState\n} from 'preact/hooks';\nimport {\n\tuseDeferredValue,\n\tuseInsertionEffect,\n\tuseSyncExternalStore,\n\tuseTransition\n} from './index';\n\nexport const REACT_ELEMENT_TYPE =\n\t(typeof Symbol != 'undefined' && Symbol.for && Symbol.for('react.element')) ||\n\t0xeac7;\n\nconst CAMEL_PROPS =\n\t/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;\nconst ON_ANI = /^on(Ani|Tra|Tou|BeforeInp|Compo)/;\nconst CAMEL_REPLACE = /[A-Z0-9]/g;\nconst IS_DOM = typeof document !== 'undefined';\n\n// Input types for which onchange should not be converted to oninput.\n// type=\"file|checkbox|radio\", plus \"range\" in IE11.\n// (IE11 doesn't support Symbol, which we use here to turn `rad` into `ra` which matches \"range\")\nconst onChangeInputType = type =>\n\t(typeof Symbol != 'undefined' && typeof Symbol() == 'symbol'\n\t\t? /fil|che|rad/\n\t\t: /fil|che|ra/\n\t).test(type);\n\n// Some libraries like `react-virtualized` explicitly check for this.\nComponent.prototype.isReactComponent = true;\n\n// `UNSAFE_*` lifecycle hooks\n// Preact only ever invokes the unprefixed methods.\n// Here we provide a base \"fallback\" implementation that calls any defined UNSAFE_ prefixed method.\n// - If a component defines its own `componentDidMount()` (including via defineProperty), use that.\n// - If a component defines `UNSAFE_componentDidMount()`, `componentDidMount` is the alias getter/setter.\n// - If anything assigns to an `UNSAFE_*` property, the assignment is forwarded to the unprefixed property.\n// See https://github.com/preactjs/preact/issues/1941\n[\n\t'componentWillMount',\n\t'componentWillReceiveProps',\n\t'componentWillUpdate'\n].forEach(key => {\n\tObject.defineProperty(Component.prototype, key, {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn this['UNSAFE_' + key];\n\t\t},\n\t\tset(v) {\n\t\t\tObject.defineProperty(this, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\twritable: true,\n\t\t\t\tvalue: v\n\t\t\t});\n\t\t}\n\t});\n});\n\n/**\n * Proxy render() since React returns a Component reference.\n * @param {import('./internal').VNode} vnode VNode tree to render\n * @param {import('./internal').PreactElement} parent DOM node to render vnode tree into\n * @param {() => void} [callback] Optional callback that will be called after rendering\n * @returns {import('./internal').Component | null} The root component reference or null\n */\nexport function render(vnode, parent, callback) {\n\t// React destroys any existing DOM nodes, see #1727\n\t// ...but only on the first render, see #1828\n\tif (parent._children == null) {\n\t\tparent.textContent = '';\n\t}\n\n\tpreactRender(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nexport function hydrate(vnode, parent, callback) {\n\tpreactHydrate(vnode, parent);\n\tif (typeof callback == 'function') callback();\n\n\treturn vnode ? vnode._component : null;\n}\n\nlet oldEventHook = options.event;\noptions.event = e => {\n\tif (oldEventHook) e = oldEventHook(e);\n\n\te.persist = () => {};\n\te.isPropagationStopped = function isPropagationStopped() {\n\t\treturn this.cancelBubble;\n\t};\n\te.isDefaultPrevented = function isDefaultPrevented() {\n\t\treturn this.defaultPrevented;\n\t};\n\treturn (e.nativeEvent = e);\n};\n\nconst classNameDescriptorNonEnumberable = {\n\tconfigurable: true,\n\tget() {\n\t\treturn this.class;\n\t}\n};\n\nfunction handleDomVNode(vnode) {\n\tlet props = vnode.props,\n\t\ttype = vnode.type,\n\t\tnormalizedProps = {},\n\t\tisNonDashedType = type.indexOf('-') == -1;\n\n\tfor (let i in props) {\n\t\tlet value = props[i];\n\n\t\tif (\n\t\t\t(i === 'value' && 'defaultValue' in props && value == null) ||\n\t\t\t// Emulate React's behavior of not rendering the contents of noscript tags on the client.\n\t\t\t(IS_DOM && i === 'children' && type === 'noscript') ||\n\t\t\ti === 'class' ||\n\t\t\ti === 'className'\n\t\t) {\n\t\t\t// Skip applying value if it is null/undefined and we already set\n\t\t\t// a default value\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet lowerCased = i.toLowerCase();\n\t\tif (i === 'defaultValue' && 'value' in props && props.value == null) {\n\t\t\t// `defaultValue` is treated as a fallback `value` when a value prop is present but null/undefined.\n\t\t\t// `defaultValue` for Elements with no value prop is the same as the DOM defaultValue property.\n\t\t\ti = 'value';\n\t\t} else if (i === 'download' && value === true) {\n\t\t\t// Calling `setAttribute` with a truthy value will lead to it being\n\t\t\t// passed as a stringified value, e.g. `download=\"true\"`. React\n\t\t\t// converts it to an empty string instead, otherwise the attribute\n\t\t\t// value will be used as the file name and the file will be called\n\t\t\t// \"true\" upon downloading it.\n\t\t\tvalue = '';\n\t\t} else if (lowerCased === 'translate' && value === 'no') {\n\t\t\tvalue = false;\n\t\t} else if (lowerCased[0] === 'o' && lowerCased[1] === 'n') {\n\t\t\tif (lowerCased === 'ondoubleclick') {\n\t\t\t\ti = 'ondblclick';\n\t\t\t} else if (\n\t\t\t\tlowerCased === 'onchange' &&\n\t\t\t\t(type === 'input' || type === 'textarea') &&\n\t\t\t\t!onChangeInputType(props.type)\n\t\t\t) {\n\t\t\t\tlowerCased = i = 'oninput';\n\t\t\t} else if (lowerCased === 'onfocus') {\n\t\t\t\ti = 'onfocusin';\n\t\t\t} else if (lowerCased === 'onblur') {\n\t\t\t\ti = 'onfocusout';\n\t\t\t} else if (ON_ANI.test(i)) {\n\t\t\t\ti = lowerCased;\n\t\t\t}\n\t\t} else if (isNonDashedType && CAMEL_PROPS.test(i)) {\n\t\t\ti = i.replace(CAMEL_REPLACE, '-$&').toLowerCase();\n\t\t} else if (value === null) {\n\t\t\tvalue = undefined;\n\t\t}\n\n\t\t// Add support for onInput and onChange, see #3561\n\t\t// if we have an oninput prop already change it to oninputCapture\n\t\tif (lowerCased === 'oninput') {\n\t\t\ti = lowerCased;\n\t\t\tif (normalizedProps[i]) {\n\t\t\t\ti = 'oninputCapture';\n\t\t\t}\n\t\t}\n\n\t\tnormalizedProps[i] = value;\n\t}\n\n\tif (type == 'select') {\n\t\t// Add support for array select values: <select multiple value={[]} />\n\t\tif (normalizedProps.multiple && Array.isArray(normalizedProps.value)) {\n\t\t\t// forEach() always returns undefined, which we abuse here to unset the value prop.\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tchild.props.selected =\n\t\t\t\t\tnormalizedProps.value.indexOf(child.props.value) != -1;\n\t\t\t});\n\t\t}\n\n\t\t// Adding support for defaultValue in select tag\n\t\tif (normalizedProps.defaultValue != null) {\n\t\t\tnormalizedProps.value = toChildArray(props.children).forEach(child => {\n\t\t\t\tif (normalizedProps.multiple) {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue.indexOf(child.props.value) != -1;\n\t\t\t\t} else {\n\t\t\t\t\tchild.props.selected =\n\t\t\t\t\t\tnormalizedProps.defaultValue == child.props.value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tif (props.class && !props.className) {\n\t\tnormalizedProps.class = props.class;\n\t\tObject.defineProperty(\n\t\t\tnormalizedProps,\n\t\t\t'className',\n\t\t\tclassNameDescriptorNonEnumberable\n\t\t);\n\t} else if (props.className) {\n\t\tnormalizedProps.class = normalizedProps.className = props.className;\n\t}\n\n\tvnode.props = normalizedProps;\n}\n\nlet oldVNodeHook = options.vnode;\noptions.vnode = vnode => {\n\t// only normalize props on Element nodes\n\tif (typeof vnode.type === 'string') {\n\t\thandleDomVNode(vnode);\n\t}\n\n\tvnode.$$typeof = REACT_ELEMENT_TYPE;\n\n\tif (oldVNodeHook) oldVNodeHook(vnode);\n};\n\n// Only needed for react-relay\nlet currentComponent;\nconst oldBeforeRender = options._render;\noptions._render = function (vnode) {\n\tif (oldBeforeRender) {\n\t\toldBeforeRender(vnode);\n\t}\n\tcurrentComponent = vnode._component;\n};\n\nconst oldDiffed = options.diffed;\n/** @type {(vnode: import('./internal').VNode) => void} */\noptions.diffed = function (vnode) {\n\tif (oldDiffed) {\n\t\toldDiffed(vnode);\n\t}\n\n\tconst props = vnode.props;\n\tconst dom = vnode._dom;\n\n\tif (\n\t\tdom != null &&\n\t\tvnode.type === 'textarea' &&\n\t\t'value' in props &&\n\t\tprops.value !== dom.value\n\t) {\n\t\tdom.value = props.value == null ? '' : props.value;\n\t}\n\n\tcurrentComponent = null;\n};\n\n// This is a very very private internal function for React it\n// is used to sort-of do runtime dependency injection.\nexport const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {\n\tReactCurrentDispatcher: {\n\t\tcurrent: {\n\t\t\treadContext(context) {\n\t\t\t\treturn currentComponent._globalContext[context._id].props.value;\n\t\t\t},\n\t\t\tuseCallback,\n\t\t\tuseContext,\n\t\t\tuseDebugValue,\n\t\t\tuseDeferredValue,\n\t\t\tuseEffect,\n\t\t\tuseId,\n\t\t\tuseImperativeHandle,\n\t\t\tuseInsertionEffect,\n\t\t\tuseLayoutEffect,\n\t\t\tuseMemo,\n\t\t\t// useMutableSource, // experimental-only and replaced by uSES, likely not worth supporting\n\t\t\tuseReducer,\n\t\t\tuseRef,\n\t\t\tuseState,\n\t\t\tuseSyncExternalStore,\n\t\t\tuseTransition\n\t\t}\n\t}\n};\n","import {\n\tcreateElement,\n\trender as preactRender,\n\tcloneElement as preactCloneElement,\n\tcreateRef,\n\tComponent,\n\tcreateContext,\n\tFragment,\n\toptions\n} from 'preact';\nimport {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue\n} from 'preact/hooks';\nimport {\n\tuseInsertionEffect,\n\tstartTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tuseTransition\n} from './hooks';\nimport { PureComponent } from './PureComponent';\nimport { memo } from './memo';\nimport { forwardRef } from './forwardRef';\nimport { Children } from './Children';\nimport { Suspense, lazy } from './suspense';\nimport { SuspenseList } from './suspense-list';\nimport { createPortal } from './portals';\nimport {\n\thydrate,\n\trender,\n\tREACT_ELEMENT_TYPE,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n} from './render';\n\nconst version = '18.3.1'; // trick libraries to think we are react\n\n/**\n * Legacy version of createElement.\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor\n */\nfunction createFactory(type) {\n\treturn createElement.bind(null, type);\n}\n\n/**\n * Check if the passed element is a valid (p)react node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isValidElement(element) {\n\treturn !!element && element.$$typeof === REACT_ELEMENT_TYPE;\n}\n\n/**\n * Check if the passed element is a Fragment node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isFragment(element) {\n\treturn isValidElement(element) && element.type === Fragment;\n}\n\n/**\n * Check if the passed element is a Memo node.\n * @param {*} element The element to check\n * @returns {boolean}\n */\nfunction isMemo(element) {\n\treturn (\n\t\t!!element &&\n\t\ttypeof element.displayName == 'string' &&\n\t\telement.displayName.indexOf('Memo(') == 0\n\t);\n}\n\n/**\n * Wrap `cloneElement` to abort if the passed element is not a valid element and apply\n * all vnode normalizations.\n * @param {import('./internal').VNode} element The vnode to clone\n * @param {object} props Props to add when cloning\n * @param {Array<import('./internal').ComponentChildren>} rest Optional component children\n */\nfunction cloneElement(element) {\n\tif (!isValidElement(element)) return element;\n\treturn preactCloneElement.apply(null, arguments);\n}\n\n/**\n * Remove a component tree from the DOM, including state and event handlers.\n * @param {import('./internal').PreactElement} container\n * @returns {boolean}\n */\nfunction unmountComponentAtNode(container) {\n\tif (container._children) {\n\t\tpreactRender(null, container);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n/**\n * Get the matching DOM node for a component\n * @param {import('./internal').Component} component\n * @returns {import('./internal').PreactElement | null}\n */\nfunction findDOMNode(component) {\n\treturn (\n\t\t(component &&\n\t\t\t(component.base || (component.nodeType === 1 && component))) ||\n\t\tnull\n\t);\n}\n\n/**\n * Deprecated way to control batched rendering inside the reconciler, but we\n * already schedule in batches inside our rendering code\n * @template Arg\n * @param {(arg: Arg) => void} callback function that triggers the updated\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n */\n// eslint-disable-next-line camelcase\nconst unstable_batchedUpdates = (callback, arg) => callback(arg);\n\n/**\n * In React, `flushSync` flushes the entire tree and forces a rerender.\n * @template Arg\n * @template Result\n * @param {(arg: Arg) => Result} callback function that runs before the flush\n * @param {Arg} [arg] Optional argument that can be passed to the callback\n * @returns\n */\nconst flushSync = (callback, arg) => {\n\tconst prevDebounce = options.debounceRendering;\n\tlet flush;\n\toptions.debounceRendering = cb => {\n\t\tflush = cb;\n\t};\n\ttry {\n\t\tconst res = callback(arg);\n\t\tif (flush) flush();\n\t\treturn res;\n\t} finally {\n\t\toptions.debounceRendering = prevDebounce;\n\t}\n};\n\n// compat to react-is\nexport const isElement = isValidElement;\n\nexport * from 'preact/hooks';\nexport {\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tisFragment,\n\tisMemo,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tuseInsertionEffect,\n\tstartTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tuseTransition,\n\t// eslint-disable-next-line camelcase\n\tunstable_batchedUpdates,\n\tFragment as StrictMode,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n\n// React copies the named exports to the default one.\nexport default {\n\tuseState,\n\tuseId,\n\tuseReducer,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseInsertionEffect,\n\tuseTransition,\n\tuseDeferredValue,\n\tuseSyncExternalStore,\n\tstartTransition,\n\tuseRef,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseCallback,\n\tuseContext,\n\tuseDebugValue,\n\tversion,\n\tChildren,\n\trender,\n\thydrate,\n\tunmountComponentAtNode,\n\tcreatePortal,\n\tcreateElement,\n\tcreateContext,\n\tcreateFactory,\n\tcloneElement,\n\tcreateRef,\n\tFragment,\n\tisValidElement,\n\tisElement,\n\tisFragment,\n\tisMemo,\n\tfindDOMNode,\n\tComponent,\n\tPureComponent,\n\tmemo,\n\tforwardRef,\n\tflushSync,\n\tunstable_batchedUpdates,\n\tStrictMode: Fragment,\n\tSuspense,\n\tSuspenseList,\n\tlazy,\n\t__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED\n};\n","/**\n * Thin browser client for the Aginies platform: activation handshake, hosted-chat\n * configuration and streaming chat turns. No framework dependency; the React layer\n * wraps it.\n */\n\nexport interface AginiesConfig {\n /** Platform origin, e.g. `https://app.example.com`. No trailing slash. */\n baseUrl: string\n /** Activation token issued for the deployment. Without it nothing renders, unless `hosted`. */\n token?: string\n /**\n * The platform's own pages: the widget runs on the platform origin and activates\n * without a token. Refused from any other origin.\n */\n hosted?: boolean\n /** UI language. Defaults to the document language, then English. */\n locale?: 'tr' | 'en'\n /** Fetch implementation override (tests, SSR). */\n fetch?: typeof fetch\n}\n\nexport interface ActivationConfig {\n apiBase: string\n brand: { name: string; logoUrl: string | null }\n theme: Record<string, string | undefined> | null\n /** Widget modules the activation unlocks; empty means all. */\n modules?: string[]\n /** The tenant a tenant key belongs to. Absent for a static activation key. */\n tenant?: { id: string; name: string }\n}\n\n/**\n * The session a tenant key buys: a short-lived bearer the client sends on every\n * platform call and renews by re-activating when it is refused.\n */\nexport interface ActivationSession {\n token: string\n /** Unix seconds. */\n expiresAt: number\n}\n\nexport type ActivationState =\n | { status: 'idle' }\n | { status: 'activating' }\n | { status: 'active'; config: ActivationConfig }\n | { status: 'rejected'; reason: string }\n\nexport interface ChatConfig {\n id: string\n title: string\n description: string\n customizations: {\n primaryColor?: string\n welcomeMessage?: string\n imageUrl?: string\n logoUrl?: string\n headerText?: string\n }\n authType: 'public' | 'password' | 'email' | 'sso'\n outputConfigs?: Array<{ blockId: string; path?: string }>\n /** What the platform can do with speech for this chat. */\n voice?: { stt: boolean; tts: boolean }\n}\n\nexport interface Transcription {\n transcript: string\n language?: string\n duration?: number\n}\n\nexport interface ChatAuthRequired {\n authRequired: ChatConfig['authType']\n title?: string\n description?: string\n}\n\nexport interface ChatFilePayload {\n name: string\n type: string\n size: number\n data: string\n lastModified?: number\n}\n\nexport interface SendMessageInput {\n input?: string\n conversationId?: string\n password?: string\n email?: string\n files?: ChatFilePayload[]\n}\n\n/** One server-sent event from a chat turn, already decoded. */\nexport type ChatStreamEvent =\n | { type: 'chunk'; blockId?: string; text: string }\n | { type: 'final'; data: unknown }\n | { type: 'error'; message: string }\n | { type: 'done' }\n\nexport class AginiesError extends Error {\n readonly status: number\n readonly code?: string\n constructor(message: string, status: number, code?: string) {\n super(message)\n this.name = 'AginiesError'\n this.status = status\n this.code = code\n }\n}\n\nconst trimSlash = (s: string) => s.replace(/\\/+$/, '')\n\nexport class AginiesClient {\n readonly baseUrl: string\n readonly token: string | null\n private readonly hosted: boolean\n readonly locale: 'tr' | 'en'\n private readonly fetchImpl: typeof fetch\n private state: ActivationState = { status: 'idle' }\n private listeners = new Set<(s: ActivationState) => void>()\n private activation: Promise<ActivationState> | null = null\n private session: ActivationSession | null = null\n\n constructor(config: AginiesConfig) {\n if (!config?.baseUrl) throw new AginiesError('baseUrl is required', 0, 'MISSING_BASE_URL')\n if (!config?.token && !config?.hosted) {\n throw new AginiesError('token is required', 0, 'MISSING_TOKEN')\n }\n this.baseUrl = trimSlash(config.baseUrl)\n this.token = config.token ?? null\n this.hosted = config.hosted === true\n this.locale = config.locale ?? detectLocale()\n this.fetchImpl = config.fetch ?? ((...args) => fetch(...args))\n }\n\n getState(): ActivationState {\n return this.state\n }\n\n subscribe(listener: (s: ActivationState) => void): () => void {\n this.listeners.add(listener)\n return () => this.listeners.delete(listener)\n }\n\n private setState(next: ActivationState) {\n this.state = next\n for (const l of this.listeners) l(next)\n }\n\n /**\n * Runs the activation handshake once and caches the outcome. Components render only\n * while the state is `active`; a rejected activation is final for this client.\n */\n activate(): Promise<ActivationState> {\n if (this.activation) return this.activation\n this.setState({ status: 'activating' })\n this.activation = (async () => {\n try {\n const res = await this.fetchImpl(`${this.baseUrl}/api/ui/activate`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(this.hosted ? { hosted: true } : { token: this.token }),\n })\n if (!res.ok) {\n const body = await safeJson(res)\n const reason = (body && (body.error as string)) || `HTTP ${res.status}`\n this.setState({ status: 'rejected', reason })\n return this.state\n }\n const body = (await res.json()) as {\n activated?: boolean\n config?: ActivationConfig\n session?: ActivationSession\n }\n if (!body.activated || !body.config) {\n this.setState({ status: 'rejected', reason: 'Activation refused' })\n return this.state\n }\n this.session = body.session ?? null\n this.setState({ status: 'active', config: body.config })\n return this.state\n } catch (err) {\n this.setState({\n status: 'rejected',\n reason: err instanceof Error ? err.message : 'Activation failed',\n })\n return this.state\n }\n })()\n return this.activation\n }\n\n private assertActive() {\n if (this.state.status !== 'active') {\n throw new AginiesError('Client is not activated', 0, 'NOT_ACTIVATED')\n }\n }\n\n /** The current tenant session, if the activation issued one. */\n getSession(): ActivationSession | null {\n return this.session\n }\n\n /** Whether `module` may render under this activation. */\n hasModule(module: string): boolean {\n if (this.state.status !== 'active') return false\n const modules = this.state.config.modules ?? []\n return modules.length === 0 || modules.includes(module)\n }\n\n /**\n * Re-runs the handshake to obtain a fresh session. Used when a call is refused with\n * an expired bearer; the activation state stays `active` unless the platform now\n * rejects the key.\n */\n private async renewSession(): Promise<boolean> {\n this.activation = null\n const state = await this.activate()\n return state.status === 'active' && this.session !== null\n }\n\n private withSession(init: RequestInit): RequestInit {\n if (!this.session) return init\n const headers = new Headers(init.headers ?? {})\n if (!headers.has('Authorization')) headers.set('Authorization', `Bearer ${this.session.token}`)\n return { ...init, headers }\n }\n\n /**\n * A platform request carrying cookies and, when a tenant session exists, its bearer.\n * A 401/403 on a session that has expired triggers one renewal and one retry.\n */\n private async request(path: string, init: RequestInit = {}): Promise<Response> {\n const url = `${this.baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n const send = () => this.fetchImpl(url, this.withSession({ credentials: 'include', ...init }))\n let res = await send()\n if (\n this.session &&\n (res.status === 401 || res.status === 403) &&\n this.session.expiresAt * 1000 <= Date.now() + 5_000\n ) {\n if (await this.renewSession()) res = await send()\n }\n return res\n }\n\n /** A raw request against the platform for endpoints the client does not wrap. */\n fetchRaw(path: string, init: RequestInit = {}): Promise<Response> {\n this.assertActive()\n return this.request(path, init)\n }\n\n /** Sends a recording to the platform's transcription model. */\n async transcribe(\n identifier: string,\n audio: Blob,\n filename = 'turn.webm',\n language?: string\n ): Promise<Transcription> {\n this.assertActive()\n const form = new FormData()\n form.append('file', audio, filename)\n if (language) form.append('language', language)\n const res = await this.request(`/api/chat/${encodeURIComponent(identifier)}/voice/transcribe`, {\n method: 'POST',\n body: form,\n })\n if (!res.ok) throw await voiceError(res)\n return (await res.json()) as Transcription\n }\n\n /** Audio for a reply from the platform's synthesis endpoint. */\n async speak(identifier: string, text: string): Promise<Blob> {\n this.assertActive()\n const res = await this.request(`/api/chat/${encodeURIComponent(identifier)}/voice/speak`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ text }),\n })\n if (!res.ok) throw await voiceError(res)\n return res.blob()\n }\n\n /** Hosted-chat configuration. Resolves to an auth requirement instead of throwing on 401. */\n async getChat(identifier: string): Promise<ChatConfig | ChatAuthRequired> {\n this.assertActive()\n const res = await this.request(`/api/chat/${encodeURIComponent(identifier)}`)\n const body = await safeJson(res)\n if (res.status === 401 && body && typeof body.authRequired === 'string') {\n return body as unknown as ChatAuthRequired\n }\n if (!res.ok) {\n throw new AginiesError((body?.error as string) || `HTTP ${res.status}`, res.status)\n }\n return body as unknown as ChatConfig\n }\n\n /**\n * Sends one turn and yields the streamed events. Authentication for password / e-mail\n * chats travels in the same body on the first call; the platform then sets a cookie.\n */\n async *sendMessage(\n identifier: string,\n input: SendMessageInput,\n signal?: AbortSignal\n ): AsyncGenerator<ChatStreamEvent> {\n this.assertActive()\n const res = await this.request(`/api/chat/${encodeURIComponent(identifier)}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(input),\n signal,\n })\n if (!res.ok) {\n const body = await safeJson(res)\n if (res.status === 401 && body && typeof body.authRequired === 'string') {\n throw new AginiesError('Authentication required', 401, 'AUTH_REQUIRED')\n }\n throw new AginiesError((body?.error as string) || `HTTP ${res.status}`, res.status)\n }\n const contentType = res.headers.get('content-type') ?? ''\n if (!contentType.includes('text/event-stream')) {\n const body = await safeJson(res)\n yield { type: 'final', data: body }\n yield { type: 'done' }\n return\n }\n yield* parseSSE(res.body as ReadableStream<Uint8Array>)\n }\n}\n\n/** Parses an SSE body into chat events. Exported for tests. */\nexport async function* parseSSE(\n stream: ReadableStream<Uint8Array>\n): AsyncGenerator<ChatStreamEvent> {\n const reader = stream.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done) break\n buffer += decoder.decode(value, { stream: true })\n let sep = buffer.indexOf('\\n\\n')\n while (sep !== -1) {\n const frame = buffer.slice(0, sep)\n buffer = buffer.slice(sep + 2)\n const event = decodeFrame(frame)\n if (event) yield event\n sep = buffer.indexOf('\\n\\n')\n }\n }\n const tail = decodeFrame(buffer)\n if (tail) yield tail\n } finally {\n reader.releaseLock()\n }\n yield { type: 'done' }\n}\n\nfunction decodeFrame(frame: string): ChatStreamEvent | null {\n const line = frame.split('\\n').find((l) => l.startsWith('data:'))\n if (!line) return null\n const data = line.slice(5).trim()\n if (!data || data === '[DONE]') return null\n let json: Record<string, unknown>\n try {\n json = JSON.parse(data)\n } catch {\n return { type: 'chunk', text: data }\n }\n if (json.event === 'error') {\n return { type: 'error', message: (json.error as string) || 'Stream error' }\n }\n if (json.event === 'final') {\n return { type: 'final', data: json.data }\n }\n if (typeof json.chunk === 'string') {\n return { type: 'chunk', blockId: json.blockId as string | undefined, text: json.chunk }\n }\n return null\n}\n\nasync function voiceError(res: Response): Promise<AginiesError> {\n const body = await safeJson(res)\n if (res.status === 401 && body && typeof body.authRequired === 'string') {\n return new AginiesError('Authentication required', 401, 'AUTH_REQUIRED')\n }\n if (res.status === 503)\n return new AginiesError('Voice is not available', 503, 'VOICE_UNAVAILABLE')\n return new AginiesError((body?.error as string) || `HTTP ${res.status}`, res.status)\n}\n\nasync function safeJson(res: Response): Promise<Record<string, unknown> | null> {\n try {\n return (await res.json()) as Record<string, unknown>\n } catch {\n return null\n }\n}\n\nfunction detectLocale(): 'tr' | 'en' {\n if (typeof document !== 'undefined') {\n const lang = document.documentElement.lang?.toLowerCase() ?? ''\n if (lang.startsWith('tr')) return 'tr'\n }\n if (typeof navigator !== 'undefined' && navigator.language?.toLowerCase().startsWith('tr')) {\n return 'tr'\n }\n return 'en'\n}\n","/**\n * Human-in-the-loop approvals. A run that reaches a \"Human in the Loop\" block pauses;\n * the platform stores its state and hands out a resume link. This module reads the\n * paused execution (`GET /api/resume/:workflowId/:executionId[/:contextId]`) and resumes\n * it with the approver's input (`POST …/:contextId`), through the activated client so a\n * tenant session travels along.\n */\nimport { type AginiesClient, AginiesError } from '../client'\n\nexport type ResumeStatus = 'paused' | 'resumed' | 'failed' | 'queued' | 'resuming'\n\nexport interface ResumeQueueEntry {\n id: string\n contextId: string\n status: string\n queuedAt: string | null\n claimedAt: string | null\n completedAt: string | null\n failureReason: string | null\n newExecutionId: string\n resumeInput: unknown\n}\n\nexport interface PausePoint {\n contextId: string\n triggerBlockId: string\n /** The block's paused output; `data.inputFormat` describes the approver's form. */\n response: { data?: Record<string, unknown> } | null\n registeredAt: string\n resumeStatus: ResumeStatus\n snapshotReady: boolean\n queuePosition?: number | null\n latestResumeEntry?: ResumeQueueEntry | null\n}\n\nexport interface PausedExecution {\n id: string\n workflowId: string\n executionId: string\n status: string\n totalPauseCount: number\n resumedCount: number\n pausedAt: string | null\n updatedAt: string | null\n expiresAt: string | null\n metadata: Record<string, unknown> | null\n pausePoints: PausePoint[]\n queue?: ResumeQueueEntry[]\n}\n\nexport interface PauseContext {\n execution: PausedExecution\n pausePoint: PausePoint\n queue: ResumeQueueEntry[]\n activeResumeEntry?: ResumeQueueEntry | null\n}\n\nexport interface ResumeOutcome {\n status: 'started' | 'queued'\n executionId: string\n queuePosition?: number | null\n message?: string\n}\n\n/** One field of the approver's form, as the block author configured it. */\nexport interface ResumeField {\n id: string\n name: string\n label: string\n type: string\n description?: string\n placeholder?: string\n value?: unknown\n required: boolean\n options?: unknown[]\n rows?: number\n}\n\nconst path = (workflowId: string, executionId: string, contextId?: string) =>\n `/api/resume/${encodeURIComponent(workflowId)}/${encodeURIComponent(executionId)}${\n contextId ? `/${encodeURIComponent(contextId)}` : ''\n }`\n\nasync function readJson<T>(res: Response): Promise<T> {\n let body: unknown = null\n try {\n body = await res.json()\n } catch {\n /* not JSON */\n }\n if (!res.ok) {\n const error = (body as { error?: string } | null)?.error\n throw new AginiesError(\n error || `HTTP ${res.status}`,\n res.status,\n res.status === 404 ? 'NOT_FOUND' : res.status === 403 ? 'FORBIDDEN' : undefined\n )\n }\n return body as T\n}\n\nexport function getPausedExecution(\n client: AginiesClient,\n workflowId: string,\n executionId: string\n): Promise<PausedExecution> {\n return client.fetchRaw(path(workflowId, executionId)).then((r) => readJson<PausedExecution>(r))\n}\n\nexport function getPauseContext(\n client: AginiesClient,\n workflowId: string,\n executionId: string,\n contextId: string\n): Promise<PauseContext> {\n return client\n .fetchRaw(path(workflowId, executionId, contextId))\n .then((r) => readJson<PauseContext>(r))\n}\n\nexport function listPausedExecutions(\n client: AginiesClient,\n workflowId: string,\n status?: string\n): Promise<PausedExecution[]> {\n const query = status ? `?status=${encodeURIComponent(status)}` : ''\n return client\n .fetchRaw(`/api/workflows/${encodeURIComponent(workflowId)}/paused${query}`)\n .then((r) => readJson<{ pausedExecutions: PausedExecution[] }>(r))\n .then((b) => b.pausedExecutions ?? [])\n}\n\n/** Resumes one pause point with the approver's submission, keyed by field name. */\nexport function resumeExecution(\n client: AginiesClient,\n workflowId: string,\n executionId: string,\n contextId: string,\n submission: Record<string, unknown> | null\n): Promise<ResumeOutcome> {\n return client\n .fetchRaw(path(workflowId, executionId, contextId), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(submission ? { input: { submission } } : {}),\n })\n .then((r) => readJson<ResumeOutcome>(r))\n}\n\n/* ───────────────────────────── form helpers ───────────────────────────── */\n\n/** Reads the approver's form out of a pause point, tolerating partial definitions. */\nexport function fieldsOf(point: PausePoint | null | undefined): ResumeField[] {\n const raw = point?.response?.data?.inputFormat\n if (!Array.isArray(raw)) return []\n return raw\n .map((f, index): ResumeField | null => {\n if (!f || typeof f !== 'object') return null\n const field = f as Record<string, unknown>\n const name = typeof field.name === 'string' ? field.name.trim() : ''\n if (!name) return null\n const str = (v: unknown) => (typeof v === 'string' && v.trim() ? v.trim() : undefined)\n return {\n id: str(field.id) ?? `field_${index}`,\n name,\n label: str(field.label) ?? name,\n type: str(field.type) ?? 'string',\n description: str(field.description),\n placeholder: str(field.placeholder),\n value: field.value,\n required: field.required === true,\n options: Array.isArray(field.options) ? field.options : undefined,\n rows: typeof field.rows === 'number' ? field.rows : undefined,\n }\n })\n .filter((f): f is ResumeField => f !== null)\n}\n\n/** The paused output shown to the approver: everything in `data` except form plumbing. */\nexport function outputOf(point: PausePoint | null | undefined): Record<string, unknown> {\n const data = point?.response?.data\n if (!data || typeof data !== 'object') return {}\n const { inputFormat: _f, resumeLinks: _l, ...rest } = data as Record<string, unknown>\n return rest\n}\n\n/** Formats a stored value for an input of this field's type. */\nexport function formatFieldValue(field: ResumeField, value: unknown): string {\n if (value === undefined || value === null) return ''\n switch (field.type) {\n case 'boolean':\n if (typeof value === 'boolean') return value ? 'true' : 'false'\n if (typeof value === 'string' && ['true', 'false'].includes(value.trim().toLowerCase()))\n return value.trim().toLowerCase()\n return ''\n case 'number':\n return typeof value === 'number'\n ? Number.isFinite(value)\n ? String(value)\n : ''\n : String(value)\n case 'array':\n case 'object':\n case 'files':\n if (typeof value === 'string') return value\n try {\n return JSON.stringify(value, null, 2)\n } catch {\n return ''\n }\n default:\n return typeof value === 'string' ? value : JSON.stringify(value)\n }\n}\n\n/** Parses an input's text back into the field's type; `error` names what went wrong. */\nexport function parseFieldValue(\n field: ResumeField,\n raw: string\n): { value?: unknown; error?: 'number' | 'json' } {\n const text = raw.trim()\n switch (field.type) {\n case 'boolean':\n return { value: text === 'true' }\n case 'number': {\n const n = Number(text)\n return Number.isFinite(n) ? { value: n } : { error: 'number' }\n }\n case 'array':\n case 'object':\n case 'files':\n try {\n return { value: JSON.parse(text) }\n } catch {\n return { error: 'json' }\n }\n default:\n return { value: raw }\n }\n}\n\n/** Initial input text per field, from the block's defaults. */\nexport function initialValues(fields: ResumeField[]): Record<string, string> {\n return Object.fromEntries(fields.map((f) => [f.name, formatFieldValue(f, f.value)]))\n}\n\n/**\n * Builds the submission from the inputs, or reports the fields that are missing or\n * malformed. Empty optional fields are left out of the submission.\n */\nexport function buildSubmission(\n fields: ResumeField[],\n values: Record<string, string>\n): { submission: Record<string, unknown>; errors: Record<string, 'required' | 'number' | 'json'> } {\n const submission: Record<string, unknown> = {}\n const errors: Record<string, 'required' | 'number' | 'json'> = {}\n for (const field of fields) {\n const raw = values[field.name] ?? ''\n const present = field.type === 'boolean' ? raw === 'true' || raw === 'false' : raw.trim() !== ''\n if (!present) {\n if (field.required) errors[field.name] = 'required'\n continue\n }\n const { value, error } = parseFieldValue(field, raw)\n if (error) errors[field.name] = error\n else if (value !== undefined) submission[field.name] = value\n }\n return { submission, errors }\n}\n","const ENCODED_ENTITIES = /[\"&<]/;\n\n/** @param {string} str */\nexport function encodeEntities(str) {\n\t// Skip all work for strings with no entities needing encoding:\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\n\n\tlet last = 0,\n\t\ti = 0,\n\t\tout = '',\n\t\tch = '';\n\n\t// Seek forward in str until the next entity char:\n\tfor (; i < str.length; i++) {\n\t\tswitch (str.charCodeAt(i)) {\n\t\t\tcase 34:\n\t\t\t\tch = '"';\n\t\t\t\tbreak;\n\t\t\tcase 38:\n\t\t\t\tch = '&';\n\t\t\t\tbreak;\n\t\t\tcase 60:\n\t\t\t\tch = '<';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tcontinue;\n\t\t}\n\t\t// Append skipped/buffered characters and the encoded entity:\n\t\tif (i !== last) out += str.slice(last, i);\n\t\tout += ch;\n\t\t// Start the next seek/buffer after the entity's offset:\n\t\tlast = i + 1;\n\t}\n\tif (i !== last) out += str.slice(last, i);\n\treturn out;\n}\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\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 = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { options, Fragment } from 'preact';\nimport { encodeEntities } from './utils';\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\n\nlet vnodeId = 0;\n\nconst isArray = Array.isArray;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {unknown} [isStaticChildren]\n * @param {unknown} [__source]\n * @param {unknown} [__self]\n */\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\n\tif (!props) props = {};\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = props,\n\t\tref,\n\t\ti;\n\n\tif ('ref' in normalizedProps) {\n\t\tnormalizedProps = {};\n\t\tfor (i in props) {\n\t\t\tif (i == 'ref') {\n\t\t\t\tref = props[i];\n\t\t\t} else {\n\t\t\t\tnormalizedProps[i] = props[i];\n\t\t\t}\n\t\t}\n\t}\n\n\t/** @type {VNode & { __source: any; __self: any }} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\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: --vnodeId,\n\t\t_index: -1,\n\t\t_flags: 0,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\n/**\n * Create a template vnode. This function is not expected to be\n * used directly, but rather through a precompile JSX transform\n * @param {string[]} templates\n * @param {Array<string | null | VNode>} exprs\n * @returns {VNode}\n */\nfunction jsxTemplate(templates, ...exprs) {\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\n\t// Bypass render to string top level Fragment optimization\n\tvnode.key = vnode._vnode;\n\treturn vnode;\n}\n\nconst JS_TO_CSS = {};\nconst CSS_REGEX = /[A-Z]/g;\n\n/**\n * Unwrap potential signals.\n * @param {*} value\n * @returns {*}\n */\nfunction normalizeAttrValue(value) {\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.valueOf === 'function'\n\t\t? value.valueOf()\n\t\t: value;\n}\n\n/**\n * Serialize an HTML attribute to a string. This function is not\n * expected to be used directly, but rather through a precompile\n * JSX transform\n * @param {string} name The attribute name\n * @param {*} value The attribute value\n * @returns {string}\n */\nfunction jsxAttr(name, value) {\n\tif (options.attr) {\n\t\tconst result = options.attr(name, value);\n\t\tif (typeof result === 'string') return result;\n\t}\n\n\tvalue = normalizeAttrValue(value);\n\n\tif (name === 'ref' || name === 'key') return '';\n\tif (name === 'style' && typeof value === 'object') {\n\t\tlet str = '';\n\t\tfor (let prop in value) {\n\t\t\tlet val = value[prop];\n\t\t\tif (val != null && val !== '') {\n\t\t\t\tconst name =\n\t\t\t\t\tprop[0] == '-'\n\t\t\t\t\t\t? prop\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\n\n\t\t\t\tlet suffix = ';';\n\t\t\t\tif (\n\t\t\t\t\ttypeof val === 'number' &&\n\t\t\t\t\t// Exclude custom-attributes\n\t\t\t\t\t!name.startsWith('--') &&\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\n\t\t\t\t) {\n\t\t\t\t\tsuffix = 'px;';\n\t\t\t\t}\n\t\t\t\tstr = str + name + ':' + val + suffix;\n\t\t\t}\n\t\t}\n\t\treturn name + '=\"' + encodeEntities(str) + '\"';\n\t}\n\n\tif (\n\t\tvalue == null ||\n\t\tvalue === false ||\n\t\ttypeof value === 'function' ||\n\t\ttypeof value === 'object'\n\t) {\n\t\treturn '';\n\t} else if (value === true) return name;\n\n\treturn name + '=\"' + encodeEntities('' + value) + '\"';\n}\n\n/**\n * Escape a dynamic child passed to `jsxTemplate`. This function\n * is not expected to be used directly, but rather through a\n * precompile JSX transform\n * @param {*} value\n * @returns {string | null | VNode | Array<string | null | VNode>}\n */\nfunction jsxEscape(value) {\n\tif (\n\t\tvalue == null ||\n\t\ttypeof value === 'boolean' ||\n\t\ttypeof value === 'function'\n\t) {\n\t\treturn null;\n\t}\n\n\tif (typeof value === 'object') {\n\t\t// Check for VNode\n\t\tif (value.constructor === undefined) return value;\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\n\t\t\t}\n\t\t\treturn value;\n\t\t}\n\t}\n\n\treturn encodeEntities('' + value);\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment,\n\t// precompiled JSX transform\n\tjsxTemplate,\n\tjsxAttr,\n\tjsxEscape\n};\n","import type {\n ButtonHTMLAttributes,\n HTMLAttributes,\n InputHTMLAttributes,\n TextareaHTMLAttributes,\n} from 'react'\nimport { forwardRef } from 'react'\n\n/** Joins class names, dropping falsy entries. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter(Boolean).join(' ')\n}\n\n/* ───────────────────────────── Button ───────────────────────────── */\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /** `primary` is the text fill, `signal` the accent fill, `outline` the quiet default. */\n variant?: 'primary' | 'signal' | 'outline' | 'ghost' | 'destructive'\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n { variant = 'outline', size = 'md', className, type = 'button', ...props },\n ref\n) {\n return (\n <button\n ref={ref}\n type={type}\n className={cx('agi-btn', `agi-btn--${variant}`, `agi-btn--${size}`, className)}\n {...props}\n />\n )\n})\n\n/* ───────────────────────────── Tag / Chip ───────────────────────────── */\n\nexport interface TagProps extends HTMLAttributes<HTMLSpanElement> {\n tone?: 'default' | 'signal' | 'ok' | 'warn' | 'bad'\n}\n\nexport function Tag({ tone = 'default', className, ...props }: TagProps) {\n return (\n <span\n className={cx('agi-tag', tone !== 'default' && `agi-tag--${tone}`, className)}\n {...props}\n />\n )\n}\n\nexport interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n pressed?: boolean\n}\n\nexport function Chip({ pressed = false, className, type = 'button', ...props }: ChipProps) {\n return (\n <button type={type} aria-pressed={pressed} className={cx('agi-chip', className)} {...props} />\n )\n}\n\n/* ───────────────────────────── Surfaces ───────────────────────────── */\n\nexport interface PanelProps extends HTMLAttributes<HTMLDivElement> {\n level?: 1 | 2\n}\n\nexport function Panel({ level = 1, className, ...props }: PanelProps) {\n return <div className={cx('agi-panel', level === 2 && 'agi-panel--2', className)} {...props} />\n}\n\n/* ───────────────────────────── Type ───────────────────────────── */\n\nexport function Eyebrow({\n className,\n quiet,\n ...props\n}: HTMLAttributes<HTMLParagraphElement> & { quiet?: boolean }) {\n return <p className={cx('agi-eyebrow', quiet && 'agi-eyebrow--quiet', className)} {...props} />\n}\n\nexport interface StatProps extends HTMLAttributes<HTMLDivElement> {\n value: string\n label: string\n}\n\nexport function Stat({ value, label, className, ...props }: StatProps) {\n return (\n <div className={cx('agi-stat', className)} {...props}>\n <div className='agi-stat__v'>{value}</div>\n <div className='agi-stat__k'>{label}</div>\n </div>\n )\n}\n\n/* ───────────────────────────── Fields ───────────────────────────── */\n\nexport interface FieldProps extends HTMLAttributes<HTMLLabelElement> {\n label: string\n htmlFor?: string\n /** Help text under the control; replaced by `error` when one is set. */\n hint?: string\n error?: string\n}\n\nexport function Field({ label, hint, error, className, children, ...props }: FieldProps) {\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: the control is passed as children\n <label className={cx('agi-field', className)} {...props}>\n <span className='agi-field__label'>{label}</span>\n {children}\n {error ? (\n <span className='agi-field__error'>{error}</span>\n ) : (\n hint && <span className='agi-field__hint'>{hint}</span>\n )}\n </label>\n )\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>>(\n function Input({ className, ...props }, ref) {\n return <input ref={ref} className={cx('agi-input', className)} {...props} />\n }\n)\n\nexport const Textarea = forwardRef<\n HTMLTextAreaElement,\n TextareaHTMLAttributes<HTMLTextAreaElement>\n>(function Textarea({ className, ...props }, ref) {\n return <textarea ref={ref} className={cx('agi-input', 'agi-textarea', className)} {...props} />\n})\n\n/* ───────────────────────────── Feedback ───────────────────────────── */\n\nexport function Spinner({ className, label }: { className?: string; label?: string }) {\n return (\n <output className={cx('agi-spinner', className)} aria-label={label}>\n <span />\n <span />\n <span />\n </output>\n )\n}\n","export type Locale = 'tr' | 'en'\n\nconst STRINGS = {\n chat: {\n open: { tr: 'Sohbeti aç', en: 'Open chat' },\n close: { tr: 'Kapat', en: 'Close' },\n placeholder: { tr: 'Mesajınızı yazın…', en: 'Type your message…' },\n send: { tr: 'Gönder', en: 'Send' },\n stop: { tr: 'Durdur', en: 'Stop' },\n attach: { tr: 'Dosya ekle', en: 'Attach file' },\n attachments: { tr: 'Ekler', en: 'Attachments' },\n removeFile: { tr: 'Dosyayı kaldır', en: 'Remove file' },\n tooManyFiles: { tr: 'En fazla 5 dosya ekleyebilirsiniz.', en: 'You can attach up to 5 files.' },\n fileTooLarge: {\n tr: \"Dosyalar 10 MB'tan küçük olmalı.\",\n en: 'Files must be smaller than 10 MB.',\n },\n welcome: {\n tr: 'Merhaba! Size nasıl yardımcı olabilirim?',\n en: 'Hi there! How can I help you today?',\n },\n thinking: { tr: 'Yanıt hazırlanıyor', en: 'Working on it' },\n stopped: { tr: 'Yanıt durduruldu.', en: 'Response stopped.' },\n error: {\n tr: 'Bir sorun oluştu. Lütfen tekrar deneyin.',\n en: 'Something went wrong. Please try again.',\n },\n unavailable: {\n tr: 'Bu sohbet şu anda kullanılamıyor.',\n en: 'This chat is currently unavailable.',\n },\n poweredBy: { tr: 'Aginies ile', en: 'Powered by Aginies' },\n you: { tr: 'Siz', en: 'You' },\n assistant: { tr: 'Ajan', en: 'Agent' },\n },\n auth: {\n passwordTitle: { tr: 'Bu sohbet parola korumalı', en: 'This chat is password protected' },\n passwordHint: { tr: 'Devam etmek için parolayı girin.', en: 'Enter the password to continue.' },\n password: { tr: 'Parola', en: 'Password' },\n emailTitle: { tr: 'E-posta ile doğrulama', en: 'Verify with your e-mail' },\n emailHint: {\n tr: 'İş e-postanızı girin; size bir kod göndereceğiz.',\n en: 'Enter your work e-mail; we will send you a code.',\n },\n email: { tr: 'E-posta', en: 'E-mail' },\n code: { tr: 'Doğrulama kodu', en: 'Verification code' },\n codeHint: {\n tr: 'E-postanıza gelen 6 haneli kodu girin.',\n en: 'Enter the 6-digit code from your e-mail.',\n },\n continue: { tr: 'Devam et', en: 'Continue' },\n sendCode: { tr: 'Kod gönder', en: 'Send code' },\n verify: { tr: 'Doğrula', en: 'Verify' },\n back: { tr: 'Geri', en: 'Back' },\n invalidPassword: { tr: 'Parola yanlış.', en: 'Wrong password.' },\n invalidEmail: {\n tr: 'Bu e-posta adresi yetkili değil.',\n en: 'This e-mail address is not allowed.',\n },\n invalidCode: {\n tr: 'Kod geçersiz veya süresi dolmuş.',\n en: 'The code is invalid or has expired.',\n },\n codeSent: { tr: 'Kod gönderildi.', en: 'Code sent.' },\n codeError: {\n tr: 'Kod gönderilemedi. Lütfen tekrar deneyin.',\n en: 'The code could not be sent. Please try again.',\n },\n resend: { tr: 'Kodu yeniden gönder', en: 'Resend code' },\n ssoTitle: { tr: 'Kurumsal giriş gerekli', en: 'Sign in with your organisation' },\n ssoHint: {\n tr: 'Bu sohbet kurumsal kimlikle açılır.',\n en: 'This chat opens with your organisation account.',\n },\n ssoButton: { tr: 'Kurumsal giriş', en: 'Sign in' },\n },\n voice: {\n talk: { tr: 'Konuşmak için dokunun', en: 'Tap to talk' },\n stopTalking: { tr: 'Bitirmek için dokunun', en: 'Tap when done' },\n dictate: { tr: 'Sesle yaz', en: 'Dictate' },\n handsFree: { tr: 'Sesli sohbet', en: 'Voice conversation' },\n exit: { tr: 'Sesli sohbetten çık', en: 'Leave voice conversation' },\n listening: { tr: 'Dinliyor', en: 'Listening' },\n transcribing: { tr: 'Yazıya dökülüyor', en: 'Transcribing' },\n thinking: { tr: 'Yanıt hazırlanıyor', en: 'Working on it' },\n speaking: { tr: 'Konuşuyor', en: 'Speaking' },\n idle: { tr: 'Hazır', en: 'Ready' },\n interrupt: { tr: 'Sözünü kesmek için dokunun', en: 'Tap to interrupt' },\n micDenied: {\n tr: 'Mikrofon izni verilmedi. Tarayıcı ayarlarından izin verin.',\n en: 'Microphone access was denied. Allow it in your browser settings.',\n },\n unsupported: {\n tr: 'Bu tarayıcı ses kaydını desteklemiyor.',\n en: 'This browser cannot record audio.',\n },\n unavailable: {\n tr: 'Ses özelliği bu sohbet için açık değil.',\n en: 'Voice is not enabled for this chat.',\n },\n error: {\n tr: 'Ses işlenemedi. Lütfen tekrar deneyin.',\n en: 'Voice could not be processed. Please try again.',\n },\n },\n run: {\n submit: { tr: 'Çalıştır', en: 'Run' },\n cancel: { tr: 'İptal', en: 'Cancel' },\n running: { tr: 'Çalışıyor', en: 'Running' },\n done: { tr: 'Tamamlandı', en: 'Completed' },\n error: { tr: 'Hata', en: 'Error' },\n failed: { tr: 'Çalıştırma başarısız oldu.', en: 'The run failed.' },\n unauthorized: { tr: 'API anahtarı reddedildi.', en: 'The API key was rejected.' },\n steps: { tr: 'Adımlar', en: 'Steps' },\n execution: { tr: 'çalıştırma', en: 'execution' },\n },\n approval: {\n eyebrow: { tr: 'İnsan onayı', en: 'Human approval' },\n title: { tr: 'Onay bekleyen adım', en: 'A step is waiting for approval' },\n execution: { tr: 'çalıştırma', en: 'execution' },\n pausedAt: { tr: 'duraklatıldı', en: 'paused' },\n points: { tr: 'Onay noktaları', en: 'Approval points' },\n point: { tr: 'Nokta', en: 'Point' },\n output: { tr: 'Ajanın önerisi', en: 'What the agent proposes' },\n queuePosition: { tr: 'Sıra', en: 'Queue position' },\n submit: { tr: 'Onayla ve devam et', en: 'Approve and continue' },\n submitting: { tr: 'Gönderiliyor', en: 'Submitting' },\n refresh: { tr: 'Yenile', en: 'Refresh' },\n required: { tr: 'Bu alan zorunlu.', en: 'This field is required.' },\n notANumber: { tr: 'Sayı girin.', en: 'Enter a number.' },\n notJson: { tr: 'Geçerli JSON girin.', en: 'Enter valid JSON.' },\n notFound: {\n tr: 'Bu onay bulunamadı; süresi dolmuş veya tamamlanmış olabilir.',\n en: 'This approval could not be found; it may have expired or been completed.',\n },\n loadError: { tr: 'Onay yüklenemedi.', en: 'The approval could not be loaded.' },\n resumeError: { tr: 'Devam ettirilemedi.', en: 'The run could not be resumed.' },\n resumedMessage: {\n tr: 'Ajan kaldığı yerden devam ediyor.',\n en: 'The agent is continuing from where it paused.',\n },\n queuedMessage: {\n tr: 'Onay sıraya alındı; önceki devam işlemleri bitince çalışacak.',\n en: 'The approval is queued; it runs after the earlier resumes finish.',\n },\n paused: { tr: 'Onay bekliyor', en: 'Awaiting approval' },\n queued: { tr: 'Sırada', en: 'Queued' },\n resuming: { tr: 'Devam ediyor', en: 'Resuming' },\n resumed: { tr: 'Devam etti', en: 'Resumed' },\n failed: { tr: 'Başarısız', en: 'Failed' },\n },\n common: {\n loading: { tr: 'Yükleniyor', en: 'Loading' },\n retry: { tr: 'Tekrar dene', en: 'Retry' },\n notActivated: {\n tr: 'Aginies UI paketi etkinleştirilmedi.',\n en: 'The Aginies UI package is not activated.',\n },\n },\n} as const\n\ntype Section = keyof typeof STRINGS\ntype Key<S extends Section> = keyof (typeof STRINGS)[S]\n\n/** Returns a translator bound to a locale: `t('chat', 'send')`. */\nexport function translator(locale: Locale) {\n return function t<S extends Section>(section: S, key: Key<S>): string {\n const entry = STRINGS[section][key] as { tr: string; en: string }\n return entry[locale] ?? entry.en\n }\n}\n\nexport type Translator = ReturnType<typeof translator>\n","import { createContext, type ReactNode, useContext, useEffect, useMemo, useState } from 'react'\nimport { type ActivationState, AginiesClient, type AginiesConfig } from './client'\nimport { type Locale, type Translator, translator } from './i18n'\n\nlet defaultClient: AginiesClient | null = null\n\n/**\n * Creates the shared client and starts the activation handshake. Call it once, before\n * rendering any widget; `AginiesProvider` picks the client up automatically.\n */\nexport function init(config: AginiesConfig): AginiesClient {\n defaultClient = new AginiesClient(config)\n void defaultClient.activate()\n return defaultClient\n}\n\n/** The client created by `init()`, if any. */\nexport function getClient(): AginiesClient | null {\n return defaultClient\n}\n\nexport interface AginiesContextValue {\n client: AginiesClient\n state: ActivationState\n locale: Locale\n t: Translator\n}\n\nconst AginiesContext = createContext<AginiesContextValue | null>(null)\n\n/**\n * Whether the activation unlocks `module` (`chat`, `run`, `observability`, `approval`).\n * A widget whose module is locked renders nothing and warns once.\n */\nexport function useModule(module: string): boolean {\n const { client } = useAginies()\n const allowed = client.hasModule(module)\n useEffect(() => {\n if (!allowed && typeof console !== 'undefined') {\n console.warn(`[aginies] the \"${module}\" module is not enabled for this activation key`)\n }\n }, [allowed, module])\n return allowed\n}\n\nexport interface AginiesProviderProps {\n /** A client from `init()` or `new AginiesClient()`. Defaults to the one `init()` made. */\n client?: AginiesClient\n /** Override the client's locale for this subtree. */\n locale?: Locale\n /** Rendered while the activation handshake runs. Defaults to nothing. */\n fallback?: ReactNode\n children: ReactNode\n}\n\n/**\n * Provides the activated client to every widget below it. Children render only once the\n * activation succeeds; a rejected activation renders nothing and logs one warning, so a\n * page with a wrong or missing token degrades to plain content.\n */\nexport function AginiesProvider({\n client,\n locale,\n fallback = null,\n children,\n}: AginiesProviderProps) {\n const resolved = client ?? defaultClient\n const [state, setState] = useState<ActivationState>(\n resolved?.getState() ?? { status: 'rejected', reason: 'init() was not called' }\n )\n\n useEffect(() => {\n if (!resolved) return\n setState(resolved.getState())\n const unsubscribe = resolved.subscribe(setState)\n void resolved.activate()\n return unsubscribe\n }, [resolved])\n\n useEffect(() => {\n if (state.status === 'rejected' && typeof console !== 'undefined') {\n console.warn(`[aginies] UI kit not activated: ${state.reason}`)\n }\n }, [state])\n\n const value = useMemo<AginiesContextValue | null>(() => {\n if (!resolved) return null\n const l = locale ?? resolved.locale\n return { client: resolved, state, locale: l, t: translator(l) }\n }, [resolved, state, locale])\n\n if (!value) return null\n if (state.status === 'idle' || state.status === 'activating') return <>{fallback}</>\n if (state.status === 'rejected') return null\n return <AginiesContext.Provider value={value}>{children}</AginiesContext.Provider>\n}\n\n/** Access to the activated client, its configuration and the translator. */\nexport function useAginies(): AginiesContextValue {\n const ctx = useContext(AginiesContext)\n if (!ctx) {\n throw new Error('[aginies] useAginies must be used inside <AginiesProvider> after init()')\n }\n return ctx\n}\n","import { type FormEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { AginiesError } from '../client'\nimport { Button, cx, Eyebrow, Field, Input, Panel, Spinner, Tag, Textarea } from '../core'\nimport { useAginies, useModule } from '../provider'\nimport {\n buildSubmission,\n fieldsOf,\n getPausedExecution,\n initialValues,\n outputOf,\n type PausedExecution,\n type PausePoint,\n type ResumeField,\n type ResumeOutcome,\n resumeExecution,\n} from './approval-client'\n\nexport type ApprovalStatus =\n | 'loading'\n | 'ready'\n | 'submitting'\n | 'resumed'\n | 'queued'\n | 'not-found'\n | 'error'\n\n/**\n * State for one paused run: which pause point is selected, the approver's form, the\n * outcome of resuming. `ApprovalPanel` renders it; use the hook for a custom UI.\n */\nexport function useApproval(workflowId: string, executionId: string, contextId?: string) {\n const { client, t } = useAginies()\n const [status, setStatus] = useState<ApprovalStatus>('loading')\n const [execution, setExecution] = useState<PausedExecution | null>(null)\n const [selected, setSelected] = useState<string | null>(contextId ?? null)\n const [values, setValues] = useState<Record<string, string>>({})\n const [errors, setErrors] = useState<Record<string, string>>({})\n const [error, setError] = useState<string | null>(null)\n const [outcome, setOutcome] = useState<ResumeOutcome | null>(null)\n const selectedRef = useRef<string | null>(contextId ?? null)\n\n const pausePoint: PausePoint | null = useMemo(() => {\n if (!execution) return null\n return (\n execution.pausePoints.find((p) => p.contextId === selected) ??\n execution.pausePoints.find((p) => p.resumeStatus === 'paused') ??\n execution.pausePoints[0] ??\n null\n )\n }, [execution, selected])\n\n const fields: ResumeField[] = useMemo(() => fieldsOf(pausePoint), [pausePoint])\n\n const load = useCallback(async () => {\n setStatus('loading')\n setError(null)\n try {\n const detail = await getPausedExecution(client, workflowId, executionId)\n setExecution(detail)\n const wanted = contextId ?? selectedRef.current\n const point =\n detail.pausePoints.find((p) => p.contextId === wanted) ??\n detail.pausePoints.find((p) => p.resumeStatus === 'paused') ??\n detail.pausePoints[0]\n if (point) {\n selectedRef.current = point.contextId\n setSelected(point.contextId)\n setValues(initialValues(fieldsOf(point)))\n }\n setErrors({})\n setStatus('ready')\n } catch (err) {\n if (err instanceof AginiesError && err.code === 'NOT_FOUND') setStatus('not-found')\n else {\n setError(err instanceof Error ? err.message : t('approval', 'loadError'))\n setStatus('error')\n }\n }\n }, [client, workflowId, executionId, contextId, t])\n\n useEffect(() => {\n void load()\n }, [load])\n\n const select = useCallback(\n (nextContextId: string) => {\n selectedRef.current = nextContextId\n setSelected(nextContextId)\n const point = execution?.pausePoints.find((p) => p.contextId === nextContextId)\n setValues(initialValues(fieldsOf(point)))\n setErrors({})\n },\n [execution]\n )\n\n const setValue = useCallback((name: string, value: string) => {\n setValues((v) => ({ ...v, [name]: value }))\n setErrors((e) => {\n if (!(name in e)) return e\n const { [name]: _drop, ...rest } = e\n return rest\n })\n }, [])\n\n const submit = useCallback(async () => {\n if (!pausePoint || status === 'submitting') return\n const { submission, errors: problems } = buildSubmission(fields, values)\n if (Object.keys(problems).length > 0) {\n setErrors(\n Object.fromEntries(\n Object.entries(problems).map(([k, v]) => [\n k,\n v === 'required'\n ? t('approval', 'required')\n : v === 'number'\n ? t('approval', 'notANumber')\n : t('approval', 'notJson'),\n ])\n )\n )\n return\n }\n setStatus('submitting')\n setError(null)\n try {\n const result = await resumeExecution(\n client,\n workflowId,\n executionId,\n pausePoint.contextId,\n fields.length > 0 ? submission : null\n )\n setOutcome(result)\n setStatus(result.status === 'queued' ? 'queued' : 'resumed')\n } catch (err) {\n setError(err instanceof Error ? err.message : t('approval', 'resumeError'))\n setStatus('ready')\n }\n }, [client, workflowId, executionId, pausePoint, fields, values, status, t])\n\n return {\n status,\n execution,\n pausePoint,\n fields,\n values,\n errors,\n error,\n outcome,\n select,\n setValue,\n submit,\n reload: load,\n }\n}\n\n/* ───────────────────────────── component ───────────────────────────── */\n\nexport interface ApprovalPanelProps {\n /** Id of the agent (workflow) whose run is paused. */\n workflowId: string\n /** The paused execution, from the resume link the approver received. */\n executionId: string\n /** A specific pause point; defaults to the first one still paused. */\n contextId?: string\n title?: string\n description?: string\n /** Label of the resume button; defaults to \"Approve and continue\". */\n submitLabel?: string\n /** Called after the platform accepted the resume. */\n onResumed?: (outcome: ResumeOutcome) => void\n /** Hide the paused output block. */\n hideOutput?: boolean\n className?: string\n}\n\nconst STATUS_TONE: Record<string, 'default' | 'ok' | 'warn' | 'bad' | 'signal'> = {\n paused: 'warn',\n queued: 'signal',\n resuming: 'signal',\n resumed: 'ok',\n failed: 'bad',\n}\n\nexport function ApprovalPanel({\n workflowId,\n executionId,\n contextId,\n title,\n description,\n submitLabel,\n onResumed,\n hideOutput = false,\n className,\n}: ApprovalPanelProps) {\n const { t, locale } = useAginies()\n const enabled = useModule('approval')\n const a = useApproval(workflowId, executionId, contextId)\n const onResumedRef = useRef(onResumed)\n onResumedRef.current = onResumed\n\n useEffect(() => {\n if ((a.status === 'resumed' || a.status === 'queued') && a.outcome) {\n onResumedRef.current?.(a.outcome)\n }\n }, [a.status, a.outcome])\n\n if (!enabled) return null\n\n const point = a.pausePoint\n const output = hideOutput ? {} : outputOf(point)\n const outputEntries = Object.entries(output)\n const canSubmit = point?.resumeStatus === 'paused' && a.status === 'ready'\n const fmt = (iso: string | null | undefined) =>\n iso ? new Date(iso).toLocaleString(locale === 'tr' ? 'tr-TR' : 'en-GB') : ''\n\n const onSubmit = (e: FormEvent) => {\n e.preventDefault()\n void a.submit()\n }\n\n return (\n <Panel className={cx('agi-approval', className)} aria-busy={a.status === 'loading'}>\n <header className='agi-approval__head'>\n <Eyebrow>{t('approval', 'eyebrow')}</Eyebrow>\n <h3 className='agi-approval__title'>{title ?? t('approval', 'title')}</h3>\n {description && <p className='agi-approval__desc'>{description}</p>}\n {a.execution && (\n <p className='agi-approval__meta'>\n {t('approval', 'execution')}{' '}\n <span className='agi-approval__meta-value'>{a.execution.executionId.slice(0, 8)}</span>\n {a.execution.pausedAt && (\n <>\n {' · '}\n {t('approval', 'pausedAt')} {fmt(a.execution.pausedAt)}\n </>\n )}\n </p>\n )}\n </header>\n\n {a.status === 'loading' && (\n <div className='agi-approval__state'>\n <Spinner label={t('common', 'loading')} /> {t('common', 'loading')}\n </div>\n )}\n\n {a.status === 'not-found' && (\n <div className='agi-approval__state'>\n <p>{t('approval', 'notFound')}</p>\n </div>\n )}\n\n {a.status === 'error' && (\n <div className='agi-approval__state'>\n <p className='agi-approval__error'>{a.error}</p>\n <Button variant='outline' size='sm' onClick={() => void a.reload()}>\n {t('common', 'retry')}\n </Button>\n </div>\n )}\n\n {a.execution && a.execution.pausePoints.length > 1 && (\n <nav className='agi-approval__points' aria-label={t('approval', 'points')}>\n {a.execution.pausePoints.map((p, i) => (\n <button\n type='button'\n key={p.contextId}\n className={cx(\n 'agi-approval__point',\n p.contextId === point?.contextId && 'is-selected'\n )}\n onClick={() => a.select(p.contextId)}\n >\n <span>\n {t('approval', 'point')} {i + 1}\n </span>\n <Tag tone={STATUS_TONE[p.resumeStatus] ?? 'default'}>\n {t('approval', p.resumeStatus)}\n </Tag>\n </button>\n ))}\n </nav>\n )}\n\n {point && a.status !== 'loading' && (\n <>\n <div className='agi-approval__status'>\n <Tag tone={STATUS_TONE[point.resumeStatus] ?? 'default'}>\n {t('approval', point.resumeStatus)}\n </Tag>\n {typeof point.queuePosition === 'number' && point.queuePosition > 0 && (\n <span className='agi-approval__queue'>\n {t('approval', 'queuePosition')} {point.queuePosition}\n </span>\n )}\n </div>\n\n {outputEntries.length > 0 && (\n <section className='agi-approval__output' aria-label={t('approval', 'output')}>\n <div className='agi-approval__output-label'>{t('approval', 'output')}</div>\n <dl className='agi-approval__kv'>\n {outputEntries.map(([k, v]) => (\n <div key={k} className='agi-approval__kv-row'>\n <dt>{k}</dt>\n <dd>{typeof v === 'string' ? v : JSON.stringify(v, null, 2)}</dd>\n </div>\n ))}\n </dl>\n </section>\n )}\n\n {(a.status === 'resumed' || a.status === 'queued') && a.outcome ? (\n <output className='agi-approval__done'>\n <Tag tone={a.status === 'queued' ? 'signal' : 'ok'}>\n {t('approval', a.status === 'queued' ? 'queued' : 'resumed')}\n </Tag>\n <p>\n {a.status === 'queued'\n ? t('approval', 'queuedMessage')\n : t('approval', 'resumedMessage')}\n </p>\n </output>\n ) : (\n <form className='agi-approval__form' onSubmit={onSubmit}>\n {a.fields.map((f) => (\n <Field key={f.id} label={f.label} hint={f.description} error={a.errors[f.name]}>\n {renderField(f, a.values[f.name] ?? '', (v) => a.setValue(f.name, v), !canSubmit)}\n </Field>\n ))}\n {a.error && <p className='agi-approval__error'>{a.error}</p>}\n <div className='agi-approval__actions'>\n <Button variant='signal' type='submit' disabled={!canSubmit}>\n {a.status === 'submitting' ? (\n <>\n <Spinner label={t('approval', 'submitting')} /> {t('approval', 'submitting')}\n </>\n ) : (\n (submitLabel ?? t('approval', 'submit'))\n )}\n </Button>\n <Button\n variant='outline'\n type='button'\n onClick={() => void a.reload()}\n disabled={a.status === 'submitting'}\n >\n {t('approval', 'refresh')}\n </Button>\n </div>\n </form>\n )}\n </>\n )}\n </Panel>\n )\n}\n\nfunction renderField(f: ResumeField, value: string, set: (v: string) => void, disabled: boolean) {\n switch (f.type) {\n case 'boolean':\n return (\n <select\n className='agi-input'\n value={value}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n >\n <option value=''>—</option>\n <option value='true'>true</option>\n <option value='false'>false</option>\n </select>\n )\n case 'number':\n return (\n <Input\n type='number'\n value={value}\n placeholder={f.placeholder}\n required={f.required}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n />\n )\n case 'array':\n case 'object':\n case 'files':\n return (\n <Textarea\n value={value}\n rows={f.rows ?? 4}\n placeholder={f.placeholder ?? '{ }'}\n required={f.required}\n disabled={disabled}\n className='agi-approval__json'\n onChange={(e) => set(e.target.value)}\n />\n )\n default:\n if (Array.isArray(f.options) && f.options.length > 0) {\n return (\n <select\n className='agi-input'\n value={value}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n >\n <option value=''>—</option>\n {f.options.map((o) => {\n const opt =\n typeof o === 'object' && o !== null\n ? (o as { value?: unknown; label?: unknown })\n : { value: o, label: o }\n const v = String(opt.value ?? '')\n return (\n <option key={v} value={v}>\n {String(opt.label ?? v)}\n </option>\n )\n })}\n </select>\n )\n }\n if ((f.rows ?? 1) > 1) {\n return (\n <Textarea\n value={value}\n rows={f.rows}\n placeholder={f.placeholder}\n required={f.required}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n />\n )\n }\n return (\n <Input\n value={value}\n placeholder={f.placeholder}\n required={f.required}\n disabled={disabled}\n onChange={(e) => set(e.target.value)}\n />\n )\n }\n}\n","import { Fragment, type ReactNode } from 'react'\n\n/**\n * Small Markdown renderer for agent replies. It builds React elements directly, so nothing\n * from the model reaches the DOM as HTML. Covers what agents actually write: paragraphs,\n * headings, emphasis, inline and fenced code, links, lists, blockquotes, tables and rules.\n */\nexport function Markdown({ text, className }: { text: string; className?: string }) {\n return <div className={className}>{renderBlocks(parseBlocks(text))}</div>\n}\n\n/* ───────────────────────────── blocks ───────────────────────────── */\n\ntype Block =\n | { kind: 'paragraph'; lines: string[] }\n | { kind: 'heading'; level: number; text: string }\n | { kind: 'code'; lang: string; code: string }\n | { kind: 'quote'; blocks: Block[] }\n | { kind: 'list'; ordered: boolean; start: number; items: string[] }\n | {\n kind: 'table'\n header: string[]\n align: Array<'left' | 'center' | 'right' | null>\n rows: string[][]\n }\n | { kind: 'rule' }\n\nconst FENCE = /^\\s*(`{3,}|~{3,})\\s*([\\w+-]*)\\s*$/\nconst HEADING = /^(#{1,6})\\s+(.*?)\\s*#*\\s*$/\nconst RULE = /^\\s*([-*_])(?:\\s*\\1){2,}\\s*$/\nconst QUOTE = /^\\s*>\\s?(.*)$/\nconst LIST = /^\\s*(?:([-*+])|(\\d{1,9})[.)])\\s+(.*)$/\nconst TABLE_SEPARATOR = /^\\s*\\|?\\s*:?-+:?\\s*(\\|\\s*:?-+:?\\s*)*\\|?\\s*$/\n\nexport function parseBlocks(text: string): Block[] {\n const lines = text.replace(/\\r\\n?/g, '\\n').split('\\n')\n const blocks: Block[] = []\n let i = 0\n let paragraph: string[] = []\n\n const flush = () => {\n if (paragraph.length > 0) {\n blocks.push({ kind: 'paragraph', lines: paragraph })\n paragraph = []\n }\n }\n\n while (i < lines.length) {\n const line = lines[i] as string\n\n if (line.trim() === '') {\n flush()\n i += 1\n continue\n }\n\n const fence = FENCE.exec(line)\n if (fence) {\n flush()\n const marker = fence[1] as string\n const lang = fence[2] ?? ''\n const code: string[] = []\n i += 1\n while (i < lines.length && !(lines[i] as string).trim().startsWith(marker)) {\n code.push(lines[i] as string)\n i += 1\n }\n i += 1\n blocks.push({ kind: 'code', lang, code: code.join('\\n') })\n continue\n }\n\n const heading = HEADING.exec(line)\n if (heading) {\n flush()\n blocks.push({ kind: 'heading', level: (heading[1] as string).length, text: heading[2] ?? '' })\n i += 1\n continue\n }\n\n if (RULE.test(line)) {\n flush()\n blocks.push({ kind: 'rule' })\n i += 1\n continue\n }\n\n if (QUOTE.test(line)) {\n flush()\n const inner: string[] = []\n while (i < lines.length && QUOTE.test(lines[i] as string)) {\n inner.push((QUOTE.exec(lines[i] as string) as RegExpExecArray)[1] ?? '')\n i += 1\n }\n blocks.push({ kind: 'quote', blocks: parseBlocks(inner.join('\\n')) })\n continue\n }\n\n const list = LIST.exec(line)\n if (list) {\n flush()\n const ordered = list[2] !== undefined\n const start = ordered ? Number.parseInt(list[2] as string, 10) : 1\n const items: string[] = []\n while (i < lines.length) {\n const m = LIST.exec(lines[i] as string)\n if (m && (m[2] !== undefined) === ordered) {\n items.push(m[3] ?? '')\n i += 1\n } else if (\n items.length > 0 &&\n (lines[i] as string).trim() !== '' &&\n /^\\s{2,}/.test(lines[i] as string) &&\n !LIST.test(lines[i] as string)\n ) {\n // A continuation line indented under the previous item.\n items[items.length - 1] = `${items[items.length - 1]} ${(lines[i] as string).trim()}`\n i += 1\n } else {\n break\n }\n }\n blocks.push({ kind: 'list', ordered, start, items })\n continue\n }\n\n if (\n line.includes('|') &&\n i + 1 < lines.length &&\n TABLE_SEPARATOR.test(lines[i + 1] as string)\n ) {\n flush()\n const header = splitRow(line)\n const align = splitRow(lines[i + 1] as string).map((cell) => {\n const left = cell.startsWith(':')\n const right = cell.endsWith(':')\n if (left && right) return 'center'\n if (right) return 'right'\n if (left) return 'left'\n return null\n })\n const rows: string[][] = []\n i += 2\n while (i < lines.length && (lines[i] as string).includes('|')) {\n rows.push(splitRow(lines[i] as string))\n i += 1\n }\n blocks.push({ kind: 'table', header, align, rows })\n continue\n }\n\n paragraph.push(line)\n i += 1\n }\n flush()\n return blocks\n}\n\nfunction splitRow(line: string): string[] {\n const trimmed = line.trim().replace(/^\\|/, '').replace(/\\|$/, '')\n return trimmed.split(/(?<!\\\\)\\|/).map((cell) => cell.replace(/\\\\\\|/g, '|').trim())\n}\n\nfunction renderBlocks(blocks: Block[]): ReactNode[] {\n return blocks.map((block, index) => {\n switch (block.kind) {\n case 'paragraph':\n return (\n <p key={index}>\n {block.lines.map((line, n) => (\n <Fragment key={n}>\n {n > 0 && <br />}\n {renderInline(line)}\n </Fragment>\n ))}\n </p>\n )\n case 'heading': {\n const Tag = `h${Math.min(block.level + 2, 6)}` as 'h3' | 'h4' | 'h5' | 'h6'\n return <Tag key={index}>{renderInline(block.text)}</Tag>\n }\n case 'code':\n return (\n <pre key={index} data-lang={block.lang || undefined}>\n <code>{block.code}</code>\n </pre>\n )\n case 'quote':\n return <blockquote key={index}>{renderBlocks(block.blocks)}</blockquote>\n case 'list': {\n const items = block.items.map((item, n) => <li key={n}>{renderInline(item)}</li>)\n return block.ordered ? (\n <ol key={index} start={block.start === 1 ? undefined : block.start}>\n {items}\n </ol>\n ) : (\n <ul key={index}>{items}</ul>\n )\n }\n case 'table':\n return (\n <div key={index} className='agi-md__table'>\n <table>\n <thead>\n <tr>\n {block.header.map((cell, n) => (\n <th key={n} style={alignStyle(block.align[n])}>\n {renderInline(cell)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {block.rows.map((row, r) => (\n <tr key={r}>\n {block.header.map((_, n) => (\n <td key={n} style={alignStyle(block.align[n])}>\n {renderInline(row[n] ?? '')}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )\n case 'rule':\n return <hr key={index} />\n }\n })\n}\n\nfunction alignStyle(align: 'left' | 'center' | 'right' | null | undefined) {\n return align ? { textAlign: align } : undefined\n}\n\n/* ───────────────────────────── inline ───────────────────────────── */\n\nconst INLINE =\n /(`+)([\\s\\S]*?)\\1|\\*\\*([\\s\\S]+?)\\*\\*|(?<![\\w`])__([\\s\\S]+?)__(?![\\w])|~~([\\s\\S]+?)~~|\\*([^*\\n]+?)\\*|(?<![\\w`])_([^_\\n]+?)_(?![\\w])|\\[([^\\]]+)\\]\\(([^)\\s]+)(?:\\s+\"[^\"]*\")?\\)|(https?:\\/\\/[^\\s<]*[^\\s<.,;:!?)\\]'\"])/g\n\nexport function renderInline(text: string): ReactNode[] {\n const nodes: ReactNode[] = []\n let last = 0\n let key = 0\n // A fresh instance per call: the function recurses for nested emphasis, and a shared\n // global regex would have its lastIndex reset by the inner call.\n const inline = new RegExp(INLINE.source, 'g')\n let match = inline.exec(text)\n while (match) {\n if (match.index > last) nodes.push(text.slice(last, match.index))\n const [, , code, bold, boldAlt, strike, italic, italicAlt, linkText, linkHref, autoHref] = match\n if (code !== undefined) {\n nodes.push(<code key={key++}>{code.trim()}</code>)\n } else if (bold !== undefined || boldAlt !== undefined) {\n nodes.push(<strong key={key++}>{renderInline((bold ?? boldAlt) as string)}</strong>)\n } else if (strike !== undefined) {\n nodes.push(<del key={key++}>{renderInline(strike)}</del>)\n } else if (italic !== undefined || italicAlt !== undefined) {\n nodes.push(<em key={key++}>{renderInline((italic ?? italicAlt) as string)}</em>)\n } else if (linkText !== undefined && linkHref !== undefined) {\n nodes.push(link(key++, linkHref, renderInline(linkText)))\n } else if (autoHref !== undefined) {\n nodes.push(link(key++, autoHref, autoHref))\n }\n last = match.index + match[0].length\n match = inline.exec(text)\n }\n if (last < text.length) nodes.push(text.slice(last))\n return nodes\n}\n\nconst SAFE_HREF = /^(https?:\\/\\/|mailto:)/i\n\nfunction link(key: number, href: string, children: ReactNode): ReactNode {\n if (!SAFE_HREF.test(href)) return <Fragment key={key}>{children}</Fragment>\n return (\n <a key={key} href={href} target='_blank' rel='noopener noreferrer'>\n {children}\n </a>\n )\n}\n","/**\n * Structured replies: an agent may answer with a JSON document of items (text, buttons,\n * table, cards, pie, image) instead of prose. This mirrors the contract the platform's\n * hosted chat renders, so a workflow tuned for one renders identically in the widget.\n */\n\nexport interface StructuredButton {\n label: string\n action: string\n}\nexport interface StructuredTable {\n headers: string[]\n rows: string[][]\n}\nexport interface StructuredCard {\n title: string\n subtitle: string\n body: string\n image: string\n}\nexport interface StructuredPie {\n labels: string[]\n data: number[]\n}\nexport interface StructuredImage {\n url: string\n caption: string\n}\nexport interface StructuredItem {\n text: { content: string }\n buttons: StructuredButton[]\n table: StructuredTable\n cards: StructuredCard[]\n pie: StructuredPie\n image: StructuredImage\n}\nexport interface StructuredResponse {\n items: StructuredItem[]\n}\n\nconst isObject = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\nconst isStringArray = (v: unknown): v is string[] =>\n Array.isArray(v) && v.every((x) => typeof x === 'string')\nconst isNumberArray = (v: unknown): v is number[] =>\n Array.isArray(v) && v.every((x) => typeof x === 'number')\n\nfunction isCard(v: unknown): v is StructuredCard {\n return (\n isObject(v) &&\n typeof v.title === 'string' &&\n typeof v.subtitle === 'string' &&\n typeof v.body === 'string' &&\n typeof v.image === 'string'\n )\n}\n\nfunction normaliseItem(raw: unknown): StructuredItem | null {\n if (!isObject(raw)) return null\n const text = raw.text\n const buttons = raw.buttons\n const table = raw.table\n const pie = raw.pie\n const image = raw.image\n const cards = Array.isArray(raw.cards) ? raw.cards : raw.card ? [raw.card] : []\n if (!isObject(text) || typeof text.content !== 'string') return null\n if (\n !Array.isArray(buttons) ||\n !buttons.every(\n (b) => isObject(b) && typeof b.label === 'string' && typeof b.action === 'string'\n )\n )\n return null\n if (\n !isObject(table) ||\n !isStringArray(table.headers) ||\n !Array.isArray(table.rows) ||\n !table.rows.every(isStringArray)\n )\n return null\n if (!cards.every(isCard)) return null\n if (!isObject(pie) || !isStringArray(pie.labels) || !isNumberArray(pie.data)) return null\n if (!isObject(image) || typeof image.url !== 'string' || typeof image.caption !== 'string')\n return null\n return {\n text: { content: text.content },\n buttons: buttons as StructuredButton[],\n table: table as unknown as StructuredTable,\n cards: cards as StructuredCard[],\n pie: pie as unknown as StructuredPie,\n image: image as unknown as StructuredImage,\n }\n}\n\n/** Parses a reply into a structured response, or null when it is ordinary prose. */\nexport function parseStructured(raw: string): StructuredResponse | null {\n let parsed: unknown\n try {\n parsed = JSON.parse(raw)\n } catch {\n return null\n }\n const list = Array.isArray(parsed)\n ? parsed\n : isObject(parsed) && Array.isArray(parsed.items)\n ? parsed.items\n : null\n if (!list) return null\n const items = list.map(normaliseItem)\n if (items.some((i) => i === null)) return null\n return { items: items as StructuredItem[] }\n}\n\n/* ───────────────────────────── renderer ───────────────────────────── */\n\nexport interface StructuredUIProps {\n response: StructuredResponse\n /** Called with the button's action text; the widget sends it as the next message. */\n onAction?: (action: string) => void\n}\n\nexport function StructuredUI({ response, onAction }: StructuredUIProps) {\n return (\n <div className='agi-sui'>\n {response.items.map((item, i) => (\n <div key={i} className='agi-sui__item'>\n {item.text.content && <p className='agi-sui__text'>{item.text.content}</p>}\n {item.image.url && (\n <figure className='agi-sui__figure'>\n <img src={item.image.url} alt={item.image.caption} />\n {item.image.caption && <figcaption>{item.image.caption}</figcaption>}\n </figure>\n )}\n {item.cards.length > 0 && (\n <div className='agi-sui__cards'>\n {item.cards.map((c, ci) => (\n <div key={ci} className='agi-panel agi-sui__card'>\n {c.image && <img src={c.image} alt='' />}\n <div>\n <div className='agi-sui__card-title'>{c.title}</div>\n {c.subtitle && <div className='agi-sui__card-sub'>{c.subtitle}</div>}\n {c.body && <p>{c.body}</p>}\n </div>\n </div>\n ))}\n </div>\n )}\n {item.table.headers.length > 0 && (\n <div className='agi-sui__scroll'>\n <table className='agi-table'>\n <thead>\n <tr>\n {item.table.headers.map((h, hi) => (\n <th key={hi}>{h}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {item.table.rows.map((r, ri) => (\n <tr key={ri}>\n {r.map((cell, ci) => (\n <td key={ci}>{cell}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n {item.pie.labels.length > 0 && <Pie labels={item.pie.labels} data={item.pie.data} />}\n {item.buttons.length > 0 && (\n <div className='agi-sui__actions'>\n {item.buttons.map((b, bi) => (\n <button\n key={bi}\n type='button'\n className='agi-chip'\n onClick={() => onAction?.(b.action)}\n >\n {b.label}\n </button>\n ))}\n </div>\n )}\n </div>\n ))}\n </div>\n )\n}\n\nfunction Pie({ labels, data }: StructuredPie) {\n const total = data.reduce((a, b) => a + Math.max(0, b), 0)\n if (total <= 0) return null\n let angle = 0\n const slices = labels.map((label, i) => {\n const value = Math.max(0, data[i] ?? 0)\n const start = angle\n angle += (value / total) * 360\n return { label, value, start, end: angle, color: `var(--data-${(i % 6) + 1})` }\n })\n const arc = (start: number, end: number) => {\n const r = 48\n const cx = 50\n const cy = 50\n const a0 = ((start - 90) * Math.PI) / 180\n const a1 = ((end - 90) * Math.PI) / 180\n const large = end - start > 180 ? 1 : 0\n const x0 = cx + r * Math.cos(a0)\n const y0 = cy + r * Math.sin(a0)\n const x1 = cx + r * Math.cos(a1)\n const y1 = cy + r * Math.sin(a1)\n if (end - start >= 360) return `M${cx} ${cy - r} A${r} ${r} 0 1 1 ${cx - 0.01} ${cy - r} Z`\n return `M${cx} ${cy} L${x0} ${y0} A${r} ${r} 0 ${large} 1 ${x1} ${y1} Z`\n }\n return (\n <div className='agi-sui__pie'>\n <svg viewBox='0 0 100 100' role='img' aria-label={labels.join(', ')}>\n <title>{labels.join(', ')}</title>\n {slices.map((s) => (\n <path key={s.label} d={arc(s.start, s.end)} fill={s.color} />\n ))}\n </svg>\n <ul>\n {slices.map((s) => (\n <li key={s.label}>\n <span style={{ background: s.color }} />\n {s.label}\n <b>{Math.round((s.value / total) * 100)}%</b>\n </li>\n ))}\n </ul>\n </div>\n )\n}\n","import { useCallback, useEffect, useRef, useState } from 'react'\nimport { AginiesError } from '../client'\nimport { useAginies } from '../provider'\n\n/**\n * Voice for the chat widget: records the visitor with the browser's recorder, sends the\n * clip to the platform (which runs its own transcription model) and plays replies back\n * from the platform's synthesis endpoint. No third-party browser speech API is involved,\n * so it behaves the same in every browser and the audio never leaves the platform.\n */\n\nexport type VoiceState =\n | 'idle'\n | 'listening'\n | 'transcribing'\n | 'speaking'\n | 'denied'\n | 'unsupported'\n\nexport interface UseVoiceOptions {\n identifier: string\n /** Receives the transcript of a finished recording; empty recordings are dropped. */\n onTranscript: (text: string) => void\n /** Language hint for transcription; omit for auto-detection. */\n language?: string\n /** Stop recording after this much silence once speech was heard. */\n silenceMs?: number\n /** Longest single recording. */\n maxMs?: number\n}\n\nexport interface VoiceControls {\n state: VoiceState\n /** Last failure, cleared on the next successful action. */\n error: string | null\n /** Whether this browser can record at all. */\n supported: boolean\n /** Input level 0..1 while listening, for a meter. */\n level: number\n startListening: () => Promise<void>\n /** Ends the recording and transcribes it. */\n stopListening: () => void\n /** Ends the recording and discards it. */\n cancelListening: () => void\n /** Plays a reply; resolves when playback ends or is stopped. */\n speak: (text: string) => Promise<void>\n stopSpeaking: () => void\n}\n\nconst MIME_CANDIDATES = [\n 'audio/webm;codecs=opus',\n 'audio/webm',\n 'audio/mp4',\n 'audio/ogg;codecs=opus',\n]\n/** Recordings shorter than this are noise from a tap, not speech. */\nconst MIN_CLIP_BYTES = 800\nconst SPEECH_RMS = 0.02\n\nexport function isVoiceSupported(): boolean {\n return (\n typeof window !== 'undefined' &&\n typeof navigator !== 'undefined' &&\n !!navigator.mediaDevices?.getUserMedia &&\n typeof MediaRecorder !== 'undefined'\n )\n}\n\nexport function useVoice({\n identifier,\n onTranscript,\n language,\n silenceMs = 1400,\n maxMs = 60_000,\n}: UseVoiceOptions): VoiceControls {\n const { client, t } = useAginies()\n const supported = isVoiceSupported()\n const [state, setState] = useState<VoiceState>(supported ? 'idle' : 'unsupported')\n const [error, setError] = useState<string | null>(null)\n const [level, setLevel] = useState(0)\n\n const recorderRef = useRef<MediaRecorder | null>(null)\n const streamRef = useRef<MediaStream | null>(null)\n const chunksRef = useRef<Blob[]>([])\n const discardRef = useRef(false)\n const timersRef = useRef<number[]>([])\n const meterRef = useRef<{ ctx: AudioContext; interval: number } | null>(null)\n const audioRef = useRef<HTMLAudioElement | null>(null)\n const audioUrlRef = useRef<string | null>(null)\n const startingRef = useRef(false)\n const onTranscriptRef = useRef(onTranscript)\n onTranscriptRef.current = onTranscript\n\n const clearTimers = useCallback(() => {\n for (const id of timersRef.current) window.clearTimeout(id)\n timersRef.current = []\n if (meterRef.current) {\n window.clearInterval(meterRef.current.interval)\n void meterRef.current.ctx.close().catch(() => {})\n meterRef.current = null\n }\n setLevel(0)\n }, [])\n\n const releaseStream = useCallback(() => {\n for (const track of streamRef.current?.getTracks() ?? []) track.stop()\n streamRef.current = null\n }, [])\n\n const stopSpeaking = useCallback(() => {\n const audio = audioRef.current\n if (audio) {\n audio.pause()\n audio.src = ''\n audioRef.current = null\n }\n if (audioUrlRef.current) {\n URL.revokeObjectURL(audioUrlRef.current)\n audioUrlRef.current = null\n }\n setState((s) => (s === 'speaking' ? 'idle' : s))\n }, [])\n\n const finish = useCallback((recorder: MediaRecorder) => {\n recorder.stop()\n }, [])\n\n const stopListening = useCallback(() => {\n const recorder = recorderRef.current\n if (!recorder || recorder.state === 'inactive') return\n discardRef.current = false\n finish(recorder)\n }, [finish])\n\n const cancelListening = useCallback(() => {\n const recorder = recorderRef.current\n if (!recorder || recorder.state === 'inactive') return\n discardRef.current = true\n finish(recorder)\n }, [finish])\n\n const startMeter = useCallback(\n (stream: MediaStream, onSilence: () => void) => {\n const Ctx =\n typeof AudioContext !== 'undefined'\n ? AudioContext\n : (window as unknown as { webkitAudioContext?: typeof AudioContext }).webkitAudioContext\n if (!Ctx) return\n try {\n const ctx = new Ctx()\n const analyser = ctx.createAnalyser()\n analyser.fftSize = 2048\n ctx.createMediaStreamSource(stream).connect(analyser)\n const data = new Uint8Array(analyser.fftSize)\n let heard = false\n let lastVoice = Date.now()\n const interval = window.setInterval(() => {\n analyser.getByteTimeDomainData(data)\n let sum = 0\n for (const v of data) {\n const n = (v - 128) / 128\n sum += n * n\n }\n const rms = Math.sqrt(sum / data.length)\n setLevel(Math.min(1, rms * 6))\n if (rms > SPEECH_RMS) {\n heard = true\n lastVoice = Date.now()\n } else if (heard && Date.now() - lastVoice > silenceMs) {\n onSilence()\n }\n }, 100)\n meterRef.current = { ctx, interval }\n } catch {\n // No meter: the visitor stops the recording by hand or the cap ends it.\n }\n },\n [silenceMs]\n )\n\n const startListening = useCallback(async () => {\n if (!supported) {\n setState('unsupported')\n return\n }\n if (startingRef.current) return\n if (recorderRef.current && recorderRef.current.state !== 'inactive') return\n startingRef.current = true\n stopSpeaking()\n setError(null)\n\n let stream: MediaStream\n try {\n stream = await navigator.mediaDevices.getUserMedia({ audio: true })\n } catch {\n startingRef.current = false\n setState('denied')\n setError(t('voice', 'micDenied'))\n return\n }\n startingRef.current = false\n streamRef.current = stream\n\n const mimeType = MIME_CANDIDATES.find((m) => MediaRecorder.isTypeSupported?.(m))\n const recorder = new MediaRecorder(stream, mimeType ? { mimeType } : undefined)\n recorderRef.current = recorder\n chunksRef.current = []\n discardRef.current = false\n\n recorder.ondataavailable = (e) => {\n if (e.data && e.data.size > 0) chunksRef.current.push(e.data)\n }\n recorder.onstop = () => {\n clearTimers()\n releaseStream()\n recorderRef.current = null\n const type = recorder.mimeType || mimeType || 'audio/webm'\n const clip = new Blob(chunksRef.current, { type })\n chunksRef.current = []\n if (discardRef.current || clip.size < MIN_CLIP_BYTES) {\n setState('idle')\n return\n }\n setState('transcribing')\n const ext = type.includes('mp4') ? 'm4a' : type.includes('ogg') ? 'ogg' : 'webm'\n client\n .transcribe(identifier, clip, `turn.${ext}`, language)\n .then((result) => {\n setState('idle')\n if (result.transcript) onTranscriptRef.current(result.transcript)\n })\n .catch((err) => {\n setState('idle')\n setError(\n err instanceof AginiesError && err.code === 'VOICE_UNAVAILABLE'\n ? t('voice', 'unavailable')\n : t('voice', 'error')\n )\n })\n }\n\n recorder.start(250)\n setState('listening')\n startMeter(stream, () => stopListening())\n timersRef.current.push(window.setTimeout(() => stopListening(), maxMs))\n }, [\n supported,\n stopSpeaking,\n t,\n client,\n identifier,\n language,\n maxMs,\n stopListening,\n clearTimers,\n releaseStream,\n startMeter,\n ])\n\n const speak = useCallback(\n async (text: string) => {\n stopSpeaking()\n setError(null)\n setState('speaking')\n try {\n const blob = await client.speak(identifier, text)\n const url = URL.createObjectURL(blob)\n audioUrlRef.current = url\n const audio = new Audio(url)\n audioRef.current = audio\n await new Promise<void>((resolve) => {\n audio.onended = () => resolve()\n audio.onerror = () => resolve()\n audio.onpause = () => resolve()\n audio.play().catch(() => resolve())\n })\n } catch (err) {\n setError(\n err instanceof AginiesError && err.code === 'VOICE_UNAVAILABLE'\n ? t('voice', 'unavailable')\n : t('voice', 'error')\n )\n } finally {\n if (audioUrlRef.current) URL.revokeObjectURL(audioUrlRef.current)\n audioUrlRef.current = null\n audioRef.current = null\n setState((s) => (s === 'speaking' ? 'idle' : s))\n }\n },\n [client, identifier, stopSpeaking, t]\n )\n\n useEffect(\n () => () => {\n discardRef.current = true\n if (recorderRef.current && recorderRef.current.state !== 'inactive')\n recorderRef.current.stop()\n clearTimers()\n releaseStream()\n const audio = audioRef.current\n if (audio) audio.pause()\n if (audioUrlRef.current) URL.revokeObjectURL(audioUrlRef.current)\n },\n [clearTimers, releaseStream]\n )\n\n return {\n state,\n error,\n supported,\n level,\n startListening,\n stopListening,\n cancelListening,\n speak,\n stopSpeaking,\n }\n}\n","import { type ChangeEvent, type FormEvent, useCallback, useEffect, useRef, useState } from 'react'\nimport { AginiesError, type ChatConfig, type ChatFilePayload } from '../client'\nimport { Button, cx, Field, Input, Spinner } from '../core'\nimport { useAginies, useModule } from '../provider'\nimport { Markdown } from './markdown'\nimport { parseStructured, type StructuredResponse, StructuredUI } from './structured-ui'\nimport { useVoice, type VoiceControls } from './voice'\n\n/** A file the visitor attached to a message, as shown in the transcript. */\nexport interface ChatAttachment {\n name: string\n type: string\n size: number\n}\n\nexport interface ChatMessage {\n id: string\n role: 'user' | 'assistant'\n content: string\n attachments?: ChatAttachment[]\n structured?: StructuredResponse | null\n streaming?: boolean\n error?: boolean\n}\n\n/** Outcome of asking the platform to e-mail a verification code. */\nexport type CodeRequestResult = 'sent' | 'unauthorized' | 'error'\n\n/** Per-file and per-message limits for attachments; the platform rejects larger uploads. */\nexport const ATTACHMENT_LIMITS = { maxFiles: 5, maxBytes: 10 * 1024 * 1024 } as const\n\ntype AuthNeed = 'password' | 'email' | 'sso' | null\n\n/**\n * Chat state for one hosted-chat deployment: configuration, authentication, messages and\n * the streaming turn in flight. `ChatWidget` renders it; use the hook directly for a custom UI.\n */\nexport function useChat(identifier: string, enabled = true) {\n const { client, t } = useAginies()\n const [config, setConfig] = useState<ChatConfig | null>(null)\n const [authNeed, setAuthNeed] = useState<AuthNeed>(null)\n const [authTitle, setAuthTitle] = useState<string | undefined>()\n const [loadError, setLoadError] = useState<string | null>(null)\n const [messages, setMessages] = useState<ChatMessage[]>([])\n const [busy, setBusy] = useState(false)\n const [conversationId] = useState(() => randomId())\n const abortRef = useRef<AbortController | null>(null)\n\n const load = useCallback(async () => {\n setLoadError(null)\n try {\n const res = await client.getChat(identifier)\n if ('authRequired' in res) {\n setAuthNeed(res.authRequired === 'public' ? null : res.authRequired)\n setAuthTitle(res.title)\n return\n }\n setConfig(res)\n setAuthNeed(null)\n } catch (err) {\n setLoadError(\n err instanceof AginiesError && err.status === 403\n ? t('chat', 'unavailable')\n : t('chat', 'error')\n )\n }\n }, [client, identifier, t])\n\n useEffect(() => {\n if (enabled) void load()\n }, [load, enabled])\n\n const chatPath = `/api/chat/${encodeURIComponent(identifier)}`\n\n /** Sends the password as a first turn; the platform sets its cookie and returns the config. */\n const authenticate = useCallback(\n async ({ password }: { password: string }) => {\n const res = await client.fetchRaw(chatPath, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ password, conversationId }),\n })\n if (res.ok) {\n await load()\n return true\n }\n return false\n },\n [client, chatPath, conversationId, load]\n )\n\n /** Asks the platform to e-mail a one-time code to an address on the chat's allow-list. */\n const requestCode = useCallback(\n async (email: string): Promise<CodeRequestResult> => {\n const res = await client.fetchRaw(`${chatPath}/otp`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email }),\n })\n if (res.ok) return 'sent'\n return res.status === 403 ? 'unauthorized' : 'error'\n },\n [client, chatPath]\n )\n\n /** Verifies the e-mailed code; on success the platform sets its cookie and the chat loads. */\n const verifyCode = useCallback(\n async (email: string, otp: string) => {\n const res = await client.fetchRaw(`${chatPath}/otp`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ email, otp }),\n })\n if (res.ok) {\n await load()\n return true\n }\n return false\n },\n [client, chatPath, load]\n )\n\n const stop = useCallback(() => {\n abortRef.current?.abort()\n abortRef.current = null\n setBusy(false)\n setMessages((prev) => {\n const last = prev[prev.length - 1]\n if (!last || last.role !== 'assistant' || !last.streaming) return prev\n return [\n ...prev.slice(0, -1),\n { ...last, streaming: false, content: last.content || t('chat', 'stopped') },\n ]\n })\n }, [t])\n\n const send = useCallback(\n async (text: string, files: ChatFilePayload[] = []) => {\n const input = text.trim()\n if ((!input && files.length === 0) || busy) return\n const userMessage: ChatMessage = {\n id: randomId(),\n role: 'user',\n content: input,\n attachments: files.map(({ name, type, size }) => ({ name, type, size })),\n }\n const assistantId = randomId()\n setMessages((prev) => [\n ...prev,\n userMessage,\n { id: assistantId, role: 'assistant', content: '', streaming: true },\n ])\n setBusy(true)\n const controller = new AbortController()\n abortRef.current = controller\n let content = ''\n const update = (patch: Partial<ChatMessage>) =>\n setMessages((prev) => prev.map((m) => (m.id === assistantId ? { ...m, ...patch } : m)))\n try {\n for await (const ev of client.sendMessage(\n identifier,\n { input, conversationId, files },\n controller.signal\n )) {\n if (ev.type === 'chunk') {\n content += ev.text\n update({ content })\n } else if (ev.type === 'final') {\n const text = extractFinalText(ev.data)\n if (text && !content) {\n content = text\n update({ content })\n }\n } else if (ev.type === 'error') {\n update({ content: ev.message, error: true, streaming: false })\n }\n }\n update({ streaming: false, structured: parseStructured(content) })\n } catch (err) {\n if (controller.signal.aborted) return\n const message =\n err instanceof AginiesError && err.code === 'AUTH_REQUIRED'\n ? t('chat', 'unavailable')\n : t('chat', 'error')\n update({ content: message, error: true, streaming: false })\n if (err instanceof AginiesError && err.code === 'AUTH_REQUIRED') void load()\n } finally {\n abortRef.current = null\n setBusy(false)\n }\n },\n [busy, client, identifier, conversationId, t, load]\n )\n\n return {\n config,\n authNeed,\n authTitle,\n loadError,\n messages,\n busy,\n send,\n stop,\n authenticate,\n requestCode,\n verifyCode,\n reload: load,\n }\n}\n\nfunction extractFinalText(data: unknown): string | null {\n if (!data || typeof data !== 'object') return null\n const d = data as { output?: Record<string, Record<string, unknown>> }\n if (!d.output) return null\n for (const block of Object.values(d.output)) {\n if (block && typeof block === 'object') {\n const b = block as Record<string, unknown>\n if (typeof b.content === 'string') return b.content\n if (typeof b.result === 'string') return b.result\n }\n }\n return null\n}\n\nfunction randomId(): string {\n if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) return crypto.randomUUID()\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`\n}\n\n/* ───────────────────────────── widget ───────────────────────────── */\n\nexport interface ChatWidgetProps {\n /** Identifier of the deployed chat, the last segment of its hosted URL. */\n identifier: string\n /** `bubble` floats a launcher in a corner; `inline` fills its container; `full` fills the viewport. */\n mode?: 'bubble' | 'inline' | 'full'\n /** Corner for `bubble` mode. */\n position?: 'right' | 'left'\n /** Text on the launcher; defaults to the chat title. */\n launcherLabel?: string\n /** Start open (bubble mode). */\n defaultOpen?: boolean\n /** Theme for the widget subtree; `auto` follows the host page. */\n theme?: 'dark' | 'light' | 'auto'\n /**\n * Offer dictation and a hands-free voice conversation when the platform provides speech\n * for this chat and the browser can record. Default true.\n */\n voice?: boolean\n className?: string\n}\n\n/** Voice controls the composer shows: dictation into the draft and a hands-free mode. */\ninterface ComposerVoice {\n state: VoiceControls['state']\n error: string | null\n start: () => Promise<void>\n stop: () => void\n onHandsFree: () => void\n}\n\ninterface Dictation {\n id: number\n text: string\n}\n\nexport function ChatWidget({\n identifier,\n mode = 'inline',\n position = 'right',\n launcherLabel,\n defaultOpen = false,\n theme = 'auto',\n voice = true,\n className,\n}: ChatWidgetProps) {\n const [open, setOpen] = useState(defaultOpen || mode !== 'bubble')\n const { t } = useAginies()\n const enabled = useModule('chat')\n const chat = useChat(identifier, enabled)\n const [voiceMode, setVoiceMode] = useState(false)\n const [dictation, setDictation] = useState<Dictation | null>(null)\n const voiceModeRef = useRef(voiceMode)\n voiceModeRef.current = voiceMode\n const sendRef = useRef(chat.send)\n sendRef.current = chat.send\n const voiceControls = useVoice({\n identifier,\n onTranscript: (text) => {\n if (voiceModeRef.current) void sendRef.current(text)\n else setDictation({ id: Date.now(), text })\n },\n })\n const capabilities = chat.config?.voice\n const voiceAvailable = voice && voiceControls.supported && capabilities?.stt === true\n const title = chat.config?.title ?? chat.authTitle ?? launcherLabel ?? 'Aginies'\n const themeClass = theme === 'auto' ? undefined : theme === 'dark' ? 'dark' : 'light'\n if (!enabled) return null\n\n const leaveVoiceMode = () => {\n voiceControls.cancelListening()\n voiceControls.stopSpeaking()\n setVoiceMode(false)\n }\n\n const panel = (\n <section\n className={cx('agi-chat', `agi-chat--${mode}`, themeClass, className)}\n data-theme={themeClass}\n aria-label={title}\n >\n <header className='agi-chat__head'>\n <div className='agi-chat__title'>\n {chat.config?.customizations.imageUrl && (\n <img src={chat.config.customizations.imageUrl} alt='' />\n )}\n <div>\n <div className='agi-chat__name'>{title}</div>\n {chat.config?.description && (\n <div className='agi-chat__desc'>{chat.config.description}</div>\n )}\n </div>\n </div>\n {mode === 'bubble' && (\n <button\n type='button'\n className='agi-chat__close'\n onClick={() => setOpen(false)}\n aria-label={t('chat', 'close')}\n >\n ×\n </button>\n )}\n </header>\n\n {chat.loadError ? (\n <div className='agi-chat__state'>\n <p>{chat.loadError}</p>\n <Button variant='outline' size='sm' onClick={() => void chat.reload()}>\n {t('common', 'retry')}\n </Button>\n </div>\n ) : chat.authNeed ? (\n <ChatAuth\n need={chat.authNeed}\n onPassword={chat.authenticate}\n onRequestCode={chat.requestCode}\n onVerifyCode={chat.verifyCode}\n />\n ) : !chat.config ? (\n <div className='agi-chat__state'>\n <Spinner label={t('common', 'loading')} />\n </div>\n ) : voiceMode ? (\n <VoiceConversation\n messages={chat.messages}\n busy={chat.busy}\n voice={voiceControls}\n speakReplies={capabilities?.tts === true}\n onExit={leaveVoiceMode}\n />\n ) : (\n <>\n <MessageList\n messages={chat.messages}\n welcome={chat.config.customizations.welcomeMessage || t('chat', 'welcome')}\n onAction={(action) => void chat.send(action)}\n />\n <Composer\n busy={chat.busy}\n onSend={chat.send}\n onStop={chat.stop}\n dictation={dictation}\n voice={\n voiceAvailable\n ? {\n state: voiceControls.state,\n error: voiceControls.error,\n start: voiceControls.startListening,\n stop: voiceControls.stopListening,\n onHandsFree: () => setVoiceMode(true),\n }\n : undefined\n }\n />\n </>\n )}\n <footer className='agi-chat__foot'>\n <a href='https://www.aginies.com' target='_blank' rel='noreferrer'>\n {t('chat', 'poweredBy')}\n </a>\n </footer>\n </section>\n )\n\n if (mode !== 'bubble') return panel\n\n return (\n <div\n className={cx('agi-bubble', `agi-bubble--${position}`, themeClass)}\n data-theme={themeClass}\n >\n {open && panel}\n <button\n type='button'\n className={cx('agi-bubble__launcher', open && 'agi-bubble__launcher--open')}\n onClick={() => setOpen((o) => !o)}\n aria-expanded={open}\n aria-label={open ? t('chat', 'close') : t('chat', 'open')}\n >\n <svg\n width='22'\n height='22'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='1.7'\n strokeLinecap='round'\n strokeLinejoin='round'\n aria-hidden='true'\n >\n <path d='M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-5 4v-4H6.5A2.5 2.5 0 0 1 4 13.5v-8z' />\n <path d='M8 8h8M8 11.5h5' />\n </svg>\n {!open && <span>{launcherLabel ?? title}</span>}\n </button>\n </div>\n )\n}\n\n/* ───────────────────────────── parts ───────────────────────────── */\n\nfunction MessageList({\n messages,\n welcome,\n onAction,\n}: {\n messages: ChatMessage[]\n welcome: string\n onAction: (action: string) => void\n}) {\n const { t } = useAginies()\n const endRef = useRef<HTMLDivElement>(null)\n useEffect(() => {\n endRef.current?.scrollIntoView?.({ block: 'end' })\n }, [])\n return (\n <div className='agi-chat__messages' role='log' aria-live='polite'>\n <div className='agi-msg agi-msg--assistant'>\n <span className='agi-msg__who'>{t('chat', 'assistant')}</span>\n <div className='agi-msg__body'>{welcome}</div>\n </div>\n {messages.map((m) => (\n <div\n key={m.id}\n className={cx('agi-msg', `agi-msg--${m.role}`, m.error && 'agi-msg--error')}\n >\n <span className='agi-msg__who'>\n {m.role === 'user' ? t('chat', 'you') : t('chat', 'assistant')}\n </span>\n <div className='agi-msg__body'>\n {m.structured ? (\n <StructuredUI response={m.structured} onAction={onAction} />\n ) : m.content ? (\n m.role === 'assistant' && !m.error ? (\n <Markdown className='agi-md' text={m.content} />\n ) : (\n <p>{m.content}</p>\n )\n ) : m.streaming ? (\n <span className='agi-msg__thinking'>\n <Spinner label={t('chat', 'thinking')} /> {t('chat', 'thinking')}\n </span>\n ) : null}\n {m.attachments && m.attachments.length > 0 && (\n <ul className='agi-msg__files' aria-label={t('chat', 'attachments')}>\n {m.attachments.map((file, n) => (\n <li key={n} className='agi-file'>\n <FileGlyph />\n <span className='agi-file__name'>{file.name}</span>\n <span className='agi-file__size'>{formatBytes(file.size)}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n ))}\n <div ref={endRef} />\n </div>\n )\n}\n\nfunction Composer({\n busy,\n onSend,\n onStop,\n voice,\n dictation,\n}: {\n busy: boolean\n onSend: (text: string, files?: ChatFilePayload[]) => Promise<void>\n onStop: () => void\n voice?: ComposerVoice\n dictation?: Dictation | null\n}) {\n const { t } = useAginies()\n const [value, setValue] = useState('')\n const [files, setFiles] = useState<ChatFilePayload[]>([])\n const [fileError, setFileError] = useState<string | null>(null)\n const fileInput = useRef<HTMLInputElement>(null)\n\n // A finished dictation lands in the draft so the visitor can read and edit it first.\n useEffect(() => {\n if (dictation) setValue((v) => (v.trim() ? `${v.trimEnd()} ${dictation.text}` : dictation.text))\n }, [dictation])\n\n const listening = voice?.state === 'listening'\n const transcribing = voice?.state === 'transcribing'\n\n const submit = (e: FormEvent) => {\n e.preventDefault()\n if (busy) return\n const text = value\n const attached = files\n setValue('')\n setFiles([])\n setFileError(null)\n void onSend(text, attached)\n }\n\n const pick = async (e: ChangeEvent<HTMLInputElement>) => {\n const chosen = Array.from(e.target.files ?? [])\n e.target.value = ''\n if (chosen.length === 0) return\n if (files.length + chosen.length > ATTACHMENT_LIMITS.maxFiles) {\n setFileError(t('chat', 'tooManyFiles'))\n return\n }\n if (chosen.some((file) => file.size > ATTACHMENT_LIMITS.maxBytes)) {\n setFileError(t('chat', 'fileTooLarge'))\n return\n }\n setFileError(null)\n const payloads = await Promise.all(chosen.map(readFile))\n setFiles((prev) => [...prev, ...payloads])\n }\n\n const canSend = value.trim().length > 0 || files.length > 0\n\n return (\n <form className='agi-chat__composer' onSubmit={submit}>\n {(files.length > 0 || fileError) && (\n <div className='agi-chat__pending'>\n {files.map((file, n) => (\n <span key={n} className='agi-file agi-file--pending'>\n <FileGlyph />\n <span className='agi-file__name'>{file.name}</span>\n <button\n type='button'\n className='agi-file__remove'\n aria-label={`${t('chat', 'removeFile')}: ${file.name}`}\n onClick={() => setFiles((prev) => prev.filter((_, i) => i !== n))}\n >\n ×\n </button>\n </span>\n ))}\n {fileError && <span className='agi-chat__file-error'>{fileError}</span>}\n </div>\n )}\n {voice?.error && <div className='agi-chat__file-error'>{voice.error}</div>}\n <div className='agi-chat__row'>\n <input\n ref={fileInput}\n type='file'\n multiple\n hidden\n onChange={pick}\n data-testid='agi-file-input'\n />\n <Button\n variant='ghost'\n type='button'\n aria-label={t('chat', 'attach')}\n title={t('chat', 'attach')}\n disabled={busy}\n onClick={() => fileInput.current?.click()}\n >\n <svg width='16' height='16' viewBox='0 0 24 24' fill='none' aria-hidden='true'>\n <path\n d='M21 12.5 12.8 20.7a5.5 5.5 0 0 1-7.8-7.8l8.6-8.6a3.5 3.5 0 0 1 5 5l-8.6 8.6a1.5 1.5 0 0 1-2.1-2.1L15.5 8'\n stroke='currentColor'\n strokeWidth='1.6'\n strokeLinecap='round'\n strokeLinejoin='round'\n />\n </svg>\n </Button>\n <Input\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder={t('chat', 'placeholder')}\n aria-label={t('chat', 'placeholder')}\n autoComplete='off'\n />\n {voice && (\n <>\n <Button\n variant='ghost'\n type='button'\n className={cx('agi-chat__mic', listening && 'agi-chat__mic--on')}\n aria-label={listening ? t('voice', 'stopTalking') : t('voice', 'dictate')}\n aria-pressed={listening}\n title={listening ? t('voice', 'stopTalking') : t('voice', 'dictate')}\n disabled={busy || transcribing}\n onClick={() => (listening ? voice.stop() : void voice.start())}\n >\n {transcribing ? <Spinner label={t('voice', 'transcribing')} /> : <MicGlyph />}\n </Button>\n <Button\n variant='ghost'\n type='button'\n aria-label={t('voice', 'handsFree')}\n title={t('voice', 'handsFree')}\n disabled={busy || listening || transcribing}\n onClick={voice.onHandsFree}\n >\n <HeadsetGlyph />\n </Button>\n </>\n )}\n {busy ? (\n <Button variant='outline' onClick={onStop}>\n {t('chat', 'stop')}\n </Button>\n ) : (\n <Button variant='signal' type='submit' disabled={!canSend}>\n {t('chat', 'send')}\n </Button>\n )}\n </div>\n </form>\n )\n}\n\n/**\n * Hands-free conversation: the widget listens, sends what it heard, reads the reply aloud\n * when the platform can speak, and listens again. A tap while the agent speaks interrupts\n * it; a tap while listening ends the turn early.\n */\nfunction VoiceConversation({\n messages,\n busy,\n voice,\n speakReplies,\n onExit,\n}: {\n messages: ChatMessage[]\n busy: boolean\n voice: VoiceControls\n speakReplies: boolean\n onExit: () => void\n}) {\n const { t } = useAginies()\n const spokenRef = useRef<string | null>(null)\n const mountedRef = useRef(true)\n const lastAssistant = [...messages].reverse().find((m) => m.role === 'assistant')\n const lastUser = [...messages].reverse().find((m) => m.role === 'user')\n\n // Runs once on entering the mode; later turns are driven by the reply effect below.\n // biome-ignore lint/correctness/useExhaustiveDependencies: mount-only\n useEffect(() => {\n mountedRef.current = true\n spokenRef.current = lastAssistant?.id ?? null\n void voice.startListening()\n return () => {\n mountedRef.current = false\n }\n }, [])\n\n const replyId = lastAssistant?.id\n const replyStreaming = lastAssistant?.streaming === true\n // biome-ignore lint/correctness/useExhaustiveDependencies: a reply is handled once, when it completes\n useEffect(() => {\n if (!lastAssistant || replyStreaming || replyId === spokenRef.current) return\n spokenRef.current = replyId ?? null\n const run = async () => {\n if (speakReplies && lastAssistant.content && !lastAssistant.error) {\n await voice.speak(lastAssistant.content)\n }\n if (mountedRef.current) await voice.startListening()\n }\n void run()\n }, [replyId, replyStreaming])\n\n const status =\n voice.state === 'listening'\n ? t('voice', 'listening')\n : voice.state === 'transcribing'\n ? t('voice', 'transcribing')\n : voice.state === 'speaking'\n ? t('voice', 'speaking')\n : busy\n ? t('voice', 'thinking')\n : t('voice', 'idle')\n\n const hint =\n voice.state === 'listening'\n ? t('voice', 'stopTalking')\n : voice.state === 'speaking'\n ? t('voice', 'interrupt')\n : voice.state === 'transcribing' || busy\n ? ''\n : t('voice', 'talk')\n\n const tap = () => {\n if (voice.state === 'listening') voice.stopListening()\n else if (voice.state === 'speaking') {\n voice.stopSpeaking()\n void voice.startListening()\n } else if (voice.state === 'idle' && !busy) void voice.startListening()\n }\n\n return (\n <section className='agi-voice' aria-label={t('voice', 'handsFree')}>\n <button\n type='button'\n className='agi-voice__exit'\n onClick={onExit}\n aria-label={t('voice', 'exit')}\n >\n ×\n </button>\n <div className='agi-voice__status' aria-live='polite'>\n {status}\n </div>\n {lastUser?.content && <p className='agi-voice__you'>{lastUser.content}</p>}\n <div className='agi-voice__reply'>\n {lastAssistant?.content ? (\n <Markdown className='agi-md' text={lastAssistant.content} />\n ) : busy ? (\n <Spinner label={t('voice', 'thinking')} />\n ) : null}\n </div>\n <button\n type='button'\n className={cx(\n 'agi-voice__orb',\n `agi-voice__orb--${voice.state}`,\n busy && 'agi-voice__orb--busy'\n )}\n style={{ ['--agi-level' as string]: voice.level }}\n onClick={tap}\n aria-label={hint || status}\n disabled={voice.state === 'transcribing' || voice.state === 'unsupported'}\n >\n <MicGlyph size={28} />\n </button>\n <div className='agi-voice__hint'>{hint}</div>\n {voice.error && <div className='agi-voice__error'>{voice.error}</div>}\n </section>\n )\n}\n\nfunction MicGlyph({ size = 16 }: { size?: number }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='1.8'\n strokeLinecap='round'\n strokeLinejoin='round'\n aria-hidden='true'\n >\n <rect x='9' y='3' width='6' height='11' rx='3' />\n <path d='M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6' />\n </svg>\n )\n}\n\nfunction HeadsetGlyph() {\n return (\n <svg\n width='16'\n height='16'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='1.8'\n strokeLinecap='round'\n strokeLinejoin='round'\n aria-hidden='true'\n >\n <path d='M4 14v-2a8 8 0 0 1 16 0v2' />\n <rect x='3' y='13' width='4' height='6' rx='1.5' />\n <rect x='17' y='13' width='4' height='6' rx='1.5' />\n <path d='M19 19v1a2 2 0 0 1-2 2h-3' />\n </svg>\n )\n}\n\nfunction readFile(file: File): Promise<ChatFilePayload> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () =>\n resolve({\n name: file.name,\n type: file.type || 'application/octet-stream',\n size: file.size,\n data: String(reader.result),\n lastModified: file.lastModified,\n })\n reader.onerror = () => reject(reader.error)\n reader.readAsDataURL(file)\n })\n}\n\nfunction formatBytes(size: number): string {\n if (size < 1024) return `${size} B`\n if (size < 1024 * 1024) return `${(size / 1024).toFixed(0)} KB`\n return `${(size / (1024 * 1024)).toFixed(1)} MB`\n}\n\nfunction FileGlyph() {\n return (\n <svg width='12' height='12' viewBox='0 0 24 24' fill='none' aria-hidden='true'>\n <path\n d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5z'\n stroke='currentColor'\n strokeWidth='1.8'\n strokeLinejoin='round'\n />\n <path d='M14 3v5h5' stroke='currentColor' strokeWidth='1.8' strokeLinejoin='round' />\n </svg>\n )\n}\n\nfunction ChatAuth({\n need,\n onPassword,\n onRequestCode,\n onVerifyCode,\n}: {\n need: Exclude<AuthNeed, null>\n onPassword: (c: { password: string }) => Promise<boolean>\n onRequestCode: (email: string) => Promise<CodeRequestResult>\n onVerifyCode: (email: string, code: string) => Promise<boolean>\n}) {\n const { t, client } = useAginies()\n\n if (need === 'sso') {\n return (\n <div className='agi-chat__state'>\n <h3>{t('auth', 'ssoTitle')}</h3>\n <p>{t('auth', 'ssoHint')}</p>\n <Button\n variant='signal'\n onClick={() => window.open(`${client.baseUrl}/chat/`, '_blank', 'noopener')}\n >\n {t('auth', 'ssoButton')}\n </Button>\n </div>\n )\n }\n\n if (need === 'email') {\n return <EmailAuth onRequestCode={onRequestCode} onVerifyCode={onVerifyCode} />\n }\n\n return <PasswordAuth onPassword={onPassword} />\n}\n\nfunction PasswordAuth({\n onPassword,\n}: {\n onPassword: (c: { password: string }) => Promise<boolean>\n}) {\n const { t } = useAginies()\n const [value, setValue] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [pending, setPending] = useState(false)\n\n const submit = async (e: FormEvent) => {\n e.preventDefault()\n setPending(true)\n setError(null)\n const ok = await onPassword({ password: value })\n setPending(false)\n if (!ok) setError(t('auth', 'invalidPassword'))\n }\n\n return (\n <form className='agi-chat__state agi-chat__auth' onSubmit={submit}>\n <h3>{t('auth', 'passwordTitle')}</h3>\n <p>{t('auth', 'passwordHint')}</p>\n <Field label={t('auth', 'password')} error={error ?? undefined}>\n <Input\n type='password'\n value={value}\n onChange={(e) => setValue(e.target.value)}\n required\n autoComplete='current-password'\n />\n </Field>\n <Button variant='signal' type='submit' disabled={pending || !value}>\n {t('auth', 'continue')}\n </Button>\n </form>\n )\n}\n\n/**\n * Two steps, mirroring the platform's hosted page: the address goes to the allow-list check\n * and receives a six-digit code; the code is then verified and the platform sets its cookie.\n */\nfunction EmailAuth({\n onRequestCode,\n onVerifyCode,\n}: {\n onRequestCode: (email: string) => Promise<CodeRequestResult>\n onVerifyCode: (email: string, code: string) => Promise<boolean>\n}) {\n const { t } = useAginies()\n const [email, setEmail] = useState('')\n const [code, setCode] = useState('')\n const [step, setStep] = useState<'email' | 'code'>('email')\n const [error, setError] = useState<string | null>(null)\n const [notice, setNotice] = useState<string | null>(null)\n const [pending, setPending] = useState(false)\n\n const request = async () => {\n setPending(true)\n setError(null)\n setNotice(null)\n const result = await onRequestCode(email.trim())\n setPending(false)\n if (result === 'sent') {\n setStep('code')\n setNotice(t('auth', 'codeSent'))\n } else {\n setError(t('auth', result === 'unauthorized' ? 'invalidEmail' : 'codeError'))\n }\n }\n\n const verify = async () => {\n setPending(true)\n setError(null)\n setNotice(null)\n const ok = await onVerifyCode(email.trim(), code.trim())\n setPending(false)\n if (!ok) setError(t('auth', 'invalidCode'))\n }\n\n const submit = (e: FormEvent) => {\n e.preventDefault()\n void (step === 'email' ? request() : verify())\n }\n\n if (step === 'code') {\n return (\n <form className='agi-chat__state agi-chat__auth' onSubmit={submit}>\n <h3>{t('auth', 'emailTitle')}</h3>\n <p>\n {t('auth', 'codeHint')} <strong>{email}</strong>\n </p>\n <Field label={t('auth', 'code')} error={error ?? undefined} hint={notice ?? undefined}>\n <Input\n inputMode='numeric'\n autoComplete='one-time-code'\n pattern='[0-9]{6}'\n maxLength={6}\n value={code}\n onChange={(e) => setCode(e.target.value.replace(/\\D/g, ''))}\n required\n />\n </Field>\n <div className='agi-chat__auth-actions'>\n <Button variant='signal' type='submit' disabled={pending || code.length !== 6}>\n {t('auth', 'verify')}\n </Button>\n <Button variant='ghost' type='button' disabled={pending} onClick={() => void request()}>\n {t('auth', 'resend')}\n </Button>\n <Button\n variant='ghost'\n type='button'\n disabled={pending}\n onClick={() => {\n setStep('email')\n setCode('')\n setError(null)\n setNotice(null)\n }}\n >\n {t('auth', 'back')}\n </Button>\n </div>\n </form>\n )\n }\n\n return (\n <form className='agi-chat__state agi-chat__auth' onSubmit={submit}>\n <h3>{t('auth', 'emailTitle')}</h3>\n <p>{t('auth', 'emailHint')}</p>\n <Field label={t('auth', 'email')} error={error ?? undefined}>\n <Input\n type='email'\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n required\n autoComplete='email'\n />\n </Field>\n <Button variant='signal' type='submit' disabled={pending || !email.trim()}>\n {t('auth', 'sendCode')}\n </Button>\n </form>\n )\n}\n","/* @aginies/tokens v0.1.0 — generated from src/tokens.ts. Do not edit by hand. */\n\n/* Static tokens: type, shape, spacing, motion, layout. */\n:root {\n --font-display: 'Bricolage Grotesque Variable', 'Instrument Sans Variable', ui-sans-serif, system-ui, sans-serif;\n --font-body: 'Instrument Sans Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;\n --font-mono: 'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n --radius-sm: 4px;\n --radius-md: 6px;\n --radius-lg: 10px;\n --radius-xl: 14px;\n --radius-2xl: 20px;\n --radius-full: 9999px;\n --radius: var(--radius-lg);\n --space-1: 4px;\n --space-2: 8px;\n --space-3: 12px;\n --space-4: 16px;\n --space-5: 24px;\n --space-6: 32px;\n --space-7: 48px;\n --space-8: 64px;\n --fs-display: clamp(40px, 6.4vw, 88px);\n --lh-display: 0.96;\n --ls-display: -0.04em;\n --fs-h1: clamp(36px, 5.2vw, 68px);\n --lh-h1: 1;\n --ls-h1: -0.035em;\n --fs-h2: clamp(28px, 3.8vw, 50px);\n --lh-h2: 1.04;\n --ls-h2: -0.03em;\n --fs-h3: clamp(20px, 2vw, 26px);\n --lh-h3: 1.2;\n --ls-h3: -0.02em;\n --fs-h4: 17px;\n --lh-h4: 1.3;\n --ls-h4: -0.01em;\n --fs-stat: clamp(30px, 3.4vw, 44px);\n --lh-stat: 1;\n --ls-stat: -0.03em;\n --fs-lede: clamp(17px, 1.4vw, 20px);\n --lh-lede: 1.5;\n --fs-body: 16px;\n --lh-body: 1.55;\n --fs-body-2: 15px;\n --lh-body-2: 1.5;\n --fs-small: 13.5px;\n --lh-small: 1.45;\n --fs-eyebrow: 11.5px;\n --lh-eyebrow: 1;\n --ls-eyebrow: 0.14em;\n --fs-label: 11px;\n --lh-label: 1;\n --ls-label: 0.1em;\n --fs-tag: 11.5px;\n --lh-tag: 1;\n --ls-tag: 0.04em;\n --fs-ui: 13px;\n --lh-ui: 1.4;\n --fs-ui-sm: 12px;\n --lh-ui-sm: 1.35;\n --fs-ui-xs: 11px;\n --lh-ui-xs: 1.3;\n --duration-fast: 150ms;\n --duration-base: 200ms;\n --duration-slow: 300ms;\n --duration-enter: 600ms;\n --ease-enter: cubic-bezier(0.2, 0.7, 0.2, 1);\n --max: 1200px;\n --gutter: clamp(20px, 4vw, 40px);\n --section-y: clamp(64px, 9vw, 128px);\n --section-y-tight: clamp(40px, 6vw, 80px);\n --bp-sm: 640px;\n --bp-md: 768px;\n --bp-lg: 1024px;\n --bp-xl: 1280px;\n --bp-2xl: 1536px;\n --bp-nav: 1180px;\n --bp-wide: 1340px;\n --z-base: 0;\n --z-raised: 10;\n --z-sticky: 50;\n --z-dropdown: 100;\n --z-modal: 200;\n --z-toast: 300;\n --focus-ring: 2px solid var(--signal);\n --focus-ring-offset: 3px;\n --focus-field-ring: 0 0 0 3px var(--signal-soft);\n --neutral-50: #F4F6FA;\n --neutral-50-rgb: 244 246 250;\n --neutral-100: #EEF1F7;\n --neutral-100-rgb: 238 241 247;\n --neutral-200: #DCE1EC;\n --neutral-200-rgb: 220 225 236;\n --neutral-300: #C5CCDB;\n --neutral-300-rgb: 197 204 219;\n --neutral-400: #A9B2CC;\n --neutral-400-rgb: 169 178 204;\n --neutral-500: #7F8AA8;\n --neutral-500-rgb: 127 138 168;\n --neutral-600: #6B7590;\n --neutral-600-rgb: 107 117 144;\n --neutral-700: #3C4560;\n --neutral-700-rgb: 60 69 96;\n --neutral-800: #2A3350;\n --neutral-800-rgb: 42 51 80;\n --neutral-900: #1B2238;\n --neutral-900-rgb: 27 34 56;\n --neutral-950: #0B1020;\n --neutral-950-rgb: 11 16 32;\n}\n\n\n/* Dark is the default theme. */\n:root {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n}\n\n.dark, [data-theme=\"dark\"] {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n}\n\n.light, [data-theme=\"light\"] {\n --bg: #F4F6FA;\n --bg-rgb: 244 246 250;\n --bg-2: #FFFFFF;\n --bg-2-rgb: 255 255 255;\n --panel: #FFFFFF;\n --panel-rgb: 255 255 255;\n --panel-2: #EEF1F7;\n --panel-2-rgb: 238 241 247;\n --panel-3: #E4E9F2;\n --panel-3-rgb: 228 233 242;\n --line: #DCE1EC;\n --line-rgb: 220 225 236;\n --line-2: #C5CCDB;\n --line-2-rgb: 197 204 219;\n --line-3: #A9B2CC;\n --line-3-rgb: 169 178 204;\n --text: #0B1220;\n --text-rgb: 11 18 32;\n --text-2: #3C4560;\n --text-2-rgb: 60 69 96;\n --mute: #6B7590;\n --mute-rgb: 107 117 144;\n --signal: #0077C2;\n --signal-rgb: 0 119 194;\n --signal-2: #005E9A;\n --signal-2-rgb: 0 94 154;\n --signal-ink: #FFFFFF;\n --signal-ink-rgb: 255 255 255;\n --signal-soft: rgba(0, 119, 194, 0.10);\n --ok: #0B7F57;\n --ok-rgb: 11 127 87;\n --ok-ink: #FFFFFF;\n --ok-ink-rgb: 255 255 255;\n --ok-soft: rgba(11, 127, 87, 0.12);\n --warn: #9C5A12;\n --warn-rgb: 156 90 18;\n --warn-ink: #FFFFFF;\n --warn-ink-rgb: 255 255 255;\n --warn-soft: rgba(156, 90, 18, 0.12);\n --bad: #B3261E;\n --bad-rgb: 179 38 30;\n --bad-ink: #FFFFFF;\n --bad-ink-rgb: 255 255 255;\n --bad-soft: rgba(179, 38, 30, 0.10);\n --shadow: 0 20px 50px rgba(11, 18, 32, 0.10);\n --shadow-sm: 0 8px 20px rgba(11, 18, 32, 0.08);\n --overlay: rgba(11, 18, 32, 0.45);\n --signal-50: 238 246 255;\n --signal-100: 217 236 255;\n --signal-200: 181 219 254;\n --signal-300: 130 195 253;\n --signal-400: 82 170 244;\n --signal-500: 46 144 221;\n --signal-600: 21 120 191;\n --signal-700: 3 96 157;\n --signal-800: 3 73 121;\n --signal-900: 3 52 87;\n --signal-950: 1 34 61;\n --ok-50: 234 250 241;\n --ok-100: 213 242 226;\n --ok-200: 180 227 202;\n --ok-300: 135 206 171;\n --ok-400: 94 184 143;\n --ok-500: 60 160 118;\n --ok-600: 38 134 96;\n --ok-700: 22 109 75;\n --ok-800: 16 83 57;\n --ok-900: 10 59 40;\n --ok-950: 2 40 25;\n --warn-50: 255 243 233;\n --warn-100: 253 228 209;\n --warn-200: 244 205 174;\n --warn-300: 231 175 127;\n --warn-400: 213 146 87;\n --warn-500: 189 120 56;\n --warn-600: 161 98 36;\n --warn-700: 132 77 22;\n --warn-800: 101 59 15;\n --warn-900: 73 41 9;\n --warn-950: 50 26 3;\n --bad-50: 255 242 240;\n --bad-100: 254 226 221;\n --bad-200: 255 198 189;\n --bad-300: 254 159 145;\n --bad-400: 251 115 99;\n --bad-500: 226 85 71;\n --bad-600: 194 63 52;\n --bad-700: 160 46 37;\n --bad-800: 124 34 27;\n --bad-900: 89 23 17;\n --bad-950: 63 11 8;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230077C2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: light;\n}\n\n@media (prefers-color-scheme: light) {\n :root:not(.dark):not([data-theme=\"dark\"]) {\n --bg: #F4F6FA;\n --bg-rgb: 244 246 250;\n --bg-2: #FFFFFF;\n --bg-2-rgb: 255 255 255;\n --panel: #FFFFFF;\n --panel-rgb: 255 255 255;\n --panel-2: #EEF1F7;\n --panel-2-rgb: 238 241 247;\n --panel-3: #E4E9F2;\n --panel-3-rgb: 228 233 242;\n --line: #DCE1EC;\n --line-rgb: 220 225 236;\n --line-2: #C5CCDB;\n --line-2-rgb: 197 204 219;\n --line-3: #A9B2CC;\n --line-3-rgb: 169 178 204;\n --text: #0B1220;\n --text-rgb: 11 18 32;\n --text-2: #3C4560;\n --text-2-rgb: 60 69 96;\n --mute: #6B7590;\n --mute-rgb: 107 117 144;\n --signal: #0077C2;\n --signal-rgb: 0 119 194;\n --signal-2: #005E9A;\n --signal-2-rgb: 0 94 154;\n --signal-ink: #FFFFFF;\n --signal-ink-rgb: 255 255 255;\n --signal-soft: rgba(0, 119, 194, 0.10);\n --ok: #0B7F57;\n --ok-rgb: 11 127 87;\n --ok-ink: #FFFFFF;\n --ok-ink-rgb: 255 255 255;\n --ok-soft: rgba(11, 127, 87, 0.12);\n --warn: #9C5A12;\n --warn-rgb: 156 90 18;\n --warn-ink: #FFFFFF;\n --warn-ink-rgb: 255 255 255;\n --warn-soft: rgba(156, 90, 18, 0.12);\n --bad: #B3261E;\n --bad-rgb: 179 38 30;\n --bad-ink: #FFFFFF;\n --bad-ink-rgb: 255 255 255;\n --bad-soft: rgba(179, 38, 30, 0.10);\n --shadow: 0 20px 50px rgba(11, 18, 32, 0.10);\n --shadow-sm: 0 8px 20px rgba(11, 18, 32, 0.08);\n --overlay: rgba(11, 18, 32, 0.45);\n --signal-50: 238 246 255;\n --signal-100: 217 236 255;\n --signal-200: 181 219 254;\n --signal-300: 130 195 253;\n --signal-400: 82 170 244;\n --signal-500: 46 144 221;\n --signal-600: 21 120 191;\n --signal-700: 3 96 157;\n --signal-800: 3 73 121;\n --signal-900: 3 52 87;\n --signal-950: 1 34 61;\n --ok-50: 234 250 241;\n --ok-100: 213 242 226;\n --ok-200: 180 227 202;\n --ok-300: 135 206 171;\n --ok-400: 94 184 143;\n --ok-500: 60 160 118;\n --ok-600: 38 134 96;\n --ok-700: 22 109 75;\n --ok-800: 16 83 57;\n --ok-900: 10 59 40;\n --ok-950: 2 40 25;\n --warn-50: 255 243 233;\n --warn-100: 253 228 209;\n --warn-200: 244 205 174;\n --warn-300: 231 175 127;\n --warn-400: 213 146 87;\n --warn-500: 189 120 56;\n --warn-600: 161 98 36;\n --warn-700: 132 77 22;\n --warn-800: 101 59 15;\n --warn-900: 73 41 9;\n --warn-950: 50 26 3;\n --bad-50: 255 242 240;\n --bad-100: 254 226 221;\n --bad-200: 255 198 189;\n --bad-300: 254 159 145;\n --bad-400: 251 115 99;\n --bad-500: 226 85 71;\n --bad-600: 194 63 52;\n --bad-700: 160 46 37;\n --bad-800: 124 34 27;\n --bad-900: 89 23 17;\n --bad-950: 63 11 8;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230077C2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: light;\n }\n\n}\n\n/* A .room section always carries the palette opposite to its ambient theme. */\n:root .room, .dark .room, [data-theme=\"dark\"] .room {\n --bg: #F4F6FA;\n --bg-rgb: 244 246 250;\n --bg-2: #FFFFFF;\n --bg-2-rgb: 255 255 255;\n --panel: #FFFFFF;\n --panel-rgb: 255 255 255;\n --panel-2: #EEF1F7;\n --panel-2-rgb: 238 241 247;\n --panel-3: #E4E9F2;\n --panel-3-rgb: 228 233 242;\n --line: #DCE1EC;\n --line-rgb: 220 225 236;\n --line-2: #C5CCDB;\n --line-2-rgb: 197 204 219;\n --line-3: #A9B2CC;\n --line-3-rgb: 169 178 204;\n --text: #0B1220;\n --text-rgb: 11 18 32;\n --text-2: #3C4560;\n --text-2-rgb: 60 69 96;\n --mute: #6B7590;\n --mute-rgb: 107 117 144;\n --signal: #0077C2;\n --signal-rgb: 0 119 194;\n --signal-2: #005E9A;\n --signal-2-rgb: 0 94 154;\n --signal-ink: #FFFFFF;\n --signal-ink-rgb: 255 255 255;\n --signal-soft: rgba(0, 119, 194, 0.10);\n --ok: #0B7F57;\n --ok-rgb: 11 127 87;\n --ok-ink: #FFFFFF;\n --ok-ink-rgb: 255 255 255;\n --ok-soft: rgba(11, 127, 87, 0.12);\n --warn: #9C5A12;\n --warn-rgb: 156 90 18;\n --warn-ink: #FFFFFF;\n --warn-ink-rgb: 255 255 255;\n --warn-soft: rgba(156, 90, 18, 0.12);\n --bad: #B3261E;\n --bad-rgb: 179 38 30;\n --bad-ink: #FFFFFF;\n --bad-ink-rgb: 255 255 255;\n --bad-soft: rgba(179, 38, 30, 0.10);\n --shadow: 0 20px 50px rgba(11, 18, 32, 0.10);\n --shadow-sm: 0 8px 20px rgba(11, 18, 32, 0.08);\n --overlay: rgba(11, 18, 32, 0.45);\n --signal-50: 238 246 255;\n --signal-100: 217 236 255;\n --signal-200: 181 219 254;\n --signal-300: 130 195 253;\n --signal-400: 82 170 244;\n --signal-500: 46 144 221;\n --signal-600: 21 120 191;\n --signal-700: 3 96 157;\n --signal-800: 3 73 121;\n --signal-900: 3 52 87;\n --signal-950: 1 34 61;\n --ok-50: 234 250 241;\n --ok-100: 213 242 226;\n --ok-200: 180 227 202;\n --ok-300: 135 206 171;\n --ok-400: 94 184 143;\n --ok-500: 60 160 118;\n --ok-600: 38 134 96;\n --ok-700: 22 109 75;\n --ok-800: 16 83 57;\n --ok-900: 10 59 40;\n --ok-950: 2 40 25;\n --warn-50: 255 243 233;\n --warn-100: 253 228 209;\n --warn-200: 244 205 174;\n --warn-300: 231 175 127;\n --warn-400: 213 146 87;\n --warn-500: 189 120 56;\n --warn-600: 161 98 36;\n --warn-700: 132 77 22;\n --warn-800: 101 59 15;\n --warn-900: 73 41 9;\n --warn-950: 50 26 3;\n --bad-50: 255 242 240;\n --bad-100: 254 226 221;\n --bad-200: 255 198 189;\n --bad-300: 254 159 145;\n --bad-400: 251 115 99;\n --bad-500: 226 85 71;\n --bad-600: 194 63 52;\n --bad-700: 160 46 37;\n --bad-800: 124 34 27;\n --bad-900: 89 23 17;\n --bad-950: 63 11 8;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230077C2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: light;\n}\n\n.light .room, [data-theme=\"light\"] .room {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n}\n\n@media (prefers-color-scheme: light) {\n :root:not(.dark):not([data-theme=\"dark\"]) .room {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n }\n\n :root:not(.dark):not([data-theme=\"dark\"]) .light .room {\n --bg: #070A14;\n --bg-rgb: 7 10 20;\n --bg-2: #0B1020;\n --bg-2-rgb: 11 16 32;\n --panel: #0E1426;\n --panel-rgb: 14 20 38;\n --panel-2: #121A30;\n --panel-2-rgb: 18 26 48;\n --panel-3: #182240;\n --panel-3-rgb: 24 34 64;\n --line: #1B2238;\n --line-rgb: 27 34 56;\n --line-2: #2A3350;\n --line-2-rgb: 42 51 80;\n --line-3: #3C4560;\n --line-3-rgb: 60 69 96;\n --text: #E7ECF7;\n --text-rgb: 231 236 247;\n --text-2: #A9B2CC;\n --text-2-rgb: 169 178 204;\n --mute: #7F8AA8;\n --mute-rgb: 127 138 168;\n --signal: #5FC8FF;\n --signal-rgb: 95 200 255;\n --signal-2: #01B1F7;\n --signal-2-rgb: 1 177 247;\n --signal-ink: #06111F;\n --signal-ink-rgb: 6 17 31;\n --signal-soft: rgba(95, 200, 255, 0.12);\n --ok: #4FD1A0;\n --ok-rgb: 79 209 160;\n --ok-ink: #06111F;\n --ok-ink-rgb: 6 17 31;\n --ok-soft: rgba(79, 209, 160, 0.14);\n --warn: #F2B35B;\n --warn-rgb: 242 179 91;\n --warn-ink: #06111F;\n --warn-ink-rgb: 6 17 31;\n --warn-soft: rgba(242, 179, 91, 0.14);\n --bad: #FF7A7A;\n --bad-rgb: 255 122 122;\n --bad-ink: #06111F;\n --bad-ink-rgb: 6 17 31;\n --bad-soft: rgba(255, 122, 122, 0.14);\n --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);\n --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);\n --overlay: rgba(7, 10, 20, 0.6);\n --signal-50: 235 247 255;\n --signal-100: 211 238 255;\n --signal-200: 173 222 251;\n --signal-300: 122 199 241;\n --signal-400: 75 175 226;\n --signal-500: 33 150 202;\n --signal-600: 8 125 172;\n --signal-700: 1 100 139;\n --signal-800: 2 77 107;\n --signal-900: 0 54 78;\n --signal-950: 0 36 53;\n --ok-50: 231 251 241;\n --ok-100: 208 243 226;\n --ok-200: 171 229 202;\n --ok-300: 118 210 171;\n --ok-400: 65 188 142;\n --ok-500: 16 163 118;\n --ok-600: 0 136 97;\n --ok-700: 5 109 78;\n --ok-800: 5 84 59;\n --ok-900: 1 60 41;\n --ok-950: 1 40 26;\n --warn-50: 255 243 229;\n --warn-100: 251 230 204;\n --warn-200: 241 208 166;\n --warn-300: 227 178 114;\n --warn-400: 208 150 67;\n --warn-500: 185 125 25;\n --warn-600: 156 102 1;\n --warn-700: 125 82 5;\n --warn-800: 97 62 0;\n --warn-900: 69 43 1;\n --warn-950: 47 28 0;\n --bad-50: 255 242 241;\n --bad-100: 255 226 224;\n --bad-200: 255 197 194;\n --bad-300: 254 158 155;\n --bad-400: 244 119 119;\n --bad-500: 220 90 93;\n --bad-600: 188 69 72;\n --bad-700: 155 51 55;\n --bad-800: 120 38 41;\n --bad-900: 86 26 28;\n --bad-950: 60 14 16;\n --data-1: var(--signal);\n --data-2: var(--ok);\n --data-3: var(--warn);\n --data-4: var(--bad);\n --data-5: var(--text-2);\n --data-6: var(--mute);\n --canvas-bg: var(--bg);\n --canvas-grid: var(--line);\n --canvas-node: var(--panel);\n --canvas-node-line: var(--line-2);\n --edge: var(--line-2);\n --edge-hover: var(--text-2);\n --edge-active: var(--signal);\n --execution: var(--ok);\n --check-icon: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%235FC8FF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");\n color-scheme: dark;\n }\n\n}\n\n.room { background: var(--bg); color: var(--text); }\n\n/* @aginies/webuikit — component styles. Tokens come from @aginies/tokens (prepended at build). */\n\n/* ─── reset inside widgets ─── */\n.agi-chat,\n.agi-bubble,\n.agi-panel,\n.agi-btn,\n.agi-input,\n.agi-tag,\n.agi-chip {\n box-sizing: border-box;\n font-family: var(--font-body);\n color: var(--text);\n}\n.agi-chat *,\n.agi-bubble * {\n box-sizing: border-box;\n}\n\n/* ─── buttons ─── */\n.agi-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n height: 36px;\n padding: 0 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line-2);\n background: transparent;\n color: var(--text);\n font: inherit;\n font-size: 13.5px;\n font-weight: 600;\n letter-spacing: -0.005em;\n white-space: nowrap;\n cursor: pointer;\n transition:\n background var(--duration-fast) ease,\n border-color var(--duration-fast) ease,\n color var(--duration-fast) ease,\n transform var(--duration-fast) ease;\n}\n.agi-btn:hover {\n border-color: var(--text-2);\n background: var(--panel);\n}\n.agi-btn:active {\n transform: translateY(1px);\n}\n.agi-btn:focus-visible {\n outline: var(--focus-ring);\n outline-offset: var(--focus-ring-offset);\n}\n.agi-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n transform: none;\n}\n.agi-btn--primary {\n background: var(--text);\n border-color: var(--text);\n color: var(--bg);\n}\n.agi-btn--primary:hover {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n}\n.agi-btn--signal {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n}\n.agi-btn--signal:hover {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n filter: brightness(1.08);\n}\n.agi-btn--destructive {\n background: var(--bad);\n border-color: var(--bad);\n color: var(--bad-ink);\n}\n.agi-btn--ghost {\n border-color: transparent;\n color: var(--text-2);\n}\n.agi-btn--ghost:hover {\n background: var(--panel-2);\n color: var(--text);\n}\n.agi-btn--sm {\n height: 30px;\n padding: 0 10px;\n font-size: 12.5px;\n}\n.agi-btn--lg {\n height: 44px;\n padding: 0 18px;\n font-size: 15px;\n}\n\n/* ─── tags / chips ─── */\n.agi-tag {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n font-family: var(--font-mono);\n font-size: var(--fs-tag);\n letter-spacing: var(--ls-tag);\n padding: 3px 8px;\n border-radius: var(--radius-sm);\n border: 1px solid var(--line-2);\n color: var(--text-2);\n white-space: nowrap;\n}\n.agi-tag--signal {\n color: var(--signal);\n border-color: color-mix(in srgb, var(--signal) 45%, transparent);\n background: var(--signal-soft);\n}\n.agi-tag--ok {\n color: var(--ok);\n border-color: color-mix(in srgb, var(--ok) 45%, transparent);\n background: var(--ok-soft);\n}\n.agi-tag--warn {\n color: var(--warn);\n border-color: color-mix(in srgb, var(--warn) 45%, transparent);\n background: var(--warn-soft);\n}\n.agi-tag--bad {\n color: var(--bad);\n border-color: color-mix(in srgb, var(--bad) 45%, transparent);\n background: var(--bad-soft);\n}\n.agi-chip {\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 0 12px;\n border-radius: var(--radius-full);\n border: 1px solid var(--line-2);\n background: transparent;\n font: inherit;\n font-size: 13px;\n color: var(--text-2);\n cursor: pointer;\n transition: all var(--duration-fast) ease;\n}\n.agi-chip:hover {\n border-color: var(--text-2);\n color: var(--text);\n}\n.agi-chip[aria-pressed=\"true\"] {\n background: var(--signal);\n border-color: var(--signal);\n color: var(--signal-ink);\n font-weight: 600;\n}\n\n/* ─── surfaces / type ─── */\n.agi-panel {\n background: var(--panel);\n border: 1px solid var(--line);\n border-radius: var(--radius-lg);\n}\n.agi-panel--2 {\n background: var(--panel-2);\n}\n.agi-eyebrow {\n margin: 0;\n font-family: var(--font-mono);\n font-size: var(--fs-eyebrow);\n letter-spacing: var(--ls-eyebrow);\n text-transform: uppercase;\n color: var(--signal);\n font-weight: 500;\n}\n.agi-eyebrow--quiet {\n color: var(--mute);\n}\n.agi-stat {\n display: grid;\n gap: 4px;\n}\n.agi-stat__v {\n font-family: var(--font-display);\n font-size: var(--fs-stat);\n line-height: 1;\n letter-spacing: -0.03em;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n}\n.agi-stat__k {\n font-family: var(--font-mono);\n font-size: var(--fs-eyebrow);\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n}\n\n/* ─── fields ─── */\n.agi-field {\n display: grid;\n gap: 6px;\n}\n.agi-field__label {\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-field__error {\n color: var(--bad);\n font-size: 13px;\n}\n.agi-field__hint {\n font-size: 12px;\n color: var(--mute);\n}\n.agi-input {\n width: 100%;\n background: var(--bg-2);\n border: 1px solid var(--line-2);\n border-radius: var(--radius-md);\n padding: 9px 12px;\n color: var(--text);\n font: inherit;\n font-size: 14px;\n transition: border-color var(--duration-fast) ease;\n}\n.agi-input::placeholder {\n color: var(--mute);\n}\n.agi-input:focus {\n outline: none;\n border-color: var(--signal);\n box-shadow: var(--focus-field-ring);\n}\n.agi-textarea {\n resize: vertical;\n min-height: 90px;\n}\n\n/* ─── spinner ─── */\n.agi-spinner {\n display: inline-flex;\n gap: 4px;\n align-items: center;\n}\n.agi-spinner span {\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: var(--signal);\n animation: agi-pulse 1.2s ease-in-out infinite;\n}\n.agi-spinner span:nth-child(2) {\n animation-delay: 0.15s;\n}\n.agi-spinner span:nth-child(3) {\n animation-delay: 0.3s;\n}\n@keyframes agi-pulse {\n 0%,\n 80%,\n 100% {\n opacity: 0.25;\n transform: scale(0.8);\n }\n 40% {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n/* ─── table ─── */\n.agi-table {\n border-collapse: collapse;\n width: 100%;\n font-size: 13.5px;\n}\n.agi-table th,\n.agi-table td {\n text-align: left;\n padding: 8px 10px;\n border-bottom: 1px solid var(--line);\n vertical-align: top;\n}\n.agi-table th {\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n font-weight: 500;\n}\n.agi-table td {\n color: var(--text-2);\n}\n\n/* ─── chat ─── */\n.agi-chat {\n display: flex;\n flex-direction: column;\n min-height: 0;\n background: var(--panel);\n border: 1px solid var(--line);\n border-radius: var(--radius-lg);\n overflow: hidden;\n font-size: 14.5px;\n line-height: 1.5;\n}\n.agi-chat--inline {\n height: 100%;\n min-height: 420px;\n}\n.agi-chat--full {\n position: fixed;\n inset: 0;\n border-radius: 0;\n border: 0;\n z-index: var(--z-modal);\n}\n.agi-chat--bubble {\n width: min(400px, calc(100vw - 32px));\n height: min(600px, calc(100vh - 110px));\n box-shadow: var(--shadow);\n}\n.agi-chat__head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 12px 14px;\n border-bottom: 1px solid var(--line);\n background: var(--panel-2);\n}\n.agi-chat__title {\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n}\n.agi-chat__title img {\n width: 28px;\n height: 28px;\n border-radius: 6px;\n object-fit: cover;\n flex: none;\n}\n.agi-chat__name {\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 15px;\n letter-spacing: -0.01em;\n}\n.agi-chat__desc {\n color: var(--mute);\n font-size: 12.5px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.agi-chat__close {\n width: 30px;\n height: 30px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line-2);\n background: transparent;\n color: var(--text-2);\n font-size: 18px;\n line-height: 1;\n cursor: pointer;\n}\n.agi-chat__close:hover {\n color: var(--text);\n border-color: var(--text-2);\n}\n.agi-chat__messages {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 14px;\n display: grid;\n gap: 12px;\n align-content: start;\n background-image: radial-gradient(var(--line) 1px, transparent 1px);\n background-size: 18px 18px;\n}\n.agi-msg {\n display: grid;\n gap: 4px;\n max-width: 88%;\n}\n.agi-msg--user {\n justify-self: end;\n text-align: right;\n}\n.agi-msg__who {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-msg__body {\n padding: 10px 12px;\n border-radius: var(--radius-lg);\n border: 1px solid var(--line);\n background: var(--bg-2);\n color: var(--text);\n text-align: left;\n}\n.agi-msg__body p {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n.agi-msg--user .agi-msg__body {\n background: var(--signal-soft);\n border-color: color-mix(in srgb, var(--signal) 35%, transparent);\n}\n.agi-msg--error .agi-msg__body {\n border-color: color-mix(in srgb, var(--bad) 45%, transparent);\n background: var(--bad-soft);\n color: var(--bad);\n}\n.agi-msg__thinking {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n color: var(--mute);\n font-size: 13px;\n}\n.agi-chat__composer {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border-top: 1px solid var(--line);\n background: var(--panel);\n}\n.agi-chat__row {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.agi-chat__row .agi-input {\n flex: 1;\n min-width: 0;\n}\n.agi-chat__pending {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n align-items: center;\n}\n.agi-chat__file-error {\n font-size: 12px;\n color: var(--bad);\n}\n.agi-file {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n max-width: 100%;\n padding: 3px 8px;\n border-radius: 999px;\n border: 1px solid var(--line);\n background: var(--panel-2);\n color: var(--text-2);\n font-family: var(--font-mono);\n font-size: 11px;\n}\n.agi-file__name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--text);\n}\n.agi-file__size {\n color: var(--mute);\n}\n.agi-file__remove {\n border: 0;\n background: none;\n padding: 0 2px;\n color: var(--mute);\n cursor: pointer;\n font-size: 14px;\n line-height: 1;\n}\n.agi-file__remove:hover {\n color: var(--bad);\n}\n.agi-msg__files {\n list-style: none;\n margin: 8px 0 0;\n padding: 0;\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.agi-chat__auth-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n/* ─── voice ─── */\n.agi-chat__mic--on {\n color: var(--signal);\n border-color: var(--signal);\n background: var(--signal-soft);\n}\n.agi-voice {\n position: relative;\n flex: 1;\n min-height: 0;\n display: grid;\n grid-template-rows: auto auto 1fr auto auto;\n justify-items: center;\n align-content: center;\n gap: 14px;\n padding: 28px 20px 24px;\n text-align: center;\n overflow: hidden;\n background: radial-gradient(circle at 50% 30%, var(--signal-soft), transparent 60%);\n}\n.agi-voice__exit {\n position: absolute;\n top: 10px;\n right: 12px;\n width: 28px;\n height: 28px;\n border-radius: 999px;\n border: 1px solid var(--line);\n background: var(--panel);\n color: var(--text-2);\n font-size: 16px;\n line-height: 1;\n cursor: pointer;\n}\n.agi-voice__exit:hover {\n color: var(--text);\n border-color: var(--text-2);\n}\n.agi-voice__status {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.1em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-voice__you {\n margin: 0;\n max-width: 34ch;\n color: var(--text-2);\n font-size: 13.5px;\n}\n.agi-voice__reply {\n min-height: 0;\n max-width: 46ch;\n overflow-y: auto;\n color: var(--text);\n text-align: left;\n}\n.agi-voice__reply .agi-md {\n font-size: 15px;\n}\n.agi-voice__orb {\n width: 92px;\n height: 92px;\n border-radius: 999px;\n border: 1px solid var(--line-2);\n background: var(--panel-2);\n color: var(--text);\n display: grid;\n place-items: center;\n cursor: pointer;\n transition:\n box-shadow 120ms linear,\n border-color 160ms ease,\n background 160ms ease;\n}\n.agi-voice__orb:hover {\n border-color: var(--text-2);\n}\n.agi-voice__orb:disabled {\n cursor: default;\n opacity: 0.6;\n}\n.agi-voice__orb--listening {\n border-color: var(--signal);\n color: var(--signal);\n background: var(--signal-soft);\n box-shadow: 0 0 0 calc(4px + var(--agi-level, 0) * 28px)\n color-mix(in srgb, var(--signal) 22%, transparent);\n}\n.agi-voice__orb--speaking {\n border-color: var(--signal);\n animation: agi-voice-speak 1.4s ease-in-out infinite;\n}\n.agi-voice__orb--busy,\n.agi-voice__orb--transcribing {\n border-style: dashed;\n}\n@keyframes agi-voice-speak {\n 0%,\n 100% {\n box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 18%, transparent);\n }\n 50% {\n box-shadow: 0 0 0 16px color-mix(in srgb, var(--signal) 8%, transparent);\n }\n}\n.agi-voice__hint {\n min-height: 1.4em;\n font-size: 13px;\n color: var(--text-2);\n}\n.agi-voice__error {\n font-size: 12.5px;\n color: var(--bad);\n max-width: 40ch;\n}\n\n/* ─── markdown in replies ─── */\n.agi-md {\n display: grid;\n gap: 8px;\n word-break: break-word;\n}\n.agi-md p {\n margin: 0;\n white-space: normal;\n}\n.agi-md h3,\n.agi-md h4,\n.agi-md h5,\n.agi-md h6 {\n margin: 4px 0 0;\n font-family: var(--font-display);\n font-weight: 600;\n letter-spacing: -0.01em;\n line-height: 1.3;\n}\n.agi-md h3 {\n font-size: 15.5px;\n}\n.agi-md h4 {\n font-size: 14.5px;\n}\n.agi-md h5,\n.agi-md h6 {\n font-size: 13.5px;\n}\n.agi-md ul,\n.agi-md ol {\n margin: 0;\n padding-left: 20px;\n display: grid;\n gap: 3px;\n}\n.agi-md a {\n color: var(--signal);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.agi-md code {\n font-family: var(--font-mono);\n font-size: 12px;\n padding: 1px 5px;\n border-radius: 4px;\n background: var(--panel-3);\n border: 1px solid var(--line);\n}\n.agi-md pre {\n margin: 0;\n padding: 10px 12px;\n overflow-x: auto;\n border-radius: var(--radius);\n background: var(--panel-3);\n border: 1px solid var(--line);\n}\n.agi-md pre code {\n padding: 0;\n border: 0;\n background: none;\n font-size: 12px;\n line-height: 1.55;\n}\n.agi-md blockquote {\n margin: 0;\n padding: 2px 0 2px 12px;\n border-left: 2px solid var(--line-2);\n color: var(--text-2);\n display: grid;\n gap: 6px;\n}\n.agi-md hr {\n border: 0;\n border-top: 1px solid var(--line);\n margin: 4px 0;\n}\n.agi-md__table {\n overflow-x: auto;\n}\n.agi-md table {\n border-collapse: collapse;\n width: 100%;\n font-size: 12.5px;\n}\n.agi-md th,\n.agi-md td {\n padding: 6px 8px;\n border: 1px solid var(--line);\n text-align: left;\n vertical-align: top;\n}\n.agi-md th {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n background: var(--panel-2);\n}\n.agi-chat__foot {\n padding: 6px 12px;\n border-top: 1px solid var(--line);\n text-align: right;\n}\n.agi-chat__foot a {\n font-family: var(--font-mono);\n font-size: 10.5px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n text-decoration: none;\n}\n.agi-chat__foot a:hover {\n color: var(--signal);\n}\n.agi-chat__state {\n flex: 1;\n display: grid;\n align-content: center;\n justify-items: start;\n gap: 12px;\n padding: 24px;\n}\n.agi-chat__state h3 {\n margin: 0;\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 17px;\n letter-spacing: -0.01em;\n}\n.agi-chat__state p {\n margin: 0;\n color: var(--text-2);\n}\n.agi-chat__auth .agi-field {\n width: 100%;\n max-width: 360px;\n}\n\n/* ─── structured replies ─── */\n.agi-sui {\n display: grid;\n gap: 12px;\n}\n.agi-sui__item {\n display: grid;\n gap: 10px;\n}\n.agi-sui__text {\n margin: 0;\n white-space: pre-wrap;\n}\n.agi-sui__figure {\n margin: 0;\n}\n.agi-sui__figure img {\n max-width: 100%;\n border-radius: var(--radius-md);\n display: block;\n}\n.agi-sui__figure figcaption {\n font-size: 12.5px;\n color: var(--mute);\n margin-top: 4px;\n}\n.agi-sui__cards {\n display: grid;\n gap: 8px;\n}\n.agi-sui__card {\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 10px;\n padding: 10px;\n background: var(--panel-2);\n}\n.agi-sui__card img {\n width: 56px;\n height: 56px;\n border-radius: var(--radius-md);\n object-fit: cover;\n}\n.agi-sui__card p {\n margin: 4px 0 0;\n color: var(--text-2);\n font-size: 13.5px;\n}\n.agi-sui__card-title {\n font-weight: 600;\n}\n.agi-sui__card-sub {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--mute);\n}\n.agi-sui__scroll {\n overflow-x: auto;\n}\n.agi-sui__actions {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.agi-sui__pie {\n display: grid;\n grid-template-columns: 96px 1fr;\n gap: 12px;\n align-items: center;\n}\n.agi-sui__pie svg {\n width: 96px;\n height: 96px;\n}\n.agi-sui__pie ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n font-size: 13px;\n}\n.agi-sui__pie li {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--text-2);\n}\n.agi-sui__pie li span {\n width: 10px;\n height: 10px;\n border-radius: 2px;\n flex: none;\n}\n.agi-sui__pie li b {\n margin-left: auto;\n font-family: var(--font-mono);\n font-weight: 500;\n color: var(--text);\n}\n\n/* ─── bubble launcher ─── */\n.agi-bubble {\n position: fixed;\n bottom: 20px;\n z-index: var(--z-toast);\n display: grid;\n gap: 10px;\n justify-items: end;\n}\n.agi-bubble--right {\n right: 20px;\n}\n.agi-bubble--left {\n left: 20px;\n justify-items: start;\n}\n.agi-bubble__launcher {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n height: 48px;\n padding: 0 18px 0 14px;\n border-radius: var(--radius-full);\n border: 1px solid var(--signal);\n background: var(--signal);\n color: var(--signal-ink);\n font: inherit;\n font-family: var(--font-body);\n font-weight: 600;\n font-size: 14px;\n cursor: pointer;\n box-shadow: var(--shadow-sm);\n transition: transform var(--duration-fast) ease;\n}\n.agi-bubble__launcher:hover {\n transform: translateY(-1px);\n}\n.agi-bubble__launcher--open {\n width: 48px;\n padding: 0;\n justify-content: center;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .agi-spinner span {\n animation: none;\n opacity: 0.7;\n }\n}\n\n/* ─── agent runner ─── */\n.agi-run {\n display: grid;\n gap: 14px;\n padding: 16px;\n font-size: 14.5px;\n}\n.agi-run__title {\n margin: 0;\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 17px;\n letter-spacing: -0.01em;\n}\n.agi-run__desc {\n margin: 4px 0 0;\n color: var(--text-2);\n}\n.agi-run__form {\n display: grid;\n gap: 12px;\n}\n.agi-run__actions {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.agi-run__status {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n color: var(--mute);\n font-size: 13px;\n}\n.agi-checkbox {\n width: 16px;\n height: 16px;\n accent-color: var(--signal);\n}\n.agi-run__steps {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n}\n.agi-run__step {\n display: grid;\n grid-template-columns: 10px 1fr auto;\n gap: 8px;\n align-items: center;\n font-size: 13px;\n color: var(--text-2);\n}\n.agi-run__step-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--line-2);\n}\n.agi-run__step.is-running .agi-run__step-dot {\n background: var(--signal);\n animation: agi-pulse 1.2s ease-in-out infinite;\n}\n.agi-run__step.is-done .agi-run__step-dot {\n background: var(--ok);\n}\n.agi-run__step.is-error .agi-run__step-dot {\n background: var(--bad);\n}\n.agi-run__step-meta {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--mute);\n}\n.agi-run__result {\n display: grid;\n gap: 8px;\n padding: 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: var(--bg-2);\n}\n.agi-run__text {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n}\n.agi-run__output {\n margin: 0;\n font-family: var(--font-mono);\n font-size: 12.5px;\n white-space: pre-wrap;\n word-break: break-word;\n color: var(--text-2);\n}\n.agi-run__error {\n margin: 0;\n color: var(--bad);\n}\n.agi-run__meta {\n margin: 0;\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.04em;\n color: var(--mute);\n}\n.agi-run__meta b {\n font-weight: 500;\n color: var(--text-2);\n}\n\n/* ─── approval ─── */\n.agi-approval {\n display: grid;\n gap: 14px;\n padding: 16px;\n font-size: 14.5px;\n}\n.agi-approval__head {\n display: grid;\n gap: 4px;\n}\n.agi-approval__title {\n margin: 0;\n font-family: var(--font-display);\n font-weight: 600;\n font-size: 17px;\n letter-spacing: -0.01em;\n}\n.agi-approval__desc {\n margin: 0;\n color: var(--text-2);\n}\n.agi-approval__meta {\n margin: 2px 0 0;\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.04em;\n color: var(--mute);\n}\n.agi-approval__meta-value {\n font-weight: 500;\n color: var(--text-2);\n}\n.agi-approval__state {\n display: grid;\n gap: 10px;\n justify-items: start;\n color: var(--text-2);\n}\n.agi-approval__state p {\n margin: 0;\n}\n.agi-approval__points {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n}\n.agi-approval__point {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 6px 10px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: transparent;\n color: var(--text-2);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n}\n.agi-approval__point.is-selected {\n border-color: var(--signal);\n color: var(--text);\n}\n.agi-approval__status {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.agi-approval__queue {\n font-size: 13px;\n color: var(--mute);\n}\n.agi-approval__output {\n display: grid;\n gap: 8px;\n padding: 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: var(--bg-2);\n}\n.agi-approval__output-label {\n font-family: var(--font-mono);\n font-size: 11px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: var(--mute);\n}\n.agi-approval__kv {\n margin: 0;\n display: grid;\n gap: 6px;\n}\n.agi-approval__kv-row {\n display: grid;\n grid-template-columns: minmax(80px, 160px) 1fr;\n gap: 10px;\n align-items: start;\n}\n.agi-approval__kv dt {\n font-family: var(--font-mono);\n font-size: 12px;\n color: var(--text-2);\n word-break: break-word;\n}\n.agi-approval__kv dd {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n font-size: 13.5px;\n}\n.agi-approval__form {\n display: grid;\n gap: 12px;\n}\n.agi-approval__json {\n font-family: var(--font-mono);\n font-size: 12.5px;\n}\n.agi-approval__actions {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.agi-approval__error {\n margin: 0;\n color: var(--bad);\n}\n.agi-approval__done {\n display: grid;\n gap: 8px;\n justify-items: start;\n padding: 12px;\n border-radius: var(--radius-md);\n border: 1px solid var(--line);\n background: var(--bg-2);\n}\n.agi-approval__done p {\n margin: 0;\n color: var(--text-2);\n}\n\n/* ─── observability ─── */\n.agi-stats {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));\n gap: 12px;\n}\n.agi-stats__tile {\n display: grid;\n gap: 4px;\n padding: 16px;\n}\n.agi-stat__v.is-ok {\n color: var(--ok);\n}\n.agi-stat__v.is-warn {\n color: var(--warn);\n}\n.agi-stat__v.is-bad {\n color: var(--bad);\n}\n.agi-stats__delta {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--text-2);\n}\n\n.agi-heat {\n display: grid;\n gap: 6px;\n font-size: 12.5px;\n}\n.agi-heat__table {\n border-collapse: separate;\n border-spacing: 3px;\n width: 100%;\n table-layout: fixed;\n}\n.agi-heat__label {\n width: 140px;\n color: var(--text-2);\n font-weight: 400;\n text-align: left;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding-right: 8px;\n}\n.agi-heat__col {\n font-family: var(--font-mono);\n font-size: 9.5px;\n font-weight: 500;\n letter-spacing: 0.06em;\n color: var(--mute);\n text-align: center;\n}\n.agi-heat__td {\n padding: 0;\n}\n.agi-heat__cell {\n display: block;\n height: 18px;\n border-radius: 3px;\n background: var(--line);\n}\n.agi-heat__cell.is-ok {\n background: var(--ok);\n}\n.agi-heat__cell.is-warn {\n background: var(--warn);\n}\n.agi-heat__cell.is-bad {\n background: var(--bad);\n}\n.agi-heat__cell.is-none {\n background: var(--line);\n opacity: 0.6;\n}\n.agi-heat__legend {\n display: flex;\n gap: 6px;\n}\n\n.agi-timeline {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n gap: 4px;\n}\n.agi-timeline__step {\n display: grid;\n grid-template-columns: 18px minmax(120px, 1fr) minmax(120px, 2fr) auto;\n gap: 10px;\n align-items: center;\n padding: 6px 8px;\n border-radius: var(--radius-md);\n border: 1px solid transparent;\n font-size: 13px;\n}\n.agi-timeline__step.is-running {\n background: var(--signal-soft);\n border-color: color-mix(in srgb, var(--signal) 40%, transparent);\n}\n.agi-timeline__step.is-waiting {\n background: var(--warn-soft);\n border-color: color-mix(in srgb, var(--warn) 45%, transparent);\n}\n.agi-timeline__step.is-error {\n background: var(--bad-soft);\n border-color: color-mix(in srgb, var(--bad) 45%, transparent);\n}\n.agi-timeline__glyph {\n color: var(--mute);\n text-align: center;\n}\n.agi-timeline__step.is-done .agi-timeline__glyph,\n.agi-timeline__step.k-verify .agi-timeline__glyph,\n.agi-timeline__step.k-write .agi-timeline__glyph {\n color: var(--ok);\n}\n.agi-timeline__step.is-running .agi-timeline__glyph {\n color: var(--signal);\n}\n.agi-timeline__step.is-waiting .agi-timeline__glyph,\n.agi-timeline__step.k-approval .agi-timeline__glyph {\n color: var(--warn);\n}\n.agi-timeline__name {\n color: var(--text);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.agi-timeline__detail {\n display: block;\n color: var(--mute);\n font-size: 11.5px;\n}\n.agi-timeline__bar {\n position: relative;\n height: 6px;\n border-radius: 3px;\n background: var(--line);\n}\n.agi-timeline__fill {\n position: absolute;\n top: 0;\n bottom: 0;\n border-radius: 3px;\n background: var(--signal);\n}\n.agi-timeline__step.is-done .agi-timeline__fill {\n background: var(--ok);\n}\n.agi-timeline__step.is-error .agi-timeline__fill {\n background: var(--bad);\n}\n.agi-timeline__step.is-waiting .agi-timeline__fill {\n background: var(--warn);\n}\n.agi-timeline__meta {\n font-family: var(--font-mono);\n font-size: 11px;\n color: var(--mute);\n white-space: nowrap;\n}\n\n.agi-bars {\n display: grid;\n gap: 8px;\n font-size: 13px;\n}\n.agi-bars__row {\n display: grid;\n grid-template-columns: minmax(100px, 1fr) minmax(120px, 3fr) auto;\n gap: 10px;\n align-items: center;\n}\n.agi-bars__label {\n color: var(--text-2);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.agi-bars__track {\n height: 10px;\n border-radius: 5px;\n background: var(--line);\n overflow: hidden;\n}\n.agi-bars__fill {\n display: block;\n height: 100%;\n border-radius: 5px;\n}\n.agi-bars__value {\n font-family: var(--font-mono);\n font-size: 12px;\n color: var(--text);\n white-space: nowrap;\n display: grid;\n text-align: right;\n}\n.agi-bars__note {\n font-size: 10.5px;\n color: var(--mute);\n}\n","import { render, hydrate, unmountComponentAtNode } from 'preact/compat';\n\nexport function createRoot(container) {\n\treturn {\n\t\t// eslint-disable-next-line\n\t\trender: function (children) {\n\t\t\trender(children, container);\n\t\t},\n\t\t// eslint-disable-next-line\n\t\tunmount: function () {\n\t\t\tunmountComponentAtNode(container);\n\t\t}\n\t};\n}\n\nexport function hydrateRoot(container, children) {\n\thydrate(children, container);\n\treturn createRoot(container);\n}\n\nexport default {\n\tcreateRoot,\n\thydrateRoot\n};\n"],"mappings":"olBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,cAAAE,GAAA,aAAAC,GAAA,SAAAC,GAAA,SAAAC,GAAA,YAAAC,KCCO,IC0BMC,GChBPC,ECPFC,GA2FSC,GCiFTC,GAWAC,GAEEC,GA0BAC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F,GAAI,CAACD,EAAQ,OAAO,KACpB,IAAME,EAAIF,EAAO,QACjB,GAAI,CAACE,EAAE,SAAW,CAACA,EAAE,MAAO,OAAO,KAMnC,GALApB,GAAK,CACH,QAASoB,EAAE,QACX,MAAOA,EAAE,MACT,OAAQA,EAAE,SAAW,MAAQA,EAAE,SAAW,KAAOA,EAAE,OAAS,MAC9D,CAAC,EACGA,EAAE,SAAU,CACd,GAAM,CAACC,EAAYC,EAAaC,CAAS,EAAIH,EAAE,SAAS,MAAM,GAAG,EACjE,GAAI,CAACC,GAAc,CAACC,EAAa,OAAO,KACxC,IAAME,EAAgB,IACpBV,GAAS,CAAE,WAAAO,EAAY,YAAAC,EAAa,UAAAC,EAAW,UAAWH,EAAE,SAAU,CAAC,EACzE,OAAI,SAAS,aAAe,WAC1B,SAAS,iBAAiB,mBAAoB,IAAMI,EAAc,EAAG,CAAE,KAAM,EAAK,CAAC,EAC5E,MAEFA,EAAc,CACvB,CACA,GAAI,CAACJ,EAAE,KAAM,OAAO,KACpB,IAAMK,EAAQ,IACZvB,GAAK,CACH,WAAYkB,EAAE,KACd,KAAOA,EAAE,MAAoC,SAC7C,SAAWA,EAAE,UAA4C,QACzD,MAAQA,EAAE,OAAsC,OAChD,cAAeA,EAAE,MACjB,UAAWA,EAAE,SACf,CAAC,EACH,OAAI,SAAS,aAAe,WAC1B,SAAS,iBAAiB,mBAAoB,IAAMK,EAAM,EAAG,CAAE,KAAM,EAAK,CAAC,EACpE,MAEFA,EAAM,CACf,CAEA,SAASN,IAA0C,CACjD,OAAI,OAAO,SAAa,IAAoB,KACpC,SAAS,eAA8C,IACjE,CAEI,OAAO,OAAW,KACpBF,GAAS","names":["src_exports","__export","approval","autoload","chat","init","version","slice","options","vnodeId","isValidElement","rerenderQueue","prevDebounce","defer","depthSort","_id","EVENT_DISPATCHED","EVENT_ATTACHED","CAPTURE_REGEX","eventClock","eventProxy","eventProxyCapture","i","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","isArray","Array","assign","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","key","ref","normalizedProps","arguments","length","call","defaultProps","createVNode","original","vnode","__k","__","__b","__e","__c","constructor","__v","__i","__u","Fragment","props","children","BaseComponent","context","this","getDomSibling","vnode","childIndex","__","__i","sibling","__k","length","__e","type","renderComponent","component","__P","__d","oldVNode","__v","oldDom","commitQueue","refQueue","newVNode","assign","options","diff","__n","namespaceURI","__u","commitRoot","updateParentDomPointers","__c","base","some","child","enqueueRender","c","rerenderQueue","push","process","__r","prevDebounce","debounceRendering","defer","l","sort","depthSort","shift","diffChildren","parentDom","renderResult","newParentVNode","oldParentVNode","globalContext","namespace","excessDomChildren","isHydrating","i","childVNode","newDom","firstChildDom","result","oldChildren","EMPTY_ARR","newChildrenLength","constructNewChildrenArray","EMPTY_OBJ","ref","applyRef","insert","nextSibling","skewedIndex","matchingIndex","oldChildrenLength","remainingOldChildren","skew","Array","constructor","String","createVNode","isArray","__b","key","findMatchingIndex","unmount","parentVNode","parentNode","insertBefore","nodeType","toChildArray","out","x","y","matched","setStyle","style","value","setProperty","IS_NON_DIMENSIONAL","test","dom","name","oldValue","useCapture","lowerCaseName","o","cssText","replace","CAPTURE_REGEX","toLowerCase","slice","EVENT_ATTACHED","eventClock","addEventListener","eventProxyCapture","eventProxy","removeEventListener","e","removeAttribute","setAttribute","createEventProxy","eventHandler","EVENT_DISPATCHED","event","tmp","oldCommitQueueLength","isNew","oldProps","oldState","snapshot","clearProcessingException","newProps","isClassComponent","provider","componentContext","renderHook","count","newType","outer","prototype","render","contextType","__E","doRender","sub","state","__h","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","apply","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","cloneNode","then","MODE_HYDRATE","indexOf","removeNode","markAsForce","diffElementNodes","diffed","root","cb","call","node","map","newHtml","oldHtml","newChildren","inputValue","checked","localName","document","createTextNode","createElementNS","is","__m","data","defaultValue","childNodes","attributes","__html","innerHTML","content","undefined","hasRefUnmount","current","skipRemove","r","componentWillUnmount","replaceNode","documentElement","createElement","firstChild","createContext","defaultValue","Context","props","subs","ctx","this","getChildContext","Set","__c","componentWillUnmount","shouldComponentUpdate","_props","value","forEach","c","__e","enqueueRender","sub","add","old","delete","call","children","i","__","Provider","__l","Consumer","contextValue","contextType","slice","EMPTY_ARR","options","error","vnode","oldVNode","errorInfo","component","ctor","handled","constructor","getDerivedStateFromError","setState","__d","componentDidCatch","__E","e","vnodeId","isValidElement","BaseComponent","prototype","update","callback","s","__s","state","assign","__v","_sb","push","forceUpdate","__h","render","Fragment","rerenderQueue","defer","Promise","then","bind","resolve","setTimeout","depthSort","a","b","__b","process","__r","_id","Math","random","toString","EVENT_DISPATCHED","EVENT_ATTACHED","CAPTURE_REGEX","eventClock","eventProxy","createEventProxy","eventProxyCapture","currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","options","_options","oldBeforeDiff","__b","oldBeforeRender","__r","oldAfterDiff","diffed","oldCommit","__c","oldBeforeUnmount","unmount","oldRoot","__","getHookState","index","type","__h","hooks","__H","length","push","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","action","currentValue","__N","nextValue","setState","__f","updateHookState","p","s","c","updatedHook","shouldUpdate","props","some","hookItem","prevScu","result","call","this","shouldComponentUpdate","prevCWU","componentWillUpdate","__e","tmp","useEffect","callback","args","state","__s","argsChanged","_pendingArgs","useRef","initialValue","currentHook","useMemo","current","useMemo","factory","args","state","getHookState","currentIndex","argsChanged","__H","__","__h","useCallback","callback","currentHook","useContext","context","provider","currentComponent","__c","c","sub","props","value","flushAfterPaintEffects","component","afterPaintEffects","shift","hooks","__H","__P","__h","some","invokeCleanup","invokeEffect","e","options","__e","__v","__b","vnode","currentComponent","oldBeforeDiff","__","parentDom","__k","__m","oldRoot","__r","oldBeforeRender","currentIndex","__c","previousComponent","hookItem","__N","_pendingArgs","diffed","oldAfterDiff","c","length","push","prevRaf","requestAnimationFrame","afterNextFrame","commitQueue","filter","cb","oldCommit","unmount","oldBeforeUnmount","hasErrored","s","HAS_RAF","callback","raf","done","clearTimeout","timeout","cancelAnimationFrame","setTimeout","hook","comp","cleanup","argsChanged","oldArgs","newArgs","arg","index","invokeOrReturn","f","assign","obj","props","i","shallowDiffers","a","b","useLayoutEffect","PureComponent","p","c","this","props","context","PureComponent","prototype","Component","isPureReactComponent","shouldComponentUpdate","props","state","shallowDiffers","this","oldDiffHook","options","__b","vnode","type","__f","ref","REACT_FORWARD_SYMBOL","Symbol","for","forwardRef","fn","Forwarded","clone","assign","$$typeof","render","isReactComponent","displayName","name","oldCatchError","options","__e","error","newVNode","oldVNode","errorInfo","then","component","vnode","__","__c","__k","oldUnmount","unmount","detachedClone","detachedParent","parentDom","__H","forEach","effect","assign","__P","map","child","removeOriginal","originalParent","__v","appendChild","Suspense","this","__u","_suspenders","__b","suspended","__a","SuspenseList","this","_next","_map","options","unmount","vnode","component","__c","__z","__R","__u","type","oldUnmount","Suspense","prototype","Component","promise","suspendingVNode","suspendingComponent","c","_suspenders","push","resolve","suspended","__v","resolved","onResolved","onSuspensionComplete","originalParentDom","__P","state","__a","suspendedVNode","__k","removeOriginal","__O","setState","__b","pop","forceUpdate","then","componentWillUnmount","render","props","detachedParent","document","createElement","detachedComponent","detachedClone","fallback","Fragment","children","list","child","node","delete","revealOrder","size","length","SuspenseList","prototype","Component","__a","child","list","this","delegated","suspended","__v","node","_map","get","unsuspend","wrappedUnsuspend","props","revealOrder","push","resolve","render","_next","Map","children","toChildArray","reverse","i","length","set","componentDidUpdate","componentDidMount","_this","forEach","REACT_ELEMENT_TYPE","Symbol","for","CAMEL_PROPS","ON_ANI","CAMEL_REPLACE","IS_DOM","document","onChangeInputType","type","test","vnode","parent","callback","__k","textContent","preactRender","__c","Component","prototype","isReactComponent","forEach","key","Object","defineProperty","configurable","get","this","set","v","writable","value","oldEventHook","options","event","e","persist","isPropagationStopped","cancelBubble","isDefaultPrevented","defaultPrevented","nativeEvent","currentComponent","classNameDescriptorNonEnumberable","class","oldVNodeHook","vnode","type","props","normalizedProps","isNonDashedType","indexOf","i","IS_DOM","lowerCased","toLowerCase","onChangeInputType","ON_ANI","test","CAMEL_PROPS","replace","CAMEL_REPLACE","multiple","Array","isArray","toChildArray","children","child","selected","defaultValue","className","$$typeof","REACT_ELEMENT_TYPE","oldBeforeRender","__r","__c","oldDiffed","diffed","dom","__e","unmountComponentAtNode","container","__k","preactRender","AginiesError","message","status","code","__publicField","trimSlash","s","AginiesClient","config","detectLocale","args","listener","next","l","res","body","safeJson","reason","err","module","modules","init","headers","path","url","send","identifier","audio","filename","language","form","voiceError","text","input","signal","parseSSE","stream","reader","decoder","buffer","done","value","sep","frame","event","decodeFrame","tail","line","data","json","path","workflowId","executionId","contextId","readJson","res","body","error","AginiesError","getPausedExecution","client","r","resumeExecution","client","workflowId","executionId","contextId","submission","path","r","readJson","fieldsOf","point","raw","f","index","field","name","str","v","outputOf","data","_f","_l","rest","formatFieldValue","value","parseFieldValue","text","n","initialValues","fields","buildSubmission","values","errors","error","vnodeId","createVNode","type","props","key","isStaticChildren","__source","__self","ref","i","normalizedProps","vnode","__k","__","__b","__e","__c","constructor","__v","vnodeId","__i","__u","defaultProps","options","cx","parts","Button","D","variant","size","className","type","props","ref","u","Tag","tone","Panel","level","className","props","u","cx","Eyebrow","quiet","Field","label","hint","error","className","children","props","u","cx","Input","D","ref","Textarea","Spinner","STRINGS","translator","locale","section","key","entry","defaultClient","init","config","AginiesClient","AginiesContext","X","useModule","module","client","useAginies","allowed","h","AginiesProvider","locale","fallback","children","resolved","defaultClient","state","setState","d","unsubscribe","value","T","l","translator","u","S","ctx","x","useApproval","workflowId","executionId","contextId","client","t","useAginies","status","setStatus","d","execution","setExecution","selected","setSelected","values","setValues","errors","setErrors","error","setError","outcome","setOutcome","selectedRef","A","pausePoint","T","p","fields","fieldsOf","load","q","detail","getPausedExecution","wanted","point","initialValues","err","AginiesError","h","select","nextContextId","setValue","name","value","v","e","_drop","rest","submit","submission","problems","buildSubmission","k","result","resumeExecution","STATUS_TONE","ApprovalPanel","title","description","submitLabel","onResumed","hideOutput","className","locale","enabled","useModule","a","onResumedRef","output","outputOf","outputEntries","canSubmit","fmt","iso","onSubmit","u","Panel","cx","Eyebrow","S","Spinner","Button","i","Tag","f","Field","renderField","set","disabled","Input","Textarea","o","opt","Markdown","text","className","u","renderBlocks","parseBlocks","FENCE","HEADING","RULE","QUOTE","LIST","TABLE_SEPARATOR","lines","blocks","i","paragraph","flush","line","fence","marker","lang","code","heading","inner","list","ordered","start","items","m","header","splitRow","align","cell","left","right","rows","block","index","n","S","renderInline","Tag","item","alignStyle","row","_","INLINE","nodes","last","key","inline","match","bold","boldAlt","strike","italic","italicAlt","linkText","linkHref","autoHref","link","SAFE_HREF","href","children","isObject","v","isStringArray","x","isNumberArray","isCard","normaliseItem","raw","text","buttons","table","pie","image","cards","b","parseStructured","parsed","list","items","i","StructuredUI","response","onAction","u","item","c","ci","h","hi","ri","cell","Pie","bi","labels","data","total","a","angle","slices","label","value","start","arc","end","a0","a1","large","x0","y0","x1","y1","s","MIME_CANDIDATES","MIN_CLIP_BYTES","SPEECH_RMS","isVoiceSupported","useVoice","identifier","onTranscript","language","silenceMs","maxMs","client","t","useAginies","supported","state","setState","d","error","setError","level","setLevel","recorderRef","A","streamRef","chunksRef","discardRef","timersRef","meterRef","audioRef","audioUrlRef","startingRef","onTranscriptRef","clearTimers","q","id","releaseStream","track","stopSpeaking","audio","s","finish","recorder","stopListening","cancelListening","startMeter","stream","onSilence","Ctx","ctx","analyser","data","heard","lastVoice","interval","sum","v","n","rms","startListening","mimeType","m","e","type","clip","ext","result","err","AginiesError","speak","text","blob","url","resolve","h","ATTACHMENT_LIMITS","useChat","identifier","enabled","client","t","useAginies","config","setConfig","d","authNeed","setAuthNeed","authTitle","setAuthTitle","loadError","setLoadError","messages","setMessages","busy","setBusy","conversationId","randomId","abortRef","A","load","q","res","err","AginiesError","h","chatPath","authenticate","password","requestCode","email","verifyCode","otp","stop","prev","last","send","text","files","input","userMessage","name","type","size","assistantId","controller","content","update","patch","m","ev","extractFinalText","parseStructured","message","data","block","b","ChatWidget","mode","position","launcherLabel","defaultOpen","theme","voice","className","open","setOpen","useModule","chat","voiceMode","setVoiceMode","dictation","setDictation","voiceModeRef","sendRef","voiceControls","useVoice","capabilities","voiceAvailable","title","themeClass","leaveVoiceMode","panel","u","cx","Button","ChatAuth","VoiceConversation","S","MessageList","action","Composer","Spinner","o","welcome","onAction","endRef","StructuredUI","Markdown","file","n","FileGlyph","formatBytes","onSend","onStop","value","setValue","setFiles","fileError","setFileError","fileInput","v","listening","transcribing","submit","e","attached","pick","chosen","payloads","readFile","canSend","_","i","Input","MicGlyph","HeadsetGlyph","speakReplies","onExit","spokenRef","mountedRef","lastAssistant","lastUser","replyId","replyStreaming","status","hint","tap","resolve","reject","reader","need","onPassword","onRequestCode","onVerifyCode","EmailAuth","PasswordAuth","error","setError","pending","setPending","ok","Field","setEmail","code","setCode","step","setStep","notice","setNotice","request","result","verify","styles_default","createRoot","container","children","nn","pn","version","STYLE_ID","client","ensureStyles","style","styles_default","init","config","chat","options","container","mode","props","element","resolveContainer","root","createRoot","k","AginiesProvider","ChatWidget","approval","ApprovalPanel","el","autoload","script","currentScript","d","workflowId","executionId","contextId","mountApproval","mount"]}
|