{"version":3,"file":"index-Bl-WJHvp.mjs","sources":["../../node_modules/@radix-ui/primitive/dist/index.mjs"],"sourcesContent":["// src/primitive.tsx\nvar canUseDOM = !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n  return function handleEvent(event) {\n    originalEventHandler?.(event);\n    if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n      return ourEventHandler?.(event);\n    }\n  };\n}\nfunction getOwnerWindow(element) {\n  if (!canUseDOM) {\n    throw new Error(\"Cannot access window outside of the DOM\");\n  }\n  return element?.ownerDocument?.defaultView ?? window;\n}\nfunction getOwnerDocument(element) {\n  if (!canUseDOM) {\n    throw new Error(\"Cannot access document outside of the DOM\");\n  }\n  return element?.ownerDocument ?? document;\n}\nfunction getActiveElement(node, activeDescendant = false) {\n  const { activeElement } = getOwnerDocument(node);\n  if (!activeElement?.nodeName) {\n    return null;\n  }\n  if (isFrame(activeElement) && activeElement.contentDocument) {\n    return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n  }\n  if (activeDescendant) {\n    const id = activeElement.getAttribute(\"aria-activedescendant\");\n    if (id) {\n      const element = getOwnerDocument(activeElement).getElementById(id);\n      if (element) {\n        return element;\n      }\n    }\n  }\n  return activeElement;\n}\nfunction isFrame(element) {\n  return element.tagName === \"IFRAME\";\n}\nexport {\n  canUseDOM,\n  composeEventHandlers,\n  getActiveElement,\n  getOwnerDocument,\n  getOwnerWindow,\n  isFrame\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";AAUO,SAAS,oBAAA,CACd,oBAAA,EACA,eAAA,EACA,EAAE,wBAAA,GAA2B,IAAA,EAAK,GAAI,EAAC,EACvC;IACA,OAAO,SAAS,WAAA,CAAY,KAAA,EAAU;AACpC,QAAA,oBAAA,GAAuB,KAAK,CAAA;AAE5B,QAAA,IAAI,wBAAA,KAA6B,KAAA,IAAS,CAAC,KAAA,CAAM,gBAAA,EAAkB;AACjE,YAAA,OAAO,kBAAkB,KAAK,CAAA;AAChC,QAAA;AACF,IAAA,CAAA;AACF;;;;","x_google_ignoreList":[0]}