"use strict";const f=require("./utils-Bv1frUk6.cjs.js"),v=require("./platform-BDLy2vDY.cjs.js"),l=require("react"),g=require("./SSRProvider-DZRLwxPS.cjs.js");function E(e){return e.pointerType===""&&e.isTrusted?!0:v.$c87311424ea30a05$export$a11b0059900ceec8()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function M(e){return!v.$c87311424ea30a05$export$a11b0059900ceec8()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}let o=null,i=new Set,c=new Map,d=!1,p=!1;const k={Tab:!0,Escape:!0};function u(e,r){for(let t of i)t(e,r)}function H(e){return!(e.metaKey||!v.$c87311424ea30a05$export$9ac100e40613ea10()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function $(e){d=!0,H(e)&&(o="keyboard",u("keyboard",e))}function a(e){o="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(d=!0,u("pointer",e))}function m(e){E(e)&&(d=!0,o="virtual")}function y(e){e.target===window||e.target===document||f.$8a9cb279dc87e130$export$fda7da73ab5d4c48||!e.isTrusted||(!d&&!p&&(o="virtual",u("virtual",e)),d=!1,p=!1)}function L(){f.$8a9cb279dc87e130$export$fda7da73ab5d4c48||(d=!1,p=!0)}function x(e){if(typeof window>"u"||typeof document>"u"||c.get(f.$431fbd86ca7dc216$export$f21a1ffae260145a(e)))return;const r=f.$431fbd86ca7dc216$export$f21a1ffae260145a(e),t=f.$431fbd86ca7dc216$export$b204af158042fbac(e);let n=r.HTMLElement.prototype.focus;r.HTMLElement.prototype.focus=function(){d=!0,n.apply(this,arguments)},t.addEventListener("keydown",$,!0),t.addEventListener("keyup",$,!0),t.addEventListener("click",m,!0),r.addEventListener("focus",y,!0),r.addEventListener("blur",L,!1),typeof PointerEvent<"u"?(t.addEventListener("pointerdown",a,!0),t.addEventListener("pointermove",a,!0),t.addEventListener("pointerup",a,!0)):process.env.NODE_ENV==="test"&&(t.addEventListener("mousedown",a,!0),t.addEventListener("mousemove",a,!0),t.addEventListener("mouseup",a,!0)),r.addEventListener("beforeunload",()=>{S(e)},{once:!0}),c.set(r,{focus:n})}const S=(e,r)=>{const t=f.$431fbd86ca7dc216$export$f21a1ffae260145a(e),n=f.$431fbd86ca7dc216$export$b204af158042fbac(e);r&&n.removeEventListener("DOMContentLoaded",r),c.has(t)&&(t.HTMLElement.prototype.focus=c.get(t).focus,n.removeEventListener("keydown",$,!0),n.removeEventListener("keyup",$,!0),n.removeEventListener("click",m,!0),t.removeEventListener("focus",y,!0),t.removeEventListener("blur",L,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",a,!0),n.removeEventListener("pointermove",a,!0),n.removeEventListener("pointerup",a,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",a,!0),n.removeEventListener("mousemove",a,!0),n.removeEventListener("mouseup",a,!0)),c.delete(t))};function w(){return o!=="pointer"}function I(){return o}function K(e){o=e,u(e,null)}function O(){x();let[e,r]=l.useState(o);return l.useEffect(()=>{let t=()=>{r(o)};return i.add(t),()=>{i.delete(t)}},[]),g.$b5e257d569688ac6$export$535bd6ca7f90a273()?null:e}const C=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function F(e,r,t){let n=f.$431fbd86ca7dc216$export$b204af158042fbac(t?.target);const b=typeof window<"u"?f.$431fbd86ca7dc216$export$f21a1ffae260145a(t?.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?f.$431fbd86ca7dc216$export$f21a1ffae260145a(t?.target).HTMLTextAreaElement:HTMLTextAreaElement,T=typeof window<"u"?f.$431fbd86ca7dc216$export$f21a1ffae260145a(t?.target).HTMLElement:HTMLElement,h=typeof window<"u"?f.$431fbd86ca7dc216$export$f21a1ffae260145a(t?.target).KeyboardEvent:KeyboardEvent;return e=e||n.activeElement instanceof b&&!C.has(n.activeElement.type)||n.activeElement instanceof s||n.activeElement instanceof T&&n.activeElement.isContentEditable,!(e&&r==="keyboard"&&t instanceof h&&!k[t.key])}function j(e,r,t){x(),l.useEffect(()=>{let n=(b,s)=>{F(!!t?.isTextInput,b,s)&&e(w())};return i.add(n),()=>{i.delete(n)}},r)}exports.$507fabe10e71c6fb$export$630ff653c5ada6a9=I;exports.$507fabe10e71c6fb$export$8397ddfc504fdb9a=K;exports.$507fabe10e71c6fb$export$98e20ec92f614cfe=O;exports.$507fabe10e71c6fb$export$b9b3dfddab17db27=w;exports.$507fabe10e71c6fb$export$ec71b4b83ac08ec3=j;exports.$6a7db85432448f7f$export$29bf1b5f2c56cf63=M;exports.$6a7db85432448f7f$export$60278871457622de=E;
//# sourceMappingURL=useFocusVisible-DfE3Z6QO.cjs.js.map
