{"version":3,"names":["autoUpdate","computePosition","isElement","createEffect","createSignal","onCleanup","untrack","useIsoLayoutEffect","useFloatingTree","useFloatingRootContext","createPosition","getOpts","x","setX","ownedWrite","y","setY","placement","setPlacement","strategy","setStrategy","middlewareData","setMiddlewareData","isPositioned","setIsPositioned","referenceRef","current","floatingRef","referenceSignal","setReferenceSignal","floatingSignal","setFloatingSignal","isMounted","undefined","update","opts","reference","elements","floating","config","middleware","platform","then","next","open","setReference","node","setFloating","openValue","cleanup","o","refs","useFloating","options","nodeId","internalRootStore","onOpenChange","rootContext","positionReference","setPositionReferenceRaw","domReferenceRef","state","domReferenceElement","domReference","position","referenceElement","floatingElement","setPositionReference","computedPositionReference","getBoundingClientRect","getClientRects","contextElement","localDomReference","setLocalDomReference","localFloatingElement","setLocalFloatingElement","localRef","localFloating","sync","localDomElement","context","setOpen","events","dataRef","floatingId","rootStore","tree","externalTree","floatingContext","nodesRef","find","n","id"],"sources":["use-floating.ts"],"sourcesContent":["/**\n * Stage 2 port of Base UI React's `useFloating` hook.\n *\n * React source: `base-ui/packages/react/src/floating-ui-react/hooks/useFloating.ts`.\n * That file wraps `@floating-ui/react-dom`'s `useFloating` (the positioning\n * engine) and grafts on a root-store context, a domReference ref, and a\n * `FloatingContext` value that later-stage interaction hooks consume.\n *\n * The Solid port:\n * - Replaces `@floating-ui/react-dom`'s `useFloating` with an inline\n *   Solid-native port of the same algorithm built on `@floating-ui/dom`'s\n *   `computePosition` + `autoUpdate`. We can't reuse the React helper\n *   because it is gated on `React.useState` / `ReactDOM.flushSync`.\n * - Swaps `React.useRef` for the `MutableRef<T>` pattern from Stage 1.\n * - Swaps `React.useState` / `useEffect` for Solid's `createSignal` /\n *   `createEffect` + `onCleanup`.\n * - Uses `useIsoLayoutEffect` (alias of `createRenderEffect`) where React\n *   uses `useIsoLayoutEffect`.\n *\n * `FloatingTree` / `useFloatingTree` is ported in Stage 3. The\n * tree-sync block at the end of React's `useFloating` that writes back\n * `node.context` is now wired: it's required for\n * `FloatingFocusManager.handleFocusOutside` to detect focus moves into\n * an ancestor floating element as \"related\" rather than closing the\n * current surface.\n */\nimport {\n\tautoUpdate,\n\tcomputePosition,\n\ttype VirtualElement,\n} from \"@floating-ui/dom\";\nimport { isElement } from \"@floating-ui/utils/dom\";\nimport { createEffect, createSignal, onCleanup, untrack } from \"solid-js\";\nimport { useIsoLayoutEffect } from \"../../use-iso-layout-effect\";\nimport type { FloatingRootStore } from \"../components/floating-root-store\";\nimport { useFloatingTree } from \"../components/floating-tree\";\nimport type {\n\tContextData,\n\tExtendedElements,\n\tExtendedRefs,\n\tFloatingContext,\n\tFloatingEvents,\n\tMutableRef,\n\tNarrowedElement,\n\tReferenceType,\n\tUseFloatingOptions,\n\tUseFloatingReturn,\n} from \"../types\";\nimport { useFloatingRootContext } from \"./use-floating-root-context\";\n\n// ---------------------------------------------------------------------------\n// Low-level Solid port of `@floating-ui/react-dom`'s `useFloating`.\n//\n// This reimplements the positioning engine: drive `computePosition` from the\n// latest reference/floating/middleware/strategy/placement, and use\n// `autoUpdate` to re-run it when layout changes. Output signals feed the\n// outer `UseFloatingReturn`. Kept in this file because no other hook needs\n// it; Stage 5+ may extract it if components start reaching for the raw\n// positioning engine.\n// ---------------------------------------------------------------------------\n\ninterface UsePositionOptions {\n\tplacement: UseFloatingOptions[\"placement\"];\n\tstrategy: UseFloatingOptions[\"strategy\"];\n\tmiddleware: UseFloatingOptions[\"middleware\"];\n\tplatform: UseFloatingOptions[\"platform\"];\n\telements: {\n\t\treference: ReferenceType | null;\n\t\tfloating: HTMLElement | null;\n\t};\n\topen: boolean | undefined;\n}\n\ninterface UsePositionInternal {\n\tx: () => number;\n\ty: () => number;\n\tplacement: () => NonNullable<UseFloatingOptions[\"placement\"]>;\n\tstrategy: () => NonNullable<UseFloatingOptions[\"strategy\"]>;\n\tmiddlewareData: () => Record<string, unknown>;\n\tisPositioned: () => boolean;\n\tupdate: () => void;\n\trefs: {\n\t\treference: MutableRef<ReferenceType | null>;\n\t\tfloating: MutableRef<HTMLElement | null>;\n\t\tsetReference: (node: ReferenceType | null) => void;\n\t\tsetFloating: (node: HTMLElement | null) => void;\n\t};\n\telements: () => {\n\t\treference: ReferenceType | null;\n\t\tfloating: HTMLElement | null;\n\t};\n}\n\nfunction createPosition(\n\tgetOpts: () => UsePositionOptions,\n): UsePositionInternal {\n\tconst [x, setX] = createSignal(0, { ownedWrite: true });\n\tconst [y, setY] = createSignal(0, { ownedWrite: true });\n\t// Initial signal values are taken as snapshots — `getOpts()` reads\n\t// reactive sources (the parent's options bag) inside this hook's\n\t// component-body scope, which strict-read flags. The seeded value is\n\t// only the initial; subsequent updates flow through the apply effect\n\t// further below.\n\tconst [placement, setPlacement] = createSignal<\n\t\tNonNullable<UseFloatingOptions[\"placement\"]>\n\t>(\n\t\tuntrack(() => getOpts().placement ?? \"bottom\"),\n\t\t{ ownedWrite: true },\n\t);\n\tconst [strategy, setStrategy] = createSignal<\n\t\tNonNullable<UseFloatingOptions[\"strategy\"]>\n\t>(\n\t\tuntrack(() => getOpts().strategy ?? \"absolute\"),\n\t\t{ ownedWrite: true },\n\t);\n\tconst [middlewareData, setMiddlewareData] = createSignal<\n\t\tRecord<string, unknown>\n\t>({}, { ownedWrite: true });\n\tconst [isPositioned, setIsPositioned] = createSignal(false, {\n\t\townedWrite: true,\n\t});\n\n\tconst referenceRef: MutableRef<ReferenceType | null> = { current: null };\n\tconst floatingRef: MutableRef<HTMLElement | null> = { current: null };\n\n\tconst [referenceSignal, setReferenceSignal] =\n\t\tcreateSignal<ReferenceType | null>(null, { ownedWrite: true });\n\tconst [floatingSignal, setFloatingSignal] = createSignal<HTMLElement | null>(\n\t\tnull,\n\t\t{ ownedWrite: true },\n\t);\n\n\t// Track mount state so `computePosition` callbacks don't touch signals\n\t// after disposal. In Solid there is no `onMount` export; we flip the\n\t// flag in a split-effect's apply (which fires after setup completes)\n\t// and clear it via `onCleanup`.\n\tlet isMounted = false;\n\tcreateEffect(\n\t\t() => undefined,\n\t\t() => {\n\t\t\tisMounted = true;\n\t\t},\n\t);\n\tonCleanup(() => {\n\t\tisMounted = false;\n\t});\n\n\tconst update = () => {\n\t\t// `update` fires from effect-apply callbacks and `autoUpdate`'s\n\t\t// resize/scroll listeners — neither is a tracking scope in Solid 2.\n\t\t// `getOpts` reads store signals (for `elements.reference`/`.floating`\n\t\t// in particular); wrap in `untrack` so those reads return the current\n\t\t// values without emitting the dev \"read directly in an effect\" warning.\n\t\tconst opts = untrack(getOpts);\n\t\tconst reference = referenceRef.current ?? opts.elements.reference;\n\t\tconst floating = floatingRef.current ?? opts.elements.floating;\n\t\tif (!reference || !floating) {\n\t\t\treturn;\n\t\t}\n\t\tconst config: Parameters<typeof computePosition>[2] = {\n\t\t\tplacement: opts.placement ?? \"bottom\",\n\t\t\tstrategy: opts.strategy ?? \"absolute\",\n\t\t\tmiddleware: opts.middleware ?? [],\n\t\t};\n\t\tif (opts.platform) {\n\t\t\tconfig.platform = opts.platform;\n\t\t}\n\t\tcomputePosition(reference, floating, config).then((next) => {\n\t\t\tif (!isMounted) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetX(next.x);\n\t\t\tsetY(next.y);\n\t\t\tsetPlacement(next.placement);\n\t\t\tsetStrategy(next.strategy);\n\t\t\tsetMiddlewareData(next.middlewareData);\n\t\t\t// Matches React: don't flip isPositioned to `true` while open is\n\t\t\t// explicitly false (transition-out case).\n\t\t\tsetIsPositioned(opts.open !== false);\n\t\t});\n\t};\n\n\tconst setReference = (node: ReferenceType | null) => {\n\t\tif (node !== referenceRef.current) {\n\t\t\treferenceRef.current = node;\n\t\t\tsetReferenceSignal(node);\n\t\t}\n\t};\n\n\tconst setFloating = (node: HTMLElement | null) => {\n\t\tif (node !== floatingRef.current) {\n\t\t\tfloatingRef.current = node;\n\t\t\tsetFloatingSignal(node);\n\t\t}\n\t};\n\n\t// Reset isPositioned when open flips to false. Mirrors React's layout\n\t// effect. Split-effect: compute tracks `opts.open`, apply runs the\n\t// side effect. We check `isPositioned()` untracked inside apply since\n\t// we only want to flip it on the open-value change.\n\tcreateEffect(\n\t\t() => getOpts().open,\n\t\t(openValue) => {\n\t\t\tif (openValue === false) {\n\t\t\t\tsetIsPositioned(false);\n\t\t\t}\n\t\t},\n\t);\n\n\t// Drive `autoUpdate` whenever both reference + floating are attached.\n\t// `autoUpdate` itself handles scroll/resize listening — we just need\n\t// to re-subscribe if either element changes. Compute produces the\n\t// [reference, floating] pair (tracking `referenceSignal`,\n\t// `floatingSignal`, and the opts' elements), apply (re)binds\n\t// `autoUpdate` + hooks a cleanup.\n\tcreateEffect(\n\t\t() => {\n\t\t\tconst opts = getOpts();\n\t\t\treturn {\n\t\t\t\treference: opts.elements.reference ?? referenceSignal(),\n\t\t\t\t// The locally-set floating element (`refs.setFloating`, i.e. the\n\t\t\t\t// positioner) must take precedence over the root store's\n\t\t\t\t// `floatingElement` for POSITIONING. Roots that sync the popup\n\t\t\t\t// element into the store (tooltip, preview-card — for interaction\n\t\t\t\t// hooks like safe-polygon) would otherwise re-target `autoUpdate`\n\t\t\t\t// + `computePosition` at the popup a frame after mount, and the\n\t\t\t\t// popup-relative coordinates would corrupt the positioner's\n\t\t\t\t// transform (the tooltip visibly flies toward the document\n\t\t\t\t// origin). React's `useFloating` has the same split: positioning\n\t\t\t\t// follows `position.refs.setFloating`, the store serves hooks.\n\t\t\t\tfloating: floatingSignal() ?? opts.elements.floating,\n\t\t\t};\n\t\t},\n\t\t({ reference, floating }) => {\n\t\t\tif (reference) {\n\t\t\t\treferenceRef.current = reference;\n\t\t\t}\n\t\t\tif (floating) {\n\t\t\t\tfloatingRef.current = floating;\n\t\t\t}\n\t\t\tif (!reference || !floating) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst cleanup = autoUpdate(reference, floating, update);\n\t\t\treturn cleanup;\n\t\t},\n\t);\n\n\t// Re-run the position calc when placement/strategy/middleware change.\n\tcreateEffect(\n\t\t() => {\n\t\t\tconst o = getOpts();\n\t\t\treturn [o.placement, o.strategy, o.middleware, o.platform] as const;\n\t\t},\n\t\t() => {\n\t\t\tupdate();\n\t\t},\n\t);\n\n\treturn {\n\t\tx,\n\t\ty,\n\t\tplacement,\n\t\tstrategy,\n\t\tmiddlewareData,\n\t\tisPositioned,\n\t\tupdate,\n\t\trefs: {\n\t\t\treference: referenceRef,\n\t\t\tfloating: floatingRef,\n\t\t\tsetReference,\n\t\t\tsetFloating,\n\t\t},\n\t\telements: () => {\n\t\t\tconst opts = getOpts();\n\t\t\treturn {\n\t\t\t\treference: opts.elements.reference ?? referenceSignal(),\n\t\t\t\tfloating: opts.elements.floating ?? floatingSignal(),\n\t\t\t};\n\t\t},\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Public `useFloating` hook\n// ---------------------------------------------------------------------------\n\n/**\n * Provides data to position a floating element and context to add interactions.\n *\n * The `externalTree` option is consumed via `useFloatingTree(externalTree)`\n * to resolve the tree that owns `nodeId`; when omitted, the ambient\n * `FloatingTreeContext` supplies it. Both the `dataRef.current.floatingContext`\n * write and the tree-node back-ref (`node.context = context`) are wired.\n *\n * @see https://floating-ui.com/docs/useFloating\n */\nexport function useFloating(\n\toptions: UseFloatingOptions = {},\n): UseFloatingReturn {\n\tconst { nodeId } = options;\n\n\tconst internalRootStore = useFloatingRootContext({\n\t\tonOpenChange: options.onOpenChange,\n\t\telements: options.elements,\n\t});\n\n\tconst rootContext: FloatingRootStore =\n\t\t(options.rootContext as FloatingRootStore | undefined) ?? internalRootStore;\n\n\t// Position-reference override (settable via `setPositionReference`).\n\tconst [positionReference, setPositionReferenceRaw] =\n\t\tcreateSignal<ReferenceType | null>(null, { ownedWrite: true });\n\n\tconst domReferenceRef: MutableRef<NarrowedElement<ReferenceType> | null> = {\n\t\tcurrent: null,\n\t};\n\n\t// Sync rootContext's domReferenceElement into the local ref. React does\n\t// this inside a useIsoLayoutEffect; Solid uses the same primitive.\n\tuseIsoLayoutEffect(\n\t\t() => rootContext.state.domReferenceElement,\n\t\t(domReference) => {\n\t\t\tif (domReference) {\n\t\t\t\tdomReferenceRef.current =\n\t\t\t\t\tdomReference as NarrowedElement<ReferenceType> | null;\n\t\t\t}\n\t\t},\n\t);\n\n\tconst position = createPosition(() => ({\n\t\tplacement: options.placement,\n\t\tstrategy: options.strategy,\n\t\tmiddleware: options.middleware,\n\t\tplatform: options.platform,\n\t\telements: {\n\t\t\treference:\n\t\t\t\tpositionReference() ??\n\t\t\t\t((rootContext.state.positionReference ??\n\t\t\t\t\trootContext.state.referenceElement) as ReferenceType | null),\n\t\t\tfloating: rootContext.state.floatingElement as HTMLElement | null,\n\t\t},\n\t\topen: rootContext.state.open as boolean,\n\t}));\n\n\tconst setPositionReference = (node: ReferenceType | null) => {\n\t\tconst computedPositionReference = isElement(node)\n\t\t\t? ({\n\t\t\t\t\tgetBoundingClientRect: () => node.getBoundingClientRect(),\n\t\t\t\t\tgetClientRects: () => node.getClientRects(),\n\t\t\t\t\tcontextElement: node,\n\t\t\t\t} satisfies VirtualElement)\n\t\t\t: node;\n\t\tsetPositionReferenceRaw(computedPositionReference);\n\t\tposition.refs.setReference(computedPositionReference);\n\t};\n\n\t// Local mirrors synced into the root store — mirrors React's\n\t// `localDomReference` / `localFloatingElement` state + `useSyncedValue`\n\t// calls. We implement them as plain signals + a Solid effect so the\n\t// writes happen reactively.\n\tconst [localDomReference, setLocalDomReference] = createSignal<\n\t\tNarrowedElement<ReferenceType> | null | undefined\n\t>(undefined, { ownedWrite: true });\n\tconst [localFloatingElement, setLocalFloatingElement] =\n\t\tcreateSignal<HTMLElement | null>(null, { ownedWrite: true });\n\n\tcreateEffect(\n\t\t() => ({\n\t\t\tlocalRef: localDomReference(),\n\t\t\tlocalFloating: localFloatingElement(),\n\t\t}),\n\t\t({ localRef, localFloating }) => {\n\t\t\t// Apply callback is untracked in Solid 2 (`createEffect(compute,\n\t\t\t// effectFn)` only tracks the compute fn). We want \"current value,\n\t\t\t// no subscription\" for the rootContext store reads — `untrack`\n\t\t\t// keeps the strict-read context from flagging the snapshot reads\n\t\t\t// while preserving identical semantics (rootContext writes still\n\t\t\t// reactively notify their own subscribers).\n\t\t\tuntrack(() => {\n\t\t\t\trootContext.sync(\n\t\t\t\t\t\"referenceElement\",\n\t\t\t\t\tlocalRef === undefined\n\t\t\t\t\t\t? (rootContext.state.referenceElement as ReferenceType | null)\n\t\t\t\t\t\t: (localRef ?? null),\n\t\t\t\t);\n\t\t\t\tconst localDomElement = isElement(localRef)\n\t\t\t\t\t? (localRef as Element)\n\t\t\t\t\t: null;\n\t\t\t\trootContext.sync(\n\t\t\t\t\t\"domReferenceElement\",\n\t\t\t\t\tlocalRef === undefined\n\t\t\t\t\t\t? rootContext.state.domReferenceElement\n\t\t\t\t\t\t: localDomElement,\n\t\t\t\t);\n\t\t\t\trootContext.sync(\"floatingElement\", localFloating);\n\t\t\t});\n\t\t},\n\t);\n\n\tconst setReference = (node: ReferenceType | null) => {\n\t\tif (isElement(node) || node === null) {\n\t\t\t(domReferenceRef as MutableRef<Element | null>).current = node;\n\t\t\tsetLocalDomReference(node as NarrowedElement<ReferenceType> | null);\n\t\t}\n\n\t\t// Backwards-compat: passing a virtual element to `reference` AFTER\n\t\t// a DOM reference has been set preserves the virtual-ref path.\n\t\t// See matching comment in React source.\n\t\tif (\n\t\t\tisElement(position.refs.reference.current) ||\n\t\t\tposition.refs.reference.current === null ||\n\t\t\t(node !== null && !isElement(node))\n\t\t) {\n\t\t\tposition.refs.setReference(node);\n\t\t}\n\t};\n\n\tconst setFloating = (node: HTMLElement | null) => {\n\t\tsetLocalFloatingElement(node);\n\t\tposition.refs.setFloating(node);\n\t};\n\n\tconst refs: ExtendedRefs = {\n\t\treference: position.refs.reference,\n\t\tfloating: position.refs.floating,\n\t\tdomReference: domReferenceRef,\n\t\tsetReference,\n\t\tsetFloating,\n\t\tsetPositionReference,\n\t};\n\n\t// `elements` exposes current values. React used `useMemo`; Solid\n\t// inlines the read and relies on consumers to track if needed.\n\t// Defined as a getter-style object so the values stay live when read\n\t// from inside a tracking context (e.g. an effect in a consumer).\n\tconst elements: ExtendedElements = {\n\t\tget reference() {\n\t\t\treturn position.elements().reference;\n\t\t},\n\t\tget floating() {\n\t\t\treturn position.elements().floating;\n\t\t},\n\t\tget domReference() {\n\t\t\treturn rootContext.state\n\t\t\t\t.domReferenceElement as NarrowedElement<ReferenceType> | null;\n\t\t},\n\t};\n\n\t// FloatingContext — live getters over the underlying signals so that\n\t// interaction hooks (Stage 4+) observe current values inside effects.\n\t// Each getter subscribes to exactly one signal — a single `data()` function\n\t// that read all six signals per call caused\n\t// every reader to subscribe to all six, amplifying `middlewareData`\n\t// churn into ResizeObserver feedback via the `size` middleware's\n\t// `--anchor-width` writes.\n\tconst context: FloatingContext = {\n\t\tget x() {\n\t\t\treturn position.x();\n\t\t},\n\t\tget y() {\n\t\t\treturn position.y();\n\t\t},\n\t\tget placement() {\n\t\t\treturn position.placement();\n\t\t},\n\t\tget strategy() {\n\t\t\treturn position.strategy();\n\t\t},\n\t\tget middlewareData() {\n\t\t\treturn position.middlewareData();\n\t\t},\n\t\tget isPositioned() {\n\t\t\treturn position.isPositioned();\n\t\t},\n\t\tupdate: position.update,\n\t\tget open() {\n\t\t\treturn rootContext.state.open as boolean;\n\t\t},\n\t\tonOpenChange: rootContext.setOpen,\n\t\tevents: rootContext.context.events as FloatingEvents,\n\t\tdataRef: rootContext.context.dataRef as MutableRef<ContextData>,\n\t\tget floatingId() {\n\t\t\treturn rootContext.state.floatingId as string | undefined;\n\t\t},\n\t\trefs,\n\t\telements,\n\t\tnodeId,\n\t\trootStore: rootContext,\n\t} as FloatingContext;\n\n\t// Stash the context on the dataRef so legacy call sites can fish it\n\t// back out (matches React). Also sync the back-ref on the floating\n\t// tree node so ancestor / descendant walks (used by\n\t// `FloatingFocusManager.handleFocusOutside`, `useDismiss`, nested\n\t// hover interaction) can reach this context via `node.context`.\n\t// Mirrors React's `node.context = context` assignment at the tail of\n\t// `useFloating`.\n\tconst tree = useFloatingTree(options.externalTree);\n\tuseIsoLayoutEffect(\n\t\t() => undefined,\n\t\t() => {\n\t\t\trootContext.context.dataRef.current.floatingContext = context;\n\t\t\tif (tree && nodeId != null) {\n\t\t\t\tconst node = tree.nodesRef.current.find((n) => n.id === nodeId);\n\t\t\t\tif (node) {\n\t\t\t\t\tnode.context = context;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t);\n\n\t// Return shape: merge positioning data + context + refs + elements.\n\t// Each getter reads exactly one signal — see the note above the\n\t// `context` builder. Building the object with\n\t// getters (not via `{...result}` spread) preserves reactivity; spread\n\t// would evaluate getters once and freeze the initial `0`/`false` values.\n\treturn {\n\t\tget x() {\n\t\t\treturn position.x();\n\t\t},\n\t\tget y() {\n\t\t\treturn position.y();\n\t\t},\n\t\tget placement() {\n\t\t\treturn position.placement();\n\t\t},\n\t\tget strategy() {\n\t\t\treturn position.strategy();\n\t\t},\n\t\tget middlewareData() {\n\t\t\treturn position.middlewareData();\n\t\t},\n\t\tget isPositioned() {\n\t\t\treturn position.isPositioned();\n\t\t},\n\t\tupdate: position.update,\n\t\tcontext,\n\t\trefs,\n\t\telements,\n\t} as UseFloatingReturn;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACCA,UAAU,EACVC,eAAe,QAET,kBAAkB;AACzB,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,YAAY,EAAEC,YAAY,EAAEC,SAAS,EAAEC,OAAO,QAAQ,UAAU;AACzE,SAASC,kBAAkB,QAAQ,6BAA6B;AAEhE,SAASC,eAAe,QAAQ,6BAA6B;AAa7D,SAASC,sBAAsB,QAAQ,6BAA6B;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCA,SAASC,cAAcA,CACtBC,OAAiC,EACX;EACtB,MAAM,CAACC,CAAC,EAAEC,IAAI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