efficient-shell 7.20.1 → 7.21.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.
@@ -1,13 +1,13 @@
1
- import{Breadcrumbs as e}from"./chunk-Z2TTHY7G.js";import{SidebarLayout as t}from"./chunk-GIWC2ZTG.js";import{BrandMark as r}from"./chunk-BQ7GR7H6.js";import{OneLineLabel as n,TH_ONE_LINE as a}from"./chunk-VOFDPOB6.js";import{inputClasses as l,PLACEHOLDER_INK as i,FILTER_ON as o,FILTER_ON_INK as s,FILTER_OFF as c,INPUT_BASE_ON as d,INPUT_BASE as u,INPUT_SIZES as h}from"./chunk-HJQAE6SP.js";import{isSafeLinkHref as m}from"./chunk-PJPK2ADX.js";import{useShellLanguage as p}from"./chunk-RBKIYZ7H.js";import{toast_default as g}from"./chunk-RUHUTZN4.js";import{useIsMobile as f,useShortcutLabel as b,useShellPrefs as x}from"./chunk-ZRU5F2XT.js";import{isAriaDisabled as y,swallowPress as v,describedByWith as w,OffWithReason as N,useDropdownPosition as k,MENU_MAX_HEIGHT as $,Button_default as M,Tooltip as C,popupBounds as L,VIEWPORT_MARGIN as S,placeMenu as D,followAnchor as P,POPUP_MAX_WIDTH as A,followRect as z,placeAtPoint as j}from"./chunk-IJ7RXIWX.js";import{useTabLayer as F,focusableIn as E,useFocusTrap as B,useScrollLock as T,dialogA11y as I,stopAfter as O}from"./chunk-76VCH7N6.js";import{PopupMenu as R,MenuSemanticsContext as W,leavesContextMenuAlone as K,PopupMenuDivider as q,PopupMenuLabel as H,itemLook as _,MenuCheckMark as U}from"./chunk-IQDY2YFN.js";import{useDismissPopupsOnOpen as V}from"./chunk-UVBK6YSR.js";import{iconButtonClasses as Y,buttonClasses as G}from"./chunk-JTNKC4CR.js";import{glassStyle as X,GLASS_DIVIDER as Z,solidSurfaceStyle as J}from"./chunk-7IQ3B77H.js";import{registerModalEscapeInterceptor as Q,onOverlayOpen as ee,Z_LAYERS as te}from"./chunk-FIEA5CGB.js";import{useBrowserLayoutEffect as re,useBrowserValue as ne,useHydrated as ae,useBrowserValueOnce as le,useBrowserState as ie}from"./chunk-D65T4H6J.js";import{reportBoundaryError as oe}from"./chunk-KNUR2UEG.js";import{useFileIntake as se,humanSize as ce,FileIntakeAlert as de}from"./chunk-M4TRVJTO.js";import{useShellLocale as ue,useShellStrings as he,DEFAULT_SHELL_STRINGS as me,currentShellStrings as pe,splitAround as ge}from"./chunk-QRCDQPJA.js";import{formatPlain as fe,formatFixed as be,formatPercent as xe}from"./chunk-C3QOHMR6.js";import{parseFocal as ye,formatFocal as ve,nudgeFocal as we,focalFromRect as Ne}from"./chunk-AP2QEJXQ.js";import{calendarNames as ke,firstDayOfWeek as $e,formatDate as Me,EMPTY_VALUE as Ce,toInstant as Le,timeAgo as Se,formatDateTime as De}from"./chunk-W32SKK3D.js";import{Icon as Pe,setIconSet as Ae}from"./chunk-ZGUQLVY4.js";import{forwardRef as ze,useId as je,useCallback as Fe,useState as Ee,useRef as Be,useMemo as Te,useEffect as Ie,createContext as Oe,Children as Re,isValidElement as We,cloneElement as Ke,useContext as qe,Fragment as He,Component as _e,useSyncExternalStore as Ue,useLayoutEffect as Ve}from"react";import{jsx as Ye,jsxs as Ge,Fragment as Xe}from"react/jsx-runtime";import{createPortal as Ze}from"react-dom";var Je=ze(function({children:e,variant:t="ghost",size:r="md",type:n="button",className:a="",pressed:l,disabledReason:i,ink:o,disabled:s,onClick:c,"aria-disabled":d,"aria-describedby":u,...h},m){const p=je(),g=(Boolean(s)||y(d))&&null!=i&&""!==i,f=g||y(d),b=/* @__PURE__ */Ye("button",{ref:m,type:n,className:Y({variant:t,size:r,pressed:l??(!0===h["aria-pressed"]||"true"===h["aria-pressed"]),ink:o,className:a}),...h,disabled:g?void 0:s,"aria-disabled":!!f||d,"aria-describedby":w(u,g?p:void 0),onClick:f?v:c,children:e});return g?/* @__PURE__ */Ye(N,{reason:i,id:p,children:b}):b}),Qe=ze(function({invalid:e,leftIcon:t,rightAdornment:r,size:n,className:a="",readOnly:o,...s},c){const d=`${t?"pl-10":""} ${r?"pr-10":""}`.trim(),u=
2
- /* @__PURE__ */Ye("input",{ref:c,"aria-invalid":e||void 0,readOnly:o,className:l({invalid:e,size:n,readOnly:o,className:[d,a].filter(Boolean).join(" ")}),...s});return t||r?/* @__PURE__ */Ge("div",{className:"relative",children:[t&&/* @__PURE__ */Ye("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${i}`,children:t}),u,r&&/* @__PURE__ */Ye("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:r})]}):u}),et=ze(function({invalid:e,autoGrow:t,className:r="",onInput:n,rows:a=3,size:i,readOnly:o,...s},c){const d=Fe(e=>{if(t){const t=e.currentTarget;t.style.height="auto",t.style.height=`${t.scrollHeight}px`}n?.(e)},[t,n]);/* @__PURE__ */
1
+ import{Breadcrumbs as e}from"./chunk-Z2TTHY7G.js";import{SidebarLayout as t}from"./chunk-GIWC2ZTG.js";import{BrandMark as r}from"./chunk-BQ7GR7H6.js";import{OneLineLabel as n,TH_ONE_LINE as a}from"./chunk-VOFDPOB6.js";import{inputClasses as l,PLACEHOLDER_INK as i,FILTER_ON as o,FILTER_ON_INK as s,FILTER_OFF as c,INPUT_BASE_ON as d,INPUT_BASE as u,INPUT_SIZES as h}from"./chunk-HJQAE6SP.js";import{useShellLanguage as m}from"./chunk-RBKIYZ7H.js";import{isSafeLinkHref as p}from"./chunk-PJPK2ADX.js";import{toast_default as g}from"./chunk-RUHUTZN4.js";import{useIsMobile as f,useShortcutLabel as b,useShellPrefs as x}from"./chunk-ZRU5F2XT.js";import{isAriaDisabled as y,swallowPress as v,describedByWith as w,OffWithReason as N,useDropdownPosition as k,MENU_MAX_HEIGHT as $,Button_default as M,Tooltip as C,popupBounds as L,VIEWPORT_MARGIN as S,placeMenu as D,followAnchor as P,POPUP_MAX_WIDTH as A,followRect as j,placeAtPoint as z}from"./chunk-IJ7RXIWX.js";import{useTabLayer as F,focusableIn as E,useFocusTrap as B,useScrollLock as T,dialogA11y as I,stopAfter as O}from"./chunk-76VCH7N6.js";import{PopupMenu as R,MenuSemanticsContext as W,leavesContextMenuAlone as K,PopupMenuDivider as _,PopupMenuLabel as q,itemLook as H,MenuCheckMark as U}from"./chunk-IQDY2YFN.js";import{useDismissPopupsOnOpen as V}from"./chunk-UVBK6YSR.js";import{iconButtonClasses as Y,buttonClasses as G}from"./chunk-JTNKC4CR.js";import{glassStyle as X,GLASS_DIVIDER as Z,solidSurfaceStyle as J}from"./chunk-7IQ3B77H.js";import{registerModalEscapeInterceptor as Q,onOverlayOpen as ee,Z_LAYERS as te}from"./chunk-FIEA5CGB.js";import{useBrowserLayoutEffect as re,useBrowserValue as ne,useHydrated as ae,useBrowserValueOnce as le,useBrowserState as ie}from"./chunk-D65T4H6J.js";import{reportBoundaryError as oe}from"./chunk-KNUR2UEG.js";import{useFileIntake as se,humanSize as ce,FileIntakeAlert as de}from"./chunk-M4TRVJTO.js";import{useShellLocale as ue,useShellStrings as he,DEFAULT_SHELL_STRINGS as me,currentShellStrings as pe,splitAround as ge}from"./chunk-QRCDQPJA.js";import{formatPlain as fe,formatFixed as be,formatPercent as xe}from"./chunk-C3QOHMR6.js";import{parseFocal as ye,formatFocal as ve,nudgeFocal as we,focalFromRect as Ne}from"./chunk-AP2QEJXQ.js";import{calendarNames as ke,firstDayOfWeek as $e,formatDate as Me,EMPTY_VALUE as Ce,toInstant as Le,timeAgo as Se,formatDateTime as De}from"./chunk-W32SKK3D.js";import{Icon as Pe,setIconSet as Ae}from"./chunk-ZGUQLVY4.js";import{forwardRef as je,useId as ze,useCallback as Fe,useState as Ee,useRef as Be,useMemo as Te,useEffect as Ie,createContext as Oe,Children as Re,isValidElement as We,cloneElement as Ke,useContext as _e,Fragment as qe,Component as He,useSyncExternalStore as Ue,useLayoutEffect as Ve}from"react";import{jsx as Ye,jsxs as Ge,Fragment as Xe}from"react/jsx-runtime";import{createPortal as Ze}from"react-dom";var Je=je(function({children:e,variant:t="ghost",size:r="md",type:n="button",className:a="",pressed:l,disabledReason:i,ink:o,disabled:s,onClick:c,"aria-disabled":d,"aria-describedby":u,...h},m){const p=ze(),g=(Boolean(s)||y(d))&&null!=i&&""!==i,f=g||y(d),b=/* @__PURE__ */Ye("button",{ref:m,type:n,className:Y({variant:t,size:r,pressed:l??(!0===h["aria-pressed"]||"true"===h["aria-pressed"]),ink:o,className:a}),...h,disabled:g?void 0:s,"aria-disabled":!!f||d,"aria-describedby":w(u,g?p:void 0),onClick:f?v:c,children:e});return g?/* @__PURE__ */Ye(N,{reason:i,id:p,children:b}):b}),Qe=je(function({invalid:e,leftIcon:t,rightAdornment:r,size:n,className:a="",readOnly:o,...s},c){const d=`${t?"pl-10":""} ${r?"pr-10":""}`.trim(),u=
2
+ /* @__PURE__ */Ye("input",{ref:c,"aria-invalid":e||void 0,readOnly:o,className:l({invalid:e,size:n,readOnly:o,className:[d,a].filter(Boolean).join(" ")}),...s});return t||r?/* @__PURE__ */Ge("div",{className:"relative",children:[t&&/* @__PURE__ */Ye("span",{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 ${i}`,children:t}),u,r&&/* @__PURE__ */Ye("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:r})]}):u}),et=je(function({invalid:e,autoGrow:t,className:r="",onInput:n,rows:a=3,size:i,readOnly:o,...s},c){const d=Fe(e=>{if(t){const t=e.currentTarget;t.style.height="auto",t.style.height=`${t.scrollHeight}px`}n?.(e)},[t,n]);/* @__PURE__ */
3
3
  return Ye("textarea",{ref:c,"aria-invalid":e||void 0,rows:a,onInput:d,readOnly:o,className:l({invalid:e,size:i,readOnly:o,multiline:!0,className:`${t?"resize-none overflow-hidden":""} ${r}`.trim()}),...s})});function tt(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function rt(e){for(let t=e.length-1;t>=0;t--)if(!e[t].disabled)return t;return-1}function nt(e,t,r){let n=t+r;for(;n>=0&&n<e.length;){if(!e[n].disabled)return n;n+=r}return t>=0&&t<e.length&&!e[t].disabled?t:r>0?tt(e):rt(e)}function at(e,t,r){const n=t.toLowerCase(),a=e.length;if(!n||0===a)return-1;for(let t=1;t<=a;t++){const l=((r+t)%a+a)%a,i=e[l];if(!i.disabled&&i.label.toLowerCase().startsWith(n))return l}return-1}var lt=e=>Array.isArray(e.options);function it(e){const t=[];for(const r of e)lt(r)?t.push(...r.options):t.push(r);return t}function ot(e,t){const r=[];for(const n of e){if(!lt(n)){t(n)&&r.push(n);continue}const e=n.options.filter(t);e.length&&r.push({...n,options:e})}return r}function st(e,t,r,n=""){const a=[];let l=0;return e.forEach((e,i)=>{if(!lt(e))return a.push(t(e,l)),void(l+=1);const o=`${r}-group-${i}`,s=l;l+=e.options.length,a.push(
4
4
  /* @__PURE__ */Ge("div",{role:"group","aria-labelledby":o,children:[
5
5
  /* @__PURE__ */Ye("div",{id:o,role:"presentation","data-option-group-heading":"",className:`truncate px-3 pb-1 pt-2 text-xs font-semibold text-gray-500 ${n}`.trim(),children:e.label}),e.options.map((e,r)=>t(e,s+r))]},o))}),a}function ct({selected:e}){/* @__PURE__ */
6
6
  return Ye(Pe,{name:"check","aria-hidden":"true",className:"h-4 w-4 shrink-0 "+(e?"":"invisible"),strokeWidth:2.5})}function dt(e,t){return e.label.toLowerCase().includes(t)||(e.sublabel?.toLowerCase().includes(t)??!1)}function ut({children:e,grows:t=!1}){/* @__PURE__ */
7
- return Ye("span",{className:`min-w-0 ${t?"shrink":"max-w-[45%] shrink-0"} truncate text-xs text-gray-400`,children:e})}var ht=ze(function({value:e,onChange:t,options:r,placeholder:n,invalid:a,className:i="",size:o,touchSize:s,renderOption:c,renderValue:d,valueText:u,readOnly:h,multiple:m,...p},g){const f=t;/* @__PURE__ */
7
+ return Ye("span",{className:`min-w-0 ${t?"shrink":"max-w-[45%] shrink-0"} truncate text-xs text-gray-400`,children:e})}var ht=je(function({value:e,onChange:t,options:r,placeholder:n,invalid:a,className:i="",size:o,touchSize:s,renderOption:c,renderValue:d,valueText:u,readOnly:h,multiple:m,...p},g){const f=t;/* @__PURE__ */
8
8
  return Ge("select",{ref:g,value:e,multiple:m||void 0,onChange:e=>f(m?Array.from(e.target.selectedOptions,e=>e.value):e.target.value),"aria-invalid":a||void 0,className:l({invalid:a,size:o,className:`pr-8 ${i}`.trim()}),...p,children:[void 0!==n&&!m&&/* @__PURE__ */Ye("option",{value:"",disabled:!0,children:n}),
9
9
  /* @__PURE__ */Ye(mt,{items:r})]})});function mt({items:e}){const t=e=>/* @__PURE__ */Ye("option",{value:e.value,disabled:e.disabled,lang:e.lang,children:e.label},e.value);/* @__PURE__ */
10
- return Ye(Xe,{children:e.map((e,r)=>(e=>lt(e))(e)?/* @__PURE__ */Ye("optgroup",{label:e.label,children:e.options.map(t)},`group-${r}`):t(e))})}var pt=ze(function({value:e,onChange:t,options:r,placeholder:n,invalid:a,className:o="",id:s,disabled:c,size:d,touchSize:u,title:h,multiple:m,renderOption:p,renderValue:g,valueText:f,readOnly:b=!1,"aria-describedby":x,"aria-label":y,"aria-labelledby":v,...w},N){const[M,C]=Ee(!1),[L,S]=Ee(-1),D=Be(null),P=Be(null),A=Be(null),z=Be(M);z.current=M;const j=Be({buffer:"",timer:null}),F=je(),E=`${F}-listbox`,B=s??`${F}-trigger`,T=e=>`${F}-opt-${e}`,I=Te(()=>it(r),[r]),O=m?e:[],R=t,W=k(P,M,{matchTriggerWidth:!0}),K=m?I.findIndex(e=>O.includes(e.value)):I.findIndex(t=>t.value===e),q=m?I.filter(e=>O.includes(e.value)).map(e=>e.label).join(", ")||void 0:K>=0?I[K].label:void 0,H=!m&&K>=0?I[K].lang:void 0,_=m?I.filter(e=>O.includes(e.value)):K>=0?[I[K]]:[],U=g&&_.length?g(_):void 0,V=void 0!==U&&f?f(_):void 0,Y=Fe((e=!0)=>{C(!1),S(-1),e&&P.current?.focus()},[]),G=Fe(()=>{c||b||(S(K>=0?K:tt(I)),C(!0))},[c,b,I,K]),Z=Fe(t=>{const r=I[t];if(r&&!r.disabled){if(m){const n=e;return R(n.includes(r.value)?n.filter(e=>e!==r.value):[...n,r.value]),void S(t)}R(r.value),Y()}},[I,m,e,R,Y]);Ie(()=>{if(!M)return;return Q(e=>!("Escape"!==e.key||!z.current)&&(Y(),!0),()=>A.current)},[M,Y]),Ie(()=>{if(!M)return;const e=e=>{const t=e.target;D.current?.contains(t)||A.current?.contains(t)||Y(!1)};document.addEventListener("pointerdown",e);const t=ee(()=>Y(!1));return()=>{document.removeEventListener("pointerdown",e),t()}},[M,Y]),Ie(()=>{!M||L<0||A.current?.querySelector(`#${CSS.escape(T(L))}`)?.scrollIntoView({block:"nearest"})});const J=Fe(e=>{const t=j.current;t.timer&&clearTimeout(t.timer),t.buffer+=e,t.timer=setTimeout(()=>{t.buffer="",t.timer=null},500);const r=M?L:K,n=at(I,t.buffer,r);n<0||(M?S(n):m?(S(n),C(!0)):Z(n))},[M,L,K,I,Z,m]),re=M?st(r,(t,r)=>{const n=(a=t.value,m?O.includes(a):e===a);var a;const l=r===L;/* @__PURE__ */
10
+ return Ye(Xe,{children:e.map((e,r)=>(e=>lt(e))(e)?/* @__PURE__ */Ye("optgroup",{label:e.label,children:e.options.map(t)},`group-${r}`):t(e))})}var pt=je(function({value:e,onChange:t,options:r,placeholder:n,invalid:a,className:o="",id:s,disabled:c,size:d,touchSize:u,title:h,multiple:m,renderOption:p,renderValue:g,valueText:f,readOnly:b=!1,"aria-describedby":x,"aria-label":y,"aria-labelledby":v,...w},N){const[M,C]=Ee(!1),[L,S]=Ee(-1),D=Be(null),P=Be(null),A=Be(null),j=Be(M);j.current=M;const z=Be({buffer:"",timer:null}),F=ze(),E=`${F}-listbox`,B=s??`${F}-trigger`,T=e=>`${F}-opt-${e}`,I=Te(()=>it(r),[r]),O=m?e:[],R=t,W=k(P,M,{matchTriggerWidth:!0}),K=m?I.findIndex(e=>O.includes(e.value)):I.findIndex(t=>t.value===e),_=m?I.filter(e=>O.includes(e.value)).map(e=>e.label).join(", ")||void 0:K>=0?I[K].label:void 0,q=!m&&K>=0?I[K].lang:void 0,H=m?I.filter(e=>O.includes(e.value)):K>=0?[I[K]]:[],U=g&&H.length?g(H):void 0,V=void 0!==U&&f?f(H):void 0,Y=Fe((e=!0)=>{C(!1),S(-1),e&&P.current?.focus()},[]),G=Fe(()=>{c||b||(S(K>=0?K:tt(I)),C(!0))},[c,b,I,K]),Z=Fe(t=>{const r=I[t];if(r&&!r.disabled){if(m){const n=e;return R(n.includes(r.value)?n.filter(e=>e!==r.value):[...n,r.value]),void S(t)}R(r.value),Y()}},[I,m,e,R,Y]);Ie(()=>{if(!M)return;return Q(e=>!("Escape"!==e.key||!j.current)&&(Y(),!0),()=>A.current)},[M,Y]),Ie(()=>{if(!M)return;const e=e=>{const t=e.target;D.current?.contains(t)||A.current?.contains(t)||Y(!1)};document.addEventListener("pointerdown",e);const t=ee(()=>Y(!1));return()=>{document.removeEventListener("pointerdown",e),t()}},[M,Y]),Ie(()=>{!M||L<0||A.current?.querySelector(`#${CSS.escape(T(L))}`)?.scrollIntoView({block:"nearest"})});const J=Fe(e=>{const t=z.current;t.timer&&clearTimeout(t.timer),t.buffer+=e,t.timer=setTimeout(()=>{t.buffer="",t.timer=null},500);const r=M?L:K,n=at(I,t.buffer,r);n<0||(M?S(n):m?(S(n),C(!0)):Z(n))},[M,L,K,I,Z,m]),re=M?st(r,(t,r)=>{const n=(a=t.value,m?O.includes(a):e===a);var a;const l=r===L;/* @__PURE__ */
11
11
  return Ge("div",{id:T(r),role:"option",lang:t.description||p?void 0:t.lang,"aria-selected":n,"aria-disabled":t.disabled||void 0,onPointerEnter:()=>{t.disabled||S(r)},onClick:()=>Z(r),className:`mx-1 cursor-pointer truncate rounded-lg min-h-(--row-height-menu) px-3 py-2 text-sm leading-5${m?" flex items-center gap-2":""}\n ${t.disabled?"cursor-not-allowed text-gray-400":l?"bg-blue-50 text-blue-700":n?"font-medium text-blue-600":"text-gray-700"}`,children:[m&&/* @__PURE__ */Ye(ct,{selected:n}),p?/* @__PURE__ */Ye("span",{className:"block min-w-0 flex-1 truncate",children:p(t,{selected:n,active:l})}):m?/* @__PURE__ */Ge("span",{className:"block min-w-0 flex-1",children:[
12
12
  /* @__PURE__ */Ye("span",{lang:t.lang,className:"block truncate",children:t.label}),t.description&&/* @__PURE__ */Ye("span",{className:"mt-0.5 block truncate text-xs leading-4 font-normal text-gray-500",children:t.description})]}):t.description?
13
13
  /* @__PURE__ */Ge(Xe,{children:[
@@ -17,21 +17,21 @@ return Ge("div",{ref:D,className:"relative",children:[
17
17
  /* @__PURE__ */Ye("button",{ref:P,id:B,type:"button",role:"combobox","aria-haspopup":"listbox","aria-expanded":M,"aria-controls":M?E:void 0,"aria-activedescendant":M&&L>=0?T(L):void 0,"aria-invalid":a||void 0,"aria-describedby":x,"aria-label":y,"aria-labelledby":v,title:h,disabled:c,"aria-readonly":b||void 0,onClick:()=>M?Y():G(),onKeyDown:e=>{if(!c&&!b)switch(e.key){case"ArrowDown":return e.preventDefault(),void(M?S(e=>nt(I,e,1)):G());case"ArrowUp":return e.preventDefault(),void(M?S(e=>nt(I,e,-1)):G());case"Home":return void(M&&(e.preventDefault(),S(tt(I))));case"End":return void(M&&(e.preventDefault(),S(rt(I))));case"Enter":return void(M&&(e.preventDefault(),Z(L)));case" ":return e.preventDefault(),void(M?Z(L):G());case"Escape":return void(M&&(e.preventDefault(),e.stopPropagation(),Y()));case"Tab":return void(M&&Y(!1));default:1!==e.key.length||e.metaKey||e.ctrlKey||e.altKey||(e.preventDefault(),J(e.key))}},className:l({invalid:a,size:d,readOnly:b,className:`${b?"":"pr-8 "}text-left ${o}`.trim()}),children:void 0!==U?
18
18
  /* @__PURE__ */Ge("span",{className:"relative block min-w-0 truncate",children:[
19
19
  /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-select-value":"",className:"flex min-w-0 items-center gap-2 truncate",children:U}),
20
- /* @__PURE__ */Ye("span",{lang:void 0===V?H:void 0,className:"sr-only",children:V??q})]}):/* @__PURE__ */Ye("span",{lang:H,className:"block truncate "+(void 0===q?"text-gray-400":""),children:q??n??" "})}),!b&&/* @__PURE__ */Ye(Pe,{name:"chevron-up-down","aria-hidden":"true",className:`pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 ${i}`,strokeWidth:2}),
20
+ /* @__PURE__ */Ye("span",{lang:void 0===V?q:void 0,className:"sr-only",children:V??_})]}):/* @__PURE__ */Ye("span",{lang:q,className:"block truncate "+(void 0===_?"text-gray-400":""),children:_??n??" "})}),!b&&/* @__PURE__ */Ye(Pe,{name:"chevron-up-down","aria-hidden":"true",className:`pointer-events-none absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 ${i}`,strokeWidth:2}),
21
21
  /* @__PURE__ */Ge("select",{ref:N,value:e,multiple:m||void 0,onChange:e=>R(m?Array.from(e.target.selectedOptions,e=>e.value):e.target.value),disabled:c,"aria-hidden":"true",tabIndex:-1,className:"sr-only",...w,children:[void 0!==n&&!m&&/* @__PURE__ */Ye("option",{value:"",disabled:!0,children:n}),
22
22
  /* @__PURE__ */Ye(mt,{items:r})]}),M&&Ze(
23
- /* @__PURE__ */Ye("div",{ref:A,id:E,role:"listbox","aria-labelledby":v??(y?void 0:B),"aria-label":v?void 0:y,"aria-multiselectable":m||void 0,className:"fixed overflow-y-auto rounded-(--radius-popup) py-1",style:{zIndex:te.popup,left:W?.left,top:W?.top,bottom:W?.bottom,width:W?.width,maxHeight:W?.maxHeight??$,visibility:W?void 0:"hidden",...X()},children:re}),document.body)]})}),gt=ze(function({touchSize:e="touch",...t},r){return f()&&!t.readOnly?/* @__PURE__ */Ye(ht,{ref:r,...t,size:e}):/* @__PURE__ */Ye(pt,{ref:r,...t})});function ft(e,t,r,n){const a=je(),l=!!e&&!!t,i=l?`${a}-label`:void 0,o=l?`${a}-description`:void 0;return{labelId:i,descriptionId:o,labelledBy:r??i,describedBy:[n,o].filter(Boolean).join(" ")||void 0}}var bt=ze(function({checked:e,onChange:t,indeterminate:r=!1,label:n,description:a,disabled:l,className:i="","aria-labelledby":o,"aria-describedby":s,...c},d){const u=Be(null),h=ft(n,a,o,s);Ie(()=>{u.current&&(u.current.indeterminate=r)},[r,e]);const m=Fe(e=>{u.current=e,"function"==typeof d?d(e):d&&(d.current=e)},[d]),p=(r="")=>/* @__PURE__ */Ye("input",{ref:m,type:"checkbox",checked:e,disabled:l,onChange:e=>t(e.target.checked),className:`h-4 w-4 shrink-0 rounded border-gray-300 accent-blue-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 ${r}`.trim(),"aria-labelledby":h.labelledBy,"aria-describedby":h.describedBy,...c});return n||a?/* @__PURE__ */Ge("label",{className:`flex items-start gap-2 ${l?"cursor-not-allowed opacity-60":"cursor-pointer"} ${i}`.trim(),children:[p("mt-0.5"),
24
- /* @__PURE__ */Ge("span",{className:"text-sm leading-tight",children:[n&&/* @__PURE__ */Ye("span",{id:h.labelId,className:"font-medium text-gray-700",children:n}),a&&/* @__PURE__ */Ye("span",{id:h.descriptionId,className:"mt-0.5 block text-xs text-gray-500",children:a})]})]}):p(i)}),xt="h-4 w-4 shrink-0 border-gray-300 accent-blue-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60",yt=ze(function({checked:e,onChange:t,label:r,description:n,disabled:a,className:l="","aria-labelledby":i,"aria-describedby":o,...s},c){const d=ft(r,n,i,o);return r||n?/* @__PURE__ */Ge("label",{className:`flex items-start gap-2 ${a?"cursor-not-allowed opacity-60":"cursor-pointer"} ${l}`.trim(),children:[
23
+ /* @__PURE__ */Ye("div",{ref:A,id:E,role:"listbox","aria-labelledby":v??(y?void 0:B),"aria-label":v?void 0:y,"aria-multiselectable":m||void 0,className:"fixed overflow-y-auto rounded-(--radius-popup) py-1",style:{zIndex:te.popup,left:W?.left,top:W?.top,bottom:W?.bottom,width:W?.width,maxHeight:W?.maxHeight??$,visibility:W?void 0:"hidden",...X()},children:re}),document.body)]})}),gt=je(function({touchSize:e="touch",...t},r){return f()&&!t.readOnly?/* @__PURE__ */Ye(ht,{ref:r,...t,size:e}):/* @__PURE__ */Ye(pt,{ref:r,...t})});function ft(e,t,r,n){const a=ze(),l=!!e&&!!t,i=l?`${a}-label`:void 0,o=l?`${a}-description`:void 0;return{labelId:i,descriptionId:o,labelledBy:r??i,describedBy:[n,o].filter(Boolean).join(" ")||void 0}}var bt=je(function({checked:e,onChange:t,indeterminate:r=!1,label:n,description:a,disabled:l,className:i="","aria-labelledby":o,"aria-describedby":s,...c},d){const u=Be(null),h=ft(n,a,o,s);Ie(()=>{u.current&&(u.current.indeterminate=r)},[r,e]);const m=Fe(e=>{u.current=e,"function"==typeof d?d(e):d&&(d.current=e)},[d]),p=(r="")=>/* @__PURE__ */Ye("input",{ref:m,type:"checkbox",checked:e,disabled:l,onChange:e=>t(e.target.checked),className:`h-4 w-4 shrink-0 rounded border-gray-300 accent-blue-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 ${r}`.trim(),"aria-labelledby":h.labelledBy,"aria-describedby":h.describedBy,...c});return n||a?/* @__PURE__ */Ge("label",{className:`flex items-start gap-2 ${l?"cursor-not-allowed opacity-60":"cursor-pointer"} ${i}`.trim(),children:[p("mt-0.5"),
24
+ /* @__PURE__ */Ge("span",{className:"text-sm leading-tight",children:[n&&/* @__PURE__ */Ye("span",{id:h.labelId,className:"font-medium text-gray-700",children:n}),a&&/* @__PURE__ */Ye("span",{id:h.descriptionId,className:"mt-0.5 block text-xs text-gray-500",children:a})]})]}):p(i)}),xt="h-4 w-4 shrink-0 border-gray-300 accent-blue-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60",yt=je(function({checked:e,onChange:t,label:r,description:n,disabled:a,className:l="","aria-labelledby":i,"aria-describedby":o,...s},c){const d=ft(r,n,i,o);return r||n?/* @__PURE__ */Ge("label",{className:`flex items-start gap-2 ${a?"cursor-not-allowed opacity-60":"cursor-pointer"} ${l}`.trim(),children:[
25
25
  /* @__PURE__ */Ye("input",{ref:c,type:"radio",checked:e,disabled:a,onChange:e=>t(e.target.checked),className:`${xt} mt-0.5`,"aria-labelledby":d.labelledBy,"aria-describedby":d.describedBy,...s}),
26
26
  /* @__PURE__ */Ge("span",{className:"min-w-0 flex-1 text-sm leading-tight",children:[r&&/* @__PURE__ */Ye("span",{id:d.labelId,className:"block min-w-0 font-medium text-gray-700",children:r}),n&&/* @__PURE__ */Ye("span",{id:d.descriptionId,className:"mt-0.5 block min-w-0 text-xs text-gray-500",children:n})]})]}):/* @__PURE__ */Ye("input",{ref:c,type:"radio",checked:e,disabled:a,onChange:e=>t(e.target.checked),className:`${xt} ${l}`.trim(),"aria-labelledby":d.labelledBy,"aria-describedby":d.describedBy,...s})});function vt({label:e,htmlFor:t,labelId:r,hint:n,error:a,required:l,className:i="",children:o}){const s=t?a?`${t}-error`:n?`${t}-hint`:void 0:void 0,c=1===Re.count(o)?Re.only(o):null,d=We(c)?c:null,u={};if(d){if(s){const e=(d.props["aria-describedby"]??"").split(/\s+/);u["aria-describedby"]=Array.from(new Set([...e,s].filter(Boolean))).join(" ")}a&&void 0===d.props["aria-invalid"]&&(u["aria-invalid"]=!0)}const h=d&&Object.keys(u).length>0?Ke(d,u):o;/* @__PURE__ */
27
27
  return Ge("div",{className:i,children:[e&&/* @__PURE__ */Ge("label",{id:r,htmlFor:t,className:"mb-1 block text-xs font-medium text-gray-600",children:[e,l&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"ml-0.5 text-red-500",children:"*"})]}),h,a?
28
- /* @__PURE__ */Ye("p",{id:t?`${t}-error`:void 0,role:"alert",className:"mt-1 text-2xs text-red-600",children:a}):n?/* @__PURE__ */Ye("p",{id:t?`${t}-hint`:void 0,className:"mt-1 text-2xs text-gray-400",children:n}):null]})}var wt={vertical:"flex flex-col gap-2",horizontal:"flex flex-wrap items-start gap-x-6 gap-y-2"};function Nt({label:e,hint:t,error:r,required:n,name:a,value:l,onChange:i,options:o,orientation:s="vertical",disabled:c=!1,className:d=""}){const u=je(),h=e?`${u}-label`:void 0;/* @__PURE__ */
28
+ /* @__PURE__ */Ye("p",{id:t?`${t}-error`:void 0,role:"alert",className:"mt-1 text-2xs text-red-600",children:a}):n?/* @__PURE__ */Ye("p",{id:t?`${t}-hint`:void 0,className:"mt-1 text-2xs text-gray-400",children:n}):null]})}var wt={vertical:"flex flex-col gap-2",horizontal:"flex flex-wrap items-start gap-x-6 gap-y-2"};function Nt({label:e,hint:t,error:r,required:n,name:a,value:l,onChange:i,options:o,orientation:s="vertical",disabled:c=!1,className:d=""}){const u=ze(),h=e?`${u}-label`:void 0;/* @__PURE__ */
29
29
  return Ye(vt,{label:e,labelId:h,htmlFor:u,hint:t,error:r,required:n,className:d,children:/* @__PURE__ */Ye("div",{id:u,role:"radiogroup","aria-labelledby":h,"aria-required":n||void 0,className:wt[s],children:o.map(e=>/* @__PURE__ */Ye(yt,{name:a,value:e.value,checked:l===e.value,onChange:t=>{t&&i(e.value)},label:e.label,description:e.description,disabled:c||e.disabled},e.value))})})}function kt({errors:e,title:t,autoFocus:r=!0,className:n=""}){const a=he(),l=Be(null),i=Be(!1);if(Ie(()=>{const t=e.length>0;t&&!i.current&&r&&l.current?.focus(),i.current=t},[e.length>0,r]),0===e.length)return null;/* @__PURE__ */
30
30
  return Ge("div",{ref:l,role:"alert",tabIndex:-1,className:`rounded-md border border-red-300 bg-red-50 px-4 py-3 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-invalid-solid)] ${n}`.trim(),children:[
31
31
  /* @__PURE__ */Ye("h2",{className:"text-sm font-semibold text-red-800",children:t??a.form.errorSummaryTitle}),
32
32
  /* @__PURE__ */Ye("ul",{className:"mt-2 space-y-1",children:e.map(({fieldId:e,message:t},r)=>/* @__PURE__ */Ye("li",{children:e?/* @__PURE__ */Ye("a",{href:`#${e}`,onClick:t=>{t.preventDefault(),(e=>{const t=document.getElementById(e);t&&(t.scrollIntoView({block:"center"}),t.focus())})(e)},className:"text-sm text-red-700 underline hover:text-red-900",children:t}):
33
33
  /* @__PURE__ */Ye("span",{className:"text-sm text-red-700",children:t})},`${e??""}-${r}`))})]})}var $t="text-xs font-medium text-gray-600";function Mt({inline:e=!1,className:t=""}={}){return[e?"":"mb-1 block",$t,t].filter(Boolean).join(" ")}function Ct({required:e,children:t,className:r="",...n}){/* @__PURE__ */
34
- return Ge("label",{className:Mt({className:r}),...n,children:[t,e&&/* @__PURE__ */Ye("span",{className:"ml-0.5 text-red-500",children:"*"})]})}var Lt=/^data:([a-z0-9!#$&^_.+-]+)\/([a-z0-9!#$&^_.+-]+)/i;function St(e){if(/^data:/i.test(e||""))return function(e){const t=Lt.exec(e);if(!t)return"media";const[,r,n]=t,a=n.split("+")[0].split(".").pop().replace(/^x-/i,"");return a?`${r.toLowerCase()}.${a.toLowerCase()}`:"media"}(e);const t=(e||"").split("?")[0].split("#")[0],r=t.substring(t.lastIndexOf("/")+1);try{return decodeURIComponent(r.replace(/^[0-9a-f]{32}_/i,""))||r||"media"}catch{return r||"media"}}var Dt=/\.(mp4|webm|ogg|ogv|mov|m4v)(\?|#|$)/i;function Pt(e,t=me.media){const r=function(e){const t=e.includes("video"),r=e.includes("image")||"*"===e||""===e;return t&&!r?"video":r&&!t?"image":"file"}(e);return"image"===r?t.uploadImage:"video"===r?t.uploadVideo:t.uploadFile}function At(e,t,r="",n="p-4"){return["flex w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed text-center transition-colors",n,t?"cursor-not-allowed opacity-60":"cursor-pointer",e?"border-blue-500 bg-blue-50":"border-gray-300 bg-gray-50 hover:bg-gray-100",r].filter(Boolean).join(" ")}function zt(e){return e?"rosh-focus-ring":"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-zone)]"}function jt({label:e,rounded:t="rounded-lg"}){/* @__PURE__ */
34
+ return Ge("label",{className:Mt({className:r}),...n,children:[t,e&&/* @__PURE__ */Ye("span",{className:"ml-0.5 text-red-500",children:"*"})]})}var Lt=/^data:([a-z0-9!#$&^_.+-]+)\/([a-z0-9!#$&^_.+-]+)/i;function St(e){if(/^data:/i.test(e||""))return function(e){const t=Lt.exec(e);if(!t)return"media";const[,r,n]=t,a=n.split("+")[0].split(".").pop().replace(/^x-/i,"");return a?`${r.toLowerCase()}.${a.toLowerCase()}`:"media"}(e);const t=(e||"").split("?")[0].split("#")[0],r=t.substring(t.lastIndexOf("/")+1);try{return decodeURIComponent(r.replace(/^[0-9a-f]{32}_/i,""))||r||"media"}catch{return r||"media"}}var Dt=/\.(mp4|webm|ogg|ogv|mov|m4v)(\?|#|$)/i;function Pt(e,t=me.media){const r=function(e){const t=e.includes("video"),r=e.includes("image")||"*"===e||""===e;return t&&!r?"video":r&&!t?"image":"file"}(e);return"image"===r?t.uploadImage:"video"===r?t.uploadVideo:t.uploadFile}function At(e,t,r="",n="p-4"){return["flex w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed text-center transition-colors",n,t?"cursor-not-allowed opacity-60":"cursor-pointer",e?"border-blue-500 bg-blue-50":"border-gray-300 bg-gray-50 hover:bg-gray-100",r].filter(Boolean).join(" ")}function jt(e){return e?"rosh-focus-ring":"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-zone)]"}function zt({label:e,rounded:t="rounded-lg"}){/* @__PURE__ */
35
35
  return Ge("div",{role:"status",className:`absolute inset-0 flex items-center justify-center gap-2 bg-white/60 ${t}`,children:[
36
36
  /* @__PURE__ */Ye(Bt,{}),
37
37
  /* @__PURE__ */Ye("span",{className:"text-xs font-medium text-gray-600",children:e})]})}function Ft({children:e}){/* @__PURE__ */
@@ -40,22 +40,22 @@ return Ge("svg",{className:`${e} animate-spin text-gray-400`,viewBox:"0 0 24 24"
40
40
  /* @__PURE__ */Ye("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),
41
41
  /* @__PURE__ */Ye("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]})}function Tt({className:e="h-4 w-4"}){/* @__PURE__ */
42
42
  return Ye(Pe,{name:"close",className:e,strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})}function It({className:e="h-6 w-6"}){/* @__PURE__ */
43
- return Ye(Pe,{name:"upload",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function Ot({value:e,onChange:t,onPick:r,onFile:n,label:a,hint:l,error:i,required:o,className:s,accept:c="image/*",maxSizeBytes:d,fit:u="cover",height:h=112,placeholder:m,cta:p,acceptHint:g,showFilename:f=!0,allowReplace:b=!0,allowRemove:x=!0,replaceLabel:y,removeLabel:v,busy:w=!1,busyLabel:N,disabled:k=!1}){const $=he().media,C=p??$.cta,L=y??$.replace,S=v??$.remove,D=N??$.uploading,P=je(),A=Be(null),[z,j]=Ee(null);Ie(()=>()=>{A.current&&URL.revokeObjectURL(A.current)},[]);const F=k||w,E=!!e&&(Et(e,c)||e===z),B=m??Pt(c,$),T=e=>{r?r(e):n?n(e):(e=>{A.current&&URL.revokeObjectURL(A.current);const r=URL.createObjectURL(e);A.current=r,j(e.type.startsWith("video/")?r:null),t(r)})(e)},I=se({accept:c,maxSizeBytes:d,acceptHint:g,multiple:!1,disabled:F,onAccept:([e])=>T(e)}),{dragOver:O}=I,R=()=>{F||(r?r():I.open())},W=e?St(e):"",K=/* @__PURE__ */Ge("div",{children:[
44
- /* @__PURE__ */Ge("div",{...I.zoneProps,className:["relative overflow-hidden rounded-md border bg-gray-100 transition-colors",O?"border-blue-500":"border-gray-200"].join(" "),style:{height:h},children:[E?/* @__PURE__ */Ye("video",{src:e??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":W||void 0,className:"h-full w-full",style:{objectFit:u}}):/* @__PURE__ */Ye("img",{src:e??void 0,alt:W,className:"h-full w-full",style:{objectFit:u}}),f&&e&&/* @__PURE__ */Ye(Ft,{children:W}),w&&/* @__PURE__ */Ye(jt,{label:D,rounded:"rounded-md"})]}),!k&&(b||x)&&/* @__PURE__ */Ge("div",{className:"mt-2 flex gap-2",children:[b&&/* @__PURE__ */Ye(M,{id:P,variant:"secondary",size:"sm",onClick:()=>R(),disabled:w,children:L}),x&&/* @__PURE__ */Ye(M,{variant:"ghost",size:"sm",onClick:()=>{A.current&&(URL.revokeObjectURL(A.current),A.current=null),j(null),t("")},disabled:w,children:S})]})]}),q=/* @__PURE__ */Ye("button",{type:"button",id:P,onClick:()=>R(),disabled:F,"aria-label":"string"==typeof B?B:$.upload,"aria-busy":w||void 0,"aria-invalid":!!i||void 0,"aria-required":o||void 0,"aria-describedby":i?`${P}-error`:l?`${P}-hint`:void 0,...I.zoneProps,className:At(O,F,zt(F)),style:{minHeight:h},children:w?/* @__PURE__ */Ge("span",{role:"status",className:"flex flex-col items-center gap-2",children:[
43
+ return Ye(Pe,{name:"upload",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e})}function Ot({value:e,onChange:t,onPick:r,onFile:n,label:a,hint:l,error:i,required:o,className:s,accept:c="image/*",maxSizeBytes:d,fit:u="cover",height:h=112,placeholder:m,cta:p,acceptHint:g,showFilename:f=!0,allowReplace:b=!0,allowRemove:x=!0,replaceLabel:y,removeLabel:v,busy:w=!1,busyLabel:N,disabled:k=!1}){const $=he().media,C=p??$.cta,L=y??$.replace,S=v??$.remove,D=N??$.uploading,P=ze(),A=Be(null),[j,z]=Ee(null);Ie(()=>()=>{A.current&&URL.revokeObjectURL(A.current)},[]);const F=k||w,E=!!e&&(Et(e,c)||e===j),B=m??Pt(c,$),T=e=>{r?r(e):n?n(e):(e=>{A.current&&URL.revokeObjectURL(A.current);const r=URL.createObjectURL(e);A.current=r,z(e.type.startsWith("video/")?r:null),t(r)})(e)},I=se({accept:c,maxSizeBytes:d,acceptHint:g,multiple:!1,disabled:F,onAccept:([e])=>T(e)}),{dragOver:O}=I,R=()=>{F||(r?r():I.open())},W=e?St(e):"",K=/* @__PURE__ */Ge("div",{children:[
44
+ /* @__PURE__ */Ge("div",{...I.zoneProps,className:["relative overflow-hidden rounded-md border bg-gray-100 transition-colors",O?"border-blue-500":"border-gray-200"].join(" "),style:{height:h},children:[E?/* @__PURE__ */Ye("video",{src:e??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":W||void 0,className:"h-full w-full",style:{objectFit:u}}):/* @__PURE__ */Ye("img",{src:e??void 0,alt:W,className:"h-full w-full",style:{objectFit:u}}),f&&e&&/* @__PURE__ */Ye(Ft,{children:W}),w&&/* @__PURE__ */Ye(zt,{label:D,rounded:"rounded-md"})]}),!k&&(b||x)&&/* @__PURE__ */Ge("div",{className:"mt-2 flex gap-2",children:[b&&/* @__PURE__ */Ye(M,{id:P,variant:"secondary",size:"sm",onClick:()=>R(),disabled:w,children:L}),x&&/* @__PURE__ */Ye(M,{variant:"ghost",size:"sm",onClick:()=>{A.current&&(URL.revokeObjectURL(A.current),A.current=null),z(null),t("")},disabled:w,children:S})]})]}),_=/* @__PURE__ */Ye("button",{type:"button",id:P,onClick:()=>R(),disabled:F,"aria-label":"string"==typeof B?B:$.upload,"aria-busy":w||void 0,"aria-invalid":!!i||void 0,"aria-required":o||void 0,"aria-describedby":i?`${P}-error`:l?`${P}-hint`:void 0,...I.zoneProps,className:At(O,F,jt(F)),style:{minHeight:h},children:w?/* @__PURE__ */Ge("span",{role:"status",className:"flex flex-col items-center gap-2",children:[
45
45
  /* @__PURE__ */Ye(Bt,{}),
46
46
  /* @__PURE__ */Ye("span",{className:"text-xs font-medium text-gray-500",children:D})]}):/* @__PURE__ */Ge(Xe,{children:[
47
47
  /* @__PURE__ */Ye("span",{className:"text-gray-400",children:/* @__PURE__ */Ye(It,{})}),
48
48
  /* @__PURE__ */Ye("span",{className:"px-3 text-xs text-gray-500",children:B}),
49
49
  /* @__PURE__ */Ye("span",{className:"text-sm font-medium text-blue-600",children:C}),g&&/* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:g})]})});/* @__PURE__ */
50
- return Ge(vt,{label:a,htmlFor:P,hint:l,error:i,required:o,className:s,children:[e?K:q,!r&&/* @__PURE__ */Ye("input",{...I.inputProps}),
51
- /* @__PURE__ */Ye(de,{rejections:I.rejections})]})}function Rt({committedUrl:e,committedHasAlpha:t=null,committedIsLight:n=null,fallbackUrl:a,fallbackHasAlpha:l=null,fallbackIsLight:i=null,subjectName:o,assetName:s,onSave:c,onRemove:d,accept:u="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:h="PNG · ICO · SVG · JPG · WEBP",maxBytes:m=5242880,previews:p=[],disabled:g=!1}){const f=Be(null),[b,x]=Ee(null),[y,v]=Ee(""),[w,N]=Ee(""),[k,$]=Ee(!1),[C,L]=Ee(!1),S=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(s),D=he().brandAsset,P=y||e||a||"",A=b?null:e?t:l,z=b?null:e?n:i;Ie(()=>()=>{f.current&&URL.revokeObjectURL(f.current)},[]);const j=()=>{f.current&&(URL.revokeObjectURL(f.current),f.current=null)};/* @__PURE__ */
50
+ return Ge(vt,{label:a,htmlFor:P,hint:l,error:i,required:o,className:s,children:[e?K:_,!r&&/* @__PURE__ */Ye("input",{...I.inputProps}),
51
+ /* @__PURE__ */Ye(de,{rejections:I.rejections})]})}function Rt({committedUrl:e,committedHasAlpha:t=null,committedIsLight:n=null,fallbackUrl:a,fallbackHasAlpha:l=null,fallbackIsLight:i=null,subjectName:o,assetName:s,onSave:c,onRemove:d,accept:u="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:h="PNG · ICO · SVG · JPG · WEBP",maxBytes:m=5242880,previews:p=[],disabled:g=!1}){const f=Be(null),[b,x]=Ee(null),[y,v]=Ee(""),[w,N]=Ee(""),[k,$]=Ee(!1),[C,L]=Ee(!1),S=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(s),D=he().brandAsset,P=y||e||a||"",A=b?null:e?t:l,j=b?null:e?n:i;Ie(()=>()=>{f.current&&URL.revokeObjectURL(f.current)},[]);const z=()=>{f.current&&(URL.revokeObjectURL(f.current),f.current=null)};/* @__PURE__ */
52
52
  return Ge("section",{"aria-label":D.region(s,o),className:"grid gap-4 lg:grid-cols-2",children:[
53
53
  /* @__PURE__ */Ge("div",{className:"rounded-lg border border-gray-200 bg-white p-4",children:[
54
- /* @__PURE__ */Ye(Ot,{value:P,onChange:()=>{},onFile:e=>{if(g)return;j();const t=URL.createObjectURL(e);f.current=t,x(e),v(t),N("")},label:s,hint:w||D.usedFor(o),error:w||void 0,accept:u,acceptHint:h,maxSizeBytes:m,fit:"contain",height:180,allowRemove:!1,busy:k||C,disabled:g}),
54
+ /* @__PURE__ */Ye(Ot,{value:P,onChange:()=>{},onFile:e=>{if(g)return;z();const t=URL.createObjectURL(e);f.current=t,x(e),v(t),N("")},label:s,hint:w||D.usedFor(o),error:w||void 0,accept:u,acceptHint:h,maxSizeBytes:m,fit:"contain",height:180,allowRemove:!1,busy:k||C,disabled:g}),
55
55
  /* @__PURE__ */Ge("div",{className:"mt-3 flex flex-wrap gap-2",children:[
56
- /* @__PURE__ */Ye(M,{onClick:async()=>{if(b&&!g&&!k){$(!0),N("");try{await c(b),j(),x(null),v("")}catch(e){N(e instanceof Error?e.message:D.saveFailed(S,s))}finally{$(!1)}}},disabled:!b||g,loading:k,children:D.save(S,s)}),(b||e)&&/* @__PURE__ */Ye(M,{variant:"ghost-danger",onClick:async()=>{if(!g&&!C){if(b)return j(),x(null),v(""),void N("");if(e){L(!0),N("");try{await d()}catch(e){N(e instanceof Error?e.message:D.removeFailed(S,s))}finally{L(!1)}}}},disabled:g,loading:C,children:b?D.discard:D.remove(S,s)})]})]}),p.length>0&&/* @__PURE__ */Ge("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":D.previews(s),children:[
56
+ /* @__PURE__ */Ye(M,{onClick:async()=>{if(b&&!g&&!k){$(!0),N("");try{await c(b),z(),x(null),v("")}catch(e){N(e instanceof Error?e.message:D.saveFailed(S,s))}finally{$(!1)}}},disabled:!b||g,loading:k,children:D.save(S,s)}),(b||e)&&/* @__PURE__ */Ye(M,{variant:"ghost-danger",onClick:async()=>{if(!g&&!C){if(b)return z(),x(null),v(""),void N("");if(e){L(!0),N("");try{await d()}catch(e){N(e instanceof Error?e.message:D.removeFailed(S,s))}finally{L(!1)}}}},disabled:g,loading:C,children:b?D.discard:D.remove(S,s)})]})]}),p.length>0&&/* @__PURE__ */Ge("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":D.previews(s),children:[
57
57
  /* @__PURE__ */Ye("h3",{className:"text-sm font-semibold text-gray-900",children:D.preview}),
58
- /* @__PURE__ */Ye("div",{className:"mt-3 grid gap-3",children:p.map(e=>{const t=/* @__PURE__ */Ye(r,{src:P,alt:D.alt(o,s),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:A,isLight:z,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
58
+ /* @__PURE__ */Ye("div",{className:"mt-3 grid gap-3",children:p.map(e=>{const t=/* @__PURE__ */Ye(r,{src:P,alt:D.alt(o,s),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:A,isLight:j,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
59
59
  return Ge("div",{"data-brand-preview":!0,className:"dark"===e.surface?"text-white":"text-gray-900",children:[
60
60
  /* @__PURE__ */Ye("div",{className:"mb-2 text-xs font-medium text-gray-500",children:e.label}),"browser-tab"===e.kind?/* @__PURE__ */Ge("div",{className:"flex items-end gap-1 border-b border-gray-200",children:[
61
61
  /* @__PURE__ */Ge("div",{className:"flex max-w-[220px] items-center gap-2 rounded-t-lg border border-b-0 border-gray-200 bg-white px-3 py-2",children:[t,
@@ -67,40 +67,40 @@ return Ge("div",{"data-brand-preview":!0,className:"dark"===e.surface?"text-whit
67
67
  /* @__PURE__ */Ge("div",{className:"min-w-0 leading-tight",children:[
68
68
  /* @__PURE__ */Ye("div",{className:"truncate text-xs font-medium text-gray-700",children:e.title??o}),e.url&&/* @__PURE__ */Ye("div",{className:"truncate text-xs text-gray-400",children:e.url})]})]}),
69
69
  /* @__PURE__ */Ye("div",{className:"mt-2 text-sm font-medium text-blue-700",children:e.title??o}),e.description&&/* @__PURE__ */Ye("div",{className:"text-xs text-gray-500",children:e.description})]}):/* @__PURE__ */Ge("div",{className:["flex items-center gap-3 rounded-md border border-gray-200 p-3","dark"===e.surface?"bg-gray-900 text-white":"bg-white text-gray-900"].join(" "),children:[t,
70
- /* @__PURE__ */Ye("span",{className:"text-sm",children:e.title??e.label})]})]},`${e.label}-${e.slot}-${e.surface??"light"}`)})})]})]})}function Wt(e,t={}){return t.preferSquare&&e.logo_square_url?{src:e.logo_square_url,hasAlpha:e.logo_square_has_alpha,isLight:e.logo_square_is_light,adaptive:!0}:"dark"===t.surface&&e.logo_on_dark_url?{src:e.logo_on_dark_url,hasAlpha:null,isLight:null,adaptive:!1}:{src:e.logo_url,hasAlpha:e.logo_has_alpha,isLight:e.logo_is_light,adaptive:!0}}var Kt=Oe(null);function qt(e){const t=document.head.querySelector('link[data-portal-branding="favicon"]');if(!e)return void t?.remove();const r=t??document.createElement("link");r.rel="icon",r.href=e,r.dataset.portalBranding="favicon",t||document.head.appendChild(r)}function Ht({load:e,fallback:t,documentTitle:r,children:n}){const[a,l]=Ee(t),[i,o]=Ee(!0),[s,c]=Ee(null),d=Be(e),u=Be(t);d.current=e,u.current=t,Ie(()=>{const e=new AbortController;let t=!0;return l(u.current),o(!0),c(null),d.current(e.signal).then(e=>{t&&(l(e),o(!1))},e=>{t&&(c(e instanceof Error?e:new Error("Could not load portal branding.")),o(!1))}),()=>{t=!1,e.abort()}},[]),Ie(()=>(qt(a.favicon_url),()=>qt(null)),[a.favicon_url]),Ie(()=>{r&&(document.title=r(a))},[a,r]);const h=Te(()=>({branding:a,loading:i,error:s}),[a,i,s]);/* @__PURE__ */
71
- return Ye(Kt.Provider,{value:h,children:n})}function _t(){const e=qe(Kt);if(!e)throw new Error("usePortalBranding must be used inside PortalBrandingProvider.");return e}var Ut=/* @__PURE__ */Ye(Pe,{name:"close",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",className:"h-3 w-3"});function Vt({items:e,onPick:t,onFiles:r,onRemove:n,onReorder:a,label:l,hint:i,error:o,required:s,className:c,accept:d="image/*",maxSizeBytes:u,maxFiles:h,fit:m="cover",thumbSize:p=96,placeholder:g,cta:f,acceptHint:b,showCover:x=!1,coverLabel:y,busy:v=!1,busyLabel:w,disabled:N=!1,readOnly:k=!1}){const $=he().media,M=f??$.cta,C=y??$.cover,L=w??$.uploading,S=je(),[D,P]=Ee(null),A=N||v,z=!(!t&&!r||A||k),j=!!n&&!A&&!k,F=!!a&&!A&&!k,E=zt(A),B=g??Pt(d,$),T=se({accept:d,maxSizeBytes:u,maxFiles:h,acceptHint:b,multiple:!0,disabled:!z,currentCount:e.length,onAccept:e=>{if(r)r(e);else for(const r of e)t(r)}}),I=T.dragOver,O=()=>{z&&(t?t():T.open())},R={width:p,height:p},W=z&&/* @__PURE__ */Ge("button",{type:"button",onClick:()=>O(),"aria-label":$.addMedia,className:`flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500 ${E}`,style:R,children:[
70
+ /* @__PURE__ */Ye("span",{className:"text-sm",children:e.title??e.label})]})]},`${e.label}-${e.slot}-${e.surface??"light"}`)})})]})]})}function Wt(e,t={}){return t.preferSquare&&e.logo_square_url?{src:e.logo_square_url,hasAlpha:e.logo_square_has_alpha,isLight:e.logo_square_is_light,adaptive:!0}:"dark"===t.surface&&e.logo_on_dark_url?{src:e.logo_on_dark_url,hasAlpha:null,isLight:null,adaptive:!1}:{src:e.logo_url,hasAlpha:e.logo_has_alpha,isLight:e.logo_is_light,adaptive:!0}}var Kt=Oe(null);function _t(e){const t=document.head.querySelector('link[data-portal-branding="favicon"]');if(!e)return void t?.remove();const r=t??document.createElement("link");r.rel="icon",r.href=e,r.dataset.portalBranding="favicon",t||document.head.appendChild(r)}function qt({load:e,fallback:t,documentTitle:r,children:n}){const[a,l]=Ee(t),[i,o]=Ee(!0),[s,c]=Ee(null),d=Be(e),u=Be(t);d.current=e,u.current=t,Ie(()=>{const e=new AbortController;let t=!0;return l(u.current),o(!0),c(null),d.current(e.signal).then(e=>{t&&(l(e),o(!1))},e=>{t&&(c(e instanceof Error?e:new Error("Could not load portal branding.")),o(!1))}),()=>{t=!1,e.abort()}},[]),Ie(()=>(_t(a.favicon_url),()=>_t(null)),[a.favicon_url]),Ie(()=>{r&&(document.title=r(a))},[a,r]);const h=Te(()=>({branding:a,loading:i,error:s}),[a,i,s]);/* @__PURE__ */
71
+ return Ye(Kt.Provider,{value:h,children:n})}function Ht(){const e=_e(Kt);if(!e)throw new Error("usePortalBranding must be used inside PortalBrandingProvider.");return e}var Ut=/* @__PURE__ */Ye(Pe,{name:"close",strokeWidth:2,strokeLinecap:"round","aria-hidden":"true",className:"h-3 w-3"});function Vt({items:e,onPick:t,onFiles:r,onRemove:n,onReorder:a,label:l,hint:i,error:o,required:s,className:c,accept:d="image/*",maxSizeBytes:u,maxFiles:h,fit:m="cover",thumbSize:p=96,placeholder:g,cta:f,acceptHint:b,showCover:x=!1,coverLabel:y,busy:v=!1,busyLabel:w,disabled:N=!1,readOnly:k=!1}){const $=he().media,M=f??$.cta,C=y??$.cover,L=w??$.uploading,S=ze(),[D,P]=Ee(null),A=N||v,j=!(!t&&!r||A||k),z=!!n&&!A&&!k,F=!!a&&!A&&!k,E=jt(A),B=g??Pt(d,$),T=se({accept:d,maxSizeBytes:u,maxFiles:h,acceptHint:b,multiple:!0,disabled:!j,currentCount:e.length,onAccept:e=>{if(r)r(e);else for(const r of e)t(r)}}),I=T.dragOver,O=()=>{j&&(t?t():T.open())},R={width:p,height:p},W=j&&/* @__PURE__ */Ge("button",{type:"button",onClick:()=>O(),"aria-label":$.addMedia,className:`flex shrink-0 flex-col items-center justify-center gap-1 rounded-md border-2 border-dashed border-gray-300 bg-gray-50 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-500 ${E}`,style:R,children:[
72
72
  /* @__PURE__ */Ye(It,{className:"h-5 w-5"}),
73
- /* @__PURE__ */Ye("span",{className:"text-xs font-medium text-gray-500",children:$.add})]}),K=z?/* @__PURE__ */Ge("button",{type:"button",onClick:()=>O(),"aria-label":"string"==typeof B?B:$.upload,className:At(I,!1,E),style:{minHeight:p+32},children:[
73
+ /* @__PURE__ */Ye("span",{className:"text-xs font-medium text-gray-500",children:$.add})]}),K=j?/* @__PURE__ */Ge("button",{type:"button",onClick:()=>O(),"aria-label":"string"==typeof B?B:$.upload,className:At(I,!1,E),style:{minHeight:p+32},children:[
74
74
  /* @__PURE__ */Ye("span",{className:"text-gray-400",children:/* @__PURE__ */Ye(It,{})}),
75
75
  /* @__PURE__ */Ye("span",{className:"px-3 text-xs text-gray-500",children:B}),
76
76
  /* @__PURE__ */Ye("span",{className:"text-sm font-medium text-blue-600",children:M}),b&&/* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:b})]}):/* @__PURE__ */Ye("div",{className:"flex w-full items-center justify-center rounded-lg border border-gray-200 bg-gray-50 px-3 text-xs text-gray-400",style:{minHeight:p+32},children:$.empty});/* @__PURE__ */
77
77
  return Ge(vt,{label:l,labelId:l?`${S}-label`:void 0,htmlFor:S,hint:i,error:o,required:s,className:c,children:[
78
78
  /* @__PURE__ */Ge("div",{id:S,role:"group","aria-labelledby":l?`${S}-label`:void 0,"aria-describedby":o?`${S}-error`:i?`${S}-hint`:void 0,"aria-busy":v||void 0,...T.zoneProps,className:"relative rounded-lg transition-colors",style:{...A?{opacity:.6}:{},...I?{boxShadow:"0 0 0 2px var(--rosh-drop-ring)"}:{}},children:[0===e.length?K:/* @__PURE__ */Ge("div",{className:"flex flex-wrap gap-2",children:[e.map((t,r)=>{const l=t.kind?"video"===t.kind:Et(t.url,d),i=St(t.url),o=x&&(t.cover??0===r);/* @__PURE__ */
79
- return Ge("div",{draggable:F||void 0,onDragStart:F?e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(r)),P(r)}:void 0,onDragEnd:F?()=>P(null):void 0,onDragOver:F?e=>{null!=D&&(e.preventDefault(),e.stopPropagation())}:void 0,onDrop:F?e=>{null!=D&&(e.preventDefault(),e.stopPropagation(),D!==r&&a(D,r),P(null))}:void 0,tabIndex:F?0:void 0,"aria-label":F?$.reorder(i,r+1,e.length):void 0,onKeyDown:F?t=>{"ArrowLeft"===t.key||"ArrowUp"===t.key?r>0&&(t.preventDefault(),a(r,r-1)):"ArrowRight"!==t.key&&"ArrowDown"!==t.key||r<e.length-1&&(t.preventDefault(),a(r,r+1))}:void 0,className:["relative shrink-0 overflow-hidden rounded-md border border-gray-200 bg-gray-100",E,D===r?"opacity-50":""].join(" "),style:{...R,cursor:F?"move":void 0},children:[l?/* @__PURE__ */Ye("video",{src:t.url,muted:!0,playsInline:!0,preload:"metadata","aria-label":i,className:"h-full w-full",style:{objectFit:m}}):/* @__PURE__ */Ye("img",{src:t.url,alt:i,className:"h-full w-full",style:{objectFit:m}}),o&&/* @__PURE__ */Ye("span",{className:"absolute left-1 top-1 rounded bg-blue-600 px-2 py-0.5 text-xs font-medium text-white",children:C}),null!=t.caption&&/* @__PURE__ */Ye(Ft,{children:t.caption}),j&&/* @__PURE__ */Ye("button",{type:"button",onClick:()=>n(t.id),"aria-label":$.removeItem(i),className:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white ${E}`,style:{background:"var(--rosh-media-scrim-button)"},children:Ut})]},t.id)}),W]}),v&&/* @__PURE__ */Ye(jt,{label:L})]}),!t&&r&&/* @__PURE__ */Ye("input",{...T.inputProps}),
80
- /* @__PURE__ */Ye(de,{rejections:T.rejections})]})}var Yt=e=>String(e).padStart(2,"0"),Gt="grid grid-cols-[repeat(7,minmax(0,40px))] sm:grid-cols-[repeat(7,minmax(0,32px))] justify-center gap-1";function Xt(e){return`${e.getFullYear()}-${Yt(e.getMonth()+1)}-${Yt(e.getDate())}`}function Zt(e){if(!e)return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const r=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(r.getTime())?null:r}var Jt=e=>`${e.getFullYear()}-${Yt(e.getMonth()+1)}`;var Qt=()=>Xt(/* @__PURE__ */new Date);var er=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),tr=(e,t)=>{const r=new Date(e.getFullYear(),e.getMonth()+t,1),n=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();return new Date(r.getFullYear(),r.getMonth(),Math.min(e.getDate(),n))};function rr({value:e,endValue:t,mode:r="single",onSelect:n,min:a,max:l,month:i,defaultMonth:o,onMonthChange:s,weekStartsOn:c,quickJump:d=!0,markedDates:u,readOnly:h=!1,"aria-label":m,className:p=""}){const g=Te(()=>new Set(u??[]),[u]),f=Zt(e),b=ne(Qt,null),x=Zt(b),y=he().calendar,v=ue(),w=ke(v),N=ne(()=>$e(v),0),k=c??N,$=()=>{if(!x)return null;const e=Jt(x);return a&&e<a.slice(0,7)?a.slice(0,7):l&&e>l.slice(0,7)?l.slice(0,7):e},[M,C]=Ee(()=>o||(f?Jt(f):$())),L=i??M??$(),S=null===L?null:function(e,t){const r=/^(\d{4})-(\d{2})$/.exec(e);return r?new Date(Number(r[1]),Number(r[2])-1,1):t}(L,x),[D,P]=Ee(()=>e??b),A=Be(null),z=Be(!1),[j,F]=Ee("days"),E=Te(()=>S?function(e,t){const r=new Date(e.getFullYear(),e.getMonth(),1),n=(r.getDay()-t+7)%7,a=new Date(r.getFullYear(),r.getMonth(),1-n);return Array.from({length:42},(e,t)=>new Date(a.getFullYear(),a.getMonth(),a.getDate()+t))}(S,k):[],[L,k]),B=e=>!!a&&e<a||!!l&&e>l,T=D??b,I=E.some(e=>Xt(e)===T),O=S?E.find(e=>e.getMonth()===S.getMonth())??E[0]:null,R=I&&T?T:O?Xt(O):"";if(Ie(()=>{z.current&&(z.current=!1,A.current?.querySelector('[data-active="true"]')?.focus())},[R,L]),!S)/* @__PURE__ */
79
+ return Ge("div",{draggable:F||void 0,onDragStart:F?e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(r)),P(r)}:void 0,onDragEnd:F?()=>P(null):void 0,onDragOver:F?e=>{null!=D&&(e.preventDefault(),e.stopPropagation())}:void 0,onDrop:F?e=>{null!=D&&(e.preventDefault(),e.stopPropagation(),D!==r&&a(D,r),P(null))}:void 0,tabIndex:F?0:void 0,"aria-label":F?$.reorder(i,r+1,e.length):void 0,onKeyDown:F?t=>{"ArrowLeft"===t.key||"ArrowUp"===t.key?r>0&&(t.preventDefault(),a(r,r-1)):"ArrowRight"!==t.key&&"ArrowDown"!==t.key||r<e.length-1&&(t.preventDefault(),a(r,r+1))}:void 0,className:["relative shrink-0 overflow-hidden rounded-md border border-gray-200 bg-gray-100",E,D===r?"opacity-50":""].join(" "),style:{...R,cursor:F?"move":void 0},children:[l?/* @__PURE__ */Ye("video",{src:t.url,muted:!0,playsInline:!0,preload:"metadata","aria-label":i,className:"h-full w-full",style:{objectFit:m}}):/* @__PURE__ */Ye("img",{src:t.url,alt:i,className:"h-full w-full",style:{objectFit:m}}),o&&/* @__PURE__ */Ye("span",{className:"absolute left-1 top-1 rounded bg-blue-600 px-2 py-0.5 text-xs font-medium text-white",children:C}),null!=t.caption&&/* @__PURE__ */Ye(Ft,{children:t.caption}),z&&/* @__PURE__ */Ye("button",{type:"button",onClick:()=>n(t.id),"aria-label":$.removeItem(i),className:`absolute right-1 top-1 flex h-5 w-5 items-center justify-center rounded-full text-white ${E}`,style:{background:"var(--rosh-media-scrim-button)"},children:Ut})]},t.id)}),W]}),v&&/* @__PURE__ */Ye(zt,{label:L})]}),!t&&r&&/* @__PURE__ */Ye("input",{...T.inputProps}),
80
+ /* @__PURE__ */Ye(de,{rejections:T.rejections})]})}var Yt=e=>String(e).padStart(2,"0"),Gt="grid grid-cols-[repeat(7,minmax(0,40px))] sm:grid-cols-[repeat(7,minmax(0,32px))] justify-center gap-1";function Xt(e){return`${e.getFullYear()}-${Yt(e.getMonth()+1)}-${Yt(e.getDate())}`}function Zt(e){if(!e)return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const r=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(r.getTime())?null:r}var Jt=e=>`${e.getFullYear()}-${Yt(e.getMonth()+1)}`;var Qt=()=>Xt(/* @__PURE__ */new Date);var er=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),tr=(e,t)=>{const r=new Date(e.getFullYear(),e.getMonth()+t,1),n=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();return new Date(r.getFullYear(),r.getMonth(),Math.min(e.getDate(),n))};function rr({value:e,endValue:t,mode:r="single",onSelect:n,min:a,max:l,month:i,defaultMonth:o,onMonthChange:s,weekStartsOn:c,quickJump:d=!0,markedDates:u,readOnly:h=!1,"aria-label":m,className:p=""}){const g=Te(()=>new Set(u??[]),[u]),f=Zt(e),b=ne(Qt,null),x=Zt(b),y=he().calendar,v=ue(),w=ke(v),N=ne(()=>$e(v),0),k=c??N,$=()=>{if(!x)return null;const e=Jt(x);return a&&e<a.slice(0,7)?a.slice(0,7):l&&e>l.slice(0,7)?l.slice(0,7):e},[M,C]=Ee(()=>o||(f?Jt(f):$())),L=i??M??$(),S=null===L?null:function(e,t){const r=/^(\d{4})-(\d{2})$/.exec(e);return r?new Date(Number(r[1]),Number(r[2])-1,1):t}(L,x),[D,P]=Ee(()=>e??b),A=Be(null),j=Be(!1),[z,F]=Ee("days"),E=Te(()=>S?function(e,t){const r=new Date(e.getFullYear(),e.getMonth(),1),n=(r.getDay()-t+7)%7,a=new Date(r.getFullYear(),r.getMonth(),1-n);return Array.from({length:42},(e,t)=>new Date(a.getFullYear(),a.getMonth(),a.getDate()+t))}(S,k):[],[L,k]),B=e=>!!a&&e<a||!!l&&e>l,T=D??b,I=E.some(e=>Xt(e)===T),O=S?E.find(e=>e.getMonth()===S.getMonth())??E[0]:null,R=I&&T?T:O?Xt(O):"";if(Ie(()=>{j.current&&(j.current=!1,A.current?.querySelector('[data-active="true"]')?.focus())},[R,L]),!S)/* @__PURE__ */
81
81
  return Ge("div",{className:p,"aria-hidden":"true","data-calendar-pending":"",children:[
82
82
  /* @__PURE__ */Ye("div",{className:"mb-2 h-6"}),
83
- /* @__PURE__ */Ye("div",{className:"space-y-1",children:Array.from({length:7},(e,t)=>/* @__PURE__ */Ye("div",0===t?{className:"py-1 text-xs",children:" "}:{className:Gt,children:/* @__PURE__ */Ye("span",{className:"aspect-square"})},t))})]});const W=e=>"years"===j?new Date(S.getFullYear()+12*e,S.getMonth(),1):"months"===j?new Date(S.getFullYear()+e,S.getMonth(),1):tr(S,e),K=e=>{const t=Jt(e);void 0===i&&C(t),s?.(t)},q=m??w.monthYear(S.getFullYear(),S.getMonth());/* @__PURE__ */
83
+ /* @__PURE__ */Ye("div",{className:"space-y-1",children:Array.from({length:7},(e,t)=>/* @__PURE__ */Ye("div",0===t?{className:"py-1 text-xs",children:" "}:{className:Gt,children:/* @__PURE__ */Ye("span",{className:"aspect-square"})},t))})]});const W=e=>"years"===z?new Date(S.getFullYear()+12*e,S.getMonth(),1):"months"===z?new Date(S.getFullYear()+e,S.getMonth(),1):tr(S,e),K=e=>{const t=Jt(e);void 0===i&&C(t),s?.(t)},_=m??w.monthYear(S.getFullYear(),S.getMonth());/* @__PURE__ */
84
84
  return Ge("div",{className:p,children:[
85
85
  /* @__PURE__ */Ge("div",{className:"mb-2 flex items-center justify-between px-1",children:[
86
- /* @__PURE__ */Ye("button",{type:"button","aria-label":"years"===j?y.previousYears:"months"===j?y.previousYear:y.previousMonth,onClick:()=>K(W(-1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */Ye(Pe,{name:"chevron-left",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}),
87
- /* @__PURE__ */Ye("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:d?/* @__PURE__ */Ge(Xe,{children:["years"!==j&&/* @__PURE__ */Ye("button",{type:"button","aria-label":y.chooseMonth(w.months[S.getMonth()]),onClick:()=>F(e=>"months"===e?"days":"months"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:w.months[S.getMonth()]}),
86
+ /* @__PURE__ */Ye("button",{type:"button","aria-label":"years"===z?y.previousYears:"months"===z?y.previousYear:y.previousMonth,onClick:()=>K(W(-1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */Ye(Pe,{name:"chevron-left",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}),
87
+ /* @__PURE__ */Ye("div",{"aria-live":"polite",className:"flex items-center gap-1 text-sm font-semibold text-gray-800",children:d?/* @__PURE__ */Ge(Xe,{children:["years"!==z&&/* @__PURE__ */Ye("button",{type:"button","aria-label":y.chooseMonth(w.months[S.getMonth()]),onClick:()=>F(e=>"months"===e?"days":"months"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:w.months[S.getMonth()]}),
88
88
  /* @__PURE__ */Ye("button",{type:"button","aria-label":y.chooseYear(S.getFullYear()),onClick:()=>F(e=>"years"===e?"days":"years"),className:"rounded-md px-2 py-0.5 transition-colors hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:S.getFullYear()})]}):/* @__PURE__ */Ye("span",{children:w.monthYear(S.getFullYear(),S.getMonth())})}),
89
- /* @__PURE__ */Ye("button",{type:"button","aria-label":"years"===j?y.nextYears:"months"===j?y.nextYear:y.nextMonth,onClick:()=>K(W(1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */Ye(Pe,{name:"chevron-right",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})})]}),"months"===j&&/* @__PURE__ */Ye("div",{role:"group","aria-label":y.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:w.monthsShort.map((e,t)=>/* @__PURE__ */Ye("button",{type:"button","aria-pressed":t===S.getMonth(),onClick:()=>{K(new Date(S.getFullYear(),t,1)),F("days")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",t===S.getMonth()?"bg-blue-600 font-semibold text-white":x&&t===x.getMonth()&&S.getFullYear()===x.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),"years"===j&&/* @__PURE__ */Ye("div",{role:"group","aria-label":y.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,t)=>{return r=S.getFullYear(),12*Math.floor(r/12)+t;var r}).map(e=>/* @__PURE__ */Ye("button",{type:"button","aria-pressed":e===S.getFullYear(),onClick:()=>{K(new Date(e,S.getMonth(),1)),F("months")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",e===S.getFullYear()?"bg-blue-600 font-semibold text-white":e===x?.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),
90
- /* @__PURE__ */Ge("div",{ref:A,role:"grid","aria-label":q,className:"space-y-1","aria-readonly":h||void 0,onKeyDown:e=>{const t=Zt(R)??x??S,r={ArrowLeft:()=>er(t,-1),ArrowRight:()=>er(t,1),ArrowUp:()=>er(t,-7),ArrowDown:()=>er(t,7),Home:()=>er(t,-(t.getDay()-k+7)%7),End:()=>er(t,6-(t.getDay()-k+7)%7),PageUp:()=>tr(t,e.shiftKey?-12:-1),PageDown:()=>tr(t,e.shiftKey?12:1)};if(r[e.key])return e.preventDefault(),a=r[e.key](),z.current=!0,P(Xt(a)),void(Jt(a)!==L&&K(a));var a;"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h||B(R)||n(R))},hidden:"days"!==j,children:[
89
+ /* @__PURE__ */Ye("button",{type:"button","aria-label":"years"===z?y.nextYears:"months"===z?y.nextYear:y.nextMonth,onClick:()=>K(W(1)),className:"rounded-full p-1 text-gray-600 hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */Ye(Pe,{name:"chevron-right",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})})]}),"months"===z&&/* @__PURE__ */Ye("div",{role:"group","aria-label":y.monthPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:w.monthsShort.map((e,t)=>/* @__PURE__ */Ye("button",{type:"button","aria-pressed":t===S.getMonth(),onClick:()=>{K(new Date(S.getFullYear(),t,1)),F("days")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",t===S.getMonth()?"bg-blue-600 font-semibold text-white":x&&t===x.getMonth()&&S.getFullYear()===x.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),"years"===z&&/* @__PURE__ */Ye("div",{role:"group","aria-label":y.yearPanel,className:"grid grid-cols-3 gap-1 text-center text-sm",children:Array.from({length:12},(e,t)=>{return r=S.getFullYear(),12*Math.floor(r/12)+t;var r}).map(e=>/* @__PURE__ */Ye("button",{type:"button","aria-pressed":e===S.getFullYear(),onClick:()=>{K(new Date(e,S.getMonth(),1)),F("months")},className:["rounded-md py-4 transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",e===S.getFullYear()?"bg-blue-600 font-semibold text-white":e===x?.getFullYear()?"font-medium text-blue-600 hover:bg-gray-100":"text-gray-700 hover:bg-gray-100"].join(" "),children:e},e))}),
90
+ /* @__PURE__ */Ge("div",{ref:A,role:"grid","aria-label":_,className:"space-y-1","aria-readonly":h||void 0,onKeyDown:e=>{const t=Zt(R)??x??S,r={ArrowLeft:()=>er(t,-1),ArrowRight:()=>er(t,1),ArrowUp:()=>er(t,-7),ArrowDown:()=>er(t,7),Home:()=>er(t,-(t.getDay()-k+7)%7),End:()=>er(t,6-(t.getDay()-k+7)%7),PageUp:()=>tr(t,e.shiftKey?-12:-1),PageDown:()=>tr(t,e.shiftKey?12:1)};if(r[e.key])return e.preventDefault(),a=r[e.key](),j.current=!0,P(Xt(a)),void(Jt(a)!==L&&K(a));var a;"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),h||B(R)||n(R))},hidden:"days"!==z,children:[
91
91
  /* @__PURE__ */Ye("div",{role:"row",className:`${Gt} text-center text-xs font-medium text-gray-500`,children:Array.from({length:7},(e,t)=>(t+k)%7).map(e=>
92
92
  /* @__PURE__ */Ye("div",{role:"columnheader","aria-label":w.weekdays[e],className:"py-1",children:/* @__PURE__ */Ye("abbr",{title:w.weekdays[e],className:"no-underline",children:w.weekdaysShort[e]})},e))}),Array.from({length:6},(a,l)=>/* @__PURE__ */Ye("div",{role:"row",className:`${Gt} text-center text-sm`,children:E.slice(7*l,7*l+7).map(a=>{const l=Xt(a),i=a.getMonth()!==S.getMonth(),o=l===e||"range"===r&&l===t,s=(n=>!("range"!==r||!e||!t)&&n>e&&n<t)(l),c=B(l),d=w.longDate(a.getFullYear(),a.getMonth(),a.getDate()),u=e=>["relative w-full aspect-square rounded-md transition-colors",e?"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",c?"cursor-not-allowed text-gray-300":o?"bg-blue-600 font-semibold text-white":s?"bg-blue-100 text-blue-800":i?"text-gray-500"+(e?" hover:bg-gray-100":""):"text-gray-700"+(e?" hover:bg-gray-100":""),l!==b||o?"":"font-semibold text-blue-600"].filter(Boolean).join(" "),m=g.has(l)&&/* @__PURE__ */Ye("span",{"data-marked":"","aria-hidden":"true",className:"absolute bottom-1 left-1/2 h-1 w-1 -translate-x-1/2 rounded-full "+(o?"bg-white":i?"bg-gray-400":"bg-blue-500")});/* @__PURE__ */
93
- return Ye("div",{role:"gridcell","aria-selected":o,"aria-label":h?d:void 0,children:h?/* @__PURE__ */Ge("span",{"aria-hidden":"true",className:`grid place-items-center ${u(!1)}`,children:[a.getDate(),m]}):/* @__PURE__ */Ge("button",{type:"button","data-active":l===R,tabIndex:l===R?0:-1,disabled:c,"aria-label":d,"aria-current":l===b?"date":void 0,onClick:()=>{P(l),n(l)},className:u(!0),children:[a.getDate(),m]})},l)})},l))]})]})}var nr=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],ar=e=>`${e.getFullYear()}-${lr(e.getMonth()+1)}`,lr=e=>String(e).padStart(2,"0");function ir(e){return`${e.getFullYear()}-${lr(e.getMonth()+1)}-${lr(e.getDate())}`}function or(e,t){const r=t.getFullYear(),n=t.getMonth(),a=new Date(r,n,t.getDate()),l=new Date(r,n,0),i=e=>new Date(r,n-e,1);switch(e){case"last2Weeks":return{from:ir(new Date(r,n,t.getDate()-14)),to:ir(a)};case"lastMonth":return{from:ir(i(1)),to:ir(l)};case"last3Months":return{from:ir(i(3)),to:ir(l)};case"last6Months":return{from:ir(i(6)),to:ir(l)};case"last12Months":return{from:ir(i(12)),to:ir(l)}}}function sr(e,t,r){const n=ar(e);return t&&n<t.slice(0,7)?t.slice(0,7):r&&n>r.slice(0,7)?r.slice(0,7):n}function cr(e){const[t,r,n]=e.split("-").map(Number);return new Date(t,r-1,n)}function dr(e){const[t,r,n]=e.split("-");return t&&r&&n?`${n}/${r}/${t}`:e}var ur=/* @__PURE__ */new Map;function hr({from:e,to:t,onChange:r,formatDisplay:n,clearable:a,required:l=!1,name:i,id:d,"aria-labelledby":u,"aria-label":h,weekStartsOn:m,placeholder:p,fullWidth:g=!1,min:f,max:b,disabled:x=!1,allowOpenEnd:y=!1}){const v=he().dateRange,w=ue(),N=n??(w?function(e){let t=ur.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),ur.set(e,t));const r=t;return e=>{const[t,n,a]=e.split("-").map(Number);return t&&n&&a?r.format(new Date(Date.UTC(t,n-1,a))):e}}(w):dr),$=p??v.placeholder,M=a??!l,[C,L]=Ee(!1),[S,D]=Ee(e),[P,A]=Ee(t),[z,j]=Ee(null),[F,E]=Ee("from"),B=Be(null),T=Be(null),I=Be(null),O=je(),R=je(),W=je(),[K,q]=Ee(!1),H=k(B,C,{preferredMaxWidth:520,preferredMaxHeight:K?720:560,popupRef:I}),_=Be(null),U=Be(null),[V,Y]=Ee(!0);re(()=>{const e=U.current;if(!C||!K||!e)return;const t=getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length||1,r=parseFloat(getComputedStyle(e).columnGap)||0,n=(e.clientWidth-r*(t-1))/t,a=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=n+.5;a!==V&&Y(a)});const Z=Be(null);re(()=>{const e=I.current;if(!C||!H||!e)return;const t=getComputedStyle(e),r=H.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(K)null!==Z.current&&Z.current<=r&&q(!1);else{const e=_.current?.offsetWidth??0;if(0===e)return;Z.current=e,e>r+.5&&q(!0)}});const[J,Q]=Ee(!1);re(()=>{const e=!!d&&(T.current?.labels?.length??0)>0;e!==J&&Q(e)});const ne=!!h||!!u||J,ae=/* @__PURE__ */new Date,[le,ie]=Ee(()=>e?ar(cr(e)):sr(ae,f,b)),oe=nr.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(or(e,ae),f,b)),se=e=>e?N(e):"";Ie(()=>{if(!C)return;const e=e=>{const t=e.target;B.current?.contains(t)||I.current?.contains(t)||L(!1)};document.addEventListener("mousedown",e);const t=ee(()=>L(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[C]),Ie(()=>{x&&L(!1)},[x]);const ce=()=>{r("",""),L(!1)},de=e&&t?`${se(e)} — ${se(t)}`:e?v.fromOnly(se(e)):t?v.toOnly(se(t)):"",me=ke(w),pe=e=>{const t=Zt(e);return t?me.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},ge=e&&t?v.range(pe(e),pe(t)):e?v.fromOnly(pe(e)):t?v.toOnly(pe(t)):$,fe=e=>K?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(z===e?"border-blue-300 bg-blue-50 text-blue-700 font-medium":"border-gray-200 text-gray-700 hover:bg-gray-50"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(z===e?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),be=/* @__PURE__ */Ge(Xe,{children:[oe.map(e=>/* @__PURE__ */Ye("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=or(e,ae);D(t.from),A(t.to),j(e),ie(t.from.slice(0,7))})(e),className:fe(e),"aria-label":K?v[e]:void 0,children:K?V?v[e]:v[`${e}Short`]:v[e]},e)),
94
- /* @__PURE__ */Ye("button",{type:"button",onClick:()=>j("Custom"),className:fe("Custom"),children:v.custom})]}),xe=(e,t)=>y?/* @__PURE__ */Ye("button",{type:"button","data-range-end":e,"aria-pressed":F===e,onClick:()=>E(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */Ye("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),ye=e=>y&&F===e?" ring-1 ring-blue-400":"",ve=
95
- /* @__PURE__ */Ye(rr,{mode:"range",min:f,max:b,value:S||null,endValue:P||null,month:le,onMonthChange:ie,onSelect:e=>{j("Custom"),y?"from"===F?(P&&e>P?(D(P),A(e)):D(e),E("to")):S&&e<S?(A(S),D(e)):A(e):!S||S&&P?(D(e),A("")):e<S?(A(S),D(e)):A(e)},weekStartsOn:m,"aria-label":v.dialog});/* @__PURE__ */
93
+ return Ye("div",{role:"gridcell","aria-selected":o,"aria-label":h?d:void 0,children:h?/* @__PURE__ */Ge("span",{"aria-hidden":"true",className:`grid place-items-center ${u(!1)}`,children:[a.getDate(),m]}):/* @__PURE__ */Ge("button",{type:"button","data-active":l===R,tabIndex:l===R?0:-1,disabled:c,"aria-label":d,"aria-current":l===b?"date":void 0,onClick:()=>{P(l),n(l)},className:u(!0),children:[a.getDate(),m]})},l)})},l))]})]})}var nr=["last2Weeks","lastMonth","last3Months","last6Months","last12Months"],ar=e=>`${e.getFullYear()}-${lr(e.getMonth()+1)}`,lr=e=>String(e).padStart(2,"0");function ir(e){return`${e.getFullYear()}-${lr(e.getMonth()+1)}-${lr(e.getDate())}`}function or(e,t){const r=t.getFullYear(),n=t.getMonth(),a=new Date(r,n,t.getDate()),l=new Date(r,n,0),i=e=>new Date(r,n-e,1);switch(e){case"last2Weeks":return{from:ir(new Date(r,n,t.getDate()-14)),to:ir(a)};case"lastMonth":return{from:ir(i(1)),to:ir(l)};case"last3Months":return{from:ir(i(3)),to:ir(l)};case"last6Months":return{from:ir(i(6)),to:ir(l)};case"last12Months":return{from:ir(i(12)),to:ir(l)}}}function sr(e,t,r){const n=ar(e);return t&&n<t.slice(0,7)?t.slice(0,7):r&&n>r.slice(0,7)?r.slice(0,7):n}function cr(e){const[t,r,n]=e.split("-").map(Number);return new Date(t,r-1,n)}function dr(e){const[t,r,n]=e.split("-");return t&&r&&n?`${n}/${r}/${t}`:e}var ur=/* @__PURE__ */new Map;function hr({from:e,to:t,onChange:r,formatDisplay:n,clearable:a,required:l=!1,name:i,id:d,"aria-labelledby":u,"aria-label":h,weekStartsOn:m,placeholder:p,fullWidth:g=!1,min:f,max:b,disabled:x=!1,allowOpenEnd:y=!1}){const v=he().dateRange,w=ue(),N=n??(w?function(e){let t=ur.get(e);t||(t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC",calendar:"gregory"}),ur.set(e,t));const r=t;return e=>{const[t,n,a]=e.split("-").map(Number);return t&&n&&a?r.format(new Date(Date.UTC(t,n-1,a))):e}}(w):dr),$=p??v.placeholder,M=a??!l,[C,L]=Ee(!1),[S,D]=Ee(e),[P,A]=Ee(t),[j,z]=Ee(null),[F,E]=Ee("from"),B=Be(null),T=Be(null),I=Be(null),O=ze(),R=ze(),W=ze(),[K,_]=Ee(!1),q=k(B,C,{preferredMaxWidth:520,preferredMaxHeight:K?720:560,popupRef:I}),H=Be(null),U=Be(null),[V,Y]=Ee(!0);re(()=>{const e=U.current;if(!C||!K||!e)return;const t=getComputedStyle(e).gridTemplateColumns.split(" ").filter(Boolean).length||1,r=parseFloat(getComputedStyle(e).columnGap)||0,n=(e.clientWidth-r*(t-1))/t,a=Math.max(...Array.from(e.querySelectorAll("[data-preset-measure]"),e=>e.offsetWidth))+24+2<=n+.5;a!==V&&Y(a)});const Z=Be(null);re(()=>{const e=I.current;if(!C||!q||!e)return;const t=getComputedStyle(e),r=q.maxWidth-(e.offsetWidth-e.clientWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight);if(K)null!==Z.current&&Z.current<=r&&_(!1);else{const e=H.current?.offsetWidth??0;if(0===e)return;Z.current=e,e>r+.5&&_(!0)}});const[J,Q]=Ee(!1);re(()=>{const e=!!d&&(T.current?.labels?.length??0)>0;e!==J&&Q(e)});const ne=!!h||!!u||J,ae=/* @__PURE__ */new Date,[le,ie]=Ee(()=>e?ar(cr(e)):sr(ae,f,b)),oe=nr.filter(e=>((e,t,r)=>(!t||e.from>=t)&&(!r||e.to<=r))(or(e,ae),f,b)),se=e=>e?N(e):"";Ie(()=>{if(!C)return;const e=e=>{const t=e.target;B.current?.contains(t)||I.current?.contains(t)||L(!1)};document.addEventListener("mousedown",e);const t=ee(()=>L(!1));return()=>{document.removeEventListener("mousedown",e),t()}},[C]),Ie(()=>{x&&L(!1)},[x]);const ce=()=>{r("",""),L(!1)},de=e&&t?`${se(e)} — ${se(t)}`:e?v.fromOnly(se(e)):t?v.toOnly(se(t)):"",me=ke(w),pe=e=>{const t=Zt(e);return t?me.longDate(t.getFullYear(),t.getMonth(),t.getDate()):e},ge=e&&t?v.range(pe(e),pe(t)):e?v.fromOnly(pe(e)):t?v.toOnly(pe(t)):$,fe=e=>K?"h-8 w-full min-w-0 truncate rounded-(--radius-control) border px-3 text-sm transition-colors "+(j===e?"border-blue-300 bg-blue-50 text-blue-700 font-medium":"border-gray-200 text-gray-700 hover:bg-gray-50"):"h-8 text-left px-3 text-sm rounded-(--radius-control) transition-colors "+(j===e?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),be=/* @__PURE__ */Ge(Xe,{children:[oe.map(e=>/* @__PURE__ */Ye("button",{type:"button",onClick:()=>(e=>{if("Custom"===e)return;const t=or(e,ae);D(t.from),A(t.to),z(e),ie(t.from.slice(0,7))})(e),className:fe(e),"aria-label":K?v[e]:void 0,children:K?V?v[e]:v[`${e}Short`]:v[e]},e)),
94
+ /* @__PURE__ */Ye("button",{type:"button",onClick:()=>z("Custom"),className:fe("Custom"),children:v.custom})]}),xe=(e,t)=>y?/* @__PURE__ */Ye("button",{type:"button","data-range-end":e,"aria-pressed":F===e,onClick:()=>E(e),className:"flex items-center gap-2 whitespace-nowrap rounded rosh-focus-ring",children:t}):/* @__PURE__ */Ye("div",{className:"flex items-center gap-2 whitespace-nowrap",children:t}),ye=e=>y&&F===e?" ring-1 ring-blue-400":"",ve=
95
+ /* @__PURE__ */Ye(rr,{mode:"range",min:f,max:b,value:S||null,endValue:P||null,month:le,onMonthChange:ie,onSelect:e=>{z("Custom"),y?"from"===F?(P&&e>P?(D(P),A(e)):D(e),E("to")):S&&e<S?(A(S),D(e)):A(e):!S||S&&P?(D(e),A("")):e<S?(A(S),D(e)):A(e)},weekStartsOn:m,"aria-label":v.dialog});/* @__PURE__ */
96
96
  return Ge("div",{className:"relative"+(g?" w-full":""),ref:B,children:[
97
97
  /* @__PURE__ */Ge("div",{className:`${g?"flex w-full":"inline-flex"} h-8 items-center gap-2 border rounded-lg px-3 text-sm focus-within:border-blue-500 has-focus-visible:ring-1 has-focus-visible:ring-[color:var(--rosh-focus-ring-deep)] ${e||t?`${o} ${s}`:c}${x?" cursor-not-allowed opacity-60":""}`,children:[
98
- /* @__PURE__ */Ge("button",{ref:T,type:"button",onClick:()=>{x||(D(e),A(t),j(null),E(e&&!t?"to":"from"),ie(e?ar(cr(e)):sr(ae,f,b)),L(!0))},"aria-haspopup":"dialog","aria-expanded":C,id:d,disabled:x||void 0,"aria-label":h,"aria-labelledby":u,"aria-describedby":[ne?R:void 0,l?W:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":C?O:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(g?" min-w-0 flex-1 justify-start":""),children:[
98
+ /* @__PURE__ */Ge("button",{ref:T,type:"button",onClick:()=>{x||(D(e),A(t),z(null),E(e&&!t?"to":"from"),ie(e?ar(cr(e)):sr(ae,f,b)),L(!0))},"aria-haspopup":"dialog","aria-expanded":C,id:d,disabled:x||void 0,"aria-label":h,"aria-labelledby":u,"aria-describedby":[ne?R:void 0,l?W:void 0].filter(Boolean).join(" ")||void 0,"aria-controls":C?O:void 0,className:"inline-flex items-center gap-2 rosh-focus-ring"+(g?" min-w-0 flex-1 justify-start":""),children:[
99
99
  /* @__PURE__ */Ye(Pe,{name:"date",className:"w-4 h-4 shrink-0",strokeWidth:"2","aria-hidden":"true"}),
100
100
  /* @__PURE__ */Ye("span",{className:"truncate",children:de||$})]}),M&&!x&&(e||t)&&/* @__PURE__ */Ye("button",{type:"button",onClick:ce,"aria-label":v.clearRange,className:"text-blue-400 hover:text-red-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded",children:"×"})]}),ne&&/* @__PURE__ */Ye("span",{id:R,className:"sr-only",children:ge}),l&&/* @__PURE__ */Ye("span",{id:W,className:"sr-only",children:v.required}),i&&/* @__PURE__ */Ge(Xe,{children:[
101
101
  /* @__PURE__ */Ye("input",{type:"hidden",name:i.from,value:e,disabled:x||void 0}),
102
102
  /* @__PURE__ */Ye("input",{type:"hidden",name:i.to,value:t,disabled:x||void 0})]}),C&&Ze(
103
- /* @__PURE__ */Ge("div",{ref:I,id:O,role:"dialog","aria-label":v.dialog,"data-layout":K?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:te.popup,left:H?.left,right:H?.right,top:H?.top,bottom:H?.bottom,width:K&&H?H.maxWidth:"max-content",maxWidth:H?.maxWidth,maxHeight:H?.maxHeight,overflowY:"auto",visibility:H?void 0:"hidden",...X()},children:[
103
+ /* @__PURE__ */Ge("div",{ref:I,id:O,role:"dialog","aria-label":v.dialog,"data-layout":K?"stacked":"side",className:"fixed rounded-(--radius-popup) p-4",style:{zIndex:te.popup,left:q?.left,right:q?.right,top:q?.top,bottom:q?.bottom,width:K&&q?q.maxWidth:"max-content",maxWidth:q?.maxWidth,maxHeight:q?.maxHeight,overflowY:"auto",visibility:q?void 0:"hidden",...X()},children:[
104
104
  /* @__PURE__ */Ge("div",{className:K?"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2":"flex items-center gap-3 mb-3",children:[xe("from",/* @__PURE__ */Ge(Xe,{children:[
105
105
  /* @__PURE__ */Ye("span",{className:"text-xs font-medium text-gray-500",children:v.from}),
106
106
  /* @__PURE__ */Ye("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${S?"border-blue-300 bg-blue-50 text-blue-700":"border-gray-200 bg-gray-50 text-gray-400"}${ye("from")}`,children:S?se(S):v.start})]})),!K&&/* @__PURE__ */Ye("span",{className:"text-gray-300",children:"—"}),xe("to",/* @__PURE__ */Ge(Xe,{children:[
@@ -108,67 +108,67 @@ return Ge("div",{className:"relative"+(g?" w-full":""),ref:B,children:[
108
108
  /* @__PURE__ */Ye("span",{className:`text-sm px-2 py-1 rounded border min-w-[90px] ${P?"border-blue-300 bg-blue-50 text-blue-700":"border-gray-200 bg-gray-50 text-gray-400"}${ye("to")}`,children:P?se(P):v.end})]}))]}),K?/* @__PURE__ */Ge(Xe,{children:[oe.length>0&&/* @__PURE__ */Ge("div",{className:"mb-3 @container",children:[!V&&/* @__PURE__ */Ye("p",{"aria-hidden":"true",className:"mb-1 text-xs font-medium text-gray-500",children:v.lastHeading}),
109
109
  /* @__PURE__ */Ge("div",{ref:U,className:"relative grid grid-cols-2 gap-2 @min-[320px]:grid-cols-3",children:[be,oe.map(e=>/* @__PURE__ */Ye("span",{"data-preset-measure":"","aria-hidden":"true",className:"invisible absolute left-0 top-0 whitespace-nowrap text-sm",children:v[e]},e))]})]}),
110
110
  /* @__PURE__ */Ye("div",{className:"w-full",children:ve})]}):
111
- /* @__PURE__ */Ge("div",{ref:_,className:"flex w-max gap-4",children:[
111
+ /* @__PURE__ */Ge("div",{ref:H,className:"flex w-max gap-4",children:[
112
112
  /* @__PURE__ */Ye("div",{className:"w-64",children:ve}),oe.length>0&&/* @__PURE__ */Ye("div",{className:"border-l border-gray-200 pl-4 flex flex-col gap-1 min-w-[130px]",children:be})]}),
113
113
  /* @__PURE__ */Ge("div",{className:"flex flex-wrap justify-end gap-2 mt-4 pt-3 border-t border-gray-200",children:[M&&/* @__PURE__ */Ye("button",{type:"button",onClick:ce,className:G({variant:"ghost"}),children:v.clear}),
114
114
  /* @__PURE__ */Ye("button",{type:"button",onClick:()=>L(!1),className:G({variant:"secondary"}),children:v.cancel}),
115
- /* @__PURE__ */Ye("button",{type:"button",onClick:()=>{r(S,P),L(!1)},disabled:y?!S&&!P:!S||!P,className:G({variant:"primary"}),children:v.apply})]})]}),document.body)]})}var mr=/^\d{2}:\d{2}(:\d{2})?$/,pr=e=>String(e).padStart(2,"0");function gr(e,t){if(null==e||""===e)return"";if(e instanceof Date){if(Number.isNaN(e.getTime()))return"";const r=`${pr(e.getHours())}:${pr(e.getMinutes())}`;return t?`${r}:${pr(e.getSeconds())}`:r}return mr.test(e)?e:""}var fr=ze(function({value:e,onChange:t,min:r,max:n,invalid:a,size:i,className:o="",step:s,...c},d){const u=null!=s&&Number(s)<60,h=ue();/* @__PURE__ */
116
- return Ye("input",{ref:d,type:"time",lang:h,step:s,"aria-invalid":a||void 0,value:gr(e,u),min:gr(r,u)||void 0,max:gr(n,u)||void 0,onChange:e=>t?.(mr.test(e.target.value)?e.target.value:null),className:l({invalid:a,size:i,className:o}),...c})}),br=/^\d{4}-\d{2}-\d{2}$/,xr=/^(aria|data)-/,yr=/* @__PURE__ */new Set(["aria-invalid","aria-required"]);function vr(e){if(null==e||""===e)return"";if(e instanceof Date)return Number.isNaN(e.getTime())?"":ir(e);if(br.test(e))return e;const t=new Date(e);return Number.isNaN(t.getTime())?"":ir(t)}function wr(e){if(!br.test(e))return null;const[t,r,n]=e.split("-").map(Number),a=new Date(t,r-1,n);return a.getMonth()===r-1&&a.getDate()===n?a:null}function Nr(e,t){const r=wr(e);return r?t.longDate(r.getFullYear(),r.getMonth(),r.getDate()):""}var kr=ze(function({value:e,onChange:t,min:r,max:n,invalid:a,size:o,native:s,weekStartsOn:c,className:d="","aria-label":u,"aria-describedby":h,"aria-labelledby":m,id:p,name:g,disabled:f,placeholder:b,required:x,clearable:y,form:v,title:w,tabIndex:N,autoFocus:$,onFocus:M,onBlur:C,...L},S){const D=y??!x,P=vr(e),A=vr(r),z=vr(n),j=he().datePicker,F=ue(),E=ke(F),[B,T]=Ee(!1),I=Be(null),O=Be(null),R=Be(null),W=je(),K=je(),q=je(),H=k(O,B,{popupRef:R}),[_,U]=Ee(!1);re(()=>{const e=!!p&&(O.current?.labels?.length??0)>0;e!==_&&U(e)});const V=!u&&(!!m||_);if(Ie(()=>{if(!B)return;const e=e=>{const t=e.target;I.current?.contains(t)||R.current?.contains(t)||T(!1)};document.addEventListener("pointerdown",e,!0);const t=ee(()=>T(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[B]),Ie(()=>{if(B)return Q(e=>"Escape"===e.key&&(T(!1),O.current?.focus(),!0),()=>R.current)},[B]),s)/* @__PURE__ */
117
- return Ye("input",{ref:S,type:"date",lang:F,id:p,name:g,disabled:f,"aria-label":u,"aria-describedby":h,"aria-invalid":a||void 0,value:P,min:A||void 0,max:z||void 0,onChange:e=>t?.(wr(e.target.value)),className:l({invalid:a,size:o,className:d}),"aria-labelledby":m,required:x,form:v,title:w,tabIndex:N,autoFocus:$,onFocus:M,onBlur:C,...L});const Y=Object.fromEntries(Object.entries(L).filter(([e])=>xr.test(e)&&!yr.has(e))),G=L["aria-required"],X=!!x||!0===G||"true"===G,Z=[V?K:void 0,X?q:void 0,h].filter(Boolean).join(" ")||void 0,J=ir(/* @__PURE__ */new Date),ne=(!A||J>=A)&&(!z||J<=z),ae=b??j.placeholder;/* @__PURE__ */
115
+ /* @__PURE__ */Ye("button",{type:"button",onClick:()=>{r(S,P),L(!1)},disabled:y?!S&&!P:!S||!P,className:G({variant:"primary"}),children:v.apply})]})]}),document.body)]})}var mr=/^\d{2}:\d{2}(:\d{2})?$/,pr=e=>String(e).padStart(2,"0");function gr(e,t){if(null==e||""===e)return"";if(e instanceof Date){if(Number.isNaN(e.getTime()))return"";const r=`${pr(e.getHours())}:${pr(e.getMinutes())}`;return t?`${r}:${pr(e.getSeconds())}`:r}return mr.test(e)?e:""}var fr=je(function({value:e,onChange:t,min:r,max:n,invalid:a,size:i,className:o="",step:s,...c},d){const u=null!=s&&Number(s)<60,h=ue();/* @__PURE__ */
116
+ return Ye("input",{ref:d,type:"time",lang:h,step:s,"aria-invalid":a||void 0,value:gr(e,u),min:gr(r,u)||void 0,max:gr(n,u)||void 0,onChange:e=>t?.(mr.test(e.target.value)?e.target.value:null),className:l({invalid:a,size:i,className:o}),...c})}),br=/^\d{4}-\d{2}-\d{2}$/,xr=/^(aria|data)-/,yr=/* @__PURE__ */new Set(["aria-invalid","aria-required"]);function vr(e){if(null==e||""===e)return"";if(e instanceof Date)return Number.isNaN(e.getTime())?"":ir(e);if(br.test(e))return e;const t=new Date(e);return Number.isNaN(t.getTime())?"":ir(t)}function wr(e){if(!br.test(e))return null;const[t,r,n]=e.split("-").map(Number),a=new Date(t,r-1,n);return a.getMonth()===r-1&&a.getDate()===n?a:null}function Nr(e,t){const r=wr(e);return r?t.longDate(r.getFullYear(),r.getMonth(),r.getDate()):""}var kr=je(function({value:e,onChange:t,min:r,max:n,invalid:a,size:o,native:s,weekStartsOn:c,className:d="","aria-label":u,"aria-describedby":h,"aria-labelledby":m,id:p,name:g,disabled:f,placeholder:b,required:x,clearable:y,form:v,title:w,tabIndex:N,autoFocus:$,onFocus:M,onBlur:C,...L},S){const D=y??!x,P=vr(e),A=vr(r),j=vr(n),z=he().datePicker,F=ue(),E=ke(F),[B,T]=Ee(!1),I=Be(null),O=Be(null),R=Be(null),W=ze(),K=ze(),_=ze(),q=k(O,B,{popupRef:R}),[H,U]=Ee(!1);re(()=>{const e=!!p&&(O.current?.labels?.length??0)>0;e!==H&&U(e)});const V=!u&&(!!m||H);if(Ie(()=>{if(!B)return;const e=e=>{const t=e.target;I.current?.contains(t)||R.current?.contains(t)||T(!1)};document.addEventListener("pointerdown",e,!0);const t=ee(()=>T(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[B]),Ie(()=>{if(B)return Q(e=>"Escape"===e.key&&(T(!1),O.current?.focus(),!0),()=>R.current)},[B]),s)/* @__PURE__ */
117
+ return Ye("input",{ref:S,type:"date",lang:F,id:p,name:g,disabled:f,"aria-label":u,"aria-describedby":h,"aria-invalid":a||void 0,value:P,min:A||void 0,max:j||void 0,onChange:e=>t?.(wr(e.target.value)),className:l({invalid:a,size:o,className:d}),"aria-labelledby":m,required:x,form:v,title:w,tabIndex:N,autoFocus:$,onFocus:M,onBlur:C,...L});const Y=Object.fromEntries(Object.entries(L).filter(([e])=>xr.test(e)&&!yr.has(e))),G=L["aria-required"],X=!!x||!0===G||"true"===G,Z=[V?K:void 0,X?_:void 0,h].filter(Boolean).join(" ")||void 0,J=ir(/* @__PURE__ */new Date),ne=(!A||J>=A)&&(!j||J<=j),ae=b??z.placeholder;/* @__PURE__ */
118
118
  return Ge("div",{ref:I,className:"relative",children:[
119
119
  /* @__PURE__ */Ye("input",{ref:S,type:"hidden",name:g,form:v,value:P}),
120
120
  /* @__PURE__ */Ge("button",{ref:O,type:"button",...Y,id:p,disabled:f,title:w,tabIndex:N,autoFocus:$,onFocus:M,onBlur:C,"aria-haspopup":"dialog","aria-expanded":B,"aria-controls":B?W:void 0,"aria-labelledby":m,"aria-describedby":Z,"aria-label":u?`${u}${P?`, ${Nr(P,E)}`:""}`:void 0,onClick:()=>T(e=>!e),className:`${l({invalid:a,size:o,className:d})} flex items-center justify-between text-left`,children:[
121
121
  /* @__PURE__ */Ye("span",{className:P?"text-gray-900":"text-gray-400",children:P?Nr(P,E):ae}),
122
- /* @__PURE__ */Ye(Pe,{name:"date",className:`h-4 w-4 shrink-0 ${i}`,strokeWidth:"1.75","aria-hidden":"true"})]}),V&&/* @__PURE__ */Ye("span",{id:K,className:"sr-only",children:P?Nr(P,E):ae}),X&&/* @__PURE__ */Ye("span",{id:q,className:"sr-only",children:j.required}),B&&Ze(
123
- /* @__PURE__ */Ge("div",{ref:R,id:W,role:"dialog","aria-label":u??j.dialog,className:"fixed w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-lg",style:{zIndex:te.popup,left:H?.left,right:H?.right,top:H?.top,bottom:H?.bottom,maxWidth:H?.maxWidth,visibility:H?void 0:"hidden"},children:[
124
- /* @__PURE__ */Ye(rr,{value:P||null,min:A||null,max:z||null,weekStartsOn:c,onSelect:e=>{T(!1),O.current?.focus(),t?.(wr(e))}}),(D||ne)&&/* @__PURE__ */Ge("div",{className:"mt-2 flex justify-between border-t border-gray-100 pt-2",children:[D&&/* @__PURE__ */Ye("button",{type:"button",onClick:()=>{T(!1),O.current?.focus(),t?.(null)},className:"rounded-(--radius-control) px-2 py-1 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700",children:j.clear}),ne&&/* @__PURE__ */Ye("button",{type:"button",onClick:()=>{T(!1),O.current?.focus(),t?.(/* @__PURE__ */new Date)},className:"ml-auto rounded-(--radius-control) px-2 py-1 text-sm font-medium text-blue-600 hover:bg-blue-50",children:j.today})]})]}),document.body)]})}),$r=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?$/,Mr=e=>String(e).padStart(2,"0");function Cr(e){return null==e||""===e?"":e instanceof Date?Number.isNaN(e.getTime())?"":`${(t=e).getFullYear()}-${Mr(t.getMonth()+1)}-${Mr(t.getDate())}T${Mr(t.getHours())}:${Mr(t.getMinutes())}`:$r.test(e)?e:"";var t}var Lr=ze(function({value:e,onChange:t,min:r,max:n,invalid:a,size:i,className:o="",...s},c){const d=ue();/* @__PURE__ */
125
- return Ye("input",{ref:c,type:"datetime-local",lang:d,"aria-invalid":a||void 0,value:Cr(e),min:Cr(r)||void 0,max:Cr(n)||void 0,onChange:e=>t?.(function(e){if(!$r.test(e))return null;const[t,r]=e.split("T"),[n,a,l]=t.split("-").map(Number),[i,o,s=0]=r.split(":").map(Number);if(i>23||o>59||s>59)return null;const c=new Date(n,a-1,l,i,o,s);return c.getMonth()===a-1&&c.getDate()===l?c:null}(e.target.value)),className:l({invalid:a,size:i,className:o}),...s})});function Sr(e){let t=null;try{t=window.getSelection()}catch{return null}if(!t||0===t.rangeCount||t.isCollapsed)return null;const r=e;if(r&&"number"==typeof r.nodeType){let e=!1;for(let n=0;n<t.rangeCount&&!e;n++)e=t.getRangeAt(n).intersectsNode(r);if(!e)return null}const n=t.toString();if(!n.trim())return null;const a=document.createElement("div");for(let e=0;e<t.rangeCount;e++)a.appendChild(t.getRangeAt(e).cloneContents());return{text:n,html:a.innerHTML}}async function Dr(e,t){try{if(t&&"undefined"!=typeof ClipboardItem&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})})]),!0;if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}const r=r=>{r.clipboardData?.setData("text/plain",e),t&&r.clipboardData?.setData("text/html",t),r.preventDefault()},n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.addEventListener("copy",r);try{return document.execCommand("copy")}catch{return!1}finally{document.removeEventListener("copy",r),n.remove()}}async function Pr(e,t,r){const n=await Dr(t,r),a=pe().copy;return n?g.success(a.copiedLabel(e)):g.error(a.failed),n}var Ar={bordered:"border border-gray-300 bg-white",flat:"bg-gray-100"},zr={sm:{box:"gap-2 px-3 py-1 text-xs",button:"-my-1"},md:{box:"gap-2 px-3 min-h-8 py-1 text-sm",button:"-my-0.5"}};function jr(){/* @__PURE__ */
122
+ /* @__PURE__ */Ye(Pe,{name:"date",className:`h-4 w-4 shrink-0 ${i}`,strokeWidth:"1.75","aria-hidden":"true"})]}),V&&/* @__PURE__ */Ye("span",{id:K,className:"sr-only",children:P?Nr(P,E):ae}),X&&/* @__PURE__ */Ye("span",{id:_,className:"sr-only",children:z.required}),B&&Ze(
123
+ /* @__PURE__ */Ge("div",{ref:R,id:W,role:"dialog","aria-label":u??z.dialog,className:"fixed w-72 rounded-xl border border-gray-200 bg-white p-3 shadow-lg",style:{zIndex:te.popup,left:q?.left,right:q?.right,top:q?.top,bottom:q?.bottom,maxWidth:q?.maxWidth,visibility:q?void 0:"hidden"},children:[
124
+ /* @__PURE__ */Ye(rr,{value:P||null,min:A||null,max:j||null,weekStartsOn:c,onSelect:e=>{T(!1),O.current?.focus(),t?.(wr(e))}}),(D||ne)&&/* @__PURE__ */Ge("div",{className:"mt-2 flex justify-between border-t border-gray-100 pt-2",children:[D&&/* @__PURE__ */Ye("button",{type:"button",onClick:()=>{T(!1),O.current?.focus(),t?.(null)},className:"rounded-(--radius-control) px-2 py-1 text-sm text-gray-500 hover:bg-gray-100 hover:text-gray-700",children:z.clear}),ne&&/* @__PURE__ */Ye("button",{type:"button",onClick:()=>{T(!1),O.current?.focus(),t?.(/* @__PURE__ */new Date)},className:"ml-auto rounded-(--radius-control) px-2 py-1 text-sm font-medium text-blue-600 hover:bg-blue-50",children:z.today})]})]}),document.body)]})}),$r=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?$/,Mr=e=>String(e).padStart(2,"0");function Cr(e){return null==e||""===e?"":e instanceof Date?Number.isNaN(e.getTime())?"":`${(t=e).getFullYear()}-${Mr(t.getMonth()+1)}-${Mr(t.getDate())}T${Mr(t.getHours())}:${Mr(t.getMinutes())}`:$r.test(e)?e:"";var t}var Lr=je(function({value:e,onChange:t,min:r,max:n,invalid:a,size:i,className:o="",...s},c){const d=ue();/* @__PURE__ */
125
+ return Ye("input",{ref:c,type:"datetime-local",lang:d,"aria-invalid":a||void 0,value:Cr(e),min:Cr(r)||void 0,max:Cr(n)||void 0,onChange:e=>t?.(function(e){if(!$r.test(e))return null;const[t,r]=e.split("T"),[n,a,l]=t.split("-").map(Number),[i,o,s=0]=r.split(":").map(Number);if(i>23||o>59||s>59)return null;const c=new Date(n,a-1,l,i,o,s);return c.getMonth()===a-1&&c.getDate()===l?c:null}(e.target.value)),className:l({invalid:a,size:i,className:o}),...s})});function Sr(e){let t=null;try{t=window.getSelection()}catch{return null}if(!t||0===t.rangeCount||t.isCollapsed)return null;const r=e;if(r&&"number"==typeof r.nodeType){let e=!1;for(let n=0;n<t.rangeCount&&!e;n++)e=t.getRangeAt(n).intersectsNode(r);if(!e)return null}const n=t.toString();if(!n.trim())return null;const a=document.createElement("div");for(let e=0;e<t.rangeCount;e++)a.appendChild(t.getRangeAt(e).cloneContents());return{text:n,html:a.innerHTML}}async function Dr(e,t){try{if(t&&"undefined"!=typeof ClipboardItem&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})})]),!0;if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}const r=r=>{r.clipboardData?.setData("text/plain",e),t&&r.clipboardData?.setData("text/html",t),r.preventDefault()},n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.addEventListener("copy",r);try{return document.execCommand("copy")}catch{return!1}finally{document.removeEventListener("copy",r),n.remove()}}async function Pr(e,t,r){const n=await Dr(t,r),a=pe().copy;return n?g.success(a.copiedLabel(e)):g.error(a.failed),n}var Ar={bordered:"border border-gray-300 bg-white",flat:"bg-gray-100"},jr={sm:{box:"gap-2 px-3 py-1 text-xs",button:"-my-1"},md:{box:"gap-2 px-3 min-h-8 py-1 text-sm",button:"-my-0.5"}};function zr(){/* @__PURE__ */
126
126
  return Ye(Pe,{name:"copy",className:"h-4 w-4","aria-hidden":"true"})}function Fr(){/* @__PURE__ */
127
- return Ye(Pe,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function Er({value:e,children:t,symbol:r,label:n,size:a="md",variant:l="bordered",hideCopyButton:i=!1,onCopy:o,multiline:s=!1,id:c,"aria-describedby":d,className:u=""}){const[h,m]=Ee(!1),p=Be(null),f=he().copy;Ie(()=>()=>{p.current&&clearTimeout(p.current)},[]);const b=Fe(async()=>{await Dr(e)?(m(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{m(!1),p.current=null},2e3),o?.(e)):g.error(f.failed)},[e,o,f]),{box:x,button:y}=zr[a],v=!i;/* @__PURE__ */
127
+ return Ye(Pe,{name:"check",className:"h-4 w-4 text-green-600","aria-hidden":"true"})}function Er({value:e,children:t,symbol:r,label:n,size:a="md",variant:l="bordered",hideCopyButton:i=!1,onCopy:o,multiline:s=!1,id:c,"aria-describedby":d,className:u=""}){const[h,m]=Ee(!1),p=Be(null),f=he().copy;Ie(()=>()=>{p.current&&clearTimeout(p.current)},[]);const b=Fe(async()=>{await Dr(e)?(m(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{m(!1),p.current=null},2e3),o?.(e)):g.error(f.failed)},[e,o,f]),{box:x,button:y}=jr[a],v=!i;/* @__PURE__ */
128
128
  return Ge("div",{id:v?void 0:c,"aria-describedby":v?void 0:d,className:["inline-flex max-w-full items-center rounded-md",Ar[l],x,u].filter(Boolean).join(" "),children:[null!=r&&""!==r&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"shrink-0 select-none font-mono text-gray-400",children:r}),
129
129
  /* @__PURE__ */Ye("span",{className:"min-w-0 font-mono text-gray-800 "+(s?"whitespace-pre-wrap break-all":"truncate"),title:s?void 0:e,children:t??e}),!i&&/* @__PURE__ */Ge(Xe,{children:[
130
- /* @__PURE__ */Ye(Je,{id:c,"aria-label":n?f.copyLabel(n):f.copy,"aria-describedby":d,onClick:b,className:`${y} text-gray-400`,children:/* @__PURE__ */Ye(h?Fr:jr,{})}),
130
+ /* @__PURE__ */Ye(Je,{id:c,"aria-label":n?f.copyLabel(n):f.copy,"aria-describedby":d,onClick:b,className:`${y} text-gray-400`,children:/* @__PURE__ */Ye(h?Fr:zr,{})}),
131
131
  /* @__PURE__ */Ye("span",{"aria-live":"polite",className:"sr-only",children:h?f.copied:""})]})]})}var Br=2;function Tr(e,t){if("."===t)return e.includes(".")?e:""===e?"0.":`${e}.`;if(t<"0"||t>"9")return e;const r=e.indexOf(".");return-1!==r&&e.length-r-1>=2?e:"0"===e?t:e+t}function Ir(e){return e.slice(0,-1)}var Or=["1","2","3","4","5","6","7","8","9",".","0"];function Rr({value:e,onChange:t,onEnter:r,enterLabel:n,enterDisabled:a,className:l=""}){const i=he().keypad,o=r=>{r!==e&&t(r)};/* @__PURE__ */
132
132
  return Ge("div",{className:`grid grid-cols-3 gap-3 ${l}`.trim(),children:[Or.map(t=>/* @__PURE__ */Ye(M,{size:"touch-xl",variant:"secondary",onClick:()=>o(Tr(e,t)),children:t},t)),
133
- /* @__PURE__ */Ye(M,{size:"touch-xl",variant:"secondary","aria-label":i.backspace,onClick:()=>o(Ir(e)),children:"⌫"}),r&&/* @__PURE__ */Ye(M,{size:"touch-xl",variant:"primary",className:"col-span-3",disabled:a,onClick:r,children:n??i.enter})]})}var Wr={md:"h-24 p-3",lg:"h-32 p-4"},Kr=ze(function({title:e,subtitle:t,size:r="lg",selected:n=!1,disabled:a,type:l="button",className:i="",...o},s){/* @__PURE__ */
133
+ /* @__PURE__ */Ye(M,{size:"touch-xl",variant:"secondary","aria-label":i.backspace,onClick:()=>o(Ir(e)),children:"⌫"}),r&&/* @__PURE__ */Ye(M,{size:"touch-xl",variant:"primary",className:"col-span-3",disabled:a,onClick:r,children:n??i.enter})]})}var Wr={md:"h-24 p-3",lg:"h-32 p-4"},Kr=je(function({title:e,subtitle:t,size:r="lg",selected:n=!1,disabled:a,type:l="button",className:i="",...o},s){/* @__PURE__ */
134
134
  return Ge("button",{ref:s,type:l,disabled:a,"aria-pressed":n||void 0,className:["flex w-full flex-col justify-between rounded-xl border text-left transition-colors rosh-focus-ring","disabled:cursor-not-allowed disabled:opacity-50",n?"border-blue-600 bg-blue-50 ring-2 ring-blue-400/40":"border-gray-200 bg-white hover:bg-gray-50 focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",Wr[r],i].filter(Boolean).join(" "),...o,children:[
135
- /* @__PURE__ */Ye("span",{className:"line-clamp-2 font-medium text-gray-900",children:e}),null!=t&&/* @__PURE__ */Ye("span",{className:"text-sm text-gray-500",children:t})]})}),qr={sm:"h-(--control-height-sm) px-(--space-control-x-sm) gap-(--space-icon-gap-sm) text-xs",md:"h-(--control-height-md) px-(--space-control-x) gap-(--space-icon-gap) text-sm",lg:"h-(--control-height-lg) px-(--space-control-x-lg) gap-(--space-icon-gap) text-sm",touch:"h-14 px-(--space-20) gap-(--space-icon-gap) text-base"};function Hr(e=!1,t=""){return["rosh-choice-track inline-flex max-w-full items-center gap-(--space-4) overflow-x-auto rounded-(--radius-card) bg-gray-100 p-(--space-4)","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",e?"w-full":"",t].filter(Boolean).join(" ")}function _r({size:e="md",selected:t,disabled:r=!1,block:n=!1}){return["relative inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-(--radius-control) font-medium transition-colors",qr[e],t?"bg-blue-600 text-white shadow-sm rosh-segmented-on":"text-gray-600 hover:text-gray-900",r?"cursor-not-allowed opacity-40":"cursor-pointer",n?"flex-1":""].filter(Boolean).join(" ")}function Ur(e=!1){return e?"relative inline-flex shrink-0 flex-1":"relative inline-flex shrink-0"}function Vr({icon:e,label:t}){/* @__PURE__ */
136
- return Ge(Xe,{children:[e?/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"inline-flex shrink-0",children:e}):null,t]})}function Yr({value:e,onChange:t,options:r,name:n,size:a="md",block:l=!1,label:i,className:o="","aria-labelledby":s,"aria-describedby":c}){const d={"aria-label":s?void 0:i,"aria-labelledby":s,"aria-describedby":c},u=je(),h=Hr(l,o),m=Ur(l);/* @__PURE__ */
137
- return Ye("div",n?{role:"radiogroup",...d,className:h,children:r.map(r=>{const i=`${u}-${r.value}`,o=r.value===e,s=/* @__PURE__ */Ge("label",{htmlFor:i,className:_r({size:a,selected:o,disabled:r.disabled,block:l}),children:[
135
+ /* @__PURE__ */Ye("span",{className:"line-clamp-2 font-medium text-gray-900",children:e}),null!=t&&/* @__PURE__ */Ye("span",{className:"text-sm text-gray-500",children:t})]})}),_r={sm:"h-(--control-height-sm) px-(--space-control-x-sm) gap-(--space-icon-gap-sm) text-xs",md:"h-(--control-height-md) px-(--space-control-x) gap-(--space-icon-gap) text-sm",lg:"h-(--control-height-lg) px-(--space-control-x-lg) gap-(--space-icon-gap) text-sm",touch:"h-14 px-(--space-20) gap-(--space-icon-gap) text-base"};function qr(e=!1,t=""){return["rosh-choice-track inline-flex max-w-full items-center gap-(--space-4) overflow-x-auto rounded-(--radius-card) bg-gray-100 p-(--space-4)","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",e?"w-full":"",t].filter(Boolean).join(" ")}function Hr({size:e="md",selected:t,disabled:r=!1,block:n=!1}){return["relative inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-(--radius-control) font-medium transition-colors",_r[e],t?"bg-blue-600 text-white shadow-sm rosh-segmented-on":"text-gray-600 hover:text-gray-900",r?"cursor-not-allowed opacity-40":"cursor-pointer",n?"flex-1":""].filter(Boolean).join(" ")}function Ur(e=!1){return e?"relative inline-flex shrink-0 flex-1":"relative inline-flex shrink-0"}function Vr({icon:e,label:t}){/* @__PURE__ */
136
+ return Ge(Xe,{children:[e?/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"inline-flex shrink-0",children:e}):null,t]})}function Yr({value:e,onChange:t,options:r,name:n,size:a="md",block:l=!1,label:i,className:o="","aria-labelledby":s,"aria-describedby":c}){const d={"aria-label":s?void 0:i,"aria-labelledby":s,"aria-describedby":c},u=ze(),h=qr(l,o),m=Ur(l);/* @__PURE__ */
137
+ return Ye("div",n?{role:"radiogroup",...d,className:h,children:r.map(r=>{const i=`${u}-${r.value}`,o=r.value===e,s=/* @__PURE__ */Ge("label",{htmlFor:i,className:Hr({size:a,selected:o,disabled:r.disabled,block:l}),children:[
138
138
  /* @__PURE__ */Ye("input",{id:i,type:"radio",name:n,value:r.value,checked:o,disabled:r.disabled,"aria-describedby":r.title?`${i}-note`:void 0,onChange:()=>t(r.value),className:"absolute inset-0 m-0 h-full w-full appearance-none rounded-[inherit] bg-transparent cursor-[inherit] rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"}),
139
- /* @__PURE__ */Ye(Vr,{icon:r.icon,label:r.label}),r.title&&/* @__PURE__ */Ye("span",{id:`${i}-note`,className:"sr-only",children:r.title})]},r.value);return r.title?/* @__PURE__ */Ye(C,{content:r.title,className:m,children:s},r.value):s})}:{role:"group",...d,className:h,children:r.map(r=>{const n=r.value===e,i=/* @__PURE__ */Ye("button",{type:"button","aria-pressed":n,disabled:r.disabled,onClick:()=>t(r.value),className:_r({size:a,selected:n,disabled:r.disabled,block:l}),children:/* @__PURE__ */Ye(Vr,{icon:r.icon,label:r.label})},r.value);return r.title?/* @__PURE__ */Ye(C,{content:r.title,className:m,children:i},r.value):i})})}var Gr={sm:"h-5 w-9",md:"h-6 w-11",touch:"h-8 w-14"},Xr={sm:"h-4 w-4",md:"h-5 w-5",touch:"h-7 w-7"},Zr={sm:"translate-x-4",md:"translate-x-5",touch:"translate-x-6"},Jr=ze(function({checked:e,onChange:t,disabled:r=!1,size:n="md",label:a,hint:l,id:i,className:o="",disabledReason:s,disabledReasonId:c,...d},u){const h=je(),m=i??h,p=l?`${m}-hint`:void 0,g=r&&c?c:void 0,f=r&&!g&&null!=s&&""!==s,b=f?`${m}-reason`:void 0,x=[p,g??b].filter(Boolean).join(" ")||void 0,y=/* @__PURE__ */Ye("button",{ref:u,id:m,type:"button",role:"switch","aria-checked":e,"aria-describedby":x,disabled:r,onClick:()=>t(!e),...d,className:["relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]","disabled:cursor-not-allowed disabled:opacity-40",Gr[n],e?"bg-blue-600":"bg-gray-300"].join(" "),children:/* @__PURE__ */Ye("span",{className:["inline-block rounded-full bg-white shadow transition-transform",Xr[n],e?Zr[n]:"translate-x-0"].join(" ")})});return a||l||f?/* @__PURE__ */Ge("span",{className:`flex items-start gap-3 ${o}`.trim(),children:[y,
140
- /* @__PURE__ */Ge("span",{className:"min-w-0",children:[a&&/* @__PURE__ */Ye("label",{htmlFor:m,className:"block text-sm font-medium text-gray-800",children:a}),l&&/* @__PURE__ */Ye("span",{id:p,className:"mt-0.5 block text-xs text-gray-500",children:l}),f&&/* @__PURE__ */Ye("span",{id:b,className:"mt-0.5 block text-xs text-red-600",children:s})]})]}):/* @__PURE__ */Ye("span",{className:o,children:y})});function Qr(e){const t=String(e),r=/e-(\d+)$/.exec(t);return r?Number(r[1]):t.split(".")[1]?.length??0}var en=(e,t)=>null==e?"":null!=t?e.toFixed(t):String(e);function tn({dir:e,compact:t,label:r,disabled:n,onStep:a}){const l=Be(a);l.current=a;const i=Be({}),o=Fe(()=>{const e=i.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),i.current={}},[]);Ie(()=>o,[o]),Ie(()=>{n&&o()},[n,o]);const s=/* @__PURE__ */Ye(Pe,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:t?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:t?2.6:2}),c={tabIndex:-1,"aria-label":r,disabled:n,onPointerDown:e=>{if(0!==e.button||n)return;e.preventDefault(),o();const t=e.shiftKey;l.current(t);const r=e.currentTarget.ownerDocument.defaultView??window;r.addEventListener("pointerup",o),i.current={off:()=>r.removeEventListener("pointerup",o),wait:setTimeout(()=>{i.current.every=setInterval(()=>l.current(t),60)},400)}},onPointerLeave:o,onPointerCancel:o,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return t?/* @__PURE__ */Ye("button",{type:"button",...c,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:s}):/* @__PURE__ */Ye(Je,{size:"sm",...c,children:s})}var rn=ze(function({value:e,onChange:t,min:r,max:n,precision:a,step:i,shiftStep:o,disabled:s,readOnly:c,invalid:d,placeholder:u,size:h,prefix:m,suffix:p,id:g,name:f,className:b="",onBlur:x,onFocus:y,steppers:v=!1,stepFrom:w,snap:N=!1,allowEmpty:k=!0,appearance:$="box",display:M,reportWhileTyping:C=!0,onRevert:L,"aria-label":S,"aria-labelledby":D,"aria-describedby":P,...A},z){const j="bare"===$,F="string"==typeof p&&""!==p.trim()?p.trim():void 0,E=e=>function(e,t){let r=e.trim();if(t&&r.endsWith(t)&&(r=r.slice(0,-t.length).trim()),r=r.replace(",","."),""===r||"-"===r||"."===r||"-."===r)return null;const n=Number(r);return Number.isFinite(n)?n:null}(e,F),B=Object.fromEntries(Object.entries(A).filter(([e])=>e.startsWith("data-"))),T=he(),[I,O]=Ee(()=>en(e,a)),R=Be(I);R.current=I;const W=Be(null),K=Fe(e=>{W.current=e,"function"==typeof z?z(e):z&&(z.current=e)},[z]),q=Be(e),H=Be(e);H.current=e;const _=Boolean(s||c),U="compact"===v;Ie(()=>{E(R.current)!==e&&O(en(e,a))},[e,a]);const V=e=>{if(_)return;let l=(E(R.current)??w??(u?E(u):null)??0)+e;null!=r&&l<r&&(l=r),null!=n&&l>n&&(l=n);const o=a??String(i??1).split(".")[1]?.length??0;l=Number(l.toFixed(o));const s=en(l,a);R.current=s,O(s),t(l),ee()},Y=Be(V);Y.current=V;const[G,X]=Ee(!1),[Z,J]=Ee(0),ee=()=>{j&&J(e=>e+1)};Ie(()=>{j&&G&&document.activeElement===W.current&&W.current?.select()},[j,G,Z]);const te=Be(!1);Ie(()=>{if(G&&!_)return Q(e=>{if("Escape"!==e.key||document.activeElement!==W.current)return!1;const r=q.current;if(E(R.current)===r)return!1;const n=en(r,a);return R.current=n,O(n),H.current!==r&&(L??t)(r),ee(),!0})},[G,_,a,t,L]);const re=()=>{const e=E(R.current);if(null==e){if(!k){const e=en(H.current,a);return R.current=e,O(e),H.current}return R.current="",O(""),null!==H.current&&t(null),null}let l=e;const o=a??(N?Math.max(Qr(i??1),Qr(r??0)):void 0);N&&(l=function(e,t,r){const n=(e-r)/t;return r+Math.round(n+1e-9*Math.sign(e))*t}(l,i??1,r??0)),null!=r&&l<r&&(l=r),null!=n&&l>n&&(l=n),null!=o&&(l=Number(l.toFixed(o)));const s=en(l,a);return R.current=s,O(s),l===e&&l===H.current||t(l),l},ne=/* @__PURE__ */Ye("input",{ref:K,id:g,name:f,type:"text",inputMode:0===a?"numeric":"decimal",value:!G&&M?M(e):I,disabled:s,readOnly:c,placeholder:u,step:i,role:"spinbutton","aria-valuenow":e??void 0,"aria-valuemin":r,"aria-valuemax":n,"aria-valuetext":null==e?u||void 0:`${en(e,a)}${j&&F?F:""}`,"aria-describedby":P,"data-appearance":j?"bare":void 0,...B,autoComplete:j?"off":void 0,spellCheck:!j&&void 0,"aria-invalid":d||void 0,"aria-label":S,"aria-labelledby":D,onChange:e=>(e=>{if(c)return;const r=F&&e.trimEnd().endsWith(F)?e.trimEnd().slice(0,-F.length).trimEnd():e;if(""!==r&&!/^-?\d*[.,]?\d*$/.test(r))return;if(O(e),!C)return;const n=E(e);(null!==n||k)&&t(n)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!_)return q.current=re(),void ee();const t=i??1,r=o??10*t,n="ArrowUp"===e.key?e.shiftKey?r:t:"ArrowDown"===e.key?-(e.shiftKey?r:t):"PageUp"===e.key?10*t:"PageDown"===e.key?10*-t:null;null===n||_||(e.preventDefault(),V(n))},onFocus:()=>{q.current=H.current,X(!0),te.current=!0,y?.()},onMouseUp:j?e=>{te.current&&(te.current=!1,e.preventDefault())}:void 0,onBlur:()=>{X(!1),te.current=!1,re(),x?.()},className:j?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",G?"bg-white":"bg-transparent",_?"cursor-default":"cursor-text",b].filter(Boolean).join(" "):l({invalid:d,size:h,readOnly:c,className:[m?"pl-8":"",U?p?"pr-12":"pr-6":v?p?"pr-24":"pr-16":p?"pr-10":"","text-right tabular-nums",b].filter(Boolean).join(" ")})});if(j||!m&&!p&&!v)return ne;const ae=E(I);/* @__PURE__ */
141
- return Ge("div",{className:"relative",children:[m&&/* @__PURE__ */Ye("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:m}),ne,p&&/* @__PURE__ */Ye("span",{className:`pointer-events-none absolute ${U?"right-6":v?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-sm text-gray-500`,children:p}),v&&(()=>{const e=/* @__PURE__ */Ye(tn,{dir:-1,compact:U,label:T.number.decrease,disabled:_||null!=r&&null!=ae&&ae<=r,onStep:e=>Y.current(-(e?o??10*(i??1):i??1))}),t=/* @__PURE__ */Ye(tn,{dir:1,compact:U,label:T.number.increase,disabled:_||null!=n&&null!=ae&&ae>=n,onStep:e=>Y.current(e?o??10*(i??1):i??1)});/* @__PURE__ */
139
+ /* @__PURE__ */Ye(Vr,{icon:r.icon,label:r.label}),r.title&&/* @__PURE__ */Ye("span",{id:`${i}-note`,className:"sr-only",children:r.title})]},r.value);return r.title?/* @__PURE__ */Ye(C,{content:r.title,className:m,children:s},r.value):s})}:{role:"group",...d,className:h,children:r.map(r=>{const n=r.value===e,i=/* @__PURE__ */Ye("button",{type:"button","aria-pressed":n,disabled:r.disabled,onClick:()=>t(r.value),className:Hr({size:a,selected:n,disabled:r.disabled,block:l}),children:/* @__PURE__ */Ye(Vr,{icon:r.icon,label:r.label})},r.value);return r.title?/* @__PURE__ */Ye(C,{content:r.title,className:m,children:i},r.value):i})})}var Gr={sm:"h-5 w-9",md:"h-6 w-11",touch:"h-8 w-14"},Xr={sm:"h-4 w-4",md:"h-5 w-5",touch:"h-7 w-7"},Zr={sm:"translate-x-4",md:"translate-x-5",touch:"translate-x-6"},Jr=je(function({checked:e,onChange:t,disabled:r=!1,size:n="md",label:a,hint:l,id:i,className:o="",disabledReason:s,disabledReasonId:c,...d},u){const h=ze(),m=i??h,p=l?`${m}-hint`:void 0,g=r&&c?c:void 0,f=r&&!g&&null!=s&&""!==s,b=f?`${m}-reason`:void 0,x=[p,g??b].filter(Boolean).join(" ")||void 0,y=/* @__PURE__ */Ye("button",{ref:u,id:m,type:"button",role:"switch","aria-checked":e,"aria-describedby":x,disabled:r,onClick:()=>t(!e),...d,className:["relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]","disabled:cursor-not-allowed disabled:opacity-40",Gr[n],e?"bg-blue-600":"bg-gray-300"].join(" "),children:/* @__PURE__ */Ye("span",{className:["inline-block rounded-full bg-white shadow transition-transform",Xr[n],e?Zr[n]:"translate-x-0"].join(" ")})});return a||l||f?/* @__PURE__ */Ge("span",{className:`flex items-start gap-3 ${o}`.trim(),children:[y,
140
+ /* @__PURE__ */Ge("span",{className:"min-w-0",children:[a&&/* @__PURE__ */Ye("label",{htmlFor:m,className:"block text-sm font-medium text-gray-800",children:a}),l&&/* @__PURE__ */Ye("span",{id:p,className:"mt-0.5 block text-xs text-gray-500",children:l}),f&&/* @__PURE__ */Ye("span",{id:b,className:"mt-0.5 block text-xs text-red-600",children:s})]})]}):/* @__PURE__ */Ye("span",{className:o,children:y})});function Qr(e){const t=String(e),r=/e-(\d+)$/.exec(t);return r?Number(r[1]):t.split(".")[1]?.length??0}var en=(e,t)=>null==e?"":null!=t?e.toFixed(t):String(e);function tn({dir:e,compact:t,label:r,disabled:n,onStep:a}){const l=Be(a);l.current=a;const i=Be({}),o=Fe(()=>{const e=i.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),i.current={}},[]);Ie(()=>o,[o]),Ie(()=>{n&&o()},[n,o]);const s=/* @__PURE__ */Ye(Pe,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:t?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:t?2.6:2}),c={tabIndex:-1,"aria-label":r,disabled:n,onPointerDown:e=>{if(0!==e.button||n)return;e.preventDefault(),o();const t=e.shiftKey;l.current(t);const r=e.currentTarget.ownerDocument.defaultView??window;r.addEventListener("pointerup",o),i.current={off:()=>r.removeEventListener("pointerup",o),wait:setTimeout(()=>{i.current.every=setInterval(()=>l.current(t),60)},400)}},onPointerLeave:o,onPointerCancel:o,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return t?/* @__PURE__ */Ye("button",{type:"button",...c,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:s}):/* @__PURE__ */Ye(Je,{size:"sm",...c,children:s})}var rn=je(function({value:e,onChange:t,min:r,max:n,precision:a,step:i,shiftStep:o,disabled:s,readOnly:c,invalid:d,placeholder:u,size:h,prefix:m,suffix:p,id:g,name:f,className:b="",onBlur:x,onFocus:y,steppers:v=!1,stepFrom:w,snap:N=!1,allowEmpty:k=!0,appearance:$="box",display:M,reportWhileTyping:C=!0,onRevert:L,"aria-label":S,"aria-labelledby":D,"aria-describedby":P,...A},j){const z="bare"===$,F="string"==typeof p&&""!==p.trim()?p.trim():void 0,E=e=>function(e,t){let r=e.trim();if(t&&r.endsWith(t)&&(r=r.slice(0,-t.length).trim()),r=r.replace(",","."),""===r||"-"===r||"."===r||"-."===r)return null;const n=Number(r);return Number.isFinite(n)?n:null}(e,F),B=Object.fromEntries(Object.entries(A).filter(([e])=>e.startsWith("data-"))),T=he(),[I,O]=Ee(()=>en(e,a)),R=Be(I);R.current=I;const W=Be(null),K=Fe(e=>{W.current=e,"function"==typeof j?j(e):j&&(j.current=e)},[j]),_=Be(e),q=Be(e);q.current=e;const H=Boolean(s||c),U="compact"===v;Ie(()=>{E(R.current)!==e&&O(en(e,a))},[e,a]);const V=e=>{if(H)return;let l=(E(R.current)??w??(u?E(u):null)??0)+e;null!=r&&l<r&&(l=r),null!=n&&l>n&&(l=n);const o=a??String(i??1).split(".")[1]?.length??0;l=Number(l.toFixed(o));const s=en(l,a);R.current=s,O(s),t(l),ee()},Y=Be(V);Y.current=V;const[G,X]=Ee(!1),[Z,J]=Ee(0),ee=()=>{z&&J(e=>e+1)};Ie(()=>{z&&G&&document.activeElement===W.current&&W.current?.select()},[z,G,Z]);const te=Be(!1);Ie(()=>{if(G&&!H)return Q(e=>{if("Escape"!==e.key||document.activeElement!==W.current)return!1;const r=_.current;if(E(R.current)===r)return!1;const n=en(r,a);return R.current=n,O(n),q.current!==r&&(L??t)(r),ee(),!0})},[G,H,a,t,L]);const re=()=>{const e=E(R.current);if(null==e){if(!k){const e=en(q.current,a);return R.current=e,O(e),q.current}return R.current="",O(""),null!==q.current&&t(null),null}let l=e;const o=a??(N?Math.max(Qr(i??1),Qr(r??0)):void 0);N&&(l=function(e,t,r){const n=(e-r)/t;return r+Math.round(n+1e-9*Math.sign(e))*t}(l,i??1,r??0)),null!=r&&l<r&&(l=r),null!=n&&l>n&&(l=n),null!=o&&(l=Number(l.toFixed(o)));const s=en(l,a);return R.current=s,O(s),l===e&&l===q.current||t(l),l},ne=/* @__PURE__ */Ye("input",{ref:K,id:g,name:f,type:"text",inputMode:0===a?"numeric":"decimal",value:!G&&M?M(e):I,disabled:s,readOnly:c,placeholder:u,step:i,role:"spinbutton","aria-valuenow":e??void 0,"aria-valuemin":r,"aria-valuemax":n,"aria-valuetext":null==e?u||void 0:`${en(e,a)}${z&&F?F:""}`,"aria-describedby":P,"data-appearance":z?"bare":void 0,...B,autoComplete:z?"off":void 0,spellCheck:!z&&void 0,"aria-invalid":d||void 0,"aria-label":S,"aria-labelledby":D,onChange:e=>(e=>{if(c)return;const r=F&&e.trimEnd().endsWith(F)?e.trimEnd().slice(0,-F.length).trimEnd():e;if(""!==r&&!/^-?\d*[.,]?\d*$/.test(r))return;if(O(e),!C)return;const n=E(e);(null!==n||k)&&t(n)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!H)return _.current=re(),void ee();const t=i??1,r=o??10*t,n="ArrowUp"===e.key?e.shiftKey?r:t:"ArrowDown"===e.key?-(e.shiftKey?r:t):"PageUp"===e.key?10*t:"PageDown"===e.key?10*-t:null;null===n||H||(e.preventDefault(),V(n))},onFocus:()=>{_.current=q.current,X(!0),te.current=!0,y?.()},onMouseUp:z?e=>{te.current&&(te.current=!1,e.preventDefault())}:void 0,onBlur:()=>{X(!1),te.current=!1,re(),x?.()},className:z?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",G?"bg-white":"bg-transparent",H?"cursor-default":"cursor-text",b].filter(Boolean).join(" "):l({invalid:d,size:h,readOnly:c,className:[m?"pl-8":"",U?p?"pr-12":"pr-6":v?p?"pr-24":"pr-16":p?"pr-10":"","text-right tabular-nums",b].filter(Boolean).join(" ")})});if(z||!m&&!p&&!v)return ne;const ae=E(I);/* @__PURE__ */
141
+ return Ge("div",{className:"relative",children:[m&&/* @__PURE__ */Ye("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:m}),ne,p&&/* @__PURE__ */Ye("span",{className:`pointer-events-none absolute ${U?"right-6":v?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-sm text-gray-500`,children:p}),v&&(()=>{const e=/* @__PURE__ */Ye(tn,{dir:-1,compact:U,label:T.number.decrease,disabled:H||null!=r&&null!=ae&&ae<=r,onStep:e=>Y.current(-(e?o??10*(i??1):i??1))}),t=/* @__PURE__ */Ye(tn,{dir:1,compact:U,label:T.number.increase,disabled:H||null!=n&&null!=ae&&ae>=n,onStep:e=>Y.current(e?o??10*(i??1):i??1)});/* @__PURE__ */
142
142
  return Ge("span",U?{"data-steppers":"compact",className:"absolute inset-y-px right-px flex w-4 flex-col overflow-hidden rounded-r-(--radius-control)",children:[t,e]}:{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5",children:[e,t]})})()]})}),nn=(e,t,r)=>Math.min(r,Math.max(t,e));var an=8,ln=40;var on="undefined"==typeof window?Ie:Ve;function sn(e,t,r,n){return Number(nn(e,t,r).toFixed(n))}var cn=Oe(null);function dn({children:e}){const[t,r]=Ee({}),n=Te(()=>(e,t)=>r(r=>{if(null===t){if(!(e in r))return r;const t={...r};return delete t[e],t}return r[e]===t?r:{...r,[e]:t}}),[]),a=Te(()=>{const e=Object.values(t);return{set:n,width:e.length?`max(${e.join(", ")})`:null}},[t,n]);/* @__PURE__ */
143
- return Ye(cn.Provider,{value:a,children:e})}function un({value:e,onChange:t,min:r,max:n,step:a=1,shiftStep:l,precision:i,inputMin:o,inputMax:s,suffix:c,showInput:d=!0,emptyLabel:u,placeholderValue:h,stepFrom:m,label:p,"aria-labelledby":g,valueText:f,id:b,disabled:x,size:y="md",className:v=""}){const w=he(),N=je(),k=b??N,$=i??function(e){const t=String(e),r=/e-(\d+)$/.exec(t);return r?Number(r[1]):t.split(".")[1]?.length??0}(a),M=o??r,C=s??n,L=void 0!==u||void 0!==h,S=m??h,D=nn(e??h??r,r,n),P=Be(null),[A,z]=Ee(null),j=Boolean(c);on(()=>{const e=()=>{const e=P.current?.querySelector("input");if(!e)return;const t=getComputedStyle(e),r=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,r)=>e+(parseFloat(t[r])||0),0);r<=0||z(e=>e&&e.frame===r&&e.fontSize===t.fontSize?e:{frame:r,fontSize:t.fontSize})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[j,d]);const F=e=>f?f(e):"string"==typeof c?`${e.toFixed($)} ${c}`:void 0,E=null==e?u??(null!=h?F(h)??String(h):void 0):F(e),B=`calc(${T=[r.toFixed($),n.toFixed($),e?.toFixed($),u,h?.toFixed($)],Math.max(1,...T.map(e=>(e??"").length))}ch + ${(A?.frame??10+(j?ln:an))+2}px)`;var T;const I=qe(cn),O=je(),R=I?.set;return on(()=>{R&&R(O,d?B:null)},[R,O,B,d]),Ie(()=>()=>R?.(O,null),[R,O]),/* @__PURE__ */Ge("div",{className:`flex items-center gap-3 ${v}`.trim(),children:[
143
+ return Ye(cn.Provider,{value:a,children:e})}function un({value:e,onChange:t,min:r,max:n,step:a=1,shiftStep:l,precision:i,inputMin:o,inputMax:s,suffix:c,showInput:d=!0,emptyLabel:u,placeholderValue:h,stepFrom:m,label:p,"aria-labelledby":g,valueText:f,id:b,disabled:x,size:y="md",className:v=""}){const w=he(),N=ze(),k=b??N,$=i??function(e){const t=String(e),r=/e-(\d+)$/.exec(t);return r?Number(r[1]):t.split(".")[1]?.length??0}(a),M=o??r,C=s??n,L=void 0!==u||void 0!==h,S=m??h,D=nn(e??h??r,r,n),P=Be(null),[A,j]=Ee(null),z=Boolean(c);on(()=>{const e=()=>{const e=P.current?.querySelector("input");if(!e)return;const t=getComputedStyle(e),r=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,r)=>e+(parseFloat(t[r])||0),0);r<=0||j(e=>e&&e.frame===r&&e.fontSize===t.fontSize?e:{frame:r,fontSize:t.fontSize})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[z,d]);const F=e=>f?f(e):"string"==typeof c?`${e.toFixed($)} ${c}`:void 0,E=null==e?u??(null!=h?F(h)??String(h):void 0):F(e),B=`calc(${T=[r.toFixed($),n.toFixed($),e?.toFixed($),u,h?.toFixed($)],Math.max(1,...T.map(e=>(e??"").length))}ch + ${(A?.frame??10+(z?ln:an))+2}px)`;var T;const I=_e(cn),O=ze(),R=I?.set;return on(()=>{R&&R(O,d?B:null)},[R,O,B,d]),Ie(()=>()=>R?.(O,null),[R,O]),/* @__PURE__ */Ge("div",{className:`flex items-center gap-3 ${v}`.trim(),children:[
144
144
  /* @__PURE__ */Ye("input",{id:k,type:"range",min:r,max:n,step:a,value:D,disabled:x,"aria-label":g?void 0:p,"aria-labelledby":g,"aria-valuetext":E,onKeyDown:i=>{const o="ArrowUp"===i.key||"ArrowRight"===i.key?1:"ArrowDown"===i.key||"ArrowLeft"===i.key?-1:0;if(!o||i.altKey||i.ctrlKey||i.metaKey)return;const s=i.shiftKey&&null!=l;if(!s&&!(null==e&&null!=S))return;i.preventDefault();t(sn((e??S??D)+o*(s?l??a:a),r,n,$))},onChange:e=>t(sn(Number(e.target.value),r,n,$)),className:"min-w-0 flex-1 cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 "+("sm"===y?"h-1":"h-1.5")}),d&&
145
- /* @__PURE__ */Ye("div",{ref:P,className:"shrink-0 text-xs",style:{width:I?.width??B,...A?{fontSize:A.fontSize}:{}},children:/* @__PURE__ */Ye(rn,{value:e,onChange:e=>{null!=e?e<M||e>C||t(e):L&&t(null)},min:M,max:C,step:a,shiftStep:l,stepFrom:S,precision:$,snap:!0,allowEmpty:L,suffix:c,disabled:x,placeholder:u??(null!=h?h.toFixed($):void 0),size:"sm","aria-label":p?w.slider.value(p):void 0,"aria-labelledby":p?void 0:g})})]})}function hn({items:e,onChange:t,label:r,className:a="","aria-labelledby":l,"aria-describedby":i}){const o=he().displayChips,s=je();/* @__PURE__ */
145
+ /* @__PURE__ */Ye("div",{ref:P,className:"shrink-0 text-xs",style:{width:I?.width??B,...A?{fontSize:A.fontSize}:{}},children:/* @__PURE__ */Ye(rn,{value:e,onChange:e=>{null!=e?e<M||e>C||t(e):L&&t(null)},min:M,max:C,step:a,shiftStep:l,stepFrom:S,precision:$,snap:!0,allowEmpty:L,suffix:c,disabled:x,placeholder:u??(null!=h?h.toFixed($):void 0),size:"sm","aria-label":p?w.slider.value(p):void 0,"aria-labelledby":p?void 0:g})})]})}function hn({items:e,onChange:t,label:r,className:a="","aria-labelledby":l,"aria-describedby":i}){const o=he().displayChips,s=ze();/* @__PURE__ */
146
146
  return Ye("div",{role:"group","aria-label":l?void 0:r,"aria-labelledby":l,"aria-describedby":i,className:`flex flex-wrap gap-2 ${a}`.trim(),children:e.map((e,r)=>{const a=`${s}-${r}-state`,l=`${s}-${r}-reason`,i=Boolean(e.disabled)&&null!=e.disabledReason&&""!==e.disabledReason,c=/* @__PURE__ */Ge("button",{type:"button","aria-pressed":e.shown,disabled:!(!e.disabled||i)||void 0,"aria-disabled":!!i||void 0,"aria-describedby":w(a,i?l:void 0),onClick:i?v:()=>t(e.id,!e.shown),className:"inline-flex h-6 max-w-full shrink-0 items-center gap-1 whitespace-nowrap rounded-full border pl-2 pr-3 text-xs font-medium transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(e.shown?"border-blue-200 bg-blue-50 text-blue-700 hover:bg-blue-100":"border-gray-200 bg-white text-gray-500 hover:bg-gray-50 hover:text-gray-900"),children:[
147
147
  /* @__PURE__ */Ye(Pe,{name:e.shown?"eye":"eye-off",className:"h-4 w-4 shrink-0",strokeWidth:"1.75"}),
148
148
  /* @__PURE__ */Ye(n,{children:e.label})]}),d=/* @__PURE__ */Ye("span",{id:a,className:"sr-only",children:e.shown?o.shown:o.hidden});/* @__PURE__ */
149
- return Ge(He,{children:[i?/* @__PURE__ */Ye(N,{reason:e.disabledReason,id:l,children:c}):/* @__PURE__ */Ye(C,{content:e.shown?o.shownHint:o.hiddenHint,describe:!1,className:"relative inline-flex max-w-full",children:c}),d]},e.id)})})}var mn=4,pn=10,gn={1:["100%"],2:["50%","50%"],3:["33.34%","33.33%","33.33%"],4:["25%","25%","25%","25%"]},fn={1:[],2:[50],3:[34,33],4:[25,25,25]},bn=e=>"number"==typeof e&&Number.isFinite(e);function xn(e,t){if(!Number.isInteger(t)||t<2||t>4)return;if(!Array.isArray(e)||e.length!==t-1)return;if(!e.every(bn))return;const r=[];let n=0;return e.forEach((e,a)=>{const l=((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))))(e,pn,100-n-(t-1-a)*pn);r.push(l),n+=l}),r}function yn(e,t){const r=xn(e,t);if(!r)return(e=>[...gn[e]??gn[1]])(t);const n=r.reduce((e,t)=>e+t,0);return[...r.map(e=>`${e}%`),100-n+"%"]}function vn(e,t){return yn(t,e)}var wn=(e,t,r)=>Math.min(r,Math.max(t,e)),Nn=e=>e.reduce((e,t)=>e+t,0),kn=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var $n,Mn="w-0.5",Cn=`${Mn} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var Ln=["text-blue-700","text-gray-600"];function Sn({count:e,value:t,onChange:r,label:n,"aria-labelledby":a,readOnly:l=!1,disabled:i=!1,footer:o=!0,className:s=""}){const c=he().widths,d=je(),u=wn(Math.round(e)||1,1,4),h=xn(t,u),m=h??[...fn[u]??[]],p=[...m,100-Nn(m)],g=l||i,f=Be(null),b=Be({onChange:r,shown:m,locked:g,n:u,stored:h});b.current={onChange:r,shown:m,locked:g,n:u,stored:h};const x=e=>{const{onChange:t,shown:r,locked:n,n:a}=b.current;if(n)return!1;const l=xn(e,a);return!(!l||kn(l,r))&&(t(l),!0)},y=(e,t,r)=>{const n=e[t]+e[t+1],a=[...e];a[t]=wn(Math.round(r),pn,n-pn),a[t+1]=n-a[t],x(a.slice(0,-1))&&(O.current=null)},v=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const r=t.shiftKey?10:1,n=p[e]+p[e+1],a="ArrowRight"===t.key?p[e]+r:"ArrowLeft"===t.key?p[e]-r:"PageUp"===t.key?p[e]+10:"PageDown"===t.key?p[e]-10:"Home"===t.key?pn:"End"===t.key?n-pn:null;null!==a&&(t.preventDefault(),y(p,e,a))},w=Be(null),[N,k]=Ee(null),$=()=>{w.current=null,k(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};Ie(()=>$,[]);const L=e=>t=>{if(0!==t.button||g)return;t.preventDefault();const r=f.current?.getBoundingClientRect().width??0;r<=0||(w.current={i:e,x:t.clientX,width:r,from:p,moved:!1,pointer:t.pointerId},k(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},S=e=>{const t=w.current;if(!t)return;if(0===e.buttons)return void $();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}y(t.from,t.i,t.from[t.i]+r/t.width*100)},D=e=>{const t=w.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),$())},P=(e,t)=>{const{shown:r}=b.current,n=function(e,t,r){const n=e.length,a=[...e];if(n<2)return a;const l=wn(Math.round(r),pn,100-(n-1)*pn);let i=l-a[t];a[t]=l;const o=[...Array.from({length:n-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(i<0)return a[o[0]]-=i,a;for(const e of o){if(i<=0)break;const t=Math.min(i,a[e]-pn);a[e]-=t,i-=t}return a}([...r,100-Nn(r)],e,t);return x(n.slice(0,-1))?n:null},[A,z]=Ee(0);Ie(()=>{const e=f.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>z(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const j=Be(null),[F,E]=Ee(null),[B,T]=Ee([]),I=(e,t)=>E(r=>t?e:r===e?null:r),O=Be(null),R=(e,t)=>{const r=O.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:a,stored:l}=b.current;var i,o;return a||(i=l,o=r.stored,void 0===i||void 0===o?i===o:kn(i,o))||n(r.stored),!0},W=p.join(",");Ie(()=>{const e=null===F?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===$n&&($n=document.createElement("canvas").getContext("2d")),!$n)return[];const a=$n;return r.flatMap((e,r)=>{if(r===t)return[];const l=e.getBoundingClientRect(),i=getComputedStyle(e);a.font=`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;const o=a.measureText(e.value).width/2,s=(l.left+l.right)/2;return s+o>n.left&&s-o<n.right?[r]:[]})}(j.current,F);T(t=>kn(t,e)?t:e)},[F,W,A]);const K=p.slice(0,-1).map((e,t)=>Nn(p.slice(0,t+1)));/* @__PURE__ */
149
+ return Ge(qe,{children:[i?/* @__PURE__ */Ye(N,{reason:e.disabledReason,id:l,children:c}):/* @__PURE__ */Ye(C,{content:e.shown?o.shownHint:o.hiddenHint,describe:!1,className:"relative inline-flex max-w-full",children:c}),d]},e.id)})})}var mn=4,pn=10,gn={1:["100%"],2:["50%","50%"],3:["33.34%","33.33%","33.33%"],4:["25%","25%","25%","25%"]},fn={1:[],2:[50],3:[34,33],4:[25,25,25]},bn=e=>"number"==typeof e&&Number.isFinite(e);function xn(e,t){if(!Number.isInteger(t)||t<2||t>4)return;if(!Array.isArray(e)||e.length!==t-1)return;if(!e.every(bn))return;const r=[];let n=0;return e.forEach((e,a)=>{const l=((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))))(e,pn,100-n-(t-1-a)*pn);r.push(l),n+=l}),r}function yn(e,t){const r=xn(e,t);if(!r)return(e=>[...gn[e]??gn[1]])(t);const n=r.reduce((e,t)=>e+t,0);return[...r.map(e=>`${e}%`),100-n+"%"]}function vn(e,t){return yn(t,e)}var wn=(e,t,r)=>Math.min(r,Math.max(t,e)),Nn=e=>e.reduce((e,t)=>e+t,0),kn=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var $n,Mn="w-0.5",Cn=`${Mn} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var Ln=["text-blue-700","text-gray-600"];function Sn({count:e,value:t,onChange:r,label:n,"aria-labelledby":a,readOnly:l=!1,disabled:i=!1,footer:o=!0,className:s=""}){const c=he().widths,d=ze(),u=wn(Math.round(e)||1,1,4),h=xn(t,u),m=h??[...fn[u]??[]],p=[...m,100-Nn(m)],g=l||i,f=Be(null),b=Be({onChange:r,shown:m,locked:g,n:u,stored:h});b.current={onChange:r,shown:m,locked:g,n:u,stored:h};const x=e=>{const{onChange:t,shown:r,locked:n,n:a}=b.current;if(n)return!1;const l=xn(e,a);return!(!l||kn(l,r))&&(t(l),!0)},y=(e,t,r)=>{const n=e[t]+e[t+1],a=[...e];a[t]=wn(Math.round(r),pn,n-pn),a[t+1]=n-a[t],x(a.slice(0,-1))&&(O.current=null)},v=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const r=t.shiftKey?10:1,n=p[e]+p[e+1],a="ArrowRight"===t.key?p[e]+r:"ArrowLeft"===t.key?p[e]-r:"PageUp"===t.key?p[e]+10:"PageDown"===t.key?p[e]-10:"Home"===t.key?pn:"End"===t.key?n-pn:null;null!==a&&(t.preventDefault(),y(p,e,a))},w=Be(null),[N,k]=Ee(null),$=()=>{w.current=null,k(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};Ie(()=>$,[]);const L=e=>t=>{if(0!==t.button||g)return;t.preventDefault();const r=f.current?.getBoundingClientRect().width??0;r<=0||(w.current={i:e,x:t.clientX,width:r,from:p,moved:!1,pointer:t.pointerId},k(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},S=e=>{const t=w.current;if(!t)return;if(0===e.buttons)return void $();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}y(t.from,t.i,t.from[t.i]+r/t.width*100)},D=e=>{const t=w.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),$())},P=(e,t)=>{const{shown:r}=b.current,n=function(e,t,r){const n=e.length,a=[...e];if(n<2)return a;const l=wn(Math.round(r),pn,100-(n-1)*pn);let i=l-a[t];a[t]=l;const o=[...Array.from({length:n-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(i<0)return a[o[0]]-=i,a;for(const e of o){if(i<=0)break;const t=Math.min(i,a[e]-pn);a[e]-=t,i-=t}return a}([...r,100-Nn(r)],e,t);return x(n.slice(0,-1))?n:null},[A,j]=Ee(0);Ie(()=>{const e=f.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>j(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const z=Be(null),[F,E]=Ee(null),[B,T]=Ee([]),I=(e,t)=>E(r=>t?e:r===e?null:r),O=Be(null),R=(e,t)=>{const r=O.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:a,stored:l}=b.current;var i,o;return a||(i=l,o=r.stored,void 0===i||void 0===o?i===o:kn(i,o))||n(r.stored),!0},W=p.join(",");Ie(()=>{const e=null===F?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===$n&&($n=document.createElement("canvas").getContext("2d")),!$n)return[];const a=$n;return r.flatMap((e,r)=>{if(r===t)return[];const l=e.getBoundingClientRect(),i=getComputedStyle(e);a.font=`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;const o=a.measureText(e.value).width/2,s=(l.left+l.right)/2;return s+o>n.left&&s-o<n.right?[r]:[]})}(z.current,F);T(t=>kn(t,e)?t:e)},[F,W,A]);const K=p.slice(0,-1).map((e,t)=>Nn(p.slice(0,t+1)));/* @__PURE__ */
150
150
  return Ge("div",{role:"group","aria-label":a?void 0:n,"aria-labelledby":a,"aria-describedby":u>1?d:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${i?"opacity-60":""} ${s}`.trim(),children:[
151
- /* @__PURE__ */Ge("div",{ref:j,"data-widths-bar":"",className:"relative h-8",children:[
151
+ /* @__PURE__ */Ge("div",{ref:z,"data-widths-bar":"",className:"relative h-8",children:[
152
152
  /* @__PURE__ */Ye("div",{ref:f,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-white",children:p.map((e,t)=>/* @__PURE__ */Ye("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${Ln[t%2]} ${t%2==0?"bg-blue-50":""}`,children:1===u&&/* @__PURE__ */Ye("span",{"data-widths-label":"",children:`${e}%`})},t))}),
153
- /* @__PURE__ */Ye("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),u>1&&p.map((e,t)=>/* @__PURE__ */Ge(He,{children:[(()=>{const r=F===t,n=Nn(p.slice(0,t)),a=r?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
153
+ /* @__PURE__ */Ye("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),u>1&&p.map((e,t)=>/* @__PURE__ */Ge(qe,{children:[(()=>{const r=F===t,n=Nn(p.slice(0,t)),a=r?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
154
154
  return Ye("div",{className:"absolute inset-y-0 "+(r?"z-20":""),style:{left:`clamp(0px, calc(${n+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */Ye(rn,{appearance:"bare",value:e,display:()=>(e=>A>0&&A*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:pn,max:100-(u-1)*pn,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:l,disabled:i,"aria-label":c.column(t+1),"aria-describedby":d,"data-widths-label":"",onChange:e=>{null===e||R(t,e)||P(t,e)},onRevert:e=>((e,t)=>{b.current.locked||null===t||R(e,t)||P(e,t)})(t,e),onFocus:()=>{O.current={column:t,share:e,stored:b.current.stored},I(t,!0)},onBlur:()=>I(t,!1),className:`absolute inset-0 text-xs font-medium ${Ln[t%2]} ${B.includes(t)&&!r?"opacity-0":""}`})})})(),t<u-1&&/* @__PURE__ */Ye("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${K[t]}%`},children:/* @__PURE__ */Ye(C,{content:c.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */Ye("div",{role:"separator",tabIndex:i?-1:0,"aria-orientation":"vertical","aria-label":c.divider(t+1,t+2),"aria-valuenow":p[t],"aria-valuemin":pn,"aria-valuemax":p[t]+p[t+1]-pn,"aria-valuetext":c.dividerValue(t+1,p[t],t+2,p[t+1]),"aria-disabled":g||void 0,onKeyDown:g?void 0:v(t),onPointerDown:L(t),onPointerMove:S,onPointerUp:D,onPointerCancel:D,onLostPointerCapture:()=>{w.current&&$()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(g?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */Ye("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(g?`${Mn} bg-gray-300`:`bg-blue-600 transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${N===t?"w-1":Cn}`)})})})})]},t))]}),u>1&&!o&&/* @__PURE__ */Ye("span",{id:d,className:"sr-only",children:c.hint(u,pn)}),u>1&&o&&/* @__PURE__ */Ye("div",{"data-widths-footer":"",className:"@container",children:/* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-2 @max-[264px]:flex-col @max-[264px]:items-end",children:[
155
155
  /* @__PURE__ */Ye("span",{id:d,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:c.hint(u,pn)}),
156
- /* @__PURE__ */Ye(M,{variant:"secondary",size:"sm",disabled:g,onClick:()=>{g||void 0===t||r(void 0)},className:"shrink-0",children:c.reset})]})})]})}var Dn=/(^|[\s:])!?z-/;function Pn({trigger:e,children:t,title:r,description:n,"aria-label":a,align:l="start",side:i="bottom",open:o,defaultOpen:s=!1,onOpenChange:c,matchTriggerWidth:d=!1,maxHeight:u,initialFocus:h,id:m,triggerLabel:p,"aria-describedby":g,disabled:f,className:b="",triggerClassName:x,panelClassName:y=""}){const[v,w]=Ee(s),N=(o??v)&&!f,k=ae(),$=Be(null),M=Be(null),C=Be(null),A=Be(null),z=je(),j=m??z,B=je(),T=je(),I=je(),R=Be(null),W=Be(!1),K=Be({openProp:o,onOpenChange:c});K.current={openProp:o,onOpenChange:c};const q=Fe(e=>{void 0===K.current.openProp&&w(e),K.current.onOpenChange?.(e)},[]),H=Fe((e=!1)=>{W.current=e,q(!1)},[q]),_=e=>{R.current=e.nativeEvent},U=Fe(()=>{const e=C.current,t=M.current;if(!e||!t)return;const r=t.getBoundingClientRect(),n=L(t),a=Math.max(0,n.right-n.left-2*S),o=e.style;o.left="0px",o.top="0px",o.maxWidth=`${a}px`,o.maxHeight="none",o.width=d?`${Math.min(r.width,a)}px`:"";const s={width:e.offsetWidth,height:e.offsetHeight},c=u??1/0,h=D({trigger:r,menu:{width:s.width,height:Math.min(s.height,c)},bounds:n,align:l,side:i}),m=Math.min(h.maxHeight,c);o.left=`${h.left}px`,o.top=`${h.top}px`,o.maxHeight=`${m}px`,o.overflowY=s.height>m?"auto":"",e.dataset.side=h.side,e.dataset.align=l},[l,i,d,u]);re(()=>{N&&k&&U()}),Ie(()=>{if(!N||!k)return;const e=P(()=>M.current,U),t=A.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>U());return r.observe(t),()=>{e(),r.disconnect()}},[N,k,U]),Ie(()=>{if(!N)return;const e=e=>{let t=null,r=0;const n=e=>{t===e&&(t=null,window.clearTimeout(r),(e=>{if(R.current===e)return!1;const t=e.target;return!(t&&($.current?.contains(t)||C.current?.contains(t)))})(e)&&H(!0))},a=e=>{t=e,r=window.setTimeout(()=>n(e),0)},l=e=>n(e);return document.addEventListener(e,a,!0),window.addEventListener(e,l),()=>{window.clearTimeout(r),document.removeEventListener(e,a,!0),window.removeEventListener(e,l)}},t=e("pointerdown"),r=e("focusin"),n=ee(()=>H()),a=Q(e=>"Escape"===e.key&&(H(),M.current?.focus(),!0),()=>C.current);return()=>{t(),r(),n(),a()}},[N,H]),F(C,N&&k),re(()=>{if(!N||!k)return;const e=C.current;return()=>{if(W.current)return;const t=document.activeElement;t&&t!==document.body&&!e?.contains(t)||M.current?.focus({preventScroll:!0})}},[N,k]),Ie(()=>{if(!N||!k)return;const e=C.current;e&&(W.current=!1,(h?.current??E(e)[0]??e).focus({preventScroll:!0}))},[N,k]);const V="function"==typeof t?t({close:()=>H()}):t,Y=r?{"aria-labelledby":T}:a?{"aria-label":a}:{"aria-labelledby":j};/* @__PURE__ */
156
+ /* @__PURE__ */Ye(M,{variant:"secondary",size:"sm",disabled:g,onClick:()=>{g||void 0===t||r(void 0)},className:"shrink-0",children:c.reset})]})})]})}var Dn=/(^|[\s:])!?z-/;function Pn({trigger:e,children:t,title:r,description:n,"aria-label":a,align:l="start",side:i="bottom",open:o,defaultOpen:s=!1,onOpenChange:c,matchTriggerWidth:d=!1,maxHeight:u,initialFocus:h,id:m,triggerLabel:p,"aria-describedby":g,disabled:f,className:b="",triggerClassName:x,panelClassName:y=""}){const[v,w]=Ee(s),N=(o??v)&&!f,k=ae(),$=Be(null),M=Be(null),C=Be(null),A=Be(null),j=ze(),z=m??j,B=ze(),T=ze(),I=ze(),R=Be(null),W=Be(!1),K=Be({openProp:o,onOpenChange:c});K.current={openProp:o,onOpenChange:c};const _=Fe(e=>{void 0===K.current.openProp&&w(e),K.current.onOpenChange?.(e)},[]),q=Fe((e=!1)=>{W.current=e,_(!1)},[_]),H=e=>{R.current=e.nativeEvent},U=Fe(()=>{const e=C.current,t=M.current;if(!e||!t)return;const r=t.getBoundingClientRect(),n=L(t),a=Math.max(0,n.right-n.left-2*S),o=e.style;o.left="0px",o.top="0px",o.maxWidth=`${a}px`,o.maxHeight="none",o.width=d?`${Math.min(r.width,a)}px`:"";const s={width:e.offsetWidth,height:e.offsetHeight},c=u??1/0,h=D({trigger:r,menu:{width:s.width,height:Math.min(s.height,c)},bounds:n,align:l,side:i}),m=Math.min(h.maxHeight,c);o.left=`${h.left}px`,o.top=`${h.top}px`,o.maxHeight=`${m}px`,o.overflowY=s.height>m?"auto":"",e.dataset.side=h.side,e.dataset.align=l},[l,i,d,u]);re(()=>{N&&k&&U()}),Ie(()=>{if(!N||!k)return;const e=P(()=>M.current,U),t=A.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>U());return r.observe(t),()=>{e(),r.disconnect()}},[N,k,U]),Ie(()=>{if(!N)return;const e=e=>{let t=null,r=0;const n=e=>{t===e&&(t=null,window.clearTimeout(r),(e=>{if(R.current===e)return!1;const t=e.target;return!(t&&($.current?.contains(t)||C.current?.contains(t)))})(e)&&q(!0))},a=e=>{t=e,r=window.setTimeout(()=>n(e),0)},l=e=>n(e);return document.addEventListener(e,a,!0),window.addEventListener(e,l),()=>{window.clearTimeout(r),document.removeEventListener(e,a,!0),window.removeEventListener(e,l)}},t=e("pointerdown"),r=e("focusin"),n=ee(()=>q()),a=Q(e=>"Escape"===e.key&&(q(),M.current?.focus(),!0),()=>C.current);return()=>{t(),r(),n(),a()}},[N,q]),F(C,N&&k),re(()=>{if(!N||!k)return;const e=C.current;return()=>{if(W.current)return;const t=document.activeElement;t&&t!==document.body&&!e?.contains(t)||M.current?.focus({preventScroll:!0})}},[N,k]),Ie(()=>{if(!N||!k)return;const e=C.current;e&&(W.current=!1,(h?.current??E(e)[0]??e).focus({preventScroll:!0}))},[N,k]);const V="function"==typeof t?t({close:()=>q()}):t,Y=r?{"aria-labelledby":T}:a?{"aria-label":a}:{"aria-labelledby":z};/* @__PURE__ */
157
157
  return Ge("div",{ref:$,className:`relative inline-flex ${b}`.trim(),children:[
158
- /* @__PURE__ */Ye("button",{ref:M,id:j,type:"button","aria-haspopup":"dialog","aria-expanded":N,"aria-controls":N&&k?B:void 0,"aria-label":p,"aria-describedby":g,disabled:f,onClick:()=>N?H():q(!0),onKeyDown:e=>{if("Tab"!==e.key||e.shiftKey||!N)return;const t=(()=>{const e=C.current;return e?E(e)[0]??e:null})();t&&(e.preventDefault(),t.focus({preventScroll:!0}))},className:x??G({variant:"secondary"}),children:e}),N&&k&&Ze(
159
- /* @__PURE__ */Ye("div",{ref:C,id:B,role:"dialog",...Y,"aria-describedby":n?I:void 0,tabIndex:-1,"data-popover-panel":"",onPointerDownCapture:_,onFocusCapture:_,onKeyDown:e=>{const t=C.current,r=M.current;if("Tab"!==e.key||!t||!r||!t.contains(e.target))return;const n=E(t),a=document.activeElement;if(e.shiftKey){if(n.length>0&&a!==n[0]&&a!==t)return;return e.preventDefault(),void r.focus({preventScroll:!0})}if(n.length>0&&a!==n[n.length-1])return;e.preventDefault();const l=O(r,t);H(!!l),(l??r).focus({preventScroll:!0})},className:`fixed rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${y}`.trim(),style:Dn.test(y)?void 0:{zIndex:te.popup},children:/* @__PURE__ */Ge("div",{ref:A,children:[r&&/* @__PURE__ */Ye("h2",{id:T,className:"text-sm font-semibold text-gray-900",children:r}),n&&/* @__PURE__ */Ye("p",{id:I,className:"mt-1 text-sm text-gray-500",children:n}),r||n?/* @__PURE__ */Ye("div",{className:"mt-3",children:V}):V]})}),document.body)]})}var An=/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function zn(e){const t=e.trim().replace(/^#/,"");if(!An.test(t))return null;return`#${(3===t.length?[...t].map(e=>e+e).join(""):t).toLowerCase()}`}var jn=e=>e.toUpperCase(),Fn=(e,t,r)=>Math.min(r,Math.max(t,e));function En(e){const t=zn(e);if(!t)return{h:0,s:0,v:0};const r=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,a=parseInt(t.slice(5,7),16)/255,l=Math.max(r,n,a),i=l-Math.min(r,n,a);let o=0;return 0!==i&&(o=l===r?(n-a)/i%6*60:l===n?60*((a-r)/i+2):60*((r-n)/i+4)),{h:(o+360)%360,s:0===l?0:i/l,v:l}}function Bn({h:e,s:t,v:r}){const n=(e%360+360)%360,a=Fn(t,0,1),l=Fn(r,0,1),i=l*a,o=i*(1-Math.abs(n/60%2-1)),s=l-i,[c,d,u]=n<60?[i,o,0]:n<120?[o,i,0]:n<180?[0,i,o]:n<240?[0,o,i]:n<300?[o,0,i]:[i,0,o],h=e=>Math.round(255*(e+s)).toString(16).padStart(2,"0");return`#${h(c)}${h(d)}${h(u)}`}var Tn=`linear-gradient(to right, ${[0,60,120,180,240,300,360].map(e=>Bn({h:e%360,s:1,v:1})).join(", ")})`,In={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},On={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function Rn(e){return e?{background:e}:On}function Wn({size:e="md",selected:t=!1,className:r=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",t?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",In[e],r].filter(Boolean).join(" ")}var Kn=ze(function({color:e,size:t="md",selected:r,className:n,type:a="button",...l},i){/* @__PURE__ */
160
- return Ye("button",{ref:i,type:a,"aria-pressed":r,className:Wn({size:t,selected:r,className:n}),...l,children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"absolute inset-0",style:Rn(e)})})}),qn=(e,t,r)=>Math.min(r,Math.max(t,e)),Hn=e=>"string"==typeof e?{value:e}:e;var _n={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function Un({value:e,onChange:t,label:r,presets:n,clearable:a=!1,fallback:l,dragWrites:i="live",disabled:o=!1,onClose:s,id:c,className:d=""}){const u=he().color,h=zn(l??""),[m,p]=Ee(()=>En(e||h||"")),g=Be(e);Ie(()=>{e!==g.current&&(g.current=e,e?p(En(e)):h&&p(En(h)))},[e]);const f=r=>{o||r===e||(g.current=r,t(r))},b=e=>{const t=zn(e);t&&(p(En(t)),f(t))},x=e=>{p(e),f(Bn(e))},[y,v]=Ee(!1),w=Be(m);w.current=m;const N=e=>({onPointerDown:t=>{if(o||0!==t.button)return;t.currentTarget.setPointerCapture?.(t.pointerId),t.currentTarget.focus({preventScroll:!0});const r=e(t,w.current);"end"===i?(v(!0),p(r)):x(r)},onPointerMove:t=>{if(o||!(1&t.buttons))return;const r=e(t,w.current);"end"===i?p(r):x(r)},onPointerUp:t=>{"end"===i&&y&&(v(!1),x(e(t,w.current)))}}),k=N((e,t)=>{return{...t,...(r=e.clientX,n=e.clientY,a=e.currentTarget.getBoundingClientRect(),{s:a.width>0?Fn((r-a.left)/a.width,0,1):0,v:a.height>0?1-Fn((n-a.top)/a.height,0,1):0})};var r,n,a}),$=N((e,t)=>{return{...t,h:(r=e.clientX,n=e.currentTarget.getBoundingClientRect(),n.width>0?Math.min(359,360*Fn((r-n.left)/n.width,0,1)):0)};var r,n}),M=y?Bn(m):e,L=e=>`${Math.round(100*e)}%`,S=(n??[]).map(Hn),D=zn(e);/* @__PURE__ */
161
- return Ge("div",{id:c,className:`flex w-56 flex-col gap-3 ${o?"opacity-60":""} ${d}`.trim(),onKeyDown:e=>{"Escape"===e.key&&s&&(e.preventDefault(),e.stopPropagation(),s())},children:[(S.length>0||a)&&/* @__PURE__ */Ge("div",{role:"group","aria-label":u.presets,className:"flex flex-wrap gap-2",children:[a&&/* @__PURE__ */Ye(C,{content:u.clear,children:/* @__PURE__ */Ye(Kn,{color:"",size:"sm","aria-label":u.clear,selected:""===e,disabled:o,onClick:()=>{o||""===e||(g.current="",t(""))}})}),S.map(e=>{const t=zn(e.value),r=e.label?`${e.label} · ${jn(t??e.value)}`:jn(t??e.value);/* @__PURE__ */
158
+ /* @__PURE__ */Ye("button",{ref:M,id:z,type:"button","aria-haspopup":"dialog","aria-expanded":N,"aria-controls":N&&k?B:void 0,"aria-label":p,"aria-describedby":g,disabled:f,onClick:()=>N?q():_(!0),onKeyDown:e=>{if("Tab"!==e.key||e.shiftKey||!N)return;const t=(()=>{const e=C.current;return e?E(e)[0]??e:null})();t&&(e.preventDefault(),t.focus({preventScroll:!0}))},className:x??G({variant:"secondary"}),children:e}),N&&k&&Ze(
159
+ /* @__PURE__ */Ye("div",{ref:C,id:B,role:"dialog",...Y,"aria-describedby":n?I:void 0,tabIndex:-1,"data-popover-panel":"",onPointerDownCapture:H,onFocusCapture:H,onKeyDown:e=>{const t=C.current,r=M.current;if("Tab"!==e.key||!t||!r||!t.contains(e.target))return;const n=E(t),a=document.activeElement;if(e.shiftKey){if(n.length>0&&a!==n[0]&&a!==t)return;return e.preventDefault(),void r.focus({preventScroll:!0})}if(n.length>0&&a!==n[n.length-1])return;e.preventDefault();const l=O(r,t);q(!!l),(l??r).focus({preventScroll:!0})},className:`fixed rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${y}`.trim(),style:Dn.test(y)?void 0:{zIndex:te.popup},children:/* @__PURE__ */Ge("div",{ref:A,children:[r&&/* @__PURE__ */Ye("h2",{id:T,className:"text-sm font-semibold text-gray-900",children:r}),n&&/* @__PURE__ */Ye("p",{id:I,className:"mt-1 text-sm text-gray-500",children:n}),r||n?/* @__PURE__ */Ye("div",{className:"mt-3",children:V}):V]})}),document.body)]})}var An=/^(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function jn(e){const t=e.trim().replace(/^#/,"");if(!An.test(t))return null;return`#${(3===t.length?[...t].map(e=>e+e).join(""):t).toLowerCase()}`}var zn=e=>e.toUpperCase(),Fn=(e,t,r)=>Math.min(r,Math.max(t,e));function En(e){const t=jn(e);if(!t)return{h:0,s:0,v:0};const r=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,a=parseInt(t.slice(5,7),16)/255,l=Math.max(r,n,a),i=l-Math.min(r,n,a);let o=0;return 0!==i&&(o=l===r?(n-a)/i%6*60:l===n?60*((a-r)/i+2):60*((r-n)/i+4)),{h:(o+360)%360,s:0===l?0:i/l,v:l}}function Bn({h:e,s:t,v:r}){const n=(e%360+360)%360,a=Fn(t,0,1),l=Fn(r,0,1),i=l*a,o=i*(1-Math.abs(n/60%2-1)),s=l-i,[c,d,u]=n<60?[i,o,0]:n<120?[o,i,0]:n<180?[0,i,o]:n<240?[0,o,i]:n<300?[o,0,i]:[i,0,o],h=e=>Math.round(255*(e+s)).toString(16).padStart(2,"0");return`#${h(c)}${h(d)}${h(u)}`}var Tn=`linear-gradient(to right, ${[0,60,120,180,240,300,360].map(e=>Bn({h:e%360,s:1,v:1})).join(", ")})`,In={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},On={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function Rn(e){return e?{background:e}:On}function Wn({size:e="md",selected:t=!1,className:r=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",t?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",In[e],r].filter(Boolean).join(" ")}var Kn=je(function({color:e,size:t="md",selected:r,className:n,type:a="button",...l},i){/* @__PURE__ */
160
+ return Ye("button",{ref:i,type:a,"aria-pressed":r,className:Wn({size:t,selected:r,className:n}),...l,children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"absolute inset-0",style:Rn(e)})})}),_n=(e,t,r)=>Math.min(r,Math.max(t,e)),qn=e=>"string"==typeof e?{value:e}:e;var Hn={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function Un({value:e,onChange:t,label:r,presets:n,clearable:a=!1,fallback:l,dragWrites:i="live",disabled:o=!1,onClose:s,id:c,className:d=""}){const u=he().color,h=jn(l??""),[m,p]=Ee(()=>En(e||h||"")),g=Be(e);Ie(()=>{e!==g.current&&(g.current=e,e?p(En(e)):h&&p(En(h)))},[e]);const f=r=>{o||r===e||(g.current=r,t(r))},b=e=>{const t=jn(e);t&&(p(En(t)),f(t))},x=e=>{p(e),f(Bn(e))},[y,v]=Ee(!1),w=Be(m);w.current=m;const N=e=>({onPointerDown:t=>{if(o||0!==t.button)return;t.currentTarget.setPointerCapture?.(t.pointerId),t.currentTarget.focus({preventScroll:!0});const r=e(t,w.current);"end"===i?(v(!0),p(r)):x(r)},onPointerMove:t=>{if(o||!(1&t.buttons))return;const r=e(t,w.current);"end"===i?p(r):x(r)},onPointerUp:t=>{"end"===i&&y&&(v(!1),x(e(t,w.current)))}}),k=N((e,t)=>{return{...t,...(r=e.clientX,n=e.clientY,a=e.currentTarget.getBoundingClientRect(),{s:a.width>0?Fn((r-a.left)/a.width,0,1):0,v:a.height>0?1-Fn((n-a.top)/a.height,0,1):0})};var r,n,a}),$=N((e,t)=>{return{...t,h:(r=e.clientX,n=e.currentTarget.getBoundingClientRect(),n.width>0?Math.min(359,360*Fn((r-n.left)/n.width,0,1)):0)};var r,n}),M=y?Bn(m):e,L=e=>`${Math.round(100*e)}%`,S=(n??[]).map(qn),D=jn(e);/* @__PURE__ */
161
+ return Ge("div",{id:c,className:`flex w-56 flex-col gap-3 ${o?"opacity-60":""} ${d}`.trim(),onKeyDown:e=>{"Escape"===e.key&&s&&(e.preventDefault(),e.stopPropagation(),s())},children:[(S.length>0||a)&&/* @__PURE__ */Ge("div",{role:"group","aria-label":u.presets,className:"flex flex-wrap gap-2",children:[a&&/* @__PURE__ */Ye(C,{content:u.clear,children:/* @__PURE__ */Ye(Kn,{color:"",size:"sm","aria-label":u.clear,selected:""===e,disabled:o,onClick:()=>{o||""===e||(g.current="",t(""))}})}),S.map(e=>{const t=jn(e.value),r=e.label?`${e.label} · ${zn(t??e.value)}`:zn(t??e.value);/* @__PURE__ */
162
162
  return Ye(C,{content:r,children:/* @__PURE__ */Ye(Kn,{color:t??e.value,size:"sm","aria-label":r,selected:null!==t&&t===D,disabled:o,onClick:()=>b(e.value)})},`${e.label??""}:${e.value}`)})]}),
163
- /* @__PURE__ */Ye("div",{role:"slider",tabIndex:o?-1:0,"aria-label":u.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*m.v),"aria-valuetext":u.squareValue(Math.round(100*m.s),Math.round(100*m.v)),"aria-disabled":o||void 0,"data-color-square":"",onKeyDown:e=>{if(o)return;const t=function(e,t,r){const n=r?.1:.01,a={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[t];return a?{...e,s:qn(e.s+a[0],0,1),v:qn(e.v+a[1],0,1)}:null}(m,e.key,e.shiftKey);t&&(e.preventDefault(),x(t))},...k,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:Bn({h:m.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:L(m.s),top:L(1-m.v),..._n}})}),
164
- /* @__PURE__ */Ye("div",{role:"slider",tabIndex:o?-1:0,"aria-label":u.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(m.h),"aria-orientation":"horizontal","aria-disabled":o||void 0,"data-color-hue":"",onKeyDown:e=>{if(o)return;const t=function(e,t,r){const n=r?10:1;switch(t){case"ArrowLeft":case"ArrowDown":return qn(e-n,0,359);case"ArrowRight":case"ArrowUp":return qn(e+n,0,359);case"PageDown":return qn(e-10,0,359);case"PageUp":return qn(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}(m.h,e.key,e.shiftKey);null!==t&&(e.preventDefault(),x({...m,h:t}))},...$,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:Tn},children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:m.h/360*100+"%",background:Bn({h:m.h,s:1,v:1}),..._n}})}),
163
+ /* @__PURE__ */Ye("div",{role:"slider",tabIndex:o?-1:0,"aria-label":u.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*m.v),"aria-valuetext":u.squareValue(Math.round(100*m.s),Math.round(100*m.v)),"aria-disabled":o||void 0,"data-color-square":"",onKeyDown:e=>{if(o)return;const t=function(e,t,r){const n=r?.1:.01,a={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[t];return a?{...e,s:_n(e.s+a[0],0,1),v:_n(e.v+a[1],0,1)}:null}(m,e.key,e.shiftKey);t&&(e.preventDefault(),x(t))},...k,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:Bn({h:m.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:L(m.s),top:L(1-m.v),...Hn}})}),
164
+ /* @__PURE__ */Ye("div",{role:"slider",tabIndex:o?-1:0,"aria-label":u.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(m.h),"aria-orientation":"horizontal","aria-disabled":o||void 0,"data-color-hue":"",onKeyDown:e=>{if(o)return;const t=function(e,t,r){const n=r?10:1;switch(t){case"ArrowLeft":case"ArrowDown":return _n(e-n,0,359);case"ArrowRight":case"ArrowUp":return _n(e+n,0,359);case"PageDown":return _n(e-10,0,359);case"PageUp":return _n(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}(m.h,e.key,e.shiftKey);null!==t&&(e.preventDefault(),x({...m,h:t}))},...$,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:Tn},children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:m.h/360*100+"%",background:Bn({h:m.h,s:1,v:1}),...Hn}})}),
165
165
  /* @__PURE__ */Ge("div",{className:"flex items-center gap-2",children:[
166
166
  /* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-gray-300",style:Rn(M||(h??""))}),
167
- /* @__PURE__ */Ye(Vn,{value:M,placeholder:!e&&h?jn(h):void 0,onChange:b,label:u.hex(r),disabled:o})]})]})}function Vn({value:e,onChange:t,label:r,placeholder:n,disabled:a,id:i,size:o="md",className:s=""}){const[c,d]=Ee(null);/* @__PURE__ */
168
- return Ye("input",{id:i,type:"text",value:c??(e?jn(e):""),"aria-label":r,placeholder:n,maxLength:7,spellCheck:!1,autoComplete:"off",disabled:a,onChange:r=>{d(r.target.value);const n=zn(r.target.value);null!==n&&n!==e&&t(n)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(null))},onBlur:()=>d(null),className:l({size:o,className:`min-w-0 flex-1 font-mono uppercase ${s}`.trim()})})}function Yn({value:e,onChange:t,label:r,presets:n,clearable:a,fallback:l,dragWrites:i,disabled:o,id:s,showHexInput:c=!1,size:d="md",align:u="start",open:h,onOpenChange:m,className:p=""}){const g=he().color,f=je(),b=zn(l??""),x=e||b||"",y=e?jn(e):b?jn(b):g.none;/* @__PURE__ */
167
+ /* @__PURE__ */Ye(Vn,{value:M,placeholder:!e&&h?zn(h):void 0,onChange:b,label:u.hex(r),disabled:o})]})]})}function Vn({value:e,onChange:t,label:r,placeholder:n,disabled:a,id:i,size:o="md",className:s=""}){const[c,d]=Ee(null);/* @__PURE__ */
168
+ return Ye("input",{id:i,type:"text",value:c??(e?zn(e):""),"aria-label":r,placeholder:n,maxLength:7,spellCheck:!1,autoComplete:"off",disabled:a,onChange:r=>{d(r.target.value);const n=jn(r.target.value);null!==n&&n!==e&&t(n)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(null))},onBlur:()=>d(null),className:l({size:o,className:`min-w-0 flex-1 font-mono uppercase ${s}`.trim()})})}function Yn({value:e,onChange:t,label:r,presets:n,clearable:a,fallback:l,dragWrites:i,disabled:o,id:s,showHexInput:c=!1,size:d="md",align:u="start",open:h,onOpenChange:m,className:p=""}){const g=he().color,f=ze(),b=jn(l??""),x=e||b||"",y=e?zn(e):b?zn(b):g.none;/* @__PURE__ */
169
169
  return Ge("div",{className:`inline-flex items-center gap-2 ${p}`.trim(),children:[
170
170
  /* @__PURE__ */Ye(Pn,{id:s,trigger:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"absolute inset-0",style:Rn(x)}),triggerLabel:g.swatch(r,y),triggerClassName:Wn({size:d}),"aria-label":g.panel(r),align:u,open:h,onOpenChange:m,disabled:o,children:/* @__PURE__ */Ye(Un,{id:f,value:e,onChange:t,label:r,presets:n,clearable:a,fallback:l,dragWrites:i,disabled:o})}),c&&
171
- /* @__PURE__ */Ye("div",{className:"w-24 flex-none",children:/* @__PURE__ */Ye(Vn,{value:e,placeholder:!e&&b?jn(b):void 0,onChange:r=>{o||r===e||t(r)},label:g.hex(r),disabled:o,size:d})})]})}var Gn={background:"color-mix(in srgb, var(--status-on-solid) 45%, transparent)"},Xn={borderColor:"var(--status-on-solid)",boxShadow:"0 0 0 1px var(--rosh-media-scrim-button), 0 1px 4px var(--rosh-media-scrim-button)"};function Zn({value:e,onChange:t,label:r,image:n,hint:a,emptyText:l,actions:i,disabled:o=!1,id:s,className:c=""}){const d=he().imageFocus,u=je(),h=Be(null),m=Be(!1),{x:p,y:g}=ye(e),f=ve(p,g),b=r=>{r!==e&&t(r)},x=(e,t)=>{const r=h.current?.getBoundingClientRect();if(!r)return;const n=Ne(r,e,t);b(ve(n.x,n.y))},y=()=>{m.current=!1};if(!n)/* @__PURE__ */
171
+ /* @__PURE__ */Ye("div",{className:"w-24 flex-none",children:/* @__PURE__ */Ye(Vn,{value:e,placeholder:!e&&b?zn(b):void 0,onChange:r=>{o||r===e||t(r)},label:g.hex(r),disabled:o,size:d})})]})}var Gn={background:"color-mix(in srgb, var(--status-on-solid) 45%, transparent)"},Xn={borderColor:"var(--status-on-solid)",boxShadow:"0 0 0 1px var(--rosh-media-scrim-button), 0 1px 4px var(--rosh-media-scrim-button)"};function Zn({value:e,onChange:t,label:r,image:n,hint:a,emptyText:l,actions:i,disabled:o=!1,id:s,className:c=""}){const d=he().imageFocus,u=ze(),h=Be(null),m=Be(!1),{x:p,y:g}=ye(e),f=ve(p,g),b=r=>{r!==e&&t(r)},x=(e,t)=>{const r=h.current?.getBoundingClientRect();if(!r)return;const n=Ne(r,e,t);b(ve(n.x,n.y))},y=()=>{m.current=!1};if(!n)/* @__PURE__ */
172
172
  return Ye("div",{"data-image-focus":"",className:c||void 0,children:/* @__PURE__ */Ye("p",{className:"text-xs text-gray-500",children:l??d.noImage})});const v=void 0===a,w=null!==a;/* @__PURE__ */
173
173
  return Ge("div",{"data-image-focus":"",className:`flex flex-col gap-2 ${c}`.trim(),children:[
174
174
  /* @__PURE__ */Ye("button",{id:s,type:"button","data-image-focus-picture":"",disabled:o,"aria-label":d.picture(r,f),"aria-describedby":u,onKeyDown:t=>{if(o||t.altKey||t.ctrlKey||t.metaKey)return;const r=we(e,t.key,t.shiftKey);null!==r&&(t.preventDefault(),b(r))},onPointerDown:e=>{o||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),m.current=!0,x(e.clientX,e.clientY))},onPointerMove:e=>{m.current&&!o&&x(e.clientX,e.clientY)},onPointerUp:y,onPointerCancel:y,onLostPointerCapture:y,className:["flex min-h-36 w-full touch-none items-center justify-center overflow-hidden rounded-md border border-gray-200 bg-gray-50 p-0","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",o?"cursor-not-allowed opacity-60":"cursor-crosshair"].join(" "),children:/* @__PURE__ */Ge("span",{ref:h,"data-image-focus-pane":"",className:"relative block max-w-full",children:[
@@ -176,25 +176,25 @@ return Ge("div",{"data-image-focus":"",className:`flex flex-col gap-2 ${c}`.trim
176
176
  /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-image-focus-cross":"h",className:"pointer-events-none absolute inset-x-0 h-px",style:{top:`${g}%`,...Gn}}),
177
177
  /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-image-focus-cross":"v",className:"pointer-events-none absolute inset-y-0 w-px",style:{left:`${p}%`,...Gn}}),
178
178
  /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-image-focus-dot":"",className:"pointer-events-none absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2",style:{left:`${p}%`,top:`${g}%`,...Xn}})]})}),w||i?/* @__PURE__ */Ge("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */Ye("span",w?{id:v?u:void 0,className:"min-w-0 flex-1 text-xs text-gray-500",children:v?d.hint:a}:{className:"min-w-0 flex-1"}),i]}):null,!v&&/* @__PURE__ */Ye("span",{id:u,className:"sr-only",children:d.hint})]})}function Jn({onClear:e,ariaLabel:t}){/* @__PURE__ */
179
- return Ye("button",{type:"button","aria-label":t,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),e()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity text-base leading-none",children:"×"})}function Qn(e){const{options:t,placeholder:r,emptyOptionLabel:n,className:a="",disabled:l,id:i,filter:o=!1,allowFreeText:s=!1,freeTextOption:c,onSearchChange:h,loading:m=!1,error:p,onRetry:g,rightAdornment:f,renderOption:b,clearable:x=!0,"aria-label":y,"aria-labelledby":v,"aria-describedby":w}=e,N=!0===e.multiple,L=e.multiple?e.value:e.value?[e.value]:[],S=e.multiple?"":e.value,D=t=>{e.multiple?e.onChange(t):e.onChange(t[0]??"")},P=L.length>0,A=o&&P&&!l,z=N||o,j=null!=c,F=s||j,[E,B]=Ee(!1),[T,I]=Ee(-1),O=je(),R=i??`${O}-input`,W=`${O}-listbox`,K=e=>`${O}-opt-${e}`,[q,H]=Ee(""),_=he(),U=n??_.select.none,V=e=>{H(e),I(-1),h?.(e)},Y=Be(null),G=Be(null),J=Be(null),ne=Be(null),ae=Be(E);ae.current=E;const le=Be(!1),ie=e=>{ae.current&&(ae.current=!1,e&&s&&!j&&De&&(N?L.includes(De)||D([...L,De]):De!==S&&D([De])),B(!1),V(""))},oe=(e,t)=>{if(!e.disabled){if(N)return D(L.includes(e.value)?L.filter(t=>t!==e.value):[...L,e.value]),void(e===Pe?V(""):I(t));D([e.value]),ie(!1)}},[se,ce]=Ee(null);re(()=>{if(!f||E)return void ce(null);const e=ne.current?.offsetWidth??0;ce(e?e+(fe?32:8)+6:null)});const de=k(G,E,z?{popupRef:J}:{matchTriggerWidth:!0}),ue=Te(()=>it(t),[t]),me=L.join("\0"),pe=Te(()=>{const e=[],t=/* @__PURE__ */new Set;for(const r of ue)L.includes(r.value)&&!t.has(r.value)&&(t.add(r.value),e.push(r.label));if(F)for(const r of L)t.has(r)||e.push(r);return e},[ue,me,F]),ge=pe.join(", "),fe=x&&P&&!l,[be,xe]=Ee(null),ye=Be(null),ve=Be(""),we=Be(()=>{});we.current=()=>{const e=G.current,t=ye.current;if(!N||!e||!t)return;const r=getComputedStyle(e),n=e.clientWidth-(parseFloat(r.paddingLeft)||0)-(parseFloat(r.paddingRight)||0),a=[r.fontStyle,r.fontWeight,r.fontSize,r.fontFamily,r.letterSpacing].join("|"),l=`${n}|${a}|${pe.join("\0")}`;if(l===ve.current)return;ve.current=l;let i=null;n>0&&pe.length>0&&(t.style.fontStyle=r.fontStyle,t.style.fontWeight=r.fontWeight,t.style.fontSize=r.fontSize,t.style.fontFamily=r.fontFamily,t.style.letterSpacing=r.letterSpacing,i=function(e,t){const r=e.length;if(0===r||t(e.join(", ")))return{shown:r,cut:!1};if(1===r)return{shown:1,cut:!0};let n=0;for(let a=1;a<r&&t(`${e.slice(0,a).join(", ")} +${r-a}`);a+=1)n=a;return{shown:n,cut:!1}}(pe,e=>(t.textContent=e,t.getBoundingClientRect().width<=n)),t.textContent=""),xe(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},re(()=>{we.current()}),Ie(()=>{const e=G.current;if(!N||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>we.current());return t.observe(e),()=>t.disconnect()},[N]);const Ne=pe.length,ke=!N||!be||be.shown>=Ne?ge:0===be.shown?_.select.selectedCount(Ne):`${pe.slice(0,be.shown).join(", ")} +${Ne-be.shown}`,$e=N&&null!==be&&(be.shown<Ne||be.cut),Me=E&&P&&z;Ie(()=>{if(!E)return;const e=e=>{const t=e.target;Y.current?.contains(t)||J.current?.contains(t)||ie(!0)};document.addEventListener("mousedown",e);const t=ee(()=>ie(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[E,s,q,me,e.onChange]),Ie(()=>{if(E)return Q(e=>!("Escape"!==e.key||!ae.current)&&(ie(!1),G.current?.blur(),!0),()=>J.current)},[E]);const Ce=Te(()=>{const e=/* @__PURE__ */new Set;return ot(t,t=>!e.has(t.value)&&(e.add(t.value),!0))},[t]),Le=Te(()=>{if(h)return Ce;const e=q.trim().toLowerCase();return e?ot(Ce,t=>dt(t,e)):Ce},[Ce,q,h]),Se=Te(()=>it(Le),[Le]),De=q.trim(),Pe=Te(()=>j&&De?ue.some(e=>e.label===De)||L.includes(De)?null:{value:De,label:De}:null,[j,De,ue,me]),Ae=Te(()=>Pe?[...Se,Pe]:Se,[Se,Pe]);/* @__PURE__ */
180
- return Ge("div",{ref:Y,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&(Y.current?.contains(t)||J.current?.contains(t))||le.current||document.activeElement!==G.current&&ie(!0)},children:[(ze=/* @__PURE__ */Ye("input",{id:R,ref:G,type:"text",autoComplete:"off",role:"combobox","aria-expanded":E,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":E?W:void 0,"aria-activedescendant":E&&T>=0&&T<Ae.length?K(T):void 0,"aria-label":v?void 0:y,"aria-labelledby":v,"aria-describedby":w,value:E?q:ke,onChange:e=>{V(e.target.value),B(!0)},onFocus:()=>{l||(V(""),B(!0))},onKeyDown:e=>{if("ArrowDown"===e.key||"ArrowUp"===e.key){if(l)return;if(e.preventDefault(),!E)return void B(!0);if(0===Ae.length)return;const t="ArrowDown"===e.key?1:-1;return void I(e=>nt(Ae,e,t))}"Enter"===e.key?(e.preventDefault(),E&&T>=0&&T<Ae.length?oe(Ae[T],T):1!==Se.length||Se[0].disabled?s&&!j&&De&&(N?(L.includes(De)||D([...L,De]),V("")):(D([De]),ie(!1),G.current?.blur())):oe(Se[0],0)):"Escape"===e.key?(ie(!1),G.current?.blur()):"Tab"===e.key&&ie(!0)},placeholder:Me?ke:r||U,className:`${A?d:u} ${a} ${fe?"pr-8":""} ${l?"bg-gray-50 text-gray-400 cursor-not-allowed":""} truncate${Me?" rosh-field-shows-choice":""}`,style:se?{paddingRight:se}:void 0,disabled:l}),N?/* @__PURE__ */Ye(C,{content:!E&&$e?ge:null,className:"block",children:ze}):ze),N&&
181
- /* @__PURE__ */Ye("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */Ye("span",{ref:ye,className:"whitespace-pre"})}),fe&&/* @__PURE__ */Ye(Jn,{ariaLabel:_.select.clear,onClear:()=>{D([]),ie(!1)}}),f&&!E&&/* @__PURE__ */Ye("div",{ref:ne,className:`absolute top-1/2 -translate-y-1/2 ${fe?"right-8":"right-2"} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:f}),E&&Ze(
182
- /* @__PURE__ */Ge("div",{ref:J,onMouseDownCapture:()=>{le.current=!0,setTimeout(()=>{le.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:te.popup,left:de?.left,right:de?.right,top:de?.top,bottom:de?.bottom,minWidth:de?.minWidth,width:de?.width,...z&&{maxWidth:de?.maxWidth},visibility:de?void 0:"hidden",...X()},children:[N&&P&&x&&!l&&
183
- /* @__PURE__ */Ye("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),D([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-gray-50 border-b ${Z}`,children:_.select.clearAll}),m?
184
- /* @__PURE__ */Ye("p",{role:"status",className:"px-3 py-2 text-sm text-gray-500",children:_.search.searching}):p?/* @__PURE__ */Ge("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
185
- /* @__PURE__ */Ye("span",{className:"min-w-0 flex-1",children:p}),g&&/* @__PURE__ */Ye(M,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:g,className:"shrink-0",children:_.list.retry})]}):null,
186
- /* @__PURE__ */Ge("div",{id:W,role:Ae.length?"listbox":void 0,"aria-labelledby":Ae.length?v??(y?void 0:R):void 0,"aria-label":Ae.length&&!v?y:void 0,"aria-multiselectable":!(!Ae.length||!N)||void 0,className:"overflow-y-auto",style:{maxHeight:de?.maxHeight??$},children:[0===Ae.length?m||p?null:/* @__PURE__ */Ye("p",{className:"px-3 py-3 text-sm text-gray-400 text-center",children:_.select.noMatches}):0===Se.length?null:st(Le,(e,t)=>{const r=L.includes(e.value);/* @__PURE__ */
179
+ return Ye("button",{type:"button","aria-label":t,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),e()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity text-base leading-none",children:"×"})}function Qn(e){const{options:t,placeholder:r,emptyOptionLabel:n,className:a="",disabled:l,id:i,filter:o=!1,allowFreeText:s=!1,freeTextOption:c,onSearchChange:h,loading:m=!1,error:p,onRetry:g,rightAdornment:f,renderOption:b,clearable:x=!0,"aria-label":y,"aria-labelledby":v,"aria-describedby":w}=e,N=!0===e.multiple,L=e.multiple?e.value:e.value?[e.value]:[],S=e.multiple?"":e.value,D=t=>{e.multiple?e.onChange(t):e.onChange(t[0]??"")},P=L.length>0,A=o&&P&&!l,j=N||o,z=null!=c,F=s||z,[E,B]=Ee(!1),[T,I]=Ee(-1),O=ze(),R=i??`${O}-input`,W=`${O}-listbox`,K=e=>`${O}-opt-${e}`,[_,q]=Ee(""),H=he(),U=n??H.select.none,V=e=>{q(e),I(-1),h?.(e)},Y=Be(null),G=Be(null),J=Be(null),ne=Be(null),ae=Be(E);ae.current=E;const le=Be(!1),ie=e=>{ae.current&&(ae.current=!1,e&&s&&!z&&De&&(N?L.includes(De)||D([...L,De]):De!==S&&D([De])),B(!1),V(""))},oe=(e,t)=>{if(!e.disabled){if(N)return D(L.includes(e.value)?L.filter(t=>t!==e.value):[...L,e.value]),void(e===Pe?V(""):I(t));D([e.value]),ie(!1)}},[se,ce]=Ee(null);re(()=>{if(!f||E)return void ce(null);const e=ne.current?.offsetWidth??0;ce(e?e+(fe?32:8)+6:null)});const de=k(G,E,j?{popupRef:J}:{matchTriggerWidth:!0}),ue=Te(()=>it(t),[t]),me=L.join("\0"),pe=Te(()=>{const e=[],t=/* @__PURE__ */new Set;for(const r of ue)L.includes(r.value)&&!t.has(r.value)&&(t.add(r.value),e.push(r.label));if(F)for(const r of L)t.has(r)||e.push(r);return e},[ue,me,F]),ge=pe.join(", "),fe=x&&P&&!l,[be,xe]=Ee(null),ye=Be(null),ve=Be(""),we=Be(()=>{});we.current=()=>{const e=G.current,t=ye.current;if(!N||!e||!t)return;const r=getComputedStyle(e),n=e.clientWidth-(parseFloat(r.paddingLeft)||0)-(parseFloat(r.paddingRight)||0),a=[r.fontStyle,r.fontWeight,r.fontSize,r.fontFamily,r.letterSpacing].join("|"),l=`${n}|${a}|${pe.join("\0")}`;if(l===ve.current)return;ve.current=l;let i=null;n>0&&pe.length>0&&(t.style.fontStyle=r.fontStyle,t.style.fontWeight=r.fontWeight,t.style.fontSize=r.fontSize,t.style.fontFamily=r.fontFamily,t.style.letterSpacing=r.letterSpacing,i=function(e,t){const r=e.length;if(0===r||t(e.join(", ")))return{shown:r,cut:!1};if(1===r)return{shown:1,cut:!0};let n=0;for(let a=1;a<r&&t(`${e.slice(0,a).join(", ")} +${r-a}`);a+=1)n=a;return{shown:n,cut:!1}}(pe,e=>(t.textContent=e,t.getBoundingClientRect().width<=n)),t.textContent=""),xe(e=>e?.shown===i?.shown&&e?.cut===i?.cut?e:i)},re(()=>{we.current()}),Ie(()=>{const e=G.current;if(!N||!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>we.current());return t.observe(e),()=>t.disconnect()},[N]);const Ne=pe.length,ke=!N||!be||be.shown>=Ne?ge:0===be.shown?H.select.selectedCount(Ne):`${pe.slice(0,be.shown).join(", ")} +${Ne-be.shown}`,$e=N&&null!==be&&(be.shown<Ne||be.cut),Me=E&&P&&j;Ie(()=>{if(!E)return;const e=e=>{const t=e.target;Y.current?.contains(t)||J.current?.contains(t)||ie(!0)};document.addEventListener("mousedown",e);const t=ee(()=>ie(!0));return()=>{document.removeEventListener("mousedown",e),t()}},[E,s,_,me,e.onChange]),Ie(()=>{if(E)return Q(e=>!("Escape"!==e.key||!ae.current)&&(ie(!1),G.current?.blur(),!0),()=>J.current)},[E]);const Ce=Te(()=>{const e=/* @__PURE__ */new Set;return ot(t,t=>!e.has(t.value)&&(e.add(t.value),!0))},[t]),Le=Te(()=>{if(h)return Ce;const e=_.trim().toLowerCase();return e?ot(Ce,t=>dt(t,e)):Ce},[Ce,_,h]),Se=Te(()=>it(Le),[Le]),De=_.trim(),Pe=Te(()=>z&&De?ue.some(e=>e.label===De)||L.includes(De)?null:{value:De,label:De}:null,[z,De,ue,me]),Ae=Te(()=>Pe?[...Se,Pe]:Se,[Se,Pe]);/* @__PURE__ */
180
+ return Ge("div",{ref:Y,className:"relative group",onBlur:e=>{const t=e.relatedTarget;t&&(Y.current?.contains(t)||J.current?.contains(t))||le.current||document.activeElement!==G.current&&ie(!0)},children:[(je=/* @__PURE__ */Ye("input",{id:R,ref:G,type:"text",autoComplete:"off",role:"combobox","aria-expanded":E,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":E?W:void 0,"aria-activedescendant":E&&T>=0&&T<Ae.length?K(T):void 0,"aria-label":v?void 0:y,"aria-labelledby":v,"aria-describedby":w,value:E?_:ke,onChange:e=>{V(e.target.value),B(!0)},onFocus:()=>{l||(V(""),B(!0))},onKeyDown:e=>{if("ArrowDown"===e.key||"ArrowUp"===e.key){if(l)return;if(e.preventDefault(),!E)return void B(!0);if(0===Ae.length)return;const t="ArrowDown"===e.key?1:-1;return void I(e=>nt(Ae,e,t))}"Enter"===e.key?(e.preventDefault(),E&&T>=0&&T<Ae.length?oe(Ae[T],T):1!==Se.length||Se[0].disabled?s&&!z&&De&&(N?(L.includes(De)||D([...L,De]),V("")):(D([De]),ie(!1),G.current?.blur())):oe(Se[0],0)):"Escape"===e.key?(ie(!1),G.current?.blur()):"Tab"===e.key&&ie(!0)},placeholder:Me?ke:r||U,className:`${A?d:u} ${a} ${fe?"pr-8":""} ${l?"bg-gray-50 text-gray-400 cursor-not-allowed":""} truncate${Me?" rosh-field-shows-choice":""}`,style:se?{paddingRight:se}:void 0,disabled:l}),N?/* @__PURE__ */Ye(C,{content:!E&&$e?ge:null,className:"block",children:je}):je),N&&
181
+ /* @__PURE__ */Ye("div",{"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 h-0 w-0 overflow-hidden",children:/* @__PURE__ */Ye("span",{ref:ye,className:"whitespace-pre"})}),fe&&/* @__PURE__ */Ye(Jn,{ariaLabel:H.select.clear,onClear:()=>{D([]),ie(!1)}}),f&&!E&&/* @__PURE__ */Ye("div",{ref:ne,className:`absolute top-1/2 -translate-y-1/2 ${fe?"right-8":"right-2"} flex items-center gap-1 flex-nowrap justify-end pointer-events-none`,children:f}),E&&Ze(
182
+ /* @__PURE__ */Ge("div",{ref:J,onMouseDownCapture:()=>{le.current=!0,setTimeout(()=>{le.current=!1},0)},className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:te.popup,left:de?.left,right:de?.right,top:de?.top,bottom:de?.bottom,minWidth:de?.minWidth,width:de?.width,...j&&{maxWidth:de?.maxWidth},visibility:de?void 0:"hidden",...X()},children:[N&&P&&x&&!l&&
183
+ /* @__PURE__ */Ye("button",{type:"button",tabIndex:-1,onMouseDown:e=>{e.preventDefault(),D([])},className:`block w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm text-gray-600 hover:bg-gray-50 border-b ${Z}`,children:H.select.clearAll}),m?
184
+ /* @__PURE__ */Ye("p",{role:"status",className:"px-3 py-2 text-sm text-gray-500",children:H.search.searching}):p?/* @__PURE__ */Ge("div",{role:"alert",className:"flex items-center gap-2 px-3 py-2 text-sm text-red-600",children:[
185
+ /* @__PURE__ */Ye("span",{className:"min-w-0 flex-1",children:p}),g&&/* @__PURE__ */Ye(M,{variant:"link",size:"sm",onMouseDown:e=>e.preventDefault(),onClick:g,className:"shrink-0",children:H.list.retry})]}):null,
186
+ /* @__PURE__ */Ge("div",{id:W,role:Ae.length?"listbox":void 0,"aria-labelledby":Ae.length?v??(y?void 0:R):void 0,"aria-label":Ae.length&&!v?y:void 0,"aria-multiselectable":!(!Ae.length||!N)||void 0,className:"overflow-y-auto",style:{maxHeight:de?.maxHeight??$},children:[0===Ae.length?m||p?null:/* @__PURE__ */Ye("p",{className:"px-3 py-3 text-sm text-gray-400 text-center",children:H.select.noMatches}):0===Se.length?null:st(Le,(e,t)=>{const r=L.includes(e.value);/* @__PURE__ */
187
187
  return Ge("button",{id:K(t),type:"button",role:"option","aria-selected":r,"aria-disabled":e.disabled||void 0,tabIndex:-1,onMouseDown:r=>{(e.disabled||N)&&r.preventDefault(),oe(e,t)},className:"w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center justify-between gap-2 whitespace-nowrap "+(e.disabled?"cursor-not-allowed text-gray-400":`hover:bg-gray-50 ${r?"text-blue-600 font-medium":"text-gray-700"} ${t===T?"bg-gray-100":r?"bg-blue-50/50":""}`),children:[N&&/* @__PURE__ */Ye(ct,{selected:r}),
188
- /* @__PURE__ */Ye("span",{className:`min-w-0 ${z?"flex-auto":"flex-1"} truncate`,children:b?b(e,{selected:r,active:t===T}):e.label}),e.sublabel&&/* @__PURE__ */Ye(ut,{grows:z,children:e.sublabel})]},e.value)},O),Pe&&c&&
189
- /* @__PURE__ */Ye("button",{id:K(Se.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{N&&e.preventDefault(),oe(Pe,Se.length)},className:`w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 whitespace-nowrap text-gray-700 hover:bg-gray-50 ${Se.length?`border-t ${Z}`:""} ${T===Se.length?"bg-gray-100":""}`,children:/* @__PURE__ */Ye("span",{className:"min-w-0 flex-1 truncate",children:c(Pe.value)})},`${O}-typed`)]})]}),document.body)]});var ze}function ea(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}var ta="address",ra={kindOf:()=>ta,targetOf:e=>e,readFilter:()=>null,withFilter:e=>e},na=e=>m(e.trim());function aa(e){const{value:t,kinds:r,rules:n=ra,filtersFor:a,label:l,readOnly:i,placeholder:o,className:s=""}=e,c=void 0!==e.onApply,d=he().link,u=n.isSafe??na,h=je(),m=Be(null),p=Be(null),[g,f]=Ee({url:t}),b=c?g.url:t,[x,y]=Ee(!1),[v,w]=Ee(null),[N,k]=Ee(null),$=Be(()=>{});$.current=c?e.onCancel:()=>{},Ie(()=>{if(c)return Q(e=>{const t=m.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&($.current(),!0)},()=>m.current)},[c]),Ie(()=>{if(!c)return;const e=p.current;e?(e.focus(),e.select()):m.current?.querySelector("button, input")?.focus()},[]);const C=r??[{value:ta,label:d.address,target:{type:"text"}}],L=v&&v.against===b?v.kind:n.kindOf(b),S=C.filter(e=>!e.hideWhenEmpty||ea(e.target).length>0||e.value===L),D=S.find(e=>"text"===e.target.type),P=S.find(e=>e.value===L)??D??S[0];if(!P)return null;const A="text"!==P.target.type,z=A?n.targetOf(b):b,j=ea(P.target),F=j.find(e=>e.value===z),E=e=>({value:e,label:d.unavailable(e)}),B="select"===P.target.type&&z&&a?a(z):null,T=B?n.readFilter(b):null,I=T?B?.find(e=>e.param===T.param):void 0,O=N&&N.against===b?N.text:b,R=!A&&""!==O.trim()&&!u(O),W=R&&(!c||x),K=(t,r)=>{c?f({url:t,name:r}):void 0===r?e.onChange(t):e.onChange(t,r)},q=(e,t)=>{w(t=>t?{...t,against:e}:t),K(e,t)},H=e=>{if(!e)return q("");const t=j.find(t=>t.value===e);q(e,t?.label)},_=A?b:O.trim(),U=()=>{if(!c||!_)return;if(!A&&R)return void y(!0);const t=A&&g.url===_?g.name:void 0,r=e.onApply;void 0===t?r(_):r(_,t)},V=(e,t)=>t&&!e.some(e=>e.value===t)?[E(t),...e]:[...e],Y=(e,t,r,n,a)=>{const l=[];for(const e of r){const t=l[l.length-1],r={value:e.value,label:e.label};e.group?t&&"options"in t&&t.label===e.group?t.options.push(r):l.push({label:e.group,options:[r]}):l.push(r)}if(a){const a=r.some(e=>""===e.value);/* @__PURE__ */
188
+ /* @__PURE__ */Ye("span",{className:`min-w-0 ${j?"flex-auto":"flex-1"} truncate`,children:b?b(e,{selected:r,active:t===T}):e.label}),e.sublabel&&/* @__PURE__ */Ye(ut,{grows:j,children:e.sublabel})]},e.value)},O),Pe&&c&&
189
+ /* @__PURE__ */Ye("button",{id:K(Se.length),type:"button",role:"option","aria-selected":!1,tabIndex:-1,onMouseDown:e=>{N&&e.preventDefault(),oe(Pe,Se.length)},className:`w-full overflow-hidden text-left px-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 whitespace-nowrap text-gray-700 hover:bg-gray-50 ${Se.length?`border-t ${Z}`:""} ${T===Se.length?"bg-gray-100":""}`,children:/* @__PURE__ */Ye("span",{className:"min-w-0 flex-1 truncate",children:c(Pe.value)})},`${O}-typed`)]})]}),document.body)]});var je}function ea(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}var ta="address",ra={kindOf:()=>ta,targetOf:e=>e,readFilter:()=>null,withFilter:e=>e},na=e=>p(e.trim());function aa(e){const{value:t,kinds:r,rules:n=ra,filtersFor:a,label:l,readOnly:i,placeholder:o,className:s=""}=e,c=void 0!==e.onApply,d=he().link,u=n.isSafe??na,h=ze(),m=Be(null),p=Be(null),[g,f]=Ee({url:t}),b=c?g.url:t,[x,y]=Ee(!1),[v,w]=Ee(null),[N,k]=Ee(null),$=Be(()=>{});$.current=c?e.onCancel:()=>{},Ie(()=>{if(c)return Q(e=>{const t=m.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&($.current(),!0)},()=>m.current)},[c]),Ie(()=>{if(!c)return;const e=p.current;e?(e.focus(),e.select()):m.current?.querySelector("button, input")?.focus()},[]);const C=r??[{value:ta,label:d.address,target:{type:"text"}}],L=v&&v.against===b?v.kind:n.kindOf(b),S=C.filter(e=>!e.hideWhenEmpty||ea(e.target).length>0||e.value===L),D=S.find(e=>"text"===e.target.type),P=S.find(e=>e.value===L)??D??S[0];if(!P)return null;const A="text"!==P.target.type,j=A?n.targetOf(b):b,z=ea(P.target),F=z.find(e=>e.value===j),E=e=>({value:e,label:d.unavailable(e)}),B="select"===P.target.type&&j&&a?a(j):null,T=B?n.readFilter(b):null,I=T?B?.find(e=>e.param===T.param):void 0,O=N&&N.against===b?N.text:b,R=!A&&""!==O.trim()&&!u(O),W=R&&(!c||x),K=(t,r)=>{c?f({url:t,name:r}):void 0===r?e.onChange(t):e.onChange(t,r)},_=(e,t)=>{w(t=>t?{...t,against:e}:t),K(e,t)},q=e=>{if(!e)return _("");const t=z.find(t=>t.value===e);_(e,t?.label)},H=A?b:O.trim(),U=()=>{if(!c||!H)return;if(!A&&R)return void y(!0);const t=A&&g.url===H?g.name:void 0,r=e.onApply;void 0===t?r(H):r(H,t)},V=(e,t)=>t&&!e.some(e=>e.value===t)?[E(t),...e]:[...e],Y=(e,t,r,n,a)=>{const l=[];for(const e of r){const t=l[l.length-1],r={value:e.value,label:e.label};e.group?t&&"options"in t&&t.label===e.group?t.options.push(r):l.push({label:e.group,options:[r]}):l.push(r)}if(a){const a=r.some(e=>""===e.value);/* @__PURE__ */
190
190
  return Ye(Qn,{"aria-label":e,value:t,options:l,disabled:i,clearable:a,placeholder:r.find(e=>""===e.value)?.label,onChange:n})}/* @__PURE__ */
191
- return Ye(gt,{size:"sm","aria-label":e,value:t,options:l,readOnly:i,onChange:n})};let G;if("text"===P.target.type)G=/* @__PURE__ */Ye(Qe,{ref:p,id:`${h}-address`,size:"sm",type:"text",invalid:W,"aria-label":d.address,"aria-describedby":W?`${h}-why`:void 0,placeholder:o??d.addressPlaceholder,spellCheck:!1,autoComplete:"off",value:O,readOnly:i,onChange:e=>(e=>{y(!1);const t=e.trim();t?u(e)?(k({text:e,against:t}),q(t)):k({text:e,against:b}):(k({text:e,against:""}),q(""))})(e.target.value)});else{const e="groups"===P.target.type?P.target.groups.flatMap(e=>e.options.map(t=>({value:t.value,label:t.label,group:e.label}))):P.target.options.map(e=>({value:e.value,label:e.label})),t=[{value:"",label:P.target.placeholder},...V(e,z)];G=Y(P.label,z,t,H,e.length>10)}const X=/* @__PURE__ */Ge(Xe,{children:[r&&Y(d.linkType,P.value,S.map(e=>({value:e.value,label:e.label})),e=>{k(null),y(!1);const t=S.find(t=>t.value===e);if(!t||"text"===t.target.type)return void w({kind:e,against:b});const r=ea(t.target)[0];w({kind:e,against:r?r.value:""}),r?K(r.value,r.label):K("")},!1),G,B&&Y(d.filter,T?.param??"",[{value:"",label:d.noFilter},...T&&!I?[E(T.param)]:[],...B.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return q(z,F?.label);const t=B?.find(t=>t.param===e),r=t?.values[0];r&&q(n.withFilter(z,{param:e,value:r.value}),r.label)},!1),B&&T&&Y(d.value,T.value,V((I?.values??[]).map(e=>({value:e.value,label:e.label})),T.value),e=>{if(!T)return;const t=I?.values.find(t=>t.value===e);q(n.withFilter(z,{param:T.param,value:e}),t?.label)},(I?.values.length??0)>10),W&&/* @__PURE__ */Ye("p",{id:`${h}-why`,role:"alert",className:"text-2xs leading-4 text-red-600",children:d.unsafe}),P.hint&&/* @__PURE__ */Ye("p",{className:"text-2xs leading-4 text-gray-400",children:P.hint}),B&&/* @__PURE__ */Ye("p",{className:"text-2xs leading-4 text-gray-400",children:d.filterHint})]});if(!c)/* @__PURE__ */
191
+ return Ye(gt,{size:"sm","aria-label":e,value:t,options:l,readOnly:i,onChange:n})};let G;if("text"===P.target.type)G=/* @__PURE__ */Ye(Qe,{ref:p,id:`${h}-address`,size:"sm",type:"text",invalid:W,"aria-label":d.address,"aria-describedby":W?`${h}-why`:void 0,placeholder:o??d.addressPlaceholder,spellCheck:!1,autoComplete:"off",value:O,readOnly:i,onChange:e=>(e=>{y(!1);const t=e.trim();t?u(e)?(k({text:e,against:t}),_(t)):k({text:e,against:b}):(k({text:e,against:""}),_(""))})(e.target.value)});else{const e="groups"===P.target.type?P.target.groups.flatMap(e=>e.options.map(t=>({value:t.value,label:t.label,group:e.label}))):P.target.options.map(e=>({value:e.value,label:e.label})),t=[{value:"",label:P.target.placeholder},...V(e,j)];G=Y(P.label,j,t,q,e.length>10)}const X=/* @__PURE__ */Ge(Xe,{children:[r&&Y(d.linkType,P.value,S.map(e=>({value:e.value,label:e.label})),e=>{k(null),y(!1);const t=S.find(t=>t.value===e);if(!t||"text"===t.target.type)return void w({kind:e,against:b});const r=ea(t.target)[0];w({kind:e,against:r?r.value:""}),r?K(r.value,r.label):K("")},!1),G,B&&Y(d.filter,T?.param??"",[{value:"",label:d.noFilter},...T&&!I?[E(T.param)]:[],...B.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return _(j,F?.label);const t=B?.find(t=>t.param===e),r=t?.values[0];r&&_(n.withFilter(j,{param:e,value:r.value}),r.label)},!1),B&&T&&Y(d.value,T.value,V((I?.values??[]).map(e=>({value:e.value,label:e.label})),T.value),e=>{if(!T)return;const t=I?.values.find(t=>t.value===e);_(n.withFilter(j,{param:T.param,value:e}),t?.label)},(I?.values.length??0)>10),W&&/* @__PURE__ */Ye("p",{id:`${h}-why`,role:"alert",className:"text-2xs leading-4 text-red-600",children:d.unsafe}),P.hint&&/* @__PURE__ */Ye("p",{className:"text-2xs leading-4 text-gray-400",children:P.hint}),B&&/* @__PURE__ */Ye("p",{className:"text-2xs leading-4 text-gray-400",children:d.filterHint})]});if(!c)/* @__PURE__ */
192
192
  return Ye("div",{ref:m,className:`flex min-w-0 flex-auto flex-col gap-2 ${s}`.trim(),role:l?"group":void 0,"aria-label":l,children:X});const Z=e.onRemove;/* @__PURE__ */
193
193
  return Ge("div",{ref:m,role:"dialog","aria-label":l??d.title,className:`flex min-w-0 flex-col gap-2 rounded-xl border border-gray-200 bg-white p-3 shadow-lg ${s}`.trim(),onKeyDown:e=>{"Enter"!==e.key||e.defaultPrevented||e.target instanceof Element&&e.target.closest("button")||(e.preventDefault(),U())},children:[A?/* @__PURE__ */Ye("span",{className:Mt({inline:!0}),children:d.title}):/* @__PURE__ */Ye("label",{htmlFor:`${h}-address`,className:Mt({inline:!0}),children:d.title}),X,
194
194
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-2",children:[Z?/* @__PURE__ */Ye(M,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onClick:Z,children:d.remove}):null,
195
195
  /* @__PURE__ */Ge("span",{className:"ml-auto flex gap-1",children:[
196
196
  /* @__PURE__ */Ye(M,{variant:"secondary",size:"sm","data-window-action":"cancel",onClick:()=>$.current(),children:d.cancel}),
197
- /* @__PURE__ */Ye(M,{variant:"primary",size:"sm","data-window-action":"apply",onClick:U,disabled:i||""===_,children:d.apply})]})]})]})}function la({label:e,text:t,onTextChange:r,link:n,onLinkChange:a,kinds:l,rules:i,filtersFor:o,textPlaceholder:s,readOnly:c,className:d=""}){const u=he().link,[m,p]=Ee(!1),g=Be(null),f=je(),b=()=>{p(!1),g.current?.focus()};/* @__PURE__ */
197
+ /* @__PURE__ */Ye(M,{variant:"primary",size:"sm","data-window-action":"apply",onClick:U,disabled:i||""===H,children:d.apply})]})]})]})}function la({label:e,text:t,onTextChange:r,link:n,onLinkChange:a,kinds:l,rules:i,filtersFor:o,textPlaceholder:s,readOnly:c,className:d=""}){const u=he().link,[m,p]=Ee(!1),g=Be(null),f=ze(),b=()=>{p(!1),g.current?.focus()};/* @__PURE__ */
198
198
  return Ge("div",{className:`flex min-w-0 flex-auto flex-col ${d}`.trim(),children:[
199
199
  /* @__PURE__ */Ye(Qe,{size:"sm",type:"text",className:"rounded-b-none","aria-label":u.text(e),placeholder:s,value:t,readOnly:c,onChange:e=>r(e.target.value)}),
200
200
  /* @__PURE__ */Ge("button",{ref:g,type:"button","aria-label":u.linkOf(e,n),"aria-expanded":m,"aria-controls":m?f:void 0,disabled:c,onClick:()=>p(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded-b-(--radius-control) border border-t-0 border-gray-300 bg-gray-50 ${h.sm} text-left hover:bg-gray-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60`,children:[
@@ -202,10 +202,10 @@ return Ge("div",{className:`flex min-w-0 flex-auto flex-col ${d}`.trim(),childre
202
202
  /* @__PURE__ */Ye("span",{className:"min-w-0 truncate "+(n?"text-blue-600":"text-gray-400"),children:n||u.addLink})]}),m&&/* @__PURE__ */Ye("div",{id:f,className:"mt-2",children:/* @__PURE__ */Ye(aa,{value:n,label:u.linkOf(e,n),kinds:l,rules:i,filtersFor:o,onApply:(e,t)=>{void 0===t?a(e):a(e,t),b()},onRemove:n?()=>{a(""),b()}:void 0,onCancel:b})})]})}var ia={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},oa=["tl","tr","bl","br"];function sa({label:e,value:t,corners:r,onChange:n,radius:a=null,onRadiusChange:l,radiusLabel:i,radiusMin:o=0,radiusMax:s,radiusStep:c=1,radiusPlaceholder:d,disabled:u=!1,disabledReason:h,id:m,className:p=""}){const g=he(),f=function(e){const t=oa.map(t=>e.find(e=>e.value===t));for(const r of e){if(oa.includes(r.value))continue;const e=t.findIndex(e=>void 0===e);-1===e?t.push(r):t[e]=r}return t.filter(e=>void 0!==e)}(r),[b,x]=Ee(0),y=Be(null);/* @__PURE__ */
203
203
  return Ge("div",{id:m,role:"group","aria-label":e,className:`flex min-w-0 flex-wrap items-center gap-2 ${p}`.trim(),children:[l&&
204
204
  /* @__PURE__ */Ye("div",{className:"w-30 shrink-0",children:/* @__PURE__ */Ye(rn,{value:a,onChange:l,min:o,max:s,step:c,precision:0,placeholder:d,prefix:/* @__PURE__ */Ye("span",{"data-radius-mark":"","aria-hidden":"true",children:g.corners.radiusMark}),suffix:g.corners.unit,steppers:"compact",disabled:u,"aria-label":i??g.corners.radius})}),
205
- /* @__PURE__ */Ye("div",{ref:y,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const t=Array.from(y.current?.querySelectorAll("button[data-corner]")??[]),r=t.indexOf(document.activeElement);if(-1===r)return;const n=r%2,a=Math.floor(r/2),l="ArrowRight"===e.key?2*a+1:"ArrowLeft"===e.key?2*a:"ArrowDown"===e.key?2+n:"ArrowUp"===e.key?n:null;null!==l&&(e.preventDefault(),l<t.length&&t[l].focus())},children:f.map((e,r)=>{const a=t.includes(e.value),l=u||!0===e.disabled,i=l&&(!0===e.disabled&&e.title||(u?h:void 0))||void 0,o=/* @__PURE__ */Ye(Je,{"aria-pressed":a,"aria-label":e.label,"aria-disabled":l||void 0,disabledReason:i,"data-corner":e.value,size:"sm",tabIndex:r===b?0:-1,onFocus:()=>x(r),onClick:()=>{l||n(a?t.filter(t=>t!==e.value):[...t,e.value])},children:/* @__PURE__ */Ye(Pe,{name:"corner",strokeWidth:2,className:["h-4 w-4",ia[e.value]??""].filter(Boolean).join(" ")})},e.value);return i?o:/* @__PURE__ */Ye(C,{content:e.title??e.label,children:o},e.value)})})]})}var ca={ArrowLeft:[0,-1],ArrowRight:[0,1],ArrowUp:[-1,0],ArrowDown:[1,0]};function da({label:e,value:t,points:r,onChange:n,disabled:a=!1,disabledReason:l,id:i,className:o=""}){const s=je(),c=Be([]),d=r.findIndex(e=>e.value===t),u=r.findIndex(e=>!a&&!0!==e.disabled),h=d>=0?d:Math.max(0,u);/* @__PURE__ */
206
- return Ye("div",{id:i,role:"radiogroup","aria-label":e,className:`grid w-max grid-cols-3 gap-px overflow-hidden rounded-(--radius-control) border border-gray-200 bg-gray-200 ${o}`.trim(),children:r.map((e,i)=>{const o=t===e.value,d=a||!0===e.disabled,u=d&&(!0===e.disabled&&e.title||(a?l:void 0))||void 0,m=`${s}-${i}`,p=/* @__PURE__ */Ye("button",{type:"button",role:"radio","aria-checked":o,"aria-label":e.label,"aria-disabled":d||void 0,"aria-describedby":w(void 0,u?m:void 0),ref:e=>{c.current[i]=e},tabIndex:i===h?0:-1,onKeyDown:e=>((e,l)=>{const i=ca[l.key];if(!i)return;l.preventDefault();const o=Math.floor(e/3)+i[0],s=e%3+i[1];if(o<0||s<0||s>=3)return;const d=3*o+s;if(d>=r.length)return;c.current[d]?.focus();const u=r[d];a||!0===u.disabled||u.value===t||n(u.value)})(i,e),onClick:d?v:()=>n(e.value),className:"group relative flex size-(--control-height-lg) items-center justify-center transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring)] aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(o?"bg-blue-50 hover:bg-blue-100":"bg-white hover:bg-gray-50"),children:e.icon?/* @__PURE__ */Ye("span",{"data-icon-slot":"","aria-hidden":"true",className:"inline-flex items-center justify-center [&_svg]:h-4 [&_svg]:w-4 "+(o?"text-blue-700":"text-gray-500 group-hover:text-gray-700"),children:e.icon}):/* @__PURE__ */Ye("span",{"data-dot":"","aria-hidden":"true",className:o?"size-3 rounded-sm bg-blue-600":"size-1 rounded-full bg-[color:var(--ink-faintest)] transition-colors group-hover:bg-[color:var(--ink-faint)]"})},e.value);return u?/* @__PURE__ */Ye(N,{reason:u,id:m,block:!0,children:p},e.value):/* @__PURE__ */Ye(C,{content:e.title??e.label,className:"relative flex",children:p},e.value)})})}var ua=ze(function({files:e,onChange:t,accept:r,acceptHint:n,multiple:a=!0,maxSizeBytes:l,maxFiles:i,disabled:o=!1,label:s,hint:c,error:d,required:u,className:h=""},m){const p=je(),g=he().files,f=se({accept:r,acceptHint:n,maxSizeBytes:l,maxFiles:i,multiple:a,disabled:o,currentCount:e.length,onAccept:r=>t(a?[...e,...r]:r.slice(0,1))}),b=d?`${p}-error`:c?`${p}-hint`:void 0;/* @__PURE__ */
205
+ /* @__PURE__ */Ye("div",{ref:y,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const t=Array.from(y.current?.querySelectorAll("button[data-corner]")??[]),r=t.indexOf(document.activeElement);if(-1===r)return;const n=r%2,a=Math.floor(r/2),l="ArrowRight"===e.key?2*a+1:"ArrowLeft"===e.key?2*a:"ArrowDown"===e.key?2+n:"ArrowUp"===e.key?n:null;null!==l&&(e.preventDefault(),l<t.length&&t[l].focus())},children:f.map((e,r)=>{const a=t.includes(e.value),l=u||!0===e.disabled,i=l&&(!0===e.disabled&&e.title||(u?h:void 0))||void 0,o=/* @__PURE__ */Ye(Je,{"aria-pressed":a,"aria-label":e.label,"aria-disabled":l||void 0,disabledReason:i,"data-corner":e.value,size:"sm",tabIndex:r===b?0:-1,onFocus:()=>x(r),onClick:()=>{l||n(a?t.filter(t=>t!==e.value):[...t,e.value])},children:/* @__PURE__ */Ye(Pe,{name:"corner",strokeWidth:2,className:["h-4 w-4",ia[e.value]??""].filter(Boolean).join(" ")})},e.value);return i?o:/* @__PURE__ */Ye(C,{content:e.title??e.label,children:o},e.value)})})]})}var ca={ArrowLeft:[0,-1],ArrowRight:[0,1],ArrowUp:[-1,0],ArrowDown:[1,0]};function da({label:e,value:t,points:r,onChange:n,disabled:a=!1,disabledReason:l,id:i,className:o=""}){const s=ze(),c=Be([]),d=r.findIndex(e=>e.value===t),u=r.findIndex(e=>!a&&!0!==e.disabled),h=d>=0?d:Math.max(0,u);/* @__PURE__ */
206
+ return Ye("div",{id:i,role:"radiogroup","aria-label":e,className:`grid w-max grid-cols-3 gap-px overflow-hidden rounded-(--radius-control) border border-gray-200 bg-gray-200 ${o}`.trim(),children:r.map((e,i)=>{const o=t===e.value,d=a||!0===e.disabled,u=d&&(!0===e.disabled&&e.title||(a?l:void 0))||void 0,m=`${s}-${i}`,p=/* @__PURE__ */Ye("button",{type:"button",role:"radio","aria-checked":o,"aria-label":e.label,"aria-disabled":d||void 0,"aria-describedby":w(void 0,u?m:void 0),ref:e=>{c.current[i]=e},tabIndex:i===h?0:-1,onKeyDown:e=>((e,l)=>{const i=ca[l.key];if(!i)return;l.preventDefault();const o=Math.floor(e/3)+i[0],s=e%3+i[1];if(o<0||s<0||s>=3)return;const d=3*o+s;if(d>=r.length)return;c.current[d]?.focus();const u=r[d];a||!0===u.disabled||u.value===t||n(u.value)})(i,e),onClick:d?v:()=>n(e.value),className:"group relative flex size-(--control-height-lg) items-center justify-center transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring)] aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(o?"bg-blue-50 hover:bg-blue-100":"bg-white hover:bg-gray-50"),children:e.icon?/* @__PURE__ */Ye("span",{"data-icon-slot":"","aria-hidden":"true",className:"inline-flex items-center justify-center [&_svg]:h-4 [&_svg]:w-4 "+(o?"text-blue-700":"text-gray-500 group-hover:text-gray-700"),children:e.icon}):/* @__PURE__ */Ye("span",{"data-dot":"","aria-hidden":"true",className:o?"size-3 rounded-sm bg-blue-600":"size-1 rounded-full bg-[color:var(--ink-faintest)] transition-colors group-hover:bg-[color:var(--ink-faint)]"})},e.value);return u?/* @__PURE__ */Ye(N,{reason:u,id:m,block:!0,children:p},e.value):/* @__PURE__ */Ye(C,{content:e.title??e.label,className:"relative flex",children:p},e.value)})})}var ua=je(function({files:e,onChange:t,accept:r,acceptHint:n,multiple:a=!0,maxSizeBytes:l,maxFiles:i,disabled:o=!1,label:s,hint:c,error:d,required:u,className:h=""},m){const p=ze(),g=he().files,f=se({accept:r,acceptHint:n,maxSizeBytes:l,maxFiles:i,multiple:a,disabled:o,currentCount:e.length,onAccept:r=>t(a?[...e,...r]:r.slice(0,1))}),b=d?`${p}-error`:c?`${p}-hint`:void 0;/* @__PURE__ */
207
207
  return Ge(vt,{label:s,htmlFor:p,hint:c,error:d,required:u,className:h,children:[
208
- /* @__PURE__ */Ge("button",{ref:m,type:"button",id:p,disabled:o,onClick:f.open,"aria-invalid":!!d||void 0,"aria-required":u||void 0,"aria-describedby":b,...f.zoneProps,className:At(f.dragOver,o,zt(o),"px-4 py-6"),children:[
208
+ /* @__PURE__ */Ge("button",{ref:m,type:"button",id:p,disabled:o,onClick:f.open,"aria-invalid":!!d||void 0,"aria-required":u||void 0,"aria-describedby":b,...f.zoneProps,className:At(f.dragOver,o,jt(o),"px-4 py-6"),children:[
209
209
  /* @__PURE__ */Ge("span",{children:[
210
210
  /* @__PURE__ */Ye("span",{className:"text-sm font-medium text-blue-600",children:a?g.chooseMany:g.chooseOne}),
211
211
  /* @__PURE__ */Ye("span",{className:"text-sm text-gray-500",children:` ${a?g.dragMany:g.dragOne}`})]}),n&&/* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:n})]}),
@@ -226,20 +226,20 @@ return Ge("li",{className:"flex max-w-full items-center gap-2 rounded-md border
226
226
  /* @__PURE__ */Ge("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[
227
227
  /* @__PURE__ */Ye(fa,{onClick:p.open,count:e.length,variant:c,label:s,disabled:i}),d]}),
228
228
  /* @__PURE__ */Ye(de,{rejections:p.rejections})]})}var xa="inline-flex max-w-full items-center whitespace-nowrap rounded-full",ya={success:"bg-[var(--status-success-soft)] text-[color:var(--status-success-soft-ink)]",active:"bg-[var(--status-active-soft)] text-[color:var(--status-active-soft-ink)]",queued:"bg-[var(--status-queued-soft)] text-[color:var(--status-queued-soft-ink)]",info:"bg-[var(--status-info-soft)] text-[color:var(--status-info-soft-ink)]",pending:"bg-[var(--status-pending-soft)] text-[color:var(--status-pending-soft-ink)]",warning:"bg-[var(--status-warning-soft)] text-[color:var(--status-warning-soft-ink)]",danger:"bg-[var(--status-danger-soft)] text-[color:var(--status-danger-soft-ink)]",draft:"bg-[var(--status-draft-soft)] text-[color:var(--status-draft-soft-ink)]",neutral:"bg-[var(--status-neutral-soft)] text-[color:var(--status-neutral-soft-ink)]"},va={success:"bg-[var(--status-success-solid)] text-[color:var(--status-on-solid)]",active:"bg-[var(--status-active-solid)] text-[color:var(--status-on-solid)]",queued:"bg-[var(--status-queued-solid)] text-[color:var(--status-on-solid)]",info:"bg-[var(--status-info-solid)] text-[color:var(--status-on-solid)]",pending:"bg-[var(--status-pending-solid)] text-[color:var(--status-on-solid)]",warning:"bg-[var(--status-warning-solid)] text-[color:var(--status-on-solid)]",danger:"bg-[var(--status-danger-solid)] text-[color:var(--status-on-solid)]",draft:"bg-[var(--status-draft-solid)] text-[color:var(--status-on-solid)]",neutral:"bg-[var(--status-neutral-solid)] text-[color:var(--status-on-solid)]"};function wa(e,t="subtle"){return"solid"===t?va[e]:ya[e]}var Na=Oe({}),ka=Oe(void 0);function $a(e){return e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Ma({groups:e,labelFor:t,children:r}){/* @__PURE__ */
229
- return Ye(Na.Provider,{value:e,children:/* @__PURE__ */Ye(ka.Provider,{value:t,children:r})})}function Ca(){const e=qe(ka);return Fe(t=>e?.(t)??$a(t),[e])}function La({status:e,label:t,emphasis:r="subtle"}){const a=wa(qe(Na)[e]??"neutral",r),l=qe(ka),i=t??l?.(e)??$a(e);/* @__PURE__ */
230
- return Ye("span",{className:`${xa} px-3 py-0.5 text-xs font-medium ${a}`,children:/* @__PURE__ */Ye(n,{children:i})})}var Sa={accent:{chip:"inline-flex max-w-full items-center gap-1 rounded bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700",remove:"text-blue-400 hover:text-red-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded leading-none"},danger:{chip:`inline-flex max-w-full items-center gap-1 rounded ${ya.danger} px-2 py-0.5 text-xs font-medium`,remove:"text-current opacity-70 hover:opacity-100 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded leading-none"}};function Da({value:e,onChange:t,options:r=[],placeholder:n,allowFreeText:a=!1,invalid:i,disabled:o,id:s,className:c="",tone:d,tooltip:u,split:h}){const[m,p]=Ee(!1),[g,f]=Ee(""),b=he(),x=Be(null),y=Be(null),v=Be(null),w=k(x,m),N=e=>r.find(t=>t.value===e)?.label??e,M=Te(()=>{const t=new Set(e),n=[],a=g.trim().toLowerCase();for(const e of r)t.has(e.value)||(t.add(e.value),a&&!dt(e,a)||n.push(e));return n},[r,e,g]),L=n=>{const l=[...e];for(const e of n){const t=e.trim();if(!t)continue;const n=t.toLowerCase(),i=r.find(e=>e.value===t||e.label.toLowerCase()===n)?.value,o=i??(a?t:null);o&&!l.includes(o)&&l.push(o)}l.length!==e.length&&t(l)},S=r=>{r&&!e.includes(r)?(t([...e,r]),f("")):f("")},D=r=>t(e.filter(e=>e!==r)),P=()=>{const e=g.trim();if(h&&e)return L(e.split(h)),void f("");a&&e?S(e):f("")},z=Be(()=>{});z.current=()=>{P(),p(!1)},Ie(()=>{if(!m)return;const e=e=>{const t=e.target;x.current?.contains(t)||v.current?.contains(t)||(P(),p(!1))};document.addEventListener("mousedown",e);const t=ee(()=>z.current());return()=>{document.removeEventListener("mousedown",e),t()}});const j=r.length>0;/* @__PURE__ */
229
+ return Ye(Na.Provider,{value:e,children:/* @__PURE__ */Ye(ka.Provider,{value:t,children:r})})}function Ca(){const e=_e(ka);return Fe(t=>e?.(t)??$a(t),[e])}function La({status:e,label:t,emphasis:r="subtle"}){const a=wa(_e(Na)[e]??"neutral",r),l=_e(ka),i=t??l?.(e)??$a(e);/* @__PURE__ */
230
+ return Ye("span",{className:`${xa} px-3 py-0.5 text-xs font-medium ${a}`,children:/* @__PURE__ */Ye(n,{children:i})})}var Sa={accent:{chip:"inline-flex max-w-full items-center gap-1 rounded bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700",remove:"text-blue-400 hover:text-red-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded leading-none"},danger:{chip:`inline-flex max-w-full items-center gap-1 rounded ${ya.danger} px-2 py-0.5 text-xs font-medium`,remove:"text-current opacity-70 hover:opacity-100 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-deep)] rounded leading-none"}};function Da({value:e,onChange:t,options:r=[],placeholder:n,allowFreeText:a=!1,invalid:i,disabled:o,id:s,className:c="",tone:d,tooltip:u,split:h}){const[m,p]=Ee(!1),[g,f]=Ee(""),b=he(),x=Be(null),y=Be(null),v=Be(null),w=k(x,m),N=e=>r.find(t=>t.value===e)?.label??e,M=Te(()=>{const t=new Set(e),n=[],a=g.trim().toLowerCase();for(const e of r)t.has(e.value)||(t.add(e.value),a&&!dt(e,a)||n.push(e));return n},[r,e,g]),L=n=>{const l=[...e];for(const e of n){const t=e.trim();if(!t)continue;const n=t.toLowerCase(),i=r.find(e=>e.value===t||e.label.toLowerCase()===n)?.value,o=i??(a?t:null);o&&!l.includes(o)&&l.push(o)}l.length!==e.length&&t(l)},S=r=>{r&&!e.includes(r)?(t([...e,r]),f("")):f("")},D=r=>t(e.filter(e=>e!==r)),P=()=>{const e=g.trim();if(h&&e)return L(e.split(h)),void f("");a&&e?S(e):f("")},j=Be(()=>{});j.current=()=>{P(),p(!1)},Ie(()=>{if(!m)return;const e=e=>{const t=e.target;x.current?.contains(t)||v.current?.contains(t)||(P(),p(!1))};document.addEventListener("mousedown",e);const t=ee(()=>j.current());return()=>{document.removeEventListener("mousedown",e),t()}});const z=r.length>0;/* @__PURE__ */
231
231
  return Ge("div",{ref:x,className:"relative",children:[
232
232
  /* @__PURE__ */Ge("div",{onMouseDown:e=>{o||e.target.closest("button")||(e.preventDefault(),y.current?.focus())},className:l({invalid:i,multiline:!0,className:`flex flex-wrap items-center gap-1 cursor-text focus-within:border-blue-400 has-focus-visible:ring-2 has-focus-visible:ring-[color:var(--rosh-focus-ring)] ${o?"bg-gray-50 cursor-not-allowed":""} ${c}`}),children:[e.map(e=>{const t=d?.(e),r=Sa[t??"accent"],n=/* @__PURE__ */Ge("span",{"data-tone":t,className:r.chip,children:[
233
233
  /* @__PURE__ */Ye("span",{className:"truncate",children:N(e)}),!o&&/* @__PURE__ */Ye("button",{type:"button","aria-label":b.select.removeItem?.(N(e))??`${b.select.remove} ${N(e)}`,onClick:()=>D(e),className:r.remove,children:"×"})]},e),a=u?.(e);return null==a?n:/* @__PURE__ */Ye(C,{content:a,className:"relative inline-flex max-w-full",children:n},e)}),
234
- /* @__PURE__ */Ye("input",{id:s,ref:y,type:"text",autoComplete:"off",role:"combobox","aria-expanded":m&&j,"aria-invalid":i||void 0,disabled:o,value:g,placeholder:0===e.length?n:void 0,onChange:e=>{(e=>{if(h){const t=e.split(h);if(t.length>1)return L(t.slice(0,-1)),void f(t[t.length-1])}f(e)})(e.target.value),p(!0)},onFocus:()=>{!o&&j&&p(!0)},onKeyDown:t=>{if("Enter"===t.key||","===t.key&&a){t.preventDefault();const e=g.trim(),r=e?M.filter(t=>dt(t,e.toLowerCase())):[];1===r.length?S(r[0].value):P()}else"Backspace"===t.key&&""===g&&e.length>0?D(e[e.length-1]):"Escape"===t.key?(p(!1),f(""),y.current?.blur()):"Tab"===t.key&&(P(),p(!1))},className:"min-w-[8ch] flex-1 border-none bg-transparent p-0 text-sm text-gray-800 placeholder:text-gray-400 rosh-focus-ring focus-visible:ring-0 disabled:cursor-not-allowed"})]}),m&&j&&Ze(
234
+ /* @__PURE__ */Ye("input",{id:s,ref:y,type:"text",autoComplete:"off",role:"combobox","aria-expanded":m&&z,"aria-invalid":i||void 0,disabled:o,value:g,placeholder:0===e.length?n:void 0,onChange:e=>{(e=>{if(h){const t=e.split(h);if(t.length>1)return L(t.slice(0,-1)),void f(t[t.length-1])}f(e)})(e.target.value),p(!0)},onFocus:()=>{!o&&z&&p(!0)},onKeyDown:t=>{if("Enter"===t.key||","===t.key&&a){t.preventDefault();const e=g.trim(),r=e?M.filter(t=>dt(t,e.toLowerCase())):[];1===r.length?S(r[0].value):P()}else"Backspace"===t.key&&""===g&&e.length>0?D(e[e.length-1]):"Escape"===t.key?(p(!1),f(""),y.current?.blur()):"Tab"===t.key&&(P(),p(!1))},className:"min-w-[8ch] flex-1 border-none bg-transparent p-0 text-sm text-gray-800 placeholder:text-gray-400 rosh-focus-ring focus-visible:ring-0 disabled:cursor-not-allowed"})]}),m&&z&&Ze(
235
235
  /* @__PURE__ */Ye("div",{ref:v,className:"fixed rounded-(--radius-popup) overflow-hidden",style:{zIndex:te.popup,left:w?.left,right:w?.right,top:w?.top,bottom:w?.bottom,minWidth:w?.minWidth,maxWidth:w?.maxWidth??A,width:"max-content",visibility:w?void 0:"hidden",...X()},children:/* @__PURE__ */Ye("div",{className:"overflow-y-auto",style:{maxHeight:w?.maxHeight??$},children:0===M.length?/* @__PURE__ */Ye("p",{className:"px-3 py-3 text-sm text-gray-400 text-center",children:r.length>0&&e.length>=r.length?b.select.allSelected:b.select.noMatches}):M.map(e=>/* @__PURE__ */Ye("button",{type:"button",onMouseDown:t=>{t.preventDefault(),S(e.value)},className:e.sublabel?"w-full text-left px-3 min-h-(--row-height-menu) py-2 text-sm hover:bg-gray-50 text-gray-700 whitespace-nowrap flex items-center justify-between gap-3":"w-full text-left px-3 min-h-(--row-height-menu) py-2 leading-5 text-sm hover:bg-gray-50 text-gray-700 whitespace-nowrap",children:e.sublabel?/* @__PURE__ */Ge(Xe,{children:[
236
236
  /* @__PURE__ */Ye("span",{className:"min-w-0 truncate",children:e.label}),
237
- /* @__PURE__ */Ye(ut,{grows:!0,children:e.sublabel})]}):e.label},e.value))})}),document.body)]})}var Pa={none:{body:"",edge:"px-4 py-3"},sm:{body:"p-3",edge:"px-3 py-2"},md:{body:"p-4",edge:"px-4 py-3"},lg:{body:"p-6",edge:"px-6 py-4"}},Aa={neutral:"border-gray-200",warning:"border-amber-300",current:"border-gray-200"};function za({children:e,header:t,description:r,footer:n,padded:a=!0,padding:l,headingLevel:i,headerActions:o,"aria-label":s,className:c="",bodyClassName:d="",style:u,tone:h="neutral"}){const m=Pa[l??(a?"md":"none")],p=je(),g=je(),f=null!=t&&null!=r&&""!==r,b=null!=i&&null!=t,x=`h${i}`,y=null!=s&&""!==s,v=b||y,w=v?"section":"div",N=`rounded-(--radius-card) border ${Aa[h]} bg-white shadow-sm ${c}`.trim(),k=Re.toArray(e).length>0,$=k?"border-b border-gray-100 ":"",M="current"===h,C=M?"text-base font-semibold text-blue-700":"text-base font-semibold text-gray-900",L=M?"rounded-t-(--radius-card) bg-blue-50 ":"",S=`${$}${L}${m.edge} ${C}`;/* @__PURE__ */
237
+ /* @__PURE__ */Ye(ut,{grows:!0,children:e.sublabel})]}):e.label},e.value))})}),document.body)]})}var Pa={none:{body:"",edge:"px-4 py-3"},sm:{body:"p-3",edge:"px-3 py-2"},md:{body:"p-4",edge:"px-4 py-3"},lg:{body:"p-6",edge:"px-6 py-4"}},Aa={neutral:"border-gray-200",warning:"border-amber-300",current:"border-gray-200"};function ja({children:e,header:t,description:r,footer:n,padded:a=!0,padding:l,headingLevel:i,headerActions:o,"aria-label":s,className:c="",bodyClassName:d="",style:u,tone:h="neutral"}){const m=Pa[l??(a?"md":"none")],p=ze(),g=ze(),f=null!=t&&null!=r&&""!==r,b=null!=i&&null!=t,x=`h${i}`,y=null!=s&&""!==s,v=b||y,w=v?"section":"div",N=`rounded-(--radius-card) border ${Aa[h]} bg-white shadow-sm ${c}`.trim(),k=Re.toArray(e).length>0,$=k?"border-b border-gray-100 ":"",M="current"===h,C=M?"text-base font-semibold text-blue-700":"text-base font-semibold text-gray-900",L=M?"rounded-t-(--radius-card) bg-blue-50 ":"",S=`${$}${L}${m.edge} ${C}`;/* @__PURE__ */
238
238
  return Ge(w,{className:N,style:u,...y?{"aria-label":s}:b?{"aria-labelledby":p}:{},...f&&v?{"aria-describedby":g}:{},...M?{"aria-current":!0}:{},children:[f?
239
239
  /* @__PURE__ */Ge("div",{className:`${$}${L}${m.edge}`,children:[null!=o?/* @__PURE__ */Ge("div",{className:`flex items-center justify-between gap-3 ${C}`,children:[b?/* @__PURE__ */Ye(x,{id:p,children:t}):/* @__PURE__ */Ye("span",{children:t}),o]}):b?/* @__PURE__ */Ye(x,{id:p,className:C,children:t}):/* @__PURE__ */Ye("div",{className:C,children:t}),
240
240
  /* @__PURE__ */Ye("p",{id:g,className:M?"mt-0.5 text-xs text-gray-600":"mt-0.5 text-xs text-gray-500",children:r})]}):null!=t&&(null!=o?
241
241
  /* @__PURE__ */Ge("div",{className:`${S} flex items-center justify-between gap-3`,children:[b?/* @__PURE__ */Ye(x,{id:p,children:t}):/* @__PURE__ */Ye("span",{children:t}),o]}):b?
242
- /* @__PURE__ */Ye(x,{id:p,className:S,children:t}):/* @__PURE__ */Ye("div",{className:S,children:t})),k&&/* @__PURE__ */Ye("div",{className:[m.body,d].filter(Boolean).join(" "),children:e}),n&&/* @__PURE__ */Ye("div",{className:`border-t border-gray-100 ${m.edge}`,children:n})]})}function ja({label:e,value:t,icon:r,delta:n,className:a=""}){const l=ue(),i="number"==typeof t&&l?fe(t,l):t,o="up"===n?.direction?"text-green-600":"down"===n?.direction?"text-red-600":"text-gray-500",s="up"===n?.direction?"▲":"down"===n?.direction?"▼":"→";/* @__PURE__ */
242
+ /* @__PURE__ */Ye(x,{id:p,className:S,children:t}):/* @__PURE__ */Ye("div",{className:S,children:t})),k&&/* @__PURE__ */Ye("div",{className:[m.body,d].filter(Boolean).join(" "),children:e}),n&&/* @__PURE__ */Ye("div",{className:`border-t border-gray-100 ${m.edge}`,children:n})]})}function za({label:e,value:t,icon:r,delta:n,className:a=""}){const l=ue(),i="number"==typeof t&&l?fe(t,l):t,o="up"===n?.direction?"text-green-600":"down"===n?.direction?"text-red-600":"text-gray-500",s="up"===n?.direction?"▲":"down"===n?.direction?"▼":"→";/* @__PURE__ */
243
243
  return Ge("div",{className:`rounded-(--radius-card) border border-gray-200 bg-white p-4 shadow-sm ${a}`.trim(),children:[
244
244
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between text-gray-500",children:[
245
245
  /* @__PURE__ */Ye("span",{className:"text-xs font-medium uppercase tracking-wide",children:e}),r]}),
@@ -247,10 +247,10 @@ return Ge("div",{className:`rounded-(--radius-card) border border-gray-200 bg-wh
247
247
  /* @__PURE__ */Ye("span",{className:"text-2xl font-semibold text-gray-900",children:i}),n&&/* @__PURE__ */Ge("span",{className:`text-xs font-medium ${o}`,children:[s," ",n.value]})]})]})}var Fa={default:"text-gray-900",secondary:"text-gray-500",tertiary:"text-gray-400",disabled:"text-gray-300",danger:"text-red-600",success:"text-green-600",warning:"text-amber-600",link:"text-blue-600",inherit:""},Ea={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg"},Ba={normal:"font-normal",medium:"font-medium",semibold:"font-semibold"};function Ta({children:e,tone:t="default",size:r="sm",weight:n="normal",truncate:a=!1,as:l="span",className:i="",...o}){/* @__PURE__ */
248
248
  return Ye(l,{className:[Fa[t],Ea[r],Ba[n],a?"block truncate":"",i].filter(Boolean).join(" "),title:o.title??(a&&"string"==typeof e?e:void 0),htmlFor:o.htmlFor,children:e})}var Ia={1:"text-2xl font-semibold",2:"text-xl font-semibold",3:"text-lg font-semibold",4:"text-base font-semibold",5:"text-sm font-semibold"};function Oa({children:e,level:t=2,tone:r="default",className:n=""}){/* @__PURE__ */
249
249
  return Ye(`h${t}`,{className:[Ia[t],Fa[r],n].filter(Boolean).join(" "),children:e})}function Ra({children:e,tone:t="secondary",size:r="sm",className:n=""}){/* @__PURE__ */
250
- return Ye("p",{className:[Fa[t],Ea[r],"mb-2 last:mb-0",n].filter(Boolean).join(" "),children:e})}var Wa={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8"},Ka={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"},qa={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around"};function Ha({children:e,gap:t=4,align:r,justify:n,className:a=""}){/* @__PURE__ */
251
- return Ye("div",{className:["flex flex-col",Wa[t],r?Ka[r]:"",n?qa[n]:"",a].filter(Boolean).join(" "),children:e})}function _a({children:e,gap:t=2,align:r="center",justify:n,wrap:a=!0,className:l=""}){/* @__PURE__ */
252
- return Ye("div",{className:["flex",a?"flex-wrap":"",Wa[t],Ka[r],n?qa[n]:"",l].filter(Boolean).join(" "),children:e})}var Ua={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",6:"grid-cols-6",12:"grid-cols-12"},Va={1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",6:"sm:grid-cols-6",12:"sm:grid-cols-12"},Ya={1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",6:"lg:grid-cols-6",12:"lg:grid-cols-12"};function Ga({children:e,cols:t=1,smCols:r,lgCols:n,gap:a=4,className:l=""}){/* @__PURE__ */
253
- return Ye("div",{className:["grid",Ua[t],r?Va[r]:"",n?Ya[n]:"",Wa[a],l].filter(Boolean).join(" "),children:e})}var Xa={sm:"my-2",md:"my-4",lg:"my-6"};function Za({orientation:e="horizontal",children:t,align:r="center",spacing:n="md",className:a=""}){const l=je();if("vertical"===e)/* @__PURE__ */
250
+ return Ye("p",{className:[Fa[t],Ea[r],"mb-2 last:mb-0",n].filter(Boolean).join(" "),children:e})}var Wa={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8"},Ka={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"},_a={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around"};function qa({children:e,gap:t=4,align:r,justify:n,className:a=""}){/* @__PURE__ */
251
+ return Ye("div",{className:["flex flex-col",Wa[t],r?Ka[r]:"",n?_a[n]:"",a].filter(Boolean).join(" "),children:e})}function Ha({children:e,gap:t=2,align:r="center",justify:n,wrap:a=!0,className:l=""}){/* @__PURE__ */
252
+ return Ye("div",{className:["flex",a?"flex-wrap":"",Wa[t],Ka[r],n?_a[n]:"",l].filter(Boolean).join(" "),children:e})}var Ua={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",6:"grid-cols-6",12:"grid-cols-12"},Va={1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",6:"sm:grid-cols-6",12:"sm:grid-cols-12"},Ya={1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",6:"lg:grid-cols-6",12:"lg:grid-cols-12"};function Ga({children:e,cols:t=1,smCols:r,lgCols:n,gap:a=4,className:l=""}){/* @__PURE__ */
253
+ return Ye("div",{className:["grid",Ua[t],r?Va[r]:"",n?Ya[n]:"",Wa[a],l].filter(Boolean).join(" "),children:e})}var Xa={sm:"my-2",md:"my-4",lg:"my-6"};function Za({orientation:e="horizontal",children:t,align:r="center",spacing:n="md",className:a=""}){const l=ze();if("vertical"===e)/* @__PURE__ */
254
254
  return Ye("span",{role:"presentation",className:`inline-block h-full min-h-[1em] w-px shrink-0 self-stretch bg-gray-200 ${a}`.trim()});if(!t)/* @__PURE__ */
255
255
  return Ye("hr",{className:`border-0 border-t border-gray-200 ${Xa[n]} ${a}`.trim()});const i="left"===r?"w-4 shrink-0":"flex-1",o="right"===r?"w-4 shrink-0":"flex-1";
256
256
  /* @__PURE__ */
@@ -276,13 +276,13 @@ return Ge("div",{className:`flex items-center ${n}`.trim(),children:[l.map((e,t)
276
276
  return Ye(Pe,{name:"check-circle",look:"mini",...t});case"warning":/* @__PURE__ */
277
277
  return Ye(Pe,{name:"warning",look:"mini",...t});case"danger":/* @__PURE__ */
278
278
  return Ye(Pe,{name:"close-circle",look:"mini",...t});default:/* @__PURE__ */
279
- return Ye(Pe,{name:"info",look:"mini",...t})}}function zl({tone:e="info",emphasis:t="subtle",title:r,children:n,icon:a,action:l,onDismiss:i,sticky:o=!1,className:s=""}){const c=Dl[e],d="solid"===t,u=he().banner,h=d?Pl[e]:c.box,m=o?"sticky top-0 z-30":"",p=/* @__PURE__ */Ge(Xe,{children:[r&&/* @__PURE__ */Ye("div",{className:("font-semibold "+(d?"":"text-gray-900")).trim(),children:r}),n&&/* @__PURE__ */Ye("div",{className:`${d?"":"text-gray-700"} ${r?"mt-0.5":""}`.trim(),children:n})]});/* @__PURE__ */
279
+ return Ye(Pe,{name:"info",look:"mini",...t})}}function jl({tone:e="info",emphasis:t="subtle",title:r,children:n,icon:a,action:l,onDismiss:i,sticky:o=!1,className:s=""}){const c=Dl[e],d="solid"===t,u=he().banner,h=d?Pl[e]:c.box,m=o?"sticky top-0 z-30":"",p=/* @__PURE__ */Ge(Xe,{children:[r&&/* @__PURE__ */Ye("div",{className:("font-semibold "+(d?"":"text-gray-900")).trim(),children:r}),n&&/* @__PURE__ */Ye("div",{className:`${d?"":"text-gray-700"} ${r?"mt-0.5":""}`.trim(),children:n})]});/* @__PURE__ */
280
280
  return Ge("div",{role:"danger"===e?"alert":"status",className:`${m} flex items-start gap-3 rounded-lg border px-4 py-3 ${h} ${s}`.trim(),children:[
281
281
  /* @__PURE__ */Ye("span",{className:`mt-0.5 shrink-0 ${d?"":c.icon}`.trim(),children:a??/* @__PURE__ */Ye(Al,{tone:e})}),null==l?/* @__PURE__ */Ye("div",{className:"min-w-0 flex-1 text-sm",children:p}):
282
282
  /* @__PURE__ */Ge("div",{className:"flex min-w-0 flex-1 flex-wrap items-start gap-x-3 gap-y-2",children:[
283
283
  /* @__PURE__ */Ye("div",{className:"min-w-0 grow basis-48 text-sm",children:p}),
284
- /* @__PURE__ */Ye("div",{className:"shrink-0 self-center",children:l})]}),i&&/* @__PURE__ */Ye("button",{type:"button",onClick:i,"aria-label":u.dismiss,className:"shrink-0 "+(d?"opacity-80 hover:opacity-100":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Ye(Pe,{name:"close",className:"h-4 w-4",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})}var jl=(e,t)=>`${e}-tab-${t}`,Fl=(e,t)=>`${e}-panel-${t}`,El=(e,t)=>`flex items-center border-b border-gray-200${e?"":" gap-1"} ${t}`.trim();function Bl(e,t){return`-mb-px inline-flex items-center gap-2 border-b-2 px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${t?"flex-1 justify-center ":""}${e?"border-blue-600 text-blue-600":"border-transparent text-gray-900 hover:border-gray-300"}`}function Tl({items:e,value:t,onChange:r,variant:n="underline",block:a=!1,idPrefix:l,className:i="","aria-label":o,"aria-labelledby":s}){const c=Be([]),d="pill"===n,u=(t,r)=>{for(let n=1;n<=e.length;n+=1){const a=((t+r*n)%e.length+e.length)%e.length;if(!e[a]?.disabled)return a}return null},h=t=>{const r=1===t?e.map((e,t)=>t):e.map((t,r)=>e.length-1-r);for(const t of r)if(!e[t]?.disabled)return t;return null};/* @__PURE__ */
285
- return Ye("div",{role:"tablist","aria-label":o,"aria-labelledby":s,onKeyDown:n=>{const a=e.findIndex(e=>e.id===t);let l=null;if("ArrowRight"===n.key||"ArrowDown"===n.key)l=u(a,1);else if("ArrowLeft"===n.key||"ArrowUp"===n.key)l=u(a,-1);else if("Home"===n.key)l=h(1);else{if("End"!==n.key)return;l=h(-1)}n.preventDefault(),null!==l&&l!==a&&(r(e[l].id),c.current[l]?.focus())},className:d?Hr(a,i):El(a,i),children:e.map((e,n)=>{const i=e.id===t,o=/* @__PURE__ */Ye("button",{ref:e=>{c.current[n]=e},type:"button",role:"tab",id:l?jl(l,e.id):void 0,"aria-controls":l?Fl(l,e.id):void 0,"aria-selected":i,tabIndex:i?0:-1,disabled:e.disabled,onClick:()=>r(e.id),className:d?_r({selected:i,disabled:e.disabled,block:a}):Bl(i,a),children:/* @__PURE__ */Ye(Vr,{icon:e.icon,label:e.label})},e.id);return null!=e.tooltip&&!1!==e.tooltip?/* @__PURE__ */Ye(C,{content:e.tooltip,className:d||a?Ur(a):void 0,children:o},e.id):o})})}var Il=()=>/* @__PURE__ */Ye(Pe,{name:"check",className:"h-3.5 w-3.5","aria-hidden":"true"});function Ol({items:e,value:t,onChange:r,"aria-label":n,className:a=""}){const l=Math.max(0,e.findIndex(e=>e.id===t));/* @__PURE__ */
284
+ /* @__PURE__ */Ye("div",{className:"shrink-0 self-center",children:l})]}),i&&/* @__PURE__ */Ye("button",{type:"button",onClick:i,"aria-label":u.dismiss,className:"shrink-0 "+(d?"opacity-80 hover:opacity-100":"text-gray-400 hover:text-gray-600"),children:/* @__PURE__ */Ye(Pe,{name:"close",className:"h-4 w-4",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})]})}var zl=(e,t)=>`${e}-tab-${t}`,Fl=(e,t)=>`${e}-panel-${t}`,El=(e,t)=>`flex items-center border-b border-gray-200${e?"":" gap-1"} ${t}`.trim();function Bl(e,t){return`-mb-px inline-flex items-center gap-2 border-b-2 px-3 py-2 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${t?"flex-1 justify-center ":""}${e?"border-blue-600 text-blue-600":"border-transparent text-gray-900 hover:border-gray-300"}`}function Tl({items:e,value:t,onChange:r,variant:n="underline",block:a=!1,idPrefix:l,className:i="","aria-label":o,"aria-labelledby":s}){const c=Be([]),d="pill"===n,u=(t,r)=>{for(let n=1;n<=e.length;n+=1){const a=((t+r*n)%e.length+e.length)%e.length;if(!e[a]?.disabled)return a}return null},h=t=>{const r=1===t?e.map((e,t)=>t):e.map((t,r)=>e.length-1-r);for(const t of r)if(!e[t]?.disabled)return t;return null};/* @__PURE__ */
285
+ return Ye("div",{role:"tablist","aria-label":o,"aria-labelledby":s,onKeyDown:n=>{const a=e.findIndex(e=>e.id===t);let l=null;if("ArrowRight"===n.key||"ArrowDown"===n.key)l=u(a,1);else if("ArrowLeft"===n.key||"ArrowUp"===n.key)l=u(a,-1);else if("Home"===n.key)l=h(1);else{if("End"!==n.key)return;l=h(-1)}n.preventDefault(),null!==l&&l!==a&&(r(e[l].id),c.current[l]?.focus())},className:d?qr(a,i):El(a,i),children:e.map((e,n)=>{const i=e.id===t,o=/* @__PURE__ */Ye("button",{ref:e=>{c.current[n]=e},type:"button",role:"tab",id:l?zl(l,e.id):void 0,"aria-controls":l?Fl(l,e.id):void 0,"aria-selected":i,tabIndex:i?0:-1,disabled:e.disabled,onClick:()=>r(e.id),className:d?Hr({selected:i,disabled:e.disabled,block:a}):Bl(i,a),children:/* @__PURE__ */Ye(Vr,{icon:e.icon,label:e.label})},e.id);return null!=e.tooltip&&!1!==e.tooltip?/* @__PURE__ */Ye(C,{content:e.tooltip,className:d||a?Ur(a):void 0,children:o},e.id):o})})}var Il=()=>/* @__PURE__ */Ye(Pe,{name:"check",className:"h-3.5 w-3.5","aria-hidden":"true"});function Ol({items:e,value:t,onChange:r,"aria-label":n,className:a=""}){const l=Math.max(0,e.findIndex(e=>e.id===t));/* @__PURE__ */
286
286
  return Ye("ol",{"aria-label":n,className:`grid items-start ${a}`.trim(),style:{gridTemplateColumns:`repeat(${Math.max(e.length,1)}, minmax(0, 1fr))`},children:e.map((t,n)=>{const a=n<l?"complete":n===l?"current":"upcoming",i="complete"===a&&!!r,o=/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:["flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-semibold transition-colors","complete"===a?"bg-blue-600 text-white":"","current"===a?"border-2 border-blue-600 bg-white text-blue-600":"","upcoming"===a?"border-2 border-gray-300 bg-white text-gray-400":""].filter(Boolean).join(" "),children:"complete"===a?/* @__PURE__ */Ye(Il,{}):n+1}),s=/* @__PURE__ */Ge("span",{className:"min-w-0 text-center",children:[
287
287
  /* @__PURE__ */Ye("span",{className:"block text-sm font-medium "+("upcoming"===a?"text-gray-400":"text-gray-900"),children:t.label}),t.description&&/* @__PURE__ */Ye("span",{className:"block text-xs text-gray-500",children:t.description})]});/* @__PURE__ */
288
288
  return Ge("li",{"aria-current":"current"===a?"step":void 0,className:"relative flex min-w-0 justify-center",children:[n<e.length-1&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"absolute top-3.5 h-0.5 rounded "+(n<l?"bg-blue-600":"bg-gray-200"),style:{left:"calc(50% + 0.875rem)",right:"calc(-50% + 0.875rem)"}}),i?/* @__PURE__ */Ge("button",{type:"button",onClick:()=>r?.(t.id),className:"relative z-10 flex min-w-0 flex-col items-center gap-2 rounded px-2 text-center rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:[o,s]}):/* @__PURE__ */Ge("span",{className:"relative z-10 flex min-w-0 flex-col items-center gap-2 px-2 text-center",children:[o,s]})]},t.id)})})}function Rl({items:e,defaultOpenIds:t=[],openIds:r,onOpenChange:n,allowMultiple:a=!1,className:l=""}){const[i,o]=Ee(t),s=r??i;/* @__PURE__ */
@@ -293,11 +293,11 @@ return Ge("div",{children:[
293
293
  /* @__PURE__ */Ye(Pe,{name:"chevron-down",className:"h-4 w-4 shrink-0 transition-transform "+(t?"rotate-180":""),strokeWidth:"2","aria-hidden":"true"})]}),t&&/* @__PURE__ */Ye("div",{className:"px-4 pb-3 text-sm text-gray-600",children:e.content})]},e.id)})})}function Wl({colorClass:e,tone:t,children:r,size:a="sm",capitalize:l=!1,closable:i=!1,onClose:o,closeLabel:s,className:c=""}){const d=e??ya[t??"neutral"],u="xs"===a?"px-2 py-0.5 text-3xs":"md"===a?"px-3 py-0.5 text-xs":"px-2 py-0.5 text-xs",h=l?"capitalize":"",m=he().badge,p=s??("string"==typeof r?m.removeItem(r):m.remove),g="xs"===a?"h-2.5 w-2.5":"h-3 w-3";/* @__PURE__ */
294
294
  return Ge("span",{className:[xa,"font-medium",u,h,d,c].filter(Boolean).join(" "),children:[
295
295
  /* @__PURE__ */Ye(n,{children:r}),i&&/* @__PURE__ */Ye("button",{type:"button",onClick:o,"aria-label":p,className:"-mr-0.5 ml-1 inline-flex shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-strong)]",children:/* @__PURE__ */Ye(Pe,{name:"close",look:"mini",className:g,"aria-hidden":"true"})})]})}function Kl({title:e,message:t,description:r,hint:n,variant:a,frameless:l,icon:i,children:o}){const s=l?"none":a??"dashed",c="boolean"!=typeof i&&null!=i?i:null,d=!c&&(i??"card"!==s),u=he().emptyState,h=t??(e?void 0:u.message),m=r??n;/* @__PURE__ */
296
- return Ge("div",{className:`flex flex-col items-center justify-center text-center ${"card"===s?"rounded-md border border-gray-200 bg-white px-6 py-12":"none"===s?"px-6 py-12":"rounded-lg border-2 border-dashed border-gray-300 px-6 py-12"}`,children:[c&&/* @__PURE__ */Ye("div",{className:"mb-3 flex h-10 w-10 items-center justify-center text-gray-300","aria-hidden":"true",children:c}),d&&/* @__PURE__ */Ye(Pe,{name:"inbox",className:"h-10 w-10 text-gray-300 mb-3","aria-hidden":"true",strokeWidth:1}),e&&/* @__PURE__ */Ye("h3",{className:"text-sm font-medium text-gray-900",children:e}),h&&/* @__PURE__ */Ye("p",{className:"text-sm text-gray-500 "+(e?"mt-2":""),children:h}),m&&/* @__PURE__ */Ye("p",{className:"text-xs text-gray-400 mt-1",children:m}),o&&/* @__PURE__ */Ye("div",{className:"mt-4",children:o})]})}function ql({title:t,description:r,subtitle:n,actions:a,children:l,icon:i,breadcrumbs:o}){const s=r??n,c=a??l;/* @__PURE__ */
296
+ return Ge("div",{className:`flex flex-col items-center justify-center text-center ${"card"===s?"rounded-md border border-gray-200 bg-white px-6 py-12":"none"===s?"px-6 py-12":"rounded-lg border-2 border-dashed border-gray-300 px-6 py-12"}`,children:[c&&/* @__PURE__ */Ye("div",{className:"mb-3 flex h-10 w-10 items-center justify-center text-gray-300","aria-hidden":"true",children:c}),d&&/* @__PURE__ */Ye(Pe,{name:"inbox",className:"h-10 w-10 text-gray-300 mb-3","aria-hidden":"true",strokeWidth:1}),e&&/* @__PURE__ */Ye("h3",{className:"text-sm font-medium text-gray-900",children:e}),h&&/* @__PURE__ */Ye("p",{className:"text-sm text-gray-500 "+(e?"mt-2":""),children:h}),m&&/* @__PURE__ */Ye("p",{className:"text-xs text-gray-400 mt-1",children:m}),o&&/* @__PURE__ */Ye("div",{className:"mt-4",children:o})]})}function _l({title:t,description:r,subtitle:n,actions:a,children:l,icon:i,breadcrumbs:o}){const s=r??n,c=a??l;/* @__PURE__ */
297
297
  return Ge("div",{className:"mb-6",children:[o&&o.length>0&&/* @__PURE__ */Ye(e,{items:o,className:"mb-3"}),
298
298
  /* @__PURE__ */Ge("div",{className:"flex items-start justify-between gap-4",children:[
299
299
  /* @__PURE__ */Ge("div",{children:[
300
- /* @__PURE__ */Ge("h1",{className:"flex items-center gap-2 text-xl font-semibold text-gray-900",children:[i&&/* @__PURE__ */Ye("span",{className:"shrink-0",children:i}),t]}),s&&/* @__PURE__ */Ye("p",{className:"mt-1 text-sm text-gray-500",children:s})]}),c&&/* @__PURE__ */Ye("div",{className:"flex items-center gap-2",children:c})]})]})}var Hl=["success","warning","danger"];function _l(e){return"string"==typeof e&&Hl.includes(e)}function Ul(e,t,r){if(null==e||!Number.isFinite(e))return null;const n=Vl(t),a=Vl(r);return null==n&&null==a?null:null!=a&&e>=a?"danger":null!=n&&e>=n?"warning":"success"}function Vl(e){return null!=e&&Number.isFinite(e)?e:null}var Yl={success:{tone:"success",fill:"bg-green-500",ink:"text-gray-900",word:"ok"},warning:{tone:"warning",fill:"bg-amber-500",ink:"text-amber-600",word:"warning"},danger:{tone:"danger",fill:"bg-red-500",ink:"text-red-600",word:"critical"}};var Gl=/* @__PURE__ */new Set;function Xl(e,t){if(null==e)return null;if(_l(e))return Yl[e];const r=function(e){const t="string"==typeof e?JSON.stringify(e):"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?String(e):Object.prototype.toString.call(e);return t.length>32?`${t.slice(0,31)}…`:t}(e);return function(e,t){const r=`${e}:${t}`;Gl.has(r)||(Gl.add(r),console.error(`[efficient-shell] ${e}: severity ${t} is not one of ${Hl.join(" | ")}. Rendering an "unknown severity" marker — a health marker must never silently disappear. If this came from a backend rollup, map it to the shell's vocabulary at the fetch boundary (see isSeverityTone).`))}(t,r),{tone:null,fill:"bg-gray-300 border border-red-500",ink:"text-gray-900",word:`unrecognised severity ${r}`,token:r}}function Zl({at:e,title:t,className:r}){/* @__PURE__ */
300
+ /* @__PURE__ */Ge("h1",{className:"flex items-center gap-2 text-xl font-semibold text-gray-900",children:[i&&/* @__PURE__ */Ye("span",{className:"shrink-0",children:i}),t]}),s&&/* @__PURE__ */Ye("p",{className:"mt-1 text-sm text-gray-500",children:s})]}),c&&/* @__PURE__ */Ye("div",{className:"flex items-center gap-2",children:c})]})]})}var ql=["success","warning","danger"];function Hl(e){return"string"==typeof e&&ql.includes(e)}function Ul(e,t,r){if(null==e||!Number.isFinite(e))return null;const n=Vl(t),a=Vl(r);return null==n&&null==a?null:null!=a&&e>=a?"danger":null!=n&&e>=n?"warning":"success"}function Vl(e){return null!=e&&Number.isFinite(e)?e:null}var Yl={success:{tone:"success",fill:"bg-green-500",ink:"text-gray-900",word:"ok"},warning:{tone:"warning",fill:"bg-amber-500",ink:"text-amber-600",word:"warning"},danger:{tone:"danger",fill:"bg-red-500",ink:"text-red-600",word:"critical"}};var Gl=/* @__PURE__ */new Set;function Xl(e,t){if(null==e)return null;if(Hl(e))return Yl[e];const r=function(e){const t="string"==typeof e?JSON.stringify(e):"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?String(e):Object.prototype.toString.call(e);return t.length>32?`${t.slice(0,31)}…`:t}(e);return function(e,t){const r=`${e}:${t}`;Gl.has(r)||(Gl.add(r),console.error(`[efficient-shell] ${e}: severity ${t} is not one of ${ql.join(" | ")}. Rendering an "unknown severity" marker — a health marker must never silently disappear. If this came from a backend rollup, map it to the shell's vocabulary at the fetch boundary (see isSeverityTone).`))}(t,r),{tone:null,fill:"bg-gray-300 border border-red-500",ink:"text-gray-900",word:`unrecognised severity ${r}`,token:r}}function Zl({at:e,title:t,className:r}){/* @__PURE__ */
301
301
  return Ye("div",{title:t,className:`absolute -top-[3px] h-3 w-0.5 rounded-[1px] ${r}`,style:{left:`${e}%`}})}var Jl=e=>Math.min(100,Math.max(0,e));function Ql({label:e,value:t,max:r=100,warn:n,crit:a,severity:l,detail:i,formatValue:o,emptyLabel:s,size:c="sm",ariaLabel:d,className:u=""}){const h=he().meter,m=ue(),p=s??h.noData,g=null!=t&&Number.isFinite(t)?t:null,f=Number.isFinite(r)&&r>0?r:null;var b,x;null==f&&(b=`MetricBar:max:${String(r)}`,x=`[efficient-shell] MetricBar: max=${String(r)} is not a positive finite number, so there is no scale to draw a proportional bar against. Printing the value without a bar. Pass the real capacity, or leave the reading out entirely (value={null}) when it is unknown — do not pass 0.`,Gl.has(b)||(Gl.add(b),console.error(x)));const y=Xl(l,"MetricBar"),v=null!=g?y??(null==(w=Ul(g,n,a))?null:Yl[w]):null;var w;const N=Vl(n),k=Vl(a),$=null!=g&&null!=f?Jl(g/f*100):0,M=null!=g?(o??(e=>100===f?xe(e,1,m):fe(e,m)))(g):"—",C=null!=g&&null!=f&&(null!=N||null!=k),L="md"===c?"h-2":"h-1.5",S=null!=g&&null!=f,D=/* @__PURE__ */Ge("div",{...S?{role:"meter","aria-label":d??("string"==typeof e?e:void 0),"aria-valuemin":0,"aria-valuemax":f,"aria-valuenow":Math.min(f,Math.max(0,g)),"aria-valuetext":M}:{"aria-hidden":!0},className:S&&v?`relative mt-2 ${L} rounded-full bg-gray-200`:`relative mt-2 ${L} rounded-full border border-dashed border-gray-300 bg-transparent`,children:[S&&
302
302
  /* @__PURE__ */Ye("div",{className:`absolute inset-y-0 left-0 rounded-full ${v?v.fill:"bg-gray-400"}`,style:{width:`${$}%`}}),C&&null!=f&&null!=N&&/* @__PURE__ */Ye(Zl,{at:Jl(N/f*100),title:h.warningAt(N),className:"bg-gray-400 opacity-75"}),C&&null!=f&&null!=k&&/* @__PURE__ */Ye(Zl,{at:Jl(k/f*100),title:h.criticalAt(k),className:"bg-gray-500"})]}),P=v?v.ink:null!=g?"text-gray-900":"text-gray-400";/* @__PURE__ */
303
303
  return Ge("div","md"===c?{className:u,children:[null!=e&&/* @__PURE__ */Ye("div",{className:"text-3xs font-medium uppercase tracking-wide text-gray-500",children:e}),
@@ -306,14 +306,14 @@ return Ge("div","md"===c?{className:u,children:[null!=e&&/* @__PURE__ */Ye("div"
306
306
  /* @__PURE__ */Ye("span",{className:"min-w-0 truncate text-2xs tabular-nums text-gray-400",children:null!=g?i:p})]}),D]}:{className:u,children:[
307
307
  /* @__PURE__ */Ge("div",{className:"flex items-baseline gap-2",children:[null!=e&&/* @__PURE__ */Ye("span",{className:"w-14 shrink-0 truncate text-3xs font-medium uppercase tracking-wide text-gray-500",children:e}),
308
308
  /* @__PURE__ */Ye("span",{className:`text-sm font-semibold tabular-nums ${P}`,children:M}),
309
- /* @__PURE__ */Ye("span",{className:"ml-auto min-w-0 truncate text-2xs tabular-nums text-gray-400",children:null!=g?i:p})]}),D]})}function ei(e){return null!=e&&Number.isFinite(e)&&e>=0?e:null}function ti(e,t){const r=ei(e);if(null==r)return"no-reading";const n=ei(t);return null==n||0===n?"no-budget":r>n?"over":"within"}var ri=e=>Math.min(100,Math.max(0,e));function ni({label:e,elapsed:t,budget:r,grace:n,detail:a,formatDuration:l,emptyLabel:i,noBudgetLabel:o,size:s="sm",ariaLabel:c,className:d=""}){const u=he().meter,h=ue(),m=l??(e=>function(e,t=me.meter){const r=Math.round(e),n=Math.floor(r/3600),a=Math.floor(r%3600/60),l=r%60;return n>0?t.hoursMinutes(n,a):a>0?t.minutesSeconds(a,l):t.seconds(l)}(e,u)),p=i??u.noReading,g=o??u.noBudget,f=ei(t),b=ei(r),x=null!=b&&b>0?b:null,y=ei(n)??0,v="over"===ti(t,r),w=null!=x?x+y:null,N=null!=x&&null!=w?ri(x/w*100):null,k=v&&y>0,$=null==w||null==f?0:v?k?N??0:0:ri(f/w*100),M=k?N??0:0,C=v?k&&null!=w&&null!=f?ri(f/w*100):100:0,L=Math.max(0,C-M),S=null!=f&&null!=x?f/x*100:null,D=null!=S?xe(Math.round(S),0,h):null!=f?m(f):"—",P=a??(null==f?p:null==x?g:`${m(f)} / ${m(x)}`),A="md"===s?"h-2":"h-1.5",z=v?"text-red-600":null!=f?"text-gray-900":"text-gray-400",j=null!=f&&null!=x&&null!=w?/* @__PURE__ */Ge("div",{role:"meter","aria-label":c??("string"==typeof e?e:void 0),"aria-valuemin":0,"aria-valuemax":w,"aria-valuenow":Math.min(w,f),"aria-valuetext":u.ofBudget(D),className:`relative mt-2 ${A} overflow-hidden rounded-full bg-gray-200`,children:[(!v||k)&&/* @__PURE__ */Ye("div",{className:"absolute inset-y-0 left-0 rounded-full bg-blue-600",style:{width:`${$}%`}}),L>0&&/* @__PURE__ */Ye("div",{className:"rosh-budget-overrun absolute inset-y-0",style:{left:`${M}%`,width:`${L}%`}}),y>0&&null!=N&&/* @__PURE__ */Ye("div",{title:u.budget,className:"absolute inset-y-0 w-0.5 bg-gray-700",style:{left:`${N}%`}})]}):null;/* @__PURE__ */
309
+ /* @__PURE__ */Ye("span",{className:"ml-auto min-w-0 truncate text-2xs tabular-nums text-gray-400",children:null!=g?i:p})]}),D]})}function ei(e){return null!=e&&Number.isFinite(e)&&e>=0?e:null}function ti(e,t){const r=ei(e);if(null==r)return"no-reading";const n=ei(t);return null==n||0===n?"no-budget":r>n?"over":"within"}var ri=e=>Math.min(100,Math.max(0,e));function ni({label:e,elapsed:t,budget:r,grace:n,detail:a,formatDuration:l,emptyLabel:i,noBudgetLabel:o,size:s="sm",ariaLabel:c,className:d=""}){const u=he().meter,h=ue(),m=l??(e=>function(e,t=me.meter){const r=Math.round(e),n=Math.floor(r/3600),a=Math.floor(r%3600/60),l=r%60;return n>0?t.hoursMinutes(n,a):a>0?t.minutesSeconds(a,l):t.seconds(l)}(e,u)),p=i??u.noReading,g=o??u.noBudget,f=ei(t),b=ei(r),x=null!=b&&b>0?b:null,y=ei(n)??0,v="over"===ti(t,r),w=null!=x?x+y:null,N=null!=x&&null!=w?ri(x/w*100):null,k=v&&y>0,$=null==w||null==f?0:v?k?N??0:0:ri(f/w*100),M=k?N??0:0,C=v?k&&null!=w&&null!=f?ri(f/w*100):100:0,L=Math.max(0,C-M),S=null!=f&&null!=x?f/x*100:null,D=null!=S?xe(Math.round(S),0,h):null!=f?m(f):"—",P=a??(null==f?p:null==x?g:`${m(f)} / ${m(x)}`),A="md"===s?"h-2":"h-1.5",j=v?"text-red-600":null!=f?"text-gray-900":"text-gray-400",z=null!=f&&null!=x&&null!=w?/* @__PURE__ */Ge("div",{role:"meter","aria-label":c??("string"==typeof e?e:void 0),"aria-valuemin":0,"aria-valuemax":w,"aria-valuenow":Math.min(w,f),"aria-valuetext":u.ofBudget(D),className:`relative mt-2 ${A} overflow-hidden rounded-full bg-gray-200`,children:[(!v||k)&&/* @__PURE__ */Ye("div",{className:"absolute inset-y-0 left-0 rounded-full bg-blue-600",style:{width:`${$}%`}}),L>0&&/* @__PURE__ */Ye("div",{className:"rosh-budget-overrun absolute inset-y-0",style:{left:`${M}%`,width:`${L}%`}}),y>0&&null!=N&&/* @__PURE__ */Ye("div",{title:u.budget,className:"absolute inset-y-0 w-0.5 bg-gray-700",style:{left:`${N}%`}})]}):null;/* @__PURE__ */
310
310
  return Ge("div","md"===s?{className:d,children:[null!=e&&/* @__PURE__ */Ye("div",{className:"text-3xs font-medium uppercase tracking-wide text-gray-500",children:e}),
311
311
  /* @__PURE__ */Ge("div",{className:"mt-1 flex items-baseline gap-2",children:[
312
- /* @__PURE__ */Ye("span",{className:`text-2xl font-semibold leading-[30px] tabular-nums ${z}`,children:D}),
313
- /* @__PURE__ */Ye("span",{className:"min-w-0 truncate text-2xs tabular-nums text-gray-400",children:P})]}),j]}:{className:d,children:[
312
+ /* @__PURE__ */Ye("span",{className:`text-2xl font-semibold leading-[30px] tabular-nums ${j}`,children:D}),
313
+ /* @__PURE__ */Ye("span",{className:"min-w-0 truncate text-2xs tabular-nums text-gray-400",children:P})]}),z]}:{className:d,children:[
314
314
  /* @__PURE__ */Ge("div",{className:"flex items-baseline gap-2",children:[null!=e&&/* @__PURE__ */Ye("span",{className:"w-14 shrink-0 truncate text-3xs font-medium uppercase tracking-wide text-gray-500",children:e}),
315
- /* @__PURE__ */Ye("span",{className:`text-sm font-semibold tabular-nums ${z}`,children:D}),
316
- /* @__PURE__ */Ye("span",{className:"ml-auto min-w-0 truncate text-2xs tabular-nums text-gray-400",children:P})]}),j]})}var ai=864e5;function li(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const r=new Date(t).getUTCFullYear();return r<2e3||r>2100?null:t}function ii(e,t){return Me(new Date(e).toISOString().slice(0,10),{locale:t})}var oi=(e,t)=>`${e}-fill-${t}`,si=e=>`${e}-glow`,ci=e=>`${e}-reveal`,di=e=>`${e}-ground`;function ui(e,t,r,n){return"solid"===r?n:`url(#${oi(e,t)})`}function hi(e){return"solid"===e?void 0:"4 3"}function mi({id:e,index:t,colour:r,variant:n,from:a,to:l}){const i=oi(e,t);if("solid"===n)return null;if("gradient"===n||"gradient-reverse"===n){const e="gradient-reverse"===n;/* @__PURE__ */
315
+ /* @__PURE__ */Ye("span",{className:`text-sm font-semibold tabular-nums ${j}`,children:D}),
316
+ /* @__PURE__ */Ye("span",{className:"ml-auto min-w-0 truncate text-2xs tabular-nums text-gray-400",children:P})]}),z]})}var ai=864e5;function li(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const r=new Date(t).getUTCFullYear();return r<2e3||r>2100?null:t}function ii(e,t){return Me(new Date(e).toISOString().slice(0,10),{locale:t})}var oi=(e,t)=>`${e}-fill-${t}`,si=e=>`${e}-glow`,ci=e=>`${e}-reveal`,di=e=>`${e}-ground`;function ui(e,t,r,n){return"solid"===r?n:`url(#${oi(e,t)})`}function hi(e){return"solid"===e?void 0:"4 3"}function mi({id:e,index:t,colour:r,variant:n,from:a,to:l}){const i=oi(e,t);if("solid"===n)return null;if("gradient"===n||"gradient-reverse"===n){const e="gradient-reverse"===n;/* @__PURE__ */
317
317
  return Ge("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[
318
318
  /* @__PURE__ */Ye("stop",{offset:"0%",stopColor:r,stopOpacity:e?l:a}),
319
319
  /* @__PURE__ */Ye("stop",{offset:"100%",stopColor:r,stopOpacity:e?a:l})]})}const o=/* @__PURE__ */Ye("rect",{width:"100%",height:"100%",fill:r,fillOpacity:.45*a});return"duotone"===n?/* @__PURE__ */Ge("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[
@@ -348,20 +348,20 @@ return Ye("svg",{viewBox:"0 0 12 12","aria-hidden":"true",children:yi[e]})}funct
348
348
  return Ge("svg",{viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",children:[
349
349
  /* @__PURE__ */Ye("path",{d:"M4.2 2.2v11.6"}),
350
350
  /* @__PURE__ */Ye("path",{d:"M4.2 3.1h7.4l-1.6 2.5 1.6 2.6H4.2z"})]})}function Ni(){/* @__PURE__ */
351
- return Ye("svg",{viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",children:/* @__PURE__ */Ye("path",{d:"M2.8 11.6V8.2M6.6 11.6V5.4M10.4 11.6V7M14.2 11.6V3.6"})})}var ki=1e-6;function $i(e,t,r={}){const n=Number.isFinite(t)&&t>0?t:0,a=Array.from(new Set(e.filter(e=>Number.isFinite(e)))).sort((e,t)=>e-t);if(n<=0||a.length<2){const e=a[0]??0;return{anchorsMs:a,xs:a.map(()=>0),gaps:[],xByMs:()=>0,msByPx:()=>e,inCut:()=>!1}}const l=a[a.length-1]-a[0],i=r.maxTimeShare??.3,o=Math.min(r.breakPx??48,n),s=r.minGapPx??48,c=[],d=[],u=[];for(let e=0;e+1<a.length;e++){const t=a[e+1]-a[e];c.push(t),d.push(l>0?t/l*n:0),u.push(l>0&&t/l>i)}const h=u.filter(Boolean).length,m=Math.max(0,n-h*o);let p=0,g=0;for(let e=0;e<c.length;e++)u[e]||(p+=c[e],g+=1);const f=c.map((e,t)=>u[t]?o:0===g?0:p>0?m*e/p:m/g),b=function(e,t,r){const n=e.slice();let a=0;for(let e=0;e<n.length;e++)t[e]||n[e]>=r-ki||(a+=r-n[e],n[e]=r);if(a<=ki)return n;let l=0;for(let e=0;e<n.length;e++)!t[e]&&n[e]>r+ki&&(l+=n[e]-r);if(l<=ki)return n;const i=Math.min(a,l);for(let e=0;e<n.length;e++)t[e]||n[e]<=r+ki||(n[e]-=i*(n[e]-r)/l);return n}(f,u,s),x=b.reduce((e,t,r)=>u[r]?e:e+t,0),y=b.map((e,t)=>u[t]?e:x>0?e*m/x:e),v=[0];for(let e=0;e<y.length;e++)v.push(v[e]+y[e]);v[v.length-1]=n;const w=v.slice(0,-1).map((e,t)=>({fromMs:a[t],toMs:a[t+1],gapMs:c[t],fromPx:e,toPx:v[t+1],wantPx:d[t],clampedPx:f[t],px:v[t+1]-e,compressed:u[t]}));return{anchorsMs:a,xs:v,gaps:w,xByMs:e=>{if(!Number.isFinite(e)||e<=a[0])return 0;if(e>=a[a.length-1])return n;for(let t=0;t+1<a.length;t++){if(e>a[t+1])continue;const r=a[t+1]-a[t],n=r>0?(e-a[t])/r:0;return v[t]+n*(v[t+1]-v[t])}return n},msByPx:e=>{const t=Math.min(Math.max(Number.isFinite(e)?e:0,0),n);for(let e=0;e+1<a.length;e++){if(t>v[e+1]&&e+2<a.length)continue;const r=v[e+1]-v[e],n=r>0?(t-v[e])/r:0;return a[e]+n*(a[e+1]-a[e])}return a[a.length-1]},inCut:e=>w.some(t=>t.compressed&&e>t.fromMs&&e<t.toMs)}}function Mi(e,t,r){return Math.max(0,Math.min(e-t/2,Math.max(0,r-t)))}var Ci="mixed";function Li(e,t){return 5.6*Math.max(e.length,t.length)+8}var Si=(e,t,r)=>Math.min(Math.max(e,t),r),Di=e=>-(Math.cos(Math.PI*e)-1)/2;function Pi(e,t){if(!(t>0))return{px:e.fromPx,ms:e.fromMs};if(t>=1||e.durationMs<=0)return{px:e.toPx,ms:e.toMs};const r=e.fromPx+(e.toPx-e.fromPx)*Di(t);return{px:r,ms:e.msByPx(r)}}var Ai={lanes:{tag:0,laneA:17,laneH:30,rail:52,ruler:64,laneB:86,height:120},active:{tag:0,laneA:17,laneH:30,rail:38,ruler:50,laneB:74,height:108},none:{tag:0,laneA:16,laneH:14,rail:34,ruler:46,laneB:46,height:72}};function zi(){try{return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var ji=e=>5.6*e.length,Fi={default:{},dfm:{glyph:"doc",token:"var(--tl-dfm)"},shipment:{diamond:!0,glyph:"truck",token:"var(--tl-shipment)"},testing:{glyph:"flask",token:"var(--tl-testing)"},completion:{glyph:"check",token:"var(--tl-completion)"},inspection:{glyph:"flask",token:"var(--tl-inspection)"},invoice:{glyph:"receipt",token:"var(--tl-invoice)"},report:{}},Ei={doc:"dfm",flask:"testing",check:"completion",truck:"shipment",receipt:"invoice"};function Bi(e,t,r){if("none"!==e.glyph)return e.glyph?e.glyph:Fi[t].glyph??(r?"flag":void 0)}function Ti(e,t,r=!1){const n=Fi[e],a=["rosh-tl-node","rosh-tl-mark",`is-${t}`];n.diamond&&a.push("is-diamond"),r&&a.push("is-provisional");const l="current"===t?"var(--tl-accent)":n.token??"var(--tl-accent)",i="dot"===t||r?{borderColor:l,color:l}:{backgroundColor:l,color:"var(--tl-on-kind)"};return{className:a.join(" "),style:i}}function Ii(e){const t=(e=>"string"==typeof e?e:"")(e.detail);return`${e.label} · ${e.dateText}${t?` · ${t}`:""}`}var Oi="undefined"==typeof document?Ie:Ve;function Ri(e,t){const[r,n]=Ee(0);return Oi(()=>{const r=t?e.current:null;if(!r)return;const a=()=>{const e=r.getBoundingClientRect().width;e>0&&n(e)};if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(r),()=>{l.disconnect()}},[e,t]),r}function Wi(e,t,r){const n=/* @__PURE__ */new Map;for(const e of t)Number.isFinite(e.x)&&n.set(e.x,Math.max(n.get(e.x)??0,e.widthPx));const a=[...n.keys()].sort((e,t)=>e-t);if(r<=0||a.length<2)return e;const l=Math.max(0,a[0]),i=Math.min(r,a[a.length-1]),o=i-l,s=[];for(let e=0;e+1<a.length;e++){const t=(n.get(a[e])??0)/2+(n.get(a[e+1])??0)/2+8;s.push(Math.max(28,t,a[e+1]-a[e]))}const c=s.reduce((e,t)=>e+t,0),d=Math.min(Math.max(c,o),.8*r);if(d<=o+.5)return e;const u=l,h=r-i,m=u+h,p=Math.max(0,r-d),g=m>0?p*u/m:0,f=g,b=g+d,x=s.map(e=>c>0?e*d/c:0),y=e=>{if(e<=l)return u>0?e*g/u:f;if(e>=i)return h>0?b+(e-i)*(r-b)/h:b;let t=f;for(let r=0;r+1<a.length;r++){if(e>a[r+1]){t+=x[r];continue}const n=a[r+1]-a[r];return t+(n>0?(e-a[r])/n*x[r]:0)}return b};return{anchorsMs:e.anchorsMs,xs:e.xs.map(y),gaps:e.gaps.map(e=>({...e,fromPx:y(e.fromPx),toPx:y(e.toPx),px:y(e.toPx)-y(e.fromPx)})),xByMs:t=>y(e.xByMs(t)),msByPx:t=>e.msByPx((e=>{if(e<=f)return g>0?e*u/g:l;if(e>=b)return r-b>0?i+(e-b)*h/(r-b):i;let t=f;for(let r=0;r+1<a.length;r++){if(!(e>t+x[r]))return a[r]+(x[r]>0?(e-t)/x[r]*(a[r+1]-a[r]):0);t+=x[r]}return i})(t)),inCut:e.inCut}}function Ki(e){if(!e||0===e.length)return null;const t=e.filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);return t.length>0?t:null}function qi({marks:e,innerRef:t}){/* @__PURE__ */
351
+ return Ye("svg",{viewBox:"0 0 16 16","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",children:/* @__PURE__ */Ye("path",{d:"M2.8 11.6V8.2M6.6 11.6V5.4M10.4 11.6V7M14.2 11.6V3.6"})})}var ki=1e-6;function $i(e,t,r={}){const n=Number.isFinite(t)&&t>0?t:0,a=Array.from(new Set(e.filter(e=>Number.isFinite(e)))).sort((e,t)=>e-t);if(n<=0||a.length<2){const e=a[0]??0;return{anchorsMs:a,xs:a.map(()=>0),gaps:[],xByMs:()=>0,msByPx:()=>e,inCut:()=>!1}}const l=a[a.length-1]-a[0],i=r.maxTimeShare??.3,o=Math.min(r.breakPx??48,n),s=r.minGapPx??48,c=[],d=[],u=[];for(let e=0;e+1<a.length;e++){const t=a[e+1]-a[e];c.push(t),d.push(l>0?t/l*n:0),u.push(l>0&&t/l>i)}const h=u.filter(Boolean).length,m=Math.max(0,n-h*o);let p=0,g=0;for(let e=0;e<c.length;e++)u[e]||(p+=c[e],g+=1);const f=c.map((e,t)=>u[t]?o:0===g?0:p>0?m*e/p:m/g),b=function(e,t,r){const n=e.slice();let a=0;for(let e=0;e<n.length;e++)t[e]||n[e]>=r-ki||(a+=r-n[e],n[e]=r);if(a<=ki)return n;let l=0;for(let e=0;e<n.length;e++)!t[e]&&n[e]>r+ki&&(l+=n[e]-r);if(l<=ki)return n;const i=Math.min(a,l);for(let e=0;e<n.length;e++)t[e]||n[e]<=r+ki||(n[e]-=i*(n[e]-r)/l);return n}(f,u,s),x=b.reduce((e,t,r)=>u[r]?e:e+t,0),y=b.map((e,t)=>u[t]?e:x>0?e*m/x:e),v=[0];for(let e=0;e<y.length;e++)v.push(v[e]+y[e]);v[v.length-1]=n;const w=v.slice(0,-1).map((e,t)=>({fromMs:a[t],toMs:a[t+1],gapMs:c[t],fromPx:e,toPx:v[t+1],wantPx:d[t],clampedPx:f[t],px:v[t+1]-e,compressed:u[t]}));return{anchorsMs:a,xs:v,gaps:w,xByMs:e=>{if(!Number.isFinite(e)||e<=a[0])return 0;if(e>=a[a.length-1])return n;for(let t=0;t+1<a.length;t++){if(e>a[t+1])continue;const r=a[t+1]-a[t],n=r>0?(e-a[t])/r:0;return v[t]+n*(v[t+1]-v[t])}return n},msByPx:e=>{const t=Math.min(Math.max(Number.isFinite(e)?e:0,0),n);for(let e=0;e+1<a.length;e++){if(t>v[e+1]&&e+2<a.length)continue;const r=v[e+1]-v[e],n=r>0?(t-v[e])/r:0;return a[e]+n*(a[e+1]-a[e])}return a[a.length-1]},inCut:e=>w.some(t=>t.compressed&&e>t.fromMs&&e<t.toMs)}}function Mi(e,t,r){return Math.max(0,Math.min(e-t/2,Math.max(0,r-t)))}var Ci="mixed";function Li(e,t){return 5.6*Math.max(e.length,t.length)+8}var Si=(e,t,r)=>Math.min(Math.max(e,t),r),Di=e=>-(Math.cos(Math.PI*e)-1)/2;function Pi(e,t){if(!(t>0))return{px:e.fromPx,ms:e.fromMs};if(t>=1||e.durationMs<=0)return{px:e.toPx,ms:e.toMs};const r=e.fromPx+(e.toPx-e.fromPx)*Di(t);return{px:r,ms:e.msByPx(r)}}var Ai={lanes:{tag:0,laneA:17,laneH:30,rail:52,ruler:64,laneB:86,height:120},active:{tag:0,laneA:17,laneH:30,rail:38,ruler:50,laneB:74,height:108},none:{tag:0,laneA:16,laneH:14,rail:34,ruler:46,laneB:46,height:72}};function ji(){try{return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var zi=e=>5.6*e.length,Fi={default:{},dfm:{glyph:"doc",token:"var(--tl-dfm)"},shipment:{diamond:!0,glyph:"truck",token:"var(--tl-shipment)"},testing:{glyph:"flask",token:"var(--tl-testing)"},completion:{glyph:"check",token:"var(--tl-completion)"},inspection:{glyph:"flask",token:"var(--tl-inspection)"},invoice:{glyph:"receipt",token:"var(--tl-invoice)"},report:{}},Ei={doc:"dfm",flask:"testing",check:"completion",truck:"shipment",receipt:"invoice"};function Bi(e,t,r){if("none"!==e.glyph)return e.glyph?e.glyph:Fi[t].glyph??(r?"flag":void 0)}function Ti(e,t,r=!1){const n=Fi[e],a=["rosh-tl-node","rosh-tl-mark",`is-${t}`];n.diamond&&a.push("is-diamond"),r&&a.push("is-provisional");const l="current"===t?"var(--tl-accent)":n.token??"var(--tl-accent)",i="dot"===t||r?{borderColor:l,color:l}:{backgroundColor:l,color:"var(--tl-on-kind)"};return{className:a.join(" "),style:i}}function Ii(e){const t=(e=>"string"==typeof e?e:"")(e.detail);return`${e.label} · ${e.dateText}${t?` · ${t}`:""}`}var Oi="undefined"==typeof document?Ie:Ve;function Ri(e,t){const[r,n]=Ee(0);return Oi(()=>{const r=t?e.current:null;if(!r)return;const a=()=>{const e=r.getBoundingClientRect().width;e>0&&n(e)};if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(r),()=>{l.disconnect()}},[e,t]),r}function Wi(e,t,r){const n=/* @__PURE__ */new Map;for(const e of t)Number.isFinite(e.x)&&n.set(e.x,Math.max(n.get(e.x)??0,e.widthPx));const a=[...n.keys()].sort((e,t)=>e-t);if(r<=0||a.length<2)return e;const l=Math.max(0,a[0]),i=Math.min(r,a[a.length-1]),o=i-l,s=[];for(let e=0;e+1<a.length;e++){const t=(n.get(a[e])??0)/2+(n.get(a[e+1])??0)/2+8;s.push(Math.max(28,t,a[e+1]-a[e]))}const c=s.reduce((e,t)=>e+t,0),d=Math.min(Math.max(c,o),.8*r);if(d<=o+.5)return e;const u=l,h=r-i,m=u+h,p=Math.max(0,r-d),g=m>0?p*u/m:0,f=g,b=g+d,x=s.map(e=>c>0?e*d/c:0),y=e=>{if(e<=l)return u>0?e*g/u:f;if(e>=i)return h>0?b+(e-i)*(r-b)/h:b;let t=f;for(let r=0;r+1<a.length;r++){if(e>a[r+1]){t+=x[r];continue}const n=a[r+1]-a[r];return t+(n>0?(e-a[r])/n*x[r]:0)}return b};return{anchorsMs:e.anchorsMs,xs:e.xs.map(y),gaps:e.gaps.map(e=>({...e,fromPx:y(e.fromPx),toPx:y(e.toPx),px:y(e.toPx)-y(e.fromPx)})),xByMs:t=>y(e.xByMs(t)),msByPx:t=>e.msByPx((e=>{if(e<=f)return g>0?e*u/g:l;if(e>=b)return r-b>0?i+(e-b)*h/(r-b):i;let t=f;for(let r=0;r+1<a.length;r++){if(!(e>t+x[r]))return a[r]+(x[r]>0?(e-t)/x[r]*(a[r+1]-a[r]):0);t+=x[r]}return i})(t)),inCut:e.inCut}}function Ki(e){if(!e||0===e.length)return null;const t=e.filter(e=>Number.isFinite(e)).sort((e,t)=>e-t);return t.length>0?t:null}function _i({marks:e,innerRef:t}){/* @__PURE__ */
352
352
  return Ye("div",{ref:t,"aria-hidden":"true",className:"rosh-tl-measure",children:e.map(e=>/* @__PURE__ */Ge("div",{"data-lane-key":e.key,className:"rosh-tl-measure-box",children:[
353
353
  /* @__PURE__ */Ye("span",{className:"rosh-tl-name",children:e.label}),
354
- /* @__PURE__ */Ye("span",{className:"rosh-tl-date",children:e.dateText})]},e.key))})}function Hi({startMs:e,endMs:t,axis:r,geo:n,reveal:a}){const l=he().timeline,i=ke(ue()),o=n.ruler,s=[],c=[],d=r.gaps.filter(e=>e.compressed),u=new Date(e);u.setUTCDate(u.getUTCDate()+(8-u.getUTCDay())%7);for(let e=u.getTime();e<t;e+=7*ai){if(r.inCut(e))continue;const t=r.xByMs(e);r.xByMs(e+7*ai)-t<14||s.push(
355
- /* @__PURE__ */Ye("i",{className:"rosh-tl-tick is-week",style:{left:`${t}px`,top:`${o}px`,height:"3px"}},`wk-${e}`))}const h=d.map(e=>{const t=(e.fromPx+e.toPx)/2,r=ji(l.days(Math.round(e.gapMs/ai)))/2+6;return[t-r,t+r]}),m=(e,t)=>h.some(([r,n])=>e<n&&t>r);s.push(
354
+ /* @__PURE__ */Ye("span",{className:"rosh-tl-date",children:e.dateText})]},e.key))})}function qi({startMs:e,endMs:t,axis:r,geo:n,reveal:a}){const l=he().timeline,i=ke(ue()),o=n.ruler,s=[],c=[],d=r.gaps.filter(e=>e.compressed),u=new Date(e);u.setUTCDate(u.getUTCDate()+(8-u.getUTCDay())%7);for(let e=u.getTime();e<t;e+=7*ai){if(r.inCut(e))continue;const t=r.xByMs(e);r.xByMs(e+7*ai)-t<14||s.push(
355
+ /* @__PURE__ */Ye("i",{className:"rosh-tl-tick is-week",style:{left:`${t}px`,top:`${o}px`,height:"3px"}},`wk-${e}`))}const h=d.map(e=>{const t=(e.fromPx+e.toPx)/2,r=zi(l.days(Math.round(e.gapMs/ai)))/2+6;return[t-r,t+r]}),m=(e,t)=>h.some(([r,n])=>e<n&&t>r);s.push(
356
356
  /* @__PURE__ */Ye("i",{"data-timeline-part":"start-tick",className:"rosh-tl-tick",style:{left:"0px",top:`${o}px`,height:"6px"}},"start"));const p=new Date(e);p.setUTCDate(1);let g=-1/0,f=!0;for(;p.getTime()<t;){const t=p.getTime();if(!(t<=e)&&!r.inCut(t)){const e=r.xByMs(t);if(s.push(
357
- /* @__PURE__ */Ye("i",{className:"rosh-tl-tick",style:{left:`${e}px`,top:`${o}px`,height:"6px"}},`mo-${t}`)),e-g>=72||f){const r=f||0===p.getUTCMonth()?i.shortMonthYear(p.getUTCFullYear(),p.getUTCMonth()):i.monthsShort[p.getUTCMonth()];m(e,e+ji(r))||(c.push(
357
+ /* @__PURE__ */Ye("i",{className:"rosh-tl-tick",style:{left:`${e}px`,top:`${o}px`,height:"6px"}},`mo-${t}`)),e-g>=72||f){const r=f||0===p.getUTCMonth()?i.shortMonthYear(p.getUTCFullYear(),p.getUTCMonth()):i.monthsShort[p.getUTCMonth()];m(e,e+zi(r))||(c.push(
358
358
  /* @__PURE__ */Ye("span",{className:"rosh-tl-month"+(a?" rosh-tl-fade":""),style:{left:`${e}px`,top:`${o+9}px`,...a?{animationDelay:"420ms"}:{}},children:r},`mon-${t}`)),g=e,f=!1)}}p.setUTCMonth(p.getUTCMonth()+1)}/* @__PURE__ */
359
359
  return Ge("div",{"aria-hidden":"true","data-timeline-part":"ruler",children:[s,c,d.map(e=>{const t=Math.max(1,Math.round(e.gapMs/ai));/* @__PURE__ */
360
360
  return Ge("span",{"data-timeline-part":"break",className:"rosh-tl-rulercut"+(a?" rosh-tl-fade":""),style:{left:(e.fromPx+e.toPx)/2+"px",top:`${o}px`,...a?{animationDelay:"420ms"}:{}},children:[
361
361
  /* @__PURE__ */Ge("span",{className:"rosh-tl-cutglyph",children:[
362
362
  /* @__PURE__ */Ye("i",{}),
363
363
  /* @__PURE__ */Ye("i",{})]}),
364
- /* @__PURE__ */Ye("span",{children:l.days(t)})]},`cut-${e.fromMs}`)})]})}function _i({pending:e,reveal:t}){const r=he().timeline,[n,a]=Ee(!1),l=n?e:e.slice(0,2),i=e.length-l.length;/* @__PURE__ */
364
+ /* @__PURE__ */Ye("span",{children:l.days(t)})]},`cut-${e.fromMs}`)})]})}function Hi({pending:e,reveal:t}){const r=he().timeline,[n,a]=Ee(!1),l=n?e:e.slice(0,2),i=e.length-l.length;/* @__PURE__ */
365
365
  return Ge("div",{className:"rosh-tl-pending","data-timeline-part":"pending",children:[
366
366
  /* @__PURE__ */Ye("p",{className:"rosh-tl-pending-head",children:r.notReached}),
367
367
  /* @__PURE__ */Ye("ol",{className:"rosh-tl-ghosts","aria-label":r.notReached,children:l.map((e,n)=>/* @__PURE__ */Ge("li",{className:t?"rosh-tl-fade":void 0,style:t?{animationDelay:440+60*n+"ms"}:void 0,children:[
@@ -376,7 +376,7 @@ return Ge("li",{className:a?"rosh-tl-fade":void 0,style:a?xi(t,i):void 0,...e.ke
376
376
  /* @__PURE__ */Ye("span",{className:"rosh-tl-name",children:e.label}),
377
377
  /* @__PURE__ */Ye("span",{className:"rosh-tl-date",children:e.dateText})]})]},e.key)})}),u>0&&/* @__PURE__ */Ge("p",{className:"rosh-tl-vgap","aria-hidden":"true",children:[
378
378
  /* @__PURE__ */Ye("i",{className:"rosh-tl-vline is-dash"}),
379
- /* @__PURE__ */Ye("span",{children:c.daysToToday(u)})]}),t.length>0&&/* @__PURE__ */Ye(_i,{pending:t,reveal:a})]})}function Vi({axis:e,geo:t,fillTo:r,reveal:n,trackPx:a,tweened:l=!1}){/* @__PURE__ */
379
+ /* @__PURE__ */Ye("span",{children:c.daysToToday(u)})]}),t.length>0&&/* @__PURE__ */Ye(Hi,{pending:t,reveal:a})]})}function Vi({axis:e,geo:t,fillTo:r,reveal:n,trackPx:a,tweened:l=!1}){/* @__PURE__ */
380
380
  return Ge("div",{"aria-hidden":"true",children:[
381
381
  /* @__PURE__ */Ye("div",{className:"rosh-tl-rail bg-gray-200",style:{top:`${t.rail}px`,height:"6px",width:`${a}px`}}),null!==r&&/* @__PURE__ */Ye("div",{"data-timeline-part":"fill",className:`rosh-tl-fill bg-blue-600${l?" is-tweened":""}${n?" rosh-tl-draw":""}`,style:{top:`${t.rail}px`,height:"6px",width:`${Math.max(0,Math.min(e.xByMs(r),a))}px`}}),e.gaps.filter(e=>e.compressed).map(e=>/* @__PURE__ */Ge("div",{className:"rosh-tl-cut",style:{left:(e.fromPx+e.toPx)/2+"px",top:`${t.rail}px`,height:"6px"},children:[
382
382
  /* @__PURE__ */Ye("i",{}),
@@ -385,12 +385,12 @@ return Ge("div",{"aria-hidden":"true","data-timeline-part":"start",children:[
385
385
  /* @__PURE__ */Ye("i",{className:`rosh-tl-start${n?" is-around":""}${o}`,style:{left:"0px",top:`${e.rail+3}px`,...s}}),null!=t&&!1!==t&&/* @__PURE__ */Ye("span",{className:`rosh-tl-edge${o}`,"data-timeline-part":"start-caption",style:{left:"0px",top:`${i}px`,...s},children:t}),null!=r&&!1!==r&&/* @__PURE__ */Ye("span",{className:`rosh-tl-edge is-end${o}`,"data-timeline-part":"end-caption",style:{left:`${l}px`,top:`${i}px`,...s},children:r})]})}function Gi({x:e,geo:t,trackPx:r,label:n,reveal:a}){const l=he().timeline;/* @__PURE__ */
386
386
  return Ge("div",{"aria-hidden":"true","data-timeline-part":"today",children:[
387
387
  /* @__PURE__ */Ye("div",{className:"rosh-tl-todayline"+(a?" rosh-tl-fade":""),style:{left:`${e}px`,top:`${t.laneA}px`,height:t.ruler+20-t.laneA+"px",...a?{animationDelay:"420ms"}:{}}}),
388
- /* @__PURE__ */Ye("span",{className:"rosh-tl-todaytag"+(a?" rosh-tl-fade":""),title:l.todayTitle(n),style:{left:`${Mi(e,48,r)}px`,top:`${t.tag}px`,...a?{animationDelay:"420ms"}:{}},children:l.today})]})}function Xi({nodes:e,geo:t,reveal:r}){const n=e.map(e=>{const t=e.members.map(e=>e.caption).filter(e=>!!e);return 0===t.length?null:{x:e.x,first:t[0],last:t[t.length-1]}}).filter(e=>null!==e).sort((e,t)=>e.x-t.x),a=[];let l=null;const i=()=>{l&&(a.push({x:(l.from+l.to)/2,text:l.first===l.last?l.first:`${l.first}–${l.last}`}),l=null)};for(const e of n){const t=e.first===e.last?e.first:`${e.first}–${e.last}`,r=ji(t)/2;l&&e.x-r<l.right+6?(l.to=e.x,l.last=e.last,l.right=e.x+r):(i(),l={from:e.x,to:e.x,first:e.first,last:e.last,right:e.x+r})}return i(),/* @__PURE__ */Ye("div",{"aria-hidden":"true","data-timeline-part":"captions",children:a.map(e=>/* @__PURE__ */Ye("span",{className:"rosh-tl-caption"+(r?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:`${t.laneA}px`,...r?{animationDelay:"360ms"}:{}},children:e.text},`${e.x}-${e.text}`))})}function Zi({phase:e,geo:t,xOf:r}){const n=r(e.minMs),a=Math.max(r(e.maxMs)-n,4);/* @__PURE__ */
388
+ /* @__PURE__ */Ye("span",{className:"rosh-tl-todaytag"+(a?" rosh-tl-fade":""),title:l.todayTitle(n),style:{left:`${Mi(e,48,r)}px`,top:`${t.tag}px`,...a?{animationDelay:"420ms"}:{}},children:l.today})]})}function Xi({nodes:e,geo:t,reveal:r}){const n=e.map(e=>{const t=e.members.map(e=>e.caption).filter(e=>!!e);return 0===t.length?null:{x:e.x,first:t[0],last:t[t.length-1]}}).filter(e=>null!==e).sort((e,t)=>e.x-t.x),a=[];let l=null;const i=()=>{l&&(a.push({x:(l.from+l.to)/2,text:l.first===l.last?l.first:`${l.first}–${l.last}`}),l=null)};for(const e of n){const t=e.first===e.last?e.first:`${e.first}–${e.last}`,r=zi(t)/2;l&&e.x-r<l.right+6?(l.to=e.x,l.last=e.last,l.right=e.x+r):(i(),l={from:e.x,to:e.x,first:e.first,last:e.last,right:e.x+r})}return i(),/* @__PURE__ */Ye("div",{"aria-hidden":"true","data-timeline-part":"captions",children:a.map(e=>/* @__PURE__ */Ye("span",{className:"rosh-tl-caption"+(r?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:`${t.laneA}px`,...r?{animationDelay:"360ms"}:{}},children:e.text},`${e.x}-${e.text}`))})}function Zi({phase:e,geo:t,xOf:r}){const n=r(e.minMs),a=Math.max(r(e.maxMs)-n,4);/* @__PURE__ */
389
389
  return Ge("div",{"aria-hidden":"true","data-timeline-part":"phase",children:[
390
390
  /* @__PURE__ */Ye("div",{className:"rosh-tl-phase border-gray-300",style:{left:`${n}px`,width:`${a}px`,top:t.laneB+t.laneH-4+"px"}}),
391
391
  /* @__PURE__ */Ge("span",{className:"rosh-tl-phase-label text-gray-500",style:{left:`${n+a/2}px`,top:`${t.laneB+t.laneH+5}px`},children:[e.label," · parallel"]})]})}function Ji({nodes:e,trackPx:t,geo:r,activeKey:n,hoveredKey:a,currentKey:l}){const i=he().timeline,o=(e,t)=>null!==t&&(e.key===t||e.members.some(e=>e.key===t)),s=e.find(e=>e.key===a)??e.find(e=>o(e,n))??null;if(!s)return null;const c=s.mark,d=c?c.label:`×${s.members.length}`,u=c?c.dateText:function(e){const t=e[0].dateText,r=e[e.length-1].dateText;return t===r?t:`${t} – ${r}`}(s.members),h=c?c.widthPx:Li(d,u),m=c?.onOpen;/* @__PURE__ */
392
392
  return Ge("div",{"data-timeline-part":"label",className:`rosh-tl-label${s.key===a?" is-hot":""}${o(s,l)?" is-current":""}`,style:{left:`${Mi(s.x,h,t)}px`,top:`${r.laneB}px`,width:`${h}px`,height:`${r.laneH}px`},children:[m?/* @__PURE__ */Ye("button",{type:"button",className:"rosh-tl-name rosh-tl-open","data-timeline-part":"open","aria-label":i.open(d),onClick:m,children:d}):/* @__PURE__ */Ye("span",{className:"rosh-tl-name","aria-hidden":"true",children:d}),
393
- /* @__PURE__ */Ye("span",{className:"rosh-tl-date","aria-hidden":"true",children:u})]})}function Qi({groups:e,trackPx:t,geo:r,startMs:n,endMs:a,currentKey:l,hoveredKey:i,reveal:o,step:s,zoomedKey:c,popId:d,aimBubble:u,openCluster:h,setOpenCluster:m,previewCluster:p,setPreviewCluster:g,setZoomKey:f,startCaptionPx:b}){const x=[];e.forEach((e,t)=>{if("cluster"===e.type){const n=`cluster-${e.members[0].key}`,a=(r=e.members,`${(r[0]?.label??"").replace(/\s*v?\d+$/i,"").trim()||(r[0]?.label??"")} ×${r.length}`);if(x.push({key:n,group:e,text:a,x:e.members.reduce((e,t)=>e+t.baseX,0)/e.members.length,index:t,lane:-1,left:0,widthPx:Math.ceil(ji(a))+28}),n===c)for(const r of e.members)x.push({key:r.key,group:{type:"item",mark:r},text:r.label,x:r.x,index:t,lane:-1,left:0,widthPx:r.widthPx});return}var r;x.push({key:e.mark.key,group:e,text:e.mark.label,x:e.mark.x,index:t,lane:-1,left:0,widthPx:e.mark.widthPx})}),x.sort((e,t)=>e.x-t.x);const y=function(e,t,r,n,a={}){const l=t>0?t:0,i=n>0?n:1,o=a.gapPx??6,s=Math.max(1,a.laneCount??4),c=e.map((e,t)=>({item:e,index:t})).sort((e,t)=>(e.item.priority??0)-(t.item.priority??0)||e.item.ms-t.item.ms||e.index-t.index),d=Array.from({length:s},()=>[]),u=/* @__PURE__ */new Map;for(const{item:e}of c){const t=Math.max(0,e.widthPx);if(l<=0||t>l){u.set(e.key,-1);continue}const n=e.xPx??(e.ms-r)/i*l,a=Math.min(Math.max(n-t/2,0),l-t),c=a+t;let h=-1;for(let e=0;e<s;e++)if(d[e].every(e=>a>e.right+o||c+o<e.left)){d[e].push({left:a,right:c}),h=e;break}u.set(e.key,h)}return e.map(e=>({key:e.key,lane:u.get(e.key)??-1}))}([...b>0?[{key:"__rosh-tl-start__",ms:n,xPx:0,widthPx:b,priority:-2}]:[],...x.map(e=>({key:e.key,ms:"cluster"===e.group.type?e.group.members[0].ms:e.group.mark.ms,xPx:e.x,widthPx:e.widthPx,priority:"cluster"===e.group.type?-1:0}))],t,n,Math.max(a-n,ai),{laneCount:2}),v=new Map(y.map(e=>[e.key,e.lane]));for(const e of x)e.lane=v.get(e.key)??-1,e.left=Mi(e.x,e.widthPx,t);const w=x.find(e=>e.key===(h??p)),N=e=>0===e?r.laneA:r.laneB,k=e=>0===e?r.rail-4:r.rail+6+3;/* @__PURE__ */
393
+ /* @__PURE__ */Ye("span",{className:"rosh-tl-date","aria-hidden":"true",children:u})]})}function Qi({groups:e,trackPx:t,geo:r,startMs:n,endMs:a,currentKey:l,hoveredKey:i,reveal:o,step:s,zoomedKey:c,popId:d,aimBubble:u,openCluster:h,setOpenCluster:m,previewCluster:p,setPreviewCluster:g,setZoomKey:f,startCaptionPx:b}){const x=[];e.forEach((e,t)=>{if("cluster"===e.type){const n=`cluster-${e.members[0].key}`,a=(r=e.members,`${(r[0]?.label??"").replace(/\s*v?\d+$/i,"").trim()||(r[0]?.label??"")} ×${r.length}`);if(x.push({key:n,group:e,text:a,x:e.members.reduce((e,t)=>e+t.baseX,0)/e.members.length,index:t,lane:-1,left:0,widthPx:Math.ceil(zi(a))+28}),n===c)for(const r of e.members)x.push({key:r.key,group:{type:"item",mark:r},text:r.label,x:r.x,index:t,lane:-1,left:0,widthPx:r.widthPx});return}var r;x.push({key:e.mark.key,group:e,text:e.mark.label,x:e.mark.x,index:t,lane:-1,left:0,widthPx:e.mark.widthPx})}),x.sort((e,t)=>e.x-t.x);const y=function(e,t,r,n,a={}){const l=t>0?t:0,i=n>0?n:1,o=a.gapPx??6,s=Math.max(1,a.laneCount??4),c=e.map((e,t)=>({item:e,index:t})).sort((e,t)=>(e.item.priority??0)-(t.item.priority??0)||e.item.ms-t.item.ms||e.index-t.index),d=Array.from({length:s},()=>[]),u=/* @__PURE__ */new Map;for(const{item:e}of c){const t=Math.max(0,e.widthPx);if(l<=0||t>l){u.set(e.key,-1);continue}const n=e.xPx??(e.ms-r)/i*l,a=Math.min(Math.max(n-t/2,0),l-t),c=a+t;let h=-1;for(let e=0;e<s;e++)if(d[e].every(e=>a>e.right+o||c+o<e.left)){d[e].push({left:a,right:c}),h=e;break}u.set(e.key,h)}return e.map(e=>({key:e.key,lane:u.get(e.key)??-1}))}([...b>0?[{key:"__rosh-tl-start__",ms:n,xPx:0,widthPx:b,priority:-2}]:[],...x.map(e=>({key:e.key,ms:"cluster"===e.group.type?e.group.members[0].ms:e.group.mark.ms,xPx:e.x,widthPx:e.widthPx,priority:"cluster"===e.group.type?-1:0}))],t,n,Math.max(a-n,ai),{laneCount:2}),v=new Map(y.map(e=>[e.key,e.lane]));for(const e of x)e.lane=v.get(e.key)??-1,e.left=Mi(e.x,e.widthPx,t);const w=x.find(e=>e.key===(h??p)),N=e=>0===e?r.laneA:r.laneB,k=e=>0===e?r.rail-4:r.rail+6+3;/* @__PURE__ */
394
394
  return Ge(Xe,{children:[x.map(e=>{const t=Math.max(0,e.lane),n=Math.round(e.index*s+60);if("cluster"===e.group.type){const a=h===e.key,l=e.group.members.map(e=>e.x),i=()=>{g(null),a||f(null)};/* @__PURE__ */
395
395
  return Ge("div",{children:[
396
396
  /* @__PURE__ */Ge("button",{type:"button","data-timeline-part":"cluster",className:`rosh-tl-pill${Fi[e.group.kind]?.token?"":" text-blue-600"}${o?" rosh-tl-fade":""}`,"aria-expanded":a,"aria-controls":d,style:{left:`${e.left}px`,top:`${0===t?r.laneA+r.laneH-19:r.laneB}px`,color:Fi[e.group.kind]?.token,...o?{animationDelay:`${n}ms`}:{}},onMouseEnter:()=>{g(e.key),f(e.key)},onMouseLeave:i,onFocus:()=>{g(e.key),f(e.key)},onBlur:i,onClick:()=>{m(a?null:e.key),f(a?null:e.key)},children:[
@@ -409,20 +409,20 @@ return Ge("div",{children:[
409
409
  return Ge(Xe,{children:[
410
410
  /* @__PURE__ */Ye("div",{className:"rosh-tl-hit","aria-hidden":"true","data-timeline-part":"hit",style:{top:a.rail-9+"px",height:"24px"},onPointerDown:e=>{N(e),w(v(e.clientX))},onPointerMove:$,onPointerUp:k,onPointerCancel:k}),
411
411
  /* @__PURE__ */Ye("div",{className:"rosh-tl-chip","data-timeline-part":"chip",style:{left:`${Mi(f,88,o)+44}px`,top:`${a.tag}px`},children:e.chip?e.chip(b):ii(b,p)}),
412
- /* @__PURE__ */Ye("div",{role:"slider",tabIndex:0,className:"rosh-tl-thumb text-blue-600","data-timeline-part":"thumb","aria-label":e.ariaLabel??m.scrub,"aria-valuemin":0,"aria-valuemax":x&&x.length>0?x.length-1:C,"aria-valuenow":x&&x.length>0?Math.max(0,y):Math.round((t-l)/ai),"aria-valuetext":M,style:{left:`${f}px`,top:`${a.rail+3}px`},onPointerDown:N,onPointerMove:$,onPointerUp:k,onPointerCancel:k,onKeyDown:e=>{const r=(e=>{const{key:r}=e;if(x&&x.length>0){const e=y<0?0:y;return"ArrowRight"===r||"ArrowUp"===r?x[Math.min(e+1,x.length-1)]:"ArrowLeft"===r||"ArrowDown"===r?x[Math.max(e-1,0)]:"Home"===r?x[0]:"End"===r?x[x.length-1]:null}const n=(e.shiftKey?7:1)*ai;return"ArrowRight"===r||"ArrowUp"===r?t+n:"ArrowLeft"===r||"ArrowDown"===r?t-n:"Home"===r?l:"End"===r?i:null})(e);null!==r&&(e.preventDefault(),d?.(),w(r))}})]})}function to(e,t,r){return(t?e.height:e.ruler+26)+(r?22:0)}function ro({startMs:e,endMs:t,axis:r="linear",items:n,markers:a=[],pending:l=[],fillToMs:i,todayMs:o,labels:s="lanes",activeKey:c=null,onActivate:d,thumb:u,playback:h,edgeCaptions:m,phases:p=[],currentKey:g,zoomRange:f=null,motion:b=!0,ariaLabel:x,highlightKeys:y=null,onHoverChange:v,endMark:w=null}){const N="none"===s,k=le(Date.now,null),$=le(zi,!1),M=o??k,C=Be(null),S=he().timeline,D=ue(),P=e=>ii(e,D),A=Be(null),z=Be(null),j=Be(null),F=Be(/* @__PURE__ */new Map),E=Be(void 0),B=Be(void 0),T=Be(null),[I,O]=Ee({}),[R,W]=Ee(null),[K,q]=Ee(null),[H,_]=Ee(null),[U,V]=Ee(null),[Y,G]=Ee(null),[X,Z]=Ee(null),J=je(),ee=je(),te=Ri(C,!0),re=te>0?te-(l.length>0&&!N?176:0):0,ne=re>0&&re-20<320,ae=Ri(A,!ne),ie=ae>0?ae:600,oe=Ai[s],se=N&&l.length>0,ce=se?Math.max(0,ie-36):ie,de=r=>r>=e-ai&&r<=t+ai,me=n.filter(e=>Number.isFinite(e.ms)&&de(e.ms)).slice().sort((e,t)=>e.ms-t.ms),pe="spread"===r?a.map(e=>new Date(e.date).getTime()).filter(e=>Number.isFinite(e)):[],ge=$i([e,...[...me.map(e=>e.ms),...pe].filter(r=>r>e&&r<t),t],ce,"compressed"===(fe=r)?{}:"spread"===fe?{maxTimeShare:1/0}:{maxTimeShare:1/0,minGapPx:0});var fe;const be=ge.xByMs,xe=me.filter(e=>!e.provisional),ye=g??(xe.length>0?xe[xe.length-1].key:null),ve=me.map((e,t)=>{const r=e.date??P(e.ms),n=(e.priority??0)>0||"report"===e.kind,a=function(e){const t=e.kind??"default";return"default"===t&&e.glyph&&"none"!==e.glyph?Ei[e.glyph]??t:t}(e);return{key:e.key,ms:e.ms,x:be(e.ms),baseX:be(e.ms),kind:a,label:e.label,dateText:r,detail:e.detail,preview:e.preview,glyph:Bi(e,a,0===t&&"default"===a),role:e.key===ye?"current":n?"dot":"key",widthPx:N?Math.max(16,ji(e.caption??"")+6):I[e.key]||Li(e.label,r),collapsible:n,onClick:e.onClick,onOpen:e.onOpen,isItem:!0,caption:e.caption,provisional:!!e.provisional,isCap:!1}}),we=a.map(e=>({marker:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)&&de(e)).map(({marker:e,ms:t})=>{const r=`marker-${e.id}`,n=P(t);return{key:r,ms:t,x:be(t),baseX:be(t),kind:e.kind,label:e.label,dateText:n,detail:e.detail,preview:e.preview,glyph:e.glyph??Fi[e.kind].glyph,role:"key",widthPx:I[r]||Li(e.label,n),collapsible:!1,onClick:e.onClick?()=>e.onClick?.(e):void 0,onOpen:e.onOpen?()=>e.onOpen?.(e):void 0,isItem:!1,provisional:!1,isCap:!1}}),Ne=se?(()=>{const e=l[l.length-1],r=l.slice(0,-1).map(e=>e.label);return[{key:e.key,ms:t+ai,x:ie,baseX:ie,kind:e.kind??"default",label:e.label,dateText:S.notReached,detail:r.length>0?S.alsoToCome(r):void 0,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]})():[],ke=N&&w&&!se?[{key:w.key,ms:t,x:ce,baseX:ce,kind:"default",label:w.label,dateText:w.dateText??P(t),detail:w.detail,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]:[],$e=[...ve,...we,...Ne,...ke].sort((e,t)=>e.x-t.x||e.ms-t.ms),Me=m?.start??S.start(P(e)),Ce=null==Me||!1===Me?0:"string"==typeof Me?Math.ceil(ji(Me)):96,Le="lanes"===s?function(e,t={}){const r=t.minPitchPx??40,n=[];let a=0;for(;a<e.length;){const t=e[a];if(!t.collapsible){n.push({type:"item",mark:t}),a+=1;continue}let l=a+1;for(;l<e.length&&e[l].collapsible&&e[l].kind===t.kind;)l+=1;const i=e.slice(a,l),o=i.length>1&&i.every((e,t)=>{if(0===t)return!0;const n=i[t-1],a=Math.max(r,Math.max(e.widthPx,n.widthPx)+8);return e.x-n.x<a});if(i.length>=3||o)n.push({type:"cluster",kind:t.kind,members:i});else for(const e of i)n.push({type:"item",mark:e});a=l}return n}($e):[],Se=function(e,t=16){const r=[];let n=0;for(;n<e.length;){let a=n+1;for(;a<e.length&&e[a].x-e[a-1].x<t;)a+=1;if(a-n===1)r.push({type:"item",mark:e[n]});else{const t=e.slice(n,a),l=new Set(t.map(e=>e.kind));r.push({type:"cluster",kind:1===l.size?t[0].kind:Ci,members:t})}n=a}return r}($e),De=e=>"cluster"===e.type?`fold-${e.members[0].key}`:e.mark.key,Pe=/* @__PURE__ */new Map;for(const e of Se)if("cluster"===e.type)for(const t of e.members)Pe.set(t.key,De(e));const Ae=H??U??Y,ze=Le.find(e=>"cluster"===e.type&&(e=>"cluster"===e.type?`cluster-${e.members[0].key}`:e.mark.key)(e)===Ae)??Se.find(e=>"cluster"===e.type&&De(e)===Ae),Te=e=>({x:e.baseX,widthPx:e.widthPx}),Oe=ze&&"cluster"===ze.type?ze.members.map(Te):f?$e.filter(e=>e.ms>=f[0]&&e.ms<=f[1]).map(Te):[],Re=Oe.length>1?Wi(ge,Oe,ce):ge,We=Re!==ge;if(We)for(const e of $e)e.isCap||(e.x=Re.xByMs(e.ms));const Ke=$e.some(e=>e.x<14),qe=We&&ze?Ae:null,He=e=>({key:e.key,mark:e,members:[e],x:e.x,kind:e.kind,openable:!1}),_e=ne?$e.map(He):Se.flatMap(e=>{if("item"===e.type)return[He(e.mark)];const t=De(e);if(t===qe&&(r=e.members).every((e,t)=>0===t||e.x-r[t-1].x>=16))return e.members.map(He);var r;const n=e.members.map(e=>e.x);return[{key:t,mark:null,members:e.members,x:n.reduce((e,t)=>e+t,0)/n.length,kind:e.kind,openable:new Set(e.members.map(e=>e.ms)).size>1}]}),Ue=/* @__PURE__ */new Map;for(const e of _e)for(const t of e.members)Ue.set(t.key,e.key);const Ve=Se.find(e=>"cluster"===e.type&&De(e)===qe),Ze=Ve&&"cluster"===Ve.type?{from:Math.min(...Ve.members.map(e=>e.x))-16,to:Math.max(...Ve.members.map(e=>e.x))+16}:null,Je=Be(qe),[Qe,et]=Ee(!1);Ie(()=>{if(Je.current===qe)return;Je.current=qe,et(!0);const e=setTimeout(()=>et(!1),240);return()=>clearTimeout(e)},[qe]);const tt=$e.map(e=>`${e.key} ${e.label} ${e.dateText}`).join("|");Oi(()=>{const e=z.current;if(!e)return;const t={};for(const r of Array.from(e.children)){const e=r.dataset.laneKey,n=r.getBoundingClientRect().width;e&&n>0&&(t[e]=n)}O(e=>function(e,t){const r=Object.keys(e);return r.length===Object.keys(t).length&&r.every(r=>Math.abs((e[r]??0)-(t[r]??0))<.5)}(e,t)?e:t)},[tt]);const rt=`${s}|${r}|${$e.map(e=>`${e.key}@${e.ms}`).join("|")}`,[nt,at]=Ee(rt),lt=b&&nt===rt;Ie(()=>{nt!==rt&&at(rt)},[nt,rt]);const it=Math.min(28,340/Math.max(1,$e.length-1)),ot=Ki(u?.stops),st=r=>{const n=Math.min(Math.max(r,e),t);if(!ot)return n;let a=ot[0];for(const e of ot)Math.abs(e-n)<Math.abs(a-n)&&(a=e);return a},ct=u?st(u.valueMs):null,dt=h&&u?ve.filter(e=>!ot||ot.includes(e.ms)).map(e=>({key:e.key,ms:e.ms})):[],ut=function(e,t,r={}){const n=Number.isFinite(r.speed)&&(r.speed??0)>0?r.speed:1,a=Math.max(0,r.dwellMs??700)/n,l=t.filter(e=>Number.isFinite(e.ms)).slice().sort((e,t)=>e.ms-t.ms),i=[];for(let t=0;t+1<l.length;t++){const o=l[t],s=l[t+1],c=e.xByMs(o.ms),d=e.xByMs(s.ms),u=Math.max(0,d-c),h=u<=.5||r.reducedMotion?0:Si(350*u/100,450,1400)/n;i.push({fromKey:o.key,toKey:s.key,fromMs:o.ms,toMs:s.ms,fromPx:c,toPx:d,lengthPx:u,durationMs:h,dwellMs:a,msByPx:e.msByPx})}return i}(Re,dt,{speed:h?.speed,reducedMotion:$}),[ht,mt]=Ee(null),pt=Be(null),gt=Be({segments:ut,value:ct,playback:h});Ie(()=>{gt.current={segments:ut,value:ct,playback:h}});const ft=Be(null),bt=Fe(e=>{null===e&&null===ft.current||(ft.current=e,gt.current.playback?.onProgress?.(e))},[]),xt=Fe(()=>{pt.current=null,mt(null),bt(null),gt.current.playback?.onStop?.()},[bt]),yt=!!h?.playing&&!!u;Ie(()=>{if(!yt)return;const e=gt.current,t=null===e.value?-1:e.segments.findIndex(t=>t.fromMs===e.value);if(t<0)return void xt();pt.current&&pt.current.index===t||(pt.current={index:t,phase:"rest",t:0,restLeftMs:e.segments[t].dwellMs,sinceMs:null});let r,n=0;const a=e=>mt(t=>t&&t.px===e.px&&t.ms===e.ms?t:e),l=()=>{clearTimeout(r);const e=pt.current;"rest"===e?.phase&&(r=setTimeout(i,Math.max(0,e.restLeftMs)))},i=()=>{const e=pt.current;if("rest"!==e?.phase)return;const t=gt.current.segments[e.index];t?(pt.current={index:e.index,phase:"glide",t:0,restLeftMs:0,sinceMs:null},a(Pi(t,0))):xt()},o=e=>{const t=gt.current,r=pt.current;if(!r)return;const i=function(e,t,r){const n=e[t.index];if(!n)return{cursor:null,at:null,arrived:null,progress:null};const a=null===t.sinceMs?0:Math.max(0,r-t.sinceMs);if("rest"===t.phase){const e=t.restLeftMs-a;return e>0?{cursor:{...t,restLeftMs:e,sinceMs:r},at:Pi(n,0),arrived:null,progress:null}:{cursor:{index:t.index,phase:"glide",t:0,restLeftMs:0,sinceMs:r},at:Pi(n,0),arrived:null,progress:null}}const l=n.durationMs>0?Math.min(1,t.t+a/n.durationMs):1,i=Pi(n,l);if(l<1)return{cursor:{...t,t:l,sinceMs:r},at:i,arrived:null,progress:{fromKey:n.fromKey,toKey:n.toKey,t:Di(l),ms:i.ms}};const o=e[t.index+1];return{cursor:o?{index:t.index+1,phase:"rest",t:0,restLeftMs:o.dwellMs,sinceMs:r}:null,at:i,arrived:{key:n.toKey,ms:n.toMs},progress:null}}(t.segments,r,e);pt.current=i.cursor,i.at&&a(i.at),bt(i.progress),i.arrived&&t.playback?.onArrive(i.arrived.key,i.arrived.ms),i.cursor?(i.cursor.phase===r.phase&&i.cursor.index===r.index||l(),n=requestAnimationFrame(o)):xt()};return l(),n=requestAnimationFrame(o),()=>{cancelAnimationFrame(n),clearTimeout(r),pt.current&&(pt.current.sinceMs=null,bt(null))}},[yt,xt,bt]);const vt=ve.filter(e=>!e.provisional),wt=u?ht?ht.ms:ct:void 0!==i?i:vt.length>0?null===M?vt[vt.length-1].ms:Math.min(vt[vt.length-1].ms,M):null,Nt=new Set(y??[]),kt=$e.filter(e=>Nt.has(e.key)).map(e=>e.x),$t=kt.length>0?{from:Math.min(...kt),to:Math.max(...kt)}:null,Mt=Fe(()=>{clearTimeout(E.current),clearTimeout(B.current),W(null),q(null),_(null),V(null),G(null)},[]);Ie(()=>()=>{clearTimeout(E.current),clearTimeout(B.current)},[]),Ie(()=>{const e=T.current;e&&(T.current=null,F.current.get(e)?.focus())});const Ct=null!==K||null!==H||null!==U||null!==Y;Ie(()=>{if(Ct)return Q(e=>"Escape"===e.key&&(Mt(),!0))},[Ct,Mt]);const Lt=Fe((e,t)=>{if(!e)return;const r=e.offsetWidth/2;let n=r>0?Math.max(r,Math.min(t,ie-r)):t;const a=e.parentElement;if(r>0&&a){const t=L(e),l=a.getBoundingClientRect().left,i=t.left+8+r-l,o=t.right-8-r-l;i<=o&&(n=Math.max(i,Math.min(n,o)))}e.style.left=`${n}px`,e.style.setProperty("--rosh-tl-arrow",`${r+(t-n)}px`)},[ie]),St=_e.find(e=>e.key===K)??null,Dt=St?St.x:0;Oi(()=>{Lt(j.current,Dt)},[Lt,K,Dt]);const Pt=ct??void 0,At=Be(null);Ie(()=>{if(void 0===Pt)return;const e=Re.xByMs(Pt),t=At.current;if(At.current=e,null===t||e<=t)return;const r=[];for(const n of $e){if(n.x<=t||n.x>e)continue;const a=F.current.get(Ue.get(n.key)??n.key);a&&(a.classList.add("is-hit"),r.push(setTimeout(()=>a.classList.remove("is-hit"),460)))}return()=>{for(const e of r)clearTimeout(e)}},[Pt]);const zt=_e.map(e=>e.key),jt=ye?Ue.get(ye)??null:null,Ft=X&&zt.includes(X)?X:jt&&zt.includes(jt)?jt:zt[0],Et=e=>{const t=zt.indexOf(e.target.dataset?.timelineKey??"");if(t<0)return;const r="ArrowRight"===e.key||"ArrowDown"===e.key?t+1:"ArrowLeft"===e.key||"ArrowUp"===e.key?t-1:"Home"===e.key?0:"End"===e.key?zt.length-1:-1;r<0||r>zt.length-1||(e.preventDefault(),Z(zt[r]),F.current.get(zt[r])?.focus())},Bt=()=>clearTimeout(B.current),Tt=e=>{Bt(),G(e)},It=()=>{clearTimeout(B.current),B.current=setTimeout(()=>G(null),260)},Ot=e=>{qe&&Pe.get(e)===qe?Bt():(Bt(),G(null))},Rt=e=>{clearTimeout(E.current),W(e),q(e),v?.((e=>{const t=_e.find(t=>t.key===e);return t?.members[0]?.key??e})(e))},Wt=e=>{W(t=>t===e?null:t),clearTimeout(E.current),E.current=setTimeout(()=>q(t=>t===e?null:t),160),v?.(null)},Kt=e=>({type:"button","data-timeline-node":e.isCap?"cap":e.isItem?"item":"marker","data-timeline-key":e.key,"aria-label":Ii(e),"aria-describedby":K===e.key?J:void 0,tabIndex:e.key===Ft?0:-1,ref:t=>{t?F.current.set(e.key,t):F.current.delete(e.key)},onMouseEnter:()=>{Ot(e.key),Rt(e.key)},onMouseLeave:()=>{It(),Wt(e.key)},onFocus:()=>{Ot(e.key),Rt(e.key),Z(e.key)},onBlur:()=>{It(),Wt(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),e.onClick?.(),e.isItem&&d?.(e.key)}}),qt=e=>{return{type:"button","data-timeline-node":"fold","data-timeline-key":e.key,"data-timeline-count":String(e.members.length),"aria-label":(t=e.members,r=S,r.events(t.length,t.map(Ii))),"aria-describedby":K===e.key?J:void 0,tabIndex:e.key===Ft?0:-1,ref:t=>{t?F.current.set(e.key,t):F.current.delete(e.key)},onMouseEnter:()=>{e.openable?Tt(e.key):Rt(e.key)},onMouseLeave:()=>{It(),Wt(e.key)},onFocus:()=>{Bt(),Rt(e.key),Z(e.key)},onBlur:()=>{It(),Wt(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{if(t.stopPropagation(),!e.openable)return void Rt(e.key);Tt(e.key);const r=e.members[0];Z(r.key),T.current=r.key}};var t,r},Ht="lanes"!==s||$e.length>1;if(ne)/* @__PURE__ */
413
- return Ye("div",{ref:C,children:/* @__PURE__ */Ye(Ui,{marks:$e.filter(e=>!e.isCap),pending:l,currentKey:ye,todayMs:M,reveal:lt,ariaLabel:x,step:it,nodeProps:Kt,onKeyDown:Et})});const _t=(e,t)=>null==e||!1===e?null:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"rosh-tl-flank"+(t?" is-end":""),"data-timeline-part":t?"end-caption":"start-caption",style:{paddingTop:oe.rail-3+"px"},children:e});/* @__PURE__ */
412
+ /* @__PURE__ */Ye("div",{role:"slider",tabIndex:0,className:"rosh-tl-thumb text-blue-600","data-timeline-part":"thumb","aria-label":e.ariaLabel??m.scrub,"aria-valuemin":0,"aria-valuemax":x&&x.length>0?x.length-1:C,"aria-valuenow":x&&x.length>0?Math.max(0,y):Math.round((t-l)/ai),"aria-valuetext":M,style:{left:`${f}px`,top:`${a.rail+3}px`},onPointerDown:N,onPointerMove:$,onPointerUp:k,onPointerCancel:k,onKeyDown:e=>{const r=(e=>{const{key:r}=e;if(x&&x.length>0){const e=y<0?0:y;return"ArrowRight"===r||"ArrowUp"===r?x[Math.min(e+1,x.length-1)]:"ArrowLeft"===r||"ArrowDown"===r?x[Math.max(e-1,0)]:"Home"===r?x[0]:"End"===r?x[x.length-1]:null}const n=(e.shiftKey?7:1)*ai;return"ArrowRight"===r||"ArrowUp"===r?t+n:"ArrowLeft"===r||"ArrowDown"===r?t-n:"Home"===r?l:"End"===r?i:null})(e);null!==r&&(e.preventDefault(),d?.(),w(r))}})]})}function to(e,t,r){return(t?e.height:e.ruler+26)+(r?22:0)}function ro({startMs:e,endMs:t,axis:r="linear",items:n,markers:a=[],pending:l=[],fillToMs:i,todayMs:o,labels:s="lanes",activeKey:c=null,onActivate:d,thumb:u,playback:h,edgeCaptions:m,phases:p=[],currentKey:g,zoomRange:f=null,motion:b=!0,ariaLabel:x,highlightKeys:y=null,onHoverChange:v,endMark:w=null}){const N="none"===s,k=le(Date.now,null),$=le(ji,!1),M=o??k,C=Be(null),S=he().timeline,D=ue(),P=e=>ii(e,D),A=Be(null),j=Be(null),z=Be(null),F=Be(/* @__PURE__ */new Map),E=Be(void 0),B=Be(void 0),T=Be(null),[I,O]=Ee({}),[R,W]=Ee(null),[K,_]=Ee(null),[q,H]=Ee(null),[U,V]=Ee(null),[Y,G]=Ee(null),[X,Z]=Ee(null),J=ze(),ee=ze(),te=Ri(C,!0),re=te>0?te-(l.length>0&&!N?176:0):0,ne=re>0&&re-20<320,ae=Ri(A,!ne),ie=ae>0?ae:600,oe=Ai[s],se=N&&l.length>0,ce=se?Math.max(0,ie-36):ie,de=r=>r>=e-ai&&r<=t+ai,me=n.filter(e=>Number.isFinite(e.ms)&&de(e.ms)).slice().sort((e,t)=>e.ms-t.ms),pe="spread"===r?a.map(e=>new Date(e.date).getTime()).filter(e=>Number.isFinite(e)):[],ge=$i([e,...[...me.map(e=>e.ms),...pe].filter(r=>r>e&&r<t),t],ce,"compressed"===(fe=r)?{}:"spread"===fe?{maxTimeShare:1/0}:{maxTimeShare:1/0,minGapPx:0});var fe;const be=ge.xByMs,xe=me.filter(e=>!e.provisional),ye=g??(xe.length>0?xe[xe.length-1].key:null),ve=me.map((e,t)=>{const r=e.date??P(e.ms),n=(e.priority??0)>0||"report"===e.kind,a=function(e){const t=e.kind??"default";return"default"===t&&e.glyph&&"none"!==e.glyph?Ei[e.glyph]??t:t}(e);return{key:e.key,ms:e.ms,x:be(e.ms),baseX:be(e.ms),kind:a,label:e.label,dateText:r,detail:e.detail,preview:e.preview,glyph:Bi(e,a,0===t&&"default"===a),role:e.key===ye?"current":n?"dot":"key",widthPx:N?Math.max(16,zi(e.caption??"")+6):I[e.key]||Li(e.label,r),collapsible:n,onClick:e.onClick,onOpen:e.onOpen,isItem:!0,caption:e.caption,provisional:!!e.provisional,isCap:!1}}),we=a.map(e=>({marker:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)&&de(e)).map(({marker:e,ms:t})=>{const r=`marker-${e.id}`,n=P(t);return{key:r,ms:t,x:be(t),baseX:be(t),kind:e.kind,label:e.label,dateText:n,detail:e.detail,preview:e.preview,glyph:e.glyph??Fi[e.kind].glyph,role:"key",widthPx:I[r]||Li(e.label,n),collapsible:!1,onClick:e.onClick?()=>e.onClick?.(e):void 0,onOpen:e.onOpen?()=>e.onOpen?.(e):void 0,isItem:!1,provisional:!1,isCap:!1}}),Ne=se?(()=>{const e=l[l.length-1],r=l.slice(0,-1).map(e=>e.label);return[{key:e.key,ms:t+ai,x:ie,baseX:ie,kind:e.kind??"default",label:e.label,dateText:S.notReached,detail:r.length>0?S.alsoToCome(r):void 0,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]})():[],ke=N&&w&&!se?[{key:w.key,ms:t,x:ce,baseX:ce,kind:"default",label:w.label,dateText:w.dateText??P(t),detail:w.detail,glyph:void 0,role:"key",widthPx:16,collapsible:!1,isItem:!1,provisional:!1,isCap:!0}]:[],$e=[...ve,...we,...Ne,...ke].sort((e,t)=>e.x-t.x||e.ms-t.ms),Me=m?.start??S.start(P(e)),Ce=null==Me||!1===Me?0:"string"==typeof Me?Math.ceil(zi(Me)):96,Le="lanes"===s?function(e,t={}){const r=t.minPitchPx??40,n=[];let a=0;for(;a<e.length;){const t=e[a];if(!t.collapsible){n.push({type:"item",mark:t}),a+=1;continue}let l=a+1;for(;l<e.length&&e[l].collapsible&&e[l].kind===t.kind;)l+=1;const i=e.slice(a,l),o=i.length>1&&i.every((e,t)=>{if(0===t)return!0;const n=i[t-1],a=Math.max(r,Math.max(e.widthPx,n.widthPx)+8);return e.x-n.x<a});if(i.length>=3||o)n.push({type:"cluster",kind:t.kind,members:i});else for(const e of i)n.push({type:"item",mark:e});a=l}return n}($e):[],Se=function(e,t=16){const r=[];let n=0;for(;n<e.length;){let a=n+1;for(;a<e.length&&e[a].x-e[a-1].x<t;)a+=1;if(a-n===1)r.push({type:"item",mark:e[n]});else{const t=e.slice(n,a),l=new Set(t.map(e=>e.kind));r.push({type:"cluster",kind:1===l.size?t[0].kind:Ci,members:t})}n=a}return r}($e),De=e=>"cluster"===e.type?`fold-${e.members[0].key}`:e.mark.key,Pe=/* @__PURE__ */new Map;for(const e of Se)if("cluster"===e.type)for(const t of e.members)Pe.set(t.key,De(e));const Ae=q??U??Y,je=Le.find(e=>"cluster"===e.type&&(e=>"cluster"===e.type?`cluster-${e.members[0].key}`:e.mark.key)(e)===Ae)??Se.find(e=>"cluster"===e.type&&De(e)===Ae),Te=e=>({x:e.baseX,widthPx:e.widthPx}),Oe=je&&"cluster"===je.type?je.members.map(Te):f?$e.filter(e=>e.ms>=f[0]&&e.ms<=f[1]).map(Te):[],Re=Oe.length>1?Wi(ge,Oe,ce):ge,We=Re!==ge;if(We)for(const e of $e)e.isCap||(e.x=Re.xByMs(e.ms));const Ke=$e.some(e=>e.x<14),_e=We&&je?Ae:null,qe=e=>({key:e.key,mark:e,members:[e],x:e.x,kind:e.kind,openable:!1}),He=ne?$e.map(qe):Se.flatMap(e=>{if("item"===e.type)return[qe(e.mark)];const t=De(e);if(t===_e&&(r=e.members).every((e,t)=>0===t||e.x-r[t-1].x>=16))return e.members.map(qe);var r;const n=e.members.map(e=>e.x);return[{key:t,mark:null,members:e.members,x:n.reduce((e,t)=>e+t,0)/n.length,kind:e.kind,openable:new Set(e.members.map(e=>e.ms)).size>1}]}),Ue=/* @__PURE__ */new Map;for(const e of He)for(const t of e.members)Ue.set(t.key,e.key);const Ve=Se.find(e=>"cluster"===e.type&&De(e)===_e),Ze=Ve&&"cluster"===Ve.type?{from:Math.min(...Ve.members.map(e=>e.x))-16,to:Math.max(...Ve.members.map(e=>e.x))+16}:null,Je=Be(_e),[Qe,et]=Ee(!1);Ie(()=>{if(Je.current===_e)return;Je.current=_e,et(!0);const e=setTimeout(()=>et(!1),240);return()=>clearTimeout(e)},[_e]);const tt=$e.map(e=>`${e.key} ${e.label} ${e.dateText}`).join("|");Oi(()=>{const e=j.current;if(!e)return;const t={};for(const r of Array.from(e.children)){const e=r.dataset.laneKey,n=r.getBoundingClientRect().width;e&&n>0&&(t[e]=n)}O(e=>function(e,t){const r=Object.keys(e);return r.length===Object.keys(t).length&&r.every(r=>Math.abs((e[r]??0)-(t[r]??0))<.5)}(e,t)?e:t)},[tt]);const rt=`${s}|${r}|${$e.map(e=>`${e.key}@${e.ms}`).join("|")}`,[nt,at]=Ee(rt),lt=b&&nt===rt;Ie(()=>{nt!==rt&&at(rt)},[nt,rt]);const it=Math.min(28,340/Math.max(1,$e.length-1)),ot=Ki(u?.stops),st=r=>{const n=Math.min(Math.max(r,e),t);if(!ot)return n;let a=ot[0];for(const e of ot)Math.abs(e-n)<Math.abs(a-n)&&(a=e);return a},ct=u?st(u.valueMs):null,dt=h&&u?ve.filter(e=>!ot||ot.includes(e.ms)).map(e=>({key:e.key,ms:e.ms})):[],ut=function(e,t,r={}){const n=Number.isFinite(r.speed)&&(r.speed??0)>0?r.speed:1,a=Math.max(0,r.dwellMs??700)/n,l=t.filter(e=>Number.isFinite(e.ms)).slice().sort((e,t)=>e.ms-t.ms),i=[];for(let t=0;t+1<l.length;t++){const o=l[t],s=l[t+1],c=e.xByMs(o.ms),d=e.xByMs(s.ms),u=Math.max(0,d-c),h=u<=.5||r.reducedMotion?0:Si(350*u/100,450,1400)/n;i.push({fromKey:o.key,toKey:s.key,fromMs:o.ms,toMs:s.ms,fromPx:c,toPx:d,lengthPx:u,durationMs:h,dwellMs:a,msByPx:e.msByPx})}return i}(Re,dt,{speed:h?.speed,reducedMotion:$}),[ht,mt]=Ee(null),pt=Be(null),gt=Be({segments:ut,value:ct,playback:h});Ie(()=>{gt.current={segments:ut,value:ct,playback:h}});const ft=Be(null),bt=Fe(e=>{null===e&&null===ft.current||(ft.current=e,gt.current.playback?.onProgress?.(e))},[]),xt=Fe(()=>{pt.current=null,mt(null),bt(null),gt.current.playback?.onStop?.()},[bt]),yt=!!h?.playing&&!!u;Ie(()=>{if(!yt)return;const e=gt.current,t=null===e.value?-1:e.segments.findIndex(t=>t.fromMs===e.value);if(t<0)return void xt();pt.current&&pt.current.index===t||(pt.current={index:t,phase:"rest",t:0,restLeftMs:e.segments[t].dwellMs,sinceMs:null});let r,n=0;const a=e=>mt(t=>t&&t.px===e.px&&t.ms===e.ms?t:e),l=()=>{clearTimeout(r);const e=pt.current;"rest"===e?.phase&&(r=setTimeout(i,Math.max(0,e.restLeftMs)))},i=()=>{const e=pt.current;if("rest"!==e?.phase)return;const t=gt.current.segments[e.index];t?(pt.current={index:e.index,phase:"glide",t:0,restLeftMs:0,sinceMs:null},a(Pi(t,0))):xt()},o=e=>{const t=gt.current,r=pt.current;if(!r)return;const i=function(e,t,r){const n=e[t.index];if(!n)return{cursor:null,at:null,arrived:null,progress:null};const a=null===t.sinceMs?0:Math.max(0,r-t.sinceMs);if("rest"===t.phase){const e=t.restLeftMs-a;return e>0?{cursor:{...t,restLeftMs:e,sinceMs:r},at:Pi(n,0),arrived:null,progress:null}:{cursor:{index:t.index,phase:"glide",t:0,restLeftMs:0,sinceMs:r},at:Pi(n,0),arrived:null,progress:null}}const l=n.durationMs>0?Math.min(1,t.t+a/n.durationMs):1,i=Pi(n,l);if(l<1)return{cursor:{...t,t:l,sinceMs:r},at:i,arrived:null,progress:{fromKey:n.fromKey,toKey:n.toKey,t:Di(l),ms:i.ms}};const o=e[t.index+1];return{cursor:o?{index:t.index+1,phase:"rest",t:0,restLeftMs:o.dwellMs,sinceMs:r}:null,at:i,arrived:{key:n.toKey,ms:n.toMs},progress:null}}(t.segments,r,e);pt.current=i.cursor,i.at&&a(i.at),bt(i.progress),i.arrived&&t.playback?.onArrive(i.arrived.key,i.arrived.ms),i.cursor?(i.cursor.phase===r.phase&&i.cursor.index===r.index||l(),n=requestAnimationFrame(o)):xt()};return l(),n=requestAnimationFrame(o),()=>{cancelAnimationFrame(n),clearTimeout(r),pt.current&&(pt.current.sinceMs=null,bt(null))}},[yt,xt,bt]);const vt=ve.filter(e=>!e.provisional),wt=u?ht?ht.ms:ct:void 0!==i?i:vt.length>0?null===M?vt[vt.length-1].ms:Math.min(vt[vt.length-1].ms,M):null,Nt=new Set(y??[]),kt=$e.filter(e=>Nt.has(e.key)).map(e=>e.x),$t=kt.length>0?{from:Math.min(...kt),to:Math.max(...kt)}:null,Mt=Fe(()=>{clearTimeout(E.current),clearTimeout(B.current),W(null),_(null),H(null),V(null),G(null)},[]);Ie(()=>()=>{clearTimeout(E.current),clearTimeout(B.current)},[]),Ie(()=>{const e=T.current;e&&(T.current=null,F.current.get(e)?.focus())});const Ct=null!==K||null!==q||null!==U||null!==Y;Ie(()=>{if(Ct)return Q(e=>"Escape"===e.key&&(Mt(),!0))},[Ct,Mt]);const Lt=Fe((e,t)=>{if(!e)return;const r=e.offsetWidth/2;let n=r>0?Math.max(r,Math.min(t,ie-r)):t;const a=e.parentElement;if(r>0&&a){const t=L(e),l=a.getBoundingClientRect().left,i=t.left+8+r-l,o=t.right-8-r-l;i<=o&&(n=Math.max(i,Math.min(n,o)))}e.style.left=`${n}px`,e.style.setProperty("--rosh-tl-arrow",`${r+(t-n)}px`)},[ie]),St=He.find(e=>e.key===K)??null,Dt=St?St.x:0;Oi(()=>{Lt(z.current,Dt)},[Lt,K,Dt]);const Pt=ct??void 0,At=Be(null);Ie(()=>{if(void 0===Pt)return;const e=Re.xByMs(Pt),t=At.current;if(At.current=e,null===t||e<=t)return;const r=[];for(const n of $e){if(n.x<=t||n.x>e)continue;const a=F.current.get(Ue.get(n.key)??n.key);a&&(a.classList.add("is-hit"),r.push(setTimeout(()=>a.classList.remove("is-hit"),460)))}return()=>{for(const e of r)clearTimeout(e)}},[Pt]);const jt=He.map(e=>e.key),zt=ye?Ue.get(ye)??null:null,Ft=X&&jt.includes(X)?X:zt&&jt.includes(zt)?zt:jt[0],Et=e=>{const t=jt.indexOf(e.target.dataset?.timelineKey??"");if(t<0)return;const r="ArrowRight"===e.key||"ArrowDown"===e.key?t+1:"ArrowLeft"===e.key||"ArrowUp"===e.key?t-1:"Home"===e.key?0:"End"===e.key?jt.length-1:-1;r<0||r>jt.length-1||(e.preventDefault(),Z(jt[r]),F.current.get(jt[r])?.focus())},Bt=()=>clearTimeout(B.current),Tt=e=>{Bt(),G(e)},It=()=>{clearTimeout(B.current),B.current=setTimeout(()=>G(null),260)},Ot=e=>{_e&&Pe.get(e)===_e?Bt():(Bt(),G(null))},Rt=e=>{clearTimeout(E.current),W(e),_(e),v?.((e=>{const t=He.find(t=>t.key===e);return t?.members[0]?.key??e})(e))},Wt=e=>{W(t=>t===e?null:t),clearTimeout(E.current),E.current=setTimeout(()=>_(t=>t===e?null:t),160),v?.(null)},Kt=e=>({type:"button","data-timeline-node":e.isCap?"cap":e.isItem?"item":"marker","data-timeline-key":e.key,"aria-label":Ii(e),"aria-describedby":K===e.key?J:void 0,tabIndex:e.key===Ft?0:-1,ref:t=>{t?F.current.set(e.key,t):F.current.delete(e.key)},onMouseEnter:()=>{Ot(e.key),Rt(e.key)},onMouseLeave:()=>{It(),Wt(e.key)},onFocus:()=>{Ot(e.key),Rt(e.key),Z(e.key)},onBlur:()=>{It(),Wt(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),e.onClick?.(),e.isItem&&d?.(e.key)}}),_t=e=>{return{type:"button","data-timeline-node":"fold","data-timeline-key":e.key,"data-timeline-count":String(e.members.length),"aria-label":(t=e.members,r=S,r.events(t.length,t.map(Ii))),"aria-describedby":K===e.key?J:void 0,tabIndex:e.key===Ft?0:-1,ref:t=>{t?F.current.set(e.key,t):F.current.delete(e.key)},onMouseEnter:()=>{e.openable?Tt(e.key):Rt(e.key)},onMouseLeave:()=>{It(),Wt(e.key)},onFocus:()=>{Bt(),Rt(e.key),Z(e.key)},onBlur:()=>{It(),Wt(e.key)},onPointerDown:e=>e.stopPropagation(),onClick:t=>{if(t.stopPropagation(),!e.openable)return void Rt(e.key);Tt(e.key);const r=e.members[0];Z(r.key),T.current=r.key}};var t,r},qt="lanes"!==s||$e.length>1;if(ne)/* @__PURE__ */
413
+ return Ye("div",{ref:C,children:/* @__PURE__ */Ye(Ui,{marks:$e.filter(e=>!e.isCap),pending:l,currentKey:ye,todayMs:M,reveal:lt,ariaLabel:x,step:it,nodeProps:Kt,onKeyDown:Et})});const Ht=(e,t)=>null==e||!1===e?null:/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"rosh-tl-flank"+(t?" is-end":""),"data-timeline-part":t?"end-caption":"start-caption",style:{paddingTop:oe.rail-3+"px"},children:e});/* @__PURE__ */
414
414
  return Ge("div",{ref:C,className:"rosh-tl-body"+(l.length>0&&!N?"":" is-solo"),children:[
415
- /* @__PURE__ */Ge("div",{className:"flex items-stretch gap-3",children:[N&&_t(Me,!1),
416
- /* @__PURE__ */Ye("div",{className:"rosh-tl-stage",style:{height:`${to(oe,Ht,p.length>0&&!N)}px`},children:/* @__PURE__ */Ge("div",{ref:A,className:`rosh-tl-layer${Qe?" is-zooming":""}${ht?" is-gliding":""}`,onMouseMove:e=>{if(!Ze)return;const t=A.current?.getBoundingClientRect();if(!t)return;const r=e.clientX-t.left;r>=Ze.from&&r<=Ze.to?Bt():It()},onMouseLeave:It,children:[!N&&/* @__PURE__ */Ye(qi,{marks:$e,innerRef:z}),
415
+ /* @__PURE__ */Ge("div",{className:"flex items-stretch gap-3",children:[N&&Ht(Me,!1),
416
+ /* @__PURE__ */Ye("div",{className:"rosh-tl-stage",style:{height:`${to(oe,qt,p.length>0&&!N)}px`},children:/* @__PURE__ */Ge("div",{ref:A,className:`rosh-tl-layer${Qe?" is-zooming":""}${ht?" is-gliding":""}`,onMouseMove:e=>{if(!Ze)return;const t=A.current?.getBoundingClientRect();if(!t)return;const r=e.clientX-t.left;r>=Ze.from&&r<=Ze.to?Bt():It()},onMouseLeave:It,children:[!N&&/* @__PURE__ */Ye(_i,{marks:$e,innerRef:j}),
417
417
  /* @__PURE__ */Ye(Vi,{axis:Re,geo:oe,fillTo:wt,reveal:lt,trackPx:ce,tweened:!!u}),se&&
418
418
  /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-tail","data-timeline-part":"tail",style:{left:`${ce}px`,width:ie-ce+"px",top:oe.rail+3-1+"px"}}),$t&&/* @__PURE__ */Ye("div",{"aria-hidden":"true",className:"rosh-tl-band","data-timeline-part":"highlight",style:{left:$t.from-10+"px",width:$t.to-$t.from+20+"px",top:oe.rail-7+"px",height:"20px"}}),
419
- /* @__PURE__ */Ye(Hi,{startMs:e,endMs:t,axis:Re,geo:oe,reveal:lt}),
420
- /* @__PURE__ */Ye(Yi,{geo:oe,caption:N?null:Me,endCaption:N?null:m?.end,around:Ke,reveal:lt,trackPx:ie}),N&&/* @__PURE__ */Ye(Xi,{nodes:_e,geo:oe,reveal:lt}),null!==M&&M>e&&M<=t+ai&&/* @__PURE__ */Ye(Gi,{x:Re.xByMs(Math.min(M,t)),geo:oe,trackPx:ie,label:P(M),reveal:lt}),!N&&p.map(e=>/* @__PURE__ */Ye(Zi,{phase:e,geo:oe,xOf:Re.xByMs},e.key)),
421
- /* @__PURE__ */Ye("ol",{className:"rosh-tl-nodes","aria-label":x,onKeyDown:Et,children:_e.map((e,t)=>{const r=t=>null!==t&&e.members.some(e=>e.key===t),n=`${oe.rail+3}px`,a=lt?xi(t,it):{},l=(e=>!!$t&&e.x>=$t.from-.5&&e.x<=$t.to+.5)(e)?" is-lit":"";if(e.mark?.isCap)/* @__PURE__ */
419
+ /* @__PURE__ */Ye(qi,{startMs:e,endMs:t,axis:Re,geo:oe,reveal:lt}),
420
+ /* @__PURE__ */Ye(Yi,{geo:oe,caption:N?null:Me,endCaption:N?null:m?.end,around:Ke,reveal:lt,trackPx:ie}),N&&/* @__PURE__ */Ye(Xi,{nodes:He,geo:oe,reveal:lt}),null!==M&&M>e&&M<=t+ai&&/* @__PURE__ */Ye(Gi,{x:Re.xByMs(Math.min(M,t)),geo:oe,trackPx:ie,label:P(M),reveal:lt}),!N&&p.map(e=>/* @__PURE__ */Ye(Zi,{phase:e,geo:oe,xOf:Re.xByMs},e.key)),
421
+ /* @__PURE__ */Ye("ol",{className:"rosh-tl-nodes","aria-label":x,onKeyDown:Et,children:He.map((e,t)=>{const r=t=>null!==t&&e.members.some(e=>e.key===t),n=`${oe.rail+3}px`,a=lt?xi(t,it):{},l=(e=>!!$t&&e.x>=$t.from-.5&&e.x<=$t.to+.5)(e)?" is-lit":"";if(e.mark?.isCap)/* @__PURE__ */
422
422
  return Ye("li",{children:/* @__PURE__ */Ye("button",{...Kt(e.mark),className:`rosh-tl-node rosh-tl-mark is-cap${l}${lt?" rosh-tl-pop":""}`,style:{left:`${e.x}px`,top:n,...a}})},e.key);if(!e.mark){const t=e.kind===Ci,i=Ti(t?"default":e.kind,"key"),o=t?void 0:Fi[e.kind]?.glyph;/* @__PURE__ */
423
423
  return Ge("li",{...r(ye)?{"aria-current":"step"}:{},children:[
424
- /* @__PURE__ */Ge("button",{...qt(e),className:`${i.className} is-fold${t?" is-mixed":""}${r(c)?" is-active":""}${l}${lt?" rosh-tl-pop":""}`,style:{...i.style,left:`${e.x}px`,top:n,...a},children:[o&&/* @__PURE__ */Ye(vi,{name:o}),t&&/* @__PURE__ */Ge("span",{"aria-hidden":"true",className:"rosh-tl-foldnum",children:["×",e.members.length]})]}),!t&&/* @__PURE__ */Ge("i",{"aria-hidden":"true",className:"rosh-tl-count"+(lt?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:n},children:["×",e.members.length]})]},e.key)}const i=e.mark,o=Ti(i.kind,i.role,i.provisional),{glyph:s}=i;/* @__PURE__ */
425
- return Ye("li",{...i.key===ye?{"aria-current":"step"}:{},children:/* @__PURE__ */Ge("button",{...Kt(i),className:`${o.className}${i.key===c?" is-active":""}${l}${lt?" rosh-tl-pop":""}`,style:{...o.style,left:`${i.x}px`,top:n,...a},children:[s&&/* @__PURE__ */Ye(vi,{name:s}),"current"===i.role&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"rosh-tl-pulse bg-blue-600"+(lt?" is-on":"")})]})},i.key)})}),"lanes"===s?/* @__PURE__ */Ye(Qi,{groups:Le,trackPx:ie,geo:oe,startMs:e,endMs:t,currentKey:ye,hoveredKey:R,reveal:lt,step:it,zoomedKey:qe,popId:ee,aimBubble:Lt,startCaptionPx:Ce,openCluster:H,setOpenCluster:_,previewCluster:U,setPreviewCluster:V,setZoomKey:G}):"active"===s?/* @__PURE__ */Ye(Ji,{nodes:_e,trackPx:ie,geo:oe,activeKey:c,hoveredKey:R,currentKey:ye}):null,St&&/* @__PURE__ */Ye("div",{ref:j,id:J,role:"tooltip",className:"rosh-tl-bubble"+(St.members.some(e=>e.preview)?" is-preview":""),"data-timeline-part":"tooltip",style:{top:`${oe.rail+6+6}px`},onMouseEnter:()=>{Bt(),Rt(St.key)},onMouseLeave:()=>{It(),Wt(St.key)},onFocus:()=>{Bt(),Rt(St.key)},onBlur:()=>{It(),Wt(St.key)},children:St.mark?/* @__PURE__ */Ge(Xe,{children:[
424
+ /* @__PURE__ */Ge("button",{..._t(e),className:`${i.className} is-fold${t?" is-mixed":""}${r(c)?" is-active":""}${l}${lt?" rosh-tl-pop":""}`,style:{...i.style,left:`${e.x}px`,top:n,...a},children:[o&&/* @__PURE__ */Ye(vi,{name:o}),t&&/* @__PURE__ */Ge("span",{"aria-hidden":"true",className:"rosh-tl-foldnum",children:["×",e.members.length]})]}),!t&&/* @__PURE__ */Ge("i",{"aria-hidden":"true",className:"rosh-tl-count"+(lt?" rosh-tl-fade":""),style:{left:`${e.x}px`,top:n},children:["×",e.members.length]})]},e.key)}const i=e.mark,o=Ti(i.kind,i.role,i.provisional),{glyph:s}=i;/* @__PURE__ */
425
+ return Ye("li",{...i.key===ye?{"aria-current":"step"}:{},children:/* @__PURE__ */Ge("button",{...Kt(i),className:`${o.className}${i.key===c?" is-active":""}${l}${lt?" rosh-tl-pop":""}`,style:{...o.style,left:`${i.x}px`,top:n,...a},children:[s&&/* @__PURE__ */Ye(vi,{name:s}),"current"===i.role&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"rosh-tl-pulse bg-blue-600"+(lt?" is-on":"")})]})},i.key)})}),"lanes"===s?/* @__PURE__ */Ye(Qi,{groups:Le,trackPx:ie,geo:oe,startMs:e,endMs:t,currentKey:ye,hoveredKey:R,reveal:lt,step:it,zoomedKey:_e,popId:ee,aimBubble:Lt,startCaptionPx:Ce,openCluster:q,setOpenCluster:H,previewCluster:U,setPreviewCluster:V,setZoomKey:G}):"active"===s?/* @__PURE__ */Ye(Ji,{nodes:He,trackPx:ie,geo:oe,activeKey:c,hoveredKey:R,currentKey:ye}):null,St&&/* @__PURE__ */Ye("div",{ref:z,id:J,role:"tooltip",className:"rosh-tl-bubble"+(St.members.some(e=>e.preview)?" is-preview":""),"data-timeline-part":"tooltip",style:{top:`${oe.rail+6+6}px`},onMouseEnter:()=>{Bt(),Rt(St.key)},onMouseLeave:()=>{It(),Wt(St.key)},onFocus:()=>{Bt(),Rt(St.key)},onBlur:()=>{It(),Wt(St.key)},children:St.mark?/* @__PURE__ */Ge(Xe,{children:[
426
426
  /* @__PURE__ */Ye("span",{className:"rosh-tl-name",children:St.mark.label}),
427
427
  /* @__PURE__ */Ye("span",{className:"rosh-tl-date",children:St.mark.dateText}),St.mark.preview?/* @__PURE__ */Ye("div",{className:"rosh-tl-preview","data-timeline-part":"preview",children:St.mark.preview}):St.mark.detail&&/* @__PURE__ */Ye("span",{className:"rosh-tl-detail",children:St.mark.detail}),(St.mark.onOpen??St.mark.onClick)&&/* @__PURE__ */Ye("button",{type:"button",className:"rosh-tl-bubble-open text-blue-600","data-timeline-part":"bubble-open",onClick:()=>(St.mark?.onOpen??St.mark?.onClick)?.(),children:S.openButton})]}):
428
428
  /* @__PURE__ */Ge("div",{className:"rosh-tl-fold-list","data-timeline-part":"fold-members",children:[
@@ -431,14 +431,14 @@ return Ye("li",{...i.key===ye?{"aria-current":"step"}:{},children:/* @__PURE__ *
431
431
  /* @__PURE__ */Ge("p",{className:"rosh-tl-foldrow",children:[
432
432
  /* @__PURE__ */Ye("span",{children:e.label}),
433
433
  /* @__PURE__ */Ye("span",{className:"rosh-tl-date",children:e.dateText})]}),e.preview?/* @__PURE__ */Ye("div",{className:"rosh-tl-preview","data-timeline-part":"preview",children:e.preview}):e.detail&&/* @__PURE__ */Ye("span",{className:"rosh-tl-detail",children:e.detail})]},e.key))})]})}),u&&null!==ct&&
434
- /* @__PURE__ */Ye(eo,{thumb:u,value:ct,snap:st,axis:Re,geo:oe,startMs:e,endMs:t,trackPx:ie,layerRef:A,glide:ht,onScrub:h?xt:void 0,nodes:dt,onProgress:bt})]})}),N&&_t(m?.end,!0)]}),l.length>0&&!N&&/* @__PURE__ */Ye(_i,{pending:l,reveal:lt})]})}function no({icon:e,heading:t,subject:r,meta:n=[],actions:a,footer:l,children:i}){const o=[...r?[/* @__PURE__ */Ye("b",{children:r},"subject")]:[],...n.filter(e=>null!=e&&!1!==e&&""!==e)];/* @__PURE__ */
434
+ /* @__PURE__ */Ye(eo,{thumb:u,value:ct,snap:st,axis:Re,geo:oe,startMs:e,endMs:t,trackPx:ie,layerRef:A,glide:ht,onScrub:h?xt:void 0,nodes:dt,onProgress:bt})]})}),N&&Ht(m?.end,!0)]}),l.length>0&&!N&&/* @__PURE__ */Ye(Hi,{pending:l,reveal:lt})]})}function no({icon:e,heading:t,subject:r,meta:n=[],actions:a,footer:l,children:i}){const o=[...r?[/* @__PURE__ */Ye("b",{children:r},"subject")]:[],...n.filter(e=>null!=e&&!1!==e&&""!==e)];/* @__PURE__ */
435
435
  return Ge("section",{className:"rosh-tl-card border-gray-200 bg-gray-50",children:[
436
436
  /* @__PURE__ */Ge("div",{className:"rosh-tl-head",children:[
437
437
  /* @__PURE__ */Ge("div",{className:"rosh-tl-head-main text-gray-800",children:[e&&/* @__PURE__ */Ye("span",{className:"rosh-tl-ico","aria-hidden":"true",children:e}),
438
438
  /* @__PURE__ */Ye("h4",{className:"rosh-tl-title",children:t}),o.length>0&&/* @__PURE__ */Ye("p",{className:"rosh-tl-meta text-gray-500",children:o.map((e,t)=>
439
- /* @__PURE__ */Ge(He,{children:[t>0&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",children:" · "}),e]},t))})]}),a&&/* @__PURE__ */Ye("span",{className:"rosh-tl-head-actions",children:a})]}),i,l&&/* @__PURE__ */Ye("div",{className:"rosh-tl-foot border-gray-200",children:l})]})}function ao({title:e,heading:t,subject:r,milestones:n,summary:a,endDate:l,phaseLabels:i,variant:o="card",edgeCaptions:s,highlightKeys:c=null,onHoverChange:d}){const u=le(Date.now,null),h=[],m=[],p=he().timeline,g=ue();for(const e of n){const t=li(e.date??null);null===t?m.push({key:e.key,label:e.label,kind:e.kind}):h.push({...e,ms:t})}h.sort((e,t)=>e.ms-t.ms);const f=li(l??null);let b,x,y=!0;0===h.length?(x=f??u??0,b=x-30*ai,y=null!==f||null!==u):(b=h[0].ms,x=f??h[h.length-1].ms,x-b<ai&&(x=b+ai));const v=h.length>0?Math.max(0,Math.round((x-b)/ai)):0,w=a??(v>0?p.duration(v):void 0),N=[h.length>0?p.started(ii(h[0].ms,g)):void 0,w,m.length>0?p.reached(h.length,n.length):void 0],k=h.map(e=>{return{key:e.key,ms:e.ms,kind:e.kind,label:e.label,detail:e.detail,preview:e.preview,glyph:e.glyph,onClick:e.onClick,onOpen:e.onOpen,priority:(t=e.kind,"dfm"===t?1:0),caption:e.caption,provisional:e.provisional};var t}),$={};for(const e of h)e.phase&&($[e.phase]=$[e.phase]||[]).push(e.ms);const M=Object.entries($).filter(([,e])=>e.length>=2).map(([e,t])=>({key:e,label:i?.[e]??e,minMs:Math.min(...t),maxMs:Math.max(...t)})),C="rail"===o,L=y&&/* @__PURE__ */Ye("div",{className:"select-none",children:/* @__PURE__ */Ye(ro,{axis:C?"spread":"compressed",labels:C?"none":"lanes",items:k,pending:m,phases:M,startMs:b,endMs:x,todayMs:u??void 0,edgeCaptions:s,highlightKeys:c,onHoverChange:d,ariaLabel:p.milestones(e)})});/* @__PURE__ */
440
- return Ye("div",C?{className:"shrink-0","data-timeline-variant":"rail",children:L}:{className:"shrink-0",children:/* @__PURE__ */Ye(no,{icon:/* @__PURE__ */Ye(wi,{}),heading:t??e,subject:r,meta:N,children:L})})}var lo=/* @__PURE__ */new Set(["finished","partial_shipped","shipped","completed","cancelled"]),io=[{key:"casting",label:"Casting",weight:.2},{key:"cnc",label:"CNC",weight:.2},{key:"painting",label:"Painting",weight:.5},{key:"packing",label:"Packing",weight:.1},{key:"finished_goods",label:"FG",weight:0},{key:"stock_qty",label:"Stock",weight:0}];function oo(e){if(e.order_qty<=0)return 0;let t=0;for(const r of io)if(r.weight>0){t+=Math.min((e[r.key]||0)/e.order_qty,1)*r.weight}return 100*t}function so(e){const t=e?.items??[];return 0===t.length?0:t.reduce((e,t)=>e+oo(t),0)/t.length}function co(e){const{reports:t,poProductionStartDate:r,poEstCompletionDate:n,poStatus:a,poNumber:l="",currentReportId:i,currentReportDate:o,msPerDayOfPlayback:s=500,markers:c=[]}=e,[d,u]=Ee(null),h=he().production;Ie(()=>{o?u(new Date(o).getTime()):t.length>0&&u(new Date(t[0].date).getTime())},[i]);const[m,p]=Ee(!1),g=Be(null),f=()=>{null!=g.current&&(cancelAnimationFrame(g.current),g.current=null),p(!1)};Ie(()=>()=>f(),[]),Ie(()=>{f()},[i]);const b=t.map(e=>li(e.date)).filter(e=>null!=e),x=le(Date.now,null)??Math.max(0,...b,...c.map(e=>li(e.date)??0),li(r??null)??0,li(n??null)??0),y=b.length?Math.min(...b):x,v=b.length?Math.max(...b):x,w=li(r??null)??y,N=li(n??null)??0,k=lo.has((a||"").toLowerCase()),$=c.reduce((e,t)=>{const r=li(t.date);return null!=r&&r>e?r:e},0),M=(()=>{const e=[N,v,$,w+ai];return k||e.push(x),Math.max(...e)})(),C=Math.max(1,Math.round((M-w)/ai)),L=li(o??null)??v??w,S=Math.min(Math.max(d??L,w),M),D=t.find(e=>{const t=li(e.date);return null!=t&&t<=S})??null;let P=null;for(let e=t.length-1;e>=0;e--){const r=li(t[e].date);if(null!=r&&r>S){P=t[e];break}}const A=(()=>{if(D||!P||0===t.length)return null;const e=(t[t.length-1].items??[]).map((e,t)=>({id:`zero-${e.part_number}-${t}`,part_number:e.part_number,description:e.description??"",order_qty:Number(e.order_qty||0),casting:0,cnc:0,painting:0,packing:0,finished_goods:0,stock_qty:0}));return{id:`zero-${l}`,progress_number:h.start,date:r||new Date(w).toISOString().slice(0,10),items:e,est_completion_date:n??null,created_by_name:"",notes:""}})(),z=D??A,j=D?li(D.date):A?w:null,F=P?li(P.date):null,E=!!(z&&P&&null!=j&&null!=F&&S>j&&S<F);let B,T;if(E&&null!=j&&null!=F){const e=(S-j)/Math.max(F-j,1),t=(t,r)=>Math.round(t+(r-t)*e),r={};for(const e of z?.items??[])r[e.part_number]=e;const n={};for(const e of P?.items??[])n[e.part_number]=e;const a=Array.from(/* @__PURE__ */new Set([...Object.keys(r),...Object.keys(n)])).map((e,a)=>{const l=r[e]??{},i=n[e]??{},o=e=>Number(e)||0;return{id:`interp-${e}-${a}`,part_number:e,description:l.description??i.description??"",order_qty:o(l.order_qty??i.order_qty??0),casting:t(o(l.casting),o(i.casting)),cnc:t(o(l.cnc),o(i.cnc)),painting:t(o(l.painting),o(i.painting)),packing:t(o(l.packing),o(i.packing)),finished_goods:t(o(l.finished_goods),o(i.finished_goods)),stock_qty:t(o(l.stock_qty),o(i.stock_qty))}}),l=li(z?.est_completion_date),i=li(P?.est_completion_date);let o;o=null!=l&&null!=i?new Date(Math.round(l+(i-l)*e)).toISOString().slice(0,10):z?.est_completion_date||P?.est_completion_date||null,B={id:`interp-${S}`,progress_number:h.estimated,date:new Date(S).toISOString().slice(0,10),created_by_name:"",est_completion_date:o,items:a,notes:""},T=z}else if(B=z??t[t.length-1]??null,B){const e=t.findIndex(e=>e.id===B.id);T=e>=0&&e<t.length-1?t[e+1]:null}else T=null;const I={};for(const e of T?.items??[])I[e.part_number]=e;const O=!(!i||B?.id===i),R=i?Math.min(li(o??null)??M,M):M,W=i?t.find(e=>e.id===i)?.progress_number:void 0;return{startMs:w,endMs:M,totalLeadDays:C,scrubMs:S,setScrubMs:e=>{f(),u(e)},resetToCurrent:()=>{f(),o&&u(new Date(o).getTime())},scrubbedAway:O,beforeAnchor:z,nextAfter:P,displayed:B,prevReport:T,prevByPN:I,isInterpolated:E,playing:m,startPlay:()=>{if(m)return void f();if(R<=w)return void u(R);p(!0),u(w);let e=performance.now(),t=w;const r=n=>{const a=n-e;if(e=n,t+=a/s*ai,t>=R)return u(R),g.current=null,void p(!1);u(t),g.current=requestAnimationFrame(r)};g.current=requestAnimationFrame(r)},stopPlay:f,reports:t,markers:c,poNumber:l,currentReportId:i,currentReportProgressNumber:W,estCompletionMs:li(n??null)}}function uo({startMs:e,endMs:t,reports:r,markers:n,valueMs:a,activeId:l,onChange:i,onPickReport:o,onOpenReport:s,onOpenMarker:c,onDragStart:d,renderReportPreview:u,reportLabel:h,playback:m,edgeCaptions:p,bare:g=!1,endMark:f=null}){const b=he().production,x=ue(),y=r.map(e=>({report:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)).sort((e,t)=>e.ms-t.ms),v=y.map(({report:e,ms:t})=>({key:e.id,ms:t,kind:"report",label:h(e),preview:e.preview??u?.(e),onOpen:s?()=>s(e.id):void 0})),w=new Map(y.map(({report:e,ms:t})=>[e.id,t])),N=y.map(({ms:e})=>e),k=c?n.map(e=>({...e,onOpen:c})):n;/* @__PURE__ */
441
- return Ye("div",{className:"select-none",children:/* @__PURE__ */Ye(ro,{axis:g?"spread":"linear",labels:g?"none":"active",endMark:g?f:null,items:v,markers:k,startMs:e,endMs:t,activeKey:l,onActivate:e=>{const t=w.get(e);null!=t&&i(t),o(e)},playback:m,edgeCaptions:p,thumb:{valueMs:a,onChange:i,onDragStart:d,stops:N,ariaLabel:b.scrub,valueText:e=>{const t=(e=>y.find(t=>t.ms===e)?.report)(e);return t?`${h(t)} · ${ii(e,x)}`:ii(e,x)}},ariaLabel:b.label(ii(e,x),ii(t,x))})})}function ho({snapshot:e,onPickReport:t,onOpenReport:r,onOpenMarker:n,renderReportPreview:a,onScrubProgress:l,heading:i,edgeCaptions:o,reportLabel:s=e=>e.progress_number,resetLabel:c,variant:d="card",onPlayStart:u}){const{reports:h,markers:m,poNumber:p,startMs:g,endMs:f,totalLeadDays:b,scrubMs:x,setScrubMs:y,displayed:v,scrubbedAway:w,resetToCurrent:N,currentReportId:k,currentReportProgressNumber:$,estCompletionMs:M}=e,C=function(e,t,r){const[n,a]=Ee(!1),l=Be(!1);return{playing:n,toggle:()=>{n?a(!1):0!==e.length&&(r?.(),l.current||(l.current=!0,t(e[0])),a(!0))},stop:()=>{l.current=!1,a(!1)}}}(h.map(e=>li(e.date)).filter(e=>null!=e).sort((e,t)=>e-t),y,u),L=he().production,S=ue(),D=i??L.heading,P=e=>ii(e,S);if(0===h.length&&0===m.length)return null;const A=m.filter(e=>"shipment"===e.kind),z=m.filter(e=>"inspection"===e.kind),j=m.filter(e=>"invoice"===e.kind),F=(v?.items??[]).reduce((e,t)=>e+(Number(t.stock_qty)||0),0),E=v?so(v):0,B=h.find(e=>e.id===k),T=B?s(B):$,I=
439
+ /* @__PURE__ */Ge(qe,{children:[t>0&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",children:" · "}),e]},t))})]}),a&&/* @__PURE__ */Ye("span",{className:"rosh-tl-head-actions",children:a})]}),i,l&&/* @__PURE__ */Ye("div",{className:"rosh-tl-foot border-gray-200",children:l})]})}function ao({title:e,heading:t,subject:r,milestones:n,summary:a,endDate:l,phaseLabels:i,variant:o="card",edgeCaptions:s,highlightKeys:c=null,onHoverChange:d}){const u=le(Date.now,null),h=[],m=[],p=he().timeline,g=ue();for(const e of n){const t=li(e.date??null);null===t?m.push({key:e.key,label:e.label,kind:e.kind}):h.push({...e,ms:t})}h.sort((e,t)=>e.ms-t.ms);const f=li(l??null);let b,x,y=!0;0===h.length?(x=f??u??0,b=x-30*ai,y=null!==f||null!==u):(b=h[0].ms,x=f??h[h.length-1].ms,x-b<ai&&(x=b+ai));const v=h.length>0?Math.max(0,Math.round((x-b)/ai)):0,w=a??(v>0?p.duration(v):void 0),N=[h.length>0?p.started(ii(h[0].ms,g)):void 0,w,m.length>0?p.reached(h.length,n.length):void 0],k=h.map(e=>{return{key:e.key,ms:e.ms,kind:e.kind,label:e.label,detail:e.detail,preview:e.preview,glyph:e.glyph,onClick:e.onClick,onOpen:e.onOpen,priority:(t=e.kind,"dfm"===t?1:0),caption:e.caption,provisional:e.provisional};var t}),$={};for(const e of h)e.phase&&($[e.phase]=$[e.phase]||[]).push(e.ms);const M=Object.entries($).filter(([,e])=>e.length>=2).map(([e,t])=>({key:e,label:i?.[e]??e,minMs:Math.min(...t),maxMs:Math.max(...t)})),C="rail"===o,L=y&&/* @__PURE__ */Ye("div",{className:"select-none",children:/* @__PURE__ */Ye(ro,{axis:C?"spread":"compressed",labels:C?"none":"lanes",items:k,pending:m,phases:M,startMs:b,endMs:x,todayMs:u??void 0,edgeCaptions:s,highlightKeys:c,onHoverChange:d,ariaLabel:p.milestones(e)})});/* @__PURE__ */
440
+ return Ye("div",C?{className:"shrink-0","data-timeline-variant":"rail",children:L}:{className:"shrink-0",children:/* @__PURE__ */Ye(no,{icon:/* @__PURE__ */Ye(wi,{}),heading:t??e,subject:r,meta:N,children:L})})}var lo=/* @__PURE__ */new Set(["finished","partial_shipped","shipped","completed","cancelled"]),io=[{key:"casting",label:"Casting",weight:.2},{key:"cnc",label:"CNC",weight:.2},{key:"painting",label:"Painting",weight:.5},{key:"packing",label:"Packing",weight:.1},{key:"finished_goods",label:"FG",weight:0},{key:"stock_qty",label:"Stock",weight:0}];function oo(e){if(e.order_qty<=0)return 0;let t=0;for(const r of io)if(r.weight>0){t+=Math.min((e[r.key]||0)/e.order_qty,1)*r.weight}return 100*t}function so(e){const t=e?.items??[];return 0===t.length?0:t.reduce((e,t)=>e+oo(t),0)/t.length}function co(e){const{reports:t,poProductionStartDate:r,poEstCompletionDate:n,poStatus:a,poNumber:l="",currentReportId:i,currentReportDate:o,msPerDayOfPlayback:s=500,markers:c=[]}=e,[d,u]=Ee(null),h=he().production;Ie(()=>{o?u(new Date(o).getTime()):t.length>0&&u(new Date(t[0].date).getTime())},[i]);const[m,p]=Ee(!1),g=Be(null),f=()=>{null!=g.current&&(cancelAnimationFrame(g.current),g.current=null),p(!1)};Ie(()=>()=>f(),[]),Ie(()=>{f()},[i]);const b=t.map(e=>li(e.date)).filter(e=>null!=e),x=le(Date.now,null)??Math.max(0,...b,...c.map(e=>li(e.date)??0),li(r??null)??0,li(n??null)??0),y=b.length?Math.min(...b):x,v=b.length?Math.max(...b):x,w=li(r??null)??y,N=li(n??null)??0,k=lo.has((a||"").toLowerCase()),$=c.reduce((e,t)=>{const r=li(t.date);return null!=r&&r>e?r:e},0),M=(()=>{const e=[N,v,$,w+ai];return k||e.push(x),Math.max(...e)})(),C=Math.max(1,Math.round((M-w)/ai)),L=li(o??null)??v??w,S=Math.min(Math.max(d??L,w),M),D=t.find(e=>{const t=li(e.date);return null!=t&&t<=S})??null;let P=null;for(let e=t.length-1;e>=0;e--){const r=li(t[e].date);if(null!=r&&r>S){P=t[e];break}}const A=(()=>{if(D||!P||0===t.length)return null;const e=(t[t.length-1].items??[]).map((e,t)=>({id:`zero-${e.part_number}-${t}`,part_number:e.part_number,description:e.description??"",order_qty:Number(e.order_qty||0),casting:0,cnc:0,painting:0,packing:0,finished_goods:0,stock_qty:0}));return{id:`zero-${l}`,progress_number:h.start,date:r||new Date(w).toISOString().slice(0,10),items:e,est_completion_date:n??null,created_by_name:"",notes:""}})(),j=D??A,z=D?li(D.date):A?w:null,F=P?li(P.date):null,E=!!(j&&P&&null!=z&&null!=F&&S>z&&S<F);let B,T;if(E&&null!=z&&null!=F){const e=(S-z)/Math.max(F-z,1),t=(t,r)=>Math.round(t+(r-t)*e),r={};for(const e of j?.items??[])r[e.part_number]=e;const n={};for(const e of P?.items??[])n[e.part_number]=e;const a=Array.from(/* @__PURE__ */new Set([...Object.keys(r),...Object.keys(n)])).map((e,a)=>{const l=r[e]??{},i=n[e]??{},o=e=>Number(e)||0;return{id:`interp-${e}-${a}`,part_number:e,description:l.description??i.description??"",order_qty:o(l.order_qty??i.order_qty??0),casting:t(o(l.casting),o(i.casting)),cnc:t(o(l.cnc),o(i.cnc)),painting:t(o(l.painting),o(i.painting)),packing:t(o(l.packing),o(i.packing)),finished_goods:t(o(l.finished_goods),o(i.finished_goods)),stock_qty:t(o(l.stock_qty),o(i.stock_qty))}}),l=li(j?.est_completion_date),i=li(P?.est_completion_date);let o;o=null!=l&&null!=i?new Date(Math.round(l+(i-l)*e)).toISOString().slice(0,10):j?.est_completion_date||P?.est_completion_date||null,B={id:`interp-${S}`,progress_number:h.estimated,date:new Date(S).toISOString().slice(0,10),created_by_name:"",est_completion_date:o,items:a,notes:""},T=j}else if(B=j??t[t.length-1]??null,B){const e=t.findIndex(e=>e.id===B.id);T=e>=0&&e<t.length-1?t[e+1]:null}else T=null;const I={};for(const e of T?.items??[])I[e.part_number]=e;const O=!(!i||B?.id===i),R=i?Math.min(li(o??null)??M,M):M,W=i?t.find(e=>e.id===i)?.progress_number:void 0;return{startMs:w,endMs:M,totalLeadDays:C,scrubMs:S,setScrubMs:e=>{f(),u(e)},resetToCurrent:()=>{f(),o&&u(new Date(o).getTime())},scrubbedAway:O,beforeAnchor:j,nextAfter:P,displayed:B,prevReport:T,prevByPN:I,isInterpolated:E,playing:m,startPlay:()=>{if(m)return void f();if(R<=w)return void u(R);p(!0),u(w);let e=performance.now(),t=w;const r=n=>{const a=n-e;if(e=n,t+=a/s*ai,t>=R)return u(R),g.current=null,void p(!1);u(t),g.current=requestAnimationFrame(r)};g.current=requestAnimationFrame(r)},stopPlay:f,reports:t,markers:c,poNumber:l,currentReportId:i,currentReportProgressNumber:W,estCompletionMs:li(n??null)}}function uo({startMs:e,endMs:t,reports:r,markers:n,valueMs:a,activeId:l,onChange:i,onPickReport:o,onOpenReport:s,onOpenMarker:c,onDragStart:d,renderReportPreview:u,reportLabel:h,playback:m,edgeCaptions:p,bare:g=!1,endMark:f=null}){const b=he().production,x=ue(),y=r.map(e=>({report:e,ms:new Date(e.date).getTime()})).filter(({ms:e})=>Number.isFinite(e)).sort((e,t)=>e.ms-t.ms),v=y.map(({report:e,ms:t})=>({key:e.id,ms:t,kind:"report",label:h(e),preview:e.preview??u?.(e),onOpen:s?()=>s(e.id):void 0})),w=new Map(y.map(({report:e,ms:t})=>[e.id,t])),N=y.map(({ms:e})=>e),k=c?n.map(e=>({...e,onOpen:c})):n;/* @__PURE__ */
441
+ return Ye("div",{className:"select-none",children:/* @__PURE__ */Ye(ro,{axis:g?"spread":"linear",labels:g?"none":"active",endMark:g?f:null,items:v,markers:k,startMs:e,endMs:t,activeKey:l,onActivate:e=>{const t=w.get(e);null!=t&&i(t),o(e)},playback:m,edgeCaptions:p,thumb:{valueMs:a,onChange:i,onDragStart:d,stops:N,ariaLabel:b.scrub,valueText:e=>{const t=(e=>y.find(t=>t.ms===e)?.report)(e);return t?`${h(t)} · ${ii(e,x)}`:ii(e,x)}},ariaLabel:b.label(ii(e,x),ii(t,x))})})}function ho({snapshot:e,onPickReport:t,onOpenReport:r,onOpenMarker:n,renderReportPreview:a,onScrubProgress:l,heading:i,edgeCaptions:o,reportLabel:s=e=>e.progress_number,resetLabel:c,variant:d="card",onPlayStart:u}){const{reports:h,markers:m,poNumber:p,startMs:g,endMs:f,totalLeadDays:b,scrubMs:x,setScrubMs:y,displayed:v,scrubbedAway:w,resetToCurrent:N,currentReportId:k,currentReportProgressNumber:$,estCompletionMs:M}=e,C=function(e,t,r){const[n,a]=Ee(!1),l=Be(!1);return{playing:n,toggle:()=>{n?a(!1):0!==e.length&&(r?.(),l.current||(l.current=!0,t(e[0])),a(!0))},stop:()=>{l.current=!1,a(!1)}}}(h.map(e=>li(e.date)).filter(e=>null!=e).sort((e,t)=>e-t),y,u),L=he().production,S=ue(),D=i??L.heading,P=e=>ii(e,S);if(0===h.length&&0===m.length)return null;const A=m.filter(e=>"shipment"===e.kind),j=m.filter(e=>"inspection"===e.kind),z=m.filter(e=>"invoice"===e.kind),F=(v?.items??[]).reduce((e,t)=>e+(Number(t.stock_qty)||0),0),E=v?so(v):0,B=h.find(e=>e.id===k),T=B?s(B):$,I=
442
442
  /* @__PURE__ */Ge("button",{type:"button",onClick:C.toggle,"aria-pressed":C.playing,title:C.playing?L.pause:L.playTitle,className:"rosh-tl-play text-gray-700 border-gray-300 hover:text-blue-600 hover:border-blue-600",children:[C.playing?/* @__PURE__ */Ye(Pe,{name:"pause","aria-hidden":"true"}):/* @__PURE__ */Ye(Pe,{name:"play","aria-hidden":"true"}),
443
443
  /* @__PURE__ */Ye("span",{children:C.playing?L.pause:L.play})]}),O=w&&(c??T)?/* @__PURE__ */Ye("button",{type:"button",onClick:()=>{C.stop(),N()},className:"text-xs text-blue-600 underline-offset-4 hover:underline font-medium",children:c??L.backTo(String(T))}):null,[R,W]=ge(L.showing),K=e=>/* @__PURE__ */Ye("p",{className:"rosh-tl-status text-gray-800",children:v?/* @__PURE__ */Ge(Xe,{children:[e&&R,
444
444
  /* @__PURE__ */Ye("b",{className:"font-medium",children:s(v)}),e&&W,
@@ -449,9 +449,9 @@ return Ge("div",{className:"shrink-0","data-timeline-variant":"rail",children:[
449
449
  return Ye("div",{className:"shrink-0",children:/* @__PURE__ */Ye(no,{icon:/* @__PURE__ */Ye(Ni,{}),heading:D,subject:p,meta:[`${P(g)} → ${P(f)}`,L.leadTime(b)],actions:/* @__PURE__ */Ge(Xe,{children:[O,I]}),footer:/* @__PURE__ */Ge(Xe,{children:[K(!0),
450
450
  /* @__PURE__ */Ge("div",{className:"rosh-tl-legend",children:[h.length>0&&/* @__PURE__ */Ge("span",{className:"border-gray-200 text-gray-500",children:[
451
451
  /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-ring border-blue-600"}),L.report]}),A.length>0&&/* @__PURE__ */Ge("span",{className:"border-gray-200 text-gray-500",children:[
452
- /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-diamond",style:{background:"var(--tl-shipment)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */Ye(vi,{name:"truck"})}),L.shipment]}),z.length>0&&/* @__PURE__ */Ge("span",{className:"border-gray-200 text-gray-500",children:[
453
- /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-inspection)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */Ye(vi,{name:"flask"})}),L.inspection]}),j.length>0&&/* @__PURE__ */Ge("span",{className:"border-gray-200 text-gray-500",children:[
454
- /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */Ye(vi,{name:"receipt"})}),L.invoice]})]})]}),children:/* @__PURE__ */Ye(uo,{startMs:g,endMs:f,reports:h,markers:m,valueMs:x,activeId:v?.id??"",onChange:y,onPickReport:t,onOpenReport:r,onOpenMarker:n,renderReportPreview:a,reportLabel:s,edgeCaptions:o,onDragStart:C.stop,playback:{playing:C.playing,onArrive:(e,t)=>y(t),onProgress:l,onStop:C.stop}})})})}var mo=e=>"number"==typeof e?e:parseInt(String(e??""))||0;function po({items:e,getVolume:t,getInstructionVolume:r,getActualVolume:n,qtyField:a="instruction",showNewIndicator:l=!1,getInstructionQty:i=e=>e.quantity,getActualQty:o=e=>e.actual_qty,isFilled:s,isNew:c=e=>Boolean(e._isNew),className:d,style:u}){const h=he().containers,m=s?e.filter(s):e,p=e=>mo(i(e)),g=e=>mo(o(e)),f=m.some(e=>null!=o(e)&&g(e)>0),b=e=>f?p(e):"actual"===a?o(e)??i(e)??0:i(e)??0,x=m.reduce((e,t)=>e+mo(b(t)),0),y=m.filter(e=>c(e)).length,v=m.filter(e=>c(e)).reduce((e,t)=>e+mo(b(t)),0),w=m.reduce((e,t)=>e+p(t),0),N=m.reduce((e,t)=>e+g(t),0),k=e=>t?.(e)??0,$=r??(e=>k(e)*p(e)),M=n??(e=>k(e)*g(e)),C=m.reduce((e,t)=>e+$(t),0),L=m.reduce((e,t)=>e+M(t),0),S=f?Math.max(C,L):"actual"===a&&L||C,D=S<=34.65?"20ft":"40ft",P="20ft"===D?33:67,A=S>0?Math.max(1,Math.ceil(S/P)):0,z=A*P,j=S>0&&S>=.95*z&&S<=1.1*z;if(0===m.length)return null;const F=(e,t)=>P>0?Math.max(0,Math.min((e-t*P)/P*100,100)):0;/* @__PURE__ */
452
+ /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-diamond",style:{background:"var(--tl-shipment)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */Ye(vi,{name:"truck"})}),L.shipment]}),j.length>0&&/* @__PURE__ */Ge("span",{className:"border-gray-200 text-gray-500",children:[
453
+ /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-inspection)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */Ye(vi,{name:"flask"})}),L.inspection]}),z.length>0&&/* @__PURE__ */Ge("span",{className:"border-gray-200 text-gray-500",children:[
454
+ /* @__PURE__ */Ye("i",{"aria-hidden":"true",className:"rosh-tl-glyph is-disc",style:{background:"var(--tl-invoice)",color:"var(--tl-on-kind)"},children:/* @__PURE__ */Ye(vi,{name:"receipt"})}),L.invoice]})]})]}),children:/* @__PURE__ */Ye(uo,{startMs:g,endMs:f,reports:h,markers:m,valueMs:x,activeId:v?.id??"",onChange:y,onPickReport:t,onOpenReport:r,onOpenMarker:n,renderReportPreview:a,reportLabel:s,edgeCaptions:o,onDragStart:C.stop,playback:{playing:C.playing,onArrive:(e,t)=>y(t),onProgress:l,onStop:C.stop}})})})}var mo=e=>"number"==typeof e?e:parseInt(String(e??""))||0;function po({items:e,getVolume:t,getInstructionVolume:r,getActualVolume:n,qtyField:a="instruction",showNewIndicator:l=!1,getInstructionQty:i=e=>e.quantity,getActualQty:o=e=>e.actual_qty,isFilled:s,isNew:c=e=>Boolean(e._isNew),className:d,style:u}){const h=he().containers,m=s?e.filter(s):e,p=e=>mo(i(e)),g=e=>mo(o(e)),f=m.some(e=>null!=o(e)&&g(e)>0),b=e=>f?p(e):"actual"===a?o(e)??i(e)??0:i(e)??0,x=m.reduce((e,t)=>e+mo(b(t)),0),y=m.filter(e=>c(e)).length,v=m.filter(e=>c(e)).reduce((e,t)=>e+mo(b(t)),0),w=m.reduce((e,t)=>e+p(t),0),N=m.reduce((e,t)=>e+g(t),0),k=e=>t?.(e)??0,$=r??(e=>k(e)*p(e)),M=n??(e=>k(e)*g(e)),C=m.reduce((e,t)=>e+$(t),0),L=m.reduce((e,t)=>e+M(t),0),S=f?Math.max(C,L):"actual"===a&&L||C,D=S<=34.65?"20ft":"40ft",P="20ft"===D?33:67,A=S>0?Math.max(1,Math.ceil(S/P)):0,j=A*P,z=S>0&&S>=.95*j&&S<=1.1*j;if(0===m.length)return null;const F=(e,t)=>P>0?Math.max(0,Math.min((e-t*P)/P*100,100)):0;/* @__PURE__ */
455
455
  return Ge("div",{className:`mt-2 px-1 space-y-2 ${d??""}`.trim(),style:u,children:[
456
456
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[
457
457
  /* @__PURE__ */Ge("span",{children:[`${h.items(m.length)} · ${h.pieces(x)}`,f&&w!==N&&/* @__PURE__ */Ye("span",{className:"ml-1 text-gray-400",children:h.split(w,N)})]}),l&&y>0&&/* @__PURE__ */Ge("span",{className:"flex items-center gap-1 text-green-600",children:[
@@ -468,7 +468,7 @@ return Ge("div",{className:"flex items-center gap-2",children:[
468
468
  /* @__PURE__ */Ye("span",{className:"text-gray-400",children:"/"}),
469
469
  /* @__PURE__ */Ge("span",{className:"inline-flex items-center gap-1 text-green-700",children:[
470
470
  /* @__PURE__ */Ye("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500"}),h.loaded(L)]})]}):/* @__PURE__ */Ye("b",{className:"text-gray-700",children:h.volume(S)})]}),
471
- /* @__PURE__ */Ge("span",{className:"font-medium "+(j?"text-green-600":"text-gray-500"),children:[j&&"✓ ",A," × ",D]})]})]}):/* @__PURE__ */Ye("div",{className:"text-xs text-gray-400",children:h.noVolume})]})}var go=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,fo=e=>m(e.trim());function bo(e){const t=[];let r,n=0,a=0;for(go.lastIndex=0;null!==(r=go.exec(e));)r.index>n&&t.push(e.slice(n,r.index)),void 0!==r[1]?t.push(
471
+ /* @__PURE__ */Ge("span",{className:"font-medium "+(z?"text-green-600":"text-gray-500"),children:[z&&"✓ ",A," × ",D]})]})]}):/* @__PURE__ */Ye("div",{className:"text-xs text-gray-400",children:h.noVolume})]})}var go=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,fo=e=>p(e.trim());function bo(e){const t=[];let r,n=0,a=0;for(go.lastIndex=0;null!==(r=go.exec(e));)r.index>n&&t.push(e.slice(n,r.index)),void 0!==r[1]?t.push(
472
472
  /* @__PURE__ */Ge("span",{className:"text-gray-400",children:["[",r[1],"]"]},a++)):void 0!==r[3]?t.push(
473
473
  /* @__PURE__ */Ye("a",{href:fo(r[4])?r[4]:void 0,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",children:r[3]},a++)):void 0!==r[5]?t.push(
474
474
  /* @__PURE__ */Ye("strong",{className:"font-semibold text-gray-900",children:r[5]},a++)):void 0!==r[6]?t.push(
@@ -511,10 +511,10 @@ return Ge("button",{type:"button",onClick:()=>m(e.slug),className:"w-full text-l
511
511
  /* @__PURE__ */Ye("div",{className:"flex-1 overflow-auto px-5 py-4",children:o?o(w):w.body?/* @__PURE__ */Ye($o,{children:w.body}):/* @__PURE__ */Ye("p",{className:"text-sm text-gray-500 italic",children:c.help.noBody})})]}):/* @__PURE__ */Ye("div",{className:"flex-1 flex items-center justify-center px-6 text-center",children:/* @__PURE__ */Ye("p",{className:"text-sm text-gray-500",children:t?c.help.loading:c.help.pickArticle})})})]})}var Lo={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50"};function So({children:e,onClick:t,variant:r="primary",hotkey:n,disabled:a=!1,type:l="button",title:i,className:o=""}){const s=b(n??"");/* @__PURE__ */
512
512
  return Ge("button",{type:l,onClick:t,disabled:a,title:i,className:`w-full inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors disabled:opacity-50 ${Lo[r]} ${o}`,children:[e,n&&/* @__PURE__ */Ye("kbd",{className:"kbd-submit rounded border px-2 py-0.5 text-2xs font-medium",children:s})]})}function Do(e){return"shrink-0 inline-flex items-center justify-center min-w-[1.25rem] px-2 h-5 rounded-full text-2xs font-medium "+(e?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600")}function Po({children:e,count:t}){return null==t?/* @__PURE__ */Ye("p",{className:"px-3 pb-1 pt-1 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:e}):/* @__PURE__ */Ge("p",{className:"flex items-center justify-between gap-2 px-3 pb-1 pt-1 text-2xs font-semibold uppercase tracking-wide text-gray-400",children:[
513
513
  /* @__PURE__ */Ye("span",{className:"min-w-0 truncate",children:e}),
514
- /* @__PURE__ */Ye("span",{className:"shrink-0 normal-case tracking-normal tabular-nums",children:t})]})}function Ao(e){return"flex min-w-0 flex-1 items-center justify-between gap-2 rounded-r-lg border-l-2 h-8 px-3 text-sm "+(e?"border-blue-500 bg-blue-50 font-medium text-blue-700":"border-gray-200 text-gray-700 hover:bg-gray-100")}function zo({label:e,count:t,active:r,onClick:n,icon:a,trailing:l,severity:i,depth:o=0}){const s=Xl(i,"SidebarNavItem"),c=he().severity,d=s?(h=c,(u=s).tone?h[u.tone]:h.unrecognised(u.token??"")):void 0;var u,h;const m=/* @__PURE__ */Ge(Xe,{children:[null!=a&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"shrink-0 h-4 w-4",children:a}),s&&
514
+ /* @__PURE__ */Ye("span",{className:"shrink-0 normal-case tracking-normal tabular-nums",children:t})]})}function Ao(e){return"flex min-w-0 flex-1 items-center justify-between gap-2 rounded-r-lg border-l-2 h-8 px-3 text-sm "+(e?"border-blue-500 bg-blue-50 font-medium text-blue-700":"border-gray-200 text-gray-700 hover:bg-gray-100")}function jo({label:e,count:t,active:r,onClick:n,icon:a,trailing:l,severity:i,depth:o=0}){const s=Xl(i,"SidebarNavItem"),c=he().severity,d=s?(h=c,(u=s).tone?h[u.tone]:h.unrecognised(u.token??"")):void 0;var u,h;const m=/* @__PURE__ */Ge(Xe,{children:[null!=a&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"shrink-0 h-4 w-4",children:a}),s&&
515
515
  /* @__PURE__ */Ye("span",{"aria-hidden":"true",title:d,className:`shrink-0 h-1.5 w-1.5 rounded-full ${s.fill}`}),
516
516
  /* @__PURE__ */Ye("span",{className:"min-w-0 truncate mr-auto",title:"string"==typeof e?e:void 0,children:e}),s&&/* @__PURE__ */Ye("span",{className:"sr-only",children:d}),null!=t&&t>0&&/* @__PURE__ */Ye("span",{className:Do(r),children:t}),null!=l&&/* @__PURE__ */Ye("span",{className:"shrink-0",children:l})]});/* @__PURE__ */
517
- return Ye("button",1===o?{type:"button",onClick:n,className:"flex w-full pl-5 text-left",children:/* @__PURE__ */Ye("span",{className:Ao(r),children:m})}:{type:"button",onClick:n,className:"flex w-full items-center justify-between gap-2 rounded-lg h-8 px-3 text-sm text-left "+(r?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),children:m})}function jo({label:e,count:t,children:r,defaultExpanded:n=!0,storageKey:a}){const l=je(),[i,o]=ie(()=>{if(a){let e=null;try{e=window.localStorage.getItem(a)}catch{}if("1"===e||"0"===e)return"1"===e}return n},n),s=!i&&Re.toArray(r).some(e=>We(e)&&!0===e.props.active);/* @__PURE__ */
517
+ return Ye("button",1===o?{type:"button",onClick:n,className:"flex w-full pl-5 text-left",children:/* @__PURE__ */Ye("span",{className:Ao(r),children:m})}:{type:"button",onClick:n,className:"flex w-full items-center justify-between gap-2 rounded-lg h-8 px-3 text-sm text-left "+(r?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),children:m})}function zo({label:e,count:t,children:r,defaultExpanded:n=!0,storageKey:a}){const l=ze(),[i,o]=ie(()=>{if(a){let e=null;try{e=window.localStorage.getItem(a)}catch{}if("1"===e||"0"===e)return"1"===e}return n},n),s=!i&&Re.toArray(r).some(e=>We(e)&&!0===e.props.active);/* @__PURE__ */
518
518
  return Ge("div",{children:[
519
519
  /* @__PURE__ */Ge("button",{type:"button",onClick:()=>{const e=!i;if(o(e),a)try{window.localStorage.setItem(a,e?"1":"0")}catch{}},"aria-expanded":i,"aria-controls":l,className:"flex w-full items-center gap-2 rounded-lg h-8 px-3 text-sm font-medium text-left "+(s?"bg-blue-50 text-blue-700":"text-gray-800 hover:bg-gray-100"),children:[
520
520
  /* @__PURE__ */Ye("span",{className:"min-w-0 truncate",title:e,children:e}),
@@ -523,141 +523,139 @@ return Ge("div",{children:[
523
523
  return Ge("div",{className:`flex h-12 shrink-0 items-stretch gap-1 border-b border-gray-200 bg-white px-3 ${l??""}`,children:[n&&/* @__PURE__ */Ye("div",{className:"mr-1 flex items-center gap-2 pr-3 font-semibold text-gray-900",children:n}),
524
524
  /* @__PURE__ */Ye("nav",{className:"flex items-stretch gap-0.5",children:e.map(e=>{const n=e.key===t;/* @__PURE__ */
525
525
  return Ge("button",{type:"button",disabled:e.disabled,"aria-current":n?"page":void 0,onClick:()=>!e.disabled&&r?.(e.key),className:"relative inline-flex items-center gap-2 px-3 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40 "+(n?"text-blue-600":"text-gray-600 hover:text-gray-900"),children:[e.icon&&/* @__PURE__ */Ye("span",{className:"h-4 w-4 shrink-0",children:e.icon}),
526
- /* @__PURE__ */Ye("span",{className:"whitespace-nowrap",children:e.label}),null!=e.badge&&/* @__PURE__ */Ye("span",{className:"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-2 text-2xs font-semibold leading-5 text-gray-600",children:e.badge}),n&&/* @__PURE__ */Ye("span",{className:"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600","aria-hidden":!0})]},e.key)})}),a&&/* @__PURE__ */Ye("div",{className:"ml-auto flex items-center gap-2",children:a})]})}var Eo=/(^|[\s:])!?z-/,Bo=e=>!!e&&"label"!==e.type&&"divider"!==e.type&&!e.disabled;function To({trigger:e,items:t,align:r="end",side:n="bottom","aria-label":a,className:l="",triggerClassName:i,menuClassName:o="",minWidth:s=180,linkAs:c,disabled:d,id:u,"aria-describedby":h}){const[m,p]=Ee(!1),[g,f]=Ee(-1),b=Be(null),x=Be(null),y=Be(null),v=Be({text:"",at:0}),w=je(),N=je(),k=u??N,$=Fe(e=>{p(!1),e&&x.current?.focus()},[]),M=(e,r)=>{const n=t.length;for(let a=0;a<n;a+=1){const l=((e+r*a)%n+n)%n;if(Bo(t[l]))return l}return-1},C=()=>y.current?.closest("[data-popup-menu-tree]")??null;Ie(()=>{if(!m)return;const e=e=>{const t=e.target;b.current?.contains(t)||C()?.contains(t)||$(!1)};document.addEventListener("pointerdown",e,!0);const t=ee(()=>$(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[m,$]);const S=Fe(()=>{const e=C(),t=x.current;if(!e||!t)return;const a=e.style;a.left="0px",a.top="0px",a.maxWidth="none",a.maxHeight="none";const l={width:e.offsetWidth,height:e.offsetHeight},i=D({trigger:t.getBoundingClientRect(),menu:l,bounds:L(t),align:r,side:n});a.left=`${i.left}px`,a.top=`${i.top}px`,a.maxWidth=`${i.maxWidth}px`,a.maxHeight=`${i.maxHeight}px`,a.overflowY=l.height>i.maxHeight?"auto":"",e.dataset.side=i.side,e.dataset.align=r},[r,n]);re(()=>{m&&S()}),Ie(()=>{if(m)return P(()=>x.current,S)},[m,S]),Ie(()=>{if(!m)return;const e=y.current,r=Bo(t[g])?e?.querySelector(`[data-dropdown-index="${g}"]`):null;(r??e)?.focus({preventScroll:!0})},[m,g]),Ie(()=>{if(m)return Q(e=>"Escape"===e.key&&($(!0),!0),()=>y.current)},[m,$]);const A=e=>{f(e),p(!0)},z=e=>{e.disabled||($(!0),e.onSelect())},j=c??"a",F=(e,t)=>({"data-dropdown-index":e,tabIndex:e===g?0:-1,onMouseEnter:()=>{t.disabled||f(e)}}),E=(e,t)=>{if("divider"===e.type)/* @__PURE__ */
527
- return Ye("div",{role:"separator",children:/* @__PURE__ */Ye(q,{})},e.key);if("label"===e.type)/* @__PURE__ */
528
- return Ye("div",{id:`${w}-label-${t}`,children:/* @__PURE__ */Ye(H,{children:e.label})},e.key);if("checkbox"===e.type){const r=_(!1,e.disabled,"");/* @__PURE__ */
526
+ /* @__PURE__ */Ye("span",{className:"whitespace-nowrap",children:e.label}),null!=e.badge&&/* @__PURE__ */Ye("span",{className:"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-2 text-2xs font-semibold leading-5 text-gray-600",children:e.badge}),n&&/* @__PURE__ */Ye("span",{className:"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600","aria-hidden":!0})]},e.key)})}),a&&/* @__PURE__ */Ye("div",{className:"ml-auto flex items-center gap-2",children:a})]})}var Eo=/(^|[\s:])!?z-/,Bo=e=>!!e&&"label"!==e.type&&"divider"!==e.type&&!e.disabled;function To({trigger:e,items:t,align:r="end",side:n="bottom","aria-label":a,className:l="",triggerClassName:i,menuClassName:o="",minWidth:s=180,linkAs:c,disabled:d,id:u,"aria-describedby":h}){const[m,p]=Ee(!1),[g,f]=Ee(-1),b=Be(null),x=Be(null),y=Be(null),v=Be({text:"",at:0}),w=ze(),N=ze(),k=u??N,$=Fe(e=>{p(!1),e&&x.current?.focus()},[]),M=(e,r)=>{const n=t.length;for(let a=0;a<n;a+=1){const l=((e+r*a)%n+n)%n;if(Bo(t[l]))return l}return-1},C=()=>y.current?.closest("[data-popup-menu-tree]")??null;Ie(()=>{if(!m)return;const e=e=>{const t=e.target;b.current?.contains(t)||C()?.contains(t)||$(!1)};document.addEventListener("pointerdown",e,!0);const t=ee(()=>$(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[m,$]);const S=Fe(()=>{const e=C(),t=x.current;if(!e||!t)return;const a=e.style;a.left="0px",a.top="0px",a.maxWidth="none",a.maxHeight="none";const l={width:e.offsetWidth,height:e.offsetHeight},i=D({trigger:t.getBoundingClientRect(),menu:l,bounds:L(t),align:r,side:n});a.left=`${i.left}px`,a.top=`${i.top}px`,a.maxWidth=`${i.maxWidth}px`,a.maxHeight=`${i.maxHeight}px`,a.overflowY=l.height>i.maxHeight?"auto":"",e.dataset.side=i.side,e.dataset.align=r},[r,n]);re(()=>{m&&S()}),Ie(()=>{if(m)return P(()=>x.current,S)},[m,S]),Ie(()=>{if(!m)return;const e=y.current,r=Bo(t[g])?e?.querySelector(`[data-dropdown-index="${g}"]`):null;(r??e)?.focus({preventScroll:!0})},[m,g]),Ie(()=>{if(m)return Q(e=>"Escape"===e.key&&($(!0),!0),()=>y.current)},[m,$]);const A=e=>{f(e),p(!0)},j=e=>{e.disabled||($(!0),e.onSelect())},z=c??"a",F=(e,t)=>({"data-dropdown-index":e,tabIndex:e===g?0:-1,onMouseEnter:()=>{t.disabled||f(e)}}),E=(e,t)=>{if("divider"===e.type)/* @__PURE__ */
527
+ return Ye("div",{role:"separator",children:/* @__PURE__ */Ye(_,{})},e.key);if("label"===e.type)/* @__PURE__ */
528
+ return Ye("div",{id:`${w}-label-${t}`,children:/* @__PURE__ */Ye(q,{children:e.label})},e.key);if("checkbox"===e.type){const r=H(!1,e.disabled,"");/* @__PURE__ */
529
529
  return Ge("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,disabled:e.disabled,className:r.className,style:r.style,onClick:()=>(e=>{e.disabled||e.onSelect()})(e),...F(t,e),children:[
530
- /* @__PURE__ */Ye(U,{kind:"checkbox",checked:e.checked}),e.icon,e.label]},e.key)}if("radio"===e.type){const r=_(!1,e.disabled,"");/* @__PURE__ */
531
- return Ge("button",{type:"button",role:"menuitemradio","aria-checked":e.checked,disabled:e.disabled,className:r.className,style:r.style,onClick:()=>z(e),...F(t,e),children:[
532
- /* @__PURE__ */Ye(U,{kind:"radio",checked:e.checked}),e.icon,e.label]},e.key)}if((e=>"link"===e.type||void 0===e.type&&"string"==typeof e.href)(e)){const r=_(!1,e.disabled,"no-underline "+(e.current?"font-medium":""));return e.disabled?/* @__PURE__ */Ge("a",{role:"menuitem","aria-disabled":"true",className:r.className,style:r.style,...F(t,e),children:[e.icon,e.label]},e.key):/* @__PURE__ */Ge(j,{href:e.href,role:"menuitem","aria-current":e.current?"page":void 0,className:r.className,style:r.style,onClick:()=>$(!0),...F(t,e),children:[e.icon,e.label]},e.key)}const r=_(e.danger,e.disabled,"");/* @__PURE__ */
533
- return Ge("button",{type:"button",role:"menuitem",disabled:e.disabled,className:r.className,style:r.style,onClick:()=>z(e),...F(t,e),children:[e.icon,e.label]},e.key)},B={...Eo.test(o)?{}:{zIndex:te.popup},minWidth:s};/* @__PURE__ */
530
+ /* @__PURE__ */Ye(U,{kind:"checkbox",checked:e.checked}),e.icon,e.label]},e.key)}if("radio"===e.type){const r=H(!1,e.disabled,"");/* @__PURE__ */
531
+ return Ge("button",{type:"button",role:"menuitemradio","aria-checked":e.checked,disabled:e.disabled,className:r.className,style:r.style,onClick:()=>j(e),...F(t,e),children:[
532
+ /* @__PURE__ */Ye(U,{kind:"radio",checked:e.checked}),e.icon,e.label]},e.key)}if((e=>"link"===e.type||void 0===e.type&&"string"==typeof e.href)(e)){const r=H(!1,e.disabled,"no-underline "+(e.current?"font-medium":""));return e.disabled?/* @__PURE__ */Ge("a",{role:"menuitem","aria-disabled":"true",className:r.className,style:r.style,...F(t,e),children:[e.icon,e.label]},e.key):/* @__PURE__ */Ge(z,{href:e.href,role:"menuitem","aria-current":e.current?"page":void 0,className:r.className,style:r.style,onClick:()=>$(!0),...F(t,e),children:[e.icon,e.label]},e.key)}const r=H(e.danger,e.disabled,"");/* @__PURE__ */
533
+ return Ge("button",{type:"button",role:"menuitem",disabled:e.disabled,className:r.className,style:r.style,onClick:()=>j(e),...F(t,e),children:[e.icon,e.label]},e.key)},B={...Eo.test(o)?{}:{zIndex:te.popup},minWidth:s};/* @__PURE__ */
534
534
  return Ge("div",{ref:b,className:`relative inline-flex ${l}`.trim(),children:[
535
535
  /* @__PURE__ */Ye("button",{ref:x,id:k,type:"button","aria-haspopup":"menu","aria-expanded":m,"aria-controls":m?w:void 0,"aria-label":a,"aria-describedby":h,disabled:d,onClick:()=>m?$(!1):A(M(0,1)),onKeyDown:e=>{"ArrowDown"===e.key||"Enter"===e.key||" "===e.key?(e.preventDefault(),A(M(0,1))):"ArrowUp"===e.key&&(e.preventDefault(),A(M(t.length-1,-1)))},className:i??"inline-flex items-center justify-center rounded-(--radius-control) text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] disabled:cursor-not-allowed disabled:opacity-60 "+(a?"h-8 min-w-8 px-0":"h-8 min-w-8 gap-2 px-3"),children:e}),m&&
536
- /* @__PURE__ */Ye(R,{portal:!0,className:o,style:B,children:/* @__PURE__ */Ye("div",{ref:y,id:w,role:"menu","aria-orientation":"vertical","aria-label":a,"aria-labelledby":a?void 0:k,tabIndex:-1,onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),f(M(g+1,1));else if("ArrowUp"===e.key)e.preventDefault(),f(M(g-1,-1));else if("Home"===e.key)e.preventDefault(),f(M(0,1));else if("End"===e.key)e.preventDefault(),f(M(t.length-1,-1));else if("Tab"===e.key)e.preventDefault(),$(!0);else if(" "===e.key){const t=e.target;t.matches?.("a[href]")&&(e.preventDefault(),t.click())}else 1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey||(e=>{const r=Date.now(),n=e.key.toLowerCase(),a=r-v.current.at<500?v.current.text+n:n;v.current={text:a,at:r};const l=[...a].every(e=>e===a[0]),i=l?a[0]:a,o=l?g+1:Math.max(g,0),s=y.current,c=t.length;for(let r=0;r<c;r+=1){const n=((o+r)%c+c)%c;if(Bo(t[n])&&(s?.querySelector(`[data-dropdown-index="${n}"]`)?.textContent?.trim().toLowerCase()??"").startsWith(i))return e.preventDefault(),void f(n)}})(e)},children:(()=>{const e=[];for(let r=0;r<t.length;){const n=t[r];if("radio"!==n.type&&"checkbox"!==n.type){e.push(E(n,r)),r+=1;continue}const a=n.type,l=r,i=[];for(;r<t.length&&t[r].type===a;)i.push(E(t[r],r)),r+=1;const o="label"===t[l-1]?.type?`${w}-label-${l-1}`:void 0;e.push(/* @__PURE__ */Ye("div",{role:"group","aria-labelledby":o,children:i},`group:${n.key}`))}return e})()})})]})}var Io=()=>({left:0,top:0,right:window.innerWidth,bottom:window.innerHeight});function Oo({anchor:e,bounds:t,side:r="top",align:n="start","aria-label":a,children:l,className:i=""}){const o=ae(),s=Be(null),c=Be(e);c.current=e;const d=Be(t);d.current=t;const u=Fe(()=>{const e=s.current,t=c.current();if(!e||!t)return;const a=(d.current??Io)(),l=e.style;l.maxWidth=`${Math.max(0,a.right-a.left-2*S)}px`;const i=D({trigger:t,menu:{width:e.offsetWidth,height:e.offsetHeight},bounds:a,align:n,side:r});l.left=`${i.left}px`,l.top=`${i.top}px`,e.dataset.side=i.side},[n,r]);re(()=>{o&&u()}),Ie(()=>{if(!o)return;const e=z(()=>c.current(),u),t=s.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>u());return r.observe(t),()=>{e(),r.disconnect()}},[o,u]);return o&&e()?Ze(
537
- /* @__PURE__ */Ye("div",{ref:s,role:"toolbar","aria-label":a,"data-floating-bar":"",onMouseDown:e=>{const t=e.target;t?.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])')||e.preventDefault()},className:`fixed rounded-(--radius-popup) p-1 ${i}`.trim(),style:{...J(),position:"fixed",left:0,top:0,zIndex:te.popup},children:l}),document.body):null}function Ro(e){return e?[...e.querySelectorAll("button:not([disabled])")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function Wo({at:e,onClose:t,children:r,owner:n,"aria-label":a,minWidth:l=180,className:i="",autoFocus:o=!0}){const s=Be(null),[c,d]=Ee(null),u=Be(t);u.current=t,re(()=>{const t=s.current?.closest("[data-popup-menu-tree]");if(!t)return;const r={width:t.offsetWidth,height:t.offsetHeight},a=j({point:e,menu:r,bounds:L(n??null)});d(e=>e&&e.left===a.left&&e.top===a.top&&e.maxHeight===a.maxHeight?e:{left:a.left,top:a.top,maxHeight:a.maxHeight,scroll:r.height>a.maxHeight})},[e.x,e.y,n]);const h=Be(null),m=Be(!1);Ie(()=>(h.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!s.current?.contains(e)||h.current?.focus?.({preventScroll:!0})}),[]),Ie(()=>{c&&!m.current&&o&&(m.current=!0,Ro(s.current)[0]?.focus({preventScroll:!0}))},[c,o]),Ie(()=>{if(o)return;const e=e=>{if(s.current?.contains(document.activeElement))return;const t=Ro(s.current),r="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;r&&(e.preventDefault(),r.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o]),Ie(()=>Q(e=>"Escape"===e.key&&(u.current(),!0),()=>s.current),[]),Ie(()=>{const e=()=>u.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const p=Fe(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void u.current();const t=Ro(s.current);if(0===t.length)return;const r=t.indexOf(document.activeElement),n="ArrowDown"===e.key?(r+1)%t.length:"ArrowUp"===e.key?r<=0?t.length-1:r-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;n<0||(e.preventDefault(),t[n].focus())},[]),g=c?{left:c.left,top:c.top,maxHeight:c.maxHeight,...c.scroll?{overflowY:"auto"}:{}}:{left:e.x,top:e.y,visibility:"hidden"};/* @__PURE__ */
538
- return Ye(R,{portal:!0,minWidth:l,style:g,onClose:t,className:i,children:/* @__PURE__ */Ye(W.Provider,{value:!0,children:/* @__PURE__ */Ye("div",{ref:s,role:"menu","aria-label":a,"data-context-menu":"",onKeyDown:p,children:r})})})}function Ko(){const[e,t]=Ee(null),r=Fe(()=>t(null),[]),n=Fe((e,r)=>{const n="nativeEvent"in e?e.nativeEvent:e;if(K(n))return!1;e.preventDefault();const a=e.target instanceof Element?e.target:null;let{clientX:l,clientY:i}=e;if(0===l&&0===i&&a){const e=a.getBoundingClientRect();l=e.left,i=e.bottom}return t({x:l,y:i,data:r,owner:a}),!0},[]),a=Fe(e=>{n(e,void 0)},[n]);return{open:n,onContextMenu:a,close:r,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:r}}}var qo="Alt+ArrowUp Alt+ArrowDown";function Ho(e){return!e.altKey||e.ctrlKey||e.metaKey?null:"ArrowUp"===e.key?"up":"ArrowDown"===e.key?"down":null}var _o=/* @__PURE__ */Ge("svg",{"aria-hidden":"true",viewBox:"0 0 8 14",fill:"currentColor",className:"h-3.5 w-2",children:[
536
+ /* @__PURE__ */Ye(R,{portal:!0,className:o,style:B,children:/* @__PURE__ */Ye("div",{ref:y,id:w,role:"menu","aria-orientation":"vertical","aria-label":a,"aria-labelledby":a?void 0:k,tabIndex:-1,onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),f(M(g+1,1));else if("ArrowUp"===e.key)e.preventDefault(),f(M(g-1,-1));else if("Home"===e.key)e.preventDefault(),f(M(0,1));else if("End"===e.key)e.preventDefault(),f(M(t.length-1,-1));else if("Tab"===e.key)e.preventDefault(),$(!0);else if(" "===e.key){const t=e.target;t.matches?.("a[href]")&&(e.preventDefault(),t.click())}else 1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey||(e=>{const r=Date.now(),n=e.key.toLowerCase(),a=r-v.current.at<500?v.current.text+n:n;v.current={text:a,at:r};const l=[...a].every(e=>e===a[0]),i=l?a[0]:a,o=l?g+1:Math.max(g,0),s=y.current,c=t.length;for(let r=0;r<c;r+=1){const n=((o+r)%c+c)%c;if(Bo(t[n])&&(s?.querySelector(`[data-dropdown-index="${n}"]`)?.textContent?.trim().toLowerCase()??"").startsWith(i))return e.preventDefault(),void f(n)}})(e)},children:(()=>{const e=[];for(let r=0;r<t.length;){const n=t[r];if("radio"!==n.type&&"checkbox"!==n.type){e.push(E(n,r)),r+=1;continue}const a=n.type,l=r,i=[];for(;r<t.length&&t[r].type===a;)i.push(E(t[r],r)),r+=1;const o="label"===t[l-1]?.type?`${w}-label-${l-1}`:void 0;e.push(/* @__PURE__ */Ye("div",{role:"group","aria-labelledby":o,children:i},`group:${n.key}`))}return e})()})})]})}var Io=()=>({left:0,top:0,right:window.innerWidth,bottom:window.innerHeight});function Oo({anchor:e,bounds:t,side:r="top",align:n="start","aria-label":a,children:l,className:i=""}){const o=ae(),s=Be(null),c=Be(e);c.current=e;const d=Be(t);d.current=t;const u=Fe(()=>{const e=s.current,t=c.current();if(!e||!t)return;const a=(d.current??Io)(),l=e.style;l.maxWidth=`${Math.max(0,a.right-a.left-2*S)}px`;const i=D({trigger:t,menu:{width:e.offsetWidth,height:e.offsetHeight},bounds:a,align:n,side:r});l.left=`${i.left}px`,l.top=`${i.top}px`,e.dataset.side=i.side},[n,r]);re(()=>{o&&u()}),Ie(()=>{if(!o)return;const e=j(()=>c.current(),u),t=s.current;if(!t||"undefined"==typeof ResizeObserver)return e;const r=new ResizeObserver(()=>u());return r.observe(t),()=>{e(),r.disconnect()}},[o,u]);return o&&e()?Ze(
537
+ /* @__PURE__ */Ye("div",{ref:s,role:"toolbar","aria-label":a,"data-floating-bar":"",onMouseDown:e=>{const t=e.target;t?.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])')||e.preventDefault()},className:`fixed rounded-(--radius-popup) p-1 ${i}`.trim(),style:{...J(),position:"fixed",left:0,top:0,zIndex:te.popup},children:l}),document.body):null}function Ro(e){return e?[...e.querySelectorAll("button:not([disabled])")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function Wo({at:e,onClose:t,children:r,owner:n,"aria-label":a,minWidth:l=180,className:i="",autoFocus:o=!0}){const s=Be(null),[c,d]=Ee(null),u=Be(t);u.current=t,re(()=>{const t=s.current?.closest("[data-popup-menu-tree]");if(!t)return;const r={width:t.offsetWidth,height:t.offsetHeight},a=z({point:e,menu:r,bounds:L(n??null)});d(e=>e&&e.left===a.left&&e.top===a.top&&e.maxHeight===a.maxHeight?e:{left:a.left,top:a.top,maxHeight:a.maxHeight,scroll:r.height>a.maxHeight})},[e.x,e.y,n]);const h=Be(null),m=Be(!1);Ie(()=>(h.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!s.current?.contains(e)||h.current?.focus?.({preventScroll:!0})}),[]),Ie(()=>{c&&!m.current&&o&&(m.current=!0,Ro(s.current)[0]?.focus({preventScroll:!0}))},[c,o]),Ie(()=>{if(o)return;const e=e=>{if(s.current?.contains(document.activeElement))return;const t=Ro(s.current),r="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;r&&(e.preventDefault(),r.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o]),Ie(()=>Q(e=>"Escape"===e.key&&(u.current(),!0),()=>s.current),[]),Ie(()=>{const e=()=>u.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const p=Fe(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void u.current();const t=Ro(s.current);if(0===t.length)return;const r=t.indexOf(document.activeElement),n="ArrowDown"===e.key?(r+1)%t.length:"ArrowUp"===e.key?r<=0?t.length-1:r-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;n<0||(e.preventDefault(),t[n].focus())},[]),g=c?{left:c.left,top:c.top,maxHeight:c.maxHeight,...c.scroll?{overflowY:"auto"}:{}}:{left:e.x,top:e.y,visibility:"hidden"};/* @__PURE__ */
538
+ return Ye(R,{portal:!0,minWidth:l,style:g,onClose:t,className:i,children:/* @__PURE__ */Ye(W.Provider,{value:!0,children:/* @__PURE__ */Ye("div",{ref:s,role:"menu","aria-label":a,"data-context-menu":"",onKeyDown:p,children:r})})})}function Ko(){const[e,t]=Ee(null),r=Fe(()=>t(null),[]),n=Fe((e,r)=>{const n="nativeEvent"in e?e.nativeEvent:e;if(K(n))return!1;e.preventDefault();const a=e.target instanceof Element?e.target:null;let{clientX:l,clientY:i}=e;if(0===l&&0===i&&a){const e=a.getBoundingClientRect();l=e.left,i=e.bottom}return t({x:l,y:i,data:r,owner:a}),!0},[]),a=Fe(e=>{n(e,void 0)},[n]);return{open:n,onContextMenu:a,close:r,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:r}}}var _o="Alt+ArrowUp Alt+ArrowDown";function qo(e){return!e.altKey||e.ctrlKey||e.metaKey?null:"ArrowUp"===e.key?"up":"ArrowDown"===e.key?"down":null}var Ho=/* @__PURE__ */Ge("svg",{"aria-hidden":"true",viewBox:"0 0 4 14",fill:"currentColor",className:"h-3.5 w-1",children:[
539
539
  /* @__PURE__ */Ye("circle",{cx:"2",cy:"3",r:"1.1"}),
540
- /* @__PURE__ */Ye("circle",{cx:"6",cy:"3",r:"1.1"}),
541
540
  /* @__PURE__ */Ye("circle",{cx:"2",cy:"7",r:"1.1"}),
542
- /* @__PURE__ */Ye("circle",{cx:"6",cy:"7",r:"1.1"}),
543
- /* @__PURE__ */Ye("circle",{cx:"2",cy:"11",r:"1.1"}),
544
- /* @__PURE__ */Ye("circle",{cx:"6",cy:"11",r:"1.1"})]});function Uo({hint:e,dragging:t,revealClassName:r,marker:n}){const a=he().tree;/* @__PURE__ */
545
- return Ye(C,{content:e??a.dragHint,side:"left",delay:700,className:"absolute left-0 top-1/2 inline-flex -translate-y-1/2 transition-opacity "+(t?"opacity-0":`opacity-0 ${r}`),children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",[`data-${n}-grip`]:"",className:"flex h-4 w-2 items-center justify-center text-gray-400",children:_o})})}function Vo({id:e}){/* @__PURE__ */
541
+ /* @__PURE__ */Ye("circle",{cx:"2",cy:"11",r:"1.1"})]});function Uo({hint:e,dragging:t,revealClassName:r,marker:n}){const a=he().tree;/* @__PURE__ */
542
+ return Ye(C,{content:e??a.dragHint,side:"left",delay:700,className:"absolute inset-y-0 left-0 inline-flex transition-opacity "+(t?"opacity-0":`opacity-0 ${r}`),children:/* @__PURE__ */Ye("span",{"aria-hidden":"true",[`data-${n}-grip`]:"",className:"flex h-full w-2 items-center justify-center text-[color:var(--ink-faintest)]",children:Ho})})}function Vo({id:e}){/* @__PURE__ */
546
543
  return Ye("span",{id:e,hidden:!0,children:he().tree.moveHint})}var Yo='[role="treeitem"]';function Go(e){return[...e.querySelectorAll(Yo)].filter(t=>{for(let r=t.parentElement?.closest('[role="group"]');r&&e.contains(r);r=r.parentElement?.closest('[role="group"]')??null)if(r.hasAttribute("hidden"))return!1;return!0})}function Xo({"aria-label":e,"aria-labelledby":t,children:r,className:n="",rootProps:a}){const l=Be(null);re(()=>{const e=l.current;if(!e)return;const t=[...e.querySelectorAll(Yo)];if(0===t.length)return;const r=t.find(e=>e===document.activeElement)??t.find(e=>"true"===e.getAttribute("aria-selected"))??Go(e)[0]??t[0];for(const e of t)e.tabIndex=e===r?0:-1});const i=Fe(e=>{a?.onKeyDown?.(e);const t=l.current,r=e.target.closest?.(Yo);if(!t||!r||e.target!==r||e.defaultPrevented)return;if(e.altKey||e.ctrlKey||e.metaKey)return;const n=Go(t),i=n.indexOf(r),o=Number(r.getAttribute("aria-level")??"1"),s=r=>{e.preventDefault(),function(e,t){if(t){for(const r of e.querySelectorAll(Yo))r.tabIndex=r===t?0:-1;t.focus()}}(t,r)};switch(e.key){case"ArrowDown":s(n[i+1]);break;case"ArrowUp":s(n[i-1]);break;case"Home":s(n[0]);break;case"End":s(n[n.length-1]);break;case"ArrowRight":if("true"===r.getAttribute("aria-expanded")){const t=n[i+1];t&&Number(t.getAttribute("aria-level")??"1")>o?s(t):e.preventDefault()}break;case"ArrowLeft":if("true"!==r.getAttribute("aria-expanded"))for(let e=i-1;e>=0;e--)if(Number(n[e].getAttribute("aria-level")??"1")<o){s(n[e]);break}}},[a]);/* @__PURE__ */
547
544
  return Ye("div",{...a,ref:l,role:"tree","aria-label":t?void 0:e,"aria-labelledby":t,onKeyDown:i,className:`flex flex-col gap-1 ${n}`.trim(),children:r})}function Zo({children:e,hidden:t,className:r=""}){/* @__PURE__ */
548
- return Ye("div",{role:"group",hidden:t,className:`ml-4 flex flex-col gap-1 border-l border-gray-200 pl-2 ${r}`.trim(),children:e})}function Jo({children:e}){/* @__PURE__ */
549
- return Ye("div",{role:"presentation",className:"px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-gray-500",children:e})}var Qo={backgroundColor:"inherit",maskImage:"linear-gradient(to right, transparent, black 12px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 12px)"};function es({label:e,level:t=1,icon:r,preview:n,selected:a=!1,expanded:l,onToggle:i,onSelect:o,muted:s=!1,badge:c,actions:d,actionsPinned:u=!1,actionsOverlay:h=!0,rename:m,drop:p,dragging:g=!1,draggable:f=!1,dragHint:b,onMove:x,rowProps:y,className:v=""}){const w=void 0!==l,N=je(),k=[y?.["aria-describedby"],x?N:void 0].filter(Boolean).join(" ")||void 0,$=a?"bg-blue-50 text-blue-700":"into"===p?"bg-blue-50 text-gray-900":"text-gray-700 hover:bg-gray-100";/* @__PURE__ */
550
- return Ge("div",{...y,role:"treeitem","aria-level":t,"aria-selected":a,"aria-expanded":w?l:void 0,tabIndex:a?0:-1,"aria-keyshortcuts":y?.["aria-keyshortcuts"]??(x?qo:void 0),"aria-describedby":k,"data-drop":p,"data-draggable":f||void 0,onKeyDown:e=>{if(y?.onKeyDown?.(e),e.target!==e.currentTarget||e.defaultPrevented)return;const t=Ho(e);t&&x?(e.preventDefault(),x(t)):"Enter"!==e.key&&" "!==e.key||!o?("ArrowRight"===e.key&&w&&!l&&i||"ArrowLeft"===e.key&&w&&l&&i)&&(e.preventDefault(),i()):(e.preventDefault(),o())},onClick:e=>{y?.onClick?.(e),e.defaultPrevented||o?.()},className:["group/treerow relative flex min-h-8 select-none items-center gap-2 rounded-md px-2 py-1 text-sm",f?"cursor-grab active:cursor-grabbing":"cursor-pointer","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",$,"into"===p?"ring-2 ring-inset ring-[color:var(--rosh-drop-ring)]":"",g?"opacity-40":"",v].filter(Boolean).join(" "),children:["before"===p&&/* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -top-0.5 h-0.5 rounded-full bg-blue-500"}),"after"===p&&/* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -bottom-0.5 h-0.5 rounded-full bg-blue-500"}),f&&
551
- /* @__PURE__ */Ye(Uo,{marker:"tree",hint:b,dragging:g,revealClassName:"group-hover/treerow:opacity-100 group-focus-visible/treerow:opacity-100"}),
552
- /* @__PURE__ */Ye("span",w?{"aria-hidden":"true","data-tree-caret":"",onClick:e=>{e.stopPropagation(),i?.()},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-gray-200 hover:text-gray-900",children:(M=!!l,/* @__PURE__ */Ye(Pe,{name:"chevron-right","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3 transition-transform "+(M?"rotate-90":"")}))}:{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),null!=r&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0 items-center justify-center "+(s?"text-gray-400":""),children:r}),
553
- /* @__PURE__ */Ge("span",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[m??/* @__PURE__ */Ge("span",{className:`min-w-0 truncate ${a?"font-semibold":"font-medium"} ${s?"text-gray-400 line-through":""}`,children:[e,null!=n&&/* @__PURE__ */Ye("span",{className:"ml-2 font-normal text-gray-500",children:n})]}),null!=c&&!1!==c&&/* @__PURE__ */Ye("span",{className:"shrink-0 rounded bg-gray-100 px-1 py-0.5 text-2xs font-medium tabular-nums text-gray-500",children:c}),null!=d&&!h&&/* @__PURE__ */Ye("span",{"data-tree-actions":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:"ml-auto flex shrink-0 items-center gap-0.5 transition-opacity "+(u||s?"opacity-100":"opacity-0 group-hover/treerow:opacity-100 group-focus-within/treerow:opacity-100"),children:d})]}),null!=d&&h&&
554
- /* @__PURE__ */Ge("span",{"data-tree-actions":"","data-tree-actions-overlay":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),style:Qo,className:"absolute inset-y-0 right-0 grid rounded-r-md transition-opacity "+(u||s||a?"opacity-100":"pointer-events-none opacity-0 group-hover/treerow:pointer-events-auto group-hover/treerow:opacity-100 group-focus-within/treerow:pointer-events-auto group-focus-within/treerow:opacity-100"),children:[
545
+ return Ye("div",{role:"group",hidden:t,className:`ml-4 flex flex-col gap-1 border-l border-gray-200 pl-2 ${r}`.trim(),children:e})}var Jo=["inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full px-2","text-2xs font-medium normal-case tabular-nums tracking-normal","bg-[color:color-mix(in_srgb,var(--ink-faint)_12%,transparent)] text-gray-600"].join(" ");function Qo({children:e,count:t,expanded:r,onToggle:n}){const a=void 0!==r,l=/* @__PURE__ */Ye("span",{"data-tree-label-text":"",className:"min-w-0 flex-1 truncate text-left",children:e}),i=null!=t&&!1!==t&&/* @__PURE__ */Ye("span",{"data-tree-count":"",className:Jo,children:t}),o="text-xs font-semibold uppercase tracking-wide text-gray-500";return a?/* @__PURE__ */Ye("div",{role:"presentation",className:"pb-1 pt-3",children:/* @__PURE__ */Ge("button",{type:"button","aria-expanded":r,onClick:n,className:["flex w-full items-center gap-2 rounded-md px-2 hover:text-gray-900","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",o].join(" "),children:[
546
+ /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-caret":"",className:"flex h-4 w-4 shrink-0 items-center justify-center",children:es(!!r)}),l,i]})}):/* @__PURE__ */Ge("div",{role:"presentation",className:`flex items-center gap-2 px-2 pb-1 pt-3 ${o}`,children:[
547
+ /* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),l,i]})}var es=e=>/* @__PURE__ */Ye(Pe,{name:"chevron-right","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3 transition-transform "+(e?"rotate-90":"")}),ts={backgroundColor:"inherit",maskImage:"linear-gradient(to right, transparent, black 12px)",WebkitMaskImage:"linear-gradient(to right, transparent, black 12px)"};function rs({label:e,level:t=1,icon:r,preview:n,selected:a=!1,expanded:l,onToggle:i,onSelect:o,muted:s=!1,badge:c,actions:d,actionsPinned:u=!1,actionsOverlay:h=!0,rename:m,drop:p,dragging:g=!1,draggable:f=!1,dragHint:b,onMove:x,rowProps:y,className:v=""}){const w=void 0!==l,N=ze(),k=[y?.["aria-describedby"],x?N:void 0].filter(Boolean).join(" ")||void 0,$=a?"bg-blue-50 text-blue-700":"into"===p?"bg-blue-50 text-gray-900":"text-gray-700 hover:bg-gray-100";/* @__PURE__ */
548
+ return Ge("div",{...y,role:"treeitem","aria-level":t,"aria-selected":a,"aria-expanded":w?l:void 0,tabIndex:a?0:-1,"aria-keyshortcuts":y?.["aria-keyshortcuts"]??(x?_o:void 0),"aria-describedby":k,"data-drop":p,"data-draggable":f||void 0,onKeyDown:e=>{if(y?.onKeyDown?.(e),e.target!==e.currentTarget||e.defaultPrevented)return;const t=qo(e);t&&x?(e.preventDefault(),x(t)):"Enter"!==e.key&&" "!==e.key||!o?("ArrowRight"===e.key&&w&&!l&&i||"ArrowLeft"===e.key&&w&&l&&i)&&(e.preventDefault(),i()):(e.preventDefault(),o())},onClick:e=>{y?.onClick?.(e),e.defaultPrevented||o?.()},className:["group/treerow relative flex h-8 shrink-0 select-none items-center gap-2 rounded-md px-2 text-sm",f?"cursor-grab active:cursor-grabbing":"cursor-pointer","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",$,"into"===p?"ring-2 ring-inset ring-[color:var(--rosh-drop-ring)]":"",g?"opacity-40":"",v].filter(Boolean).join(" "),children:["before"===p&&/* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -top-0.5 h-0.5 rounded-full bg-blue-500"}),"after"===p&&/* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-drop-line":"",className:"pointer-events-none absolute inset-x-2 -bottom-0.5 h-0.5 rounded-full bg-blue-500"}),f&&
549
+ /* @__PURE__ */Ye(Uo,{marker:"tree",hint:b,dragging:g,revealClassName:"group-hover/treerow:opacity-100"}),
550
+ /* @__PURE__ */Ye("span",w?{"aria-hidden":"true","data-tree-caret":"",onClick:e=>{e.stopPropagation(),i?.()},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-gray-200 hover:text-gray-900",children:es(!!l)}:{"aria-hidden":"true",className:"h-4 w-4 shrink-0"}),null!=r&&/* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0 items-center justify-center "+(s?"text-gray-400":""),children:r}),
551
+ /* @__PURE__ */Ge("span",{className:"relative flex min-w-0 flex-1 items-center gap-2",children:[m??/* @__PURE__ */Ge("span",{className:`min-w-0 truncate ${a?"font-semibold":"font-medium"} ${s?"text-gray-400 line-through":""}`,children:[e,null!=n&&/* @__PURE__ */Ye("span",{className:"ml-2 font-normal text-gray-500",children:n})]}),null!=c&&!1!==c&&/* @__PURE__ */Ye("span",{"data-tree-count":"",className:Jo,children:c}),null!=d&&!h&&/* @__PURE__ */Ye("span",{"data-tree-actions":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),className:"ml-auto flex shrink-0 items-center gap-0.5 transition-opacity "+(u||s?"opacity-100":"opacity-0 group-hover/treerow:opacity-100 group-focus-within/treerow:opacity-100"),children:d})]}),null!=d&&h&&
552
+ /* @__PURE__ */Ge("span",{"data-tree-actions":"","data-tree-actions-overlay":"",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),style:ts,className:"absolute inset-y-0 right-0 grid rounded-r-md transition-opacity "+(u||s||a?"opacity-100":"pointer-events-none opacity-0 group-hover/treerow:pointer-events-auto group-hover/treerow:opacity-100 group-focus-within/treerow:pointer-events-auto group-focus-within/treerow:opacity-100"),children:[
555
553
  /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-actions-scrim":"",className:"col-start-1 row-start-1",style:{background:"var(--rosh-tree-ground, var(--surface))"}}),
556
554
  /* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"col-start-1 row-start-1",style:{backgroundColor:"inherit"}}),
557
- /* @__PURE__ */Ye("span",{className:"col-start-1 row-start-1 flex items-center gap-0.5 pl-4 pr-2",children:d})]}),x&&/* @__PURE__ */Ye(Vo,{id:N})]});var M}function ts({onAdd:e,label:t,drop:r=!1,slotProps:n}){const a=he().tree,l=r?a.dropHere:t??a.empty,i="flex min-h-8 w-full items-center gap-2 rounded-md border border-dashed px-3 text-sm "+(r?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 text-gray-500");/* @__PURE__ */
555
+ /* @__PURE__ */Ye("span",{className:"col-start-1 row-start-1 flex items-center gap-0.5 pl-4 pr-2",children:d})]}),x&&/* @__PURE__ */Ye(Vo,{id:N})]})}function ns({onAdd:e,label:t,drop:r=!1,slotProps:n}){const a=he().tree,l=r?a.dropHere:t??a.empty,i="flex min-h-8 w-full items-center gap-2 rounded-md border border-dashed px-3 text-sm "+(r?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-300 text-gray-500");/* @__PURE__ */
558
556
  return Ye("div",{...n,role:"presentation","data-drop":r||void 0,children:e?/* @__PURE__ */Ge("button",{type:"button",onClick:e,className:`${i} text-left hover:bg-gray-100 hover:text-gray-900 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]`,children:[
559
- /* @__PURE__ */Ye("span",{"aria-hidden":"true",children:"+"}),l]}):/* @__PURE__ */Ye("span",{className:i,children:l})})}function rs({onInsert:e,label:t,drop:r=!1,seamProps:n}){const a=he().tree,l=t??a.insertHere,i=r?"opacity-100":e?"opacity-0 group-hover/seam:opacity-100 group-focus-within/seam:opacity-100":"opacity-0";/* @__PURE__ */
557
+ /* @__PURE__ */Ye("span",{"aria-hidden":"true",children:"+"}),l]}):/* @__PURE__ */Ye("span",{className:i,children:l})})}function as({onInsert:e,label:t,drop:r=!1,seamProps:n}){const a=he().tree,l=t??a.insertHere,i=r?"opacity-100":e?"opacity-0 group-hover/seam:opacity-100 group-focus-within/seam:opacity-100":"opacity-0";/* @__PURE__ */
560
558
  return Ge("div",{...n,role:"presentation","data-tree-seam":"","data-drop":r||void 0,className:`group/seam relative z-10 -my-1 h-1 shrink-0 ${n?.className??""}`.trim(),children:[
561
559
  /* @__PURE__ */Ye("span",{"aria-hidden":"true",className:"absolute inset-x-0 -bottom-1 -top-1"}),
562
- /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-seam-line":"",className:`pointer-events-none absolute inset-x-2 top-1/2 h-0.5 -translate-y-1/2 rounded-full bg-blue-500 transition-opacity ${i}`}),e&&/* @__PURE__ */Ye(C,{content:l,className:"absolute left-1/2 top-1/2 inline-flex -translate-x-1/2 -translate-y-1/2",children:/* @__PURE__ */Ye("button",{type:"button","aria-label":l,onClick:e,className:"flex h-5 w-5 items-center justify-center rounded-full bg-blue-600 text-white transition rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(r?"scale-75 opacity-0":"scale-75 opacity-0 group-hover/seam:scale-100 group-hover/seam:opacity-100 focus-visible:scale-100 focus-visible:opacity-100"),children:/* @__PURE__ */Ye(Pe,{name:"add","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3"})})})]})}var ns=Oe("compact");function as({"aria-label":e,"aria-labelledby":t,children:r,spacing:n="compact",className:a="",rootProps:l}){/* @__PURE__ */
563
- return Ye(ns.Provider,{value:n,children:/* @__PURE__ */Ye("div",{...l,role:"list","aria-label":t?void 0:e,"aria-labelledby":t,"data-sortable-list":n,className:`flex min-w-0 flex-col ${"comfortable"===n?"gap-2":"gap-1"} ${a}`.trim(),children:r})})}function ls({children:e,actions:t,below:r,active:n=!1,flat:a=!1,draggable:l=!1,dragHint:i,dragging:o=!1,drop:s,onMove:c,rowProps:d,rowRef:u,className:h=""}){const m=qe(ns),p=Be(null),g=je(),f=[d?.["aria-describedby"],c?g:void 0].filter(Boolean).join(" ")||void 0,b=d?.tabIndex;re(()=>{const e=p.current;if(!e||void 0!==b)return;const t=[...e.querySelectorAll('a[href], button, input, select, textarea, [contenteditable]:not([contenteditable="false"]), [tabindex]')].some(t=>t!==e);c&&!t?e.tabIndex=0:e.removeAttribute("tabindex")});/* @__PURE__ */
560
+ /* @__PURE__ */Ye("span",{"aria-hidden":"true","data-tree-seam-line":"",className:`pointer-events-none absolute inset-x-2 top-1/2 h-0.5 -translate-y-1/2 rounded-full bg-blue-500 transition-opacity ${i}`}),e&&/* @__PURE__ */Ye(C,{content:l,className:"absolute left-1/2 top-1/2 inline-flex -translate-x-1/2 -translate-y-1/2",children:/* @__PURE__ */Ye("button",{type:"button","aria-label":l,onClick:e,className:"flex h-5 w-5 items-center justify-center rounded-full bg-blue-600 text-white transition rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(r?"scale-75 opacity-0":"scale-75 opacity-0 group-hover/seam:scale-100 group-hover/seam:opacity-100 focus-visible:scale-100 focus-visible:opacity-100"),children:/* @__PURE__ */Ye(Pe,{name:"add","aria-hidden":"true",strokeWidth:2.6,className:"h-3 w-3"})})})]})}var ls=Oe("compact");function is({"aria-label":e,"aria-labelledby":t,children:r,spacing:n="compact",className:a="",rootProps:l}){/* @__PURE__ */
561
+ return Ye(ls.Provider,{value:n,children:/* @__PURE__ */Ye("div",{...l,role:"list","aria-label":t?void 0:e,"aria-labelledby":t,"data-sortable-list":n,className:`flex min-w-0 flex-col ${"comfortable"===n?"gap-2":"gap-1"} ${a}`.trim(),children:r})})}function os({children:e,actions:t,below:r,active:n=!1,flat:a=!1,draggable:l=!1,dragHint:i,dragging:o=!1,drop:s,onMove:c,rowProps:d,rowRef:u,className:h=""}){const m=_e(ls),p=Be(null),g=ze(),f=[d?.["aria-describedby"],c?g:void 0].filter(Boolean).join(" ")||void 0,b=d?.tabIndex;re(()=>{const e=p.current;if(!e||void 0!==b)return;const t=[...e.querySelectorAll('a[href], button, input, select, textarea, [contenteditable]:not([contenteditable="false"]), [tabindex]')].some(t=>t!==e);c&&!t?e.tabIndex=0:e.removeAttribute("tabindex")});/* @__PURE__ */
564
562
  return Ge("div",{role:"listitem","data-list-item":"","data-drop":s,className:"relative flex min-w-0 flex-col",children:[s&&/* @__PURE__ */Ye("span",{"aria-hidden":"true","data-list-drop-line":"",className:`pointer-events-none absolute inset-x-2 z-10 h-0.5 rounded-full bg-blue-500 ${("comfortable"===m?{before:"-top-[5px]",after:"-bottom-[5px]"}:{before:"-top-0.5",after:"-bottom-0.5"})[s]}`}),
565
- /* @__PURE__ */Ge("div",{...d,ref:e=>{var t,r;p.current=e,r=e,"function"==typeof(t=u)?t(r):t&&(t.current=r)},"data-list-row":"","data-active":n||void 0,"data-draggable":l||void 0,"aria-keyshortcuts":d?.["aria-keyshortcuts"]??(c?qo:void 0),"aria-describedby":f,onKeyDown:e=>{if(d?.onKeyDown?.(e),e.defaultPrevented||!c)return;const t=Ho(e);t&&!e.target.closest?.("select")&&(e.preventDefault(),c(t))},className:["group/listrow relative flex min-h-8 min-w-0 items-center gap-1 rounded-md pl-3 text-sm",l?"cursor-grab active:cursor-grabbing":"","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",null!=t&&!1!==t?"":"pr-2",n?"bg-gray-100":a?"":"hover:bg-gray-100",o?"opacity-40":"",h].filter(Boolean).join(" "),children:[l&&/* @__PURE__ */Ye(Uo,{marker:"list",hint:i,dragging:o,revealClassName:"group-hover/listrow:opacity-100 group-focus-within/listrow:opacity-100"}),
566
- /* @__PURE__ */Ye("div",{"data-list-row-main":"",className:"flex min-h-8 min-w-0 flex-1 items-center gap-1",children:e}),null!=t&&!1!==t&&/* @__PURE__ */Ye("div",{"data-list-actions":"",className:"flex shrink-0 items-center gap-0.5",children:t}),c&&/* @__PURE__ */Ye(Vo,{id:g})]}),null!=r&&!1!==r&&/* @__PURE__ */Ye("div",{"data-list-below":"",children:r})]})}var is=Oe({labels:"none",shown:"none"}),os="button[data-icon-rail-button]:not([disabled])";function ss(e,t,r){const n=getComputedStyle(e),a=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0)+(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),l="horizontal"===t?(parseFloat(n.columnGap)||0)*Math.max(0,r-1):0,i=e.parentElement;let o=1/0;if(i){const e=getComputedStyle(i);o=i.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)}return{chrome:a+l,room:o}}function cs({"aria-label":e,orientation:t="vertical",children:r,className:n="",labels:a="none",labelsFit:l=!1,onLabelsShown:i}){const o=Be(null),s="none"!==a&&l,[c,d]=Ee(null),u="none"===a?"none":s?c??"none":"all",h=Be(()=>{});h.current=()=>{const e=o.current;if(!e||!s)return;const r=function(e,t){return[...e.querySelectorAll("button[data-icon-rail-button]")].map(e=>{const r=getComputedStyle(e),n=(parseFloat(r.paddingLeft)||0)+(parseFloat(r.paddingRight)||0)+(parseFloat(r.borderLeftWidth)||0)+(parseFloat(r.borderRightWidth)||0),a=parseFloat(r.minWidth)||0,l=e.querySelector("[data-icon-rail-glyph]")?.getBoundingClientRect().width??0,i=e.querySelector("[data-icon-rail-word]")?.scrollWidth??0;return{bare:Math.max(a,n+l),worded:"below"===t?Math.max(a,n+Math.max(l,i)):Math.max(a,n+l+8+i),active:"true"===e.getAttribute("aria-pressed")}})}(e,a);d(function({buttons:e,orientation:t,chrome:r,room:n}){if(0===e.length)return"none";const a=n=>{const a=e.map(e=>n(e)?e.worded:e.bare);return r+("horizontal"===t?a.reduce((e,t)=>e+t,0):Math.max(...a))};return a(()=>!0)<=n+.5?"all":e.some(e=>e.active)&&a(e=>e.active)<=n+.5?"chosen":"none"}({buttons:r,orientation:t,...ss(e,t,r.length)}))},re(()=>{h.current()}),Ie(()=>{const e=o.current?.parentElement;if(!s||!e)return;let t=!0;const r=()=>{t&&h.current()},n="undefined"==typeof ResizeObserver?void 0:ResizeObserver,a=n?new n(r):null;return a?.observe(e),document.fonts?.ready.then(r,()=>{}),()=>{t=!1,a?.disconnect()}},[s]);const m=Be(null),p=Be(i);p.current=i,Ie(()=>{s&&null!==c&&m.current!==c&&(m.current=c,p.current?.(c))},[s,c]),re(()=>{const e=o.current;if(!e)return;const t=[...e.querySelectorAll(os)];if(0===t.length)return;const r=t.find(e=>e===document.activeElement)??t.find(e=>"true"===e.getAttribute("aria-pressed"))??t[0];for(const t of e.querySelectorAll("button[data-icon-rail-button]"))t.tabIndex=t===r?0:-1});/* @__PURE__ */
567
- return Ye("div",{ref:o,role:"toolbar","aria-label":e,"aria-orientation":t,"data-orientation":t,onKeyDown:e=>{const r=o.current;if(!r)return;const n=[...r.querySelectorAll(os)],a=n.indexOf(e.target);if(a<0)return;const l="vertical"===t?"ArrowUp":"ArrowLeft",i="vertical"===t?"ArrowDown":"ArrowRight",s=e.key===i?(a+1)%n.length:e.key===l?(a-1+n.length)%n.length:"Home"===e.key?0:"End"===e.key?n.length-1:-1;if(!(s<0)){e.preventDefault();for(const e of n)e.tabIndex=e===n[s]?0:-1;n[s].focus()}},"data-labels":"none"===a?void 0:a,"data-labels-shown":"none"===a?void 0:u,className:`flex gap-1 ${"vertical"===t?"flex-col items-center":"flex-row items-center"} ${n}`.trim(),children:/* @__PURE__ */Ye(is.Provider,{value:{labels:a,shown:u},children:r})})}function ds({label:e,icon:t,active:r,disabled:n,onClick:a,badge:l,tooltipSide:i="right",className:o=""}){const s=!0===r,{labels:c,shown:d}=qe(is),u=void 0===l||!1===l||0===l?t:/* @__PURE__ */Ye(vl,{count:"number"==typeof l?l:void 0,dot:!0===l,max:99,children:t}),h="none"!==c,m=h&&("all"===d||"chosen"===d&&s),p=/* @__PURE__ */Ye("button",{type:"button","data-icon-rail-button":"","aria-label":e,"aria-pressed":"boolean"==typeof r?r:void 0,disabled:n,onClick:n?void 0:a,className:[`relative inline-flex ${h?"beside"===c?"h-9 min-w-9 justify-center px-2":"min-h-9 min-w-9 flex-col justify-center px-1 py-1":"h-9 w-9 justify-center"} shrink-0 items-center rounded-lg transition-colors`,"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-40",s?"bg-blue-50 text-blue-700":"text-gray-600 hover:bg-gray-100 hover:text-gray-900",o].filter(Boolean).join(" "),children:h?/* @__PURE__ */Ge(Xe,{children:[
563
+ /* @__PURE__ */Ge("div",{...d,ref:e=>{var t,r;p.current=e,r=e,"function"==typeof(t=u)?t(r):t&&(t.current=r)},"data-list-row":"","data-active":n||void 0,"data-draggable":l||void 0,"aria-keyshortcuts":d?.["aria-keyshortcuts"]??(c?_o:void 0),"aria-describedby":f,onKeyDown:e=>{if(d?.onKeyDown?.(e),e.defaultPrevented||!c)return;const t=qo(e);t&&!e.target.closest?.("select")&&(e.preventDefault(),c(t))},className:["group/listrow relative flex min-h-8 min-w-0 items-center gap-1 rounded-md pl-3 text-sm",l?"cursor-grab active:cursor-grabbing":"","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",null!=t&&!1!==t?"":"pr-2",n?"bg-gray-100":a?"":"hover:bg-gray-100",o?"opacity-40":"",h].filter(Boolean).join(" "),children:[l&&/* @__PURE__ */Ye(Uo,{marker:"list",hint:i,dragging:o,revealClassName:"group-hover/listrow:opacity-100 group-focus-within/listrow:opacity-100"}),
564
+ /* @__PURE__ */Ye("div",{"data-list-row-main":"",className:"flex min-h-8 min-w-0 flex-1 items-center gap-1",children:e}),null!=t&&!1!==t&&/* @__PURE__ */Ye("div",{"data-list-actions":"",className:"flex shrink-0 items-center gap-0.5",children:t}),c&&/* @__PURE__ */Ye(Vo,{id:g})]}),null!=r&&!1!==r&&/* @__PURE__ */Ye("div",{"data-list-below":"",children:r})]})}var ss=Oe({labels:"none",shown:"none"}),cs="button[data-icon-rail-button]:not([disabled])";function ds(e,t,r){const n=getComputedStyle(e),a=(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0)+(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0),l="horizontal"===t?(parseFloat(n.columnGap)||0)*Math.max(0,r-1):0,i=e.parentElement;let o=1/0;if(i){const e=getComputedStyle(i);o=i.clientWidth-(parseFloat(e.paddingLeft)||0)-(parseFloat(e.paddingRight)||0)}return{chrome:a+l,room:o}}function us({"aria-label":e,orientation:t="vertical",children:r,className:n="",labels:a="none",labelsFit:l=!1,onLabelsShown:i}){const o=Be(null),s="none"!==a&&l,[c,d]=Ee(null),u="none"===a?"none":s?c??"none":"all",h=Be(()=>{});h.current=()=>{const e=o.current;if(!e||!s)return;const r=function(e,t){return[...e.querySelectorAll("button[data-icon-rail-button]")].map(e=>{const r=getComputedStyle(e),n=(parseFloat(r.paddingLeft)||0)+(parseFloat(r.paddingRight)||0)+(parseFloat(r.borderLeftWidth)||0)+(parseFloat(r.borderRightWidth)||0),a=parseFloat(r.minWidth)||0,l=e.querySelector("[data-icon-rail-glyph]")?.getBoundingClientRect().width??0,i=e.querySelector("[data-icon-rail-word]")?.scrollWidth??0;return{bare:Math.max(a,n+l),worded:"below"===t?Math.max(a,n+Math.max(l,i)):Math.max(a,n+l+8+i),active:"true"===e.getAttribute("aria-pressed")}})}(e,a);d(function({buttons:e,orientation:t,chrome:r,room:n}){if(0===e.length)return"none";const a=n=>{const a=e.map(e=>n(e)?e.worded:e.bare);return r+("horizontal"===t?a.reduce((e,t)=>e+t,0):Math.max(...a))};return a(()=>!0)<=n+.5?"all":e.some(e=>e.active)&&a(e=>e.active)<=n+.5?"chosen":"none"}({buttons:r,orientation:t,...ds(e,t,r.length)}))},re(()=>{h.current()}),Ie(()=>{const e=o.current?.parentElement;if(!s||!e)return;let t=!0;const r=()=>{t&&h.current()},n="undefined"==typeof ResizeObserver?void 0:ResizeObserver,a=n?new n(r):null;return a?.observe(e),document.fonts?.ready.then(r,()=>{}),()=>{t=!1,a?.disconnect()}},[s]);const m=Be(null),p=Be(i);p.current=i,Ie(()=>{s&&null!==c&&m.current!==c&&(m.current=c,p.current?.(c))},[s,c]),re(()=>{const e=o.current;if(!e)return;const t=[...e.querySelectorAll(cs)];if(0===t.length)return;const r=t.find(e=>e===document.activeElement)??t.find(e=>"true"===e.getAttribute("aria-pressed"))??t[0];for(const t of e.querySelectorAll("button[data-icon-rail-button]"))t.tabIndex=t===r?0:-1});/* @__PURE__ */
565
+ return Ye("div",{ref:o,role:"toolbar","aria-label":e,"aria-orientation":t,"data-orientation":t,onKeyDown:e=>{const r=o.current;if(!r)return;const n=[...r.querySelectorAll(cs)],a=n.indexOf(e.target);if(a<0)return;const l="vertical"===t?"ArrowUp":"ArrowLeft",i="vertical"===t?"ArrowDown":"ArrowRight",s=e.key===i?(a+1)%n.length:e.key===l?(a-1+n.length)%n.length:"Home"===e.key?0:"End"===e.key?n.length-1:-1;if(!(s<0)){e.preventDefault();for(const e of n)e.tabIndex=e===n[s]?0:-1;n[s].focus()}},"data-labels":"none"===a?void 0:a,"data-labels-shown":"none"===a?void 0:u,className:`flex gap-1 ${"vertical"===t?"flex-col items-center":"flex-row items-center"} ${n}`.trim(),children:/* @__PURE__ */Ye(ss.Provider,{value:{labels:a,shown:u},children:r})})}function hs({label:e,icon:t,active:r,disabled:n,onClick:a,badge:l,tooltipSide:i="right",className:o=""}){const s=!0===r,{labels:c,shown:d}=_e(ss),u=void 0===l||!1===l||0===l?t:/* @__PURE__ */Ye(vl,{count:"number"==typeof l?l:void 0,dot:!0===l,max:99,children:t}),h="none"!==c,m=h&&("all"===d||"chosen"===d&&s),p=/* @__PURE__ */Ye("button",{type:"button","data-icon-rail-button":"","aria-label":e,"aria-pressed":"boolean"==typeof r?r:void 0,disabled:n,onClick:n?void 0:a,className:[`relative inline-flex ${h?"beside"===c?"h-9 min-w-9 justify-center px-2":"min-h-9 min-w-9 flex-col justify-center px-1 py-1":"h-9 w-9 justify-center"} shrink-0 items-center rounded-lg transition-colors`,"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-40",s?"bg-blue-50 text-blue-700":"text-gray-600 hover:bg-gray-100 hover:text-gray-900",o].filter(Boolean).join(" "),children:h?/* @__PURE__ */Ge(Xe,{children:[
568
566
  /* @__PURE__ */Ye("span",{"data-icon-rail-glyph":"",className:"inline-flex shrink-0 items-center justify-center",children:u}),
569
567
  /* @__PURE__ */Ye("span",{"data-icon-rail-word":"","aria-hidden":"true",className:["overflow-hidden whitespace-nowrap text-xs font-medium leading-none",m?"beside"===c?"ml-2":"mt-1":"max-h-0 max-w-0"].join(" "),children:e})]}):u});/* @__PURE__ */
570
- return Ye(C,{content:e,side:i,children:p})}var us=6e4;function hs({currentVersion:e,versionUrl:t="/version.json",pollMs:r=6e4}){const[n,a]=Ee(null);return Ie(()=>{if(!e||null!==n)return;let l=!1;const i=async()=>{if("undefined"==typeof document||"hidden"!==document.visibilityState)try{const r=t.includes("?")?"&":"?",n=await fetch(`${t}${r}t=${Date.now()}`,{cache:"no-store"});if(!n.ok)return;const i=await n.json(),o=i&&"object"==typeof i&&"string"==typeof i.version?i.version:null;!l&&o&&o!==e&&a(o)}catch{}};i();const o=setInterval(()=>{i()},r),s=()=>{"visible"===document.visibilityState&&i()};return document.addEventListener("visibilitychange",s),()=>{l=!0,clearInterval(o),document.removeEventListener("visibilitychange",s)}},[e,t,r,n]),n}function ms({currentVersion:e,versionUrl:t,pollMs:r,message:n,onRefresh:a,className:l=""}){const i=hs({currentVersion:e,versionUrl:t,pollMs:r}),o=he();if(null===i)return null;const s=a??(()=>window.location.reload());/* @__PURE__ */
571
- return Ye("div",{"data-app-update-banner":"",className:`fixed left-1/2 top-3 z-(--z-toast) w-max max-w-[calc(100vw-1.5rem)] -translate-x-1/2 ${l}`.trim(),children:/* @__PURE__ */Ge(zl,{tone:"warning",className:"shadow-lg",action:/* @__PURE__ */Ye(M,{type:"button",variant:"primary",size:"md",onClick:s,children:o.update.refreshNow}),children:[
568
+ return Ye(C,{content:e,side:i,children:p})}var ms=6e4;function ps({currentVersion:e,versionUrl:t="/version.json",pollMs:r=6e4}){const[n,a]=Ee(null);return Ie(()=>{if(!e||null!==n)return;let l=!1;const i=async()=>{if("undefined"==typeof document||"hidden"!==document.visibilityState)try{const r=t.includes("?")?"&":"?",n=await fetch(`${t}${r}t=${Date.now()}`,{cache:"no-store"});if(!n.ok)return;const i=await n.json(),o=i&&"object"==typeof i&&"string"==typeof i.version?i.version:null;!l&&o&&o!==e&&a(o)}catch{}};i();const o=setInterval(()=>{i()},r),s=()=>{"visible"===document.visibilityState&&i()};return document.addEventListener("visibilitychange",s),()=>{l=!0,clearInterval(o),document.removeEventListener("visibilitychange",s)}},[e,t,r,n]),n}function gs({currentVersion:e,versionUrl:t,pollMs:r,message:n,onRefresh:a,className:l=""}){const i=ps({currentVersion:e,versionUrl:t,pollMs:r}),o=he();if(null===i)return null;const s=a??(()=>window.location.reload());/* @__PURE__ */
569
+ return Ye("div",{"data-app-update-banner":"",className:`fixed left-1/2 top-3 z-(--z-toast) w-max max-w-[calc(100vw-1.5rem)] -translate-x-1/2 ${l}`.trim(),children:/* @__PURE__ */Ge(jl,{tone:"warning",className:"shadow-lg",action:/* @__PURE__ */Ye(M,{type:"button",variant:"primary",size:"md",onClick:s,children:o.update.refreshNow}),children:[
572
570
  /* @__PURE__ */Ye("span",{className:"font-medium",children:n??o.update.available}),
573
- /* @__PURE__ */Ge("span",{className:"ml-2 whitespace-nowrap font-mono text-xs text-gray-500",children:[e," → ",i]})]})})}var ps={sm:"sm:w-[320px]",md:"sm:w-[448px]",lg:"sm:w-[640px]"},gs={right:"inset-y-0 right-0",left:"inset-y-0 left-0",bottom:"inset-x-0 bottom-0"};function fs({onClose:e}){const t=he().dialog;/* @__PURE__ */
574
- return Ye("button",{type:"button",onClick:e,"aria-label":t.close,className:"rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */Ye(Pe,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})}function bs({open:e,onClose:t,side:r="right",size:n="md",title:a,description:l,footer:i,children:o,blocking:s=!1,initialFocus:c,"aria-label":d,"aria-labelledby":u,"aria-describedby":h,className:m=""}){const p=Be(null),g=je(),f=je(),b=je();if(V(e),B(p,e,c),T(e),Ie(()=>{if(e)return Q(()=>(s||t(),!0),()=>p.current)},[e,s,t]),!e)return null;const x="bottom"===r,y=x?{maxHeight:"85vh"}:void 0;/* @__PURE__ */
571
+ /* @__PURE__ */Ge("span",{className:"ml-2 whitespace-nowrap font-mono text-xs text-gray-500",children:[e," → ",i]})]})})}var fs={sm:"sm:w-[320px]",md:"sm:w-[448px]",lg:"sm:w-[640px]"},bs={right:"inset-y-0 right-0",left:"inset-y-0 left-0",bottom:"inset-x-0 bottom-0"};function xs({onClose:e}){const t=he().dialog;/* @__PURE__ */
572
+ return Ye("button",{type:"button",onClick:e,"aria-label":t.close,className:"rounded-(--radius-control) p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */Ye(Pe,{name:"close",className:"h-5 w-5",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true"})})}function ys({open:e,onClose:t,side:r="right",size:n="md",title:a,description:l,footer:i,children:o,blocking:s=!1,initialFocus:c,"aria-label":d,"aria-labelledby":u,"aria-describedby":h,className:m=""}){const p=Be(null),g=ze(),f=ze(),b=ze();if(V(e),B(p,e,c),T(e),Ie(()=>{if(e)return Q(()=>(s||t(),!0),()=>p.current)},[e,s,t]),!e)return null;const x="bottom"===r,y=x?{maxHeight:"85vh"}:void 0;/* @__PURE__ */
575
573
  return Ge("div",{className:"fixed inset-0",style:{zIndex:te.overlay},role:"presentation",children:[
576
574
  /* @__PURE__ */Ye("div",{className:"fixed inset-0 bg-black/30",onClick:s?void 0:t,"aria-hidden":"true"}),
577
- /* @__PURE__ */Ge("div",{ref:p,...I({modal:!0,titleId:a?b:void 0,labelledBy:u,label:d}),"aria-describedby":h??(l?f:o?g:void 0),style:y,className:["fixed flex flex-col bg-white shadow-xl",x?"":`w-full max-w-full ${ps[n]}`,gs[r],x?"rounded-t-xl":"",m].filter(Boolean).join(" "),children:[a?/* @__PURE__ */Ge("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3",children:[
575
+ /* @__PURE__ */Ge("div",{ref:p,...I({modal:!0,titleId:a?b:void 0,labelledBy:u,label:d}),"aria-describedby":h??(l?f:o?g:void 0),style:y,className:["fixed flex flex-col bg-white shadow-xl",x?"":`w-full max-w-full ${fs[n]}`,bs[r],x?"rounded-t-xl":"",m].filter(Boolean).join(" "),children:[a?/* @__PURE__ */Ge("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-gray-100 px-4 py-3",children:[
578
576
  /* @__PURE__ */Ge("div",{className:"min-w-0",children:[
579
- /* @__PURE__ */Ye("h2",{id:b,className:"text-base font-semibold text-gray-900",children:a}),l&&/* @__PURE__ */Ye("p",{id:f,className:"mt-0.5 text-sm text-gray-500",children:l})]}),!s&&/* @__PURE__ */Ye(fs,{onClose:t})]}):!s&&/* @__PURE__ */Ye("div",{className:"absolute right-2 top-2 z-10",children:/* @__PURE__ */Ye(fs,{onClose:t})}),
580
- /* @__PURE__ */Ge("div",{id:g,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[l&&!a&&/* @__PURE__ */Ye("p",{id:f,className:("mb-3 text-sm text-gray-500 "+(s?"":"pr-8")).trim(),children:l}),o]}),i&&/* @__PURE__ */Ye("div",{className:"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3",children:i})]})]})}function xs({items:e,columns:t,columnOf:r,getId:n,onMove:a,renderCard:l,onCardClick:i,sortInColumn:o,isLoading:s=!1,loadingText:c,emptyState:d,showColumnsWhenEmpty:u=!1,columnEmptyText:h,onAddItem:m,addItemText:p}){const g=he().kanban,f=ue(),b=c??g.loading,x=h??g.dropHere,y=p??g.addItem,[v,w]=Ee(null),[N,k]=Ee(null),$=Te(()=>{const n={};for(const e of t)n[e.value]=[];for(const t of e)(n[r(t)]??=[]).push(t);if(o)for(const e of Object.keys(n))n[e].sort(o);return n},[e,t,r,o]),M=()=>{w(null),k(null)},C=Be(null),L=Be(/* @__PURE__ */new Map);re(()=>{if(null!==v)return;const e=C.current;if(!e)return;const t=/* @__PURE__ */new Map,r=[];if(e.querySelectorAll("[data-kanban-card]").forEach(e=>{const n=e.dataset.kanbanCard,a=e.getBoundingClientRect();t.set(n,a);const l=L.current.get(n);if(l){const t=l.left-a.left,n=l.top-a.top;(t||n)&&r.push([e,t,n])}}),L.current=t,r.length){for(const[e,t,n]of r)e.style.transition="none",e.style.transform=`translate(${t}px, ${n}px)`;requestAnimationFrame(()=>{for(const[e]of r)e.style.transition="transform 200ms cubic-bezier(0.2, 0, 0, 1)",e.style.transform="",e.addEventListener("transitionend",()=>{e.style.transition="",e.style.transform=""},{once:!0})})}},[$,v]);return s?/* @__PURE__ */Ye("div",{className:"text-sm text-gray-500 p-4",children:b}):0!==e.length||u?/* @__PURE__ */Ye("div",{ref:C,className:"flex-1 overflow-x-auto grid-scroll",children:/* @__PURE__ */Ye("div",{className:"flex gap-3 h-full min-w-max pb-2",children:t.map(e=>{const t=$[e.value]??[],r=null!==N&&N.col===e.value,o=null!==v?t.findIndex(e=>n(e)===v):-1,s=r&&(-1===o||N.index!==o&&N.index!==o+1)?N.index:-1;/* @__PURE__ */
577
+ /* @__PURE__ */Ye("h2",{id:b,className:"text-base font-semibold text-gray-900",children:a}),l&&/* @__PURE__ */Ye("p",{id:f,className:"mt-0.5 text-sm text-gray-500",children:l})]}),!s&&/* @__PURE__ */Ye(xs,{onClose:t})]}):!s&&/* @__PURE__ */Ye("div",{className:"absolute right-2 top-2 z-10",children:/* @__PURE__ */Ye(xs,{onClose:t})}),
578
+ /* @__PURE__ */Ge("div",{id:g,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[l&&!a&&/* @__PURE__ */Ye("p",{id:f,className:("mb-3 text-sm text-gray-500 "+(s?"":"pr-8")).trim(),children:l}),o]}),i&&/* @__PURE__ */Ye("div",{className:"flex shrink-0 justify-end gap-3 border-t border-gray-100 px-4 py-3",children:i})]})]})}function vs({items:e,columns:t,columnOf:r,getId:n,onMove:a,renderCard:l,onCardClick:i,sortInColumn:o,isLoading:s=!1,loadingText:c,emptyState:d,showColumnsWhenEmpty:u=!1,columnEmptyText:h,onAddItem:m,addItemText:p}){const g=he().kanban,f=ue(),b=c??g.loading,x=h??g.dropHere,y=p??g.addItem,[v,w]=Ee(null),[N,k]=Ee(null),$=Te(()=>{const n={};for(const e of t)n[e.value]=[];for(const t of e)(n[r(t)]??=[]).push(t);if(o)for(const e of Object.keys(n))n[e].sort(o);return n},[e,t,r,o]),M=()=>{w(null),k(null)},C=Be(null),L=Be(/* @__PURE__ */new Map);re(()=>{if(null!==v)return;const e=C.current;if(!e)return;const t=/* @__PURE__ */new Map,r=[];if(e.querySelectorAll("[data-kanban-card]").forEach(e=>{const n=e.dataset.kanbanCard,a=e.getBoundingClientRect();t.set(n,a);const l=L.current.get(n);if(l){const t=l.left-a.left,n=l.top-a.top;(t||n)&&r.push([e,t,n])}}),L.current=t,r.length){for(const[e,t,n]of r)e.style.transition="none",e.style.transform=`translate(${t}px, ${n}px)`;requestAnimationFrame(()=>{for(const[e]of r)e.style.transition="transform 200ms cubic-bezier(0.2, 0, 0, 1)",e.style.transform="",e.addEventListener("transitionend",()=>{e.style.transition="",e.style.transform=""},{once:!0})})}},[$,v]);return s?/* @__PURE__ */Ye("div",{className:"text-sm text-gray-500 p-4",children:b}):0!==e.length||u?/* @__PURE__ */Ye("div",{ref:C,className:"flex-1 overflow-x-auto grid-scroll",children:/* @__PURE__ */Ye("div",{className:"flex gap-3 h-full min-w-max pb-2",children:t.map(e=>{const t=$[e.value]??[],r=null!==N&&N.col===e.value,o=null!==v?t.findIndex(e=>n(e)===v):-1,s=r&&(-1===o||N.index!==o&&N.index!==o+1)?N.index:-1;/* @__PURE__ */
581
579
  return Ge("div",{className:"group flex flex-col w-72 shrink-0 rounded-xl bg-gray-50 border transition-colors "+(r?"border-blue-400 ring-2 ring-blue-300/60":"border-gray-200"),onDragOver:e=>{e.preventDefault();try{e.dataTransfer.dropEffect="move"}catch{}},onDrop:t=>{t.preventDefault(),(e=>{if(v&&N&&N.col===e){const t=($[e]??[]).findIndex(e=>n(e)===v),r=-1!==t;if(!r||N.index!==t&&N.index!==t+1){const n=r&&N.index>t?N.index-1:N.index;a(v,e,n)}}M()})(e.value)},children:[
582
580
  /* @__PURE__ */Ge("div",{className:`flex items-center justify-between px-3 py-2 rounded-t-xl text-sm font-medium ${e.accent??"text-gray-700 bg-gray-100"}`,children:[
583
581
  /* @__PURE__ */Ge("span",{className:"flex items-center gap-2",children:[
584
582
  /* @__PURE__ */Ye("span",{className:`h-2 w-2 rounded-full ${e.dot??"bg-gray-400"}`}),e.label]}),
585
583
  /* @__PURE__ */Ye("span",{className:"text-xs opacity-70",children:fe(t.length,f)})]}),
586
584
  /* @__PURE__ */Ge("div",{className:"flex-1 overflow-y-auto p-2 space-y-2 min-h-[120px]",onDragEnter:()=>k(r=>r&&r.col===e.value&&r.index===t.length?r:{col:e.value,index:t.length}),children:[t.map((r,a)=>{const o=n(r),c=o===v;/* @__PURE__ */
587
- return Ge(He,{children:[s===a&&/* @__PURE__ */Ye("div",{className:"h-0.5 rounded-full bg-blue-500","aria-hidden":!0}),
585
+ return Ge(qe,{children:[s===a&&/* @__PURE__ */Ye("div",{className:"h-0.5 rounded-full bg-blue-500","aria-hidden":!0}),
588
586
  /* @__PURE__ */Ye("div",{"data-kanban-card":o,draggable:!0,onDragStart:e=>{w(o);try{e.dataTransfer.effectAllowed="move"}catch{}},onDragEnter:r=>{r.stopPropagation();const l=null!==v?t.findIndex(e=>n(e)===v):-1,i=-1!==l&&l<a?a+1:a;k(t=>t&&t.col===e.value&&t.index===i?t:{col:e.value,index:i})},onDragEnd:M,onClick:i?()=>i(r):void 0,style:null===v?void 0:{opacity:c?.4:1,transition:"opacity 120ms ease"},className:"rounded-lg bg-white border border-gray-200 p-3 shadow-sm hover:border-blue-400 hover:shadow transition "+(i?"cursor-pointer":""),children:l(r)})]},o)}),t.length>0&&s===t.length&&/* @__PURE__ */Ye("div",{className:"h-0.5 rounded-full bg-blue-500","aria-hidden":!0}),0===t.length&&/* @__PURE__ */Ye("div",{className:"text-2xs text-center rounded-lg transition-all duration-150 "+(r?"border-2 border-dashed border-blue-300 bg-blue-50/50 text-blue-400 py-8":"text-gray-400 py-6"),children:x})]}),m&&/* @__PURE__ */Ye("div",{className:"p-2 pt-0",children:/* @__PURE__ */Ge("button",{type:"button",onClick:()=>m(e.value),className:"flex w-full items-center justify-center gap-1 rounded-lg px-2 min-h-8 py-1 text-xs font-medium text-gray-500 opacity-0 transition hover:bg-gray-100 hover:text-gray-700 focus-visible:opacity-100 group-hover:opacity-100",children:[
589
- /* @__PURE__ */Ye("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"+"}),y]})})]},e.value)})})}):/* @__PURE__ */Ye(Xe,{children:d??/* @__PURE__ */Ye("div",{className:"text-sm text-gray-500 p-4",children:g.empty})})}var ys="inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40";function vs({page:e,pageCount:t,onPageChange:r,siblingCount:n=1,showEdges:a=!1,className:l=""}){const i=he().pagination,o=ue();if(t<=1)return null;const s=function(e,t,r){const n=/* @__PURE__ */new Set([1,t]);for(let a=e-r;a<=e+r;a++)a>=1&&a<=t&&n.add(a);const a=[...n].sort((e,t)=>e-t),l=[];let i=0;for(const e of a)i&&e-i>1&&l.push("…"),l.push(e),i=e;return l}(e,t,n),c=n=>{n>=1&&n<=t&&n!==e&&r(n)};/* @__PURE__ */
590
- return Ge("nav",{"aria-label":i.label,className:`flex items-center gap-1 ${l}`.trim(),children:[a&&/* @__PURE__ */Ye("button",{type:"button","aria-label":i.first,disabled:1===e,onClick:()=>c(1),className:`${ys} text-gray-600 hover:bg-gray-100`,children:"«"}),
591
- /* @__PURE__ */Ye("button",{type:"button","aria-label":i.previous,disabled:1===e,onClick:()=>c(e-1),className:`${ys} text-gray-600 hover:bg-gray-100`,children:"‹"}),s.map((t,r)=>"…"===t?/* @__PURE__ */Ye("span",{className:"px-1 text-gray-400",children:"…"},`gap-${r}`):/* @__PURE__ */Ye("button",{type:"button","aria-current":t===e?"page":void 0,onClick:()=>c(t),className:`${ys} ${t===e?"bg-blue-600 font-medium text-white":"text-gray-700 hover:bg-gray-100"}`,children:fe(t,o)},t)),
592
- /* @__PURE__ */Ye("button",{type:"button","aria-label":i.next,disabled:e===t,onClick:()=>c(e+1),className:`${ys} text-gray-600 hover:bg-gray-100`,children:"›"}),a&&/* @__PURE__ */Ye("button",{type:"button","aria-label":i.last,disabled:e===t,onClick:()=>c(t),className:`${ys} text-gray-600 hover:bg-gray-100`,children:"»"})]})}function ws(e){const t={};if(!e)return t;for(const[r,n]of Object.entries(e))!r.startsWith("data-")||"string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n||(t[r]=n);return t}var Ns=e=>Array.isArray(e.columns),ks=e=>"wide"===e.only?"rosh-dt-only-wide":"stacked"===e.only?"rosh-dt-only-stacked":"",$s="rosh-dt-row-link rosh-focus-ring underline-offset-4 hover:underline",Ms={sm:"px-2 py-2",md:"px-3 py-2"},Cs={left:"text-left",right:"text-right",center:"text-center"};function Ls({direction:e}){/* @__PURE__ */
587
+ /* @__PURE__ */Ye("span",{"aria-hidden":!0,className:"text-sm leading-none",children:"+"}),y]})})]},e.value)})})}):/* @__PURE__ */Ye(Xe,{children:d??/* @__PURE__ */Ye("div",{className:"text-sm text-gray-500 p-4",children:g.empty})})}var ws="inline-flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40";function Ns({page:e,pageCount:t,onPageChange:r,siblingCount:n=1,showEdges:a=!1,className:l=""}){const i=he().pagination,o=ue();if(t<=1)return null;const s=function(e,t,r){const n=/* @__PURE__ */new Set([1,t]);for(let a=e-r;a<=e+r;a++)a>=1&&a<=t&&n.add(a);const a=[...n].sort((e,t)=>e-t),l=[];let i=0;for(const e of a)i&&e-i>1&&l.push("…"),l.push(e),i=e;return l}(e,t,n),c=n=>{n>=1&&n<=t&&n!==e&&r(n)};/* @__PURE__ */
588
+ return Ge("nav",{"aria-label":i.label,className:`flex items-center gap-1 ${l}`.trim(),children:[a&&/* @__PURE__ */Ye("button",{type:"button","aria-label":i.first,disabled:1===e,onClick:()=>c(1),className:`${ws} text-gray-600 hover:bg-gray-100`,children:"«"}),
589
+ /* @__PURE__ */Ye("button",{type:"button","aria-label":i.previous,disabled:1===e,onClick:()=>c(e-1),className:`${ws} text-gray-600 hover:bg-gray-100`,children:"‹"}),s.map((t,r)=>"…"===t?/* @__PURE__ */Ye("span",{className:"px-1 text-gray-400",children:"…"},`gap-${r}`):/* @__PURE__ */Ye("button",{type:"button","aria-current":t===e?"page":void 0,onClick:()=>c(t),className:`${ws} ${t===e?"bg-blue-600 font-medium text-white":"text-gray-700 hover:bg-gray-100"}`,children:fe(t,o)},t)),
590
+ /* @__PURE__ */Ye("button",{type:"button","aria-label":i.next,disabled:e===t,onClick:()=>c(e+1),className:`${ws} text-gray-600 hover:bg-gray-100`,children:"›"}),a&&/* @__PURE__ */Ye("button",{type:"button","aria-label":i.last,disabled:e===t,onClick:()=>c(t),className:`${ws} text-gray-600 hover:bg-gray-100`,children:"»"})]})}function ks(e){const t={};if(!e)return t;for(const[r,n]of Object.entries(e))!r.startsWith("data-")||"string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n||(t[r]=n);return t}var $s=e=>Array.isArray(e.columns),Ms=e=>"wide"===e.only?"rosh-dt-only-wide":"stacked"===e.only?"rosh-dt-only-stacked":"",Cs="rosh-dt-row-link rosh-focus-ring underline-offset-4 hover:underline",Ls={sm:"px-2 py-2",md:"px-3 py-2"},Ss={left:"text-left",right:"text-right",center:"text-center"};function Ds({direction:e}){/* @__PURE__ */
593
591
  return Ge("span",{className:"ml-1 inline-flex flex-col leading-none","aria-hidden":"true",children:[
594
592
  /* @__PURE__ */Ye("svg",{className:"h-2 w-2 "+("asc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */Ye("path",{d:"M4 0L8 5H0z"})}),
595
- /* @__PURE__ */Ye("svg",{className:"h-2 w-2 "+("desc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */Ye("path",{d:"M4 5L0 0h8z"})})]})}function Ss(e,t=!1){const r=t?"":" whitespace-nowrap";return e.code?`font-mono${r}`:e.numeric?`tabular-nums${r}`:""}function Ds({columns:e,data:t,rowKey:r,sort:l=null,onSortChange:i,pagination:o,caption:s,loading:c=!1,bordered:d=!1,size:u="md",minWidth:h,rowClassName:m,onRow:p,rowHref:g,onRowPress:f,linkAs:b,emptyText:x,selection:y,footer:v,virtualized:w,stackOnNarrow:N=!1,stackBelow:k,className:$=""}){const M=he(),C=x??M.table.empty,L=(e,t)=>"function"==typeof r?r(e,t):String(e[r]),S=N&&!w,D=S?e:e.flatMap(e=>{if(!Ns(e))return"stacked"===e.only?[]:[e];const t=e.columns.filter(e=>"stacked"!==e.only);return t.length?[{...e,columns:t}]:[]}),P=e=>S?{role:e}:{},A=(e,t)=>(t??("string"==typeof e||"number"==typeof e?String(e):"")).trim()||void 0,[z,j]=Ee(0),F=w?.overscan??6,E=w?e=>{const t=Math.max(0,Math.floor(e.currentTarget.scrollTop/w.rowHeight)-F);j(e=>e===t?e:t)}:void 0,B=w?Math.ceil(w.height/w.rowHeight)+2*F:t.length,T=w?Math.min(z,Math.max(0,t.length-B)):0,I=Math.min(t.length,T+B),O=w?T*w.rowHeight:0,R=w?(t.length-I)*w.rowHeight:0,W=Be(null),[K,q]=Ee(0);re(()=>{if(!w)return;const e=W.current?.offsetHeight??0;q(t=>t===e?t:e)});const H=e=>e.sortField??e.key,_=e=>l&&l.field===H(e)?l.direction:null,U=D.flatMap(e=>Ns(e)?e.columns:[e]),V=D.some(Ns),Y=/* @__PURE__ */new Map;if(S)for(const e of D)if(Ns(e))for(const t of e.columns)Y.set(t,A(e.title,e.label));const G=e=>{const t=A(e.title,e.label),r=Y.get(e);return t&&r?`${r} · ${t}`:t},X=new Set(y?.selected??[]),Z=y?t.map((e,t)=>L(e,t)):[],J=Z.length>0&&Z.every(e=>X.has(e)),Q=Z.some(e=>X.has(e)),ee=y?36:0,te=U.length+(y?1:0),ne=U.some(e=>"left"===e.fixed),ae=S&&!y&&U.some(e=>e.cardCorner),le=b??"a",ie=`${Ms[u]} ${"sm"===u?"text-xs":"text-sm"}`,oe=(e,t)=>e.ellipsis?/* @__PURE__ */Ye("span",{className:"block w-0 min-w-full",children:t}):t,se=(e,t,r,l=0)=>{const o=_(e),s=Cs[e.align??(e.numeric?"right":"left")],c="left"===e.fixed,d=!(!e.sortable||!i);/* @__PURE__ */
596
- return Ye("th",{scope:"col",...P("columnheader"),rowSpan:r>1?r:void 0,"aria-sort":"asc"===o?"ascending":"desc"===o?"descending":d?"none":void 0,style:{width:e.width,...c?{left:(de[t]??0)+ee}:{},...w?{top:l}:{}},className:[ie,s,a,"font-semibold uppercase tracking-wide text-gray-500","sm"===u?"text-2xs":"text-xs",c?w?"sticky z-20 bg-gray-50":"sticky z-10 bg-gray-50":w?"sticky z-10 bg-gray-50":"",S&&d?"rosh-dt-sort":"",S?ks(e):"",e.headerClassName??""].filter(Boolean).join(" "),children:oe(e,d?/* @__PURE__ */Ge("button",{type:"button",onClick:()=>(e=>{if(!i)return;const t=H(e),r=_(e),n=e.sortFirst??"asc";i(null===r?{field:t,direction:n}:r===n?{field:t,direction:"asc"===n?"desc":"asc"}:null)})(e),"data-group":S?Y.get(e):void 0,className:`inline-flex max-w-full items-center font-semibold uppercase tracking-wide hover:text-gray-700 ${s}`,children:[
593
+ /* @__PURE__ */Ye("svg",{className:"h-2 w-2 "+("desc"===e?"text-gray-700":"text-gray-300"),viewBox:"0 0 8 5",fill:"currentColor",children:/* @__PURE__ */Ye("path",{d:"M4 5L0 0h8z"})})]})}function Ps(e,t=!1){const r=t?"":" whitespace-nowrap";return e.code?`font-mono${r}`:e.numeric?`tabular-nums${r}`:""}function As({columns:e,data:t,rowKey:r,sort:l=null,onSortChange:i,pagination:o,caption:s,loading:c=!1,bordered:d=!1,size:u="md",minWidth:h,rowClassName:m,onRow:p,rowHref:g,onRowPress:f,linkAs:b,emptyText:x,selection:y,footer:v,virtualized:w,stackOnNarrow:N=!1,stackBelow:k,className:$=""}){const M=he(),C=x??M.table.empty,L=(e,t)=>"function"==typeof r?r(e,t):String(e[r]),S=N&&!w,D=S?e:e.flatMap(e=>{if(!$s(e))return"stacked"===e.only?[]:[e];const t=e.columns.filter(e=>"stacked"!==e.only);return t.length?[{...e,columns:t}]:[]}),P=e=>S?{role:e}:{},A=(e,t)=>(t??("string"==typeof e||"number"==typeof e?String(e):"")).trim()||void 0,[j,z]=Ee(0),F=w?.overscan??6,E=w?e=>{const t=Math.max(0,Math.floor(e.currentTarget.scrollTop/w.rowHeight)-F);z(e=>e===t?e:t)}:void 0,B=w?Math.ceil(w.height/w.rowHeight)+2*F:t.length,T=w?Math.min(j,Math.max(0,t.length-B)):0,I=Math.min(t.length,T+B),O=w?T*w.rowHeight:0,R=w?(t.length-I)*w.rowHeight:0,W=Be(null),[K,_]=Ee(0);re(()=>{if(!w)return;const e=W.current?.offsetHeight??0;_(t=>t===e?t:e)});const q=e=>e.sortField??e.key,H=e=>l&&l.field===q(e)?l.direction:null,U=D.flatMap(e=>$s(e)?e.columns:[e]),V=D.some($s),Y=/* @__PURE__ */new Map;if(S)for(const e of D)if($s(e))for(const t of e.columns)Y.set(t,A(e.title,e.label));const G=e=>{const t=A(e.title,e.label),r=Y.get(e);return t&&r?`${r} · ${t}`:t},X=new Set(y?.selected??[]),Z=y?t.map((e,t)=>L(e,t)):[],J=Z.length>0&&Z.every(e=>X.has(e)),Q=Z.some(e=>X.has(e)),ee=y?36:0,te=U.length+(y?1:0),ne=U.some(e=>"left"===e.fixed),ae=S&&!y&&U.some(e=>e.cardCorner),le=b??"a",ie=`${Ls[u]} ${"sm"===u?"text-xs":"text-sm"}`,oe=(e,t)=>e.ellipsis?/* @__PURE__ */Ye("span",{className:"block w-0 min-w-full",children:t}):t,se=(e,t,r,l=0)=>{const o=H(e),s=Ss[e.align??(e.numeric?"right":"left")],c="left"===e.fixed,d=!(!e.sortable||!i);/* @__PURE__ */
594
+ return Ye("th",{scope:"col",...P("columnheader"),rowSpan:r>1?r:void 0,"aria-sort":"asc"===o?"ascending":"desc"===o?"descending":d?"none":void 0,style:{width:e.width,...c?{left:(de[t]??0)+ee}:{},...w?{top:l}:{}},className:[ie,s,a,"font-semibold uppercase tracking-wide text-gray-500","sm"===u?"text-2xs":"text-xs",c?w?"sticky z-20 bg-gray-50":"sticky z-10 bg-gray-50":w?"sticky z-10 bg-gray-50":"",S&&d?"rosh-dt-sort":"",S?Ms(e):"",e.headerClassName??""].filter(Boolean).join(" "),children:oe(e,d?/* @__PURE__ */Ge("button",{type:"button",onClick:()=>(e=>{if(!i)return;const t=q(e),r=H(e),n=e.sortFirst??"asc";i(null===r?{field:t,direction:n}:r===n?{field:t,direction:"asc"===n?"desc":"asc"}:null)})(e),"data-group":S?Y.get(e):void 0,className:`inline-flex max-w-full items-center font-semibold uppercase tracking-wide hover:text-gray-700 ${s}`,children:[
597
595
  /* @__PURE__ */Ye(n,{children:e.title}),
598
- /* @__PURE__ */Ye(Ls,{direction:o})]}):/* @__PURE__ */Ye(n,{children:e.title}))},e.key)};let ce=0;const de=U.map(e=>{if("left"!==e.fixed)return null;const t=ce;return ce+=e.width??0,t}),ue=/* @__PURE__ */Ge(Xe,{children:[
596
+ /* @__PURE__ */Ye(Ds,{direction:o})]}):/* @__PURE__ */Ye(n,{children:e.title}))},e.key)};let ce=0;const de=U.map(e=>{if("left"!==e.fixed)return null;const t=ce;return ce+=e.width??0,t}),ue=/* @__PURE__ */Ge(Xe,{children:[
599
597
  /* @__PURE__ */Ge("div",{onScroll:E,style:w?{maxHeight:w.height}:void 0,className:`relative overflow-x-auto ${w?"overflow-y-auto":""} ${d?"rounded-lg border border-gray-200":""}${S?" rosh-dt-scroll":""}`.trim(),children:[c&&
600
598
  /* @__PURE__ */Ge("div",{className:"absolute inset-0 z-20 flex items-start justify-center bg-white/60 pt-8",role:"status","aria-live":"polite",children:[
601
599
  /* @__PURE__ */Ye("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-gray-200 border-t-blue-600"}),
602
600
  /* @__PURE__ */Ye("span",{className:"sr-only",children:M.table.loading})]}),
603
601
  /* @__PURE__ */Ge("table",{...P("table"),className:(S?"rosh-dt-table ":"")+"w-full border-collapse tabular-nums",style:h?{minWidth:h}:void 0,children:[s&&/* @__PURE__ */Ye("caption",{className:"sr-only",children:s}),
604
602
  /* @__PURE__ */Ge("thead",{...P("rowgroup"),className:S?"rosh-dt-head":void 0,children:[
605
- /* @__PURE__ */Ge("tr",{ref:W,...P("row"),className:"border-b border-gray-200 bg-gray-50",children:[y&&/* @__PURE__ */Ye("th",{scope:"col",...P("columnheader"),rowSpan:V?2:void 0,style:{width:36,...w?{top:0}:{}},className:[ie,a,ne||w?"sticky z-20 bg-gray-50":"",ne?"left-0":"",S?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */Ye(bt,{"aria-label":M.table.selectAll,checked:J,indeterminate:Q&&!J,onChange:()=>{if(!y)return;const e=new Set(Z);y.onChange(J?y.selected.filter(t=>!e.has(t)):[...y.selected,...Z.filter(e=>!X.has(e))])}})}),D.map((e,t)=>Ns(e)?/* @__PURE__ */Ye("th",{scope:"colgroup",...P("columnheader"),colSpan:e.columns.length,style:w?{top:0}:void 0,className:[ie,"text-center",a,"font-semibold uppercase tracking-wide text-gray-500","sm"===u?"text-2xs":"text-xs","border-b border-gray-200",w?"sticky z-10 bg-gray-50":"",e.headerClassName??""].filter(Boolean).join(" "),children:/* @__PURE__ */Ye(n,{children:e.title})},e.key??`group-${t}`):se(e,U.indexOf(e),V?2:1))]}),V&&/* @__PURE__ */Ye("tr",{...P("row"),className:"border-b border-gray-200 bg-gray-50",children:D.flatMap(e=>Ns(e)?e.columns:[]).map(e=>se(e,U.indexOf(e),1,K))})]}),
606
- /* @__PURE__ */Ye("tbody",{...P("rowgroup"),className:S?"rosh-dt-body":void 0,children:0!==t.length||c?/* @__PURE__ */Ge(Xe,{children:[O>0&&/* @__PURE__ */Ye("tr",{"aria-hidden":"true",children:/* @__PURE__ */Ye("td",{colSpan:te,style:{height:O,padding:0,border:0}})}),t.slice(T,I).map((e,t)=>{const r=T+t,n=p?.(e,r),a=!!n?.current,l=g?.(e,r),i=void 0===l&&f?()=>f(e,r):void 0,o=void 0!==l||void 0!==i;let s=!1;const c=(e,t)=>{if(s=!0,!o)return e;const r=[$s,i?"cursor-pointer text-left":"",t?.className??""].filter(Boolean).join(" "),n=a?"true":void 0;return void 0!==l?/* @__PURE__ */Ye(le,{href:l,className:r,"aria-current":n,children:e}):/* @__PURE__ */Ye("button",{type:"button",onClick:i,className:r,"aria-current":n,children:e})},d=U.map(t=>t.render?t.render(e,r,c):t.dataIndex?e[t.dataIndex]:null);if(o&&!s){const e=U.findIndex(e=>"stacked"!==e.only&&!e.cardCorner),t=U.findIndex(e=>"wide"!==e.only&&!e.cardCorner);for(const r of/* @__PURE__ */new Set([e,t]))r>=0&&(d[r]=c(d[r]))}const u=e=>e?t=>{t.currentTarget.contains(t.relatedTarget)||e()}:void 0;/* @__PURE__ */
607
- return Ge("tr",{...ws(n),...P("row"),style:w?{height:w.rowHeight}:void 0,onClick:n?.onClick,onMouseEnter:n?.onMouseEnter,onMouseLeave:n?.onMouseLeave,onFocus:u(n?.onFocus),onBlur:u(n?.onBlur),"aria-current":a&&!o?"true":void 0,...n?.onClick?{tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick?.()))}}:{},className:[S?y?"rosh-dt-row rosh-dt-row-select":"rosh-dt-row":"",S&&ae?"rosh-dt-row-corner":"","border-b border-gray-100 last:border-b-0",n?.onClick?"cursor-pointer hover:bg-gray-50 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",o?"rosh-dt-linked hover:bg-gray-50":"",a?"rosh-dt-current":"",m?.(e,r)??"",n?.className??""].filter(Boolean).join(" "),children:[y&&(()=>{const t=L(e,r);/* @__PURE__ */
603
+ /* @__PURE__ */Ge("tr",{ref:W,...P("row"),className:"border-b border-gray-200 bg-gray-50",children:[y&&/* @__PURE__ */Ye("th",{scope:"col",...P("columnheader"),rowSpan:V?2:void 0,style:{width:36,...w?{top:0}:{}},className:[ie,a,ne||w?"sticky z-20 bg-gray-50":"",ne?"left-0":"",S?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */Ye(bt,{"aria-label":M.table.selectAll,checked:J,indeterminate:Q&&!J,onChange:()=>{if(!y)return;const e=new Set(Z);y.onChange(J?y.selected.filter(t=>!e.has(t)):[...y.selected,...Z.filter(e=>!X.has(e))])}})}),D.map((e,t)=>$s(e)?/* @__PURE__ */Ye("th",{scope:"colgroup",...P("columnheader"),colSpan:e.columns.length,style:w?{top:0}:void 0,className:[ie,"text-center",a,"font-semibold uppercase tracking-wide text-gray-500","sm"===u?"text-2xs":"text-xs","border-b border-gray-200",w?"sticky z-10 bg-gray-50":"",e.headerClassName??""].filter(Boolean).join(" "),children:/* @__PURE__ */Ye(n,{children:e.title})},e.key??`group-${t}`):se(e,U.indexOf(e),V?2:1))]}),V&&/* @__PURE__ */Ye("tr",{...P("row"),className:"border-b border-gray-200 bg-gray-50",children:D.flatMap(e=>$s(e)?e.columns:[]).map(e=>se(e,U.indexOf(e),1,K))})]}),
604
+ /* @__PURE__ */Ye("tbody",{...P("rowgroup"),className:S?"rosh-dt-body":void 0,children:0!==t.length||c?/* @__PURE__ */Ge(Xe,{children:[O>0&&/* @__PURE__ */Ye("tr",{"aria-hidden":"true",children:/* @__PURE__ */Ye("td",{colSpan:te,style:{height:O,padding:0,border:0}})}),t.slice(T,I).map((e,t)=>{const r=T+t,n=p?.(e,r),a=!!n?.current,l=g?.(e,r),i=void 0===l&&f?()=>f(e,r):void 0,o=void 0!==l||void 0!==i;let s=!1;const c=(e,t)=>{if(s=!0,!o)return e;const r=[Cs,i?"cursor-pointer text-left":"",t?.className??""].filter(Boolean).join(" "),n=a?"true":void 0;return void 0!==l?/* @__PURE__ */Ye(le,{href:l,className:r,"aria-current":n,children:e}):/* @__PURE__ */Ye("button",{type:"button",onClick:i,className:r,"aria-current":n,children:e})},d=U.map(t=>t.render?t.render(e,r,c):t.dataIndex?e[t.dataIndex]:null);if(o&&!s){const e=U.findIndex(e=>"stacked"!==e.only&&!e.cardCorner),t=U.findIndex(e=>"wide"!==e.only&&!e.cardCorner);for(const r of/* @__PURE__ */new Set([e,t]))r>=0&&(d[r]=c(d[r]))}const u=e=>e?t=>{t.currentTarget.contains(t.relatedTarget)||e()}:void 0;/* @__PURE__ */
605
+ return Ge("tr",{...ks(n),...P("row"),style:w?{height:w.rowHeight}:void 0,onClick:n?.onClick,onMouseEnter:n?.onMouseEnter,onMouseLeave:n?.onMouseLeave,onFocus:u(n?.onFocus),onBlur:u(n?.onBlur),"aria-current":a&&!o?"true":void 0,...n?.onClick?{tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick?.()))}}:{},className:[S?y?"rosh-dt-row rosh-dt-row-select":"rosh-dt-row":"",S&&ae?"rosh-dt-row-corner":"","border-b border-gray-100 last:border-b-0",n?.onClick?"cursor-pointer hover:bg-gray-50 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]":"",o?"rosh-dt-linked hover:bg-gray-50":"",a?"rosh-dt-current":"",m?.(e,r)??"",n?.className??""].filter(Boolean).join(" "),children:[y&&(()=>{const t=L(e,r);/* @__PURE__ */
608
606
  return Ye("td",{...P("cell"),style:{width:36},onClick:e=>e.stopPropagation(),className:[ie,ne?"sticky left-0 z-10 bg-white":"",S?"rosh-dt-select":""].filter(Boolean).join(" "),children:/* @__PURE__ */Ye(bt,{"aria-label":M.table.selectRow,checked:X.has(t),onChange:()=>(e=>{y&&y.onChange(X.has(e)?y.selected.filter(t=>t!==e):[...y.selected,e])})(t)})})})(),U.map((e,t)=>{const r="left"===e.fixed,n=d[t],a=ae&&!!e.cardCorner,l=S&&!a&&"wide"!==e.only;/* @__PURE__ */
609
- return Ye("td",{...P("cell"),"data-label":l?G(e):void 0,style:r?{left:(de[t]??0)+ee}:void 0,className:[l?e.ellipsis?"rosh-dt-cell rosh-dt-clip":"rosh-dt-cell":"",a?"rosh-dt-corner":"",S?ks(e):"",ie,Cs[e.align??(e.numeric?"right":"left")],S?"":Ss(e),"text-gray-900",e.ellipsis?"max-w-0 truncate":"",r?"sticky z-10 bg-white":"",e.className??""].filter(Boolean).join(" "),children:S?
610
- /* @__PURE__ */Ye("span",{className:["rosh-dt-value",Ss(e,!0)].filter(Boolean).join(" "),children:n}):n},e.key)})]},L(e,r))}),R>0&&/* @__PURE__ */Ye("tr",{"aria-hidden":"true",children:/* @__PURE__ */Ye("td",{colSpan:te,style:{height:R,padding:0,border:0}})})]}):/* @__PURE__ */Ye("tr",{...P("row"),className:S?"rosh-dt-empty":void 0,children:/* @__PURE__ */Ye("td",{...P("cell"),colSpan:te,className:`${ie} py-10 text-center text-gray-500`,children:C})})})]}),v]}),o&&o.pageCount>1&&/* @__PURE__ */Ye("div",{className:S?"rosh-dt-pager mt-3 flex justify-end":"mt-3 flex justify-end",children:/* @__PURE__ */Ye(vs,{page:o.page,pageCount:o.pageCount,onPageChange:o.onPageChange})})]});/* @__PURE__ */
611
- return Ye("div",S?void 0!==k&&k>0&&40!==k?{className:`rosh-dt-at ${$}`.trim(),children:/* @__PURE__ */Ye("div",{className:"rosh-dt-stack",style:{width:40/k*100+"%"},children:/* @__PURE__ */Ye("div",{className:"rosh-dt-fit",style:{width:k/40*100+"%"},children:ue})})}:{className:`rosh-dt-stack ${$}`.trim(),children:ue}:{className:$,children:ue})}function Ps({selectedCount:e,hiddenSelectedCount:t=0,loadedCount:r,totalCount:n,label:a,isFetchingMore:l,extra:i}){const o=he().list,s=n??r,c=r>=s,d=t>0?o.selectedNotShown(e,t):e>0?o.selected(e):"";/* @__PURE__ */
612
- return Ge(Xe,{children:[i,d?`${d} — `:"",c?null!=n?o.allLoaded(s,a):o.count(s,a):o.loadedOf(r,s,a),l?` · ${o.loadingMore}`:""]})}function As({title:e,message:t,onRetry:r,variant:n="dashed"}){const a=he().list;/* @__PURE__ */
607
+ return Ye("td",{...P("cell"),"data-label":l?G(e):void 0,style:r?{left:(de[t]??0)+ee}:void 0,className:[l?e.ellipsis?"rosh-dt-cell rosh-dt-clip":"rosh-dt-cell":"",a?"rosh-dt-corner":"",S?Ms(e):"",ie,Ss[e.align??(e.numeric?"right":"left")],S?"":Ps(e),"text-gray-900",e.ellipsis?"max-w-0 truncate":"",r?"sticky z-10 bg-white":"",e.className??""].filter(Boolean).join(" "),children:S?
608
+ /* @__PURE__ */Ye("span",{className:["rosh-dt-value",Ps(e,!0)].filter(Boolean).join(" "),children:n}):n},e.key)})]},L(e,r))}),R>0&&/* @__PURE__ */Ye("tr",{"aria-hidden":"true",children:/* @__PURE__ */Ye("td",{colSpan:te,style:{height:R,padding:0,border:0}})})]}):/* @__PURE__ */Ye("tr",{...P("row"),className:S?"rosh-dt-empty":void 0,children:/* @__PURE__ */Ye("td",{...P("cell"),colSpan:te,className:`${ie} py-10 text-center text-gray-500`,children:C})})})]}),v]}),o&&o.pageCount>1&&/* @__PURE__ */Ye("div",{className:S?"rosh-dt-pager mt-3 flex justify-end":"mt-3 flex justify-end",children:/* @__PURE__ */Ye(Ns,{page:o.page,pageCount:o.pageCount,onPageChange:o.onPageChange})})]});/* @__PURE__ */
609
+ return Ye("div",S?void 0!==k&&k>0&&40!==k?{className:`rosh-dt-at ${$}`.trim(),children:/* @__PURE__ */Ye("div",{className:"rosh-dt-stack",style:{width:40/k*100+"%"},children:/* @__PURE__ */Ye("div",{className:"rosh-dt-fit",style:{width:k/40*100+"%"},children:ue})})}:{className:`rosh-dt-stack ${$}`.trim(),children:ue}:{className:$,children:ue})}function js({selectedCount:e,hiddenSelectedCount:t=0,loadedCount:r,totalCount:n,label:a,isFetchingMore:l,extra:i}){const o=he().list,s=n??r,c=r>=s,d=t>0?o.selectedNotShown(e,t):e>0?o.selected(e):"";/* @__PURE__ */
610
+ return Ge(Xe,{children:[i,d?`${d} — `:"",c?null!=n?o.allLoaded(s,a):o.count(s,a):o.loadedOf(r,s,a),l?` · ${o.loadingMore}`:""]})}function zs({title:e,message:t,onRetry:r,variant:n="dashed"}){const a=he().list;/* @__PURE__ */
613
611
  return Ge("div",{className:`flex flex-col items-center justify-center text-center ${"card"===n?"rounded-md border border-gray-200 bg-white px-6 py-12":"none"===n?"px-6 py-12":"rounded-lg border-2 border-dashed border-red-200 px-6 py-12"}`,role:"alert",children:[
614
612
  /* @__PURE__ */Ye(Pe,{name:"warning",className:"h-10 w-10 text-red-300 mb-3",strokeWidth:1,"aria-hidden":"true"}),
615
613
  /* @__PURE__ */Ye("h3",{className:"text-sm font-medium text-gray-900",children:e??a.loadError}),
616
- /* @__PURE__ */Ye("p",{className:"text-sm text-gray-500 mt-2",children:t??a.loadErrorMessage}),r&&/* @__PURE__ */Ye("div",{className:"mt-4",children:/* @__PURE__ */Ye(M,{variant:"secondary",size:"sm",onClick:r,children:a.retry})})]})}function zs({data:e,width:t=120,height:r=32,stroke:n="currentColor",fill:a,strokeWidth:l=1.5,showDots:i=!1,className:o,style:s}){if(0===e.length)return null;const c=Math.max(...e),d=Math.min(...e),u=c-d||1,h=l+(i?2:0),m=e=>r-h-(e-d)/u*(r-2*h),p=1===e.length?[[0,r/2],[t,r/2]]:e.map((r,n)=>[n*t/(e.length-1),m(r)]),g=p.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" "),f=`${g} L${t.toFixed(2)},${r} L0,${r} Z`;/* @__PURE__ */
614
+ /* @__PURE__ */Ye("p",{className:"text-sm text-gray-500 mt-2",children:t??a.loadErrorMessage}),r&&/* @__PURE__ */Ye("div",{className:"mt-4",children:/* @__PURE__ */Ye(M,{variant:"secondary",size:"sm",onClick:r,children:a.retry})})]})}function Fs({data:e,width:t=120,height:r=32,stroke:n="currentColor",fill:a,strokeWidth:l=1.5,showDots:i=!1,className:o,style:s}){if(0===e.length)return null;const c=Math.max(...e),d=Math.min(...e),u=c-d||1,h=l+(i?2:0),m=e=>r-h-(e-d)/u*(r-2*h),p=1===e.length?[[0,r/2],[t,r/2]]:e.map((r,n)=>[n*t/(e.length-1),m(r)]),g=p.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" "),f=`${g} L${t.toFixed(2)},${r} L0,${r} Z`;/* @__PURE__ */
617
615
  return Ge("svg",{className:o,style:s,width:t,height:r,viewBox:`0 0 ${t} ${r}`,preserveAspectRatio:"none",role:"img","aria-hidden":"true",children:[a&&/* @__PURE__ */Ye("path",{d:f,fill:a,stroke:"none"}),
618
- /* @__PURE__ */Ye("path",{d:g,fill:"none",stroke:n,strokeWidth:l,strokeLinejoin:"round",strokeLinecap:"round"}),i&&p.map(([e,t],r)=>/* @__PURE__ */Ye("circle",{cx:e,cy:t,r:l+.5,fill:n},r))]})}var js=8,Fs=["var(--viz-series-1)","var(--viz-series-2)","var(--viz-series-3)","var(--viz-series-4)","var(--viz-series-5)","var(--viz-series-6)","var(--viz-series-7)","var(--viz-series-8)"],Es={good:"var(--viz-good)",neutral:"var(--viz-neutral)",warning:"var(--viz-warning)",serious:"var(--viz-serious)",critical:"var(--viz-critical)"},Bs={grid:"var(--viz-grid)",axis:"var(--viz-axis)",label:"var(--viz-label)",muted:"var(--viz-muted)",surface:"var(--viz-surface)"};function Ts(e){return Fs[e]??Bs.muted}function Is(e,t,r){return t||(r?Es[r]:Ts(e))}function Os(e,t={},r=8){const n={},a=/* @__PURE__ */new Set,l=/* @__PURE__ */new Set;for(const r of e){const e=t[r];void 0===e||a.has(e)||(n[r]=e,a.add(e)),l.add(r)}const i=0===Object.keys(t).length;for(const l of e){if(void 0!==n[l])continue;if(!i&&l in t)continue;const e=Array.from({length:r},(e,t)=>t).find(e=>!a.has(e));if(void 0===e)break;n[l]=e,a.add(e)}return n}function Rs(e,t,r=8){if(void 0!==e[t]){const{[t]:r,...n}=e;return n}const n=new Set(Object.values(e)),a=Array.from({length:r},(e,t)=>t).find(e=>!n.has(e));return void 0===a?e:{...e,[t]:a}}function Ws(e,t,r,n){return r||n?Is(e,r,n):e<t?Ts(e):Bs.muted}function Ks(e,t){const[r,n]=e,a=n-r,l=e=>0===a?t.from:t.from+(e-r)/a*(t.to-t.from);return l.domain=e,l.range=t,l.ticks=e=>e<2?[r]:Array.from({length:e},(t,n)=>r+a*n/(e-1)),l}function qs(e,t,r=0){const n=e>0?(t.to-t.from)/e:0,a=n*r,l=e=>t.from+e*n+a/2;return l.bandwidth=Math.max(0,n-a),l.center=e=>t.from+e*n+n/2,l.end=e=>t.from+(e+1)*n-a/2,l.count=e,l}function Hs(e,t){const r=[...e].sort((e,t)=>e-t),n=Math.max(0,r.length-1),a=e=>0===n?t.from:t.from+e/n*(t.to-t.from),l=e=>{const t=r.indexOf(e);if(t>=0)return a(t);const l=r.findIndex(t=>t>=e);return a(-1===l?n:l)};return l.levels=r,l.indexOf=e=>r.indexOf(e),l.range=t,l}function _s(e){if(!Number.isFinite(e)||e<=0)return 1;const t=10**Math.floor(Math.log10(e)),r=e/t;return(r<=1?1:r<=2?2:r<=2.5?2.5:r<=5?5:10)*t}function Us(e,t,{intervals:r=5,integer:n=!1,zero:a=!0}={}){const l=a?Math.min(0,e):e,i=a?Math.max(0,t):Math.max(e,t);if(!Number.isFinite(l)||!Number.isFinite(i)||i-l<=0){const e=Number.isFinite(l)&&!a?l:0;return{lo:e,hi:e+1,ticks:[e,e+1]}}const o=Math.max(1,Math.floor(r));let s=10**Math.floor(Math.log10((i-l)/o));for(;;){for(const e of[1,2,2.5,5]){const t=e*s;if(n&&!Number.isInteger(t))continue;const r=Math.floor(l/t)*t,a=Math.ceil(i/t)*t,c=Math.round((a-r)/t);if(c<=o){const e=Array.from({length:c+1},(e,n)=>Number((r+n*t).toPrecision(12)));return{lo:e[0],hi:e[c],ticks:e}}}s*=10}}function Vs(e,t,{intervals:r=5,integerLeft:n=!1,integerRight:a=!1}={}){const l=e=>Math.min(0,e),i=e=>Math.max(0,e),o=([e,t],r,n,a)=>{if(l(e)<0&&0===r)return null;if(i(t)>0&&0===n)return null;const o=function(e,t){if(!(e>0))return 1;let r=10**Math.floor(Math.log10(e));for(;;){for(const n of[1,2,2.5,5]){const a=n*r;if((!t||Number.isInteger(a))&&a>=e*(1-1e-9))return a}r*=10}}(Math.max(r?-l(e)/r:0,n?i(t)/n:0),a),s=o*(r+n),c=i(t)-l(e);return{step:o,waste:c>0?(s-c)/s:1}};let s=null;const c=Math.max(2,Math.floor(r));for(let r=2;r<=c;r++)for(let l=0;l<=r;l++){const i=o(e,l,r-l,n),d=o(t,l,r-l,a);if(!i||!d)continue;const u=i.waste+d.waste+.02*(c-r);(!s||u<s.score-1e-9)&&(s={n:r,k:l,l:i.step,r:d.step,score:u})}const{n:d,k:u,l:h,r:m}=s??{n:1,k:0,l:1,r:1},p=e=>{const t=Array.from({length:d+1},(t,r)=>Number(((r-u)*e).toPrecision(12)));return{lo:t[0],hi:t[d],ticks:t}};return{left:p(h),right:p(m)}}function Ys(e,t){const r=Math.max(e[0],e[1]),n=Math.min(e[0],e[1]),a=r>0?r:0,l=n>0?n:a>0?10**(Math.ceil(Math.log10(a))-3):0,i=Math.log10(l),o=a>0&&l>0?Math.log10(a)-i:0,s=e=>{if(o<=0)return t.from;const r=Math.max(l,e);return t.from+(Math.log10(r)-i)/o*(t.to-t.from)};return s.domain=[l,a],s.range=t,s.ticks=e=>{if(e<2||o<=0)return[l];const t=Math.ceil(i),r=Math.floor(Math.log10(a)),n=[];for(let e=t;e<=r;e+=1)n.push(10**e);return 0===n.length?[l,a]:(Math.log10(n[0])-i>.15&&n.unshift(l),Math.log10(a)-Math.log10(n[n.length-1])>.15&&n.push(a),n)},s}function Gs(e,t=0){const r=e>0?2*Math.PI/e:0,n=e=>-Math.PI/2+e*r+t/2;return n.step=Math.max(0,r-t),n.center=e=>-Math.PI/2+e*r+r/2,n.count=e,n}function Xs(e,t){const[r,n]=e,a=Math.sqrt(Math.max(0,n))-Math.sqrt(Math.max(0,r));return e=>{if(0===a)return t.to;const n=(Math.sqrt(Math.max(0,e))-Math.sqrt(Math.max(0,r)))/a;return t.from+Math.min(1,Math.max(0,n))*(t.to-t.from)}}function Zs(e,t=10){const r=e.filter(Number.isFinite);if(Array.isArray(t)){const e=[...t].filter(Number.isFinite).sort((e,t)=>e-t);if(e.length<2)return[];const n=Array.from({length:e.length-1},(t,r)=>({from:e[r],to:e[r+1],count:0})),a=e[e.length-1];for(const t of r){if(t<e[0]||t>a)continue;const r=t===a?n.length-1:n.findIndex(e=>t>=e.from&&t<e.to);r>=0&&(n[r].count+=1)}return n}const n=t;if(0===r.length||n<1)return[];const a=Math.min(...r),l=(Math.max(...r)-a)/n||1,i=Array.from({length:n},(e,t)=>({from:a+t*l,to:a+(t+1)*l,count:0}));for(const e of r){i[Math.min(n-1,Math.floor((e-a)/l))].count+=1}return i}function Js(e,t,{fontSize:r=11,gap:n=8}={}){const a=e.reduce((e,t)=>Math.max(e,t.length),0);return Math.max(t,Math.ceil(.62*a*r+n+2))}function Qs(e,t=720){const[r,n]=Ee(t);return Ie(()=>{const t=e.current;if(!t||"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(e=>{const t=e[0]?.contentRect.width??0;t>0&&n(t)});return r.observe(t),()=>r.disconnect()},[e]),r}function ec(e,t,r){const n=(t/2+8).toFixed(1),a=e=>{return`clamp(0px, calc(${t=e,r>0?(t/r*100).toFixed(2):"0.00"}% + ${n}px), calc(100% - 184px))`;var t};return e<=r/2?{left:a(e)}:{right:a(r-e)}}function tc({labels:e,values:t,height:r=220,width:n,bandPadding:a=.24,min:l,max:i,yTickCount:o=4,formatValue:s,yAxisLabel:c,xTickAnchor:d="center",children:u,overlay:h,tooltip:m,onSelect:p,ariaLabel:g,className:f,emptyLabel:b}){const x=he().charts,y=ue(),v=s??(e=>fe(e,y)),w=b??x.noData,N=Be(null),k=Qs(N),$=n??k,[M,C]=Ee(null),L=je();if(Ie(()=>{if(null!==M)return Q(e=>"Escape"===e.key&&(C(null),!0))},[M]),0===e.length||!t.some(Number.isFinite))/* @__PURE__ */
619
- return Ye("div",{className:f,ref:N,children:/* @__PURE__ */Ye("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:r},children:w})});const S=t.filter(Number.isFinite),D=S.every(Number.isInteger),P=void 0===l&&void 0===i?Us(Math.min(0,...S),Math.max(0,...S),{intervals:o+1,integer:D}):null,A=void 0!==l&&void 0===i?Us(l,Math.max(l,...S),{intervals:o+1,integer:D,zero:!1}):null,z=P?P.lo:l??Math.min(0,...S),j=P?P.hi:A?A.hi:i??_s(Math.max(...S,0)),F=P?P.ticks:A?[z,...A.ticks.filter(e=>e>z)]:Ks([z,j],{from:0,to:1}).ticks(o+1),E={top:12,right:16,bottom:26,left:Js(F.map(v),48)+(c?10:0)},B=E.left,T=Math.max(B+1,$-E.right),I=E.top,O=r-E.bottom,R=Ks([z,j],{from:O,to:I}),W=qs(e.length,{from:B,to:T},a),K=(T-B)/Math.max(1,e.length),q=K>=48,H=q?1:Math.max(1,Math.ceil(e.length/Math.max(1,Math.floor($/84)))),_=Math.max(2,Math.floor((K-6)/6.6)),U=e=>q&&e.length>_?`${e.slice(0,_-1).trimEnd()}…`:e;/* @__PURE__ */
616
+ /* @__PURE__ */Ye("path",{d:g,fill:"none",stroke:n,strokeWidth:l,strokeLinejoin:"round",strokeLinecap:"round"}),i&&p.map(([e,t],r)=>/* @__PURE__ */Ye("circle",{cx:e,cy:t,r:l+.5,fill:n},r))]})}var Es=8,Bs=["var(--viz-series-1)","var(--viz-series-2)","var(--viz-series-3)","var(--viz-series-4)","var(--viz-series-5)","var(--viz-series-6)","var(--viz-series-7)","var(--viz-series-8)"],Ts={good:"var(--viz-good)",neutral:"var(--viz-neutral)",warning:"var(--viz-warning)",serious:"var(--viz-serious)",critical:"var(--viz-critical)"},Is={grid:"var(--viz-grid)",axis:"var(--viz-axis)",label:"var(--viz-label)",muted:"var(--viz-muted)",surface:"var(--viz-surface)"};function Os(e){return Bs[e]??Is.muted}function Rs(e,t,r){return t||(r?Ts[r]:Os(e))}function Ws(e,t={},r=8){const n={},a=/* @__PURE__ */new Set,l=/* @__PURE__ */new Set;for(const r of e){const e=t[r];void 0===e||a.has(e)||(n[r]=e,a.add(e)),l.add(r)}const i=0===Object.keys(t).length;for(const l of e){if(void 0!==n[l])continue;if(!i&&l in t)continue;const e=Array.from({length:r},(e,t)=>t).find(e=>!a.has(e));if(void 0===e)break;n[l]=e,a.add(e)}return n}function Ks(e,t,r=8){if(void 0!==e[t]){const{[t]:r,...n}=e;return n}const n=new Set(Object.values(e)),a=Array.from({length:r},(e,t)=>t).find(e=>!n.has(e));return void 0===a?e:{...e,[t]:a}}function _s(e,t,r,n){return r||n?Rs(e,r,n):e<t?Os(e):Is.muted}function qs(e,t){const[r,n]=e,a=n-r,l=e=>0===a?t.from:t.from+(e-r)/a*(t.to-t.from);return l.domain=e,l.range=t,l.ticks=e=>e<2?[r]:Array.from({length:e},(t,n)=>r+a*n/(e-1)),l}function Hs(e,t,r=0){const n=e>0?(t.to-t.from)/e:0,a=n*r,l=e=>t.from+e*n+a/2;return l.bandwidth=Math.max(0,n-a),l.center=e=>t.from+e*n+n/2,l.end=e=>t.from+(e+1)*n-a/2,l.count=e,l}function Us(e,t){const r=[...e].sort((e,t)=>e-t),n=Math.max(0,r.length-1),a=e=>0===n?t.from:t.from+e/n*(t.to-t.from),l=e=>{const t=r.indexOf(e);if(t>=0)return a(t);const l=r.findIndex(t=>t>=e);return a(-1===l?n:l)};return l.levels=r,l.indexOf=e=>r.indexOf(e),l.range=t,l}function Vs(e){if(!Number.isFinite(e)||e<=0)return 1;const t=10**Math.floor(Math.log10(e)),r=e/t;return(r<=1?1:r<=2?2:r<=2.5?2.5:r<=5?5:10)*t}function Ys(e,t,{intervals:r=5,integer:n=!1,zero:a=!0}={}){const l=a?Math.min(0,e):e,i=a?Math.max(0,t):Math.max(e,t);if(!Number.isFinite(l)||!Number.isFinite(i)||i-l<=0){const e=Number.isFinite(l)&&!a?l:0;return{lo:e,hi:e+1,ticks:[e,e+1]}}const o=Math.max(1,Math.floor(r));let s=10**Math.floor(Math.log10((i-l)/o));for(;;){for(const e of[1,2,2.5,5]){const t=e*s;if(n&&!Number.isInteger(t))continue;const r=Math.floor(l/t)*t,a=Math.ceil(i/t)*t,c=Math.round((a-r)/t);if(c<=o){const e=Array.from({length:c+1},(e,n)=>Number((r+n*t).toPrecision(12)));return{lo:e[0],hi:e[c],ticks:e}}}s*=10}}function Gs(e,t,{intervals:r=5,integerLeft:n=!1,integerRight:a=!1}={}){const l=e=>Math.min(0,e),i=e=>Math.max(0,e),o=([e,t],r,n,a)=>{if(l(e)<0&&0===r)return null;if(i(t)>0&&0===n)return null;const o=function(e,t){if(!(e>0))return 1;let r=10**Math.floor(Math.log10(e));for(;;){for(const n of[1,2,2.5,5]){const a=n*r;if((!t||Number.isInteger(a))&&a>=e*(1-1e-9))return a}r*=10}}(Math.max(r?-l(e)/r:0,n?i(t)/n:0),a),s=o*(r+n),c=i(t)-l(e);return{step:o,waste:c>0?(s-c)/s:1}};let s=null;const c=Math.max(2,Math.floor(r));for(let r=2;r<=c;r++)for(let l=0;l<=r;l++){const i=o(e,l,r-l,n),d=o(t,l,r-l,a);if(!i||!d)continue;const u=i.waste+d.waste+.02*(c-r);(!s||u<s.score-1e-9)&&(s={n:r,k:l,l:i.step,r:d.step,score:u})}const{n:d,k:u,l:h,r:m}=s??{n:1,k:0,l:1,r:1},p=e=>{const t=Array.from({length:d+1},(t,r)=>Number(((r-u)*e).toPrecision(12)));return{lo:t[0],hi:t[d],ticks:t}};return{left:p(h),right:p(m)}}function Xs(e,t){const r=Math.max(e[0],e[1]),n=Math.min(e[0],e[1]),a=r>0?r:0,l=n>0?n:a>0?10**(Math.ceil(Math.log10(a))-3):0,i=Math.log10(l),o=a>0&&l>0?Math.log10(a)-i:0,s=e=>{if(o<=0)return t.from;const r=Math.max(l,e);return t.from+(Math.log10(r)-i)/o*(t.to-t.from)};return s.domain=[l,a],s.range=t,s.ticks=e=>{if(e<2||o<=0)return[l];const t=Math.ceil(i),r=Math.floor(Math.log10(a)),n=[];for(let e=t;e<=r;e+=1)n.push(10**e);return 0===n.length?[l,a]:(Math.log10(n[0])-i>.15&&n.unshift(l),Math.log10(a)-Math.log10(n[n.length-1])>.15&&n.push(a),n)},s}function Zs(e,t=0){const r=e>0?2*Math.PI/e:0,n=e=>-Math.PI/2+e*r+t/2;return n.step=Math.max(0,r-t),n.center=e=>-Math.PI/2+e*r+r/2,n.count=e,n}function Js(e,t){const[r,n]=e,a=Math.sqrt(Math.max(0,n))-Math.sqrt(Math.max(0,r));return e=>{if(0===a)return t.to;const n=(Math.sqrt(Math.max(0,e))-Math.sqrt(Math.max(0,r)))/a;return t.from+Math.min(1,Math.max(0,n))*(t.to-t.from)}}function Qs(e,t=10){const r=e.filter(Number.isFinite);if(Array.isArray(t)){const e=[...t].filter(Number.isFinite).sort((e,t)=>e-t);if(e.length<2)return[];const n=Array.from({length:e.length-1},(t,r)=>({from:e[r],to:e[r+1],count:0})),a=e[e.length-1];for(const t of r){if(t<e[0]||t>a)continue;const r=t===a?n.length-1:n.findIndex(e=>t>=e.from&&t<e.to);r>=0&&(n[r].count+=1)}return n}const n=t;if(0===r.length||n<1)return[];const a=Math.min(...r),l=(Math.max(...r)-a)/n||1,i=Array.from({length:n},(e,t)=>({from:a+t*l,to:a+(t+1)*l,count:0}));for(const e of r){i[Math.min(n-1,Math.floor((e-a)/l))].count+=1}return i}function ec(e,t,{fontSize:r=11,gap:n=8}={}){const a=e.reduce((e,t)=>Math.max(e,t.length),0);return Math.max(t,Math.ceil(.62*a*r+n+2))}function tc(e,t=720){const[r,n]=Ee(t);return Ie(()=>{const t=e.current;if(!t||"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(e=>{const t=e[0]?.contentRect.width??0;t>0&&n(t)});return r.observe(t),()=>r.disconnect()},[e]),r}function rc(e,t,r){const n=(t/2+8).toFixed(1),a=e=>{return`clamp(0px, calc(${t=e,r>0?(t/r*100).toFixed(2):"0.00"}% + ${n}px), calc(100% - 184px))`;var t};return e<=r/2?{left:a(e)}:{right:a(r-e)}}function nc({labels:e,values:t,height:r=220,width:n,bandPadding:a=.24,min:l,max:i,yTickCount:o=4,formatValue:s,yAxisLabel:c,xTickAnchor:d="center",children:u,overlay:h,tooltip:m,onSelect:p,ariaLabel:g,className:f,emptyLabel:b}){const x=he().charts,y=ue(),v=s??(e=>fe(e,y)),w=b??x.noData,N=Be(null),k=tc(N),$=n??k,[M,C]=Ee(null),L=ze();if(Ie(()=>{if(null!==M)return Q(e=>"Escape"===e.key&&(C(null),!0))},[M]),0===e.length||!t.some(Number.isFinite))/* @__PURE__ */
617
+ return Ye("div",{className:f,ref:N,children:/* @__PURE__ */Ye("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:r},children:w})});const S=t.filter(Number.isFinite),D=S.every(Number.isInteger),P=void 0===l&&void 0===i?Ys(Math.min(0,...S),Math.max(0,...S),{intervals:o+1,integer:D}):null,A=void 0!==l&&void 0===i?Ys(l,Math.max(l,...S),{intervals:o+1,integer:D,zero:!1}):null,j=P?P.lo:l??Math.min(0,...S),z=P?P.hi:A?A.hi:i??Vs(Math.max(...S,0)),F=P?P.ticks:A?[j,...A.ticks.filter(e=>e>j)]:qs([j,z],{from:0,to:1}).ticks(o+1),E={top:12,right:16,bottom:26,left:ec(F.map(v),48)+(c?10:0)},B=E.left,T=Math.max(B+1,$-E.right),I=E.top,O=r-E.bottom,R=qs([j,z],{from:O,to:I}),W=Hs(e.length,{from:B,to:T},a),K=(T-B)/Math.max(1,e.length),_=K>=48,q=_?1:Math.max(1,Math.ceil(e.length/Math.max(1,Math.floor($/84)))),H=Math.max(2,Math.floor((K-6)/6.6)),U=e=>_&&e.length>H?`${e.slice(0,H-1).trimEnd()}…`:e;/* @__PURE__ */
620
618
  return Ge("div",{className:`relative ${f??""}`,ref:N,children:[
621
619
  /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${$} ${r}`,role:"img","aria-label":g,tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>C(null),onBlur:()=>C(null),onKeyDown:t=>{if(p&&null!==M&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void p(M);if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key)return;t.preventDefault();const r="ArrowRight"===t.key?1:-1;C(t=>Math.min(e.length-1,Math.max(0,(t??0)+r)))},children:[
622
- /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ye("clipPath",{id:L,children:/* @__PURE__ */Ye("rect",{x:B,y:I,width:T-B,height:O-I})})}),F.map(e=>/* @__PURE__ */Ye("line",{x1:B,y1:R(e),x2:T,y2:R(e),stroke:Bs.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${e}`)),
623
- /* @__PURE__ */Ye("line",{x1:B,y1:R(Math.max(z,0)),x2:T,y2:R(Math.max(z,0)),stroke:Bs.axis,strokeWidth:1,shapeRendering:"crispEdges"}),F.map(e=>/* @__PURE__ */Ye("text",{x:B-8,y:R(e)+4,textAnchor:"end",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:v(e)},`t${e}`)),c&&/* @__PURE__ */Ye("text",{x:14,y:(I+O)/2,transform:`rotate(-90 14 ${(I+O)/2})`,textAnchor:"middle",fontSize:11,fill:Bs.label,children:c}),
624
- /* @__PURE__ */Ye("g",{clipPath:`url(#${L})`,children:u({x:W,y:R,left:B,right:T,top:I,bottom:O,width:$,height:r,clipId:L,active:M})}),h?.({x:W,y:R,left:B,right:T,top:I,bottom:O,width:$,height:r,clipId:L,active:M}),e.map((e,t)=>t%H===0?/* @__PURE__ */Ye("text",{x:"start"===d?W(t):W.center(t),y:r-8,textAnchor:"middle",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:U(e)},`x${t}`):null),e.map((t,r)=>/* @__PURE__ */Ye("rect",{x:W.center(r)-(T-B)/e.length/2,y:I,width:(T-B)/e.length,height:O-I,fill:"transparent",onMouseEnter:()=>C(r),onClick:p?()=>p(r):void 0,style:p?{cursor:"pointer"}:void 0},`h${r}`))]}),m&&null!==M&&
625
- /* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 z-10",style:ec(W.center(M),W.bandwidth,$),children:m(M)})]})}function rc({height:e=220,width:t=720,variant:r="area",bars:n=9,label:a,className:l}){const i=he().charts,o=a??i.loading,s=`${je()}-shimmer`,c=48,d=t-16,u=12,h=e-26;/* @__PURE__ */
620
+ /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ye("clipPath",{id:L,children:/* @__PURE__ */Ye("rect",{x:B,y:I,width:T-B,height:O-I})})}),F.map(e=>/* @__PURE__ */Ye("line",{x1:B,y1:R(e),x2:T,y2:R(e),stroke:Is.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${e}`)),
621
+ /* @__PURE__ */Ye("line",{x1:B,y1:R(Math.max(j,0)),x2:T,y2:R(Math.max(j,0)),stroke:Is.axis,strokeWidth:1,shapeRendering:"crispEdges"}),F.map(e=>/* @__PURE__ */Ye("text",{x:B-8,y:R(e)+4,textAnchor:"end",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:v(e)},`t${e}`)),c&&/* @__PURE__ */Ye("text",{x:14,y:(I+O)/2,transform:`rotate(-90 14 ${(I+O)/2})`,textAnchor:"middle",fontSize:11,fill:Is.label,children:c}),
622
+ /* @__PURE__ */Ye("g",{clipPath:`url(#${L})`,children:u({x:W,y:R,left:B,right:T,top:I,bottom:O,width:$,height:r,clipId:L,active:M})}),h?.({x:W,y:R,left:B,right:T,top:I,bottom:O,width:$,height:r,clipId:L,active:M}),e.map((e,t)=>t%q===0?/* @__PURE__ */Ye("text",{x:"start"===d?W(t):W.center(t),y:r-8,textAnchor:"middle",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:U(e)},`x${t}`):null),e.map((t,r)=>/* @__PURE__ */Ye("rect",{x:W.center(r)-(T-B)/e.length/2,y:I,width:(T-B)/e.length,height:O-I,fill:"transparent",onMouseEnter:()=>C(r),onClick:p?()=>p(r):void 0,style:p?{cursor:"pointer"}:void 0},`h${r}`))]}),m&&null!==M&&
623
+ /* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 z-10",style:rc(W.center(M),W.bandwidth,$),children:m(M)})]})}function ac({height:e=220,width:t=720,variant:r="area",bars:n=9,label:a,className:l}){const i=he().charts,o=a??i.loading,s=`${ze()}-shimmer`,c=48,d=t-16,u=12,h=e-26;/* @__PURE__ */
626
624
  return Ye("div",{className:l,children:/* @__PURE__ */Ge("svg",{width:"100%",height:e,viewBox:`0 0 ${t} ${e}`,role:"img","aria-label":o,"aria-busy":"true",children:[
627
625
  /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ge("linearGradient",{id:s,x1:"0",y1:"0",x2:"1",y2:"0",children:[
628
- /* @__PURE__ */Ye("stop",{offset:"0%",stopColor:Bs.surface,stopOpacity:"0"}),
629
- /* @__PURE__ */Ye("stop",{offset:"45%",stopColor:Bs.surface,stopOpacity:"0.55"}),
630
- /* @__PURE__ */Ye("stop",{offset:"55%",stopColor:Bs.surface,stopOpacity:"0.55"}),
631
- /* @__PURE__ */Ye("stop",{offset:"100%",stopColor:Bs.surface,stopOpacity:"0"})]})}),Array.from({length:5},(e,t)=>{const r=u+(h-u)*t/4;/* @__PURE__ */
632
- return Ye("line",{x1:c,y1:r,x2:d,y2:r,stroke:Bs.grid,strokeWidth:1,shapeRendering:"crispEdges"},t)}),Array.from({length:5},(e,t)=>/* @__PURE__ */Ye("rect",{x:18,y:u+(h-u)*t/4-4,width:22,height:8,rx:4,fill:Bs.grid},`t${t}`)),"bars"===r?Array.from({length:n},(e,t)=>{const r=(d-c)/n,a=.35+.4*Math.abs(Math.sin(1.1*(t+1))),l=(h-u)*a;/* @__PURE__ */
633
- return Ye("rect",{x:c+t*r+.18*r,y:h-l,width:.64*r,height:l,rx:3,fill:Bs.grid},t)}):/* @__PURE__ */Ye("path",{d:`M48,${h} C${c+.25*(d-c)},${u+.35*(h-u)} ${c+.55*(d-c)},${u+.15*(h-u)} ${d},${u+.55*(h-u)} L${d},${h} Z`,fill:Bs.grid}),
634
- /* @__PURE__ */Ye("rect",{className:"rosh-viz-shimmer",x:-t,y:0,width:t,height:e,fill:`url(#${s})`})]})})}var nc=Oe({highlighted:null,setHighlighted:()=>{}});function ac({children:e}){const[t,r]=Ee(null),n=Te(()=>({highlighted:t,setHighlighted:r}),[t]);/* @__PURE__ */
635
- return Ye(nc.Provider,{value:n,children:e})}function lc(){return qe(nc)}function ic(e,t,r=.22){return null===t?null:t===e?1:r}function oc(e,t="none"){if("none"===t||0===e.length)return null;if("last"===t){for(let t=e.length-1;t>=0;t-=1)if("number"==typeof e[t]&&Number.isFinite(e[t]))return t;return null}let r=null;return e.forEach((n,a)=>{if("number"!=typeof n||!Number.isFinite(n))return;if(null===r)return void(r=a);const l=e[r];("max"===t?n>l:n<l)&&(r=a)}),r}function sc({variant:e="solid",title:t,rows:r,footnote:n,emphasisKey:a,className:l}){const i="glass"===e;/* @__PURE__ */
626
+ /* @__PURE__ */Ye("stop",{offset:"0%",stopColor:Is.surface,stopOpacity:"0"}),
627
+ /* @__PURE__ */Ye("stop",{offset:"45%",stopColor:Is.surface,stopOpacity:"0.55"}),
628
+ /* @__PURE__ */Ye("stop",{offset:"55%",stopColor:Is.surface,stopOpacity:"0.55"}),
629
+ /* @__PURE__ */Ye("stop",{offset:"100%",stopColor:Is.surface,stopOpacity:"0"})]})}),Array.from({length:5},(e,t)=>{const r=u+(h-u)*t/4;/* @__PURE__ */
630
+ return Ye("line",{x1:c,y1:r,x2:d,y2:r,stroke:Is.grid,strokeWidth:1,shapeRendering:"crispEdges"},t)}),Array.from({length:5},(e,t)=>/* @__PURE__ */Ye("rect",{x:18,y:u+(h-u)*t/4-4,width:22,height:8,rx:4,fill:Is.grid},`t${t}`)),"bars"===r?Array.from({length:n},(e,t)=>{const r=(d-c)/n,a=.35+.4*Math.abs(Math.sin(1.1*(t+1))),l=(h-u)*a;/* @__PURE__ */
631
+ return Ye("rect",{x:c+t*r+.18*r,y:h-l,width:.64*r,height:l,rx:3,fill:Is.grid},t)}):/* @__PURE__ */Ye("path",{d:`M48,${h} C${c+.25*(d-c)},${u+.35*(h-u)} ${c+.55*(d-c)},${u+.15*(h-u)} ${d},${u+.55*(h-u)} L${d},${h} Z`,fill:Is.grid}),
632
+ /* @__PURE__ */Ye("rect",{className:"rosh-viz-shimmer",x:-t,y:0,width:t,height:e,fill:`url(#${s})`})]})})}var lc=Oe({highlighted:null,setHighlighted:()=>{}});function ic({children:e}){const[t,r]=Ee(null),n=Te(()=>({highlighted:t,setHighlighted:r}),[t]);/* @__PURE__ */
633
+ return Ye(lc.Provider,{value:n,children:e})}function oc(){return _e(lc)}function sc(e,t,r=.22){return null===t?null:t===e?1:r}function cc(e,t="none"){if("none"===t||0===e.length)return null;if("last"===t){for(let t=e.length-1;t>=0;t-=1)if("number"==typeof e[t]&&Number.isFinite(e[t]))return t;return null}let r=null;return e.forEach((n,a)=>{if("number"!=typeof n||!Number.isFinite(n))return;if(null===r)return void(r=a);const l=e[r];("max"===t?n>l:n<l)&&(r=a)}),r}function dc({variant:e="solid",title:t,rows:r,footnote:n,emphasisKey:a,className:l}){const i="glass"===e;/* @__PURE__ */
636
634
  return Ge("div",{role:"status",className:`pointer-events-none min-w-44 rounded-xl p-3 text-xs ${i?"":"bg-white ring-1 ring-black/5"} ${l??""}`,style:i?X():{boxShadow:"var(--elevation-popup)"},children:[t&&/* @__PURE__ */Ye("p",{className:"mb-2 text-sm font-medium text-gray-800",children:t}),
637
635
  /* @__PURE__ */Ye("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:r.map(e=>/* @__PURE__ */Ge("li",{className:"flex items-center gap-3",style:a&&e.key!==a?{opacity:.45}:void 0,children:[
638
- /* @__PURE__ */Ye("span",{className:"h-3 w-3 shrink-0 rounded-[4px]",style:{backgroundColor:e.color??Bs.muted}}),
636
+ /* @__PURE__ */Ye("span",{className:"h-3 w-3 shrink-0 rounded-[4px]",style:{backgroundColor:e.color??Is.muted}}),
639
637
  /* @__PURE__ */Ye("span",{className:"flex-1 whitespace-nowrap text-gray-600",children:e.label}),
640
- /* @__PURE__ */Ye("span",{className:"pl-4 font-semibold tabular-nums text-gray-900",children:e.value??"—"})]},e.key))}),n&&/* @__PURE__ */Ye("p",{className:"mt-2 text-2xs text-gray-500",children:n})]})}function cc({series:e,labels:t,stacked:r=!1,stackMode:n="value",height:a=220,width:l,max:i,formatValue:o,yAxisLabel:s,className:c,emptyLabel:d,radius:u=3,loading:h=!1,animate:m=!0,glow:p=!1,emphasise:g=!1,activeKey:f,highlight:b="none",valueLabels:x=!1,onSelect:y,min:v,formatTooltipValue:w,tooltipLabels:N,barGap:k=4,seriesLabels:$=!1}){const M=je(),{highlighted:C}=lc(),L=he().charts,S=ue(),D=o??(e=>fe(e,S)),P=w??D;if(h)/* @__PURE__ */return Ye(rc,{height:a,width:l,variant:"bars",className:c});const A=(e,t)=>{const r=e.pointColors?.[t];if(r)return r;const n=e.pointTones?.[t];return n?Es[n]:Is(e.slot,e.color,e.tone)},z=e.map((e,t)=>({...e,slot:t})).filter(e=>e.data.some(e=>Number.isFinite(e))),j=(e,t)=>{const r=e.data[t];return"number"==typeof r&&Number.isFinite(r)?r:0},F=t.map((e,t)=>z.reduce((e,r)=>e+j(r,t),0)),E=t.map((e,t)=>z.reduce((e,r)=>e+Math.max(0,j(r,t)),0)),B=t.map((e,t)=>z.reduce((e,r)=>e+Math.min(0,j(r,t)),0)),T=r&&"percent"===n,I=(e,t)=>F[t]>0?e/F[t]:null,O=T?[1]:r?[...E,...B]:z.flatMap(e=>e.data.filter(Number.isFinite)),R=(e,t)=>{const r=e.bandwidth/Math.max(1,z.length),n=z.length>1?Math.min(k,.25*r):0;return{offset:t*r+n/2,width:Math.max(1,r-n)}},W=$&&!r?({x:e,y:r})=>{const n=Math.min(r.domain[1],Math.max(r.domain[0],0));return t.map((t,a)=>z.map((t,l)=>{const i=t.data[a];if(!Number.isFinite(i))return null;const o=Math.min(r.domain[1],Math.max(r.domain[0],i)),{offset:s,width:c}=R(e,l),d=e(a)+s+c/2,u=Math.min(r(o),r(n)),h=Math.max(r(o),r(n));if(c<13)return null;const m=Math.floor((h-u-12)/6.6),p=m>=Math.min(4,t.label.length),g=p&&t.label.length>m?`${t.label.slice(0,m-1).trimEnd()}…`:t.label,f=p?h-6:u-4;/* @__PURE__ */
641
- return Ye("text",{"data-series-label":"true",x:d,y:f,transform:`rotate(-90 ${d} ${f})`,textAnchor:"start",dominantBaseline:"central",fontSize:11,fill:p?Bs.surface:Bs.label,children:g},`n${t.key}-${a}`)}))}:null;/* @__PURE__ */
642
- return Ye(tc,{labels:t,values:O,height:a,width:l,max:T?1:i,min:T?void 0:v,formatValue:T?e=>xe(Math.round(100*e),0,S):D,yAxisLabel:s,className:c,emptyLabel:d,onSelect:y,ariaLabel:L.acrossCategories(z.map(e=>e.label),t.length),tooltip:e=>/* @__PURE__ */Ye(sc,{title:N?.[e]??t[e],rows:z.map(t=>({key:t.key,label:t.label,color:A(t,e),value:Number.isFinite(t.data[e])?T?`${xe(100*(I(t.data[e],e)??0),1,S)} · ${P(t.data[e])}`:P(t.data[e]):void 0})),footnote:T?L.inCategory(P(F[e])):void 0}),overlay:x&&!T||W?({x:e,y:n})=>/* @__PURE__ */Ge("g",{pointerEvents:"none",children:[W?.({x:e,y:n}),x&&!T&&t.map((t,a)=>{if(r){if(!z.some(e=>Number.isFinite(e.data[a])))return null;const t=z.reduce((e,t)=>e+j(t,a),0),r=t>=0?E[a]:B[a];/* @__PURE__ */
643
- return Ye("text",{"data-value-label":"true",x:e.center(a),y:t>=0?n(r)-4:n(r)+12,textAnchor:"middle",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:D(t)},`v${a}`)}return z.map((t,r)=>{const l=t.data[a];if(!Number.isFinite(l))return null;const i=l,{offset:o,width:s}=R(e,r);/* @__PURE__ */
644
- return Ye("text",{"data-value-label":"true",x:e(a)+o+s/2,y:i>=0?n(i)-4:n(i)+12,textAnchor:"middle",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:D(i)},`v${t.key}-${a}`)})})]}):void 0,children:({x:e,y:n,bottom:a,active:l})=>{const i=f?t.indexOf(f):-1,o=oc(r?F:z[0]?.data??[],b),s=l??(i>=0?i:o);/* @__PURE__ */
638
+ /* @__PURE__ */Ye("span",{className:"pl-4 font-semibold tabular-nums text-gray-900",children:e.value??"—"})]},e.key))}),n&&/* @__PURE__ */Ye("p",{className:"mt-2 text-2xs text-gray-500",children:n})]})}function uc({series:e,labels:t,stacked:r=!1,stackMode:n="value",height:a=220,width:l,max:i,formatValue:o,yAxisLabel:s,className:c,emptyLabel:d,radius:u=3,loading:h=!1,animate:m=!0,glow:p=!1,emphasise:g=!1,activeKey:f,highlight:b="none",valueLabels:x=!1,onSelect:y,min:v,formatTooltipValue:w,tooltipLabels:N,barGap:k=4,seriesLabels:$=!1}){const M=ze(),{highlighted:C}=oc(),L=he().charts,S=ue(),D=o??(e=>fe(e,S)),P=w??D;if(h)/* @__PURE__ */return Ye(ac,{height:a,width:l,variant:"bars",className:c});const A=(e,t)=>{const r=e.pointColors?.[t];if(r)return r;const n=e.pointTones?.[t];return n?Ts[n]:Rs(e.slot,e.color,e.tone)},j=e.map((e,t)=>({...e,slot:t})).filter(e=>e.data.some(e=>Number.isFinite(e))),z=(e,t)=>{const r=e.data[t];return"number"==typeof r&&Number.isFinite(r)?r:0},F=t.map((e,t)=>j.reduce((e,r)=>e+z(r,t),0)),E=t.map((e,t)=>j.reduce((e,r)=>e+Math.max(0,z(r,t)),0)),B=t.map((e,t)=>j.reduce((e,r)=>e+Math.min(0,z(r,t)),0)),T=r&&"percent"===n,I=(e,t)=>F[t]>0?e/F[t]:null,O=T?[1]:r?[...E,...B]:j.flatMap(e=>e.data.filter(Number.isFinite)),R=(e,t)=>{const r=e.bandwidth/Math.max(1,j.length),n=j.length>1?Math.min(k,.25*r):0;return{offset:t*r+n/2,width:Math.max(1,r-n)}},W=$&&!r?({x:e,y:r})=>{const n=Math.min(r.domain[1],Math.max(r.domain[0],0));return t.map((t,a)=>j.map((t,l)=>{const i=t.data[a];if(!Number.isFinite(i))return null;const o=Math.min(r.domain[1],Math.max(r.domain[0],i)),{offset:s,width:c}=R(e,l),d=e(a)+s+c/2,u=Math.min(r(o),r(n)),h=Math.max(r(o),r(n));if(c<13)return null;const m=Math.floor((h-u-12)/6.6),p=m>=Math.min(4,t.label.length),g=p&&t.label.length>m?`${t.label.slice(0,m-1).trimEnd()}…`:t.label,f=p?h-6:u-4;/* @__PURE__ */
639
+ return Ye("text",{"data-series-label":"true",x:d,y:f,transform:`rotate(-90 ${d} ${f})`,textAnchor:"start",dominantBaseline:"central",fontSize:11,fill:p?Is.surface:Is.label,children:g},`n${t.key}-${a}`)}))}:null;/* @__PURE__ */
640
+ return Ye(nc,{labels:t,values:O,height:a,width:l,max:T?1:i,min:T?void 0:v,formatValue:T?e=>xe(Math.round(100*e),0,S):D,yAxisLabel:s,className:c,emptyLabel:d,onSelect:y,ariaLabel:L.acrossCategories(j.map(e=>e.label),t.length),tooltip:e=>/* @__PURE__ */Ye(dc,{title:N?.[e]??t[e],rows:j.map(t=>({key:t.key,label:t.label,color:A(t,e),value:Number.isFinite(t.data[e])?T?`${xe(100*(I(t.data[e],e)??0),1,S)} · ${P(t.data[e])}`:P(t.data[e]):void 0})),footnote:T?L.inCategory(P(F[e])):void 0}),overlay:x&&!T||W?({x:e,y:n})=>/* @__PURE__ */Ge("g",{pointerEvents:"none",children:[W?.({x:e,y:n}),x&&!T&&t.map((t,a)=>{if(r){if(!j.some(e=>Number.isFinite(e.data[a])))return null;const t=j.reduce((e,t)=>e+z(t,a),0),r=t>=0?E[a]:B[a];/* @__PURE__ */
641
+ return Ye("text",{"data-value-label":"true",x:e.center(a),y:t>=0?n(r)-4:n(r)+12,textAnchor:"middle",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:D(t)},`v${a}`)}return j.map((t,r)=>{const l=t.data[a];if(!Number.isFinite(l))return null;const i=l,{offset:o,width:s}=R(e,r);/* @__PURE__ */
642
+ return Ye("text",{"data-value-label":"true",x:e(a)+o+s/2,y:i>=0?n(i)-4:n(i)+12,textAnchor:"middle",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:D(i)},`v${t.key}-${a}`)})})]}):void 0,children:({x:e,y:n,bottom:a,active:l})=>{const i=f?t.indexOf(f):-1,o=cc(r?F:j[0]?.data??[],b),s=l??(i>=0?i:o);/* @__PURE__ */
645
643
  return Ge("g",{children:[
646
- /* @__PURE__ */Ye(gi,{id:M,glow:p}),t.map((t,a)=>{let l=0,i=0;const o=n(Math.min(n.domain[1],Math.max(n.domain[0],0)));return z.map((t,c)=>{const d=t.data[a];if(!Number.isFinite(d))return null;const h=T?I(d,a):d;if(null===h)return null;const f=A(t,a),b=R(e,c),x=r?e(a):e(a)+b.offset,y=r?Math.max(1,e.bandwidth):b.width;let v,w,N=!0;if(r){const e=h>=0?l:i,t=e+h;h>=0?l=t:i=t,v=n(Math.max(e,t)),w=n(Math.min(e,t)),N=0===e}else v=Math.min(n(h),o),w=Math.max(n(h),o);const k=Math.max(0,w-v-(r&&!N?2:0)),$=null===s||s===a,L=$?f:g?Bs.muted:f,S=ic(t.key,C);/* @__PURE__ */
647
- return Ye("rect",{x:x,y:v,width:y,height:k,rx:u,fill:L,fillOpacity:S??($?1:g?.32:.45),filter:p&&s===a?`url(#${si(M)})`:void 0,className:"rosh-viz-mark"+(m?` ${bi.rise}`:""),style:m?xi(a*(r?1:z.length)+c,26):void 0},`${t.key}-${a}`)})}),null!==l&&!g&&/* @__PURE__ */Ye("line",{x1:e.center(l),y1:n(n.domain[1]),x2:e.center(l),y2:a,stroke:Bs.axis,strokeWidth:1})]})}})}var dc=e=>e.toFixed(2);function uc(e){return e.map(([e,t],r)=>`${0===r?"M":"L"}${dc(e)},${dc(t)}`).join(" ")}function hc(e){let t="";return e.forEach((e,r)=>{t+=`${0===r?"M":" L"}${dc(e.start)},${dc(e.y)}`,t+=` L${dc(e.end)},${dc(e.y)}`}),t}function mc(e){if(e.length<3)return uc(e);const t=e.length,r=[],n=[];for(let a=0;a<t-1;a+=1){const t=e[a+1][0]-e[a][0];r.push(t),n.push(0===t?0:(e[a+1][1]-e[a][1])/t)}const a=[n[0]];for(let e=1;e<t-1;e+=1)a.push(n[e-1]*n[e]<=0?0:(n[e-1]+n[e])/2);a.push(n[t-2]);for(let e=0;e<t-1;e+=1){if(0===n[e]){a[e]=0,a[e+1]=0;continue}const t=a[e]/n[e],r=a[e+1]/n[e],l=t*t+r*r;if(l>9){const i=3/Math.sqrt(l);a[e]=i*t*n[e],a[e+1]=i*r*n[e]}}let l=`M${dc(e[0][0])},${dc(e[0][1])}`;for(let n=0;n<t-1;n+=1){const t=r[n]/3;l+=` C${dc(e[n][0]+t)},${dc(e[n][1]+a[n]*t)} ${dc(e[n+1][0]-t)},${dc(e[n+1][1]-a[n+1]*t)} ${dc(e[n+1][0])},${dc(e[n+1][1])}`}return l}function pc(e,t=0){if(e.length<3)return uc(e);const r=e.map(e=>e[1]),n=Math.min(...r),a=Math.max(...r),l=e=>Math.min(a,Math.max(n,e)),i=(1-t)/6;let o=`M${dc(e[0][0])},${dc(e[0][1])}`;for(let t=0;t<e.length-1;t+=1){const r=e[t-1]??e[t],n=e[t],a=e[t+1],s=e[t+2]??a,c=n[0]+(a[0]-r[0])*i,d=l(n[1]+(a[1]-r[1])*i),u=a[0]-(s[0]-n[0])*i,h=l(a[1]-(s[1]-n[1])*i);o+=` C${dc(c)},${dc(d)} ${dc(u)},${dc(h)} ${dc(a[0])},${dc(a[1])}`}return o}function gc(e){if(e.length<2)return uc(e);let t=`M${dc(e[0][0])},${dc(e[0][1])}`;for(let r=1;r<e.length;r+=1){const[n,a]=e[r-1],[l,i]=e[r],o=(n+l)/2;t+=` C${dc(o)},${dc(a)} ${dc(o)},${dc(i)} ${dc(l)},${dc(i)}`}return t}function fc(e,t="linear",r=0){return 0===e.length?"":1===e.length?`M${dc(e[0][0])},${dc(e[0][1])}`:"monotone"===t?mc(e):"spline"===t?pc(e,r):"bump"===t?gc(e):uc(e)}function bc(e,t,r){if(0===t.length)return"";const n=t[0],a=t[t.length-1];return`${e} L${dc(a[0])},${dc(r)} L${dc(n[0])},${dc(r)} Z`}function xc(e,t){if(0===t.length)return e;return`${e} L${[...t].reverse().map(([e,t])=>`${dc(e)},${dc(t)}`).join(" L")} Z`}function yc(e,t,r,n,a=-Math.PI/2){return Array.from({length:n},(l,i)=>{const o=a+2*i*Math.PI/n;return[e+r*Math.cos(o),t+r*Math.sin(o)]})}function vc(e,t,r,n,a,l){const i=l-a;if(Math.abs(i)>=2*Math.PI){const l=a+Math.PI;return`${vc(e,t,r,n,a,l)} ${vc(e,t,r,n,l,a+2*Math.PI)}`}const o=Math.abs(i)>Math.PI?1:0,s=(r,n)=>[e+r*Math.cos(n),t+r*Math.sin(n)],[c,d]=s(n,a),[u,h]=s(n,l);if(r<=0)return`M${dc(e)},${dc(t)} L${dc(c)},${dc(d)} A${dc(n)},${dc(n)} 0 ${o} 1 ${dc(u)},${dc(h)} Z`;const[m,p]=s(r,l),[g,f]=s(r,a);return`M${dc(c)},${dc(d)} A${dc(n)},${dc(n)} 0 ${o} 1 ${dc(u)},${dc(h)} L${dc(m)},${dc(p)} A${dc(r)},${dc(r)} 0 ${o} 0 ${dc(g)},${dc(f)} Z`}function wc({segments:e,variant:t="pie",size:r=280,innerRadius:n,padAngle:a=.012,maxSegments:l=6,otherLabel:i,formatValue:o,centerLabel:s,animate:c=!0,labels:d="none",labelMinShare:u=.04,className:h,emptyLabel:m}){const p=he().charts,g=ue(),f=o??(e=>fe(e,g)),b=i??p.other,x=m??p.nothingToBreakDown,y=je(),[v,w]=Ee(null),{highlighted:N}=lc(),k=Be(null),$=Qs(k,Number.POSITIVE_INFINITY),M=e.map((e,t)=>({...e,slot:t})).filter(e=>e.value>0);if(0===M.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${h??""}`,children:x});const C=[...M].sort((e,t)=>t.value-e.value),L=C.slice(0,l),S=C.slice(l),D=S.length>0?[...L,{key:"__other__",label:b,value:S.reduce((e,t)=>e+t.value,0),slot:-1,color:Bs.muted}]:L,P=e=>Is(e.slot,e.color,e.tone),A=D.reduce((e,t)=>e+t.value,0),z=Math.ceil(.62*Math.max(...D.map(e=>String(e.label).length),4)*11)+24,j="outside"===d&&$>=120+2*z,F=j?z:0,E=j?Math.max(120,Math.min(r,$-2*F)):r,B=E+2*F,T=F+E/2,I=E/2,O=E/2-12,R=n??("ring"===t?.58*O:0),W=Gs(D.length,a),K=Math.max(...D.map(e=>e.value)),q=e=>R+(O-R)*Math.sqrt(Math.max(0,e)/K);let H=-Math.PI/2;const _=(()=>{if(!j)return[];let e=-Math.PI/2;const r=D.map((r,n)=>{const l="rose"===t?Gs(D.length,a).step:r.value/A*Math.PI*2,i="rose"===t?Gs(D.length,a).center(n):e+l/2;e+=l;const o="rose"===t?q(r.value):O;return{key:r.key,label:r.label,share:r.value/A,right:Math.cos(i)>=0,anchor:[T+o*Math.cos(i),I+o*Math.sin(i)],y:I+(o+14)*Math.sin(i),index:n}}).filter(e=>e.share>=u),n=Math.max(1,Math.floor((E-11-13)/26)+1),l=/* @__PURE__ */new Set;for(const e of[!0,!1]){const t=r.filter(t=>t.right===e).sort((e,t)=>t.share-e.share).slice(0,n).sort((e,t)=>e.y-t.y);for(let e=1;e<t.length;e+=1)t[e].y-t[e-1].y<26&&(t[e].y=t[e-1].y+26);for(let e=t.length-1;e>=0;e-=1){const r=e===t.length-1?E-13:t[e+1].y-26;t[e].y=Math.min(t[e].y,r)}t.forEach((e,r)=>{e.y=Math.max(e.y,0===r?11:t[r-1].y+26),l.add(e.key)})}return r.filter(e=>l.has(e.key))})(),U=(e,t)=>null!==v?v!==e:null!==N&&N!==t,V=null!==v?D[v]:void 0;/* @__PURE__ */
644
+ /* @__PURE__ */Ye(gi,{id:M,glow:p}),t.map((t,a)=>{let l=0,i=0;const o=n(Math.min(n.domain[1],Math.max(n.domain[0],0)));return j.map((t,c)=>{const d=t.data[a];if(!Number.isFinite(d))return null;const h=T?I(d,a):d;if(null===h)return null;const f=A(t,a),b=R(e,c),x=r?e(a):e(a)+b.offset,y=r?Math.max(1,e.bandwidth):b.width;let v,w,N=!0;if(r){const e=h>=0?l:i,t=e+h;h>=0?l=t:i=t,v=n(Math.max(e,t)),w=n(Math.min(e,t)),N=0===e}else v=Math.min(n(h),o),w=Math.max(n(h),o);const k=Math.max(0,w-v-(r&&!N?2:0)),$=null===s||s===a,L=$?f:g?Is.muted:f,S=sc(t.key,C);/* @__PURE__ */
645
+ return Ye("rect",{x:x,y:v,width:y,height:k,rx:u,fill:L,fillOpacity:S??($?1:g?.32:.45),filter:p&&s===a?`url(#${si(M)})`:void 0,className:"rosh-viz-mark"+(m?` ${bi.rise}`:""),style:m?xi(a*(r?1:j.length)+c,26):void 0},`${t.key}-${a}`)})}),null!==l&&!g&&/* @__PURE__ */Ye("line",{x1:e.center(l),y1:n(n.domain[1]),x2:e.center(l),y2:a,stroke:Is.axis,strokeWidth:1})]})}})}var hc=e=>e.toFixed(2);function mc(e){return e.map(([e,t],r)=>`${0===r?"M":"L"}${hc(e)},${hc(t)}`).join(" ")}function pc(e){let t="";return e.forEach((e,r)=>{t+=`${0===r?"M":" L"}${hc(e.start)},${hc(e.y)}`,t+=` L${hc(e.end)},${hc(e.y)}`}),t}function gc(e){if(e.length<3)return mc(e);const t=e.length,r=[],n=[];for(let a=0;a<t-1;a+=1){const t=e[a+1][0]-e[a][0];r.push(t),n.push(0===t?0:(e[a+1][1]-e[a][1])/t)}const a=[n[0]];for(let e=1;e<t-1;e+=1)a.push(n[e-1]*n[e]<=0?0:(n[e-1]+n[e])/2);a.push(n[t-2]);for(let e=0;e<t-1;e+=1){if(0===n[e]){a[e]=0,a[e+1]=0;continue}const t=a[e]/n[e],r=a[e+1]/n[e],l=t*t+r*r;if(l>9){const i=3/Math.sqrt(l);a[e]=i*t*n[e],a[e+1]=i*r*n[e]}}let l=`M${hc(e[0][0])},${hc(e[0][1])}`;for(let n=0;n<t-1;n+=1){const t=r[n]/3;l+=` C${hc(e[n][0]+t)},${hc(e[n][1]+a[n]*t)} ${hc(e[n+1][0]-t)},${hc(e[n+1][1]-a[n+1]*t)} ${hc(e[n+1][0])},${hc(e[n+1][1])}`}return l}function fc(e,t=0){if(e.length<3)return mc(e);const r=e.map(e=>e[1]),n=Math.min(...r),a=Math.max(...r),l=e=>Math.min(a,Math.max(n,e)),i=(1-t)/6;let o=`M${hc(e[0][0])},${hc(e[0][1])}`;for(let t=0;t<e.length-1;t+=1){const r=e[t-1]??e[t],n=e[t],a=e[t+1],s=e[t+2]??a,c=n[0]+(a[0]-r[0])*i,d=l(n[1]+(a[1]-r[1])*i),u=a[0]-(s[0]-n[0])*i,h=l(a[1]-(s[1]-n[1])*i);o+=` C${hc(c)},${hc(d)} ${hc(u)},${hc(h)} ${hc(a[0])},${hc(a[1])}`}return o}function bc(e){if(e.length<2)return mc(e);let t=`M${hc(e[0][0])},${hc(e[0][1])}`;for(let r=1;r<e.length;r+=1){const[n,a]=e[r-1],[l,i]=e[r],o=(n+l)/2;t+=` C${hc(o)},${hc(a)} ${hc(o)},${hc(i)} ${hc(l)},${hc(i)}`}return t}function xc(e,t="linear",r=0){return 0===e.length?"":1===e.length?`M${hc(e[0][0])},${hc(e[0][1])}`:"monotone"===t?gc(e):"spline"===t?fc(e,r):"bump"===t?bc(e):mc(e)}function yc(e,t,r){if(0===t.length)return"";const n=t[0],a=t[t.length-1];return`${e} L${hc(a[0])},${hc(r)} L${hc(n[0])},${hc(r)} Z`}function vc(e,t){if(0===t.length)return e;return`${e} L${[...t].reverse().map(([e,t])=>`${hc(e)},${hc(t)}`).join(" L")} Z`}function wc(e,t,r,n,a=-Math.PI/2){return Array.from({length:n},(l,i)=>{const o=a+2*i*Math.PI/n;return[e+r*Math.cos(o),t+r*Math.sin(o)]})}function Nc(e,t,r,n,a,l){const i=l-a;if(Math.abs(i)>=2*Math.PI){const l=a+Math.PI;return`${Nc(e,t,r,n,a,l)} ${Nc(e,t,r,n,l,a+2*Math.PI)}`}const o=Math.abs(i)>Math.PI?1:0,s=(r,n)=>[e+r*Math.cos(n),t+r*Math.sin(n)],[c,d]=s(n,a),[u,h]=s(n,l);if(r<=0)return`M${hc(e)},${hc(t)} L${hc(c)},${hc(d)} A${hc(n)},${hc(n)} 0 ${o} 1 ${hc(u)},${hc(h)} Z`;const[m,p]=s(r,l),[g,f]=s(r,a);return`M${hc(c)},${hc(d)} A${hc(n)},${hc(n)} 0 ${o} 1 ${hc(u)},${hc(h)} L${hc(m)},${hc(p)} A${hc(r)},${hc(r)} 0 ${o} 0 ${hc(g)},${hc(f)} Z`}function kc({segments:e,variant:t="pie",size:r=280,innerRadius:n,padAngle:a=.012,maxSegments:l=6,otherLabel:i,formatValue:o,centerLabel:s,animate:c=!0,labels:d="none",labelMinShare:u=.04,className:h,emptyLabel:m}){const p=he().charts,g=ue(),f=o??(e=>fe(e,g)),b=i??p.other,x=m??p.nothingToBreakDown,y=ze(),[v,w]=Ee(null),{highlighted:N}=oc(),k=Be(null),$=tc(k,Number.POSITIVE_INFINITY),M=e.map((e,t)=>({...e,slot:t})).filter(e=>e.value>0);if(0===M.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${h??""}`,children:x});const C=[...M].sort((e,t)=>t.value-e.value),L=C.slice(0,l),S=C.slice(l),D=S.length>0?[...L,{key:"__other__",label:b,value:S.reduce((e,t)=>e+t.value,0),slot:-1,color:Is.muted}]:L,P=e=>Rs(e.slot,e.color,e.tone),A=D.reduce((e,t)=>e+t.value,0),j=Math.ceil(.62*Math.max(...D.map(e=>String(e.label).length),4)*11)+24,z="outside"===d&&$>=120+2*j,F=z?j:0,E=z?Math.max(120,Math.min(r,$-2*F)):r,B=E+2*F,T=F+E/2,I=E/2,O=E/2-12,R=n??("ring"===t?.58*O:0),W=Zs(D.length,a),K=Math.max(...D.map(e=>e.value)),_=e=>R+(O-R)*Math.sqrt(Math.max(0,e)/K);let q=-Math.PI/2;const H=(()=>{if(!z)return[];let e=-Math.PI/2;const r=D.map((r,n)=>{const l="rose"===t?Zs(D.length,a).step:r.value/A*Math.PI*2,i="rose"===t?Zs(D.length,a).center(n):e+l/2;e+=l;const o="rose"===t?_(r.value):O;return{key:r.key,label:r.label,share:r.value/A,right:Math.cos(i)>=0,anchor:[T+o*Math.cos(i),I+o*Math.sin(i)],y:I+(o+14)*Math.sin(i),index:n}}).filter(e=>e.share>=u),n=Math.max(1,Math.floor((E-11-13)/26)+1),l=/* @__PURE__ */new Set;for(const e of[!0,!1]){const t=r.filter(t=>t.right===e).sort((e,t)=>t.share-e.share).slice(0,n).sort((e,t)=>e.y-t.y);for(let e=1;e<t.length;e+=1)t[e].y-t[e-1].y<26&&(t[e].y=t[e-1].y+26);for(let e=t.length-1;e>=0;e-=1){const r=e===t.length-1?E-13:t[e+1].y-26;t[e].y=Math.min(t[e].y,r)}t.forEach((e,r)=>{e.y=Math.max(e.y,0===r?11:t[r-1].y+26),l.add(e.key)})}return r.filter(e=>l.has(e.key))})(),U=(e,t)=>null!==v?v!==e:null!==N&&N!==t,V=null!==v?D[v]:void 0;/* @__PURE__ */
648
646
  return Ge("div",{className:`relative ${h??""}`,ref:k,children:[
649
647
  /* @__PURE__ */Ge("svg",{width:"100%",height:E,viewBox:`0 0 ${B} ${E}`,role:"img","aria-labelledby":y,onMouseLeave:()=>w(null),children:[
650
- /* @__PURE__ */Ye("title",{id:y,children:p.breakdown(f(A),D.length)}),D.map((e,r)=>{const n=P(e),l="rose"===t?W(r):H,i="rose"===t?W.step:e.value/A*Math.PI*2-a;"rose"!==t&&(H+=e.value/A*Math.PI*2);const o=l+Math.max(.001,i),s="rose"===t?q(e.value):O;/* @__PURE__ */
651
- return Ye("path",{d:vc(T,I,R,s,l,o),fill:n,fillOpacity:U(r,e.key)?.4:1,stroke:Bs.surface,strokeWidth:1,className:c?bi.sweep:void 0,style:c?xi(r,55):void 0,onMouseEnter:()=>w(r)},e.key)}),_.map(e=>{const t=e.right?B-6:6,r=e.right?T+O+14:T-O-14;/* @__PURE__ */
648
+ /* @__PURE__ */Ye("title",{id:y,children:p.breakdown(f(A),D.length)}),D.map((e,r)=>{const n=P(e),l="rose"===t?W(r):q,i="rose"===t?W.step:e.value/A*Math.PI*2-a;"rose"!==t&&(q+=e.value/A*Math.PI*2);const o=l+Math.max(.001,i),s="rose"===t?_(e.value):O;/* @__PURE__ */
649
+ return Ye("path",{d:Nc(T,I,R,s,l,o),fill:n,fillOpacity:U(r,e.key)?.4:1,stroke:Is.surface,strokeWidth:1,className:c?bi.sweep:void 0,style:c?xi(r,55):void 0,onMouseEnter:()=>w(r)},e.key)}),H.map(e=>{const t=e.right?B-6:6,r=e.right?T+O+14:T-O-14;/* @__PURE__ */
652
650
  return Ge("g",{children:[
653
- /* @__PURE__ */Ye("polyline",{points:`${e.anchor[0].toFixed(1)},${e.anchor[1].toFixed(1)} ${r},${e.y.toFixed(1)} ${t},${e.y.toFixed(1)}`,fill:"none",stroke:Bs.grid,strokeWidth:1}),
654
- /* @__PURE__ */Ye("text",{x:t,y:e.y-2,fontSize:11,fill:Bs.label,textAnchor:e.right?"end":"start",children:e.label}),
655
- /* @__PURE__ */Ye("text",{x:t,y:e.y+10,fontSize:11,fontWeight:600,fill:Bs.label,textAnchor:e.right?"end":"start",style:{fontVariantNumeric:"tabular-nums"},children:xe(100*e.share,1,g)})]},`lbl-${e.key}`)}),s&&R>0&&/* @__PURE__ */Ye("text",{x:T,y:I+5,textAnchor:"middle",fontSize:16,fontWeight:600,fill:Bs.label,children:s})]}),V&&null!==v&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:V.label,rows:[{key:"value",label:p.value,color:P(V),value:f(V.value)},{key:"share",label:p.share,color:Bs.muted,value:xe(V.value/A*100,1,g)}]})}),
651
+ /* @__PURE__ */Ye("polyline",{points:`${e.anchor[0].toFixed(1)},${e.anchor[1].toFixed(1)} ${r},${e.y.toFixed(1)} ${t},${e.y.toFixed(1)}`,fill:"none",stroke:Is.grid,strokeWidth:1}),
652
+ /* @__PURE__ */Ye("text",{x:t,y:e.y-2,fontSize:11,fill:Is.label,textAnchor:e.right?"end":"start",children:e.label}),
653
+ /* @__PURE__ */Ye("text",{x:t,y:e.y+10,fontSize:11,fontWeight:600,fill:Is.label,textAnchor:e.right?"end":"start",style:{fontVariantNumeric:"tabular-nums"},children:xe(100*e.share,1,g)})]},`lbl-${e.key}`)}),s&&R>0&&/* @__PURE__ */Ye("text",{x:T,y:I+5,textAnchor:"middle",fontSize:16,fontWeight:600,fill:Is.label,children:s})]}),V&&null!==v&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:V.label,rows:[{key:"value",label:p.value,color:P(V),value:f(V.value)},{key:"share",label:p.share,color:Is.muted,value:xe(V.value/A*100,1,g)}]})}),
656
654
  /* @__PURE__ */Ye("ul",{className:"m-0 mt-3 grid gap-1 p-0",style:{gridTemplateColumns:"repeat(auto-fit,minmax(140px,1fr))"},children:D.map((e,t)=>/* @__PURE__ */Ge("li",{className:"flex list-none items-center gap-2 text-xs text-gray-600",children:[
657
655
  /* @__PURE__ */Ye("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:P(e)}}),
658
656
  /* @__PURE__ */Ye("span",{className:"flex-1 truncate",children:e.label}),
659
- /* @__PURE__ */Ye("span",{className:"tabular-nums text-gray-800",children:xe(e.value/A*100,1,g)})]},e.key))})]})}var Nc={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},kc=[12,18,14,22,19,27,24,31,28,35,30,38],$c=["J","F","M","A","M","J","J","A","S","O","N","D"],Mc=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],Cc=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function Lc(){/* @__PURE__ */
660
- return Ye(Ma,{groups:Nc,children:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-6xl space-y-6",children:[
657
+ /* @__PURE__ */Ye("span",{className:"tabular-nums text-gray-800",children:xe(e.value/A*100,1,g)})]},e.key))})]})}var $c={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},Mc=[12,18,14,22,19,27,24,31,28,35,30,38],Cc=["J","F","M","A","M","J","J","A","S","O","N","D"],Lc=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],Sc=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function Dc(){/* @__PURE__ */
658
+ return Ye(Ma,{groups:$c,children:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-6xl space-y-6",children:[
661
659
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-4",children:[
662
660
  /* @__PURE__ */Ge("div",{children:[
663
661
  /* @__PURE__ */Ye("h1",{className:"text-xl font-semibold text-gray-900",children:"Dashboard"}),
@@ -666,34 +664,34 @@ return Ye(Ma,{groups:Nc,children:/* @__PURE__ */Ye("div",{className:"h-full over
666
664
  /* @__PURE__ */Ye(M,{variant:"secondary",size:"sm",children:"Export"}),
667
665
  /* @__PURE__ */Ye(M,{size:"sm",children:"New report"})]})]}),
668
666
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[
669
- /* @__PURE__ */Ye(ja,{label:"Revenue",value:"$38.2k",delta:{value:"12%",direction:"up"}}),
670
- /* @__PURE__ */Ye(ja,{label:"Orders",value:"1,204",delta:{value:"4%",direction:"up"}}),
671
- /* @__PURE__ */Ye(ja,{label:"Customers",value:"892",delta:{value:"2%",direction:"down"}}),
672
- /* @__PURE__ */Ye(ja,{label:"Refunds",value:"$1.1k",delta:{value:"0%",direction:"flat"}})]}),
667
+ /* @__PURE__ */Ye(za,{label:"Revenue",value:"$38.2k",delta:{value:"12%",direction:"up"}}),
668
+ /* @__PURE__ */Ye(za,{label:"Orders",value:"1,204",delta:{value:"4%",direction:"up"}}),
669
+ /* @__PURE__ */Ye(za,{label:"Customers",value:"892",delta:{value:"2%",direction:"down"}}),
670
+ /* @__PURE__ */Ye(za,{label:"Refunds",value:"$1.1k",delta:{value:"0%",direction:"flat"}})]}),
673
671
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3",children:[
674
- /* @__PURE__ */Ye(za,{header:"Revenue",className:"lg:col-span-2",children:/* @__PURE__ */Ye(cc,{labels:$c,height:200,series:[{key:"revenue",label:"Revenue",data:kc}],formatValue:e=>`$${e}k`})}),
675
- /* @__PURE__ */Ye(za,{header:"Traffic sources",children:/* @__PURE__ */Ye(wc,{variant:"ring",size:180,segments:Mc,centerLabel:"100%"})})]}),
676
- /* @__PURE__ */Ye(za,{header:"Recent orders",padded:!1,children:/* @__PURE__ */Ge("table",{className:"w-full text-sm",children:[
672
+ /* @__PURE__ */Ye(ja,{header:"Revenue",className:"lg:col-span-2",children:/* @__PURE__ */Ye(uc,{labels:Cc,height:200,series:[{key:"revenue",label:"Revenue",data:Mc}],formatValue:e=>`$${e}k`})}),
673
+ /* @__PURE__ */Ye(ja,{header:"Traffic sources",children:/* @__PURE__ */Ye(kc,{variant:"ring",size:180,segments:Lc,centerLabel:"100%"})})]}),
674
+ /* @__PURE__ */Ye(ja,{header:"Recent orders",padded:!1,children:/* @__PURE__ */Ge("table",{className:"w-full text-sm",children:[
677
675
  /* @__PURE__ */Ye("thead",{children:/* @__PURE__ */Ge("tr",{className:"border-b border-gray-100 text-left text-xs uppercase tracking-wide text-gray-400",children:[
678
676
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium`,children:"Order"}),
679
677
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium`,children:"Customer"}),
680
678
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium`,children:"Total"}),
681
679
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium`,children:"Status"})]})}),
682
- /* @__PURE__ */Ye("tbody",{className:"divide-y divide-gray-100",children:Cc.map(e=>/* @__PURE__ */Ge("tr",{className:"text-gray-700",children:[
680
+ /* @__PURE__ */Ye("tbody",{className:"divide-y divide-gray-100",children:Sc.map(e=>/* @__PURE__ */Ge("tr",{className:"text-gray-700",children:[
683
681
  /* @__PURE__ */Ye("td",{className:"px-4 py-2 font-mono text-xs text-gray-500",children:e.id}),
684
682
  /* @__PURE__ */Ye("td",{className:"px-4 py-2",children:/* @__PURE__ */Ge("span",{className:"flex items-center gap-2",children:[
685
683
  /* @__PURE__ */Ye(Ll,{size:"xs",name:e.customer}),e.customer]})}),
686
684
  /* @__PURE__ */Ye("td",{className:"px-4 py-2",children:e.total}),
687
685
  /* @__PURE__ */Ye("td",{className:"px-4 py-2",children:/* @__PURE__ */Ye(La,{status:e.status})})]},e.id))})]})}),
688
686
  /* @__PURE__ */Ge("p",{className:"flex items-center gap-2 text-xs text-gray-400",children:[
689
- /* @__PURE__ */Ye("span",{className:"text-emerald-600",children:/* @__PURE__ */Ye(zs,{data:kc,width:80,height:20})}),"Trending up 12% vs last month"]})]})})})}var Sc={active:"success",invited:"queued",suspended:"danger",pending:"pending"},Dc=[{name:"Alice Nguyen",email:"alice@acme.co",role:"Admin",status:"active"},{name:"Marco Reyes",email:"marco@acme.co",role:"Editor",status:"invited"},{name:"Priya Patel",email:"priya@acme.co",role:"Editor",status:"active"},{name:"Tom Becker",email:"tom@acme.co",role:"Viewer",status:"suspended"},{name:"Sara Lind",email:"sara@acme.co",role:"Viewer",status:"pending"},{name:"Yuki Tanaka",email:"yuki@acme.co",role:"Editor",status:"active"}];function Pc(){const[e,t]=Ee(1),[r,n]=Ee(""),[l,i]=Ee("");/* @__PURE__ */
690
- return Ye(Ma,{groups:Sc,children:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-5xl space-y-4",children:[
687
+ /* @__PURE__ */Ye("span",{className:"text-emerald-600",children:/* @__PURE__ */Ye(Fs,{data:Mc,width:80,height:20})}),"Trending up 12% vs last month"]})]})})})}var Pc={active:"success",invited:"queued",suspended:"danger",pending:"pending"},Ac=[{name:"Alice Nguyen",email:"alice@acme.co",role:"Admin",status:"active"},{name:"Marco Reyes",email:"marco@acme.co",role:"Editor",status:"invited"},{name:"Priya Patel",email:"priya@acme.co",role:"Editor",status:"active"},{name:"Tom Becker",email:"tom@acme.co",role:"Viewer",status:"suspended"},{name:"Sara Lind",email:"sara@acme.co",role:"Viewer",status:"pending"},{name:"Yuki Tanaka",email:"yuki@acme.co",role:"Editor",status:"active"}];function jc(){const[e,t]=Ee(1),[r,n]=Ee(""),[l,i]=Ee("");/* @__PURE__ */
688
+ return Ye(Ma,{groups:Pc,children:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-5xl space-y-4",children:[
691
689
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-4",children:[
692
690
  /* @__PURE__ */Ye("h1",{className:"text-xl font-semibold text-gray-900",children:"Members"}),
693
691
  /* @__PURE__ */Ye(M,{size:"sm",children:"Invite member"})]}),
694
- /* @__PURE__ */Ge(za,{padded:!1,children:[
692
+ /* @__PURE__ */Ge(ja,{padded:!1,children:[
695
693
  /* @__PURE__ */Ge("div",{className:"flex flex-wrap items-center gap-2 border-b border-gray-100 p-3",children:[
696
- /* @__PURE__ */Ye("div",{className:"min-w-48 flex-1",children:/* @__PURE__ */Ye(Qe,{value:l,onChange:e=>i(e.target.value),placeholder:"Search members…",leftIcon:/* @__PURE__ */Ye(Ac,{})})}),
694
+ /* @__PURE__ */Ye("div",{className:"min-w-48 flex-1",children:/* @__PURE__ */Ye(Qe,{value:l,onChange:e=>i(e.target.value),placeholder:"Search members…",leftIcon:/* @__PURE__ */Ye(zc,{})})}),
697
695
  /* @__PURE__ */Ye("div",{className:"w-40",children:/* @__PURE__ */Ye(gt,{value:r,onChange:n,placeholder:"All roles",options:[{value:"admin",label:"Admin"},{value:"editor",label:"Editor"},{value:"viewer",label:"Viewer"}]})}),
698
696
  /* @__PURE__ */Ye(M,{variant:"secondary",size:"sm",children:"Filter"})]}),
699
697
  /* @__PURE__ */Ge("table",{className:"w-full text-sm",children:[
@@ -702,7 +700,7 @@ return Ye(Ma,{groups:Sc,children:/* @__PURE__ */Ye("div",{className:"h-full over
702
700
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium`,children:"Role"}),
703
701
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium`,children:"Status"}),
704
702
  /* @__PURE__ */Ye("th",{className:`${a} px-4 py-2 font-medium text-right`,children:"Actions"})]})}),
705
- /* @__PURE__ */Ye("tbody",{className:"divide-y divide-gray-100",children:Dc.map(e=>/* @__PURE__ */Ge("tr",{className:"text-gray-700 hover:bg-gray-50",children:[
703
+ /* @__PURE__ */Ye("tbody",{className:"divide-y divide-gray-100",children:Ac.map(e=>/* @__PURE__ */Ge("tr",{className:"text-gray-700 hover:bg-gray-50",children:[
706
704
  /* @__PURE__ */Ge("td",{className:"px-4 py-3",children:[
707
705
  /* @__PURE__ */Ye("div",{className:"font-medium text-gray-900",children:e.name}),
708
706
  /* @__PURE__ */Ye("div",{className:"text-xs text-gray-400",children:e.email})]}),
@@ -711,19 +709,19 @@ return Ye(Ma,{groups:Sc,children:/* @__PURE__ */Ye("div",{className:"h-full over
711
709
  /* @__PURE__ */Ye("td",{className:"px-4 py-3 text-right",children:/* @__PURE__ */Ye(M,{variant:"ghost",size:"sm",children:"Edit"})})]},e.email))})]}),
712
710
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between border-t border-gray-100 p-3",children:[
713
711
  /* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:"Showing 1–6 of 48"}),
714
- /* @__PURE__ */Ye(vs,{page:e,pageCount:8,onPageChange:t,showEdges:!0})]})]})]})})})}function Ac(){/* @__PURE__ */
715
- return Ye(Pe,{name:"search",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}function zc(){const[e,t]=Ee("pro"),[r,n]=Ee(!0),[a,l]=Ee("us");/* @__PURE__ */
712
+ /* @__PURE__ */Ye(Ns,{page:e,pageCount:8,onPageChange:t,showEdges:!0})]})]})]})})})}function zc(){/* @__PURE__ */
713
+ return Ye(Pe,{name:"search",className:"h-4 w-4",strokeWidth:"2","aria-hidden":"true"})}function Fc(){const[e,t]=Ee("pro"),[r,n]=Ee(!0),[a,l]=Ee("us");/* @__PURE__ */
716
714
  return Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("form",{className:"mx-auto max-w-2xl space-y-5",onSubmit:e=>e.preventDefault(),children:[
717
715
  /* @__PURE__ */Ge("div",{children:[
718
716
  /* @__PURE__ */Ye("h1",{className:"text-xl font-semibold text-gray-900",children:"Account settings"}),
719
717
  /* @__PURE__ */Ye("p",{className:"text-sm text-gray-500",children:"Update your profile and preferences."})]}),
720
- /* @__PURE__ */Ye(za,{header:"Profile",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
718
+ /* @__PURE__ */Ye(ja,{header:"Profile",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
721
719
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[
722
720
  /* @__PURE__ */Ye(vt,{label:"First name",htmlFor:"fn",required:!0,children:/* @__PURE__ */Ye(Qe,{id:"fn",defaultValue:"Alice"})}),
723
721
  /* @__PURE__ */Ye(vt,{label:"Last name",htmlFor:"ln",required:!0,children:/* @__PURE__ */Ye(Qe,{id:"ln",defaultValue:"Nguyen"})})]}),
724
722
  /* @__PURE__ */Ye(vt,{label:"Email",htmlFor:"email",hint:"We'll never share your email.",children:/* @__PURE__ */Ye(Qe,{id:"email",type:"email",defaultValue:"alice@acme.co"})}),
725
723
  /* @__PURE__ */Ye(vt,{label:"Bio",htmlFor:"bio",hint:"Brief description for your profile.",children:/* @__PURE__ */Ye(et,{id:"bio",autoGrow:!0,defaultValue:"Product designer at Acme."})})]})}),
726
- /* @__PURE__ */Ye(za,{header:"Preferences",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
724
+ /* @__PURE__ */Ye(ja,{header:"Preferences",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
727
725
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[
728
726
  /* @__PURE__ */Ye(vt,{label:"Country",htmlFor:"country",children:/* @__PURE__ */Ye(gt,{value:a,onChange:l,options:[{value:"us",label:"United States"},{value:"de",label:"Germany"},{value:"jp",label:"Japan"}]})}),
729
727
  /* @__PURE__ */Ye(vt,{label:"Plan",children:/* @__PURE__ */Ge("div",{className:"space-y-2 pt-1",children:[
@@ -733,13 +731,13 @@ return Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__
733
731
  /* @__PURE__ */Ye(bt,{checked:r,onChange:n,label:"Email me product updates",description:"Occasional news — no more than once a month."})]})}),
734
732
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-end gap-2",children:[
735
733
  /* @__PURE__ */Ye(M,{variant:"secondary",children:"Cancel"}),
736
- /* @__PURE__ */Ye(M,{type:"submit",children:"Save changes"})]})]})})}var jc=[{name:"Mechanical keyboard",qty:1,price:129},{name:"USB-C cable (2m)",qty:2,price:12},{name:"Laptop stand",qty:1,price:48}];function Fc(){const[e,t]=Ee(!0),[r,n]=Ee("us"),a=jc.reduce((e,t)=>e+t.qty*t.price,0),l=a+9;/* @__PURE__ */
734
+ /* @__PURE__ */Ye(M,{type:"submit",children:"Save changes"})]})]})})}var Ec=[{name:"Mechanical keyboard",qty:1,price:129},{name:"USB-C cable (2m)",qty:2,price:12},{name:"Laptop stand",qty:1,price:48}];function Bc(){const[e,t]=Ee(!0),[r,n]=Ee("us"),a=Ec.reduce((e,t)=>e+t.qty*t.price,0),l=a+9;/* @__PURE__ */
737
735
  return Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-5xl space-y-5",children:[
738
736
  /* @__PURE__ */Ye("h1",{className:"text-xl font-semibold text-gray-900",children:"Checkout"}),
739
737
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[
740
738
  /* @__PURE__ */Ge("form",{className:"space-y-5 lg:col-span-2",onSubmit:e=>e.preventDefault(),children:[
741
- /* @__PURE__ */Ye(za,{header:"Contact",children:/* @__PURE__ */Ye("div",{className:"space-y-4",children:/* @__PURE__ */Ye(vt,{label:"Email",htmlFor:"ck-email",required:!0,children:/* @__PURE__ */Ye(Qe,{id:"ck-email",type:"email",placeholder:"you@example.com"})})})}),
742
- /* @__PURE__ */Ye(za,{header:"Shipping address",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
739
+ /* @__PURE__ */Ye(ja,{header:"Contact",children:/* @__PURE__ */Ye("div",{className:"space-y-4",children:/* @__PURE__ */Ye(vt,{label:"Email",htmlFor:"ck-email",required:!0,children:/* @__PURE__ */Ye(Qe,{id:"ck-email",type:"email",placeholder:"you@example.com"})})})}),
740
+ /* @__PURE__ */Ye(ja,{header:"Shipping address",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
743
741
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[
744
742
  /* @__PURE__ */Ye(vt,{label:"First name",required:!0,children:/* @__PURE__ */Ye(Qe,{placeholder:"Alice"})}),
745
743
  /* @__PURE__ */Ye(vt,{label:"Last name",required:!0,children:/* @__PURE__ */Ye(Qe,{placeholder:"Nguyen"})})]}),
@@ -749,14 +747,14 @@ return Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__
749
747
  /* @__PURE__ */Ye(vt,{label:"ZIP",children:/* @__PURE__ */Ye(Qe,{placeholder:"94103"})}),
750
748
  /* @__PURE__ */Ye(vt,{label:"Country",children:/* @__PURE__ */Ye(gt,{value:r,onChange:n,options:[{value:"us",label:"United States"},{value:"de",label:"Germany"},{value:"jp",label:"Japan"}]})})]}),
751
749
  /* @__PURE__ */Ye(bt,{checked:e,onChange:t,label:"Billing address same as shipping"})]})}),
752
- /* @__PURE__ */Ye(za,{header:"Payment",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
750
+ /* @__PURE__ */Ye(ja,{header:"Payment",children:/* @__PURE__ */Ge("div",{className:"space-y-4",children:[
753
751
  /* @__PURE__ */Ye(vt,{label:"Card number",required:!0,children:/* @__PURE__ */Ye(Qe,{placeholder:"1234 5678 9012 3456"})}),
754
752
  /* @__PURE__ */Ge("div",{className:"grid grid-cols-2 gap-4",children:[
755
753
  /* @__PURE__ */Ye(vt,{label:"Expiry",required:!0,children:/* @__PURE__ */Ye(Qe,{placeholder:"MM / YY"})}),
756
754
  /* @__PURE__ */Ye(vt,{label:"CVC",required:!0,children:/* @__PURE__ */Ye(Qe,{placeholder:"123"})})]})]})})]}),
757
755
  /* @__PURE__ */Ge("div",{className:"space-y-4",children:[
758
- /* @__PURE__ */Ge(za,{header:"Order summary",children:[
759
- /* @__PURE__ */Ye("ul",{className:"space-y-2 text-sm",children:jc.map(e=>/* @__PURE__ */Ge("li",{className:"flex items-center justify-between gap-2 text-gray-700",children:[
756
+ /* @__PURE__ */Ge(ja,{header:"Order summary",children:[
757
+ /* @__PURE__ */Ye("ul",{className:"space-y-2 text-sm",children:Ec.map(e=>/* @__PURE__ */Ge("li",{className:"flex items-center justify-between gap-2 text-gray-700",children:[
760
758
  /* @__PURE__ */Ge("span",{children:[e.name," ",
761
759
  /* @__PURE__ */Ge("span",{className:"text-gray-400",children:["×",e.qty]})]}),
762
760
  /* @__PURE__ */Ge("span",{children:["$",e.qty*e.price]})]},e.name))}),
@@ -771,11 +769,11 @@ return Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__
771
769
  /* @__PURE__ */Ye("span",{children:"Total"}),
772
770
  /* @__PURE__ */Ge("span",{children:["$",l]})]})]}),
773
771
  /* @__PURE__ */Ge(M,{block:!0,className:"mt-4",children:["Pay $",l]})]}),
774
- /* @__PURE__ */Ye(zl,{tone:"success",title:"Promo applied",children:"Free returns within 30 days."})]})]})]})})}var Ec=[{id:"inbox",label:"Inbox",count:12},{id:"starred",label:"Starred",count:3},{id:"sent",label:"Sent"},{id:"drafts",label:"Drafts",count:1},{id:"archive",label:"Archive"},{id:"trash",label:"Trash"}],Bc=[{id:1,from:"Marco Reyes",subject:"Q3 roadmap review",preview:"Sharing the deck ahead of Thursday — let me know…",time:"9:14",unread:!0},{id:2,from:"Priya Patel",subject:"Design handoff",preview:"The Figma file is ready for engineering. I exported…",time:"8:02",unread:!0},{id:3,from:"GitHub",subject:"[acme/web] PR #482 merged",preview:"Your pull request was merged into main by…",time:"Yest"},{id:4,from:"Sara Lind",subject:"Lunch Friday?",preview:"A few of us are heading to the new place on 5th…",time:"Yest"}];function Tc(){const[e,r]=Ee(1),n=Bc.find(t=>t.id===e)??Bc[0];/* @__PURE__ */
772
+ /* @__PURE__ */Ye(jl,{tone:"success",title:"Promo applied",children:"Free returns within 30 days."})]})]})]})})}var Tc=[{id:"inbox",label:"Inbox",count:12},{id:"starred",label:"Starred",count:3},{id:"sent",label:"Sent"},{id:"drafts",label:"Drafts",count:1},{id:"archive",label:"Archive"},{id:"trash",label:"Trash"}],Ic=[{id:1,from:"Marco Reyes",subject:"Q3 roadmap review",preview:"Sharing the deck ahead of Thursday — let me know…",time:"9:14",unread:!0},{id:2,from:"Priya Patel",subject:"Design handoff",preview:"The Figma file is ready for engineering. I exported…",time:"8:02",unread:!0},{id:3,from:"GitHub",subject:"[acme/web] PR #482 merged",preview:"Your pull request was merged into main by…",time:"Yest"},{id:4,from:"Sara Lind",subject:"Lunch Friday?",preview:"A few of us are heading to the new place on 5th…",time:"Yest"}];function Oc(){const[e,r]=Ee(1),n=Ic.find(t=>t.id===e)??Ic[0];/* @__PURE__ */
775
773
  return Ye("div",{className:"h-full",children:/* @__PURE__ */Ye(t,{side:"left",defaultWidth:200,sidebar:/* @__PURE__ */Ge("div",{className:"flex h-full flex-col p-2",children:[
776
- /* @__PURE__ */Ye(M,{block:!0,className:"mb-2",children:"Compose"}),Ec.map((e,t)=>/* @__PURE__ */Ge("button",{className:"flex items-center justify-between rounded-md px-3 py-2 text-left text-sm "+(0===t?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
774
+ /* @__PURE__ */Ye(M,{block:!0,className:"mb-2",children:"Compose"}),Tc.map((e,t)=>/* @__PURE__ */Ge("button",{className:"flex items-center justify-between rounded-md px-3 py-2 text-left text-sm "+(0===t?"bg-blue-50 font-medium text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
777
775
  /* @__PURE__ */Ye("span",{children:e.label}),null!=e.count&&/* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:e.count})]},e.id))]}),children:/* @__PURE__ */Ge("div",{className:"flex h-full",children:[
778
- /* @__PURE__ */Ye("div",{className:"w-72 shrink-0 overflow-auto border-r border-gray-200",children:Bc.map(t=>/* @__PURE__ */Ge("button",{onClick:()=>r(t.id),className:"block w-full border-b border-gray-100 px-4 py-3 text-left hover:bg-gray-50 "+(t.id===e?"bg-blue-50/50":""),children:[
776
+ /* @__PURE__ */Ye("div",{className:"w-72 shrink-0 overflow-auto border-r border-gray-200",children:Ic.map(t=>/* @__PURE__ */Ge("button",{onClick:()=>r(t.id),className:"block w-full border-b border-gray-100 px-4 py-3 text-left hover:bg-gray-50 "+(t.id===e?"bg-blue-50/50":""),children:[
779
777
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-2",children:[
780
778
  /* @__PURE__ */Ye("span",{className:"truncate text-sm "+(t.unread?"font-semibold text-gray-900":"text-gray-700"),children:t.from}),
781
779
  /* @__PURE__ */Ye("span",{className:"shrink-0 text-2xs text-gray-400",children:t.time})]}),
@@ -796,8 +794,8 @@ return Ye("div",{className:"h-full",children:/* @__PURE__ */Ye(t,{side:"left",de
796
794
  /* @__PURE__ */Ye("p",{children:"Hi,"}),
797
795
  /* @__PURE__ */Ge("p",{children:[n.preview," The full details are attached — happy to walk through anything on a quick call."]}),
798
796
  /* @__PURE__ */Ge("p",{children:["Best,",
799
- /* @__PURE__ */Ye("br",{}),n.from]})]})]})]})})})}var Ic=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],Oc=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function Rc(){const[e,r]=Ee(1),n=Ic.find(t=>t.id===e)??Ic[0];/* @__PURE__ */
800
- return Ye("div",{className:"h-full",children:/* @__PURE__ */Ye(t,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto",children:Ic.map(t=>/* @__PURE__ */Ge("button",{onClick:()=>r(t.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(t.id===e?"bg-blue-50/50":""),children:[
797
+ /* @__PURE__ */Ye("br",{}),n.from]})]})]})]})})})}var Rc=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],Wc=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function Kc(){const[e,r]=Ee(1),n=Rc.find(t=>t.id===e)??Rc[0];/* @__PURE__ */
798
+ return Ye("div",{className:"h-full",children:/* @__PURE__ */Ye(t,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto",children:Rc.map(t=>/* @__PURE__ */Ge("button",{onClick:()=>r(t.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(t.id===e?"bg-blue-50/50":""),children:[
801
799
  /* @__PURE__ */Ye(Ll,{name:t.name,status:t.status}),
802
800
  /* @__PURE__ */Ge("div",{className:"min-w-0 flex-1",children:[
803
801
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-2",children:[
@@ -809,219 +807,219 @@ return Ye("div",{className:"h-full",children:/* @__PURE__ */Ye(t,{side:"left",de
809
807
  /* @__PURE__ */Ge("div",{children:[
810
808
  /* @__PURE__ */Ye("div",{className:"text-sm font-medium text-gray-900",children:n.name}),
811
809
  /* @__PURE__ */Ye("div",{className:"text-xs text-gray-400 capitalize",children:n.status})]})]}),
812
- /* @__PURE__ */Ye("div",{className:"flex flex-1 flex-col gap-2 overflow-auto bg-gray-50 p-4",children:Oc.map((e,t)=>/* @__PURE__ */Ye("div",{className:"flex "+(e.mine?"justify-end":"justify-start"),children:/* @__PURE__ */Ye("div",{style:{maxWidth:"75%"},className:"rounded-2xl px-3 py-2 text-sm "+(e.mine?"bg-blue-600 text-white":"bg-white text-gray-800 shadow-sm"),children:e.text})},t))}),
810
+ /* @__PURE__ */Ye("div",{className:"flex flex-1 flex-col gap-2 overflow-auto bg-gray-50 p-4",children:Wc.map((e,t)=>/* @__PURE__ */Ye("div",{className:"flex "+(e.mine?"justify-end":"justify-start"),children:/* @__PURE__ */Ye("div",{style:{maxWidth:"75%"},className:"rounded-2xl px-3 py-2 text-sm "+(e.mine?"bg-blue-600 text-white":"bg-white text-gray-800 shadow-sm"),children:e.text})},t))}),
813
811
  /* @__PURE__ */Ge("form",{className:"flex items-center gap-2 border-t border-gray-200 p-3",onSubmit:e=>e.preventDefault(),children:[
814
812
  /* @__PURE__ */Ye("div",{className:"flex-1",children:/* @__PURE__ */Ye(Qe,{placeholder:"Type a message…"})}),
815
- /* @__PURE__ */Ye(M,{type:"submit",children:"Send"})]})]})})})}var Wc={featured:"success",new:"active",draft:"draft"},Kc=["linear-gradient(135deg,#60a5fa,#a78bfa)","linear-gradient(135deg,#34d399,#10b981)","linear-gradient(135deg,#fbbf24,#f59e0b)","linear-gradient(135deg,#f472b6,#ec4899)","linear-gradient(135deg,#38bdf8,#6366f1)","linear-gradient(135deg,#fb7185,#ef4444)","linear-gradient(135deg,#4ade80,#22c55e)","linear-gradient(135deg,#c084fc,#8b5cf6)"].map((e,t)=>({id:t,title:["Sunrise","Forest","Desert","Bloom","Ocean","Ember","Meadow","Dusk"][t],tag:["featured","new","draft"][t%3],bg:e}));function qc(){const[e,t]=Ee("all"),r="all"===e?Kc:Kc.filter(t=>t.tag===e);/* @__PURE__ */
816
- return Ye(Ma,{groups:Wc,children:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-5xl space-y-4",children:[
813
+ /* @__PURE__ */Ye(M,{type:"submit",children:"Send"})]})]})})})}var _c={featured:"success",new:"active",draft:"draft"},qc=["linear-gradient(135deg,#60a5fa,#a78bfa)","linear-gradient(135deg,#34d399,#10b981)","linear-gradient(135deg,#fbbf24,#f59e0b)","linear-gradient(135deg,#f472b6,#ec4899)","linear-gradient(135deg,#38bdf8,#6366f1)","linear-gradient(135deg,#fb7185,#ef4444)","linear-gradient(135deg,#4ade80,#22c55e)","linear-gradient(135deg,#c084fc,#8b5cf6)"].map((e,t)=>({id:t,title:["Sunrise","Forest","Desert","Bloom","Ocean","Ember","Meadow","Dusk"][t],tag:["featured","new","draft"][t%3],bg:e}));function Hc(){const[e,t]=Ee("all"),r="all"===e?qc:qc.filter(t=>t.tag===e);/* @__PURE__ */
814
+ return Ye(Ma,{groups:_c,children:/* @__PURE__ */Ye("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"mx-auto max-w-5xl space-y-4",children:[
817
815
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-4",children:[
818
816
  /* @__PURE__ */Ye("h1",{className:"text-xl font-semibold text-gray-900",children:"Gallery"}),
819
817
  /* @__PURE__ */Ye(M,{size:"sm",children:"Upload"})]}),
820
818
  /* @__PURE__ */Ye(Tl,{value:e,onChange:t,variant:"pill",items:[{id:"all",label:"All"},{id:"featured",label:"Featured"},{id:"new",label:"New"},{id:"draft",label:"Drafts"}]}),
821
- /* @__PURE__ */Ye("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:r.map(e=>/* @__PURE__ */Ge(za,{padded:!1,className:"overflow-hidden",children:[
819
+ /* @__PURE__ */Ye("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4",children:r.map(e=>/* @__PURE__ */Ge(ja,{padded:!1,className:"overflow-hidden",children:[
822
820
  /* @__PURE__ */Ye("div",{className:"relative h-28",style:{background:e.bg},children:/* @__PURE__ */Ye("span",{className:"absolute right-2 top-2",children:/* @__PURE__ */Ye(La,{status:e.tag})})}),
823
821
  /* @__PURE__ */Ge("div",{className:"flex items-center justify-between gap-2 p-3",children:[
824
822
  /* @__PURE__ */Ye("span",{className:"truncate text-sm font-medium text-gray-900",children:e.title}),
825
- /* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:"2.4 MB"})]})]},e.id))})]})})})}var Hc={login:{title:"Welcome back",subtitle:"Sign in to your account",cta:"Sign in"},register:{title:"Create your account",subtitle:"Start your 14-day free trial",cta:"Create account"},forgot:{title:"Reset password",subtitle:"We'll email you a reset link",cta:"Send reset link"}};function _c({mode:e="login"}){const[t,r]=Ee(!0),n=Hc[e];/* @__PURE__ */
823
+ /* @__PURE__ */Ye("span",{className:"text-xs text-gray-400",children:"2.4 MB"})]})]},e.id))})]})})})}var Uc={login:{title:"Welcome back",subtitle:"Sign in to your account",cta:"Sign in"},register:{title:"Create your account",subtitle:"Start your 14-day free trial",cta:"Create account"},forgot:{title:"Reset password",subtitle:"We'll email you a reset link",cta:"Send reset link"}};function Vc({mode:e="login"}){const[t,r]=Ee(!0),n=Uc[e];/* @__PURE__ */
826
824
  return Ye("div",{className:"flex h-full items-center justify-center overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */Ge("div",{className:"w-full max-w-sm",children:[
827
825
  /* @__PURE__ */Ge("div",{className:"mb-6 text-center",children:[
828
826
  /* @__PURE__ */Ye("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-blue-600 text-sm font-bold text-white",children:"A"}),
829
827
  /* @__PURE__ */Ye("h1",{className:"text-lg font-semibold text-gray-900",children:n.title}),
830
828
  /* @__PURE__ */Ye("p",{className:"text-sm text-gray-500",children:n.subtitle})]}),
831
- /* @__PURE__ */Ye(za,{children:/* @__PURE__ */Ge("form",{className:"space-y-4",onSubmit:e=>e.preventDefault(),children:["register"===e&&/* @__PURE__ */Ye(vt,{label:"Name",htmlFor:"au-name",children:/* @__PURE__ */Ye(Qe,{id:"au-name",placeholder:"Alice Nguyen"})}),
829
+ /* @__PURE__ */Ye(ja,{children:/* @__PURE__ */Ge("form",{className:"space-y-4",onSubmit:e=>e.preventDefault(),children:["register"===e&&/* @__PURE__ */Ye(vt,{label:"Name",htmlFor:"au-name",children:/* @__PURE__ */Ye(Qe,{id:"au-name",placeholder:"Alice Nguyen"})}),
832
830
  /* @__PURE__ */Ye(vt,{label:"Email",htmlFor:"au-email",children:/* @__PURE__ */Ye(Qe,{id:"au-email",type:"email",placeholder:"you@example.com"})}),"forgot"!==e&&/* @__PURE__ */Ye(vt,{label:"Password",htmlFor:"au-pass",hint:"register"===e?"At least 8 characters.":void 0,children:/* @__PURE__ */Ye(Qe,{id:"au-pass",type:"password",placeholder:"••••••••"})}),"login"===e&&/* @__PURE__ */Ge("div",{className:"flex items-center justify-between",children:[
833
831
  /* @__PURE__ */Ye(bt,{checked:t,onChange:r,label:"Remember me"}),
834
832
  /* @__PURE__ */Ye("a",{href:"#",className:"text-sm text-blue-600 hover:underline",children:"Forgot?"})]}),
835
833
  /* @__PURE__ */Ye(M,{type:"submit",block:!0,children:n.cta})]})}),
836
834
  /* @__PURE__ */Ye("p",{className:"mt-4 text-center text-sm text-gray-500",children:/* @__PURE__ */Ge(Xe,"register"===e?{children:["Already have an account? ",
837
835
  /* @__PURE__ */Ye("a",{href:"#",className:"text-blue-600 hover:underline",children:"Sign in"})]}:{children:["New here? ",
838
- /* @__PURE__ */Ye("a",{href:"#",className:"text-blue-600 hover:underline",children:"Create an account"})]})})]})})}var Uc={403:e=>({title:e.forbidden,body:e.forbiddenBody}),404:e=>({title:e.notFound,body:e.notFoundBody}),500:e=>({title:e.serverError,body:e.serverErrorBody})};function Vc({code:e=404,actions:t}){const r=Uc[e](he().errors);/* @__PURE__ */
836
+ /* @__PURE__ */Ye("a",{href:"#",className:"text-blue-600 hover:underline",children:"Create an account"})]})})]})})}var Yc={403:e=>({title:e.forbidden,body:e.forbiddenBody}),404:e=>({title:e.notFound,body:e.notFoundBody}),500:e=>({title:e.serverError,body:e.serverErrorBody})};function Gc({code:e=404,actions:t}){const r=Yc[e](he().errors);/* @__PURE__ */
839
837
  return Ge("div",{className:"flex h-full flex-col items-center justify-center bg-gray-50 p-6 text-center",children:[
840
838
  /* @__PURE__ */Ye("div",{className:"text-7xl font-bold tracking-tight text-gray-400",children:e}),
841
839
  /* @__PURE__ */Ye("h1",{className:"mt-2 text-xl font-semibold text-gray-900",children:r.title}),
842
- /* @__PURE__ */Ye("p",{className:"mt-1 max-w-sm text-sm text-gray-500",children:r.body}),t&&/* @__PURE__ */Ye("div",{className:"mt-6 flex items-center gap-2",children:t})]})}function Yc({pick:e}){/* @__PURE__ */
843
- return Ye(Xe,{children:e(he().errors)})}var Gc=class extends _e{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t),oe(e),this.props.onError?.(e,t)}componentDidUpdate(e){if(!this.state.error)return;const t=e.resetKeys??[],r=this.props.resetKeys??[];(t.length!==r.length||t.some((e,t)=>!Object.is(e,r[t])))&&this.reset()}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):
840
+ /* @__PURE__ */Ye("p",{className:"mt-1 max-w-sm text-sm text-gray-500",children:r.body}),t&&/* @__PURE__ */Ye("div",{className:"mt-6 flex items-center gap-2",children:t})]})}function Xc({pick:e}){/* @__PURE__ */
841
+ return Ye(Xe,{children:e(he().errors)})}var Zc=class extends He{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t),oe(e),this.props.onError?.(e,t)}componentDidUpdate(e){if(!this.state.error)return;const t=e.resetKeys??[],r=this.props.resetKeys??[];(t.length!==r.length||t.some((e,t)=>!Object.is(e,r[t])))&&this.reset()}reset=()=>this.setState({error:null});render(){const{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.reset):
844
842
  /* @__PURE__ */Ge("div",{className:"flex h-full flex-col",children:[
845
- /* @__PURE__ */Ye("div",{role:"alert",className:"min-h-0 flex-1",children:/* @__PURE__ */Ye(Vc,{code:500,actions:/* @__PURE__ */Ge(Xe,{children:[
846
- /* @__PURE__ */Ye(M,{onClick:this.reset,children:/* @__PURE__ */Ye(Yc,{pick:e=>e.retry})}),this.props.actions]})})}),this.props.showDetails&&/* @__PURE__ */Ge("details",{className:"mx-auto w-full max-w-2xl shrink-0 px-6 pb-6",children:[
847
- /* @__PURE__ */Ye("summary",{className:"cursor-pointer text-sm font-medium text-gray-600",children:/* @__PURE__ */Ye(Yc,{pick:e=>e.details})}),
848
- /* @__PURE__ */Ye("pre",{className:"mt-2 overflow-auto rounded-md bg-gray-100 p-3 text-xs text-gray-700",children:e.stack??e.message})]})]}):this.props.children}};function Xc(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}function Zc(e){const t=Xc();return t?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):()=>{}}function Jc(){return Xc()?.matches??!1}function Qc(){return!1}function ed(e){const t=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(t,r,n),l=Math.min(t,r,n);let i=0,o=0;const s=(a+l)/2;if(a!==l){const e=a-l;o=s>.5?e/(2-a-l):e/(a+l),i=a===t?((r-n)/e+(r<n?6:0))/6:a===r?((n-t)/e+2)/6:((t-r)/e+4)/6}return[360*i,100*o,100*s]}function td(e,t,r){r/=100;const n=(t/=100)*Math.min(r,1-r),a=t=>{const a=(t+e/30)%12;return r-n*Math.max(Math.min(a-3,9-a,1),-1)},l=e=>Math.round(255*e).toString(16).padStart(2,"0");return`#${l(a(0))}${l(a(8))}${l(a(4))}`}function rd(e){const t=e||"system";return"system"===t?Jc()?"dark":"light":t}function nd(e){const t=document.documentElement;if(e&&/^#[0-9a-fA-F]{6}$/.test(e)){const[r,n,a]=ed(e);t.setAttribute("data-custom-accent","true"),t.style.setProperty("--accent-600",e),t.style.setProperty("--accent-700",td(r,n,Math.max(a-10,5))),t.style.setProperty("--accent-500",td(r,n,Math.min(a+10,95))),t.style.setProperty("--accent-400",td(r,n,Math.min(a+20,95))),t.style.setProperty("--accent-300",td(r,Math.min(n+10,100),Math.min(a+30,92))),t.style.setProperty("--accent-200",td(r,Math.min(n+15,100),Math.min(a+38,94))),t.style.setProperty("--accent-100",td(r,Math.min(n+20,100),Math.min(a+42,96))),t.style.setProperty("--accent-50",td(r,Math.min(n+20,100),Math.min(a+46,98)))}else t.removeAttribute("data-custom-accent"),["--accent-600","--accent-700","--accent-500","--accent-400","--accent-300","--accent-200","--accent-100","--accent-50"].forEach(e=>t.style.removeProperty(e))}function ad(e,t,r,n,a){const l=document.documentElement;if(e){const e=e=>`${parseInt(e.slice(1,3),16)} ${parseInt(e.slice(3,5),16)} ${parseInt(e.slice(5,7),16)}`;if(t&&l.style.setProperty("--custom-bg-color",t),r&&(l.style.setProperty("--window-header-rgb",e(r)),l.style.setProperty("--window-footer-rgb",e(r))),n&&l.style.setProperty("--window-content-rgb",e(n)),a){l.style.setProperty("--custom-button-color",a);const[e,t,r]=ed(a);l.style.setProperty("--custom-button-hover",td(e,t,Math.max(r-10,5)))}}else["--custom-bg-color","--custom-button-color","--custom-button-hover"].forEach(e=>l.style.removeProperty(e))}var ld=["square","soft","round"];function id(e){return"square"===e||"round"===e?e:"soft"}function od(e){const t=id(e);"soft"===t?document.documentElement.removeAttribute("data-corners"):document.documentElement.setAttribute("data-corners",t)}function sd(e){const t="string"==typeof e&&e?e:null;Ae(t),t?document.documentElement.setAttribute("data-icon-set",t):document.documentElement.removeAttribute("data-icon-set")}function cd(e){"corners"in e&&od(e.corners),"icon_set"in e&&sd(e.icon_set),document.documentElement.setAttribute("data-theme",rd(e.theme)),nd(e.accent_color??null),ad(e.accent_color??null,e.custom_bg_color??null,e.custom_title_color??null,e.custom_window_color??null,e.custom_button_color??null)}function dd(){const{prefs:e}=x(),t=Ue(Zc,Jc,Qc),r=e.theme||"system",n=e.accent_color||null,a=e.custom_bg_color||null,l=e.custom_title_color||null,i=e.custom_window_color||null,o=e.custom_button_color||null,s=id(e.corners),c="string"==typeof e.icon_set&&e.icon_set?e.icon_set:null,d="system"===r?t?"dark":"light":r;return Ie(()=>(document.documentElement.setAttribute("data-theme",d),()=>document.documentElement.removeAttribute("data-theme")),[d]),Ie(()=>(od(s),()=>document.documentElement.removeAttribute("data-corners")),[s]),Ie(()=>(sd(c),()=>sd(null)),[c]),Ie(()=>{nd(n)},[n]),Ie(()=>{ad(n,a,l,i,o)},[n,a,l,i,o]),{theme:r,resolved:d,corners:s,iconSet:c}}function ud(e){const t=Math.max(0,...e.map(e=>[...e].reduce((e,t)=>e+((t.codePointAt(0)??0)>=11904?1:.62),0)));return Math.round(10*(t+3.5))/10}function hd({size:e="sm",className:t=""}){const{language:r,languages:n,setLanguage:a}=p(),l=he().language;return n.length<2?null:/* @__PURE__ */Ge("span",{className:`inline-flex items-center gap-2 text-gray-500 ${t}`.trim(),children:[
843
+ /* @__PURE__ */Ye("div",{role:"alert",className:"min-h-0 flex-1",children:/* @__PURE__ */Ye(Gc,{code:500,actions:/* @__PURE__ */Ge(Xe,{children:[
844
+ /* @__PURE__ */Ye(M,{onClick:this.reset,children:/* @__PURE__ */Ye(Xc,{pick:e=>e.retry})}),this.props.actions]})})}),this.props.showDetails&&/* @__PURE__ */Ge("details",{className:"mx-auto w-full max-w-2xl shrink-0 px-6 pb-6",children:[
845
+ /* @__PURE__ */Ye("summary",{className:"cursor-pointer text-sm font-medium text-gray-600",children:/* @__PURE__ */Ye(Xc,{pick:e=>e.details})}),
846
+ /* @__PURE__ */Ye("pre",{className:"mt-2 overflow-auto rounded-md bg-gray-100 p-3 text-xs text-gray-700",children:e.stack??e.message})]})]}):this.props.children}};function Jc(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}function Qc(e){const t=Jc();return t?(t.addEventListener("change",e),()=>t.removeEventListener("change",e)):()=>{}}function ed(){return Jc()?.matches??!1}function td(){return!1}function rd(e){const t=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,n=parseInt(e.slice(5,7),16)/255,a=Math.max(t,r,n),l=Math.min(t,r,n);let i=0,o=0;const s=(a+l)/2;if(a!==l){const e=a-l;o=s>.5?e/(2-a-l):e/(a+l),i=a===t?((r-n)/e+(r<n?6:0))/6:a===r?((n-t)/e+2)/6:((t-r)/e+4)/6}return[360*i,100*o,100*s]}function nd(e,t,r){r/=100;const n=(t/=100)*Math.min(r,1-r),a=t=>{const a=(t+e/30)%12;return r-n*Math.max(Math.min(a-3,9-a,1),-1)},l=e=>Math.round(255*e).toString(16).padStart(2,"0");return`#${l(a(0))}${l(a(8))}${l(a(4))}`}function ad(e){const t=e||"system";return"system"===t?ed()?"dark":"light":t}function ld(e){const t=document.documentElement;if(e&&/^#[0-9a-fA-F]{6}$/.test(e)){const[r,n,a]=rd(e);t.setAttribute("data-custom-accent","true"),t.style.setProperty("--accent-600",e),t.style.setProperty("--accent-700",nd(r,n,Math.max(a-10,5))),t.style.setProperty("--accent-500",nd(r,n,Math.min(a+10,95))),t.style.setProperty("--accent-400",nd(r,n,Math.min(a+20,95))),t.style.setProperty("--accent-300",nd(r,Math.min(n+10,100),Math.min(a+30,92))),t.style.setProperty("--accent-200",nd(r,Math.min(n+15,100),Math.min(a+38,94))),t.style.setProperty("--accent-100",nd(r,Math.min(n+20,100),Math.min(a+42,96))),t.style.setProperty("--accent-50",nd(r,Math.min(n+20,100),Math.min(a+46,98)))}else t.removeAttribute("data-custom-accent"),["--accent-600","--accent-700","--accent-500","--accent-400","--accent-300","--accent-200","--accent-100","--accent-50"].forEach(e=>t.style.removeProperty(e))}function id(e,t,r,n,a){const l=document.documentElement;if(e){const e=e=>`${parseInt(e.slice(1,3),16)} ${parseInt(e.slice(3,5),16)} ${parseInt(e.slice(5,7),16)}`;if(t&&l.style.setProperty("--custom-bg-color",t),r&&(l.style.setProperty("--window-header-rgb",e(r)),l.style.setProperty("--window-footer-rgb",e(r))),n&&l.style.setProperty("--window-content-rgb",e(n)),a){l.style.setProperty("--custom-button-color",a);const[e,t,r]=rd(a);l.style.setProperty("--custom-button-hover",nd(e,t,Math.max(r-10,5)))}}else["--custom-bg-color","--custom-button-color","--custom-button-hover"].forEach(e=>l.style.removeProperty(e))}var od=["square","soft","round"];function sd(e){return"square"===e||"round"===e?e:"soft"}function cd(e){const t=sd(e);"soft"===t?document.documentElement.removeAttribute("data-corners"):document.documentElement.setAttribute("data-corners",t)}function dd(e){const t="string"==typeof e&&e?e:null;Ae(t),t?document.documentElement.setAttribute("data-icon-set",t):document.documentElement.removeAttribute("data-icon-set")}function ud(e){"corners"in e&&cd(e.corners),"icon_set"in e&&dd(e.icon_set),document.documentElement.setAttribute("data-theme",ad(e.theme)),ld(e.accent_color??null),id(e.accent_color??null,e.custom_bg_color??null,e.custom_title_color??null,e.custom_window_color??null,e.custom_button_color??null)}function hd(){const{prefs:e}=x(),t=Ue(Qc,ed,td),r=e.theme||"system",n=e.accent_color||null,a=e.custom_bg_color||null,l=e.custom_title_color||null,i=e.custom_window_color||null,o=e.custom_button_color||null,s=sd(e.corners),c="string"==typeof e.icon_set&&e.icon_set?e.icon_set:null,d="system"===r?t?"dark":"light":r;return Ie(()=>(document.documentElement.setAttribute("data-theme",d),()=>document.documentElement.removeAttribute("data-theme")),[d]),Ie(()=>(cd(s),()=>document.documentElement.removeAttribute("data-corners")),[s]),Ie(()=>(dd(c),()=>dd(null)),[c]),Ie(()=>{ld(n)},[n]),Ie(()=>{id(n,a,l,i,o)},[n,a,l,i,o]),{theme:r,resolved:d,corners:s,iconSet:c}}function md(e){const t=Math.max(0,...e.map(e=>[...e].reduce((e,t)=>e+((t.codePointAt(0)??0)>=11904?1:.62),0)));return Math.round(10*(t+3.5))/10}function pd({size:e="sm",className:t=""}){const{language:r,languages:n,setLanguage:a}=m(),l=he().language;return n.length<2?null:/* @__PURE__ */Ge("span",{className:`inline-flex items-center gap-2 text-gray-500 ${t}`.trim(),children:[
849
847
  /* @__PURE__ */Ye(Pe,{name:"globe","aria-hidden":!0,className:"h-4 w-4 shrink-0"}),
850
- /* @__PURE__ */Ye("span",{className:"block",style:{width:`${ud(n.map(e=>e.name))}em`},children:/* @__PURE__ */Ye(gt,{size:e,touchSize:e,"aria-label":l.title,value:r,onChange:e=>{a(e)},options:n.map(({tag:e,name:t})=>({value:e,label:t,lang:e}))})})]})}function md({description:e,className:t=""}){const{language:r,languages:n,setLanguage:a}=p(),l=he().language;return n.length<2?null:/* @__PURE__ */Ge("div",{className:`space-y-4 ${t}`.trim(),children:[
848
+ /* @__PURE__ */Ye("span",{className:"block",style:{width:`${md(n.map(e=>e.name))}em`},children:/* @__PURE__ */Ye(gt,{size:e,touchSize:e,"aria-label":l.title,value:r,onChange:e=>{a(e)},options:n.map(({tag:e,name:t})=>({value:e,label:t,lang:e}))})})]})}function gd({description:e,className:t=""}){const{language:r,languages:n,setLanguage:a}=m(),l=he().language;return n.length<2?null:/* @__PURE__ */Ge("div",{className:`space-y-4 ${t}`.trim(),children:[
851
849
  /* @__PURE__ */Ge("div",{children:[
852
850
  /* @__PURE__ */Ye("h3",{className:"text-sm font-semibold text-gray-900",children:l.title}),
853
851
  /* @__PURE__ */Ye("p",{className:"mt-0.5 text-sm text-gray-500",children:e??l.description})]}),
854
- /* @__PURE__ */Ye(Nt,{name:"shell-language",value:r,onChange:e=>{a(e)},hint:l.reloadNote,options:n.map(({tag:e,name:t})=>({value:e,label:/* @__PURE__ */Ye("span",{lang:e,children:t})}))})]})}function pd({label:e="Not available"}){/* @__PURE__ */
855
- return Ye("span",{className:"text-gray-400",role:"img","aria-label":e,children:Ce})}function gd({value:e,precise:t,locale:r,className:n}){const a=ue(),l=Le(e);if(!l)/* @__PURE__ */return Ye(pd,{});const i="string"==typeof e?e:l.toISOString();/* @__PURE__ */
856
- return Ye("time",{dateTime:i,title:De(i,{locale:r??a}),className:n,children:Se(l,{precise:t,locale:r??a})})}function fd(e,t=300){const[r,n]=Ee(e);return Ie(()=>{const r=setTimeout(()=>n(e),t);return()=>clearTimeout(r)},[e,t]),r}function bd(e,t){Ie(()=>{const r=r=>{e.current&&!e.current.contains(r.target)&&t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t])}function xd(e,t,r){if(0===e.length||t<=0||r<=0)return 1/0;const n=Math.max(...e),a=Math.min(...e),l=t*t,i=r*r;return Math.max(i*n/l,l/(i*a))}function yd(e,t,r,n){const a=n?r.height:r.width,l=a>0?t/a:0;let i=0;return{tiles:e.map(e=>{const o=t>0?e.value/t*a:0,s=n?{...e,x:r.x,y:r.y+i,width:l,height:o}:{...e,x:r.x+i,y:r.y,width:o,height:l};return i+=o,s}),rest:n?{x:r.x+l,y:r.y,width:r.width-l,height:r.height}:{x:r.x,y:r.y+l,width:r.width,height:r.height-l}}}function vd(e,t,r){const n=e.filter(e=>e.value>0).sort((e,t)=>t.value-e.value);if(0===n.length||t<=0||r<=0)return[];const a=n.reduce((e,t)=>e+t.value,0),l=t*r,i=[];let o={x:0,y:0,width:t,height:r},s=[],c=0,d=[...n.map(e=>({...e,value:e.value/a*l}))];for(;d.length>0;){const e=d[0],t=Math.min(o.width,o.height),r=o.width>=o.height,n=xd(s.map(e=>e.value),c,t),a=xd([...s.map(e=>e.value),e.value],c+e.value,t);if(0===s.length||a<=n)s.push(e),c+=e.value,d=d.slice(1);else{const e=yd(s,c,o,r);i.push(...e.tiles),o=e.rest,s=[],c=0}}s.length>0&&i.push(...yd(s,c,o,o.width>=o.height).tiles);const u=new Map(e.map(e=>[e.key,e.value]));return i.map(e=>({...e,value:u.get(e.key)??e.value}))}function wd({rows:e,max:t,formatValue:r,emphasisKey:n,highlight:a="none",emphasisTone:l,barHeight:i=12,rowGap:o=30,animate:s=!0,labelFont:c="sans",className:d,emptyLabel:u}){const h=he().charts,m=ue(),p=r??(e=>fe(e,m)),g=u??h.nothingToRank;if(0===e.length)/* @__PURE__ */
857
- return Ye("p",{className:`text-sm text-gray-500 ${d??""}`,children:g});const f=oc(e.map(e=>e.value),a),b=n??(null===f?void 0:e[f]?.key),x=t??Math.max(...e.map(e=>e.value).filter(Number.isFinite),0),y=Ts(0);/* @__PURE__ */
858
- return Ye("ol",{className:`m-0 list-none p-0 ${d??""}`,style:{display:"grid",rowGap:`${Math.max(4,o-i)}px`},children:e.map((e,t)=>{const r=e.key===b,n=r?l?Es[l]:Ts(1):b?Bs.muted:y,a=Number.isFinite(e.value)?e.value:null,o=null!==a&&x>0?Math.max(0,Math.min(1,a/x)):0;/* @__PURE__ */
852
+ /* @__PURE__ */Ye(Nt,{name:"shell-language",value:r,onChange:e=>{a(e)},hint:l.reloadNote,options:n.map(({tag:e,name:t})=>({value:e,label:/* @__PURE__ */Ye("span",{lang:e,children:t})}))})]})}function fd({label:e="Not available"}){/* @__PURE__ */
853
+ return Ye("span",{className:"text-gray-400",role:"img","aria-label":e,children:Ce})}function bd({value:e,precise:t,locale:r,className:n}){const a=ue(),l=Le(e);if(!l)/* @__PURE__ */return Ye(fd,{});const i="string"==typeof e?e:l.toISOString();/* @__PURE__ */
854
+ return Ye("time",{dateTime:i,title:De(i,{locale:r??a}),className:n,children:Se(l,{precise:t,locale:r??a})})}function xd(e,t=300){const[r,n]=Ee(e);return Ie(()=>{const r=setTimeout(()=>n(e),t);return()=>clearTimeout(r)},[e,t]),r}function yd(e,t){Ie(()=>{const r=r=>{e.current&&!e.current.contains(r.target)&&t()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[e,t])}function vd(e,t,r){if(0===e.length||t<=0||r<=0)return 1/0;const n=Math.max(...e),a=Math.min(...e),l=t*t,i=r*r;return Math.max(i*n/l,l/(i*a))}function wd(e,t,r,n){const a=n?r.height:r.width,l=a>0?t/a:0;let i=0;return{tiles:e.map(e=>{const o=t>0?e.value/t*a:0,s=n?{...e,x:r.x,y:r.y+i,width:l,height:o}:{...e,x:r.x+i,y:r.y,width:o,height:l};return i+=o,s}),rest:n?{x:r.x+l,y:r.y,width:r.width-l,height:r.height}:{x:r.x,y:r.y+l,width:r.width,height:r.height-l}}}function Nd(e,t,r){const n=e.filter(e=>e.value>0).sort((e,t)=>t.value-e.value);if(0===n.length||t<=0||r<=0)return[];const a=n.reduce((e,t)=>e+t.value,0),l=t*r,i=[];let o={x:0,y:0,width:t,height:r},s=[],c=0,d=[...n.map(e=>({...e,value:e.value/a*l}))];for(;d.length>0;){const e=d[0],t=Math.min(o.width,o.height),r=o.width>=o.height,n=vd(s.map(e=>e.value),c,t),a=vd([...s.map(e=>e.value),e.value],c+e.value,t);if(0===s.length||a<=n)s.push(e),c+=e.value,d=d.slice(1);else{const e=wd(s,c,o,r);i.push(...e.tiles),o=e.rest,s=[],c=0}}s.length>0&&i.push(...wd(s,c,o,o.width>=o.height).tiles);const u=new Map(e.map(e=>[e.key,e.value]));return i.map(e=>({...e,value:u.get(e.key)??e.value}))}function kd({rows:e,max:t,formatValue:r,emphasisKey:n,highlight:a="none",emphasisTone:l,barHeight:i=12,rowGap:o=30,animate:s=!0,labelFont:c="sans",className:d,emptyLabel:u}){const h=he().charts,m=ue(),p=r??(e=>fe(e,m)),g=u??h.nothingToRank;if(0===e.length)/* @__PURE__ */
855
+ return Ye("p",{className:`text-sm text-gray-500 ${d??""}`,children:g});const f=cc(e.map(e=>e.value),a),b=n??(null===f?void 0:e[f]?.key),x=t??Math.max(...e.map(e=>e.value).filter(Number.isFinite),0),y=Os(0);/* @__PURE__ */
856
+ return Ye("ol",{className:`m-0 list-none p-0 ${d??""}`,style:{display:"grid",rowGap:`${Math.max(4,o-i)}px`},children:e.map((e,t)=>{const r=e.key===b,n=r?l?Ts[l]:Os(1):b?Is.muted:y,a=Number.isFinite(e.value)?e.value:null,o=null!==a&&x>0?Math.max(0,Math.min(1,a/x)):0;/* @__PURE__ */
859
857
  return Ge("li",{className:"grid gap-1",children:[
860
858
  /* @__PURE__ */Ge("div",{className:"flex items-baseline justify-between gap-3",children:[
861
859
  /* @__PURE__ */Ge("span",{className:`truncate ${"mono"===c?"font-mono ":""}text-xs text-gray-600 ${r?"font-semibold":""}`,title:e.label,children:[e.label,r&&/* @__PURE__ */Ye("span",{className:"sr-only",children:` ${h.emphasised}`})]}),
862
860
  /* @__PURE__ */Ye("span",{className:"shrink-0 text-xs font-semibold tabular-nums text-gray-700",style:r?{color:n}:void 0,children:null===a?"—":p(a)})]}),
863
- /* @__PURE__ */Ye("div",{className:"w-full rounded-sm bg-gray-200",style:{height:i},children:/* @__PURE__ */Ye("div",{className:`rounded-sm ${s?bi.grow:""}`,style:{width:`${(100*o).toFixed(2)}%`,height:i,backgroundColor:n,minWidth:o>0?2:0,...s?xi(t):{}}})})]},e.key)})})}var Nd=e=>Math.max(0,Math.min(1,e));function kd({value:e,segments:t,objective:r,label:n,detail:a,formatValue:l,tone:i,className:o,unavailableLabel:s}){const c=he().charts,d=ue(),u=l??(e=>xe(100*e,1,d)),h=s??c.notEnough;if(null==e||!Number.isFinite(e))/* @__PURE__ */
861
+ /* @__PURE__ */Ye("div",{className:"w-full rounded-sm bg-gray-200",style:{height:i},children:/* @__PURE__ */Ye("div",{className:`rounded-sm ${s?bi.grow:""}`,style:{width:`${(100*o).toFixed(2)}%`,height:i,backgroundColor:n,minWidth:o>0?2:0,...s?xi(t):{}}})})]},e.key)})})}var $d=e=>Math.max(0,Math.min(1,e));function Md({value:e,segments:t,objective:r,label:n,detail:a,formatValue:l,tone:i,className:o,unavailableLabel:s}){const c=he().charts,d=ue(),u=l??(e=>xe(100*e,1,d)),h=s??c.notEnough;if(null==e||!Number.isFinite(e))/* @__PURE__ */
864
862
  return Ge("div",{className:o,children:[n&&/* @__PURE__ */Ye("p",{className:"text-sm font-medium text-gray-700",children:n}),
865
- /* @__PURE__ */Ye("p",{className:"mt-1 text-sm text-gray-500",children:h})]});const m=Nd(e),p=null==r||e>=r,g=i??(p?"good":"critical"),f=Es[g],b=[t?.length?t.map(e=>`${e.label} ${u(e.value)}`).join(" · "):"",a??"",null!=r?(p?c.objectiveMet:c.objectiveMissed)(u(r)):""].filter(Boolean).join(" · ");/* @__PURE__ */
863
+ /* @__PURE__ */Ye("p",{className:"mt-1 text-sm text-gray-500",children:h})]});const m=$d(e),p=null==r||e>=r,g=i??(p?"good":"critical"),f=Ts[g],b=[t?.length?t.map(e=>`${e.label} ${u(e.value)}`).join(" · "):"",a??"",null!=r?(p?c.objectiveMet:c.objectiveMissed)(u(r)):""].filter(Boolean).join(" · ");/* @__PURE__ */
866
864
  return Ge("div",{className:o,children:[
867
865
  /* @__PURE__ */Ge("div",{className:"mb-2 flex items-baseline justify-between gap-3",children:[
868
866
  /* @__PURE__ */Ye("span",{className:"text-sm font-medium text-gray-700",children:n}),
869
867
  /* @__PURE__ */Ye("span",{className:"text-sm font-semibold tabular-nums",style:{color:f},children:u(e)})]}),
870
868
  /* @__PURE__ */Ge("div",{className:"relative w-full rounded-full bg-gray-200",style:{height:12},role:"meter","aria-valuenow":Number((100*m).toFixed(2)),"aria-valuemin":0,"aria-valuemax":100,"aria-valuetext":u(e),"aria-label":n,children:[
871
- /* @__PURE__ */Ye("div",t?.length?{className:"flex h-full overflow-hidden rounded-full",children:t.map((e,r)=>/* @__PURE__ */Ye("div",{className:"h-full shrink-0"+(r===t.length-1?" rounded-r-full":""),style:{width:`${(100*Nd(e.value)).toFixed(2)}%`,backgroundColor:Es[e.tone??(0===r?g:"neutral")]}},`${e.label}-${r}`))}:{className:"h-full rounded-full",style:{width:`${(100*m).toFixed(2)}%`,backgroundColor:f}}),null!=r&&/* @__PURE__ */Ye("span",{className:"absolute top-[-4px] w-0.5 rounded-full",style:{left:`${(100*Nd(r)).toFixed(2)}%`,height:20,backgroundColor:Bs.axis},"aria-hidden":"true"})]}),b&&/* @__PURE__ */Ye("p",{className:"mt-2 text-xs text-gray-500",children:b})]})}var $d={up:{glyph:"▲",word:"trendUp"},down:{glyph:"▼",word:"trendDown"},flat:{glyph:"■",word:"trendFlat"}};function Md({label:e,value:t,unit:r,delta:n,deltaTone:a,trend:l,trendTone:i,footnote:o,className:s}){const c=he().charts,d=ue(),u=null==n?null:n>0?"up":n<0?"down":"flat",h=a?Es[a]:void 0,m=i?Es[i]:Is(0);/* @__PURE__ */
869
+ /* @__PURE__ */Ye("div",t?.length?{className:"flex h-full overflow-hidden rounded-full",children:t.map((e,r)=>/* @__PURE__ */Ye("div",{className:"h-full shrink-0"+(r===t.length-1?" rounded-r-full":""),style:{width:`${(100*$d(e.value)).toFixed(2)}%`,backgroundColor:Ts[e.tone??(0===r?g:"neutral")]}},`${e.label}-${r}`))}:{className:"h-full rounded-full",style:{width:`${(100*m).toFixed(2)}%`,backgroundColor:f}}),null!=r&&/* @__PURE__ */Ye("span",{className:"absolute top-[-4px] w-0.5 rounded-full",style:{left:`${(100*$d(r)).toFixed(2)}%`,height:20,backgroundColor:Is.axis},"aria-hidden":"true"})]}),b&&/* @__PURE__ */Ye("p",{className:"mt-2 text-xs text-gray-500",children:b})]})}var Cd={up:{glyph:"▲",word:"trendUp"},down:{glyph:"▼",word:"trendDown"},flat:{glyph:"■",word:"trendFlat"}};function Ld({label:e,value:t,unit:r,delta:n,deltaTone:a,trend:l,trendTone:i,footnote:o,className:s}){const c=he().charts,d=ue(),u=null==n?null:n>0?"up":n<0?"down":"flat",h=a?Ts[a]:void 0,m=i?Ts[i]:Rs(0);/* @__PURE__ */
872
870
  return Ge("div",{className:`flex flex-col gap-0.5 rounded-lg border border-gray-200 bg-white p-4 ${s??""}`,children:[
873
871
  /* @__PURE__ */Ye("span",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:e}),
874
872
  /* @__PURE__ */Ge("span",{className:"flex items-baseline gap-2",children:[
875
873
  /* @__PURE__ */Ye("span",{className:"text-2xl font-semibold leading-tight text-gray-900",children:t}),r&&/* @__PURE__ */Ye("span",{className:"text-sm font-medium text-gray-500",children:r})]}),u&&/* @__PURE__ */Ge("span",{className:"text-xs font-medium",style:h?{color:h}:void 0,children:[
876
- /* @__PURE__ */Ye("span",{"aria-hidden":"true",children:$d[u].glyph})," ",fe(Math.abs(n),d),
877
- /* @__PURE__ */Ge("span",{className:"sr-only",children:[" ",c[$d[u].word]]})]}),l&&l.length>1&&/* @__PURE__ */Ye(zs,{data:l,height:26,stroke:m,strokeWidth:2,className:"mt-2 w-full"}),o&&/* @__PURE__ */Ye("span",{className:"mt-1 text-xs text-gray-500",children:o})]})}function Cd({shape:e,colour:t}){const r="shrink-0";switch(e){case"circle":/* @__PURE__ */
874
+ /* @__PURE__ */Ye("span",{"aria-hidden":"true",children:Cd[u].glyph})," ",fe(Math.abs(n),d),
875
+ /* @__PURE__ */Ge("span",{className:"sr-only",children:[" ",c[Cd[u].word]]})]}),l&&l.length>1&&/* @__PURE__ */Ye(Fs,{data:l,height:26,stroke:m,strokeWidth:2,className:"mt-2 w-full"}),o&&/* @__PURE__ */Ye("span",{className:"mt-1 text-xs text-gray-500",children:o})]})}function Sd({shape:e,colour:t}){const r="shrink-0";switch(e){case"circle":/* @__PURE__ */
878
876
  return Ye("span",{className:`${r} h-2.5 w-2.5 rounded-full`,style:{backgroundColor:t}});case"circle-outline":/* @__PURE__ */
879
877
  return Ye("span",{className:`${r} h-2.5 w-2.5 rounded-full border-2`,style:{borderColor:t}});case"rounded-square-outline":/* @__PURE__ */
880
878
  return Ye("span",{className:`${r} h-2.5 w-2.5 rounded-sm border-2`,style:{borderColor:t}});case"square":/* @__PURE__ */
881
879
  return Ye("span",{className:`${r} h-2.5 w-2.5`,style:{backgroundColor:t}});case"bar":/* @__PURE__ */
882
880
  return Ye("span",{className:`${r} h-1 w-4 rounded-full`,style:{backgroundColor:t}});case"bar-vertical":/* @__PURE__ */
883
881
  return Ye("span",{className:`${r} h-3.5 w-1 rounded-full`,style:{backgroundColor:t}});default:/* @__PURE__ */
884
- return Ye("span",{className:`${r} h-2.5 w-2.5 rounded-sm`,style:{backgroundColor:t}})}}function Ld({entries:e,interactive:t,fallbackSwatch:r,onClick:n}){const{highlighted:a,setHighlighted:l}=lc();/* @__PURE__ */
882
+ return Ye("span",{className:`${r} h-2.5 w-2.5 rounded-sm`,style:{backgroundColor:t}})}}function Dd({entries:e,interactive:t,fallbackSwatch:r,onClick:n}){const{highlighted:a,setHighlighted:l}=oc();/* @__PURE__ */
885
883
  return Ye("ul",{className:"m-0 flex flex-wrap items-center gap-x-4 gap-y-1 p-0",children:e.map((e,i)=>{const o=t&&null!==a&&a!==e.key,s=/* @__PURE__ */Ge(Xe,{children:[
886
- /* @__PURE__ */Ye(Cd,{shape:e.swatch??r,colour:Is(i,e.color,e.tone)}),e.label]});/* @__PURE__ */
887
- return Ye("li",{className:"list-none",children:t||n?/* @__PURE__ */Ye("button",{type:"button",onClick:n?()=>n(e.key):void 0,"aria-pressed":n?Boolean(e.pressed):void 0,onMouseEnter:t?()=>l(e.key):void 0,onMouseLeave:t?()=>l(null):void 0,onFocus:t?()=>l(e.key):void 0,onBlur:t?()=>l(null):void 0,className:"flex items-center gap-2 rounded text-xs text-gray-600 transition-opacity rosh-focus-outline "+(o?"opacity-40":""),children:s}):/* @__PURE__ */Ye("span",{className:"flex items-center gap-2 text-xs text-gray-600",children:s})},e.key)})})}function Sd({title:e,subtitle:t,legend:r,table:n,tableLabel:a,busy:l=!1,loading:i=!1,skeletonVariant:o="area",skeletonHeight:s,interactiveLegend:c=!0,legendSwatch:d="rounded-square",onLegendClick:u,actions:h,children:m,className:p}){const g=he().charts;/* @__PURE__ */
888
- return Ye(ac,{children:/* @__PURE__ */Ge("section",{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-gray-200 bg-white p-5 ${p??""}`,"aria-busy":l||i||void 0,children:[
884
+ /* @__PURE__ */Ye(Sd,{shape:e.swatch??r,colour:Rs(i,e.color,e.tone)}),e.label]});/* @__PURE__ */
885
+ return Ye("li",{className:"list-none",children:t||n?/* @__PURE__ */Ye("button",{type:"button",onClick:n?()=>n(e.key):void 0,"aria-pressed":n?Boolean(e.pressed):void 0,onMouseEnter:t?()=>l(e.key):void 0,onMouseLeave:t?()=>l(null):void 0,onFocus:t?()=>l(e.key):void 0,onBlur:t?()=>l(null):void 0,className:"flex items-center gap-2 rounded text-xs text-gray-600 transition-opacity rosh-focus-outline "+(o?"opacity-40":""),children:s}):/* @__PURE__ */Ye("span",{className:"flex items-center gap-2 text-xs text-gray-600",children:s})},e.key)})})}function Pd({title:e,subtitle:t,legend:r,table:n,tableLabel:a,busy:l=!1,loading:i=!1,skeletonVariant:o="area",skeletonHeight:s,interactiveLegend:c=!0,legendSwatch:d="rounded-square",onLegendClick:u,actions:h,children:m,className:p}){const g=he().charts;/* @__PURE__ */
886
+ return Ye(ic,{children:/* @__PURE__ */Ge("section",{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-gray-200 bg-white p-5 ${p??""}`,"aria-busy":l||i||void 0,children:[
889
887
  /* @__PURE__ */Ge("header",{className:"flex items-start justify-between gap-4",children:[
890
888
  /* @__PURE__ */Ge("div",{className:"min-w-0",children:[
891
- /* @__PURE__ */Ye("h3",{className:"text-base font-semibold text-gray-900",children:e}),t&&/* @__PURE__ */Ye("p",{className:"mt-0.5 text-sm text-gray-500",children:t})]}),h&&/* @__PURE__ */Ye("div",{className:"shrink-0",children:h})]}),i?/* @__PURE__ */Ye(rc,{variant:o,height:s}):/* @__PURE__ */Ye("div",{className:l?"opacity-60 transition-opacity":"transition-opacity",children:m}),!i&&r&&r.length>1&&/* @__PURE__ */Ye(Ld,{entries:r,interactive:c,fallbackSwatch:d,onClick:u}),!i&&n&&/* @__PURE__ */Ge("details",{className:"border-t border-gray-100 pt-3",children:[
889
+ /* @__PURE__ */Ye("h3",{className:"text-base font-semibold text-gray-900",children:e}),t&&/* @__PURE__ */Ye("p",{className:"mt-0.5 text-sm text-gray-500",children:t})]}),h&&/* @__PURE__ */Ye("div",{className:"shrink-0",children:h})]}),i?/* @__PURE__ */Ye(ac,{variant:o,height:s}):/* @__PURE__ */Ye("div",{className:l?"opacity-60 transition-opacity":"transition-opacity",children:m}),!i&&r&&r.length>1&&/* @__PURE__ */Ye(Dd,{entries:r,interactive:c,fallbackSwatch:d,onClick:u}),!i&&n&&/* @__PURE__ */Ge("details",{className:"border-t border-gray-100 pt-3",children:[
892
890
  /* @__PURE__ */Ye("summary",{className:"cursor-pointer text-sm font-medium text-gray-600 rosh-focus-outline",children:a??g.showTable}),
893
- /* @__PURE__ */Ye("div",{className:"mt-3 overflow-x-auto",style:{color:Bs.label},children:n})]})]})})}function Dd({cx:e,cy:t,color:r,variant:n="default",pulse:a=!1,title:l}){const i="border"===n?3:"colored-border"===n?1.5:0,o="border"===n?3:3.5;/* @__PURE__ */
894
- return Ge("g",{children:[a&&/* @__PURE__ */Ye("circle",{className:"rosh-viz-ping",cx:e,cy:t,r:o,fill:r,fillOpacity:.45}),"border"===n&&/* @__PURE__ */Ye("circle",{cx:e,cy:t,r:o+i,fill:Bs.surface}),
895
- /* @__PURE__ */Ye("circle",{cx:e,cy:t,r:o,fill:"colored-border"===n?Bs.surface:r,stroke:"colored-border"===n?r:void 0,strokeWidth:"colored-border"===n?i:void 0,children:l&&/* @__PURE__ */Ye("title",{children:l})})]})}function Pd({labels:e,data:t,range:r,onRangeChange:n,height:a=46,width:l=720,color:i,className:o}){const s=he().charts,c=Be(null),d=e.length-1,[u,h]=r,m=i??Is(0),p=e=>0===d?0:e/d*l,g=e=>"number"==typeof e&&Number.isFinite(e),f=t.filter(g),b=Math.max(...f,1),x=e=>a-e/b*(a-6),y=[];e.forEach((e,r)=>{if(!g(t[r]))return;const n=y[y.length-1];n&&n.to===r-1?n.to=r:y.push({from:r,to:r})});const v=y.map(e=>{const r=[];for(let n=e.from;n<=e.to;n+=1)r.push(`${n===e.from?"M":"L"}${p(n).toFixed(2)},${x(t[n]).toFixed(2)}`);return`${r.join(" ")} L${p(e.to).toFixed(2)},${a} L${p(e.from).toFixed(2)},${a} Z`}).join(" "),w=(e,t)=>{const r=Math.max(0,Math.min(d,t));n("from"===e?[Math.min(r,h-1),h]:[u,Math.max(r,u+1)])},N=e=>t=>{const r=t.shiftKey?5:1,n="from"===e?u:h;"ArrowLeft"===t.key&&(t.preventDefault(),w(e,n-r)),"ArrowRight"===t.key&&(t.preventDefault(),w(e,n+r)),"Home"===t.key&&(t.preventDefault(),w(e,0)),"End"===t.key&&(t.preventDefault(),w(e,d))},k=Be(null),$=e=>t=>{k.current=e,t.currentTarget.setPointerCapture(t.pointerId)},M=e=>t=>{k.current===e&&w(e,(e=>{const t=c.current?.getBoundingClientRect();if(!t||0===t.width)return u;const r=Math.max(0,Math.min(1,(e-t.left)/t.width));return Math.round(r*d)})(t.clientX))},C=e=>()=>{k.current===e&&(k.current=null)},L=t=>{const r="from"===t?u:h;/* @__PURE__ */
891
+ /* @__PURE__ */Ye("div",{className:"mt-3 overflow-x-auto",style:{color:Is.label},children:n})]})]})})}function Ad({cx:e,cy:t,color:r,variant:n="default",pulse:a=!1,title:l}){const i="border"===n?3:"colored-border"===n?1.5:0,o="border"===n?3:3.5;/* @__PURE__ */
892
+ return Ge("g",{children:[a&&/* @__PURE__ */Ye("circle",{className:"rosh-viz-ping",cx:e,cy:t,r:o,fill:r,fillOpacity:.45}),"border"===n&&/* @__PURE__ */Ye("circle",{cx:e,cy:t,r:o+i,fill:Is.surface}),
893
+ /* @__PURE__ */Ye("circle",{cx:e,cy:t,r:o,fill:"colored-border"===n?Is.surface:r,stroke:"colored-border"===n?r:void 0,strokeWidth:"colored-border"===n?i:void 0,children:l&&/* @__PURE__ */Ye("title",{children:l})})]})}function jd({labels:e,data:t,range:r,onRangeChange:n,height:a=46,width:l=720,color:i,className:o}){const s=he().charts,c=Be(null),d=e.length-1,[u,h]=r,m=i??Rs(0),p=e=>0===d?0:e/d*l,g=e=>"number"==typeof e&&Number.isFinite(e),f=t.filter(g),b=Math.max(...f,1),x=e=>a-e/b*(a-6),y=[];e.forEach((e,r)=>{if(!g(t[r]))return;const n=y[y.length-1];n&&n.to===r-1?n.to=r:y.push({from:r,to:r})});const v=y.map(e=>{const r=[];for(let n=e.from;n<=e.to;n+=1)r.push(`${n===e.from?"M":"L"}${p(n).toFixed(2)},${x(t[n]).toFixed(2)}`);return`${r.join(" ")} L${p(e.to).toFixed(2)},${a} L${p(e.from).toFixed(2)},${a} Z`}).join(" "),w=(e,t)=>{const r=Math.max(0,Math.min(d,t));n("from"===e?[Math.min(r,h-1),h]:[u,Math.max(r,u+1)])},N=e=>t=>{const r=t.shiftKey?5:1,n="from"===e?u:h;"ArrowLeft"===t.key&&(t.preventDefault(),w(e,n-r)),"ArrowRight"===t.key&&(t.preventDefault(),w(e,n+r)),"Home"===t.key&&(t.preventDefault(),w(e,0)),"End"===t.key&&(t.preventDefault(),w(e,d))},k=Be(null),$=e=>t=>{k.current=e,t.currentTarget.setPointerCapture(t.pointerId)},M=e=>t=>{k.current===e&&w(e,(e=>{const t=c.current?.getBoundingClientRect();if(!t||0===t.width)return u;const r=Math.max(0,Math.min(1,(e-t.left)/t.width));return Math.round(r*d)})(t.clientX))},C=e=>()=>{k.current===e&&(k.current=null)},L=t=>{const r="from"===t?u:h;/* @__PURE__ */
896
894
  return Ye("rect",{x:p(r)-4.5,y:0,width:9,height:a,rx:3,fill:m,className:"cursor-ew-resize rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",tabIndex:0,role:"slider","aria-label":"from"===t?s.windowStart:s.windowEnd,"aria-valuemin":0,"aria-valuemax":d,"aria-valuenow":r,"aria-valuetext":e[r],style:{touchAction:"none"},onKeyDown:N(t),onPointerDown:$(t),onPointerMove:M(t),onPointerUp:C(t),onPointerCancel:C(t)},t)};/* @__PURE__ */
897
895
  return Ye("div",{className:o,children:/* @__PURE__ */Ge("svg",{ref:c,width:"100%",height:a,viewBox:`0 0 ${l} ${a}`,role:"group","aria-label":s.window(e[u],e[h],e.length),children:[
898
- /* @__PURE__ */Ye("path",{d:v,fill:Bs.grid}),
899
- /* @__PURE__ */Ye("rect",{x:0,y:0,width:p(u),height:a,fill:Bs.surface,fillOpacity:.72}),
900
- /* @__PURE__ */Ye("rect",{x:p(h),y:0,width:Math.max(0,l-p(h)),height:a,fill:Bs.surface,fillOpacity:.72}),
901
- /* @__PURE__ */Ye("rect",{x:p(u),y:0,width:Math.max(1,p(h)-p(u)),height:a,fill:"none",stroke:m,strokeWidth:1}),L("from"),L("to")]})})}var Ad=12,zd=16,jd=26,Fd=52,Ed=e=>"number"==typeof e&&Number.isFinite(e);function Bd({series:e,labels:t,height:r=200,stacked:n=!1,stackMode:a="value",levels:l,curve:i="linear",tension:o=0,max:s,yTickCount:c=4,formatValue:d,formatTooltipValue:u,tooltipLabels:h,yAxisLabel:m,referenceLines:p,labelEndpoints:g=!1,dots:f,dotVariant:b="border",pulse:x=!1,brush:y=!1,range:v,onRangeChange:w,loading:N=!1,animate:k=!0,reveal:$="left-to-right",fillVariant:M="gradient",gridStyle:C="solid",width:L,className:S,emptyLabel:D}){const P=he().charts,A=ue(),z=d??(e=>fe(e,A)),j=u??z,F=D??P.noData,E=Be(null),B=Qs(E),T=L??B,[I,O]=Ee(null),[R,W]=Ee(null),{highlighted:K}=lc(),q=je();if(Ie(()=>{if(null!==I)return Q(e=>"Escape"===e.key&&(O(null),!0))},[I]),N)/* @__PURE__ */
902
- return Ye("div",{className:S,ref:E,children:/* @__PURE__ */Ye(rc,{height:r,width:L??B})});const H=t,_=v??R??[0,Math.max(0,H.length-1)],[U,V]=_,Y=e=>y?e.slice(U,V+1):e,G=e.map((e,t)=>({...e,slot:t})).filter(e=>e.data.some(Ed)).map(e=>({...e,data:Y(e.data)}));if(t=Y(H),0===G.length||0===t.length)/* @__PURE__ */
903
- return Ye("div",{className:S,ref:E,children:/* @__PURE__ */Ye("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:r},children:F})});const X=t.map((e,t)=>G.reduce((e,r)=>e+(Ed(r.data[t])?r.data[t]:0),0)),Z=(e,t)=>X[t]>0?e/X[t]:null,J=[];if(n){let e=t.map(()=>0);for(const t of G)e=e.map((e,r)=>e+(Ed(t.data[r])?t.data[r]:0)),J.push("percent"===a?e.map((e,t)=>Z(e,t)):[...e])}const ee=!!l&&l.length>0,te=e=>"right"===e.axis,re=!n&&!ee&&void 0===s&&G.some(te)&&G.some(e=>!te(e)),ne=re?G.filter(e=>!te(e)):G,ae=re?G.filter(te).flatMap(e=>e.data.filter(Ed)):[],le=n?(J.at(-1)??[]).filter(Ed):ne.flatMap(e=>e.data.filter(Ed)),ie=re?Vs([Math.min(0,...le),Math.max(0,...le)],[Math.min(0,...ae),Math.max(0,...ae)],{intervals:c+1,integerLeft:le.every(Number.isInteger),integerRight:ae.every(Number.isInteger)}):null,oe=ie?ie.left:n&&"percent"===a||ee||void 0!==s?null:Us(n?0:Math.min(0,...le),Math.max(0,...le),{intervals:c+1,integer:le.every(Number.isInteger)}),se=oe?oe.lo:0,ce=n&&"percent"===a?1:oe?oe.hi:s??_s(Math.max(...le,0)),de=n&&"percent"===a?e=>xe(Math.round(100*e),0,A):z,me=ee?l:oe?oe.ticks:Ks([se,ce],{from:0,to:1}).ticks(c+1),pe=Js(me.map(de),Fd),ge=ie?Js(ie.right.ticks.map(z),zd):zd,be={left:pe,right:Math.max(pe+1,T-ge),top:Ad,bottom:r-jd},ye=qs(t.length,{from:be.left,to:be.right}),ve=ee?Hs(l,{from:be.bottom,to:be.top}):null,we=Ks([se,ce],{from:be.bottom,to:be.top}),Ne=we(Math.max(se,0)),ke=e=>ve?ve(e):we(e),$e=ie?Ks([ie.right.lo,ie.right.hi],{from:be.bottom,to:be.top}):null,Me=e=>$e&&te(e)?$e:ke,Ce=ve?ve.levels.map(e=>({value:e,y:ve(e)})):me.map(e=>({value:e,y:we(e)})),Le=e=>r=>{r.preventDefault(),O(r=>{const n=(r??0)+e;return Math.min(t.length-1,Math.max(0,n))})},Se=Math.max(1,Math.ceil(t.length/Math.max(1,Math.floor(T/96))));/* @__PURE__ */
896
+ /* @__PURE__ */Ye("path",{d:v,fill:Is.grid}),
897
+ /* @__PURE__ */Ye("rect",{x:0,y:0,width:p(u),height:a,fill:Is.surface,fillOpacity:.72}),
898
+ /* @__PURE__ */Ye("rect",{x:p(h),y:0,width:Math.max(0,l-p(h)),height:a,fill:Is.surface,fillOpacity:.72}),
899
+ /* @__PURE__ */Ye("rect",{x:p(u),y:0,width:Math.max(1,p(h)-p(u)),height:a,fill:"none",stroke:m,strokeWidth:1}),L("from"),L("to")]})})}var zd=12,Fd=16,Ed=26,Bd=52,Td=e=>"number"==typeof e&&Number.isFinite(e);function Id({series:e,labels:t,height:r=200,stacked:n=!1,stackMode:a="value",levels:l,curve:i="linear",tension:o=0,max:s,yTickCount:c=4,formatValue:d,formatTooltipValue:u,tooltipLabels:h,yAxisLabel:m,referenceLines:p,labelEndpoints:g=!1,dots:f,dotVariant:b="border",pulse:x=!1,brush:y=!1,range:v,onRangeChange:w,loading:N=!1,animate:k=!0,reveal:$="left-to-right",fillVariant:M="gradient",gridStyle:C="solid",width:L,className:S,emptyLabel:D}){const P=he().charts,A=ue(),j=d??(e=>fe(e,A)),z=u??j,F=D??P.noData,E=Be(null),B=tc(E),T=L??B,[I,O]=Ee(null),[R,W]=Ee(null),{highlighted:K}=oc(),_=ze();if(Ie(()=>{if(null!==I)return Q(e=>"Escape"===e.key&&(O(null),!0))},[I]),N)/* @__PURE__ */
900
+ return Ye("div",{className:S,ref:E,children:/* @__PURE__ */Ye(ac,{height:r,width:L??B})});const q=t,H=v??R??[0,Math.max(0,q.length-1)],[U,V]=H,Y=e=>y?e.slice(U,V+1):e,G=e.map((e,t)=>({...e,slot:t})).filter(e=>e.data.some(Td)).map(e=>({...e,data:Y(e.data)}));if(t=Y(q),0===G.length||0===t.length)/* @__PURE__ */
901
+ return Ye("div",{className:S,ref:E,children:/* @__PURE__ */Ye("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:r},children:F})});const X=t.map((e,t)=>G.reduce((e,r)=>e+(Td(r.data[t])?r.data[t]:0),0)),Z=(e,t)=>X[t]>0?e/X[t]:null,J=[];if(n){let e=t.map(()=>0);for(const t of G)e=e.map((e,r)=>e+(Td(t.data[r])?t.data[r]:0)),J.push("percent"===a?e.map((e,t)=>Z(e,t)):[...e])}const ee=!!l&&l.length>0,te=e=>"right"===e.axis,re=!n&&!ee&&void 0===s&&G.some(te)&&G.some(e=>!te(e)),ne=re?G.filter(e=>!te(e)):G,ae=re?G.filter(te).flatMap(e=>e.data.filter(Td)):[],le=n?(J.at(-1)??[]).filter(Td):ne.flatMap(e=>e.data.filter(Td)),ie=re?Gs([Math.min(0,...le),Math.max(0,...le)],[Math.min(0,...ae),Math.max(0,...ae)],{intervals:c+1,integerLeft:le.every(Number.isInteger),integerRight:ae.every(Number.isInteger)}):null,oe=ie?ie.left:n&&"percent"===a||ee||void 0!==s?null:Ys(n?0:Math.min(0,...le),Math.max(0,...le),{intervals:c+1,integer:le.every(Number.isInteger)}),se=oe?oe.lo:0,ce=n&&"percent"===a?1:oe?oe.hi:s??Vs(Math.max(...le,0)),de=n&&"percent"===a?e=>xe(Math.round(100*e),0,A):j,me=ee?l:oe?oe.ticks:qs([se,ce],{from:0,to:1}).ticks(c+1),pe=ec(me.map(de),Bd),ge=ie?ec(ie.right.ticks.map(j),Fd):Fd,be={left:pe,right:Math.max(pe+1,T-ge),top:zd,bottom:r-Ed},ye=Hs(t.length,{from:be.left,to:be.right}),ve=ee?Us(l,{from:be.bottom,to:be.top}):null,we=qs([se,ce],{from:be.bottom,to:be.top}),Ne=we(Math.max(se,0)),ke=e=>ve?ve(e):we(e),$e=ie?qs([ie.right.lo,ie.right.hi],{from:be.bottom,to:be.top}):null,Me=e=>$e&&te(e)?$e:ke,Ce=ve?ve.levels.map(e=>({value:e,y:ve(e)})):me.map(e=>({value:e,y:we(e)})),Le=e=>r=>{r.preventDefault(),O(r=>{const n=(r??0)+e;return Math.min(t.length-1,Math.max(0,n))})},Se=Math.max(1,Math.ceil(t.length/Math.max(1,Math.floor(T/96))));/* @__PURE__ */
904
902
  return Ge("div",{className:`relative ${S??""}`,ref:E,children:[
905
903
  /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${T} ${r}`,role:"img","aria-label":P.overIntervals(G.map(e=>e.label),t.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>O(null),onBlur:()=>O(null),onKeyDown:e=>{"ArrowRight"===e.key&&Le(1)(e),"ArrowLeft"===e.key&&Le(-1)(e)},children:[
906
- /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ye("clipPath",{id:q,children:/* @__PURE__ */Ye("rect",{x:be.left,y:be.top,width:be.right-be.left,height:be.bottom-be.top})})}),
907
- /* @__PURE__ */Ye(gi,{id:q,fills:G.map((e,t)=>({color:Is(e.slot,e.color,e.tone),variant:e.fillVariant??M})),fadeFrom:n?.42:.3,reveal:!!k&&$}),Ce.map(e=>/* @__PURE__ */Ye("line",{x1:be.left,y1:e.y,x2:be.right,y2:e.y,stroke:Bs.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===C?"3 3":void 0},`grid-${e.value}`)),
908
- /* @__PURE__ */Ye("line",{x1:be.left,y1:Ne,x2:be.right,y2:Ne,stroke:Bs.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Ce.map(e=>/* @__PURE__ */Ye("text",{x:be.left-8,y:e.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:de(e.value)},`ytick-${e.value}`)),ie&&Ce.map((e,t)=>/* @__PURE__ */Ye("text",{x:be.right+8,y:e.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:z(ie.right.ticks[t])},`ytick-r-${e.value}`)),m&&/* @__PURE__ */Ye("text",{x:12,y:(be.top+be.bottom)/2,transform:`rotate(-90 12 ${(be.top+be.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:Bs.label,children:m}),
909
- /* @__PURE__ */Ye("g",{clipPath:`url(#${q})`,mask:k&&$?`url(#${ci(q)})`:void 0,children:G.map((e,r)=>{const a=Is(e.slot,e.color,e.tone),l=e.mode??(n?"area":"line"),s=ic(e.key,K);if("step"===l){const r=t.map((t,r)=>({start:ye(r),end:ye.end(r),value:e.data[r]})).filter(e=>Ed(e.value)).map(t=>({start:t.start,end:t.end,y:Me(e)(t.value)}));/* @__PURE__ */
910
- return Ye("path",{d:hc(r),fill:"none",stroke:a,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:s??void 0,className:"rosh-viz-mark"},e.key)}const c=t.map((t,a)=>{const l=n?J[r]?.[a]:e.data[a];return Ed(l)?[ye.center(a),Me(e)(l)]:null}).filter(e=>null!==e);if(0===c.length)return null;if("column"===l){const l=Math.max(1,.62*ye.bandwidth),i="solid"===e.fillVariant,o=Me(e);/* @__PURE__ */
911
- return Ye("g",{opacity:s??void 0,className:"rosh-viz-mark",children:t.map((t,s)=>{const c=n?J[r]?.[s]:e.data[s];if(!Ed(c))return null;const d=o(c);/* @__PURE__ */
912
- return Ye("rect",{x:ye.center(s)-l/2,y:Math.min(d,Ne),width:l,height:Math.abs(Ne-d),rx:2,fill:a,fillOpacity:i?1:.35,className:k?bi.rise:void 0,style:k?xi(s,26):void 0},s)})},e.key)}const d=fc(c,i,o),u=n&&r>0?t.map((e,t)=>[ye.center(t),ke(J[r-1]?.[t]??0)-2]):null,h=u?xc(d,u):bc(d,c,Ne);/* @__PURE__ */
904
+ /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ye("clipPath",{id:_,children:/* @__PURE__ */Ye("rect",{x:be.left,y:be.top,width:be.right-be.left,height:be.bottom-be.top})})}),
905
+ /* @__PURE__ */Ye(gi,{id:_,fills:G.map((e,t)=>({color:Rs(e.slot,e.color,e.tone),variant:e.fillVariant??M})),fadeFrom:n?.42:.3,reveal:!!k&&$}),Ce.map(e=>/* @__PURE__ */Ye("line",{x1:be.left,y1:e.y,x2:be.right,y2:e.y,stroke:Is.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===C?"3 3":void 0},`grid-${e.value}`)),
906
+ /* @__PURE__ */Ye("line",{x1:be.left,y1:Ne,x2:be.right,y2:Ne,stroke:Is.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Ce.map(e=>/* @__PURE__ */Ye("text",{x:be.left-8,y:e.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:de(e.value)},`ytick-${e.value}`)),ie&&Ce.map((e,t)=>/* @__PURE__ */Ye("text",{x:be.right+8,y:e.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:j(ie.right.ticks[t])},`ytick-r-${e.value}`)),m&&/* @__PURE__ */Ye("text",{x:12,y:(be.top+be.bottom)/2,transform:`rotate(-90 12 ${(be.top+be.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:Is.label,children:m}),
907
+ /* @__PURE__ */Ye("g",{clipPath:`url(#${_})`,mask:k&&$?`url(#${ci(_)})`:void 0,children:G.map((e,r)=>{const a=Rs(e.slot,e.color,e.tone),l=e.mode??(n?"area":"line"),s=sc(e.key,K);if("step"===l){const r=t.map((t,r)=>({start:ye(r),end:ye.end(r),value:e.data[r]})).filter(e=>Td(e.value)).map(t=>({start:t.start,end:t.end,y:Me(e)(t.value)}));/* @__PURE__ */
908
+ return Ye("path",{d:pc(r),fill:"none",stroke:a,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:s??void 0,className:"rosh-viz-mark"},e.key)}const c=t.map((t,a)=>{const l=n?J[r]?.[a]:e.data[a];return Td(l)?[ye.center(a),Me(e)(l)]:null}).filter(e=>null!==e);if(0===c.length)return null;if("column"===l){const l=Math.max(1,.62*ye.bandwidth),i="solid"===e.fillVariant,o=Me(e);/* @__PURE__ */
909
+ return Ye("g",{opacity:s??void 0,className:"rosh-viz-mark",children:t.map((t,s)=>{const c=n?J[r]?.[s]:e.data[s];if(!Td(c))return null;const d=o(c);/* @__PURE__ */
910
+ return Ye("rect",{x:ye.center(s)-l/2,y:Math.min(d,Ne),width:l,height:Math.abs(Ne-d),rx:2,fill:a,fillOpacity:i?1:.35,className:k?bi.rise:void 0,style:k?xi(s,26):void 0},s)})},e.key)}const d=xc(c,i,o),u=n&&r>0?t.map((e,t)=>[ye.center(t),ke(J[r-1]?.[t]??0)-2]):null,h=u?vc(d,u):yc(d,c,Ne);/* @__PURE__ */
913
911
  return Ge("g",{opacity:s??void 0,className:"rosh-viz-mark",children:[("area"===l||n)&&
914
- /* @__PURE__ */Ye("path",{d:h,fill:ui(q,r,e.fillVariant??M,a),stroke:"none"}),
915
- /* @__PURE__ */Ye("path",{d:d,fill:"none",stroke:a,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:hi(e.stroke??(e.forecast?"animated-dashed":"solid")),className:k&&("animated-dashed"===e.stroke||e.forecast&&!e.stroke)?bi.march:void 0})]},e.key)})}),p?.map((e,t)=>{const r=e.color??Es[e.tone??"critical"],n=ke(e.value);/* @__PURE__ */
912
+ /* @__PURE__ */Ye("path",{d:h,fill:ui(_,r,e.fillVariant??M,a),stroke:"none"}),
913
+ /* @__PURE__ */Ye("path",{d:d,fill:"none",stroke:a,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:hi(e.stroke??(e.forecast?"animated-dashed":"solid")),className:k&&("animated-dashed"===e.stroke||e.forecast&&!e.stroke)?bi.march:void 0})]},e.key)})}),p?.map((e,t)=>{const r=e.color??Ts[e.tone??"critical"],n=ke(e.value);/* @__PURE__ */
916
914
  return Ge("g",{children:[
917
- /* @__PURE__ */Ye("line",{x1:be.left,y1:n,x2:be.right,y2:n,stroke:r,strokeWidth:1,strokeDasharray:"5 4"}),e.label&&/* @__PURE__ */Ye("text",{x:be.right-4,y:n-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:r,children:e.label})]},`rule-${t}`)}),"none"!==(f??(g?"last":"none"))&&G.map((e,r)=>{if("column"===e.mode)return null;const a=f??(g?"last":"none"),l=Is(e.slot,e.color,e.tone),i=[...e.data].map(Ed).lastIndexOf(!0),o="all"===a?t.map((e,t)=>t).filter(t=>Ed(n?J[r]?.[t]:e.data[t])):i>=0?[i]:[];/* @__PURE__ */
918
- return Ge("g",{children:[o.map(a=>{const o=n?J[r]?.[a]:e.data[a];return Ed(o)?/* @__PURE__ */Ye(Dd,{cx:ye.center(a),cy:Me(e)(o),color:l,variant:b,pulse:x&&a===i,title:`${t[a]}: ${e.label} ${z(o)}`},a):null}),g&&i>=0&&Ed(n?J[r]?.[i]:e.data[i])&&/* @__PURE__ */Ye("text",{x:ye.center(i)-10,y:Me(e)(n?J[r]?.[i]:e.data[i])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:z(n?J[r]?.[i]:e.data[i])})]},`dots-${e.key}`)}),t.map((e,t)=>t%Se===0?/* @__PURE__ */Ye("text",{x:ye.center(t),y:r-8,textAnchor:"middle",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:e},`xtick-${t}`):null),null!==I&&/* @__PURE__ */Ye("line",{x1:ye.center(I),y1:be.top,x2:ye.center(I),y2:be.bottom,stroke:Bs.axis,strokeWidth:1}),t.map((e,t)=>/* @__PURE__ */Ye("rect",{x:ye(t),y:be.top,width:Math.max(1,ye.bandwidth),height:be.bottom-be.top,fill:"transparent",onMouseEnter:()=>O(t)},`hit-${t}`))]}),y&&H.length>2&&/* @__PURE__ */Ye(Pd,{className:"mt-1",labels:H,width:T,data:e[0]?.data??[],range:_,onRangeChange:e=>{w?w(e):W(e)}}),null!==I&&
919
- /* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 z-10",style:ec(ye.center(I),ye.bandwidth,T),children:/* @__PURE__ */Ye(sc,{title:h?.[I]??t[I],rows:G.map((e,t)=>({key:e.key,label:e.label,color:Is(e.slot,e.color,e.tone),value:Ed(e.data[I])?n&&"percent"===a?`${xe(100*(Z(e.data[I],I)??0),1,A)} · ${j(e.data[I])}`:j(e.data[I]):void 0})),footnote:n&&"percent"===a?P.inBucket(j(X[I])):void 0})})]})}var Td=3;function Id({series:e,height:t=260,width:r,xLabel:n,yLabel:a,formatX:l,formatY:i,xDomain:o,yDomain:s,xScale:c="linear",yScale:d="linear",radiusRange:u=[4,22],className:h,emptyLabel:m}){const p=he().charts,g=ue(),f=l??(e=>fe(e,g)),b=i??(e=>fe(e,g)),x=m??p.noObservations,y=Be(null),v=Qs(y),w=r??v,N=je(),[k,$]=Ee(null);Ie(()=>{if(null!==k)return Q(e=>"Escape"===e.key&&($(null),!0))},[k]);const M=(e,t)=>!t||e>=Math.min(t[0],t[1])&&e<=Math.max(t[0],t[1]),C=e.map((e,t)=>({...e,slot:t})).filter(e=>e.points.length>0),L=o||s?C.map(e=>({...e,points:e.points.filter(e=>M(e.x,o)&&M(e.y,s))})).filter(e=>e.points.length>0):C,S=C.reduce((e,t)=>e+t.points.length,0)-L.reduce((e,t)=>e+t.points.length,0);if(0===L.length)/* @__PURE__ */
920
- return Ye("div",{className:h,ref:y,children:/* @__PURE__ */Ye("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:t},children:x})});const D=L.flatMap(e=>e.points),P=D.some(e=>null!=e.size),A=14,z=20,j=34,F=52,E=(e,t,r,n)=>{const a=e.filter(e=>e>0),l="log"===r?a.length>0?Math.min(...a):0:Math.min(0,...e),i=t??[l,_s(Math.max(...e))];return"log"===r?Ys(i,n):Ks(i,n)},B=E(D.map(e=>e.y),s,d,{from:t-j,to:A}),T=Js(B.ticks(5).map(b),F),I=Math.max(T+1,w-z),O=E(D.map(e=>e.x),o,c,{from:T,to:I}),R=Xs([0,Math.max(...D.map(e=>e.size??1))],{from:u[0],to:u[1]}),W=k?L[k.s]:void 0,K=k&&W?W.points[k.i]:void 0,q=L.flatMap((e,t)=>e.points.map((e,r)=>({s:t,i:r})));/* @__PURE__ */
915
+ /* @__PURE__ */Ye("line",{x1:be.left,y1:n,x2:be.right,y2:n,stroke:r,strokeWidth:1,strokeDasharray:"5 4"}),e.label&&/* @__PURE__ */Ye("text",{x:be.right-4,y:n-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:r,children:e.label})]},`rule-${t}`)}),"none"!==(f??(g?"last":"none"))&&G.map((e,r)=>{if("column"===e.mode)return null;const a=f??(g?"last":"none"),l=Rs(e.slot,e.color,e.tone),i=[...e.data].map(Td).lastIndexOf(!0),o="all"===a?t.map((e,t)=>t).filter(t=>Td(n?J[r]?.[t]:e.data[t])):i>=0?[i]:[];/* @__PURE__ */
916
+ return Ge("g",{children:[o.map(a=>{const o=n?J[r]?.[a]:e.data[a];return Td(o)?/* @__PURE__ */Ye(Ad,{cx:ye.center(a),cy:Me(e)(o),color:l,variant:b,pulse:x&&a===i,title:`${t[a]}: ${e.label} ${j(o)}`},a):null}),g&&i>=0&&Td(n?J[r]?.[i]:e.data[i])&&/* @__PURE__ */Ye("text",{x:ye.center(i)-10,y:Me(e)(n?J[r]?.[i]:e.data[i])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:j(n?J[r]?.[i]:e.data[i])})]},`dots-${e.key}`)}),t.map((e,t)=>t%Se===0?/* @__PURE__ */Ye("text",{x:ye.center(t),y:r-8,textAnchor:"middle",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:e},`xtick-${t}`):null),null!==I&&/* @__PURE__ */Ye("line",{x1:ye.center(I),y1:be.top,x2:ye.center(I),y2:be.bottom,stroke:Is.axis,strokeWidth:1}),t.map((e,t)=>/* @__PURE__ */Ye("rect",{x:ye(t),y:be.top,width:Math.max(1,ye.bandwidth),height:be.bottom-be.top,fill:"transparent",onMouseEnter:()=>O(t)},`hit-${t}`))]}),y&&q.length>2&&/* @__PURE__ */Ye(jd,{className:"mt-1",labels:q,width:T,data:e[0]?.data??[],range:H,onRangeChange:e=>{w?w(e):W(e)}}),null!==I&&
917
+ /* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 z-10",style:rc(ye.center(I),ye.bandwidth,T),children:/* @__PURE__ */Ye(dc,{title:h?.[I]??t[I],rows:G.map((e,t)=>({key:e.key,label:e.label,color:Rs(e.slot,e.color,e.tone),value:Td(e.data[I])?n&&"percent"===a?`${xe(100*(Z(e.data[I],I)??0),1,A)} · ${z(e.data[I])}`:z(e.data[I]):void 0})),footnote:n&&"percent"===a?P.inBucket(z(X[I])):void 0})})]})}var Od=3;function Rd({series:e,height:t=260,width:r,xLabel:n,yLabel:a,formatX:l,formatY:i,xDomain:o,yDomain:s,xScale:c="linear",yScale:d="linear",radiusRange:u=[4,22],className:h,emptyLabel:m}){const p=he().charts,g=ue(),f=l??(e=>fe(e,g)),b=i??(e=>fe(e,g)),x=m??p.noObservations,y=Be(null),v=tc(y),w=r??v,N=ze(),[k,$]=Ee(null);Ie(()=>{if(null!==k)return Q(e=>"Escape"===e.key&&($(null),!0))},[k]);const M=(e,t)=>!t||e>=Math.min(t[0],t[1])&&e<=Math.max(t[0],t[1]),C=e.map((e,t)=>({...e,slot:t})).filter(e=>e.points.length>0),L=o||s?C.map(e=>({...e,points:e.points.filter(e=>M(e.x,o)&&M(e.y,s))})).filter(e=>e.points.length>0):C,S=C.reduce((e,t)=>e+t.points.length,0)-L.reduce((e,t)=>e+t.points.length,0);if(0===L.length)/* @__PURE__ */
918
+ return Ye("div",{className:h,ref:y,children:/* @__PURE__ */Ye("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:t},children:x})});const D=L.flatMap(e=>e.points),P=D.some(e=>null!=e.size),A=14,j=20,z=34,F=52,E=(e,t,r,n)=>{const a=e.filter(e=>e>0),l="log"===r?a.length>0?Math.min(...a):0:Math.min(0,...e),i=t??[l,Vs(Math.max(...e))];return"log"===r?Xs(i,n):qs(i,n)},B=E(D.map(e=>e.y),s,d,{from:t-z,to:A}),T=ec(B.ticks(5).map(b),F),I=Math.max(T+1,w-j),O=E(D.map(e=>e.x),o,c,{from:T,to:I}),R=Js([0,Math.max(...D.map(e=>e.size??1))],{from:u[0],to:u[1]}),W=k?L[k.s]:void 0,K=k&&W?W.points[k.i]:void 0,_=L.flatMap((e,t)=>e.points.map((e,r)=>({s:t,i:r})));/* @__PURE__ */
921
919
  return Ge("div",{className:`relative ${h??""}`,ref:y,children:[
922
- /* @__PURE__ */Ge("svg",{width:"100%",height:t,viewBox:`0 0 ${w} ${t}`,role:"img","aria-label":p.scatter(L.map(e=>e.label),a??p.yAxis,n??p.xAxis)+(S>0?`. ${p.outsideRange(S)}`:""),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>$(null),onBlur:()=>$(null),onKeyDown:e=>{if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;e.preventDefault();const t="ArrowRight"===e.key?1:-1,r=k?q.findIndex(e=>e.s===k.s&&e.i===k.i):0;$(q[Math.min(q.length-1,Math.max(0,r+t))])},children:[
923
- /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ye("clipPath",{id:N,children:/* @__PURE__ */Ye("rect",{x:T-u[1],y:A-u[1],width:I-T+2*u[1],height:t-j-A+2*u[1]})})}),B.ticks(5).map(e=>/* @__PURE__ */Ge("g",{children:[
924
- /* @__PURE__ */Ye("line",{x1:T,y1:B(e),x2:I,y2:B(e),stroke:Bs.grid,strokeWidth:1,shapeRendering:"crispEdges"}),
925
- /* @__PURE__ */Ye("text",{x:T-8,y:B(e)+4,textAnchor:"end",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:b(e)})]},`y${e}`)),O.ticks(5).map(e=>/* @__PURE__ */Ye("text",{x:O(e),y:t-12,textAnchor:"middle",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:f(e)},`x${e}`)),n&&/* @__PURE__ */Ye("text",{x:(T+I)/2,y:t-.5,textAnchor:"middle",fontSize:11,fill:Bs.label,children:n}),a&&/* @__PURE__ */Ye("text",{x:12,y:t/2,transform:`rotate(-90 12 ${t/2})`,textAnchor:"middle",fontSize:11,fill:Bs.label,children:a}),
926
- /* @__PURE__ */Ye("g",{clipPath:`url(#${N})`,children:L.map((e,t)=>{const r=Ws(e.slot,3,e.color,e.tone);return e.points.map((n,a)=>/* @__PURE__ */Ye("circle",{cx:O(n.x),cy:B(n.y),r:P?R(n.size??0):u[0]+1,fill:r,fillOpacity:k&&k.s!==t?.25:.62,stroke:Bs.surface,strokeWidth:2,onMouseEnter:()=>$({s:t,i:a})},`${e.key}-${a}`))})})]}),k&&W&&K&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:K.label??W.label,rows:[{key:"x",label:n??p.xAxis,color:Ws(W.slot,3,W.color,W.tone),value:f(K.x)},{key:"y",label:a??p.yAxis,color:Ws(W.slot,3,W.color,W.tone),value:b(K.y)},...null!=K.size?[{key:"size",label:p.size,color:Bs.muted,value:fe(K.size,g)}]:[]],footnote:K.label?W.label:void 0})})]})}function Od({rows:e,labels:t,variant:r="area",curve:n="linear",height:a=220,width:l,max:i,min:o,formatValue:s,yAxisLabel:c,color:d,tone:u,label:h,className:m,emptyLabel:p,radius:g=3}){const f=he().charts,b=ue(),x=s??(e=>fe(e,b)),y=h??f.range,v=e.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),w=Is(0,d,u);/* @__PURE__ */
927
- return Ye(tc,{labels:t,values:v,height:a,width:l,max:i,min:o,formatValue:x,yAxisLabel:c,className:m,emptyLabel:p,bandPadding:"bar"===r?.34:0,ariaLabel:f.rangeLabel(y,t.length),tooltip:r=>/* @__PURE__ */Ye(sc,{title:t[r],rows:[{key:"high",label:f.high,color:w,value:null==e[r]?void 0:x(e[r].high)},{key:"low",label:f.low,color:w,value:null==e[r]?void 0:x(e[r].low)}]}),children:({x:t,y:a,active:l})=>"bar"===r?/* @__PURE__ */Ye("g",{children:e.map((e,r)=>/* @__PURE__ */Ye("rect",{x:t(r),y:a(e.high),width:Math.max(1,t.bandwidth),height:Math.max(1,a(e.low)-a(e.high)),rx:g,fill:w,fillOpacity:null===l||l===r?.85:.4},r))}):/* @__PURE__ */Ge("g",{children:[(()=>{const r=e.map((e,r)=>[t.center(r),a(e.high)]),l=e.map((e,r)=>[t.center(r),a(e.low)]);/* @__PURE__ */
920
+ /* @__PURE__ */Ge("svg",{width:"100%",height:t,viewBox:`0 0 ${w} ${t}`,role:"img","aria-label":p.scatter(L.map(e=>e.label),a??p.yAxis,n??p.xAxis)+(S>0?`. ${p.outsideRange(S)}`:""),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>$(null),onBlur:()=>$(null),onKeyDown:e=>{if("ArrowRight"!==e.key&&"ArrowLeft"!==e.key)return;e.preventDefault();const t="ArrowRight"===e.key?1:-1,r=k?_.findIndex(e=>e.s===k.s&&e.i===k.i):0;$(_[Math.min(_.length-1,Math.max(0,r+t))])},children:[
921
+ /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ye("clipPath",{id:N,children:/* @__PURE__ */Ye("rect",{x:T-u[1],y:A-u[1],width:I-T+2*u[1],height:t-z-A+2*u[1]})})}),B.ticks(5).map(e=>/* @__PURE__ */Ge("g",{children:[
922
+ /* @__PURE__ */Ye("line",{x1:T,y1:B(e),x2:I,y2:B(e),stroke:Is.grid,strokeWidth:1,shapeRendering:"crispEdges"}),
923
+ /* @__PURE__ */Ye("text",{x:T-8,y:B(e)+4,textAnchor:"end",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:b(e)})]},`y${e}`)),O.ticks(5).map(e=>/* @__PURE__ */Ye("text",{x:O(e),y:t-12,textAnchor:"middle",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:f(e)},`x${e}`)),n&&/* @__PURE__ */Ye("text",{x:(T+I)/2,y:t-.5,textAnchor:"middle",fontSize:11,fill:Is.label,children:n}),a&&/* @__PURE__ */Ye("text",{x:12,y:t/2,transform:`rotate(-90 12 ${t/2})`,textAnchor:"middle",fontSize:11,fill:Is.label,children:a}),
924
+ /* @__PURE__ */Ye("g",{clipPath:`url(#${N})`,children:L.map((e,t)=>{const r=_s(e.slot,3,e.color,e.tone);return e.points.map((n,a)=>/* @__PURE__ */Ye("circle",{cx:O(n.x),cy:B(n.y),r:P?R(n.size??0):u[0]+1,fill:r,fillOpacity:k&&k.s!==t?.25:.62,stroke:Is.surface,strokeWidth:2,onMouseEnter:()=>$({s:t,i:a})},`${e.key}-${a}`))})})]}),k&&W&&K&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:K.label??W.label,rows:[{key:"x",label:n??p.xAxis,color:_s(W.slot,3,W.color,W.tone),value:f(K.x)},{key:"y",label:a??p.yAxis,color:_s(W.slot,3,W.color,W.tone),value:b(K.y)},...null!=K.size?[{key:"size",label:p.size,color:Is.muted,value:fe(K.size,g)}]:[]],footnote:K.label?W.label:void 0})})]})}function Wd({rows:e,labels:t,variant:r="area",curve:n="linear",height:a=220,width:l,max:i,min:o,formatValue:s,yAxisLabel:c,color:d,tone:u,label:h,className:m,emptyLabel:p,radius:g=3}){const f=he().charts,b=ue(),x=s??(e=>fe(e,b)),y=h??f.range,v=e.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),w=Rs(0,d,u);/* @__PURE__ */
925
+ return Ye(nc,{labels:t,values:v,height:a,width:l,max:i,min:o,formatValue:x,yAxisLabel:c,className:m,emptyLabel:p,bandPadding:"bar"===r?.34:0,ariaLabel:f.rangeLabel(y,t.length),tooltip:r=>/* @__PURE__ */Ye(dc,{title:t[r],rows:[{key:"high",label:f.high,color:w,value:null==e[r]?void 0:x(e[r].high)},{key:"low",label:f.low,color:w,value:null==e[r]?void 0:x(e[r].low)}]}),children:({x:t,y:a,active:l})=>"bar"===r?/* @__PURE__ */Ye("g",{children:e.map((e,r)=>/* @__PURE__ */Ye("rect",{x:t(r),y:a(e.high),width:Math.max(1,t.bandwidth),height:Math.max(1,a(e.low)-a(e.high)),rx:g,fill:w,fillOpacity:null===l||l===r?.85:.4},r))}):/* @__PURE__ */Ge("g",{children:[(()=>{const r=e.map((e,r)=>[t.center(r),a(e.high)]),l=e.map((e,r)=>[t.center(r),a(e.low)]);/* @__PURE__ */
928
926
  return Ge(Xe,{children:[
929
- /* @__PURE__ */Ye("path",{d:xc(fc(r,n),l),fill:w,fillOpacity:.2,stroke:"none"}),
930
- /* @__PURE__ */Ye("path",{d:fc(r,n),fill:"none",stroke:w,strokeWidth:2,strokeLinejoin:"round"}),
931
- /* @__PURE__ */Ye("path",{d:fc(l,n),fill:"none",stroke:w,strokeWidth:2,strokeLinejoin:"round",strokeOpacity:.7})]})})(),null!==l&&/* @__PURE__ */Ye("line",{x1:t.center(l),y1:a(e[l].high),x2:t.center(l),y2:a(e[l].low),stroke:Bs.axis,strokeWidth:1})]})})}function Rd({steps:e,height:t=240,width:r,formatValue:n,yAxisLabel:a,className:l,emptyLabel:i,radius:o=3,connectors:s=!0}){const c=he().charts,d=ue(),u=n??(e=>fe(e,d));let h=0;const m=e.map(e=>{if(e.total){const t={from:0,to:h,value:h,total:!0};return{...e,...t}}const t=h;return h+=e.value,{...e,from:t,to:h,value:e.value,total:!1}}),p=m.flatMap(e=>[e.from,e.to]);/* @__PURE__ */
932
- return Ye(tc,{labels:e.map(e=>e.label),values:p,height:t,width:r,formatValue:u,yAxisLabel:a,className:l,emptyLabel:i,bandPadding:.36,ariaLabel:c.waterfall(e.length,u(m[0]?.from??0),u(h)),tooltip:e=>{const t=m[e],r=t?.total?Es.neutral:t.value>=0?Es.good:Es.critical;/* @__PURE__ */
933
- return Ye(sc,{title:t?.label,rows:[{key:"step",color:r,label:t?.total?c.balance:t.value>=0?c.increase:c.decrease,value:t?.total?u(t.to):`${t.value>=0?"+":"−"}${u(Math.abs(t.value))}`},...t?.total?[]:[{key:"running",label:c.runningTotal,color:Es.neutral,value:u(t.to)}]]})},children:({x:e,y:t,active:r})=>/* @__PURE__ */Ge("g",{children:[s&&m.slice(0,-1).map((r,n)=>
934
- /* @__PURE__ */Ye("line",{x1:e.end(n),y1:t(r.to),x2:e(n+1),y2:t(r.to),stroke:Bs.grid,strokeWidth:1,shapeRendering:"crispEdges"},`c${n}`)),m.map((n,a)=>{const l=n.total?Es.neutral:n.value>=0?Es.good:Es.critical,i=Math.min(t(n.from),t(n.to)),s=Math.max(1,Math.abs(t(n.to)-t(n.from)));/* @__PURE__ */
935
- return Ye("rect",{x:e(a),y:i,width:Math.max(1,e.bandwidth),height:s,rx:o,fill:l,fillOpacity:null===r||r===a?1:.45},a)})]})})}function Wd({values:e,bins:t=10,precomputed:r,height:n=220,width:a,color:l,tone:i,formatBound:o,formatCount:s,yAxisLabel:c,label:d,className:u,emptyLabel:h}){const m=he().charts,p=ue(),g=o??(e=>Number.isInteger(e)?fe(e,p):be(e,1,p)),f=s??(e=>fe(e,p)),b=c??m.countAxis,x=d??m.distribution,y=r??Zs(e??[],t),v=Is(0,l,i),w=y.map(e=>g(e.from)),N=y.map(e=>e.count);/* @__PURE__ */
936
- return Ye(tc,{labels:w,values:N,height:n,width:a,bandPadding:0,xTickAnchor:"start",formatValue:f,yAxisLabel:b,className:u,emptyLabel:h,ariaLabel:m.histogram(x,y.length,(e??[]).length),tooltip:e=>/* @__PURE__ */Ye(sc,{title:`${g(y[e].from)} – ${g(y[e].to)}`,rows:[{key:"count",label:m.observations,color:v,value:f(y[e].count)}]}),children:({x:e,y:t,bottom:r,active:n})=>/* @__PURE__ */Ye("g",{children:y.map((a,l)=>/* @__PURE__ */Ye("rect",{x:e(l)+.5,y:t(a.count),width:Math.max(1,e.bandwidth-1),height:Math.max(0,r-t(a.count)),fill:v,fillOpacity:null===n||n===l?.85:.42},l))})})}function Kd({boxes:e,height:t=240,width:r,color:n,tone:a,formatValue:l,yAxisLabel:i,label:o,className:s,emptyLabel:c}){const d=he().charts,u=ue(),h=l??(e=>fe(e,u)),m=o??d.distribution,p=Is(0,n,a),g=e.flatMap(e=>[e.min,e.max,...e.outliers??[]]).filter(Number.isFinite);/* @__PURE__ */
937
- return Ye(tc,{labels:e.map(e=>e.label),values:g,height:t,width:r,bandPadding:.5,formatValue:h,yAxisLabel:i,className:s,emptyLabel:c,ariaLabel:d.fiveNumber(m,e.length),tooltip:t=>{const r=e[t];/* @__PURE__ */
938
- return Ye(sc,{title:r.label,rows:[{key:"max",label:d.maximum,color:p,value:h(r.max)},{key:"q3",label:d.q3,color:p,value:h(r.q3)},{key:"median",label:d.median,color:p,value:h(r.median)},{key:"q1",label:d.q1,color:p,value:h(r.q1)},{key:"min",label:d.minimum,color:p,value:h(r.min)}],emphasisKey:"median",footnote:r.outliers?.length?d.outliers(r.outliers.length):void 0})},children:({x:t,y:r,active:n})=>/* @__PURE__ */Ye("g",{children:e.map((e,a)=>{const l=t.center(a),i=Math.max(6,t.bandwidth);/* @__PURE__ */
927
+ /* @__PURE__ */Ye("path",{d:vc(xc(r,n),l),fill:w,fillOpacity:.2,stroke:"none"}),
928
+ /* @__PURE__ */Ye("path",{d:xc(r,n),fill:"none",stroke:w,strokeWidth:2,strokeLinejoin:"round"}),
929
+ /* @__PURE__ */Ye("path",{d:xc(l,n),fill:"none",stroke:w,strokeWidth:2,strokeLinejoin:"round",strokeOpacity:.7})]})})(),null!==l&&/* @__PURE__ */Ye("line",{x1:t.center(l),y1:a(e[l].high),x2:t.center(l),y2:a(e[l].low),stroke:Is.axis,strokeWidth:1})]})})}function Kd({steps:e,height:t=240,width:r,formatValue:n,yAxisLabel:a,className:l,emptyLabel:i,radius:o=3,connectors:s=!0}){const c=he().charts,d=ue(),u=n??(e=>fe(e,d));let h=0;const m=e.map(e=>{if(e.total){const t={from:0,to:h,value:h,total:!0};return{...e,...t}}const t=h;return h+=e.value,{...e,from:t,to:h,value:e.value,total:!1}}),p=m.flatMap(e=>[e.from,e.to]);/* @__PURE__ */
930
+ return Ye(nc,{labels:e.map(e=>e.label),values:p,height:t,width:r,formatValue:u,yAxisLabel:a,className:l,emptyLabel:i,bandPadding:.36,ariaLabel:c.waterfall(e.length,u(m[0]?.from??0),u(h)),tooltip:e=>{const t=m[e],r=t?.total?Ts.neutral:t.value>=0?Ts.good:Ts.critical;/* @__PURE__ */
931
+ return Ye(dc,{title:t?.label,rows:[{key:"step",color:r,label:t?.total?c.balance:t.value>=0?c.increase:c.decrease,value:t?.total?u(t.to):`${t.value>=0?"+":"−"}${u(Math.abs(t.value))}`},...t?.total?[]:[{key:"running",label:c.runningTotal,color:Ts.neutral,value:u(t.to)}]]})},children:({x:e,y:t,active:r})=>/* @__PURE__ */Ge("g",{children:[s&&m.slice(0,-1).map((r,n)=>
932
+ /* @__PURE__ */Ye("line",{x1:e.end(n),y1:t(r.to),x2:e(n+1),y2:t(r.to),stroke:Is.grid,strokeWidth:1,shapeRendering:"crispEdges"},`c${n}`)),m.map((n,a)=>{const l=n.total?Ts.neutral:n.value>=0?Ts.good:Ts.critical,i=Math.min(t(n.from),t(n.to)),s=Math.max(1,Math.abs(t(n.to)-t(n.from)));/* @__PURE__ */
933
+ return Ye("rect",{x:e(a),y:i,width:Math.max(1,e.bandwidth),height:s,rx:o,fill:l,fillOpacity:null===r||r===a?1:.45},a)})]})})}function _d({values:e,bins:t=10,precomputed:r,height:n=220,width:a,color:l,tone:i,formatBound:o,formatCount:s,yAxisLabel:c,label:d,className:u,emptyLabel:h}){const m=he().charts,p=ue(),g=o??(e=>Number.isInteger(e)?fe(e,p):be(e,1,p)),f=s??(e=>fe(e,p)),b=c??m.countAxis,x=d??m.distribution,y=r??Qs(e??[],t),v=Rs(0,l,i),w=y.map(e=>g(e.from)),N=y.map(e=>e.count);/* @__PURE__ */
934
+ return Ye(nc,{labels:w,values:N,height:n,width:a,bandPadding:0,xTickAnchor:"start",formatValue:f,yAxisLabel:b,className:u,emptyLabel:h,ariaLabel:m.histogram(x,y.length,(e??[]).length),tooltip:e=>/* @__PURE__ */Ye(dc,{title:`${g(y[e].from)} – ${g(y[e].to)}`,rows:[{key:"count",label:m.observations,color:v,value:f(y[e].count)}]}),children:({x:e,y:t,bottom:r,active:n})=>/* @__PURE__ */Ye("g",{children:y.map((a,l)=>/* @__PURE__ */Ye("rect",{x:e(l)+.5,y:t(a.count),width:Math.max(1,e.bandwidth-1),height:Math.max(0,r-t(a.count)),fill:v,fillOpacity:null===n||n===l?.85:.42},l))})})}function qd({boxes:e,height:t=240,width:r,color:n,tone:a,formatValue:l,yAxisLabel:i,label:o,className:s,emptyLabel:c}){const d=he().charts,u=ue(),h=l??(e=>fe(e,u)),m=o??d.distribution,p=Rs(0,n,a),g=e.flatMap(e=>[e.min,e.max,...e.outliers??[]]).filter(Number.isFinite);/* @__PURE__ */
935
+ return Ye(nc,{labels:e.map(e=>e.label),values:g,height:t,width:r,bandPadding:.5,formatValue:h,yAxisLabel:i,className:s,emptyLabel:c,ariaLabel:d.fiveNumber(m,e.length),tooltip:t=>{const r=e[t];/* @__PURE__ */
936
+ return Ye(dc,{title:r.label,rows:[{key:"max",label:d.maximum,color:p,value:h(r.max)},{key:"q3",label:d.q3,color:p,value:h(r.q3)},{key:"median",label:d.median,color:p,value:h(r.median)},{key:"q1",label:d.q1,color:p,value:h(r.q1)},{key:"min",label:d.minimum,color:p,value:h(r.min)}],emphasisKey:"median",footnote:r.outliers?.length?d.outliers(r.outliers.length):void 0})},children:({x:t,y:r,active:n})=>/* @__PURE__ */Ye("g",{children:e.map((e,a)=>{const l=t.center(a),i=Math.max(6,t.bandwidth);/* @__PURE__ */
939
937
  return Ge("g",{opacity:null!==n&&n!==a?.45:1,children:[
940
938
  /* @__PURE__ */Ye("line",{x1:l,y1:r(e.max),x2:l,y2:r(e.q3),stroke:p,strokeWidth:1.5}),
941
939
  /* @__PURE__ */Ye("line",{x1:l,y1:r(e.q1),x2:l,y2:r(e.min),stroke:p,strokeWidth:1.5}),
942
940
  /* @__PURE__ */Ye("line",{x1:l-i/4,y1:r(e.max),x2:l+i/4,y2:r(e.max),stroke:p,strokeWidth:1.5}),
943
941
  /* @__PURE__ */Ye("line",{x1:l-i/4,y1:r(e.min),x2:l+i/4,y2:r(e.min),stroke:p,strokeWidth:1.5}),
944
942
  /* @__PURE__ */Ye("rect",{x:l-i/2,y:r(e.q3),width:i,height:Math.max(1,r(e.q1)-r(e.q3)),rx:2,fill:p,fillOpacity:.22,stroke:p,strokeWidth:1.5}),
945
- /* @__PURE__ */Ye("line",{x1:l-i/2,y1:r(e.median),x2:l+i/2,y2:r(e.median),stroke:p,strokeWidth:3}),(e.outliers??[]).map((e,t)=>/* @__PURE__ */Ye("circle",{cx:l,cy:r(e),r:3,fill:p,stroke:Bs.surface,strokeWidth:1.5},t))]},a)})})})}function qd({candles:e,variant:t="candle",height:r=260,width:n,formatValue:a,yAxisLabel:l,label:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=a??(e=>Number.isInteger(e)?fe(e,d):be(e,2,d)),h=i??c.price,m=e.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),p=Math.min(...m),g=Math.max(...m),f=.08*(g-p)||1;/* @__PURE__ */
946
- return Ye(tc,{labels:e.map(e=>e.label),values:m,height:r,width:n,min:p-f,max:g+f,bandPadding:.42,formatValue:u,yAxisLabel:l,className:o,emptyLabel:s,ariaLabel:c.ohlc(h,e.length),tooltip:t=>{const r=e[t],n=r.close>=r.open,a=n?Es.good:Es.critical;/* @__PURE__ */
947
- return Ye(sc,{title:r.label,rows:[{key:"open",label:c.open,color:a,value:u(r.open)},{key:"high",label:c.high,color:a,value:u(r.high)},{key:"low",label:c.low,color:a,value:u(r.low)},{key:"close",label:c.close,color:a,value:u(r.close)}],emphasisKey:"close",footnote:n?c.closedAbove:c.closedBelow})},children:({x:r,y:n,active:a})=>/* @__PURE__ */Ye("g",{children:e.map((e,l)=>{const i=e.close>=e.open,o=i?Es.good:Es.critical,s=r.center(l),c=Math.max(3,r.bandwidth),d=null!==a&&a!==l,u=n(Math.max(e.open,e.close)),h=Math.max(1,Math.abs(n(e.close)-n(e.open)));/* @__PURE__ */
943
+ /* @__PURE__ */Ye("line",{x1:l-i/2,y1:r(e.median),x2:l+i/2,y2:r(e.median),stroke:p,strokeWidth:3}),(e.outliers??[]).map((e,t)=>/* @__PURE__ */Ye("circle",{cx:l,cy:r(e),r:3,fill:p,stroke:Is.surface,strokeWidth:1.5},t))]},a)})})})}function Hd({candles:e,variant:t="candle",height:r=260,width:n,formatValue:a,yAxisLabel:l,label:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=a??(e=>Number.isInteger(e)?fe(e,d):be(e,2,d)),h=i??c.price,m=e.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),p=Math.min(...m),g=Math.max(...m),f=.08*(g-p)||1;/* @__PURE__ */
944
+ return Ye(nc,{labels:e.map(e=>e.label),values:m,height:r,width:n,min:p-f,max:g+f,bandPadding:.42,formatValue:u,yAxisLabel:l,className:o,emptyLabel:s,ariaLabel:c.ohlc(h,e.length),tooltip:t=>{const r=e[t],n=r.close>=r.open,a=n?Ts.good:Ts.critical;/* @__PURE__ */
945
+ return Ye(dc,{title:r.label,rows:[{key:"open",label:c.open,color:a,value:u(r.open)},{key:"high",label:c.high,color:a,value:u(r.high)},{key:"low",label:c.low,color:a,value:u(r.low)},{key:"close",label:c.close,color:a,value:u(r.close)}],emphasisKey:"close",footnote:n?c.closedAbove:c.closedBelow})},children:({x:r,y:n,active:a})=>/* @__PURE__ */Ye("g",{children:e.map((e,l)=>{const i=e.close>=e.open,o=i?Ts.good:Ts.critical,s=r.center(l),c=Math.max(3,r.bandwidth),d=null!==a&&a!==l,u=n(Math.max(e.open,e.close)),h=Math.max(1,Math.abs(n(e.close)-n(e.open)));/* @__PURE__ */
948
946
  return Ge("g",{opacity:d?.45:1,children:[
949
947
  /* @__PURE__ */Ye("line",{x1:s,y1:n(e.high),x2:s,y2:n(e.low),stroke:o,strokeWidth:1.5}),"candle"===t?/* @__PURE__ */Ye("rect",{x:s-c/2,y:u,width:c,height:h,rx:1,fill:i?o:"transparent",fillOpacity:i?.85:1,stroke:o,strokeWidth:1.5}):/* @__PURE__ */Ge(Xe,{children:[
950
948
  /* @__PURE__ */Ye("line",{x1:s-c/2,y1:n(e.open),x2:s,y2:n(e.open),stroke:o,strokeWidth:2}),
951
- /* @__PURE__ */Ye("line",{x1:s,y1:n(e.close),x2:s+c/2,y2:n(e.close),stroke:o,strokeWidth:2})]})]},l)})})})}function Hd({rows:e,columns:t,cells:r,height:n,width:a,color:l,max:i,formatValue:o,label:s,className:c,emptyLabel:d,cellGap:u=2,cellRadius:h=2}){const m=he().charts,p=ue(),g=o??(e=>fe(e,p)),f=s??m.intensity,b=d??m.noActivity,x=Be(null),y=Qs(x),v=a??y,w=je(),[N,k]=Ee(null);if(Ie(()=>{if(null!==N)return Q(e=>"Escape"===e.key&&(k(null),!0))},[N]),0===e.length||0===t.length)/* @__PURE__ */
952
- return Ye("div",{className:c,ref:x,children:/* @__PURE__ */Ye("p",{className:"py-8 text-center text-sm text-gray-500",children:b})});const $=l??Is(0),M=i??Math.max(1,...r.flat().filter(Number.isFinite)),C=96,L=26*e.length,S=n??L+26+26,D=Math.max(2,(Math.max(97,v)-C)/t.length),P=e=>{const t=M>0?Math.max(0,Math.min(1,e/M)):0;return`color-mix(in oklab, ${$} ${(8+92*t).toFixed(1)}%, ${Bs.surface})`};/* @__PURE__ */
949
+ /* @__PURE__ */Ye("line",{x1:s,y1:n(e.close),x2:s+c/2,y2:n(e.close),stroke:o,strokeWidth:2})]})]},l)})})})}function Ud({rows:e,columns:t,cells:r,height:n,width:a,color:l,max:i,formatValue:o,label:s,className:c,emptyLabel:d,cellGap:u=2,cellRadius:h=2}){const m=he().charts,p=ue(),g=o??(e=>fe(e,p)),f=s??m.intensity,b=d??m.noActivity,x=Be(null),y=tc(x),v=a??y,w=ze(),[N,k]=Ee(null);if(Ie(()=>{if(null!==N)return Q(e=>"Escape"===e.key&&(k(null),!0))},[N]),0===e.length||0===t.length)/* @__PURE__ */
950
+ return Ye("div",{className:c,ref:x,children:/* @__PURE__ */Ye("p",{className:"py-8 text-center text-sm text-gray-500",children:b})});const $=l??Rs(0),M=i??Math.max(1,...r.flat().filter(Number.isFinite)),C=96,L=26*e.length,S=n??L+26+26,D=Math.max(2,(Math.max(97,v)-C)/t.length),P=e=>{const t=M>0?Math.max(0,Math.min(1,e/M)):0;return`color-mix(in oklab, ${$} ${(8+92*t).toFixed(1)}%, ${Is.surface})`};/* @__PURE__ */
953
951
  return Ge("div",{className:`relative ${c??""}`,ref:x,children:[
954
952
  /* @__PURE__ */Ge("svg",{width:"100%",height:S,viewBox:`0 0 ${v} ${S}`,role:"img","aria-label":m.heatmap(f,e.length,t.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>k(null),onBlur:()=>k(null),onKeyDown:r=>{const n="ArrowDown"===r.key?1:"ArrowUp"===r.key?-1:0,a="ArrowRight"===r.key?1:"ArrowLeft"===r.key?-1:0;0===n&&0===a||(r.preventDefault(),k(r=>({r:Math.min(e.length-1,Math.max(0,(r?.r??0)+n)),c:Math.min(t.length-1,Math.max(0,(r?.c??0)+a))})))},children:[
955
953
  /* @__PURE__ */Ye("defs",{children:/* @__PURE__ */Ge("linearGradient",{id:w,x1:"0",x2:"1",children:[
956
954
  /* @__PURE__ */Ye("stop",{offset:"0",stopColor:P(0)}),
957
- /* @__PURE__ */Ye("stop",{offset:"1",stopColor:P(M)})]})}),e.map((e,t)=>/* @__PURE__ */Ye("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:Bs.label,children:e},`r${t}`)),e.map((e,n)=>t.map((t,a)=>{const l=r[n]?.[a]??0,i=N&&(N.r!==n||N.c!==a);/* @__PURE__ */
958
- return Ye("rect",{x:C+a*D+u/2,y:26*n+u/2,width:Math.max(1,D-u),height:26-u,rx:h,fill:P(l),opacity:i?.55:1,onMouseEnter:()=>k({r:n,c:a}),children:/* @__PURE__ */Ye("title",{children:`${e} · ${t}: ${g(l)}`})},`${n}-${a}`)})),t.map((e,r)=>r%Math.max(1,Math.ceil(t.length/Math.max(1,Math.floor((v-C)/56))))===0?/* @__PURE__ */Ye("text",{x:C+r*D+D/2,y:L+15,textAnchor:"middle",fontSize:11,fill:Bs.label,children:e},`c${r}`):null),
955
+ /* @__PURE__ */Ye("stop",{offset:"1",stopColor:P(M)})]})}),e.map((e,t)=>/* @__PURE__ */Ye("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:Is.label,children:e},`r${t}`)),e.map((e,n)=>t.map((t,a)=>{const l=r[n]?.[a]??0,i=N&&(N.r!==n||N.c!==a);/* @__PURE__ */
956
+ return Ye("rect",{x:C+a*D+u/2,y:26*n+u/2,width:Math.max(1,D-u),height:26-u,rx:h,fill:P(l),opacity:i?.55:1,onMouseEnter:()=>k({r:n,c:a}),children:/* @__PURE__ */Ye("title",{children:`${e} · ${t}: ${g(l)}`})},`${n}-${a}`)})),t.map((e,r)=>r%Math.max(1,Math.ceil(t.length/Math.max(1,Math.floor((v-C)/56))))===0?/* @__PURE__ */Ye("text",{x:C+r*D+D/2,y:L+15,textAnchor:"middle",fontSize:11,fill:Is.label,children:e},`c${r}`):null),
959
957
  /* @__PURE__ */Ye("rect",{x:C,y:L+26,width:Math.min(180,Math.max(40,v-C)),height:8,rx:4,fill:`url(#${w})`}),
960
- /* @__PURE__ */Ye("text",{x:C,y:L+48,fontSize:11,fill:Bs.label,children:"0"}),
961
- /* @__PURE__ */Ye("text",{x:C+Math.min(180,Math.max(40,v-C)),y:L+48,textAnchor:"end",fontSize:11,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:g(M)})]}),N&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */Ye(sc,{title:`${e[N.r]} · ${t[N.c]}`,rows:[{key:"v",label:f,color:$,value:null==r[N.r]?.[N.c]?void 0:g(r[N.r][N.c])}]})})]})}function _d({caption:e,head:t,rows:r}){/* @__PURE__ */
958
+ /* @__PURE__ */Ye("text",{x:C,y:L+48,fontSize:11,fill:Is.label,children:"0"}),
959
+ /* @__PURE__ */Ye("text",{x:C+Math.min(180,Math.max(40,v-C)),y:L+48,textAnchor:"end",fontSize:11,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:g(M)})]}),N&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */Ye(dc,{title:`${e[N.r]} · ${t[N.c]}`,rows:[{key:"v",label:f,color:$,value:null==r[N.r]?.[N.c]?void 0:g(r[N.r][N.c])}]})})]})}function Vd({caption:e,head:t,rows:r}){/* @__PURE__ */
962
960
  return Ge("table",{className:"sr-only",children:[
963
961
  /* @__PURE__ */Ye("caption",{children:e}),
964
962
  /* @__PURE__ */Ye("thead",{children:/* @__PURE__ */Ye("tr",{children:t.map(e=>/* @__PURE__ */Ye("th",{className:a,scope:"col",children:e},e))})}),
965
- /* @__PURE__ */Ye("tbody",{children:r.map((e,t)=>/* @__PURE__ */Ye("tr",{children:e.map((e,t)=>/* @__PURE__ */Ye("td",{children:e},t))},t))})]})}var Ud=3,Vd=e=>`${e.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" ")} Z`;function Yd({axes:e,series:t,size:r=300,mode:n="area",grid:a="polygon",rings:l=4,formatValue:i,animate:o=!0,className:s,emptyLabel:c}){const d=he().charts,u=ue(),h=i??(e=>fe(e,u)),m=c??d.nothingToCompare,p=je(),[g,f]=Ee(null),{highlighted:b}=lc(),x=t;if(e.length<3||0===x.length)/* @__PURE__ */
966
- return Ye("p",{className:`text-sm text-gray-500 ${s??""}`,children:m});const y=r/2,v=r/2,w=r/2-46,N=Gs(e.length),k=e.map((e,t)=>null!=e.max&&Number.isFinite(e.max)&&e.max>0?e.max:Math.max(1,...x.map(e=>e.values[t]??0).filter(Number.isFinite))),$=(e,t)=>{const r=Math.max(0,Math.min(1,t/k[e])),n=N.center(e)-N.step/2;return[y+w*r*Math.cos(n),v+w*r*Math.sin(n)]},M=(e,t)=>null!==g?g!==e:null!==b&&b!==t,C=null!==g?x[g]:void 0;/* @__PURE__ */
963
+ /* @__PURE__ */Ye("tbody",{children:r.map((e,t)=>/* @__PURE__ */Ye("tr",{children:e.map((e,t)=>/* @__PURE__ */Ye("td",{children:e},t))},t))})]})}var Yd=3,Gd=e=>`${e.map(([e,t],r)=>`${0===r?"M":"L"}${e.toFixed(2)},${t.toFixed(2)}`).join(" ")} Z`;function Xd({axes:e,series:t,size:r=300,mode:n="area",grid:a="polygon",rings:l=4,formatValue:i,animate:o=!0,className:s,emptyLabel:c}){const d=he().charts,u=ue(),h=i??(e=>fe(e,u)),m=c??d.nothingToCompare,p=ze(),[g,f]=Ee(null),{highlighted:b}=oc(),x=t;if(e.length<3||0===x.length)/* @__PURE__ */
964
+ return Ye("p",{className:`text-sm text-gray-500 ${s??""}`,children:m});const y=r/2,v=r/2,w=r/2-46,N=Zs(e.length),k=e.map((e,t)=>null!=e.max&&Number.isFinite(e.max)&&e.max>0?e.max:Math.max(1,...x.map(e=>e.values[t]??0).filter(Number.isFinite))),$=(e,t)=>{const r=Math.max(0,Math.min(1,t/k[e])),n=N.center(e)-N.step/2;return[y+w*r*Math.cos(n),v+w*r*Math.sin(n)]},M=(e,t)=>null!==g?g!==e:null!==b&&b!==t,C=null!==g?x[g]:void 0;/* @__PURE__ */
967
965
  return Ge("div",{className:`relative ${s??""}`,children:[
968
966
  /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${r} ${r}`,role:"img","aria-labelledby":p,onMouseLeave:()=>f(null),children:[
969
- /* @__PURE__ */Ye("title",{id:p,children:d.acrossMeasures(x.map(e=>e.label),e.length)}),Array.from({length:l},(t,r)=>{const n=w*(r+1)/l;return"circle"===a?/* @__PURE__ */Ye("circle",{cx:y,cy:v,r:n,fill:"none",stroke:Bs.grid,strokeWidth:1},r):/* @__PURE__ */Ye("path",{d:Vd(yc(y,v,n,e.length)),fill:"none",stroke:Bs.grid,strokeWidth:1},r)}),e.map((e,t)=>{const[r,n]=$(t,k[t]);/* @__PURE__ */
967
+ /* @__PURE__ */Ye("title",{id:p,children:d.acrossMeasures(x.map(e=>e.label),e.length)}),Array.from({length:l},(t,r)=>{const n=w*(r+1)/l;return"circle"===a?/* @__PURE__ */Ye("circle",{cx:y,cy:v,r:n,fill:"none",stroke:Is.grid,strokeWidth:1},r):/* @__PURE__ */Ye("path",{d:Gd(wc(y,v,n,e.length)),fill:"none",stroke:Is.grid,strokeWidth:1},r)}),e.map((e,t)=>{const[r,n]=$(t,k[t]);/* @__PURE__ */
970
968
  return Ge("g",{children:[
971
- /* @__PURE__ */Ye("line",{x1:y,y1:v,x2:r,y2:n,stroke:Bs.grid,strokeWidth:1}),
972
- /* @__PURE__ */Ye("text",{x:y+(w+18)*Math.cos(N.center(t)-N.step/2),y:v+(w+18)*Math.sin(N.center(t)-N.step/2)+4,textAnchor:"middle",fontSize:11,fill:Bs.label,children:e.label})]},e.key)}),
973
- /* @__PURE__ */Ye(gi,{id:p,reveal:!!o&&"center-out"}),x.map((t,r)=>{const a=Ws(r,3,t.color,t.tone),l=e.map((e,r)=>$(r,t.values[r]??0));/* @__PURE__ */
974
- return Ge("g",{opacity:M(r,t.key)?.3:1,onMouseEnter:()=>f(r),mask:o?`url(#${ci(p)})`:void 0,children:["area"===n&&/* @__PURE__ */Ye("path",{d:Vd(l),fill:a,fillOpacity:.18,stroke:"none"}),
975
- /* @__PURE__ */Ye("path",{d:Vd(l),fill:"none",stroke:a,strokeWidth:2,strokeLinejoin:"round"}),l.map(([e,t],r)=>/* @__PURE__ */Ye("circle",{cx:e,cy:t,r:3.5,fill:a,stroke:Bs.surface,strokeWidth:1.5},r))]},t.key)})]}),C&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:C.label,rows:e.map((e,t)=>({key:e.key,label:e.label,color:Ws(g,3,C.color,C.tone),value:h(C.values[t]??0)}))})}),
969
+ /* @__PURE__ */Ye("line",{x1:y,y1:v,x2:r,y2:n,stroke:Is.grid,strokeWidth:1}),
970
+ /* @__PURE__ */Ye("text",{x:y+(w+18)*Math.cos(N.center(t)-N.step/2),y:v+(w+18)*Math.sin(N.center(t)-N.step/2)+4,textAnchor:"middle",fontSize:11,fill:Is.label,children:e.label})]},e.key)}),
971
+ /* @__PURE__ */Ye(gi,{id:p,reveal:!!o&&"center-out"}),x.map((t,r)=>{const a=_s(r,3,t.color,t.tone),l=e.map((e,r)=>$(r,t.values[r]??0));/* @__PURE__ */
972
+ return Ge("g",{opacity:M(r,t.key)?.3:1,onMouseEnter:()=>f(r),mask:o?`url(#${ci(p)})`:void 0,children:["area"===n&&/* @__PURE__ */Ye("path",{d:Gd(l),fill:a,fillOpacity:.18,stroke:"none"}),
973
+ /* @__PURE__ */Ye("path",{d:Gd(l),fill:"none",stroke:a,strokeWidth:2,strokeLinejoin:"round"}),l.map(([e,t],r)=>/* @__PURE__ */Ye("circle",{cx:e,cy:t,r:3.5,fill:a,stroke:Is.surface,strokeWidth:1.5},r))]},t.key)})]}),C&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:C.label,rows:e.map((e,t)=>({key:e.key,label:e.label,color:_s(g,3,C.color,C.tone),value:h(C.values[t]??0)}))})}),
976
974
  /* @__PURE__ */Ye("ul",{className:"m-0 mt-3 grid gap-1 p-0",style:{gridTemplateColumns:"repeat(auto-fit,minmax(140px,1fr))"},children:x.map((e,t)=>/* @__PURE__ */Ge("li",{className:"flex list-none items-center gap-2 text-xs text-gray-600",children:[
977
- /* @__PURE__ */Ye("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:Ws(t,3,e.color,e.tone)}}),
975
+ /* @__PURE__ */Ye("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:_s(t,3,e.color,e.tone)}}),
978
976
  /* @__PURE__ */Ye("span",{className:"flex-1 truncate",children:e.label})]},e.key))}),
979
- /* @__PURE__ */Ye(_d,{caption:d.acrossMeasures(x.map(e=>e.label),e.length),head:[d.tableSeries,...e.map(e=>e.label)],rows:x.map(t=>[t.label,...e.map((e,r)=>h(t.values[r]??0))])})]})}var Gd=300*Math.PI/180;function Xd({rows:e,variant:t="track",size:r=300,max:n,formatValue:a,animate:l=!0,className:i,emptyLabel:o,trackGap:s=6}){const c=he().charts,d=ue(),u=a??(e=>fe(e,d)),h=o??c.nothingToPlot,m=je(),[p,g]=Ee(null),{highlighted:f}=lc();if(0===e.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${i??""}`,children:h});const b=r/2,x=r/2,y=r/2-10,v=n??Math.max(...e.map(e=>e.value),1),w="track"===t?Math.max(6,(y-.16*r)/e.length):0,N=Math.max(1,Math.floor((y-.16*r)/w||1)),k="track"===t?e.slice(0,N):e,$=Math.min(s,Math.max(1,w-2)),M=Gs(k.length,.03),C=null!==p?k[p]:void 0;/* @__PURE__ */
977
+ /* @__PURE__ */Ye(Vd,{caption:d.acrossMeasures(x.map(e=>e.label),e.length),head:[d.tableSeries,...e.map(e=>e.label)],rows:x.map(t=>[t.label,...e.map((e,r)=>h(t.values[r]??0))])})]})}var Zd=300*Math.PI/180;function Jd({rows:e,variant:t="track",size:r=300,max:n,formatValue:a,animate:l=!0,className:i,emptyLabel:o,trackGap:s=6}){const c=he().charts,d=ue(),u=a??(e=>fe(e,d)),h=o??c.nothingToPlot,m=ze(),[p,g]=Ee(null),{highlighted:f}=oc();if(0===e.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${i??""}`,children:h});const b=r/2,x=r/2,y=r/2-10,v=n??Math.max(...e.map(e=>e.value),1),w="track"===t?Math.max(6,(y-.16*r)/e.length):0,N=Math.max(1,Math.floor((y-.16*r)/w||1)),k="track"===t?e.slice(0,N):e,$=Math.min(s,Math.max(1,w-2)),M=Zs(k.length,.03),C=null!==p?k[p]:void 0;/* @__PURE__ */
980
978
  return Ge("div",{className:`relative ${i??""}`,children:[
981
979
  /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${r} ${r}`,role:"img","aria-labelledby":m,onMouseLeave:()=>g(null),children:[
982
- /* @__PURE__ */Ye("title",{id:m,children:"track"===t?c.radialTrack(k.length):c.radialCycle(k.length)}),k.map((e,n)=>{const a=Is(n,e.color,e.tone),i=Math.max(0,Math.min(1,e.value/v)),o=((e,t)=>null!==p?p!==e:null!==f&&f!==t)(n,e.key);if("track"===t){const t=y-n*w,r=t-w+$,s=-Math.PI/2;/* @__PURE__ */
980
+ /* @__PURE__ */Ye("title",{id:m,children:"track"===t?c.radialTrack(k.length):c.radialCycle(k.length)}),k.map((e,n)=>{const a=Rs(n,e.color,e.tone),i=Math.max(0,Math.min(1,e.value/v)),o=((e,t)=>null!==p?p!==e:null!==f&&f!==t)(n,e.key);if("track"===t){const t=y-n*w,r=t-w+$,s=-Math.PI/2;/* @__PURE__ */
983
981
  return Ge("g",{opacity:o?.4:1,onMouseEnter:()=>g(n),className:l?bi.sweep:void 0,style:l?xi(n,70):void 0,children:[
984
- /* @__PURE__ */Ye("path",{d:vc(b,x,r,t,s,s+Gd),fill:Bs.grid}),
985
- /* @__PURE__ */Ye("path",{d:vc(b,x,r,t,s,s+Gd*i),fill:a})]},e.key)}const s=.14*r;/* @__PURE__ */
986
- return Ye("g",{opacity:o?.4:1,onMouseEnter:()=>g(n),children:/* @__PURE__ */Ye("path",{d:vc(b,x,s,s+(y-s)*i,M(n),M(n)+M.step),fill:a})},e.key)})]}),C&&null!==p&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:C.label,rows:[{key:"value",label:c.value,color:Is(p,C.color,C.tone),value:u(C.value)}]})}),
982
+ /* @__PURE__ */Ye("path",{d:Nc(b,x,r,t,s,s+Zd),fill:Is.grid}),
983
+ /* @__PURE__ */Ye("path",{d:Nc(b,x,r,t,s,s+Zd*i),fill:a})]},e.key)}const s=.14*r;/* @__PURE__ */
984
+ return Ye("g",{opacity:o?.4:1,onMouseEnter:()=>g(n),children:/* @__PURE__ */Ye("path",{d:Nc(b,x,s,s+(y-s)*i,M(n),M(n)+M.step),fill:a})},e.key)})]}),C&&null!==p&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:C.label,rows:[{key:"value",label:c.value,color:Rs(p,C.color,C.tone),value:u(C.value)}]})}),
987
985
  /* @__PURE__ */Ye("ul",{className:"m-0 mt-3 grid gap-1 p-0",style:{gridTemplateColumns:"repeat(auto-fit,minmax(150px,1fr))"},children:e.map((e,t)=>/* @__PURE__ */Ge("li",{className:"flex list-none items-center gap-2 text-xs text-gray-600",children:[
988
- /* @__PURE__ */Ye("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:Is(t,e.color,e.tone)}}),
986
+ /* @__PURE__ */Ye("span",{className:"h-2.5 w-2.5 shrink-0 rounded-sm",style:{backgroundColor:Rs(t,e.color,e.tone)}}),
989
987
  /* @__PURE__ */Ye("span",{className:"flex-1 truncate",children:e.label}),
990
- /* @__PURE__ */Ye("span",{className:"tabular-nums text-gray-800",children:u(e.value)})]},e.key))})]})}function Zd({stages:e,shape:t="funnel",height:r,width:n,gap:a=4,minBandWidth:l=0,formatValue:i,color:o,className:s,emptyLabel:c}){const d=he().charts,u=ue(),h=i??(e=>fe(e,u)),m=c??d.noStages,p=je(),[g,f]=Ee(null),{highlighted:b}=lc(),x=Be(null),y=Qs(x,560),v=n??y;if(0===e.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${s??""}`,children:m});const w=o??Is(0),N=r??54*e.length,k=Math.max(...e.map(e=>e.value),1),$="bars"===t,M=$?Math.round(Math.min(132,Math.max(80,.24*v))):Math.round(Math.min(168,Math.max(104,.38*v))),C=t=>{const r=e[t-1]?.value;return null!=r&&r>0?100*(1-e[t].value/r):null},L=t=>{const r=C(t);return{count:h(e[t].value),drop:null!=r?`−${xe(r,1,u)}`:""}},S=$?Math.ceil(Math.max(...e.map((e,t)=>{const{count:r,drop:n}=L(t);return.62*(r.length+(n?n.length+1:0))*12}))+16):0,D=v-M-S,P=Math.max($?2:0,Math.min(l,D)),A=e=>Math.max(P,D*Math.max(0,e/k)),z=e=>A(e)/2,j=M+D/2,F=t=>46+t/Math.max(1,e.length-1)*54,E=e=>`color-mix(in oklab, ${w} ${F(e).toFixed(0)}%, ${Bs.surface})`,B=e=>F(e)>=55?Bs.surface:Bs.label,T=(e,t)=>null!==g?g!==e:null!==b&&b!==t,I=null!==g?e[g]:void 0;/* @__PURE__ */
988
+ /* @__PURE__ */Ye("span",{className:"tabular-nums text-gray-800",children:u(e.value)})]},e.key))})]})}function Qd({stages:e,shape:t="funnel",height:r,width:n,gap:a=4,minBandWidth:l=0,formatValue:i,color:o,className:s,emptyLabel:c}){const d=he().charts,u=ue(),h=i??(e=>fe(e,u)),m=c??d.noStages,p=ze(),[g,f]=Ee(null),{highlighted:b}=oc(),x=Be(null),y=tc(x,560),v=n??y;if(0===e.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${s??""}`,children:m});const w=o??Rs(0),N=r??54*e.length,k=Math.max(...e.map(e=>e.value),1),$="bars"===t,M=$?Math.round(Math.min(132,Math.max(80,.24*v))):Math.round(Math.min(168,Math.max(104,.38*v))),C=t=>{const r=e[t-1]?.value;return null!=r&&r>0?100*(1-e[t].value/r):null},L=t=>{const r=C(t);return{count:h(e[t].value),drop:null!=r?`−${xe(r,1,u)}`:""}},S=$?Math.ceil(Math.max(...e.map((e,t)=>{const{count:r,drop:n}=L(t);return.62*(r.length+(n?n.length+1:0))*12}))+16):0,D=v-M-S,P=Math.max($?2:0,Math.min(l,D)),A=e=>Math.max(P,D*Math.max(0,e/k)),j=e=>A(e)/2,z=M+D/2,F=t=>46+t/Math.max(1,e.length-1)*54,E=e=>`color-mix(in oklab, ${w} ${F(e).toFixed(0)}%, ${Is.surface})`,B=e=>F(e)>=55?Is.surface:Is.label,T=(e,t)=>null!==g?g!==e:null!==b&&b!==t,I=null!==g?e[g]:void 0;/* @__PURE__ */
991
989
  return Ge("div",{className:`relative ${s??""}`,ref:x,children:[
992
990
  /* @__PURE__ */Ge("svg",{width:"100%",height:N,viewBox:`0 0 ${v} ${N}`,role:"img","aria-labelledby":p,onMouseLeave:()=>f(null),children:[
993
991
  /* @__PURE__ */Ye("title",{id:p,children:d.funnel(e.length,h(e[0].value),h(e[e.length-1].value))}),e.map((r,n)=>{const l=n*N/e.length+a/2,i=(n+1)*N/e.length-a/2,o=(l+i)/2,s=xe(r.value/(e[0].value||1)*100,0,u),c=.62*s.length*12+12;if($){const e=M,t=e+A(r.value),{count:a,drop:d}=L(n);/* @__PURE__ */
994
992
  return Ge("g",{opacity:T(n,r.key)?.45:1,onMouseEnter:()=>f(n),children:[
995
993
  /* @__PURE__ */Ye("path",{d:`M${e},${l} L${t},${l} L${t},${i} L${e},${i} Z`,fill:E(n)}),
996
- /* @__PURE__ */Ye("text",{x:M-12,y:o+4,textAnchor:"end",fontSize:12,fill:Bs.label,children:r.label}),t-e>=c&&/* @__PURE__ */Ye("text",{x:e+8,y:o+4,textAnchor:"start",fontSize:12,fontWeight:600,fill:B(n),style:{fontVariantNumeric:"tabular-nums"},children:s}),
997
- /* @__PURE__ */Ge("text",{"data-funnel-value":"true",x:t+8,y:o+4,textAnchor:"start",fontSize:12,fill:Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:[
998
- /* @__PURE__ */Ye("tspan",{fontWeight:600,children:a}),d&&/* @__PURE__ */Ye("tspan",{fill:Bs.muted,children:` ${d}`})]})]},r.key)}const d=z(r.value),m="cone"===t?z(e[n+1]?.value??r.value):d,p=C(n),g=2*Math.min(d,m)>=c;/* @__PURE__ */
994
+ /* @__PURE__ */Ye("text",{x:M-12,y:o+4,textAnchor:"end",fontSize:12,fill:Is.label,children:r.label}),t-e>=c&&/* @__PURE__ */Ye("text",{x:e+8,y:o+4,textAnchor:"start",fontSize:12,fontWeight:600,fill:B(n),style:{fontVariantNumeric:"tabular-nums"},children:s}),
995
+ /* @__PURE__ */Ge("text",{"data-funnel-value":"true",x:t+8,y:o+4,textAnchor:"start",fontSize:12,fill:Is.label,style:{fontVariantNumeric:"tabular-nums"},children:[
996
+ /* @__PURE__ */Ye("tspan",{fontWeight:600,children:a}),d&&/* @__PURE__ */Ye("tspan",{fill:Is.muted,children:` ${d}`})]})]},r.key)}const d=j(r.value),m="cone"===t?j(e[n+1]?.value??r.value):d,p=C(n),g=2*Math.min(d,m)>=c;/* @__PURE__ */
999
997
  return Ge("g",{opacity:T(n,r.key)?.45:1,onMouseEnter:()=>f(n),children:[
1000
- /* @__PURE__ */Ye("path",{d:`M${j-d},${l} L${j+d},${l} L${j+m},${i} L${j-m},${i} Z`,fill:E(n)}),
1001
- /* @__PURE__ */Ye("text",{x:M-14,y:o-2,textAnchor:"end",fontSize:12,fill:Bs.label,children:r.label}),
1002
- /* @__PURE__ */Ge("text",{x:M-14,y:o+14,textAnchor:"end",fontSize:11,fill:Bs.muted,style:{fontVariantNumeric:"tabular-nums"},children:[h(r.value),null!=p?` · −${xe(p,1,u)}`:""]}),
1003
- /* @__PURE__ */Ye("text",{x:g?j:j+Math.max(d,m)+6,y:o+4,textAnchor:g?"middle":"start",fontSize:12,fontWeight:600,fill:g?B(n):Bs.label,style:{fontVariantNumeric:"tabular-nums"},children:s})]},r.key)})]}),I&&null!==g&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:I.label,rows:[{key:"value",label:d.count,color:E(g),value:h(I.value)},{key:"share",label:d.ofFirstStage,color:Bs.muted,value:xe(I.value/(e[0].value||1)*100,0,u)},...g>0&&e[g-1].value>0?[{key:"drop",label:d.droppedHere,color:Es.critical,value:`−${xe(100*(1-I.value/e[g-1].value),1,u)}`}]:[]]})})]})}function Jd({items:e,height:t=320,width:r,gap:n=2,radius:a=3,formatValue:l,color:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=l??(e=>fe(e,d)),h=s??c.nothingToBreakDown,m=Be(null),p=Qs(m),g=r??p,[f,b]=Ee(null),{highlighted:x}=lc(),y=vd(e,g,t);if(0===y.length)/* @__PURE__ */
1004
- return Ye("div",{className:o,ref:m,children:/* @__PURE__ */Ye("p",{className:"py-8 text-center text-sm text-gray-500",children:h})});const v=i??Is(0),w=Math.max(...y.map(e=>e.value),1),N=e=>34+e/w*62,k=e=>`color-mix(in oklab, ${v} ${N(e).toFixed(0)}%, ${Bs.surface})`,$=e=>N(e)>=55?Bs.surface:Bs.label,M=f??x,C=f?y.find(e=>e.key===f):void 0;/* @__PURE__ */
998
+ /* @__PURE__ */Ye("path",{d:`M${z-d},${l} L${z+d},${l} L${z+m},${i} L${z-m},${i} Z`,fill:E(n)}),
999
+ /* @__PURE__ */Ye("text",{x:M-14,y:o-2,textAnchor:"end",fontSize:12,fill:Is.label,children:r.label}),
1000
+ /* @__PURE__ */Ge("text",{x:M-14,y:o+14,textAnchor:"end",fontSize:11,fill:Is.muted,style:{fontVariantNumeric:"tabular-nums"},children:[h(r.value),null!=p?` · −${xe(p,1,u)}`:""]}),
1001
+ /* @__PURE__ */Ye("text",{x:g?z:z+Math.max(d,m)+6,y:o+4,textAnchor:g?"middle":"start",fontSize:12,fontWeight:600,fill:g?B(n):Is.label,style:{fontVariantNumeric:"tabular-nums"},children:s})]},r.key)})]}),I&&null!==g&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:I.label,rows:[{key:"value",label:d.count,color:E(g),value:h(I.value)},{key:"share",label:d.ofFirstStage,color:Is.muted,value:xe(I.value/(e[0].value||1)*100,0,u)},...g>0&&e[g-1].value>0?[{key:"drop",label:d.droppedHere,color:Ts.critical,value:`−${xe(100*(1-I.value/e[g-1].value),1,u)}`}]:[]]})})]})}function eu({items:e,height:t=320,width:r,gap:n=2,radius:a=3,formatValue:l,color:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=l??(e=>fe(e,d)),h=s??c.nothingToBreakDown,m=Be(null),p=tc(m),g=r??p,[f,b]=Ee(null),{highlighted:x}=oc(),y=Nd(e,g,t);if(0===y.length)/* @__PURE__ */
1002
+ return Ye("div",{className:o,ref:m,children:/* @__PURE__ */Ye("p",{className:"py-8 text-center text-sm text-gray-500",children:h})});const v=i??Rs(0),w=Math.max(...y.map(e=>e.value),1),N=e=>34+e/w*62,k=e=>`color-mix(in oklab, ${v} ${N(e).toFixed(0)}%, ${Is.surface})`,$=e=>N(e)>=55?Is.surface:Is.label,M=f??x,C=f?y.find(e=>e.key===f):void 0;/* @__PURE__ */
1005
1003
  return Ge("div",{className:`relative ${o??""}`,ref:m,children:[
1006
1004
  /* @__PURE__ */Ye("svg",{width:"100%",height:t,viewBox:`0 0 ${g} ${t}`,role:"img","aria-label":c.treemap(e.length),onMouseLeave:()=>b(null),children:y.map(e=>{const t=Math.max(0,e.width-n),r=Math.max(0,e.height-n),l=t>6.2*e.label.length+12&&r>30,i=l&&r>44;/* @__PURE__ */
1007
1005
  return Ge("g",{opacity:M&&M!==e.key?.55:1,onMouseEnter:()=>b(e.key),children:[
1008
- /* @__PURE__ */Ye("rect",{x:e.x+n/2,y:e.y+n/2,width:t,height:r,rx:a,fill:k(e.value)}),l&&/* @__PURE__ */Ye("text",{x:e.x+n/2+8,y:e.y+n/2+18,fontSize:12,fontWeight:600,fill:$(e.value),children:e.label}),i&&/* @__PURE__ */Ye("text",{x:e.x+n/2+8,y:e.y+n/2+34,fontSize:11,fill:$(e.value),fillOpacity:.85,style:{fontVariantNumeric:"tabular-nums"},children:u(e.value)})]},e.key)})}),C&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:C.label,rows:[{key:"value",label:c.value,color:k(C.value),value:u(C.value)}]})}),
1009
- /* @__PURE__ */Ye(_d,{caption:c.treemap(e.length),head:[c.tableItem,c.value],rows:y.map(e=>[e.label,u(e.value)])})]})}function Qd(e,t,r,n,a,l,i,o){if(n>=8)return;const s=e.reduce((e,t)=>e+eu(t,8-n),0);if(s<=0)return;let c=t;e.forEach((e,t)=>{const d=eu(e,8-n),u=d/s*r,h=`${i}/${e.key}`,m=0===n?t:a,p=0===n?e.key:l;o.push({id:h,label:e.label,value:d,depth:n,start:c,end:c+u,branch:m,branchKey:p}),e.children?.length&&Qd(e.children,c,u,n+1,m,p,h,o),c+=u})}function eu(e,t){return t>0&&e.children?.length?e.children.reduce((e,r)=>e+eu(r,t-1),0):Math.max(0,e.value??0)}function tu({nodes:e,size:t=320,innerRadius:r=44,ringGap:n=2,formatValue:a,centerLabel:l,className:i,emptyLabel:o}){const s=he().charts,c=ue(),d=a??(e=>fe(e,c)),u=o??s.nothingToBreakDown,[h,m]=Ee(null),{highlighted:p}=lc(),g=[];if(Qd(e,-Math.PI/2,2*Math.PI,0,0,"","",g),0===g.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${i??""}`,children:u});const f=Math.max(...g.map(e=>e.depth))+1,b=t/2,x=t/2,y=(t/2-8-r)/f,v=g.filter(e=>0===e.depth).reduce((e,t)=>e+t.value,0),w=e=>`color-mix(in oklab, ${Is(e.branch)} ${Math.max(16,100-24*e.depth).toFixed(0)}%, ${Bs.surface})`,N=e=>null!==h?e.id===h:null===p||e.branchKey===p,k=h?g.find(e=>e.id===h):void 0,$=e=>xe(e.value/v*100,1,c);/* @__PURE__ */
1006
+ /* @__PURE__ */Ye("rect",{x:e.x+n/2,y:e.y+n/2,width:t,height:r,rx:a,fill:k(e.value)}),l&&/* @__PURE__ */Ye("text",{x:e.x+n/2+8,y:e.y+n/2+18,fontSize:12,fontWeight:600,fill:$(e.value),children:e.label}),i&&/* @__PURE__ */Ye("text",{x:e.x+n/2+8,y:e.y+n/2+34,fontSize:11,fill:$(e.value),fillOpacity:.85,style:{fontVariantNumeric:"tabular-nums"},children:u(e.value)})]},e.key)})}),C&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:C.label,rows:[{key:"value",label:c.value,color:k(C.value),value:u(C.value)}]})}),
1007
+ /* @__PURE__ */Ye(Vd,{caption:c.treemap(e.length),head:[c.tableItem,c.value],rows:y.map(e=>[e.label,u(e.value)])})]})}function tu(e,t,r,n,a,l,i,o){if(n>=8)return;const s=e.reduce((e,t)=>e+ru(t,8-n),0);if(s<=0)return;let c=t;e.forEach((e,t)=>{const d=ru(e,8-n),u=d/s*r,h=`${i}/${e.key}`,m=0===n?t:a,p=0===n?e.key:l;o.push({id:h,label:e.label,value:d,depth:n,start:c,end:c+u,branch:m,branchKey:p}),e.children?.length&&tu(e.children,c,u,n+1,m,p,h,o),c+=u})}function ru(e,t){return t>0&&e.children?.length?e.children.reduce((e,r)=>e+ru(r,t-1),0):Math.max(0,e.value??0)}function nu({nodes:e,size:t=320,innerRadius:r=44,ringGap:n=2,formatValue:a,centerLabel:l,className:i,emptyLabel:o}){const s=he().charts,c=ue(),d=a??(e=>fe(e,c)),u=o??s.nothingToBreakDown,[h,m]=Ee(null),{highlighted:p}=oc(),g=[];if(tu(e,-Math.PI/2,2*Math.PI,0,0,"","",g),0===g.length)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${i??""}`,children:u});const f=Math.max(...g.map(e=>e.depth))+1,b=t/2,x=t/2,y=(t/2-8-r)/f,v=g.filter(e=>0===e.depth).reduce((e,t)=>e+t.value,0),w=e=>`color-mix(in oklab, ${Rs(e.branch)} ${Math.max(16,100-24*e.depth).toFixed(0)}%, ${Is.surface})`,N=e=>null!==h?e.id===h:null===p||e.branchKey===p,k=h?g.find(e=>e.id===h):void 0,$=e=>xe(e.value/v*100,1,c);/* @__PURE__ */
1010
1008
  return Ge("div",{className:`relative ${i??""}`,children:[
1011
- /* @__PURE__ */Ge("svg",{width:"100%",height:t,viewBox:`0 0 ${t} ${t}`,role:"img","aria-label":s.sunburst(d(v),f),onMouseLeave:()=>m(null),children:[g.map(e=>/* @__PURE__ */Ye("path",{d:vc(b,x,r+e.depth*y+n/2,r+(e.depth+1)*y-n/2,e.start,e.end),fill:w(e),fillOpacity:N(e)?1:.45,stroke:Bs.surface,strokeWidth:1,onMouseEnter:()=>m(e.id)},e.id)),l&&/* @__PURE__ */Ye("text",{x:b,y:x+5,textAnchor:"middle",fontSize:16,fontWeight:600,fill:Bs.label,children:l})]}),k&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:k.label,rows:[{key:"value",label:s.value,color:w(k),value:d(k.value)},{key:"share",label:s.share,color:Bs.muted,value:$(k)}]})}),
1012
- /* @__PURE__ */Ye(_d,{caption:s.sunburst(d(v),f),head:[s.tableLevel,s.tableItem,s.value,s.share],rows:g.map(e=>[e.depth+1,e.label,d(e.value),$(e)])})]})}function ru({nodes:e,links:t,height:r=320,width:n,nodeWidth:a=14,nodePadding:l=12,formatValue:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=i??(e=>fe(e,d)),h=s??c.noFlows,m=Be(null),p=Qs(m),g=n??p,[f,b]=Ee(null),{highlighted:x}=lc();if(0===e.length||0===t.length)/* @__PURE__ */
1013
- return Ye("div",{className:o,ref:m,children:/* @__PURE__ */Ye("p",{className:"py-8 text-center text-sm text-gray-500",children:h})});const y=[...new Set(e.map(e=>e.depth))].sort((e,t)=>e-t),v=e=>y.length<=1?0:y.indexOf(e)/(y.length-1)*(g-a-140)+70,w=new Map(e.map(e=>{const r=t.filter(t=>t.from===e.key).reduce((e,t)=>e+t.value,0),n=t.filter(t=>t.to===e.key).reduce((e,t)=>e+t.value,0);return[e.key,Math.max(r,n,e.value??0)]})),N=/* @__PURE__ */new Map;for(const t of e)N.set(t.depth,[...N.get(t.depth)??[],t]);const k=Math.max(...[...N.values()].map(e=>e.reduce((e,t)=>e+(w.get(t.key)??0),0))),$=r-20,M=k>0?($-l*(Math.max(...[...N.values()].map(e=>e.length))-1))/k:0,C=/* @__PURE__ */new Map;for(const[e,t]of N){const r=t.map(e=>Math.max(2,(w.get(e.key)??0)*M)),n=r.reduce((e,t)=>e+t,0)+l*(t.length-1),a=r.reduce((e,t)=>e+Math.max(0,t-2),0),i=n>$&&a>0?Math.max(0,1-(n-$)/a):1;let o=10;t.forEach((t,n)=>{const a=2+Math.max(0,r[n]-2)*i;C.set(t.key,{x:v(e),y:o,h:a,index:n}),o+=a+l})}const L=/* @__PURE__ */new Map,S=/* @__PURE__ */new Map,D=/* @__PURE__ */new Map,P=(e,t)=>e.from===t||e.to===t,A="link"===f?.kind?t[f.index]:void 0,z="node"===f?.kind?e.find(e=>e.key===f.key):void 0;/* @__PURE__ */
1009
+ /* @__PURE__ */Ge("svg",{width:"100%",height:t,viewBox:`0 0 ${t} ${t}`,role:"img","aria-label":s.sunburst(d(v),f),onMouseLeave:()=>m(null),children:[g.map(e=>/* @__PURE__ */Ye("path",{d:Nc(b,x,r+e.depth*y+n/2,r+(e.depth+1)*y-n/2,e.start,e.end),fill:w(e),fillOpacity:N(e)?1:.45,stroke:Is.surface,strokeWidth:1,onMouseEnter:()=>m(e.id)},e.id)),l&&/* @__PURE__ */Ye("text",{x:b,y:x+5,textAnchor:"middle",fontSize:16,fontWeight:600,fill:Is.label,children:l})]}),k&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:k.label,rows:[{key:"value",label:s.value,color:w(k),value:d(k.value)},{key:"share",label:s.share,color:Is.muted,value:$(k)}]})}),
1010
+ /* @__PURE__ */Ye(Vd,{caption:s.sunburst(d(v),f),head:[s.tableLevel,s.tableItem,s.value,s.share],rows:g.map(e=>[e.depth+1,e.label,d(e.value),$(e)])})]})}function au({nodes:e,links:t,height:r=320,width:n,nodeWidth:a=14,nodePadding:l=12,formatValue:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=i??(e=>fe(e,d)),h=s??c.noFlows,m=Be(null),p=tc(m),g=n??p,[f,b]=Ee(null),{highlighted:x}=oc();if(0===e.length||0===t.length)/* @__PURE__ */
1011
+ return Ye("div",{className:o,ref:m,children:/* @__PURE__ */Ye("p",{className:"py-8 text-center text-sm text-gray-500",children:h})});const y=[...new Set(e.map(e=>e.depth))].sort((e,t)=>e-t),v=e=>y.length<=1?0:y.indexOf(e)/(y.length-1)*(g-a-140)+70,w=new Map(e.map(e=>{const r=t.filter(t=>t.from===e.key).reduce((e,t)=>e+t.value,0),n=t.filter(t=>t.to===e.key).reduce((e,t)=>e+t.value,0);return[e.key,Math.max(r,n,e.value??0)]})),N=/* @__PURE__ */new Map;for(const t of e)N.set(t.depth,[...N.get(t.depth)??[],t]);const k=Math.max(...[...N.values()].map(e=>e.reduce((e,t)=>e+(w.get(t.key)??0),0))),$=r-20,M=k>0?($-l*(Math.max(...[...N.values()].map(e=>e.length))-1))/k:0,C=/* @__PURE__ */new Map;for(const[e,t]of N){const r=t.map(e=>Math.max(2,(w.get(e.key)??0)*M)),n=r.reduce((e,t)=>e+t,0)+l*(t.length-1),a=r.reduce((e,t)=>e+Math.max(0,t-2),0),i=n>$&&a>0?Math.max(0,1-(n-$)/a):1;let o=10;t.forEach((t,n)=>{const a=2+Math.max(0,r[n]-2)*i;C.set(t.key,{x:v(e),y:o,h:a,index:n}),o+=a+l})}const L=/* @__PURE__ */new Map,S=/* @__PURE__ */new Map,D=/* @__PURE__ */new Map,P=(e,t)=>e.from===t||e.to===t,A="link"===f?.kind?t[f.index]:void 0,j="node"===f?.kind?e.find(e=>e.key===f.key):void 0;/* @__PURE__ */
1014
1012
  return Ge("div",{className:`relative ${o??""}`,ref:m,children:[
1015
- /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${g} ${r}`,role:"img","aria-label":c.sankey(e.length,t.length),onMouseLeave:()=>b(null),children:[t.map((e,t)=>{const r=C.get(e.from),n=C.get(e.to);if(!r||!n)return null;const l=Math.max(1,e.value*M),i=r.y+(L.get(e.from)??0)+l/2,o=n.y+(S.get(e.to)??0)+l/2;L.set(e.from,(L.get(e.from)??0)+l),S.set(e.to,(S.get(e.to)??0)+l);const s=r.x+a,c=n.x,d=Is(r.index,e.color),u=`${e.from}→${e.to}`,h=D.get(u)??0;D.set(u,h+1);const m=((e,t)=>f?"link"===f.kind?f.index===t:P(e,f.key):null!==x?P(e,x):null)(e,t);/* @__PURE__ */
1016
- return Ye("path",{d:gc([[s,i],[c,o]]),fill:"none",stroke:d,strokeWidth:l,strokeOpacity:null===m||m?.42:.12,onMouseEnter:()=>b({kind:"link",index:t})},h?`${u}#${h}`:u)}),e.map(e=>{const r=C.get(e.key);if(!r)return null;const n=r.x>g/2,l=(i=e.key,f?"node"===f.kind?f.key===i:P(t[f.index],i):null!==x?x===i:null);var i;/* @__PURE__ */
1013
+ /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${g} ${r}`,role:"img","aria-label":c.sankey(e.length,t.length),onMouseLeave:()=>b(null),children:[t.map((e,t)=>{const r=C.get(e.from),n=C.get(e.to);if(!r||!n)return null;const l=Math.max(1,e.value*M),i=r.y+(L.get(e.from)??0)+l/2,o=n.y+(S.get(e.to)??0)+l/2;L.set(e.from,(L.get(e.from)??0)+l),S.set(e.to,(S.get(e.to)??0)+l);const s=r.x+a,c=n.x,d=Rs(r.index,e.color),u=`${e.from}→${e.to}`,h=D.get(u)??0;D.set(u,h+1);const m=((e,t)=>f?"link"===f.kind?f.index===t:P(e,f.key):null!==x?P(e,x):null)(e,t);/* @__PURE__ */
1014
+ return Ye("path",{d:bc([[s,i],[c,o]]),fill:"none",stroke:d,strokeWidth:l,strokeOpacity:null===m||m?.42:.12,onMouseEnter:()=>b({kind:"link",index:t})},h?`${u}#${h}`:u)}),e.map(e=>{const r=C.get(e.key);if(!r)return null;const n=r.x>g/2,l=(i=e.key,f?"node"===f.kind?f.key===i:P(t[f.index],i):null!==x?x===i:null);var i;/* @__PURE__ */
1017
1015
  return Ge("g",{opacity:null===l||l?1:.45,onMouseEnter:()=>b({kind:"node",key:e.key}),children:[
1018
- /* @__PURE__ */Ye("rect",{x:r.x,y:r.y,width:a,height:r.h,rx:2,fill:Is(r.index,e.color,e.tone)}),
1019
- /* @__PURE__ */Ye("text",{x:n?r.x-8:r.x+a+8,y:r.y+r.h/2+4,textAnchor:n?"end":"start",fontSize:11,fill:Bs.label,children:e.label})]},e.key)})]}),A&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:`${A.from} → ${A.to}`,rows:[{key:"value",label:c.flow,color:Is(C.get(A.from)?.index??0,A.color),value:u(A.value)}]})}),z&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:z.label,rows:[{key:"value",label:c.throughput,color:Is(C.get(z.key)?.index??0,z.color,z.tone),value:u(w.get(z.key)??0)}]})}),
1020
- /* @__PURE__ */Ye(_d,{caption:c.sankey(e.length,t.length),head:[c.tableFrom,c.tableTo,c.value],rows:t.map(e=>[e.from,e.to,u(e.value)])})]})}function nu({labels:e,matrix:t,size:r=340,maxNodes:n=8,padAngle:a=.04,arcWidth:l=12,formatValue:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=i??(e=>fe(e,d)),h=s??c.noFlows,[m,p]=Ee(null),{highlighted:g}=lc(),f=function(e,t,r,n){const a=(e,r)=>{const n=t[e]?.[r];return"number"==typeof n&&Number.isFinite(n)?n:0},l=e.map((t,r)=>e.reduce((e,t,n)=>e+a(r,n)+a(n,r),0)),i=Math.max(2,r),o=e.length>i,s=o?e.map((e,t)=>t).sort((e,t)=>l[t]-l[e]).slice(0,i-1).sort((e,t)=>e-t):e.map((e,t)=>t),c=new Map(s.map((e,t)=>[e,t])),d=o?s.length:-1,u=o?[...s.map(t=>e[t]),n]:[...e],h=u.map(()=>u.map(()=>0));let m=0;e.forEach((t,r)=>e.forEach((e,t)=>{const n=c.get(r)??d,l=c.get(t)??d;n!==d||l!==d?h[n][l]+=a(r,t):m+=a(r,t)}));const p=u.map((e,t)=>u.reduce((e,r,n)=>e+h[t][n]+h[n][t],0));return d>=0&&(p[d]+=m),{labels:u,matrix:h,totals:p,otherIndex:d,foldedCount:o?e.length-s.length:0}}(e,t,n,c.other),{labels:b,matrix:x,otherIndex:y,foldedCount:v}=f,w=(e,t)=>x[e]?.[t]??0,N=e=>e===y?Bs.muted:Is(e),k=f.totals,$=b.map((e,t)=>t).sort((e,t)=>k[t]-k[e]),M=$.reduce((e,t)=>e+k[t],0);if(M<=0)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${o??""}`,children:h});const C=r/2,L=r/2,S=r/2-44,D=S-l,P=a*$.length,A=/* @__PURE__ */new Map;let z=-Math.PI/2;$.forEach((e,t)=>{const r=k[e]/M*(2*Math.PI-P);A.set(e,{start:z,end:z+r,slot:t}),z+=r+a});const j=/* @__PURE__ */new Map,F=[];for(const e of $)for(const t of $){const r=w(e,t);if(r<=0)continue;const n=A.get(e),a=r/Math.max(1,k[e])*(n.end-n.start),l=j.get(e)??0;j.set(e,l+a),F.push({from:e,to:t,value:r,a:n.start+l+a/2,b:A.get(t).start+(A.get(t).end-A.get(t).start)/2})}const E=(e,t)=>[C+t*Math.cos(e),L+t*Math.sin(e)],B="arc"===m?.kind?m.index:void 0,T="ribbon"===m?.kind?F[m.index]:void 0;/* @__PURE__ */
1016
+ /* @__PURE__ */Ye("rect",{x:r.x,y:r.y,width:a,height:r.h,rx:2,fill:Rs(r.index,e.color,e.tone)}),
1017
+ /* @__PURE__ */Ye("text",{x:n?r.x-8:r.x+a+8,y:r.y+r.h/2+4,textAnchor:n?"end":"start",fontSize:11,fill:Is.label,children:e.label})]},e.key)})]}),A&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:`${A.from} → ${A.to}`,rows:[{key:"value",label:c.flow,color:Rs(C.get(A.from)?.index??0,A.color),value:u(A.value)}]})}),j&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:j.label,rows:[{key:"value",label:c.throughput,color:Rs(C.get(j.key)?.index??0,j.color,j.tone),value:u(w.get(j.key)??0)}]})}),
1018
+ /* @__PURE__ */Ye(Vd,{caption:c.sankey(e.length,t.length),head:[c.tableFrom,c.tableTo,c.value],rows:t.map(e=>[e.from,e.to,u(e.value)])})]})}function lu({labels:e,matrix:t,size:r=340,maxNodes:n=8,padAngle:a=.04,arcWidth:l=12,formatValue:i,className:o,emptyLabel:s}){const c=he().charts,d=ue(),u=i??(e=>fe(e,d)),h=s??c.noFlows,[m,p]=Ee(null),{highlighted:g}=oc(),f=function(e,t,r,n){const a=(e,r)=>{const n=t[e]?.[r];return"number"==typeof n&&Number.isFinite(n)?n:0},l=e.map((t,r)=>e.reduce((e,t,n)=>e+a(r,n)+a(n,r),0)),i=Math.max(2,r),o=e.length>i,s=o?e.map((e,t)=>t).sort((e,t)=>l[t]-l[e]).slice(0,i-1).sort((e,t)=>e-t):e.map((e,t)=>t),c=new Map(s.map((e,t)=>[e,t])),d=o?s.length:-1,u=o?[...s.map(t=>e[t]),n]:[...e],h=u.map(()=>u.map(()=>0));let m=0;e.forEach((t,r)=>e.forEach((e,t)=>{const n=c.get(r)??d,l=c.get(t)??d;n!==d||l!==d?h[n][l]+=a(r,t):m+=a(r,t)}));const p=u.map((e,t)=>u.reduce((e,r,n)=>e+h[t][n]+h[n][t],0));return d>=0&&(p[d]+=m),{labels:u,matrix:h,totals:p,otherIndex:d,foldedCount:o?e.length-s.length:0}}(e,t,n,c.other),{labels:b,matrix:x,otherIndex:y,foldedCount:v}=f,w=(e,t)=>x[e]?.[t]??0,N=e=>e===y?Is.muted:Rs(e),k=f.totals,$=b.map((e,t)=>t).sort((e,t)=>k[t]-k[e]),M=$.reduce((e,t)=>e+k[t],0);if(M<=0)/* @__PURE__ */return Ye("p",{className:`text-sm text-gray-500 ${o??""}`,children:h});const C=r/2,L=r/2,S=r/2-44,D=S-l,P=a*$.length,A=/* @__PURE__ */new Map;let j=-Math.PI/2;$.forEach((e,t)=>{const r=k[e]/M*(2*Math.PI-P);A.set(e,{start:j,end:j+r,slot:t}),j+=r+a});const z=/* @__PURE__ */new Map,F=[];for(const e of $)for(const t of $){const r=w(e,t);if(r<=0)continue;const n=A.get(e),a=r/Math.max(1,k[e])*(n.end-n.start),l=z.get(e)??0;z.set(e,l+a),F.push({from:e,to:t,value:r,a:n.start+l+a/2,b:A.get(t).start+(A.get(t).end-A.get(t).start)/2})}const E=(e,t)=>[C+t*Math.cos(e),L+t*Math.sin(e)],B="arc"===m?.kind?m.index:void 0,T="ribbon"===m?.kind?F[m.index]:void 0;/* @__PURE__ */
1021
1019
  return Ge("div",{className:`relative ${o??""}`,children:[
1022
1020
  /* @__PURE__ */Ge("svg",{width:"100%",height:r,viewBox:`0 0 ${r} ${r}`,role:"img","aria-label":c.chord($.length),onMouseLeave:()=>p(null),children:[F.map((e,t)=>{const[n,a]=E(e.a,D),[l,i]=E(e.b,D),o=N(e.from),s=((e,t)=>m?"ribbon"===m.kind?m.index===t:m.index===e.from||m.index===e.to:null!==g?b[e.from]===g||b[e.to]===g:null)(e,t);/* @__PURE__ */
1023
1021
  return Ye("path",{d:`M${n},${a} Q${C},${L} ${l},${i}`,fill:"none",stroke:o,strokeWidth:Math.max(1,e.value/M*r*.9),strokeOpacity:null===s||s?.34:.07,strokeLinecap:"round",onMouseEnter:()=>p({kind:"ribbon",index:t})},`${b[e.from]}→${b[e.to]}`)}),$.map(e=>{const t=A.get(e),r=(t.start+t.end)/2,[n,a]=E(r,S+16),l=(e=>m?"arc"===m.kind?m.index===e:F[m.index].from===e||F[m.index].to===e:null!==g?b[e]===g:null)(e);/* @__PURE__ */
1024
1022
  return Ge("g",{onMouseEnter:()=>p({kind:"arc",index:e}),children:[
1025
- /* @__PURE__ */Ye("path",{d:vc(C,L,D,S,t.start,t.end),fill:N(e),fillOpacity:null===l||l?1:.45}),
1026
- /* @__PURE__ */Ye("text",{x:n,y:a+4,fontSize:11,fill:Bs.label,textAnchor:Math.cos(r)>.15?"start":Math.cos(r)<-.15?"end":"middle",children:b[e]})]},e)})]}),v>0&&/* @__PURE__ */Ye("p",{className:"mt-1 text-xs text-gray-500",children:c.chordFolded(v)}),void 0!==B&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:b[B],rows:[{key:"total",label:c.totalFlow,color:N(B),value:u(k[B])}]})}),T&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(sc,{title:`${b[T.from]} → ${b[T.to]}`,rows:[{key:"value",label:c.flow,color:N(T.from),value:u(T.value)}]})}),
1027
- /* @__PURE__ */Ye(_d,{caption:c.chord($.length),head:[c.tableFrom,c.tableTo,c.value],rows:F.map(e=>[b[e.from],b[e.to],u(e.value)])})]})}export{us as APP_UPDATE_POLL_MS,Rl as Accordion,da as AlignmentGrid,ms as AppUpdateBanner,fa as AttachButton,pa as AttachmentDropZone,ga as AttachmentList,_c as AuthScreen,Ll as Avatar,Sl as AvatarGroup,il as BORDER_WIDTHS,zl as Banner,Kd as BoxPlotChart,Rt as BrandAssetEditor,ni as BudgetBar,Bs as CHART_INK,mn as COLUMN_COUNT_MAX,gn as COLUMN_COUNT_WIDTHS,fn as COLUMN_SHARES_EQUAL,pn as COLUMN_SHARE_MIN,el as CONTROL_HEIGHTS,ld as CORNERS,rr as Calendar,qd as CandlestickChart,za as Card,tc as CartesianPlot,Pd as ChartBrush,gi as ChartDefs,Dd as ChartDot,Sd as ChartFrame,ac as ChartHighlightProvider,rc as ChartSkeleton,sc as ChartTooltip,Rc as ChatTemplate,bt as Checkbox_default,Fc as CheckoutTemplate,nu as ChordChart,Yn as ColorPicker,Un as ColorPickerPanel,Kn as ColorSwatch,Wl as ColoredBadge,cc as ColumnChart,ba as ComposerAttachments,po as ContainerFillChart,Wo as ContextMenu,sa as CornersInput,vl as CountBadge,ai as DAY_MS,Lc as DashboardTemplate,Ds as DataTable,Pc as DataTablePage,kr as DatePicker_default,hr as DateRangePicker,Lr as DateTimePicker_default,fl as DescriptionList,hn as DisplayChips,Za as Divider,bs as Drawer,To as DropdownMenu,sl as ELEVATION_LEVELS,Tc as EmailTemplate,Kl as EmptyState,pd as EmptyValue,Gc as ErrorBoundary,Vc as ErrorPage,al as FONT_WEIGHTS,ua as FilePicker_default,Oo as FloatingBar,kt as FormErrorSummary,vt as FormField,zc as FormLayoutPage,Zd as FunnelChart,ya as GROUP_COLORS,va as GROUP_COLORS_SOLID,qc as GalleryTemplate,Ga as Grid,Hd as HeatmapChart,Co as HelpCenter,Vn as HexInput,Wd as HistogramChart,Je as IconButton_default,cs as IconRail,ds as IconRailButton,Zn as ImageFocusPoint,_a as Inline,rn as InputNumber_default,Qe as Input_default,xs as Kanban,Ct as Label,md as LanguagePanel,hd as LanguageSelect,aa as LinkPicker,Ps as ListFooter,As as ListLoadError,ls as ListRow,Br as MAX_FRACTION_DIGITS,bi as MOTION,ll as MOTION_DURATIONS,$o as Markdown,Ot as MediaUploadField,Vt as MediaUploadGrid,kd as Meter,Ql as MetricBar,ao as MilestoneTimeline,ht as NativeSelect,Rr as NumericKeypad,lo as POST_PRODUCTION_STATUSES,ql as PageHeader,vs as Pagination,ha as PaperclipGlyph,Ra as Paragraph,wc as PieChart,Pn as Popover,Ht as PortalBrandingProvider,ho as ProductionTimeline,Ud as RADAR_SERIES_CAP,ol as RADIUS_ROLES,tl as ROW_HEIGHTS,Yd as RadarChart,Xd as RadialBarChart,Nt as RadioGroup,yt as Radio_default,Od as RangeChart,wd as RankedBars,Td as SCATTER_SERIES_CAP,js as SERIES_SLOT_COUNT,Fs as SERIES_VARS,Qa as SPACING_ROLES,Ja as SPACING_SCALE,io as STAGES,Es as STATUS_VARS,ru as SankeyChart,Id as ScatterChart,Qn as SearchableSelect,Yr as Segmented,gt as Select_default,xl as SettingRow,So as SidebarActionButton,Po as SidebarGroupLabel,jo as SidebarNavGroup,zo as SidebarNavItem,ul as Skeleton,un as Slider,dn as SliderGroup,Er as Snippet,as as SortableList,zs as Sparkline,Ha as Stack,ja as StatCard,Md as StatTile,kl as Statistic,La as StatusBadge,Ma as StatusBadgeProvider,Ol as Stepper,tu as SunburstChart,Jr as Switch_default,nl as TYPE_SCALE,Tl as Tabs,Da as TagInput,Ta as Text,la as TextLinkField,et as Textarea_default,Kr as TileButton_default,gd as TimeAgo,fr as TimePicker_default,Bd as TimeSeriesChart,ro as TimelineTrack,Oa as Title,Fo as TopNav,Xo as Tree,ts as TreeEmptySlot,Zo as TreeGroup,Jo as TreeGroupLabel,es as TreeRow,rs as TreeSeam,Jd as TreemapChart,Rd as WaterfallChart,Sn as WidthsBar,Gs as angleScale,Tr as appendKey,od as applyCorners,sd as applyIconSet,cd as applyThemePrefs,vc as arcPath,xc as areaBetween,bc as areaFrom,Os as assignSeriesSlots,oc as autoHighlightIndex,Ir as backspace,qs as bandScale,Zs as binValues,ti as budgetState,gc as bumpPath,oo as calcOverall,so as calcReportOverall,Rn as colorFill,Wn as colorSwatchClasses,yn as columnSharesWidths,Pr as copyToClipboard,fc as curvePath,hi as dashFor,ui as fillFor,oi as fillId,tt as firstEnabledIndex,ii as fmtSliderDate,Zt as fromKey,si as glowId,di as groundId,wa as groupColors,En as hexToHsv,ic as highlightOpacity,Bn as hsvToHex,_l as isSeverityTone,rl as isSpacingStep,Mt as labelClasses,Hs as ladderScale,ud as languageSelectWidth,rt as lastEnabledIndex,uc as linearPath,Ks as linearScale,Ys as logScale,ci as maskId,at as matchTypeahead,St as mediaFileName,mc as monotonePath,nt as nextEnabledIndex,Us as niceAxis,_s as niceMax,zn as parseHexColor,yc as polygonPoints,Xs as radiusScale,xn as resolveColumnShares,vn as resolveColumnWidths,id as resolveCorners,Wt as resolvePortalBrandAsset,Is as resolveSeriesColor,Ws as resolveSeriesColorWithin,rd as resolveTheme,Sr as selectionAt,Ts as seriesColor,Ul as severityOf,pc as splinePath,vd as squarify,xi as stagger,hc as stepPath,jl as tabButtonId,Fl as tabPanelId,li as toDayMs,ir as toISODate,Xt as toKey,Rs as toggleSeriesSlot,hs as useAppUpdate,bd as useClickOutside,Ko as useContextMenu,fd as useDebouncedValue,lc as useHighlight,Qs as usePlotWidth,_t as usePortalBranding,co as useProductionTimeline,Ca as useStatusLabel,dd as useTheme};
1023
+ /* @__PURE__ */Ye("path",{d:Nc(C,L,D,S,t.start,t.end),fill:N(e),fillOpacity:null===l||l?1:.45}),
1024
+ /* @__PURE__ */Ye("text",{x:n,y:a+4,fontSize:11,fill:Is.label,textAnchor:Math.cos(r)>.15?"start":Math.cos(r)<-.15?"end":"middle",children:b[e]})]},e)})]}),v>0&&/* @__PURE__ */Ye("p",{className:"mt-1 text-xs text-gray-500",children:c.chordFolded(v)}),void 0!==B&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:b[B],rows:[{key:"total",label:c.totalFlow,color:N(B),value:u(k[B])}]})}),T&&/* @__PURE__ */Ye("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */Ye(dc,{title:`${b[T.from]} → ${b[T.to]}`,rows:[{key:"value",label:c.flow,color:N(T.from),value:u(T.value)}]})}),
1025
+ /* @__PURE__ */Ye(Vd,{caption:c.chord($.length),head:[c.tableFrom,c.tableTo,c.value],rows:F.map(e=>[b[e.from],b[e.to],u(e.value)])})]})}export{ms as APP_UPDATE_POLL_MS,Rl as Accordion,da as AlignmentGrid,gs as AppUpdateBanner,fa as AttachButton,pa as AttachmentDropZone,ga as AttachmentList,Vc as AuthScreen,Ll as Avatar,Sl as AvatarGroup,il as BORDER_WIDTHS,jl as Banner,qd as BoxPlotChart,Rt as BrandAssetEditor,ni as BudgetBar,Is as CHART_INK,mn as COLUMN_COUNT_MAX,gn as COLUMN_COUNT_WIDTHS,fn as COLUMN_SHARES_EQUAL,pn as COLUMN_SHARE_MIN,el as CONTROL_HEIGHTS,od as CORNERS,rr as Calendar,Hd as CandlestickChart,ja as Card,nc as CartesianPlot,jd as ChartBrush,gi as ChartDefs,Ad as ChartDot,Pd as ChartFrame,ic as ChartHighlightProvider,ac as ChartSkeleton,dc as ChartTooltip,Kc as ChatTemplate,bt as Checkbox_default,Bc as CheckoutTemplate,lu as ChordChart,Yn as ColorPicker,Un as ColorPickerPanel,Kn as ColorSwatch,Wl as ColoredBadge,uc as ColumnChart,ba as ComposerAttachments,po as ContainerFillChart,Wo as ContextMenu,sa as CornersInput,vl as CountBadge,ai as DAY_MS,Dc as DashboardTemplate,As as DataTable,jc as DataTablePage,kr as DatePicker_default,hr as DateRangePicker,Lr as DateTimePicker_default,fl as DescriptionList,hn as DisplayChips,Za as Divider,ys as Drawer,To as DropdownMenu,sl as ELEVATION_LEVELS,Oc as EmailTemplate,Kl as EmptyState,fd as EmptyValue,Zc as ErrorBoundary,Gc as ErrorPage,al as FONT_WEIGHTS,ua as FilePicker_default,Oo as FloatingBar,kt as FormErrorSummary,vt as FormField,Fc as FormLayoutPage,Qd as FunnelChart,ya as GROUP_COLORS,va as GROUP_COLORS_SOLID,Hc as GalleryTemplate,Ga as Grid,Ud as HeatmapChart,Co as HelpCenter,Vn as HexInput,_d as HistogramChart,Je as IconButton_default,us as IconRail,hs as IconRailButton,Zn as ImageFocusPoint,Ha as Inline,rn as InputNumber_default,Qe as Input_default,vs as Kanban,Ct as Label,gd as LanguagePanel,pd as LanguageSelect,aa as LinkPicker,js as ListFooter,zs as ListLoadError,os as ListRow,Br as MAX_FRACTION_DIGITS,bi as MOTION,ll as MOTION_DURATIONS,$o as Markdown,Ot as MediaUploadField,Vt as MediaUploadGrid,Md as Meter,Ql as MetricBar,ao as MilestoneTimeline,ht as NativeSelect,Rr as NumericKeypad,lo as POST_PRODUCTION_STATUSES,_l as PageHeader,Ns as Pagination,ha as PaperclipGlyph,Ra as Paragraph,kc as PieChart,Pn as Popover,qt as PortalBrandingProvider,ho as ProductionTimeline,Yd as RADAR_SERIES_CAP,ol as RADIUS_ROLES,tl as ROW_HEIGHTS,Xd as RadarChart,Jd as RadialBarChart,Nt as RadioGroup,yt as Radio_default,Wd as RangeChart,kd as RankedBars,Od as SCATTER_SERIES_CAP,Es as SERIES_SLOT_COUNT,Bs as SERIES_VARS,Qa as SPACING_ROLES,Ja as SPACING_SCALE,io as STAGES,Ts as STATUS_VARS,au as SankeyChart,Rd as ScatterChart,Qn as SearchableSelect,Yr as Segmented,gt as Select_default,xl as SettingRow,So as SidebarActionButton,Po as SidebarGroupLabel,zo as SidebarNavGroup,jo as SidebarNavItem,ul as Skeleton,un as Slider,dn as SliderGroup,Er as Snippet,is as SortableList,Fs as Sparkline,qa as Stack,za as StatCard,Ld as StatTile,kl as Statistic,La as StatusBadge,Ma as StatusBadgeProvider,Ol as Stepper,nu as SunburstChart,Jr as Switch_default,nl as TYPE_SCALE,Tl as Tabs,Da as TagInput,Ta as Text,la as TextLinkField,et as Textarea_default,Kr as TileButton_default,bd as TimeAgo,fr as TimePicker_default,Id as TimeSeriesChart,ro as TimelineTrack,Oa as Title,Fo as TopNav,Xo as Tree,ns as TreeEmptySlot,Zo as TreeGroup,Qo as TreeGroupLabel,rs as TreeRow,as as TreeSeam,eu as TreemapChart,Kd as WaterfallChart,Sn as WidthsBar,Zs as angleScale,Tr as appendKey,cd as applyCorners,dd as applyIconSet,ud as applyThemePrefs,Nc as arcPath,vc as areaBetween,yc as areaFrom,Ws as assignSeriesSlots,cc as autoHighlightIndex,Ir as backspace,Hs as bandScale,Qs as binValues,ti as budgetState,bc as bumpPath,oo as calcOverall,so as calcReportOverall,Rn as colorFill,Wn as colorSwatchClasses,yn as columnSharesWidths,Pr as copyToClipboard,xc as curvePath,hi as dashFor,ui as fillFor,oi as fillId,tt as firstEnabledIndex,ii as fmtSliderDate,Zt as fromKey,si as glowId,di as groundId,wa as groupColors,En as hexToHsv,sc as highlightOpacity,Bn as hsvToHex,Hl as isSeverityTone,rl as isSpacingStep,Mt as labelClasses,Us as ladderScale,md as languageSelectWidth,rt as lastEnabledIndex,mc as linearPath,qs as linearScale,Xs as logScale,ci as maskId,at as matchTypeahead,St as mediaFileName,gc as monotonePath,nt as nextEnabledIndex,Ys as niceAxis,Vs as niceMax,jn as parseHexColor,wc as polygonPoints,Js as radiusScale,xn as resolveColumnShares,vn as resolveColumnWidths,sd as resolveCorners,Wt as resolvePortalBrandAsset,Rs as resolveSeriesColor,_s as resolveSeriesColorWithin,ad as resolveTheme,Sr as selectionAt,Os as seriesColor,Ul as severityOf,fc as splinePath,Nd as squarify,xi as stagger,pc as stepPath,zl as tabButtonId,Fl as tabPanelId,li as toDayMs,ir as toISODate,Xt as toKey,Ks as toggleSeriesSlot,ps as useAppUpdate,yd as useClickOutside,Ko as useContextMenu,xd as useDebouncedValue,oc as useHighlight,tc as usePlotWidth,Ht as usePortalBranding,co as useProductionTimeline,Ca as useStatusLabel,hd as useTheme};