Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/dom-utils

Package Overview
Dependencies
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/dom-utils - npm Package Compare versions

Comparing version 0.0.0-dev-20220412212252 to 0.0.0-dev-20220413091534

2

dist/index.js

@@ -1,2 +0,2 @@

var Ee=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var lt=(e,t)=>{for(var n in t)Ee(e,n,{get:t[n],enumerable:!0})},ct=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of st(t))!at.call(e,o)&&o!==n&&Ee(e,o,{get:()=>t[o],enumerable:!(r=it(t,o))||r.enumerable});return e};var ut=e=>ct(Ee({},"__esModule",{value:!0}),e);var bn={};lt(bn,{MAX_Z_INDEX:()=>Qn,addDomEvent:()=>y,addPointerEvent:()=>V,addPointerlockChangeListener:()=>tt,addPointerlockErrorListener:()=>nt,ariaAttr:()=>dt,autoResizeInput:()=>Et,contains:()=>Kt,copyVisualStyles:()=>ye,createLiveRegion:()=>tn,dataAttr:()=>ft,disableTextSelection:()=>Oe,dispatchInputCheckedEvent:()=>jt,dispatchInputValueEvent:()=>_t,extractClientInfo:()=>Pt,extractInfo:()=>be,findByText:()=>ln,focusableSelector:()=>Pe,forceReflow:()=>pt,getClosestFormElement:()=>$e,getComputedStyle:()=>I,getDocumentElement:()=>Ft,getEventKey:()=>Qt,getEventName:()=>Ne,getEventStep:()=>en,getEventWindow:()=>Wt,getFocusables:()=>Ue,getNativeEvent:()=>Nt,getNodeName:()=>ie,getOwnerDocument:()=>F,getOwnerWindow:()=>M,getParent:()=>se,getPointerlockElement:()=>mn,getScrollOffset:()=>zt,getScrollParent:()=>q,getScrollParents:()=>qe,getTabbables:()=>Ut,indexOfId:()=>Ae,isDisabled:()=>ae,isFocusable:()=>ke,isHTMLElement:()=>L,isHidden:()=>le,isScrollParent:()=>Me,isTabbable:()=>Xe,isWindow:()=>j,itemById:()=>Ge,nextById:()=>Je,nextTick:()=>B,observeAttributes:()=>nn,observeChildren:()=>on,observeElementRect:()=>yn,prevById:()=>an,preventBodyPointerEvents:()=>Rt,preventBodyScroll:()=>Bt,query:()=>sn,queryAll:()=>rn,raf:()=>ve,requestPointerLock:()=>En,restoreTextSelection:()=>et,setVisuallyHidden:()=>Se,sortByTreeOrder:()=>cn,trackDocumentVisibility:()=>hn,trackFormReset:()=>$t,trackInputPropertyMutation:()=>qt,trackPointerDown:()=>un,trackPointerMove:()=>fn,validateBlur:()=>Yt,visuallyHiddenStyle:()=>Qe,waitFor:()=>gn,waitForEvent:()=>wn});module.exports=ut(bn);var ft=e=>e?"":void 0,dt=e=>e?!0:void 0;var Ve=new WeakMap;function I(e){var n;if(!e)return{};let t=Ve.get(e);return t||(t=((n=e==null?void 0:e.ownerDocument.defaultView)!=null?n:window).getComputedStyle(e),Ve.set(e,t)),t}function ye(e,t){if(!e)return;let n=I(e),r="box-sizing:"+n.boxSizing+";border-left:"+n.borderLeftWidth+" solid red;border-right:"+n.borderRightWidth+" solid red;font-family:"+n.fontFamily+";font-feature-settings:"+n.fontFeatureSettings+";font-kerning:"+n.fontKerning+";font-size:"+n.fontSize+";font-stretch:"+n.fontStretch+";font-style:"+n.fontStyle+";font-variant:"+n.fontVariant+";font-variant-caps:"+n.fontVariantCaps+";font-variant-ligatures:"+n.fontVariantLigatures+";font-variant-numeric:"+n.fontVariantNumeric+";font-weight:"+n.fontWeight+";letter-spacing:"+n.letterSpacing+";margin-left:"+n.marginLeft+";margin-right:"+n.marginRight+";padding-left:"+n.paddingLeft+";padding-right:"+n.paddingRight+";text-indent:"+n.textIndent+";text-transform:"+n.textTransform;t.style.cssText+=r}function B(e){let t=new Set;function n(r){let o=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(o))}return n(()=>n(e)),function(){t.forEach(function(o){o()})}}function ve(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}function pt(){return document.body.offsetHeight}function mt(e){var t=e.createElement("div");return t.id="ghost",t.style.cssText="display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;",e.body.appendChild(t),t}function Et(e){var o;if(!e)return;let t=(o=e.ownerDocument)!=null?o:document,n=mt(t);ye(e,n);function r(){ve(()=>{n.innerHTML=e.value;let i=getComputedStyle(n);e==null||e.style.setProperty("width",i.width)})}return r(),e==null||e.addEventListener("input",r),e==null||e.addEventListener("change",r),()=>{t.body.removeChild(n),e==null||e.removeEventListener("input",r),e==null||e.removeEventListener("change",r)}}var Fe=e=>e,D=()=>{},x=(...e)=>t=>e.reduce((n,r)=>r(n),t);var Sn=(()=>{let e=0;return()=>(e++,e.toString(36))})();var he=e=>ge()&&e.test(navigator.platform);var ge=()=>typeof window<"u",yt=()=>he(/^Mac/),vt=()=>he(/^iPhone/),ht=()=>he(/^iPad/)||yt()&&navigator.maxTouchPoints>1,_=()=>vt()||ht();var gt=e=>Array.isArray(e);var wt=e=>!(e==null||typeof e!="object"||gt(e));var We=e=>wt(e)&&"button"in e;var ne=e=>e.button===0;var O=new Map,b=new Map;function Ke(e,t,n,r){var l;if(!e)return D;let o=JSON.stringify({type:t,options:r}),i=O.get(e);if(O.has(e))i!=null&&i.has(o)?(l=i==null?void 0:i.get(o))==null||l.add(n):i==null||i.set(o,new Set([n]));else{let u=new Map([[o,new Set([n])]]);O.set(e,u)}function s(u){var d,a;function c(m){var p;let E=O.get(u);(p=E==null?void 0:E.get(o))==null||p.forEach(w=>w(m))}if(!(b!=null&&b.has(u))){b.set(u,new Map([[o,c]])),u.addEventListener(t,c,r);return}(d=b==null?void 0:b.get(u))!=null&&d.has(o)||((a=b.get(u))==null||a.set(o,c),u.addEventListener(t,c,r))}return s(e),function(){var d,a,m,E;if(!O.has(e))return;let c=O.get(e);if((d=c==null?void 0:c.get(o))==null||d.delete(n),((a=c==null?void 0:c.get(o))==null?void 0:a.size)===0){let p=(m=b.get(e))==null?void 0:m.get(o);e.removeEventListener(t,p,r),c==null||c.delete(o),(E=b.get(e))==null||E.delete(o),(c==null?void 0:c.size)===0&&(O.delete(e),b.delete(e))}}}var we=e=>Object.prototype.toString.call(e).slice(8,-1),bt=e=>we(e)==="Object"&&"current"in e,Tt=e=>we(e)==="Function"?e():e,xt=e=>we(e)==="Object"&&!!e.touches,Lt={pageX:0,pageY:0,clientX:0,clientY:0};function be(e,t="page"){let n=xt(e)?e.touches[0]||e.changedTouches[0]||Lt:e;return{point:{x:n[`${t}X`],y:n[`${t}Y`]}}}function y(e,t,n,r){let o=bt(e)?e.current:Tt(e);return Ke(o,t,n,r)}function V(e,t,n,r){var i;let o=(i=Ne(t))!=null?i:t;return y(e,o,Mt(n,t==="pointerdown"),r)}function Mt(e,t=!1){let n=r=>{e(r,be(r))};return t?Ht(n):n}function Ht(e){return t=>{var i;let n=(i=t.view)!=null?i:window,r=t instanceof n.MouseEvent;(!r||r&&t.button===0)&&e(t)}}function Pt(e){return be(e,"client")}var kt=()=>typeof window!="undefined"&&window.onpointerdown===null,St=()=>typeof window!="undefined"&&window.ontouchstart===null,At=()=>typeof window!="undefined"&&window.onmousedown===null,Dt={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},Ot={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function Ne(e){return kt()?e:St()?Ot[e]:At()?Dt[e]:e}var oe=0,ze;function Rt(e,t={}){let{disabled:n=!1,document:r}=t,o=r||document,i=!1,s=!1;function l(){let a=E=>{let p=E.pointerType==="mouse";i=!p,s=p&&ne(E)},m=()=>{i=!1,s=!1};return x(y(o,"pointerdown",a),y(o,"pointerup",m))}function u(){oe--,oe===0&&(o.body.style.pointerEvents=ze),e&&(e.style.pointerEvents="")}function c(){if(!n)return oe===0&&(ze=o.body.style.pointerEvents),o.body.style.pointerEvents="none",e&&(e.style.pointerEvents="auto"),oe++,function(){i?y(o,"click",u,{once:!0}):s?y(o,"pointerup",u,{once:!0}):u()}}let d=[];return d.push(c()),B(()=>{d.push(l())}),function(){d.forEach(a=>a==null?void 0:a())}}function Be(e){return typeof e=="object"&&e!=null&&e.nodeType===1}function _e(e,t){return(!t||e!=="hidden")&&e!=="visible"&&e!=="clip"}function Te(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return _e(n.overflowY,t)||_e(n.overflowX,t)||function(r){var o=function(i){if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}}(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)}(e)}return!1}function re(e,t,n,r,o,i,s,l){return i<e&&s>t||i>e&&s<t?0:i<=e&&l<=n||s>=t&&l>=n?i-e-r:s>t&&l<n||i<e&&l>n?s-t+o:0}function xe(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,s=t.boundary,l=t.skipOverflowHiddenElements,u=typeof s=="function"?s:function(rt){return rt!==s};if(!Be(e))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,d=[],a=e;Be(a)&&u(a);){if((a=a.parentElement)===c){d.push(a);break}a!=null&&a===document.body&&Te(a)&&!Te(document.documentElement)||a!=null&&Te(a,l)&&d.push(a)}for(var m=n.visualViewport?n.visualViewport.width:innerWidth,E=n.visualViewport?n.visualViewport.height:innerHeight,p=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,T=e.getBoundingClientRect(),H=T.height,P=T.width,k=T.top,K=T.right,N=T.bottom,v=T.left,f=o==="start"||o==="nearest"?k:o==="end"?N:k+H/2,h=i==="center"?v+P/2:i==="end"?K:v,z=[],ue=0;ue<d.length;ue++){var g=d[ue],C=g.getBoundingClientRect(),fe=C.height,de=C.width,U=C.top,pe=C.right,me=C.bottom,X=C.left;if(r==="if-needed"&&k>=0&&v>=0&&N<=E&&K<=m&&k>=U&&N<=me&&v>=X&&K<=pe)return z;var $=getComputedStyle(g),Z=parseInt($.borderLeftWidth,10),Q=parseInt($.borderTopWidth,10),G=parseInt($.borderRightWidth,10),J=parseInt($.borderBottomWidth,10),S=0,A=0,ee="offsetWidth"in g?g.offsetWidth-g.clientWidth-Z-G:0,te="offsetHeight"in g?g.offsetHeight-g.clientHeight-Q-J:0;if(c===g)S=o==="start"?f:o==="end"?f-E:o==="nearest"?re(w,w+E,E,Q,J,w+f,w+f+H,H):f-E/2,A=i==="start"?h:i==="center"?h-m/2:i==="end"?h-m:re(p,p+m,m,Z,G,p+h,p+h+P,P),S=Math.max(0,S+w),A=Math.max(0,A+p);else{S=o==="start"?f-U-Q:o==="end"?f-me+J+te:o==="nearest"?re(U,me,fe,Q,J+te,f,f+H,H):f-(U+fe/2)+te/2,A=i==="start"?h-X-Z:i==="center"?h-(X+de/2)+ee/2:i==="end"?h-pe+G+ee:re(X,pe,de,Z,G+ee,h,h+P,P);var Ce=g.scrollLeft,Ie=g.scrollTop;f+=Ie-(S=Math.max(0,Math.min(Ie+S,g.scrollHeight-fe+te))),h+=Ce-(A=Math.max(0,Math.min(Ce+A,g.scrollWidth-de+ee)))}z.push({el:g,top:S,left:A})}return z}function je(e){return e===Object(e)&&Object.keys(e).length!==0}function Ct(e,t){t===void 0&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scroll&&n?o.scroll({top:i,left:s,behavior:t}):(o.scrollTop=i,o.scrollLeft=s)})}function It(e){return e===!1?{block:"end",inline:"nearest"}:je(e)?e:{block:"start",inline:"nearest"}}function Vt(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(je(t)&&typeof t.behavior=="function")return t.behavior(n?xe(e,t):[]);if(!!n){var r=It(t);return Ct(xe(e,r),r.behavior)}}var Le=Vt;function F(e){var t;return j(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function M(e){var t;return(t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window}function Ft(e){return F(e).documentElement}function ie(e){return j(e)?"":e&&e.localName||""}function Wt(e){if(e.view)return e.view;let t=e.currentTarget;return t!=null?M(t):window}function se(e){let t=F(e);return ie(e)==="html"?e:e.assignedSlot||e.parentElement||t.documentElement}function Kt(e,t){return e?e===t||L(e)&&L(t)&&e.contains(t):!1}function L(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}function j(e){return(e==null?void 0:e.toString())==="[object Window]"}var ae=e=>(e==null?void 0:e.getAttribute("disabled"))!=null||!!(e!=null&&e.getAttribute("aria-disabled"));function Nt(e){var t;return(t=e.nativeEvent)!=null?t:e}function Me(e){let{overflow:t,overflowX:n,overflowY:r}=I(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function q(e){return["html","body","#document"].includes(ie(e))?F(e).body:L(e)&&Me(e)?e:q(se(e))}function qe(e,t=[]){let n=q(e),r=n===F(e).body,o=M(n),i=r?[o].concat(o.visualViewport||[],Me(n)?n:[]):n,s=t.concat(i);return r?s:s.concat(qe(se(i)))}function zt(e){return j(e)?{scrollLeft:e.scrollX,scrollTop:e.scrollY}:{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}var Ye=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Bt(e){var d;let{document:t,disabled:n=!1,allowPinchZoom:r}=e!=null?e:{},o=t!=null?t:document,i=(d=o==null?void 0:o.defaultView)!=null?d:window,s=ge()?i.visualViewport:null,l=o.documentElement;function u(){let a=x(Y(l,"paddingRight",`${i.innerWidth-l.clientWidth}px`),Y(l,"overflow","hidden"));return()=>a==null?void 0:a()}function c(){let a,m=0,E=v=>{a=q(v.target),!(a===l&&a===o.body)&&(m=v.changedTouches[0].pageY)},p=v=>{if(v.touches.length===2&&r)return;if(!a||a===l||a===o.body){v.preventDefault();return}let f=v.changedTouches[0].pageY,h=a.scrollTop,z=a.scrollHeight-a.clientHeight;(h<=0&&f>m||h>=z&&f<m)&&v.preventDefault(),m=f},w=v=>{let f=v.target;f instanceof i.HTMLInputElement&&!Ye.has(f.type)&&(v.preventDefault(),f.style.transform="translateY(-2000px)",f.focus(),i.requestAnimationFrame(()=>{f.style.transform=""}))},T=v=>{let f=v.target;f instanceof i.HTMLInputElement&&!Ye.has(f.type)&&(f.style.transform="translateY(-2000px)",i.requestAnimationFrame(()=>{f.style.transform="",s&&(s.height<i.innerHeight?i.requestAnimationFrame(function(){Le(f,{scrollMode:"if-needed"})}):y(s,"resize",()=>{Le(f,{scrollMode:"if-needed"})},{once:!0}))}))},H=()=>{i.scrollTo(0,0)},P=i.scrollX,k=i.scrollY,K=x(Y(l,"paddingRight",`${i.innerWidth-l.clientWidth}px`),Y(l,"overflow","hidden"),Y(o.body,"marginTop",`-${k}px`));i.scrollTo(0,0);let N=x(y(o,"touchstart",E,{passive:!1,capture:!0}),y(o,"touchmove",p,{passive:!1,capture:!0}),y(o,"touchend",w,{passive:!1,capture:!0}),y(o,"focus",T,!0),y(i,"scroll",H));return()=>{K(),N(),i.scrollTo(P,k)}}return n?D:_()?c():u()}function Y(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}var Qn=2147483647;function He(e,t){var l;let{type:n,property:r}=t,s=M(e)[n==="input"?"HTMLInputElement":"HTMLTextAreaElement"].prototype;return(l=Object.getOwnPropertyDescriptor(s,r))!=null?l:{}}function _t(e,t){var i;let n=M(e);if(!(e instanceof n.HTMLInputElement))return;(i=He(e,{type:"input",property:"value"}).set)==null||i.call(e,t);let o=new n.Event("input",{bubbles:!0});e.dispatchEvent(o)}function jt(e,t){var i;let n=M(e);if(!(e instanceof n.HTMLInputElement))return;(i=He(e,{type:"input",property:"checked"}).set)==null||i.call(e,t);let o=new n.Event("click",{bubbles:!0});e.dispatchEvent(o)}function qt(e,t){let{fn:n,property:r,type:o}=t;if(!n||!e)return;let{get:i,set:s}=He(e,{property:r,type:o}),l=!0;return Object.defineProperty(e,r,{get(){return i==null?void 0:i.call(this)},set(u){return l&&n(u),s==null?void 0:s.call(this,u)}}),function(){l=!1}}function Yt(e,t){var o;let n=Array.isArray(t.exclude)?t.exclude:[t.exclude],r=(o=e.relatedTarget)!=null?o:t.fallback;return n.every(i=>!(i!=null&&i.contains(r)))}var Pe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");function le(e,t){let n=I(e);if(!e||n.getPropertyValue("visibility")==="hidden")return!0;for(;e;){if(t!=null&&e===t)return!1;if(n.getPropertyValue("display")==="none")return!0;e=e.parentElement}return!1}var Ue=(e,t=!1)=>{if(!e)return[];let n=Array.from(e.querySelectorAll(Pe));return t&&L(e)&&n.unshift(e),n.filter(r=>ke(r)&&!le(r))},ke=e=>!L(e)||le(e)||ae(e)?!1:e==null?void 0:e.matches(Pe),Ut=(e,t=!1)=>Ue(e,t).filter(Xe),Xe=e=>ke(e)&&!ae(e)&&!le(e);function $e(e){return Xt(e)?e.form:e.closest("form")}function Xt(e){return["textarea","input","select","button"].includes(e.localName)}function $t(e,t){if(!e)return;let n=$e(e);return n==null||n.addEventListener("reset",t,{passive:!0}),()=>{n==null||n.removeEventListener("reset",t)}}var Ze={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft",Home:"End",End:"Home"},Zt={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"};function Qt(e,t={}){var s;let{dir:n="ltr",orientation:r="horizontal"}=t,{key:o}=e;return o=(s=Zt[o])!=null?s:o,n==="rtl"&&r==="horizontal"&&o in Ze&&(o=Ze[o]),o}var Gt=new Set(["PageUp","PageDown"]),Jt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function en(e){return e.ctrlKey||e.metaKey?.1:Gt.has(e.key)||e.shiftKey&&Jt.has(e.key)?10:1}var Qe={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function Se(e){Object.assign(e.style,Qe)}function tn(e={}){var d;let{level:t="polite",doc:n,root:r,delay:o=0}=e,i=n!=null?n:document,s=(d=i.defaultView)!=null?d:window,l=r!=null?r:i.body;function u(a,m){let E=i.getElementById("__live-region__");E&&l.removeChild(E),m=m!=null?m:o;let p=i.createElement("span");p.id="__live-region__";var w=t!=="assertive"?"status":"alert";p.setAttribute("aria-live",t),p.setAttribute("role",w),Se(p),l.appendChild(p),s.setTimeout(()=>{p.textContent=a},m)}function c(){let a=i.getElementById("__live-region__");a&&l.removeChild(a)}return{announce:u,destroy:c}}function nn(e,t,n){if(!e)return D;let r=Array.isArray(t)?t:[t],o=e.ownerDocument.defaultView||window,i=new o.MutationObserver(s=>{for(let l of s)l.type==="attributes"&&l.attributeName&&r.includes(l.attributeName)&&n(l)});return i.observe(e,{attributes:!0,attributeFilter:r}),()=>i.disconnect()}function on(e,t,n=!1){if(!e)return D;let r=e.ownerDocument.defaultView||window,o=new r.MutationObserver(i=>{for(let s of i)s.type==="childList"&&t(s)});return o.observe(e,{childList:!0,subtree:n}),()=>o.disconnect()}function rn(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function sn(e,t){return e==null?void 0:e.querySelector(t)}function Ge(e,t){return e.find(n=>n.id===t)}function Ae(e,t){let n=Ge(e,t);return n?e.indexOf(n):-1}function Je(e,t,n=!0){let r=Ae(e,t);return r=n?(r+1)%e.length:Math.min(r+1,e.length-1),e[r]}function an(e,t,n=!0){let r=Ae(e,t);return r===-1?n?e[e.length-1]:null:(r=n?(r-1+e.length)%e.length:Math.max(0,r-1),e[r])}function ln(e,t,n){let r=e.filter(o=>{var s;let i=(s=o.dataset.valuetext)!=null?s:o.textContent;return!!(i!=null&&i.toLowerCase().startsWith(t.toLowerCase()))});return n?Je(r,n):null}function cn(e){return e.sort((t,n)=>t.compareDocumentPosition(n)&2?1:-1)}var W="default",De="",ce=new WeakMap;function Oe({target:e,doc:t}={}){let n=t!=null?t:document;return _()?(W==="default"&&(De=n.documentElement.style.webkitUserSelect,n.documentElement.style.webkitUserSelect="none"),W="disabled"):e&&(ce.set(e,e.style.userSelect),e.style.userSelect="none"),()=>et({target:e,doc:n})}function et({target:e,doc:t}={}){let n=t!=null?t:document;if(_()){if(W!=="disabled")return;W="restoring",setTimeout(()=>{B(()=>{W==="restoring"&&(n.documentElement.style.webkitUserSelect==="none"&&(n.documentElement.style.webkitUserSelect=De||""),De="",W="default")})},300)}else if(e&&ce.has(e)){let r=ce.get(e);e.style.userSelect==="none"&&(e.style.userSelect=r!=null?r:""),e.getAttribute("style")===""&&e.removeAttribute("style"),ce.delete(e)}}function un(e,t){var o;let n=(o=e.defaultView)!=null?o:window;return y(e,"pointerdown",i=>{i.target instanceof n.HTMLElement&&t(i.target)})}function fn(e){let{onPointerMove:t,onPointerUp:n,ctx:r}=e,{doc:o=document,threshold:i=5}=r;return x(V(o,"pointermove",(l,u)=>{let{point:c}=u;if(!(Math.sqrt(c.x**2+c.y**2)<i)){if(We(l)&&ne(l)){n();return}t(u,l)}},!1),V(o,"pointerup",n,!1),V(o,"pointercancel",n,!1),V(o,"contextmenu",n,!1),Oe({doc:o}))}function tt(e,t){return e.addEventListener("webkitpointerlockchange",t,!1),e.addEventListener("mozpointerlockchange",t,!1),e.addEventListener("pointerlockchange",t,!1),function(){e.removeEventListener("mozpointerlockchange",t,!1),e.removeEventListener("pointerlockchange",t,!1)}}function nt(e,t){return e.addEventListener("webkitpointerlockerror",t,!1),e.addEventListener("mozpointerlockerror",t,!1),e.addEventListener("pointerlockerror",t,!1),function(){e.removeEventListener("webkitpointerlockerror",t,!1),e.removeEventListener("mozpointerlockerror",t,!1),e.removeEventListener("pointerlockerror",t,!1)}}function dn(e){return e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock}function pn(e){return e.exitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock}function mn(e){return e.pointerLockElement||e.mozPointerLockElement||e.webkitPointerLockElement}function En(e,t={}){let{onPointerLock:n,onPointerUnlock:r}=t,o=e.body;function i(){return"pointerLockElement"in e||"mozPointerLockElement"in e||"webkitPointerLockElement"in e}function s(){return!!e.pointerLockElement}function l(){s()?n==null||n():r==null||r()}function u(p){s()&&(r==null||r()),console.error("PointerLock error occured:",p),c()}function c(){e.exitPointerLock=pn(e),e.exitPointerLock()}let d=new Set;function a(){d.add(tt(e,l)),d.add(nt(e,u))}function m(){!i()||(d.forEach(p=>p()),d.clear(),c())}function E(){!i()||(o.requestPointerLock=dn(o),o.requestPointerLock(),a())}return E(),m}var R=new Map;function yn(e,t){let n=R.get(e);return n?(n.callbacks.push(t),t(e.getBoundingClientRect())):(R.set(e,{rect:{},callbacks:[t]}),R.size===1&&(Re=requestAnimationFrame(ot))),function(){let o=R.get(e);if(!o)return;let i=o.callbacks.indexOf(t);i>-1&&o.callbacks.splice(i,1),o.callbacks.length===0&&(R.delete(e),R.size===0&&cancelAnimationFrame(Re))}}var Re;function ot(){let e=[];R.forEach((t,n)=>{let r=n.getBoundingClientRect();vn(t.rect,r)||(t.rect=r,e.push(t))}),e.forEach(t=>{t.callbacks.forEach(n=>n(t.rect))}),Re=requestAnimationFrame(ot)}function vn(e,t){return e.width===t.width&&e.height===t.height&&e.top===t.top&&e.right===t.right&&e.bottom===t.bottom&&e.left===t.left}function hn(e,t){let n=Fe(e);return y(n,"visibilitychange",()=>{let r=n.hidden||n.msHidden||n.webkitHidden;t(!!r)})}function gn(e){let t=e();return t?Promise.resolve(t):new Promise(n=>{let r=globalThis.setInterval(function(){let o=e();o&&(globalThis.clearInterval(r),n(o))},0)})}function wn(e,t){return new Promise(n=>{function r(o){o.target===e&&(e.removeEventListener(t,r),n())}e.addEventListener(t,r)})}
var Ee=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var lt=(e,t)=>{for(var n in t)Ee(e,n,{get:t[n],enumerable:!0})},ct=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of st(t))!at.call(e,o)&&o!==n&&Ee(e,o,{get:()=>t[o],enumerable:!(r=it(t,o))||r.enumerable});return e};var ut=e=>ct(Ee({},"__esModule",{value:!0}),e);var bn={};lt(bn,{MAX_Z_INDEX:()=>Qn,addDomEvent:()=>y,addPointerEvent:()=>V,addPointerlockChangeListener:()=>tt,addPointerlockErrorListener:()=>nt,ariaAttr:()=>dt,autoResizeInput:()=>Et,contains:()=>Kt,copyVisualStyles:()=>ye,createLiveRegion:()=>tn,dataAttr:()=>ft,disableTextSelection:()=>Oe,dispatchInputCheckedEvent:()=>jt,dispatchInputValueEvent:()=>_t,extractClientInfo:()=>Pt,extractInfo:()=>be,findByText:()=>ln,focusableSelector:()=>Pe,forceReflow:()=>pt,getClosestFormElement:()=>$e,getComputedStyle:()=>I,getDocumentElement:()=>Ft,getEventKey:()=>Qt,getEventName:()=>Ne,getEventStep:()=>en,getEventWindow:()=>Wt,getFocusables:()=>Ue,getNativeEvent:()=>Nt,getNodeName:()=>ie,getOwnerDocument:()=>F,getOwnerWindow:()=>M,getParent:()=>se,getPointerlockElement:()=>mn,getScrollOffset:()=>zt,getScrollParent:()=>q,getScrollParents:()=>qe,getTabbables:()=>Ut,indexOfId:()=>Ae,isDisabled:()=>ae,isFocusable:()=>ke,isHTMLElement:()=>L,isHidden:()=>le,isScrollParent:()=>Me,isTabbable:()=>Xe,isWindow:()=>j,itemById:()=>Ge,nextById:()=>Je,nextTick:()=>B,observeAttributes:()=>nn,observeChildren:()=>on,observeElementRect:()=>yn,prevById:()=>an,preventBodyPointerEvents:()=>Rt,preventBodyScroll:()=>Bt,query:()=>sn,queryAll:()=>rn,raf:()=>ve,requestPointerLock:()=>En,restoreTextSelection:()=>et,setVisuallyHidden:()=>Se,sortByTreeOrder:()=>cn,trackDocumentVisibility:()=>hn,trackFormReset:()=>$t,trackInputPropertyMutation:()=>qt,trackPointerDown:()=>un,trackPointerMove:()=>fn,validateBlur:()=>Yt,visuallyHiddenStyle:()=>Qe,waitFor:()=>gn,waitForEvent:()=>wn});module.exports=ut(bn);var ft=e=>e?"":void 0,dt=e=>e?!0:void 0;var Ve=new WeakMap;function I(e){var n;if(!e)return{};let t=Ve.get(e);return t||(t=((n=e==null?void 0:e.ownerDocument.defaultView)!=null?n:window).getComputedStyle(e),Ve.set(e,t)),t}function ye(e,t){if(!e)return;let n=I(e),r="box-sizing:"+n.boxSizing+";border-left:"+n.borderLeftWidth+" solid red;border-right:"+n.borderRightWidth+" solid red;font-family:"+n.fontFamily+";font-feature-settings:"+n.fontFeatureSettings+";font-kerning:"+n.fontKerning+";font-size:"+n.fontSize+";font-stretch:"+n.fontStretch+";font-style:"+n.fontStyle+";font-variant:"+n.fontVariant+";font-variant-caps:"+n.fontVariantCaps+";font-variant-ligatures:"+n.fontVariantLigatures+";font-variant-numeric:"+n.fontVariantNumeric+";font-weight:"+n.fontWeight+";letter-spacing:"+n.letterSpacing+";margin-left:"+n.marginLeft+";margin-right:"+n.marginRight+";padding-left:"+n.paddingLeft+";padding-right:"+n.paddingRight+";text-indent:"+n.textIndent+";text-transform:"+n.textTransform;t.style.cssText+=r}function B(e){let t=new Set;function n(r){let o=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(o))}return n(()=>n(e)),function(){t.forEach(function(o){o()})}}function ve(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}function pt(){return document.body.offsetHeight}function mt(e){var t=e.createElement("div");return t.id="ghost",t.style.cssText="display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;",e.body.appendChild(t),t}function Et(e){var o;if(!e)return;let t=(o=e.ownerDocument)!=null?o:document,n=mt(t);ye(e,n);function r(){ve(()=>{n.innerHTML=e.value;let i=getComputedStyle(n);e==null||e.style.setProperty("width",i.width)})}return r(),e==null||e.addEventListener("input",r),e==null||e.addEventListener("change",r),()=>{t.body.removeChild(n),e==null||e.removeEventListener("input",r),e==null||e.removeEventListener("change",r)}}var Fe=e=>e,D=()=>{},x=(...e)=>t=>e.reduce((n,r)=>r(n),t);var Sn=(()=>{let e=0;return()=>(e++,e.toString(36))})();var he=e=>ge()&&e.test(navigator.platform);var ge=()=>typeof window<"u",yt=()=>he(/^Mac/),vt=()=>he(/^iPhone/),ht=()=>he(/^iPad/)||yt()&&navigator.maxTouchPoints>1,_=()=>vt()||ht();var gt=e=>Array.isArray(e);var wt=e=>!(e==null||typeof e!="object"||gt(e));var We=e=>wt(e)&&"button"in e;var ne=e=>e.button===0;var O=new Map,b=new Map;function Ke(e,t,n,r){var l;if(!e)return D;let o=JSON.stringify({type:t,options:r}),i=O.get(e);if(O.has(e))i!=null&&i.has(o)?(l=i==null?void 0:i.get(o))==null||l.add(n):i==null||i.set(o,new Set([n]));else{let u=new Map([[o,new Set([n])]]);O.set(e,u)}function s(u){var d,a;function c(m){var p;let E=O.get(u);(p=E==null?void 0:E.get(o))==null||p.forEach(w=>w(m))}if(!(b!=null&&b.has(u))){b.set(u,new Map([[o,c]])),u.addEventListener(t,c,r);return}(d=b==null?void 0:b.get(u))!=null&&d.has(o)||((a=b.get(u))==null||a.set(o,c),u.addEventListener(t,c,r))}return s(e),function(){var d,a,m,E;if(!O.has(e))return;let c=O.get(e);if((d=c==null?void 0:c.get(o))==null||d.delete(n),((a=c==null?void 0:c.get(o))==null?void 0:a.size)===0){let p=(m=b.get(e))==null?void 0:m.get(o);e.removeEventListener(t,p,r),c==null||c.delete(o),(E=b.get(e))==null||E.delete(o),(c==null?void 0:c.size)===0&&(O.delete(e),b.delete(e))}}}var we=e=>Object.prototype.toString.call(e).slice(8,-1),bt=e=>we(e)==="Object"&&"current"in e,Tt=e=>we(e)==="Function"?e():e,xt=e=>we(e)==="Object"&&!!e.touches,Lt={pageX:0,pageY:0,clientX:0,clientY:0};function be(e,t="page"){let n=xt(e)?e.touches[0]||e.changedTouches[0]||Lt:e;return{point:{x:n[`${t}X`],y:n[`${t}Y`]}}}function y(e,t,n,r){let o=bt(e)?e.current:Tt(e);return Ke(o,t,n,r)}function V(e,t,n,r){var i;let o=(i=Ne(t))!=null?i:t;return y(e,o,Mt(n,t==="pointerdown"),r)}function Mt(e,t=!1){let n=r=>{e(r,be(r))};return t?Ht(n):n}function Ht(e){return t=>{var i;let n=(i=t.view)!=null?i:window,r=t instanceof n.MouseEvent;(!r||r&&t.button===0)&&e(t)}}function Pt(e){return be(e,"client")}var kt=()=>typeof window!="undefined"&&window.onpointerdown===null,St=()=>typeof window!="undefined"&&window.ontouchstart===null,At=()=>typeof window!="undefined"&&window.onmousedown===null,Dt={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},Ot={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function Ne(e){return kt()?e:St()?Ot[e]:At()?Dt[e]:e}var oe=0,ze;function Rt(e,t={}){let{disabled:n=!1,document:r}=t,o=r||document,i=!1,s=!1;function l(){let a=E=>{let p=E.pointerType==="mouse";i=!p,s=p&&ne(E)},m=()=>{i=!1,s=!1};return x(y(o,"pointerdown",a),y(o,"pointerup",m))}function u(){oe--,oe===0&&(o.body.style.pointerEvents=ze),e&&(e.style.pointerEvents="")}function c(){if(!n)return oe===0&&(ze=o.body.style.pointerEvents),o.body.style.pointerEvents="none",e&&(e.style.pointerEvents="auto"),oe++,function(){i?y(o,"click",u,{once:!0}):s?y(o,"pointerup",u,{once:!0}):u()}}let d=[];return d.push(c()),B(()=>{d.push(l())}),function(){d.forEach(a=>a==null?void 0:a())}}function Be(e){return typeof e=="object"&&e!=null&&e.nodeType===1}function _e(e,t){return(!t||e!=="hidden")&&e!=="visible"&&e!=="clip"}function Te(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return _e(n.overflowY,t)||_e(n.overflowX,t)||function(r){var o=function(i){if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}}(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)}(e)}return!1}function re(e,t,n,r,o,i,s,l){return i<e&&s>t||i>e&&s<t?0:i<=e&&l<=n||s>=t&&l>=n?i-e-r:s>t&&l<n||i<e&&l>n?s-t+o:0}function xe(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,s=t.boundary,l=t.skipOverflowHiddenElements,u=typeof s=="function"?s:function(rt){return rt!==s};if(!Be(e))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,d=[],a=e;Be(a)&&u(a);){if((a=a.parentElement)===c){d.push(a);break}a!=null&&a===document.body&&Te(a)&&!Te(document.documentElement)||a!=null&&Te(a,l)&&d.push(a)}for(var m=n.visualViewport?n.visualViewport.width:innerWidth,E=n.visualViewport?n.visualViewport.height:innerHeight,p=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,T=e.getBoundingClientRect(),H=T.height,P=T.width,k=T.top,K=T.right,N=T.bottom,v=T.left,f=o==="start"||o==="nearest"?k:o==="end"?N:k+H/2,h=i==="center"?v+P/2:i==="end"?K:v,z=[],ue=0;ue<d.length;ue++){var g=d[ue],C=g.getBoundingClientRect(),fe=C.height,de=C.width,U=C.top,pe=C.right,me=C.bottom,X=C.left;if(r==="if-needed"&&k>=0&&v>=0&&N<=E&&K<=m&&k>=U&&N<=me&&v>=X&&K<=pe)return z;var $=getComputedStyle(g),Z=parseInt($.borderLeftWidth,10),Q=parseInt($.borderTopWidth,10),G=parseInt($.borderRightWidth,10),J=parseInt($.borderBottomWidth,10),S=0,A=0,ee="offsetWidth"in g?g.offsetWidth-g.clientWidth-Z-G:0,te="offsetHeight"in g?g.offsetHeight-g.clientHeight-Q-J:0;if(c===g)S=o==="start"?f:o==="end"?f-E:o==="nearest"?re(w,w+E,E,Q,J,w+f,w+f+H,H):f-E/2,A=i==="start"?h:i==="center"?h-m/2:i==="end"?h-m:re(p,p+m,m,Z,G,p+h,p+h+P,P),S=Math.max(0,S+w),A=Math.max(0,A+p);else{S=o==="start"?f-U-Q:o==="end"?f-me+J+te:o==="nearest"?re(U,me,fe,Q,J+te,f,f+H,H):f-(U+fe/2)+te/2,A=i==="start"?h-X-Z:i==="center"?h-(X+de/2)+ee/2:i==="end"?h-pe+G+ee:re(X,pe,de,Z,G+ee,h,h+P,P);var Ce=g.scrollLeft,Ie=g.scrollTop;f+=Ie-(S=Math.max(0,Math.min(Ie+S,g.scrollHeight-fe+te))),h+=Ce-(A=Math.max(0,Math.min(Ce+A,g.scrollWidth-de+ee)))}z.push({el:g,top:S,left:A})}return z}function je(e){return e===Object(e)&&Object.keys(e).length!==0}function Ct(e,t){t===void 0&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scroll&&n?o.scroll({top:i,left:s,behavior:t}):(o.scrollTop=i,o.scrollLeft=s)})}function It(e){return e===!1?{block:"end",inline:"nearest"}:je(e)?e:{block:"start",inline:"nearest"}}function Vt(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(je(t)&&typeof t.behavior=="function")return t.behavior(n?xe(e,t):[]);if(!!n){var r=It(t);return Ct(xe(e,r),r.behavior)}}var Le=Vt;function F(e){var t;return j(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function M(e){var t;return(t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window}function Ft(e){return F(e).documentElement}function ie(e){return j(e)?"":e&&e.localName||""}function Wt(e){if(e.view)return e.view;let t=e.currentTarget;return t!=null?M(t):window}function se(e){let t=F(e);return ie(e)==="html"?e:e.assignedSlot||e.parentElement||t.documentElement}function Kt(e,t){return e?e===t||L(e)&&L(t)&&e.contains(t):!1}function L(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}function j(e){return(e==null?void 0:e.toString())==="[object Window]"}var ae=e=>(e==null?void 0:e.getAttribute("disabled"))!=null||!!(e!=null&&e.getAttribute("aria-disabled"));function Nt(e){var t;return(t=e.nativeEvent)!=null?t:e}function Me(e){let{overflow:t,overflowX:n,overflowY:r}=I(e);return/auto|scroll|overlay|hidden/.test(t+r+n)}function q(e){return["html","body","#document"].includes(ie(e))?F(e).body:L(e)&&Me(e)?e:q(se(e))}function qe(e,t=[]){let n=q(e),r=n===F(e).body,o=M(n),i=r?[o].concat(o.visualViewport||[],Me(n)?n:[]):n,s=t.concat(i);return r?s:s.concat(qe(se(i)))}function zt(e){return j(e)?{scrollLeft:e.scrollX,scrollTop:e.scrollY}:{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}var Ye=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Bt(e){var d;let{document:t,disabled:n=!1,allowPinchZoom:r}=e!=null?e:{},o=t!=null?t:document,i=(d=o==null?void 0:o.defaultView)!=null?d:window,s=ge()?i.visualViewport:null,l=o.documentElement;function u(){let a=x(Y(l,"paddingRight",`${i.innerWidth-l.clientWidth}px`),Y(l,"overflow","hidden"));return()=>a==null?void 0:a()}function c(){let a,m=0,E=v=>{a=q(v.target),!(a===l&&a===o.body)&&(m=v.changedTouches[0].pageY)},p=v=>{if(v.touches.length===2&&r)return;if(!a||a===l||a===o.body){v.preventDefault();return}let f=v.changedTouches[0].pageY,h=a.scrollTop,z=a.scrollHeight-a.clientHeight;(h<=0&&f>m||h>=z&&f<m)&&v.preventDefault(),m=f},w=v=>{let f=v.target;f instanceof i.HTMLInputElement&&!Ye.has(f.type)&&(v.preventDefault(),f.style.transform="translateY(-2000px)",f.focus(),i.requestAnimationFrame(()=>{f.style.transform=""}))},T=v=>{let f=v.target;f instanceof i.HTMLInputElement&&!Ye.has(f.type)&&(f.style.transform="translateY(-2000px)",i.requestAnimationFrame(()=>{f.style.transform="",s&&(s.height<i.innerHeight?i.requestAnimationFrame(function(){Le(f,{scrollMode:"if-needed"})}):y(s,"resize",()=>{Le(f,{scrollMode:"if-needed"})},{once:!0}))}))},H=()=>{i.scrollTo(0,0)},P=i.scrollX,k=i.scrollY,K=x(Y(l,"paddingRight",`${i.innerWidth-l.clientWidth}px`),Y(l,"overflow","hidden"),Y(o.body,"marginTop",`-${k}px`));i.scrollTo(0,0);let N=x(y(o,"touchstart",E,{passive:!1,capture:!0}),y(o,"touchmove",p,{passive:!1,capture:!0}),y(o,"touchend",w,{passive:!1,capture:!0}),y(o,"focus",T,!0),y(i,"scroll",H));return()=>{K(),N(),i.scrollTo(P,k)}}return n?D:_()?c():u()}function Y(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}var Qn=2147483647;function He(e,t){var l;let{type:n,property:r}=t,s=M(e)[n==="input"?"HTMLInputElement":"HTMLTextAreaElement"].prototype;return(l=Object.getOwnPropertyDescriptor(s,r))!=null?l:{}}function _t(e,t){var i;let n=M(e);if(!(e instanceof n.HTMLInputElement))return;(i=He(e,{type:"input",property:"value"}).set)==null||i.call(e,t);let o=new n.Event("input",{bubbles:!0});e.dispatchEvent(o)}function jt(e,t){var i;let n=M(e);if(!(e instanceof n.HTMLInputElement))return;(i=He(e,{type:"input",property:"checked"}).set)==null||i.call(e,t);let o=new n.Event("click",{bubbles:!0});e.dispatchEvent(o)}function qt(e,t){let{fn:n,property:r,type:o}=t;if(!n||!e)return;let{get:i,set:s}=He(e,{property:r,type:o}),l=!0;return Object.defineProperty(e,r,{get(){return i==null?void 0:i.call(this)},set(u){return l&&n(u),s==null?void 0:s.call(this,u)}}),function(){l=!1}}function Yt(e,t){var o;let n=Array.isArray(t.exclude)?t.exclude:[t.exclude],r=(o=e.relatedTarget)!=null?o:t.fallback;return n.every(i=>!(i!=null&&i.contains(r)))}var Pe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");function le(e,t){let n=I(e);if(!e||n.getPropertyValue("visibility")==="hidden")return!0;for(;e;){if(t!=null&&e===t)return!1;if(n.getPropertyValue("display")==="none")return!0;e=e.parentElement}return!1}var Ue=(e,t=!1)=>{if(!e)return[];let n=Array.from(e.querySelectorAll(Pe));return t&&L(e)&&n.unshift(e),n.filter(r=>ke(r)&&!le(r))},ke=e=>!L(e)||le(e)||ae(e)?!1:e==null?void 0:e.matches(Pe),Ut=(e,t=!1)=>Ue(e,t).filter(Xe),Xe=e=>ke(e)&&!ae(e)&&!le(e);function $e(e){return Xt(e)?e.form:e.closest("form")}function Xt(e){return["textarea","input","select","button"].includes(e.localName)}function $t(e,t){if(!e)return;let n=$e(e);return n==null||n.addEventListener("reset",t,{passive:!0}),()=>{n==null||n.removeEventListener("reset",t)}}var Ze={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft",Home:"End",End:"Home"},Zt={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"};function Qt(e,t={}){var s;let{dir:n="ltr",orientation:r="horizontal"}=t,{key:o}=e;return o=(s=Zt[o])!=null?s:o,n==="rtl"&&r==="horizontal"&&o in Ze&&(o=Ze[o]),o}var Gt=new Set(["PageUp","PageDown"]),Jt=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function en(e){return e.ctrlKey||e.metaKey?.1:Gt.has(e.key)||e.shiftKey&&Jt.has(e.key)?10:1}var Qe={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function Se(e){Object.assign(e.style,Qe)}function tn(e={}){var d;let{level:t="polite",doc:n,root:r,delay:o=0}=e,i=n!=null?n:document,s=(d=i.defaultView)!=null?d:window,l=r!=null?r:i.body;function u(a,m){let E=i.getElementById("__live-region__");E&&l.removeChild(E),m=m!=null?m:o;let p=i.createElement("span");p.id="__live-region__";var w=t!=="assertive"?"status":"alert";p.setAttribute("aria-live",t),p.setAttribute("role",w),Se(p),l.appendChild(p),s.setTimeout(()=>{p.textContent=a},m)}function c(){let a=i.getElementById("__live-region__");a&&l.removeChild(a)}return{announce:u,destroy:c}}function nn(e,t,n){if(!e)return D;let r=Array.isArray(t)?t:[t],o=e.ownerDocument.defaultView||window,i=new o.MutationObserver(s=>{for(let l of s)l.type==="attributes"&&l.attributeName&&r.includes(l.attributeName)&&n(l)});return i.observe(e,{attributes:!0,attributeFilter:r}),()=>i.disconnect()}function on(e,t,n=!1){if(!e)return D;let r=e.ownerDocument.defaultView||window,o=new r.MutationObserver(i=>{for(let s of i)s.type==="childList"&&t(s)});return o.observe(e,{childList:!0,subtree:n}),()=>o.disconnect()}function rn(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function sn(e,t){return e==null?void 0:e.querySelector(t)}function Ge(e,t){return e.find(n=>n.id===t)}function Ae(e,t){let n=Ge(e,t);return n?e.indexOf(n):-1}function Je(e,t,n=!0){let r=Ae(e,t);return r=n?(r+1)%e.length:Math.min(r+1,e.length-1),e[r]}function an(e,t,n=!0){let r=Ae(e,t);return r===-1?n?e[e.length-1]:null:(r=n?(r-1+e.length)%e.length:Math.max(0,r-1),e[r])}function ln(e,t,n){let r=e.filter(o=>{var s;let i=(s=o.dataset.valuetext)!=null?s:o.textContent;return!!(i!=null&&i.toLowerCase().startsWith(t.toLowerCase()))});return n?Je(r,n):null}function cn(e){return e.sort((t,n)=>t.compareDocumentPosition(n)&2?1:-1)}var W="default",De="",ce=new WeakMap;function Oe({target:e,doc:t}={}){let n=t!=null?t:document;return _()?(W==="default"&&(De=n.documentElement.style.webkitUserSelect,n.documentElement.style.webkitUserSelect="none"),W="disabled"):e&&(ce.set(e,e.style.userSelect),e.style.userSelect="none"),()=>et({target:e,doc:n})}function et({target:e,doc:t}={}){let n=t!=null?t:document;if(_()){if(W!=="disabled")return;W="restoring",setTimeout(()=>{B(()=>{W==="restoring"&&(n.documentElement.style.webkitUserSelect==="none"&&(n.documentElement.style.webkitUserSelect=De||""),De="",W="default")})},300)}else if(e&&ce.has(e)){let r=ce.get(e);e.style.userSelect==="none"&&(e.style.userSelect=r!=null?r:""),e.getAttribute("style")===""&&e.removeAttribute("style"),ce.delete(e)}}function un(e,t){var o;let n=(o=e.defaultView)!=null?o:window;return y(e,"pointerdown",i=>{i.target instanceof n.HTMLElement&&t(i.target)})}function fn(e){let{onPointerMove:t,onPointerUp:n,ctx:r}=e,{doc:o=document,threshold:i=5}=r;return x(V(o,"pointermove",(l,u)=>{let{point:c}=u;if(!(Math.sqrt(c.x**2+c.y**2)<i)){if(We(l)&&ne(l)){n();return}t(u,l)}},!1),V(o,"pointerup",n,!1),V(o,"pointercancel",n,!1),V(o,"contextmenu",n,!1),Oe({doc:o}))}function tt(e,t){return e.addEventListener("webkitpointerlockchange",t,!1),e.addEventListener("mozpointerlockchange",t,!1),e.addEventListener("pointerlockchange",t,!1),function(){e.removeEventListener("mozpointerlockchange",t,!1),e.removeEventListener("pointerlockchange",t,!1)}}function nt(e,t){return e.addEventListener("webkitpointerlockerror",t,!1),e.addEventListener("mozpointerlockerror",t,!1),e.addEventListener("pointerlockerror",t,!1),function(){e.removeEventListener("webkitpointerlockerror",t,!1),e.removeEventListener("mozpointerlockerror",t,!1),e.removeEventListener("pointerlockerror",t,!1)}}function dn(e){return e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock}function pn(e){return e.exitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock}function mn(e){return e.pointerLockElement||e.mozPointerLockElement||e.webkitPointerLockElement}function En(e,t={}){let{onPointerLock:n,onPointerUnlock:r}=t,o=e.body;function i(){return"pointerLockElement"in e||"mozPointerLockElement"in e||"webkitPointerLockElement"in e}function s(){return!!e.pointerLockElement}function l(){s()?n==null||n():r==null||r()}function u(p){s()&&(r==null||r()),console.error("PointerLock error occured:",p),c()}function c(){e.exitPointerLock=pn(e),e.exitPointerLock()}let d=new Set;function a(){d.add(tt(e,l)),d.add(nt(e,u))}function m(){!i()||(d.forEach(p=>p()),d.clear(),c())}function E(){!i()||!s()||(o.requestPointerLock=dn(o),o.requestPointerLock(),a())}return E(),m}var R=new Map;function yn(e,t){let n=R.get(e);return n?(n.callbacks.push(t),t(e.getBoundingClientRect())):(R.set(e,{rect:{},callbacks:[t]}),R.size===1&&(Re=requestAnimationFrame(ot))),function(){let o=R.get(e);if(!o)return;let i=o.callbacks.indexOf(t);i>-1&&o.callbacks.splice(i,1),o.callbacks.length===0&&(R.delete(e),R.size===0&&cancelAnimationFrame(Re))}}var Re;function ot(){let e=[];R.forEach((t,n)=>{let r=n.getBoundingClientRect();vn(t.rect,r)||(t.rect=r,e.push(t))}),e.forEach(t=>{t.callbacks.forEach(n=>n(t.rect))}),Re=requestAnimationFrame(ot)}function vn(e,t){return e.width===t.width&&e.height===t.height&&e.top===t.top&&e.right===t.right&&e.bottom===t.bottom&&e.left===t.left}function hn(e,t){let n=Fe(e);return y(n,"visibilitychange",()=>{let r=n.hidden||n.msHidden||n.webkitHidden;t(!!r)})}function gn(e){let t=e();return t?Promise.resolve(t):new Promise(n=>{let r=globalThis.setInterval(function(){let o=e();o&&(globalThis.clearInterval(r),n(o))},0)})}function wn(e,t){return new Promise(n=>{function r(o){o.target===e&&(e.removeEventListener(t,r),n())}e.addEventListener(t,r)})}
//# sourceMappingURL=index.js.map
{
"name": "@zag-js/dom-utils",
"version": "0.0.0-dev-20220412212252",
"version": "0.0.0-dev-20220413091534",
"description": "",

@@ -29,5 +29,5 @@ "keywords": [

"@types/react": "^18.0.0",
"@zag-js/utils": "^0.0.0-dev-20220412212252",
"@zag-js/utils": "^0.0.0-dev-20220413091534",
"scroll-into-view-if-needed": "^2.2.29"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc