@bgub/fig-dom 0.1.0-alpha.6 → 0.1.0-alpha.7
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 +34 -0
- package/dist/index.js +1 -1
- package/dist/renderer-DBahcxuV.js +2 -0
- package/dist/renderer-DBahcxuV.js.map +1 -0
- package/dist/view-transitions.js +1 -1
- package/dist/view-transitions.js.map +1 -1
- package/dist-development/index.js +1 -1
- package/dist-development/renderer-CDHS_ArT.js +2 -0
- package/dist-development/renderer-CDHS_ArT.js.map +1 -0
- package/dist-development/view-transitions.js +1 -1
- package/dist-development/view-transitions.js.map +1 -1
- package/package.json +5 -5
- package/dist/renderer-eduO0rfo.js +0 -2
- package/dist/renderer-eduO0rfo.js.map +0 -1
- package/dist-development/renderer-BEPUhK1G.js +0 -2
- package/dist-development/renderer-BEPUhK1G.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./renderer-
|
|
1
|
+
import{t as e}from"./renderer-CDHS_ArT.js";import{VIEW_TRANSITION_PENDING_PROPERTY as t,VIEW_TRANSITION_TIMEOUT_MS as n}from"@bgub/fig/internal";import{createViewTransitionCommitCoordinator as r}from"@bgub/fig-reconciler/view-transitions";const i=new WeakMap;function a(e,t,n){let r={name:t};return i.set(r,{owner:e.ownerDocument,snapshots:n}),r}function o(e){let t=i.get(e);if(t===void 0)throw Error(`The view-transition surface was not created by Fig DOM. Read pseudo elements from a surface passed to <ViewTransition onTransition>.`);let n=c(e.name),r=e=>s(t.owner.documentElement,`::view-transition-${e}(${n})`);return{group:r(`group`),imagePair:r(`image-pair`),new:t.snapshots.new?r(`new`):null,old:t.snapshots.old?r(`old`):null}}function s(e,t){return{selector:t,animate(n,r){let i=typeof r==`number`?{duration:r,pseudoElement:t}:{...r,pseudoElement:t};return e.animate(n,i)},getAnimations(){return e.getAnimations({subtree:!0}).filter(n=>{let r=n.effect;return r!==null&&`target`in r&&r.target===e&&`pseudoElement`in r&&r.pseudoElement===t})},getComputedStyle(){return e.ownerDocument.defaultView?.getComputedStyle(e,t)??getComputedStyle(e,t)}}}function c(e){return globalThis.CSS?.escape?.(e)??e}const l=new WeakSet;function u(e,t,n,r,i,a){let o=x(e),s=o.startViewTransition?.bind(o);if(s===void 0)return!1;let c=!1,l=!1,u=!1,v=null,y=null,b=g(i),S=g(a),C=()=>{v?.(),b(!1),S()},w=()=>{n();try{let e=()=>{c=!0,y=r(),y.cancelRootSnapshot&&(v=d(o))},n=s(t.types.length===0?e:{types:[...t.types],update:e});n!==void 0&&(p(o,n),f(o,n,()=>y));let i=_(n);i===void 0?C():(n?.ready===void 0?h(i,()=>b(!1)):n.ready.then(()=>b(!0),()=>b(!1)),h(i,()=>{v?.(),S()}))}catch(e){if(!c){if(l){c=!0;try{r()}finally{C()}}else u=!0,C();return}if(C(),!l)throw e;setTimeout(()=>{throw e})}};return m(o,t.interrupt,w)?(l=!0,`deferred`):(w(),u?!1:c?`committed`:`deferred`)}function d(e){let t=e.documentElement,n=t.style,r=n.viewTransitionName??``;return n.viewTransitionName=`none`,()=>{n.viewTransitionName=r,t.getAttribute(`style`)===``&&t.removeAttribute(`style`)}}function f(e,t,n){let r=[],i=()=>{for(let e of r)try{e.cancel()}catch{}r.length=0},a=()=>{let t=n();if(t===null||t.canceledNames.length===0&&!t.cancelRootSnapshot)return;let i=e.documentElement;if(typeof i.animate!=`function`)return;let a=e=>{typeof e?.cancel==`function`&&r.push(e)},o=e=>{a(i.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(${e})`}))};try{for(let e of t.canceledNames)o(c(e));t.cancelRootSnapshot&&(o(`root`),a(i.animate({height:[0,0],width:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})))}catch{}},o=t.ready??t.finished;o===void 0?a():o.then(a,()=>void 0),h(_(t),i)}function p(e,n){e[t]=n,h(_(n),()=>{e[t]===n&&(e[t]=null)})}function m(e,r,i){let a=e[t];if(a==null)return!1;let o=_(a);if(o===void 0)return!1;let s=!0;function c(){s&&(s=!1,clearTimeout(u),e[t]===a&&(e[t]=null),i())}let u=setTimeout(c,n);if(h(o,c),r&&a.skipTransition!==void 0&&!l.has(a)){l.add(a);try{a.skipTransition()}catch{l.delete(a)}}return!0}function h(e,t){e===void 0?t():e.then(t,t)}function g(e){let t=!1;return(...n)=>{t||(t=!0,e(...n))}}function _(e){return e?.finished??e?.ready}function v(e){if(typeof e.getBoundingClientRect!=`function`)return null;let t=e.getBoundingClientRect(),n=e.ownerDocument?.defaultView??null,r=n===null||t.bottom>=0&&t.right>=0&&t.top<=n.innerHeight&&t.left<=n.innerWidth,i=!1;try{i=n?.getComputedStyle(e).position===`absolute`}catch{}return{absolutelyPositioned:i,height:t.height,inViewport:r,width:t.width,x:t.left,y:t.top}}function y(e,t,n){let r=e.style;r.viewTransitionName=c(t),n!==null&&(r.viewTransitionClass=n)}function b(e,t){let n=e.style,r=t.style,i=r?.viewTransitionName??r?.[`view-transition-name`],a=r?.viewTransitionClass??r?.[`view-transition-class`];n.viewTransitionName=S(i),n.viewTransitionClass=S(a)}function x(e){return e.ownerDocument??document}function S(e){return typeof e==`string`||typeof e==`number`?String(e).trim():``}const C=r({commit:u,apply:y,restore:b,measure:v,createSurface:a,suspend(e,t,n){return m(x(e),t.interrupt,n)}});function w(){e.installCommitCoordinator(C)}export{w as enableViewTransitions,o as getViewTransitionPseudoElements};
|
|
2
2
|
//# sourceMappingURL=view-transitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-transitions.js","names":[],"sources":["../src/view-transition-pseudos.ts","../src/view-transition.ts","../src/view-transitions.ts"],"sourcesContent":["import type { ViewTransitionSurface } from \"@bgub/fig\";\nimport type { ViewTransitionSurfaceSnapshots } from \"@bgub/fig-reconciler/view-transitions\";\n\nexport interface ViewTransitionPseudoElement {\n readonly selector: string;\n animate(\n keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n options?: number | KeyframeAnimationOptions,\n ): Animation;\n getAnimations(): Animation[];\n getComputedStyle(): CSSStyleDeclaration;\n}\n\nexport interface ViewTransitionPseudoElements {\n readonly group: ViewTransitionPseudoElement;\n readonly imagePair: ViewTransitionPseudoElement;\n readonly new: ViewTransitionPseudoElement | null;\n readonly old: ViewTransitionPseudoElement | null;\n}\n\nconst domSurfaces = new WeakMap<\n ViewTransitionSurface,\n { owner: Document; snapshots: ViewTransitionSurfaceSnapshots }\n>();\n\nexport function createDOMViewTransitionSurface(\n element: Element,\n name: string,\n snapshots: ViewTransitionSurfaceSnapshots,\n): ViewTransitionSurface {\n const surface: ViewTransitionSurface = { name };\n domSurfaces.set(surface, { owner: element.ownerDocument, snapshots });\n return surface;\n}\n\nexport function getViewTransitionPseudoElements(\n surface: ViewTransitionSurface,\n): ViewTransitionPseudoElements {\n const resolved = domSurfaces.get(surface);\n if (resolved === undefined) {\n throw new Error(\n \"The view-transition surface was not created by Fig DOM. Read pseudo \" +\n \"elements from a surface passed to <ViewTransition onTransition>.\",\n );\n }\n\n const name = escapeViewTransitionName(surface.name);\n const pseudo = (kind: string): ViewTransitionPseudoElement =>\n createPseudoElement(\n resolved.owner.documentElement,\n `::view-transition-${kind}(${name})`,\n );\n return {\n group: pseudo(\"group\"),\n imagePair: pseudo(\"image-pair\"),\n new: resolved.snapshots.new ? pseudo(\"new\") : null,\n old: resolved.snapshots.old ? pseudo(\"old\") : null,\n };\n}\n\nfunction createPseudoElement(\n element: HTMLElement,\n selector: string,\n): ViewTransitionPseudoElement {\n return {\n selector,\n animate(keyframes, options): Animation {\n const resolvedOptions: KeyframeAnimationOptions =\n typeof options === \"number\"\n ? { duration: options, pseudoElement: selector }\n : { ...options, pseudoElement: selector };\n return element.animate(keyframes, resolvedOptions);\n },\n getAnimations(): Animation[] {\n return element.getAnimations({ subtree: true }).filter((animation) => {\n const effect = animation.effect;\n return (\n effect !== null &&\n \"target\" in effect &&\n effect.target === element &&\n \"pseudoElement\" in effect &&\n effect.pseudoElement === selector\n );\n });\n },\n getComputedStyle(): CSSStyleDeclaration {\n return (\n element.ownerDocument.defaultView?.getComputedStyle(\n element,\n selector,\n ) ?? getComputedStyle(element, selector)\n );\n },\n };\n}\n\nexport function escapeViewTransitionName(name: string): string {\n return globalThis.CSS?.escape?.(name) ?? name;\n}\n","import type { Props } from \"@bgub/fig\";\nimport {\n VIEW_TRANSITION_PENDING_PROPERTY,\n VIEW_TRANSITION_TIMEOUT_MS,\n} from \"@bgub/fig/internal\";\nimport type {\n ViewTransitionCommitResult,\n ViewTransitionHostConfig,\n ViewTransitionMutationResult,\n ViewTransitionSurfaceMeasurement,\n} from \"@bgub/fig-reconciler/view-transitions\";\nimport type { Container } from \"./events.ts\";\nimport {\n createDOMViewTransitionSurface,\n escapeViewTransitionName,\n} from \"./view-transition-pseudos.ts\";\n\ninterface RunningViewTransition {\n finished?: Promise<unknown>;\n ready?: Promise<unknown>;\n}\n\ninterface CancellableAnimation {\n cancel(): void;\n}\n\ntype ViewTransitionDocument = Document & {\n [VIEW_TRANSITION_PENDING_PROPERTY]?: RunningViewTransition | null;\n};\n\nfunction commitViewTransition(\n container: Container,\n types: readonly string[],\n prepareSnapshot: () => void,\n mutate: () => ViewTransitionMutationResult,\n onReady: (active: boolean) => void,\n onFinished: () => void,\n): ViewTransitionCommitResult {\n const owner = ownerDocument(container);\n const start = owner.startViewTransition?.bind(owner);\n if (start === undefined) return false;\n\n let didMutate = false;\n let chained = false;\n let failedBeforeMutate = false;\n let restoreRootName: (() => void) | null = null;\n let mutationResult: ViewTransitionMutationResult | null = null;\n const notifyReady = once(onReady);\n const notifyFinished = once(onFinished);\n const finishUnanimated = (): void => {\n restoreRootName?.();\n notifyReady(false);\n notifyFinished();\n };\n\n const run = (): void => {\n prepareSnapshot();\n try {\n const update = () => {\n didMutate = true;\n mutationResult = mutate();\n // Before the new capture: when measurement shows every change is\n // contained in a named boundary, drop the root's own snapshot so the\n // page-wide overlay does not swallow pointer events for the\n // animation's duration.\n if (mutationResult.cancelRootSnapshot) {\n restoreRootName = cancelRootViewTransitionName(owner);\n }\n };\n const transition = start(\n types.length === 0 ? update : { types: [...types], update },\n );\n if (transition !== undefined) {\n registerPendingTransition(owner, transition);\n hideCanceledSnapshots(owner, transition, () => mutationResult);\n }\n // Root-name restore waits for the transition to fully settle: putting\n // `view-transition-name: root` back on the live <html> while the\n // transition still runs can re-associate the live root with its\n // (force-hidden) captured group, which paints the page blank for the\n // rest of the animation.\n const settleAfterTransition = transitionSettled(transition);\n if (settleAfterTransition === undefined) {\n finishUnanimated();\n } else {\n if (transition?.ready === undefined) {\n onSettled(settleAfterTransition, () => notifyReady(false));\n } else {\n transition.ready.then(\n () => notifyReady(true),\n () => notifyReady(false),\n );\n }\n const finish = (): void => {\n restoreRootName?.();\n notifyFinished();\n };\n onSettled(settleAfterTransition, finish);\n }\n } catch (error) {\n if (!didMutate) {\n // A chained run has no caller to report a fallback to and the\n // reconciler stays frozen until mutate runs: commit unanimated.\n // A synchronous run reports `false` so the caller falls back.\n if (chained) {\n didMutate = true;\n try {\n mutate();\n } finally {\n finishUnanimated();\n }\n } else {\n failedBeforeMutate = true;\n finishUnanimated();\n }\n return;\n }\n finishUnanimated();\n if (!chained) throw error;\n // Chained commit errors were already routed by the reconciler's\n // deferred-commit handling; a residual throw here is a transition\n // failure that must not vanish into the pending promise.\n setTimeout(() => {\n throw error;\n });\n }\n };\n\n // Serialize per document: starting a transition while one is running makes\n // the browser abruptly skip the running animation, and the skipped\n // transition's restore could race this one's old-state capture. The\n // reconciler normally parks eligible commits upstream (render-during-wait\n // via the adapter's suspend hook), so for fig-dom this chain is a fallback\n // for renderers that wire commit without suspend — chaining freezes the root\n // until the previous animation settles or times out; parking keeps\n // rendering live.\n if (waitForActiveViewTransition(owner, run)) {\n chained = true;\n return \"deferred\";\n }\n\n run();\n if (failedBeforeMutate) return false;\n return didMutate ? \"committed\" : \"deferred\";\n}\n\n// Remove the root element from the new capture, remembering how to restore\n// the author's inline style afterwards.\nfunction cancelRootViewTransitionName(\n owner: ViewTransitionDocument,\n): () => void {\n const element = owner.documentElement;\n const style = element.style;\n const previous = style.viewTransitionName ?? \"\";\n style.viewTransitionName = \"none\";\n\n return () => {\n style.viewTransitionName = previous;\n if (element.getAttribute(\"style\") === \"\") element.removeAttribute(\"style\");\n };\n}\n\n// Old snapshots were captured before the update callback ran and cannot be\n// un-captured; once the pseudo tree exists (ready), hide the groups of\n// measurement-canceled boundaries — and the root group plus the\n// ::view-transition overlay when the whole-page snapshot was dropped — with\n// filling zero-duration animations so untouched regions stay interactive\n// while the remaining groups animate. Mirrors React's\n// cancelViewTransitionName / cancelRootViewTransitionName.\nfunction hideCanceledSnapshots(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n getResult: () => ViewTransitionMutationResult | null,\n): void {\n // The filled zero-duration animations outlive their pseudo tree: without\n // an explicit cancel once the transition settles they would apply to the\n // next transition's pseudo tree and hide its groups.\n const hideAnimations: CancellableAnimation[] = [];\n const cancelHideAnimations = (): void => {\n for (const animation of hideAnimations) {\n try {\n animation.cancel();\n } catch {\n // Cancelling a finished pseudo animation is best-effort.\n }\n }\n hideAnimations.length = 0;\n };\n\n const hide = (): void => {\n const result = getResult();\n if (result === null) return;\n if (result.canceledNames.length === 0 && !result.cancelRootSnapshot) {\n return;\n }\n\n const element = owner.documentElement;\n if (typeof element.animate !== \"function\") return;\n\n const track = (animation: unknown): void => {\n if (\n typeof (animation as CancellableAnimation | null)?.cancel === \"function\"\n ) {\n hideAnimations.push(animation as CancellableAnimation);\n }\n };\n\n const hideGroup = (name: string): void => {\n track(\n element.animate(\n { opacity: [0, 0], pointerEvents: [\"none\", \"none\"] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: `::view-transition-group(${name})`,\n },\n ),\n );\n };\n\n try {\n for (const name of result.canceledNames) {\n hideGroup(escapeViewTransitionName(name));\n }\n if (result.cancelRootSnapshot) {\n hideGroup(\"root\");\n track(\n element.animate(\n { height: [0, 0], width: [0, 0] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: \"::view-transition\",\n },\n ),\n );\n }\n } catch {\n // Pseudo-element animation is best-effort: without it the canceled\n // snapshots fall back to the browser's default cross-fade.\n }\n };\n\n const ready = transition.ready ?? transition.finished;\n if (ready === undefined) hide();\n else ready.then(hide, () => undefined);\n\n const settled = transitionSettled(transition);\n onSettled(settled, cancelHideAnimations);\n}\n\nfunction registerPendingTransition(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n): void {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = transition;\n const release = (): void => {\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === transition) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n };\n onSettled(transitionSettled(transition), release);\n}\n\n// React caps suspended commits at 60 seconds. Besides preventing a broken or\n// infinite animation from parking work forever, releasing the document mutex\n// lets the resumed commit start a new transition, which ends the stale one.\nfunction waitForActiveViewTransition(\n owner: ViewTransitionDocument,\n onFinished: () => void,\n): boolean {\n const pending = owner[VIEW_TRANSITION_PENDING_PROPERTY];\n if (pending == null) return false;\n const settled = transitionSettled(pending);\n if (settled === undefined) return false;\n\n let waiting = true;\n function finish(): void {\n if (!waiting) return;\n waiting = false;\n clearTimeout(timeout);\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === pending) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n onFinished();\n }\n\n const timeout = setTimeout(finish, VIEW_TRANSITION_TIMEOUT_MS);\n onSettled(settled, finish);\n return true;\n}\n\nfunction onSettled(\n promise: Promise<unknown> | undefined,\n callback: () => void,\n): void {\n if (promise === undefined) callback();\n else promise.then(callback, callback);\n}\n\nfunction once<Args extends unknown[]>(\n callback: (...args: Args) => void,\n): (...args: Args) => void {\n let called = false;\n return (...args) => {\n if (called) return;\n called = true;\n callback(...args);\n };\n}\n\nfunction transitionSettled(\n transition: RunningViewTransition | undefined,\n): Promise<unknown> | undefined {\n return transition?.finished ?? transition?.ready;\n}\n\nfunction measureViewTransitionSurface(\n element: Element,\n): ViewTransitionSurfaceMeasurement | null {\n if (typeof element.getBoundingClientRect !== \"function\") return null;\n\n const rect = element.getBoundingClientRect();\n const view = element.ownerDocument?.defaultView ?? null;\n const inViewport =\n view === null\n ? true\n : rect.bottom >= 0 &&\n rect.right >= 0 &&\n rect.top <= view.innerHeight &&\n rect.left <= view.innerWidth;\n let absolutelyPositioned = false;\n try {\n absolutelyPositioned =\n view?.getComputedStyle(element).position === \"absolute\";\n } catch {\n // Detached elements or minimal test environments: assume static\n // positioning, the conservative choice (resizes keep the root snapshot).\n }\n\n return {\n absolutelyPositioned,\n height: rect.height,\n inViewport,\n width: rect.width,\n x: rect.left,\n y: rect.top,\n };\n}\n\nfunction applyViewTransitionName(\n element: Element,\n name: string,\n className: string | null,\n): void {\n const style = (element as HTMLElement).style;\n\n style.viewTransitionName = escapeViewTransitionName(name);\n if (className !== null) style.viewTransitionClass = className;\n}\n\nfunction restoreViewTransitionName(element: Element, props: Props): void {\n const style = (element as HTMLElement).style;\n const styleProp = props.style;\n const name =\n styleProp?.viewTransitionName ?? styleProp?.[\"view-transition-name\"];\n const className =\n styleProp?.viewTransitionClass ?? styleProp?.[\"view-transition-class\"];\n\n style.viewTransitionName = styleValue(name);\n style.viewTransitionClass = styleValue(className);\n}\n\nfunction ownerDocument(container: Container): ViewTransitionDocument {\n return (container.ownerDocument ?? document) as ViewTransitionDocument;\n}\n\nfunction styleValue(value: unknown): string {\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value).trim();\n }\n\n return \"\";\n}\n\nexport const viewTransitionHostConfig: ViewTransitionHostConfig<\n Container,\n Element\n> = {\n commit: commitViewTransition,\n apply: applyViewTransitionName,\n restore: restoreViewTransitionName,\n measure: measureViewTransitionSurface,\n createSurface: createDOMViewTransitionSurface,\n // Park eligible commits behind the shared per-document mutex while\n // rendering continues, then re-schedule once the transition settles.\n suspend(container, onFinished) {\n return waitForActiveViewTransition(ownerDocument(container), onFinished);\n },\n};\n","import { createViewTransitionCommitCoordinator } from \"@bgub/fig-reconciler/view-transitions\";\nimport { domRenderer } from \"./renderer.ts\";\nimport { viewTransitionHostConfig } from \"./view-transition.ts\";\n\nexport {\n getViewTransitionPseudoElements,\n type ViewTransitionPseudoElement,\n type ViewTransitionPseudoElements,\n} from \"./view-transition-pseudos.ts\";\n\nconst coordinator = createViewTransitionCommitCoordinator(\n viewTransitionHostConfig,\n);\n\nexport function enableViewTransitions(): void {\n domRenderer.installCommitCoordinator(coordinator);\n}\n"],"mappings":"+OAoBA,MAAM,EAAc,IAAI,QAKxB,SAAgB,EACd,EACA,EACA,EACuB,CACvB,IAAM,EAAiC,CAAE,MAAK,EAE9C,OADA,EAAY,IAAI,EAAS,CAAE,MAAO,EAAQ,cAAe,WAAU,CAAC,EAC7D,CACT,CAEA,SAAgB,EACd,EAC8B,CAC9B,IAAM,EAAW,EAAY,IAAI,CAAO,EACxC,GAAI,IAAa,IAAA,GACf,MAAU,MACR,sIAEF,EAGF,IAAM,EAAO,EAAyB,EAAQ,IAAI,EAC5C,EAAU,GACd,EACE,EAAS,MAAM,gBACf,qBAAqB,EAAK,GAAG,EAAK,EACpC,EACF,MAAO,CACL,MAAO,EAAO,OAAO,EACrB,UAAW,EAAO,YAAY,EAC9B,IAAK,EAAS,UAAU,IAAM,EAAO,KAAK,EAAI,KAC9C,IAAK,EAAS,UAAU,IAAM,EAAO,KAAK,EAAI,IAChD,CACF,CAEA,SAAS,EACP,EACA,EAC6B,CAC7B,MAAO,CACL,WACA,QAAQ,EAAW,EAAoB,CACrC,IAAM,EACJ,OAAO,GAAY,SACf,CAAE,SAAU,EAAS,cAAe,CAAS,EAC7C,CAAE,GAAG,EAAS,cAAe,CAAS,EAC5C,OAAO,EAAQ,QAAQ,EAAW,CAAe,CACnD,EACA,eAA6B,CAC3B,OAAO,EAAQ,cAAc,CAAE,QAAS,EAAK,CAAC,CAAC,C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C7C,EACJ,IAAS,MAEL,EAAK,QAAU,GACf,EAAK,OAAS,GACd,EAAK,KAAO,EAAK,aACjB,EAAK,MAAQ,EAAK,WACpB,EAAuB,GAC3B,GAAI,CACF,EACE,GAAM,iBAAiB,CAAO,CAAC,CAAC,WAAa,UACjD,MAAQ,CAGR,CAEA,MAAO,CACL,uBACA,OAAQ,EAAK,OACb,aACA,MAAO,EAAK,MACZ,EAAG,EAAK,KACR,EAAG,EAAK,GACV,CACF,CAEA,SAAS,EACP,EACA,EACA,EACM,CACN,IAAM,EAAS,EAAwB,MAEvC,EAAM,mBAAqB,EAAyB,CAAI,EACpD,IAAc,OAAM,EAAM,oBAAsB,EACtD,CAEA,SAAS,EAA0B,EAAkB,EAAoB,CACvE,IAAM,EAAS,EAAwB,MACjC,EAAY,EAAM,MAClB,EACJ,GAAW,oBAAsB,IAAY,wBACzC,EACJ,GAAW,qBAAuB,IAAY,yBAEhD,EAAM,mBAAqB,EAAW,CAAI,EAC1C,EAAM,oBAAsB,EAAW,CAAS,CAClD,CAEA,SAAS,EAAc,EAA8C,CACnE,OAAQ,EAAU,eAAiB,QACrC,CAEA,SAAS,EAAW,EAAwB,CAK1C,OAJI,OAAO,GAAU,UAAY,OAAO,GAAU,SACzC,OAAO,CAAK,CAAC,CAAC,KAAK,EAGrB,EACT,CCrXA,MAAM,EAAc,EAClB,CD0XA,OAAQ,EACR,MAAO,EACP,QAAS,EACT,QAAS,EACT,cAAe,EAGf,QAAQ,EAAW,EAAY,CAC7B,OAAO,EAA4B,EAAc,CAAS,EAAG,CAAU,CACzE,CCnYA,CACF,EAEA,SAAgB,GAA8B,CAC5C,EAAY,yBAAyB,CAAW,CAClD"}
|
|
1
|
+
{"version":3,"file":"view-transitions.js","names":[],"sources":["../src/view-transition-pseudos.ts","../src/view-transition.ts","../src/view-transitions.ts"],"sourcesContent":["import type { ViewTransitionSurface } from \"@bgub/fig\";\nimport type { ViewTransitionSurfaceSnapshots } from \"@bgub/fig-reconciler/view-transitions\";\n\nexport interface ViewTransitionPseudoElement {\n readonly selector: string;\n animate(\n keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n options?: number | KeyframeAnimationOptions,\n ): Animation;\n getAnimations(): Animation[];\n getComputedStyle(): CSSStyleDeclaration;\n}\n\nexport interface ViewTransitionPseudoElements {\n readonly group: ViewTransitionPseudoElement;\n readonly imagePair: ViewTransitionPseudoElement;\n readonly new: ViewTransitionPseudoElement | null;\n readonly old: ViewTransitionPseudoElement | null;\n}\n\nconst domSurfaces = new WeakMap<\n ViewTransitionSurface,\n { owner: Document; snapshots: ViewTransitionSurfaceSnapshots }\n>();\n\nexport function createDOMViewTransitionSurface(\n element: Element,\n name: string,\n snapshots: ViewTransitionSurfaceSnapshots,\n): ViewTransitionSurface {\n const surface: ViewTransitionSurface = { name };\n domSurfaces.set(surface, { owner: element.ownerDocument, snapshots });\n return surface;\n}\n\nexport function getViewTransitionPseudoElements(\n surface: ViewTransitionSurface,\n): ViewTransitionPseudoElements {\n const resolved = domSurfaces.get(surface);\n if (resolved === undefined) {\n throw new Error(\n \"The view-transition surface was not created by Fig DOM. Read pseudo \" +\n \"elements from a surface passed to <ViewTransition onTransition>.\",\n );\n }\n\n const name = escapeViewTransitionName(surface.name);\n const pseudo = (kind: string): ViewTransitionPseudoElement =>\n createPseudoElement(\n resolved.owner.documentElement,\n `::view-transition-${kind}(${name})`,\n );\n return {\n group: pseudo(\"group\"),\n imagePair: pseudo(\"image-pair\"),\n new: resolved.snapshots.new ? pseudo(\"new\") : null,\n old: resolved.snapshots.old ? pseudo(\"old\") : null,\n };\n}\n\nfunction createPseudoElement(\n element: HTMLElement,\n selector: string,\n): ViewTransitionPseudoElement {\n return {\n selector,\n animate(keyframes, options): Animation {\n const resolvedOptions: KeyframeAnimationOptions =\n typeof options === \"number\"\n ? { duration: options, pseudoElement: selector }\n : { ...options, pseudoElement: selector };\n return element.animate(keyframes, resolvedOptions);\n },\n getAnimations(): Animation[] {\n return element.getAnimations({ subtree: true }).filter((animation) => {\n const effect = animation.effect;\n return (\n effect !== null &&\n \"target\" in effect &&\n effect.target === element &&\n \"pseudoElement\" in effect &&\n effect.pseudoElement === selector\n );\n });\n },\n getComputedStyle(): CSSStyleDeclaration {\n return (\n element.ownerDocument.defaultView?.getComputedStyle(\n element,\n selector,\n ) ?? getComputedStyle(element, selector)\n );\n },\n };\n}\n\nexport function escapeViewTransitionName(name: string): string {\n return globalThis.CSS?.escape?.(name) ?? name;\n}\n","import type { Props } from \"@bgub/fig\";\nimport {\n VIEW_TRANSITION_PENDING_PROPERTY,\n VIEW_TRANSITION_TIMEOUT_MS,\n} from \"@bgub/fig/internal\";\nimport type {\n ViewTransitionCommitOptions,\n ViewTransitionCommitResult,\n ViewTransitionHostConfig,\n ViewTransitionMutationResult,\n ViewTransitionSurfaceMeasurement,\n} from \"@bgub/fig-reconciler/view-transitions\";\nimport type { Container } from \"./events.ts\";\nimport {\n createDOMViewTransitionSurface,\n escapeViewTransitionName,\n} from \"./view-transition-pseudos.ts\";\n\ninterface RunningViewTransition {\n finished?: Promise<unknown>;\n ready?: Promise<unknown>;\n skipTransition?(): void;\n}\n\ninterface CancellableAnimation {\n cancel(): void;\n}\n\ntype ViewTransitionDocument = Document & {\n [VIEW_TRANSITION_PENDING_PROPERTY]?: RunningViewTransition | null;\n};\n\nconst interruptedTransitions = new WeakSet<object>();\n\nfunction commitViewTransition(\n container: Container,\n options: ViewTransitionCommitOptions,\n prepareSnapshot: () => void,\n mutate: () => ViewTransitionMutationResult,\n onReady: (active: boolean) => void,\n onFinished: () => void,\n): ViewTransitionCommitResult {\n const owner = ownerDocument(container);\n const start = owner.startViewTransition?.bind(owner);\n if (start === undefined) return false;\n\n let didMutate = false;\n let chained = false;\n let failedBeforeMutate = false;\n let restoreRootName: (() => void) | null = null;\n let mutationResult: ViewTransitionMutationResult | null = null;\n const notifyReady = once(onReady);\n const notifyFinished = once(onFinished);\n const finishUnanimated = (): void => {\n restoreRootName?.();\n notifyReady(false);\n notifyFinished();\n };\n\n const run = (): void => {\n prepareSnapshot();\n try {\n const update = () => {\n didMutate = true;\n mutationResult = mutate();\n // Before the new capture: when measurement shows every change is\n // contained in a named boundary, drop the root's own snapshot so the\n // page-wide overlay does not swallow pointer events for the\n // animation's duration.\n if (mutationResult.cancelRootSnapshot) {\n restoreRootName = cancelRootViewTransitionName(owner);\n }\n };\n const transition = start(\n options.types.length === 0\n ? update\n : { types: [...options.types], update },\n );\n if (transition !== undefined) {\n registerPendingTransition(owner, transition);\n hideCanceledSnapshots(owner, transition, () => mutationResult);\n }\n // Root-name restore waits for the transition to fully settle: putting\n // `view-transition-name: root` back on the live <html> while the\n // transition still runs can re-associate the live root with its\n // (force-hidden) captured group, which paints the page blank for the\n // rest of the animation.\n const settleAfterTransition = transitionSettled(transition);\n if (settleAfterTransition === undefined) {\n finishUnanimated();\n } else {\n if (transition?.ready === undefined) {\n onSettled(settleAfterTransition, () => notifyReady(false));\n } else {\n transition.ready.then(\n () => notifyReady(true),\n () => notifyReady(false),\n );\n }\n const finish = (): void => {\n restoreRootName?.();\n notifyFinished();\n };\n onSettled(settleAfterTransition, finish);\n }\n } catch (error) {\n if (!didMutate) {\n // A chained run has no caller to report a fallback to and the\n // reconciler stays frozen until mutate runs: commit unanimated.\n // A synchronous run reports `false` so the caller falls back.\n if (chained) {\n didMutate = true;\n try {\n mutate();\n } finally {\n finishUnanimated();\n }\n } else {\n failedBeforeMutate = true;\n finishUnanimated();\n }\n return;\n }\n finishUnanimated();\n if (!chained) throw error;\n // Chained commit errors were already routed by the reconciler's\n // deferred-commit handling; a residual throw here is a transition\n // failure that must not vanish into the pending promise.\n setTimeout(() => {\n throw error;\n });\n }\n };\n\n // Coordinate per document: the default serializes animations, while an\n // explicit interruption skips the active one but still waits for its\n // restoration before capturing the next old state. The reconciler normally\n // parks eligible commits upstream (render-during-wait via the adapter's\n // suspend hook), so for fig-dom this chain is a fallback for renderers that\n // wire commit without suspend — chaining freezes the root until the previous\n // animation settles or times out; parking keeps rendering live.\n if (coordinateActiveViewTransition(owner, options.interrupt, run)) {\n chained = true;\n return \"deferred\";\n }\n\n run();\n if (failedBeforeMutate) return false;\n return didMutate ? \"committed\" : \"deferred\";\n}\n\n// Remove the root element from the new capture, remembering how to restore\n// the author's inline style afterwards.\nfunction cancelRootViewTransitionName(\n owner: ViewTransitionDocument,\n): () => void {\n const element = owner.documentElement;\n const style = element.style;\n const previous = style.viewTransitionName ?? \"\";\n style.viewTransitionName = \"none\";\n\n return () => {\n style.viewTransitionName = previous;\n if (element.getAttribute(\"style\") === \"\") element.removeAttribute(\"style\");\n };\n}\n\n// Old snapshots were captured before the update callback ran and cannot be\n// un-captured; once the pseudo tree exists (ready), hide the groups of\n// measurement-canceled boundaries — and the root group plus the\n// ::view-transition overlay when the whole-page snapshot was dropped — with\n// filling zero-duration animations so untouched regions stay interactive\n// while the remaining groups animate. Mirrors React's\n// cancelViewTransitionName / cancelRootViewTransitionName.\nfunction hideCanceledSnapshots(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n getResult: () => ViewTransitionMutationResult | null,\n): void {\n // The filled zero-duration animations outlive their pseudo tree: without\n // an explicit cancel once the transition settles they would apply to the\n // next transition's pseudo tree and hide its groups.\n const hideAnimations: CancellableAnimation[] = [];\n const cancelHideAnimations = (): void => {\n for (const animation of hideAnimations) {\n try {\n animation.cancel();\n } catch {\n // Cancelling a finished pseudo animation is best-effort.\n }\n }\n hideAnimations.length = 0;\n };\n\n const hide = (): void => {\n const result = getResult();\n if (result === null) return;\n if (result.canceledNames.length === 0 && !result.cancelRootSnapshot) {\n return;\n }\n\n const element = owner.documentElement;\n if (typeof element.animate !== \"function\") return;\n\n const track = (animation: unknown): void => {\n if (\n typeof (animation as CancellableAnimation | null)?.cancel === \"function\"\n ) {\n hideAnimations.push(animation as CancellableAnimation);\n }\n };\n\n const hideGroup = (name: string): void => {\n track(\n element.animate(\n { opacity: [0, 0], pointerEvents: [\"none\", \"none\"] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: `::view-transition-group(${name})`,\n },\n ),\n );\n };\n\n try {\n for (const name of result.canceledNames) {\n hideGroup(escapeViewTransitionName(name));\n }\n if (result.cancelRootSnapshot) {\n hideGroup(\"root\");\n track(\n element.animate(\n { height: [0, 0], width: [0, 0] },\n {\n duration: 0,\n fill: \"forwards\",\n pseudoElement: \"::view-transition\",\n },\n ),\n );\n }\n } catch {\n // Pseudo-element animation is best-effort: without it the canceled\n // snapshots fall back to the browser's default cross-fade.\n }\n };\n\n const ready = transition.ready ?? transition.finished;\n if (ready === undefined) hide();\n else ready.then(hide, () => undefined);\n\n const settled = transitionSettled(transition);\n onSettled(settled, cancelHideAnimations);\n}\n\nfunction registerPendingTransition(\n owner: ViewTransitionDocument,\n transition: RunningViewTransition,\n): void {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = transition;\n const release = (): void => {\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === transition) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n };\n onSettled(transitionSettled(transition), release);\n}\n\n// React caps suspended commits at 60 seconds. Besides preventing a broken or\n// infinite animation from parking work forever, releasing the document mutex\n// lets the resumed commit start a new transition, which ends the stale one.\nfunction coordinateActiveViewTransition(\n owner: ViewTransitionDocument,\n interrupt: boolean,\n onFinished: () => void,\n): boolean {\n const pending = owner[VIEW_TRANSITION_PENDING_PROPERTY];\n if (pending == null) return false;\n const settled = transitionSettled(pending);\n if (settled === undefined) return false;\n\n let waiting = true;\n function finish(): void {\n if (!waiting) return;\n waiting = false;\n clearTimeout(timeout);\n if (owner[VIEW_TRANSITION_PENDING_PROPERTY] === pending) {\n owner[VIEW_TRANSITION_PENDING_PROPERTY] = null;\n }\n onFinished();\n }\n\n const timeout = setTimeout(finish, VIEW_TRANSITION_TIMEOUT_MS);\n onSettled(settled, finish);\n if (\n interrupt &&\n pending.skipTransition !== undefined &&\n !interruptedTransitions.has(pending)\n ) {\n interruptedTransitions.add(pending);\n try {\n pending.skipTransition();\n } catch {\n interruptedTransitions.delete(pending);\n // A failed interruption falls back to waiting for normal settlement.\n }\n }\n return true;\n}\n\nfunction onSettled(\n promise: Promise<unknown> | undefined,\n callback: () => void,\n): void {\n if (promise === undefined) callback();\n else promise.then(callback, callback);\n}\n\nfunction once<Args extends unknown[]>(\n callback: (...args: Args) => void,\n): (...args: Args) => void {\n let called = false;\n return (...args) => {\n if (called) return;\n called = true;\n callback(...args);\n };\n}\n\nfunction transitionSettled(\n transition: RunningViewTransition | undefined,\n): Promise<unknown> | undefined {\n return transition?.finished ?? transition?.ready;\n}\n\nfunction measureViewTransitionSurface(\n element: Element,\n): ViewTransitionSurfaceMeasurement | null {\n if (typeof element.getBoundingClientRect !== \"function\") return null;\n\n const rect = element.getBoundingClientRect();\n const view = element.ownerDocument?.defaultView ?? null;\n const inViewport =\n view === null\n ? true\n : rect.bottom >= 0 &&\n rect.right >= 0 &&\n rect.top <= view.innerHeight &&\n rect.left <= view.innerWidth;\n let absolutelyPositioned = false;\n try {\n absolutelyPositioned =\n view?.getComputedStyle(element).position === \"absolute\";\n } catch {\n // Detached elements or minimal test environments: assume static\n // positioning, the conservative choice (resizes keep the root snapshot).\n }\n\n return {\n absolutelyPositioned,\n height: rect.height,\n inViewport,\n width: rect.width,\n x: rect.left,\n y: rect.top,\n };\n}\n\nfunction applyViewTransitionName(\n element: Element,\n name: string,\n className: string | null,\n): void {\n const style = (element as HTMLElement).style;\n\n style.viewTransitionName = escapeViewTransitionName(name);\n if (className !== null) style.viewTransitionClass = className;\n}\n\nfunction restoreViewTransitionName(element: Element, props: Props): void {\n const style = (element as HTMLElement).style;\n const styleProp = props.style;\n const name =\n styleProp?.viewTransitionName ?? styleProp?.[\"view-transition-name\"];\n const className =\n styleProp?.viewTransitionClass ?? styleProp?.[\"view-transition-class\"];\n\n style.viewTransitionName = styleValue(name);\n style.viewTransitionClass = styleValue(className);\n}\n\nfunction ownerDocument(container: Container): ViewTransitionDocument {\n return (container.ownerDocument ?? document) as ViewTransitionDocument;\n}\n\nfunction styleValue(value: unknown): string {\n if (typeof value === \"string\" || typeof value === \"number\") {\n return String(value).trim();\n }\n\n return \"\";\n}\n\nexport const viewTransitionHostConfig: ViewTransitionHostConfig<\n Container,\n Element\n> = {\n commit: commitViewTransition,\n apply: applyViewTransitionName,\n restore: restoreViewTransitionName,\n measure: measureViewTransitionSurface,\n createSurface: createDOMViewTransitionSurface,\n // Park eligible commits behind the shared per-document mutex while\n // rendering continues, then re-schedule once the transition settles.\n suspend(container, options, onFinished) {\n return coordinateActiveViewTransition(\n ownerDocument(container),\n options.interrupt,\n onFinished,\n );\n },\n};\n","import { createViewTransitionCommitCoordinator } from \"@bgub/fig-reconciler/view-transitions\";\nimport { domRenderer } from \"./renderer.ts\";\nimport { viewTransitionHostConfig } from \"./view-transition.ts\";\n\nexport {\n getViewTransitionPseudoElements,\n type ViewTransitionPseudoElement,\n type ViewTransitionPseudoElements,\n} from \"./view-transition-pseudos.ts\";\n\nconst coordinator = createViewTransitionCommitCoordinator(\n viewTransitionHostConfig,\n);\n\nexport function enableViewTransitions(): void {\n domRenderer.installCommitCoordinator(coordinator);\n}\n"],"mappings":"+OAoBA,MAAM,EAAc,IAAI,QAKxB,SAAgB,EACd,EACA,EACA,EACuB,CACvB,IAAM,EAAiC,CAAE,MAAK,EAE9C,OADA,EAAY,IAAI,EAAS,CAAE,MAAO,EAAQ,cAAe,WAAU,CAAC,EAC7D,CACT,CAEA,SAAgB,EACd,EAC8B,CAC9B,IAAM,EAAW,EAAY,IAAI,CAAO,EACxC,GAAI,IAAa,IAAA,GACf,MAAU,MACR,sIAEF,EAGF,IAAM,EAAO,EAAyB,EAAQ,IAAI,EAC5C,EAAU,GACd,EACE,EAAS,MAAM,gBACf,qBAAqB,EAAK,GAAG,EAAK,EACpC,EACF,MAAO,CACL,MAAO,EAAO,OAAO,EACrB,UAAW,EAAO,YAAY,EAC9B,IAAK,EAAS,UAAU,IAAM,EAAO,KAAK,EAAI,KAC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,SAAS,EAAc,EAA8C,CACnE,OAAQ,EAAU,eAAiB,QACrC,CAEA,SAAS,EAAW,EAAwB,CAK1C,OAJI,OAAO,GAAU,UAAY,OAAO,GAAU,SACzC,OAAO,CAAK,CAAC,CAAC,KAAK,EAGrB,EACT,CCxYA,MAAM,EAAc,EAClB,CD6YA,OAAQ,EACR,MAAO,EACP,QAAS,EACT,QAAS,EACT,cAAe,EAGf,QAAQ,EAAW,EAAS,EAAY,CACtC,OAAO,EACL,EAAc,CAAS,EACvB,EAAQ,UACR,CACF,CACF,CC1ZA,CACF,EAEA,SAAgB,GAA8B,CAC5C,EAAY,yBAAyB,CAAW,CAClD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgub/fig-dom",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Fig DOM renderer",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/bgub/fig",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@bgub/fig-reconciler": "0.1.0-alpha.
|
|
67
|
+
"@bgub/fig-reconciler": "0.1.0-alpha.7"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@bgub/fig": "0.1.0-alpha.
|
|
70
|
+
"@bgub/fig": "0.1.0-alpha.7"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@bgub/fig-server": "0.1.0-alpha.
|
|
74
|
-
"@bgub/fig": "0.1.0-alpha.
|
|
73
|
+
"@bgub/fig-server": "0.1.0-alpha.7",
|
|
74
|
+
"@bgub/fig": "0.1.0-alpha.7"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": "^20.19.0 || >=22.12.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
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 u,assetResourceFromHostAttributes as ee,assetResourceFromHostProps as d,assetResourceHostAttributes 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=new WeakMap,le=new WeakSet;function ue(...e){let t=e.filter(e=>typeof e==`function`);return(e,n)=>{for(let r of t)r(e,n)}}function de(e,t){let n=ge(t),r=y.get(e);if(n===null){r!==void 0&&x(r),y.delete(e);return}if(r===void 0){let t={callback:n,controller:null,strictRan:!1};y.set(e,t),b(e,t)}else r.callback!==n&&(x(r),r.callback=n,b(e,r))}function fe(e){let t=y.get(e);t!==void 0&&b(e,t)}function pe(e){le.add(e);let t=y.get(e);t!==void 0&&x(t)}function me(e){le.delete(e);let t=y.get(e);t!==void 0&&b(e,t)}function he(e){let t=y.get(e);t!==void 0&&(x(t),y.delete(e))}function b(e,t){t.controller!==null||e.parentNode===null||le.has(e)||(t.controller=new AbortController,t.callback(e,t.controller.signal))}function x(e){e.controller?.abort(),e.controller=null}function ge(e){if(v(e))return null;if(typeof e==`function`)return e;throw Error(`The bind prop must be a function.`)}const S=Symbol.for(`fig.native-event-descriptors`),_e=ie((e,t,n,r)=>{ne(e,`on()`);let i=e.props,a=i[S];a===void 0&&(a=[],Object.defineProperty(i,S,{configurable:!0,value:a})),a.push({callback:n,options:r,slot:re(e),type:t})});function ve(e,t,n){return _e(e,t,n)}const ye=[];function be(e){return e[S]??ye}function xe(e,t,n){let r=C(e,`currentTarget`,{value:t});try{return n(e)}finally{r()}}function Se(e,t,n){let r={immediateStopped:!1,stopped:!t&&e.cancelBubble===!0},i=Ce(e,`stopPropagation`,()=>{r.stopped=!0}),a=Ce(e,`stopImmediatePropagation`,()=>{r.stopped=!0,r.immediateStopped=!0}),o=C(e,`cancelBubble`,{get:()=>r.stopped,set(e){e===!0&&(r.stopped=!0)}});try{return n(r)}finally{o(),a(),i(),r.stopped&&(e.cancelBubble=!0)}}function Ce(e,t,n){let r=Reflect.get(e,t);return typeof r==`function`?C(e,t,{value(){n(),r.call(e)}}):we}function C(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)}:we}function we(){}const w=new WeakMap,T=new WeakMap,Te=new WeakMap,E=[],Ee=new Set(a),De=new Set([`beforeinput`,`blur`,`change`,`click`,`contextmenu`,`dblclick`,`focus`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mouseup`,`pointerdown`,`pointerup`,`submit`,`touchend`,`touchstart`]),D=new Set([`drag`,`dragover`,`mousemove`,`pointermove`,`scroll`,`touchmove`,`wheel`]),Oe=new Set([...De,...D,`mouseenter`,`mouseleave`]),ke=new Set(`abort.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 Ae=e=>e();function je(e){Ae=e}function Me(e,t){let n=O(e);n.run=t.run,t.hydrate!==void 0&&(n.hydrate=t.hydrate,Ge(e,n),Pe(e))}const Ne=new WeakMap;function Pe(e){let t=e.ownerDocument??e,i=Ne.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,Ne.set(t,i)}let o=!1;for(let t=0;t<i.length;){let n=i[t];if(Ee.has(n.type)&&I(e,n.target)){i.splice(t,1),qe(e,n.type,n),o=!0;continue}t+=1}o&&queueMicrotask(A)}function Fe(e){let t=T.get(e);if(t!==void 0){Ie(e);for(let n of t.listeners.values())e.removeEventListener(n.type,n.listener,n.capture);Le(e),T.delete(e);for(let t=E.length-1;t>=0;--t)E[t].root===e&&E.splice(t,1)}}function Ie(e){let t=T.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 Le(e){for(let t of T.get(e)?.portals??[])Le(t),k(t)}function O(e){let t=T.get(e);return t===void 0&&(t={hydrate:null,hydrationListeners:null,listeners:new Map,portalOwner:null,portals:null,run:null},T.set(e,t)),t}function Re(e,t){let n=w.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??=Ve(e),s!==void 0&&j(s),s=Ue(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())j(e);i.length===0?w.delete(e):w.set(e,i)}function ze(e){let t=w.get(e);if(t===void 0)return;let{listenerTarget:n,root:r}=Ve(e);for(let i of t)Qe(e,r,n,i)}function Be(e){let t=w.get(e);if(t!==void 0){for(let e of t)j(e);w.delete(e)}}function Ve(e){let t=L(e);if(t===null)return{listenerTarget:null,root:null};let n=T.get(t);return n===void 0?{listenerTarget:null,root:null}:{listenerTarget:t,root:n.portalOwner?.root??(n.run===null?null:t)}}function He(e,t,n){let r=O(e),i=L(n)??t;if(r.portalOwner!==null){if(r.portalOwner.root===t&&r.portalOwner.parentTarget===i){r.portalOwner={logicalParent:n,parentTarget:i,root:t};return}k(e)}r.portalOwner={logicalParent:n,parentTarget:i,root:t};let a=O(i);(a.portals??=new Set).add(e);for(let n of a.listeners.values())tt(t,e,n.type,n.capture,n.passive)}function k(e){let t=T.get(e);if(!t?.portalOwner)return;let n=t.portalOwner;t.portalOwner=null;let r=T.get(n.parentTarget);if(r!==void 0){r.portals?.delete(e);for(let t of r.listeners.keys())nt(e,t)}}function A(){let e=new Set;for(let t=0;t<E.length;){let n=E[t];if(!I(n.listenerTarget??n.root,n.event.target)){E.splice(t,1);continue}if(Je(n)===`blocked`){e.add(n.root),t+=1;continue}if(e.has(n.root)){t+=1;continue}E.splice(t,1),Ye(n)}}function Ue(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 Qe(e,t,n,o),o}function j(e){F(e),P(e)}function We(e,t,n,r,i,a){let o=L(a.target);if(o!==t&&((o===null?null:T.get(o)??null)?.portalOwner?.root===e||!I(t,a.target))||Ke(e,n,a)===`blocked`)return;let s=M(e,t,n,r,i,a);s.length!==0&&Se(a,!1,e=>N(s,a,e))}function Ge(e,t){if(t.hydrationListeners===null){t.hydrationListeners=[];for(let n of Oe){let r=t=>Ke(e,n,t);t.hydrationListeners.push([n,r]),e.addEventListener(n,r,{capture:!0,passive:ot(n)})}}}function Ke(e,t,n){let r=T.get(e)?.hydrate??null;if(r===null)return`none`;let i=Te.get(n),a=i?.get(e);if(a!==void 0)return a;let o=R(t),s=m(o,()=>r(n.target,o));return i===void 0&&(i=new WeakMap,Te.set(n,i)),i.set(e,s),s===`blocked`&&Ee.has(t)&&qe(e,t,n),s}function qe(e,t,n){E.push({event:n,listenerTarget:L(n.target),root:e,type:t})}function Je(e){let t=T.get(e.root)?.hydrate??null;if(t===null)return`none`;let n=R(e.type);return m(n,()=>t(e.event.target,n))}function Ye(e){let{event:t,root:n,type:r}=e,i=e.listenerTarget??e.root;Se(t,!0,e=>{N(M(n,i,r,!0,null,t),t,e),!(e.immediateStopped||e.stopped)&&N(M(n,i,r,!1,null,t),t,e)})}function M(e,t,n,r,i,a){let o=it(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=w.get(a);if(c!==void 0)for(let t of c){let o=rt(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 N(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{Xe(i,t)}finally{let e=i.slot;e.attachment===null&&P(e)}}}function Xe(e,t){let n=e.slot;P(n),n.controller=new AbortController;let r=n.controller.signal;Ae(()=>{Ze(e.root,()=>m(R(n.type),()=>{xe(t,e.element,t=>{e.callback(t,r)})}))})}function Ze(e,t){let n=e===null?null:T.get(e)?.run??null;return n===null?t():n(t)}function P(e){e.controller?.abort(),e.controller=null}function Qe(e,t,n,r){ke.has(r.type)?$e(e,t,r):et(t,n,r)}function $e(e,t,n){let r=n.attachment;if(r!==null){if(`element`in r&&r.element===e){t!==null&&(r.root=t);return}F(n)}let i=t=>{try{Xe({callback:n.callback,element:e,root:rt(n),slot:n},t)}finally{n.attachment===null&&P(n)}};n.attachment={element:e,listener:i,root:t},e.addEventListener(n.type,i,{capture:n.capture,passive:n.passive})}function et(e,t,n){if(e===null||t===null)return;let r=n.attachment;r!==null&&`listenerTarget`in r&&r.root===e&&r.listenerTarget===t||(F(n),n.attachment={listenerTarget:t,root:e},tt(e,t,n.type,n.capture,n.passive))}function tt(e,t,n,r,i){let a=O(t).listeners,o=`${n}:${r}:${i}`,s=a.get(o);if(s===void 0){s={capture:r,count:0,listener:a=>We(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 T.get(t)?.portals??[])tt(e,a,n,r,i)}s.count+=1}function nt(e,t){let n=T.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 T.get(e)?.portals??[])nt(n,t)}}function F(e){let t=e.attachment;t!==null&&(e.attachment=null,`element`in t?t.element.removeEventListener(e.type,t.listener,e.capture):nt(t.listenerTarget,`${e.type}:${e.capture}:${e.passive}`))}function rt(e){return e.attachment?.root??null}function it(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 at(r,e,t),r}}for(let e=n.target;e!==t&&(h(e)&&r.push(e),e=_(e),e!==null););return at(r,e,t),r}function at(e,t,n){let r=T.get(n)?.portalOwner??null;if(r===null||r.root!==t)return;let i=r.logicalParent;for(;i!==null&&i!==t;){if(st(i)){let e=T.get(i)?.portalOwner??null;if(e!==null&&e.root===t){i=e.logicalParent;continue}}h(i)&&e.push(i),i=_(i)}}function I(e,t){for(let n=t;n!==null;){if(n===e)return!0;n=_(n)}return!1}function L(e){for(let t=e;t!==null;){if(st(t)){let e=T.get(t);if(e!==void 0&&(e.portalOwner!==null||e.run!==null))return t}t=_(t)}return null}function R(e){return De.has(e)?`discrete`:D.has(e)?`continuous`:`default`}function ot(e){return D.has(e)||e===`touchstart`||e===`touchend`}function st(e){return typeof e==`object`&&!!e&&`addEventListener`in e&&`childNodes`in e}function ct(e){oe(e,e=>{fe(e),ze(e)})}function z(e){oe(e,e=>{he(e),Be(e)})}const B=new WeakMap;function lt(e){return Ct(e)||e===`checked`||e===`defaultChecked`}function ut(e,t,n,r,i,a){if(t===`select`&&Ct(n))return;if(t===`option`&&n===`value`){U(e,`value`,H(r));return}let o=a.initial===!0&&a.hydrating!==!0;n===`value`?v(r)||mt(e,r):n===`defaultValue`?pt(e,r,t,o&&i.value===void 0):n===`checked`?r!==void 0&&_t(e,r):n===`defaultChecked`&>(e,r,o&&i.checked===void 0)}function dt(e,t,n,r){if(t!==`select`)return;let i=n.value!==void 0,a=i?n.value:n.defaultValue;if(v(a)){B.delete(e);return}let o=!i&&r.hydrating===!0,s={appliedDefault:B.get(e)?.appliedDefault===!0||!i,applyDefaultToInsertedOptions:!o&&!i&&r.initial===!0,controlled:i,selectedValues:Array.isArray(a)?new Set(a.map(String)):String(a)};B.set(e,s),!o&&(i||r.initial===!0)&&vt(e,s.selectedValues)}function V(e,t=!1){let n=xt(e);if(n===null)return;let r=B.get(n);r!==void 0&&(!r.controlled&&r.appliedDefault&&!t||!r.controlled&&t&&!r.applyDefaultToInsertedOptions||(vt(e,r.selectedValues),r.controlled||(r.appliedDefault=!0)))}function ft(e,t){return(e===`input`||e===`textarea`||e===`select`)&&(t.value!==void 0||t.checked!==void 0)}function pt(e,t,n,r){let i=H(t),a=i??``;`defaultValue`in e&&(e.defaultValue=a),n===`textarea`?e.textContent=a:U(e,`value`,i),r&&`value`in e&&ht(e,a)}function mt(e,t){let n=H(t);n!==null&&(`value`in e?ht(e,n):U(e,`value`,n))}function ht(e,t){let n=e;n.value!==t&&(n.value=t)}function gt(e,t,n){let r=t===!0;`defaultChecked`in e&&(e.defaultChecked=r),U(e,`checked`,r),n&&_t(e,t)}function _t(e,t){let n=t===!0;`checked`in e?e.checked=n:U(e,`checked`,n)}function H(e){return v(e)?null:String(e)}function vt(e,t){if(g(e)===`option`){yt(e,t);return}St(e,e=>{yt(e,t)})}function yt(e,t){e.selected=bt(e,t)}function bt(e,t){let n=e.getAttribute(`value`)??(e.textContent??``).replace(/\s+/g,` `).trim();return typeof t==`string`?n===t:t.has(n)}function xt(e){let t=e.parentNode;for(;t!==null;){if(h(t)&&g(t)===`select`)return t;t=t.parentNode}return null}function St(e,t){for(let n=e.firstChild;n!==null;){let e=n.nextSibling;h(n)&&(g(n)===`option`?t(n):St(n,t)),n=e}}function Ct(e){return e===`value`||e===`defaultValue`}function U(e,t,n){v(n)?e.removeAttribute(t):e.setAttribute(t,String(n))}function wt(e,t,n){let r=e.style;if(r===void 0)return;let i=Tt(t),a=Tt(n);for(let e of Object.keys(i))e in a||Dt(r,e);for(let[e,t]of Object.entries(a))v(t)?Dt(r,e):Et(r,e,t)}function Tt(e){return typeof e==`object`&&e?e:{}}function Et(e,t,n){typeof n==`number`||typeof n==`bigint`||(t.startsWith(`--`)&&typeof e.setProperty==`function`?e.setProperty(t,String(n)):e[t]=n)}function Dt(e,t){t.startsWith(`--`)&&typeof e.removeProperty==`function`?e.removeProperty(t):e[t]=``}const Ot=`http://www.w3.org/1999/xlink`;function W(e,t,n,r={}){(`mix`in t||`mix`in n)&&Re(e,be(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`){if(s===`bind`){o!==c&&de(e,c);continue}if(s===`unsafeHTML`){r.hydrating===!0?jt(c):o!==c&&At(e,c);continue}if(!Ft(s)){if(lt(s)){ut(e,i,s,c,n,r);continue}o!==c&&(s===`style`?wt(e,o,c):Nt(e,Mt(s,a),c))}}}dt(e,i,n,r),(i===`option`||i===`optgroup`)&&V(e)}function kt(e,t){W(e,{},t,{hydrating:!0})}function At(e,t){let n=jt(t);`innerHTML`in e&&(e.innerHTML=n??``)}function jt(e){if(v(e))return null;if(typeof e==`string`)return e;throw Error(`The unsafeHTML prop must be a string.`)}function Mt(e,t){return t?e.toLowerCase():e}function Nt(e,t,n){if(v(n)){Pt(e,t);return}if(t===`xlink:href`){e.setAttributeNS(Ot,t,String(n));return}e.setAttribute(t,String(n))}function Pt(e,t){if(t===`xlink:href`){e.removeAttributeNS(Ot,`href`);return}e.removeAttribute(t)}function Ft(e){return e===`children`||e===`key`||e===`mix`||e===`suppressHydrationWarning`||e===`unsafeHTML`||It(e)}function It(e){return/^on[A-Z]/.test(e)}var Lt=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.`);W(this.element,this.rendered??{},e),this.resourceKind===`title`&&(this.element.textContent=Rt(e.children)),this.rendered=e}};function Rt(e){return e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(Rt).join(``):``}const zt=new WeakMap,G=new WeakMap;function Bt(e,t,n){let r=q();if(r===null)return;let i=qt(e),a=qt(t);for(let[e]of i)a.has(e)||Xt(r,e,n);for(let[e,t]of a)i.has(e)?(t.kind===`title`||t.kind===`meta`)&&Yt(r,e,t,n):Jt(r,t,n)}function Vt(e,t){let n=q(),r=d(e,t);if(n===null||r===null)return null;let i=p(r);if(Y(r)){let t=document.createElement(e);return G.set(t,{key:i,kind:r.kind}),t}let a=n.entries.get(i);if(a?.kind===`metadata`)throw Error(`Expected a persistent resource entry.`);let o=a?.element??Z(n,i)??document.createElement(e);return a===void 0&&(n.entries.set(i,{count:0,element:o,kind:`persistent`,ready:null}),G.set(o,{key:i,kind:r.kind})),o}function Ht(e,t,n){let r=q();if(r===null)return e;let i=d(g(e),t);return i!==null&&Y(i)?J(r,i,t,n,e):Ut(r,e)}function Ut(e,t){let n=G.get(t);if(n===void 0){let e=rn(t);if(e===null)return t;n={key:p(e),kind:e.kind},G.set(t,n)}let r=e.entries.get(n.key);if(r?.kind===`metadata`)throw Error(`Expected a persistent resource entry.`);return r!==void 0&&r.element!==t?(r.count+=1,X(e,r.element)):(r===void 0?e.entries.set(n.key,{count:1,element:t,kind:`persistent`,ready:null}):r.count+=1,X(e,t))}function K(e,t){let n=q(),r=G.get(e);if(n===null||r===void 0)return;let i=n.entries.get(r.key);if(i?.kind===`metadata`){Zt(n,r.key,i,t);return}if(r.kind===`title`||r.kind===`meta`){G.delete(e),an(e);return}Wt(n,e)}function Wt(e,t){let n=G.get(t);if(n===void 0)return;let r=e.entries.get(n.key);if(r===void 0||r.element!==t){if(tn(e,t))return;G.delete(t);return}if(r.kind!==`persistent`)throw Error(`Expected a persistent resource entry.`);r.count>0&&--r.count}function Gt(e,t,n,r){let i=g(e),a=d(i,n),o=G.get(e);if(a===null)return e;let s=p(a),c=q();if(c===null)return W(e,t,n),e;let l=o===void 0?void 0:c.entries.get(o.key);if(l?.kind===`metadata`){if(!Y(a)||s===o?.key)return l.update(r,Y(a)?$t(a,n):n),l.element;K(e,r);let t=document.createElement(i);return W(t,{},n),a.kind===`title`&&(t.textContent=a.value),G.set(t,{key:p(a),kind:a.kind}),J(c,a,n,r,t)}if(o===void 0||s===o.key)return W(e,t,n),e;K(e,r);let u=c.entries.get(s),ee=u?.kind===`persistent`&&u.count>0?u.element:void 0,f=Vt(i,n)??e;return f===e?(W(e,t,n),e):(ee!==f&&W(f,{},n),Ht(f,n,r))}function Kt(e){let t=q();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=sn(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),G.set(o,{key:i,kind:e.kind}));let a=nn(t,e,i,r);a!==null&&n.push(a);continue}let s=dn(e),c={count:1,element:s,kind:`persistent`,ready:null};c.ready=cn(e)?un(s).then(()=>{t.entries.get(i)===c&&(c.ready=null)}):null,t.entries.set(i,c),G.set(s,{key:i,kind:e.kind}),en(t,s),c.ready!==null&&n.push(c.ready)}return n.length===0?Promise.resolve():Promise.all(n).then(()=>void 0)}function q(){if(typeof document>`u`||document.head==null)return null;let e=zt.get(document.head);return e===void 0&&(e={entries:new Map,head:document.head},zt.set(document.head,e)),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=sn(e),r=p(n);(!t.has(r)||Y(n))&&t.set(r,n)}return t}function Jt(e,t,n){if(Y(t)){J(e,t,Qt(t),n);return}let r=p(t),i=e.entries.get(r);if(i?.kind===`metadata`)throw Error(`Expected a persistent resource entry.`);let a=i?.element,o=a??Z(e,r)??dn(t);a===void 0&&(e.entries.set(r,{count:0,element:o,kind:`persistent`,ready:null}),G.set(o,{key:r,kind:t.kind})),Ut(e,o)}function Yt(e,t,n,r){let i=e.entries.get(t);if(i===void 0){Jt(e,n,r);return}if(i.kind!==`metadata`)throw Error(`Expected a metadata resource entry.`);i.update(r,Qt(n))}function Xt(e,t,n){let r=e.entries.get(t);r!==void 0&&(r.kind===`metadata`?Zt(e,t,r,n):Wt(e,r.element))}function J(e,t,n,r,i){let a=p(t),o=$t(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 Lt(n,t.kind,r,o),e.entries.set(a,s),G.set(n,{key:a,kind:t.kind})}else s.acquire(r,o);return X(e,s.element)}function Zt(e,t,n,r){n.release(r)!==`retained`&&(e.entries.delete(t),G.delete(n.element),an(n.element))}function Qt(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 $t(e,t){return e.kind===`title`?{...t,children:e.value}:t}function Y(e){return e.kind===`title`||e.kind===`meta`}function X(e,t){return t.parentNode!==e.head&&en(e,t),ct(t),t}function en(e,t){let n=on(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)?on(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){for(let n=e.head.firstChild;n!==null;n=n.nextSibling)if(h(n)){let e=rn(n);if(e!==null&&p(e)===t)return n}return null}function tn(e,t){for(let n of e.entries.values())if(n.element===t)return!0;return!1}function nn(e,t,n,r){if(!cn(t))return null;if(r.ready!==null)return r.ready;if(!ln(r.element))return null;let i=un(r.element).then(()=>{e.entries.get(n)===r&&(r.ready=null)});return r.ready=i,i}function rn(e){return ee(g(e),t=>e.getAttribute(t))}function an(e){z(e),e.parentNode?.removeChild(e)}function on(e){if(g(e)!==`link`)return null;let t=rn(e);return t?.kind===`stylesheet`?t.precedence??``:null}function sn(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 cn(e){return e.kind!==`stylesheet`||e.blocking===`none`?!1:e.media===void 0||e.media===``||typeof matchMedia!=`function`||matchMedia(e.media).matches}function ln(e){return g(e)===`link`&&e.getAttribute(`rel`)===`stylesheet`&&`sheet`in e&&e.sheet===null}function un(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 dn(e){let t=document.createElement(e.kind===`script`?`script`:`link`);for(let[n,r]of f(e))t.setAttribute(n,r===!0?``:r);return t}function fn(e){if(!$(e))return null;let t=Q(e);return t===null?null:pn(e,t)}function pn(e,t){let n=mn(e);return n===null?null:{end:n,forceClientRender:!1,id:t.id,start:e,get error(){return hn(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 mn(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 hn(e){let t=e.nextSibling;return Sn(t)?{digest:t.dataset.dgst,message:t.dataset.msg}:null}function gn(e){if(!Cn(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 _n(e,t){if(!Cn(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 vn(i,t.start,t.end);if(r!==null&&r!==n&&i.parentNode===r)return yn(i,t.end)}return!1}function vn(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 yn(e,t){for(let n=e;n!==null;n=n.nextSibling)if(n===t)return!0;return!1}function bn(e){for(let t=e.start;t!==null;){let n=t.nextSibling;if(xn(t),t===e.end)return;t=n}}function xn(e){e.parentNode?.removeChild(e)}function $(e){return typeof e==`object`&&!!e&&`data`in e&&`nodeType`in e&&e.nodeType===8}function Sn(e){return typeof e==`object`&&!!e&&`dataset`in e}function Cn(e){return typeof e==`object`&&!!e&&`parentNode`in e}function wn(e){return e.nodeType===9}const Tn=ae({createInstance:kn,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)&&Hn(t)&&V(t,!0)},finalizeInitialInstance:(e,t)=>W(e,{},t,{initial:!0}),setTextContent:(e,t)=>{e.textContent!==t&&(e.textContent=t)},getFirstHydratableChild:Pn,getNextHydratableSibling:e=>Fn(e.nextSibling),canHydrateInstance:On,canHydrateTextInstance:(e,t,n)=>Vn(e)&&(n===!0||e.nodeValue===t),canRetainHydrationTail:e=>{let t=g(e);return t===`html`||t===`head`||t===`body`},resolveSingletonInstance:An,acquireSingletonInstance:(e,t)=>{jn(e),W(e,{},t,{initial:!0})},releaseSingletonInstance:(e,t)=>{W(e,t,{}),jn(e)},resolveHoistedInstance:(e,t,n)=>Nn(e,n)===`http://www.w3.org/1999/xhtml`?Vt(e,t):null,commitHoistedInstance:Ht,commitAssetResources:Bt,removeHoistedInstance:K,updateHoistedInstance:Gt,shouldCommitUpdate:(e,t,n)=>ft(e,n),clearContainer:e=>{Mn(e,wn(e)),queueMicrotask(A)},insertBefore:(e,t,n)=>{e.insertBefore(t,n),h(t)&&Hn(t)&&V(t),ct(t)},removeChild:(e,t)=>{z(t),e.removeChild(t)},commitTextUpdate:(e,t)=>{e.nodeValue!==t&&(e.nodeValue=t)},commitUpdate:W,commitHydratedInstance:kt,getActivityBoundary:Dn,getFirstActivityHydratable:e=>Fn(En(e).firstChild??null),commitHydratedActivityBoundary:e=>{let t=e.parentNode;if(t===null)return;let n=En(e);for(;n.firstChild!==null;)t.insertBefore(n.firstChild,e);t.removeChild(e)},hideInstance:e=>{pe(e),e.style.setProperty(`display`,`none`,`important`)},unhideInstance:(e,t)=>{let n=t.style?.display;e.style.setProperty(`display`,typeof n==`string`?n:``),me(e)},hideTextInstance:e=>{e.nodeValue=``},unhideTextInstance:(e,t)=>{e.nodeValue!==t&&(e.nodeValue=t)},getSuspenseBoundary:fn,getEnclosingSuspenseBoundaryStart:gn,isTargetWithinSuspenseBoundary:_n,shouldRecoverSuspenseMismatchAtRoot:(e,t)=>wn(e)&&_n(e.documentElement,t),registerSuspenseBoundaryRetry:(e,t)=>{e.start.__figRetry=t},commitHydratedSuspenseBoundary:e=>{e.status===`completed`&&!e.forceClientRender?(xn(e.start),xn(e.end)):bn(e),queueMicrotask(A)},removeDehydratedSuspenseBoundary:e=>{bn(e),queueMicrotask(A)},completeRootHydration:e=>{Ie(e),queueMicrotask(A)},preparePortalContainer:He,removePortalContainer:k});je(Tn.batchedUpdates),e(Tn.scheduleRefresh);function En(e){return`content`in e?e.content:e}function Dn(e){return h(e)&&g(e)===`template`&&e.getAttribute(t)!==null?e:null}function On(e,t,n){return!h(e)||!(`setAttribute`in e)||g(e)!==t.toLowerCase()?!1:Bn(e,n)}function kn(e,t,n){let r=Nn(e,n);return r===`http://www.w3.org/1999/xhtml`?document.createElement(e):document.createElementNS(r,e)}function An(e,t){if(wn(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 jn(e){for(;e.attributes.length>0;)e.removeAttributeNode(e.attributes[0])}function Mn(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`){Mn(n,!0),n=r;continue}if(e===`script`||e===`style`||e===`link`&&n.getAttribute(`rel`)?.toLowerCase()===`stylesheet`){n=r;continue}}z(n),e.removeChild(n),n=r}}function Nn(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 Pn(e,t){return t!==void 0&&zn(t)!==null||g(e)===`textarea`&&t!==void 0&&Rn(t)?null:Fn(e.firstChild)}function Fn(e){let t=e;for(;t!==null&&(Ln(t)||t.nodeType===10||In(t));)t=t.nextSibling;return t}function In(e){return h(e)&&e.getAttribute(i)!==null}function Ln(e){return e.nodeType===8&&e.nodeValue===u}function Rn(e){return e.value!==void 0||e.defaultValue!==void 0}function zn(e){return v(e.unsafeHTML)?null:e.unsafeHTML}function Bn(e,t){let n=zn(t);return n===null||typeof n!=`string`||`innerHTML`in e}function Vn(e){return e.nodeType===3}function Hn(e){let t=g(e);return t===`option`||t===`optgroup`}export{ve as a,Fe as i,Kt as n,ue as o,Me as r,Tn as t};
|
|
2
|
-
//# sourceMappingURL=renderer-eduO0rfo.js.map
|