@bgub/fig-dom 0.1.3 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,65 @@
1
+ ## @bgub/fig-dom@2.0.0
2
+
3
+ ### Keep binding errors and hydration requests attached to the right commit
4
+
5
+ Attribute deferred binding errors to the declaring asset owner when multiple components share a hoisted element. Preserve ownership through metadata winner changes as well as asset acquisition and updates.
6
+
7
+ Queue event-triggered hydration until an active commit finishes instead of re-entering its render attempt. Bind and layout callbacks can focus or click a dehydrated boundary without corrupting the commit; queued replayable events still dispatch once after hydration.
8
+
9
+ ### Apply host properties before updating bindings
10
+
11
+ Run callback and host bindings after the host's attributes and form properties
12
+ have been applied. Widgets now follow form reassociation through later mixins,
13
+ removing the old form's reset listener and registering with the new form.
14
+
15
+ ### Preserve host behavior lifetimes across configuration updates
16
+
17
+ Add `context.owns(prop)` to identify the last mixin writer of a host prop, even
18
+ when a later override writes the same value.
19
+
20
+ Add `hostBinding(context, owner, update)` for mixins that register committed DOM
21
+ configuration. Updates keep their lifetime signal; removal, owner replacement,
22
+ and Activity hiding abort it synchronously.
23
+
24
+ The host `bind` prop additionally accepts host-binding descriptions and nested
25
+ binding arrays through the new `Binding` type. Array members have independent
26
+ signals and development strict checks. `Bind` remains callable, and
27
+ `composeBind` preserves its callable result and shared lifetime semantics.
28
+ `BindCallback` is an alias for `Bind`.
29
+
30
+ Headless widgets adopt shared committed value, registration, and reference owners.
31
+ Controlled props cannot leak from suspended renders, accepted uncontrolled
32
+ requests compose before commit, and compound Combobox changes cancel together.
33
+ Host configuration updates preserve typeahead and toast work while actual
34
+ removal cleans up immediately. Caller-authored native disability and accessible
35
+ names remain authoritative.
36
+
37
+ ### Finish pending captures before synchronous work
38
+
39
+ Allow explicit `flushSync` and unmount to interrupt pending View Transition captures. Preserve animations through automatically scheduled synchronous work, including before-paint repairs and external-store notifications, by retaining capture ownership until readiness. Validate pending mutations, restore author styles before urgent work, suppress interrupted transition callbacks, and ignore late browser callbacks.
40
+
41
+ Automatically cancel captures whose mutation was rejected as stale or failed. Release the document animation lock and wake existing client and streamed-reveal waiters without waiting for the discarded animation, so transition-priority retries can publish promptly even when native cancellation is unavailable or throws.
42
+
43
+ Custom commit coordinators and View Transition host adapters must return `{ interrupt() }` instead of `"deferred"`. The operation must synchronously finish or reject the pending mutation, restore temporary host state, and release capture. Return `"committed"` only when both mutation and capture restoration have completed.
44
+
45
+ View Transition host adapters receive `cancelTransition: true` when no candidate was published. Skip the entire native animation and release capture in that case; `canceledNames` and `cancelRootSnapshot` alone only suppress individual snapshots.
46
+
47
+ Bind DOM pseudo-element handles to the transition signal. Cancel animations created through those handles at completion and reject expired handles, preventing filled animations or saved handles from affecting later transitions with the same surface names. Surface host adapters receive the lifetime signal as a fourth `createSurface` argument.
48
+
49
+ ### Preserve focus across DOM commits
50
+
51
+ Add an optional synchronous `HostConfig.commitMutation` scope and a named `HostCommitActivation<Instance>` type for its returned activation callback. Fig DOM captures focus before host mutations and restores surviving focus afterward, then activates binding callbacks against the published tree before component `useBeforePaint` callbacks choose their final focus policy. Binds can focus, select, or blur without restoration overwriting their choices. Native event and custom-element callbacks may be overridden before restoration finishes; native events continue to dispatch normally. Restoration is bounded to one selection repair followed by one explicit focus attempt, including when selection repair itself fires a listener that redirects focus.
52
+
53
+ Use atomic native moves when nodes share a shadow-including root to preserve browser-managed state, including native dialog/popover membership. Ordinary insertion remains the fallback. Removed or hidden elements are not restored, and focus restoration does not request scrolling.
54
+
55
+ ### Preserve text selection across DOM commits
56
+
57
+ Capture input, textarea, and DOM selection once before mutations and restore surviving boundaries and direction before `useBeforePaint`. Child boundaries follow surviving children instead of stale indices, so sibling edits preserve the selected text and caret position. Cover accessible shadow roots, multi-node moves, and focused descendants of editing hosts. Skip removed or reordered boundaries that no longer define a valid range, and clamp shortened text offsets. Component layout policy runs after preservation, replacing per-move callback-intent heuristics with explicit commit ordering.
58
+
59
+ ### Keep native widget changes in step with input
60
+
61
+ Run native toggle, dialog dismissal, form reset, and pointer/touch cancellation events at discrete priority. This prevents a dismissed popover from reopening with stale state and closing another popup opened by the next click.
62
+
1
63
  ## @bgub/fig-dom@0.1.2
2
64
 
3
65
  ### Ignore temporary view transition styles during hydration
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as Bind, i as HostStyle, n as EmptyPropValue, o as composeBind, r as HostProps, t as HostIntrinsicElements } from "./jsx-It_Mpx4I.js";
1
+ import { a as Bind, c as HostBinding, i as HostStyle, l as composeBind, n as EmptyPropValue, o as BindCallback, r as HostProps, s as Binding, t as HostIntrinsicElements, u as hostBinding } from "./jsx-EjGcEK-p.js";
2
2
  import { AwaitedFigNode, DataResource, DataResourceKey, DataResourceKeyInput, FigAssetResource, FigNode, FigPortal, Key, MixinDescriptor } from "@bgub/fig";
3
3
  import { FigRoot, FigRootOptions, RecoverableErrorInfo } from "@bgub/fig-reconciler";
4
4
  import { PayloadDecodeOptions } from "@bgub/fig/payload";
