@sps-woodland/tabs 8.17.1 → 8.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),Z=require("@react-stately/collections"),Dt=require("react-dom"),N=require("@sps-woodland/core"),Be=require("@spscommerce/utils");function At(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const R=At(f);class Ue{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let r=this.keyMap.get(e);return r?r.prevKey:null}getKeyAfter(e){let r=this.keyMap.get(e);return r?r.nextKey:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const r=[...this.getKeys()];return this.getItem(r[e])}getChildren(e){let r=this.keyMap.get(e);return(r==null?void 0:r.childNodes)||[]}constructor(e){this.keyMap=new Map,this.iterable=e;let r=o=>{if(this.keyMap.set(o.key,o),o.childNodes&&o.type==="section")for(let s of o.childNodes)r(s)};for(let o of e)r(o);let n,i=0;for(let[o,s]of this.keyMap)n?(n.nextKey=o,s.prevKey=n.key):(this.firstKey=o,s.prevKey=void 0),s.type==="item"&&(s.index=i++),n=s,n.nextKey=void 0;this.lastKey=n==null?void 0:n.key}}class z extends Set{constructor(e,r,n){super(e),e instanceof z?(this.anchorKey=r||e.anchorKey,this.currentKey=n||e.currentKey):(this.anchorKey=r,this.currentKey=n)}}function lt(t,e,r){let[n,i]=f.useState(t||e),o=f.useRef(t!==void 0),s=t!==void 0;f.useEffect(()=>{let v=o.current;v!==s&&console.warn(`WARN: A component changed from ${v?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}.`),o.current=s},[s]);let u=s?t:n,b=f.useCallback((v,...h)=>{let w=($,...g)=>{r&&(Object.is(u,$)||r($,...g)),s||(u=$)};typeof v=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),i((g,...M)=>{let T=v(s?u:g,...M);return w(T,...h),s?g:T})):(s||i(v),w(v,...h))},[s,u,r]);return[u,b]}function Ot(t,e){if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;return!0}function Ft(t){let{selectionMode:e="none",disallowEmptySelection:r,allowDuplicateSelectionEvents:n,selectionBehavior:i="toggle",disabledBehavior:o="all"}=t,s=f.useRef(!1),[,u]=f.useState(!1),b=f.useRef(null),v=f.useRef(null),[,h]=f.useState(null),w=f.useMemo(()=>je(t.selectedKeys),[t.selectedKeys]),$=f.useMemo(()=>je(t.defaultSelectedKeys,new z),[t.defaultSelectedKeys]),[g,M]=lt(w,$,t.onSelectionChange),T=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),[P,L]=f.useState(i);i==="replace"&&P==="toggle"&&typeof g=="object"&&g.size===0&&L("replace");let k=f.useRef(i);return f.useEffect(()=>{i!==k.current&&(L(i),k.current=i)},[i]),{selectionMode:e,disallowEmptySelection:r,selectionBehavior:P,setSelectionBehavior:L,get isFocused(){return s.current},setFocused(x){s.current=x,u(x)},get focusedKey(){return b.current},get childFocusStrategy(){return v.current},setFocusedKey(x,I="first"){b.current=x,v.current=I,h(x)},selectedKeys:g,setSelectedKeys(x){(n||!Ot(x,g))&&M(x)},disabledKeys:T,disabledBehavior:o}}function je(t,e){return t?t==="all"?"all":new z(t):e}class zt{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,r){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,r)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){return this.state.selectionMode==="none"?!1:(e=this.getKey(e),this.state.selectedKeys==="all"?this.canSelectItem(e):this.state.selectedKeys.has(e))}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),r=this.state.selectedKeys;return this._isSelectAll=e.every(n=>r.has(n)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&Z.compareNodeOrder(this.collection,n,e)<0)&&(e=n)}return e==null?void 0:e.key}get lastSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&Z.compareNodeOrder(this.collection,n,e)>0)&&(e=n)}return e==null?void 0:e.key}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}e=this.getKey(e);let r;if(this.state.selectedKeys==="all")r=new z([e],e,e);else{let n=this.state.selectedKeys,i=n.anchorKey||e;r=new z(n,i,e);for(let o of this.getKeyRange(i,n.currentKey||e))r.delete(o);for(let o of this.getKeyRange(e,i))this.canSelectItem(o)&&r.add(o)}this.state.setSelectedKeys(r)}getKeyRange(e,r){let n=this.collection.getItem(e),i=this.collection.getItem(r);return n&&i?Z.compareNodeOrder(this.collection,n,i)<=0?this.getKeyRangeInternal(e,r):this.getKeyRangeInternal(r,e):[]}getKeyRangeInternal(e,r){let n=[],i=e;for(;i;){let o=this.collection.getItem(i);if((o&&o.type==="item"||o.type==="cell"&&this.allowsCellSelection)&&n.push(i),i===r)return n;i=this.collection.getKeyAfter(i)}return[]}getKey(e){let r=this.collection.getItem(e);if(!r||r.type==="cell"&&this.allowsCellSelection)return e;for(;r.type!=="item"&&r.parentKey!=null;)r=this.collection.getItem(r.parentKey);return!r||r.type!=="item"?null:r.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}if(e=this.getKey(e),e==null)return;let r=new z(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);r.has(e)?r.delete(e):this.canSelectItem(e)&&(r.add(e),r.anchorKey=e,r.currentKey=e),!(this.disallowEmptySelection&&r.size===0)&&this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode==="none"||(e=this.getKey(e),e==null))return;let r=this.canSelectItem(e)?new z([e],e,e):new z;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode==="none")return;let r=new z;for(let n of e)if(n=this.getKey(n),n!=null&&(r.add(n),this.selectionMode==="single"))break;this.state.setSelectedKeys(r)}getSelectAllKeys(){let e=[],r=n=>{for(;n;){if(this.canSelectItem(n)){let i=this.collection.getItem(n);i.type==="item"&&e.push(n),i.hasChildNodes&&(this.allowsCellSelection||i.type!=="item")&&r(Z.getFirstItem(Z.getChildNodes(i,this.collection)).key)}n=this.collection.getKeyAfter(n)}};return r(this.collection.getFirstKey()),e}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new z)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,r){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||r&&(r.pointerType==="touch"||r.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let r=this.selectedKeys;if(e.size!==r.size)return!1;for(let n of e)if(!r.has(n))return!1;for(let n of r)if(!e.has(n))return!1;return!0}canSelectItem(e){var r;if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let n=this.collection.getItem(e);return!(!n||!(n==null||(r=n.props)===null||r===void 0)&&r.isDisabled||n.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){var r,n;return this.state.disabledBehavior==="all"&&(this.state.disabledKeys.has(e)||!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.isDisabled))}isLink(e){var r,n;return!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.href)}getItemProps(e){var r;return(r=this.collection.getItem(e))===null||r===void 0?void 0:r.props}constructor(e,r,n){this.collection=e,this.state=r;var i;this.allowsCellSelection=(i=n==null?void 0:n.allowsCellSelection)!==null&&i!==void 0?i:!1,this._isSelectAll=null}}function Rt(t){let{filter:e}=t,r=Ft(t),n=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),i=f.useCallback(v=>e?new Ue(e(v)):new Ue(v),[e]),o=f.useMemo(()=>({suppressTextValueWarning:t.suppressTextValueWarning}),[t.suppressTextValueWarning]),s=Z.useCollection(t,i,o),u=f.useMemo(()=>new zt(s,r),[s,r]);const b=f.useRef(null);return f.useEffect(()=>{if(r.focusedKey!=null&&!s.getItem(r.focusedKey)){const v=b.current.getItem(r.focusedKey),h=[...b.current.getKeys()].map(T=>{const P=b.current.getItem(T);return P.type==="item"?P:null}).filter(T=>T!==null),w=[...s.getKeys()].map(T=>{const P=s.getItem(T);return P.type==="item"?P:null}).filter(T=>T!==null),$=h.length-w.length;let g=Math.min($>1?Math.max(v.index-$+1,0):v.index,w.length-1),M;for(;g>=0;){if(!u.isDisabled(w[g].key)){M=w[g];break}g<w.length-1?g++:(g>v.index&&(g=v.index),g--)}r.setFocusedKey(M?M.key:null)}b.current=s},[s,u,r,r.focusedKey]),{collection:s,disabledKeys:n,selectionManager:u}}function Nt(t){var e;let[r,n]=lt(t.selectedKey,(e=t.defaultSelectedKey)!==null&&e!==void 0?e:null,t.onSelectionChange),i=f.useMemo(()=>r!=null?[r]:[],[r]),{collection:o,disabledKeys:s,selectionManager:u}=Rt({...t,selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:v=>{var h;let w=(h=v.values().next().value)!==null&&h!==void 0?h:null;w===r&&t.onSelectionChange&&t.onSelectionChange(w),n(w)}}),b=r!=null?o.getItem(r):null;return{collection:o,disabledKeys:s,selectionManager:u,selectedKey:r,setSelectedKey:n,selectedItem:b}}function Bt(t){var e;let r=Nt({...t,suppressTextValueWarning:!0,defaultSelectedKey:(e=t.defaultSelectedKey)!==null&&e!==void 0?e:He(t.collection,t.disabledKeys?new Set(t.disabledKeys):new Set)}),{selectionManager:n,collection:i,selectedKey:o}=r,s=f.useRef(o);return f.useEffect(()=>{let u=o;(n.isEmpty||!i.getItem(u))&&(u=He(i,r.disabledKeys),u!=null&&n.setSelectedKeys([u])),(u!=null&&n.focusedKey==null||!n.isFocused&&u!==s.current)&&n.setFocusedKey(u),s.current=u}),{...r,isDisabled:t.isDisabled||!1}}function He(t,e){let r=null;if(t){for(r=t.getFirstKey();e.has(r)&&r!==t.getLastKey();)r=t.getKeyAfter(r);e.has(r)&&r===t.getLastKey()&&(r=t.getFirstKey())}return r}const ot=new WeakMap;function fe(t,e,r){return typeof e=="string"&&(e=e.replace(/\s+/g,"")),`${ot.get(t)}-${r}-${e}`}const le=typeof document<"u"?f.useLayoutEffect:()=>{};function Q(t){const e=f.useRef(null);return le(()=>{e.current=t},[t]),f.useCallback((...r)=>{const n=e.current;return n==null?void 0:n(...r)},[])}const pe={prefix:String(Math.round(Math.random()*1e10)),current:0},st=f.createContext(pe),Ut=f.createContext(!1);let jt=!!(typeof window<"u"&&window.document&&window.document.createElement),he=new WeakMap;function Ht(t=!1){let e=f.useContext(st),r=f.useRef(null);if(r.current===null&&!t){var n,i;let o=(i=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||i===void 0||(n=i.ReactCurrentOwner)===null||n===void 0?void 0:n.current;if(o){let s=he.get(o);s==null?he.set(o,{id:e.current,state:o.memoizedState}):o.memoizedState!==s.state&&(e.current=s.id,he.delete(o))}r.current=++e.current}return r.current}function Wt(t){let e=f.useContext(st);e===pe&&!jt&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let r=Ht(!!t),n=e===pe&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${e.prefix}`;return t||`${n}-${r}`}function Vt(t){let e=f.useId(),[r]=f.useState(at()),n=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${pe.prefix}`;return t||`${n}-${e}`}const Gt=typeof f.useId=="function"?Vt:Wt;function qt(){return!1}function Xt(){return!0}function Yt(t){return()=>{}}function at(){return typeof f.useSyncExternalStore=="function"?f.useSyncExternalStore(Yt,qt,Xt):f.useContext(Ut)}let _t=!!(typeof window<"u"&&window.document&&window.document.createElement),be=new Map;function ct(t){let[e,r]=f.useState(t),n=f.useRef(null),i=Gt(e),o=f.useCallback(s=>{n.current=s},[]);return _t&&be.set(i,o),le(()=>{let s=i;return()=>{be.delete(s)}},[i]),f.useEffect(()=>{let s=n.current;s&&(n.current=null,r(s))}),i}function Jt(t,e){if(t===e)return t;let r=be.get(t);if(r)return r(e),e;let n=be.get(e);return n?(n(t),t):e}function ut(...t){return(...e)=>{for(let r of t)typeof r=="function"&&r(...e)}}const D=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},G=t=>t&&"window"in t&&t.window===t?t:D(t).defaultView||window;function dt(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=dt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Zt(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=dt(t))&&(n&&(n+=" "),n+=e);return n}function W(...t){let e={...t[0]};for(let r=1;r<t.length;r++){let n=t[r];for(let i in n){let o=e[i],s=n[i];typeof o=="function"&&typeof s=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=ut(o,s):(i==="className"||i==="UNSAFE_className")&&typeof o=="string"&&typeof s=="string"?e[i]=Zt(o,s):i==="id"&&o&&s?e.id=Jt(o,s):e[i]=s!==void 0?s:o}}return e}const Qt=new Set(["id"]),er=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),tr=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),rr=/^(data-.*)$/;function nr(t,e={}){let{labelable:r,isLink:n,propNames:i}=e,o={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(Qt.has(s)||r&&er.has(s)||n&&tr.has(s)||i!=null&&i.has(s)||rr.test(s))&&(o[s]=t[s]);return o}function H(t){if(ir())t.focus({preventScroll:!0});else{let e=lr(t);t.focus(),or(e)}}let se=null;function ir(){if(se==null){se=!1;try{document.createElement("div").focus({get preventScroll(){return se=!0,!0}})}catch{}}return se}function lr(t){let e=t.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==n;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&r.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function or(t){for(let{element:e,scrollTop:r,scrollLeft:n}of t)e.scrollTop=r,e.scrollLeft=n}function ve(t){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(r=>t.test(r.brand)))||t.test(window.navigator.userAgent)}function Le(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function q(){return Le(/^Mac/i)}function sr(){return Le(/^iPhone/i)}function ft(){return Le(/^iPad/i)||q()&&navigator.maxTouchPoints>1}function Ie(){return sr()||ft()}function ar(){return q()||Ie()}function cr(){return ve(/AppleWebKit/i)&&!ur()}function ur(){return ve(/Chrome/i)}function pt(){return ve(/Android/i)}function dr(){return ve(/Firefox/i)}const fr=f.createContext({isNative:!0,open:br,useHref:t=>t});function Ce(){return f.useContext(fr)}function X(t,e,r=!0){var n,i;let{metaKey:o,ctrlKey:s,altKey:u,shiftKey:b}=e;dr()&&(!((i=window.event)===null||i===void 0||(n=i.type)===null||n===void 0)&&n.startsWith("key"))&&t.target==="_blank"&&(q()?o=!0:s=!0);let v=cr()&&q()&&!ft()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:s,altKey:u,shiftKey:b}):new MouseEvent("click",{metaKey:o,ctrlKey:s,altKey:u,shiftKey:b,bubbles:!0,cancelable:!0});X.isOpening=r,H(t),t.dispatchEvent(v),X.isOpening=!1}X.isOpening=!1;function pr(t,e){if(t instanceof HTMLAnchorElement)e(t);else if(t.hasAttribute("data-href")){let r=document.createElement("a");r.href=t.getAttribute("data-href"),t.hasAttribute("data-target")&&(r.target=t.getAttribute("data-target")),t.hasAttribute("data-rel")&&(r.rel=t.getAttribute("data-rel")),t.hasAttribute("data-download")&&(r.download=t.getAttribute("data-download")),t.hasAttribute("data-ping")&&(r.ping=t.getAttribute("data-ping")),t.hasAttribute("data-referrer-policy")&&(r.referrerPolicy=t.getAttribute("data-referrer-policy")),t.appendChild(r),e(r),t.removeChild(r)}}function br(t,e){pr(t,r=>X(r,e))}function yr(t){let e=Ce();return{href:t!=null&&t.href?e.useHref(t==null?void 0:t.href):void 0,target:t==null?void 0:t.target,rel:t==null?void 0:t.rel,download:t==null?void 0:t.download,ping:t==null?void 0:t.ping,referrerPolicy:t==null?void 0:t.referrerPolicy}}let ee=new Map,Ke=new Set;function We(){if(typeof window>"u")return;function t(n){return"propertyName"in n}let e=n=>{if(!t(n)||!n.target)return;let i=ee.get(n.target);i||(i=new Set,ee.set(n.target,i),n.target.addEventListener("transitioncancel",r,{once:!0})),i.add(n.propertyName)},r=n=>{if(!t(n)||!n.target)return;let i=ee.get(n.target);if(i&&(i.delete(n.propertyName),i.size===0&&(n.target.removeEventListener("transitioncancel",r),ee.delete(n.target)),ee.size===0)){for(let o of Ke)o();Ke.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?We():document.addEventListener("DOMContentLoaded",We));function bt(t){requestAnimationFrame(()=>{ee.size===0?t():Ke.add(t)})}function yt(){let t=f.useRef(new Map),e=f.useCallback((i,o,s,u)=>{let b=u!=null&&u.once?(...v)=>{t.current.delete(s),s(...v)}:s;t.current.set(s,{type:o,eventTarget:i,fn:b,options:u}),i.addEventListener(o,s,u)},[]),r=f.useCallback((i,o,s,u)=>{var b;let v=((b=t.current.get(s))===null||b===void 0?void 0:b.fn)||s;i.removeEventListener(o,v,u),t.current.delete(s)},[]),n=f.useCallback(()=>{t.current.forEach((i,o)=>{r(i.eventTarget,i.type,o,i.options)})},[r]);return f.useEffect(()=>n,[n]),{addGlobalListener:e,removeGlobalListener:r,removeAllGlobalListeners:n}}function vt(t,e){let{id:r,"aria-label":n,"aria-labelledby":i}=t;return r=ct(r),i&&n?i=[...new Set([r,...i.trim().split(/\s+/)])].join(" "):i&&(i=i.trim().split(/\s+/).join(" ")),!n&&!i&&e&&(n=e),{id:r,"aria-label":n,"aria-labelledby":i}}function vr(t,e){le(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function gr(t,e){let r=window.getComputedStyle(t),n=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return n&&e&&(n=t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth),n}function hr(t,e){const r=[];for(;t&&t!==document.documentElement;)gr(t,e)&&r.push(t),t=t.parentElement;return r}let $r=0;const $e=new Map;function mr(t){let[e,r]=f.useState();return le(()=>{if(!t)return;let n=$e.get(t);if(n)r(n.element.id);else{let i=`react-aria-description-${$r++}`;r(i);let o=document.createElement("div");o.id=i,o.style.display="none",o.textContent=t,document.body.appendChild(o),n={refCount:0,element:o},$e.set(t,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),$e.delete(t))}},[t]),{"aria-describedby":t?e:void 0}}function Sr(t,e,r,n){let i=Q(r),o=r==null;f.useEffect(()=>{if(o||!t.current)return;let s=t.current;return s.addEventListener(e,i,n),()=>{s.removeEventListener(e,i,n)}},[t,e,n,o,i])}function gt(t,e){let r=Ve(t,e,"left"),n=Ve(t,e,"top"),i=e.offsetWidth,o=e.offsetHeight,s=t.scrollLeft,u=t.scrollTop,{borderTopWidth:b,borderLeftWidth:v}=getComputedStyle(t),h=t.scrollLeft+parseInt(v,10),w=t.scrollTop+parseInt(b,10),$=h+t.clientWidth,g=w+t.clientHeight;r<=s?s=r-parseInt(v,10):r+i>$&&(s+=r+i-$),n<=w?u=n-parseInt(b,10):n+o>g&&(u+=n+o-g),t.scrollLeft=s,t.scrollTop=u}function Ve(t,e,r){const n=r==="left"?"offsetLeft":"offsetTop";let i=0;for(;e.offsetParent&&(i+=e[n],e.offsetParent!==t);){if(e.offsetParent.contains(t)){i-=t[n];break}e=e.offsetParent}return i}function Ge(t,e){if(document.contains(t)){let s=document.scrollingElement||document.documentElement;if(window.getComputedStyle(s).overflow==="hidden"){let b=hr(t);for(let v of b)gt(v,t)}else{var r;let{left:b,top:v}=t.getBoundingClientRect();t==null||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{block:"nearest"});let{left:h,top:w}=t.getBoundingClientRect();if(Math.abs(b-h)>1||Math.abs(v-w)>1){var n,i,o;e==null||(i=e.containingElement)===null||i===void 0||(n=i.scrollIntoView)===null||n===void 0||n.call(i,{block:"center",inline:"center"}),(o=t.scrollIntoView)===null||o===void 0||o.call(t,{block:"nearest"})}}}}function Te(t){return t.mozInputSource===0&&t.isTrusted?!0:pt()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Kr(t){return!pt()&&t.width===0&&t.height===0||t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"}function we(t){return ar()?t.altKey:t.ctrlKey}function te(t){return q()?t.metaKey:t.ctrlKey}const Tr=1e3;function wr(t){let{keyboardDelegate:e,selectionManager:r,onTypeSelect:n}=t,i=f.useRef({search:"",timeout:null}).current,o=s=>{let u=Pr(s.key);if(!u||s.ctrlKey||s.metaKey||!s.currentTarget.contains(s.target))return;u===" "&&i.search.trim().length>0&&(s.preventDefault(),"continuePropagation"in s||s.stopPropagation()),i.search+=u;let b=e.getKeyForSearch(i.search,r.focusedKey);b==null&&(b=e.getKeyForSearch(i.search)),b!=null&&(r.setFocusedKey(b),n&&n(b)),clearTimeout(i.timeout),i.timeout=setTimeout(()=>{i.search=""},Tr)};return{typeSelectProps:{onKeyDownCapture:e.getKeyForSearch?o:null}}}function Pr(t){return t.length===1||!/^[A-Z]/i.test(t)?t:""}let re="default",Pe="",de=new WeakMap;function qe(t){if(Ie()){if(re==="default"){const e=D(t);Pe=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}re="disabled"}else(t instanceof HTMLElement||t instanceof SVGElement)&&(de.set(t,t.style.userSelect),t.style.userSelect="none")}function ae(t){if(Ie()){if(re!=="disabled")return;re="restoring",setTimeout(()=>{bt(()=>{if(re==="restoring"){const e=D(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=Pe||""),Pe="",re="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&de.has(t)){let e=de.get(t);t.style.userSelect==="none"&&(t.style.userSelect=e),t.getAttribute("style")===""&&t.removeAttribute("style"),de.delete(t)}}const ht=f.createContext({register:()=>{}});ht.displayName="PressResponderContext";function Er(t,e){return e.get?e.get.call(t):e.value}function $t(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function xr(t,e){var r=$t(t,e,"get");return Er(t,r)}function kr(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Mr(t,e,r){kr(t,e),e.set(t,r)}function Lr(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function Xe(t,e,r){var n=$t(t,e,"set");return Lr(t,n,r),r}function Ir(t){let e=f.useContext(ht);if(e){let{register:r,...n}=e;t=W(n,t),r()}return vr(e,t.ref),t}var ce=new WeakMap;class ue{continuePropagation(){Xe(this,ce,!1)}get shouldStopPropagation(){return xr(this,ce)}constructor(e,r,n){Mr(this,ce,{writable:!0,value:void 0}),Xe(this,ce,!0),this.type=e,this.pointerType=r,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey}}const Ye=Symbol("linkClicked");function mt(t){let{onPress:e,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:u,preventFocusOnPress:b,shouldCancelOnPointerExit:v,allowTextSelectionOnPress:h,ref:w,...$}=Ir(t),[g,M]=f.useState(!1),T=f.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:P,removeAllGlobalListeners:L}=yt(),k=Q((l,m)=>{let p=T.current;if(s||p.didFirePressStart)return!1;let d=!0;if(p.isTriggeringEvent=!0,n){let K=new ue("pressstart",m,l);n(K),d=K.shouldStopPropagation}return r&&r(!0),p.isTriggeringEvent=!1,p.didFirePressStart=!0,M(!0),d}),x=Q((l,m,p=!0)=>{let d=T.current;if(!d.didFirePressStart)return!1;d.ignoreClickAfterPress=!0,d.didFirePressStart=!1,d.isTriggeringEvent=!0;let K=!0;if(i){let a=new ue("pressend",m,l);i(a),K=a.shouldStopPropagation}if(r&&r(!1),M(!1),e&&p&&!s){let a=new ue("press",m,l);e(a),K&&(K=a.shouldStopPropagation)}return d.isTriggeringEvent=!1,K}),I=Q((l,m)=>{let p=T.current;if(s)return!1;if(o){p.isTriggeringEvent=!0;let d=new ue("pressup",m,l);return o(d),p.isTriggeringEvent=!1,d.shouldStopPropagation}return!0}),C=Q(l=>{let m=T.current;m.isPressed&&m.target&&(m.isOverTarget&&m.pointerType!=null&&x(j(m.target,l),m.pointerType,!1),m.isPressed=!1,m.isOverTarget=!1,m.activePointerId=null,m.pointerType=null,L(),h||ae(m.target))}),A=Q(l=>{v&&C(l)}),B=f.useMemo(()=>{let l=T.current,m={onKeyDown(d){if(me(d.nativeEvent,d.currentTarget)&&d.currentTarget.contains(d.target)){var K;Je(d.target,d.key)&&d.preventDefault();let a=!0;if(!l.isPressed&&!d.repeat){l.target=d.currentTarget,l.isPressed=!0,a=k(d,"keyboard");let c=d.currentTarget,E=O=>{me(O,c)&&!O.repeat&&c.contains(O.target)&&l.target&&I(j(l.target,O),"keyboard")};P(D(d.currentTarget),"keyup",ut(E,p),!0)}a&&d.stopPropagation(),d.metaKey&&q()&&((K=l.metaKeyEvents)===null||K===void 0||K.set(d.key,d.nativeEvent))}else d.key==="Meta"&&(l.metaKeyEvents=new Map)},onClick(d){if(!(d&&!d.currentTarget.contains(d.target))&&d&&d.button===0&&!l.isTriggeringEvent&&!X.isOpening){let K=!0;if(s&&d.preventDefault(),!l.ignoreClickAfterPress&&!l.ignoreEmulatedMouseEvents&&!l.isPressed&&(l.pointerType==="virtual"||Te(d.nativeEvent))){!s&&!b&&H(d.currentTarget);let a=k(d,"virtual"),c=I(d,"virtual"),E=x(d,"virtual");K=a&&c&&E}l.ignoreEmulatedMouseEvents=!1,l.ignoreClickAfterPress=!1,K&&d.stopPropagation()}}},p=d=>{var K;if(l.isPressed&&l.target&&me(d,l.target)){var a;Je(d.target,d.key)&&d.preventDefault();let E=d.target;x(j(l.target,d),"keyboard",l.target.contains(E)),L(),d.key!=="Enter"&&De(l.target)&&l.target.contains(E)&&!d[Ye]&&(d[Ye]=!0,X(l.target,d,!1)),l.isPressed=!1,(a=l.metaKeyEvents)===null||a===void 0||a.delete(d.key)}else if(d.key==="Meta"&&(!((K=l.metaKeyEvents)===null||K===void 0)&&K.size)){var c;let E=l.metaKeyEvents;l.metaKeyEvents=void 0;for(let O of E.values())(c=l.target)===null||c===void 0||c.dispatchEvent(new KeyboardEvent("keyup",O))}};if(typeof PointerEvent<"u"){m.onPointerDown=c=>{if(c.button!==0||!c.currentTarget.contains(c.target))return;if(Kr(c.nativeEvent)){l.pointerType="virtual";return}Se(c.currentTarget)&&c.preventDefault(),l.pointerType=c.pointerType;let E=!0;l.isPressed||(l.isPressed=!0,l.isOverTarget=!0,l.activePointerId=c.pointerId,l.target=c.currentTarget,!s&&!b&&H(c.currentTarget),h||qe(l.target),E=k(c,l.pointerType),P(D(c.currentTarget),"pointermove",d,!1),P(D(c.currentTarget),"pointerup",K,!1),P(D(c.currentTarget),"pointercancel",a,!1)),E&&c.stopPropagation()},m.onMouseDown=c=>{c.currentTarget.contains(c.target)&&c.button===0&&(Se(c.currentTarget)&&c.preventDefault(),c.stopPropagation())},m.onPointerUp=c=>{!c.currentTarget.contains(c.target)||l.pointerType==="virtual"||c.button===0&&J(c,c.currentTarget)&&I(c,l.pointerType||c.pointerType)};let d=c=>{c.pointerId===l.activePointerId&&(l.target&&J(c,l.target)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,k(j(l.target,c),l.pointerType)):l.target&&l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,x(j(l.target,c),l.pointerType,!1),A(c)))},K=c=>{c.pointerId===l.activePointerId&&l.isPressed&&c.button===0&&l.target&&(J(c,l.target)&&l.pointerType!=null?x(j(l.target,c),l.pointerType):l.isOverTarget&&l.pointerType!=null&&x(j(l.target,c),l.pointerType,!1),l.isPressed=!1,l.isOverTarget=!1,l.activePointerId=null,l.pointerType=null,L(),h||ae(l.target))},a=c=>{C(c)};m.onDragStart=c=>{c.currentTarget.contains(c.target)&&C(c)}}else{m.onMouseDown=a=>{if(a.button!==0||!a.currentTarget.contains(a.target))return;if(Se(a.currentTarget)&&a.preventDefault(),l.ignoreEmulatedMouseEvents){a.stopPropagation();return}l.isPressed=!0,l.isOverTarget=!0,l.target=a.currentTarget,l.pointerType=Te(a.nativeEvent)?"virtual":"mouse",!s&&!b&&H(a.currentTarget),k(a,l.pointerType)&&a.stopPropagation(),P(D(a.currentTarget),"mouseup",d,!1)},m.onMouseEnter=a=>{if(!a.currentTarget.contains(a.target))return;let c=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!0,c=k(a,l.pointerType)),c&&a.stopPropagation()},m.onMouseLeave=a=>{if(!a.currentTarget.contains(a.target))return;let c=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!1,c=x(a,l.pointerType,!1),A(a)),c&&a.stopPropagation()},m.onMouseUp=a=>{a.currentTarget.contains(a.target)&&!l.ignoreEmulatedMouseEvents&&a.button===0&&I(a,l.pointerType||"mouse")};let d=a=>{if(a.button===0){if(l.isPressed=!1,L(),l.ignoreEmulatedMouseEvents){l.ignoreEmulatedMouseEvents=!1;return}l.target&&J(a,l.target)&&l.pointerType!=null?x(j(l.target,a),l.pointerType):l.target&&l.isOverTarget&&l.pointerType!=null&&x(j(l.target,a),l.pointerType,!1),l.isOverTarget=!1}};m.onTouchStart=a=>{if(!a.currentTarget.contains(a.target))return;let c=Cr(a.nativeEvent);if(!c)return;l.activePointerId=c.identifier,l.ignoreEmulatedMouseEvents=!0,l.isOverTarget=!0,l.isPressed=!0,l.target=a.currentTarget,l.pointerType="touch",!s&&!b&&H(a.currentTarget),h||qe(l.target),k(a,l.pointerType)&&a.stopPropagation(),P(G(a.currentTarget),"scroll",K,!0)},m.onTouchMove=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=_e(a.nativeEvent,l.activePointerId),E=!0;c&&J(c,a.currentTarget)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,E=k(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,E=x(a,l.pointerType,!1),A(a)),E&&a.stopPropagation()},m.onTouchEnd=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=_e(a.nativeEvent,l.activePointerId),E=!0;c&&J(c,a.currentTarget)&&l.pointerType!=null?(I(a,l.pointerType),E=x(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(E=x(a,l.pointerType,!1)),E&&a.stopPropagation(),l.isPressed=!1,l.activePointerId=null,l.isOverTarget=!1,l.ignoreEmulatedMouseEvents=!0,l.target&&!h&&ae(l.target),L()},m.onTouchCancel=a=>{a.currentTarget.contains(a.target)&&(a.stopPropagation(),l.isPressed&&C(a))};let K=a=>{l.isPressed&&a.target.contains(l.target)&&C({currentTarget:l.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};m.onDragStart=a=>{a.currentTarget.contains(a.target)&&C(a)}}return m},[P,s,b,L,h,C,A,x,k,I]);return f.useEffect(()=>()=>{var l;h||ae((l=T.current.target)!==null&&l!==void 0?l:void 0)},[h]),{isPressed:u||g,pressProps:W($,B)}}function De(t){return t.tagName==="A"&&t.hasAttribute("href")}function me(t,e){const{key:r,code:n}=t,i=e,o=i.getAttribute("role");return(r==="Enter"||r===" "||r==="Spacebar"||n==="Space")&&!(i instanceof G(i).HTMLInputElement&&!St(i,r)||i instanceof G(i).HTMLTextAreaElement||i.isContentEditable)&&!((o==="link"||!o&&De(i))&&r!=="Enter")}function Cr(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function _e(t,e){const r=t.changedTouches;for(let n=0;n<r.length;n++){const i=r[n];if(i.identifier===e)return i}return null}function j(t,e){return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}}function Dr(t){let e=0,r=0;return t.width!==void 0?e=t.width/2:t.radiusX!==void 0&&(e=t.radiusX),t.height!==void 0?r=t.height/2:t.radiusY!==void 0&&(r=t.radiusY),{top:t.clientY-r,right:t.clientX+e,bottom:t.clientY+r,left:t.clientX-e}}function Ar(t,e){return!(t.left>e.right||e.left>t.right||t.top>e.bottom||e.top>t.bottom)}function J(t,e){let r=e.getBoundingClientRect(),n=Dr(t);return Ar(r,n)}function Se(t){return!(t instanceof HTMLElement)||!t.hasAttribute("draggable")}function Je(t,e){return t instanceof HTMLInputElement?!St(t,e):t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!De(t)}const Or=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function St(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":Or.has(t.type)}let oe=null,Fr=new Set,ie=new Map,Y=!1,Ee=!1;function Ae(t,e){for(let r of Fr)r(t,e)}function zr(t){return!(t.metaKey||!q()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function ye(t){Y=!0,zr(t)&&(oe="keyboard",Ae("keyboard",t))}function F(t){oe="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(Y=!0,Ae("pointer",t))}function Kt(t){Te(t)&&(Y=!0,oe="virtual")}function Tt(t){t.target===window||t.target===document||(!Y&&!Ee&&(oe="virtual",Ae("virtual",t)),Y=!1,Ee=!1)}function wt(){Y=!1,Ee=!0}function Ze(t){if(typeof window>"u"||ie.get(G(t)))return;const e=G(t),r=D(t);let n=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){Y=!0,n.apply(this,arguments)},r.addEventListener("keydown",ye,!0),r.addEventListener("keyup",ye,!0),r.addEventListener("click",Kt,!0),e.addEventListener("focus",Tt,!0),e.addEventListener("blur",wt,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",F,!0),r.addEventListener("pointermove",F,!0),r.addEventListener("pointerup",F,!0)):(r.addEventListener("mousedown",F,!0),r.addEventListener("mousemove",F,!0),r.addEventListener("mouseup",F,!0)),e.addEventListener("beforeunload",()=>{Pt(t)},{once:!0}),ie.set(e,{focus:n})}const Pt=(t,e)=>{const r=G(t),n=D(t);e&&n.removeEventListener("DOMContentLoaded",e),ie.has(r)&&(r.HTMLElement.prototype.focus=ie.get(r).focus,n.removeEventListener("keydown",ye,!0),n.removeEventListener("keyup",ye,!0),n.removeEventListener("click",Kt,!0),r.removeEventListener("focus",Tt,!0),r.removeEventListener("blur",wt,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",F,!0),n.removeEventListener("pointermove",F,!0),n.removeEventListener("pointerup",F,!0)):(n.removeEventListener("mousedown",F,!0),n.removeEventListener("mousemove",F,!0),n.removeEventListener("mouseup",F,!0)),ie.delete(r))};function Rr(t){const e=D(t);let r;return e.readyState!=="loading"?Ze(t):(r=()=>{Ze(t)},e.addEventListener("DOMContentLoaded",r)),()=>Pt(t,r)}typeof document<"u"&&Rr();function xe(){return oe}const Nr=500;function Br(t){let{isDisabled:e,onLongPressStart:r,onLongPressEnd:n,onLongPress:i,threshold:o=Nr,accessibilityDescription:s}=t;const u=f.useRef();let{addGlobalListener:b,removeGlobalListener:v}=yt(),{pressProps:h}=mt({isDisabled:e,onPressStart($){if($.continuePropagation(),($.pointerType==="mouse"||$.pointerType==="touch")&&(r&&r({...$,type:"longpressstart"}),u.current=setTimeout(()=>{$.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),i&&i({...$,type:"longpress"}),u.current=void 0},o),$.pointerType==="touch")){let g=M=>{M.preventDefault()};b($.target,"contextmenu",g,{once:!0}),b(window,"pointerup",()=>{setTimeout(()=>{v($.target,"contextmenu",g)},30)},{once:!0})}},onPressEnd($){u.current&&clearTimeout(u.current),n&&($.pointerType==="mouse"||$.pointerType==="touch")&&n({...$,type:"longpressend"})}}),w=mr(i&&!e?s:void 0);return{longPressProps:W(h,w)}}function ke(t){const e=D(t);if(xe()==="virtual"){let r=e.activeElement;bt(()=>{e.activeElement===r&&t.isConnected&&H(t)})}else H(t)}function Ur(t){const e=G(t);if(!(t instanceof e.HTMLElement)&&!(t instanceof e.SVGElement))return!1;let{display:r,visibility:n}=t.style,i=r!=="none"&&n!=="hidden"&&n!=="collapse";if(i){const{getComputedStyle:o}=t.ownerDocument.defaultView;let{display:s,visibility:u}=o(t);i=s!=="none"&&u!=="hidden"&&u!=="collapse"}return i}function jr(t,e){return!t.hasAttribute("hidden")&&!t.hasAttribute("data-react-aria-prevent-focus")&&(t.nodeName==="DETAILS"&&e&&e.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}function Et(t,e){return t.nodeName!=="#comment"&&Ur(t)&&jr(t,e)&&(!t.parentElement||Et(t.parentElement,t))}const Oe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],Hr=Oe.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Oe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Wr=Oe.join(':not([hidden]):not([tabindex="-1"]),');function xt(t,e){return!t||!e?!1:e.some(r=>r.contains(t))}function kt(t,e,r){let n=e!=null&&e.tabbable?Wr:Hr,i=D(t).createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(o){var s;return!(e==null||(s=e.from)===null||s===void 0)&&s.contains(o)?NodeFilter.FILTER_REJECT:o.matches(n)&&Et(o)&&(!r||xt(o,r))&&(!(e!=null&&e.accept)||e.accept(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return e!=null&&e.from&&(i.currentNode=e.from),i}class Fe{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,r,n){let i=this.fastMap.get(r??null);if(!i)return;let o=new Qe({scopeRef:e});i.addChild(o),o.parent=i,this.fastMap.set(e,o),n&&(o.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let r=this.fastMap.get(e);if(!r)return;let n=r.parent;for(let o of this.traverse())o!==r&&r.nodeToRestore&&o.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&xt(o.nodeToRestore,r.scopeRef.current)&&(o.nodeToRestore=r.nodeToRestore);let i=r.children;n&&(n.removeChild(r),i.size>0&&i.forEach(o=>n&&n.addChild(o))),this.fastMap.delete(r.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let r of e.children)yield*this.traverse(r)}clone(){var e;let r=new Fe;var n;for(let i of this.traverse())r.addTreeNode(i.scopeRef,(n=(e=i.parent)===null||e===void 0?void 0:e.scopeRef)!==null&&n!==void 0?n:null,i.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new Qe({scopeRef:null}),this.fastMap.set(null,this.root)}}class Qe{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}new Fe;function Vr(t,e){let r=e==null?void 0:e.isDisabled,[n,i]=f.useState(!1);return le(()=>{if(t!=null&&t.current&&!r){let o=()=>{if(t.current){let u=kt(t.current,{tabbable:!0});i(!!u.nextNode())}};o();let s=new MutationObserver(o);return s.observe(t.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{s.disconnect()}}}),r?!1:n}const Gr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),qr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Xr(t){if(Intl.Locale){let r=new Intl.Locale(t).maximize(),n=typeof r.getTextInfo=="function"?r.getTextInfo():r.textInfo;if(n)return n.direction==="rtl";if(r.script)return Gr.has(r.script)}let e=t.split("-")[0];return qr.has(e)}const Yr=Symbol.for("react-aria.i18n.locale");function Mt(){let t=typeof window<"u"&&window[Yr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{t="en-US"}return{locale:t,direction:Xr(t)?"rtl":"ltr"}}let Me=Mt(),ne=new Set;function et(){Me=Mt();for(let t of ne)t(Me)}function _r(){let t=at(),[e,r]=f.useState(Me);return f.useEffect(()=>(ne.size===0&&window.addEventListener("languagechange",et),ne.add(r),()=>{ne.delete(r),ne.size===0&&window.removeEventListener("languagechange",et)}),[]),t?{locale:"en-US",direction:"ltr"}:e}const Jr=f.createContext(null);function Lt(){let t=_r();return f.useContext(Jr)||t}function Zr(t){let{selectionManager:e,keyboardDelegate:r,ref:n,autoFocus:i=!1,shouldFocusWrap:o=!1,disallowEmptySelection:s=!1,disallowSelectAll:u=!1,selectOnFocus:b=e.selectionBehavior==="replace",disallowTypeAhead:v=!1,shouldUseVirtualFocus:h,allowsTabNavigation:w=!1,isVirtualized:$,scrollRef:g=n,linkBehavior:M="action"}=t,{direction:T}=Lt(),P=Ce(),L=p=>{if(p.altKey&&p.key==="Tab"&&p.preventDefault(),!n.current.contains(p.target))return;const d=(S,V)=>{if(S!=null){if(e.isLink(S)&&M==="selection"&&b&&!we(p)){Dt.flushSync(()=>{e.setFocusedKey(S,V)});let _=g.current.querySelector(`[data-key="${CSS.escape(S.toString())}"]`),Ne=e.getItemProps(S);P.open(_,p,Ne.href,Ne.routerOptions);return}if(e.setFocusedKey(S,V),e.isLink(S)&&M==="override")return;p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&!we(p)&&e.replaceSelection(S)}};switch(p.key){case"ArrowDown":if(r.getKeyBelow){var K,a;p.preventDefault();let S=e.focusedKey!=null?r.getKeyBelow(e.focusedKey):(K=r.getFirstKey)===null||K===void 0?void 0:K.call(r);S==null&&o&&(S=(a=r.getFirstKey)===null||a===void 0?void 0:a.call(r,e.focusedKey)),d(S)}break;case"ArrowUp":if(r.getKeyAbove){var c,E;p.preventDefault();let S=e.focusedKey!=null?r.getKeyAbove(e.focusedKey):(c=r.getLastKey)===null||c===void 0?void 0:c.call(r);S==null&&o&&(S=(E=r.getLastKey)===null||E===void 0?void 0:E.call(r,e.focusedKey)),d(S)}break;case"ArrowLeft":if(r.getKeyLeftOf){var O,y;p.preventDefault();let S=r.getKeyLeftOf(e.focusedKey);S==null&&o&&(S=T==="rtl"?(O=r.getFirstKey)===null||O===void 0?void 0:O.call(r,e.focusedKey):(y=r.getLastKey)===null||y===void 0?void 0:y.call(r,e.focusedKey)),d(S,T==="rtl"?"first":"last")}break;case"ArrowRight":if(r.getKeyRightOf){var U,ge;p.preventDefault();let S=r.getKeyRightOf(e.focusedKey);S==null&&o&&(S=T==="rtl"?(U=r.getLastKey)===null||U===void 0?void 0:U.call(r,e.focusedKey):(ge=r.getFirstKey)===null||ge===void 0?void 0:ge.call(r,e.focusedKey)),d(S,T==="rtl"?"last":"first")}break;case"Home":if(r.getFirstKey){p.preventDefault();let S=r.getFirstKey(e.focusedKey,te(p));e.setFocusedKey(S),te(p)&&p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&e.replaceSelection(S)}break;case"End":if(r.getLastKey){p.preventDefault();let S=r.getLastKey(e.focusedKey,te(p));e.setFocusedKey(S),te(p)&&p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&e.replaceSelection(S)}break;case"PageDown":if(r.getKeyPageBelow){p.preventDefault();let S=r.getKeyPageBelow(e.focusedKey);d(S)}break;case"PageUp":if(r.getKeyPageAbove){p.preventDefault();let S=r.getKeyPageAbove(e.focusedKey);d(S)}break;case"a":te(p)&&e.selectionMode==="multiple"&&u!==!0&&(p.preventDefault(),e.selectAll());break;case"Escape":!s&&e.selectedKeys.size!==0&&(p.stopPropagation(),p.preventDefault(),e.clearSelection());break;case"Tab":if(!w){if(p.shiftKey)n.current.focus();else{let S=kt(n.current,{tabbable:!0}),V,_;do _=S.lastChild(),_&&(V=_);while(_);V&&!V.contains(document.activeElement)&&H(V)}break}}},k=f.useRef({top:0,left:0});Sr(g,"scroll",$?null:()=>{k.current={top:g.current.scrollTop,left:g.current.scrollLeft}});let x=p=>{if(e.isFocused){p.currentTarget.contains(p.target)||e.setFocused(!1);return}if(p.currentTarget.contains(p.target)){if(e.setFocused(!0),e.focusedKey==null){let a=E=>{E!=null&&(e.setFocusedKey(E),b&&e.replaceSelection(E))},c=p.relatedTarget;var d,K;c&&p.currentTarget.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING?a((d=e.lastSelectedKey)!==null&&d!==void 0?d:r.getLastKey()):a((K=e.firstSelectedKey)!==null&&K!==void 0?K:r.getFirstKey())}else $||(g.current.scrollTop=k.current.top,g.current.scrollLeft=k.current.left);if(!$&&e.focusedKey!=null){let a=g.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);a&&(a.contains(document.activeElement)||H(a),xe()==="keyboard"&&Ge(a,{containingElement:n.current}))}}},I=p=>{p.currentTarget.contains(p.relatedTarget)||e.setFocused(!1)};const C=f.useRef(i);f.useEffect(()=>{if(C.current){let p=null;i==="first"&&(p=r.getFirstKey()),i==="last"&&(p=r.getLastKey());let d=e.selectedKeys;if(d.size){for(let K of d)if(e.canSelectItem(K)){p=K;break}}e.setFocused(!0),e.setFocusedKey(p),p==null&&!h&&ke(n.current)}},[]);let A=f.useRef(e.focusedKey);f.useEffect(()=>{let p=xe();if(e.isFocused&&e.focusedKey!=null&&(g!=null&&g.current)){let d=g.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);d&&(p==="keyboard"||C.current)&&($||gt(g.current,d),p!=="virtual"&&Ge(d,{containingElement:n.current}))}e.isFocused&&e.focusedKey==null&&A.current!=null&&ke(n.current),A.current=e.focusedKey,C.current=!1},[$,g,e.focusedKey,e.isFocused,n]);let B={onKeyDown:L,onFocus:x,onBlur:I,onMouseDown(p){g.current===p.target&&p.preventDefault()}},{typeSelectProps:l}=wr({keyboardDelegate:r,selectionManager:e});v||(B=W(l,B));let m;return h||(m=e.focusedKey==null?0:-1),{collectionProps:{...B,tabIndex:m}}}function Qr(t){let{selectionManager:e,key:r,ref:n,shouldSelectOnPressUp:i,shouldUseVirtualFocus:o,focus:s,isDisabled:u,onAction:b,allowsDifferentPressOrigin:v,linkBehavior:h="action"}=t,w=Ce(),$=y=>{if(y.pointerType==="keyboard"&&we(y))e.toggleSelection(r);else{if(e.selectionMode==="none")return;if(e.isLink(r)){if(h==="selection"){let U=e.getItemProps(r);w.open(n.current,y,U.href,U.routerOptions),e.setSelectedKeys(e.selectedKeys);return}else if(h==="override"||h==="none")return}e.selectionMode==="single"?e.isSelected(r)&&!e.disallowEmptySelection?e.toggleSelection(r):e.replaceSelection(r):y&&y.shiftKey?e.extendSelection(r):e.selectionBehavior==="toggle"||y&&(te(y)||y.pointerType==="touch"||y.pointerType==="virtual")?e.toggleSelection(r):e.replaceSelection(r)}};f.useEffect(()=>{r===e.focusedKey&&e.isFocused&&!o&&(s?s():document.activeElement!==n.current&&ke(n.current))},[n,r,e.focusedKey,e.childFocusStrategy,e.isFocused,o]),u=u||e.isDisabled(r);let g={};!o&&!u?g={tabIndex:r===e.focusedKey?0:-1,onFocus(y){y.target===n.current&&e.setFocusedKey(r)}}:u&&(g.onMouseDown=y=>{y.preventDefault()});let M=e.isLink(r)&&h==="override",T=e.isLink(r)&&h!=="selection"&&h!=="none",P=!u&&e.canSelectItem(r)&&!M,L=(b||T)&&!u,k=L&&(e.selectionBehavior==="replace"?!P:!P||e.isEmpty),x=L&&P&&e.selectionBehavior==="replace",I=k||x,C=f.useRef(null),A=I&&P,B=f.useRef(!1),l=f.useRef(!1),m=y=>{if(b&&b(),T){let U=e.getItemProps(r);w.open(n.current,y,U.href,U.routerOptions)}},p={};i?(p.onPressStart=y=>{C.current=y.pointerType,B.current=A,y.pointerType==="keyboard"&&(!I||rt())&&$(y)},v?(p.onPressUp=k?null:y=>{y.pointerType!=="keyboard"&&P&&$(y)},p.onPress=k?m:null):p.onPress=y=>{if(k||x&&y.pointerType!=="mouse"){if(y.pointerType==="keyboard"&&!tt())return;m(y)}else y.pointerType!=="keyboard"&&P&&$(y)}):(p.onPressStart=y=>{C.current=y.pointerType,B.current=A,l.current=k,P&&(y.pointerType==="mouse"&&!k||y.pointerType==="keyboard"&&(!L||rt()))&&$(y)},p.onPress=y=>{(y.pointerType==="touch"||y.pointerType==="pen"||y.pointerType==="virtual"||y.pointerType==="keyboard"&&I&&tt()||y.pointerType==="mouse"&&l.current)&&(I?m(y):P&&$(y))}),g["data-key"]=r,p.preventFocusOnPress=o;let{pressProps:d,isPressed:K}=mt(p),a=x?y=>{C.current==="mouse"&&(y.stopPropagation(),y.preventDefault(),m(y))}:void 0,{longPressProps:c}=Br({isDisabled:!A,onLongPress(y){y.pointerType==="touch"&&($(y),e.setSelectionBehavior("toggle"))}}),E=y=>{C.current==="touch"&&B.current&&y.preventDefault()},O=e.isLink(r)?y=>{X.isOpening||y.preventDefault()}:void 0;return{itemProps:W(g,P||k?d:{},A?c:{},{onDoubleClick:a,onDragStartCapture:E,onClick:O}),isPressed:K,isSelected:e.isSelected(r),isFocused:e.isFocused&&e.focusedKey===r,isDisabled:u,allowsSelection:P,hasAction:I}}function tt(){let t=window.event;return(t==null?void 0:t.key)==="Enter"}function rt(){let t=window.event;return(t==null?void 0:t.key)===" "||(t==null?void 0:t.code)==="Space"}function en(t,e,r){let{key:n,isDisabled:i,shouldSelectOnPressUp:o}=t,{selectionManager:s,selectedKey:u}=e,b=n===u,v=i||e.isDisabled||e.selectionManager.isDisabled(n),{itemProps:h,isPressed:w}=Qr({selectionManager:s,key:n,ref:r,isDisabled:v,shouldSelectOnPressUp:o,linkBehavior:"selection"}),$=fe(e,n,"tab"),g=fe(e,n,"tabpanel"),{tabIndex:M}=h,T=e.collection.getItem(n),P=nr(T==null?void 0:T.props,{labelable:!0});delete P.id;let L=yr(T==null?void 0:T.props);return{tabProps:W(P,L,h,{id:$,"aria-selected":b,"aria-disabled":v||void 0,"aria-controls":b?g:void 0,tabIndex:v?void 0:M,role:"tab"}),isSelected:b,isDisabled:v,isPressed:w}}function tn(t,e,r){let n=Vr(r)?void 0:0;var i;const o=fe(e,(i=t.id)!==null&&i!==void 0?i:e==null?void 0:e.selectedKey,"tabpanel"),s=vt({...t,id:o,"aria-labelledby":fe(e,e==null?void 0:e.selectedKey,"tab")});return{tabPanelProps:W(s,{tabIndex:n,role:"tabpanel","aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"]})}}class rn{getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}getKeyAbove(e){return this.getPreviousKey(e)}getKeyBelow(e){return this.getNextKey(e)}isDisabled(e){var r,n;return this.disabledKeys.has(e)||!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.isDisabled)}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getNextKey(e){do e=this.collection.getKeyAfter(e),e==null&&(e=this.collection.getFirstKey());while(this.isDisabled(e));return e}getPreviousKey(e){do e=this.collection.getKeyBefore(e),e==null&&(e=this.collection.getLastKey());while(this.isDisabled(e));return e}constructor(e,r,n,i=new Set){this.collection=e,this.flipDirection=r==="rtl"&&n==="horizontal",this.disabledKeys=i}}function nn(t,e,r){let{orientation:n="horizontal",keyboardActivation:i="automatic"}=t,{collection:o,selectionManager:s,disabledKeys:u}=e,{direction:b}=Lt(),v=f.useMemo(()=>new rn(o,b,n,u),[o,u,n,b]),{collectionProps:h}=Zr({ref:r,selectionManager:s,keyboardDelegate:v,selectOnFocus:i==="automatic",disallowEmptySelection:!0,scrollRef:r,linkBehavior:"selection"}),w=ct();ot.set(e,w);let $=vt({...t,id:w});return{tabListProps:{...W(h,$),role:"tablist","aria-orientation":n,tabIndex:void 0}}}function ln(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function it(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nt(Object(r),!0).forEach(function(n){ln(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var on=(t,e,r)=>{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},ze=t=>e=>{var r=t.defaultClassName,n=it(it({},t.defaultVariants),e);for(var i in n){var o,s=(o=n[i])!==null&&o!==void 0?o:t.defaultVariants[i];if(s!=null){var u=s;typeof u=="boolean"&&(u=u===!0?"true":"false");var b=t.variantClassNames[i][u];b&&(r+=" "+b)}}for(var[v,h]of t.compoundVariants)on(v,n,t.defaultVariants)&&(r+=" "+h);return r},sn=ze({defaultClassName:"kz6kzz0",variantClassNames:{context:{container:"kz6kzz1",navigation:"kz6kzz2"},active:{true:"kz6kzz3",false:"kz6kzz4"},disabled:{true:"kz6kzz5",false:"kz6kzz6"}},defaultVariants:{},compoundVariants:[[{context:"container",active:!0},"kz6kzz7"],[{context:"container",active:!1},"kz6kzz8"],[{context:"container",active:!1,disabled:!1},"kz6kzz9"],[{context:"navigation",active:!0},"kz6kzza"],[{context:"navigation",active:!1},"kz6kzzb"],[{context:"navigation",active:!1,disabled:!1},"kz6kzzc"],[{context:"navigation",active:!1,disabled:!0},"kz6kzzd"]]}),an=ze({defaultClassName:"",variantClassNames:{active:{true:"kz6kzze",false:"kz6kzzf"},disabled:{true:"kz6kzzg",false:"kz6kzzh"},context:{navigation:"kz6kzzi",container:"kz6kzzj"}},defaultVariants:{},compoundVariants:[[{context:"navigation",active:!0},"kz6kzzk"]]});function It({context:t,item:e,state:r,...n}){const{key:i}=e,o=R.useRef(null),{tabProps:s}=en({key:i},r,o),u=r.selectedKey===i,b=r.disabledKeys.has(i),v=N.modChildren(e.rendered,h=>h.type.displayName==="SpsTag"||N.Metadata.isWoodlandComponent(h.type)&&N.Metadata.get(h.type).name==="Tag"?[{className:N.cl(h.props.className,an({active:u,disabled:b,context:t}))}]:[{}]);return R.createElement("div",{...s,ref:o,className:sn({active:u,disabled:b,context:t}),...n},v)}N.Metadata.set(It,{name:"Tab"});function Ct({context:t,"data-testid":e,state:r,...n}){const i=R.useRef(null),{tabPanelProps:o}=tn(n,r,i),s=t==="container"?N.Content:"div";return R.createElement(s,{...o,ref:i,"data-testid":e},r.selectedItem?r.selectedItem.props.children:null)}N.Metadata.set(Ct,{name:"TabPanel"});var cn=ze({defaultClassName:"fy26er0",variantClassNames:{context:{container:"fy26er1",navigation:"fy26er2"}},defaultVariants:{},compoundVariants:[]});function Re({className:t,context:e="navigation","data-testid":r,...n}){const i=Bt(n),o=R.useRef(null),{tabListProps:s}=nn(n,i,o),u=N.useChildTestIdAttrBuilder({"data-testid":r});return R.createElement(R.Fragment,null,R.createElement("div",{...s,ref:o,className:N.cl(cn({context:e}),t),"data-testid":r},[...i.collection].map(b=>R.createElement(It,{key:b.key,item:b,state:i,context:e,...u(`tab-${String(b.key)}`)}))),R.createElement(Ct,{key:i.selectedItem?i.selectedItem.key:null,state:i,context:e,...u("tab-panel")}))}N.Metadata.set(Re,{name:"Tabs"});const un={components:[Re],examples:{basic:{label:"Basic Navigation Tabs",description:Be.code`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),ee=require("@react-stately/collections"),Ot=require("react-dom"),R=require("@sps-woodland/core"),Ue=require("@spscommerce/utils");function Ft(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const z=Ft(f);class je{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let r=this.keyMap.get(e);return r?r.prevKey:null}getKeyAfter(e){let r=this.keyMap.get(e);return r?r.nextKey:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const r=[...this.getKeys()];return this.getItem(r[e])}getChildren(e){let r=this.keyMap.get(e);return(r==null?void 0:r.childNodes)||[]}constructor(e){this.keyMap=new Map,this.iterable=e;let r=s=>{if(this.keyMap.set(s.key,s),s.childNodes&&s.type==="section")for(let o of s.childNodes)r(o)};for(let s of e)r(s);let n,i=0;for(let[s,o]of this.keyMap)n?(n.nextKey=s,o.prevKey=n.key):(this.firstKey=s,o.prevKey=void 0),o.type==="item"&&(o.index=i++),n=o,n.nextKey=void 0;this.lastKey=n==null?void 0:n.key}}class F extends Set{constructor(e,r,n){super(e),e instanceof F?(this.anchorKey=r||e.anchorKey,this.currentKey=n||e.currentKey):(this.anchorKey=r,this.currentKey=n)}}function at(t,e,r){let[n,i]=f.useState(t||e),s=f.useRef(t!==void 0),o=t!==void 0;f.useEffect(()=>{let y=s.current;y!==o&&console.warn(`WARN: A component changed from ${y?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),s.current=o},[o]);let c=o?t:n,p=f.useCallback((y,...g)=>{let S=($,...h)=>{r&&(Object.is(c,$)||r($,...h)),o||(c=$)};typeof y=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),i((h,...M)=>{let _=y(o?c:h,...M);return S(_,...g),o?h:_})):(o||i(y),S(y,...g))},[o,c,r]);return[c,p]}function zt(t,e){if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;return!0}function Rt(t){let{selectionMode:e="none",disallowEmptySelection:r,allowDuplicateSelectionEvents:n,selectionBehavior:i="toggle",disabledBehavior:s="all"}=t,o=f.useRef(!1),[,c]=f.useState(!1),p=f.useRef(null),y=f.useRef(null),[,g]=f.useState(null),S=f.useMemo(()=>He(t.selectedKeys),[t.selectedKeys]),$=f.useMemo(()=>He(t.defaultSelectedKeys,new F),[t.defaultSelectedKeys]),[h,M]=at(S,$,t.onSelectionChange),_=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),[w,x]=f.useState(i);i==="replace"&&w==="toggle"&&typeof h=="object"&&h.size===0&&x("replace");let k=f.useRef(i);return f.useEffect(()=>{i!==k.current&&(x(i),k.current=i)},[i]),{selectionMode:e,disallowEmptySelection:r,selectionBehavior:w,setSelectionBehavior:x,get isFocused(){return o.current},setFocused(E){o.current=E,c(E)},get focusedKey(){return p.current},get childFocusStrategy(){return y.current},setFocusedKey(E,C="first"){p.current=E,y.current=C,g(E)},selectedKeys:h,setSelectedKeys(E){(n||!zt(E,h))&&M(E)},disabledKeys:_,disabledBehavior:s}}function He(t,e){return t?t==="all"?"all":new F(t):e}class Nt{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,r){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,r)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){return this.state.selectionMode==="none"?!1:(e=this.getKey(e),this.state.selectedKeys==="all"?this.canSelectItem(e):this.state.selectedKeys.has(e))}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),r=this.state.selectedKeys;return this._isSelectAll=e.every(n=>r.has(n)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&ee.compareNodeOrder(this.collection,n,e)<0)&&(e=n)}return e==null?void 0:e.key}get lastSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&ee.compareNodeOrder(this.collection,n,e)>0)&&(e=n)}return e==null?void 0:e.key}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}e=this.getKey(e);let r;if(this.state.selectedKeys==="all")r=new F([e],e,e);else{let n=this.state.selectedKeys,i=n.anchorKey||e;r=new F(n,i,e);for(let s of this.getKeyRange(i,n.currentKey||e))r.delete(s);for(let s of this.getKeyRange(e,i))this.canSelectItem(s)&&r.add(s)}this.state.setSelectedKeys(r)}getKeyRange(e,r){let n=this.collection.getItem(e),i=this.collection.getItem(r);return n&&i?ee.compareNodeOrder(this.collection,n,i)<=0?this.getKeyRangeInternal(e,r):this.getKeyRangeInternal(r,e):[]}getKeyRangeInternal(e,r){let n=[],i=e;for(;i;){let s=this.collection.getItem(i);if((s&&s.type==="item"||s.type==="cell"&&this.allowsCellSelection)&&n.push(i),i===r)return n;i=this.collection.getKeyAfter(i)}return[]}getKey(e){let r=this.collection.getItem(e);if(!r||r.type==="cell"&&this.allowsCellSelection)return e;for(;r.type!=="item"&&r.parentKey!=null;)r=this.collection.getItem(r.parentKey);return!r||r.type!=="item"?null:r.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}if(e=this.getKey(e),e==null)return;let r=new F(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);r.has(e)?r.delete(e):this.canSelectItem(e)&&(r.add(e),r.anchorKey=e,r.currentKey=e),!(this.disallowEmptySelection&&r.size===0)&&this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode==="none"||(e=this.getKey(e),e==null))return;let r=this.canSelectItem(e)?new F([e],e,e):new F;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode==="none")return;let r=new F;for(let n of e)if(n=this.getKey(n),n!=null&&(r.add(n),this.selectionMode==="single"))break;this.state.setSelectedKeys(r)}getSelectAllKeys(){let e=[],r=n=>{for(;n!=null;){if(this.canSelectItem(n)){let i=this.collection.getItem(n);i.type==="item"&&e.push(n),i.hasChildNodes&&(this.allowsCellSelection||i.type!=="item")&&r(ee.getFirstItem(ee.getChildNodes(i,this.collection)).key)}n=this.collection.getKeyAfter(n)}};return r(this.collection.getFirstKey()),e}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new F)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,r){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||r&&(r.pointerType==="touch"||r.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let r=this.selectedKeys;if(e.size!==r.size)return!1;for(let n of e)if(!r.has(n))return!1;for(let n of r)if(!e.has(n))return!1;return!0}canSelectItem(e){var r;if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let n=this.collection.getItem(e);return!(!n||!(n==null||(r=n.props)===null||r===void 0)&&r.isDisabled||n.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){var r,n;return this.state.disabledBehavior==="all"&&(this.state.disabledKeys.has(e)||!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.isDisabled))}isLink(e){var r,n;return!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.href)}getItemProps(e){var r;return(r=this.collection.getItem(e))===null||r===void 0?void 0:r.props}constructor(e,r,n){this.collection=e,this.state=r;var i;this.allowsCellSelection=(i=n==null?void 0:n.allowsCellSelection)!==null&&i!==void 0?i:!1,this._isSelectAll=null}}function Bt(t){let{filter:e}=t,r=Rt(t),n=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),i=f.useCallback(y=>e?new je(e(y)):new je(y),[e]),s=f.useMemo(()=>({suppressTextValueWarning:t.suppressTextValueWarning}),[t.suppressTextValueWarning]),o=ee.useCollection(t,i,s),c=f.useMemo(()=>new Nt(o,r),[o,r]);const p=f.useRef(null);return f.useEffect(()=>{if(r.focusedKey!=null&&!o.getItem(r.focusedKey)){const y=p.current.getItem(r.focusedKey),g=[...p.current.getKeys()].map(w=>{const x=p.current.getItem(w);return x.type==="item"?x:null}).filter(w=>w!==null),S=[...o.getKeys()].map(w=>{const x=o.getItem(w);return x.type==="item"?x:null}).filter(w=>w!==null),$=g.length-S.length;let h=Math.min($>1?Math.max(y.index-$+1,0):y.index,S.length-1),M,_=!1;for(;h>=0;){if(!c.isDisabled(S[h].key)){M=S[h];break}h<S.length-1&&!_?h++:(_=!0,h>y.index&&(h=y.index),h--)}r.setFocusedKey(M?M.key:null)}p.current=o},[o,c,r,r.focusedKey]),{collection:o,disabledKeys:n,selectionManager:c}}function Ut(t){var e;let[r,n]=at(t.selectedKey,(e=t.defaultSelectedKey)!==null&&e!==void 0?e:null,t.onSelectionChange),i=f.useMemo(()=>r!=null?[r]:[],[r]),{collection:s,disabledKeys:o,selectionManager:c}=Bt({...t,selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:y=>{var g;let S=(g=y.values().next().value)!==null&&g!==void 0?g:null;S===r&&t.onSelectionChange&&t.onSelectionChange(S),n(S)}}),p=r!=null?s.getItem(r):null;return{collection:s,disabledKeys:o,selectionManager:c,selectedKey:r,setSelectedKey:n,selectedItem:p}}function jt(t){var e;let r=Ut({...t,suppressTextValueWarning:!0,defaultSelectedKey:(e=t.defaultSelectedKey)!==null&&e!==void 0?e:We(t.collection,t.disabledKeys?new Set(t.disabledKeys):new Set)}),{selectionManager:n,collection:i,selectedKey:s}=r,o=f.useRef(s);return f.useEffect(()=>{let c=s;(n.isEmpty||!i.getItem(c))&&(c=We(i,r.disabledKeys),c!=null&&n.setSelectedKeys([c])),(c!=null&&n.focusedKey==null||!n.isFocused&&c!==o.current)&&n.setFocusedKey(c),o.current=c}),{...r,isDisabled:t.isDisabled||!1}}function We(t,e){let r=null;if(t){var n,i,s,o;for(r=t.getFirstKey();(e.has(r)||!((i=t.getItem(r))===null||i===void 0||(n=i.props)===null||n===void 0)&&n.isDisabled)&&r!==t.getLastKey();)r=t.getKeyAfter(r);(e.has(r)||!((o=t.getItem(r))===null||o===void 0||(s=o.props)===null||s===void 0)&&s.isDisabled)&&r===t.getLastKey()&&(r=t.getFirstKey())}return r}const ct=new WeakMap;function be(t,e,r){return typeof e=="string"&&(e=e.replace(/\s+/g,"")),`${ct.get(t)}-${r}-${e}`}const oe=typeof document<"u"?f.useLayoutEffect:()=>{};function te(t){const e=f.useRef(null);return oe(()=>{e.current=t},[t]),f.useCallback((...r)=>{const n=e.current;return n==null?void 0:n(...r)},[])}const ve={prefix:String(Math.round(Math.random()*1e10)),current:0},ut=f.createContext(ve),Ht=f.createContext(!1);let Wt=!!(typeof window<"u"&&window.document&&window.document.createElement),me=new WeakMap;function Vt(t=!1){let e=f.useContext(ut),r=f.useRef(null);if(r.current===null&&!t){var n,i;let s=(i=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||i===void 0||(n=i.ReactCurrentOwner)===null||n===void 0?void 0:n.current;if(s){let o=me.get(s);o==null?me.set(s,{id:e.current,state:s.memoizedState}):s.memoizedState!==o.state&&(e.current=o.id,me.delete(s))}r.current=++e.current}return r.current}function Gt(t){let e=f.useContext(ut);e===ve&&!Wt&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let r=Vt(!!t),n=e===ve&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${e.prefix}`;return t||`${n}-${r}`}function Xt(t){let e=f.useId(),[r]=f.useState(dt()),n=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ve.prefix}`;return t||`${n}-${e}`}const Yt=typeof f.useId=="function"?Xt:Gt;function qt(){return!1}function Jt(){return!0}function Zt(t){return()=>{}}function dt(){return typeof f.useSyncExternalStore=="function"?f.useSyncExternalStore(Zt,qt,Jt):f.useContext(Ht)}let Qt=!!(typeof window<"u"&&window.document&&window.document.createElement),ye=new Map;function ft(t){let[e,r]=f.useState(t),n=f.useRef(null),i=Yt(e),s=f.useCallback(o=>{n.current=o},[]);return Qt&&ye.set(i,s),oe(()=>{let o=i;return()=>{ye.delete(o)}},[i]),f.useEffect(()=>{let o=n.current;o&&(n.current=null,r(o))}),i}function er(t,e){if(t===e)return t;let r=ye.get(t);if(r)return r(e),e;let n=ye.get(e);return n?(n(t),t):e}function pt(...t){return(...e)=>{for(let r of t)typeof r=="function"&&r(...e)}}const D=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},X=t=>t&&"window"in t&&t.window===t?t:D(t).defaultView||window;function bt(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=bt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function tr(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=bt(t))&&(n&&(n+=" "),n+=e);return n}function V(...t){let e={...t[0]};for(let r=1;r<t.length;r++){let n=t[r];for(let i in n){let s=e[i],o=n[i];typeof s=="function"&&typeof o=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=pt(s,o):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[i]=tr(s,o):i==="id"&&s&&o?e.id=er(s,o):e[i]=o!==void 0?o:s}}return e}const rr=new Set(["id"]),nr=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),ir=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),lr=/^(data-.*)$/;function sr(t,e={}){let{labelable:r,isLink:n,propNames:i}=e,s={};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(rr.has(o)||r&&nr.has(o)||n&&ir.has(o)||i!=null&&i.has(o)||lr.test(o))&&(s[o]=t[o]);return s}function j(t){if(or())t.focus({preventScroll:!0});else{let e=ar(t);t.focus(),cr(e)}}let ce=null;function or(){if(ce==null){ce=!1;try{document.createElement("div").focus({get preventScroll(){return ce=!0,!0}})}catch{}}return ce}function ar(t){let e=t.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==n;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&r.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function cr(t){for(let{element:e,scrollTop:r,scrollLeft:n}of t)e.scrollTop=r,e.scrollLeft=n}function he(t){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(r=>t.test(r.brand)))||t.test(window.navigator.userAgent)}function Ce(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function H(t){let e=null;return()=>(e==null&&(e=t()),e)}const Y=H(function(){return Ce(/^Mac/i)}),ur=H(function(){return Ce(/^iPhone/i)}),vt=H(function(){return Ce(/^iPad/i)||Y()&&navigator.maxTouchPoints>1}),Ie=H(function(){return ur()||vt()}),dr=H(function(){return Y()||Ie()}),fr=H(function(){return he(/AppleWebKit/i)&&!pr()}),pr=H(function(){return he(/Chrome/i)}),yt=H(function(){return he(/Android/i)}),br=H(function(){return he(/Firefox/i)}),vr=f.createContext({isNative:!0,open:gr,useHref:t=>t});function De(){return f.useContext(vr)}function q(t,e,r=!0){var n,i;let{metaKey:s,ctrlKey:o,altKey:c,shiftKey:p}=e;br()&&(!((i=window.event)===null||i===void 0||(n=i.type)===null||n===void 0)&&n.startsWith("key"))&&t.target==="_blank"&&(Y()?s=!0:o=!0);let y=fr()&&Y()&&!vt()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:s,ctrlKey:o,altKey:c,shiftKey:p}):new MouseEvent("click",{metaKey:s,ctrlKey:o,altKey:c,shiftKey:p,bubbles:!0,cancelable:!0});q.isOpening=r,j(t),t.dispatchEvent(y),q.isOpening=!1}q.isOpening=!1;function yr(t,e){if(t instanceof HTMLAnchorElement)e(t);else if(t.hasAttribute("data-href")){let r=document.createElement("a");r.href=t.getAttribute("data-href"),t.hasAttribute("data-target")&&(r.target=t.getAttribute("data-target")),t.hasAttribute("data-rel")&&(r.rel=t.getAttribute("data-rel")),t.hasAttribute("data-download")&&(r.download=t.getAttribute("data-download")),t.hasAttribute("data-ping")&&(r.ping=t.getAttribute("data-ping")),t.hasAttribute("data-referrer-policy")&&(r.referrerPolicy=t.getAttribute("data-referrer-policy")),t.appendChild(r),e(r),t.removeChild(r)}}function gr(t,e){yr(t,r=>q(r,e))}function hr(t){let e=De();return{href:t!=null&&t.href?e.useHref(t==null?void 0:t.href):void 0,target:t==null?void 0:t.target,rel:t==null?void 0:t.rel,download:t==null?void 0:t.download,ping:t==null?void 0:t.ping,referrerPolicy:t==null?void 0:t.referrerPolicy}}let re=new Map,we=new Set;function Ve(){if(typeof window>"u")return;function t(n){return"propertyName"in n}let e=n=>{if(!t(n)||!n.target)return;let i=re.get(n.target);i||(i=new Set,re.set(n.target,i),n.target.addEventListener("transitioncancel",r,{once:!0})),i.add(n.propertyName)},r=n=>{if(!t(n)||!n.target)return;let i=re.get(n.target);if(i&&(i.delete(n.propertyName),i.size===0&&(n.target.removeEventListener("transitioncancel",r),re.delete(n.target)),re.size===0)){for(let s of we)s();we.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?Ve():document.addEventListener("DOMContentLoaded",Ve));function gt(t){requestAnimationFrame(()=>{re.size===0?t():we.add(t)})}function ht(){let t=f.useRef(new Map),e=f.useCallback((i,s,o,c)=>{let p=c!=null&&c.once?(...y)=>{t.current.delete(o),o(...y)}:o;t.current.set(o,{type:s,eventTarget:i,fn:p,options:c}),i.addEventListener(s,o,c)},[]),r=f.useCallback((i,s,o,c)=>{var p;let y=((p=t.current.get(o))===null||p===void 0?void 0:p.fn)||o;i.removeEventListener(s,y,c),t.current.delete(o)},[]),n=f.useCallback(()=>{t.current.forEach((i,s)=>{r(i.eventTarget,i.type,s,i.options)})},[r]);return f.useEffect(()=>n,[n]),{addGlobalListener:e,removeGlobalListener:r,removeAllGlobalListeners:n}}function $t(t,e){let{id:r,"aria-label":n,"aria-labelledby":i}=t;return r=ft(r),i&&n?i=[...new Set([r,...i.trim().split(/\s+/)])].join(" "):i&&(i=i.trim().split(/\s+/).join(" ")),!n&&!i&&e&&(n=e),{id:r,"aria-label":n,"aria-labelledby":i}}function $r(t,e){oe(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function mr(t,e){let r=window.getComputedStyle(t),n=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return n&&e&&(n=t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth),n}function Kr(t,e){const r=[];for(;t&&t!==document.documentElement;)mr(t,e)&&r.push(t),t=t.parentElement;return r}let Sr=0;const Ke=new Map;function Tr(t){let[e,r]=f.useState();return oe(()=>{if(!t)return;let n=Ke.get(t);if(n)r(n.element.id);else{let i=`react-aria-description-${Sr++}`;r(i);let s=document.createElement("div");s.id=i,s.style.display="none",s.textContent=t,document.body.appendChild(s),n={refCount:0,element:s},Ke.set(t,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),Ke.delete(t))}},[t]),{"aria-describedby":t?e:void 0}}function Ge(t,e,r,n){let i=te(r),s=r==null;f.useEffect(()=>{if(s||!t.current)return;let o=t.current;return o.addEventListener(e,i,n),()=>{o.removeEventListener(e,i,n)}},[t,e,n,s,i])}function mt(t,e){let r=Xe(t,e,"left"),n=Xe(t,e,"top"),i=e.offsetWidth,s=e.offsetHeight,o=t.scrollLeft,c=t.scrollTop,{borderTopWidth:p,borderLeftWidth:y}=getComputedStyle(t),g=t.scrollLeft+parseInt(y,10),S=t.scrollTop+parseInt(p,10),$=g+t.clientWidth,h=S+t.clientHeight;r<=o?o=r-parseInt(y,10):r+i>$&&(o+=r+i-$),n<=S?c=n-parseInt(p,10):n+s>h&&(c+=n+s-h),t.scrollLeft=o,t.scrollTop=c}function Xe(t,e,r){const n=r==="left"?"offsetLeft":"offsetTop";let i=0;for(;e.offsetParent&&(i+=e[n],e.offsetParent!==t);){if(e.offsetParent.contains(t)){i-=t[n];break}e=e.offsetParent}return i}function Ye(t,e){if(document.contains(t)){let o=document.scrollingElement||document.documentElement;if(window.getComputedStyle(o).overflow==="hidden"){let p=Kr(t);for(let y of p)mt(y,t)}else{var r;let{left:p,top:y}=t.getBoundingClientRect();t==null||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{block:"nearest"});let{left:g,top:S}=t.getBoundingClientRect();if(Math.abs(p-g)>1||Math.abs(y-S)>1){var n,i,s;e==null||(i=e.containingElement)===null||i===void 0||(n=i.scrollIntoView)===null||n===void 0||n.call(i,{block:"center",inline:"center"}),(s=t.scrollIntoView)===null||s===void 0||s.call(t,{block:"nearest"})}}}}function Pe(t){return t.mozInputSource===0&&t.isTrusted?!0:yt()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function wr(t){return!yt()&&t.width===0&&t.height===0||t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"}function _e(t){return dr()?t.altKey:t.ctrlKey}function ne(t){return Y()?t.metaKey:t.ctrlKey}const Pr=1e3;function _r(t){let{keyboardDelegate:e,selectionManager:r,onTypeSelect:n}=t,i=f.useRef({search:"",timeout:null}).current,s=o=>{let c=Er(o.key);if(!c||o.ctrlKey||o.metaKey||!o.currentTarget.contains(o.target))return;c===" "&&i.search.trim().length>0&&(o.preventDefault(),"continuePropagation"in o||o.stopPropagation()),i.search+=c;let p=e.getKeyForSearch(i.search,r.focusedKey);p==null&&(p=e.getKeyForSearch(i.search)),p!=null&&(r.setFocusedKey(p),n&&n(p)),clearTimeout(i.timeout),i.timeout=setTimeout(()=>{i.search=""},Pr)};return{typeSelectProps:{onKeyDownCapture:e.getKeyForSearch?s:null}}}function Er(t){return t.length===1||!/^[A-Z]/i.test(t)?t:""}let ie="default",Ee="",pe=new WeakMap;function qe(t){if(Ie()){if(ie==="default"){const e=D(t);Ee=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}ie="disabled"}else(t instanceof HTMLElement||t instanceof SVGElement)&&(pe.set(t,t.style.userSelect),t.style.userSelect="none")}function ue(t){if(Ie()){if(ie!=="disabled")return;ie="restoring",setTimeout(()=>{gt(()=>{if(ie==="restoring"){const e=D(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=Ee||""),Ee="",ie="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&pe.has(t)){let e=pe.get(t);t.style.userSelect==="none"&&(t.style.userSelect=e),t.getAttribute("style")===""&&t.removeAttribute("style"),pe.delete(t)}}const Kt=f.createContext({register:()=>{}});Kt.displayName="PressResponderContext";function xr(t,e){return e.get?e.get.call(t):e.value}function St(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function kr(t,e){var r=St(t,e,"get");return xr(t,r)}function Mr(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Lr(t,e,r){Mr(t,e),e.set(t,r)}function Cr(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function Je(t,e,r){var n=St(t,e,"set");return Cr(t,n,r),r}function Ir(t){let e=f.useContext(Kt);if(e){let{register:r,...n}=e;t=V(n,t),r()}return $r(e,t.ref),t}var de=new WeakMap;class fe{continuePropagation(){Je(this,de,!1)}get shouldStopPropagation(){return kr(this,de)}constructor(e,r,n,i){Lr(this,de,{writable:!0,value:void 0}),Je(this,de,!0);var s;let o=(s=i==null?void 0:i.target)!==null&&s!==void 0?s:n.currentTarget;const c=o==null?void 0:o.getBoundingClientRect();let p,y=0,g,S=null;n.clientX!=null&&n.clientY!=null&&(g=n.clientX,S=n.clientY),c&&(g!=null&&S!=null?(p=g-c.left,y=S-c.top):(p=c.width/2,y=c.height/2)),this.type=e,this.pointerType=r,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=p,this.y=y}}const Ze=Symbol("linkClicked");function Tt(t){let{onPress:e,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:s,isDisabled:o,isPressed:c,preventFocusOnPress:p,shouldCancelOnPointerExit:y,allowTextSelectionOnPress:g,ref:S,...$}=Ir(t),[h,M]=f.useState(!1),_=f.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:w,removeAllGlobalListeners:x}=ht(),k=te((l,m)=>{let b=_.current;if(o||b.didFirePressStart)return!1;let d=!0;if(b.isTriggeringEvent=!0,n){let T=new fe("pressstart",m,l);n(T),d=T.shouldStopPropagation}return r&&r(!0),b.isTriggeringEvent=!1,b.didFirePressStart=!0,M(!0),d}),E=te((l,m,b=!0)=>{let d=_.current;if(!d.didFirePressStart)return!1;d.ignoreClickAfterPress=!0,d.didFirePressStart=!1,d.isTriggeringEvent=!0;let T=!0;if(i){let a=new fe("pressend",m,l);i(a),T=a.shouldStopPropagation}if(r&&r(!1),M(!1),e&&b&&!o){let a=new fe("press",m,l);e(a),T&&(T=a.shouldStopPropagation)}return d.isTriggeringEvent=!1,T}),C=te((l,m)=>{let b=_.current;if(o)return!1;if(s){b.isTriggeringEvent=!0;let d=new fe("pressup",m,l);return s(d),b.isTriggeringEvent=!1,d.shouldStopPropagation}return!0}),L=te(l=>{let m=_.current;m.isPressed&&m.target&&(m.isOverTarget&&m.pointerType!=null&&E(U(m.target,l),m.pointerType,!1),m.isPressed=!1,m.isOverTarget=!1,m.activePointerId=null,m.pointerType=null,x(),g||ue(m.target))}),I=te(l=>{y&&L(l)}),N=f.useMemo(()=>{let l=_.current,m={onKeyDown(d){if(Se(d.nativeEvent,d.currentTarget)&&d.currentTarget.contains(d.target)){var T;et(d.target,d.key)&&d.preventDefault();let a=!0;if(!l.isPressed&&!d.repeat){l.target=d.currentTarget,l.isPressed=!0,a=k(d,"keyboard");let u=d.currentTarget,P=A=>{Se(A,u)&&!A.repeat&&u.contains(A.target)&&l.target&&C(U(l.target,A),"keyboard")};w(D(d.currentTarget),"keyup",pt(P,b),!0)}a&&d.stopPropagation(),d.metaKey&&Y()&&((T=l.metaKeyEvents)===null||T===void 0||T.set(d.key,d.nativeEvent))}else d.key==="Meta"&&(l.metaKeyEvents=new Map)},onClick(d){if(!(d&&!d.currentTarget.contains(d.target))&&d&&d.button===0&&!l.isTriggeringEvent&&!q.isOpening){let T=!0;if(o&&d.preventDefault(),!l.ignoreClickAfterPress&&!l.ignoreEmulatedMouseEvents&&!l.isPressed&&(l.pointerType==="virtual"||Pe(d.nativeEvent))){!o&&!p&&j(d.currentTarget);let a=k(d,"virtual"),u=C(d,"virtual"),P=E(d,"virtual");T=a&&u&&P}l.ignoreEmulatedMouseEvents=!1,l.ignoreClickAfterPress=!1,T&&d.stopPropagation()}}},b=d=>{var T;if(l.isPressed&&l.target&&Se(d,l.target)){var a;et(d.target,d.key)&&d.preventDefault();let P=d.target;E(U(l.target,d),"keyboard",l.target.contains(P)),x(),d.key!=="Enter"&&Ae(l.target)&&l.target.contains(P)&&!d[Ze]&&(d[Ze]=!0,q(l.target,d,!1)),l.isPressed=!1,(a=l.metaKeyEvents)===null||a===void 0||a.delete(d.key)}else if(d.key==="Meta"&&(!((T=l.metaKeyEvents)===null||T===void 0)&&T.size)){var u;let P=l.metaKeyEvents;l.metaKeyEvents=void 0;for(let A of P.values())(u=l.target)===null||u===void 0||u.dispatchEvent(new KeyboardEvent("keyup",A))}};if(typeof PointerEvent<"u"){m.onPointerDown=u=>{if(u.button!==0||!u.currentTarget.contains(u.target))return;if(wr(u.nativeEvent)){l.pointerType="virtual";return}Te(u.currentTarget)&&u.preventDefault(),l.pointerType=u.pointerType;let P=!0;l.isPressed||(l.isPressed=!0,l.isOverTarget=!0,l.activePointerId=u.pointerId,l.target=u.currentTarget,!o&&!p&&j(u.currentTarget),g||qe(l.target),P=k(u,l.pointerType),w(D(u.currentTarget),"pointermove",d,!1),w(D(u.currentTarget),"pointerup",T,!1),w(D(u.currentTarget),"pointercancel",a,!1)),P&&u.stopPropagation()},m.onMouseDown=u=>{u.currentTarget.contains(u.target)&&u.button===0&&(Te(u.currentTarget)&&u.preventDefault(),u.stopPropagation())},m.onPointerUp=u=>{!u.currentTarget.contains(u.target)||l.pointerType==="virtual"||u.button===0&&Q(u,u.currentTarget)&&C(u,l.pointerType||u.pointerType)};let d=u=>{u.pointerId===l.activePointerId&&(l.target&&Q(u,l.target)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,k(U(l.target,u),l.pointerType)):l.target&&l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,E(U(l.target,u),l.pointerType,!1),I(u)))},T=u=>{u.pointerId===l.activePointerId&&l.isPressed&&u.button===0&&l.target&&(Q(u,l.target)&&l.pointerType!=null?E(U(l.target,u),l.pointerType):l.isOverTarget&&l.pointerType!=null&&E(U(l.target,u),l.pointerType,!1),l.isPressed=!1,l.isOverTarget=!1,l.activePointerId=null,l.pointerType=null,x(),g||ue(l.target))},a=u=>{L(u)};m.onDragStart=u=>{u.currentTarget.contains(u.target)&&L(u)}}else{m.onMouseDown=a=>{if(a.button!==0||!a.currentTarget.contains(a.target))return;if(Te(a.currentTarget)&&a.preventDefault(),l.ignoreEmulatedMouseEvents){a.stopPropagation();return}l.isPressed=!0,l.isOverTarget=!0,l.target=a.currentTarget,l.pointerType=Pe(a.nativeEvent)?"virtual":"mouse",!o&&!p&&j(a.currentTarget),k(a,l.pointerType)&&a.stopPropagation(),w(D(a.currentTarget),"mouseup",d,!1)},m.onMouseEnter=a=>{if(!a.currentTarget.contains(a.target))return;let u=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!0,u=k(a,l.pointerType)),u&&a.stopPropagation()},m.onMouseLeave=a=>{if(!a.currentTarget.contains(a.target))return;let u=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!1,u=E(a,l.pointerType,!1),I(a)),u&&a.stopPropagation()},m.onMouseUp=a=>{a.currentTarget.contains(a.target)&&!l.ignoreEmulatedMouseEvents&&a.button===0&&C(a,l.pointerType||"mouse")};let d=a=>{if(a.button===0){if(l.isPressed=!1,x(),l.ignoreEmulatedMouseEvents){l.ignoreEmulatedMouseEvents=!1;return}l.target&&Q(a,l.target)&&l.pointerType!=null?E(U(l.target,a),l.pointerType):l.target&&l.isOverTarget&&l.pointerType!=null&&E(U(l.target,a),l.pointerType,!1),l.isOverTarget=!1}};m.onTouchStart=a=>{if(!a.currentTarget.contains(a.target))return;let u=Dr(a.nativeEvent);if(!u)return;l.activePointerId=u.identifier,l.ignoreEmulatedMouseEvents=!0,l.isOverTarget=!0,l.isPressed=!0,l.target=a.currentTarget,l.pointerType="touch",!o&&!p&&j(a.currentTarget),g||qe(l.target),k(W(l.target,a),l.pointerType)&&a.stopPropagation(),w(X(a.currentTarget),"scroll",T,!0)},m.onTouchMove=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let u=Qe(a.nativeEvent,l.activePointerId),P=!0;u&&Q(u,a.currentTarget)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,P=k(W(l.target,a),l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,P=E(W(l.target,a),l.pointerType,!1),I(W(l.target,a))),P&&a.stopPropagation()},m.onTouchEnd=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let u=Qe(a.nativeEvent,l.activePointerId),P=!0;u&&Q(u,a.currentTarget)&&l.pointerType!=null?(C(W(l.target,a),l.pointerType),P=E(W(l.target,a),l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(P=E(W(l.target,a),l.pointerType,!1)),P&&a.stopPropagation(),l.isPressed=!1,l.activePointerId=null,l.isOverTarget=!1,l.ignoreEmulatedMouseEvents=!0,l.target&&!g&&ue(l.target),x()},m.onTouchCancel=a=>{a.currentTarget.contains(a.target)&&(a.stopPropagation(),l.isPressed&&L(W(l.target,a)))};let T=a=>{l.isPressed&&a.target.contains(l.target)&&L({currentTarget:l.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};m.onDragStart=a=>{a.currentTarget.contains(a.target)&&L(a)}}return m},[w,o,p,x,g,L,I,E,k,C]);return f.useEffect(()=>()=>{var l;g||ue((l=_.current.target)!==null&&l!==void 0?l:void 0)},[g]),{isPressed:c||h,pressProps:V($,N)}}function Ae(t){return t.tagName==="A"&&t.hasAttribute("href")}function Se(t,e){const{key:r,code:n}=t,i=e,s=i.getAttribute("role");return(r==="Enter"||r===" "||r==="Spacebar"||n==="Space")&&!(i instanceof X(i).HTMLInputElement&&!wt(i,r)||i instanceof X(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&Ae(i))&&r!=="Enter")}function Dr(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function Qe(t,e){const r=t.changedTouches;for(let n=0;n<r.length;n++){const i=r[n];if(i.identifier===e)return i}return null}function W(t,e){let r=0,n=0;return e.targetTouches&&e.targetTouches.length===1&&(r=e.targetTouches[0].clientX,n=e.targetTouches[0].clientY),{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:r,clientY:n}}function U(t,e){let r=e.clientX,n=e.clientY;return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:r,clientY:n}}function Ar(t){let e=0,r=0;return t.width!==void 0?e=t.width/2:t.radiusX!==void 0&&(e=t.radiusX),t.height!==void 0?r=t.height/2:t.radiusY!==void 0&&(r=t.radiusY),{top:t.clientY-r,right:t.clientX+e,bottom:t.clientY+r,left:t.clientX-e}}function Or(t,e){return!(t.left>e.right||e.left>t.right||t.top>e.bottom||e.top>t.bottom)}function Q(t,e){let r=e.getBoundingClientRect(),n=Ar(t);return Or(r,n)}function Te(t){return!(t instanceof HTMLElement)||!t.hasAttribute("draggable")}function et(t,e){return t instanceof HTMLInputElement?!wt(t,e):t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!Ae(t)}const Fr=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function wt(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":Fr.has(t.type)}let ae=null,zr=new Set,se=new Map,J=!1,xe=!1;function Oe(t,e){for(let r of zr)r(t,e)}function Rr(t){return!(t.metaKey||!Y()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function ge(t){J=!0,Rr(t)&&(ae="keyboard",Oe("keyboard",t))}function O(t){ae="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(J=!0,Oe("pointer",t))}function Pt(t){Pe(t)&&(J=!0,ae="virtual")}function _t(t){t.target===window||t.target===document||(!J&&!xe&&(ae="virtual",Oe("virtual",t)),J=!1,xe=!1)}function Et(){J=!1,xe=!0}function tt(t){if(typeof window>"u"||se.get(X(t)))return;const e=X(t),r=D(t);let n=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){J=!0,n.apply(this,arguments)},r.addEventListener("keydown",ge,!0),r.addEventListener("keyup",ge,!0),r.addEventListener("click",Pt,!0),e.addEventListener("focus",_t,!0),e.addEventListener("blur",Et,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",O,!0),r.addEventListener("pointermove",O,!0),r.addEventListener("pointerup",O,!0)):(r.addEventListener("mousedown",O,!0),r.addEventListener("mousemove",O,!0),r.addEventListener("mouseup",O,!0)),e.addEventListener("beforeunload",()=>{xt(t)},{once:!0}),se.set(e,{focus:n})}const xt=(t,e)=>{const r=X(t),n=D(t);e&&n.removeEventListener("DOMContentLoaded",e),se.has(r)&&(r.HTMLElement.prototype.focus=se.get(r).focus,n.removeEventListener("keydown",ge,!0),n.removeEventListener("keyup",ge,!0),n.removeEventListener("click",Pt,!0),r.removeEventListener("focus",_t,!0),r.removeEventListener("blur",Et,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",O,!0),n.removeEventListener("pointermove",O,!0),n.removeEventListener("pointerup",O,!0)):(n.removeEventListener("mousedown",O,!0),n.removeEventListener("mousemove",O,!0),n.removeEventListener("mouseup",O,!0)),se.delete(r))};function Nr(t){const e=D(t);let r;return e.readyState!=="loading"?tt(t):(r=()=>{tt(t)},e.addEventListener("DOMContentLoaded",r)),()=>xt(t,r)}typeof document<"u"&&Nr();function ke(){return ae}const Br=500;function Ur(t){let{isDisabled:e,onLongPressStart:r,onLongPressEnd:n,onLongPress:i,threshold:s=Br,accessibilityDescription:o}=t;const c=f.useRef(void 0);let{addGlobalListener:p,removeGlobalListener:y}=ht(),{pressProps:g}=Tt({isDisabled:e,onPressStart($){if($.continuePropagation(),($.pointerType==="mouse"||$.pointerType==="touch")&&(r&&r({...$,type:"longpressstart"}),c.current=setTimeout(()=>{$.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),i&&i({...$,type:"longpress"}),c.current=void 0},s),$.pointerType==="touch")){let h=M=>{M.preventDefault()};p($.target,"contextmenu",h,{once:!0}),p(window,"pointerup",()=>{setTimeout(()=>{y($.target,"contextmenu",h)},30)},{once:!0})}},onPressEnd($){c.current&&clearTimeout(c.current),n&&($.pointerType==="mouse"||$.pointerType==="touch")&&n({...$,type:"longpressend"})}}),S=Tr(i&&!e?o:void 0);return{longPressProps:V(g,S)}}function Me(t){const e=D(t);if(ke()==="virtual"){let r=e.activeElement;gt(()=>{e.activeElement===r&&t.isConnected&&j(t)})}else j(t)}function jr(t){const e=X(t);if(!(t instanceof e.HTMLElement)&&!(t instanceof e.SVGElement))return!1;let{display:r,visibility:n}=t.style,i=r!=="none"&&n!=="hidden"&&n!=="collapse";if(i){const{getComputedStyle:s}=t.ownerDocument.defaultView;let{display:o,visibility:c}=s(t);i=o!=="none"&&c!=="hidden"&&c!=="collapse"}return i}function Hr(t,e){return!t.hasAttribute("hidden")&&!t.hasAttribute("data-react-aria-prevent-focus")&&(t.nodeName==="DETAILS"&&e&&e.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}function kt(t,e){return t.nodeName!=="#comment"&&jr(t)&&Hr(t,e)&&(!t.parentElement||kt(t.parentElement,t))}const Fe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],Wr=Fe.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Fe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Vr=Fe.join(':not([hidden]):not([tabindex="-1"]),');function Mt(t,e){return!t||!e?!1:e.some(r=>r.contains(t))}function Lt(t,e,r){let n=e!=null&&e.tabbable?Vr:Wr,i=D(t).createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(s){var o;return!(e==null||(o=e.from)===null||o===void 0)&&o.contains(s)?NodeFilter.FILTER_REJECT:s.matches(n)&&kt(s)&&(!r||Mt(s,r))&&(!(e!=null&&e.accept)||e.accept(s))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return e!=null&&e.from&&(i.currentNode=e.from),i}class ze{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,r,n){let i=this.fastMap.get(r??null);if(!i)return;let s=new rt({scopeRef:e});i.addChild(s),s.parent=i,this.fastMap.set(e,s),n&&(s.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let r=this.fastMap.get(e);if(!r)return;let n=r.parent;for(let s of this.traverse())s!==r&&r.nodeToRestore&&s.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&Mt(s.nodeToRestore,r.scopeRef.current)&&(s.nodeToRestore=r.nodeToRestore);let i=r.children;n&&(n.removeChild(r),i.size>0&&i.forEach(s=>n&&n.addChild(s))),this.fastMap.delete(r.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let r of e.children)yield*this.traverse(r)}clone(){var e;let r=new ze;var n;for(let i of this.traverse())r.addTreeNode(i.scopeRef,(n=(e=i.parent)===null||e===void 0?void 0:e.scopeRef)!==null&&n!==void 0?n:null,i.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new rt({scopeRef:null}),this.fastMap.set(null,this.root)}}class rt{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}new ze;function Gr(t,e){let r=e==null?void 0:e.isDisabled,[n,i]=f.useState(!1);return oe(()=>{if(t!=null&&t.current&&!r){let s=()=>{if(t.current){let c=Lt(t.current,{tabbable:!0});i(!!c.nextNode())}};s();let o=new MutationObserver(s);return o.observe(t.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{o.disconnect()}}}),r?!1:n}const Xr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Yr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function qr(t){if(Intl.Locale){let r=new Intl.Locale(t).maximize(),n=typeof r.getTextInfo=="function"?r.getTextInfo():r.textInfo;if(n)return n.direction==="rtl";if(r.script)return Xr.has(r.script)}let e=t.split("-")[0];return Yr.has(e)}const Jr=Symbol.for("react-aria.i18n.locale");function Ct(){let t=typeof window<"u"&&window[Jr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{t="en-US"}return{locale:t,direction:qr(t)?"rtl":"ltr"}}let Le=Ct(),le=new Set;function nt(){Le=Ct();for(let t of le)t(Le)}function Zr(){let t=dt(),[e,r]=f.useState(Le);return f.useEffect(()=>(le.size===0&&window.addEventListener("languagechange",nt),le.add(r),()=>{le.delete(r),le.size===0&&window.removeEventListener("languagechange",nt)}),[]),t?{locale:"en-US",direction:"ltr"}:e}const Qr=f.createContext(null);function It(){let t=Zr();return f.useContext(Qr)||t}function en(t){let{selectionManager:e,keyboardDelegate:r,ref:n,autoFocus:i=!1,shouldFocusWrap:s=!1,disallowEmptySelection:o=!1,disallowSelectAll:c=!1,selectOnFocus:p=e.selectionBehavior==="replace",disallowTypeAhead:y=!1,shouldUseVirtualFocus:g,allowsTabNavigation:S=!1,isVirtualized:$,scrollRef:h=n,linkBehavior:M="action"}=t,{direction:_}=It(),w=De(),x=b=>{if(b.altKey&&b.key==="Tab"&&b.preventDefault(),!n.current.contains(b.target))return;const d=(K,G)=>{if(K!=null){if(e.isLink(K)&&M==="selection"&&p&&!_e(b)){Ot.flushSync(()=>{e.setFocusedKey(K,G)});let Z=h.current.querySelector(`[data-key="${CSS.escape(K.toString())}"]`),Be=e.getItemProps(K);w.open(Z,b,Be.href,Be.routerOptions);return}if(e.setFocusedKey(K,G),e.isLink(K)&&M==="override")return;b.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(K):p&&!_e(b)&&e.replaceSelection(K)}};switch(b.key){case"ArrowDown":if(r.getKeyBelow){var T,a;b.preventDefault();let K=e.focusedKey!=null?r.getKeyBelow(e.focusedKey):(T=r.getFirstKey)===null||T===void 0?void 0:T.call(r);K==null&&s&&(K=(a=r.getFirstKey)===null||a===void 0?void 0:a.call(r,e.focusedKey)),d(K)}break;case"ArrowUp":if(r.getKeyAbove){var u,P;b.preventDefault();let K=e.focusedKey!=null?r.getKeyAbove(e.focusedKey):(u=r.getLastKey)===null||u===void 0?void 0:u.call(r);K==null&&s&&(K=(P=r.getLastKey)===null||P===void 0?void 0:P.call(r,e.focusedKey)),d(K)}break;case"ArrowLeft":if(r.getKeyLeftOf){var A,v;b.preventDefault();let K=r.getKeyLeftOf(e.focusedKey);K==null&&s&&(K=_==="rtl"?(A=r.getFirstKey)===null||A===void 0?void 0:A.call(r,e.focusedKey):(v=r.getLastKey)===null||v===void 0?void 0:v.call(r,e.focusedKey)),d(K,_==="rtl"?"first":"last")}break;case"ArrowRight":if(r.getKeyRightOf){var B,$e;b.preventDefault();let K=r.getKeyRightOf(e.focusedKey);K==null&&s&&(K=_==="rtl"?(B=r.getLastKey)===null||B===void 0?void 0:B.call(r,e.focusedKey):($e=r.getFirstKey)===null||$e===void 0?void 0:$e.call(r,e.focusedKey)),d(K,_==="rtl"?"last":"first")}break;case"Home":if(r.getFirstKey){b.preventDefault();let K=r.getFirstKey(e.focusedKey,ne(b));e.setFocusedKey(K),ne(b)&&b.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(K):p&&e.replaceSelection(K)}break;case"End":if(r.getLastKey){b.preventDefault();let K=r.getLastKey(e.focusedKey,ne(b));e.setFocusedKey(K),ne(b)&&b.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(K):p&&e.replaceSelection(K)}break;case"PageDown":if(r.getKeyPageBelow){b.preventDefault();let K=r.getKeyPageBelow(e.focusedKey);d(K)}break;case"PageUp":if(r.getKeyPageAbove){b.preventDefault();let K=r.getKeyPageAbove(e.focusedKey);d(K)}break;case"a":ne(b)&&e.selectionMode==="multiple"&&c!==!0&&(b.preventDefault(),e.selectAll());break;case"Escape":!o&&e.selectedKeys.size!==0&&(b.stopPropagation(),b.preventDefault(),e.clearSelection());break;case"Tab":if(!S){if(b.shiftKey)n.current.focus();else{let K=Lt(n.current,{tabbable:!0}),G,Z;do Z=K.lastChild(),Z&&(G=Z);while(Z);G&&!G.contains(document.activeElement)&&j(G)}break}}},k=f.useRef({top:0,left:0});Ge(h,"scroll",$?null:()=>{k.current={top:h.current.scrollTop,left:h.current.scrollLeft}});let E=b=>{if(e.isFocused){b.currentTarget.contains(b.target)||e.setFocused(!1);return}if(b.currentTarget.contains(b.target)){if(e.setFocused(!0),e.focusedKey==null){let a=P=>{P!=null&&(e.setFocusedKey(P),p&&e.replaceSelection(P))},u=b.relatedTarget;var d,T;u&&b.currentTarget.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING?a((d=e.lastSelectedKey)!==null&&d!==void 0?d:r.getLastKey()):a((T=e.firstSelectedKey)!==null&&T!==void 0?T:r.getFirstKey())}else $||(h.current.scrollTop=k.current.top,h.current.scrollLeft=k.current.left);if(e.focusedKey!=null){let a=h.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);a&&(a.contains(document.activeElement)||j(a),ke()==="keyboard"&&Ye(a,{containingElement:n.current}))}}},C=b=>{b.currentTarget.contains(b.relatedTarget)||e.setFocused(!1)};const L=f.useRef(i);f.useEffect(()=>{if(L.current){let b=null;i==="first"&&(b=r.getFirstKey()),i==="last"&&(b=r.getLastKey());let d=e.selectedKeys;if(d.size){for(let T of d)if(e.canSelectItem(T)){b=T;break}}e.setFocused(!0),e.setFocusedKey(b),b==null&&!g&&Me(n.current)}},[]);let I=f.useRef(e.focusedKey);f.useEffect(()=>{if(e.isFocused&&e.focusedKey!=null&&(e.focusedKey!==I.current||L.current)&&(h!=null&&h.current)){let b=ke(),d=n.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);if(!d)return;(b==="keyboard"||L.current)&&(mt(h.current,d),b!=="virtual"&&Ye(d,{containingElement:n.current}))}e.isFocused&&e.focusedKey==null&&I.current!=null&&Me(n.current),I.current=e.focusedKey,L.current=!1}),Ge(n,"react-aria-focus-scope-restore",b=>{b.preventDefault(),e.setFocused(!0)});let N={onKeyDown:x,onFocus:E,onBlur:C,onMouseDown(b){h.current===b.target&&b.preventDefault()}},{typeSelectProps:l}=_r({keyboardDelegate:r,selectionManager:e});y||(N=V(l,N));let m;return g||(m=e.focusedKey==null?0:-1),{collectionProps:{...N,tabIndex:m}}}function tn(t){let{selectionManager:e,key:r,ref:n,shouldSelectOnPressUp:i,shouldUseVirtualFocus:s,focus:o,isDisabled:c,onAction:p,allowsDifferentPressOrigin:y,linkBehavior:g="action"}=t,S=De(),$=v=>{if(v.pointerType==="keyboard"&&_e(v))e.toggleSelection(r);else{if(e.selectionMode==="none")return;if(e.isLink(r)){if(g==="selection"){let B=e.getItemProps(r);S.open(n.current,v,B.href,B.routerOptions),e.setSelectedKeys(e.selectedKeys);return}else if(g==="override"||g==="none")return}e.selectionMode==="single"?e.isSelected(r)&&!e.disallowEmptySelection?e.toggleSelection(r):e.replaceSelection(r):v&&v.shiftKey?e.extendSelection(r):e.selectionBehavior==="toggle"||v&&(ne(v)||v.pointerType==="touch"||v.pointerType==="virtual")?e.toggleSelection(r):e.replaceSelection(r)}};f.useEffect(()=>{r===e.focusedKey&&e.isFocused&&!s&&(o?o():document.activeElement!==n.current&&Me(n.current))},[n,r,e.focusedKey,e.childFocusStrategy,e.isFocused,s]),c=c||e.isDisabled(r);let h={};!s&&!c?h={tabIndex:r===e.focusedKey?0:-1,onFocus(v){v.target===n.current&&e.setFocusedKey(r)}}:c&&(h.onMouseDown=v=>{v.preventDefault()});let M=e.isLink(r)&&g==="override",_=e.isLink(r)&&g!=="selection"&&g!=="none",w=!c&&e.canSelectItem(r)&&!M,x=(p||_)&&!c,k=x&&(e.selectionBehavior==="replace"?!w:!w||e.isEmpty),E=x&&w&&e.selectionBehavior==="replace",C=k||E,L=f.useRef(null),I=C&&w,N=f.useRef(!1),l=f.useRef(!1),m=v=>{if(p&&p(),_){let B=e.getItemProps(r);S.open(n.current,v,B.href,B.routerOptions)}},b={};i?(b.onPressStart=v=>{L.current=v.pointerType,N.current=I,v.pointerType==="keyboard"&&(!C||lt())&&$(v)},y?(b.onPressUp=k?null:v=>{v.pointerType!=="keyboard"&&w&&$(v)},b.onPress=k?m:null):b.onPress=v=>{if(k||E&&v.pointerType!=="mouse"){if(v.pointerType==="keyboard"&&!it())return;m(v)}else v.pointerType!=="keyboard"&&w&&$(v)}):(b.onPressStart=v=>{L.current=v.pointerType,N.current=I,l.current=k,w&&(v.pointerType==="mouse"&&!k||v.pointerType==="keyboard"&&(!x||lt()))&&$(v)},b.onPress=v=>{(v.pointerType==="touch"||v.pointerType==="pen"||v.pointerType==="virtual"||v.pointerType==="keyboard"&&C&&it()||v.pointerType==="mouse"&&l.current)&&(C?m(v):w&&$(v))}),h["data-key"]=r,b.preventFocusOnPress=s;let{pressProps:d,isPressed:T}=Tt(b),a=E?v=>{L.current==="mouse"&&(v.stopPropagation(),v.preventDefault(),m(v))}:void 0,{longPressProps:u}=Ur({isDisabled:!I,onLongPress(v){v.pointerType==="touch"&&($(v),e.setSelectionBehavior("toggle"))}}),P=v=>{L.current==="touch"&&N.current&&v.preventDefault()},A=e.isLink(r)?v=>{q.isOpening||v.preventDefault()}:void 0;return{itemProps:V(h,w||k?d:{},I?u:{},{onDoubleClick:a,onDragStartCapture:P,onClick:A}),isPressed:T,isSelected:e.isSelected(r),isFocused:e.isFocused&&e.focusedKey===r,isDisabled:c,allowsSelection:w,hasAction:C}}function it(){let t=window.event;return(t==null?void 0:t.key)==="Enter"}function lt(){let t=window.event;return(t==null?void 0:t.key)===" "||(t==null?void 0:t.code)==="Space"}function rn(t,e,r){let{key:n,isDisabled:i,shouldSelectOnPressUp:s}=t,{selectionManager:o,selectedKey:c}=e,p=n===c,y=i||e.isDisabled||e.selectionManager.isDisabled(n),{itemProps:g,isPressed:S}=tn({selectionManager:o,key:n,ref:r,isDisabled:y,shouldSelectOnPressUp:s,linkBehavior:"selection"}),$=be(e,n,"tab"),h=be(e,n,"tabpanel"),{tabIndex:M}=g,_=e.collection.getItem(n),w=sr(_==null?void 0:_.props,{labelable:!0});delete w.id;let x=hr(_==null?void 0:_.props);return{tabProps:V(w,x,g,{id:$,"aria-selected":p,"aria-disabled":y||void 0,"aria-controls":p?h:void 0,tabIndex:y?void 0:M,role:"tab"}),isSelected:p,isDisabled:y,isPressed:S}}function nn(t,e,r){let n=Gr(r)?void 0:0;var i;const s=be(e,(i=t.id)!==null&&i!==void 0?i:e==null?void 0:e.selectedKey,"tabpanel"),o=$t({...t,id:s,"aria-labelledby":be(e,e==null?void 0:e.selectedKey,"tab")});return{tabPanelProps:V(o,{tabIndex:n,role:"tabpanel","aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"]})}}class ln{getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}getKeyAbove(e){return this.getPreviousKey(e)}getKeyBelow(e){return this.getNextKey(e)}isDisabled(e){var r,n;return this.disabledKeys.has(e)||!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.isDisabled)}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getNextKey(e){do e=this.collection.getKeyAfter(e),e==null&&(e=this.collection.getFirstKey());while(this.isDisabled(e));return e}getPreviousKey(e){do e=this.collection.getKeyBefore(e),e==null&&(e=this.collection.getLastKey());while(this.isDisabled(e));return e}constructor(e,r,n,i=new Set){this.collection=e,this.flipDirection=r==="rtl"&&n==="horizontal",this.disabledKeys=i}}function sn(t,e,r){let{orientation:n="horizontal",keyboardActivation:i="automatic"}=t,{collection:s,selectionManager:o,disabledKeys:c}=e,{direction:p}=It(),y=f.useMemo(()=>new ln(s,p,n,c),[s,c,n,p]),{collectionProps:g}=en({ref:r,selectionManager:o,keyboardDelegate:y,selectOnFocus:i==="automatic",disallowEmptySelection:!0,scrollRef:r,linkBehavior:"selection"}),S=ft();ct.set(e,S);let $=$t({...t,id:S});return{tabListProps:{...V(g,$),role:"tablist","aria-orientation":n,tabIndex:void 0}}}function on(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function st(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ot(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?st(Object(r),!0).forEach(function(n){on(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var an=(t,e,r)=>{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},Re=t=>e=>{var r=t.defaultClassName,n=ot(ot({},t.defaultVariants),e);for(var i in n){var s,o=(s=n[i])!==null&&s!==void 0?s:t.defaultVariants[i];if(o!=null){var c=o;typeof c=="boolean"&&(c=c===!0?"true":"false");var p=t.variantClassNames[i][c];p&&(r+=" "+p)}}for(var[y,g]of t.compoundVariants)an(y,n,t.defaultVariants)&&(r+=" "+g);return r},cn=Re({defaultClassName:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz0",variantClassNames:{context:{container:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz1",navigation:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz2"},active:{true:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz3",false:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz4"},disabled:{true:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz5",false:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz6"}},defaultVariants:{},compoundVariants:[[{context:"container",active:!0},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz7"],[{context:"container",active:!1},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz8"],[{context:"container",active:!1,disabled:!1},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzz9"],[{context:"navigation",active:!0},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzza"],[{context:"navigation",active:!1},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzb"],[{context:"navigation",active:!1,disabled:!1},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzc"],[{context:"navigation",active:!1,disabled:!0},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzd"]]}),un=Re({defaultClassName:"",variantClassNames:{active:{true:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzze",false:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzf"},disabled:{true:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzg",false:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzh"},context:{navigation:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzi",container:"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzj"}},defaultVariants:{},compoundVariants:[[{context:"navigation",active:!0},"pkg_sps-woodland_tabs__version_8_18_0__hash_kz6kzzk"]]});function Dt({context:t,item:e,state:r,...n}){const{key:i}=e,s=z.useRef(null),{tabProps:o}=rn({key:i},r,s),c=r.selectedKey===i,p=r.disabledKeys.has(i),y=R.modChildren(e.rendered,g=>g.type.displayName==="SpsTag"||R.Metadata.isWoodlandComponent(g.type)&&R.Metadata.get(g.type).name==="Tag"?[{className:R.cl(g.props.className,un({active:c,disabled:p,context:t}))}]:[{}]);return z.createElement("div",{...o,ref:s,className:cn({active:c,disabled:p,context:t}),...n},y)}R.Metadata.set(Dt,{name:"Tab"});function At({context:t,"data-testid":e,state:r,...n}){const i=z.useRef(null),{tabPanelProps:s}=nn(n,r,i),o=t==="container"?R.Content:"div";return z.createElement(o,{...s,ref:i,"data-testid":e},r.selectedItem?r.selectedItem.props.children:null)}R.Metadata.set(At,{name:"TabPanel"});var dn=Re({defaultClassName:"pkg_sps-woodland_tabs__version_8_18_0__hash_fy26er0",variantClassNames:{context:{container:"pkg_sps-woodland_tabs__version_8_18_0__hash_fy26er1",navigation:"pkg_sps-woodland_tabs__version_8_18_0__hash_fy26er2"}},defaultVariants:{},compoundVariants:[]});function Ne({className:t,context:e="navigation","data-testid":r,...n}){const i=jt(n),s=z.useRef(null),{tabListProps:o}=sn(n,i,s),c=R.useChildTestIdAttrBuilder({"data-testid":r});return z.createElement(z.Fragment,null,z.createElement("div",{...o,ref:s,className:R.cl(dn({context:e}),t),"data-testid":r},[...i.collection].map(p=>z.createElement(Dt,{key:p.key,item:p,state:i,context:e,...c(`tab-${String(p.key)}`)}))),z.createElement(At,{key:i.selectedItem?i.selectedItem.key:null,state:i,context:e,...c("tab-panel")}))}R.Metadata.set(Ne,{name:"Tabs"});const fn={components:[Ne],examples:{basic:{label:"Basic Navigation Tabs",description:Ue.code`
2
2
  <p>Navigation tabs</p>
3
- `,examples:{basic:{react:Be.code`
3
+ `,examples:{basic:{react:Ue.code`
4
4
  import { Item } from "@react-stately/collections";
5
5
  import { Box, Icon } from "@sps-woodland/core";
6
6
  import { Tabs } from "@sps-woodland/tabs";
@@ -61,4 +61,4 @@
61
61
  </Tabs>
62
62
  )
63
63
  }
64
- `}}}}},dn={"Tabbed Navigation":un};exports.MANIFEST=dn;exports.Tabs=Re;
64
+ `}}}}},pn={"Tabbed Navigation":fn};exports.MANIFEST=pn;exports.Tabs=Ne;