{"version":3,"names":["getOffset","element","prop","axis","styles","getComputedStyle","propAxis","Number","parseFloat"],"sources":["get-offset.ts"],"sourcesContent":["/**\n * Returns the total inline or block offset (margin / padding) of an\n * element in CSS pixels. Used by scroll-area to compute the effective\n * inner size of viewports without being tripped up by Safari's RTL\n * margin-inline-end bug — on Safari we assume symmetry and double the\n * start value instead of summing start + end.\n */\nexport function getOffset(\n\telement: Element | null,\n\tprop: \"margin\" | \"padding\",\n\taxis: \"x\" | \"y\",\n): number {\n\tif (!element) {\n\t\treturn 0;\n\t}\n\n\tconst styles = getComputedStyle(element);\n\tconst propAxis = axis === \"x\" ? \"Inline\" : \"Block\";\n\n\t// Safari misreports `marginInlineEnd` in RTL.\n\t// We have to assume the start/end values are symmetrical, which is likely.\n\tif (axis === \"x\" && prop === \"margin\") {\n\t\treturn Number.parseFloat(styles[`${prop}InlineStart`]) * 2;\n\t}\n\n\treturn (\n\t\tNumber.parseFloat(styles[`${prop}${propAxis}Start`]) +\n\t\tNumber.parseFloat(styles[`${prop}${propAxis}End`])\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,SAASA,CACxBC,OAAuB,EACvBC,IAA0B,EAC1BC,IAAe,EACN;EACT,IAAI,CAACF,OAAO,EAAE;IACb,OAAO,CAAC;EACT;EAEA,MAAMG,MAAM,GAAGC,gBAAgB,CAACJ,OAAO,CAAC;EACxC,MAAMK,QAAQ,GAAGH,IAAI,KAAK,GAAG,GAAG,QAAQ,GAAG,OAAO;;EAElD;EACA;EACA,IAAIA,IAAI,KAAK,GAAG,IAAID,IAAI,KAAK,QAAQ,EAAE;IACtC,OAAOK,MAAM,CAACC,UAAU,CAACJ,MAAM,CAAC,GAAGF,IAAI,aAAa,CAAC,CAAC,GAAG,CAAC;EAC3D;EAEA,OACCK,MAAM,CAACC,UAAU,CAACJ,MAAM,CAAC,GAAGF,IAAI,GAAGI,QAAQ,OAAO,CAAC,CAAC,GACpDC,MAAM,CAACC,UAAU,CAACJ,MAAM,CAAC,GAAGF,IAAI,GAAGI,QAAQ,KAAK,CAAC,CAAC;AAEpD","ignoreList":[]}