@@ -73,4 +73,4 @@ declare function hydrateRoot(container: Container, children: FigNode, options?:
73
73
  /** Creates portal. */
74
74
  declare function createPortal(children: FigNode, container: Container, key?: Key | null): FigPortal<Container>;
75
75
  //#endregion
76
- export { type Bind, type Container, type EmptyPropValue, type EventCallback, type EventOptions, type FigRoot, type FigRootOptions, type HostIntrinsicElements, type HostProps, type HostStyle, type PayloadComponent, type PayloadComponentLoadContext, type PayloadComponentLoader, type PayloadComponentOptions, type PayloadSource, type RecoverableErrorInfo, composeBind, createPayloadComponent, createPortal, createRoot, flushSync, hydrateRoot, insertAssetResources, on };
76
+ export { type Bind, type BindCallback, type Binding, type Container, type EmptyPropValue, type EventCallback, type EventOptions, type FigRoot, type FigRootOptions, type HostBinding, type HostIntrinsicElements, type HostProps, type HostStyle, type PayloadComponent, type PayloadComponentLoadContext, type PayloadComponentLoader, type PayloadComponentOptions, type PayloadSource, type RecoverableErrorInfo, composeBind, createPayloadComponent, createPortal, createRoot, flushSync, hostBinding, hydrateRoot, insertAssetResources, on };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./renderer-jfUYsG5x.js";import{assertPayloadCodecMatches as o,createPortalNode as s,jsonPayloadCodec as c,loadContextCapabilities as l}from"@bgub/fig/internal";import{dataResource as u,readData as d}from"@bgub/fig";import{decodePayloadStream as f}from"@bgub/fig/payload";const p=()=>void 0;async function m(e,t,r={}){let{signal:i}=t;if(i.aborted)throw await e.body?.cancel().catch(p),h(i);if(!e.ok)throw await e.body?.cancel().catch(p),Error(`Payload request failed with status ${e.status}.`);let a=e.body;if(a===null)throw Error(`Payload response did not include a body.`);try{o(c,e.headers.get(`content-type`))}catch(e){throw await a.cancel().catch(p),e}let s=l(t);return f(a,{hydrate:s?.hydrate,onHoleError:s?.attributeError,onStreamDone:e=>{},prepareAssets:r.prepareAssets??(e=>n(e)),retainAssets:r.retainAssets,resolveClientReference:r.resolveClientReference,signal:i})}function h(e){return e.reason??Error(`Payload request aborted.`)}function g(e){let t=new WeakMap,n=1;function r(e){if(e===null)return null;if(e===void 0)return[`undefined`];if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isNaN(e)?[`number`,`NaN`]:e===1/0?[`number`,`Infinity`]:e===-1/0?[`number`,`-Infinity`]:Object.is(e,-0)?[`number`,`-0`]:e;if(typeof e==`bigint`)return[`bigint`,e.toString()];if(typeof e==`symbol`){let t=Symbol.keyFor(e);if(t===void 0)throw Error(`Only global Symbol.for symbols can be serialized.`);return[`symbol`,t]}if(typeof e==`function`)throw Error(`Functions cannot be serialized into the payload.`);if(e instanceof Date){let t=e.toJSON();if(t===null)throw Error(`Invalid Date values cannot be serialized.`);return[`date`,t]}let i=t.get(e);if(i!==void 0)return[`ref`,i];let a=n++;if(t.set(e,a),Array.isArray(e))return[`array`,a,e.map(r)];if(e instanceof Map)return[`map`,a,Array.from(e,([e,t])=>[r(e),r(t)])];if(e instanceof Set)return[`set`,a,Array.from(e,r)];let o=Object.getPrototypeOf(e);if(o!==Object.prototype&&o!==null)throw Error(`Cannot serialize ${o?.constructor?.name??`object`} into the payload.`);let s=e;return[`object`,a,Object.keys(s).sort().map(e=>[e,r(s[e])])]}return r(e)}function _(e){let t=t=>{let n=v(t);return[...e.key,e.cacheKey===void 0?n:e.cacheKey(t)]},n=u({debugArgs:e.cacheKey===void 0?void 0:v,key:t,load:async(n,r)=>{let i=await e.load(n,{key:l(r)?.key??t(n),signal:r.signal});return m(i instanceof Response?i:new Response(i.stream,{headers:{"content-type":i.contentType}}),r,{prepareAssets:e.prepareAssets??e.load.prepareAssets,resolveClientReference:e.resolveClientReference??e.load.resolveClientReference,retainAssets:e.retainAssets??e.load.retainAssets})}}),r=Object.assign(function(e){return y(e),d(r,e)},n);return Object.defineProperty(r,"displayName",{configurable:!0,value:`Payload(${e.key[0]})`}),r}function v(e){return y(e),g(e)}function y(e){if(Object.hasOwn(e,`children`))throw Error(`Payload components do not accept children.`)}const b=a.flushSync;function x(e,t){let n=a.createRoot(e,t);return i(e,{run:e=>n.data.run(e)}),w(n,e)}function S(e,t,n){let r=a.hydrateRoot(e,t,n);return i(e,{hydrate:(t,n)=>a.hydrateTarget(e,t,n),run:e=>r.data.run(e)}),w(r,e)}function C(e,t,n=null){return s(e,t,n)}function w(e,n){return{...e,unmount:()=>{e.unmount(),t(n)}}}export{r as composeBind,_ as createPayloadComponent,C as createPortal,x as createRoot,b as flushSync,S as hydrateRoot,n as insertAssetResources,e as on};
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./renderer-DUqtXVQB.js";import{assertPayloadCodecMatches as s,createPortalNode as c,jsonPayloadCodec as l,loadContextCapabilities as u}from"@bgub/fig/internal";import{dataResource as d,readData as f}from"@bgub/fig";import{decodePayloadStream as p}from"@bgub/fig/payload";const m=()=>void 0;async function h(e,t,r={}){let{signal:i}=t;if(i.aborted)throw await e.body?.cancel().catch(m),g(i);if(!e.ok)throw await e.body?.cancel().catch(m),Error(`Payload request failed with status ${e.status}.`);let a=e.body;if(a===null)throw Error(`Payload response did not include a body.`);try{s(l,e.headers.get(`content-type`))}catch(e){throw await a.cancel().catch(m),e}let o=u(t);return p(a,{hydrate:o?.hydrate,onHoleError:o?.attributeError,onStreamDone:e=>{},prepareAssets:r.prepareAssets??(e=>n(e)),retainAssets:r.retainAssets,resolveClientReference:r.resolveClientReference,signal:i})}function g(e){return e.reason??Error(`Payload request aborted.`)}function _(e){let t=new WeakMap,n=1;function r(e){if(e===null)return null;if(e===void 0)return[`undefined`];if(typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`)return Number.isNaN(e)?[`number`,`NaN`]:e===1/0?[`number`,`Infinity`]:e===-1/0?[`number`,`-Infinity`]:Object.is(e,-0)?[`number`,`-0`]:e;if(typeof e==`bigint`)return[`bigint`,e.toString()];if(typeof e==`symbol`){let t=Symbol.keyFor(e);if(t===void 0)throw Error(`Only global Symbol.for symbols can be serialized.`);return[`symbol`,t]}if(typeof e==`function`)throw Error(`Functions cannot be serialized into the payload.`);if(e instanceof Date){let t=e.toJSON();if(t===null)throw Error(`Invalid Date values cannot be serialized.`);return[`date`,t]}let i=t.get(e);if(i!==void 0)return[`ref`,i];let a=n++;if(t.set(e,a),Array.isArray(e))return[`array`,a,e.map(r)];if(e instanceof Map)return[`map`,a,Array.from(e,([e,t])=>[r(e),r(t)])];if(e instanceof Set)return[`set`,a,Array.from(e,r)];let o=Object.getPrototypeOf(e);if(o!==Object.prototype&&o!==null)throw Error(`Cannot serialize ${o?.constructor?.name??`object`} into the payload.`);let s=e;return[`object`,a,Object.keys(s).sort().map(e=>[e,r(s[e])])]}return r(e)}function v(e){let t=t=>{let n=y(t);return[...e.key,e.cacheKey===void 0?n:e.cacheKey(t)]},n=d({debugArgs:e.cacheKey===void 0?void 0:y,key:t,load:async(n,r)=>{let i=await e.load(n,{key:u(r)?.key??t(n),signal:r.signal});return h(i instanceof Response?i:new Response(i.stream,{headers:{"content-type":i.contentType}}),r,{prepareAssets:e.prepareAssets??e.load.prepareAssets,resolveClientReference:e.resolveClientReference??e.load.resolveClientReference,retainAssets:e.retainAssets??e.load.retainAssets})}}),r=Object.assign(function(e){return b(e),f(r,e)},n);return Object.defineProperty(r,"displayName",{configurable:!0,value:`Payload(${e.key[0]})`}),r}function y(e){return b(e),_(e)}function b(e){if(Object.hasOwn(e,`children`))throw Error(`Payload components do not accept children.`)}const x=o.flushSync;function S(e,t){let n=o.createRoot(e,t);return i(e,{run:e=>n.data.run(e)}),T(n,e)}function C(e,t,n){let r=o.hydrateRoot(e,t,n);return i(e,{hydrate:(t,n)=>o.hydrateTarget(e,t,n),run:e=>r.data.run(e)}),T(r,e)}function w(e,t,n=null){return c(e,t,n)}function T(e,n){return{...e,unmount:()=>{e.unmount(),t(n)}}}export{r as composeBind,v as createPayloadComponent,w as createPortal,S as createRoot,x as flushSync,a as hostBinding,C as hydrateRoot,n as insertAssetResources,e as on};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/payload-decoder.ts","../src/payload-key.ts","../src/payload-component.ts","../src/index.ts"],"sourcesContent":["import type { AwaitedFigNode, DataResourceLoadContext } from \"@bgub/fig\";\nimport {\n assertPayloadCodecMatches,\n jsonPayloadCodec,\n loadContextCapabilities,\n} from \"@bgub/fig/internal\";\nimport {\n decodePayloadStream,\n type PayloadDecodeOptions,\n} from \"@bgub/fig/payload\";\nimport { insertAssetResources } from \"./asset-resources.ts\";\n\ndeclare const __FIG_DEV__: boolean | undefined;\n\nconst __DEV__ = typeof __FIG_DEV__ === \"boolean\" ? __FIG_DEV__ : false;\nconst noop = (): void => undefined;\n\nexport type PayloadDecoderOptions = Pick<\n PayloadDecodeOptions,\n \"prepareAssets\" | \"resolveClientReference\" | \"retainAssets\"\n>;\n\n/**\n * Decodes a validated Payload response within one data-resource generation.\n * The root becomes the entry value, streamed holes keep filling for the\n * generation's lifetime, `data` rows hydrate through its guarded capability,\n * and discovered assets enter the document with dependent reveal gates.\n */\nexport async function decodePayloadResponse(\n response: Response,\n context: DataResourceLoadContext,\n options: PayloadDecoderOptions = {},\n): Promise<AwaitedFigNode> {\n const { signal } = context;\n if (signal.aborted) {\n await response.body?.cancel().catch(noop);\n throw abortReason(signal);\n }\n if (!response.ok) {\n await response.body?.cancel().catch(noop);\n throw new Error(`Payload request failed with status ${response.status}.`);\n }\n const body = response.body;\n if (body === null) {\n throw new Error(\"Payload response did not include a body.\");\n }\n try {\n assertPayloadCodecMatches(\n jsonPayloadCodec,\n response.headers.get(\"content-type\"),\n );\n } catch (error) {\n await body.cancel().catch(noop);\n throw error;\n }\n\n const capabilities = loadContextCapabilities(context);\n return decodePayloadStream(body, {\n // Absent outside a data store: data rows are ignored rather than hydrated.\n hydrate: capabilities?.hydrate,\n onHoleError: capabilities?.attributeError,\n // Post-root failures surface through the rejected holes they strand;\n // observing the stream end keeps a failure that no longer has a pending\n // slot from being silently discarded in development.\n onStreamDone: (result) => {\n if (__DEV__ && result.status === \"failed\") {\n console.error(\n \"Payload decode failed after its root value published:\",\n result.error,\n );\n }\n },\n prepareAssets:\n options.prepareAssets ?? ((assets) => insertAssetResources(assets)),\n retainAssets: options.retainAssets,\n resolveClientReference: options.resolveClientReference,\n signal,\n });\n}\n\nfunction abortReason(signal: AbortSignal): unknown {\n return signal.reason ?? new Error(\"Payload request aborted.\");\n}\n","import type { DataResourceKeyInput } from \"@bgub/fig\";\n\nexport function encodePayloadKey(value: unknown): DataResourceKeyInput {\n const ids = new WeakMap<object, number>();\n let nextId = 1;\n\n function encode(value: unknown): DataResourceKeyInput {\n if (value === null) return null;\n if (value === undefined) return [\"undefined\"];\n if (typeof value === \"string\" || typeof value === \"boolean\") return value;\n if (typeof value === \"number\") {\n if (Number.isNaN(value)) return [\"number\", \"NaN\"];\n if (value === Infinity) return [\"number\", \"Infinity\"];\n if (value === -Infinity) return [\"number\", \"-Infinity\"];\n return Object.is(value, -0) ? [\"number\", \"-0\"] : value;\n }\n if (typeof value === \"bigint\") return [\"bigint\", value.toString()];\n if (typeof value === \"symbol\") {\n const key = Symbol.keyFor(value);\n if (key === undefined) {\n throw new Error(\"Only global Symbol.for symbols can be serialized.\");\n }\n return [\"symbol\", key];\n }\n if (typeof value === \"function\") {\n throw new Error(\"Functions cannot be serialized into the payload.\");\n }\n if (value instanceof Date) {\n const json = value.toJSON();\n if (json === null) {\n throw new Error(\"Invalid Date values cannot be serialized.\");\n }\n return [\"date\", json];\n }\n\n const existing = ids.get(value);\n if (existing !== undefined) return [\"ref\", existing];\n const id = nextId++;\n ids.set(value, id);\n\n if (Array.isArray(value)) {\n return [\"array\", id, value.map(encode)];\n }\n if (value instanceof Map) {\n return [\n \"map\",\n id,\n Array.from(value, ([key, item]) => [encode(key), encode(item)]),\n ];\n }\n if (value instanceof Set) {\n return [\"set\", id, Array.from(value, encode)];\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n throw new Error(\n `Cannot serialize ${prototype?.constructor?.name ?? \"object\"} into the payload.`,\n );\n }\n const record = value as Record<string, unknown>;\n return [\n \"object\",\n id,\n Object.keys(record)\n .sort()\n .map((key) => [key, encode(record[key])]),\n ];\n }\n\n return encode(value);\n}\n","import {\n type AwaitedFigNode,\n dataResource,\n type DataResource,\n type DataResourceKey,\n type DataResourceKeyInput,\n type FigNode,\n readData,\n} from \"@bgub/fig\";\nimport { loadContextCapabilities } from \"@bgub/fig/internal\";\nimport {\n decodePayloadResponse,\n type PayloadDecoderOptions,\n} from \"./payload-decoder.ts\";\nimport { encodePayloadKey } from \"./payload-key.ts\";\n\n/** Describes payload source. */\nexport type PayloadSource =\n | Response\n | {\n contentType: string;\n stream: ReadableStream<Uint8Array>;\n };\n\n/** Describes payload component load context. */\nexport interface PayloadComponentLoadContext {\n key: DataResourceKey;\n signal: AbortSignal;\n}\n\n/** Describes payload component loader. */\nexport interface PayloadComponentLoader<\n TProps extends object,\n> extends PayloadDecoderOptions {\n (\n props: TProps,\n context: PayloadComponentLoadContext,\n ): PayloadSource | PromiseLike<PayloadSource>;\n}\n\n/** Describes payload component options. */\nexport interface PayloadComponentOptions<\n TProps extends object,\n> extends PayloadDecoderOptions {\n cacheKey?: (props: TProps) => DataResourceKeyInput;\n key: DataResourceKey;\n load: PayloadComponentLoader<TProps>;\n}\n\n/** Describes payload component. */\nexport interface PayloadComponent<TProps extends object> extends DataResource<\n [TProps],\n AwaitedFigNode\n> {\n (props: TProps & { children?: FigNode }): FigNode;\n}\n\n/**\n * Creates a renderable Payload tree backed by Fig's ordinary data store.\n */\nexport function createPayloadComponent<TProps extends object>(\n options: PayloadComponentOptions<TProps>,\n): PayloadComponent<TProps> {\n const key = (props: TProps): DataResourceKey => {\n const serialized = serializedProps(props);\n return [\n ...options.key,\n options.cacheKey === undefined ? serialized : options.cacheKey(props),\n ];\n };\n const resource = dataResource<[TProps], AwaitedFigNode>({\n debugArgs: options.cacheKey === undefined ? undefined : serializedProps,\n key,\n load: async (props, context) => {\n const source = await options.load(props, {\n key: loadContextCapabilities(context)?.key ?? key(props),\n signal: context.signal,\n });\n const response =\n source instanceof Response\n ? source\n : new Response(source.stream, {\n headers: { \"content-type\": source.contentType },\n });\n return decodePayloadResponse(response, context, {\n prepareAssets: options.prepareAssets ?? options.load.prepareAssets,\n resolveClientReference:\n options.resolveClientReference ?? options.load.resolveClientReference,\n retainAssets: options.retainAssets ?? options.load.retainAssets,\n });\n },\n });\n\n const component: PayloadComponent<TProps> = Object.assign(\n function PayloadComponent(props: TProps & { children?: FigNode }): FigNode {\n rejectChildren(props);\n return readData(component, props);\n },\n resource,\n );\n Object.defineProperty(component, \"displayName\", {\n configurable: true,\n value: `Payload(${options.key[0]})`,\n });\n\n return component;\n}\n\nfunction serializedProps<TProps extends object>(\n props: TProps,\n): DataResourceKeyInput {\n rejectChildren(props);\n return encodePayloadKey(props);\n}\n\nfunction rejectChildren(props: object): void {\n if (Object.hasOwn(props, \"children\")) {\n throw new Error(\"Payload components do not accept children.\");\n }\n}\n","/**\n * Browser DOM rendering APIs for Fig applications.\n *\n * @module\n */\nimport type { FigNode, FigPortal, Key } from \"@bgub/fig\";\nimport { createPortalNode } from \"@bgub/fig/internal\";\nimport type {\n FigRoot,\n FigRootOptions,\n RecoverableErrorInfo,\n} from \"@bgub/fig-reconciler\";\nimport { composeBind } from \"./bind.ts\";\nimport {\n type EventCallback,\n type EventOptions,\n on,\n} from \"./event-descriptor.ts\";\nimport { type Container, registerRoot, unregisterRoot } from \"./events.ts\";\nimport { domRenderer } from \"./renderer.ts\";\n\nexport { insertAssetResources } from \"./asset-resources.ts\";\nexport type { Bind } from \"./bind.ts\";\nexport { composeBind };\nexport { type EventCallback, type EventOptions, on };\nexport type {\n EmptyPropValue,\n HostIntrinsicElements,\n HostProps,\n HostStyle,\n} from \"./jsx.ts\";\nexport {\n createPayloadComponent,\n type PayloadComponent,\n type PayloadComponentLoadContext,\n type PayloadComponentLoader,\n type PayloadComponentOptions,\n type PayloadSource,\n} from \"./payload-component.ts\";\n\nexport type { Container, FigRoot, FigRootOptions, RecoverableErrorInfo };\n\n/** The flush sync. */\nexport const flushSync = domRenderer.flushSync;\n\n/** Creates root. */\nexport function createRoot(\n container: Container,\n options?: FigRootOptions,\n): FigRoot {\n const root = domRenderer.createRoot(container, options);\n registerRoot(container, { run: (callback) => root.data.run(callback) });\n return withEventTeardown(root, container);\n}\n\n/** Hydrates root. */\nexport function hydrateRoot(\n container: Container,\n children: FigNode,\n options?: FigRootOptions,\n): FigRoot {\n const root = domRenderer.hydrateRoot(container, children, options);\n registerRoot(container, {\n hydrate: (target, priority) =>\n domRenderer.hydrateTarget(container, target, priority),\n run: (callback) => root.data.run(callback),\n });\n return withEventTeardown(root, container);\n}\n\n/** Creates portal. */\nexport function createPortal(\n children: FigNode,\n container: Container,\n key: Key | null = null,\n): FigPortal<Container> {\n return createPortalNode(children, container, key);\n}\n\n// Event routing lives outside the reconciler, so root teardown owns both.\nfunction withEventTeardown(root: FigRoot, container: Container): FigRoot {\n return {\n ...root,\n unmount: () => {\n root.unmount();\n unregisterRoot(container);\n },\n };\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/payload-decoder.ts","../src/payload-key.ts","../src/payload-component.ts","../src/index.ts"],"sourcesContent":["import type { AwaitedFigNode, DataResourceLoadContext } from \"@bgub/fig\";\nimport {\n assertPayloadCodecMatches,\n jsonPayloadCodec,\n loadContextCapabilities,\n} from \"@bgub/fig/internal\";\nimport {\n decodePayloadStream,\n type PayloadDecodeOptions,\n} from \"@bgub/fig/payload\";\nimport { insertAssetResources } from \"./asset-resources.ts\";\n\ndeclare const __FIG_DEV__: boolean | undefined;\n\nconst __DEV__ = typeof __FIG_DEV__ === \"boolean\" ? __FIG_DEV__ : false;\nconst noop = (): void => undefined;\n\nexport type PayloadDecoderOptions = Pick<\n PayloadDecodeOptions,\n \"prepareAssets\" | \"resolveClientReference\" | \"retainAssets\"\n>;\n\n/**\n * Decodes a validated Payload response within one data-resource generation.\n * The root becomes the entry value, streamed holes keep filling for the\n * generation's lifetime, `data` rows hydrate through its guarded capability,\n * and discovered assets enter the document with dependent reveal gates.\n */\nexport async function decodePayloadResponse(\n response: Response,\n context: DataResourceLoadContext,\n options: PayloadDecoderOptions = {},\n): Promise<AwaitedFigNode> {\n const { signal } = context;\n if (signal.aborted) {\n await response.body?.cancel().catch(noop);\n throw abortReason(signal);\n }\n if (!response.ok) {\n await response.body?.cancel().catch(noop);\n throw new Error(`Payload request failed with status ${response.status}.`);\n }\n const body = response.body;\n if (body === null) {\n throw new Error(\"Payload response did not include a body.\");\n }\n try {\n assertPayloadCodecMatches(\n jsonPayloadCodec,\n response.headers.get(\"content-type\"),\n );\n } catch (error) {\n await body.cancel().catch(noop);\n throw error;\n }\n\n const capabilities = loadContextCapabilities(context);\n return decodePayloadStream(body, {\n // Absent outside a data store: data rows are ignored rather than hydrated.\n hydrate: capabilities?.hydrate,\n onHoleError: capabilities?.attributeError,\n // Post-root failures surface through the rejected holes they strand;\n // observing the stream end keeps a failure that no longer has a pending\n // slot from being silently discarded in development.\n onStreamDone: (result) => {\n if (__DEV__ && result.status === \"failed\") {\n console.error(\n \"Payload decode failed after its root value published:\",\n result.error,\n );\n }\n },\n prepareAssets:\n options.prepareAssets ?? ((assets) => insertAssetResources(assets)),\n retainAssets: options.retainAssets,\n resolveClientReference: options.resolveClientReference,\n signal,\n });\n}\n\nfunction abortReason(signal: AbortSignal): unknown {\n return signal.reason ?? new Error(\"Payload request aborted.\");\n}\n","import type { DataResourceKeyInput } from \"@bgub/fig\";\n\nexport function encodePayloadKey(value: unknown): DataResourceKeyInput {\n const ids = new WeakMap<object, number>();\n let nextId = 1;\n\n function encode(value: unknown): DataResourceKeyInput {\n if (value === null) return null;\n if (value === undefined) return [\"undefined\"];\n if (typeof value === \"string\" || typeof value === \"boolean\") return value;\n if (typeof value === \"number\") {\n if (Number.isNaN(value)) return [\"number\", \"NaN\"];\n if (value === Infinity) return [\"number\", \"Infinity\"];\n if (value === -Infinity) return [\"number\", \"-Infinity\"];\n return Object.is(value, -0) ? [\"number\", \"-0\"] : value;\n }\n if (typeof value === \"bigint\") return [\"bigint\", value.toString()];\n if (typeof value === \"symbol\") {\n const key = Symbol.keyFor(value);\n if (key === undefined) {\n throw new Error(\"Only global Symbol.for symbols can be serialized.\");\n }\n return [\"symbol\", key];\n }\n if (typeof value === \"function\") {\n throw new Error(\"Functions cannot be serialized into the payload.\");\n }\n if (value instanceof Date) {\n const json = value.toJSON();\n if (json === null) {\n throw new Error(\"Invalid Date values cannot be serialized.\");\n }\n return [\"date\", json];\n }\n\n const existing = ids.get(value);\n if (existing !== undefined) return [\"ref\", existing];\n const id = nextId++;\n ids.set(value, id);\n\n if (Array.isArray(value)) {\n return [\"array\", id, value.map(encode)];\n }\n if (value instanceof Map) {\n return [\n \"map\",\n id,\n Array.from(value, ([key, item]) => [encode(key), encode(item)]),\n ];\n }\n if (value instanceof Set) {\n return [\"set\", id, Array.from(value, encode)];\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n throw new Error(\n `Cannot serialize ${prototype?.constructor?.name ?? \"object\"} into the payload.`,\n );\n }\n const record = value as Record<string, unknown>;\n return [\n \"object\",\n id,\n Object.keys(record)\n .sort()\n .map((key) => [key, encode(record[key])]),\n ];\n }\n\n return encode(value);\n}\n","import {\n type AwaitedFigNode,\n dataResource,\n type DataResource,\n type DataResourceKey,\n type DataResourceKeyInput,\n type FigNode,\n readData,\n} from \"@bgub/fig\";\nimport { loadContextCapabilities } from \"@bgub/fig/internal\";\nimport {\n decodePayloadResponse,\n type PayloadDecoderOptions,\n} from \"./payload-decoder.ts\";\nimport { encodePayloadKey } from \"./payload-key.ts\";\n\n/** Describes payload source. */\nexport type PayloadSource =\n | Response\n | {\n contentType: string;\n stream: ReadableStream<Uint8Array>;\n };\n\n/** Describes payload component load context. */\nexport interface PayloadComponentLoadContext {\n key: DataResourceKey;\n signal: AbortSignal;\n}\n\n/** Describes payload component loader. */\nexport interface PayloadComponentLoader<\n TProps extends object,\n> extends PayloadDecoderOptions {\n (\n props: TProps,\n context: PayloadComponentLoadContext,\n ): PayloadSource | PromiseLike<PayloadSource>;\n}\n\n/** Describes payload component options. */\nexport interface PayloadComponentOptions<\n TProps extends object,\n> extends PayloadDecoderOptions {\n cacheKey?: (props: TProps) => DataResourceKeyInput;\n key: DataResourceKey;\n load: PayloadComponentLoader<TProps>;\n}\n\n/** Describes payload component. */\nexport interface PayloadComponent<TProps extends object> extends DataResource<\n [TProps],\n AwaitedFigNode\n> {\n (props: TProps & { children?: FigNode }): FigNode;\n}\n\n/**\n * Creates a renderable Payload tree backed by Fig's ordinary data store.\n */\nexport function createPayloadComponent<TProps extends object>(\n options: PayloadComponentOptions<TProps>,\n): PayloadComponent<TProps> {\n const key = (props: TProps): DataResourceKey => {\n const serialized = serializedProps(props);\n return [\n ...options.key,\n options.cacheKey === undefined ? serialized : options.cacheKey(props),\n ];\n };\n const resource = dataResource<[TProps], AwaitedFigNode>({\n debugArgs: options.cacheKey === undefined ? undefined : serializedProps,\n key,\n load: async (props, context) => {\n const source = await options.load(props, {\n key: loadContextCapabilities(context)?.key ?? key(props),\n signal: context.signal,\n });\n const response =\n source instanceof Response\n ? source\n : new Response(source.stream, {\n headers: { \"content-type\": source.contentType },\n });\n return decodePayloadResponse(response, context, {\n prepareAssets: options.prepareAssets ?? options.load.prepareAssets,\n resolveClientReference:\n options.resolveClientReference ?? options.load.resolveClientReference,\n retainAssets: options.retainAssets ?? options.load.retainAssets,\n });\n },\n });\n\n const component: PayloadComponent<TProps> = Object.assign(\n function PayloadComponent(props: TProps & { children?: FigNode }): FigNode {\n rejectChildren(props);\n return readData(component, props);\n },\n resource,\n );\n Object.defineProperty(component, \"displayName\", {\n configurable: true,\n value: `Payload(${options.key[0]})`,\n });\n\n return component;\n}\n\nfunction serializedProps<TProps extends object>(\n props: TProps,\n): DataResourceKeyInput {\n rejectChildren(props);\n return encodePayloadKey(props);\n}\n\nfunction rejectChildren(props: object): void {\n if (Object.hasOwn(props, \"children\")) {\n throw new Error(\"Payload components do not accept children.\");\n }\n}\n","/**\n * Browser DOM rendering APIs for Fig applications.\n *\n * @module\n */\nimport type { FigNode, FigPortal, Key } from \"@bgub/fig\";\nimport { createPortalNode } from \"@bgub/fig/internal\";\nimport type {\n FigRoot,\n FigRootOptions,\n RecoverableErrorInfo,\n} from \"@bgub/fig-reconciler\";\nimport { composeBind, hostBinding } from \"./bind.ts\";\nimport {\n type EventCallback,\n type EventOptions,\n on,\n} from \"./event-descriptor.ts\";\nimport { type Container, registerRoot, unregisterRoot } from \"./events.ts\";\nimport { domRenderer } from \"./renderer.ts\";\n\nexport { insertAssetResources } from \"./asset-resources.ts\";\nexport type { Bind, BindCallback, Binding, HostBinding } from \"./bind.ts\";\nexport { composeBind, hostBinding };\nexport { type EventCallback, type EventOptions, on };\nexport type {\n EmptyPropValue,\n HostIntrinsicElements,\n HostProps,\n HostStyle,\n} from \"./jsx.ts\";\nexport {\n createPayloadComponent,\n type PayloadComponent,\n type PayloadComponentLoadContext,\n type PayloadComponentLoader,\n type PayloadComponentOptions,\n type PayloadSource,\n} from \"./payload-component.ts\";\n\nexport type { Container, FigRoot, FigRootOptions, RecoverableErrorInfo };\n\n/** The flush sync. */\nexport const flushSync = domRenderer.flushSync;\n\n/** Creates root. */\nexport function createRoot(\n container: Container,\n options?: FigRootOptions,\n): FigRoot {\n const root = domRenderer.createRoot(container, options);\n registerRoot(container, { run: (callback) => root.data.run(callback) });\n return withEventTeardown(root, container);\n}\n\n/** Hydrates root. */\nexport function hydrateRoot(\n container: Container,\n children: FigNode,\n options?: FigRootOptions,\n): FigRoot {\n const root = domRenderer.hydrateRoot(container, children, options);\n registerRoot(container, {\n hydrate: (target, priority) =>\n domRenderer.hydrateTarget(container, target, priority),\n run: (callback) => root.data.run(callback),\n });\n return withEventTeardown(root, container);\n}\n\n/** Creates portal. */\nexport function createPortal(\n children: FigNode,\n container: Container,\n key: Key | null = null,\n): FigPortal<Container> {\n return createPortalNode(children, container, key);\n}\n\n// Event routing lives outside the reconciler, so root teardown owns both.\nfunction withEventTeardown(root: FigRoot, container: Container): FigRoot {\n return {\n ...root,\n unmount: () => {\n root.unmount();\n unregisterRoot(container);\n },\n };\n}\n"],"mappings":"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"}
@@ -1,8 +1,24 @@
1
- import { FigNode, Key, MixinDescriptor, MixinInput } from "@bgub/fig";
1
+ import { FigNode, Key, MixinContext, MixinDescriptor, MixinInput } from "@bgub/fig";
2
+ import "@bgub/fig-reconciler";
2
3
  //#region src/bind.d.ts
