{"version":3,"sources":["../../../src/hooks/useSafeZoneArea/getSafeZonePoints.ts"],"sourcesContent":["import type { Point } from './types';\n\ntype RectCorners = Record<'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft', Point>;\n\n/**\n * Returns the mouse anchor and the container corners facing it.\n *\n * @internal\n */\nexport function getSafeZonePoints(mouseAnchor: Point, containerCorners: RectCorners): Point[] {\n  const { topLeft, topRight, bottomRight, bottomLeft } = containerCorners;\n  const isAbove = mouseAnchor[1] < topLeft[1];\n  const isBelow = mouseAnchor[1] > bottomLeft[1];\n  const isLeft = mouseAnchor[0] < topLeft[0];\n  const isRight = mouseAnchor[0] > topRight[0];\n\n  if (isAbove) {\n    if (isLeft) {\n      return [mouseAnchor, bottomLeft, topLeft, topRight];\n    }\n\n    if (isRight) {\n      return [mouseAnchor, topLeft, topRight, bottomRight];\n    }\n\n    return [mouseAnchor, topLeft, topRight];\n  }\n\n  if (isBelow) {\n    if (isLeft) {\n      return [mouseAnchor, topLeft, bottomLeft, bottomRight];\n    }\n\n    if (isRight) {\n      return [mouseAnchor, topRight, bottomRight, bottomLeft];\n    }\n\n    return [mouseAnchor, bottomRight, bottomLeft];\n  }\n\n  if (isLeft) {\n    return [mouseAnchor, bottomLeft, topLeft];\n  }\n\n  if (isRight) {\n    return [mouseAnchor, topRight, bottomRight];\n  }\n\n  return [];\n}\n"],"names":["getSafeZonePoints","mouseAnchor","containerCorners","topLeft","topRight","bottomRight","bottomLeft","isAbove","isBelow","isLeft","isRight"],"mappings":"AAIA;;;;CAIC,GACD;;;;+BAAgBA;;;;;;AAAT,2BAA2BC,WAAkB,EAAEC,gBAA6B;IACjF,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,EAAE,GAAGJ;IACvD,MAAMK,UAAUN,WAAW,CAAC,EAAE,GAAGE,OAAO,CAAC,EAAE;IAC3C,MAAMK,UAAUP,WAAW,CAAC,EAAE,GAAGK,UAAU,CAAC,EAAE;IAC9C,MAAMG,SAASR,WAAW,CAAC,EAAE,GAAGE,OAAO,CAAC,EAAE;IAC1C,MAAMO,UAAUT,WAAW,CAAC,EAAE,GAAGG,QAAQ,CAAC,EAAE;IAE5C,IAAIG,SAAS;QACX,IAAIE,QAAQ;YACV,OAAO;gBAACR;gBAAaK;gBAAYH;gBAASC;aAAS;QACrD;QAEA,IAAIM,SAAS;YACX,OAAO;gBAACT;gBAAaE;gBAASC;gBAAUC;aAAY;QACtD;QAEA,OAAO;YAACJ;YAAaE;YAASC;SAAS;IACzC;IAEA,IAAII,SAAS;QACX,IAAIC,QAAQ;YACV,OAAO;gBAACR;gBAAaE;gBAASG;gBAAYD;aAAY;QACxD;QAEA,IAAIK,SAAS;YACX,OAAO;gBAACT;gBAAaG;gBAAUC;gBAAaC;aAAW;QACzD;QAEA,OAAO;YAACL;YAAaI;YAAaC;SAAW;IAC/C;IAEA,IAAIG,QAAQ;QACV,OAAO;YAACR;YAAaK;YAAYH;SAAQ;IAC3C;IAEA,IAAIO,SAAS;QACX,OAAO;YAACT;YAAaG;YAAUC;SAAY;IAC7C;IAEA,OAAO,EAAE;AACX"}