{"version":3,"names":["isElement","Timeout","contains","getTarget","getNodeChildren","CURSOR_SPEED_THRESHOLD","CURSOR_SPEED_THRESHOLD_SQUARED","POLYGON_BUFFER","hasIntersectingEdge","pointX","pointY","xi","yi","xj","yj","isPointInQuadrilateral","x1","y1","x2","y2","x3","y3","x4","y4","isInsideValue","isInsideRect","rect","x","width","y","height","isInsideAxisAlignedRect","minX","Math","min","maxX","max","minY","maxY","safePolygon","options","blockPointerEvents","timeout","fn","placement","elements","onClose","nodeId","tree","side","split","hasLanded","lastX","lastY","lastCursorTime","performance","now","isCursorMovingSlowly","nextX","nextY","currentTime","elapsedTime","deltaX","deltaY","distanceSquared","thresholdSquared","close","clear","onMouseMove","event","domReference","floating","undefined","clientX","clientY","target","isLeave","type","isOverFloatingEl","isOverReferenceEl","relatedTarget","hasOpenChildNode","Boolean","nodesRef","current","length","closeIfNoOpenChild","refRect","getBoundingClientRect","cursorLeaveFromRight","right","cursorLeaveFromBottom","bottom","isFloatingWider","isFloatingTaller","left","top","isInsideTroughRect","isInsidePolygon","cursorXOffset","cursorPointOneX","cursorPointTwoX","cursorPointY","commonYLeft","commonYRight","cursorYOffset","cursorPointOneY","cursorPointTwoY","cursorPointX","commonXTop","commonXBottom","start","__options"],"sources":["safe-polygon.ts"],"sourcesContent":["import { isElement } from \"@floating-ui/utils/dom\";\n\nimport { Timeout } from \"../use-timeout\";\nimport type {\n\tHandleClose,\n\tHandleCloseContext,\n\tHandleCloseOptions,\n\tSafePolygonOptions,\n} from \"./hooks/use-hover-shared\";\nimport type { Rect, Side } from \"./types\";\nimport { contains, getTarget } from \"./utils/element\";\nimport { getNodeChildren } from \"./utils/nodes\";\n\n/**\n * Safe-polygon hover-bridge computation. Ported 1:1 from the React\n * source — pure geometry plus a shared `Timeout` for the stale-landing\n * escape path.\n *\n * The `HandleClose` / `HandleCloseContext` / `HandleCloseOptions` /\n * `SafePolygonOptions` types now live in `hooks/use-hover-shared.ts`\n * alongside the hover cluster (Stage 4.4). This module re-exports them\n * so existing `from './safe-polygon'` imports (e.g. the barrel) keep\n * working. The dependency direction is `safe-polygon → use-hover-shared`\n * for types only — no circular import, since `use-hover-shared.ts`\n * holds zero runtime references back into this file.\n */\n\nexport type {\n\tHandleClose,\n\tHandleCloseContext,\n\tHandleCloseOptions,\n\tSafePolygonOptions,\n};\n\nconst CURSOR_SPEED_THRESHOLD = 0.1;\nconst CURSOR_SPEED_THRESHOLD_SQUARED =\n\tCURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;\nconst POLYGON_BUFFER = 0.5;\n\nfunction hasIntersectingEdge(\n\tpointX: number,\n\tpointY: number,\n\txi: number,\n\tyi: number,\n\txj: number,\n\tyj: number,\n) {\n\treturn (\n\t\tyi >= pointY !== yj >= pointY &&\n\t\tpointX <= ((xj - xi) * (pointY - yi)) / (yj - yi) + xi\n\t);\n}\n\nfunction isPointInQuadrilateral(\n\tpointX: number,\n\tpointY: number,\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n\tx3: number,\n\ty3: number,\n\tx4: number,\n\ty4: number,\n) {\n\tlet isInsideValue = false;\n\tif (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {\n\t\tisInsideValue = !isInsideValue;\n\t}\n\tif (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {\n\t\tisInsideValue = !isInsideValue;\n\t}\n\tif (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {\n\t\tisInsideValue = !isInsideValue;\n\t}\n\tif (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {\n\t\tisInsideValue = !isInsideValue;\n\t}\n\treturn isInsideValue;\n}\n\nfunction isInsideRect(pointX: number, pointY: number, rect: Rect) {\n\treturn (\n\t\tpointX >= rect.x &&\n\t\tpointX <= rect.x + rect.width &&\n\t\tpointY >= rect.y &&\n\t\tpointY <= rect.y + rect.height\n\t);\n}\n\nfunction isInsideAxisAlignedRect(\n\tpointX: number,\n\tpointY: number,\n\tx1: number,\n\ty1: number,\n\tx2: number,\n\ty2: number,\n) {\n\tconst minX = Math.min(x1, x2);\n\tconst maxX = Math.max(x1, x2);\n\tconst minY = Math.min(y1, y2);\n\tconst maxY = Math.max(y1, y2);\n\treturn pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;\n}\n\n/**\n * Generates a safe polygon area the user can traverse without closing the\n * floating element once leaving the reference element.\n * @see https://floating-ui.com/docs/useHover#safepolygon\n */\nexport function safePolygon(options: SafePolygonOptions = {}): HandleClose {\n\tconst { blockPointerEvents = false } = options;\n\tconst timeout = new Timeout();\n\n\tconst fn: HandleClose = ({\n\t\tx,\n\t\ty,\n\t\tplacement,\n\t\telements,\n\t\tonClose,\n\t\tnodeId,\n\t\ttree,\n\t}) => {\n\t\tconst side = placement?.split(\"-\")[0] as Side | undefined;\n\t\tlet hasLanded = false;\n\t\tlet lastX: number | null = null;\n\t\tlet lastY: number | null = null;\n\t\tlet lastCursorTime =\n\t\t\ttypeof performance !== \"undefined\" ? performance.now() : 0;\n\n\t\tfunction isCursorMovingSlowly(nextX: number, nextY: number) {\n\t\t\tconst currentTime = performance.now();\n\t\t\tconst elapsedTime = currentTime - lastCursorTime;\n\n\t\t\tif (lastX === null || lastY === null || elapsedTime === 0) {\n\t\t\t\tlastX = nextX;\n\t\t\t\tlastY = nextY;\n\t\t\t\tlastCursorTime = currentTime;\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst deltaX = nextX - lastX;\n\t\t\tconst deltaY = nextY - lastY;\n\t\t\tconst distanceSquared = deltaX * deltaX + deltaY * deltaY;\n\t\t\tconst thresholdSquared =\n\t\t\t\telapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;\n\n\t\t\tlastX = nextX;\n\t\t\tlastY = nextY;\n\t\t\tlastCursorTime = currentTime;\n\n\t\t\treturn distanceSquared < thresholdSquared;\n\t\t}\n\n\t\tfunction close() {\n\t\t\ttimeout.clear();\n\t\t\tonClose();\n\t\t}\n\n\t\treturn function onMouseMove(event: MouseEvent) {\n\t\t\ttimeout.clear();\n\n\t\t\tconst domReference = elements.domReference;\n\t\t\tconst floating = elements.floating;\n\t\t\tif (\n\t\t\t\t!domReference ||\n\t\t\t\t!floating ||\n\t\t\t\tside == null ||\n\t\t\t\tx == null ||\n\t\t\t\ty == null\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst { clientX, clientY } = event;\n\t\t\tconst target = getTarget(event) as Element | null;\n\t\t\tconst isLeave = event.type === \"mouseleave\";\n\t\t\tconst isOverFloatingEl = contains(floating, target);\n\t\t\tconst isOverReferenceEl = contains(domReference, target);\n\n\t\t\tif (isOverFloatingEl) {\n\t\t\t\thasLanded = true;\n\t\t\t\tif (!isLeave) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isOverReferenceEl) {\n\t\t\t\thasLanded = false;\n\t\t\t\tif (!isLeave) {\n\t\t\t\t\thasLanded = true;\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Prevent overlapping floating element from being stuck in an\n\t\t\t// open-close loop: https://github.com/floating-ui/floating-ui/issues/1910\n\t\t\tif (\n\t\t\t\tisLeave &&\n\t\t\t\tisElement(event.relatedTarget) &&\n\t\t\t\tcontains(floating, event.relatedTarget as Element)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tfunction hasOpenChildNode() {\n\t\t\t\treturn Boolean(\n\t\t\t\t\ttree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfunction closeIfNoOpenChild() {\n\t\t\t\tif (!hasOpenChildNode()) {\n\t\t\t\t\tclose();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If any nested child is open, abort.\n\t\t\tif (hasOpenChildNode()) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst refRect = domReference.getBoundingClientRect();\n\t\t\tconst rect = floating.getBoundingClientRect();\n\t\t\tconst cursorLeaveFromRight = x > rect.right - rect.width / 2;\n\t\t\tconst cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n\t\t\tconst isFloatingWider = rect.width > refRect.width;\n\t\t\tconst isFloatingTaller = rect.height > refRect.height;\n\t\t\tconst left = (isFloatingWider ? refRect : rect).left;\n\t\t\tconst right = (isFloatingWider ? refRect : rect).right;\n\t\t\tconst top = (isFloatingTaller ? refRect : rect).top;\n\t\t\tconst bottom = (isFloatingTaller ? refRect : rect).bottom;\n\n\t\t\t// If the pointer leaves from the opposite side, the \"buffer\" logic\n\t\t\t// creates a point where the floating element remains open, but\n\t\t\t// should be ignored. Constant of 1 handles float rounding.\n\t\t\tif (\n\t\t\t\t(side === \"top\" && y >= refRect.bottom - 1) ||\n\t\t\t\t(side === \"bottom\" && y <= refRect.top + 1) ||\n\t\t\t\t(side === \"left\" && x >= refRect.right - 1) ||\n\t\t\t\t(side === \"right\" && x <= refRect.left + 1)\n\t\t\t) {\n\t\t\t\tcloseIfNoOpenChild();\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// Ignore when the cursor is within the rectangular trough between\n\t\t\t// the two elements. Since the triangle is created from the cursor\n\t\t\t// point, which can start beyond the ref element's edge, traversing\n\t\t\t// back and forth from the ref to the floating element could close\n\t\t\t// it; this keeps it open.\n\t\t\tlet isInsideTroughRect = false;\n\n\t\t\tswitch (side) {\n\t\t\t\tcase \"top\":\n\t\t\t\t\tisInsideTroughRect = isInsideAxisAlignedRect(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\tleft,\n\t\t\t\t\t\trefRect.top + 1,\n\t\t\t\t\t\tright,\n\t\t\t\t\t\trect.bottom - 1,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"bottom\":\n\t\t\t\t\tisInsideTroughRect = isInsideAxisAlignedRect(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\tleft,\n\t\t\t\t\t\trect.top + 1,\n\t\t\t\t\t\tright,\n\t\t\t\t\t\trefRect.bottom - 1,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"left\":\n\t\t\t\t\tisInsideTroughRect = isInsideAxisAlignedRect(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\trect.right - 1,\n\t\t\t\t\t\tbottom,\n\t\t\t\t\t\trefRect.left + 1,\n\t\t\t\t\t\ttop,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"right\":\n\t\t\t\t\tisInsideTroughRect = isInsideAxisAlignedRect(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\trefRect.right - 1,\n\t\t\t\t\t\tbottom,\n\t\t\t\t\t\trect.left + 1,\n\t\t\t\t\t\ttop,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif (isInsideTroughRect) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (hasLanded && !isInsideRect(clientX, clientY, refRect)) {\n\t\t\t\tcloseIfNoOpenChild();\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (!isLeave && isCursorMovingSlowly(clientX, clientY)) {\n\t\t\t\tcloseIfNoOpenChild();\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tlet isInsidePolygon = false;\n\n\t\t\tswitch (side) {\n\t\t\t\tcase \"top\": {\n\t\t\t\t\tconst cursorXOffset = isFloatingWider\n\t\t\t\t\t\t? POLYGON_BUFFER / 2\n\t\t\t\t\t\t: POLYGON_BUFFER * 4;\n\t\t\t\t\tconst cursorPointOneX = isFloatingWider\n\t\t\t\t\t\t? x + cursorXOffset\n\t\t\t\t\t\t: cursorLeaveFromRight\n\t\t\t\t\t\t\t? x + cursorXOffset\n\t\t\t\t\t\t\t: x - cursorXOffset;\n\t\t\t\t\tconst cursorPointTwoX = isFloatingWider\n\t\t\t\t\t\t? x - cursorXOffset\n\t\t\t\t\t\t: cursorLeaveFromRight\n\t\t\t\t\t\t\t? x + cursorXOffset\n\t\t\t\t\t\t\t: x - cursorXOffset;\n\t\t\t\t\tconst cursorPointY = y + POLYGON_BUFFER + 1;\n\n\t\t\t\t\tconst commonYLeft = cursorLeaveFromRight\n\t\t\t\t\t\t? rect.bottom - POLYGON_BUFFER\n\t\t\t\t\t\t: isFloatingWider\n\t\t\t\t\t\t\t? rect.bottom - POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.top;\n\t\t\t\t\tconst commonYRight = cursorLeaveFromRight\n\t\t\t\t\t\t? isFloatingWider\n\t\t\t\t\t\t\t? rect.bottom - POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.top\n\t\t\t\t\t\t: rect.bottom - POLYGON_BUFFER;\n\n\t\t\t\t\tisInsidePolygon = isPointInQuadrilateral(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\tcursorPointOneX,\n\t\t\t\t\t\tcursorPointY,\n\t\t\t\t\t\tcursorPointTwoX,\n\t\t\t\t\t\tcursorPointY,\n\t\t\t\t\t\trect.left,\n\t\t\t\t\t\tcommonYLeft,\n\t\t\t\t\t\trect.right,\n\t\t\t\t\t\tcommonYRight,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"bottom\": {\n\t\t\t\t\tconst cursorXOffset = isFloatingWider\n\t\t\t\t\t\t? POLYGON_BUFFER / 2\n\t\t\t\t\t\t: POLYGON_BUFFER * 4;\n\t\t\t\t\tconst cursorPointOneX = isFloatingWider\n\t\t\t\t\t\t? x + cursorXOffset\n\t\t\t\t\t\t: cursorLeaveFromRight\n\t\t\t\t\t\t\t? x + cursorXOffset\n\t\t\t\t\t\t\t: x - cursorXOffset;\n\t\t\t\t\tconst cursorPointTwoX = isFloatingWider\n\t\t\t\t\t\t? x - cursorXOffset\n\t\t\t\t\t\t: cursorLeaveFromRight\n\t\t\t\t\t\t\t? x + cursorXOffset\n\t\t\t\t\t\t\t: x - cursorXOffset;\n\t\t\t\t\tconst cursorPointY = y - POLYGON_BUFFER;\n\n\t\t\t\t\tconst commonYLeft = cursorLeaveFromRight\n\t\t\t\t\t\t? rect.top + POLYGON_BUFFER\n\t\t\t\t\t\t: isFloatingWider\n\t\t\t\t\t\t\t? rect.top + POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.bottom;\n\t\t\t\t\tconst commonYRight = cursorLeaveFromRight\n\t\t\t\t\t\t? isFloatingWider\n\t\t\t\t\t\t\t? rect.top + POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.bottom\n\t\t\t\t\t\t: rect.top + POLYGON_BUFFER;\n\n\t\t\t\t\tisInsidePolygon = isPointInQuadrilateral(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\tcursorPointOneX,\n\t\t\t\t\t\tcursorPointY,\n\t\t\t\t\t\tcursorPointTwoX,\n\t\t\t\t\t\tcursorPointY,\n\t\t\t\t\t\trect.left,\n\t\t\t\t\t\tcommonYLeft,\n\t\t\t\t\t\trect.right,\n\t\t\t\t\t\tcommonYRight,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"left\": {\n\t\t\t\t\tconst cursorYOffset = isFloatingTaller\n\t\t\t\t\t\t? POLYGON_BUFFER / 2\n\t\t\t\t\t\t: POLYGON_BUFFER * 4;\n\t\t\t\t\tconst cursorPointOneY = isFloatingTaller\n\t\t\t\t\t\t? y + cursorYOffset\n\t\t\t\t\t\t: cursorLeaveFromBottom\n\t\t\t\t\t\t\t? y + cursorYOffset\n\t\t\t\t\t\t\t: y - cursorYOffset;\n\t\t\t\t\tconst cursorPointTwoY = isFloatingTaller\n\t\t\t\t\t\t? y - cursorYOffset\n\t\t\t\t\t\t: cursorLeaveFromBottom\n\t\t\t\t\t\t\t? y + cursorYOffset\n\t\t\t\t\t\t\t: y - cursorYOffset;\n\t\t\t\t\tconst cursorPointX = x + POLYGON_BUFFER + 1;\n\n\t\t\t\t\tconst commonXTop = cursorLeaveFromBottom\n\t\t\t\t\t\t? rect.right - POLYGON_BUFFER\n\t\t\t\t\t\t: isFloatingTaller\n\t\t\t\t\t\t\t? rect.right - POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.left;\n\t\t\t\t\tconst commonXBottom = cursorLeaveFromBottom\n\t\t\t\t\t\t? isFloatingTaller\n\t\t\t\t\t\t\t? rect.right - POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.left\n\t\t\t\t\t\t: rect.right - POLYGON_BUFFER;\n\n\t\t\t\t\tisInsidePolygon = isPointInQuadrilateral(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\tcommonXTop,\n\t\t\t\t\t\trect.top,\n\t\t\t\t\t\tcommonXBottom,\n\t\t\t\t\t\trect.bottom,\n\t\t\t\t\t\tcursorPointX,\n\t\t\t\t\t\tcursorPointOneY,\n\t\t\t\t\t\tcursorPointX,\n\t\t\t\t\t\tcursorPointTwoY,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"right\": {\n\t\t\t\t\tconst cursorYOffset = isFloatingTaller\n\t\t\t\t\t\t? POLYGON_BUFFER / 2\n\t\t\t\t\t\t: POLYGON_BUFFER * 4;\n\t\t\t\t\tconst cursorPointOneY = isFloatingTaller\n\t\t\t\t\t\t? y + cursorYOffset\n\t\t\t\t\t\t: cursorLeaveFromBottom\n\t\t\t\t\t\t\t? y + cursorYOffset\n\t\t\t\t\t\t\t: y - cursorYOffset;\n\t\t\t\t\tconst cursorPointTwoY = isFloatingTaller\n\t\t\t\t\t\t? y - cursorYOffset\n\t\t\t\t\t\t: cursorLeaveFromBottom\n\t\t\t\t\t\t\t? y + cursorYOffset\n\t\t\t\t\t\t\t: y - cursorYOffset;\n\t\t\t\t\tconst cursorPointX = x - POLYGON_BUFFER;\n\n\t\t\t\t\tconst commonXTop = cursorLeaveFromBottom\n\t\t\t\t\t\t? rect.left + POLYGON_BUFFER\n\t\t\t\t\t\t: isFloatingTaller\n\t\t\t\t\t\t\t? rect.left + POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.right;\n\t\t\t\t\tconst commonXBottom = cursorLeaveFromBottom\n\t\t\t\t\t\t? isFloatingTaller\n\t\t\t\t\t\t\t? rect.left + POLYGON_BUFFER\n\t\t\t\t\t\t\t: rect.right\n\t\t\t\t\t\t: rect.left + POLYGON_BUFFER;\n\n\t\t\t\t\tisInsidePolygon = isPointInQuadrilateral(\n\t\t\t\t\t\tclientX,\n\t\t\t\t\t\tclientY,\n\t\t\t\t\t\tcursorPointX,\n\t\t\t\t\t\tcursorPointOneY,\n\t\t\t\t\t\tcursorPointX,\n\t\t\t\t\t\tcursorPointTwoY,\n\t\t\t\t\t\tcommonXTop,\n\t\t\t\t\t\trect.top,\n\t\t\t\t\t\tcommonXBottom,\n\t\t\t\t\t\trect.bottom,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif (!isInsidePolygon) {\n\t\t\t\tcloseIfNoOpenChild();\n\t\t\t} else if (!hasLanded) {\n\t\t\t\ttimeout.start(40, closeIfNoOpenChild);\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t};\n\t};\n\n\tfn.__options = {\n\t\t...options,\n\t\tblockPointerEvents,\n\t};\n\n\treturn fn;\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,wBAAwB;AAElD,SAASC,OAAO,QAAQ,gBAAgB;AAQxC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,iBAAiB;AACrD,SAASC,eAAe,QAAQ,eAAe;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,MAAMC,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