3
- /** Describes bind. */
4
+ /** A callback owns work until its binding signal aborts. */
4
5
  type Bind<T extends Element = Element> = (node: T, signal: AbortSignal) => undefined;
5
- /** Compose bind. */
6
+ /** Explicit callback spelling for APIs that also accept binding descriptions. */
7
+ type BindCallback<T extends Element = Element> = Bind<T>;
8
+ declare const HostBindingBrand: unique symbol;
9
+ /** An opaque committed host behavior created by hostBinding(). */
10
+ interface HostBinding<T extends Element = Element> {
11
+ readonly [HostBindingBrand]: BindCallback<T>;
12
+ }
13
+ /** Host prop value; arrays preserve each member's independent lifetime. */
14
+ type Binding<T extends Element = Element> = Bind<T> | HostBinding<T> | readonly (Binding<T> | false | null | undefined)[];
15
+ /**
16
+ * Declare a behavior inside a mixin. Its callback runs on each committed
17
+ * update, with the same signal until the owner/slot disappears, is replaced,
18
+ * or Activity hides the host. Raw bind functions retain callback lifetimes.
19
+ */
20
+ declare function hostBinding<T extends Element = Element>(context: MixinContext, owner: object, update: BindCallback<T>): HostBinding<T>;
21
+ /** Compose callbacks into one callable binding with a shared lifetime. */
6
22
  declare function composeBind<T extends Element = Element>(...binds: Array<Bind<T> | false | null | undefined>): Bind<T>;
