@easygov/web-components 0.1.2 → 0.2.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.
@@ -0,0 +1,27 @@
1
+ import{a as xs,b as jt,c as b,d as H,e as Zt,f as ys,g as ie,h as $n,i as hu,j as vu,k as xu,l as yu}from"./chunk-O3IXHDLE.js";var cf=xs(af=>{"use strict";var Zo=H();function Zv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qv=typeof Object.is=="function"?Object.is:Zv,ex=Zo.useState,tx=Zo.useEffect,nx=Zo.useLayoutEffect,ox=Zo.useDebugValue;function rx(e,t){var n=t(),o=ex({inst:{value:n,getSnapshot:t}}),r=o[0].inst,s=o[1];return nx(function(){r.value=n,r.getSnapshot=t,Qa(r)&&s({inst:r})},[e,n,t]),tx(function(){return Qa(r)&&s({inst:r}),e(function(){Qa(r)&&s({inst:r})})},[e]),ox(n),n}function Qa(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Qv(e,n)}catch{return!0}}function sx(e,t){return t()}var ix=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?sx:rx;af.useSyncExternalStore=Zo.useSyncExternalStore!==void 0?Zo.useSyncExternalStore:ix});var Ds=xs((Yb,lf)=>{"use strict";lf.exports=cf()});var ff=xs(uf=>{"use strict";var Ls=H(),ax=Ds();function cx(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lx=typeof Object.is=="function"?Object.is:cx,ux=ax.useSyncExternalStore,fx=Ls.useRef,dx=Ls.useEffect,px=Ls.useMemo,mx=Ls.useDebugValue;uf.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var s=fx(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=px(function(){function c(d){if(!l){if(l=!0,u=d,d=o(d),r!==void 0&&i.hasValue){var m=i.value;if(r(m,d))return f=m}return f=d}if(m=f,lx(u,d))return m;var g=o(d);return r!==void 0&&r(m,g)?(u=d,m):(u=d,f=g)}var l=!1,u,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,o,r]);var a=ux(e,s[0],s[1]);return dx(function(){i.hasValue=!0,i.value=a},[a]),mx(a),a}});var pf=xs((Xb,df)=>{"use strict";df.exports=ff()});var Su={login:"Anmelden",logout:"Abmelden",dashboard:"Dashboard",selectLanguage:"Sprache w\xE4hlen",loginSuccess:"Sie sind jetzt angemeldet.",logoutSuccess:"Sie wurden abgemeldet.",skipToMain:"Zum Hauptinhalt springen",allGovServices:"Alle Beh\xF6rdenleistungen",register:"Registrieren",myFavorites:"Meine Favoriten",settings:"Einstellungen",myCompanies:"Meine Unternehmen",search:"Suchen",testEnvironment:"Testumgebung",errorTitle:"Fehler",errorFallbackMessage:"Beim Laden der Kopfzeilendaten ist ein Fehler aufgetreten.",errorCustomerAccountNotAccessible:"Sie haben keinen Zugriff auf das ausgew\xE4hlte Kundenkonto.",errorReference:"Referenz",errorCloseLabel:"Schliessen",errorDetailsLabel:"Details"};var Ru={login:"Sign In",logout:"Sign Out",dashboard:"Dashboard",selectLanguage:"Select language",loginSuccess:"You are now signed in.",logoutSuccess:"You have been signed out.",skipToMain:"Skip to main content",allGovServices:"All government services",register:"Register",myFavorites:"My favorites",settings:"Settings",myCompanies:"My companies",search:"Search",testEnvironment:"Test environment",errorTitle:"Error",errorFallbackMessage:"An error occurred while loading header data.",errorCustomerAccountNotAccessible:"You do not have access to the selected customer account.",errorReference:"Reference",errorCloseLabel:"Close",errorDetailsLabel:"Details"};var wu={login:"Se connecter",logout:"Se d\xE9connecter",dashboard:"Tableau de bord",selectLanguage:"Choisir la langue",loginSuccess:"Vous \xEAtes maintenant connect\xE9.",logoutSuccess:"Vous avez \xE9t\xE9 d\xE9connect\xE9.",skipToMain:"Aller au contenu principal",allGovServices:"Toutes les prestations administratives",register:"S'inscrire",myFavorites:"Mes favoris",settings:"Param\xE8tres",myCompanies:"Mes entreprises",search:"Rechercher",testEnvironment:"Environnement de test",errorTitle:"Erreur",errorFallbackMessage:"Une erreur est survenue lors du chargement des donn\xE9es d'en-t\xEAte.",errorCustomerAccountNotAccessible:"Vous n'avez pas acc\xE8s au compte client s\xE9lectionn\xE9.",errorReference:"R\xE9f\xE9rence",errorCloseLabel:"Fermer",errorDetailsLabel:"D\xE9tails"};var bu={login:"Accedi",logout:"Esci",dashboard:"Dashboard",selectLanguage:"Seleziona la lingua",loginSuccess:"Hai effettuato l'accesso.",logoutSuccess:"Hai effettuato il logout.",skipToMain:"Vai al contenuto principale",allGovServices:"Tutte le prestazioni statali",register:"Registrati",myFavorites:"I miei preferiti",settings:"Impostazioni",myCompanies:"Le mie aziende",search:"Cerca",testEnvironment:"Ambiente di test",errorTitle:"Errore",errorFallbackMessage:"Si \xE8 verificato un errore durante il caricamento dei dati dell'intestazione.",errorCustomerAccountNotAccessible:"Non hai accesso al conto cliente selezionato.",errorReference:"Riferimento",errorCloseLabel:"Chiudi",errorDetailsLabel:"Dettagli"};var Eu={de:Su,en:Ru,fr:wu,it:bu};function nt(e,t="de"){return Eu[t]?.[e]??Eu.en?.[e]??e}var Ss=[{value:"de",label:"Deutsch"},{value:"en",label:"English"},{value:"fr",label:"Fran\xE7ais"},{value:"it",label:"Italiano"}];var Aa="eg-display-language",yv=3600*24*365;function Cu(e){if(/^[\d.]+$/.test(e))return null;let t=e.indexOf(".");if(t===-1)return null;let n=e.slice(t+1);return n.includes(".")?`.${n}`:null}function Sv(e){let t=Cu(e);if(t===null)return[];let n=[null],o=t.slice(1);for(;;){let r=o.indexOf(".");if(r===-1)break;let s=o.slice(r+1);if(!s.includes("."))break;n.push(`.${s}`),o=s}return n}function Rs(e){return e!=null&&Ss.some(t=>t.value===e)}function Rv(e,t,n){let o=[`${Aa}=${e}`,"Path=/",`Max-Age=${yv}`,"SameSite=Lax"],r=Cu(t);return r!==null&&o.push(`Domain=${r}`),n==="https:"&&o.push("Secure"),o.join("; ")}function wv(e,t){let n=[`${Aa}=`,"Path=/","Max-Age=0","SameSite=Lax"];return e!==null&&n.push(`Domain=${e}`),t==="https:"&&n.push("Secure"),n.join("; ")}function _u(){if(typeof document>"u")return null;let e=`${Aa}=`,t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e));if(t===void 0)return null;let n=t.slice(e.length);return Rs(n)?n:null}function Pu(e){if(typeof document>"u"||typeof window>"u")return;let{hostname:t,protocol:n}=window.location;for(let o of Sv(t))document.cookie=wv(o,n);document.cookie=Rv(e,t,n)}var Tu="eg:displaylanguagechange",Iu="de";function bv(){if(typeof document>"u")return null;let e=typeof navigator>"u"?void 0:navigator.language;if(typeof e!="string")return null;let t=e.slice(0,2).toLowerCase();return Rs(t)?t:null}function Da(){return _u()??bv()??Iu}var La=null,Va=new Set,Fa=!1;function Ev(){for(let e of[...Va])e()}function Ha(e){e!==La&&(La=e,Ev())}function ws(){Ha(Da())}function Cv(e){let t=e.detail,n=typeof t=="object"&&t!==null&&"locale"in t?t.locale:void 0;if(typeof n=="string"&&Rs(n)){Ha(n);return}ws()}function _v(){document.visibilityState==="visible"&&ws()}function Pv(){Fa||typeof window>"u"||(Fa=!0,window.addEventListener(Tu,Cv),window.addEventListener("focus",ws),document.addEventListener("visibilitychange",_v),ws())}function Ua(){return Fa?La??Da():Da()}function Ou(){return Iu}function Ba(e){Pu(e),Ha(e),typeof window<"u"&&window.dispatchEvent(new CustomEvent(Tu,{detail:{locale:e}}))}function Wa(e){return Pv(),Va.add(e),()=>{Va.delete(e)}}var Ie=b(H());var Zu=b(H(),1);var Jo=b(H(),1);function bs(){return typeof window<"u"}function it(e){return Es(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Sn(e){var t;return(t=(Es(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Es(e){return bs()?e instanceof Node||e instanceof Oe(e).Node:!1}function Pe(e){return bs()?e instanceof Element||e instanceof Oe(e).Element:!1}function Te(e){return bs()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function xn(e){return!bs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}function wo(e){let{overflow:t,overflowX:n,overflowY:o,display:r}=pt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Nu(e){return/^(table|td|th)$/.test(it(e))}function _r(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var Tv=/transform|translate|scale|rotate|perspective|filter/,Iv=/paint|layout|strict|content/,Ro=e=>!!e&&e!=="none",$a;function Cs(e){let t=Pe(e)?pt(e):e;return Ro(t.transform)||Ro(t.translate)||Ro(t.scale)||Ro(t.rotate)||Ro(t.perspective)||!_s()&&(Ro(t.backdropFilter)||Ro(t.filter))||Tv.test(t.willChange||"")||Iv.test(t.contain||"")}function Mu(e){let t=yn(e);for(;Te(t)&&!Rn(t);){if(Cs(t))return t;if(_r(t))return null;t=yn(t)}return null}function _s(){return $a==null&&($a=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),$a}function Rn(e){return/^(html|body|#document)$/.test(it(e))}function pt(e){return Oe(e).getComputedStyle(e)}function Pr(e){return Pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yn(e){if(it(e)==="html")return e;let t=e.assignedSlot||e.parentNode||xn(e)&&e.host||Sn(e);return xn(t)?t.host:t}function ku(e){let t=yn(e);return Rn(t)?(e.ownerDocument||e).body:Te(t)&&wo(t)?t:ku(t)}function jn(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ku(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),i=Oe(r);if(s){let a=Ps(i);return t.concat(i,i.visualViewport||[],wo(r)?r:[],a&&n?jn(a):[])}else return t.concat(r,jn(r,[],n))}function Ps(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Ov=b(H(),1),Tr={...Ov};var Du=b(H(),1),Au={};function He(e,t){let n=Du.useRef(Au);return n.current===Au&&(n.current=e(t)),n}var ja=Tr.useInsertionEffect,Nv=ja&&ja!==Tr.useLayoutEffect?ja:e=>e();function z(e){let t=He(Mv).current;return t.next=e,Nv(t.effect),t.trampoline}function Mv(){let e={next:void 0,callback:kv,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function kv(){}var Lu=b(H(),1),Av=()=>{},B=typeof document<"u"?Lu.useLayoutEffect:Av;function Ir(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var za={};function Qt(e,t,n,o,r){if(!n&&!o&&!r&&!e)return Ts(t);let s=Ts(e);return t&&(s=Or(s,t)),n&&(s=Or(s,n)),o&&(s=Or(s,o)),r&&(s=Or(s,r)),s}function Vu(e){if(e.length===0)return za;if(e.length===1)return Ts(e[0]);let t=Ts(e[0]);for(let n=1;n<e.length;n+=1)t=Or(t,e[n]);return t}function Ts(e){return qa(e)?{...Hu(e,za)}:Dv(e)}function Or(e,t){return qa(t)?Hu(t,e):Lv(e,t)}function Dv(e){let t={...e};for(let n in t){let o=t[n];Fu(n,o)&&(t[n]=Uu(o))}return t}function Lv(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=Ir(e.style,o);break}case"className":{e[n]=Ka(e.className,o);break}default:Fu(n,o)?e[n]=Vv(e[n],o):e[n]=o}}return e}function Fu(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),r=e.charCodeAt(2);return n===111&&o===110&&r>=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function qa(e){return typeof e=="function"}function Hu(e,t){return qa(e)?e(t):e??za}function Vv(e,t){return t?e?(...n)=>{let o=n[0];if(Bu(o)){let s=o;Nr(s);let i=t(...n);return s.baseUIHandlerPrevented||e?.(...n),i}let r=t(...n);return e?.(...n),r}:Uu(t):e}function Uu(e){return e&&((...t)=>{let n=t[0];return Bu(n)&&Nr(n),e(...t)})}function Nr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Ka(e,t){return t?e?t+" "+e:t:e}function Bu(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Fv(e,t){return function(o,...r){let s=new URL(e);return s.searchParams.set("code",o.toString()),r.forEach(i=>s.searchParams.append("args[]",i)),`${t} error #${o}; visit ${s} for the full message.`}}var Hv=Fv("https://base-ui.com/production-error","Base UI"),Ae=Hv;var Is=b(H(),1),Ga=Is.createContext(void 0);function Os(e=!1){let t=Is.useContext(Ga);if(t===void 0&&!e)throw new Error(Ae(16));return t}var Wu=b(H(),1);function $u(e){let{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:r=0,isNativeButton:s}=e,i=o&&t!==!1,a=o&&t===!1;return{props:Wu.useMemo(()=>{let l={onKeyDown(u){n&&t&&u.key!=="Tab"&&u.preventDefault()}};return o||(l.tabIndex=r,!s&&n&&(l.tabIndex=t?r:-1)),(s&&(t||i)||!s&&n)&&(l["aria-disabled"]=n),s&&(!t||a)&&(l.disabled=n),l},[o,n,t,i,a,s,r])}}function ve(e){return e?.ownerDocument||document}function Ns(e,t,{detail:n=0}={}){e.dispatchEvent(new(Oe(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function zt(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:r=!0,composite:s}=e,i=Jo.useRef(null),a=Os(!0),c=s??a!==void 0,{props:l}=$u({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:o,isNativeButton:r}),u=Jo.useCallback(()=>{let d=i.current;Ya(d)&&c&&t&&l.disabled===void 0&&d.disabled&&(d.disabled=!1)},[t,l.disabled,c]);B(u,[u]);let f=Jo.useCallback((d={})=>{let{onClick:m,onMouseDown:g,onKeyUp:h,onKeyDown:v,onPointerDown:y,...R}=d;return Qt({onClick(x){if(t){x.preventDefault();return}m?.(x)},onMouseDown(x){t||g?.(x)},onKeyDown(x){if(t||(Nr(x),v?.(x),x.baseUIHandlerPrevented))return;let S=x.target===x.currentTarget,w=x.currentTarget,C=Ya(w),_=!r&&Uv(w),T=S&&(r?C:!_),O=x.key==="Enter",P=x.key===" ",L=w.getAttribute("role"),E=L?.startsWith("menuitem")||L==="option"||L==="gridcell";if(S&&c&&P){if(x.defaultPrevented&&E)return;x.preventDefault(),(!r||C)&&(x.preventBaseUIHandler(),Ns(w,x));return}if(!T||r||!P&&!O){S&&_&&P&&x.preventDefault();return}x.defaultPrevented||(x.preventDefault(),O&&(x.preventBaseUIHandler(),Ns(w,x)))},onKeyUp(x){if(!t){if(Nr(x),h?.(x),x.target===x.currentTarget&&r&&c&&Ya(x.currentTarget)&&x.key===" "){x.preventDefault();return}x.baseUIHandlerPrevented||x.target===x.currentTarget&&!r&&!c&&!x.defaultPrevented&&x.key===" "&&(x.preventBaseUIHandler(),Ns(x.currentTarget,x))}},onPointerDown(x){if(t){x.preventDefault();return}y?.(x)}},r?{type:"button"}:{role:"button"},l,R)},[t,l,c,r]),p=z(d=>{i.current=d,u()});return{getButtonProps:f,buttonRef:p}}function Ya(e){return Te(e)&&e.tagName==="BUTTON"}function Uv(e){return Te(e)&&e.tagName==="A"&&!!e.href}var zn=b(H(),1);function en(e,t,n,o){let r=He(zu).current;return Bv(r,e,t,n,o)&&qu(r,[e,t,n,o]),r.callback}function ju(e){let t=He(zu).current;return Wv(t,e)&&qu(t,e),t.callback}function zu(){return{callback:null,cleanup:null,refs:[]}}function Bv(e,t,n,o,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==r}function Wv(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}function qu(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let r=0;r<t.length;r+=1){let s=t[r];if(s!=null)switch(typeof s){case"function":{let i=s(n);typeof i=="function"&&(o[r]=i);break}case"object":{s.current=n;break}default:}}e.cleanup=()=>{for(let r=0;r<t.length;r+=1){let s=t[r];if(s!=null)switch(typeof s){case"function":{let i=o[r];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}default:}}}}}}var Gu=b(H(),1);var Ku=b(H(),1),$v=parseInt(Ku.version,10);function Xo(e){return $v>=e}function Ja(e){if(!Gu.isValidElement(e))return null;let t=e,n=t.props;return(Xo(19)?n?.ref:t.ref)??null}function Le(){}var yt=Object.freeze([]),Ne=Object.freeze({});function Yu(e,t){let n={};for(let o in e){let r=e[o];if(t?.hasOwnProperty(o)){let s=t[o](r);s!=null&&Object.assign(n,s);continue}r===!0?n[`data-${o.toLowerCase()}`]="":r&&(n[`data-${o.toLowerCase()}`]=r.toString())}return n}function Ju(e,t){return typeof e=="function"?e(t):e}function Xu(e,t){return typeof e=="function"?e(t):e}var Xa=b(H(),1);function oe(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=Kv(o));let r=jv(t,n,o);if(n.enabled===!1)return null;let s=n.state??Ne;return Gv(e,o,r,s)}function jv(e,t,n){let{className:o,style:r}=e,{state:s=Ne,ref:i,props:a,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Ju(o,s):void 0,f=l?Xu(r,s):void 0,p=l?Yu(s,c):Ne,d=l&&a?zv(a):void 0,m=l?Ir(p,d)??{}:Ne;return typeof document<"u"&&(l?Array.isArray(i)?m.ref=ju([m.ref,Ja(n),...i]):m.ref=en(m.ref,Ja(n),i):en(null,null)),l?(u!==void 0&&(m.className=Ka(m.className,u)),f!==void 0&&(m.style=Ir(m.style,f)),m):Ne}function zv(e){return Array.isArray(e)?Vu(e):Qt(void 0,e)}var qv=Symbol.for("react.lazy");function Kv(e){if(e?.$$typeof!==qv)return e;let t=zn.Children.toArray(e)[0];return zn.isValidElement(t)?t:e}function Gv(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);let r=Qt(n,t.props);return r.ref=n.ref,zn.cloneElement(t,r)}if(e&&typeof e=="string")return Yv(e,n);throw new Error(Ae(8))}function Yv(e,t){return e==="button"?(0,Xa.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,Xa.createElement)("img",{alt:"",...t,key:t.key}):zn.createElement(e,t)}var Za=Zu.forwardRef(function(t,n){let{render:o,className:r,disabled:s=!1,focusableWhenDisabled:i=!1,nativeButton:a=!0,style:c,...l}=t,{getButtonProps:u,buttonRef:f}=zt({disabled:s,focusableWhenDisabled:i,native:a});return oe("button",t,{state:{disabled:s},ref:[n,f],props:[l,u]})});var Qu=b(ie()),Jv=ys("eg-button",{variants:{variant:{primary:"eg-button--primary",secondary:"eg-button--secondary",critical:"eg-button--critical",tertiary:"eg-button--tertiary"},size:{s:"eg-button--size-s",m:"eg-button--size-m",l:"eg-button--size-l","icon-s":"eg-button--size-icon-s","icon-m":"eg-button--size-icon-m","icon-l":"eg-button--size-icon-l"}},defaultVariants:{variant:"primary",size:"l"}});function Ms({className:e,variant:t,size:n,...o}){return(0,Qu.jsx)(Za,{"data-slot":"button",className:Jv({variant:t,size:n,className:e}),...o})}var fn={};jt(fn,{Arrow:()=>Im,Backdrop:()=>Up,Group:()=>Hm,GroupLabel:()=>Bm,Icon:()=>Dp,Item:()=>Em,ItemIndicator:()=>_m,ItemText:()=>Pm,Label:()=>Tp,List:()=>wm,Popup:()=>Sm,Portal:()=>Fp,Positioner:()=>fm,Root:()=>wp,ScrollDownArrow:()=>km,ScrollUpArrow:()=>Lm,Separator:()=>jm,Trigger:()=>Np,Value:()=>kp});var tt=b(H(),1);var ef={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ks={...ef,position:"fixed",top:0,left:0},tf={...ef,position:"absolute"};var nf=b(H(),1);function of(e){let t=nf.useRef(!0);t.current&&(t.current=!1,e())}var rf=b(H(),1);function sf(e){let[t,n]=rf.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function As(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}var bo=b(H(),1);function Mr({controlled:e,default:t,name:n,state:o="value"}){let{current:r}=bo.useRef(e!==void 0),[s,i]=bo.useState(t),a=r&&e!==void 0?e:s,c=bo.useCallback(l=>{r||i(l)},[]);return[a,c]}function Ue(e){let t=He(Xv,e).current;return t.next=e,B(t.effect),t}function Xv(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var xf=b(H(),1),oc=b(Ds(),1),yf=b(pf(),1);var mf=b(H(),1);var ec=[],tc;function gf(){return tc}function hf(e){ec.push(e)}function nc(e){let t=(n,o)=>{let r=He(gx).current,s;try{tc=r;for(let i of ec)i.before(r);s=e(n,o);for(let i of ec)i.after(r);r.didInitialize=!0}finally{tc=void 0}return s};return t.displayName=e.displayName||e.name,t}function vf(e){return mf.forwardRef(nc(e))}function gx(){return{didInitialize:!1}}var hx=Xo(19),vx=hx?yx:Sx;function Vs(e,t,n,o,r){return vx(e,t,n,o,r)}function xx(e,t,n,o,r){let s=xf.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return(0,oc.useSyncExternalStore)(e.subscribe,s,s)}hf({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let o=e.syncHooks[n],r=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,r)||(t=!0,o.value=r)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let r of e.syncHooks)n.add(r.store);let o=[];for(let r of n)o.push(r.subscribe(t));return()=>{for(let r of o)r()}}),(0,oc.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function yx(e,t,n,o,r){let s=gf();if(!s)return xx(e,t,n,o,r);let i=s.syncIndex;s.syncIndex+=1;let a;return s.didInitialize?(a=s.syncHooks[i],(a.store!==e||a.selector!==t||!Object.is(a.a1,n)||!Object.is(a.a2,o)||!Object.is(a.a3,r))&&(a.store!==e&&(s.didChangeStore=!0),a.store=e,a.selector=t,a.a1=n,a.a2=o,a.a3=r,a.value=t(e.getSnapshot(),n,o,r))):(a={store:e,selector:t,a1:n,a2:o,a3:r,value:t(e.getSnapshot(),n,o,r)},s.syncHooks.push(a)),a.value}function Sx(e,t,n,o,r){return(0,yf.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}var Fs=class{static create(t){return new this(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;let n=this.updateTick;for(let o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(let n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){let t={...this.state};this.setState(t)}use(t,n,o,r){return Vs(this,t,n,o,r)}};var Eo=b(H(),1);var wn=class extends Fs{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}useSyncedValue(t,n){Eo.useDebugValue(t);let o=this;B(()=>{o.state[t]!==n&&o.set(t,n)},[o,t,n])}useSyncedValueWithCleanup(t,n){let o=this;B(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){let n=this,o=Object.values(t);B(()=>{n.update(t)},[n,...o])}useControlledProp(t,n){Eo.useDebugValue(t);let o=this,r=n!==void 0;B(()=>{r&&!Object.is(o.state[t],n)&&o.setState({...o.state,[t]:n})},[o,t,n,r])}select(t,n,o,r){let s=this.selectors[t];return s(this.state,n,o,r)}useState(t,n,o,r){return Eo.useDebugValue(t),Vs(this,this.selectors[t],n,o,r)}useContextCallback(t,n){Eo.useDebugValue(t);let o=z(n??Le);this.context[t]=o}useStateSetter(t){let n=Eo.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{let i=o(s);if(!Object.is(r,i)){let a=r;r=i,n(i,a,this)}})}};function bt(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function xe(e,t,n,o){return e.addEventListener(t,n,o),()=>{e.removeEventListener(t,n,o)}}var Sf=b(H(),1);function Qo(e){Sf.useEffect(e,yt)}var Hs=null,vE=globalThis.requestAnimationFrame,rc=class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;let n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){let n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){let n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}},Us=new rc;var tn=class e{static create(){return new e}static request(t){return Us.request(t)}static cancel(t){return Us.cancel(t)}currentId=Hs;request(t){this.cancel(),this.currentId=Us.request(()=>{this.currentId=Hs,t()})}cancel=()=>{this.currentId!==Hs&&(Us.cancel(this.currentId),this.currentId=Hs)};disposeEffect=()=>this.cancel};function Nt(){let e=He(tn.create).current;return Qo(e.disposeEffect),e}var kr=0,Lt=class e{static create(){return new e}currentId=kr;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=kr,n()},t)}isStarted(){return this.currentId!==kr}clear=()=>{this.currentId!==kr&&(clearTimeout(this.currentId),this.currentId=kr)};disposeEffect=()=>this.clear};function et(){let e=He(Lt.create).current;return Qo(e.disposeEffect),e}var Ge={};jt(Ge,{engine:()=>lc,env:()=>fc,mediaQuery:()=>dc,os:()=>ac,screenReader:()=>uc});var ac={};jt(ac,{android:()=>bf,apple:()=>ic,ios:()=>sc,linux:()=>Cx,mac:()=>Ef,windows:()=>Ex});function Rx(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:wx,platform:bx,maxTouchPoints:Rf}=Rx(),Co=wx.toLowerCase(),_o=bx.toLowerCase();var sc=/^i(os$|p)/.test(_o)||_o==="macintel"&&Rf>1,wf="android",bf=_o===wf||Co.includes(wf),Ef=!sc&&_o.startsWith("mac"),Ex=_o.startsWith("win"),Cx=!bf&&/^(linux|chrome os)/.test(_o),ic=Ef||sc;var lc={};jt(lc,{blink:()=>Px,gecko:()=>_x,webkit:()=>cc});var cc=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),_x=!cc&&Co.includes("firefox"),Px=!cc&&Co.includes("chrom");var uc={};jt(uc,{voiceOver:()=>Tx});var Tx=ic;var fc={};jt(fc,{jsdom:()=>Ix});var Ix=/jsdom|happydom/.test(Co);var dc={};jt(dc,{iOS:()=>Ox});var Ox="@supports (-webkit-touch-callout: none)";function Et(e){e.preventDefault(),e.stopPropagation()}function Cf(e){return"nativeEvent"in e}function qn(e){return e.pointerType===""&&e.isTrusted?!0:Ge.os.android&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function er(e){return Ge.env.jsdom?!1:!Ge.os.android&&e.width===0&&e.height===0||Ge.os.android&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function kn(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function _f(e){let t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function mt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Q(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&xn(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Ve(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}var Ar="data-base-ui-focusable";var pc="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Dr="ArrowLeft",Lr="ArrowRight",mc="ArrowUp",Bs="ArrowDown";var tr={};jt(tr,{endingStyle:()=>Vr,startingStyle:()=>Po});var Po="data-starting-style",Vr="data-ending-style";var Nx={[Po]:""},Mx={[Vr]:""},Vt={transitionStatus(e){return e==="starting"?Nx:e==="ending"?Mx:null}};var nn={};jt(nn,{align:()=>Lx,anchorHidden:()=>vc,closed:()=>hc,endingStyle:()=>Ax,open:()=>gc,side:()=>Dx,startingStyle:()=>kx});var gc="data-open",hc="data-closed",kx=Po,Ax=Vr,vc="data-anchor-hidden",Dx="data-side",Lx="data-align";var To={};jt(To,{popupOpen:()=>Ws,pressed:()=>xc});var Ws="data-popup-open",xc="data-pressed";var Vx={[Ws]:""},Fx={[Ws]:"",[xc]:""},Hx={[gc]:""},Ux={[hc]:""},Bx={[vc]:""},nr={open(e){return e?Vx:null}},$s={open(e){return e?Fx:null}},qt={open(e){return e?Hx:Ux},anchorHidden(e){return e?Bx:null}},Kn={...qt,...Vt};var VE=To.popupOpen,yc="data-trigger-disabled";function Fr(e,t){if(!Pe(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(yc);for(let[,o]of t.entries())if(Q(o,n))return!o.hasAttribute(yc);return!1}function js(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Pf(e){return e.matches("html,body")}function Hr(e){return Te(e)&&e.matches(pc)}function Sc(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${pc}`)!=null}function Ur(e){return e?e.getAttribute("role")==="combobox"&&Hr(e):!1}function Io(e){return e?e.hasAttribute(Ar)?e:e.querySelector(`[${Ar}]`)||e:null}function $x(e,t){return t!=null&&!kn(t)?0:typeof e=="function"?e():e}function Br(e,t,n){let o=$x(e,n);return typeof o=="number"?o:o?.[t]}function Rc(e){return typeof e=="function"?e():e}function zs(e,t){return t||e==="click"||e==="mousedown"}function Tf(e){return e?.includes("mouse")&&e!=="mousedown"}var ne={};jt(ne,{cancelOpen:()=>vy,chipRemovePress:()=>Qx,clearPress:()=>Zx,closePress:()=>Jx,closeWatcher:()=>uy,decrementPress:()=>ny,disabled:()=>yy,drag:()=>my,escapeKey:()=>ly,focusOut:()=>cy,imperativeAction:()=>wy,incrementPress:()=>ty,initial:()=>Ry,inputBlur:()=>sy,inputChange:()=>oy,inputClear:()=>ry,inputPaste:()=>iy,inputPress:()=>ay,itemPress:()=>Yx,keyboard:()=>dy,linkPress:()=>Xx,listNavigation:()=>fy,missing:()=>Sy,none:()=>jx,outsidePress:()=>Gx,pointer:()=>py,scrub:()=>hy,siblingOpen:()=>xy,swipe:()=>by,trackPress:()=>ey,triggerFocus:()=>Kx,triggerHover:()=>qx,triggerPress:()=>zx,wheel:()=>gy,windowResize:()=>Ey});var jx="none",zx="trigger-press",qx="trigger-hover",Kx="trigger-focus",Gx="outside-press",Yx="item-press",Jx="close-press",Xx="link-press",Zx="clear-press",Qx="chip-remove-press",ey="track-press",ty="increment-press",ny="decrement-press",oy="input-change",ry="input-clear",sy="input-blur",iy="input-paste",ay="input-press",cy="focus-out",ly="escape-key",uy="close-watcher",fy="list-navigation",dy="keyboard",py="pointer",my="drag",gy="wheel",hy="scrub",vy="cancel-open",xy="sibling-open",yy="disabled",Sy="missing",Ry="initial",wy="imperative-action",by="swipe",Ey="window-resize";function me(e,t,n,o){let r=!1,s=!1,i=o??Ne;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...i}}var _t=b(H(),1);var qs=b(H(),1);var If=b(ie(),1),on=qs.forwardRef(function(t,n){let[o,r]=qs.useState();return B(()=>{Ge.screenReader.voiceOver&&Ge.engine.webkit&&r("button")},[]),(0,If.jsx)("span",{...t,ref:n,style:ks,"aria-hidden":o?void 0:!0,...{tabIndex:0,role:o},"data-base-ui-focus-guard":""})});var Gn=Math.min,pn=Math.max,Yn=Math.round,$r=Math.floor,bn=e=>({x:e,y:e}),Cy={left:"right",right:"left",bottom:"top",top:"bottom"};function Gs(e,t,n){return pn(e,Gn(t,n))}function En(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function rn(e){return e.split("-")[1]}function Ys(e){return e==="x"?"y":"x"}function jr(e){return e==="y"?"height":"width"}function Ft(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function zr(e){return Ys(Ft(e))}function Mf(e,t,n){n===void 0&&(n=!1);let o=rn(e),r=zr(e),s=jr(r),i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wr(i)),[i,Wr(i)]}function kf(e){let t=Wr(e);return[Ks(e),t,Ks(t)]}function Ks(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var Of=["left","right"],Nf=["right","left"],_y=["top","bottom"],Py=["bottom","top"];function Ty(e,t,n){switch(e){case"top":case"bottom":return n?t?Nf:Of:t?Of:Nf;case"left":case"right":return t?_y:Py;default:return[]}}function Af(e,t,n,o){let r=rn(e),s=Ty(Ct(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(Ks)))),s}function Wr(e){let t=Ct(e);return Cy[t]+e.slice(t.length)}function Iy(e){var t,n,o,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(r=e.left)!=null?r:0}}function Js(e){return typeof e!="number"?Iy(e):{top:e,right:e,bottom:e,left:e}}function An(e){let{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Jn(e,t){return t<0||t>=e.length}function Oo(e,t){return sn(e.current,{disabledIndices:t})}function or(e,t){return sn(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function sn(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:r=1}={}){let s=t;do s+=n?-r:r;while(s>=0&&s<=e.length-1&&Dn(e,s,o));return s}function Dn(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!No(r)||r.matches(":disabled")?!0:!n&&(r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true"):!1}function Oy(e){return e.visibility==="hidden"||e.visibility==="collapse"}function No(e,t=e?pt(e):null){return!e||!e.isConnected||!t||Oy(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}var Ny='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function My(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return xn(n)?n.host:null}function bc(e){for(let t of Array.from(e.children))if(it(t)==="summary")return t;return null}function ky(e,t){let n=bc(t);return!!n&&(e===n||Q(n,e))}function Df(e){let t=e?it(e):"";return e!=null&&e.matches(Ny)&&(t!=="summary"||e.parentElement!=null&&it(e.parentElement)==="details"&&bc(e.parentElement)===e)&&(t!=="details"||bc(e)==null)&&(t!=="input"||e.type!=="hidden")}function Lf(e){if(!Df(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=My(t)){let n=t!==e,o=it(t)==="slot";if(t.hasAttribute("inert")||n&&it(t)==="details"&&!t.open&&!ky(e,t)||t.hasAttribute("hidden")||!o&&!Ay(t,n))return!1}return!0}function Ay(e,t){let n=pt(e);return t?n.display!=="none":No(e,n)}function Vf(e){let t=e.tabIndex;if(t<0){let n=it(e);if(n==="details"||n==="audio"||n==="video"||Te(e)&&e.isContentEditable)return 0}return t}function wc(e){if(it(e)!=="input")return null;let t=e;return t.type==="radio"&&t.name!==""?t:null}function Dy(e,t){let n=wc(e);if(!n)return!0;let o=t.find(r=>{let s=wc(r);return s?.name===n.name&&s.form===n.form&&s.checked});return o?o===n:t.find(r=>{let s=wc(r);return s?.name===n.name&&s.form===n.form})===n}function Ff(e){if(Te(e)&&it(e)==="slot"){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Te(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Hf(e,t){Ff(e).forEach(n=>{Df(n)&&t.push(n),Hf(n,t)})}function Uf(e,t,n){Ff(e).forEach(o=>{Te(o)&&o.matches(t)&&n.push(o),Uf(o,t,n)})}function Xs(e){return Lf(e)&&Vf(e)>=0}function Ec(e){let t=[];return Hf(e,t),t.filter(Lf)}function rr(e){let t=Ec(e);return t.filter(n=>Vf(n)>=0&&Dy(n,t))}function Bf(e,t){let n=rr(e),o=n.length;if(o===0)return;let r=mt(ve(e)),s=n.indexOf(r),i=s===-1?t===1?0:o-1:s+t;return n[i]}function Xn(e){return Bf(ve(e).body,1)||e}function Zn(e){return Bf(ve(e).body,-1)||e}function Ly(e,t){if(!e)return null;let n=rr(ve(e).body),o=n.length;if(o===0)return null;let r=n.indexOf(e);if(r===-1)return null;let s=(r+t+o)%o;return n[s]}function Wf(e){return Ly(e,1)}function Mt(e,t){let n=t||e.currentTarget,o=e.relatedTarget;return!o||!Q(n,o)}function Zs(e){rr(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function qr(e){let t=[];Uf(e,"[data-tabindex]",t),t.forEach(n=>{let o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}function Ht(e,t,n=!0){return e.filter(r=>r.parentId===t).flatMap(r=>[...!n||r.context?.open?[r]:[],...Ht(e,r.id,n)])}function Cc(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){let r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function Mo(e){return`data-base-ui-${e}`}var Qs=0;function sr(e,t={}){let{preventScroll:n=!1,sync:o=!1,shouldFocus:r}=t;cancelAnimationFrame(Qs);function s(){r&&!r()||e?.focus({preventScroll:n})}if(o)return s(),Le;let i=requestAnimationFrame(s);return Qs=i,()=>{Qs===i&&(cancelAnimationFrame(i),Qs=0)}}var _c={inert:new WeakMap,"aria-hidden":new WeakMap},$f="data-base-ui-inert",Tc={inert:new WeakSet,"aria-hidden":new WeakSet},Kr=new WeakMap,Pc=0;function Vy(e){return Tc[e]}function Kf(e){return e?xn(e)?e.host:Kf(e.parentNode):null}var jf=(e,t)=>t.map(n=>{if(e.contains(n))return n;let o=Kf(n);return e.contains(o)?o:null}).filter(n=>n!=null),zf=e=>{let t=new Set;return e.forEach(n=>{let o=n;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},qf=(e,t,n)=>{let o=[],r=s=>{!s||n.has(s)||Array.from(s.children).forEach(i=>{it(i)!=="script"&&(t.has(i)?r(i):o.push(i))})};return r(e),o};function Fy(e,t,n,o,{mark:r=!0}){let s=null;o?s="inert":n&&(s="aria-hidden");let i=null,a=null,c=jf(t,e),l=r?qf(t,zf(c),new Set(c)):[],u=[],f=[];if(s){let p=_c[s],d=Vy(s);a=d,i=p;let m=jf(t,Array.from(t.querySelectorAll("[aria-live]"))),g=c.concat(m);qf(t,zf(g),new Set(g)).forEach(v=>{let y=v.getAttribute(s),R=y!==null&&y!=="false",x=(p.get(v)||0)+1;p.set(v,x),u.push(v),x===1&&R&&d.add(v),R||v.setAttribute(s,s==="inert"?"":"true")})}return r&&l.forEach(p=>{let d=(Kr.get(p)||0)+1;Kr.set(p,d),f.push(p),d===1&&p.setAttribute($f,"")}),Pc+=1,()=>{i&&u.forEach(p=>{let m=(i.get(p)||0)-1;i.set(p,m),m||(!a?.has(p)&&s&&p.removeAttribute(s),a?.delete(p))}),r&&f.forEach(p=>{let d=(Kr.get(p)||0)-1;Kr.set(p,d),d||p.removeAttribute($f)}),Pc-=1,Pc||(_c.inert=new WeakMap,_c["aria-hidden"]=new WeakMap,Tc.inert=new WeakSet,Tc["aria-hidden"]=new WeakSet,Kr=new WeakMap)}}function Ic(e,t={}){let{ariaHidden:n=!1,inert:o=!1,mark:r=!0}=t,s=ve(e[0]).body;return Fy(e,s,n,o,{mark:r})}var Ye=b(H(),1),Oc=b($n(),1);var ei=b(H(),1);var Gf=0;function Hy(e,t="mui"){let[n,o]=ei.useState(e),r=e||n;return ei.useEffect(()=>{n==null&&(Gf+=1,o(`${t}-${Gf}`))},[n,t]),r}var Yf=Tr.useId;function an(e,t){if(Yf!==void 0){let n=Yf();return e??(t?`${t}-${n}`:n)}return Hy(e,t)}var Jf={style:{transition:"none"}},ti="data-base-ui-click-trigger",Uy="data-base-ui-swipe-ignore",By="data-swipe-ignore",gC=`[${Uy}]`,hC=`[${By}]`,ni={fallbackAxisSide:"none"},Xf={fallbackAxisSide:"end"},oi={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var ko=b(ie(),1),Zf=Ye.createContext(null),Nc=()=>Ye.useContext(Zf),Wy=Mo("portal");function Qf(e={}){let{ref:t,container:n,componentProps:o=Ne,elementProps:r}=e,s=an(),a=Nc()?.portalNode,[c,l]=Ye.useState(null),[u,f]=Ye.useState(null),p=z(h=>{h!==null&&f(h)}),d=Ye.useRef(null);B(()=>{if(n===null){d.current&&(d.current=null,f(null),l(null));return}let h=(n&&(Es(n)?n:n.current))??a??document.body;if(h==null){d.current&&(d.current=null,f(null),l(null));return}d.current!==h&&(d.current=h,f(null),l(h))},[n,a]);let m=oe("div",o,{ref:[t,p],props:[{id:s,[Wy]:""},r]}),g=c&&m?Oc.createPortal(m,c):null;return{node:u,nodeId:Ye.isValidElement(m)?m.props.id:void 0,subtree:g}}var Ao=Ye.forwardRef(function(t,n){let{render:o,className:r,style:s,children:i,container:a,portalOwnerRole:c,...l}=t,{node:u,nodeId:f,subtree:p}=Qf({container:a,ref:n,componentProps:t,elementProps:l}),d=Ye.useRef(null),m=Ye.useRef(null),g=Ye.useRef(null),h=Ye.useRef(null),[v,y]=Ye.useState(null),R=Ye.useRef(!1),x=v?.modal,S=v?.open,w=!!v&&!v.modal&&v.open&&!!u;Ye.useEffect(()=>{if(!u||x)return;function _(T){u&&T.relatedTarget&&Mt(T)&&(T.type==="focusin"?R.current&&(qr(u),R.current=!1):(Zs(u),R.current=!0))}return bt(xe(u,"focusin",_,!0),xe(u,"focusout",_,!0))},[u,x]),B(()=>{!u||S!==!0||!R.current||(qr(u),R.current=!1)},[S,u]);let C=Ye.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:m,beforeInsideRef:g,afterInsideRef:h,portalNode:u,setFocusManagerState:y}),[u]);return(0,ko.jsxs)(Ye.Fragment,{children:[p,(0,ko.jsxs)(Zf.Provider,{value:C,children:[w&&u&&(0,ko.jsx)(on,{"data-type":"outside",ref:d,onFocus:_=>{if(Mt(_,u))g.current?.focus();else{let T=v?v.domReference:null;Zn(T)?.focus()}}}),w&&u&&(0,ko.jsx)("span",{role:c,"aria-owns":f,style:oi}),u&&Oc.createPortal(i,u),w&&u&&(0,ko.jsx)(on,{"data-type":"outside",ref:m,onFocus:_=>{if(Mt(_,u))h.current?.focus();else{let T=v?v.domReference:null;Xn(T)?.focus(),v?.closeOnFocusOut&&v?.onOpenChange(!1,me(ne.focusOut,_.nativeEvent))}}})]})]})});var Qn=b(H(),1);function ri(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var si=class{nodesRef={current:[]};events=ri();addNode(t){this.nodesRef.current.push(t)}removeNode(t){let n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}};var Mc=b(ie(),1),ed=Qn.createContext(null),td=Qn.createContext(null),Kt=()=>Qn.useContext(ed)?.id||null,gt=e=>{let t=Qn.useContext(td);return e??t};function kc(e){let t=an(),n=gt(e),o=Kt();return B(()=>{if(!t)return;let r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function Gr(e){let{children:t,id:n}=e,o=Kt();return(0,Mc.jsx)(ed.Provider,{value:Qn.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function Ac(e){let{children:t,externalTree:n}=e,o=He(()=>n??new si).current;return(0,Mc.jsx)(td.Provider,{value:o,children:t})}function mn(e){return e==null?e:"current"in e?e.current:e}var Yr=b(ie(),1);function $y(e,t){let n=Oe(Ve(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}var nd=20,eo=[];function Dc(){eo=eo.filter(e=>e.deref()?.isConnected)}function od(e){Dc(),e&&it(e)!=="body"&&(eo.push(new WeakRef(e)),eo.length>nd&&(eo=eo.slice(-nd)))}function rd(){return Dc(),eo[eo.length-1]?.deref()}function jy(e){return e?Xs(e)?e:rr(e)[0]||e:null}function sd(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;let n=Ec(e).filter(r=>{let s=r.getAttribute("data-tabindex")||"";return Xs(r)||r.hasAttribute("data-tabindex")&&!s.startsWith("-")}),o=e.getAttribute("tabindex");n.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Jr(e){let{context:t,children:n,disabled:o=!1,initialFocus:r=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:a=!0,closeOnFocusOut:c=!0,openInteractionType:l="",nextFocusableElement:u,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:d,getInsideElements:m}=e,g="rootStore"in t?t.rootStore:t,h=g.useState("open"),v=g.useState("domReferenceElement"),y=g.useState("floatingElement"),{events:R,dataRef:x}=g.context,S=z(()=>x.current.floatingContext?.nodeId),w=r===!1,C=Ur(v)&&w,_=Ue(r),T=Ue(s),O=Ue(l),P=Ue(h),L=gt(d),E=Nc(),M=_t.useRef(!1),I=_t.useRef(!1),A=_t.useRef(!1),D=_t.useRef(null),N=_t.useRef(""),W=_t.useRef(""),k=_t.useRef(null),j=_t.useRef(null),U=en(k,p,E?.beforeInsideRef),$=en(j,E?.afterInsideRef),V=et(),X=et(),Y=Nt(),ge=E!=null,Z=Io(y),fe=z((q=Z)=>q?rr(q):[]),ee=z(()=>m?.().filter(q=>q!=null)??[]);_t.useEffect(()=>{if(o||!a)return;function q(de){de.key==="Tab"&&Q(Z,mt(ve(Z)))&&fe().length===0&&!C&&Et(de)}let le=ve(Z);return xe(le,"keydown",q)},[o,Z,a,C,fe]),_t.useEffect(()=>{if(o||!h)return;let q=ve(Z);function le(){A.current=!1}function de(De){let re=Ve(De),Re=ee(),se=Q(y,re)||Q(v,re)||Q(E?.portalNode,re)||Re.some(Ce=>Ce===re||Q(Ce,re));A.current=!se,W.current=De.pointerType||"keyboard",re?.closest(`[${ti}]`)&&(I.current=!0,X.start(0,()=>{I.current=!1}))}function he(){W.current="keyboard"}return bt(xe(q,"pointerdown",de,!0),xe(q,"pointerup",le,!0),xe(q,"pointercancel",le,!0),xe(q,"keydown",he,!0),le)},[o,y,v,Z,h,E,X,ee]),_t.useEffect(()=>{if(o||!c)return;let q=ve(Z);function le(){I.current=!0,X.start(0,()=>{I.current=!1})}function de(Re){let se=Ve(Re);Xs(se)&&(D.current=se)}function he(Re){let se=Re.relatedTarget,Ce=Re.currentTarget,be=Ve(Re);a&&se==null&&be!=null&&Q(y,be)&&od(be),queueMicrotask(()=>{let _e=S(),We=g.context.triggerElements,G=ee(),te=se?.hasAttribute(Mo("focus-guard"))&&[k.current,j.current,E?.beforeInsideRef.current,E?.afterInsideRef.current,E?.beforeOutsideRef.current,E?.afterOutsideRef.current,mn(f),mn(u)].includes(se),K=!(Q(v,se)||Q(y,se)||Q(se,y)||Q(E?.portalNode,se)||G.some(F=>F===se||Q(F,se))||We.hasMatchingElement(F=>Q(F,se))||te||L&&(Ht(L.nodesRef.current,_e).find(F=>Q(F.context?.elements.floating,se)||Q(F.context?.elements.domReference,se))||Cc(L.nodesRef.current,_e).find(F=>[F.context?.elements.floating,Io(F.context?.elements.floating)].includes(se)||F.context?.elements.domReference===se)));if(Ce===v&&Z&&sd(Z),i&&Ce!==v&&!No(be)&&mt(q)===q.body){if(Te(Z)&&(Z.focus(),i==="popup")){Y.request(()=>{Z.focus()});return}let F=fe(),ue=D.current,Me=(ue&&F.includes(ue)?ue:null)||F[F.length-1]||Z;Te(Me)&&Me.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(C||!a)&&se&&K&&!I.current&&(C||se!==rd())&&(M.current=!0,g.setOpen(!1,me(ne.focusOut,Re)))})}function De(){A.current||(x.current.insideReactTree=!0,V.start(0,()=>{x.current.insideReactTree=!1}))}let re=Te(v)?v:null;if(!(!y&&!re))return bt(re&&xe(re,"focusout",he),re&&xe(re,"pointerdown",le),y&&xe(y,"focusin",de),y&&xe(y,"focusout",he),y&&E&&xe(y,"focusout",De,!0))},[o,v,y,Z,a,L,E,g,c,i,fe,C,S,x,V,X,Y,u,f,ee]),_t.useEffect(()=>{if(o||!y||!h)return;let q=Array.from(E?.portalNode?.querySelectorAll(`[${Mo("portal")}]`)||[]),de=(L?Cc(L.nodesRef.current,S()):[]).find(Ce=>Ur(Ce.context?.elements.domReference||null))?.context?.elements.domReference,De=[...[y,...q,k.current,j.current,E?.beforeOutsideRef.current,E?.afterOutsideRef.current,...ee()],de,mn(f),mn(u),C?v:null].filter(Ce=>Ce!=null),re=Ic(De,{ariaHidden:a||C,mark:!1}),Re=[y,...q].filter(Ce=>Ce!=null),se=Ic(Re);return()=>{se(),re()}},[h,o,v,y,a,E,C,L,S,u,f,ee]),B(()=>{if(!h||o||!Te(Z))return;N.current="",W.current="";let q=ve(Z),le=mt(q);queueMicrotask(()=>{let de=_.current,he=typeof de=="function"?de(O.current||""):de;if(he===void 0||he===!1||Q(Z,le))return;let re=null,Re=()=>(re==null&&(re=fe(Z)),re[0]||Z),se;he===!0||he===null?se=Re():se=mn(he),se=se||Re();let Ce=Q(Z,mt(q));sr(se,{preventScroll:se===Z,shouldFocus(){if(!P.current)return!1;if(Ce)return!0;let be=mt(q);return!(be!==se&&Q(Z,be))}})})},[o,h,Z,fe,_,O,P]),B(()=>{if(o||!Z)return;let q=ve(Z),le=mt(q),de=O.current==null;od(le);function he(re){if(re.open||(N.current=$y(re.nativeEvent,W.current)),re.reason===ne.triggerHover&&re.nativeEvent.type==="mouseleave"&&(M.current=!0),re.reason===ne.outsidePress)if(re.nested)M.current=!1;else if(qn(re.nativeEvent)||er(re.nativeEvent))M.current=!1;else{let Re=!1;ve(Z).createElement("div").focus({get preventScroll(){return Re=!0,!1}}),Re?M.current=!1:M.current=!0}}R.on("openchange",he);function De(re){let Re=T.current,se=typeof Re=="function"?Re(re):Re;if(se===void 0||se===!1)return null;se===null&&(se=!0);let Ce=v?.isConnected?v:null,be=le?.isConnected&&it(le)!=="body"?le:null,_e=de?be||Ce:Ce||be;return _e||(_e=rd()||null),typeof se=="boolean"?_e:mn(se)||_e||null}return()=>{R.off("openchange",he);let re=mt(q),Re=ee(),se=Q(y,re)||Re.some(We=>We===re||Q(We,re))||L&&Ht(L.nodesRef.current,S(),!1).some(We=>Q(We.context?.elements.floating,re)),Ce=T.current,be=N.current,_e=De(be);queueMicrotask(()=>{let We=jy(_e),G=typeof Ce!="boolean";if(Ce&&!M.current&&Te(We)&&(!(!G&&We!==re&&re!==q.body)||se)){let te={preventScroll:!0};be==="keyboard"&&(te.focusVisible=!0),We.focus(te)}M.current=!1})}},[o,y,Z,T,O,R,L,v,S,ee]),B(()=>{if(!Ge.engine.webkit||h||!y)return;let q=mt(ve(y));!Te(q)||!Hr(q)||Q(y,q)&&q.blur()},[h,y]),B(()=>{if(!(o||!E))return E.setFocusManagerState({modal:a,closeOnFocusOut:c,open:h,onOpenChange:g.setOpen,domReference:v}),()=>{E.setFocusManagerState(null)}},[o,E,a,h,g,c,v]),B(()=>{if(!(o||!Z))return sd(Z),()=>{queueMicrotask(Dc)}},[o,Z]);let ce=!o&&(a?!C:!0)&&(ge||a);return(0,Yr.jsxs)(_t.Fragment,{children:[ce&&(0,Yr.jsx)(on,{"data-type":"inside",ref:U,onFocus:q=>{if(a){let le=fe();sr(le[le.length-1])}else E?.portalNode&&(M.current=!1,Mt(q,E.portalNode)?Xn(v)?.focus():mn(f??E.beforeOutsideRef)?.focus())}}),n,ce&&(0,Yr.jsx)(on,{"data-type":"inside",ref:$,onFocus:q=>{a?sr(fe()[0]):E?.portalNode&&(c&&(M.current=!0),Mt(q,E.portalNode)?Zn(v)?.focus():mn(u??E.afterOutsideRef)?.focus())}})]})}var Xr=b(H(),1);function Do(e,t={}){let{enabled:n=!0,event:o="click",toggle:r=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:a=0,reason:c=ne.triggerPress}=t,l="rootStore"in e?e.rootStore:e,u=l.context.dataRef,f=Xr.useRef(void 0),p=Nt(),d=et(),m=Xr.useMemo(()=>{function g(v,y,R,x){let S=me(c,y,R);v&&x==="touch"&&a>0?d.start(a,()=>{l.setOpen(!0,S)}):l.setOpen(v,S)}function h(v,y,R){let x=u.current.openEvent,S=l.select("domReferenceElement")!==y;return v&&S||!v||!r?!0:x&&i?!R(x.type):!1}return{onPointerDown(v){f.current=kn(v.pointerType,!0)&&er(v.nativeEvent)?"virtual":v.pointerType},onMouseDown(v){let y=f.current,R=v.nativeEvent,x=l.select("open");if(v.button!==0||o==="click"||kn(y,!0)&&s)return;let S=h(x,v.currentTarget,_=>_==="click"||_==="mousedown"),w=Ve(R);if(Hr(w)){g(S,R,w,y);return}let C=v.currentTarget;p.request(()=>{g(S,R,C,y)})},onClick(v){if(o==="mousedown-only")return;let y=f.current;if(o==="mousedown"&&y){f.current=void 0;return}if(kn(y,!0)&&s)return;let R=l.select("open"),x=h(R,v.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");g(x,v.nativeEvent,v.currentTarget,y)},onKeyDown(){f.current=void 0}}},[u,o,s,c,l,i,r,p,d,a]);return Xr.useMemo(()=>n?{reference:m}:Ne,[n,m])}var kt=b(H(),1);function zy(){return!1}function qy(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Lo(e,t={}){let{enabled:n=!0,escapeKey:o=!0,outsidePress:r=!0,outsidePressEvent:s="sloppy",referencePress:i=zy,bubbles:a,externalTree:c}=t,l="rootStore"in e?e.rootStore:e,u=l.useState("open"),f=l.useState("floatingElement"),{dataRef:p,events:d}=l.context,m=gt(c),g=z(typeof r=="function"?r:()=>!1),h=typeof r=="function"?g:r,v=h!==!1,y=z(()=>s),{escapeKey:R,outsidePress:x}=qy(a),S=kt.useRef(!1),w=kt.useRef(!1),C=kt.useRef(!1),_=kt.useRef(!1),T=kt.useRef(!1),O=kt.useRef(""),P=kt.useRef(null),L=et(),E=et(),M=z(()=>{E.clear(),p.current.insideReactTree=!1}),I=z(V=>{let X=p.current.floatingContext?.nodeId;return(m?Ht(m.nodesRef.current,X):[]).some(ge=>ge.context?.open&&!ge.context.dataRef.current[V])}),A=z(V=>js(V,l.select("floatingElement"))||js(V,l.select("domReferenceElement"))),D=z(V=>{i()&&l.setOpen(!1,me(ne.triggerPress,V.nativeEvent))}),N=z(V=>{if(!u||!n||!o||V.key!=="Escape"||T.current||!R&&I("__escapeKeyBubbles"))return;let X=Cf(V)?V.nativeEvent:V,Y=me(ne.escapeKey,X);l.setOpen(!1,Y),Y.isCanceled||V.preventDefault(),!R&&!Y.isPropagationAllowed&&V.stopPropagation()}),W=z(()=>{p.current.insideReactTree=!0,E.start(0,M)}),k=z(V=>{if(!u||!n||V.button!==0)return;let X=Ve(V.nativeEvent);Q(l.select("floatingElement"),X)&&(S.current||(S.current=!0,w.current=!1))}),j=z(V=>{!u||!n||(V.defaultPrevented||V.nativeEvent.defaultPrevented)&&S.current&&(w.current=!0)});kt.useEffect(()=>{function V(X){X.open||(_.current=!1)}return d.on("openchange",V),()=>{d.off("openchange",V)}},[d]),kt.useEffect(()=>{if(!u||!n)return u||(_.current=!1),M;p.current.__escapeKeyBubbles=R,p.current.__outsidePressBubbles=x;let V=new Lt,X=new Lt,Y=ve(f);function ge(){V.clear(),T.current=!0}function Z(){V.start(Ge.engine.webkit?5:0,()=>{T.current=!1})}function fe(){C.current=!0,X.start(0,()=>{C.current=!1})}function ee(){S.current=!1,w.current=!1}function ce(){let K=O.current,F=K==="pen"||!K?"mouse":K,ue=y(),Me=typeof ue=="function"?ue():ue;return typeof Me=="string"?Me:Me[F]}function q(K){let F=ce();return F==="intentional"&&K.type!=="click"||F==="sloppy"&&K.type==="click"}function le(K){let F=p.current.floatingContext?.nodeId,ue=m&&Ht(m.nodesRef.current,F).some(Me=>js(K,Me.context?.elements.floating));return A(K)||ue}function de(K){if(q(K)){K.type!=="click"&&!A(K)&&(X.clear(),C.current=!1),M();return}if(p.current.insideReactTree){M();return}let F=Ve(K),ue=`[${Mo("inert")}]`,Me=Pe(F)?F.getRootNode():null,Ke=Array.from((xn(Me)?Me:ve(l.select("floatingElement"))).querySelectorAll(ue)),$e=l.context.triggerElements;if(F&&($e.hasElement(F)||$e.hasMatchingElement(Qe=>Q(Qe,F))))return;let Ze=Pe(F)?F:null;for(;Ze&&!Rn(Ze);){let Qe=yn(Ze);if(Rn(Qe)||!Pe(Qe))break;Ze=Qe}if(!(Ke.length&&Pe(F)&&!Pf(F)&&!Q(F,l.select("floatingElement"))&&Ke.every(Qe=>!Q(Ze,Qe)))){if(Te(F)&&!("touches"in K)){let Qe=Rn(F),It=pt(F),vt=/auto|scroll/,xt=Qe||vt.test(It.overflowX),Dt=Qe||vt.test(It.overflowY),Xt=xt&&F.clientWidth>0&&F.scrollWidth>F.clientWidth,dn=Dt&&F.clientHeight>0&&F.scrollHeight>F.clientHeight,wt=It.direction==="rtl",ft=dn&&(wt?K.offsetX<=F.offsetWidth-F.clientWidth:K.offsetX>F.clientWidth),ye=Xt&&K.offsetY>F.clientHeight;if(ft||ye)return}if(!le(K)){if(ce()==="intentional"){if(K.detail!==0&&!qn(K)&&!_.current)return;if(C.current){X.clear(),C.current=!1;return}}typeof h=="function"&&!h(K)||I("__outsidePressBubbles")||(l.setOpen(!1,me(ne.outsidePress,K)),M())}}}function he(K){ce()!=="sloppy"||K.pointerType==="touch"||!l.select("open")||!n||A(K)||de(K)}function De(K){if(ce()!=="sloppy"||!l.select("open")||!n||A(K))return;let F=K.touches[0];F&&(P.current={startTime:Date.now(),startX:F.clientX,startY:F.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function re(K,F){let ue=Ve(K);if(!ue)return;let Me=xe(ue,K.type,()=>{F(K),Me()})}function Re(K){O.current="touch",re(K,De)}function se(K){L.clear(),K.type==="pointerdown"&&(K.button===0&&(_.current=!0),O.current=K.pointerType),!(K.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&re(K,F=>{F.type==="pointerdown"?he(F):de(F)})}function Ce(K){if(K.type==="pointercancel"&&(_.current=!1),!S.current)return;let F=w.current;if(ee(),ce()==="intentional"){if(K.type==="pointercancel"){F&&fe();return}if(!le(K)){if(F){fe();return}typeof h=="function"&&!h(K)||(X.clear(),C.current=!0,M())}}}function be(K){if(ce()!=="sloppy"||!P.current||A(K))return;let F=K.touches[0];if(!F)return;let ue=Math.abs(F.clientX-P.current.startX),Me=Math.abs(F.clientY-P.current.startY),Ke=Math.sqrt(ue*ue+Me*Me);Ke>5&&(P.current.dismissOnTouchEnd=!0),Ke>10&&(de(K),L.clear(),P.current=null)}function _e(K){re(K,be)}function We(K){ce()!=="sloppy"||!P.current||A(K)||(P.current.dismissOnTouchEnd&&de(K),L.clear(),P.current=null)}function G(K){re(K,We)}let te=bt(o&&bt(xe(Y,"keydown",N),xe(Y,"compositionstart",ge),xe(Y,"compositionend",Z)),v&&bt(xe(Y,"click",se,!0),xe(Y,"pointerdown",se,!0),xe(Y,"pointerup",Ce,!0),xe(Y,"pointercancel",Ce,!0),xe(Y,"mousedown",se,!0),xe(Y,"mouseup",Ce,!0),xe(Y,"touchstart",Re,{capture:!0,passive:!0}),xe(Y,"touchmove",_e,{capture:!0,passive:!0}),xe(Y,"touchend",G,{capture:!0,passive:!0})));return()=>{te(),V.clear(),X.clear(),ee(),C.current=!1,M()}},[p,f,o,v,h,u,n,R,x,N,M,y,I,A,m,l,L]);let U=kt.useMemo(()=>({onKeyDown:N,onPointerDown:D,onClick:D}),[N,D]),$=kt.useMemo(()=>({onKeyDown:N,onPointerDown:j,onMouseDown:j,onClickCapture:W,onMouseDownCapture(V){W(),k(V)},onPointerDownCapture(V){W(),k(V)},onMouseUpCapture:W,onTouchEndCapture:W,onTouchMoveCapture:W}),[N,W,k,j]);return kt.useMemo(()=>n?{reference:U,floating:$,trigger:U}:{},[n,U,$])}var Pt=b(H(),1);function id(e,t,n){let{reference:o,floating:r}=e,s=Ft(t),i=zr(t),a=jr(i),c=Ct(t),l=s==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2,d;switch(c){case"top":d={x:u,y:o.y-r.height};break;case"bottom":d={x:u,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-r.width,y:f};break;default:d={x:o.x,y:o.y}}let m=rn(t);return m&&(d[i]+=p*(m==="end"?1:-1)*(n&&l?-1:1)),d}async function ad(e,t){var n;t===void 0&&(t={});let{x:o,y:r,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=En(t,e),m=Js(d),h=a[p?f==="floating"?"reference":"floating":f],v=An(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(h)))==null||n?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),y=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),x=await(s.isElement==null?void 0:s.isElement(R))&&await(s.getScale==null?void 0:s.getScale(R))||{x:1,y:1},S=An(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:R,strategy:c}):y);return{top:(v.top-S.top+m.top)/x.y,bottom:(S.bottom-v.bottom+m.bottom)/x.y,left:(v.left-S.left+m.left)/x.x,right:(S.right-v.right+m.right)/x.x}}var Ky=50,cd=async(e,t,n)=>{let{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:ad},c=await(i.isRTL==null?void 0:i.isRTL(t)),l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:f}=id(l,o,c),p=o,d=0,m={};for(let g=0;g<s.length;g++){let h=s[g];if(!h)continue;let{name:v,fn:y}=h,{x:R,y:x,data:S,reset:w}=await y({x:u,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});u=R??u,f=x??f,m[v]={...m[v],...S},w&&d<Ky&&(d++,typeof w=="object"&&(w.placement&&(p=w.placement),w.rects&&(l=w.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):w.rects),{x:u,y:f}=id(l,p,c)),g=-1)}return{x:u,y:f,placement:p,strategy:r,middlewareData:m}};var ld=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;let{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...h}=En(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};let v=Ct(r),y=Ft(a),R=Ct(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=p||(R||!g?[Wr(a)]:kf(a)),w=m!=="none";!p&&w&&S.push(...Af(a,g,m,x));let C=[a,...S],_=await c.detectOverflow(t,h),T=[],O=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&T.push(_[v]),f){let M=Mf(r,i,x);T.push(_[M[0]],_[M[1]])}if(O=[...O,{placement:r,overflows:T}],!T.every(M=>M<=0)){var P,L;let M=(((P=s.flip)==null?void 0:P.index)||0)+1,I=C[M];if(I&&(!(f==="alignment"?y!==Ft(I):!1)||O.every(N=>Ft(N.placement)===y?N.overflows[0]>0:!0)))return{data:{index:M,overflows:O},reset:{placement:I}};let A=(L=O.filter(D=>D.overflows[0]<=0).sort((D,N)=>D.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!A)switch(d){case"bestFit":{var E;let D=(E=O.filter(N=>{if(w){let W=Ft(N.placement);return W===y||W==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(W=>W>0).reduce((W,k)=>W+k,0)]).sort((N,W)=>N[1]-W[1])[0])==null?void 0:E[0];D&&(A=D);break}case"initialPlacement":A=a;break}if(r!==A)return{reset:{placement:A}}}return{}}}};var ud=new Set(["left","top"]);async function Gy(e,t){let{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Ct(n),a=rn(n),c=Ft(n)==="y",l=ud.has(i)?-1:1,u=s&&c?-1:1,f=En(t,e),{mainAxis:p,crossAxis:d,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(d=a==="end"?m*-1:m),c?{x:d*u,y:p*l}:{x:p*l,y:d*u}}var fd=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;let{x:r,y:s,placement:i,middlewareData:a}=t,c=await Gy(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:i}}}}},dd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:y=>{let{x:R,y:x}=y;return{x:R,y:x}}},...l}=En(e,t),u={x:n,y:o},f=await s.detectOverflow(t,l),p=Ft(r),d=Ys(p),m=u[d],g=u[p],h=(y,R)=>Gs(R+f[y==="y"?"top":"left"],R,R-f[y==="y"?"bottom":"right"]);i&&(m=h(d,m)),a&&(g=h(p,g));let v=c.fn({...t,[d]:m,[p]:g});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[d]:i,[p]:a}}}}}},pd=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;let{x:r,y:s,placement:i,rects:a,middlewareData:c}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=En(e,t),p={x:r,y:s},d=Ft(i),m=Ys(d),g=p[m],h=p[d],v=En(l,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(o=v.crossAxis)!=null?o:0};if(u){let S=m==="y"?"height":"width",w=a.reference[m]-a.floating[S]+y.mainAxis,C=a.reference[m]+a.reference[S]-y.mainAxis;g<w?g=w:g>C&&(g=C)}if(f){var R,x;let S=m==="y"?"width":"height",w=ud.has(Ct(i)),C=a.reference[d]-a.floating[S]+(w&&((R=c.offset)==null?void 0:R[d])||0)+(w?0:y.crossAxis),_=a.reference[d]+a.reference[S]+(w?0:((x=c.offset)==null?void 0:x[d])||0)-(w?y.crossAxis:0);h<C?h=C:h>_&&(h=_)}return{[m]:g,[d]:h}}}},md=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:n,rects:o,platform:r,elements:s}=t,{apply:i=()=>{},...a}=En(e,t),c=await r.detectOverflow(t,a),l=Ct(n),u=rn(n),f=Ft(n)==="y",{width:p,height:d}=o.floating,m,g;l==="top"||l==="bottom"?(m=l,g=u===(await(r.isRTL==null?void 0:r.isRTL(s.floating))?"start":"end")?"left":"right"):(g=l,m=u==="end"?"top":"bottom");let h=d-c.top-c.bottom,v=p-c.left-c.right,y=Gn(d-c[m],h),R=Gn(p-c[g],v),x=t.middlewareData.shift,S=!x,w=y,C=R;x!=null&&x.enabled.x&&(C=v),x!=null&&x.enabled.y&&(w=h),S&&!u&&(f?C=p-2*pn(c.left,c.right):w=d-2*pn(c.top,c.bottom)),await i({...t,availableWidth:C,availableHeight:w});let _=await r.getDimensions(s.floating);return p!==_.width||d!==_.height?{reset:{rects:!0}}:{}}}};function vd(e){let t=pt(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,r=Te(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=Yn(n)!==s||Yn(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function Vc(e){return Pe(e)?e:e.contextElement}function ir(e){let t=Vc(e);if(!Te(t))return bn(1);let n=t.getBoundingClientRect(),{width:o,height:r,$:s}=vd(t),i=(s?Yn(n.width):n.width)/o,a=(s?Yn(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}var Yy=bn(0);function xd(e){let t=Oe(e);return!_s()||!t.visualViewport?Yy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jy(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Oe(e)}function Vo(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=e.getBoundingClientRect(),s=Vc(e),i=bn(1);t&&(o?Pe(o)&&(i=ir(o)):i=ir(e));let a=Jy(s,n,o)?xd(s):bn(0),c=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,u=r.width/i.x,f=r.height/i.y;if(s&&o){let p=Oe(s),d=Pe(o)?Oe(o):o,m=p,g=Ps(m);for(;g&&d!==m;){let h=ir(g),v=g.getBoundingClientRect(),y=pt(g),R=v.left+(g.clientLeft+parseFloat(y.paddingLeft))*h.x,x=v.top+(g.clientTop+parseFloat(y.paddingTop))*h.y;c*=h.x,l*=h.y,u*=h.x,f*=h.y,c+=R,l+=x,m=Oe(g),g=Ps(m)}}return An({width:u,height:f,x:c,y:l})}function ii(e,t){let n=Pr(e).scrollLeft;return t?t.left+n:Vo(Sn(e)).left+n}function yd(e,t){let n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ii(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Xy(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e,s=r==="fixed",i=Sn(o),a=t?_r(t.floating):!1;if(o===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=bn(1),u=bn(0),f=Te(o);if((f||!s)&&((it(o)!=="body"||wo(i))&&(c=Pr(o)),f)){let d=Vo(o);l=ir(o),u.x=d.x+o.clientLeft,u.y=d.y+o.clientTop}let p=i&&!f&&!s?yd(i,c):bn(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-c.scrollTop*l.y+u.y+p.y}}function Zy(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Qy(e){let t=Pr(e),n=e.ownerDocument.body,o=pn(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=pn(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),s=-t.scrollLeft+ii(e),i=-t.scrollTop;return pt(n).direction==="rtl"&&(s+=pn(e.clientWidth,n.clientWidth)-o),{width:o,height:r,x:s,y:i}}var eS=25;function tS(e,t,n){n===void 0&&(n="viewport");let o=n==="layoutViewport",r=Oe(e),s=Sn(e),i=r.visualViewport,a=s.clientWidth,c=s.clientHeight,l=0,u=0;if(i){let p=!_s()||t==="fixed";o?p||(l=-i.offsetLeft,u=-i.offsetTop):(a=i.width,c=i.height,p&&(l=i.offsetLeft,u=i.offsetTop))}if(ii(s)<=0){let p=s.ownerDocument,d=p.body,m=getComputedStyle(d),g=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(s.clientWidth-d.clientWidth-g),v=getComputedStyle(s).scrollbarGutter==="stable both-edges"?h/2:h;v<=eS&&(a-=v)}return{width:a,height:c,x:l,y:u}}function nS(e,t){let n=Vo(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=ir(e),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=r*s.x,l=o*s.y;return{width:i,height:a,x:c,y:l}}function gd(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=tS(e,n,t);else if(t==="document")o=Qy(Sn(e));else if(Pe(t))o=nS(t,n);else{let r=xd(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return An(o)}function oS(e,t){let n=t.get(e);if(n)return n;let o=jn(e,[],!1).filter(a=>Pe(a)&&it(a)!=="body"),r=null,s=pt(e).position==="fixed",i=s?yn(e):e;for(;Pe(i)&&!Rn(i);){let a=pt(i),c=Cs(i),l=r?r.position:s?"fixed":"";!c&&(l==="fixed"||l==="absolute"&&a.position==="static")?o=o.filter(f=>f!==i):r=a,i=yn(i)}return t.set(e,o),o}function rS(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e,i=[...n==="clippingAncestors"?_r(t)?[]:oS(t,this._c):[].concat(n),o],a=gd(t,i[0],r),c=a.top,l=a.right,u=a.bottom,f=a.left;for(let p=1;p<i.length;p++){let d=gd(t,i[p],r);c=pn(d.top,c),l=Gn(d.right,l),u=Gn(d.bottom,u),f=pn(d.left,f)}return{width:l-f,height:u-c,x:f,y:c}}function sS(e){let{width:t,height:n}=vd(e);return{width:t,height:n}}function iS(e,t,n){let o=Te(t),r=Sn(t),s=n==="fixed",i=Vo(e,!0,s,t),a={scrollLeft:0,scrollTop:0},c=bn(0);if((o||!s)&&((it(t)!=="body"||wo(r))&&(a=Pr(t)),o)){let p=Vo(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}!o&&r&&(c.x=ii(r));let l=r&&!o&&!s?yd(r,a):bn(0),u=i.left+a.scrollLeft-c.x-l.x,f=i.top+a.scrollTop-c.y-l.y;return{x:u,y:f,width:i.width,height:i.height}}function Lc(e){return pt(e).position==="static"}function hd(e,t){if(!Te(e)||pt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Sn(e)===n&&(n=n.ownerDocument.body),n}function Sd(e,t){let n=Oe(e);if(_r(e))return n;if(!Te(e)){let r=yn(e);for(;r&&!Rn(r);){if(Pe(r)&&!Lc(r))return r;r=yn(r)}return n}let o=hd(e,t);for(;o&&Nu(o)&&Lc(o);)o=hd(o,t);return o&&Rn(o)&&Lc(o)&&!Cs(o)?n:o||Mu(e)||n}var aS=async function(e){let t=this.getOffsetParent||Sd,n=this.getDimensions,o=await n(e.floating);return{reference:iS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function cS(e){return pt(e).direction==="rtl"}var Zr={convertOffsetParentRelativeRectToViewportRelativeRect:Xy,getDocumentElement:Sn,getClippingRect:rS,getOffsetParent:Sd,getElementRects:aS,getClientRects:Zy,getDimensions:sS,getScale:ir,isElement:Pe,isRTL:cS};function Rd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lS(e,t,n){let o=null,r,s=Sn(e);function i(){var u;clearTimeout(r),(u=o)==null||u.disconnect(),o=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),i();let p=e.getBoundingClientRect(),{left:d,top:m,width:g,height:h}=p;if(u||t(),!g||!h)return;let v=$r(m),y=$r(s.clientWidth-(d+g)),R=$r(s.clientHeight-(m+h)),x=$r(d),w={rootMargin:-v+"px "+-y+"px "+-R+"px "+-x+"px",threshold:pn(0,Gn(1,f))||1},C=!0;function _(T){let O=T[0].intersectionRatio;if(!Rd(p,e.getBoundingClientRect()))return a();if(O!==f){if(!C)return a();O?a(!1,O):r=setTimeout(()=>{a(!1,1e-7)},1e3)}C=!1}try{o=new IntersectionObserver(_,{...w,root:s.ownerDocument})}catch{o=new IntersectionObserver(_,w)}o.observe(e)}let c=Oe(e),l=()=>a(n);return c.addEventListener("resize",l),a(!0),()=>{c.removeEventListener("resize",l),i()}}function Qr(e,t,n,o){o===void 0&&(o={});let{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=Vc(e),u=r||s?[...l?jn(l):[],...t?jn(t):[]]:[];u.forEach(v=>{r&&v.addEventListener("scroll",n),s&&v.addEventListener("resize",n)});let f=l&&a?lS(l,n,s):null,p=-1,d=null;i&&(d=new ResizeObserver(v=>{let[y]=v;y&&y.target===l&&d&&t&&(d.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var R;(R=d)==null||R.observe(t)})),n()}),l&&!c&&d.observe(l),t&&d.observe(t));let m,g=c?Vo(e):null;c&&h();function h(){let v=Vo(e);g&&!Rd(g,v)&&n(),g=v,m=requestAnimationFrame(h)}return n(),()=>{var v;u.forEach(y=>{r&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f?.(),(v=d)==null||v.disconnect(),d=null,c&&cancelAnimationFrame(m)}}var wd=fd;var bd=dd,Ed=ld,Cd=md;var _d=pd,ai=(e,t,n)=>{let o=new Map,r=n??{},s={...Zr,...r.platform,_c:o};return cd(e,t,{...r,platform:s})};var ct=b(H(),1),Td=b(H(),1),Id=b($n(),1),fS=typeof document<"u",dS=function(){},ci=fS?Td.useLayoutEffect:dS;function li(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!li(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){let s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!li(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Od(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pd(e,t){let n=Od(e);return Math.round(t*n)/n}function Fc(e){let t=ct.useRef(e);return ci(()=>{t.current=e}),t}function Nd(e){e===void 0&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,f]=ct.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,d]=ct.useState(o);li(p,o)||d(o);let[m,g]=ct.useState(null),[h,v]=ct.useState(null),y=ct.useCallback(N=>{N!==w.current&&(w.current=N,g(N))},[]),R=ct.useCallback(N=>{N!==C.current&&(C.current=N,v(N))},[]),x=s||m,S=i||h,w=ct.useRef(null),C=ct.useRef(null),_=ct.useRef(u),T=c!=null,O=Fc(c),P=Fc(r),L=Fc(l),E=ct.useCallback(()=>{if(!w.current||!C.current)return;let N={placement:t,strategy:n,middleware:p};P.current&&(N.platform=P.current),ai(w.current,C.current,N).then(W=>{let k={...W,isPositioned:L.current!==!1};M.current&&!li(_.current,k)&&(_.current=k,Id.flushSync(()=>{f(k)}))})},[p,t,n,P,L]);ci(()=>{l===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(N=>({...N,isPositioned:!1})))},[l]);let M=ct.useRef(!1);ci(()=>(M.current=!0,()=>{M.current=!1}),[]),ci(()=>{if(x&&(w.current=x),S&&(C.current=S),x&&S){if(O.current)return O.current(x,S,E);E()}},[x,S,E,O,T]);let I=ct.useMemo(()=>({reference:w,floating:C,setReference:y,setFloating:R}),[y,R]),A=ct.useMemo(()=>({reference:x,floating:S}),[x,S]),D=ct.useMemo(()=>{let N={position:n,left:0,top:0};if(!A.floating)return N;let W=Pd(A.floating,u.x),k=Pd(A.floating,u.y);return a?{...N,transform:"translate("+W+"px, "+k+"px)",...Od(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:k}},[n,a,A.floating,u.x,u.y]);return ct.useMemo(()=>({...u,update:E,refs:I,elements:A,floatingStyles:D}),[u,E,I,A,D])}var Hc=(e,t)=>{let n=wd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uc=(e,t)=>{let n=bd(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bc=(e,t)=>({fn:_d(e).fn,options:[e,t]}),Wc=(e,t)=>{let n=Ed(e);return{name:n.name,fn:n.fn,options:[e,t]}},$c=(e,t)=>{let n=Cd(e);return{name:n.name,fn:n.fn,options:[e,t]}};var ui=class{attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,n,o=!0){this.fallbackStore=t,this.componentName=n,this.throwOnMissingTrigger=o}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let n=this.attachedStores.lastIndexOf(t);n!==-1&&this.attachedStores.splice(n,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(n=>{n()}))}openByTrigger(t){let n=this.attachedStore;if(n===null)return;let o;if(t){for(let r=this.attachedStores.length-1;r>=0&&!o;r-=1)o=this.attachedStores[r].context.triggerElements.getById(t);o??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!o&&this.throwOnMissingTrigger)throw new Error(Ae(99,this.componentName,t,this.componentName));n.setOpen(!0,me(ne.imperativeAction,void 0,o))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,me(ne.imperativeAction))}};var qc=b(H(),1),gS=b($n(),1);var Md=b(H(),1);var pS={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},Cn=class extends wn{constructor(t){let{syncOnly:n,nested:o,onOpenChange:r,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ri(),nested:o,triggerElements:s},pS),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&_f(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);let o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}};function kd(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:o,floatingId:r,nested:s,onOpenChange:i}=e,a=t.useState("open"),c=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),u=t.context.triggerElements,f=i,p=Md.useRef(null);o===void 0&&p.current===null&&(p.current=new Cn({open:a,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:f,floatingId:r,syncOnly:!0,nested:s}));let d=o??p.current;return t.useSyncedValue("floatingId",r),B(()=>{let m={open:a,floatingId:r,referenceElement:c,floatingElement:l};Pe(c)&&(m.domReferenceElement=c),d.state.positionReference===d.state.referenceElement&&(m.positionReference=c),d.update(m)},[a,r,c,l,d]),d.context.onOpenChange=f,d.context.nested=s,d}var jc=b(H(),1);function cn(e,t=!1,n=!1,o=!1){let[r,s]=jc.useState(e&&t?"idle":void 0),[i,a]=jc.useState(e&&!o);return e&&!i&&(a(!0),s("starting")),!e&&i&&r!=="ending"&&!n&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),B(()=>{if(!e&&i&&r!=="ending"&&n){let c=tn.request(()=>{s("ending")});return()=>{tn.cancel(c)}}},[e,i,r,n]),B(()=>{if(!e||t)return;let c=tn.request(()=>{s(void 0)});return()=>{tn.cancel(c)}},[t,e]),B(()=>{if(!e||!t)return;e&&i&&r!=="idle"&&s("starting");let c=tn.request(()=>{s("idle")});return()=>{tn.cancel(c)}},[t,e,i,r]),{mounted:i,setMounted:a,transitionStatus:r}}var Ad=b(H(),1);var zc=b($n(),1);var fi=null;function mS(e){if(!fi){let t=[];fi=t,queueMicrotask(()=>{fi=null,zc.flushSync(()=>{for(let n of t)n()})})}fi.push(e)}function di(e,t=!1,n=!1){let o=Nt();return z((r,s=null)=>{o.cancel();let i=mn(e);if(i==null)return;let a=i,c=()=>{if(!n){zc.flushSync(r);return}mS(()=>{s?.aborted||r()})};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function l(){Promise.all(a.getAnimations().map(u=>u.finished)).then(()=>{s?.aborted||c()},()=>{if(s?.aborted)return;if(a.getAnimations().some(f=>f.pending||f.playState!=="finished")){l();return}c()})}if(t){let u=Po;if(!a.hasAttribute(u)){o.request(l);return}let f=new MutationObserver(()=>{a.hasAttribute(u)||(f.disconnect(),l())});f.observe(a,{attributes:!0,attributeFilter:[u]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}o.request(l)})}function St(e){let{enabled:t=!0,open:n,ref:o,batch:r=!1,onComplete:s}=e,i=z(s),a=di(o,n,r);Ad.useEffect(()=>{if(!t)return;let c=new AbortController;return a(i,c.signal),()=>{c.abort()}},[t,n,i,a])}var pi={tabIndex:-1,[Ar]:""};function Ld(e){return t=>t==="touch"?e.current:!0}function Vd(e,t=!1){let n=an(),o=Kt()!=null,r=He(()=>e(n,o)).current;return kd({popupStore:r,treatPopupAsFloatingElement:t,floatingRootContext:r.state.floatingRootContext,floatingId:n,nested:o,onOpenChange:r.setOpen}),r}function Fd({handle:e,store:t}){return B(()=>e.attachStore(t),[e,t]),null}function Dd(e){let t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function hS(e,t){let n=qc.useRef(null);return z(o=>{let r=n.current;if(r!==null){if(r.element===o&&r.store===t&&r.id===e)return;n.current=null;let s=r.store;s.context.triggerElements.getById(r.id)===r.element&&(s.context.triggerElements.delete(r.id),Dd(s))}o!==null&&e!==void 0&&(n.current={store:t,id:e,element:o},t.context.triggerElements.add(e,o),Dd(t))})}function Hd(e,t,n,o=!1){let r=e.preventUnmountingOnClose;t?r=!1:o&&(r=!0);let s=n?.id??null,i=e.activeTriggerId,a=e.activeTriggerElement;return(s||t)&&(i=s,a=n??null),{open:t,preventUnmountingOnClose:r,activeTriggerId:i,activeTriggerElement:a}}function Ud(e,t,n,o){let r=n.useState("isMountedByTrigger",e),s=hS(e,n),i=z(c=>{let l=n.select("open"),u=n.select("activeTriggerId");if(u===e){let f={activeTriggerElement:c,...l?o:null};n.update(f);return}if(u==null&&l){let f={activeTriggerId:e??null,activeTriggerElement:c,...o};n.update(f)}}),a=z(c=>{s(c),c&&i(c)});return B(()=>(a(t.current),()=>a(null)),[a,t,n,e]),B(()=>{if(r){let c={activeTriggerElement:t.current,...o};n.update(c)}},[r,n,t,...Object.values(o)]),{registerTrigger:a,isMountedByThisTrigger:r}}function Bd(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,o=qc.useRef(null),r=e.useState("open"),s=e.useState("triggerCount"),i=e.useState("activeTriggerId"),a=e.useState("activeTriggerElement");B(()=>{if(!r){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}let c=e.context.triggerElements.size,l={};e.state.triggerCount!==c&&(l.triggerCount=c);let u=e.select("activeTriggerId"),f=null;if(u){let p=e.context.triggerElements.getById(u);if(p)o.current=u,p!==e.state.activeTriggerElement&&(l.activeTriggerElement=p);else{for(let[d,m]of e.context.triggerElements.entries())if(m===e.state.activeTriggerElement){l.activeTriggerId=d,l.activeTriggerElement=m,o.current=d;break}l.activeTriggerId===void 0&&(o.current===u?f=u:o.current=null)}}else o.current=null;if(!f&&!u&&c===1){let p=e.context.triggerElements.entries().next();if(!p.done){let[d,m]=p.value;l.activeTriggerId=d,l.activeTriggerElement=m,o.current=d}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0||l.activeTriggerElement!==void 0)&&e.update(l),f&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===f&&!e.context.triggerElements.getById(f)){let p=me(ne.none);e.setOpen(!1,p),p.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,i,a,n])}function Wd(e,t,n,o){let{mounted:r,setMounted:s,transitionStatus:i}=cn(e,!1,!1,o),a=t.useState("preventUnmountingOnClose"),c=e?!1:a;t.useSyncedValues({mounted:r,transitionStatus:i,preventUnmountingOnClose:c});let l=z(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return St({enabled:r&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:i}}function $d(e,t){e.useSyncedValues(t),B(()=>()=>{e.update({activeTriggerProps:Ne,inactiveTriggerProps:Ne,popupProps:Ne})},[e])}function jd(e,t){B(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),B(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}var Ln=class{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(let n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(let n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function qd(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Cn({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Ne,inactiveTriggerProps:Ne,popupProps:Ne}}var es=e=>e.triggerIdProp??e.activeTriggerId,Kc=e=>e.openProp??e.open,zd=e=>(e.popupElement?.id??e.floatingId)||void 0;function Kd(e,t){return t!==void 0&&Kc(e)&&es(e)===t}function vS(e,t){return Kd(e,t)?!0:t!==void 0&&Kc(e)&&es(e)==null&&e.triggerCount===1}var Gd={open:Kc,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:es,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:zd,isTriggerActive:(e,t)=>t!==void 0&&es(e)===t,isOpenedByTrigger:(e,t)=>Kd(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&es(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>vS(e,t)?zd(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};var Gc=b(H(),1),Yd=b(Ds(),1);function Jd(e){let t=Gc.useCallback(o=>e===void 0?Le:e.subscribeStore(o),[e]),n=Gc.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Yd.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Fo(e){let{open:t=!1,onOpenChange:n,elements:o={}}=e,r=an(),s=Kt()!=null,i=He(()=>new Cn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Ln,floatingId:r,syncOnly:!1,nested:s})).current;return B(()=>{let a={open:t,floatingId:r};o.reference!==void 0&&(a.referenceElement=o.reference,a.domReferenceElement=Pe(o.reference)?o.reference:null),o.floating!==void 0&&(a.floatingElement=o.floating),i.update(a)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function Xd(e={}){let t=Fo(e),n=e.rootContext||t;return Qd(e,n)}function Zd(e){return Qd(e,e.rootContext)}function Qd(e,t){let{nodeId:n,externalTree:o}=e,r=t.useState("referenceElement"),s=t.useState("floatingElement"),i=t.useState("domReferenceElement"),a=t.useState("open"),c=t.useState("floatingId"),[l,u]=Pt.useState(null),[f,p]=Pt.useState(void 0),[d,m]=Pt.useState(void 0),g=Pt.useRef(null),h=gt(o),v=Pt.useMemo(()=>({reference:r,floating:s,domReference:i}),[r,s,i]),y=Nd({...e,elements:{...v,...l&&{reference:l}}}),R=Pe(f)?f:null,x=d===void 0?t.state.floatingElement:d;t.useSyncedValue("referenceElement",f??null),t.useSyncedValue("domReferenceElement",f===void 0?i:R),t.useSyncedValue("floatingElement",x);let S=Pt.useCallback(P=>{let L=Pe(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;u(L),y.refs.setReference(L)},[y.refs]),w=Pt.useCallback(P=>{(Pe(P)||P===null)&&(g.current=P,p(P)),(Pe(y.refs.reference.current)||y.refs.reference.current===null||P!==null&&!Pe(P))&&y.refs.setReference(P)},[y.refs,p]),C=Pt.useCallback(P=>{m(P),y.refs.setFloating(P)},[y.refs]),_=Pt.useMemo(()=>({...y.refs,setReference:w,setFloating:C,setPositionReference:S,domReference:g}),[y.refs,w,C,S]),T=Pt.useMemo(()=>({...y.elements,domReference:i}),[y.elements,i]),O=Pt.useMemo(()=>({...y,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:_,elements:T,nodeId:n,rootStore:t}),[y,_,T,n,t,a,c]);return B(()=>{i&&(g.current=i)},[i]),B(()=>{t.context.dataRef.current.floatingContext=O;let P=h?.nodesRef.current.find(L=>L.id===n);P&&(P.context=O)}),Pt.useMemo(()=>({...y,context:O,refs:_,elements:T,rootStore:t}),[y,_,T,O,t])}var Jc=b(H(),1);var Yc=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Lt,this.restTimeout=new Lt,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},mi=new WeakMap;function _n(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&mi.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),mi.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ar(e,t){let{scopeElement:n,referenceElement:o,floatingElement:r}=t,s=mi.get(n);s&&s!==e&&_n(s),_n(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=r,mi.set(n,e),n.style.pointerEvents="none",o.style.pointerEvents="auto",r.style.pointerEvents="auto"}function cr(e){let t=e.context.dataRef.current,n=He(()=>t.hoverInteractionState??Yc.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=n),Qo(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Xc(e,t={}){let{enabled:n=!0,closeDelay:o=0,nodeId:r}=t,s="rootStore"in e?e.rootStore:e,i=s.useState("open"),a=s.useState("floatingElement"),c=s.useState("domReferenceElement"),{dataRef:l}=s.context,u=gt(),f=Kt(),p=cr(s),d=et(),m=z(()=>zs(l.current.openEvent?.type,p.interactedInside)),g=z(()=>Tf(l.current.openEvent?.type)),h=z(()=>{_n(p)});B(()=>{i||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,h())},[i,p,h]),Jc.useEffect(()=>h,[h]),B(()=>{if(n&&i&&p.handleCloseOptions?.blockPointerEvents&&g()&&Pe(c)&&a){let v=c,y=a,R=ve(a),x=u?.nodesRef.current.find(_=>_.id===f)?.context?.elements.floating;x&&(x.style.pointerEvents="");let S=p.pointerEventsScopeElement!==y?p.pointerEventsScopeElement:null,w=x!==y?x:null,C=p.handleCloseOptions?.getScope?.()??S??w??v.closest("[data-rootownerid]")??R.body;return ar(p,{scopeElement:C,referenceElement:v,floatingElement:y}),()=>{h()}}},[n,i,c,a,p,g,u,f,h]),Jc.useEffect(()=>{if(!n)return;function v(){return!!(u&&f&&Ht(u.nodesRef.current,f).length>0)}function y(_){let T=Br(o,"close",p.pointerType),O=()=>{s.setOpen(!1,me(ne.triggerHover,_)),u?.events.emit("floating.closed",_)};T?p.openChangeTimeout.start(T,O):(p.openChangeTimeout.clear(),O())}function R(_){let T=Ve(_);if(!Sc(T)){p.interactedInside=!1;return}p.interactedInside=T?.closest("[aria-haspopup]")!=null}function x(){p.openChangeTimeout.clear(),d.clear(),u?.events.off("floating.closed",w),h()}function S(_){if(v()&&u){u.events.on("floating.closed",w);return}if(Fr(_.relatedTarget,s.context.triggerElements))return;let T=l.current.floatingContext?.nodeId??r,O=_.relatedTarget;if(!(u&&T&&Pe(O)&&Ht(u.nodesRef.current,T,!1).some(L=>Q(L.context?.elements.floating,O)))){if(p.handler){p.handler(_);return}h(),g()&&!m()&&y(_)}}function w(_){!u||!f||v()||d.start(0,()=>{u.events.off("floating.closed",w),s.setOpen(!1,me(ne.triggerHover,_)),u.events.emit("floating.closed",_)})}let C=a;return bt(C&&xe(C,"mouseenter",x),C&&xe(C,"mouseleave",S),C&&xe(C,"pointerdown",R,!0),()=>{u?.events.off("floating.closed",w)})},[n,a,s,l,o,r,g,m,h,p,u,f,d])}var to=b(H(),1),ep=b($n(),1);var xS={current:null};function Zc(e,t={}){let{enabled:n=!0,delay:o=0,handleClose:r=null,mouseOnly:s=!1,restMs:i=0,move:a=!0,triggerElementRef:c=xS,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:p,shouldOpen:d,guardStaleOpen:m=!1}=t,g="rootStore"in e?e.rootStore:e,{dataRef:h,events:v}=g.context,y=gt(l),R=cr(g),x=to.useRef(!1),S=Ue(r),w=Ue(o),C=Ue(i),_=Ue(n),T=Ue(d),O=Ue(p),P=z(()=>zs(h.current.openEvent?.type,R.interactedInside)),L=z(()=>T.current?.()!==!1),E=z((A,D,N)=>{let W=g.context.triggerElements;if(W.hasElement(D))return!A||!Q(A,D);if(!Pe(N))return!1;let k=N;return W.hasMatchingElement(j=>Q(j,k))&&(!A||!Q(A,k))}),M=z(()=>{if(!R.handler)return;ve(g.select("domReferenceElement")).removeEventListener("mousemove",R.handler),R.handler=void 0}),I=z(()=>{_n(R)});return u&&(R.handleCloseOptions=r?.__options),to.useEffect(()=>M,[M]),to.useEffect(()=>{if(!n)return;function A(D){D.open?x.current=!1:(x.current=D.reason===ne.triggerHover,M(),R.openChangeTimeout.clear(),R.restTimeout.clear(),R.blockMouseMove=!0,R.restTimeoutPending=!1)}return v.on("openchange",A),()=>{v.off("openchange",A)}},[n,v,R,M]),to.useEffect(()=>{if(!n)return;function A(U,$=!0){let V=Br(w.current,"close",R.pointerType);V?R.openChangeTimeout.start(V,()=>{g.setOpen(!1,me(ne.triggerHover,U)),y?.events.emit("floating.closed",U)}):$&&(R.openChangeTimeout.clear(),g.setOpen(!1,me(ne.triggerHover,U)),y?.events.emit("floating.closed",U))}let D=c.current??(u?g.select("domReferenceElement"):null);if(!Pe(D))return;function N(U){if(R.openChangeTimeout.clear(),R.blockMouseMove=!1,s&&!kn(R.pointerType))return;let $=Rc(C.current),V=Br(w.current,"open",R.pointerType),X=Ve(U),Y=U.currentTarget??null,ge=g.select("domReferenceElement"),Z=Y;if(Pe(X)&&!g.context.triggerElements.hasElement(X)){for(let re of g.context.triggerElements.elements())if(Q(re,X)){Z=re;break}}Pe(Y)&&Pe(ge)&&!g.context.triggerElements.hasElement(Y)&&Q(Y,ge)&&(Z=ge);let fe=Z==null?!1:E(ge,Z,X),ee=g.select("open"),ce=O.current?.()??g.select("transitionStatus")==="ending",q=!ee&&ce&&x.current,le=!fe&&Pe(Z)&&Pe(ge)&&Q(ge,Z)&&q,de=$>0&&!V,he=fe&&(ee||q)||le,De=!ee||fe;if(he){L()&&g.setOpen(!0,me(ne.triggerHover,U,Z));return}de||(V?R.openChangeTimeout.start(V,()=>{De&&L()&&g.setOpen(!0,me(ne.triggerHover,U,Z))}):De&&L()&&g.setOpen(!0,me(ne.triggerHover,U,Z)))}function W(U){if(P()){I();return}M();let $=g.select("domReferenceElement"),V=ve($);R.restTimeout.clear(),R.restTimeoutPending=!1;let X=h.current.floatingContext??f?.();if(Fr(U.relatedTarget,g.context.triggerElements))return;if(S.current&&X){g.select("open")||R.openChangeTimeout.clear();let ge=c.current;R.handler=S.current({...X,tree:y,x:U.clientX,y:U.clientY,onClose(){I(),M(),_.current&&!P()&&ge===g.select("domReferenceElement")&&A(U,!0)}}),V.addEventListener("mousemove",R.handler),R.handler(U);return}(R.pointerType!=="touch"||!Q(g.select("floatingElement"),U.relatedTarget))&&A(U)}function k(U){Q(D,U.relatedTarget)||(R.openChangeTimeout.clear(),R.restTimeout.clear(),R.restTimeoutPending=!1)}let j=m?xe(D,"mouseout",k):void 0;return a?bt(xe(D,"mousemove",N,{once:!0}),xe(D,"mouseenter",N),xe(D,"mouseleave",W),j):bt(xe(D,"mouseenter",N),xe(D,"mouseleave",W),j)},[M,I,h,w,g,n,S,R,u,E,P,s,a,C,c,y,_,f,O,L,m]),to.useMemo(()=>{if(!n)return;function A(D){R.pointerType=D.pointerType}return{onPointerDown:A,onPointerEnter:A,onMouseMove(D){let{nativeEvent:N}=D,W=D.currentTarget,k=g.select("domReferenceElement"),j=g.select("open"),U=E(k,W,D.target);if(s&&!kn(R.pointerType))return;if(j&&U&&R.handleCloseOptions?.blockPointerEvents){let X=g.select("floatingElement");if(X){let Y=R.handleCloseOptions?.getScope?.()??W.ownerDocument.body;ar(R,{scopeElement:Y,referenceElement:W,floatingElement:X})}}let $=Rc(C.current);if(j&&!U||$===0||!U&&R.restTimeoutPending&&D.movementX**2+D.movementY**2<2)return;R.restTimeout.clear();function V(){if(R.restTimeoutPending=!1,P())return;let X=g.select("open");!R.blockMouseMove&&(!X||U)&&L()&&g.setOpen(!0,me(ne.triggerHover,N,W))}R.pointerType==="touch"?ep.flushSync(()=>{V()}):U&&j?V():(R.restTimeoutPending=!0,R.restTimeout.start($,V))}}},[n,R,P,E,s,g,C,L])}var Rt=b(H(),1);var yS="Escape";function tp(e){return Ge.engine.webkit&&e.movementX===0&&e.movementY===0}function hi(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function gi(e,t){return hi(t,e===mc||e===Bs,e===Dr||e===Lr)}function Qc(e,t,n){return hi(t,e===Bs,n?e===Dr:e===Lr)||e==="Enter"||e===" "||e===""}function SS(e,t,n){return hi(t,n?e===Dr:e===Lr,e===Bs)}function RS(e,t,n,o){let r=n?e===Lr:e===Dr,s=e===mc;return t==="both"||t==="horizontal"&&o?e===yS:hi(t,r,s)}function el(e,t){let{listRef:n,activeIndex:o,onNavigate:r=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:a=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:f=!1,focusItemOnOpen:p="auto",focusItemOnHover:d=!0,openOnArrowKeyDown:m=!0,disabledIndices:g=void 0,orientation:h="vertical",parentOrientation:v,id:y,resetOnPointerLeave:R=!0,externalTree:x,grid:S}=t,w=S!=null,C="rootStore"in e?e.rootStore:e,_=C.useState("open"),T=C.useState("floatingElement"),O=C.useState("domReferenceElement"),P=C.context.dataRef,L=Io(T),E=Ur(O),M=Ue(L),I=Kt(),A=gt(x),D=Rt.useRef(p),N=Rt.useRef(i??-1),W=Rt.useRef(null),k=Rt.useRef(!0),j=z(G=>{r(N.current===-1?null:N.current,G)}),U=Rt.useRef(!!T),$=Rt.useRef(_),V=Rt.useRef(!1),X=Rt.useRef(!1),Y=Rt.useRef(null),ge=Ue(g),Z=Ue(_),fe=Ue(i),ee=Ue(R),ce=Nt(),q=Nt(),le=z(()=>{function G(ue){f?A?.events.emit("virtualfocus",ue):Y.current=sr(ue,{sync:V.current,preventScroll:!0})}let te=n.current[N.current],K=X.current;te&&G(te),(V.current?ue=>ue():ue=>ce.request(ue))(()=>{let ue=n.current[N.current]||te;if(!ue)return;te||G(ue),se&&(K||!k.current)&&ue.scrollIntoView?.({block:"nearest",inline:"nearest"})})});B(()=>{P.current.orientation=h},[P,h]),B(()=>{s&&(_&&T?(N.current=i??-1,D.current&&i!=null&&(X.current=!0,j())):U.current&&(N.current=-1,j()))},[s,_,T,i,j]),B(()=>{if(s){if(!_){V.current=!1;return}if(T)if(o==null){if(V.current=!1,fe.current!=null)return;if(U.current&&(N.current=-1,le()),(!$.current||!U.current)&&D.current&&(W.current!=null||D.current===!0&&W.current==null)){let G=0,te=()=>{n.current[0]==null?(G<2&&(G?F=>q.request(F):queueMicrotask)(te),G+=1):(N.current=W.current==null||Qc(W.current,h,u)||l?Oo(n):or(n),W.current=null,j())};te()}}else Jn(n.current,o)||(N.current=o,le(),X.current=!1)}},[s,_,T,o,fe,l,n,h,u,j,le,q]),B(()=>{if(!s||T||!A||f||!U.current)return;let G=A.nodesRef.current,te=G.find(ue=>ue.id===I)?.context?.elements.floating,K=mt(ve(O??te??null)),F=G.some(ue=>ue.context&&Q(ue.context.elements.floating,K));te&&!F&&k.current&&te.focus({preventScroll:!0})},[s,T,O,A,I,f]),B(()=>{$.current=_,U.current=!!T}),B(()=>{_||(W.current=null,D.current=p)},[_,p]);let de=o!=null,he=z(G=>{if(!Z.current)return;let te=n.current.indexOf(G.currentTarget);te!==-1&&(N.current!==te||o!==te)&&(N.current=te,j(G))}),De=z(()=>v??A?.nodesRef.current.find(G=>G.id===I)?.context?.dataRef?.current.orientation),re=z(()=>Oo(n,ge.current)),Re=z(G=>{if(k.current=!1,V.current=!0,G.which===229||!Z.current&&G.currentTarget===M.current)return;if(l&&RS(G.key,h,u,w)){gi(G.key,De())||Et(G),C.setOpen(!1,me(ne.listNavigation,G.nativeEvent)),Te(O)&&(f?A?.events.emit("virtualfocus",O):O.focus());return}let te=N.current,K=Oo(n,g),F=or(n,g);if(E||(G.key==="Home"&&(Et(G),N.current=K,j(G)),G.key==="End"&&(Et(G),N.current=F,j(G))),S!=null){let ue=S(G,N.current,n,h,c,u,g,K,F);if(ue!=null&&(N.current=ue,j(G)),h==="both")return}if(gi(G.key,h)){if(Et(G),_&&!f&&mt(G.currentTarget.ownerDocument)===G.currentTarget){N.current=Qc(G.key,h,u)?K:F,j(G);return}Qc(G.key,h,u)?c?te>=F?a&&te!==n.current.length?N.current=-1:(V.current=!1,N.current=K):N.current=sn(n.current,{startingIndex:te,disabledIndices:g}):N.current=Math.min(F,sn(n.current,{startingIndex:te,disabledIndices:g})):c?te<=K?a&&te!==-1?N.current=n.current.length:(V.current=!1,N.current=F):N.current=sn(n.current,{startingIndex:te,decrement:!0,disabledIndices:g}):N.current=Math.max(K,sn(n.current,{startingIndex:te,decrement:!0,disabledIndices:g})),Jn(n.current,N.current)&&(N.current=-1),j(G)}}),se=Rt.useMemo(()=>({onFocus(te){V.current=!0,he(te)},onClick:({currentTarget:te})=>te.focus({preventScroll:!0}),onMouseMove(te){tp(te)||(V.current=!0,X.current=!1,d&&he(te))},onPointerLeave(te){if(!Z.current||!k.current||te.pointerType==="touch")return;V.current=!0;let K=te.relatedTarget;if(!(!d||n.current.includes(K))&&ee.current&&(Y.current?.(),Y.current=null,N.current=-1,j(te),!f)){let F=M.current,ue=mt(ve(F));F&&Q(F,ue)&&F.focus({preventScroll:!0})}}}),[he,Z,M,d,n,j,ee,f]),Ce=Rt.useMemo(()=>f&&_&&de&&{"aria-activedescendant":`${y}-${o}`},[f,_,de,y,o]),be=Rt.useMemo(()=>({...E?{}:Ce,onKeyDown(G){if(G.key==="Tab"&&G.shiftKey&&_&&!f){let te=Ve(G.nativeEvent);if(te&&!Q(M.current,te))return;Et(G),C.setOpen(!1,me(ne.focusOut,G.nativeEvent)),Te(O)&&O.focus();return}Re(G)},onPointerMove(G){tp(G)||(k.current=!0)}}),[Ce,Re,M,E,C,_,f,O]),_e=Rt.useMemo(()=>{function G(F){C.setOpen(!0,me(ne.listNavigation,F.nativeEvent,F.currentTarget))}function te(F){p==="auto"&&qn(F.nativeEvent)&&(D.current=!f)}function K(F){D.current=p,p==="auto"&&er(F.nativeEvent)&&(D.current=!0)}return{onKeyDown(F){let ue=C.select("open");k.current=!1;let Me=F.key.startsWith("Arrow"),Ke=SS(F.key,De(),u),$e=gi(F.key,h),Ze=(l?Ke:$e)||F.key==="Enter"||F.key.trim()==="";if(f&&ue)return Re(F);if(!(!ue&&!m&&Me)){if(Ze){let Qe=gi(F.key,De());W.current=l&&Qe?null:F.key}if(l){Ke&&(Et(F),ue?(N.current=re(),j(F)):G(F));return}$e&&(fe.current!=null&&(N.current=fe.current),Et(F),!ue&&m?G(F):Re(F),ue&&j(F))}},onFocus(F){C.select("open")&&!f&&(N.current=-1,j(F))},onPointerDown:K,onPointerEnter:K,onMouseDown:te,onClick:te}},[Re,p,re,l,j,C,m,h,De,u,fe,f]),We=Rt.useMemo(()=>({...Ce,..._e}),[Ce,_e]);return Rt.useMemo(()=>s?{reference:We,floating:be,item:se,trigger:_e}:{},[s,We,be,_e,se])}var Ho=b(H(),1);function tl(e,t){let{listRef:n,elementsRef:o,activeIndex:r,onMatch:s,disabledIndices:i,onTyping:a,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,f="rootStore"in e?e.rootStore:e,p=f.useState("open"),d=et(),m=Ho.useRef(""),g=Ho.useRef(u??r??-1),h=Ho.useRef(null),v=z(x=>{function S(M){return o?.current[M]}function w(M){let I=S(M);return I&&!No(I)||I?.matches(":disabled")?!1:i==null||!Dn(yt,M,i)}function C(M,I,A=0){if(M.length===0)return-1;let D=(A%M.length+M.length)%M.length,N=I.toLowerCase();for(let W=0;W<M.length;W+=1){let k=(D+W)%M.length;if(!(!M[k]?.toLowerCase().startsWith(N)||!w(k)))return k}return-1}let _=n.current;if(m.current.length>0&&x.key===" "&&(Et(x),a?.(!0)),m.current.length>0&&m.current[0]!==" "&&C(_,m.current)===-1&&x.key!==" "&&a?.(!1),_==null||x.key.length!==1||x.ctrlKey||x.metaKey||x.altKey)return;p&&x.key!==" "&&(Et(x),a?.(!0));let T=m.current==="";T&&(g.current=u??r??-1),_.every((M,I)=>M&&w(I)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&m.current===x.key&&(m.current="",g.current=h.current),m.current+=x.key,d.start(l,()=>{m.current="",g.current=h.current,a?.(!1)});let L=((T?u??r??-1:g.current)??0)+1,E=C(_,m.current,L);E!==-1?(s?.(E),h.current=E):x.key!==" "&&(m.current="",a?.(!1))}),y=z(x=>{let S=x.relatedTarget,w=f.select("domReferenceElement"),C=f.select("floatingElement");Q(w,S)||Q(C,S)||(d.clear(),m.current="",g.current=h.current,a?.(!1))});B(()=>{!p&&u!==null||(d.clear(),h.current=null,m.current!==""&&(m.current=""))},[p,u,d]);let R=Ho.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return Ho.useMemo(()=>c?{reference:R,floating:R}:{},[c,R])}var np=.1,wS=np*np,Be=.5;function vi(e,t,n,o,r,s){return o>=t!=s>=t&&e<=(r-n)*(t-o)/(s-o)+n}function xi(e,t,n,o,r,s,i,a,c,l){let u=!1;return vi(e,t,n,o,r,s)&&(u=!u),vi(e,t,r,s,i,a)&&(u=!u),vi(e,t,i,a,c,l)&&(u=!u),vi(e,t,c,l,n,o)&&(u=!u),u}function bS(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function yi(e,t,n,o,r,s){let i=Math.min(n,r),a=Math.max(n,r),c=Math.min(o,s),l=Math.max(o,s);return e>=i&&e<=a&&t>=c&&t<=l}function nl(e={}){let{blockPointerEvents:t=!1}=e,n=new Lt,o=({x:r,y:s,placement:i,elements:a,onClose:c,nodeId:l,tree:u})=>{let f=i?.split("-")[0],p=!1,d=null,m=null,g=typeof performance<"u"?performance.now():0;function h(y,R){let x=performance.now(),S=x-g;if(d===null||m===null||S===0)return d=y,m=R,g=x,!1;let w=y-d,C=R-m,_=w*w+C*C,T=S*S*wS;return d=y,m=R,g=x,_<T}function v(){n.clear(),c()}return function(R){n.clear();let x=a.domReference,S=a.floating;if(!x||!S||f==null||r==null||s==null)return;let{clientX:w,clientY:C}=R,_=Ve(R),T=R.type==="mouseleave",O=Q(S,_),P=Q(x,_);if(O&&(p=!0,!T))return;if(P&&(p=!1,!T)){p=!0;return}if(T&&Pe(R.relatedTarget)&&Q(S,R.relatedTarget))return;function L(){return!!(u&&Ht(u.nodesRef.current,l).length>0)}function E(){L()||v()}if(L())return;let M=x.getBoundingClientRect(),I=S.getBoundingClientRect(),A=r>I.right-I.width/2,D=s>I.bottom-I.height/2,N=I.width>M.width,W=I.height>M.height,k=(N?M:I).left,j=(N?M:I).right,U=(W?M:I).top,$=(W?M:I).bottom;if(f==="top"&&s>=M.bottom-1||f==="bottom"&&s<=M.top+1||f==="left"&&r>=M.right-1||f==="right"&&r<=M.left+1){E();return}let V=!1;switch(f){case"top":V=yi(w,C,k,M.top+1,j,I.bottom-1);break;case"bottom":V=yi(w,C,k,I.top+1,j,M.bottom-1);break;case"left":V=yi(w,C,I.right-1,$,M.left+1,U);break;case"right":V=yi(w,C,M.right-1,$,I.left+1,U);break;default:}if(V)return;if(p&&!bS(w,C,M)){E();return}if(!T&&h(w,C)){E();return}let X=!1;switch(f){case"top":{let Y=N?Be/2:Be*4,ge=N||A?r+Y:r-Y,Z=N?r-Y:A?r+Y:r-Y,fe=s+Be+1,ee=A||N?I.bottom-Be:I.top,ce=A?N?I.bottom-Be:I.top:I.bottom-Be;X=xi(w,C,ge,fe,Z,fe,I.left,ee,I.right,ce);break}case"bottom":{let Y=N?Be/2:Be*4,ge=N||A?r+Y:r-Y,Z=N?r-Y:A?r+Y:r-Y,fe=s-Be,ee=A||N?I.top+Be:I.bottom,ce=A?N?I.top+Be:I.bottom:I.top+Be;X=xi(w,C,ge,fe,Z,fe,I.left,ee,I.right,ce);break}case"left":{let Y=W?Be/2:Be*4,ge=W||D?s+Y:s-Y,Z=W?s-Y:D?s+Y:s-Y,fe=r+Be+1,ee=D||W?I.right-Be:I.left,ce=D?W?I.right-Be:I.left:I.right-Be;X=xi(w,C,ee,I.top,ce,I.bottom,fe,ge,fe,Z);break}case"right":{let Y=W?Be/2:Be*4,ge=W||D?s+Y:s-Y,Z=W?s-Y:D?s+Y:s-Y,fe=r-Be,ee=D||W?I.left+Be:I.right,ce=D?W?I.left+Be:I.right:I.left+Be;X=xi(w,C,fe,ge,fe,Z,ee,I.top,ce,I.bottom);break}default:}X?p||n.start(40,E):E()}};return o.__options={...e,blockPointerEvents:t},o}var no=b(H(),1),ol=no.createContext(void 0),rl=no.createContext(void 0),sl=no.createContext(void 0);function je(){let e=no.useContext(ol);if(e===void 0)throw new Error(Ae(60));return e}function oo(){let e=no.useContext(rl);if(e===void 0)throw new Error(Ae(101));return e}function Si(){let e=no.useContext(sl);if(e===void 0)throw new Error(Ae(61));return e}var wi=b(H(),1);var op="data-valid",rp="data-invalid";var sp={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},CS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ip={disabled:!1,...CS},Ri={valid(e){return e===null?null:e?{[op]:""}:{[rp]:""}}};var _S={invalid:void 0,name:void 0,validityData:{state:sp,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,setTouched:Le,setDirty:Le,setFilled:Le,setFocused:Le,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:ip,registerFieldControl:Le,validation:{getValidationProps:(e,t=Ne)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Le,getInputControl:()=>null,commit:async()=>{},change:Le}},PS=wi.createContext(_S);function ro(e=!0){let t=wi.useContext(PS);if(t.setValidityData===Le&&!e)throw new Error(Ae(28));return t}function ap(e,t,n,o,r=!0,s){let{registerFieldControl:i}=ro(),a=He(()=>Symbol());B(()=>{let c=a.current;if(!r){i(c,void 0);return}i(c,{controlRef:e,getValue:o,id:t,name:s,value:n})},[e,r,o,t,s,i,a,n]),B(()=>{let c=a.current;return()=>{i(c,void 0)}},[i,a])}var il=b(H(),1);function Tt(e){return an(e,"base-ui")}var bi=b(H(),1);var TS=bi.createContext({controlId:void 0,registerControlId:Le,resetControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function lr(){return bi.useContext(TS)}function Ei(e={}){let{id:t,enabled:n=!0}=e,{controlId:o,registerControlId:r,resetControlId:s}=lr(),i=Tt(),a=He(()=>Symbol()),c=il.useRef(!1),l=il.useRef(!1),u=z(()=>{!c.current||r===Le||(c.current=!1,r(a.current,void 0))});return B(()=>{if(!n||r===Le){u();return}let f;if(t!==void 0)l.current=!0,f=t;else if(l.current)f=i;else{s();return}if(f===void 0){u();return}c.current=!0,r(a.current,f)},[t,n,r,s,i,a,u]),B(()=>u,[u]),(n?o:void 0)??t??i}function cp(e,t,n=Object.is){let{length:o}=e;if(o!==t.length)return!1;for(let r=0;r<o;r+=1)if(!n(e[r],t[r]))return!1;return!0}var cl=(e,t)=>Object.is(e,t);function Vn(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function lp(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!cp(e,t,(o,r)=>Vn(o,r,n)):e!==t}function al(e,t,n){return e?e.some(o=>o===void 0?!1:Vn(t,o,n)):!1}function ts(e,t,n){return e?e.findIndex(o=>o===void 0?!1:Vn(o,t,n)):-1}function IS(e,t){if(t!==cl)return o=>al(e,o,t);let n=new Set(e);return n.delete(void 0),o=>n.has(o)&&(o!==0||e.some(r=>Object.is(o,r)))}function ll(e,t,n,o){let r=o&&Array.isArray(t)?e.findIndex(IS(t,n)):ts(e,t,n);return r===-1?null:r}function up(e,t,n,o,r,s){return al(o,t,r)?s!=null&&e>s&&al(o,n[s],r)?s:e:e===s?ll(n,o,r,!0):s}function fp(e,t,n){return e.filter(o=>!Vn(t,o,n))}var dp=b(H(),1);function Ci(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}var pp=b(ie(),1);function OS(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function mp(e){return OS(e?.[0])}function NS(e){return mp(e)?e.flatMap(t=>t.items):e}function gp(e){if(!Array.isArray(e))return e!=null&&"null"in e;let t=e;if(mp(t)){for(let n of t)for(let o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(let n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function ul(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Ci(e)}function so(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Ci(e.value):Ci(e)}function fl(e,t,n){function o(){return ul(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??o();if(Array.isArray(t)){let s=NS(t);if(e==null||typeof e!="object"){let i=s.find(a=>a.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){let i=s.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function hp(e,t,n){return e.reduce((o,r,s)=>(s>0&&o.push(", "),o.push((0,pp.jsx)(dp.Fragment,{children:fl(r,t,n)},s)),o),[])}var vp={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:so(t,o)!==""},hasNullItemLabel:(e,t)=>t?gp(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(r=>Vn(t,r,n)):Vn(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};var _i=b(H(),1);var MS=_i.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitCountRef:{current:0}});function xp(){return _i.useContext(MS)}var yp=b(H(),1);function Pi(e,t){let n=yp.useRef(e),o=z(t);B(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}var os=b(H(),1);var ns=b(H(),1);function Sp(e){let t=ns.useRef(""),n=ns.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:ns.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r?e(r,r.pointerType):e(r,t.current),t.current=""},[e]),onPointerDown:n}}function dl(e,t){let n=z((s,i)=>{(typeof e=="function"?e():e)||t(i||(Ge.os.ios?"touch":""))}),{onClick:o,onPointerDown:r}=Sp(n);return os.useMemo(()=>({onClick:o,onPointerDown:r}),[o,r])}function Rp(e){let[t,n]=os.useState(null),o=dl(e,n);return Pi(e,r=>{r&&!e&&n(null)}),os.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}function Uo(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}var Gt=1;function ur(e,t){return Math.max(0,e-t)}function fr(e,t){if(t<=0)return 0;let n=Uo(e,0,t),o=n,r=t-n,s=o<=Gt,i=r<=Gt;return s&&i?o<=r?0:t:s?0:i?t:n}var Bo=b(ie(),1);function wp(e){let{id:t,value:n,defaultValue:o=null,onValueChange:r,open:s,defaultOpen:i=!1,onOpenChange:a,name:c,form:l,autoComplete:u,disabled:f=!1,readOnly:p=!1,required:d=!1,modal:m=!0,actionsRef:g,inputRef:h,onOpenChangeComplete:v,items:y,multiple:R=!1,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:w=cl,highlightItemOnHover:C=!0,children:_}=e,{clearErrors:T}=xp(),{setDirty:O,setTouched:P,setFocused:L,validityData:E,setFilled:M,name:I,disabled:A,validation:D,validationMode:N}=ro(),W=Ei({id:t}),k=A||f,j=I??c,[U,$]=Mr({controlled:n,default:R?o??yt:o,name:"Select",state:"value"}),[V,X]=Mr({controlled:s,default:i,name:"Select",state:"open"}),Y=tt.useRef([]),ge=tt.useRef([]),Z=tt.useRef(null),fe=tt.useRef(null),ee=tt.useRef(0),ce=tt.useRef(null),q=tt.useRef([]),le=tt.useRef(!1),de=tt.useRef(null),he=tt.useRef(null),De=tt.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=tt.useRef(!1),Re=tt.useRef(U),{mounted:se,setMounted:Ce,transitionStatus:be}=cn(V),{openMethod:_e,triggerProps:We}=Rp(V),G=He(()=>new wn({id:W,labelId:void 0,modal:m,multiple:R,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:w,value:U,open:V,mounted:se,transitionStatus:be,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ne,triggerProps:Ne,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:Le,setOpen:Le,handleScrollArrowVisibility:Le,onOpenChangeComplete:Le,listRef:Y,popupRef:Z,scrollHandlerRef:fe,scrollArrowsMountedCountRef:ee,valueRef:ce,valuesRef:q,labelsRef:ge,typingRef:le,selectionRef:De,firstItemTextRef:de,selectedItemTextRef:he,alignItemWithTriggerActiveRef:re,initialValueRef:Re},vp)).current,te=G.useState("activeIndex"),K=G.useState("selectedIndex"),F=G.useState("triggerElement"),ue=G.useState("positionerElement"),Me=sf(_e),Ke=_e??Me,$e=tt.useMemo(()=>R?"":so(U,S),[R,U,S]),Ze=tt.useMemo(()=>R&&Array.isArray(U)?U.map(Se=>so(Se,S)):so(U,S),[R,U,S]),Qe=Ue(F),It=z(()=>Ze);ap(Qe,W,U,It,!k,c);let vt=R?Array.isArray(U)&&U.length>0:U!=null&&$e!=="";B(()=>{M(vt)},[vt,M]),B(function(){let Fe=ll(q.current,U,w,R);Fe===null&&(he.current=null),!V&&G.set("selectedIndex",Fe)},[R,V,U,w,G]),Pi(U,()=>{T(j),O(lp(U,E.initialValue,w)),D.change(U)});let xt=z((Se,Fe)=>{a?.(Se,Fe),!Fe.isCanceled&&(X(Se),!Se&&(Fe.reason===ne.focusOut||Fe.reason===ne.outsidePress)&&(P(!0),L(!1),N==="onBlur"&&D.commit(U)))}),Dt=z(()=>{Ce(!1),G.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)});St({enabled:!g,open:V,ref:Z,onComplete(){V||Dt()}}),tt.useImperativeHandle(g,()=>({unmount:Dt}),[Dt]);let Xt=z((Se,Fe)=>{r?.(Se,Fe),!Fe.isCanceled&&$(Se)}),dn=z(Se=>{let Fe=ur(Se.scrollHeight,Se.clientHeight),Ot=fr(Se.scrollTop,Fe),$t=Ot>0,So=Ot<Fe;G.set("scrollUpArrowVisible",$t),G.set("scrollDownArrowVisible",So)}),wt=Fo({open:V,onOpenChange:xt,elements:{reference:F,floating:ue}}),ft=Do(wt,{enabled:!k,event:"mousedown"}),ye=Lo(wt),Je=el(wt,{enabled:!k,listRef:Y,activeIndex:te,selectedIndex:K,disabledIndices:yt,onNavigate(Se){Se===null&&!V||G.set("activeIndex",Se)},focusItemOnHover:C}),rt=tl(wt,{enabled:!k&&(V||!p&&!R),listRef:ge,activeIndex:te,selectedIndex:K,disabledIndices:Se=>As(Y.current[Se]),onMatch(Se){V?G.set("activeIndex",Se):Xt(q.current[Se],me(ne.none))},onTyping(Se){le.current=Se}}),dt=tt.useMemo(()=>Qt(rt.reference,Je.reference,ye.reference,ft.reference,We),[ft.reference,rt.reference,Je.reference,ye.reference,We]),Wt=tt.useMemo(()=>Qt(pi,rt.floating,Je.floating,ye.floating),[rt.floating,Je.floating,ye.floating]),st=Je.item??Ne;G.useContextCallback("setValue",Xt),G.useContextCallback("setOpen",xt),G.useContextCallback("handleScrollArrowVisibility",dn),G.useContextCallback("onOpenChangeComplete",v),of(()=>{G.update({popupProps:Wt,triggerProps:dt})}),G.useSyncedValues({id:W,modal:m,multiple:R,value:U,open:V,mounted:se,transitionStatus:be,popupProps:Wt,triggerProps:dt,items:y,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:w,openMethod:Ke});let J=tt.useMemo(()=>({disabled:k,readOnly:p,required:d,multiple:R,highlightItemOnHover:C,itemProps:st}),[k,p,d,R,C,st]),pe=en(h,D.inputRef),we=R?void 0:j,Ee=tt.useMemo(()=>!R||!Array.isArray(U)||!j?null:U.map(Se=>{let Fe=so(Se,S);return(0,Bo.jsx)("input",{type:"hidden",form:l,name:j,value:Fe,disabled:k},Fe)}),[R,U,l,j,S,k]);return(0,Bo.jsxs)(ol.Provider,{value:G,children:[(0,Bo.jsx)(rl.Provider,{value:J,children:(0,Bo.jsx)(sl.Provider,{value:wt,children:_})}),(0,Bo.jsx)("input",{...D.getValidationProps(k,{onFocus(){G.state.triggerElement?.focus({focusVisible:!0})},onChange(Se){if(Se.nativeEvent.defaultPrevented||k||p)return;let Fe=Se.currentTarget.value,Ot=me(ne.none,Se.nativeEvent);function $t(){if(R)return;let So=Fe.toLowerCase(),Cr=q.current.findIndex(ka=>so(ka,S).toLowerCase()===So||ul(ka,x).toLowerCase()===So);Cr===-1&&(Cr=q.current.findIndex((ka,xv)=>{let gu=ge.current[xv];return gu!=null&&gu.toLowerCase()===So}));let mu=q.current[Cr];mu!=null&&Xt(mu,Ot)}G.set("forceMount",!0),queueMicrotask($t)}}),id:W&&we==null?`${W}-hidden-input`:void 0,form:l,name:we,autoComplete:u,value:$e,disabled:k,required:d&&!(R&&vt),readOnly:p,ref:pe,style:j?tf:ks,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ee]})}var Pp=b(H(),1);function bp(e,t){let n=Tt(e);return B(()=>(t(n),()=>{t(o=>o===n?void 0:o)}),[n,t]),n}function Ep(e={}){let{id:t,fallbackControlId:n,native:o=!1,setLabelId:r,focusControl:s}=e,{controlId:i,setLabelId:a}=lr(),c=z(d=>{a(d),r?.(d)}),l=bp(t,c),u=i??n;function f(d){if(s){s(d,u);return}if(!u)return;let m=ve(d.currentTarget).getElementById(u);Te(m)&&kS(m)}function p(d){Ve(d.nativeEvent)?.closest("button,input,select,textarea")||(!d.defaultPrevented&&d.detail>1&&d.preventDefault(),!o&&f(d))}return o?{id:l,htmlFor:u,onMouseDown:p}:{id:l,onClick:p,onPointerDown(d){d.preventDefault()}}}function kS(e){e.focus({focusVisible:!0})}function Cp(e){return e==null?void 0:`${e}-label`}function _p(e,t){return e??t}var Tp=Pp.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=i;delete a.id;let c=ro(),l=je(),u=l.useState("triggerElement"),f=l.useState("id"),p=Cp(f),d=Ep({id:p,fallbackControlId:u?.id??f,setLabelId(m){let g=typeof m=="function"?m(l.state.labelId):m;l.set("labelId",g)}});return oe("div",t,{ref:n,state:c.state,props:[d,i],stateAttributesMapping:Ri})});var dr=b(H(),1);var Ti=5;function Ip(e,t){let n=AS(t);return e.clientX>=n.left-Ti&&e.clientX<=n.right+Ti&&e.clientY>=n.top-Ti&&e.clientY<=n.bottom+Ti}function AS(e){let t=e.getBoundingClientRect(),n=Oe(e);if(Ge.env.jsdom)return t;let o=n.getComputedStyle(e,"::before"),r=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||r.content!=="none"))return t;let i=parseFloat(o.width)||0,a=parseFloat(o.height)||0,c=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,i,c),f=Math.max(t.height,a,l),p=u-t.width,d=f-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-d/2,bottom:t.bottom+d/2}}var PI=To.popupOpen,TI=To.pressed;var Op="data-popup-side";var LS=400,VS={...$s,...Ri,popupSide:e=>e?{[Op]:e}:null,value:()=>null},Np=dr.forwardRef(function(t,n){let{render:o,className:r,id:s,disabled:i=!1,nativeButton:a=!0,style:c,...l}=t,{setTouched:u,setFocused:f,validationMode:p,validation:d,state:m,disabled:g}=ro(),{labelId:h}=lr(),v=je(),{readOnly:y,required:R,disabled:x}=oo(),S=g||x||i,w=v.useState("open"),C=v.useState("mounted"),_=v.useState("value"),T=v.useState("triggerProps"),O=v.useState("positionerElement"),P=v.useState("listElement"),L=v.useState("popupSide"),E=v.useState("id"),M=v.useState("labelId"),I=v.useState("hasSelectedValue"),A=C&&O?L:null,D=s??E,N=_p(h,M);Ei({id:s});let W=Ue(O),k=dr.useRef(null),{getButtonProps:j,buttonRef:U}=zt({disabled:S,native:a}),$=v.useStateSetter("triggerElement"),V=et(),X=et(),Y=et();dr.useEffect(()=>{if(w)return Y.start(LS,()=>{v.context.selectionRef.current.allowUnselectedMouseUp=!0,v.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Y.clear()};v.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[w,v,X,Y]);let ge=Qt(T,{id:D,role:"combobox","aria-expanded":w,"aria-haspopup":"listbox","aria-controls":w?P?.id??Io(O)?.id:void 0,"aria-labelledby":N,"aria-readonly":y||void 0,"aria-required":R||void 0,tabIndex:S?-1:0,onFocus(ee){f(!0),w&&v.context.alignItemWithTriggerActiveRef.current&&v.context.setOpen(!1,me(ne.none,ee.nativeEvent)),V.start(0,()=>{v.set("forceMount",!0)})},onBlur(ee){Q(O,ee.relatedTarget)||(u(!0),f(!1),p==="onBlur"&&d.commit(_))},onMouseDown(ee){if(w)return;let ce=ve(ee.currentTarget);function q(le){if(!k.current)return;let de=le.target;Q(k.current,de)||Q(W.current,de)||Ip(le,k.current)||v.context.setOpen(!1,me(ne.cancelOpen,le))}X.start(0,()=>{ce.addEventListener("mouseup",q,{once:!0})})}},l,j),Z=d.getValidationProps(S,ge);Z.role="combobox";let fe={...m,open:w,disabled:S,value:_,readOnly:y,popupSide:A,placeholder:!I};return oe("button",t,{ref:[n,k,U,$],state:fe,stateAttributesMapping:VS,props:Z})});var Mp=b(H(),1);var FS={value:()=>null},kp=Mp.forwardRef(function(t,n){let{className:o,render:r,children:s,placeholder:i,style:a,...c}=t,l=je(),u=l.useState("value"),f=l.useState("items"),p=l.useState("itemToStringLabel"),d=l.useState("hasSelectedValue"),m=!d&&i!=null&&s==null,g=l.useState("hasNullItemLabel",m),h={value:u,placeholder:!d},v=null;return typeof s=="function"?v=s(u):s!=null?v=s:m&&!g?v=i:Array.isArray(u)?v=hp(u,f,p):v=fl(u,f,p),oe("span",t,{state:h,ref:[n,l.context.valueRef],props:[{children:v},c],stateAttributesMapping:FS})});var Ap=b(H(),1);var Dp=Ap.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,l={open:je().useState("open")};return oe("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"\u25BC"},i],stateAttributesMapping:nr})});var Lp=b(H(),1);var Vp=b(ie(),1),Fp=Lp.forwardRef(function(t,n){let o=je(),r=o.useState("mounted"),s=o.useState("forceMount");return r||s?(0,Vp.jsx)(Ao,{ref:n,...t}):null});var Hp=b(H(),1);var HS={...qt,...Vt},Up=Hp.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=je(),c=a.useState("open"),l=a.useState("mounted"),u=a.useState("transitionStatus");return oe("div",t,{state:{open:c,transitionStatus:u},ref:n,props:[{role:"presentation",hidden:!l,style:{userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:HS})});var ln=b(H(),1);function io(e){return Xo(19)?e:e?"true":void 0}var Fn=b(H(),1);var Ii=b(H(),1),pl=Ii.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Bp(){return Ii.useContext(pl)}var Wp=b(ie(),1);function Oi(e){let{children:t,elementsRef:n,labelsRef:o,onMapChange:r}=e,s=z(r),[,i]=Fn.useState(!1),a=He(BS).current,c=He(US).current,l=Fn.useRef(0),u=Fn.useRef(!0),f=Fn.useRef(null),p=Fn.useRef(null),d=z(()=>{u.current||(u.current=!0,i(S=>!S))}),m=z((S,w)=>{c.set(S,w),d()}),g=z(S=>{c.delete(S),d()}),h=z(S=>{let w=new Map;return n.current.length=0,o&&(o.current.length=0),S.forEach(C=>{w.set(C.element,{...C.registration.metadata??{},index:C.index}),n.current[C.index]=C.element,o&&(o.current[C.index]=C.registration.label!==void 0?C.registration.label:C.registration.textRef?.current?.textContent??C.element.textContent)}),l.current=n.current.length,w});function v(S){if(p.current?.disconnect(),p.current=null,typeof MutationObserver!="function"||S.length<2)return;let w=new MutationObserver(_=>{if(!jS(_))return;let T=null;for(let O of S)if(O.isConnected){if(T&&$p(T,O)>0){w.disconnect(),d();return}T=O}});p.current=w;let C=new Set;for(let _=1;_<S.length;_+=1){let T=$S(S[_-1],S[_]);T&&C.add(T)}C.forEach(_=>w.observe(_,{childList:!0}))}let y=z(()=>{let[S,w]=WS(c),C=h(S),_=f.current,T=!_||_.length!==S.length||S.some((O,P)=>{let L=_[P];return O.index!==L.index||O.element!==L.element||O.registration.index!==L.registration.index||O.registration.metadata!==L.registration.metadata});v(w),f.current=S,u.current=!1,T&&(a.forEach(O=>O(C)),s(C))});B(()=>(!u.current&&f.current&&h(f.current),()=>{n.current=[],o&&(o.current=[])}),[n,o,h]),B(()=>{u.current&&y()}),B(()=>()=>{p.current?.disconnect(),u.current=!0},[]);let R=z(S=>(a.add(S),()=>{a.delete(S)})),x=Fn.useMemo(()=>({register:m,unregister:g,subscribeMapChange:R,nextIndexRef:l}),[m,g,R,l]);return(0,Wp.jsx)(pl.Provider,{value:x,children:t})}function US(){return new Map}function BS(){return new Set}function WS(e){let t=new Set,n=[],o=[];e.forEach((s,i)=>{if(!i.isConnected)return;let a=s.index,c={index:a??-1,element:i,registration:s};a===null?o.push(c):a>=0&&(t.add(a),n.push(c))});let r=0;return o.sort((s,i)=>$p(s.element,i.element)),o.forEach(s=>{for(;t.has(r);)r+=1;s.index=r,n.push(s),r+=1}),t.size>0&&n.sort((s,i)=>s.index-i.index),[n,o.map(s=>s.element)]}function $S(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function jS(e){for(let t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function $p(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Yt=b(H(),1);var Ni=b(H(),1),zS=Ni.createContext(void 0);function Pn(){return Ni.useContext(zS)?.direction??"ltr"}var qS=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:f="real"}=En(e,t)||{};if(l==null)return{};let p=Js(u),d={x:n,y:o},m=zr(r),g=jr(m),h=await i.getDimensions(l),v=m==="y",y=v?"top":"left",R=v?"bottom":"right",x=v?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[m]-d[m]-s.floating[g],w=d[m]-s.reference[m],C=f==="real"?await i.getOffsetParent?.(l):a.floating,_=a.floating[x]||s.floating[g];(!_||!await i.isElement?.(C))&&(_=a.floating[x]||s.floating[g]);let T=S/2-w/2,O=_/2-h[g]/2-1,P=Math.min(p[y],O),L=Math.min(p[R],O),E=P,M=_-h[g]-L,I=_/2-h[g]/2+T,A=Gs(E,I,M),D=!c.arrow&&rn(r)!=null&&I!==A&&s.reference[g]/2-(I<E?P:L)-h[g]/2<0,N=D?I<E?I-E:I-M:0;return{[m]:d[m]+N,data:{[m]:A,centerOffset:I-A-N,...D&&{alignmentOffset:N}},reset:D}}}),jp=(e,t)=>{let{name:n,fn:o}=qS(e);return{name:n,fn:o,options:[e,t]}};var zp={name:"hide",async fn(e){let{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0,i=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:i.top-n>=0||i.right-t>=0||i.bottom-n>=0||i.left-t>=0||s}}}};var pr={sideX:"left",sideY:"top"};var qp="--available-width",Kp="--available-height",Gp="--anchor-width",Yp="--anchor-height",Jp="--transform-origin";var Xp=qp,Zp=Kp;function tm(e,t,n){let o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Qp(e,t,n){let{rects:o,placement:r}=e;return{side:tm(t,Ct(r),n),align:rn(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function nm(e){return ml(e,Zd)}function ml(e,t){let{anchor:n,positionMethod:o="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:d,keepMounted:m=!1,floatingRootContext:g,mounted:h,collisionAvoidance:v,shift:y,nodeId:R,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:w}=e,[C,_]=Yt.useState(null);!h&&C!==null&&_(null);let T=v.side||"flip",O=v.align||"flip",P=v.fallbackAxisSide||"end",L=y?.crossAxis??!1,E=y?.rootBoundary,M=typeof n=="function"?n:void 0,I=z(M),A=M?I:n,D=Ue(n),N=Ue(h),k=Pn()==="rtl",j=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":k?"left":"right","inline-start":k?"right":"left"}[r],U=i==="center"?j:`${j}-${i}`,$=l;typeof $=="number"?$={top:$,right:$,bottom:$,left:$}:$&&($={top:$.top||0,right:$.right||0,bottom:$.bottom||0,left:$.left||0});let V=1,X=r==="bottom"?V:0,Y=r==="top"?V:0,ge=r==="right"?V:0,Z=r==="left"?V:0,fe={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:$},ee=Yt.useRef(null),ce=Ue(s),q=Ue(a),le=typeof s!="function"?s:0,de=typeof a!="function"?a:0,he=[];d&&he.push(d),he.push(Hc(ye=>{let Je=Qp(ye,r,k),rt=typeof ce.current=="function"?ce.current(Je):ce.current,dt=typeof q.current=="function"?q.current(Je):q.current;return{mainAxis:rt,crossAxis:dt,alignmentAxis:dt}},[le,de,k,r]));let De=O==="none"&&T!=="shift",re=!De&&(u||L||T==="shift"),Re=T==="none"?null:Wc({...fe,padding:{top:$.top+V+X,right:$.right+V+Z,bottom:$.bottom+V+Y,left:$.left+V+ge},mainAxis:!L&&T==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),se=De?null:Uc({...fe,rootBoundary:E,mainAxis:O!=="none",crossAxis:re,limiter:u||L?void 0:Bc(ye=>{if(!ee.current)return{};let{width:Je,height:rt}=ee.current.getBoundingClientRect(),dt=Ft(Ct(ye.placement)),Wt=dt==="y"?Je:rt,st=dt==="y"?$.left+$.right:$.top+$.bottom;return{offset:Wt/2+st/2}})},[fe,u,L,E,$,O]);T==="shift"||O==="shift"||i==="center"?he.push(se,Re):he.push(Re,se),he.push($c({...fe,apply({elements:{floating:ye},availableWidth:Je,availableHeight:rt,rects:dt}){if(!N.current)return;let Wt=ye.style;Wt.setProperty(Xp,`${Je}px`),Wt.setProperty(Zp,`${rt}px`);let st=Oe(ye).devicePixelRatio||1,{x:J,y:pe,width:we,height:Ee}=dt.reference,Se=(Math.round((J+we)*st)-Math.round(J*st))/st,Fe=(Math.round((pe+Ee)*st)-Math.round(pe*st))/st;Wt.setProperty(Gp,`${Se}px`),Wt.setProperty(Yp,`${Fe}px`)}}),jp(ye=>({element:ee.current||ve(ye.elements.floating).createElement("div"),padding:ee.current?f:0,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(ye){let{elements:{floating:Je},middlewareData:rt,placement:dt,platform:Wt,rects:st,y:J}=ye,pe=Ct(dt),we=rn(dt),Ee=Ft(pe)==="y",Se=ee.current,Fe=typeof s=="function"?s(Qp(ye,r,k)):s,Ot;if(!Se&&we&&Math.abs(Ee?rt.shift?.x||0:rt.shift?.y||0)<=1)Ot=we==="start"===(Ee&&Wt.isRTL?.(Je)===!0)?"100%":"0%";else{let So=Ee?rt.arrow?.x||0:rt.arrow?.y||0,Cr=Ee?Se?.clientWidth||0:Se?.clientHeight||0;Ot=`${So+Cr/2}px`}let $t=pe==="top"||pe==="left"?`calc(100% + ${Fe}px)`:`${-Fe}px`;return re&&Ee&&Math.abs(rt.shift?.y||0)>Fe&&($t=`${st.reference.y+st.reference.height/2-J}px`),Je.style.setProperty(Jp,Ee?`${Ot} ${$t}`:`${$t} ${Ot}`),{}}},zp,x),B(()=>{!h&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,g]);let Ce=Yt.useMemo(()=>({ancestorScroll:!p,elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:be,elements:_e,x:We,y:G,middlewareData:te,update:K,placement:F,context:ue,isPositioned:Me,floatingStyles:Ke}=t({rootContext:g,open:m?h:void 0,placement:U,middleware:he,strategy:o,whileElementsMounted:m?void 0:(...ye)=>Qr(...ye,Ce),nodeId:R,externalTree:w}),{sideX:$e,sideY:Ze}=te.adaptiveOrigin||pr,Qe=Me?o:"fixed",It=Yt.useMemo(()=>{let ye;return Me?x?ye={position:Qe,[$e]:We,[Ze]:G}:ye={...Ke,position:Qe}:ye={position:Qe,top:0,left:0},ye[Xp]="100vw",ye[Zp]="100vh",Me||(ye.opacity=0),ye},[x,Qe,$e,We,Ze,G,Ke,Me]),vt=Yt.useRef(null);B(()=>{if(!h)return;let ye=D.current,Je=typeof ye=="function"?ye():ye,dt=(em(Je)?Je.current:Je)||null||null;dt!==vt.current&&(be.setPositionReference(dt),vt.current=dt)},[h,be,A,D]),Yt.useEffect(()=>{if(!h)return;let ye=D.current;typeof ye!="function"&&em(ye)&&ye.current!==vt.current&&(be.setPositionReference(ye.current),vt.current=ye.current)},[h,be,A,D]),Yt.useEffect(()=>{if(m&&h&&_e.reference&&_e.floating)return Qr(_e.reference,_e.floating,K,Ce)},[m,h,_e,K,Ce]);let xt=Ct(F),Dt=tm(r,xt,k),Xt=rn(F)||"center",dn=!!te.hide?.referenceHidden;B(()=>{S&&h&&Me&&xt!==j&&_(xt)},[S,h,Me,xt,j]);let wt=Yt.useMemo(()=>({position:"absolute",top:te.arrow?.y,left:te.arrow?.x}),[te.arrow]),ft=te.arrow?.centerOffset!==0;return Yt.useMemo(()=>({positionerStyles:It,arrowStyles:wt,arrowRef:ee,arrowUncentered:ft,side:Dt,align:Xt,physicalSide:xt,anchorHidden:dn,refs:be,context:ue,isPositioned:Me,update:K}),[It,wt,ee,ft,Dt,Xt,xt,dn,be,ue,Me,K])}function em(e){return e!=null&&"current"in e}var Mi=b(H(),1),gl=Mi.createContext(void 0);function ao(){let e=Mi.useContext(gl);if(!e)throw new Error(Ae(59));return e}var om=b(H(),1),rm=b(ie(),1),ki=om.forwardRef(function(t,n){let{cutout:o,...r}=t,s;if(o){let i=o.getBoundingClientRect();s=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return(0,rm.jsx)("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});function mr(e,t){e&&Object.assign(e.style,t)}var Ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function co(e){return e==="starting"?Jf:Ne}function Di(e,t,{styles:n,transitionStatus:o,props:r,refs:s,hidden:i,inert:a=!1}){let c={...n};return a&&(c.pointerEvents="none"),oe("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:c},co(o),r],stateAttributesMapping:qt})}var lm=b(H(),1);var sm={},im={},am="";function Li(e,t){return wo(e)?e:t}function cm(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Li(t,n)).overflowY)}function GS(e){if(typeof document>"u")return!1;let t=ve(e);return Oe(t).innerWidth-t.documentElement.clientWidth>0}function YS(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;let n=ve(e),o=n.documentElement,r=n.body,s=Li(o,r),i=s.style.overflowY,a=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",s.style.overflowY="scroll";let c=s.offsetWidth;s.style.overflowY="hidden";let l=s.offsetWidth;return s.style.overflowY=i,o.style.scrollbarGutter=a,c===l}function JS(e){let t=ve(e),n=t.documentElement,o=t.body,r=Li(n,o),s={overflowY:r.style.overflowY,overflowX:r.style.overflowX};return Object.assign(r.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(r.style,s)}}function XS(e){let t=ve(e),n=t.documentElement,o=t.body,r=Oe(n),s=0,i=0,a=!1,c=tn.create();if(Ge.engine.webkit&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){let d=r.getComputedStyle(n),m=r.getComputedStyle(o),v=(d.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,sm={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},am=n.style.scrollBehavior,im={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};let y=n.scrollHeight>n.clientHeight,R=n.scrollWidth>n.clientWidth,x=d.overflowY==="scroll"||m.overflowY==="scroll",S=d.overflowX==="scroll"||m.overflowX==="scroll",w=Math.max(0,r.innerWidth-o.clientWidth),C=Math.max(0,r.innerHeight-o.clientHeight),_=parseFloat(m.marginTop)+parseFloat(m.marginBottom),T=parseFloat(m.marginLeft)+parseFloat(m.marginRight),O=Li(n,o);if(a=YS(e),a){n.style.scrollbarGutter=v,O.style.overflowY="hidden",O.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(y||x)&&(n.style.overflowY="scroll"),(R||S)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:_||C?`calc(100dvh - ${_+C}px)`:"100dvh",width:T||w?`calc(100vw - ${T+w}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,sm),Object.assign(o.style,im),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=am)}function f(){u(),c.request(l)}l();let p=xe(r,"resize",f);return()=>{c.cancel(),u(),typeof r.removeEventListener=="function"&&p()}}var hl=class{lockCount=0;restore=null;timeoutLock=Lt.create();timeoutUnlock=Lt.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;let n=ve(t),o=n.documentElement,r=n.body,s=Oe(o);if(cm(s,o,r)){let a=new s.MutationObserver(()=>{cm(s,o,r)||(a.disconnect(),this.restore=null,this.lock(t))}),c={attributes:!0};a.observe(o,c),a.observe(r,c),this.restore=()=>a.disconnect();return}let i=Ge.os.ios||!GS(t);this.restore=i?JS(t):XS(t)}},ZS=new hl;function Vi(e=!0,t=null){B(()=>{if(e)return ZS.acquire(t)},[e,t])}var QS=20;function um(e,t,n,o){let[r,s]=lm.useState(!1);B(()=>{if(!e||!t||n==null){s(!1);return}let i=ve(n).documentElement.clientWidth,a=n.offsetWidth;s(i>0&&a>0&&a>=i-QS)},[e,t,n]),Vi(e&&(!t||r),o)}var rs=b(ie(),1),eR={position:"fixed"},fm=ln.forwardRef(function(t,n){let{anchor:o,className:r,render:s,positionMethod:i,side:a,align:c,sideOffset:l,alignOffset:u,collisionBoundary:f="clipping-ancestors",collisionPadding:p,arrowPadding:d,sticky:m,disableAnchorTracking:g,alignItemWithTrigger:h=!0,collisionAvoidance:v=ni,style:y,...R}=t,x=je(),S=Si(),w=x.useState("open"),C=x.useState("mounted"),_=x.useState("modal"),T=x.useState("value"),O=x.useState("openMethod"),P=x.useState("positionerElement"),L=x.useState("triggerElement"),E=x.useState("isItemEqualToValue"),M=x.useState("transitionStatus"),I=ln.useRef(null),A=ln.useRef(null),[D,N]=ln.useState(h),W=C&&D&&O!=="touch";!C&&D!==h&&N(h),ln.useImperativeHandle(x.context.alignItemWithTriggerActiveRef,()=>W),um((W||_)&&w,O==="touch",P,L);let k=nm({anchor:o,floatingRootContext:S,positionMethod:i,mounted:C,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,disableAnchorTracking:g??W,collisionAvoidance:v,keepMounted:!0}),j=W?"none":k.side,U=W?eR:k.positionerStyles,$={open:w,side:j,align:k.align,anchorHidden:k.anchorHidden};B(()=>{x.set("popupSide",k.side)},[x,k.side]);let V=x.useStateSetter("positionerElement"),X=Di(t,$,{styles:U,transitionStatus:M,props:R,refs:[n,V],hidden:!C,inert:!w}),Y=ln.useRef(0),ge=z(fe=>{if(x.context.valuesRef.current.length===0)return;let ee=Y.current;Y.current=fe.size;let ce=me(ne.none);if(ee!==0&&!x.state.multiple&&T!==null&&ts(x.context.valuesRef.current,T,E)===-1){let le=x.context.initialValueRef.current,he=le!=null&&ts(x.context.valuesRef.current,le,E)!==-1?le:null;x.context.setValue(he,ce),he===null&&(x.set("selectedIndex",null),x.context.selectedItemTextRef.current=null)}if(ee!==0&&x.state.multiple&&Array.isArray(T)){let q=T.filter(le=>ts(x.context.valuesRef.current,le,E)!==-1);q.length!==T.length&&(x.context.setValue(q,ce),q.length===0&&(x.set("selectedIndex",null),x.context.selectedItemTextRef.current=null))}if(w&&W){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let q={height:""};mr(P,q),mr(x.context.popupRef.current,q)}}),Z=ln.useMemo(()=>({...k,side:j,alignItemWithTriggerActive:W,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:I,scrollDownArrowRef:A}),[k,j,W,N]);return(0,rs.jsx)(Oi,{elementsRef:x.context.listRef,labelsRef:x.context.labelsRef,onMapChange:ge,children:(0,rs.jsxs)(gl.Provider,{value:Z,children:[C&&_&&(0,rs.jsx)(ki,{inert:io(!w),cutout:L}),X]})})});var un=b(H(),1);var dm=b(ie(),1),Fi="base-ui-disable-scrollbar",ss={className:Fi,getElement(e){return(0,dm.jsx)("style",{nonce:e,href:Fi,precedence:"base-ui:low",children:`.${Fi}{scrollbar-width:none}.${Fi}::-webkit-scrollbar{display:none}`})}};var Hi=b(H(),1),tR=Hi.createContext(void 0);function pm(e){let t=Hi.useContext(tR);if(t===void 0&&!e)throw new Error(Ae(69));return t}var Bi="ArrowUp",Wi="ArrowDown",$i="ArrowLeft",ji="ArrowRight",zi="Home",qi="End";var gr=new Set([Bi,Wi,$i,ji,zi,qi]),nR="Shift",gm=[nR,"Control","Alt","Meta"];function oR(e){return Te(e)&&e.tagName==="INPUT"}function vl(e){return!!(oR(e)&&e.selectionStart!=null||Te(e)&&e.tagName==="TEXTAREA")}function xl(e,t,n,o){if(!e||!t||!t.scrollTo)return;let r=e.scrollLeft,s=e.scrollTop,i=e.clientWidth<e.scrollWidth,a=e.clientHeight<e.scrollHeight;if(i&&o!=="vertical"){let c=mm(e,t,"left"),l=Ui(e),u=Ui(t);n==="ltr"&&(c+t.offsetWidth+u.scrollMarginRight>e.scrollLeft+e.clientWidth-l.scrollPaddingRight?r=c+t.offsetWidth+u.scrollMarginRight-e.clientWidth+l.scrollPaddingRight:c-u.scrollMarginLeft<e.scrollLeft+l.scrollPaddingLeft&&(r=c-u.scrollMarginLeft-l.scrollPaddingLeft)),n==="rtl"&&(c-u.scrollMarginLeft<e.scrollLeft+l.scrollPaddingLeft?r=c-u.scrollMarginLeft-l.scrollPaddingLeft:c+t.offsetWidth+u.scrollMarginRight>e.scrollLeft+e.clientWidth-l.scrollPaddingRight&&(r=c+t.offsetWidth+u.scrollMarginRight-e.clientWidth+l.scrollPaddingRight))}if(a&&o!=="horizontal"){let c=mm(e,t,"top"),l=Ui(e),u=Ui(t);c-u.scrollMarginTop<e.scrollTop+l.scrollPaddingTop?s=c-u.scrollMarginTop-l.scrollPaddingTop:c+t.offsetHeight+u.scrollMarginBottom>e.scrollTop+e.clientHeight-l.scrollPaddingBottom&&(s=c+t.offsetHeight+u.scrollMarginBottom-e.clientHeight+l.scrollPaddingBottom)}e.scrollTo({left:r,top:s,behavior:"auto"})}function mm(e,t,n){let o=n==="left"?"offsetLeft":"offsetTop",r=0;for(;t.offsetParent&&(r+=t[o],t.offsetParent!==e);)t=t.offsetParent;return r}function Ui(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var Ki=b(H(),1),rR=Ki.createContext(void 0),sR={disableStyleElements:!1};function hm(){return Ki.useContext(rR)??sR}var yl="--transform-origin";var Ji=b(ie(),1),aR={...qt,...Vt},Sm=un.forwardRef(function(t,n){let{render:o,className:r,style:s,finalFocus:i,...a}=t,c=je(),{multiple:l,readOnly:u,highlightItemOnHover:f}=oo(),p=Si(),{side:d,align:m,alignItemWithTriggerActive:g,isPositioned:h,setControlledAlignItemWithTrigger:v}=ao(),y=pm(!0)!=null,R=Pn(),{nonce:x,disableStyleElements:S}=hm(),w=c.useState("id"),C=c.useState("open"),_=c.useState("openMethod"),T=c.useState("mounted"),O=c.useState("popupProps"),P=c.useState("transitionStatus"),L=c.useState("triggerElement"),E=c.useState("positionerElement"),M=c.useState("listElement"),I=un.useRef(!1),A=un.useRef(!1),D=un.useRef({}),N=Nt(),W=z($=>{if(!E||!c.context.popupRef.current||!A.current)return;let V=E.style.top==="0px",X=E.style.bottom==="0px";if(I.current||!g||!V&&!X){c.context.handleScrollArrowVisibility($);return}let Y=xm(E),ge=is(E.getBoundingClientRect().height,"y",Y),Z=ve(E),fe=Oe(E),ee=fe.getComputedStyle(E),ce=parseFloat(ee.marginTop),q=parseFloat(ee.marginBottom),le=vm(fe.getComputedStyle(c.context.popupRef.current)),de=Math.min(Z.documentElement.clientHeight-ce-q,le),he=$.scrollTop,De=Gi($),re=null,Re=_e=>{E.style.height=`${_e}px`},se=V?De-he:he,Ce=Math.min(ge+se,de);if(se<=Gt){let _e=Uo(se,0,de-ge);_e>0&&Re(ge+_e),$.scrollTop=V?De:0,de-(ge+_e)<=Gt&&(I.current=!0),c.context.handleScrollArrowVisibility($);return}if(de-Ce>Gt)re=V?1/0:0;else if(X&&he<De){let _e=ge+se-de;re=he-(se-_e)}let be=Math.ceil(Ce);if(be!==0&&Re(be),re!=null){let _e=Uo(re,0,Gi($));Math.abs($.scrollTop-_e)>Gt&&($.scrollTop=_e)}be>=de-Gt&&(I.current=!0),c.context.handleScrollArrowVisibility($)});un.useImperativeHandle(c.context.scrollHandlerRef,()=>W,[W]),St({open:C,ref:c.context.popupRef,onComplete(){C&&c.context.onOpenChangeComplete(!0)}});let k={open:C,transitionStatus:P,side:d,align:m};B(()=>{!E||!c.context.popupRef.current||Object.keys(D.current).length||(D.current={top:E.style.top||"0",left:E.style.left||"0",right:E.style.right,height:E.style.height,bottom:E.style.bottom,minHeight:E.style.minHeight,maxHeight:E.style.maxHeight,marginTop:E.style.marginTop,marginBottom:E.style.marginBottom})},[c,E]),B(()=>{C||g||(A.current=!1,I.current=!1,mr(E,D.current))},[C,g,E]),B(()=>{let $=c.context.popupRef.current;if(!C||!L||!E||!$||g&&!h||c.state.transitionStatus==="ending")return;if(A.current=!0,$.style.removeProperty(yl),!g){N.request(()=>c.context.handleScrollArrowVisibility(M||$));return}let V=cR($);try{let X=c.context.selectedItemTextRef.current;X?.isConnected||(X=!c.select("hasSelectedValue")&&c.context.firstItemTextRef.current?.isConnected?c.context.firstItemTextRef.current:null);let Y=c.context.valueRef.current,ge=Oe(E),Z=ge.getComputedStyle(E),fe=ge.getComputedStyle($),ee=ve(L),ce=xm(L),q=Yi(L.getBoundingClientRect(),ce),le=Yi(E.getBoundingClientRect(),ce),de=q.height,he=M||$,De=he.scrollHeight,re=parseFloat(fe.borderBottomWidth),Re=parseFloat(Z.marginTop)||10,se=parseFloat(Z.marginBottom)||10,Ce=parseFloat(Z.minHeight)||100,be=vm(fe),_e=5,We=5,G=20,te=ee.documentElement.clientHeight-Re-se,K=ee.documentElement.clientWidth,F=te-q.bottom+de,ue,Me=R==="rtl"?q.right-le.width:q.left,Ke=0;if(X&&Y){let ft=Yi(Y.getBoundingClientRect(),ce);ue=Yi(X.getBoundingClientRect(),ce),Me=le.left+(R==="rtl"?ft.right-ue.right:ft.left-ue.left);let ye=ft.top-q.top+ft.height/2;Ke=ue.top-le.top+ue.height/2-ye}let $e=F+Ke+se+re,Ze=Math.min(te,$e),Qe=te-Re-se,It=$e-Ze,vt=K-We;E.style.left=`${Uo(Me,_e,vt-le.width)}px`,E.style.height=`${Ze}px`,E.style.maxHeight="none",E.style.marginTop=`${Re}px`,E.style.marginBottom=`${se}px`,$.style.height="100%";let xt=Gi(he),Dt=It>=xt-Gt;Dt&&(Ze=Math.min(te,le.height)-(It-xt));let Xt=q.top<G||q.bottom>te-G||Math.ceil(Ze)+Gt<Math.min(De,Ce),dn=(ge.visualViewport?.scale??1)!==1&&Ge.engine.webkit;if(Xt||dn){mr(E,D.current),v(!1);return}let wt=Math.max(Ce,Ze);if(Dt){let ft=Math.max(0,te-$e);E.style.top=le.height>=Qe?"0":`${ft}px`,E.style.height=`${Ze}px`,he.scrollTop=Gi(he)}else E.style.bottom="0",he.scrollTop=It;if(ue){let ft=le.top,ye=le.height,Je=ue.top+ue.height/2,rt=Uo(ye>0?(Je-ft)/ye*100:50,0,100);$.style.setProperty(yl,`50% ${rt}%`)}(wt===te||Ze>=be)&&(I.current=!0),c.context.handleScrollArrowVisibility(he),f&&c.state.selectedIndex===null&&c.state.activeIndex===null&&c.context.listRef.current[0]!=null&&c.set("activeIndex",0)}finally{V()}},[c,C,E,L,g,v,N,M,f,R,h]),un.useEffect(()=>{if(!g||!E||!C)return;let $=Oe(E);function V(X){c.context.setOpen(!1,me(ne.windowResize,X))}return xe($,"resize",V)},[c,g,E,C]);let j={...M?{role:"presentation"}:{role:"listbox","aria-multiselectable":l||void 0,"aria-readonly":u||void 0,id:`${w}-list`},onKeyDown($){y&&gr.has($.key)&&$.stopPropagation()},onScroll($){M||W($.currentTarget)},...g&&{style:M?{height:"100%"}:Ai},className:!M&&g?ss.className:void 0},U=oe("div",t,{ref:[n,c.context.popupRef],state:k,stateAttributesMapping:aR,props:[O,j,co(P),a]});return(0,Ji.jsxs)(un.Fragment,{children:[!S&&ss.getElement(x),(0,Ji.jsx)(Jr,{context:p,modal:!1,disabled:!T,openInteractionType:_,returnFocus:i,restoreFocus:!0,children:U})]})});function vm(e){let t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Gi(e){return ur(e.scrollHeight,e.clientHeight)}function xm(e){return Zr.getScale(e)}function is(e,t,n){return e/n[t]}function Yi(e,t){return An({x:is(e.x,"x",t),y:is(e.y,"y",t),width:is(e.width,"x",t),height:is(e.height,"y",t)})}var ym=[["transform","none"],["scale","1"],["translate","0 0"]];function cR(e){let{style:t}=e,n={};for(let[o,r]of ym)n[o]=t.getPropertyValue(o),t.setProperty(o,r,"important");return()=>{for(let[o]of ym){let r=n[o];r?t.setProperty(o,r):t.removeProperty(o)}}}var Rm=b(H(),1);var wm=Rm.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=je(),{multiple:c,readOnly:l}=oo(),{alignItemWithTriggerActive:u}=ao(),f=a.useState("hasScrollArrows"),p=a.useState("openMethod"),m={id:`${a.useState("id")}-list`,role:"listbox","aria-multiselectable":c||void 0,"aria-readonly":l||void 0,onScroll(h){a.context.scrollHandlerRef.current?.(h.currentTarget)},...u&&{style:Ai},className:f&&p!=="touch"?ss.className:void 0},g=a.useStateSetter("listElement");return oe("div",t,{ref:[n,g],props:[m,i]})});var gn=b(H(),1);var Wo=b(H(),1);function Xi(e={}){let{guess:t,label:n,metadata:o,textRef:r,index:s}=e,{register:i,unregister:a,subscribeMapChange:c,nextIndexRef:l}=Bp(),u=Wo.useRef(-1),[f,p]=Wo.useState(s==null&&t?()=>{if(u.current===-1){let h=l.current;l.current+=1,u.current=h}return u.current}:-1),d=s??f,m=Wo.useRef(null),g=Wo.useCallback(h=>{let v=m.current;v&&a(v),m.current=h,h&&i(h,{metadata:o??null,index:s??null,label:n,textRef:r})},[s,i,a,o,n,r]);return B(()=>{if(s==null)return c(h=>{let v=m.current?h.get(m.current)?.index:null;v!=null&&p(v)})},[s,c]),{ref:g,index:d}}var Zi=b(H(),1),Sl=Zi.createContext(void 0);function as(){let e=Zi.useContext(Sl);if(!e)throw new Error(Ae(57));return e}var bm=b(ie(),1),Em=gn.memo(gn.forwardRef(function(t,n){let{render:o,className:r,style:s,value:i=null,label:a,disabled:c=!1,nativeButton:l=!1,...u}=t,f=gn.useRef(null),p=Xi({guess:!0,label:a,textRef:f}),d=je(),{itemProps:m,multiple:g,disabled:h,readOnly:v}=oo(),y=h||c,R=d.useState("isActive",p.index),x=d.useState("open"),S=d.useState("isSelected",i),w=d.useState("isSelectedByFocus",p.index),C=d.useState("isItemEqualToValue"),_=p.index,T=gn.useRef(null);B(()=>{let k=d.context.valuesRef.current;return k[_]=i,()=>{delete k[_]}},[_,i,d]),B(()=>{let k=d.state.value,j=d.state.selectedIndex,U=j,$;g&&Array.isArray(k)?(U=up(_,i,d.context.valuesRef.current,k,C,j),$=U===_,_===j&&!$&&(d.context.selectedItemTextRef.current=null)):($=k!==void 0&&Vn(i,k,C),$&&(U=_)),d.set("selectedIndex",U),$&&f.current&&(d.context.selectedItemTextRef.current=f.current)},[_,g,C,d,i]);let O=gn.useRef("mouse"),P=gn.useRef(!1),{getButtonProps:L,buttonRef:E}=zt({disabled:y,focusableWhenDisabled:!0,native:l,composite:!0}),M={disabled:y,selected:S,highlighted:R};function I(k){if(h||v)return;let j=d.state.value;if(g){let U=Array.isArray(j)?j:[],$=S?fp(U,i,C):[...U,i];d.context.setValue($,me(ne.itemPress,k))}else d.context.setValue(i,me(ne.itemPress,k)),d.context.setOpen(!1,me(ne.itemPress,k))}function A(){d.context.selectionRef.current.dragY=0}let D={role:"option","aria-selected":S,tabIndex:x&&R?0:-1,onKeyDown(k){d.set("activeIndex",_),k.key===" "&&d.context.typingRef.current&&k.preventDefault()},onClick(k){let j=O.current!=="touch",U=k.nativeEvent.pointerType,$=j&&qn(k.nativeEvent)&&(U!==void 0||R),V=j&&!$&&!P.current;P.current=!1,!(y||V)&&I(k.nativeEvent)},onPointerEnter(k){O.current=k.pointerType},onPointerMove(k){if(k.pointerType==="mouse"&&k.buttons===1){let j=d.context.selectionRef.current;j.dragY+=k.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(k){O.current=k.pointerType,P.current=!0,A()},onMouseUp(){if(A(),y||O.current==="touch"||P.current)return;let k=!d.context.selectionRef.current.allowSelectedMouseUp&&S,j=!d.context.selectionRef.current.allowUnselectedMouseUp&&!S;k||j||(P.current=!0,T.current?.click(),P.current=!1)}},N=oe("div",t,{ref:[E,n,p.ref,T],state:M,props:[m,D,u,L]}),W=gn.useMemo(()=>({selected:S,index:_,textRef:f,selectedByFocus:w}),[S,_,f,w]);return(0,bm.jsx)(Sl.Provider,{value:W,children:N})}));var $o=b(H(),1);var Cm=b(ie(),1),_m=$o.forwardRef(function(t,n){let{selected:o}=as();return t.keepMounted||o?(0,Cm.jsx)(lR,{...t,ref:n}):null}),lR=$o.memo($o.forwardRef((e,t)=>{let{render:n,className:o,style:r,keepMounted:s,...i}=e,{selected:a}=as(),c=$o.useRef(null),{transitionStatus:l,setMounted:u}=cn(a),p=oe("span",e,{ref:[t,c],state:{selected:a,transitionStatus:l},props:[{"aria-hidden":!0,children:"\u2714\uFE0F"},i],stateAttributesMapping:Vt});return St({batch:!0,enabled:!a,open:a,ref:c,onComplete(){a||u(!1)}}),p}));var hr=b(H(),1);var Pm=hr.memo(hr.forwardRef(function(t,n){let{index:o,textRef:r,selectedByFocus:s}=as(),i=je(),{render:a,className:c,style:l,...u}=t,f=hr.useCallback(d=>{d&&(o===0&&(i.context.firstItemTextRef.current=d),s&&(i.context.selectedItemTextRef.current=d))},[i,o,s]);return oe("div",t,{ref:[f,n,r],props:u})}));var Tm=b(H(),1);var Im=Tm.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=je(),{side:c,align:l,arrowRef:u,arrowStyles:f,arrowUncentered:p,alignItemWithTriggerActive:d}=ao(),g={open:a.useState("open"),side:c,align:l,uncentered:p},h=oe("div",t,{state:g,ref:[u,n],props:[{style:f,"aria-hidden":!0},i],stateAttributesMapping:Kn});return d?null:h});var Nm=b(H(),1);var Om=b(H(),1);var Qi=Om.forwardRef(function(t,n){let{render:o,className:r,style:s,direction:i,keepMounted:a,...c}=t,l=i==="up",u=je(),{side:f,scrollDownArrowRef:p,scrollUpArrowRef:d}=ao(),m=l?"scrollUpArrowVisible":"scrollDownArrowVisible",g=u.useState(m),h=u.useState("openMethod"),v=g&&h!=="touch",y=et(),R=l?d:p,{mounted:x,transitionStatus:S,setMounted:w}=cn(v);B(()=>(u.context.scrollArrowsMountedCountRef.current+=1,u.set("hasScrollArrows",!0),()=>{u.context.scrollArrowsMountedCountRef.current=Math.max(0,u.context.scrollArrowsMountedCountRef.current-1),u.context.scrollArrowsMountedCountRef.current===0&&u.set("hasScrollArrows",!1)}),[u]),St({open:v,ref:R,onComplete(){v||w(!1)}});let T=oe("div",t,{ref:[n,R],state:{direction:i,visible:v,side:f,transitionStatus:S},props:[{"aria-hidden":!0,children:l?"\u25B2":"\u25BC",style:{position:"absolute"},onMouseMove(P){if(P.movementX===0&&P.movementY===0||y.isStarted())return;u.set("activeIndex",null);function L(){let E=u.state.listElement??u.context.popupRef.current;if(!E)return;u.set("activeIndex",null),u.context.handleScrollArrowVisibility(E);let M=ur(E.scrollHeight,E.clientHeight),I=fr(E.scrollTop,M),A=I===(l?0:M),D=u.context.listRef.current;if(I!==E.scrollTop&&(E.scrollTop=I),A){y.clear();return}if(D.length>0){let N=R.current?.offsetHeight||0;E.scrollTop=uR(D,l,I,E.clientHeight,N,M)}y.start(40,L)}y.start(40,L)},onMouseLeave(){y.clear()}},c],stateAttributesMapping:Vt});return x||a?T:null});function uR(e,t,n,o,r,s){if(t){let u=0,f=n+r-Gt;for(let m=0;m<e.length;m+=1){let g=e[m];if(g&&g.offsetTop>=f){u=m;break}}let p=Math.max(0,u-1),d=e[p];return p<u&&d?fr(d.offsetTop-r,s):0}let i=e.length-1,a=n+o-r+Gt;for(let u=0;u<e.length;u+=1){let f=e[u];if(f&&f.offsetTop+f.offsetHeight>a){i=Math.max(0,u-1);break}}let c=Math.min(e.length-1,i+1),l=e[c];return c>i&&l?fr(l.offsetTop+l.offsetHeight-o+r,s):s}var Mm=b(ie(),1),km=Nm.forwardRef(function(t,n){return(0,Mm.jsx)(Qi,{...t,ref:n,direction:"down"})});var Am=b(H(),1);var Dm=b(ie(),1),Lm=Am.forwardRef(function(t,n){return(0,Dm.jsx)(Qi,{...t,ref:n,direction:"up"})});var vr=b(H(),1);var ea=b(H(),1),Rl=ea.createContext(void 0);function Vm(){let e=ea.useContext(Rl);if(e===void 0)throw new Error(Ae(56));return e}var Fm=b(ie(),1),Hm=vr.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,[a,c]=vr.useState(),l=vr.useMemo(()=>({labelId:a,setLabelId:c}),[a,c]),u=oe("div",t,{ref:n,props:[{role:"group","aria-labelledby":a},i]});return(0,Fm.jsx)(Rl.Provider,{value:l,children:u})});var Um=b(H(),1);var Bm=Um.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,{setLabelId:c}=Vm(),l=Tt(i);return B(()=>(c(l),()=>{c(f=>f===l?void 0:f)}),[l,c]),oe("div",t,{ref:n,props:[{id:l,"aria-hidden":!0},a]})});var Wm=b(H(),1);var $m=Wm.forwardRef(function(t,n){let{className:o,render:r,orientation:s="horizontal",style:i,...a}=t;return oe("div",t,{state:{orientation:s},ref:n,props:[{role:"presentation"},a]})});var jm=$m;var zm=b(ie()),fR=ys("eg-icon",{variants:{size:{s:"eg-icon--size-s",m:"eg-icon--size-m",l:"eg-icon--size-l"}},defaultVariants:{size:"m"}});function lt({size:e,className:t,color:n,style:o,children:r,...s}){return(0,zm.jsx)("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",focusable:"false",className:fR({size:e,className:t}),style:n?{...o,color:n}:o,...s,children:r})}var wl=b(ie());function ta(e){return(0,wl.jsx)(lt,{...e,children:(0,wl.jsx)("path",{d:"M8 11L3 5.99999L3.7 5.29999L8 9.59999L12.3 5.29999L13 5.99999L8 11Z"})})}var At=b(ie());function qm(e){return(0,At.jsx)(fn.Root,{"data-slot":"select",...e})}function Km({className:e,placeholder:t,leadingIcon:n,renderValue:o,...r}){return(0,At.jsxs)(fn.Trigger,{"data-slot":"select-trigger",className:Zt("eg-select-trigger",e),...r,children:[n!=null&&(0,At.jsx)("span",{className:"eg-select-trigger__icon","aria-hidden":"true",children:n}),(0,At.jsx)(fn.Value,{className:"eg-select-value",placeholder:t,children:o}),(0,At.jsx)("span",{className:"eg-select-trigger__chevron","aria-hidden":"true",children:(0,At.jsx)(ta,{})})]})}function Gm({className:e,children:t,sideOffset:n=0,alignItemWithTrigger:o=!0,container:r,...s}){return(0,At.jsx)(fn.Portal,{...r!=null?{container:r}:{},children:(0,At.jsx)(fn.Positioner,{sideOffset:n,alignItemWithTrigger:o,children:(0,At.jsx)(fn.Popup,{"data-slot":"select-popup",className:Zt("eg-select-popup",e),...s,children:(0,At.jsx)(fn.List,{className:"eg-select-list",children:t})})})})}function Ym({className:e,children:t,leadingIcon:n,...o}){return(0,At.jsxs)(fn.Item,{"data-slot":"select-item",className:Zt("eg-select-item",e),...o,children:[n!=null&&(0,At.jsx)("span",{className:"eg-select-item__icon","aria-hidden":"true",children:n}),(0,At.jsx)(fn.ItemText,{className:"eg-select-item__text",children:t})]})}var Cg=b(H());var hn={};jt(hn,{Backdrop:()=>Xm,Close:()=>Qm,Description:()=>tg,Handle:()=>us,Popup:()=>ig,Portal:()=>cg,Root:()=>hg,Title:()=>Sg,Trigger:()=>wg,Viewport:()=>xg,createHandle:()=>bg});var Jm=b(H(),1);var na=b(H(),1),bl=na.createContext(void 0);function ht(e){let t=na.useContext(bl);if(!e&&t===void 0)throw new Error(Ae(27));return t}var Xm=Jm.forwardRef(function(t,n){let{render:o,className:r,style:s,forceRender:i=!1,...a}=t,c=ht(),l=c.useState("open"),u=c.useState("nested"),f=c.useState("mounted"),p=c.useState("transitionStatus");return oe("div",t,{state:{open:l,transitionStatus:p},ref:[c.context.backdropRef,n],stateAttributesMapping:Kn,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:i||!u})});var Zm=b(H(),1);var Qm=Zm.forwardRef(function(t,n){let{render:o,className:r,style:s,disabled:i=!1,nativeButton:a=!0,...c}=t,l=ht(),u=l.useState("open"),{getButtonProps:f,buttonRef:p}=zt({disabled:i,native:a}),d={disabled:i};function m(g){u&&l.setOpen(!1,me(ne.closePress,g.nativeEvent))}return oe("button",t,{state:d,ref:[n,p],props:[{onClick:m},c,f]})});var eg=b(H(),1);var tg=eg.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,c=ht(),l=Tt(i);return c.useSyncedValueWithCleanup("descriptionElementId",l),oe("p",t,{ref:n,props:[{id:l},a]})});var rg=b(H(),1);var oa=b(H(),1),El=oa.createContext(void 0);function ra(){let e=oa.useContext(El);if(e===void 0)throw new Error(Ae(26));return e}var ng="--nested-dialogs";var nk=nn.open,ok=nn.closed,rk=nn.startingStyle,sk=nn.endingStyle;var og="data-nested-dialog-open";var sa={...qt,...Vt,nestedDialogOpen(e){return e?{[og]:""}:null}};var sg=b(ie(),1),ig=rg.forwardRef(function(t,n){let{render:o,className:r,style:s,finalFocus:i,initialFocus:a,...c}=t,l=ht(),u=l.useState("descriptionElementId"),f=l.useState("disablePointerDismissal"),p=l.useState("floatingRootContext"),d=l.useState("popupProps"),m=l.useState("modal"),g=l.useState("mounted"),h=l.useState("nested"),v=l.useState("nestedOpenDialogCount"),y=l.useState("open"),R=l.useState("openMethod"),x=l.useState("titleElementId"),S=l.useState("transitionStatus"),w=l.useState("role"),C=p.useState("floatingId");ra(),St({open:y,ref:l.context.popupRef,onComplete(){y&&l.context.onOpenChangeComplete?.(!0)}});let _=a===void 0?Ld(l.context.popupRef):a,T=v>0,O=l.useStateSetter("popupElement"),L=oe("div",t,{state:{open:y,nested:h,transitionStatus:S,nestedDialogOpen:T},props:[d,{id:C,"aria-labelledby":x,"aria-describedby":u,role:w,...pi,hidden:!g,onKeyDown(E){gr.has(E.key)&&E.stopPropagation()},style:{[ng]:v}},c],ref:[n,l.context.popupRef,O],stateAttributesMapping:sa});return(0,sg.jsx)(Jr,{context:p,openInteractionType:R,disabled:!g,closeOnFocusOut:!f,initialFocus:_,returnFocus:i,modal:m!==!1,restoreFocus:"popup",children:L})});var ag=b(H(),1);var cs=b(ie(),1),cg=ag.forwardRef(function(t,n){let{keepMounted:o=!1,...r}=t,s=ht(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||o?(0,cs.jsx)(El.Provider,{value:o,children:(0,cs.jsxs)(Ao,{ref:n,...r,children:[i&&a===!0&&(0,cs.jsx)(ki,{ref:s.context.internalBackdropRef,inert:io(!c)}),t.children]})}):null});var mg=b(H(),1);var Cl=b(H(),1);function lg({store:e,parentContext:t,isDrawer:n}){let o=e.useState("open"),r=e.useState("disablePointerDismissal"),s=e.useState("modal"),i=e.useState("popupElement"),a=e.useState("floatingRootContext"),[c,l]=Cl.useState(0),[u,f]=Cl.useState(0),p=c===0,d=Lo(a,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(m){if(!e.context.outsidePressEnabledRef.current||"button"in m&&m.button!==0)return!1;if("touches"in m){if(m.type==="touchend"){if(m.changedTouches.length!==1||m.touches.length!==0)return!1}else if(m.touches.length!==1)return!1}let g=Ve(m);if(p&&!r){if(s){let h=e.context.internalBackdropRef.current,v=e.context.backdropRef.current;return h||v?h===g||v===g||Q(g,i)&&!g?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:p});return Vi(o&&s===!0,i),e.useContextCallback("onNestedDialogOpen",(m,g)=>{l(m),f(g)}),B(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(c+1,u+(n?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[n,o,c,u,t]),$d(e,{activeTriggerProps:d.reference,inactiveTriggerProps:d.trigger,popupProps:d.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var aa=b(H(),1);var ia=class extends wn{setState(t){}update(t){}set(t,n){}notifyAll(){}};var ug={...Gd,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},ca=class extends wn{constructor(t,n,o){let r=new Ln,s=dg(t,r,n,o);super(s,pg(r),ug)}setOpen=(t,n)=>{n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),!n.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(t,n),this.update(Hd(this.state,t,n.trigger)))}};function fg(){let e=new Ln;return new ia(Object.freeze(dg(void 0,e)),Object.freeze(pg(e)),ug)}function dg(e,t,n,o=!1){return{...qd(t,n,o),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function pg(e){return{popupRef:aa.createRef(),backdropRef:aa.createRef(),internalBackdropRef:aa.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}var ls=b(ie(),1);function gg(e,t){let{children:n,open:o,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:i,disablePointerDismissal:a=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:p=null}=t,d=e==="drawer",m=e==="alert-dialog",g=m?!0:c,h=m||a,v=m?"alertdialog":"dialog",y=ht(!0),R=y!=null,x={modal:g,disablePointerDismissal:h,nested:R,role:v},S=Vd((P,L)=>new ca({open:r,openProp:o,activeTriggerId:p,triggerIdProp:f,...x},P,L),!0);S.useControlledProp("openProp",o),S.useControlledProp("triggerIdProp",f),S.useSyncedValues(x),S.useContextCallback("onOpenChange",s),S.useContextCallback("onOpenChangeComplete",i);let w=S.useState("open"),C=S.useState("mounted"),_=S.useState("payload");jd(S,w),Bd(S);let{forceUnmount:T}=Wd(w,S);mg.useImperativeHandle(l,()=>({unmount:T,close:()=>S.setOpen(!1,me(ne.imperativeAction))}),[T,S]);let O=w||C;return(0,ls.jsxs)(bl.Provider,{value:S,children:[u&&(0,ls.jsx)(Fd,{handle:u,store:S}),O&&(0,ls.jsx)(lg,{store:S,parentContext:y?.context,isDrawer:d}),typeof n=="function"?n({payload:_}):n]})}var hg=nc(function(t){return gg("dialog",t)});var vg=b(H(),1);var xg=vg.forwardRef(function(t,n){let{render:o,className:r,style:s,children:i,...a}=t,c=ra(),l=ht(),u=l.useState("open"),f=l.useState("nested"),p=l.useState("transitionStatus"),d=l.useState("nestedOpenDialogCount"),m=l.useState("mounted"),g=l.useStateSetter("viewportElement"),h=d>0;return oe("div",t,{enabled:c||m,state:{open:u,nested:f,transitionStatus:p,nestedDialogOpen:h},ref:[n,g],stateAttributesMapping:sa,props:[{role:"presentation",hidden:!m,style:{pointerEvents:u?void 0:"none"},children:i},a]})});var yg=b(H(),1);var Sg=yg.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,c=ht(),l=Tt(i);return c.useSyncedValueWithCleanup("titleElementId",l),oe("h2",t,{ref:n,props:[{id:l},a]})});var Rg=b(H(),1);var wg=vf(function(t,n){let{render:o,className:r,style:s,disabled:i=!1,nativeButton:a=!0,id:c,payload:l,handle:u,...f}=t,p=ht(!0),m=Jd(u)??p;if(!m)throw new Error(Ae(79));let g=Tt(c),h=m.useState("floatingRootContext"),v=m.useState("isOpenedByTrigger",g),y=m.useState("triggerPopupId",g),R=Rg.useRef(null),{registerTrigger:x,isMountedByThisTrigger:S}=Ud(g,R,m,{payload:l}),{getButtonProps:w,buttonRef:C}=zt({disabled:i,native:a}),_=Do(h),T=dl(()=>m.select("open"),L=>{m.set("openMethod",L)}),O={disabled:i,open:v},P=m.useState("triggerProps",S);return oe("button",t,{state:O,ref:[C,n,x,R],props:[_.reference,P,T,{[ti]:"",id:g,"aria-haspopup":"dialog","aria-expanded":v,"aria-controls":y},f,w],stateAttributesMapping:nr})});var us=class extends ui{constructor(){super(fg(),"Dialog",!1)}open(t){this.openByTrigger(t)}openWithPayload(t){let n=this.attachedStore;n!==null&&(n.set("payload",t),n.setOpen(!0,me(ne.imperativeAction)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function bg(){return new us}var _l=b(ie());function Eg(e){return(0,_l.jsx)(lt,{...e,children:(0,_l.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14ZM8.5 4H7.5V9.5H8.5V4ZM7.58332 11.1264C7.70666 11.044 7.85166 11 8 11C8.19891 11 8.38968 11.079 8.53033 11.2197C8.67098 11.3603 8.75 11.5511 8.75 11.75C8.75 11.8983 8.70601 12.0433 8.6236 12.1667C8.54119 12.29 8.42406 12.3861 8.28701 12.4429C8.14997 12.4997 7.99917 12.5145 7.85368 12.4856C7.7082 12.4566 7.57456 12.3852 7.46967 12.2803C7.36478 12.1754 7.29335 12.0418 7.26441 11.8963C7.23547 11.7508 7.25033 11.6 7.30709 11.463C7.36386 11.3259 7.45999 11.2088 7.58332 11.1264Z"})})}var at=b(ie());function mR(e){if(typeof e=="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function _g({open:e,onClose:t,title:n,message:o,reference:r,details:s,closeLabel:i="Schliessen",detailsLabel:a="Details"}){let c=s?Object.entries(s):[];return(0,at.jsx)(hn.Root,{open:e,onOpenChange:l=>{l||t()},children:(0,at.jsxs)(hn.Portal,{children:[(0,at.jsx)(hn.Backdrop,{"data-slot":"error-dialog-backdrop",className:"eg-error-dialog__backdrop"}),(0,at.jsx)(hn.Viewport,{className:"eg-error-dialog__viewport",children:(0,at.jsxs)(hn.Popup,{"data-slot":"error-dialog",className:"eg-error-dialog",role:"alertdialog",children:[(0,at.jsxs)("div",{className:"eg-error-dialog__header",children:[(0,at.jsx)(Eg,{className:"eg-error-dialog__icon"}),(0,at.jsx)(hn.Title,{"data-slot":"error-dialog-title",className:"eg-error-dialog__title",children:n})]}),(0,at.jsx)(hn.Description,{"data-slot":"error-dialog-message",className:"eg-error-dialog__message",children:o}),r&&(0,at.jsx)("p",{"data-slot":"error-dialog-reference",className:"eg-error-dialog__reference",children:r}),c.length>0&&(0,at.jsxs)("details",{"data-slot":"error-dialog-details",className:"eg-error-dialog__details",children:[(0,at.jsx)("summary",{"data-slot":"error-dialog-details-toggle",className:"eg-error-dialog__details-summary",children:a}),(0,at.jsx)("dl",{className:"eg-error-dialog__details-list",children:c.map(([l,u])=>(0,at.jsxs)(Cg.Fragment,{children:[(0,at.jsx)("dt",{className:"eg-error-dialog__details-key",children:l}),(0,at.jsx)("dd",{className:"eg-error-dialog__details-value",children:mR(u)})]},l))})]}),(0,at.jsx)("div",{className:"eg-error-dialog__footer",children:(0,at.jsx)(hn.Close,{render:(0,at.jsx)(Ms,{variant:"secondary",size:"m","data-slot":"error-dialog-close",children:i})})})]})})]})})}var Ut={};jt(Ut,{Arrow:()=>rh,Backdrop:()=>eh,Content:()=>Fg,Icon:()=>lh,Item:()=>Ag,Link:()=>ah,List:()=>Mg,Popup:()=>nh,Portal:()=>zg,Positioner:()=>Jg,Root:()=>Tg,Trigger:()=>Wg,Viewport:()=>Zg});var qe=b(H(),1);var xr=b(H(),1),Pl=xr.createContext(void 0);function ze(e){let t=xr.useContext(Pl);if(t===void 0&&!e)throw new Error(Ae(41));return t}var Tl=xr.createContext(void 0);function Tn(){return xr.useContext(Tl)}var lo="--positioner-width",uo="--positioner-height";var fo="--popup-width",po="--popup-height";function yr(e,t,n,o){e.style.setProperty(fo,`${n}px`),e.style.setProperty(po,`${o}px`),t.style.setProperty(lo,`${n}px`),t.style.setProperty(uo,`${o}px`)}var Sr=b(ie(),1),gR=new Set([ne.triggerHover,ne.outsidePress,ne.focusOut]);function hR(e){let t=parseFloat(e.style.getPropertyValue(lo))||0,n=parseFloat(e.style.getPropertyValue(uo))||0;return t<=0||n<=0?null:{width:t,height:n}}var Tg=qe.forwardRef(function(t,n){let{defaultValue:o=null,value:r,onValueChange:s,actionsRef:i,delay:a=50,closeDelay:c=50,orientation:l="horizontal",onOpenChangeComplete:u}=t,f=Kt()!=null,p=ze(!0),[d,m]=Mr({controlled:r,default:o,name:"NavigationMenu",state:"value"}),g=d!=null,h=qe.useRef(void 0),v=qe.useRef(null),[y,R]=qe.useState(null),[x,S]=qe.useState(null),[w,C]=qe.useState(null),[_,T]=qe.useState(null),[O,P]=qe.useState(null),[L,E]=qe.useState(void 0),[M,I]=qe.useState(!1),A=qe.useRef(null),D=qe.useRef(null),N=qe.useRef(null),W=qe.useRef(null),k=qe.useRef(null),j=qe.useRef(null),U=qe.useRef({abortController:null,owner:null}),{mounted:$,setMounted:V,transitionStatus:X}=cn(g);B(()=>{if(g||!y||!x)return;let ce=hR(y);ce&&yr(x,y,ce.width,ce.height)},[g,x,y]),qe.useEffect(()=>{I(!1)},[d]);let Y=z((ce,q)=>{ce==null&&(h.current=q.reason),ce!==d&&s?.(ce,q),!q.isCanceled&&(ce==null&&(P(null),E(void 0)),m(ce),f&&ce==null&&q.reason===ne.linkPress&&p&&p.setValue(null,q))}),ge=z(()=>{let ce=ve(v.current),q=mt(ce);!(h.current&&gR.has(h.current))&&Te(A.current)&&(q===ve(x).body||Q(x,q))&&x&&(A.current.focus({preventScroll:!0}),A.current=void 0),V(!1),u?.(!1),P(null),E(void 0),D.current=null,h.current=void 0});qe.useImperativeHandle(i,()=>({unmount:ge}),[ge]),St({enabled:!i,open:g,ref:{current:x},onComplete(){g||ge()}}),St({enabled:!i,open:g,ref:{current:_},onComplete(){g||ge()}});let Z=g?O:null,fe=qe.useMemo(()=>({open:g,value:d,setValue:Y,mounted:$,transitionStatus:X,positionerElement:y,setPositionerElement:R,popupElement:x,setPopupElement:S,viewportElement:w,setViewportElement:C,viewportTargetElement:_,setViewportTargetElement:T,activationDirection:Z,setActivationDirection:P,floatingRootContext:L,setFloatingRootContext:E,currentContentRef:D,nested:f,rootRef:v,beforeInsideRef:N,afterInsideRef:W,beforeOutsideRef:k,afterOutsideRef:j,prevTriggerElementRef:A,popupAutoSizeResetRef:U,delay:a,closeDelay:c,orientation:l,viewportInert:M,setViewportInert:I}),[g,d,Y,$,X,y,x,w,_,Z,L,f,a,c,l,M]),ee=(0,Sr.jsx)(Pl.Provider,{value:fe,children:(0,Sr.jsx)(vR,{componentProps:t,forwardedRef:n,children:t.children})});return f?ee:(0,Sr.jsx)(Ac,{children:ee})});function vR(e){let{className:t,render:n,defaultValue:o,value:r,onValueChange:s,actionsRef:i,delay:a,closeDelay:c,orientation:l,onOpenChangeComplete:u,style:f,...p}=e.componentProps,d=kc(),{rootRef:m,nested:g,open:h}=ze(),v={open:h,nested:g},y=oe(g?"div":"nav",e.componentProps,{state:v,ref:[e.forwardedRef,m],props:p});return(0,Sr.jsx)(Tl.Provider,{value:d,children:(0,Sr.jsx)(Gr,{id:d,children:y})})}var pa=b(H(),1);var Og=b(H(),1);var jo=b(H(),1);var Ol="data-composite-item-active";function Ig(e){let{loopFocus:t=!0,orientation:n="both",grid:o,onLoop:r,direction:s,highlightedIndex:i,onHighlightedIndexChange:a,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:f,modifierKeys:p=yt}=e,[d,m]=jo.useState(0),g=o!=null,h=jo.useRef(null),v=en(h,c),y=jo.useRef([]),R=jo.useRef(!1),x=jo.useRef(null),S=i??d,w=z((P,L=!1)=>{if(x.current=y.current[P]??null,(a??m)(P),L){let E=y.current[P];xl(h.current,E,s,n)}}),C=z(P=>{if(P.size===0)return;if(R.current){let I=y.current,A=I.indexOf(x.current);if(A===-1){let D=I[S];!D||Dn(I,S,f)?w(xR(I,f)):x.current=D}else A!==S&&w(A);return}R.current=!0;let L=Array.from(P.keys()),E=L.find(I=>I?.hasAttribute(Ol))??null,M=E?P.get(E)?.index??-1:-1;if(M!==-1)w(M);else if(Dn(L,S,f)){let I=sn(L,{disabledIndices:f});Jn(L,I)||w(I)}xl(h.current,E,s,n)});B(()=>{if(f==null||i!=null||!R.current)return;let P=y.current;if(Dn(P,S,f)){let L=sn(P,{disabledIndices:f});Jn(P,L)||w(L)}},[f,i,S,y,w]);let _=z((P,L,E)=>r?r(P,L,E,y):E),T=z(P=>{let L=P.key===zi||P.key===qi;if(!gr.has(P.key)||!l&&L||yR(P,p)||!h.current)return;let M=s==="rtl",I=M?$i:ji,A=M?ji:$i,D=n==="vertical"?Wi:I,N=n==="vertical"?Bi:A,W=Ve(P.nativeEvent);if(W!=null&&vl(W)&&!As(W)){let X=W.selectionStart,Y=W.selectionEnd,ge=W.value;if(X==null||P.shiftKey||X!==Y||P.key!==N&&X<ge.length||P.key!==D&&X>0)return}let k=S,j=Oo(y,f),U=or(y,f);o!=null&&(k=o({disabledIndices:f,elementsRef:y,event:P,highlightedIndex:S,loopFocus:t,maxIndex:U,minIndex:j,onLoop:_,orientation:n,rtl:M}));let $=n!=="vertical"&&P.key===I||n!=="horizontal"&&P.key===Wi,V=n!=="vertical"&&P.key===A||n!=="horizontal"&&P.key===Bi;l&&(P.key===zi?k=j:P.key===qi&&(k=U)),k===S&&($||V)&&(t&&k===U&&$?(k=j,r&&(k=r(P,S,k,y))):t&&k===j&&V?(k=U,r&&(k=r(P,S,k,y))):k=sn(y.current,{startingIndex:k,decrement:V,disabledIndices:f})),k!==S&&!Jn(y.current,k)&&(u&&P.stopPropagation(),(g||L||$||V)&&P.preventDefault(),w(k,!0),queueMicrotask(()=>{y.current[k]?.focus()}))});return{props:{ref:v,onFocus(P){let L=h.current,E=Ve(P.nativeEvent);!L||E==null||!vl(E)||E.setSelectionRange(0,E.value.length)},onKeyDown:T},highlightedIndex:S,onHighlightedIndexChange:w,elementsRef:y,onMapChange:C,relayKeyboardEvent:T}}function xR(e,t){let n=-1;for(let o=0;o<e.length;o+=1){let r=e[o];if(!(!r||Dn(e,o,t))){if(r.hasAttribute(Ol))return o;n===-1&&(n=o)}}return Math.max(n,0)}function yR(e,t){for(let n of gm)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var Nl=b(ie(),1);function fs(e){let{render:t,className:n,style:o,refs:r=yt,props:s=yt,state:i=Ne,stateAttributesMapping:a,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:f,loopFocus:p,onLoop:d,enableHomeAndEndKeys:m,onMapChange:g,stopEventPropagation:h=!0,rootRef:v,disabledIndices:y,modifierKeys:R,highlightItemOnHover:x=!1,tag:S="div",...w}=e,C=Pn(),{props:_,highlightedIndex:T,onHighlightedIndexChange:O,elementsRef:P,onMapChange:L,relayKeyboardEvent:E}=Ig({grid:f,loopFocus:p,onLoop:d,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:v,stopEventPropagation:h,enableHomeAndEndKeys:m,direction:C,disabledIndices:y,modifierKeys:R}),M=oe(S,e,{state:i,ref:r,props:[_,...s,w],stateAttributesMapping:a}),I=Og.useMemo(()=>({highlightedIndex:T,onHighlightedIndexChange:O,highlightItemOnHover:x,relayKeyboardEvent:E}),[T,O,x,E]);return(0,Nl.jsx)(Ga.Provider,{value:I,children:(0,Nl.jsx)(Oi,{elementsRef:P,onMapChange:A=>{g?.(A),L(A)},children:M})})}var la="data-base-ui-navigation-menu-trigger";var ua=b(H(),1),fa=ua.createContext(void 0);function Ng(){return ua.useContext(fa)}function Rr(){return new Cn({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Ln,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}var da=b(ie(),1),Mg=pa.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,a=Tn(),{orientation:c,open:l,floatingRootContext:u,positionerElement:f,value:p,closeDelay:d,viewportElement:m,nested:g}=ze(),h=pa.useMemo(()=>Rr(),[]),v=u||h,y=f!=null||p==null,R=f!=null||m!=null||p==null;Xc(v,{enabled:!!u&&R,closeDelay:d,nodeId:a});let x=Lo(v,{enabled:y,outsidePressEvent:"intentional",outsidePress(O){return Ve(O)?.closest(`[${la}]`)===null}}),S=u?x:void 0,w={open:l},C=g?Ne:{onKeyDown(O){(c==="horizontal"&&(O.key==="ArrowLeft"||O.key==="ArrowRight")||c==="vertical"&&(O.key==="ArrowUp"||O.key==="ArrowDown"))&&O.stopPropagation()}},_=[S?.floating||Ne,C,i],T=oe("ul",t,{state:w,ref:n,props:_,enabled:g});return g?(0,da.jsx)(fa.Provider,{value:S,children:T}):(0,da.jsx)(fa.Provider,{value:S,children:(0,da.jsx)(fs,{render:o,className:r,style:s,state:w,refs:[n],props:_,loopFocus:!1,orientation:c,tag:"ul"})})});var ga=b(H(),1);var ma=b(H(),1),Ml=ma.createContext(void 0);function wr(){let e=ma.useContext(Ml);if(!e)throw new Error(Ae(39));return e}var kg=b(ie(),1),Ag=ga.forwardRef(function(t,n){let{render:o,className:r,style:s,value:i,...a}=t,c=Tt(),l=i??c,u=oe("li",t,{ref:n,props:a}),f=ga.useMemo(()=>({value:l}),[l]);return(0,kg.jsx)(Ml.Provider,{value:f,children:u})});var zo=b(H(),1),Vg=b($n(),1);var VA=nn.open,FA=nn.closed,HA=nn.startingStyle,UA=nn.endingStyle,Dg="data-activation-direction";var ha=b(ie(),1),Lg={...qt,...Vt,activationDirection(e){return e?{[Dg]:e}:null}},Fg=zo.forwardRef(function(t,n){let{render:o,className:r,style:s,keepMounted:i=!1,...a}=t,{mounted:c,viewportElement:l,value:u,activationDirection:f,currentContentRef:p,viewportTargetElement:d}=ze(),{value:m}=wr(),g=Tn(),h=c&&u===m,v=zo.useRef(null),[y,R]=zo.useState(!1),[x,S]=zo.useState(!1),{mounted:w,setMounted:C,transitionStatus:_}=cn(h);w&&!c&&C(!1),St({ref:v,open:h,onComplete(){h||C(!1)}}),B(()=>{h&&v.current&&(p.current=v.current)},[h,p]);let T={open:h,transitionStatus:_,activationDirection:f},O=z(A=>{A&&h&&(p.current=A)}),P={onFocus(A){Ve(A.nativeEvent)?.hasAttribute("data-base-ui-focus-guard")||S(!0)},onBlur(A){Q(A.currentTarget,A.relatedTarget)||S(!1)}},L=!h&&w?{style:{position:"absolute",top:0,left:0},inert:io(!x),...P}:P,E=d||l,M=i&&!w,I=i&&!E&&!y;return i&&E&&!y&&R(!0),I?(0,ha.jsx)(fs,{render:o,className:r,style:s,state:T,refs:[n],props:[L,{hidden:!0},a],stateAttributesMapping:Lg}):!E||!w&&!i?null:Vg.createPortal((0,ha.jsx)(Gr,{id:g,children:(0,ha.jsx)(fs,{render:o,className:r,style:s,state:T,refs:[n,v,O],props:[L,M?{hidden:!0}:Ne,a],stateAttributesMapping:Lg})}),E)});var Xe=b(H(),1),ya=b($n(),1);function va({currentTarget:e,relatedTarget:t},n){let{popupElement:o,rootRef:r,tree:s,nodeId:i}=n,a=s?Ht(s.nodesRef.current,i).some(c=>Q(c.context?.elements.floating,t)):!1;return o?!Q(o,e)&&!Q(o,t)&&!Q(r.current,t)&&!a:!Q(r.current,t)&&!a}var Hg=b(H(),1);function Ug(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:o}=Os(),{ref:r,index:s}=Xi(e),i=n===s,a=Hg.useRef(null),c=en(r,a);return{compositeProps:{tabIndex:i?0:-1,onFocus(){o(s)},onMouseMove(){let u=a.current;if(!t||!u)return;let f=u.hasAttribute("disabled")||u.ariaDisabled==="true";!i&&!f&&u.focus()}},compositeRef:c,index:s}}function xa(e){let{render:t,className:n,style:o,state:r=Ne,props:s=yt,refs:i=yt,metadata:a,stateAttributesMapping:c,tag:l="div",...u}=e,{compositeProps:f,compositeRef:p}=Ug({metadata:a});return oe(l,e,{state:r,ref:[p,...i],props:[f,...s,u],stateAttributesMapping:c})}function br(e){let t=pt(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,r=Te(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o;return(Yn(n)!==s||Yn(o)!==i)&&(n=s,o=i),{width:n,height:o}}var mo=b(ie(),1),Bg={width:0,height:0},Wg=Xe.forwardRef(function(t,n){let{render:o,className:r,style:s,nativeButton:i=!0,disabled:a=!1,...c}=t,{value:l,setValue:u,mounted:f,open:p,positionerElement:d,setActivationDirection:m,setFloatingRootContext:g,popupElement:h,viewportElement:v,transitionStatus:y,rootRef:R,beforeOutsideRef:x,afterOutsideRef:S,afterInsideRef:w,beforeInsideRef:C,prevTriggerElementRef:_,popupAutoSizeResetRef:T,currentContentRef:O,delay:P,closeDelay:L,orientation:E,setViewportInert:M,nested:I}=ze(),{value:A}=wr(),D=Tn(),N=gt(),W=Ng(),k=Pn(),j=et(),U=Nt(),$=Nt(),V=Nt(),[X,Y]=Xe.useState(null),[ge,Z]=Xe.useState(!0),[fe,ee]=Xe.useState(""),ce=Xe.useRef(null),q=Xe.useRef(Bg),le=Xe.useRef(!1),de=p&&l===A,he=Ue(de),De=(d!=null||l==null)&&!a,re=d||v,Re=(re!=null||l==null)&&!a,se=di(h),Ce=Xe.useCallback(J=>{ce.current=J,Y(J)},[]),be=z((J=!1)=>{!J&&T.current.owner!==A||(T.current.abortController?.abort(),T.current.abortController=null,T.current.owner=null)});B(()=>{de||(U.cancel(),V.cancel(),be())},[de,U,V,be]);function _e(J){J.style.setProperty(fo,"auto"),J.style.setProperty(po,"auto")}function We(J,pe){J.style.removeProperty(fo),J.style.removeProperty(po),pe.style.removeProperty(lo),pe.style.removeProperty(uo)}function G(J){be(!0);let pe=new AbortController;T.current.abortController=pe,T.current.owner=A,se(()=>{T.current.abortController=null,T.current.owner=null,_e(J)},pe.signal)}let te=z((J,pe,we,Ee)=>{be(!0),We(J,pe);let{width:Se,height:Fe}=br(J),Ot=Se||q.current.width,$t=Fe||q.current.height;(Ee===0||we===0)&&(we=Ot,Ee=$t),J.style.setProperty(fo,`${we}px`),J.style.setProperty(po,`${Ee}px`),pe.style.setProperty(lo,`${Ot}px`),pe.style.setProperty(uo,`${$t}px`),V.request(()=>{he.current&&(J.style.setProperty(fo,`${Ot}px`),J.style.setProperty(po,`${$t}px`),G(J))})}),K=z((J,pe,we,Ee)=>{V.cancel(),U.cancel(),be(!0),!(we===0||Ee===0)&&(yr(J,pe,we,Ee),U.request(()=>{U.request(()=>{We(J,pe);let{width:Se,height:Fe}=br(J),Ot=Se||we,$t=Fe||Ee;yr(J,pe,we,Ee),V.request(()=>{he.current&&(yr(J,pe,Ot,$t),G(J))})})}))}),F=z((J,pe)=>{V.cancel(),be(!0),We(J,pe);let{width:we,height:Ee}=br(J);we===0||Ee===0||(q.current={width:we,height:Ee},_e(J),pe.style.setProperty(lo,`${we}px`),pe.style.setProperty(uo,`${Ee}px`))}),ue=z(J=>{let pe=J.style.getPropertyValue(fo),we=J.style.getPropertyValue(po);return pe!==""&&pe!=="auto"&&we!==""&&we!=="auto"?{size:{width:J.offsetWidth||q.current.width,height:J.offsetHeight||q.current.height},syncPositioner:!0}:{size:q.current,syncPositioner:!1}});Xe.useEffect(()=>{p||(j.clear(),U.cancel(),$.cancel(),V.cancel(),be(!0),le.current=!1,ee(""))},[j,p,U,$,V,be]),Xe.useEffect(()=>{f||(q.current=Bg)},[f]),B(()=>{if(!h||typeof ResizeObserver!="function")return;let J=new ResizeObserver(()=>{q.current={width:h.offsetWidth,height:h.offsetHeight}});return J.observe(h),()=>{J.disconnect()}},[h]),Xe.useEffect(()=>{if(!p||!de||!h||!d)return;let J=h,pe=d,we=Oe(pe);function Ee(){$.cancel(),$.request(()=>F(J,pe))}let Se=xe(we,"resize",Ee);return()=>{$.cancel(),Se()}},[p,de,h,d,$,F]),Xe.useEffect(()=>{let J=O.current;if(!J||!h||!d||!de||typeof MutationObserver!="function")return;let pe=new MutationObserver(()=>{if(y==="starting"||h.hasAttribute(tr.startingStyle)){F(h,d);return}let{size:we,syncPositioner:Ee}=ue(h);if(Ee){K(h,d,we.width,we.height);return}te(h,d,we.width,we.height)});return pe.observe(J,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["hidden"]}),()=>{pe.disconnect()}},[O,h,d,de,y,ue,K,te,F]),B(()=>{if(he.current&&p&&h&&d){if(le.current){le.current=!1;return}let{width:J,height:pe}=br(h);te(h,d,J,pe)}},[O,te,he,p,h,d,y]);function Me(J,pe){let we=pe.reason===ne.triggerHover;if(!De||fe==="touch"&&we||!J&&l!==A)return;function Ee(){we&&(Z(!0),j.clear(),j.start(500,()=>{Z(!1)})),J?u(A,pe):(u(null,pe),ee(""))}we?ya.flushSync(Ee):Ee()}let Ke=Fo({open:p,onOpenChange:Me,elements:{reference:X,floating:re}}),$e=cr(Ke),Ze=fe!=="touch";Xe.useEffect(()=>(p||(Ke.context.dataRef.current.openEvent=void 0,$e.pointerType=void 0,$e.interactedInside=!1,$e.restTimeoutPending=!1,$e.openChangeTimeout.clear(),$e.restTimeout.clear()),()=>{_n($e)}),[Ke,$e,p]);let Qe=z(()=>!I||d||!ce.current||!re?null:bR(ce.current,re,D));function It(){return I&&d?null:ce.current?.closest("ul")??null}let vt=Zc(Ke,{enabled:Re,move:!1,handleClose:nl({blockPointerEvents:Ze,getScope:It}),restMs:f&&d?0:P,delay:{close:L},triggerElementRef:ce,getHandleCloseContext:Qe}),xt=Xe.useMemo(()=>vt?{reference:vt}:void 0,[vt]),Dt=Do(Ke,{enabled:De,stickIfOpen:ge,toggle:de}),Xt=Xe.useMemo(()=>Qt(Dt.reference,xt?.reference),[Dt.reference,xt]);B(()=>{de&&(g(Ke),_.current=X)},[de,Ke,g,_,X]);function dn(J){ya.flushSync(()=>{let pe=J.currentTarget,we=_.current?.getBoundingClientRect();if(f&&we&&X){let Ee=X.getBoundingClientRect(),Se=Ee.left>we.left,Fe=Ee.top>we.top;E==="horizontal"&&Ee.left!==we.left?m(Se?"right":"left"):E==="vertical"&&Ee.top!==we.top&&m(Fe?"down":"up")}if(J.type!=="click"&&l!=null&&(Ke.context.dataRef.current.openEvent=void 0),!(fe==="touch"&&J.type!=="click")&&(l!=null&&J.type!=="keydown"&&u(A,me(J.type==="mouseenter"?ne.triggerHover:ne.triggerPress,J.nativeEvent)),J.type==="mouseenter"&&Ze&&(!I||!d)&&re)){let Ee=()=>{let Se=It()??pe.ownerDocument.body;ar($e,{scopeElement:Se,referenceElement:pe,floatingElement:re})};l!=null&&l!==A?queueMicrotask(Ee):Ee()}})}let wt=z(J=>{if(a)return;if(!h||!d){dn(J);return}let{width:pe,height:we}=br(h),Ee=l!=null&&l!==A&&(J.type==="click"||fe!=="touch");dn(J),Ee&&(le.current=!0),te(h,d,pe,we)}),ft={open:de,disabled:a};function ye(J){ee(J.pointerType)}function Je(J){ye(J),_n($e)}let rt={tabIndex:0,onMouseEnter:wt,onClick:wt,onPointerEnter:ye,onPointerDown:Je,"aria-expanded":de,"aria-controls":de?h?.id:void 0,[la]:"",onFocus(){de&&M(!1)},onMouseLeave(){l==null&&_n($e)},onKeyDown(J){if(I)return;let pe=k==="rtl"?"ArrowLeft":"ArrowRight",we=E==="horizontal"&&J.key==="ArrowDown",Ee=E==="vertical"&&J.key===pe;(we||Ee)&&(u(A,me(ne.listNavigation,J.nativeEvent)),wt(J),Et(J))},onBlur(J){d&&h&&va({currentTarget:J.currentTarget,relatedTarget:J.relatedTarget},{popupElement:h,rootRef:R,tree:N,nodeId:D})&&u(null,me(ne.focusOut,J.nativeEvent))}},{getButtonProps:dt,buttonRef:Wt}=zt({disabled:a,focusableWhenDisabled:!0,native:i}),st=re;return(0,mo.jsxs)(Xe.Fragment,{children:[(0,mo.jsx)(xa,{tag:"button",render:o,className:r,style:s,state:ft,stateAttributesMapping:$s,refs:[n,Ce,Wt],props:[Xt,W?.reference||yt,rt,c,dt]}),de&&(0,mo.jsxs)(Xe.Fragment,{children:[(0,mo.jsx)(on,{ref:x,onFocus:J=>{st&&Mt(J,st)?C.current?.focus():Zn(X)?.focus()}}),(0,mo.jsx)("span",{"aria-owns":v?.id,style:oi}),(0,mo.jsx)(on,{ref:S,onFocus:J=>{if(st&&Mt(J,st))ya.flushSync(()=>{M(!1)}),(w.current||X)?.focus();else{let pe=Xn(X);I&&!d&&st&&pe&&Q(st,pe)&&(pe=Wf(w.current)),pe?.focus(),(!I||d)&&!Q(R.current,pe)&&u(null,me(ne.focusOut,J.nativeEvent))}}})]})]})});function wR(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.left+n.width/2,s=n.top+n.height/2,i=o.left+o.width/2,a=o.top+o.height/2,c=i-r,l=a-s;return Math.abs(c)>=Math.abs(l)?c>=0?"right":"left":l>=0?"bottom":"top"}function bR(e,t,n){return{placement:wR(e,t),elements:{domReference:e,floating:t},nodeId:n}}var jg=b(H(),1);var Sa=b(H(),1),kl=Sa.createContext(void 0);function $g(){let e=Sa.useContext(kl);if(e===void 0)throw new Error(Ae(40));return e}var Al=b(ie(),1),zg=jg.forwardRef(function(t,n){let{keepMounted:o=!1,...r}=t,{mounted:s}=ze();return s||o?(0,Al.jsx)(kl.Provider,{value:o,children:(0,Al.jsx)(Ao,{ref:n,...r})}):null});var Hn=b(H(),1),Gg=b($n(),1);function qg(e){return ml(e,Xd)}var Ra=b(H(),1),Dl=Ra.createContext(void 0);function qo(e=!1){let t=Ra.useContext(Dl);if(!t&&!e)throw new Error(Ae(42));return t}var Kg={name:"adaptiveOrigin",async fn(e){let{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:a}=e,c=Oe(r),l=c.getComputedStyle(r);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:pr};let f=await s.getOffsetParent?.(r),p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(f===c){let y=ve(r);p={width:y.documentElement.clientWidth,height:y.documentElement.clientHeight}}else await s.isElement?.(f)&&(p=await s.getDimensions(f));let d=Ct(a),m=t,g=n;d==="left"&&(m=p.width-(t+o.width)),d==="top"&&(g=p.height-(n+o.height));let h=d==="left"?"right":pr.sideX,v=d==="top"?"bottom":pr.sideY;return{x:m,y:g,data:{sideX:h,sideY:v}}}};var Yg=b(ie(),1),ER=Rr(),Jg=Hn.forwardRef(function(t,n){let{open:o,mounted:r,positionerElement:s,setPositionerElement:i,floatingRootContext:a,nested:c,transitionStatus:l}=ze(),{className:u,render:f,anchor:p,positionMethod:d="absolute",side:m="bottom",align:g="center",sideOffset:h=0,alignOffset:v=0,collisionBoundary:y="clipping-ancestors",collisionPadding:R=5,collisionAvoidance:x=c?Xf:ni,arrowPadding:S=5,sticky:w=!1,disableAnchorTracking:C=!1,style:_,...T}=t,O=$g(),P=Tn(),L=et(),E=et(),[M,I]=Hn.useState(o),A=Hn.useRef(o);Hn.useEffect(()=>{if(!s)return;function j(U){s&&Mt(U)&&(U.type==="focusin"?qr:Zs)(s)}return bt(xe(s,"focusin",j,!0),xe(s,"focusout",j,!0))},[s]);let D=(a||ER).useState("domReferenceElement"),N=qg({anchor:p??D,positionMethod:d,mounted:r,side:m,sideOffset:h,align:g,alignOffset:v,arrowPadding:S,collisionBoundary:y,collisionPadding:R,sticky:w,disableAnchorTracking:C,keepMounted:O,floatingRootContext:a,collisionAvoidance:x,shift:{rootBoundary:"layoutViewport"},nodeId:P,adaptiveOrigin:Kg}),W={open:o,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:M};Hn.useEffect(()=>{if(!o)return;A.current&&L.start(0,()=>{A.current=!1,E.isStarted()||I(!1)});function j(){Gg.flushSync(()=>{I(!0)}),E.start(100,()=>{I(!1)})}let U=Oe(s);return xe(U,"resize",j)},[o,L,E,s]);let k=Di(t,W,{styles:N.positionerStyles,transitionStatus:l,props:T,refs:[n,i],hidden:!r,inert:!o});return(0,Yg.jsx)(Dl.Provider,{value:N,children:k})});var wa=b(H(),1);var go=b(ie(),1),CR=Rr();function Xg({children:e}){let{beforeInsideRef:t,beforeOutsideRef:n,afterInsideRef:o,afterOutsideRef:r,positionerElement:s,viewportElement:i,floatingRootContext:a}=ze(),c=!!qo(!0),l=s||i;return!a&&!c?e:(0,go.jsxs)(wa.Fragment,{children:[(0,go.jsx)(on,{ref:t,onFocus:u=>{l&&Mt(u,l)?Xn(l)?.focus():n.current?.focus()}}),e,(0,go.jsx)(on,{ref:o,onFocus:u=>{l&&Mt(u,l)?Zn(l)?.focus():r.current?.focus()}})]})}var Zg=wa.forwardRef(function(t,n){let{render:o,className:r,style:s,children:i,id:a,...c}=t,l=an(a),{setViewportElement:u,setViewportTargetElement:f,floatingRootContext:p,prevTriggerElementRef:d,viewportInert:m,setViewportInert:g}=ze(),v=!!qo(!0),y=(p||CR).useState("domReferenceElement");B(()=>{y&&(d.current=y)},[y,d]);let R=oe("div",t,{ref:[n,u],props:[{id:l,onBlur(x){let S=x.relatedTarget,w=x.currentTarget;S&&!Q(w,S)&&S!==y&&g(!0)},...!v&&m&&{inert:io(!0)},children:v?i:(0,go.jsx)(Xg,{children:(0,go.jsx)("div",{ref:f,children:i})})},c]});return v?(0,go.jsx)(Xg,{children:R}):R});var Qg=b(H(),1);var eh=Qg.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,{open:a,mounted:c,transitionStatus:l}=ze();return oe("div",t,{state:{open:a,transitionStatus:l},ref:n,props:[{role:"presentation",hidden:!c,style:{userSelect:"none",WebkitUserSelect:"none"}},i],stateAttributesMapping:Kn})});var th=b(H(),1);var nh=th.forwardRef(function(t,n){let{render:o,className:r,style:s,id:i,...a}=t,{open:c,transitionStatus:l,setPopupElement:u}=ze(),f=qo(),p=Pn(),d=Tt(i),m={open:c,transitionStatus:l,side:f.side,align:f.align,anchorHidden:f.anchorHidden},g=f.side==="left";p==="rtl"?g=g||f.side==="inline-end":g=g||f.side==="inline-start";let h=f.side==="top"||g;return oe("nav",t,{state:m,ref:[n,u],props:[{id:d,tabIndex:-1,style:h?{position:"absolute",[f.side==="top"?"bottom":"top"]:"0",[g?"right":"left"]:"0"}:{}},co(l),a],stateAttributesMapping:Kn})});var oh=b(H(),1);var rh=oh.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,{open:a,transitionStatus:c}=ze(),{arrowRef:l,side:u,align:f,arrowUncentered:p,arrowStyles:d}=qo();return oe("div",t,{state:{open:a,side:u,align:f,uncentered:p},ref:[n,l],props:[{style:d,"aria-hidden":!0},co(c),i],stateAttributesMapping:qt})});var sh=b(H(),1);var ih=b(ie(),1),ah=sh.forwardRef(function(t,n){let{className:o,render:r,active:s=!1,closeOnClick:i=!1,style:a,...c}=t,{setValue:l,popupElement:u,positionerElement:f,rootRef:p}=ze(),d=Tn(),m=gt();return(0,ih.jsx)(xa,{tag:"a",render:r,className:o,style:a,state:{active:s},refs:[n],props:[{"aria-current":s?"page":void 0,tabIndex:void 0,onClick(v){i&&l(null,me(ne.linkPress,v.nativeEvent))},onBlur(v){f&&u&&va({currentTarget:v.currentTarget,relatedTarget:v.relatedTarget},{popupElement:u,rootRef:p,tree:m,nodeId:d})&&l(null,me(ne.focusOut,v.nativeEvent))}},c]})});var ch=b(H(),1);var lh=ch.forwardRef(function(t,n){let{render:o,className:r,style:s,...i}=t,{value:a}=wr(),{open:c,value:l}=ze();return oe("span",t,{state:{open:c&&l===a},ref:n,props:[{"aria-hidden":!0,children:"\u25BC"},i],stateAttributesMapping:nr})});var ot=b(ie());function Ll({className:e,children:t,positionerProps:n,container:o,...r}){return(0,ot.jsxs)(Ut.Root,{"data-slot":"navigation-menu",className:Zt("eg-nav-menu",e),...r,children:[t,(0,ot.jsx)(Ut.Portal,{...o!=null?{container:o}:{},children:(0,ot.jsx)(Ut.Positioner,{className:"eg-nav-menu__positioner",sideOffset:4,...n,children:(0,ot.jsx)(Ut.Popup,{className:"eg-nav-menu__popup",children:(0,ot.jsx)(Ut.Viewport,{className:"eg-nav-menu__viewport"})})})})]})}function Vl({className:e,...t}){return(0,ot.jsx)(Ut.List,{"data-slot":"navigation-menu-list",className:Zt("eg-nav-menu__list",e),...t})}function Un({className:e,...t}){return(0,ot.jsx)(Ut.Item,{"data-slot":"navigation-menu-item",className:Zt("eg-nav-menu__item",e),...t})}function Fl({className:e,leadingIcon:t,badge:n,disabled:o,children:r,...s}){return(0,ot.jsxs)(Ut.Trigger,{"data-slot":"navigation-menu-trigger","data-disabled":o||void 0,disabled:o,className:Zt("eg-nav-menu__trigger",e),...s,children:[t!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-icon","aria-hidden":"true",children:t}),(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-label",children:r}),(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-chevron","aria-hidden":"true",children:(0,ot.jsx)(ta,{})}),n!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__badge","aria-label":`${n} notifications`,children:n})]})}function Ko({className:e,leadingIcon:t,children:n,...o}){return(0,ot.jsxs)(Ut.Link,{"data-slot":"navigation-menu-anchor",className:Zt("eg-nav-menu__trigger","eg-nav-menu__anchor",e),...o,children:[t!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-icon","aria-hidden":"true",children:t}),(0,ot.jsx)("span",{className:"eg-nav-menu__trigger-label",children:n})]})}function Hl({className:e,...t}){return(0,ot.jsx)(Ut.Content,{"data-slot":"navigation-menu-content",className:Zt("eg-nav-menu__content",e),...t})}function ba({className:e,leadingIcon:t,trailingIcon:n,active:o,children:r,...s}){return(0,ot.jsxs)(Ut.Link,{"data-slot":"navigation-menu-link",className:Zt("eg-nav-menu__link",o&&"eg-nav-menu__link--active",e),...s,children:[t!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__link-icon","aria-hidden":"true",children:t}),r,n!=null&&(0,ot.jsx)("span",{className:"eg-nav-menu__link-icon","aria-hidden":"true",children:n})]})}var Ul=b(ie());function Bl(e){return(0,Ul.jsx)(lt,{...e,children:(0,Ul.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.85 4.65L9.35 1.15C9.25 1.05 9.15 1 9 1H4C3.45 1 3 1.45 3 2V14C3 14.55 3.45 15 4 15H12C12.55 15 13 14.55 13 14V5C13 4.85 12.95 4.75 12.85 4.65ZM9 2.2L11.8 5H9V2.2ZM12 14H4V2H8V5C8 5.55 8.45 6 9 6H12V14ZM5 11V12H11V11H5ZM5 9V8H11V9H5Z"})})}var Wl=b(ie());function uh(e){return(0,Wl.jsx)(lt,{...e,children:(0,Wl.jsx)("path",{d:"M14.5 13.7929L10.7239 10.0169C11.6313 8.92758 12.0838 7.53038 11.9872 6.11596C11.8907 4.70153 11.2525 3.37879 10.2055 2.42288C9.15855 1.46698 7.78335 0.951515 6.366 0.983723C4.94865 1.01593 3.59828 1.59333 2.59581 2.59581C1.59333 3.59828 1.01593 4.94865 0.983723 6.366C0.951515 7.78335 1.46698 9.15855 2.42288 10.2055C3.37879 11.2525 4.70153 11.8907 6.11596 11.9872C7.53038 12.0838 8.92758 11.6313 10.0169 10.7239L13.7929 14.5L14.5 13.7929ZM2 6.5C2 5.60998 2.26392 4.73995 2.75838 3.99993C3.25285 3.25991 3.95565 2.68313 4.77792 2.34254C5.60019 2.00194 6.50499 1.91283 7.3779 2.08646C8.25082 2.2601 9.05264 2.68868 9.68198 3.31802C10.3113 3.94735 10.7399 4.74918 10.9135 5.62209C11.0872 6.495 10.998 7.3998 10.6575 8.22207C10.3169 9.04434 9.74008 9.74714 9.00006 10.2416C8.26004 10.7361 7.39001 11 6.5 11C5.30693 10.9987 4.1631 10.5241 3.31948 9.68052C2.47585 8.83689 2.00132 7.69306 2 6.5Z"})})}var $l=b(ie());function fh(e){return(0,$l.jsx)(lt,{...e,children:(0,$l.jsx)("path",{d:"M13.725 7.555L2.725 2.055C2.63879 2.01189 2.54195 1.99461 2.44614 2.00526C2.35034 2.0159 2.25965 2.05401 2.185 2.115C2.11372 2.17475 2.06051 2.2532 2.03136 2.34153C2.00221 2.42985 1.99828 2.52456 2.02 2.615L3.5 8L2 13.37C1.97962 13.4455 1.97724 13.5248 1.99306 13.6014C2.00887 13.678 2.04245 13.7499 2.09108 13.8111C2.13972 13.8724 2.20205 13.9214 2.27307 13.9542C2.34409 13.987 2.42182 14.0027 2.5 14C2.57827 13.9995 2.65534 13.9807 2.725 13.945L13.725 8.445C13.8069 8.40304 13.8756 8.3393 13.9236 8.26078C13.9716 8.18226 13.997 8.09203 13.997 8C13.997 7.90798 13.9716 7.81774 13.9236 7.73923C13.8756 7.66071 13.8069 7.59696 13.725 7.555ZM3.275 12.555L4.38 8.5H9V7.5H4.38L3.275 3.445L12.38 8L3.275 12.555Z"})})}var jl=b(ie());function dh(e){return(0,jl.jsx)(lt,{...e,children:(0,jl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.5 7.99996V8.37996L14.445 9.24496C14.6194 9.3979 14.7353 9.60672 14.7727 9.83568C14.8101 10.0646 14.7667 10.2995 14.65 10.5L13.51 12.5C13.4223 12.6518 13.2962 12.778 13.1444 12.8657C12.9926 12.9535 12.8204 12.9998 12.645 13C12.5363 13.0008 12.4282 12.9839 12.325 12.95L11.115 12.54C10.9035 12.6794 10.683 12.8047 10.455 12.915L10.2 14.175C10.1543 14.4052 10.029 14.6119 9.84623 14.7591C9.66341 14.9063 9.43466 14.9845 9.2 14.98H6.84C6.60535 14.9845 6.3766 14.9063 6.19378 14.7591C6.01096 14.6119 5.88573 14.4052 5.84 14.175L5.585 12.915C5.35859 12.8046 5.13977 12.6794 4.93 12.54L3.715 12.95C3.61176 12.9839 3.50368 13.0008 3.395 13C3.21964 12.9998 3.04741 12.9535 2.89559 12.8657C2.74376 12.778 2.61769 12.6518 2.53 12.5L1.35 10.5C1.22795 10.2975 1.18158 10.0583 1.2191 9.82493C1.25663 9.59152 1.37564 9.37896 1.555 9.22496L2.5 8.38496V7.99996V7.61996L1.555 6.75496C1.38057 6.60202 1.26473 6.39319 1.22733 6.16424C1.18993 5.93529 1.2333 5.70045 1.35 5.49996L2.53 3.49996C2.61769 3.34809 2.74376 3.22195 2.89559 3.13419C3.04741 3.04643 3.21964 3.00014 3.395 2.99996C3.50259 2.99264 3.61065 3.00277 3.715 3.02996L4.905 3.45996C5.11649 3.32053 5.33697 3.19526 5.565 3.08496L5.82 1.82496C5.86573 1.59476 5.99096 1.38798 6.17378 1.24081C6.3566 1.09364 6.58535 1.01546 6.82 1.01996H9.16C9.39466 1.01546 9.62341 1.09364 9.80623 1.24081C9.98905 1.38798 10.1143 1.59476 10.16 1.82496L10.415 3.08496C10.6414 3.19529 10.8602 3.32056 11.07 3.45996L12.285 3.04996C12.3882 3.01601 12.4963 2.99913 12.605 2.99996C12.7804 3.00014 12.9526 3.04643 13.1044 3.13419C13.2562 3.22195 13.3823 3.34809 13.47 3.49996L14.65 5.49996C14.7738 5.70075 14.8226 5.93885 14.7879 6.17216C14.7531 6.40547 14.637 6.61898 14.46 6.77496L13.5 7.61496V7.99996ZM10.89 11.42L12.605 12L13.785 9.99996L12.425 8.76496C12.5175 8.24739 12.5175 7.71753 12.425 7.19996L13.785 5.99996L12.605 3.99996L10.885 4.55996C10.4821 4.22453 10.0258 3.95917 9.535 3.77496L9.18 1.99996H6.82L6.465 3.79496C5.97031 3.97409 5.51147 4.23991 5.11 4.57996L3.395 3.99996L2.215 5.99996L3.575 7.23496C3.48255 7.75253 3.48255 8.28239 3.575 8.79996L2.215 9.99996L3.395 12L5.115 11.44C5.51786 11.7754 5.97422 12.0407 6.465 12.225L6.82 14H9.18L9.535 12.205C10.0297 12.0258 10.4885 11.76 10.89 11.42ZM6.33329 10.4944C6.82664 10.8241 7.40666 11 8 11C8.39508 11.004 8.78699 10.9292 9.15278 10.7798C9.51857 10.6305 9.85088 10.4096 10.1303 10.1303C10.4096 9.85088 10.6305 9.51857 10.7798 9.15278C10.9292 8.78699 11.004 8.39508 11 8C11 7.40666 10.8241 6.82664 10.4944 6.33329C10.1648 5.83994 9.69623 5.45543 9.14805 5.22836C8.59987 5.0013 7.99667 4.94189 7.41473 5.05765C6.83279 5.1734 6.29824 5.45912 5.87868 5.87868C5.45912 6.29824 5.1734 6.83279 5.05765 7.41473C4.94189 7.99667 5.0013 8.59987 5.22836 9.14805C5.45543 9.69623 5.83994 10.1648 6.33329 10.4944ZM7.22741 6.1397C7.47284 6.04137 7.73567 5.99384 8 6C8.26433 5.99384 8.52716 6.04137 8.77259 6.1397C9.01803 6.23803 9.24097 6.38512 9.42793 6.57208C9.61488 6.75904 9.76198 6.98197 9.86031 7.22741C9.95864 7.47284 10.0062 7.73567 10 8C10.0062 8.26433 9.95864 8.52716 9.86031 8.77259C9.76198 9.01803 9.61488 9.24097 9.42793 9.42793C9.24097 9.61488 9.01803 9.76198 8.77259 9.86031C8.52716 9.95864 8.26433 10.0062 8 10C7.73567 10.0062 7.47284 9.95864 7.22741 9.86031C6.98197 9.76198 6.75904 9.61488 6.57208 9.42793C6.38512 9.24097 6.23803 9.01803 6.1397 8.77259C6.04137 8.52716 5.99384 8.26433 6 8C5.99384 7.73567 6.04137 7.47284 6.1397 7.22741C6.23803 6.98197 6.38512 6.75904 6.57208 6.57208C6.75904 6.38512 6.98197 6.23803 7.22741 6.1397Z"})})}var zl=b(ie());function ph(e){return(0,zl.jsx)(lt,{...e,children:(0,zl.jsx)("path",{d:"M8.00001 3.26L9.38001 6.05L9.61001 6.55L10.11 6.625L13.19 7.07L11 9.22L10.625 9.585L10.715 10.085L11.24 13.15L8.48501 11.705L8.00001 11.5L7.53501 11.745L4.78001 13.17L5.28001 10.105L5.37001 9.605L5.00001 9.22L2.79001 7.045L5.87001 6.6L6.37001 6.525L6.60001 6.025L8.00001 3.26ZM8.00001 1L5.72501 5.61L0.640015 6.345L4.32001 9.935L3.45001 15L8.00001 12.61L12.55 15L11.68 9.935L15.36 6.35L10.275 5.61L8.00001 1Z"})})}var ql=b(ie());function mh(e){return(0,ql.jsx)(lt,{...e,children:(0,ql.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C6.49445 2 6.9778 2.14662 7.38893 2.42133C7.80005 2.69603 8.12048 3.08648 8.3097 3.54329C8.49892 4.00011 8.54843 4.50277 8.45196 4.98773C8.3555 5.47268 8.1174 5.91814 7.76777 6.26777C7.41814 6.6174 6.97268 6.8555 6.48773 6.95196C6.00278 7.04843 5.50011 6.99892 5.04329 6.8097C4.58648 6.62048 4.19603 6.30005 3.92133 5.88893C3.64662 5.4778 3.5 4.99445 3.5 4.5C3.5 3.83696 3.76339 3.20107 4.23223 2.73223C4.70108 2.26339 5.33696 2 6 2ZM6 1C5.30777 1 4.63108 1.20527 4.05551 1.58986C3.47993 1.97444 3.03133 2.52107 2.76642 3.16061C2.50152 3.80015 2.4322 4.50388 2.56725 5.18282C2.7023 5.86175 3.03564 6.48539 3.52513 6.97487C4.01461 7.46436 4.63825 7.7977 5.31719 7.93275C5.99612 8.0678 6.69985 7.99848 7.33939 7.73358C7.97894 7.46867 8.52556 7.02007 8.91015 6.4445C9.29473 5.86892 9.5 5.19223 9.5 4.5C9.5 3.57174 9.13125 2.6815 8.47487 2.02513C7.8185 1.36875 6.92826 1 6 1ZM16 7H14V5H13V7H11V8H13V10H14V8H16V7ZM10 15H11V12.5C11 11.5717 10.6313 10.6815 9.97487 10.0251C9.3185 9.36875 8.42826 9 7.5 9H4.5C3.57174 9 2.6815 9.36875 2.02513 10.0251C1.36875 10.6815 1 11.5717 1 12.5V15H2V12.5C2 11.837 2.26339 11.2011 2.73223 10.7322C3.20107 10.2634 3.83696 10 4.5 10H7.5C8.16304 10 8.79893 10.2634 9.26777 10.7322C9.73661 11.2011 10 11.837 10 12.5V15Z"})})}var Kl=b(ie());function gh(e){return(0,Kl.jsx)(lt,{...e,children:(0,Kl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 15H13C13.2652 15 13.5196 14.8946 13.7071 14.7071C13.8946 14.5196 14 14.2652 14 14V2C14 1.73478 13.8946 1.48043 13.7071 1.29289C13.5196 1.10536 13.2652 1 13 1H7C6.73478 1 6.48043 1.10536 6.29289 1.29289C6.10536 1.48043 6 1.73478 6 2V3.5H7V2H13V14H7V12.5H6V14C6 14.2652 6.10536 14.5196 6.29289 14.7071C6.48043 14.8946 6.73478 15 7 15ZM9.085 8.5L7.295 10.295L8 11L11 8L8 5L7.295 5.705L9.085 7.5H2V8.5H9.085Z"})})}var Gl=b(ie());function hh(e){return(0,Gl.jsx)(lt,{...e,children:(0,Gl.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 15H3C2.73488 14.9997 2.4807 14.8942 2.29323 14.7068C2.10576 14.5193 2.0003 14.2651 2 14V2C2.0003 1.73488 2.10576 1.4807 2.29323 1.29323C2.4807 1.10576 2.73488 1.0003 3 1H9C9.26512 1.0003 9.5193 1.10576 9.70677 1.29323C9.89424 1.4807 9.9997 1.73488 10 2V3.5H9V2H3V14H9V12.5H10V14C9.9997 14.2651 9.89424 14.5193 9.70677 14.7068C9.5193 14.8942 9.26512 14.9997 9 15ZM12.086 8.5L10.293 10.293L11 11L14 8L11 5L10.293 5.707L12.086 7.5H5V8.5H12.086Z"})})}var vh=b(H());var Bt=b(ie());function xh(e){let t=(0,vh.useId)();return(0,Bt.jsxs)(xu,{viewBox:"0 0 356 86",...e,children:[(0,Bt.jsxs)("g",{clipPath:`url(#${t}c0)`,children:[(0,Bt.jsx)("path",{d:"M33.6 36.5151C33.4 30.13 29.4 26.5383 24 26.5383C17.8 26.5383 13.6 30.3295 12.6 36.5151H33.6ZM24.4 17.3596C38.2 17.3596 45.6 27.3364 45.6 40.1068C45.6 41.5035 45.4 44.6961 45.4 44.6961H12.2C13 53.0766 19.4 57.4664 26.6 57.4664C34.4 57.4664 40.4 52.2784 40.4 52.2784L45 60.8585C45 60.8585 37.6 67.6427 25.8 67.6427C9.8 67.4432 0 55.8701 0 42.3016C0 27.536 10 17.3596 24.4 17.3596Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M69.8 58.065C76.2 58.065 80.6 51.2808 80.6 45.4942V44.297H78.6C72.4 44.297 62.6 45.0951 62.6 51.8794C62.6 55.0719 65 58.065 69.8 58.065ZM79 36.3156H80.6V35.717C80.6 29.3318 76.6 27.3364 71.4 27.3364C64.6 27.3364 58.2 31.9258 58.2 31.9258L53.6 23.3457C53.6 23.3457 61 17.3596 72.4 17.3596C85 17.3596 92.4 24.3434 92.4 36.5151V66.4455H81.4V62.4548C81.4 60.659 81.6 59.0627 81.6 59.0627H81.4C81.4 59.0627 77.8 67.4432 66.8 67.4432C58.2 67.4432 50.6 62.0557 50.6 52.478C50.6 37.3132 71.2 36.3156 79 36.3156Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M105.4 52.0789C105.4 52.0789 110.6 57.2668 118.4 57.2668C121.8 57.2668 124.8 55.6705 124.8 52.877C124.8 45.6937 101.4 46.6914 101.4 31.3271C101.4 22.348 109.4 17.1601 119.8 17.1601C130.6 17.1601 135.8 22.5476 135.8 22.5476L131.4 31.3271C131.4 31.3271 127 27.1369 119.6 27.1369C116.4 27.1369 113.4 28.5336 113.4 31.5267C113.4 38.3109 136.8 37.5128 136.8 52.877C136.8 60.8585 129.8 67.2436 118.4 67.2436C106.4 67.2436 99.8 60.2599 99.8 60.2599L105.4 52.0789Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M143 74.0278C143 74.0278 145.6 76.0232 148.4 76.0232C151.6 76.0232 154.8 74.0278 156.6 69.8376L158.4 65.6473L138.2 18.3573H151.6L161.6 45.8933C162.6 48.4872 163.4 52.2784 163.4 52.2784H163.6C163.6 52.2784 164.4 48.4872 165.2 45.8933L174.6 18.1578H187.6L166.2 73.4292C162.8 82.2088 156.2 86 148.8 86C143 86 138.8 82.8074 138.8 82.8074L143 74.0278Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M225.6 41.3039C225.6 30.3295 220.2 27.536 213.8 27.536C206.6 27.536 202.6 32.7239 202.6 40.9049C202.6 49.2854 207 55.471 214.6 55.471C220.2 55.2715 225.6 52.0789 225.6 41.3039ZM211.8 75.8237C219.2 75.8237 225.4 72.6311 225.4 64.2506V61.4571C225.4 60.2599 225.6 58.8631 225.6 58.8631H225.4C222.6 63.0534 218.4 65.2483 212 65.2483C198.2 65.2483 190.4 54.0742 190.4 41.1044C190.4 27.935 197.8 17.1601 211.6 17.1601C222 17.1601 225.8 23.3457 225.8 23.3457H226C226 23.3457 226 22.7471 226 21.949V18.3573H237.2V63.2529C237.2 79.6148 224.4 85.8005 211.8 85.8005C205.8 85.8005 199.4 84.2042 194.8 81.6102L198.4 72.4316C198.4 72.8306 204.6 75.8237 211.8 75.8237Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M272.4 57.2668C280.2 57.2668 286.6 51.2808 286.6 42.3016C286.6 33.5221 280.2 27.3364 272.4 27.3364C264.6 27.3364 258 33.5221 258 42.3016C258 51.2808 264.6 57.2668 272.4 57.2668ZM272.2 17.3596C286.8 17.3596 298.6 27.7355 298.6 42.5012C298.6 57.2668 286.8 67.6427 272.2 67.6427C257.6 67.6427 245.8 57.2668 245.8 42.5012C246 27.7355 257.6 17.3596 272.2 17.3596Z",fill:"#1D1D1F"}),(0,Bt.jsx)("path",{d:"M300.8 18.3573H313.4L323.4 48.0882C324.4 50.8817 325 55.2715 325 55.2715H325.2C325.2 55.2715 326 50.8817 326.8 48.0882L342.8 0H355.4L332.2 66.2459H318L300.8 18.3573Z",fill:"#FF2D16"})]}),(0,Bt.jsx)("defs",{children:(0,Bt.jsx)("clipPath",{id:`${t}c0`,children:(0,Bt.jsx)("rect",{width:"356",height:"86",fill:"white"})})})]})}var Go=class extends Error{};Go.prototype.name="InvalidTokenError";function _R(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let o=n.charCodeAt(0).toString(16).toUpperCase();return o.length<2&&(o="0"+o),"%"+o}))}function PR(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return _R(t)}catch{return atob(t)}}function yh(e,t){if(typeof e!="string")throw new Go("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,o=e.split(".")[n];if(typeof o!="string")throw new Go(`Invalid token specified: missing part #${n+1}`);let r;try{r=PR(o)}catch(s){throw new Go(`Invalid token specified: invalid base64 for part #${n+1} (${s.message})`)}try{return JSON.parse(r)}catch(s){throw new Go(`Invalid token specified: invalid json for part #${n+1} (${s.message})`)}}var TR={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},On,Nn,Ca=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(Ca||{});(e=>{function t(){On=3,Nn=TR}e.reset=t;function n(r){if(!(0<=r&&r<=4))throw new Error("Invalid log level");On=r}e.setLevel=n;function o(r){Nn=r}e.setLogger=o})(Ca||(Ca={}));var ke=class In{constructor(t){this._name=t}debug(...t){On>=4&&Nn.debug(In._format(this._name,this._method),...t)}info(...t){On>=3&&Nn.info(In._format(this._name,this._method),...t)}warn(...t){On>=2&&Nn.warn(In._format(this._name,this._method),...t)}error(...t){On>=1&&Nn.error(In._format(this._name,this._method),...t)}throw(t){throw this.error(t),t}create(t){let n=Object.create(this);return n._method=t,n.debug("begin"),n}static createStatic(t,n){let o=new In(`${t}.${n}`);return o.debug("begin"),o}static _format(t,n){let o=`[${t}]`;return n?`${o} ${n}:`:o}static debug(t,...n){On>=4&&Nn.debug(In._format(t),...n)}static info(t,...n){On>=3&&Nn.info(In._format(t),...n)}static warn(t,...n){On>=2&&Nn.warn(In._format(t),...n)}static error(t,...n){On>=1&&Nn.error(In._format(t),...n)}};Ca.reset();var ds=class{static decode(e){try{return yh(e)}catch(t){throw ke.error("JwtUtils.decode",t),t}}static async generateSignedJwt(e,t,n){let o=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),s=`${o}.${r}`,i=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,new TextEncoder().encode(s)),a=ut.encodeBase64Url(new Uint8Array(i));return`${s}.${a}`}static async generateSignedJwtWithHmac(e,t,n){let o=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=ut.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),s=`${o}.${r}`,i=await window.crypto.subtle.sign("HMAC",n,new TextEncoder().encode(s)),a=ut.encodeBase64Url(new Uint8Array(i));return`${s}.${a}`}},IR="10000000-1000-4000-8000-100000000000",Xl=e=>btoa([...new Uint8Array(e)].map(t=>String.fromCharCode(t)).join("")),Eh=class vn{static _randomWord(){let t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}static generateUUIDv4(){return IR.replace(/[018]/g,n=>(+n^vn._randomWord()&15>>+n/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return vn.generateUUIDv4()+vn.generateUUIDv4()+vn.generateUUIDv4()}static async generateCodeChallenge(t){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{let o=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",o);return Xl(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(n){throw ke.error("CryptoUtils.generateCodeChallenge",n),n}}static generateBasicAuth(t,n){let r=new TextEncoder().encode([t,n].join(":"));return Xl(r)}static async hash(t,n){let o=new TextEncoder().encode(n),r=await crypto.subtle.digest(t,o);return new Uint8Array(r)}static async customCalculateJwkThumbprint(t){let n;switch(t.kty){case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":n={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}let o=await vn.hash("SHA-256",JSON.stringify(n));return vn.encodeBase64Url(o)}static async generateDPoPProof({url:t,accessToken:n,httpMethod:o,keyPair:r,nonce:s}){let i,a,c={jti:window.crypto.randomUUID(),htm:o??"GET",htu:t,iat:Math.floor(Date.now()/1e3)};n&&(i=await vn.hash("SHA-256",n),a=vn.encodeBase64Url(i),c.ath=a),s&&(c.nonce=s);try{let l=await crypto.subtle.exportKey("jwk",r.publicKey),u={alg:"ES256",typ:"dpop+jwt",jwk:{crv:l.crv,kty:l.kty,x:l.x,y:l.y}};return await ds.generateSignedJwt(u,c,r.privateKey)}catch(l){throw l instanceof TypeError?new Error(`Error exporting dpop public key: ${l.message}`):l}}static async generateDPoPJkt(t){try{let n=await crypto.subtle.exportKey("jwk",t.publicKey);return await vn.customCalculateJwkThumbprint(n)}catch(n){throw n instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${n.message}`):n}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}static async generateClientAssertionJwt(t,n,o,r="HS256"){let s=Math.floor(Date.now()/1e3),i={alg:r,typ:"JWT"},a={iss:t,sub:t,aud:o,jti:vn.generateUUIDv4(),exp:s+300,iat:s},l={HS256:"SHA-256",HS384:"SHA-384",HS512:"SHA-512"}[r];if(!l)throw new Error(`Unsupported algorithm: ${r}. Supported algorithms are: HS256, HS384, HS512`);let u=new TextEncoder,f=await crypto.subtle.importKey("raw",u.encode(n),{name:"HMAC",hash:l},!1,["sign"]);return await ds.generateSignedJwtWithHmac(i,a,f)}};Eh.encodeBase64Url=e=>Xl(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var ut=Eh,ho=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new ke(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){let t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}async raise(...e){this._logger.debug("raise:",...e);for(let t of this._callbacks)await t(...e)}},Sh=class{static center({...e}){var t,n,o;return e.width==null&&(e.width=(t=[800,720,600,480].find(r=>r<=window.outerWidth/1.618))!=null?t:360),(n=e.left)!=null||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),e.height!=null&&((o=e.top)!=null||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}=${typeof n!="boolean"?n:n?"yes":"no"}`).join(",")}},Bn=class Ea extends ho{constructor(){super(...arguments),this._logger=new ke(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{let t=this._expiration-Ea.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=Ea.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){let n=this._logger.create("init");t=Math.max(Math.floor(t),1);let o=Ea.getEpochTime()+t;if(this.expiration===o&&this._timerHandle){n.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),n.debug("using duration",t),this._expiration=o;let r=Math.min(t,5);this._timerHandle=setInterval(this._callback,r*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Zl=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");let o=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(o.slice(1))}},Er=";",Yo=class extends Error{constructor(e,t){var n,o,r;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw ke.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=(n=e.error_description)!=null?n:null,this.error_uri=(o=e.error_uri)!=null?o:null,this.state=e.userState,this.session_state=(r=e.session_state)!=null?r:null,this.url_state=e.url_state}},ou=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},OR=class{constructor(e){this._logger=new ke("AccessTokenEvents"),this._expiringTimer=new Bn("Access token expiring"),this._expiredTimer=new Bn("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}async load(e){let t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){let n=e.expires_in;if(t.debug("access token present, remaining duration:",n),n>0){let r=n-this._expiringNotificationTimeInSeconds;r<=0&&(r=1),t.debug("registering expiring timer, raising in",r,"seconds"),this._expiringTimer.init(r)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();let o=n+1;t.debug("registering expired timer, raising in",o,"seconds"),this._expiredTimer.init(o)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},NR=class{constructor(e,t,n,o,r){this._callback=e,this._client_id=t,this._intervalInSeconds=o,this._stopOnError=r,this._logger=new ke("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=i=>{i.origin===this._frame_origin&&i.source===this._frame.contentWindow&&(i.data==="error"?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):i.data==="changed"?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(i.data+" message from check session op iframe"))};let s=new URL(n);this._frame_origin=s.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=s.href}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;let t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},Pa=class{constructor(){this._logger=new ke("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},Ql=class extends Error{constructor(e,t){super(t),this.name="ErrorDPoPNonce",this.nonce=e}},ru=class{constructor(e=[],t=null,n={}){this._jwtHandler=t,this._extraHeaders=n,this._logger=new ke("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){let{timeoutInSeconds:n,...o}=t;if(!n)return await fetch(e,o);let r=new AbortController,s=setTimeout(()=>r.abort(),n*1e3);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new ou("Network timed out"):i}finally{clearTimeout(s)}}async getJson(e,{token:t,credentials:n,timeoutInSeconds:o}={}){let r=this._logger.create("getJson"),s={Accept:this._contentTypes.join(", ")};t&&(r.debug("token passed, setting Authorization header"),s.Authorization="Bearer "+t),this._appendExtraHeaders(s);let i;try{r.debug("url:",e),i=await this.fetchWithTimeout(e,{method:"GET",headers:s,timeoutInSeconds:o,credentials:n})}catch(l){throw r.error("Network Error"),l}r.debug("HTTP response received, status",i.status);let a=i.headers.get("Content-Type");if(a&&!this._contentTypes.find(l=>a.startsWith(l))&&r.throw(new Error(`Invalid response Content-Type: ${a??"undefined"}, from URL: ${e}`)),i.ok&&this._jwtHandler&&a?.startsWith("application/jwt"))return await this._jwtHandler(await i.text());let c;try{c=await i.json()}catch(l){throw r.error("Error parsing JSON response",l),i.ok?l:new Error(`${i.statusText} (${i.status})`)}if(!i.ok)throw r.error("Error from server:",c),c.error?new Yo(c):new Error(`${i.statusText} (${i.status}): ${JSON.stringify(c)}`);return c}async postForm(e,{body:t,basicAuth:n,timeoutInSeconds:o,initCredentials:r,extraHeaders:s}){let i=this._logger.create("postForm"),a={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...s};n!==void 0&&(a.Authorization="Basic "+n),this._appendExtraHeaders(a);let c;try{i.debug("url:",e),c=await this.fetchWithTimeout(e,{method:"POST",headers:a,body:t,timeoutInSeconds:o,credentials:r})}catch(p){throw i.error("Network error"),p}i.debug("HTTP response received, status",c.status);let l=c.headers.get("Content-Type");if(l&&!this._contentTypes.find(p=>l.startsWith(p)))throw new Error(`Invalid response Content-Type: ${l??"undefined"}, from URL: ${e}`);let u=await c.text(),f={};if(u)try{f=JSON.parse(u)}catch(p){throw i.error("Error parsing JSON response",p),c.ok?p:new Error(`${c.statusText} (${c.status})`)}if(!c.ok){if(i.error("Error from server:",f),c.headers.has("dpop-nonce")){let p=c.headers.get("dpop-nonce");throw new Ql(p,`${JSON.stringify(f)}`)}throw f.error?new Yo(f,t):new Error(`${c.statusText} (${c.status}): ${JSON.stringify(f)}`)}return f}_appendExtraHeaders(e){let t=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),o=["accept","content-type"],r=["authorization"];n.length!==0&&n.forEach(s=>{if(o.includes(s.toLocaleLowerCase())){t.warn("Protected header could not be set",s,o);return}if(r.includes(s.toLocaleLowerCase())&&Object.keys(e).includes(s)){t.warn("Header could not be overridden",s,r);return}let i=typeof this._extraHeaders[s]=="function"?this._extraHeaders[s]():this._extraHeaders[s];i&&i!==""&&(e[s]=i)})}},MR=class{constructor(e){this._settings=e,this._logger=new ke("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new ru(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){let e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);let t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},t,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){let n=this._logger.create(`_getMetadataProperty('${e}')`),o=await this.getMetadata();if(n.debug("resolved"),o[e]===void 0){if(t===!0){n.warn("Metadata does not contain optional property");return}n.throw(new Error("Metadata does not contain property "+e))}return o[e]}async getSigningKeys(){let e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;let t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);let n=await this._jsonService.getJson(t,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(e.debug("got key set",n),!Array.isArray(n.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=n.keys,this._signingKeys}},Ta=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new ke("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;let t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");let e=await this._store.length,t=[];for(let n=0;n<e;n++){let o=await this._store.key(n);o&&o.indexOf(this._prefix)===0&&t.push(o.substr(this._prefix.length))}return t}},kR="code",AR="openid",DR="client_secret_post",LR=900,eu=class{constructor({authority:e,metadataUrl:t,metadata:n,signingKeys:o,metadataSeed:r,client_id:s,client_secret:i,response_type:a=kR,scope:c=AR,redirect_uri:l,post_logout_redirect_uri:u,client_authentication:f=DR,token_endpoint_auth_signing_alg:p="HS256",prompt:d,display:m,max_age:g,ui_locales:h,acr_values:v,resource:y,response_mode:R,filterProtocolClaims:x=!0,loadUserInfo:S=!1,requestTimeoutInSeconds:w,staleStateAgeInSeconds:C=LR,mergeClaimsStrategy:_={array:"replace"},disablePKCE:T=!1,stateStore:O,revokeTokenAdditionalContentTypes:P,fetchRequestCredentials:L,refreshTokenAllowedScope:E,extraQueryParams:M={},extraTokenParams:I={},extraHeaders:A={},dpop:D,omitScopeWhenRequesting:N=!1}){var W;if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=n,this.metadataSeed=r,this.signingKeys=o,this.client_id=s,this.client_secret=i,this.response_type=a,this.scope=c,this.redirect_uri=l,this.post_logout_redirect_uri=u,this.client_authentication=f,this.token_endpoint_auth_signing_alg=p,this.prompt=d,this.display=m,this.max_age=g,this.ui_locales=h,this.acr_values=v,this.resource=y,this.response_mode=R,this.filterProtocolClaims=x??!0,this.loadUserInfo=!!S,this.staleStateAgeInSeconds=C,this.mergeClaimsStrategy=_,this.omitScopeWhenRequesting=N,this.disablePKCE=!!T,this.revokeTokenAdditionalContentTypes=P,this.fetchRequestCredentials=L||"same-origin",this.requestTimeoutInSeconds=w,O)this.stateStore=O;else{let k=typeof window<"u"?window.localStorage:new Pa;this.stateStore=new Ta({store:k})}if(this.refreshTokenAllowedScope=E,this.extraQueryParams=M,this.extraTokenParams=I,this.extraHeaders=A,this.dpop=D,this.dpop&&!((W=this.dpop)!=null&&W.store))throw new Error("A DPoPStore is required when dpop is enabled")}},VR=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ke("UserInfoService"),this._getClaimsFromJwt=async n=>{let o=this._logger.create("_getClaimsFromJwt");try{let r=ds.decode(n);return o.debug("JWT decoding successful"),r}catch(r){throw o.error("Error parsing JWT response"),r}},this._jsonService=new ru(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){let t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));let n=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",n);let o=await this._jsonService.getJson(n,{token:e,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("got claims",o),o}},Ch=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new ke("TokenClient"),this._jsonService=new ru(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:n=this._settings.client_id,client_secret:o=this._settings.client_secret,extraHeaders:r,...s}){let i=this._logger.create("exchangeCode");n||i.throw(new Error("A client_id is required")),t||i.throw(new Error("A redirect_uri is required")),s.code||i.throw(new Error("A code is required"));let a=new URLSearchParams({grant_type:e,redirect_uri:t});for(let[f,p]of Object.entries(s))p!=null&&a.set(f,p);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&o==null)throw i.throw(new Error("A client_secret is required")),null;let c,l=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":c=ut.generateBasicAuth(n,o);break;case"client_secret_post":a.append("client_id",n),o&&a.append("client_secret",o);break;case"client_secret_jwt":{let f=await ut.generateClientAssertionJwt(n,o,l,this._settings.token_endpoint_auth_signing_alg);a.append("client_id",n),a.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),a.append("client_assertion",f);break}}i.debug("got token endpoint");let u=await this._jsonService.postForm(l,{body:a,basicAuth:c,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return i.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,scope:o=this._settings.scope,...r}){let s=this._logger.create("exchangeCredentials");t||s.throw(new Error("A client_id is required"));let i=new URLSearchParams({grant_type:e});this._settings.omitScopeWhenRequesting||i.set("scope",o);for(let[u,f]of Object.entries(r))f!=null&&i.set(u,f);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&n==null)throw s.throw(new Error("A client_secret is required")),null;let a,c=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":a=ut.generateBasicAuth(t,n);break;case"client_secret_post":i.append("client_id",t),n&&i.append("client_secret",n);break;case"client_secret_jwt":{let u=await ut.generateClientAssertionJwt(t,n,c,this._settings.token_endpoint_auth_signing_alg);i.append("client_id",t),i.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.append("client_assertion",u);break}}s.debug("got token endpoint");let l=await this._jsonService.postForm(c,{body:i,basicAuth:a,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return s.debug("got response"),l}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,timeoutInSeconds:o,extraHeaders:r,...s}){let i=this._logger.create("exchangeRefreshToken");t||i.throw(new Error("A client_id is required")),s.refresh_token||i.throw(new Error("A refresh_token is required"));let a=new URLSearchParams({grant_type:e});for(let[f,p]of Object.entries(s))Array.isArray(p)?p.forEach(d=>a.append(f,d)):p!=null&&a.set(f,p);if((this._settings.client_authentication==="client_secret_basic"||this._settings.client_authentication==="client_secret_jwt")&&n==null)throw i.throw(new Error("A client_secret is required")),null;let c,l=await this._metadataService.getTokenEndpoint(!1);switch(this._settings.client_authentication){case"client_secret_basic":c=ut.generateBasicAuth(t,n);break;case"client_secret_post":a.append("client_id",t),n&&a.append("client_secret",n);break;case"client_secret_jwt":{let f=await ut.generateClientAssertionJwt(t,n,l,this._settings.token_endpoint_auth_signing_alg);a.append("client_id",t),a.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),a.append("client_assertion",f);break}}i.debug("got token endpoint");let u=await this._jsonService.postForm(l,{body:a,basicAuth:c,timeoutInSeconds:o,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return i.debug("got response"),u}async revoke(e){var t;let n=this._logger.create("revoke");e.token||n.throw(new Error("A token is required"));let o=await this._metadataService.getRevocationEndpoint(!1);n.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);let r=new URLSearchParams;for(let[s,i]of Object.entries(e))i!=null&&r.set(s,i);r.set("client_id",this._settings.client_id),this._settings.client_secret&&r.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(o,{body:r,timeoutInSeconds:this._settings.requestTimeoutInSeconds}),n.debug("got response")}},FR=class{constructor(e,t,n){this._settings=e,this._metadataService=t,this._claimsService=n,this._logger=new ke("ResponseValidator"),this._userInfoService=new VR(this._settings,this._metadataService),this._tokenClient=new Ch(this._settings,this._metadataService)}async validateSigninResponse(e,t,n){let o=this._logger.create("validateSigninResponse");this._processSigninState(e,t),o.debug("state processed"),await this._processCode(e,t,n),o.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e,"",t.nonce),o.debug("tokens validated"),await this._processClaims(e,t?.skipUserInfo,e.isOpenId),o.debug("claims processed")}async validateCredentialsResponse(e,t){let n=this._logger.create("validateCredentialsResponse"),o=e.isOpenId&&!!e.id_token;o&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,t,o),n.debug("claims processed")}async validateRefreshResponse(e,t){var n,o;let r=this._logger.create("validateRefreshResponse");e.userState=t.data,(n=e.session_state)!=null||(e.session_state=t.session_state),(o=e.scope)!=null||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);let s=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,s),r.debug("claims processed")}validateSignoutResponse(e,t){let n=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&n.throw(new Error("State does not match")),n.debug("state validated"),e.userState=t.data,e.error)throw n.warn("Response was error",e.error),new Yo(e)}_processSigninState(e,t){var n;let o=this._logger.create("_processSigninState");if(t.id!==e.state&&o.throw(new Error("State does not match")),t.client_id||o.throw(new Error("No client_id on state")),t.authority||o.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&o.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&o.throw(new Error("client_id mismatch on settings vs. signin state")),o.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,(n=e.scope)!=null||(e.scope=t.scope),e.error)throw o.warn("Response was error",e.error),new Yo(e);t.code_verifier&&!e.code&&o.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,n=!0){let o=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){o.debug("not loading user info");return}o.debug("loading user info");let r=await this._userInfoService.getClaims(e.access_token);o.debug("user info claims received from user info endpoint"),n&&r.sub!==e.profile.sub&&o.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(r)),o.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t,n){let o=this._logger.create("_processCode");if(e.code){o.debug("Validating code");let r=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,extraHeaders:n,...t.extraTokenParams});Object.assign(e,r)}else o.debug("No code to process")}_validateIdTokenAttributes(e,t,n){var o;let r=this._logger.create("_validateIdTokenAttributes");r.debug("decoding ID Token JWT");let s=ds.decode((o=e.id_token)!=null?o:"");if(s.sub||r.throw(new Error("ID Token is missing a subject claim")),n&&s.nonce!==n&&r.throw(new Error("nonce in id_token does not match nonce in client storage")),t){let i=ds.decode(t);s.sub!==i.sub&&r.throw(new Error("sub in id_token does not match current sub")),s.auth_time&&s.auth_time!==i.auth_time&&r.throw(new Error("auth_time in id_token does not match original auth_time")),s.azp&&s.azp!==i.azp&&r.throw(new Error("azp in id_token does not match original azp")),!s.azp&&i.azp&&r.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=s}},_a=class tu{constructor(t){this.id=t.id||ut.generateUUIDv4(),this.data=t.data,t.created&&t.created>0?this.created=t.created:this.created=Bn.getEpochTime(),this.request_type=t.request_type,this.url_state=t.url_state}toStorageString(){return new ke("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return ke.createStatic("State","fromStorageString"),Promise.resolve(new tu(JSON.parse(t)))}static async clearStaleState(t,n){let o=ke.createStatic("State","clearStaleState"),r=Bn.getEpochTime()-n,s=await t.getAllKeys();o.debug("got keys",s);for(let i=0;i<s.length;i++){let a=s[i],c=await t.get(a),l=!1;if(c)try{let u=await tu.fromStorageString(c);o.debug("got item from key:",a,u.created),u.created<=r&&(l=!0)}catch(u){o.error("Error parsing state for key:",a,u),l=!0}else o.debug("no item in storage for key:",a),l=!0;l&&(o.debug("removed item for key:",a),t.remove(a))}}},_h=class nu extends _a{constructor(t){super(t),this.code_verifier=t.code_verifier,this.code_challenge=t.code_challenge,this.authority=t.authority,this.client_id=t.client_id,this.redirect_uri=t.redirect_uri,this.scope=t.scope,this.client_secret=t.client_secret,this.extraTokenParams=t.extraTokenParams,this.response_mode=t.response_mode,this.skipUserInfo=t.skipUserInfo,this.nonce=t.nonce}static async create(t){let n=t.code_verifier===!0?ut.generateCodeVerifier():t.code_verifier||void 0,o=n?await ut.generateCodeChallenge(n):void 0;return new nu({...t,code_verifier:n,code_challenge:o})}toStorageString(){return new ke("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo,nonce:this.nonce})}static fromStorageString(t){ke.createStatic("SigninState","fromStorageString");let n=JSON.parse(t);return nu.create(n)}},Ph=class Th{constructor(t){this.url=t.url,this.state=t.state}static async create({url:t,authority:n,client_id:o,redirect_uri:r,response_type:s,scope:i,state_data:a,response_mode:c,request_type:l,client_secret:u,nonce:f,url_state:p,resource:d,skipUserInfo:m,extraQueryParams:g,extraTokenParams:h,disablePKCE:v,dpopJkt:y,omitScopeWhenRequesting:R,...x}){if(!t)throw this._logger.error("create: No url passed"),new Error("url");if(!o)throw this._logger.error("create: No client_id passed"),new Error("client_id");if(!r)throw this._logger.error("create: No redirect_uri passed"),new Error("redirect_uri");if(!s)throw this._logger.error("create: No response_type passed"),new Error("response_type");if(!i)throw this._logger.error("create: No scope passed"),new Error("scope");if(!n)throw this._logger.error("create: No authority passed"),new Error("authority");let S=await _h.create({data:a,request_type:l,url_state:p,code_verifier:!v,client_id:o,authority:n,redirect_uri:r,response_mode:c,client_secret:u,scope:i,extraTokenParams:h,skipUserInfo:m,nonce:f}),w=new URL(t);w.searchParams.append("client_id",o),w.searchParams.append("redirect_uri",r),w.searchParams.append("response_type",s),R||w.searchParams.append("scope",i),f&&w.searchParams.append("nonce",f),y&&w.searchParams.append("dpop_jkt",y);let C=S.id;p&&(C=`${C}${Er}${p}`),w.searchParams.append("state",C),S.code_challenge&&(w.searchParams.append("code_challenge",S.code_challenge),w.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach(T=>w.searchParams.append("resource",T));for(let[_,T]of Object.entries({response_mode:c,...x,...g}))T!=null&&w.searchParams.append(_,T.toString());return new Th({url:w.href,state:S})}};Ph._logger=new ke("SigninRequest");var HR=Ph,UR="openid",Yl=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){let t=decodeURIComponent(this.state).split(Er);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(Er))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-Bn.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+Bn.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(UR))||!!this.id_token}},BR=class{constructor({url:e,state_data:t,id_token_hint:n,post_logout_redirect_uri:o,extraQueryParams:r,request_type:s,client_id:i,url_state:a}){if(this._logger=new ke("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");let c=new URL(e);if(n&&c.searchParams.append("id_token_hint",n),i&&c.searchParams.append("client_id",i),o&&(c.searchParams.append("post_logout_redirect_uri",o),t||a)){this.state=new _a({data:t,request_type:s,url_state:a});let l=this.state.id;a&&(l=`${l}${Er}${a}`),c.searchParams.append("state",l)}for(let[l,u]of Object.entries({...r}))u!=null&&c.searchParams.append(l,u.toString());this.url=c.href}},WR=class{constructor(e){if(this.state=e.get("state"),this.state){let t=decodeURIComponent(this.state).split(Er);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(Er))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},$R=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],jR=["sub","iss","aud","exp","iat"],zR=class{constructor(e){this._settings=e,this._logger=new ke("ClaimsService")}filterProtocolClaims(e){let t={...e};if(this._settings.filterProtocolClaims){let n;Array.isArray(this._settings.filterProtocolClaims)?n=this._settings.filterProtocolClaims:n=$R;for(let o of n)jR.includes(o)||delete t[o]}return t}mergeClaims(e,t){let n={...e};for(let[o,r]of Object.entries(t))if(n[o]!==r)if(Array.isArray(n[o])||Array.isArray(r))if(this._settings.mergeClaimsStrategy.array=="replace")n[o]=r;else{let s=Array.isArray(n[o])?n[o]:[n[o]];for(let i of Array.isArray(r)?r:[r])s.includes(i)||s.push(i);n[o]=s}else typeof n[o]=="object"&&typeof r=="object"?n[o]=this.mergeClaims(n[o],r):n[o]=r;return n}},Ih=class{constructor(e,t){this.keys=e,this.nonce=t}},qR=class{constructor(e,t){this._logger=new ke("OidcClient"),this.settings=e instanceof eu?e:new eu(e),this.metadataService=t??new MR(this.settings),this._claimsService=new zR(this.settings),this._validator=new FR(this.settings,this.metadataService,this._claimsService),this._tokenClient=new Ch(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:o,id_token_hint:r,login_hint:s,skipUserInfo:i,nonce:a,url_state:c,response_type:l=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:f=this.settings.redirect_uri,prompt:p=this.settings.prompt,display:d=this.settings.display,max_age:m=this.settings.max_age,ui_locales:g=this.settings.ui_locales,acr_values:h=this.settings.acr_values,resource:v=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:R=this.settings.extraQueryParams,extraTokenParams:x=this.settings.extraTokenParams,dpopJkt:S,omitScopeWhenRequesting:w=this.settings.omitScopeWhenRequesting}){let C=this._logger.create("createSigninRequest");if(l!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");let _=await this.metadataService.getAuthorizationEndpoint();C.debug("Received authorization endpoint",_);let T=await HR.create({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:f,response_type:l,scope:u,state_data:e,url_state:c,prompt:p,display:d,max_age:m,ui_locales:g,id_token_hint:r,login_hint:s,acr_values:h,dpopJkt:S,resource:v,request:t,request_uri:n,extraQueryParams:R,extraTokenParams:x,request_type:o,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:i,nonce:a,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:w});await this.clearStaleState();let O=T.state;return await this.settings.stateStore.set(O.id,O.toStorageString()),T}async readSigninResponseState(e,t=!1){let n=this._logger.create("readSigninResponseState"),o=new Yl(Zl.readParams(e,this.settings.response_mode));if(!o.state)throw n.throw(new Error("No state in response")),null;let r=await this.settings.stateStore[t?"remove":"get"](o.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await _h.fromStorageString(r),response:o}}async processSigninResponse(e,t,n=!0){let o=this._logger.create("processSigninResponse"),{state:r,response:s}=await this.readSigninResponseState(e,n);if(o.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){let i=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:i}}try{await this._validator.validateSigninResponse(s,r,t)}catch(i){if(i instanceof Ql&&this.settings.dpop){let a=await this.getDpopProof(this.settings.dpop.store,i.nonce);t.DPoP=a,await this._validator.validateSigninResponse(s,r,t)}else throw i}return s}async getDpopProof(e,t){let n,o;return(await e.getAllKeys()).includes(this.settings.client_id)?(o=await e.get(this.settings.client_id),o.nonce!==t&&t&&(o.nonce=t,await e.set(this.settings.client_id,o))):(n=await ut.generateDPoPKeys(),o=new Ih(n,t),await e.set(this.settings.client_id,o)),await ut.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:o.keys,nonce:o.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:o={}}){let r=await this._tokenClient.exchangeCredentials({username:e,password:t,...o}),s=new Yl(new URLSearchParams);return Object.assign(s,r),await this._validator.validateCredentialsResponse(s,n),s}async useRefreshToken({state:e,redirect_uri:t,resource:n,timeoutInSeconds:o,extraHeaders:r,extraTokenParams:s}){var i;let a=this._logger.create("useRefreshToken"),c;if(this.settings.refreshTokenAllowedScope===void 0)c=e.scope;else{let f=this.settings.refreshTokenAllowedScope.split(" ");c=(((i=e.scope)==null?void 0:i.split(" "))||[]).filter(d=>f.includes(d)).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){let f=await this.getDpopProof(this.settings.dpop.store);r={...r,DPoP:f}}let l;try{l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:c,redirect_uri:t,resource:n,timeoutInSeconds:o,extraHeaders:r,...s})}catch(f){if(f instanceof Ql&&this.settings.dpop)r.DPoP=await this.getDpopProof(this.settings.dpop.store,f.nonce),l=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:c,redirect_uri:t,resource:n,timeoutInSeconds:o,extraHeaders:r,...s});else throw f}let u=new Yl(new URLSearchParams);return Object.assign(u,l),a.debug("validating response",u),await this._validator.validateRefreshResponse(u,{...e,scope:c}),u}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:o,url_state:r,post_logout_redirect_uri:s=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){let a=this._logger.create("createSignoutRequest"),c=await this.metadataService.getEndSessionEndpoint();if(!c)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",c),!n&&s&&!t&&(n=this.settings.client_id);let l=new BR({url:c,id_token_hint:t,client_id:n,post_logout_redirect_uri:s,state_data:e,extraQueryParams:i,request_type:o,url_state:r});await this.clearStaleState();let u=l.state;return u&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(u.id,u.toStorageString())),l}async readSignoutResponseState(e,t=!1){let n=this._logger.create("readSignoutResponseState"),o=new WR(Zl.readParams(e,this.settings.response_mode));if(!o.state){if(n.debug("No state in response"),o.error)throw n.warn("Response was error:",o.error),new Yo(o);return{state:void 0,response:o}}let r=await this.settings.stateStore[t?"remove":"get"](o.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await _a.fromStorageString(r),response:o}}async processSignoutResponse(e){let t=this._logger.create("processSignoutResponse"),{state:n,response:o}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(o,n)):t.debug("No state from storage; skipping response validation"),o}clearStaleState(){return this._logger.create("clearStaleState"),_a.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},KR=class{constructor(e){this._userManager=e,this._logger=new ke("SessionMonitor"),this._start=async t=>{let n=t.session_state;if(!n)return;let o=this._logger.create("_start");if(t.profile?(this._sub=t.profile.sub,o.debug("session_state",n,", sub",this._sub)):(this._sub=void 0,o.debug("session_state",n,", anonymous user")),this._checkSessionIFrame){this._checkSessionIFrame.start(n);return}try{let r=await this._userManager.metadataService.getCheckSessionIframe();if(r){o.debug("initializing check session iframe");let s=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,c=new NR(this._callback,s,r,i,a);await c.load(),this._checkSessionIFrame=c,c.start(n)}else o.warn("no check session iframe found in the metadata")}catch(r){o.error("Error from getCheckSessionIframe:",r instanceof Error?r.message:r)}},this._stop=()=>{let t=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){let n=setInterval(async()=>{clearInterval(n);try{let o=await this._userManager.querySessionStatus();if(o){let r={session_state:o.session_state,profile:o.sub?{sub:o.sub}:null};this._start(r)}}catch(o){t.error("error from querySessionStatus",o instanceof Error?o.message:o)}},1e3)}},this._callback=async()=>{let t=this._logger.create("_callback");try{let n=await this._userManager.querySessionStatus(),o=!0;n&&this._checkSessionIFrame?n.sub===this._sub?(o=!1,this._checkSessionIFrame.start(n.session_state),t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",n.session_state),await this._userManager.events._raiseUserSessionChanged()):t.debug("different subject signed into OP",n.sub):t.debug("subject no longer signed into OP"),o?this._sub?await this._userManager.events._raiseUserSignedOut():await this._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise")}catch(n){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",n),await this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(t=>{this._logger.error(t)})}async _init(){this._logger.create("_init");let e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){let t=await this._userManager.querySessionStatus();if(t){let n={session_state:t.session_state,profile:t.sub?{sub:t.sub}:null};this._start(n)}}}},Jl=class Oh{constructor(t){var n;this.id_token=t.id_token,this.session_state=(n=t.session_state)!=null?n:null,this.access_token=t.access_token,this.refresh_token=t.refresh_token,this.token_type=t.token_type,this.scope=t.scope,this.profile=t.profile,this.expires_at=t.expires_at,this.state=t.userState,this.url_state=t.url_state}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-Bn.getEpochTime()}set expires_in(t){t!==void 0&&(this.expires_at=Math.floor(t)+Bn.getEpochTime())}get expired(){let t=this.expires_in;if(t!==void 0)return t<=0}get scopes(){var t,n;return(n=(t=this.scope)==null?void 0:t.split(" "))!=null?n:[]}toStorageString(){return new ke("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return ke.createStatic("User","fromStorageString"),new Oh(JSON.parse(t))}},Rh="oidc-client",Nh=class{constructor(){this._abort=new ho("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){let t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);let{url:n,keepOpen:o}=await new Promise((r,s)=>{let i=c=>{var l;let u=c.data,f=(l=e.scriptOrigin)!=null?l:window.location.origin;if(!(c.origin!==f||u?.source!==Rh)){try{let p=Zl.readParams(u.url,e.response_mode).get("state");if(p||t.warn("no state found in response url"),c.source!==this._window&&p!==e.state)return}catch{this._dispose(),s(new Error("Invalid response from window"))}r(u)}};window.addEventListener("message",i,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",i,!1));let a=new BroadcastChannel(`oidc-client-popup-${e.state}`);a.addEventListener("message",i,!1),this._disposeHandlers.add(()=>a.close()),this._disposeHandlers.add(this._abort.addHandler(c=>{this._dispose(),s(c)}))});return t.debug("got response from window"),this._dispose(),o||this.close(),{url:n}}_dispose(){this._logger.create("_dispose");for(let e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,n=!1,o=window.location.origin){let r={source:Rh,url:t,keepOpen:n},s=new ke("_notifyParent");if(e)s.debug("With parent. Using parent.postMessage."),e.postMessage(r,o);else{s.debug("No parent. Using BroadcastChannel.");let i=new URL(t).searchParams.get("state");if(!i)throw new Error("No parent and no state in URL. Can't complete notification.");let a=new BroadcastChannel(`oidc-client-popup-${i}`);a.postMessage(r),a.close()}}},Mh={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},kh="_blank",GR=60,YR=2,Ah=10,JR=class extends eu{constructor(e){let{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:n=e.post_logout_redirect_uri,popupWindowFeatures:o=Mh,popupWindowTarget:r=kh,redirectMethod:s="assign",redirectTarget:i="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,requestTimeoutInSeconds:l,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:f,automaticSilentRenew:p=!0,validateSubOnSilentRenew:d=!0,includeIdTokenInSilentRenew:m=!1,monitorSession:g=!1,monitorAnonymousSession:h=!1,checkSessionIntervalInSeconds:v=YR,query_status_response_type:y="code",stopCheckSessionOnError:R=!0,revokeTokenTypes:x=["access_token","refresh_token"],revokeTokensOnSignout:S=!1,includeIdTokenInSilentSignout:w=!1,accessTokenExpiringNotificationTimeInSeconds:C=GR,maxSilentRenewTimeoutRetries:_,userStore:T}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=n,this.popupWindowFeatures=o,this.popupWindowTarget=r,this.redirectMethod=s,this.redirectTarget=i,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=c,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=f||l||Ah,this.automaticSilentRenew=p,this.validateSubOnSilentRenew=d,this.includeIdTokenInSilentRenew=m,this.monitorSession=g,this.monitorAnonymousSession=h,this.checkSessionIntervalInSeconds=v,this.stopCheckSessionOnError=R,this.query_status_response_type=y,this.revokeTokenTypes=x,this.revokeTokensOnSignout=S,this.includeIdTokenInSilentSignout=w,this.accessTokenExpiringNotificationTimeInSeconds=C,this.maxSilentRenewTimeoutRetries=_,T)this.userStore=T;else{let O=typeof window<"u"?window.sessionStorage:new Pa;this.userStore=new Ta({store:O})}}},wh=class Dh extends Nh{constructor({silentRequestTimeoutInSeconds:t=Ah}){super(),this._logger=new ke("IFrameWindow"),this._timeoutInSeconds=t,this._frame=Dh.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){let t=window.document.createElement("iframe");return t.style.visibility="hidden",t.style.position="fixed",t.style.left="-1000px",t.style.top="0",t.width="0",t.height="0",window.document.body.appendChild(t),t}async navigate(t){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);let n=setTimeout(()=>{this._abort.raise(new ou("IFrame timed out without a response"))},this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(n)),await super.navigate(t)}close(){var t;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",n=>{var o;let r=n.target;(o=r.parentNode)==null||o.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(t=this._frame.contentWindow)==null||t.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(t,n){return super._notifyParent(window.parent,t,!1,n)}},XR=class{constructor(e){this._settings=e,this._logger=new ke("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new wh({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),wh.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},ZR=500,QR=1e3,bh=class extends Nh{constructor({popupWindowTarget:e=kh,popupWindowFeatures:t={},popupSignal:n,popupAbortOnClose:o}){super(),this._logger=new ke("PopupWindow");let r=Sh.center({...Mh,...t});this._window=window.open(void 0,e,Sh.serialize(r)),this.abortOnClose=!!o,n&&n.addEventListener("abort",()=>{var s;this._abort.raise(new Error((s=n.reason)!=null?s:"Popup aborted"))}),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*QR)}async navigate(e){var t;(t=this._window)==null||t.focus();let n=setInterval(()=>{(!this._window||this._window.closed)&&(this._logger.debug("Popup closed by user or isolated by redirect"),o(),this._disposeHandlers.delete(o),this.abortOnClose&&this._abort.raise(new Error("Popup closed by user")))},ZR),o=()=>clearInterval(n);return this._disposeHandlers.add(o),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){super._notifyParent(window.opener,e,t),!t&&!window.opener&&window.close()}},ew=class{constructor(e){this._settings=e,this._logger=new ke("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget,popupSignal:n,popupAbortOnClose:o}){return new bh({popupWindowFeatures:e,popupWindowTarget:t,popupSignal:n,popupAbortOnClose:o})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),bh.notifyOpener(e,t)}},tw=class{constructor(e){this._settings=e,this._logger=new ke("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var n;this._logger.create("prepare");let o=window.self;t==="top"&&(o=(n=window.top)!=null?n:window.self);let r=o.location[e].bind(o.location),s;return{navigate:async i=>(this._logger.create("navigate"),await new Promise((c,l)=>{s=l,window.addEventListener("pageshow",()=>c(window.location.href)),r(i.url)})),close:()=>{this._logger.create("close"),s?.(new Error("Redirect aborted")),o.stop()}}}async callback(){}},nw=class extends OR{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new ke("UserManagerEvents"),this._userLoaded=new ho("User loaded"),this._userUnloaded=new ho("User unloaded"),this._silentRenewError=new ho("Silent renew error"),this._userSignedIn=new ho("User signed in"),this._userSignedOut=new ho("User signed out"),this._userSessionChanged=new ho("User session changed")}async load(e,t=!0){await super.load(e),t&&await this._userLoaded.raise(e)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}async _raiseSilentRenewError(e){await this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},ow=class{constructor(e){this._userManager=e,this._logger=new ke("SilentRenewService"),this._isStarted=!1,this._retryTimer=new Bn("Retry Silent Renew"),this._timeoutRetryCount=0,this._tokenExpiring=async()=>{let t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),this._timeoutRetryCount=0,t.debug("silent token renewal successful")}catch(n){if(n instanceof ou){this._timeoutRetryCount++;let o=this._userManager.settings.maxSilentRenewTimeoutRetries;if(o!==void 0&&this._timeoutRetryCount>o){t.error(`Timeout retry limit reached (${this._timeoutRetryCount} > ${o}), raising silentRenewError:`,n),this._timeoutRetryCount=0,await this._userManager.events._raiseSilentRenewError(n);return}t.warn(`ErrorTimeout from signinSilent (attempt ${this._timeoutRetryCount}), retry in 5s:`,n),this._retryTimer.init(5);return}t.error("Error from signinSilent:",n),this._timeoutRetryCount=0,await this._userManager.events._raiseSilentRenewError(n)}}}async start(){let e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},rw=class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}},Lh=class{constructor(e,t,n,o){this._logger=new ke("UserManager"),this.settings=new JR(e),this._client=new qR(e),this._redirectNavigator=t??new tw(this.settings),this._popupNavigator=n??new ew(this.settings),this._iframeNavigator=o??new XR(this.settings),this._events=new nw(this.settings),this._silentRenewService=new ow(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new KR(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(e=!1){let t=this._logger.create("getUser"),n=await this._loadUser();return n?(t.info("user loaded"),await this._events.load(n,e),n):(t.info("user not found in storage"),null)}async removeUser(){let e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),await this._events.unload()}async signinRedirect(e={}){var t;this._logger.create("signinRedirect");let{redirectMethod:n,...o}=e,r;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(r=await this.generateDPoPJkt(this.settings.dpop));let s=await this._redirectNavigator.prepare({redirectMethod:n});await this._signinStart({request_type:"si:r",dpopJkt:r,...o},s)}async signinRedirectCallback(e=window.location.href){let t=this._logger.create("signinRedirectCallback"),n=await this._signinEnd(e);return n.profile&&n.profile.sub?t.info("success, signed in subject",n.profile.sub):t.info("no subject"),n}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:n=!1}){let o=this._logger.create("signinResourceOwnerCredential"),r=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n,extraTokenParams:this.settings.extraTokenParams});o.debug("got signin response");let s=await this._buildUser(r);return s.profile&&s.profile.sub?o.info("success, signed in subject",s.profile.sub):o.info("no subject"),s}async signinPopup(e={}){var t;let n=this._logger.create("signinPopup"),o;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(o=await this.generateDPoPJkt(this.settings.dpop));let{popupWindowFeatures:r,popupWindowTarget:s,popupSignal:i,popupAbortOnClose:a,...c}=e,l=this.settings.popup_redirect_uri;l||n.throw(new Error("No popup_redirect_uri configured"));let u=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:s,popupSignal:i,popupAbortOnClose:a}),f=await this._signin({request_type:"si:p",redirect_uri:l,display:"popup",dpopJkt:o,...c},u);return f&&(f.profile&&f.profile.sub?n.info("success, signed in subject",f.profile.sub):n.info("no subject")),f}async signinPopupCallback(e=window.location.href,t=!1){let n=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async signinSilent(e={}){var t,n;let o=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:r,...s}=e,i=await this._loadUser();if(!e.forceIframeAuth&&i?.refresh_token){o.debug("using refresh token");let f=new rw(i);return await this._useRefreshToken({state:f,redirect_uri:s.redirect_uri,resource:s.resource,extraTokenParams:s.extraTokenParams,timeoutInSeconds:r})}let a;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(a=await this.generateDPoPJkt(this.settings.dpop));let c=this.settings.silent_redirect_uri;c||o.throw(new Error("No silent_redirect_uri configured"));let l;i&&this.settings.validateSubOnSilentRenew&&(o.debug("subject prior to silent renew:",i.profile.sub),l=i.profile.sub);let u=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r});return i=await this._signin({request_type:"si:s",redirect_uri:c,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?i?.id_token:void 0,dpopJkt:a,...s},u,l),i&&((n=i.profile)!=null&&n.sub?o.info("success, signed in subject",i.profile.sub):o.info("no subject")),i}async _useRefreshToken(e){let t=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...e}),n=new Jl({...e.state,...t});return await this.storeUser(n),await this._events.load(n),n}async signinSilentCallback(e=window.location.href){let t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){let{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":await this.signinPopupCallback(e);break;case"si:s":await this.signinSilentCallback(e);break;default:throw new Error("invalid request_type in state")}}async signoutCallback(e=window.location.href,t=!1){let{state:n}=await this._client.readSignoutResponseState(e);if(n)switch(n.request_type){case"so:r":return await this.signoutRedirectCallback(e);case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid request_type in state")}}async querySessionStatus(e={}){let t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:n,...o}=e,r=this.settings.silent_redirect_uri;r||t.throw(new Error("No silent_redirect_uri configured"));let s=await this._loadUser(),i=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n}),a=await this._signinStart({request_type:"si:s",redirect_uri:r,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?s?.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...o},i);try{let c={},l=await this._client.processSigninResponse(a.url,c);return t.debug("got signin response"),l.session_state&&l.profile.sub?(t.info("success for subject",l.profile.sub),{session_state:l.session_state,sub:l.profile.sub}):(t.info("success, user not authenticated"),null)}catch(c){if(this.settings.monitorAnonymousSession&&c instanceof Yo)switch(c.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:c.session_state}}throw c}}async _signin(e,t,n){let o=await this._signinStart(e,t);return await this._signinEnd(o.url,n)}async _signinStart(e,t){let n=this._logger.create("_signinStart");try{let o=await this._client.createSigninRequest(e);return n.debug("got signin request"),await t.navigate({url:o.url,state:o.state.id,response_mode:o.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(o){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),o}}async _signinEnd(e,t){let n=this._logger.create("_signinEnd"),o={},r=await this._client.processSigninResponse(e,o);return n.debug("got signin response"),await this._buildUser(r,t)}async _buildUser(e,t){let n=this._logger.create("_buildUser"),o=new Jl(e);if(t){if(t!==o.profile.sub)throw n.debug("current user does not match user returned from signin. sub from signin:",o.profile.sub),new Yo({...e,error:"login_required"});n.debug("current user matches user returned from signin")}return await this.storeUser(o),n.debug("user stored"),await this._events.load(o),o}async signoutRedirect(e={}){let t=this._logger.create("signoutRedirect"),{redirectMethod:n,...o}=e,r=await this._redirectNavigator.prepare({redirectMethod:n});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...o},r),t.info("success")}async signoutRedirectCallback(e=window.location.href){let t=this._logger.create("signoutRedirectCallback"),n=await this._signoutEnd(e);return t.info("success"),n}async signoutPopup(e={}){let t=this._logger.create("signoutPopup"),{popupWindowFeatures:n,popupWindowTarget:o,popupSignal:r,...s}=e,i=this.settings.popup_post_logout_redirect_uri,a=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:o,popupSignal:r});await this._signout({request_type:"so:p",post_logout_redirect_uri:i,state:i==null?void 0:{},...s},a),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){let n=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async _signout(e,t){let n=await this._signoutStart(e,t);return await this._signoutEnd(n.url)}async _signoutStart(e={},t){var n;let o=this._logger.create("_signoutStart");try{let r=await this._loadUser();o.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(r);let s=e.id_token_hint||r&&r.id_token;s&&(o.debug("setting id_token_hint in signout request"),e.id_token_hint=s),await this.removeUser(),o.debug("user removed, creating signout request");let i=await this._client.createSignoutRequest(e);return o.debug("got signout request"),await t.navigate({url:i.url,state:(n=i.state)==null?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(r){throw o.debug("error after preparing navigator, closing navigator window"),t.close(),r}}async _signoutEnd(e){let t=this._logger.create("_signoutEnd"),n=await this._client.processSignoutResponse(e);return t.debug("got signout response"),n}async signoutSilent(e={}){var t;let n=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:o,...r}=e,s=this.settings.includeIdTokenInSilentSignout?(t=await this._loadUser())==null?void 0:t.id_token:void 0,i=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:o});await this._signout({request_type:"so:s",post_logout_redirect_uri:i,id_token_hint:s,...r},a),n.info("success")}async signoutSilentCallback(e=window.location.href){let t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){let t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){let n=this._logger.create("_revokeInternal");if(!e)return;let o=t.filter(r=>typeof e[r]=="string");if(!o.length){n.debug("no need to revoke due to no token(s)");return}for(let r of o)await this._client.revokeToken(e[r],r),n.info(`${r} revoked successfully`),r!=="access_token"&&(e[r]=null);await this.storeUser(e),n.debug("user stored"),await this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){let e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),Jl.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){let t=this._logger.create("storeUser");if(e){t.debug("storing user");let n=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,n)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey),this.settings.dpop&&await this.settings.dpop.store.remove(this.settings.client_id)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(e,t,n,o){var r,s;let i=await((s=(r=this.settings.dpop)==null?void 0:r.store)==null?void 0:s.get(this.settings.client_id));if(i)return await ut.generateDPoPProof({url:e,accessToken:t?.access_token,httpMethod:n,keyPair:i.keys,nonce:o})}async generateDPoPJkt(e){let t=await e.store.get(this.settings.client_id);if(!t){let n=await ut.generateDPoPKeys();t=new Ih(n),await e.store.set(this.settings.client_id,t)}return await ut.generateDPoPJkt(t.keys)}};function sw(e,t){let n=e.indexOf(".");return n===-1?null:`${t}${e.slice(n)}`}function su(e){if(typeof window>"u")return null;let{protocol:t,hostname:n}=window.location,o=sw(n,e);return o?`${t}//${o}`:null}function ps(){return su("core")}function Ia(){return su("info")}function Oa(){return ps()}var iw="/auth/realms/easygov";function iu(){let e=su("auth");return e?`${e}${iw}`:null}function aw(e){return e==="easygov.swiss"?null:e==="in.easygov.swiss"?"IN":e==="vp.easygov.swiss"?"VP":"DEV"}function Vh(){if(typeof window>"u")return null;let{hostname:e}=window.location,t=e.indexOf(".");return t===-1?"DEV":aw(e.slice(t+1))}typeof window<"u"&&window.addEventListener("unhandledrejection",e=>{let t=e.reason instanceof Error?e.reason.message:"";e.reason instanceof TypeError&&(t==="Load failed"||t==="Failed to fetch")&&(e.preventDefault(),console.info("[easygov-header] suppressed background OIDC fetch error:",t))});var cw="core",Wn=null,Na=!1,xo="initializing",cu=new Set,Jt=null,Uh=!1;function ms(){for(let e of[...cu])e(Wn)}function vo(e){xo!==e&&(xo=e,ms())}function au(e){if(e===null||e.expired===!0){Wn!==null&&(Wn=null,ms());return}let t=e.profile,n=t.sub??"",o=t.name??t.preferred_username??"(unknown)";Wn={user:{sub:n,name:o},accessToken:e.access_token},xo="authenticated",ms()}function lw(){let e=iu()??"",t=ps()??"",n=typeof window<"u"?window.location.origin+window.location.pathname:"",o=e?{authorization_endpoint:`${e}/protocol/openid-connect/auth`,token_endpoint:`${e}/protocol/openid-connect/token`,end_session_endpoint:`${e}/protocol/openid-connect/logout`,userinfo_endpoint:`${e}/protocol/openid-connect/userinfo`,check_session_iframe:`${e}/protocol/openid-connect/login-status-iframe.html`,jwks_uri:`${e}/protocol/openid-connect/certs`}:void 0;return{authority:e,client_id:cw,redirect_uri:n,silent_redirect_uri:`${t}/oidc-silent.html`,iframeScriptOrigin:t,post_logout_redirect_uri:Ia()??n,scope:"openid profile email",automaticSilentRenew:!0,monitorSession:!0,metadata:o,userStore:new Ta({store:new Pa})}}var uw=["code","state","session_state","iss","error","error_description","error_uri"];function fw(e){return/[?&](code|error)=/.test(e)}function Fh(){if(typeof window>"u")return;let e=new URL(window.location.href),t=!1;for(let n of uw)e.searchParams.has(n)&&(e.searchParams.delete(n),t=!0);t&&window.history.replaceState({},document.title,e.pathname+e.search+e.hash)}function dw(){if(typeof window>"u")return!1;try{return window!==window.top}catch{return!0}}function Hh(){Uh=!0,Na=!0,vo("no-auth")}async function Bh(){if(Jt!==null||Uh)return;if(!iu()){Hh();return}if(typeof window<"u"&&dw()&&fw(window.location.search))return;try{Jt=new Lh(lw())}catch{Hh();return}Jt.events.addUserLoaded(n=>au(n)),Jt.events.addUserUnloaded(()=>{xo!=="signing-out"&&vo("unauthenticated"),au(null)}),Jt.events.addAccessTokenExpired(()=>vo("renewing")),Jt.events.addSilentRenewError(()=>vo("renewing")),Jt.events.addUserSignedOut(()=>{vo("unauthenticated"),au(null)});let e=typeof window<"u"?window.location.search:"";if(typeof window<"u"&&/[?&]code=/.test(e)&&/[?&]state=/.test(e)){try{await Jt.signinCallback()}catch{}Fh(),Na=!0,xo=Wn!==null?"authenticated":"unauthenticated",ms();return}let t=!1;if(typeof window<"u"&&/[?&]error=/.test(e)&&(t=!0,Fh()),!t)try{await Jt.signinSilent()}catch{}Na=!0,xo=Wn!==null?"authenticated":"unauthenticated",ms()}function Wh(){return Na}function lu(){return Wn?.accessToken??null}function $h(){return Wn?.user??null}function jh(e){return cu.add(e),()=>{cu.delete(e)}}function zh(){Jt!==null&&(vo("signing-in"),Jt.signinRedirect())}function qh(){Jt!==null&&(vo("signing-out"),Jt.signoutRedirect())}typeof window<"u"&&window.addEventListener("pageshow",e=>{e.persisted&&(xo==="signing-in"||xo==="signing-out")&&vo(Wn!==null?"authenticated":"unauthenticated")});var pw=new Set(["customer","process","parentprocess"]);function mw(){return typeof window>"u"?[]:window.location.pathname.split("/").filter(Boolean)}function Jh(){let e=mw(),t=e.findIndex(o=>pw.has(o)),n=t===-1?void 0:e[t+1];return n?{type:e[t],id:decodeURIComponent(n)}:null}var Kh=null,Ma=null;function gw(e,t){return e===null||t===null?e===t:e.type===t.type&&e.id===t.id}function Xh(){let e=typeof window>"u"?"":window.location.pathname;if(e===Kh)return Ma;Kh=e;let t=Jh();return gw(t,Ma)||(Ma=t),Ma}function Zh(){return null}var gs=new Set,Gh=!1,uu=!1;function hw(){if(uu=!1,gs.size!==0)for(let e of[...gs])e()}function Yh(){uu||gs.size===0||(uu=!0,queueMicrotask(hw))}function vw(){if(!Gh){Gh=!0;for(let e of["pushState","replaceState"]){let t=window.history[e].bind(window.history);window.history[e]=(n,o,r)=>{t(n,o,r),Yh()}}window.addEventListener("popstate",Yh)}}function Qh(e){return vw(),gs.add(e),()=>{gs.delete(e)}}var tv={contextJwt:null,claims:null},ev=tv,xw=new Set;function nv(e,t){if(e!==ev.contextJwt){ev=e===null?tv:{contextJwt:e,claims:t};for(let n of[...xw])n()}}var ov={name:"@easygov/react-components",version:"0.9.0",private:!1,description:"React 19 component library for EasyGov \u2014 accessible UI components styled with eg-* design tokens.",license:"MIT",author:"easygov",keywords:["easygov","react","components","ui","design-system"],repository:{type:"git",url:"git+https://gitlab.adesso-group.com/229efe07/easygov20-highcode-ui-components.git",directory:"packages/react-components"},sideEffects:["**/*.css"],exports:{".":"./src/index.ts","./icons":"./src/icons/index.ts","./styles.css":{types:"./src/styles/styles-css.d.mts",default:"./dist/easygov.css"},"./fonts.css":"./src/styles/fonts.css","./fonts/noto-sans-latin":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-latin.woff2"},"./fonts/noto-sans-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-latin-ext.woff2"},"./fonts/noto-sans-italic-latin":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-Italic-latin.woff2"},"./fonts/noto-sans-italic-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./src/fonts/NotoSans-Italic-latin-ext.woff2"}},files:["dist","src/fonts/OFL.txt","src/fonts/woff2.d.mts","src/styles/styles-css.d.mts"],publishConfig:{access:"public",main:"./dist/easygov.mjs",module:"./dist/easygov.mjs",types:"./dist/easygov.d.mts",exports:{".":{types:"./dist/easygov.d.mts",import:"./dist/easygov.mjs"},"./icons":{types:"./dist/icons.d.mts",import:"./dist/icons.mjs"},"./styles.css":{types:"./src/styles/styles-css.d.mts",default:"./dist/easygov.css"},"./fonts.css":"./dist/fonts.css","./fonts/noto-sans-latin":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-latin.woff2"},"./fonts/noto-sans-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-latin-ext.woff2"},"./fonts/noto-sans-italic-latin":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-Italic-latin.woff2"},"./fonts/noto-sans-italic-latin-ext":{types:"./src/fonts/woff2.d.mts",default:"./dist/NotoSans-Italic-latin-ext.woff2"}}},scripts:{lint:"eslint .",build:"tsup","check-types":"tsc --noEmit",test:"vitest run","test:watch":"vitest","generate:logos":"node scripts/generate-logos.mjs",prepublishOnly:"tsup"},peerDependencies:{react:"^19","react-dom":"^19"},devDependencies:{"@easygov/design-tokens":"workspace:*","@easygov/eslint-config":"workspace:*","@easygov/typescript-config":"workspace:*","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@types/node":"^24.0.0","@types/react":"19.3.0","@types/react-dom":"19.3.0","@vitest/coverage-v8":"^4.1.9",eslint:"^9.39.1",jsdom:"^30.0.0",react:"^19.2.0","react-dom":"^19.2.0",tsup:"^8.5.1",typescript:"5.9.3",vitest:"^4.1.9"},dependencies:{"@base-ui/react":"^1.5.0","class-variance-authority":"^0.7.1","oidc-client-ts":"^3.5.0"}};var du=ov.version,sv={libraryVersion:du,backendVersion:null},Sw={libraryVersion:du,backendVersion:null},fu=new Set;function iv(e){return fu.add(e),()=>{fu.delete(e)}}function av(){return sv}function cv(){return Sw}function Rw(e){sv={libraryVersion:du,backendVersion:e};for(let t of[...fu])t()}var rv=!1;function lv(){if(rv)return;rv=!0;let e=Oa();e&&(async()=>{try{let t=await fetch(`${e}/external/api/v1/version`);if(!t.ok)return;let n=await t.json();if(typeof n.version!="string")return;Rw(n.version)}catch{}})()}var ww=new Set(["type","title","status","detail","instance","errorCode","traceId","timestamp"]);async function uv(e){try{let t=await e.json();return typeof t!="object"||t===null||Array.isArray(t)?null:t}catch{return null}}function fv(e,t){let n=typeof e?.traceId=="string"&&e.traceId!==""?e.traceId:void 0,o=typeof e?.errorCode=="string"&&e.errorCode!==""?e.errorCode:void 0,r=o==="customer-account-not-accessible"?nt("errorCustomerAccountNotAccessible",t):nt("errorFallbackMessage",t),s=n!==void 0?`${nt("errorReference",t)}: ${n}${o!==void 0?` (${o})`:""}`:void 0,i=e?Object.fromEntries(Object.entries(e).filter(([c])=>!ww.has(c))):{},a=Object.keys(i).length>0?i:void 0;return{title:nt("errorTitle",t),message:r,reference:s,details:a}}var ae=b(ie()),pu=()=>()=>{};function hs(e){let t=(0,Ie.useRef)(e);return(0,Ie.useEffect)(()=>{t.current=e},[e]),t}var pv={user:null,accessToken:null},vs=pv;function bw(){let e=$h(),t=lu();return e===vs.user&&t===vs.accessToken||(vs={user:e,accessToken:t}),vs}function mv(e){return jh(()=>e())}function gv(){return(0,Ie.useSyncExternalStore)(mv,bw,()=>pv)}function hv(){return(0,Ie.useSyncExternalStore)(Wa,Ua,Ou)}function vv(){return(0,Ie.useSyncExternalStore)(iv,av,cv)}function Ew(){return(0,Ie.useSyncExternalStore)(Qh,Xh,Zh)}function dv(e){try{let t=e.split(".")[1];if(!t)return null;let n=t.replace(/-/g,"+").replace(/_/g,"/"),o=n+"=".repeat((4-n.length%4)%4),r=atob(o),s=Uint8Array.from(r,a=>a.charCodeAt(0)),i=new TextDecoder().decode(s);return JSON.parse(i)}catch{return null}}function Cw(e,t){let[n,o]=(0,Ie.useState)(null),[r,s]=(0,Ie.useState)(0),[i,a]=(0,Ie.useState)(null),c=e.user?.sub??null;(0,Ie.useEffect)(()=>{if(c===null){o(null),s(0),a(null);return}let f=lu(),p=Oa();if(!f||!p)return;let d=new AbortController;return(async()=>{try{let m=new URL(`${p}/external/bff/api/header-context`);t?.type==="customer"?m.searchParams.set("selectedCustomerAccountId",t.id):t?.type==="process"?m.searchParams.set("selectedProcessId",t.id):t?.type==="parentprocess"&&m.searchParams.set("selectedParentProcessId",t.id);let g=await fetch(m.toString(),{headers:{Authorization:`Bearer ${f}`,Accept:"application/json"},signal:d.signal});if(d.signal.aborted)return;if(!g.ok){console.warn(`[easygov-header] getHeaderContext returned ${g.status}`);let y=await uv(g);if(d.signal.aborted)return;a({problem:y});return}let h=await g.json();if(d.signal.aborted)return;if(dv(h.contextJwt)===null){console.warn("[easygov-header] failed to decode contextJwt payload"),a({problem:null});return}o(h.contextJwt),s(h.accessibleAccountCount),a(null)}catch(m){m.name!=="AbortError"&&(console.error("[easygov-header] getHeaderContext failed",m),a({problem:null}))}})(),()=>d.abort()},[c,t]);let l=(0,Ie.useMemo)(()=>n!==null?dv(n):null,[n]),u=(0,Ie.useCallback)(()=>a(null),[]);return{claims:l,contextJwt:n,accessibleAccountCount:r,contextError:i,dismissContextError:u}}function Mn(e,t){return`${e?.replace(/\/+$/,"")??""}${t}`}function yo(e,t){return n=>{e(t)&&n.preventDefault()}}function _w({initializing:e,user:t,onLogin:n,onLogout:o,dashboardPath:r,favoritesPath:s,companyPath:i,servicesPath:a,profilePath:c,coreOrigin:l,infoOrigin:u,infoHomePath:f,logoTitle:p,environmentStage:d,userDisplayName:m,companyLabel:g,accessibleAccountCount:h,onNavigate:v,locale:y,onLocaleChange:R,portalContainer:x,headerRef:S,announcement:w}){let[C,_]=(0,Ie.useState)(!1),[T,O]=(0,Ie.useState)(!1);(0,Ie.useEffect)(()=>{let D=N=>{N.persisted&&(_(!1),O(!1))};return window.addEventListener("pageshow",D),()=>window.removeEventListener("pageshow",D)},[]);let P=()=>{_(!0),n()},L=()=>{O(!0),o()},E=t!==null,M=E?hh:gh,I=nt(E?"logout":"login",y),A=`/select-account?returnTo=${encodeURIComponent(Mn(l,"/dashboard"))}`;return(0,ae.jsxs)("header",{ref:S,className:"eg-header",role:"banner","data-slot":"header",children:[(0,ae.jsx)("a",{href:"#main-content",className:"eg-header__skip-link",children:nt("skipToMain",y)}),(0,ae.jsx)(hu,{className:"eg-header__grid",children:(0,ae.jsxs)(vu,{className:"eg-header__content",children:[(0,ae.jsxs)("div",{className:"eg-header__left",children:[(0,ae.jsxs)("div",{className:"eg-header__brand-group",children:[(0,ae.jsx)("div",{className:"eg-header__brand-clip",children:(0,ae.jsx)("a",{href:Mn(u,f),className:"eg-header__brand","aria-label":"EasyGov",title:p,"data-slot":"header-logo",children:(0,ae.jsx)(xh,{height:24})})}),d!==null&&(0,ae.jsxs)("span",{className:"eg-header__env-badge","data-slot":"header-environment-badge",children:[nt("testEnvironment",y),": ",d]})]}),(0,ae.jsx)("nav",{className:"eg-header__nav","aria-label":"Main navigation",children:(0,ae.jsx)(Ll,{container:x,children:(0,ae.jsxs)(Vl,{children:[E&&h>0&&(0,ae.jsx)(Un,{value:"dashboard",children:(0,ae.jsx)(Ko,{href:Mn(l,r),onClick:yo(v,r),leadingIcon:(0,ae.jsx)(fh,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-dashboard",children:nt("dashboard",y)})}),E&&h>0&&(0,ae.jsx)(Un,{value:"favorites",children:(0,ae.jsx)(Ko,{href:Mn(l,s),onClick:yo(v,s),leadingIcon:(0,ae.jsx)(ph,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-favorites",children:nt("myFavorites",y)})}),E&&(0,ae.jsx)(Un,{value:"all-services",children:(0,ae.jsx)(Ko,{href:Mn(l,a),onClick:yo(v,a),leadingIcon:(0,ae.jsx)(Bl,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-services",children:nt("allGovServices",y)})})]})})})]}),(0,ae.jsxs)("div",{className:"eg-header__right",children:[(0,ae.jsx)("nav",{className:"eg-header__nav","aria-label":"Account navigation",children:(0,ae.jsx)(Ll,{container:x,children:(0,ae.jsxs)(Vl,{children:[E&&h>1&&g!==null&&(0,ae.jsxs)(Un,{value:"company-switcher",children:[(0,ae.jsx)(Fl,{"data-slot":"header-company-switcher-trigger",children:g}),(0,ae.jsx)(Hl,{children:(0,ae.jsx)(ba,{href:Mn(l,A),onClick:yo(v,A),closeOnClick:!0,"data-slot":"header-company-switcher-select-account",children:nt("myCompanies",y)})})]}),e?(0,ae.jsx)("div",{className:"eg-header__skeleton eg-header__skeleton--services","aria-hidden":"true"}):!E&&(0,ae.jsx)(Un,{value:"all-services-logged-out",children:(0,ae.jsx)(Ko,{href:Mn(l,"/services"),onClick:yo(v,"/services"),leadingIcon:(0,ae.jsx)(Bl,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-services",children:nt("allGovServices",y)})}),e?(0,ae.jsx)("div",{className:"eg-header__skeleton eg-header__skeleton--register","aria-hidden":"true"}):!E&&(0,ae.jsx)(Un,{value:"register",children:(0,ae.jsx)(Ko,{href:Mn(l,"/register"),onClick:yo(v,"/register"),leadingIcon:(0,ae.jsx)(mh,{size:"s","aria-hidden":"true"}),"data-slot":"header-nav-register",children:nt("register",y)})}),E&&(0,ae.jsxs)(Un,{value:"settings",children:[(0,ae.jsx)(Fl,{leadingIcon:(0,ae.jsx)(dh,{size:"s","aria-hidden":"true"}),"data-slot":"header-settings-trigger",children:nt("settings",y)}),(0,ae.jsxs)(Hl,{children:[(0,ae.jsx)(ba,{href:Mn(l,c),onClick:yo(v,c),closeOnClick:!0,"data-slot":"header-settings-profile",children:m}),g!==null&&(0,ae.jsx)(ba,{href:Mn(l,i),onClick:yo(v,i),closeOnClick:!0,"data-slot":"header-settings-company",children:g})]})]}),e?(0,ae.jsx)("div",{className:"eg-header__skeleton eg-header__skeleton--auth","aria-hidden":"true"}):(0,ae.jsx)(Un,{value:"auth",children:(0,ae.jsx)(Ko,{href:"#","aria-disabled":E?T:C,onClick:D=>{D.preventDefault(),!(E?T:C)&&(E?L():P())},leadingIcon:(0,ae.jsx)(M,{size:"s","aria-hidden":"true"}),"data-slot":E?"header-nav-logout":"header-nav-login",children:I})})]})})}),(0,ae.jsxs)("div",{className:"eg-header__right-menu",children:[(0,ae.jsxs)(qm,{value:y,onValueChange:D=>D!=null&&R(D),children:[(0,ae.jsx)(Km,{"aria-label":nt("selectLanguage",y),renderValue:D=>typeof D=="string"?D.toUpperCase():null}),(0,ae.jsx)(Gm,{container:x,alignItemWithTrigger:!1,children:Ss.map(D=>(0,ae.jsx)(Ym,{value:D.value,"data-slot":`language-option-${D.value}`,children:D.label},D.value))})]}),(0,ae.jsx)(Ms,{variant:"tertiary",size:"icon-s",onClick:()=>console.info("[easygov-header] search clicked"),"aria-label":nt("search",y),"data-slot":"header-search-button",children:(0,ae.jsx)(uh,{size:"s","aria-hidden":"true"})})]}),(0,ae.jsx)(yu,{height:31,className:"eg-header__swiss-logo"})]})]})}),(0,ae.jsx)("div",{className:"eg-header__sr-only","aria-live":"polite","aria-atomic":"true",children:w})]})}function Pw({onLanguageChange:e,onNavigate:t,onContextChange:n,onLogout:o}){let r=(0,Ie.useRef)(!1);(0,Ie.useEffect)(()=>{r.current||(r.current=!0,Bh())},[]),(0,Ie.useEffect)(()=>{lv()},[]);let s=vv(),i=(0,Ie.useSyncExternalStore)(mv,Wh,()=>!0),a=gv(),c=Ew(),l=c?.type==="customer"?c.id:null,{claims:u,contextJwt:f,accessibleAccountCount:p,contextError:d,dismissContextError:m}=Cw(a,c),g=(0,Ie.useRef)(null),h=(0,Ie.useRef)(null),[v,y]=(0,Ie.useState)(""),R=hv(),x=(0,Ie.useMemo)(()=>d!==null?fv(d.problem,R):null,[d,R]),S=hs(R),w=hs(o);(0,Ie.useEffect)(()=>{let ee=a.user?.sub??null,ce=h.current;if(h.current=ee,ee!==ce){if(g.current?.dispatchEvent(new CustomEvent("sessionchange",{bubbles:!0,composed:!0,detail:{user:a.user}})),ee!==null&&ce===null){let q=nt("loginSuccess",S.current);y(q),setTimeout(()=>y(""),3e3)}else if(ee===null&&ce!==null){let q=nt("logoutSuccess",S.current);y(q),setTimeout(()=>y(""),3e3),w.current?.()}}},[a.user,S,w]);let C=hs(e);(0,Ie.useEffect)(()=>{C.current?.(R),g.current?.dispatchEvent(new CustomEvent("languagechange",{bubbles:!0,composed:!0,detail:{locale:R}})),typeof document<"u"&&(document.documentElement.lang=R)},[R,C]);let _=hs(n);(0,Ie.useEffect)(()=>{nv(f,u),!(f===null||u===null)&&(_.current?.(f,u),g.current?.dispatchEvent(new CustomEvent("contextchange",{bubbles:!0,composed:!0,detail:{contextJwt:f,claims:u}})))},[f,u,_]);let T=(0,Ie.useCallback)(ee=>{Ba(ee)},[]),[O,P]=(0,Ie.useState)(null);(0,Ie.useLayoutEffect)(()=>{let ee=g.current?.getRootNode();ee instanceof ShadowRoot&&P(ee)},[]);let L=(0,Ie.useSyncExternalStore)(pu,ps,()=>null),E=(0,Ie.useSyncExternalStore)(pu,Ia,()=>null),M=(0,Ie.useSyncExternalStore)(pu,Vh,()=>null),I=hs(t),A=(0,Ie.useCallback)(ee=>(g.current?.dispatchEvent(new CustomEvent("navigate",{bubbles:!0,composed:!0,detail:{path:ee}})),I.current?(I.current(ee),!0):!1),[I]),D=a.user===null?null:{name:a.user.name},N=`${u?.currentUser.firstName??""} ${u?.currentUser.lastName??""}`.trim(),W=u?.customerAccount?.id??l,k=W!==null?`/customer/${W}`:null,j=a.user!==null?k:null,U=ee=>j!==null?`${ee}${j}`:ee,$=U("/dashboard"),V=U("/favorites"),X=U("/company"),Y=U("/services"),ge=U("/profile"),Z=E!==null&&j!==null?j:"/",fe=s.backendVersion!==null?`UI-Version: ${s.libraryVersion}
2
+ Backend-Version: ${s.backendVersion}`:`UI-Version: ${s.libraryVersion}`;return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(_w,{headerRef:g,initializing:!i,user:D,onLogin:()=>zh(),onLogout:()=>qh(),dashboardPath:$,favoritesPath:V,companyPath:X,servicesPath:Y,profilePath:ge,coreOrigin:L,infoOrigin:E,infoHomePath:Z,logoTitle:fe,environmentStage:M,userDisplayName:N!==""?N:D?.name??"",companyLabel:u?.customerAccount?.label??null,accessibleAccountCount:p,onNavigate:A,locale:R,onLocaleChange:T,portalContainer:O,announcement:v}),(0,ae.jsx)(_g,{open:x!==null,onClose:m,title:x?.title??"",message:x?.message??"",reference:x?.reference,details:x?.details,closeLabel:nt("errorCloseLabel",R),detailsLabel:nt("errorDetailsLabel",R)})]})}export{Ua as a,Ba as b,Wa as c,Pw as d};
3
+ /*! Bundled license information:
4
+
5
+ use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
6
+ (**
7
+ * @license React
8
+ * use-sync-external-store-shim.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ *)
15
+
16
+ use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js:
17
+ (**
18
+ * @license React
19
+ * use-sync-external-store-shim/with-selector.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ *)
26
+ */
27
+ //# sourceMappingURL=chunk-MPITA5PQ.js.map