Socket
Socket
Sign inDemoInstall

@zag-js/popover

Package Overview
Dependencies
Maintainers
1
Versions
1024
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/popover - npm Package Compare versions

Comparing version 0.0.0-dev-20220412162814 to 0.0.0-dev-20220412212252

10

dist/index.js

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

var z=Object.defineProperty,et=Object.defineProperties,tt=Object.getOwnPropertyDescriptor,nt=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols;var ve=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable;var he=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,be=(e,t)=>{for(var n in t||(t={}))ve.call(t,n)&&he(e,n,t[n]);if(me)for(var n of me(t))rt.call(t,n)&&he(e,n,t[n]);return e},ye=(e,t)=>et(e,nt(t)),it=e=>z(e,"__esModule",{value:!0});var lt=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},at=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ot(t))!ve.call(e,i)&&(n||i!=="default")&&z(e,i,{get:()=>t[i],enumerable:!(a=tt(t,i))||a.enumerable});return e};var st=(e=>(t,n)=>e&&e.get(t)||(n=at(it({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var At={};lt(At,{connect:()=>Ye,machine:()=>Ge});function Ee(e){return typeof e=="object"&&e!=null&&e.nodeType===1}function we(e,t){return(!t||e!=="hidden")&&e!=="visible"&&e!=="clip"}function re(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return we(n.overflowY,t)||we(n.overflowX,t)||function(a){var i=function(o){if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch(l){return null}}(a);return!!i&&(i.clientHeight<a.scrollHeight||i.clientWidth<a.scrollWidth)}(e)}return!1}function Y(e,t,n,a,i,o,l,d){return o<e&&l>t||o>e&&l<t?0:o<=e&&d<=n||l>=t&&d>=n?o-e-a:l>t&&d<n||o<e&&d>n?l-t+i:0}function ie(e,t){var n=window,a=t.scrollMode,i=t.block,o=t.inline,l=t.boundary,d=t.skipOverflowHiddenElements,u=typeof l=="function"?l:function(Je){return Je!==l};if(!Ee(e))throw new TypeError("Invalid target");for(var p=document.scrollingElement||document.documentElement,g=[],s=e;Ee(s)&&u(s);){if((s=s.parentElement)===p){g.push(s);break}s!=null&&s===document.body&&re(s)&&!re(document.documentElement)||s!=null&&re(s,d)&&g.push(s)}for(var f=n.visualViewport?n.visualViewport.width:innerWidth,v=n.visualViewport?n.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,P=e.getBoundingClientRect(),A=P.height,L=P.width,S=P.top,M=P.right,F=P.bottom,m=P.left,c=i==="start"||i==="nearest"?S:i==="end"?F:S+A/2,h=o==="center"?m+L/2:o==="end"?M:m,R=[],J=0;J<g.length;J++){var b=g[J],O=b.getBoundingClientRect(),ee=O.height,te=O.width,N=O.top,ne=O.right,oe=O.bottom,V=O.left;if(a==="if-needed"&&S>=0&&m>=0&&F<=v&&M<=f&&S>=N&&F<=oe&&m>=V&&M<=ne)return R;var W=getComputedStyle(b),_=parseInt(W.borderLeftWidth,10),j=parseInt(W.borderTopWidth,10),K=parseInt(W.borderRightWidth,10),q=parseInt(W.borderBottomWidth,10),I=0,x=0,U="offsetWidth"in b?b.offsetWidth-b.clientWidth-_-K:0,$="offsetHeight"in b?b.offsetHeight-b.clientHeight-j-q:0;if(p===b)I=i==="start"?c:i==="end"?c-v:i==="nearest"?Y(w,w+v,v,j,q,w+c,w+c+A,A):c-v/2,x=o==="start"?h:o==="center"?h-f/2:o==="end"?h-f:Y(y,y+f,f,_,K,y+h,y+h+L,L),I=Math.max(0,I+w),x=Math.max(0,x+y);else{I=i==="start"?c-N-j:i==="end"?c-oe+q+$:i==="nearest"?Y(N,oe,ee,j,q+$,c,c+A,A):c-(N+ee/2)+$/2,x=o==="start"?h-V-_:o==="center"?h-(V+te/2)+U/2:o==="end"?h-ne+K+U:Y(V,ne,te,_,K+U,h,h+L,L);var pe=b.scrollLeft,ge=b.scrollTop;c+=ge-(I=Math.max(0,Math.min(ge+I,b.scrollHeight-ee+$))),h+=pe-(x=Math.max(0,Math.min(pe+x,b.scrollWidth-te+U)))}R.push({el:b,top:I,left:x})}return R}function Te(e){return e===Object(e)&&Object.keys(e).length!==0}function ut(e,t){t===void 0&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(a){var i=a.el,o=a.top,l=a.left;i.scroll&&n?i.scroll({top:o,left:l,behavior:t}):(i.scrollTop=o,i.scrollLeft=l)})}function ct(e){return e===!1?{block:"end",inline:"nearest"}:Te(e)?e:{block:"start",inline:"nearest"}}function dt(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(Te(t)&&typeof t.behavior=="function")return t.behavior(n?ie(e,t):[]);if(!!n){var a=ct(t);return ut(ie(e,a),a.behavior)}}var le=dt;var Ce=e=>e?"":void 0;var Pe=new WeakMap;function ke(e){var t;if(!e)return{};let n=Pe.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),Pe.set(e,n)),n}function k(e){let t=new Set;function n(a){let i=globalThis.requestAnimationFrame(a);t.add(()=>globalThis.cancelAnimationFrame(i))}return n(()=>n(e)),function(){t.forEach(function(a){a()})}}function Ae(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}var Le=()=>{},X=(...e)=>t=>e.reduce((n,a)=>a(n),t),Dt=(()=>{let e=0;return()=>(e++,e.toString(36))})(),ae=e=>Se()&&e.test(navigator.platform),Se=()=>typeof window!="undefined",ft=()=>ae(/^Mac/),pt=()=>ae(/^iPhone/),gt=()=>ae(/^iPad/)||ft()&&navigator.maxTouchPoints>1,mt=()=>pt()||gt();var vt=e=>e.button===0,D=new Map,T=new Map;function ht(e,t,n,a){var i;if(!e)return Le;let o=JSON.stringify({type:t,options:a}),l=D.get(e);if(D.has(e))(l==null?void 0:l.has(o))?(i=l==null?void 0:l.get(o))==null||i.add(n):l==null||l.set(o,new Set([n]));else{let u=new Map([[o,new Set([n])]]);D.set(e,u)}function d(u){var p,g;function s(f){var v;let y=D.get(u);(v=y==null?void 0:y.get(o))==null||v.forEach(w=>w(f))}if(!(T==null?void 0:T.has(u))){T.set(u,new Map([[o,s]])),u.addEventListener(t,s,a);return}((p=T==null?void 0:T.get(u))==null?void 0:p.has(o))||((g=T.get(u))==null||g.set(o,s),u.addEventListener(t,s,a))}return d(e),function(){var u,p,g,s;if(!D.has(e))return;let f=D.get(e);if((u=f==null?void 0:f.get(o))==null||u.delete(n),((p=f==null?void 0:f.get(o))==null?void 0:p.size)===0){let v=(g=T.get(e))==null?void 0:g.get(o);e.removeEventListener(t,v,a),f==null||f.delete(o),(s=T.get(e))==null||s.delete(o),(f==null?void 0:f.size)===0&&(D.delete(e),T.delete(e))}}}var Ie=e=>Object.prototype.toString.call(e).slice(8,-1),bt=e=>Ie(e)==="Object"&&"current"in e,yt=e=>Ie(e)==="Function"?e():e;function E(e,t,n,a){let i=bt(e)?e.current:yt(e);return ht(i,t,n,a)}var Z=0,xe;function De(e,t={}){let{disabled:n=!1,document:a}=t,i=a||document,o=!1,l=!1;function d(){let s=v=>{let y=v.pointerType==="mouse";o=!y,l=y&&vt(v)},f=()=>{o=!1,l=!1};return X(E(i,"pointerdown",s),E(i,"pointerup",f))}function u(){Z--,Z===0&&(i.body.style.pointerEvents=xe),e&&(e.style.pointerEvents="")}function p(){if(!n)return Z===0&&(xe=i.body.style.pointerEvents),i.body.style.pointerEvents="none",e&&(e.style.pointerEvents="auto"),Z++,function(){o?E(i,"click",u,{once:!0}):l?E(i,"pointerup",u,{once:!0}):u()}}let g=[];return g.push(p()),k(()=>{g.push(d())}),function(){g.forEach(s=>s==null?void 0:s())}}function Oe(e){var t;return Re(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Me(e){return Re(e)?"":e&&e.localName||""}function Et(e){let t=Oe(e);return Me(e)==="html"?e:e.assignedSlot||e.parentElement||t.documentElement}function Fe(e,t){return e?e===t||B(e)&&B(t)&&e.contains(t):!1}function B(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}function Re(e){return(e==null?void 0:e.toString())==="[object Window]"}var Be=e=>(e==null?void 0:e.getAttribute("disabled"))!=null||!!(e==null?void 0:e.getAttribute("aria-disabled"));function wt(e){let{overflow:t,overflowX:n,overflowY:a}=ke(e);return/auto|scroll|overlay|hidden/.test(t+a+n)}function He(e){return["html","body","#document"].includes(Me(e))?Oe(e).body:B(e)&&wt(e)?e:He(Et(e))}var Ne=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ve(e){var t;let{document:n,disabled:a=!1,allowPinchZoom:i}=e!=null?e:{},o=n!=null?n:document,l=(t=o==null?void 0:o.defaultView)!=null?t:window,d=Se()?l.visualViewport:null,u=o.documentElement;function p(){let s=X(H(u,"paddingRight",`${l.innerWidth-u.clientWidth}px`),H(u,"overflow","hidden"));return()=>s==null?void 0:s()}function g(){let s,f=0,v=m=>{s=He(m.target),!(s===u&&s===o.body)&&(f=m.changedTouches[0].pageY)},y=m=>{if(m.touches.length===2&&i)return;if(!s||s===u||s===o.body){m.preventDefault();return}let c=m.changedTouches[0].pageY,h=s.scrollTop,R=s.scrollHeight-s.clientHeight;(h<=0&&c>f||h>=R&&c<f)&&m.preventDefault(),f=c},w=m=>{let c=m.target;c instanceof l.HTMLInputElement&&!Ne.has(c.type)&&(m.preventDefault(),c.style.transform="translateY(-2000px)",c.focus(),l.requestAnimationFrame(()=>{c.style.transform=""}))},P=m=>{let c=m.target;c instanceof l.HTMLInputElement&&!Ne.has(c.type)&&(c.style.transform="translateY(-2000px)",l.requestAnimationFrame(()=>{c.style.transform="",!!d&&(d.height<l.innerHeight?l.requestAnimationFrame(function(){le(c,{scrollMode:"if-needed"})}):E(d,"resize",()=>{le(c,{scrollMode:"if-needed"})},{once:!0}))}))},A=()=>{l.scrollTo(0,0)},L=l.scrollX,S=l.scrollY,M=X(H(u,"paddingRight",`${l.innerWidth-u.clientWidth}px`),H(u,"overflow","hidden"),H(o.body,"marginTop",`-${S}px`));l.scrollTo(0,0);let F=X(E(o,"touchstart",v,{passive:!1,capture:!0}),E(o,"touchmove",y,{passive:!1,capture:!0}),E(o,"touchend",w,{passive:!1,capture:!0}),E(o,"focus",P,!0),E(l,"scroll",A));return()=>{M(),F(),l.scrollTo(L,S)}}return a?Le:mt()?g():p()}function H(e,t,n){let a=e.style[t];return e.style[t]=n,()=>{e.style[t]=a}}function We(e,t){var n;let a=Array.isArray(t.exclude)?t.exclude:[t.exclude],i=(n=e.relatedTarget)!=null?n:t.fallback;return a.every(o=>!(o==null?void 0:o.contains(i)))}var _e=["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 se(e,t){let n=ke(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(_e));return t&&B(e)&&n.unshift(e),n.filter(a=>Q(a)&&!se(a))},Q=e=>!B(e)||se(e)||Be(e)?!1:e==null?void 0:e.matches(_e),ce=(e,t=!1)=>ue(e,t).filter(Tt),Tt=e=>Q(e)&&!Be(e)&&!se(e);function je(e,t){var n;let a=(n=e.defaultView)!=null?n:window;return E(e,"pointerdown",i=>{i.target instanceof a.HTMLElement&&t(i.target)})}var ze=require("@zag-js/popper");function Ct(e){return{button:e,label:e,input:e,output:e,element:e}}var Ke=Ct(e=>e);var qe=e=>e[0],Ue=e=>e[e.length-1];function Pt(e,t,n={}){let{step:a=1,loop:i=!0}=n,o=t+a,l=e.length,d=l-1;return t===-1?a>0?0:d:o<0?i?d:0:o>=l?i?0:t>l?l:t:o}function de(e,t,n={}){return e[Pt(e,t,n)]}var G=(e,...t)=>{let n=typeof e=="function"?e(...t):e;return n!=null?n:void 0},$e=e=>e;var Rt=(()=>{let e=0;return()=>(e++,e.toString(36))})();var r={getDoc:e=>{var t;return(t=e.doc)!=null?t:document},getActiveEl:e=>r.getDoc(e).activeElement,getAnchorId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.anchor)!=null?n:`popover-${e.uid}-anchor`},getTriggerId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.trigger)!=null?n:`popover-${e.uid}-trigger`},getContentId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.content)!=null?n:`popover-${e.uid}-content`},getPositionerId:e=>`popover-${e.uid}-popper`,getArrowId:e=>`popover-${e.uid}-arrow`,getTitleId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.title)!=null?n:`popover-${e.uid}-title`},getDescriptionId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.description)!=null?n:`popover-${e.uid}-desc`},getCloseButtonId:e=>{var t,n;return(n=(t=e.ids)==null?void 0:t.closeBtn)!=null?n:`popover-${e.uid}-close-button`},getAnchorEl:e=>r.getDoc(e).getElementById(r.getAnchorId(e)),getTriggerEl:e=>r.getDoc(e).getElementById(r.getTriggerId(e)),getContentEl:e=>r.getDoc(e).getElementById(r.getContentId(e)),getPositionerEl:e=>r.getDoc(e).getElementById(r.getPositionerId(e)),getTitleEl:e=>r.getDoc(e).getElementById(r.getTitleId(e)),getDescriptionEl:e=>r.getDoc(e).getElementById(r.getDescriptionId(e)),getFocusableEls:e=>ue(r.getContentEl(e)),getFirstFocusableEl:e=>r.getFocusableEls(e)[0],getDocTabbableEls:e=>ce($e(r.getDoc(e))),getTabbableEls:e=>{let t=r.getContentEl(e);return t?ce(t):[]},getFirstTabbableEl:e=>qe(r.getTabbableEls(e)),getLastTabbableEl:e=>Ue(r.getTabbableEls(e)),getInitialFocusEl:e=>{var t;return(t=G(e.initialFocusEl))!=null?t:r.getFirstFocusableEl(e)}};function Ye(e,t,n=Ke){let a=e.matches("open"),i=e.context.pointerdownNode,o=(0,ze.getPlacementStyles)({measured:!!e.context.isPlacementComplete});return{portalled:e.context.currentPortalled,isOpen:a,open(){t("OPEN")},close(){t("CLOSE")},arrowProps:n.element({id:r.getArrowId(e.context),"data-part":"arrow",style:o.arrow}),innerArrowProps:n.element({"data-part":"arrow-inner",style:o.innerArrow}),anchorProps:n.element({"data-part":"anchor",id:r.getAnchorId(e.context)}),triggerProps:n.button({"data-part":"trigger",type:"button","data-placement":e.context.currentPlacement,id:r.getTriggerId(e.context),"aria-haspopup":"dialog","aria-expanded":a,"data-expanded":Ce(a),"aria-controls":r.getContentId(e.context),onClick(){t("TRIGGER_CLICK")}}),positionerProps:n.element({id:r.getPositionerId(e.context),"data-part":"positioner",style:o.floating}),contentProps:n.element({"data-part":"content",id:r.getContentId(e.context),tabIndex:-1,role:"dialog",hidden:!a,"aria-labelledby":e.context.isTitleRendered?r.getTitleId(e.context):void 0,"aria-describedby":e.context.isDescriptionRendered?r.getDescriptionId(e.context):void 0,"data-placement":e.context.currentPlacement,onKeyDown(l){let u={Escape(p){t("ESCAPE"),p.stopPropagation()},Tab(p){let g=p.shiftKey?"SHIFT_TAB":"TAB";t({type:g,preventDefault:()=>p.preventDefault()})}}[l.key];u==null||u(l)},onBlur(l){var u;if(We(l,{exclude:[r.getTriggerEl(e.context),r.getContentEl(e.context)],fallback:i})){let p=(u=l.relatedTarget)!=null?u:i;t({type:"INTERACT_OUTSIDE",focusable:Q(p)})}}}),titleProps:n.element({"data-part":"title",id:r.getTitleId(e.context)}),descriptionProps:n.element({"data-part":"description",id:r.getDescriptionId(e.context)}),closeButtonProps:n.button({"data-part":"close-button",id:r.getCloseButtonId(e.context),type:"button","aria-label":"close",onClick(){t("CLOSE")}})}}var C=require("@zag-js/core");var Xe=require("@zag-js/popper");var Ze=require("aria-hidden"),Qe=require("focus-trap");var{and:fe,or:kt}=C.guards,Ge=(0,C.createMachine)({id:"popover",initial:"unknown",context:{isTitleRendered:!0,isDescriptionRendered:!0,isAnchorRendered:!1,uid:"",closeOnBlur:!0,closeOnEsc:!0,autoFocus:!0,modal:!1,positioning:{placement:"bottom"},currentPlacement:void 0},computed:{currentPortalled:e=>!!e.modal||!!e.portalled},states:{unknown:{on:{SETUP:{target:"closed",actions:["setupDocument","checkRenderedElements"]}}},closed:{entry:["clearPointerDown","invokeOnClose"],on:{TRIGGER_CLICK:"open",OPEN:"open"}},open:{activities:["trackPointerDown","trapFocus","preventScroll","hideContentBelow","disableOutsidePointerEvents","computePlacement"],entry:(0,C.choose)([{guard:"autoFocus",actions:["setInitialFocus","invokeOnOpen"]},{actions:["focusContent","invokeOnOpen"]}]),on:{CLOSE:{target:"closed",actions:"focusTrigger"},TRIGGER_CLICK:{target:"closed",actions:"focusTrigger"},ESCAPE:{guard:"closeOnEsc",target:"closed",actions:"focusTrigger"},TAB:{guard:fe("isLastTabbableElement","closeOnBlur","portalled"),target:"closed",actions:"focusNextTabbableElementAfterTrigger"},SHIFT_TAB:{guard:fe(kt("isFirstTabbableElement","isContentFocused"),"closeOnBlur","portalled"),target:"closed",actions:"focusTrigger"},INTERACT_OUTSIDE:[{guard:fe("closeOnBlur","isRelatedTargetFocusable"),target:"closed"},{guard:"closeOnBlur",target:"closed",actions:"focusTrigger"}]}}}},{activities:{computePlacement(e){e.currentPlacement=e.positioning.placement;let t=e.isAnchorRendered?r.getAnchorEl(e):r.getTriggerEl(e);return(0,Xe.getPlacement)(t,r.getPositionerEl(e),ye(be({},e.positioning),{onComplete(n){e.currentPlacement=n.placement,e.isPlacementComplete=!0},onCleanup(){e.currentPlacement=void 0,e.isPlacementComplete=!1}}))},trackPointerDown(e){return je(r.getDoc(e),t=>{e.pointerdownNode=(0,C.ref)(t)})},disableOutsidePointerEvents(e){let t=r.getContentEl(e);return De(t,{document:r.getDoc(e),disabled:!e.modal})},hideContentBelow(e){if(!e.modal)return;let t;return k(()=>{let n=r.getContentEl(e);if(!!n)try{t=(0,Ze.hideOthers)(n)}catch(a){}}),()=>t==null?void 0:t()},preventScroll(e){return Ve({allowPinchZoom:!0,disabled:!e.modal,document:r.getDoc(e)})},trapFocus(e){if(!e.modal)return;let t;return k(()=>{let n=r.getContentEl(e);if(!!n){t=(0,Qe.createFocusTrap)(n,{escapeDeactivates:!1,allowOutsideClick:!0,returnFocusOnDeactivate:!0,document:r.getDoc(e),fallbackFocus:n,initialFocus:G(e.initialFocusEl)});try{t.activate()}catch(a){}}}),()=>t==null?void 0:t.deactivate()}},guards:{closeOnEsc:e=>!!e.closeOnEsc,autoFocus:e=>!!e.autoFocus,modal:e=>!!e.modal,portalled:e=>!!e.portalled,isRelatedTargetFocusable:(e,t)=>t.focusable,closeOnBlur:e=>!!e.closeOnBlur,isContentFocused:e=>r.getContentEl(e)===r.getActiveEl(e),isFirstTabbableElement:e=>r.getFirstTabbableEl(e)===r.getActiveEl(e),isLastTabbableElement:e=>r.getLastTabbableEl(e)===r.getActiveEl(e)},actions:{checkRenderedElements(e){Ae(()=>{e.isAnchorRendered=!!r.getAnchorEl(e),e.isTitleRendered=!!r.getTitleEl(e),e.isDescriptionRendered=!!r.getDescriptionEl(e)})},setupDocument(e,t){t.doc&&(e.doc=(0,C.ref)(t.doc)),e.uid=t.id},clearPointerDown(e){e.pointerdownNode=null},focusContent(e){k(()=>{var t;(t=r.getContentEl(e))==null||t.focus()})},setInitialFocus(e){k(()=>{var t;(t=r.getInitialFocusEl(e))==null||t.focus()})},focusTrigger(e){k(()=>{var t;(t=r.getTriggerEl(e))==null||t.focus()})},invokeOnOpen(e,t){var n;t.type!=="SETUP"&&((n=e.onOpen)==null||n.call(e))},invokeOnClose(e,t){var n;t.type!=="SETUP"&&((n=e.onClose)==null||n.call(e))},focusNextTabbableElementAfterTrigger(e,t){let n=r.getContentEl(e),a=r.getDoc(e),i=r.getTriggerEl(e);if(!n||!i||r.getLastTabbableEl(e)!==a.activeElement)return;let l=r.getDocTabbableEls(e),d=de(l,l.indexOf(i),{loop:!1});d===n&&(l=l.filter(u=>!Fe(n,u)),d=de(l,l.indexOf(i),{loop:!1})),!(!d||d===i)&&(t.preventDefault(),k(()=>d==null?void 0:d.focus()))}}});module.exports=st(At);
var Gt=Object.defineProperty;var tr=Object.getOwnPropertyDescriptor;var er=Object.getOwnPropertyNames;var nr=Object.prototype.hasOwnProperty;var rr=(t,e)=>{for(var n in e)Gt(t,n,{get:e[n],enumerable:!0})},ir=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of er(e))!nr.call(t,i)&&i!==n&&Gt(t,i,{get:()=>e[i],enumerable:!(r=tr(e,i))||r.enumerable});return t};var or=t=>ir(Gt({},"__esModule",{value:!0}),t);var Qi={};rr(Qi,{connect:()=>En,machine:()=>Zn});module.exports=or(Qi);var De=t=>t?"":void 0;var Se=new WeakMap;function Re(t){var e;if(!t)return{};let n=Se.get(t);return n||(n=((e=t?.ownerDocument.defaultView)!=null?e:window).getComputedStyle(t),Se.set(t,n)),n}function $(t){let e=new Set;function n(r){let i=globalThis.requestAnimationFrame(r);e.add(()=>globalThis.cancelAnimationFrame(i))}return n(()=>n(t)),function(){e.forEach(function(r){r()})}}function Fe(t){let e=globalThis.requestAnimationFrame(t);return function(){globalThis.cancelAnimationFrame(e)}}var Me=()=>{},Ot=(...t)=>e=>t.reduce((n,r)=>r(n),e),eo=(()=>{let t=0;return()=>(t++,t.toString(36))})(),Jt=t=>Ie()&&t.test(navigator.platform),Ie=()=>typeof window<"u",ar=()=>Jt(/^Mac/),lr=()=>Jt(/^iPhone/),sr=()=>Jt(/^iPad/)||ar()&&navigator.maxTouchPoints>1,cr=()=>lr()||sr();var ur=t=>t.button===0,J=new Map,V=new Map;function dr(t,e,n,r){var i;if(!t)return Me;let o=JSON.stringify({type:e,options:r}),l=J.get(t);if(J.has(t))l!=null&&l.has(o)?(i=l?.get(o))==null||i.add(n):l?.set(o,new Set([n]));else{let s=new Map([[o,new Set([n])]]);J.set(t,s)}function c(s){var p,b;function h(d){var v;let a=J.get(s);(v=a?.get(o))==null||v.forEach(u=>u(d))}if(!(V!=null&&V.has(s))){V.set(s,new Map([[o,h]])),s.addEventListener(e,h,r);return}(p=V?.get(s))!=null&&p.has(o)||((b=V.get(s))==null||b.set(o,h),s.addEventListener(e,h,r))}return c(t),function(){var s,p,b,h;if(!J.has(t))return;let d=J.get(t);if((s=d?.get(o))==null||s.delete(n),((p=d?.get(o))==null?void 0:p.size)===0){let v=(b=V.get(t))==null?void 0:b.get(o);t.removeEventListener(e,v,r),d?.delete(o),(h=V.get(t))==null||h.delete(o),d?.size===0&&(J.delete(t),V.delete(t))}}}var Ne=t=>Object.prototype.toString.call(t).slice(8,-1),fr=t=>Ne(t)==="Object"&&"current"in t,hr=t=>Ne(t)==="Function"?t():t;function I(t,e,n,r){let i=fr(t)?t.current:hr(t);return dr(i,e,n,r)}var Pt=0,Ce;function je(t,e={}){let{disabled:n=!1,document:r}=e,i=r||document,o=!1,l=!1;function c(){let h=v=>{let a=v.pointerType==="mouse";o=!a,l=a&&ur(v)},d=()=>{o=!1,l=!1};return Ot(I(i,"pointerdown",h),I(i,"pointerup",d))}function s(){Pt--,Pt===0&&(i.body.style.pointerEvents=Ce),t&&(t.style.pointerEvents="")}function p(){if(!n)return Pt===0&&(Ce=i.body.style.pointerEvents),i.body.style.pointerEvents="none",t&&(t.style.pointerEvents="auto"),Pt++,function(){o?I(i,"click",s,{once:!0}):l?I(i,"pointerup",s,{once:!0}):s()}}let b=[];return b.push(p()),$(()=>{b.push(c())}),function(){b.forEach(h=>h?.())}}function Ae(t){return typeof t=="object"&&t!=null&&t.nodeType===1}function ke(t,e){return(!e||t!=="hidden")&&t!=="visible"&&t!=="clip"}function Xt(t,e){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var n=getComputedStyle(t,null);return ke(n.overflowY,e)||ke(n.overflowX,e)||function(r){var i=function(o){if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}}(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)}(t)}return!1}function Lt(t,e,n,r,i,o,l,c){return o<t&&l>e||o>t&&l<e?0:o<=t&&c<=n||l>=e&&c>=n?o-t-r:l>e&&c<n||o<t&&c>n?l-e+i:0}function Pe(t,e){var n=window,r=e.scrollMode,i=e.block,o=e.inline,l=e.boundary,c=e.skipOverflowHiddenElements,s=typeof l=="function"?l:function(Qn){return Qn!==l};if(!Ae(t))throw new TypeError("Invalid target");for(var p=document.scrollingElement||document.documentElement,b=[],h=t;Ae(h)&&s(h);){if((h=h.parentElement)===p){b.push(h);break}h!=null&&h===document.body&&Xt(h)&&!Xt(document.documentElement)||h!=null&&Xt(h,c)&&b.push(h)}for(var d=n.visualViewport?n.visualViewport.width:innerWidth,v=n.visualViewport?n.visualViewport.height:innerHeight,a=window.scrollX||pageXOffset,u=window.scrollY||pageYOffset,f=t.getBoundingClientRect(),m=f.height,w=f.width,E=f.top,T=f.right,C=f.bottom,g=f.left,y=i==="start"||i==="nearest"?E:i==="end"?C:E+m/2,S=o==="center"?g+w/2:o==="end"?T:g,k=[],P=0;P<b.length;P++){var A=b[P],F=A.getBoundingClientRect(),M=F.height,D=F.width,N=F.top,H=F.right,z=F.bottom,wt=F.left;if(r==="if-needed"&&E>=0&&g>=0&&C<=v&&T<=d&&E>=N&&C<=z&&g>=wt&&T<=H)return k;var Et=getComputedStyle(A),xt=parseInt(Et.borderLeftWidth,10),Tt=parseInt(Et.borderTopWidth,10),St=parseInt(Et.borderRightWidth,10),Ct=parseInt(Et.borderBottomWidth,10),G=0,X=0,At="offsetWidth"in A?A.offsetWidth-A.clientWidth-xt-St:0,kt="offsetHeight"in A?A.offsetHeight-A.clientHeight-Tt-Ct:0;if(p===A)G=i==="start"?y:i==="end"?y-v:i==="nearest"?Lt(u,u+v,v,Tt,Ct,u+y,u+y+m,m):y-v/2,X=o==="start"?S:o==="center"?S-d/2:o==="end"?S-d:Lt(a,a+d,d,xt,St,a+S,a+S+w,w),G=Math.max(0,G+u),X=Math.max(0,X+a);else{G=i==="start"?y-N-Tt:i==="end"?y-z+Ct+kt:i==="nearest"?Lt(N,z,M,Tt,Ct+kt,y,y+m,m):y-(N+M/2)+kt/2,X=o==="start"?S-wt-xt:o==="center"?S-(wt+D/2)+At/2:o==="end"?S-H+St+At:Lt(wt,H,D,xt,St+At,S,S+w,w);var xe=A.scrollLeft,Te=A.scrollTop;y+=Te-(G=Math.max(0,Math.min(Te+G,A.scrollHeight-M+kt))),S+=xe-(X=Math.max(0,Math.min(xe+X,A.scrollWidth-D+At)))}k.push({el:A,top:G,left:X})}return k}function We(t){return t===Object(t)&&Object.keys(t).length!==0}function pr(t,e){e===void 0&&(e="auto");var n="scrollBehavior"in document.body.style;t.forEach(function(r){var i=r.el,o=r.top,l=r.left;i.scroll&&n?i.scroll({top:o,left:l,behavior:e}):(i.scrollTop=o,i.scrollLeft=l)})}function vr(t){return t===!1?{block:"end",inline:"nearest"}:We(t)?t:{block:"start",inline:"nearest"}}function gr(t,e){var n=t.isConnected||t.ownerDocument.documentElement.contains(t);if(We(e)&&typeof e.behavior=="function")return e.behavior(n?Pe(t,e):[]);if(n){var r=vr(e);return pr(Pe(t,r),r.behavior)}}var Le=gr;function Be(t){var e;return Ve(t)?t.document:(e=t?.ownerDocument)!=null?e:document}function He(t){return Ve(t)?"":t&&t.localName||""}function mr(t){let e=Be(t);return He(t)==="html"?t:t.assignedSlot||t.parentElement||e.documentElement}function ze(t,e){return t?t===e||ut(t)&&ut(e)&&t.contains(e):!1}function ut(t){return typeof t=="object"&&t?.nodeType===Node.ELEMENT_NODE&&typeof t?.nodeName=="string"}function Ve(t){return t?.toString()==="[object Window]"}var Ke=t=>t?.getAttribute("disabled")!=null||!!(t!=null&&t.getAttribute("aria-disabled"));function br(t){let{overflow:e,overflowX:n,overflowY:r}=Re(t);return/auto|scroll|overlay|hidden/.test(e+r+n)}function qe(t){return["html","body","#document"].includes(He(t))?Be(t).body:ut(t)&&br(t)?t:qe(mr(t))}var Oe=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function $e(t){var e;let{document:n,disabled:r=!1,allowPinchZoom:i}=t??{},o=n??document,l=(e=o?.defaultView)!=null?e:window,c=Ie()?l.visualViewport:null,s=o.documentElement;function p(){let h=Ot(ct(s,"paddingRight",`${l.innerWidth-s.clientWidth}px`),ct(s,"overflow","hidden"));return()=>h?.()}function b(){let h,d=0,v=g=>{h=qe(g.target),!(h===s&&h===o.body)&&(d=g.changedTouches[0].pageY)},a=g=>{if(g.touches.length===2&&i)return;if(!h||h===s||h===o.body){g.preventDefault();return}let y=g.changedTouches[0].pageY,S=h.scrollTop,k=h.scrollHeight-h.clientHeight;(S<=0&&y>d||S>=k&&y<d)&&g.preventDefault(),d=y},u=g=>{let y=g.target;y instanceof l.HTMLInputElement&&!Oe.has(y.type)&&(g.preventDefault(),y.style.transform="translateY(-2000px)",y.focus(),l.requestAnimationFrame(()=>{y.style.transform=""}))},f=g=>{let y=g.target;y instanceof l.HTMLInputElement&&!Oe.has(y.type)&&(y.style.transform="translateY(-2000px)",l.requestAnimationFrame(()=>{y.style.transform="",c&&(c.height<l.innerHeight?l.requestAnimationFrame(function(){Le(y,{scrollMode:"if-needed"})}):I(c,"resize",()=>{Le(y,{scrollMode:"if-needed"})},{once:!0}))}))},m=()=>{l.scrollTo(0,0)},w=l.scrollX,E=l.scrollY,T=Ot(ct(s,"paddingRight",`${l.innerWidth-s.clientWidth}px`),ct(s,"overflow","hidden"),ct(o.body,"marginTop",`-${E}px`));l.scrollTo(0,0);let C=Ot(I(o,"touchstart",v,{passive:!1,capture:!0}),I(o,"touchmove",a,{passive:!1,capture:!0}),I(o,"touchend",u,{passive:!1,capture:!0}),I(o,"focus",f,!0),I(l,"scroll",m));return()=>{T(),C(),l.scrollTo(w,E)}}return r?Me:cr()?b():p()}function ct(t,e,n){let r=t.style[e];return t.style[e]=n,()=>{t.style[e]=r}}function _e(t,e){var n;let r=Array.isArray(e.exclude)?e.exclude:[e.exclude],i=(n=t.relatedTarget)!=null?n:e.fallback;return r.every(o=>!(o!=null&&o.contains(i)))}var Ue=["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 Zt(t,e){let n=Re(t);if(!t||n.getPropertyValue("visibility")==="hidden")return!0;for(;t;){if(e!=null&&t===e)return!1;if(n.getPropertyValue("display")==="none")return!0;t=t.parentElement}return!1}var Qt=(t,e=!1)=>{if(!t)return[];let n=Array.from(t.querySelectorAll(Ue));return e&&ut(t)&&n.unshift(t),n.filter(r=>Dt(r)&&!Zt(r))},Dt=t=>!ut(t)||Zt(t)||Ke(t)?!1:t?.matches(Ue),te=(t,e=!1)=>Qt(t,e).filter(yr),yr=t=>Dt(t)&&!Ke(t)&&!Zt(t);function Ye(t,e){var n;let r=(n=t.defaultView)!=null?n:window;return I(t,"pointerdown",i=>{i.target instanceof r.HTMLElement&&e(i.target)})}function ot(t){return t.split("-")[0]}function Nt(t){return t.split("-")[1]}function ft(t){return["top","bottom"].includes(ot(t))?"x":"y"}function ie(t){return t==="y"?"height":"width"}function Ge(t,e,n){let{reference:r,floating:i}=t,o=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2,c=ft(e),s=ie(c),p=r[s]/2-i[s]/2,b=ot(e),h=c==="x",d;switch(b){case"top":d={x:o,y:r.y-i.height};break;case"bottom":d={x:o,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:l};break;case"left":d={x:r.x-i.width,y:l};break;default:d={x:r.x,y:r.y}}switch(Nt(e)){case"start":d[c]-=p*(n&&h?-1:1);break;case"end":d[c]+=p*(n&&h?-1:1);break}return d}var wr=async(t,e,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,c=await(l.isRTL==null?void 0:l.isRTL(e)),s=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:p,y:b}=Ge(s,r,c),h=r,d={},v=0;for(let a=0;a<o.length;a++){let{name:u,fn:f}=o[a],{x:m,y:w,data:E,reset:T}=await f({x:p,y:b,initialPlacement:r,placement:h,strategy:i,middlewareData:d,rects:s,platform:l,elements:{reference:t,floating:e}});if(p=m??p,b=w??b,d={...d,[u]:{...d[u],...E}},T){typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(s=T.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:p,y:b}=Ge(s,h,c)),a=-1;continue}}return{x:p,y:b,placement:h,strategy:i,middlewareData:d}};function Er(t){return{top:0,right:0,bottom:0,left:0,...t}}function ln(t){return typeof t!="number"?Er(t):{top:t,right:t,bottom:t,left:t}}function Ft(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function oe(t,e){var n;e===void 0&&(e={});let{x:r,y:i,platform:o,rects:l,elements:c,strategy:s}=t,{boundary:p="clippingAncestors",rootBoundary:b="viewport",elementContext:h="floating",altBoundary:d=!1,padding:v=0}=e,a=ln(v),u=c[d?h==="floating"?"reference":"floating":h],f=Ft(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(u)))==null||n?u:u.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:p,rootBoundary:b,strategy:s})),m=Ft(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:h==="floating"?{...l.floating,x:r,y:i}:l.reference,offsetParent:await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),strategy:s}):l[h]);return{top:f.top-m.top+a.top,bottom:m.bottom-f.bottom+a.bottom,left:f.left-m.left+a.left,right:m.right-f.right+a.right}}var xr=Math.min,tt=Math.max;function ee(t,e,n){return tt(t,xr(e,n))}var Tr=t=>({name:"arrow",options:t,async fn(e){let{element:n,padding:r=0}=t??{},{x:i,y:o,placement:l,rects:c,platform:s}=e;if(n==null)return{};let p=ln(r),b={x:i,y:o},h=ft(l),d=ie(h),v=await s.getDimensions(n),a=h==="y"?"top":"left",u=h==="y"?"bottom":"right",f=c.reference[d]+c.reference[h]-b[h]-c.floating[d],m=b[h]-c.reference[h],w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(n)),E=w?h==="y"?w.clientHeight||0:w.clientWidth||0:0,T=f/2-m/2,C=p[a],g=E-v[d]-p[u],y=E/2-v[d]/2+T,S=ee(C,y,g);return{data:{[h]:S,centerOffset:y-S}}}}),Sr={left:"right",right:"left",bottom:"top",top:"bottom"};function Mt(t){return t.replace(/left|right|bottom|top/g,e=>Sr[e])}function Cr(t,e,n){n===void 0&&(n=!1);let r=Nt(t),i=ft(t),o=ie(i),l=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=Mt(l)),{main:l,cross:Mt(l)}}var Ar={start:"end",end:"start"};function Xe(t){return t.replace(/start|end/g,e=>Ar[e])}function kr(t){let e=Mt(t);return[Xe(t),e,Xe(e)]}var Pr=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n;let{placement:r,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:s}=e,{mainAxis:p=!0,crossAxis:b=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",flipAlignment:v=!0,...a}=t,u=ot(r),f=h||(u===l||!v?[Mt(l)]:kr(l)),m=[l,...f],w=await oe(e,a),E=[],T=((n=i.flip)==null?void 0:n.overflows)||[];if(p&&E.push(w[u]),b){let{main:S,cross:k}=Cr(r,o,await(c.isRTL==null?void 0:c.isRTL(s.floating)));E.push(w[S],w[k])}if(T=[...T,{placement:r,overflows:E}],!E.every(S=>S<=0)){var C,g;let S=((C=(g=i.flip)==null?void 0:g.index)!=null?C:0)+1,k=m[S];if(k)return{data:{index:S,overflows:T},reset:{placement:k}};let P="bottom";switch(d){case"bestFit":{var y;let A=(y=T.slice().sort((F,M)=>F.overflows.filter(D=>D>0).reduce((D,N)=>D+N,0)-M.overflows.filter(D=>D>0).reduce((D,N)=>D+N,0))[0])==null?void 0:y.placement;A&&(P=A);break}case"initialPlacement":P=l;break}if(r!==P)return{reset:{placement:P}}}return{}}}};function Lr(t,e,n,r){r===void 0&&(r=!1);let i=ot(t),o=Nt(t),l=ft(t)==="x",c=["left","top"].includes(i)?-1:1,s=r&&l?-1:1,p=typeof n=="function"?n({...e,placement:t}):n,b=typeof p=="number",{mainAxis:h,crossAxis:d,alignmentAxis:v}=b?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};return o&&typeof v=="number"&&(d=o==="end"?v*-1:v),l?{x:d*s,y:h*c}:{x:h*c,y:d*s}}var Or=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){let{x:n,y:r,placement:i,rects:o,platform:l,elements:c}=e,s=Lr(i,o,t,await(l.isRTL==null?void 0:l.isRTL(c.floating)));return{x:n+s.x,y:r+s.y,data:s}}}};function Dr(t){return t==="x"?"y":"x"}var Rr=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:f=>{let{x:m,y:w}=f;return{x:m,y:w}}},...s}=t,p={x:n,y:r},b=await oe(e,s),h=ft(ot(i)),d=Dr(h),v=p[h],a=p[d];if(o){let f=h==="y"?"top":"left",m=h==="y"?"bottom":"right",w=v+b[f],E=v-b[m];v=ee(w,v,E)}if(l){let f=d==="y"?"top":"left",m=d==="y"?"bottom":"right",w=a+b[f],E=a-b[m];a=ee(w,a,E)}let u=c.fn({...e,[h]:v,[d]:a});return{...u,data:{x:u.x-n,y:u.y-r}}}}},Fr=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){let{placement:n,rects:r,platform:i,elements:o}=e,{apply:l,...c}=t,s=await oe(e,c),p=ot(n),b=Nt(n),h,d;p==="top"||p==="bottom"?(h=p,d=b===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(d=p,h=b==="end"?"top":"bottom");let v=tt(s.left,0),a=tt(s.right,0),u=tt(s.top,0),f=tt(s.bottom,0),m={height:r.floating.height-(["left","right"].includes(n)?2*(u!==0||f!==0?u+f:tt(s.top,s.bottom)):s[h]),width:r.floating.width-(["top","bottom"].includes(n)?2*(v!==0||a!==0?v+a:tt(s.left,s.right)):s[d])},w=await i.getDimensions(o.floating);l?.({...m,...r});let E=await i.getDimensions(o.floating);return w.width!==E.width||w.height!==E.height?{reset:{rects:!0}}:{}}}};function sn(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function q(t){if(t==null)return window;if(!sn(t)){let e=t.ownerDocument;return e&&e.defaultView||window}return t}function ht(t){return q(t).getComputedStyle(t)}function K(t){return sn(t)?"":t?(t.nodeName||"").toLowerCase():""}function j(t){return t instanceof q(t).HTMLElement}function it(t){return t instanceof q(t).Element}function Mr(t){return t instanceof q(t).Node}function ae(t){let e=q(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function jt(t){let{overflow:e,overflowX:n,overflowY:r}=ht(t);return/auto|scroll|overlay|hidden/.test(e+r+n)}function Ir(t){return["table","td","th"].includes(K(t))}function cn(t){let e=navigator.userAgent.toLowerCase().includes("firefox"),n=ht(t);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||e&&n.willChange==="filter"||e&&(n.filter?n.filter!=="none":!1)}function un(){return!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var Je=Math.min,dt=Math.max,It=Math.round;function nt(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);let r=t.getBoundingClientRect(),i=1,o=1;e&&j(t)&&(i=t.offsetWidth>0&&It(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&It(r.height)/t.offsetHeight||1);let l=it(t)?q(t):window,c=!un()&&n,s=(r.left+(c?l.visualViewport.offsetLeft:0))/i,p=(r.top+(c?l.visualViewport.offsetTop:0))/o,b=r.width/i,h=r.height/o;return{width:b,height:h,top:p,right:s+b,bottom:p+h,left:s,x:s,y:p}}function U(t){return((Mr(t)?t.ownerDocument:t.document)||window.document).documentElement}function Wt(t){return it(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function dn(t){return nt(U(t)).left+Wt(t).scrollLeft}function Nr(t){let e=nt(t);return It(e.width)!==t.offsetWidth||It(e.height)!==t.offsetHeight}function jr(t,e,n){let r=j(e),i=U(e),o=nt(t,r&&Nr(e),n==="fixed"),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};if(r||!r&&n!=="fixed")if((K(e)!=="body"||jt(i))&&(l=Wt(e)),j(e)){let s=nt(e,!0);c.x=s.x+e.clientLeft,c.y=s.y+e.clientTop}else i&&(c.x=dn(i));return{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function le(t){return K(t)==="html"?t:t.assignedSlot||t.parentNode||(ae(t)?t.host:null)||U(t)}function Ze(t){return!j(t)||getComputedStyle(t).position==="fixed"?null:t.offsetParent}function Wr(t){let e=le(t);for(ae(e)&&(e=e.host);j(e)&&!["html","body"].includes(K(e));){if(cn(e))return e;e=e.parentNode}return null}function ne(t){let e=q(t),n=Ze(t);for(;n&&Ir(n)&&getComputedStyle(n).position==="static";)n=Ze(n);return n&&(K(n)==="html"||K(n)==="body"&&getComputedStyle(n).position==="static"&&!cn(n))?e:n||Wr(t)||e}function Qe(t){if(j(t))return{width:t.offsetWidth,height:t.offsetHeight};let e=nt(t);return{width:e.width,height:e.height}}function Br(t){let{rect:e,offsetParent:n,strategy:r}=t,i=j(n),o=U(n);if(n===o)return e;let l={scrollLeft:0,scrollTop:0},c={x:0,y:0};if((i||!i&&r!=="fixed")&&((K(n)!=="body"||jt(o))&&(l=Wt(n)),j(n))){let s=nt(n,!0);c.x=s.x+n.clientLeft,c.y=s.y+n.clientTop}return{...e,x:e.x-l.scrollLeft+c.x,y:e.y-l.scrollTop+c.y}}function Hr(t,e){let n=q(t),r=U(t),i=n.visualViewport,o=r.clientWidth,l=r.clientHeight,c=0,s=0;if(i){o=i.width,l=i.height;let p=un();(p||!p&&e==="fixed")&&(c=i.offsetLeft,s=i.offsetTop)}return{width:o,height:l,x:c,y:s}}function zr(t){var e;let n=U(t),r=Wt(t),i=(e=t.ownerDocument)==null?void 0:e.body,o=dt(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),l=dt(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),c=-r.scrollLeft+dn(t),s=-r.scrollTop;return ht(i||n).direction==="rtl"&&(c+=dt(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:l,x:c,y:s}}function fn(t){let e=le(t);return["html","body","#document"].includes(K(e))?t.ownerDocument.body:j(e)&&jt(e)?e:fn(e)}function se(t,e){var n;e===void 0&&(e=[]);let r=fn(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),o=q(r),l=i?[o].concat(o.visualViewport||[],jt(r)?r:[]):r,c=e.concat(l);return i?c:c.concat(se(le(l)))}function Vr(t,e){let n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&ae(n)){let r=e;do{if(r&&t===r)return!0;r=r.parentNode||r.host}while(r)}return!1}function Kr(t,e){let n=nt(t,!1,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:r,left:i,x:i,y:r,right:i+t.clientWidth,bottom:r+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}function tn(t,e,n){return e==="viewport"?Ft(Hr(t,n)):it(e)?Kr(e,n):Ft(zr(U(t)))}function qr(t){let e=se(t),n=["absolute","fixed"].includes(ht(t).position)&&j(t)?ne(t):t;return it(n)?e.filter(r=>it(r)&&Vr(r,n)&&K(r)!=="body"):[]}function $r(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,o=[...n==="clippingAncestors"?qr(e):[].concat(n),r],l=o[0],c=o.reduce((s,p)=>{let b=tn(e,p,i);return s.top=dt(b.top,s.top),s.right=Je(b.right,s.right),s.bottom=Je(b.bottom,s.bottom),s.left=dt(b.left,s.left),s},tn(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}var _r={getClippingRect:$r,convertOffsetParentRelativeRectToViewportRelativeRect:Br,isElement:it,getDimensions:Qe,getOffsetParent:ne,getDocumentElement:U,getElementRects:t=>{let{reference:e,floating:n,strategy:r}=t;return{reference:jr(e,ne(n),r),floating:{...Qe(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>ht(t).direction==="rtl"},Ur=(t,e,n)=>wr(t,e,{platform:_r,...n}),Yr=()=>{},ro=(()=>{let t=0;return()=>(t++,t.toString(36))})(),Z=new Map,_=new Map;function Gr(t,e,n,r){var i;if(!t)return Yr;let o=JSON.stringify({type:e,options:r}),l=Z.get(t);if(Z.has(t))l!=null&&l.has(o)?(i=l?.get(o))==null||i.add(n):l?.set(o,new Set([n]));else{let s=new Map([[o,new Set([n])]]);Z.set(t,s)}function c(s){var p,b;function h(d){var v;(v=Z.get(s)?.get(o))==null||v.forEach(u=>u(d))}if(!(_!=null&&_.has(s))){_.set(s,new Map([[o,h]])),s.addEventListener(e,h,r);return}(p=_?.get(s))!=null&&p.has(o)||((b=_.get(s))==null||b.set(o,h),s.addEventListener(e,h,r))}return c(t),function(){var s,p,b,h;if(!Z.has(t))return;let d=Z.get(t);if((s=d?.get(o))==null||s.delete(n),((p=d?.get(o))==null?void 0:p.size)===0){let v=(b=_.get(t))==null?void 0:b.get(o);t.removeEventListener(e,v,r),d?.delete(o),(h=_.get(t))==null||h.delete(o),d?.size===0&&(Z.delete(t),_.delete(t))}}}var hn=t=>Object.prototype.toString.call(t).slice(8,-1),Xr=t=>hn(t)==="Object"&&"current"in t,Jr=t=>hn(t)==="Function"?t():t;function en(t,e,n,r){let i=Xr(t)?t.current:Jr(t);return Gr(i,e,n,r)}function Zr(t){var e;return Qr(t)?t.document:(e=t?.ownerDocument)!=null?e:document}function nn(t){return typeof t=="object"&&t?.nodeType===Node.ELEMENT_NODE&&typeof t?.nodeName=="string"}function Qr(t){return t?.toString()==="[object Window]"}var io=["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(","),et=new Map;function rn(t,e){let n=et.get(t);return n?(n.callbacks.push(e),e(t.getBoundingClientRect())):(et.set(t,{rect:{},callbacks:[e]}),et.size===1&&(re=requestAnimationFrame(pn))),function(){let r=et.get(t);if(!r)return;let i=r.callbacks.indexOf(e);i>-1&&r.callbacks.splice(i,1),r.callbacks.length===0&&(et.delete(t),et.size===0&&cancelAnimationFrame(re))}}var re;function pn(){let t=[];et.forEach((e,n)=>{let r=n.getBoundingClientRect();ti(e.rect,r)||(e.rect=r,t.push(e))}),t.forEach(e=>{e.callbacks.forEach(n=>n(e.rect))}),re=requestAnimationFrame(pn)}function ti(t,e){return t.width===e.width&&t.height===e.height&&t.top===e.top&&t.right===e.right&&t.bottom===e.bottom&&t.left===e.left}var on=()=>{},Rt=(...t)=>e=>t.reduce((n,r)=>r(n),e),oo=(()=>{let t=0;return()=>(t++,t.toString(36))})(),ei=t=>t===!0||t===!1;function ni(t){return ei(t)?{ancestorResize:t,ancestorScroll:t,referenceResize:t}:Object.assign({ancestorResize:!0,ancestorScroll:!0,referenceResize:!0},t)}function ri(t,e,n,r=!1){let{ancestorScroll:i,ancestorResize:o,referenceResize:l}=ni(r),c=i||o,s=[];c&&nn(t)&&s.push(...se(t));function p(){let h=[rn(e,n)];return l&&nn(t)&&h.push(rn(t,n)),h.push(Rt(...s.map(d=>en(d,"resize",n)))),()=>h.forEach(d=>d())}function b(){return Rt(...s.map(h=>en(h,"scroll",n,{passive:!0})))}return Rt(p(),b())}var Q=t=>({variable:t,reference:`var(${t})`}),L={arrowShadowColor:Q("--arrow-shadow-color"),arrowSize:Q("--arrow-size"),arrowSizeHalf:Q("--arrow-size-half"),arrowBg:Q("--arrow-background"),transformOrigin:Q("--transform-origin"),arrowOffset:Q("--arrow-offset"),boxShadow:Q("--arrow-box-shadow")},an={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},ii={name:"transformOrigin",fn({placement:t,elements:e}){let{floating:n}=e;return n.style.setProperty(L.transformOrigin.variable,an[t]),{data:{transformOrigin:an[t]}}}},oi=t=>({name:"shiftArrow",fn({placement:e,middlewareData:n}){var r;let{element:i}=t,{x:o,y:l}=(r=n.arrow)!=null?r:{x:0,y:0},c={top:"bottom",right:"left",bottom:"top",left:"right"}[e.split("-")[0]];return Object.assign(i.style,{top:`${l}px`,left:`${o}px`,[c]:L.arrowOffset.reference,[L.boxShadow.variable]:ai(e)}),{}}});function ai(t){if(t.includes("top"))return`1px 1px 1px 0 ${L.arrowShadowColor.reference}`;if(t.includes("bottom"))return`-1px -1px 1px 0 ${L.arrowShadowColor.reference}`;if(t.includes("right"))return`-1px 1px 1px 0 ${L.arrowShadowColor.reference}`;if(t.includes("left"))return`1px -1px 1px 0 ${L.arrowShadowColor.reference}`}var li={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,sameWidth:!1};function vn(t,e,n={}){var r;if(t==null||e==null)return on;n=Object.assign({},li,n);let i=[ii];if(n.flip&&i.push(Pr({boundary:n.boundary,padding:8})),n.gutter||n.offset){let c=n.gutter?{mainAxis:n.gutter}:n.offset;i.push(Or(c))}i.push(Rr({boundary:n.boundary}));let o=Zr(e).querySelector("[data-part=arrow]");o&&i.push(Tr({element:o,padding:8}),oi({element:o})),n.sameWidth&&i.push(Fr({apply(c){let{width:s}=c.reference;Object.assign(e.style,{width:`${s}px`,minWidth:"unset"})}}));function l(){if(t==null||e==null)return;let{placement:c,strategy:s}=n;Ur(t,e,{placement:c,middleware:i,strategy:s}).then(p=>{let{x:b,y:h,strategy:d}=p;return Object.assign(e.style,{left:`${b}px`,top:`${h}px`,position:d}),p}).then(p=>{var b;(b=n.onComplete)==null||b.call(n,p)})}return l(),Rt(ri(t,e,l,n.listeners),(r=n.onCleanup)!=null?r:on)}var si={position:"fixed",top:0,left:0,opacity:0,transform:"translate3d(0, -200%, 0)",pointerEvents:"none"};function gn(t){let{measured:e,strategy:n="absolute"}=t;return{arrow:{position:"absolute",width:L.arrowSize.reference,height:L.arrowSize.reference,[L.arrowSizeHalf.variable]:`calc(${L.arrowSize.reference} / 2)`,[L.arrowOffset.variable]:`calc(${L.arrowSizeHalf.reference} * -1)`,opacity:e?void 0:0},innerArrow:{transform:"rotate(45deg)",background:L.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:n,minWidth:"max-content",...!e&&si}}}function ci(t){return{button:t,label:t,input:t,output:t,element:t}}var mn=ci(t=>t);var bn=t=>t[0],yn=t=>t[t.length-1];function ui(t,e,n={}){let{step:r=1,loop:i=!0}=n,o=e+r,l=t.length,c=l-1;return e===-1?r>0?0:c:o<0?i?c:0:o>=l?i?0:e>l?l:e:o}function ce(t,e,n={}){return t[ui(t,e,n)]}var Bt=(t,...e)=>{let n=typeof t=="function"?t(...e):t;return n??void 0},wn=t=>t;var so=(()=>{let t=0;return()=>(t++,t.toString(36))})();var x={getDoc:t=>{var e;return(e=t.doc)!=null?e:document},getActiveEl:t=>x.getDoc(t).activeElement,getAnchorId:t=>{var e,n;return(n=(e=t.ids)==null?void 0:e.anchor)!=null?n:`popover-${t.uid}-anchor`},getTriggerId:t=>{var e,n;return(n=(e=t.ids)==null?void 0:e.trigger)!=null?n:`popover-${t.uid}-trigger`},getContentId:t=>{var e,n;return(n=(e=t.ids)==null?void 0:e.content)!=null?n:`popover-${t.uid}-content`},getPositionerId:t=>`popover-${t.uid}-popper`,getArrowId:t=>`popover-${t.uid}-arrow`,getTitleId:t=>{var e,n;return(n=(e=t.ids)==null?void 0:e.title)!=null?n:`popover-${t.uid}-title`},getDescriptionId:t=>{var e,n;return(n=(e=t.ids)==null?void 0:e.description)!=null?n:`popover-${t.uid}-desc`},getCloseButtonId:t=>{var e,n;return(n=(e=t.ids)==null?void 0:e.closeBtn)!=null?n:`popover-${t.uid}-close-button`},getAnchorEl:t=>x.getDoc(t).getElementById(x.getAnchorId(t)),getTriggerEl:t=>x.getDoc(t).getElementById(x.getTriggerId(t)),getContentEl:t=>x.getDoc(t).getElementById(x.getContentId(t)),getPositionerEl:t=>x.getDoc(t).getElementById(x.getPositionerId(t)),getTitleEl:t=>x.getDoc(t).getElementById(x.getTitleId(t)),getDescriptionEl:t=>x.getDoc(t).getElementById(x.getDescriptionId(t)),getFocusableEls:t=>Qt(x.getContentEl(t)),getFirstFocusableEl:t=>x.getFocusableEls(t)[0],getDocTabbableEls:t=>te(wn(x.getDoc(t))),getTabbableEls:t=>{let e=x.getContentEl(t);return e?te(e):[]},getFirstTabbableEl:t=>bn(x.getTabbableEls(t)),getLastTabbableEl:t=>yn(x.getTabbableEls(t)),getInitialFocusEl:t=>{var e;return(e=Bt(t.initialFocusEl))!=null?e:x.getFirstFocusableEl(t)}};function En(t,e,n=mn){let r=t.matches("open"),i=t.context.pointerdownNode,o=gn({measured:!!t.context.isPlacementComplete});return{portalled:t.context.currentPortalled,isOpen:r,open(){e("OPEN")},close(){e("CLOSE")},arrowProps:n.element({id:x.getArrowId(t.context),"data-part":"arrow",style:o.arrow}),innerArrowProps:n.element({"data-part":"arrow-inner",style:o.innerArrow}),anchorProps:n.element({"data-part":"anchor",id:x.getAnchorId(t.context)}),triggerProps:n.button({"data-part":"trigger",type:"button","data-placement":t.context.currentPlacement,id:x.getTriggerId(t.context),"aria-haspopup":"dialog","aria-expanded":r,"data-expanded":De(r),"aria-controls":x.getContentId(t.context),onClick(){e("TRIGGER_CLICK")}}),positionerProps:n.element({id:x.getPositionerId(t.context),"data-part":"positioner",style:o.floating}),contentProps:n.element({"data-part":"content",id:x.getContentId(t.context),tabIndex:-1,role:"dialog",hidden:!r,"aria-labelledby":t.context.isTitleRendered?x.getTitleId(t.context):void 0,"aria-describedby":t.context.isDescriptionRendered?x.getDescriptionId(t.context):void 0,"data-placement":t.context.currentPlacement,onKeyDown(l){let s={Escape(p){e("ESCAPE"),p.stopPropagation()},Tab(p){let b=p.shiftKey?"SHIFT_TAB":"TAB";e({type:b,preventDefault:()=>p.preventDefault()})}}[l.key];s==null||s(l)},onBlur(l){var s;if(_e(l,{exclude:[x.getTriggerEl(t.context),x.getContentEl(t.context)],fallback:i})){let p=(s=l.relatedTarget)!=null?s:i;e({type:"INTERACT_OUTSIDE",focusable:Dt(p)})}}}),titleProps:n.element({"data-part":"title",id:x.getTitleId(t.context)}),descriptionProps:n.element({"data-part":"description",id:x.getDescriptionId(t.context)}),closeButtonProps:n.button({"data-part":"close-button",id:x.getCloseButtonId(t.context),type:"button","aria-label":"close",onClick(){e("CLOSE")}})}}var qt={},xo=Symbol(),To=Symbol(),di=Symbol(),xn=Object.getPrototypeOf,he=new WeakMap,fi=t=>t&&(he.has(t)?he.get(t):xn(t)===Object.prototype||xn(t)===Array.prototype),hi=t=>fi(t)&&t[di]||null,Tn=(t,e=!0)=>{he.set(t,e)},Rn=Symbol(),W=Symbol(),Vt=Symbol(),pi=Symbol(),pt=Symbol(),Sn=Symbol(),ve=new WeakSet;function gt(t){return ve.add(t),t}var Kt=t=>typeof t=="object"&&t!==null,vi=t=>Kt(t)&&!ve.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer),Cn=new WeakMap,An=1,kn=new WeakMap;function ge(t={}){if(!Kt(t))throw new Error("object required");let e=Cn.get(t);if(e)return e;let n=An,r=new Set,i=(d,v=++An)=>{n!==v&&(n=v,r.forEach(a=>a(d,v)))},o=new Map,l=d=>{let v=o.get(d);return v||(v=(a,u)=>{let f=[...a];f[1]=[d,...f[1]],i(f,u)},o.set(d,v)),v},c=d=>{let v=o.get(d);return o.delete(d),v},s=(d,v)=>{let a=kn.get(v);if(a?.[0]===n)return a[1];let u=Array.isArray(d)?[]:Object.create(Object.getPrototypeOf(d));return Tn(u,!0),kn.set(v,[n,u]),Reflect.ownKeys(d).forEach(f=>{let m=Reflect.get(d,f,v);if(ve.has(m))Tn(m,!1),u[f]=m;else if(m instanceof Promise)if(pt in m)u[f]=m[pt];else{let w=m[Sn]||m;Object.defineProperty(u,f,{get(){if(pt in m)return m[pt];throw w}})}else m?.[W]?u[f]=m[Vt]:u[f]=m}),Object.freeze(u),u},p=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t)),b={get(d,v,a){return v===Rn?n:v===W?r:v===Vt?s(d,a):v===pi?b:Reflect.get(d,v,a)},deleteProperty(d,v){let a=Reflect.get(d,v),u=a?.[W];u&&u.delete(c(v));let f=Reflect.deleteProperty(d,v);return f&&i(["delete",[v],a]),f},is:Object.is,canProxy:vi,set(d,v,a,u){var f;let m=Reflect.get(d,v,u);if(this.is(m,a))return!0;let w=m?.[W];w&&w.delete(c(v)),Kt(a)&&(a=hi(a)||a);let E;return(f=Object.getOwnPropertyDescriptor(d,v))!=null&&f.set?E=a:a instanceof Promise?E=a.then(T=>(E[pt]=T,i(["resolve",[v],T]),T)).catch(T=>{E[Sn]=T,i(["reject",[v],T])}):a?.[W]?(E=a,E[W].add(l(v))):this.canProxy(a)?(E=ge(a),E[W].add(l(v))):E=a,Reflect.set(d,v,E,u),i(["set",[v],a,m]),!0}},h=new Proxy(p,b);return Cn.set(t,h),Reflect.ownKeys(t).forEach(d=>{let v=Object.getOwnPropertyDescriptor(t,d);v.get||v.set?Object.defineProperty(p,d,v):h[d]=t[d]}),h}function Pn(t){return Kt(t)?t[Rn]:void 0}function me(t,e,n){(qt.env&&qt.env.MODE)!=="production"&&!t?.[W]&&console.warn("Please use proxy object");let r,i=[],o=l=>{if(i.push(l),n){e(i.splice(0));return}r||(r=Promise.resolve().then(()=>{r=void 0,e(i.splice(0))}))};return t[W].add(o),()=>{t[W].delete(o)}}function gi(t){return(qt.env&&qt.env.MODE)!=="production"&&!t?.[Vt]&&console.warn("Please use proxy object"),t[Vt]}function mi(t){for(;t.length>0;)t.pop();return t}var Ln=(t,...e)=>(typeof t=="function"?t(...e):t)??void 0,B=t=>t,On=()=>{};var bi=(()=>{let t=0;return()=>(t++,t.toString(36))})(),at=t=>Array.isArray(t),mt=t=>!(t==null||typeof t!="object"||at(t)),yi=t=>typeof t=="number"&&!Number.isNaN(t),O=t=>typeof t=="string",lt=t=>typeof t=="function";function ue(...t){let e=t.length===1?t[0]:t[1],n=t.length===2?t[0]:!0}function de(...t){let e=t.length===1?t[0]:t[1],n=t.length===2?t[0]:!0}function Fn(t){return{predicate:e=>(n,r)=>{var i;return(i=t.find(o=>{var l;return o.guard=o.guard||(()=>!0),O(o.guard)?!!((l=e[o.guard])!=null&&l.call(e,n,r)):Mn(o.guard)?o.guard.predicate(e??{})(n,r):o.guard(n,r)}))==null?void 0:i.actions}}}function Mn(t){return mt(t)&&t.predicate!=null}function fe(t,e){return(n,r)=>Mn(t)?t.predicate(e??{})(n,r):t}function wi(...t){return{predicate:e=>(n,r)=>t.map(i=>{var o;return O(i)?!!((o=e[i])!=null&&o.call(e,n,r)):lt(i)?i(n,r):i.predicate(e)(n,r)}).some(Boolean)}}function Ei(...t){return{predicate:e=>(n,r)=>t.map(i=>{var o;return O(i)?!!((o=e[i])!=null&&o.call(e,n,r)):lt(i)?i(n,r):i.predicate(e)(n,r)}).every(Boolean)}}function xi(t){return{predicate:e=>(n,r)=>{var i;return O(t)?!((i=e[t])!=null&&i.call(e,n,r)):lt(t)?!t(n,r):!t.predicate(e)(n,r)}}}var In={or:wi,and:Ei,not:xi};function Ti(t){return mt(t)&&t.predicate!=null}var Si=()=>!0;function Nn(t,e){return t=t??Si,(n,r)=>{if(O(t)){let i=e?.[t];return lt(i)?i(n,r):i}return Ti(t)?t.predicate(e??{})(n,r):t?.(n,r)}}function vt(t){var e,n,r;if(Array.isArray(t)){for(n=Array(e=t.length);e--;)n[e]=(r=t[e])&&typeof r=="object"?vt(r):r;return n}if(Object.prototype.toString.call(t)==="[object Object]"){n={};for(e in t)e==="__proto__"?Object.defineProperty(n,e,{value:vt(t[e]),configurable:!0,enumerable:!0,writable:!0}):n[e]=(r=t[e])&&typeof r=="object"?vt(r):r;return n}return t}function Dn(t,e,n,r){return me(t,i=>{i.some(o=>o[1][0]===e)&&n(t[e])},r)}var So=Symbol(),rt=new WeakMap,bt=new WeakMap,jn=(t,e)=>{let n=rt.get(t);n&&(n[0].forEach(r=>{let{d:i}=r;t!==i&&jn(i)}),++n[2],e&&n[3].add(e))},Ci=(t,e)=>{let n=rt.get(t);return n?.[2]?(n[3].add(e),!0):!1},pe=t=>{let e=rt.get(t);e&&(--e[2],e[2]||(e[3].forEach(n=>n()),e[3].clear()),e[0].forEach(n=>{let{d:r}=n;t!==r&&pe(r)}))},Ai=t=>{let{s:e,d:n}=t,r=bt.get(n);r||(r=[new Set],bt.set(t.d,r)),r[0].add(t);let i=rt.get(e);if(!i){let o=new Set,l=me(e,c=>{o.forEach(s=>{let{d:p,c:b,n:h,i:d}=s;e===p&&c.every(v=>v[1].length===1&&d.includes(v[1][0]))||s.p||(jn(e,b),h?pe(e):s.p=Promise.resolve().then(()=>{delete s.p,pe(e)}))})},!0);i=[o,l,0,new Set],rt.set(e,i)}i[0].add(t)},Wn=t=>{let{s:e,d:n}=t,r=bt.get(n);r?.[0].delete(t),r?.[0].size===0&&bt.delete(n);let i=rt.get(e);if(i){let[o,l]=i;o.delete(t),o.size||(l(),rt.delete(e))}},ki=t=>{let e=bt.get(t);return e?Array.from(e[0]):[]};function Pi(t,e){let n=e?.proxy||ge({}),r=!!e?.sync,i=Object.keys(t);return i.forEach(o=>{if(Object.getOwnPropertyDescriptor(n,o))throw new Error("object property already defined");let l=t[o],c=null,s=()=>{if(c&&(Array.from(c).map(([d])=>Ci(d,s)).some(d=>d)||Array.from(c).every(([d,v])=>Pn(d)===v.v)))return;let p=new Map,b=l(d=>(p.set(d,{v:Pn(d)}),d)),h=()=>{p.forEach((d,v)=>{var a;let u=(a=c?.get(v))==null?void 0:a.s;if(u)d.s=u;else{let f={s:v,d:n,k:o,c:s,n:r,i};Ai(f),d.s=f}}),c?.forEach((d,v)=>{!p.has(v)&&d.s&&Wn(d.s)}),c=p};b instanceof Promise?b.finally(h):h(),n[o]=b};s()}),n}function Li(t,e){let n=e?.delete?new Set:null;ki(t).forEach(r=>{let{k:i}=r;(!e?.keys||e.keys.includes(i))&&(Wn(r),n&&n.add(i))}),n&&n.forEach(r=>{delete t[r]})}function Oi(t){var e;let n=ge({value:"",previousValue:"",event:B({}),context:(e=t.context)!=null?e:B({}),done:!1,tags:[],hasTag(r){return this.tags.includes(r)},matches(...r){return r.includes(this.value)},can(r){return B(this).nextEvents.includes(r)},get nextEvents(){var r,i,o,l;let c=(o=(i=(r=t.states)==null?void 0:r[this.value])==null?void 0:i.on)!=null?o:{},s=(l=t?.on)!=null?l:{};return Object.keys({...c,...s})},get changed(){return this.event.value==="machine.init"||!this.previousValue?!1:this.value!==this.previousValue}});return B(n)}function Ht(t,e){return(n,r)=>{if(yi(t))return t;if(lt(t))return t(n,r);if(O(t)){let i=Number.parseFloat(t);if(!Number.isNaN(i))return i;if(e){let o=e?.[t];if(o==null){let l=`[machine] Cannot determine delay for ${t}. It doesn't exist in options.delays`;throw new Error(l)}return lt(o)?o(n,r):o}}}}function R(t){return O(t)?{type:t}:t}function Y(t){return t?at(t)?t:[t]:[]}function Bn(t){return O(t)?{target:t}:t}function Di(t,e){return(n,r)=>Y(t).map(Bn).find(i=>{var o;let l=Nn(i.guard,e)(n,r);return(o=l??i.target)!=null?o:i.actions})}function Ri(t,e){let n=O(t)?Bn(t):t,r=i=>(i.actions&&!i.target&&e&&(i.target=e),i);if(at(n))return n.map(r);if(mt(n))return r(B(n))}var zt=class{constructor(t,e){this.config=t,this.status="Not Started",this.type="machine",this.activityEvents=new Map,this.delayedEvents=new Map,this.stateListeners=new Set,this.eventListeners=new Set,this.doneListeners=new Set,this.contextWatchers=new Set,this.removeStateListener=On,this.removeEventListener=On,this.children=new Map,this.start=a=>{if(this.status==="Running")return this;this.status="Running";let u=R("machine.init");if(a){let w=mt(a)?a:{context:this.config.context,value:a};this.setState(w.value),this.setContext(w.context)}let f={target:a?void 0:this.config.initial},m=this.getNextStateInfo(f,u);return m.target=B(m.target||f.target),this.initialState=m,this.performStateChangeEffects(m.target,m,u),this.removeStateListener=me(this.state,()=>{this.stateListeners.forEach(w=>{w(this.stateSnapshot)})},this.sync),this.removeEventListener=Dn(this.state,"event",w=>{this.config.onEvent&&this.executeActions(this.config.onEvent,w);for(let E of this.eventListeners)E(w)}),this.setupContextWatchers(),this.executeActivities(R("machine.start"),Y(this.config.activities),"machine.start"),this.executeActions(this.config.entry,R("machine.start")),this},this.setupContextWatchers=()=>{var a;for(let[u,f]of Object.entries((a=this.config.watch)!=null?a:{}))this.contextWatchers.add(Dn(this.state.context,u,()=>{this.executeActions(f,this.state.event)}))},this.setupComputed=()=>{var a;let u=B((a=this.config.computed)!=null?a:{}),f=Object.fromEntries(Object.entries(u).map(([m,w])=>[m,E=>w(E(this.state.context))]));Pi(f,{proxy:this.state.context})},this.detachComputed=()=>{Li(this.state.context,{delete:!0})},this.stop=()=>{if(this.status!=="Stopped")return this.setState(null),this.setEvent("machine.stop"),this.config.context&&this.setContext(this.config.context),this.stopStateListeners(),this.stopChildren(),this.stopActivities(),this.stopDelayedEvents(),this.stopContextWatchers(),this.stopEventListeners(),this.detachComputed(),this.status="Stopped",this.executeActions(this.config.exit,R("machine.stop")),this},this.stopEventListeners=()=>{this.eventListeners.clear(),this.removeEventListener()},this.stopStateListeners=()=>{this.removeStateListener(),this.stateListeners.clear()},this.stopContextWatchers=()=>{this.contextWatchers.forEach(a=>a()),this.contextWatchers.clear()},this.stopDelayedEvents=()=>{this.delayedEvents.forEach(a=>{a.forEach(u=>u())}),this.delayedEvents.clear()},this.stopActivities=a=>{var u,f;a?((u=this.activityEvents.get(a))==null||u.forEach(m=>m()),(f=this.activityEvents.get(a))==null||f.clear(),this.activityEvents.delete(a)):(this.activityEvents.forEach(m=>{m.forEach(w=>w()),m.clear()}),this.activityEvents.clear())},this.sendChild=(a,u)=>{let f=R(a),m=Ln(u,this.contextSnapshot),w=this.children.get(m);w||de(`[machine/send-child] Cannot send '${f.type}' event to unknown child`),w.send(f)},this.stopChild=a=>{this.children.has(a)||de("[machine/stop-child] Cannot stop unknown child"),this.children.get(a).stop(),this.children.delete(a)},this.removeChild=a=>{this.children.delete(a)},this.stopChildren=()=>{this.children.forEach(a=>a.stop()),this.children.clear()},this.setParent=a=>{this.parent=a},this.spawn=(a,u)=>{let f=Ln(a);return u&&(f.id=u),f.type="machine.actor",f.setParent(this),this.children.set(f.id,B(f)),f.onDone(()=>{this.removeChild(f.id)}).start(),B(gt(f))},this.addActivityCleanup=(a,u)=>{var f;!a||(this.activityEvents.has(a)?(f=this.activityEvents.get(a))==null||f.add(u):this.activityEvents.set(a,new Set([u])))},this.setState=a=>{this.state.previousValue=this.state.value,this.state.value=a;let u=this.getStateNode(a);a==null?mi(this.state.tags):this.state.tags=Y(u?.tags)},this.setContext=a=>{for(let u in a)this.state.context[u]=a[u]},this.withContext=a=>{this.detachComputed();let u={...this.config.context,...a};return new zt({...this.config,context:u},this.options)},this.withOptions=a=>(this.detachComputed(),new zt(this.config,{...this.options,...a})),this.setActions=a=>{this.actionMap={...this.actionMap,...a}},this.clone=()=>(this.detachComputed(),new zt(this.config,this.options)),this.getStateNode=a=>{var u;if(a)return(u=this.config.states)==null?void 0:u[a]},this.getNextStateInfo=(a,u)=>{var f;let m=this.determineTransition(a,u),w=(f=m?.target)!=null?f:this.state.value,E=this.getStateNode(w);return{transition:m,stateNode:E,target:w}},this.getActionFromDelayedTransition=a=>{let u=R("machine.after"),f=Ht(a.delay,this.delayMap)(this.contextSnapshot,u),m;return{entry:()=>{m=globalThis.setTimeout(()=>{let w=this.state.value,E=this.getNextStateInfo(a,u);this.performStateChangeEffects(w,E,u)},f)},exit:()=>{globalThis.clearTimeout(m)}}},this.getDelayedEventActions=a=>{let u=this.getStateNode(a),f=R("machine.after");if(!u||!u.after)return;let m=[],w=[];if(at(u.after)){let E=this.determineTransition(u.after,f);if(!E)return;let T=this.getActionFromDelayedTransition(E);m.push(T.entry),w.push(T.exit)}else if(mt(u.after))for(let E in u.after){let T=u.after[E],C={};if(at(T)){let y=this.determineTransition(T,f);y&&(C=y)}else O(T)?C={target:T,delay:E}:C={...T,delay:E};let g=this.getActionFromDelayedTransition(C);m.push(g.entry),w.push(g.exit)}return{entries:m,exits:w}},this.executeActions=(a,u)=>{var f;let m=fe(a,this.guardMap)(this.contextSnapshot,u);for(let w of Y(m)){let E=O(w)?(f=this.actionMap)==null?void 0:f[w]:w;ue(O(w)&&!E,`[machine/exec-action] No implementation found for action: \`${w}\``),E?.(this.state.context,u,this.meta)}},this.executeActivities=(a,u,f)=>{var m;for(let w of u){let E=O(w)?(m=this.activityMap)==null?void 0:m[w]:w;if(!E){ue(`[machine/exec-activity] No implementation found for activity: \`${w}\``);continue}let T=E(this.state.context,a,this.meta);T&&this.addActivityCleanup(f??this.state.value,T)}},this.createEveryActivities=(a,u)=>{if(!a)return;let f=R("machine.every");if(at(a)){let m=Y(a).find(E=>{let T=Ht(E.delay,this.delayMap);E.delay=T(this.contextSnapshot,f);let C=Nn(E.guard,this.guardMap)(this.contextSnapshot,f);return C??E.delay});if(!m)return;let w=Ht(m.delay,this.delayMap)(this.contextSnapshot,f);u(()=>{let E=globalThis.setInterval(()=>{this.executeActions(m.actions,f)},w);return()=>{globalThis.clearInterval(E)}})}else for(let m in a){let w=a?.[m],E=Ht(m,this.delayMap)(this.contextSnapshot,f);u(()=>{let T=globalThis.setInterval(()=>{this.executeActions(w,f)},E);return()=>{globalThis.clearInterval(T)}})}},this.setEvent=a=>{this.state.event=gt(R(a))},this.performExitEffects=(a,u)=>{let f=this.state.value,m=a?this.getStateNode(a):void 0;this.stopActivities(f);let w=fe(m?.exit,this.guardMap)(this.contextSnapshot,u),E=Y(w),T=this.delayedEvents.get(f);T&&E.push(...T),this.executeActions(E,u),this.eventListeners.clear()},this.performEntryEffects=(a,u)=>{let f=this.getStateNode(a),m=Y(f?.activities);this.createEveryActivities(f?.every,C=>{m.unshift(C)}),m.length>0&&this.executeActivities(u,m);let w=fe(f?.entry,this.guardMap)(this.contextSnapshot,u),E=Y(w),T=this.getDelayedEventActions(a);f?.after&&T&&(this.delayedEvents.set(a,T?.exits),E.push(...T.entries)),this.executeActions(E,u),f?.type==="final"&&(this.state.done=!0,this.doneListeners.forEach(C=>{C(this.stateSnapshot)}),this.stop())},this.performTransitionEffects=(a,u)=>{let f=this.determineTransition(a,u);this.executeActions(f?.actions,u)},this.performStateChangeEffects=(a,u,f)=>{var m,w;this.setEvent(f),u.target=(w=(m=u.target)!=null?m:this.state.value)!=null?w:void 0;let E=u.target&&u.target!==this.state.value;E&&this.performExitEffects(a,f),this.performTransitionEffects(u?.transition,f),this.setState(u.target),E&&this.performEntryEffects(u.target,f)},this.determineTransition=(a,u)=>{let f=Di(a,this.guardMap);return f?.(this.contextSnapshot,u)},this.sendParent=a=>{var u;this.parent||de("[machine/send-parent] Cannot send event to an unknown parent");let f=R(a);(u=this.parent)==null||u.send(f)},this.send=a=>{let u=R(a);this.transition(this.state.value,u)},this.transition=(a,u)=>{var f,m,w;let E=O(a)?this.getStateNode(a):a?.stateNode,T=R(u);if(!E&&!this.config.on){let S=this.status==="Stopped"?"[machine/transition] Cannot transition a stopped machine":"[machine/transition] State does not have a definition";ue(S);return}let C=(w=(f=E?.on)==null?void 0:f[T.type])!=null?w:(m=this.config.on)==null?void 0:m[T.type],g=Ri(C,this.state.value);if(!g)return;let y=this.getNextStateInfo(g,T);return this.performStateChangeEffects(this.state.value,y,T),y.stateNode},this.subscribe=a=>(this.stateListeners.add(a),this.status==="Running"&&a(this.stateSnapshot),()=>{this.stateListeners.delete(a)}),this.onDone=a=>(this.doneListeners.add(a),this),this.onTransition=a=>(this.stateListeners.add(a),this.status==="Running"&&a(this.stateSnapshot),this),this.onEvent=a=>(a(this.state.event),this.eventListeners.add(a),this);var n,r,i,o,l,c,s,p,b,h,d;this.options=vt(e),this.id=(n=t.id)!=null?n:`machine-${bi()}`,this.guardMap=(i=(r=this.options)==null?void 0:r.guards)!=null?i:{},this.actionMap=(l=(o=this.options)==null?void 0:o.actions)!=null?l:{},this.delayMap=(s=(c=this.options)==null?void 0:c.delays)!=null?s:{},this.activityMap=(b=(p=this.options)==null?void 0:p.activities)!=null?b:{},this.sync=(d=(h=this.options)==null?void 0:h.sync)!=null?d:!1,this.state=Oi(vt(t)),this.setupComputed();let v=R("machine.created");this.executeActions(t?.created,v)}get stateSnapshot(){return B(gi(this.state))}get contextSnapshot(){return this.stateSnapshot.context}get self(){let t=this;return{id:this.id,send:this.send.bind(this),sendParent:this.sendParent.bind(this),sendChild:this.sendChild.bind(this),stop:this.stop.bind(this),stopChild:this.stopChild.bind(this),spawn:this.spawn.bind(this),get state(){return t.stateSnapshot}}}get meta(){return{state:this.stateSnapshot,guards:this.guardMap,send:this.send.bind(this),listen:this.onEvent.bind(this),self:this.self,getState:()=>this.stateSnapshot}}},Hn=(t,e)=>new zt(t,e);var Fi=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},st=new WeakMap,$t=new WeakMap,_t={},be=0,zn=function(t,e,n){e===void 0&&(e=Fi(t)),n===void 0&&(n="data-aria-hidden");var r=Array.isArray(t)?t:[t];_t[n]||(_t[n]=new WeakMap);var i=_t[n],o=[],l=new Set,c=function(p){!p||l.has(p)||(l.add(p),c(p.parentNode))};r.forEach(c);var s=function(p){!p||r.indexOf(p)>=0||Array.prototype.forEach.call(p.children,function(b){if(l.has(b))s(b);else{var h=b.getAttribute("aria-hidden"),d=h!==null&&h!=="false",v=(st.get(b)||0)+1,a=(i.get(b)||0)+1;st.set(b,v),i.set(b,a),o.push(b),v===1&&d&&$t.set(b,!0),a===1&&b.setAttribute(n,"true"),d||b.setAttribute("aria-hidden","true")}})};return s(e),l.clear(),be++,function(){o.forEach(function(p){var b=st.get(p)-1,h=i.get(p)-1;st.set(p,b),i.set(p,h),b||($t.has(p)||p.removeAttribute("aria-hidden"),$t.delete(p)),h||p.removeAttribute(n)}),be--,be||(st=new WeakMap,st=new WeakMap,$t=new WeakMap,_t={})}};var Kn=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],Vn=Kn.join(","),Ut=typeof Element>"u"?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Mi=function(e,n,r){var i=Array.prototype.slice.apply(e.querySelectorAll(Vn));return n&&Ut.call(e,Vn)&&i.unshift(e),i=i.filter(r),i},Ii=function(e){return e.contentEditable==="true"},qn=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return isNaN(n)?Ii(e)||(e.nodeName==="AUDIO"||e.nodeName==="VIDEO"||e.nodeName==="DETAILS")&&e.getAttribute("tabindex")===null?0:e.tabIndex:n},Ni=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},ye=function(e){return e.tagName==="INPUT"},ji=function(e){return ye(e)&&e.type==="hidden"},Wi=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},Bi=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},Hi=function(e){if(!e.name)return!0;var n=e.form||e.ownerDocument,r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var o=Bi(i,e.form);return!o||o===e},zi=function(e){return ye(e)&&e.type==="radio"},Vi=function(e){return zi(e)&&!Hi(e)},Ki=function(e,n){if(getComputedStyle(e).visibility==="hidden")return!0;var r=Ut.call(e,"details>summary:first-of-type"),i=r?e.parentElement:e;if(Ut.call(i,"details:not([open]) *"))return!0;if(!n||n==="full")for(;e;){if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}else if(n==="non-zero-area"){var o=e.getBoundingClientRect(),l=o.width,c=o.height;return l===0&&c===0}return!1},qi=function(e){if(ye(e)||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.tagName==="BUTTON")for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return!i.contains(e)}return!0}n=n.parentElement}return!1},$n=function(e,n){return!(n.disabled||ji(n)||Ki(n,e.displayCheck)||Wi(n)||qi(n))},$i=function(e,n){return!(!$n(e,n)||Vi(n)||qn(n)<0)},_n=function(e,n){n=n||{};var r=[],i=[],o=Mi(e,n.includeContainer,$i.bind(null,n));o.forEach(function(c,s){var p=qn(c);p===0?r.push(c):i.push({documentOrder:s,tabIndex:p,node:c})});var l=i.sort(Ni).map(function(c){return c.node}).concat(r);return l};var _i=Kn.concat("iframe").join(","),Un=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Ut.call(e,_i)===!1?!1:$n(n,e)};function Yn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ui(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Yn(Object(n),!0).forEach(function(r){Yi(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Yn(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Yi(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Gn=function(){var t=[];return{activateTrap:function(n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var i=t.indexOf(n);i===-1||t.splice(i,1),t.push(n)},deactivateTrap:function(n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}}}(),Gi=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Xi=function(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27},Ji=function(e){return e.key==="Tab"||e.keyCode===9},Xn=function(e){return setTimeout(e,0)},we=function(e,n){var r=-1;return e.every(function(i,o){return n(i)?(r=o,!1):!0}),r},yt=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof e=="function"?e.apply(void 0,r):e},Yt=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Jn=function(e,n){var r=n?.document||document,i=Ui({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},n),o={containers:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},l,c=function(g,y,S){return g&&g[y]!==void 0?g[y]:i[S||y]},s=function(g){return!!(g&&o.containers.some(function(y){return y.contains(g)}))},p=function(g){var y=i[g];if(typeof y=="function"){for(var S=arguments.length,k=new Array(S>1?S-1:0),P=1;P<S;P++)k[P-1]=arguments[P];y=y.apply(void 0,k)}if(!y){if(y===void 0||y===!1)return y;throw new Error("`".concat(g,"` was specified but was not a node, or did not return a node"))}var A=y;if(typeof y=="string"&&(A=r.querySelector(y),!A))throw new Error("`".concat(g,"` as selector refers to no known node"));return A},b=function(){var g=p("initialFocus");if(g===!1)return!1;if(g===void 0)if(s(r.activeElement))g=r.activeElement;else{var y=o.tabbableGroups[0],S=y&&y.firstTabbableNode;g=S||p("fallbackFocus")}if(!g)throw new Error("Your focus-trap needs to have at least one focusable element");return g},h=function(){if(o.tabbableGroups=o.containers.map(function(g){var y=_n(g);if(y.length>0)return{container:g,firstTabbableNode:y[0],lastTabbableNode:y[y.length-1]}}).filter(function(g){return!!g}),o.tabbableGroups.length<=0&&!p("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},d=function C(g){if(g!==!1&&g!==r.activeElement){if(!g||!g.focus){C(b());return}g.focus({preventScroll:!!i.preventScroll}),o.mostRecentlyFocusedNode=g,Gi(g)&&g.select()}},v=function(g){var y=p("setReturnFocus",g);return y||(y===!1?!1:g)},a=function(g){var y=Yt(g);if(!s(y)){if(yt(i.clickOutsideDeactivates,g)){l.deactivate({returnFocus:i.returnFocusOnDeactivate&&!Un(y)});return}yt(i.allowOutsideClick,g)||g.preventDefault()}},u=function(g){var y=Yt(g),S=s(y);S||y instanceof Document?S&&(o.mostRecentlyFocusedNode=y):(g.stopImmediatePropagation(),d(o.mostRecentlyFocusedNode||b()))},f=function(g){var y=Yt(g);h();var S=null;if(o.tabbableGroups.length>0){var k=we(o.tabbableGroups,function(H){var z=H.container;return z.contains(y)});if(k<0)g.shiftKey?S=o.tabbableGroups[o.tabbableGroups.length-1].lastTabbableNode:S=o.tabbableGroups[0].firstTabbableNode;else if(g.shiftKey){var P=we(o.tabbableGroups,function(H){var z=H.firstTabbableNode;return y===z});if(P<0&&o.tabbableGroups[k].container===y&&(P=k),P>=0){var A=P===0?o.tabbableGroups.length-1:P-1,F=o.tabbableGroups[A];S=F.lastTabbableNode}}else{var M=we(o.tabbableGroups,function(H){var z=H.lastTabbableNode;return y===z});if(M<0&&o.tabbableGroups[k].container===y&&(M=k),M>=0){var D=M===o.tabbableGroups.length-1?0:M+1,N=o.tabbableGroups[D];S=N.firstTabbableNode}}}else S=p("fallbackFocus");S&&(g.preventDefault(),d(S))},m=function(g){if(Xi(g)&&yt(i.escapeDeactivates,g)!==!1){g.preventDefault(),l.deactivate();return}if(Ji(g)){f(g);return}},w=function(g){if(!yt(i.clickOutsideDeactivates,g)){var y=Yt(g);s(y)||yt(i.allowOutsideClick,g)||(g.preventDefault(),g.stopImmediatePropagation())}},E=function(){if(!!o.active)return Gn.activateTrap(l),o.delayInitialFocusTimer=i.delayInitialFocus?Xn(function(){d(b())}):d(b()),r.addEventListener("focusin",u,!0),r.addEventListener("mousedown",a,{capture:!0,passive:!1}),r.addEventListener("touchstart",a,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",m,{capture:!0,passive:!1}),l},T=function(){if(!!o.active)return r.removeEventListener("focusin",u,!0),r.removeEventListener("mousedown",a,!0),r.removeEventListener("touchstart",a,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",m,!0),l};return l={activate:function(g){if(o.active)return this;var y=c(g,"onActivate"),S=c(g,"onPostActivate"),k=c(g,"checkCanFocusTrap");k||h(),o.active=!0,o.paused=!1,o.nodeFocusedBeforeActivation=r.activeElement,y&&y();var P=function(){k&&h(),E(),S&&S()};return k?(k(o.containers.concat()).then(P,P),this):(P(),this)},deactivate:function(g){if(!o.active)return this;clearTimeout(o.delayInitialFocusTimer),o.delayInitialFocusTimer=void 0,T(),o.active=!1,o.paused=!1,Gn.deactivateTrap(l);var y=c(g,"onDeactivate"),S=c(g,"onPostDeactivate"),k=c(g,"checkCanReturnFocus");y&&y();var P=c(g,"returnFocus","returnFocusOnDeactivate"),A=function(){Xn(function(){P&&d(v(o.nodeFocusedBeforeActivation)),S&&S()})};return P&&k?(k(v(o.nodeFocusedBeforeActivation)).then(A,A),this):(A(),this)},pause:function(){return o.paused||!o.active?this:(o.paused=!0,T(),this)},unpause:function(){return!o.paused||!o.active?this:(o.paused=!1,h(),E(),this)},updateContainerElements:function(g){var y=[].concat(g).filter(Boolean);return o.containers=y.map(function(S){return typeof S=="string"?r.querySelector(S):S}),o.active&&h(),this}},l.updateContainerElements(e),l};var{and:Ee,or:Zi}=In,Zn=Hn({id:"popover",initial:"unknown",context:{isTitleRendered:!0,isDescriptionRendered:!0,isAnchorRendered:!1,uid:"",closeOnBlur:!0,closeOnEsc:!0,autoFocus:!0,modal:!1,positioning:{placement:"bottom"},currentPlacement:void 0},computed:{currentPortalled:t=>!!t.modal||!!t.portalled},states:{unknown:{on:{SETUP:{target:"closed",actions:["setupDocument","checkRenderedElements"]}}},closed:{entry:["clearPointerDown","invokeOnClose"],on:{TRIGGER_CLICK:"open",OPEN:"open"}},open:{activities:["trackPointerDown","trapFocus","preventScroll","hideContentBelow","disableOutsidePointerEvents","computePlacement"],entry:Fn([{guard:"autoFocus",actions:["setInitialFocus","invokeOnOpen"]},{actions:["focusContent","invokeOnOpen"]}]),on:{CLOSE:{target:"closed",actions:"focusTrigger"},TRIGGER_CLICK:{target:"closed",actions:"focusTrigger"},ESCAPE:{guard:"closeOnEsc",target:"closed",actions:"focusTrigger"},TAB:{guard:Ee("isLastTabbableElement","closeOnBlur","portalled"),target:"closed",actions:"focusNextTabbableElementAfterTrigger"},SHIFT_TAB:{guard:Ee(Zi("isFirstTabbableElement","isContentFocused"),"closeOnBlur","portalled"),target:"closed",actions:"focusTrigger"},INTERACT_OUTSIDE:[{guard:Ee("closeOnBlur","isRelatedTargetFocusable"),target:"closed"},{guard:"closeOnBlur",target:"closed",actions:"focusTrigger"}]}}}},{activities:{computePlacement(t){t.currentPlacement=t.positioning.placement;let e=t.isAnchorRendered?x.getAnchorEl(t):x.getTriggerEl(t);return vn(e,x.getPositionerEl(t),{...t.positioning,onComplete(n){t.currentPlacement=n.placement,t.isPlacementComplete=!0},onCleanup(){t.currentPlacement=void 0,t.isPlacementComplete=!1}})},trackPointerDown(t){return Ye(x.getDoc(t),e=>{t.pointerdownNode=gt(e)})},disableOutsidePointerEvents(t){let e=x.getContentEl(t);return je(e,{document:x.getDoc(t),disabled:!t.modal})},hideContentBelow(t){if(!t.modal)return;let e;return $(()=>{let n=x.getContentEl(t);if(!!n)try{e=zn(n)}catch(r){}}),()=>e==null?void 0:e()},preventScroll(t){return $e({allowPinchZoom:!0,disabled:!t.modal,document:x.getDoc(t)})},trapFocus(t){if(!t.modal)return;let e;return $(()=>{let n=x.getContentEl(t);if(!!n){e=Jn(n,{escapeDeactivates:!1,allowOutsideClick:!0,returnFocusOnDeactivate:!0,document:x.getDoc(t),fallbackFocus:n,initialFocus:Bt(t.initialFocusEl)});try{e.activate()}catch(r){}}}),()=>e==null?void 0:e.deactivate()}},guards:{closeOnEsc:t=>!!t.closeOnEsc,autoFocus:t=>!!t.autoFocus,modal:t=>!!t.modal,portalled:t=>!!t.portalled,isRelatedTargetFocusable:(t,e)=>e.focusable,closeOnBlur:t=>!!t.closeOnBlur,isContentFocused:t=>x.getContentEl(t)===x.getActiveEl(t),isFirstTabbableElement:t=>x.getFirstTabbableEl(t)===x.getActiveEl(t),isLastTabbableElement:t=>x.getLastTabbableEl(t)===x.getActiveEl(t)},actions:{checkRenderedElements(t){Fe(()=>{t.isAnchorRendered=!!x.getAnchorEl(t),t.isTitleRendered=!!x.getTitleEl(t),t.isDescriptionRendered=!!x.getDescriptionEl(t)})},setupDocument(t,e){e.doc&&(t.doc=gt(e.doc)),t.uid=e.id},clearPointerDown(t){t.pointerdownNode=null},focusContent(t){$(()=>{var e;(e=x.getContentEl(t))==null||e.focus()})},setInitialFocus(t){$(()=>{var e;(e=x.getInitialFocusEl(t))==null||e.focus()})},focusTrigger(t){$(()=>{var e;(e=x.getTriggerEl(t))==null||e.focus()})},invokeOnOpen(t,e){var n;e.type!=="SETUP"&&((n=t.onOpen)==null||n.call(t))},invokeOnClose(t,e){var n;e.type!=="SETUP"&&((n=t.onClose)==null||n.call(t))},focusNextTabbableElementAfterTrigger(t,e){let n=x.getContentEl(t),r=x.getDoc(t),i=x.getTriggerEl(t);if(!n||!i||x.getLastTabbableEl(t)!==r.activeElement)return;let l=x.getDocTabbableEls(t),c=ce(l,l.indexOf(i),{loop:!1});c===n&&(l=l.filter(s=>!ze(n,s)),c=ce(l,l.indexOf(i),{loop:!1})),!(!c||c===i)&&(e.preventDefault(),$(()=>c==null?void 0:c.focus()))}}});
/*!
* focus-trap 6.7.1
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/
/*!
* tabbable 5.2.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
//# sourceMappingURL=index.js.map

18

package.json
{
"name": "@zag-js/popover",
"version": "0.0.0-dev-20220412162814",
"version": "0.0.0-dev-20220412212252",
"description": "Core logic for the popover widget implemented as a state machine",

@@ -15,3 +15,3 @@ "keywords": [

"author": "Segun Adebayo <sage@adebayosegun.com>",
"homepage": "https://github.com/chakra-ui/ui-machines#readme",
"homepage": "https://github.com/chakra-ui/zag#readme",
"license": "MIT",

@@ -21,3 +21,3 @@ "main": "dist/index.js",

"module": "dist/index.mjs",
"repository": "https://github.com/chakra-ui/ui-machines/tree/main/packages/popover",
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/popover",
"sideEffects": false,

@@ -31,10 +31,10 @@ "files": [

"bugs": {
"url": "https://github.com/chakra-ui/ui-machines/issues"
"url": "https://github.com/chakra-ui/zag/issues"
},
"dependencies": {
"@zag-js/core": "^0.0.0-dev-20220412162814",
"@zag-js/dom-utils": "^0.0.0-dev-20220412162814",
"@zag-js/types": "^0.0.0-dev-20220412162814",
"@zag-js/popper": "^0.0.0-dev-20220412162814",
"@zag-js/utils": "^0.0.0-dev-20220412162814",
"@zag-js/core": "^0.0.0-dev-20220412212252",
"@zag-js/dom-utils": "^0.0.0-dev-20220412212252",
"@zag-js/types": "^0.0.0-dev-20220412212252",
"@zag-js/popper": "^0.0.0-dev-20220412212252",
"@zag-js/utils": "^0.0.0-dev-20220412212252",
"aria-hidden": "^1.1.3",

@@ -41,0 +41,0 @@ "focus-trap": "^6.7.1"

@@ -15,8 +15,6 @@ # @zag-js/popover

Yes please! See the [contributing guidelines](https://github.com/chakra-ui/ui-machines/blob/main/CONTRIBUTING.md) for
details.
Yes please! See the [contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md) for details.
## Licence
This project is licensed under the terms of the
[MIT license](https://github.com/chakra-ui/ui-machines/blob/main/LICENSE).
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE).

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