import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{C as n}from"./Tooltip.bbzhtE2V.js";import{i as r}from"./useDescription.DhcBmKN1.js";var i=Symbol.for(`react-aria.i18n.locale`),a=Symbol.for(`react-aria.i18n.strings`),o=void 0,s=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=c(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[i];if(o===void 0){let t=window[a];if(!t)return null;o={};for(let r in t)o[r]=new e({[n]:t[r]},n)}let r=o?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function c(e,t,n=`en-US`){if(t[e])return t[e];let r=l(e),i=u(e);if(i&&t[`${r}-${i}`])return t[`${r}-${i}`];if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function l(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}function u(e){if(Intl.Locale)return new Intl.Locale(e).script}var d=new Map,f=new Map,p=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=d.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),d.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=f.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),f.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}},m=e(t(),1),h=new WeakMap;function g(e){let t=h.get(e);return t||(t=new s(e),h.set(e,t)),t}function _(e,t){return t&&s.getGlobalDictionaryForPackage(t)||g(e)}function v(e,t){let{locale:r}=n(),i=_(e,t);return(0,m.useMemo)(()=>new p(r,i),[r,i])}var y=7e3,b=null;function x(e,t=`assertive`,n=y){b?b.announce(e,t,n):(b=new C,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?b.announce(e,t,n):setTimeout(()=>{b?.isAttached()&&b?.announce(e,t,n)},100))}function S(e){b&&b.clear(e)}var C=class{constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=y){if(!this.node)return;let r=document.createElement(`div`);typeof e==`object`?(r.setAttribute(`role`,`img`),r.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):r.textContent=e,t===`assertive`?this.assertiveLog?.appendChild(r):this.politeLog?.appendChild(r),e!==``&&setTimeout(()=>{r.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}};function w(e,t){let n=e;for(r(n,t)&&(n=n.parentElement);n&&!r(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}export{v as a,_ as i,x as n,p as o,S as r,s,w as t};