7
23
  //#endregion
8
24
  //#region src/jsx-attributes.generated.d.ts
@@ -191,7 +207,7 @@ type AttributeValue = string | number | true | EmptyPropValue;
191
207
  /** Describes host style. */
192
208
  type HostStyle = Readonly<Record<string, string | EmptyPropValue>>;
193
209
  interface FigHostProps<E extends Element> {
194
- bind?: Bind<E> | EmptyPropValue;
210
+ bind?: Binding<E> | EmptyPropValue;
195
211
  children?: FigNode;
196
212
  key?: Key | null;
197
213
  mix?: MixinInput;
@@ -238,7 +254,7 @@ type HtmlHostProps<Tag extends string, E extends Element> = HostProps<E, Tag ext
238
254
  type SvgHostProps<Tag extends string, E extends Element> = HostProps<E, Tag extends keyof SvgAttributeNameByTag ? SvgAttributes<Tag> : SvgGlobalAttributeName | FigGlobalAttributeName | SvgLegacyAttributeName>;
239
255
  type OpenHtmlHostProps<E extends Element> = HostProps<E, HtmlGlobalAttributeName | FigGlobalAttributeName>;
240
256
  interface OpenHostProps<E extends Element> extends FigHostProps<E>, ReactHabitTraps {
241
- [attribute: string]: FigNode | HostStyle | MixinDescriptor | ReadonlyArray<MixinInput> | 0n | Bind<E>;
257
+ [attribute: string]: FigNode | HostStyle | MixinDescriptor | ReadonlyArray<MixinInput> | 0n | Binding<E>;
242
258
  }
243
259
  //#endregion
244
260
  //#region src/jsx.d.ts
@@ -250,4 +266,4 @@ type HostIntrinsicElements = HtmlHostPropsByTag<HTMLElementTagNameMap> & SvgHost
250
266
  [customElement: `${string}-${string}`]: OpenHostProps<HTMLElement>;
251
267
  };
252
268
  //#endregion
253
- export { Bind as a, HostStyle as i, EmptyPropValue as n, composeBind as o, HostProps as r, HostIntrinsicElements as t };
269
+ export { Bind as a, HostBinding as c, HostStyle as i, composeBind as l, EmptyPropValue as n, BindCallback as o, HostProps as r, Binding as s, HostIntrinsicElements as t, hostBinding as u };
@@ -1,4 +1,4 @@
1
- import { t as HostIntrinsicElements } from "./jsx-It_Mpx4I.js";
1
+ import { t as HostIntrinsicElements } from "./jsx-EjGcEK-p.js";
2
2
  import { FigNode, Key } from "@bgub/fig";
3
3
  import { Fragment, jsx, jsxDEV, jsxs } from "@bgub/fig/jsx-runtime";
