{"version":3,"file":"direction.cjs","names":[],"sources":["../../src/core/direction.ts"],"sourcesContent":["/**\n * Resolves the effective text direction for an element.\n *\n * The closest ancestor with an explicit `dir=\"ltr\"` or `dir=\"rtl\"` attribute wins — this\n * supports locally-scoped RTL sections (e.g. a single `dir=\"rtl\"` panel inside an otherwise\n * LTR page). When no explicit `dir` attribute is found up the tree, falls back to the\n * computed `direction` CSS property (e.g. set via a `direction: rtl` style rule with no\n * `dir` attribute). Defaults to `'ltr'` when `el` is `null`.\n */\nexport function elementDirection(el: Element | null): 'ltr' | 'rtl' {\n  let node: Element | null = el;\n\n  while (node) {\n    const dir = node.getAttribute('dir');\n\n    if (dir === 'rtl' || dir === 'ltr') return dir;\n\n    node = node.parentElement;\n  }\n\n  return el !== null && getComputedStyle(el).direction === 'rtl' ? 'rtl' : 'ltr';\n}\n"],"mappings":"AASA,SAAgB,EAAiB,EAAmC,CAClE,IAAI,EAAuB,EAE3B,KAAO,GAAM,CACX,IAAM,EAAM,EAAK,aAAa,KAAK,EAEnC,GAAI,IAAQ,OAAS,IAAQ,MAAO,OAAO,EAE3C,EAAO,EAAK,aACd,CAEA,OAAO,IAAO,MAAQ,iBAAiB,CAAE,CAAC,CAAC,YAAc,MAAQ,MAAQ,KAC3E"}