4
4
  //#region src/jsx-runtime.d.ts
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./refresh-internal-B05aFp_T.js";import{ACTIVITY_TEMPLATE_ATTRIBUTE as t,EARLY_EVENT_HANDLER_PROPERTY as n,EARLY_EVENT_QUEUE_PROPERTY as r,HYDRATION_SKIP_ATTRIBUTE as i,REPLAYABLE_EVENT_TYPES as a,SUSPENSE_CLIENT_MARKER as o,SUSPENSE_COMPLETED_MARKER as s,SUSPENSE_END_MARKER as c,SUSPENSE_PENDING_PREFIX as l,TEXT_SEPARATOR_DATA as ee,assetResourceFromHostAttributes as u,assetResourceFromHostProps as d,assetResourceHostProps as f,assetResourceKey as p,isFigAssetResource as te,markClientOnlyHostBehavior as ne,mixinSlot as re}from"@bgub/fig/internal";import{createMixin as ie}from"@bgub/fig";import{createRenderer as ae,runWithEventPriority as m}from"@bgub/fig-reconciler";function oe(e,t){if(!h(e))return;let n=[];se(e,n);for(let e of n)t(e)}function se(e,t){t.push(e);for(let n=e.firstChild;n!==null;n=n.nextSibling)h(n)&&se(n,t)}function h(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===1}function g(e){return h(e)?`localName`in e&&typeof e.localName==`string`?e.localName.toLowerCase():`tagName`in e&&typeof e.tagName==`string`?e.tagName.toLowerCase():``:``}function ce(e){return e.namespaceURI===null||e.namespaceURI===`http://www.w3.org/1999/xhtml`}function _(e){return typeof e==`object`&&e&&`parentNode`in e?e.parentNode:null}function v(e){return e==null||e===!1}const y=Symbol.for(`fig.host-binding`);function le(e,t,n){return{[y]:n,owner:t,slot:re(e)}}const b=new WeakMap,ue=new WeakSet;let x=null;function de(e){let t=x,n=new Map;x=n;try{e()}finally{x=t}return e=>{let t=x;x=null;try{for(let[t,{element:r,key:i,update:a}]of n)e(r,()=>ye(r,i,t,a),t.assetOwner)}finally{n.clear(),x=t}}}function fe(...e){let t=e.filter(e=>typeof e==`function`);return(e,n)=>{for(let r of t)r(e,n)}}function pe(e,t,n){let r=b.get(e)??new Map,i=new Map,a=0;function o(e){if(v(e)){a++;return}if(Array.isArray(e)){e.forEach(o);return}if(typeof e==`function`){i.set(`callback:${a++}`,{callback:e,owner:void 0});return}if(be(e)){let t=`host:${e.slot}`;if(i.has(t))throw Error(`Duplicate host binding slot.`);i.set(t,{callback:e[y],owner:e.owner});return}throw Error(`The bind prop must contain callbacks or host bindings.`)}o(t);for(let[e,t]of r){let n=i.get(e);(n===void 0||n.owner!==t.owner||n.owner===void 0&&n.callback!==t.callback)&&S(t)}let s=new Map;for(let[e,t]of i){let i=r.get(e),a=i!==void 0&&i.owner===t.owner?i:{assetOwner:n,callback:t.callback,owner:t.owner,controller:null,strictRan:!1};a.assetOwner=n,a.callback=t.callback,s.set(e,a)}b.set(e,s);for(let[t,n]of s)ve(e,t,n,n.owner!==void 0);s.size===0&&b.delete(e)}function me(e){for(let[t,n]of b.get(e)??[])ve(e,t,n,!1)}function he(e){ue.add(e);for(let t of b.get(e)?.values()??[])S(t)}function ge(e){ue.delete(e),me(e)}function _e(e){for(let t of b.get(e)?.values()??[])S(t);b.delete(e)}function ve(e,t,n,r){n.controller!==null&&!r||(x===null?ye(e,t,n,r):x.set(n,{element:e,key:t,update:r}))}function ye(e,t,n,r){if(!(b.get(e)?.get(t)!==n||e.parentNode===null||ue.has(e))){if(n.controller!==null){r&&n.callback(e,n.controller.signal);return}n.controller=new AbortController,n.callback(e,n.controller.signal)}}function S(e){let t=e.controller;e.controller=null,t?.abort()}function be(e){return typeof e==`object`&&!!e&&`owner`in e&&(typeof e.owner==`object`||typeof e.owner==`function`)&&e.owner!==null&&`slot`in e&&typeof e.slot==`string`&&y in e&&typeof e[y]==`function`}const C=Symbol.for(`fig.native-event-descriptors`),xe=ie((e,t,n,r)=>{ne(e,`on()`);let i=e.props,a=i[C];a===void 0&&(a=[],Object.defineProperty(i,C,{configurable:!0,value:a})),a.push({callback:n,options:r,slot:re(e),type:t})});function Se(e,t,n){return xe(e,t,n)}const Ce=[];function we(e){return e[C]??Ce}function Te(e,t,n){let r=w(e,`currentTarget`,{value:t});try{return n(e)}finally{r()}}function Ee(e,t,n){let r={immediateStopped:!1,stopped:!t&&e.cancelBubble===!0},i=De(e,`stopPropagation`,()=>{r.stopped=!0}),a=De(e,`stopImmediatePropagation`,()=>{r.stopped=!0,r.immediateStopped=!0}),o=w(e,`cancelBubble`,{get:()=>r.stopped,set(e){e===!0&&(r.stopped=!0)}});try{return n(r)}finally{o(),a(),i(),r.stopped&&e.stopPropagation()}}function De(e,t,n){let r=Reflect.get(e,t);return typeof r==`function`?w(e,t,{value(){n(),r.call(e)}}):Oe}function w(e,t,n){let r=Object.getOwnPropertyDescriptor(e,t);return Reflect.defineProperty(e,t,{configurable:!0,...n})?r===void 0?()=>{Reflect.deleteProperty(e,t)}:()=>{Reflect.defineProperty(e,t,r)}:Oe}function Oe(){}const T=new WeakMap,E=new WeakMap,ke=new WeakMap,D=[],Ae=new Set(a),je=new Set(`beforeinput.beforetoggle.cancel.close.blur.change.click.contextmenu.dblclick.focus.focusin.focusout.input.keydown.keyup.mousedown.mouseup.pointercancel.pointerdown.pointerup.reset.submit.toggle.touchcancel.touchend.touchstart`.split(`.`)),O=new Set([`drag`,`dragover`,`mousemove`,`pointermove`,`scroll`,`touchmove`,`wheel`]),Me=new Set([...je,...O,`mouseenter`,`mouseleave`]),Ne=new Set(`abort.beforetoggle.blur.cancel.canplay.canplaythrough.close.durationchange.emptied.encrypted.ended.error.focus.invalid.load.loadeddata.loadedmetadata.loadstart.mouseenter.mouseleave.pause.play.playing.pointerenter.pointerleave.progress.ratechange.resize.scroll.scrollend.seeked.seeking.stalled.suspend.timeupdate.toggle.volumechange.waiting`.split(`.`));let Pe=e=>e();function Fe(e){Pe=e}function Ie(e,t){let n=k(e);n.run=t.run,t.hydrate!==void 0&&(n.hydrate=t.hydrate,Ye(e,n),Re(e))}const Le=new WeakMap;function Re(e){let t=e.ownerDocument??e,i=Le.get(t);if(i===void 0){let e=t[r];if(!Array.isArray(e))return;let o=t[n];if(typeof o==`function`&&typeof t.removeEventListener==`function`)for(let e of a)t.removeEventListener(e,o,!0);delete t[r],delete t[n],i=e,Le.set(t,i)}let o=!1;for(let t=0;t<i.length;){let n=i[t];if(Ae.has(n.type)&&L(e,n.target)){i.splice(t,1),Ze(e,n.type,n),o=!0;continue}t+=1}o&&queueMicrotask(j)}function ze(e){let t=E.get(e);if(t!==void 0){Be(e);for(let n of t.listeners.values())e.removeEventListener(n.type,n.listener,n.capture);Ve(e),E.delete(e);for(let t=D.length-1;t>=0;--t)D[t].root===e&&D.splice(t,1)}}function Be(e){let t=E.get(e);if(t!==void 0&&t.run!==null){t.hydrate=null;for(let[n,r]of t.hydrationListeners??[])e.removeEventListener(n,r,!0);t.hydrationListeners=null}}function Ve(e){for(let t of E.get(e)?.portals??[])Ve(t),A(t)}function k(e){let t=E.get(e);return t===void 0&&(t={hydrate:null,hydrationListeners:null,listeners:new Map,portalOwner:null,portals:null,run:null},E.set(e,t)),t}function He(e,t){let n=T.get(e)??[];if(n.length===0&&t.length===0)return;let r=new Map;for(let e of n)r.set(e.slot,e);let i=[],a=null;for(let n of t){let t=n.options?.capture===!0,o=n.options?.passive===!0,s=r.get(n.slot);r.delete(n.slot),s===void 0||s.type!==n.type||s.capture!==t||s.passive!==o?(a??=Ge(e),s!==void 0&&M(s),s=qe(e,a.root,a.listenerTarget,n,t,o)):s.callback!==n.callback&&(s.callback=n.callback),i.push(s)}for(let e of r.values())M(e);i.length===0?T.delete(e):T.set(e,i)}function Ue(e){let t=T.get(e);if(t===void 0)return;let{listenerTarget:n,root:r}=Ge(e);for(let i of t)nt(e,r,n,i)}function We(e){let t=T.get(e);if(t!==void 0){for(let e of t)M(e);T.delete(e)}}function Ge(e){let t=R(e);if(t===null)return{listenerTarget:null,root:null};let n=E.get(t);return n===void 0?{listenerTarget:null,root:null}:{listenerTarget:t,root:n.portalOwner?.root??(n.run===null?null:t)}}function Ke(e,t,n){let r=k(e),i=R(n)??t;if(r.portalOwner!==null){if(r.portalOwner.root===t&&r.portalOwner.parentTarget===i){r.portalOwner={logicalParent:n,parentTarget:i,root:t};return}A(e)}r.portalOwner={logicalParent:n,parentTarget:i,root:t};let a=k(i);(a.portals??=new Set).add(e);for(let n of a.listeners.values())at(t,e,n.type,n.capture,n.passive)}function A(e){let t=E.get(e);if(!t?.portalOwner)return;let n=t.portalOwner;t.portalOwner=null;let r=E.get(n.parentTarget);if(r!==void 0){r.portals?.delete(e);for(let t of r.listeners.keys())ot(e,t)}}function j(){let e=new Set;for(let t=0;t<D.length;){let n=D[t];if(!L(n.listenerTarget??n.root,n.event.target)){D.splice(t,1);continue}if(Qe(n)===`blocked`){e.add(n.root),t+=1;continue}if(e.has(n.root)){t+=1;continue}D.splice(t,1),$e(n)}}function qe(e,t,n,r,i,a){let o={attachment:null,capture:i,callback:r.callback,controller:null,passive:a,slot:r.slot,type:r.type};return nt(e,t,n,o),o}function M(e){I(e),F(e)}function Je(e,t,n,r,i,a){let o=R(a.target);if(o!==t&&((o===null?null:E.get(o)??null)?.portalOwner?.root===e||!L(t,a.target))||Xe(e,n,a)===`blocked`)return;let s=N(e,t,n,r,i,a);s.length!==0&&Ee(a,!1,e=>P(s,a,e))}function Ye(e,t){if(t.hydrationListeners===null){t.hydrationListeners=[];for(let n of Me){let r=t=>Xe(e,n,t);t.hydrationListeners.push([n,r]),e.addEventListener(n,r,{capture:!0,passive:ut(n)})}}}function Xe(e,t,n){let r=E.get(e)?.hydrate??null;if(r===null)return`none`;let i=ke.get(n),a=i?.get(e);if(a!==void 0)return a;let o=z(t),s=m(o,()=>r(n.target,o));return i===void 0&&(i=new WeakMap,ke.set(n,i)),i.set(e,s),s===`blocked`&&Ae.has(t)&&Ze(e,t,n),s}function Ze(e,t,n){D.push({event:n,listenerTarget:R(n.target),root:e,type:t})}function Qe(e){let t=E.get(e.root)?.hydrate??null;if(t===null)return`none`;let n=z(e.type);return m(n,()=>t(e.event.target,n))}function $e(e){let{event:t,root:n,type:r}=e,i=e.listenerTarget??e.root;Ee(t,!0,e=>{P(N(n,i,r,!0,null,t),t,e),!(e.immediateStopped||e.stopped)&&P(N(n,i,r,!1,null,t),t,e)})}function N(e,t,n,r,i,a){let o=ct(e,t,a),s=[],c=r?-1:1;for(let t=r?o.length-1:0;t>=0&&t<o.length;t+=c){let a=o[t],c=T.get(a);if(c!==void 0)for(let t of c){let o=st(t);o!==e||t.type!==n||t.capture!==r||i!==null&&t.passive!==i||s.push({callback:t.callback,element:a,root:o,slot:t})}}return s}function P(e,t,n){let r=null;for(let i of e){if(n.immediateStopped)return;if(i.element!==r){if(r!==null&&n.stopped)return;r=i.element}try{et(i,t)}finally{let e=i.slot;e.attachment===null&&F(e)}}}function et(e,t){let n=e.slot;F(n),n.controller=new AbortController;let r=n.controller.signal;Pe(()=>{tt(e.root,()=>m(z(n.type),()=>{Te(t,e.element,t=>{e.callback(t,r)})}))})}function tt(e,t){let n=e===null?null:E.get(e)?.run??null;return n===null?t():n(t)}function F(e){e.controller?.abort(),e.controller=null}function nt(e,t,n,r){Ne.has(r.type)?rt(e,t,r):it(t,n,r)}function rt(e,t,n){let r=n.attachment;if(r!==null){if(`element`in r&&r.element===e){t!==null&&(r.root=t);return}I(n)}let i=t=>{try{et({callback:n.callback,element:e,root:st(n),slot:n},t)}finally{n.attachment===null&&F(n)}};n.attachment={element:e,listener:i,root:t},e.addEventListener(n.type,i,{capture:n.capture,passive:n.passive})}function it(e,t,n){if(e===null||t===null)return;let r=n.attachment;r!==null&&`listenerTarget`in r&&r.root===e&&r.listenerTarget===t||(I(n),n.attachment={listenerTarget:t,root:e},at(e,t,n.type,n.capture,n.passive))}function at(e,t,n,r,i){let a=k(t).listeners,o=`${n}:${r}:${i}`,s=a.get(o);if(s===void 0){s={capture:r,count:0,listener:a=>Je(e,t,n,r,i,a),passive:i,type:n},t.addEventListener(n,s.listener,{capture:r,passive:i}),a.set(o,s);for(let a of E.get(t)?.portals??[])at(e,a,n,r,i)}s.count+=1}function ot(e,t){let n=E.get(e)?.listeners,r=n?.get(t);if(n!==void 0&&r!==void 0&&(--r.count,!(r.count>0))){e.removeEventListener(r.type,r.listener,r.capture),n.delete(t);for(let n of E.get(e)?.portals??[])ot(n,t)}}function I(e){let t=e.attachment;t!==null&&(e.attachment=null,`element`in t?t.element.removeEventListener(e.type,t.listener,e.capture):ot(t.listenerTarget,`${e.type}:${e.capture}:${e.passive}`))}function st(e){return e.attachment?.root??null}function ct(e,t,n){let r=[],i=n.composedPath?.();if(i!==void 0){let n=i.indexOf(t);if(n!==-1){for(let e=0;e<n;e+=1){let t=i[e];h(t)&&r.push(t)}return lt(r,e,t),r}}for(let e=n.target;e!==t&&(h(e)&&r.push(e),e=_(e),e!==null););return lt(r,e,t),r}function lt(e,t,n){let r=E.get(n)?.portalOwner??null;if(r===null||r.root!==t)return;let i=r.logicalParent;for(;i!==null&&i!==t;){if(dt(i)){let e=E.get(i)?.portalOwner??null;if(e!==null&&e.root===t){i=e.logicalParent;continue}}h(i)&&e.push(i),i=_(i)}}function L(e,t){for(let n=t;n!==null;){if(n===e)return!0;n=_(n)}return!1}function R(e){for(let t=e;t!==null;){if(dt(t)){let e=E.get(t);if(e!==void 0&&(e.portalOwner!==null||e.run!==null))return t}t=_(t)}return null}function z(e){return je.has(e)?`discrete`:O.has(e)?`continuous`:`default`}function ut(e){return O.has(e)||e===`touchstart`||e===`touchend`}function dt(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&`childNodes`in e}function ft(e){oe(e,e=>{me(e),Ue(e)})}function B(e){oe(e,e=>{_e(e),We(e)})}const V=new WeakMap;function pt(e){return Dt(e)||e===`checked`||e===`defaultChecked`}function mt(e,t,n,r,i,a){if(t===`select`&&Dt(n))return;if(t===`option`&&n===`value`){W(e,`value`,U(r));return}let o=a.initial===!0&&a.hydrating!==!0;n===`value`?v(r)||vt(e,r):n===`defaultValue`?_t(e,r,t,o&&i.value===void 0):n===`checked`?r!==void 0&&xt(e,r):n===`defaultChecked`&&bt(e,r,o&&i.checked===void 0)}function ht(e,t,n,r){if(t!==`select`)return;let i=n.value!==void 0,a=i?n.value:n.defaultValue;if(v(a)){V.delete(e);return}let o=!i&&r.hydrating===!0,s={appliedDefault:V.get(e)?.appliedDefault===!0||!i,applyDefaultToInsertedOptions:!o&&!i&&r.initial===!0,controlled:i,selectedValues:Array.isArray(a)?new Set(a.map(String)):String(a)};V.set(e,s),!o&&(i||r.initial===!0)&&St(e,s.selectedValues)}function H(e,t=!1){let n=Tt(e);if(n===null)return;let r=V.get(n);r!==void 0&&(!r.controlled&&r.appliedDefault&&!t||!r.controlled&&t&&!r.applyDefaultToInsertedOptions||(St(e,r.selectedValues),r.controlled||(r.appliedDefault=!0)))}function gt(e,t){return(e===`input`||e===`textarea`||e===`select`)&&(t.value!==void 0||t.checked!==void 0)}function _t(e,t,n,r){let i=U(t),a=i??``;`defaultValue`in e&&(e.defaultValue=a),n===`textarea`?e.textContent=a:W(e,`value`,i),r&&`value`in e&&yt(e,a)}function vt(e,t){let n=U(t);n!==null&&(`value`in e?yt(e,n):W(e,`value`,n))}function yt(e,t){let n=e;n.value!==t&&(n.value=t)}function bt(e,t,n){let r=t===!0;`defaultChecked`in e&&(e.defaultChecked=r),W(e,`checked`,r),n&&xt(e,t)}function xt(e,t){let n=t===!0;`checked`in e?e.checked=n:W(e,`checked`,n)}function U(e){return v(e)?null:String(e)}function St(e,t){if(g(e)===`option`){Ct(e,t);return}Et(e,e=>{Ct(e,t)})}function Ct(e,t){e.selected=wt(e,t)}function wt(e,t){let n=e.getAttribute(`value`)??(e.textContent??``).replace(/\s+/g,` `).trim();return typeof t==`string`?n===t:t.has(n)}function Tt(e){let t=e.parentNode;for(;t!==null;){if(h(t)&&g(t)===`select`)return t;t=t.parentNode}return null}function Et(e,t){for(let n=e.firstChild;n!==null;){let e=n.nextSibling;h(n)&&(g(n)===`option`?t(n):Et(n,t)),n=e}}function Dt(e){return e===`value`||e===`defaultValue`}function W(e,t,n){v(n)?e.removeAttribute(t):e.setAttribute(t,String(n))}function Ot(e,t,n){let r=e.style;if(r===void 0)return;let i=kt(t),a=kt(n);for(let e of Object.keys(i))e in a||jt(r,e);for(let[e,t]of Object.entries(a))v(t)?jt(r,e):At(r,e,t)}function kt(e){return typeof e==`object`&&e?e:{}}function At(e,t,n){typeof n!=`number`&&typeof n!=`bigint`&&(t.startsWith(`--`)&&typeof e.setProperty==`function`?e.setProperty(t,String(n)):e[t]=n)}function jt(e,t){t.startsWith(`--`)&&typeof e.removeProperty==`function`?e.removeProperty(t):e[t]=``}const Mt=`http://www.w3.org/1999/xlink`;function G(e,t,n,r={}){(`mix`in t||`mix`in n)&&He(e,we(n));let i=g(e),a=ce(e),o=Object.keys(t);for(let e in n)Object.hasOwn(n,e)&&!Object.hasOwn(t,e)&&o.push(e);for(let s of o){let o=t[s],c=n[s];if(s!==`mix`&&s!==`bind`){if(s===`unsafeHTML`){r.hydrating===!0?Ft(c):o!==c&&Pt(e,c);continue}if(!zt(s)){if(pt(s)){mt(e,i,s,c,n,r);continue}o!==c&&(s===`style`?Ot(e,o,c):Lt(e,It(s,a),c))}}}ht(e,i,n,r),(i===`option`||i===`optgroup`)&&H(e),t.bind!==n.bind&&pe(e,n.bind,r.assetOwner)}function Nt(e,t){G(e,{},t,{hydrating:!0})}function Pt(e,t){let n=Ft(t);`innerHTML`in e&&(e.innerHTML=n??``)}function Ft(e){if(v(e))return null;if(typeof e==`string`)return e;throw Error(`The unsafeHTML prop must be a string.`)}function It(e,t){return t?e.toLowerCase():e}function Lt(e,t,n){if(v(n)){Rt(e,t);return}if(t===`xlink:href`){e.setAttributeNS(Mt,t,String(n));return}e.setAttribute(t,String(n))}function Rt(e,t){if(t===`xlink:href`){e.removeAttributeNS(Mt,`href`);return}e.removeAttribute(t)}function zt(e){return e===`children`||e===`key`||e===`mix`||e===`suppressHydrationWarning`||e===`unsafeHTML`||Bt(e)}function Bt(e){return/^on[A-Z]/.test(e)}var Vt=class{element;resourceKind;kind=`metadata`;byOwner=new Map;rendered=null;winner;constructor(e,t,n,r){this.element=e,this.resourceKind=t,this.winner=n,this.byOwner.set(n,r),this.applyWinner()}acquire(e,t){let n=!this.byOwner.has(e);this.byOwner.set(e,t),n&&(this.winner=e),this.winner===e&&this.applyWinner()}update(e,t){if(!this.byOwner.has(e))throw Error(`Expected a live metadata claim.`);this.byOwner.set(e,t),this.winner===e&&this.applyWinner()}release(e){if(!this.byOwner.delete(e))return`retained`;if(this.byOwner.size===0)return`empty`;if(this.winner!==e)return`retained`;let t=null;for(let e of this.byOwner.keys())t=e;if(t===null)throw Error(`Expected a live metadata claim.`);return this.winner=t,this.applyWinner(),`retained`}applyWinner(){let e=this.byOwner.get(this.winner);if(e===void 0)throw Error(`Expected a live metadata claim.`);G(this.element,this.rendered??{},e,{assetOwner:this.winner}),this.resourceKind===`title`&&(this.element.textContent=Ht(e.children)),this.rendered=e}};function Ht(e){return e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Ht).join(``):``}const Ut=new WeakMap,K=new WeakMap,Wt=new WeakSet;function Gt(e,t,n){let r=J();if(r===null)return;let i=Qt(e),a=Qt(t);for(let[e]of i)a.has(e)||tn(r,e,n);for(let[e,t]of a)i.has(e)?(t.kind===`title`||t.kind===`meta`)&&en(r,e,t,n):$t(r,t,n)}function Kt(e,t){let n=J(),r=d(e,t);return n===null||r===null?null:document.createElement(e)}function qt(e,t,n){let r=J();if(r===null)return e;let i=d(g(e),t);if(i===null)return e;if(X(i))return Y(r,i,t,n,e);let a=p(i),o=r.entries.get(a)?.element??Z(r,a),s=o??e;if(o===null)G(e,{},t,{initial:!0,assetOwner:n});else{let e=we(t);e.length!==0&&He(o,e),v(t.bind)||pe(o,t.bind,n)}return Jt(r,s,a,i.kind)}function Jt(e,t,n,r){let i=e.entries.get(n);if(i?.kind===`metadata`)throw Error(`Expected a persistent resource entry.`);return i===void 0?(K.set(t,{key:n,kind:r}),e.entries.set(n,{count:1,element:t,kind:`persistent`,ready:null})):i.count+=1,on(e,i?.element??t)}function q(e,t){let n=J(),r=K.get(e);if(n===null||r===void 0)return;let i=n.entries.get(r.key);if(i?.kind===`metadata`){nn(n,r.key,i,t);return}if(r.kind===`title`||r.kind===`meta`){K.delete(e),fn(e);return}Yt(n,e)}function Yt(e,t){let n=K.get(t);if(n===void 0)return;let r=e.entries.get(n.key);if(r===void 0||r.element!==t){if(ln(e,t))return;K.delete(t);return}if(r.kind!==`persistent`)throw Error(`Expected a persistent resource entry.`);r.count>0&&--r.count}function Xt(e,t,n,r){let i=g(e),a=d(i,n),o=K.get(e);if(a===null)return e;let s=p(a),c=J();if(c===null)return G(e,t,n,{assetOwner:r}),e;let l=o===void 0?void 0:c.entries.get(o.key);return l?.kind===`metadata`?!X(a)||s===o?.key?(l.update(r,X(a)?an(a,n):n),l.element):(q(e,r),Y(c,a,n,r)):o===void 0||s===o.key?(G(e,t,n,{assetOwner:r}),e):(q(e,r),qt(Kt(i,n)??e,n,r))}function Zt(e){let t=J();if(t===null)return Promise.resolve();let n=[];for(let r of e){if(!te(r)||r.kind===`title`||r.kind===`meta`)continue;let e=mn(r),i=p(e),a=t.entries.get(i)?.element,o=(a?.parentNode===t.head?a:null)??Z(t,i);if(o!==null){let r=t.entries.get(i);if(r?.kind===`metadata`)throw Error(`Expected a persistent resource entry.`);r?.element!==o&&(r={count:1,element:o,kind:`persistent`,ready:null},t.entries.set(i,r),K.set(o,{key:i,kind:e.kind}));let a=un(t,e,i,r);a!==null&&n.push(a);continue}let s=vn(e),c={count:1,element:s,kind:`persistent`,ready:null};c.ready=hn(e)?_n(s).then(()=>{t.entries.get(i)===c&&(c.ready=null)}):null,t.entries.set(i,c),K.set(s,{key:i,kind:e.kind}),sn(t,s),c.ready!==null&&n.push(c.ready)}return n.length===0?Promise.resolve():Promise.all(n).then(()=>void 0)}function J(){if(typeof document>`u`||document.head==null)return null;let e=Ut.get(document.head);if(e===void 0){let t={entries:new Map,head:document.head,discovered:null,observer:null},n=document.defaultView?.MutationObserver;n!==void 0&&(t.observer=new n(e=>cn(t,e)),t.observer.observe(t.head,{childList:!0,attributes:!0,subtree:!0})),e=t,Ut.set(document.head,e)}return e}function Qt(e){let t=new Map;if(e===null)return t;let n=Array.isArray(e)?e:[e];for(let e of n){if(!te(e))continue;let n=mn(e),r=p(n);(!t.has(r)||X(n))&&t.set(r,n)}return t}function $t(e,t,n){if(X(t)){Y(e,t,rn(t),n);return}let r=p(t);Jt(e,e.entries.get(r)?.element??Z(e,r)??vn(t),r,t.kind)}function en(e,t,n,r){let i=e.entries.get(t);if(i===void 0){$t(e,n,r);return}if(i.kind!==`metadata`)throw Error(`Expected a metadata resource entry.`);i.update(r,rn(n))}function tn(e,t,n){let r=e.entries.get(t);r!==void 0&&(r.kind===`metadata`?nn(e,t,r,n):Yt(e,r.element))}function Y(e,t,n,r,i){let a=p(t),o=an(t,n),s=e.entries.get(a);if(s?.kind===`persistent`)throw Error(`Expected a metadata resource entry.`);if(s===void 0){let n=Z(e,a)??i??document.createElement(t.kind);s=new Vt(n,t.kind,r,o),e.entries.set(a,s),K.set(n,{key:a,kind:t.kind})}else s.acquire(r,o);return on(e,s.element)}function nn(e,t,n,r){n.release(r)!==`retained`&&(e.entries.delete(t),K.delete(n.element),fn(n.element))}function rn(e){return e.kind===`title`?{children:e.value}:{charset:e.charset,content:e.content,"data-fig-resource-key":e.key,"http-equiv":e[`http-equiv`],name:e.name,property:e.property}}function an(e,t){return e.kind===`title`?{...t,children:e.value}:t}function X(e){return e.kind===`title`||e.kind===`meta`}function on(e,t){return t.parentNode!==e.head&&sn(e,t),ft(t),t}function sn(e,t){Wt.add(t);let n=pn(t);if(n===null){e.head.appendChild(t);return}let r=!1;for(let i=e.head.firstChild;i!==null;i=i.nextSibling){let a=h(i)?pn(i):null;if(a!==null){if(a===n)r=!0;else if(r){e.head.insertBefore(t,i);return}}}e.head.appendChild(t)}function Z(e,t){if(e.observer===null?e.discovered=null:cn(e,e.observer.takeRecords()),e.discovered===null){let t=new Map;for(let n=e.head.firstChild;n!==null;n=n.nextSibling)if(h(n)){let e=dn(n);if(e!==null){let r=p(e);t.has(r)||t.set(r,n)}}e.discovered=t}return e.discovered.get(t)??null}function cn(e,t){for(let n of t){(n.type===`attributes`||n.removedNodes.length!==0)&&(e.discovered=null);for(let t of n.addedNodes)Wt.delete(t)||(e.discovered=null)}}function ln(e,t){for(let n of e.entries.values())if(n.element===t)return!0;return!1}function un(e,t,n,r){if(!hn(t))return null;if(r.ready!==null)return r.ready;if(!gn(r.element))return null;let i=_n(r.element).then(()=>{e.entries.get(n)===r&&(r.ready=null)});return r.ready=i,i}function dn(e){return u(g(e),t=>e.getAttribute(t))}function fn(e){B(e),e.parentNode?.removeChild(e)}function pn(e){if(g(e)!==`link`)return null;let t=dn(e);return t?.kind===`stylesheet`?t.precedence??``:null}function mn(e){return e.kind===`font`?{as:`font`,crossorigin:e.crossorigin??`anonymous`,fetchpriority:e.fetchpriority,href:e.href,key:e.key,kind:`preload`,type:e.type}:e}function hn(e){return e.kind!==`stylesheet`||e.blocking===`none`?!1:e.media===void 0||e.media===``||typeof matchMedia!=`function`||matchMedia(e.media).matches}function gn(e){return g(e)===`link`&&e.getAttribute(`rel`)===`stylesheet`&&`sheet`in e&&e.sheet===null}function _n(e){return new Promise(t=>{let n=()=>{e.removeEventListener(`load`,n),e.removeEventListener(`error`,n),t()};e.addEventListener(`load`,n),e.addEventListener(`error`,n)})}function vn(e){let t=document.createElement(e.kind===`script`?`script`:`link`),n=f(e);for(let e of Object.keys(n)){let r=n[e];t.setAttribute(e,r===!0?``:r)}return t}function yn(e,t){let n=e.ownerDocument??e,r=e.getRootNode(),i=r.nodeType===11&&`host`in r?r:n;i.activeElement||(i=n);let a=i.activeElement;for(;a?.shadowRoot?.activeElement;)i=a.shadowRoot,a=i.activeElement;if(!a||a===n.body||a===n.documentElement){t();return}let o=a,s=bn(o,i);try{t()}finally{o.isConnected&&o.ownerDocument===n&&(s?.(),i.activeElement!==o&&wn(o)&&o.focus?.({preventScroll:!0}))}}function bn(e,t){if(e.localName===`input`||e.localName===`textarea`){let t=e,{selectionStart:n,selectionEnd:r,selectionDirection:i}=t;return n===null||r===null?null:()=>{t.selectionStart!==null&&(t.selectionStart!==n||t.selectionEnd!==r||t.selectionDirection!==i)&&wn(t)&&t.setSelectionRange(n,r,i??void 0)}}let n=e.ownerDocument.getSelection(),r=n&&xn(n,t);if(!n||!r||!e.contains(r.startContainer)||!e.contains(r.endContainer))return null;let{startContainer:i,startOffset:a,endContainer:o,endOffset:s}=r,c=r.collapsed,l=Cn(i,a,!1),ee=c?l:Cn(o,s,!0),u=Sn(n,r);return()=>{let r=l(),d=c?r:ee();if(!r||!d||!e.contains(r.node)||!e.contains(d.node))return;let f=xn(n,t);if(r.node===i&&r.offset===a&&d.node===o&&d.offset===s&&f?.startContainer===r.node&&f.startOffset===r.offset&&f.endContainer===d.node&&f.endOffset===d.offset&&Sn(n,f)===u)return;let p=e.ownerDocument.createRange();p.setStart(r.node,r.offset),p.setEnd(d.node,d.offset),!(p.startContainer!==r.node||p.startOffset!==r.offset||!c&&p.collapsed&&(i.nodeType!==3||o.nodeType!==3))&&wn(e)&&n.setBaseAndExtent(u?d.node:r.node,u?d.offset:r.offset,u?r.node:d.node,u?r.offset:d.offset)}}function xn(e,t){return t.nodeType===11&&e.getComposedRanges?e.getComposedRanges({shadowRoots:[t]})[0]??null:e.rangeCount?e.getRangeAt(0):null}function Sn(e,t){return e.direction===`backward`||e.direction===void 0&&e.anchorNode===t.endContainer&&e.anchorOffset===t.endOffset}function Cn(e,t,n){if(e.nodeType===3)return()=>({node:e,offset:Math.min(t,e.nodeValue?.length??0)});let r=t>0&&(n||t===e.childNodes.length),i=e.childNodes[t-+!!r];return i?()=>{let e=i.parentNode;if(!e)return null;let t=+!!r;for(let e=i.previousSibling;e;e=e.previousSibling)t++;return{node:e,offset:t}}:()=>({node:e,offset:0})}function wn(e){return e.checkVisibility?.({visibilityProperty:!0})!==!1}function Tn(e,t,n){(t.parentNode!==e||t!==n&&t.nextSibling!==n)&&(t.parentNode!==null&&typeof e.moveBefore==`function`&&t.getRootNode({composed:!0})===e.getRootNode({composed:!0})?e.moveBefore(t,n):e.insertBefore(t,n))}function En(e){if(!$(e))return null;let t=Q(e);return t===null?null:Dn(e,t)}function Dn(e,t){let n=On(e);return n===null?null:{end:n,forceClientRender:!1,id:t.id,start:e,get error(){return kn(e)},get status(){return Q(e)?.status??t.status}}}function Q(e){if(!$(e))return null;if(e.data===s)return{id:null,status:`completed`};if(e.data===o)return{id:null,status:`client-rendered`};let t=e.data.startsWith(l)?e.data.slice(l.length):null;return t!==null&&t!==``?{id:t,status:`pending`}:null}function On(e){let t=0;for(let n=e.nextSibling;n!==null;n=n.nextSibling)if($(n)){if(Q(n)!==null){t+=1;continue}if(n.data===c){if(t===0)return n;--t}}return null}function kn(e){let t=e.nextSibling;return In(t)?{digest:t.dataset.dgst,message:t.dataset.msg}:null}function An(e){if(!Ln(e))return null;for(let t=e;t!==null;t=t.parentNode){let e=0;for(let n=t.previousSibling;n!==null;n=n.previousSibling)if($(n)){if(n.data===c){e+=1;continue}if(Q(n)!==null){if(e===0)return n;--e}}}return null}function jn(e,t){if(!Ln(e))return!1;let n=t.start.parentNode,r=t.end.parentNode;if(n===null&&r===null)return!1;for(let i=e;i!==null;i=i.parentNode){if(i===t.start||i===t.end)return!1;if(n!==null&&i.parentNode===n)return Mn(i,t.start,t.end);if(r!==null&&r!==n&&i.parentNode===r)return Nn(i,t.end)}return!1}function Mn(e,t,n){for(let r=e;r!==null;r=r.previousSibling){if(r===t)return!0;if(r===n)return!1}return!1}function Nn(e,t){for(let n=e;n!==null;n=n.nextSibling)if(n===t)return!0;return!1}function Pn(e){for(let t=e.start;t!==null;){let n=t.nextSibling;if(Fn(t),t===e.end)return;t=n}}function Fn(e){e.parentNode?.removeChild(e)}function $(e){return typeof e==`object`&&!!e&&`data`in e&&`nodeType`in e&&e.nodeType===8}function In(e){return typeof e==`object`&&!!e&&`dataset`in e}function Ln(e){return typeof e==`object`&&!!e&&`parentNode`in e}function Rn(e){return e.nodeType===9}const zn=ae({createInstance:Un,commitMutation:(e,t)=>de(()=>yn(e,t)),createTextInstance:e=>document.createTextNode(e),validateInstanceNesting:(e,t,n)=>{},validateTextNesting:(e,t)=>{},containerType:e=>h(e)?g(e):null,appendInitialChild:(e,t)=>{e.appendChild(t),h(t)&&nr(t)&&H(t,!0)},finalizeInitialInstance:(e,t)=>G(e,{},t,{initial:!0}),setTextContent:(e,t)=>{e.textContent!==t&&(e.textContent=t)},getFirstHydratableChild:Jn,getNextHydratableSibling:e=>Yn(e.nextSibling),canHydrateInstance:Hn,canHydrateTextInstance:(e,t,n)=>tr(e)&&(n===!0||e.nodeValue===t),canRetainHydrationTail:e=>{let t=g(e);return t===`html`||t===`head`||t===`body`},resolveSingletonInstance:Wn,acquireSingletonInstance:(e,t)=>{Gn(e),G(e,{},t,{initial:!0})},releaseSingletonInstance:(e,t)=>{G(e,t,{}),Gn(e)},resolveHoistedInstance:(e,t,n)=>qn(e,n)===`http://www.w3.org/1999/xhtml`?Kt(e,t):null,commitHoistedInstance:qt,commitAssetResources:Gt,removeHoistedInstance:q,updateHoistedInstance:Xt,shouldCommitUpdate:(e,t,n)=>gt(e,n),clearContainer:e=>{Kn(e,Rn(e)),queueMicrotask(j)},insertBefore:(e,t,n)=>{Tn(e,t,n),h(t)&&nr(t)&&H(t),ft(t)},removeChild:(e,t)=>{B(t),e.removeChild(t)},commitTextUpdate:(e,t)=>{e.nodeValue!==t&&(e.nodeValue=t)},commitUpdate:G,commitHydratedInstance:Nt,getActivityBoundary:Vn,getFirstActivityHydratable:e=>Yn(Bn(e).firstChild??null),commitHydratedActivityBoundary:e=>{let t=e.parentNode;if(t===null)return;let n=Bn(e);for(;n.firstChild!==null;)t.insertBefore(n.firstChild,e);t.removeChild(e)},hideInstance:e=>{he(e),e.style.setProperty(`display`,`none`,`important`)},unhideInstance:(e,t)=>{let n=t.style?.display;e.style.setProperty(`display`,typeof n==`string`?n:``),ge(e)},hideTextInstance:e=>{e.nodeValue=``},unhideTextInstance:(e,t)=>{e.nodeValue!==t&&(e.nodeValue=t)},getSuspenseBoundary:En,getEnclosingSuspenseBoundaryStart:An,isTargetWithinSuspenseBoundary:jn,shouldRecoverSuspenseMismatchAtRoot:(e,t)=>Rn(e)&&jn(e.documentElement,t),registerSuspenseBoundaryRetry:(e,t)=>{e.start.__figRetry=t},commitHydratedSuspenseBoundary:e=>{e.status===`completed`&&!e.forceClientRender?(Fn(e.start),Fn(e.end)):Pn(e),queueMicrotask(j)},removeDehydratedSuspenseBoundary:e=>{Pn(e),queueMicrotask(j)},completeRootHydration:e=>{Be(e),queueMicrotask(j)},preparePortalContainer:Ke,removePortalContainer:A});Fe(zn.batchedUpdates),e(zn.scheduleRefresh);function Bn(e){return`content`in e?e.content:e}function Vn(e){return h(e)&&g(e)===`template`&&e.getAttribute(t)!==null?e:null}function Hn(e,t,n){return!h(e)||!(`setAttribute`in e)||g(e)!==t.toLowerCase()?!1:er(e,n)}function Un(e,t,n){let r=qn(e,n);return r===`http://www.w3.org/1999/xhtml`?document.createElement(e):document.createElementNS(r,e)}function Wn(e,t){if(Rn(t))return e.toLowerCase()===`html`?t.documentElement:null;let n=t.ownerDocument;if(n==null||t!==n.documentElement)return null;switch(e.toLowerCase()){case`head`:return n.head;case`body`:return n.body;default:return null}}function Gn(e){for(;e.attributes.length>0;)e.removeAttributeNode(e.attributes[0])}function Kn(e,t){let n=e.firstChild;for(;n!==null;){let r=n.nextSibling;if(n.nodeType===10){n=r;continue}if(t&&h(n)){let e=g(n);if(e===`html`||e===`head`||e===`body`){Kn(n,!0),n=r;continue}if(e===`script`||e===`style`||e===`link`&&n.getAttribute(`rel`)?.toLowerCase()===`stylesheet`){n=r;continue}}B(n),e.removeChild(n),n=r}}function qn(e,t){let n=e.toLowerCase();return n===`svg`?`http://www.w3.org/2000/svg`:n===`math`?`http://www.w3.org/1998/Math/MathML`:`namespaceURI`in t&&g(t)!==`foreignobject`?t.namespaceURI??`http://www.w3.org/1999/xhtml`:`http://www.w3.org/1999/xhtml`}function Jn(e,t){return t!==void 0&&$n(t)!==null||g(e)===`textarea`&&t!==void 0&&Qn(t)?null:Yn(e.firstChild)}function Yn(e){let t=e;for(;t!==null&&(Zn(t)||t.nodeType===10||Xn(t));)t=t.nextSibling;return t}function Xn(e){return h(e)&&e.getAttribute(i)!==null}function Zn(e){return e.nodeType===8&&e.nodeValue===ee}function Qn(e){return e.value!==void 0||e.defaultValue!==void 0}function $n(e){return v(e.unsafeHTML)?null:e.unsafeHTML}function er(e,t){let n=$n(t);return n===null||typeof n!=`string`||`innerHTML`in e}function tr(e){return e.nodeType===3}function nr(e){let t=g(e);return t===`option`||t===`optgroup`}export{Se as a,ze as i,Zt as n,fe as o,Ie as r,le as s,zn as t};
2
+ //# sourceMappingURL=renderer-DUqtXVQB.js.map